superdoc 2.28.0-next.14 β 2.28.0-next.15
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/types/clipboard.d.ts +5 -1
- package/dist/layout-engine/contracts/src/index.d.ts +2 -1
- package/dist/layout-engine/contracts/src/run-helpers.d.ts +1 -0
- package/dist/layout-engine/layout-bridge/src/marker-run-key.d.ts +2 -0
- package/dist/layout-engine/layout-engine/src/paginator.d.ts +1 -0
- package/dist/layout-engine/style-engine/src/ooxml/index.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 l5=Object.create,pp=Object.defineProperty,c5=Object.getOwnPropertyDescriptor,u5=Object.getOwnPropertyNames,d5=Object.getPrototypeOf,f5=Object.prototype.hasOwnProperty,eo=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(r){throw n=[r],r}},dw=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),uf=(e,t)=>{let n={};for(var r in e)pp(n,r,{get:e[r],enumerable:!0});return t||pp(n,Symbol.toStringTag,{value:"Module"}),n},h5=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(var o=u5(t),i=0,s=o.length,a;i<s;i++)a=o[i],!f5.call(e,a)&&a!==n&&pp(e,a,{get:(l=>t[l]).bind(null,a),enumerable:!(r=c5(t,a))||r.enumerable});return e},fw=(e,t,n)=>(n=e!=null?l5(d5(e)):{},h5(t||!e||!e.__esModule?pp(n,"default",{value:e,enumerable:!0}):n,e)),p5=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"]),m5=new Set(["text","data","message","errorMessage","quotedText"]),g5=["keydown","keyup","beforeinput","pointerdown","pointermove","pointerup","click","dblclick","mousedown","mouseup","scroll","compositionstart","compositionend","paste","cut","drop","dragstart"],v5=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"]),y5=0;function Ru(e,t){return e&&typeof e=="object"?Object.getOwnPropertyDescriptor(e,t)?.value:void 0}function hw(e,t,n){return typeof e=="number"&&Number.isSafeInteger(e)&&e>0&&e<=n?e:t}var b5=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.active;this.api=Object.freeze({get active(){return n()},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 g5){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=hw(Ru(e,"maxEvents"),2e4,1e5),this.maxBytes=hw(Ru(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()}-${++y5}`,version:this.version(),status:"recording",startedAt:Date.now(),durationMs:0,timeOrigin:t.performance.timeOrigin,startTimeMs:this.startMs,captureContent:Ru(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(Ru(s,String(d)),a+1)??null)}const l={};for(const u of p5){const d=Ru(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 m5){const d=Ru(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[g,y]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 _=p.getAttribute(g);_&&s[y]==null&&(s[y]=y==="pageIndex"?Number(_):_)}const v=p.getAttribute("data-sdt-id")??p.getAttribute("data-sdt-container-id");v&&d.add(v),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 h=[];for(let p=t;p;p=p.parentElement){const v=this.root.ownerDocument.defaultView.getComputedStyle(p),g=p===this.root||/auto|scroll/.test(`${v.overflowX} ${v.overflowY}`);if(p.scrollLeft||p.scrollTop||g&&(p.scrollWidth>p.clientWidth||p.scrollHeight>p.clientHeight)){const y=[];let _=p;for(;_&&_!==this.root;){const w=_.parentElement;if(!w)break;y.unshift(`:nth-child(${Array.prototype.indexOf.call(w.children,_)+1})`),_=w}_===this.root&&h.push({selector:p===this.root?null:`:scope > ${y.join(" > ")}`,scrollLeft:p.scrollLeft,scrollTop:p.scrollTop})}if(p===this.root)break;if(h.length>=32)throw new Error("scroll-ancestor-limit")}s.scrollAncestors=h}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=v5.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 pw(e){try{return Rs(Rs(Rs(e,"diagnostics"),"recording"),"enabled")===!0}catch{return!1}}var Lu=new WeakMap,w5=0,mw=["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"],C5=["text","data","message","errorMessage","quotedText","value"];function Rs(e,t){if(!(!e||typeof e!="object"))return Object.getOwnPropertyDescriptor(e,t)?.value}function gw(e,t,n){return typeof e=="number"&&Number.isSafeInteger(e)&&e>0&&e<=n?e:t}var k5=class{constructor(e,t,n){if(this.version=t,this.sessionId=`interaction-${++w5}`,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=[],pw(e))try{this.workflow=new b5(n,t)}catch{}const r=Rs(Rs(e,"diagnostics"),"history");this.enabled=Rs(r,"enabled")!==!1,this.captureContent=Rs(r,"captureContent")===!0,this.maxEvents=gw(Rs(r,"maxEvents"),500,1e4),this.maxBytes=gw(Rs(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 h=Math.min(l.length,16);l.length>h&&(n=!0);const p=[];for(let v=0;v<h&&r>0;v++)p.push(o(Rs(l,String(v)),u+1)??null);return p}const d={};for(const h of this.captureContent?[...mw,...C5]:mw){if(r<=0){n=!0;break}const p=Rs(l,h);if(p===void 0)continue;const v=o(p,u+1);v!==void 0&&(d[h]=v)}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=[]}},vw=()=>({schemaVersion:1,sessionId:"unavailable",version:"unknown",enabled:!1,events:[],retainedBytes:0,evictedEvents:0,truncatedEvents:0,captureFailures:1}),S5=Object.freeze({getSnapshot:vw,clear(){}});function _5(e,t,n,r){try{const o=new k5(t,n,r);Lu.set(e,o),o.attach(r);const i=Object.freeze({...o.workflow?{recording:o.workflow.api}:{},getSnapshot:()=>{try{return o.snapshot()}catch{return vw()}},clear:()=>{try{o.clear()}catch{}}});return o.record("instance:created",()=>({})),i}catch{return S5}}function df(e,t,n){try{e&&Lu.get(e)?.record(t,n)}catch{}}function A5(e,t,n){try{const r=Lu.get(e),o=r?.action();return o&&r?.record(t,()=>({...n(),actionId:o})),o}catch{return}}function I5(e){try{Lu.get(e)?.close(),Lu.delete(e)}catch{}}function E5(e){return Lu.get(e)?.workflow?.api}var T5=dw(((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,h){this.fn=u,this.context=d,this.once=h||!1}function s(u,d,h,p,v){if(typeof h!="function")throw new TypeError("The listener must be a function");var g=new i(h,p||u,v),y=r?r+d:d;return u._events[y]?u._events[y].fn?u._events[y]=[u._events[y],g]:u._events[y].push(g):(u._events[y]=g,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=[],h,p;if(this._eventsCount===0)return d;for(p in h=this._events)n.call(h,p)&&d.push(r?p.slice(1):p);return Object.getOwnPropertySymbols?d.concat(Object.getOwnPropertySymbols(h)):d},l.prototype.listeners=function(d){var h=r?r+d:d,p=this._events[h];if(!p)return[];if(p.fn)return[p.fn];for(var v=0,g=p.length,y=new Array(g);v<g;v++)y[v]=p[v].fn;return y},l.prototype.listenerCount=function(d){var h=r?r+d:d,p=this._events[h];return p?p.fn?1:p.length:0},l.prototype.emit=function(d,h,p,v,g,y){var _=r?r+d:d;if(!this._events[_])return!1;var w=this._events[_],I=arguments.length,k,C;if(w.fn){switch(w.once&&this.removeListener(d,w.fn,void 0,!0),I){case 1:return w.fn.call(w.context),!0;case 2:return w.fn.call(w.context,h),!0;case 3:return w.fn.call(w.context,h,p),!0;case 4:return w.fn.call(w.context,h,p,v),!0;case 5:return w.fn.call(w.context,h,p,v,g),!0;case 6:return w.fn.call(w.context,h,p,v,g,y),!0}for(C=1,k=new Array(I-1);C<I;C++)k[C-1]=arguments[C];w.fn.apply(w.context,k)}else{var R=w.length,P;for(C=0;C<R;C++)switch(w[C].once&&this.removeListener(d,w[C].fn,void 0,!0),I){case 1:w[C].fn.call(w[C].context);break;case 2:w[C].fn.call(w[C].context,h);break;case 3:w[C].fn.call(w[C].context,h,p);break;case 4:w[C].fn.call(w[C].context,h,p,v);break;default:if(!k)for(P=1,k=new Array(I-1);P<I;P++)k[P-1]=arguments[P];w[C].fn.apply(w[C].context,k)}}return!0},l.prototype.on=function(d,h,p){return s(this,d,h,p,!1)},l.prototype.once=function(d,h,p){return s(this,d,h,p,!0)},l.prototype.removeListener=function(d,h,p,v){var g=r?r+d:d;if(!this._events[g])return this;if(!h)return a(this,g),this;var y=this._events[g];if(y.fn)y.fn===h&&(!v||y.once)&&(!p||y.context===p)&&a(this,g);else{for(var _=0,w=[],I=y.length;_<I;_++)(y[_].fn!==h||v&&!y[_].once||p&&y[_].context!==p)&&w.push(y[_]);w.length?this._events[g]=w.length===1?w[0]:w:a(this,g)}return this},l.prototype.removeAllListeners=function(d){var h;return d?(h=r?r+d:d,this._events[h]&&a(this,h)):(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)})),Lv=fw(T5(),1),qo=[];for(let e=0;e<256;++e)qo.push((e+256).toString(16).slice(1));function x5(e,t=0){return(qo[e[t+0]]+qo[e[t+1]]+qo[e[t+2]]+qo[e[t+3]]+"-"+qo[e[t+4]]+qo[e[t+5]]+"-"+qo[e[t+6]]+qo[e[t+7]]+"-"+qo[e[t+8]]+qo[e[t+9]]+"-"+qo[e[t+10]]+qo[e[t+11]]+qo[e[t+12]]+qo[e[t+13]]+qo[e[t+14]]+qo[e[t+15]]).toLowerCase()}var Mv,R5=new Uint8Array(16);function L5(){if(!Mv){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Mv=crypto.getRandomValues.bind(crypto)}return Mv(R5)}var M5=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),yw={randomUUID:M5};function Ua(e,t,n){if(yw.randomUUID&&!t&&!e)return yw.randomUUID();e=e||{};const r=e.random??e.rng?.()??L5();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 x5(r)}function ff(e){const t=Object.create(null);for(const n of e.split(","))t[n]=1;return n=>n in t}function xn(e){if(qt(e)){const t={};for(let n=0;n<e.length;n++){const r=e[n],o=yr(r)?O5(r):xn(r);if(o)for(const i in o)t[i]=o[i]}return t}else if(yr(e)||Zn(e))return e}function O5(e){const t={};return e.replace(xw,"").split(Ew).forEach(n=>{if(n){const r=n.split(Tw);r.length>1&&(t[r[0].trim()]=r[1].trim())}}),t}function cn(e){let t="";if(yr(e))t=e;else if(qt(e))for(let n=0;n<e.length;n++){const r=cn(e[n]);r&&(t+=r+" ")}else if(Zn(e))for(const n in e)e[n]&&(t+=n+" ");return t.trim()}function Ov(e){if(!e)return null;let{class:t,style:n}=e;return t&&!yr(t)&&(e.class=cn(t)),n&&(e.style=xn(n)),e}function bw(e){return!!e||e===""}function P5(e,t){if(e.length!==t.length)return!1;let n=!0;for(let r=0;n&&r<e.length;r++)n=ja(e[r],t[r]);return n}function ja(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=Ri(e),r=Ri(t),n||r)return e===t;if(n=qt(e),r=qt(t),n||r)return n&&r?P5(e,t):!1;if(n=Zn(e),r=Zn(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||!ja(e[o],t[o]))return!1}}return String(e)===String(t)}function mp(e,t){return e.findIndex(n=>ja(n,t))}function D5(e){return e==null?"initial":typeof e=="string"?e===""?" ":e:(typeof e!="number"||Number.isFinite(e),String(e))}var Hn,Uc,$i,Pv,Mu,hf,dr,gp,ww,or,qt,jc,Vl,Dv,Cw,fn,yr,Ri,Zn,vp,Fv,$c,kw,pf,mf,Ul,gf,Sw,fo,_w,bi,Ou,Pu,Po,Hc,Nv,vf,yf,Aw,bf,Iw,Ew,Tw,xw,Bv,Rw,F5,zv,Et,Vv,yp,Uv=eo((()=>{Hn={},Uc=[],$i=()=>{},Pv=()=>!1,Mu=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),hf=e=>e.startsWith("onUpdate:"),dr=Object.assign,gp=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},ww=Object.prototype.hasOwnProperty,or=(e,t)=>ww.call(e,t),qt=Array.isArray,jc=e=>$c(e)==="[object Map]",Vl=e=>$c(e)==="[object Set]",Dv=e=>$c(e)==="[object Date]",Cw=e=>$c(e)==="[object RegExp]",fn=e=>typeof e=="function",yr=e=>typeof e=="string",Ri=e=>typeof e=="symbol",Zn=e=>e!==null&&typeof e=="object",vp=e=>(Zn(e)||fn(e))&&fn(e.then)&&fn(e.catch),Fv=Object.prototype.toString,$c=e=>Fv.call(e),kw=e=>$c(e).slice(8,-1),pf=e=>$c(e)==="[object Object]",mf=e=>yr(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,Ul=ff(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),gf=e=>{const t=Object.create(null);return(n=>t[n]||(t[n]=e(n)))},Sw=/-\w/g,fo=gf(e=>e.replace(Sw,t=>t.slice(1).toUpperCase())),_w=/\B([A-Z])/g,bi=gf(e=>e.replace(_w,"-$1").toLowerCase()),Ou=gf(e=>e.charAt(0).toUpperCase()+e.slice(1)),Pu=gf(e=>e?`on${Ou(e)}`:""),Po=(e,t)=>!Object.is(e,t),Hc=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},Nv=(e,t,n,r=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:r,value:n})},vf=e=>{const t=parseFloat(e);return isNaN(t)?e:t},yf=e=>{const t=yr(e)?Number(e):NaN;return isNaN(t)?e:t},bf=()=>Aw||(Aw=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}),Iw=ff("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"),Ew=/;(?![^(]*\))/g,Tw=/:([^]+)/,xw=/\/\*[^]*?\*\//g,Bv="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",Rw=ff(Bv),F5=ff(Bv+",async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected"),zv=e=>!!(e&&e.__v_isRef===!0),Et=e=>yr(e)?e:e==null?"":qt(e)||Zn(e)&&(e.toString===Fv||!fn(e.toString))?zv(e)?Et(e.value):JSON.stringify(e,Vv,2):String(e),Vv=(e,t)=>zv(t)?Vv(e,t.value):jc(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((n,[r,o],i)=>(n[yp(r,i)+" =>"]=o,n),{})}:Vl(t)?{[`Set(${t.size})`]:[...t.values()].map(n=>yp(n))}:Ri(t)?yp(t):Zn(t)&&!qt(t)&&!pf(t)?String(t):t,yp=(e,t="")=>{var n;return Ri(e)?`Symbol(${(n=e.description)!=null?n:t})`:e}}));function jv(e){return new _p(e)}function $v(){return si}function Lw(e,t=!1){si&&si.cleanups.push(e)}function Mw(e,t=!1){if(e.flags|=8,t){e.next=Sf,Sf=e;return}e.next=kf,kf=e}function Hv(){Qv++}function Gv(){if(--Qv>0)return;if(Sf){let t=Sf;for(Sf=void 0;t;){const n=t.next;t.next=void 0,t.flags&=-9,t=n}}let e;for(;kf;){let t=kf;for(kf=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 Ow(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function Pw(e){let t,n=e.depsTail,r=n;for(;r;){const o=r.prevDep;r.version===-1?(r===n&&(n=o),qv(r),N5(r)):t=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=o}e.deps=t,e.depsTail=n}function Wv(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(Dw(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function Dw(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===Nu)||(e.globalVersion=Nu,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!Wv(e))))return;e.flags|=2;const t=e.dep,n=Ar,r=ds;Ar=e,ds=!0;try{Ow(e);const o=e.fn(e._value);(t.version===0||Po(o,e._value))&&(e.flags|=128,e._value=o,t.version++)}catch(o){throw t.version++,o}finally{Ar=n,ds=r,Pw(e),e.flags&=-3}}function qv(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)qv(i,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function N5(e){const{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}function B5(e,t){e.effect instanceof Fu&&(e=e.effect.fn);const n=new Fu(e);t&&dr(n,t);try{n.run()}catch(o){throw n.stop(),o}const r=n.run.bind(n);return r.effect=n,r}function z5(e){e.effect.stop()}function $a(){Jv.push(ds),ds=!1}function Ha(){const e=Jv.pop();ds=e===void 0?!0:e}function Fw(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const n=Ar;Ar=void 0;try{t()}finally{Ar=n}}}function Nw(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)Nw(r)}const n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}function ii(e,t,n){if(ds&&Ar){let r=Af.get(e);r||Af.set(e,r=new Map);let o=r.get(n);o||(r.set(n,o=new _f),o.map=r,o.key=n),o.track()}}function Ga(e,t,n,r,o,i){const s=Af.get(e);if(!s){Nu++;return}const a=l=>{l&&l.trigger()};if(Hv(),t==="clear")s.forEach(a);else{const l=qt(e),u=l&&mf(n);if(l&&n==="length"){const d=Number(r);s.forEach((h,p)=>{(p==="length"||p===Bu||!Ri(p)&&p>=d)&&a(h)})}else switch((n!==void 0||s.has(void 0))&&a(s.get(n)),u&&a(s.get(Bu)),t){case"add":l?u&&a(s.get("length")):(a(s.get(jl)),jc(e)&&a(s.get(Ip)));break;case"delete":l||(a(s.get(jl)),jc(e)&&a(s.get(Ip)));break;case"set":jc(e)&&a(s.get(jl));break}}Gv()}function V5(e,t){const n=Af.get(e);return n&&n.get(t)}function Du(e){const t=Rn(e);return t===e?t:(ii(t,"iterate",Bu),Mi(e)?t:t.map(fs))}function bp(e){return ii(e=Rn(e),"iterate",Bu),e}function Js(e,t){return ea(e)?Gc(Li(e)?fs(t):t):fs(t)}function Kv(e,t,n){const r=bp(e),o=r[t]();return r!==e&&!Mi(e)&&(o._next=o.next,o.next=()=>{const i=o._next();return i.done||(i.value=n(i.value)),i}),o}function Wa(e,t,n,r,o,i){const s=bp(e),a=s!==e&&!Mi(e),l=s[t];if(l!==qw[t]){const h=l.apply(e,i);return a?fs(h):h}let u=n;s!==e&&(a?u=function(h,p){return n.call(this,Js(e,h),p,e)}:n.length>2&&(u=function(h,p){return n.call(this,h,p,e)}));const d=l.call(s,u,r);return a&&o?o(d):d}function Bw(e,t,n,r){const o=bp(e),i=o!==e&&!Mi(e);let s=n,a=!1;o!==e&&(i?(a=r.length===0,s=function(u,d,h){return a&&(a=!1,u=Js(e,u)),n.call(this,u,Js(e,d),h,e)}):n.length>3&&(s=function(u,d,h){return n.call(this,u,d,h,e)}));const l=o[t](s,...r);return a?Js(e,l):l}function Yv(e,t,n){const r=Rn(e);ii(r,"iterate",Bu);const o=r[t](...n);return(o===-1||o===!1)&&Cf(n[0])?(n[0]=Rn(n[0]),r[t](...n)):o}function wf(e,t,n=[]){$a(),Hv();const r=Rn(e)[t].apply(e,n);return Gv(),Ha(),r}function U5(e){Ri(e)||(e=String(e));const t=Rn(this);return ii(t,"has",e),t.hasOwnProperty(e)}function j5(e,t,n){return function(...r){const o=this.__v_raw,i=Rn(o),s=jc(i),a=e==="entries"||e===Symbol.iterator&&s,l=e==="keys"&&s,u=o[e](...r),d=n?Ep:t?Gc:fs;return!t&&ii(i,"iterate",l?Ip:jl),dr(Object.create(u),{next(){const{value:h,done:p}=u.next();return p?{value:h,done:p}:{value:a?[d(h[0]),d(h[1])]:d(h),done:p}}})}}function wp(e){return function(...t){return e==="delete"?!1:e==="clear"?void 0:this}}function $5(e,t){const n={get(r){const o=this.__v_raw,i=Rn(o),s=Rn(r);e||(Po(r,s)&&ii(i,"get",r),ii(i,"get",s));const{has:a}=If(i),l=t?Ep:e?Gc:fs;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&&ii(Rn(r),"iterate",jl),r.size},has(r){const o=this.__v_raw,i=Rn(o),s=Rn(r);return e||(Po(r,s)&&ii(i,"has",r),ii(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=Rn(s),l=t?Ep:e?Gc:fs;return!e&&ii(a,"iterate",jl),s.forEach((u,d)=>r.call(o,l(u),l(d),i))}};return dr(n,e?{add:wp("add"),set:wp("set"),delete:wp("delete"),clear:wp("clear")}:{add(r){const o=Rn(this),i=If(o),s=Rn(r),a=!t&&!Mi(r)&&!ea(r)?s:r;return i.has.call(o,a)||Po(r,a)&&i.has.call(o,r)||Po(s,a)&&i.has.call(o,s)||(o.add(a),Ga(o,"add",a,a)),this},set(r,o){!t&&!Mi(o)&&!ea(o)&&(o=Rn(o));const i=Rn(this),{has:s,get:a}=If(i);let l=s.call(i,r);l||(r=Rn(r),l=s.call(i,r));const u=a.call(i,r);return i.set(r,o),l?Po(o,u)&&Ga(i,"set",r,o,u):Ga(i,"add",r,o),this},delete(r){const o=Rn(this),{has:i,get:s}=If(o);let a=i.call(o,r);a||(r=Rn(r),a=i.call(o,r));const l=s?s.call(o,r):void 0,u=o.delete(r);return a&&Ga(o,"delete",r,void 0,l),u},clear(){const r=Rn(this),o=r.size!==0,i=void 0,s=r.clear();return o&&Ga(r,"clear",void 0,void 0,i),s}}),["keys","values","entries",Symbol.iterator].forEach(r=>{n[r]=j5(r,e,t)}),n}function Cp(e,t){const n=$5(e,t);return(r,o,i)=>o==="__v_isReactive"?!e:o==="__v_isReadonly"?e:o==="__v_raw"?r:Reflect.get(or(n,o)&&o in r?n:r,o,i)}function H5(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function G5(e){return e.__v_skip||!Object.isExtensible(e)?0:H5(kw(e))}function vo(e){return ea(e)?e:Sp(e,!1,Yw,Jw,oy)}function zw(e){return Sp(e,!1,Zw,eC,iy)}function kp(e){return Sp(e,!0,Xw,tC,sy)}function W5(e){return Sp(e,!0,Qw,nC,ay)}function Sp(e,t,n,r,o){if(!Zn(e)||e.__v_raw&&!(t&&e.__v_isReactive))return e;const i=G5(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 Li(e){return ea(e)?Li(e.__v_raw):!!(e&&e.__v_isReactive)}function ea(e){return!!(e&&e.__v_isReadonly)}function Mi(e){return!!(e&&e.__v_isShallow)}function Cf(e){return e?!!e.__v_raw:!1}function Rn(e){const t=e&&e.__v_raw;return t?Rn(t):e}function Ko(e){return!or(e,"__v_skip")&&Object.isExtensible(e)&&Nv(e,"__v_skip",!0),e}function Tr(e){return e?e.__v_isRef===!0:!1}function ne(e){return Vw(e,!1)}function Yr(e){return Vw(e,!0)}function Vw(e,t){return Tr(e)?e:new rC(e,t)}function q5(e){e.dep&&e.dep.trigger()}function nt(e){return Tr(e)?e.value:e}function K5(e){return fn(e)?e():nt(e)}function Xv(e){return Li(e)?e:new Proxy(e,oC)}function Uw(e){return new iC(e)}function jw(e){const t=qt(e)?new Array(e.length):{};for(const n in e)t[n]=$w(e,n);return t}function Zv(e,t,n){return Tr(e)?e:fn(e)?new aC(e):Zn(e)&&arguments.length>1?$w(e,t,n):ne(e)}function $w(e,t,n){return new sC(e,t,n)}function Y5(e,t,n=!1){let r,o;return fn(e)?r=e:(r=e.get,o=e.set),new lC(r,o,n)}function X5(){return Ka}function Hw(e,t=!1,n=Ka){if(n){let r=Tf.get(n);r||Tf.set(n,r=[]),r.push(e)}}function Z5(e,t,n=Hn){const{immediate:r,deep:o,once:i,scheduler:s,augmentJob:a,call:l}=n,u=C=>o?C:Mi(C)||o===!1||o===0?qa(C,1):qa(C);let d,h,p,v,g=!1,y=!1;if(Tr(e)?(h=()=>e.value,g=Mi(e)):Li(e)?(h=()=>u(e),g=!0):qt(e)?(y=!0,g=e.some(C=>Li(C)||Mi(C)),h=()=>e.map(C=>{if(Tr(C))return C.value;if(Li(C))return u(C);if(fn(C))return l?l(C,2):C()})):fn(e)?t?h=l?()=>l(e,2):e:h=()=>{if(p){$a();try{p()}finally{Ha()}}const C=Ka;Ka=d;try{return l?l(e,3,[v]):e(v)}finally{Ka=C}}:h=$i,t&&o){const C=h,R=o===!0?1/0:o;h=()=>qa(C(),R)}const _=$v(),w=()=>{d.stop(),_&&_.active&&gp(_.effects,d)};if(i&&t){const C=t;t=(...R)=>{C(...R),w()}}let I=y?new Array(e.length).fill(Ef):Ef;const k=C=>{if(!(!(d.flags&1)||!d.dirty&&!C))if(t){const R=d.run();if(o||g||(y?R.some((P,M)=>Po(P,I[M])):Po(R,I))){p&&p();const P=Ka;Ka=d;try{const M=[R,I===Ef?void 0:y&&I[0]===Ef?[]:I,v];I=R,l?l(t,3,M):t(...M)}finally{Ka=P}}}else d.run()};return a&&a(k),d=new Fu(h),d.scheduler=s?()=>s(k,!1):k,v=C=>Hw(C,!1,d),p=d.onStop=()=>{const C=Tf.get(d);if(C){if(l)l(C,4);else for(const R of C)R();Tf.delete(d)}},t?r?k(!0):I=d.run():s?s(k.bind(null,!0),!0):d.run(),w.pause=d.pause.bind(d),w.resume=d.resume.bind(d),w.stop=w,w}function qa(e,t=1/0,n){if(t<=0||!Zn(e)||e.__v_skip||(n=n||new Map,(n.get(e)||0)>=t))return e;if(n.set(e,t),t--,Tr(e))qa(e.value,t,n);else if(qt(e))for(let r=0;r<e.length;r++)qa(e[r],t,n);else if(Vl(e)||jc(e))e.forEach(r=>{qa(r,t,n)});else if(pf(e)){for(const r in e)qa(e[r],t,n);for(const r of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,r)&&qa(e[r],t,n)}return e}var si,_p,Ar,Ap,Fu,Qv,kf,Sf,ds,Jv,Nu,Gw,_f,Af,jl,Ip,Bu,Ww,qw,Kw,ey,ty,ny,ry,Yw,Xw,Zw,Qw,Ep,If,Jw,eC,tC,nC,oy,iy,sy,ay,fs,Gc,rC,oC,iC,sC,aC,lC,cC,uC,Ef,Tf,Ka,Q5=eo((()=>{Uv(),_p=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=si,!e&&si&&(this.index=(si.scopes||(si.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=si;try{return si=this,e()}finally{si=t}}}on(){++this._on===1&&(this.prevScope=si,si=this)}off(){this._on>0&&--this._on===0&&(si=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}}},Ap=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,si&&si.active&&si.effects.push(this)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,Ap.has(this)&&(Ap.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||Mw(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,Fw(this),Ow(this);const e=Ar,t=ds;Ar=this,ds=!0;try{return this.fn()}finally{Pw(this),Ar=e,ds=t,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)qv(e);this.deps=this.depsTail=void 0,Fw(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?Ap.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){Wv(this)&&this.run()}get dirty(){return Wv(this)}},Qv=0,ds=!0,Jv=[],Nu=0,Gw=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}},_f=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(!Ar||!ds||Ar===this.computed)return;let t=this.activeLink;if(t===void 0||t.sub!==Ar)t=this.activeLink=new Gw(Ar,this),Ar.deps?(t.prevDep=Ar.depsTail,Ar.depsTail.nextDep=t,Ar.depsTail=t):Ar.deps=Ar.depsTail=t,Nw(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=Ar.depsTail,t.nextDep=void 0,Ar.depsTail.nextDep=t,Ar.depsTail=t,Ar.deps===t&&(Ar.deps=n)}return t}trigger(e){this.version++,Nu++,this.notify(e)}notify(e){Hv();try{for(let t=this.subs;t;t=t.prevSub)t.sub.notify()&&t.sub.dep.notify()}finally{Gv()}}},Af=new WeakMap,jl=Symbol(""),Ip=Symbol(""),Bu=Symbol(""),Ww={__proto__:null,[Symbol.iterator](){return Kv(this,Symbol.iterator,e=>Js(this,e))},concat(...e){return Du(this).concat(...e.map(t=>qt(t)?Du(t):t))},entries(){return Kv(this,"entries",e=>(e[1]=Js(this,e[1]),e))},every(e,t){return Wa(this,"every",e,t,void 0,arguments)},filter(e,t){return Wa(this,"filter",e,t,n=>n.map(r=>Js(this,r)),arguments)},find(e,t){return Wa(this,"find",e,t,n=>Js(this,n),arguments)},findIndex(e,t){return Wa(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return Wa(this,"findLast",e,t,n=>Js(this,n),arguments)},findLastIndex(e,t){return Wa(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return Wa(this,"forEach",e,t,void 0,arguments)},includes(...e){return Yv(this,"includes",e)},indexOf(...e){return Yv(this,"indexOf",e)},join(e){return Du(this).join(e)},lastIndexOf(...e){return Yv(this,"lastIndexOf",e)},map(e,t){return Wa(this,"map",e,t,void 0,arguments)},pop(){return wf(this,"pop")},push(...e){return wf(this,"push",e)},reduce(e,...t){return Bw(this,"reduce",e,t)},reduceRight(e,...t){return Bw(this,"reduceRight",e,t)},shift(){return wf(this,"shift")},some(e,t){return Wa(this,"some",e,t,void 0,arguments)},splice(...e){return wf(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 wf(this,"unshift",e)},values(){return Kv(this,"values",e=>Js(this,e))}},qw=Array.prototype,Kw=ff("__proto__,__v_isRef,__isVue"),ey=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(Ri)),ty=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?ay:sy:o?iy:oy).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(n)?e:void 0;const i=qt(e);if(!r){let a;if(i&&(a=Ww[t]))return a;if(t==="hasOwnProperty")return U5}const s=Reflect.get(e,t,Tr(e)?e:n);if((Ri(t)?ey.has(t):Kw(t))||(r||ii(e,"get",t),o))return s;if(Tr(s)){const a=i&&mf(t)?s:s.value;return r&&Zn(a)?kp(a):a}return Zn(s)?r?kp(s):vo(s):s}},ny=class extends ty{constructor(e=!1){super(!1,e)}set(e,t,n,r){let o=e[t];const i=qt(e)&&mf(t);if(!this._isShallow){const l=ea(o);if(!Mi(n)&&!ea(n)&&(o=Rn(o),n=Rn(n)),!i&&Tr(o)&&!Tr(n))return l||(o.value=n),!0}const s=i?Number(t)<e.length:or(e,t),a=Reflect.set(e,t,n,Tr(e)?e:r);return e===Rn(r)&&(s?Po(n,o)&&Ga(e,"set",t,n,o):Ga(e,"add",t,n)),a}deleteProperty(e,t){const n=or(e,t),r=e[t],o=Reflect.deleteProperty(e,t);return o&&n&&Ga(e,"delete",t,void 0,r),o}has(e,t){const n=Reflect.has(e,t);return(!Ri(t)||!ey.has(t))&&ii(e,"has",t),n}ownKeys(e){return ii(e,"iterate",qt(e)?"length":jl),Reflect.ownKeys(e)}},ry=class extends ty{constructor(e=!1){super(!0,e)}set(e,t){return!0}deleteProperty(e,t){return!0}},Yw=new ny,Xw=new ry,Zw=new ny(!0),Qw=new ry(!0),Ep=e=>e,If=e=>Reflect.getPrototypeOf(e),Jw={get:Cp(!1,!1)},eC={get:Cp(!1,!0)},tC={get:Cp(!0,!1)},nC={get:Cp(!0,!0)},oy=new WeakMap,iy=new WeakMap,sy=new WeakMap,ay=new WeakMap,fs=e=>Zn(e)?vo(e):e,Gc=e=>Zn(e)?kp(e):e,rC=class{constructor(e,t){this.dep=new _f,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=t?e:Rn(e),this._value=t?e:fs(e),this.__v_isShallow=t}get value(){return this.dep.track(),this._value}set value(e){const t=this._rawValue,n=this.__v_isShallow||Mi(e)||ea(e);e=n?e:Rn(e),Po(e,t)&&(this._rawValue=e,this._value=n?e:fs(e),this.dep.trigger())}},oC={get:(e,t,n)=>t==="__v_raw"?e:nt(Reflect.get(e,t,n)),set:(e,t,n,r)=>{const o=e[t];return Tr(o)&&!Tr(n)?(o.value=n,!0):Reflect.set(e,t,n,r)}},iC=class{constructor(e){this.__v_isRef=!0,this._value=void 0;const t=this.dep=new _f,{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)}},sC=class{constructor(e,t,n){this._object=e,this._defaultValue=n,this.__v_isRef=!0,this._value=void 0,this._key=Ri(t)?t:String(t),this._raw=Rn(e);let r=!0,o=e;if(!qt(e)||Ri(this._key)||!mf(this._key))do r=!Cf(o)||Mi(o);while(r&&(o=o.__v_raw));this._shallow=r}get value(){let e=this._object[this._key];return this._shallow&&(e=nt(e)),this._value=e===void 0?this._defaultValue:e}set value(e){if(this._shallow&&Tr(this._raw[this._key])){const t=this._object[this._key];if(Tr(t)){t.value=e;return}}this._object[this._key]=e}get dep(){return V5(this._raw,this._key)}},aC=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()}},lC=class{constructor(e,t,n){this.fn=e,this.setter=t,this._value=void 0,this.dep=new _f(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=Nu-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!t,this.isSSR=n}notify(){if(this.flags|=16,!(this.flags&8)&&Ar!==this)return Mw(this,!0),!0}get value(){const e=this.dep.track();return Dw(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}},cC={GET:"get",HAS:"has",ITERATE:"iterate"},uC={SET:"set",ADD:"add",DELETE:"delete",CLEAR:"clear"},Ef={},Tf=new WeakMap,Ka=void 0}));function J5(e){Ty.push(e)}function e6(){Ty.pop()}function t6(e,t){}function zu(e,t,n,r){try{return r?e(...r):e()}catch(o){Wc(o,t,n)}}function hs(e,t,n,r){if(fn(e)){const o=zu(e,t,n,r);return o&&vp(o)&&o.catch(i=>{Wc(i,t,n)}),o}if(qt(e)){const o=[];for(let i=0;i<e.length;i++)o.push(hs(e[i],t,n,r));return o}}function Wc(e,t,n,r=!0){const o=t?t.vnode:null,{errorHandler:i,throwUnhandledErrorInProduction:s}=t&&t.appContext.config||Hn;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 h=0;h<d.length;h++)if(d[h](e,l,u)===!1)return}a=a.parent}if(i){$a(),zu(i,null,10,[e,l,u]),Ha();return}}n6(e,n,o,r,s)}function n6(e,t,n,r=!0,o=!1){if(o)throw e;console.error(e)}function It(e){const t=zf||xy;return e?t.then(this?e.bind(this):e):t}function r6(e){let t=Ms+1,n=ai.length;for(;t<n;){const r=t+n>>>1,o=ai[r],i=Hu(o);i<e||i===e&&o.flags&2?t=r+1:n=r}return t}function ly(e){if(!(e.flags&1)){const t=Hu(e),n=ai[ai.length-1];!n||!(e.flags&2)&&t>=Hu(n)?ai.push(e):ai.splice(r6(t),0,e),e.flags|=1,dC()}}function dC(){zf||(zf=xy.then(hC))}function xf(e){qt(e)?Kc.push(...e):Qa&&e.id===-1?Qa.splice(Yc+1,0,e):e.flags&1||(Kc.push(e),e.flags|=1),dC()}function fC(e,t,n=Ms+1){for(;n<ai.length;n++){const r=ai[n];if(r&&r.flags&2){if(e&&r.id!==e.uid)continue;ai.splice(n,1),n--,r.flags&4&&(r.flags&=-2),r(),r.flags&4||(r.flags&=-2)}}}function Tp(e){if(Kc.length){const t=[...new Set(Kc)].sort((n,r)=>Hu(n)-Hu(r));if(Kc.length=0,Qa){Qa.push(...t);return}for(Qa=t,Yc=0;Yc<Qa.length;Yc++){const n=Qa[Yc];n.flags&4&&(n.flags&=-2),n.flags&8||n(),n.flags&=-2}Qa=null,Yc=0}}function hC(e){try{for(Ms=0;Ms<ai.length;Ms++){const t=ai[Ms];t&&!(t.flags&8)&&(t.flags&4&&(t.flags&=-2),zu(t,t.i,t.i?15:14),t.flags&4||(t.flags&=-2))}}finally{for(;Ms<ai.length;Ms++){const t=ai[Ms];t&&(t.flags&=-2)}Ms=-1,ai.length=0,Tp(e),zf=null,(ai.length||Kc.length)&&hC(e)}}function pC(e,t){var n,r;Gu=e,Gu?(Gu.enabled=!0,Vf.forEach(({event:o,args:i})=>Gu.emit(o,...i)),Vf=[]):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=>{pC(o,t)}),setTimeout(()=>{Gu||(t.__VUE_DEVTOOLS_HOOK_REPLAY__=null,Vf=[])},3e3)):Vf=[]}function Rf(e){const t=Fo;return Fo=e,Uf=e&&e.type.__scopeId||null,t}function o6(e){Uf=e}function i6(){Uf=null}function Do(e,t=Fo,n){if(!t||e._n)return e;const r=(...o)=>{r._d&&Nf(-1);const i=Rf(t);let s;try{s=e(...o)}finally{Rf(i),r._d&&Nf(1)}return s};return r._n=!0,r._c=!0,r._d=!0,r}function Hi(e,t){if(Fo===null)return e;const n=Bf(Fo),r=e.dirs||(e.dirs=[]);for(let o=0;o<t.length;o++){let[i,s,a,l=Hn]=t[o];i&&(fn(i)&&(i={mounted:i,updated:i}),i.deep&&qa(s),r.push({dir:i,instance:n,value:s,oldValue:void 0,arg:a,modifiers:l}))}return e}function ta(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&&($a(),hs(l,n,8,[e.el,a,e,t]),Ha())}}function cy(e,t){if(No){let n=No.provides;const r=No.parent&&No.parent.provides;r===n&&(n=No.provides=Object.create(r)),n[e]=t}}function na(e,t,n=!1){const r=Fr();if(r||ql){let o=ql?ql._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&&fn(t)?t.call(r&&r.proxy):t}}function mC(){return!!(Fr()||ql)}function s6(e,t){return Lf(e,null,t)}function a6(e,t){return Lf(e,null,{flush:"post"})}function gC(e,t){return Lf(e,null,{flush:"sync"})}function $t(e,t,n){return Lf(e,t,n)}function Lf(e,t,n=Hn){const{immediate:r,deep:o,flush:i,once:s}=n,a=dr({},n),l=t&&r||!t&&i!=="post";let u;if(Xl){if(i==="sync"){const v=Ly();u=v.__watcherHandles||(v.__watcherHandles=[])}else if(!l){const v=()=>{};return v.stop=$i,v.resume=$i,v.pause=$i,v}}const d=No;a.call=(v,g,y)=>hs(v,d,g,y);let h=!1;i==="post"?a.scheduler=v=>{ho(v,d&&d.suspense)}:i!=="sync"&&(h=!0,a.scheduler=(v,g)=>{g?v():ly(v)}),a.augmentJob=v=>{t&&(v.flags|=4),h&&(v.flags|=2,d&&(v.id=d.uid,v.i=d))};const p=Z5(e,t,a);return Xl&&(u?u.push(p):l&&p()),p}function l6(e,t,n){const r=this.proxy,o=yr(e)?e.includes(".")?vC(r,e):()=>r[e]:e.bind(r,r);let i;fn(t)?i=t:(i=t.handler,n=t);const s=Qc(this),a=Lf(o,i.bind(r),n);return s(),a}function vC(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 xp(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,h=i===2;if(h&&r(s,t,n),(!h||Gl(d))&&l&16)for(let p=0;p<u.length;p++)o(u[p],t,n,2);h&&r(a,t,n)}function c6(e,t,n,r,o,i,{o:{nextSibling:s,parentNode:a,querySelector:l,insert:u,createText:d}},h){function p(_,w){let I=w;for(;I;){if(I&&I.nodeType===8){if(I.data==="teleport start anchor")t.targetStart=I;else if(I.data==="teleport anchor"){t.targetAnchor=I,_._lpa=t.targetAnchor&&s(t.targetAnchor);break}}I=s(I)}}function v(_,w){w.anchor=h(s(_),w,a(_),n,r,o,i)}const g=t.target=Vp(t.props,l),y=Gl(t.props);if(g){const _=g._lpa||g.firstChild;t.shapeFlag&16&&(y?(v(e,t),p(g,_),t.targetAnchor||uy(g,t,d,u,a(e)===g?e:null)):(t.anchor=s(e),p(g,_),t.targetAnchor||uy(g,t,d,u),h(_&&s(_),t,g,n,r,o,i))),Mf(t,y)}else y&&t.shapeFlag&16&&(v(e,t),t.targetStart=e,t.targetAnchor=s(e));return t.anchor&&s(t.anchor)}function Mf(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 uy(e,t,n,r,o=null){const i=t.targetStart=n(""),s=t.targetAnchor=n("");return i[My]=s,e&&(r(i,e,o),r(s,e,o)),s}function dy(){const e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return Xn(()=>{e.isMounted=!0}),br(()=>{e.isUnmounting=!0}),e}function yC(e){let t=e[0];if(e.length>1){for(const n of e)if(n.type!==no){t=n;break}}return t}function bC(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 Vu(e,t,n,r,o){const{appear:i,mode:s,persisted:a=!1,onBeforeEnter:l,onEnter:u,onAfterEnter:d,onEnterCancelled:h,onBeforeLeave:p,onLeave:v,onAfterLeave:g,onLeaveCancelled:y,onBeforeAppear:_,onAppear:w,onAfterAppear:I,onAppearCancelled:k}=t,C=String(e.key),R=bC(n,e),P=(F,D)=>{F&&hs(F,r,9,D)},M=(F,D)=>{const V=D[1];P(F,D),qt(F)?F.every(x=>x.length<=1)&&V():F.length<=1&&V()},$={mode:s,persisted:a,beforeEnter(F){let D=l;if(!n.isMounted)if(i)D=_||l;else return;F[Os]&&F[Os](!0);const V=R[C];V&&Ls(e,V)&&V.el[Os]&&V.el[Os](),P(D,[F])},enter(F){if(R[C]===e)return;let D=u,V=d,x=h;if(!n.isMounted)if(i)D=w||u,V=I||d,x=k||h;else return;let B=!1;F[Wu]=te=>{B||(B=!0,te?P(x,[F]):P(V,[F]),$.delayedLeave&&$.delayedLeave(),F[Wu]=void 0)};const T=F[Wu].bind(null,!1);D?M(D,[F,T]):T()},leave(F,D){const V=String(e.key);if(F[Wu]&&F[Wu](!0),n.isUnmounting)return D();P(p,[F]);let x=!1;F[Os]=T=>{x||(x=!0,D(),T?P(y,[F]):P(g,[F]),F[Os]=void 0,R[V]===e&&delete R[V])};const B=F[Os].bind(null,!1);R[V]=e,v?M(v,[F,B]):B()},clone(F){const D=Vu(F,t,n,r,o);return o&&o(D),D}};return $}function fy(e){if(qu(e))return e=ra(e),e.children=null,e}function wC(e){if(!qu(e))return Oy(e.type)&&e.children?yC(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&&fn(n.default))return n.default()}}function Ya(e,t){e.shapeFlag&6&&e.component?(e.transition=t,Ya(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 Rp(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===Ht?(s.patchFlag&128&&o++,r=r.concat(Rp(s.children,t,a))):(t||s.type!==no)&&r.push(a!=null?ra(s,{key:a}):s)}if(o>1)for(let i=0;i<r.length;i++)r[i].patchFlag=-2;return r}function $l(e,t){return fn(e)?dr({name:e.name},t,{setup:e}):e}function u6(){const e=Fr();return e?(e.appContext.config.idPrefix||"v")+"-"+e.ids[0]+e.ids[1]++:""}function hy(e){e.ids=[e.ids[0]+e.ids[2]+++"-",0,0]}function d6(e){const t=Fr(),n=Yr(null);if(t){const r=t.refs===Hn?t.refs={}:t.refs;Object.defineProperty(r,e,{enumerable:!0,get:()=>n.value,set:o=>n.value=o})}return n}function CC(e,t){let n;return!!((n=Object.getOwnPropertyDescriptor(e,t))&&!n.configurable)}function Uu(e,t,n,r,o=!1){if(qt(e)){e.forEach((y,_)=>Uu(y,t&&(qt(t)?t[_]:t),n,r,o));return}if(ia(r)&&!o){r.shapeFlag&512&&r.type.__asyncResolved&&r.component.subTree.component&&Uu(e,t,n,r.component.subTree);return}const i=r.shapeFlag&4?Bf(r.component):r.el,s=o?null:i,{i:a,r:l}=e,u=t&&t.r,d=a.refs===Hn?a.refs={}:a.refs,h=a.setupState,p=Rn(h),v=h===Hn?Pv:y=>CC(d,y)?!1:or(p,y),g=(y,_)=>!(_&&CC(d,_));if(u!=null&&u!==l){if(kC(t),yr(u))d[u]=null,v(u)&&(h[u]=null);else if(Tr(u)){const y=t;g(u,y.k)&&(u.value=null),y.k&&(d[y.k]=null)}}if(fn(l))zu(l,a,12,[s,d]);else{const y=yr(l),_=Tr(l);if(y||_){const w=()=>{if(e.f){const I=y?v(l)?h[l]:d[l]:g(l)||!e.k?l.value:d[e.k];if(o)qt(I)&&gp(I,i);else if(qt(I))I.includes(i)||I.push(i);else if(y)d[l]=[i],v(l)&&(h[l]=d[l]);else{const k=[i];g(l,e.k)&&(l.value=k),e.k&&(d[e.k]=k)}}else y?(d[l]=s,v(l)&&(h[l]=s)):_&&(g(l,e.k)&&(l.value=s),e.k&&(d[e.k]=s))};if(s){const I=()=>{w(),jf.delete(e)};I.id=-1,jf.set(e,I),ho(I,n)}else kC(e),w()}}}function kC(e){const t=jf.get(e);t&&(t.flags|=8,jf.delete(e))}function f6(e){const{mt:t,p:n,o:{patchProp:r,createText:o,nextSibling:i,parentNode:s,remove:a,insert:l,createComment:u}}=e,d=(k,C)=>{if(!C.hasChildNodes()){n(null,k,C),Tp(),C._vnode=k;return}h(C.firstChild,k,null,null,null),Tp(),C._vnode=k},h=(k,C,R,P,M,$=!1)=>{$=$||!!C.dynamicChildren;const F=Zc(k)&&k.data==="[",D=()=>y(k,C,R,P,M,F),{type:V,ref:x,shapeFlag:B,patchFlag:T}=C;let te=k.nodeType;C.el=k,T===-2&&($=!1,C.dynamicChildren=null);let U=null;switch(V){case Ja:te!==3?C.children===""?(l(C.el=o(""),s(k),k),U=k):U=D():(k.data!==C.children&&(Xc(),k.data=C.children),U=i(k));break;case no:I(k)?(U=i(k),w(C.el=k.content.firstChild,k,R)):te!==8||F?U=D():U=i(k);break;case Kl:if(F&&(k=i(k),te=k.nodeType),te===1||te===3){U=k;const W=!C.children.length;for(let Y=0;Y<C.staticCount;Y++)W&&(C.children+=U.nodeType===1?U.outerHTML:U.data),Y===C.staticCount-1&&(C.anchor=U),U=i(U);return F?i(U):U}else D();break;case Ht:F?U=g(k,C,R,P,M,$):U=D();break;default:if(B&1)(te!==1||C.type.toLowerCase()!==k.tagName.toLowerCase())&&!I(k)?U=D():U=p(k,C,R,P,M,$);else if(B&6){C.slotScopeIds=M;const W=s(k);if(F?U=_(k):Zc(k)&&k.data==="teleport start"?U=_(k,k.data,"teleport end"):U=i(k),t(C,W,null,R,P,$f(W),$),ia(C)&&!C.type.__asyncResolved){let Y;F?(Y=un(Ht),Y.anchor=U?U.previousSibling:W.lastChild):Y=k.nodeType===3?Gi(""):un("div"),Y.el=k,C.component.subTree=Y}}else B&64?te!==8?U=D():U=C.type.hydrate(k,C,R,P,M,$,e,v):B&128&&(U=C.type.hydrate(k,C,R,P,$f(s(k)),M,$,e,h))}return x!=null&&Uu(x,null,P,C),U},p=(k,C,R,P,M,$)=>{$=$||!!C.dynamicChildren;const{type:F,props:D,patchFlag:V,shapeFlag:x,dirs:B,transition:T}=C,te=F==="input"||F==="option";if(te||V!==-1){B&&ta(C,null,R,"created");let U=!1;if(I(k)){U=GC(null,T)&&R&&R.vnode.props&&R.vnode.props.appear;const Y=k.content.firstChild;if(U){const J=Y.getAttribute("class");J&&(Y.$cls=J),T.beforeEnter(Y)}w(Y,k,R),C.el=k=Y}if(x&16&&!(D&&(D.innerHTML||D.textContent))){let Y=v(k.firstChild,C,k,R,P,M,$);for(;Y;){Lp(k,1)||Xc();const J=Y;Y=Y.nextSibling,a(J)}}else if(x&8){let Y=C.children;Y[0]===`
|
|
2
2
|
`&&(k.tagName==="PRE"||k.tagName==="TEXTAREA")&&(Y=Y.slice(1));const{textContent:J}=k;J!==Y&&J!==Y.replace(/\r\n|\r/g,`
|
|
3
3
|
`)&&(Lp(k,0)||Xc(),k.textContent=C.children)}if(D){if(te||!$||V&48){const Y=k.tagName.includes("-");for(const J in D)(te&&(J.endsWith("value")||J==="indeterminate")||Mu(J)&&!Ul(J)||J[0]==="."||Y&&!Ul(J))&&r(k,J,null,D[J],void 0,R)}else if(D.onClick)r(k,"onClick",null,D.onClick,void 0,R);else if(V&4&&Li(D.style))for(const Y in D.style)D.style[Y]}let W;(W=D&&D.onVnodeBeforeMount)&&Pi(W,R,C),B&&ta(C,null,R,"beforeMount"),((W=D&&D.onVnodeMounted)||B||U)&&XC(()=>{W&&Pi(W,R,C),U&&T.enter(k),B&&ta(C,null,R,"mounted")},P)}return k.nextSibling},v=(k,C,R,P,M,$,F)=>{F=F||!!C.dynamicChildren;const D=C.children,V=D.length;for(let x=0;x<V;x++){const B=F?D[x]:D[x]=Oi(D[x]),T=B.type===Ja;k?(T&&!F&&x+1<V&&Oi(D[x+1]).type===Ja&&(l(o(k.data.slice(B.children.length)),R,i(k)),k.data=B.children),k=h(k,B,P,M,$,F)):T&&!B.children?l(B.el=o(""),R):(Lp(R,1)||Xc(),n(null,B,R,null,P,M,$f(R),$))}return k},g=(k,C,R,P,M,$)=>{const{slotScopeIds:F}=C;F&&(M=M?M.concat(F):F);const D=s(k),V=v(i(k),C,D,R,P,M,$);return V&&Zc(V)&&V.data==="]"?i(C.anchor=V):(Xc(),l(C.anchor=u("]"),D,V),V)},y=(k,C,R,P,M,$)=>{if(Lp(k.parentElement,1)||Xc(),C.el=null,$){const V=_(k);for(;;){const x=i(k);if(x&&x!==V)a(x);else break}}const F=i(k),D=s(k);return a(k),n(null,C,D,F,R,P,$f(D),M),R&&(R.vnode.el=C.el,Bp(R,C.el)),F},_=(k,C="[",R="]")=>{let P=0;for(;k;)if(k=i(k),k&&Zc(k)&&(k.data===C&&P++,k.data===R)){if(P===0)return i(k);P--}return k},w=(k,C,R)=>{const P=C.parentNode;P&&P.replaceChild(k,C);let M=R;for(;M;)M.vnode.el===C&&(M.vnode.el=M.subTree.el=k),M=M.parent},I=k=>k.nodeType===1&&k.tagName==="TEMPLATE";return[d,h]}function Lp(e,t){if(t===0||t===1)for(;e&&!e.hasAttribute(zy);)e=e.parentElement;const n=e&&e.getAttribute(zy);if(n==null)return!1;if(n==="")return!0;{const r=n.split(",");return t===0&&r.includes("children")?!0:r.includes(mk[t])}}function h6(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 p6(e,t){if(Zc(e)&&e.data==="["){let n=1,r=e.nextSibling;for(;r;){if(r.nodeType===1){if(t(r)===!1)break}else if(Zc(r))if(r.data==="]"){if(--n===0)break}else r.data==="["&&n++;r=r.nextSibling}}else t(e)}function SC(e){fn(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,h=0;const p=()=>(h++,u=null,v()),v=()=>{let g;return u||(g=u=t().catch(y=>{if(y=y instanceof Error?y:new Error(String(y)),l)return new Promise((_,w)=>{l(y,()=>_(p()),()=>w(y),h+1)});throw y}).then(y=>g!==u&&u?u:(y&&(y.__esModule||y[Symbol.toStringTag]==="Module")&&(y=y.default),d=y,y)))};return $l({name:"AsyncComponentWrapper",__asyncLoader:v,__asyncHydrate(g,y,_){let w=!1;(y.bu||(y.bu=[])).push(()=>w=!0);const I=()=>{w||_()},k=i?()=>{const C=i(I,R=>p6(g,R));C&&(y.bum||(y.bum=[])).push(C)}:I;d?k():v().then(()=>!y.isUnmounted&&k())},get __asyncResolved(){return d},setup(){const g=No;if(hy(g),d)return()=>Mp(d,g);const y=k=>{u=null,Wc(k,g,13,!r)};if(a&&g.suspense||Xl)return v().then(k=>()=>Mp(k,g)).catch(k=>(y(k),()=>r?un(r,{error:k}):null));const _=ne(!1),w=ne(),I=ne(!!o);return o&&setTimeout(()=>{I.value=!1},o),s!=null&&setTimeout(()=>{if(!_.value&&!w.value){const k=new Error(`Async component timed out after ${s}ms.`);y(k),w.value=k}},s),v().then(()=>{_.value=!0,g.parent&&qu(g.parent.vnode)&&g.parent.update()}).catch(k=>{y(k),w.value=k}),()=>{if(_.value&&d)return Mp(d,g);if(w.value&&r)return un(r,{error:w.value});if(n&&!I.value)return Mp(n,g)}}})}function Mp(e,t){const{ref:n,props:r,children:o,ce:i}=t.vnode,s=un(e,r,o);return s.ref=n,s.ce=i,delete t.vnode.ce,s}function Of(e,t){return qt(e)?e.some(n=>Of(n,t)):yr(e)?e.split(",").includes(t):Cw(e)?(e.lastIndex=0,e.test(t)):!1}function py(e,t){_C(e,"a",t)}function my(e,t){_C(e,"da",t)}function _C(e,t,n=No){const r=e.__wdc||(e.__wdc=()=>{let o=n;for(;o;){if(o.isDeactivated)return;o=o.parent}return e()});if(Pp(t,r,n),n){let o=n.parent;for(;o&&o.parent;)qu(o.parent.vnode)&&m6(r,t,n,o),o=o.parent}}function m6(e,t,n,r){const o=Pp(t,e,r,!0);Gf(()=>{gp(r[t],o)},n)}function gy(e){e.shapeFlag&=-257,e.shapeFlag&=-513}function Op(e){return e.shapeFlag&128?e.ssContent:e}function Pp(e,t,n=No,r=!1){if(n){const o=n[e]||(n[e]=[]),i=t.__weh||(t.__weh=(...s)=>{$a();const a=Qc(n),l=hs(t,n,e,s);return a(),Ha(),l});return r?o.unshift(i):o.push(i),i}}function AC(e,t=No){Pp("ec",e,t)}function g6(e,t){return yy($p,e,!0,t)||e}function vy(e){return yr(e)?yy($p,e,!1)||e:e||Hy}function IC(e){return yy(Sk,e)}function yy(e,t,n=!0,r=!1){const o=Fo||No;if(o){const i=o.type;if(e===$p){const a=Ey(i,!1);if(a&&(a===t||a===fo(t)||a===Ou(fo(t))))return i}const s=EC(o[e]||i[e],t)||EC(o.appContext[e],t);return!s&&r?i:s}}function EC(e,t){return e&&(e[t]||e[fo(t)]||e[Ou(fo(t))])}function Bn(e,t,n,r){let o;const i=n&&n[r],s=qt(e);if(s||yr(e)){const a=s&&Li(e);let l=!1,u=!1;a&&(l=!Mi(e),u=ea(e),e=bp(e)),o=new Array(e.length);for(let d=0,h=e.length;d<h;d++)o[d]=t(l?u?Gc(fs(e[d])):fs(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(Zn(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 v6(e,t){for(let n=0;n<t.length;n++){const r=t[n];if(qt(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 ju(e,t,n={},r,o){if(Fo.ce||Fo.parent&&ia(Fo.parent)&&Fo.parent.ce){const u=Object.keys(n).length>0;return t!=="default"&&(n.name=t),fe(),wn(Ht,null,[un("slot",n,r&&r())],u?-2:64)}let i=e[t];i&&i._c&&(i._d=!1),fe();const s=i&&by(i(n)),a=n.key||s&&s.key,l=wn(Ht,{key:(a&&!Ri(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 by(e){return e.some(t=>Xa(t)?!(t.type===no||t.type===Ht&&!by(t.children)):!0)?e:null}function y6(e,t){const n={};for(const r in e)n[t&&/[A-Z]/.test(r)?`on:${r}`:Pu(r)]=e[r];return n}function b6(){return null}function w6(){return null}function C6(e){}function k6(e){}function S6(){return null}function _6(){}function A6(e,t){return null}function TC(){return RC("useSlots").slots}function xC(){return RC("useAttrs").attrs}function RC(e){const t=Fr();return t.setupContext||(t.setupContext=ik(t))}function Pf(e){return qt(e)?e.reduce((t,n)=>(t[n]=null,t),{}):e}function I6(e,t){const n=Pf(e);for(const r in t){if(r.startsWith("__skip"))continue;let o=n[r];o?qt(o)||fn(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 E6(e,t){return!e||!t?e||t:qt(e)&&qt(t)?e.concat(t):dr({},Pf(e),Pf(t))}function T6(e,t){const n={};for(const r in e)t.includes(r)||Object.defineProperty(n,r,{enumerable:!0,get:()=>e[r]});return n}function x6(e){const t=Fr(),n=Xl;let r=e();Zu(),n&&Xu(!1);const o=()=>{Qc(t),n&&Xu(!0)},i=()=>{Fr()!==t&&t.scope.off(),Zu(),n&&Xu(!1)};return vp(r)&&(r=r.catch(s=>{throw o(),Promise.resolve().then(()=>Promise.resolve().then(i)),s})),[r,()=>{o(),Promise.resolve().then(i)}]}function R6(e){const t=wy(e),n=e.proxy,r=e.ctx;qp=!1,t.beforeCreate&&LC(t.beforeCreate,e,"bc");const{data:o,computed:i,methods:s,watch:a,provide:l,inject:u,created:d,beforeMount:h,mounted:p,beforeUpdate:v,updated:g,activated:y,deactivated:_,beforeDestroy:w,beforeUnmount:I,destroyed:k,unmounted:C,render:R,renderTracked:P,renderTriggered:M,errorCaptured:$,serverPrefetch:F,expose:D,inheritAttrs:V,components:x,directives:B,filters:T}=t;if(u&&L6(u,r,null),s)for(const W in s){const Y=s[W];fn(Y)&&(r[W]=Y.bind(n))}if(o){const W=o.call(n,n);Zn(W)&&(e.data=vo(W))}if(qp=!0,i)for(const W in i){const Y=i[W],J=fn(Y)?Y.bind(n,n):fn(Y.get)?Y.get.bind(n,n):$i,Oe=!fn(Y)&&fn(Y.set)?Y.set.bind(n):$i,de=Ce({get:J,set:Oe});Object.defineProperty(r,W,{enumerable:!0,configurable:!0,get:()=>de.value,set:oe=>de.value=oe})}if(a)for(const W in a)MC(a[W],r,n,W);if(l){const W=fn(l)?l.call(n):l;Reflect.ownKeys(W).forEach(Y=>{cy(Y,W[Y])})}d&&LC(d,e,"c");function U(W,Y){qt(Y)?Y.forEach(J=>W(J.bind(n))):Y&&W(Y.bind(n))}if(U(Vy,h),U(Xn,p),U(jp,v),U(Hf,g),U(py,y),U(my,_),U(AC,$),U($y,P),U(jy,M),U(br,I),U(Gf,C),U(Uy,F),qt(D))if(D.length){const W=e.exposed||(e.exposed={});D.forEach(Y=>{Object.defineProperty(W,Y,{get:()=>n[Y],set:J=>n[Y]=J,enumerable:!0})})}else e.exposed||(e.exposed={});R&&e.render===$i&&(e.render=R),V!=null&&(e.inheritAttrs=V),x&&(e.components=x),B&&(e.directives=B),F&&hy(e)}function L6(e,t,n=$i){qt(e)&&(e=Cy(e));for(const r in e){const o=e[r];let i;Zn(o)?"default"in o?i=na(o.from||r,o.default,!0):i=na(o.from||r):i=na(o),Tr(i)?Object.defineProperty(t,r,{enumerable:!0,configurable:!0,get:()=>i.value,set:s=>i.value=s}):t[r]=i}}function LC(e,t,n){hs(qt(e)?e.map(r=>r.bind(t.proxy)):e.bind(t.proxy),t,n)}function MC(e,t,n,r){let o=r.includes(".")?vC(n,r):()=>n[r];if(yr(e)){const i=t[e];fn(i)&&$t(o,i)}else if(fn(e))$t(o,e.bind(n));else if(Zn(e))if(qt(e))e.forEach(i=>MC(i,t,n,r));else{const i=fn(e.handler)?e.handler.bind(n):t[e.handler];fn(i)&&$t(o,i,e)}}function wy(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=>Dp(l,u,s,!0)),Dp(l,t,s)),Zn(t)&&i.set(t,l),l}function Dp(e,t,n,r=!1){const{mixins:o,extends:i}=t;i&&Dp(e,i,n,!0),o&&o.forEach(s=>Dp(e,s,n,!0));for(const s in t)if(!(r&&s==="expose")){const a=Ak[s]||n&&n[s];e[s]=a?a(e[s],t[s]):t[s]}return e}function OC(e,t){return t?e?function(){return dr(fn(e)?e.call(this,this):e,fn(t)?t.call(this,this):t)}:t:e}function M6(e,t){return Df(Cy(e),Cy(t))}function Cy(e){if(qt(e)){const t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function wi(e,t){return e?[...new Set([].concat(e,t))]:t}function Df(e,t){return e?dr(Object.create(null),e,t):t}function PC(e,t){return e?qt(e)&&qt(t)?[...new Set([...e,...t])]:dr(Object.create(null),Pf(e),Pf(t??{})):t}function O6(e,t){if(!e)return t;if(!t)return e;const n=dr(Object.create(null),e);for(const r in t)n[r]=wi(e[r],t[r]);return n}function DC(){return{app:null,config:{isNativeTag:Pv,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 P6(e,t){return function(r,o=null){fn(r)||(r=dr({},r)),o!=null&&!Zn(o)&&(o=null);const i=DC(),s=new WeakSet,a=[];let l=!1;const u=i.app={_uid:Ik++,_component:r,_props:o,_container:null,_context:i,_instance:null,version:eb,get config(){return i.config},set config(d){},use(d,...h){return s.has(d)||(d&&fn(d.install)?(s.add(d),d.install(u,...h)):fn(d)&&(s.add(d),d(u,...h))),u},mixin(d){return i.mixins.includes(d)||i.mixins.push(d),u},component(d,h){return h?(i.components[d]=h,u):i.components[d]},directive(d,h){return h?(i.directives[d]=h,u):i.directives[d]},mount(d,h,p){if(!l){const v=u._ceVNode||un(r,o);return v.appContext=i,p===!0?p="svg":p===!1&&(p=void 0),h&&t?t(v,d):e(v,d,p),l=!0,u._container=d,d.__vue_app__=u,Bf(v.component)}},onUnmount(d){a.push(d)},unmount(){l&&(hs(a,u._instance,16),e(null,u._container),delete u._container.__vue_app__)},provide(d,h){return i.provides[d]=h,u},runWithContext(d){const h=ql;ql=u;try{return d()}finally{ql=h}}};return u}}function D6(e,t,n=Hn){const r=Fr(),o=fo(t),i=bi(t),s=Gy(e,o),a=Uw((l,u)=>{let d,h=Hn,p;return gC(()=>{const v=e[o];Po(d,v)&&(d=v,u())}),{get(){return l(),n.get?n.get(d):d},set(v){const g=n.set?n.set(v):v;if(!Po(g,d)&&!(h!==Hn&&Po(v,h)))return;const y=r.vnode.props;y&&(t in y||o in y||i in y)&&(`onUpdate:${t}`in y||`onUpdate:${o}`in y||`onUpdate:${i}`in y)||(d=v,u()),r.emit(`update:${t}`,g),Po(v,g)&&Po(v,h)&&!Po(g,p)&&u(),h=v,p=g}}});return a[Symbol.iterator]=()=>{let l=0;return{next(){return l<2?{value:l++?s||Hn:a,done:!1}:{done:!0}}}},a}function F6(e,t,...n){if(e.isUnmounted)return;const r=e.vnode.props||Hn;let o=n;const i=t.startsWith("update:"),s=i&&Gy(r,t.slice(7));s&&(s.trim&&(o=n.map(d=>yr(d)?d.trim():d)),s.number&&(o=n.map(vf)));let a,l=r[a=Pu(t)]||r[a=Pu(fo(t))];!l&&i&&(l=r[a=Pu(bi(t))]),l&&hs(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,hs(u,e,6,o)}}function FC(e,t,n=!1){const r=n?Ek:t.emitsCache,o=r.get(e);if(o!==void 0)return o;const i=e.emits;let s={},a=!1;if(!fn(e)){const l=u=>{const d=FC(u,t,!0);d&&(a=!0,dr(s,d))};!n&&t.mixins.length&&t.mixins.forEach(l),e.extends&&l(e.extends),e.mixins&&e.mixins.forEach(l)}return!i&&!a?(Zn(e)&&r.set(e,null),null):(qt(i)?i.forEach(l=>s[l]=null):dr(s,i),Zn(e)&&r.set(e,s),s)}function Fp(e,t){return!e||!Mu(t)?!1:(t=t.slice(2).replace(/Once$/,""),or(e,t[0].toLowerCase()+t.slice(1))||or(e,bi(t))||or(e,t))}function Np(e){const{type:t,vnode:n,proxy:r,withProxy:o,propsOptions:[i],slots:s,attrs:a,emit:l,render:u,renderCache:d,props:h,data:p,setupState:v,ctx:g,inheritAttrs:y}=e,_=Rf(e);let w,I;try{if(n.shapeFlag&4){const C=o||r,R=C;w=Oi(u.call(R,C,d,h,v,p,g)),I=a}else{const C=t;w=Oi(C.length>1?C(h,{attrs:a,slots:s,emit:l}):C(h,null)),I=t.props?a:Tk(a)}}catch(C){Yu.length=0,Wc(C,e,1),w=un(no)}let k=w;if(I&&y!==!1){const C=Object.keys(I),{shapeFlag:R}=k;C.length&&R&7&&(i&&C.some(hf)&&(I=xk(I,i)),k=ra(k,I,!1,!0))}return n.dirs&&(k=ra(k,null,!1,!0),k.dirs=k.dirs?k.dirs.concat(n.dirs):n.dirs),n.transition&&Ya(k,n.transition),w=k,Rf(_),w}function N6(e,t=!0){let n;for(let r=0;r<e.length;r++){const o=e[r];if(Xa(o)){if(o.type!==no||o.children==="v-if"){if(n)return;n=o}}else return}return n}function B6(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?NC(r,s,u):!!s;if(l&8){const d=t.dynamicProps;for(let h=0;h<d.length;h++){const p=d[h];if(BC(s,r,p)&&!Fp(u,p))return!0}}}else return(o||a)&&(!a||!a.$stable)?!0:r===s?!1:r?s?NC(r,s,u):!0:!!s;return!1}function NC(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(BC(t,e,i)&&!Fp(n,i))return!0}return!1}function BC(e,t,n){const r=e[n],o=t[n];return n==="style"&&Zn(r)&&Zn(o)?!ja(r,o):r!==o}function Bp({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 z6(e,t,n,r=!1){const o={},i=qy();e.propsDefaults=Object.create(null),zC(e,t,o,i);for(const s in e.propsOptions[0])s in o||(o[s]=void 0);n?e.props=r?o:zw(o):e.type.props?e.props=o:e.props=i,e.attrs=i}function V6(e,t,n,r){const{props:o,attrs:i,vnode:{patchFlag:s}}=e,a=Rn(o),[l]=e.propsOptions;let u=!1;if((r||s>0)&&!(s&16)){if(s&8){const d=e.vnode.dynamicProps;for(let h=0;h<d.length;h++){let p=d[h];if(Fp(e.emitsOptions,p))continue;const v=t[p];if(l)if(or(i,p))v!==i[p]&&(i[p]=v,u=!0);else{const g=fo(p);o[g]=ky(l,a,g,v,e,!1)}else v!==i[p]&&(i[p]=v,u=!0)}}}else{zC(e,t,o,i)&&(u=!0);let d;for(const h in a)(!t||!or(t,h)&&((d=bi(h))===h||!or(t,d)))&&(l?n&&(n[h]!==void 0||n[d]!==void 0)&&(o[h]=ky(l,a,h,void 0,e,!0)):delete o[h]);if(i!==a)for(const h in i)(!t||!or(t,h))&&(delete i[h],u=!0)}u&&Ga(e.attrs,"set","")}function zC(e,t,n,r){const[o,i]=e.propsOptions;let s=!1,a;if(t)for(let l in t){if(Ul(l))continue;const u=t[l];let d;o&&or(o,d=fo(l))?!i||!i.includes(d)?n[d]=u:(a||(a={}))[d]=u:Fp(e.emitsOptions,l)||(!(l in r)||u!==r[l])&&(r[l]=u,s=!0)}if(i){const l=Rn(n),u=a||Hn;for(let d=0;d<i.length;d++){const h=i[d];n[h]=ky(o,l,h,u[h],e,!or(u,h))}}return s}function ky(e,t,n,r,o,i){const s=e[n];if(s!=null){const a=or(s,"default");if(a&&r===void 0){const l=s.default;if(s.type!==Function&&!s.skipFactory&&fn(l)){const{propsDefaults:u}=o;if(n in u)r=u[n];else{const d=Qc(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===bi(n))&&(r=!0))}return r}function VC(e,t,n=!1){const r=n?Rk:t.propsCache,o=r.get(e);if(o)return o;const i=e.props,s={},a=[];let l=!1;if(!fn(e)){const d=h=>{l=!0;const[p,v]=VC(h,t,!0);dr(s,p),v&&a.push(...v)};!n&&t.mixins.length&&t.mixins.forEach(d),e.extends&&d(e.extends),e.mixins&&e.mixins.forEach(d)}if(!i&&!l)return Zn(e)&&r.set(e,Uc),Uc;if(qt(i))for(let d=0;d<i.length;d++){const h=fo(i[d]);UC(h)&&(s[h]=Hn)}else if(i)for(const d in i){const h=fo(d);if(UC(h)){const p=i[d],v=s[h]=qt(p)||fn(p)?{type:p}:dr({},p),g=v.type;let y=!1,_=!0;if(qt(g))for(let w=0;w<g.length;++w){const I=g[w],k=fn(I)&&I.name;if(k==="Boolean"){y=!0;break}else k==="String"&&(_=!1)}else y=fn(g)&&g.name==="Boolean";v[0]=y,v[1]=_,(y||or(v,"default"))&&a.push(h)}}const u=[s,a];return Zn(e)&&r.set(e,u),u}function UC(e){return e[0]!=="$"&&!Ul(e)}function jC(e){return HC(e)}function $C(e){return HC(e,f6)}function HC(e,t){const n=bf();n.__VUE__=!0;const{insert:r,remove:o,patchProp:i,createElement:s,createText:a,createComment:l,setText:u,setElementText:d,parentNode:h,nextSibling:p,setScopeId:v=$i,insertStaticContent:g}=e,y=(L,A,ee,ue=null,Z=null,G=null,K=void 0,re=null,ge=!!A.dynamicChildren)=>{if(L===A)return;L&&!Ls(L,A)&&(ue=ut(L),oe(L,Z,G,!0),L=null),A.patchFlag===-2&&(ge=!1,A.dynamicChildren=null);const{type:X,ref:ce,shapeFlag:Ae}=A;switch(X){case Ja:_(L,A,ee,ue);break;case no:w(L,A,ee,ue);break;case Kl:L==null&&I(A,ee,ue,K);break;case Ht:x(L,A,ee,ue,Z,G,K,re,ge);break;default:Ae&1?R(L,A,ee,ue,Z,G,K,re,ge):Ae&6?B(L,A,ee,ue,Z,G,K,re,ge):(Ae&64||Ae&128)&&X.process(L,A,ee,ue,Z,G,K,re,ge,Pe)}ce!=null&&Z?Uu(ce,L&&L.ref,G,A||L,!A):ce==null&&L&&L.ref!=null&&Uu(L.ref,null,G,L,!0)},_=(L,A,ee,ue)=>{if(L==null)r(A.el=a(A.children),ee,ue);else{const Z=A.el=L.el;A.children!==L.children&&u(Z,A.children)}},w=(L,A,ee,ue)=>{L==null?r(A.el=l(A.children||""),ee,ue):A.el=L.el},I=(L,A,ee,ue)=>{[L.el,L.anchor]=g(L.children,A,ee,ue,L.el,L.anchor)},k=({el:L,anchor:A},ee,ue)=>{let Z;for(;L&&L!==A;)Z=p(L),r(L,ee,ue),L=Z;r(A,ee,ue)},C=({el:L,anchor:A})=>{let ee;for(;L&&L!==A;)ee=p(L),o(L),L=ee;o(A)},R=(L,A,ee,ue,Z,G,K,re,ge)=>{if(A.type==="svg"?K="svg":A.type==="math"&&(K="mathml"),L==null)P(A,ee,ue,Z,G,K,re,ge);else{const X=L.el&&L.el._isVueCE?L.el:null;try{X&&X._beginPatch(),F(L,A,Z,G,K,re,ge)}finally{X&&X._endPatch()}}},P=(L,A,ee,ue,Z,G,K,re)=>{let ge,X;const{props:ce,shapeFlag:Ae,transition:ke,dirs:De}=L;if(ge=L.el=s(L.type,G,ce&&ce.is,ce),Ae&8?d(ge,L.children):Ae&16&&$(L.children,ge,null,ue,Z,Sy(L,G),K,re),De&&ta(L,null,ue,"created"),M(ge,L,L.scopeId,K,ue),ce){for(const xe in ce)xe!=="value"&&!Ul(xe)&&i(ge,xe,null,ce[xe],G,ue);"value"in ce&&i(ge,"value",null,ce.value,G),(X=ce.onVnodeBeforeMount)&&Pi(X,ue,L)}De&&ta(L,null,ue,"beforeMount");const ft=GC(Z,ke);ft&&ke.beforeEnter(ge),r(ge,A,ee),((X=ce&&ce.onVnodeMounted)||ft||De)&&ho(()=>{X&&Pi(X,ue,L),ft&&ke.enter(ge),De&&ta(L,null,ue,"mounted")},Z)},M=(L,A,ee,ue,Z)=>{if(ee&&v(L,ee),ue)for(let G=0;G<ue.length;G++)v(L,ue[G]);if(Z){let G=Z.subTree;if(A===G||Wf(G.type)&&(G.ssContent===A||G.ssFallback===A)){const K=Z.vnode;M(L,K,K.scopeId,K.slotScopeIds,Z.parent)}}},$=(L,A,ee,ue,Z,G,K,re,ge=0)=>{for(let X=ge;X<L.length;X++){const ce=L[X]=re?Za(L[X]):Oi(L[X]);y(null,ce,A,ee,ue,Z,G,K,re)}},F=(L,A,ee,ue,Z,G,K)=>{const re=A.el=L.el;let{patchFlag:ge,dynamicChildren:X,dirs:ce}=A;ge|=L.patchFlag&16;const Ae=L.props||Hn,ke=A.props||Hn;let De;if(ee&&qc(ee,!1),(De=ke.onVnodeBeforeUpdate)&&Pi(De,ee,A,L),ce&&ta(A,L,ee,"beforeUpdate"),ee&&qc(ee,!0),(Ae.innerHTML&&ke.innerHTML==null||Ae.textContent&&ke.textContent==null)&&d(re,""),X?D(L.dynamicChildren,X,re,ee,ue,Sy(A,Z),G):K||Y(L,A,re,null,ee,ue,Sy(A,Z),G,!1),ge>0){if(ge&16)V(re,Ae,ke,ee,Z);else if(ge&2&&Ae.class!==ke.class&&i(re,"class",null,ke.class,Z),ge&4&&i(re,"style",Ae.style,ke.style,Z),ge&8){const ft=A.dynamicProps;for(let xe=0;xe<ft.length;xe++){const qe=ft[xe],Bt=Ae[qe],bt=ke[qe];(bt!==Bt||qe==="value")&&i(re,qe,Bt,bt,Z,ee)}}ge&1&&L.children!==A.children&&d(re,A.children)}else!K&&X==null&&V(re,Ae,ke,ee,Z);((De=ke.onVnodeUpdated)||ce)&&ho(()=>{De&&Pi(De,ee,A,L),ce&&ta(A,L,ee,"updated")},ue)},D=(L,A,ee,ue,Z,G,K)=>{for(let re=0;re<A.length;re++){const ge=L[re],X=A[re],ce=ge.el&&(ge.type===Ht||!Ls(ge,X)||ge.shapeFlag&198)?h(ge.el):ee;y(ge,X,ce,null,ue,Z,G,K,!0)}},V=(L,A,ee,ue,Z)=>{if(A!==ee){if(A!==Hn)for(const G in A)!Ul(G)&&!(G in ee)&&i(L,G,A[G],null,Z,ue);for(const G in ee){if(Ul(G))continue;const K=ee[G],re=A[G];K!==re&&G!=="value"&&i(L,G,re,K,Z,ue)}"value"in ee&&i(L,"value",A.value,ee.value,Z)}},x=(L,A,ee,ue,Z,G,K,re,ge)=>{const X=A.el=L?L.el:a(""),ce=A.anchor=L?L.anchor:a("");let{patchFlag:Ae,dynamicChildren:ke,slotScopeIds:De}=A;De&&(re=re?re.concat(De):De),L==null?(r(X,ee,ue),r(ce,ee,ue),$(A.children||[],ee,ce,Z,G,K,re,ge)):Ae>0&&Ae&64&&ke&&L.dynamicChildren&&L.dynamicChildren.length===ke.length?(D(L.dynamicChildren,ke,ee,Z,G,K,re),(A.key!=null||Z&&A===Z.subTree)&&_y(L,A,!0)):Y(L,A,ee,ce,Z,G,K,re,ge)},B=(L,A,ee,ue,Z,G,K,re,ge)=>{A.slotScopeIds=re,L==null?A.shapeFlag&512?Z.ctx.activate(A,ee,ue,K,ge):T(A,ee,ue,Z,G,K,ge):te(L,A,ge)},T=(L,A,ee,ue,Z,G,K)=>{const re=L.component=tk(L,ue,Z);if(qu(L)&&(re.ctx.renderer=Pe),rk(re,!1,K),re.asyncDep){if(Z&&Z.registerDep(re,U,K),!L.el){const ge=re.subTree=un(no);w(null,ge,A,ee),L.placeholder=ge.el}}else U(re,L,A,ee,Z,G,K)},te=(L,A,ee)=>{const ue=A.component=L.component;if(B6(L,A,ee))if(ue.asyncDep&&!ue.asyncResolved){W(ue,A,ee);return}else ue.next=A,ue.update();else A.el=L.el,ue.vnode=A},U=(L,A,ee,ue,Z,G,K)=>{const re=()=>{if(L.isMounted){let{next:Ae,bu:ke,u:De,parent:ft,vnode:xe}=L;{const Dt=WC(L);if(Dt){Ae&&(Ae.el=xe.el,W(L,Ae,K)),Dt.asyncDep.then(()=>{ho(()=>{L.isUnmounted||X()},Z)});return}}let qe=Ae,Bt;qc(L,!1),Ae?(Ae.el=xe.el,W(L,Ae,K)):Ae=xe,ke&&Hc(ke),(Bt=Ae.props&&Ae.props.onVnodeBeforeUpdate)&&Pi(Bt,ft,Ae,xe),qc(L,!0);const bt=Np(L),tt=L.subTree;L.subTree=bt,y(tt,bt,h(tt.el),ut(tt),L,Z,G),Ae.el=bt.el,qe===null&&Bp(L,bt.el),De&&ho(De,Z),(Bt=Ae.props&&Ae.props.onVnodeUpdated)&&ho(()=>Pi(Bt,ft,Ae,xe),Z)}else{let Ae;const{el:ke,props:De}=A,{bm:ft,m:xe,parent:qe,root:Bt,type:bt}=L,tt=ia(A);if(qc(L,!1),ft&&Hc(ft),!tt&&(Ae=De&&De.onVnodeBeforeMount)&&Pi(Ae,qe,A),qc(L,!0),ke&&le){const Dt=()=>{L.subTree=Np(L),le(ke,L.subTree,L,Z,null)};tt&&bt.__asyncHydrate?bt.__asyncHydrate(ke,L,Dt):Dt()}else{Bt.ce&&Bt.ce._hasShadowRoot()&&Bt.ce._injectChildStyle(bt,L.parent?L.parent.type:void 0);const Dt=L.subTree=Np(L);y(null,Dt,ee,ue,L,Z,G),A.el=Dt.el}if(xe&&ho(xe,Z),!tt&&(Ae=De&&De.onVnodeMounted)){const Dt=A;ho(()=>Pi(Ae,qe,Dt),Z)}(A.shapeFlag&256||qe&&ia(qe.vnode)&&qe.vnode.shapeFlag&256)&&L.a&&ho(L.a,Z),L.isMounted=!0,A=ee=ue=null}};L.scope.on();const ge=L.effect=new Fu(re);L.scope.off();const X=L.update=ge.run.bind(ge),ce=L.job=ge.runIfDirty.bind(ge);ce.i=L,ce.id=L.uid,ge.scheduler=()=>ly(ce),qc(L,!0),X()},W=(L,A,ee)=>{A.component=L;const ue=L.vnode.props;L.vnode=A,L.next=null,V6(L,A.props,ue,ee),Ok(L,A.children,ee),$a(),fC(L),Ha()},Y=(L,A,ee,ue,Z,G,K,re,ge=!1)=>{const X=L&&L.children,ce=L?L.shapeFlag:0,Ae=A.children,{patchFlag:ke,shapeFlag:De}=A;if(ke>0){if(ke&128){Oe(X,Ae,ee,ue,Z,G,K,re,ge);return}else if(ke&256){J(X,Ae,ee,ue,Z,G,K,re,ge);return}}De&8?(ce&16&&rt(X,Z,G),Ae!==X&&d(ee,Ae)):ce&16?De&16?Oe(X,Ae,ee,ue,Z,G,K,re,ge):rt(X,Z,G,!0):(ce&8&&d(ee,""),De&16&&$(Ae,ee,ue,Z,G,K,re,ge))},J=(L,A,ee,ue,Z,G,K,re,ge)=>{L=L||Uc,A=A||Uc;const X=L.length,ce=A.length,Ae=Math.min(X,ce);let ke;for(ke=0;ke<Ae;ke++){const De=A[ke]=ge?Za(A[ke]):Oi(A[ke]);y(L[ke],De,ee,null,Z,G,K,re,ge)}X>ce?rt(L,Z,G,!0,!1,Ae):$(A,ee,ue,Z,G,K,re,ge,Ae)},Oe=(L,A,ee,ue,Z,G,K,re,ge)=>{let X=0;const ce=A.length;let Ae=L.length-1,ke=ce-1;for(;X<=Ae&&X<=ke;){const De=L[X],ft=A[X]=ge?Za(A[X]):Oi(A[X]);if(Ls(De,ft))y(De,ft,ee,null,Z,G,K,re,ge);else break;X++}for(;X<=Ae&&X<=ke;){const De=L[Ae],ft=A[ke]=ge?Za(A[ke]):Oi(A[ke]);if(Ls(De,ft))y(De,ft,ee,null,Z,G,K,re,ge);else break;Ae--,ke--}if(X>Ae){if(X<=ke){const De=ke+1,ft=De<ce?A[De].el:ue;for(;X<=ke;)y(null,A[X]=ge?Za(A[X]):Oi(A[X]),ee,ft,Z,G,K,re,ge),X++}}else if(X>ke)for(;X<=Ae;)oe(L[X],Z,G,!0),X++;else{const De=X,ft=X,xe=new Map;for(X=ft;X<=ke;X++){const ln=A[X]=ge?Za(A[X]):Oi(A[X]);ln.key!=null&&xe.set(ln.key,X)}let qe,Bt=0;const bt=ke-ft+1;let tt=!1,Dt=0;const tn=new Array(bt);for(X=0;X<bt;X++)tn[X]=0;for(X=De;X<=Ae;X++){const ln=L[X];if(Bt>=bt){oe(ln,Z,G,!0);continue}let qn;if(ln.key!=null)qn=xe.get(ln.key);else for(qe=ft;qe<=ke;qe++)if(tn[qe-ft]===0&&Ls(ln,A[qe])){qn=qe;break}qn===void 0?oe(ln,Z,G,!0):(tn[qn-ft]=X+1,qn>=Dt?Dt=qn:tt=!0,y(ln,A[qn],ee,null,Z,G,K,re,ge),Bt++)}const Mn=tt?U6(tn):Uc;for(qe=Mn.length-1,X=bt-1;X>=0;X--){const ln=ft+X,qn=A[ln],Kt=A[ln+1],Fn=ln+1<ce?Kt.el||qC(Kt):ue;tn[X]===0?y(null,qn,ee,Fn,Z,G,K,re,ge):tt&&(qe<0||X!==Mn[qe]?de(qn,ee,Fn,2):qe--)}}},de=(L,A,ee,ue,Z=null)=>{const{el:G,type:K,transition:re,children:ge,shapeFlag:X}=L;if(X&6){de(L.component.subTree,A,ee,ue);return}if(X&128){L.suspense.move(A,ee,ue);return}if(X&64){K.move(L,A,ee,Pe);return}if(K===Ht){r(G,A,ee);for(let ce=0;ce<ge.length;ce++)de(ge[ce],A,ee,ue);r(L.anchor,A,ee);return}if(K===Kl){k(L,A,ee);return}if(ue!==2&&X&1&&re)if(ue===0)re.beforeEnter(G),r(G,A,ee),ho(()=>re.enter(G),Z);else{const{leave:ce,delayLeave:Ae,afterLeave:ke}=re,De=()=>{L.ctx.isUnmounted?o(G):r(G,A,ee)},ft=()=>{G._isLeaving&&G[Os](!0),ce(G,()=>{De(),ke&&ke()})};Ae?Ae(G,De,ft):ft()}else r(G,A,ee)},oe=(L,A,ee,ue=!1,Z=!1)=>{const{type:G,props:K,ref:re,children:ge,dynamicChildren:X,shapeFlag:ce,patchFlag:Ae,dirs:ke,cacheIndex:De,memo:ft}=L;if(Ae===-2&&(Z=!1),re!=null&&($a(),Uu(re,null,ee,L,!0),Ha()),De!=null&&(A.renderCache[De]=void 0),ce&256){A.ctx.deactivate(L);return}const xe=ce&1&&ke,qe=!ia(L);let Bt;if(qe&&(Bt=K&&K.onVnodeBeforeUnmount)&&Pi(Bt,A,L),ce&6)Ve(L.component,ee,ue);else{if(ce&128){L.suspense.unmount(ee,ue);return}xe&&ta(L,null,A,"beforeUnmount"),ce&64?L.type.remove(L,A,ee,Pe,ue):X&&!X.hasOnce&&(G!==Ht||Ae>0&&Ae&64)?rt(X,A,ee,!1,!0):(G===Ht&&Ae&384||!Z&&ce&16)&&rt(ge,A,ee),ue&&pe(L)}const bt=ft!=null&&De==null;(qe&&(Bt=K&&K.onVnodeUnmounted)||xe||bt)&&ho(()=>{Bt&&Pi(Bt,A,L),xe&&ta(L,null,A,"unmounted"),bt&&(L.el=null)},ee)},pe=L=>{const{type:A,el:ee,anchor:ue,transition:Z}=L;if(A===Ht){Ee(ee,ue);return}if(A===Kl){C(L);return}const G=()=>{o(ee),Z&&!Z.persisted&&Z.afterLeave&&Z.afterLeave()};if(L.shapeFlag&1&&Z&&!Z.persisted){const{leave:K,delayLeave:re}=Z,ge=()=>K(ee,G);re?re(L.el,G,ge):ge()}else G()},Ee=(L,A)=>{let ee;for(;L!==A;)ee=p(L),o(L),L=ee;o(A)},Ve=(L,A,ee)=>{const{bum:ue,scope:Z,job:G,subTree:K,um:re,m:ge,a:X}=L;zp(ge),zp(X),ue&&Hc(ue),Z.stop(),G&&(G.flags|=8,oe(K,L,A,ee)),re&&ho(re,A),ho(()=>{L.isUnmounted=!0},A)},rt=(L,A,ee,ue=!1,Z=!1,G=0)=>{for(let K=G;K<L.length;K++)oe(L[K],A,ee,ue,Z)},ut=L=>{if(L.shapeFlag&6)return ut(L.component.subTree);if(L.shapeFlag&128)return L.suspense.next();const A=p(L.anchor||L.el),ee=A&&A[My];return ee?p(ee):A};let ht=!1;const Rt=(L,A,ee)=>{let ue;L==null?A._vnode&&(oe(A._vnode,null,null,!0),ue=A._vnode.component):y(A._vnode||null,L,A,null,null,null,ee),A._vnode=L,ht||(ht=!0,fC(ue),Tp(),ht=!1)},Pe={p:y,um:oe,m:de,r:pe,mt:T,mc:$,pc:Y,pbc:D,n:ut,o:e};let Re,le;return t&&([Re,le]=t(Pe)),{render:Rt,hydrate:Re,createApp:P6(Rt,Re)}}function Sy({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 qc({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function GC(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function _y(e,t,n=!1){const r=e.children,o=t.children;if(qt(r)&&qt(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]=Za(o[i]),a.el=s.el),!n&&a.patchFlag!==-2&&_y(s,a)),a.type===Ja&&(a.patchFlag===-1&&(a=o[i]=Za(a)),a.el=s.el),a.type===no&&!a.el&&(a.el=s.el)}}function U6(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 WC(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:WC(t)}function zp(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}function qC(e){if(e.placeholder)return e.placeholder;const t=e.component;return t?qC(t.subTree):null}function Ff(e,t){const n=e.props&&e.props[t];fn(n)&&n()}function j6(e,t,n,r,o,i,s,a,l){const{p:u,o:{createElement:d}}=l,h=d("div"),p=e.suspense=KC(e,o,r,t,h,n,i,s,a,l);u(null,p.pendingBranch=e.ssContent,h,null,r,p,i,s),p.deps>0?(Ff(e,"onPending"),Ff(e,"onFallback"),u(null,e.ssFallback,t,n,r,null,i,s),$u(p,e.ssFallback)):p.resolve(!1,!0)}function $6(e,t,n,r,o,i,s,a,{p:l,um:u,o:{createElement:d}}){const h=t.suspense=e.suspense;h.vnode=t,t.el=e.el;const p=t.ssContent,v=t.ssFallback,{activeBranch:g,pendingBranch:y,isInFallback:_,isHydrating:w}=h;if(y)h.pendingBranch=p,Ls(y,p)?(l(y,p,h.hiddenContainer,null,o,h,i,s,a),h.deps<=0?h.resolve():_&&(w||(l(g,v,n,r,o,null,i,s,a),$u(h,v)))):(h.pendingId=Xp++,w?(h.isHydrating=!1,h.activeBranch=y):u(y,o,h),h.deps=0,h.effects.length=0,h.hiddenContainer=d("div"),_?(l(null,p,h.hiddenContainer,null,o,h,i,s,a),h.deps<=0?h.resolve():(l(g,v,n,r,o,null,i,s,a),$u(h,v))):g&&Ls(g,p)?(l(g,p,n,r,o,h,i,s,a),h.resolve(!0)):(l(null,p,h.hiddenContainer,null,o,h,i,s,a),h.deps<=0&&h.resolve()));else if(g&&Ls(g,p))l(g,p,n,r,o,h,i,s,a),$u(h,p);else if(Ff(t,"onPending"),h.pendingBranch=p,p.shapeFlag&512?h.pendingId=p.component.suspenseId:h.pendingId=Xp++,l(null,p,h.hiddenContainer,null,o,h,i,s,a),h.deps<=0)h.resolve();else{const{timeout:I,pendingId:k}=h;I>0?setTimeout(()=>{h.pendingId===k&&h.fallback(v)},I):I===0&&h.fallback(v)}}function KC(e,t,n,r,o,i,s,a,l,u,d=!1){const{p:h,m:p,um:v,n:g,o:{parentNode:y,remove:_}}=u;let w;const I=W6(e);I&&t&&t.pendingBranch&&(w=t.pendingId,t.deps++);const k=e.props?yf(e.props.timeout):void 0,C=i,R={vnode:e,parent:t,parentComponent:n,namespace:s,container:r,hiddenContainer:o,deps:0,pendingId:Xp++,timeout:typeof k=="number"?k:-1,activeBranch:null,isFallbackMountPending:!1,pendingBranch:null,isInFallback:!d,isHydrating:d,isUnmounted:!1,effects:[],resolve(P=!1,M=!1){const{vnode:$,activeBranch:F,pendingBranch:D,pendingId:V,effects:x,parentComponent:B,container:T,isInFallback:te}=R;let U=!1;R.isHydrating?R.isHydrating=!1:P||(U=F&&D.transition&&D.transition.mode==="out-in",U&&(F.transition.afterLeave=()=>{V===R.pendingId&&(p(D,T,i===C?g(F):i,0),xf(x),te&&$.ssFallback&&($.ssFallback.el=null))}),F&&!R.isFallbackMountPending&&(y(F.el)===T&&(i=g(F)),v(F,B,R,!0),!U&&te&&$.ssFallback&&ho(()=>$.ssFallback.el=null,R)),U||p(D,T,i,0)),R.isFallbackMountPending=!1,$u(R,D),R.pendingBranch=null,R.isInFallback=!1;let W=R.parent,Y=!1;for(;W;){if(W.pendingBranch){W.effects.push(...x),Y=!0;break}W=W.parent}!Y&&!U&&xf(x),R.effects=[],I&&t&&t.pendingBranch&&w===t.pendingId&&(t.deps--,t.deps===0&&!M&&t.resolve()),Ff($,"onResolve")},fallback(P){if(!R.pendingBranch)return;const{vnode:M,activeBranch:$,parentComponent:F,container:D,namespace:V}=R;Ff(M,"onFallback");const x=g($),B=()=>{R.isFallbackMountPending=!1,R.isInFallback&&(h(null,P,D,x,F,null,V,a,l),$u(R,P))},T=P.transition&&P.transition.mode==="out-in";T&&(R.isFallbackMountPending=!0,$.transition.afterLeave=B),R.isInFallback=!0,v($,F,null,!0),T||B()},move(P,M,$){R.activeBranch&&p(R.activeBranch,P,M,$),R.container=P},next(){return R.activeBranch&&g(R.activeBranch)},registerDep(P,M,$){const F=!!R.pendingBranch;F&&R.deps++;const D=P.vnode.el;P.asyncDep.catch(V=>{Wc(V,P,0)}).then(V=>{if(P.isUnmounted||R.isUnmounted||R.pendingId!==P.suspenseId)return;Zu(),P.asyncResolved=!0;const{vnode:x}=P;Iy(P,V,!1),D&&(x.el=D);const B=!D&&P.subTree.el;M(P,x,y(D||P.subTree.el),D?null:g(P.subTree),R,s,$),B&&(x.placeholder=null,_(B)),Bp(P,x.el),F&&--R.deps===0&&R.resolve()})},unmount(P,M){R.isUnmounted=!0,R.activeBranch&&v(R.activeBranch,n,P,M),R.pendingBranch&&v(R.pendingBranch,n,P,M)}};return R}function H6(e,t,n,r,o,i,s,a,l){const u=t.suspense=KC(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 G6(e){const{shapeFlag:t,children:n}=e,r=t&32;e.ssContent=YC(r?n.default:n),e.ssFallback=r?YC(n.fallback):un(no)}function YC(e){let t;if(fn(e)){const n=Yl&&e._c;n&&(e._d=!1,fe()),e=e(),n&&(e._d=!0,t=Yo,ZC())}return qt(e)&&(e=N6(e)),e=Oi(e),t&&!e.dynamicChildren&&(e.dynamicChildren=t.filter(n=>n!==e)),e}function XC(e,t){t&&t.pendingBranch?qt(e)?t.effects.push(...e):t.effects.push(e):xf(e)}function $u(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,Bp(r,o))}function W6(e){const t=e.props&&e.props.suspensible;return t!=null&&t!==!1}function fe(e=!1){Yu.push(Yo=e?null:[])}function ZC(){Yu.pop(),Yo=Yu[Yu.length-1]||null}function Nf(e,t=!1){Yl+=e,e<0&&Yo&&t&&(Yo.hasOnce=!0)}function QC(e){return e.dynamicChildren=Yl>0?Yo||Uc:null,ZC(),Yl>0&&Yo&&Yo.push(e),e}function we(e,t,n,r,o,i){return QC(ae(e,t,n,r,o,i,!0))}function wn(e,t,n,r,o){return QC(un(e,t,n,r,o,!0))}function Xa(e){return e?e.__v_isVNode===!0:!1}function Ls(e,t){return e.type===t.type&&e.key===t.key}function q6(e){}function ae(e,t=null,n=null,r=0,o=null,i=e===Ht?0:1,s=!1,a=!1){const l={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&Qy(t),ref:t&&qf(t),scopeId:Uf,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:Fo};return a?(Ay(l,n),i&128&&e.normalize(l)):n&&(l.shapeFlag|=yr(n)?8:16),Yl>0&&!s&&Yo&&(l.patchFlag>0||i&6)&&l.patchFlag!==32&&Yo.push(l),l}function K6(e,t=null,n=null,r=0,o=null,i=!1){if((!e||e===Hy)&&(e=no),Xa(e)){const a=ra(e,t,!0);return n&&Ay(a,n),Yl>0&&!i&&Yo&&(a.shapeFlag&6?Yo[Yo.indexOf(e)]=a:Yo.push(a)),a.patchFlag=-2,a}if(Z6(e)&&(e=e.__vccOpts),t){t=JC(t);let{class:a,style:l}=t;a&&!yr(a)&&(t.class=cn(a)),Zn(l)&&(Cf(l)&&!qt(l)&&(l=dr({},l)),t.style=xn(l))}const s=yr(e)?1:Wf(e)?128:Oy(e)?64:Zn(e)?4:fn(e)?2:0;return ae(e,t,n,r,o,s,i,!0)}function JC(e){return e?Cf(e)||Ky(e)?dr({},e):e:null}function ra(e,t,n=!1,r=!1){const{props:o,ref:i,patchFlag:s,children:a,transition:l}=e,u=t?oa(o||{},t):o,d={__v_isVNode:!0,__v_skip:!0,type:e.type,props:u,key:u&&Qy(u),ref:t&&t.ref?n&&i?qt(i)?i.concat(qf(t)):[i,qf(t)]:qf(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!==Ht?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&&ra(e.ssContent),ssFallback:e.ssFallback&&ra(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return l&&r&&Ya(d,l.clone(d)),d}function Gi(e=" ",t=0){return un(Ja,null,e,t)}function ek(e,t){const n=un(Kl,null,e);return n.staticCount=t,n}function mt(e="",t=!1){return t?(fe(),wn(no,null,e)):un(no,null,e)}function Oi(e){return e==null||typeof e=="boolean"?un(no):qt(e)?un(Ht,null,e.slice()):Xa(e)?Za(e):un(Ja,null,String(e))}function Za(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:ra(e)}function Ay(e,t){let n=0;const{shapeFlag:r}=e;if(t==null)t=null;else if(qt(t))n=16;else if(typeof t=="object")if(r&65){const o=t.default;o&&(o._c&&(o._d=!1),Ay(e,o()),o._c&&(o._d=!0));return}else{n=32;const o=t._;!o&&!Ky(t)?t._ctx=Fo:o===3&&Fo&&(Fo.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else fn(t)?(t={default:t,_ctx:Fo},n=32):(t=String(t),r&64?(n=16,t=[Gi(t)]):n=8);e.children=t,e.shapeFlag|=n}function oa(...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=cn([t.class,r.class]));else if(o==="style")t.style=xn([t.style,r.style]);else if(Mu(o)){const i=t[o],s=r[o];s&&i!==s&&!(qt(i)&&i.includes(s))?t[o]=i?[].concat(i,s):s:s==null&&i==null&&!hf(o)&&(t[o]=s)}else o!==""&&(t[o]=r[o])}return t}function Pi(e,t,n,r=null){hs(e,t,7,[n,r])}function tk(e,t,n){const r=e.type,o=(t?t.appContext:e.appContext)||Dk,i={uid:Fk++,vnode:e,type:r,parent:t,appContext:o,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new _p(!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:VC(r,o),emitsOptions:FC(r,o),emit:null,emitted:null,propsDefaults:Hn,inheritAttrs:r.inheritAttrs,ctx:Hn,data:Hn,props:Hn,attrs:Hn,slots:Hn,refs:Hn,setupState:Hn,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=F6.bind(null,i),e.ce&&e.ce(i),i}function nk(e){return e.vnode.shapeFlag&4}function rk(e,t=!1,n=!1){t&&Xu(t);const{props:r,children:o}=e.vnode,i=nk(e);z6(e,r,i,t),Mk(e,o,n||t);const s=i?Y6(e,t):void 0;return t&&Xu(!1),s}function Y6(e,t){const n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,Wp);const{setup:r}=n;if(r){$a();const o=e.setupContext=r.length>1?ik(e):null,i=Qc(e),s=zu(r,e,0,[e.props,o]),a=vp(s);if(Ha(),i(),(a||e.sp)&&!ia(e)&&hy(e),a){if(s.then(Zu,Zu),t)return s.then(l=>{Iy(e,l,t)}).catch(l=>{Wc(l,e,0)});e.asyncDep=s}else Iy(e,s,t)}else ok(e,t)}function Iy(e,t,n){fn(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:Zn(t)&&(e.setupState=Xv(t)),ok(e,n)}function X6(e){Qp=e,Jy=t=>{t.render._rc&&(t.withProxy=new Proxy(t.ctx,_k))}}function ok(e,t,n){const r=e.type;if(!e.render){if(!t&&Qp&&!r.render){const o=r.template||wy(e).template;if(o){const{isCustomElement:i,compilerOptions:s}=e.appContext.config,{delimiters:a,compilerOptions:l}=r,u=dr(dr({isCustomElement:i,delimiters:a},s),l);r.render=Qp(o,u)}}e.render=r.render||$i,Jy&&Jy(e)}{const o=Qc(e);$a();try{R6(e)}finally{Ha(),o()}}}function ik(e){const t=n=>{e.exposed=n||{}};return{attrs:new Proxy(e.attrs,Bk),slots:e.slots,emit:e.emit,expose:t}}function Bf(e){return e.exposed?e.exposeProxy||(e.exposeProxy=new Proxy(Xv(Ko(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in Ku)return Ku[n](e)},has(t,n){return n in t||n in Ku}})):e.proxy}function Ey(e,t=!0){return fn(e)?e.displayName||e.name:e.name||t&&e.__name}function Z6(e){return fn(e)&&"__vccOpts"in e}function to(e,t,n){try{Nf(-1);const r=arguments.length;return r===2?Zn(t)&&!qt(t)?Xa(t)?un(e,null,[t]):un(e,t):un(e,null,t):(r>3?n=Array.prototype.slice.call(arguments,2):r===3&&Xa(n)&&(n=[n]),un(e,t,n))}finally{Nf(1)}}function Q6(){return;function e(t,n,r){const o=t[r];if(qt(o)&&o.includes(n)||Zn(o)&&n in o||t.extends&&e(t.extends,n,r)||t.mixins&&t.mixins.some(i=>e(i,n,r)))return!0}}function J6(e,t,n,r){const o=n[r];if(o&&sk(o,e))return o;const i=t();return i.memo=e.slice(),i.cacheIndex=r,n[r]=i}function sk(e,t){const n=e.memo;if(n.length!=t.length)return!1;for(let r=0;r<n.length;r++)if(Po(n[r],t[r]))return!1;return Yl>0&&Yo&&Yo.push(e),!0}var Ty,ak,lk,ai,Ms,Kc,Qa,Yc,xy,zf,Hu,Gu,Vf,Fo,Uf,ck,Ry,Ly,Hl,My,Oy,Gl,uk,Py,Dy,Vp,dk,Wl,Os,Wu,Wi,Up,Fy,fk,Ny,jf,By,Xc,hk,pk,$f,Zc,zy,mk,gk,vk,yk,bk,wk,Ck,ia,qu,kk,sa,Vy,Xn,jp,Hf,br,Gf,Uy,jy,$y,$p,Sk,Hy,Hp,Ku,Gp,Wp,_k,qp,Ak,Ik,ql,Gy,Ek,Tk,xk,Wy,qy,Ky,Rk,Kp,Yp,Lk,Yy,Xy,Zy,Mk,Ok,ho,Wf,Xp,Pk,Ht,Ja,no,Kl,Yu,Yo,Yl,Qy,qf,un,Dk,Fk,No,Fr,Zp,Xu,Qc,Zu,Xl,Qp,Jy,Nk,Bk,Ce,eb,zk,Vk,Uk,jk,$k,e8,t8,n8,Hk=eo((()=>{Q5(),Uv(),Ty=[],ak={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"},lk={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"},ai=[],Ms=-1,Kc=[],Qa=null,Yc=0,xy=Promise.resolve(),zf=null,Hu=e=>e.id==null?e.flags&2?-1:1/0:e.id,Vf=[],Fo=null,Uf=null,ck=e=>Do,Ry=Symbol.for("v-scx"),Ly=()=>{{const e=na(Ry);return e}},Hl=new WeakMap,My=Symbol("_vte"),Oy=e=>e.__isTeleport,Gl=e=>e&&(e.disabled||e.disabled===""),uk=e=>e&&(e.defer||e.defer===""),Py=e=>typeof SVGElement<"u"&&e instanceof SVGElement,Dy=e=>typeof MathMLElement=="function"&&e instanceof MathMLElement,Vp=(e,t)=>{const n=e&&e.to;return yr(n)?t?t(n):null:n},dk={name:"Teleport",__isTeleport:!0,process(e,t,n,r,o,i,s,a,l,u){const{mc:d,pc:h,pbc:p,o:{insert:v,querySelector:g,createText:y,createComment:_}}=u,w=Gl(t.props);let{dynamicChildren:I}=t;const k=(P,M,$)=>{P.shapeFlag&16&&d(P.children,M,$,o,i,s,a,l)},C=(P=t)=>{const M=Gl(P.props),$=P.target=Vp(P.props,g),F=uy($,P,y,v);$&&(s!=="svg"&&Py($)?s="svg":s!=="mathml"&&Dy($)&&(s="mathml"),o&&o.isCE&&(o.ce._teleportTargets||(o.ce._teleportTargets=new Set)).add($),M||(k(P,$,F),Mf(P,!1)))},R=P=>{const M=()=>{Hl.get(P)===M&&(Hl.delete(P),Gl(P.props)&&(k(P,n,P.anchor),Mf(P,!0)),C(P))};Hl.set(P,M),ho(M,i)};if(e==null){const P=t.el=y(""),M=t.anchor=y("");if(v(P,n,r),v(M,n,r),uk(t.props)||i&&i.pendingBranch){R(t);return}w&&(k(t,n,M),Mf(t,!0)),C()}else{t.el=e.el;const P=t.anchor=e.anchor,M=Hl.get(e);if(M){M.flags|=8,Hl.delete(e),R(t);return}t.targetStart=e.targetStart;const $=t.target=e.target,F=t.targetAnchor=e.targetAnchor,D=Gl(e.props),V=D?n:$,x=D?P:F;if(s==="svg"||Py($)?s="svg":(s==="mathml"||Dy($))&&(s="mathml"),I?(p(e.dynamicChildren,I,V,o,i,s,a),_y(e,t,!0)):l||h(e,t,V,x,o,i,s,a,!1),w)D?t.props&&e.props&&t.props.to!==e.props.to&&(t.props.to=e.props.to):xp(t,n,P,u,1);else if((t.props&&t.props.to)!==(e.props&&e.props.to)){const B=t.target=Vp(t.props,g);B&&xp(t,B,null,u,0)}else D&&xp(t,$,F,u,1);Mf(t,w)}},remove(e,t,n,{um:r,o:{remove:o}},i){const{shapeFlag:s,children:a,anchor:l,targetStart:u,targetAnchor:d,target:h,props:p}=e;let v=i||!Gl(p);const g=Hl.get(e);if(g&&(g.flags|=8,Hl.delete(e),v=!1),h&&(o(u),o(d)),i&&o(l),s&16)for(let y=0;y<a.length;y++){const _=a[y];r(_,t,n,v,!!_.dynamicChildren)}},move:xp,hydrate:c6},Wl=dk,Os=Symbol("_leaveCb"),Wu=Symbol("_enterCb"),Wi=[Function,Array],Up={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:Wi,onEnter:Wi,onAfterEnter:Wi,onEnterCancelled:Wi,onBeforeLeave:Wi,onLeave:Wi,onAfterLeave:Wi,onLeaveCancelled:Wi,onBeforeAppear:Wi,onAppear:Wi,onAfterAppear:Wi,onAppearCancelled:Wi},Fy=e=>{const t=e.subTree;return t.component?Fy(t.component):t},fk={name:"BaseTransition",props:Up,setup(e,{slots:t}){const n=Fr(),r=dy();return()=>{const o=t.default&&Rp(t.default(),!0);if(!o||!o.length)return;const i=yC(o),s=Rn(e),{mode:a}=s;if(r.isLeaving)return fy(i);const l=wC(i);if(!l)return fy(i);let u=Vu(l,s,r,n,h=>u=h);l.type!==no&&Ya(l,u);let d=n.subTree&&wC(n.subTree);if(d&&d.type!==no&&!Ls(d,l)&&Fy(n).type!==no){let h=Vu(d,s,r,n);if(Ya(d,h),a==="out-in"&&l.type!==no)return r.isLeaving=!0,h.afterLeave=()=>{r.isLeaving=!1,n.job.flags&8||n.update(),delete h.afterLeave,d=void 0},fy(i);a==="in-out"&&l.type!==no?h.delayLeave=(p,v,g)=>{const y=bC(r,d);y[String(d.key)]=d,p[Os]=()=>{v(),p[Os]=void 0,delete u.delayedLeave,d=void 0},u.delayedLeave=()=>{g(),delete u.delayedLeave,d=void 0}}:d=void 0}else d&&(d=void 0);return i}}},Ny=fk,jf=new WeakMap,By=!1,Xc=()=>{By||(console.error("Hydration completed but contains mismatches."),By=!0)},hk=e=>e.namespaceURI.includes("svg")&&e.tagName!=="foreignObject",pk=e=>e.namespaceURI.includes("MathML"),$f=e=>{if(e.nodeType===1){if(hk(e))return"svg";if(pk(e))return"mathml"}},Zc=e=>e.nodeType===8,zy="data-allow-mismatch",mk={0:"text",1:"children",2:"class",3:"style",4:"attribute"},gk=bf().requestIdleCallback||(e=>setTimeout(e,1)),vk=bf().cancelIdleCallback||(e=>clearTimeout(e)),yk=(e=1e4)=>t=>{const n=gk(t,{timeout:e});return()=>vk(n)},bk=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(h6(o))return t(),r.disconnect(),!1;r.observe(o)}}),()=>r.disconnect()},wk=e=>t=>{if(e){const n=matchMedia(e);if(n.matches)t();else return n.addEventListener("change",t,{once:!0}),()=>n.removeEventListener("change",t)}},Ck=(e=[])=>(t,n)=>{yr(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},ia=e=>!!e.type.__asyncLoader,qu=e=>e.type.__isKeepAlive,kk={name:"KeepAlive",__isKeepAlive:!0,props:{include:[String,RegExp,Array],exclude:[String,RegExp,Array],max:[String,Number]},setup(e,{slots:t}){const n=Fr(),r=n.ctx;if(!r.renderer)return()=>{const I=t.default&&t.default();return I&&I.length===1?I[0]:I};const o=new Map,i=new Set;let s=null;const a=n.suspense,{renderer:{p:l,m:u,um:d,o:{createElement:h}}}=r,p=h("div");r.activate=(I,k,C,R,P)=>{const M=I.component;u(I,k,C,0,a),l(M.vnode,I,k,C,M,a,R,I.slotScopeIds,P),ho(()=>{M.isDeactivated=!1,M.a&&Hc(M.a);const $=I.props&&I.props.onVnodeMounted;$&&Pi($,M.parent,I)},a)},r.deactivate=I=>{const k=I.component;zp(k.m),zp(k.a),u(I,p,null,1,a),ho(()=>{k.da&&Hc(k.da);const C=I.props&&I.props.onVnodeUnmounted;C&&Pi(C,k.parent,I),k.isDeactivated=!0},a)};function v(I){gy(I),d(I,n,a,!0)}function g(I){o.forEach((k,C)=>{const R=Ey(ia(k)?k.type.__asyncResolved||{}:k.type);R&&!I(R)&&y(C)})}function y(I){const k=o.get(I);k&&(!s||!Ls(k,s))?v(k):s&&gy(s),o.delete(I),i.delete(I)}$t(()=>[e.include,e.exclude],([I,k])=>{I&&g(C=>Of(I,C)),k&&g(C=>!Of(k,C))},{flush:"post",deep:!0});let _=null;const w=()=>{_!=null&&(Wf(n.subTree.type)?ho(()=>{o.set(_,Op(n.subTree))},n.subTree.suspense):o.set(_,Op(n.subTree)))};return Xn(w),Hf(w),br(()=>{o.forEach(I=>{const{subTree:k,suspense:C}=n,R=Op(k);if(I.type===R.type&&I.key===R.key){gy(R);const P=R.component.da;P&&ho(P,C);return}v(I)})}),()=>{if(_=null,!t.default)return s=null;const I=t.default(),k=I[0];if(I.length>1)return s=null,I;if(!Xa(k)||!(k.shapeFlag&4)&&!(k.shapeFlag&128))return s=null,k;let C=Op(k);if(C.type===no)return s=null,C;const R=C.type,P=Ey(ia(C)?C.type.__asyncResolved||{}:R),{include:M,exclude:$,max:F}=e;if(M&&(!P||!Of(M,P))||$&&P&&Of($,P))return C.shapeFlag&=-257,s=C,k;const D=C.key==null?R:C.key,V=o.get(D);return C.el&&(C=ra(C),k.shapeFlag&128&&(k.ssContent=C)),_=D,V?(C.el=V.el,C.component=V.component,C.transition&&Ya(C,C.transition),C.shapeFlag|=512,i.delete(D),i.add(D)):(i.add(D),F&&i.size>parseInt(F,10)&&y(i.values().next().value)),C.shapeFlag|=256,s=C,Wf(k.type)?k:C}}},sa=e=>(t,n=No)=>{(!Xl||e==="sp")&&Pp(e,(...r)=>t(...r),n)},Vy=sa("bm"),Xn=sa("m"),jp=sa("bu"),Hf=sa("u"),br=sa("bum"),Gf=sa("um"),Uy=sa("sp"),jy=sa("rtg"),$y=sa("rtc"),$p="components",Sk="directives",Hy=Symbol.for("v-ndc"),Hp=e=>e?nk(e)?Bf(e):Hp(e.parent):null,Ku=dr(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=>Hp(e.parent),$root:e=>Hp(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>wy(e),$forceUpdate:e=>e.f||(e.f=()=>{ly(e.update)}),$nextTick:e=>e.n||(e.n=It.bind(e.proxy)),$watch:e=>l6.bind(e)}),Gp=(e,t)=>e!==Hn&&!e.__isScriptSetup&&or(e,t),Wp={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(Gp(r,t))return s[t]=1,r[t];if(o!==Hn&&or(o,t))return s[t]=2,o[t];if(or(i,t))return s[t]=3,i[t];if(n!==Hn&&or(n,t))return s[t]=4,n[t];qp&&(s[t]=0)}}const u=Ku[t];let d,h;if(u)return t==="$attrs"&&ii(e.attrs,"get",""),u(e);if((d=a.__cssModules)&&(d=d[t]))return d;if(n!==Hn&&or(n,t))return s[t]=4,n[t];if(h=l.config.globalProperties,or(h,t))return h[t]},set({_:e},t,n){const{data:r,setupState:o,ctx:i}=e;return Gp(o,t)?(o[t]=n,!0):r!==Hn&&or(r,t)?(r[t]=n,!0):or(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!==Hn&&a[0]!=="$"&&or(e,a)||Gp(t,a)||or(i,a)||or(r,a)||or(Ku,a)||or(o.config.globalProperties,a)||(l=s.__cssModules)&&l[a])},defineProperty(e,t,n){return n.get!=null?e._.accessCache[t]=0:or(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}},_k=dr({},Wp,{get(e,t){if(t!==Symbol.unscopables)return Wp.get(e,t,e)},has(e,t){return t[0]!=="_"&&!Iw(t)}}),qp=!0,Ak={data:OC,props:PC,emits:PC,methods:Df,computed:Df,beforeCreate:wi,created:wi,beforeMount:wi,mounted:wi,beforeUpdate:wi,updated:wi,beforeDestroy:wi,beforeUnmount:wi,destroyed:wi,unmounted:wi,activated:wi,deactivated:wi,errorCaptured:wi,serverPrefetch:wi,components:Df,directives:Df,watch:O6,provide:OC,inject:M6},Ik=0,ql=null,Gy=(e,t)=>t==="modelValue"||t==="model-value"?e.modelModifiers:e[`${t}Modifiers`]||e[`${fo(t)}Modifiers`]||e[`${bi(t)}Modifiers`],Ek=new WeakMap,Tk=e=>{let t;for(const n in e)(n==="class"||n==="style"||Mu(n))&&((t||(t={}))[n]=e[n]);return t},xk=(e,t)=>{const n={};for(const r in e)(!hf(r)||!(r.slice(9)in t))&&(n[r]=e[r]);return n},Wy={},qy=()=>Object.create(Wy),Ky=e=>Object.getPrototypeOf(e)===Wy,Rk=new WeakMap,Kp=e=>e==="_"||e==="_ctx"||e==="$stable",Yp=e=>qt(e)?e.map(Oi):[Oi(e)],Lk=(e,t,n)=>{if(t._n)return t;const r=Do((...o)=>Yp(t(...o)),n);return r._c=!1,r},Yy=(e,t,n)=>{const r=e._ctx;for(const o in e){if(Kp(o))continue;const i=e[o];if(fn(i))t[o]=Lk(o,i,r);else if(i!=null){const s=Yp(i);t[o]=()=>s}}},Xy=(e,t)=>{const n=Yp(t);e.slots.default=()=>n},Zy=(e,t,n)=>{for(const r in t)(n||!Kp(r))&&(e[r]=t[r])},Mk=(e,t,n)=>{const r=e.slots=qy();if(e.vnode.shapeFlag&32){const o=t._;o?(Zy(r,t,n),n&&Nv(r,"_",o,!0)):Yy(t,r)}else t&&Xy(e,t)},Ok=(e,t,n)=>{const{vnode:r,slots:o}=e;let i=!0,s=Hn;if(r.shapeFlag&32){const a=t._;a?n&&a===1?i=!1:Zy(o,t,n):(i=!t.$stable,Yy(t,o)),s=t}else t&&(Xy(e,t),s={default:1});if(i)for(const a in o)!Kp(a)&&s[a]==null&&delete o[a]},ho=XC,Wf=e=>e.__isSuspense,Xp=0,Pk={name:"Suspense",__isSuspense:!0,process(e,t,n,r,o,i,s,a,l,u){if(e==null)j6(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}$6(e,t,n,r,o,s,a,l,u)}},hydrate:H6,normalize:G6},Ht=Symbol.for("v-fgt"),Ja=Symbol.for("v-txt"),no=Symbol.for("v-cmt"),Kl=Symbol.for("v-stc"),Yu=[],Yo=null,Yl=1,Qy=({key:e})=>e??null,qf=({ref:e,ref_key:t,ref_for:n})=>(typeof e=="number"&&(e=""+e),e!=null?yr(e)||Tr(e)||fn(e)?{i:Fo,r:e,k:t,f:!!n}:e:null),un=K6,Dk=DC(),Fk=0,No=null,Fr=()=>No||Fo;{const e=bf(),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)}};Zp=t("__VUE_INSTANCE_SETTERS__",n=>No=n),Xu=t("__VUE_SSR_SETTERS__",n=>Xl=n)}Qc=e=>{const t=No;return Zp(e),e.scope.on(),()=>{e.scope.off(),Zp(t)}},Zu=()=>{No&&No.scope.off(),Zp(null)},Xl=!1,Nk=()=>!Qp,Bk={get(e,t){return ii(e,"get",""),e[t]}},Ce=(e,t)=>Y5(e,t,Xl),eb="3.5.32",zk=$i,Vk=lk,Uk=Gu,jk=pC,$k={createComponentInstance:tk,setupComponent:rk,renderComponentRoot:Np,setCurrentRenderingInstance:Rf,isVNode:Xa,normalizeVNode:Oi,getComponentPublicInstance:Bf,ensureValidVNode:by,pushWarningContext:J5,popWarningContext:e6},e8=null,t8=null,n8=null}));function Gk(e){const t={};for(const x in e)x in lb||(t[x]=e[x]);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:h=`${n}-leave-from`,leaveActiveClass:p=`${n}-leave-active`,leaveToClass:v=`${n}-leave-to`}=e,g=r8(o),y=g&&g[0],_=g&&g[1],{onBeforeEnter:w,onEnter:I,onEnterCancelled:k,onLeave:C,onLeaveCancelled:R,onBeforeAppear:P=w,onAppear:M=I,onAppearCancelled:$=k}=t,F=(x,B,T,te)=>{x._enterCancelled=te,Zl(x,B?d:a),Zl(x,B?u:s),T&&T()},D=(x,B)=>{x._isLeaving=!1,Zl(x,h),Zl(x,v),Zl(x,p),B&&B()},V=x=>(B,T)=>{const te=x?M:I,U=()=>F(B,x,T);Ql(te,[B,U]),Wk(()=>{Zl(B,x?l:i),aa(B,x?d:a),ub(te)||qk(B,r,y,U)})};return dr(t,{onBeforeEnter(x){Ql(w,[x]),aa(x,i),aa(x,s)},onBeforeAppear(x){Ql(P,[x]),aa(x,l),aa(x,u)},onEnter:V(!1),onAppear:V(!0),onLeave(x,B){x._isLeaving=!0;const T=()=>D(x,B);aa(x,h),x._enterCancelled?(aa(x,p),nb(x)):(nb(x),aa(x,p)),Wk(()=>{x._isLeaving&&(Zl(x,h),aa(x,v),ub(C)||qk(x,r,_,T))}),Ql(C,[x,T])},onEnterCancelled(x){F(x,!1,void 0,!0),Ql(k,[x])},onAppearCancelled(x){F(x,!0,void 0,!0),Ql($,[x])},onLeaveCancelled(x){D(x),Ql(R,[x])}})}function r8(e){if(e==null)return null;if(Zn(e))return[tb(e.enter),tb(e.leave)];{const t=tb(e);return[t,t]}}function tb(e){return yf(e)}function aa(e,t){t.split(/\s+/).forEach(n=>n&&e.classList.add(n)),(e[Jc]||(e[Jc]=new Set)).add(t)}function Zl(e,t){t.split(/\s+/).forEach(r=>r&&e.classList.remove(r));const n=e[Jc];n&&(n.delete(t),n.size||(e[Jc]=void 0))}function Wk(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}function qk(e,t,n,r){const o=e._endId=++mS,i=()=>{o===e._endId&&r()};if(n!=null)return setTimeout(i,n);const{type:s,timeout:a,propCount:l}=Kk(e,t);if(!s)return r();const u=s+"end";let d=0;const h=()=>{e.removeEventListener(u,p),i()},p=v=>{v.target===e&&++d>=l&&h()};setTimeout(()=>{d<l&&h()},a+1),e.addEventListener(u,p)}function Kk(e,t){const n=window.getComputedStyle(e),r=g=>(n[g]||"").split(", "),o=r(`${tl}Delay`),i=r(`${tl}Duration`),s=Yk(o,i),a=r(`${Ju}Delay`),l=r(`${Ju}Duration`),u=Yk(a,l);let d=null,h=0,p=0;t===tl?s>0&&(d=tl,h=s,p=i.length):t===Ju?u>0&&(d=Ju,h=u,p=l.length):(h=Math.max(s,u),d=h>0?s>u?tl:Ju:null,p=d?d===tl?i.length:l.length:0);const v=d===tl&&/\b(?:transform|all)(?:,|$)/.test(r(`${tl}Property`).toString());return{type:d,timeout:h,propCount:p,hasTransform:v}}function Yk(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((n,r)=>Xk(n)+Xk(e[r])))}function Xk(e){return e==="auto"?0:Number(e.slice(0,-1).replace(",","."))*1e3}function nb(e){return(e?e.ownerDocument:document).body.offsetHeight}function o8(e,t,n){const r=e[Jc];r&&(t=(t?[t,...r]:[...r]).join(" ")),t==null?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}function Kf(e,t){e.style.display=t?e[Yf]:"none",e[db]=!t}function i8(){fb.getSSRProps=({value:e})=>{if(!e)return{style:{display:"none"}}}}function s8(e){const t=Fr();if(!t)return;const n=t.ut=(o=e(t.proxy))=>{Array.from(document.querySelectorAll(`[data-v-owner="${t.uid}"]`)).forEach(i=>Jp(i,o))},r=()=>{const o=e(t.proxy);t.ce?Jp(t.ce,o):rb(t.subTree,o),n(o)};jp(()=>{xf(r)}),Xn(()=>{$t(r,$i,{flush:"post"});const o=new MutationObserver(r);o.observe(t.subTree.el.parentNode,{childList:!0}),Gf(()=>o.disconnect())})}function rb(e,t){if(e.shapeFlag&128){const n=e.suspense;e=n.activeBranch,n.pendingBranch&&!n.isHydrating&&n.effects.push(()=>{rb(n.activeBranch,t)})}for(;e.component;)e=e.component.subTree;if(e.shapeFlag&1&&e.el)Jp(e.el,t);else if(e.type===Ht)e.children.forEach(n=>rb(n,t));else if(e.type===Kl){let{el:n,anchor:r}=e;for(;n&&(Jp(n,t),n!==r);)n=n.nextSibling}}function Jp(e,t){if(e.nodeType===1){const n=e.style;let r="";for(const o in t){const i=D5(t[o]);n.setProperty(`--${o}`,i),r+=`--${o}: ${i};`}n[hb]=r}}function a8(e,t,n){const r=e.style,o=yr(n);let i=!1;if(n&&!o){if(t)if(yr(t))for(const s of t.split(";")){const a=s.slice(0,s.indexOf(":")).trim();n[a]==null&&em(r,a,"")}else for(const s in t)n[s]==null&&em(r,s,"");for(const s in n)s==="display"&&(i=!0),em(r,s,n[s])}else if(o){if(t!==n){const s=r[hb];s&&(n+=";"+s),r.cssText=n,i=gS.test(n)}}else t&&e.removeAttribute("style");Yf in e&&(e[Yf]=i?r.display:"",e[db]&&(r.display="none"))}function em(e,t,n){if(qt(n))n.forEach(r=>em(e,t,r));else if(n==null&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const r=l8(e,t);pb.test(n)?e.setProperty(bi(r),n.replace(pb,""),"important"):e[r]=n}}function l8(e,t){const n=om[t];if(n)return n;let r=fo(t);if(r!=="filter"&&r in e)return om[t]=r;r=Ou(r);for(let o=0;o<mb.length;o++){const i=mb[o]+r;if(i in e)return om[t]=i}return t}function Zk(e,t,n,r,o,i=Rw(t)){r&&t.startsWith("xlink:")?n==null?e.removeAttributeNS(gb,t.slice(6,t.length)):e.setAttributeNS(gb,t,n):n==null||i&&!bw(n)?e.removeAttribute(t):e.setAttribute(t,i?"":Ri(n)?String(n):n)}function Qk(e,t,n,r,o){if(t==="innerHTML"||t==="textContent"){n!=null&&(e[t]=t==="innerHTML"?ib(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=bw(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 el(e,t,n,r){e.addEventListener(t,n,r)}function c8(e,t,n,r){e.removeEventListener(t,n,r)}function u8(e,t,n,r,o=null){const i=e[vb]||(e[vb]={}),s=i[t];if(r&&s)s.value=r;else{const[a,l]=d8(t);r?el(e,a,i[t]=f8(r,o),l):s&&(c8(e,a,s,l),i[t]=void 0)}}function d8(e){let t;if(yb.test(e)){t={};let n;for(;n=e.match(yb);)e=e.slice(0,e.length-n[0].length),t[n[0].toLowerCase()]=!0}return[e[2]===":"?e.slice(3):bi(e.slice(2)),t]}function f8(e,t){const n=r=>{if(!r._vts)r._vts=Date.now();else if(r._vts<=n.attached)return;hs(h8(r,n.value),t,5,[r])};return n.value=e,n.attached=yS(),n}function h8(e,t){if(qt(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 p8(e,t,n,r){if(r)return!!(t==="innerHTML"||t==="textContent"||t in e&&bb(t)&&fn(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 bb(t)&&yr(n)?!1:t in e}function m8(e,t){const n=e._def.props;if(!n)return!1;const r=fo(t);return Array.isArray(n)?n.some(o=>fo(o)===r):Object.keys(n).some(o=>fo(o)===r)}function Jk(e,t,n){let r=$l(e,t);pf(r)&&(r=dr({},r,t));class o extends kb{constructor(s){super(r,s,n)}}return o.def=r,o}function eS(e){const t=Fr(),n=t&&t.ce;return n||null}function g8(){const e=eS();return e&&e.shadowRoot}function v8(e="$style"){{const t=Fr();if(!t)return Hn;const n=t.type.__cssModules;if(!n)return Hn;const r=n[e];return r||Hn}}function y8(e){const t=e.el;t[Xf]&&t[Xf](),t[Ab]&&t[Ab]()}function b8(e){_b.set(e,tS(e.el))}function w8(e){const t=Sb.get(e),n=_b.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 tS(e){const t=e.getBoundingClientRect();return{left:t.left,top:t.top}}function C8(e,t,n){const r=e.cloneNode(),o=e[Jc];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}=Kk(r);return i.removeChild(r),s}function k8(e){e.target.composing=!0}function nS(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}function rS(e,t,n){return t&&(e=e.trim()),n&&(e=vf(e)),e}function oS(e,{value:t,oldValue:n},r){e._modelValue=t;let o;if(qt(t))o=mp(t,r.props.value)>-1;else if(Vl(t))o=t.has(r.props.value);else{if(t===n)return;o=ja(t,sS(e,!0))}e.checked!==o&&(e.checked=o)}function iS(e,t){const n=e.multiple,r=qt(t);if(!(n&&!r&&!Vl(t))){for(let o=0,i=e.options.length;o<i;o++){const s=e.options[o],a=Qu(s);if(n)if(r){const l=typeof a;l==="string"||l==="number"?s.selected=t.some(u=>String(u)===String(a)):s.selected=mp(t,a)>-1}else s.selected=t.has(a);else if(ja(Qu(s),t)){e.selectedIndex!==o&&(e.selectedIndex=o);return}}!n&&e.selectedIndex!==-1&&(e.selectedIndex=-1)}}function Qu(e){return"_value"in e?e._value:e.value}function sS(e,t){const n=t?"_trueValue":"_falseValue";return n in e?e[n]:t}function aS(e,t){switch(e){case"SELECT":return am;case"TEXTAREA":return Ki;default:switch(t){case"checkbox":return ed;case"radio":return sm;default:return Ki}}}function tm(e,t,n,r,o){const i=aS(e.tagName,n.props&&n.props.type)[o];i&&i(e,t,n,r)}function S8(){Ki.getSSRProps=({value:e})=>({value:e}),sm.getSSRProps=({value:e},t)=>{if(t.props&&ja(t.props.value,e))return{checked:!0}},ed.getSSRProps=({value:e},t)=>{if(qt(e)){if(t.props&&mp(e,t.props.value)>-1)return{checked:!0}}else if(Vl(e)){if(t.props&&e.has(t.props.value))return{checked:!0}}else if(e)return{checked:!0}},Ib.getSSRProps=(e,t)=>{if(typeof t.type!="string")return;const n=aS(t.type.toUpperCase(),t.props&&t.props.type);if(n.getSSRProps)return n.getSSRProps(e,t)}}function lS(){return Zf||(Zf=jC(Eb))}function cS(){return Zf=Tb?Zf:$C(Eb),Tb=!0,Zf}function uS(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function dS(e){return yr(e)?document.querySelector(e):e}var nm,ob,ib,fS,hS,la,sb,ab,tl,Ju,Jc,lb,cb,pS,rm,Ql,ub,mS,Yf,db,fb,hb,gS,pb,mb,om,gb,vb,yb,im,vS,yS,bb,wb,Cb,bS,wS,kb,Sb,_b,Xf,Ab,CS,kS,nl,qi,Ki,ed,sm,am,Ib,SS,_S,an,AS,Ci,Eb,Zf,Tb,xb,IS,eu,Rb,Lb,ES,_8=eo((()=>{if(Hk(),Hk(),Uv(),nm=void 0,ob=typeof window<"u"&&window.trustedTypes,ob)try{nm=ob.createPolicy("vue",{createHTML:e=>e})}catch{}ib=nm?e=>nm.createHTML(e):e=>e,fS="http://www.w3.org/2000/svg",hS="http://www.w3.org/1998/Math/MathML",la=typeof document<"u"?document:null,sb=la&&la.createElement("template"),ab={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"?la.createElementNS(fS,e):t==="mathml"?la.createElementNS(hS,e):n?la.createElement(e,{is:n}):la.createElement(e);return e==="select"&&r&&r.multiple!=null&&o.setAttribute("multiple",r.multiple),o},createText:e=>la.createTextNode(e),createComment:e=>la.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>la.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{sb.innerHTML=ib(r==="svg"?`<svg>${e}</svg>`:r==="mathml"?`<math>${e}</math>`:e);const a=sb.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]}},tl="transition",Ju="animation",Jc=Symbol("_vtc"),lb={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},cb=dr({},Up,lb),pS=e=>(e.displayName="Transition",e.props=cb,e),rm=pS((e,{slots:t})=>to(Ny,Gk(e),t)),Ql=(e,t=[])=>{qt(e)?e.forEach(n=>n(...t)):e&&e(...t)},ub=e=>e?qt(e)?e.some(t=>t.length>1):e.length>1:!1,mS=0,Yf=Symbol("_vod"),db=Symbol("_vsh"),fb={name:"show",beforeMount(e,{value:t},{transition:n}){e[Yf]=e.style.display==="none"?"":e.style.display,n&&t?n.beforeEnter(e):Kf(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),Kf(e,!0),r.enter(e)):r.leave(e,()=>{Kf(e,!1)}):Kf(e,t))},beforeUnmount(e,{value:t}){Kf(e,t)}},hb=Symbol(""),gS=/(?:^|;)\s*display\s*:/,pb=/\s*!important$/,mb=["Webkit","Moz","ms"],om={},gb="http://www.w3.org/1999/xlink",vb=Symbol("_vei"),yb=/(?:Once|Passive|Capture)$/,im=0,vS=Promise.resolve(),yS=()=>im||(vS.then(()=>im=0),im=Date.now()),bb=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,wb=(e,t,n,r,o,i)=>{const s=o==="svg";t==="class"?o8(e,r,s):t==="style"?a8(e,n,r):Mu(t)?hf(t)||u8(e,t,n,r,i):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):p8(e,t,r,s))?(Qk(e,t,r),!e.tagName.includes("-")&&(t==="value"||t==="checked"||t==="selected")&&Zk(e,t,r,s,i,t!=="value")):e._isVueCE&&(m8(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!yr(r)))?Qk(e,fo(t),r,i,t):(t==="true-value"?e._trueValue=r:t==="false-value"&&(e._falseValue=r),Zk(e,t,r,s))},Cb={},bS=((e,t)=>Jk(e,t,Rb)),wS=typeof HTMLElement<"u"?HTMLElement:class{},kb=class Xx extends wS{constructor(t,n={},r=eu){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!==eu?this._root=this.shadowRoot:t.shadowRoot!==!1?(this.attachShadow(dr({},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 Xx){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,It(()=>{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&&!qt(i))for(const l in i){const u=i[l];(u===Number||u&&u.type===Number)&&(l in this._props&&(this._props[l]=yf(this._props[l])),(a||(a=Object.create(null)))[fo(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)or(this,r)||Object.defineProperty(this,r,{get:()=>nt(n[r])})}_resolveProps(t){const{props:n}=t,r=qt(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(fo))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):Cb;const o=fo(t);n&&this._numberProps&&this._numberProps[o]&&(r=yf(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===Cb?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(bi(t),""):typeof n=="string"||typeof n=="number"?this.setAttribute(bi(t),n+""):n||this.removeAttribute(bi(t)),i&&i.observe(this,{attributes:!0})}}_update(){const t=this._createVNode();this._app&&(t.appContext=this._app._context),xb(t,this._root)}_createVNode(){const t={};this.shadowRoot||(t.onVnodeMounted=t.onVnodeUpdated=this._renderSlots.bind(this));const n=un(this._def,dr(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,pf(s[0])?dr({detail:s},s[0]):{detail:s}))};r.emit=(i,...s)=>{o(i,s),bi(i)!==i&&o(bi(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 h;for(;h=d.nextNode();)h.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){}},Sb=new WeakMap,_b=new WeakMap,Xf=Symbol("_moveCb"),Ab=Symbol("_enterCb"),CS=e=>(delete e.props.mode,e),kS=CS({name:"TransitionGroup",props:dr({},cb,{tag:String,moveClass:String}),setup(e,{slots:t}){const n=Fr(),r=dy();let o,i;return Hf(()=>{if(!o.length)return;const s=e.moveClass||`${e.name||"v"}-move`;if(!C8(o[0].el,n.vnode.el,s)){o=[];return}o.forEach(y8),o.forEach(b8);const a=o.filter(w8);nb(n.vnode.el),a.forEach(l=>{const u=l.el,d=u.style;aa(u,s),d.transform=d.webkitTransform=d.transitionDuration="";const h=u[Xf]=p=>{p&&p.target!==u||(!p||p.propertyName.endsWith("transform"))&&(u.removeEventListener("transitionend",h),u[Xf]=null,Zl(u,s))};u.addEventListener("transitionend",h)}),o=[]}),()=>{const s=Rn(e),a=Gk(s);let l=s.tag||Ht;if(o=[],i)for(let u=0;u<i.length;u++){const d=i[u];d.el&&d.el instanceof Element&&(o.push(d),Ya(d,Vu(d,a,r,n)),Sb.set(d,tS(d.el)))}i=t.default?Rp(t.default()):[];for(let u=0;u<i.length;u++){const d=i[u];d.key!=null&&Ya(d,Vu(d,a,r,n))}return un(l,null,i)}}}),nl=e=>{const t=e.props["onUpdate:modelValue"]||!1;return qt(t)?n=>Hc(t,n):t},qi=Symbol("_assign"),Ki={created(e,{modifiers:{lazy:t,trim:n,number:r}},o){e[qi]=nl(o);const i=r||o.props&&o.props.type==="number";el(e,t?"change":"input",s=>{s.target.composing||e[qi](rS(e.value,n,i))}),(n||i)&&el(e,"change",()=>{e.value=rS(e.value,n,i)}),t||(el(e,"compositionstart",k8),el(e,"compositionend",nS),el(e,"change",nS))},mounted(e,{value:t}){e.value=t??""},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:r,trim:o,number:i}},s){if(e[qi]=nl(s),e.composing)return;const a=(i||e.type==="number")&&!/^0\d/.test(e.value)?vf(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)}},ed={deep:!0,created(e,t,n){e[qi]=nl(n),el(e,"change",()=>{const r=e._modelValue,o=Qu(e),i=e.checked,s=e[qi];if(qt(r)){const a=mp(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(Vl(r)){const a=new Set(r);i?a.add(o):a.delete(o),s(a)}else s(sS(e,i))})},mounted:oS,beforeUpdate(e,t,n){e[qi]=nl(n),oS(e,t,n)}},sm={created(e,{value:t},n){e.checked=ja(t,n.props.value),e[qi]=nl(n),el(e,"change",()=>{e[qi](Qu(e))})},beforeUpdate(e,{value:t,oldValue:n},r){e[qi]=nl(r),t!==n&&(e.checked=ja(t,r.props.value))}},am={deep:!0,created(e,{value:t,modifiers:{number:n}},r){const o=Vl(t);el(e,"change",()=>{const i=Array.prototype.filter.call(e.options,s=>s.selected).map(s=>n?vf(Qu(s)):Qu(s));e[qi](e.multiple?o?new Set(i):i:i[0]),e._assigning=!0,It(()=>{e._assigning=!1})}),e[qi]=nl(r)},mounted(e,{value:t}){iS(e,t)},beforeUpdate(e,t,n){e[qi]=nl(n)},updated(e,{value:t}){e._assigning||iS(e,t)}},Ib={created(e,t,n){tm(e,t,n,null,"created")},mounted(e,t,n){tm(e,t,n,null,"mounted")},beforeUpdate(e,t,n,r){tm(e,t,n,r,"beforeUpdate")},updated(e,t,n,r){tm(e,t,n,r,"updated")}},SS=["ctrl","shift","alt","meta"],_S={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)=>SS.some(n=>e[`${n}Key`]&&!t.includes(n))},an=(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=_S[t[s]];if(a&&a(o,t))return}return e(o,...i)}))},AS={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},Ci=(e,t)=>{const n=e._withKeys||(e._withKeys={}),r=t.join(".");return n[r]||(n[r]=(o=>{if(!("key"in o))return;const i=bi(o.key);if(t.some(s=>s===i||AS[s]===i))return e(o)}))},Eb=dr({patchProp:wb},ab),Tb=!1,xb=((...e)=>{lS().render(...e)}),IS=((...e)=>{cS().hydrate(...e)}),eu=((...e)=>{const t=lS().createApp(...e),{mount:n}=t;return t.mount=r=>{const o=dS(r);if(!o)return;const i=t._component;!fn(i)&&!i.render&&!i.template&&(i.template=o.innerHTML),o.nodeType===1&&(o.textContent="");const s=n(o,!1,uS(o));return o instanceof Element&&(o.removeAttribute("v-cloak"),o.setAttribute("data-v-app","")),s},t}),Rb=((...e)=>{const t=cS().createApp(...e),{mount:n}=t;return t.mount=r=>{const o=dS(r);if(o)return n(o,!0,uS(o))},t}),Lb=!1,ES=()=>{Lb||(Lb=!0,S8(),i8())}})),A8=uf({BaseTransition:()=>Ny,BaseTransitionPropsValidators:()=>Up,Comment:()=>no,DeprecationTypes:()=>null,EffectScope:()=>_p,ErrorCodes:()=>ak,ErrorTypeStrings:()=>Vk,Fragment:()=>Ht,KeepAlive:()=>kk,ReactiveEffect:()=>Fu,Static:()=>Kl,Suspense:()=>Pk,Teleport:()=>Wl,Text:()=>Ja,TrackOpTypes:()=>cC,Transition:()=>rm,TransitionGroup:()=>kS,TriggerOpTypes:()=>uC,VueElement:()=>kb,assertNumber:()=>t6,callWithAsyncErrorHandling:()=>hs,callWithErrorHandling:()=>zu,camelize:()=>fo,capitalize:()=>Ou,cloneVNode:()=>ra,compatUtils:()=>null,compile:()=>TS,computed:()=>Ce,createApp:()=>eu,createBlock:()=>wn,createCommentVNode:()=>mt,createElementBlock:()=>we,createElementVNode:()=>ae,createHydrationRenderer:()=>$C,createPropsRestProxy:()=>T6,createRenderer:()=>jC,createSSRApp:()=>Rb,createSlots:()=>v6,createStaticVNode:()=>ek,createTextVNode:()=>Gi,createVNode:()=>un,customRef:()=>Uw,defineAsyncComponent:()=>SC,defineComponent:()=>$l,defineCustomElement:()=>Jk,defineEmits:()=>w6,defineExpose:()=>C6,defineModel:()=>_6,defineOptions:()=>k6,defineProps:()=>b6,defineSSRCustomElement:()=>bS,defineSlots:()=>S6,devtools:()=>Uk,effect:()=>B5,effectScope:()=>jv,getCurrentInstance:()=>Fr,getCurrentScope:()=>$v,getCurrentWatcher:()=>X5,getTransitionRawChildren:()=>Rp,guardReactiveProps:()=>JC,h:()=>to,handleError:()=>Wc,hasInjectionContext:()=>mC,hydrate:()=>IS,hydrateOnIdle:()=>yk,hydrateOnInteraction:()=>Ck,hydrateOnMediaQuery:()=>wk,hydrateOnVisible:()=>bk,initCustomFormatter:()=>Q6,initDirectivesForSSR:()=>ES,inject:()=>na,isMemoSame:()=>sk,isProxy:()=>Cf,isReactive:()=>Li,isReadonly:()=>ea,isRef:()=>Tr,isRuntimeOnly:()=>Nk,isShallow:()=>Mi,isVNode:()=>Xa,markRaw:()=>Ko,mergeDefaults:()=>I6,mergeModels:()=>E6,mergeProps:()=>oa,nextTick:()=>It,nodeOps:()=>ab,normalizeClass:()=>cn,normalizeProps:()=>Ov,normalizeStyle:()=>xn,onActivated:()=>py,onBeforeMount:()=>Vy,onBeforeUnmount:()=>br,onBeforeUpdate:()=>jp,onDeactivated:()=>my,onErrorCaptured:()=>AC,onMounted:()=>Xn,onRenderTracked:()=>$y,onRenderTriggered:()=>jy,onScopeDispose:()=>Lw,onServerPrefetch:()=>Uy,onUnmounted:()=>Gf,onUpdated:()=>Hf,onWatcherCleanup:()=>Hw,openBlock:()=>fe,patchProp:()=>wb,popScopeId:()=>i6,provide:()=>cy,proxyRefs:()=>Xv,pushScopeId:()=>o6,queuePostFlushCb:()=>xf,reactive:()=>vo,readonly:()=>kp,ref:()=>ne,registerRuntimeCompiler:()=>X6,render:()=>xb,renderList:()=>Bn,renderSlot:()=>ju,resolveComponent:()=>g6,resolveDirective:()=>IC,resolveDynamicComponent:()=>vy,resolveFilter:()=>null,resolveTransitionHooks:()=>Vu,setBlockTracking:()=>Nf,setDevtoolsHook:()=>jk,setTransitionHooks:()=>Ya,shallowReactive:()=>zw,shallowReadonly:()=>W5,shallowRef:()=>Yr,ssrContextKey:()=>Ry,ssrUtils:()=>$k,stop:()=>z5,toDisplayString:()=>Et,toHandlerKey:()=>Pu,toHandlers:()=>y6,toRaw:()=>Rn,toRef:()=>Zv,toRefs:()=>jw,toValue:()=>K5,transformVNodeArgs:()=>q6,triggerRef:()=>q5,unref:()=>nt,useAttrs:()=>xC,useCssModule:()=>v8,useCssVars:()=>s8,useHost:()=>eS,useId:()=>u6,useModel:()=>D6,useSSRContext:()=>Ly,useShadowRoot:()=>g8,useSlots:()=>TC,useTemplateRef:()=>d6,useTransitionState:()=>dy,vModelCheckbox:()=>ed,vModelDynamic:()=>Ib,vModelRadio:()=>sm,vModelSelect:()=>am,vModelText:()=>Ki,vShow:()=>fb,version:()=>eb,warn:()=>zk,watch:()=>$t,watchEffect:()=>s6,watchPostEffect:()=>a6,watchSyncEffect:()=>gC,withAsyncContext:()=>x6,withCtx:()=>Do,withDefaults:()=>A6,withDirectives:()=>Hi,withKeys:()=>Ci,withMemo:()=>J6,withModifiers:()=>an,withScopeId:()=>ck}),TS,Ut=eo((()=>{_8(),TS=()=>{}})),I8=dw(((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 h=typeof require=="function"&&require;if(!d&&h)return h(u,!0);if(a)return a(u,!0);var p=new Error("Cannot find module '"+u+"'");throw p.code="MODULE_NOT_FOUND",p}var v=o[u]={exports:{}};r[u][0].call(v.exports,function(g){var y=r[u][1][g];return s(y||g)},v,v.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,h,p,v,g,y,_=[],w=0,I=l.length,k=I,C=i.getTypeOf(l)!=="string";w<l.length;)k=I-w,h=C?(u=l[w++],d=w<I?l[w++]:0,w<I?l[w++]:0):(u=l.charCodeAt(w++),d=w<I?l.charCodeAt(w++):0,w<I?l.charCodeAt(w++):0),p=u>>2,v=(3&u)<<4|d>>4,g=1<k?(15&d)<<2|h>>6:64,y=2<k?63&h:64,_.push(a.charAt(p)+a.charAt(v)+a.charAt(g)+a.charAt(y));return _.join("")},o.decode=function(l){var u,d,h,p,v,g,y=0,_=0,w="data:";if(l.substr(0,w.length)===w)throw new Error("Invalid base64 input, it looks like a data url.");var I,k=3*(l=l.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(l.charAt(l.length-1)===a.charAt(64)&&k--,l.charAt(l.length-2)===a.charAt(64)&&k--,k%1!=0)throw new Error("Invalid base64 input, bad content length.");for(I=s.uint8array?new Uint8Array(0|k):new Array(0|k);y<l.length;)u=a.indexOf(l.charAt(y++))<<2|(p=a.indexOf(l.charAt(y++)))>>4,d=(15&p)<<4|(v=a.indexOf(l.charAt(y++)))>>2,h=(3&v)<<6|(g=a.indexOf(l.charAt(y++))),I[_++]=u,v!==64&&(I[_++]=d),g!==64&&(I[_++]=h);return I}},{"./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,h,p,v,g){this.compressedSize=d,this.uncompressedSize=h,this.crc32=p,this.compression=v,this.compressedContent=g}u.prototype={getContentWorker:function(){var d=new s(i.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new l("data_length")),h=this;return d.on("end",function(){if(this.streamInfo.data_length!==h.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,h,p){return d.pipe(new a).pipe(new l("uncompressedSize")).pipe(h.compressWorker(p)).pipe(new l("compressedSize")).withStreamInfo("compression",h)},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,h,p){var v=s,g=p+h;u^=-1;for(var y=p;y<g;y++)u=u>>>8^v[255&(u^d[y])];return-1^u})(0|l,a,a.length,0):(function(u,d,h,p){var v=s,g=p+h;u^=-1;for(var y=p;y<g;y++)u=u>>>8^v[255&(u^d.charCodeAt(y))];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(h,p){l.call(this,"FlateWorker/"+h),this._pako=null,this._pakoAction=h,this._pakoOptions=p,this.meta={}}o.magic="\b\0",a.inherits(d,l),d.prototype.processChunk=function(h){this.meta=h.meta,this._pako===null&&this._createPako(),this._pako.push(a.transformTo(u,h.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 h=this;this._pako.onData=function(p){h.push({data:p,meta:h.meta})}},o.compressWorker=function(h){return new d("Deflate",h)},o.uncompressWorker=function(){return new d("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(n,r,o){"use strict";function i(v,g){var y,_="";for(y=0;y<g;y++)_+=String.fromCharCode(255&v),v>>>=8;return _}function s(v,g,y,_,w,I){var k,C,R=v.file,P=v.compression,M=I!==u.utf8encode,$=a.transformTo("string",I(R.name)),F=a.transformTo("string",u.utf8encode(R.name)),D=R.comment,V=a.transformTo("string",I(D)),x=a.transformTo("string",u.utf8encode(D)),B=F.length!==R.name.length,T=x.length!==D.length,te="",U="",W="",Y=R.dir,J=R.date,Oe={crc32:0,compressedSize:0,uncompressedSize:0};g&&!y||(Oe.crc32=v.crc32,Oe.compressedSize=v.compressedSize,Oe.uncompressedSize=v.uncompressedSize);var de=0;g&&(de|=8),M||!B&&!T||(de|=2048);var oe=0,pe=0;Y&&(oe|=16),w==="UNIX"?(pe=798,oe|=(function(Ve,rt){var ut=Ve;return Ve||(ut=rt?16893:33204),(65535&ut)<<16})(R.unixPermissions,Y)):(pe=20,oe|=(function(Ve){return 63&(Ve||0)})(R.dosPermissions)),k=J.getUTCHours(),k<<=6,k|=J.getUTCMinutes(),k<<=5,k|=J.getUTCSeconds()/2,C=J.getUTCFullYear()-1980,C<<=4,C|=J.getUTCMonth()+1,C<<=5,C|=J.getUTCDate(),B&&(U=i(1,1)+i(d($),4)+F,te+="up"+i(U.length,2)+U),T&&(W=i(1,1)+i(d(V),4)+x,te+="uc"+i(W.length,2)+W);var Ee="";return Ee+=`
|
|
4
|
-
\0`,Ee+=i(de,2),Ee+=P.magic,Ee+=i(k,2),Ee+=i(C,2),Ee+=i(Oe.crc32,4),Ee+=i(Oe.compressedSize,4),Ee+=i(Oe.uncompressedSize,4),Ee+=i($.length,2),Ee+=i(te.length,2),{fileRecord:h.LOCAL_FILE_HEADER+Ee+$+te,dirRecord:h.CENTRAL_FILE_HEADER+i(pe,2)+Ee+i(V.length,2)+"\0\0\0\0"+i(oe,4)+i(_,4)+$+te+V}}var a=n("../utils"),l=n("../stream/GenericWorker"),u=n("../utf8"),d=n("../crc32"),h=n("../signature");function p(v,g,y,_){l.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=g,this.zipPlatform=y,this.encodeFileName=_,this.streamFiles=v,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(v){var g=v.meta.percent||0,y=this.entriesCount,_=this._sources.length;this.accumulate?this.contentBuffer.push(v):(this.bytesWritten+=v.data.length,l.prototype.push.call(this,{data:v.data,meta:{currentFile:this.currentFile,percent:y?(g+100*(y-_-1))/y:100}}))},p.prototype.openedSource=function(v){this.currentSourceOffset=this.bytesWritten,this.currentFile=v.file.name;var g=this.streamFiles&&!v.file.dir;if(g){var y=s(v,g,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:y.fileRecord,meta:{percent:0}})}else this.accumulate=!0},p.prototype.closedSource=function(v){this.accumulate=!1;var g=this.streamFiles&&!v.file.dir,y=s(v,g,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(y.dirRecord),g)this.push({data:(function(_){return h.DATA_DESCRIPTOR+i(_.crc32,4)+i(_.compressedSize,4)+i(_.uncompressedSize,4)})(v),meta:{percent:100}});else for(this.push({data:y.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},p.prototype.flush=function(){for(var v=this.bytesWritten,g=0;g<this.dirRecords.length;g++)this.push({data:this.dirRecords[g],meta:{percent:100}});var y=this.bytesWritten-v,_=(function(w,I,k,C,R){var P=a.transformTo("string",R(C));return h.CENTRAL_DIRECTORY_END+"\0\0\0\0"+i(w,2)+i(w,2)+i(I,4)+i(k,4)+i(P.length,2)+P})(this.dirRecords.length,y,v,this.zipComment,this.encodeFileName);this.push({data:_,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(v){this._sources.push(v);var g=this;return v.on("data",function(y){g.processChunk(y)}),v.on("end",function(){g.closedSource(g.previous.streamInfo),g._sources.length?g.prepareNextSource():g.end()}),v.on("error",function(y){g.error(y)}),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(v){var g=this._sources;if(!l.prototype.error.call(this,v))return!1;for(var y=0;y<g.length;y++)try{g[y].error(v)}catch{}return!0},p.prototype.lock=function(){l.prototype.lock.call(this);for(var v=this._sources,g=0;g<v.length;g++)v[g].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),h=0;try{a.forEach(function(p,v){h++;var g=(function(I,k){var C=I||k,R=i[C];if(!R)throw new Error(C+" is not a valid compression method !");return R})(v.options.compression,l.compression),y=v.options.compressionOptions||l.compressionOptions||{},_=v.dir,w=v.date;v._compressWorker(g,y).withStreamInfo("file",{name:p,dir:_,date:w,comment:v.comment||"",unixPermissions:v.unixPermissions,dosPermissions:v.dosPermissions}).pipe(d)}),d.entriesCount=h}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 h(p){return new s.Promise(function(v,g){var y=p.decompressed.getContentWorker().pipe(new u);y.on("error",function(_){g(_)}).on("end",function(){y.streamInfo.crc32!==p.decompressed.crc32?g(new Error("Corrupted zip : CRC32 mismatch")):v()}).resume()})}r.exports=function(p,v){var g=this;return v=i.extend(v||{},{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,v.optimizedBinaryString,v.base64).then(function(y){var _=new l(v);return _.load(y),_}).then(function(y){var _=[s.Promise.resolve(y)],w=y.files;if(v.checkCRC32)for(var I=0;I<w.length;I++)_.push(h(w[I]));return s.Promise.all(_)}).then(function(y){for(var _=y.shift(),w=_.files,I=0;I<w.length;I++){var k=w[I],C=k.fileNameStr,R=i.resolve(k.fileNameStr);g.file(R,k.decompressed,{binary:!0,optimizedBinaryString:!0,date:k.date,dir:k.dir,comment:k.fileCommentStr.length?k.fileCommentStr:null,unixPermissions:k.unixPermissions,dosPermissions:k.dosPermissions,createFolders:v.createFolders}),k.dir||(g.file(R).unsafeOriginalName=C)}return _.zipComment.length&&(g.comment=_.zipComment),g})}},{"./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(h,p){d.push(h)||d._helper.pause(),u&&u(p)}).on("error",function(h){d.emit("error",h)}).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(C,R,P){var M,$=a.getTypeOf(R),F=a.extend(P||{},d);F.date=F.date||new Date,F.compression!==null&&(F.compression=F.compression.toUpperCase()),typeof F.unixPermissions=="string"&&(F.unixPermissions=parseInt(F.unixPermissions,8)),F.unixPermissions&&16384&F.unixPermissions&&(F.dir=!0),F.dosPermissions&&16&F.dosPermissions&&(F.dir=!0),F.dir&&(C=w(C)),F.createFolders&&(M=_(C))&&I.call(this,M,!0);var D=$==="string"&&F.binary===!1&&F.base64===!1;P&&P.binary!==void 0||(F.binary=!D),(R instanceof h&&R.uncompressedSize===0||F.dir||!R||R.length===0)&&(F.base64=!1,F.binary=!0,R="",F.compression="STORE",$="string");var V=null;V=R instanceof h||R instanceof l?R:g.isNode&&g.isStream(R)?new y(C,R):a.prepareContent(C,R,F.binary,F.optimizedBinaryString,F.base64);var x=new p(C,V,F);this.files[C]=x}var s=n("./utf8"),a=n("./utils"),l=n("./stream/GenericWorker"),u=n("./stream/StreamHelper"),d=n("./defaults"),h=n("./compressedObject"),p=n("./zipObject"),v=n("./generate"),g=n("./nodejsUtils"),y=n("./nodejs/NodejsStreamInputAdapter"),_=function(C){C.slice(-1)==="/"&&(C=C.substring(0,C.length-1));var R=C.lastIndexOf("/");return 0<R?C.substring(0,R):""},w=function(C){return C.slice(-1)!=="/"&&(C+="/"),C},I=function(C,R){return R=R!==void 0?R:d.createFolders,C=w(C),this.files[C]||i.call(this,C,null,{dir:!0,createFolders:R}),this.files[C]};function k(C){return Object.prototype.toString.call(C)==="[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(C){var R,P,M;for(R in this.files)M=this.files[R],(P=R.slice(this.root.length,R.length))&&R.slice(0,this.root.length)===this.root&&C(P,M)},filter:function(C){var R=[];return this.forEach(function(P,M){C(P,M)&&R.push(M)}),R},file:function(C,R,P){if(arguments.length!==1)return C=this.root+C,i.call(this,C,R,P),this;if(k(C)){var M=C;return this.filter(function(F,D){return!D.dir&&M.test(F)})}var $=this.files[this.root+C];return $&&!$.dir?$:null},folder:function(C){if(!C)return this;if(k(C))return this.filter(function($,F){return F.dir&&C.test($)});var R=this.root+C,P=I.call(this,R),M=this.clone();return M.root=P.name,M},remove:function(C){C=this.root+C;var R=this.files[C];if(R||(C.slice(-1)!=="/"&&(C+="/"),R=this.files[C]),R&&!R.dir)delete this.files[C];else for(var P=this.filter(function($,F){return F.name.slice(0,C.length)===C}),M=0;M<P.length;M++)delete this.files[P[M].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(C){var R,P={};try{if((P=a.extend(C||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:s.utf8encode})).type=P.type.toLowerCase(),P.compression=P.compression.toUpperCase(),P.type==="binarystring"&&(P.type="string"),!P.type)throw new Error("No output type specified.");a.checkSupport(P.type),P.platform!=="darwin"&&P.platform!=="freebsd"&&P.platform!=="linux"&&P.platform!=="sunos"||(P.platform="UNIX"),P.platform==="win32"&&(P.platform="DOS");var M=P.comment||this.comment||"";R=v.generateWorker(this,P,M)}catch($){(R=new l("error")).error($)}return new u(R,P.type||"string",P.mimeType)},generateAsync:function(C,R){return this.generateInternalStream(C).accumulate(R)},generateNodeStream:function(C,R){return(C=C||{}).type||(C.type="nodebuffer"),this.generateInternalStream(C).toNodejsStream(R)}}},{"./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),h=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]===h)return p-this.zero;return-1},s.prototype.readAndCheckSignature=function(a){var l=a.charCodeAt(0),u=a.charCodeAt(1),d=a.charCodeAt(2),h=a.charCodeAt(3),p=this.readData(4);return l===p[0]&&u===p[1]&&d===p[2]&&h===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(h){var p=i.getTypeOf(h);return i.checkSupport(p),p!=="string"||s.uint8array?p==="nodebuffer"?new u(h):s.uint8array?new d(i.transformTo("uint8array",h)):new a(i.transformTo("array",h)):new l(h)}},{"../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"),h=null;if(u.nodestream)try{h=n("../nodejs/NodejsStreamOutputAdapter")}catch{}function p(g,y){return new d.Promise(function(_,w){var I=[],k=g._internalType,C=g._outputType,R=g._mimeType;g.on("data",function(P,M){I.push(P),y&&y(M)}).on("error",function(P){I=[],w(P)}).on("end",function(){try{_((function(P,M,$){switch(P){case"blob":return i.newBlob(i.transformTo("arraybuffer",M),$);case"base64":return l.encode(M);default:return i.transformTo(P,M)}})(C,(function(P,M){var $,F=0,D=null,V=0;for($=0;$<M.length;$++)V+=M[$].length;switch(P){case"string":return M.join("");case"array":return Array.prototype.concat.apply([],M);case"uint8array":for(D=new Uint8Array(V),$=0;$<M.length;$++)D.set(M[$],F),F+=M[$].length;return D;case"nodebuffer":return Buffer.concat(M);default:throw new Error("concat : unsupported type '"+P+"'")}})(k,I),R))}catch(P){w(P)}I=[]}).resume()})}function v(g,y,_){var w=y;switch(y){case"blob":case"arraybuffer":w="uint8array";break;case"base64":w="string"}try{this._internalType=w,this._outputType=y,this._mimeType=_,i.checkSupport(w),this._worker=g.pipe(new s(w)),g.lock()}catch(I){this._worker=new a("error"),this._worker.error(I)}}v.prototype={accumulate:function(g){return p(this,g)},on:function(g,y){var _=this;return g==="data"?this._worker.on(g,function(w){y.call(_,w.data,w.meta)}):this._worker.on(g,function(){i.delay(y,arguments,_)}),this},resume:function(){return i.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(g){if(i.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new h(this,{objectMode:this._outputType!=="nodebuffer"},g)}},r.exports=v},{"../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 h(){l.call(this,"utf-8 decode"),this.leftOver=null}function p(){l.call(this,"utf-8 encode")}o.utf8encode=function(v){return s.nodebuffer?a.newBufferFrom(v,"utf-8"):(function(g){var y,_,w,I,k,C=g.length,R=0;for(I=0;I<C;I++)(64512&(_=g.charCodeAt(I)))==55296&&I+1<C&&(64512&(w=g.charCodeAt(I+1)))==56320&&(_=65536+(_-55296<<10)+(w-56320),I++),R+=_<128?1:_<2048?2:_<65536?3:4;for(y=s.uint8array?new Uint8Array(R):new Array(R),I=k=0;k<R;I++)(64512&(_=g.charCodeAt(I)))==55296&&I+1<C&&(64512&(w=g.charCodeAt(I+1)))==56320&&(_=65536+(_-55296<<10)+(w-56320),I++),_<128?y[k++]=_:(_<2048?y[k++]=192|_>>>6:(_<65536?y[k++]=224|_>>>12:(y[k++]=240|_>>>18,y[k++]=128|_>>>12&63),y[k++]=128|_>>>6&63),y[k++]=128|63&_);return y})(v)},o.utf8decode=function(v){return s.nodebuffer?i.transformTo("nodebuffer",v).toString("utf-8"):(function(g){var y,_,w,I,k=g.length,C=new Array(2*k);for(y=_=0;y<k;)if((w=g[y++])<128)C[_++]=w;else if(4<(I=u[w]))C[_++]=65533,y+=I-1;else{for(w&=I===2?31:I===3?15:7;1<I&&y<k;)w=w<<6|63&g[y++],I--;1<I?C[_++]=65533:w<65536?C[_++]=w:(w-=65536,C[_++]=55296|w>>10&1023,C[_++]=56320|1023&w)}return C.length!==_&&(C.subarray?C=C.subarray(0,_):C.length=_),i.applyFromCharCode(C)})(v=i.transformTo(s.uint8array?"uint8array":"array",v))},i.inherits(h,l),h.prototype.processChunk=function(v){var g=i.transformTo(s.uint8array?"uint8array":"array",v.data);if(this.leftOver&&this.leftOver.length){if(s.uint8array){var y=g;(g=new Uint8Array(y.length+this.leftOver.length)).set(this.leftOver,0),g.set(y,this.leftOver.length)}else g=this.leftOver.concat(g);this.leftOver=null}var _=(function(I,k){var C;for((k=k||I.length)>I.length&&(k=I.length),C=k-1;0<=C&&(192&I[C])==128;)C--;return C<0||C===0?k:C+u[I[C]]>k?C:k})(g),w=g;_!==g.length&&(s.uint8array?(w=g.subarray(0,_),this.leftOver=g.subarray(_,g.length)):(w=g.slice(0,_),this.leftOver=g.slice(_,g.length))),this.push({data:o.utf8decode(w),meta:v.meta})},h.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:o.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},o.Utf8DecodeWorker=h,i.inherits(p,l),p.prototype.processChunk=function(v){this.push({data:o.utf8encode(v.data),meta:v.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(y){return y}function d(y,_){for(var w=0;w<y.length;++w)_[w]=255&y.charCodeAt(w);return _}n("setimmediate"),o.newBlob=function(y,_){o.checkSupport("blob");try{return new Blob([y],{type:_})}catch{try{var w=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return w.append(y),w.getBlob(_)}catch{throw new Error("Bug : can't construct the Blob.")}}};var h={stringifyByChunk:function(y,_,w){var I=[],k=0,C=y.length;if(C<=w)return String.fromCharCode.apply(null,y);for(;k<C;)_==="array"||_==="nodebuffer"?I.push(String.fromCharCode.apply(null,y.slice(k,Math.min(k+w,C)))):I.push(String.fromCharCode.apply(null,y.subarray(k,Math.min(k+w,C)))),k+=w;return I.join("")},stringifyByChar:function(y){for(var _="",w=0;w<y.length;w++)_+=String.fromCharCode(y[w]);return _},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(y){var _=65536,w=o.getTypeOf(y),I=!0;if(w==="uint8array"?I=h.applyCanBeUsed.uint8array:w==="nodebuffer"&&(I=h.applyCanBeUsed.nodebuffer),I)for(;1<_;)try{return h.stringifyByChunk(y,w,_)}catch{_=Math.floor(_/2)}return h.stringifyByChar(y)}function v(y,_){for(var w=0;w<y.length;w++)_[w]=y[w];return _}o.applyFromCharCode=p;var g={};g.string={string:u,array:function(y){return d(y,new Array(y.length))},arraybuffer:function(y){return g.string.uint8array(y).buffer},uint8array:function(y){return d(y,new Uint8Array(y.length))},nodebuffer:function(y){return d(y,a.allocBuffer(y.length))}},g.array={string:p,array:u,arraybuffer:function(y){return new Uint8Array(y).buffer},uint8array:function(y){return new Uint8Array(y)},nodebuffer:function(y){return a.newBufferFrom(y)}},g.arraybuffer={string:function(y){return p(new Uint8Array(y))},array:function(y){return v(new Uint8Array(y),new Array(y.byteLength))},arraybuffer:u,uint8array:function(y){return new Uint8Array(y)},nodebuffer:function(y){return a.newBufferFrom(new Uint8Array(y))}},g.uint8array={string:p,array:function(y){return v(y,new Array(y.length))},arraybuffer:function(y){return y.buffer},uint8array:u,nodebuffer:function(y){return a.newBufferFrom(y)}},g.nodebuffer={string:p,array:function(y){return v(y,new Array(y.length))},arraybuffer:function(y){return g.nodebuffer.uint8array(y).buffer},uint8array:function(y){return v(y,new Uint8Array(y.length))},nodebuffer:u},o.transformTo=function(y,_){return _=_||"",y?(o.checkSupport(y),g[o.getTypeOf(_)][y](_)):_},o.resolve=function(y){for(var _=y.split("/"),w=[],I=0;I<_.length;I++){var k=_[I];k==="."||k===""&&I!==0&&I!==_.length-1||(k===".."?w.pop():w.push(k))}return w.join("/")},o.getTypeOf=function(y){return typeof y=="string"?"string":Object.prototype.toString.call(y)==="[object Array]"?"array":i.nodebuffer&&a.isBuffer(y)?"nodebuffer":i.uint8array&&y instanceof Uint8Array?"uint8array":i.arraybuffer&&y instanceof ArrayBuffer?"arraybuffer":void 0},o.checkSupport=function(y){if(!i[y.toLowerCase()])throw new Error(y+" is not supported by this platform")},o.MAX_VALUE_16BITS=65535,o.MAX_VALUE_32BITS=-1,o.pretty=function(y){var _,w,I="";for(w=0;w<(y||"").length;w++)I+="\\x"+((_=y.charCodeAt(w))<16?"0":"")+_.toString(16).toUpperCase();return I},o.delay=function(y,_,w){setImmediate(function(){y.apply(w||null,_||[])})},o.inherits=function(y,_){function w(){}w.prototype=_.prototype,y.prototype=new w},o.extend=function(){var y,_,w={};for(y=0;y<arguments.length;y++)for(_ in arguments[y])Object.prototype.hasOwnProperty.call(arguments[y],_)&&w[_]===void 0&&(w[_]=arguments[y][_]);return w},o.prepareContent=function(y,_,w,I,k){return l.Promise.resolve(_).then(function(C){return i.blob&&(C instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(C))!==-1)&&typeof FileReader<"u"?new l.Promise(function(R,P){var M=new FileReader;M.onload=function($){R($.target.result)},M.onerror=function($){P($.target.error)},M.readAsArrayBuffer(C)}):C}).then(function(C){var R=o.getTypeOf(C);return R?(R==="arraybuffer"?C=o.transformTo("uint8array",C):R==="string"&&(k?C=s.decode(C):w&&I!==!0&&(C=(function(P){return d(P,i.uint8array?new Uint8Array(P.length):new Array(P.length))})(C))),C):l.Promise.reject(new Error("Can't read the data of '"+y+"'. 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(h){this.files=[],this.loadOptions=h}d.prototype={checkSignature:function(h){if(!this.reader.readAndCheckSignature(h)){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(h)+")")}},isSignature:function(h,p){var v=this.reader.index;this.reader.setIndex(h);var g=this.reader.readString(4)===p;return this.reader.setIndex(v),g},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 h=this.reader.readData(this.zipCommentLength),p=u.uint8array?"uint8array":"array",v=s.transformTo(p,h);this.zipComment=this.loadOptions.decodeFileName(v)},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 h,p,v,g=this.zip64EndOfCentralSize-44;0<g;)h=this.reader.readInt(2),p=this.reader.readInt(4),v=this.reader.readData(p),this.zip64ExtensibleData[h]={id:h,length:p,value:v}},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 h,p;for(h=0;h<this.files.length;h++)p=this.files[h],this.reader.setIndex(p.localHeaderOffset),this.checkSignature(a.LOCAL_FILE_HEADER),p.readLocalPart(this.reader),p.handleUTF8(),p.processAttributes()},readCentralDir:function(){var h;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(a.CENTRAL_FILE_HEADER);)(h=new l({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(h);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 h=this.reader.lastIndexOfSignature(a.CENTRAL_DIRECTORY_END);if(h<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(h);var p=h;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,(h=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(h),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 v=this.centralDirOffset+this.centralDirSize;this.zip64&&(v+=20,v+=12+this.zip64EndOfCentralSize);var g=p-v;if(0<g)this.isSignature(p,a.CENTRAL_FILE_HEADER)||(this.reader.zero=g);else if(g<0)throw new Error("Corrupted zip: missing "+Math.abs(g)+" bytes.")},prepareReader:function(h){this.reader=i(h)},load:function(h){this.prepareReader(h),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"),h=n("./support");function p(v,g){this.options=v,this.loadOptions=g}p.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(v){var g,y;if(v.skip(22),this.fileNameLength=v.readInt(2),y=v.readInt(2),this.fileName=v.readData(this.fileNameLength),v.skip(y),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((g=(function(_){for(var w in d)if(Object.prototype.hasOwnProperty.call(d,w)&&d[w].magic===_)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,g,v.readData(this.compressedSize))},readCentralPart:function(v){this.versionMadeBy=v.readInt(2),v.skip(2),this.bitFlag=v.readInt(2),this.compressionMethod=v.readString(2),this.date=v.readDate(),this.crc32=v.readInt(4),this.compressedSize=v.readInt(4),this.uncompressedSize=v.readInt(4);var g=v.readInt(2);if(this.extraFieldsLength=v.readInt(2),this.fileCommentLength=v.readInt(2),this.diskNumberStart=v.readInt(2),this.internalFileAttributes=v.readInt(2),this.externalFileAttributes=v.readInt(4),this.localHeaderOffset=v.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");v.skip(g),this.readExtraFields(v),this.parseZIP64ExtraField(v),this.fileComment=v.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var v=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),v==0&&(this.dosPermissions=63&this.externalFileAttributes),v==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var v=i(this.extraFields[1].value);this.uncompressedSize===s.MAX_VALUE_32BITS&&(this.uncompressedSize=v.readInt(8)),this.compressedSize===s.MAX_VALUE_32BITS&&(this.compressedSize=v.readInt(8)),this.localHeaderOffset===s.MAX_VALUE_32BITS&&(this.localHeaderOffset=v.readInt(8)),this.diskNumberStart===s.MAX_VALUE_32BITS&&(this.diskNumberStart=v.readInt(4))}},readExtraFields:function(v){var g,y,_,w=v.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});v.index+4<w;)g=v.readInt(2),y=v.readInt(2),_=v.readData(y),this.extraFields[g]={id:g,length:y,value:_};v.setIndex(w)},handleUTF8:function(){var v=h.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=u.utf8decode(this.fileName),this.fileCommentStr=u.utf8decode(this.fileComment);else{var g=this.findExtraFieldUnicodePath();if(g!==null)this.fileNameStr=g;else{var y=s.transformTo(v,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(y)}var _=this.findExtraFieldUnicodeComment();if(_!==null)this.fileCommentStr=_;else{var w=s.transformTo(v,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(w)}}},findExtraFieldUnicodePath:function(){var v=this.extraFields[28789];if(v){var g=i(v.value);return g.readInt(1)!==1||l(this.fileName)!==g.readInt(4)?null:u.utf8decode(g.readData(v.length-5))}return null},findExtraFieldUnicodeComment:function(){var v=this.extraFields[25461];if(v){var g=i(v.value);return g.readInt(1)!==1||l(this.fileComment)!==g.readInt(4)?null:u.utf8decode(g.readData(v.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(g,y,_){this.name=g,this.dir=_.dir,this.date=_.date,this.comment=_.comment,this.unixPermissions=_.unixPermissions,this.dosPermissions=_.dosPermissions,this._data=y,this._dataBinary=_.binary,this.options={compression:_.compression,compressionOptions:_.compressionOptions}}var s=n("./stream/StreamHelper"),a=n("./stream/DataWorker"),l=n("./utf8"),u=n("./compressedObject"),d=n("./stream/GenericWorker");i.prototype={internalStream:function(g){var y=null,_="string";try{if(!g)throw new Error("No output type specified.");var w=(_=g.toLowerCase())==="string"||_==="text";_!=="binarystring"&&_!=="text"||(_="string"),y=this._decompressWorker();var I=!this._dataBinary;I&&!w&&(y=y.pipe(new l.Utf8EncodeWorker)),!I&&w&&(y=y.pipe(new l.Utf8DecodeWorker))}catch(k){(y=new d("error")).error(k)}return new s(y,_,"")},async:function(g,y){return this.internalStream(g).accumulate(y)},nodeStream:function(g,y){return this.internalStream(g||"nodebuffer").toNodejsStream(y)},_compressWorker:function(g,y){if(this._data instanceof u&&this._data.compression.magic===g.magic)return this._data.getCompressedWorker();var _=this._decompressWorker();return this._dataBinary||(_=_.pipe(new l.Utf8EncodeWorker)),u.createWorkerFrom(_,g,y)},_decompressWorker:function(){return this._data instanceof u?this._data.getContentWorker():this._data instanceof d?this._data:new a(this._data)}};for(var h=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],p=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},v=0;v<h.length;v++)i.prototype[h[v]]=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(g),h=i.document.createTextNode("");d.observe(h,{characterData:!0}),s=function(){h.data=u=++u%2}}else if(i.setImmediate||i.MessageChannel===void 0)s="document"in i&&"onreadystatechange"in i.document.createElement("script")?function(){var y=i.document.createElement("script");y.onreadystatechange=function(){g(),y.onreadystatechange=null,y.parentNode.removeChild(y),y=null},i.document.documentElement.appendChild(y)}:function(){setTimeout(g,0)};else{var p=new i.MessageChannel;p.port1.onmessage=g,s=function(){p.port2.postMessage(0)}}var v=[];function g(){var y,_;a=!0;for(var w=v.length;w;){for(_=v,v=[],y=-1;++y<w;)_[y]();w=v.length}a=!1}r.exports=function(y){v.push(y)!==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 h(w){if(typeof w!="function")throw new TypeError("resolver must be a function");this.state=d,this.queue=[],this.outcome=void 0,w!==s&&y(this,w)}function p(w,I,k){this.promise=w,typeof I=="function"&&(this.onFulfilled=I,this.callFulfilled=this.otherCallFulfilled),typeof k=="function"&&(this.onRejected=k,this.callRejected=this.otherCallRejected)}function v(w,I,k){i(function(){var C;try{C=I(k)}catch(R){return a.reject(w,R)}C===w?a.reject(w,new TypeError("Cannot resolve promise with itself")):a.resolve(w,C)})}function g(w){var I=w&&w.then;if(w&&(typeof w=="object"||typeof w=="function")&&typeof I=="function")return function(){I.apply(w,arguments)}}function y(w,I){var k=!1;function C(M){k||(k=!0,a.reject(w,M))}function R(M){k||(k=!0,a.resolve(w,M))}var P=_(function(){I(R,C)});P.status==="error"&&C(P.value)}function _(w,I){var k={};try{k.value=w(I),k.status="success"}catch(C){k.status="error",k.value=C}return k}(r.exports=h).prototype.finally=function(w){if(typeof w!="function")return this;var I=this.constructor;return this.then(function(k){return I.resolve(w()).then(function(){return k})},function(k){return I.resolve(w()).then(function(){throw k})})},h.prototype.catch=function(w){return this.then(null,w)},h.prototype.then=function(w,I){if(typeof w!="function"&&this.state===u||typeof I!="function"&&this.state===l)return this;var k=new this.constructor(s);return this.state!==d?v(k,this.state===u?w:I,this.outcome):this.queue.push(new p(k,w,I)),k},p.prototype.callFulfilled=function(w){a.resolve(this.promise,w)},p.prototype.otherCallFulfilled=function(w){v(this.promise,this.onFulfilled,w)},p.prototype.callRejected=function(w){a.reject(this.promise,w)},p.prototype.otherCallRejected=function(w){v(this.promise,this.onRejected,w)},a.resolve=function(w,I){var k=_(g,I);if(k.status==="error")return a.reject(w,k.value);var C=k.value;if(C)y(w,C);else{w.state=u,w.outcome=I;for(var R=-1,P=w.queue.length;++R<P;)w.queue[R].callFulfilled(I)}return w},a.reject=function(w,I){w.state=l,w.outcome=I;for(var k=-1,C=w.queue.length;++k<C;)w.queue[k].callRejected(I);return w},h.resolve=function(w){return w instanceof this?w:a.resolve(new this(s),w)},h.reject=function(w){var I=new this(s);return a.reject(I,w)},h.all=function(w){var I=this;if(Object.prototype.toString.call(w)!=="[object Array]")return this.reject(new TypeError("must be an array"));var k=w.length,C=!1;if(!k)return this.resolve([]);for(var R=new Array(k),P=0,M=-1,$=new this(s);++M<k;)F(w[M],M);return $;function F(D,V){I.resolve(D).then(function(x){R[V]=x,++P!==k||C||(C=!0,a.resolve($,R))},function(x){C||(C=!0,a.reject($,x))})}},h.race=function(w){var I=this;if(Object.prototype.toString.call(w)!=="[object Array]")return this.reject(new TypeError("must be an array"));var k=w.length,C=!1;if(!k)return this.resolve([]);for(var R=-1,P=new this(s);++R<k;)M=w[R],I.resolve(M).then(function($){C||(C=!0,a.resolve(P,$))},function($){C||(C=!0,a.reject(P,$))});var M;return P}},{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,h=0,p=-1,v=0,g=8;function y(w){if(!(this instanceof y))return new y(w);this.options=s.assign({level:p,method:g,chunkSize:16384,windowBits:15,memLevel:8,strategy:v,to:""},w||{});var I=this.options;I.raw&&0<I.windowBits?I.windowBits=-I.windowBits:I.gzip&&0<I.windowBits&&I.windowBits<16&&(I.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new u,this.strm.avail_out=0;var k=i.deflateInit2(this.strm,I.level,I.method,I.windowBits,I.memLevel,I.strategy);if(k!==h)throw new Error(l[k]);if(I.header&&i.deflateSetHeader(this.strm,I.header),I.dictionary){var C;if(C=typeof I.dictionary=="string"?a.string2buf(I.dictionary):d.call(I.dictionary)==="[object ArrayBuffer]"?new Uint8Array(I.dictionary):I.dictionary,(k=i.deflateSetDictionary(this.strm,C))!==h)throw new Error(l[k]);this._dict_set=!0}}function _(w,I){var k=new y(I);if(k.push(w,!0),k.err)throw k.msg||l[k.err];return k.result}y.prototype.push=function(w,I){var k,C,R=this.strm,P=this.options.chunkSize;if(this.ended)return!1;C=I===~~I?I:I===!0?4:0,typeof w=="string"?R.input=a.string2buf(w):d.call(w)==="[object ArrayBuffer]"?R.input=new Uint8Array(w):R.input=w,R.next_in=0,R.avail_in=R.input.length;do{if(R.avail_out===0&&(R.output=new s.Buf8(P),R.next_out=0,R.avail_out=P),(k=i.deflate(R,C))!==1&&k!==h)return this.onEnd(k),!(this.ended=!0);R.avail_out!==0&&(R.avail_in!==0||C!==4&&C!==2)||(this.options.to==="string"?this.onData(a.buf2binstring(s.shrinkBuf(R.output,R.next_out))):this.onData(s.shrinkBuf(R.output,R.next_out)))}while((0<R.avail_in||R.avail_out===0)&&k!==1);return C===4?(k=i.deflateEnd(this.strm),this.onEnd(k),this.ended=!0,k===h):C!==2||(this.onEnd(h),!(R.avail_out=0))},y.prototype.onData=function(w){this.chunks.push(w)},y.prototype.onEnd=function(w){w===h&&(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=y,o.deflate=_,o.deflateRaw=function(w,I){return(I=I||{}).raw=!0,_(w,I)},o.gzip=function(w,I){return(I=I||{}).gzip=!0,_(w,I)}},{"./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"),h=n("./zlib/gzheader"),p=Object.prototype.toString;function v(y){if(!(this instanceof v))return new v(y);this.options=s.assign({chunkSize:16384,windowBits:0,to:""},y||{});var _=this.options;_.raw&&0<=_.windowBits&&_.windowBits<16&&(_.windowBits=-_.windowBits,_.windowBits===0&&(_.windowBits=-15)),!(0<=_.windowBits&&_.windowBits<16)||y&&y.windowBits||(_.windowBits+=32),15<_.windowBits&&_.windowBits<48&&(15&_.windowBits)==0&&(_.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,_.windowBits);if(w!==l.Z_OK)throw new Error(u[w]);this.header=new h,i.inflateGetHeader(this.strm,this.header)}function g(y,_){var w=new v(_);if(w.push(y,!0),w.err)throw w.msg||u[w.err];return w.result}v.prototype.push=function(y,_){var w,I,k,C,R,P,M=this.strm,$=this.options.chunkSize,F=this.options.dictionary,D=!1;if(this.ended)return!1;I=_===~~_?_:_===!0?l.Z_FINISH:l.Z_NO_FLUSH,typeof y=="string"?M.input=a.binstring2buf(y):p.call(y)==="[object ArrayBuffer]"?M.input=new Uint8Array(y):M.input=y,M.next_in=0,M.avail_in=M.input.length;do{if(M.avail_out===0&&(M.output=new s.Buf8($),M.next_out=0,M.avail_out=$),(w=i.inflate(M,l.Z_NO_FLUSH))===l.Z_NEED_DICT&&F&&(P=typeof F=="string"?a.string2buf(F):p.call(F)==="[object ArrayBuffer]"?new Uint8Array(F):F,w=i.inflateSetDictionary(this.strm,P)),w===l.Z_BUF_ERROR&&D===!0&&(w=l.Z_OK,D=!1),w!==l.Z_STREAM_END&&w!==l.Z_OK)return this.onEnd(w),!(this.ended=!0);M.next_out&&(M.avail_out!==0&&w!==l.Z_STREAM_END&&(M.avail_in!==0||I!==l.Z_FINISH&&I!==l.Z_SYNC_FLUSH)||(this.options.to==="string"?(k=a.utf8border(M.output,M.next_out),C=M.next_out-k,R=a.buf2string(M.output,k),M.next_out=C,M.avail_out=$-C,C&&s.arraySet(M.output,M.output,k,C,0),this.onData(R)):this.onData(s.shrinkBuf(M.output,M.next_out)))),M.avail_in===0&&M.avail_out===0&&(D=!0)}while((0<M.avail_in||M.avail_out===0)&&w!==l.Z_STREAM_END);return w===l.Z_STREAM_END&&(I=l.Z_FINISH),I===l.Z_FINISH?(w=i.inflateEnd(this.strm),this.onEnd(w),this.ended=!0,w===l.Z_OK):I!==l.Z_SYNC_FLUSH||(this.onEnd(l.Z_OK),!(M.avail_out=0))},v.prototype.onData=function(y){this.chunks.push(y)},v.prototype.onEnd=function(y){y===l.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=s.flattenChunks(this.chunks)),this.chunks=[],this.err=y,this.msg=this.strm.msg},o.Inflate=v,o.inflate=g,o.inflateRaw=function(y,_){return(_=_||{}).raw=!0,g(y,_)},o.ungzip=g},{"./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 h in d)d.hasOwnProperty(h)&&(l[h]=d[h])}}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,h,p){if(u.subarray&&l.subarray)l.set(u.subarray(d,d+h),p);else for(var v=0;v<h;v++)l[p+v]=u[d+v]},flattenChunks:function(l){var u,d,h,p,v,g;for(u=h=0,d=l.length;u<d;u++)h+=l[u].length;for(g=new Uint8Array(h),u=p=0,d=l.length;u<d;u++)v=l[u],g.set(v,p),p+=v.length;return g}},a={arraySet:function(l,u,d,h,p){for(var v=0;v<h;v++)l[p+v]=u[d+v]},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(h,p){if(p<65537&&(h.subarray&&a||!h.subarray&&s))return String.fromCharCode.apply(null,i.shrinkBuf(h,p));for(var v="",g=0;g<p;g++)v+=String.fromCharCode(h[g]);return v}l[254]=l[254]=1,o.string2buf=function(h){var p,v,g,y,_,w=h.length,I=0;for(y=0;y<w;y++)(64512&(v=h.charCodeAt(y)))==55296&&y+1<w&&(64512&(g=h.charCodeAt(y+1)))==56320&&(v=65536+(v-55296<<10)+(g-56320),y++),I+=v<128?1:v<2048?2:v<65536?3:4;for(p=new i.Buf8(I),y=_=0;_<I;y++)(64512&(v=h.charCodeAt(y)))==55296&&y+1<w&&(64512&(g=h.charCodeAt(y+1)))==56320&&(v=65536+(v-55296<<10)+(g-56320),y++),v<128?p[_++]=v:(v<2048?p[_++]=192|v>>>6:(v<65536?p[_++]=224|v>>>12:(p[_++]=240|v>>>18,p[_++]=128|v>>>12&63),p[_++]=128|v>>>6&63),p[_++]=128|63&v);return p},o.buf2binstring=function(h){return d(h,h.length)},o.binstring2buf=function(h){for(var p=new i.Buf8(h.length),v=0,g=p.length;v<g;v++)p[v]=h.charCodeAt(v);return p},o.buf2string=function(h,p){var v,g,y,_,w=p||h.length,I=new Array(2*w);for(v=g=0;v<w;)if((y=h[v++])<128)I[g++]=y;else if(4<(_=l[y]))I[g++]=65533,v+=_-1;else{for(y&=_===2?31:_===3?15:7;1<_&&v<w;)y=y<<6|63&h[v++],_--;1<_?I[g++]=65533:y<65536?I[g++]=y:(y-=65536,I[g++]=55296|y>>10&1023,I[g++]=56320|1023&y)}return d(I,g)},o.utf8border=function(h,p){var v;for((p=p||h.length)>h.length&&(p=h.length),v=p-1;0<=v&&(192&h[v])==128;)v--;return v<0||v===0?p:v+l[h[v]]>p?v: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,h=0;a!==0;){for(a-=h=2e3<a?2e3:a;d=d+(u=u+s[l++]|0)|0,--h;);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,h=u+l;s^=-1;for(var p=u;p<h;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"),h=0,p=4,v=0,g=-2,y=-1,_=4,w=2,I=8,k=9,C=286,R=30,P=19,M=2*C+1,$=15,F=3,D=258,V=D+F+1,x=42,B=113,T=1,te=2,U=3,W=4;function Y(A,ee){return A.msg=d[ee],ee}function J(A){return(A<<1)-(4<A?9:0)}function Oe(A){for(var ee=A.length;0<=--ee;)A[ee]=0}function de(A){var ee=A.state,ue=ee.pending;ue>A.avail_out&&(ue=A.avail_out),ue!==0&&(s.arraySet(A.output,ee.pending_buf,ee.pending_out,ue,A.next_out),A.next_out+=ue,ee.pending_out+=ue,A.total_out+=ue,A.avail_out-=ue,ee.pending-=ue,ee.pending===0&&(ee.pending_out=0))}function oe(A,ee){a._tr_flush_block(A,0<=A.block_start?A.block_start:-1,A.strstart-A.block_start,ee),A.block_start=A.strstart,de(A.strm)}function pe(A,ee){A.pending_buf[A.pending++]=ee}function Ee(A,ee){A.pending_buf[A.pending++]=ee>>>8&255,A.pending_buf[A.pending++]=255&ee}function Ve(A,ee){var ue,Z,G=A.max_chain_length,K=A.strstart,re=A.prev_length,ge=A.nice_match,X=A.strstart>A.w_size-V?A.strstart-(A.w_size-V):0,ce=A.window,Ae=A.w_mask,ke=A.prev,De=A.strstart+D,ft=ce[K+re-1],xe=ce[K+re];A.prev_length>=A.good_match&&(G>>=2),ge>A.lookahead&&(ge=A.lookahead);do if(ce[(ue=ee)+re]===xe&&ce[ue+re-1]===ft&&ce[ue]===ce[K]&&ce[++ue]===ce[K+1]){K+=2,ue++;do;while(ce[++K]===ce[++ue]&&ce[++K]===ce[++ue]&&ce[++K]===ce[++ue]&&ce[++K]===ce[++ue]&&ce[++K]===ce[++ue]&&ce[++K]===ce[++ue]&&ce[++K]===ce[++ue]&&ce[++K]===ce[++ue]&&K<De);if(Z=D-(De-K),K=De-D,re<Z){if(A.match_start=ee,ge<=(re=Z))break;ft=ce[K+re-1],xe=ce[K+re]}}while((ee=ke[ee&Ae])>X&&--G!=0);return re<=A.lookahead?re:A.lookahead}function rt(A){var ee,ue,Z,G,K,re,ge,X,ce,Ae,ke=A.w_size;do{if(G=A.window_size-A.lookahead-A.strstart,A.strstart>=ke+(ke-V)){for(s.arraySet(A.window,A.window,ke,ke,0),A.match_start-=ke,A.strstart-=ke,A.block_start-=ke,ee=ue=A.hash_size;Z=A.head[--ee],A.head[ee]=ke<=Z?Z-ke:0,--ue;);for(ee=ue=ke;Z=A.prev[--ee],A.prev[ee]=ke<=Z?Z-ke:0,--ue;);G+=ke}if(A.strm.avail_in===0)break;if(re=A.strm,ge=A.window,X=A.strstart+A.lookahead,ce=G,Ae=void 0,Ae=re.avail_in,ce<Ae&&(Ae=ce),ue=Ae===0?0:(re.avail_in-=Ae,s.arraySet(ge,re.input,re.next_in,Ae,X),re.state.wrap===1?re.adler=l(re.adler,ge,Ae,X):re.state.wrap===2&&(re.adler=u(re.adler,ge,Ae,X)),re.next_in+=Ae,re.total_in+=Ae,Ae),A.lookahead+=ue,A.lookahead+A.insert>=F)for(K=A.strstart-A.insert,A.ins_h=A.window[K],A.ins_h=(A.ins_h<<A.hash_shift^A.window[K+1])&A.hash_mask;A.insert&&(A.ins_h=(A.ins_h<<A.hash_shift^A.window[K+F-1])&A.hash_mask,A.prev[K&A.w_mask]=A.head[A.ins_h],A.head[A.ins_h]=K,K++,A.insert--,!(A.lookahead+A.insert<F)););}while(A.lookahead<V&&A.strm.avail_in!==0)}function ut(A,ee){for(var ue,Z;;){if(A.lookahead<V){if(rt(A),A.lookahead<V&&ee===h)return T;if(A.lookahead===0)break}if(ue=0,A.lookahead>=F&&(A.ins_h=(A.ins_h<<A.hash_shift^A.window[A.strstart+F-1])&A.hash_mask,ue=A.prev[A.strstart&A.w_mask]=A.head[A.ins_h],A.head[A.ins_h]=A.strstart),ue!==0&&A.strstart-ue<=A.w_size-V&&(A.match_length=Ve(A,ue)),A.match_length>=F)if(Z=a._tr_tally(A,A.strstart-A.match_start,A.match_length-F),A.lookahead-=A.match_length,A.match_length<=A.max_lazy_match&&A.lookahead>=F){for(A.match_length--;A.strstart++,A.ins_h=(A.ins_h<<A.hash_shift^A.window[A.strstart+F-1])&A.hash_mask,ue=A.prev[A.strstart&A.w_mask]=A.head[A.ins_h],A.head[A.ins_h]=A.strstart,--A.match_length!=0;);A.strstart++}else A.strstart+=A.match_length,A.match_length=0,A.ins_h=A.window[A.strstart],A.ins_h=(A.ins_h<<A.hash_shift^A.window[A.strstart+1])&A.hash_mask;else Z=a._tr_tally(A,0,A.window[A.strstart]),A.lookahead--,A.strstart++;if(Z&&(oe(A,!1),A.strm.avail_out===0))return T}return A.insert=A.strstart<F-1?A.strstart:F-1,ee===p?(oe(A,!0),A.strm.avail_out===0?U:W):A.last_lit&&(oe(A,!1),A.strm.avail_out===0)?T:te}function ht(A,ee){for(var ue,Z,G;;){if(A.lookahead<V){if(rt(A),A.lookahead<V&&ee===h)return T;if(A.lookahead===0)break}if(ue=0,A.lookahead>=F&&(A.ins_h=(A.ins_h<<A.hash_shift^A.window[A.strstart+F-1])&A.hash_mask,ue=A.prev[A.strstart&A.w_mask]=A.head[A.ins_h],A.head[A.ins_h]=A.strstart),A.prev_length=A.match_length,A.prev_match=A.match_start,A.match_length=F-1,ue!==0&&A.prev_length<A.max_lazy_match&&A.strstart-ue<=A.w_size-V&&(A.match_length=Ve(A,ue),A.match_length<=5&&(A.strategy===1||A.match_length===F&&4096<A.strstart-A.match_start)&&(A.match_length=F-1)),A.prev_length>=F&&A.match_length<=A.prev_length){for(G=A.strstart+A.lookahead-F,Z=a._tr_tally(A,A.strstart-1-A.prev_match,A.prev_length-F),A.lookahead-=A.prev_length-1,A.prev_length-=2;++A.strstart<=G&&(A.ins_h=(A.ins_h<<A.hash_shift^A.window[A.strstart+F-1])&A.hash_mask,ue=A.prev[A.strstart&A.w_mask]=A.head[A.ins_h],A.head[A.ins_h]=A.strstart),--A.prev_length!=0;);if(A.match_available=0,A.match_length=F-1,A.strstart++,Z&&(oe(A,!1),A.strm.avail_out===0))return T}else if(A.match_available){if((Z=a._tr_tally(A,0,A.window[A.strstart-1]))&&oe(A,!1),A.strstart++,A.lookahead--,A.strm.avail_out===0)return T}else A.match_available=1,A.strstart++,A.lookahead--}return A.match_available&&(Z=a._tr_tally(A,0,A.window[A.strstart-1]),A.match_available=0),A.insert=A.strstart<F-1?A.strstart:F-1,ee===p?(oe(A,!0),A.strm.avail_out===0?U:W):A.last_lit&&(oe(A,!1),A.strm.avail_out===0)?T:te}function Rt(A,ee,ue,Z,G){this.good_length=A,this.max_lazy=ee,this.nice_length=ue,this.max_chain=Z,this.func=G}function Pe(){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=I,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*M),this.dyn_dtree=new s.Buf16(2*(2*R+1)),this.bl_tree=new s.Buf16(2*(2*P+1)),Oe(this.dyn_ltree),Oe(this.dyn_dtree),Oe(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new s.Buf16($+1),this.heap=new s.Buf16(2*C+1),Oe(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new s.Buf16(2*C+1),Oe(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 Re(A){var ee;return A&&A.state?(A.total_in=A.total_out=0,A.data_type=w,(ee=A.state).pending=0,ee.pending_out=0,ee.wrap<0&&(ee.wrap=-ee.wrap),ee.status=ee.wrap?x:B,A.adler=ee.wrap===2?0:1,ee.last_flush=h,a._tr_init(ee),v):Y(A,g)}function le(A){var ee=Re(A);return ee===v&&(function(ue){ue.window_size=2*ue.w_size,Oe(ue.head),ue.max_lazy_match=i[ue.level].max_lazy,ue.good_match=i[ue.level].good_length,ue.nice_match=i[ue.level].nice_length,ue.max_chain_length=i[ue.level].max_chain,ue.strstart=0,ue.block_start=0,ue.lookahead=0,ue.insert=0,ue.match_length=ue.prev_length=F-1,ue.match_available=0,ue.ins_h=0})(A.state),ee}function L(A,ee,ue,Z,G,K){if(!A)return g;var re=1;if(ee===y&&(ee=6),Z<0?(re=0,Z=-Z):15<Z&&(re=2,Z-=16),G<1||k<G||ue!==I||Z<8||15<Z||ee<0||9<ee||K<0||_<K)return Y(A,g);Z===8&&(Z=9);var ge=new Pe;return(A.state=ge).strm=A,ge.wrap=re,ge.gzhead=null,ge.w_bits=Z,ge.w_size=1<<ge.w_bits,ge.w_mask=ge.w_size-1,ge.hash_bits=G+7,ge.hash_size=1<<ge.hash_bits,ge.hash_mask=ge.hash_size-1,ge.hash_shift=~~((ge.hash_bits+F-1)/F),ge.window=new s.Buf8(2*ge.w_size),ge.head=new s.Buf16(ge.hash_size),ge.prev=new s.Buf16(ge.w_size),ge.lit_bufsize=1<<G+6,ge.pending_buf_size=4*ge.lit_bufsize,ge.pending_buf=new s.Buf8(ge.pending_buf_size),ge.d_buf=1*ge.lit_bufsize,ge.l_buf=3*ge.lit_bufsize,ge.level=ee,ge.strategy=K,ge.method=ue,le(A)}i=[new Rt(0,0,0,0,function(A,ee){var ue=65535;for(ue>A.pending_buf_size-5&&(ue=A.pending_buf_size-5);;){if(A.lookahead<=1){if(rt(A),A.lookahead===0&&ee===h)return T;if(A.lookahead===0)break}A.strstart+=A.lookahead,A.lookahead=0;var Z=A.block_start+ue;if((A.strstart===0||A.strstart>=Z)&&(A.lookahead=A.strstart-Z,A.strstart=Z,oe(A,!1),A.strm.avail_out===0)||A.strstart-A.block_start>=A.w_size-V&&(oe(A,!1),A.strm.avail_out===0))return T}return A.insert=0,ee===p?(oe(A,!0),A.strm.avail_out===0?U:W):(A.strstart>A.block_start&&(oe(A,!1),A.strm.avail_out),T)}),new Rt(4,4,8,4,ut),new Rt(4,5,16,8,ut),new Rt(4,6,32,32,ut),new Rt(4,4,16,16,ht),new Rt(8,16,32,32,ht),new Rt(8,16,128,128,ht),new Rt(8,32,128,256,ht),new Rt(32,128,258,1024,ht),new Rt(32,258,258,4096,ht)],o.deflateInit=function(A,ee){return L(A,ee,I,15,8,0)},o.deflateInit2=L,o.deflateReset=le,o.deflateResetKeep=Re,o.deflateSetHeader=function(A,ee){return A&&A.state?A.state.wrap!==2?g:(A.state.gzhead=ee,v):g},o.deflate=function(A,ee){var ue,Z,G,K;if(!A||!A.state||5<ee||ee<0)return A?Y(A,g):g;if(Z=A.state,!A.output||!A.input&&A.avail_in!==0||Z.status===666&&ee!==p)return Y(A,A.avail_out===0?-5:g);if(Z.strm=A,ue=Z.last_flush,Z.last_flush=ee,Z.status===x)if(Z.wrap===2)A.adler=0,pe(Z,31),pe(Z,139),pe(Z,8),Z.gzhead?(pe(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)),pe(Z,255&Z.gzhead.time),pe(Z,Z.gzhead.time>>8&255),pe(Z,Z.gzhead.time>>16&255),pe(Z,Z.gzhead.time>>24&255),pe(Z,Z.level===9?2:2<=Z.strategy||Z.level<2?4:0),pe(Z,255&Z.gzhead.os),Z.gzhead.extra&&Z.gzhead.extra.length&&(pe(Z,255&Z.gzhead.extra.length),pe(Z,Z.gzhead.extra.length>>8&255)),Z.gzhead.hcrc&&(A.adler=u(A.adler,Z.pending_buf,Z.pending,0)),Z.gzindex=0,Z.status=69):(pe(Z,0),pe(Z,0),pe(Z,0),pe(Z,0),pe(Z,0),pe(Z,Z.level===9?2:2<=Z.strategy||Z.level<2?4:0),pe(Z,3),Z.status=B);else{var re=I+(Z.w_bits-8<<4)<<8;re|=(2<=Z.strategy||Z.level<2?0:Z.level<6?1:Z.level===6?2:3)<<6,Z.strstart!==0&&(re|=32),re+=31-re%31,Z.status=B,Ee(Z,re),Z.strstart!==0&&(Ee(Z,A.adler>>>16),Ee(Z,65535&A.adler)),A.adler=1}if(Z.status===69)if(Z.gzhead.extra){for(G=Z.pending;Z.gzindex<(65535&Z.gzhead.extra.length)&&(Z.pending!==Z.pending_buf_size||(Z.gzhead.hcrc&&Z.pending>G&&(A.adler=u(A.adler,Z.pending_buf,Z.pending-G,G)),de(A),G=Z.pending,Z.pending!==Z.pending_buf_size));)pe(Z,255&Z.gzhead.extra[Z.gzindex]),Z.gzindex++;Z.gzhead.hcrc&&Z.pending>G&&(A.adler=u(A.adler,Z.pending_buf,Z.pending-G,G)),Z.gzindex===Z.gzhead.extra.length&&(Z.gzindex=0,Z.status=73)}else Z.status=73;if(Z.status===73)if(Z.gzhead.name){G=Z.pending;do{if(Z.pending===Z.pending_buf_size&&(Z.gzhead.hcrc&&Z.pending>G&&(A.adler=u(A.adler,Z.pending_buf,Z.pending-G,G)),de(A),G=Z.pending,Z.pending===Z.pending_buf_size)){K=1;break}K=Z.gzindex<Z.gzhead.name.length?255&Z.gzhead.name.charCodeAt(Z.gzindex++):0,pe(Z,K)}while(K!==0);Z.gzhead.hcrc&&Z.pending>G&&(A.adler=u(A.adler,Z.pending_buf,Z.pending-G,G)),K===0&&(Z.gzindex=0,Z.status=91)}else Z.status=91;if(Z.status===91)if(Z.gzhead.comment){G=Z.pending;do{if(Z.pending===Z.pending_buf_size&&(Z.gzhead.hcrc&&Z.pending>G&&(A.adler=u(A.adler,Z.pending_buf,Z.pending-G,G)),de(A),G=Z.pending,Z.pending===Z.pending_buf_size)){K=1;break}K=Z.gzindex<Z.gzhead.comment.length?255&Z.gzhead.comment.charCodeAt(Z.gzindex++):0,pe(Z,K)}while(K!==0);Z.gzhead.hcrc&&Z.pending>G&&(A.adler=u(A.adler,Z.pending_buf,Z.pending-G,G)),K===0&&(Z.status=103)}else Z.status=103;if(Z.status===103&&(Z.gzhead.hcrc?(Z.pending+2>Z.pending_buf_size&&de(A),Z.pending+2<=Z.pending_buf_size&&(pe(Z,255&A.adler),pe(Z,A.adler>>8&255),A.adler=0,Z.status=B)):Z.status=B),Z.pending!==0){if(de(A),A.avail_out===0)return Z.last_flush=-1,v}else if(A.avail_in===0&&J(ee)<=J(ue)&&ee!==p)return Y(A,-5);if(Z.status===666&&A.avail_in!==0)return Y(A,-5);if(A.avail_in!==0||Z.lookahead!==0||ee!==h&&Z.status!==666){var ge=Z.strategy===2?(function(X,ce){for(var Ae;;){if(X.lookahead===0&&(rt(X),X.lookahead===0)){if(ce===h)return T;break}if(X.match_length=0,Ae=a._tr_tally(X,0,X.window[X.strstart]),X.lookahead--,X.strstart++,Ae&&(oe(X,!1),X.strm.avail_out===0))return T}return X.insert=0,ce===p?(oe(X,!0),X.strm.avail_out===0?U:W):X.last_lit&&(oe(X,!1),X.strm.avail_out===0)?T:te})(Z,ee):Z.strategy===3?(function(X,ce){for(var Ae,ke,De,ft,xe=X.window;;){if(X.lookahead<=D){if(rt(X),X.lookahead<=D&&ce===h)return T;if(X.lookahead===0)break}if(X.match_length=0,X.lookahead>=F&&0<X.strstart&&(ke=xe[De=X.strstart-1])===xe[++De]&&ke===xe[++De]&&ke===xe[++De]){ft=X.strstart+D;do;while(ke===xe[++De]&&ke===xe[++De]&&ke===xe[++De]&&ke===xe[++De]&&ke===xe[++De]&&ke===xe[++De]&&ke===xe[++De]&&ke===xe[++De]&&De<ft);X.match_length=D-(ft-De),X.match_length>X.lookahead&&(X.match_length=X.lookahead)}if(X.match_length>=F?(Ae=a._tr_tally(X,1,X.match_length-F),X.lookahead-=X.match_length,X.strstart+=X.match_length,X.match_length=0):(Ae=a._tr_tally(X,0,X.window[X.strstart]),X.lookahead--,X.strstart++),Ae&&(oe(X,!1),X.strm.avail_out===0))return T}return X.insert=0,ce===p?(oe(X,!0),X.strm.avail_out===0?U:W):X.last_lit&&(oe(X,!1),X.strm.avail_out===0)?T:te})(Z,ee):i[Z.level].func(Z,ee);if(ge!==U&&ge!==W||(Z.status=666),ge===T||ge===U)return A.avail_out===0&&(Z.last_flush=-1),v;if(ge===te&&(ee===1?a._tr_align(Z):ee!==5&&(a._tr_stored_block(Z,0,0,!1),ee===3&&(Oe(Z.head),Z.lookahead===0&&(Z.strstart=0,Z.block_start=0,Z.insert=0))),de(A),A.avail_out===0))return Z.last_flush=-1,v}return ee!==p?v:Z.wrap<=0?1:(Z.wrap===2?(pe(Z,255&A.adler),pe(Z,A.adler>>8&255),pe(Z,A.adler>>16&255),pe(Z,A.adler>>24&255),pe(Z,255&A.total_in),pe(Z,A.total_in>>8&255),pe(Z,A.total_in>>16&255),pe(Z,A.total_in>>24&255)):(Ee(Z,A.adler>>>16),Ee(Z,65535&A.adler)),de(A),0<Z.wrap&&(Z.wrap=-Z.wrap),Z.pending!==0?v:1)},o.deflateEnd=function(A){var ee;return A&&A.state?(ee=A.state.status)!==x&&ee!==69&&ee!==73&&ee!==91&&ee!==103&&ee!==B&&ee!==666?Y(A,g):(A.state=null,ee===B?Y(A,-3):v):g},o.deflateSetDictionary=function(A,ee){var ue,Z,G,K,re,ge,X,ce,Ae=ee.length;if(!A||!A.state||(K=(ue=A.state).wrap)===2||K===1&&ue.status!==x||ue.lookahead)return g;for(K===1&&(A.adler=l(A.adler,ee,Ae,0)),ue.wrap=0,Ae>=ue.w_size&&(K===0&&(Oe(ue.head),ue.strstart=0,ue.block_start=0,ue.insert=0),ce=new s.Buf8(ue.w_size),s.arraySet(ce,ee,Ae-ue.w_size,ue.w_size,0),ee=ce,Ae=ue.w_size),re=A.avail_in,ge=A.next_in,X=A.input,A.avail_in=Ae,A.next_in=0,A.input=ee,rt(ue);ue.lookahead>=F;){for(Z=ue.strstart,G=ue.lookahead-(F-1);ue.ins_h=(ue.ins_h<<ue.hash_shift^ue.window[Z+F-1])&ue.hash_mask,ue.prev[Z&ue.w_mask]=ue.head[ue.ins_h],ue.head[ue.ins_h]=Z,Z++,--G;);ue.strstart=Z,ue.lookahead=F-1,rt(ue)}return ue.strstart+=ue.lookahead,ue.block_start=ue.strstart,ue.insert=ue.lookahead,ue.lookahead=0,ue.match_length=ue.prev_length=F-1,ue.match_available=0,A.next_in=ge,A.input=X,A.avail_in=re,ue.wrap=K,v},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,h,p,v,g,y,_,w,I,k,C,R,P,M,$,F,D,V,x,B,T=i.input,te;u=l+(i.avail_in-5),d=i.next_out,te=i.output,h=d-(s-i.avail_out),p=d+(i.avail_out-257),v=a.dmax,g=a.wsize,y=a.whave,_=a.wnext,w=a.window,I=a.hold,k=a.bits,C=a.lencode,R=a.distcode,P=(1<<a.lenbits)-1,M=(1<<a.distbits)-1;e:do{k<15&&(I+=T[l++]<<k,k+=8,I+=T[l++]<<k,k+=8),$=C[I&P];t:for(;;){if(I>>>=F=$>>>24,k-=F,(F=$>>>16&255)===0)te[d++]=65535&$;else{if(!(16&F)){if((64&F)==0){$=C[(65535&$)+(I&(1<<F)-1)];continue t}if(32&F){a.mode=12;break e}i.msg="invalid literal/length code",a.mode=30;break e}D=65535&$,(F&=15)&&(k<F&&(I+=T[l++]<<k,k+=8),D+=I&(1<<F)-1,I>>>=F,k-=F),k<15&&(I+=T[l++]<<k,k+=8,I+=T[l++]<<k,k+=8),$=R[I&M];n:for(;;){if(I>>>=F=$>>>24,k-=F,!(16&(F=$>>>16&255))){if((64&F)==0){$=R[(65535&$)+(I&(1<<F)-1)];continue n}i.msg="invalid distance code",a.mode=30;break e}if(V=65535&$,k<(F&=15)&&(I+=T[l++]<<k,(k+=8)<F&&(I+=T[l++]<<k,k+=8)),v<(V+=I&(1<<F)-1)){i.msg="invalid distance too far back",a.mode=30;break e}if(I>>>=F,k-=F,(F=d-h)<V){if(y<(F=V-F)&&a.sane){i.msg="invalid distance too far back",a.mode=30;break e}if(B=w,(x=0)===_){if(x+=g-F,F<D){for(D-=F;te[d++]=w[x++],--F;);x=d-V,B=te}}else if(_<F){if(x+=g+_-F,(F-=_)<D){for(D-=F;te[d++]=w[x++],--F;);if(x=0,_<D){for(D-=F=_;te[d++]=w[x++],--F;);x=d-V,B=te}}}else if(x+=_-F,F<D){for(D-=F;te[d++]=w[x++],--F;);x=d-V,B=te}for(;2<D;)te[d++]=B[x++],te[d++]=B[x++],te[d++]=B[x++],D-=3;D&&(te[d++]=B[x++],1<D&&(te[d++]=B[x++]))}else{for(x=d-V;te[d++]=te[x++],te[d++]=te[x++],te[d++]=te[x++],2<(D-=3););D&&(te[d++]=te[x++],1<D&&(te[d++]=te[x++]))}break}}break}}while(l<u&&d<p);l-=D=k>>3,I&=(1<<(k-=D<<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=I,a.bits=k}},{}],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,h=2,p=0,v=-2,g=1,y=852,_=592;function w(x){return(x>>>24&255)+(x>>>8&65280)+((65280&x)<<8)+((255&x)<<24)}function I(){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 k(x){var B;return x&&x.state?(B=x.state,x.total_in=x.total_out=B.total=0,x.msg="",B.wrap&&(x.adler=1&B.wrap),B.mode=g,B.last=0,B.havedict=0,B.dmax=32768,B.head=null,B.hold=0,B.bits=0,B.lencode=B.lendyn=new i.Buf32(y),B.distcode=B.distdyn=new i.Buf32(_),B.sane=1,B.back=-1,p):v}function C(x){var B;return x&&x.state?((B=x.state).wsize=0,B.whave=0,B.wnext=0,k(x)):v}function R(x,B){var T,te;return x&&x.state?(te=x.state,B<0?(T=0,B=-B):(T=1+(B>>4),B<48&&(B&=15)),B&&(B<8||15<B)?v:(te.window!==null&&te.wbits!==B&&(te.window=null),te.wrap=T,te.wbits=B,C(x))):v}function P(x,B){var T,te;return x?(te=new I,(x.state=te).window=null,(T=R(x,B))!==p&&(x.state=null),T):v}var M,$,F=!0;function D(x){if(F){var B;for(M=new i.Buf32(512),$=new i.Buf32(32),B=0;B<144;)x.lens[B++]=8;for(;B<256;)x.lens[B++]=9;for(;B<280;)x.lens[B++]=7;for(;B<288;)x.lens[B++]=8;for(u(d,x.lens,0,288,M,0,x.work,{bits:9}),B=0;B<32;)x.lens[B++]=5;u(h,x.lens,0,32,$,0,x.work,{bits:5}),F=!1}x.lencode=M,x.lenbits=9,x.distcode=$,x.distbits=5}function V(x,B,T,te){var U,W=x.state;return W.window===null&&(W.wsize=1<<W.wbits,W.wnext=0,W.whave=0,W.window=new i.Buf8(W.wsize)),te>=W.wsize?(i.arraySet(W.window,B,T-W.wsize,W.wsize,0),W.wnext=0,W.whave=W.wsize):(te<(U=W.wsize-W.wnext)&&(U=te),i.arraySet(W.window,B,T-te,U,W.wnext),(te-=U)?(i.arraySet(W.window,B,T-te,te,0),W.wnext=te,W.whave=W.wsize):(W.wnext+=U,W.wnext===W.wsize&&(W.wnext=0),W.whave<W.wsize&&(W.whave+=U))),0}o.inflateReset=C,o.inflateReset2=R,o.inflateResetKeep=k,o.inflateInit=function(x){return P(x,15)},o.inflateInit2=P,o.inflate=function(x,B){var T,te,U,W,Y,J,Oe,de,oe,pe,Ee,Ve,rt,ut,ht,Rt,Pe,Re,le,L,A,ee,ue,Z,G=0,K=new i.Buf8(4),re=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!x||!x.state||!x.output||!x.input&&x.avail_in!==0)return v;(T=x.state).mode===12&&(T.mode=13),Y=x.next_out,U=x.output,Oe=x.avail_out,W=x.next_in,te=x.input,J=x.avail_in,de=T.hold,oe=T.bits,pe=J,Ee=Oe,ee=p;e:for(;;)switch(T.mode){case g:if(T.wrap===0){T.mode=13;break}for(;oe<16;){if(J===0)break e;J--,de+=te[W++]<<oe,oe+=8}if(2&T.wrap&&de===35615){K[T.check=0]=255&de,K[1]=de>>>8&255,T.check=a(T.check,K,2,0),oe=de=0,T.mode=2;break}if(T.flags=0,T.head&&(T.head.done=!1),!(1&T.wrap)||(((255&de)<<8)+(de>>8))%31){x.msg="incorrect header check",T.mode=30;break}if((15&de)!=8){x.msg="unknown compression method",T.mode=30;break}if(oe-=4,A=8+(15&(de>>>=4)),T.wbits===0)T.wbits=A;else if(A>T.wbits){x.msg="invalid window size",T.mode=30;break}T.dmax=1<<A,x.adler=T.check=1,T.mode=512&de?10:12,oe=de=0;break;case 2:for(;oe<16;){if(J===0)break e;J--,de+=te[W++]<<oe,oe+=8}if(T.flags=de,(255&T.flags)!=8){x.msg="unknown compression method",T.mode=30;break}if(57344&T.flags){x.msg="unknown header flags set",T.mode=30;break}T.head&&(T.head.text=de>>8&1),512&T.flags&&(K[0]=255&de,K[1]=de>>>8&255,T.check=a(T.check,K,2,0)),oe=de=0,T.mode=3;case 3:for(;oe<32;){if(J===0)break e;J--,de+=te[W++]<<oe,oe+=8}T.head&&(T.head.time=de),512&T.flags&&(K[0]=255&de,K[1]=de>>>8&255,K[2]=de>>>16&255,K[3]=de>>>24&255,T.check=a(T.check,K,4,0)),oe=de=0,T.mode=4;case 4:for(;oe<16;){if(J===0)break e;J--,de+=te[W++]<<oe,oe+=8}T.head&&(T.head.xflags=255&de,T.head.os=de>>8),512&T.flags&&(K[0]=255&de,K[1]=de>>>8&255,T.check=a(T.check,K,2,0)),oe=de=0,T.mode=5;case 5:if(1024&T.flags){for(;oe<16;){if(J===0)break e;J--,de+=te[W++]<<oe,oe+=8}T.length=de,T.head&&(T.head.extra_len=de),512&T.flags&&(K[0]=255&de,K[1]=de>>>8&255,T.check=a(T.check,K,2,0)),oe=de=0}else T.head&&(T.head.extra=null);T.mode=6;case 6:if(1024&T.flags&&(J<(Ve=T.length)&&(Ve=J),Ve&&(T.head&&(A=T.head.extra_len-T.length,T.head.extra||(T.head.extra=new Array(T.head.extra_len)),i.arraySet(T.head.extra,te,W,Ve,A)),512&T.flags&&(T.check=a(T.check,te,Ve,W)),J-=Ve,W+=Ve,T.length-=Ve),T.length))break e;T.length=0,T.mode=7;case 7:if(2048&T.flags){if(J===0)break e;for(Ve=0;A=te[W+Ve++],T.head&&A&&T.length<65536&&(T.head.name+=String.fromCharCode(A)),A&&Ve<J;);if(512&T.flags&&(T.check=a(T.check,te,Ve,W)),J-=Ve,W+=Ve,A)break e}else T.head&&(T.head.name=null);T.length=0,T.mode=8;case 8:if(4096&T.flags){if(J===0)break e;for(Ve=0;A=te[W+Ve++],T.head&&A&&T.length<65536&&(T.head.comment+=String.fromCharCode(A)),A&&Ve<J;);if(512&T.flags&&(T.check=a(T.check,te,Ve,W)),J-=Ve,W+=Ve,A)break e}else T.head&&(T.head.comment=null);T.mode=9;case 9:if(512&T.flags){for(;oe<16;){if(J===0)break e;J--,de+=te[W++]<<oe,oe+=8}if(de!==(65535&T.check)){x.msg="header crc mismatch",T.mode=30;break}oe=de=0}T.head&&(T.head.hcrc=T.flags>>9&1,T.head.done=!0),x.adler=T.check=0,T.mode=12;break;case 10:for(;oe<32;){if(J===0)break e;J--,de+=te[W++]<<oe,oe+=8}x.adler=T.check=w(de),oe=de=0,T.mode=11;case 11:if(T.havedict===0)return x.next_out=Y,x.avail_out=Oe,x.next_in=W,x.avail_in=J,T.hold=de,T.bits=oe,2;x.adler=T.check=1,T.mode=12;case 12:if(B===5||B===6)break e;case 13:if(T.last){de>>>=7&oe,oe-=7&oe,T.mode=27;break}for(;oe<3;){if(J===0)break e;J--,de+=te[W++]<<oe,oe+=8}switch(T.last=1&de,oe-=1,3&(de>>>=1)){case 0:T.mode=14;break;case 1:if(D(T),T.mode=20,B!==6)break;de>>>=2,oe-=2;break e;case 2:T.mode=17;break;case 3:x.msg="invalid block type",T.mode=30}de>>>=2,oe-=2;break;case 14:for(de>>>=7&oe,oe-=7&oe;oe<32;){if(J===0)break e;J--,de+=te[W++]<<oe,oe+=8}if((65535&de)!=(de>>>16^65535)){x.msg="invalid stored block lengths",T.mode=30;break}if(T.length=65535&de,oe=de=0,T.mode=15,B===6)break e;case 15:T.mode=16;case 16:if(Ve=T.length){if(J<Ve&&(Ve=J),Oe<Ve&&(Ve=Oe),Ve===0)break e;i.arraySet(U,te,W,Ve,Y),J-=Ve,W+=Ve,Oe-=Ve,Y+=Ve,T.length-=Ve;break}T.mode=12;break;case 17:for(;oe<14;){if(J===0)break e;J--,de+=te[W++]<<oe,oe+=8}if(T.nlen=257+(31&de),de>>>=5,oe-=5,T.ndist=1+(31&de),de>>>=5,oe-=5,T.ncode=4+(15&de),de>>>=4,oe-=4,286<T.nlen||30<T.ndist){x.msg="too many length or distance symbols",T.mode=30;break}T.have=0,T.mode=18;case 18:for(;T.have<T.ncode;){for(;oe<3;){if(J===0)break e;J--,de+=te[W++]<<oe,oe+=8}T.lens[re[T.have++]]=7&de,de>>>=3,oe-=3}for(;T.have<19;)T.lens[re[T.have++]]=0;if(T.lencode=T.lendyn,T.lenbits=7,ue={bits:T.lenbits},ee=u(0,T.lens,0,19,T.lencode,0,T.work,ue),T.lenbits=ue.bits,ee){x.msg="invalid code lengths set",T.mode=30;break}T.have=0,T.mode=19;case 19:for(;T.have<T.nlen+T.ndist;){for(;Rt=(G=T.lencode[de&(1<<T.lenbits)-1])>>>16&255,Pe=65535&G,!((ht=G>>>24)<=oe);){if(J===0)break e;J--,de+=te[W++]<<oe,oe+=8}if(Pe<16)de>>>=ht,oe-=ht,T.lens[T.have++]=Pe;else{if(Pe===16){for(Z=ht+2;oe<Z;){if(J===0)break e;J--,de+=te[W++]<<oe,oe+=8}if(de>>>=ht,oe-=ht,T.have===0){x.msg="invalid bit length repeat",T.mode=30;break}A=T.lens[T.have-1],Ve=3+(3&de),de>>>=2,oe-=2}else if(Pe===17){for(Z=ht+3;oe<Z;){if(J===0)break e;J--,de+=te[W++]<<oe,oe+=8}oe-=ht,A=0,Ve=3+(7&(de>>>=ht)),de>>>=3,oe-=3}else{for(Z=ht+7;oe<Z;){if(J===0)break e;J--,de+=te[W++]<<oe,oe+=8}oe-=ht,A=0,Ve=11+(127&(de>>>=ht)),de>>>=7,oe-=7}if(T.have+Ve>T.nlen+T.ndist){x.msg="invalid bit length repeat",T.mode=30;break}for(;Ve--;)T.lens[T.have++]=A}}if(T.mode===30)break;if(T.lens[256]===0){x.msg="invalid code -- missing end-of-block",T.mode=30;break}if(T.lenbits=9,ue={bits:T.lenbits},ee=u(d,T.lens,0,T.nlen,T.lencode,0,T.work,ue),T.lenbits=ue.bits,ee){x.msg="invalid literal/lengths set",T.mode=30;break}if(T.distbits=6,T.distcode=T.distdyn,ue={bits:T.distbits},ee=u(h,T.lens,T.nlen,T.ndist,T.distcode,0,T.work,ue),T.distbits=ue.bits,ee){x.msg="invalid distances set",T.mode=30;break}if(T.mode=20,B===6)break e;case 20:T.mode=21;case 21:if(6<=J&&258<=Oe){x.next_out=Y,x.avail_out=Oe,x.next_in=W,x.avail_in=J,T.hold=de,T.bits=oe,l(x,Ee),Y=x.next_out,U=x.output,Oe=x.avail_out,W=x.next_in,te=x.input,J=x.avail_in,de=T.hold,oe=T.bits,T.mode===12&&(T.back=-1);break}for(T.back=0;Rt=(G=T.lencode[de&(1<<T.lenbits)-1])>>>16&255,Pe=65535&G,!((ht=G>>>24)<=oe);){if(J===0)break e;J--,de+=te[W++]<<oe,oe+=8}if(Rt&&(240&Rt)==0){for(Re=ht,le=Rt,L=Pe;Rt=(G=T.lencode[L+((de&(1<<Re+le)-1)>>Re)])>>>16&255,Pe=65535&G,!(Re+(ht=G>>>24)<=oe);){if(J===0)break e;J--,de+=te[W++]<<oe,oe+=8}de>>>=Re,oe-=Re,T.back+=Re}if(de>>>=ht,oe-=ht,T.back+=ht,T.length=Pe,Rt===0){T.mode=26;break}if(32&Rt){T.back=-1,T.mode=12;break}if(64&Rt){x.msg="invalid literal/length code",T.mode=30;break}T.extra=15&Rt,T.mode=22;case 22:if(T.extra){for(Z=T.extra;oe<Z;){if(J===0)break e;J--,de+=te[W++]<<oe,oe+=8}T.length+=de&(1<<T.extra)-1,de>>>=T.extra,oe-=T.extra,T.back+=T.extra}T.was=T.length,T.mode=23;case 23:for(;Rt=(G=T.distcode[de&(1<<T.distbits)-1])>>>16&255,Pe=65535&G,!((ht=G>>>24)<=oe);){if(J===0)break e;J--,de+=te[W++]<<oe,oe+=8}if((240&Rt)==0){for(Re=ht,le=Rt,L=Pe;Rt=(G=T.distcode[L+((de&(1<<Re+le)-1)>>Re)])>>>16&255,Pe=65535&G,!(Re+(ht=G>>>24)<=oe);){if(J===0)break e;J--,de+=te[W++]<<oe,oe+=8}de>>>=Re,oe-=Re,T.back+=Re}if(de>>>=ht,oe-=ht,T.back+=ht,64&Rt){x.msg="invalid distance code",T.mode=30;break}T.offset=Pe,T.extra=15&Rt,T.mode=24;case 24:if(T.extra){for(Z=T.extra;oe<Z;){if(J===0)break e;J--,de+=te[W++]<<oe,oe+=8}T.offset+=de&(1<<T.extra)-1,de>>>=T.extra,oe-=T.extra,T.back+=T.extra}if(T.offset>T.dmax){x.msg="invalid distance too far back",T.mode=30;break}T.mode=25;case 25:if(Oe===0)break e;if(Ve=Ee-Oe,T.offset>Ve){if((Ve=T.offset-Ve)>T.whave&&T.sane){x.msg="invalid distance too far back",T.mode=30;break}rt=Ve>T.wnext?(Ve-=T.wnext,T.wsize-Ve):T.wnext-Ve,Ve>T.length&&(Ve=T.length),ut=T.window}else ut=U,rt=Y-T.offset,Ve=T.length;for(Oe<Ve&&(Ve=Oe),Oe-=Ve,T.length-=Ve;U[Y++]=ut[rt++],--Ve;);T.length===0&&(T.mode=21);break;case 26:if(Oe===0)break e;U[Y++]=T.length,Oe--,T.mode=21;break;case 27:if(T.wrap){for(;oe<32;){if(J===0)break e;J--,de|=te[W++]<<oe,oe+=8}if(Ee-=Oe,x.total_out+=Ee,T.total+=Ee,Ee&&(x.adler=T.check=T.flags?a(T.check,U,Ee,Y-Ee):s(T.check,U,Ee,Y-Ee)),Ee=Oe,(T.flags?de:w(de))!==T.check){x.msg="incorrect data check",T.mode=30;break}oe=de=0}T.mode=28;case 28:if(T.wrap&&T.flags){for(;oe<32;){if(J===0)break e;J--,de+=te[W++]<<oe,oe+=8}if(de!==(4294967295&T.total)){x.msg="incorrect length check",T.mode=30;break}oe=de=0}T.mode=29;case 29:ee=1;break e;case 30:ee=-3;break e;case 31:return-4;default:return v}return x.next_out=Y,x.avail_out=Oe,x.next_in=W,x.avail_in=J,T.hold=de,T.bits=oe,(T.wsize||Ee!==x.avail_out&&T.mode<30&&(T.mode<27||B!==4))&&V(x,x.output,x.next_out,Ee-x.avail_out)?(T.mode=31,-4):(pe-=x.avail_in,Ee-=x.avail_out,x.total_in+=pe,x.total_out+=Ee,T.total+=Ee,T.wrap&&Ee&&(x.adler=T.check=T.flags?a(T.check,U,Ee,x.next_out-Ee):s(T.check,U,Ee,x.next_out-Ee)),x.data_type=T.bits+(T.last?64:0)+(T.mode===12?128:0)+(T.mode===20||T.mode===15?256:0),(pe==0&&Ee===0||B===4)&&ee===p&&(ee=-5),ee)},o.inflateEnd=function(x){if(!x||!x.state)return v;var B=x.state;return B.window&&(B.window=null),x.state=null,p},o.inflateGetHeader=function(x,B){var T;return x&&x.state?(2&(T=x.state).wrap)==0?v:((T.head=B).done=!1,p):v},o.inflateSetDictionary=function(x,B){var T,te=B.length;return x&&x.state?(T=x.state).wrap!==0&&T.mode!==11?v:T.mode===11&&s(1,B,te,0)!==T.check?-3:V(x,B,te,te)?(T.mode=31,-4):(T.havedict=1,p):v},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,h,p,v,g,y,_,w){var I,k,C,R,P,M,$,F,D,V=w.bits,x=0,B=0,T=0,te=0,U=0,W=0,Y=0,J=0,Oe=0,de=0,oe=null,pe=0,Ee=new i.Buf16(16),Ve=new i.Buf16(16),rt=null,ut=0;for(x=0;x<=15;x++)Ee[x]=0;for(B=0;B<v;B++)Ee[h[p+B]]++;for(U=V,te=15;1<=te&&Ee[te]===0;te--);if(te<U&&(U=te),te===0)return g[y++]=20971520,g[y++]=20971520,w.bits=1,0;for(T=1;T<te&&Ee[T]===0;T++);for(U<T&&(U=T),x=J=1;x<=15;x++)if(J<<=1,(J-=Ee[x])<0)return-1;if(0<J&&(d===0||te!==1))return-1;for(Ve[1]=0,x=1;x<15;x++)Ve[x+1]=Ve[x]+Ee[x];for(B=0;B<v;B++)h[p+B]!==0&&(_[Ve[h[p+B]]++]=B);if(M=d===0?(oe=rt=_,19):d===1?(oe=s,pe-=257,rt=a,ut-=257,256):(oe=l,rt=u,-1),x=T,P=y,Y=B=de=0,C=-1,R=(Oe=1<<(W=U))-1,d===1&&852<Oe||d===2&&592<Oe)return 1;for(;;){for($=x-Y,D=_[B]<M?(F=0,_[B]):_[B]>M?(F=rt[ut+_[B]],oe[pe+_[B]]):(F=96,0),I=1<<x-Y,T=k=1<<W;g[P+(de>>Y)+(k-=I)]=$<<24|F<<16|D|0,k!==0;);for(I=1<<x-1;de&I;)I>>=1;if(I!==0?(de&=I-1,de+=I):de=0,B++,--Ee[x]==0){if(x===te)break;x=h[p+_[B]]}if(U<x&&(de&R)!==C){for(Y===0&&(Y=U),P+=T,J=1<<(W=x-Y);W+Y<te&&!((J-=Ee[W+Y])<=0);)W++,J<<=1;if(Oe+=1<<W,d===1&&852<Oe||d===2&&592<Oe)return 1;g[C=de&R]=U<<24|W<<16|P-y|0}}return de!==0&&(g[P+de]=x-Y<<24|4194304),w.bits=U,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(G){for(var K=G.length;0<=--K;)G[K]=0}var u=0,d=29,h=256,p=h+1+d,v=30,g=19,y=2*p+1,_=15,w=16,I=7,k=256,C=16,R=17,P=18,M=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],$=[0,0,0,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],F=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],D=[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 x=new Array(2*v);l(x);var B=new Array(512);l(B);var T=new Array(256);l(T);var te=new Array(d);l(te);var U,W,Y,J=new Array(v);function Oe(G,K,re,ge,X){this.static_tree=G,this.extra_bits=K,this.extra_base=re,this.elems=ge,this.max_length=X,this.has_stree=G&&G.length}function de(G,K){this.dyn_tree=G,this.max_code=0,this.stat_desc=K}function oe(G){return G<256?B[G]:B[256+(G>>>7)]}function pe(G,K){G.pending_buf[G.pending++]=255&K,G.pending_buf[G.pending++]=K>>>8&255}function Ee(G,K,re){G.bi_valid>w-re?(G.bi_buf|=K<<G.bi_valid&65535,pe(G,G.bi_buf),G.bi_buf=K>>w-G.bi_valid,G.bi_valid+=re-w):(G.bi_buf|=K<<G.bi_valid&65535,G.bi_valid+=re)}function Ve(G,K,re){Ee(G,re[2*K],re[2*K+1])}function rt(G,K){for(var re=0;re|=1&G,G>>>=1,re<<=1,0<--K;);return re>>>1}function ut(G,K,re){var ge,X,ce=new Array(_+1),Ae=0;for(ge=1;ge<=_;ge++)ce[ge]=Ae=Ae+re[ge-1]<<1;for(X=0;X<=K;X++){var ke=G[2*X+1];ke!==0&&(G[2*X]=rt(ce[ke]++,ke))}}function ht(G){var K;for(K=0;K<p;K++)G.dyn_ltree[2*K]=0;for(K=0;K<v;K++)G.dyn_dtree[2*K]=0;for(K=0;K<g;K++)G.bl_tree[2*K]=0;G.dyn_ltree[2*k]=1,G.opt_len=G.static_len=0,G.last_lit=G.matches=0}function Rt(G){8<G.bi_valid?pe(G,G.bi_buf):0<G.bi_valid&&(G.pending_buf[G.pending++]=G.bi_buf),G.bi_buf=0,G.bi_valid=0}function Pe(G,K,re,ge){var X=2*K,ce=2*re;return G[X]<G[ce]||G[X]===G[ce]&&ge[K]<=ge[re]}function Re(G,K,re){for(var ge=G.heap[re],X=re<<1;X<=G.heap_len&&(X<G.heap_len&&Pe(K,G.heap[X+1],G.heap[X],G.depth)&&X++,!Pe(K,ge,G.heap[X],G.depth));)G.heap[re]=G.heap[X],re=X,X<<=1;G.heap[re]=ge}function le(G,K,re){var ge,X,ce,Ae,ke=0;if(G.last_lit!==0)for(;ge=G.pending_buf[G.d_buf+2*ke]<<8|G.pending_buf[G.d_buf+2*ke+1],X=G.pending_buf[G.l_buf+ke],ke++,ge===0?Ve(G,X,K):(Ve(G,(ce=T[X])+h+1,K),(Ae=M[ce])!==0&&Ee(G,X-=te[ce],Ae),Ve(G,ce=oe(--ge),re),(Ae=$[ce])!==0&&Ee(G,ge-=J[ce],Ae)),ke<G.last_lit;);Ve(G,k,K)}function L(G,K){var re,ge,X,ce=K.dyn_tree,Ae=K.stat_desc.static_tree,ke=K.stat_desc.has_stree,De=K.stat_desc.elems,ft=-1;for(G.heap_len=0,G.heap_max=y,re=0;re<De;re++)ce[2*re]!==0?(G.heap[++G.heap_len]=ft=re,G.depth[re]=0):ce[2*re+1]=0;for(;G.heap_len<2;)ce[2*(X=G.heap[++G.heap_len]=ft<2?++ft:0)]=1,G.depth[X]=0,G.opt_len--,ke&&(G.static_len-=Ae[2*X+1]);for(K.max_code=ft,re=G.heap_len>>1;1<=re;re--)Re(G,ce,re);for(X=De;re=G.heap[1],G.heap[1]=G.heap[G.heap_len--],Re(G,ce,1),ge=G.heap[1],G.heap[--G.heap_max]=re,G.heap[--G.heap_max]=ge,ce[2*X]=ce[2*re]+ce[2*ge],G.depth[X]=(G.depth[re]>=G.depth[ge]?G.depth[re]:G.depth[ge])+1,ce[2*re+1]=ce[2*ge+1]=X,G.heap[1]=X++,Re(G,ce,1),2<=G.heap_len;);G.heap[--G.heap_max]=G.heap[1],(function(xe,qe){var Bt,bt,tt,Dt,tn,Mn,ln=qe.dyn_tree,qn=qe.max_code,Kt=qe.stat_desc.static_tree,Fn=qe.stat_desc.has_stree,Jn=qe.stat_desc.extra_bits,Nn=qe.stat_desc.extra_base,Sr=qe.stat_desc.max_length,Kn=0;for(Dt=0;Dt<=_;Dt++)xe.bl_count[Dt]=0;for(ln[2*xe.heap[xe.heap_max]+1]=0,Bt=xe.heap_max+1;Bt<y;Bt++)Sr<(Dt=ln[2*ln[2*(bt=xe.heap[Bt])+1]+1]+1)&&(Dt=Sr,Kn++),ln[2*bt+1]=Dt,qn<bt||(xe.bl_count[Dt]++,tn=0,Nn<=bt&&(tn=Jn[bt-Nn]),Mn=ln[2*bt],xe.opt_len+=Mn*(Dt+tn),Fn&&(xe.static_len+=Mn*(Kt[2*bt+1]+tn)));if(Kn!==0){do{for(Dt=Sr-1;xe.bl_count[Dt]===0;)Dt--;xe.bl_count[Dt]--,xe.bl_count[Dt+1]+=2,xe.bl_count[Sr]--,Kn-=2}while(0<Kn);for(Dt=Sr;Dt!==0;Dt--)for(bt=xe.bl_count[Dt];bt!==0;)qn<(tt=xe.heap[--Bt])||(ln[2*tt+1]!==Dt&&(xe.opt_len+=(Dt-ln[2*tt+1])*ln[2*tt],ln[2*tt+1]=Dt),bt--)}})(G,K),ut(ce,ft,G.bl_count)}function A(G,K,re){var ge,X,ce=-1,Ae=K[1],ke=0,De=7,ft=4;for(Ae===0&&(De=138,ft=3),K[2*(re+1)+1]=65535,ge=0;ge<=re;ge++)X=Ae,Ae=K[2*(ge+1)+1],++ke<De&&X===Ae||(ke<ft?G.bl_tree[2*X]+=ke:X!==0?(X!==ce&&G.bl_tree[2*X]++,G.bl_tree[2*C]++):ke<=10?G.bl_tree[2*R]++:G.bl_tree[2*P]++,ce=X,ft=(ke=0)===Ae?(De=138,3):X===Ae?(De=6,3):(De=7,4))}function ee(G,K,re){var ge,X,ce=-1,Ae=K[1],ke=0,De=7,ft=4;for(Ae===0&&(De=138,ft=3),ge=0;ge<=re;ge++)if(X=Ae,Ae=K[2*(ge+1)+1],!(++ke<De&&X===Ae)){if(ke<ft)for(;Ve(G,X,G.bl_tree),--ke!=0;);else X!==0?(X!==ce&&(Ve(G,X,G.bl_tree),ke--),Ve(G,C,G.bl_tree),Ee(G,ke-3,2)):ke<=10?(Ve(G,R,G.bl_tree),Ee(G,ke-3,3)):(Ve(G,P,G.bl_tree),Ee(G,ke-11,7));ce=X,ft=(ke=0)===Ae?(De=138,3):X===Ae?(De=6,3):(De=7,4)}}l(J);var ue=!1;function Z(G,K,re,ge){Ee(G,(u<<1)+(ge?1:0),3),(function(X,ce,Ae,ke){Rt(X),ke&&(pe(X,Ae),pe(X,~Ae)),i.arraySet(X.pending_buf,X.window,ce,Ae,X.pending),X.pending+=Ae})(G,K,re,!0)}o._tr_init=function(G){ue||((function(){var K,re,ge,X,ce,Ae=new Array(_+1);for(X=ge=0;X<d-1;X++)for(te[X]=ge,K=0;K<1<<M[X];K++)T[ge++]=X;for(T[ge-1]=X,X=ce=0;X<16;X++)for(J[X]=ce,K=0;K<1<<$[X];K++)B[ce++]=X;for(ce>>=7;X<v;X++)for(J[X]=ce<<7,K=0;K<1<<$[X]-7;K++)B[256+ce++]=X;for(re=0;re<=_;re++)Ae[re]=0;for(K=0;K<=143;)V[2*K+1]=8,K++,Ae[8]++;for(;K<=255;)V[2*K+1]=9,K++,Ae[9]++;for(;K<=279;)V[2*K+1]=7,K++,Ae[7]++;for(;K<=287;)V[2*K+1]=8,K++,Ae[8]++;for(ut(V,p+1,Ae),K=0;K<v;K++)x[2*K+1]=5,x[2*K]=rt(K,5);U=new Oe(V,M,h+1,p,_),W=new Oe(x,$,0,v,_),Y=new Oe(new Array(0),F,0,g,I)})(),ue=!0),G.l_desc=new de(G.dyn_ltree,U),G.d_desc=new de(G.dyn_dtree,W),G.bl_desc=new de(G.bl_tree,Y),G.bi_buf=0,G.bi_valid=0,ht(G)},o._tr_stored_block=Z,o._tr_flush_block=function(G,K,re,ge){var X,ce,Ae=0;0<G.level?(G.strm.data_type===2&&(G.strm.data_type=(function(ke){var De,ft=4093624447;for(De=0;De<=31;De++,ft>>>=1)if(1&ft&&ke.dyn_ltree[2*De]!==0)return s;if(ke.dyn_ltree[18]!==0||ke.dyn_ltree[20]!==0||ke.dyn_ltree[26]!==0)return a;for(De=32;De<h;De++)if(ke.dyn_ltree[2*De]!==0)return a;return s})(G)),L(G,G.l_desc),L(G,G.d_desc),Ae=(function(ke){var De;for(A(ke,ke.dyn_ltree,ke.l_desc.max_code),A(ke,ke.dyn_dtree,ke.d_desc.max_code),L(ke,ke.bl_desc),De=g-1;3<=De&&ke.bl_tree[2*D[De]+1]===0;De--);return ke.opt_len+=3*(De+1)+5+5+4,De})(G),X=G.opt_len+3+7>>>3,(ce=G.static_len+3+7>>>3)<=X&&(X=ce)):X=ce=re+5,re+4<=X&&K!==-1?Z(G,K,re,ge):G.strategy===4||ce===X?(Ee(G,2+(ge?1:0),3),le(G,V,x)):(Ee(G,4+(ge?1:0),3),(function(ke,De,ft,xe){var qe;for(Ee(ke,De-257,5),Ee(ke,ft-1,5),Ee(ke,xe-4,4),qe=0;qe<xe;qe++)Ee(ke,ke.bl_tree[2*D[qe]+1],3);ee(ke,ke.dyn_ltree,De-1),ee(ke,ke.dyn_dtree,ft-1)})(G,G.l_desc.max_code+1,G.d_desc.max_code+1,Ae+1),le(G,G.dyn_ltree,G.dyn_dtree)),ht(G),ge&&Rt(G)},o._tr_tally=function(G,K,re){return G.pending_buf[G.d_buf+2*G.last_lit]=K>>>8&255,G.pending_buf[G.d_buf+2*G.last_lit+1]=255&K,G.pending_buf[G.l_buf+G.last_lit]=255&re,G.last_lit++,K===0?G.dyn_ltree[2*re]++:(G.matches++,K--,G.dyn_ltree[2*(T[re]+h+1)]++,G.dyn_dtree[2*oe(K)]++),G.last_lit===G.lit_bufsize-1},o._tr_align=function(G){Ee(G,2,3),Ve(G,k,V),(function(K){K.bi_valid===16?(pe(K,K.bi_buf),K.bi_buf=0,K.bi_valid=0):8<=K.bi_valid&&(K.pending_buf[K.pending++]=255&K.bi_buf,K.bi_buf>>=8,K.bi_valid-=8)})(G)}},{"../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,h,p=1,v={},g=!1,y=s.document,_=Object.getPrototypeOf&&Object.getPrototypeOf(s);_=_&&_.setTimeout?_:s,l={}.toString.call(s.process)==="[object process]"?function(C){process.nextTick(function(){I(C)})}:(function(){if(s.postMessage&&!s.importScripts){var C=!0,R=s.onmessage;return s.onmessage=function(){C=!1},s.postMessage("","*"),s.onmessage=R,C}})()?(h="setImmediate$"+Math.random()+"$",s.addEventListener?s.addEventListener("message",k,!1):s.attachEvent("onmessage",k),function(C){s.postMessage(h+C,"*")}):s.MessageChannel?((d=new MessageChannel).port1.onmessage=function(C){I(C.data)},function(C){d.port2.postMessage(C)}):y&&"onreadystatechange"in y.createElement("script")?(u=y.documentElement,function(C){var R=y.createElement("script");R.onreadystatechange=function(){I(C),R.onreadystatechange=null,u.removeChild(R),R=null},u.appendChild(R)}):function(C){setTimeout(I,0,C)},_.setImmediate=function(C){typeof C!="function"&&(C=new Function(""+C));for(var R=new Array(arguments.length-1),P=0;P<R.length;P++)R[P]=arguments[P+1];return v[p]={callback:C,args:R},l(p),p++},_.clearImmediate=w}function w(C){delete v[C]}function I(C){if(g)setTimeout(I,0,C);else{var R=v[C];if(R){g=!0;try{(function(P){var M=P.callback,$=P.args;switch($.length){case 0:M();break;case 1:M($[0]);break;case 2:M($[0],$[1]);break;case 3:M($[0],$[1],$[2]);break;default:M.apply(a,$)}})(R)}finally{w(C),g=!1}}}}function k(C){C.source===s&&typeof C.data=="string"&&C.data.indexOf(h)===0&&I(+C.data.slice(h.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)})})),Nr="application/vnd.openxmlformats-officedocument.wordprocessingml.document",rl="application/pdf",Qf="text/html",E8={docx:Nr,pdf:rl,html:Qf},lm={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"},T8=e=>typeof e!="string"?"":e.trim(),Mb=e=>{if(typeof e!="string")return"";const t=e.trim();return t?t.toLowerCase():""},cm=e=>{if(typeof e!="string")return"";const t=e.trim();return t?t.toLowerCase():""},tu=e=>{const t=e??{},n=T8(t.id),r=Mb(t.email);return{id:n,email:r,name:typeof t.name=="string"?t.name:"",hasId:n.length>0,hasEmail:r.length>0}},xS=({current:e,other:t})=>{const n=tu(e),r=tu(t);return n.hasId&&r.hasId?n.id===r.id:n.hasEmail&&r.hasEmail?n.email===r.email:!1},um=({actor:e,fallbackKey:t=""})=>{const n=tu(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 x8(e){return typeof e.captureStackTrace=="function"}var dm=class extends Error{constructor(e,t){super(e),this.cause=t,this.name="FileObjectError",x8(Error)&&Error.captureStackTrace(this,this.constructor)}},R8=class extends dm{constructor(e){super("Invalid data URI format: URI must contain exactly one comma separator"),this.uri=e,this.name="InvalidDataUriError"}},L8=class extends dm{constructor(e,t){super(`Failed to fetch file from URL: ${e}`,t),this.url=e,this.name="FetchFailedError"}},Ob=async(e,t,n,r)=>{try{if(e.startsWith("data:")&&e.includes(";base64,")){const s=e.split(",");if(s.length!==2)throw new R8(e);const a=atob(s[1]),l=Uint8Array.from(a,u=>u.charCodeAt(0));return new File([l],t,{type:n})}const o=await(r?.signal?fetch(e,{signal:r.signal}):fetch(e));if(!o.ok)throw new L8(e,new Error(`HTTP ${o.status}: ${o.statusText}`));const i=await o.blob();return new File([i],t,{type:n})}catch(o){throw o instanceof dm?o:new dm("Failed to create file object",o)}};function M8(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 fm=new WeakMap;function RS(e){return e.ownerDocument??document}function LS(e,t){const n=fm.get(t);n?.bindings.delete(e),n&&n.bindings.size===0&&(t.removeEventListener("click",n.listener),fm.delete(t))}function MS(e,t){const n=RS(e);e.__clickOutsideDocument&&e.__clickOutsideDocument!==n&&LS(e,e.__clickOutsideDocument);let r=fm.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},fm.set(n,r),n.addEventListener("click",i)}r.bindings.set(e,t),e.__clickOutsideHandler=r.listener,e.__clickOutsideDocument=n}var Pb={mounted(e,t){MS(e,t)},updated(e,t){MS(e,t)},unmounted(e){LS(e,e.__clickOutsideDocument??RS(e)),delete e.__clickOutsideHandler,delete e.__clickOutsideDocument}},O8="https://ingest.superdoc.dev/v1/collect",hZ="community-and-eval-agplv3";function P8(){try{return"2.28.0-next.14"}catch{return"unknown"}}var D8=class{constructor(e){this.enabled=e.enabled,this.endpoint=e.endpoint||O8,this.licenseKey=e.licenseKey||"",this.metadata=e.metadata,this.superdocVersion=P8()}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{}}};Ut();var F8=fw(I8(),1),hm={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"},pZ=[hm.INLINE_SDT_LABEL,hm.BLOCK_SDT_LABEL],OS={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"},N8=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"}}},mZ=`.${hm.BLOCK_SDT}[${OS.SDT_ID}]`,gZ=`[${OS.DRAGGABLE}="true"]`,B8=typeof window<"u",PS,Jf=e=>PS=e,DS=Symbol();function Db(e){return e&&typeof e=="object"&&Object.prototype.toString.call(e)==="[object Object]"&&typeof e.toJSON!="function"}var eh;(function(e){e.direct="direct",e.patchObject="patch object",e.patchFunction="patch function"})(eh||(eh={}));var FS=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 z8(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 Fb(e,t,n){const r=new XMLHttpRequest;r.open("GET",e),r.responseType="blob",r.onload=function(){V8(r.response,t,n)},r.onerror=function(){console.error("could not download file")},r.send()}function NS(e){const t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch{}return t.status>=200&&t.status<=299}function pm(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 mm=typeof navigator=="object"?navigator:{userAgent:""},BS=/Macintosh/.test(mm.userAgent)&&/AppleWebKit/.test(mm.userAgent)&&!/Safari/.test(mm.userAgent),V8=B8?typeof HTMLAnchorElement<"u"&&"download"in HTMLAnchorElement.prototype&&!BS?U8:"msSaveOrOpenBlob"in mm?j8:$8:()=>{};function U8(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?NS(r.href)?Fb(e,t,n):(r.target="_blank",pm(r)):pm(r)):(r.href=URL.createObjectURL(e),setTimeout(function(){URL.revokeObjectURL(r.href)},4e4),setTimeout(function(){pm(r)},0))}function j8(e,t="download",n){if(typeof e=="string")if(NS(e))Fb(e,t,n);else{const r=document.createElement("a");r.href=e,r.target="_blank",setTimeout(function(){pm(r)})}else navigator.msSaveOrOpenBlob(z8(e,n),t)}function $8(e,t,n,r){if(r=r||open("","_blank"),r&&(r.document.title=r.document.body.innerText="downloading..."),typeof e=="string")return Fb(e,t,n);const o=e.type==="application/octet-stream",i=/constructor/i.test(String(FS.HTMLElement))||"safari"in FS,s=/CriOS\/[\d]+/.test(navigator.userAgent);if((s||o&&i||BS)&&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:vZ}=Object;function H8(){const e=jv(!0),t=e.run(()=>ne({}));let n=[],r=[];const o=Ko({install(i){Jf(o),o._a=i,i.provide(DS,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 zS=()=>{};function VS(e,t,n,r=zS){e.add(t);const o=()=>{e.delete(t)&&r()};return!n&&$v()&&Lw(o),o}function td(e,...t){e.forEach(n=>{n(...t)})}var G8=e=>e(),US=Symbol(),Nb=Symbol();function Bb(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];Db(o)&&Db(r)&&e.hasOwnProperty(n)&&!Tr(r)&&!Li(r)?e[n]=Bb(o,r):e[n]=r}return e}var W8=Symbol();function q8(e){return!Db(e)||!Object.prototype.hasOwnProperty.call(e,W8)}var{assign:Jl}=Object;function K8(e){return!!(Tr(e)&&e.effect)}function Y8(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=jw(n.state.value[e]);return Jl(d,i,Object.keys(s||{}).reduce((h,p)=>(h[p]=Ko(Ce(()=>{Jf(n);const v=n._s.get(e);return s[p].call(v,v)})),h),{}))}return l=jS(e,u,t,n,r,!0),l}function jS(e,t,n={},r,o,i){let s;const a=Jl({actions:{}},n),l={deep:!0};let u,d,h=new Set,p=new Set,v;const g=r.state.value[e];!i&&!g&&(r.state.value[e]={});let y;function _(P){let M;u=d=!1,typeof P=="function"?(P(r.state.value[e]),M={type:eh.patchFunction,storeId:e,events:v}):(Bb(r.state.value[e],P),M={type:eh.patchObject,payload:P,storeId:e,events:v});const $=y=Symbol();It().then(()=>{y===$&&(u=!0)}),d=!0,td(h,M,r.state.value[e])}const w=i?function(){const{state:M}=n,$=M?M():{};this.$patch(F=>{Jl(F,$)})}:zS;function I(){s.stop(),h.clear(),p.clear(),r._s.delete(e)}const k=(P,M="")=>{if(US in P)return P[Nb]=M,P;const $=function(){Jf(r);const F=Array.from(arguments),D=new Set,V=new Set;function x(te){D.add(te)}function B(te){V.add(te)}td(p,{args:F,name:$[Nb],store:C,after:x,onError:B});let T;try{T=P.apply(this&&this.$id===e?this:C,F)}catch(te){throw td(V,te),te}return T instanceof Promise?T.then(te=>(td(D,te),te)).catch(te=>(td(V,te),Promise.reject(te))):(td(D,T),T)};return $[US]=!0,$[Nb]=M,$},C=vo({_p:r,$id:e,$onAction:VS.bind(null,p),$patch:_,$reset:w,$subscribe(P,M={}){const $=VS(h,P,M.detached,()=>F()),F=s.run(()=>$t(()=>r.state.value[e],D=>{(M.flush==="sync"?d:u)&&P({storeId:e,type:eh.direct,events:v},D)},Jl({},l,M)));return $},$dispose:I});r._s.set(e,C);const R=(r._a&&r._a.runWithContext||G8)(()=>r._e.run(()=>(s=jv()).run(()=>t({action:k}))));for(const P in R){const M=R[P];Tr(M)&&!K8(M)||Li(M)?i||(g&&q8(M)&&(Tr(M)?M.value=g[P]:Bb(M,g[P])),r.state.value[e][P]=M):typeof M=="function"&&(R[P]=k(M,P),a.actions[P]=M)}return Jl(C,R),Jl(Rn(C),R),Object.defineProperty(C,"$state",{get:()=>r.state.value[e],set:P=>{_(M=>{Jl(M,P)})}}),r._p.forEach(P=>{Jl(C,s.run(()=>P({store:C,app:r._a,pinia:r,options:a})))}),g&&i&&n.hydrate&&n.hydrate(C.$state,g),u=!0,d=!0,C}function $S(e,t,n){let r;const o=typeof t=="function";r=o?n:t;function i(s,a){const l=mC();return s=s||(l?na(DS,null):null),s&&Jf(s),s=PS,s._s.has(e)||(o?jS(e,t,r,s):Y8(e,r,s)),s._s.get(e)}return i.$id=e,i}function ca(e){const t=Rn(e),n={};for(const r in t){const o=t[r];o.effect?n[r]=Ce({get:()=>e[r],set(i){e[r]=i}}):(Tr(o)||Li(o))&&(n[r]=Zv(e,r))}return n}var HS=class extends Error{constructor(e,t){super(e==="DOCUMENT_LOAD_TIMEOUT"?"Document load deadline exceeded.":"Document load cancelled."),this.code=e,this.documentId=t,this.name="DocumentLoadError"}};function X8(e,t){if(e===void 0)return;if(e.timeoutMs!==void 0&&(!Number.isFinite(e.timeoutMs)||e.timeoutMs<=0||e.timeoutMs>2147483647))throw new RangeError("load.timeoutMs must be positive and at most 2147483647.");const n=new AbortController;let r=!1,o=null,i,s;const a=new Set,l=new Set,u=new Promise((v,g)=>{s=g});u.catch(()=>{});const d=()=>{i!==void 0&&clearTimeout(i),e.signal?.removeEventListener("abort",p)},h=v=>{if(!(r||o)){o=new HS(v,t),d(),n.abort(o),s(o);for(const g of l)g();l.clear();for(const g of[...a])g(o);a.clear()}},p=()=>h("DOCUMENT_LOAD_CANCELLED");return e.timeoutMs!==void 0&&(i=setTimeout(()=>h("DOCUMENT_LOAD_TIMEOUT"),e.timeoutMs)),e.signal?.addEventListener("abort",p,{once:!0}),e.signal?.aborted&&p(),{signal:n.signal,wait(v){return o?Promise.reject(o):Promise.race([u,v])},assertActive(){if(o)throw o},finish(){if(o)return!1;r=!0,d(),a.clear();for(const v of l)v();return l.clear(),!0},cancel:p,onSettled(v){r||o?v():l.add(v)},onFailure(v){return o?v(o):r||a.add(v),()=>a.delete(v)}}}function GS(e){return e.collaboration!==void 0?e.collaboration:e.v2Collaboration}function WS(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 nu(e){return typeof e=="string"&&e.length>0?e:null}function Z8(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 qS(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 Q8(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 zb(e){return e===void 0?"join":e==="join"||e==="create"?e:null}function J8(e){if(e!==void 0)return typeof e=="number"&&Number.isFinite(e)&&e>0&&e<=2147483647?e:null}function gm(e,t){return!e.ok||t===void 0?e:{ok:!0,target:{...e.target,syncTimeoutMs:t}}}function Vb(){return{ok:!1,reason:"invalid-room-mode",message:'SuperDoc v2 collaboration roomMode must be either "join" or "create".'}}function eR(e){const t=e.providerType;return typeof t=="string"&&t.length>0?t.toLowerCase():null}function tR(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 KS(e,t){const n=nu(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=Z8(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: ${WS(r)}).`};const i=Q8(t.params),s=e==="hocuspocus"&&typeof t.token=="function"?t.token:e==="hocuspocus"?nu(t.token):null,a=zb(t.roomMode);return a?{ok:!0,target:{providerFamily:e,documentId:n,roomMode:a,serverUrl:o,...i?{params:i}:{},...s?{token:s}:{},...e==="hocuspocus"&&t.retry!==void 0?{retry:t.retry}:{}}}:Vb()}function nR(e){const t=nu(e.adapterId);if(!t)return{ok:!1,reason:"invalid-adapter-id",message:"SuperDoc v2 provider extensions require a non-empty collaboration.adapterId."};const n=nu(e.documentId);if(!n)return{ok:!1,reason:"invalid-document-id",message:"SuperDoc v2 provider extensions require a non-empty collaboration.documentId."};const r=zb(e.roomMode);if(!r)return Vb();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:nu(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 rR(e,t){const n=nu(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=nu(e.publicApiKey),o=zb(e.roomMode);if(!o)return Vb();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."};const a=e.baseUrl,l=a===void 0?void 0:qS(a);if(l===null)return{ok:!1,reason:"invalid-base-url",message:"SuperDoc v2 Liveblocks collaboration requires baseUrl to be an absolute http(s) URL."};const u=l?{baseUrl:l}:{};if(r)return{ok:!0,target:{providerFamily:"liveblocks",documentId:n,roomMode:o,publicApiKey:r,...u}};const d=qS(i,t);return d?{ok:!0,target:{providerFamily:"liveblocks",documentId:n,roomMode:o,authEndpoint:d,...u}}:{ok:!1,reason:"invalid-auth-endpoint",message:"SuperDoc v2 Liveblocks collaboration requires a valid http(s) authEndpoint URL (received: <redacted>)."}}function YS(e){const{legacyCollaboration:t,documentType:n,documentCount:r,authEndpointBaseUrl:o}=e,i=GS(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=tR(t);if(u){const d=u==="external-ydoc-provider"?"unsupported-legacy-provider":"unsupported-provider-family",h=WS(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: ${h}). 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=J8(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=eR(s);return l===null||l==="y-websocket"?gm(KS("y-websocket",s),a):l==="hocuspocus"?gm(KS("hocuspocus",s),a):l==="liveblocks"?gm(rR(s,o),a):l==="extension"?gm(nR(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 th=(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?th(e.originFileObj,e.name||t):e.file?th(e.file,e.name||t):e.raw?th(e.raw,e.name||t):null},XS=Object.getOwnPropertyDescriptor(ArrayBuffer.prototype,"byteLength")?.get,oR=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Uint8Array.prototype),Symbol.toStringTag)?.get,ec=e=>{if(ArrayBuffer.isView(e))return oR?.call(e)==="Uint8Array";if(!XS)return!1;try{return XS.call(e),!0}catch{return!1}},Ub=e=>{if(e instanceof Uint8Array)return e;const t=ArrayBuffer.isView(e)?e:new Uint8Array(e);return Uint8Array.from(t)},jb=(e,t)=>new Blob([Ub(e)],{type:t}),$b=e=>{switch(e.toLowerCase()){case"docx":case Nr:return Nr;case"pdf":case rl:return rl;case"html":case Qf:return Qf;default:return e}},vm=(e="")=>{const t=String(e).toLowerCase();return t.endsWith(".docx")?Nr:t.endsWith(".pdf")?rl:t.endsWith(".html")||t.endsWith(".htm")?Qf:t.endsWith(".md")||t.endsWith(".markdown")?"text/markdown":""},iR=e=>e==="application/vnd.openxmlformats-officedocument.wordprocessingml.document"?"document.docx":e==="application/pdf"?"document.pdf":e==="text/html"?"document.html":"document",sR="application/octet-stream",Hb=e=>{if(e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"collaboration")){const n={...e};delete n.collaboration,e={...n,v2Collaboration:GS(e)}}if(ec(e))return{type:Nr,data:Ub(e),name:"document.docx"};const t=th(e);if(t){const n=e&&typeof e.name=="string"?e.name:"",r=t.name||"",o=vm(n),i=o||vm(r),s=t.type.toLowerCase()===sR,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(ec(e.data)){const r=$b(e.type||vm(e.name)||"application/vnd.openxmlformats-officedocument.wordprocessingml.document");return{...e,type:r,data:r==="application/vnd.openxmlformats-officedocument.wordprocessingml.document"?Ub(e.data):jb(e.data,r),name:e.name||iR(r)}}const n=th(e.data,e.name);if(n){const r=typeof e.type=="string"&&e.type?$b(e.type):"",o=r||n.type||vm(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=$b(e.type);if(n!==e.type)return{...e,type:n}}return e};Ut();function aR(e,t){const n=e.itemid,r=e,o=t!==null&&typeof t=="object"?vo({...t}):ne(t),i=ne(null);return $t(o,(a,l)=>{const u={fieldId:n.value,changeTime:Date.now(),oldValue:l,newValue:a,originalField:r};i.value=u}),{value:o}}function lR(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}=aR(e,i,ne([])),l=ne(e.itemtype),u=ne(e.itemfieldtype),d=e,h=vo({fontFamily:e.fontfamily||"Arial",fontSize:e.font_size||"12pt",originalFontSize:e.original_font_size||"12pt"}),p=ne(e.logicrules),v=ne(!1),g=vo({}),y={SELECT:uR,IMAGEINPUT:cR,CHECKBOXINPUT:dR};return l.value in y&&Object.assign(g,y[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:v,originalJSON:d,fieldStyle:h,valueGetter:e.valueGetter,...g}}function cR(e){return{fontfamily:ne(e.fontfamily),iteminputtype:ne(e.iteminputtype)}}function uR(e){return{options:ne(e.itemoptions)}}function dR(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 ua=()=>new Map,Gb=e=>{const t=ua();return e.forEach((n,r)=>{t.set(r,n)}),t},nd=(e,t,n)=>{let r=e.get(t);return r===void 0&&e.set(t,r=n()),r},fR=(e,t)=>{const n=[];for(const[r,o]of e)n.push(t(o,r));return n},hR=(e,t)=>{for(const[n,r]of e)if(t(r,n))return!0;return!1},rd=()=>new Set,Wb=e=>e[e.length-1],od=Array.from,qb=(e,t)=>{for(let n=0;n<e.length;n++)if(!t(e[n],n,e))return!1;return!0},ZS=(e,t)=>{for(let n=0;n<e.length;n++)if(t(e[n],n,e))return!0;return!1},pR=(e,t)=>{const n=new Array(e);for(let r=0;r<e;r++)n[r]=t(r,n);return n},ym=Array.isArray,mR=class{constructor(){this._observers=ua()}on(e,t){return nd(this._observers,e,rd).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 od((this._observers.get(e)||ua()).values()).forEach(n=>n(...t))}destroy(){this._observers=ua()}},ol=Math.floor,bm=Math.abs,QS=(e,t)=>e<t?e:t,id=(e,t)=>e>t?e:t,yZ=Number.isNaN,gR=e=>e!==0?e<0:1/e<0,bZ=1,wZ=2,CZ=4,kZ=8,SZ=32,_Z=64,AZ=128,vR=1<<17,yR=1<<18,bR=1<<19,wR=1<<20,CR=1<<21,kR=1<<22,SR=1<<23,_R=1<<24,AR=1<<25,IR=1<<26,ER=1<<27,TR=1<<28,xR=1<<29,RR=1<<30,IZ=31,EZ=63,TZ=127,xZ=vR-1,RZ=yR-1,LZ=bR-1,MZ=wR-1,OZ=CR-1,PZ=kR-1,DZ=SR-1,FZ=_R-1,NZ=AR-1,BZ=IR-1,zZ=ER-1,VZ=TR-1,UZ=xR-1,jZ=RR-1,$Z=2147483647,JS=Number.MAX_SAFE_INTEGER,e3=Number.MIN_SAFE_INTEGER,LR=Number.isInteger||(e=>typeof e=="number"&&isFinite(e)&&ol(e)===e),HZ=Number.isNaN,GZ=Number.parseInt,t3=String.fromCharCode,WZ=String.fromCodePoint,qZ=t3(65535),MR=e=>e.toLowerCase(),OR=/^\s*/g,PR=e=>e.replace(OR,""),DR=/([A-Z])/g,n3=(e,t)=>PR(e.replace(DR,n=>`${t}${MR(n)}`)),FR=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},nh=typeof TextEncoder<"u"?new TextEncoder:null,NR=e=>nh.encode(e),BR=nh?NR:FR,Kb=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});Kb&&Kb.decode(new Uint8Array).length===1&&(Kb=null);var zR=(e,t)=>pR(t,()=>e).join(""),rh=class{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}},Yb=()=>new rh,VR=e=>{let t=e.cpos;for(let n=0;n<e.bufs.length;n++)t+=e.bufs[n].length;return t},il=e=>{const t=new Uint8Array(VR(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},UR=(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(id(n,t)*2),e.cpos=0)},Bo=(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},Xb=Bo,wr=(e,t)=>{for(;t>127;)Bo(e,128|127&t),t=ol(t/128);Bo(e,127&t)},Zb=(e,t)=>{const n=gR(t);for(n&&(t=-t),Bo(e,(t>63?128:0)|(n?64:0)|63&t),t=ol(t/64);t>0;)Bo(e,(t>127?128:0)|127&t),t=ol(t/128)},Qb=new Uint8Array(3e4),jR=Qb.length/3,$R=(e,t)=>{if(t.length<jR){const n=nh.encodeInto(t,Qb).written||0;wr(e,n);for(let r=0;r<n;r++)Bo(e,Qb[r])}else Yi(e,BR(t))},HR=(e,t)=>{const n=unescape(encodeURIComponent(t)),r=n.length;wr(e,r);for(let o=0;o<r;o++)Bo(e,n.codePointAt(o))},sd=nh&&nh.encodeInto?$R:HR,Jb=(e,t)=>{const n=e.cbuf.length,r=e.cpos,o=QS(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(id(n*2,i)),e.cbuf.set(t.subarray(o)),e.cpos=i)},Yi=(e,t)=>{wr(e,t.byteLength),Jb(e,t)},e0=(e,t)=>{UR(e,t);const n=new DataView(e.cbuf.buffer,e.cpos,t);return e.cpos+=t,n},GR=(e,t)=>e0(e,4).setFloat32(0,t,!1),WR=(e,t)=>e0(e,8).setFloat64(0,t,!1),qR=(e,t)=>e0(e,8).setBigInt64(0,t,!1),r3=new DataView(new ArrayBuffer(4)),KR=e=>(r3.setFloat32(0,e),r3.getFloat32(0)===e),oh=(e,t)=>{switch(typeof t){case"string":Bo(e,119),sd(e,t);break;case"number":LR(t)&&bm(t)<=2147483647?(Bo(e,125),Zb(e,t)):KR(t)?(Bo(e,124),GR(e,t)):(Bo(e,123),WR(e,t));break;case"bigint":Bo(e,122),qR(e,t);break;case"object":if(t===null)Bo(e,126);else if(ym(t)){Bo(e,117),wr(e,t.length);for(let n=0;n<t.length;n++)oh(e,t[n])}else if(t instanceof Uint8Array)Bo(e,116),Yi(e,t);else{Bo(e,118);const n=Object.keys(t);wr(e,n.length);for(let r=0;r<n.length;r++){const o=n[r];sd(e,o),oh(e,t[o])}}break;case"boolean":Bo(e,t?120:121);break;default:Bo(e,127)}},o3=class extends rh{constructor(e){super(),this.w=e,this.s=null,this.count=0}write(e){this.s===e?this.count++:(this.count>0&&wr(this,this.count-1),this.count=1,this.w(this,e),this.s=e)}},i3=e=>{e.count>0&&(Zb(e.encoder,e.count===1?e.s:-e.s),e.count>1&&wr(e.encoder,e.count-2))},wm=class{constructor(){this.encoder=new rh,this.s=0,this.count=0}write(e){this.s===e?this.count++:(i3(this),this.count=1,this.s=e)}toUint8Array(){return i3(this),il(this.encoder)}},s3=e=>{if(e.count>0){const t=e.diff*2+(e.count===1?0:1);Zb(e.encoder,t),e.count>1&&wr(e.encoder,e.count-2)}},t0=class{constructor(){this.encoder=new rh,this.s=0,this.count=0,this.diff=0}write(e){this.diff===e-this.s?(this.s=e,this.count++):(s3(this),this.count=1,this.diff=e-this.s,this.s=e)}toUint8Array(){return s3(this),il(this.encoder)}},YR=class{constructor(){this.sarr=[],this.s="",this.lensE=new wm}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 rh;return this.sarr.push(this.s),this.s="",sd(e,this.sarr.join("")),Jb(e,this.lensE.toUint8Array()),il(e)}},tc=e=>new Error(e),Ps=()=>{throw tc("Method unimplemented")},sl=()=>{throw tc("Unexpected case")},KZ=crypto.subtle,XR=crypto.getRandomValues.bind(crypto),a3=()=>XR(new Uint32Array(1))[0],ZR="10000000-1000-4000-8000-100000000000",QR=()=>ZR.replace(/[018]/g,e=>(e^a3()&15>>e/4).toString(16)),JR=Date.now,l3=e=>new Promise(e),YZ=Promise.all.bind(Promise),c3=e=>e===void 0?null:e,e7=class{constructor(){this.map=new Map}setItem(e,t){this.map.set(e,t)}getItem(e){return this.map.get(e)}},u3=new e7,t7=!0;try{typeof localStorage<"u"&&localStorage&&(u3=localStorage,t7=!1)}catch{}var n7=u3,ih=Symbol("Equality"),d3=(e,t)=>e===t||!!e?.[ih]?.(t)||!1,r7=e=>typeof e=="object",o7=Object.assign,i7=Object.keys,s7=(e,t)=>{for(const n in e)t(e[n],n)},Cm=e=>i7(e).length,a7=e=>{for(const t in e)return!1;return!0},sh=(e,t)=>{for(const n in e)if(!t(e[n],n))return!1;return!0},n0=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),l7=(e,t)=>e===t||Cm(e)===Cm(t)&&sh(e,(n,r)=>(n!==void 0||n0(t,r))&&d3(t[r],n)),c7=Object.freeze,f3=e=>{for(const t in e){const n=e[t];(typeof n=="object"||typeof n=="function")&&f3(e[t])}return c7(e)},r0=(e,t,n=0)=>{try{for(;n<e.length;n++)e[n](...t)}finally{n<e.length&&r0(e,t,n+1)}},km=(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[ih]!=null)return e[ih](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)||!km(e.get(n),t.get(n)))return!1;break;case void 0:case Object:if(Cm(e)!==Cm(t))return!1;for(const n in e)if(!n0(e,n)||!km(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(!km(e[n],t[n]))return!1;break;default:return!1}return!0},u7=(e,t)=>t.includes(e),ah=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]",XZ=typeof navigator<"u"?/Mac/.test(navigator.platform):!1,da,d7=[],f7=()=>{if(da===void 0)if(ah){da=ua();const e=process.argv;let t=null;for(let n=0;n<e.length;n++){const r=e[n];r[0]==="-"?(t!==null&&da.set(t,""),t=r):t!==null?(da.set(t,r),t=null):d7.push(r)}t!==null&&da.set(t,"")}else typeof location=="object"?(da=ua(),(location.search||"?").slice(1).split("&").forEach(e=>{if(e.length!==0){const[t,n]=e.split("=");da.set(`--${n3(t,"-")}`,n),da.set(`-${n3(t,"-")}`,n)}})):da=ua();return da},o0=e=>f7().has(e),Sm=e=>c3(ah?process.env[e.toUpperCase().replaceAll("-","_")]:n7.getItem(e)),h3=e=>o0("--"+e)||Sm(e)!==null,h7=h3("production"),p7=ah&&u7(process.env.FORCE_COLOR,["true","1","2"]),m7=p7||!o0("--no-colors")&&!h3("no-color")&&(!ah||process.stdout.isTTY)&&(!ah||o0("--color")||Sm("COLORTERM")!==null||(Sm("TERM")||"").includes("color")),g7=class{constructor(e,t){this.left=e,this.right=t}},al=(e,t)=>new g7(e,t),p3=e=>e.next()>=.5,i0=(e,t,n)=>ol(e.next()*(n+1-t)+t),m3=(e,t,n)=>ol(e.next()*(n+1-t)+t),s0=(e,t,n)=>m3(e,t,n),v7=e=>t3(s0(e,97,122)),y7=(e,t=0,n=20)=>{const r=s0(e,t,n);let o="";for(let i=0;i<r;i++)o+=v7(e);return o},a0=(e,t)=>t[s0(e,0,t.length-1)],b7=Symbol("0schema"),w7=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(zR(" ",(this._rerrs.length-t)*2)+`${n.path!=null?`[${n.path}] `:""}${n.has} doesn't match ${n.expected}. ${n.message}`)}return e.join(`
|
|
4
|
+
\0`,Ee+=i(de,2),Ee+=P.magic,Ee+=i(k,2),Ee+=i(C,2),Ee+=i(Oe.crc32,4),Ee+=i(Oe.compressedSize,4),Ee+=i(Oe.uncompressedSize,4),Ee+=i($.length,2),Ee+=i(te.length,2),{fileRecord:h.LOCAL_FILE_HEADER+Ee+$+te,dirRecord:h.CENTRAL_FILE_HEADER+i(pe,2)+Ee+i(V.length,2)+"\0\0\0\0"+i(oe,4)+i(_,4)+$+te+V}}var a=n("../utils"),l=n("../stream/GenericWorker"),u=n("../utf8"),d=n("../crc32"),h=n("../signature");function p(v,g,y,_){l.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=g,this.zipPlatform=y,this.encodeFileName=_,this.streamFiles=v,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(v){var g=v.meta.percent||0,y=this.entriesCount,_=this._sources.length;this.accumulate?this.contentBuffer.push(v):(this.bytesWritten+=v.data.length,l.prototype.push.call(this,{data:v.data,meta:{currentFile:this.currentFile,percent:y?(g+100*(y-_-1))/y:100}}))},p.prototype.openedSource=function(v){this.currentSourceOffset=this.bytesWritten,this.currentFile=v.file.name;var g=this.streamFiles&&!v.file.dir;if(g){var y=s(v,g,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:y.fileRecord,meta:{percent:0}})}else this.accumulate=!0},p.prototype.closedSource=function(v){this.accumulate=!1;var g=this.streamFiles&&!v.file.dir,y=s(v,g,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(y.dirRecord),g)this.push({data:(function(_){return h.DATA_DESCRIPTOR+i(_.crc32,4)+i(_.compressedSize,4)+i(_.uncompressedSize,4)})(v),meta:{percent:100}});else for(this.push({data:y.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},p.prototype.flush=function(){for(var v=this.bytesWritten,g=0;g<this.dirRecords.length;g++)this.push({data:this.dirRecords[g],meta:{percent:100}});var y=this.bytesWritten-v,_=(function(w,I,k,C,R){var P=a.transformTo("string",R(C));return h.CENTRAL_DIRECTORY_END+"\0\0\0\0"+i(w,2)+i(w,2)+i(I,4)+i(k,4)+i(P.length,2)+P})(this.dirRecords.length,y,v,this.zipComment,this.encodeFileName);this.push({data:_,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(v){this._sources.push(v);var g=this;return v.on("data",function(y){g.processChunk(y)}),v.on("end",function(){g.closedSource(g.previous.streamInfo),g._sources.length?g.prepareNextSource():g.end()}),v.on("error",function(y){g.error(y)}),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(v){var g=this._sources;if(!l.prototype.error.call(this,v))return!1;for(var y=0;y<g.length;y++)try{g[y].error(v)}catch{}return!0},p.prototype.lock=function(){l.prototype.lock.call(this);for(var v=this._sources,g=0;g<v.length;g++)v[g].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),h=0;try{a.forEach(function(p,v){h++;var g=(function(I,k){var C=I||k,R=i[C];if(!R)throw new Error(C+" is not a valid compression method !");return R})(v.options.compression,l.compression),y=v.options.compressionOptions||l.compressionOptions||{},_=v.dir,w=v.date;v._compressWorker(g,y).withStreamInfo("file",{name:p,dir:_,date:w,comment:v.comment||"",unixPermissions:v.unixPermissions,dosPermissions:v.dosPermissions}).pipe(d)}),d.entriesCount=h}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 h(p){return new s.Promise(function(v,g){var y=p.decompressed.getContentWorker().pipe(new u);y.on("error",function(_){g(_)}).on("end",function(){y.streamInfo.crc32!==p.decompressed.crc32?g(new Error("Corrupted zip : CRC32 mismatch")):v()}).resume()})}r.exports=function(p,v){var g=this;return v=i.extend(v||{},{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,v.optimizedBinaryString,v.base64).then(function(y){var _=new l(v);return _.load(y),_}).then(function(y){var _=[s.Promise.resolve(y)],w=y.files;if(v.checkCRC32)for(var I=0;I<w.length;I++)_.push(h(w[I]));return s.Promise.all(_)}).then(function(y){for(var _=y.shift(),w=_.files,I=0;I<w.length;I++){var k=w[I],C=k.fileNameStr,R=i.resolve(k.fileNameStr);g.file(R,k.decompressed,{binary:!0,optimizedBinaryString:!0,date:k.date,dir:k.dir,comment:k.fileCommentStr.length?k.fileCommentStr:null,unixPermissions:k.unixPermissions,dosPermissions:k.dosPermissions,createFolders:v.createFolders}),k.dir||(g.file(R).unsafeOriginalName=C)}return _.zipComment.length&&(g.comment=_.zipComment),g})}},{"./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(h,p){d.push(h)||d._helper.pause(),u&&u(p)}).on("error",function(h){d.emit("error",h)}).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(C,R,P){var M,$=a.getTypeOf(R),F=a.extend(P||{},d);F.date=F.date||new Date,F.compression!==null&&(F.compression=F.compression.toUpperCase()),typeof F.unixPermissions=="string"&&(F.unixPermissions=parseInt(F.unixPermissions,8)),F.unixPermissions&&16384&F.unixPermissions&&(F.dir=!0),F.dosPermissions&&16&F.dosPermissions&&(F.dir=!0),F.dir&&(C=w(C)),F.createFolders&&(M=_(C))&&I.call(this,M,!0);var D=$==="string"&&F.binary===!1&&F.base64===!1;P&&P.binary!==void 0||(F.binary=!D),(R instanceof h&&R.uncompressedSize===0||F.dir||!R||R.length===0)&&(F.base64=!1,F.binary=!0,R="",F.compression="STORE",$="string");var V=null;V=R instanceof h||R instanceof l?R:g.isNode&&g.isStream(R)?new y(C,R):a.prepareContent(C,R,F.binary,F.optimizedBinaryString,F.base64);var x=new p(C,V,F);this.files[C]=x}var s=n("./utf8"),a=n("./utils"),l=n("./stream/GenericWorker"),u=n("./stream/StreamHelper"),d=n("./defaults"),h=n("./compressedObject"),p=n("./zipObject"),v=n("./generate"),g=n("./nodejsUtils"),y=n("./nodejs/NodejsStreamInputAdapter"),_=function(C){C.slice(-1)==="/"&&(C=C.substring(0,C.length-1));var R=C.lastIndexOf("/");return 0<R?C.substring(0,R):""},w=function(C){return C.slice(-1)!=="/"&&(C+="/"),C},I=function(C,R){return R=R!==void 0?R:d.createFolders,C=w(C),this.files[C]||i.call(this,C,null,{dir:!0,createFolders:R}),this.files[C]};function k(C){return Object.prototype.toString.call(C)==="[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(C){var R,P,M;for(R in this.files)M=this.files[R],(P=R.slice(this.root.length,R.length))&&R.slice(0,this.root.length)===this.root&&C(P,M)},filter:function(C){var R=[];return this.forEach(function(P,M){C(P,M)&&R.push(M)}),R},file:function(C,R,P){if(arguments.length!==1)return C=this.root+C,i.call(this,C,R,P),this;if(k(C)){var M=C;return this.filter(function(F,D){return!D.dir&&M.test(F)})}var $=this.files[this.root+C];return $&&!$.dir?$:null},folder:function(C){if(!C)return this;if(k(C))return this.filter(function($,F){return F.dir&&C.test($)});var R=this.root+C,P=I.call(this,R),M=this.clone();return M.root=P.name,M},remove:function(C){C=this.root+C;var R=this.files[C];if(R||(C.slice(-1)!=="/"&&(C+="/"),R=this.files[C]),R&&!R.dir)delete this.files[C];else for(var P=this.filter(function($,F){return F.name.slice(0,C.length)===C}),M=0;M<P.length;M++)delete this.files[P[M].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(C){var R,P={};try{if((P=a.extend(C||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:s.utf8encode})).type=P.type.toLowerCase(),P.compression=P.compression.toUpperCase(),P.type==="binarystring"&&(P.type="string"),!P.type)throw new Error("No output type specified.");a.checkSupport(P.type),P.platform!=="darwin"&&P.platform!=="freebsd"&&P.platform!=="linux"&&P.platform!=="sunos"||(P.platform="UNIX"),P.platform==="win32"&&(P.platform="DOS");var M=P.comment||this.comment||"";R=v.generateWorker(this,P,M)}catch($){(R=new l("error")).error($)}return new u(R,P.type||"string",P.mimeType)},generateAsync:function(C,R){return this.generateInternalStream(C).accumulate(R)},generateNodeStream:function(C,R){return(C=C||{}).type||(C.type="nodebuffer"),this.generateInternalStream(C).toNodejsStream(R)}}},{"./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),h=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]===h)return p-this.zero;return-1},s.prototype.readAndCheckSignature=function(a){var l=a.charCodeAt(0),u=a.charCodeAt(1),d=a.charCodeAt(2),h=a.charCodeAt(3),p=this.readData(4);return l===p[0]&&u===p[1]&&d===p[2]&&h===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(h){var p=i.getTypeOf(h);return i.checkSupport(p),p!=="string"||s.uint8array?p==="nodebuffer"?new u(h):s.uint8array?new d(i.transformTo("uint8array",h)):new a(i.transformTo("array",h)):new l(h)}},{"../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"),h=null;if(u.nodestream)try{h=n("../nodejs/NodejsStreamOutputAdapter")}catch{}function p(g,y){return new d.Promise(function(_,w){var I=[],k=g._internalType,C=g._outputType,R=g._mimeType;g.on("data",function(P,M){I.push(P),y&&y(M)}).on("error",function(P){I=[],w(P)}).on("end",function(){try{_((function(P,M,$){switch(P){case"blob":return i.newBlob(i.transformTo("arraybuffer",M),$);case"base64":return l.encode(M);default:return i.transformTo(P,M)}})(C,(function(P,M){var $,F=0,D=null,V=0;for($=0;$<M.length;$++)V+=M[$].length;switch(P){case"string":return M.join("");case"array":return Array.prototype.concat.apply([],M);case"uint8array":for(D=new Uint8Array(V),$=0;$<M.length;$++)D.set(M[$],F),F+=M[$].length;return D;case"nodebuffer":return Buffer.concat(M);default:throw new Error("concat : unsupported type '"+P+"'")}})(k,I),R))}catch(P){w(P)}I=[]}).resume()})}function v(g,y,_){var w=y;switch(y){case"blob":case"arraybuffer":w="uint8array";break;case"base64":w="string"}try{this._internalType=w,this._outputType=y,this._mimeType=_,i.checkSupport(w),this._worker=g.pipe(new s(w)),g.lock()}catch(I){this._worker=new a("error"),this._worker.error(I)}}v.prototype={accumulate:function(g){return p(this,g)},on:function(g,y){var _=this;return g==="data"?this._worker.on(g,function(w){y.call(_,w.data,w.meta)}):this._worker.on(g,function(){i.delay(y,arguments,_)}),this},resume:function(){return i.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(g){if(i.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new h(this,{objectMode:this._outputType!=="nodebuffer"},g)}},r.exports=v},{"../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 h(){l.call(this,"utf-8 decode"),this.leftOver=null}function p(){l.call(this,"utf-8 encode")}o.utf8encode=function(v){return s.nodebuffer?a.newBufferFrom(v,"utf-8"):(function(g){var y,_,w,I,k,C=g.length,R=0;for(I=0;I<C;I++)(64512&(_=g.charCodeAt(I)))==55296&&I+1<C&&(64512&(w=g.charCodeAt(I+1)))==56320&&(_=65536+(_-55296<<10)+(w-56320),I++),R+=_<128?1:_<2048?2:_<65536?3:4;for(y=s.uint8array?new Uint8Array(R):new Array(R),I=k=0;k<R;I++)(64512&(_=g.charCodeAt(I)))==55296&&I+1<C&&(64512&(w=g.charCodeAt(I+1)))==56320&&(_=65536+(_-55296<<10)+(w-56320),I++),_<128?y[k++]=_:(_<2048?y[k++]=192|_>>>6:(_<65536?y[k++]=224|_>>>12:(y[k++]=240|_>>>18,y[k++]=128|_>>>12&63),y[k++]=128|_>>>6&63),y[k++]=128|63&_);return y})(v)},o.utf8decode=function(v){return s.nodebuffer?i.transformTo("nodebuffer",v).toString("utf-8"):(function(g){var y,_,w,I,k=g.length,C=new Array(2*k);for(y=_=0;y<k;)if((w=g[y++])<128)C[_++]=w;else if(4<(I=u[w]))C[_++]=65533,y+=I-1;else{for(w&=I===2?31:I===3?15:7;1<I&&y<k;)w=w<<6|63&g[y++],I--;1<I?C[_++]=65533:w<65536?C[_++]=w:(w-=65536,C[_++]=55296|w>>10&1023,C[_++]=56320|1023&w)}return C.length!==_&&(C.subarray?C=C.subarray(0,_):C.length=_),i.applyFromCharCode(C)})(v=i.transformTo(s.uint8array?"uint8array":"array",v))},i.inherits(h,l),h.prototype.processChunk=function(v){var g=i.transformTo(s.uint8array?"uint8array":"array",v.data);if(this.leftOver&&this.leftOver.length){if(s.uint8array){var y=g;(g=new Uint8Array(y.length+this.leftOver.length)).set(this.leftOver,0),g.set(y,this.leftOver.length)}else g=this.leftOver.concat(g);this.leftOver=null}var _=(function(I,k){var C;for((k=k||I.length)>I.length&&(k=I.length),C=k-1;0<=C&&(192&I[C])==128;)C--;return C<0||C===0?k:C+u[I[C]]>k?C:k})(g),w=g;_!==g.length&&(s.uint8array?(w=g.subarray(0,_),this.leftOver=g.subarray(_,g.length)):(w=g.slice(0,_),this.leftOver=g.slice(_,g.length))),this.push({data:o.utf8decode(w),meta:v.meta})},h.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:o.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},o.Utf8DecodeWorker=h,i.inherits(p,l),p.prototype.processChunk=function(v){this.push({data:o.utf8encode(v.data),meta:v.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(y){return y}function d(y,_){for(var w=0;w<y.length;++w)_[w]=255&y.charCodeAt(w);return _}n("setimmediate"),o.newBlob=function(y,_){o.checkSupport("blob");try{return new Blob([y],{type:_})}catch{try{var w=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return w.append(y),w.getBlob(_)}catch{throw new Error("Bug : can't construct the Blob.")}}};var h={stringifyByChunk:function(y,_,w){var I=[],k=0,C=y.length;if(C<=w)return String.fromCharCode.apply(null,y);for(;k<C;)_==="array"||_==="nodebuffer"?I.push(String.fromCharCode.apply(null,y.slice(k,Math.min(k+w,C)))):I.push(String.fromCharCode.apply(null,y.subarray(k,Math.min(k+w,C)))),k+=w;return I.join("")},stringifyByChar:function(y){for(var _="",w=0;w<y.length;w++)_+=String.fromCharCode(y[w]);return _},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(y){var _=65536,w=o.getTypeOf(y),I=!0;if(w==="uint8array"?I=h.applyCanBeUsed.uint8array:w==="nodebuffer"&&(I=h.applyCanBeUsed.nodebuffer),I)for(;1<_;)try{return h.stringifyByChunk(y,w,_)}catch{_=Math.floor(_/2)}return h.stringifyByChar(y)}function v(y,_){for(var w=0;w<y.length;w++)_[w]=y[w];return _}o.applyFromCharCode=p;var g={};g.string={string:u,array:function(y){return d(y,new Array(y.length))},arraybuffer:function(y){return g.string.uint8array(y).buffer},uint8array:function(y){return d(y,new Uint8Array(y.length))},nodebuffer:function(y){return d(y,a.allocBuffer(y.length))}},g.array={string:p,array:u,arraybuffer:function(y){return new Uint8Array(y).buffer},uint8array:function(y){return new Uint8Array(y)},nodebuffer:function(y){return a.newBufferFrom(y)}},g.arraybuffer={string:function(y){return p(new Uint8Array(y))},array:function(y){return v(new Uint8Array(y),new Array(y.byteLength))},arraybuffer:u,uint8array:function(y){return new Uint8Array(y)},nodebuffer:function(y){return a.newBufferFrom(new Uint8Array(y))}},g.uint8array={string:p,array:function(y){return v(y,new Array(y.length))},arraybuffer:function(y){return y.buffer},uint8array:u,nodebuffer:function(y){return a.newBufferFrom(y)}},g.nodebuffer={string:p,array:function(y){return v(y,new Array(y.length))},arraybuffer:function(y){return g.nodebuffer.uint8array(y).buffer},uint8array:function(y){return v(y,new Uint8Array(y.length))},nodebuffer:u},o.transformTo=function(y,_){return _=_||"",y?(o.checkSupport(y),g[o.getTypeOf(_)][y](_)):_},o.resolve=function(y){for(var _=y.split("/"),w=[],I=0;I<_.length;I++){var k=_[I];k==="."||k===""&&I!==0&&I!==_.length-1||(k===".."?w.pop():w.push(k))}return w.join("/")},o.getTypeOf=function(y){return typeof y=="string"?"string":Object.prototype.toString.call(y)==="[object Array]"?"array":i.nodebuffer&&a.isBuffer(y)?"nodebuffer":i.uint8array&&y instanceof Uint8Array?"uint8array":i.arraybuffer&&y instanceof ArrayBuffer?"arraybuffer":void 0},o.checkSupport=function(y){if(!i[y.toLowerCase()])throw new Error(y+" is not supported by this platform")},o.MAX_VALUE_16BITS=65535,o.MAX_VALUE_32BITS=-1,o.pretty=function(y){var _,w,I="";for(w=0;w<(y||"").length;w++)I+="\\x"+((_=y.charCodeAt(w))<16?"0":"")+_.toString(16).toUpperCase();return I},o.delay=function(y,_,w){setImmediate(function(){y.apply(w||null,_||[])})},o.inherits=function(y,_){function w(){}w.prototype=_.prototype,y.prototype=new w},o.extend=function(){var y,_,w={};for(y=0;y<arguments.length;y++)for(_ in arguments[y])Object.prototype.hasOwnProperty.call(arguments[y],_)&&w[_]===void 0&&(w[_]=arguments[y][_]);return w},o.prepareContent=function(y,_,w,I,k){return l.Promise.resolve(_).then(function(C){return i.blob&&(C instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(C))!==-1)&&typeof FileReader<"u"?new l.Promise(function(R,P){var M=new FileReader;M.onload=function($){R($.target.result)},M.onerror=function($){P($.target.error)},M.readAsArrayBuffer(C)}):C}).then(function(C){var R=o.getTypeOf(C);return R?(R==="arraybuffer"?C=o.transformTo("uint8array",C):R==="string"&&(k?C=s.decode(C):w&&I!==!0&&(C=(function(P){return d(P,i.uint8array?new Uint8Array(P.length):new Array(P.length))})(C))),C):l.Promise.reject(new Error("Can't read the data of '"+y+"'. 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(h){this.files=[],this.loadOptions=h}d.prototype={checkSignature:function(h){if(!this.reader.readAndCheckSignature(h)){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(h)+")")}},isSignature:function(h,p){var v=this.reader.index;this.reader.setIndex(h);var g=this.reader.readString(4)===p;return this.reader.setIndex(v),g},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 h=this.reader.readData(this.zipCommentLength),p=u.uint8array?"uint8array":"array",v=s.transformTo(p,h);this.zipComment=this.loadOptions.decodeFileName(v)},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 h,p,v,g=this.zip64EndOfCentralSize-44;0<g;)h=this.reader.readInt(2),p=this.reader.readInt(4),v=this.reader.readData(p),this.zip64ExtensibleData[h]={id:h,length:p,value:v}},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 h,p;for(h=0;h<this.files.length;h++)p=this.files[h],this.reader.setIndex(p.localHeaderOffset),this.checkSignature(a.LOCAL_FILE_HEADER),p.readLocalPart(this.reader),p.handleUTF8(),p.processAttributes()},readCentralDir:function(){var h;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(a.CENTRAL_FILE_HEADER);)(h=new l({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(h);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 h=this.reader.lastIndexOfSignature(a.CENTRAL_DIRECTORY_END);if(h<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(h);var p=h;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,(h=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(h),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 v=this.centralDirOffset+this.centralDirSize;this.zip64&&(v+=20,v+=12+this.zip64EndOfCentralSize);var g=p-v;if(0<g)this.isSignature(p,a.CENTRAL_FILE_HEADER)||(this.reader.zero=g);else if(g<0)throw new Error("Corrupted zip: missing "+Math.abs(g)+" bytes.")},prepareReader:function(h){this.reader=i(h)},load:function(h){this.prepareReader(h),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"),h=n("./support");function p(v,g){this.options=v,this.loadOptions=g}p.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(v){var g,y;if(v.skip(22),this.fileNameLength=v.readInt(2),y=v.readInt(2),this.fileName=v.readData(this.fileNameLength),v.skip(y),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((g=(function(_){for(var w in d)if(Object.prototype.hasOwnProperty.call(d,w)&&d[w].magic===_)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,g,v.readData(this.compressedSize))},readCentralPart:function(v){this.versionMadeBy=v.readInt(2),v.skip(2),this.bitFlag=v.readInt(2),this.compressionMethod=v.readString(2),this.date=v.readDate(),this.crc32=v.readInt(4),this.compressedSize=v.readInt(4),this.uncompressedSize=v.readInt(4);var g=v.readInt(2);if(this.extraFieldsLength=v.readInt(2),this.fileCommentLength=v.readInt(2),this.diskNumberStart=v.readInt(2),this.internalFileAttributes=v.readInt(2),this.externalFileAttributes=v.readInt(4),this.localHeaderOffset=v.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");v.skip(g),this.readExtraFields(v),this.parseZIP64ExtraField(v),this.fileComment=v.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var v=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),v==0&&(this.dosPermissions=63&this.externalFileAttributes),v==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var v=i(this.extraFields[1].value);this.uncompressedSize===s.MAX_VALUE_32BITS&&(this.uncompressedSize=v.readInt(8)),this.compressedSize===s.MAX_VALUE_32BITS&&(this.compressedSize=v.readInt(8)),this.localHeaderOffset===s.MAX_VALUE_32BITS&&(this.localHeaderOffset=v.readInt(8)),this.diskNumberStart===s.MAX_VALUE_32BITS&&(this.diskNumberStart=v.readInt(4))}},readExtraFields:function(v){var g,y,_,w=v.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});v.index+4<w;)g=v.readInt(2),y=v.readInt(2),_=v.readData(y),this.extraFields[g]={id:g,length:y,value:_};v.setIndex(w)},handleUTF8:function(){var v=h.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=u.utf8decode(this.fileName),this.fileCommentStr=u.utf8decode(this.fileComment);else{var g=this.findExtraFieldUnicodePath();if(g!==null)this.fileNameStr=g;else{var y=s.transformTo(v,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(y)}var _=this.findExtraFieldUnicodeComment();if(_!==null)this.fileCommentStr=_;else{var w=s.transformTo(v,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(w)}}},findExtraFieldUnicodePath:function(){var v=this.extraFields[28789];if(v){var g=i(v.value);return g.readInt(1)!==1||l(this.fileName)!==g.readInt(4)?null:u.utf8decode(g.readData(v.length-5))}return null},findExtraFieldUnicodeComment:function(){var v=this.extraFields[25461];if(v){var g=i(v.value);return g.readInt(1)!==1||l(this.fileComment)!==g.readInt(4)?null:u.utf8decode(g.readData(v.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(g,y,_){this.name=g,this.dir=_.dir,this.date=_.date,this.comment=_.comment,this.unixPermissions=_.unixPermissions,this.dosPermissions=_.dosPermissions,this._data=y,this._dataBinary=_.binary,this.options={compression:_.compression,compressionOptions:_.compressionOptions}}var s=n("./stream/StreamHelper"),a=n("./stream/DataWorker"),l=n("./utf8"),u=n("./compressedObject"),d=n("./stream/GenericWorker");i.prototype={internalStream:function(g){var y=null,_="string";try{if(!g)throw new Error("No output type specified.");var w=(_=g.toLowerCase())==="string"||_==="text";_!=="binarystring"&&_!=="text"||(_="string"),y=this._decompressWorker();var I=!this._dataBinary;I&&!w&&(y=y.pipe(new l.Utf8EncodeWorker)),!I&&w&&(y=y.pipe(new l.Utf8DecodeWorker))}catch(k){(y=new d("error")).error(k)}return new s(y,_,"")},async:function(g,y){return this.internalStream(g).accumulate(y)},nodeStream:function(g,y){return this.internalStream(g||"nodebuffer").toNodejsStream(y)},_compressWorker:function(g,y){if(this._data instanceof u&&this._data.compression.magic===g.magic)return this._data.getCompressedWorker();var _=this._decompressWorker();return this._dataBinary||(_=_.pipe(new l.Utf8EncodeWorker)),u.createWorkerFrom(_,g,y)},_decompressWorker:function(){return this._data instanceof u?this._data.getContentWorker():this._data instanceof d?this._data:new a(this._data)}};for(var h=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],p=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},v=0;v<h.length;v++)i.prototype[h[v]]=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(g),h=i.document.createTextNode("");d.observe(h,{characterData:!0}),s=function(){h.data=u=++u%2}}else if(i.setImmediate||i.MessageChannel===void 0)s="document"in i&&"onreadystatechange"in i.document.createElement("script")?function(){var y=i.document.createElement("script");y.onreadystatechange=function(){g(),y.onreadystatechange=null,y.parentNode.removeChild(y),y=null},i.document.documentElement.appendChild(y)}:function(){setTimeout(g,0)};else{var p=new i.MessageChannel;p.port1.onmessage=g,s=function(){p.port2.postMessage(0)}}var v=[];function g(){var y,_;a=!0;for(var w=v.length;w;){for(_=v,v=[],y=-1;++y<w;)_[y]();w=v.length}a=!1}r.exports=function(y){v.push(y)!==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 h(w){if(typeof w!="function")throw new TypeError("resolver must be a function");this.state=d,this.queue=[],this.outcome=void 0,w!==s&&y(this,w)}function p(w,I,k){this.promise=w,typeof I=="function"&&(this.onFulfilled=I,this.callFulfilled=this.otherCallFulfilled),typeof k=="function"&&(this.onRejected=k,this.callRejected=this.otherCallRejected)}function v(w,I,k){i(function(){var C;try{C=I(k)}catch(R){return a.reject(w,R)}C===w?a.reject(w,new TypeError("Cannot resolve promise with itself")):a.resolve(w,C)})}function g(w){var I=w&&w.then;if(w&&(typeof w=="object"||typeof w=="function")&&typeof I=="function")return function(){I.apply(w,arguments)}}function y(w,I){var k=!1;function C(M){k||(k=!0,a.reject(w,M))}function R(M){k||(k=!0,a.resolve(w,M))}var P=_(function(){I(R,C)});P.status==="error"&&C(P.value)}function _(w,I){var k={};try{k.value=w(I),k.status="success"}catch(C){k.status="error",k.value=C}return k}(r.exports=h).prototype.finally=function(w){if(typeof w!="function")return this;var I=this.constructor;return this.then(function(k){return I.resolve(w()).then(function(){return k})},function(k){return I.resolve(w()).then(function(){throw k})})},h.prototype.catch=function(w){return this.then(null,w)},h.prototype.then=function(w,I){if(typeof w!="function"&&this.state===u||typeof I!="function"&&this.state===l)return this;var k=new this.constructor(s);return this.state!==d?v(k,this.state===u?w:I,this.outcome):this.queue.push(new p(k,w,I)),k},p.prototype.callFulfilled=function(w){a.resolve(this.promise,w)},p.prototype.otherCallFulfilled=function(w){v(this.promise,this.onFulfilled,w)},p.prototype.callRejected=function(w){a.reject(this.promise,w)},p.prototype.otherCallRejected=function(w){v(this.promise,this.onRejected,w)},a.resolve=function(w,I){var k=_(g,I);if(k.status==="error")return a.reject(w,k.value);var C=k.value;if(C)y(w,C);else{w.state=u,w.outcome=I;for(var R=-1,P=w.queue.length;++R<P;)w.queue[R].callFulfilled(I)}return w},a.reject=function(w,I){w.state=l,w.outcome=I;for(var k=-1,C=w.queue.length;++k<C;)w.queue[k].callRejected(I);return w},h.resolve=function(w){return w instanceof this?w:a.resolve(new this(s),w)},h.reject=function(w){var I=new this(s);return a.reject(I,w)},h.all=function(w){var I=this;if(Object.prototype.toString.call(w)!=="[object Array]")return this.reject(new TypeError("must be an array"));var k=w.length,C=!1;if(!k)return this.resolve([]);for(var R=new Array(k),P=0,M=-1,$=new this(s);++M<k;)F(w[M],M);return $;function F(D,V){I.resolve(D).then(function(x){R[V]=x,++P!==k||C||(C=!0,a.resolve($,R))},function(x){C||(C=!0,a.reject($,x))})}},h.race=function(w){var I=this;if(Object.prototype.toString.call(w)!=="[object Array]")return this.reject(new TypeError("must be an array"));var k=w.length,C=!1;if(!k)return this.resolve([]);for(var R=-1,P=new this(s);++R<k;)M=w[R],I.resolve(M).then(function($){C||(C=!0,a.resolve(P,$))},function($){C||(C=!0,a.reject(P,$))});var M;return P}},{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,h=0,p=-1,v=0,g=8;function y(w){if(!(this instanceof y))return new y(w);this.options=s.assign({level:p,method:g,chunkSize:16384,windowBits:15,memLevel:8,strategy:v,to:""},w||{});var I=this.options;I.raw&&0<I.windowBits?I.windowBits=-I.windowBits:I.gzip&&0<I.windowBits&&I.windowBits<16&&(I.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new u,this.strm.avail_out=0;var k=i.deflateInit2(this.strm,I.level,I.method,I.windowBits,I.memLevel,I.strategy);if(k!==h)throw new Error(l[k]);if(I.header&&i.deflateSetHeader(this.strm,I.header),I.dictionary){var C;if(C=typeof I.dictionary=="string"?a.string2buf(I.dictionary):d.call(I.dictionary)==="[object ArrayBuffer]"?new Uint8Array(I.dictionary):I.dictionary,(k=i.deflateSetDictionary(this.strm,C))!==h)throw new Error(l[k]);this._dict_set=!0}}function _(w,I){var k=new y(I);if(k.push(w,!0),k.err)throw k.msg||l[k.err];return k.result}y.prototype.push=function(w,I){var k,C,R=this.strm,P=this.options.chunkSize;if(this.ended)return!1;C=I===~~I?I:I===!0?4:0,typeof w=="string"?R.input=a.string2buf(w):d.call(w)==="[object ArrayBuffer]"?R.input=new Uint8Array(w):R.input=w,R.next_in=0,R.avail_in=R.input.length;do{if(R.avail_out===0&&(R.output=new s.Buf8(P),R.next_out=0,R.avail_out=P),(k=i.deflate(R,C))!==1&&k!==h)return this.onEnd(k),!(this.ended=!0);R.avail_out!==0&&(R.avail_in!==0||C!==4&&C!==2)||(this.options.to==="string"?this.onData(a.buf2binstring(s.shrinkBuf(R.output,R.next_out))):this.onData(s.shrinkBuf(R.output,R.next_out)))}while((0<R.avail_in||R.avail_out===0)&&k!==1);return C===4?(k=i.deflateEnd(this.strm),this.onEnd(k),this.ended=!0,k===h):C!==2||(this.onEnd(h),!(R.avail_out=0))},y.prototype.onData=function(w){this.chunks.push(w)},y.prototype.onEnd=function(w){w===h&&(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=y,o.deflate=_,o.deflateRaw=function(w,I){return(I=I||{}).raw=!0,_(w,I)},o.gzip=function(w,I){return(I=I||{}).gzip=!0,_(w,I)}},{"./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"),h=n("./zlib/gzheader"),p=Object.prototype.toString;function v(y){if(!(this instanceof v))return new v(y);this.options=s.assign({chunkSize:16384,windowBits:0,to:""},y||{});var _=this.options;_.raw&&0<=_.windowBits&&_.windowBits<16&&(_.windowBits=-_.windowBits,_.windowBits===0&&(_.windowBits=-15)),!(0<=_.windowBits&&_.windowBits<16)||y&&y.windowBits||(_.windowBits+=32),15<_.windowBits&&_.windowBits<48&&(15&_.windowBits)==0&&(_.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,_.windowBits);if(w!==l.Z_OK)throw new Error(u[w]);this.header=new h,i.inflateGetHeader(this.strm,this.header)}function g(y,_){var w=new v(_);if(w.push(y,!0),w.err)throw w.msg||u[w.err];return w.result}v.prototype.push=function(y,_){var w,I,k,C,R,P,M=this.strm,$=this.options.chunkSize,F=this.options.dictionary,D=!1;if(this.ended)return!1;I=_===~~_?_:_===!0?l.Z_FINISH:l.Z_NO_FLUSH,typeof y=="string"?M.input=a.binstring2buf(y):p.call(y)==="[object ArrayBuffer]"?M.input=new Uint8Array(y):M.input=y,M.next_in=0,M.avail_in=M.input.length;do{if(M.avail_out===0&&(M.output=new s.Buf8($),M.next_out=0,M.avail_out=$),(w=i.inflate(M,l.Z_NO_FLUSH))===l.Z_NEED_DICT&&F&&(P=typeof F=="string"?a.string2buf(F):p.call(F)==="[object ArrayBuffer]"?new Uint8Array(F):F,w=i.inflateSetDictionary(this.strm,P)),w===l.Z_BUF_ERROR&&D===!0&&(w=l.Z_OK,D=!1),w!==l.Z_STREAM_END&&w!==l.Z_OK)return this.onEnd(w),!(this.ended=!0);M.next_out&&(M.avail_out!==0&&w!==l.Z_STREAM_END&&(M.avail_in!==0||I!==l.Z_FINISH&&I!==l.Z_SYNC_FLUSH)||(this.options.to==="string"?(k=a.utf8border(M.output,M.next_out),C=M.next_out-k,R=a.buf2string(M.output,k),M.next_out=C,M.avail_out=$-C,C&&s.arraySet(M.output,M.output,k,C,0),this.onData(R)):this.onData(s.shrinkBuf(M.output,M.next_out)))),M.avail_in===0&&M.avail_out===0&&(D=!0)}while((0<M.avail_in||M.avail_out===0)&&w!==l.Z_STREAM_END);return w===l.Z_STREAM_END&&(I=l.Z_FINISH),I===l.Z_FINISH?(w=i.inflateEnd(this.strm),this.onEnd(w),this.ended=!0,w===l.Z_OK):I!==l.Z_SYNC_FLUSH||(this.onEnd(l.Z_OK),!(M.avail_out=0))},v.prototype.onData=function(y){this.chunks.push(y)},v.prototype.onEnd=function(y){y===l.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=s.flattenChunks(this.chunks)),this.chunks=[],this.err=y,this.msg=this.strm.msg},o.Inflate=v,o.inflate=g,o.inflateRaw=function(y,_){return(_=_||{}).raw=!0,g(y,_)},o.ungzip=g},{"./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 h in d)d.hasOwnProperty(h)&&(l[h]=d[h])}}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,h,p){if(u.subarray&&l.subarray)l.set(u.subarray(d,d+h),p);else for(var v=0;v<h;v++)l[p+v]=u[d+v]},flattenChunks:function(l){var u,d,h,p,v,g;for(u=h=0,d=l.length;u<d;u++)h+=l[u].length;for(g=new Uint8Array(h),u=p=0,d=l.length;u<d;u++)v=l[u],g.set(v,p),p+=v.length;return g}},a={arraySet:function(l,u,d,h,p){for(var v=0;v<h;v++)l[p+v]=u[d+v]},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(h,p){if(p<65537&&(h.subarray&&a||!h.subarray&&s))return String.fromCharCode.apply(null,i.shrinkBuf(h,p));for(var v="",g=0;g<p;g++)v+=String.fromCharCode(h[g]);return v}l[254]=l[254]=1,o.string2buf=function(h){var p,v,g,y,_,w=h.length,I=0;for(y=0;y<w;y++)(64512&(v=h.charCodeAt(y)))==55296&&y+1<w&&(64512&(g=h.charCodeAt(y+1)))==56320&&(v=65536+(v-55296<<10)+(g-56320),y++),I+=v<128?1:v<2048?2:v<65536?3:4;for(p=new i.Buf8(I),y=_=0;_<I;y++)(64512&(v=h.charCodeAt(y)))==55296&&y+1<w&&(64512&(g=h.charCodeAt(y+1)))==56320&&(v=65536+(v-55296<<10)+(g-56320),y++),v<128?p[_++]=v:(v<2048?p[_++]=192|v>>>6:(v<65536?p[_++]=224|v>>>12:(p[_++]=240|v>>>18,p[_++]=128|v>>>12&63),p[_++]=128|v>>>6&63),p[_++]=128|63&v);return p},o.buf2binstring=function(h){return d(h,h.length)},o.binstring2buf=function(h){for(var p=new i.Buf8(h.length),v=0,g=p.length;v<g;v++)p[v]=h.charCodeAt(v);return p},o.buf2string=function(h,p){var v,g,y,_,w=p||h.length,I=new Array(2*w);for(v=g=0;v<w;)if((y=h[v++])<128)I[g++]=y;else if(4<(_=l[y]))I[g++]=65533,v+=_-1;else{for(y&=_===2?31:_===3?15:7;1<_&&v<w;)y=y<<6|63&h[v++],_--;1<_?I[g++]=65533:y<65536?I[g++]=y:(y-=65536,I[g++]=55296|y>>10&1023,I[g++]=56320|1023&y)}return d(I,g)},o.utf8border=function(h,p){var v;for((p=p||h.length)>h.length&&(p=h.length),v=p-1;0<=v&&(192&h[v])==128;)v--;return v<0||v===0?p:v+l[h[v]]>p?v: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,h=0;a!==0;){for(a-=h=2e3<a?2e3:a;d=d+(u=u+s[l++]|0)|0,--h;);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,h=u+l;s^=-1;for(var p=u;p<h;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"),h=0,p=4,v=0,g=-2,y=-1,_=4,w=2,I=8,k=9,C=286,R=30,P=19,M=2*C+1,$=15,F=3,D=258,V=D+F+1,x=42,B=113,T=1,te=2,U=3,W=4;function Y(A,ee){return A.msg=d[ee],ee}function J(A){return(A<<1)-(4<A?9:0)}function Oe(A){for(var ee=A.length;0<=--ee;)A[ee]=0}function de(A){var ee=A.state,ue=ee.pending;ue>A.avail_out&&(ue=A.avail_out),ue!==0&&(s.arraySet(A.output,ee.pending_buf,ee.pending_out,ue,A.next_out),A.next_out+=ue,ee.pending_out+=ue,A.total_out+=ue,A.avail_out-=ue,ee.pending-=ue,ee.pending===0&&(ee.pending_out=0))}function oe(A,ee){a._tr_flush_block(A,0<=A.block_start?A.block_start:-1,A.strstart-A.block_start,ee),A.block_start=A.strstart,de(A.strm)}function pe(A,ee){A.pending_buf[A.pending++]=ee}function Ee(A,ee){A.pending_buf[A.pending++]=ee>>>8&255,A.pending_buf[A.pending++]=255&ee}function Ve(A,ee){var ue,Z,G=A.max_chain_length,K=A.strstart,re=A.prev_length,ge=A.nice_match,X=A.strstart>A.w_size-V?A.strstart-(A.w_size-V):0,ce=A.window,Ae=A.w_mask,ke=A.prev,De=A.strstart+D,ft=ce[K+re-1],xe=ce[K+re];A.prev_length>=A.good_match&&(G>>=2),ge>A.lookahead&&(ge=A.lookahead);do if(ce[(ue=ee)+re]===xe&&ce[ue+re-1]===ft&&ce[ue]===ce[K]&&ce[++ue]===ce[K+1]){K+=2,ue++;do;while(ce[++K]===ce[++ue]&&ce[++K]===ce[++ue]&&ce[++K]===ce[++ue]&&ce[++K]===ce[++ue]&&ce[++K]===ce[++ue]&&ce[++K]===ce[++ue]&&ce[++K]===ce[++ue]&&ce[++K]===ce[++ue]&&K<De);if(Z=D-(De-K),K=De-D,re<Z){if(A.match_start=ee,ge<=(re=Z))break;ft=ce[K+re-1],xe=ce[K+re]}}while((ee=ke[ee&Ae])>X&&--G!=0);return re<=A.lookahead?re:A.lookahead}function rt(A){var ee,ue,Z,G,K,re,ge,X,ce,Ae,ke=A.w_size;do{if(G=A.window_size-A.lookahead-A.strstart,A.strstart>=ke+(ke-V)){for(s.arraySet(A.window,A.window,ke,ke,0),A.match_start-=ke,A.strstart-=ke,A.block_start-=ke,ee=ue=A.hash_size;Z=A.head[--ee],A.head[ee]=ke<=Z?Z-ke:0,--ue;);for(ee=ue=ke;Z=A.prev[--ee],A.prev[ee]=ke<=Z?Z-ke:0,--ue;);G+=ke}if(A.strm.avail_in===0)break;if(re=A.strm,ge=A.window,X=A.strstart+A.lookahead,ce=G,Ae=void 0,Ae=re.avail_in,ce<Ae&&(Ae=ce),ue=Ae===0?0:(re.avail_in-=Ae,s.arraySet(ge,re.input,re.next_in,Ae,X),re.state.wrap===1?re.adler=l(re.adler,ge,Ae,X):re.state.wrap===2&&(re.adler=u(re.adler,ge,Ae,X)),re.next_in+=Ae,re.total_in+=Ae,Ae),A.lookahead+=ue,A.lookahead+A.insert>=F)for(K=A.strstart-A.insert,A.ins_h=A.window[K],A.ins_h=(A.ins_h<<A.hash_shift^A.window[K+1])&A.hash_mask;A.insert&&(A.ins_h=(A.ins_h<<A.hash_shift^A.window[K+F-1])&A.hash_mask,A.prev[K&A.w_mask]=A.head[A.ins_h],A.head[A.ins_h]=K,K++,A.insert--,!(A.lookahead+A.insert<F)););}while(A.lookahead<V&&A.strm.avail_in!==0)}function ut(A,ee){for(var ue,Z;;){if(A.lookahead<V){if(rt(A),A.lookahead<V&&ee===h)return T;if(A.lookahead===0)break}if(ue=0,A.lookahead>=F&&(A.ins_h=(A.ins_h<<A.hash_shift^A.window[A.strstart+F-1])&A.hash_mask,ue=A.prev[A.strstart&A.w_mask]=A.head[A.ins_h],A.head[A.ins_h]=A.strstart),ue!==0&&A.strstart-ue<=A.w_size-V&&(A.match_length=Ve(A,ue)),A.match_length>=F)if(Z=a._tr_tally(A,A.strstart-A.match_start,A.match_length-F),A.lookahead-=A.match_length,A.match_length<=A.max_lazy_match&&A.lookahead>=F){for(A.match_length--;A.strstart++,A.ins_h=(A.ins_h<<A.hash_shift^A.window[A.strstart+F-1])&A.hash_mask,ue=A.prev[A.strstart&A.w_mask]=A.head[A.ins_h],A.head[A.ins_h]=A.strstart,--A.match_length!=0;);A.strstart++}else A.strstart+=A.match_length,A.match_length=0,A.ins_h=A.window[A.strstart],A.ins_h=(A.ins_h<<A.hash_shift^A.window[A.strstart+1])&A.hash_mask;else Z=a._tr_tally(A,0,A.window[A.strstart]),A.lookahead--,A.strstart++;if(Z&&(oe(A,!1),A.strm.avail_out===0))return T}return A.insert=A.strstart<F-1?A.strstart:F-1,ee===p?(oe(A,!0),A.strm.avail_out===0?U:W):A.last_lit&&(oe(A,!1),A.strm.avail_out===0)?T:te}function ht(A,ee){for(var ue,Z,G;;){if(A.lookahead<V){if(rt(A),A.lookahead<V&&ee===h)return T;if(A.lookahead===0)break}if(ue=0,A.lookahead>=F&&(A.ins_h=(A.ins_h<<A.hash_shift^A.window[A.strstart+F-1])&A.hash_mask,ue=A.prev[A.strstart&A.w_mask]=A.head[A.ins_h],A.head[A.ins_h]=A.strstart),A.prev_length=A.match_length,A.prev_match=A.match_start,A.match_length=F-1,ue!==0&&A.prev_length<A.max_lazy_match&&A.strstart-ue<=A.w_size-V&&(A.match_length=Ve(A,ue),A.match_length<=5&&(A.strategy===1||A.match_length===F&&4096<A.strstart-A.match_start)&&(A.match_length=F-1)),A.prev_length>=F&&A.match_length<=A.prev_length){for(G=A.strstart+A.lookahead-F,Z=a._tr_tally(A,A.strstart-1-A.prev_match,A.prev_length-F),A.lookahead-=A.prev_length-1,A.prev_length-=2;++A.strstart<=G&&(A.ins_h=(A.ins_h<<A.hash_shift^A.window[A.strstart+F-1])&A.hash_mask,ue=A.prev[A.strstart&A.w_mask]=A.head[A.ins_h],A.head[A.ins_h]=A.strstart),--A.prev_length!=0;);if(A.match_available=0,A.match_length=F-1,A.strstart++,Z&&(oe(A,!1),A.strm.avail_out===0))return T}else if(A.match_available){if((Z=a._tr_tally(A,0,A.window[A.strstart-1]))&&oe(A,!1),A.strstart++,A.lookahead--,A.strm.avail_out===0)return T}else A.match_available=1,A.strstart++,A.lookahead--}return A.match_available&&(Z=a._tr_tally(A,0,A.window[A.strstart-1]),A.match_available=0),A.insert=A.strstart<F-1?A.strstart:F-1,ee===p?(oe(A,!0),A.strm.avail_out===0?U:W):A.last_lit&&(oe(A,!1),A.strm.avail_out===0)?T:te}function Rt(A,ee,ue,Z,G){this.good_length=A,this.max_lazy=ee,this.nice_length=ue,this.max_chain=Z,this.func=G}function Pe(){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=I,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*M),this.dyn_dtree=new s.Buf16(2*(2*R+1)),this.bl_tree=new s.Buf16(2*(2*P+1)),Oe(this.dyn_ltree),Oe(this.dyn_dtree),Oe(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new s.Buf16($+1),this.heap=new s.Buf16(2*C+1),Oe(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new s.Buf16(2*C+1),Oe(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 Re(A){var ee;return A&&A.state?(A.total_in=A.total_out=0,A.data_type=w,(ee=A.state).pending=0,ee.pending_out=0,ee.wrap<0&&(ee.wrap=-ee.wrap),ee.status=ee.wrap?x:B,A.adler=ee.wrap===2?0:1,ee.last_flush=h,a._tr_init(ee),v):Y(A,g)}function le(A){var ee=Re(A);return ee===v&&(function(ue){ue.window_size=2*ue.w_size,Oe(ue.head),ue.max_lazy_match=i[ue.level].max_lazy,ue.good_match=i[ue.level].good_length,ue.nice_match=i[ue.level].nice_length,ue.max_chain_length=i[ue.level].max_chain,ue.strstart=0,ue.block_start=0,ue.lookahead=0,ue.insert=0,ue.match_length=ue.prev_length=F-1,ue.match_available=0,ue.ins_h=0})(A.state),ee}function L(A,ee,ue,Z,G,K){if(!A)return g;var re=1;if(ee===y&&(ee=6),Z<0?(re=0,Z=-Z):15<Z&&(re=2,Z-=16),G<1||k<G||ue!==I||Z<8||15<Z||ee<0||9<ee||K<0||_<K)return Y(A,g);Z===8&&(Z=9);var ge=new Pe;return(A.state=ge).strm=A,ge.wrap=re,ge.gzhead=null,ge.w_bits=Z,ge.w_size=1<<ge.w_bits,ge.w_mask=ge.w_size-1,ge.hash_bits=G+7,ge.hash_size=1<<ge.hash_bits,ge.hash_mask=ge.hash_size-1,ge.hash_shift=~~((ge.hash_bits+F-1)/F),ge.window=new s.Buf8(2*ge.w_size),ge.head=new s.Buf16(ge.hash_size),ge.prev=new s.Buf16(ge.w_size),ge.lit_bufsize=1<<G+6,ge.pending_buf_size=4*ge.lit_bufsize,ge.pending_buf=new s.Buf8(ge.pending_buf_size),ge.d_buf=1*ge.lit_bufsize,ge.l_buf=3*ge.lit_bufsize,ge.level=ee,ge.strategy=K,ge.method=ue,le(A)}i=[new Rt(0,0,0,0,function(A,ee){var ue=65535;for(ue>A.pending_buf_size-5&&(ue=A.pending_buf_size-5);;){if(A.lookahead<=1){if(rt(A),A.lookahead===0&&ee===h)return T;if(A.lookahead===0)break}A.strstart+=A.lookahead,A.lookahead=0;var Z=A.block_start+ue;if((A.strstart===0||A.strstart>=Z)&&(A.lookahead=A.strstart-Z,A.strstart=Z,oe(A,!1),A.strm.avail_out===0)||A.strstart-A.block_start>=A.w_size-V&&(oe(A,!1),A.strm.avail_out===0))return T}return A.insert=0,ee===p?(oe(A,!0),A.strm.avail_out===0?U:W):(A.strstart>A.block_start&&(oe(A,!1),A.strm.avail_out),T)}),new Rt(4,4,8,4,ut),new Rt(4,5,16,8,ut),new Rt(4,6,32,32,ut),new Rt(4,4,16,16,ht),new Rt(8,16,32,32,ht),new Rt(8,16,128,128,ht),new Rt(8,32,128,256,ht),new Rt(32,128,258,1024,ht),new Rt(32,258,258,4096,ht)],o.deflateInit=function(A,ee){return L(A,ee,I,15,8,0)},o.deflateInit2=L,o.deflateReset=le,o.deflateResetKeep=Re,o.deflateSetHeader=function(A,ee){return A&&A.state?A.state.wrap!==2?g:(A.state.gzhead=ee,v):g},o.deflate=function(A,ee){var ue,Z,G,K;if(!A||!A.state||5<ee||ee<0)return A?Y(A,g):g;if(Z=A.state,!A.output||!A.input&&A.avail_in!==0||Z.status===666&&ee!==p)return Y(A,A.avail_out===0?-5:g);if(Z.strm=A,ue=Z.last_flush,Z.last_flush=ee,Z.status===x)if(Z.wrap===2)A.adler=0,pe(Z,31),pe(Z,139),pe(Z,8),Z.gzhead?(pe(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)),pe(Z,255&Z.gzhead.time),pe(Z,Z.gzhead.time>>8&255),pe(Z,Z.gzhead.time>>16&255),pe(Z,Z.gzhead.time>>24&255),pe(Z,Z.level===9?2:2<=Z.strategy||Z.level<2?4:0),pe(Z,255&Z.gzhead.os),Z.gzhead.extra&&Z.gzhead.extra.length&&(pe(Z,255&Z.gzhead.extra.length),pe(Z,Z.gzhead.extra.length>>8&255)),Z.gzhead.hcrc&&(A.adler=u(A.adler,Z.pending_buf,Z.pending,0)),Z.gzindex=0,Z.status=69):(pe(Z,0),pe(Z,0),pe(Z,0),pe(Z,0),pe(Z,0),pe(Z,Z.level===9?2:2<=Z.strategy||Z.level<2?4:0),pe(Z,3),Z.status=B);else{var re=I+(Z.w_bits-8<<4)<<8;re|=(2<=Z.strategy||Z.level<2?0:Z.level<6?1:Z.level===6?2:3)<<6,Z.strstart!==0&&(re|=32),re+=31-re%31,Z.status=B,Ee(Z,re),Z.strstart!==0&&(Ee(Z,A.adler>>>16),Ee(Z,65535&A.adler)),A.adler=1}if(Z.status===69)if(Z.gzhead.extra){for(G=Z.pending;Z.gzindex<(65535&Z.gzhead.extra.length)&&(Z.pending!==Z.pending_buf_size||(Z.gzhead.hcrc&&Z.pending>G&&(A.adler=u(A.adler,Z.pending_buf,Z.pending-G,G)),de(A),G=Z.pending,Z.pending!==Z.pending_buf_size));)pe(Z,255&Z.gzhead.extra[Z.gzindex]),Z.gzindex++;Z.gzhead.hcrc&&Z.pending>G&&(A.adler=u(A.adler,Z.pending_buf,Z.pending-G,G)),Z.gzindex===Z.gzhead.extra.length&&(Z.gzindex=0,Z.status=73)}else Z.status=73;if(Z.status===73)if(Z.gzhead.name){G=Z.pending;do{if(Z.pending===Z.pending_buf_size&&(Z.gzhead.hcrc&&Z.pending>G&&(A.adler=u(A.adler,Z.pending_buf,Z.pending-G,G)),de(A),G=Z.pending,Z.pending===Z.pending_buf_size)){K=1;break}K=Z.gzindex<Z.gzhead.name.length?255&Z.gzhead.name.charCodeAt(Z.gzindex++):0,pe(Z,K)}while(K!==0);Z.gzhead.hcrc&&Z.pending>G&&(A.adler=u(A.adler,Z.pending_buf,Z.pending-G,G)),K===0&&(Z.gzindex=0,Z.status=91)}else Z.status=91;if(Z.status===91)if(Z.gzhead.comment){G=Z.pending;do{if(Z.pending===Z.pending_buf_size&&(Z.gzhead.hcrc&&Z.pending>G&&(A.adler=u(A.adler,Z.pending_buf,Z.pending-G,G)),de(A),G=Z.pending,Z.pending===Z.pending_buf_size)){K=1;break}K=Z.gzindex<Z.gzhead.comment.length?255&Z.gzhead.comment.charCodeAt(Z.gzindex++):0,pe(Z,K)}while(K!==0);Z.gzhead.hcrc&&Z.pending>G&&(A.adler=u(A.adler,Z.pending_buf,Z.pending-G,G)),K===0&&(Z.status=103)}else Z.status=103;if(Z.status===103&&(Z.gzhead.hcrc?(Z.pending+2>Z.pending_buf_size&&de(A),Z.pending+2<=Z.pending_buf_size&&(pe(Z,255&A.adler),pe(Z,A.adler>>8&255),A.adler=0,Z.status=B)):Z.status=B),Z.pending!==0){if(de(A),A.avail_out===0)return Z.last_flush=-1,v}else if(A.avail_in===0&&J(ee)<=J(ue)&&ee!==p)return Y(A,-5);if(Z.status===666&&A.avail_in!==0)return Y(A,-5);if(A.avail_in!==0||Z.lookahead!==0||ee!==h&&Z.status!==666){var ge=Z.strategy===2?(function(X,ce){for(var Ae;;){if(X.lookahead===0&&(rt(X),X.lookahead===0)){if(ce===h)return T;break}if(X.match_length=0,Ae=a._tr_tally(X,0,X.window[X.strstart]),X.lookahead--,X.strstart++,Ae&&(oe(X,!1),X.strm.avail_out===0))return T}return X.insert=0,ce===p?(oe(X,!0),X.strm.avail_out===0?U:W):X.last_lit&&(oe(X,!1),X.strm.avail_out===0)?T:te})(Z,ee):Z.strategy===3?(function(X,ce){for(var Ae,ke,De,ft,xe=X.window;;){if(X.lookahead<=D){if(rt(X),X.lookahead<=D&&ce===h)return T;if(X.lookahead===0)break}if(X.match_length=0,X.lookahead>=F&&0<X.strstart&&(ke=xe[De=X.strstart-1])===xe[++De]&&ke===xe[++De]&&ke===xe[++De]){ft=X.strstart+D;do;while(ke===xe[++De]&&ke===xe[++De]&&ke===xe[++De]&&ke===xe[++De]&&ke===xe[++De]&&ke===xe[++De]&&ke===xe[++De]&&ke===xe[++De]&&De<ft);X.match_length=D-(ft-De),X.match_length>X.lookahead&&(X.match_length=X.lookahead)}if(X.match_length>=F?(Ae=a._tr_tally(X,1,X.match_length-F),X.lookahead-=X.match_length,X.strstart+=X.match_length,X.match_length=0):(Ae=a._tr_tally(X,0,X.window[X.strstart]),X.lookahead--,X.strstart++),Ae&&(oe(X,!1),X.strm.avail_out===0))return T}return X.insert=0,ce===p?(oe(X,!0),X.strm.avail_out===0?U:W):X.last_lit&&(oe(X,!1),X.strm.avail_out===0)?T:te})(Z,ee):i[Z.level].func(Z,ee);if(ge!==U&&ge!==W||(Z.status=666),ge===T||ge===U)return A.avail_out===0&&(Z.last_flush=-1),v;if(ge===te&&(ee===1?a._tr_align(Z):ee!==5&&(a._tr_stored_block(Z,0,0,!1),ee===3&&(Oe(Z.head),Z.lookahead===0&&(Z.strstart=0,Z.block_start=0,Z.insert=0))),de(A),A.avail_out===0))return Z.last_flush=-1,v}return ee!==p?v:Z.wrap<=0?1:(Z.wrap===2?(pe(Z,255&A.adler),pe(Z,A.adler>>8&255),pe(Z,A.adler>>16&255),pe(Z,A.adler>>24&255),pe(Z,255&A.total_in),pe(Z,A.total_in>>8&255),pe(Z,A.total_in>>16&255),pe(Z,A.total_in>>24&255)):(Ee(Z,A.adler>>>16),Ee(Z,65535&A.adler)),de(A),0<Z.wrap&&(Z.wrap=-Z.wrap),Z.pending!==0?v:1)},o.deflateEnd=function(A){var ee;return A&&A.state?(ee=A.state.status)!==x&&ee!==69&&ee!==73&&ee!==91&&ee!==103&&ee!==B&&ee!==666?Y(A,g):(A.state=null,ee===B?Y(A,-3):v):g},o.deflateSetDictionary=function(A,ee){var ue,Z,G,K,re,ge,X,ce,Ae=ee.length;if(!A||!A.state||(K=(ue=A.state).wrap)===2||K===1&&ue.status!==x||ue.lookahead)return g;for(K===1&&(A.adler=l(A.adler,ee,Ae,0)),ue.wrap=0,Ae>=ue.w_size&&(K===0&&(Oe(ue.head),ue.strstart=0,ue.block_start=0,ue.insert=0),ce=new s.Buf8(ue.w_size),s.arraySet(ce,ee,Ae-ue.w_size,ue.w_size,0),ee=ce,Ae=ue.w_size),re=A.avail_in,ge=A.next_in,X=A.input,A.avail_in=Ae,A.next_in=0,A.input=ee,rt(ue);ue.lookahead>=F;){for(Z=ue.strstart,G=ue.lookahead-(F-1);ue.ins_h=(ue.ins_h<<ue.hash_shift^ue.window[Z+F-1])&ue.hash_mask,ue.prev[Z&ue.w_mask]=ue.head[ue.ins_h],ue.head[ue.ins_h]=Z,Z++,--G;);ue.strstart=Z,ue.lookahead=F-1,rt(ue)}return ue.strstart+=ue.lookahead,ue.block_start=ue.strstart,ue.insert=ue.lookahead,ue.lookahead=0,ue.match_length=ue.prev_length=F-1,ue.match_available=0,A.next_in=ge,A.input=X,A.avail_in=re,ue.wrap=K,v},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,h,p,v,g,y,_,w,I,k,C,R,P,M,$,F,D,V,x,B,T=i.input,te;u=l+(i.avail_in-5),d=i.next_out,te=i.output,h=d-(s-i.avail_out),p=d+(i.avail_out-257),v=a.dmax,g=a.wsize,y=a.whave,_=a.wnext,w=a.window,I=a.hold,k=a.bits,C=a.lencode,R=a.distcode,P=(1<<a.lenbits)-1,M=(1<<a.distbits)-1;e:do{k<15&&(I+=T[l++]<<k,k+=8,I+=T[l++]<<k,k+=8),$=C[I&P];t:for(;;){if(I>>>=F=$>>>24,k-=F,(F=$>>>16&255)===0)te[d++]=65535&$;else{if(!(16&F)){if((64&F)==0){$=C[(65535&$)+(I&(1<<F)-1)];continue t}if(32&F){a.mode=12;break e}i.msg="invalid literal/length code",a.mode=30;break e}D=65535&$,(F&=15)&&(k<F&&(I+=T[l++]<<k,k+=8),D+=I&(1<<F)-1,I>>>=F,k-=F),k<15&&(I+=T[l++]<<k,k+=8,I+=T[l++]<<k,k+=8),$=R[I&M];n:for(;;){if(I>>>=F=$>>>24,k-=F,!(16&(F=$>>>16&255))){if((64&F)==0){$=R[(65535&$)+(I&(1<<F)-1)];continue n}i.msg="invalid distance code",a.mode=30;break e}if(V=65535&$,k<(F&=15)&&(I+=T[l++]<<k,(k+=8)<F&&(I+=T[l++]<<k,k+=8)),v<(V+=I&(1<<F)-1)){i.msg="invalid distance too far back",a.mode=30;break e}if(I>>>=F,k-=F,(F=d-h)<V){if(y<(F=V-F)&&a.sane){i.msg="invalid distance too far back",a.mode=30;break e}if(B=w,(x=0)===_){if(x+=g-F,F<D){for(D-=F;te[d++]=w[x++],--F;);x=d-V,B=te}}else if(_<F){if(x+=g+_-F,(F-=_)<D){for(D-=F;te[d++]=w[x++],--F;);if(x=0,_<D){for(D-=F=_;te[d++]=w[x++],--F;);x=d-V,B=te}}}else if(x+=_-F,F<D){for(D-=F;te[d++]=w[x++],--F;);x=d-V,B=te}for(;2<D;)te[d++]=B[x++],te[d++]=B[x++],te[d++]=B[x++],D-=3;D&&(te[d++]=B[x++],1<D&&(te[d++]=B[x++]))}else{for(x=d-V;te[d++]=te[x++],te[d++]=te[x++],te[d++]=te[x++],2<(D-=3););D&&(te[d++]=te[x++],1<D&&(te[d++]=te[x++]))}break}}break}}while(l<u&&d<p);l-=D=k>>3,I&=(1<<(k-=D<<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=I,a.bits=k}},{}],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,h=2,p=0,v=-2,g=1,y=852,_=592;function w(x){return(x>>>24&255)+(x>>>8&65280)+((65280&x)<<8)+((255&x)<<24)}function I(){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 k(x){var B;return x&&x.state?(B=x.state,x.total_in=x.total_out=B.total=0,x.msg="",B.wrap&&(x.adler=1&B.wrap),B.mode=g,B.last=0,B.havedict=0,B.dmax=32768,B.head=null,B.hold=0,B.bits=0,B.lencode=B.lendyn=new i.Buf32(y),B.distcode=B.distdyn=new i.Buf32(_),B.sane=1,B.back=-1,p):v}function C(x){var B;return x&&x.state?((B=x.state).wsize=0,B.whave=0,B.wnext=0,k(x)):v}function R(x,B){var T,te;return x&&x.state?(te=x.state,B<0?(T=0,B=-B):(T=1+(B>>4),B<48&&(B&=15)),B&&(B<8||15<B)?v:(te.window!==null&&te.wbits!==B&&(te.window=null),te.wrap=T,te.wbits=B,C(x))):v}function P(x,B){var T,te;return x?(te=new I,(x.state=te).window=null,(T=R(x,B))!==p&&(x.state=null),T):v}var M,$,F=!0;function D(x){if(F){var B;for(M=new i.Buf32(512),$=new i.Buf32(32),B=0;B<144;)x.lens[B++]=8;for(;B<256;)x.lens[B++]=9;for(;B<280;)x.lens[B++]=7;for(;B<288;)x.lens[B++]=8;for(u(d,x.lens,0,288,M,0,x.work,{bits:9}),B=0;B<32;)x.lens[B++]=5;u(h,x.lens,0,32,$,0,x.work,{bits:5}),F=!1}x.lencode=M,x.lenbits=9,x.distcode=$,x.distbits=5}function V(x,B,T,te){var U,W=x.state;return W.window===null&&(W.wsize=1<<W.wbits,W.wnext=0,W.whave=0,W.window=new i.Buf8(W.wsize)),te>=W.wsize?(i.arraySet(W.window,B,T-W.wsize,W.wsize,0),W.wnext=0,W.whave=W.wsize):(te<(U=W.wsize-W.wnext)&&(U=te),i.arraySet(W.window,B,T-te,U,W.wnext),(te-=U)?(i.arraySet(W.window,B,T-te,te,0),W.wnext=te,W.whave=W.wsize):(W.wnext+=U,W.wnext===W.wsize&&(W.wnext=0),W.whave<W.wsize&&(W.whave+=U))),0}o.inflateReset=C,o.inflateReset2=R,o.inflateResetKeep=k,o.inflateInit=function(x){return P(x,15)},o.inflateInit2=P,o.inflate=function(x,B){var T,te,U,W,Y,J,Oe,de,oe,pe,Ee,Ve,rt,ut,ht,Rt,Pe,Re,le,L,A,ee,ue,Z,G=0,K=new i.Buf8(4),re=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!x||!x.state||!x.output||!x.input&&x.avail_in!==0)return v;(T=x.state).mode===12&&(T.mode=13),Y=x.next_out,U=x.output,Oe=x.avail_out,W=x.next_in,te=x.input,J=x.avail_in,de=T.hold,oe=T.bits,pe=J,Ee=Oe,ee=p;e:for(;;)switch(T.mode){case g:if(T.wrap===0){T.mode=13;break}for(;oe<16;){if(J===0)break e;J--,de+=te[W++]<<oe,oe+=8}if(2&T.wrap&&de===35615){K[T.check=0]=255&de,K[1]=de>>>8&255,T.check=a(T.check,K,2,0),oe=de=0,T.mode=2;break}if(T.flags=0,T.head&&(T.head.done=!1),!(1&T.wrap)||(((255&de)<<8)+(de>>8))%31){x.msg="incorrect header check",T.mode=30;break}if((15&de)!=8){x.msg="unknown compression method",T.mode=30;break}if(oe-=4,A=8+(15&(de>>>=4)),T.wbits===0)T.wbits=A;else if(A>T.wbits){x.msg="invalid window size",T.mode=30;break}T.dmax=1<<A,x.adler=T.check=1,T.mode=512&de?10:12,oe=de=0;break;case 2:for(;oe<16;){if(J===0)break e;J--,de+=te[W++]<<oe,oe+=8}if(T.flags=de,(255&T.flags)!=8){x.msg="unknown compression method",T.mode=30;break}if(57344&T.flags){x.msg="unknown header flags set",T.mode=30;break}T.head&&(T.head.text=de>>8&1),512&T.flags&&(K[0]=255&de,K[1]=de>>>8&255,T.check=a(T.check,K,2,0)),oe=de=0,T.mode=3;case 3:for(;oe<32;){if(J===0)break e;J--,de+=te[W++]<<oe,oe+=8}T.head&&(T.head.time=de),512&T.flags&&(K[0]=255&de,K[1]=de>>>8&255,K[2]=de>>>16&255,K[3]=de>>>24&255,T.check=a(T.check,K,4,0)),oe=de=0,T.mode=4;case 4:for(;oe<16;){if(J===0)break e;J--,de+=te[W++]<<oe,oe+=8}T.head&&(T.head.xflags=255&de,T.head.os=de>>8),512&T.flags&&(K[0]=255&de,K[1]=de>>>8&255,T.check=a(T.check,K,2,0)),oe=de=0,T.mode=5;case 5:if(1024&T.flags){for(;oe<16;){if(J===0)break e;J--,de+=te[W++]<<oe,oe+=8}T.length=de,T.head&&(T.head.extra_len=de),512&T.flags&&(K[0]=255&de,K[1]=de>>>8&255,T.check=a(T.check,K,2,0)),oe=de=0}else T.head&&(T.head.extra=null);T.mode=6;case 6:if(1024&T.flags&&(J<(Ve=T.length)&&(Ve=J),Ve&&(T.head&&(A=T.head.extra_len-T.length,T.head.extra||(T.head.extra=new Array(T.head.extra_len)),i.arraySet(T.head.extra,te,W,Ve,A)),512&T.flags&&(T.check=a(T.check,te,Ve,W)),J-=Ve,W+=Ve,T.length-=Ve),T.length))break e;T.length=0,T.mode=7;case 7:if(2048&T.flags){if(J===0)break e;for(Ve=0;A=te[W+Ve++],T.head&&A&&T.length<65536&&(T.head.name+=String.fromCharCode(A)),A&&Ve<J;);if(512&T.flags&&(T.check=a(T.check,te,Ve,W)),J-=Ve,W+=Ve,A)break e}else T.head&&(T.head.name=null);T.length=0,T.mode=8;case 8:if(4096&T.flags){if(J===0)break e;for(Ve=0;A=te[W+Ve++],T.head&&A&&T.length<65536&&(T.head.comment+=String.fromCharCode(A)),A&&Ve<J;);if(512&T.flags&&(T.check=a(T.check,te,Ve,W)),J-=Ve,W+=Ve,A)break e}else T.head&&(T.head.comment=null);T.mode=9;case 9:if(512&T.flags){for(;oe<16;){if(J===0)break e;J--,de+=te[W++]<<oe,oe+=8}if(de!==(65535&T.check)){x.msg="header crc mismatch",T.mode=30;break}oe=de=0}T.head&&(T.head.hcrc=T.flags>>9&1,T.head.done=!0),x.adler=T.check=0,T.mode=12;break;case 10:for(;oe<32;){if(J===0)break e;J--,de+=te[W++]<<oe,oe+=8}x.adler=T.check=w(de),oe=de=0,T.mode=11;case 11:if(T.havedict===0)return x.next_out=Y,x.avail_out=Oe,x.next_in=W,x.avail_in=J,T.hold=de,T.bits=oe,2;x.adler=T.check=1,T.mode=12;case 12:if(B===5||B===6)break e;case 13:if(T.last){de>>>=7&oe,oe-=7&oe,T.mode=27;break}for(;oe<3;){if(J===0)break e;J--,de+=te[W++]<<oe,oe+=8}switch(T.last=1&de,oe-=1,3&(de>>>=1)){case 0:T.mode=14;break;case 1:if(D(T),T.mode=20,B!==6)break;de>>>=2,oe-=2;break e;case 2:T.mode=17;break;case 3:x.msg="invalid block type",T.mode=30}de>>>=2,oe-=2;break;case 14:for(de>>>=7&oe,oe-=7&oe;oe<32;){if(J===0)break e;J--,de+=te[W++]<<oe,oe+=8}if((65535&de)!=(de>>>16^65535)){x.msg="invalid stored block lengths",T.mode=30;break}if(T.length=65535&de,oe=de=0,T.mode=15,B===6)break e;case 15:T.mode=16;case 16:if(Ve=T.length){if(J<Ve&&(Ve=J),Oe<Ve&&(Ve=Oe),Ve===0)break e;i.arraySet(U,te,W,Ve,Y),J-=Ve,W+=Ve,Oe-=Ve,Y+=Ve,T.length-=Ve;break}T.mode=12;break;case 17:for(;oe<14;){if(J===0)break e;J--,de+=te[W++]<<oe,oe+=8}if(T.nlen=257+(31&de),de>>>=5,oe-=5,T.ndist=1+(31&de),de>>>=5,oe-=5,T.ncode=4+(15&de),de>>>=4,oe-=4,286<T.nlen||30<T.ndist){x.msg="too many length or distance symbols",T.mode=30;break}T.have=0,T.mode=18;case 18:for(;T.have<T.ncode;){for(;oe<3;){if(J===0)break e;J--,de+=te[W++]<<oe,oe+=8}T.lens[re[T.have++]]=7&de,de>>>=3,oe-=3}for(;T.have<19;)T.lens[re[T.have++]]=0;if(T.lencode=T.lendyn,T.lenbits=7,ue={bits:T.lenbits},ee=u(0,T.lens,0,19,T.lencode,0,T.work,ue),T.lenbits=ue.bits,ee){x.msg="invalid code lengths set",T.mode=30;break}T.have=0,T.mode=19;case 19:for(;T.have<T.nlen+T.ndist;){for(;Rt=(G=T.lencode[de&(1<<T.lenbits)-1])>>>16&255,Pe=65535&G,!((ht=G>>>24)<=oe);){if(J===0)break e;J--,de+=te[W++]<<oe,oe+=8}if(Pe<16)de>>>=ht,oe-=ht,T.lens[T.have++]=Pe;else{if(Pe===16){for(Z=ht+2;oe<Z;){if(J===0)break e;J--,de+=te[W++]<<oe,oe+=8}if(de>>>=ht,oe-=ht,T.have===0){x.msg="invalid bit length repeat",T.mode=30;break}A=T.lens[T.have-1],Ve=3+(3&de),de>>>=2,oe-=2}else if(Pe===17){for(Z=ht+3;oe<Z;){if(J===0)break e;J--,de+=te[W++]<<oe,oe+=8}oe-=ht,A=0,Ve=3+(7&(de>>>=ht)),de>>>=3,oe-=3}else{for(Z=ht+7;oe<Z;){if(J===0)break e;J--,de+=te[W++]<<oe,oe+=8}oe-=ht,A=0,Ve=11+(127&(de>>>=ht)),de>>>=7,oe-=7}if(T.have+Ve>T.nlen+T.ndist){x.msg="invalid bit length repeat",T.mode=30;break}for(;Ve--;)T.lens[T.have++]=A}}if(T.mode===30)break;if(T.lens[256]===0){x.msg="invalid code -- missing end-of-block",T.mode=30;break}if(T.lenbits=9,ue={bits:T.lenbits},ee=u(d,T.lens,0,T.nlen,T.lencode,0,T.work,ue),T.lenbits=ue.bits,ee){x.msg="invalid literal/lengths set",T.mode=30;break}if(T.distbits=6,T.distcode=T.distdyn,ue={bits:T.distbits},ee=u(h,T.lens,T.nlen,T.ndist,T.distcode,0,T.work,ue),T.distbits=ue.bits,ee){x.msg="invalid distances set",T.mode=30;break}if(T.mode=20,B===6)break e;case 20:T.mode=21;case 21:if(6<=J&&258<=Oe){x.next_out=Y,x.avail_out=Oe,x.next_in=W,x.avail_in=J,T.hold=de,T.bits=oe,l(x,Ee),Y=x.next_out,U=x.output,Oe=x.avail_out,W=x.next_in,te=x.input,J=x.avail_in,de=T.hold,oe=T.bits,T.mode===12&&(T.back=-1);break}for(T.back=0;Rt=(G=T.lencode[de&(1<<T.lenbits)-1])>>>16&255,Pe=65535&G,!((ht=G>>>24)<=oe);){if(J===0)break e;J--,de+=te[W++]<<oe,oe+=8}if(Rt&&(240&Rt)==0){for(Re=ht,le=Rt,L=Pe;Rt=(G=T.lencode[L+((de&(1<<Re+le)-1)>>Re)])>>>16&255,Pe=65535&G,!(Re+(ht=G>>>24)<=oe);){if(J===0)break e;J--,de+=te[W++]<<oe,oe+=8}de>>>=Re,oe-=Re,T.back+=Re}if(de>>>=ht,oe-=ht,T.back+=ht,T.length=Pe,Rt===0){T.mode=26;break}if(32&Rt){T.back=-1,T.mode=12;break}if(64&Rt){x.msg="invalid literal/length code",T.mode=30;break}T.extra=15&Rt,T.mode=22;case 22:if(T.extra){for(Z=T.extra;oe<Z;){if(J===0)break e;J--,de+=te[W++]<<oe,oe+=8}T.length+=de&(1<<T.extra)-1,de>>>=T.extra,oe-=T.extra,T.back+=T.extra}T.was=T.length,T.mode=23;case 23:for(;Rt=(G=T.distcode[de&(1<<T.distbits)-1])>>>16&255,Pe=65535&G,!((ht=G>>>24)<=oe);){if(J===0)break e;J--,de+=te[W++]<<oe,oe+=8}if((240&Rt)==0){for(Re=ht,le=Rt,L=Pe;Rt=(G=T.distcode[L+((de&(1<<Re+le)-1)>>Re)])>>>16&255,Pe=65535&G,!(Re+(ht=G>>>24)<=oe);){if(J===0)break e;J--,de+=te[W++]<<oe,oe+=8}de>>>=Re,oe-=Re,T.back+=Re}if(de>>>=ht,oe-=ht,T.back+=ht,64&Rt){x.msg="invalid distance code",T.mode=30;break}T.offset=Pe,T.extra=15&Rt,T.mode=24;case 24:if(T.extra){for(Z=T.extra;oe<Z;){if(J===0)break e;J--,de+=te[W++]<<oe,oe+=8}T.offset+=de&(1<<T.extra)-1,de>>>=T.extra,oe-=T.extra,T.back+=T.extra}if(T.offset>T.dmax){x.msg="invalid distance too far back",T.mode=30;break}T.mode=25;case 25:if(Oe===0)break e;if(Ve=Ee-Oe,T.offset>Ve){if((Ve=T.offset-Ve)>T.whave&&T.sane){x.msg="invalid distance too far back",T.mode=30;break}rt=Ve>T.wnext?(Ve-=T.wnext,T.wsize-Ve):T.wnext-Ve,Ve>T.length&&(Ve=T.length),ut=T.window}else ut=U,rt=Y-T.offset,Ve=T.length;for(Oe<Ve&&(Ve=Oe),Oe-=Ve,T.length-=Ve;U[Y++]=ut[rt++],--Ve;);T.length===0&&(T.mode=21);break;case 26:if(Oe===0)break e;U[Y++]=T.length,Oe--,T.mode=21;break;case 27:if(T.wrap){for(;oe<32;){if(J===0)break e;J--,de|=te[W++]<<oe,oe+=8}if(Ee-=Oe,x.total_out+=Ee,T.total+=Ee,Ee&&(x.adler=T.check=T.flags?a(T.check,U,Ee,Y-Ee):s(T.check,U,Ee,Y-Ee)),Ee=Oe,(T.flags?de:w(de))!==T.check){x.msg="incorrect data check",T.mode=30;break}oe=de=0}T.mode=28;case 28:if(T.wrap&&T.flags){for(;oe<32;){if(J===0)break e;J--,de+=te[W++]<<oe,oe+=8}if(de!==(4294967295&T.total)){x.msg="incorrect length check",T.mode=30;break}oe=de=0}T.mode=29;case 29:ee=1;break e;case 30:ee=-3;break e;case 31:return-4;default:return v}return x.next_out=Y,x.avail_out=Oe,x.next_in=W,x.avail_in=J,T.hold=de,T.bits=oe,(T.wsize||Ee!==x.avail_out&&T.mode<30&&(T.mode<27||B!==4))&&V(x,x.output,x.next_out,Ee-x.avail_out)?(T.mode=31,-4):(pe-=x.avail_in,Ee-=x.avail_out,x.total_in+=pe,x.total_out+=Ee,T.total+=Ee,T.wrap&&Ee&&(x.adler=T.check=T.flags?a(T.check,U,Ee,x.next_out-Ee):s(T.check,U,Ee,x.next_out-Ee)),x.data_type=T.bits+(T.last?64:0)+(T.mode===12?128:0)+(T.mode===20||T.mode===15?256:0),(pe==0&&Ee===0||B===4)&&ee===p&&(ee=-5),ee)},o.inflateEnd=function(x){if(!x||!x.state)return v;var B=x.state;return B.window&&(B.window=null),x.state=null,p},o.inflateGetHeader=function(x,B){var T;return x&&x.state?(2&(T=x.state).wrap)==0?v:((T.head=B).done=!1,p):v},o.inflateSetDictionary=function(x,B){var T,te=B.length;return x&&x.state?(T=x.state).wrap!==0&&T.mode!==11?v:T.mode===11&&s(1,B,te,0)!==T.check?-3:V(x,B,te,te)?(T.mode=31,-4):(T.havedict=1,p):v},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,h,p,v,g,y,_,w){var I,k,C,R,P,M,$,F,D,V=w.bits,x=0,B=0,T=0,te=0,U=0,W=0,Y=0,J=0,Oe=0,de=0,oe=null,pe=0,Ee=new i.Buf16(16),Ve=new i.Buf16(16),rt=null,ut=0;for(x=0;x<=15;x++)Ee[x]=0;for(B=0;B<v;B++)Ee[h[p+B]]++;for(U=V,te=15;1<=te&&Ee[te]===0;te--);if(te<U&&(U=te),te===0)return g[y++]=20971520,g[y++]=20971520,w.bits=1,0;for(T=1;T<te&&Ee[T]===0;T++);for(U<T&&(U=T),x=J=1;x<=15;x++)if(J<<=1,(J-=Ee[x])<0)return-1;if(0<J&&(d===0||te!==1))return-1;for(Ve[1]=0,x=1;x<15;x++)Ve[x+1]=Ve[x]+Ee[x];for(B=0;B<v;B++)h[p+B]!==0&&(_[Ve[h[p+B]]++]=B);if(M=d===0?(oe=rt=_,19):d===1?(oe=s,pe-=257,rt=a,ut-=257,256):(oe=l,rt=u,-1),x=T,P=y,Y=B=de=0,C=-1,R=(Oe=1<<(W=U))-1,d===1&&852<Oe||d===2&&592<Oe)return 1;for(;;){for($=x-Y,D=_[B]<M?(F=0,_[B]):_[B]>M?(F=rt[ut+_[B]],oe[pe+_[B]]):(F=96,0),I=1<<x-Y,T=k=1<<W;g[P+(de>>Y)+(k-=I)]=$<<24|F<<16|D|0,k!==0;);for(I=1<<x-1;de&I;)I>>=1;if(I!==0?(de&=I-1,de+=I):de=0,B++,--Ee[x]==0){if(x===te)break;x=h[p+_[B]]}if(U<x&&(de&R)!==C){for(Y===0&&(Y=U),P+=T,J=1<<(W=x-Y);W+Y<te&&!((J-=Ee[W+Y])<=0);)W++,J<<=1;if(Oe+=1<<W,d===1&&852<Oe||d===2&&592<Oe)return 1;g[C=de&R]=U<<24|W<<16|P-y|0}}return de!==0&&(g[P+de]=x-Y<<24|4194304),w.bits=U,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(G){for(var K=G.length;0<=--K;)G[K]=0}var u=0,d=29,h=256,p=h+1+d,v=30,g=19,y=2*p+1,_=15,w=16,I=7,k=256,C=16,R=17,P=18,M=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],$=[0,0,0,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],F=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],D=[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 x=new Array(2*v);l(x);var B=new Array(512);l(B);var T=new Array(256);l(T);var te=new Array(d);l(te);var U,W,Y,J=new Array(v);function Oe(G,K,re,ge,X){this.static_tree=G,this.extra_bits=K,this.extra_base=re,this.elems=ge,this.max_length=X,this.has_stree=G&&G.length}function de(G,K){this.dyn_tree=G,this.max_code=0,this.stat_desc=K}function oe(G){return G<256?B[G]:B[256+(G>>>7)]}function pe(G,K){G.pending_buf[G.pending++]=255&K,G.pending_buf[G.pending++]=K>>>8&255}function Ee(G,K,re){G.bi_valid>w-re?(G.bi_buf|=K<<G.bi_valid&65535,pe(G,G.bi_buf),G.bi_buf=K>>w-G.bi_valid,G.bi_valid+=re-w):(G.bi_buf|=K<<G.bi_valid&65535,G.bi_valid+=re)}function Ve(G,K,re){Ee(G,re[2*K],re[2*K+1])}function rt(G,K){for(var re=0;re|=1&G,G>>>=1,re<<=1,0<--K;);return re>>>1}function ut(G,K,re){var ge,X,ce=new Array(_+1),Ae=0;for(ge=1;ge<=_;ge++)ce[ge]=Ae=Ae+re[ge-1]<<1;for(X=0;X<=K;X++){var ke=G[2*X+1];ke!==0&&(G[2*X]=rt(ce[ke]++,ke))}}function ht(G){var K;for(K=0;K<p;K++)G.dyn_ltree[2*K]=0;for(K=0;K<v;K++)G.dyn_dtree[2*K]=0;for(K=0;K<g;K++)G.bl_tree[2*K]=0;G.dyn_ltree[2*k]=1,G.opt_len=G.static_len=0,G.last_lit=G.matches=0}function Rt(G){8<G.bi_valid?pe(G,G.bi_buf):0<G.bi_valid&&(G.pending_buf[G.pending++]=G.bi_buf),G.bi_buf=0,G.bi_valid=0}function Pe(G,K,re,ge){var X=2*K,ce=2*re;return G[X]<G[ce]||G[X]===G[ce]&&ge[K]<=ge[re]}function Re(G,K,re){for(var ge=G.heap[re],X=re<<1;X<=G.heap_len&&(X<G.heap_len&&Pe(K,G.heap[X+1],G.heap[X],G.depth)&&X++,!Pe(K,ge,G.heap[X],G.depth));)G.heap[re]=G.heap[X],re=X,X<<=1;G.heap[re]=ge}function le(G,K,re){var ge,X,ce,Ae,ke=0;if(G.last_lit!==0)for(;ge=G.pending_buf[G.d_buf+2*ke]<<8|G.pending_buf[G.d_buf+2*ke+1],X=G.pending_buf[G.l_buf+ke],ke++,ge===0?Ve(G,X,K):(Ve(G,(ce=T[X])+h+1,K),(Ae=M[ce])!==0&&Ee(G,X-=te[ce],Ae),Ve(G,ce=oe(--ge),re),(Ae=$[ce])!==0&&Ee(G,ge-=J[ce],Ae)),ke<G.last_lit;);Ve(G,k,K)}function L(G,K){var re,ge,X,ce=K.dyn_tree,Ae=K.stat_desc.static_tree,ke=K.stat_desc.has_stree,De=K.stat_desc.elems,ft=-1;for(G.heap_len=0,G.heap_max=y,re=0;re<De;re++)ce[2*re]!==0?(G.heap[++G.heap_len]=ft=re,G.depth[re]=0):ce[2*re+1]=0;for(;G.heap_len<2;)ce[2*(X=G.heap[++G.heap_len]=ft<2?++ft:0)]=1,G.depth[X]=0,G.opt_len--,ke&&(G.static_len-=Ae[2*X+1]);for(K.max_code=ft,re=G.heap_len>>1;1<=re;re--)Re(G,ce,re);for(X=De;re=G.heap[1],G.heap[1]=G.heap[G.heap_len--],Re(G,ce,1),ge=G.heap[1],G.heap[--G.heap_max]=re,G.heap[--G.heap_max]=ge,ce[2*X]=ce[2*re]+ce[2*ge],G.depth[X]=(G.depth[re]>=G.depth[ge]?G.depth[re]:G.depth[ge])+1,ce[2*re+1]=ce[2*ge+1]=X,G.heap[1]=X++,Re(G,ce,1),2<=G.heap_len;);G.heap[--G.heap_max]=G.heap[1],(function(xe,qe){var Bt,bt,tt,Dt,tn,Mn,ln=qe.dyn_tree,qn=qe.max_code,Kt=qe.stat_desc.static_tree,Fn=qe.stat_desc.has_stree,Jn=qe.stat_desc.extra_bits,Nn=qe.stat_desc.extra_base,Sr=qe.stat_desc.max_length,Kn=0;for(Dt=0;Dt<=_;Dt++)xe.bl_count[Dt]=0;for(ln[2*xe.heap[xe.heap_max]+1]=0,Bt=xe.heap_max+1;Bt<y;Bt++)Sr<(Dt=ln[2*ln[2*(bt=xe.heap[Bt])+1]+1]+1)&&(Dt=Sr,Kn++),ln[2*bt+1]=Dt,qn<bt||(xe.bl_count[Dt]++,tn=0,Nn<=bt&&(tn=Jn[bt-Nn]),Mn=ln[2*bt],xe.opt_len+=Mn*(Dt+tn),Fn&&(xe.static_len+=Mn*(Kt[2*bt+1]+tn)));if(Kn!==0){do{for(Dt=Sr-1;xe.bl_count[Dt]===0;)Dt--;xe.bl_count[Dt]--,xe.bl_count[Dt+1]+=2,xe.bl_count[Sr]--,Kn-=2}while(0<Kn);for(Dt=Sr;Dt!==0;Dt--)for(bt=xe.bl_count[Dt];bt!==0;)qn<(tt=xe.heap[--Bt])||(ln[2*tt+1]!==Dt&&(xe.opt_len+=(Dt-ln[2*tt+1])*ln[2*tt],ln[2*tt+1]=Dt),bt--)}})(G,K),ut(ce,ft,G.bl_count)}function A(G,K,re){var ge,X,ce=-1,Ae=K[1],ke=0,De=7,ft=4;for(Ae===0&&(De=138,ft=3),K[2*(re+1)+1]=65535,ge=0;ge<=re;ge++)X=Ae,Ae=K[2*(ge+1)+1],++ke<De&&X===Ae||(ke<ft?G.bl_tree[2*X]+=ke:X!==0?(X!==ce&&G.bl_tree[2*X]++,G.bl_tree[2*C]++):ke<=10?G.bl_tree[2*R]++:G.bl_tree[2*P]++,ce=X,ft=(ke=0)===Ae?(De=138,3):X===Ae?(De=6,3):(De=7,4))}function ee(G,K,re){var ge,X,ce=-1,Ae=K[1],ke=0,De=7,ft=4;for(Ae===0&&(De=138,ft=3),ge=0;ge<=re;ge++)if(X=Ae,Ae=K[2*(ge+1)+1],!(++ke<De&&X===Ae)){if(ke<ft)for(;Ve(G,X,G.bl_tree),--ke!=0;);else X!==0?(X!==ce&&(Ve(G,X,G.bl_tree),ke--),Ve(G,C,G.bl_tree),Ee(G,ke-3,2)):ke<=10?(Ve(G,R,G.bl_tree),Ee(G,ke-3,3)):(Ve(G,P,G.bl_tree),Ee(G,ke-11,7));ce=X,ft=(ke=0)===Ae?(De=138,3):X===Ae?(De=6,3):(De=7,4)}}l(J);var ue=!1;function Z(G,K,re,ge){Ee(G,(u<<1)+(ge?1:0),3),(function(X,ce,Ae,ke){Rt(X),ke&&(pe(X,Ae),pe(X,~Ae)),i.arraySet(X.pending_buf,X.window,ce,Ae,X.pending),X.pending+=Ae})(G,K,re,!0)}o._tr_init=function(G){ue||((function(){var K,re,ge,X,ce,Ae=new Array(_+1);for(X=ge=0;X<d-1;X++)for(te[X]=ge,K=0;K<1<<M[X];K++)T[ge++]=X;for(T[ge-1]=X,X=ce=0;X<16;X++)for(J[X]=ce,K=0;K<1<<$[X];K++)B[ce++]=X;for(ce>>=7;X<v;X++)for(J[X]=ce<<7,K=0;K<1<<$[X]-7;K++)B[256+ce++]=X;for(re=0;re<=_;re++)Ae[re]=0;for(K=0;K<=143;)V[2*K+1]=8,K++,Ae[8]++;for(;K<=255;)V[2*K+1]=9,K++,Ae[9]++;for(;K<=279;)V[2*K+1]=7,K++,Ae[7]++;for(;K<=287;)V[2*K+1]=8,K++,Ae[8]++;for(ut(V,p+1,Ae),K=0;K<v;K++)x[2*K+1]=5,x[2*K]=rt(K,5);U=new Oe(V,M,h+1,p,_),W=new Oe(x,$,0,v,_),Y=new Oe(new Array(0),F,0,g,I)})(),ue=!0),G.l_desc=new de(G.dyn_ltree,U),G.d_desc=new de(G.dyn_dtree,W),G.bl_desc=new de(G.bl_tree,Y),G.bi_buf=0,G.bi_valid=0,ht(G)},o._tr_stored_block=Z,o._tr_flush_block=function(G,K,re,ge){var X,ce,Ae=0;0<G.level?(G.strm.data_type===2&&(G.strm.data_type=(function(ke){var De,ft=4093624447;for(De=0;De<=31;De++,ft>>>=1)if(1&ft&&ke.dyn_ltree[2*De]!==0)return s;if(ke.dyn_ltree[18]!==0||ke.dyn_ltree[20]!==0||ke.dyn_ltree[26]!==0)return a;for(De=32;De<h;De++)if(ke.dyn_ltree[2*De]!==0)return a;return s})(G)),L(G,G.l_desc),L(G,G.d_desc),Ae=(function(ke){var De;for(A(ke,ke.dyn_ltree,ke.l_desc.max_code),A(ke,ke.dyn_dtree,ke.d_desc.max_code),L(ke,ke.bl_desc),De=g-1;3<=De&&ke.bl_tree[2*D[De]+1]===0;De--);return ke.opt_len+=3*(De+1)+5+5+4,De})(G),X=G.opt_len+3+7>>>3,(ce=G.static_len+3+7>>>3)<=X&&(X=ce)):X=ce=re+5,re+4<=X&&K!==-1?Z(G,K,re,ge):G.strategy===4||ce===X?(Ee(G,2+(ge?1:0),3),le(G,V,x)):(Ee(G,4+(ge?1:0),3),(function(ke,De,ft,xe){var qe;for(Ee(ke,De-257,5),Ee(ke,ft-1,5),Ee(ke,xe-4,4),qe=0;qe<xe;qe++)Ee(ke,ke.bl_tree[2*D[qe]+1],3);ee(ke,ke.dyn_ltree,De-1),ee(ke,ke.dyn_dtree,ft-1)})(G,G.l_desc.max_code+1,G.d_desc.max_code+1,Ae+1),le(G,G.dyn_ltree,G.dyn_dtree)),ht(G),ge&&Rt(G)},o._tr_tally=function(G,K,re){return G.pending_buf[G.d_buf+2*G.last_lit]=K>>>8&255,G.pending_buf[G.d_buf+2*G.last_lit+1]=255&K,G.pending_buf[G.l_buf+G.last_lit]=255&re,G.last_lit++,K===0?G.dyn_ltree[2*re]++:(G.matches++,K--,G.dyn_ltree[2*(T[re]+h+1)]++,G.dyn_dtree[2*oe(K)]++),G.last_lit===G.lit_bufsize-1},o._tr_align=function(G){Ee(G,2,3),Ve(G,k,V),(function(K){K.bi_valid===16?(pe(K,K.bi_buf),K.bi_buf=0,K.bi_valid=0):8<=K.bi_valid&&(K.pending_buf[K.pending++]=255&K.bi_buf,K.bi_buf>>=8,K.bi_valid-=8)})(G)}},{"../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,h,p=1,v={},g=!1,y=s.document,_=Object.getPrototypeOf&&Object.getPrototypeOf(s);_=_&&_.setTimeout?_:s,l={}.toString.call(s.process)==="[object process]"?function(C){process.nextTick(function(){I(C)})}:(function(){if(s.postMessage&&!s.importScripts){var C=!0,R=s.onmessage;return s.onmessage=function(){C=!1},s.postMessage("","*"),s.onmessage=R,C}})()?(h="setImmediate$"+Math.random()+"$",s.addEventListener?s.addEventListener("message",k,!1):s.attachEvent("onmessage",k),function(C){s.postMessage(h+C,"*")}):s.MessageChannel?((d=new MessageChannel).port1.onmessage=function(C){I(C.data)},function(C){d.port2.postMessage(C)}):y&&"onreadystatechange"in y.createElement("script")?(u=y.documentElement,function(C){var R=y.createElement("script");R.onreadystatechange=function(){I(C),R.onreadystatechange=null,u.removeChild(R),R=null},u.appendChild(R)}):function(C){setTimeout(I,0,C)},_.setImmediate=function(C){typeof C!="function"&&(C=new Function(""+C));for(var R=new Array(arguments.length-1),P=0;P<R.length;P++)R[P]=arguments[P+1];return v[p]={callback:C,args:R},l(p),p++},_.clearImmediate=w}function w(C){delete v[C]}function I(C){if(g)setTimeout(I,0,C);else{var R=v[C];if(R){g=!0;try{(function(P){var M=P.callback,$=P.args;switch($.length){case 0:M();break;case 1:M($[0]);break;case 2:M($[0],$[1]);break;case 3:M($[0],$[1],$[2]);break;default:M.apply(a,$)}})(R)}finally{w(C),g=!1}}}}function k(C){C.source===s&&typeof C.data=="string"&&C.data.indexOf(h)===0&&I(+C.data.slice(h.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)})})),Nr="application/vnd.openxmlformats-officedocument.wordprocessingml.document",rl="application/pdf",Qf="text/html",E8={docx:Nr,pdf:rl,html:Qf},lm={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"},T8=e=>typeof e!="string"?"":e.trim(),Mb=e=>{if(typeof e!="string")return"";const t=e.trim();return t?t.toLowerCase():""},cm=e=>{if(typeof e!="string")return"";const t=e.trim();return t?t.toLowerCase():""},tu=e=>{const t=e??{},n=T8(t.id),r=Mb(t.email);return{id:n,email:r,name:typeof t.name=="string"?t.name:"",hasId:n.length>0,hasEmail:r.length>0}},xS=({current:e,other:t})=>{const n=tu(e),r=tu(t);return n.hasId&&r.hasId?n.id===r.id:n.hasEmail&&r.hasEmail?n.email===r.email:!1},um=({actor:e,fallbackKey:t=""})=>{const n=tu(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 x8(e){return typeof e.captureStackTrace=="function"}var dm=class extends Error{constructor(e,t){super(e),this.cause=t,this.name="FileObjectError",x8(Error)&&Error.captureStackTrace(this,this.constructor)}},R8=class extends dm{constructor(e){super("Invalid data URI format: URI must contain exactly one comma separator"),this.uri=e,this.name="InvalidDataUriError"}},L8=class extends dm{constructor(e,t){super(`Failed to fetch file from URL: ${e}`,t),this.url=e,this.name="FetchFailedError"}},Ob=async(e,t,n,r)=>{try{if(e.startsWith("data:")&&e.includes(";base64,")){const s=e.split(",");if(s.length!==2)throw new R8(e);const a=atob(s[1]),l=Uint8Array.from(a,u=>u.charCodeAt(0));return new File([l],t,{type:n})}const o=await(r?.signal?fetch(e,{signal:r.signal}):fetch(e));if(!o.ok)throw new L8(e,new Error(`HTTP ${o.status}: ${o.statusText}`));const i=await o.blob();return new File([i],t,{type:n})}catch(o){throw o instanceof dm?o:new dm("Failed to create file object",o)}};function M8(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 fm=new WeakMap;function RS(e){return e.ownerDocument??document}function LS(e,t){const n=fm.get(t);n?.bindings.delete(e),n&&n.bindings.size===0&&(t.removeEventListener("click",n.listener),fm.delete(t))}function MS(e,t){const n=RS(e);e.__clickOutsideDocument&&e.__clickOutsideDocument!==n&&LS(e,e.__clickOutsideDocument);let r=fm.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},fm.set(n,r),n.addEventListener("click",i)}r.bindings.set(e,t),e.__clickOutsideHandler=r.listener,e.__clickOutsideDocument=n}var Pb={mounted(e,t){MS(e,t)},updated(e,t){MS(e,t)},unmounted(e){LS(e,e.__clickOutsideDocument??RS(e)),delete e.__clickOutsideHandler,delete e.__clickOutsideDocument}},O8="https://ingest.superdoc.dev/v1/collect",hZ="community-and-eval-agplv3";function P8(){try{return"2.28.0-next.15"}catch{return"unknown"}}var D8=class{constructor(e){this.enabled=e.enabled,this.endpoint=e.endpoint||O8,this.licenseKey=e.licenseKey||"",this.metadata=e.metadata,this.superdocVersion=P8()}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{}}};Ut();var F8=fw(I8(),1),hm={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"},pZ=[hm.INLINE_SDT_LABEL,hm.BLOCK_SDT_LABEL],OS={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"},N8=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"}}},mZ=`.${hm.BLOCK_SDT}[${OS.SDT_ID}]`,gZ=`[${OS.DRAGGABLE}="true"]`,B8=typeof window<"u",PS,Jf=e=>PS=e,DS=Symbol();function Db(e){return e&&typeof e=="object"&&Object.prototype.toString.call(e)==="[object Object]"&&typeof e.toJSON!="function"}var eh;(function(e){e.direct="direct",e.patchObject="patch object",e.patchFunction="patch function"})(eh||(eh={}));var FS=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 z8(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 Fb(e,t,n){const r=new XMLHttpRequest;r.open("GET",e),r.responseType="blob",r.onload=function(){V8(r.response,t,n)},r.onerror=function(){console.error("could not download file")},r.send()}function NS(e){const t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch{}return t.status>=200&&t.status<=299}function pm(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 mm=typeof navigator=="object"?navigator:{userAgent:""},BS=/Macintosh/.test(mm.userAgent)&&/AppleWebKit/.test(mm.userAgent)&&!/Safari/.test(mm.userAgent),V8=B8?typeof HTMLAnchorElement<"u"&&"download"in HTMLAnchorElement.prototype&&!BS?U8:"msSaveOrOpenBlob"in mm?j8:$8:()=>{};function U8(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?NS(r.href)?Fb(e,t,n):(r.target="_blank",pm(r)):pm(r)):(r.href=URL.createObjectURL(e),setTimeout(function(){URL.revokeObjectURL(r.href)},4e4),setTimeout(function(){pm(r)},0))}function j8(e,t="download",n){if(typeof e=="string")if(NS(e))Fb(e,t,n);else{const r=document.createElement("a");r.href=e,r.target="_blank",setTimeout(function(){pm(r)})}else navigator.msSaveOrOpenBlob(z8(e,n),t)}function $8(e,t,n,r){if(r=r||open("","_blank"),r&&(r.document.title=r.document.body.innerText="downloading..."),typeof e=="string")return Fb(e,t,n);const o=e.type==="application/octet-stream",i=/constructor/i.test(String(FS.HTMLElement))||"safari"in FS,s=/CriOS\/[\d]+/.test(navigator.userAgent);if((s||o&&i||BS)&&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:vZ}=Object;function H8(){const e=jv(!0),t=e.run(()=>ne({}));let n=[],r=[];const o=Ko({install(i){Jf(o),o._a=i,i.provide(DS,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 zS=()=>{};function VS(e,t,n,r=zS){e.add(t);const o=()=>{e.delete(t)&&r()};return!n&&$v()&&Lw(o),o}function td(e,...t){e.forEach(n=>{n(...t)})}var G8=e=>e(),US=Symbol(),Nb=Symbol();function Bb(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];Db(o)&&Db(r)&&e.hasOwnProperty(n)&&!Tr(r)&&!Li(r)?e[n]=Bb(o,r):e[n]=r}return e}var W8=Symbol();function q8(e){return!Db(e)||!Object.prototype.hasOwnProperty.call(e,W8)}var{assign:Jl}=Object;function K8(e){return!!(Tr(e)&&e.effect)}function Y8(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=jw(n.state.value[e]);return Jl(d,i,Object.keys(s||{}).reduce((h,p)=>(h[p]=Ko(Ce(()=>{Jf(n);const v=n._s.get(e);return s[p].call(v,v)})),h),{}))}return l=jS(e,u,t,n,r,!0),l}function jS(e,t,n={},r,o,i){let s;const a=Jl({actions:{}},n),l={deep:!0};let u,d,h=new Set,p=new Set,v;const g=r.state.value[e];!i&&!g&&(r.state.value[e]={});let y;function _(P){let M;u=d=!1,typeof P=="function"?(P(r.state.value[e]),M={type:eh.patchFunction,storeId:e,events:v}):(Bb(r.state.value[e],P),M={type:eh.patchObject,payload:P,storeId:e,events:v});const $=y=Symbol();It().then(()=>{y===$&&(u=!0)}),d=!0,td(h,M,r.state.value[e])}const w=i?function(){const{state:M}=n,$=M?M():{};this.$patch(F=>{Jl(F,$)})}:zS;function I(){s.stop(),h.clear(),p.clear(),r._s.delete(e)}const k=(P,M="")=>{if(US in P)return P[Nb]=M,P;const $=function(){Jf(r);const F=Array.from(arguments),D=new Set,V=new Set;function x(te){D.add(te)}function B(te){V.add(te)}td(p,{args:F,name:$[Nb],store:C,after:x,onError:B});let T;try{T=P.apply(this&&this.$id===e?this:C,F)}catch(te){throw td(V,te),te}return T instanceof Promise?T.then(te=>(td(D,te),te)).catch(te=>(td(V,te),Promise.reject(te))):(td(D,T),T)};return $[US]=!0,$[Nb]=M,$},C=vo({_p:r,$id:e,$onAction:VS.bind(null,p),$patch:_,$reset:w,$subscribe(P,M={}){const $=VS(h,P,M.detached,()=>F()),F=s.run(()=>$t(()=>r.state.value[e],D=>{(M.flush==="sync"?d:u)&&P({storeId:e,type:eh.direct,events:v},D)},Jl({},l,M)));return $},$dispose:I});r._s.set(e,C);const R=(r._a&&r._a.runWithContext||G8)(()=>r._e.run(()=>(s=jv()).run(()=>t({action:k}))));for(const P in R){const M=R[P];Tr(M)&&!K8(M)||Li(M)?i||(g&&q8(M)&&(Tr(M)?M.value=g[P]:Bb(M,g[P])),r.state.value[e][P]=M):typeof M=="function"&&(R[P]=k(M,P),a.actions[P]=M)}return Jl(C,R),Jl(Rn(C),R),Object.defineProperty(C,"$state",{get:()=>r.state.value[e],set:P=>{_(M=>{Jl(M,P)})}}),r._p.forEach(P=>{Jl(C,s.run(()=>P({store:C,app:r._a,pinia:r,options:a})))}),g&&i&&n.hydrate&&n.hydrate(C.$state,g),u=!0,d=!0,C}function $S(e,t,n){let r;const o=typeof t=="function";r=o?n:t;function i(s,a){const l=mC();return s=s||(l?na(DS,null):null),s&&Jf(s),s=PS,s._s.has(e)||(o?jS(e,t,r,s):Y8(e,r,s)),s._s.get(e)}return i.$id=e,i}function ca(e){const t=Rn(e),n={};for(const r in t){const o=t[r];o.effect?n[r]=Ce({get:()=>e[r],set(i){e[r]=i}}):(Tr(o)||Li(o))&&(n[r]=Zv(e,r))}return n}var HS=class extends Error{constructor(e,t){super(e==="DOCUMENT_LOAD_TIMEOUT"?"Document load deadline exceeded.":"Document load cancelled."),this.code=e,this.documentId=t,this.name="DocumentLoadError"}};function X8(e,t){if(e===void 0)return;if(e.timeoutMs!==void 0&&(!Number.isFinite(e.timeoutMs)||e.timeoutMs<=0||e.timeoutMs>2147483647))throw new RangeError("load.timeoutMs must be positive and at most 2147483647.");const n=new AbortController;let r=!1,o=null,i,s;const a=new Set,l=new Set,u=new Promise((v,g)=>{s=g});u.catch(()=>{});const d=()=>{i!==void 0&&clearTimeout(i),e.signal?.removeEventListener("abort",p)},h=v=>{if(!(r||o)){o=new HS(v,t),d(),n.abort(o),s(o);for(const g of l)g();l.clear();for(const g of[...a])g(o);a.clear()}},p=()=>h("DOCUMENT_LOAD_CANCELLED");return e.timeoutMs!==void 0&&(i=setTimeout(()=>h("DOCUMENT_LOAD_TIMEOUT"),e.timeoutMs)),e.signal?.addEventListener("abort",p,{once:!0}),e.signal?.aborted&&p(),{signal:n.signal,wait(v){return o?Promise.reject(o):Promise.race([u,v])},assertActive(){if(o)throw o},finish(){if(o)return!1;r=!0,d(),a.clear();for(const v of l)v();return l.clear(),!0},cancel:p,onSettled(v){r||o?v():l.add(v)},onFailure(v){return o?v(o):r||a.add(v),()=>a.delete(v)}}}function GS(e){return e.collaboration!==void 0?e.collaboration:e.v2Collaboration}function WS(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 nu(e){return typeof e=="string"&&e.length>0?e:null}function Z8(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 qS(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 Q8(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 zb(e){return e===void 0?"join":e==="join"||e==="create"?e:null}function J8(e){if(e!==void 0)return typeof e=="number"&&Number.isFinite(e)&&e>0&&e<=2147483647?e:null}function gm(e,t){return!e.ok||t===void 0?e:{ok:!0,target:{...e.target,syncTimeoutMs:t}}}function Vb(){return{ok:!1,reason:"invalid-room-mode",message:'SuperDoc v2 collaboration roomMode must be either "join" or "create".'}}function eR(e){const t=e.providerType;return typeof t=="string"&&t.length>0?t.toLowerCase():null}function tR(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 KS(e,t){const n=nu(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=Z8(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: ${WS(r)}).`};const i=Q8(t.params),s=e==="hocuspocus"&&typeof t.token=="function"?t.token:e==="hocuspocus"?nu(t.token):null,a=zb(t.roomMode);return a?{ok:!0,target:{providerFamily:e,documentId:n,roomMode:a,serverUrl:o,...i?{params:i}:{},...s?{token:s}:{},...e==="hocuspocus"&&t.retry!==void 0?{retry:t.retry}:{}}}:Vb()}function nR(e){const t=nu(e.adapterId);if(!t)return{ok:!1,reason:"invalid-adapter-id",message:"SuperDoc v2 provider extensions require a non-empty collaboration.adapterId."};const n=nu(e.documentId);if(!n)return{ok:!1,reason:"invalid-document-id",message:"SuperDoc v2 provider extensions require a non-empty collaboration.documentId."};const r=zb(e.roomMode);if(!r)return Vb();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:nu(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 rR(e,t){const n=nu(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=nu(e.publicApiKey),o=zb(e.roomMode);if(!o)return Vb();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."};const a=e.baseUrl,l=a===void 0?void 0:qS(a);if(l===null)return{ok:!1,reason:"invalid-base-url",message:"SuperDoc v2 Liveblocks collaboration requires baseUrl to be an absolute http(s) URL."};const u=l?{baseUrl:l}:{};if(r)return{ok:!0,target:{providerFamily:"liveblocks",documentId:n,roomMode:o,publicApiKey:r,...u}};const d=qS(i,t);return d?{ok:!0,target:{providerFamily:"liveblocks",documentId:n,roomMode:o,authEndpoint:d,...u}}:{ok:!1,reason:"invalid-auth-endpoint",message:"SuperDoc v2 Liveblocks collaboration requires a valid http(s) authEndpoint URL (received: <redacted>)."}}function YS(e){const{legacyCollaboration:t,documentType:n,documentCount:r,authEndpointBaseUrl:o}=e,i=GS(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=tR(t);if(u){const d=u==="external-ydoc-provider"?"unsupported-legacy-provider":"unsupported-provider-family",h=WS(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: ${h}). 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=J8(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=eR(s);return l===null||l==="y-websocket"?gm(KS("y-websocket",s),a):l==="hocuspocus"?gm(KS("hocuspocus",s),a):l==="liveblocks"?gm(rR(s,o),a):l==="extension"?gm(nR(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 th=(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?th(e.originFileObj,e.name||t):e.file?th(e.file,e.name||t):e.raw?th(e.raw,e.name||t):null},XS=Object.getOwnPropertyDescriptor(ArrayBuffer.prototype,"byteLength")?.get,oR=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Uint8Array.prototype),Symbol.toStringTag)?.get,ec=e=>{if(ArrayBuffer.isView(e))return oR?.call(e)==="Uint8Array";if(!XS)return!1;try{return XS.call(e),!0}catch{return!1}},Ub=e=>{if(e instanceof Uint8Array)return e;const t=ArrayBuffer.isView(e)?e:new Uint8Array(e);return Uint8Array.from(t)},jb=(e,t)=>new Blob([Ub(e)],{type:t}),$b=e=>{switch(e.toLowerCase()){case"docx":case Nr:return Nr;case"pdf":case rl:return rl;case"html":case Qf:return Qf;default:return e}},vm=(e="")=>{const t=String(e).toLowerCase();return t.endsWith(".docx")?Nr:t.endsWith(".pdf")?rl:t.endsWith(".html")||t.endsWith(".htm")?Qf:t.endsWith(".md")||t.endsWith(".markdown")?"text/markdown":""},iR=e=>e==="application/vnd.openxmlformats-officedocument.wordprocessingml.document"?"document.docx":e==="application/pdf"?"document.pdf":e==="text/html"?"document.html":"document",sR="application/octet-stream",Hb=e=>{if(e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"collaboration")){const n={...e};delete n.collaboration,e={...n,v2Collaboration:GS(e)}}if(ec(e))return{type:Nr,data:Ub(e),name:"document.docx"};const t=th(e);if(t){const n=e&&typeof e.name=="string"?e.name:"",r=t.name||"",o=vm(n),i=o||vm(r),s=t.type.toLowerCase()===sR,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(ec(e.data)){const r=$b(e.type||vm(e.name)||"application/vnd.openxmlformats-officedocument.wordprocessingml.document");return{...e,type:r,data:r==="application/vnd.openxmlformats-officedocument.wordprocessingml.document"?Ub(e.data):jb(e.data,r),name:e.name||iR(r)}}const n=th(e.data,e.name);if(n){const r=typeof e.type=="string"&&e.type?$b(e.type):"",o=r||n.type||vm(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=$b(e.type);if(n!==e.type)return{...e,type:n}}return e};Ut();function aR(e,t){const n=e.itemid,r=e,o=t!==null&&typeof t=="object"?vo({...t}):ne(t),i=ne(null);return $t(o,(a,l)=>{const u={fieldId:n.value,changeTime:Date.now(),oldValue:l,newValue:a,originalField:r};i.value=u}),{value:o}}function lR(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}=aR(e,i,ne([])),l=ne(e.itemtype),u=ne(e.itemfieldtype),d=e,h=vo({fontFamily:e.fontfamily||"Arial",fontSize:e.font_size||"12pt",originalFontSize:e.original_font_size||"12pt"}),p=ne(e.logicrules),v=ne(!1),g=vo({}),y={SELECT:uR,IMAGEINPUT:cR,CHECKBOXINPUT:dR};return l.value in y&&Object.assign(g,y[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:v,originalJSON:d,fieldStyle:h,valueGetter:e.valueGetter,...g}}function cR(e){return{fontfamily:ne(e.fontfamily),iteminputtype:ne(e.iteminputtype)}}function uR(e){return{options:ne(e.itemoptions)}}function dR(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 ua=()=>new Map,Gb=e=>{const t=ua();return e.forEach((n,r)=>{t.set(r,n)}),t},nd=(e,t,n)=>{let r=e.get(t);return r===void 0&&e.set(t,r=n()),r},fR=(e,t)=>{const n=[];for(const[r,o]of e)n.push(t(o,r));return n},hR=(e,t)=>{for(const[n,r]of e)if(t(r,n))return!0;return!1},rd=()=>new Set,Wb=e=>e[e.length-1],od=Array.from,qb=(e,t)=>{for(let n=0;n<e.length;n++)if(!t(e[n],n,e))return!1;return!0},ZS=(e,t)=>{for(let n=0;n<e.length;n++)if(t(e[n],n,e))return!0;return!1},pR=(e,t)=>{const n=new Array(e);for(let r=0;r<e;r++)n[r]=t(r,n);return n},ym=Array.isArray,mR=class{constructor(){this._observers=ua()}on(e,t){return nd(this._observers,e,rd).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 od((this._observers.get(e)||ua()).values()).forEach(n=>n(...t))}destroy(){this._observers=ua()}},ol=Math.floor,bm=Math.abs,QS=(e,t)=>e<t?e:t,id=(e,t)=>e>t?e:t,yZ=Number.isNaN,gR=e=>e!==0?e<0:1/e<0,bZ=1,wZ=2,CZ=4,kZ=8,SZ=32,_Z=64,AZ=128,vR=1<<17,yR=1<<18,bR=1<<19,wR=1<<20,CR=1<<21,kR=1<<22,SR=1<<23,_R=1<<24,AR=1<<25,IR=1<<26,ER=1<<27,TR=1<<28,xR=1<<29,RR=1<<30,IZ=31,EZ=63,TZ=127,xZ=vR-1,RZ=yR-1,LZ=bR-1,MZ=wR-1,OZ=CR-1,PZ=kR-1,DZ=SR-1,FZ=_R-1,NZ=AR-1,BZ=IR-1,zZ=ER-1,VZ=TR-1,UZ=xR-1,jZ=RR-1,$Z=2147483647,JS=Number.MAX_SAFE_INTEGER,e3=Number.MIN_SAFE_INTEGER,LR=Number.isInteger||(e=>typeof e=="number"&&isFinite(e)&&ol(e)===e),HZ=Number.isNaN,GZ=Number.parseInt,t3=String.fromCharCode,WZ=String.fromCodePoint,qZ=t3(65535),MR=e=>e.toLowerCase(),OR=/^\s*/g,PR=e=>e.replace(OR,""),DR=/([A-Z])/g,n3=(e,t)=>PR(e.replace(DR,n=>`${t}${MR(n)}`)),FR=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},nh=typeof TextEncoder<"u"?new TextEncoder:null,NR=e=>nh.encode(e),BR=nh?NR:FR,Kb=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});Kb&&Kb.decode(new Uint8Array).length===1&&(Kb=null);var zR=(e,t)=>pR(t,()=>e).join(""),rh=class{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}},Yb=()=>new rh,VR=e=>{let t=e.cpos;for(let n=0;n<e.bufs.length;n++)t+=e.bufs[n].length;return t},il=e=>{const t=new Uint8Array(VR(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},UR=(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(id(n,t)*2),e.cpos=0)},Bo=(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},Xb=Bo,wr=(e,t)=>{for(;t>127;)Bo(e,128|127&t),t=ol(t/128);Bo(e,127&t)},Zb=(e,t)=>{const n=gR(t);for(n&&(t=-t),Bo(e,(t>63?128:0)|(n?64:0)|63&t),t=ol(t/64);t>0;)Bo(e,(t>127?128:0)|127&t),t=ol(t/128)},Qb=new Uint8Array(3e4),jR=Qb.length/3,$R=(e,t)=>{if(t.length<jR){const n=nh.encodeInto(t,Qb).written||0;wr(e,n);for(let r=0;r<n;r++)Bo(e,Qb[r])}else Yi(e,BR(t))},HR=(e,t)=>{const n=unescape(encodeURIComponent(t)),r=n.length;wr(e,r);for(let o=0;o<r;o++)Bo(e,n.codePointAt(o))},sd=nh&&nh.encodeInto?$R:HR,Jb=(e,t)=>{const n=e.cbuf.length,r=e.cpos,o=QS(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(id(n*2,i)),e.cbuf.set(t.subarray(o)),e.cpos=i)},Yi=(e,t)=>{wr(e,t.byteLength),Jb(e,t)},e0=(e,t)=>{UR(e,t);const n=new DataView(e.cbuf.buffer,e.cpos,t);return e.cpos+=t,n},GR=(e,t)=>e0(e,4).setFloat32(0,t,!1),WR=(e,t)=>e0(e,8).setFloat64(0,t,!1),qR=(e,t)=>e0(e,8).setBigInt64(0,t,!1),r3=new DataView(new ArrayBuffer(4)),KR=e=>(r3.setFloat32(0,e),r3.getFloat32(0)===e),oh=(e,t)=>{switch(typeof t){case"string":Bo(e,119),sd(e,t);break;case"number":LR(t)&&bm(t)<=2147483647?(Bo(e,125),Zb(e,t)):KR(t)?(Bo(e,124),GR(e,t)):(Bo(e,123),WR(e,t));break;case"bigint":Bo(e,122),qR(e,t);break;case"object":if(t===null)Bo(e,126);else if(ym(t)){Bo(e,117),wr(e,t.length);for(let n=0;n<t.length;n++)oh(e,t[n])}else if(t instanceof Uint8Array)Bo(e,116),Yi(e,t);else{Bo(e,118);const n=Object.keys(t);wr(e,n.length);for(let r=0;r<n.length;r++){const o=n[r];sd(e,o),oh(e,t[o])}}break;case"boolean":Bo(e,t?120:121);break;default:Bo(e,127)}},o3=class extends rh{constructor(e){super(),this.w=e,this.s=null,this.count=0}write(e){this.s===e?this.count++:(this.count>0&&wr(this,this.count-1),this.count=1,this.w(this,e),this.s=e)}},i3=e=>{e.count>0&&(Zb(e.encoder,e.count===1?e.s:-e.s),e.count>1&&wr(e.encoder,e.count-2))},wm=class{constructor(){this.encoder=new rh,this.s=0,this.count=0}write(e){this.s===e?this.count++:(i3(this),this.count=1,this.s=e)}toUint8Array(){return i3(this),il(this.encoder)}},s3=e=>{if(e.count>0){const t=e.diff*2+(e.count===1?0:1);Zb(e.encoder,t),e.count>1&&wr(e.encoder,e.count-2)}},t0=class{constructor(){this.encoder=new rh,this.s=0,this.count=0,this.diff=0}write(e){this.diff===e-this.s?(this.s=e,this.count++):(s3(this),this.count=1,this.diff=e-this.s,this.s=e)}toUint8Array(){return s3(this),il(this.encoder)}},YR=class{constructor(){this.sarr=[],this.s="",this.lensE=new wm}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 rh;return this.sarr.push(this.s),this.s="",sd(e,this.sarr.join("")),Jb(e,this.lensE.toUint8Array()),il(e)}},tc=e=>new Error(e),Ps=()=>{throw tc("Method unimplemented")},sl=()=>{throw tc("Unexpected case")},KZ=crypto.subtle,XR=crypto.getRandomValues.bind(crypto),a3=()=>XR(new Uint32Array(1))[0],ZR="10000000-1000-4000-8000-100000000000",QR=()=>ZR.replace(/[018]/g,e=>(e^a3()&15>>e/4).toString(16)),JR=Date.now,l3=e=>new Promise(e),YZ=Promise.all.bind(Promise),c3=e=>e===void 0?null:e,e7=class{constructor(){this.map=new Map}setItem(e,t){this.map.set(e,t)}getItem(e){return this.map.get(e)}},u3=new e7,t7=!0;try{typeof localStorage<"u"&&localStorage&&(u3=localStorage,t7=!1)}catch{}var n7=u3,ih=Symbol("Equality"),d3=(e,t)=>e===t||!!e?.[ih]?.(t)||!1,r7=e=>typeof e=="object",o7=Object.assign,i7=Object.keys,s7=(e,t)=>{for(const n in e)t(e[n],n)},Cm=e=>i7(e).length,a7=e=>{for(const t in e)return!1;return!0},sh=(e,t)=>{for(const n in e)if(!t(e[n],n))return!1;return!0},n0=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),l7=(e,t)=>e===t||Cm(e)===Cm(t)&&sh(e,(n,r)=>(n!==void 0||n0(t,r))&&d3(t[r],n)),c7=Object.freeze,f3=e=>{for(const t in e){const n=e[t];(typeof n=="object"||typeof n=="function")&&f3(e[t])}return c7(e)},r0=(e,t,n=0)=>{try{for(;n<e.length;n++)e[n](...t)}finally{n<e.length&&r0(e,t,n+1)}},km=(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[ih]!=null)return e[ih](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)||!km(e.get(n),t.get(n)))return!1;break;case void 0:case Object:if(Cm(e)!==Cm(t))return!1;for(const n in e)if(!n0(e,n)||!km(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(!km(e[n],t[n]))return!1;break;default:return!1}return!0},u7=(e,t)=>t.includes(e),ah=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]",XZ=typeof navigator<"u"?/Mac/.test(navigator.platform):!1,da,d7=[],f7=()=>{if(da===void 0)if(ah){da=ua();const e=process.argv;let t=null;for(let n=0;n<e.length;n++){const r=e[n];r[0]==="-"?(t!==null&&da.set(t,""),t=r):t!==null?(da.set(t,r),t=null):d7.push(r)}t!==null&&da.set(t,"")}else typeof location=="object"?(da=ua(),(location.search||"?").slice(1).split("&").forEach(e=>{if(e.length!==0){const[t,n]=e.split("=");da.set(`--${n3(t,"-")}`,n),da.set(`-${n3(t,"-")}`,n)}})):da=ua();return da},o0=e=>f7().has(e),Sm=e=>c3(ah?process.env[e.toUpperCase().replaceAll("-","_")]:n7.getItem(e)),h3=e=>o0("--"+e)||Sm(e)!==null,h7=h3("production"),p7=ah&&u7(process.env.FORCE_COLOR,["true","1","2"]),m7=p7||!o0("--no-colors")&&!h3("no-color")&&(!ah||process.stdout.isTTY)&&(!ah||o0("--color")||Sm("COLORTERM")!==null||(Sm("TERM")||"").includes("color")),g7=class{constructor(e,t){this.left=e,this.right=t}},al=(e,t)=>new g7(e,t),p3=e=>e.next()>=.5,i0=(e,t,n)=>ol(e.next()*(n+1-t)+t),m3=(e,t,n)=>ol(e.next()*(n+1-t)+t),s0=(e,t,n)=>m3(e,t,n),v7=e=>t3(s0(e,97,122)),y7=(e,t=0,n=20)=>{const r=s0(e,t,n);let o="";for(let i=0;i<r;i++)o+=v7(e);return o},a0=(e,t)=>t[s0(e,0,t.length-1)],b7=Symbol("0schema"),w7=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(zR(" ",(this._rerrs.length-t)*2)+`${n.path!=null?`[${n.path}] `:""}${n.has} doesn't match ${n.expected}. ${n.message}`)}return e.join(`
|
|
5
5
|
`)}},l0=(e,t)=>e===t?!0:e==null||t==null||e.constructor!==t.constructor?!1:e[ih]?d3(e,t):ym(e)?qb(e,n=>ZS(t,r=>l0(n,r))):r7(e)?sh(e,(n,r)=>l0(n,t[r])):!1,ki=class{static _dilutes=!1;extends(e){let[t,n]=[this.shape,e.shape];return this.constructor._dilutes&&([n,t]=[t,n]),l0(t,n)}equals(e){return this.constructor===e.constructor&&km(this.shape,e.shape)}[b7](){return!0}[ih](e){return this.equals(e)}validate(e){return this.check(e)}check(e,t){Ps()}get nullable(){return ad(this,xm)}get optional(){return new y3(this)}cast(e){return M3(e,this),e}expect(e){return M3(e,this),e}},c0=class extends ki{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}},yo=(e,t=null)=>new c0(e,t),ZZ=yo(c0),u0=class extends ki{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}},zo=e=>new u0(e),QZ=yo(u0),_m=class extends ki{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}},Am=(...e)=>new _m(e),g3=yo(_m),C7=RegExp.escape||(e=>e.replace(/[().|&,$^[\]]/g,t=>"\\"+t)),v3=e=>{if(cd.check(e))return[C7(e)];if(g3.check(e))return e.shape.map(t=>t+"");if(x3.check(e))return["[+-]?\\d+.?\\d*"];if(R3.check(e))return[".*"];if(Im.check(e))return e.shape.map(v3).flat(1);sl()},k7=class extends ki{constructor(e){super(),this.shape=e,this._r=new RegExp("^"+e.map(v3).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}},JZ=yo(k7),S7=Symbol("optional"),y3=class extends ki{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[S7](){return!0}},_7=yo(y3),b3=class extends ki{check(e,t){return t?.extend(null,"never",typeof e),!1}},eQ=new b3,tQ=yo(b3),w3=class Zx extends ki{constructor(t,n=!1){super(),this.shape=t,this._isPartial=n}static _dilutes=!0;get partial(){return new Zx(this.shape,!0)}check(t,n){return t==null?(n?.extend(null,"object","null"),!1):sh(this.shape,(r,o)=>{const i=this._isPartial&&!n0(t,o)||r.check(t[o],n);return!i&&n?.extend(o.toString(),r.toString(),typeof t[o],"Object property does not match"),i})}},A7=e=>new w3(e),I7=yo(w3),E7=zo(e=>e!=null&&(e.constructor===Object||e.constructor==null)),C3=class extends ki{constructor(e,t){super(),this.shape={keys:e,values:t}}check(e,t){return e!=null&&sh(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)})}},k3=(e,t)=>new C3(e,t),T7=yo(C3),S3=class extends ki{constructor(e){super(),this.shape=e}check(e,t){return e!=null&&sh(this.shape,(n,r)=>{const o=n.check(e[r],t);return!o&&t?.extend(r.toString(),"Tuple",typeof n),o})}},x7=(...e)=>new S3(e),nQ=yo(S3),_3=class extends ki{constructor(e){super(),this.shape=e.length===1?e[0]:new d0(e)}check(e,t){const n=ym(e)&&qb(e,r=>this.shape.check(r));return!n&&t?.extend(null,"Array",""),n}},A3=(...e)=>new _3(e),R7=yo(_3),L7=zo(e=>ym(e)),I3=class extends ki{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}},M7=(e,t=null)=>new I3(e,t),rQ=yo(I3),O7=M7(ki),P7=class extends ki{constructor(e){super(),this.len=e.length-1,this.args=x7(...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}},D7=yo(P7),F7=zo(e=>typeof e=="function"),N7=class extends ki{constructor(e){super(),this.shape=e}check(e,t){const n=qb(this.shape,r=>r.check(e,t));return!n&&t?.extend(null,"Intersectinon",typeof e),n}},oQ=yo(N7,e=>e.shape.length>0),d0=class extends ki{static _dilutes=!0;constructor(e){super(),this.shape=e}check(e,t){const n=ZS(this.shape,r=>r.check(e,t));return t?.extend(null,"Union",typeof e),n}},ad=(...e)=>e.findIndex(t=>Im.check(t))>=0?ad(...e.map(t=>lh(t)).map(t=>Im.check(t)?t.shape:[t]).flat(1)):e.length===1?e[0]:new d0(e),Im=yo(d0),E3=()=>!0,Em=zo(E3),B7=yo(u0,e=>e.shape===E3),f0=zo(e=>typeof e=="bigint"),z7=zo(e=>e===f0),T3=zo(e=>typeof e=="symbol"),iQ=zo(e=>e===T3),ld=zo(e=>typeof e=="number"),x3=zo(e=>e===ld),cd=zo(e=>typeof e=="string"),R3=zo(e=>e===cd),Tm=zo(e=>typeof e=="boolean"),V7=zo(e=>e===Tm),L3=Am(void 0),sQ=yo(_m,e=>e.shape.length===1&&e.shape[0]===void 0),aQ=Am(void 0),xm=Am(null),U7=yo(_m,e=>e.shape.length===1&&e.shape[0]===null),lQ=yo(Uint8Array),cQ=yo(c0,e=>e.shape===Uint8Array),j7=ad(ld,cd,xm,L3,f0,Tm,T3),uQ=(()=>{const e=A3(Em),t=k3(cd,Em),n=ad(ld,cd,xm,Tm,e,t);return e.shape=n,t.shape.values=n,n})(),lh=e=>{if(O7.check(e))return e;if(E7.check(e)){const t={};for(const n in e)t[n]=lh(e[n]);return A7(t)}else{if(L7.check(e))return ad(...e.map(lh));if(j7.check(e))return Am(e);if(F7.check(e))return yo(e)}sl()},M3=h7?()=>{}:(e,t)=>{const n=new w7;if(!t.check(e,n))throw tc(`Expected value to be of type ${t.constructor.name}.
|
|
6
6
|
${n.toString()}`)},$7=class{constructor(e){this.patterns=[],this.$state=e}if(e,t){return this.patterns.push({if:lh(e),h:t}),this}else(e){return this.if(Em,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 tc("Unhandled pattern")}}},H7=e=>new $7(e),O3=H7(Em).if(x3,(e,t)=>i0(t,e3,JS)).if(R3,(e,t)=>y7(t)).if(V7,(e,t)=>p3(t)).if(z7,(e,t)=>BigInt(i0(t,e3,JS))).if(Im,(e,t)=>ud(t,a0(t,e.shape))).if(I7,(e,t)=>{const n={};for(const r in e.shape){let o=e.shape[r];if(_7.check(o)){if(p3(t))continue;o=o.shape}n[r]=O3(o,t)}return n}).if(R7,(e,t)=>{const n=[],r=m3(t,0,42);for(let o=0;o<r;o++)n.push(ud(t,e.shape));return n}).if(g3,(e,t)=>a0(t,e.shape)).if(U7,(e,t)=>null).if(D7,(e,t)=>{const n=ud(t,e.res);return()=>n}).if(B7,(e,t)=>ud(t,a0(t,[ld,cd,xm,L3,f0,Tm,A3(ld),k3(ad("a","b","c"),ld)]))).if(T7,(e,t)=>{const n={},r=i0(t,0,3);for(let o=0;o<r;o++){const i=ud(t,e.shape.keys);n[i]=ud(t,e.shape.values)}return n}).done(),ud=(e,t)=>O3(lh(t),e),ru=typeof document<"u"?document:{},dQ=zo(e=>e.nodeType===Y7),fQ=typeof DOMParser<"u"?new DOMParser:null,hQ=zo(e=>e.nodeType===W7),pQ=zo(e=>e.nodeType===q7),G7=e=>fR(e,(t,n)=>`${n}:${t};`).join(""),W7=ru.ELEMENT_NODE,q7=ru.TEXT_NODE,mQ=ru.CDATA_SECTION_NODE,gQ=ru.COMMENT_NODE,K7=ru.DOCUMENT_NODE,vQ=ru.DOCUMENT_TYPE_NODE,Y7=ru.DOCUMENT_FRAGMENT_NODE,yQ=zo(e=>e.nodeType===K7),ll=Symbol,P3=ll(),D3=ll(),X7=ll(),Z7=ll(),Q7=ll(),F3=ll(),J7=ll(),h0=ll(),eL=ll(),tL=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},bQ=JR(),nL={[P3]:al("font-weight","bold"),[D3]:al("font-weight","normal"),[X7]:al("color","blue"),[Q7]:al("color","green"),[Z7]:al("color","grey"),[F3]:al("color","red"),[J7]:al("color","purple"),[h0]:al("color","orange"),[eL]:al("color","black")},rL=e=>{e.length===1&&e[0]?.constructor===Function&&(e=e[0]());const t=[],n=[],r=ua();let o=[],i=0;for(;i<e.length;i++){const s=e[i],a=nL[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=G7(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},N3=m7?rL:tL,oL=(...e)=>{console.log(...N3(e)),B3.forEach(t=>t.print(e))},iL=(...e)=>{console.warn(...N3(e)),e.unshift(h0),B3.forEach(t=>t.print(e))},B3=rd(),z3=e=>({[Symbol.iterator](){return this},next:e}),sL=(e,t)=>z3(()=>{let n;do n=e.next();while(!n.done&&!t(n.value));return n}),p0=(e,t)=>z3(()=>{const{done:n,value:r}=e.next();return{done:n,value:n?void 0:t(r)}}),V3=class{constructor(e,t){this.clock=e,this.len=t}},U3=class{constructor(){this.clients=new Map}},j3=(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])J3(e,i,u.clock,u.len,n)}}),aL=(e,t)=>{let n=0,r=e.length-1;for(;n<=r;){const o=ol((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},$3=(e,t)=>{const n=e.clients.get(t.client);return n!==void 0&&aL(n,t.clock)!==null},H3=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 V3(o.clock,id(o.len,i.clock+i.len-o.clock)):(r<n&&(t[r]=i),r++)}t.length=r})},G3=(e,t,n,r)=>{nd(e.clients,t,()=>[]).push(new V3(n,r))},lL=()=>new U3,cL=(e,t)=>{wr(e.restEncoder,t.clients.size),od(t.clients.entries()).sort((n,r)=>r[0]-n[0]).forEach(([n,r])=>{e.resetDsCurVal(),wr(e.restEncoder,n);const o=r.length;wr(e.restEncoder,o);for(let i=0;i<o;i++){const s=r[i];e.writeDsClock(s.clock),e.writeDsLen(s.len)}})},W3=a3,m0=class Qx extends mR{constructor({guid:t=QR(),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=W3(),this.guid=t,this.collectionid=n,this.share=new Map,this.store=new CL,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=l3(u=>{this.on("load",()=>{this.isLoaded=!0,u(this)})});const l=()=>l3(u=>{const d=h=>{(h===void 0||h===!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&&xr(t.parent.doc,n=>{n.subdocsLoaded.add(this)},null,!0),this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(od(this.subdocs).map(t=>t.guid))}transact(t,n=null){return xr(this,t,n)}get(t,n=Xo){const r=nd(this.share,t,()=>{const i=new n;return i._integrate(this,null),i}),o=r.constructor;if(n!==Xo&&o!==n)if(o===Xo){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,DL)}getText(t=""){return this.get(t,UL)}getMap(t=""){return this.get(t,S0)}getXmlElement(t=""){return this.get(t,k_)}getXmlFragment(t=""){return this.get(t,E0)}toJSON(){const t={};return this.share.forEach((n,r)=>{t[r]=n.toJSON()}),t}destroy(){this.isDestroyed=!0,od(this.subdocs).forEach(n=>n.destroy());const t=this._item;if(t!==null){this._item=null;const n=t.content;n.doc=new Qx({guid:this.guid,...n.opts,shouldLoad:!1}),n.doc._item=t,xr(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()}},uL=class{constructor(){this.restEncoder=Yb()}toUint8Array(){return il(this.restEncoder)}resetDsCurVal(){}writeDsClock(e){wr(this.restEncoder,e)}writeDsLen(e){wr(this.restEncoder,e)}},dL=class extends uL{writeLeftID(e){wr(this.restEncoder,e.client),wr(this.restEncoder,e.clock)}writeRightID(e){wr(this.restEncoder,e.client),wr(this.restEncoder,e.clock)}writeClient(e){wr(this.restEncoder,e)}writeInfo(e){Xb(this.restEncoder,e)}writeString(e){sd(this.restEncoder,e)}writeParentInfo(e){wr(this.restEncoder,e?1:0)}writeTypeRef(e){wr(this.restEncoder,e)}writeLen(e){wr(this.restEncoder,e)}writeAny(e){oh(this.restEncoder,e)}writeBuf(e){Yi(this.restEncoder,e)}writeJSON(e){sd(this.restEncoder,JSON.stringify(e))}writeKey(e){sd(this.restEncoder,e)}},fL=class{constructor(){this.restEncoder=Yb(),this.dsCurrVal=0}toUint8Array(){return il(this.restEncoder)}resetDsCurVal(){this.dsCurrVal=0}writeDsClock(e){const t=e-this.dsCurrVal;this.dsCurrVal=e,wr(this.restEncoder,t)}writeDsLen(e){e===0&&sl(),wr(this.restEncoder,e-1),this.dsCurrVal+=e}},hL=class extends fL{constructor(){super(),this.keyMap=new Map,this.keyClock=0,this.keyClockEncoder=new t0,this.clientEncoder=new wm,this.leftClockEncoder=new t0,this.rightClockEncoder=new t0,this.infoEncoder=new o3(Xb),this.stringEncoder=new YR,this.parentInfoEncoder=new o3(Xb),this.typeRefEncoder=new wm,this.lenEncoder=new wm}toUint8Array(){const e=Yb();return wr(e,0),Yi(e,this.keyClockEncoder.toUint8Array()),Yi(e,this.clientEncoder.toUint8Array()),Yi(e,this.leftClockEncoder.toUint8Array()),Yi(e,this.rightClockEncoder.toUint8Array()),Yi(e,il(this.infoEncoder)),Yi(e,this.stringEncoder.toUint8Array()),Yi(e,il(this.parentInfoEncoder)),Yi(e,this.typeRefEncoder.toUint8Array()),Yi(e,this.lenEncoder.toUint8Array()),Jb(e,il(this.restEncoder)),il(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){oh(this.restEncoder,e)}writeBuf(e){Yi(this.restEncoder,e)}writeJSON(e){oh(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)}},pL=(e,t,n,r)=>{r=id(r,t[0].id.clock);const o=cl(t,r);wr(e.restEncoder,t.length-o),e.writeClient(n),wr(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)},mL=(e,t,n)=>{const r=new Map;n.forEach((o,i)=>{Di(t,i)>o&&r.set(i,o)}),v0(t).forEach((o,i)=>{n.has(i)||r.set(i,0)}),wr(e.restEncoder,r.size),od(r.entries()).sort((o,i)=>i[0]-o[0]).forEach(([o,i])=>{pL(e,t.clients.get(o),o,i)})},gL=(e,t)=>mL(e,t.doc.store,t.beforeState),vL=class{constructor(){this.l=[]}},q3=()=>new vL,K3=(e,t)=>e.l.push(t),Y3=(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.")},X3=(e,t,n)=>r0(e.l,[t,n]),Rm=class{constructor(e,t){this.client=e,this.clock=t}},Lm=(e,t)=>e===t||e!==null&&t!==null&&e.client===t.client&&e.clock===t.clock,ro=(e,t)=>new Rm(e,t),yL=e=>{for(const[t,n]of e.doc.share.entries())if(n===e)return t;throw sl()},bL=class{constructor(e,t){this.ds=e,this.sv=t}},wL=(e,t)=>new bL(e,t),wQ=wL(lL(),new Map),dd=(e,t)=>t===void 0?!e.deleted:t.sv.has(e.id.client)&&(t.sv.get(e.id.client)||0)>e.id.clock&&!$3(t.ds,e.id),g0=(e,t)=>{const n=nd(e.meta,g0,rd),r=e.doc.store;n.has(t)||(t.sv.forEach((o,i)=>{o<Di(r,i)&&nc(e,ro(i,o))}),j3(e,t.ds,o=>{}),n.add(t))},CL=class{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}},v0=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},Z3=(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 sl()}n.push(t)},cl=(e,t)=>{let n=0,r=e.length-1,o=e[r],i=o.id.clock;if(i===t)return r;let s=ol(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=ol((n+r)/2)}throw sl()},kL=(e,t)=>{const n=e.clients.get(t.client);return n[cl(n,t.clock)]},y0=kL,b0=(e,t,n)=>{const r=cl(t,n),o=t[r];return o.id.clock<n&&o instanceof Xi?(t.splice(r+1,0,I_(e,o,n-o.id.clock)),r+1):r},nc=(e,t)=>{const n=e.doc.store.clients.get(t.client);return n[b0(e,n,t.clock)]},Q3=(e,t,n)=>{const r=t.clients.get(n.client),o=cl(r,n.clock),i=r[o];return n.clock!==i.id.clock+i.length-1&&i.constructor!==oc&&r.splice(o+1,0,I_(e,i,n.clock-i.id.clock+1)),i},SL=(e,t,n)=>{const r=e.clients.get(t.id.client);r[cl(r,t.id.clock)]=n},J3=(e,t,n,r,o)=>{if(r===0)return;const i=n+r;let s=b0(e,t,n),a;do a=t[s++],i<a.id.clock+a.length&&b0(e,t,i),o(a);while(s<t.length&&t[s].id.clock<i)},_L=class{constructor(e,t,n){this.doc=e,this.deleteSet=new U3,this.beforeState=v0(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}},e_=(e,t)=>t.deleteSet.clients.size===0&&!hR(t.afterState,(n,r)=>t.beforeState.get(r)!==n)?!1:(H3(t.deleteSet),gL(e,t),cL(e,t.deleteSet),!0),t_=(e,t,n)=>{const r=t._item;(r===null||r.id.clock<(e.beforeState.get(r.id.client)||0)&&!r.deleted)&&nd(e.changed,t,rd).add(n)},Mm=(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 Xi&&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},AL=(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=cl(i,a.clock),d=i[u];u<i.length&&d.id.clock<l;d=i[++u]){const h=i[u];if(a.clock+a.len<=h.id.clock)break;h instanceof Xi&&h.deleted&&!h.keep&&n(h)&&h.gc(t,!1)}}}},IL=(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=QS(o.length-1,1+cl(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+Mm(o,l)}})},n_=(e,t)=>{if(t<e.length){const n=e[t],r=n.doc,o=r.store,i=n.deleteSet,s=n._mergeStructs;try{H3(i),n.afterState=v0(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,h)=>d.path.length-h.path.length),a.push(()=>{X3(u._dEH,l,n)}))}),a.push(()=>r.emit("afterTransaction",[n,r])),a.push(()=>{n._needFormattingCleanup&&zL(n)})}),r0(a,[])}finally{r.gc&&AL(i,o,r.gcFilter),IL(i,o),n.afterState.forEach((d,h)=>{const p=n.beforeState.get(h)||0;if(p!==d){const v=o.clients.get(h),g=id(cl(v,p),1);for(let y=v.length-1;y>=g;)y-=1+Mm(v,y)}});for(let d=s.length-1;d>=0;d--){const{client:h,clock:p}=s[d].id,v=o.clients.get(h),g=cl(v,p);g+1<v.length&&Mm(v,g+1)>1||g>0&&Mm(v,g)}if(!n.local&&n.afterState.get(r.clientID)!==n.beforeState.get(r.clientID)&&(oL(h0,P3,"[yjs] ",D3,F3,"Changed the client-id because another client seems to be using it."),r.clientID=W3()),r.emit("afterTransactionCleanup",[n,r]),r._observers.has("update")){const d=new dL;e_(d,n)&&r.emit("update",[d.toUint8Array(),n.origin,r,n])}if(r._observers.has("updateV2")){const d=new hL;e_(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])):n_(e,t+1)}}},xr=(e,t,n=null,r=!0)=>{const o=e._transactionCleanups;let i=!1,s=null;e._transaction===null&&(i=!0,e._transaction=new _L(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&&n_(o,0)}}return s},r_="You must not compute changes after the event-handler fired.",Om=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=EL(this.currentTarget,this.target))}deletes(e){return $3(this.transaction.deleteSet,e.id)}get keys(){if(this._keys===null){if(this.transaction.doc._transactionCleanups.length===0)throw tc(r_);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=Wb(s.content.getContent());else return;else s!==null&&this.deletes(s)?(o="update",i=Wb(s.content.getContent())):(o="add",i=void 0)}else if(this.deletes(r))o="delete",i=Wb(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 tc(r_);const t=this.target,n=rd(),r=rd(),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}},EL=(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},li=()=>{iL("Invalid access: Add Yjs type to a document before reading data.")},o_=80,w0=0,TL=class{constructor(e,t){e.marker=!0,this.p=e,this.index=t,this.timestamp=w0++}},xL=e=>{e.timestamp=w0++},i_=(e,t,n)=>{e.p.marker=!1,e.p=t,t.marker=!0,e.index=n,e.timestamp=w0++},RL=(e,t,n)=>{if(e.length>=o_){const r=e.reduce((o,i)=>o.timestamp<i.timestamp?o:i);return i_(r,t,n),r}else{const r=new TL(t,n);return e.push(r),r}},Pm=(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)=>bm(t-i.index)<bm(t-s.index)?i:s);let r=e._start,o=0;for(n!==null&&(r=n.p,o=n.index,xL(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&&bm(n.index-o)<r.parent.length/o_?(i_(n,r,o),n):RL(e._searchMarker,r,o)},ch=(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=id(t,o.index+n))}},Dm=(e,t,n)=>{const r=e,o=t.changedParentTypes;for(;nd(o,e,()=>[]).push(n),e._item!==null;)e=e._item.parent;X3(r._eH,n,t)},Xo=class{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=q3(),this._dEH=q3(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(e,t){this.doc=e,this._item=t}_copy(){throw Ps()}clone(){throw Ps()}_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){K3(this._eH,e)}observeDeep(e){K3(this._dEH,e)}unobserve(e){Y3(this._eH,e)}unobserveDeep(e){Y3(this._dEH,e)}toJSON(){}},s_=(e,t,n)=>{e.doc??li(),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},a_=e=>{e.doc??li();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},uh=(e,t)=>{let n=0,r=e._start;for(e.doc??li();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}},l_=(e,t)=>{const n=[];return uh(e,(r,o)=>{n.push(t(r,o,e))}),n},LL=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}}}},c_=(e,t)=>{e.doc??li();const n=Pm(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}},Fm=(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 Xi(ro(s,Di(a,s)),o,o&&o.lastId,l,l&&l.id,t,null,new T0(u)),o.integrate(e,0),u=[])};r.forEach(h=>{if(h===null)u.push(h);else switch(h.constructor){case Number:case Object:case Boolean:case Array:case String:u.push(h);break;default:switch(d(),h.constructor){case Uint8Array:case ArrayBuffer:o=new Xi(ro(s,Di(a,s)),o,o&&o.lastId,l,l&&l.id,t,null,new __(new Uint8Array(h))),o.integrate(e,0);break;case m0:o=new Xi(ro(s,Di(a,s)),o,o&&o.lastId,l,l&&l.id,t,null,new A_(h)),o.integrate(e,0);break;default:if(h instanceof Xo)o=new Xi(ro(s,Di(a,s)),o,o&&o.lastId,l,l&&l.id,t,null,new pd(h)),o.integrate(e,0);else throw new Error("Unexpected content type in insert operation")}}}),d()},u_=()=>tc("Length exceeded!"),d_=(e,t,n,r)=>{if(n>t._length)throw u_();if(n===0)return t._searchMarker&&ch(t._searchMarker,n,r.length),Fm(e,t,null,r);const o=n,i=Pm(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&&nc(e,ro(s.id.client,s.id.clock+n));break}n-=s.length}return t._searchMarker&&ch(t._searchMarker,o,r.length),Fm(e,t,s,r)},ML=(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 Fm(e,t,r,n)},f_=(e,t,n,r)=>{if(r===0)return;const o=n,i=r,s=Pm(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&&nc(e,ro(a.id.client,a.id.clock+n)),n-=a.length);for(;r>0&&a!==null;)a.deleted||(r<a.length&&nc(e,ro(a.id.client,a.id.clock+r)),a.delete(e),r-=a.length),a=a.right;if(r>0)throw u_();t._searchMarker&&ch(t._searchMarker,o,-i+r)},Nm=(e,t,n)=>{const r=t._map.get(n);r!==void 0&&r.delete(e)},C0=(e,t,n,r)=>{const o=t._map.get(n)||null,i=e.doc,s=i.clientID;let a;if(r==null)a=new T0([r]);else switch(r.constructor){case Number:case Object:case Boolean:case Array:case String:case Date:case BigInt:a=new T0([r]);break;case Uint8Array:a=new __(r);break;case m0:a=new A_(r);break;default:if(r instanceof Xo)a=new pd(r);else throw new Error("Unexpected content type")}new Xi(ro(s,Di(i.store,s)),o,o&&o.lastId,null,null,t,n,a).integrate(e,0)},k0=(e,t)=>{e.doc??li();const n=e._map.get(t);return n!==void 0&&!n.deleted?n.content.getContent()[n.length-1]:void 0},h_=e=>{const t={};return e.doc??li(),e._map.forEach((n,r)=>{n.deleted||(t[r]=n.content.getContent()[n.length-1])}),t},p_=(e,t)=>{e.doc??li();const n=e._map.get(t);return n!==void 0&&!n.deleted},OL=(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&&dd(i,t)&&(n[o]=i.content.getContent()[i.length-1])}),n},Bm=e=>(e.doc??li(),sL(e._map.entries(),t=>!t[1].deleted)),PL=class extends Om{},DL=class Rv extends Xo{constructor(){super(),this._prelimContent=[],this._searchMarker=[]}static from(t){const n=new Rv;return n.push(t),n}_integrate(t,n){super._integrate(t,n),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new Rv}clone(){const t=new Rv;return t.insert(0,this.toArray().map(n=>n instanceof Xo?n.clone():n)),t}get length(){return this.doc??li(),this._length}_callObserver(t,n){super._callObserver(t,n),Dm(this,t,new PL(this,t))}insert(t,n){this.doc!==null?xr(this.doc,r=>{d_(r,this,t,n)}):this._prelimContent.splice(t,0,...n)}push(t){this.doc!==null?xr(this.doc,n=>{ML(n,this,t)}):this._prelimContent.push(...t)}unshift(t){this.insert(0,t)}delete(t,n=1){this.doc!==null?xr(this.doc,r=>{f_(r,this,t,n)}):this._prelimContent.splice(t,n)}get(t){return c_(this,t)}toArray(){return a_(this)}slice(t=0,n=this.length){return s_(this,t,n)}toJSON(){return this.map(t=>t instanceof Xo?t.toJSON():t)}map(t){return l_(this,t)}forEach(t){uh(this,t)}[Symbol.iterator](){return LL(this)}_write(t){t.writeTypeRef(qL)}},FL=class extends Om{constructor(e,t,n){super(e,t),this.keysChanged=n}},S0=class rw extends Xo{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 rw}clone(){const t=new rw;return this.forEach((n,r)=>{t.set(r,n instanceof Xo?n.clone():n)}),t}_callObserver(t,n){Dm(this,t,new FL(this,t,n))}toJSON(){this.doc??li();const t={};return this._map.forEach((n,r)=>{if(!n.deleted){const o=n.content.getContent()[n.length-1];t[r]=o instanceof Xo?o.toJSON():o}}),t}get size(){return[...Bm(this)].length}keys(){return p0(Bm(this),t=>t[0])}values(){return p0(Bm(this),t=>t[1].content.getContent()[t[1].length-1])}entries(){return p0(Bm(this),t=>[t[0],t[1].content.getContent()[t[1].length-1]])}forEach(t){this.doc??li(),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?xr(this.doc,n=>{Nm(n,this,t)}):this._prelimContent.delete(t)}set(t,n){return this.doc!==null?xr(this.doc,r=>{C0(r,this,t,n)}):this._prelimContent.set(t,n),n}get(t){return k0(this,t)}has(t){return p_(this,t)}clear(){this.doc!==null?xr(this.doc,t=>{this.forEach(function(n,r,o){Nm(t,o,r)})}):this._prelimContent.clear()}_write(t){t.writeTypeRef(KL)}},rc=(e,t)=>e===t||typeof e=="object"&&typeof t=="object"&&e&&t&&l7(e,t),_0=class{constructor(e,t,n,r){this.left=e,this.right=t,this.index=n,this.currentAttributes=r}forward(){this.right===null&&sl(),this.right.content.constructor===ci?this.right.deleted||fd(this.currentAttributes,this.right.content):this.right.deleted||(this.index+=this.right.length),this.left=this.right,this.right=this.right.right}},m_=(e,t,n)=>{for(;t.right!==null&&n>0;)t.right.content.constructor===ci?t.right.deleted||fd(t.currentAttributes,t.right.content):t.right.deleted||(n<t.right.length&&nc(e,ro(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},zm=(e,t,n,r)=>{const o=new Map,i=r?Pm(t,n):null;if(i){const s=new _0(i.p.left,i.p,i.index,o);return m_(e,s,n-i.index)}else{const s=new _0(null,t._start,0,o);return m_(e,s,n)}},g_=(e,t,n,r)=>{for(;n.right!==null&&(n.right.deleted===!0||n.right.content.constructor===ci&&rc(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 Xi(ro(i,Di(o.store,i)),l,l&&l.lastId,u,u&&u.id,t,null,new ci(a,s));d.integrate(e,0),n.right=d,n.forward()})},fd=(e,t)=>{const{key:n,value:r}=t;r===null?e.delete(n):e.set(n,r)},v_=(e,t)=>{for(;e.right!==null;){if(!(e.right.deleted||e.right.content.constructor===ci&&rc(t[e.right.content.key]??null,e.right.content.value)))break;e.forward()}},y_=(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(!rc(u,l)){s.set(a,u);const{left:d,right:h}=n;n.right=new Xi(ro(i,Di(o.store,i)),d,d&&d.lastId,h,h&&h.id,t,null,new ci(a,l)),n.right.integrate(e,0),n.forward()}}return s},A0=(e,t,n,r,o)=>{n.currentAttributes.forEach((p,v)=>{o[v]===void 0&&(o[v]=null)});const i=e.doc,s=i.clientID;v_(n,o);const a=y_(e,t,n,o),l=r.constructor===String?new hd(r):r instanceof Xo?new pd(r):new Vm(r);let{left:u,right:d,index:h}=n;t._searchMarker&&ch(t._searchMarker,n.index,l.getLength()),d=new Xi(ro(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=h,n.forward(),g_(e,t,n,a)},b_=(e,t,n,r,o)=>{const i=e.doc,s=i.clientID;v_(n,o);const a=y_(e,t,n,o);e:for(;n.right!==null&&(r>0||a.size>0&&(n.right.deleted||n.right.content.constructor===ci));){if(!n.right.deleted)switch(n.right.content.constructor){case ci:{const{key:l,value:u}=n.right.content,d=o[l];if(d!==void 0){if(rc(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&&nc(e,ro(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 Xi(ro(s,Di(i.store,s)),n.left,n.left&&n.left.lastId,n.right,n.right&&n.right.id,t,null,new hd(l)),n.right.integrate(e,0),n.forward()}g_(e,t,n,a)},w_=(e,t,n,r,o)=>{let i=t;const s=ua();for(;i&&(!i.countable||i.deleted);){if(!i.deleted&&i.content.constructor===ci){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===ci){const{key:d,value:h}=u,p=r.get(d)??null;(s.get(d)!==u||p===h)&&(t.delete(e),a++,!l&&(o.get(d)??null)===h&&p!==h&&(p===null?o.delete(d):o.set(d,p))),!l&&!t.deleted&&fd(o,u)}}t=t.right}return a},NL=(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===ci){const r=t.content.key;n.has(r)?t.delete(e):n.add(r)}t=t.left}},BL=e=>{let t=0;return xr(e.doc,n=>{let r=e._start,o=e._start,i=ua();const s=Gb(i);for(;o;)o.deleted===!1&&(o.content.constructor===ci?fd(s,o.content):(t+=w_(n,r,o,i,s),i=Gb(s),r=o)),o=o.right}),t},zL=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&&J3(e,n.store.clients.get(r),i,o,s=>{!s.deleted&&s.content.constructor===ci&&s.constructor!==oc&&t.add(s.parent)})}xr(n,r=>{j3(e,e.deleteSet,o=>{if(o instanceof oc||!o.parent._hasFormatting||t.has(o.parent))return;const i=o.parent;o.content.constructor===ci?t.add(i):NL(r,o)});for(const o of t)BL(o)})},C_=(e,t,n)=>{const r=n,o=Gb(t.currentAttributes),i=t.right;for(;n>0&&t.right!==null;){if(t.right.deleted===!1)switch(t.right.content.constructor){case pd:case Vm:case hd:n<t.right.length&&nc(e,ro(t.right.id.client,t.right.id.clock+n)),n-=t.right.length,t.right.delete(e);break}t.forward()}i&&w_(e,i,t.right,o,t.currentAttributes);const s=(t.left||t.right).parent;return s._searchMarker&&ch(s._searchMarker,t.index,-r+n),t},VL=class extends Om{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=[];xr(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 h=()=>{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((v,g)=>{v!==null&&(p.attributes[g]=v)}))),l="";break;case"retain":u>0&&(p={retain:u},a7(a)||(p.attributes=o7({},a))),u=0;break}p&&t.push(p),s=null}};for(;i!==null;){switch(i.content.constructor){case pd:case Vm:this.adds(i)?this.deletes(i)||(h(),s="insert",l=i.content.getContent()[0],h()):this.deletes(i)?(s!=="delete"&&(h(),s="delete"),d+=1):i.deleted||(s!=="retain"&&(h(),s="retain"),u+=1);break;case hd:this.adds(i)?this.deletes(i)||(s!=="insert"&&(h(),s="insert"),l+=i.content.str):this.deletes(i)?(s!=="delete"&&(h(),s="delete"),d+=i.length):i.deleted||(s!=="retain"&&(h(),s="retain"),u+=i.length);break;case ci:{const{key:p,value:v}=i.content;if(this.adds(i)){if(!this.deletes(i)){const g=r.get(p)??null;rc(g,v)?v!==null&&i.delete(n):(s==="retain"&&h(),rc(v,o.get(p)??null)?delete a[p]:a[p]=v)}}else if(this.deletes(i)){o.set(p,v);const g=r.get(p)??null;rc(g,v)||(s==="retain"&&h(),a[p]=g)}else if(!i.deleted){o.set(p,v);const g=a[p];g!==void 0&&(rc(g,v)?g!==null&&i.delete(n):(s==="retain"&&h(),v===null?delete a[p]:a[p]=v))}i.deleted||(s==="insert"&&h(),fd(r,i.content));break}}i=i.right}for(h();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}},UL=class ow extends Xo{constructor(t){super(),this._pending=t!==void 0?[()=>this.insert(0,t)]:[],this._searchMarker=[],this._hasFormatting=!1}get length(){return this.doc??li(),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 ow}clone(){const t=new ow;return t.applyDelta(this.toDelta()),t}_callObserver(t,n){super._callObserver(t,n);const r=new VL(this,t,n);Dm(this,t,r),!t.local&&this._hasFormatting&&(t._needFormattingCleanup=!0)}toString(){this.doc??li();let t="",n=this._start;for(;n!==null;)!n.deleted&&n.countable&&n.content.constructor===hd&&(t+=n.content.str),n=n.right;return t}toJSON(){return this.toString()}applyDelta(t,{sanitize:n=!0}={}){this.doc!==null?xr(this.doc,r=>{const o=new _0(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
|
`,sE=()=>{if(typeof document>"u")throw new Error(r$)},Fs=class s5{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 s5(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=ze._getRotation(l.rotation),l}},o$="[object Array]",i$="[object Number]",s$="[object String]",a$="[object Boolean]",l$=Math.PI/180,c$=180/Math.PI,Th="#",u$="",d$="0",f$="Konva warning: ",aE="Konva error: ",h$="rgb(",N1={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]},p$=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/,pg=[],xh=null,m$=typeof requestAnimationFrame<"u"&&requestAnimationFrame||function(e){setTimeout(e,16)},ze={_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)===o$},_isNumber(e){return Object.prototype.toString.call(e)===i$&&!isNaN(e)&&isFinite(e)},_isString(e){return Object.prototype.toString.call(e)===s$},_isBoolean(e){return Object.prototype.toString.call(e)===a$},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){pg.push(e),pg.length===1&&m$(function(){const t=pg;pg=[],t.forEach(function(n){n()})})},createCanvasElement(){sE();const e=document.createElement("canvas");try{e.style=e.style||{}}catch{}return e},createImageElement(){return sE(),document.createElement("img")},_isInDocument(e){for(;e=e.parentNode;)if(e==document)return!0;return!1},_urlToImage(e,t){const n=ze.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(Th,u$);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=d$+e;return Th+e},isCanvasFarblingActive(){if(xh!==null)return xh;if(typeof document>"u")return xh=!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 xh=r,this.releaseCanvas(e),xh},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),Th+this._rgbToHex(e,t,n)},getSnappedHexColor(e){const t=this._hexToRgb(e);return Th+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 N1?(t=N1[e],{r:t[0],g:t[1],b:t[2]}):e[0]===Th?this._hexToRgb(e.substring(1)):e.substr(0,4)===h$?(t=p$.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",ze._namedColorToRBA(e)||ze._hex3ColorToRGBA(e)||ze._hex4ColorToRGBA(e)||ze._hex6ColorToRGBA(e)||ze._hex8ColorToRGBA(e)||ze._rgbColorToRGBA(e)||ze._rgbaColorToRGBA(e)||ze._hslColorToRGBA(e)},_namedColorToRBA(e){const t=N1[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 h=0;h<3;h++)a=r+1/3*-(h-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[h]=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*l$},radToDeg(e){return e*c$},_degToRad(e){return ze.warn("Util._degToRad is removed. Please use public Util.degToRad instead."),ze.degToRad(e)},_radToDeg(e){return ze.warn("Util._radToDeg is removed. Please use public Util.radToDeg instead."),ze.radToDeg(e)},_getRotation(e){return Mt.angleDeg?ze.radToDeg(e):e},_capitalize(e){return e.charAt(0).toUpperCase()+e.slice(1)},throw(e){throw new Error(aE+e)},error(e){console.error(aE+e)},warn(e){Mt.showWarnings&&console.warn(f$+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=ze.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=ze._getProjectionToSegment(i.x,i.y,a.x,a.y,e.x,e.y),u=l[0],d=l[1],h=l[2];h<o&&(r.x=u,r.y=d,o=h)}),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=ze._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||ze._isElement(e[n]))if(t.configurable)delete e[n];else return null;else if(ze._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){Mt.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},h=Math.hypot(u.x,u.y),p=Math.hypot(d.x,d.y);let v;typeof o=="number"?v=o:v=i<o.length?o[i]:0,v=r*Math.cos(Math.PI/n)*Math.min(1,v/r*2);const g={x:u.x/h,y:u.y/h},y={x:d.x/p,y:d.y/p},_={x:a.x-g.x*v,y:a.y-g.y*v},w={x:a.x+y.x*v,y:a.y+y.y*v};i===0?e.moveTo(_.x,_.y):e.lineTo(_.x,_.y),e.arcTo(a.x,a.y,w.x,w.y,v)}}};function g$(e){const t=[],n=e.length,r=ze;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 lE=",",v$="(",y$=")",b$="([",w$="])",C$=";",k$="()",S$="=",cE=["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"],_$=["fillStyle","strokeStyle","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY","letterSpacing","lineCap","lineDashOffset","lineJoin","lineWidth","miterLimit","direction","font","textAlign","textBaseline","globalAlpha","globalCompositeOperation","imageSmoothingEnabled","filter"],A$=100,mg=null;function uE(){if(mg!==null)return mg;try{const e=ze.createCanvasElement().getContext("2d");return e?!!e&&"filter"in e:(mg=!1,!1)}catch{return mg=!1,!1}}var gg=class{constructor(e){this.canvas=e,Mt.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+=k$:ze._isArray(l[0])?o+=b$+l.join(lE)+w$:(t&&(l=l.map(u=>typeof u=="number"?Math.floor(u):u)),o+=v$+l.join(lE)+y$)):(o+=s.property,e||(o+=S$+s.val)),o+=C$;return o}clearTrace(){this.traceArr=[]}_trace(e){let t=this.traceArr,n;t.push(e),n=t.length,n>=A$&&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=cE.length,n=this.setAttr,r,o;const i=function(s){let a=e[s],l;e[s]=function(){return o=g$(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(cE[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)}};_$.forEach(function(e){Object.defineProperty(gg.prototype,e,{get(){return this._context[e]},set(t){this._context[e]=t}})});var I$=class extends gg{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)}},E$=class extends gg{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()}}},vg;function T$(){if(vg)return vg;const e=ze.createCanvasElement(),t=e.getContext("2d");return vg=(function(){return(Mt._global.devicePixelRatio||1)/(t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1)})(),ze.releaseCanvas(e),vg}var B1=class{constructor(e){this.pixelRatio=1,this.width=0,this.height=0,this.isCache=!1;const t=(e||{}).pixelRatio||Mt.pixelRatio||T$();this.pixelRatio=t,this._canvas=ze.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 ze.error("Unable to get data URL. "+r.message+" For more info read https://konvajs.org/docs/posts/Tainted_Canvas.html."),""}}}},hc=class extends B1{constructor(e={width:0,height:0,willReadFrequently:!1}){super(e),this.context=new I$(this,{willReadFrequently:e.willReadFrequently}),this.setSize(e.width,e.height)}},z1=class extends B1{constructor(e={width:0,height:0}){super(e),this.hitCanvas=!0,this.context=new E$(this),this.setSize(e.width,e.height)}},Qn={get isDragging(){let e=!1;return Qn._dragElements.forEach(t=>{t.dragStatus==="dragging"&&(e=!0)}),e},justDragged:!1,get node(){let e;return Qn._dragElements.forEach(t=>{e=t.node}),e},_dragElements:new Map,_drag(e){const t=[];Qn._dragElements.forEach((n,r)=>{const{node:o}=n,i=o.getStage();i.setPointersPositions(e),n.pointerId===void 0&&(n.pointerId=ze._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=[];Qn._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")&&(Qn.justDragged=!0,Mt._mouseListenClick=!1,Mt._touchListenClick=!1,Mt._pointerListenClick=!1,n.dragStatus="stopped");const i=n.node.getLayer()||n.node instanceof Mt.Stage&&n.node;i&&t.indexOf(i)===-1&&t.push(i)}),t.forEach(n=>{n.draw()})},_endDragAfter(e){Qn._dragElements.forEach((t,n)=>{t.dragStatus==="stopped"&&t.node.fire("dragend",{type:"dragend",target:t.node,evt:e},!0),t.dragStatus!=="dragging"&&Qn._dragElements.delete(n)})}};Mt.isBrowser&&(window.addEventListener("mouseup",Qn._endDragBefore,!0),window.addEventListener("touchend",Qn._endDragBefore,!0),window.addEventListener("touchcancel",Qn._endDragBefore,!0),window.addEventListener("mousemove",Qn._drag),window.addEventListener("touchmove",Qn._drag),window.addEventListener("mouseup",Qn._endDragAfter,!1),window.addEventListener("touchend",Qn._endDragAfter,!1),window.addEventListener("touchcancel",Qn._endDragAfter,!1));function pc(e){return ze._isString(e)?'"'+e+'"':Object.prototype.toString.call(e)==="[object Number]"||ze._isBoolean(e)?e:Object.prototype.toString.call(e)}function dE(e){return e>255?255:e<0?0:Math.round(e)}function Tt(){if(Mt.isUnminified)return function(e,t){return ze._isNumber(e)||ze.warn(pc(e)+' is a not valid value for "'+t+'" attribute. The value should be a number.'),e}}function yg(e){if(Mt.isUnminified)return function(t,n){let r=ze._isNumber(t),o=ze._isArray(t)&&t.length==e;return!r&&!o&&ze.warn(pc(t)+' is a not valid value for "'+n+'" attribute. The value should be a number or Array<number>('+e+")"),t}}function V1(){if(Mt.isUnminified)return function(e,t){return ze._isNumber(e)||e==="auto"||ze.warn(pc(e)+' is a not valid value for "'+t+'" attribute. The value should be a number or "auto".'),e}}function du(){if(Mt.isUnminified)return function(e,t){return ze._isString(e)||ze.warn(pc(e)+' is a not valid value for "'+t+'" attribute. The value should be a string.'),e}}function fE(){if(Mt.isUnminified)return function(e,t){const n=ze._isString(e),r=Object.prototype.toString.call(e)==="[object CanvasGradient]"||e&&e.addColorStop;return n||r||ze.warn(pc(e)+' is a not valid value for "'+t+'" attribute. The value should be a string or a native gradient.'),e}}function x$(){if(Mt.isUnminified)return function(e,t){const n=Int8Array?Object.getPrototypeOf(Int8Array):null;return n&&e instanceof n||(ze._isArray(e)?e.forEach(function(r){ze._isNumber(r)||ze.warn('"'+t+'" attribute has non numeric element '+r+". Make sure that all elements are numbers.")}):ze.warn(pc(e)+' is a not valid value for "'+t+'" attribute. The value should be a array of numbers.')),e}}function Ns(){if(Mt.isUnminified)return function(e,t){return e===!0||e===!1||ze.warn(pc(e)+' is a not valid value for "'+t+'" attribute. The value should be a boolean.'),e}}function R$(e){if(Mt.isUnminified)return function(t,n){return t==null||ze.isObject(t)||ze.warn(pc(t)+' is a not valid value for "'+n+'" attribute. The value should be an object with properties '+e),t}}var Rh="get",Lh="set",ve={addGetterSetter(e,t,n,r,o){ve.addGetter(e,t,n),ve.addSetter(e,t,r,o),ve.addOverloadedGetterSetter(e,t)},addGetter(e,t,n){const r=Rh+ze._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=Lh+ze._capitalize(t);e.prototype[o]||ve.overWriteSetter(e,t,n,r)},overWriteSetter(e,t,n,r){const o=Lh+ze._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=ze._capitalize,a=Rh+s(t),l=Lh+s(t);e.prototype[a]=function(){const d={};for(let h=0;h<i;h++){const p=n[h];d[p]=this.getAttr(t+s(p))}return d};const u=R$(n);e.prototype[l]=function(d){const h=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,h,d),o&&o.call(this),this},ve.addOverloadedGetterSetter(e,t)},addOverloadedGetterSetter(e,t){const n=ze._capitalize(t),r=Lh+n,o=Rh+n;e.prototype[t]=function(){return arguments.length?(this[r](arguments[0]),this):this[o]()}},addDeprecatedGetterSetter(e,t,n,r){ze.error("Adding deprecated "+t);const o=Rh+ze._capitalize(t),i=t+" property is deprecated and will be removed soon. Look at Konva change log for more information.";e.prototype[o]=function(){ze.error(i);const s=this.attrs[t];return s===void 0?n:s},ve.addSetter(e,t,r,function(){ze.error(i)}),ve.addOverloadedGetterSetter(e,t)},backCompat(e,t){ze.each(t,function(n,r){const o=e.prototype[r],i=Rh+ze._capitalize(n),s=Lh+ze._capitalize(n);function a(){o.apply(this,arguments),ze.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 L$(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=Mt.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=Mt.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=Mt.Filters;l&&l.Contrast&&l.Contrast.call(this,s)}}case"grayscale":return function(i){const s=Mt.Filters;s&&s.Grayscale&&s.Grayscale.call(this,i)};case"sepia":return function(i){const s=Mt.Filters;s&&s.Sepia&&s.Sepia.call(this,i)};case"invert":return function(i){const s=Mt.Filters;s&&s.Invert&&s.Invert.call(this,i)};default:ze.warn(`CSS filter "${r}" is not supported in fallback mode. Consider using function filters for better compatibility.`);break}}return()=>{}}var bg="absoluteOpacity",hE="allEventListeners",vl="absoluteTransform",pE="absoluteScale",fu="canvas",M$="Change",O$="children",P$="konva",U1="listening",D$="mouseenter",F$="mouseleave",N$="pointerenter",B$="pointerleave",z$="touchenter",V$="touchleave",mE="set",gE="Shape",wg=" ",vE="stage",mc="transform",U$="Stage",j1="visible",j$=["xChange.konva","yChange.konva","scaleXChange.konva","scaleYChange.konva","skewXChange.konva","skewYChange.konva","rotationChange.konva","offsetXChange.konva","offsetYChange.konva","transformsEnabledChange.konva"].join(wg),$$=1,Ot=class hp{constructor(t){this._id=$$++,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===mc||t===vl)&&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===mc||t===vl)&&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(wg);this.on(o,()=>{this._clearCache(t)}),this._attachedDepsListeners.set(t,!0)}return this._getCache(t,r)}_getCanvasCache(){return this._cache.get(fu)}_clearSelfAndDescendantCache(t){this._clearCache(t),t===vl&&this.fire("absoluteTransformChange")}clearCache(){if(this._cache.has(fu)){const{scene:t,filter:n,hit:r}=this._cache.get(fu);ze.releaseCanvas(t._canvas,n._canvas,r._canvas),this._cache.delete(fu)}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,h=n.hitCanvasPixelRatio||1;if(!o||!i){ze.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,v=Math.abs(Math.round(r.y)-l)>.5?1:0;o+=u*2+p,i+=u*2+v,a-=u,l-=u;const g=new hc({pixelRatio:s,width:o,height:i}),y=new hc({pixelRatio:s,width:0,height:0,willReadFrequently:!0}),_=new z1({pixelRatio:h,width:o,height:i}),w=g.getContext(),I=_.getContext(),k=new hc({width:g.width/g.pixelRatio+Math.abs(a),height:g.height/g.pixelRatio+Math.abs(l),pixelRatio:g.pixelRatio}),C=k.getContext();return _.isCache=!0,g.isCache=!0,this._cache.delete(fu),this._filterUpToDate=!1,n.imageSmoothingEnabled===!1&&(g.getContext()._context.imageSmoothingEnabled=!1,y.getContext()._context.imageSmoothingEnabled=!1),w.save(),I.save(),C.save(),w.translate(-a,-l),I.translate(-a,-l),C.translate(-a,-l),k.x=a,k.y=l,this._isUnderCache=!0,this._clearSelfAndDescendantCache(bg),this._clearSelfAndDescendantCache(pE),this.drawScene(g,this,k),this.drawHit(_,this),this._isUnderCache=!1,w.restore(),I.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()),ze.releaseCanvas(k._canvas),this._cache.set(fu,{scene:g,filter:y,hit:_,x:a,y:l}),this._requestDraw(),this}isCached(){return this._cache.has(fu)}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"&&uE(),typeof t[p]!="string"||!uE()){d=!1;break}const h=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()/h,r.getHeight()/h),i.restore(),this._filterUpToDate=!0,o}try{for(s=t.length,i.clear(),i.drawImage(r._canvas,0,0,r.getWidth()/h,r.getHeight()/h),a=i.getImageData(0,0,o.getWidth(),o.getHeight()),l=0;l<s;l++)u=t[l],typeof u=="string"&&(u=L$(u)),u.call(this,a),i.putImageData(a,0,0)}catch(p){ze.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(hE),t.length===3)return this._delegate.apply(this,t);const o=n.split(wg);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(wg),o=r.length,i,s,a,l,u,d;if(this._cache&&this._cache.delete(hE),!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=ze.cloneObject(i),i.currentTarget=s[a],r.call(s[a],i)}),this}remove(){return this.isDragging()&&this.stopDrag(),Qn._dragElements.delete(this._id),Qn._dragElements.forEach((t,n)=>{this.isAncestorOf(t.node)&&Qn._dragElements.delete(n)}),this._remove(),this}_clearCaches(){this._clearSelfAndDescendantCache(vl),this._clearSelfAndDescendantCache(bg),this._clearSelfAndDescendantCache(pE),this._clearSelfAndDescendantCache(vE),this._clearSelfAndDescendantCache(j1),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"+ze._capitalize(t);return ze._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!==O$&&(r=mE+ze._capitalize(n),ze._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(j1,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;Qn._dragElements.forEach(s=>{s.dragStatus==="dragging"&&(s.node.nodeType==="Stage"||s.node.getLayer()===r)&&(o=!0)});const i=!n&&!Mt.hitOnDragEnabled&&(o||Mt.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!==gE&&(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!==U$&&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(mc),this._clearSelfAndDescendantCache(vl)),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 Fs,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(mc);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(mc),this._clearSelfAndDescendantCache(vl),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 ze.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 ze.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 ze.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 ze.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 ze.warn("Node has no parent. zIndex parameter is ignored."),this;(t<0||t>=this.parent.children.length)&&ze.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(bg,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=ze.isObject(r)&&!ze._isPlainObject(r)&&!ze._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 ze._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],ze.isValidSelector(i)||(ze.warn('Selector "'+i+'" is invalid. Allowed selectors examples are "#foo", ".bar" or "Group".'),ze.warn('If you have a custom shape with such className, please change it to start with upper letter like "Triangle".'),ze.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(vE,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(vl,this._getAbsoluteTransform)}_getAbsoluteTransform(t){let n;if(t)return n=new Fs,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(vl)||new Fs,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(mc,this._getTransform)}_getTransform(){var t,n;const r=this._cache.get(mc)||new Fs;r.reset();const o=this.x(),i=this.y(),s=Mt.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,h=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),(h!==0||p!==0)&&r.translate(-1*h,-1*p),r.dirty=!1,r}clone(t){let n=ze.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(P$)<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 hc({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 hc({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,ze._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():Mt.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+M$,{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[mE+ze._capitalize(t)];return ze._isFunction(r)?r.call(this,n):this._setAttr(t,n),this}_requestDraw(){if(Mt.autoDrawEnabled){const t=this.getLayer()||this.getStage();t?.batchDraw()}}_setAttr(t,n){const r=this.attrs[t];r===n&&!ze.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===gE&&(n.target=this);const o=[D$,F$,N$,B$,z$,V$];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=hp.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,hp.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;Qn._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){Qn._dragElements.has(this._id)||this._createDragElement(t);const r=Qn._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:ze.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=Qn._dragElements.get(this._id);n&&(n.dragStatus="stopped"),Qn._endDragBefore(t),Qn._endDragAfter(t)}setDraggable(t){this._setAttr("draggable",t),this._dragChange()}isDragging(){const t=Qn._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||Mt.dragButtons.indexOf(t.evt.button)>=0)||this.isDragging())return;let n=!1;Qn._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=Qn._dragElements.get(this._id),n=t&&t.dragStatus==="dragging",r=t&&t.dragStatus==="ready";n?this.stopDrag():r&&Qn._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 ze.haveIntersection(r,this.getClientRect())}static create(t,n){return ze._isString(t)&&(t=JSON.parse(t)),this._createNode(t,n)}static _createNode(t,n){let r=hp.prototype.getClassName.call(t),o=t.children,i,s,a;n&&(t.attrs.container=n),Mt[r]||(ze.warn('Can not find a node with class name "'+r+'". Fallback to "Shape".'),r="Shape");const l=Mt[r];if(i=new l(t.attrs),o)for(s=o.length,a=0;a<s;a++)i.add(hp._createNode(o[a]));return i}};Ot.protoListenerMap=new Map,Ot.prototype.nodeType="Node",Ot.prototype._attrsAffectingSize=[],Ot.prototype.eventListeners={},Ot.prototype.on(j$,function(){if(this._batchingTransformChange){this._needClearTransformCache=!0;return}this._clearCache(mc),this._clearSelfAndDescendantCache(vl)}),Ot.prototype.on("visibleChange.konva",function(){this._clearSelfAndDescendantCache(j1)}),Ot.prototype.on("listeningChange.konva",function(){this._clearSelfAndDescendantCache(U1)}),Ot.prototype.on("opacityChange.konva",function(){this._clearSelfAndDescendantCache(bg)});var kr=ve.addGetterSetter;kr(Ot,"zIndex"),kr(Ot,"absolutePosition"),kr(Ot,"position"),kr(Ot,"x",0,Tt()),kr(Ot,"y",0,Tt()),kr(Ot,"globalCompositeOperation","source-over",du()),kr(Ot,"opacity",1,Tt()),kr(Ot,"name","",du()),kr(Ot,"id","",du()),kr(Ot,"rotation",0,Tt()),ve.addComponentsGetterSetter(Ot,"scale",["x","y"]),kr(Ot,"scaleX",1,Tt()),kr(Ot,"scaleY",1,Tt()),ve.addComponentsGetterSetter(Ot,"skew",["x","y"]),kr(Ot,"skewX",0,Tt()),kr(Ot,"skewY",0,Tt()),ve.addComponentsGetterSetter(Ot,"offset",["x","y"]),kr(Ot,"offsetX",0,Tt()),kr(Ot,"offsetY",0,Tt()),kr(Ot,"dragDistance",void 0,Tt()),kr(Ot,"width",0,Tt()),kr(Ot,"height",0,Tt()),kr(Ot,"listening",!0,Ns()),kr(Ot,"preventDefault",!0,Ns()),kr(Ot,"filters",void 0,function(e){return this._filterUpToDate=!1,e}),kr(Ot,"visible",!0,Ns()),kr(Ot,"transformsEnabled","all",du()),kr(Ot,"size"),kr(Ot,"dragBoundFunc"),kr(Ot,"draggable",!1,Ns()),ve.backCompat(Ot,{rotateDeg:"rotate",setRotationDeg:"setRotation",getRotationDeg:"getRotation"});var Ji=class extends Ot{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=Ot.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=Ot.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 v=p.getMatrix();i.transform(v[0],v[1],v[2],v[3],v[4],v[5]),i.beginPath();let g;if(l)g=l.call(this,i,this);else{const y=this.clipX(),_=this.clipY();i.rect(y||0,_||0,s,a)}i.clip.apply(i,g),v=p.copy().invert().getMatrix(),i.transform(v[0],v[1],v[2],v[3],v[4],v[5])}const h=!d&&this.globalCompositeOperation()!=="source-over"&&e==="drawScene";h&&(i.save(),i._applyGlobalCompositeOperation(this)),(o=this.children)===null||o===void 0||o.forEach(function(p){p[e](t,n,r)}),h&&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 v=p.getClientRect({relativeTo:u,skipShadow:e.skipShadow,skipStroke:e.skipStroke});v.width===0&&v.height===0||(o===void 0?(o=v.x,i=v.y,s=v.x+v.width,a=v.y+v.height):(o=Math.min(o,v.x),i=Math.min(i,v.y),s=Math.max(s,v.x+v.width),a=Math.max(a,v.y+v.height)))});const d=this.find("Shape");let h=!1;for(let p=0;p<d.length;p++)if(d[p]._isVisible(this)){h=!0;break}return h&&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)}};ve.addComponentsGetterSetter(Ji,"clip",["x","y","width","height"]),ve.addGetterSetter(Ji,"clipX",void 0,Tt()),ve.addGetterSetter(Ji,"clipY",void 0,Tt()),ve.addGetterSetter(Ji,"clipWidth",void 0,Tt()),ve.addGetterSetter(Ji,"clipHeight",void 0,Tt()),ve.addGetterSetter(Ji,"clipFunc");var Mh=new Map,yE=Mt._global.PointerEvent!==void 0;function $1(e){return Mh.get(e)}function H1(e){return{evt:e,pointerId:e.pointerId}}function bE(e,t){return Mh.get(e)===t}function wE(e,t){Oh(e),t.getStage()&&(Mh.set(e,t),yE&&t._fire("gotpointercapture",H1(new PointerEvent("gotpointercapture"))))}function Oh(e,t){const n=Mh.get(e);if(!n)return;const r=n.getStage();r&&r.content,Mh.delete(e),yE&&n._fire("lostpointercapture",H1(new PointerEvent("lostpointercapture")))}var H$="Stage",G$="string",CE="px",W$="mouseout",kE="mouseleave",SE="mouseover",_E="mouseenter",AE="mousemove",IE="mousedown",EE="mouseup",Ph="pointermove",Dh="pointerdown",Od="pointerup",Fh="pointercancel",q$="lostpointercapture",Cg="pointerout",Nh="pointerleave",kg="pointerover",Sg="pointerenter",G1="contextmenu",TE="touchstart",xE="touchend",RE="touchmove",LE="touchcancel",W1="wheel",K$=5,Y$=[[_E,"_pointerenter"],[IE,"_pointerdown"],[AE,"_pointermove"],[EE,"_pointerup"],[kE,"_pointerleave"],[TE,"_pointerdown"],[RE,"_pointermove"],[xE,"_pointerup"],[LE,"_pointercancel"],[SE,"_pointerover"],[W1,"_wheel"],[G1,"_contextmenu"],[Dh,"_pointerdown"],[Ph,"_pointermove"],[Od,"_pointerup"],[Fh,"_pointercancel"],[Nh,"_pointerleave"],[q$,"_lostpointercapture"]],q1={mouse:{[Cg]:W$,[Nh]:kE,[kg]:SE,[Sg]:_E,[Ph]:AE,[Dh]:IE,[Od]:EE,[Fh]:"mousecancel",pointerclick:"click",pointerdblclick:"dblclick"},touch:{[Cg]:"touchout",[Nh]:"touchleave",[kg]:"touchover",[Sg]:"touchenter",[Ph]:RE,[Dh]:TE,[Od]:xE,[Fh]:LE,pointerclick:"tap",pointerdblclick:"dbltap"},pointer:{[Cg]:Cg,[Nh]:Nh,[kg]:kg,[Sg]:Sg,[Ph]:Ph,[Dh]:Dh,[Od]:Od,[Fh]:Fh,pointerclick:"pointerclick",pointerdblclick:"pointerdblclick"}},Bh=e=>e.indexOf("pointer")>=0?"pointer":e.indexOf("touch")>=0?"touch":"mouse",Pd=e=>{const t=Bh(e);if(t==="pointer")return Mt.pointerEventsEnabled&&q1.pointer;if(t==="touch")return q1.touch;if(t==="mouse")return q1.mouse};function ME(e={}){return(e.clipFunc||e.clipWidth||e.clipHeight)&&ze.warn("Stage does not support clipping. Please use clip for Layers or Groups."),e}var X$="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);",zh=[],_g=class extends Ji{constructor(e){super(ME(e)),this._pointerPositions=[],this._changedPointerPositions=[],this._buildDOM(),this._bindContentEvents(),zh.push(this),this.on("widthChange.konva heightChange.konva",this._resizeDOM),this.on("visibleChange.konva",this._checkVisibility),this.on("clipWidthChange.konva clipHeightChange.konva clipFuncChange.konva",()=>{ME(this.attrs)}),this._checkVisibility()}_validateAdd(e){const t=e.getType()==="Layer",n=e.getType()==="FastLayer";t||n||ze.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===G$){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"),Ji.prototype.clone.call(this,e)}destroy(){super.destroy();const e=this.content;e&&ze._isInDocument(e)&&this.container().removeChild(e);const t=zh.indexOf(this);return t>-1&&zh.splice(t,1),ze.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}:(ze.warn(X$),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 hc({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+CE,this.content.style.height=t+CE),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>K$&&ze.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(),Mt.isBrowser&&this.content.appendChild(e.canvas._canvas),this}getParent(){return null}getLayer(){return null}hasPointerCapture(e){return bE(e,this)}setPointerCapture(e){wE(e,this)}releaseCapture(e){Oh(e,this)}getLayers(){return this.children}_bindContentEvents(){Mt.isBrowser&&Y$.forEach(([e,t])=>{this.content.addEventListener(e,n=>{this[t](n)},{passive:!1})})}_pointerenter(e){this.setPointersPositions(e);const t=Pd(e.type);t&&this._fire(t.pointerenter,{evt:e,target:this,currentTarget:this})}_pointerover(e){this.setPointersPositions(e);const t=Pd(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=Pd(e.type),n=Bh(e.type);if(!t)return;this.setPointersPositions(e);const r=this._getTargetShape(n),o=!(Mt.isDragging()||Mt.isTransforming())||Mt.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=Pd(e.type),n=Bh(e.type);if(!t)return;this.setPointersPositions(e);let r=!1;this._changedPointerPositions.forEach(o=>{const i=this.getIntersection(o);if(Qn.justDragged=!1,Mt["_"+n+"ListenClick"]=!0,!i||!i.isListening()){this[n+"ClickStartShape"]=void 0;return}Mt.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=Pd(e.type),n=Bh(e.type);if(!t)return;const r=e.type.indexOf("touch")>=0||e.pointerType==="touch";if(Mt.isDragging()&&Qn.node.preventDefault()&&e.cancelable&&r&&e.preventDefault(),this.setPointersPositions(e),!(!(Mt.isDragging()||Mt.isTransforming())||Mt.hitOnDragEnabled))return;const o={};let i=!1;const s=this._getTargetShape(n);this._changedPointerPositions.forEach(a=>{const l=$1(a.id)||this.getIntersection(a),u=a.id,d={evt:e,pointerId:u},h=s!==l;if(h&&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,h&&(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=Pd(e.type),n=Bh(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=$1(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 h=!1;Mt["_"+n+"InDblClickWindow"]?(h=!0,clearTimeout(this[n+"DblTimeout"])):Qn.justDragged||(Mt["_"+n+"InDblClickWindow"]=!0,clearTimeout(this[n+"DblTimeout"])),this[n+"DblTimeout"]=setTimeout(function(){Mt["_"+n+"InDblClickWindow"]=!1},Mt.dblClickWindow),l&&l.isListening()?(s=!0,this[n+"ClickEndShape"]=l,l._fireAndBubble(t.pointerup,{...d}),Mt["_"+n+"ListenClick"]&&r&&r===l&&(l._fireAndBubble(t.pointerclick,{...d}),h&&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),Mt["_"+n+"ListenClick"]&&this._fire(t.pointerclick,{evt:e,target:this,currentTarget:this,pointerId:u}),h&&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}),Mt["_"+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(G1,{evt:e}):this._fire(G1,{evt:e,target:this,currentTarget:this})}_wheel(e){this.setPointersPositions(e);const t=this.getIntersection(this.getPointerPosition());t&&t.isListening()?t._fireAndBubble(W1,{evt:e}):this._fire(W1,{evt:e,target:this,currentTarget:this})}_pointercancel(e){this.setPointersPositions(e);const t=$1(e.pointerId)||this.getIntersection(this.getPointerPosition());t&&t._fireAndBubble(Od,H1(e)),Oh(e.pointerId)}_lostpointercapture(e){Oh(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:ze._getFirstPointerId(e)}],this._changedPointerPositions=[{x:n,y:r,id:ze._getFirstPointerId(e)}])}_setPointerPosition(e){ze.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 hc({width:this.width(),height:this.height()}),this.bufferHitCanvas=new z1({pixelRatio:1,width:this.width(),height:this.height()}),!Mt.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 ze.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}};_g.prototype.nodeType=H$,Xr(_g),ve.addGetterSetter(_g,"container"),Mt.isBrowser&&document.addEventListener("visibilitychange",()=>{zh.forEach(e=>{e.batchDraw()})});var OE="hasShadow",PE="shadowRGBA",DE="patternImage",FE="linearGradient",NE="radialGradient",Ag;function K1(){return Ag||(Ag=ze.createCanvasElement().getContext("2d"),Ag)}var Vh={};function Z$(e){const t=this.attrs.fillRule;t?e.fill(t):e.fill()}function Q$(e){e.stroke()}function J$(e){const t=this.attrs.fillRule;t?e.fill(t):e.fill()}function eH(e){e.stroke()}function tH(){this._clearCache(OE)}function nH(){this._clearCache(PE)}function rH(){this._clearCache(DE)}function oH(){this._clearCache(FE)}function iH(){this._clearCache(NE)}var _t=class extends Ot{constructor(e){super(e);let t,n=0;for(;t=ze.getHitColor(),!(t&&!(t in Vh));)if(n++,n>=1e4){ze.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=ze.getRandomColor();break}this.colorKey=t,Vh[t]=this}getContext(){return ze.warn("shape.getContext() method is deprecated. Please do not use it."),this.getLayer().getContext()}getCanvas(){return ze.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(OE,this._hasShadow)}_hasShadow(){return this.shadowEnabled()&&this.shadowOpacity()!==0&&!!(this.shadowColor()||this.shadowBlur()||this.shadowOffsetX()||this.shadowOffsetY())}_getFillPattern(){return this._getCache(DE,this.__getFillPattern)}__getFillPattern(){if(this.fillPatternImage()){const e=K1().createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(e&&e.setTransform){const t=new Fs;t.translate(this.fillPatternX(),this.fillPatternY()),t.rotate(Mt.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(FE,this.__getLinearGradient)}__getLinearGradient(){const e=this.fillLinearGradientColorStops();if(e){const t=K1(),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(NE,this.__getRadialGradient)}__getRadialGradient(){const e=this.fillRadialGradientColorStops();if(e){const t=K1(),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(PE,this._getShadowRGBA)}_getShadowRGBA(){if(!this.hasShadow())return;const e=ze.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 Ot.prototype.destroy.call(this),delete Vh[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){ze.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,h=u?this.shadowOffsetY():0,p=a+Math.abs(d),v=l+Math.abs(h),g=u&&this.shadowBlur()||0,y={width:p+g*2,height:v+g*2,x:-(s/2+g)+Math.min(d,0)+i.x,y:-(s/2+g)+Math.min(h,0)+i.y};return r?y:this._transformedRect(y,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,h=d.getContext();n?(h.save(),h.setTransform(1,0,0,1,0,0),h.clearRect(0,0,d.width,d.height),h.restore()):h.clear(),h.save(),h._applyLineJoin(this),h._applyMiterLimit(this);const p=this.getAbsoluteTransform(t).getMatrix();h.transform(p[0],p[1],p[2],p[3],p[4],p[5]),s.call(this,h,this),h.restore();const v=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/v,d.height/v)}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||ze.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=ze._hexToRgb(this.colorKey);for(let h=0;h<u;h+=4)l[h+3]>e?(l[h]=d.r,l[h+1]=d.g,l[h+2]=d.b,l[h+3]=255):l[h+3]=0;o.putImageData(a,0,0)}catch(a){ze.error("Unable to draw hit graph from cached scene canvas. "+a.message)}return this}hasPointerCapture(e){return bE(e,this)}setPointerCapture(e){wE(e,this)}releaseCapture(e){Oh(e,this)}};_t.prototype._fillFunc=Z$,_t.prototype._strokeFunc=Q$,_t.prototype._fillFuncHit=J$,_t.prototype._strokeFuncHit=eH,_t.prototype._centroid=!1,_t.prototype.nodeType="Shape",Xr(_t),_t.prototype.eventListeners={},_t.prototype.on("shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",tH),_t.prototype.on("shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",nH),_t.prototype.on("fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",rH),_t.prototype.on("fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",oH),_t.prototype.on("fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",iH),ve.addGetterSetter(_t,"stroke",void 0,fE()),ve.addGetterSetter(_t,"strokeWidth",2,Tt()),ve.addGetterSetter(_t,"fillAfterStrokeEnabled",!1),ve.addGetterSetter(_t,"hitStrokeWidth","auto",V1()),ve.addGetterSetter(_t,"strokeHitEnabled",!0,Ns()),ve.addGetterSetter(_t,"perfectDrawEnabled",!0,Ns()),ve.addGetterSetter(_t,"shadowForStrokeEnabled",!0,Ns()),ve.addGetterSetter(_t,"lineJoin"),ve.addGetterSetter(_t,"lineCap"),ve.addGetterSetter(_t,"miterLimit"),ve.addGetterSetter(_t,"sceneFunc"),ve.addGetterSetter(_t,"hitFunc"),ve.addGetterSetter(_t,"dash"),ve.addGetterSetter(_t,"dashOffset",0,Tt()),ve.addGetterSetter(_t,"shadowColor",void 0,du()),ve.addGetterSetter(_t,"shadowBlur",0,Tt()),ve.addGetterSetter(_t,"shadowOpacity",1,Tt()),ve.addComponentsGetterSetter(_t,"shadowOffset",["x","y"]),ve.addGetterSetter(_t,"shadowOffsetX",0,Tt()),ve.addGetterSetter(_t,"shadowOffsetY",0,Tt()),ve.addGetterSetter(_t,"fillPatternImage"),ve.addGetterSetter(_t,"fill",void 0,fE()),ve.addGetterSetter(_t,"fillPatternX",0,Tt()),ve.addGetterSetter(_t,"fillPatternY",0,Tt()),ve.addGetterSetter(_t,"fillLinearGradientColorStops"),ve.addGetterSetter(_t,"strokeLinearGradientColorStops"),ve.addGetterSetter(_t,"fillRadialGradientStartRadius",0),ve.addGetterSetter(_t,"fillRadialGradientEndRadius",0),ve.addGetterSetter(_t,"fillRadialGradientColorStops"),ve.addGetterSetter(_t,"fillPatternRepeat","repeat"),ve.addGetterSetter(_t,"fillEnabled",!0),ve.addGetterSetter(_t,"strokeEnabled",!0),ve.addGetterSetter(_t,"shadowEnabled",!0),ve.addGetterSetter(_t,"dashEnabled",!0),ve.addGetterSetter(_t,"strokeScaleEnabled",!0),ve.addGetterSetter(_t,"fillPriority","color"),ve.addComponentsGetterSetter(_t,"fillPatternOffset",["x","y"]),ve.addGetterSetter(_t,"fillPatternOffsetX",0,Tt()),ve.addGetterSetter(_t,"fillPatternOffsetY",0,Tt()),ve.addComponentsGetterSetter(_t,"fillPatternScale",["x","y"]),ve.addGetterSetter(_t,"fillPatternScaleX",1,Tt()),ve.addGetterSetter(_t,"fillPatternScaleY",1,Tt()),ve.addComponentsGetterSetter(_t,"fillLinearGradientStartPoint",["x","y"]),ve.addComponentsGetterSetter(_t,"strokeLinearGradientStartPoint",["x","y"]),ve.addGetterSetter(_t,"fillLinearGradientStartPointX",0),ve.addGetterSetter(_t,"strokeLinearGradientStartPointX",0),ve.addGetterSetter(_t,"fillLinearGradientStartPointY",0),ve.addGetterSetter(_t,"strokeLinearGradientStartPointY",0),ve.addComponentsGetterSetter(_t,"fillLinearGradientEndPoint",["x","y"]),ve.addComponentsGetterSetter(_t,"strokeLinearGradientEndPoint",["x","y"]),ve.addGetterSetter(_t,"fillLinearGradientEndPointX",0),ve.addGetterSetter(_t,"strokeLinearGradientEndPointX",0),ve.addGetterSetter(_t,"fillLinearGradientEndPointY",0),ve.addGetterSetter(_t,"strokeLinearGradientEndPointY",0),ve.addComponentsGetterSetter(_t,"fillRadialGradientStartPoint",["x","y"]),ve.addGetterSetter(_t,"fillRadialGradientStartPointX",0),ve.addGetterSetter(_t,"fillRadialGradientStartPointY",0),ve.addComponentsGetterSetter(_t,"fillRadialGradientEndPoint",["x","y"]),ve.addGetterSetter(_t,"fillRadialGradientEndPointX",0),ve.addGetterSetter(_t,"fillRadialGradientEndPointY",0),ve.addGetterSetter(_t,"fillPatternRotation",0),ve.addGetterSetter(_t,"fillRule",void 0,du()),ve.backCompat(_t,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"});var sH="beforeDraw",aH="draw",BE=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],lH=BE.length,hu=class extends Ji{constructor(e){super(e),this.canvas=new hc,this.hitCanvas=new z1({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(){Ot.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(!Ot.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(Ot.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(Ot.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 Ot.prototype.remove.call(this),e&&e.parentNode&&ze._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"&&ze.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(),Ot.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(){ze.warn('Can not change width of layer. Use "stage.width(value)" function instead.')}getHeight(){if(this.parent)return this.parent.height()}setHeight(){ze.warn('Can not change height of layer. Use "stage.height(value)" function instead.')}batchDraw(){return this._waitingForDraw||(this._waitingForDraw=!0,ze.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<lH;r++){const o=BE[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=Vh[ze.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(sH,{node:this}),this.clearBeforeDraw()&&o.getContext().clear(),Ji.prototype.drawScene.call(this,o,t,n),this._fire(aH,{node:this}),this}drawHit(e,t){const n=this.getLayer(),r=e||n&&n.hitCanvas;return n&&n.clearBeforeDraw()&&n.getHitCanvas().getContext().clear(),Ji.prototype.drawHit.call(this,r,t),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(e){ze.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening(e)}getHitGraphEnabled(e){return ze.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 ze.releaseCanvas(this.getNativeCanvasElement(),this.getHitCanvas()._canvas),super.destroy()}};hu.prototype.nodeType="Layer",Xr(hu),ve.addGetterSetter(hu,"imageSmoothingEnabled",!0),ve.addGetterSetter(hu,"clearBeforeDraw",!0),ve.addGetterSetter(hu,"hitGraphEnabled",!0,Ns());var Y1=class extends hu{constructor(e){super(e),this.listening(!1),ze.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.')}};Y1.prototype.nodeType="FastLayer",Xr(Y1);var Dd=class extends Ji{_validateAdd(e){const t=e.getType();t!=="Group"&&t!=="Shape"&&ze.throw("You may only add groups and shapes to groups.")}};Dd.prototype.nodeType="Group",Xr(Dd);var X1=(function(){return uu.performance&&uu.performance.now?function(){return uu.performance.now()}:function(){return new Date().getTime()}})(),Fd=class cf{constructor(t,n){this.id=cf.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:X1(),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=cf.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=X1(),cf._addAnimation(this),this}stop(){return cf._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(X1());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=cf;t.animations.length?(t._runFrames(),ze.requestAnimFrame(t._animationLoop)):t.animRunning=!1}static _handleAnimation(){this.animRunning||(this.animRunning=!0,ze.requestAnimFrame(this._animationLoop))}};Fd.animations=[],Fd.animIdCounter=0,Fd.animRunning=!1;var cH={node:1,duration:1,easing:1,onFinish:1,yoyo:1},uH=1,zE=2,VE=3,UE=["fill","stroke","shadowColor"],dH=0,fH=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=zE,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")}reverse(){this.state=VE,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===zE?this.setTime(e):this.state===VE&&this.setTime(this.duration-e)}pause(){this.state=uH,this.fire("onPause")}getTimer(){return new Date().getTime()}},Ig=class uo{constructor(t){const n=this,r=t.node,o=r._id,i=t.easing||Uh.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=dH++;const u=r.getLayer()||(r instanceof Mt.Stage?r.getLayers():null);u||ze.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 fH(l,function(d){n._tweenFunc(d)},i,0,1,a*1e3,s),this._addListeners(),uo.attrs[o]||(uo.attrs[o]={}),uo.attrs[o][this._id]||(uo.attrs[o][this._id]={}),uo.tweens[o]||(uo.tweens[o]={});for(l in t)cH[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=uo.tweens[o][t];d&&delete uo.attrs[o][d][t];let h=r.getAttr(t);if(ze._isArray(n))if(i=[],s=Math.max(n.length,h.length),t==="points"&&n.length!==h.length&&(n.length>h.length?(l=h,h=ze._prepareArrayForTween(h,n,r.closed())):(a=n,n=ze._prepareArrayForTween(n,h,r.closed()))),t.indexOf("fill")===0)for(let p=0;p<s;p++)if(p%2===0)i.push(n[p]-h[p]);else{const v=ze.colorToRGBA(h[p]);u=ze.colorToRGBA(n[p]),h[p]=v,i.push({r:u.r-v.r,g:u.g-v.g,b:u.b-v.b,a:u.a-v.a})}else for(let p=0;p<s;p++)i.push(n[p]-h[p]);else UE.indexOf(t)!==-1?(h=ze.colorToRGBA(h),u=ze.colorToRGBA(n),i={r:u.r-h.r,g:u.g-h.g,b:u.b-h.b,a:u.a-h.a}):i=n-h;uo.attrs[o][this._id][t]={start:h,diff:i,end:n,trueEnd:a,trueStart:l},uo.tweens[o][t]=this._id}_tweenFunc(t){const n=this.node,r=uo.attrs[n._id][this._id];let o,i,s,a,l,u,d,h;for(o in r){if(i=r[o],s=i.start,a=i.diff,h=i.end,ze._isArray(s))if(l=[],d=Math.max(s.length,h.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 UE.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=uo.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=uo.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=uo.tweens[t];this.pause(),this.anim&&this.anim.stop();for(const o in r)delete uo.tweens[t][o];delete uo.attrs[t][n],uo.tweens[t]&&(Object.keys(uo.tweens[t]).length===0&&delete uo.tweens[t],Object.keys(uo.attrs[t]).length===0&&delete uo.attrs[t])}};Ig.attrs={},Ig.tweens={},Ot.prototype.to=function(e){const t=e.onFinish;e.node=this,e.onFinish=function(){this.destroy(),t&&t()},new Ig(e).play()};var Uh={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-Uh.BounceEaseOut(r-e,0,n,r)+t},BounceEaseInOut(e,t,n,r){return e<r/2?Uh.BounceEaseIn(e*2,0,n,r)*.5+t:Uh.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}},jE=ze._assign(Mt,{Util:ze,Transform:Fs,Node:Ot,Container:Ji,Stage:_g,stages:zh,Layer:hu,FastLayer:Y1,Group:Dd,DD:Qn,Shape:_t,shapes:Vh,Animation:Fd,Tween:Ig,Easings:Uh,Context:gg,Canvas:B1}),yl=class extends _t{_sceneFunc(e){const t=Mt.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=Mt.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),h=a*(a>0?t:e);return{x:l,y:n?-1*h:d,width:u-l,height:h-d}}};yl.prototype._centroid=!0,yl.prototype.className="Arc",yl.prototype._attrsAffectingSize=["innerRadius","outerRadius","angle","clockwise"],Xr(yl),ve.addGetterSetter(yl,"innerRadius",0,Tt()),ve.addGetterSetter(yl,"outerRadius",0,Tt()),ve.addGetterSetter(yl,"angle",0,Tt()),ve.addGetterSetter(yl,"clockwise",!1,Ns());function Z1(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 $E(e,t){const n=e.length,r=[];for(let o=2;o<n-2;o+=2){const i=Z1(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 hH(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 bl=class extends _t{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():$E(this.points(),this.tension())}_getTensionPointsClosed(){const e=this.points(),t=e.length,n=this.tension(),r=Z1(e[t-2],e[t-1],e[0],e[1],e[2],e[3],n),o=Z1(e[t-4],e[t-3],e[t-2],e[t-1],e[0],e[1],n),i=$E(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],...hH(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}}};bl.prototype.className="Line",bl.prototype._attrsAffectingSize=["points","bezier","tension"],Xr(bl),ve.addGetterSetter(bl,"closed",!1),ve.addGetterSetter(bl,"bezier",!1),ve.addGetterSetter(bl,"tension",0,Tt()),ve.addGetterSetter(bl,"points",[],x$());var pH=[[],[],[-.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]],mH=[[],[],[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]],gH=[[1],[1,1],[1,2,1],[1,3,3,1]],HE=(e,t,n)=>{let r,o;const s=n/2;r=0;for(let a=0;a<20;a++)o=s*pH[20][a]+s,r+=mH[20][a]*vH(e,t,o);return s*r},GE=(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),h=u/a,p=n+d,v=h-d*d,g=p*p+v>0?Math.sqrt(p*p+v):0,y=d*d+v>0?Math.sqrt(d*d+v):0,_=d+Math.sqrt(d*d+v)!==0?v*Math.log(Math.abs((p+g)/(d+y))):0;return Math.sqrt(a)/2*(p*g-d*y+_)};function vH(e,t,n){const r=Q1(1,n,e),o=Q1(1,n,t),i=r*r+o*o;return Math.sqrt(i)}var Q1=(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+=gH[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 Q1(e-1,t,o)}},WE=(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},ys=class ji extends _t{constructor(t){super(t),this.dataArray=[],this.pathLength=0,this._readDataAttribute(),this.on("dataChange.konva",function(){this._readDataAttribute()})}_readDataAttribute(){this.dataArray=ji.parsePathData(this.data()),this.pathLength=ji.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],h=s[4],p=s[5],v=s[6],g=s[7],y=u>d?u:d,_=u>d?1:u/d,w=u>d?d/u:1;t.translate(a,l),t.rotate(v),t.scale(_,w),t.arc(0,0,y,h,h+p,1-g),t.scale(1/_,1/w),t.rotate(-v),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],h=l.points[4]+d;let p=Math.PI/180;if(Math.abs(u-h)<p&&(p=Math.abs(u-h)),d<0)for(let v=u-p;v>h;v-=p){const g=ji.getPointOnEllipticalArc(l.points[0],l.points[1],l.points[2],l.points[3],v,0);t.push(g.x,g.y)}else for(let v=u+p;v<h;v+=p){const g=ji.getPointOnEllipticalArc(l.points[0],l.points[1],l.points[2],l.points[3],v,0);t.push(g.x,g.y)}}else if(l.command==="C")for(let u=0;u<=1;u+=.01){const d=ji.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 ji.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 ji.getPointOnLine(t,s.start.x,s.start.y,a[0],a[1]);case"C":return ji.getPointOnCubicBezier(WE(t,ji.getPathLength(n),y=>HE([s.start.x,a[0],a[2],a[4]],[s.start.y,a[1],a[3],a[5]],y)),s.start.x,s.start.y,a[0],a[1],a[2],a[3],a[4],a[5]);case"Q":return ji.getPointOnQuadraticBezier(WE(t,ji.getPathLength(n),y=>GE([s.start.x,a[0],a[2]],[s.start.y,a[1],a[3]],y)),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],h=a[3],p=a[5],v=a[6];let g=a[4];return g+=p*t/s.pathLength,ji.getPointOnEllipticalArc(l,u,d,h,g,v)}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),h=u*d;if(Math.abs(a-r-u*(s-n))<1e-10)return{x:s+d,y:a+h};const p=((s-n)*(o-n)+(a-r)*(i-r))/(l*l),v=n+p*(o-n),g=r+p*(i-r),y=this.getLineLength(s,a,v,g),_=Math.sqrt(t*t-y*y),w=Math.sqrt(_*_/(1+u*u))*(o<n?-1:1),I=u*w;return{x:v+w,y:g+I}}static getPointOnCubicBezier(t,n,r,o,i,s,a,l,u){function d(g){return g*g*g}function h(g){return 3*g*g*(1-g)}function p(g){return 3*g*(1-g)*(1-g)}function v(g){return(1-g)*(1-g)*(1-g)}return{x:l*d(t)+s*h(t)+o*p(t)+n*v(t),y:u*d(t)+a*h(t)+i*p(t)+r*v(t)}}static getPointOnQuadraticBezier(t,n,r,o,i,s,a){function l(h){return h*h}function u(h){return 2*h*(1-h)}function d(h){return(1-h)*(1-h)}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 h=0;h<r.length;h++)n=n.replace(new RegExp(r[h],"g"),"|"+r[h]);const o=n.split("|"),i=[],s=[];let a=0,l=0;const u=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:e[-+]?\d+)?)/gi;let d;for(let h=1;h<o.length;h++){let p=o[h],v=p.charAt(0);for(p=p.slice(1),s.length=0;d=u.exec(p);)s.push(d[0]);let g=[],y=v==="A"||v==="a"?0:-1;for(let _=0,w=s.length;_<w;_++){const I=s[_];if(I==="00"){g.push(0,0),y>=0&&(y+=2,y>=7&&(y-=7));continue}if(y>=0){if(y===3){if(/^[01]{2}\d+(?:\.\d+)?$/.test(I)){g.push(parseInt(I[0],10)),g.push(parseInt(I[1],10)),g.push(parseFloat(I.slice(2))),y+=3,y>=7&&(y-=7);continue}if(I==="11"||I==="10"||I==="01"){g.push(parseInt(I[0],10)),g.push(parseInt(I[1],10)),y+=2,y>=7&&(y-=7);continue}if(I==="0"||I==="1"){g.push(parseInt(I,10)),y+=1,y>=7&&(y-=7);continue}}else if(y===4){if(/^[01]\d+(?:\.\d+)?$/.test(I)){g.push(parseInt(I[0],10)),g.push(parseFloat(I.slice(1))),y+=2,y>=7&&(y-=7);continue}if(I==="0"||I==="1"){g.push(parseInt(I,10)),y+=1,y>=7&&(y-=7);continue}}const k=parseFloat(I);isNaN(k)?g.push(0):g.push(k),y+=1,y>=7&&(y-=7)}else{const k=parseFloat(I);isNaN(k)?g.push(0):g.push(k)}}for(;g.length>0&&!isNaN(g[0]);){let _="",w=[];const I=a,k=l;let C,R,P,M,$,F,D,V,x,B;switch(v){case"l":a+=g.shift(),l+=g.shift(),_="L",w.push(a,l);break;case"L":a=g.shift(),l=g.shift(),w.push(a,l);break;case"m":const T=g.shift(),te=g.shift();if(a+=T,l+=te,_="M",i.length>2&&i[i.length-1].command==="z"){for(let U=i.length-2;U>=0;U--)if(i[U].command==="M"){a=i[U].points[0]+T,l=i[U].points[1]+te;break}}w.push(a,l),v="l";break;case"M":a=g.shift(),l=g.shift(),_="M",w.push(a,l),v="L";break;case"h":a+=g.shift(),_="L",w.push(a,l);break;case"H":a=g.shift(),_="L",w.push(a,l);break;case"v":l+=g.shift(),_="L",w.push(a,l);break;case"V":l=g.shift(),_="L",w.push(a,l);break;case"C":w.push(g.shift(),g.shift(),g.shift(),g.shift()),a=g.shift(),l=g.shift(),w.push(a,l);break;case"c":w.push(a+g.shift(),l+g.shift(),a+g.shift(),l+g.shift()),a+=g.shift(),l+=g.shift(),_="C",w.push(a,l);break;case"S":R=a,P=l,C=i[i.length-1],C.command==="C"&&(R=a+(a-C.points[2]),P=l+(l-C.points[3])),w.push(R,P,g.shift(),g.shift()),a=g.shift(),l=g.shift(),_="C",w.push(a,l);break;case"s":R=a,P=l,C=i[i.length-1],C.command==="C"&&(R=a+(a-C.points[2]),P=l+(l-C.points[3])),w.push(R,P,a+g.shift(),l+g.shift()),a+=g.shift(),l+=g.shift(),_="C",w.push(a,l);break;case"Q":w.push(g.shift(),g.shift()),a=g.shift(),l=g.shift(),w.push(a,l);break;case"q":w.push(a+g.shift(),l+g.shift()),a+=g.shift(),l+=g.shift(),_="Q",w.push(a,l);break;case"T":R=a,P=l,C=i[i.length-1],C.command==="Q"&&(R=a+(a-C.points[0]),P=l+(l-C.points[1])),a=g.shift(),l=g.shift(),_="Q",w.push(R,P,a,l);break;case"t":R=a,P=l,C=i[i.length-1],C.command==="Q"&&(R=a+(a-C.points[0]),P=l+(l-C.points[1])),a+=g.shift(),l+=g.shift(),_="Q",w.push(R,P,a,l);break;case"A":M=g.shift(),$=g.shift(),F=g.shift(),D=g.shift(),V=g.shift(),x=a,B=l,a=g.shift(),l=g.shift(),_="A",w=this.convertEndpointToCenterParameterization(x,B,a,l,D,V,M,$,F);break;case"a":M=g.shift(),$=g.shift(),F=g.shift(),D=g.shift(),V=g.shift(),x=a,B=l,a+=g.shift(),l+=g.shift(),_="A",w=this.convertEndpointToCenterParameterization(x,B,a,l,D,V,M,$,F);break}i.push({command:_||v,points:w,start:{x:I,y:k},pathLength:this.calcLength(I,k,_||v,w)})}(v==="z"||v==="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=ji;switch(r){case"L":return u.getLineLength(t,n,o[0],o[1]);case"C":return HE([t,o[0],o[2],o[4]],[n,o[1],o[3],o[5]],1);case"Q":return GE([t,o[0],o[2]],[n,o[1],o[3]],1);case"A":i=0;const d=o[4],h=o[5],p=o[4]+h;let v=Math.PI/180;if(Math.abs(d-p)<v&&(v=Math.abs(d-p)),s=u.getPointOnEllipticalArc(o[0],o[1],o[2],o[3],d,0),h<0)for(l=d-v;l>p;l-=v)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+v;l<p;l+=v)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),h=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,v=h*h/(a*a)+p*p/(l*l);v>1&&(a*=Math.sqrt(v),l*=Math.sqrt(v));let g=Math.sqrt((a*a*(l*l)-a*a*(p*p)-l*l*(h*h))/(a*a*(p*p)+l*l*(h*h)));i===s&&(g*=-1),isNaN(g)&&(g=0);const y=g*a*p/l,_=g*-l*h/a,w=(t+r)/2+Math.cos(d)*y-Math.sin(d)*_,I=(n+o)/2+Math.sin(d)*y+Math.cos(d)*_,k=function(D){return Math.sqrt(D[0]*D[0]+D[1]*D[1])},C=function(D,V){return(D[0]*V[0]+D[1]*V[1])/(k(D)*k(V))},R=function(D,V){return(D[0]*V[1]<D[1]*V[0]?-1:1)*Math.acos(C(D,V))},P=R([1,0],[(h-y)/a,(p-_)/l]),M=[(h-y)/a,(p-_)/l],$=[(-1*h-y)/a,(-1*p-_)/l];let F=R(M,$);return C(M,$)<=-1&&(F=Math.PI),C(M,$)>=1&&(F=0),s===0&&F>0&&(F=F-2*Math.PI),s===1&&F<0&&(F=F+2*Math.PI),[w,I,a,l,P,F,d,s]}};ys.prototype.className="Path",ys.prototype._attrsAffectingSize=["data"],Xr(ys),ve.addGetterSetter(ys,"data");var pu=class extends bl{_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 h=[r[r.length-4],r[r.length-3],r[r.length-2],r[r.length-1],n[s-2],n[s-1]],p=ys.calcLength(r[r.length-4],r[r.length-3],"C",h),v=ys.getPointOnQuadraticBezier(Math.min(1,1-i/p),h[0],h[1],h[2],h[3],h[4],h[5]);a=n[s-2]-v.x,l=n[s-1]-v.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}}};pu.prototype.className="Arrow",Xr(pu),ve.addGetterSetter(pu,"pointerLength",10,Tt()),ve.addGetterSetter(pu,"pointerWidth",10,Tt()),ve.addGetterSetter(pu,"pointerAtBeginning",!1),ve.addGetterSetter(pu,"pointerAtEnding",!0);var Nd=class extends _t{_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)}};Nd.prototype._centroid=!0,Nd.prototype.className="Circle",Nd.prototype._attrsAffectingSize=["radius"],Xr(Nd),ve.addGetterSetter(Nd,"radius",0,Tt());var gc=class extends _t{_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)}};gc.prototype.className="Ellipse",gc.prototype._centroid=!0,gc.prototype._attrsAffectingSize=["radiusX","radiusY"],Xr(gc),ve.addComponentsGetterSetter(gc,"radius",["x","y"]),ve.addGetterSetter(gc,"radiusX",0,Tt()),ve.addGetterSetter(gc,"radiusY",0,Tt());var Bs=class a5 extends _t{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?ze.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?ze.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=ze.createImageElement();o.onload=function(){n(new a5({image:o}))},o.onerror=r,o.crossOrigin="Anonymous",o.src=t}};Bs.prototype.className="Image",Bs.prototype._attrsAffectingSize=["image"],Xr(Bs),ve.addGetterSetter(Bs,"cornerRadius",0,yg(4)),ve.addGetterSetter(Bs,"image"),ve.addComponentsGetterSetter(Bs,"crop",["x","y","width","height"]),ve.addGetterSetter(Bs,"cropX",0,Tt()),ve.addGetterSetter(Bs,"cropY",0,Tt()),ve.addGetterSetter(Bs,"cropWidth",0,Tt()),ve.addGetterSetter(Bs,"cropHeight",0,Tt());var qE=["fontFamily","fontSize","fontStyle","padding","lineHeight","text","width","height","pointerDirection","pointerWidth","pointerHeight"],yH="Change.konva",bH="none",J1="up",e2="right",t2="down",n2="left",wH=qE.length,r2=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<wH;n++)e.on(qE[n]+yH,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 J1:s=n/2,a=-1*l;break;case e2:s=n+i,a=r/2;break;case t2:s=n/2,a=r+l;break;case n2: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})}}};r2.prototype.className="Label",Xr(r2);var mu=class extends _t{_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===J1&&(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===e2&&(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===t2&&(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===n2&&(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===J1?(t-=r,s+=r):o===t2?s+=r:o===n2?(e-=n*1.5,i+=n):o===e2&&(i+=n*1.5),{x:e,y:t,width:i,height:s}}};mu.prototype.className="Tag",Xr(mu),ve.addGetterSetter(mu,"pointerDirection",bH),ve.addGetterSetter(mu,"pointerWidth",0,Tt()),ve.addGetterSetter(mu,"pointerHeight",0,Tt()),ve.addGetterSetter(mu,"cornerRadius",0,yg(4));var jh=class extends _t{_sceneFunc(e){const t=this.cornerRadius(),n=this.width(),r=this.height();e.beginPath(),t?ze.drawRoundedRectPath(e,n,r,t):e.rect(0,0,n,r),e.closePath(),e.fillStrokeShape(this)}};jh.prototype.className="Rect",Xr(jh),ve.addGetterSetter(jh,"cornerRadius",0,yg(4));var vc=class extends _t{_sceneFunc(e){const t=this._getPoints(),n=this.radius(),r=this.sides(),o=this.cornerRadius();if(e.beginPath(),o)ze.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)}};vc.prototype.className="RegularPolygon",vc.prototype._centroid=!0,vc.prototype._attrsAffectingSize=["radius"],Xr(vc),ve.addGetterSetter(vc,"radius",0,Tt()),ve.addGetterSetter(vc,"sides",0,Tt()),ve.addGetterSetter(vc,"cornerRadius",0,yg(4));var KE=Math.PI*2,gu=class extends _t{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.innerRadius(),0,KE,!1),e.moveTo(this.outerRadius(),0),e.arc(0,0,this.outerRadius(),KE,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)}};gu.prototype.className="Ring",gu.prototype._centroid=!0,gu.prototype._attrsAffectingSize=["innerRadius","outerRadius"],Xr(gu),ve.addGetterSetter(gu,"innerRadius",0,Tt()),ve.addGetterSetter(gu,"outerRadius",0,Tt());var wa=class extends _t{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 h=i[t],p=n*2;e.drawImage(d,s,a,l,u,h[p+0],h[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)}};wa.prototype.className="Sprite",Xr(wa),ve.addGetterSetter(wa,"animation"),ve.addGetterSetter(wa,"animations"),ve.addGetterSetter(wa,"frameOffsets"),ve.addGetterSetter(wa,"image"),ve.addGetterSetter(wa,"frameIndex",0,Tt()),ve.addGetterSetter(wa,"frameRate",17,Tt()),ve.backCompat(wa,{index:"frameIndex",getIndex:"getFrameIndex",setIndex:"setFrameIndex"});var yc=class extends _t{_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)}};yc.prototype.className="Star",yc.prototype._centroid=!0,yc.prototype._attrsAffectingSize=["innerRadius","outerRadius"],Xr(yc),ve.addGetterSetter(yc,"numPoints",5,Tt()),ve.addGetterSetter(yc,"innerRadius",0,Tt()),ve.addGetterSetter(yc,"outerRadius",0,Tt());function bc(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 Bd="auto",CH="center",YE="inherit",$h="justify",kH="Change.konva",XE="2d",ZE="-",QE="left",SH="text",_H="Text",AH="top",IH="bottom",JE="middle",eT="normal",EH="px ",Eg=" ",TH="right",tT="rtl",xH="word",RH="char",nT="none",o2="β¦",rT=["direction","fontFamily","fontSize","fontStyle","fontVariant","padding","align","verticalAlign","lineHeight","text","width","height","wrap","ellipsis","letterSpacing"],LH=rT.length,Hh=null;function MH(){if(Hh!==null)return Hh;Hh=!1;try{const e=document.createElement("canvas");e.width=10,e.height=10;const t=e.getContext(XE);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){Hh=!0;break}}}catch{}return Hh}function OH(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 Tg;function i2(){return Tg||(Tg=ze.createCanvasElement().getContext(XE),Tg)}function PH(e){e.fillText(this._partialText,this._partialTextX,this._partialTextY)}function DH(e){e.setAttr("miterLimit",2),e.strokeText(this._partialText,this._partialTextX,this._partialTextY)}function FH(e){return e=e||{},!e.fillLinearGradientColorStops&&!e.fillRadialGradientColorStops&&!e.fillPatternImage&&(e.fill=e.fill||"black"),e}var Ir=class extends _t{constructor(e){super(FH(e)),this._partialTextX=0,this._partialTextY=0;for(let t=0;t<LH;t++)this.on(rT[t]+kH,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,h=this.align(),p=this.getWidth(),v=this.letterSpacing(),g=this.charRenderFunc(),y=this.fill(),_=this.textDecoration(),w=this.underlineOffset(),I=_.indexOf("underline")!==-1,k=_.indexOf("line-through")!==-1,C;u=u===YE?e.direction:u;let R=a/2,P=JE;if(!Mt.legacyTextRendering){const M=this.measureSize("M");P="alphabetic",R=(((t=M.fontBoundingBoxAscent)!==null&&t!==void 0?t:M.actualBoundingBoxAscent)-((n=M.fontBoundingBoxDescent)!==null&&n!==void 0?n:M.actualBoundingBoxDescent))/2+a/2}for(u===tT&&e.setAttr("direction",u),e.setAttr("font",this._getContextFont()),e.setAttr("textBaseline",P),e.setAttr("textAlign",QE),l===JE?d=(this.getHeight()-o*a-i*2)/2:l===IH&&(d=this.getHeight()-o*a-i*2),e.translate(i,d+i),C=0;C<o;C++){let M=0,$=0;const F=r[C],D=F.text,V=F.width,x=F.lastInParagraph;if(e.save(),h===TH?M+=p-V-i*2:h===CH&&(M+=(p-V-i*2)/2),I){e.save(),e.beginPath();const T=w??(Mt.legacyTextRendering?Math.round(s/2):Math.round(s/4)),te=M,U=R+$+T;e.moveTo(te,U);const W=h===$h&&!x?p-i*2:V;e.lineTo(te+Math.round(W),U),e.lineWidth=s/15,e.strokeStyle=this._getLinearGradient()||y,e.stroke(),e.restore()}const B=M;if(u!==tT&&(v!==0||h===$h||g)){const T=D.split(" ").length-1,te=bc(D);for(let U=0;U<te.length;U++){const W=te[U];if(W===" "&&!x&&h===$h&&(M+=(p-i*2-V)/T),this._partialTextX=M,this._partialTextY=R+$,this._partialText=W,g){e.save();const Y=r.slice(0,C).reduce((J,Oe)=>J+bc(Oe.text).length,0);g({char:W,index:U+Y,x:M,y:R+$,lineIndex:C,column:U,isLastInLine:x,width:this.measureSize(W).width,context:e})}e.fillStrokeShape(this),g&&e.restore(),M+=this.measureSize(W).width+v}}else v!==0&&e.setAttr("letterSpacing",`${v}px`),this._partialTextX=M,this._partialTextY=R+$,this._partialText=D,e.fillStrokeShape(this);if(k){e.save(),e.beginPath();const T=Mt.legacyTextRendering?0:-Math.round(s/4),te=B;e.moveTo(te,R+$+T);const U=h===$h&&!x?p-i*2:V;e.lineTo(te+Math.round(U),R+$+T),e.lineWidth=s/15,e.strokeStyle=this._getLinearGradient()||y,e.stroke(),e.restore()}e.restore(),o>1&&(R+=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=ze._isString(e)?e:e==null?"":e+"";return this._setAttr(SH,t),this}getWidth(){return this.attrs.width===Bd||this.attrs.width===void 0?this.getTextWidth()+this.padding()*2:this.attrs.width}getHeight(){return this.attrs.height===Bd||this.attrs.height===void 0?this.fontSize()*this.textArr.length*this.lineHeight()+this.padding()*2:this.attrs.height}getTextWidth(){return this.textWidth}getTextHeight(){return ze.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,h;let p=i2(),v=this.fontSize(),g;p.save(),p.font=this._getContextFont(),g=p.measureText(e),p.restore();const y=v/100;return{actualBoundingBoxAscent:(t=g.actualBoundingBoxAscent)!==null&&t!==void 0?t:71.58203125*y,actualBoundingBoxDescent:(n=g.actualBoundingBoxDescent)!==null&&n!==void 0?n:0,actualBoundingBoxLeft:(r=g.actualBoundingBoxLeft)!==null&&r!==void 0?r:-7.421875*y,actualBoundingBoxRight:(o=g.actualBoundingBoxRight)!==null&&o!==void 0?o:75.732421875*y,alphabeticBaseline:(i=g.alphabeticBaseline)!==null&&i!==void 0?i:0,emHeightAscent:(s=g.emHeightAscent)!==null&&s!==void 0?s:100*y,emHeightDescent:(a=g.emHeightDescent)!==null&&a!==void 0?a:-20*y,fontBoundingBoxAscent:(l=g.fontBoundingBoxAscent)!==null&&l!==void 0?l:91*y,fontBoundingBoxDescent:(u=g.fontBoundingBoxDescent)!==null&&u!==void 0?u:21*y,hangingBaseline:(d=g.hangingBaseline)!==null&&d!==void 0?d:72.80000305175781*y,ideographicBaseline:(h=g.ideographicBaseline)!==null&&h!==void 0?h:-21*y,width:g.width,height:v}}_getContextFont(){return this.fontStyle()+Eg+this.fontVariant()+Eg+(this.fontSize()+EH)+OH(this.fontFamily())}_addTextLine(e){this.align()===$h&&(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 i2().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!==Bd&&o!==void 0,a=i!==Bd&&i!==void 0,l=this.padding(),u=o-l*2,d=i-l*2,h=0,p=this.wrap(),v=p!==RH&&p!==nT,g=this.ellipsis();this.textArr=[],i2().font=this._getContextFont();const y=g?this._getTextWidth(o2):0;for(let _=0,w=e.length;_<w;++_){let I=e[_],k=this._getTextWidth(I);if(s&&k>u)for(;I.length>0;){let C=0,R=bc(I).length,P="",M=0;for(;C<R;){const $=C+R>>>1,F=bc(I).slice(0,$+1).join(""),D=this._getTextWidth(F);(g&&a&&h+r>d?D+y:D)<=u?(C=$+1,P=F,M=D):R=$}if(P){if(v){const $=bc(I),F=bc(P),D=$[F.length],V=D===Eg||D===ZE;let x;if(V&&M<=u)x=F.length;else{const B=F.lastIndexOf(Eg),T=F.lastIndexOf(ZE);x=Math.max(B,T)+1}x>0&&(C=x,P=$.slice(0,C).join(""),M=this._getTextWidth(P))}if(P=P.trimRight(),this._addTextLine(P),n=Math.max(n,M),h+=r,this._shouldHandleEllipsis(h)){this._tryToAddEllipsisToLastLine();break}if(I=bc(I).slice(C).join("").trimLeft(),I.length>0&&(k=this._getTextWidth(I),k<=u)){this._addTextLine(I),h+=r,n=Math.max(n,k);break}}else break}else this._addTextLine(I),h+=r,n=Math.max(n,k),this._shouldHandleEllipsis(h)&&_<w-1&&this._tryToAddEllipsisToLastLine();if(this.textArr[this.textArr.length-1]&&(this.textArr[this.textArr.length-1].lastInParagraph=!0),a&&h+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!==Bd&&r!==void 0,i=r-this.padding()*2;return this.wrap()===nT||o&&e+n>i}_tryToAddEllipsisToLastLine(){const e=this.attrs.width,t=e!==Bd&&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+o2)<n||(o.text=o.text.slice(0,o.text.length-3))),this.textArr.splice(this.textArr.length-1,1),this._addTextLine(o.text+o2))}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&&MH()?!0:super._useBufferCanvas()}};Ir.prototype._fillFunc=PH,Ir.prototype._strokeFunc=DH,Ir.prototype.className=_H,Ir.prototype._attrsAffectingSize=["text","fontSize","padding","wrap","lineHeight","letterSpacing"],Xr(Ir),ve.overWriteSetter(Ir,"width",V1()),ve.overWriteSetter(Ir,"height",V1()),ve.addGetterSetter(Ir,"direction",YE),ve.addGetterSetter(Ir,"fontFamily","Arial"),ve.addGetterSetter(Ir,"fontSize",12,Tt()),ve.addGetterSetter(Ir,"fontStyle",eT),ve.addGetterSetter(Ir,"fontVariant",eT),ve.addGetterSetter(Ir,"padding",0,Tt()),ve.addGetterSetter(Ir,"align",QE),ve.addGetterSetter(Ir,"verticalAlign",AH),ve.addGetterSetter(Ir,"lineHeight",1,Tt()),ve.addGetterSetter(Ir,"wrap",xH),ve.addGetterSetter(Ir,"ellipsis",!1,Ns()),ve.addGetterSetter(Ir,"letterSpacing",0,Tt()),ve.addGetterSetter(Ir,"text","",du()),ve.addGetterSetter(Ir,"textDecoration",""),ve.addGetterSetter(Ir,"underlineOffset",void 0,Tt()),ve.addGetterSetter(Ir,"charRenderFunc",void 0);var NH="",oT="normal";function iT(e){e.fillText(this.partialText,0,0)}function sT(e){e.strokeText(this.partialText,0,0)}var Eo=class extends _t{constructor(e){super(e),this.dummyCanvas=ze.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 ys.getPathLength(this.dataArray)}_getPointAtLength(e){return!this.attrs.data||e>this.pathLength?null:ys.getPointAtLengthOfDataArray(e,this.dataArray)}_readDataAttribute(){this.dataArray=ys.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 ze.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}setText(e){return Ir.prototype.setText.call(this,e)}_getContextFont(){return Ir.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=bc(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 h=d;for(let p=0;p<t.length;p++){const v=this._getPointAtLength(h);if(!v)return;const g=t[p].char;let y=t[p].width+i;if(g===" "&&s==="justify"){const P=this.text().split(" ").length-1;y+=(this.pathLength-u)/P}const _=h+y,w=this._getPointAtLength(_>this.pathLength&&_-this.pathLength<=l?this.pathLength:_);if(!w)return;const I=ys.getLineLength(v.x,v.y,w.x,w.y);let k=0;if(a)try{k=a(t[p-1].char,g)*this.fontSize()}catch{k=0}v.x+=k,w.x+=k,this.textWidth+=k;const C=ys.getPointOnLine(k+I/2,v.x,v.y,w.x,w.y),R=Math.atan2(w.y-v.y,w.x-v.x);this.glyphInfo.push({transposeX:C.x,transposeY:C.y,text:e[p],rotation:R,p0:v,p1:w,width:I}),h+=y}}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 ze.releaseCanvas(this.dummyCanvas),super.destroy()}};Eo.prototype._fillFunc=iT,Eo.prototype._strokeFunc=sT,Eo.prototype._fillFuncHit=iT,Eo.prototype._strokeFuncHit=sT,Eo.prototype.className="TextPath",Eo.prototype._attrsAffectingSize=["text","fontSize","data"],Xr(Eo),ve.addGetterSetter(Eo,"data"),ve.addGetterSetter(Eo,"fontFamily","Arial"),ve.addGetterSetter(Eo,"fontSize",12,Tt()),ve.addGetterSetter(Eo,"fontStyle",oT),ve.addGetterSetter(Eo,"align","left"),ve.addGetterSetter(Eo,"letterSpacing",0,Tt()),ve.addGetterSetter(Eo,"textBaseline","middle"),ve.addGetterSetter(Eo,"fontVariant",oT),ve.addGetterSetter(Eo,"text",NH),ve.addGetterSetter(Eo,"textDecoration",""),ve.addGetterSetter(Eo,"kerningFunc",void 0);var aT="tr-konva",BH=["resizeEnabledChange","rotateAnchorOffsetChange","rotateAnchorAngleChange","rotateEnabledChange","enabledAnchorsChange","anchorSizeChange","borderEnabledChange","borderStrokeChange","borderStrokeWidthChange","borderDashChange","anchorStrokeChange","anchorStrokeWidthChange","anchorFillChange","anchorCornerRadiusChange","ignoreStrokeChange","anchorStyleFuncChange"].map(e=>e+`.${aT}`).join(" "),lT="nodesRect",zH=["widthChange","heightChange","scaleXChange","scaleYChange","skewXChange","skewYChange","rotationChange","offsetXChange","offsetYChange","transformsEnabledChange","strokeWidthChange","draggableChange"],VH={"top-left":-45,"top-center":0,"top-right":45,"middle-right":-90,"middle-left":90,"bottom-left":-135,"bottom-center":180,"bottom-right":135},UH="ontouchstart"in Mt._global;function jH(e,t,n){if(e==="rotater")return n;t+=ze.degToRad(VH[e]||0);const r=(ze.radToDeg(t)%360+360)%360;return ze._inRange(r,337.5,360)||ze._inRange(r,0,22.5)?"ns-resize":ze._inRange(r,22.5,67.5)?"nesw-resize":ze._inRange(r,67.5,112.5)?"ew-resize":ze._inRange(r,112.5,157.5)?"nwse-resize":ze._inRange(r,157.5,202.5)?"ns-resize":ze._inRange(r,202.5,247.5)?"nesw-resize":ze._inRange(r,247.5,292.5)?"ew-resize":ze._inRange(r,292.5,337.5)?"nwse-resize":(ze.error("Transformer has unknown angle for cursor detection: "+r),"pointer")}var xg=["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"];function $H(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 cT(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 HH(e,t){return cT(e,t,$H(e))}function GH(e,t,n){let r=t;for(let o=0;o<e.length;o++){const i=Mt.getAngle(e[o]),s=Math.abs(i-t)%(Math.PI*2);Math.min(s,Math.PI*2-s)<n&&(r=i)}return r}var s2=0,Wn=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(BH,this.update),this.getNode()&&this.update()}attachTo(e){return this.setNode(e),this}setNode(e){return ze.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 aT+this._id}setNodes(e=[]){this._nodes&&this._nodes.length&&this.detach();const t=e.filter(n=>n.isAncestorOf(this)?(ze.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(zH.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(lT),this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")}_getNodeRect(){return this._getCache(lT,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=(Mt.getAngle(e.getAbsoluteRotation())+Math.PI*2)%(Math.PI*2);return cT({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},-Mt.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(h){const p=d.point(h);e.push(p)})});const t=new Fs;t.rotate(-Mt.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:Mt.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(),xg.forEach(e=>{this._createAnchor(e)}),this._createAnchor("rotater"),this._elementsCreated=!0}_createAnchor(e){const t=new jh({stroke:"rgb(0, 161, 255)",fill:"white",strokeWidth:1,name:e+" _anchor",dragDistance:0,draggable:!0,hitStrokeWidth:UH?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=jH(e,Mt.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 _t({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=ze.degToRad(a),d=Math.sin(u),h=-Math.cos(u),p=i/2,v=s/2;let g=1/0;h<0?g=Math.min(g,-v/h):h>0&&(g=Math.min(g,(s-v)/h)),d<0?g=Math.min(g,-p/d):d>0&&(g=Math.min(g,(i-p)/d));const y=p+d*g,_=v+h*g,w=ze._sign(s),I=y+d*l*w,k=_+h*l*w;t.moveTo(y,_),t.lineTo(I,k)}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},s2++,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 I=Mt.getAngle(this.rotateAnchorAngle());let k=Math.atan2(-n,t)+Math.PI/2-I;w.height<0&&(k-=Math.PI);const C=Mt.getAngle(this.rotation())+k,R=Mt.getAngle(this.rotationSnapTolerance()),P=HH(w,GH(this.rotationSnaps(),C,R)-w.rotation);this._fitNodesInto(P,e);return}const d=this.shiftBehavior();let h;d==="inverted"?h=this.keepRatio()&&!e.shiftKey:d==="none"?h=this.keepRatio():h=this.keepRatio()||e.shiftKey;let p=this.centeredScaling()||e.altKey;if(this._movingAnchorName==="top-left"){if(h){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 I=this.findOne(".top-left").x()>w.x?-1:1,k=this.findOne(".top-left").y()>w.y?-1:1;t=r*this.cos*I,n=r*this.sin*k,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(h){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 I=this.findOne(".top-right").x()<w.x?-1:1,k=this.findOne(".top-right").y()>w.y?-1:1;t=r*this.cos*I,n=r*this.sin*k,this.findOne(".top-right").x(w.x+t),this.findOne(".top-right").y(w.y-n)}var v=o.position();this.findOne(".top-left").y(v.y),this.findOne(".bottom-right").x(v.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(h){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 I=w.x<o.x()?-1:1,k=o.y()<w.y?-1:1;t=r*this.cos*I,n=r*this.sin*k,o.x(w.x-t),o.y(w.y+n)}v=o.position(),this.findOne(".top-left").x(v.x),this.findOne(".bottom-right").y(v.y)}else if(this._movingAnchorName==="bottom-center")this.findOne(".bottom-right").y(o.y());else if(this._movingAnchorName==="bottom-right"){if(h){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 I=this.findOne(".bottom-right").x()<w.x?-1:1,k=this.findOne(".bottom-right").y()<w.y?-1:1;t=r*this.cos*I,n=r*this.sin*k,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"),I=this.findOne(".bottom-right"),k=w.x(),C=w.y(),R=this.getWidth()-I.x(),P=this.getHeight()-I.y();I.move({x:-k,y:-C}),w.move({x:R,y:P})}const g=this.findOne(".top-left").getAbsolutePosition();t=g.x,n=g.y;const y=this.findOne(".bottom-right").x()-this.findOne(".top-left").x(),_=this.findOne(".bottom-right").y()-this.findOne(".top-left").y();this._fitNodesInto({x:t,y:n,width:y,height:_,rotation:Mt.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();s2--,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(ze._inRange(e.width,-this.padding()*2-r,r)){this.update();return}if(ze._inRange(e.height,-this.padding()*2-r,r)){this.update();return}const o=new Fs;if(o.rotate(Mt.getAngle(this.rotation())),this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf("left")>=0){const h=o.point({x:-this.padding()*2,y:0});e.x+=h.x,e.y+=h.y,e.width+=this.padding()*2,this._movingAnchorName=this._movingAnchorName.replace("left","right"),this._anchorDragOffset.x-=h.x,this._anchorDragOffset.y-=h.y}else if(this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf("right")>=0){const h=o.point({x:this.padding()*2,y:0});this._movingAnchorName=this._movingAnchorName.replace("right","left"),this._anchorDragOffset.x-=h.x,this._anchorDragOffset.y-=h.y,e.width+=this.padding()*2}if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf("top")>=0){const h=o.point({x:0,y:-this.padding()*2});e.x+=h.x,e.y+=h.y,this._movingAnchorName=this._movingAnchorName.replace("top","bottom"),this._anchorDragOffset.x-=h.x,this._anchorDragOffset.y-=h.y,e.height+=this.padding()*2}else if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf("bottom")>=0){const h=o.point({x:0,y:this.padding()*2});this._movingAnchorName=this._movingAnchorName.replace("bottom","top"),this._anchorDragOffset.x-=h.x,this._anchorDragOffset.y-=h.y,e.height+=this.padding()*2}if(this.boundBoxFunc()){const h=this.boundBoxFunc()(n,e);h?e=h:ze.warn("boundBoxFunc returned falsy. You should return new bound rect from it!")}const i=1e7,s=new Fs;s.translate(n.x,n.y),s.rotate(n.rotation),s.scale(n.width/i,n.height/i);const a=new Fs,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(h=>{var p;if(!h.getStage())return;const v=h.getParent().getAbsoluteTransform(),g=h.getTransform().copy();g.translate(h.offsetX(),h.offsetY());const y=new Fs;y.multiply(v.copy().invert()).multiply(d).multiply(v).multiply(g);const _=y.decompose();h.setAttrs(_),(p=h.getLayer())===null||p===void 0||p.batchDraw()}),this.rotation(ze._getRotation(e.rotation)),this._nodes.forEach(h=>{this._fire("transform",{evt:t,target:h}),h._fire("transform",{evt:t,target:h})}),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(ze._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(R=>{R.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(),h=ze.degToRad(u),p=Math.sin(h),v=-Math.cos(h),g=n/2,y=r/2;let _=1/0;v<0?_=Math.min(_,-y/v):v>0&&(_=Math.min(_,(r-y)/v)),p<0?_=Math.min(_,-g/p):p>0&&(_=Math.min(_,(n-g)/p));const w=g+p*_,I=y+v*_,k=ze._sign(r);this._batchChangeChild(".rotater",{x:w+p*d*k,y:I+v*d*k-s*v,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(R=>R.draggable()),x:0,y:0});const C=this.anchorStyleFunc();C&&l.forEach(R=>{C(R)}),(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?(ze.error("You cannot add external nodes to the Transformer. Use tr.nodes([node]) instead."),this):super.add(...e)}toObject(){return Ot.prototype.toObject.call(this)}clone(e){return Ot.prototype.clone.call(this,e)}getClientRect(){return this.nodes().length>0?super.getClientRect():{x:0,y:0,width:0,height:0}}};Wn.isTransforming=()=>s2>0;function WH(e){return e instanceof Array||ze.warn("enabledAnchors value should be an array"),e instanceof Array&&e.forEach(function(t){xg.indexOf(t)===-1&&ze.warn("Unknown anchor name: "+t+". Available names are: "+xg.join(", "))}),e||[]}Wn.prototype.className="Transformer",Xr(Wn),ve.addGetterSetter(Wn,"enabledAnchors",xg,WH),ve.addGetterSetter(Wn,"flipEnabled",!0,Ns()),ve.addGetterSetter(Wn,"resizeEnabled",!0),ve.addGetterSetter(Wn,"anchorSize",10,Tt()),ve.addGetterSetter(Wn,"rotateEnabled",!0),ve.addGetterSetter(Wn,"rotateLineVisible",!0),ve.addGetterSetter(Wn,"rotationSnaps",[]),ve.addGetterSetter(Wn,"rotateAnchorOffset",50,Tt()),ve.addGetterSetter(Wn,"rotateAnchorAngle",0,Tt()),ve.addGetterSetter(Wn,"rotateAnchorCursor","crosshair"),ve.addGetterSetter(Wn,"rotationSnapTolerance",5,Tt()),ve.addGetterSetter(Wn,"borderEnabled",!0),ve.addGetterSetter(Wn,"anchorStroke","rgb(0, 161, 255)"),ve.addGetterSetter(Wn,"anchorStrokeWidth",1,Tt()),ve.addGetterSetter(Wn,"anchorFill","white"),ve.addGetterSetter(Wn,"anchorCornerRadius",0,Tt()),ve.addGetterSetter(Wn,"borderStroke","rgb(0, 161, 255)"),ve.addGetterSetter(Wn,"borderStrokeWidth",1,Tt()),ve.addGetterSetter(Wn,"borderDash"),ve.addGetterSetter(Wn,"keepRatio",!0),ve.addGetterSetter(Wn,"shiftBehavior","default"),ve.addGetterSetter(Wn,"centeredScaling",!1),ve.addGetterSetter(Wn,"ignoreStroke",!1),ve.addGetterSetter(Wn,"padding",0,Tt()),ve.addGetterSetter(Wn,"nodes"),ve.addGetterSetter(Wn,"node"),ve.addGetterSetter(Wn,"boundBoxFunc"),ve.addGetterSetter(Wn,"anchorDragBoundFunc"),ve.addGetterSetter(Wn,"anchorStyleFunc"),ve.addGetterSetter(Wn,"shouldOverdrawWholeArea",!1),ve.addGetterSetter(Wn,"useSingleNodeRotation",!0),ve.backCompat(Wn,{lineEnabled:"borderEnabled",rotateHandlerOffset:"rotateAnchorOffset",enabledHandlers:"enabledAnchors"});var wl=class extends _t{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.radius(),0,Mt.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)}};wl.prototype.className="Wedge",wl.prototype._centroid=!0,wl.prototype._attrsAffectingSize=["radius"],Xr(wl),ve.addGetterSetter(wl,"radius",0,Tt()),ve.addGetterSetter(wl,"angle",0,Tt()),ve.addGetterSetter(wl,"clockwise",!1),ve.backCompat(wl,{angleDeg:"angle",getAngleDeg:"getAngle",setAngleDeg:"setAngle"});function uT(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}var qH=[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],KH=[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 YH(e,t){const n=e.data,r=e.width,o=e.height;let i,s,a,l,u,d,h,p,v,g,y,_,w,I,k,C,R,P,M,$;const F=t+t+1,D=r-1,V=o-1,x=t+1,B=x*(x+1)/2,T=new uT,te=qH[t],U=KH[t];let W=null,Y=T,J=null,Oe=null;for(let de=1;de<F;de++)Y=Y.next=new uT,de===x&&(W=Y);Y.next=T,a=s=0;for(let de=0;de<o;de++){_=w=I=k=l=u=d=h=0,p=x*(C=n[s]),v=x*(R=n[s+1]),g=x*(P=n[s+2]),y=x*(M=n[s+3]),l+=B*C,u+=B*R,d+=B*P,h+=B*M,Y=T;for(let oe=0;oe<x;oe++)Y.r=C,Y.g=R,Y.b=P,Y.a=M,Y=Y.next;for(let oe=1;oe<x;oe++)i=s+((D<oe?D:oe)<<2),l+=(Y.r=C=n[i])*($=x-oe),u+=(Y.g=R=n[i+1])*$,d+=(Y.b=P=n[i+2])*$,h+=(Y.a=M=n[i+3])*$,_+=C,w+=R,I+=P,k+=M,Y=Y.next;J=T,Oe=W;for(let oe=0;oe<r;oe++)n[s+3]=M=h*te>>U,M!==0?(M=255/M,n[s]=(l*te>>U)*M,n[s+1]=(u*te>>U)*M,n[s+2]=(d*te>>U)*M):n[s]=n[s+1]=n[s+2]=0,l-=p,u-=v,d-=g,h-=y,p-=J.r,v-=J.g,g-=J.b,y-=J.a,i=a+((i=oe+t+1)<D?i:D)<<2,_+=J.r=n[i],w+=J.g=n[i+1],I+=J.b=n[i+2],k+=J.a=n[i+3],l+=_,u+=w,d+=I,h+=k,J=J.next,p+=C=Oe.r,v+=R=Oe.g,g+=P=Oe.b,y+=M=Oe.a,_-=C,w-=R,I-=P,k-=M,Oe=Oe.next,s+=4;a+=r}for(let de=0;de<r;de++){w=I=k=_=u=d=h=l=0,s=de<<2,p=x*(C=n[s]),v=x*(R=n[s+1]),g=x*(P=n[s+2]),y=x*(M=n[s+3]),l+=B*C,u+=B*R,d+=B*P,h+=B*M,Y=T;for(let pe=0;pe<x;pe++)Y.r=C,Y.g=R,Y.b=P,Y.a=M,Y=Y.next;let oe=r;for(let pe=1;pe<=t;pe++)s=oe+de<<2,l+=(Y.r=C=n[s])*($=x-pe),u+=(Y.g=R=n[s+1])*$,d+=(Y.b=P=n[s+2])*$,h+=(Y.a=M=n[s+3])*$,_+=C,w+=R,I+=P,k+=M,Y=Y.next,pe<V&&(oe+=r);s=de,J=T,Oe=W;for(let pe=0;pe<o;pe++)i=s<<2,n[i+3]=M=h*te>>U,M>0?(M=255/M,n[i]=(l*te>>U)*M,n[i+1]=(u*te>>U)*M,n[i+2]=(d*te>>U)*M):n[i]=n[i+1]=n[i+2]=0,l-=p,u-=v,d-=g,h-=y,p-=J.r,v-=J.g,g-=J.b,y-=J.a,i=de+((i=pe+x)<V?i:V)*r<<2,l+=_+=J.r=n[i],u+=w+=J.g=n[i+1],d+=I+=J.b=n[i+2],h+=k+=J.a=n[i+3],J=J.next,p+=C=Oe.r,v+=R=Oe.g,g+=P=Oe.b,y+=M=Oe.a,_-=C,w-=R,I-=P,k-=M,Oe=Oe.next,s+=r}}var XH=function(t){const n=Math.round(this.blurRadius());n>0&&YH(t,n)};ve.addGetterSetter(Ot,"blurRadius",0,Tt(),ve.afterSetFilter);var ZH=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};ve.addGetterSetter(Ot,"brightness",0,Tt(),ve.afterSetFilter);var QH=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)},JH=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};ve.addGetterSetter(Ot,"contrast",0,Tt(),ve.afterSetFilter);var eG=function(e){var t,n,r,o,i,s,a,l,u;const d=e.data,h=e.width,p=e.height,v=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)),g=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)),y=(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,_=!!((u=(l=this.embossBlend)===null||l===void 0?void 0:l.call(this))!==null&&u!==void 0&&u),w=v*10,I=g*255,k=y*Math.PI/180,C=Math.cos(k),R=Math.sin(k),P=128/1020*w,M=new Uint8ClampedArray(d),$=new Float32Array(h*p);for(let B=0,T=0;T<d.length;T+=4,B++)$[B]=.2126*M[T]+.7152*M[T+1]+.0722*M[T+2];const F=[-1,0,1,-2,0,2,-1,0,1],D=[-1,-2,-1,0,0,0,1,2,1],V=[-h-1,-h,-h+1,-1,0,1,h-1,h,h+1],x=B=>B<0?0:B>255?255:B;for(let B=1;B<p-1;B++)for(let T=1;T<h-1;T++){const te=B*h+T;let U=0,W=0;U+=$[te+V[0]]*F[0],W+=$[te+V[0]]*D[0],U+=$[te+V[1]]*F[1],W+=$[te+V[1]]*D[1],U+=$[te+V[2]]*F[2],W+=$[te+V[2]]*D[2],U+=$[te+V[3]]*F[3],W+=$[te+V[3]]*D[3],U+=$[te+V[5]]*F[5],W+=$[te+V[5]]*D[5],U+=$[te+V[6]]*F[6],W+=$[te+V[6]]*D[6],U+=$[te+V[7]]*F[7],W+=$[te+V[7]]*D[7],U+=$[te+V[8]]*F[8],W+=$[te+V[8]]*D[8];const Y=x(I+(C*U+R*W)*P),J=te*4;if(_){const Oe=Y-I;d[J]=x(M[J]+Oe),d[J+1]=x(M[J+1]+Oe),d[J+2]=x(M[J+2]+Oe),d[J+3]=M[J+3]}else d[J]=d[J+1]=d[J+2]=Y,d[J+3]=M[J+3]}for(let B=0;B<h;B++){let T=B*4,te=((p-1)*h+B)*4;d[T]=M[T],d[T+1]=M[T+1],d[T+2]=M[T+2],d[T+3]=M[T+3],d[te]=M[te],d[te+1]=M[te+1],d[te+2]=M[te+2],d[te+3]=M[te+3]}for(let B=1;B<p-1;B++){let T=B*h*4,te=(B*h+(h-1))*4;d[T]=M[T],d[T+1]=M[T+1],d[T+2]=M[T+2],d[T+3]=M[T+3],d[te]=M[te],d[te+1]=M[te+1],d[te+2]=M[te+2],d[te+3]=M[te+3]}return e};ve.addGetterSetter(Ot,"embossStrength",.5,Tt(),ve.afterSetFilter),ve.addGetterSetter(Ot,"embossWhiteLevel",.5,Tt(),ve.afterSetFilter),ve.addGetterSetter(Ot,"embossDirection","top-left",void 0,ve.afterSetFilter),ve.addGetterSetter(Ot,"embossBlend",!1,void 0,ve.afterSetFilter);function a2(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 tG=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,h;const p=this.enhance();if(p===0)return;for(let k=0;k<n;k+=4)i=t[k+0],i<r?r=i:i>o&&(o=i),l=t[k+1],l<s?s=l:l>a&&(a=l),h=t[k+2],h<u?u=h:h>d&&(d=h);o===r&&(o=255,r=0),a===s&&(a=255,s=0),d===u&&(d=255,u=0);let v,g,y,_,w,I;if(p>0)v=o+p*(255-o),g=r-p*(r-0),y=a+p*(255-a),_=s-p*(s-0),w=d+p*(255-d),I=u-p*(u-0);else{const k=(o+r)*.5;v=o+p*(o-k),g=r+p*(r-k);const C=(a+s)*.5;y=a+p*(a-C),_=s+p*(s-C);const R=(d+u)*.5;w=d+p*(d-R),I=u+p*(u-R)}for(let k=0;k<n;k+=4)t[k+0]=a2(t[k+0],r,o,g,v),t[k+1]=a2(t[k+1],s,a,_,y),t[k+2]=a2(t[k+2],u,d,I,w)};ve.addGetterSetter(Ot,"enhance",0,Tt(),ve.afterSetFilter);var nG=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}};ve.addGetterSetter(Ot,"hue",0,Tt(),ve.afterSetFilter),ve.addGetterSetter(Ot,"saturation",0,Tt(),ve.afterSetFilter),ve.addGetterSetter(Ot,"luminance",0,Tt(),ve.afterSetFilter);var rG=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,h=.114*r-.114*a-.497*l,p=.299*r-.299*a-.328*l,v=.587*r+.413*a+.035*l,g=.114*r-.114*a+.293*l,y=.299*r-.3*a+1.25*l,_=.587*r-.586*a-1.05*l,w=.114*r+.886*a-.2*l;let I,k,C,R;for(let P=0;P<n;P+=4)I=t[P+0],k=t[P+1],C=t[P+2],R=t[P+3],t[P+0]=u*I+d*k+h*C+s,t[P+1]=p*I+v*k+g*C+s,t[P+2]=y*I+_*k+w*C+s,t[P+3]=R},oG=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,h=.299*r-.299*s-.328*a,p=.587*r+.413*s+.035*a,v=.114*r-.114*s+.293*a,g=.299*r-.3*s+1.25*a,y=.587*r-.586*s-1.05*a,_=.114*r+.886*s-.2*a;for(let w=0;w<n;w+=4){const I=t[w+0],k=t[w+1],C=t[w+2],R=t[w+3];t[w+0]=l*I+u*k+d*C,t[w+1]=h*I+p*k+v*C,t[w+2]=g*I+y*k+_*C,t[w+3]=R}};ve.addGetterSetter(Ot,"hue",0,Tt(),ve.afterSetFilter),ve.addGetterSetter(Ot,"saturation",0,Tt(),ve.afterSetFilter),ve.addGetterSetter(Ot,"value",0,Tt(),ve.afterSetFilter);var iG=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]},sG=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,h=s-l;const p=Math.sqrt(d*d+h*h);u=p>u?p:u;const v=s,g=i,y=360/g*Math.PI/180;for(let _=0;_<g;_+=1){const w=Math.sin(_*y),I=Math.cos(_*y);for(let k=0;k<v;k+=1){d=Math.floor(a+u*k/v*I),h=Math.floor(l+u*k/v*w);let C=(h*i+d)*4;const R=r[C+0],P=r[C+1],M=r[C+2],$=r[C+3];C=(_+k*i)*4,o[C+0]=R,o[C+1]=P,o[C+2]=M,o[C+3]=$}}},aG=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,h=s-l;const p=Math.sqrt(d*d+h*h);u=p>u?p:u;const v=s,g=i,y=n.polarRotation||0;let _,w;for(d=0;d<i;d+=1)for(h=0;h<s;h+=1){const I=d-a,k=h-l,C=Math.sqrt(I*I+k*k)*v/u;let R=(Math.atan2(k,I)*180/Math.PI+360+y)%360;R=R*g/360,_=Math.floor(R),w=Math.floor(C);let P=(w*i+_)*4;const M=r[P+0],$=r[P+1],F=r[P+2],D=r[P+3];P=(h*i+d)*4,o[P+0]=M,o[P+1]=$,o[P+2]=F,o[P+3]=D}},lG=function(e){const t=e.width,n=e.height;let r,o,i,s,a,l,u,d,h,p,v=Math.round(this.kaleidoscopePower());const g=Math.round(this.kaleidoscopeAngle()),y=Math.floor(t*(g%360)/360);if(v<1)return;const _=ze.createCanvasElement();_.width=t,_.height=n;const w=_.getContext("2d").getImageData(0,0,t,n);ze.releaseCanvas(_),sG(e,w,{polarCenterX:t/2,polarCenterY:n/2});let I=t/Math.pow(2,v);for(;I<=8;)I=I*2,v-=1;I=Math.ceil(I);let k=I,C=0,R=k,P=1;for(y+I>t&&(C=k,R=0,P=-1),o=0;o<n;o+=1)for(r=C;r!==R;r+=P)i=Math.round(r+y)%t,h=(t*o+i)*4,a=w.data[h+0],l=w.data[h+1],u=w.data[h+2],d=w.data[h+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(k=Math.floor(I),s=0;s<v;s+=1){for(r=0;r<k+1;r+=1)h=(t*o+r)*4,a=w.data[h+0],l=w.data[h+1],u=w.data[h+2],d=w.data[h+3],p=(t*o+k*2-r-1)*4,w.data[p+0]=a,w.data[p+1]=l,w.data[p+2]=u,w.data[p+3]=d;k*=2}aG(w,e,{polarRotation:0})};ve.addGetterSetter(Ot,"kaleidoscopePower",2,Tt(),ve.afterSetFilter),ve.addGetterSetter(Ot,"kaleidoscopeAngle",0,Tt(),ve.afterSetFilter);function Rg(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 Gh(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 cG(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 uG(e,t){const n=Rg(e,0,0),r=Rg(e,e.width-1,0),o=Rg(e,0,e.height-1),i=Rg(e,e.width-1,e.height-1),s=t||10;if(Gh(n,r)<s&&Gh(r,i)<s&&Gh(i,o)<s&&Gh(o,n)<s){const a=cG([r,n,i,o]),l=[];for(let u=0;u<e.width*e.height;u++)l[u]=Gh(a,[e.data[u*4],e.data[u*4+1],e.data[u*4+2]])<s?0:255;return l}}function dG(e,t){for(let n=0;n<e.width*e.height;n++)e.data[4*n+3]=t[n]}function fG(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 h=0;h<o;h++)for(let p=0;p<o;p++){const v=a+h-i,g=l+p-i;if(v>=0&&v<n&&g>=0&&g<t){const y=v*t+g,_=r[h*o+p];d+=e[y]*_}}s[u]=d===2040?255:0}return s}function hG(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 h=0;h<o;h++)for(let p=0;p<o;p++){const v=a+h-i,g=l+p-i;if(v>=0&&v<n&&g>=0&&g<t){const y=v*t+g,_=r[h*o+p];d+=e[y]*_}}s[u]=d>=1020?255:0}return s}function pG(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 h=0;h<o;h++)for(let p=0;p<o;p++){const v=a+h-i,g=l+p-i;if(v>=0&&v<n&&g>=0&&g<t){const y=v*t+g,_=r[h*o+p];d+=e[y]*_}}s[u]=d}return s}var mG=function(e){let t=uG(e,this.threshold());return t&&(t=fG(t,e.width,e.height),t=hG(t,e.width,e.height),t=pG(t,e.width,e.height),dG(e,t)),e};ve.addGetterSetter(Ot,"threshold",0,Tt(),ve.afterSetFilter);var gG=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()};ve.addGetterSetter(Ot,"noise",.2,Tt(),ve.afterSetFilter);var vG=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){ze.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,h=0,p=0;const v=a*t,g=v+t,y=l*t,_=y+t;let w=0;for(let I=v;I<g;I+=1)if(!(I>=n))for(let k=y;k<_;k+=1){if(k>=r)continue;const C=(n*k+I)*4;u+=s[C+0],d+=s[C+1],h+=s[C+2],p+=s[C+3],w+=1}u=u/w,d=d/w,h=h/w,p=p/w;for(let I=v;I<g;I+=1)if(!(I>=n))for(let k=y;k<_;k+=1){if(k>=r)continue;const C=(n*k+I)*4;s[C+0]=u,s[C+1]=d,s[C+2]=h,s[C+3]=p}}};ve.addGetterSetter(Ot,"pixelSize",8,Tt(),ve.afterSetFilter);var yG=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};ve.addGetterSetter(Ot,"levels",.5,Tt(),ve.afterSetFilter);var bG=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]}};ve.addGetterSetter(Ot,"red",0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)}),ve.addGetterSetter(Ot,"green",0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)}),ve.addGetterSetter(Ot,"blue",0,dE,ve.afterSetFilter);var wG=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}};ve.addGetterSetter(Ot,"red",0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)}),ve.addGetterSetter(Ot,"green",0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)}),ve.addGetterSetter(Ot,"blue",0,dE,ve.afterSetFilter),ve.addGetterSetter(Ot,"alpha",1,function(e){return this._filterUpToDate=!1,e>1?1:e<0?0:e});var CG=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)}},kG=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},SG=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};ve.addGetterSetter(Ot,"threshold",.5,Tt(),ve.afterSetFilter);var _G=jE.Util._assign(jE,{Arc:yl,Arrow:pu,Circle:Nd,Ellipse:gc,Image:Bs,Label:r2,Tag:mu,Line:bl,Path:ys,Rect:jh,RegularPolygon:vc,Ring:gu,Sprite:wa,Star:yc,Text:Ir,TextPath:Eo,Transformer:Wn,Wedge:wl,Filters:{Blur:XH,Brightness:QH,Brighten:ZH,Contrast:JH,Emboss:eG,Enhance:tG,Grayscale:nG,HSL:rG,HSV:oG,Invert:iG,Kaleidoscope:lG,Mask:mG,Noise:gG,Pixelate:vG,Posterize:yG,RGB:bG,RGBA:wG,Sepia:CG,Solarize:kG,Threshold:SG}}),AG=_G;Ut();var IG=["dialog","floating"],dT=["top-right","top-left","bottom-right","bottom-left","top-center","bottom-center"];function EG(e){if(!e||typeof e!="object")throw new Error("SurfaceManager: request must be a non-null object.");if(!IG.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&&!dT.includes(e.floating.placement))throw new Error(`SurfaceManager: floating.placement must be one of ${dT.join(", ")}, got "${e.floating.placement}".`)}var TG=class{activeDialog=Yr(null);activeFloating=Yr(null);#e=!1;#t=1;#n;constructor({getModuleConfig:e}){this.#n=e}open(e){if(this.#e)return this.#u(e);EG(e);const t=this.#d(e),{component:n,props:r,render:o}=this.#f(t);let i,s=!1;const a=new Promise(v=>{i=g=>s?!1:(s=!0,v(g),!0)});let l;const u=v=>{i({status:"submitted",data:v})&&this.#o(l)},d=v=>{i({status:"closed",reason:v})&&this.#o(l)};l={id:t.id,mode:t.mode,request:t,component:n,props:r,render:o,resolve:u,close:d,settle:v=>i(v),get settled(){return s}};const h=t.mode==="dialog"?"activeDialog":"activeFloating",p=this[h].value;return p&&!p.settled&&p.settle({status:"replaced",replacedBy:t.id}),this[h].value=l,{id:t.id,mode:t.mode,close:v=>this.#r(l,v),result:a}}close(e,t){if(e!=null){const o=this.#c(e);o&&this.#r(o,t);return}const n=this.activeDialog.value;if(n&&!n.settled){this.#r(n,t);return}const r=this.activeFloating.value;r&&!r.settled&&this.#r(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"})}#r(e,t){e.settled||(e.settle({status:"closed",reason:t}),this.#o(e))}#o(e){const t=e.mode==="dialog"?this.activeDialog:this.activeFloating;t.value===e&&(t.value=null)}#c(e){return this.activeDialog.value?.id===e?this.activeDialog.value:this.activeFloating.value?.id===e?this.activeFloating.value:null}#d(e){const t=e.id??`surface-${this.#t++}`,n=this.#n()??{},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}}#f(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.#n()?.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.`)}#u(e){return{id:e?.id??`surface-${this.#t++}`,mode:e?.mode??"dialog",close:()=>{},result:Promise.resolve({status:"destroyed"})}}},xG="https://docs.superdoc.dev/guides/migration/document-api",fT=new Set;function Lg(e,t){fT.has(e)||(fT.add(e),console.warn(t))}var RG={state:"editor.state",view:"editor.view",schema:"editor.schema",commands:"editor.commands",chain:"editor.chain()",can:"editor.can()",dispatch:"editor.dispatch()"},hT=Symbol.for("superdoc:rawEditor"),pT=new WeakMap;function mT(e){return!e||e[hT]?e:new Proxy(e,{get(t,n){if(n===hT)return t;const r=RG[n];r&&Lg(`deprecated:${String(n)}`,`[SuperDoc] ${r} is deprecated and will be removed in a future version. Use the Document API (editor.doc) instead. See ${xG}`);const o=Reflect.get(t,n,t);if(typeof o=="function"){let i=pT.get(t);return i||(i=new Map,pT.set(t,i)),i.has(n)||i.set(n,o.bind(t)),i.get(n)}return o}})}var gT=["review","original","final","off"],LG=["original","markup","final"],MG=["paired","independent"],vT=Symbol.for("@superdoc/trackChanges:normalized"),yT=new Set;function l2(e,t){yT.has(e)||(yT.add(e),console.warn(`[SuperDoc] ${e} is deprecated β use ${t} instead.`))}function bT(e,t,n){return typeof e=="boolean"?e:typeof t=="boolean"?t:n}function OG(e,t,n){return typeof e=="string"&&gT.includes(e)?e:typeof t=="string"&&gT.includes(t)?t:n}function PG(e){return typeof e!="string"||!LG.includes(e)?null:e}function DG(e){return e==="markup"?"review":e}function FG(e){return typeof e=="string"&&MG.includes(e)?e:null}function NG(e){return e==="grouped"?"paired":e==="separate"?"independent":null}function BG(e){return e==="paired"?"grouped":"separate"}function zs(e){return!e||typeof e!="object"||Array.isArray(e)?null:e}function c2(e){const t=e[vT]===!0,n=zs(e.viewing),r=PG(n?.trackedChanges);zs(e.modules)||(e.modules={});const o=zs(e.trackChanges),i=zs(e.modules.trackChanges),s=zs(e.layoutEngineOptions?.trackedChanges);t||(o&&Object.prototype.hasOwnProperty.call(o,"visible")&&l2("config.trackChanges.visible","config.viewing.trackedChanges"),i&&l2("config.modules.trackChanges","config.trackChanges for behavior and config.viewing.trackedChanges for viewing projection"),s&&l2("config.layoutEngineOptions.trackedChanges","config.viewing.trackedChanges for display and config.trackChanges.enabled for behavior"));const a=r?r==="markup":bT(o?.visible,i?.visible,!1),l=bT(o?.enabled,i?.enabled,typeof s?.enabled=="boolean"?s.enabled:!0),u=NG(o?.replacementMode)??FG(i?.replacements)??"paired",d=zs(o?.authorColors)??zs(i?.authorColors),h=d||void 0,p=zs(o?.semanticColors)??zs(i?.semanticColors),v=p||void 0,g=e.documentMode==="viewing",y=g?a?"review":"original":"review",_=r?g?DG(r):"review":OG(i?.mode,s?.mode,y),w={visible:a,mode:_,enabled:l,replacements:u};return h&&(w.authorColors=h),v&&(w.semanticColors=v),e.modules.trackChanges=w,e.trackChanges={visible:a,enabled:l,replacementMode:BG(u)},h&&(e.trackChanges.authorColors=h),v&&(e.trackChanges.semanticColors=v),zs(e.layoutEngineOptions)||(e.layoutEngineOptions={}),e.layoutEngineOptions.trackedChanges={mode:_,enabled:l},typeof n?.comments=="boolean"&&(zs(e.comments)||(e.comments={}),e.comments.visible=n.comments),Object.defineProperty(e,vT,{value:!0,writable:!0,configurable:!0,enumerable:!1}),w}var u2=Object.freeze({id:null,name:"Default SuperDoc user",email:null});function zG(e){return!e||typeof e!="object"?{...u2}:{...u2,...e}}var Mg=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"}),es=e=>Array.isArray(e),VG=e=>We(e),UG=e=>typeof e.onSelect=="function",d2=Object.freeze({toolbar:!0,comments:!0,contextMenu:!0,loading:!0,search:!1,linkPopover:!1,ruler:!1,contentControls:!0}),jG=Object.freeze(["left","center","right"]),$G=Object.freeze({compact:32,default:80,wide:120}),HG=e=>Object.prototype.hasOwnProperty.call(d2,e),$Q=Object.freeze(Object.keys(d2).filter(HG));function wT(e,t){const n=e?.[t];return n===!1?!1:n===void 0?d2[t]:!0}function GG(e,t){const n=e?.[t];return VG(n)?n:{}}var CT=Object.freeze(["level","readOnly","allowResolve","permissionResolver"]);function WG(e){if(!("panel"in e)&&!("highlights"in e))return e;const{panel:t,highlights:n,...r}=e;return r}function qG(e){if(!CT.some(n=>n in e))return e;const t={...e};for(const n of CT)delete t[n];return t}function kT(e){const t={...e},n=cu(e.sections,e.customItems),r=cu(e.defaultItems,e.includeDefaultItems);return delete t.customItems,delete t.includeDefaultItems,Si(t,{sections:n,defaultItems:r})}var ST=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 KG(e){return We(e)?Object.fromEntries(Object.entries(e).filter(([t,n])=>ST[t]!==void 0&&n!==void 0).map(([t,n])=>[ST[t],n])):{}}function _T(e){const t={...e};return delete t.strings,delete t.replaceControls,delete t.includeTrackedDeletions,Si(t,KG(e.strings),{replaceEnabled:cu(e.replaceControls,e.replaceEnabled),includeDeletedText:cu(e.includeTrackedDeletions,e.includeDeletedText)})}var YG=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"}),XG=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 Og(e,t){return t[String(e)]??e}function f2(e,t){if(!We(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])=>[Og(i,t),s]))}function AT(e){return es(e)?e.map(t=>Og(t,Mg)):e}function IT(e){return We(e)?Object.fromEntries(Object.entries(e).map(([t,n])=>[t,AT(n)])):e}function ZG(e,t){if(!We(e)||!es(t))return e;const n={...e};for(const r of t){if(!We(r))continue;const o=r.region??"center";n[o]===void 0&&(n[o]=[])}return n}var QG=Object.freeze({watermark:"center","page-number":"center","formatting-marks":"right","table-of-contents":"center"});function JG(e,t){if(!We(e)||!es(t))return e;const n=Object.fromEntries(Object.entries(e).map(([o,i])=>[o,es(i)?[...i]:i])),r=new Set(Object.values(n).flatMap(o=>es(o)?o:[]).map(o=>Og(o,Mg)));for(const o of t){const i=Og(o,Mg);if(r.has(i))continue;const s=QG[o];if(!s)continue;const a=n[s];n[s]=es(a)?[...a,o]:[o],r.add(i)}return n}function ET(e,t){return ZG(JG(e,t.includeItems),t.customItems)}function eW(e){return es(e)?e.map(t=>{if(!We(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 tW(e){return es(e)?e.map(t=>{if(!We(t)||typeof t.id!="string")return t;const n=t.size??"default",r=t.type==="separator"?void 0:$G[String(n)],o=t.style,i={...t,name:t.id,group:t.region,isNarrow:n==="compact",isWide:n==="wide",...r?{layoutWidth:r,style:{...o,width:`${r-2}px`}}:{}};if(t.label){i.defaultLabel===void 0&&(i.defaultLabel=t.label);const s=t.attributes??{};i.attributes={...s,ariaLabel:s.ariaLabel??t.label}}return t.type==="dropdown"&&es(t.options)&&(i.options=t.options.map(s=>We(s)?{...s,key:s.value??s.id,value:s.value??s.id}:s),i.dropdownValueKey="value"),UG(t)&&(i.command=({item:s,argument:a,payload:l,...u})=>t.onSelect({...u,value:a})),delete i.id,delete i.region,delete i.size,delete i.onSelect,i}):e}function nW(e){const t={...e},n=cu(e.items,We(e.groups)?e.groups:void 0),r=We(e.items)&&Object.keys(e.items).length===0?{center:[]}:n,o=ET(r,e),i=o===void 0?e.groups:IT(o),s=f2(e.icons,YG),a=Si(f2(e.texts,{}),f2(e.strings,XG)),l=es(e.includeItems)?new Set(e.includeItems):null,u=We(r)?new Set(Object.values(r).flatMap(d=>es(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,Si(t,{groups:i,excludeItems:AT(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:eW(e.fontOptions),customButtons:e.customItems===void 0?e.customButtons:tW(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 TT(e={}){const t=e.ui,n=t===!1,r=We(t)?t:void 0,o=B=>!n&&wT(r,B),i=B=>n?!1:r?.[B]===void 0?void 0:wT(r,B),s=B=>n?{}:GG(r,B),a=n||i("ruler")===!1,l=n||i("linkPopover")===!1,u=l?void 0:cu(s("linkPopover").popoverResolver,e.modules?.links?.popoverResolver),d=i("contentControls")??(!n&&e.modules?.contentControls?.chrome!=="none"),h=e.modules?.contentControls?.chrome==="none"?void 0:e.modules?.contentControls?.chrome,p=s("toolbar"),v=nW(p),g=We(p.items),y=e.modules?.toolbar,_=We(y)?y:{},w=e.modules?.contextMenu??e.modules?.slashMenu,I=We(w)?w:{},k=e.modules?.surfaces?.findReplace,C=_T(We(k)?k:{}),R=We(_.groups)?IT(ET(_.groups,p)):_.groups,P=[v.groups,R],M=P.find(We),$=P.find(es),F=g?Object.keys(v.groups??{}):cu($,_.toolbarGroups,e.toolbarGroups),D=es(F)?F.map(String):null,V=(B,T)=>Object.prototype.hasOwnProperty.call(B,T),x=M&&D?Object.fromEntries([...D.filter(B=>V(M,B)),...Object.keys(M).filter(B=>!jG.includes(B))].map(B=>[B,M[B]])):M;return{enabled:!n,toolbar:{enabled:o("toolbar"),container:n?null:[p.container,_.selector,e.toolbar].find(B=>B!==void 0)??null,options:n?{}:{...Si(_,v),groups:x,toolbarGroups:F,icons:Si(e.toolbarIcons,_.icons,v.icons),texts:Si(e.toolbarTexts,_.texts,v.texts)}},comments:{enabled:(i("comments")??(!n&&e.modules?.comments!==!1))&&s("comments").panel!==!1,highlights:s("comments").highlights!==!1,options:n?{}:m4(qG(WG(s("comments"))))||{}},contextMenu:{enabled:i("contextMenu")??(!n&&e.disableContextMenu!==!0),suppressed:n||i("contextMenu")===!1,options:n?{}:Si(kT(I),kT(s("contextMenu")))},loading:{enabled:o("loading")},search:{enabled:i("search")??(!n&&!!e.modules?.surfaces?.findReplace),options:n?{}:Si(C,_T(s("search")))},linkPopover:{enabled:typeof u=="function",suppressed:l,options:Si(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?Si({chrome:h},s("contentControls")):{chrome:"none"}}}}var rW=e=>e==="read"||e==="write"||e==="resolve";function xT(e={}){const t=We(e.interaction)?e.interaction:{},n=We(t.comments)?t.comments:{},r=We(t.trackedChanges)?t.trackedChanges:{},o=We(e.modules?.comments)?e.modules.comments:{},i=(n.readOnly??o.readOnly??!1)===!0,s=(n.allowResolve??o.allowResolve??!0)!==!1,a=n.level,l=rW(a),u=l?a:i?"read":s?"resolve":"write",d=r.allowDecisions;return{comments:{level:u,readOnly:l?u==="read":i,allowResolve:l?u==="resolve":s},trackedChanges:{allowDecisions:typeof d=="boolean"?d:!i}}}function RT(e={}){const t=We(e.surfaces)?e.surfaces:{},n=We(e.modules?.surfaces)?e.modules.surfaces:{},r=t.resolver===void 0?n.resolver:t.resolver;return{resolver:typeof r=="function"?r:null,dialog:Si(n.dialog,t.dialog),floating:Si(n.floating,t.floating)}}var oW="https://docs.superdoc.dev/editor/fonts/";function iW(e){return e==="localhost"||e.endsWith(".localhost")||e==="0.0.0.0"||e==="::1"||e==="[::1]"||e.startsWith("127.")}function sW(e,t,n=typeof window>"u"?"":window.location.hostname){if(!iW(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: ${oW}`)}var aW=class{#e=new Map;#t=new Map;#n=null;#r=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.#t.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.#t.set(t,e.id)}unregister(e){const t=this.#e.get(e);return t?(this.#e.delete(e),t.root&&this.#t.delete(t.root),this.#n===e&&(this.#n=null,this.#o({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.#n===null?null:this.#e.get(this.#n)}getActiveId(){return this.#n}setActive(e,t){if(e!==null&&!this.#e.has(e))throw new Error(`EditorRuntimeRegistry: cannot activate unknown runtime "${e}"`);if(e===this.#n)return;const n=this.#n;this.#n=e;let r=null;e!==null&&(r=this.#e.get(e).getLegacyEditorProjection?.()??null),this.#o({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(`[${ug}]`);if(!n)return null;const r=n.getAttribute(ug),o=r?this.get(r):null;return o&&o.root===n?o:null}subscribe(e){return this.#r.add(e),()=>{this.#r.delete(e)}}clear(){this.#e.clear(),this.#t.clear(),this.#n=null,this.#r.clear()}#o(e){for(const t of Array.from(this.#r))try{t(e)}catch{}}},lW=["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"],LT=[{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:lW,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"}],MT=new Map(LT.map(e=>[e.name,e])),cW=LT.map(e=>e.name);function h2(e){return MT.get(e)??null}function OT(e){const t=MT.get(e);return t?.disposition==="controller-routed"?t.commandId:null}var uW=(e,t)=>{let n=e.replace(/[^0-9.]/g,"");return n=parseFloat(n),isNaN(n)&&(n=t),n=parseFloat(n),n},dW=(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 h=t-(d-s);return o=u,h<=0||h>t?(r&&(clearTimeout(r),r=null),s=d,i=e(...u),r||(o=null)):!r&&n.trailing!==!1&&(r=setTimeout(a,h)),i};return l.cancel=function(){clearTimeout(r),s=0,r=o=null},l};Ut(),En();var fW={class:"sd-toolbar-icon"},hW=["innerHTML"],pW={__name:"ToolbarButtonIcon",props:{name:{type:String,required:!0},color:{type:String,default:null},icon:{type:String,default:null}},setup(e){const t=e,n=Ce(()=>{if(t.name==="color")return{backgroundColor:t.color||"#111111"};if(t.name==="highlight")return{backgroundColor:t.color||"#D6D6D6"}}),r=Ce(()=>["color","highlight"].includes(t.name));return(o,i)=>(fe(),we("div",fW,[ae("div",{class:cn(["sd-toolbar-icon__icon",[`sd-toolbar-icon__icon--${t.name}`]]),innerHTML:e.icon},null,10,hW),r.value?(fe(),we("div",{key:0,class:"color-bar",style:xn(n.value)},null,4)):mt("",!0)]))}},PT=kn(pW,[["__scopeId","data-v-65ecd5b1"]]);Ut(),En();var mW=["role","aria-label","aria-disabled"],gW=["data-item"],vW=["data-item"],yW={key:1,class:"sd-button-label"},bW=["data-item","aria-label"],wW=["innerHTML"],CW={key:2},kW=["onKeydown","id"],SW=["placeholder","onKeydown","id","data-item"],_W=["data-item","innerHTML"],AW={"aria-live":"polite",class:"sd-visually-hidden"},IW={__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}=Fr(),o=e,{name:i,active:s,icon:a,label:l,hideLabel:u,iconColor:d,hasCaret:h,splitButton:p,disabled:v,expand:g,inlineTextInputVisible:y,hasInlineTextInput:_,minWidth:w,style:I,attributes:k}=o.toolbarItem,C=Ce(()=>!!p?.value&&!!h?.value),R=Ce(()=>i?.value??""),P=ne(""),M=ne(null),{isHighContrastMode:$}=gs();$t(()=>l?.value,Ee=>{document.activeElement!==M.value&&(P.value=Ee==null?"":String(Ee))},{immediate:!0});const F=()=>{_&&It(()=>{M.value?.focus(),M.value?.select()}),n("buttonClick")},D=Ee=>{v?.value||(Ee?.stopPropagation(),n("mainClick"))},V=()=>{C.value||F()},x=Ee=>{if(C.value){D(Ee);return}F()},B=Ee=>{Ee.preventDefault(),o.allowEnterPropagation||Ee.stopPropagation(),x(Ee)},T=Ee=>{const Ve=o.toolbarItem?.nestedOptions?.value??[],rt=Ee.trim();if(!rt)return"";const ut=Ve.find(ht=>typeof ht?.label=="string"&&ht.label.toLowerCase()===rt.toLowerCase());return ut?.label?ut.label:Ve.find(ht=>typeof ht?.label=="string"&&ht.label.toLowerCase().startsWith(rt.toLowerCase()))?.label??rt},te=()=>{const Ee=String(P.value??"").trim();let Ve=Ee;if(R.value==="fontSize"){const rt=Number.parseFloat(Ee);Ve=Ee.match(/^\d+(\.5)?$/)?Ee:Number.isFinite(rt)?Math.floor(rt).toString():""}else R.value==="fontFamily"&&(Ve=T(Ee));return Ve?(n("textSubmit",Ve),P.value=Ve,!0):!1},U=Ee=>{const Ve=Ee?.currentTarget;Ve instanceof HTMLInputElement&&(Ve.focus({preventScroll:!0}),Ve.select())},W=Ee=>{requestAnimationFrame(()=>{const Ve=document.getElementById(`inlineTextInput-${Ee}`);Ve instanceof HTMLInputElement&&(Ve.focus({preventScroll:!0}),Ve.select())})},Y=()=>{const Ee=document.querySelector('[role="textbox"][aria-label*="SuperDoc body"], .ProseMirror');return Ee instanceof HTMLElement?(Ee.focus({preventScroll:!0}),!0):!1},J=()=>{const Ee=r?.$toolbar?.pendingSelectionCapture,Ve=()=>{Ee&&typeof r?.$toolbar?.ui?.selection?.restore=="function"&&r.$toolbar.ui.selection.restore(Ee)};if(Y()){Ve();return}typeof r?.$toolbar?.superdoc?.focus=="function"&&(r.$toolbar.superdoc.focus(),Ve())},Oe=()=>{te()&&J()},de=Ee=>{if(te(),Ee.shiftKey){R.value==="fontSize"&&(Ee.preventDefault(),It(()=>W("fontFamily")));return}if(Ee.preventDefault(),R.value==="fontFamily"){It(()=>W("fontSize"));return}R.value==="fontSize"&&It(J)},oe=Ce(()=>I.value?I.value:{minWidth:o.minWidth}),pe=Ce(()=>g?.value?Cr.dropdownCaretUp:Cr.dropdownCaretDown);return(Ee,Ve)=>(fe(),we("div",{class:cn(["sd-toolbar-item",nt(k).className]),style:xn(oe.value),role:e.isOverflowItem?"menuitem":"button","aria-label":nt(k).ariaLabel,"aria-disabled":nt(v)?"true":void 0,"data-sd-part":"toolbar-item",onClick:V,onKeydown:Ve[9]||(Ve[9]=Ci(rt=>B(rt),["enter"])),tabindex:"0"},[ae("div",{class:cn(["sd-toolbar-button",{"sd-active":nt(s),"sd-disabled":nt(v),narrow:e.isNarrow,wide:e.isWide,split:C.value,"has-inline-text-input":nt(_),"high-contrast":nt($)}]),"data-item":`btn-${nt(i)||""}`},[C.value?(fe(),we("div",{key:0,class:"sd-toolbar-button__main","data-item":`btn-${nt(i)||""}-main`,onClick:Ve[0]||(Ve[0]=rt=>D(rt))},[nt(a)?(fe(),wn(PT,{key:0,color:nt(d),class:"sd-toolbar-icon",icon:nt(a),name:nt(i)},null,8,["color","icon","name"])):mt("",!0),nt(l)&&!nt(u)&&!nt(y)?(fe(),we("div",yW,Et(nt(l)),1)):mt("",!0)],8,vW)):mt("",!0),C.value?(fe(),we("div",{key:1,class:"sd-toolbar-button__caret","data-item":`btn-${nt(i)||""}-caret`,"aria-label":`${nt(k).ariaLabel} options`,role:"button"},[ae("div",{class:"sd-dropdown-caret",innerHTML:pe.value,style:xn({opacity:nt(v)?.6:1})},null,12,wW)],8,bW)):(fe(),we(Ht,{key:2},[nt(a)?(fe(),wn(PT,{key:0,color:nt(d),class:"sd-toolbar-icon",icon:nt(a),name:nt(i)},null,8,["color","icon","name"])):mt("",!0),nt(l)&&!nt(u)&&(!nt(y)||R.value==="fontFamily")?(fe(),we("div",{key:1,class:cn(["sd-button-label",{"sd-visually-hidden":nt(y)&&R.value==="fontFamily"}])},Et(nt(l)),3)):mt("",!0),nt(y)?(fe(),we("span",CW,[nt(i)==="fontSize"?Hi((fe(),we("input",{key:0,"onUpdate:modelValue":Ve[1]||(Ve[1]=rt=>P.value=rt),onKeydown:[Ci(an(Oe,["stop","prevent"]),["enter"]),Ve[2]||(Ve[2]=Ci(rt=>de(rt),["tab"]))],onClick:Ve[3]||(Ve[3]=an(rt=>U(rt),["stop"])),onFocus:Ve[4]||(Ve[4]=rt=>U(rt)),type:"text",class:cn(["button-text-input button-text-input--font-size",{"high-contrast":nt($)}]),id:"inlineTextInput-"+nt(i),autocomplete:"off",ref_key:"inlineInput",ref:M},null,42,kW)),[[Ki,P.value]]):Hi((fe(),we("input",{key:1,"onUpdate:modelValue":Ve[5]||(Ve[5]=rt=>P.value=rt),placeholder:nt(l),onKeydown:[Ci(an(Oe,["stop","prevent"]),["enter"]),Ve[6]||(Ve[6]=Ci(rt=>de(rt),["tab"]))],onClick:Ve[7]||(Ve[7]=an(rt=>U(rt),["stop"])),onFocus:Ve[8]||(Ve[8]=rt=>U(rt)),type:"text",class:cn(["button-text-input",{"button-text-input--font-family":R.value==="fontFamily","high-contrast":nt($)}]),id:"inlineTextInput-"+nt(i),"data-item":R.value==="fontFamily"?`btn-${nt(i)}-input`:void 0,autocomplete:"off",ref_key:"inlineInput",ref:M},null,42,SW)),[[Ki,P.value]])])):mt("",!0),nt(h)?(fe(),we("div",{key:3,class:"sd-dropdown-caret","data-item":`btn-${nt(i)||""}-toggle`,innerHTML:pe.value,style:xn({opacity:nt(v)?.6:1})},null,12,_W)):mt("",!0)],64)),ae("div",AW,Et(`${nt(k).ariaLabel} ${nt(s)?"selected":"unset"}`),1)],10,gW)],46,mW))}},p2=kn(IW,[["__scopeId","data-v-96796456"]]);Ut(),En();var EW={class:"toolbar-separator",role:"separator","aria-label":"Toolbar separator"},TW={__name:"ToolbarSeparator",props:{active:{type:Boolean,default:!1}},emits:["command"],setup(e,{emit:t}){const{isHighContrastMode:n}=gs(),r=()=>n.value?"#000":"var(--sd-ui-border, #dbdbdb)";return(o,i)=>(fe(),we("div",EW,[ae("div",{class:"separator-inner",style:xn({backgroundColor:r()})},null,4)]))}},xW=kn(TW,[["__scopeId","data-v-cb82253a"]]);Ut(),En();var RW={class:"toolbar-dropdown"},LW=["data-superdoc-ui-owner"],MW=["onClick"],OW={key:0,class:"toolbar-dropdown-option__icon"},PW={class:"toolbar-dropdown-option__label"},Pg='button, [href], input, select, textarea, [role="button"], [tabindex]:not([tabindex="-1"])',DW={__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=TC(),s=na("sdToolbarOwnerId",null),a=ne(null),l=ne(null),u=ne({top:"0px",left:"0px",maxHeight:"none"}),d=ne([]),h=ne(-1),p=Ce(()=>!!r.show),v=ne(document.fullscreenElement),g=Ce(()=>p.value&&v.value?v.value:document.body),y=Ce(()=>r.options.some(le=>le?.type==="render")),_=Ce(()=>!!i.menu),w=Ce(()=>typeof r.menuProps!="function"?{}:r.menuProps()||{}),I=Ce(()=>{const{class:le,style:L,...A}=w.value;return A}),k=Ce(()=>["toolbar-dropdown-menu",w.value.class,{"toolbar-dropdown-menu--render-only":_.value||r.options.length>0&&r.options.every(le=>le&&le.type==="render")}]),C=Ce(()=>{const le=w.value.style||{};return{...r.contentStyle,...le}}),R=Ce(()=>({...C.value,position:"fixed",top:u.value.top,left:u.value.left,maxHeight:u.value.maxHeight,zIndex:2e3})),P=le=>{o("update:show",le)},M=()=>{p.value&&P(!1)},$=()=>{if(!a.value)return;const le=a.value.getBoundingClientRect(),L=l.value,A=L?.offsetWidth??0,ee=L?.scrollHeight??L?.offsetHeight??0,ue=window.innerWidth||document.documentElement.clientWidth||0,Z=window.innerHeight||document.documentElement.clientHeight||0,G=8,K=4,re=le.bottom+K,ge=le.top-K,X=Math.max(0,Z-re-G),ce=Math.max(0,ge-G),Ae=X<ee&&ce>X,ke=Ae?ce:X,De=Ae?Math.max(G,ge-(ee?Math.min(ee,ke):ke)):re;let ft=le.left;r.placement==="bottom-end"&&(ft=le.right-A);const xe=Math.max(G,ue-A-G);ft=Math.min(Math.max(G,ft),xe),u.value={top:`${De}px`,left:`${ft}px`,maxHeight:`${ke}px`}},F=async()=>{v.value=document.fullscreenElement,p.value&&(await It(),$())},D=()=>{r.disabled||P(!p.value)},V=le=>typeof r.nodeProps!="function"?{}:r.nodeProps(le)||{},x=le=>{le?.disabled||le?.type!=="render"&&(o("select",le?.key,le),M())},B=le=>le?.type==="render",T=le=>!le?.disabled&&le?.type!=="render",te=le=>typeof le?.icon=="function"||!!le?.icon,U=le=>typeof le?.icon=="function"?le.icon(le):le?.icon||null,W=le=>le?typeof le=="string"?le.split(/\s+/).includes("sd-selected"):Array.isArray(le)?le.some(W):typeof le=="object"?!!le["sd-selected"]:!1:!1,Y=le=>W(le?.props?.class)||W(le?.class),J=()=>r.options.map((le,L)=>T(le)?L:-1).filter(le=>le>=0),Oe=()=>{const le=r.options.findIndex(L=>T(L)&&Y(L));return le>=0?le:J()[0]??-1},de=(le,L)=>{if(!le){delete d.value[L];return}d.value[L]=le},oe=()=>{d.value.forEach((L,A)=>{L&&L.setAttribute("tabindex",A===h.value?"0":"-1")});const le=d.value[h.value];le&&typeof le.focus=="function"&&(le.focus(),le.scrollIntoView?.({block:"nearest",inline:"nearest"}))},pe=le=>{const L=J();if(!L.length){h.value=-1;return}const A=L.indexOf(h.value);if(A<0){h.value=le>0?L[0]:L[L.length-1];return}const ee=(A+le+L.length)%L.length;h.value=L[ee]},Ee=()=>{let le=r.options[h.value];if(!T(le)){const L=J()[0];le=L===void 0?null:r.options[L]}le&&x(le)},Ve=$l({name:"ToolbarDropdownRenderOption",props:{option:{type:Object,required:!0}},setup(le){return()=>typeof le.option.render!="function"?null:le.option.render()}}),rt=$l({name:"ToolbarDropdownOptionIcon",props:{option:{type:Object,required:!0}},setup(le){return()=>{const L=U(le.option);return typeof L=="string"?to("span",{innerHTML:L}):L}}}),ut=le=>{if(!p.value)return;const L=le.target;if(!(L instanceof Element))return;const A=a.value?.contains(L),ee=l.value?.contains(L);A||ee||r.hasOpenChild&&L.closest('[data-sd-part="dropdown-menu"]')||M()},ht=ne(null),Rt=()=>{const le=a.value,L=document.activeElement;if(le&&L instanceof HTMLElement&&le.contains(L)){ht.value=L;return}ht.value=le?.matches?.(Pg)?le:le?.querySelector(Pg)},Pe=()=>{const le=ht.value;if(le instanceof HTMLElement&&document.contains(le)){le.focus();return}const L=a.value;if(!L)return;const A=L.matches?.(Pg)?L:L.querySelector(Pg);if(A instanceof HTMLElement){A.focus();return}L.setAttribute("tabindex","-1"),L.focus()};t({focusTrigger:Pe});const Re=le=>{if(!p.value)return;const{key:L}=le;if(["Escape","ArrowDown","ArrowUp","Enter"].includes(L)){if(L==="Escape"){if(!r.closeOnEscape)return;le.preventDefault(),M(),It(()=>{requestAnimationFrame(Pe)});return}if(!(y.value||_.value)){if(le.preventDefault(),L==="ArrowDown"){pe(1),oe();return}if(L==="ArrowUp"){pe(-1),oe();return}L==="Enter"&&Ee()}}};return $t(p,async le=>{if(!le){h.value=-1,d.value=[];return}Rt(),await It(),$(),!(y.value||_.value)&&(h.value=Oe(),await It(),oe())},{immediate:!0}),$t(p,le=>{le?(document.addEventListener("pointerdown",ut,!0),document.addEventListener("keydown",Re,!0),window.addEventListener("resize",$),window.addEventListener("scroll",$,!0)):(document.removeEventListener("pointerdown",ut,!0),document.removeEventListener("keydown",Re,!0),window.removeEventListener("resize",$),window.removeEventListener("scroll",$,!0))},{immediate:!0}),Xn(()=>{document.addEventListener("fullscreenchange",F)}),br(()=>{document.removeEventListener("fullscreenchange",F),document.removeEventListener("pointerdown",ut,!0),document.removeEventListener("keydown",Re,!0),window.removeEventListener("resize",$),window.removeEventListener("scroll",$,!0)}),(le,L)=>(fe(),we("div",RW,[ae("div",{ref_key:"triggerRef",ref:a,class:"toolbar-dropdown-trigger","data-sd-part":"dropdown-trigger",onClick:D},[ju(le.$slots,"trigger",{},void 0,!0)],512),(fe(),wn(Wl,{to:g.value},[un(rm,{name:"fade-in-scale-up-transition"},{default:Do(()=>[p.value?(fe(),we("div",oa({key:0,ref_key:"menuRef",ref:l,"data-sd-part":"dropdown-menu",class:k.value,style:R.value},I.value,{"data-superdoc-ui-owner":nt(s)}),[_.value?ju(le.$slots,"menu",{key:0},void 0,!0):mt("",!0),(fe(!0),we(Ht,null,Bn(_.value?[]:e.options,(A,ee)=>(fe(),we("div",oa({key:A.key,ref_for:!0,ref:ue=>de(ue,ee),class:["toolbar-dropdown-option",[A.class,A.props?.class,{"sd-disabled":A.disabled,"sd-render":B(A)}]],tabindex:"-1",onClick:ue=>x(A)},{ref_for:!0},{...A.props,...V(A)}),[B(A)?(fe(),wn(nt(Ve),{key:0,option:A},null,8,["option"])):(fe(),we(Ht,{key:1},[te(A)?(fe(),we("span",OW,[un(nt(rt),{option:A},null,8,["option"])])):mt("",!0),ae("span",PW,Et(A.label),1)],64))],16,MW))),128))],16,LW)):mt("",!0)]),_:3})],8,["to"]))]))}},DT=kn(DW,[["__scopeId","data-v-e6f71d76"]]),FT=e=>{const t=e?.target;t instanceof Element&&(t.closest('input, textarea, [contenteditable="true"]')||e.preventDefault())},wc=(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})};Ut(),En();var FW={__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=Ce(()=>r.toolbarItem.expand.value),s=Ce(()=>r.overflowItems.some(d=>d.type==="dropdown"&&nt(d.expand))),a=Ce(()=>({...r.toolbarItem,active:i.value})),l=d=>{if(d!==i.value){if(d){n("buttonClick",r.toolbarItem);return}n("close")}},u=({item:d,argument:h,option:p})=>{d.name.value==="watermark"&&(n("close"),o.value?.focusTrigger()),n("command",{item:d,argument:h,option:p})};return(d,h)=>(fe(),wn(DT,{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:Do(()=>[un(p2,{"toolbar-item":a.value,"allow-enter-propagation":!0},null,8,["toolbar-item"])]),menu:Do(()=>[un(Ng,{class:"superdoc-toolbar-overflow","toolbar-items":e.overflowItems,"ui-font-family":r.uiFontFamily,"from-overflow":"",onMousedown:nt(FT),onCommand:u},null,8,["toolbar-items","ui-font-family","onMousedown"])]),_:1},8,["close-on-escape","has-open-child","content-style","show"]))}},NW=kn(FW,[["__scopeId","data-v-1227fcf9"]]),NT=e=>String(e??"").trim().toLowerCase(),Dg=(e,t)=>{const n=NT(e);if(!n)return-1;for(let r=0;r<t.length;r+=1)if(NT(t[r]).startsWith(n))return r;return-1},BW=(e,t,{autocomplete:n=!0}={})=>{const r=String(e??""),o=Dg(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}},zW=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},VW=e=>e<=31||e===127,UW=e=>e===32||e===160||e===65279,jW=e=>Array.from(String(e)).filter(t=>!VW(t.charCodeAt(0))).join(""),$W=e=>{let t="",n=!1;for(const r of String(e)){if(UW(r.charCodeAt(0))){n=t.length>0;continue}n&&(t+=" "),n=!1,t+=r}return t},HW=e=>{const t=String(e??"").split(",")[0]??"",n=jW(t);return $W(zW(n)).trim()},GW=1,WW=1638,qW=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<GW?"":String(Math.min(r,WW))};Ut(),En();var KW=["data-item"],YW=["id","value","disabled","aria-label","aria-expanded","aria-controls","aria-activedescendant","data-item"],XW=["data-item","aria-label","disabled"],ZW=["innerHTML"],QW=["data-superdoc-ui-owner","id","aria-label"],JW=["id","aria-selected","aria-label","onMousedown","onMouseenter"],eq={class:"toolbar-dropdown-option__label"},tq={class:"sd-button-label sd-font-combobox__legacy-label","aria-hidden":"true"},nq={__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}=gs(),i=na("sdToolbarOwnerId",null),s=ne(null),a=ne(null),l=ne(null),u=ne([]),d=ne(!1),h=ne(!1),p=ne(-1),v=ne(""),g=ne(""),y=ne(!1),_=ne({top:"0px",left:"0px",minWidth:"0px",maxHeight:"none"}),w=Ce(()=>n.item.nestedOptions?.value??[]),I=Ce(()=>w.value.map(X=>String(X?.label??""))),k=Ce(()=>String(n.item.label?.value??"")),C=Ce(()=>!!n.item.disabled?.value),R=Ce(()=>String(n.item.name?.value??"")),P=Ce(()=>n.item.attributes?.value?.ariaLabel??"Font family"),M=Ce(()=>d.value?g.value:k.value),$=Ce(()=>`sd-${R.value||"combobox"}-listbox-${n.item.id?.value??"default"}`),F=X=>`${$.value}-option-${X}`,D=Ce(()=>h.value&&p.value>=0?F(p.value):void 0),V=Ce(()=>h.value?Cr.dropdownCaretUp:Cr.dropdownCaretDown),x=X=>{const ce=String(X??"").trim().toLowerCase();return w.value.find(Ae=>String(Ae?.label??"").trim().toLowerCase()===ce)?.props?.style?.fontFamily||X||n.uiFontFamily},B=Ce(()=>n.showPreview?{fontFamily:x(d.value?g.value:k.value)}:{fontFamily:n.uiFontFamily}),T=()=>{const X=n.item.selectedValue?.value;if(X){const ce=w.value.findIndex(Ae=>Ae?.key===X);if(ce>=0)return ce}return I.value.findIndex(ce=>ce.toLowerCase()===k.value.toLowerCase())},te=(X,ce)=>{const Ae=s.value;if(!(!Ae||typeof Ae.setSelectionRange!="function"))try{Ae.setSelectionRange(X,ce)}catch{}},U=()=>{u.value[p.value]?.scrollIntoView?.({block:"nearest",inline:"nearest"})},W=()=>{u.value[p.value]?.focus?.()},Y=()=>{const X=a.value;if(!X)return;const ce=X.getBoundingClientRect(),Ae=l.value,ke=Ae?.scrollHeight??Ae?.offsetHeight??0,De=window.innerHeight||document.documentElement.clientHeight||0,ft=window.innerWidth||document.documentElement.clientWidth||0,xe=8,qe=4,Bt=ce.bottom+qe,bt=ce.top-qe,tt=Math.max(0,De-Bt-xe),Dt=Math.max(0,bt-xe),tn=tt<ke&&Dt>tt,Mn=tn?Dt:tt,ln=tn?Math.max(xe,bt-(ke?Math.min(ke,Mn):Mn)):Bt,qn=Math.min(Math.max(xe,ce.left),Math.max(xe,ft-ce.width-xe));_.value={top:`${ln}px`,left:`${qn}px`,minWidth:`${ce.width}px`,maxHeight:`${Mn}px`}},J=Ce(()=>({position:"fixed",top:_.value.top,left:_.value.left,minWidth:_.value.minWidth,maxHeight:_.value.maxHeight,fontFamily:n.uiFontFamily,zIndex:2e3})),Oe=X=>{n.item.expand&&typeof n.item.expand=="object"&&"value"in n.item.expand&&(n.item.expand.value=X)},de=(X,{focusInput:ce=!1,focusOption:Ae=!1}={})=>{if(C.value||!w.value.length){Oe(!1);return}h.value=!0,Oe(!0),p.value=X??-1,ce&&(d.value=!0,g.value=k.value,s.value?.focus()),It(()=>{Y(),U(),Ae&&W()})},oe=({syncItem:X=!0}={})=>{h.value=!1,p.value=-1,X&&Oe(!1)},pe=()=>{oe(),d.value=!1,v.value="",g.value=k.value},Ee=()=>{C.value||(h.value||r("item-clicked"),d.value=!0,v.value="",g.value=k.value,It(()=>te(0,g.value.length)))},Ve=X=>{if(C.value)return;const ce=document.activeElement===s.value;if(r("item-clicked"),d.value=!0,ce||(v.value="",g.value=k.value,X.preventDefault(),s.value?.focus({preventScroll:!0}),te(0,k.value.length)),!h.value){const Ae=T();de(Ae>=0?Ae:0)}},rt=X=>{const ce=X.relatedTarget;ce instanceof Node&&a.value?.contains(ce)||ce instanceof Node&&l.value?.contains(ce)||pe()},ut=X=>{if(y.value)return;const ce=X.target,Ae=ce.value,ke=typeof ce.selectionStart=="number"?ce.selectionStart:Ae.length,De=typeof ce.selectionEnd=="number"?ce.selectionEnd:ke,ft=typeof X.inputType=="string"&&X.inputType.startsWith("delete"),xe=ke===Ae.length&&De===Ae.length;v.value=Ae;const qe=BW(Ae,I.value,{autocomplete:!ft&&xe});g.value=qe.display,ce.value=qe.display,qe.display===Ae&&!xe?te(ke,De):te(qe.selectionStart,qe.selectionEnd),h.value&&(p.value=qe.matchIndex,It(U))},ht=X=>{y.value=!1,ut(X)},Rt=X=>{if(!w.value.length)return;const ce=w.value.length,Ae=p.value<0?X>0?-1:0:p.value;p.value=(Ae+X+ce)%ce,It(U)},Pe=(X,ce)=>{r("item-clicked"),r("command",{item:n.item,argument:X,option:ce}),ce&&(n.item.selectedValue.value=ce.key)},Re=X=>{X&&(Pe(X.value??X.label,X),d.value=!1,v.value="",g.value=X.label,oe())},le=()=>{if(h.value&&p.value>=0)return Re(w.value[p.value]),!0;const X=Dg(v.value,I.value);if(X>=0)return Re(w.value[X]),!0;const ce=n.normalizeValue(v.value);return ce?(Pe(ce,null),d.value=!1,v.value="",g.value=ce,oe(),!0):!1},L=X=>{if(!(X.isComposing||y.value||X.keyCode===229)&&!(X.ctrlKey||X.metaKey||X.altKey))switch(X.key){case"ArrowDown":if(X.preventDefault(),h.value)W();else{const ce=Dg(v.value,I.value),Ae=ce>=0?ce:T();de(Ae>=0?Ae:0,{focusOption:!0})}break;case"ArrowUp":if(X.preventDefault(),h.value)W();else{const ce=Dg(v.value,I.value),Ae=ce>=0?ce:T();de(Ae>=0?Ae:w.value.length-1,{focusOption:!0})}break;case"Enter":X.preventDefault(),le()&&r("editor-handoff"),s.value?.blur();break;case"Tab":X.preventDefault(),le(),oe(),s.value?.blur(),r("tab-out",X);break;case"Escape":X.preventDefault(),pe(),It(()=>s.value?.focus());break;default:break}},A=X=>{if(X.preventDefault(),!C.value)if(r("item-clicked"),h.value)oe(),s.value?.focus();else{const ce=T();de(ce>=0?ce:0,{focusOption:!0})}},ee=(X,ce)=>{X.preventDefault(),Re(ce),r("editor-handoff"),s.value?.blur()},ue=X=>{p.value=X},Z=X=>{if(!(X.ctrlKey||X.metaKey||X.altKey))switch(X.key){case"ArrowDown":X.preventDefault(),Rt(1),W();break;case"ArrowUp":X.preventDefault(),Rt(-1),W();break;case"Enter":X.preventDefault(),p.value>=0&&(Re(w.value[p.value]),r("editor-handoff"));break;case"Escape":X.preventDefault(),pe(),It(()=>s.value?.focus());break;case"Tab":X.preventDefault(),p.value>=0?Re(w.value[p.value]):oe(),r("tab-out",{shiftKey:X.shiftKey,target:s.value});break;default:break}},G=X=>{if(!h.value)return;const ce=X.target;ce instanceof Element&&(a.value?.contains(ce)||l.value?.contains(ce)||pe())};$t(h,X=>{X?(document.addEventListener("pointerdown",G,!0),window.addEventListener("resize",Y),window.addEventListener("scroll",Y,!0)):(document.removeEventListener("pointerdown",G,!0),window.removeEventListener("resize",Y),window.removeEventListener("scroll",Y,!0),u.value=[])},{immediate:!0}),br(()=>{document.removeEventListener("pointerdown",G,!0),window.removeEventListener("resize",Y),window.removeEventListener("scroll",Y,!0)});const K=(X,ce)=>{if(!X){delete u.value[ce];return}u.value[ce]=X},re=X=>X===p.value,ge=X=>X?.key&&X.key===n.item.selectedValue?.value;return $t(k,X=>{d.value||(g.value=X)}),$t(()=>!!n.item.expand?.value,X=>{if(X&&!h.value){const ce=T();de(ce>=0?ce:0,{focusInput:!0});return}!X&&h.value&&oe({syncItem:!1})}),(X,ce)=>(fe(),we("div",{ref_key:"rootRef",ref:a,class:cn(["sd-font-combobox sd-toolbar-split-field",{"sd-disabled":C.value,"high-contrast":nt(o)}]),style:xn(n.item.style?.value),"data-item":`btn-${R.value}`},[ae("span",{class:"sd-font-combobox__field sd-toolbar-split-field__main",onMousedown:Ve},[ae("input",{ref_key:"inputRef",ref:s,id:`inlineTextInput-${R.value}`,class:"button-text-input sd-font-combobox__input",type:"text",role:"combobox",autocomplete:"off",spellcheck:"false",value:M.value,style:xn(B.value),disabled:C.value,"aria-label":P.value,"aria-expanded":h.value?"true":"false","aria-controls":$.value,"aria-activedescendant":D.value,"aria-haspopup":"listbox","aria-autocomplete":"both","data-item":`btn-${R.value}-input`,onFocus:Ee,onBlur:rt,onInput:ut,onKeydown:L,onCompositionstart:ce[0]||(ce[0]=Ae=>y.value=!0),onCompositionend:ht},null,44,YW)],32),ae("button",{type:"button",class:"sd-font-combobox__caret sd-toolbar-split-field__caret","data-item":`btn-${R.value}-toggle`,tabindex:"-1","aria-label":`${P.value} options`,disabled:C.value,onMousedown:A},[ae("span",{class:"sd-dropdown-caret",innerHTML:V.value},null,8,ZW)],40,XW),(fe(),wn(Wl,{to:"body"},[h.value?(fe(),we("div",{key:0,ref_key:"popupRef",ref:l,role:"listbox","data-sd-part":"dropdown-menu","data-superdoc-ui-owner":nt(i),id:$.value,"aria-label":P.value,class:cn(["sd-font-combobox__listbox",{"high-contrast":nt(o)}]),style:xn(J.value)},[(fe(!0),we(Ht,null,Bn(w.value,(Ae,ke)=>(fe(),we("div",oa({key:Ae.key,ref_for:!0,ref:De=>K(De,ke),id:F(ke),role:"option",tabindex:"-1",class:["toolbar-dropdown-option sd-font-combobox__option",{"sd-active":re(ke),"sd-selected":ge(Ae)}],"aria-selected":ge(Ae)?"true":"false","aria-label":`${P.value} - ${Ae.label}`},{ref_for:!0},Ae.props,{onMousedown:De=>ee(De,Ae),onMouseenter:De=>ue(ke),onKeydown:Z}),[ae("span",eq,Et(Ae.label),1)],16,JW))),128))],14,QW)):mt("",!0)])),ae("span",tq,Et(k.value),1)],14,KW))}},BT=kn(nq,[["__scopeId","data-v-eb442535"]]);Ut();var rq={__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)=>(fe(),wn(BT,{item:n.item,"ui-font-family":n.uiFontFamily,"show-preview":!0,"normalize-value":nt(HW),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"]))}};Ut();var oq={__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)=>(fe(),wn(BT,{item:n.item,"ui-font-family":n.uiFontFamily,"show-preview":!1,"normalize-value":nt(qW),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"]))}};Ut(),En();var iq=2500,sq=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=xC(),r=ne(!1),o=ne(null),i=ne(null),s=ne({top:"0px",left:"0px",below:!1});let a=null,l=null,u=null;const d=Ce(()=>["sd-tooltip-content",s.value.below&&"sd-tooltip-below",n.class]),h=Ce(()=>({...t.contentStyle,...n.style||{},position:"fixed",top:s.value.top,left:s.value.left,zIndex:2100,transformOrigin:s.value.below?"top center":"bottom center"})),p=()=>{a&&(window.clearTimeout(a),a=null)},v=()=>{l&&(window.clearTimeout(l),l=null)},g=()=>{u&&(window.clearTimeout(u),u=null)},y=()=>{g(),u=window.setTimeout(()=>{u=null,I()},iq)},_=()=>{if(!o.value||!i.value)return;const V=o.value.getBoundingClientRect(),x=i.value.offsetWidth,B=i.value.offsetHeight,T=window.innerWidth||document.documentElement.clientWidth||0,te=window.innerHeight||document.documentElement.clientHeight||0,U=8;let W=V.left+V.width/2-x/2;W=Math.max(U,Math.min(W,T-x-U));const Y=V.top-B-10,J=Y<U,Oe=J?V.bottom+10:Y,de=Math.max(U,Math.min(Oe,te-B-U));s.value={top:`${de}px`,left:`${W}px`,below:J}},w=async()=>{t.disabled||(p(),v(),!r.value&&(r.value=!0,y(),await It(),_()))},I=()=>{v(),p(),g(),r.value&&(r.value=!1)},k=()=>{if(p(),v(),!r.value){if(t.delay===0){w();return}l=window.setTimeout(()=>{l=null,w()},t.delay)}},C=()=>{if(v(),p(),!!r.value){if(t.duration===0){I();return}a=window.setTimeout(()=>{a=null,I()},t.duration)}},R=()=>{t.trigger==="hover"&&k()},P=()=>{t.trigger==="hover"&&C()},M=()=>{v(),p()},$=()=>{C()},F=V=>{V.key==="Escape"&&I()},D=V=>{(V.key==="Enter"||V.key===" ")&&I()};return $t(()=>t.disabled,V=>{V&&I()}),$t(r,V=>{V?(window.addEventListener("resize",_),window.addEventListener("scroll",_,!0),document.addEventListener("keydown",F,!0)):(window.removeEventListener("resize",_),window.removeEventListener("scroll",_,!0),document.removeEventListener("keydown",F,!0))}),br(()=>{v(),p(),g(),window.removeEventListener("resize",_),window.removeEventListener("scroll",_,!0),document.removeEventListener("keydown",F,!0)}),(V,x)=>(fe(),we(Ht,null,[ae("span",{ref_key:"triggerRef",ref:o,class:"sd-tooltip-trigger",onMouseenter:R,onMouseleave:P,onFocusin:R,onFocusout:P,onClickCapture:I,onKeydownCapture:D},[ju(V.$slots,"trigger",{},void 0,!0)],544),(fe(),wn(Wl,{to:"body"},[un(rm,{name:"fade-in-scale-up-transition",css:r.value},{default:Do(()=>[r.value&&!e.disabled?(fe(),we("div",{key:0,ref_key:"contentRef",ref:i,class:cn(d.value),style:xn(h.value),onMouseenter:M,onMouseleave:$},[x[0]||(x[0]=ae("span",{class:"sd-tooltip-arrow","aria-hidden":"true"},null,-1)),ju(V.$slots,"default",{},void 0,!0)],38)):mt("",!0)]),_:3},8,["css"])]))],64))}}),Fg=kn(sq,[["__scopeId","data-v-71c6de4c"]]);Ut(),En();var aq=["onKeydown","tabindex","data-item-id"],lq={key:0},cq={key:0},uq={key:0},dq={key:0},fq={key:0},hq={__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}=Fr(),o=ne([]),i=ne(null),s=e,a=ne(null),{isHighContrastMode:l}=gs(),u=window.matchMedia("(max-width: 768px)").matches,d=Ce(()=>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"}),h=Pe=>Pe.type==="button",p=Pe=>Pe.type==="dropdown",v=Pe=>Pe.type==="dropdown"&&Pe.name?.value==="fontFamily",g=Pe=>Pe.type==="dropdown"&&Pe.name?.value==="fontSize",y=Pe=>Pe.type==="separator",_=Pe=>Pe.type==="overflow",w=Pe=>!!Pe.nestedOptions?.value?.length,I=Pe=>{if(!Pe)return!1;const Re=Pe.expand;return typeof Re=="object"&&Re!==null&&"value"in Re?!!Re.value:!!Re},k=(Pe,Re)=>{Pe?.expand&&(Pe.expand.value=Re)},C=(Pe,Re=void 0)=>{if(Pe.disabled.value)return;if(_(Pe)){const L=!I(Pe);L&&M(),k(Pe,L),a.value=L?Pe:null,n("item-clicked");return}if(p(Pe))return;a.value&&p(a.value)&&I(a.value)&&M(),n("item-clicked");const le=Re!==void 0?Re:Pe.argument?.value;n("command",le===void 0?{item:Pe}:{item:Pe,argument:le})},R=(Pe,Re)=>{Pe.disabled.value||(a.value=null,n("command",{item:Pe,argument:Re}))},P=Pe=>{if(Pe.disabled.value)return;M();const Re=Pe.splitButtonCommand,le=Pe.command,L=Re||le;if(!L)return;const A={...Pe,command:L};n("item-clicked"),n("command",{item:A})},M=()=>{const Pe=r?.$toolbar?.toolbarItems||[],Re=r?.$toolbar?.overflowItems||[],le=[...Pe,...Re];(le.length?le:s.toolbarItems).forEach(L=>{const A=_(L)&&!s.fromOverflow;(p(L)||A)&&k(L,!1)}),a.value=null},$=(Pe,Re)=>{M();const le=Pe.dropdownValueKey.value?Re[Pe.dropdownValueKey.value]:Re.label;n("command",{item:Pe,argument:le,option:Re}),Pe.selectedValue.value=Re.key,Pe.restoreEditorFocus&&wc(r?.$toolbar)},F=Pe=>{n("command",Pe)},D=()=>{M(),n("item-clicked")},V=()=>{const Pe=document.querySelector('[role="textbox"][aria-label*="SuperDoc body"], .ProseMirror');return Pe instanceof HTMLElement?(Pe.focus({preventScroll:!0}),!0):!1},x=()=>{const Pe=r?.$toolbar?.pendingSelectionCapture,Re=()=>{Pe&&typeof r?.$toolbar?.ui?.selection?.restore=="function"&&r.$toolbar.ui.selection.restore(Pe)};if(V()){Re();return}typeof r?.$toolbar?.superdoc?.focus=="function"&&(r.$toolbar.superdoc.focus(),Re())},B=Pe=>!(Pe instanceof HTMLElement)||Pe.classList.contains("sd-disabled")?null:Pe.querySelector("input:not([disabled]), textarea:not([disabled]), select:not([disabled])")||Pe.querySelector('button:not([disabled]), [role="button"]:not(.sd-disabled), [tabindex]:not([tabindex="-1"])'),T=(Pe,Re)=>{const le=Pe?.target?.closest?.(".sd-toolbar-item-ctn");if(!(le instanceof HTMLElement))return!1;let L=Re>0?le.nextElementSibling:le.previousElementSibling;for(;L;){const A=B(L);if(A instanceof HTMLElement)return le.setAttribute("tabindex","-1"),L.setAttribute("tabindex","0"),A.focus(),!0;L=Re>0?L.nextElementSibling:L.previousElementSibling}return!1},te=Pe=>{M();const Re=Pe?.shiftKey?-1:1;T(Pe,Re)||x()},U=Pe=>{if(M(),Pe?.shiftKey){T(Pe,-1)||x();return}x()},W=()=>{x()},Y=Pe=>Pe.nestedOptions?.value?.length?Pe.nestedOptions.value.map(Re=>{const le=Re?.type!=="render"&&Pe.selectedValue.value===Re.key;return{...Re,props:{...Re.props,class:le?"sd-selected":""}}}):[],J=(Pe,Re)=>({role:"menuitem","aria-label":`${Re.attributes.value.ariaLabel} - ${Pe.label}`}),Oe=Pe=>{const Re=Pe.target,le=Pe.target.closest(".sd-toolbar-item-ctn").nextElementSibling;le&&(Re.setAttribute("tabindex","-1"),le.setAttribute("tabindex","0"),le.focus())},de=Pe=>{const Re=Pe.target,le=Pe.target.closest(".sd-toolbar-item-ctn").previousElementSibling;le&&(Re.setAttribute("tabindex","-1"),le.setAttribute("tabindex","0"),le.focus())},oe=Pe=>{const Re=Pe.target.closest(".button-group").nextElementSibling;if(Re)Re.setAttribute("tabindex","0"),Re.focus();else{const le=document.querySelector(".ProseMirror");le&&le.focus()}},pe=Pe=>{const Re=Pe.target.closest(".button-group").previousElementSibling;Re&&(Re.setAttribute("tabindex","0"),Re.focus())},Ee=Pe=>{if(!Pe.disabled.value){if(p(Pe)){ut(!I(Pe),Pe);return}C(Pe)}},Ve=(Pe,Re)=>{const le=Pe.target.nodeName==="INPUT"||Pe.target.nodeName==="TEXTAREA",L=Re.name.value==="fontSize"||Re.name.value==="fontFamily";if(!(le&&L)&&["Enter"," ","Spacebar","Escape","ArrowRight","ArrowLeft","Tab"].includes(Pe.key))switch(Pe.preventDefault(),Pe.key){case"Enter":case" ":case"Spacebar":Ee(Re);break;case"Escape":M();break;case"ArrowRight":M(),Oe(Pe);break;case"ArrowLeft":M(),de(Pe);break;case"Tab":Pe.shiftKey?pe(Pe):oe(Pe);break;default:break}},rt=Pe=>{const Re=o.value.find(le=>!le.classList.contains("sd-disabled"));Re&&(Re.setAttribute("tabindex","0"),Re.focus())},ut=(Pe,Re)=>{if(n("item-clicked"),!Pe){M(),n("dropdown-update-show",!1);return}M(),a.value=Re,k(Re,!0),n("dropdown-update-show",!0)},ht=Pe=>{if(!a.value)return;const Re=Pe.target;Re instanceof Element&&(Re.closest('[data-sd-part="dropdown-menu"]')||i.value?.contains(Re)||M())};return $t(()=>I(a.value),Pe=>{Pe?document.addEventListener("pointerdown",ht,!0):document.removeEventListener("pointerdown",ht,!0)},{immediate:!0}),br(()=>{document.removeEventListener("pointerdown",ht,!0)}),(Pe,Re)=>(fe(),we("div",{style:xn(d.value),class:"button-group",role:"group",onFocus:rt,ref_key:"buttonGroupRef",ref:i},[(fe(!0),we(Ht,null,Bn(e.toolbarItems,(le,L)=>(fe(),we("div",{key:le.id.value,class:cn([{narrow:le.isNarrow.value,wide:le.isWide.value,"sd-disabled":le.disabled.value},"sd-toolbar-item-ctn"]),onKeydown:A=>Ve(A,le),ref_for:!0,ref_key:"toolbarItemRefs",ref:o,tabindex:L===0?0:-1,"data-item-id":le.id.value},[y(le)?(fe(),wn(xW,{key:0,style:{width:"20px"}})):mt("",!0),v(le)&&w(le)?(fe(),wn(Fg,{key:1,trigger:"hover",disabled:!le.tooltip?.value,"content-style":{fontFamily:s.uiFontFamily}},{trigger:Do(()=>[un(rq,{item:le,"ui-font-family":s.uiFontFamily,class:"sd-toolbar-button sd-editor-toolbar-dropdown",onCommand:F,onItemClicked:D,onTabOut:Re[0]||(Re[0]=A=>te(A)),onEditorHandoff:W},null,8,["item","ui-font-family"])]),default:Do(()=>[ae("div",null,[Gi(Et(le.tooltip)+" ",1),le.disabled.value?(fe(),we("span",lq,"(disabled)")):mt("",!0)])]),_:2},1032,["disabled","content-style"])):g(le)&&w(le)?(fe(),wn(Fg,{key:2,trigger:"hover",disabled:!le.tooltip?.value,"content-style":{fontFamily:s.uiFontFamily}},{trigger:Do(()=>[un(oq,{item:le,"ui-font-family":s.uiFontFamily,class:"sd-toolbar-button sd-editor-toolbar-dropdown",onCommand:F,onItemClicked:D,onTabOut:Re[1]||(Re[1]=A=>U(A)),onEditorHandoff:W},null,8,["item","ui-font-family"])]),default:Do(()=>[ae("div",null,[Gi(Et(le.tooltip)+" ",1),le.disabled.value?(fe(),we("span",cq,"(disabled)")):mt("",!0)])]),_:2},1032,["disabled","content-style"])):p(le)&&le.nestedOptions?.value?.length?(fe(),wn(DT,{key:3,options:Y(le),disabled:le.disabled.value,show:I(le),"content-style":{fontFamily:s.uiFontFamily},placement:"bottom-start",class:"sd-toolbar-button sd-editor-toolbar-dropdown",onSelect:(A,ee)=>$(le,ee),"onUpdate:show":A=>ut(A,le),style:xn(le.dropdownStyles.value),"menu-props":()=>({role:"menu",style:{fontFamily:s.uiFontFamily},class:["sd-toolbar-dropdown-menu",{"high-contrast":nt(l)}]}),"node-props":A=>J(A,le)},{trigger:Do(()=>[un(Fg,{trigger:"hover",disabled:!le.tooltip?.value,"content-style":{fontFamily:s.uiFontFamily}},{trigger:Do(()=>[un(p2,{"toolbar-item":le,disabled:le.disabled.value,"allow-enter-propagation":!0,onTextSubmit:A=>R(le,A),onMainClick:A=>P(le)},null,8,["toolbar-item","disabled","onTextSubmit","onMainClick"])]),default:Do(()=>[ae("div",null,[Gi(Et(le.tooltip)+" ",1),le.disabled.value?(fe(),we("span",uq,"(disabled)")):mt("",!0)])]),_:2},1032,["disabled","content-style"])]),_:2},1032,["options","disabled","show","content-style","onSelect","onUpdate:show","style","menu-props","node-props"])):h(le)?(fe(),wn(Fg,{key:4,trigger:"hover",class:"sd-editor-toolbar-tooltip","content-style":{fontFamily:s.uiFontFamily}},{trigger:Do(()=>[un(p2,{"toolbar-item":le,"is-overflow-item":e.fromOverflow,onTextSubmit:A=>R(le,A),onButtonClick:A=>C(le)},null,8,["toolbar-item","is-overflow-item","onTextSubmit","onButtonClick"])]),default:Do(()=>[le.tooltip?(fe(),we("div",dq,[Gi(Et(le.tooltip)+" ",1),le.disabled.value?(fe(),we("span",fq,"(disabled)")):mt("",!0)])):mt("",!0)]),_:2},1032,["content-style"])):mt("",!0),_(le)&&e.overflowItems.length?(fe(),wn(NW,{key:5,"toolbar-item":le,"ui-font-family":s.uiFontFamily,onButtonClick:A=>C(le),"overflow-items":e.overflowItems,onClose:M,onCommand:Re[2]||(Re[2]=A=>n("command",A))},null,8,["toolbar-item","ui-font-family","onButtonClick","overflow-items"])):mt("",!0)],42,aq))),128))],36))}},Ng=kn(hq,[["__scopeId","data-v-fb216897"]]),pq=[["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"]],mq=pq.map(([e,t])=>({label:e,key:e,props:{style:{fontFamily:`${e}, ${t}`},"data-item":"btn-fontFamily-option"}}));function gq(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 vq=[{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"}}],Wh={sm:768,md:1024,lg:1280,xl:1410},yq={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"},zT={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"},bq=Object.values(zT);Ut(),En();var wq=["data-superdoc-ui-owner"],Cq="Arial, Helvetica, sans-serif",kq={__name:"Toolbar",emits:["command","toggle","select"],setup(e,{emit:t}){const{proxy:n}=Fr();cy("sdToolbarOwnerId",S1(n.$toolbar.superdoc));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=Ce(()=>{const V=n?.$toolbar?.config?.uiDisplayFallbackFont;return typeof V=="string"&&V.trim()?V.trim():Cq}),h=n.$toolbar.config?.toolbarGroups?.includes("left"),p=n.$toolbar.config?.toolbarGroups?.includes("right"),v=V=>(i.value,n.$toolbar.getToolbarItemByGroup(V)),g=()=>{s.value=n.$toolbar.getAvailableWidth()<=Wh.lg},y=()=>{const V=o.value,x=V?.ownerDocument,B=x?.activeElement;if(!V?.contains(B))return null;const T=B.closest('[data-sd-part="toolbar-item"]')??B.querySelector('[data-sd-part="toolbar-item"]');if(!T||B!==T&&!B.contains(T))return null;const te=T.querySelector("[data-item]")?.getAttribute("data-item");return te?()=>{const U=o.value;if(!U?.isConnected||B.isConnected||x.activeElement!==x.body)return;const W=[...U.querySelectorAll("[data-item]")];for(const Y of[te,"btn-overflow"]){const J=W.find(Oe=>Oe.getAttribute("data-item")===Y)?.closest('[data-sd-part="toolbar-item"]');if(J&&J.getAttribute("aria-disabled")!=="true"){J.focus({preventScroll:!0});return}}}:null},_=async V=>{r.value+=1,await It(),V?.()},I=dW(async()=>{const V=n.$toolbar.getAvailableWidth();if(V===u)return;u=V;const x=y();await n.$toolbar.onToolbarResize(),g(),await _(x)},300),k=()=>{const V=y();u=n.$toolbar.getAvailableWidth(),g(),_(V)},C=()=>{i.value+=1};function R(){I.cancel(),window.removeEventListener("resize",I),n.$toolbar.off?.("toolbar-items-changed",k),n.$toolbar.off?.("toolbar-state-change",C),a?.disconnect(),a=null}function P(){R(),window.addEventListener("resize",I),n.$toolbar.on?.("toolbar-items-changed",k),n.$toolbar.on?.("toolbar-state-change",C),typeof ResizeObserver<"u"&&n.$toolbar.config?.responsiveToContainer&&n.$toolbar.toolbarContainer&&(a=new ResizeObserver(()=>{I()}),a.observe(n.$toolbar.toolbarContainer)),g()}Xn(P),py(P),my(R),br(R);const M=()=>{if(!n.$toolbar.activeEditor){l=null,n.$toolbar.pendingSelectionCapture=null;return}l=n.$toolbar.ui?.selection?.capture?.()??null,n.$toolbar.pendingSelectionCapture=l},$=({item:V,argument:x,option:B})=>{const T=OT(V?.name?.value);V?.type==="button"&&!V.isCustomToolbarItem&&["bold","italic","underline","strikethrough"].includes(T)&&n.$toolbar.snapshot?.commands?.[T]?.source==="builtin"||F(),n.$toolbar.emitCommand({item:V,argument:x,option:B})},F=()=>{if(!n.$toolbar.activeEditor)return;const V=n.$toolbar.pendingSelectionCapture??l;V&&typeof n.$toolbar.ui?.selection?.restore=="function"&&n.$toolbar.ui.selection.restore(V)},D=V=>{M(),FT(V)};return(V,x)=>(fe(),we("div",{class:"superdoc-toolbar",ref_key:"toolbarRoot",ref:o,key:nt(r),role:"toolbar","aria-label":"Toolbar","data-sd-part":"toolbar","data-editor-ui-surface":"","data-superdoc-ui-owner":nt(S1)(nt(n).$toolbar.superdoc),onMousedown:D},[nt(h)?(fe(),wn(Ng,{key:0,tabindex:"0","toolbar-items":v("left"),"overflow-items":nt(n).$toolbar.overflowItems,"compact-side-groups":s.value,"ui-font-family":d.value,position:"left",onCommand:$,class:"superdoc-toolbar-group-side"},null,8,["toolbar-items","overflow-items","compact-side-groups","ui-font-family"])):mt("",!0),un(Ng,{tabindex:"0","toolbar-items":v("center"),"overflow-items":nt(n).$toolbar.overflowItems,"compact-side-groups":s.value,"ui-font-family":d.value,position:"center",onCommand:$},null,8,["toolbar-items","overflow-items","compact-side-groups","ui-font-family"]),nt(p)?(fe(),wn(Ng,{key:1,tabindex:"0","toolbar-items":v("right"),"overflow-items":nt(n).$toolbar.overflowItems,"compact-side-groups":s.value,"ui-font-family":d.value,position:"right",onCommand:$,class:"superdoc-toolbar-group-side"},null,8,["toolbar-items","overflow-items","compact-side-groups","ui-font-family"])):mt("",!0)],40,wq))}},Sq=kn(kq,[["__scopeId","data-v-9554df11"]]),_q=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"}}};Ut();var Dn=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(Ua()),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,h=ne(e.disabled),p=ne(!1),v=ne(!1),g=ne(e.style),y=ne(e.isNarrow),_=ne(e.isWide),w=ne(e.minWidth),I=ne(e.layoutWidth),k=ne(e.suppressActiveHighlight||!1),C=ne(e.argument),R=ne(null),P=ne(null),M=ne(e.iconColor),$=ne(e.hasCaret),F=ne(!!e.splitButton),D=e.splitButtonCommand,V=!!e.restoreEditorFocus,x=ne(e.dropdownStyles),B=ne(e.tooltip),T=ne(e.tooltipVisible),te=ne(e.tooltipTimeout),U=ne(e.defaultLabel),W=ne(e.label),Y=ne(e.hideLabel),J=ne(e.inlineTextInputVisible),Oe=ne(e.hasInlineTextInput),de=ne(e.markName),oe=ne(e.labelAttr),pe=ne(e.selectedValue),Ee=ne(e.dropdownValueKey),Ve=ne(e.inputRef||null),rt=ne([]);if(e.options){if(!Array.isArray(e.options))throw new Error("Invalid toolbar item options - "+e.options);let ee=0;for(let ue=0;ue<e.options.length;ue+=1){const Z=e.options[ue];(!Z||typeof Z!="object")&&(ee+=1)}if(ee)throw new Error(`Toolbar item options must all be objects - ${e.name}. ${ee} row(s) are not, so this item is skipped.`);rt.value?.push(...e.options)}const ut=(ee={},...ue)=>{Re(ee,...ue),!k.value&&(p.value=!0)},ht=()=>{le(),p.value=!1},Rt=ee=>{h.value=ee},Pe=()=>{h.value=d},Re=e.onActivate||(()=>null),le=e.onDeactivate||(()=>null),L=()=>{const ee={};return Object.keys(A).forEach(ue=>{A[ue].value!==void 0&&(ee[ue]=A[ue].value)}),ee},A={id:t,name:r,type:n,command:o,noArgumentCommand:i,icon:s,tooltip:B,group:a,attributes:u,disabled:h,active:p,expand:v,nestedOptions:rt,style:g,isNarrow:y,isWide:_,minWidth:w,layoutWidth:I,argument:C,parentItem:P,iconColor:M,hasCaret:$,splitButton:F,splitButtonCommand:D,dropdownStyles:x,tooltipVisible:T,tooltipTimeout:te,defaultLabel:U,label:W,hideLabel:Y,inlineTextInputVisible:J,hasInlineTextInput:Oe,restoreEditorFocus:V,markName:de,labelAttr:oe,childItem:R,allowWithoutEditor:l,dropdownValueKey:Ee,selectedValue:pe,inputRef:Ve};return{...A,initiallyDisabled:d,unref:L,activate:ut,deactivate:ht,setDisabled:Rt,resetDisabled:Pe,onActivate:Re,onDeactivate:le}};Ut(),En();var Aq=["onClick","innerHTML","aria-label","onKeydown"],Iq={__name:"AlignmentButtons",emits:["select"],setup(e,{emit:t}){const{isHighContrastMode:n}=gs(),r=t,o=ne([]),i=[{key:"left",ariaLabel:"Align left",icon:Cr.alignLeft},{key:"center",ariaLabel:"Align center",icon:Cr.alignCenter},{key:"right",ariaLabel:"Align right",icon:Cr.alignRight},{key:"justify",ariaLabel:"Justify",icon:Cr.alignJustify}],s=d=>{r("select",d)},a=d=>{if(d===o.value.length-1)return;const h=o.value[d+1];h&&(h.setAttribute("tabindex","0"),h.focus())},l=d=>{if(d===0)return;const h=o.value[d-1];h&&(h.setAttribute("tabindex","0"),h.focus())},u=(d,h)=>{switch(d.key){case"ArrowLeft":l(h);break;case"ArrowRight":a(h);break;case"Enter":s(i[h].key);break;default:break}};return Xn(()=>{const d=o.value[0];d&&(d.setAttribute("tabindex","0"),d.focus())}),(d,h)=>(fe(),we("div",{class:cn(["alignment-buttons",{"high-contrast":nt(n)}])},[(fe(),we(Ht,null,Bn(i,(p,v)=>ae("div",{key:p.key,class:"sd-button-icon",onClick:g=>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:an(g=>u(g,v),["prevent"])},null,40,Aq)),64))],2))}},Eq=kn(Iq,[["__scopeId","data-v-13e5f7a4"]]);Ut(),En();var Tq=["onClick","innerHTML","aria-label","onKeydown"],xq={__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}=gs(),r=t,o=e,i=ne([]),s=Ce(()=>({width:`${o.iconSize}px`,height:`${o.iconSize}px`})),a=h=>{r("select",h)},l=h=>{if(h===i.value.length-1)return;const p=i.value[h+1];p&&(p.setAttribute("tabindex","0"),p.focus())},u=h=>{if(h===0)return;const p=i.value[h-1];p&&(p.setAttribute("tabindex","0"),p.focus())},d=(h,p)=>{switch(h.key){case"ArrowLeft":u(p);break;case"ArrowRight":l(p);break;case"Enter":a(o.buttons[p].key);break;default:break}};return Xn(()=>{const h=i.value[0];h&&(h.setAttribute("tabindex","0"),h.focus())}),(h,p)=>(fe(),we("div",{class:cn(["style-buttons-list",{"high-contrast":nt(n)}])},[(fe(!0),we(Ht,null,Bn(o.buttons,(v,g)=>(fe(),we("div",{key:v.key,class:cn(["sd-button-icon",{"sd-selected":o.selectedStyle===v.key}]),style:xn(s.value),onClick:y=>a(v.key),innerHTML:v.icon,role:"menuitem","aria-label":v.ariaLabel,ref_for:!0,ref_key:"buttonRefs",ref:i,onKeydown:an(y=>d(y,g),["prevent"])},null,46,Tq))),128))],2))}},VT=kn(xq,[["__scopeId","data-v-44f37ff6"]]),Rq=[{key:"disc",icon:Cr.bulletListDisc,ariaLabel:"Opaque circle"},{key:"circle",icon:Cr.bulletListCircle,ariaLabel:"Outline circle"},{key:"square",icon:Cr.bulletListSquare,ariaLabel:"Opaque square"}],Lq=[{key:"decimal",icon:Cr.numberedListDecimal,ariaLabel:"1. 2. 3."},{key:"decimal-paren",icon:Cr.numberedListDecimalParen,ariaLabel:"1) 2) 3)"},{key:"upper-roman",icon:Cr.numberedListUpperRoman,ariaLabel:"I. II. III."},{key:"lower-roman",icon:Cr.numberedListLowerRoman,ariaLabel:"i. ii. iii."},{key:"upper-alpha",icon:Cr.numberedListUpperAlpha,ariaLabel:"A. B. C."},{key:"upper-alpha-paren",icon:Cr.numberedListUpperAlphaParen,ariaLabel:"A) B) C)"},{key:"lower-alpha",icon:Cr.numberedListLowerAlpha,ariaLabel:"a. b. c."},{key:"lower-alpha-paren",icon:Cr.numberedListLowerAlphaParen,ariaLabel:"a) b) c)"}];Ut(),En();var Mq=["onClick","onKeydown"],Oq={class:"document-mode-column icon-column"},Pq=["innerHTML"],Dq={class:"document-mode-column text-column"},Fq={class:"document-mode-type"},Nq={class:"document-mode-description"},Bq={__name:"DocumentMode",props:{options:{type:Array}},emits:["select"],setup(e,{emit:t}){const n=t,r=ne([]),{isHighContrastMode:o}=gs(),i=e,s=d=>{n("select",d)},a=d=>{if(d===r.value.length-1)return;const h=r.value[d+1];h&&(h.setAttribute("tabindex","0"),h.focus())},l=d=>{if(d===0)return;const h=r.value[d-1];h&&(h.setAttribute("tabindex","0"),h.focus())},u=(d,h)=>{switch(d.key){case"ArrowDown":a(h);break;case"ArrowUp":l(h);break;case"Enter":s(i.options[h]);break;default:break}};return Xn(()=>{r.value[0].setAttribute("tabindex","0"),r.value[0].focus()}),(d,h)=>(fe(),we("div",{class:cn(["document-mode",{"high-contrast":nt(o)}])},[(fe(!0),we(Ht,null,Bn(e.options,(p,v)=>(fe(),we("div",{class:cn(["sd-option-item",{"sd-disabled":p.disabled}]),onClick:g=>s(p),"data-item":"btn-documentMode-option",role:"menuitem",ref_for:!0,ref_key:"documentModeRefs",ref:r,onKeydown:an(g=>u(g,v),["prevent"])},[ae("div",Oq,[ae("div",{class:"icon-column__icon",innerHTML:p.icon},null,8,Pq)]),ae("div",Dq,[ae("div",Fq,Et(p.label),1),ae("div",Nq,Et(p.description),1)])],42,Mq))),256))],2))}},zq=kn(Bq,[["__scopeId","data-v-bee14d7a"]]);Ut(),En();var Vq={class:"linked-style-buttons","data-editor-ui-surface":""},Uq=["onClick","onKeydown","aria-label"],jq=["title","aria-label","onClick"],$q=["innerHTML"],Hq={__name:"LinkedStyle",props:{styles:{type:Array,default:()=>[]},selectedOption:{type:String,default:null},updateLabel:{type:String,default:"Update to match selection"}},emits:["select","update"],setup(e,{emit:t}){const n=t,r=ne([]),o=e,i=v=>{n("select",v)},s=v=>{n("update",v)},a=v=>{if(v===r.value.length-1)return;const g=r.value[v+1];g.setAttribute("tabindex","0"),g.focus()},l=v=>{if(v===0)return;const g=r.value[v-1];g.setAttribute("tabindex","0"),g.focus()},u=(v,g,y)=>{switch(v.key){case"ArrowDown":a(g);break;case"ArrowUp":l(g);break;case"Enter":v.preventDefault(),i(y);break;default:break}},d=v=>v?.name??v?.id??"",h=v=>{const g=v?.preview?.css;return g&&typeof g=="object"?g:void 0},p=()=>{r.value[0]&&(r.value[0].setAttribute("tabindex","0"),r.value[0].focus())};return Xn(p),$t(()=>o.styles.length,async(v,g)=>{v===0||g!==0||(await It(),p())}),(v,g)=>(fe(),we("div",Vq,[(fe(!0),we(Ht,null,Bn(o.styles,(y,_)=>(fe(),we("div",{key:y.id??_,class:cn(["style-item",{selected:e.selectedOption===y.id}]),onClick:w=>i(y),onKeydown:w=>u(w,_,y),"aria-label":`Linked style - ${y.id??d(y)}`,ref_for:!0,ref_key:"styleRefs",ref:r},[ae("div",{class:"style-name","data-item":"btn-linkedStyles-option",style:xn(h(y))},Et(d(y)),5),ae("button",{type:"button",class:"style-update","data-item":"btn-linkedStyles-update",title:o.updateLabel,"aria-label":`${o.updateLabel}: ${d(y)}`,onClick:an(w=>s(y),["stop"]),onKeydown:g[0]||(g[0]=an(()=>{},["stop"]))},[ae("span",{class:"style-update-icon",innerHTML:nt(Cr).paintbrush},null,8,$q)],40,jq)],42,Uq))),128))]))}},Gq=kn(Hq,[["__scopeId","data-v-b5a32523"]]);Ut(),En();var Wq=["placeholder"],qq={class:"sd-ai-writer__footer"},Kq={key:0,class:"sd-ai-writer__error",role:"alert"},Yq=["disabled"],Xq="https://sd-dev-express-gateway-i6xtm.ondigitalocean.app/insights",Zq="You are an expert copywriter and you are immersed in a document editor. Only write what is asked for.",Qq={__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=Ce(()=>t.selectedText?"Insert prompt to update text":"Insert prompt to generate text"),a=Ce(()=>n.value.trim().length>0&&!r.value);Xn(()=>{It(()=>{i.value?.focus()})});function l(g){if(typeof g=="string")return g;if(!g||typeof g!="object")return"";const y=g.custom_prompt;if(Array.isArray(y)){const _=y[0];if(_&&typeof _.value=="string")return _.value}return y&&typeof y=="object"&&typeof y.value=="string"?y.value:typeof g.value=="string"?g.value:typeof g.text=="string"?g.text:""}async function u(g){const y={"Content-Type":"application/json"};t.apiKey&&(y["x-api-key"]=t.apiKey);const _=t.selectedText.trim(),w=_?`Rewrite the following text: "${_}" using these instructions: ${g}`:`Generate text based on the following prompt: ${g}`,I=await fetch(t.endpoint||Xq,{method:"POST",headers:y,body:JSON.stringify({stream:!1,context:Zq,insights:[{type:"custom_prompt",name:_?"text_rewrite":"text_generation",message:w,format:[{value:""}]}]})});if(!I.ok){const C=await I.text().catch(()=>"");throw new Error(C||`AI request failed with ${I.status}`)}const k=l((I.headers.get("content-type")||"").includes("application/json")?await I.json():await I.text()).trim();if(!k)throw new Error("AI returned no text.");return k}function d(g){return!g||typeof g!="object"?!0:!(g.success===!1||g.ok===!1)}function h(g){const y=t.doc;if(!y)throw new Error("Document API is unavailable.");t.restoreSelection?.();let _=null,w=!1;if(t.selectedText&&t.target&&typeof y.replace=="function"?(_=y.replace({target:t.target,text:g}),w=!0):t.target&&typeof y.insert=="function"?(_=y.insert({target:t.target,value:g,type:"text"}),w=!0):typeof y.insert=="function"&&(_=y.insert({value:g,type:"text"}),w=!0),!w)throw new Error("Document text insertion is unavailable.");if(!d(_))throw new Error("Unable to insert generated text.")}async function p(){if(a.value){o.value="",r.value=!0;try{h(await u(n.value.trim())),t.handleClose()}catch(g){o.value=g instanceof Error?g.message:String(g)}finally{r.value=!1}}}function v(g){g.key!=="Enter"||g.shiftKey||(g.preventDefault(),p())}return(g,y)=>(fe(),we("form",{class:"sd-ai-writer","data-item":"ai-writer",onSubmit:an(p,["prevent"])},[Hi(ae("textarea",{ref_key:"textareaRef",ref:i,"onUpdate:modelValue":y[0]||(y[0]=_=>n.value=_),class:"sd-ai-writer__input",placeholder:s.value,rows:"4",onKeydown:v},null,40,Wq),[[Ki,n.value]]),ae("div",qq,[o.value?(fe(),we("p",Kq,Et(o.value),1)):mt("",!0),ae("button",{class:"sd-ai-writer__submit",type:"submit",disabled:!a.value},Et(r.value?"Generating":"Generate"),9,Yq)])],32))}},Jq=kn(Qq,[["__scopeId","data-v-67f6c6f7"]]);Ut(),En();var eK=["aria-label","onClick","onKeydown"],tK=["innerHTML"],nK=["innerHTML"],Bg=7,rK={__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=Ce(()=>g=>r.activeColor.value?r.activeColor.value.toUpperCase()===g.value:!1),i=(g,y)=>y===5||["#FFFFFF","#FAFF09"].includes(g)?{color:"#000"}:{color:"#FFF"},s=g=>{n("select",g.value)},a=ne([]),l=ne([]);Xn(()=>{if(!r.icons.every(y=>Array.isArray(y)))throw new Error("icon props must be 2d array");const g=l.value[0];g&&(g.setAttribute("tabindex","0"),g.focus({preventScroll:!0}))});const u=(g,y)=>{const _=Bg*g+y+1,w=l.value[_];w&&(w.setAttribute("tabindex","0"),w.focus({preventScroll:!0}))},d=(g,y)=>{const _=Bg*g+y-1,w=l.value[_];w&&(w.setAttribute("tabindex","0"),w.focus({preventScroll:!0}))},h=(g,y)=>{const _=y+Bg*(g+1),w=l.value[_];w&&(w.setAttribute("tabindex","0"),w.focus({preventScroll:!0}))},p=(g,y)=>{const _=y+Bg*(g-1),w=l.value[_];w&&(w.setAttribute("tabindex","0"),w.focus({preventScroll:!0}))},v=(g,y,_,w)=>{switch(g.key){case"ArrowRight":u(y,_);break;case"ArrowLeft":d(y,_);break;case"ArrowDown":h(y,_);break;case"ArrowUp":p(y,_);break;case"Enter":s(w);break;case"Escape":n("clickoutside");break;default:break}};return(g,y)=>(fe(!0),we(Ht,null,Bn(e.icons,(_,w)=>(fe(),we("div",{class:"sd-option-row",key:w,role:"group",ref_for:!0,ref_key:"rowRefs",ref:a},[(fe(!0),we(Ht,null,Bn(_,(I,k)=>(fe(),we("div",{class:"sd-option",key:k,"aria-label":I.label,role:"menuitem",ref_for:!0,ref_key:"iconRefs",ref:l,onClick:an(C=>s(I),["stop","prevent"]),onKeydown:an(C=>v(C,w,k,I),["prevent"])},[ae("div",{class:"sd-option__icon",innerHTML:I.icon,style:xn(I.style)},null,12,tK),o.value(I)?(fe(),we("div",{key:0,class:"sd-option__check",innerHTML:nt(Cr).colorOptionCheck,style:xn(i(I.value,k))},null,12,nK)):mt("",!0)],40,eK))),128))]))),128))}},UT=kn(rK,[["__scopeId","data-v-05eb02fc"]]),oK=`<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
|
`;Ut(),En();var iK={class:"options-grid-wrap"},sK=["innerHTML"],aK={class:"option-grid-ctn"},lK={__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)=>(fe(),we("div",iK,[e.hasNoneIcon?(fe(),we("div",{key:0,class:"none-option",role:"menuitem","aria-label":"Clear color selection",onClick:i[0]||(i[0]=s=>r("none"))},[ae("span",{innerHTML:nt(oK),class:"none-icon"},null,8,sK),i[1]||(i[1]=Gi(" None ",-1))])):mt("",!0),ae("div",aK,[un(UT,{icons:e.icons,"active-color":e.activeColor,onSelect:r},null,8,["icons","active-color"]),e.customIcons.flat().length?(fe(),we(Ht,{key:0},[i[2]||(i[2]=ae("span",{class:"option-grid-ctn__subtitle"},"Custom colors",-1)),un(UT,{icons:e.customIcons,"active-color":e.activeColor,onSelect:r},null,8,["icons","active-color"])],64)):mt("",!0)])]))}},cK=kn(lK,[["__scopeId","data-v-52b0283a"]]);Ut();var uK=e=>{e.expand.value=!1},on=(e,t=null)=>({label:t,icon:Cr.colorOption,value:e,style:{color:e,boxShadow:"0 0 5px 1px rgba(0, 0, 0, 0.1)",borderRadius:"50%"}}),m2=(e,t,n=[],r=!1)=>{const o=i=>{t.iconColor.value=i,e.emitCommand({item:t,argument:i}),uK(t),wc(e)};return to("div",{},[to(cK,{icons:dK,customIcons:n,activeColor:t.iconColor,hasNoneIcon:r,onSelect:o})])},dK=[[on("#111111","black"),on("#333333","dark gray"),on("#5C5C5C","medium gray"),on("#858585","light gray"),on("#ADADAD","very light gray"),on("#D6D6D6","transparent gray"),on("#FFFFFF","white")],[on("#860028","dark red"),on("#D2003F","red"),on("#DB3365","coral red"),on("#E4668C","light red"),on("#ED99B2","pale pink"),on("#F6CCD9","transparent pink"),on("#FF004D","bright pink")],[on("#83015E","dark purple"),on("#CD0194","purple"),on("#D734A9","orchid"),on("#E167BF","light purple"),on("#EB99D4","lavender"),on("#F5CCEA","transparent pink"),on("#FF00A8","neon pink")],[on("#8E220A","maroon"),on("#DD340F","red-orange"),on("#E45C3F","burnt orange"),on("#EB856F","peach"),on("#F1AE9F","pale peach"),on("#F8D6CF","transparent peach"),on("#FF7A00","orange")],[on("#947D02","olive"),on("#E7C302","mustard yellow"),on("#ECCF35","yellow"),on("#F1DB67","light yellow"),on("#F5E79A","very pale yellow"),on("#FAF3CC","transparent yellow"),on("#FAFF09","neon yellow")],[on("#055432","forest green"),on("#07834F","green"),on("#399C72","medium green"),on("#6AB595","light green"),on("#9CCDB9","mint"),on("#CDE6DC","transparent mint"),on("#05F38F","bright teal")],[on("#063E7E","navy blue"),on("#0A60C5","blue"),on("#3B80D1","sky blue"),on("#6CA0DC","cornflower blue"),on("#9DBFE8","light blue"),on("#CEDFF3","very light blue"),on("#21c8ce","cyan")],[on("#3E027A","deep purple"),on("#6103BF","indigo"),on("#8136CC","violet"),on("#A068D9","lavender pink"),on("#C09AE6","light lilac"),on("#DFCDF2","transparent lilac"),on("#A91DFF","neon purple")]];Ut(),En();var fK=["data-cols","data-rows","onKeydown","onClick"],hK=["aria-valuetext"],zg=5,pK={__name:"TableGrid",emits:["select","clickoutside"],setup(e,{emit:t}){const n=t,r=ne(0),o=ne(0),{isHighContrastMode:i}=gs(),s=ne([]),a=h=>{let p=h.target;if(p.dataset.grid)return;let v=[...p.parentElement.querySelectorAll("[data-item]")],g=parseInt(p.dataset.cols,10),y=parseInt(p.dataset.rows,10);l(v,g,y)},l=(h,p,v)=>{o.value=p,r.value=v;for(let g=0;g<h.length;g++){let y=h[g],_=parseInt(y.dataset.cols,10),w=parseInt(y.dataset.rows,10);_<=p&&w<=v?y.classList.add("sd-selected"):y.classList.remove("sd-selected")}},u=({cols:h,rows:p})=>{n("select",{cols:h,rows:p})},d=(h,p,v)=>{let g=p-1,y=v-1;switch(h.key){case"ArrowRight":{if(g>=4)return;const _=y*zg;s.value[_+g+1].setAttribute("tabindex","0"),s.value[_+g+1].focus(),l(s.value,p+1,v);break}case"ArrowLeft":{if(g<=0)return;const _=y*zg;s.value[_+g-1].setAttribute("tabindex","0"),s.value[_+g-1].focus(),l(s.value,p-1,v);break}case"ArrowDown":{if(y>=4)return;const _=(y+1)*zg;s.value[_+g].setAttribute("tabindex","0"),s.value[_+g].focus(),l(s.value,p,v+1);break}case"ArrowUp":{if(y<=0)return;const _=(y-1)*zg;s.value[_+g].setAttribute("tabindex","0"),s.value[_+g].focus(),l(s.value,p,v-1);break}case"Enter":u({cols:p,rows:v});break;default:break}};return Xn(()=>{s.value[0].setAttribute("tabindex","0"),s.value[0].focus(),l(s.value,1,1)}),(h,p)=>(fe(),we("div",{class:cn(["toolbar-table-grid-wrapper",{"high-contrast":nt(i)}])},[ae("div",{class:"toolbar-table-grid",onMouseover:a,"data-grid":"true"},[(fe(),we(Ht,null,Bn(5,v=>(fe(),we(Ht,{key:v},[(fe(),we(Ht,null,Bn(5,g=>ae("div",{class:"toolbar-table-grid__item",key:`${v}_${g}`,"data-cols":g,"data-rows":v,"data-item":"true",ref_for:!0,ref_key:"tableGridItems",ref:s,onKeydown:an(y=>d(y,g,v),["prevent"]),onClick:an(y=>u({cols:g,rows:v}),["stop","prevent"])},null,40,fK)),64))],64))),64))],32),ae("div",{class:"toolbar-table-grid-value","aria-valuetext":`${r.value} x ${o.value}`},Et(r.value)+" x "+Et(o.value),9,hK)],2))}},mK=kn(pK,[["__scopeId","data-v-b87d6ca2"]]);Ut(),En();var gK={class:"toolbar-table-actions"},vK=["onClick","data-item","ariaLabel"],yK={class:"toolbar-table-actions__icon"},bK=["innerHTML"],wK={class:"toolbar-table-actions__label"},CK={__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)=>(fe(),we("div",gK,[(fe(!0),we(Ht,null,Bn(e.options,s=>(fe(),we("div",{class:cn(["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"},[ae("div",yK,[ae("div",{class:"toolbar-table-actions__icon-wrapper",innerHTML:s.icon},null,8,bK)]),ae("div",wK,Et(s.label),1)],10,vK))),256))]))}},kK=kn(CK,[["__scopeId","data-v-0cdad084"]]);Ut(),En();var SK=["aria-busy"],_K=["aria-disabled"],AK={class:"sd-page-number-menu__row-label","aria-hidden":"true"},IK=["aria-checked","aria-label","title","tabindex","data-position","data-alignment","onClick"],EK={class:"sd-page-number-menu__page",viewBox:"0 0 36 46","aria-hidden":"true",focusable:"false"},TK=["x","y"],xK={class:"sd-page-number-menu__check"},RK=["disabled"],LK={class:"sd-page-number-menu__format"},MK={class:"sd-page-number-menu__field"},OK=["disabled"],PK=["value"],DK={class:"sd-page-number-menu__start"},FK={class:"sd-page-number-menu__check"},NK=["disabled"],BK=["disabled","onKeydown"],zK={key:0,class:"sd-page-number-menu__error",role:"alert"},VK={key:1,class:"sd-page-number-menu__note",role:"status"},UK={class:"sd-page-number-menu__actions"},jK=["disabled"],$K=["disabled"],HK=["disabled"],GK={class:"sd-page-number-menu__cursor-text"},WK={__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(Re=>r.map(le=>({position:Re.value,alignment:le.value,label:`${Re.label}, ${le.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}=gs(),d=t.initialChoice??{},h=ne(d.position==="top"?"top":"bottom"),p=ne(r.some(Re=>Re.value===d.alignment)?d.alignment:"right"),v=ne(d.showOnFirstPage!==!1),g=ne("decimal"),y=ne(!1),_=ne(1),w=ne(null),I=ne(typeof t.loadCurrent=="function");let k=Promise.resolve();const C=ne(!1),R=ne(!1),P=ne(""),M=ne([]),$=Ce(()=>t.pageNumbersState?.enabled===!0),F=Ce(()=>t.atCursorState?.enabled===!0),D=Ce(()=>(w.value?.placements?.length??0)>0),V=Ce(()=>s.some(Re=>Re.value===g.value)?[...i,...s]:i),x=Ce(()=>o.findIndex(Re=>Re.position===h.value&&Re.alignment===p.value)),B=Ce(()=>{if(x.value>=0)return x.value;const Re=n.findIndex(le=>le.value===h.value);return Math.max(0,Re)*r.length}),T=Ce(()=>D.value?"Apply":"Add page numbers"),te=Ce(()=>$.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."),U=Ce(()=>F.value?"In the header or footer youβre editing":t.inHeaderFooter?"Place the cursor without selecting text":"Click into a header or footer first"),W=Ce(()=>{const Re=typeof navigator>"u"?"":navigator.platform||navigator.userAgent||"";return/Mac|iPhone|iPad/i.test(Re)?"β₯β§βP":"Ctrl+Alt+Shift+P"});function Y(Re){return Re.position===h.value&&Re.alignment===p.value}function J(){C.value=!0,P.value=""}function Oe(Re,{focus:le=!1}={}){h.value=Re.position,p.value=Re.alignment,J(),le&&It(()=>M.value[o.indexOf(Re)]?.focus())}function de(Re){const le=B.value,L=Math.floor(le/r.length),A=le%r.length,ee={ArrowLeft:[L,Math.max(0,A-1)],ArrowRight:[L,Math.min(r.length-1,A+1)],ArrowUp:[Math.max(0,L-1),A],ArrowDown:[Math.min(n.length-1,L+1),A],Home:[L,0],End:[L,r.length-1]}[Re.key];return ee?(Re.preventDefault(),Oe(o[ee[0]*r.length+ee[1]],{focus:!0}),!0):!1}function oe(Re){de(Re)||(Re.key==="Enter"?(Re.preventDefault(),ht()):Re.key===" "&&Re.preventDefault())}function pe(Re){if(w.value=Re&&Array.isArray(Re.placements)?Re:null,!w.value||C.value)return;const le=w.value.placements.find(L=>L.kind==="footer"&&L.alignment)??w.value.placements.find(L=>L.alignment)??w.value.placements[0];le&&(h.value=le.kind==="header"?"top":"bottom",p.value=le.alignment??null,v.value=w.value.showOnFirstPage!==!1),g.value=w.value.format??"decimal",y.value=typeof w.value.start=="number",_.value=typeof w.value.start=="number"?w.value.start:1,It(()=>M.value[B.value]?.focus({preventScroll:!0}))}function Ee(){const Re=w.value,le=h.value==="top"?"header":"footer",L=Re?.placements?.find(ue=>ue.kind===le)??null,A={position:h.value};p.value&&(!L||L.alignment!==p.value)&&(A.alignment=p.value),(!D.value||v.value!==(Re?.showOnFirstPage!==!1))&&(A.showOnFirstPage=v.value),g.value!==(Re?.format??"decimal")&&(A.format=g.value);const ee=y.value?Ve():null;return ee!==(Re?.start??null)&&(A.start=ee),A}function Ve(){const Re=Math.floor(Number(_.value));return Number.isFinite(Re)&&Re>=0?Re:1}function rt(Re,le){const L=Re?.failure?.details;return L?.reason==="page-number-has-content"?`A page number shares its line with other text. Edit the ${L.kind==="header"?"header":"footer"} directly to change it.`:L?.reason==="page-number-exists"?"This section already has page numbers.":le==="remove"?"Page numbers couldnβt be removed. Try again.":D.value?"Page numbers couldnβt be changed. Try again.":"Page numbers couldnβt be added. Try again."}async function ut(Re,le){if(!(!$.value||R.value)){R.value=!0,P.value="";try{await k;const{execute:L,outcome:A}=le(),ee=await L();if(ee===!0||ee?.success===!0){t.close(A);return}P.value=rt(ee,Re)}catch{P.value=rt(null,Re)}finally{R.value=!1}}}function ht(){return ut("apply",()=>{const Re=Ee();return{execute:()=>t.applyPageNumbers(Re),outcome:{action:"apply",choice:{position:h.value,alignment:p.value,showOnFirstPage:v.value}}}})}function Rt(){return ut("remove",()=>({execute:()=>t.removePageNumbers(),outcome:{action:"remove",kinds:(w.value?.placements??[]).map(Re=>Re.kind)}}))}function Pe(){if(!F.value||R.value)return;R.value=!0;let Re;try{Re=t.insertAtCursor()}catch{Re=void 0}t.close({action:"cursor"}),Promise.resolve(Re).catch(()=>{})}return Xn(()=>{It(()=>M.value[B.value]?.focus({preventScroll:!0})),typeof t.loadCurrent=="function"&&(k=Promise.resolve().then(()=>t.loadCurrent()).then(pe,()=>pe(null)).finally(()=>{I.value=!1}))}),(Re,le)=>(fe(),we("div",{class:cn(["sd-page-number-menu",{"high-contrast":nt(u)}]),role:"group","aria-labelledby":"sd-page-number-menu-title","aria-busy":I.value||void 0,"data-sd-page-number-menu":""},[le[9]||(le[9]=ae("div",{id:"sd-page-number-menu-title",class:"sd-page-number-menu__title"},"Page numbers",-1)),ae("div",{class:"sd-page-number-menu__grid",role:"radiogroup","aria-label":"Position","aria-disabled":!$.value||void 0},[(fe(),we(Ht,null,Bn(n,(L,A)=>(fe(),we(Ht,{key:L.value},[ae("div",AK,Et(L.label),1),(fe(!0),we(Ht,null,Bn(nt(o).slice(A*3,A*3+3),ee=>(fe(),we("button",{key:`${ee.position}-${ee.alignment}`,ref_for:!0,ref:ue=>M.value[nt(o).indexOf(ee)]=ue,type:"button",role:"radio",class:cn(["sd-page-number-menu__tile",{"is-selected":Y(ee)}]),"aria-checked":Y(ee),"aria-label":ee.label,title:ee.label,tabindex:nt(o).indexOf(ee)===B.value?0:-1,"data-position":ee.position,"data-alignment":ee.alignment,onClick:ue=>Oe(ee),onDblclick:ht,onKeydown:oe},[(fe(),we("svg",EK,[le[4]||(le[4]=ek('<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)),ae("rect",{class:"sd-page-number-menu__chip",x:a[ee.alignment],y:l[ee.position],width:"8",height:"5",rx:"1.5"},null,8,TK)]))],42,IK))),128))],64))),64))],8,_K),ae("label",xK,[Hi(ae("input",{"onUpdate:modelValue":le[0]||(le[0]=L=>v.value=L),type:"checkbox",disabled:!$.value,"data-sd-page-number-first-page":"",onChange:J},null,40,RK),[[ed,v.value]]),le[5]||(le[5]=ae("span",null,"Show on first page",-1))]),ae("div",LK,[ae("label",MK,[le[6]||(le[6]=ae("span",null,"Format",-1)),Hi(ae("select",{"onUpdate:modelValue":le[1]||(le[1]=L=>g.value=L),disabled:!$.value,"data-sd-page-number-format":"",onChange:J},[(fe(!0),we(Ht,null,Bn(V.value,L=>(fe(),we("option",{key:L.value,value:L.value},Et(L.label),9,PK))),128))],40,OK),[[am,g.value]])]),ae("div",DK,[ae("label",FK,[Hi(ae("input",{"onUpdate:modelValue":le[2]||(le[2]=L=>y.value=L),type:"checkbox",disabled:!$.value,"data-sd-page-number-restart":"",onChange:J},null,40,NK),[[ed,y.value]]),le[7]||(le[7]=ae("span",null,"Start at",-1))]),Hi(ae("input",{"onUpdate:modelValue":le[3]||(le[3]=L=>_.value=L),type:"number",min:"0",step:"1",inputmode:"numeric","aria-label":"First page number",disabled:!$.value||!y.value,"data-sd-page-number-start":"",onInput:J,onKeydown:Ci(an(ht,["prevent"]),["enter"])},null,40,BK),[[Ki,_.value,void 0,{number:!0}]])])]),P.value?(fe(),we("p",zK,Et(P.value),1)):te.value?(fe(),we("p",VK,Et(te.value),1)):mt("",!0),ae("div",UK,[D.value?(fe(),we("button",{key:0,type:"button",class:"sd-page-number-menu__remove",disabled:!$.value||R.value,"aria-label":"Remove page numbers","data-sd-page-number-remove":"",onClick:Rt}," Remove ",8,jK)):mt("",!0),ae("button",{type:"button",class:"sd-page-number-menu__add",disabled:!$.value||R.value,"data-sd-page-number-add":"",onClick:ht},Et(T.value),9,$K)]),le[10]||(le[10]=ae("div",{class:"sd-page-number-menu__divider",role:"separator"},null,-1)),ae("button",{type:"button",class:"sd-page-number-menu__cursor",disabled:!F.value||R.value,"data-sd-page-number-at-cursor":"",onClick:Pe},[ae("span",GK,[le[8]||(le[8]=ae("span",null,"Insert at cursor",-1)),ae("small",null,Et(U.value),1)]),ae("kbd",null,Et(W.value),1)],8,HK)],10,SK))}},qK=kn(WK,[["__scopeId","data-v-30327fd0"]]),g2="sd-page-number-flash",KK=1400,jT=e=>new Promise(t=>{typeof e?.requestAnimationFrame=="function"?e.requestAnimationFrame(()=>t()):setTimeout(t,16)});async function $T(e,t){const n=e?.ownerDocument?.defaultView;if(!e||!n)return;await jT(n),await jT(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(g2),i.classList.add(g2),n.setTimeout(()=>i.classList.remove(g2),KK)}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
|
-
`;Ut();var ts=e=>{e.expand.value=!1},v2=(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")},XK=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},HT=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 XK(r))n.add(o);return e.filter(r=>n.has(r))},ZK=e=>{const t=e.find(o=>o.type==="overflow"),n=e.filter(o=>o!==t),r=new Set(HT(n));return e.filter(o=>o===t||r.has(o))};function y2(e,t){const n={...e};return t?n.href=t:delete n.href,n}function GT(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 QK(e){return typeof e?.quotedText=="string"?e.quotedText:typeof e?.text=="string"?e.text:""}function b2(e){return e.ui?.selection?.get?.()??e.ui?.selection?.current?.()??null}function JK(e){return!!(e.config?.superdoc?.config?.modules?.ai||e.superdoc?.config?.modules?.ai)}function eY(e){return e.config?.superdoc?.config?.modules?.ai??e.superdoc?.config?.modules?.ai??{}}var tY=({superToolbar:e,toolbarIcons:t,toolbarTexts:n,toolbarFonts:r,hideButtons:o,availableWidth:i,role:s,isDev:a=!1,configuredItemNames:l,configuredItemOrder:u,excludedItemNames:d,additionalItems:h=[]}={})=>{const p=Dn({type:"button",name:"bold",command:"toggleBold",icon:t.bold,tooltip:n.bold,attributes:{ariaLabel:"Bold"}}),v=(r??mq).map(_q),g=Dn({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:v,onActivate:({fontFamily:pt}={},St=!1)=>{if(St){g.label.value="",g.selectedValue.value="";return}if(!pt)return;pt=pt.split(",")[0];const Gt=vn=>vn.value??vn.label,jt=v.find(vn=>Gt(vn)===g.defaultLabel.value),pn=v.find(vn=>Gt(vn)===pt);pn?(g.label.value=pn.label,g.selectedValue.value=pn.key):jt?(g.label.value=pt,g.selectedValue.value=jt.key):(g.label.value=pt,g.selectedValue.value="")},onDeactivate:()=>{const pt=v.find(St=>(St.value??St.label)===g.defaultLabel.value);g.label.value=pt?.label??g.defaultLabel.value,g.selectedValue.value=pt?.key??""}}),y=Dn({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:()=>_(y)}]});function _(pt){const St=b2(e),Gt=St?.selectionTarget??GT(St?.target),jt=St?.empty?"":QK(St),pn=eY(e),vn=()=>ts(pt),mn=()=>{const er=e.pendingSelectionCapture;er&&typeof e.ui?.selection?.restore=="function"&&e.ui.selection.restore(er)};return to("div",{},[to(Jq,{handleClose:vn,selectedText:jt,target:Gt,doc:e.superdoc?.activeEditor?.doc??null,apiKey:pn?.apiKey||e.config?.aiApiKey||"",endpoint:pn?.endpoint||e.config?.aiEndpoint||"",restoreSelection:mn})])}const w=vq,I=Dn({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:pt},St=!1)=>{if(St){I.label.value="",I.selectedValue.value="";return}const Gt=w.find(mn=>mn.label===String(I.defaultLabel.value));if(!pt){I.label.value=I.defaultLabel.value,Gt?I.selectedValue.value=Gt.key:I.selectedValue.value="";return}let jt=uW(pt,12);jt<8&&(jt=8),jt>96&&(jt=96);let pn=String(jt);const vn=w.find(mn=>mn.label===pn||mn.key===pn);vn?I.selectedValue.value=vn.key:I.selectedValue.value="",I.label.value=pn},onDeactivate:()=>{I.label.value=I.defaultLabel.value;const pt=w.find(St=>St.label===String(I.defaultLabel.value));pt?I.selectedValue.value=pt.key:I.selectedValue.value=""}}),k=()=>Dn({type:"separator",name:"separator",isNarrow:!0}),C=Dn({type:"button",name:"italic",command:"toggleItalic",icon:t.italic,active:!1,tooltip:n.italic,attributes:{ariaLabel:"Italic"}}),R=Dn({type:"button",name:"underline",command:"toggleUnderline",icon:t.underline,active:!1,tooltip:n.underline,attributes:{ariaLabel:"Underline"}}),P=Dn({type:"button",name:"strike",command:"toggleStrike",icon:t.strikethrough,active:!1,tooltip:n.strikethrough,attributes:{ariaLabel:"Strikethrough"}}),M=Dn({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:()=>m2(e,M,[],!0)}],onActivate:({color:pt})=>{M.iconColor.value=pt||""},onDeactivate:()=>M.iconColor.value=""}),$=Dn({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:()=>m2(e,$)}],onActivate:({color:pt})=>{$.iconColor.value=pt},onDeactivate:()=>$.iconColor.value="#000"}),F=Dn({type:"button",name:"search",allowWithoutEditor:!0,active:!1,icon:t.search,tooltip:n.search,group:"right",attributes:{ariaLabel:"Search"}}),D=Dn({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(D)}],onActivate:({href:pt})=>{D.attributes.value=y2(D.attributes.value,pt)},onDeactivate:()=>{D.attributes.value=y2(D.attributes.value,null),D.expand.value=!1}});function V(pt){const St=e.pendingSelectionCapture,Gt=b2(e),jt=Gt?.quotedText&&JSON.stringify(Gt.selectionTarget??Gt.target)!==JSON.stringify(St?.selectionTarget??St?.target)?Gt:St??Gt,pn=jt?.selectionTarget??GT(jt?.target)??jt?.target,vn=()=>{jt===St&&typeof e.ui?.selection?.restore=="function"&&e.ui.selection.restore(St)};return to("div",{},[to(hI,{ui:e.ui,linkItem:pt,textTarget:pn,selectedText:jt?.quotedText??null,restoreSelection:vn,closePopover:()=>{ts(pt),wc(e)},goToAnchor:()=>{ts(pt);const mn=pt.attributes.value?.href;if(!mn)return;const er=mn.slice(1),_i=(e.ui?.viewport?.getHost?.()??null)?.querySelector?.(`a[name='${er}']`);_i&&pI(_i)}})])}const x=Dn({type:"options",name:"linkInput",command:"toggleLink",active:!1});D.childItem=x,x.parentItem=D;const B=Dn({type:"button",name:"image",command:"startImageUpload",icon:t.image,active:!1,tooltip:n.image,disabled:!1,attributes:{ariaLabel:"Image"}}),T=Dn({type:"button",name:"tableOfContents",command:"insertTableOfContents",icon:t.tableOfContents,active:!1,tooltip:n.tableOfContents,disabled:!1,attributes:{ariaLabel:"Table of contents"}}),te=Dn({type:"button",name:"watermark",icon:t.watermark,tooltip:n.watermark,allowWithoutEditor:!0,disabled:!0,attributes:{ariaLabel:n.watermark}}),U=Dn({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:()=>Y(U)}]});let W=null;function Y(pt){const St=e.ui,Gt=mn=>St?.commands?.get?.(mn)?.getState?.()??null,jt=()=>{ts(pt),Pe.expand.value&&ts(Pe),wc(e)},pn=b2(e),vn=pn?.selectionTarget?.story??pn?.selectionTarget?.start?.story??pn?.target?.story??null;return to(qK,{pageNumbersState:Gt("page-numbers-apply"),atCursorState:Gt("page-number-insert"),inHeaderFooter:vn?.storyType==="headerFooterPart"||vn?.storyType==="headerFooterSlot",suggesting:St?.document?.getSnapshot?.()?.mode==="suggesting",initialChoice:W,loadCurrent:()=>St?gN(St):Promise.resolve(null),applyPageNumbers:mn=>su(St,"page-numbers-apply",mn),removePageNumbers:()=>su(St,"page-numbers-remove"),insertAtCursor:()=>su(St,"page-number-insert"),close:mn=>{jt();const er=St?.viewport?.getHost?.();if(mn?.action==="apply")W=mn.choice,$T(er,mn.choice.position==="top"?"header":"footer");else if(mn?.action==="remove")for(const _i of new Set(mn.kinds))$T(er,_i)}})}const J=Dn({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:()=>Oe(J)}]});function Oe(pt){return to("div",{},[to(mK,{onSelect:Gt=>{e.emitCommand({item:pt,argument:Gt}),ts(pt),wc(e)}})])}const de=Dn({type:"dropdown",name:"tableActions",command:"executeTableCommand",tooltip:n.tableActions,icon:t.tableActions,hideLabel:!0,disabled:!0,attributes:{ariaLabel:"Table actions"},options:[{type:"render",render:()=>pe(de)}]}),oe=[{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 pe(pt){return to(kK,{options:oe,onSelect:St=>{ts(pt);const{command:Gt}=St;e.emitCommand({item:pt,argument:{command:Gt}}),wc(e)}})}const Ee=Dn({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:()=>to("div",{},[to(Eq,{onSelect:St=>{ts(Ee);const Gt={...Ee,command:"setTextAlign"};Gt.command="setTextAlign",e.emitCommand({item:Gt,argument:St}),Ve(Ee,St),wc(e)}})]),key:"alignment"}],onActivate:({textAlign:pt})=>{Ve(Ee,pt)},onDeactivate:()=>{Ve(Ee,"left")}}),Ve=(pt,St)=>{let Gt=St==="both"?"justify":St,jt={left:t.alignLeft,right:t.alignRight,center:t.alignCenter,justify:t.alignJustify},pn=jt[Gt]??jt.left;pt.icon.value=pn},rt=Dn({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 pt=St=>{ts(rt);const Gt={...rt,command:"toggleBulletListStyle"};e.emitCommand({item:Gt,argument:St})};return to(VT,{buttons:Rq,iconSize:25,selectedStyle:rt.selectedValue.value,onSelect:pt})}}]}),ut=Dn({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 pt=St=>{ts(ut);const Gt={...ut,command:"toggleOrderedListStyle"};e.emitCommand({item:Gt,argument:St})};return to(VT,{buttons:Lq,iconSize:30,selectedStyle:ut.selectedValue.value,onSelect:pt})}}]}),ht=Dn({type:"button",name:"indentleft",command:"decreaseTextIndent",icon:t.indentLeft,active:!1,tooltip:n.indentLeft,disabled:!1,attributes:{ariaLabel:"Left indent"}}),Rt=Dn({type:"button",name:"indentright",command:"increaseTextIndent",icon:t.indentRight,active:!1,tooltip:n.indentRight,disabled:!1,attributes:{ariaLabel:"Right indent"}}),Pe=Dn({type:"overflow",name:"overflow",command:null,icon:t.overflow,active:!1,disabled:!1,attributes:{ariaLabel:"Overflow items"}}),Re=Dn({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:pt})=>{pt&&(Re.label.value=pt)}}),le=Dn({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:pt})=>{pt&&(le.label.value=pt)}}),L=Dn({type:"button",name:"undo",disabled:!0,tooltip:n.undo,command:"undo",icon:t.undo,group:"left",attributes:{ariaLabel:"Undo"}}),A=Dn({type:"button",disabled:!0,name:"redo",tooltip:n.redo,command:"redo",icon:t.redo,group:"left",attributes:{ariaLabel:"Redo"}}),ee=Dn({type:"button",disabled:!1,name:"acceptTrackedChangeBySelection",tooltip:n.trackChangesAccept,command:"acceptTrackedChangeFromToolbar",icon:t.trackChangesAccept,group:"left",attributes:{ariaLabel:"Accept tracked changes"}}),ue=Dn({type:"button",disabled:!1,name:"rejectTrackedChangeOnSelection",tooltip:n.trackChangesReject,command:"rejectTrackedChangeFromToolbar",icon:t.trackChangesReject,group:"left",attributes:{ariaLabel:"Reject tracked changes"}}),Z=Dn({type:"button",name:"clearFormatting",command:"clearFormat",tooltip:n.clearFormatting,icon:t.clearFormatting,attributes:{ariaLabel:"Clear formatting"}}),G=Dn({type:"button",name:"copyFormat",tooltip:n.copyFormat,icon:t.copyFormat,command:"copyFormat",active:!1,attributes:{ariaLabel:"Copy formatting"}}),K=(pt,St)=>pt==="editor"?St:pt==="suggester"?St.filter(Gt=>Gt.value==="suggesting"):St.filter(Gt=>Gt.value==="viewing"),re=pt=>pt==="editor"?"Editing":pt==="suggester"?"Suggesting":"Viewing",ge=Dn({type:"dropdown",name:"documentMode",command:"setDocumentMode",allowWithoutEditor:!0,icon:t.documentMode,defaultLabel:re(s),label:re(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:()=>ce(ge)}]}),X=[{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 ce(pt){return to(zq,{options:K(s,X),onSelect:St=>{const Gt=e.superdoc?.activeEditor??e.activeEditor;ts(pt);const{label:jt,icon:pn,value:vn}=St;ge.label.value=jt,ge.icon.value=pn,e.emitCommand({item:ge,argument:vn}),wc(e,Gt)}})}const Ae=new Map([["separator",20],["zoom",71],["measurementUnit",52],["fontFamily",118],["fontSize",57],["textAlign",40],["linkedStyles",142],["documentMode",47],["default",32]]),ke=["search","ruler","undo","overflow","documentMode"],De=Dn({type:"button",name:"ruler",command:"toggleRuler",allowWithoutEditor:!0,icon:t.ruler,active:!1,tooltip:n.ruler,attributes:{ariaLabel:"Ruler"}}),ft=Dn({type:"button",name:"formattingMarks",command:"toggleFormattingMarks",allowWithoutEditor:!0,icon:t.formattingMarks,active:!1,tooltip:n.formattingMarks,attributes:{ariaLabel:"Formatting marks"}}),xe=Dn({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 pt=jt=>{ts(xe);const pn=typeof jt=="string"?jt:jt?.id??null;if(!pn)return;const vn={...xe,command:"setLinkedStyle"};e.emitCommand({item:vn,argument:pn})},St=jt=>{ts(xe);const pn=typeof jt=="string"?jt:jt?.id??null;pn&&e.updateLinkedStyleToMatchSelection?.(pn)},Gt=e.getActiveLinkedStyleId?.()??null;return to("div",{},[to(Gq,{styles:e.getLinkedStyleOptions?.()??[],onSelect:pt,onUpdate:St,updateLabel:n.updateLinkedStyle,selectedOption:Gt})])}}],onActivate:({styleId:pt,styleName:St})=>{const Gt=St||pt;xe.label.value=pt&&pt!=="Normal"?String(Gt):n.formatText,xe.disabled.value=!1},onDeactivate:()=>{xe.disabled.value=!0,xe.label.value=n.formatText}}),qe=(pt,St)=>{if(St.value==pt)return to("div",{innerHTML:YK,class:"dropdown-select-icon"})},Bt=Dn({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(pt=>({label:pt.toFixed(2),key:pt,icon:()=>qe(pt,Bt.selectedValue),props:{"data-item":"btn-lineHeight-option"}}))}),bt=20,tt=32,Dt=["linkedStyles","clearFormatting","copyFormat","formattingMarks"],tn=["zoom","fontFamily","fontSize","redo"],Mn=i<=Wh.lg,ln=e.config?.showFormattingMarksButton===!0,qn=e.config?.showTableOfContentsButton===!0;Mn&&(ge.attributes.value={...ge.attributes.value,className:`${ge.attributes.value.className} sd-toolbar-item--doc-mode-compact`}),Mn&&(xe.attributes.value={...xe.attributes.value,className:`${xe.attributes.value.className} sd-toolbar-item--linked-styles-compact`});let Kt=[L,A,ee,ue,F,Re,g,k(),I,k(),p,C,R,P,$,M,k(),D,B,...qn?[T]:[],...e.config?.showWatermarkButton||l?.has("watermark")?[te]:[],...e.config?.showPageNumberButton||l?.has("pageNumber")?[U]:[],J,de,k(),Ee,rt,ut,ht,Rt,Bt,k(),xe,k(),De,le,...ln?[ft]:[],G,Z,...JK(e)?[y]:[],Pe,ge,...h];if(i<=Wh.md&&o&&(Kt=Kt.filter(pt=>pt.type!=="separator")),e.config.mode!=="docx"){const pt=Kt.findIndex(Gt=>Gt.name.value==="linkedStyles");Kt.splice(pt-1,2);const St=["ruler","zoom","undo","redo"];Kt=Kt.filter(Gt=>!St.includes(Gt.name.value))}const Fn=[];a||(s==="viewer"&&Fn.push(ee,ue),Kt=Kt.filter(pt=>!Fn.includes(pt))),l&&(Kt=Kt.filter(pt=>pt.name.value==="overflow"||pt.isCustomToolbarItem||l.has(pt.name.value))),d?.size&&(Kt=Kt.filter(pt=>!d.has(pt.name.value))),Kt=ZK(Kt);const Jn=pt=>ke.includes(pt.name.value),Nn=Kt.find(pt=>pt.name.value==="overflow"),Sr=Kt.filter(pt=>pt!==Nn);if(u){const pt=new Map(u.map((Gt,jt)=>[Gt,jt])),St=Gt=>pt.get(Gt.name.value)??Number.MAX_SAFE_INTEGER;Sr.sort((Gt,jt)=>St(Gt)-St(jt))}const Kn=pt=>{const St=[],Gt=[],jt=Sr.filter(Jn).reduce((vn,mn)=>vn+v2(mn,Ae),0);let pn=tt+jt+(pt&&Nn?v2(Nn,Ae):0);return Sr.forEach((vn,mn)=>{const er=v2(vn,Ae);if(vn.type==="separator"&&Sr[mn-1]?.name.value==="linkedStyles"&&St.includes(Sr[mn-1])){St.push(vn);return}if(i<Wh.xl+bt&&Dt.includes(vn.name.value)&&o){St.push(vn);return}if(i<Wh.sm&&tn.includes(vn.name.value)&&o){St.push(vn);return}if(Jn(vn)){Gt.push(vn);return}pn+er<=i||!o?(Gt.push(vn),pn+=er):St.push(vn)}),{visibleItems:Gt,overflowItems:St}};let{visibleItems:mr,overflowItems:Vr}=Kn(!1);if(o&&Nn&&Vr.some(pt=>pt.type!=="separator")){({visibleItems:mr,overflowItems:Vr}=Kn(!0));const pt=Kt.indexOf(Nn),St=mr.findIndex(Gt=>Kt.indexOf(Gt)>pt);St===-1?mr.push(Nn):mr.splice(St,0,Nn)}return mr=HT(mr),{defaultItems:mr,overflowItems:Vr.filter(pt=>pt.type!=="separator")}},WT={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",updateLinkedStyle:"Update to match selection"},nY=e=>e?typeof e!="string"?e instanceof HTMLElement?e:null:e.startsWith("#")||e.startsWith(".")?document.querySelector(e):document.getElementById(e):null;Ut();var rY=yq,oY=zT;function w2(e){return(typeof e=="object"||typeof e=="function")&&e!==null&&"then"in e&&typeof e.then=="function"}function qT(e){return typeof e=="function"}function iY(e){return`${((typeof e=="object"||typeof e=="function")&&e!==null&&"message"in e?e.message:void 0)??String(e)}`}function sY(e){return typeof e=="object"&&e!==null&&"addEventListener"in e&&typeof e.addEventListener=="function"&&"removeEventListener"in e&&typeof e.removeEventListener=="function"}function aY(e){return e!==null&&"closest"in e&&typeof e.closest=="function"}function KT(e){return OT(e)??rY[e]??null}function Vg(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?su(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 w2(i)?Promise.resolve(i).then(a=>{s(a),r.onSettled?.()},a=>{r.onError?.(a),r.onSettled?.()}):(s(i),r.onSettled?.()),!0}var lY=["page-numbers-apply","page-number-insert"],cY=new Set(["bold","italic","underline","strike","color","highlight","link","clearFormatting","textAlign","list","numberedlist","indentleft","indentright","lineHeight","linkedStyles"]),uY=new Set(["list","numberedlist"]);function dY(e,t){if(e==="fontFamily"||e==="fontSize"||uY.has(e)&&t?.disabled&&t?.supported!==!1&&t?.reason==null)return!0;if(!cY.has(e))return!1;const n=t?.reason;return n==="range-selection-required"||n==="selection-required"}function YT(e){return!!(aY(e)&&e.closest("[data-editor-ui-surface], .toolbar-dropdown-menu, .sd-toolbar-dropdown-menu, .sd-tooltip-content"))}function fY(e){return["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key)}var hY=new Set([...cW,...Object.keys(Mg),"ai","overflow","tableOfContents"]),pY=class extends Lv.default{#e;#t;#n;#r;constructor(e={}){if(super(),this.config={selector:null,toolbarGroups:["left","center","right"],role:"editor",icons:{...Cr},texts:{...WT},fonts:null,hideButtons:!0,responsiveToContainer:!1,mode:"docx",excludeItems:[],toolbarButtonsExclude:[],groups:null,customButtons:[],showFormattingMarksButton:!1,showTableOfContentsButton:!1,showWatermarkButton:!1,showPageNumberButton:!1},this.toolbarItems=[],this.overflowItems=[],this.#e=null,this.#t=new Map,this.#n=new WeakMap,this.#r=null,this.isDev=!1,this.role="editor",this.superdoc=void 0,this.toolbarContainer=null,this.toolbar=null,this._detachFontsChanged=null,this._linkedStyleOptions=Yr([]),this.onToolbarResize=()=>{this.#h(),this.updateToolbarState()},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={...Cr,...this.config.icons},this.config.texts={...WT,...this.config.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=nY(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.#o(),this.#u(),this.#h(),this.#d(),this._lastFontOptionsSignature=this.#g(),!this.toolbarContainer){this.updateToolbarState();return}this.app=eu(Sq),this.app.directive("click-outside",Pb),this.app.config.globalProperties.$toolbar=this,this.toolbar=this.app.mount(this.toolbarContainer),this.updateToolbarState()}catch(t){try{this.destroy()}catch{}throw t}}#o(){const e=this.superdoc?.ui??null;this.ui=e,e&&(this.snapshot=e.toolbar.getSnapshot(),this._unsubscribeController=e.toolbar.subscribe(()=>{this.snapshot=e.toolbar.getSnapshot(),this.getToolbarItemByName("linkedStyles")?.expand.value&&this.#_(),this.updateToolbarState()}),this._detachFormatPainterModeChange=e.formatPainter.onModeChange(t=>{t==="armed"||t==="persistent"?this.#x():this.#A()}))}#c(){this._unsubscribeController?.(),this._unsubscribeController=null,this._detachFormatPainterModeChange?.(),this._detachFormatPainterModeChange=null,this.#A();for(const e of this._customCommandRegs.values())try{e.unregister?.()}catch{}this._customCommandRegs.clear(),this.ui=null,this.snapshot=null}#d(){if(!this.superdoc||typeof this.superdoc.on!="function"||typeof this.superdoc.off!="function")return;const e=()=>{const t=this.#g();t!==this._lastFontOptionsSignature&&(this._lastFontOptionsSignature=t,this.#s()),this.updateToolbarState()};this.superdoc.on("fonts-changed",e),this._detachFontsChanged=()=>{this.superdoc?.off?.("fonts-changed",e)}}#f(){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}#m(e){return e||gq(this.superdoc?.fonts?.getFontFamilyOptions?.()??[])}#h(){const e=this.getAvailableWidth(),t=new Map(this.#C().filter(w=>w.isCustomToolbarItem&&w.type==="dropdown").map(w=>[w.name.value,w.selectedValue.value])),n=this.config.groups,r=n&&!Array.isArray(n)&&Object.keys(n).length>0?n:null,o=r?new Set(Object.values(r).flatMap(w=>w)):null,i=new Set([...this.config.excludeItems??[],...this.config.toolbarButtonsExclude??[]]),s=this.config.customButtons||[],a=new Set(hY),l=s.map((w,I)=>{try{if(w?.name&&a.has(w.name))throw new Error(`Toolbar item name "${w.name}" is already taken by another item, so this entry is skipped.`);const k=this.#i(w);return t.has(k.name.value)&&(k.selectedValue.value=t.get(k.name.value)),a.add(k.name?.value),k}catch(k){const C=`${w?.name??`<unnamed@${I}>`}::${iY(k)}`;return this._reportedInvalidCustomItems.has(C)||(this._reportedInvalidCustomItems.add(C),this.#p(k,w?.name??null)),null}}).filter(w=>w!==null),u=new Set(r?Object.keys(r):[]),d=r?l.filter(w=>u.has(w.group?.value||"center")):l;let h=null;if(r){const w=Object.values(r).flatMap(k=>k),I=l.filter(k=>u.has(k.group?.value||"center")).map(k=>k.name.value);h=[...new Set([...w,...I])]}const{defaultItems:p,overflowItems:v}=tY({superToolbar:this,toolbarIcons:this.config.icons,toolbarTexts:this.config.texts,toolbarFonts:this.#m(this.config.fonts),hideButtons:this.config.hideButtons,availableWidth:e,role:this.role,isDev:this.isDev,configuredItemNames:o,configuredItemOrder:h,excludedItemNames:i,additionalItems:d});h===null&&(h=[...p.map(w=>w.name.value),...v.map(w=>w.name.value)]);const g=v.filter(w=>h.includes(w.name.value)&&!i.has(w.name.value)),y=g.length?[...h,"overflow"]:h,_=p.filter(w=>y.includes(w.name.value)).filter(w=>!i.has(w.name.value));if(r){const w=new Map(h.map((P,M)=>[P,M])),I=P=>w.get(P.name.value)??Number.MAX_SAFE_INTEGER,k=_.find(P=>P.name.value==="overflow"),C=new Map(_.map((P,M)=>[P,M])),R=_.filter(P=>P!==k);if(R.sort((P,M)=>I(P)-I(M)),k){const P=C.get(k)??-1,M=R.findIndex($=>(C.get($)??-1)>P);M===-1?R.push(k):R.splice(M,0,k)}_.splice(0,_.length,...R),g.sort((P,M)=>I(P)-I(M))}if(r)for(const[w,I]of Object.entries(r))for(const k of _)I.includes(k.name.value)&&(k.group.value=w);this.toolbarItems=_,this.overflowItems=g}#i(e){const t=Dn({...e});t.isCustomToolbarItem=!0;const n=e.command;if(qT(n)&&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 w2(a)?Promise.resolve(a).catch(l=>(this.#p(l,e.name),!1)):a}catch(a){return this.#p(a,e.name),!1}}});this._customCommandRegs.set(r,o)}}return t}#s(){this.#h(),this.emit("toolbar-items-changed")}#g(){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){const t=this.toolbarItems.filter(r=>(r.group?.value||"center")===e),n=this.#t.get(e);return n?.length===t.length&&n.every((r,o)=>r===t[o])?n:(this.#t.size>=32&&this.#t.clear(),this.#t.set(e,t),t)}getToolbarItemByName(e){return this.#C().find(t=>t.name.value===e)}#C(){return[...this.toolbarItems,...this.overflowItems]}getLinkedStyleOptions(){return this.#_(),this._linkedStyleOptions.value}#_(){const e=this.ui?.styles?.getCatalog?.({includePreview:!0}),t=this.ui?.styles?.getCatalog?.({view:"quickGallery",includePreview:!0})?.items??this.ui?.styles?.getQuickGallery?.()??[],n=this.ui?.styles?.getActiveParagraphStyle?.()?.styleId,r=n&&!t.some(s=>s.id===n)?e?.styles?.find(s=>s.id===n&&(s.type==="paragraph"||s.type==="linked")):null,o=r?[r,...t]:t,i=this._linkedStyleOptions.value;(o.length!==i.length||o.some((s,a)=>s!==i[a]))&&(this._linkedStyleOptions.value=o)}getActiveLinkedStyleId(){return this.ui?.styles?.getActiveParagraphStyle?.()?.styleId??null}async updateLinkedStyleToMatchSelection(e){if(!e||typeof this.ui?.styles?.updateToMatchSelection!="function")return null;try{return await this.ui.styles.updateToMatchSelection({styleId:e})}catch(t){return this.#p(t,"linkedStyles"),null}finally{this.updateToolbarState()}}setActiveEditor(e){this.activeEditor=e;const t=this.#g();t!==this._lastFontOptionsSignature&&(this._lastFontOptionsSignature=t,this.#s()),this.ui&&(this.snapshot=this.ui.toolbar.getSnapshot()),this.updateToolbarState()}#v(e){return e==="ruler"?!!this.superdoc?.config?.rulers:e==="formattingMarks"?!!this.superdoc?.config?.layoutEngineOptions?.showFormattingMarks:!1}#y(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}#I(){const e=this.getToolbarItemByName("documentMode");if(!e)return;const t=this.snapshot?.commands?.["document-mode"]?.value,n=String(t||"editing").toLowerCase(),r=this.config.texts||{},o=this.config.icons||{},i={label:r.documentEditingMode||"Editing",icon:o.documentEditingMode||o.documentMode},s={editing:i,suggesting:{label:r.documentSuggestingMode||"Suggesting",icon:o.documentSuggestingMode||o.documentMode},viewing:{label:r.documentViewingMode||"Viewing",icon:o.documentViewingMode||o.documentMode}}[n]||i;e.label?.value!==void 0&&(e.label.value=s.label),e.defaultLabel?.value!==void 0&&(e.defaultLabel.value=s.label),e.icon?.value!==void 0&&s.icon&&(e.icon.value=s.icon)}#R(){const e=this.toolbarItems.find(n=>n.name.value==="highlight");if(!e)return;let t=this.#n.get(e);t||(t=[{key:"color",type:"render",render:()=>m2(this,e,[],!0)}],this.#n.set(e,t)),e.nestedOptions.value=t}#T(e){return!!e?.active&&e?.value==null}#O(e){return!!e&&e?.disabled===!1&&e?.value==null}#E(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=bq.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=lY.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(h2(t)?.disposition==="host-routed")return e.setDisabled(!this.#y(t)),this.#v(t)?e.activate():e.deactivate(),!0;const n=KT(t);if(!n)return!1;const r=this.snapshot?.commands?.[n];dY(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.#I()},link:()=>{e.active.value=!!r?.active;const i=r?.value??null;(i?e.attributes.value?.href!==i:Object.prototype.hasOwnProperty.call(e.attributes.value??{},"href"))&&(e.attributes.value=y2(e.attributes.value,i))},fontFamily:()=>{if(r?.value!=null){e.activate({fontFamily:r.value});return}if(this.#O(r)){e.activate({},!0);return}e.deactivate()},fontSize:()=>{if(r?.value!=null){e.activate({fontSize:r.value});return}if(this.#T(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=="object"&&i!==null?i:null,a=typeof i=="string"?i:s&&"styleId"in s?s.styleId:void 0,l=s?"styleName"in s?s.styleName:void 0:null;a?e.activate({styleId:a,styleName:l}):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.#I(),this.#R();const e=this.snapshot?.commands?.["document-mode"]?.value||"editing";!(this.snapshot&&(this.superdoc?.activeEditor??this.activeEditor))||e==="viewing"?(this.#P(),this.#C().forEach(n=>{const r=n.isCustomToolbarItem&&typeof n.command=="string";(n.allowWithoutEditor?.value||r)&&this.#E(n)})):this.#C().forEach(n=>{this.#E(n)||n.resetDisabled()}),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")}#P(){this.#C().forEach(e=>{const{allowWithoutEditor:t}=e;t?.value||e.setDisabled(!0)})}#D(e,t){const n=this.superdoc;if(e==="watermark"){if(!this.#y(e)||!this.ui)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}#b(e,t){const n=e?.name?.value;if(!n)return!1;const r={firstParty:!0,onSettled:()=>this.updateToolbarState(),onError:i=>this.#p(i,n)};if(n==="image"&&t==null)return this.#k();if(n==="tableActions"){const i=typeof t=="object"&&t!==null&&"command"in t?t.command:void 0,s=typeof i=="string"?oY[i]:void 0;return s?Vg(this.ui,s,void 0,r):!1}if(h2(n)?.disposition==="unsupported")return!0;const o=KT(n);return o?Vg(this.ui,o,t,r):!1}#k(){return this.snapshot?.commands?.image?.disabled||(this.#e||(this.#e=HD({ownerDocument:this.toolbarContainer?.ownerDocument??document,onPick:async e=>{const t=await jD(e,this.superdoc?.config?.handleImageUpload);Vg(this.ui,"image",{src:t},{firstParty:!0,onSettled:()=>this.updateToolbarState(),onError:n=>this.#p(n,"image")})},onError:e=>this.#p(e,"image")})),this.#e.open()),!0}#x(){if(this.#r)return;const e=this.superdoc?.activeEditor?.container,t=sY(e)?e:document,n=s=>{YT(s.target)||this.ui?.formatPainter.setPointerSelecting(!0)},r=s=>{this.ui?.formatPainter.setPointerSelecting(!1),!YT(s.target)&&this.ui?.formatPainter.notifyPointerUp()},o=s=>{if(s.key==="Escape"){this.ui?.formatPainter.cancel();return}fY(s)&&this.ui?.formatPainter.setKeyboardSelecting(!0)},i=()=>{this.ui?.formatPainter.setKeyboardSelecting(!1),this.ui?.formatPainter.notifyKeyUp()};t.addEventListener("pointerdown",n),t.addEventListener("pointerup",r),t.addEventListener("keydown",o),t.addEventListener("keyup",i),this.#r=()=>{t.removeEventListener("pointerdown",n),t.removeEventListener("pointerup",r),t.removeEventListener("keydown",o),t.removeEventListener("keyup",i)}}#A(){this.#r&&(this.#r(),this.#r=null)}#p(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(h2(r)?.disposition==="host-routed"){this.#D(r,t),this.updateToolbarState();return}if(qT(o)){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});w2(a)&&Promise.resolve(a).catch(l=>this.#p(l,r))}this.updateToolbarState();return}if(e?.isCustomToolbarItem&&typeof o=="string"){if(!Vg(this.ui,o,t,{onSettled:()=>this.updateToolbarState(),onError:s=>this.#p(s,r),reportUnhandled:!0}))throw new Error(`[superdoc toolbar] Command not handled: ${String(o)}`);this.updateToolbarState();return}if(!this.#b(e,t)&&o)throw new Error(`[superdoc toolbar] Command not handled: ${String(o)}`);this.updateToolbarState()}catch(s){this.#p(s,r)}}}destroy(){this.#A(),this.#e?.destroy(),this.#e=null,this.#f(),this.#c(),this.app?.unmount(),this.app=null,this.toolbar=null}};function mY(e){return new pY(e)}Ut();var gY=['[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(", "),vY=800,XT=typeof Blob=="function"?Object.getOwnPropertyDescriptor(Blob.prototype,"size")?.get:void 0,ZT=e=>{if(!XT)return!1;try{return XT.call(e),!0}catch{return!1}};function yY(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 bY=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"]),wY=["original","markup","final"],CY=["review","original","final","off"];function QT(e){return wY.includes(e)}function kY(e){return e==="markup"?"review":e}function JT(e){return CY.includes(e)}function SY(e){const t=e.modules?.trackChanges?.mode;if(JT(t))return t;const n=e.layoutEngineOptions?.trackedChanges?.mode;return JT(n)?n:null}function Ug(e,t){const n=e.viewing,r=QT(n?.trackedChanges)?n.trackedChanges:null,o=r?kY(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 _Y(e,t){const n=new F8.default;return e.forEach((r,o)=>{n.file(t[o],r)}),n.generateAsync({type:"blob",compression:"DEFLATE"})}function AY(e,t){const n=e.composedPath();if(!n.includes(t))return null;const r=n.find(a=>a instanceof HTMLElement&&a.matches(gY));if(!r)return null;const o=n.some(a=>a instanceof HTMLElement&&a.classList.contains(hm.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 IY(e){if(!e||typeof e!="object")return[];const t=e.items;return Array.isArray(t)?t:[]}function ex(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 tx(e){const t=e.selectionTarget??e.target;if(!t)return null;try{return JSON.stringify(t)}catch{return null}}function EY(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 di(e){return!!(e&&typeof e=="object"&&e.editorVersion===2)}function nx(e){return typeof e=="string"&&e.length>0?e:null}function rx(e){return e?di(e)?nx(e.documentId??e.options?.documentId??null):nx(typeof e.getDocumentId=="function"?e.getDocumentId():e.options?.documentId):null}function TY(e){if(!e||di(e))return null;const t=e;return t.documentRenderer??t.presentationEditor??null}function Vs(e){if(!e)return null;if(di(e))return e.fonts??null;const t=TY(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 qh=class extends Lv.default{static{this.allowedTypes=[Nr,rl]}#e;#t;#n;#r;#o;#c;#d;#f;#u;#m;#h;#i;#s;#g;#C;#_;#v;#y;#I;#R;#T;#O;#E;#P;#D;#b;#k;get uiConfig(){return this.#k}#x;get interactionConfig(){return this.#x}#A;get surfacesConfig(){return this.#A}#p;#F;#w;#l;#M;#N;#L;constructor(e){if(super(),this.#e=!1,this.#n=!1,this.#r=null,this.#o=null,this.#c=null,this.#d=null,this.#f=null,this.#u=null,this.#m=!1,this.#h=null,this.#i=null,this.#s=null,this.#g=null,this.#C=!1,this.#_=!1,this.#v=null,this.#y=null,this.#I=!1,this.#R=null,this.#T=null,this.#O=n=>{this.listenerCount("content-control:active-change")>0&&(this.#I||(this.#R=n.pointerId),this.#I=!0,this.#v="pointer",this.#y=null)},this.#E=n=>{n.pointerId===this.#R&&(this.#I=!1,this.#R=null,this.#v??="pointer",this.#v==="pointer"&&(this.#y=Date.now()+vY))},this.#P=n=>{this.listenerCount("content-control:active-change")>0&&!yY(n)&&(this.#v="keyboard",this.#y=null)},this.#D=n=>{this.#K(n)},this.#b=null,this.#k=TT({}),this.#x=xT({}),this.#A=RT({}),this.version="0.0.0",this.users=[],this.whiteboard=null,this.colors=[],this.readyEditors=0,this.#F=!1,this.#w=[],this.#l=new aW,this.#M=null,this.#N=!1,this.#L=null,this.config={selector:"#superdoc",documentMode:"editing",allowSelectionInViewMode:!1,role:"editor",documents:[],editorExtensions:[],colors:[],users:[],user:{...u2},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.#J=new WeakSet,this.#ee=new WeakMap,this.#te=null,this.#W=null,this.#U=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.#t=_5(this,e,()=>this.version,t),this.#p=new TG({getModuleConfig:()=>this.#A}),this.#s=t,t.addEventListener("pointerdown",this.#O,!0),t.ownerDocument.addEventListener("pointerup",this.#E,!0),t.ownerDocument.addEventListener("pointercancel",this.#E,!0),t.addEventListener("keydown",this.#P,!0),t.addEventListener("click",this.#D,!0),this.#a("content-control:active-change",e.onContentControlActiveChange),this.#Y(e,t),this.#_=!0,this.listenerCount("content-control:active-change")>0&&this.ui}async#K(e){const t=this.#s;if(!t)return;const n=AY(e,t),r=this.activeEditor?.doc?.contentControls?.list;if(!(!n||typeof r!="function"))try{const o=await r();if(this.#e)return;const i=ex(IY(o).find(s=>s.id===n));i&&this.emit("content-control:click",{target:i,source:"pointer"})}catch{return}}async#Y(e,t){this.#L=SY(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),c2(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.#je(),this.config.user=zG(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=m4(this.config.modules.comments),this.#k=TT(this.config),this.#x=xT(this.config),this.#A=RT(this.config),this.config.disableContextMenu=!this.#k.contextMenu.enabled,this.config.rulers=this.#k.ruler.enabled,this.#k.comments.enabled?this.config.modules.comments===!1&&(this.config.modules.comments={}):this.config.modules.comments=!1,this.#k.comments.enabled){this.config.modules.comments===!0&&(this.config.modules.comments={});const i=this.config.modules.comments;i&&(i.readOnly=this.#x.comments.readOnly,i.allowResolve=this.#x.comments.allowResolve)}if(this.userColorMap=new Map,this.colorIndex=0,this.version="2.28.0-next.14",this.#ne("π¦ [superdoc] Using SuperDoc version:",this.version),this.superdocId=e.superdocId||Ua(),this.colors=this.config.colors??[],this.#Ee(),this.#ye(),await ZM(),this.#e)return;if(await this.#Ce(this.config.modules),this.#e){this.#ve();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.#M||(this.#M=this.#l.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.#i=o,this.#we(),this.#Z(),this.#Ge(),this.#X()}#X(){if(this.#F=!1,this.#w=[],this.#be(),this.readyEditors=0,!this.app)throw new Error("SuperDoc: #startRuntime called before #initVueApp populated this.app");this.app.mount(this.#i)}#Z(){const e=this.config.modules?.whiteboard,t=e!==!1&&(e?.enabled??!1);this.whiteboard=new e$({Renderer:AG,enabled:t}),this.emit("whiteboard:init",{whiteboard:this.whiteboard})}get requiredNumberOfEditors(){return this.#S("requiredNumberOfEditors").documents.filter(e=>e.type===Nr).length}get ui(){return this.#b||(this.#b=sB({superdoc:this}),this.#e&&this.#b.destroy()),this.#Q(),this.#b}getDocumentApi(){return this.activeEditor?.doc??null}get diagnostics(){return this.#t}emit(e,...t){return(e==="exception"||e==="document-replaced"||e==="ready"||e==="active-editor-change"||e==="collaboration-ready"||e==="collaboration-connection-change"||e==="locked")&&df(this,e,()=>t[0]),super.emit(e,...t)}on(e,t,n){return super.on(e,t,n),e==="content-control:active-change"&&this.#_&&this.ui,this}addListener(e,t,n){return super.addListener(e,t,n),e==="content-control:active-change"&&this.#_&&this.ui,this}once(e,t,n){return super.once(e,t,n),e==="content-control:active-change"&&this.#_&&this.ui,this}removeListener(e,t,n,r){return super.removeListener(e,t,n,r),this.#z(),this}off(e,t,n,r){return super.off(e,t,n,r),this.#z(),this}removeAllListeners(e){return super.removeAllListeners(e),this.#z(),this}#z(){this.listenerCount("content-control:active-change")>0||(this.#g?.(),this.#g=null,this.#T=null,this.#v=null,this.#y=null,this.#I=!1,this.#R=null)}#Q(){if(this.#g||this.#C||!this.#b||this.#e||this.listenerCount("content-control:active-change")===0)return;let e=null,t=[],n=null,r=null,o=!0;this.#C=!0;try{n=this.#b.selection.observe(s=>{if(o){o=!1;return}if(s.status!=="ready")return;const a=tx(s);if(!a)return;this.#v==="pointer"&&this.#y!==null&&Date.now()>this.#y&&(this.#v=null,this.#y=null);const l=this.#v??(this.#I?"pointer":null),u=this.activeEditor;(l||this.#T?.editor!==u||this.#T.key!==a)&&(this.#T={editor:u,key:a,source:l??"keyboard"}),this.#v=null,this.#y=null}),r=this.#b.contentControls.observeActivePath(s=>{const a=this.activeEditor,l=s.activeIds.map(y=>ex(s.items.find(_=>_.id===y)));if(l.some(y=>y===null))return;const u=l,d=a===e,h=u.length===t.length&&u.every((y,_)=>y.id===t[_]?.id);if(d&&h)return;if(u.length===0&&t.length===0){e=a;return}const p=d?t[0]??null:null;e=a,t=u;const v=tx(this.#b.selection.getSnapshot()),g=this.#T;this.emit("content-control:active-change",{active:u[0]??null,previous:p,activePath:u,source:v&&g?.editor===a&&g.key===v?g.source:"keyboard"})});const i=()=>{n?.(),r?.()};this.#e||this.listenerCount("content-control:active-change")===0?i():this.#g=i}catch(i){throw n?.(),r?.(),i}finally{this.#C=!1}}get state(){return{documents:this.#S("state").documents.map(e=>ec(e.data)?{...e,data:jb(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}#ye(){const e=this.config.document,t=!!e&&typeof e=="object"&&(ec(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=Hb(e);this.config.documents=[{id:Ua(),...o}]}else n&&(this.config.documents=[{id:Ua(),type:Nr,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=Hb(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||Ua()}}))}#be(){const{app:e,pinia:t,superdocStore:n,commentsStore:r,highContrastModeStore:o}=Uj({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.#p),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&&FM(this),this.#ie()}#a(e,t){t&&this.on(e,t)}#we(){this.#a("editorBeforeCreate",this.config.onEditorBeforeCreate),this.#a("editorCreate",this.config.onEditorCreate),this.#a("editorDestroy",this.config.onEditorDestroy),this.#a("source:complete",this.config.onSourceComplete),this.#a("source:signals-complete",this.config.onSourceSignalsComplete),this.#a("ready",this.config.onReady),this.#a("comments-update",this.config.onCommentsUpdate),this.#a("content-control:click",this.config.onContentControlClick),this.#a("awareness-update",this.config.onAwarenessUpdate),this.#a("locked",this.config.onLocked),this.#a("pdf:document-ready",this.config.onPdfDocumentReady),this.#a("sidebar-toggle",this.config.onSidebarToggle),this.#a("collaboration-ready",this.config.onCollaborationReady),this.#a("collaboration-connection-change",this.config.onCollaborationConnectionChange),this.on("collaboration-ready",e=>this.#ke(e?.editor??null)),this.#a("editor-update",this.config.onEditorUpdate),this.#a("tracked-changes:bulk-decision",this.config.onTrackedChangesBulkDecision),this.on("content-error",this.onContentError),this.#a("exception",this.config.onException),this.#a("list-definitions-change",this.config.onListDefinitionsChange),this.#a("pagination-update",this.config.onPaginationUpdate),this.#a("fonts-resolved",this.config.onFontsResolved),this.#a("fonts-changed",this.config.onFontsChanged),this.#a("zoomChange",this.config.onZoomChange),this.#a("viewport-change",this.config.onViewportChange),this.#a("page-margins-change",this.config.onPageMarginsChange)}async#Ce({collaboration:e}={}){return e?(this.isCollaborative=!1,this.config.documents.length===0&&(this.config.documents=[{id:Ua(),type:Nr,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}#se(){if(this.#c){try{this.#c()}catch{}this.#c=null}if(this.#d){try{this.#d()}catch{}this.#d=null}if(this.#f){try{this.#f()}catch{}this.#f=null}}#ke(e){this.#se(),di(e)&&(this.#_e(e),this.#Ae(e),this.#Se(e))}#Se(e){const t=e.connection;if(!t||typeof t.subscribe!="function")return;const{documentId:n}=t;this.#u?.documentId!==n&&(this.#u=null,this.#m=!1);const r=o=>{if(this.#e)return;const i=this.#u;if(i&&i.state===o.state&&i.detail===(o.detail??null))return;const s={documentId:n,state:o.state,previousState:i?.state??null,kind:EY(o,this.#m),detail:o.detail??null,superdoc:this};this.#u=s,o.state==="synced"&&(this.#m=!0),this.emit("collaboration-connection-change",s)};try{const o=t.getSnapshot?.();o&&r(o),this.#f=t.subscribe(r)}catch(o){console.warn("[SuperDoc] v2 connection bridge failed to subscribe",o)}}getCollaborationConnectionState(){return this.#u}#_e(e){const t=e.presence;if(!t||typeof t.subscribe!="function")return;const n=Xj(()=>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.#c=t.subscribe(r)}catch(o){console.warn("[SuperDoc] v2 awareness bridge failed to subscribe",o)}}#Ae(e){const t=e.lock;if(!t||typeof t.subscribe!="function")return;const n=r=>{this.#e||this.#j(!!r.isLocked,this.#ae(r.lockedBy??null))};try{if(this.#h&&typeof t.setLocked=="function"){const o=this.#h;t.setLocked(o.isLocked,o.isLocked?o.lockedBy:null),this.#h=null}const r=t.getSnapshot?.();r&&n(r),this.#d=t.subscribe(n)}catch(r){console.warn("[SuperDoc] v2 lock bridge failed to subscribe",r)}}#ae(e){return!e||typeof e!="object"||Array.isArray(e)?null:{...e}}#Ie(e,t){return JSON.stringify(e??null)===JSON.stringify(t??null)}#j(e,t){this.isLocked===e&&this.#Ie(this.lockedBy,t)||(this.isLocked=e,this.lockedBy=t,this.#ne("π¦ [superdoc] Locking superdoc:",e,t,`
|
|
107
|
+
`;Ut();var ts=e=>{e.expand.value=!1},v2=(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")},XK=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},HT=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 XK(r))n.add(o);return e.filter(r=>n.has(r))},ZK=e=>{const t=e.find(o=>o.type==="overflow"),n=e.filter(o=>o!==t),r=new Set(HT(n));return e.filter(o=>o===t||r.has(o))};function y2(e,t){const n={...e};return t?n.href=t:delete n.href,n}function GT(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 QK(e){return typeof e?.quotedText=="string"?e.quotedText:typeof e?.text=="string"?e.text:""}function b2(e){return e.ui?.selection?.get?.()??e.ui?.selection?.current?.()??null}function JK(e){return!!(e.config?.superdoc?.config?.modules?.ai||e.superdoc?.config?.modules?.ai)}function eY(e){return e.config?.superdoc?.config?.modules?.ai??e.superdoc?.config?.modules?.ai??{}}var tY=({superToolbar:e,toolbarIcons:t,toolbarTexts:n,toolbarFonts:r,hideButtons:o,availableWidth:i,role:s,isDev:a=!1,configuredItemNames:l,configuredItemOrder:u,excludedItemNames:d,additionalItems:h=[]}={})=>{const p=Dn({type:"button",name:"bold",command:"toggleBold",icon:t.bold,tooltip:n.bold,attributes:{ariaLabel:"Bold"}}),v=(r??mq).map(_q),g=Dn({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:v,onActivate:({fontFamily:pt}={},St=!1)=>{if(St){g.label.value="",g.selectedValue.value="";return}if(!pt)return;pt=pt.split(",")[0];const Gt=vn=>vn.value??vn.label,jt=v.find(vn=>Gt(vn)===g.defaultLabel.value),pn=v.find(vn=>Gt(vn)===pt);pn?(g.label.value=pn.label,g.selectedValue.value=pn.key):jt?(g.label.value=pt,g.selectedValue.value=jt.key):(g.label.value=pt,g.selectedValue.value="")},onDeactivate:()=>{const pt=v.find(St=>(St.value??St.label)===g.defaultLabel.value);g.label.value=pt?.label??g.defaultLabel.value,g.selectedValue.value=pt?.key??""}}),y=Dn({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:()=>_(y)}]});function _(pt){const St=b2(e),Gt=St?.selectionTarget??GT(St?.target),jt=St?.empty?"":QK(St),pn=eY(e),vn=()=>ts(pt),mn=()=>{const er=e.pendingSelectionCapture;er&&typeof e.ui?.selection?.restore=="function"&&e.ui.selection.restore(er)};return to("div",{},[to(Jq,{handleClose:vn,selectedText:jt,target:Gt,doc:e.superdoc?.activeEditor?.doc??null,apiKey:pn?.apiKey||e.config?.aiApiKey||"",endpoint:pn?.endpoint||e.config?.aiEndpoint||"",restoreSelection:mn})])}const w=vq,I=Dn({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:pt},St=!1)=>{if(St){I.label.value="",I.selectedValue.value="";return}const Gt=w.find(mn=>mn.label===String(I.defaultLabel.value));if(!pt){I.label.value=I.defaultLabel.value,Gt?I.selectedValue.value=Gt.key:I.selectedValue.value="";return}let jt=uW(pt,12);jt<8&&(jt=8),jt>96&&(jt=96);let pn=String(jt);const vn=w.find(mn=>mn.label===pn||mn.key===pn);vn?I.selectedValue.value=vn.key:I.selectedValue.value="",I.label.value=pn},onDeactivate:()=>{I.label.value=I.defaultLabel.value;const pt=w.find(St=>St.label===String(I.defaultLabel.value));pt?I.selectedValue.value=pt.key:I.selectedValue.value=""}}),k=()=>Dn({type:"separator",name:"separator",isNarrow:!0}),C=Dn({type:"button",name:"italic",command:"toggleItalic",icon:t.italic,active:!1,tooltip:n.italic,attributes:{ariaLabel:"Italic"}}),R=Dn({type:"button",name:"underline",command:"toggleUnderline",icon:t.underline,active:!1,tooltip:n.underline,attributes:{ariaLabel:"Underline"}}),P=Dn({type:"button",name:"strike",command:"toggleStrike",icon:t.strikethrough,active:!1,tooltip:n.strikethrough,attributes:{ariaLabel:"Strikethrough"}}),M=Dn({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:()=>m2(e,M,[],!0)}],onActivate:({color:pt})=>{M.iconColor.value=pt||""},onDeactivate:()=>M.iconColor.value=""}),$=Dn({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:()=>m2(e,$)}],onActivate:({color:pt})=>{$.iconColor.value=pt},onDeactivate:()=>$.iconColor.value="#000"}),F=Dn({type:"button",name:"search",allowWithoutEditor:!0,active:!1,icon:t.search,tooltip:n.search,group:"right",attributes:{ariaLabel:"Search"}}),D=Dn({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(D)}],onActivate:({href:pt})=>{D.attributes.value=y2(D.attributes.value,pt)},onDeactivate:()=>{D.attributes.value=y2(D.attributes.value,null),D.expand.value=!1}});function V(pt){const St=e.pendingSelectionCapture,Gt=b2(e),jt=Gt?.quotedText&&JSON.stringify(Gt.selectionTarget??Gt.target)!==JSON.stringify(St?.selectionTarget??St?.target)?Gt:St??Gt,pn=jt?.selectionTarget??GT(jt?.target)??jt?.target,vn=()=>{jt===St&&typeof e.ui?.selection?.restore=="function"&&e.ui.selection.restore(St)};return to("div",{},[to(hI,{ui:e.ui,linkItem:pt,textTarget:pn,selectedText:jt?.quotedText??null,restoreSelection:vn,closePopover:()=>{ts(pt),wc(e)},goToAnchor:()=>{ts(pt);const mn=pt.attributes.value?.href;if(!mn)return;const er=mn.slice(1),_i=(e.ui?.viewport?.getHost?.()??null)?.querySelector?.(`a[name='${er}']`);_i&&pI(_i)}})])}const x=Dn({type:"options",name:"linkInput",command:"toggleLink",active:!1});D.childItem=x,x.parentItem=D;const B=Dn({type:"button",name:"image",command:"startImageUpload",icon:t.image,active:!1,tooltip:n.image,disabled:!1,attributes:{ariaLabel:"Image"}}),T=Dn({type:"button",name:"tableOfContents",command:"insertTableOfContents",icon:t.tableOfContents,active:!1,tooltip:n.tableOfContents,disabled:!1,attributes:{ariaLabel:"Table of contents"}}),te=Dn({type:"button",name:"watermark",icon:t.watermark,tooltip:n.watermark,allowWithoutEditor:!0,disabled:!0,attributes:{ariaLabel:n.watermark}}),U=Dn({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:()=>Y(U)}]});let W=null;function Y(pt){const St=e.ui,Gt=mn=>St?.commands?.get?.(mn)?.getState?.()??null,jt=()=>{ts(pt),Pe.expand.value&&ts(Pe),wc(e)},pn=b2(e),vn=pn?.selectionTarget?.story??pn?.selectionTarget?.start?.story??pn?.target?.story??null;return to(qK,{pageNumbersState:Gt("page-numbers-apply"),atCursorState:Gt("page-number-insert"),inHeaderFooter:vn?.storyType==="headerFooterPart"||vn?.storyType==="headerFooterSlot",suggesting:St?.document?.getSnapshot?.()?.mode==="suggesting",initialChoice:W,loadCurrent:()=>St?gN(St):Promise.resolve(null),applyPageNumbers:mn=>su(St,"page-numbers-apply",mn),removePageNumbers:()=>su(St,"page-numbers-remove"),insertAtCursor:()=>su(St,"page-number-insert"),close:mn=>{jt();const er=St?.viewport?.getHost?.();if(mn?.action==="apply")W=mn.choice,$T(er,mn.choice.position==="top"?"header":"footer");else if(mn?.action==="remove")for(const _i of new Set(mn.kinds))$T(er,_i)}})}const J=Dn({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:()=>Oe(J)}]});function Oe(pt){return to("div",{},[to(mK,{onSelect:Gt=>{e.emitCommand({item:pt,argument:Gt}),ts(pt),wc(e)}})])}const de=Dn({type:"dropdown",name:"tableActions",command:"executeTableCommand",tooltip:n.tableActions,icon:t.tableActions,hideLabel:!0,disabled:!0,attributes:{ariaLabel:"Table actions"},options:[{type:"render",render:()=>pe(de)}]}),oe=[{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 pe(pt){return to(kK,{options:oe,onSelect:St=>{ts(pt);const{command:Gt}=St;e.emitCommand({item:pt,argument:{command:Gt}}),wc(e)}})}const Ee=Dn({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:()=>to("div",{},[to(Eq,{onSelect:St=>{ts(Ee);const Gt={...Ee,command:"setTextAlign"};Gt.command="setTextAlign",e.emitCommand({item:Gt,argument:St}),Ve(Ee,St),wc(e)}})]),key:"alignment"}],onActivate:({textAlign:pt})=>{Ve(Ee,pt)},onDeactivate:()=>{Ve(Ee,"left")}}),Ve=(pt,St)=>{let Gt=St==="both"?"justify":St,jt={left:t.alignLeft,right:t.alignRight,center:t.alignCenter,justify:t.alignJustify},pn=jt[Gt]??jt.left;pt.icon.value=pn},rt=Dn({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 pt=St=>{ts(rt);const Gt={...rt,command:"toggleBulletListStyle"};e.emitCommand({item:Gt,argument:St})};return to(VT,{buttons:Rq,iconSize:25,selectedStyle:rt.selectedValue.value,onSelect:pt})}}]}),ut=Dn({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 pt=St=>{ts(ut);const Gt={...ut,command:"toggleOrderedListStyle"};e.emitCommand({item:Gt,argument:St})};return to(VT,{buttons:Lq,iconSize:30,selectedStyle:ut.selectedValue.value,onSelect:pt})}}]}),ht=Dn({type:"button",name:"indentleft",command:"decreaseTextIndent",icon:t.indentLeft,active:!1,tooltip:n.indentLeft,disabled:!1,attributes:{ariaLabel:"Left indent"}}),Rt=Dn({type:"button",name:"indentright",command:"increaseTextIndent",icon:t.indentRight,active:!1,tooltip:n.indentRight,disabled:!1,attributes:{ariaLabel:"Right indent"}}),Pe=Dn({type:"overflow",name:"overflow",command:null,icon:t.overflow,active:!1,disabled:!1,attributes:{ariaLabel:"Overflow items"}}),Re=Dn({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:pt})=>{pt&&(Re.label.value=pt)}}),le=Dn({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:pt})=>{pt&&(le.label.value=pt)}}),L=Dn({type:"button",name:"undo",disabled:!0,tooltip:n.undo,command:"undo",icon:t.undo,group:"left",attributes:{ariaLabel:"Undo"}}),A=Dn({type:"button",disabled:!0,name:"redo",tooltip:n.redo,command:"redo",icon:t.redo,group:"left",attributes:{ariaLabel:"Redo"}}),ee=Dn({type:"button",disabled:!1,name:"acceptTrackedChangeBySelection",tooltip:n.trackChangesAccept,command:"acceptTrackedChangeFromToolbar",icon:t.trackChangesAccept,group:"left",attributes:{ariaLabel:"Accept tracked changes"}}),ue=Dn({type:"button",disabled:!1,name:"rejectTrackedChangeOnSelection",tooltip:n.trackChangesReject,command:"rejectTrackedChangeFromToolbar",icon:t.trackChangesReject,group:"left",attributes:{ariaLabel:"Reject tracked changes"}}),Z=Dn({type:"button",name:"clearFormatting",command:"clearFormat",tooltip:n.clearFormatting,icon:t.clearFormatting,attributes:{ariaLabel:"Clear formatting"}}),G=Dn({type:"button",name:"copyFormat",tooltip:n.copyFormat,icon:t.copyFormat,command:"copyFormat",active:!1,attributes:{ariaLabel:"Copy formatting"}}),K=(pt,St)=>pt==="editor"?St:pt==="suggester"?St.filter(Gt=>Gt.value==="suggesting"):St.filter(Gt=>Gt.value==="viewing"),re=pt=>pt==="editor"?"Editing":pt==="suggester"?"Suggesting":"Viewing",ge=Dn({type:"dropdown",name:"documentMode",command:"setDocumentMode",allowWithoutEditor:!0,icon:t.documentMode,defaultLabel:re(s),label:re(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:()=>ce(ge)}]}),X=[{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 ce(pt){return to(zq,{options:K(s,X),onSelect:St=>{const Gt=e.superdoc?.activeEditor??e.activeEditor;ts(pt);const{label:jt,icon:pn,value:vn}=St;ge.label.value=jt,ge.icon.value=pn,e.emitCommand({item:ge,argument:vn}),wc(e,Gt)}})}const Ae=new Map([["separator",20],["zoom",71],["measurementUnit",52],["fontFamily",118],["fontSize",57],["textAlign",40],["linkedStyles",142],["documentMode",47],["default",32]]),ke=["search","ruler","undo","overflow","documentMode"],De=Dn({type:"button",name:"ruler",command:"toggleRuler",allowWithoutEditor:!0,icon:t.ruler,active:!1,tooltip:n.ruler,attributes:{ariaLabel:"Ruler"}}),ft=Dn({type:"button",name:"formattingMarks",command:"toggleFormattingMarks",allowWithoutEditor:!0,icon:t.formattingMarks,active:!1,tooltip:n.formattingMarks,attributes:{ariaLabel:"Formatting marks"}}),xe=Dn({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 pt=jt=>{ts(xe);const pn=typeof jt=="string"?jt:jt?.id??null;if(!pn)return;const vn={...xe,command:"setLinkedStyle"};e.emitCommand({item:vn,argument:pn})},St=jt=>{ts(xe);const pn=typeof jt=="string"?jt:jt?.id??null;pn&&e.updateLinkedStyleToMatchSelection?.(pn)},Gt=e.getActiveLinkedStyleId?.()??null;return to("div",{},[to(Gq,{styles:e.getLinkedStyleOptions?.()??[],onSelect:pt,onUpdate:St,updateLabel:n.updateLinkedStyle,selectedOption:Gt})])}}],onActivate:({styleId:pt,styleName:St})=>{const Gt=St||pt;xe.label.value=pt&&pt!=="Normal"?String(Gt):n.formatText,xe.disabled.value=!1},onDeactivate:()=>{xe.disabled.value=!0,xe.label.value=n.formatText}}),qe=(pt,St)=>{if(St.value==pt)return to("div",{innerHTML:YK,class:"dropdown-select-icon"})},Bt=Dn({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(pt=>({label:pt.toFixed(2),key:pt,icon:()=>qe(pt,Bt.selectedValue),props:{"data-item":"btn-lineHeight-option"}}))}),bt=20,tt=32,Dt=["linkedStyles","clearFormatting","copyFormat","formattingMarks"],tn=["zoom","fontFamily","fontSize","redo"],Mn=i<=Wh.lg,ln=e.config?.showFormattingMarksButton===!0,qn=e.config?.showTableOfContentsButton===!0;Mn&&(ge.attributes.value={...ge.attributes.value,className:`${ge.attributes.value.className} sd-toolbar-item--doc-mode-compact`}),Mn&&(xe.attributes.value={...xe.attributes.value,className:`${xe.attributes.value.className} sd-toolbar-item--linked-styles-compact`});let Kt=[L,A,ee,ue,F,Re,g,k(),I,k(),p,C,R,P,$,M,k(),D,B,...qn?[T]:[],...e.config?.showWatermarkButton||l?.has("watermark")?[te]:[],...e.config?.showPageNumberButton||l?.has("pageNumber")?[U]:[],J,de,k(),Ee,rt,ut,ht,Rt,Bt,k(),xe,k(),De,le,...ln?[ft]:[],G,Z,...JK(e)?[y]:[],Pe,ge,...h];if(i<=Wh.md&&o&&(Kt=Kt.filter(pt=>pt.type!=="separator")),e.config.mode!=="docx"){const pt=Kt.findIndex(Gt=>Gt.name.value==="linkedStyles");Kt.splice(pt-1,2);const St=["ruler","zoom","undo","redo"];Kt=Kt.filter(Gt=>!St.includes(Gt.name.value))}const Fn=[];a||(s==="viewer"&&Fn.push(ee,ue),Kt=Kt.filter(pt=>!Fn.includes(pt))),l&&(Kt=Kt.filter(pt=>pt.name.value==="overflow"||pt.isCustomToolbarItem||l.has(pt.name.value))),d?.size&&(Kt=Kt.filter(pt=>!d.has(pt.name.value))),Kt=ZK(Kt);const Jn=pt=>ke.includes(pt.name.value),Nn=Kt.find(pt=>pt.name.value==="overflow"),Sr=Kt.filter(pt=>pt!==Nn);if(u){const pt=new Map(u.map((Gt,jt)=>[Gt,jt])),St=Gt=>pt.get(Gt.name.value)??Number.MAX_SAFE_INTEGER;Sr.sort((Gt,jt)=>St(Gt)-St(jt))}const Kn=pt=>{const St=[],Gt=[],jt=Sr.filter(Jn).reduce((vn,mn)=>vn+v2(mn,Ae),0);let pn=tt+jt+(pt&&Nn?v2(Nn,Ae):0);return Sr.forEach((vn,mn)=>{const er=v2(vn,Ae);if(vn.type==="separator"&&Sr[mn-1]?.name.value==="linkedStyles"&&St.includes(Sr[mn-1])){St.push(vn);return}if(i<Wh.xl+bt&&Dt.includes(vn.name.value)&&o){St.push(vn);return}if(i<Wh.sm&&tn.includes(vn.name.value)&&o){St.push(vn);return}if(Jn(vn)){Gt.push(vn);return}pn+er<=i||!o?(Gt.push(vn),pn+=er):St.push(vn)}),{visibleItems:Gt,overflowItems:St}};let{visibleItems:mr,overflowItems:Vr}=Kn(!1);if(o&&Nn&&Vr.some(pt=>pt.type!=="separator")){({visibleItems:mr,overflowItems:Vr}=Kn(!0));const pt=Kt.indexOf(Nn),St=mr.findIndex(Gt=>Kt.indexOf(Gt)>pt);St===-1?mr.push(Nn):mr.splice(St,0,Nn)}return mr=HT(mr),{defaultItems:mr,overflowItems:Vr.filter(pt=>pt.type!=="separator")}},WT={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",updateLinkedStyle:"Update to match selection"},nY=e=>e?typeof e!="string"?e instanceof HTMLElement?e:null:e.startsWith("#")||e.startsWith(".")?document.querySelector(e):document.getElementById(e):null;Ut();var rY=yq,oY=zT;function w2(e){return(typeof e=="object"||typeof e=="function")&&e!==null&&"then"in e&&typeof e.then=="function"}function qT(e){return typeof e=="function"}function iY(e){return`${((typeof e=="object"||typeof e=="function")&&e!==null&&"message"in e?e.message:void 0)??String(e)}`}function sY(e){return typeof e=="object"&&e!==null&&"addEventListener"in e&&typeof e.addEventListener=="function"&&"removeEventListener"in e&&typeof e.removeEventListener=="function"}function aY(e){return e!==null&&"closest"in e&&typeof e.closest=="function"}function KT(e){return OT(e)??rY[e]??null}function Vg(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?su(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 w2(i)?Promise.resolve(i).then(a=>{s(a),r.onSettled?.()},a=>{r.onError?.(a),r.onSettled?.()}):(s(i),r.onSettled?.()),!0}var lY=["page-numbers-apply","page-number-insert"],cY=new Set(["bold","italic","underline","strike","color","highlight","link","clearFormatting","textAlign","list","numberedlist","indentleft","indentright","lineHeight","linkedStyles"]),uY=new Set(["list","numberedlist"]);function dY(e,t){if(e==="fontFamily"||e==="fontSize"||uY.has(e)&&t?.disabled&&t?.supported!==!1&&t?.reason==null)return!0;if(!cY.has(e))return!1;const n=t?.reason;return n==="range-selection-required"||n==="selection-required"}function YT(e){return!!(aY(e)&&e.closest("[data-editor-ui-surface], .toolbar-dropdown-menu, .sd-toolbar-dropdown-menu, .sd-tooltip-content"))}function fY(e){return["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key)}var hY=new Set([...cW,...Object.keys(Mg),"ai","overflow","tableOfContents"]),pY=class extends Lv.default{#e;#t;#n;#r;constructor(e={}){if(super(),this.config={selector:null,toolbarGroups:["left","center","right"],role:"editor",icons:{...Cr},texts:{...WT},fonts:null,hideButtons:!0,responsiveToContainer:!1,mode:"docx",excludeItems:[],toolbarButtonsExclude:[],groups:null,customButtons:[],showFormattingMarksButton:!1,showTableOfContentsButton:!1,showWatermarkButton:!1,showPageNumberButton:!1},this.toolbarItems=[],this.overflowItems=[],this.#e=null,this.#t=new Map,this.#n=new WeakMap,this.#r=null,this.isDev=!1,this.role="editor",this.superdoc=void 0,this.toolbarContainer=null,this.toolbar=null,this._detachFontsChanged=null,this._linkedStyleOptions=Yr([]),this.onToolbarResize=()=>{this.#h(),this.updateToolbarState()},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={...Cr,...this.config.icons},this.config.texts={...WT,...this.config.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=nY(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.#o(),this.#u(),this.#h(),this.#d(),this._lastFontOptionsSignature=this.#g(),!this.toolbarContainer){this.updateToolbarState();return}this.app=eu(Sq),this.app.directive("click-outside",Pb),this.app.config.globalProperties.$toolbar=this,this.toolbar=this.app.mount(this.toolbarContainer),this.updateToolbarState()}catch(t){try{this.destroy()}catch{}throw t}}#o(){const e=this.superdoc?.ui??null;this.ui=e,e&&(this.snapshot=e.toolbar.getSnapshot(),this._unsubscribeController=e.toolbar.subscribe(()=>{this.snapshot=e.toolbar.getSnapshot(),this.getToolbarItemByName("linkedStyles")?.expand.value&&this.#_(),this.updateToolbarState()}),this._detachFormatPainterModeChange=e.formatPainter.onModeChange(t=>{t==="armed"||t==="persistent"?this.#x():this.#A()}))}#c(){this._unsubscribeController?.(),this._unsubscribeController=null,this._detachFormatPainterModeChange?.(),this._detachFormatPainterModeChange=null,this.#A();for(const e of this._customCommandRegs.values())try{e.unregister?.()}catch{}this._customCommandRegs.clear(),this.ui=null,this.snapshot=null}#d(){if(!this.superdoc||typeof this.superdoc.on!="function"||typeof this.superdoc.off!="function")return;const e=()=>{const t=this.#g();t!==this._lastFontOptionsSignature&&(this._lastFontOptionsSignature=t,this.#s()),this.updateToolbarState()};this.superdoc.on("fonts-changed",e),this._detachFontsChanged=()=>{this.superdoc?.off?.("fonts-changed",e)}}#f(){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}#m(e){return e||gq(this.superdoc?.fonts?.getFontFamilyOptions?.()??[])}#h(){const e=this.getAvailableWidth(),t=new Map(this.#C().filter(w=>w.isCustomToolbarItem&&w.type==="dropdown").map(w=>[w.name.value,w.selectedValue.value])),n=this.config.groups,r=n&&!Array.isArray(n)&&Object.keys(n).length>0?n:null,o=r?new Set(Object.values(r).flatMap(w=>w)):null,i=new Set([...this.config.excludeItems??[],...this.config.toolbarButtonsExclude??[]]),s=this.config.customButtons||[],a=new Set(hY),l=s.map((w,I)=>{try{if(w?.name&&a.has(w.name))throw new Error(`Toolbar item name "${w.name}" is already taken by another item, so this entry is skipped.`);const k=this.#i(w);return t.has(k.name.value)&&(k.selectedValue.value=t.get(k.name.value)),a.add(k.name?.value),k}catch(k){const C=`${w?.name??`<unnamed@${I}>`}::${iY(k)}`;return this._reportedInvalidCustomItems.has(C)||(this._reportedInvalidCustomItems.add(C),this.#p(k,w?.name??null)),null}}).filter(w=>w!==null),u=new Set(r?Object.keys(r):[]),d=r?l.filter(w=>u.has(w.group?.value||"center")):l;let h=null;if(r){const w=Object.values(r).flatMap(k=>k),I=l.filter(k=>u.has(k.group?.value||"center")).map(k=>k.name.value);h=[...new Set([...w,...I])]}const{defaultItems:p,overflowItems:v}=tY({superToolbar:this,toolbarIcons:this.config.icons,toolbarTexts:this.config.texts,toolbarFonts:this.#m(this.config.fonts),hideButtons:this.config.hideButtons,availableWidth:e,role:this.role,isDev:this.isDev,configuredItemNames:o,configuredItemOrder:h,excludedItemNames:i,additionalItems:d});h===null&&(h=[...p.map(w=>w.name.value),...v.map(w=>w.name.value)]);const g=v.filter(w=>h.includes(w.name.value)&&!i.has(w.name.value)),y=g.length?[...h,"overflow"]:h,_=p.filter(w=>y.includes(w.name.value)).filter(w=>!i.has(w.name.value));if(r){const w=new Map(h.map((P,M)=>[P,M])),I=P=>w.get(P.name.value)??Number.MAX_SAFE_INTEGER,k=_.find(P=>P.name.value==="overflow"),C=new Map(_.map((P,M)=>[P,M])),R=_.filter(P=>P!==k);if(R.sort((P,M)=>I(P)-I(M)),k){const P=C.get(k)??-1,M=R.findIndex($=>(C.get($)??-1)>P);M===-1?R.push(k):R.splice(M,0,k)}_.splice(0,_.length,...R),g.sort((P,M)=>I(P)-I(M))}if(r)for(const[w,I]of Object.entries(r))for(const k of _)I.includes(k.name.value)&&(k.group.value=w);this.toolbarItems=_,this.overflowItems=g}#i(e){const t=Dn({...e});t.isCustomToolbarItem=!0;const n=e.command;if(qT(n)&&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 w2(a)?Promise.resolve(a).catch(l=>(this.#p(l,e.name),!1)):a}catch(a){return this.#p(a,e.name),!1}}});this._customCommandRegs.set(r,o)}}return t}#s(){this.#h(),this.emit("toolbar-items-changed")}#g(){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){const t=this.toolbarItems.filter(r=>(r.group?.value||"center")===e),n=this.#t.get(e);return n?.length===t.length&&n.every((r,o)=>r===t[o])?n:(this.#t.size>=32&&this.#t.clear(),this.#t.set(e,t),t)}getToolbarItemByName(e){return this.#C().find(t=>t.name.value===e)}#C(){return[...this.toolbarItems,...this.overflowItems]}getLinkedStyleOptions(){return this.#_(),this._linkedStyleOptions.value}#_(){const e=this.ui?.styles?.getCatalog?.({includePreview:!0}),t=this.ui?.styles?.getCatalog?.({view:"quickGallery",includePreview:!0})?.items??this.ui?.styles?.getQuickGallery?.()??[],n=this.ui?.styles?.getActiveParagraphStyle?.()?.styleId,r=n&&!t.some(s=>s.id===n)?e?.styles?.find(s=>s.id===n&&(s.type==="paragraph"||s.type==="linked")):null,o=r?[r,...t]:t,i=this._linkedStyleOptions.value;(o.length!==i.length||o.some((s,a)=>s!==i[a]))&&(this._linkedStyleOptions.value=o)}getActiveLinkedStyleId(){return this.ui?.styles?.getActiveParagraphStyle?.()?.styleId??null}async updateLinkedStyleToMatchSelection(e){if(!e||typeof this.ui?.styles?.updateToMatchSelection!="function")return null;try{return await this.ui.styles.updateToMatchSelection({styleId:e})}catch(t){return this.#p(t,"linkedStyles"),null}finally{this.updateToolbarState()}}setActiveEditor(e){this.activeEditor=e;const t=this.#g();t!==this._lastFontOptionsSignature&&(this._lastFontOptionsSignature=t,this.#s()),this.ui&&(this.snapshot=this.ui.toolbar.getSnapshot()),this.updateToolbarState()}#v(e){return e==="ruler"?!!this.superdoc?.config?.rulers:e==="formattingMarks"?!!this.superdoc?.config?.layoutEngineOptions?.showFormattingMarks:!1}#y(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}#I(){const e=this.getToolbarItemByName("documentMode");if(!e)return;const t=this.snapshot?.commands?.["document-mode"]?.value,n=String(t||"editing").toLowerCase(),r=this.config.texts||{},o=this.config.icons||{},i={label:r.documentEditingMode||"Editing",icon:o.documentEditingMode||o.documentMode},s={editing:i,suggesting:{label:r.documentSuggestingMode||"Suggesting",icon:o.documentSuggestingMode||o.documentMode},viewing:{label:r.documentViewingMode||"Viewing",icon:o.documentViewingMode||o.documentMode}}[n]||i;e.label?.value!==void 0&&(e.label.value=s.label),e.defaultLabel?.value!==void 0&&(e.defaultLabel.value=s.label),e.icon?.value!==void 0&&s.icon&&(e.icon.value=s.icon)}#R(){const e=this.toolbarItems.find(n=>n.name.value==="highlight");if(!e)return;let t=this.#n.get(e);t||(t=[{key:"color",type:"render",render:()=>m2(this,e,[],!0)}],this.#n.set(e,t)),e.nestedOptions.value=t}#T(e){return!!e?.active&&e?.value==null}#O(e){return!!e&&e?.disabled===!1&&e?.value==null}#E(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=bq.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=lY.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(h2(t)?.disposition==="host-routed")return e.setDisabled(!this.#y(t)),this.#v(t)?e.activate():e.deactivate(),!0;const n=KT(t);if(!n)return!1;const r=this.snapshot?.commands?.[n];dY(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.#I()},link:()=>{e.active.value=!!r?.active;const i=r?.value??null;(i?e.attributes.value?.href!==i:Object.prototype.hasOwnProperty.call(e.attributes.value??{},"href"))&&(e.attributes.value=y2(e.attributes.value,i))},fontFamily:()=>{if(r?.value!=null){e.activate({fontFamily:r.value});return}if(this.#O(r)){e.activate({},!0);return}e.deactivate()},fontSize:()=>{if(r?.value!=null){e.activate({fontSize:r.value});return}if(this.#T(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=="object"&&i!==null?i:null,a=typeof i=="string"?i:s&&"styleId"in s?s.styleId:void 0,l=s?"styleName"in s?s.styleName:void 0:null;a?e.activate({styleId:a,styleName:l}):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.#I(),this.#R();const e=this.snapshot?.commands?.["document-mode"]?.value||"editing";!(this.snapshot&&(this.superdoc?.activeEditor??this.activeEditor))||e==="viewing"?(this.#P(),this.#C().forEach(n=>{const r=n.isCustomToolbarItem&&typeof n.command=="string";(n.allowWithoutEditor?.value||r)&&this.#E(n)})):this.#C().forEach(n=>{this.#E(n)||n.resetDisabled()}),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")}#P(){this.#C().forEach(e=>{const{allowWithoutEditor:t}=e;t?.value||e.setDisabled(!0)})}#D(e,t){const n=this.superdoc;if(e==="watermark"){if(!this.#y(e)||!this.ui)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}#b(e,t){const n=e?.name?.value;if(!n)return!1;const r={firstParty:!0,onSettled:()=>this.updateToolbarState(),onError:i=>this.#p(i,n)};if(n==="image"&&t==null)return this.#k();if(n==="tableActions"){const i=typeof t=="object"&&t!==null&&"command"in t?t.command:void 0,s=typeof i=="string"?oY[i]:void 0;return s?Vg(this.ui,s,void 0,r):!1}if(h2(n)?.disposition==="unsupported")return!0;const o=KT(n);return o?Vg(this.ui,o,t,r):!1}#k(){return this.snapshot?.commands?.image?.disabled||(this.#e||(this.#e=HD({ownerDocument:this.toolbarContainer?.ownerDocument??document,onPick:async e=>{const t=await jD(e,this.superdoc?.config?.handleImageUpload);Vg(this.ui,"image",{src:t},{firstParty:!0,onSettled:()=>this.updateToolbarState(),onError:n=>this.#p(n,"image")})},onError:e=>this.#p(e,"image")})),this.#e.open()),!0}#x(){if(this.#r)return;const e=this.superdoc?.activeEditor?.container,t=sY(e)?e:document,n=s=>{YT(s.target)||this.ui?.formatPainter.setPointerSelecting(!0)},r=s=>{this.ui?.formatPainter.setPointerSelecting(!1),!YT(s.target)&&this.ui?.formatPainter.notifyPointerUp()},o=s=>{if(s.key==="Escape"){this.ui?.formatPainter.cancel();return}fY(s)&&this.ui?.formatPainter.setKeyboardSelecting(!0)},i=()=>{this.ui?.formatPainter.setKeyboardSelecting(!1),this.ui?.formatPainter.notifyKeyUp()};t.addEventListener("pointerdown",n),t.addEventListener("pointerup",r),t.addEventListener("keydown",o),t.addEventListener("keyup",i),this.#r=()=>{t.removeEventListener("pointerdown",n),t.removeEventListener("pointerup",r),t.removeEventListener("keydown",o),t.removeEventListener("keyup",i)}}#A(){this.#r&&(this.#r(),this.#r=null)}#p(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(h2(r)?.disposition==="host-routed"){this.#D(r,t),this.updateToolbarState();return}if(qT(o)){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});w2(a)&&Promise.resolve(a).catch(l=>this.#p(l,r))}this.updateToolbarState();return}if(e?.isCustomToolbarItem&&typeof o=="string"){if(!Vg(this.ui,o,t,{onSettled:()=>this.updateToolbarState(),onError:s=>this.#p(s,r),reportUnhandled:!0}))throw new Error(`[superdoc toolbar] Command not handled: ${String(o)}`);this.updateToolbarState();return}if(!this.#b(e,t)&&o)throw new Error(`[superdoc toolbar] Command not handled: ${String(o)}`);this.updateToolbarState()}catch(s){this.#p(s,r)}}}destroy(){this.#A(),this.#e?.destroy(),this.#e=null,this.#f(),this.#c(),this.app?.unmount(),this.app=null,this.toolbar=null}};function mY(e){return new pY(e)}Ut();var gY=['[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(", "),vY=800,XT=typeof Blob=="function"?Object.getOwnPropertyDescriptor(Blob.prototype,"size")?.get:void 0,ZT=e=>{if(!XT)return!1;try{return XT.call(e),!0}catch{return!1}};function yY(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 bY=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"]),wY=["original","markup","final"],CY=["review","original","final","off"];function QT(e){return wY.includes(e)}function kY(e){return e==="markup"?"review":e}function JT(e){return CY.includes(e)}function SY(e){const t=e.modules?.trackChanges?.mode;if(JT(t))return t;const n=e.layoutEngineOptions?.trackedChanges?.mode;return JT(n)?n:null}function Ug(e,t){const n=e.viewing,r=QT(n?.trackedChanges)?n.trackedChanges:null,o=r?kY(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 _Y(e,t){const n=new F8.default;return e.forEach((r,o)=>{n.file(t[o],r)}),n.generateAsync({type:"blob",compression:"DEFLATE"})}function AY(e,t){const n=e.composedPath();if(!n.includes(t))return null;const r=n.find(a=>a instanceof HTMLElement&&a.matches(gY));if(!r)return null;const o=n.some(a=>a instanceof HTMLElement&&a.classList.contains(hm.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 IY(e){if(!e||typeof e!="object")return[];const t=e.items;return Array.isArray(t)?t:[]}function ex(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 tx(e){const t=e.selectionTarget??e.target;if(!t)return null;try{return JSON.stringify(t)}catch{return null}}function EY(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 di(e){return!!(e&&typeof e=="object"&&e.editorVersion===2)}function nx(e){return typeof e=="string"&&e.length>0?e:null}function rx(e){return e?di(e)?nx(e.documentId??e.options?.documentId??null):nx(typeof e.getDocumentId=="function"?e.getDocumentId():e.options?.documentId):null}function TY(e){if(!e||di(e))return null;const t=e;return t.documentRenderer??t.presentationEditor??null}function Vs(e){if(!e)return null;if(di(e))return e.fonts??null;const t=TY(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 qh=class extends Lv.default{static{this.allowedTypes=[Nr,rl]}#e;#t;#n;#r;#o;#c;#d;#f;#u;#m;#h;#i;#s;#g;#C;#_;#v;#y;#I;#R;#T;#O;#E;#P;#D;#b;#k;get uiConfig(){return this.#k}#x;get interactionConfig(){return this.#x}#A;get surfacesConfig(){return this.#A}#p;#F;#w;#l;#M;#N;#L;constructor(e){if(super(),this.#e=!1,this.#n=!1,this.#r=null,this.#o=null,this.#c=null,this.#d=null,this.#f=null,this.#u=null,this.#m=!1,this.#h=null,this.#i=null,this.#s=null,this.#g=null,this.#C=!1,this.#_=!1,this.#v=null,this.#y=null,this.#I=!1,this.#R=null,this.#T=null,this.#O=n=>{this.listenerCount("content-control:active-change")>0&&(this.#I||(this.#R=n.pointerId),this.#I=!0,this.#v="pointer",this.#y=null)},this.#E=n=>{n.pointerId===this.#R&&(this.#I=!1,this.#R=null,this.#v??="pointer",this.#v==="pointer"&&(this.#y=Date.now()+vY))},this.#P=n=>{this.listenerCount("content-control:active-change")>0&&!yY(n)&&(this.#v="keyboard",this.#y=null)},this.#D=n=>{this.#K(n)},this.#b=null,this.#k=TT({}),this.#x=xT({}),this.#A=RT({}),this.version="0.0.0",this.users=[],this.whiteboard=null,this.colors=[],this.readyEditors=0,this.#F=!1,this.#w=[],this.#l=new aW,this.#M=null,this.#N=!1,this.#L=null,this.config={selector:"#superdoc",documentMode:"editing",allowSelectionInViewMode:!1,role:"editor",documents:[],editorExtensions:[],colors:[],users:[],user:{...u2},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.#J=new WeakSet,this.#ee=new WeakMap,this.#te=null,this.#W=null,this.#U=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.#t=_5(this,e,()=>this.version,t),this.#p=new TG({getModuleConfig:()=>this.#A}),this.#s=t,t.addEventListener("pointerdown",this.#O,!0),t.ownerDocument.addEventListener("pointerup",this.#E,!0),t.ownerDocument.addEventListener("pointercancel",this.#E,!0),t.addEventListener("keydown",this.#P,!0),t.addEventListener("click",this.#D,!0),this.#a("content-control:active-change",e.onContentControlActiveChange),this.#Y(e,t),this.#_=!0,this.listenerCount("content-control:active-change")>0&&this.ui}async#K(e){const t=this.#s;if(!t)return;const n=AY(e,t),r=this.activeEditor?.doc?.contentControls?.list;if(!(!n||typeof r!="function"))try{const o=await r();if(this.#e)return;const i=ex(IY(o).find(s=>s.id===n));i&&this.emit("content-control:click",{target:i,source:"pointer"})}catch{return}}async#Y(e,t){this.#L=SY(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),c2(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.#je(),this.config.user=zG(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=m4(this.config.modules.comments),this.#k=TT(this.config),this.#x=xT(this.config),this.#A=RT(this.config),this.config.disableContextMenu=!this.#k.contextMenu.enabled,this.config.rulers=this.#k.ruler.enabled,this.#k.comments.enabled?this.config.modules.comments===!1&&(this.config.modules.comments={}):this.config.modules.comments=!1,this.#k.comments.enabled){this.config.modules.comments===!0&&(this.config.modules.comments={});const i=this.config.modules.comments;i&&(i.readOnly=this.#x.comments.readOnly,i.allowResolve=this.#x.comments.allowResolve)}if(this.userColorMap=new Map,this.colorIndex=0,this.version="2.28.0-next.15",this.#ne("π¦ [superdoc] Using SuperDoc version:",this.version),this.superdocId=e.superdocId||Ua(),this.colors=this.config.colors??[],this.#Ee(),this.#ye(),await ZM(),this.#e)return;if(await this.#Ce(this.config.modules),this.#e){this.#ve();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.#M||(this.#M=this.#l.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.#i=o,this.#we(),this.#Z(),this.#Ge(),this.#X()}#X(){if(this.#F=!1,this.#w=[],this.#be(),this.readyEditors=0,!this.app)throw new Error("SuperDoc: #startRuntime called before #initVueApp populated this.app");this.app.mount(this.#i)}#Z(){const e=this.config.modules?.whiteboard,t=e!==!1&&(e?.enabled??!1);this.whiteboard=new e$({Renderer:AG,enabled:t}),this.emit("whiteboard:init",{whiteboard:this.whiteboard})}get requiredNumberOfEditors(){return this.#S("requiredNumberOfEditors").documents.filter(e=>e.type===Nr).length}get ui(){return this.#b||(this.#b=sB({superdoc:this}),this.#e&&this.#b.destroy()),this.#Q(),this.#b}getDocumentApi(){return this.activeEditor?.doc??null}get diagnostics(){return this.#t}emit(e,...t){return(e==="exception"||e==="document-replaced"||e==="ready"||e==="active-editor-change"||e==="collaboration-ready"||e==="collaboration-connection-change"||e==="locked")&&df(this,e,()=>t[0]),super.emit(e,...t)}on(e,t,n){return super.on(e,t,n),e==="content-control:active-change"&&this.#_&&this.ui,this}addListener(e,t,n){return super.addListener(e,t,n),e==="content-control:active-change"&&this.#_&&this.ui,this}once(e,t,n){return super.once(e,t,n),e==="content-control:active-change"&&this.#_&&this.ui,this}removeListener(e,t,n,r){return super.removeListener(e,t,n,r),this.#z(),this}off(e,t,n,r){return super.off(e,t,n,r),this.#z(),this}removeAllListeners(e){return super.removeAllListeners(e),this.#z(),this}#z(){this.listenerCount("content-control:active-change")>0||(this.#g?.(),this.#g=null,this.#T=null,this.#v=null,this.#y=null,this.#I=!1,this.#R=null)}#Q(){if(this.#g||this.#C||!this.#b||this.#e||this.listenerCount("content-control:active-change")===0)return;let e=null,t=[],n=null,r=null,o=!0;this.#C=!0;try{n=this.#b.selection.observe(s=>{if(o){o=!1;return}if(s.status!=="ready")return;const a=tx(s);if(!a)return;this.#v==="pointer"&&this.#y!==null&&Date.now()>this.#y&&(this.#v=null,this.#y=null);const l=this.#v??(this.#I?"pointer":null),u=this.activeEditor;(l||this.#T?.editor!==u||this.#T.key!==a)&&(this.#T={editor:u,key:a,source:l??"keyboard"}),this.#v=null,this.#y=null}),r=this.#b.contentControls.observeActivePath(s=>{const a=this.activeEditor,l=s.activeIds.map(y=>ex(s.items.find(_=>_.id===y)));if(l.some(y=>y===null))return;const u=l,d=a===e,h=u.length===t.length&&u.every((y,_)=>y.id===t[_]?.id);if(d&&h)return;if(u.length===0&&t.length===0){e=a;return}const p=d?t[0]??null:null;e=a,t=u;const v=tx(this.#b.selection.getSnapshot()),g=this.#T;this.emit("content-control:active-change",{active:u[0]??null,previous:p,activePath:u,source:v&&g?.editor===a&&g.key===v?g.source:"keyboard"})});const i=()=>{n?.(),r?.()};this.#e||this.listenerCount("content-control:active-change")===0?i():this.#g=i}catch(i){throw n?.(),r?.(),i}finally{this.#C=!1}}get state(){return{documents:this.#S("state").documents.map(e=>ec(e.data)?{...e,data:jb(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}#ye(){const e=this.config.document,t=!!e&&typeof e=="object"&&(ec(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=Hb(e);this.config.documents=[{id:Ua(),...o}]}else n&&(this.config.documents=[{id:Ua(),type:Nr,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=Hb(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||Ua()}}))}#be(){const{app:e,pinia:t,superdocStore:n,commentsStore:r,highContrastModeStore:o}=Uj({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.#p),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&&FM(this),this.#ie()}#a(e,t){t&&this.on(e,t)}#we(){this.#a("editorBeforeCreate",this.config.onEditorBeforeCreate),this.#a("editorCreate",this.config.onEditorCreate),this.#a("editorDestroy",this.config.onEditorDestroy),this.#a("source:complete",this.config.onSourceComplete),this.#a("source:signals-complete",this.config.onSourceSignalsComplete),this.#a("ready",this.config.onReady),this.#a("comments-update",this.config.onCommentsUpdate),this.#a("content-control:click",this.config.onContentControlClick),this.#a("awareness-update",this.config.onAwarenessUpdate),this.#a("locked",this.config.onLocked),this.#a("pdf:document-ready",this.config.onPdfDocumentReady),this.#a("sidebar-toggle",this.config.onSidebarToggle),this.#a("collaboration-ready",this.config.onCollaborationReady),this.#a("collaboration-connection-change",this.config.onCollaborationConnectionChange),this.on("collaboration-ready",e=>this.#ke(e?.editor??null)),this.#a("editor-update",this.config.onEditorUpdate),this.#a("tracked-changes:bulk-decision",this.config.onTrackedChangesBulkDecision),this.on("content-error",this.onContentError),this.#a("exception",this.config.onException),this.#a("list-definitions-change",this.config.onListDefinitionsChange),this.#a("pagination-update",this.config.onPaginationUpdate),this.#a("fonts-resolved",this.config.onFontsResolved),this.#a("fonts-changed",this.config.onFontsChanged),this.#a("zoomChange",this.config.onZoomChange),this.#a("viewport-change",this.config.onViewportChange),this.#a("page-margins-change",this.config.onPageMarginsChange)}async#Ce({collaboration:e}={}){return e?(this.isCollaborative=!1,this.config.documents.length===0&&(this.config.documents=[{id:Ua(),type:Nr,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}#se(){if(this.#c){try{this.#c()}catch{}this.#c=null}if(this.#d){try{this.#d()}catch{}this.#d=null}if(this.#f){try{this.#f()}catch{}this.#f=null}}#ke(e){this.#se(),di(e)&&(this.#_e(e),this.#Ae(e),this.#Se(e))}#Se(e){const t=e.connection;if(!t||typeof t.subscribe!="function")return;const{documentId:n}=t;this.#u?.documentId!==n&&(this.#u=null,this.#m=!1);const r=o=>{if(this.#e)return;const i=this.#u;if(i&&i.state===o.state&&i.detail===(o.detail??null))return;const s={documentId:n,state:o.state,previousState:i?.state??null,kind:EY(o,this.#m),detail:o.detail??null,superdoc:this};this.#u=s,o.state==="synced"&&(this.#m=!0),this.emit("collaboration-connection-change",s)};try{const o=t.getSnapshot?.();o&&r(o),this.#f=t.subscribe(r)}catch(o){console.warn("[SuperDoc] v2 connection bridge failed to subscribe",o)}}getCollaborationConnectionState(){return this.#u}#_e(e){const t=e.presence;if(!t||typeof t.subscribe!="function")return;const n=Xj(()=>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.#c=t.subscribe(r)}catch(o){console.warn("[SuperDoc] v2 awareness bridge failed to subscribe",o)}}#Ae(e){const t=e.lock;if(!t||typeof t.subscribe!="function")return;const n=r=>{this.#e||this.#j(!!r.isLocked,this.#ae(r.lockedBy??null))};try{if(this.#h&&typeof t.setLocked=="function"){const o=this.#h;t.setLocked(o.isLocked,o.isLocked?o.lockedBy:null),this.#h=null}const r=t.getSnapshot?.();r&&n(r),this.#d=t.subscribe(n)}catch(r){console.warn("[SuperDoc] v2 lock bridge failed to subscribe",r)}}#ae(e){return!e||typeof e!="object"||Array.isArray(e)?null:{...e}}#Ie(e,t){return JSON.stringify(e??null)===JSON.stringify(t??null)}#j(e,t){this.isLocked===e&&this.#Ie(this.lockedBy,t)||(this.isLocked=e,this.lockedBy=t,this.#ne("π¦ [superdoc] Locking superdoc:",e,t,`
|
|
108
108
|
|
|
109
109
|
|
|
110
110
|
`),this.emit("locked",{isLocked:e,lockedBy:t}))}#Ee(){const e=this.config.user;if(!e||e.color)return;const t=this.colors.length>0?this.colors:bY,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.#r){const{target:r}=this.#ce(e);if(this.#Te(r,this.#r.target))return this.#r.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.#n=!0;const n=(async()=>{try{const r=await this.#Fe(),o=this.#Re(),i=this.#xe();this.#Me();try{this.#h=i;const s=await this.#Pe(t,r);this.#De(s,t),this.#h=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.#Le(o),s}}finally{this.#o=null,this.#n=!1,this.#r=null}})();return this.#r={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===Nr),t=this.superdocStore?.documents.find(r=>r.id===e.id)??null,n=t?Rn(t):null;return{isCollaborative:this.isCollaborative,configV2Collaboration:e.v2Collaboration??null,configData:e.data,storeDoc:t,storeV2Collaboration:this.#Oe(n),storeData:t?.data}}#Le(e){this.#h=null;const t=this.config.documents.find(n=>n.type===Nr);t.v2Collaboration=e.configV2Collaboration,t.data=e.configData,this.isCollaborative=e.isCollaborative,e.storeDoc&&(e.storeDoc.data=e.storeData,this.#H(e.storeDoc,e.storeV2Collaboration))}#Me(){if(this.#e)throw new Error("SuperDoc: instance was destroyed during upgrade")}#S(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}#$(e){if(!this.superdocStore)throw new Error(`SuperDoc: ${e} requires the instance to be ready; wait for the "ready" event before calling.`)}#Oe(e){if(!e)return null;const t=e.v2Collaboration;return t&&typeof t=="object"&&"value"in t?t.value:t??null}#H(e,t){const n=Rn(e).v2Collaboration;if(n&&typeof n=="object"&&"value"in n){n.value=t;return}e.v2Collaboration=t}#le(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.baseUrl?{baseUrl:e.baseUrl}:{}}: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}:{},...e.retry!==void 0?{retry:e.retry}:{}}:{providerType:"y-websocket",documentId:e.documentId,roomMode:e.roomMode,...t,...e.serverUrl?{serverUrl:e.serverUrl}:{},...e.params?{params:e.params}:{}}}async#Pe(e,t){const n=this.config.documents.find(s=>s.type===Nr),r=this.#S("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(!di(o)||typeof o.upgradeToCollaboration!="function")throw new Error("SuperDoc: live v2 editor cannot attach collaboration in place");const i=this.#le({...e,roomMode:"create"});return n.v2Collaboration=i,this.#H(r,i),this.isCollaborative=!0,await o.upgradeToCollaboration(t,i),n.data=t,r.data=t,{configDoc:n,storeDoc:r}}#De(e,t){const n=this.#le({...t,roomMode:"join"});e.configDoc.v2Collaboration=n,this.#H(e.storeDoc,n)}async#Fe(){const e=this.activeEditor;if(di(e)&&typeof e.save=="function"){const r=await e.save();return this.#B(r)}const t=this.config.documents.find(r=>r.type===Nr),n=(this.superdocStore?.documents.find(r=>r.id===t.id)??null)?.data??t.data;if(n instanceof Blob)return n;if(ec(n))return this.#B(n);throw new Error("SuperDoc: upgradeToCollaboration() requires a live v2 editor save or DOCX Blob source")}#B(e){if(e instanceof Blob)return e;if(ec(e))return jb(e,Nr);throw new Error("SuperDoc: active v2 editor returned an unsupported DOCX save payload")}#Ne(e,t){const n=rx(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.#B(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.#H(s,i))}#Be(e){if(this.#e)throw new Error("SuperDoc: cannot upgrade a destroyed instance");if(this.#n)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===Nr);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(!di(this.#Ve()))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.#ce(e)}#ce(e){const t=this.config,n=t.documents.find(a=>a.type===Nr),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=YS({collaboration:e.collaboration,v2Collaboration:i,legacyCollaboration:o,documentType:Nr,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}#Ve(){const e=this.config.documents.find(n=>n.type===Nr),t=this.#S("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.#$("addSharedUser");const t=um({actor:e});t&&this.users.some(n=>um({actor:n})===t)||this.users.push(e)}removeSharedUser(e){this.#$("removeSharedUser");const t=typeof e=="string"?Mb(e):"",n=typeof e=="string"?`email:${t}`:um({actor:e});this.users=this.users.filter(r=>{const o=um({actor:r});return n?o!==n:t?Mb(r.email)!==t:!0})}onContentError({error:e,editor:t}){const n=t.options?.documentId,r=this.#S("onContentError").documents.find(a=>a.id===n),o=typeof r?.id=="string"?r.id:typeof n=="string"?n:"",i=r?.data,s=ZT(i)?i:ec(i)?this.#B(i):i==null?i:void 0;this.config.onContentError?.({error:e,editor:t,documentId:o,file:s})}broadcastPdfDocumentReady(){this.emit("pdf:document-ready")}broadcastReady(){if(!this.#e&&this.readyEditors===this.requiredNumberOfEditors){if(this.emit("ready",{superdoc:this}),this.#e)return;this.#F=!0;for(const e of this.#w.splice(0))this.emit(e)}}broadcastEditorBeforeCreate(e){this.emit("editorBeforeCreate",{editor:mT(e)})}broadcastEditorCreate(e){this.readyEditors++,this.broadcastReady(),this.#Ue(e),this.emit("editorCreate",{editor:mT(e)})}#ue(e){if(!this.#e){if(!this.#F){this.#w.push(e);return}this.emit(e)}}broadcastSourceComplete(){this.#ue("source:complete")}broadcastSourceSignalsComplete(){this.#ue("source:signals-complete")}#J;#ee;#Ue(e){if(!e||typeof e.on!="function"||this.#J.has(e))return;this.#J.add(e),e.on("fonts-changed",n=>{this.#de(e)&&this.#G(e,n)});const t=(e.documentRenderer??e.presentationEditor)?.getLastFontsChangedPayload?.();t&&this.#de(e)&&this.#G(e,t)}#de(e){return!this.activeEditor||e===this.activeEditor}#te;#G(e,t){if(this.#te=t,e.editorVersion===2){let n=this.#ee.get(e);n||(n=new Set,this.#ee.set(e,n)),sW(t.missingFonts,n)}this.emit("fonts-changed",t)}broadcastEditorDestroy(){this.emit("editorDestroy")}broadcastSidebarToggle(e){this.emit("sidebar-toggle",e)}#je(){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()`.")}#ne(...e){(console.debug?console.debug:console.log)("π¦ π¦ΈββοΈ [superdoc]",...e)}#W;get fonts(){return this.#W||(this.#W={getReport:()=>Vs(this.activeEditor)?.getReport()??[],getMissingFonts:()=>Vs(this.activeEditor)?.getMissingFonts()??[],getDocumentFontOptions:()=>Vs(this.activeEditor)?.getDocumentFontOptions()??[],getFontFamilyOptions:()=>Vs(this.activeEditor)?.getFontFamilyOptions()??[],getDocumentFonts:()=>Vs(this.activeEditor)?.getDocumentFonts()??[],onReport:e=>{const t=this.activeEditor,n=t?Vs(t)?.getLastFontsChangedPayload?.()??null:this.#te??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=Vs(this.activeEditor);if(!t)throw new Error("superdoc.fonts.map requires an active editor");t.map(e)},unmap:e=>{const t=Vs(this.activeEditor);if(!t)throw new Error("superdoc.fonts.unmap requires an active editor");t.unmap(e)},add:e=>{const t=Vs(this.activeEditor);if(!t)throw new Error("superdoc.fonts.add requires an active editor");t.add(e)},preload:e=>{const t=Vs(this.activeEditor);if(!t)throw new Error("superdoc.fonts.preload requires an active editor");return t.preload(e)}}),this.#W}#V(){const e=this.activeEditor!==null;this.#fe(),this.activeEditor=null,this.toolbar?.setActiveEditor?this.toolbar.setActiveEditor(null):this.toolbar&&(this.toolbar.activeEditor=null),e&&this.emit("active-editor-change")}#U;#fe(){if(this.#U){try{this.#U()}catch{}this.#U=null}}#$e(e){this.#fe();const t=Vs(e);if(!e||!t?.onChanged)return;const n=t.getLastFontsChangedPayload?.();n&&this.#G(e,n),this.#U=t.onChanged(r=>this.#G(e,r))}#He(e,t){this.#N=!0;try{if(e===null){this.#V();return}this.#l.get(e)?.kind==="v2"&&di(t)?this.#he(t):this.#V()}finally{this.#N=!1}}#he(e){if(di(e)){!this.#N&&this.#l.getActive()&&this.#l.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.#V()}setActiveEditor(e){this.#he(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"}]}get v2(){return this.editorVersion!==2?null:{version:2,featureMatrix:this.getV2FeatureMatrix()}}registerEditorRuntime(e){this.#l.register(e);const t=this.config.layoutEngineOptions?.showFormattingMarks;typeof t=="boolean"&&e.setShowFormattingMarks(t)}unregisterEditorRuntime(e){return this.#l.unregister(e)}getActiveRuntime(){return this.#l.getActive()}setActiveRuntime(e,t){this.#l.setActive(e,t)}resolveRuntimeFromEventTarget(e){return this.#l.resolveFromEventTarget(e)}activateRuntimeFromEventTarget(e,t){const n=this.#l.resolveFromEventTarget(e);return n?(this.#l.setActive(n.id,t),!0):!1}toggleRuler(){const e=this.#S("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 fl(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.#k.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=mY({...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 MD(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.#k.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.#l.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.#$("setDocumentMode");const t=e.toLowerCase(),n=this.config.role==="viewer"?"viewing":this.config.role==="suggester"&&t==="editing"?"suggesting":t;this.config.documentMode=n,c2(this.config),this.#ie();const r={viewing:()=>this.#oe(),editing:()=>this.#We(),suggesting:()=>this.#me()};r[n]&&(r[n](),this.emit("document-mode-change",{documentMode:n}))}#re(e,t){const n=typeof e.id=="string"&&e.id.length>0?e.id:null;if(n){const i=this.#l.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.#q(e)}#pe(){return typeof this.config.trackChanges?.enabled=="boolean"?this.config.trackChanges.enabled:typeof this.config.modules?.trackChanges?.enabled=="boolean"?this.config.modules.trackChanges.enabled:!0}#q(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.#l.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.#$("setViewingOptions");const t=Ug(this.config,this.#L),n={...this.config.viewing},r=typeof e.comments=="boolean",o=QT(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&&c2(this.config),this.#ie(),this.config.documentMode==="viewing")){const i=Ug(this.config,this.#L),s=t.comments||t.trackChangesVisible,a=i.comments||i.trackChangesVisible;this.#oe({updateTrackedChangesProjection:o,updateCommentVisibility:s!==a})}}#We(){if(this.config.role!=="editor")return this.#me();const e=this.#S("setDocumentMode");if(e.documents.length>0){const t=e.documents[0]?.getEditor();t&&this.setActiveEditor(t)}this.#q({mode:"review",enabled:this.#pe()}),e.documents.forEach(t=>{t.restoreComments?.(),this.#re(t,"editing")})}#me(){if(!["editor","suggester"].includes(this.config.role??""))return this.#oe();const e=this.#S("setDocumentMode");if(e.documents.length>0){const t=e.documents[0]?.getEditor();t&&this.setActiveEditor(t)}this.#q({mode:"review",enabled:this.#pe()}),e.documents.forEach(t=>{t.restoreComments?.(),this.#re(t,"suggesting")})}#oe(e={}){const t=this.#S("setDocumentMode");this.toolbar?.setActiveEditor?this.toolbar.setActiveEditor(null):this.toolbar&&(this.toolbar.activeEditor=null);const n=Ug(this.config,this.#L),r=n.comments,o=n.trackChangesVisible;e.updateTrackedChangesProjection!==!1&&this.#q({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.#re(i,"viewing")})}#ie(){const e=Ug(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){Lg("superdoc.search","[SuperDoc] search() is not supported in superdoc@2. Use superdoc.ui.search.")}goToSearchResult(e){Lg("superdoc.goToSearchResult","[SuperDoc] goToSearchResult() is not supported in superdoc@2. Use superdoc.ui.search.next().")}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=hA(t.availableWidth,t.documentWidth,n1(this.config.zoom?.fitWidth));n!==null&&(this.superdocStore.activeZoom=n)}}this.emit("zoomChange",{zoom:this.getZoom(),mode:e})}}getZoomState(){const e=n1(this.config.zoom?.fitWidth);return{mode:this.superdocStore?.zoomMode??"manual",value:this.superdocStore?.activeZoom??100,fitZoom:this.superdocStore?.viewportMetrics?.fitZoom??null,fitWidth:{min:e.min,max:e.max},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(di(t)&&typeof t.lock?.setLocked=="function"){t.lock.setLocked(e,e?{...this.user}:null);const n=t.lock.getSnapshot?.();n&&this.#j(!!n.isLocked,this.#ae(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.#j(e,e?this.user:null)}getHTML(e={}){return Lg("superdoc.getHTML","[SuperDoc] getHTML() is not supported in superdoc@2 and returns []. Use await superdoc.activeEditor.doc.getHtml({})."),[]}lockSuperdoc(e=!1,t=null){this.#j(e,t)}async export({exportType:e=["docx"],commentsType:t,exportedName:n,additionalFiles:r=[],additionalFileNames:o=[],isFinalDoc:i,policies:s,triggerDownload:a=!0,fieldsHighlightColor:l=null}={}){if(!Array.isArray(e)||e.length!==1||e[0]!=="docx")throw new TypeError('SuperDoc.export() only supports exportType: ["docx"].');const u=rE(n||this.config.title),d=await this.exportEditorsToDOCX({commentsType:t,isFinalDoc:i,policies:s,fieldsHighlightColor:l}),h=[...r],p=[...o];if(e.includes("docx")&&d.forEach(g=>{h.push(g),p.push(`${u}.docx`)}),h.length===1)return a?nE(h[0],u,e[0]):h[0];const v=await _Y(h,p);return a?nE(v,u,"zip"):v}async replaceFile(e){return(await this.#ge(e)).raw}async replaceDocument(e){const{raw:t,confirmed:n}=await this.#ge(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#ge(e){const t=this.activeEditor;if(di(t)&&typeof t.replaceFile=="function"){const n=this.#B(e),r=await t.replaceFile(n),o=r&&typeof r=="object"?r.state:null,i=o===null||o==="review-ready"||o==="editing-ready";return i&&(this.#Ne(t,n),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,policies:n,fieldsHighlightColor:r}={}){n!==void 0&&M1({policies:n,commentsType:e,isFinalDoc:t});const o=new WeakSet,i=s=>{"editor"in s&&s.error&&typeof s.error=="object"&&o.add(s.error)};this.on("exception",i);try{const s=this.#S("exportEditorsToDOCX").documents;if(n!==void 0&&s.some(l=>{if(l.type!=="application/vnd.openxmlformats-officedocument.wordprocessingml.document")return!1;const u=l.getEditor?.();return!di(u)||typeof u.exportDocx!="function"}))throw new Error("Independent DOCX export policies require a mounted V2 exporter for every document.");const a=s.map(async l=>{if(!l||l.type!=="application/vnd.openxmlformats-officedocument.wordprocessingml.document")return null;const u=typeof l.getEditor=="function"?l.getEditor():null,d=()=>ZT(l.data)?l.data.type&&l.data.type!=="application/vnd.openxmlformats-officedocument.wordprocessingml.document"?null:l.data:ec(l.data)?this.#B(l.data):null;if(!di(u)||typeof u.exportDocx!="function")return d();try{const h=await u.exportDocx({isFinalDoc:t,commentsType:e,policies:n,fieldsHighlightColor:r});if(h)return h}catch(h){throw(!h||typeof h!="object"||!o.has(h))&&(this.emit("exception",{error:h,document:l}),this.emit("exception",XU(h,{documentId:l.id,editor:null}))),h}return d()});return(await Promise.all(a)).filter(l=>l!=null)}finally{this.off("exception",i)}}async save(){const e=this.#S("save").documents;await Promise.all(e.map(async t=>{if(t.type!=="application/vnd.openxmlformats-officedocument.wordprocessingml.document")return;const n=t.getEditor?.();if(!di(n)||typeof n.save!="function")throw new Error(`SuperDoc: save is unavailable for document "${t.id}"`);await n.save()}))}#ve(){this.#h=null,this.#se();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.#p.open(e)}closeSurface(e){this.#p.close(e)}async removeDocument(e){const t=typeof e=="string"?e:String(e??"");if(!t)return!1;const n=this.#S("removeDocument"),r=this.activeEditor,o=rx(r);for(const i of this.#l.getAllByDocumentId(t))this.#l.unregister(i.id);return o===t&&r!==null&&this.#V(),n.removeDocument(t)?(await It(),!0):!1}destroy(){I5(this),this.#e=!0,this.#w=[],this.#s?.removeEventListener("click",this.#D,!0),this.#s?.removeEventListener("pointerdown",this.#O,!0),this.#s?.ownerDocument.removeEventListener("pointerup",this.#E,!0),this.#s?.ownerDocument.removeEventListener("pointercancel",this.#E,!0),this.#s?.removeEventListener("keydown",this.#P,!0),this.#s=null,this.#g?.(),this.#g=null,this.#o&&(this.#o(),this.#o=null),this.#p&&this.#p.destroy(),this.toolbar?.destroy?.(),this.commentsList?.close(),this.commentsList=null,this.#V(),this.app&&(this.#ne("[superdoc] Unmounting app"),this.superdocStore?.reset(),this.app.unmount(),this.removeAllListeners(),delete this.app.config.globalProperties.$config,delete this.app.config.globalProperties.$superdoc),this.#b?.destroy(),this.#ve(),this.#M?.(),this.#M=null,this.#l.clear(),this.#i&&(this.#i.remove(),this.#i=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?di(this.activeEditor)?this.activeEditor.focus?.(e):this.activeEditor.focus?.():this.#S("focus").documents.find(n=>{const r=n.getEditor?.();return r?(di(r)?r.focus?.(e):r.focus?.(),!0):!1})}setHighContrastMode(e){this.activeEditor&&(this.activeEditor.setHighContrastMode?.(e),this.highContrastModeStore?.setHighContrastMode(e))}};Object.defineProperty(qh.prototype.canPerformPermission,Symbol.for("superdoc.internal.permission-method.builtin"),{value:!0}),Ut();var ox="__SUPERDOC_V2_BROWSER_RUNTIME__";function xY(e=globalThis){const t=e[ox];return t&&typeof t=="object"?t:null}function RY(e={},t=globalThis){const n=xY(t)??{},r={...n,...e,vue:e.vue??n.vue??A8};return t[ox]=r,r}RY();var LY={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"},MY=0;function ix(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-${++MY}`}`,l=[];if(i)for(const[u,d]of Object.entries(i)){if(d==null)continue;const h=LY[u];h&&l.push(` ${h}: ${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 OY(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 PY(e){const{className:t,css:n}=ix(e);return OY(t,n),t}function DY(e){return ix(e)}function FY(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 NY=uf({BlankDOCX:()=>BY,DOCX:()=>Nr,DocumentLoadError:()=>HS,HTML:()=>Qf,PDF:()=>rl,SuperDoc:()=>qh,buildTheme:()=>DY,compareVersions:()=>M8,createTheme:()=>PY,defineSuperDocExtension:()=>FY,getFileObject:()=>Ob,listPermissionRangeEditors:()=>pN,resolvePermissionRangeEditor:()=>BA}),BY=$_,zY="SUPERDOC_ENGINE_CDN_BASE_URL",sx=Symbol.for("superdoc.docx-engine.cdn-load-state"),jg="superdocDocxEngineStatus";function VY(e,t,n=null){const r=e?.[zY],o=typeof r=="string"&&r.trim()?r:n;if(typeof o=="string"&&o.trim())return UY(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 UY(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 jY({engineVersion:e,buildBaseUrl:t}){YM(()=>{const n=VY(globalThis,e,t),r=globalThis[sx],o=r instanceof Map?r:new Map;if(globalThis[sx]=o,!o.has(n)){const i=Promise.all([import(`${n}/dist-cdn/docx-engine.es.js`),$Y(`${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 $Y(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[jg]==="loaded")return Promise.resolve();const r=n?.dataset[jg]==="loading";return n&&!r&&n.remove(),new Promise((o,i)=>{const s=r?n:document.createElement("link");let a=!1,l;const u=(v,g)=>{a||(a=!0,l?.disconnect(),s.dataset[jg]=v,g())},d=()=>u("loaded",o),h=()=>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",h,{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[jg]="loading",document.head.appendChild(s))})}jY({engineVersion:"0.27.0-next.
|
|
113
|
+
}`:""}}function OY(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 PY(e){const{className:t,css:n}=ix(e);return OY(t,n),t}function DY(e){return ix(e)}function FY(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 NY=uf({BlankDOCX:()=>BY,DOCX:()=>Nr,DocumentLoadError:()=>HS,HTML:()=>Qf,PDF:()=>rl,SuperDoc:()=>qh,buildTheme:()=>DY,compareVersions:()=>M8,createTheme:()=>PY,defineSuperDocExtension:()=>FY,getFileObject:()=>Ob,listPermissionRangeEditors:()=>pN,resolvePermissionRangeEditor:()=>BA}),BY=$_,zY="SUPERDOC_ENGINE_CDN_BASE_URL",sx=Symbol.for("superdoc.docx-engine.cdn-load-state"),jg="superdocDocxEngineStatus";function VY(e,t,n=null){const r=e?.[zY],o=typeof r=="string"&&r.trim()?r:n;if(typeof o=="string"&&o.trim())return UY(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 UY(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 jY({engineVersion:e,buildBaseUrl:t}){YM(()=>{const n=VY(globalThis,e,t),r=globalThis[sx],o=r instanceof Map?r:new Map;if(globalThis[sx]=o,!o.has(n)){const i=Promise.all([import(`${n}/dist-cdn/docx-engine.es.js`),$Y(`${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 $Y(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[jg]==="loaded")return Promise.resolve();const r=n?.dataset[jg]==="loading";return n&&!r&&n.remove(),new Promise((o,i)=>{const s=r?n:document.createElement("link");let a=!1,l;const u=(v,g)=>{a||(a=!0,l?.disconnect(),s.dataset[jg]=v,g())},d=()=>u("loaded",o),h=()=>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",h,{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[jg]="loading",document.head.appendChild(s))})}jY({engineVersion:"0.27.0-next.14",buildBaseUrl:null});for(const[e,t]of Object.entries(NY))e==="SuperDoc"||e==="default"||Object.prototype.hasOwnProperty.call(qh,e)||(qh[e]=t);var HY=qh;return HY})();
|