superdoc 2.28.0-next.8 β 2.28.0-next.9
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-cdn/superdoc.min.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var SuperDoc=(function(){var c5=Object.create,Op=Object.defineProperty,u5=Object.getOwnPropertyDescriptor,d5=Object.getOwnPropertyNames,f5=Object.getPrototypeOf,h5=Object.prototype.hasOwnProperty,to=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(r){throw n=[r],r}},gw=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),xf=(e,t)=>{let n={};for(var r in e)Op(n,r,{get:e[r],enumerable:!0});return t||Op(n,Symbol.toStringTag,{value:"Module"}),n},p5=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(var o=d5(t),i=0,s=o.length,a;i<s;i++)a=o[i],!h5.call(e,a)&&a!==n&&Op(e,a,{get:(l=>t[l]).bind(null,a),enumerable:!(r=u5(t,a))||r.enumerable});return e},vw=(e,t,n)=>(n=e!=null?c5(f5(e)):{},p5(t||!e||!e.__esModule?Op(n,"default",{value:e,enumerable:!0}):n,e)),m5=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"]),g5=new Set(["text","data","message","errorMessage","quotedText"]),v5=["keydown","keyup","beforeinput","pointerdown","pointermove","pointerup","click","dblclick","mousedown","mouseup","scroll","compositionstart","compositionend","paste","cut","drop","dragstart"],y5=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"]),b5=0;function Nu(e,t){return e&&typeof e=="object"?Object.getOwnPropertyDescriptor(e,t)?.value:void 0}function yw(e,t,n){return typeof e=="number"&&Number.isSafeInteger(e)&&e>0&&e<=n?e:t}var w5=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 v5){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=yw(Nu(e,"maxEvents"),2e4,1e5),this.maxBytes=yw(Nu(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()}-${++b5}`,version:this.version(),status:"recording",startedAt:Date.now(),durationMs:0,timeOrigin:t.performance.timeOrigin,startTimeMs:this.startMs,captureContent:Nu(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(Nu(s,String(d)),a+1)??null)}const l={};for(const u of m5){const d=Nu(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 g5){const d=Nu(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[v,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(v);_&&s[y]==null&&(s[y]=y==="pageIndex"?Number(_):_)}const g=p.getAttribute("data-sdt-id")??p.getAttribute("data-sdt-container-id");g&&d.add(g),p.classList.contains("superdoc-table-fragment")&&s.tableId==null&&(s.tableId=p.getAttribute("data-layout-block-ref"))}s.contentControlIds=[...d],s.contextSource="painted-pointer",s.fragmentId&&s.pageIndex!=null&&(s.selector=`[data-page-index="${s.pageIndex}"] ${o}`);const f=[];for(let p=t;p;p=p.parentElement){const g=this.root.ownerDocument.defaultView.getComputedStyle(p),v=p===this.root||/auto|scroll/.test(`${g.overflowX} ${g.overflowY}`);if(p.scrollLeft||p.scrollTop||v&&(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&&f.push({selector:p===this.root?null:`:scope > ${y.join(" > ")}`,scrollLeft:p.scrollLeft,scrollTop:p.scrollTop})}if(p===this.root)break;if(f.length>=32)throw new Error("scroll-ancestor-limit")}s.scrollAncestors=f}const a={target:s,inputAtMs:e.timeStamp>this.root.ownerDocument.defaultView.performance.timeOrigin?e.timeStamp-this.root.ownerDocument.defaultView.performance.timeOrigin:e.timeStamp,altKey:i.altKey,ctrlKey:i.ctrlKey,metaKey:i.metaKey,shiftKey:i.shiftKey};if(e.type==="keydown"||e.type==="keyup"){const l=i.key;e.type==="keydown"?this.heldKeys.add(l):this.heldKeys.delete(l);const u=y5.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 bw(e){try{return ks(ks(ks(e,"diagnostics"),"recording"),"enabled")===!0}catch{return!1}}var Bu=new WeakMap,C5=0,ww=["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"],k5=["text","data","message","errorMessage","quotedText","value"];function ks(e,t){if(!(!e||typeof e!="object"))return Object.getOwnPropertyDescriptor(e,t)?.value}function Cw(e,t,n){return typeof e=="number"&&Number.isSafeInteger(e)&&e>0&&e<=n?e:t}var S5=class{constructor(e,t,n){if(this.version=t,this.sessionId=`interaction-${++C5}`,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=[],bw(e))try{this.workflow=new w5(n,t)}catch{}const r=ks(ks(e,"diagnostics"),"history");this.enabled=ks(r,"enabled")!==!1,this.captureContent=ks(r,"captureContent")===!0,this.maxEvents=Cw(ks(r,"maxEvents"),500,1e4),this.maxBytes=Cw(ks(r,"maxBytes"),1048576,16777216)}record(e,t){if(this.workflow?.observe(e,t),!(!this.enabled||this.closed))try{let n=!1,r=128;const o=(l,u=0)=>{if(--r<0||u>5){n=!0;return}if(l===null||typeof l=="boolean")return l;if(typeof l=="number")return Number.isFinite(l)?l:void 0;if(typeof l=="string")return l.length>512&&(n=!0),l.slice(0,512);if(!l||typeof l!="object")return;if(Array.isArray(l)){const f=Math.min(l.length,16);l.length>f&&(n=!0);const p=[];for(let g=0;g<f&&r>0;g++)p.push(o(ks(l,String(g)),u+1)??null);return p}const d={};for(const f of this.captureContent?[...ww,...k5]:ww){if(r<=0){n=!0;break}const p=ks(l,f);if(p===void 0)continue;const g=o(p,u+1);g!==void 0&&(d[f]=g)}return d},i=o(t())??{};if(e==="selection:changed"){const l=JSON.stringify(i);if(l===this.lastSelection)return;this.lastSelection=l}else this.lastSelection=void 0;const s={sequence:++this.sequence,observedAt:Date.now(),type:e,data:i,truncated:n};let a=JSON.stringify(s);if(a.length*2>Math.min(8192,this.maxBytes)&&(s.data={},s.truncated=!0,a=JSON.stringify(s)),s.truncated&&this.truncated++,a.length*2>this.maxBytes){this.evicted++;return}for(;this.count&&(this.count>=this.maxEvents||this.bytes+a.length*2>this.maxBytes);){const l=this.slots[this.head];this.bytes-=l.length*2,this.slots[this.head]=void 0,this.head=(this.head+1)%this.maxEvents,this.count--,this.evicted++}this.slots[(this.head+this.count)%this.maxEvents]=a,this.count++,this.bytes+=a.length*2}catch{this.failures++}}action(){return(this.enabled||this.workflow?.active)&&!this.closed?`${this.sessionId}:${++this.actions}`:void 0}snapshot(){const e=[];try{for(let n=0;n<this.count;n++)e.push(JSON.parse(this.slots[(this.head+n)%this.maxEvents]))}catch{this.failures++}let t="unknown";try{t=this.version()}catch{this.failures++}return{schemaVersion:1,sessionId:this.sessionId,version:t,enabled:this.enabled,events:e,retainedBytes:this.bytes,evictedEvents:this.evicted,truncatedEvents:this.truncated,captureFailures:this.failures}}clear(){this.slots=[],this.head=0,this.count=0,this.bytes=0,this.evicted=0,this.truncated=0,this.failures=0,this.lastSelection=void 0}attach(e){if(this.enabled)for(const t of["keydown","beforeinput","compositionstart","compositionend","paste","cut","drop"]){const n=r=>this.record(`input:${t}`,()=>{const o=r;if(r.type==="keydown"){const i=r;return{inputKind:["Backspace","Delete","Enter","Tab","Escape","ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(i.key)?i.key:"key",dataLength:i.key.length===1?1:void 0,isComposing:i.isComposing}}return{inputType:o.inputType,dataLength:o.data?.length,isComposing:o.isComposing,...this.captureContent?{data:o.data}:{}}});try{e.addEventListener(t,n,!0),this.cleanups.push(()=>e.removeEventListener(t,n,!0))}catch{this.failures++}}}close(){this.workflow?.close(),this.closed=!0;for(const e of this.cleanups)try{e()}catch{this.failures++}this.cleanups=[]}},kw=()=>({schemaVersion:1,sessionId:"unavailable",version:"unknown",enabled:!1,events:[],retainedBytes:0,evictedEvents:0,truncatedEvents:0,captureFailures:1}),_5=Object.freeze({getSnapshot:kw,clear(){}});function A5(e,t,n,r){try{const o=new S5(t,n,r);Bu.set(e,o),o.attach(r);const i=Object.freeze({...o.workflow?{recording:o.workflow.api}:{},getSnapshot:()=>{try{return o.snapshot()}catch{return kw()}},clear:()=>{try{o.clear()}catch{}}});return o.record("instance:created",()=>({})),i}catch{return _5}}function Rf(e,t,n){try{e&&Bu.get(e)?.record(t,n)}catch{}}function I5(e,t,n){try{const r=Bu.get(e),o=r?.action();return o&&r?.record(t,()=>({...n(),actionId:o})),o}catch{return}}function E5(e){try{Bu.get(e)?.close(),Bu.delete(e)}catch{}}function T5(e){return Bu.get(e)?.workflow?.api}var x5=gw(((e,t)=>{var n=Object.prototype.hasOwnProperty,r="~";function o(){}Object.create&&(o.prototype=Object.create(null),new o().__proto__||(r=!1));function i(u,d,f){this.fn=u,this.context=d,this.once=f||!1}function s(u,d,f,p,g){if(typeof f!="function")throw new TypeError("The listener must be a function");var v=new i(f,p||u,g),y=r?r+d:d;return u._events[y]?u._events[y].fn?u._events[y]=[u._events[y],v]:u._events[y].push(v):(u._events[y]=v,u._eventsCount++),u}function a(u,d){--u._eventsCount===0?u._events=new o:delete u._events[d]}function l(){this._events=new o,this._eventsCount=0}l.prototype.eventNames=function(){var d=[],f,p;if(this._eventsCount===0)return d;for(p in f=this._events)n.call(f,p)&&d.push(r?p.slice(1):p);return Object.getOwnPropertySymbols?d.concat(Object.getOwnPropertySymbols(f)):d},l.prototype.listeners=function(d){var f=r?r+d:d,p=this._events[f];if(!p)return[];if(p.fn)return[p.fn];for(var g=0,v=p.length,y=new Array(v);g<v;g++)y[g]=p[g].fn;return y},l.prototype.listenerCount=function(d){var f=r?r+d:d,p=this._events[f];return p?p.fn?1:p.length:0},l.prototype.emit=function(d,f,p,g,v,y){var _=r?r+d:d;if(!this._events[_])return!1;var w=this._events[_],E=arguments.length,k,C;if(w.fn){switch(w.once&&this.removeListener(d,w.fn,void 0,!0),E){case 1:return w.fn.call(w.context),!0;case 2:return w.fn.call(w.context,f),!0;case 3:return w.fn.call(w.context,f,p),!0;case 4:return w.fn.call(w.context,f,p,g),!0;case 5:return w.fn.call(w.context,f,p,g,v),!0;case 6:return w.fn.call(w.context,f,p,g,v,y),!0}for(C=1,k=new Array(E-1);C<E;C++)k[C-1]=arguments[C];w.fn.apply(w.context,k)}else{var x=w.length,D;for(C=0;C<x;C++)switch(w[C].once&&this.removeListener(d,w[C].fn,void 0,!0),E){case 1:w[C].fn.call(w[C].context);break;case 2:w[C].fn.call(w[C].context,f);break;case 3:w[C].fn.call(w[C].context,f,p);break;case 4:w[C].fn.call(w[C].context,f,p,g);break;default:if(!k)for(D=1,k=new Array(E-1);D<E;D++)k[D-1]=arguments[D];w[C].fn.apply(w[C].context,k)}}return!0},l.prototype.on=function(d,f,p){return s(this,d,f,p,!1)},l.prototype.once=function(d,f,p){return s(this,d,f,p,!0)},l.prototype.removeListener=function(d,f,p,g){var v=r?r+d:d;if(!this._events[v])return this;if(!f)return a(this,v),this;var y=this._events[v];if(y.fn)y.fn===f&&(!g||y.once)&&(!p||y.context===p)&&a(this,v);else{for(var _=0,w=[],E=y.length;_<E;_++)(y[_].fn!==f||g&&!y[_].once||p&&y[_].context!==p)&&w.push(y[_]);w.length?this._events[v]=w.length===1?w[0]:w:a(this,v)}return this},l.prototype.removeAllListeners=function(d){var f;return d?(f=r?r+d:d,this._events[f]&&a(this,f)):(this._events=new o,this._eventsCount=0),this},l.prototype.off=l.prototype.removeListener,l.prototype.addListener=l.prototype.on,l.prefixed=r,l.EventEmitter=l,typeof t<"u"&&(t.exports=l)})),Gv=vw(x5(),1),Go=[];for(let e=0;e<256;++e)Go.push((e+256).toString(16).slice(1));function R5(e,t=0){return(Go[e[t+0]]+Go[e[t+1]]+Go[e[t+2]]+Go[e[t+3]]+"-"+Go[e[t+4]]+Go[e[t+5]]+"-"+Go[e[t+6]]+Go[e[t+7]]+"-"+Go[e[t+8]]+Go[e[t+9]]+"-"+Go[e[t+10]]+Go[e[t+11]]+Go[e[t+12]]+Go[e[t+13]]+Go[e[t+14]]+Go[e[t+15]]).toLowerCase()}var Wv,M5=new Uint8Array(16);function L5(){if(!Wv){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Wv=crypto.getRandomValues.bind(crypto)}return Wv(M5)}var O5=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Sw={randomUUID:O5};function Fa(e,t,n){if(Sw.randomUUID&&!t&&!e)return Sw.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 R5(r)}function Mf(e){const t=Object.create(null);for(const n of e.split(","))t[n]=1;return n=>n in t}function Nn(e){if(Qt(e)){const t={};for(let n=0;n<e.length;n++){const r=e[n],o=br(r)?D5(r):Nn(r);if(o)for(const i in o)t[i]=o[i]}return t}else if(br(e)||rr(e))return e}function D5(e){const t={};return e.replace(Dw,"").split(Lw).forEach(n=>{if(n){const r=n.split(Ow);r.length>1&&(t[r[0].trim()]=r[1].trim())}}),t}function gn(e){let t="";if(br(e))t=e;else if(Qt(e))for(let n=0;n<e.length;n++){const r=gn(e[n]);r&&(t+=r+" ")}else if(rr(e))for(const n in e)e[n]&&(t+=n+" ");return t.trim()}function Kv(e){if(!e)return null;let{class:t,style:n}=e;return t&&!br(t)&&(e.class=gn(t)),n&&(e.style=Nn(n)),e}function _w(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=Na(e[r],t[r]);return n}function Na(e,t){if(e===t)return!0;let n=Yv(e),r=Yv(t);if(n||r)return n&&r?e.getTime()===t.getTime():!1;if(n=Ei(e),r=Ei(t),n||r)return e===t;if(n=Qt(e),r=Qt(t),n||r)return n&&r?P5(e,t):!1;if(n=rr(e),r=rr(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||!Na(e[o],t[o]))return!1}}return String(e)===String(t)}function Dp(e,t){return e.findIndex(n=>Na(n,t))}function F5(e){return e==null?"initial":typeof e=="string"?e===""?" ":e:(typeof e!="number"||Number.isFinite(e),String(e))}var Yn,Lc,zi,qv,zu,Lf,hr,Pp,Aw,sr,Qt,Oc,Ll,Yv,Iw,bn,br,Ei,rr,Fp,Xv,Dc,Ew,Of,Df,Ol,Pf,Tw,co,xw,gi,Vu,ju,Ro,Pc,Zv,Ff,Nf,Rw,Bf,Mw,Lw,Ow,Dw,Qv,Pw,N5,Jv,Rt,ey,Np,ty=to((()=>{Yn={},Lc=[],zi=()=>{},qv=()=>!1,zu=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),Lf=e=>e.startsWith("onUpdate:"),hr=Object.assign,Pp=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},Aw=Object.prototype.hasOwnProperty,sr=(e,t)=>Aw.call(e,t),Qt=Array.isArray,Oc=e=>Dc(e)==="[object Map]",Ll=e=>Dc(e)==="[object Set]",Yv=e=>Dc(e)==="[object Date]",Iw=e=>Dc(e)==="[object RegExp]",bn=e=>typeof e=="function",br=e=>typeof e=="string",Ei=e=>typeof e=="symbol",rr=e=>e!==null&&typeof e=="object",Fp=e=>(rr(e)||bn(e))&&bn(e.then)&&bn(e.catch),Xv=Object.prototype.toString,Dc=e=>Xv.call(e),Ew=e=>Dc(e).slice(8,-1),Of=e=>Dc(e)==="[object Object]",Df=e=>br(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,Ol=Mf(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),Pf=e=>{const t=Object.create(null);return(n=>t[n]||(t[n]=e(n)))},Tw=/-\w/g,co=Pf(e=>e.replace(Tw,t=>t.slice(1).toUpperCase())),xw=/\B([A-Z])/g,gi=Pf(e=>e.replace(xw,"-$1").toLowerCase()),Vu=Pf(e=>e.charAt(0).toUpperCase()+e.slice(1)),ju=Pf(e=>e?`on${Vu(e)}`:""),Ro=(e,t)=>!Object.is(e,t),Pc=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},Zv=(e,t,n,r=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:r,value:n})},Ff=e=>{const t=parseFloat(e);return isNaN(t)?e:t},Nf=e=>{const t=br(e)?Number(e):NaN;return isNaN(t)?e:t},Bf=()=>Rw||(Rw=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}),Mw=Mf("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"),Lw=/;(?![^(]*\))/g,Ow=/:([^]+)/,Dw=/\/\*[^]*?\*\//g,Qv="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",Pw=Mf(Qv),N5=Mf(Qv+",async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected"),Jv=e=>!!(e&&e.__v_isRef===!0),Rt=e=>br(e)?e:e==null?"":Qt(e)||rr(e)&&(e.toString===Xv||!bn(e.toString))?Jv(e)?Rt(e.value):JSON.stringify(e,ey,2):String(e),ey=(e,t)=>Jv(t)?ey(e,t.value):Oc(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((n,[r,o],i)=>(n[Np(r,i)+" =>"]=o,n),{})}:Ll(t)?{[`Set(${t.size})`]:[...t.values()].map(n=>Np(n))}:Ei(t)?Np(t):rr(t)&&!Qt(t)&&!Of(t)?String(t):t,Np=(e,t="")=>{var n;return Ei(e)?`Symbol(${(n=e.description)!=null?n:t})`:e}}));function ny(e){return new $p(e)}function ry(){return ni}function Fw(e,t=!1){ni&&ni.cleanups.push(e)}function Nw(e,t=!1){if(e.flags|=8,t){e.next=Uf,Uf=e;return}e.next=jf,jf=e}function oy(){fy++}function iy(){if(--fy>0)return;if(Uf){let t=Uf;for(Uf=void 0;t;){const n=t.next;t.next=void 0,t.flags&=-9,t=n}}let e;for(;jf;){let t=jf;for(jf=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 Bw(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function zw(e){let t,n=e.depsTail,r=n;for(;r;){const o=r.prevDep;r.version===-1?(r===n&&(n=o),ay(r),B5(r)):t=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=o}e.deps=t,e.depsTail=n}function sy(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(Vw(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function Vw(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===Hu)||(e.globalVersion=Hu,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!sy(e))))return;e.flags|=2;const t=e.dep,n=Tr,r=ss;Tr=e,ss=!0;try{Bw(e);const o=e.fn(e._value);(t.version===0||Ro(o,e._value))&&(e.flags|=128,e._value=o,t.version++)}catch(o){throw t.version++,o}finally{Tr=n,ss=r,zw(e),e.flags&=-3}}function ay(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)ay(i,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function B5(e){const{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}function z5(e,t){e.effect instanceof $u&&(e=e.effect.fn);const n=new $u(e);t&&hr(n,t);try{n.run()}catch(o){throw n.stop(),o}const r=n.run.bind(n);return r.effect=n,r}function V5(e){e.effect.stop()}function Ba(){hy.push(ss),ss=!1}function za(){const e=hy.pop();ss=e===void 0?!0:e}function jw(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const n=Tr;Tr=void 0;try{t()}finally{Tr=n}}}function Uw(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)Uw(r)}const n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}function ti(e,t,n){if(ss&&Tr){let r=Hf.get(e);r||Hf.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 Va(e,t,n,r,o,i){const s=Hf.get(e);if(!s){Hu++;return}const a=l=>{l&&l.trigger()};if(oy(),t==="clear")s.forEach(a);else{const l=Qt(e),u=l&&Df(n);if(l&&n==="length"){const d=Number(r);s.forEach((f,p)=>{(p==="length"||p===Gu||!Ei(p)&&p>=d)&&a(f)})}else switch((n!==void 0||s.has(void 0))&&a(s.get(n)),u&&a(s.get(Gu)),t){case"add":l?u&&a(s.get("length")):(a(s.get(Dl)),Oc(e)&&a(s.get(Gp)));break;case"delete":l||(a(s.get(Dl)),Oc(e)&&a(s.get(Gp)));break;case"set":Oc(e)&&a(s.get(Dl));break}}iy()}function j5(e,t){const n=Hf.get(e);return n&&n.get(t)}function Uu(e){const t=Bn(e);return t===e?t:(ti(t,"iterate",Gu),xi(e)?t:t.map(as))}function Bp(e){return ti(e=Bn(e),"iterate",Gu),e}function Zs(e,t){return Qs(e)?Fc(Ti(e)?as(t):t):as(t)}function ly(e,t,n){const r=Bp(e),o=r[t]();return r!==e&&!xi(e)&&(o._next=o.next,o.next=()=>{const i=o._next();return i.done||(i.value=n(i.value)),i}),o}function ja(e,t,n,r,o,i){const s=Bp(e),a=s!==e&&!xi(e),l=s[t];if(l!==Qw[t]){const f=l.apply(e,i);return a?as(f):f}let u=n;s!==e&&(a?u=function(f,p){return n.call(this,Zs(e,f),p,e)}:n.length>2&&(u=function(f,p){return n.call(this,f,p,e)}));const d=l.call(s,u,r);return a&&o?o(d):d}function $w(e,t,n,r){const o=Bp(e),i=o!==e&&!xi(e);let s=n,a=!1;o!==e&&(i?(a=r.length===0,s=function(u,d,f){return a&&(a=!1,u=Zs(e,u)),n.call(this,u,Zs(e,d),f,e)}):n.length>3&&(s=function(u,d,f){return n.call(this,u,d,f,e)}));const l=o[t](s,...r);return a?Zs(e,l):l}function cy(e,t,n){const r=Bn(e);ti(r,"iterate",Gu);const o=r[t](...n);return(o===-1||o===!1)&&Vf(n[0])?(n[0]=Bn(n[0]),r[t](...n)):o}function zf(e,t,n=[]){Ba(),oy();const r=Bn(e)[t].apply(e,n);return iy(),za(),r}function U5(e){Ei(e)||(e=String(e));const t=Bn(this);return ti(t,"has",e),t.hasOwnProperty(e)}function $5(e,t,n){return function(...r){const o=this.__v_raw,i=Bn(o),s=Oc(i),a=e==="entries"||e===Symbol.iterator&&s,l=e==="keys"&&s,u=o[e](...r),d=n?Wp:t?Fc:as;return!t&&ti(i,"iterate",l?Gp:Dl),hr(Object.create(u),{next(){const{value:f,done:p}=u.next();return p?{value:f,done:p}:{value:a?[d(f[0]),d(f[1])]:d(f),done:p}}})}}function zp(e){return function(...t){return e==="delete"?!1:e==="clear"?void 0:this}}function H5(e,t){const n={get(r){const o=this.__v_raw,i=Bn(o),s=Bn(r);e||(Ro(r,s)&&ti(i,"get",r),ti(i,"get",s));const{has:a}=Gf(i),l=t?Wp:e?Fc:as;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&&ti(Bn(r),"iterate",Dl),r.size},has(r){const o=this.__v_raw,i=Bn(o),s=Bn(r);return e||(Ro(r,s)&&ti(i,"has",r),ti(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=Bn(s),l=t?Wp:e?Fc:as;return!e&&ti(a,"iterate",Dl),s.forEach((u,d)=>r.call(o,l(u),l(d),i))}};return hr(n,e?{add:zp("add"),set:zp("set"),delete:zp("delete"),clear:zp("clear")}:{add(r){const o=Bn(this),i=Gf(o),s=Bn(r),a=!t&&!xi(r)&&!Qs(r)?s:r;return i.has.call(o,a)||Ro(r,a)&&i.has.call(o,r)||Ro(s,a)&&i.has.call(o,s)||(o.add(a),Va(o,"add",a,a)),this},set(r,o){!t&&!xi(o)&&!Qs(o)&&(o=Bn(o));const i=Bn(this),{has:s,get:a}=Gf(i);let l=s.call(i,r);l||(r=Bn(r),l=s.call(i,r));const u=a.call(i,r);return i.set(r,o),l?Ro(o,u)&&Va(i,"set",r,o,u):Va(i,"add",r,o),this},delete(r){const o=Bn(this),{has:i,get:s}=Gf(o);let a=i.call(o,r);a||(r=Bn(r),a=i.call(o,r));const l=s?s.call(o,r):void 0,u=o.delete(r);return a&&Va(o,"delete",r,void 0,l),u},clear(){const r=Bn(this),o=r.size!==0,i=void 0,s=r.clear();return o&&Va(r,"clear",void 0,void 0,i),s}}),["keys","values","entries",Symbol.iterator].forEach(r=>{n[r]=$5(r,e,t)}),n}function Vp(e,t){const n=H5(e,t);return(r,o,i)=>o==="__v_isReactive"?!e:o==="__v_isReadonly"?e:o==="__v_raw"?r:Reflect.get(sr(n,o)&&o in r?n:r,o,i)}function G5(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function W5(e){return e.__v_skip||!Object.isExtensible(e)?0:G5(Ew(e))}function ho(e){return Qs(e)?e:Up(e,!1,eC,oC,yy)}function Hw(e){return Up(e,!1,nC,iC,by)}function jp(e){return Up(e,!0,tC,sC,wy)}function K5(e){return Up(e,!0,rC,aC,Cy)}function Up(e,t,n,r,o){if(!rr(e)||e.__v_raw&&!(t&&e.__v_isReactive))return e;const i=W5(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 Ti(e){return Qs(e)?Ti(e.__v_raw):!!(e&&e.__v_isReactive)}function Qs(e){return!!(e&&e.__v_isReadonly)}function xi(e){return!!(e&&e.__v_isShallow)}function Vf(e){return e?!!e.__v_raw:!1}function Bn(e){const t=e&&e.__v_raw;return t?Bn(t):e}function Wo(e){return!sr(e,"__v_skip")&&Object.isExtensible(e)&&Zv(e,"__v_skip",!0),e}function Or(e){return e?e.__v_isRef===!0:!1}function oe(e){return Gw(e,!1)}function qr(e){return Gw(e,!0)}function Gw(e,t){return Or(e)?e:new lC(e,t)}function q5(e){e.dep&&e.dep.trigger()}function rt(e){return Or(e)?e.value:e}function Y5(e){return bn(e)?e():rt(e)}function uy(e){return Ti(e)?e:new Proxy(e,cC)}function Ww(e){return new uC(e)}function Kw(e){const t=Qt(e)?new Array(e.length):{};for(const n in e)t[n]=qw(e,n);return t}function dy(e,t,n){return Or(e)?e:bn(e)?new fC(e):rr(e)&&arguments.length>1?qw(e,t,n):oe(e)}function qw(e,t,n){return new dC(e,t,n)}function X5(e,t,n=!1){let r,o;return bn(e)?r=e:(r=e.get,o=e.set),new hC(r,o,n)}function Z5(){return $a}function Yw(e,t=!1,n=$a){if(n){let r=Kf.get(n);r||Kf.set(n,r=[]),r.push(e)}}function Q5(e,t,n=Yn){const{immediate:r,deep:o,once:i,scheduler:s,augmentJob:a,call:l}=n,u=C=>o?C:xi(C)||o===!1||o===0?Ua(C,1):Ua(C);let d,f,p,g,v=!1,y=!1;if(Or(e)?(f=()=>e.value,v=xi(e)):Ti(e)?(f=()=>u(e),v=!0):Qt(e)?(y=!0,v=e.some(C=>Ti(C)||xi(C)),f=()=>e.map(C=>{if(Or(C))return C.value;if(Ti(C))return u(C);if(bn(C))return l?l(C,2):C()})):bn(e)?t?f=l?()=>l(e,2):e:f=()=>{if(p){Ba();try{p()}finally{za()}}const C=$a;$a=d;try{return l?l(e,3,[g]):e(g)}finally{$a=C}}:f=zi,t&&o){const C=f,x=o===!0?1/0:o;f=()=>Ua(C(),x)}const _=ry(),w=()=>{d.stop(),_&&_.active&&Pp(_.effects,d)};if(i&&t){const C=t;t=(...x)=>{C(...x),w()}}let E=y?new Array(e.length).fill(Wf):Wf;const k=C=>{if(!(!(d.flags&1)||!d.dirty&&!C))if(t){const x=d.run();if(o||v||(y?x.some((D,P)=>Ro(D,E[P])):Ro(x,E))){p&&p();const D=$a;$a=d;try{const P=[x,E===Wf?void 0:y&&E[0]===Wf?[]:E,g];E=x,l?l(t,3,P):t(...P)}finally{$a=D}}}else d.run()};return a&&a(k),d=new $u(f),d.scheduler=s?()=>s(k,!1):k,g=C=>Yw(C,!1,d),p=d.onStop=()=>{const C=Kf.get(d);if(C){if(l)l(C,4);else for(const x of C)x();Kf.delete(d)}},t?r?k(!0):E=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 Ua(e,t=1/0,n){if(t<=0||!rr(e)||e.__v_skip||(n=n||new Map,(n.get(e)||0)>=t))return e;if(n.set(e,t),t--,Or(e))Ua(e.value,t,n);else if(Qt(e))for(let r=0;r<e.length;r++)Ua(e[r],t,n);else if(Ll(e)||Oc(e))e.forEach(r=>{Ua(r,t,n)});else if(Of(e)){for(const r in e)Ua(e[r],t,n);for(const r of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,r)&&Ua(e[r],t,n)}return e}var ni,$p,Tr,Hp,$u,fy,jf,Uf,ss,hy,Hu,Xw,$f,Hf,Dl,Gp,Gu,Zw,Qw,Jw,py,my,gy,vy,eC,tC,nC,rC,Wp,Gf,oC,iC,sC,aC,yy,by,wy,Cy,as,Fc,lC,cC,uC,dC,fC,hC,pC,mC,Wf,Kf,$a,J5=to((()=>{ty(),$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=ni,!e&&ni&&(this.index=(ni.scopes||(ni.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=ni;try{return ni=this,e()}finally{ni=t}}}on(){++this._on===1&&(this.prevScope=ni,ni=this)}off(){this._on>0&&--this._on===0&&(ni=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}}},Hp=new WeakSet,$u=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,ni&&ni.active&&ni.effects.push(this)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,Hp.has(this)&&(Hp.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||Nw(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,jw(this),Bw(this);const e=Tr,t=ss;Tr=this,ss=!0;try{return this.fn()}finally{zw(this),Tr=e,ss=t,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)ay(e);this.deps=this.depsTail=void 0,jw(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?Hp.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){sy(this)&&this.run()}get dirty(){return sy(this)}},fy=0,ss=!0,hy=[],Hu=0,Xw=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(!Tr||!ss||Tr===this.computed)return;let t=this.activeLink;if(t===void 0||t.sub!==Tr)t=this.activeLink=new Xw(Tr,this),Tr.deps?(t.prevDep=Tr.depsTail,Tr.depsTail.nextDep=t,Tr.depsTail=t):Tr.deps=Tr.depsTail=t,Uw(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=Tr.depsTail,t.nextDep=void 0,Tr.depsTail.nextDep=t,Tr.depsTail=t,Tr.deps===t&&(Tr.deps=n)}return t}trigger(e){this.version++,Hu++,this.notify(e)}notify(e){oy();try{for(let t=this.subs;t;t=t.prevSub)t.sub.notify()&&t.sub.dep.notify()}finally{iy()}}},Hf=new WeakMap,Dl=Symbol(""),Gp=Symbol(""),Gu=Symbol(""),Zw={__proto__:null,[Symbol.iterator](){return ly(this,Symbol.iterator,e=>Zs(this,e))},concat(...e){return Uu(this).concat(...e.map(t=>Qt(t)?Uu(t):t))},entries(){return ly(this,"entries",e=>(e[1]=Zs(this,e[1]),e))},every(e,t){return ja(this,"every",e,t,void 0,arguments)},filter(e,t){return ja(this,"filter",e,t,n=>n.map(r=>Zs(this,r)),arguments)},find(e,t){return ja(this,"find",e,t,n=>Zs(this,n),arguments)},findIndex(e,t){return ja(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return ja(this,"findLast",e,t,n=>Zs(this,n),arguments)},findLastIndex(e,t){return ja(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return ja(this,"forEach",e,t,void 0,arguments)},includes(...e){return cy(this,"includes",e)},indexOf(...e){return cy(this,"indexOf",e)},join(e){return Uu(this).join(e)},lastIndexOf(...e){return cy(this,"lastIndexOf",e)},map(e,t){return ja(this,"map",e,t,void 0,arguments)},pop(){return zf(this,"pop")},push(...e){return zf(this,"push",e)},reduce(e,...t){return $w(this,"reduce",e,t)},reduceRight(e,...t){return $w(this,"reduceRight",e,t)},shift(){return zf(this,"shift")},some(e,t){return ja(this,"some",e,t,void 0,arguments)},splice(...e){return zf(this,"splice",e)},toReversed(){return Uu(this).toReversed()},toSorted(e){return Uu(this).toSorted(e)},toSpliced(...e){return Uu(this).toSpliced(...e)},unshift(...e){return zf(this,"unshift",e)},values(){return ly(this,"values",e=>Zs(this,e))}},Qw=Array.prototype,Jw=Mf("__proto__,__v_isRef,__isVue"),py=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(Ei)),my=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?Cy:wy:o?by:yy).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(n)?e:void 0;const i=Qt(e);if(!r){let a;if(i&&(a=Zw[t]))return a;if(t==="hasOwnProperty")return U5}const s=Reflect.get(e,t,Or(e)?e:n);if((Ei(t)?py.has(t):Jw(t))||(r||ti(e,"get",t),o))return s;if(Or(s)){const a=i&&Df(t)?s:s.value;return r&&rr(a)?jp(a):a}return rr(s)?r?jp(s):ho(s):s}},gy=class extends my{constructor(e=!1){super(!1,e)}set(e,t,n,r){let o=e[t];const i=Qt(e)&&Df(t);if(!this._isShallow){const l=Qs(o);if(!xi(n)&&!Qs(n)&&(o=Bn(o),n=Bn(n)),!i&&Or(o)&&!Or(n))return l||(o.value=n),!0}const s=i?Number(t)<e.length:sr(e,t),a=Reflect.set(e,t,n,Or(e)?e:r);return e===Bn(r)&&(s?Ro(n,o)&&Va(e,"set",t,n,o):Va(e,"add",t,n)),a}deleteProperty(e,t){const n=sr(e,t),r=e[t],o=Reflect.deleteProperty(e,t);return o&&n&&Va(e,"delete",t,void 0,r),o}has(e,t){const n=Reflect.has(e,t);return(!Ei(t)||!py.has(t))&&ti(e,"has",t),n}ownKeys(e){return ti(e,"iterate",Qt(e)?"length":Dl),Reflect.ownKeys(e)}},vy=class extends my{constructor(e=!1){super(!0,e)}set(e,t){return!0}deleteProperty(e,t){return!0}},eC=new gy,tC=new vy,nC=new gy(!0),rC=new vy(!0),Wp=e=>e,Gf=e=>Reflect.getPrototypeOf(e),oC={get:Vp(!1,!1)},iC={get:Vp(!1,!0)},sC={get:Vp(!0,!1)},aC={get:Vp(!0,!0)},yy=new WeakMap,by=new WeakMap,wy=new WeakMap,Cy=new WeakMap,as=e=>rr(e)?ho(e):e,Fc=e=>rr(e)?jp(e):e,lC=class{constructor(e,t){this.dep=new $f,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=t?e:Bn(e),this._value=t?e:as(e),this.__v_isShallow=t}get value(){return this.dep.track(),this._value}set value(e){const t=this._rawValue,n=this.__v_isShallow||xi(e)||Qs(e);e=n?e:Bn(e),Ro(e,t)&&(this._rawValue=e,this._value=n?e:as(e),this.dep.trigger())}},cC={get:(e,t,n)=>t==="__v_raw"?e:rt(Reflect.get(e,t,n)),set:(e,t,n,r)=>{const o=e[t];return Or(o)&&!Or(n)?(o.value=n,!0):Reflect.set(e,t,n,r)}},uC=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)}},dC=class{constructor(e,t,n){this._object=e,this._defaultValue=n,this.__v_isRef=!0,this._value=void 0,this._key=Ei(t)?t:String(t),this._raw=Bn(e);let r=!0,o=e;if(!Qt(e)||Ei(this._key)||!Df(this._key))do r=!Vf(o)||xi(o);while(r&&(o=o.__v_raw));this._shallow=r}get value(){let e=this._object[this._key];return this._shallow&&(e=rt(e)),this._value=e===void 0?this._defaultValue:e}set value(e){if(this._shallow&&Or(this._raw[this._key])){const t=this._object[this._key];if(Or(t)){t.value=e;return}}this._object[this._key]=e}get dep(){return j5(this._raw,this._key)}},fC=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()}},hC=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=Hu-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!t,this.isSSR=n}notify(){if(this.flags|=16,!(this.flags&8)&&Tr!==this)return Nw(this,!0),!0}get value(){const e=this.dep.track();return Vw(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}},pC={GET:"get",HAS:"has",ITERATE:"iterate"},mC={SET:"set",ADD:"add",DELETE:"delete",CLEAR:"clear"},Wf={},Kf=new WeakMap,$a=void 0}));function e6(e){Uy.push(e)}function t6(){Uy.pop()}function n6(e,t){}function Wu(e,t,n,r){try{return r?e(...r):e()}catch(o){Nc(o,t,n)}}function ls(e,t,n,r){if(bn(e)){const o=Wu(e,t,n,r);return o&&Fp(o)&&o.catch(i=>{Nc(i,t,n)}),o}if(Qt(e)){const o=[];for(let i=0;i<e.length;i++)o.push(ls(e[i],t,n,r));return o}}function Nc(e,t,n,r=!0){const o=t?t.vnode:null,{errorHandler:i,throwUnhandledErrorInProduction:s}=t&&t.appContext.config||Yn;if(t){let a=t.parent;const l=t.proxy,u=`https://vuejs.org/error-reference/#runtime-${n}`;for(;a;){const d=a.ec;if(d){for(let f=0;f<d.length;f++)if(d[f](e,l,u)===!1)return}a=a.parent}if(i){Ba(),Wu(i,null,10,[e,l,u]),za();return}}r6(e,n,o,r,s)}function r6(e,t,n,r=!0,o=!1){if(o)throw e;console.error(e)}function Tt(e){const t=oh||$y;return e?t.then(this?e.bind(this):e):t}function o6(e){let t=_s+1,n=ri.length;for(;t<n;){const r=t+n>>>1,o=ri[r],i=Zu(o);i<e||i===e&&o.flags&2?t=r+1:n=r}return t}function ky(e){if(!(e.flags&1)){const t=Zu(e),n=ri[ri.length-1];!n||!(e.flags&2)&&t>=Zu(n)?ri.push(e):ri.splice(o6(t),0,e),e.flags|=1,gC()}}function gC(){oh||(oh=$y.then(yC))}function qf(e){Qt(e)?zc.push(...e):Ka&&e.id===-1?Ka.splice(Vc+1,0,e):e.flags&1||(zc.push(e),e.flags|=1),gC()}function vC(e,t,n=_s+1){for(;n<ri.length;n++){const r=ri[n];if(r&&r.flags&2){if(e&&r.id!==e.uid)continue;ri.splice(n,1),n--,r.flags&4&&(r.flags&=-2),r(),r.flags&4||(r.flags&=-2)}}}function Kp(e){if(zc.length){const t=[...new Set(zc)].sort((n,r)=>Zu(n)-Zu(r));if(zc.length=0,Ka){Ka.push(...t);return}for(Ka=t,Vc=0;Vc<Ka.length;Vc++){const n=Ka[Vc];n.flags&4&&(n.flags&=-2),n.flags&8||n(),n.flags&=-2}Ka=null,Vc=0}}function yC(e){try{for(_s=0;_s<ri.length;_s++){const t=ri[_s];t&&!(t.flags&8)&&(t.flags&4&&(t.flags&=-2),Wu(t,t.i,t.i?15:14),t.flags&4||(t.flags&=-2))}}finally{for(;_s<ri.length;_s++){const t=ri[_s];t&&(t.flags&=-2)}_s=-1,ri.length=0,Kp(e),oh=null,(ri.length||zc.length)&&yC(e)}}function bC(e,t){var n,r;Qu=e,Qu?(Qu.enabled=!0,ih.forEach(({event:o,args:i})=>Qu.emit(o,...i)),ih=[]):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=>{bC(o,t)}),setTimeout(()=>{Qu||(t.__VUE_DEVTOOLS_HOOK_REPLAY__=null,ih=[])},3e3)):ih=[]}function Yf(e){const t=Lo;return Lo=e,sh=e&&e.type.__scopeId||null,t}function i6(e){sh=e}function s6(){sh=null}function Mo(e,t=Lo,n){if(!t||e._n)return e;const r=(...o)=>{r._d&&nh(-1);const i=Yf(t);let s;try{s=e(...o)}finally{Yf(i),r._d&&nh(1)}return s};return r._n=!0,r._c=!0,r._d=!0,r}function Vi(e,t){if(Lo===null)return e;const n=rh(Lo),r=e.dirs||(e.dirs=[]);for(let o=0;o<t.length;o++){let[i,s,a,l=Yn]=t[o];i&&(bn(i)&&(i={mounted:i,updated:i}),i.deep&&Ua(s),r.push({dir:i,instance:n,value:s,oldValue:void 0,arg:a,modifiers:l}))}return e}function Js(e,t,n,r){const o=e.dirs,i=t&&t.dirs;for(let s=0;s<o.length;s++){const a=o[s];i&&(a.oldValue=i[s].value);let l=a.dir[r];l&&(Ba(),ls(l,n,8,[e.el,a,e,t]),za())}}function Sy(e,t){if(Oo){let n=Oo.provides;const r=Oo.parent&&Oo.parent.provides;r===n&&(n=Oo.provides=Object.create(r)),n[e]=t}}function ea(e,t,n=!1){const r=Vr();if(r||zl){let o=zl?zl._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&&bn(t)?t.call(r&&r.proxy):t}}function wC(){return!!(Vr()||zl)}function a6(e,t){return Xf(e,null,t)}function l6(e,t){return Xf(e,null,{flush:"post"})}function CC(e,t){return Xf(e,null,{flush:"sync"})}function Kt(e,t,n){return Xf(e,t,n)}function Xf(e,t,n=Yn){const{immediate:r,deep:o,flush:i,once:s}=n,a=hr({},n),l=t&&r||!t&&i!=="post";let u;if(Ul){if(i==="sync"){const g=Gy();u=g.__watcherHandles||(g.__watcherHandles=[])}else if(!l){const g=()=>{};return g.stop=zi,g.resume=zi,g.pause=zi,g}}const d=Oo;a.call=(g,v,y)=>ls(g,d,v,y);let f=!1;i==="post"?a.scheduler=g=>{uo(g,d&&d.suspense)}:i!=="sync"&&(f=!0,a.scheduler=(g,v)=>{v?g():ky(g)}),a.augmentJob=g=>{t&&(g.flags|=4),f&&(g.flags|=2,d&&(g.id=d.uid,g.i=d))};const p=Q5(e,t,a);return Ul&&(u?u.push(p):l&&p()),p}function c6(e,t,n){const r=this.proxy,o=br(e)?e.includes(".")?kC(r,e):()=>r[e]:e.bind(r,r);let i;bn(t)?i=t:(i=t.handler,n=t);const s=$c(this),a=Xf(o,i.bind(r),n);return s(),a}function kC(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 qp(e,t,n,{o:{insert:r},m:o},i=2){i===0&&r(e.targetAnchor,t,n);const{el:s,anchor:a,shapeFlag:l,children:u,props:d}=e,f=i===2;if(f&&r(s,t,n),(!f||Nl(d))&&l&16)for(let p=0;p<u.length;p++)o(u[p],t,n,2);f&&r(a,t,n)}function u6(e,t,n,r,o,i,{o:{nextSibling:s,parentNode:a,querySelector:l,insert:u,createText:d}},f){function p(_,w){let E=w;for(;E;){if(E&&E.nodeType===8){if(E.data==="teleport start anchor")t.targetStart=E;else if(E.data==="teleport anchor"){t.targetAnchor=E,_._lpa=t.targetAnchor&&s(t.targetAnchor);break}}E=s(E)}}function g(_,w){w.anchor=f(s(_),w,a(_),n,r,o,i)}const v=t.target=im(t.props,l),y=Nl(t.props);if(v){const _=v._lpa||v.firstChild;t.shapeFlag&16&&(y?(g(e,t),p(v,_),t.targetAnchor||_y(v,t,d,u,a(e)===v?e:null)):(t.anchor=s(e),p(v,_),t.targetAnchor||_y(v,t,d,u),f(_&&s(_),t,v,n,r,o,i))),Zf(t,y)}else y&&t.shapeFlag&16&&(g(e,t),t.targetStart=e,t.targetAnchor=s(e));return t.anchor&&s(t.anchor)}function Zf(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 _y(e,t,n,r,o=null){const i=t.targetStart=n(""),s=t.targetAnchor=n("");return i[Wy]=s,e&&(r(i,e,o),r(s,e,o)),s}function Ay(){const e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return tr(()=>{e.isMounted=!0}),wr(()=>{e.isUnmounting=!0}),e}function SC(e){let t=e[0];if(e.length>1){for(const n of e)if(n.type!==ro){t=n;break}}return t}function _C(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 Ku(e,t,n,r,o){const{appear:i,mode:s,persisted:a=!1,onBeforeEnter:l,onEnter:u,onAfterEnter:d,onEnterCancelled:f,onBeforeLeave:p,onLeave:g,onAfterLeave:v,onLeaveCancelled:y,onBeforeAppear:_,onAppear:w,onAfterAppear:E,onAppearCancelled:k}=t,C=String(e.key),x=_C(n,e),D=(N,L)=>{N&&ls(N,r,9,L)},P=(N,L)=>{const j=L[1];D(N,L),Qt(N)?N.every(M=>M.length<=1)&&j():N.length<=1&&j()},W={mode:s,persisted:a,beforeEnter(N){let L=l;if(!n.isMounted)if(i)L=_||l;else return;N[As]&&N[As](!0);const j=x[C];j&&Ss(e,j)&&j.el[As]&&j.el[As](),D(L,[N])},enter(N){if(x[C]===e)return;let L=u,j=d,M=f;if(!n.isMounted)if(i)L=w||u,j=E||d,M=k||f;else return;let B=!1;N[Ju]=re=>{B||(B=!0,re?D(M,[N]):D(j,[N]),W.delayedLeave&&W.delayedLeave(),N[Ju]=void 0)};const R=N[Ju].bind(null,!1);L?P(L,[N,R]):R()},leave(N,L){const j=String(e.key);if(N[Ju]&&N[Ju](!0),n.isUnmounting)return L();D(p,[N]);let M=!1;N[As]=R=>{M||(M=!0,L(),R?D(y,[N]):D(v,[N]),N[As]=void 0,x[j]===e&&delete x[j])};const B=N[As].bind(null,!1);x[j]=e,g?P(g,[N,B]):B()},clone(N){const L=Ku(N,t,n,r,o);return o&&o(L),L}};return W}function Iy(e){if(ed(e))return e=ta(e),e.children=null,e}function AC(e){if(!ed(e))return Ky(e.type)&&e.children?SC(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&&bn(n.default))return n.default()}}function Ha(e,t){e.shapeFlag&6&&e.component?(e.transition=t,Ha(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 Yp(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===Xt?(s.patchFlag&128&&o++,r=r.concat(Yp(s.children,t,a))):(t||s.type!==ro)&&r.push(a!=null?ta(s,{key:a}):s)}if(o>1)for(let i=0;i<r.length;i++)r[i].patchFlag=-2;return r}function Pl(e,t){return bn(e)?hr({name:e.name},t,{setup:e}):e}function d6(){const e=Vr();return e?(e.appContext.config.idPrefix||"v")+"-"+e.ids[0]+e.ids[1]++:""}function Ey(e){e.ids=[e.ids[0]+e.ids[2]+++"-",0,0]}function f6(e){const t=Vr(),n=qr(null);if(t){const r=t.refs===Yn?t.refs={}:t.refs;Object.defineProperty(r,e,{enumerable:!0,get:()=>n.value,set:o=>n.value=o})}return n}function IC(e,t){let n;return!!((n=Object.getOwnPropertyDescriptor(e,t))&&!n.configurable)}function qu(e,t,n,r,o=!1){if(Qt(e)){e.forEach((y,_)=>qu(y,t&&(Qt(t)?t[_]:t),n,r,o));return}if(ra(r)&&!o){r.shapeFlag&512&&r.type.__asyncResolved&&r.component.subTree.component&&qu(e,t,n,r.component.subTree);return}const i=r.shapeFlag&4?rh(r.component):r.el,s=o?null:i,{i:a,r:l}=e,u=t&&t.r,d=a.refs===Yn?a.refs={}:a.refs,f=a.setupState,p=Bn(f),g=f===Yn?qv:y=>IC(d,y)?!1:sr(p,y),v=(y,_)=>!(_&&IC(d,_));if(u!=null&&u!==l){if(EC(t),br(u))d[u]=null,g(u)&&(f[u]=null);else if(Or(u)){const y=t;v(u,y.k)&&(u.value=null),y.k&&(d[y.k]=null)}}if(bn(l))Wu(l,a,12,[s,d]);else{const y=br(l),_=Or(l);if(y||_){const w=()=>{if(e.f){const E=y?g(l)?f[l]:d[l]:v(l)||!e.k?l.value:d[e.k];if(o)Qt(E)&&Pp(E,i);else if(Qt(E))E.includes(i)||E.push(i);else if(y)d[l]=[i],g(l)&&(f[l]=d[l]);else{const k=[i];v(l,e.k)&&(l.value=k),e.k&&(d[e.k]=k)}}else y?(d[l]=s,g(l)&&(f[l]=s)):_&&(v(l,e.k)&&(l.value=s),e.k&&(d[e.k]=s))};if(s){const E=()=>{w(),ah.delete(e)};E.id=-1,ah.set(e,E),uo(E,n)}else EC(e),w()}}}function EC(e){const t=ah.get(e);t&&(t.flags|=8,ah.delete(e))}function h6(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),Kp(),C._vnode=k;return}f(C.firstChild,k,null,null,null),Kp(),C._vnode=k},f=(k,C,x,D,P,W=!1)=>{W=W||!!C.dynamicChildren;const N=Uc(k)&&k.data==="[",L=()=>y(k,C,x,D,P,N),{type:j,ref:M,shapeFlag:B,patchFlag:R}=C;let re=k.nodeType;C.el=k,R===-2&&(W=!1,C.dynamicChildren=null);let te=null;switch(j){case qa:re!==3?C.children===""?(l(C.el=o(""),s(k),k),te=k):te=L():(k.data!==C.children&&(jc(),k.data=C.children),te=i(k));break;case ro:E(k)?(te=i(k),w(C.el=k.content.firstChild,k,x)):re!==8||N?te=L():te=i(k);break;case Vl:if(N&&(k=i(k),re=k.nodeType),re===1||re===3){te=k;const Y=!C.children.length;for(let X=0;X<C.staticCount;X++)Y&&(C.children+=te.nodeType===1?te.outerHTML:te.data),X===C.staticCount-1&&(C.anchor=te),te=i(te);return N?i(te):te}else L();break;case Xt:N?te=v(k,C,x,D,P,W):te=L();break;default:if(B&1)(re!==1||C.type.toLowerCase()!==k.tagName.toLowerCase())&&!E(k)?te=L():te=p(k,C,x,D,P,W);else if(B&6){C.slotScopeIds=P;const Y=s(k);if(N?te=_(k):Uc(k)&&k.data==="teleport start"?te=_(k,k.data,"teleport end"):te=i(k),t(C,Y,null,x,D,lh(Y),W),ra(C)&&!C.type.__asyncResolved){let X;N?(X=vn(Xt),X.anchor=te?te.previousSibling:Y.lastChild):X=k.nodeType===3?ji(""):vn("div"),X.el=k,C.component.subTree=X}}else B&64?re!==8?te=L():te=C.type.hydrate(k,C,x,D,P,W,e,g):B&128&&(te=C.type.hydrate(k,C,x,D,lh(s(k)),P,W,e,f))}return M!=null&&qu(M,null,D,C),te},p=(k,C,x,D,P,W)=>{W=W||!!C.dynamicChildren;const{type:N,props:L,patchFlag:j,shapeFlag:M,dirs:B,transition:R}=C,re=N==="input"||N==="option";if(re||j!==-1){B&&Js(C,null,x,"created");let te=!1;if(E(k)){te=XC(null,R)&&x&&x.vnode.props&&x.vnode.props.appear;const X=k.content.firstChild;if(te){const U=X.getAttribute("class");U&&(X.$cls=U),R.beforeEnter(X)}w(X,k,x),C.el=k=X}if(M&16&&!(L&&(L.innerHTML||L.textContent))){let X=g(k.firstChild,C,k,x,D,P,W);for(;X;){Xp(k,1)||jc();const U=X;X=X.nextSibling,a(U)}}else if(M&8){let X=C.children;X[0]===`
|
|
2
2
|
`&&(k.tagName==="PRE"||k.tagName==="TEXTAREA")&&(X=X.slice(1));const{textContent:U}=k;U!==X&&U!==X.replace(/\r\n|\r/g,`
|
|
3
3
|
`)&&(Xp(k,0)||jc(),k.textContent=C.children)}if(L){if(re||!W||j&48){const X=k.tagName.includes("-");for(const U in L)(re&&(U.endsWith("value")||U==="indeterminate")||zu(U)&&!Ol(U)||U[0]==="."||X&&!Ol(U))&&r(k,U,null,L[U],void 0,x)}else if(L.onClick)r(k,"onClick",null,L.onClick,void 0,x);else if(j&4&&Ti(L.style))for(const X in L.style)L.style[X]}let Y;(Y=L&&L.onVnodeBeforeMount)&&Mi(Y,x,C),B&&Js(C,null,x,"beforeMount"),((Y=L&&L.onVnodeMounted)||B||te)&&tk(()=>{Y&&Mi(Y,x,C),te&&R.enter(k),B&&Js(C,null,x,"mounted")},D)}return k.nextSibling},g=(k,C,x,D,P,W,N)=>{N=N||!!C.dynamicChildren;const L=C.children,j=L.length;for(let M=0;M<j;M++){const B=N?L[M]:L[M]=Ri(L[M]),R=B.type===qa;k?(R&&!N&&M+1<j&&Ri(L[M+1]).type===qa&&(l(o(k.data.slice(B.children.length)),x,i(k)),k.data=B.children),k=f(k,B,D,P,W,N)):R&&!B.children?l(B.el=o(""),x):(Xp(x,1)||jc(),n(null,B,x,null,D,P,lh(x),W))}return k},v=(k,C,x,D,P,W)=>{const{slotScopeIds:N}=C;N&&(P=P?P.concat(N):N);const L=s(k),j=g(i(k),C,L,x,D,P,W);return j&&Uc(j)&&j.data==="]"?i(C.anchor=j):(jc(),l(C.anchor=u("]"),L,j),j)},y=(k,C,x,D,P,W)=>{if(Xp(k.parentElement,1)||jc(),C.el=null,W){const j=_(k);for(;;){const M=i(k);if(M&&M!==j)a(M);else break}}const N=i(k),L=s(k);return a(k),n(null,C,L,N,x,D,lh(L),P),x&&(x.vnode.el=C.el,rm(x,C.el)),N},_=(k,C="[",x="]")=>{let D=0;for(;k;)if(k=i(k),k&&Uc(k)&&(k.data===C&&D++,k.data===x)){if(D===0)return i(k);D--}return k},w=(k,C,x)=>{const D=C.parentNode;D&&D.replaceChild(k,C);let P=x;for(;P;)P.vnode.el===C&&(P.vnode.el=P.subTree.el=k),P=P.parent},E=k=>k.nodeType===1&&k.tagName==="TEMPLATE";return[d,f]}function Xp(e,t){if(t===0||t===1)for(;e&&!e.hasAttribute(Jy);)e=e.parentElement;const n=e&&e.getAttribute(Jy);if(n==null)return!1;if(n==="")return!0;{const r=n.split(",");return t===0&&r.includes("children")?!0:r.includes(wk[t])}}function p6(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 m6(e,t){if(Uc(e)&&e.data==="["){let n=1,r=e.nextSibling;for(;r;){if(r.nodeType===1){if(t(r)===!1)break}else if(Uc(r))if(r.data==="]"){if(--n===0)break}else r.data==="["&&n++;r=r.nextSibling}}else t(e)}function TC(e){bn(e)&&(e={loader:e});const{loader:t,loadingComponent:n,errorComponent:r,delay:o=200,hydrate:i,timeout:s,suspensible:a=!0,onError:l}=e;let u=null,d,f=0;const p=()=>(f++,u=null,g()),g=()=>{let v;return u||(v=u=t().catch(y=>{if(y=y instanceof Error?y:new Error(String(y)),l)return new Promise((_,w)=>{l(y,()=>_(p()),()=>w(y),f+1)});throw y}).then(y=>v!==u&&u?u:(y&&(y.__esModule||y[Symbol.toStringTag]==="Module")&&(y=y.default),d=y,y)))};return Pl({name:"AsyncComponentWrapper",__asyncLoader:g,__asyncHydrate(v,y,_){let w=!1;(y.bu||(y.bu=[])).push(()=>w=!0);const E=()=>{w||_()},k=i?()=>{const C=i(E,x=>m6(v,x));C&&(y.bum||(y.bum=[])).push(C)}:E;d?k():g().then(()=>!y.isUnmounted&&k())},get __asyncResolved(){return d},setup(){const v=Oo;if(Ey(v),d)return()=>Zp(d,v);const y=k=>{u=null,Nc(k,v,13,!r)};if(a&&v.suspense||Ul)return g().then(k=>()=>Zp(k,v)).catch(k=>(y(k),()=>r?vn(r,{error:k}):null));const _=oe(!1),w=oe(),E=oe(!!o);return o&&setTimeout(()=>{E.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),g().then(()=>{_.value=!0,v.parent&&ed(v.parent.vnode)&&v.parent.update()}).catch(k=>{y(k),w.value=k}),()=>{if(_.value&&d)return Zp(d,v);if(w.value&&r)return vn(r,{error:w.value});if(n&&!E.value)return Zp(n,v)}}})}function Zp(e,t){const{ref:n,props:r,children:o,ce:i}=t.vnode,s=vn(e,r,o);return s.ref=n,s.ce=i,delete t.vnode.ce,s}function Qf(e,t){return Qt(e)?e.some(n=>Qf(n,t)):br(e)?e.split(",").includes(t):Iw(e)?(e.lastIndex=0,e.test(t)):!1}function Ty(e,t){xC(e,"a",t)}function xy(e,t){xC(e,"da",t)}function xC(e,t,n=Oo){const r=e.__wdc||(e.__wdc=()=>{let o=n;for(;o;){if(o.isDeactivated)return;o=o.parent}return e()});if(Jp(t,r,n),n){let o=n.parent;for(;o&&o.parent;)ed(o.parent.vnode)&&g6(r,t,n,o),o=o.parent}}function g6(e,t,n,r){const o=Jp(t,e,r,!0);uh(()=>{Pp(r[t],o)},n)}function Ry(e){e.shapeFlag&=-257,e.shapeFlag&=-513}function Qp(e){return e.shapeFlag&128?e.ssContent:e}function Jp(e,t,n=Oo,r=!1){if(n){const o=n[e]||(n[e]=[]),i=t.__weh||(t.__weh=(...s)=>{Ba();const a=$c(n),l=ls(t,n,e,s);return a(),za(),l});return r?o.unshift(i):o.push(i),i}}function RC(e,t=Oo){Jp("ec",e,t)}function v6(e,t){return Ly(lm,e,!0,t)||e}function My(e){return br(e)?Ly(lm,e,!1)||e:e||ob}function MC(e){return Ly(Tk,e)}function Ly(e,t,n=!0,r=!1){const o=Lo||Oo;if(o){const i=o.type;if(e===lm){const a=jy(i,!1);if(a&&(a===t||a===co(t)||a===Vu(co(t))))return i}const s=LC(o[e]||i[e],t)||LC(o.appContext[e],t);return!s&&r?i:s}}function LC(e,t){return e&&(e[t]||e[co(t)]||e[Vu(co(t))])}function Wn(e,t,n,r){let o;const i=n&&n[r],s=Qt(e);if(s||br(e)){const a=s&&Ti(e);let l=!1,u=!1;a&&(l=!xi(e),u=Qs(e),e=Bp(e)),o=new Array(e.length);for(let d=0,f=e.length;d<f;d++)o[d]=t(l?u?Fc(as(e[d])):as(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(rr(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 y6(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 Yu(e,t,n={},r,o){if(Lo.ce||Lo.parent&&ra(Lo.parent)&&Lo.parent.ce){const u=Object.keys(n).length>0;return t!=="default"&&(n.name=t),ge(),xn(Xt,null,[vn("slot",n,r&&r())],u?-2:64)}let i=e[t];i&&i._c&&(i._d=!1),ge();const s=i&&Oy(i(n)),a=n.key||s&&s.key,l=xn(Xt,{key:(a&&!Ei(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 Oy(e){return e.some(t=>Ga(t)?!(t.type===ro||t.type===Xt&&!Oy(t.children)):!0)?e:null}function b6(e,t){const n={};for(const r in e)n[t&&/[A-Z]/.test(r)?`on:${r}`:ju(r)]=e[r];return n}function w6(){return null}function C6(){return null}function k6(e){}function S6(e){}function _6(){return null}function A6(){}function I6(e,t){return null}function OC(){return PC("useSlots").slots}function DC(){return PC("useAttrs").attrs}function PC(e){const t=Vr();return t.setupContext||(t.setupContext=uk(t))}function Jf(e){return Qt(e)?e.reduce((t,n)=>(t[n]=null,t),{}):e}function E6(e,t){const n=Jf(e);for(const r in t){if(r.startsWith("__skip"))continue;let o=n[r];o?Qt(o)||bn(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 T6(e,t){return!e||!t?e||t:Qt(e)&&Qt(t)?e.concat(t):hr({},Jf(e),Jf(t))}function x6(e,t){const n={};for(const r in e)t.includes(r)||Object.defineProperty(n,r,{enumerable:!0,get:()=>e[r]});return n}function R6(e){const t=Vr(),n=Ul;let r=e();od(),n&&rd(!1);const o=()=>{$c(t),n&&rd(!0)},i=()=>{Vr()!==t&&t.scope.off(),od(),n&&rd(!1)};return Fp(r)&&(r=r.catch(s=>{throw o(),Promise.resolve().then(()=>Promise.resolve().then(i)),s})),[r,()=>{o(),Promise.resolve().then(i)}]}function M6(e){const t=Dy(e),n=e.proxy,r=e.ctx;fm=!1,t.beforeCreate&&FC(t.beforeCreate,e,"bc");const{data:o,computed:i,methods:s,watch:a,provide:l,inject:u,created:d,beforeMount:f,mounted:p,beforeUpdate:g,updated:v,activated:y,deactivated:_,beforeDestroy:w,beforeUnmount:E,destroyed:k,unmounted:C,render:x,renderTracked:D,renderTriggered:P,errorCaptured:W,serverPrefetch:N,expose:L,inheritAttrs:j,components:M,directives:B,filters:R}=t;if(u&&L6(u,r,null),s)for(const Y in s){const X=s[Y];bn(X)&&(r[Y]=X.bind(n))}if(o){const Y=o.call(n,n);rr(Y)&&(e.data=ho(Y))}if(fm=!0,i)for(const Y in i){const X=i[Y],U=bn(X)?X.bind(n,n):bn(X.get)?X.get.bind(n,n):zi,Oe=!bn(X)&&bn(X.set)?X.set.bind(n):zi,me=ke({get:U,set:Oe});Object.defineProperty(r,Y,{enumerable:!0,configurable:!0,get:()=>me.value,set:ce=>me.value=ce})}if(a)for(const Y in a)NC(a[Y],r,n,Y);if(l){const Y=bn(l)?l.call(n):l;Reflect.ownKeys(Y).forEach(X=>{Sy(X,Y[X])})}d&&FC(d,e,"c");function te(Y,X){Qt(X)?X.forEach(U=>Y(U.bind(n))):X&&Y(X.bind(n))}if(te(eb,f),te(tr,p),te(am,g),te(ch,v),te(Ty,y),te(xy,_),te(RC,W),te(rb,D),te(nb,P),te(wr,E),te(uh,C),te(tb,N),Qt(L))if(L.length){const Y=e.exposed||(e.exposed={});L.forEach(X=>{Object.defineProperty(Y,X,{get:()=>n[X],set:U=>n[X]=U,enumerable:!0})})}else e.exposed||(e.exposed={});x&&e.render===zi&&(e.render=x),j!=null&&(e.inheritAttrs=j),M&&(e.components=M),B&&(e.directives=B),N&&Ey(e)}function L6(e,t,n=zi){Qt(e)&&(e=Py(e));for(const r in e){const o=e[r];let i;rr(o)?"default"in o?i=ea(o.from||r,o.default,!0):i=ea(o.from||r):i=ea(o),Or(i)?Object.defineProperty(t,r,{enumerable:!0,configurable:!0,get:()=>i.value,set:s=>i.value=s}):t[r]=i}}function FC(e,t,n){ls(Qt(e)?e.map(r=>r.bind(t.proxy)):e.bind(t.proxy),t,n)}function NC(e,t,n,r){let o=r.includes(".")?kC(n,r):()=>n[r];if(br(e)){const i=t[e];bn(i)&&Kt(o,i)}else if(bn(e))Kt(o,e.bind(n));else if(rr(e))if(Qt(e))e.forEach(i=>NC(i,t,n,r));else{const i=bn(e.handler)?e.handler.bind(n):t[e.handler];bn(i)&&Kt(o,i,e)}}function Dy(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=>em(l,u,s,!0)),em(l,t,s)),rr(t)&&i.set(t,l),l}function em(e,t,n,r=!1){const{mixins:o,extends:i}=t;i&&em(e,i,n,!0),o&&o.forEach(s=>em(e,s,n,!0));for(const s in t)if(!(r&&s==="expose")){const a=Rk[s]||n&&n[s];e[s]=a?a(e[s],t[s]):t[s]}return e}function BC(e,t){return t?e?function(){return hr(bn(e)?e.call(this,this):e,bn(t)?t.call(this,this):t)}:t:e}function O6(e,t){return eh(Py(e),Py(t))}function Py(e){if(Qt(e)){const t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function vi(e,t){return e?[...new Set([].concat(e,t))]:t}function eh(e,t){return e?hr(Object.create(null),e,t):t}function zC(e,t){return e?Qt(e)&&Qt(t)?[...new Set([...e,...t])]:hr(Object.create(null),Jf(e),Jf(t??{})):t}function D6(e,t){if(!e)return t;if(!t)return e;const n=hr(Object.create(null),e);for(const r in t)n[r]=vi(e[r],t[r]);return n}function VC(){return{app:null,config:{isNativeTag:qv,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){bn(r)||(r=hr({},r)),o!=null&&!rr(o)&&(o=null);const i=VC(),s=new WeakSet,a=[];let l=!1;const u=i.app={_uid:Mk++,_component:r,_props:o,_container:null,_context:i,_instance:null,version:pb,get config(){return i.config},set config(d){},use(d,...f){return s.has(d)||(d&&bn(d.install)?(s.add(d),d.install(u,...f)):bn(d)&&(s.add(d),d(u,...f))),u},mixin(d){return i.mixins.includes(d)||i.mixins.push(d),u},component(d,f){return f?(i.components[d]=f,u):i.components[d]},directive(d,f){return f?(i.directives[d]=f,u):i.directives[d]},mount(d,f,p){if(!l){const g=u._ceVNode||vn(r,o);return g.appContext=i,p===!0?p="svg":p===!1&&(p=void 0),f&&t?t(g,d):e(g,d,p),l=!0,u._container=d,d.__vue_app__=u,rh(g.component)}},onUnmount(d){a.push(d)},unmount(){l&&(ls(a,u._instance,16),e(null,u._container),delete u._container.__vue_app__)},provide(d,f){return i.provides[d]=f,u},runWithContext(d){const f=zl;zl=u;try{return d()}finally{zl=f}}};return u}}function F6(e,t,n=Yn){const r=Vr(),o=co(t),i=gi(t),s=ib(e,o),a=Ww((l,u)=>{let d,f=Yn,p;return CC(()=>{const g=e[o];Ro(d,g)&&(d=g,u())}),{get(){return l(),n.get?n.get(d):d},set(g){const v=n.set?n.set(g):g;if(!Ro(v,d)&&!(f!==Yn&&Ro(g,f)))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=g,u()),r.emit(`update:${t}`,v),Ro(g,v)&&Ro(g,f)&&!Ro(v,p)&&u(),f=g,p=v}}});return a[Symbol.iterator]=()=>{let l=0;return{next(){return l<2?{value:l++?s||Yn:a,done:!1}:{done:!0}}}},a}function N6(e,t,...n){if(e.isUnmounted)return;const r=e.vnode.props||Yn;let o=n;const i=t.startsWith("update:"),s=i&&ib(r,t.slice(7));s&&(s.trim&&(o=n.map(d=>br(d)?d.trim():d)),s.number&&(o=n.map(Ff)));let a,l=r[a=ju(t)]||r[a=ju(co(t))];!l&&i&&(l=r[a=ju(gi(t))]),l&&ls(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,ls(u,e,6,o)}}function jC(e,t,n=!1){const r=n?Lk:t.emitsCache,o=r.get(e);if(o!==void 0)return o;const i=e.emits;let s={},a=!1;if(!bn(e)){const l=u=>{const d=jC(u,t,!0);d&&(a=!0,hr(s,d))};!n&&t.mixins.length&&t.mixins.forEach(l),e.extends&&l(e.extends),e.mixins&&e.mixins.forEach(l)}return!i&&!a?(rr(e)&&r.set(e,null),null):(Qt(i)?i.forEach(l=>s[l]=null):hr(s,i),rr(e)&&r.set(e,s),s)}function tm(e,t){return!e||!zu(t)?!1:(t=t.slice(2).replace(/Once$/,""),sr(e,t[0].toLowerCase()+t.slice(1))||sr(e,gi(t))||sr(e,t))}function nm(e){const{type:t,vnode:n,proxy:r,withProxy:o,propsOptions:[i],slots:s,attrs:a,emit:l,render:u,renderCache:d,props:f,data:p,setupState:g,ctx:v,inheritAttrs:y}=e,_=Yf(e);let w,E;try{if(n.shapeFlag&4){const C=o||r,x=C;w=Ri(u.call(x,C,d,f,g,p,v)),E=a}else{const C=t;w=Ri(C.length>1?C(f,{attrs:a,slots:s,emit:l}):C(f,null)),E=t.props?a:Ok(a)}}catch(C){nd.length=0,Nc(C,e,1),w=vn(ro)}let k=w;if(E&&y!==!1){const C=Object.keys(E),{shapeFlag:x}=k;C.length&&x&7&&(i&&C.some(Lf)&&(E=Dk(E,i)),k=ta(k,E,!1,!0))}return n.dirs&&(k=ta(k,null,!1,!0),k.dirs=k.dirs?k.dirs.concat(n.dirs):n.dirs),n.transition&&Ha(k,n.transition),w=k,Yf(_),w}function B6(e,t=!0){let n;for(let r=0;r<e.length;r++){const o=e[r];if(Ga(o)){if(o.type!==ro||o.children==="v-if"){if(n)return;n=o}}else return}return n}function z6(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?UC(r,s,u):!!s;if(l&8){const d=t.dynamicProps;for(let f=0;f<d.length;f++){const p=d[f];if($C(s,r,p)&&!tm(u,p))return!0}}}else return(o||a)&&(!a||!a.$stable)?!0:r===s?!1:r?s?UC(r,s,u):!0:!!s;return!1}function UC(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($C(t,e,i)&&!tm(n,i))return!0}return!1}function $C(e,t,n){const r=e[n],o=t[n];return n==="style"&&rr(r)&&rr(o)?!Na(r,o):r!==o}function rm({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 V6(e,t,n,r=!1){const o={},i=ab();e.propsDefaults=Object.create(null),HC(e,t,o,i);for(const s in e.propsOptions[0])s in o||(o[s]=void 0);n?e.props=r?o:Hw(o):e.type.props?e.props=o:e.props=i,e.attrs=i}function j6(e,t,n,r){const{props:o,attrs:i,vnode:{patchFlag:s}}=e,a=Bn(o),[l]=e.propsOptions;let u=!1;if((r||s>0)&&!(s&16)){if(s&8){const d=e.vnode.dynamicProps;for(let f=0;f<d.length;f++){let p=d[f];if(tm(e.emitsOptions,p))continue;const g=t[p];if(l)if(sr(i,p))g!==i[p]&&(i[p]=g,u=!0);else{const v=co(p);o[v]=Fy(l,a,v,g,e,!1)}else g!==i[p]&&(i[p]=g,u=!0)}}}else{HC(e,t,o,i)&&(u=!0);let d;for(const f in a)(!t||!sr(t,f)&&((d=gi(f))===f||!sr(t,d)))&&(l?n&&(n[f]!==void 0||n[d]!==void 0)&&(o[f]=Fy(l,a,f,void 0,e,!0)):delete o[f]);if(i!==a)for(const f in i)(!t||!sr(t,f))&&(delete i[f],u=!0)}u&&Va(e.attrs,"set","")}function HC(e,t,n,r){const[o,i]=e.propsOptions;let s=!1,a;if(t)for(let l in t){if(Ol(l))continue;const u=t[l];let d;o&&sr(o,d=co(l))?!i||!i.includes(d)?n[d]=u:(a||(a={}))[d]=u:tm(e.emitsOptions,l)||(!(l in r)||u!==r[l])&&(r[l]=u,s=!0)}if(i){const l=Bn(n),u=a||Yn;for(let d=0;d<i.length;d++){const f=i[d];n[f]=Fy(o,l,f,u[f],e,!sr(u,f))}}return s}function Fy(e,t,n,r,o,i){const s=e[n];if(s!=null){const a=sr(s,"default");if(a&&r===void 0){const l=s.default;if(s.type!==Function&&!s.skipFactory&&bn(l)){const{propsDefaults:u}=o;if(n in u)r=u[n];else{const d=$c(o);r=u[n]=l.call(null,t),d()}}else r=l;o.ce&&o.ce._setProp(n,r)}s[0]&&(i&&!a?r=!1:s[1]&&(r===""||r===gi(n))&&(r=!0))}return r}function GC(e,t,n=!1){const r=n?Pk:t.propsCache,o=r.get(e);if(o)return o;const i=e.props,s={},a=[];let l=!1;if(!bn(e)){const d=f=>{l=!0;const[p,g]=GC(f,t,!0);hr(s,p),g&&a.push(...g)};!n&&t.mixins.length&&t.mixins.forEach(d),e.extends&&d(e.extends),e.mixins&&e.mixins.forEach(d)}if(!i&&!l)return rr(e)&&r.set(e,Lc),Lc;if(Qt(i))for(let d=0;d<i.length;d++){const f=co(i[d]);WC(f)&&(s[f]=Yn)}else if(i)for(const d in i){const f=co(d);if(WC(f)){const p=i[d],g=s[f]=Qt(p)||bn(p)?{type:p}:hr({},p),v=g.type;let y=!1,_=!0;if(Qt(v))for(let w=0;w<v.length;++w){const E=v[w],k=bn(E)&&E.name;if(k==="Boolean"){y=!0;break}else k==="String"&&(_=!1)}else y=bn(v)&&v.name==="Boolean";g[0]=y,g[1]=_,(y||sr(g,"default"))&&a.push(f)}}const u=[s,a];return rr(e)&&r.set(e,u),u}function WC(e){return e[0]!=="$"&&!Ol(e)}function KC(e){return YC(e)}function qC(e){return YC(e,h6)}function YC(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:f,nextSibling:p,setScopeId:g=zi,insertStaticContent:v}=e,y=(H,A,ne,V=null,Q=null,K=null,ee=void 0,le=null,be=!!A.dynamicChildren)=>{if(H===A)return;H&&!Ss(H,A)&&(V=kt(H),ce(H,Q,K,!0),H=null),A.patchFlag===-2&&(be=!1,A.dynamicChildren=null);const{type:G,ref:pe,shapeFlag:Ee}=A;switch(G){case qa:_(H,A,ne,V);break;case ro:w(H,A,ne,V);break;case Vl:H==null&&E(A,ne,V,ee);break;case Xt:M(H,A,ne,V,Q,K,ee,le,be);break;default:Ee&1?x(H,A,ne,V,Q,K,ee,le,be):Ee&6?B(H,A,ne,V,Q,K,ee,le,be):(Ee&64||Ee&128)&&G.process(H,A,ne,V,Q,K,ee,le,be,Fe)}pe!=null&&Q?qu(pe,H&&H.ref,K,A||H,!A):pe==null&&H&&H.ref!=null&&qu(H.ref,null,K,H,!0)},_=(H,A,ne,V)=>{if(H==null)r(A.el=a(A.children),ne,V);else{const Q=A.el=H.el;A.children!==H.children&&u(Q,A.children)}},w=(H,A,ne,V)=>{H==null?r(A.el=l(A.children||""),ne,V):A.el=H.el},E=(H,A,ne,V)=>{[H.el,H.anchor]=v(H.children,A,ne,V,H.el,H.anchor)},k=({el:H,anchor:A},ne,V)=>{let Q;for(;H&&H!==A;)Q=p(H),r(H,ne,V),H=Q;r(A,ne,V)},C=({el:H,anchor:A})=>{let ne;for(;H&&H!==A;)ne=p(H),o(H),H=ne;o(A)},x=(H,A,ne,V,Q,K,ee,le,be)=>{if(A.type==="svg"?ee="svg":A.type==="math"&&(ee="mathml"),H==null)D(A,ne,V,Q,K,ee,le,be);else{const G=H.el&&H.el._isVueCE?H.el:null;try{G&&G._beginPatch(),N(H,A,Q,K,ee,le,be)}finally{G&&G._endPatch()}}},D=(H,A,ne,V,Q,K,ee,le)=>{let be,G;const{props:pe,shapeFlag:Ee,transition:Se,dirs:Ge}=H;if(be=H.el=s(H.type,K,pe&&pe.is,pe),Ee&8?d(be,H.children):Ee&16&&W(H.children,be,null,V,Q,Ny(H,K),ee,le),Ge&&Js(H,null,V,"created"),P(be,H,H.scopeId,ee,V),pe){for(const Me in pe)Me!=="value"&&!Ol(Me)&&i(be,Me,null,pe[Me],K,V);"value"in pe&&i(be,"value",null,pe.value,K),(G=pe.onVnodeBeforeMount)&&Mi(G,V,H)}Ge&&Js(H,null,V,"beforeMount");const ht=XC(Q,Se);ht&&Se.beforeEnter(be),r(be,A,ne),((G=pe&&pe.onVnodeMounted)||ht||Ge)&&uo(()=>{G&&Mi(G,V,H),ht&&Se.enter(be),Ge&&Js(H,null,V,"mounted")},Q)},P=(H,A,ne,V,Q)=>{if(ne&&g(H,ne),V)for(let K=0;K<V.length;K++)g(H,V[K]);if(Q){let K=Q.subTree;if(A===K||dh(K.type)&&(K.ssContent===A||K.ssFallback===A)){const ee=Q.vnode;P(H,ee,ee.scopeId,ee.slotScopeIds,Q.parent)}}},W=(H,A,ne,V,Q,K,ee,le,be=0)=>{for(let G=be;G<H.length;G++){const pe=H[G]=le?Wa(H[G]):Ri(H[G]);y(null,pe,A,ne,V,Q,K,ee,le)}},N=(H,A,ne,V,Q,K,ee)=>{const le=A.el=H.el;let{patchFlag:be,dynamicChildren:G,dirs:pe}=A;be|=H.patchFlag&16;const Ee=H.props||Yn,Se=A.props||Yn;let Ge;if(ne&&Bc(ne,!1),(Ge=Se.onVnodeBeforeUpdate)&&Mi(Ge,ne,A,H),pe&&Js(A,H,ne,"beforeUpdate"),ne&&Bc(ne,!0),(Ee.innerHTML&&Se.innerHTML==null||Ee.textContent&&Se.textContent==null)&&d(le,""),G?L(H.dynamicChildren,G,le,ne,V,Ny(A,Q),K):ee||X(H,A,le,null,ne,V,Ny(A,Q),K,!1),be>0){if(be&16)j(le,Ee,Se,ne,Q);else if(be&2&&Ee.class!==Se.class&&i(le,"class",null,Se.class,Q),be&4&&i(le,"style",Ee.style,Se.style,Q),be&8){const ht=A.dynamicProps;for(let Me=0;Me<ht.length;Me++){const qe=ht[Me],Jt=Ee[qe],St=Se[qe];(St!==Jt||qe==="value")&&i(le,qe,Jt,St,Q,ne)}}be&1&&H.children!==A.children&&d(le,A.children)}else!ee&&G==null&&j(le,Ee,Se,ne,Q);((Ge=Se.onVnodeUpdated)||pe)&&uo(()=>{Ge&&Mi(Ge,ne,A,H),pe&&Js(A,H,ne,"updated")},V)},L=(H,A,ne,V,Q,K,ee)=>{for(let le=0;le<A.length;le++){const be=H[le],G=A[le],pe=be.el&&(be.type===Xt||!Ss(be,G)||be.shapeFlag&198)?f(be.el):ne;y(be,G,pe,null,V,Q,K,ee,!0)}},j=(H,A,ne,V,Q)=>{if(A!==ne){if(A!==Yn)for(const K in A)!Ol(K)&&!(K in ne)&&i(H,K,A[K],null,Q,V);for(const K in ne){if(Ol(K))continue;const ee=ne[K],le=A[K];ee!==le&&K!=="value"&&i(H,K,le,ee,Q,V)}"value"in ne&&i(H,"value",A.value,ne.value,Q)}},M=(H,A,ne,V,Q,K,ee,le,be)=>{const G=A.el=H?H.el:a(""),pe=A.anchor=H?H.anchor:a("");let{patchFlag:Ee,dynamicChildren:Se,slotScopeIds:Ge}=A;Ge&&(le=le?le.concat(Ge):Ge),H==null?(r(G,ne,V),r(pe,ne,V),W(A.children||[],ne,pe,Q,K,ee,le,be)):Ee>0&&Ee&64&&Se&&H.dynamicChildren&&H.dynamicChildren.length===Se.length?(L(H.dynamicChildren,Se,ne,Q,K,ee,le),(A.key!=null||Q&&A===Q.subTree)&&By(H,A,!0)):X(H,A,ne,pe,Q,K,ee,le,be)},B=(H,A,ne,V,Q,K,ee,le,be)=>{A.slotScopeIds=le,H==null?A.shapeFlag&512?Q.ctx.activate(A,ne,V,ee,be):R(A,ne,V,Q,K,ee,be):re(H,A,be)},R=(H,A,ne,V,Q,K,ee)=>{const le=H.component=sk(H,V,Q);if(ed(H)&&(le.ctx.renderer=Fe),lk(le,!1,ee),le.asyncDep){if(Q&&Q.registerDep(le,te,ee),!H.el){const be=le.subTree=vn(ro);w(null,be,A,ne),H.placeholder=be.el}}else te(le,H,A,ne,Q,K,ee)},re=(H,A,ne)=>{const V=A.component=H.component;if(z6(H,A,ne))if(V.asyncDep&&!V.asyncResolved){Y(V,A,ne);return}else V.next=A,V.update();else A.el=H.el,V.vnode=A},te=(H,A,ne,V,Q,K,ee)=>{const le=()=>{if(H.isMounted){let{next:Ee,bu:Se,u:Ge,parent:ht,vnode:Me}=H;{const Lt=ZC(H);if(Lt){Ee&&(Ee.el=Me.el,Y(H,Ee,ee)),Lt.asyncDep.then(()=>{uo(()=>{H.isUnmounted||G()},Q)});return}}let qe=Ee,Jt;Bc(H,!1),Ee?(Ee.el=Me.el,Y(H,Ee,ee)):Ee=Me,Se&&Pc(Se),(Jt=Ee.props&&Ee.props.onVnodeBeforeUpdate)&&Mi(Jt,ht,Ee,Me),Bc(H,!0);const St=nm(H),Ut=H.subTree;H.subTree=St,y(Ut,St,f(Ut.el),kt(Ut),H,Q,K),Ee.el=St.el,qe===null&&rm(H,St.el),Ge&&uo(Ge,Q),(Jt=Ee.props&&Ee.props.onVnodeUpdated)&&uo(()=>Mi(Jt,ht,Ee,Me),Q)}else{let Ee;const{el:Se,props:Ge}=A,{bm:ht,m:Me,parent:qe,root:Jt,type:St}=H,Ut=ra(A);if(Bc(H,!1),ht&&Pc(ht),!Ut&&(Ee=Ge&&Ge.onVnodeBeforeMount)&&Mi(Ee,qe,A),Bc(H,!0),Se&&de){const Lt=()=>{H.subTree=nm(H),de(Se,H.subTree,H,Q,null)};Ut&&St.__asyncHydrate?St.__asyncHydrate(Se,H,Lt):Lt()}else{Jt.ce&&Jt.ce._hasShadowRoot()&&Jt.ce._injectChildStyle(St,H.parent?H.parent.type:void 0);const Lt=H.subTree=nm(H);y(null,Lt,ne,V,H,Q,K),A.el=Lt.el}if(Me&&uo(Me,Q),!Ut&&(Ee=Ge&&Ge.onVnodeMounted)){const Lt=A;uo(()=>Mi(Ee,qe,Lt),Q)}(A.shapeFlag&256||qe&&ra(qe.vnode)&&qe.vnode.shapeFlag&256)&&H.a&&uo(H.a,Q),H.isMounted=!0,A=ne=V=null}};H.scope.on();const be=H.effect=new $u(le);H.scope.off();const G=H.update=be.run.bind(be),pe=H.job=be.runIfDirty.bind(be);pe.i=H,pe.id=H.uid,be.scheduler=()=>ky(pe),Bc(H,!0),G()},Y=(H,A,ne)=>{A.component=H;const V=H.vnode.props;H.vnode=A,H.next=null,j6(H,A.props,V,ne),Bk(H,A.children,ne),Ba(),vC(H),za()},X=(H,A,ne,V,Q,K,ee,le,be=!1)=>{const G=H&&H.children,pe=H?H.shapeFlag:0,Ee=A.children,{patchFlag:Se,shapeFlag:Ge}=A;if(Se>0){if(Se&128){Oe(G,Ee,ne,V,Q,K,ee,le,be);return}else if(Se&256){U(G,Ee,ne,V,Q,K,ee,le,be);return}}Ge&8?(pe&16&&ot(G,Q,K),Ee!==G&&d(ne,Ee)):pe&16?Ge&16?Oe(G,Ee,ne,V,Q,K,ee,le,be):ot(G,Q,K,!0):(pe&8&&d(ne,""),Ge&16&&W(Ee,ne,V,Q,K,ee,le,be))},U=(H,A,ne,V,Q,K,ee,le,be)=>{H=H||Lc,A=A||Lc;const G=H.length,pe=A.length,Ee=Math.min(G,pe);let Se;for(Se=0;Se<Ee;Se++){const Ge=A[Se]=be?Wa(A[Se]):Ri(A[Se]);y(H[Se],Ge,ne,null,Q,K,ee,le,be)}G>pe?ot(H,Q,K,!0,!1,Ee):W(A,ne,V,Q,K,ee,le,be,Ee)},Oe=(H,A,ne,V,Q,K,ee,le,be)=>{let G=0;const pe=A.length;let Ee=H.length-1,Se=pe-1;for(;G<=Ee&&G<=Se;){const Ge=H[G],ht=A[G]=be?Wa(A[G]):Ri(A[G]);if(Ss(Ge,ht))y(Ge,ht,ne,null,Q,K,ee,le,be);else break;G++}for(;G<=Ee&&G<=Se;){const Ge=H[Ee],ht=A[Se]=be?Wa(A[Se]):Ri(A[Se]);if(Ss(Ge,ht))y(Ge,ht,ne,null,Q,K,ee,le,be);else break;Ee--,Se--}if(G>Ee){if(G<=Se){const Ge=Se+1,ht=Ge<pe?A[Ge].el:V;for(;G<=Se;)y(null,A[G]=be?Wa(A[G]):Ri(A[G]),ne,ht,Q,K,ee,le,be),G++}}else if(G>Se)for(;G<=Ee;)ce(H[G],Q,K,!0),G++;else{const Ge=G,ht=G,Me=new Map;for(G=ht;G<=Se;G++){const en=A[G]=be?Wa(A[G]):Ri(A[G]);en.key!=null&&Me.set(en.key,G)}let qe,Jt=0;const St=Se-ht+1;let Ut=!1,Lt=0;const mn=new Array(St);for(G=0;G<St;G++)mn[G]=0;for(G=Ge;G<=Ee;G++){const en=H[G];if(Jt>=St){ce(en,Q,K,!0);continue}let Tn;if(en.key!=null)Tn=Me.get(en.key);else for(qe=ht;qe<=Se;qe++)if(mn[qe-ht]===0&&Ss(en,A[qe])){Tn=qe;break}Tn===void 0?ce(en,Q,K,!0):(mn[Tn-ht]=G+1,Tn>=Lt?Lt=Tn:Ut=!0,y(en,A[Tn],ne,null,Q,K,ee,le,be),Jt++)}const ut=Ut?U6(mn):Lc;for(qe=ut.length-1,G=St-1;G>=0;G--){const en=ht+G,Tn=A[en],Cn=A[en+1],ar=en+1<pe?Cn.el||QC(Cn):V;mn[G]===0?y(null,Tn,ne,ar,Q,K,ee,le,be):Ut&&(qe<0||G!==ut[qe]?me(Tn,ne,ar,2):qe--)}}},me=(H,A,ne,V,Q=null)=>{const{el:K,type:ee,transition:le,children:be,shapeFlag:G}=H;if(G&6){me(H.component.subTree,A,ne,V);return}if(G&128){H.suspense.move(A,ne,V);return}if(G&64){ee.move(H,A,ne,Fe);return}if(ee===Xt){r(K,A,ne);for(let pe=0;pe<be.length;pe++)me(be[pe],A,ne,V);r(H.anchor,A,ne);return}if(ee===Vl){k(H,A,ne);return}if(V!==2&&G&1&&le)if(V===0)le.beforeEnter(K),r(K,A,ne),uo(()=>le.enter(K),Q);else{const{leave:pe,delayLeave:Ee,afterLeave:Se}=le,Ge=()=>{H.ctx.isUnmounted?o(K):r(K,A,ne)},ht=()=>{K._isLeaving&&K[As](!0),pe(K,()=>{Ge(),Se&&Se()})};Ee?Ee(K,Ge,ht):ht()}else r(K,A,ne)},ce=(H,A,ne,V=!1,Q=!1)=>{const{type:K,props:ee,ref:le,children:be,dynamicChildren:G,shapeFlag:pe,patchFlag:Ee,dirs:Se,cacheIndex:Ge,memo:ht}=H;if(Ee===-2&&(Q=!1),le!=null&&(Ba(),qu(le,null,ne,H,!0),za()),Ge!=null&&(A.renderCache[Ge]=void 0),pe&256){A.ctx.deactivate(H);return}const Me=pe&1&&Se,qe=!ra(H);let Jt;if(qe&&(Jt=ee&&ee.onVnodeBeforeUnmount)&&Mi(Jt,A,H),pe&6)$e(H.component,ne,V);else{if(pe&128){H.suspense.unmount(ne,V);return}Me&&Js(H,null,A,"beforeUnmount"),pe&64?H.type.remove(H,A,ne,Fe,V):G&&!G.hasOnce&&(K!==Xt||Ee>0&&Ee&64)?ot(G,A,ne,!1,!0):(K===Xt&&Ee&384||!Q&&pe&16)&&ot(be,A,ne),V&&ve(H)}const St=ht!=null&&Ge==null;(qe&&(Jt=ee&&ee.onVnodeUnmounted)||Me||St)&&uo(()=>{Jt&&Mi(Jt,A,H),Me&&Js(H,null,A,"unmounted"),St&&(H.el=null)},ne)},ve=H=>{const{type:A,el:ne,anchor:V,transition:Q}=H;if(A===Xt){Re(ne,V);return}if(A===Vl){C(H);return}const K=()=>{o(ne),Q&&!Q.persisted&&Q.afterLeave&&Q.afterLeave()};if(H.shapeFlag&1&&Q&&!Q.persisted){const{leave:ee,delayLeave:le}=Q,be=()=>ee(ne,K);le?le(H.el,K,be):be()}else K()},Re=(H,A)=>{let ne;for(;H!==A;)ne=p(H),o(H),H=ne;o(A)},$e=(H,A,ne)=>{const{bum:V,scope:Q,job:K,subTree:ee,um:le,m:be,a:G}=H;om(be),om(G),V&&Pc(V),Q.stop(),K&&(K.flags|=8,ce(ee,H,A,ne)),le&&uo(le,A),uo(()=>{H.isUnmounted=!0},A)},ot=(H,A,ne,V=!1,Q=!1,K=0)=>{for(let ee=K;ee<H.length;ee++)ce(H[ee],A,ne,V,Q)},kt=H=>{if(H.shapeFlag&6)return kt(H.component.subTree);if(H.shapeFlag&128)return H.suspense.next();const A=p(H.anchor||H.el),ne=A&&A[Wy];return ne?p(ne):A};let gt=!1;const Bt=(H,A,ne)=>{let V;H==null?A._vnode&&(ce(A._vnode,null,null,!0),V=A._vnode.component):y(A._vnode||null,H,A,null,null,null,ne),A._vnode=H,gt||(gt=!0,vC(V),Kp(),gt=!1)},Fe={p:y,um:ce,m:me,r:ve,mt:R,mc:W,pc:X,pbc:L,n:kt,o:e};let Le,de;return t&&([Le,de]=t(Fe)),{render:Bt,hydrate:Le,createApp:P6(Bt,Le)}}function Ny({type:e,props:t},n){return n==="svg"&&e==="foreignObject"||n==="mathml"&&e==="annotation-xml"&&t&&t.encoding&&t.encoding.includes("html")?void 0:n}function Bc({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function XC(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function By(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]=Wa(o[i]),a.el=s.el),!n&&a.patchFlag!==-2&&By(s,a)),a.type===qa&&(a.patchFlag===-1&&(a=o[i]=Wa(a)),a.el=s.el),a.type===ro&&!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 ZC(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:ZC(t)}function om(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 th(e,t){const n=e.props&&e.props[t];bn(n)&&n()}function $6(e,t,n,r,o,i,s,a,l){const{p:u,o:{createElement:d}}=l,f=d("div"),p=e.suspense=JC(e,o,r,t,f,n,i,s,a,l);u(null,p.pendingBranch=e.ssContent,f,null,r,p,i,s),p.deps>0?(th(e,"onPending"),th(e,"onFallback"),u(null,e.ssFallback,t,n,r,null,i,s),Xu(p,e.ssFallback)):p.resolve(!1,!0)}function H6(e,t,n,r,o,i,s,a,{p:l,um:u,o:{createElement:d}}){const f=t.suspense=e.suspense;f.vnode=t,t.el=e.el;const p=t.ssContent,g=t.ssFallback,{activeBranch:v,pendingBranch:y,isInFallback:_,isHydrating:w}=f;if(y)f.pendingBranch=p,Ss(y,p)?(l(y,p,f.hiddenContainer,null,o,f,i,s,a),f.deps<=0?f.resolve():_&&(w||(l(v,g,n,r,o,null,i,s,a),Xu(f,g)))):(f.pendingId=mm++,w?(f.isHydrating=!1,f.activeBranch=y):u(y,o,f),f.deps=0,f.effects.length=0,f.hiddenContainer=d("div"),_?(l(null,p,f.hiddenContainer,null,o,f,i,s,a),f.deps<=0?f.resolve():(l(v,g,n,r,o,null,i,s,a),Xu(f,g))):v&&Ss(v,p)?(l(v,p,n,r,o,f,i,s,a),f.resolve(!0)):(l(null,p,f.hiddenContainer,null,o,f,i,s,a),f.deps<=0&&f.resolve()));else if(v&&Ss(v,p))l(v,p,n,r,o,f,i,s,a),Xu(f,p);else if(th(t,"onPending"),f.pendingBranch=p,p.shapeFlag&512?f.pendingId=p.component.suspenseId:f.pendingId=mm++,l(null,p,f.hiddenContainer,null,o,f,i,s,a),f.deps<=0)f.resolve();else{const{timeout:E,pendingId:k}=f;E>0?setTimeout(()=>{f.pendingId===k&&f.fallback(g)},E):E===0&&f.fallback(g)}}function JC(e,t,n,r,o,i,s,a,l,u,d=!1){const{p:f,m:p,um:g,n:v,o:{parentNode:y,remove:_}}=u;let w;const E=K6(e);E&&t&&t.pendingBranch&&(w=t.pendingId,t.deps++);const k=e.props?Nf(e.props.timeout):void 0,C=i,x={vnode:e,parent:t,parentComponent:n,namespace:s,container:r,hiddenContainer:o,deps:0,pendingId:mm++,timeout:typeof k=="number"?k:-1,activeBranch:null,isFallbackMountPending:!1,pendingBranch:null,isInFallback:!d,isHydrating:d,isUnmounted:!1,effects:[],resolve(D=!1,P=!1){const{vnode:W,activeBranch:N,pendingBranch:L,pendingId:j,effects:M,parentComponent:B,container:R,isInFallback:re}=x;let te=!1;x.isHydrating?x.isHydrating=!1:D||(te=N&&L.transition&&L.transition.mode==="out-in",te&&(N.transition.afterLeave=()=>{j===x.pendingId&&(p(L,R,i===C?v(N):i,0),qf(M),re&&W.ssFallback&&(W.ssFallback.el=null))}),N&&!x.isFallbackMountPending&&(y(N.el)===R&&(i=v(N)),g(N,B,x,!0),!te&&re&&W.ssFallback&&uo(()=>W.ssFallback.el=null,x)),te||p(L,R,i,0)),x.isFallbackMountPending=!1,Xu(x,L),x.pendingBranch=null,x.isInFallback=!1;let Y=x.parent,X=!1;for(;Y;){if(Y.pendingBranch){Y.effects.push(...M),X=!0;break}Y=Y.parent}!X&&!te&&qf(M),x.effects=[],E&&t&&t.pendingBranch&&w===t.pendingId&&(t.deps--,t.deps===0&&!P&&t.resolve()),th(W,"onResolve")},fallback(D){if(!x.pendingBranch)return;const{vnode:P,activeBranch:W,parentComponent:N,container:L,namespace:j}=x;th(P,"onFallback");const M=v(W),B=()=>{x.isFallbackMountPending=!1,x.isInFallback&&(f(null,D,L,M,N,null,j,a,l),Xu(x,D))},R=D.transition&&D.transition.mode==="out-in";R&&(x.isFallbackMountPending=!0,W.transition.afterLeave=B),x.isInFallback=!0,g(W,N,null,!0),R||B()},move(D,P,W){x.activeBranch&&p(x.activeBranch,D,P,W),x.container=D},next(){return x.activeBranch&&v(x.activeBranch)},registerDep(D,P,W){const N=!!x.pendingBranch;N&&x.deps++;const L=D.vnode.el;D.asyncDep.catch(j=>{Nc(j,D,0)}).then(j=>{if(D.isUnmounted||x.isUnmounted||x.pendingId!==D.suspenseId)return;od(),D.asyncResolved=!0;const{vnode:M}=D;Vy(D,j,!1),L&&(M.el=L);const B=!L&&D.subTree.el;P(D,M,y(L||D.subTree.el),L?null:v(D.subTree),x,s,W),B&&(M.placeholder=null,_(B)),rm(D,M.el),N&&--x.deps===0&&x.resolve()})},unmount(D,P){x.isUnmounted=!0,x.activeBranch&&g(x.activeBranch,n,D,P),x.pendingBranch&&g(x.pendingBranch,n,D,P)}};return x}function G6(e,t,n,r,o,i,s,a,l){const u=t.suspense=JC(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 W6(e){const{shapeFlag:t,children:n}=e,r=t&32;e.ssContent=ek(r?n.default:n),e.ssFallback=r?ek(n.fallback):vn(ro)}function ek(e){let t;if(bn(e)){const n=jl&&e._c;n&&(e._d=!1,ge()),e=e(),n&&(e._d=!0,t=Ko,nk())}return Qt(e)&&(e=B6(e)),e=Ri(e),t&&!e.dynamicChildren&&(e.dynamicChildren=t.filter(n=>n!==e)),e}function tk(e,t){t&&t.pendingBranch?Qt(e)?t.effects.push(...e):t.effects.push(e):qf(e)}function Xu(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,rm(r,o))}function K6(e){const t=e.props&&e.props.suspensible;return t!=null&&t!==!1}function ge(e=!1){nd.push(Ko=e?null:[])}function nk(){nd.pop(),Ko=nd[nd.length-1]||null}function nh(e,t=!1){jl+=e,e<0&&Ko&&t&&(Ko.hasOnce=!0)}function rk(e){return e.dynamicChildren=jl>0?Ko||Lc:null,nk(),jl>0&&Ko&&Ko.push(e),e}function Ce(e,t,n,r,o,i){return rk(he(e,t,n,r,o,i,!0))}function xn(e,t,n,r,o){return rk(vn(e,t,n,r,o,!0))}function Ga(e){return e?e.__v_isVNode===!0:!1}function Ss(e,t){return e.type===t.type&&e.key===t.key}function q6(e){}function he(e,t=null,n=null,r=0,o=null,i=e===Xt?0:1,s=!1,a=!1){const l={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&fb(t),ref:t&&fh(t),scopeId:sh,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:Lo};return a?(zy(l,n),i&128&&e.normalize(l)):n&&(l.shapeFlag|=br(n)?8:16),jl>0&&!s&&Ko&&(l.patchFlag>0||i&6)&&l.patchFlag!==32&&Ko.push(l),l}function Y6(e,t=null,n=null,r=0,o=null,i=!1){if((!e||e===ob)&&(e=ro),Ga(e)){const a=ta(e,t,!0);return n&&zy(a,n),jl>0&&!i&&Ko&&(a.shapeFlag&6?Ko[Ko.indexOf(e)]=a:Ko.push(a)),a.patchFlag=-2,a}if(Q6(e)&&(e=e.__vccOpts),t){t=ok(t);let{class:a,style:l}=t;a&&!br(a)&&(t.class=gn(a)),rr(l)&&(Vf(l)&&!Qt(l)&&(l=hr({},l)),t.style=Nn(l))}const s=br(e)?1:dh(e)?128:Ky(e)?64:rr(e)?4:bn(e)?2:0;return he(e,t,n,r,o,s,i,!0)}function ok(e){return e?Vf(e)||lb(e)?hr({},e):e:null}function ta(e,t,n=!1,r=!1){const{props:o,ref:i,patchFlag:s,children:a,transition:l}=e,u=t?na(o||{},t):o,d={__v_isVNode:!0,__v_skip:!0,type:e.type,props:u,key:u&&fb(u),ref:t&&t.ref?n&&i?Qt(i)?i.concat(fh(t)):[i,fh(t)]:fh(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!==Xt?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&&ta(e.ssContent),ssFallback:e.ssFallback&&ta(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return l&&r&&Ha(d,l.clone(d)),d}function ji(e=" ",t=0){return vn(qa,null,e,t)}function ik(e,t){const n=vn(Vl,null,e);return n.staticCount=t,n}function pt(e="",t=!1){return t?(ge(),xn(ro,null,e)):vn(ro,null,e)}function Ri(e){return e==null||typeof e=="boolean"?vn(ro):Qt(e)?vn(Xt,null,e.slice()):Ga(e)?Wa(e):vn(qa,null,String(e))}function Wa(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:ta(e)}function zy(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),zy(e,o()),o._c&&(o._d=!0));return}else{n=32;const o=t._;!o&&!lb(t)?t._ctx=Lo:o===3&&Lo&&(Lo.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else bn(t)?(t={default:t,_ctx:Lo},n=32):(t=String(t),r&64?(n=16,t=[ji(t)]):n=8);e.children=t,e.shapeFlag|=n}function na(...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=gn([t.class,r.class]));else if(o==="style")t.style=Nn([t.style,r.style]);else if(zu(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&&!Lf(o)&&(t[o]=s)}else o!==""&&(t[o]=r[o])}return t}function Mi(e,t,n,r=null){ls(e,t,7,[n,r])}function sk(e,t,n){const r=e.type,o=(t?t.appContext:e.appContext)||Vk,i={uid:jk++,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:GC(r,o),emitsOptions:jC(r,o),emit:null,emitted:null,propsDefaults:Yn,inheritAttrs:r.inheritAttrs,ctx:Yn,data:Yn,props:Yn,attrs:Yn,slots:Yn,refs:Yn,setupState:Yn,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=N6.bind(null,i),e.ce&&e.ce(i),i}function ak(e){return e.vnode.shapeFlag&4}function lk(e,t=!1,n=!1){t&&rd(t);const{props:r,children:o}=e.vnode,i=ak(e);V6(e,r,i,t),Nk(e,o,n||t);const s=i?X6(e,t):void 0;return t&&rd(!1),s}function X6(e,t){const n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,dm);const{setup:r}=n;if(r){Ba();const o=e.setupContext=r.length>1?uk(e):null,i=$c(e),s=Wu(r,e,0,[e.props,o]),a=Fp(s);if(za(),i(),(a||e.sp)&&!ra(e)&&Ey(e),a){if(s.then(od,od),t)return s.then(l=>{Vy(e,l,t)}).catch(l=>{Nc(l,e,0)});e.asyncDep=s}else Vy(e,s,t)}else ck(e,t)}function Vy(e,t,n){bn(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:rr(t)&&(e.setupState=uy(t)),ck(e,n)}function Z6(e){vm=e,hb=t=>{t.render._rc&&(t.withProxy=new Proxy(t.ctx,xk))}}function ck(e,t,n){const r=e.type;if(!e.render){if(!t&&vm&&!r.render){const o=r.template||Dy(e).template;if(o){const{isCustomElement:i,compilerOptions:s}=e.appContext.config,{delimiters:a,compilerOptions:l}=r,u=hr(hr({isCustomElement:i,delimiters:a},s),l);r.render=vm(o,u)}}e.render=r.render||zi,hb&&hb(e)}{const o=$c(e);Ba();try{M6(e)}finally{za(),o()}}}function uk(e){const t=n=>{e.exposed=n||{}};return{attrs:new Proxy(e.attrs,$k),slots:e.slots,emit:e.emit,expose:t}}function rh(e){return e.exposed?e.exposeProxy||(e.exposeProxy=new Proxy(uy(Wo(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in td)return td[n](e)},has(t,n){return n in t||n in td}})):e.proxy}function jy(e,t=!0){return bn(e)?e.displayName||e.name:e.name||t&&e.__name}function Q6(e){return bn(e)&&"__vccOpts"in e}function no(e,t,n){try{nh(-1);const r=arguments.length;return r===2?rr(t)&&!Qt(t)?Ga(t)?vn(e,null,[t]):vn(e,t):vn(e,null,t):(r>3?n=Array.prototype.slice.call(arguments,2):r===3&&Ga(n)&&(n=[n]),vn(e,t,n))}finally{nh(1)}}function J6(){return;function e(t,n,r){const o=t[r];if(Qt(o)&&o.includes(n)||rr(o)&&n in o||t.extends&&e(t.extends,n,r)||t.mixins&&t.mixins.some(i=>e(i,n,r)))return!0}}function e8(e,t,n,r){const o=n[r];if(o&&dk(o,e))return o;const i=t();return i.memo=e.slice(),i.cacheIndex=r,n[r]=i}function dk(e,t){const n=e.memo;if(n.length!=t.length)return!1;for(let r=0;r<n.length;r++)if(Ro(n[r],t[r]))return!1;return jl>0&&Ko&&Ko.push(e),!0}var Uy,fk,hk,ri,_s,zc,Ka,Vc,$y,oh,Zu,Qu,ih,Lo,sh,pk,Hy,Gy,Fl,Wy,Ky,Nl,mk,qy,Yy,im,gk,Bl,As,Ju,Ui,sm,Xy,vk,Zy,ah,Qy,jc,yk,bk,lh,Uc,Jy,wk,Ck,kk,Sk,_k,Ak,Ik,ra,ed,Ek,oa,eb,tr,am,ch,wr,uh,tb,nb,rb,lm,Tk,ob,cm,td,um,dm,xk,fm,Rk,Mk,zl,ib,Lk,Ok,Dk,sb,ab,lb,Pk,hm,pm,Fk,cb,ub,db,Nk,Bk,uo,dh,mm,zk,Xt,qa,ro,Vl,nd,Ko,jl,fb,fh,vn,Vk,jk,Oo,Vr,gm,rd,$c,od,Ul,vm,hb,Uk,$k,ke,pb,Hk,Gk,Wk,Kk,qk,t8,n8,r8,Yk=to((()=>{J5(),ty(),Uy=[],fk={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"},hk={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"},ri=[],_s=-1,zc=[],Ka=null,Vc=0,$y=Promise.resolve(),oh=null,Zu=e=>e.id==null?e.flags&2?-1:1/0:e.id,ih=[],Lo=null,sh=null,pk=e=>Mo,Hy=Symbol.for("v-scx"),Gy=()=>{{const e=ea(Hy);return e}},Fl=new WeakMap,Wy=Symbol("_vte"),Ky=e=>e.__isTeleport,Nl=e=>e&&(e.disabled||e.disabled===""),mk=e=>e&&(e.defer||e.defer===""),qy=e=>typeof SVGElement<"u"&&e instanceof SVGElement,Yy=e=>typeof MathMLElement=="function"&&e instanceof MathMLElement,im=(e,t)=>{const n=e&&e.to;return br(n)?t?t(n):null:n},gk={name:"Teleport",__isTeleport:!0,process(e,t,n,r,o,i,s,a,l,u){const{mc:d,pc:f,pbc:p,o:{insert:g,querySelector:v,createText:y,createComment:_}}=u,w=Nl(t.props);let{dynamicChildren:E}=t;const k=(D,P,W)=>{D.shapeFlag&16&&d(D.children,P,W,o,i,s,a,l)},C=(D=t)=>{const P=Nl(D.props),W=D.target=im(D.props,v),N=_y(W,D,y,g);W&&(s!=="svg"&&qy(W)?s="svg":s!=="mathml"&&Yy(W)&&(s="mathml"),o&&o.isCE&&(o.ce._teleportTargets||(o.ce._teleportTargets=new Set)).add(W),P||(k(D,W,N),Zf(D,!1)))},x=D=>{const P=()=>{Fl.get(D)===P&&(Fl.delete(D),Nl(D.props)&&(k(D,n,D.anchor),Zf(D,!0)),C(D))};Fl.set(D,P),uo(P,i)};if(e==null){const D=t.el=y(""),P=t.anchor=y("");if(g(D,n,r),g(P,n,r),mk(t.props)||i&&i.pendingBranch){x(t);return}w&&(k(t,n,P),Zf(t,!0)),C()}else{t.el=e.el;const D=t.anchor=e.anchor,P=Fl.get(e);if(P){P.flags|=8,Fl.delete(e),x(t);return}t.targetStart=e.targetStart;const W=t.target=e.target,N=t.targetAnchor=e.targetAnchor,L=Nl(e.props),j=L?n:W,M=L?D:N;if(s==="svg"||qy(W)?s="svg":(s==="mathml"||Yy(W))&&(s="mathml"),E?(p(e.dynamicChildren,E,j,o,i,s,a),By(e,t,!0)):l||f(e,t,j,M,o,i,s,a,!1),w)L?t.props&&e.props&&t.props.to!==e.props.to&&(t.props.to=e.props.to):qp(t,n,D,u,1);else if((t.props&&t.props.to)!==(e.props&&e.props.to)){const B=t.target=im(t.props,v);B&&qp(t,B,null,u,0)}else L&&qp(t,W,N,u,1);Zf(t,w)}},remove(e,t,n,{um:r,o:{remove:o}},i){const{shapeFlag:s,children:a,anchor:l,targetStart:u,targetAnchor:d,target:f,props:p}=e;let g=i||!Nl(p);const v=Fl.get(e);if(v&&(v.flags|=8,Fl.delete(e),g=!1),f&&(o(u),o(d)),i&&o(l),s&16)for(let y=0;y<a.length;y++){const _=a[y];r(_,t,n,g,!!_.dynamicChildren)}},move:qp,hydrate:u6},Bl=gk,As=Symbol("_leaveCb"),Ju=Symbol("_enterCb"),Ui=[Function,Array],sm={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:Ui,onEnter:Ui,onAfterEnter:Ui,onEnterCancelled:Ui,onBeforeLeave:Ui,onLeave:Ui,onAfterLeave:Ui,onLeaveCancelled:Ui,onBeforeAppear:Ui,onAppear:Ui,onAfterAppear:Ui,onAppearCancelled:Ui},Xy=e=>{const t=e.subTree;return t.component?Xy(t.component):t},vk={name:"BaseTransition",props:sm,setup(e,{slots:t}){const n=Vr(),r=Ay();return()=>{const o=t.default&&Yp(t.default(),!0);if(!o||!o.length)return;const i=SC(o),s=Bn(e),{mode:a}=s;if(r.isLeaving)return Iy(i);const l=AC(i);if(!l)return Iy(i);let u=Ku(l,s,r,n,f=>u=f);l.type!==ro&&Ha(l,u);let d=n.subTree&&AC(n.subTree);if(d&&d.type!==ro&&!Ss(d,l)&&Xy(n).type!==ro){let f=Ku(d,s,r,n);if(Ha(d,f),a==="out-in"&&l.type!==ro)return r.isLeaving=!0,f.afterLeave=()=>{r.isLeaving=!1,n.job.flags&8||n.update(),delete f.afterLeave,d=void 0},Iy(i);a==="in-out"&&l.type!==ro?f.delayLeave=(p,g,v)=>{const y=_C(r,d);y[String(d.key)]=d,p[As]=()=>{g(),p[As]=void 0,delete u.delayedLeave,d=void 0},u.delayedLeave=()=>{v(),delete u.delayedLeave,d=void 0}}:d=void 0}else d&&(d=void 0);return i}}},Zy=vk,ah=new WeakMap,Qy=!1,jc=()=>{Qy||(console.error("Hydration completed but contains mismatches."),Qy=!0)},yk=e=>e.namespaceURI.includes("svg")&&e.tagName!=="foreignObject",bk=e=>e.namespaceURI.includes("MathML"),lh=e=>{if(e.nodeType===1){if(yk(e))return"svg";if(bk(e))return"mathml"}},Uc=e=>e.nodeType===8,Jy="data-allow-mismatch",wk={0:"text",1:"children",2:"class",3:"style",4:"attribute"},Ck=Bf().requestIdleCallback||(e=>setTimeout(e,1)),kk=Bf().cancelIdleCallback||(e=>clearTimeout(e)),Sk=(e=1e4)=>t=>{const n=Ck(t,{timeout:e});return()=>kk(n)},_k=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(p6(o))return t(),r.disconnect(),!1;r.observe(o)}}),()=>r.disconnect()},Ak=e=>t=>{if(e){const n=matchMedia(e);if(n.matches)t();else return n.addEventListener("change",t,{once:!0}),()=>n.removeEventListener("change",t)}},Ik=(e=[])=>(t,n)=>{br(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},ra=e=>!!e.type.__asyncLoader,ed=e=>e.type.__isKeepAlive,Ek={name:"KeepAlive",__isKeepAlive:!0,props:{include:[String,RegExp,Array],exclude:[String,RegExp,Array],max:[String,Number]},setup(e,{slots:t}){const n=Vr(),r=n.ctx;if(!r.renderer)return()=>{const E=t.default&&t.default();return E&&E.length===1?E[0]:E};const o=new Map,i=new Set;let s=null;const a=n.suspense,{renderer:{p:l,m:u,um:d,o:{createElement:f}}}=r,p=f("div");r.activate=(E,k,C,x,D)=>{const P=E.component;u(E,k,C,0,a),l(P.vnode,E,k,C,P,a,x,E.slotScopeIds,D),uo(()=>{P.isDeactivated=!1,P.a&&Pc(P.a);const W=E.props&&E.props.onVnodeMounted;W&&Mi(W,P.parent,E)},a)},r.deactivate=E=>{const k=E.component;om(k.m),om(k.a),u(E,p,null,1,a),uo(()=>{k.da&&Pc(k.da);const C=E.props&&E.props.onVnodeUnmounted;C&&Mi(C,k.parent,E),k.isDeactivated=!0},a)};function g(E){Ry(E),d(E,n,a,!0)}function v(E){o.forEach((k,C)=>{const x=jy(ra(k)?k.type.__asyncResolved||{}:k.type);x&&!E(x)&&y(C)})}function y(E){const k=o.get(E);k&&(!s||!Ss(k,s))?g(k):s&&Ry(s),o.delete(E),i.delete(E)}Kt(()=>[e.include,e.exclude],([E,k])=>{E&&v(C=>Qf(E,C)),k&&v(C=>!Qf(k,C))},{flush:"post",deep:!0});let _=null;const w=()=>{_!=null&&(dh(n.subTree.type)?uo(()=>{o.set(_,Qp(n.subTree))},n.subTree.suspense):o.set(_,Qp(n.subTree)))};return tr(w),ch(w),wr(()=>{o.forEach(E=>{const{subTree:k,suspense:C}=n,x=Qp(k);if(E.type===x.type&&E.key===x.key){Ry(x);const D=x.component.da;D&&uo(D,C);return}g(E)})}),()=>{if(_=null,!t.default)return s=null;const E=t.default(),k=E[0];if(E.length>1)return s=null,E;if(!Ga(k)||!(k.shapeFlag&4)&&!(k.shapeFlag&128))return s=null,k;let C=Qp(k);if(C.type===ro)return s=null,C;const x=C.type,D=jy(ra(C)?C.type.__asyncResolved||{}:x),{include:P,exclude:W,max:N}=e;if(P&&(!D||!Qf(P,D))||W&&D&&Qf(W,D))return C.shapeFlag&=-257,s=C,k;const L=C.key==null?x:C.key,j=o.get(L);return C.el&&(C=ta(C),k.shapeFlag&128&&(k.ssContent=C)),_=L,j?(C.el=j.el,C.component=j.component,C.transition&&Ha(C,C.transition),C.shapeFlag|=512,i.delete(L),i.add(L)):(i.add(L),N&&i.size>parseInt(N,10)&&y(i.values().next().value)),C.shapeFlag|=256,s=C,dh(k.type)?k:C}}},oa=e=>(t,n=Oo)=>{(!Ul||e==="sp")&&Jp(e,(...r)=>t(...r),n)},eb=oa("bm"),tr=oa("m"),am=oa("bu"),ch=oa("u"),wr=oa("bum"),uh=oa("um"),tb=oa("sp"),nb=oa("rtg"),rb=oa("rtc"),lm="components",Tk="directives",ob=Symbol.for("v-ndc"),cm=e=>e?ak(e)?rh(e):cm(e.parent):null,td=hr(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=>cm(e.parent),$root:e=>cm(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>Dy(e),$forceUpdate:e=>e.f||(e.f=()=>{ky(e.update)}),$nextTick:e=>e.n||(e.n=Tt.bind(e.proxy)),$watch:e=>c6.bind(e)}),um=(e,t)=>e!==Yn&&!e.__isScriptSetup&&sr(e,t),dm={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(um(r,t))return s[t]=1,r[t];if(o!==Yn&&sr(o,t))return s[t]=2,o[t];if(sr(i,t))return s[t]=3,i[t];if(n!==Yn&&sr(n,t))return s[t]=4,n[t];fm&&(s[t]=0)}}const u=td[t];let d,f;if(u)return t==="$attrs"&&ti(e.attrs,"get",""),u(e);if((d=a.__cssModules)&&(d=d[t]))return d;if(n!==Yn&&sr(n,t))return s[t]=4,n[t];if(f=l.config.globalProperties,sr(f,t))return f[t]},set({_:e},t,n){const{data:r,setupState:o,ctx:i}=e;return um(o,t)?(o[t]=n,!0):r!==Yn&&sr(r,t)?(r[t]=n,!0):sr(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!==Yn&&a[0]!=="$"&&sr(e,a)||um(t,a)||sr(i,a)||sr(r,a)||sr(td,a)||sr(o.config.globalProperties,a)||(l=s.__cssModules)&&l[a])},defineProperty(e,t,n){return n.get!=null?e._.accessCache[t]=0:sr(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}},xk=hr({},dm,{get(e,t){if(t!==Symbol.unscopables)return dm.get(e,t,e)},has(e,t){return t[0]!=="_"&&!Mw(t)}}),fm=!0,Rk={data:BC,props:zC,emits:zC,methods:eh,computed:eh,beforeCreate:vi,created:vi,beforeMount:vi,mounted:vi,beforeUpdate:vi,updated:vi,beforeDestroy:vi,beforeUnmount:vi,destroyed:vi,unmounted:vi,activated:vi,deactivated:vi,errorCaptured:vi,serverPrefetch:vi,components:eh,directives:eh,watch:D6,provide:BC,inject:O6},Mk=0,zl=null,ib=(e,t)=>t==="modelValue"||t==="model-value"?e.modelModifiers:e[`${t}Modifiers`]||e[`${co(t)}Modifiers`]||e[`${gi(t)}Modifiers`],Lk=new WeakMap,Ok=e=>{let t;for(const n in e)(n==="class"||n==="style"||zu(n))&&((t||(t={}))[n]=e[n]);return t},Dk=(e,t)=>{const n={};for(const r in e)(!Lf(r)||!(r.slice(9)in t))&&(n[r]=e[r]);return n},sb={},ab=()=>Object.create(sb),lb=e=>Object.getPrototypeOf(e)===sb,Pk=new WeakMap,hm=e=>e==="_"||e==="_ctx"||e==="$stable",pm=e=>Qt(e)?e.map(Ri):[Ri(e)],Fk=(e,t,n)=>{if(t._n)return t;const r=Mo((...o)=>pm(t(...o)),n);return r._c=!1,r},cb=(e,t,n)=>{const r=e._ctx;for(const o in e){if(hm(o))continue;const i=e[o];if(bn(i))t[o]=Fk(o,i,r);else if(i!=null){const s=pm(i);t[o]=()=>s}}},ub=(e,t)=>{const n=pm(t);e.slots.default=()=>n},db=(e,t,n)=>{for(const r in t)(n||!hm(r))&&(e[r]=t[r])},Nk=(e,t,n)=>{const r=e.slots=ab();if(e.vnode.shapeFlag&32){const o=t._;o?(db(r,t,n),n&&Zv(r,"_",o,!0)):cb(t,r)}else t&&ub(e,t)},Bk=(e,t,n)=>{const{vnode:r,slots:o}=e;let i=!0,s=Yn;if(r.shapeFlag&32){const a=t._;a?n&&a===1?i=!1:db(o,t,n):(i=!t.$stable,cb(t,o)),s=t}else t&&(ub(e,t),s={default:1});if(i)for(const a in o)!hm(a)&&s[a]==null&&delete o[a]},uo=tk,dh=e=>e.__isSuspense,mm=0,zk={name:"Suspense",__isSuspense:!0,process(e,t,n,r,o,i,s,a,l,u){if(e==null)$6(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}H6(e,t,n,r,o,s,a,l,u)}},hydrate:G6,normalize:W6},Xt=Symbol.for("v-fgt"),qa=Symbol.for("v-txt"),ro=Symbol.for("v-cmt"),Vl=Symbol.for("v-stc"),nd=[],Ko=null,jl=1,fb=({key:e})=>e??null,fh=({ref:e,ref_key:t,ref_for:n})=>(typeof e=="number"&&(e=""+e),e!=null?br(e)||Or(e)||bn(e)?{i:Lo,r:e,k:t,f:!!n}:e:null),vn=Y6,Vk=VC(),jk=0,Oo=null,Vr=()=>Oo||Lo;{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)}};gm=t("__VUE_INSTANCE_SETTERS__",n=>Oo=n),rd=t("__VUE_SSR_SETTERS__",n=>Ul=n)}$c=e=>{const t=Oo;return gm(e),e.scope.on(),()=>{e.scope.off(),gm(t)}},od=()=>{Oo&&Oo.scope.off(),gm(null)},Ul=!1,Uk=()=>!vm,$k={get(e,t){return ti(e,"get",""),e[t]}},ke=(e,t)=>X5(e,t,Ul),pb="3.5.32",Hk=zi,Gk=hk,Wk=Qu,Kk=bC,qk={createComponentInstance:sk,setupComponent:lk,renderComponentRoot:nm,setCurrentRenderingInstance:Yf,isVNode:Ga,normalizeVNode:Ri,getComponentPublicInstance:rh,ensureValidVNode:Oy,pushWarningContext:e6,popWarningContext:t6},t8=null,n8=null,r8=null}));function Xk(e){const t={};for(const M in e)M in kb||(t[M]=e[M]);if(e.css===!1)return t;const{name:n="v",type:r,duration:o,enterFromClass:i=`${n}-enter-from`,enterActiveClass:s=`${n}-enter-active`,enterToClass:a=`${n}-enter-to`,appearFromClass:l=i,appearActiveClass:u=s,appearToClass:d=a,leaveFromClass:f=`${n}-leave-from`,leaveActiveClass:p=`${n}-leave-active`,leaveToClass:g=`${n}-leave-to`}=e,v=o8(o),y=v&&v[0],_=v&&v[1],{onBeforeEnter:w,onEnter:E,onEnterCancelled:k,onLeave:C,onLeaveCancelled:x,onBeforeAppear:D=w,onAppear:P=E,onAppearCancelled:W=k}=t,N=(M,B,R,re)=>{M._enterCancelled=re,$l(M,B?d:a),$l(M,B?u:s),R&&R()},L=(M,B)=>{M._isLeaving=!1,$l(M,f),$l(M,g),$l(M,p),B&&B()},j=M=>(B,R)=>{const re=M?P:E,te=()=>N(B,M,R);Hl(re,[B,te]),Zk(()=>{$l(B,M?l:i),ia(B,M?d:a),_b(re)||Qk(B,r,y,te)})};return hr(t,{onBeforeEnter(M){Hl(w,[M]),ia(M,i),ia(M,s)},onBeforeAppear(M){Hl(D,[M]),ia(M,l),ia(M,u)},onEnter:j(!1),onAppear:j(!0),onLeave(M,B){M._isLeaving=!0;const R=()=>L(M,B);ia(M,f),M._enterCancelled?(ia(M,p),gb(M)):(gb(M),ia(M,p)),Zk(()=>{M._isLeaving&&($l(M,f),ia(M,g),_b(C)||Qk(M,r,_,R))}),Hl(C,[M,R])},onEnterCancelled(M){N(M,!1,void 0,!0),Hl(k,[M])},onAppearCancelled(M){N(M,!0,void 0,!0),Hl(W,[M])},onLeaveCancelled(M){L(M),Hl(x,[M])}})}function o8(e){if(e==null)return null;if(rr(e))return[mb(e.enter),mb(e.leave)];{const t=mb(e);return[t,t]}}function mb(e){return Nf(e)}function ia(e,t){t.split(/\s+/).forEach(n=>n&&e.classList.add(n)),(e[Hc]||(e[Hc]=new Set)).add(t)}function $l(e,t){t.split(/\s+/).forEach(r=>r&&e.classList.remove(r));const n=e[Hc];n&&(n.delete(t),n.size||(e[Hc]=void 0))}function Zk(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}function Qk(e,t,n,r){const o=e._endId=++wS,i=()=>{o===e._endId&&r()};if(n!=null)return setTimeout(i,n);const{type:s,timeout:a,propCount:l}=Jk(e,t);if(!s)return r();const u=s+"end";let d=0;const f=()=>{e.removeEventListener(u,p),i()},p=g=>{g.target===e&&++d>=l&&f()};setTimeout(()=>{d<l&&f()},a+1),e.addEventListener(u,p)}function Jk(e,t){const n=window.getComputedStyle(e),r=v=>(n[v]||"").split(", "),o=r(`${Xa}Delay`),i=r(`${Xa}Duration`),s=eS(o,i),a=r(`${sd}Delay`),l=r(`${sd}Duration`),u=eS(a,l);let d=null,f=0,p=0;t===Xa?s>0&&(d=Xa,f=s,p=i.length):t===sd?u>0&&(d=sd,f=u,p=l.length):(f=Math.max(s,u),d=f>0?s>u?Xa:sd:null,p=d?d===Xa?i.length:l.length:0);const g=d===Xa&&/\b(?:transform|all)(?:,|$)/.test(r(`${Xa}Property`).toString());return{type:d,timeout:f,propCount:p,hasTransform:g}}function eS(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((n,r)=>tS(n)+tS(e[r])))}function tS(e){return e==="auto"?0:Number(e.slice(0,-1).replace(",","."))*1e3}function gb(e){return(e?e.ownerDocument:document).body.offsetHeight}function i8(e,t,n){const r=e[Hc];r&&(t=(t?[t,...r]:[...r]).join(" ")),t==null?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}function hh(e,t){e.style.display=t?e[ph]:"none",e[Ab]=!t}function s8(){Ib.getSSRProps=({value:e})=>{if(!e)return{style:{display:"none"}}}}function a8(e){const t=Vr();if(!t)return;const n=t.ut=(o=e(t.proxy))=>{Array.from(document.querySelectorAll(`[data-v-owner="${t.uid}"]`)).forEach(i=>ym(i,o))},r=()=>{const o=e(t.proxy);t.ce?ym(t.ce,o):vb(t.subTree,o),n(o)};am(()=>{qf(r)}),tr(()=>{Kt(r,zi,{flush:"post"});const o=new MutationObserver(r);o.observe(t.subTree.el.parentNode,{childList:!0}),uh(()=>o.disconnect())})}function vb(e,t){if(e.shapeFlag&128){const n=e.suspense;e=n.activeBranch,n.pendingBranch&&!n.isHydrating&&n.effects.push(()=>{vb(n.activeBranch,t)})}for(;e.component;)e=e.component.subTree;if(e.shapeFlag&1&&e.el)ym(e.el,t);else if(e.type===Xt)e.children.forEach(n=>vb(n,t));else if(e.type===Vl){let{el:n,anchor:r}=e;for(;n&&(ym(n,t),n!==r);)n=n.nextSibling}}function ym(e,t){if(e.nodeType===1){const n=e.style;let r="";for(const o in t){const i=F5(t[o]);n.setProperty(`--${o}`,i),r+=`--${o}: ${i};`}n[Eb]=r}}function l8(e,t,n){const r=e.style,o=br(n);let i=!1;if(n&&!o){if(t)if(br(t))for(const s of t.split(";")){const a=s.slice(0,s.indexOf(":")).trim();n[a]==null&&bm(r,a,"")}else for(const s in t)n[s]==null&&bm(r,s,"");for(const s in n)s==="display"&&(i=!0),bm(r,s,n[s])}else if(o){if(t!==n){const s=r[Eb];s&&(n+=";"+s),r.cssText=n,i=CS.test(n)}}else t&&e.removeAttribute("style");ph in e&&(e[ph]=i?r.display:"",e[Ab]&&(r.display="none"))}function bm(e,t,n){if(Qt(n))n.forEach(r=>bm(e,t,r));else if(n==null&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const r=c8(e,t);Tb.test(n)?e.setProperty(gi(r),n.replace(Tb,""),"important"):e[r]=n}}function c8(e,t){const n=Sm[t];if(n)return n;let r=co(t);if(r!=="filter"&&r in e)return Sm[t]=r;r=Vu(r);for(let o=0;o<xb.length;o++){const i=xb[o]+r;if(i in e)return Sm[t]=i}return t}function nS(e,t,n,r,o,i=Pw(t)){r&&t.startsWith("xlink:")?n==null?e.removeAttributeNS(Rb,t.slice(6,t.length)):e.setAttributeNS(Rb,t,n):n==null||i&&!_w(n)?e.removeAttribute(t):e.setAttribute(t,i?"":Ei(n)?String(n):n)}function rS(e,t,n,r,o){if(t==="innerHTML"||t==="textContent"){n!=null&&(e[t]=t==="innerHTML"?bb(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=_w(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 Ya(e,t,n,r){e.addEventListener(t,n,r)}function u8(e,t,n,r){e.removeEventListener(t,n,r)}function d8(e,t,n,r,o=null){const i=e[Mb]||(e[Mb]={}),s=i[t];if(r&&s)s.value=r;else{const[a,l]=f8(t);r?Ya(e,a,i[t]=h8(r,o),l):s&&(u8(e,a,s,l),i[t]=void 0)}}function f8(e){let t;if(Lb.test(e)){t={};let n;for(;n=e.match(Lb);)e=e.slice(0,e.length-n[0].length),t[n[0].toLowerCase()]=!0}return[e[2]===":"?e.slice(3):gi(e.slice(2)),t]}function h8(e,t){const n=r=>{if(!r._vts)r._vts=Date.now();else if(r._vts<=n.attached)return;ls(p8(r,n.value),t,5,[r])};return n.value=e,n.attached=SS(),n}function p8(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 m8(e,t,n,r){if(r)return!!(t==="innerHTML"||t==="textContent"||t in e&&Ob(t)&&bn(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 Ob(t)&&br(n)?!1:t in e}function g8(e,t){const n=e._def.props;if(!n)return!1;const r=co(t);return Array.isArray(n)?n.some(o=>co(o)===r):Object.keys(n).some(o=>co(o)===r)}function oS(e,t,n){let r=Pl(e,t);Of(r)&&(r=hr({},r,t));class o extends Fb{constructor(s){super(r,s,n)}}return o.def=r,o}function iS(e){const t=Vr(),n=t&&t.ce;return n||null}function v8(){const e=iS();return e&&e.shadowRoot}function y8(e="$style"){{const t=Vr();if(!t)return Yn;const n=t.type.__cssModules;if(!n)return Yn;const r=n[e];return r||Yn}}function b8(e){const t=e.el;t[mh]&&t[mh](),t[zb]&&t[zb]()}function w8(e){Bb.set(e,sS(e.el))}function C8(e){const t=Nb.get(e),n=Bb.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 sS(e){const t=e.getBoundingClientRect();return{left:t.left,top:t.top}}function k8(e,t,n){const r=e.cloneNode(),o=e[Hc];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}=Jk(r);return i.removeChild(r),s}function S8(e){e.target.composing=!0}function aS(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}function lS(e,t,n){return t&&(e=e.trim()),n&&(e=Ff(e)),e}function cS(e,{value:t,oldValue:n},r){e._modelValue=t;let o;if(Qt(t))o=Dp(t,r.props.value)>-1;else if(Ll(t))o=t.has(r.props.value);else{if(t===n)return;o=Na(t,dS(e,!0))}e.checked!==o&&(e.checked=o)}function uS(e,t){const n=e.multiple,r=Qt(t);if(!(n&&!r&&!Ll(t))){for(let o=0,i=e.options.length;o<i;o++){const s=e.options[o],a=id(s);if(n)if(r){const l=typeof a;l==="string"||l==="number"?s.selected=t.some(u=>String(u)===String(a)):s.selected=Dp(t,a)>-1}else s.selected=t.has(a);else if(Na(id(s),t)){e.selectedIndex!==o&&(e.selectedIndex=o);return}}!n&&e.selectedIndex!==-1&&(e.selectedIndex=-1)}}function id(e){return"_value"in e?e._value:e.value}function dS(e,t){const n=t?"_trueValue":"_falseValue";return n in e?e[n]:t}function fS(e,t){switch(e){case"SELECT":return Im;case"TEXTAREA":return Hi;default:switch(t){case"checkbox":return ad;case"radio":return Am;default:return Hi}}}function wm(e,t,n,r,o){const i=fS(e.tagName,n.props&&n.props.type)[o];i&&i(e,t,n,r)}function _8(){Hi.getSSRProps=({value:e})=>({value:e}),Am.getSSRProps=({value:e},t)=>{if(t.props&&Na(t.props.value,e))return{checked:!0}},ad.getSSRProps=({value:e},t)=>{if(Qt(e)){if(t.props&&Dp(e,t.props.value)>-1)return{checked:!0}}else if(Ll(e)){if(t.props&&e.has(t.props.value))return{checked:!0}}else if(e)return{checked:!0}},Vb.getSSRProps=(e,t)=>{if(typeof t.type!="string")return;const n=fS(t.type.toUpperCase(),t.props&&t.props.type);if(n.getSSRProps)return n.getSSRProps(e,t)}}function hS(){return gh||(gh=KC(jb))}function pS(){return gh=Ub?gh:qC(jb),Ub=!0,gh}function mS(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function gS(e){return br(e)?document.querySelector(e):e}var Cm,yb,bb,vS,yS,sa,wb,Cb,Xa,sd,Hc,kb,Sb,bS,km,Hl,_b,wS,ph,Ab,Ib,Eb,CS,Tb,xb,Sm,Rb,Mb,Lb,_m,kS,SS,Ob,Db,Pb,_S,AS,Fb,Nb,Bb,mh,zb,IS,ES,Za,$i,Hi,ad,Am,Im,Vb,TS,xS,pn,RS,yi,jb,gh,Ub,$b,MS,Gc,Hb,Gb,LS,A8=to((()=>{if(Yk(),Yk(),ty(),Cm=void 0,yb=typeof window<"u"&&window.trustedTypes,yb)try{Cm=yb.createPolicy("vue",{createHTML:e=>e})}catch{}bb=Cm?e=>Cm.createHTML(e):e=>e,vS="http://www.w3.org/2000/svg",yS="http://www.w3.org/1998/Math/MathML",sa=typeof document<"u"?document:null,wb=sa&&sa.createElement("template"),Cb={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"?sa.createElementNS(vS,e):t==="mathml"?sa.createElementNS(yS,e):n?sa.createElement(e,{is:n}):sa.createElement(e);return e==="select"&&r&&r.multiple!=null&&o.setAttribute("multiple",r.multiple),o},createText:e=>sa.createTextNode(e),createComment:e=>sa.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>sa.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{wb.innerHTML=bb(r==="svg"?`<svg>${e}</svg>`:r==="mathml"?`<math>${e}</math>`:e);const a=wb.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]}},Xa="transition",sd="animation",Hc=Symbol("_vtc"),kb={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},Sb=hr({},sm,kb),bS=e=>(e.displayName="Transition",e.props=Sb,e),km=bS((e,{slots:t})=>no(Zy,Xk(e),t)),Hl=(e,t=[])=>{Qt(e)?e.forEach(n=>n(...t)):e&&e(...t)},_b=e=>e?Qt(e)?e.some(t=>t.length>1):e.length>1:!1,wS=0,ph=Symbol("_vod"),Ab=Symbol("_vsh"),Ib={name:"show",beforeMount(e,{value:t},{transition:n}){e[ph]=e.style.display==="none"?"":e.style.display,n&&t?n.beforeEnter(e):hh(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),hh(e,!0),r.enter(e)):r.leave(e,()=>{hh(e,!1)}):hh(e,t))},beforeUnmount(e,{value:t}){hh(e,t)}},Eb=Symbol(""),CS=/(?:^|;)\s*display\s*:/,Tb=/\s*!important$/,xb=["Webkit","Moz","ms"],Sm={},Rb="http://www.w3.org/1999/xlink",Mb=Symbol("_vei"),Lb=/(?:Once|Passive|Capture)$/,_m=0,kS=Promise.resolve(),SS=()=>_m||(kS.then(()=>_m=0),_m=Date.now()),Ob=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,Db=(e,t,n,r,o,i)=>{const s=o==="svg";t==="class"?i8(e,r,s):t==="style"?l8(e,n,r):zu(t)?Lf(t)||d8(e,t,n,r,i):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):m8(e,t,r,s))?(rS(e,t,r),!e.tagName.includes("-")&&(t==="value"||t==="checked"||t==="selected")&&nS(e,t,r,s,i,t!=="value")):e._isVueCE&&(g8(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!br(r)))?rS(e,co(t),r,i,t):(t==="true-value"?e._trueValue=r:t==="false-value"&&(e._falseValue=r),nS(e,t,r,s))},Pb={},_S=((e,t)=>oS(e,t,Hb)),AS=typeof HTMLElement<"u"?HTMLElement:class{},Fb=class Zx extends AS{constructor(t,n={},r=Gc){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!==Gc?this._root=this.shadowRoot:t.shadowRoot!==!1?(this.attachShadow(hr({},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 Zx){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,Tt(()=>{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]=Nf(this._props[l])),(a||(a=Object.create(null)))[co(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)sr(this,r)||Object.defineProperty(this,r,{get:()=>rt(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(co))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):Pb;const o=co(t);n&&this._numberProps&&this._numberProps[o]&&(r=Nf(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===Pb?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(gi(t),""):typeof n=="string"||typeof n=="number"?this.setAttribute(gi(t),n+""):n||this.removeAttribute(gi(t)),i&&i.observe(this,{attributes:!0})}}_update(){const t=this._createVNode();this._app&&(t.appContext=this._app._context),$b(t,this._root)}_createVNode(){const t={};this.shadowRoot||(t.onVnodeMounted=t.onVnodeUpdated=this._renderSlots.bind(this));const n=vn(this._def,hr(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,Of(s[0])?hr({detail:s},s[0]):{detail:s}))};r.emit=(i,...s)=>{o(i,s),gi(i)!==i&&o(gi(i),s)},this._setParent()}),n}_applyStyles(t,n,r){if(!t)return;if(n){if(n===this._def||this._styleChildren.has(n))return;this._styleChildren.add(n)}const o=this._nonce,i=this.shadowRoot,s=r?this._getStyleAnchor(r)||this._getStyleAnchor(this._def):this._getRootStyleInsertionAnchor(i);let a=null;for(let l=t.length-1;l>=0;l--){const u=document.createElement("style");o&&u.setAttribute("nonce",o),u.textContent=t[l],i.insertBefore(u,a||s),a=u,l===0&&(r||this._styleAnchors.set(this._def,u),n&&this._styleAnchors.set(n,u))}}_getStyleAnchor(t){if(!t)return null;const n=this._styleAnchors.get(t);return n&&n.parentNode===this.shadowRoot?n:(n&&this._styleAnchors.delete(t),null)}_getRootStyleInsertionAnchor(t){for(let n=0;n<t.childNodes.length;n++){const r=t.childNodes[n];if(!(r instanceof HTMLStyleElement))return r}return null}_parseSlots(){const t=this._slots={};let n;for(;n=this.firstChild;){const r=n.nodeType===1&&n.getAttribute("slot")||"default";(t[r]||(t[r]=[])).push(n),this.removeChild(n)}}_renderSlots(){const t=this._getSlots(),n=this._instance.type.__scopeId;for(let r=0;r<t.length;r++){const o=t[r],i=o.getAttribute("name")||"default",s=this._slots[i],a=o.parentNode;if(s)for(const l of s){if(n&&l.nodeType===1){const u=n+"-s",d=document.createTreeWalker(l,1);l.setAttribute(u,"");let f;for(;f=d.nextNode();)f.setAttribute(u,"")}a.insertBefore(l,o)}else for(;o.firstChild;)a.insertBefore(o.firstChild,o);a.removeChild(o)}}_getSlots(){const t=[this];this._teleportTargets&&t.push(...this._teleportTargets);const n=new Set;for(const r of t){const o=r.querySelectorAll("slot");for(let i=0;i<o.length;i++)n.add(o[i])}return Array.from(n)}_injectChildStyle(t,n){this._applyStyles(t.styles,t,n)}_beginPatch(){this._patching=!0,this._dirty=!1}_endPatch(){this._patching=!1,this._dirty&&this._instance&&this._update()}_hasShadowRoot(){return this._def.shadowRoot!==!1}_removeChildStyle(t){}},Nb=new WeakMap,Bb=new WeakMap,mh=Symbol("_moveCb"),zb=Symbol("_enterCb"),IS=e=>(delete e.props.mode,e),ES=IS({name:"TransitionGroup",props:hr({},Sb,{tag:String,moveClass:String}),setup(e,{slots:t}){const n=Vr(),r=Ay();let o,i;return ch(()=>{if(!o.length)return;const s=e.moveClass||`${e.name||"v"}-move`;if(!k8(o[0].el,n.vnode.el,s)){o=[];return}o.forEach(b8),o.forEach(w8);const a=o.filter(C8);gb(n.vnode.el),a.forEach(l=>{const u=l.el,d=u.style;ia(u,s),d.transform=d.webkitTransform=d.transitionDuration="";const f=u[mh]=p=>{p&&p.target!==u||(!p||p.propertyName.endsWith("transform"))&&(u.removeEventListener("transitionend",f),u[mh]=null,$l(u,s))};u.addEventListener("transitionend",f)}),o=[]}),()=>{const s=Bn(e),a=Xk(s);let l=s.tag||Xt;if(o=[],i)for(let u=0;u<i.length;u++){const d=i[u];d.el&&d.el instanceof Element&&(o.push(d),Ha(d,Ku(d,a,r,n)),Nb.set(d,sS(d.el)))}i=t.default?Yp(t.default()):[];for(let u=0;u<i.length;u++){const d=i[u];d.key!=null&&Ha(d,Ku(d,a,r,n))}return vn(l,null,i)}}}),Za=e=>{const t=e.props["onUpdate:modelValue"]||!1;return Qt(t)?n=>Pc(t,n):t},$i=Symbol("_assign"),Hi={created(e,{modifiers:{lazy:t,trim:n,number:r}},o){e[$i]=Za(o);const i=r||o.props&&o.props.type==="number";Ya(e,t?"change":"input",s=>{s.target.composing||e[$i](lS(e.value,n,i))}),(n||i)&&Ya(e,"change",()=>{e.value=lS(e.value,n,i)}),t||(Ya(e,"compositionstart",S8),Ya(e,"compositionend",aS),Ya(e,"change",aS))},mounted(e,{value:t}){e.value=t??""},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:r,trim:o,number:i}},s){if(e[$i]=Za(s),e.composing)return;const a=(i||e.type==="number")&&!/^0\d/.test(e.value)?Ff(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)}},ad={deep:!0,created(e,t,n){e[$i]=Za(n),Ya(e,"change",()=>{const r=e._modelValue,o=id(e),i=e.checked,s=e[$i];if(Qt(r)){const a=Dp(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(Ll(r)){const a=new Set(r);i?a.add(o):a.delete(o),s(a)}else s(dS(e,i))})},mounted:cS,beforeUpdate(e,t,n){e[$i]=Za(n),cS(e,t,n)}},Am={created(e,{value:t},n){e.checked=Na(t,n.props.value),e[$i]=Za(n),Ya(e,"change",()=>{e[$i](id(e))})},beforeUpdate(e,{value:t,oldValue:n},r){e[$i]=Za(r),t!==n&&(e.checked=Na(t,r.props.value))}},Im={deep:!0,created(e,{value:t,modifiers:{number:n}},r){const o=Ll(t);Ya(e,"change",()=>{const i=Array.prototype.filter.call(e.options,s=>s.selected).map(s=>n?Ff(id(s)):id(s));e[$i](e.multiple?o?new Set(i):i:i[0]),e._assigning=!0,Tt(()=>{e._assigning=!1})}),e[$i]=Za(r)},mounted(e,{value:t}){uS(e,t)},beforeUpdate(e,t,n){e[$i]=Za(n)},updated(e,{value:t}){e._assigning||uS(e,t)}},Vb={created(e,t,n){wm(e,t,n,null,"created")},mounted(e,t,n){wm(e,t,n,null,"mounted")},beforeUpdate(e,t,n,r){wm(e,t,n,r,"beforeUpdate")},updated(e,t,n,r){wm(e,t,n,r,"updated")}},TS=["ctrl","shift","alt","meta"],xS={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)=>TS.some(n=>e[`${n}Key`]&&!t.includes(n))},pn=(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=xS[t[s]];if(a&&a(o,t))return}return e(o,...i)}))},RS={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},yi=(e,t)=>{const n=e._withKeys||(e._withKeys={}),r=t.join(".");return n[r]||(n[r]=(o=>{if(!("key"in o))return;const i=gi(o.key);if(t.some(s=>s===i||RS[s]===i))return e(o)}))},jb=hr({patchProp:Db},Cb),Ub=!1,$b=((...e)=>{hS().render(...e)}),MS=((...e)=>{pS().hydrate(...e)}),Gc=((...e)=>{const t=hS().createApp(...e),{mount:n}=t;return t.mount=r=>{const o=gS(r);if(!o)return;const i=t._component;!bn(i)&&!i.render&&!i.template&&(i.template=o.innerHTML),o.nodeType===1&&(o.textContent="");const s=n(o,!1,mS(o));return o instanceof Element&&(o.removeAttribute("v-cloak"),o.setAttribute("data-v-app","")),s},t}),Hb=((...e)=>{const t=pS().createApp(...e),{mount:n}=t;return t.mount=r=>{const o=gS(r);if(o)return n(o,!0,mS(o))},t}),Gb=!1,LS=()=>{Gb||(Gb=!0,_8(),s8())}})),I8=xf({BaseTransition:()=>Zy,BaseTransitionPropsValidators:()=>sm,Comment:()=>ro,DeprecationTypes:()=>null,EffectScope:()=>$p,ErrorCodes:()=>fk,ErrorTypeStrings:()=>Gk,Fragment:()=>Xt,KeepAlive:()=>Ek,ReactiveEffect:()=>$u,Static:()=>Vl,Suspense:()=>zk,Teleport:()=>Bl,Text:()=>qa,TrackOpTypes:()=>pC,Transition:()=>km,TransitionGroup:()=>ES,TriggerOpTypes:()=>mC,VueElement:()=>Fb,assertNumber:()=>n6,callWithAsyncErrorHandling:()=>ls,callWithErrorHandling:()=>Wu,camelize:()=>co,capitalize:()=>Vu,cloneVNode:()=>ta,compatUtils:()=>null,compile:()=>OS,computed:()=>ke,createApp:()=>Gc,createBlock:()=>xn,createCommentVNode:()=>pt,createElementBlock:()=>Ce,createElementVNode:()=>he,createHydrationRenderer:()=>qC,createPropsRestProxy:()=>x6,createRenderer:()=>KC,createSSRApp:()=>Hb,createSlots:()=>y6,createStaticVNode:()=>ik,createTextVNode:()=>ji,createVNode:()=>vn,customRef:()=>Ww,defineAsyncComponent:()=>TC,defineComponent:()=>Pl,defineCustomElement:()=>oS,defineEmits:()=>C6,defineExpose:()=>k6,defineModel:()=>A6,defineOptions:()=>S6,defineProps:()=>w6,defineSSRCustomElement:()=>_S,defineSlots:()=>_6,devtools:()=>Wk,effect:()=>z5,effectScope:()=>ny,getCurrentInstance:()=>Vr,getCurrentScope:()=>ry,getCurrentWatcher:()=>Z5,getTransitionRawChildren:()=>Yp,guardReactiveProps:()=>ok,h:()=>no,handleError:()=>Nc,hasInjectionContext:()=>wC,hydrate:()=>MS,hydrateOnIdle:()=>Sk,hydrateOnInteraction:()=>Ik,hydrateOnMediaQuery:()=>Ak,hydrateOnVisible:()=>_k,initCustomFormatter:()=>J6,initDirectivesForSSR:()=>LS,inject:()=>ea,isMemoSame:()=>dk,isProxy:()=>Vf,isReactive:()=>Ti,isReadonly:()=>Qs,isRef:()=>Or,isRuntimeOnly:()=>Uk,isShallow:()=>xi,isVNode:()=>Ga,markRaw:()=>Wo,mergeDefaults:()=>E6,mergeModels:()=>T6,mergeProps:()=>na,nextTick:()=>Tt,nodeOps:()=>Cb,normalizeClass:()=>gn,normalizeProps:()=>Kv,normalizeStyle:()=>Nn,onActivated:()=>Ty,onBeforeMount:()=>eb,onBeforeUnmount:()=>wr,onBeforeUpdate:()=>am,onDeactivated:()=>xy,onErrorCaptured:()=>RC,onMounted:()=>tr,onRenderTracked:()=>rb,onRenderTriggered:()=>nb,onScopeDispose:()=>Fw,onServerPrefetch:()=>tb,onUnmounted:()=>uh,onUpdated:()=>ch,onWatcherCleanup:()=>Yw,openBlock:()=>ge,patchProp:()=>Db,popScopeId:()=>s6,provide:()=>Sy,proxyRefs:()=>uy,pushScopeId:()=>i6,queuePostFlushCb:()=>qf,reactive:()=>ho,readonly:()=>jp,ref:()=>oe,registerRuntimeCompiler:()=>Z6,render:()=>$b,renderList:()=>Wn,renderSlot:()=>Yu,resolveComponent:()=>v6,resolveDirective:()=>MC,resolveDynamicComponent:()=>My,resolveFilter:()=>null,resolveTransitionHooks:()=>Ku,setBlockTracking:()=>nh,setDevtoolsHook:()=>Kk,setTransitionHooks:()=>Ha,shallowReactive:()=>Hw,shallowReadonly:()=>K5,shallowRef:()=>qr,ssrContextKey:()=>Hy,ssrUtils:()=>qk,stop:()=>V5,toDisplayString:()=>Rt,toHandlerKey:()=>ju,toHandlers:()=>b6,toRaw:()=>Bn,toRef:()=>dy,toRefs:()=>Kw,toValue:()=>Y5,transformVNodeArgs:()=>q6,triggerRef:()=>q5,unref:()=>rt,useAttrs:()=>DC,useCssModule:()=>y8,useCssVars:()=>a8,useHost:()=>iS,useId:()=>d6,useModel:()=>F6,useSSRContext:()=>Gy,useShadowRoot:()=>v8,useSlots:()=>OC,useTemplateRef:()=>f6,useTransitionState:()=>Ay,vModelCheckbox:()=>ad,vModelDynamic:()=>Vb,vModelRadio:()=>Am,vModelSelect:()=>Im,vModelText:()=>Hi,vShow:()=>Ib,version:()=>pb,warn:()=>Hk,watch:()=>Kt,watchEffect:()=>a6,watchPostEffect:()=>l6,watchSyncEffect:()=>CC,withAsyncContext:()=>R6,withCtx:()=>Mo,withDefaults:()=>I6,withDirectives:()=>Vi,withKeys:()=>yi,withMemo:()=>e8,withModifiers:()=>pn,withScopeId:()=>pk}),OS,Wt=to((()=>{A8(),OS=()=>{}})),E8=gw(((e,t)=>{(function(n){typeof e=="object"&&typeof t<"u"?t.exports=n():typeof define=="function"&&define.amd?define([],n):(typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:this).JSZip=n()})(function(){return(function n(r,o,i){function s(u,d){if(!o[u]){if(!r[u]){var f=typeof require=="function"&&require;if(!d&&f)return f(u,!0);if(a)return a(u,!0);var p=new Error("Cannot find module '"+u+"'");throw p.code="MODULE_NOT_FOUND",p}var g=o[u]={exports:{}};r[u][0].call(g.exports,function(v){var y=r[u][1][v];return s(y||v)},g,g.exports,n,r,o,i)}return o[u].exports}for(var a=typeof require=="function"&&require,l=0;l<i.length;l++)s(i[l]);return s})({1:[function(n,r,o){"use strict";var i=n("./utils"),s=n("./support"),a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";o.encode=function(l){for(var u,d,f,p,g,v,y,_=[],w=0,E=l.length,k=E,C=i.getTypeOf(l)!=="string";w<l.length;)k=E-w,f=C?(u=l[w++],d=w<E?l[w++]:0,w<E?l[w++]:0):(u=l.charCodeAt(w++),d=w<E?l.charCodeAt(w++):0,w<E?l.charCodeAt(w++):0),p=u>>2,g=(3&u)<<4|d>>4,v=1<k?(15&d)<<2|f>>6:64,y=2<k?63&f:64,_.push(a.charAt(p)+a.charAt(g)+a.charAt(v)+a.charAt(y));return _.join("")},o.decode=function(l){var u,d,f,p,g,v,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 E,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(E=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|(g=a.indexOf(l.charAt(y++)))>>2,f=(3&g)<<6|(v=a.indexOf(l.charAt(y++))),E[_++]=u,g!==64&&(E[_++]=d),v!==64&&(E[_++]=f);return E}},{"./support":30,"./utils":32}],2:[function(n,r,o){"use strict";var i=n("./external"),s=n("./stream/DataWorker"),a=n("./stream/Crc32Probe"),l=n("./stream/DataLengthProbe");function u(d,f,p,g,v){this.compressedSize=d,this.uncompressedSize=f,this.crc32=p,this.compression=g,this.compressedContent=v}u.prototype={getContentWorker:function(){var d=new s(i.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new l("data_length")),f=this;return d.on("end",function(){if(this.streamInfo.data_length!==f.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),d},getCompressedWorker:function(){return new s(i.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},u.createWorkerFrom=function(d,f,p){return d.pipe(new a).pipe(new l("uncompressedSize")).pipe(f.compressWorker(p)).pipe(new l("compressedSize")).withStreamInfo("compression",f)},r.exports=u},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(n,r,o){"use strict";var i=n("./stream/GenericWorker");o.STORE={magic:"\0\0",compressWorker:function(){return new i("STORE compression")},uncompressWorker:function(){return new i("STORE decompression")}},o.DEFLATE=n("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(n,r,o){"use strict";var i=n("./utils"),s=(function(){for(var a,l=[],u=0;u<256;u++){a=u;for(var d=0;d<8;d++)a=1&a?3988292384^a>>>1:a>>>1;l[u]=a}return l})();r.exports=function(a,l){return a!==void 0&&a.length?i.getTypeOf(a)!=="string"?(function(u,d,f,p){var g=s,v=p+f;u^=-1;for(var y=p;y<v;y++)u=u>>>8^g[255&(u^d[y])];return-1^u})(0|l,a,a.length,0):(function(u,d,f,p){var g=s,v=p+f;u^=-1;for(var y=p;y<v;y++)u=u>>>8^g[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(f,p){l.call(this,"FlateWorker/"+f),this._pako=null,this._pakoAction=f,this._pakoOptions=p,this.meta={}}o.magic="\b\0",a.inherits(d,l),d.prototype.processChunk=function(f){this.meta=f.meta,this._pako===null&&this._createPako(),this._pako.push(a.transformTo(u,f.data),!1)},d.prototype.flush=function(){l.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},d.prototype.cleanUp=function(){l.prototype.cleanUp.call(this),this._pako=null},d.prototype._createPako=function(){this._pako=new s[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var f=this;this._pako.onData=function(p){f.push({data:p,meta:f.meta})}},o.compressWorker=function(f){return new d("Deflate",f)},o.uncompressWorker=function(){return new d("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(n,r,o){"use strict";function i(g,v){var y,_="";for(y=0;y<v;y++)_+=String.fromCharCode(255&g),g>>>=8;return _}function s(g,v,y,_,w,E){var k,C,x=g.file,D=g.compression,P=E!==u.utf8encode,W=a.transformTo("string",E(x.name)),N=a.transformTo("string",u.utf8encode(x.name)),L=x.comment,j=a.transformTo("string",E(L)),M=a.transformTo("string",u.utf8encode(L)),B=N.length!==x.name.length,R=M.length!==L.length,re="",te="",Y="",X=x.dir,U=x.date,Oe={crc32:0,compressedSize:0,uncompressedSize:0};v&&!y||(Oe.crc32=g.crc32,Oe.compressedSize=g.compressedSize,Oe.uncompressedSize=g.uncompressedSize);var me=0;v&&(me|=8),P||!B&&!R||(me|=2048);var ce=0,ve=0;X&&(ce|=16),w==="UNIX"?(ve=798,ce|=(function($e,ot){var kt=$e;return $e||(kt=ot?16893:33204),(65535&kt)<<16})(x.unixPermissions,X)):(ve=20,ce|=(function($e){return 63&($e||0)})(x.dosPermissions)),k=U.getUTCHours(),k<<=6,k|=U.getUTCMinutes(),k<<=5,k|=U.getUTCSeconds()/2,C=U.getUTCFullYear()-1980,C<<=4,C|=U.getUTCMonth()+1,C<<=5,C|=U.getUTCDate(),B&&(te=i(1,1)+i(d(W),4)+N,re+="up"+i(te.length,2)+te),R&&(Y=i(1,1)+i(d(j),4)+M,re+="uc"+i(Y.length,2)+Y);var Re="";return Re+=`
|
|
4
|
-
\0`,Re+=i(me,2),Re+=D.magic,Re+=i(k,2),Re+=i(C,2),Re+=i(Oe.crc32,4),Re+=i(Oe.compressedSize,4),Re+=i(Oe.uncompressedSize,4),Re+=i(W.length,2),Re+=i(re.length,2),{fileRecord:f.LOCAL_FILE_HEADER+Re+W+re,dirRecord:f.CENTRAL_FILE_HEADER+i(ve,2)+Re+i(j.length,2)+"\0\0\0\0"+i(ce,4)+i(_,4)+W+re+j}}var a=n("../utils"),l=n("../stream/GenericWorker"),u=n("../utf8"),d=n("../crc32"),f=n("../signature");function p(g,v,y,_){l.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=v,this.zipPlatform=y,this.encodeFileName=_,this.streamFiles=g,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(p,l),p.prototype.push=function(g){var v=g.meta.percent||0,y=this.entriesCount,_=this._sources.length;this.accumulate?this.contentBuffer.push(g):(this.bytesWritten+=g.data.length,l.prototype.push.call(this,{data:g.data,meta:{currentFile:this.currentFile,percent:y?(v+100*(y-_-1))/y:100}}))},p.prototype.openedSource=function(g){this.currentSourceOffset=this.bytesWritten,this.currentFile=g.file.name;var v=this.streamFiles&&!g.file.dir;if(v){var y=s(g,v,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:y.fileRecord,meta:{percent:0}})}else this.accumulate=!0},p.prototype.closedSource=function(g){this.accumulate=!1;var v=this.streamFiles&&!g.file.dir,y=s(g,v,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(y.dirRecord),v)this.push({data:(function(_){return f.DATA_DESCRIPTOR+i(_.crc32,4)+i(_.compressedSize,4)+i(_.uncompressedSize,4)})(g),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 g=this.bytesWritten,v=0;v<this.dirRecords.length;v++)this.push({data:this.dirRecords[v],meta:{percent:100}});var y=this.bytesWritten-g,_=(function(w,E,k,C,x){var D=a.transformTo("string",x(C));return f.CENTRAL_DIRECTORY_END+"\0\0\0\0"+i(w,2)+i(w,2)+i(E,4)+i(k,4)+i(D.length,2)+D})(this.dirRecords.length,y,g,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(g){this._sources.push(g);var v=this;return g.on("data",function(y){v.processChunk(y)}),g.on("end",function(){v.closedSource(v.previous.streamInfo),v._sources.length?v.prepareNextSource():v.end()}),g.on("error",function(y){v.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(g){var v=this._sources;if(!l.prototype.error.call(this,g))return!1;for(var y=0;y<v.length;y++)try{v[y].error(g)}catch{}return!0},p.prototype.lock=function(){l.prototype.lock.call(this);for(var g=this._sources,v=0;v<g.length;v++)g[v].lock()},r.exports=p},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(n,r,o){"use strict";var i=n("../compressions"),s=n("./ZipFileWorker");o.generateWorker=function(a,l,u){var d=new s(l.streamFiles,u,l.platform,l.encodeFileName),f=0;try{a.forEach(function(p,g){f++;var v=(function(E,k){var C=E||k,x=i[C];if(!x)throw new Error(C+" is not a valid compression method !");return x})(g.options.compression,l.compression),y=g.options.compressionOptions||l.compressionOptions||{},_=g.dir,w=g.date;g._compressWorker(v,y).withStreamInfo("file",{name:p,dir:_,date:w,comment:g.comment||"",unixPermissions:g.unixPermissions,dosPermissions:g.dosPermissions}).pipe(d)}),d.entriesCount=f}catch(p){d.error(p)}return d}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(n,r,o){"use strict";function i(){if(!(this instanceof i))return new i;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var s=new i;for(var a in this)typeof this[a]!="function"&&(s[a]=this[a]);return s}}(i.prototype=n("./object")).loadAsync=n("./load"),i.support=n("./support"),i.defaults=n("./defaults"),i.version="3.10.1",i.loadAsync=function(s,a){return new i().loadAsync(s,a)},i.external=n("./external"),r.exports=i},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(n,r,o){"use strict";var i=n("./utils"),s=n("./external"),a=n("./utf8"),l=n("./zipEntries"),u=n("./stream/Crc32Probe"),d=n("./nodejsUtils");function f(p){return new s.Promise(function(g,v){var y=p.decompressed.getContentWorker().pipe(new u);y.on("error",function(_){v(_)}).on("end",function(){y.streamInfo.crc32!==p.decompressed.crc32?v(new Error("Corrupted zip : CRC32 mismatch")):g()}).resume()})}r.exports=function(p,g){var v=this;return g=i.extend(g||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:a.utf8decode}),d.isNode&&d.isStream(p)?s.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):i.prepareContent("the loaded zip file",p,!0,g.optimizedBinaryString,g.base64).then(function(y){var _=new l(g);return _.load(y),_}).then(function(y){var _=[s.Promise.resolve(y)],w=y.files;if(g.checkCRC32)for(var E=0;E<w.length;E++)_.push(f(w[E]));return s.Promise.all(_)}).then(function(y){for(var _=y.shift(),w=_.files,E=0;E<w.length;E++){var k=w[E],C=k.fileNameStr,x=i.resolve(k.fileNameStr);v.file(x,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:g.createFolders}),k.dir||(v.file(x).unsafeOriginalName=C)}return _.zipComment.length&&(v.comment=_.zipComment),v})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(n,r,o){"use strict";var i=n("../utils"),s=n("../stream/GenericWorker");function a(l,u){s.call(this,"Nodejs stream input adapter for "+l),this._upstreamEnded=!1,this._bindStream(u)}i.inherits(a,s),a.prototype._bindStream=function(l){var u=this;(this._stream=l).pause(),l.on("data",function(d){u.push({data:d,meta:{percent:0}})}).on("error",function(d){u.isPaused?this.generatedError=d:u.error(d)}).on("end",function(){u.isPaused?u._upstreamEnded=!0:u.end()})},a.prototype.pause=function(){return!!s.prototype.pause.call(this)&&(this._stream.pause(),!0)},a.prototype.resume=function(){return!!s.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},r.exports=a},{"../stream/GenericWorker":28,"../utils":32}],13:[function(n,r,o){"use strict";var i=n("readable-stream").Readable;function s(a,l,u){i.call(this,l),this._helper=a;var d=this;a.on("data",function(f,p){d.push(f)||d._helper.pause(),u&&u(p)}).on("error",function(f){d.emit("error",f)}).on("end",function(){d.push(null)})}n("../utils").inherits(s,i),s.prototype._read=function(){this._helper.resume()},r.exports=s},{"../utils":32,"readable-stream":16}],14:[function(n,r,o){"use strict";r.exports={isNode:typeof Buffer<"u",newBufferFrom:function(i,s){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(i,s);if(typeof i=="number")throw new Error('The "data" argument must not be a number');return new Buffer(i,s)},allocBuffer:function(i){if(Buffer.alloc)return Buffer.alloc(i);var s=new Buffer(i);return s.fill(0),s},isBuffer:function(i){return Buffer.isBuffer(i)},isStream:function(i){return i&&typeof i.on=="function"&&typeof i.pause=="function"&&typeof i.resume=="function"}}},{}],15:[function(n,r,o){"use strict";function i(C,x,D){var P,W=a.getTypeOf(x),N=a.extend(D||{},d);N.date=N.date||new Date,N.compression!==null&&(N.compression=N.compression.toUpperCase()),typeof N.unixPermissions=="string"&&(N.unixPermissions=parseInt(N.unixPermissions,8)),N.unixPermissions&&16384&N.unixPermissions&&(N.dir=!0),N.dosPermissions&&16&N.dosPermissions&&(N.dir=!0),N.dir&&(C=w(C)),N.createFolders&&(P=_(C))&&E.call(this,P,!0);var L=W==="string"&&N.binary===!1&&N.base64===!1;D&&D.binary!==void 0||(N.binary=!L),(x instanceof f&&x.uncompressedSize===0||N.dir||!x||x.length===0)&&(N.base64=!1,N.binary=!0,x="",N.compression="STORE",W="string");var j=null;j=x instanceof f||x instanceof l?x:v.isNode&&v.isStream(x)?new y(C,x):a.prepareContent(C,x,N.binary,N.optimizedBinaryString,N.base64);var M=new p(C,j,N);this.files[C]=M}var s=n("./utf8"),a=n("./utils"),l=n("./stream/GenericWorker"),u=n("./stream/StreamHelper"),d=n("./defaults"),f=n("./compressedObject"),p=n("./zipObject"),g=n("./generate"),v=n("./nodejsUtils"),y=n("./nodejs/NodejsStreamInputAdapter"),_=function(C){C.slice(-1)==="/"&&(C=C.substring(0,C.length-1));var x=C.lastIndexOf("/");return 0<x?C.substring(0,x):""},w=function(C){return C.slice(-1)!=="/"&&(C+="/"),C},E=function(C,x){return x=x!==void 0?x:d.createFolders,C=w(C),this.files[C]||i.call(this,C,null,{dir:!0,createFolders:x}),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 x,D,P;for(x in this.files)P=this.files[x],(D=x.slice(this.root.length,x.length))&&x.slice(0,this.root.length)===this.root&&C(D,P)},filter:function(C){var x=[];return this.forEach(function(D,P){C(D,P)&&x.push(P)}),x},file:function(C,x,D){if(arguments.length!==1)return C=this.root+C,i.call(this,C,x,D),this;if(k(C)){var P=C;return this.filter(function(N,L){return!L.dir&&P.test(N)})}var W=this.files[this.root+C];return W&&!W.dir?W:null},folder:function(C){if(!C)return this;if(k(C))return this.filter(function(W,N){return N.dir&&C.test(W)});var x=this.root+C,D=E.call(this,x),P=this.clone();return P.root=D.name,P},remove:function(C){C=this.root+C;var x=this.files[C];if(x||(C.slice(-1)!=="/"&&(C+="/"),x=this.files[C]),x&&!x.dir)delete this.files[C];else for(var D=this.filter(function(W,N){return N.name.slice(0,C.length)===C}),P=0;P<D.length;P++)delete this.files[D[P].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 x,D={};try{if((D=a.extend(C||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:s.utf8encode})).type=D.type.toLowerCase(),D.compression=D.compression.toUpperCase(),D.type==="binarystring"&&(D.type="string"),!D.type)throw new Error("No output type specified.");a.checkSupport(D.type),D.platform!=="darwin"&&D.platform!=="freebsd"&&D.platform!=="linux"&&D.platform!=="sunos"||(D.platform="UNIX"),D.platform==="win32"&&(D.platform="DOS");var P=D.comment||this.comment||"";x=g.generateWorker(this,D,P)}catch(W){(x=new l("error")).error(W)}return new u(x,D.type||"string",D.mimeType)},generateAsync:function(C,x){return this.generateInternalStream(C).accumulate(x)},generateNodeStream:function(C,x){return(C=C||{}).type||(C.type="nodebuffer"),this.generateInternalStream(C).toNodejsStream(x)}}},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(n,r,o){"use strict";r.exports=n("stream")},{stream:void 0}],17:[function(n,r,o){"use strict";var i=n("./DataReader");function s(a){i.call(this,a);for(var l=0;l<this.data.length;l++)a[l]=255&a[l]}n("../utils").inherits(s,i),s.prototype.byteAt=function(a){return this.data[this.zero+a]},s.prototype.lastIndexOfSignature=function(a){for(var l=a.charCodeAt(0),u=a.charCodeAt(1),d=a.charCodeAt(2),f=a.charCodeAt(3),p=this.length-4;0<=p;--p)if(this.data[p]===l&&this.data[p+1]===u&&this.data[p+2]===d&&this.data[p+3]===f)return p-this.zero;return-1},s.prototype.readAndCheckSignature=function(a){var l=a.charCodeAt(0),u=a.charCodeAt(1),d=a.charCodeAt(2),f=a.charCodeAt(3),p=this.readData(4);return l===p[0]&&u===p[1]&&d===p[2]&&f===p[3]},s.prototype.readData=function(a){if(this.checkOffset(a),a===0)return[];var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=s},{"../utils":32,"./DataReader":18}],18:[function(n,r,o){"use strict";var i=n("../utils");function s(a){this.data=a,this.length=a.length,this.index=0,this.zero=0}s.prototype={checkOffset:function(a){this.checkIndex(this.index+a)},checkIndex:function(a){if(this.length<this.zero+a||a<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+a+"). Corrupted zip ?")},setIndex:function(a){this.checkIndex(a),this.index=a},skip:function(a){this.setIndex(this.index+a)},byteAt:function(){},readInt:function(a){var l,u=0;for(this.checkOffset(a),l=this.index+a-1;l>=this.index;l--)u=(u<<8)+this.byteAt(l);return this.index+=a,u},readString:function(a){return i.transformTo("string",this.readData(a))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var a=this.readInt(4);return new Date(Date.UTC(1980+(a>>25&127),(a>>21&15)-1,a>>16&31,a>>11&31,a>>5&63,(31&a)<<1))}},r.exports=s},{"../utils":32}],19:[function(n,r,o){"use strict";var i=n("./Uint8ArrayReader");function s(a){i.call(this,a)}n("../utils").inherits(s,i),s.prototype.readData=function(a){this.checkOffset(a);var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=s},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(n,r,o){"use strict";var i=n("./DataReader");function s(a){i.call(this,a)}n("../utils").inherits(s,i),s.prototype.byteAt=function(a){return this.data.charCodeAt(this.zero+a)},s.prototype.lastIndexOfSignature=function(a){return this.data.lastIndexOf(a)-this.zero},s.prototype.readAndCheckSignature=function(a){return a===this.readData(4)},s.prototype.readData=function(a){this.checkOffset(a);var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=s},{"../utils":32,"./DataReader":18}],21:[function(n,r,o){"use strict";var i=n("./ArrayReader");function s(a){i.call(this,a)}n("../utils").inherits(s,i),s.prototype.readData=function(a){if(this.checkOffset(a),a===0)return new Uint8Array(0);var l=this.data.subarray(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=s},{"../utils":32,"./ArrayReader":17}],22:[function(n,r,o){"use strict";var i=n("../utils"),s=n("../support"),a=n("./ArrayReader"),l=n("./StringReader"),u=n("./NodeBufferReader"),d=n("./Uint8ArrayReader");r.exports=function(f){var p=i.getTypeOf(f);return i.checkSupport(p),p!=="string"||s.uint8array?p==="nodebuffer"?new u(f):s.uint8array?new d(i.transformTo("uint8array",f)):new a(i.transformTo("array",f)):new l(f)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(n,r,o){"use strict";o.LOCAL_FILE_HEADER="PK",o.CENTRAL_FILE_HEADER="PK",o.CENTRAL_DIRECTORY_END="PK",o.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",o.ZIP64_CENTRAL_DIRECTORY_END="PK",o.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(n,r,o){"use strict";var i=n("./GenericWorker"),s=n("../utils");function a(l){i.call(this,"ConvertWorker to "+l),this.destType=l}s.inherits(a,i),a.prototype.processChunk=function(l){this.push({data:s.transformTo(this.destType,l.data),meta:l.meta})},r.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(n,r,o){"use strict";var i=n("./GenericWorker"),s=n("../crc32");function a(){i.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}n("../utils").inherits(a,i),a.prototype.processChunk=function(l){this.streamInfo.crc32=s(l.data,this.streamInfo.crc32||0),this.push(l)},r.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(n,r,o){"use strict";var i=n("../utils"),s=n("./GenericWorker");function a(l){s.call(this,"DataLengthProbe for "+l),this.propName=l,this.withStreamInfo(l,0)}i.inherits(a,s),a.prototype.processChunk=function(l){if(l){var u=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=u+l.data.length}s.prototype.processChunk.call(this,l)},r.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(n,r,o){"use strict";var i=n("../utils"),s=n("./GenericWorker");function a(l){s.call(this,"DataWorker");var u=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,l.then(function(d){u.dataIsReady=!0,u.data=d,u.max=d&&d.length||0,u.type=i.getTypeOf(d),u.isPaused||u._tickAndRepeat()},function(d){u.error(d)})}i.inherits(a,s),a.prototype.cleanUp=function(){s.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!s.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,i.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(i.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var l=null,u=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":l=this.data.substring(this.index,u);break;case"uint8array":l=this.data.subarray(this.index,u);break;case"array":case"nodebuffer":l=this.data.slice(this.index,u)}return this.index=u,this.push({data:l,meta:{percent:this.max?this.index/this.max*100:0}})},r.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(n,r,o){"use strict";function i(s){this.name=s||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}i.prototype={push:function(s){this.emit("data",s)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(s){this.emit("error",s)}return!0},error:function(s){return!this.isFinished&&(this.isPaused?this.generatedError=s:(this.isFinished=!0,this.emit("error",s),this.previous&&this.previous.error(s),this.cleanUp()),!0)},on:function(s,a){return this._listeners[s].push(a),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(s,a){if(this._listeners[s])for(var l=0;l<this._listeners[s].length;l++)this._listeners[s][l].call(this,a)},pipe:function(s){return s.registerPrevious(this)},registerPrevious:function(s){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=s.streamInfo,this.mergeStreamInfo(),this.previous=s;var a=this;return s.on("data",function(l){a.processChunk(l)}),s.on("end",function(){a.end()}),s.on("error",function(l){a.error(l)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var s=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),s=!0),this.previous&&this.previous.resume(),!s},flush:function(){},processChunk:function(s){this.push(s)},withStreamInfo:function(s,a){return this.extraStreamInfo[s]=a,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var s in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,s)&&(this.streamInfo[s]=this.extraStreamInfo[s])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var s="Worker "+this.name;return this.previous?this.previous+" -> "+s:s}},r.exports=i},{}],29:[function(n,r,o){"use strict";var i=n("../utils"),s=n("./ConvertWorker"),a=n("./GenericWorker"),l=n("../base64"),u=n("../support"),d=n("../external"),f=null;if(u.nodestream)try{f=n("../nodejs/NodejsStreamOutputAdapter")}catch{}function p(v,y){return new d.Promise(function(_,w){var E=[],k=v._internalType,C=v._outputType,x=v._mimeType;v.on("data",function(D,P){E.push(D),y&&y(P)}).on("error",function(D){E=[],w(D)}).on("end",function(){try{_((function(D,P,W){switch(D){case"blob":return i.newBlob(i.transformTo("arraybuffer",P),W);case"base64":return l.encode(P);default:return i.transformTo(D,P)}})(C,(function(D,P){var W,N=0,L=null,j=0;for(W=0;W<P.length;W++)j+=P[W].length;switch(D){case"string":return P.join("");case"array":return Array.prototype.concat.apply([],P);case"uint8array":for(L=new Uint8Array(j),W=0;W<P.length;W++)L.set(P[W],N),N+=P[W].length;return L;case"nodebuffer":return Buffer.concat(P);default:throw new Error("concat : unsupported type '"+D+"'")}})(k,E),x))}catch(D){w(D)}E=[]}).resume()})}function g(v,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=v.pipe(new s(w)),v.lock()}catch(E){this._worker=new a("error"),this._worker.error(E)}}g.prototype={accumulate:function(v){return p(this,v)},on:function(v,y){var _=this;return v==="data"?this._worker.on(v,function(w){y.call(_,w.data,w.meta)}):this._worker.on(v,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(v){if(i.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new f(this,{objectMode:this._outputType!=="nodebuffer"},v)}},r.exports=g},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(n,r,o){"use strict";if(o.base64=!0,o.array=!0,o.string=!0,o.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",o.nodebuffer=typeof Buffer<"u",o.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")o.blob=!1;else{var i=new ArrayBuffer(0);try{o.blob=new Blob([i],{type:"application/zip"}).size===0}catch{try{var s=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);s.append(i),o.blob=s.getBlob("application/zip").size===0}catch{o.blob=!1}}}try{o.nodestream=!!n("readable-stream").Readable}catch{o.nodestream=!1}},{"readable-stream":16}],31:[function(n,r,o){"use strict";for(var i=n("./utils"),s=n("./support"),a=n("./nodejsUtils"),l=n("./stream/GenericWorker"),u=new Array(256),d=0;d<256;d++)u[d]=252<=d?6:248<=d?5:240<=d?4:224<=d?3:192<=d?2:1;u[254]=u[254]=1;function f(){l.call(this,"utf-8 decode"),this.leftOver=null}function p(){l.call(this,"utf-8 encode")}o.utf8encode=function(g){return s.nodebuffer?a.newBufferFrom(g,"utf-8"):(function(v){var y,_,w,E,k,C=v.length,x=0;for(E=0;E<C;E++)(64512&(_=v.charCodeAt(E)))==55296&&E+1<C&&(64512&(w=v.charCodeAt(E+1)))==56320&&(_=65536+(_-55296<<10)+(w-56320),E++),x+=_<128?1:_<2048?2:_<65536?3:4;for(y=s.uint8array?new Uint8Array(x):new Array(x),E=k=0;k<x;E++)(64512&(_=v.charCodeAt(E)))==55296&&E+1<C&&(64512&(w=v.charCodeAt(E+1)))==56320&&(_=65536+(_-55296<<10)+(w-56320),E++),_<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})(g)},o.utf8decode=function(g){return s.nodebuffer?i.transformTo("nodebuffer",g).toString("utf-8"):(function(v){var y,_,w,E,k=v.length,C=new Array(2*k);for(y=_=0;y<k;)if((w=v[y++])<128)C[_++]=w;else if(4<(E=u[w]))C[_++]=65533,y+=E-1;else{for(w&=E===2?31:E===3?15:7;1<E&&y<k;)w=w<<6|63&v[y++],E--;1<E?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)})(g=i.transformTo(s.uint8array?"uint8array":"array",g))},i.inherits(f,l),f.prototype.processChunk=function(g){var v=i.transformTo(s.uint8array?"uint8array":"array",g.data);if(this.leftOver&&this.leftOver.length){if(s.uint8array){var y=v;(v=new Uint8Array(y.length+this.leftOver.length)).set(this.leftOver,0),v.set(y,this.leftOver.length)}else v=this.leftOver.concat(v);this.leftOver=null}var _=(function(E,k){var C;for((k=k||E.length)>E.length&&(k=E.length),C=k-1;0<=C&&(192&E[C])==128;)C--;return C<0||C===0?k:C+u[E[C]]>k?C:k})(v),w=v;_!==v.length&&(s.uint8array?(w=v.subarray(0,_),this.leftOver=v.subarray(_,v.length)):(w=v.slice(0,_),this.leftOver=v.slice(_,v.length))),this.push({data:o.utf8decode(w),meta:g.meta})},f.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:o.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},o.Utf8DecodeWorker=f,i.inherits(p,l),p.prototype.processChunk=function(g){this.push({data:o.utf8encode(g.data),meta:g.meta})},o.Utf8EncodeWorker=p},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(n,r,o){"use strict";var i=n("./support"),s=n("./base64"),a=n("./nodejsUtils"),l=n("./external");function u(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 f={stringifyByChunk:function(y,_,w){var E=[],k=0,C=y.length;if(C<=w)return String.fromCharCode.apply(null,y);for(;k<C;)_==="array"||_==="nodebuffer"?E.push(String.fromCharCode.apply(null,y.slice(k,Math.min(k+w,C)))):E.push(String.fromCharCode.apply(null,y.subarray(k,Math.min(k+w,C)))),k+=w;return E.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),E=!0;if(w==="uint8array"?E=f.applyCanBeUsed.uint8array:w==="nodebuffer"&&(E=f.applyCanBeUsed.nodebuffer),E)for(;1<_;)try{return f.stringifyByChunk(y,w,_)}catch{_=Math.floor(_/2)}return f.stringifyByChar(y)}function g(y,_){for(var w=0;w<y.length;w++)_[w]=y[w];return _}o.applyFromCharCode=p;var v={};v.string={string:u,array:function(y){return d(y,new Array(y.length))},arraybuffer:function(y){return v.string.uint8array(y).buffer},uint8array:function(y){return d(y,new Uint8Array(y.length))},nodebuffer:function(y){return d(y,a.allocBuffer(y.length))}},v.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)}},v.arraybuffer={string:function(y){return p(new Uint8Array(y))},array:function(y){return g(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))}},v.uint8array={string:p,array:function(y){return g(y,new Array(y.length))},arraybuffer:function(y){return y.buffer},uint8array:u,nodebuffer:function(y){return a.newBufferFrom(y)}},v.nodebuffer={string:p,array:function(y){return g(y,new Array(y.length))},arraybuffer:function(y){return v.nodebuffer.uint8array(y).buffer},uint8array:function(y){return g(y,new Uint8Array(y.length))},nodebuffer:u},o.transformTo=function(y,_){return _=_||"",y?(o.checkSupport(y),v[o.getTypeOf(_)][y](_)):_},o.resolve=function(y){for(var _=y.split("/"),w=[],E=0;E<_.length;E++){var k=_[E];k==="."||k===""&&E!==0&&E!==_.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,E="";for(w=0;w<(y||"").length;w++)E+="\\x"+((_=y.charCodeAt(w))<16?"0":"")+_.toString(16).toUpperCase();return E},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,E,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(x,D){var P=new FileReader;P.onload=function(W){x(W.target.result)},P.onerror=function(W){D(W.target.error)},P.readAsArrayBuffer(C)}):C}).then(function(C){var x=o.getTypeOf(C);return x?(x==="arraybuffer"?C=o.transformTo("uint8array",C):x==="string"&&(k?C=s.decode(C):w&&E!==!0&&(C=(function(D){return d(D,i.uint8array?new Uint8Array(D.length):new Array(D.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(f){this.files=[],this.loadOptions=f}d.prototype={checkSignature:function(f){if(!this.reader.readAndCheckSignature(f)){this.reader.index-=4;var p=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+s.pretty(p)+", expected "+s.pretty(f)+")")}},isSignature:function(f,p){var g=this.reader.index;this.reader.setIndex(f);var v=this.reader.readString(4)===p;return this.reader.setIndex(g),v},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var f=this.reader.readData(this.zipCommentLength),p=u.uint8array?"uint8array":"array",g=s.transformTo(p,f);this.zipComment=this.loadOptions.decodeFileName(g)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var f,p,g,v=this.zip64EndOfCentralSize-44;0<v;)f=this.reader.readInt(2),p=this.reader.readInt(4),g=this.reader.readData(p),this.zip64ExtensibleData[f]={id:f,length:p,value:g}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var f,p;for(f=0;f<this.files.length;f++)p=this.files[f],this.reader.setIndex(p.localHeaderOffset),this.checkSignature(a.LOCAL_FILE_HEADER),p.readLocalPart(this.reader),p.handleUTF8(),p.processAttributes()},readCentralDir:function(){var f;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(a.CENTRAL_FILE_HEADER);)(f=new l({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(f);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var f=this.reader.lastIndexOfSignature(a.CENTRAL_DIRECTORY_END);if(f<0)throw this.isSignature(0,a.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(f);var p=f;if(this.checkSignature(a.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===s.MAX_VALUE_16BITS||this.diskWithCentralDirStart===s.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===s.MAX_VALUE_16BITS||this.centralDirRecords===s.MAX_VALUE_16BITS||this.centralDirSize===s.MAX_VALUE_32BITS||this.centralDirOffset===s.MAX_VALUE_32BITS){if(this.zip64=!0,(f=this.reader.lastIndexOfSignature(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(f),this.checkSignature(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,a.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(a.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(a.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var g=this.centralDirOffset+this.centralDirSize;this.zip64&&(g+=20,g+=12+this.zip64EndOfCentralSize);var v=p-g;if(0<v)this.isSignature(p,a.CENTRAL_FILE_HEADER)||(this.reader.zero=v);else if(v<0)throw new Error("Corrupted zip: missing "+Math.abs(v)+" bytes.")},prepareReader:function(f){this.reader=i(f)},load:function(f){this.prepareReader(f),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},r.exports=d},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(n,r,o){"use strict";var i=n("./reader/readerFor"),s=n("./utils"),a=n("./compressedObject"),l=n("./crc32"),u=n("./utf8"),d=n("./compressions"),f=n("./support");function p(g,v){this.options=g,this.loadOptions=v}p.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(g){var v,y;if(g.skip(22),this.fileNameLength=g.readInt(2),y=g.readInt(2),this.fileName=g.readData(this.fileNameLength),g.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((v=(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,v,g.readData(this.compressedSize))},readCentralPart:function(g){this.versionMadeBy=g.readInt(2),g.skip(2),this.bitFlag=g.readInt(2),this.compressionMethod=g.readString(2),this.date=g.readDate(),this.crc32=g.readInt(4),this.compressedSize=g.readInt(4),this.uncompressedSize=g.readInt(4);var v=g.readInt(2);if(this.extraFieldsLength=g.readInt(2),this.fileCommentLength=g.readInt(2),this.diskNumberStart=g.readInt(2),this.internalFileAttributes=g.readInt(2),this.externalFileAttributes=g.readInt(4),this.localHeaderOffset=g.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");g.skip(v),this.readExtraFields(g),this.parseZIP64ExtraField(g),this.fileComment=g.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var g=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),g==0&&(this.dosPermissions=63&this.externalFileAttributes),g==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var g=i(this.extraFields[1].value);this.uncompressedSize===s.MAX_VALUE_32BITS&&(this.uncompressedSize=g.readInt(8)),this.compressedSize===s.MAX_VALUE_32BITS&&(this.compressedSize=g.readInt(8)),this.localHeaderOffset===s.MAX_VALUE_32BITS&&(this.localHeaderOffset=g.readInt(8)),this.diskNumberStart===s.MAX_VALUE_32BITS&&(this.diskNumberStart=g.readInt(4))}},readExtraFields:function(g){var v,y,_,w=g.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});g.index+4<w;)v=g.readInt(2),y=g.readInt(2),_=g.readData(y),this.extraFields[v]={id:v,length:y,value:_};g.setIndex(w)},handleUTF8:function(){var g=f.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=u.utf8decode(this.fileName),this.fileCommentStr=u.utf8decode(this.fileComment);else{var v=this.findExtraFieldUnicodePath();if(v!==null)this.fileNameStr=v;else{var y=s.transformTo(g,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(y)}var _=this.findExtraFieldUnicodeComment();if(_!==null)this.fileCommentStr=_;else{var w=s.transformTo(g,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(w)}}},findExtraFieldUnicodePath:function(){var g=this.extraFields[28789];if(g){var v=i(g.value);return v.readInt(1)!==1||l(this.fileName)!==v.readInt(4)?null:u.utf8decode(v.readData(g.length-5))}return null},findExtraFieldUnicodeComment:function(){var g=this.extraFields[25461];if(g){var v=i(g.value);return v.readInt(1)!==1||l(this.fileComment)!==v.readInt(4)?null:u.utf8decode(v.readData(g.length-5))}return null}},r.exports=p},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(n,r,o){"use strict";function i(v,y,_){this.name=v,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(v){var y=null,_="string";try{if(!v)throw new Error("No output type specified.");var w=(_=v.toLowerCase())==="string"||_==="text";_!=="binarystring"&&_!=="text"||(_="string"),y=this._decompressWorker();var E=!this._dataBinary;E&&!w&&(y=y.pipe(new l.Utf8EncodeWorker)),!E&&w&&(y=y.pipe(new l.Utf8DecodeWorker))}catch(k){(y=new d("error")).error(k)}return new s(y,_,"")},async:function(v,y){return this.internalStream(v).accumulate(y)},nodeStream:function(v,y){return this.internalStream(v||"nodebuffer").toNodejsStream(y)},_compressWorker:function(v,y){if(this._data instanceof u&&this._data.compression.magic===v.magic)return this._data.getCompressedWorker();var _=this._decompressWorker();return this._dataBinary||(_=_.pipe(new l.Utf8EncodeWorker)),u.createWorkerFrom(_,v,y)},_decompressWorker:function(){return this._data instanceof u?this._data.getContentWorker():this._data instanceof d?this._data:new a(this._data)}};for(var f=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],p=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},g=0;g<f.length;g++)i.prototype[f[g]]=p;r.exports=i},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(n,r,o){(function(i){"use strict";var s,a,l=i.MutationObserver||i.WebKitMutationObserver;if(l){var u=0,d=new l(v),f=i.document.createTextNode("");d.observe(f,{characterData:!0}),s=function(){f.data=u=++u%2}}else if(i.setImmediate||i.MessageChannel===void 0)s="document"in i&&"onreadystatechange"in i.document.createElement("script")?function(){var y=i.document.createElement("script");y.onreadystatechange=function(){v(),y.onreadystatechange=null,y.parentNode.removeChild(y),y=null},i.document.documentElement.appendChild(y)}:function(){setTimeout(v,0)};else{var p=new i.MessageChannel;p.port1.onmessage=v,s=function(){p.port2.postMessage(0)}}var g=[];function v(){var y,_;a=!0;for(var w=g.length;w;){for(_=g,g=[],y=-1;++y<w;)_[y]();w=g.length}a=!1}r.exports=function(y){g.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 f(w){if(typeof w!="function")throw new TypeError("resolver must be a function");this.state=d,this.queue=[],this.outcome=void 0,w!==s&&y(this,w)}function p(w,E,k){this.promise=w,typeof E=="function"&&(this.onFulfilled=E,this.callFulfilled=this.otherCallFulfilled),typeof k=="function"&&(this.onRejected=k,this.callRejected=this.otherCallRejected)}function g(w,E,k){i(function(){var C;try{C=E(k)}catch(x){return a.reject(w,x)}C===w?a.reject(w,new TypeError("Cannot resolve promise with itself")):a.resolve(w,C)})}function v(w){var E=w&&w.then;if(w&&(typeof w=="object"||typeof w=="function")&&typeof E=="function")return function(){E.apply(w,arguments)}}function y(w,E){var k=!1;function C(P){k||(k=!0,a.reject(w,P))}function x(P){k||(k=!0,a.resolve(w,P))}var D=_(function(){E(x,C)});D.status==="error"&&C(D.value)}function _(w,E){var k={};try{k.value=w(E),k.status="success"}catch(C){k.status="error",k.value=C}return k}(r.exports=f).prototype.finally=function(w){if(typeof w!="function")return this;var E=this.constructor;return this.then(function(k){return E.resolve(w()).then(function(){return k})},function(k){return E.resolve(w()).then(function(){throw k})})},f.prototype.catch=function(w){return this.then(null,w)},f.prototype.then=function(w,E){if(typeof w!="function"&&this.state===u||typeof E!="function"&&this.state===l)return this;var k=new this.constructor(s);return this.state!==d?g(k,this.state===u?w:E,this.outcome):this.queue.push(new p(k,w,E)),k},p.prototype.callFulfilled=function(w){a.resolve(this.promise,w)},p.prototype.otherCallFulfilled=function(w){g(this.promise,this.onFulfilled,w)},p.prototype.callRejected=function(w){a.reject(this.promise,w)},p.prototype.otherCallRejected=function(w){g(this.promise,this.onRejected,w)},a.resolve=function(w,E){var k=_(v,E);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=E;for(var x=-1,D=w.queue.length;++x<D;)w.queue[x].callFulfilled(E)}return w},a.reject=function(w,E){w.state=l,w.outcome=E;for(var k=-1,C=w.queue.length;++k<C;)w.queue[k].callRejected(E);return w},f.resolve=function(w){return w instanceof this?w:a.resolve(new this(s),w)},f.reject=function(w){var E=new this(s);return a.reject(E,w)},f.all=function(w){var E=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 x=new Array(k),D=0,P=-1,W=new this(s);++P<k;)N(w[P],P);return W;function N(L,j){E.resolve(L).then(function(M){x[j]=M,++D!==k||C||(C=!0,a.resolve(W,x))},function(M){C||(C=!0,a.reject(W,M))})}},f.race=function(w){var E=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 x=-1,D=new this(s);++x<k;)P=w[x],E.resolve(P).then(function(W){C||(C=!0,a.resolve(D,W))},function(W){C||(C=!0,a.reject(D,W))});var P;return D}},{immediate:36}],38:[function(n,r,o){"use strict";var i={};(0,n("./lib/utils/common").assign)(i,n("./lib/deflate"),n("./lib/inflate"),n("./lib/zlib/constants")),r.exports=i},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(n,r,o){"use strict";var i=n("./zlib/deflate"),s=n("./utils/common"),a=n("./utils/strings"),l=n("./zlib/messages"),u=n("./zlib/zstream"),d=Object.prototype.toString,f=0,p=-1,g=0,v=8;function y(w){if(!(this instanceof y))return new y(w);this.options=s.assign({level:p,method:v,chunkSize:16384,windowBits:15,memLevel:8,strategy:g,to:""},w||{});var E=this.options;E.raw&&0<E.windowBits?E.windowBits=-E.windowBits:E.gzip&&0<E.windowBits&&E.windowBits<16&&(E.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,E.level,E.method,E.windowBits,E.memLevel,E.strategy);if(k!==f)throw new Error(l[k]);if(E.header&&i.deflateSetHeader(this.strm,E.header),E.dictionary){var C;if(C=typeof E.dictionary=="string"?a.string2buf(E.dictionary):d.call(E.dictionary)==="[object ArrayBuffer]"?new Uint8Array(E.dictionary):E.dictionary,(k=i.deflateSetDictionary(this.strm,C))!==f)throw new Error(l[k]);this._dict_set=!0}}function _(w,E){var k=new y(E);if(k.push(w,!0),k.err)throw k.msg||l[k.err];return k.result}y.prototype.push=function(w,E){var k,C,x=this.strm,D=this.options.chunkSize;if(this.ended)return!1;C=E===~~E?E:E===!0?4:0,typeof w=="string"?x.input=a.string2buf(w):d.call(w)==="[object ArrayBuffer]"?x.input=new Uint8Array(w):x.input=w,x.next_in=0,x.avail_in=x.input.length;do{if(x.avail_out===0&&(x.output=new s.Buf8(D),x.next_out=0,x.avail_out=D),(k=i.deflate(x,C))!==1&&k!==f)return this.onEnd(k),!(this.ended=!0);x.avail_out!==0&&(x.avail_in!==0||C!==4&&C!==2)||(this.options.to==="string"?this.onData(a.buf2binstring(s.shrinkBuf(x.output,x.next_out))):this.onData(s.shrinkBuf(x.output,x.next_out)))}while((0<x.avail_in||x.avail_out===0)&&k!==1);return C===4?(k=i.deflateEnd(this.strm),this.onEnd(k),this.ended=!0,k===f):C!==2||(this.onEnd(f),!(x.avail_out=0))},y.prototype.onData=function(w){this.chunks.push(w)},y.prototype.onEnd=function(w){w===f&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=s.flattenChunks(this.chunks)),this.chunks=[],this.err=w,this.msg=this.strm.msg},o.Deflate=y,o.deflate=_,o.deflateRaw=function(w,E){return(E=E||{}).raw=!0,_(w,E)},o.gzip=function(w,E){return(E=E||{}).gzip=!0,_(w,E)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(n,r,o){"use strict";var i=n("./zlib/inflate"),s=n("./utils/common"),a=n("./utils/strings"),l=n("./zlib/constants"),u=n("./zlib/messages"),d=n("./zlib/zstream"),f=n("./zlib/gzheader"),p=Object.prototype.toString;function g(y){if(!(this instanceof g))return new g(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 f,i.inflateGetHeader(this.strm,this.header)}function v(y,_){var w=new g(_);if(w.push(y,!0),w.err)throw w.msg||u[w.err];return w.result}g.prototype.push=function(y,_){var w,E,k,C,x,D,P=this.strm,W=this.options.chunkSize,N=this.options.dictionary,L=!1;if(this.ended)return!1;E=_===~~_?_:_===!0?l.Z_FINISH:l.Z_NO_FLUSH,typeof y=="string"?P.input=a.binstring2buf(y):p.call(y)==="[object ArrayBuffer]"?P.input=new Uint8Array(y):P.input=y,P.next_in=0,P.avail_in=P.input.length;do{if(P.avail_out===0&&(P.output=new s.Buf8(W),P.next_out=0,P.avail_out=W),(w=i.inflate(P,l.Z_NO_FLUSH))===l.Z_NEED_DICT&&N&&(D=typeof N=="string"?a.string2buf(N):p.call(N)==="[object ArrayBuffer]"?new Uint8Array(N):N,w=i.inflateSetDictionary(this.strm,D)),w===l.Z_BUF_ERROR&&L===!0&&(w=l.Z_OK,L=!1),w!==l.Z_STREAM_END&&w!==l.Z_OK)return this.onEnd(w),!(this.ended=!0);P.next_out&&(P.avail_out!==0&&w!==l.Z_STREAM_END&&(P.avail_in!==0||E!==l.Z_FINISH&&E!==l.Z_SYNC_FLUSH)||(this.options.to==="string"?(k=a.utf8border(P.output,P.next_out),C=P.next_out-k,x=a.buf2string(P.output,k),P.next_out=C,P.avail_out=W-C,C&&s.arraySet(P.output,P.output,k,C,0),this.onData(x)):this.onData(s.shrinkBuf(P.output,P.next_out)))),P.avail_in===0&&P.avail_out===0&&(L=!0)}while((0<P.avail_in||P.avail_out===0)&&w!==l.Z_STREAM_END);return w===l.Z_STREAM_END&&(E=l.Z_FINISH),E===l.Z_FINISH?(w=i.inflateEnd(this.strm),this.onEnd(w),this.ended=!0,w===l.Z_OK):E!==l.Z_SYNC_FLUSH||(this.onEnd(l.Z_OK),!(P.avail_out=0))},g.prototype.onData=function(y){this.chunks.push(y)},g.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=g,o.inflate=v,o.inflateRaw=function(y,_){return(_=_||{}).raw=!0,v(y,_)},o.ungzip=v},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(n,r,o){"use strict";var i=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";o.assign=function(l){for(var u=Array.prototype.slice.call(arguments,1);u.length;){var d=u.shift();if(d){if(typeof d!="object")throw new TypeError(d+"must be non-object");for(var f in d)d.hasOwnProperty(f)&&(l[f]=d[f])}}return l},o.shrinkBuf=function(l,u){return l.length===u?l:l.subarray?l.subarray(0,u):(l.length=u,l)};var s={arraySet:function(l,u,d,f,p){if(u.subarray&&l.subarray)l.set(u.subarray(d,d+f),p);else for(var g=0;g<f;g++)l[p+g]=u[d+g]},flattenChunks:function(l){var u,d,f,p,g,v;for(u=f=0,d=l.length;u<d;u++)f+=l[u].length;for(v=new Uint8Array(f),u=p=0,d=l.length;u<d;u++)g=l[u],v.set(g,p),p+=g.length;return v}},a={arraySet:function(l,u,d,f,p){for(var g=0;g<f;g++)l[p+g]=u[d+g]},flattenChunks:function(l){return[].concat.apply([],l)}};o.setTyped=function(l){l?(o.Buf8=Uint8Array,o.Buf16=Uint16Array,o.Buf32=Int32Array,o.assign(o,s)):(o.Buf8=Array,o.Buf16=Array,o.Buf32=Array,o.assign(o,a))},o.setTyped(i)},{}],42:[function(n,r,o){"use strict";var i=n("./common"),s=!0,a=!0;try{String.fromCharCode.apply(null,[0])}catch{s=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{a=!1}for(var l=new i.Buf8(256),u=0;u<256;u++)l[u]=252<=u?6:248<=u?5:240<=u?4:224<=u?3:192<=u?2:1;function d(f,p){if(p<65537&&(f.subarray&&a||!f.subarray&&s))return String.fromCharCode.apply(null,i.shrinkBuf(f,p));for(var g="",v=0;v<p;v++)g+=String.fromCharCode(f[v]);return g}l[254]=l[254]=1,o.string2buf=function(f){var p,g,v,y,_,w=f.length,E=0;for(y=0;y<w;y++)(64512&(g=f.charCodeAt(y)))==55296&&y+1<w&&(64512&(v=f.charCodeAt(y+1)))==56320&&(g=65536+(g-55296<<10)+(v-56320),y++),E+=g<128?1:g<2048?2:g<65536?3:4;for(p=new i.Buf8(E),y=_=0;_<E;y++)(64512&(g=f.charCodeAt(y)))==55296&&y+1<w&&(64512&(v=f.charCodeAt(y+1)))==56320&&(g=65536+(g-55296<<10)+(v-56320),y++),g<128?p[_++]=g:(g<2048?p[_++]=192|g>>>6:(g<65536?p[_++]=224|g>>>12:(p[_++]=240|g>>>18,p[_++]=128|g>>>12&63),p[_++]=128|g>>>6&63),p[_++]=128|63&g);return p},o.buf2binstring=function(f){return d(f,f.length)},o.binstring2buf=function(f){for(var p=new i.Buf8(f.length),g=0,v=p.length;g<v;g++)p[g]=f.charCodeAt(g);return p},o.buf2string=function(f,p){var g,v,y,_,w=p||f.length,E=new Array(2*w);for(g=v=0;g<w;)if((y=f[g++])<128)E[v++]=y;else if(4<(_=l[y]))E[v++]=65533,g+=_-1;else{for(y&=_===2?31:_===3?15:7;1<_&&g<w;)y=y<<6|63&f[g++],_--;1<_?E[v++]=65533:y<65536?E[v++]=y:(y-=65536,E[v++]=55296|y>>10&1023,E[v++]=56320|1023&y)}return d(E,v)},o.utf8border=function(f,p){var g;for((p=p||f.length)>f.length&&(p=f.length),g=p-1;0<=g&&(192&f[g])==128;)g--;return g<0||g===0?p:g+l[f[g]]>p?g:p}},{"./common":41}],43:[function(n,r,o){"use strict";r.exports=function(i,s,a,l){for(var u=65535&i|0,d=i>>>16&65535|0,f=0;a!==0;){for(a-=f=2e3<a?2e3:a;d=d+(u=u+s[l++]|0)|0,--f;);u%=65521,d%=65521}return u|d<<16|0}},{}],44:[function(n,r,o){"use strict";r.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(n,r,o){"use strict";var i=(function(){for(var s,a=[],l=0;l<256;l++){s=l;for(var u=0;u<8;u++)s=1&s?3988292384^s>>>1:s>>>1;a[l]=s}return a})();r.exports=function(s,a,l,u){var d=i,f=u+l;s^=-1;for(var p=u;p<f;p++)s=s>>>8^d[255&(s^a[p])];return-1^s}},{}],46:[function(n,r,o){"use strict";var i,s=n("../utils/common"),a=n("./trees"),l=n("./adler32"),u=n("./crc32"),d=n("./messages"),f=0,p=4,g=0,v=-2,y=-1,_=4,w=2,E=8,k=9,C=286,x=30,D=19,P=2*C+1,W=15,N=3,L=258,j=L+N+1,M=42,B=113,R=1,re=2,te=3,Y=4;function X(A,ne){return A.msg=d[ne],ne}function U(A){return(A<<1)-(4<A?9:0)}function Oe(A){for(var ne=A.length;0<=--ne;)A[ne]=0}function me(A){var ne=A.state,V=ne.pending;V>A.avail_out&&(V=A.avail_out),V!==0&&(s.arraySet(A.output,ne.pending_buf,ne.pending_out,V,A.next_out),A.next_out+=V,ne.pending_out+=V,A.total_out+=V,A.avail_out-=V,ne.pending-=V,ne.pending===0&&(ne.pending_out=0))}function ce(A,ne){a._tr_flush_block(A,0<=A.block_start?A.block_start:-1,A.strstart-A.block_start,ne),A.block_start=A.strstart,me(A.strm)}function ve(A,ne){A.pending_buf[A.pending++]=ne}function Re(A,ne){A.pending_buf[A.pending++]=ne>>>8&255,A.pending_buf[A.pending++]=255&ne}function $e(A,ne){var V,Q,K=A.max_chain_length,ee=A.strstart,le=A.prev_length,be=A.nice_match,G=A.strstart>A.w_size-j?A.strstart-(A.w_size-j):0,pe=A.window,Ee=A.w_mask,Se=A.prev,Ge=A.strstart+L,ht=pe[ee+le-1],Me=pe[ee+le];A.prev_length>=A.good_match&&(K>>=2),be>A.lookahead&&(be=A.lookahead);do if(pe[(V=ne)+le]===Me&&pe[V+le-1]===ht&&pe[V]===pe[ee]&&pe[++V]===pe[ee+1]){ee+=2,V++;do;while(pe[++ee]===pe[++V]&&pe[++ee]===pe[++V]&&pe[++ee]===pe[++V]&&pe[++ee]===pe[++V]&&pe[++ee]===pe[++V]&&pe[++ee]===pe[++V]&&pe[++ee]===pe[++V]&&pe[++ee]===pe[++V]&&ee<Ge);if(Q=L-(Ge-ee),ee=Ge-L,le<Q){if(A.match_start=ne,be<=(le=Q))break;ht=pe[ee+le-1],Me=pe[ee+le]}}while((ne=Se[ne&Ee])>G&&--K!=0);return le<=A.lookahead?le:A.lookahead}function ot(A){var ne,V,Q,K,ee,le,be,G,pe,Ee,Se=A.w_size;do{if(K=A.window_size-A.lookahead-A.strstart,A.strstart>=Se+(Se-j)){for(s.arraySet(A.window,A.window,Se,Se,0),A.match_start-=Se,A.strstart-=Se,A.block_start-=Se,ne=V=A.hash_size;Q=A.head[--ne],A.head[ne]=Se<=Q?Q-Se:0,--V;);for(ne=V=Se;Q=A.prev[--ne],A.prev[ne]=Se<=Q?Q-Se:0,--V;);K+=Se}if(A.strm.avail_in===0)break;if(le=A.strm,be=A.window,G=A.strstart+A.lookahead,pe=K,Ee=void 0,Ee=le.avail_in,pe<Ee&&(Ee=pe),V=Ee===0?0:(le.avail_in-=Ee,s.arraySet(be,le.input,le.next_in,Ee,G),le.state.wrap===1?le.adler=l(le.adler,be,Ee,G):le.state.wrap===2&&(le.adler=u(le.adler,be,Ee,G)),le.next_in+=Ee,le.total_in+=Ee,Ee),A.lookahead+=V,A.lookahead+A.insert>=N)for(ee=A.strstart-A.insert,A.ins_h=A.window[ee],A.ins_h=(A.ins_h<<A.hash_shift^A.window[ee+1])&A.hash_mask;A.insert&&(A.ins_h=(A.ins_h<<A.hash_shift^A.window[ee+N-1])&A.hash_mask,A.prev[ee&A.w_mask]=A.head[A.ins_h],A.head[A.ins_h]=ee,ee++,A.insert--,!(A.lookahead+A.insert<N)););}while(A.lookahead<j&&A.strm.avail_in!==0)}function kt(A,ne){for(var V,Q;;){if(A.lookahead<j){if(ot(A),A.lookahead<j&&ne===f)return R;if(A.lookahead===0)break}if(V=0,A.lookahead>=N&&(A.ins_h=(A.ins_h<<A.hash_shift^A.window[A.strstart+N-1])&A.hash_mask,V=A.prev[A.strstart&A.w_mask]=A.head[A.ins_h],A.head[A.ins_h]=A.strstart),V!==0&&A.strstart-V<=A.w_size-j&&(A.match_length=$e(A,V)),A.match_length>=N)if(Q=a._tr_tally(A,A.strstart-A.match_start,A.match_length-N),A.lookahead-=A.match_length,A.match_length<=A.max_lazy_match&&A.lookahead>=N){for(A.match_length--;A.strstart++,A.ins_h=(A.ins_h<<A.hash_shift^A.window[A.strstart+N-1])&A.hash_mask,V=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 Q=a._tr_tally(A,0,A.window[A.strstart]),A.lookahead--,A.strstart++;if(Q&&(ce(A,!1),A.strm.avail_out===0))return R}return A.insert=A.strstart<N-1?A.strstart:N-1,ne===p?(ce(A,!0),A.strm.avail_out===0?te:Y):A.last_lit&&(ce(A,!1),A.strm.avail_out===0)?R:re}function gt(A,ne){for(var V,Q,K;;){if(A.lookahead<j){if(ot(A),A.lookahead<j&&ne===f)return R;if(A.lookahead===0)break}if(V=0,A.lookahead>=N&&(A.ins_h=(A.ins_h<<A.hash_shift^A.window[A.strstart+N-1])&A.hash_mask,V=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=N-1,V!==0&&A.prev_length<A.max_lazy_match&&A.strstart-V<=A.w_size-j&&(A.match_length=$e(A,V),A.match_length<=5&&(A.strategy===1||A.match_length===N&&4096<A.strstart-A.match_start)&&(A.match_length=N-1)),A.prev_length>=N&&A.match_length<=A.prev_length){for(K=A.strstart+A.lookahead-N,Q=a._tr_tally(A,A.strstart-1-A.prev_match,A.prev_length-N),A.lookahead-=A.prev_length-1,A.prev_length-=2;++A.strstart<=K&&(A.ins_h=(A.ins_h<<A.hash_shift^A.window[A.strstart+N-1])&A.hash_mask,V=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=N-1,A.strstart++,Q&&(ce(A,!1),A.strm.avail_out===0))return R}else if(A.match_available){if((Q=a._tr_tally(A,0,A.window[A.strstart-1]))&&ce(A,!1),A.strstart++,A.lookahead--,A.strm.avail_out===0)return R}else A.match_available=1,A.strstart++,A.lookahead--}return A.match_available&&(Q=a._tr_tally(A,0,A.window[A.strstart-1]),A.match_available=0),A.insert=A.strstart<N-1?A.strstart:N-1,ne===p?(ce(A,!0),A.strm.avail_out===0?te:Y):A.last_lit&&(ce(A,!1),A.strm.avail_out===0)?R:re}function Bt(A,ne,V,Q,K){this.good_length=A,this.max_lazy=ne,this.nice_length=V,this.max_chain=Q,this.func=K}function Fe(){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=E,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*P),this.dyn_dtree=new s.Buf16(2*(2*x+1)),this.bl_tree=new s.Buf16(2*(2*D+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(W+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 Le(A){var ne;return A&&A.state?(A.total_in=A.total_out=0,A.data_type=w,(ne=A.state).pending=0,ne.pending_out=0,ne.wrap<0&&(ne.wrap=-ne.wrap),ne.status=ne.wrap?M:B,A.adler=ne.wrap===2?0:1,ne.last_flush=f,a._tr_init(ne),g):X(A,v)}function de(A){var ne=Le(A);return ne===g&&(function(V){V.window_size=2*V.w_size,Oe(V.head),V.max_lazy_match=i[V.level].max_lazy,V.good_match=i[V.level].good_length,V.nice_match=i[V.level].nice_length,V.max_chain_length=i[V.level].max_chain,V.strstart=0,V.block_start=0,V.lookahead=0,V.insert=0,V.match_length=V.prev_length=N-1,V.match_available=0,V.ins_h=0})(A.state),ne}function H(A,ne,V,Q,K,ee){if(!A)return v;var le=1;if(ne===y&&(ne=6),Q<0?(le=0,Q=-Q):15<Q&&(le=2,Q-=16),K<1||k<K||V!==E||Q<8||15<Q||ne<0||9<ne||ee<0||_<ee)return X(A,v);Q===8&&(Q=9);var be=new Fe;return(A.state=be).strm=A,be.wrap=le,be.gzhead=null,be.w_bits=Q,be.w_size=1<<be.w_bits,be.w_mask=be.w_size-1,be.hash_bits=K+7,be.hash_size=1<<be.hash_bits,be.hash_mask=be.hash_size-1,be.hash_shift=~~((be.hash_bits+N-1)/N),be.window=new s.Buf8(2*be.w_size),be.head=new s.Buf16(be.hash_size),be.prev=new s.Buf16(be.w_size),be.lit_bufsize=1<<K+6,be.pending_buf_size=4*be.lit_bufsize,be.pending_buf=new s.Buf8(be.pending_buf_size),be.d_buf=1*be.lit_bufsize,be.l_buf=3*be.lit_bufsize,be.level=ne,be.strategy=ee,be.method=V,de(A)}i=[new Bt(0,0,0,0,function(A,ne){var V=65535;for(V>A.pending_buf_size-5&&(V=A.pending_buf_size-5);;){if(A.lookahead<=1){if(ot(A),A.lookahead===0&&ne===f)return R;if(A.lookahead===0)break}A.strstart+=A.lookahead,A.lookahead=0;var Q=A.block_start+V;if((A.strstart===0||A.strstart>=Q)&&(A.lookahead=A.strstart-Q,A.strstart=Q,ce(A,!1),A.strm.avail_out===0)||A.strstart-A.block_start>=A.w_size-j&&(ce(A,!1),A.strm.avail_out===0))return R}return A.insert=0,ne===p?(ce(A,!0),A.strm.avail_out===0?te:Y):(A.strstart>A.block_start&&(ce(A,!1),A.strm.avail_out),R)}),new Bt(4,4,8,4,kt),new Bt(4,5,16,8,kt),new Bt(4,6,32,32,kt),new Bt(4,4,16,16,gt),new Bt(8,16,32,32,gt),new Bt(8,16,128,128,gt),new Bt(8,32,128,256,gt),new Bt(32,128,258,1024,gt),new Bt(32,258,258,4096,gt)],o.deflateInit=function(A,ne){return H(A,ne,E,15,8,0)},o.deflateInit2=H,o.deflateReset=de,o.deflateResetKeep=Le,o.deflateSetHeader=function(A,ne){return A&&A.state?A.state.wrap!==2?v:(A.state.gzhead=ne,g):v},o.deflate=function(A,ne){var V,Q,K,ee;if(!A||!A.state||5<ne||ne<0)return A?X(A,v):v;if(Q=A.state,!A.output||!A.input&&A.avail_in!==0||Q.status===666&&ne!==p)return X(A,A.avail_out===0?-5:v);if(Q.strm=A,V=Q.last_flush,Q.last_flush=ne,Q.status===M)if(Q.wrap===2)A.adler=0,ve(Q,31),ve(Q,139),ve(Q,8),Q.gzhead?(ve(Q,(Q.gzhead.text?1:0)+(Q.gzhead.hcrc?2:0)+(Q.gzhead.extra?4:0)+(Q.gzhead.name?8:0)+(Q.gzhead.comment?16:0)),ve(Q,255&Q.gzhead.time),ve(Q,Q.gzhead.time>>8&255),ve(Q,Q.gzhead.time>>16&255),ve(Q,Q.gzhead.time>>24&255),ve(Q,Q.level===9?2:2<=Q.strategy||Q.level<2?4:0),ve(Q,255&Q.gzhead.os),Q.gzhead.extra&&Q.gzhead.extra.length&&(ve(Q,255&Q.gzhead.extra.length),ve(Q,Q.gzhead.extra.length>>8&255)),Q.gzhead.hcrc&&(A.adler=u(A.adler,Q.pending_buf,Q.pending,0)),Q.gzindex=0,Q.status=69):(ve(Q,0),ve(Q,0),ve(Q,0),ve(Q,0),ve(Q,0),ve(Q,Q.level===9?2:2<=Q.strategy||Q.level<2?4:0),ve(Q,3),Q.status=B);else{var le=E+(Q.w_bits-8<<4)<<8;le|=(2<=Q.strategy||Q.level<2?0:Q.level<6?1:Q.level===6?2:3)<<6,Q.strstart!==0&&(le|=32),le+=31-le%31,Q.status=B,Re(Q,le),Q.strstart!==0&&(Re(Q,A.adler>>>16),Re(Q,65535&A.adler)),A.adler=1}if(Q.status===69)if(Q.gzhead.extra){for(K=Q.pending;Q.gzindex<(65535&Q.gzhead.extra.length)&&(Q.pending!==Q.pending_buf_size||(Q.gzhead.hcrc&&Q.pending>K&&(A.adler=u(A.adler,Q.pending_buf,Q.pending-K,K)),me(A),K=Q.pending,Q.pending!==Q.pending_buf_size));)ve(Q,255&Q.gzhead.extra[Q.gzindex]),Q.gzindex++;Q.gzhead.hcrc&&Q.pending>K&&(A.adler=u(A.adler,Q.pending_buf,Q.pending-K,K)),Q.gzindex===Q.gzhead.extra.length&&(Q.gzindex=0,Q.status=73)}else Q.status=73;if(Q.status===73)if(Q.gzhead.name){K=Q.pending;do{if(Q.pending===Q.pending_buf_size&&(Q.gzhead.hcrc&&Q.pending>K&&(A.adler=u(A.adler,Q.pending_buf,Q.pending-K,K)),me(A),K=Q.pending,Q.pending===Q.pending_buf_size)){ee=1;break}ee=Q.gzindex<Q.gzhead.name.length?255&Q.gzhead.name.charCodeAt(Q.gzindex++):0,ve(Q,ee)}while(ee!==0);Q.gzhead.hcrc&&Q.pending>K&&(A.adler=u(A.adler,Q.pending_buf,Q.pending-K,K)),ee===0&&(Q.gzindex=0,Q.status=91)}else Q.status=91;if(Q.status===91)if(Q.gzhead.comment){K=Q.pending;do{if(Q.pending===Q.pending_buf_size&&(Q.gzhead.hcrc&&Q.pending>K&&(A.adler=u(A.adler,Q.pending_buf,Q.pending-K,K)),me(A),K=Q.pending,Q.pending===Q.pending_buf_size)){ee=1;break}ee=Q.gzindex<Q.gzhead.comment.length?255&Q.gzhead.comment.charCodeAt(Q.gzindex++):0,ve(Q,ee)}while(ee!==0);Q.gzhead.hcrc&&Q.pending>K&&(A.adler=u(A.adler,Q.pending_buf,Q.pending-K,K)),ee===0&&(Q.status=103)}else Q.status=103;if(Q.status===103&&(Q.gzhead.hcrc?(Q.pending+2>Q.pending_buf_size&&me(A),Q.pending+2<=Q.pending_buf_size&&(ve(Q,255&A.adler),ve(Q,A.adler>>8&255),A.adler=0,Q.status=B)):Q.status=B),Q.pending!==0){if(me(A),A.avail_out===0)return Q.last_flush=-1,g}else if(A.avail_in===0&&U(ne)<=U(V)&&ne!==p)return X(A,-5);if(Q.status===666&&A.avail_in!==0)return X(A,-5);if(A.avail_in!==0||Q.lookahead!==0||ne!==f&&Q.status!==666){var be=Q.strategy===2?(function(G,pe){for(var Ee;;){if(G.lookahead===0&&(ot(G),G.lookahead===0)){if(pe===f)return R;break}if(G.match_length=0,Ee=a._tr_tally(G,0,G.window[G.strstart]),G.lookahead--,G.strstart++,Ee&&(ce(G,!1),G.strm.avail_out===0))return R}return G.insert=0,pe===p?(ce(G,!0),G.strm.avail_out===0?te:Y):G.last_lit&&(ce(G,!1),G.strm.avail_out===0)?R:re})(Q,ne):Q.strategy===3?(function(G,pe){for(var Ee,Se,Ge,ht,Me=G.window;;){if(G.lookahead<=L){if(ot(G),G.lookahead<=L&&pe===f)return R;if(G.lookahead===0)break}if(G.match_length=0,G.lookahead>=N&&0<G.strstart&&(Se=Me[Ge=G.strstart-1])===Me[++Ge]&&Se===Me[++Ge]&&Se===Me[++Ge]){ht=G.strstart+L;do;while(Se===Me[++Ge]&&Se===Me[++Ge]&&Se===Me[++Ge]&&Se===Me[++Ge]&&Se===Me[++Ge]&&Se===Me[++Ge]&&Se===Me[++Ge]&&Se===Me[++Ge]&&Ge<ht);G.match_length=L-(ht-Ge),G.match_length>G.lookahead&&(G.match_length=G.lookahead)}if(G.match_length>=N?(Ee=a._tr_tally(G,1,G.match_length-N),G.lookahead-=G.match_length,G.strstart+=G.match_length,G.match_length=0):(Ee=a._tr_tally(G,0,G.window[G.strstart]),G.lookahead--,G.strstart++),Ee&&(ce(G,!1),G.strm.avail_out===0))return R}return G.insert=0,pe===p?(ce(G,!0),G.strm.avail_out===0?te:Y):G.last_lit&&(ce(G,!1),G.strm.avail_out===0)?R:re})(Q,ne):i[Q.level].func(Q,ne);if(be!==te&&be!==Y||(Q.status=666),be===R||be===te)return A.avail_out===0&&(Q.last_flush=-1),g;if(be===re&&(ne===1?a._tr_align(Q):ne!==5&&(a._tr_stored_block(Q,0,0,!1),ne===3&&(Oe(Q.head),Q.lookahead===0&&(Q.strstart=0,Q.block_start=0,Q.insert=0))),me(A),A.avail_out===0))return Q.last_flush=-1,g}return ne!==p?g:Q.wrap<=0?1:(Q.wrap===2?(ve(Q,255&A.adler),ve(Q,A.adler>>8&255),ve(Q,A.adler>>16&255),ve(Q,A.adler>>24&255),ve(Q,255&A.total_in),ve(Q,A.total_in>>8&255),ve(Q,A.total_in>>16&255),ve(Q,A.total_in>>24&255)):(Re(Q,A.adler>>>16),Re(Q,65535&A.adler)),me(A),0<Q.wrap&&(Q.wrap=-Q.wrap),Q.pending!==0?g:1)},o.deflateEnd=function(A){var ne;return A&&A.state?(ne=A.state.status)!==M&&ne!==69&&ne!==73&&ne!==91&&ne!==103&&ne!==B&&ne!==666?X(A,v):(A.state=null,ne===B?X(A,-3):g):v},o.deflateSetDictionary=function(A,ne){var V,Q,K,ee,le,be,G,pe,Ee=ne.length;if(!A||!A.state||(ee=(V=A.state).wrap)===2||ee===1&&V.status!==M||V.lookahead)return v;for(ee===1&&(A.adler=l(A.adler,ne,Ee,0)),V.wrap=0,Ee>=V.w_size&&(ee===0&&(Oe(V.head),V.strstart=0,V.block_start=0,V.insert=0),pe=new s.Buf8(V.w_size),s.arraySet(pe,ne,Ee-V.w_size,V.w_size,0),ne=pe,Ee=V.w_size),le=A.avail_in,be=A.next_in,G=A.input,A.avail_in=Ee,A.next_in=0,A.input=ne,ot(V);V.lookahead>=N;){for(Q=V.strstart,K=V.lookahead-(N-1);V.ins_h=(V.ins_h<<V.hash_shift^V.window[Q+N-1])&V.hash_mask,V.prev[Q&V.w_mask]=V.head[V.ins_h],V.head[V.ins_h]=Q,Q++,--K;);V.strstart=Q,V.lookahead=N-1,ot(V)}return V.strstart+=V.lookahead,V.block_start=V.strstart,V.insert=V.lookahead,V.lookahead=0,V.match_length=V.prev_length=N-1,V.match_available=0,A.next_in=be,A.input=G,A.avail_in=le,V.wrap=ee,g},o.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(n,r,o){"use strict";r.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(n,r,o){"use strict";r.exports=function(i,s){var a=i.state,l=i.next_in,u,d,f,p,g,v,y,_,w,E,k,C,x,D,P,W,N,L,j,M,B,R=i.input,re;u=l+(i.avail_in-5),d=i.next_out,re=i.output,f=d-(s-i.avail_out),p=d+(i.avail_out-257),g=a.dmax,v=a.wsize,y=a.whave,_=a.wnext,w=a.window,E=a.hold,k=a.bits,C=a.lencode,x=a.distcode,D=(1<<a.lenbits)-1,P=(1<<a.distbits)-1;e:do{k<15&&(E+=R[l++]<<k,k+=8,E+=R[l++]<<k,k+=8),W=C[E&D];t:for(;;){if(E>>>=N=W>>>24,k-=N,(N=W>>>16&255)===0)re[d++]=65535&W;else{if(!(16&N)){if((64&N)==0){W=C[(65535&W)+(E&(1<<N)-1)];continue t}if(32&N){a.mode=12;break e}i.msg="invalid literal/length code",a.mode=30;break e}L=65535&W,(N&=15)&&(k<N&&(E+=R[l++]<<k,k+=8),L+=E&(1<<N)-1,E>>>=N,k-=N),k<15&&(E+=R[l++]<<k,k+=8,E+=R[l++]<<k,k+=8),W=x[E&P];n:for(;;){if(E>>>=N=W>>>24,k-=N,!(16&(N=W>>>16&255))){if((64&N)==0){W=x[(65535&W)+(E&(1<<N)-1)];continue n}i.msg="invalid distance code",a.mode=30;break e}if(j=65535&W,k<(N&=15)&&(E+=R[l++]<<k,(k+=8)<N&&(E+=R[l++]<<k,k+=8)),g<(j+=E&(1<<N)-1)){i.msg="invalid distance too far back",a.mode=30;break e}if(E>>>=N,k-=N,(N=d-f)<j){if(y<(N=j-N)&&a.sane){i.msg="invalid distance too far back",a.mode=30;break e}if(B=w,(M=0)===_){if(M+=v-N,N<L){for(L-=N;re[d++]=w[M++],--N;);M=d-j,B=re}}else if(_<N){if(M+=v+_-N,(N-=_)<L){for(L-=N;re[d++]=w[M++],--N;);if(M=0,_<L){for(L-=N=_;re[d++]=w[M++],--N;);M=d-j,B=re}}}else if(M+=_-N,N<L){for(L-=N;re[d++]=w[M++],--N;);M=d-j,B=re}for(;2<L;)re[d++]=B[M++],re[d++]=B[M++],re[d++]=B[M++],L-=3;L&&(re[d++]=B[M++],1<L&&(re[d++]=B[M++]))}else{for(M=d-j;re[d++]=re[M++],re[d++]=re[M++],re[d++]=re[M++],2<(L-=3););L&&(re[d++]=re[M++],1<L&&(re[d++]=re[M++]))}break}}break}}while(l<u&&d<p);l-=L=k>>3,E&=(1<<(k-=L<<3))-1,i.next_in=l,i.next_out=d,i.avail_in=l<u?u-l+5:5-(l-u),i.avail_out=d<p?p-d+257:257-(d-p),a.hold=E,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,f=2,p=0,g=-2,v=1,y=852,_=592;function w(M){return(M>>>24&255)+(M>>>8&65280)+((65280&M)<<8)+((255&M)<<24)}function E(){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(M){var B;return M&&M.state?(B=M.state,M.total_in=M.total_out=B.total=0,M.msg="",B.wrap&&(M.adler=1&B.wrap),B.mode=v,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):g}function C(M){var B;return M&&M.state?((B=M.state).wsize=0,B.whave=0,B.wnext=0,k(M)):g}function x(M,B){var R,re;return M&&M.state?(re=M.state,B<0?(R=0,B=-B):(R=1+(B>>4),B<48&&(B&=15)),B&&(B<8||15<B)?g:(re.window!==null&&re.wbits!==B&&(re.window=null),re.wrap=R,re.wbits=B,C(M))):g}function D(M,B){var R,re;return M?(re=new E,(M.state=re).window=null,(R=x(M,B))!==p&&(M.state=null),R):g}var P,W,N=!0;function L(M){if(N){var B;for(P=new i.Buf32(512),W=new i.Buf32(32),B=0;B<144;)M.lens[B++]=8;for(;B<256;)M.lens[B++]=9;for(;B<280;)M.lens[B++]=7;for(;B<288;)M.lens[B++]=8;for(u(d,M.lens,0,288,P,0,M.work,{bits:9}),B=0;B<32;)M.lens[B++]=5;u(f,M.lens,0,32,W,0,M.work,{bits:5}),N=!1}M.lencode=P,M.lenbits=9,M.distcode=W,M.distbits=5}function j(M,B,R,re){var te,Y=M.state;return Y.window===null&&(Y.wsize=1<<Y.wbits,Y.wnext=0,Y.whave=0,Y.window=new i.Buf8(Y.wsize)),re>=Y.wsize?(i.arraySet(Y.window,B,R-Y.wsize,Y.wsize,0),Y.wnext=0,Y.whave=Y.wsize):(re<(te=Y.wsize-Y.wnext)&&(te=re),i.arraySet(Y.window,B,R-re,te,Y.wnext),(re-=te)?(i.arraySet(Y.window,B,R-re,re,0),Y.wnext=re,Y.whave=Y.wsize):(Y.wnext+=te,Y.wnext===Y.wsize&&(Y.wnext=0),Y.whave<Y.wsize&&(Y.whave+=te))),0}o.inflateReset=C,o.inflateReset2=x,o.inflateResetKeep=k,o.inflateInit=function(M){return D(M,15)},o.inflateInit2=D,o.inflate=function(M,B){var R,re,te,Y,X,U,Oe,me,ce,ve,Re,$e,ot,kt,gt,Bt,Fe,Le,de,H,A,ne,V,Q,K=0,ee=new i.Buf8(4),le=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!M||!M.state||!M.output||!M.input&&M.avail_in!==0)return g;(R=M.state).mode===12&&(R.mode=13),X=M.next_out,te=M.output,Oe=M.avail_out,Y=M.next_in,re=M.input,U=M.avail_in,me=R.hold,ce=R.bits,ve=U,Re=Oe,ne=p;e:for(;;)switch(R.mode){case v:if(R.wrap===0){R.mode=13;break}for(;ce<16;){if(U===0)break e;U--,me+=re[Y++]<<ce,ce+=8}if(2&R.wrap&&me===35615){ee[R.check=0]=255&me,ee[1]=me>>>8&255,R.check=a(R.check,ee,2,0),ce=me=0,R.mode=2;break}if(R.flags=0,R.head&&(R.head.done=!1),!(1&R.wrap)||(((255&me)<<8)+(me>>8))%31){M.msg="incorrect header check",R.mode=30;break}if((15&me)!=8){M.msg="unknown compression method",R.mode=30;break}if(ce-=4,A=8+(15&(me>>>=4)),R.wbits===0)R.wbits=A;else if(A>R.wbits){M.msg="invalid window size",R.mode=30;break}R.dmax=1<<A,M.adler=R.check=1,R.mode=512&me?10:12,ce=me=0;break;case 2:for(;ce<16;){if(U===0)break e;U--,me+=re[Y++]<<ce,ce+=8}if(R.flags=me,(255&R.flags)!=8){M.msg="unknown compression method",R.mode=30;break}if(57344&R.flags){M.msg="unknown header flags set",R.mode=30;break}R.head&&(R.head.text=me>>8&1),512&R.flags&&(ee[0]=255&me,ee[1]=me>>>8&255,R.check=a(R.check,ee,2,0)),ce=me=0,R.mode=3;case 3:for(;ce<32;){if(U===0)break e;U--,me+=re[Y++]<<ce,ce+=8}R.head&&(R.head.time=me),512&R.flags&&(ee[0]=255&me,ee[1]=me>>>8&255,ee[2]=me>>>16&255,ee[3]=me>>>24&255,R.check=a(R.check,ee,4,0)),ce=me=0,R.mode=4;case 4:for(;ce<16;){if(U===0)break e;U--,me+=re[Y++]<<ce,ce+=8}R.head&&(R.head.xflags=255&me,R.head.os=me>>8),512&R.flags&&(ee[0]=255&me,ee[1]=me>>>8&255,R.check=a(R.check,ee,2,0)),ce=me=0,R.mode=5;case 5:if(1024&R.flags){for(;ce<16;){if(U===0)break e;U--,me+=re[Y++]<<ce,ce+=8}R.length=me,R.head&&(R.head.extra_len=me),512&R.flags&&(ee[0]=255&me,ee[1]=me>>>8&255,R.check=a(R.check,ee,2,0)),ce=me=0}else R.head&&(R.head.extra=null);R.mode=6;case 6:if(1024&R.flags&&(U<($e=R.length)&&($e=U),$e&&(R.head&&(A=R.head.extra_len-R.length,R.head.extra||(R.head.extra=new Array(R.head.extra_len)),i.arraySet(R.head.extra,re,Y,$e,A)),512&R.flags&&(R.check=a(R.check,re,$e,Y)),U-=$e,Y+=$e,R.length-=$e),R.length))break e;R.length=0,R.mode=7;case 7:if(2048&R.flags){if(U===0)break e;for($e=0;A=re[Y+$e++],R.head&&A&&R.length<65536&&(R.head.name+=String.fromCharCode(A)),A&&$e<U;);if(512&R.flags&&(R.check=a(R.check,re,$e,Y)),U-=$e,Y+=$e,A)break e}else R.head&&(R.head.name=null);R.length=0,R.mode=8;case 8:if(4096&R.flags){if(U===0)break e;for($e=0;A=re[Y+$e++],R.head&&A&&R.length<65536&&(R.head.comment+=String.fromCharCode(A)),A&&$e<U;);if(512&R.flags&&(R.check=a(R.check,re,$e,Y)),U-=$e,Y+=$e,A)break e}else R.head&&(R.head.comment=null);R.mode=9;case 9:if(512&R.flags){for(;ce<16;){if(U===0)break e;U--,me+=re[Y++]<<ce,ce+=8}if(me!==(65535&R.check)){M.msg="header crc mismatch",R.mode=30;break}ce=me=0}R.head&&(R.head.hcrc=R.flags>>9&1,R.head.done=!0),M.adler=R.check=0,R.mode=12;break;case 10:for(;ce<32;){if(U===0)break e;U--,me+=re[Y++]<<ce,ce+=8}M.adler=R.check=w(me),ce=me=0,R.mode=11;case 11:if(R.havedict===0)return M.next_out=X,M.avail_out=Oe,M.next_in=Y,M.avail_in=U,R.hold=me,R.bits=ce,2;M.adler=R.check=1,R.mode=12;case 12:if(B===5||B===6)break e;case 13:if(R.last){me>>>=7&ce,ce-=7&ce,R.mode=27;break}for(;ce<3;){if(U===0)break e;U--,me+=re[Y++]<<ce,ce+=8}switch(R.last=1&me,ce-=1,3&(me>>>=1)){case 0:R.mode=14;break;case 1:if(L(R),R.mode=20,B!==6)break;me>>>=2,ce-=2;break e;case 2:R.mode=17;break;case 3:M.msg="invalid block type",R.mode=30}me>>>=2,ce-=2;break;case 14:for(me>>>=7&ce,ce-=7&ce;ce<32;){if(U===0)break e;U--,me+=re[Y++]<<ce,ce+=8}if((65535&me)!=(me>>>16^65535)){M.msg="invalid stored block lengths",R.mode=30;break}if(R.length=65535&me,ce=me=0,R.mode=15,B===6)break e;case 15:R.mode=16;case 16:if($e=R.length){if(U<$e&&($e=U),Oe<$e&&($e=Oe),$e===0)break e;i.arraySet(te,re,Y,$e,X),U-=$e,Y+=$e,Oe-=$e,X+=$e,R.length-=$e;break}R.mode=12;break;case 17:for(;ce<14;){if(U===0)break e;U--,me+=re[Y++]<<ce,ce+=8}if(R.nlen=257+(31&me),me>>>=5,ce-=5,R.ndist=1+(31&me),me>>>=5,ce-=5,R.ncode=4+(15&me),me>>>=4,ce-=4,286<R.nlen||30<R.ndist){M.msg="too many length or distance symbols",R.mode=30;break}R.have=0,R.mode=18;case 18:for(;R.have<R.ncode;){for(;ce<3;){if(U===0)break e;U--,me+=re[Y++]<<ce,ce+=8}R.lens[le[R.have++]]=7&me,me>>>=3,ce-=3}for(;R.have<19;)R.lens[le[R.have++]]=0;if(R.lencode=R.lendyn,R.lenbits=7,V={bits:R.lenbits},ne=u(0,R.lens,0,19,R.lencode,0,R.work,V),R.lenbits=V.bits,ne){M.msg="invalid code lengths set",R.mode=30;break}R.have=0,R.mode=19;case 19:for(;R.have<R.nlen+R.ndist;){for(;Bt=(K=R.lencode[me&(1<<R.lenbits)-1])>>>16&255,Fe=65535&K,!((gt=K>>>24)<=ce);){if(U===0)break e;U--,me+=re[Y++]<<ce,ce+=8}if(Fe<16)me>>>=gt,ce-=gt,R.lens[R.have++]=Fe;else{if(Fe===16){for(Q=gt+2;ce<Q;){if(U===0)break e;U--,me+=re[Y++]<<ce,ce+=8}if(me>>>=gt,ce-=gt,R.have===0){M.msg="invalid bit length repeat",R.mode=30;break}A=R.lens[R.have-1],$e=3+(3&me),me>>>=2,ce-=2}else if(Fe===17){for(Q=gt+3;ce<Q;){if(U===0)break e;U--,me+=re[Y++]<<ce,ce+=8}ce-=gt,A=0,$e=3+(7&(me>>>=gt)),me>>>=3,ce-=3}else{for(Q=gt+7;ce<Q;){if(U===0)break e;U--,me+=re[Y++]<<ce,ce+=8}ce-=gt,A=0,$e=11+(127&(me>>>=gt)),me>>>=7,ce-=7}if(R.have+$e>R.nlen+R.ndist){M.msg="invalid bit length repeat",R.mode=30;break}for(;$e--;)R.lens[R.have++]=A}}if(R.mode===30)break;if(R.lens[256]===0){M.msg="invalid code -- missing end-of-block",R.mode=30;break}if(R.lenbits=9,V={bits:R.lenbits},ne=u(d,R.lens,0,R.nlen,R.lencode,0,R.work,V),R.lenbits=V.bits,ne){M.msg="invalid literal/lengths set",R.mode=30;break}if(R.distbits=6,R.distcode=R.distdyn,V={bits:R.distbits},ne=u(f,R.lens,R.nlen,R.ndist,R.distcode,0,R.work,V),R.distbits=V.bits,ne){M.msg="invalid distances set",R.mode=30;break}if(R.mode=20,B===6)break e;case 20:R.mode=21;case 21:if(6<=U&&258<=Oe){M.next_out=X,M.avail_out=Oe,M.next_in=Y,M.avail_in=U,R.hold=me,R.bits=ce,l(M,Re),X=M.next_out,te=M.output,Oe=M.avail_out,Y=M.next_in,re=M.input,U=M.avail_in,me=R.hold,ce=R.bits,R.mode===12&&(R.back=-1);break}for(R.back=0;Bt=(K=R.lencode[me&(1<<R.lenbits)-1])>>>16&255,Fe=65535&K,!((gt=K>>>24)<=ce);){if(U===0)break e;U--,me+=re[Y++]<<ce,ce+=8}if(Bt&&(240&Bt)==0){for(Le=gt,de=Bt,H=Fe;Bt=(K=R.lencode[H+((me&(1<<Le+de)-1)>>Le)])>>>16&255,Fe=65535&K,!(Le+(gt=K>>>24)<=ce);){if(U===0)break e;U--,me+=re[Y++]<<ce,ce+=8}me>>>=Le,ce-=Le,R.back+=Le}if(me>>>=gt,ce-=gt,R.back+=gt,R.length=Fe,Bt===0){R.mode=26;break}if(32&Bt){R.back=-1,R.mode=12;break}if(64&Bt){M.msg="invalid literal/length code",R.mode=30;break}R.extra=15&Bt,R.mode=22;case 22:if(R.extra){for(Q=R.extra;ce<Q;){if(U===0)break e;U--,me+=re[Y++]<<ce,ce+=8}R.length+=me&(1<<R.extra)-1,me>>>=R.extra,ce-=R.extra,R.back+=R.extra}R.was=R.length,R.mode=23;case 23:for(;Bt=(K=R.distcode[me&(1<<R.distbits)-1])>>>16&255,Fe=65535&K,!((gt=K>>>24)<=ce);){if(U===0)break e;U--,me+=re[Y++]<<ce,ce+=8}if((240&Bt)==0){for(Le=gt,de=Bt,H=Fe;Bt=(K=R.distcode[H+((me&(1<<Le+de)-1)>>Le)])>>>16&255,Fe=65535&K,!(Le+(gt=K>>>24)<=ce);){if(U===0)break e;U--,me+=re[Y++]<<ce,ce+=8}me>>>=Le,ce-=Le,R.back+=Le}if(me>>>=gt,ce-=gt,R.back+=gt,64&Bt){M.msg="invalid distance code",R.mode=30;break}R.offset=Fe,R.extra=15&Bt,R.mode=24;case 24:if(R.extra){for(Q=R.extra;ce<Q;){if(U===0)break e;U--,me+=re[Y++]<<ce,ce+=8}R.offset+=me&(1<<R.extra)-1,me>>>=R.extra,ce-=R.extra,R.back+=R.extra}if(R.offset>R.dmax){M.msg="invalid distance too far back",R.mode=30;break}R.mode=25;case 25:if(Oe===0)break e;if($e=Re-Oe,R.offset>$e){if(($e=R.offset-$e)>R.whave&&R.sane){M.msg="invalid distance too far back",R.mode=30;break}ot=$e>R.wnext?($e-=R.wnext,R.wsize-$e):R.wnext-$e,$e>R.length&&($e=R.length),kt=R.window}else kt=te,ot=X-R.offset,$e=R.length;for(Oe<$e&&($e=Oe),Oe-=$e,R.length-=$e;te[X++]=kt[ot++],--$e;);R.length===0&&(R.mode=21);break;case 26:if(Oe===0)break e;te[X++]=R.length,Oe--,R.mode=21;break;case 27:if(R.wrap){for(;ce<32;){if(U===0)break e;U--,me|=re[Y++]<<ce,ce+=8}if(Re-=Oe,M.total_out+=Re,R.total+=Re,Re&&(M.adler=R.check=R.flags?a(R.check,te,Re,X-Re):s(R.check,te,Re,X-Re)),Re=Oe,(R.flags?me:w(me))!==R.check){M.msg="incorrect data check",R.mode=30;break}ce=me=0}R.mode=28;case 28:if(R.wrap&&R.flags){for(;ce<32;){if(U===0)break e;U--,me+=re[Y++]<<ce,ce+=8}if(me!==(4294967295&R.total)){M.msg="incorrect length check",R.mode=30;break}ce=me=0}R.mode=29;case 29:ne=1;break e;case 30:ne=-3;break e;case 31:return-4;default:return g}return M.next_out=X,M.avail_out=Oe,M.next_in=Y,M.avail_in=U,R.hold=me,R.bits=ce,(R.wsize||Re!==M.avail_out&&R.mode<30&&(R.mode<27||B!==4))&&j(M,M.output,M.next_out,Re-M.avail_out)?(R.mode=31,-4):(ve-=M.avail_in,Re-=M.avail_out,M.total_in+=ve,M.total_out+=Re,R.total+=Re,R.wrap&&Re&&(M.adler=R.check=R.flags?a(R.check,te,Re,M.next_out-Re):s(R.check,te,Re,M.next_out-Re)),M.data_type=R.bits+(R.last?64:0)+(R.mode===12?128:0)+(R.mode===20||R.mode===15?256:0),(ve==0&&Re===0||B===4)&&ne===p&&(ne=-5),ne)},o.inflateEnd=function(M){if(!M||!M.state)return g;var B=M.state;return B.window&&(B.window=null),M.state=null,p},o.inflateGetHeader=function(M,B){var R;return M&&M.state?(2&(R=M.state).wrap)==0?g:((R.head=B).done=!1,p):g},o.inflateSetDictionary=function(M,B){var R,re=B.length;return M&&M.state?(R=M.state).wrap!==0&&R.mode!==11?g:R.mode===11&&s(1,B,re,0)!==R.check?-3:j(M,B,re,re)?(R.mode=31,-4):(R.havedict=1,p):g},o.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(n,r,o){"use strict";var i=n("../utils/common"),s=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],a=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],l=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],u=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];r.exports=function(d,f,p,g,v,y,_,w){var E,k,C,x,D,P,W,N,L,j=w.bits,M=0,B=0,R=0,re=0,te=0,Y=0,X=0,U=0,Oe=0,me=0,ce=null,ve=0,Re=new i.Buf16(16),$e=new i.Buf16(16),ot=null,kt=0;for(M=0;M<=15;M++)Re[M]=0;for(B=0;B<g;B++)Re[f[p+B]]++;for(te=j,re=15;1<=re&&Re[re]===0;re--);if(re<te&&(te=re),re===0)return v[y++]=20971520,v[y++]=20971520,w.bits=1,0;for(R=1;R<re&&Re[R]===0;R++);for(te<R&&(te=R),M=U=1;M<=15;M++)if(U<<=1,(U-=Re[M])<0)return-1;if(0<U&&(d===0||re!==1))return-1;for($e[1]=0,M=1;M<15;M++)$e[M+1]=$e[M]+Re[M];for(B=0;B<g;B++)f[p+B]!==0&&(_[$e[f[p+B]]++]=B);if(P=d===0?(ce=ot=_,19):d===1?(ce=s,ve-=257,ot=a,kt-=257,256):(ce=l,ot=u,-1),M=R,D=y,X=B=me=0,C=-1,x=(Oe=1<<(Y=te))-1,d===1&&852<Oe||d===2&&592<Oe)return 1;for(;;){for(W=M-X,L=_[B]<P?(N=0,_[B]):_[B]>P?(N=ot[kt+_[B]],ce[ve+_[B]]):(N=96,0),E=1<<M-X,R=k=1<<Y;v[D+(me>>X)+(k-=E)]=W<<24|N<<16|L|0,k!==0;);for(E=1<<M-1;me&E;)E>>=1;if(E!==0?(me&=E-1,me+=E):me=0,B++,--Re[M]==0){if(M===re)break;M=f[p+_[B]]}if(te<M&&(me&x)!==C){for(X===0&&(X=te),D+=R,U=1<<(Y=M-X);Y+X<re&&!((U-=Re[Y+X])<=0);)Y++,U<<=1;if(Oe+=1<<Y,d===1&&852<Oe||d===2&&592<Oe)return 1;v[C=me&x]=te<<24|Y<<16|D-y|0}}return me!==0&&(v[D+me]=M-X<<24|4194304),w.bits=te,0}},{"../utils/common":41}],51:[function(n,r,o){"use strict";r.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(n,r,o){"use strict";var i=n("../utils/common"),s=0,a=1;function l(K){for(var ee=K.length;0<=--ee;)K[ee]=0}var u=0,d=29,f=256,p=f+1+d,g=30,v=19,y=2*p+1,_=15,w=16,E=7,k=256,C=16,x=17,D=18,P=[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],W=[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],N=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],L=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],j=new Array(2*(p+2));l(j);var M=new Array(2*g);l(M);var B=new Array(512);l(B);var R=new Array(256);l(R);var re=new Array(d);l(re);var te,Y,X,U=new Array(g);function Oe(K,ee,le,be,G){this.static_tree=K,this.extra_bits=ee,this.extra_base=le,this.elems=be,this.max_length=G,this.has_stree=K&&K.length}function me(K,ee){this.dyn_tree=K,this.max_code=0,this.stat_desc=ee}function ce(K){return K<256?B[K]:B[256+(K>>>7)]}function ve(K,ee){K.pending_buf[K.pending++]=255&ee,K.pending_buf[K.pending++]=ee>>>8&255}function Re(K,ee,le){K.bi_valid>w-le?(K.bi_buf|=ee<<K.bi_valid&65535,ve(K,K.bi_buf),K.bi_buf=ee>>w-K.bi_valid,K.bi_valid+=le-w):(K.bi_buf|=ee<<K.bi_valid&65535,K.bi_valid+=le)}function $e(K,ee,le){Re(K,le[2*ee],le[2*ee+1])}function ot(K,ee){for(var le=0;le|=1&K,K>>>=1,le<<=1,0<--ee;);return le>>>1}function kt(K,ee,le){var be,G,pe=new Array(_+1),Ee=0;for(be=1;be<=_;be++)pe[be]=Ee=Ee+le[be-1]<<1;for(G=0;G<=ee;G++){var Se=K[2*G+1];Se!==0&&(K[2*G]=ot(pe[Se]++,Se))}}function gt(K){var ee;for(ee=0;ee<p;ee++)K.dyn_ltree[2*ee]=0;for(ee=0;ee<g;ee++)K.dyn_dtree[2*ee]=0;for(ee=0;ee<v;ee++)K.bl_tree[2*ee]=0;K.dyn_ltree[2*k]=1,K.opt_len=K.static_len=0,K.last_lit=K.matches=0}function Bt(K){8<K.bi_valid?ve(K,K.bi_buf):0<K.bi_valid&&(K.pending_buf[K.pending++]=K.bi_buf),K.bi_buf=0,K.bi_valid=0}function Fe(K,ee,le,be){var G=2*ee,pe=2*le;return K[G]<K[pe]||K[G]===K[pe]&&be[ee]<=be[le]}function Le(K,ee,le){for(var be=K.heap[le],G=le<<1;G<=K.heap_len&&(G<K.heap_len&&Fe(ee,K.heap[G+1],K.heap[G],K.depth)&&G++,!Fe(ee,be,K.heap[G],K.depth));)K.heap[le]=K.heap[G],le=G,G<<=1;K.heap[le]=be}function de(K,ee,le){var be,G,pe,Ee,Se=0;if(K.last_lit!==0)for(;be=K.pending_buf[K.d_buf+2*Se]<<8|K.pending_buf[K.d_buf+2*Se+1],G=K.pending_buf[K.l_buf+Se],Se++,be===0?$e(K,G,ee):($e(K,(pe=R[G])+f+1,ee),(Ee=P[pe])!==0&&Re(K,G-=re[pe],Ee),$e(K,pe=ce(--be),le),(Ee=W[pe])!==0&&Re(K,be-=U[pe],Ee)),Se<K.last_lit;);$e(K,k,ee)}function H(K,ee){var le,be,G,pe=ee.dyn_tree,Ee=ee.stat_desc.static_tree,Se=ee.stat_desc.has_stree,Ge=ee.stat_desc.elems,ht=-1;for(K.heap_len=0,K.heap_max=y,le=0;le<Ge;le++)pe[2*le]!==0?(K.heap[++K.heap_len]=ht=le,K.depth[le]=0):pe[2*le+1]=0;for(;K.heap_len<2;)pe[2*(G=K.heap[++K.heap_len]=ht<2?++ht:0)]=1,K.depth[G]=0,K.opt_len--,Se&&(K.static_len-=Ee[2*G+1]);for(ee.max_code=ht,le=K.heap_len>>1;1<=le;le--)Le(K,pe,le);for(G=Ge;le=K.heap[1],K.heap[1]=K.heap[K.heap_len--],Le(K,pe,1),be=K.heap[1],K.heap[--K.heap_max]=le,K.heap[--K.heap_max]=be,pe[2*G]=pe[2*le]+pe[2*be],K.depth[G]=(K.depth[le]>=K.depth[be]?K.depth[le]:K.depth[be])+1,pe[2*le+1]=pe[2*be+1]=G,K.heap[1]=G++,Le(K,pe,1),2<=K.heap_len;);K.heap[--K.heap_max]=K.heap[1],(function(Me,qe){var Jt,St,Ut,Lt,mn,ut,en=qe.dyn_tree,Tn=qe.max_code,Cn=qe.stat_desc.static_tree,ar=qe.stat_desc.has_stree,pr=qe.stat_desc.extra_bits,Vn=qe.stat_desc.extra_base,Gn=qe.stat_desc.max_length,lr=0;for(Lt=0;Lt<=_;Lt++)Me.bl_count[Lt]=0;for(en[2*Me.heap[Me.heap_max]+1]=0,Jt=Me.heap_max+1;Jt<y;Jt++)Gn<(Lt=en[2*en[2*(St=Me.heap[Jt])+1]+1]+1)&&(Lt=Gn,lr++),en[2*St+1]=Lt,Tn<St||(Me.bl_count[Lt]++,mn=0,Vn<=St&&(mn=pr[St-Vn]),ut=en[2*St],Me.opt_len+=ut*(Lt+mn),ar&&(Me.static_len+=ut*(Cn[2*St+1]+mn)));if(lr!==0){do{for(Lt=Gn-1;Me.bl_count[Lt]===0;)Lt--;Me.bl_count[Lt]--,Me.bl_count[Lt+1]+=2,Me.bl_count[Gn]--,lr-=2}while(0<lr);for(Lt=Gn;Lt!==0;Lt--)for(St=Me.bl_count[Lt];St!==0;)Tn<(Ut=Me.heap[--Jt])||(en[2*Ut+1]!==Lt&&(Me.opt_len+=(Lt-en[2*Ut+1])*en[2*Ut],en[2*Ut+1]=Lt),St--)}})(K,ee),kt(pe,ht,K.bl_count)}function A(K,ee,le){var be,G,pe=-1,Ee=ee[1],Se=0,Ge=7,ht=4;for(Ee===0&&(Ge=138,ht=3),ee[2*(le+1)+1]=65535,be=0;be<=le;be++)G=Ee,Ee=ee[2*(be+1)+1],++Se<Ge&&G===Ee||(Se<ht?K.bl_tree[2*G]+=Se:G!==0?(G!==pe&&K.bl_tree[2*G]++,K.bl_tree[2*C]++):Se<=10?K.bl_tree[2*x]++:K.bl_tree[2*D]++,pe=G,ht=(Se=0)===Ee?(Ge=138,3):G===Ee?(Ge=6,3):(Ge=7,4))}function ne(K,ee,le){var be,G,pe=-1,Ee=ee[1],Se=0,Ge=7,ht=4;for(Ee===0&&(Ge=138,ht=3),be=0;be<=le;be++)if(G=Ee,Ee=ee[2*(be+1)+1],!(++Se<Ge&&G===Ee)){if(Se<ht)for(;$e(K,G,K.bl_tree),--Se!=0;);else G!==0?(G!==pe&&($e(K,G,K.bl_tree),Se--),$e(K,C,K.bl_tree),Re(K,Se-3,2)):Se<=10?($e(K,x,K.bl_tree),Re(K,Se-3,3)):($e(K,D,K.bl_tree),Re(K,Se-11,7));pe=G,ht=(Se=0)===Ee?(Ge=138,3):G===Ee?(Ge=6,3):(Ge=7,4)}}l(U);var V=!1;function Q(K,ee,le,be){Re(K,(u<<1)+(be?1:0),3),(function(G,pe,Ee,Se){Bt(G),Se&&(ve(G,Ee),ve(G,~Ee)),i.arraySet(G.pending_buf,G.window,pe,Ee,G.pending),G.pending+=Ee})(K,ee,le,!0)}o._tr_init=function(K){V||((function(){var ee,le,be,G,pe,Ee=new Array(_+1);for(G=be=0;G<d-1;G++)for(re[G]=be,ee=0;ee<1<<P[G];ee++)R[be++]=G;for(R[be-1]=G,G=pe=0;G<16;G++)for(U[G]=pe,ee=0;ee<1<<W[G];ee++)B[pe++]=G;for(pe>>=7;G<g;G++)for(U[G]=pe<<7,ee=0;ee<1<<W[G]-7;ee++)B[256+pe++]=G;for(le=0;le<=_;le++)Ee[le]=0;for(ee=0;ee<=143;)j[2*ee+1]=8,ee++,Ee[8]++;for(;ee<=255;)j[2*ee+1]=9,ee++,Ee[9]++;for(;ee<=279;)j[2*ee+1]=7,ee++,Ee[7]++;for(;ee<=287;)j[2*ee+1]=8,ee++,Ee[8]++;for(kt(j,p+1,Ee),ee=0;ee<g;ee++)M[2*ee+1]=5,M[2*ee]=ot(ee,5);te=new Oe(j,P,f+1,p,_),Y=new Oe(M,W,0,g,_),X=new Oe(new Array(0),N,0,v,E)})(),V=!0),K.l_desc=new me(K.dyn_ltree,te),K.d_desc=new me(K.dyn_dtree,Y),K.bl_desc=new me(K.bl_tree,X),K.bi_buf=0,K.bi_valid=0,gt(K)},o._tr_stored_block=Q,o._tr_flush_block=function(K,ee,le,be){var G,pe,Ee=0;0<K.level?(K.strm.data_type===2&&(K.strm.data_type=(function(Se){var Ge,ht=4093624447;for(Ge=0;Ge<=31;Ge++,ht>>>=1)if(1&ht&&Se.dyn_ltree[2*Ge]!==0)return s;if(Se.dyn_ltree[18]!==0||Se.dyn_ltree[20]!==0||Se.dyn_ltree[26]!==0)return a;for(Ge=32;Ge<f;Ge++)if(Se.dyn_ltree[2*Ge]!==0)return a;return s})(K)),H(K,K.l_desc),H(K,K.d_desc),Ee=(function(Se){var Ge;for(A(Se,Se.dyn_ltree,Se.l_desc.max_code),A(Se,Se.dyn_dtree,Se.d_desc.max_code),H(Se,Se.bl_desc),Ge=v-1;3<=Ge&&Se.bl_tree[2*L[Ge]+1]===0;Ge--);return Se.opt_len+=3*(Ge+1)+5+5+4,Ge})(K),G=K.opt_len+3+7>>>3,(pe=K.static_len+3+7>>>3)<=G&&(G=pe)):G=pe=le+5,le+4<=G&&ee!==-1?Q(K,ee,le,be):K.strategy===4||pe===G?(Re(K,2+(be?1:0),3),de(K,j,M)):(Re(K,4+(be?1:0),3),(function(Se,Ge,ht,Me){var qe;for(Re(Se,Ge-257,5),Re(Se,ht-1,5),Re(Se,Me-4,4),qe=0;qe<Me;qe++)Re(Se,Se.bl_tree[2*L[qe]+1],3);ne(Se,Se.dyn_ltree,Ge-1),ne(Se,Se.dyn_dtree,ht-1)})(K,K.l_desc.max_code+1,K.d_desc.max_code+1,Ee+1),de(K,K.dyn_ltree,K.dyn_dtree)),gt(K),be&&Bt(K)},o._tr_tally=function(K,ee,le){return K.pending_buf[K.d_buf+2*K.last_lit]=ee>>>8&255,K.pending_buf[K.d_buf+2*K.last_lit+1]=255&ee,K.pending_buf[K.l_buf+K.last_lit]=255&le,K.last_lit++,ee===0?K.dyn_ltree[2*le]++:(K.matches++,ee--,K.dyn_ltree[2*(R[le]+f+1)]++,K.dyn_dtree[2*ce(ee)]++),K.last_lit===K.lit_bufsize-1},o._tr_align=function(K){Re(K,2,3),$e(K,k,j),(function(ee){ee.bi_valid===16?(ve(ee,ee.bi_buf),ee.bi_buf=0,ee.bi_valid=0):8<=ee.bi_valid&&(ee.pending_buf[ee.pending++]=255&ee.bi_buf,ee.bi_buf>>=8,ee.bi_valid-=8)})(K)}},{"../utils/common":41}],53:[function(n,r,o){"use strict";r.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(n,r,o){(function(i){(function(s,a){"use strict";if(!s.setImmediate){var l,u,d,f,p=1,g={},v=!1,y=s.document,_=Object.getPrototypeOf&&Object.getPrototypeOf(s);_=_&&_.setTimeout?_:s,l={}.toString.call(s.process)==="[object process]"?function(C){process.nextTick(function(){E(C)})}:(function(){if(s.postMessage&&!s.importScripts){var C=!0,x=s.onmessage;return s.onmessage=function(){C=!1},s.postMessage("","*"),s.onmessage=x,C}})()?(f="setImmediate$"+Math.random()+"$",s.addEventListener?s.addEventListener("message",k,!1):s.attachEvent("onmessage",k),function(C){s.postMessage(f+C,"*")}):s.MessageChannel?((d=new MessageChannel).port1.onmessage=function(C){E(C.data)},function(C){d.port2.postMessage(C)}):y&&"onreadystatechange"in y.createElement("script")?(u=y.documentElement,function(C){var x=y.createElement("script");x.onreadystatechange=function(){E(C),x.onreadystatechange=null,u.removeChild(x),x=null},u.appendChild(x)}):function(C){setTimeout(E,0,C)},_.setImmediate=function(C){typeof C!="function"&&(C=new Function(""+C));for(var x=new Array(arguments.length-1),D=0;D<x.length;D++)x[D]=arguments[D+1];return g[p]={callback:C,args:x},l(p),p++},_.clearImmediate=w}function w(C){delete g[C]}function E(C){if(v)setTimeout(E,0,C);else{var x=g[C];if(x){v=!0;try{(function(D){var P=D.callback,W=D.args;switch(W.length){case 0:P();break;case 1:P(W[0]);break;case 2:P(W[0],W[1]);break;case 3:P(W[0],W[1],W[2]);break;default:P.apply(a,W)}})(x)}finally{w(C),v=!1}}}}function k(C){C.source===s&&typeof C.data=="string"&&C.data.indexOf(f)===0&&E(+C.data.slice(f.length))}})(typeof self>"u"?i===void 0?this:i:self)}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})),jr="application/vnd.openxmlformats-officedocument.wordprocessingml.document",Qa="application/pdf",vh="text/html",T8={docx:jr,pdf:Qa,html:vh},Em={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"},x8=e=>typeof e!="string"?"":e.trim(),Wb=e=>{if(typeof e!="string")return"";const t=e.trim();return t?t.toLowerCase():""},Tm=e=>{if(typeof e!="string")return"";const t=e.trim();return t?t.toLowerCase():""},Wc=e=>{const t=e??{},n=x8(t.id),r=Wb(t.email);return{id:n,email:r,name:typeof t.name=="string"?t.name:"",hasId:n.length>0,hasEmail:r.length>0}},DS=({current:e,other:t})=>{const n=Wc(e),r=Wc(t);return n.hasId&&r.hasId?n.id===r.id:n.hasEmail&&r.hasEmail?n.email===r.email:!1},xm=({actor:e,fallbackKey:t=""})=>{const n=Wc(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 R8(e){return typeof e.captureStackTrace=="function"}var Rm=class extends Error{constructor(e,t){super(e),this.cause=t,this.name="FileObjectError",R8(Error)&&Error.captureStackTrace(this,this.constructor)}},M8=class extends Rm{constructor(e){super("Invalid data URI format: URI must contain exactly one comma separator"),this.uri=e,this.name="InvalidDataUriError"}},L8=class extends Rm{constructor(e,t){super(`Failed to fetch file from URL: ${e}`,t),this.url=e,this.name="FetchFailedError"}},Kb=async(e,t,n,r)=>{try{if(e.startsWith("data:")&&e.includes(";base64,")){const s=e.split(",");if(s.length!==2)throw new M8(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 Rm?o:new Rm("Failed to create file object",o)}};function O8(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 Mm=new WeakMap;function PS(e){return e.ownerDocument??document}function FS(e,t){const n=Mm.get(t);n?.bindings.delete(e),n&&n.bindings.size===0&&(t.removeEventListener("click",n.listener),Mm.delete(t))}function NS(e,t){const n=PS(e);e.__clickOutsideDocument&&e.__clickOutsideDocument!==n&&FS(e,e.__clickOutsideDocument);let r=Mm.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},Mm.set(n,r),n.addEventListener("click",i)}r.bindings.set(e,t),e.__clickOutsideHandler=r.listener,e.__clickOutsideDocument=n}var qb={mounted(e,t){NS(e,t)},updated(e,t){NS(e,t)},unmounted(e){FS(e,e.__clickOutsideDocument??PS(e)),delete e.__clickOutsideHandler,delete e.__clickOutsideDocument}},D8="https://ingest.superdoc.dev/v1/collect",pZ="community-and-eval-agplv3";function P8(){try{return"2.28.0-next.8"}catch{return"unknown"}}var F8=class{constructor(e){this.enabled=e.enabled,this.endpoint=e.endpoint||D8,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{}}};Wt();var N8=vw(E8(),1),Lm={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"},mZ=[Lm.INLINE_SDT_LABEL,Lm.BLOCK_SDT_LABEL],BS={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"},B8=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"}}},gZ=`.${Lm.BLOCK_SDT}[${BS.SDT_ID}]`,vZ=`[${BS.DRAGGABLE}="true"]`,z8=typeof window<"u",zS,yh=e=>zS=e,VS=Symbol();function Yb(e){return e&&typeof e=="object"&&Object.prototype.toString.call(e)==="[object Object]"&&typeof e.toJSON!="function"}var bh;(function(e){e.direct="direct",e.patchObject="patch object",e.patchFunction="patch function"})(bh||(bh={}));var jS=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 V8(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 Xb(e,t,n){const r=new XMLHttpRequest;r.open("GET",e),r.responseType="blob",r.onload=function(){j8(r.response,t,n)},r.onerror=function(){console.error("could not download file")},r.send()}function US(e){const t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch{}return t.status>=200&&t.status<=299}function Om(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 Dm=typeof navigator=="object"?navigator:{userAgent:""},$S=/Macintosh/.test(Dm.userAgent)&&/AppleWebKit/.test(Dm.userAgent)&&!/Safari/.test(Dm.userAgent),j8=z8?typeof HTMLAnchorElement<"u"&&"download"in HTMLAnchorElement.prototype&&!$S?U8:"msSaveOrOpenBlob"in Dm?$8:H8:()=>{};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?US(r.href)?Xb(e,t,n):(r.target="_blank",Om(r)):Om(r)):(r.href=URL.createObjectURL(e),setTimeout(function(){URL.revokeObjectURL(r.href)},4e4),setTimeout(function(){Om(r)},0))}function $8(e,t="download",n){if(typeof e=="string")if(US(e))Xb(e,t,n);else{const r=document.createElement("a");r.href=e,r.target="_blank",setTimeout(function(){Om(r)})}else navigator.msSaveOrOpenBlob(V8(e,n),t)}function H8(e,t,n,r){if(r=r||open("","_blank"),r&&(r.document.title=r.document.body.innerText="downloading..."),typeof e=="string")return Xb(e,t,n);const o=e.type==="application/octet-stream",i=/constructor/i.test(String(jS.HTMLElement))||"safari"in jS,s=/CriOS\/[\d]+/.test(navigator.userAgent);if((s||o&&i||$S)&&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:yZ}=Object;function G8(){const e=ny(!0),t=e.run(()=>oe({}));let n=[],r=[];const o=Wo({install(i){yh(o),o._a=i,i.provide(VS,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 HS=()=>{};function GS(e,t,n,r=HS){e.add(t);const o=()=>{e.delete(t)&&r()};return!n&&ry()&&Fw(o),o}function ld(e,...t){e.forEach(n=>{n(...t)})}var W8=e=>e(),WS=Symbol(),Zb=Symbol();function Qb(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];Yb(o)&&Yb(r)&&e.hasOwnProperty(n)&&!Or(r)&&!Ti(r)?e[n]=Qb(o,r):e[n]=r}return e}var K8=Symbol();function q8(e){return!Yb(e)||!Object.prototype.hasOwnProperty.call(e,K8)}var{assign:Gl}=Object;function Y8(e){return!!(Or(e)&&e.effect)}function X8(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=Kw(n.state.value[e]);return Gl(d,i,Object.keys(s||{}).reduce((f,p)=>(f[p]=Wo(ke(()=>{yh(n);const g=n._s.get(e);return s[p].call(g,g)})),f),{}))}return l=KS(e,u,t,n,r,!0),l}function KS(e,t,n={},r,o,i){let s;const a=Gl({actions:{}},n),l={deep:!0};let u,d,f=new Set,p=new Set,g;const v=r.state.value[e];!i&&!v&&(r.state.value[e]={});let y;function _(D){let P;u=d=!1,typeof D=="function"?(D(r.state.value[e]),P={type:bh.patchFunction,storeId:e,events:g}):(Qb(r.state.value[e],D),P={type:bh.patchObject,payload:D,storeId:e,events:g});const W=y=Symbol();Tt().then(()=>{y===W&&(u=!0)}),d=!0,ld(f,P,r.state.value[e])}const w=i?function(){const{state:P}=n,W=P?P():{};this.$patch(N=>{Gl(N,W)})}:HS;function E(){s.stop(),f.clear(),p.clear(),r._s.delete(e)}const k=(D,P="")=>{if(WS in D)return D[Zb]=P,D;const W=function(){yh(r);const N=Array.from(arguments),L=new Set,j=new Set;function M(re){L.add(re)}function B(re){j.add(re)}ld(p,{args:N,name:W[Zb],store:C,after:M,onError:B});let R;try{R=D.apply(this&&this.$id===e?this:C,N)}catch(re){throw ld(j,re),re}return R instanceof Promise?R.then(re=>(ld(L,re),re)).catch(re=>(ld(j,re),Promise.reject(re))):(ld(L,R),R)};return W[WS]=!0,W[Zb]=P,W},C=ho({_p:r,$id:e,$onAction:GS.bind(null,p),$patch:_,$reset:w,$subscribe(D,P={}){const W=GS(f,D,P.detached,()=>N()),N=s.run(()=>Kt(()=>r.state.value[e],L=>{(P.flush==="sync"?d:u)&&D({storeId:e,type:bh.direct,events:g},L)},Gl({},l,P)));return W},$dispose:E});r._s.set(e,C);const x=(r._a&&r._a.runWithContext||W8)(()=>r._e.run(()=>(s=ny()).run(()=>t({action:k}))));for(const D in x){const P=x[D];Or(P)&&!Y8(P)||Ti(P)?i||(v&&q8(P)&&(Or(P)?P.value=v[D]:Qb(P,v[D])),r.state.value[e][D]=P):typeof P=="function"&&(x[D]=k(P,D),a.actions[D]=P)}return Gl(C,x),Gl(Bn(C),x),Object.defineProperty(C,"$state",{get:()=>r.state.value[e],set:D=>{_(P=>{Gl(P,D)})}}),r._p.forEach(D=>{Gl(C,s.run(()=>D({store:C,app:r._a,pinia:r,options:a})))}),v&&i&&n.hydrate&&n.hydrate(C.$state,v),u=!0,d=!0,C}function qS(e,t,n){let r;const o=typeof t=="function";r=o?n:t;function i(s,a){const l=wC();return s=s||(l?ea(VS,null):null),s&&yh(s),s=zS,s._s.has(e)||(o?KS(e,t,r,s):X8(e,r,s)),s._s.get(e)}return i.$id=e,i}function aa(e){const t=Bn(e),n={};for(const r in t){const o=t[r];o.effect?n[r]=ke({get:()=>e[r],set(i){e[r]=i}}):(Or(o)||Ti(o))&&(n[r]=dy(e,r))}return n}var YS=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 Z8(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((g,v)=>{s=v});u.catch(()=>{});const d=()=>{i!==void 0&&clearTimeout(i),e.signal?.removeEventListener("abort",p)},f=g=>{if(!(r||o)){o=new YS(g,t),d(),n.abort(o),s(o);for(const v of l)v();l.clear();for(const v of[...a])v(o);a.clear()}},p=()=>f("DOCUMENT_LOAD_CANCELLED");return e.timeoutMs!==void 0&&(i=setTimeout(()=>f("DOCUMENT_LOAD_TIMEOUT"),e.timeoutMs)),e.signal?.addEventListener("abort",p,{once:!0}),e.signal?.aborted&&p(),{signal:n.signal,wait(g){return o?Promise.reject(o):Promise.race([u,g])},assertActive(){if(o)throw o},finish(){if(o)return!1;r=!0,d(),a.clear();for(const g of l)g();return l.clear(),!0},cancel:p,onSettled(g){r||o?g():l.add(g)},onFailure(g){return o?g(o):r||a.add(g),()=>a.delete(g)}}}function XS(e){return e.collaboration!==void 0?e.collaboration:e.v2Collaboration}function ZS(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 Kc(e){return typeof e=="string"&&e.length>0?e:null}function Q8(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 J8(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 eR(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 Jb(e){return e===void 0?"join":e==="join"||e==="create"?e:null}function tR(e){if(e!==void 0)return typeof e=="number"&&Number.isFinite(e)&&e>0&&e<=2147483647?e:null}function Pm(e,t){return!e.ok||t===void 0?e:{ok:!0,target:{...e.target,syncTimeoutMs:t}}}function e0(){return{ok:!1,reason:"invalid-room-mode",message:'SuperDoc v2 collaboration roomMode must be either "join" or "create".'}}function nR(e){const t=e.providerType;return typeof t=="string"&&t.length>0?t.toLowerCase():null}function rR(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 QS(e,t){const n=Kc(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=Q8(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: ${ZS(r)}).`};const i=eR(t.params),s=e==="hocuspocus"&&typeof t.token=="function"?t.token:e==="hocuspocus"?Kc(t.token):null,a=Jb(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}:{}}}:e0()}function oR(e){const t=Kc(e.adapterId);if(!t)return{ok:!1,reason:"invalid-adapter-id",message:"SuperDoc v2 provider extensions require a non-empty collaboration.adapterId."};const n=Kc(e.documentId);if(!n)return{ok:!1,reason:"invalid-document-id",message:"SuperDoc v2 provider extensions require a non-empty collaboration.documentId."};const r=Jb(e.roomMode);if(!r)return e0();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:Kc(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 iR(e,t){const n=Kc(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=Kc(e.publicApiKey),o=Jb(e.roomMode);if(!o)return e0();const i=e.authEndpoint,s=typeof i=="string"&&i.length>0;if(!r&&!s)return{ok:!1,reason:"missing-auth",message:"SuperDoc v2 Liveblocks collaboration requires exactly one auth mode: a publicApiKey or an authEndpoint. None was provided."};if(r&&s)return{ok:!1,reason:"mixed-auth",message:"SuperDoc v2 Liveblocks collaboration accepts exactly one auth mode; pass either publicApiKey or authEndpoint, not both."};if(r)return{ok:!0,target:{providerFamily:"liveblocks",documentId:n,roomMode:o,publicApiKey:r}};const a=J8(i,t);return a?{ok:!0,target:{providerFamily:"liveblocks",documentId:n,roomMode:o,authEndpoint:a}}:{ok:!1,reason:"invalid-auth-endpoint",message:"SuperDoc v2 Liveblocks collaboration requires a valid http(s) authEndpoint URL (received: <redacted>)."}}function JS(e){const{legacyCollaboration:t,documentType:n,documentCount:r,authEndpointBaseUrl:o}=e,i=XS(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=rR(t);if(u){const d=u==="external-ydoc-provider"?"unsupported-legacy-provider":"unsupported-provider-family",f=ZS(t?.url);return{ok:!1,reason:d,message:u==="external-ydoc-provider"?"SuperDoc v2 collaboration cannot use an external { ydoc, provider } pair. Provide a collaboration target (e.g. { providerType, documentId, url }) instead.":`SuperDoc v2 collaboration does not accept "${u}" through the legacy modules.collaboration block (server: ${f}). Configure it as a document.collaboration target ({ providerType: "${u}", documentId, ... }) instead.`}}return{ok:!1,reason:"missing-target",message:"SuperDoc v2 collaboration requires a collaboration target ({ documentId, serverUrl } or { providerType, ... }). None was provided."}}const s=i;if(Object.prototype.hasOwnProperty.call(s,"createIfMissing"))return{ok:!1,reason:"invalid-room-mode",message:'SuperDoc v2 collaboration createIfMissing has been removed. Use roomMode: "create" for creation or roomMode: "join" for normal opens.'};if(s.ydoc!=null||s.provider!=null)return{ok:!1,reason:"unsupported-legacy-provider",message:"SuperDoc v2 collaboration cannot use an external { ydoc, provider } pair. v2 owns its provider; pass a collaboration target ({ providerType, documentId, serverUrl | publicApiKey | authEndpoint }) instead."};const a=tR(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=nR(s);return l===null||l==="y-websocket"?Pm(QS("y-websocket",s),a):l==="hocuspocus"?Pm(QS("hocuspocus",s),a):l==="liveblocks"?Pm(iR(s,o),a):l==="extension"?Pm(oR(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 wh=(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?wh(e.originFileObj,e.name||t):e.file?wh(e.file,e.name||t):e.raw?wh(e.raw,e.name||t):null},e3=Object.getOwnPropertyDescriptor(ArrayBuffer.prototype,"byteLength")?.get,sR=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Uint8Array.prototype),Symbol.toStringTag)?.get,Wl=e=>{if(ArrayBuffer.isView(e))return sR?.call(e)==="Uint8Array";if(!e3)return!1;try{return e3.call(e),!0}catch{return!1}},t0=e=>{if(e instanceof Uint8Array)return e;const t=ArrayBuffer.isView(e)?e:new Uint8Array(e);return Uint8Array.from(t)},n0=(e,t)=>new Blob([t0(e)],{type:t}),r0=e=>{switch(e.toLowerCase()){case"docx":case jr:return jr;case"pdf":case Qa:return Qa;case"html":case vh:return vh;default:return e}},Fm=(e="")=>{const t=String(e).toLowerCase();return t.endsWith(".docx")?jr:t.endsWith(".pdf")?Qa:t.endsWith(".html")||t.endsWith(".htm")?vh:t.endsWith(".md")||t.endsWith(".markdown")?"text/markdown":""},aR=e=>e==="application/vnd.openxmlformats-officedocument.wordprocessingml.document"?"document.docx":e==="application/pdf"?"document.pdf":e==="text/html"?"document.html":"document",lR="application/octet-stream",o0=e=>{if(e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"collaboration")){const n={...e};delete n.collaboration,e={...n,v2Collaboration:XS(e)}}if(Wl(e))return{type:jr,data:t0(e),name:"document.docx"};const t=wh(e);if(t){const n=e&&typeof e.name=="string"?e.name:"",r=t.name||"",o=Fm(n),i=o||Fm(r),s=t.type.toLowerCase()===lR,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(Wl(e.data)){const r=r0(e.type||Fm(e.name)||"application/vnd.openxmlformats-officedocument.wordprocessingml.document");return{...e,type:r,data:r==="application/vnd.openxmlformats-officedocument.wordprocessingml.document"?t0(e.data):n0(e.data,r),name:e.name||aR(r)}}const n=wh(e.data,e.name);if(n){const r=typeof e.type=="string"&&e.type?r0(e.type):"",o=r||n.type||Fm(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=r0(e.type);if(n!==e.type)return{...e,type:n}}return e};Wt();function cR(e,t){const n=e.itemid,r=e,o=t!==null&&typeof t=="object"?ho({...t}):oe(t),i=oe(null);return Kt(o,(a,l)=>{const u={fieldId:n.value,changeTime:Date.now(),oldValue:l,newValue:a,originalField:r};i.value=u}),{value:o}}function uR(e){const t=oe(e.itemid),n=oe(e.itemicon),r=oe(e.itemiconpack),o=oe(e.itemdisplaylabel),i=e.itemlinkvalue,s=e.itemplaceholdertext,{value:a}=cR(e,i,oe([])),l=oe(e.itemtype),u=oe(e.itemfieldtype),d=e,f=ho({fontFamily:e.fontfamily||"Arial",fontSize:e.font_size||"12pt",originalFontSize:e.original_font_size||"12pt"}),p=oe(e.logicrules),g=oe(!1),v=ho({}),y={SELECT:fR,IMAGEINPUT:dR,CHECKBOXINPUT:hR};return l.value in y&&Object.assign(v,y[l.value](e)),{id:t,icon:n,iconPack:r,label:o,placeholder:s,fieldType:l,fieldSubType:u,value:a,format:oe(e.itemformat),logicRules:p,hidden:g,originalJSON:d,fieldStyle:f,valueGetter:e.valueGetter,...v}}function dR(e){return{fontfamily:oe(e.fontfamily),iteminputtype:oe(e.iteminputtype)}}function fR(e){return{options:oe(e.itemoptions)}}function hR(e){const t=oe(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 la=()=>new Map,i0=e=>{const t=la();return e.forEach((n,r)=>{t.set(r,n)}),t},cd=(e,t,n)=>{let r=e.get(t);return r===void 0&&e.set(t,r=n()),r},pR=(e,t)=>{const n=[];for(const[r,o]of e)n.push(t(o,r));return n},mR=(e,t)=>{for(const[n,r]of e)if(t(r,n))return!0;return!1},ud=()=>new Set,s0=e=>e[e.length-1],dd=Array.from,a0=(e,t)=>{for(let n=0;n<e.length;n++)if(!t(e[n],n,e))return!1;return!0},t3=(e,t)=>{for(let n=0;n<e.length;n++)if(t(e[n],n,e))return!0;return!1},gR=(e,t)=>{const n=new Array(e);for(let r=0;r<e;r++)n[r]=t(r,n);return n},Nm=Array.isArray,vR=class{constructor(){this._observers=la()}on(e,t){return cd(this._observers,e,ud).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 dd((this._observers.get(e)||la()).values()).forEach(n=>n(...t))}destroy(){this._observers=la()}},Ja=Math.floor,Bm=Math.abs,n3=(e,t)=>e<t?e:t,fd=(e,t)=>e>t?e:t,bZ=Number.isNaN,yR=e=>e!==0?e<0:1/e<0,wZ=1,CZ=2,kZ=4,SZ=8,_Z=32,AZ=64,IZ=128,bR=1<<17,wR=1<<18,CR=1<<19,kR=1<<20,SR=1<<21,_R=1<<22,AR=1<<23,IR=1<<24,ER=1<<25,TR=1<<26,xR=1<<27,RR=1<<28,MR=1<<29,LR=1<<30,EZ=31,TZ=63,xZ=127,RZ=bR-1,MZ=wR-1,LZ=CR-1,OZ=kR-1,DZ=SR-1,PZ=_R-1,FZ=AR-1,NZ=IR-1,BZ=ER-1,zZ=TR-1,VZ=xR-1,jZ=RR-1,UZ=MR-1,$Z=LR-1,HZ=2147483647,r3=Number.MAX_SAFE_INTEGER,o3=Number.MIN_SAFE_INTEGER,OR=Number.isInteger||(e=>typeof e=="number"&&isFinite(e)&&Ja(e)===e),GZ=Number.isNaN,WZ=Number.parseInt,i3=String.fromCharCode,KZ=String.fromCodePoint,qZ=i3(65535),DR=e=>e.toLowerCase(),PR=/^\s*/g,FR=e=>e.replace(PR,""),NR=/([A-Z])/g,s3=(e,t)=>FR(e.replace(NR,n=>`${t}${DR(n)}`)),BR=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},Ch=typeof TextEncoder<"u"?new TextEncoder:null,zR=e=>Ch.encode(e),VR=Ch?zR:BR,l0=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});l0&&l0.decode(new Uint8Array).length===1&&(l0=null);var jR=(e,t)=>gR(t,()=>e).join(""),kh=class{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}},c0=()=>new kh,UR=e=>{let t=e.cpos;for(let n=0;n<e.bufs.length;n++)t+=e.bufs[n].length;return t},el=e=>{const t=new Uint8Array(UR(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},$R=(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(fd(n,t)*2),e.cpos=0)},Do=(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},u0=Do,Cr=(e,t)=>{for(;t>127;)Do(e,128|127&t),t=Ja(t/128);Do(e,127&t)},d0=(e,t)=>{const n=yR(t);for(n&&(t=-t),Do(e,(t>63?128:0)|(n?64:0)|63&t),t=Ja(t/64);t>0;)Do(e,(t>127?128:0)|127&t),t=Ja(t/128)},f0=new Uint8Array(3e4),HR=f0.length/3,GR=(e,t)=>{if(t.length<HR){const n=Ch.encodeInto(t,f0).written||0;Cr(e,n);for(let r=0;r<n;r++)Do(e,f0[r])}else Gi(e,VR(t))},WR=(e,t)=>{const n=unescape(encodeURIComponent(t)),r=n.length;Cr(e,r);for(let o=0;o<r;o++)Do(e,n.codePointAt(o))},hd=Ch&&Ch.encodeInto?GR:WR,h0=(e,t)=>{const n=e.cbuf.length,r=e.cpos,o=n3(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(fd(n*2,i)),e.cbuf.set(t.subarray(o)),e.cpos=i)},Gi=(e,t)=>{Cr(e,t.byteLength),h0(e,t)},p0=(e,t)=>{$R(e,t);const n=new DataView(e.cbuf.buffer,e.cpos,t);return e.cpos+=t,n},KR=(e,t)=>p0(e,4).setFloat32(0,t,!1),qR=(e,t)=>p0(e,8).setFloat64(0,t,!1),YR=(e,t)=>p0(e,8).setBigInt64(0,t,!1),a3=new DataView(new ArrayBuffer(4)),XR=e=>(a3.setFloat32(0,e),a3.getFloat32(0)===e),Sh=(e,t)=>{switch(typeof t){case"string":Do(e,119),hd(e,t);break;case"number":OR(t)&&Bm(t)<=2147483647?(Do(e,125),d0(e,t)):XR(t)?(Do(e,124),KR(e,t)):(Do(e,123),qR(e,t));break;case"bigint":Do(e,122),YR(e,t);break;case"object":if(t===null)Do(e,126);else if(Nm(t)){Do(e,117),Cr(e,t.length);for(let n=0;n<t.length;n++)Sh(e,t[n])}else if(t instanceof Uint8Array)Do(e,116),Gi(e,t);else{Do(e,118);const n=Object.keys(t);Cr(e,n.length);for(let r=0;r<n.length;r++){const o=n[r];hd(e,o),Sh(e,t[o])}}break;case"boolean":Do(e,t?120:121);break;default:Do(e,127)}},l3=class extends kh{constructor(e){super(),this.w=e,this.s=null,this.count=0}write(e){this.s===e?this.count++:(this.count>0&&Cr(this,this.count-1),this.count=1,this.w(this,e),this.s=e)}},c3=e=>{e.count>0&&(d0(e.encoder,e.count===1?e.s:-e.s),e.count>1&&Cr(e.encoder,e.count-2))},zm=class{constructor(){this.encoder=new kh,this.s=0,this.count=0}write(e){this.s===e?this.count++:(c3(this),this.count=1,this.s=e)}toUint8Array(){return c3(this),el(this.encoder)}},u3=e=>{if(e.count>0){const t=e.diff*2+(e.count===1?0:1);d0(e.encoder,t),e.count>1&&Cr(e.encoder,e.count-2)}},m0=class{constructor(){this.encoder=new kh,this.s=0,this.count=0,this.diff=0}write(e){this.diff===e-this.s?(this.s=e,this.count++):(u3(this),this.count=1,this.diff=e-this.s,this.s=e)}toUint8Array(){return u3(this),el(this.encoder)}},ZR=class{constructor(){this.sarr=[],this.s="",this.lensE=new zm}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 kh;return this.sarr.push(this.s),this.s="",hd(e,this.sarr.join("")),h0(e,this.lensE.toUint8Array()),el(e)}},Kl=e=>new Error(e),Is=()=>{throw Kl("Method unimplemented")},tl=()=>{throw Kl("Unexpected case")},YZ=crypto.subtle,QR=crypto.getRandomValues.bind(crypto),d3=()=>QR(new Uint32Array(1))[0],JR="10000000-1000-4000-8000-100000000000",e7=()=>JR.replace(/[018]/g,e=>(e^d3()&15>>e/4).toString(16)),t7=Date.now,f3=e=>new Promise(e),XZ=Promise.all.bind(Promise),h3=e=>e===void 0?null:e,n7=class{constructor(){this.map=new Map}setItem(e,t){this.map.set(e,t)}getItem(e){return this.map.get(e)}},p3=new n7,r7=!0;try{typeof localStorage<"u"&&localStorage&&(p3=localStorage,r7=!1)}catch{}var o7=p3,_h=Symbol("Equality"),m3=(e,t)=>e===t||!!e?.[_h]?.(t)||!1,i7=e=>typeof e=="object",s7=Object.assign,a7=Object.keys,l7=(e,t)=>{for(const n in e)t(e[n],n)},Vm=e=>a7(e).length,c7=e=>{for(const t in e)return!1;return!0},Ah=(e,t)=>{for(const n in e)if(!t(e[n],n))return!1;return!0},g0=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),u7=(e,t)=>e===t||Vm(e)===Vm(t)&&Ah(e,(n,r)=>(n!==void 0||g0(t,r))&&m3(t[r],n)),d7=Object.freeze,g3=e=>{for(const t in e){const n=e[t];(typeof n=="object"||typeof n=="function")&&g3(e[t])}return d7(e)},v0=(e,t,n=0)=>{try{for(;n<e.length;n++)e[n](...t)}finally{n<e.length&&v0(e,t,n+1)}},jm=(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[_h]!=null)return e[_h](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)||!jm(e.get(n),t.get(n)))return!1;break;case void 0:case Object:if(Vm(e)!==Vm(t))return!1;for(const n in e)if(!g0(e,n)||!jm(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(!jm(e[n],t[n]))return!1;break;default:return!1}return!0},f7=(e,t)=>t.includes(e),Ih=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]",ZZ=typeof navigator<"u"?/Mac/.test(navigator.platform):!1,ca,h7=[],p7=()=>{if(ca===void 0)if(Ih){ca=la();const e=process.argv;let t=null;for(let n=0;n<e.length;n++){const r=e[n];r[0]==="-"?(t!==null&&ca.set(t,""),t=r):t!==null?(ca.set(t,r),t=null):h7.push(r)}t!==null&&ca.set(t,"")}else typeof location=="object"?(ca=la(),(location.search||"?").slice(1).split("&").forEach(e=>{if(e.length!==0){const[t,n]=e.split("=");ca.set(`--${s3(t,"-")}`,n),ca.set(`-${s3(t,"-")}`,n)}})):ca=la();return ca},y0=e=>p7().has(e),Um=e=>h3(Ih?process.env[e.toUpperCase().replaceAll("-","_")]:o7.getItem(e)),v3=e=>y0("--"+e)||Um(e)!==null,m7=v3("production"),g7=Ih&&f7(process.env.FORCE_COLOR,["true","1","2"]),v7=g7||!y0("--no-colors")&&!v3("no-color")&&(!Ih||process.stdout.isTTY)&&(!Ih||y0("--color")||Um("COLORTERM")!==null||(Um("TERM")||"").includes("color")),y7=class{constructor(e,t){this.left=e,this.right=t}},nl=(e,t)=>new y7(e,t),y3=e=>e.next()>=.5,b0=(e,t,n)=>Ja(e.next()*(n+1-t)+t),b3=(e,t,n)=>Ja(e.next()*(n+1-t)+t),w0=(e,t,n)=>b3(e,t,n),b7=e=>i3(w0(e,97,122)),w7=(e,t=0,n=20)=>{const r=w0(e,t,n);let o="";for(let i=0;i<r;i++)o+=b7(e);return o},C0=(e,t)=>t[w0(e,0,t.length-1)],C7=Symbol("0schema"),k7=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(jR(" ",(this._rerrs.length-t)*2)+`${n.path!=null?`[${n.path}] `:""}${n.has} doesn't match ${n.expected}. ${n.message}`)}return e.join(`
|
|
4
|
+
\0`,Re+=i(me,2),Re+=D.magic,Re+=i(k,2),Re+=i(C,2),Re+=i(Oe.crc32,4),Re+=i(Oe.compressedSize,4),Re+=i(Oe.uncompressedSize,4),Re+=i(W.length,2),Re+=i(re.length,2),{fileRecord:f.LOCAL_FILE_HEADER+Re+W+re,dirRecord:f.CENTRAL_FILE_HEADER+i(ve,2)+Re+i(j.length,2)+"\0\0\0\0"+i(ce,4)+i(_,4)+W+re+j}}var a=n("../utils"),l=n("../stream/GenericWorker"),u=n("../utf8"),d=n("../crc32"),f=n("../signature");function p(g,v,y,_){l.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=v,this.zipPlatform=y,this.encodeFileName=_,this.streamFiles=g,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(p,l),p.prototype.push=function(g){var v=g.meta.percent||0,y=this.entriesCount,_=this._sources.length;this.accumulate?this.contentBuffer.push(g):(this.bytesWritten+=g.data.length,l.prototype.push.call(this,{data:g.data,meta:{currentFile:this.currentFile,percent:y?(v+100*(y-_-1))/y:100}}))},p.prototype.openedSource=function(g){this.currentSourceOffset=this.bytesWritten,this.currentFile=g.file.name;var v=this.streamFiles&&!g.file.dir;if(v){var y=s(g,v,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:y.fileRecord,meta:{percent:0}})}else this.accumulate=!0},p.prototype.closedSource=function(g){this.accumulate=!1;var v=this.streamFiles&&!g.file.dir,y=s(g,v,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(y.dirRecord),v)this.push({data:(function(_){return f.DATA_DESCRIPTOR+i(_.crc32,4)+i(_.compressedSize,4)+i(_.uncompressedSize,4)})(g),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 g=this.bytesWritten,v=0;v<this.dirRecords.length;v++)this.push({data:this.dirRecords[v],meta:{percent:100}});var y=this.bytesWritten-g,_=(function(w,E,k,C,x){var D=a.transformTo("string",x(C));return f.CENTRAL_DIRECTORY_END+"\0\0\0\0"+i(w,2)+i(w,2)+i(E,4)+i(k,4)+i(D.length,2)+D})(this.dirRecords.length,y,g,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(g){this._sources.push(g);var v=this;return g.on("data",function(y){v.processChunk(y)}),g.on("end",function(){v.closedSource(v.previous.streamInfo),v._sources.length?v.prepareNextSource():v.end()}),g.on("error",function(y){v.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(g){var v=this._sources;if(!l.prototype.error.call(this,g))return!1;for(var y=0;y<v.length;y++)try{v[y].error(g)}catch{}return!0},p.prototype.lock=function(){l.prototype.lock.call(this);for(var g=this._sources,v=0;v<g.length;v++)g[v].lock()},r.exports=p},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(n,r,o){"use strict";var i=n("../compressions"),s=n("./ZipFileWorker");o.generateWorker=function(a,l,u){var d=new s(l.streamFiles,u,l.platform,l.encodeFileName),f=0;try{a.forEach(function(p,g){f++;var v=(function(E,k){var C=E||k,x=i[C];if(!x)throw new Error(C+" is not a valid compression method !");return x})(g.options.compression,l.compression),y=g.options.compressionOptions||l.compressionOptions||{},_=g.dir,w=g.date;g._compressWorker(v,y).withStreamInfo("file",{name:p,dir:_,date:w,comment:g.comment||"",unixPermissions:g.unixPermissions,dosPermissions:g.dosPermissions}).pipe(d)}),d.entriesCount=f}catch(p){d.error(p)}return d}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(n,r,o){"use strict";function i(){if(!(this instanceof i))return new i;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var s=new i;for(var a in this)typeof this[a]!="function"&&(s[a]=this[a]);return s}}(i.prototype=n("./object")).loadAsync=n("./load"),i.support=n("./support"),i.defaults=n("./defaults"),i.version="3.10.1",i.loadAsync=function(s,a){return new i().loadAsync(s,a)},i.external=n("./external"),r.exports=i},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(n,r,o){"use strict";var i=n("./utils"),s=n("./external"),a=n("./utf8"),l=n("./zipEntries"),u=n("./stream/Crc32Probe"),d=n("./nodejsUtils");function f(p){return new s.Promise(function(g,v){var y=p.decompressed.getContentWorker().pipe(new u);y.on("error",function(_){v(_)}).on("end",function(){y.streamInfo.crc32!==p.decompressed.crc32?v(new Error("Corrupted zip : CRC32 mismatch")):g()}).resume()})}r.exports=function(p,g){var v=this;return g=i.extend(g||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:a.utf8decode}),d.isNode&&d.isStream(p)?s.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):i.prepareContent("the loaded zip file",p,!0,g.optimizedBinaryString,g.base64).then(function(y){var _=new l(g);return _.load(y),_}).then(function(y){var _=[s.Promise.resolve(y)],w=y.files;if(g.checkCRC32)for(var E=0;E<w.length;E++)_.push(f(w[E]));return s.Promise.all(_)}).then(function(y){for(var _=y.shift(),w=_.files,E=0;E<w.length;E++){var k=w[E],C=k.fileNameStr,x=i.resolve(k.fileNameStr);v.file(x,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:g.createFolders}),k.dir||(v.file(x).unsafeOriginalName=C)}return _.zipComment.length&&(v.comment=_.zipComment),v})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(n,r,o){"use strict";var i=n("../utils"),s=n("../stream/GenericWorker");function a(l,u){s.call(this,"Nodejs stream input adapter for "+l),this._upstreamEnded=!1,this._bindStream(u)}i.inherits(a,s),a.prototype._bindStream=function(l){var u=this;(this._stream=l).pause(),l.on("data",function(d){u.push({data:d,meta:{percent:0}})}).on("error",function(d){u.isPaused?this.generatedError=d:u.error(d)}).on("end",function(){u.isPaused?u._upstreamEnded=!0:u.end()})},a.prototype.pause=function(){return!!s.prototype.pause.call(this)&&(this._stream.pause(),!0)},a.prototype.resume=function(){return!!s.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},r.exports=a},{"../stream/GenericWorker":28,"../utils":32}],13:[function(n,r,o){"use strict";var i=n("readable-stream").Readable;function s(a,l,u){i.call(this,l),this._helper=a;var d=this;a.on("data",function(f,p){d.push(f)||d._helper.pause(),u&&u(p)}).on("error",function(f){d.emit("error",f)}).on("end",function(){d.push(null)})}n("../utils").inherits(s,i),s.prototype._read=function(){this._helper.resume()},r.exports=s},{"../utils":32,"readable-stream":16}],14:[function(n,r,o){"use strict";r.exports={isNode:typeof Buffer<"u",newBufferFrom:function(i,s){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(i,s);if(typeof i=="number")throw new Error('The "data" argument must not be a number');return new Buffer(i,s)},allocBuffer:function(i){if(Buffer.alloc)return Buffer.alloc(i);var s=new Buffer(i);return s.fill(0),s},isBuffer:function(i){return Buffer.isBuffer(i)},isStream:function(i){return i&&typeof i.on=="function"&&typeof i.pause=="function"&&typeof i.resume=="function"}}},{}],15:[function(n,r,o){"use strict";function i(C,x,D){var P,W=a.getTypeOf(x),N=a.extend(D||{},d);N.date=N.date||new Date,N.compression!==null&&(N.compression=N.compression.toUpperCase()),typeof N.unixPermissions=="string"&&(N.unixPermissions=parseInt(N.unixPermissions,8)),N.unixPermissions&&16384&N.unixPermissions&&(N.dir=!0),N.dosPermissions&&16&N.dosPermissions&&(N.dir=!0),N.dir&&(C=w(C)),N.createFolders&&(P=_(C))&&E.call(this,P,!0);var L=W==="string"&&N.binary===!1&&N.base64===!1;D&&D.binary!==void 0||(N.binary=!L),(x instanceof f&&x.uncompressedSize===0||N.dir||!x||x.length===0)&&(N.base64=!1,N.binary=!0,x="",N.compression="STORE",W="string");var j=null;j=x instanceof f||x instanceof l?x:v.isNode&&v.isStream(x)?new y(C,x):a.prepareContent(C,x,N.binary,N.optimizedBinaryString,N.base64);var M=new p(C,j,N);this.files[C]=M}var s=n("./utf8"),a=n("./utils"),l=n("./stream/GenericWorker"),u=n("./stream/StreamHelper"),d=n("./defaults"),f=n("./compressedObject"),p=n("./zipObject"),g=n("./generate"),v=n("./nodejsUtils"),y=n("./nodejs/NodejsStreamInputAdapter"),_=function(C){C.slice(-1)==="/"&&(C=C.substring(0,C.length-1));var x=C.lastIndexOf("/");return 0<x?C.substring(0,x):""},w=function(C){return C.slice(-1)!=="/"&&(C+="/"),C},E=function(C,x){return x=x!==void 0?x:d.createFolders,C=w(C),this.files[C]||i.call(this,C,null,{dir:!0,createFolders:x}),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 x,D,P;for(x in this.files)P=this.files[x],(D=x.slice(this.root.length,x.length))&&x.slice(0,this.root.length)===this.root&&C(D,P)},filter:function(C){var x=[];return this.forEach(function(D,P){C(D,P)&&x.push(P)}),x},file:function(C,x,D){if(arguments.length!==1)return C=this.root+C,i.call(this,C,x,D),this;if(k(C)){var P=C;return this.filter(function(N,L){return!L.dir&&P.test(N)})}var W=this.files[this.root+C];return W&&!W.dir?W:null},folder:function(C){if(!C)return this;if(k(C))return this.filter(function(W,N){return N.dir&&C.test(W)});var x=this.root+C,D=E.call(this,x),P=this.clone();return P.root=D.name,P},remove:function(C){C=this.root+C;var x=this.files[C];if(x||(C.slice(-1)!=="/"&&(C+="/"),x=this.files[C]),x&&!x.dir)delete this.files[C];else for(var D=this.filter(function(W,N){return N.name.slice(0,C.length)===C}),P=0;P<D.length;P++)delete this.files[D[P].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 x,D={};try{if((D=a.extend(C||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:s.utf8encode})).type=D.type.toLowerCase(),D.compression=D.compression.toUpperCase(),D.type==="binarystring"&&(D.type="string"),!D.type)throw new Error("No output type specified.");a.checkSupport(D.type),D.platform!=="darwin"&&D.platform!=="freebsd"&&D.platform!=="linux"&&D.platform!=="sunos"||(D.platform="UNIX"),D.platform==="win32"&&(D.platform="DOS");var P=D.comment||this.comment||"";x=g.generateWorker(this,D,P)}catch(W){(x=new l("error")).error(W)}return new u(x,D.type||"string",D.mimeType)},generateAsync:function(C,x){return this.generateInternalStream(C).accumulate(x)},generateNodeStream:function(C,x){return(C=C||{}).type||(C.type="nodebuffer"),this.generateInternalStream(C).toNodejsStream(x)}}},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(n,r,o){"use strict";r.exports=n("stream")},{stream:void 0}],17:[function(n,r,o){"use strict";var i=n("./DataReader");function s(a){i.call(this,a);for(var l=0;l<this.data.length;l++)a[l]=255&a[l]}n("../utils").inherits(s,i),s.prototype.byteAt=function(a){return this.data[this.zero+a]},s.prototype.lastIndexOfSignature=function(a){for(var l=a.charCodeAt(0),u=a.charCodeAt(1),d=a.charCodeAt(2),f=a.charCodeAt(3),p=this.length-4;0<=p;--p)if(this.data[p]===l&&this.data[p+1]===u&&this.data[p+2]===d&&this.data[p+3]===f)return p-this.zero;return-1},s.prototype.readAndCheckSignature=function(a){var l=a.charCodeAt(0),u=a.charCodeAt(1),d=a.charCodeAt(2),f=a.charCodeAt(3),p=this.readData(4);return l===p[0]&&u===p[1]&&d===p[2]&&f===p[3]},s.prototype.readData=function(a){if(this.checkOffset(a),a===0)return[];var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=s},{"../utils":32,"./DataReader":18}],18:[function(n,r,o){"use strict";var i=n("../utils");function s(a){this.data=a,this.length=a.length,this.index=0,this.zero=0}s.prototype={checkOffset:function(a){this.checkIndex(this.index+a)},checkIndex:function(a){if(this.length<this.zero+a||a<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+a+"). Corrupted zip ?")},setIndex:function(a){this.checkIndex(a),this.index=a},skip:function(a){this.setIndex(this.index+a)},byteAt:function(){},readInt:function(a){var l,u=0;for(this.checkOffset(a),l=this.index+a-1;l>=this.index;l--)u=(u<<8)+this.byteAt(l);return this.index+=a,u},readString:function(a){return i.transformTo("string",this.readData(a))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var a=this.readInt(4);return new Date(Date.UTC(1980+(a>>25&127),(a>>21&15)-1,a>>16&31,a>>11&31,a>>5&63,(31&a)<<1))}},r.exports=s},{"../utils":32}],19:[function(n,r,o){"use strict";var i=n("./Uint8ArrayReader");function s(a){i.call(this,a)}n("../utils").inherits(s,i),s.prototype.readData=function(a){this.checkOffset(a);var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=s},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(n,r,o){"use strict";var i=n("./DataReader");function s(a){i.call(this,a)}n("../utils").inherits(s,i),s.prototype.byteAt=function(a){return this.data.charCodeAt(this.zero+a)},s.prototype.lastIndexOfSignature=function(a){return this.data.lastIndexOf(a)-this.zero},s.prototype.readAndCheckSignature=function(a){return a===this.readData(4)},s.prototype.readData=function(a){this.checkOffset(a);var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=s},{"../utils":32,"./DataReader":18}],21:[function(n,r,o){"use strict";var i=n("./ArrayReader");function s(a){i.call(this,a)}n("../utils").inherits(s,i),s.prototype.readData=function(a){if(this.checkOffset(a),a===0)return new Uint8Array(0);var l=this.data.subarray(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=s},{"../utils":32,"./ArrayReader":17}],22:[function(n,r,o){"use strict";var i=n("../utils"),s=n("../support"),a=n("./ArrayReader"),l=n("./StringReader"),u=n("./NodeBufferReader"),d=n("./Uint8ArrayReader");r.exports=function(f){var p=i.getTypeOf(f);return i.checkSupport(p),p!=="string"||s.uint8array?p==="nodebuffer"?new u(f):s.uint8array?new d(i.transformTo("uint8array",f)):new a(i.transformTo("array",f)):new l(f)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(n,r,o){"use strict";o.LOCAL_FILE_HEADER="PK",o.CENTRAL_FILE_HEADER="PK",o.CENTRAL_DIRECTORY_END="PK",o.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",o.ZIP64_CENTRAL_DIRECTORY_END="PK",o.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(n,r,o){"use strict";var i=n("./GenericWorker"),s=n("../utils");function a(l){i.call(this,"ConvertWorker to "+l),this.destType=l}s.inherits(a,i),a.prototype.processChunk=function(l){this.push({data:s.transformTo(this.destType,l.data),meta:l.meta})},r.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(n,r,o){"use strict";var i=n("./GenericWorker"),s=n("../crc32");function a(){i.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}n("../utils").inherits(a,i),a.prototype.processChunk=function(l){this.streamInfo.crc32=s(l.data,this.streamInfo.crc32||0),this.push(l)},r.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(n,r,o){"use strict";var i=n("../utils"),s=n("./GenericWorker");function a(l){s.call(this,"DataLengthProbe for "+l),this.propName=l,this.withStreamInfo(l,0)}i.inherits(a,s),a.prototype.processChunk=function(l){if(l){var u=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=u+l.data.length}s.prototype.processChunk.call(this,l)},r.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(n,r,o){"use strict";var i=n("../utils"),s=n("./GenericWorker");function a(l){s.call(this,"DataWorker");var u=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,l.then(function(d){u.dataIsReady=!0,u.data=d,u.max=d&&d.length||0,u.type=i.getTypeOf(d),u.isPaused||u._tickAndRepeat()},function(d){u.error(d)})}i.inherits(a,s),a.prototype.cleanUp=function(){s.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!s.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,i.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(i.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var l=null,u=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":l=this.data.substring(this.index,u);break;case"uint8array":l=this.data.subarray(this.index,u);break;case"array":case"nodebuffer":l=this.data.slice(this.index,u)}return this.index=u,this.push({data:l,meta:{percent:this.max?this.index/this.max*100:0}})},r.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(n,r,o){"use strict";function i(s){this.name=s||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}i.prototype={push:function(s){this.emit("data",s)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(s){this.emit("error",s)}return!0},error:function(s){return!this.isFinished&&(this.isPaused?this.generatedError=s:(this.isFinished=!0,this.emit("error",s),this.previous&&this.previous.error(s),this.cleanUp()),!0)},on:function(s,a){return this._listeners[s].push(a),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(s,a){if(this._listeners[s])for(var l=0;l<this._listeners[s].length;l++)this._listeners[s][l].call(this,a)},pipe:function(s){return s.registerPrevious(this)},registerPrevious:function(s){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=s.streamInfo,this.mergeStreamInfo(),this.previous=s;var a=this;return s.on("data",function(l){a.processChunk(l)}),s.on("end",function(){a.end()}),s.on("error",function(l){a.error(l)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var s=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),s=!0),this.previous&&this.previous.resume(),!s},flush:function(){},processChunk:function(s){this.push(s)},withStreamInfo:function(s,a){return this.extraStreamInfo[s]=a,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var s in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,s)&&(this.streamInfo[s]=this.extraStreamInfo[s])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var s="Worker "+this.name;return this.previous?this.previous+" -> "+s:s}},r.exports=i},{}],29:[function(n,r,o){"use strict";var i=n("../utils"),s=n("./ConvertWorker"),a=n("./GenericWorker"),l=n("../base64"),u=n("../support"),d=n("../external"),f=null;if(u.nodestream)try{f=n("../nodejs/NodejsStreamOutputAdapter")}catch{}function p(v,y){return new d.Promise(function(_,w){var E=[],k=v._internalType,C=v._outputType,x=v._mimeType;v.on("data",function(D,P){E.push(D),y&&y(P)}).on("error",function(D){E=[],w(D)}).on("end",function(){try{_((function(D,P,W){switch(D){case"blob":return i.newBlob(i.transformTo("arraybuffer",P),W);case"base64":return l.encode(P);default:return i.transformTo(D,P)}})(C,(function(D,P){var W,N=0,L=null,j=0;for(W=0;W<P.length;W++)j+=P[W].length;switch(D){case"string":return P.join("");case"array":return Array.prototype.concat.apply([],P);case"uint8array":for(L=new Uint8Array(j),W=0;W<P.length;W++)L.set(P[W],N),N+=P[W].length;return L;case"nodebuffer":return Buffer.concat(P);default:throw new Error("concat : unsupported type '"+D+"'")}})(k,E),x))}catch(D){w(D)}E=[]}).resume()})}function g(v,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=v.pipe(new s(w)),v.lock()}catch(E){this._worker=new a("error"),this._worker.error(E)}}g.prototype={accumulate:function(v){return p(this,v)},on:function(v,y){var _=this;return v==="data"?this._worker.on(v,function(w){y.call(_,w.data,w.meta)}):this._worker.on(v,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(v){if(i.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new f(this,{objectMode:this._outputType!=="nodebuffer"},v)}},r.exports=g},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(n,r,o){"use strict";if(o.base64=!0,o.array=!0,o.string=!0,o.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",o.nodebuffer=typeof Buffer<"u",o.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")o.blob=!1;else{var i=new ArrayBuffer(0);try{o.blob=new Blob([i],{type:"application/zip"}).size===0}catch{try{var s=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);s.append(i),o.blob=s.getBlob("application/zip").size===0}catch{o.blob=!1}}}try{o.nodestream=!!n("readable-stream").Readable}catch{o.nodestream=!1}},{"readable-stream":16}],31:[function(n,r,o){"use strict";for(var i=n("./utils"),s=n("./support"),a=n("./nodejsUtils"),l=n("./stream/GenericWorker"),u=new Array(256),d=0;d<256;d++)u[d]=252<=d?6:248<=d?5:240<=d?4:224<=d?3:192<=d?2:1;u[254]=u[254]=1;function f(){l.call(this,"utf-8 decode"),this.leftOver=null}function p(){l.call(this,"utf-8 encode")}o.utf8encode=function(g){return s.nodebuffer?a.newBufferFrom(g,"utf-8"):(function(v){var y,_,w,E,k,C=v.length,x=0;for(E=0;E<C;E++)(64512&(_=v.charCodeAt(E)))==55296&&E+1<C&&(64512&(w=v.charCodeAt(E+1)))==56320&&(_=65536+(_-55296<<10)+(w-56320),E++),x+=_<128?1:_<2048?2:_<65536?3:4;for(y=s.uint8array?new Uint8Array(x):new Array(x),E=k=0;k<x;E++)(64512&(_=v.charCodeAt(E)))==55296&&E+1<C&&(64512&(w=v.charCodeAt(E+1)))==56320&&(_=65536+(_-55296<<10)+(w-56320),E++),_<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})(g)},o.utf8decode=function(g){return s.nodebuffer?i.transformTo("nodebuffer",g).toString("utf-8"):(function(v){var y,_,w,E,k=v.length,C=new Array(2*k);for(y=_=0;y<k;)if((w=v[y++])<128)C[_++]=w;else if(4<(E=u[w]))C[_++]=65533,y+=E-1;else{for(w&=E===2?31:E===3?15:7;1<E&&y<k;)w=w<<6|63&v[y++],E--;1<E?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)})(g=i.transformTo(s.uint8array?"uint8array":"array",g))},i.inherits(f,l),f.prototype.processChunk=function(g){var v=i.transformTo(s.uint8array?"uint8array":"array",g.data);if(this.leftOver&&this.leftOver.length){if(s.uint8array){var y=v;(v=new Uint8Array(y.length+this.leftOver.length)).set(this.leftOver,0),v.set(y,this.leftOver.length)}else v=this.leftOver.concat(v);this.leftOver=null}var _=(function(E,k){var C;for((k=k||E.length)>E.length&&(k=E.length),C=k-1;0<=C&&(192&E[C])==128;)C--;return C<0||C===0?k:C+u[E[C]]>k?C:k})(v),w=v;_!==v.length&&(s.uint8array?(w=v.subarray(0,_),this.leftOver=v.subarray(_,v.length)):(w=v.slice(0,_),this.leftOver=v.slice(_,v.length))),this.push({data:o.utf8decode(w),meta:g.meta})},f.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:o.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},o.Utf8DecodeWorker=f,i.inherits(p,l),p.prototype.processChunk=function(g){this.push({data:o.utf8encode(g.data),meta:g.meta})},o.Utf8EncodeWorker=p},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(n,r,o){"use strict";var i=n("./support"),s=n("./base64"),a=n("./nodejsUtils"),l=n("./external");function u(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 f={stringifyByChunk:function(y,_,w){var E=[],k=0,C=y.length;if(C<=w)return String.fromCharCode.apply(null,y);for(;k<C;)_==="array"||_==="nodebuffer"?E.push(String.fromCharCode.apply(null,y.slice(k,Math.min(k+w,C)))):E.push(String.fromCharCode.apply(null,y.subarray(k,Math.min(k+w,C)))),k+=w;return E.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),E=!0;if(w==="uint8array"?E=f.applyCanBeUsed.uint8array:w==="nodebuffer"&&(E=f.applyCanBeUsed.nodebuffer),E)for(;1<_;)try{return f.stringifyByChunk(y,w,_)}catch{_=Math.floor(_/2)}return f.stringifyByChar(y)}function g(y,_){for(var w=0;w<y.length;w++)_[w]=y[w];return _}o.applyFromCharCode=p;var v={};v.string={string:u,array:function(y){return d(y,new Array(y.length))},arraybuffer:function(y){return v.string.uint8array(y).buffer},uint8array:function(y){return d(y,new Uint8Array(y.length))},nodebuffer:function(y){return d(y,a.allocBuffer(y.length))}},v.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)}},v.arraybuffer={string:function(y){return p(new Uint8Array(y))},array:function(y){return g(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))}},v.uint8array={string:p,array:function(y){return g(y,new Array(y.length))},arraybuffer:function(y){return y.buffer},uint8array:u,nodebuffer:function(y){return a.newBufferFrom(y)}},v.nodebuffer={string:p,array:function(y){return g(y,new Array(y.length))},arraybuffer:function(y){return v.nodebuffer.uint8array(y).buffer},uint8array:function(y){return g(y,new Uint8Array(y.length))},nodebuffer:u},o.transformTo=function(y,_){return _=_||"",y?(o.checkSupport(y),v[o.getTypeOf(_)][y](_)):_},o.resolve=function(y){for(var _=y.split("/"),w=[],E=0;E<_.length;E++){var k=_[E];k==="."||k===""&&E!==0&&E!==_.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,E="";for(w=0;w<(y||"").length;w++)E+="\\x"+((_=y.charCodeAt(w))<16?"0":"")+_.toString(16).toUpperCase();return E},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,E,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(x,D){var P=new FileReader;P.onload=function(W){x(W.target.result)},P.onerror=function(W){D(W.target.error)},P.readAsArrayBuffer(C)}):C}).then(function(C){var x=o.getTypeOf(C);return x?(x==="arraybuffer"?C=o.transformTo("uint8array",C):x==="string"&&(k?C=s.decode(C):w&&E!==!0&&(C=(function(D){return d(D,i.uint8array?new Uint8Array(D.length):new Array(D.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(f){this.files=[],this.loadOptions=f}d.prototype={checkSignature:function(f){if(!this.reader.readAndCheckSignature(f)){this.reader.index-=4;var p=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+s.pretty(p)+", expected "+s.pretty(f)+")")}},isSignature:function(f,p){var g=this.reader.index;this.reader.setIndex(f);var v=this.reader.readString(4)===p;return this.reader.setIndex(g),v},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var f=this.reader.readData(this.zipCommentLength),p=u.uint8array?"uint8array":"array",g=s.transformTo(p,f);this.zipComment=this.loadOptions.decodeFileName(g)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var f,p,g,v=this.zip64EndOfCentralSize-44;0<v;)f=this.reader.readInt(2),p=this.reader.readInt(4),g=this.reader.readData(p),this.zip64ExtensibleData[f]={id:f,length:p,value:g}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var f,p;for(f=0;f<this.files.length;f++)p=this.files[f],this.reader.setIndex(p.localHeaderOffset),this.checkSignature(a.LOCAL_FILE_HEADER),p.readLocalPart(this.reader),p.handleUTF8(),p.processAttributes()},readCentralDir:function(){var f;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(a.CENTRAL_FILE_HEADER);)(f=new l({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(f);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var f=this.reader.lastIndexOfSignature(a.CENTRAL_DIRECTORY_END);if(f<0)throw this.isSignature(0,a.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(f);var p=f;if(this.checkSignature(a.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===s.MAX_VALUE_16BITS||this.diskWithCentralDirStart===s.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===s.MAX_VALUE_16BITS||this.centralDirRecords===s.MAX_VALUE_16BITS||this.centralDirSize===s.MAX_VALUE_32BITS||this.centralDirOffset===s.MAX_VALUE_32BITS){if(this.zip64=!0,(f=this.reader.lastIndexOfSignature(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(f),this.checkSignature(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,a.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(a.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(a.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var g=this.centralDirOffset+this.centralDirSize;this.zip64&&(g+=20,g+=12+this.zip64EndOfCentralSize);var v=p-g;if(0<v)this.isSignature(p,a.CENTRAL_FILE_HEADER)||(this.reader.zero=v);else if(v<0)throw new Error("Corrupted zip: missing "+Math.abs(v)+" bytes.")},prepareReader:function(f){this.reader=i(f)},load:function(f){this.prepareReader(f),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},r.exports=d},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(n,r,o){"use strict";var i=n("./reader/readerFor"),s=n("./utils"),a=n("./compressedObject"),l=n("./crc32"),u=n("./utf8"),d=n("./compressions"),f=n("./support");function p(g,v){this.options=g,this.loadOptions=v}p.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(g){var v,y;if(g.skip(22),this.fileNameLength=g.readInt(2),y=g.readInt(2),this.fileName=g.readData(this.fileNameLength),g.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((v=(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,v,g.readData(this.compressedSize))},readCentralPart:function(g){this.versionMadeBy=g.readInt(2),g.skip(2),this.bitFlag=g.readInt(2),this.compressionMethod=g.readString(2),this.date=g.readDate(),this.crc32=g.readInt(4),this.compressedSize=g.readInt(4),this.uncompressedSize=g.readInt(4);var v=g.readInt(2);if(this.extraFieldsLength=g.readInt(2),this.fileCommentLength=g.readInt(2),this.diskNumberStart=g.readInt(2),this.internalFileAttributes=g.readInt(2),this.externalFileAttributes=g.readInt(4),this.localHeaderOffset=g.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");g.skip(v),this.readExtraFields(g),this.parseZIP64ExtraField(g),this.fileComment=g.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var g=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),g==0&&(this.dosPermissions=63&this.externalFileAttributes),g==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var g=i(this.extraFields[1].value);this.uncompressedSize===s.MAX_VALUE_32BITS&&(this.uncompressedSize=g.readInt(8)),this.compressedSize===s.MAX_VALUE_32BITS&&(this.compressedSize=g.readInt(8)),this.localHeaderOffset===s.MAX_VALUE_32BITS&&(this.localHeaderOffset=g.readInt(8)),this.diskNumberStart===s.MAX_VALUE_32BITS&&(this.diskNumberStart=g.readInt(4))}},readExtraFields:function(g){var v,y,_,w=g.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});g.index+4<w;)v=g.readInt(2),y=g.readInt(2),_=g.readData(y),this.extraFields[v]={id:v,length:y,value:_};g.setIndex(w)},handleUTF8:function(){var g=f.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=u.utf8decode(this.fileName),this.fileCommentStr=u.utf8decode(this.fileComment);else{var v=this.findExtraFieldUnicodePath();if(v!==null)this.fileNameStr=v;else{var y=s.transformTo(g,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(y)}var _=this.findExtraFieldUnicodeComment();if(_!==null)this.fileCommentStr=_;else{var w=s.transformTo(g,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(w)}}},findExtraFieldUnicodePath:function(){var g=this.extraFields[28789];if(g){var v=i(g.value);return v.readInt(1)!==1||l(this.fileName)!==v.readInt(4)?null:u.utf8decode(v.readData(g.length-5))}return null},findExtraFieldUnicodeComment:function(){var g=this.extraFields[25461];if(g){var v=i(g.value);return v.readInt(1)!==1||l(this.fileComment)!==v.readInt(4)?null:u.utf8decode(v.readData(g.length-5))}return null}},r.exports=p},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(n,r,o){"use strict";function i(v,y,_){this.name=v,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(v){var y=null,_="string";try{if(!v)throw new Error("No output type specified.");var w=(_=v.toLowerCase())==="string"||_==="text";_!=="binarystring"&&_!=="text"||(_="string"),y=this._decompressWorker();var E=!this._dataBinary;E&&!w&&(y=y.pipe(new l.Utf8EncodeWorker)),!E&&w&&(y=y.pipe(new l.Utf8DecodeWorker))}catch(k){(y=new d("error")).error(k)}return new s(y,_,"")},async:function(v,y){return this.internalStream(v).accumulate(y)},nodeStream:function(v,y){return this.internalStream(v||"nodebuffer").toNodejsStream(y)},_compressWorker:function(v,y){if(this._data instanceof u&&this._data.compression.magic===v.magic)return this._data.getCompressedWorker();var _=this._decompressWorker();return this._dataBinary||(_=_.pipe(new l.Utf8EncodeWorker)),u.createWorkerFrom(_,v,y)},_decompressWorker:function(){return this._data instanceof u?this._data.getContentWorker():this._data instanceof d?this._data:new a(this._data)}};for(var f=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],p=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},g=0;g<f.length;g++)i.prototype[f[g]]=p;r.exports=i},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(n,r,o){(function(i){"use strict";var s,a,l=i.MutationObserver||i.WebKitMutationObserver;if(l){var u=0,d=new l(v),f=i.document.createTextNode("");d.observe(f,{characterData:!0}),s=function(){f.data=u=++u%2}}else if(i.setImmediate||i.MessageChannel===void 0)s="document"in i&&"onreadystatechange"in i.document.createElement("script")?function(){var y=i.document.createElement("script");y.onreadystatechange=function(){v(),y.onreadystatechange=null,y.parentNode.removeChild(y),y=null},i.document.documentElement.appendChild(y)}:function(){setTimeout(v,0)};else{var p=new i.MessageChannel;p.port1.onmessage=v,s=function(){p.port2.postMessage(0)}}var g=[];function v(){var y,_;a=!0;for(var w=g.length;w;){for(_=g,g=[],y=-1;++y<w;)_[y]();w=g.length}a=!1}r.exports=function(y){g.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 f(w){if(typeof w!="function")throw new TypeError("resolver must be a function");this.state=d,this.queue=[],this.outcome=void 0,w!==s&&y(this,w)}function p(w,E,k){this.promise=w,typeof E=="function"&&(this.onFulfilled=E,this.callFulfilled=this.otherCallFulfilled),typeof k=="function"&&(this.onRejected=k,this.callRejected=this.otherCallRejected)}function g(w,E,k){i(function(){var C;try{C=E(k)}catch(x){return a.reject(w,x)}C===w?a.reject(w,new TypeError("Cannot resolve promise with itself")):a.resolve(w,C)})}function v(w){var E=w&&w.then;if(w&&(typeof w=="object"||typeof w=="function")&&typeof E=="function")return function(){E.apply(w,arguments)}}function y(w,E){var k=!1;function C(P){k||(k=!0,a.reject(w,P))}function x(P){k||(k=!0,a.resolve(w,P))}var D=_(function(){E(x,C)});D.status==="error"&&C(D.value)}function _(w,E){var k={};try{k.value=w(E),k.status="success"}catch(C){k.status="error",k.value=C}return k}(r.exports=f).prototype.finally=function(w){if(typeof w!="function")return this;var E=this.constructor;return this.then(function(k){return E.resolve(w()).then(function(){return k})},function(k){return E.resolve(w()).then(function(){throw k})})},f.prototype.catch=function(w){return this.then(null,w)},f.prototype.then=function(w,E){if(typeof w!="function"&&this.state===u||typeof E!="function"&&this.state===l)return this;var k=new this.constructor(s);return this.state!==d?g(k,this.state===u?w:E,this.outcome):this.queue.push(new p(k,w,E)),k},p.prototype.callFulfilled=function(w){a.resolve(this.promise,w)},p.prototype.otherCallFulfilled=function(w){g(this.promise,this.onFulfilled,w)},p.prototype.callRejected=function(w){a.reject(this.promise,w)},p.prototype.otherCallRejected=function(w){g(this.promise,this.onRejected,w)},a.resolve=function(w,E){var k=_(v,E);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=E;for(var x=-1,D=w.queue.length;++x<D;)w.queue[x].callFulfilled(E)}return w},a.reject=function(w,E){w.state=l,w.outcome=E;for(var k=-1,C=w.queue.length;++k<C;)w.queue[k].callRejected(E);return w},f.resolve=function(w){return w instanceof this?w:a.resolve(new this(s),w)},f.reject=function(w){var E=new this(s);return a.reject(E,w)},f.all=function(w){var E=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 x=new Array(k),D=0,P=-1,W=new this(s);++P<k;)N(w[P],P);return W;function N(L,j){E.resolve(L).then(function(M){x[j]=M,++D!==k||C||(C=!0,a.resolve(W,x))},function(M){C||(C=!0,a.reject(W,M))})}},f.race=function(w){var E=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 x=-1,D=new this(s);++x<k;)P=w[x],E.resolve(P).then(function(W){C||(C=!0,a.resolve(D,W))},function(W){C||(C=!0,a.reject(D,W))});var P;return D}},{immediate:36}],38:[function(n,r,o){"use strict";var i={};(0,n("./lib/utils/common").assign)(i,n("./lib/deflate"),n("./lib/inflate"),n("./lib/zlib/constants")),r.exports=i},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(n,r,o){"use strict";var i=n("./zlib/deflate"),s=n("./utils/common"),a=n("./utils/strings"),l=n("./zlib/messages"),u=n("./zlib/zstream"),d=Object.prototype.toString,f=0,p=-1,g=0,v=8;function y(w){if(!(this instanceof y))return new y(w);this.options=s.assign({level:p,method:v,chunkSize:16384,windowBits:15,memLevel:8,strategy:g,to:""},w||{});var E=this.options;E.raw&&0<E.windowBits?E.windowBits=-E.windowBits:E.gzip&&0<E.windowBits&&E.windowBits<16&&(E.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,E.level,E.method,E.windowBits,E.memLevel,E.strategy);if(k!==f)throw new Error(l[k]);if(E.header&&i.deflateSetHeader(this.strm,E.header),E.dictionary){var C;if(C=typeof E.dictionary=="string"?a.string2buf(E.dictionary):d.call(E.dictionary)==="[object ArrayBuffer]"?new Uint8Array(E.dictionary):E.dictionary,(k=i.deflateSetDictionary(this.strm,C))!==f)throw new Error(l[k]);this._dict_set=!0}}function _(w,E){var k=new y(E);if(k.push(w,!0),k.err)throw k.msg||l[k.err];return k.result}y.prototype.push=function(w,E){var k,C,x=this.strm,D=this.options.chunkSize;if(this.ended)return!1;C=E===~~E?E:E===!0?4:0,typeof w=="string"?x.input=a.string2buf(w):d.call(w)==="[object ArrayBuffer]"?x.input=new Uint8Array(w):x.input=w,x.next_in=0,x.avail_in=x.input.length;do{if(x.avail_out===0&&(x.output=new s.Buf8(D),x.next_out=0,x.avail_out=D),(k=i.deflate(x,C))!==1&&k!==f)return this.onEnd(k),!(this.ended=!0);x.avail_out!==0&&(x.avail_in!==0||C!==4&&C!==2)||(this.options.to==="string"?this.onData(a.buf2binstring(s.shrinkBuf(x.output,x.next_out))):this.onData(s.shrinkBuf(x.output,x.next_out)))}while((0<x.avail_in||x.avail_out===0)&&k!==1);return C===4?(k=i.deflateEnd(this.strm),this.onEnd(k),this.ended=!0,k===f):C!==2||(this.onEnd(f),!(x.avail_out=0))},y.prototype.onData=function(w){this.chunks.push(w)},y.prototype.onEnd=function(w){w===f&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=s.flattenChunks(this.chunks)),this.chunks=[],this.err=w,this.msg=this.strm.msg},o.Deflate=y,o.deflate=_,o.deflateRaw=function(w,E){return(E=E||{}).raw=!0,_(w,E)},o.gzip=function(w,E){return(E=E||{}).gzip=!0,_(w,E)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(n,r,o){"use strict";var i=n("./zlib/inflate"),s=n("./utils/common"),a=n("./utils/strings"),l=n("./zlib/constants"),u=n("./zlib/messages"),d=n("./zlib/zstream"),f=n("./zlib/gzheader"),p=Object.prototype.toString;function g(y){if(!(this instanceof g))return new g(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 f,i.inflateGetHeader(this.strm,this.header)}function v(y,_){var w=new g(_);if(w.push(y,!0),w.err)throw w.msg||u[w.err];return w.result}g.prototype.push=function(y,_){var w,E,k,C,x,D,P=this.strm,W=this.options.chunkSize,N=this.options.dictionary,L=!1;if(this.ended)return!1;E=_===~~_?_:_===!0?l.Z_FINISH:l.Z_NO_FLUSH,typeof y=="string"?P.input=a.binstring2buf(y):p.call(y)==="[object ArrayBuffer]"?P.input=new Uint8Array(y):P.input=y,P.next_in=0,P.avail_in=P.input.length;do{if(P.avail_out===0&&(P.output=new s.Buf8(W),P.next_out=0,P.avail_out=W),(w=i.inflate(P,l.Z_NO_FLUSH))===l.Z_NEED_DICT&&N&&(D=typeof N=="string"?a.string2buf(N):p.call(N)==="[object ArrayBuffer]"?new Uint8Array(N):N,w=i.inflateSetDictionary(this.strm,D)),w===l.Z_BUF_ERROR&&L===!0&&(w=l.Z_OK,L=!1),w!==l.Z_STREAM_END&&w!==l.Z_OK)return this.onEnd(w),!(this.ended=!0);P.next_out&&(P.avail_out!==0&&w!==l.Z_STREAM_END&&(P.avail_in!==0||E!==l.Z_FINISH&&E!==l.Z_SYNC_FLUSH)||(this.options.to==="string"?(k=a.utf8border(P.output,P.next_out),C=P.next_out-k,x=a.buf2string(P.output,k),P.next_out=C,P.avail_out=W-C,C&&s.arraySet(P.output,P.output,k,C,0),this.onData(x)):this.onData(s.shrinkBuf(P.output,P.next_out)))),P.avail_in===0&&P.avail_out===0&&(L=!0)}while((0<P.avail_in||P.avail_out===0)&&w!==l.Z_STREAM_END);return w===l.Z_STREAM_END&&(E=l.Z_FINISH),E===l.Z_FINISH?(w=i.inflateEnd(this.strm),this.onEnd(w),this.ended=!0,w===l.Z_OK):E!==l.Z_SYNC_FLUSH||(this.onEnd(l.Z_OK),!(P.avail_out=0))},g.prototype.onData=function(y){this.chunks.push(y)},g.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=g,o.inflate=v,o.inflateRaw=function(y,_){return(_=_||{}).raw=!0,v(y,_)},o.ungzip=v},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(n,r,o){"use strict";var i=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";o.assign=function(l){for(var u=Array.prototype.slice.call(arguments,1);u.length;){var d=u.shift();if(d){if(typeof d!="object")throw new TypeError(d+"must be non-object");for(var f in d)d.hasOwnProperty(f)&&(l[f]=d[f])}}return l},o.shrinkBuf=function(l,u){return l.length===u?l:l.subarray?l.subarray(0,u):(l.length=u,l)};var s={arraySet:function(l,u,d,f,p){if(u.subarray&&l.subarray)l.set(u.subarray(d,d+f),p);else for(var g=0;g<f;g++)l[p+g]=u[d+g]},flattenChunks:function(l){var u,d,f,p,g,v;for(u=f=0,d=l.length;u<d;u++)f+=l[u].length;for(v=new Uint8Array(f),u=p=0,d=l.length;u<d;u++)g=l[u],v.set(g,p),p+=g.length;return v}},a={arraySet:function(l,u,d,f,p){for(var g=0;g<f;g++)l[p+g]=u[d+g]},flattenChunks:function(l){return[].concat.apply([],l)}};o.setTyped=function(l){l?(o.Buf8=Uint8Array,o.Buf16=Uint16Array,o.Buf32=Int32Array,o.assign(o,s)):(o.Buf8=Array,o.Buf16=Array,o.Buf32=Array,o.assign(o,a))},o.setTyped(i)},{}],42:[function(n,r,o){"use strict";var i=n("./common"),s=!0,a=!0;try{String.fromCharCode.apply(null,[0])}catch{s=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{a=!1}for(var l=new i.Buf8(256),u=0;u<256;u++)l[u]=252<=u?6:248<=u?5:240<=u?4:224<=u?3:192<=u?2:1;function d(f,p){if(p<65537&&(f.subarray&&a||!f.subarray&&s))return String.fromCharCode.apply(null,i.shrinkBuf(f,p));for(var g="",v=0;v<p;v++)g+=String.fromCharCode(f[v]);return g}l[254]=l[254]=1,o.string2buf=function(f){var p,g,v,y,_,w=f.length,E=0;for(y=0;y<w;y++)(64512&(g=f.charCodeAt(y)))==55296&&y+1<w&&(64512&(v=f.charCodeAt(y+1)))==56320&&(g=65536+(g-55296<<10)+(v-56320),y++),E+=g<128?1:g<2048?2:g<65536?3:4;for(p=new i.Buf8(E),y=_=0;_<E;y++)(64512&(g=f.charCodeAt(y)))==55296&&y+1<w&&(64512&(v=f.charCodeAt(y+1)))==56320&&(g=65536+(g-55296<<10)+(v-56320),y++),g<128?p[_++]=g:(g<2048?p[_++]=192|g>>>6:(g<65536?p[_++]=224|g>>>12:(p[_++]=240|g>>>18,p[_++]=128|g>>>12&63),p[_++]=128|g>>>6&63),p[_++]=128|63&g);return p},o.buf2binstring=function(f){return d(f,f.length)},o.binstring2buf=function(f){for(var p=new i.Buf8(f.length),g=0,v=p.length;g<v;g++)p[g]=f.charCodeAt(g);return p},o.buf2string=function(f,p){var g,v,y,_,w=p||f.length,E=new Array(2*w);for(g=v=0;g<w;)if((y=f[g++])<128)E[v++]=y;else if(4<(_=l[y]))E[v++]=65533,g+=_-1;else{for(y&=_===2?31:_===3?15:7;1<_&&g<w;)y=y<<6|63&f[g++],_--;1<_?E[v++]=65533:y<65536?E[v++]=y:(y-=65536,E[v++]=55296|y>>10&1023,E[v++]=56320|1023&y)}return d(E,v)},o.utf8border=function(f,p){var g;for((p=p||f.length)>f.length&&(p=f.length),g=p-1;0<=g&&(192&f[g])==128;)g--;return g<0||g===0?p:g+l[f[g]]>p?g:p}},{"./common":41}],43:[function(n,r,o){"use strict";r.exports=function(i,s,a,l){for(var u=65535&i|0,d=i>>>16&65535|0,f=0;a!==0;){for(a-=f=2e3<a?2e3:a;d=d+(u=u+s[l++]|0)|0,--f;);u%=65521,d%=65521}return u|d<<16|0}},{}],44:[function(n,r,o){"use strict";r.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(n,r,o){"use strict";var i=(function(){for(var s,a=[],l=0;l<256;l++){s=l;for(var u=0;u<8;u++)s=1&s?3988292384^s>>>1:s>>>1;a[l]=s}return a})();r.exports=function(s,a,l,u){var d=i,f=u+l;s^=-1;for(var p=u;p<f;p++)s=s>>>8^d[255&(s^a[p])];return-1^s}},{}],46:[function(n,r,o){"use strict";var i,s=n("../utils/common"),a=n("./trees"),l=n("./adler32"),u=n("./crc32"),d=n("./messages"),f=0,p=4,g=0,v=-2,y=-1,_=4,w=2,E=8,k=9,C=286,x=30,D=19,P=2*C+1,W=15,N=3,L=258,j=L+N+1,M=42,B=113,R=1,re=2,te=3,Y=4;function X(A,ne){return A.msg=d[ne],ne}function U(A){return(A<<1)-(4<A?9:0)}function Oe(A){for(var ne=A.length;0<=--ne;)A[ne]=0}function me(A){var ne=A.state,V=ne.pending;V>A.avail_out&&(V=A.avail_out),V!==0&&(s.arraySet(A.output,ne.pending_buf,ne.pending_out,V,A.next_out),A.next_out+=V,ne.pending_out+=V,A.total_out+=V,A.avail_out-=V,ne.pending-=V,ne.pending===0&&(ne.pending_out=0))}function ce(A,ne){a._tr_flush_block(A,0<=A.block_start?A.block_start:-1,A.strstart-A.block_start,ne),A.block_start=A.strstart,me(A.strm)}function ve(A,ne){A.pending_buf[A.pending++]=ne}function Re(A,ne){A.pending_buf[A.pending++]=ne>>>8&255,A.pending_buf[A.pending++]=255&ne}function $e(A,ne){var V,Q,K=A.max_chain_length,ee=A.strstart,le=A.prev_length,be=A.nice_match,G=A.strstart>A.w_size-j?A.strstart-(A.w_size-j):0,pe=A.window,Ee=A.w_mask,Se=A.prev,Ge=A.strstart+L,ht=pe[ee+le-1],Me=pe[ee+le];A.prev_length>=A.good_match&&(K>>=2),be>A.lookahead&&(be=A.lookahead);do if(pe[(V=ne)+le]===Me&&pe[V+le-1]===ht&&pe[V]===pe[ee]&&pe[++V]===pe[ee+1]){ee+=2,V++;do;while(pe[++ee]===pe[++V]&&pe[++ee]===pe[++V]&&pe[++ee]===pe[++V]&&pe[++ee]===pe[++V]&&pe[++ee]===pe[++V]&&pe[++ee]===pe[++V]&&pe[++ee]===pe[++V]&&pe[++ee]===pe[++V]&&ee<Ge);if(Q=L-(Ge-ee),ee=Ge-L,le<Q){if(A.match_start=ne,be<=(le=Q))break;ht=pe[ee+le-1],Me=pe[ee+le]}}while((ne=Se[ne&Ee])>G&&--K!=0);return le<=A.lookahead?le:A.lookahead}function ot(A){var ne,V,Q,K,ee,le,be,G,pe,Ee,Se=A.w_size;do{if(K=A.window_size-A.lookahead-A.strstart,A.strstart>=Se+(Se-j)){for(s.arraySet(A.window,A.window,Se,Se,0),A.match_start-=Se,A.strstart-=Se,A.block_start-=Se,ne=V=A.hash_size;Q=A.head[--ne],A.head[ne]=Se<=Q?Q-Se:0,--V;);for(ne=V=Se;Q=A.prev[--ne],A.prev[ne]=Se<=Q?Q-Se:0,--V;);K+=Se}if(A.strm.avail_in===0)break;if(le=A.strm,be=A.window,G=A.strstart+A.lookahead,pe=K,Ee=void 0,Ee=le.avail_in,pe<Ee&&(Ee=pe),V=Ee===0?0:(le.avail_in-=Ee,s.arraySet(be,le.input,le.next_in,Ee,G),le.state.wrap===1?le.adler=l(le.adler,be,Ee,G):le.state.wrap===2&&(le.adler=u(le.adler,be,Ee,G)),le.next_in+=Ee,le.total_in+=Ee,Ee),A.lookahead+=V,A.lookahead+A.insert>=N)for(ee=A.strstart-A.insert,A.ins_h=A.window[ee],A.ins_h=(A.ins_h<<A.hash_shift^A.window[ee+1])&A.hash_mask;A.insert&&(A.ins_h=(A.ins_h<<A.hash_shift^A.window[ee+N-1])&A.hash_mask,A.prev[ee&A.w_mask]=A.head[A.ins_h],A.head[A.ins_h]=ee,ee++,A.insert--,!(A.lookahead+A.insert<N)););}while(A.lookahead<j&&A.strm.avail_in!==0)}function kt(A,ne){for(var V,Q;;){if(A.lookahead<j){if(ot(A),A.lookahead<j&&ne===f)return R;if(A.lookahead===0)break}if(V=0,A.lookahead>=N&&(A.ins_h=(A.ins_h<<A.hash_shift^A.window[A.strstart+N-1])&A.hash_mask,V=A.prev[A.strstart&A.w_mask]=A.head[A.ins_h],A.head[A.ins_h]=A.strstart),V!==0&&A.strstart-V<=A.w_size-j&&(A.match_length=$e(A,V)),A.match_length>=N)if(Q=a._tr_tally(A,A.strstart-A.match_start,A.match_length-N),A.lookahead-=A.match_length,A.match_length<=A.max_lazy_match&&A.lookahead>=N){for(A.match_length--;A.strstart++,A.ins_h=(A.ins_h<<A.hash_shift^A.window[A.strstart+N-1])&A.hash_mask,V=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 Q=a._tr_tally(A,0,A.window[A.strstart]),A.lookahead--,A.strstart++;if(Q&&(ce(A,!1),A.strm.avail_out===0))return R}return A.insert=A.strstart<N-1?A.strstart:N-1,ne===p?(ce(A,!0),A.strm.avail_out===0?te:Y):A.last_lit&&(ce(A,!1),A.strm.avail_out===0)?R:re}function gt(A,ne){for(var V,Q,K;;){if(A.lookahead<j){if(ot(A),A.lookahead<j&&ne===f)return R;if(A.lookahead===0)break}if(V=0,A.lookahead>=N&&(A.ins_h=(A.ins_h<<A.hash_shift^A.window[A.strstart+N-1])&A.hash_mask,V=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=N-1,V!==0&&A.prev_length<A.max_lazy_match&&A.strstart-V<=A.w_size-j&&(A.match_length=$e(A,V),A.match_length<=5&&(A.strategy===1||A.match_length===N&&4096<A.strstart-A.match_start)&&(A.match_length=N-1)),A.prev_length>=N&&A.match_length<=A.prev_length){for(K=A.strstart+A.lookahead-N,Q=a._tr_tally(A,A.strstart-1-A.prev_match,A.prev_length-N),A.lookahead-=A.prev_length-1,A.prev_length-=2;++A.strstart<=K&&(A.ins_h=(A.ins_h<<A.hash_shift^A.window[A.strstart+N-1])&A.hash_mask,V=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=N-1,A.strstart++,Q&&(ce(A,!1),A.strm.avail_out===0))return R}else if(A.match_available){if((Q=a._tr_tally(A,0,A.window[A.strstart-1]))&&ce(A,!1),A.strstart++,A.lookahead--,A.strm.avail_out===0)return R}else A.match_available=1,A.strstart++,A.lookahead--}return A.match_available&&(Q=a._tr_tally(A,0,A.window[A.strstart-1]),A.match_available=0),A.insert=A.strstart<N-1?A.strstart:N-1,ne===p?(ce(A,!0),A.strm.avail_out===0?te:Y):A.last_lit&&(ce(A,!1),A.strm.avail_out===0)?R:re}function Bt(A,ne,V,Q,K){this.good_length=A,this.max_lazy=ne,this.nice_length=V,this.max_chain=Q,this.func=K}function Fe(){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=E,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*P),this.dyn_dtree=new s.Buf16(2*(2*x+1)),this.bl_tree=new s.Buf16(2*(2*D+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(W+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 Le(A){var ne;return A&&A.state?(A.total_in=A.total_out=0,A.data_type=w,(ne=A.state).pending=0,ne.pending_out=0,ne.wrap<0&&(ne.wrap=-ne.wrap),ne.status=ne.wrap?M:B,A.adler=ne.wrap===2?0:1,ne.last_flush=f,a._tr_init(ne),g):X(A,v)}function de(A){var ne=Le(A);return ne===g&&(function(V){V.window_size=2*V.w_size,Oe(V.head),V.max_lazy_match=i[V.level].max_lazy,V.good_match=i[V.level].good_length,V.nice_match=i[V.level].nice_length,V.max_chain_length=i[V.level].max_chain,V.strstart=0,V.block_start=0,V.lookahead=0,V.insert=0,V.match_length=V.prev_length=N-1,V.match_available=0,V.ins_h=0})(A.state),ne}function H(A,ne,V,Q,K,ee){if(!A)return v;var le=1;if(ne===y&&(ne=6),Q<0?(le=0,Q=-Q):15<Q&&(le=2,Q-=16),K<1||k<K||V!==E||Q<8||15<Q||ne<0||9<ne||ee<0||_<ee)return X(A,v);Q===8&&(Q=9);var be=new Fe;return(A.state=be).strm=A,be.wrap=le,be.gzhead=null,be.w_bits=Q,be.w_size=1<<be.w_bits,be.w_mask=be.w_size-1,be.hash_bits=K+7,be.hash_size=1<<be.hash_bits,be.hash_mask=be.hash_size-1,be.hash_shift=~~((be.hash_bits+N-1)/N),be.window=new s.Buf8(2*be.w_size),be.head=new s.Buf16(be.hash_size),be.prev=new s.Buf16(be.w_size),be.lit_bufsize=1<<K+6,be.pending_buf_size=4*be.lit_bufsize,be.pending_buf=new s.Buf8(be.pending_buf_size),be.d_buf=1*be.lit_bufsize,be.l_buf=3*be.lit_bufsize,be.level=ne,be.strategy=ee,be.method=V,de(A)}i=[new Bt(0,0,0,0,function(A,ne){var V=65535;for(V>A.pending_buf_size-5&&(V=A.pending_buf_size-5);;){if(A.lookahead<=1){if(ot(A),A.lookahead===0&&ne===f)return R;if(A.lookahead===0)break}A.strstart+=A.lookahead,A.lookahead=0;var Q=A.block_start+V;if((A.strstart===0||A.strstart>=Q)&&(A.lookahead=A.strstart-Q,A.strstart=Q,ce(A,!1),A.strm.avail_out===0)||A.strstart-A.block_start>=A.w_size-j&&(ce(A,!1),A.strm.avail_out===0))return R}return A.insert=0,ne===p?(ce(A,!0),A.strm.avail_out===0?te:Y):(A.strstart>A.block_start&&(ce(A,!1),A.strm.avail_out),R)}),new Bt(4,4,8,4,kt),new Bt(4,5,16,8,kt),new Bt(4,6,32,32,kt),new Bt(4,4,16,16,gt),new Bt(8,16,32,32,gt),new Bt(8,16,128,128,gt),new Bt(8,32,128,256,gt),new Bt(32,128,258,1024,gt),new Bt(32,258,258,4096,gt)],o.deflateInit=function(A,ne){return H(A,ne,E,15,8,0)},o.deflateInit2=H,o.deflateReset=de,o.deflateResetKeep=Le,o.deflateSetHeader=function(A,ne){return A&&A.state?A.state.wrap!==2?v:(A.state.gzhead=ne,g):v},o.deflate=function(A,ne){var V,Q,K,ee;if(!A||!A.state||5<ne||ne<0)return A?X(A,v):v;if(Q=A.state,!A.output||!A.input&&A.avail_in!==0||Q.status===666&&ne!==p)return X(A,A.avail_out===0?-5:v);if(Q.strm=A,V=Q.last_flush,Q.last_flush=ne,Q.status===M)if(Q.wrap===2)A.adler=0,ve(Q,31),ve(Q,139),ve(Q,8),Q.gzhead?(ve(Q,(Q.gzhead.text?1:0)+(Q.gzhead.hcrc?2:0)+(Q.gzhead.extra?4:0)+(Q.gzhead.name?8:0)+(Q.gzhead.comment?16:0)),ve(Q,255&Q.gzhead.time),ve(Q,Q.gzhead.time>>8&255),ve(Q,Q.gzhead.time>>16&255),ve(Q,Q.gzhead.time>>24&255),ve(Q,Q.level===9?2:2<=Q.strategy||Q.level<2?4:0),ve(Q,255&Q.gzhead.os),Q.gzhead.extra&&Q.gzhead.extra.length&&(ve(Q,255&Q.gzhead.extra.length),ve(Q,Q.gzhead.extra.length>>8&255)),Q.gzhead.hcrc&&(A.adler=u(A.adler,Q.pending_buf,Q.pending,0)),Q.gzindex=0,Q.status=69):(ve(Q,0),ve(Q,0),ve(Q,0),ve(Q,0),ve(Q,0),ve(Q,Q.level===9?2:2<=Q.strategy||Q.level<2?4:0),ve(Q,3),Q.status=B);else{var le=E+(Q.w_bits-8<<4)<<8;le|=(2<=Q.strategy||Q.level<2?0:Q.level<6?1:Q.level===6?2:3)<<6,Q.strstart!==0&&(le|=32),le+=31-le%31,Q.status=B,Re(Q,le),Q.strstart!==0&&(Re(Q,A.adler>>>16),Re(Q,65535&A.adler)),A.adler=1}if(Q.status===69)if(Q.gzhead.extra){for(K=Q.pending;Q.gzindex<(65535&Q.gzhead.extra.length)&&(Q.pending!==Q.pending_buf_size||(Q.gzhead.hcrc&&Q.pending>K&&(A.adler=u(A.adler,Q.pending_buf,Q.pending-K,K)),me(A),K=Q.pending,Q.pending!==Q.pending_buf_size));)ve(Q,255&Q.gzhead.extra[Q.gzindex]),Q.gzindex++;Q.gzhead.hcrc&&Q.pending>K&&(A.adler=u(A.adler,Q.pending_buf,Q.pending-K,K)),Q.gzindex===Q.gzhead.extra.length&&(Q.gzindex=0,Q.status=73)}else Q.status=73;if(Q.status===73)if(Q.gzhead.name){K=Q.pending;do{if(Q.pending===Q.pending_buf_size&&(Q.gzhead.hcrc&&Q.pending>K&&(A.adler=u(A.adler,Q.pending_buf,Q.pending-K,K)),me(A),K=Q.pending,Q.pending===Q.pending_buf_size)){ee=1;break}ee=Q.gzindex<Q.gzhead.name.length?255&Q.gzhead.name.charCodeAt(Q.gzindex++):0,ve(Q,ee)}while(ee!==0);Q.gzhead.hcrc&&Q.pending>K&&(A.adler=u(A.adler,Q.pending_buf,Q.pending-K,K)),ee===0&&(Q.gzindex=0,Q.status=91)}else Q.status=91;if(Q.status===91)if(Q.gzhead.comment){K=Q.pending;do{if(Q.pending===Q.pending_buf_size&&(Q.gzhead.hcrc&&Q.pending>K&&(A.adler=u(A.adler,Q.pending_buf,Q.pending-K,K)),me(A),K=Q.pending,Q.pending===Q.pending_buf_size)){ee=1;break}ee=Q.gzindex<Q.gzhead.comment.length?255&Q.gzhead.comment.charCodeAt(Q.gzindex++):0,ve(Q,ee)}while(ee!==0);Q.gzhead.hcrc&&Q.pending>K&&(A.adler=u(A.adler,Q.pending_buf,Q.pending-K,K)),ee===0&&(Q.status=103)}else Q.status=103;if(Q.status===103&&(Q.gzhead.hcrc?(Q.pending+2>Q.pending_buf_size&&me(A),Q.pending+2<=Q.pending_buf_size&&(ve(Q,255&A.adler),ve(Q,A.adler>>8&255),A.adler=0,Q.status=B)):Q.status=B),Q.pending!==0){if(me(A),A.avail_out===0)return Q.last_flush=-1,g}else if(A.avail_in===0&&U(ne)<=U(V)&&ne!==p)return X(A,-5);if(Q.status===666&&A.avail_in!==0)return X(A,-5);if(A.avail_in!==0||Q.lookahead!==0||ne!==f&&Q.status!==666){var be=Q.strategy===2?(function(G,pe){for(var Ee;;){if(G.lookahead===0&&(ot(G),G.lookahead===0)){if(pe===f)return R;break}if(G.match_length=0,Ee=a._tr_tally(G,0,G.window[G.strstart]),G.lookahead--,G.strstart++,Ee&&(ce(G,!1),G.strm.avail_out===0))return R}return G.insert=0,pe===p?(ce(G,!0),G.strm.avail_out===0?te:Y):G.last_lit&&(ce(G,!1),G.strm.avail_out===0)?R:re})(Q,ne):Q.strategy===3?(function(G,pe){for(var Ee,Se,Ge,ht,Me=G.window;;){if(G.lookahead<=L){if(ot(G),G.lookahead<=L&&pe===f)return R;if(G.lookahead===0)break}if(G.match_length=0,G.lookahead>=N&&0<G.strstart&&(Se=Me[Ge=G.strstart-1])===Me[++Ge]&&Se===Me[++Ge]&&Se===Me[++Ge]){ht=G.strstart+L;do;while(Se===Me[++Ge]&&Se===Me[++Ge]&&Se===Me[++Ge]&&Se===Me[++Ge]&&Se===Me[++Ge]&&Se===Me[++Ge]&&Se===Me[++Ge]&&Se===Me[++Ge]&&Ge<ht);G.match_length=L-(ht-Ge),G.match_length>G.lookahead&&(G.match_length=G.lookahead)}if(G.match_length>=N?(Ee=a._tr_tally(G,1,G.match_length-N),G.lookahead-=G.match_length,G.strstart+=G.match_length,G.match_length=0):(Ee=a._tr_tally(G,0,G.window[G.strstart]),G.lookahead--,G.strstart++),Ee&&(ce(G,!1),G.strm.avail_out===0))return R}return G.insert=0,pe===p?(ce(G,!0),G.strm.avail_out===0?te:Y):G.last_lit&&(ce(G,!1),G.strm.avail_out===0)?R:re})(Q,ne):i[Q.level].func(Q,ne);if(be!==te&&be!==Y||(Q.status=666),be===R||be===te)return A.avail_out===0&&(Q.last_flush=-1),g;if(be===re&&(ne===1?a._tr_align(Q):ne!==5&&(a._tr_stored_block(Q,0,0,!1),ne===3&&(Oe(Q.head),Q.lookahead===0&&(Q.strstart=0,Q.block_start=0,Q.insert=0))),me(A),A.avail_out===0))return Q.last_flush=-1,g}return ne!==p?g:Q.wrap<=0?1:(Q.wrap===2?(ve(Q,255&A.adler),ve(Q,A.adler>>8&255),ve(Q,A.adler>>16&255),ve(Q,A.adler>>24&255),ve(Q,255&A.total_in),ve(Q,A.total_in>>8&255),ve(Q,A.total_in>>16&255),ve(Q,A.total_in>>24&255)):(Re(Q,A.adler>>>16),Re(Q,65535&A.adler)),me(A),0<Q.wrap&&(Q.wrap=-Q.wrap),Q.pending!==0?g:1)},o.deflateEnd=function(A){var ne;return A&&A.state?(ne=A.state.status)!==M&&ne!==69&&ne!==73&&ne!==91&&ne!==103&&ne!==B&&ne!==666?X(A,v):(A.state=null,ne===B?X(A,-3):g):v},o.deflateSetDictionary=function(A,ne){var V,Q,K,ee,le,be,G,pe,Ee=ne.length;if(!A||!A.state||(ee=(V=A.state).wrap)===2||ee===1&&V.status!==M||V.lookahead)return v;for(ee===1&&(A.adler=l(A.adler,ne,Ee,0)),V.wrap=0,Ee>=V.w_size&&(ee===0&&(Oe(V.head),V.strstart=0,V.block_start=0,V.insert=0),pe=new s.Buf8(V.w_size),s.arraySet(pe,ne,Ee-V.w_size,V.w_size,0),ne=pe,Ee=V.w_size),le=A.avail_in,be=A.next_in,G=A.input,A.avail_in=Ee,A.next_in=0,A.input=ne,ot(V);V.lookahead>=N;){for(Q=V.strstart,K=V.lookahead-(N-1);V.ins_h=(V.ins_h<<V.hash_shift^V.window[Q+N-1])&V.hash_mask,V.prev[Q&V.w_mask]=V.head[V.ins_h],V.head[V.ins_h]=Q,Q++,--K;);V.strstart=Q,V.lookahead=N-1,ot(V)}return V.strstart+=V.lookahead,V.block_start=V.strstart,V.insert=V.lookahead,V.lookahead=0,V.match_length=V.prev_length=N-1,V.match_available=0,A.next_in=be,A.input=G,A.avail_in=le,V.wrap=ee,g},o.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(n,r,o){"use strict";r.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(n,r,o){"use strict";r.exports=function(i,s){var a=i.state,l=i.next_in,u,d,f,p,g,v,y,_,w,E,k,C,x,D,P,W,N,L,j,M,B,R=i.input,re;u=l+(i.avail_in-5),d=i.next_out,re=i.output,f=d-(s-i.avail_out),p=d+(i.avail_out-257),g=a.dmax,v=a.wsize,y=a.whave,_=a.wnext,w=a.window,E=a.hold,k=a.bits,C=a.lencode,x=a.distcode,D=(1<<a.lenbits)-1,P=(1<<a.distbits)-1;e:do{k<15&&(E+=R[l++]<<k,k+=8,E+=R[l++]<<k,k+=8),W=C[E&D];t:for(;;){if(E>>>=N=W>>>24,k-=N,(N=W>>>16&255)===0)re[d++]=65535&W;else{if(!(16&N)){if((64&N)==0){W=C[(65535&W)+(E&(1<<N)-1)];continue t}if(32&N){a.mode=12;break e}i.msg="invalid literal/length code",a.mode=30;break e}L=65535&W,(N&=15)&&(k<N&&(E+=R[l++]<<k,k+=8),L+=E&(1<<N)-1,E>>>=N,k-=N),k<15&&(E+=R[l++]<<k,k+=8,E+=R[l++]<<k,k+=8),W=x[E&P];n:for(;;){if(E>>>=N=W>>>24,k-=N,!(16&(N=W>>>16&255))){if((64&N)==0){W=x[(65535&W)+(E&(1<<N)-1)];continue n}i.msg="invalid distance code",a.mode=30;break e}if(j=65535&W,k<(N&=15)&&(E+=R[l++]<<k,(k+=8)<N&&(E+=R[l++]<<k,k+=8)),g<(j+=E&(1<<N)-1)){i.msg="invalid distance too far back",a.mode=30;break e}if(E>>>=N,k-=N,(N=d-f)<j){if(y<(N=j-N)&&a.sane){i.msg="invalid distance too far back",a.mode=30;break e}if(B=w,(M=0)===_){if(M+=v-N,N<L){for(L-=N;re[d++]=w[M++],--N;);M=d-j,B=re}}else if(_<N){if(M+=v+_-N,(N-=_)<L){for(L-=N;re[d++]=w[M++],--N;);if(M=0,_<L){for(L-=N=_;re[d++]=w[M++],--N;);M=d-j,B=re}}}else if(M+=_-N,N<L){for(L-=N;re[d++]=w[M++],--N;);M=d-j,B=re}for(;2<L;)re[d++]=B[M++],re[d++]=B[M++],re[d++]=B[M++],L-=3;L&&(re[d++]=B[M++],1<L&&(re[d++]=B[M++]))}else{for(M=d-j;re[d++]=re[M++],re[d++]=re[M++],re[d++]=re[M++],2<(L-=3););L&&(re[d++]=re[M++],1<L&&(re[d++]=re[M++]))}break}}break}}while(l<u&&d<p);l-=L=k>>3,E&=(1<<(k-=L<<3))-1,i.next_in=l,i.next_out=d,i.avail_in=l<u?u-l+5:5-(l-u),i.avail_out=d<p?p-d+257:257-(d-p),a.hold=E,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,f=2,p=0,g=-2,v=1,y=852,_=592;function w(M){return(M>>>24&255)+(M>>>8&65280)+((65280&M)<<8)+((255&M)<<24)}function E(){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(M){var B;return M&&M.state?(B=M.state,M.total_in=M.total_out=B.total=0,M.msg="",B.wrap&&(M.adler=1&B.wrap),B.mode=v,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):g}function C(M){var B;return M&&M.state?((B=M.state).wsize=0,B.whave=0,B.wnext=0,k(M)):g}function x(M,B){var R,re;return M&&M.state?(re=M.state,B<0?(R=0,B=-B):(R=1+(B>>4),B<48&&(B&=15)),B&&(B<8||15<B)?g:(re.window!==null&&re.wbits!==B&&(re.window=null),re.wrap=R,re.wbits=B,C(M))):g}function D(M,B){var R,re;return M?(re=new E,(M.state=re).window=null,(R=x(M,B))!==p&&(M.state=null),R):g}var P,W,N=!0;function L(M){if(N){var B;for(P=new i.Buf32(512),W=new i.Buf32(32),B=0;B<144;)M.lens[B++]=8;for(;B<256;)M.lens[B++]=9;for(;B<280;)M.lens[B++]=7;for(;B<288;)M.lens[B++]=8;for(u(d,M.lens,0,288,P,0,M.work,{bits:9}),B=0;B<32;)M.lens[B++]=5;u(f,M.lens,0,32,W,0,M.work,{bits:5}),N=!1}M.lencode=P,M.lenbits=9,M.distcode=W,M.distbits=5}function j(M,B,R,re){var te,Y=M.state;return Y.window===null&&(Y.wsize=1<<Y.wbits,Y.wnext=0,Y.whave=0,Y.window=new i.Buf8(Y.wsize)),re>=Y.wsize?(i.arraySet(Y.window,B,R-Y.wsize,Y.wsize,0),Y.wnext=0,Y.whave=Y.wsize):(re<(te=Y.wsize-Y.wnext)&&(te=re),i.arraySet(Y.window,B,R-re,te,Y.wnext),(re-=te)?(i.arraySet(Y.window,B,R-re,re,0),Y.wnext=re,Y.whave=Y.wsize):(Y.wnext+=te,Y.wnext===Y.wsize&&(Y.wnext=0),Y.whave<Y.wsize&&(Y.whave+=te))),0}o.inflateReset=C,o.inflateReset2=x,o.inflateResetKeep=k,o.inflateInit=function(M){return D(M,15)},o.inflateInit2=D,o.inflate=function(M,B){var R,re,te,Y,X,U,Oe,me,ce,ve,Re,$e,ot,kt,gt,Bt,Fe,Le,de,H,A,ne,V,Q,K=0,ee=new i.Buf8(4),le=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!M||!M.state||!M.output||!M.input&&M.avail_in!==0)return g;(R=M.state).mode===12&&(R.mode=13),X=M.next_out,te=M.output,Oe=M.avail_out,Y=M.next_in,re=M.input,U=M.avail_in,me=R.hold,ce=R.bits,ve=U,Re=Oe,ne=p;e:for(;;)switch(R.mode){case v:if(R.wrap===0){R.mode=13;break}for(;ce<16;){if(U===0)break e;U--,me+=re[Y++]<<ce,ce+=8}if(2&R.wrap&&me===35615){ee[R.check=0]=255&me,ee[1]=me>>>8&255,R.check=a(R.check,ee,2,0),ce=me=0,R.mode=2;break}if(R.flags=0,R.head&&(R.head.done=!1),!(1&R.wrap)||(((255&me)<<8)+(me>>8))%31){M.msg="incorrect header check",R.mode=30;break}if((15&me)!=8){M.msg="unknown compression method",R.mode=30;break}if(ce-=4,A=8+(15&(me>>>=4)),R.wbits===0)R.wbits=A;else if(A>R.wbits){M.msg="invalid window size",R.mode=30;break}R.dmax=1<<A,M.adler=R.check=1,R.mode=512&me?10:12,ce=me=0;break;case 2:for(;ce<16;){if(U===0)break e;U--,me+=re[Y++]<<ce,ce+=8}if(R.flags=me,(255&R.flags)!=8){M.msg="unknown compression method",R.mode=30;break}if(57344&R.flags){M.msg="unknown header flags set",R.mode=30;break}R.head&&(R.head.text=me>>8&1),512&R.flags&&(ee[0]=255&me,ee[1]=me>>>8&255,R.check=a(R.check,ee,2,0)),ce=me=0,R.mode=3;case 3:for(;ce<32;){if(U===0)break e;U--,me+=re[Y++]<<ce,ce+=8}R.head&&(R.head.time=me),512&R.flags&&(ee[0]=255&me,ee[1]=me>>>8&255,ee[2]=me>>>16&255,ee[3]=me>>>24&255,R.check=a(R.check,ee,4,0)),ce=me=0,R.mode=4;case 4:for(;ce<16;){if(U===0)break e;U--,me+=re[Y++]<<ce,ce+=8}R.head&&(R.head.xflags=255&me,R.head.os=me>>8),512&R.flags&&(ee[0]=255&me,ee[1]=me>>>8&255,R.check=a(R.check,ee,2,0)),ce=me=0,R.mode=5;case 5:if(1024&R.flags){for(;ce<16;){if(U===0)break e;U--,me+=re[Y++]<<ce,ce+=8}R.length=me,R.head&&(R.head.extra_len=me),512&R.flags&&(ee[0]=255&me,ee[1]=me>>>8&255,R.check=a(R.check,ee,2,0)),ce=me=0}else R.head&&(R.head.extra=null);R.mode=6;case 6:if(1024&R.flags&&(U<($e=R.length)&&($e=U),$e&&(R.head&&(A=R.head.extra_len-R.length,R.head.extra||(R.head.extra=new Array(R.head.extra_len)),i.arraySet(R.head.extra,re,Y,$e,A)),512&R.flags&&(R.check=a(R.check,re,$e,Y)),U-=$e,Y+=$e,R.length-=$e),R.length))break e;R.length=0,R.mode=7;case 7:if(2048&R.flags){if(U===0)break e;for($e=0;A=re[Y+$e++],R.head&&A&&R.length<65536&&(R.head.name+=String.fromCharCode(A)),A&&$e<U;);if(512&R.flags&&(R.check=a(R.check,re,$e,Y)),U-=$e,Y+=$e,A)break e}else R.head&&(R.head.name=null);R.length=0,R.mode=8;case 8:if(4096&R.flags){if(U===0)break e;for($e=0;A=re[Y+$e++],R.head&&A&&R.length<65536&&(R.head.comment+=String.fromCharCode(A)),A&&$e<U;);if(512&R.flags&&(R.check=a(R.check,re,$e,Y)),U-=$e,Y+=$e,A)break e}else R.head&&(R.head.comment=null);R.mode=9;case 9:if(512&R.flags){for(;ce<16;){if(U===0)break e;U--,me+=re[Y++]<<ce,ce+=8}if(me!==(65535&R.check)){M.msg="header crc mismatch",R.mode=30;break}ce=me=0}R.head&&(R.head.hcrc=R.flags>>9&1,R.head.done=!0),M.adler=R.check=0,R.mode=12;break;case 10:for(;ce<32;){if(U===0)break e;U--,me+=re[Y++]<<ce,ce+=8}M.adler=R.check=w(me),ce=me=0,R.mode=11;case 11:if(R.havedict===0)return M.next_out=X,M.avail_out=Oe,M.next_in=Y,M.avail_in=U,R.hold=me,R.bits=ce,2;M.adler=R.check=1,R.mode=12;case 12:if(B===5||B===6)break e;case 13:if(R.last){me>>>=7&ce,ce-=7&ce,R.mode=27;break}for(;ce<3;){if(U===0)break e;U--,me+=re[Y++]<<ce,ce+=8}switch(R.last=1&me,ce-=1,3&(me>>>=1)){case 0:R.mode=14;break;case 1:if(L(R),R.mode=20,B!==6)break;me>>>=2,ce-=2;break e;case 2:R.mode=17;break;case 3:M.msg="invalid block type",R.mode=30}me>>>=2,ce-=2;break;case 14:for(me>>>=7&ce,ce-=7&ce;ce<32;){if(U===0)break e;U--,me+=re[Y++]<<ce,ce+=8}if((65535&me)!=(me>>>16^65535)){M.msg="invalid stored block lengths",R.mode=30;break}if(R.length=65535&me,ce=me=0,R.mode=15,B===6)break e;case 15:R.mode=16;case 16:if($e=R.length){if(U<$e&&($e=U),Oe<$e&&($e=Oe),$e===0)break e;i.arraySet(te,re,Y,$e,X),U-=$e,Y+=$e,Oe-=$e,X+=$e,R.length-=$e;break}R.mode=12;break;case 17:for(;ce<14;){if(U===0)break e;U--,me+=re[Y++]<<ce,ce+=8}if(R.nlen=257+(31&me),me>>>=5,ce-=5,R.ndist=1+(31&me),me>>>=5,ce-=5,R.ncode=4+(15&me),me>>>=4,ce-=4,286<R.nlen||30<R.ndist){M.msg="too many length or distance symbols",R.mode=30;break}R.have=0,R.mode=18;case 18:for(;R.have<R.ncode;){for(;ce<3;){if(U===0)break e;U--,me+=re[Y++]<<ce,ce+=8}R.lens[le[R.have++]]=7&me,me>>>=3,ce-=3}for(;R.have<19;)R.lens[le[R.have++]]=0;if(R.lencode=R.lendyn,R.lenbits=7,V={bits:R.lenbits},ne=u(0,R.lens,0,19,R.lencode,0,R.work,V),R.lenbits=V.bits,ne){M.msg="invalid code lengths set",R.mode=30;break}R.have=0,R.mode=19;case 19:for(;R.have<R.nlen+R.ndist;){for(;Bt=(K=R.lencode[me&(1<<R.lenbits)-1])>>>16&255,Fe=65535&K,!((gt=K>>>24)<=ce);){if(U===0)break e;U--,me+=re[Y++]<<ce,ce+=8}if(Fe<16)me>>>=gt,ce-=gt,R.lens[R.have++]=Fe;else{if(Fe===16){for(Q=gt+2;ce<Q;){if(U===0)break e;U--,me+=re[Y++]<<ce,ce+=8}if(me>>>=gt,ce-=gt,R.have===0){M.msg="invalid bit length repeat",R.mode=30;break}A=R.lens[R.have-1],$e=3+(3&me),me>>>=2,ce-=2}else if(Fe===17){for(Q=gt+3;ce<Q;){if(U===0)break e;U--,me+=re[Y++]<<ce,ce+=8}ce-=gt,A=0,$e=3+(7&(me>>>=gt)),me>>>=3,ce-=3}else{for(Q=gt+7;ce<Q;){if(U===0)break e;U--,me+=re[Y++]<<ce,ce+=8}ce-=gt,A=0,$e=11+(127&(me>>>=gt)),me>>>=7,ce-=7}if(R.have+$e>R.nlen+R.ndist){M.msg="invalid bit length repeat",R.mode=30;break}for(;$e--;)R.lens[R.have++]=A}}if(R.mode===30)break;if(R.lens[256]===0){M.msg="invalid code -- missing end-of-block",R.mode=30;break}if(R.lenbits=9,V={bits:R.lenbits},ne=u(d,R.lens,0,R.nlen,R.lencode,0,R.work,V),R.lenbits=V.bits,ne){M.msg="invalid literal/lengths set",R.mode=30;break}if(R.distbits=6,R.distcode=R.distdyn,V={bits:R.distbits},ne=u(f,R.lens,R.nlen,R.ndist,R.distcode,0,R.work,V),R.distbits=V.bits,ne){M.msg="invalid distances set",R.mode=30;break}if(R.mode=20,B===6)break e;case 20:R.mode=21;case 21:if(6<=U&&258<=Oe){M.next_out=X,M.avail_out=Oe,M.next_in=Y,M.avail_in=U,R.hold=me,R.bits=ce,l(M,Re),X=M.next_out,te=M.output,Oe=M.avail_out,Y=M.next_in,re=M.input,U=M.avail_in,me=R.hold,ce=R.bits,R.mode===12&&(R.back=-1);break}for(R.back=0;Bt=(K=R.lencode[me&(1<<R.lenbits)-1])>>>16&255,Fe=65535&K,!((gt=K>>>24)<=ce);){if(U===0)break e;U--,me+=re[Y++]<<ce,ce+=8}if(Bt&&(240&Bt)==0){for(Le=gt,de=Bt,H=Fe;Bt=(K=R.lencode[H+((me&(1<<Le+de)-1)>>Le)])>>>16&255,Fe=65535&K,!(Le+(gt=K>>>24)<=ce);){if(U===0)break e;U--,me+=re[Y++]<<ce,ce+=8}me>>>=Le,ce-=Le,R.back+=Le}if(me>>>=gt,ce-=gt,R.back+=gt,R.length=Fe,Bt===0){R.mode=26;break}if(32&Bt){R.back=-1,R.mode=12;break}if(64&Bt){M.msg="invalid literal/length code",R.mode=30;break}R.extra=15&Bt,R.mode=22;case 22:if(R.extra){for(Q=R.extra;ce<Q;){if(U===0)break e;U--,me+=re[Y++]<<ce,ce+=8}R.length+=me&(1<<R.extra)-1,me>>>=R.extra,ce-=R.extra,R.back+=R.extra}R.was=R.length,R.mode=23;case 23:for(;Bt=(K=R.distcode[me&(1<<R.distbits)-1])>>>16&255,Fe=65535&K,!((gt=K>>>24)<=ce);){if(U===0)break e;U--,me+=re[Y++]<<ce,ce+=8}if((240&Bt)==0){for(Le=gt,de=Bt,H=Fe;Bt=(K=R.distcode[H+((me&(1<<Le+de)-1)>>Le)])>>>16&255,Fe=65535&K,!(Le+(gt=K>>>24)<=ce);){if(U===0)break e;U--,me+=re[Y++]<<ce,ce+=8}me>>>=Le,ce-=Le,R.back+=Le}if(me>>>=gt,ce-=gt,R.back+=gt,64&Bt){M.msg="invalid distance code",R.mode=30;break}R.offset=Fe,R.extra=15&Bt,R.mode=24;case 24:if(R.extra){for(Q=R.extra;ce<Q;){if(U===0)break e;U--,me+=re[Y++]<<ce,ce+=8}R.offset+=me&(1<<R.extra)-1,me>>>=R.extra,ce-=R.extra,R.back+=R.extra}if(R.offset>R.dmax){M.msg="invalid distance too far back",R.mode=30;break}R.mode=25;case 25:if(Oe===0)break e;if($e=Re-Oe,R.offset>$e){if(($e=R.offset-$e)>R.whave&&R.sane){M.msg="invalid distance too far back",R.mode=30;break}ot=$e>R.wnext?($e-=R.wnext,R.wsize-$e):R.wnext-$e,$e>R.length&&($e=R.length),kt=R.window}else kt=te,ot=X-R.offset,$e=R.length;for(Oe<$e&&($e=Oe),Oe-=$e,R.length-=$e;te[X++]=kt[ot++],--$e;);R.length===0&&(R.mode=21);break;case 26:if(Oe===0)break e;te[X++]=R.length,Oe--,R.mode=21;break;case 27:if(R.wrap){for(;ce<32;){if(U===0)break e;U--,me|=re[Y++]<<ce,ce+=8}if(Re-=Oe,M.total_out+=Re,R.total+=Re,Re&&(M.adler=R.check=R.flags?a(R.check,te,Re,X-Re):s(R.check,te,Re,X-Re)),Re=Oe,(R.flags?me:w(me))!==R.check){M.msg="incorrect data check",R.mode=30;break}ce=me=0}R.mode=28;case 28:if(R.wrap&&R.flags){for(;ce<32;){if(U===0)break e;U--,me+=re[Y++]<<ce,ce+=8}if(me!==(4294967295&R.total)){M.msg="incorrect length check",R.mode=30;break}ce=me=0}R.mode=29;case 29:ne=1;break e;case 30:ne=-3;break e;case 31:return-4;default:return g}return M.next_out=X,M.avail_out=Oe,M.next_in=Y,M.avail_in=U,R.hold=me,R.bits=ce,(R.wsize||Re!==M.avail_out&&R.mode<30&&(R.mode<27||B!==4))&&j(M,M.output,M.next_out,Re-M.avail_out)?(R.mode=31,-4):(ve-=M.avail_in,Re-=M.avail_out,M.total_in+=ve,M.total_out+=Re,R.total+=Re,R.wrap&&Re&&(M.adler=R.check=R.flags?a(R.check,te,Re,M.next_out-Re):s(R.check,te,Re,M.next_out-Re)),M.data_type=R.bits+(R.last?64:0)+(R.mode===12?128:0)+(R.mode===20||R.mode===15?256:0),(ve==0&&Re===0||B===4)&&ne===p&&(ne=-5),ne)},o.inflateEnd=function(M){if(!M||!M.state)return g;var B=M.state;return B.window&&(B.window=null),M.state=null,p},o.inflateGetHeader=function(M,B){var R;return M&&M.state?(2&(R=M.state).wrap)==0?g:((R.head=B).done=!1,p):g},o.inflateSetDictionary=function(M,B){var R,re=B.length;return M&&M.state?(R=M.state).wrap!==0&&R.mode!==11?g:R.mode===11&&s(1,B,re,0)!==R.check?-3:j(M,B,re,re)?(R.mode=31,-4):(R.havedict=1,p):g},o.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(n,r,o){"use strict";var i=n("../utils/common"),s=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],a=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],l=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],u=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];r.exports=function(d,f,p,g,v,y,_,w){var E,k,C,x,D,P,W,N,L,j=w.bits,M=0,B=0,R=0,re=0,te=0,Y=0,X=0,U=0,Oe=0,me=0,ce=null,ve=0,Re=new i.Buf16(16),$e=new i.Buf16(16),ot=null,kt=0;for(M=0;M<=15;M++)Re[M]=0;for(B=0;B<g;B++)Re[f[p+B]]++;for(te=j,re=15;1<=re&&Re[re]===0;re--);if(re<te&&(te=re),re===0)return v[y++]=20971520,v[y++]=20971520,w.bits=1,0;for(R=1;R<re&&Re[R]===0;R++);for(te<R&&(te=R),M=U=1;M<=15;M++)if(U<<=1,(U-=Re[M])<0)return-1;if(0<U&&(d===0||re!==1))return-1;for($e[1]=0,M=1;M<15;M++)$e[M+1]=$e[M]+Re[M];for(B=0;B<g;B++)f[p+B]!==0&&(_[$e[f[p+B]]++]=B);if(P=d===0?(ce=ot=_,19):d===1?(ce=s,ve-=257,ot=a,kt-=257,256):(ce=l,ot=u,-1),M=R,D=y,X=B=me=0,C=-1,x=(Oe=1<<(Y=te))-1,d===1&&852<Oe||d===2&&592<Oe)return 1;for(;;){for(W=M-X,L=_[B]<P?(N=0,_[B]):_[B]>P?(N=ot[kt+_[B]],ce[ve+_[B]]):(N=96,0),E=1<<M-X,R=k=1<<Y;v[D+(me>>X)+(k-=E)]=W<<24|N<<16|L|0,k!==0;);for(E=1<<M-1;me&E;)E>>=1;if(E!==0?(me&=E-1,me+=E):me=0,B++,--Re[M]==0){if(M===re)break;M=f[p+_[B]]}if(te<M&&(me&x)!==C){for(X===0&&(X=te),D+=R,U=1<<(Y=M-X);Y+X<re&&!((U-=Re[Y+X])<=0);)Y++,U<<=1;if(Oe+=1<<Y,d===1&&852<Oe||d===2&&592<Oe)return 1;v[C=me&x]=te<<24|Y<<16|D-y|0}}return me!==0&&(v[D+me]=M-X<<24|4194304),w.bits=te,0}},{"../utils/common":41}],51:[function(n,r,o){"use strict";r.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(n,r,o){"use strict";var i=n("../utils/common"),s=0,a=1;function l(K){for(var ee=K.length;0<=--ee;)K[ee]=0}var u=0,d=29,f=256,p=f+1+d,g=30,v=19,y=2*p+1,_=15,w=16,E=7,k=256,C=16,x=17,D=18,P=[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],W=[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],N=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],L=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],j=new Array(2*(p+2));l(j);var M=new Array(2*g);l(M);var B=new Array(512);l(B);var R=new Array(256);l(R);var re=new Array(d);l(re);var te,Y,X,U=new Array(g);function Oe(K,ee,le,be,G){this.static_tree=K,this.extra_bits=ee,this.extra_base=le,this.elems=be,this.max_length=G,this.has_stree=K&&K.length}function me(K,ee){this.dyn_tree=K,this.max_code=0,this.stat_desc=ee}function ce(K){return K<256?B[K]:B[256+(K>>>7)]}function ve(K,ee){K.pending_buf[K.pending++]=255&ee,K.pending_buf[K.pending++]=ee>>>8&255}function Re(K,ee,le){K.bi_valid>w-le?(K.bi_buf|=ee<<K.bi_valid&65535,ve(K,K.bi_buf),K.bi_buf=ee>>w-K.bi_valid,K.bi_valid+=le-w):(K.bi_buf|=ee<<K.bi_valid&65535,K.bi_valid+=le)}function $e(K,ee,le){Re(K,le[2*ee],le[2*ee+1])}function ot(K,ee){for(var le=0;le|=1&K,K>>>=1,le<<=1,0<--ee;);return le>>>1}function kt(K,ee,le){var be,G,pe=new Array(_+1),Ee=0;for(be=1;be<=_;be++)pe[be]=Ee=Ee+le[be-1]<<1;for(G=0;G<=ee;G++){var Se=K[2*G+1];Se!==0&&(K[2*G]=ot(pe[Se]++,Se))}}function gt(K){var ee;for(ee=0;ee<p;ee++)K.dyn_ltree[2*ee]=0;for(ee=0;ee<g;ee++)K.dyn_dtree[2*ee]=0;for(ee=0;ee<v;ee++)K.bl_tree[2*ee]=0;K.dyn_ltree[2*k]=1,K.opt_len=K.static_len=0,K.last_lit=K.matches=0}function Bt(K){8<K.bi_valid?ve(K,K.bi_buf):0<K.bi_valid&&(K.pending_buf[K.pending++]=K.bi_buf),K.bi_buf=0,K.bi_valid=0}function Fe(K,ee,le,be){var G=2*ee,pe=2*le;return K[G]<K[pe]||K[G]===K[pe]&&be[ee]<=be[le]}function Le(K,ee,le){for(var be=K.heap[le],G=le<<1;G<=K.heap_len&&(G<K.heap_len&&Fe(ee,K.heap[G+1],K.heap[G],K.depth)&&G++,!Fe(ee,be,K.heap[G],K.depth));)K.heap[le]=K.heap[G],le=G,G<<=1;K.heap[le]=be}function de(K,ee,le){var be,G,pe,Ee,Se=0;if(K.last_lit!==0)for(;be=K.pending_buf[K.d_buf+2*Se]<<8|K.pending_buf[K.d_buf+2*Se+1],G=K.pending_buf[K.l_buf+Se],Se++,be===0?$e(K,G,ee):($e(K,(pe=R[G])+f+1,ee),(Ee=P[pe])!==0&&Re(K,G-=re[pe],Ee),$e(K,pe=ce(--be),le),(Ee=W[pe])!==0&&Re(K,be-=U[pe],Ee)),Se<K.last_lit;);$e(K,k,ee)}function H(K,ee){var le,be,G,pe=ee.dyn_tree,Ee=ee.stat_desc.static_tree,Se=ee.stat_desc.has_stree,Ge=ee.stat_desc.elems,ht=-1;for(K.heap_len=0,K.heap_max=y,le=0;le<Ge;le++)pe[2*le]!==0?(K.heap[++K.heap_len]=ht=le,K.depth[le]=0):pe[2*le+1]=0;for(;K.heap_len<2;)pe[2*(G=K.heap[++K.heap_len]=ht<2?++ht:0)]=1,K.depth[G]=0,K.opt_len--,Se&&(K.static_len-=Ee[2*G+1]);for(ee.max_code=ht,le=K.heap_len>>1;1<=le;le--)Le(K,pe,le);for(G=Ge;le=K.heap[1],K.heap[1]=K.heap[K.heap_len--],Le(K,pe,1),be=K.heap[1],K.heap[--K.heap_max]=le,K.heap[--K.heap_max]=be,pe[2*G]=pe[2*le]+pe[2*be],K.depth[G]=(K.depth[le]>=K.depth[be]?K.depth[le]:K.depth[be])+1,pe[2*le+1]=pe[2*be+1]=G,K.heap[1]=G++,Le(K,pe,1),2<=K.heap_len;);K.heap[--K.heap_max]=K.heap[1],(function(Me,qe){var Jt,St,Ut,Lt,mn,ut,en=qe.dyn_tree,Tn=qe.max_code,Cn=qe.stat_desc.static_tree,ar=qe.stat_desc.has_stree,pr=qe.stat_desc.extra_bits,Vn=qe.stat_desc.extra_base,Gn=qe.stat_desc.max_length,lr=0;for(Lt=0;Lt<=_;Lt++)Me.bl_count[Lt]=0;for(en[2*Me.heap[Me.heap_max]+1]=0,Jt=Me.heap_max+1;Jt<y;Jt++)Gn<(Lt=en[2*en[2*(St=Me.heap[Jt])+1]+1]+1)&&(Lt=Gn,lr++),en[2*St+1]=Lt,Tn<St||(Me.bl_count[Lt]++,mn=0,Vn<=St&&(mn=pr[St-Vn]),ut=en[2*St],Me.opt_len+=ut*(Lt+mn),ar&&(Me.static_len+=ut*(Cn[2*St+1]+mn)));if(lr!==0){do{for(Lt=Gn-1;Me.bl_count[Lt]===0;)Lt--;Me.bl_count[Lt]--,Me.bl_count[Lt+1]+=2,Me.bl_count[Gn]--,lr-=2}while(0<lr);for(Lt=Gn;Lt!==0;Lt--)for(St=Me.bl_count[Lt];St!==0;)Tn<(Ut=Me.heap[--Jt])||(en[2*Ut+1]!==Lt&&(Me.opt_len+=(Lt-en[2*Ut+1])*en[2*Ut],en[2*Ut+1]=Lt),St--)}})(K,ee),kt(pe,ht,K.bl_count)}function A(K,ee,le){var be,G,pe=-1,Ee=ee[1],Se=0,Ge=7,ht=4;for(Ee===0&&(Ge=138,ht=3),ee[2*(le+1)+1]=65535,be=0;be<=le;be++)G=Ee,Ee=ee[2*(be+1)+1],++Se<Ge&&G===Ee||(Se<ht?K.bl_tree[2*G]+=Se:G!==0?(G!==pe&&K.bl_tree[2*G]++,K.bl_tree[2*C]++):Se<=10?K.bl_tree[2*x]++:K.bl_tree[2*D]++,pe=G,ht=(Se=0)===Ee?(Ge=138,3):G===Ee?(Ge=6,3):(Ge=7,4))}function ne(K,ee,le){var be,G,pe=-1,Ee=ee[1],Se=0,Ge=7,ht=4;for(Ee===0&&(Ge=138,ht=3),be=0;be<=le;be++)if(G=Ee,Ee=ee[2*(be+1)+1],!(++Se<Ge&&G===Ee)){if(Se<ht)for(;$e(K,G,K.bl_tree),--Se!=0;);else G!==0?(G!==pe&&($e(K,G,K.bl_tree),Se--),$e(K,C,K.bl_tree),Re(K,Se-3,2)):Se<=10?($e(K,x,K.bl_tree),Re(K,Se-3,3)):($e(K,D,K.bl_tree),Re(K,Se-11,7));pe=G,ht=(Se=0)===Ee?(Ge=138,3):G===Ee?(Ge=6,3):(Ge=7,4)}}l(U);var V=!1;function Q(K,ee,le,be){Re(K,(u<<1)+(be?1:0),3),(function(G,pe,Ee,Se){Bt(G),Se&&(ve(G,Ee),ve(G,~Ee)),i.arraySet(G.pending_buf,G.window,pe,Ee,G.pending),G.pending+=Ee})(K,ee,le,!0)}o._tr_init=function(K){V||((function(){var ee,le,be,G,pe,Ee=new Array(_+1);for(G=be=0;G<d-1;G++)for(re[G]=be,ee=0;ee<1<<P[G];ee++)R[be++]=G;for(R[be-1]=G,G=pe=0;G<16;G++)for(U[G]=pe,ee=0;ee<1<<W[G];ee++)B[pe++]=G;for(pe>>=7;G<g;G++)for(U[G]=pe<<7,ee=0;ee<1<<W[G]-7;ee++)B[256+pe++]=G;for(le=0;le<=_;le++)Ee[le]=0;for(ee=0;ee<=143;)j[2*ee+1]=8,ee++,Ee[8]++;for(;ee<=255;)j[2*ee+1]=9,ee++,Ee[9]++;for(;ee<=279;)j[2*ee+1]=7,ee++,Ee[7]++;for(;ee<=287;)j[2*ee+1]=8,ee++,Ee[8]++;for(kt(j,p+1,Ee),ee=0;ee<g;ee++)M[2*ee+1]=5,M[2*ee]=ot(ee,5);te=new Oe(j,P,f+1,p,_),Y=new Oe(M,W,0,g,_),X=new Oe(new Array(0),N,0,v,E)})(),V=!0),K.l_desc=new me(K.dyn_ltree,te),K.d_desc=new me(K.dyn_dtree,Y),K.bl_desc=new me(K.bl_tree,X),K.bi_buf=0,K.bi_valid=0,gt(K)},o._tr_stored_block=Q,o._tr_flush_block=function(K,ee,le,be){var G,pe,Ee=0;0<K.level?(K.strm.data_type===2&&(K.strm.data_type=(function(Se){var Ge,ht=4093624447;for(Ge=0;Ge<=31;Ge++,ht>>>=1)if(1&ht&&Se.dyn_ltree[2*Ge]!==0)return s;if(Se.dyn_ltree[18]!==0||Se.dyn_ltree[20]!==0||Se.dyn_ltree[26]!==0)return a;for(Ge=32;Ge<f;Ge++)if(Se.dyn_ltree[2*Ge]!==0)return a;return s})(K)),H(K,K.l_desc),H(K,K.d_desc),Ee=(function(Se){var Ge;for(A(Se,Se.dyn_ltree,Se.l_desc.max_code),A(Se,Se.dyn_dtree,Se.d_desc.max_code),H(Se,Se.bl_desc),Ge=v-1;3<=Ge&&Se.bl_tree[2*L[Ge]+1]===0;Ge--);return Se.opt_len+=3*(Ge+1)+5+5+4,Ge})(K),G=K.opt_len+3+7>>>3,(pe=K.static_len+3+7>>>3)<=G&&(G=pe)):G=pe=le+5,le+4<=G&&ee!==-1?Q(K,ee,le,be):K.strategy===4||pe===G?(Re(K,2+(be?1:0),3),de(K,j,M)):(Re(K,4+(be?1:0),3),(function(Se,Ge,ht,Me){var qe;for(Re(Se,Ge-257,5),Re(Se,ht-1,5),Re(Se,Me-4,4),qe=0;qe<Me;qe++)Re(Se,Se.bl_tree[2*L[qe]+1],3);ne(Se,Se.dyn_ltree,Ge-1),ne(Se,Se.dyn_dtree,ht-1)})(K,K.l_desc.max_code+1,K.d_desc.max_code+1,Ee+1),de(K,K.dyn_ltree,K.dyn_dtree)),gt(K),be&&Bt(K)},o._tr_tally=function(K,ee,le){return K.pending_buf[K.d_buf+2*K.last_lit]=ee>>>8&255,K.pending_buf[K.d_buf+2*K.last_lit+1]=255&ee,K.pending_buf[K.l_buf+K.last_lit]=255&le,K.last_lit++,ee===0?K.dyn_ltree[2*le]++:(K.matches++,ee--,K.dyn_ltree[2*(R[le]+f+1)]++,K.dyn_dtree[2*ce(ee)]++),K.last_lit===K.lit_bufsize-1},o._tr_align=function(K){Re(K,2,3),$e(K,k,j),(function(ee){ee.bi_valid===16?(ve(ee,ee.bi_buf),ee.bi_buf=0,ee.bi_valid=0):8<=ee.bi_valid&&(ee.pending_buf[ee.pending++]=255&ee.bi_buf,ee.bi_buf>>=8,ee.bi_valid-=8)})(K)}},{"../utils/common":41}],53:[function(n,r,o){"use strict";r.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(n,r,o){(function(i){(function(s,a){"use strict";if(!s.setImmediate){var l,u,d,f,p=1,g={},v=!1,y=s.document,_=Object.getPrototypeOf&&Object.getPrototypeOf(s);_=_&&_.setTimeout?_:s,l={}.toString.call(s.process)==="[object process]"?function(C){process.nextTick(function(){E(C)})}:(function(){if(s.postMessage&&!s.importScripts){var C=!0,x=s.onmessage;return s.onmessage=function(){C=!1},s.postMessage("","*"),s.onmessage=x,C}})()?(f="setImmediate$"+Math.random()+"$",s.addEventListener?s.addEventListener("message",k,!1):s.attachEvent("onmessage",k),function(C){s.postMessage(f+C,"*")}):s.MessageChannel?((d=new MessageChannel).port1.onmessage=function(C){E(C.data)},function(C){d.port2.postMessage(C)}):y&&"onreadystatechange"in y.createElement("script")?(u=y.documentElement,function(C){var x=y.createElement("script");x.onreadystatechange=function(){E(C),x.onreadystatechange=null,u.removeChild(x),x=null},u.appendChild(x)}):function(C){setTimeout(E,0,C)},_.setImmediate=function(C){typeof C!="function"&&(C=new Function(""+C));for(var x=new Array(arguments.length-1),D=0;D<x.length;D++)x[D]=arguments[D+1];return g[p]={callback:C,args:x},l(p),p++},_.clearImmediate=w}function w(C){delete g[C]}function E(C){if(v)setTimeout(E,0,C);else{var x=g[C];if(x){v=!0;try{(function(D){var P=D.callback,W=D.args;switch(W.length){case 0:P();break;case 1:P(W[0]);break;case 2:P(W[0],W[1]);break;case 3:P(W[0],W[1],W[2]);break;default:P.apply(a,W)}})(x)}finally{w(C),v=!1}}}}function k(C){C.source===s&&typeof C.data=="string"&&C.data.indexOf(f)===0&&E(+C.data.slice(f.length))}})(typeof self>"u"?i===void 0?this:i:self)}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})),jr="application/vnd.openxmlformats-officedocument.wordprocessingml.document",Qa="application/pdf",vh="text/html",T8={docx:jr,pdf:Qa,html:vh},Em={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"},x8=e=>typeof e!="string"?"":e.trim(),Wb=e=>{if(typeof e!="string")return"";const t=e.trim();return t?t.toLowerCase():""},Tm=e=>{if(typeof e!="string")return"";const t=e.trim();return t?t.toLowerCase():""},Wc=e=>{const t=e??{},n=x8(t.id),r=Wb(t.email);return{id:n,email:r,name:typeof t.name=="string"?t.name:"",hasId:n.length>0,hasEmail:r.length>0}},DS=({current:e,other:t})=>{const n=Wc(e),r=Wc(t);return n.hasId&&r.hasId?n.id===r.id:n.hasEmail&&r.hasEmail?n.email===r.email:!1},xm=({actor:e,fallbackKey:t=""})=>{const n=Wc(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 R8(e){return typeof e.captureStackTrace=="function"}var Rm=class extends Error{constructor(e,t){super(e),this.cause=t,this.name="FileObjectError",R8(Error)&&Error.captureStackTrace(this,this.constructor)}},M8=class extends Rm{constructor(e){super("Invalid data URI format: URI must contain exactly one comma separator"),this.uri=e,this.name="InvalidDataUriError"}},L8=class extends Rm{constructor(e,t){super(`Failed to fetch file from URL: ${e}`,t),this.url=e,this.name="FetchFailedError"}},Kb=async(e,t,n,r)=>{try{if(e.startsWith("data:")&&e.includes(";base64,")){const s=e.split(",");if(s.length!==2)throw new M8(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 Rm?o:new Rm("Failed to create file object",o)}};function O8(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 Mm=new WeakMap;function PS(e){return e.ownerDocument??document}function FS(e,t){const n=Mm.get(t);n?.bindings.delete(e),n&&n.bindings.size===0&&(t.removeEventListener("click",n.listener),Mm.delete(t))}function NS(e,t){const n=PS(e);e.__clickOutsideDocument&&e.__clickOutsideDocument!==n&&FS(e,e.__clickOutsideDocument);let r=Mm.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},Mm.set(n,r),n.addEventListener("click",i)}r.bindings.set(e,t),e.__clickOutsideHandler=r.listener,e.__clickOutsideDocument=n}var qb={mounted(e,t){NS(e,t)},updated(e,t){NS(e,t)},unmounted(e){FS(e,e.__clickOutsideDocument??PS(e)),delete e.__clickOutsideHandler,delete e.__clickOutsideDocument}},D8="https://ingest.superdoc.dev/v1/collect",pZ="community-and-eval-agplv3";function P8(){try{return"2.28.0-next.9"}catch{return"unknown"}}var F8=class{constructor(e){this.enabled=e.enabled,this.endpoint=e.endpoint||D8,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{}}};Wt();var N8=vw(E8(),1),Lm={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"},mZ=[Lm.INLINE_SDT_LABEL,Lm.BLOCK_SDT_LABEL],BS={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"},B8=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"}}},gZ=`.${Lm.BLOCK_SDT}[${BS.SDT_ID}]`,vZ=`[${BS.DRAGGABLE}="true"]`,z8=typeof window<"u",zS,yh=e=>zS=e,VS=Symbol();function Yb(e){return e&&typeof e=="object"&&Object.prototype.toString.call(e)==="[object Object]"&&typeof e.toJSON!="function"}var bh;(function(e){e.direct="direct",e.patchObject="patch object",e.patchFunction="patch function"})(bh||(bh={}));var jS=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 V8(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 Xb(e,t,n){const r=new XMLHttpRequest;r.open("GET",e),r.responseType="blob",r.onload=function(){j8(r.response,t,n)},r.onerror=function(){console.error("could not download file")},r.send()}function US(e){const t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch{}return t.status>=200&&t.status<=299}function Om(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 Dm=typeof navigator=="object"?navigator:{userAgent:""},$S=/Macintosh/.test(Dm.userAgent)&&/AppleWebKit/.test(Dm.userAgent)&&!/Safari/.test(Dm.userAgent),j8=z8?typeof HTMLAnchorElement<"u"&&"download"in HTMLAnchorElement.prototype&&!$S?U8:"msSaveOrOpenBlob"in Dm?$8:H8:()=>{};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?US(r.href)?Xb(e,t,n):(r.target="_blank",Om(r)):Om(r)):(r.href=URL.createObjectURL(e),setTimeout(function(){URL.revokeObjectURL(r.href)},4e4),setTimeout(function(){Om(r)},0))}function $8(e,t="download",n){if(typeof e=="string")if(US(e))Xb(e,t,n);else{const r=document.createElement("a");r.href=e,r.target="_blank",setTimeout(function(){Om(r)})}else navigator.msSaveOrOpenBlob(V8(e,n),t)}function H8(e,t,n,r){if(r=r||open("","_blank"),r&&(r.document.title=r.document.body.innerText="downloading..."),typeof e=="string")return Xb(e,t,n);const o=e.type==="application/octet-stream",i=/constructor/i.test(String(jS.HTMLElement))||"safari"in jS,s=/CriOS\/[\d]+/.test(navigator.userAgent);if((s||o&&i||$S)&&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:yZ}=Object;function G8(){const e=ny(!0),t=e.run(()=>oe({}));let n=[],r=[];const o=Wo({install(i){yh(o),o._a=i,i.provide(VS,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 HS=()=>{};function GS(e,t,n,r=HS){e.add(t);const o=()=>{e.delete(t)&&r()};return!n&&ry()&&Fw(o),o}function ld(e,...t){e.forEach(n=>{n(...t)})}var W8=e=>e(),WS=Symbol(),Zb=Symbol();function Qb(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];Yb(o)&&Yb(r)&&e.hasOwnProperty(n)&&!Or(r)&&!Ti(r)?e[n]=Qb(o,r):e[n]=r}return e}var K8=Symbol();function q8(e){return!Yb(e)||!Object.prototype.hasOwnProperty.call(e,K8)}var{assign:Gl}=Object;function Y8(e){return!!(Or(e)&&e.effect)}function X8(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=Kw(n.state.value[e]);return Gl(d,i,Object.keys(s||{}).reduce((f,p)=>(f[p]=Wo(ke(()=>{yh(n);const g=n._s.get(e);return s[p].call(g,g)})),f),{}))}return l=KS(e,u,t,n,r,!0),l}function KS(e,t,n={},r,o,i){let s;const a=Gl({actions:{}},n),l={deep:!0};let u,d,f=new Set,p=new Set,g;const v=r.state.value[e];!i&&!v&&(r.state.value[e]={});let y;function _(D){let P;u=d=!1,typeof D=="function"?(D(r.state.value[e]),P={type:bh.patchFunction,storeId:e,events:g}):(Qb(r.state.value[e],D),P={type:bh.patchObject,payload:D,storeId:e,events:g});const W=y=Symbol();Tt().then(()=>{y===W&&(u=!0)}),d=!0,ld(f,P,r.state.value[e])}const w=i?function(){const{state:P}=n,W=P?P():{};this.$patch(N=>{Gl(N,W)})}:HS;function E(){s.stop(),f.clear(),p.clear(),r._s.delete(e)}const k=(D,P="")=>{if(WS in D)return D[Zb]=P,D;const W=function(){yh(r);const N=Array.from(arguments),L=new Set,j=new Set;function M(re){L.add(re)}function B(re){j.add(re)}ld(p,{args:N,name:W[Zb],store:C,after:M,onError:B});let R;try{R=D.apply(this&&this.$id===e?this:C,N)}catch(re){throw ld(j,re),re}return R instanceof Promise?R.then(re=>(ld(L,re),re)).catch(re=>(ld(j,re),Promise.reject(re))):(ld(L,R),R)};return W[WS]=!0,W[Zb]=P,W},C=ho({_p:r,$id:e,$onAction:GS.bind(null,p),$patch:_,$reset:w,$subscribe(D,P={}){const W=GS(f,D,P.detached,()=>N()),N=s.run(()=>Kt(()=>r.state.value[e],L=>{(P.flush==="sync"?d:u)&&D({storeId:e,type:bh.direct,events:g},L)},Gl({},l,P)));return W},$dispose:E});r._s.set(e,C);const x=(r._a&&r._a.runWithContext||W8)(()=>r._e.run(()=>(s=ny()).run(()=>t({action:k}))));for(const D in x){const P=x[D];Or(P)&&!Y8(P)||Ti(P)?i||(v&&q8(P)&&(Or(P)?P.value=v[D]:Qb(P,v[D])),r.state.value[e][D]=P):typeof P=="function"&&(x[D]=k(P,D),a.actions[D]=P)}return Gl(C,x),Gl(Bn(C),x),Object.defineProperty(C,"$state",{get:()=>r.state.value[e],set:D=>{_(P=>{Gl(P,D)})}}),r._p.forEach(D=>{Gl(C,s.run(()=>D({store:C,app:r._a,pinia:r,options:a})))}),v&&i&&n.hydrate&&n.hydrate(C.$state,v),u=!0,d=!0,C}function qS(e,t,n){let r;const o=typeof t=="function";r=o?n:t;function i(s,a){const l=wC();return s=s||(l?ea(VS,null):null),s&&yh(s),s=zS,s._s.has(e)||(o?KS(e,t,r,s):X8(e,r,s)),s._s.get(e)}return i.$id=e,i}function aa(e){const t=Bn(e),n={};for(const r in t){const o=t[r];o.effect?n[r]=ke({get:()=>e[r],set(i){e[r]=i}}):(Or(o)||Ti(o))&&(n[r]=dy(e,r))}return n}var YS=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 Z8(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((g,v)=>{s=v});u.catch(()=>{});const d=()=>{i!==void 0&&clearTimeout(i),e.signal?.removeEventListener("abort",p)},f=g=>{if(!(r||o)){o=new YS(g,t),d(),n.abort(o),s(o);for(const v of l)v();l.clear();for(const v of[...a])v(o);a.clear()}},p=()=>f("DOCUMENT_LOAD_CANCELLED");return e.timeoutMs!==void 0&&(i=setTimeout(()=>f("DOCUMENT_LOAD_TIMEOUT"),e.timeoutMs)),e.signal?.addEventListener("abort",p,{once:!0}),e.signal?.aborted&&p(),{signal:n.signal,wait(g){return o?Promise.reject(o):Promise.race([u,g])},assertActive(){if(o)throw o},finish(){if(o)return!1;r=!0,d(),a.clear();for(const g of l)g();return l.clear(),!0},cancel:p,onSettled(g){r||o?g():l.add(g)},onFailure(g){return o?g(o):r||a.add(g),()=>a.delete(g)}}}function XS(e){return e.collaboration!==void 0?e.collaboration:e.v2Collaboration}function ZS(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 Kc(e){return typeof e=="string"&&e.length>0?e:null}function Q8(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 J8(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 eR(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 Jb(e){return e===void 0?"join":e==="join"||e==="create"?e:null}function tR(e){if(e!==void 0)return typeof e=="number"&&Number.isFinite(e)&&e>0&&e<=2147483647?e:null}function Pm(e,t){return!e.ok||t===void 0?e:{ok:!0,target:{...e.target,syncTimeoutMs:t}}}function e0(){return{ok:!1,reason:"invalid-room-mode",message:'SuperDoc v2 collaboration roomMode must be either "join" or "create".'}}function nR(e){const t=e.providerType;return typeof t=="string"&&t.length>0?t.toLowerCase():null}function rR(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 QS(e,t){const n=Kc(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=Q8(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: ${ZS(r)}).`};const i=eR(t.params),s=e==="hocuspocus"&&typeof t.token=="function"?t.token:e==="hocuspocus"?Kc(t.token):null,a=Jb(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}:{}}}:e0()}function oR(e){const t=Kc(e.adapterId);if(!t)return{ok:!1,reason:"invalid-adapter-id",message:"SuperDoc v2 provider extensions require a non-empty collaboration.adapterId."};const n=Kc(e.documentId);if(!n)return{ok:!1,reason:"invalid-document-id",message:"SuperDoc v2 provider extensions require a non-empty collaboration.documentId."};const r=Jb(e.roomMode);if(!r)return e0();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:Kc(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 iR(e,t){const n=Kc(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=Kc(e.publicApiKey),o=Jb(e.roomMode);if(!o)return e0();const i=e.authEndpoint,s=typeof i=="string"&&i.length>0;if(!r&&!s)return{ok:!1,reason:"missing-auth",message:"SuperDoc v2 Liveblocks collaboration requires exactly one auth mode: a publicApiKey or an authEndpoint. None was provided."};if(r&&s)return{ok:!1,reason:"mixed-auth",message:"SuperDoc v2 Liveblocks collaboration accepts exactly one auth mode; pass either publicApiKey or authEndpoint, not both."};if(r)return{ok:!0,target:{providerFamily:"liveblocks",documentId:n,roomMode:o,publicApiKey:r}};const a=J8(i,t);return a?{ok:!0,target:{providerFamily:"liveblocks",documentId:n,roomMode:o,authEndpoint:a}}:{ok:!1,reason:"invalid-auth-endpoint",message:"SuperDoc v2 Liveblocks collaboration requires a valid http(s) authEndpoint URL (received: <redacted>)."}}function JS(e){const{legacyCollaboration:t,documentType:n,documentCount:r,authEndpointBaseUrl:o}=e,i=XS(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=rR(t);if(u){const d=u==="external-ydoc-provider"?"unsupported-legacy-provider":"unsupported-provider-family",f=ZS(t?.url);return{ok:!1,reason:d,message:u==="external-ydoc-provider"?"SuperDoc v2 collaboration cannot use an external { ydoc, provider } pair. Provide a collaboration target (e.g. { providerType, documentId, url }) instead.":`SuperDoc v2 collaboration does not accept "${u}" through the legacy modules.collaboration block (server: ${f}). Configure it as a document.collaboration target ({ providerType: "${u}", documentId, ... }) instead.`}}return{ok:!1,reason:"missing-target",message:"SuperDoc v2 collaboration requires a collaboration target ({ documentId, serverUrl } or { providerType, ... }). None was provided."}}const s=i;if(Object.prototype.hasOwnProperty.call(s,"createIfMissing"))return{ok:!1,reason:"invalid-room-mode",message:'SuperDoc v2 collaboration createIfMissing has been removed. Use roomMode: "create" for creation or roomMode: "join" for normal opens.'};if(s.ydoc!=null||s.provider!=null)return{ok:!1,reason:"unsupported-legacy-provider",message:"SuperDoc v2 collaboration cannot use an external { ydoc, provider } pair. v2 owns its provider; pass a collaboration target ({ providerType, documentId, serverUrl | publicApiKey | authEndpoint }) instead."};const a=tR(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=nR(s);return l===null||l==="y-websocket"?Pm(QS("y-websocket",s),a):l==="hocuspocus"?Pm(QS("hocuspocus",s),a):l==="liveblocks"?Pm(iR(s,o),a):l==="extension"?Pm(oR(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 wh=(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?wh(e.originFileObj,e.name||t):e.file?wh(e.file,e.name||t):e.raw?wh(e.raw,e.name||t):null},e3=Object.getOwnPropertyDescriptor(ArrayBuffer.prototype,"byteLength")?.get,sR=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Uint8Array.prototype),Symbol.toStringTag)?.get,Wl=e=>{if(ArrayBuffer.isView(e))return sR?.call(e)==="Uint8Array";if(!e3)return!1;try{return e3.call(e),!0}catch{return!1}},t0=e=>{if(e instanceof Uint8Array)return e;const t=ArrayBuffer.isView(e)?e:new Uint8Array(e);return Uint8Array.from(t)},n0=(e,t)=>new Blob([t0(e)],{type:t}),r0=e=>{switch(e.toLowerCase()){case"docx":case jr:return jr;case"pdf":case Qa:return Qa;case"html":case vh:return vh;default:return e}},Fm=(e="")=>{const t=String(e).toLowerCase();return t.endsWith(".docx")?jr:t.endsWith(".pdf")?Qa:t.endsWith(".html")||t.endsWith(".htm")?vh:t.endsWith(".md")||t.endsWith(".markdown")?"text/markdown":""},aR=e=>e==="application/vnd.openxmlformats-officedocument.wordprocessingml.document"?"document.docx":e==="application/pdf"?"document.pdf":e==="text/html"?"document.html":"document",lR="application/octet-stream",o0=e=>{if(e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"collaboration")){const n={...e};delete n.collaboration,e={...n,v2Collaboration:XS(e)}}if(Wl(e))return{type:jr,data:t0(e),name:"document.docx"};const t=wh(e);if(t){const n=e&&typeof e.name=="string"?e.name:"",r=t.name||"",o=Fm(n),i=o||Fm(r),s=t.type.toLowerCase()===lR,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(Wl(e.data)){const r=r0(e.type||Fm(e.name)||"application/vnd.openxmlformats-officedocument.wordprocessingml.document");return{...e,type:r,data:r==="application/vnd.openxmlformats-officedocument.wordprocessingml.document"?t0(e.data):n0(e.data,r),name:e.name||aR(r)}}const n=wh(e.data,e.name);if(n){const r=typeof e.type=="string"&&e.type?r0(e.type):"",o=r||n.type||Fm(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=r0(e.type);if(n!==e.type)return{...e,type:n}}return e};Wt();function cR(e,t){const n=e.itemid,r=e,o=t!==null&&typeof t=="object"?ho({...t}):oe(t),i=oe(null);return Kt(o,(a,l)=>{const u={fieldId:n.value,changeTime:Date.now(),oldValue:l,newValue:a,originalField:r};i.value=u}),{value:o}}function uR(e){const t=oe(e.itemid),n=oe(e.itemicon),r=oe(e.itemiconpack),o=oe(e.itemdisplaylabel),i=e.itemlinkvalue,s=e.itemplaceholdertext,{value:a}=cR(e,i,oe([])),l=oe(e.itemtype),u=oe(e.itemfieldtype),d=e,f=ho({fontFamily:e.fontfamily||"Arial",fontSize:e.font_size||"12pt",originalFontSize:e.original_font_size||"12pt"}),p=oe(e.logicrules),g=oe(!1),v=ho({}),y={SELECT:fR,IMAGEINPUT:dR,CHECKBOXINPUT:hR};return l.value in y&&Object.assign(v,y[l.value](e)),{id:t,icon:n,iconPack:r,label:o,placeholder:s,fieldType:l,fieldSubType:u,value:a,format:oe(e.itemformat),logicRules:p,hidden:g,originalJSON:d,fieldStyle:f,valueGetter:e.valueGetter,...v}}function dR(e){return{fontfamily:oe(e.fontfamily),iteminputtype:oe(e.iteminputtype)}}function fR(e){return{options:oe(e.itemoptions)}}function hR(e){const t=oe(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 la=()=>new Map,i0=e=>{const t=la();return e.forEach((n,r)=>{t.set(r,n)}),t},cd=(e,t,n)=>{let r=e.get(t);return r===void 0&&e.set(t,r=n()),r},pR=(e,t)=>{const n=[];for(const[r,o]of e)n.push(t(o,r));return n},mR=(e,t)=>{for(const[n,r]of e)if(t(r,n))return!0;return!1},ud=()=>new Set,s0=e=>e[e.length-1],dd=Array.from,a0=(e,t)=>{for(let n=0;n<e.length;n++)if(!t(e[n],n,e))return!1;return!0},t3=(e,t)=>{for(let n=0;n<e.length;n++)if(t(e[n],n,e))return!0;return!1},gR=(e,t)=>{const n=new Array(e);for(let r=0;r<e;r++)n[r]=t(r,n);return n},Nm=Array.isArray,vR=class{constructor(){this._observers=la()}on(e,t){return cd(this._observers,e,ud).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 dd((this._observers.get(e)||la()).values()).forEach(n=>n(...t))}destroy(){this._observers=la()}},Ja=Math.floor,Bm=Math.abs,n3=(e,t)=>e<t?e:t,fd=(e,t)=>e>t?e:t,bZ=Number.isNaN,yR=e=>e!==0?e<0:1/e<0,wZ=1,CZ=2,kZ=4,SZ=8,_Z=32,AZ=64,IZ=128,bR=1<<17,wR=1<<18,CR=1<<19,kR=1<<20,SR=1<<21,_R=1<<22,AR=1<<23,IR=1<<24,ER=1<<25,TR=1<<26,xR=1<<27,RR=1<<28,MR=1<<29,LR=1<<30,EZ=31,TZ=63,xZ=127,RZ=bR-1,MZ=wR-1,LZ=CR-1,OZ=kR-1,DZ=SR-1,PZ=_R-1,FZ=AR-1,NZ=IR-1,BZ=ER-1,zZ=TR-1,VZ=xR-1,jZ=RR-1,UZ=MR-1,$Z=LR-1,HZ=2147483647,r3=Number.MAX_SAFE_INTEGER,o3=Number.MIN_SAFE_INTEGER,OR=Number.isInteger||(e=>typeof e=="number"&&isFinite(e)&&Ja(e)===e),GZ=Number.isNaN,WZ=Number.parseInt,i3=String.fromCharCode,KZ=String.fromCodePoint,qZ=i3(65535),DR=e=>e.toLowerCase(),PR=/^\s*/g,FR=e=>e.replace(PR,""),NR=/([A-Z])/g,s3=(e,t)=>FR(e.replace(NR,n=>`${t}${DR(n)}`)),BR=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},Ch=typeof TextEncoder<"u"?new TextEncoder:null,zR=e=>Ch.encode(e),VR=Ch?zR:BR,l0=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});l0&&l0.decode(new Uint8Array).length===1&&(l0=null);var jR=(e,t)=>gR(t,()=>e).join(""),kh=class{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}},c0=()=>new kh,UR=e=>{let t=e.cpos;for(let n=0;n<e.bufs.length;n++)t+=e.bufs[n].length;return t},el=e=>{const t=new Uint8Array(UR(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},$R=(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(fd(n,t)*2),e.cpos=0)},Do=(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},u0=Do,Cr=(e,t)=>{for(;t>127;)Do(e,128|127&t),t=Ja(t/128);Do(e,127&t)},d0=(e,t)=>{const n=yR(t);for(n&&(t=-t),Do(e,(t>63?128:0)|(n?64:0)|63&t),t=Ja(t/64);t>0;)Do(e,(t>127?128:0)|127&t),t=Ja(t/128)},f0=new Uint8Array(3e4),HR=f0.length/3,GR=(e,t)=>{if(t.length<HR){const n=Ch.encodeInto(t,f0).written||0;Cr(e,n);for(let r=0;r<n;r++)Do(e,f0[r])}else Gi(e,VR(t))},WR=(e,t)=>{const n=unescape(encodeURIComponent(t)),r=n.length;Cr(e,r);for(let o=0;o<r;o++)Do(e,n.codePointAt(o))},hd=Ch&&Ch.encodeInto?GR:WR,h0=(e,t)=>{const n=e.cbuf.length,r=e.cpos,o=n3(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(fd(n*2,i)),e.cbuf.set(t.subarray(o)),e.cpos=i)},Gi=(e,t)=>{Cr(e,t.byteLength),h0(e,t)},p0=(e,t)=>{$R(e,t);const n=new DataView(e.cbuf.buffer,e.cpos,t);return e.cpos+=t,n},KR=(e,t)=>p0(e,4).setFloat32(0,t,!1),qR=(e,t)=>p0(e,8).setFloat64(0,t,!1),YR=(e,t)=>p0(e,8).setBigInt64(0,t,!1),a3=new DataView(new ArrayBuffer(4)),XR=e=>(a3.setFloat32(0,e),a3.getFloat32(0)===e),Sh=(e,t)=>{switch(typeof t){case"string":Do(e,119),hd(e,t);break;case"number":OR(t)&&Bm(t)<=2147483647?(Do(e,125),d0(e,t)):XR(t)?(Do(e,124),KR(e,t)):(Do(e,123),qR(e,t));break;case"bigint":Do(e,122),YR(e,t);break;case"object":if(t===null)Do(e,126);else if(Nm(t)){Do(e,117),Cr(e,t.length);for(let n=0;n<t.length;n++)Sh(e,t[n])}else if(t instanceof Uint8Array)Do(e,116),Gi(e,t);else{Do(e,118);const n=Object.keys(t);Cr(e,n.length);for(let r=0;r<n.length;r++){const o=n[r];hd(e,o),Sh(e,t[o])}}break;case"boolean":Do(e,t?120:121);break;default:Do(e,127)}},l3=class extends kh{constructor(e){super(),this.w=e,this.s=null,this.count=0}write(e){this.s===e?this.count++:(this.count>0&&Cr(this,this.count-1),this.count=1,this.w(this,e),this.s=e)}},c3=e=>{e.count>0&&(d0(e.encoder,e.count===1?e.s:-e.s),e.count>1&&Cr(e.encoder,e.count-2))},zm=class{constructor(){this.encoder=new kh,this.s=0,this.count=0}write(e){this.s===e?this.count++:(c3(this),this.count=1,this.s=e)}toUint8Array(){return c3(this),el(this.encoder)}},u3=e=>{if(e.count>0){const t=e.diff*2+(e.count===1?0:1);d0(e.encoder,t),e.count>1&&Cr(e.encoder,e.count-2)}},m0=class{constructor(){this.encoder=new kh,this.s=0,this.count=0,this.diff=0}write(e){this.diff===e-this.s?(this.s=e,this.count++):(u3(this),this.count=1,this.diff=e-this.s,this.s=e)}toUint8Array(){return u3(this),el(this.encoder)}},ZR=class{constructor(){this.sarr=[],this.s="",this.lensE=new zm}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 kh;return this.sarr.push(this.s),this.s="",hd(e,this.sarr.join("")),h0(e,this.lensE.toUint8Array()),el(e)}},Kl=e=>new Error(e),Is=()=>{throw Kl("Method unimplemented")},tl=()=>{throw Kl("Unexpected case")},YZ=crypto.subtle,QR=crypto.getRandomValues.bind(crypto),d3=()=>QR(new Uint32Array(1))[0],JR="10000000-1000-4000-8000-100000000000",e7=()=>JR.replace(/[018]/g,e=>(e^d3()&15>>e/4).toString(16)),t7=Date.now,f3=e=>new Promise(e),XZ=Promise.all.bind(Promise),h3=e=>e===void 0?null:e,n7=class{constructor(){this.map=new Map}setItem(e,t){this.map.set(e,t)}getItem(e){return this.map.get(e)}},p3=new n7,r7=!0;try{typeof localStorage<"u"&&localStorage&&(p3=localStorage,r7=!1)}catch{}var o7=p3,_h=Symbol("Equality"),m3=(e,t)=>e===t||!!e?.[_h]?.(t)||!1,i7=e=>typeof e=="object",s7=Object.assign,a7=Object.keys,l7=(e,t)=>{for(const n in e)t(e[n],n)},Vm=e=>a7(e).length,c7=e=>{for(const t in e)return!1;return!0},Ah=(e,t)=>{for(const n in e)if(!t(e[n],n))return!1;return!0},g0=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),u7=(e,t)=>e===t||Vm(e)===Vm(t)&&Ah(e,(n,r)=>(n!==void 0||g0(t,r))&&m3(t[r],n)),d7=Object.freeze,g3=e=>{for(const t in e){const n=e[t];(typeof n=="object"||typeof n=="function")&&g3(e[t])}return d7(e)},v0=(e,t,n=0)=>{try{for(;n<e.length;n++)e[n](...t)}finally{n<e.length&&v0(e,t,n+1)}},jm=(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[_h]!=null)return e[_h](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)||!jm(e.get(n),t.get(n)))return!1;break;case void 0:case Object:if(Vm(e)!==Vm(t))return!1;for(const n in e)if(!g0(e,n)||!jm(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(!jm(e[n],t[n]))return!1;break;default:return!1}return!0},f7=(e,t)=>t.includes(e),Ih=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]",ZZ=typeof navigator<"u"?/Mac/.test(navigator.platform):!1,ca,h7=[],p7=()=>{if(ca===void 0)if(Ih){ca=la();const e=process.argv;let t=null;for(let n=0;n<e.length;n++){const r=e[n];r[0]==="-"?(t!==null&&ca.set(t,""),t=r):t!==null?(ca.set(t,r),t=null):h7.push(r)}t!==null&&ca.set(t,"")}else typeof location=="object"?(ca=la(),(location.search||"?").slice(1).split("&").forEach(e=>{if(e.length!==0){const[t,n]=e.split("=");ca.set(`--${s3(t,"-")}`,n),ca.set(`-${s3(t,"-")}`,n)}})):ca=la();return ca},y0=e=>p7().has(e),Um=e=>h3(Ih?process.env[e.toUpperCase().replaceAll("-","_")]:o7.getItem(e)),v3=e=>y0("--"+e)||Um(e)!==null,m7=v3("production"),g7=Ih&&f7(process.env.FORCE_COLOR,["true","1","2"]),v7=g7||!y0("--no-colors")&&!v3("no-color")&&(!Ih||process.stdout.isTTY)&&(!Ih||y0("--color")||Um("COLORTERM")!==null||(Um("TERM")||"").includes("color")),y7=class{constructor(e,t){this.left=e,this.right=t}},nl=(e,t)=>new y7(e,t),y3=e=>e.next()>=.5,b0=(e,t,n)=>Ja(e.next()*(n+1-t)+t),b3=(e,t,n)=>Ja(e.next()*(n+1-t)+t),w0=(e,t,n)=>b3(e,t,n),b7=e=>i3(w0(e,97,122)),w7=(e,t=0,n=20)=>{const r=w0(e,t,n);let o="";for(let i=0;i<r;i++)o+=b7(e);return o},C0=(e,t)=>t[w0(e,0,t.length-1)],C7=Symbol("0schema"),k7=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(jR(" ",(this._rerrs.length-t)*2)+`${n.path!=null?`[${n.path}] `:""}${n.has} doesn't match ${n.expected}. ${n.message}`)}return e.join(`
|
|
5
5
|
`)}},k0=(e,t)=>e===t?!0:e==null||t==null||e.constructor!==t.constructor?!1:e[_h]?m3(e,t):Nm(e)?a0(e,n=>t3(t,r=>k0(n,r))):i7(e)?Ah(e,(n,r)=>k0(n,t[r])):!1,bi=class{static _dilutes=!1;extends(e){let[t,n]=[this.shape,e.shape];return this.constructor._dilutes&&([n,t]=[t,n]),k0(t,n)}equals(e){return this.constructor===e.constructor&&jm(this.shape,e.shape)}[C7](){return!0}[_h](e){return this.equals(e)}validate(e){return this.check(e)}check(e,t){Is()}get nullable(){return pd(this,qm)}get optional(){return new k3(this)}cast(e){return F3(e,this),e}expect(e){return F3(e,this),e}},S0=class extends bi{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}},po=(e,t=null)=>new S0(e,t),QZ=po(S0),_0=class extends bi{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}},Po=e=>new _0(e),JZ=po(_0),$m=class extends bi{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}},Hm=(...e)=>new $m(e),w3=po($m),S7=RegExp.escape||(e=>e.replace(/[().|&,$^[\]]/g,t=>"\\"+t)),C3=e=>{if(gd.check(e))return[S7(e)];if(w3.check(e))return e.shape.map(t=>t+"");if(O3.check(e))return["[+-]?\\d+.?\\d*"];if(D3.check(e))return[".*"];if(Gm.check(e))return e.shape.map(C3).flat(1);tl()},_7=class extends bi{constructor(e){super(),this.shape=e,this._r=new RegExp("^"+e.map(C3).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}},eQ=po(_7),A7=Symbol("optional"),k3=class extends bi{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[A7](){return!0}},I7=po(k3),S3=class extends bi{check(e,t){return t?.extend(null,"never",typeof e),!1}},tQ=new S3,nQ=po(S3),_3=class Qx extends bi{constructor(t,n=!1){super(),this.shape=t,this._isPartial=n}static _dilutes=!0;get partial(){return new Qx(this.shape,!0)}check(t,n){return t==null?(n?.extend(null,"object","null"),!1):Ah(this.shape,(r,o)=>{const i=this._isPartial&&!g0(t,o)||r.check(t[o],n);return!i&&n?.extend(o.toString(),r.toString(),typeof t[o],"Object property does not match"),i})}},E7=e=>new _3(e),T7=po(_3),x7=Po(e=>e!=null&&(e.constructor===Object||e.constructor==null)),A3=class extends bi{constructor(e,t){super(),this.shape={keys:e,values:t}}check(e,t){return e!=null&&Ah(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)})}},I3=(e,t)=>new A3(e,t),R7=po(A3),E3=class extends bi{constructor(e){super(),this.shape=e}check(e,t){return e!=null&&Ah(this.shape,(n,r)=>{const o=n.check(e[r],t);return!o&&t?.extend(r.toString(),"Tuple",typeof n),o})}},M7=(...e)=>new E3(e),rQ=po(E3),T3=class extends bi{constructor(e){super(),this.shape=e.length===1?e[0]:new A0(e)}check(e,t){const n=Nm(e)&&a0(e,r=>this.shape.check(r));return!n&&t?.extend(null,"Array",""),n}},x3=(...e)=>new T3(e),L7=po(T3),O7=Po(e=>Nm(e)),R3=class extends bi{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}},D7=(e,t=null)=>new R3(e,t),oQ=po(R3),P7=D7(bi),F7=class extends bi{constructor(e){super(),this.len=e.length-1,this.args=M7(...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}},N7=po(F7),B7=Po(e=>typeof e=="function"),z7=class extends bi{constructor(e){super(),this.shape=e}check(e,t){const n=a0(this.shape,r=>r.check(e,t));return!n&&t?.extend(null,"Intersectinon",typeof e),n}},iQ=po(z7,e=>e.shape.length>0),A0=class extends bi{static _dilutes=!0;constructor(e){super(),this.shape=e}check(e,t){const n=t3(this.shape,r=>r.check(e,t));return t?.extend(null,"Union",typeof e),n}},pd=(...e)=>e.findIndex(t=>Gm.check(t))>=0?pd(...e.map(t=>Eh(t)).map(t=>Gm.check(t)?t.shape:[t]).flat(1)):e.length===1?e[0]:new A0(e),Gm=po(A0),M3=()=>!0,Wm=Po(M3),V7=po(_0,e=>e.shape===M3),I0=Po(e=>typeof e=="bigint"),j7=Po(e=>e===I0),L3=Po(e=>typeof e=="symbol"),sQ=Po(e=>e===L3),md=Po(e=>typeof e=="number"),O3=Po(e=>e===md),gd=Po(e=>typeof e=="string"),D3=Po(e=>e===gd),Km=Po(e=>typeof e=="boolean"),U7=Po(e=>e===Km),P3=Hm(void 0),aQ=po($m,e=>e.shape.length===1&&e.shape[0]===void 0),lQ=Hm(void 0),qm=Hm(null),$7=po($m,e=>e.shape.length===1&&e.shape[0]===null),cQ=po(Uint8Array),uQ=po(S0,e=>e.shape===Uint8Array),H7=pd(md,gd,qm,P3,I0,Km,L3),dQ=(()=>{const e=x3(Wm),t=I3(gd,Wm),n=pd(md,gd,qm,Km,e,t);return e.shape=n,t.shape.values=n,n})(),Eh=e=>{if(P7.check(e))return e;if(x7.check(e)){const t={};for(const n in e)t[n]=Eh(e[n]);return E7(t)}else{if(O7.check(e))return pd(...e.map(Eh));if(H7.check(e))return Hm(e);if(B7.check(e))return po(e)}tl()},F3=m7?()=>{}:(e,t)=>{const n=new k7;if(!t.check(e,n))throw Kl(`Expected value to be of type ${t.constructor.name}.
|
|
6
6
|
${n.toString()}`)},G7=class{constructor(e){this.patterns=[],this.$state=e}if(e,t){return this.patterns.push({if:Eh(e),h:t}),this}else(e){return this.if(Wm,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 Kl("Unhandled pattern")}}},W7=e=>new G7(e),N3=W7(Wm).if(O3,(e,t)=>b0(t,o3,r3)).if(D3,(e,t)=>w7(t)).if(U7,(e,t)=>y3(t)).if(j7,(e,t)=>BigInt(b0(t,o3,r3))).if(Gm,(e,t)=>vd(t,C0(t,e.shape))).if(T7,(e,t)=>{const n={};for(const r in e.shape){let o=e.shape[r];if(I7.check(o)){if(y3(t))continue;o=o.shape}n[r]=N3(o,t)}return n}).if(L7,(e,t)=>{const n=[],r=b3(t,0,42);for(let o=0;o<r;o++)n.push(vd(t,e.shape));return n}).if(w3,(e,t)=>C0(t,e.shape)).if($7,(e,t)=>null).if(N7,(e,t)=>{const n=vd(t,e.res);return()=>n}).if(V7,(e,t)=>vd(t,C0(t,[md,gd,qm,P3,I0,Km,x3(md),I3(pd("a","b","c"),md)]))).if(R7,(e,t)=>{const n={},r=b0(t,0,3);for(let o=0;o<r;o++){const i=vd(t,e.shape.keys);n[i]=vd(t,e.shape.values)}return n}).done(),vd=(e,t)=>N3(Eh(t),e),qc=typeof document<"u"?document:{},fQ=Po(e=>e.nodeType===Z7),hQ=typeof DOMParser<"u"?new DOMParser:null,pQ=Po(e=>e.nodeType===q7),mQ=Po(e=>e.nodeType===Y7),K7=e=>pR(e,(t,n)=>`${n}:${t};`).join(""),q7=qc.ELEMENT_NODE,Y7=qc.TEXT_NODE,gQ=qc.CDATA_SECTION_NODE,vQ=qc.COMMENT_NODE,X7=qc.DOCUMENT_NODE,yQ=qc.DOCUMENT_TYPE_NODE,Z7=qc.DOCUMENT_FRAGMENT_NODE,bQ=Po(e=>e.nodeType===X7),rl=Symbol,B3=rl(),z3=rl(),Q7=rl(),J7=rl(),eM=rl(),V3=rl(),tM=rl(),E0=rl(),nM=rl(),rM=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},wQ=t7(),oM={[B3]:nl("font-weight","bold"),[z3]:nl("font-weight","normal"),[Q7]:nl("color","blue"),[eM]:nl("color","green"),[J7]:nl("color","grey"),[V3]:nl("color","red"),[tM]:nl("color","purple"),[E0]:nl("color","orange"),[nM]:nl("color","black")},iM=e=>{e.length===1&&e[0]?.constructor===Function&&(e=e[0]());const t=[],n=[],r=la();let o=[],i=0;for(;i<e.length;i++){const s=e[i],a=oM[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=K7(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},j3=v7?iM:rM,sM=(...e)=>{console.log(...j3(e)),U3.forEach(t=>t.print(e))},aM=(...e)=>{console.warn(...j3(e)),e.unshift(E0),U3.forEach(t=>t.print(e))},U3=ud(),$3=e=>({[Symbol.iterator](){return this},next:e}),lM=(e,t)=>$3(()=>{let n;do n=e.next();while(!n.done&&!t(n.value));return n}),T0=(e,t)=>$3(()=>{const{done:n,value:r}=e.next();return{done:n,value:n?void 0:t(r)}}),H3=class{constructor(e,t){this.clock=e,this.len=t}},G3=class{constructor(){this.clients=new Map}},W3=(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])r_(e,i,u.clock,u.len,n)}}),cM=(e,t)=>{let n=0,r=e.length-1;for(;n<=r;){const o=Ja((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},K3=(e,t)=>{const n=e.clients.get(t.client);return n!==void 0&&cM(n,t.clock)!==null},q3=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 H3(o.clock,fd(o.len,i.clock+i.len-o.clock)):(r<n&&(t[r]=i),r++)}t.length=r})},Y3=(e,t,n,r)=>{cd(e.clients,t,()=>[]).push(new H3(n,r))},uM=()=>new G3,dM=(e,t)=>{Cr(e.restEncoder,t.clients.size),dd(t.clients.entries()).sort((n,r)=>r[0]-n[0]).forEach(([n,r])=>{e.resetDsCurVal(),Cr(e.restEncoder,n);const o=r.length;Cr(e.restEncoder,o);for(let i=0;i<o;i++){const s=r[i];e.writeDsClock(s.clock),e.writeDsLen(s.len)}})},X3=d3,x0=class Jx extends vR{constructor({guid:t=e7(),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=X3(),this.guid=t,this.collectionid=n,this.share=new Map,this.store=new SM,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=f3(u=>{this.on("load",()=>{this.isLoaded=!0,u(this)})});const l=()=>f3(u=>{const d=f=>{(f===void 0||f===!0)&&(this.off("sync",d),u())};this.on("sync",d)});this.on("sync",u=>{u===!1&&this.isSynced&&(this.whenSynced=l()),this.isSynced=u===void 0||u===!0,this.isSynced&&!this.isLoaded&&this.emit("load",[this])}),this.whenSynced=l()}load(){const t=this._item;t!==null&&!this.shouldLoad&&Dr(t.parent.doc,n=>{n.subdocsLoaded.add(this)},null,!0),this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(dd(this.subdocs).map(t=>t.guid))}transact(t,n=null){return Dr(this,t,n)}get(t,n=qo){const r=cd(this.share,t,()=>{const i=new n;return i._integrate(this,null),i}),o=r.constructor;if(n!==qo&&o!==n)if(o===qo){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,NM)}getText(t=""){return this.get(t,$M)}getMap(t=""){return this.get(t,N0)}getXmlElement(t=""){return this.get(t,I_)}getXmlFragment(t=""){return this.get(t,j0)}toJSON(){const t={};return this.share.forEach((n,r)=>{t[r]=n.toJSON()}),t}destroy(){this.isDestroyed=!0,dd(this.subdocs).forEach(n=>n.destroy());const t=this._item;if(t!==null){this._item=null;const n=t.content;n.doc=new Jx({guid:this.guid,...n.opts,shouldLoad:!1}),n.doc._item=t,Dr(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()}},fM=class{constructor(){this.restEncoder=c0()}toUint8Array(){return el(this.restEncoder)}resetDsCurVal(){}writeDsClock(e){Cr(this.restEncoder,e)}writeDsLen(e){Cr(this.restEncoder,e)}},hM=class extends fM{writeLeftID(e){Cr(this.restEncoder,e.client),Cr(this.restEncoder,e.clock)}writeRightID(e){Cr(this.restEncoder,e.client),Cr(this.restEncoder,e.clock)}writeClient(e){Cr(this.restEncoder,e)}writeInfo(e){u0(this.restEncoder,e)}writeString(e){hd(this.restEncoder,e)}writeParentInfo(e){Cr(this.restEncoder,e?1:0)}writeTypeRef(e){Cr(this.restEncoder,e)}writeLen(e){Cr(this.restEncoder,e)}writeAny(e){Sh(this.restEncoder,e)}writeBuf(e){Gi(this.restEncoder,e)}writeJSON(e){hd(this.restEncoder,JSON.stringify(e))}writeKey(e){hd(this.restEncoder,e)}},pM=class{constructor(){this.restEncoder=c0(),this.dsCurrVal=0}toUint8Array(){return el(this.restEncoder)}resetDsCurVal(){this.dsCurrVal=0}writeDsClock(e){const t=e-this.dsCurrVal;this.dsCurrVal=e,Cr(this.restEncoder,t)}writeDsLen(e){e===0&&tl(),Cr(this.restEncoder,e-1),this.dsCurrVal+=e}},mM=class extends pM{constructor(){super(),this.keyMap=new Map,this.keyClock=0,this.keyClockEncoder=new m0,this.clientEncoder=new zm,this.leftClockEncoder=new m0,this.rightClockEncoder=new m0,this.infoEncoder=new l3(u0),this.stringEncoder=new ZR,this.parentInfoEncoder=new l3(u0),this.typeRefEncoder=new zm,this.lenEncoder=new zm}toUint8Array(){const e=c0();return Cr(e,0),Gi(e,this.keyClockEncoder.toUint8Array()),Gi(e,this.clientEncoder.toUint8Array()),Gi(e,this.leftClockEncoder.toUint8Array()),Gi(e,this.rightClockEncoder.toUint8Array()),Gi(e,el(this.infoEncoder)),Gi(e,this.stringEncoder.toUint8Array()),Gi(e,el(this.parentInfoEncoder)),Gi(e,this.typeRefEncoder.toUint8Array()),Gi(e,this.lenEncoder.toUint8Array()),h0(e,el(this.restEncoder)),el(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){Sh(this.restEncoder,e)}writeBuf(e){Gi(this.restEncoder,e)}writeJSON(e){Sh(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)}},gM=(e,t,n,r)=>{r=fd(r,t[0].id.clock);const o=ol(t,r);Cr(e.restEncoder,t.length-o),e.writeClient(n),Cr(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)},vM=(e,t,n)=>{const r=new Map;n.forEach((o,i)=>{Li(t,i)>o&&r.set(i,o)}),M0(t).forEach((o,i)=>{n.has(i)||r.set(i,0)}),Cr(e.restEncoder,r.size),dd(r.entries()).sort((o,i)=>i[0]-o[0]).forEach(([o,i])=>{gM(e,t.clients.get(o),o,i)})},yM=(e,t)=>vM(e,t.doc.store,t.beforeState),bM=class{constructor(){this.l=[]}},Z3=()=>new bM,Q3=(e,t)=>e.l.push(t),J3=(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.")},e_=(e,t,n)=>v0(e.l,[t,n]),Ym=class{constructor(e,t){this.client=e,this.clock=t}},Xm=(e,t)=>e===t||e!==null&&t!==null&&e.client===t.client&&e.clock===t.clock,oo=(e,t)=>new Ym(e,t),wM=e=>{for(const[t,n]of e.doc.share.entries())if(n===e)return t;throw tl()},CM=class{constructor(e,t){this.ds=e,this.sv=t}},kM=(e,t)=>new CM(e,t),CQ=kM(uM(),new Map),yd=(e,t)=>t===void 0?!e.deleted:t.sv.has(e.id.client)&&(t.sv.get(e.id.client)||0)>e.id.clock&&!K3(t.ds,e.id),R0=(e,t)=>{const n=cd(e.meta,R0,ud),r=e.doc.store;n.has(t)||(t.sv.forEach((o,i)=>{o<Li(r,i)&&ql(e,oo(i,o))}),W3(e,t.ds,o=>{}),n.add(t))},SM=class{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}},M0=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},Li=(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},t_=(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 tl()}n.push(t)},ol=(e,t)=>{let n=0,r=e.length-1,o=e[r],i=o.id.clock;if(i===t)return r;let s=Ja(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=Ja((n+r)/2)}throw tl()},_M=(e,t)=>{const n=e.clients.get(t.client);return n[ol(n,t.clock)]},L0=_M,O0=(e,t,n)=>{const r=ol(t,n),o=t[r];return o.id.clock<n&&o instanceof Wi?(t.splice(r+1,0,R_(e,o,n-o.id.clock)),r+1):r},ql=(e,t)=>{const n=e.doc.store.clients.get(t.client);return n[O0(e,n,t.clock)]},n_=(e,t,n)=>{const r=t.clients.get(n.client),o=ol(r,n.clock),i=r[o];return n.clock!==i.id.clock+i.length-1&&i.constructor!==Xl&&r.splice(o+1,0,R_(e,i,n.clock-i.id.clock+1)),i},AM=(e,t,n)=>{const r=e.clients.get(t.id.client);r[ol(r,t.id.clock)]=n},r_=(e,t,n,r,o)=>{if(r===0)return;const i=n+r;let s=O0(e,t,n),a;do a=t[s++],i<a.id.clock+a.length&&O0(e,t,i),o(a);while(s<t.length&&t[s].id.clock<i)},IM=class{constructor(e,t,n){this.doc=e,this.deleteSet=new G3,this.beforeState=M0(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}},o_=(e,t)=>t.deleteSet.clients.size===0&&!mR(t.afterState,(n,r)=>t.beforeState.get(r)!==n)?!1:(q3(t.deleteSet),yM(e,t),dM(e,t.deleteSet),!0),i_=(e,t,n)=>{const r=t._item;(r===null||r.id.clock<(e.beforeState.get(r.id.client)||0)&&!r.deleted)&&cd(e.changed,t,ud).add(n)},Zm=(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 Wi&&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},EM=(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=ol(i,a.clock),d=i[u];u<i.length&&d.id.clock<l;d=i[++u]){const f=i[u];if(a.clock+a.len<=f.id.clock)break;f instanceof Wi&&f.deleted&&!f.keep&&n(f)&&f.gc(t,!1)}}}},TM=(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=n3(o.length-1,1+ol(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+Zm(o,l)}})},s_=(e,t)=>{if(t<e.length){const n=e[t],r=n.doc,o=r.store,i=n.deleteSet,s=n._mergeStructs;try{q3(i),n.afterState=M0(n.doc.store),r.emit("beforeObserverCalls",[n,r]);const a=[];n.changed.forEach((l,u)=>a.push(()=>{(u._item===null||!u._item.deleted)&&u._callObserver(n,l)})),a.push(()=>{n.changedParentTypes.forEach((l,u)=>{u._dEH.l.length>0&&(u._item===null||!u._item.deleted)&&(l=l.filter(d=>d.target._item===null||!d.target._item.deleted),l.forEach(d=>{d.currentTarget=u,d._path=null}),l.sort((d,f)=>d.path.length-f.path.length),a.push(()=>{e_(u._dEH,l,n)}))}),a.push(()=>r.emit("afterTransaction",[n,r])),a.push(()=>{n._needFormattingCleanup&&jM(n)})}),v0(a,[])}finally{r.gc&&EM(i,o,r.gcFilter),TM(i,o),n.afterState.forEach((d,f)=>{const p=n.beforeState.get(f)||0;if(p!==d){const g=o.clients.get(f),v=fd(ol(g,p),1);for(let y=g.length-1;y>=v;)y-=1+Zm(g,y)}});for(let d=s.length-1;d>=0;d--){const{client:f,clock:p}=s[d].id,g=o.clients.get(f),v=ol(g,p);v+1<g.length&&Zm(g,v+1)>1||v>0&&Zm(g,v)}if(!n.local&&n.afterState.get(r.clientID)!==n.beforeState.get(r.clientID)&&(sM(E0,B3,"[yjs] ",z3,V3,"Changed the client-id because another client seems to be using it."),r.clientID=X3()),r.emit("afterTransactionCleanup",[n,r]),r._observers.has("update")){const d=new hM;o_(d,n)&&r.emit("update",[d.toUint8Array(),n.origin,r,n])}if(r._observers.has("updateV2")){const d=new mM;o_(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])):s_(e,t+1)}}},Dr=(e,t,n=null,r=!0)=>{const o=e._transactionCleanups;let i=!1,s=null;e._transaction===null&&(i=!0,e._transaction=new IM(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&&s_(o,0)}}return s},a_="You must not compute changes after the event-handler fired.",Qm=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=xM(this.currentTarget,this.target))}deletes(e){return K3(this.transaction.deleteSet,e.id)}get keys(){if(this._keys===null){if(this.transaction.doc._transactionCleanups.length===0)throw Kl(a_);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=s0(s.content.getContent());else return;else s!==null&&this.deletes(s)?(o="update",i=s0(s.content.getContent())):(o="add",i=void 0)}else if(this.deletes(r))o="delete",i=s0(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 Kl(a_);const t=this.target,n=ud(),r=ud(),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}},xM=(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},oi=()=>{aM("Invalid access: Add Yjs type to a document before reading data.")},l_=80,D0=0,RM=class{constructor(e,t){e.marker=!0,this.p=e,this.index=t,this.timestamp=D0++}},MM=e=>{e.timestamp=D0++},c_=(e,t,n)=>{e.p.marker=!1,e.p=t,t.marker=!0,e.index=n,e.timestamp=D0++},LM=(e,t,n)=>{if(e.length>=l_){const r=e.reduce((o,i)=>o.timestamp<i.timestamp?o:i);return c_(r,t,n),r}else{const r=new RM(t,n);return e.push(r),r}},Jm=(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,MM(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/l_?(c_(n,r,o),n):LM(e._searchMarker,r,o)},Th=(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=fd(t,o.index+n))}},eg=(e,t,n)=>{const r=e,o=t.changedParentTypes;for(;cd(o,e,()=>[]).push(n),e._item!==null;)e=e._item.parent;e_(r._eH,n,t)},qo=class{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=Z3(),this._dEH=Z3(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(e,t){this.doc=e,this._item=t}_copy(){throw Is()}clone(){throw Is()}_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){Q3(this._eH,e)}observeDeep(e){Q3(this._dEH,e)}unobserve(e){J3(this._eH,e)}unobserveDeep(e){J3(this._dEH,e)}toJSON(){}},u_=(e,t,n)=>{e.doc??oi(),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},d_=e=>{e.doc??oi();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},xh=(e,t)=>{let n=0,r=e._start;for(e.doc??oi();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}},f_=(e,t)=>{const n=[];return xh(e,(r,o)=>{n.push(t(r,o,e))}),n},OM=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}}}},h_=(e,t)=>{e.doc??oi();const n=Jm(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}},tg=(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 Wi(oo(s,Li(a,s)),o,o&&o.lastId,l,l&&l.id,t,null,new U0(u)),o.integrate(e,0),u=[])};r.forEach(f=>{if(f===null)u.push(f);else switch(f.constructor){case Number:case Object:case Boolean:case Array:case String:u.push(f);break;default:switch(d(),f.constructor){case Uint8Array:case ArrayBuffer:o=new Wi(oo(s,Li(a,s)),o,o&&o.lastId,l,l&&l.id,t,null,new T_(new Uint8Array(f))),o.integrate(e,0);break;case x0:o=new Wi(oo(s,Li(a,s)),o,o&&o.lastId,l,l&&l.id,t,null,new x_(f)),o.integrate(e,0);break;default:if(f instanceof qo)o=new Wi(oo(s,Li(a,s)),o,o&&o.lastId,l,l&&l.id,t,null,new Cd(f)),o.integrate(e,0);else throw new Error("Unexpected content type in insert operation")}}}),d()},p_=()=>Kl("Length exceeded!"),m_=(e,t,n,r)=>{if(n>t._length)throw p_();if(n===0)return t._searchMarker&&Th(t._searchMarker,n,r.length),tg(e,t,null,r);const o=n,i=Jm(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&&ql(e,oo(s.id.client,s.id.clock+n));break}n-=s.length}return t._searchMarker&&Th(t._searchMarker,o,r.length),tg(e,t,s,r)},DM=(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 tg(e,t,r,n)},g_=(e,t,n,r)=>{if(r===0)return;const o=n,i=r,s=Jm(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&&ql(e,oo(a.id.client,a.id.clock+n)),n-=a.length);for(;r>0&&a!==null;)a.deleted||(r<a.length&&ql(e,oo(a.id.client,a.id.clock+r)),a.delete(e),r-=a.length),a=a.right;if(r>0)throw p_();t._searchMarker&&Th(t._searchMarker,o,-i+r)},ng=(e,t,n)=>{const r=t._map.get(n);r!==void 0&&r.delete(e)},P0=(e,t,n,r)=>{const o=t._map.get(n)||null,i=e.doc,s=i.clientID;let a;if(r==null)a=new U0([r]);else switch(r.constructor){case Number:case Object:case Boolean:case Array:case String:case Date:case BigInt:a=new U0([r]);break;case Uint8Array:a=new T_(r);break;case x0:a=new x_(r);break;default:if(r instanceof qo)a=new Cd(r);else throw new Error("Unexpected content type")}new Wi(oo(s,Li(i.store,s)),o,o&&o.lastId,null,null,t,n,a).integrate(e,0)},F0=(e,t)=>{e.doc??oi();const n=e._map.get(t);return n!==void 0&&!n.deleted?n.content.getContent()[n.length-1]:void 0},v_=e=>{const t={};return e.doc??oi(),e._map.forEach((n,r)=>{n.deleted||(t[r]=n.content.getContent()[n.length-1])}),t},y_=(e,t)=>{e.doc??oi();const n=e._map.get(t);return n!==void 0&&!n.deleted},PM=(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&&yd(i,t)&&(n[o]=i.content.getContent()[i.length-1])}),n},rg=e=>(e.doc??oi(),lM(e._map.entries(),t=>!t[1].deleted)),FM=class extends Qm{},NM=class Hv extends qo{constructor(){super(),this._prelimContent=[],this._searchMarker=[]}static from(t){const n=new Hv;return n.push(t),n}_integrate(t,n){super._integrate(t,n),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new Hv}clone(){const t=new Hv;return t.insert(0,this.toArray().map(n=>n instanceof qo?n.clone():n)),t}get length(){return this.doc??oi(),this._length}_callObserver(t,n){super._callObserver(t,n),eg(this,t,new FM(this,t))}insert(t,n){this.doc!==null?Dr(this.doc,r=>{m_(r,this,t,n)}):this._prelimContent.splice(t,0,...n)}push(t){this.doc!==null?Dr(this.doc,n=>{DM(n,this,t)}):this._prelimContent.push(...t)}unshift(t){this.insert(0,t)}delete(t,n=1){this.doc!==null?Dr(this.doc,r=>{g_(r,this,t,n)}):this._prelimContent.splice(t,n)}get(t){return h_(this,t)}toArray(){return d_(this)}slice(t=0,n=this.length){return u_(this,t,n)}toJSON(){return this.map(t=>t instanceof qo?t.toJSON():t)}map(t){return f_(this,t)}forEach(t){xh(this,t)}[Symbol.iterator](){return OM(this)}_write(t){t.writeTypeRef(YM)}},BM=class extends Qm{constructor(e,t,n){super(e,t),this.keysChanged=n}},N0=class lw extends qo{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 lw}clone(){const t=new lw;return this.forEach((n,r)=>{t.set(r,n instanceof qo?n.clone():n)}),t}_callObserver(t,n){eg(this,t,new BM(this,t,n))}toJSON(){this.doc??oi();const t={};return this._map.forEach((n,r)=>{if(!n.deleted){const o=n.content.getContent()[n.length-1];t[r]=o instanceof qo?o.toJSON():o}}),t}get size(){return[...rg(this)].length}keys(){return T0(rg(this),t=>t[0])}values(){return T0(rg(this),t=>t[1].content.getContent()[t[1].length-1])}entries(){return T0(rg(this),t=>[t[0],t[1].content.getContent()[t[1].length-1]])}forEach(t){this.doc??oi(),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?Dr(this.doc,n=>{ng(n,this,t)}):this._prelimContent.delete(t)}set(t,n){return this.doc!==null?Dr(this.doc,r=>{P0(r,this,t,n)}):this._prelimContent.set(t,n),n}get(t){return F0(this,t)}has(t){return y_(this,t)}clear(){this.doc!==null?Dr(this.doc,t=>{this.forEach(function(n,r,o){ng(t,o,r)})}):this._prelimContent.clear()}_write(t){t.writeTypeRef(XM)}},Yl=(e,t)=>e===t||typeof e=="object"&&typeof t=="object"&&e&&t&&u7(e,t),B0=class{constructor(e,t,n,r){this.left=e,this.right=t,this.index=n,this.currentAttributes=r}forward(){this.right===null&&tl(),this.right.content.constructor===ii?this.right.deleted||bd(this.currentAttributes,this.right.content):this.right.deleted||(this.index+=this.right.length),this.left=this.right,this.right=this.right.right}},b_=(e,t,n)=>{for(;t.right!==null&&n>0;)t.right.content.constructor===ii?t.right.deleted||bd(t.currentAttributes,t.right.content):t.right.deleted||(n<t.right.length&&ql(e,oo(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},og=(e,t,n,r)=>{const o=new Map,i=r?Jm(t,n):null;if(i){const s=new B0(i.p.left,i.p,i.index,o);return b_(e,s,n-i.index)}else{const s=new B0(null,t._start,0,o);return b_(e,s,n)}},w_=(e,t,n,r)=>{for(;n.right!==null&&(n.right.deleted===!0||n.right.content.constructor===ii&&Yl(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 Wi(oo(i,Li(o.store,i)),l,l&&l.lastId,u,u&&u.id,t,null,new ii(a,s));d.integrate(e,0),n.right=d,n.forward()})},bd=(e,t)=>{const{key:n,value:r}=t;r===null?e.delete(n):e.set(n,r)},C_=(e,t)=>{for(;e.right!==null;){if(!(e.right.deleted||e.right.content.constructor===ii&&Yl(t[e.right.content.key]??null,e.right.content.value)))break;e.forward()}},k_=(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(!Yl(u,l)){s.set(a,u);const{left:d,right:f}=n;n.right=new Wi(oo(i,Li(o.store,i)),d,d&&d.lastId,f,f&&f.id,t,null,new ii(a,l)),n.right.integrate(e,0),n.forward()}}return s},z0=(e,t,n,r,o)=>{n.currentAttributes.forEach((p,g)=>{o[g]===void 0&&(o[g]=null)});const i=e.doc,s=i.clientID;C_(n,o);const a=k_(e,t,n,o),l=r.constructor===String?new wd(r):r instanceof qo?new Cd(r):new ig(r);let{left:u,right:d,index:f}=n;t._searchMarker&&Th(t._searchMarker,n.index,l.getLength()),d=new Wi(oo(s,Li(i.store,s)),u,u&&u.lastId,d,d&&d.id,t,null,l),d.integrate(e,0),n.right=d,n.index=f,n.forward(),w_(e,t,n,a)},S_=(e,t,n,r,o)=>{const i=e.doc,s=i.clientID;C_(n,o);const a=k_(e,t,n,o);e:for(;n.right!==null&&(r>0||a.size>0&&(n.right.deleted||n.right.content.constructor===ii));){if(!n.right.deleted)switch(n.right.content.constructor){case ii:{const{key:l,value:u}=n.right.content,d=o[l];if(d!==void 0){if(Yl(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&&ql(e,oo(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 Wi(oo(s,Li(i.store,s)),n.left,n.left&&n.left.lastId,n.right,n.right&&n.right.id,t,null,new wd(l)),n.right.integrate(e,0),n.forward()}w_(e,t,n,a)},__=(e,t,n,r,o)=>{let i=t;const s=la();for(;i&&(!i.countable||i.deleted);){if(!i.deleted&&i.content.constructor===ii){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===ii){const{key:d,value:f}=u,p=r.get(d)??null;(s.get(d)!==u||p===f)&&(t.delete(e),a++,!l&&(o.get(d)??null)===f&&p!==f&&(p===null?o.delete(d):o.set(d,p))),!l&&!t.deleted&&bd(o,u)}}t=t.right}return a},zM=(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===ii){const r=t.content.key;n.has(r)?t.delete(e):n.add(r)}t=t.left}},VM=e=>{let t=0;return Dr(e.doc,n=>{let r=e._start,o=e._start,i=la();const s=i0(i);for(;o;)o.deleted===!1&&(o.content.constructor===ii?bd(s,o.content):(t+=__(n,r,o,i,s),i=i0(s),r=o)),o=o.right}),t},jM=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&&r_(e,n.store.clients.get(r),i,o,s=>{!s.deleted&&s.content.constructor===ii&&s.constructor!==Xl&&t.add(s.parent)})}Dr(n,r=>{W3(e,e.deleteSet,o=>{if(o instanceof Xl||!o.parent._hasFormatting||t.has(o.parent))return;const i=o.parent;o.content.constructor===ii?t.add(i):zM(r,o)});for(const o of t)VM(o)})},A_=(e,t,n)=>{const r=n,o=i0(t.currentAttributes),i=t.right;for(;n>0&&t.right!==null;){if(t.right.deleted===!1)switch(t.right.content.constructor){case Cd:case ig:case wd:n<t.right.length&&ql(e,oo(t.right.id.client,t.right.id.clock+n)),n-=t.right.length,t.right.delete(e);break}t.forward()}i&&__(e,i,t.right,o,t.currentAttributes);const s=(t.left||t.right).parent;return s._searchMarker&&Th(s._searchMarker,t.index,-r+n),t},UM=class extends Qm{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=[];Dr(e,n=>{const r=new Map,o=new Map;let i=this.target._start,s=null;const a={};let l="",u=0,d=0;const f=()=>{if(s!==null){let p=null;switch(s){case"delete":d>0&&(p={delete:d}),d=0;break;case"insert":(typeof l=="object"||l.length>0)&&(p={insert:l},r.size>0&&(p.attributes={},r.forEach((g,v)=>{g!==null&&(p.attributes[v]=g)}))),l="";break;case"retain":u>0&&(p={retain:u},c7(a)||(p.attributes=s7({},a))),u=0;break}p&&t.push(p),s=null}};for(;i!==null;){switch(i.content.constructor){case Cd:case ig:this.adds(i)?this.deletes(i)||(f(),s="insert",l=i.content.getContent()[0],f()):this.deletes(i)?(s!=="delete"&&(f(),s="delete"),d+=1):i.deleted||(s!=="retain"&&(f(),s="retain"),u+=1);break;case wd:this.adds(i)?this.deletes(i)||(s!=="insert"&&(f(),s="insert"),l+=i.content.str):this.deletes(i)?(s!=="delete"&&(f(),s="delete"),d+=i.length):i.deleted||(s!=="retain"&&(f(),s="retain"),u+=i.length);break;case ii:{const{key:p,value:g}=i.content;if(this.adds(i)){if(!this.deletes(i)){const v=r.get(p)??null;Yl(v,g)?g!==null&&i.delete(n):(s==="retain"&&f(),Yl(g,o.get(p)??null)?delete a[p]:a[p]=g)}}else if(this.deletes(i)){o.set(p,g);const v=r.get(p)??null;Yl(v,g)||(s==="retain"&&f(),a[p]=v)}else if(!i.deleted){o.set(p,g);const v=a[p];v!==void 0&&(Yl(v,g)?v!==null&&i.delete(n):(s==="retain"&&f(),g===null?delete a[p]:a[p]=g))}i.deleted||(s==="insert"&&f(),bd(r,i.content));break}}i=i.right}for(f();t.length>0;){const p=t[t.length-1];if(p.retain!==void 0&&p.attributes===void 0)t.pop();else break}}),this._delta=t}return this._delta}},$M=class cw extends qo{constructor(t){super(),this._pending=t!==void 0?[()=>this.insert(0,t)]:[],this._searchMarker=[],this._hasFormatting=!1}get length(){return this.doc??oi(),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 cw}clone(){const t=new cw;return t.applyDelta(this.toDelta()),t}_callObserver(t,n){super._callObserver(t,n);const r=new UM(this,t,n);eg(this,t,r),!t.local&&this._hasFormatting&&(t._needFormattingCleanup=!0)}toString(){this.doc??oi();let t="",n=this._start;for(;n!==null;)!n.deleted&&n.countable&&n.content.constructor===wd&&(t+=n.content.str),n=n.right;return t}toJSON(){return this.toString()}applyDelta(t,{sanitize:n=!0}={}){this.doc!==null?Dr(this.doc,r=>{const o=new B0(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
|
`,dE=()=>{if(typeof document>"u")throw new Error(s$)},Ts=class a5{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 a5(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=je._getRotation(l.rotation),l}},a$="[object Array]",l$="[object Number]",c$="[object String]",u$="[object Boolean]",d$=Math.PI/180,f$=180/Math.PI,Kh="#",h$="",p$="0",m$="Konva warning: ",fE="Konva error: ",g$="rgb(",J1={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,132,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,255,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,203],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[119,128,144],slategrey:[119,128,144],snow:[255,255,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],transparent:[255,255,255,0],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,5]},v$=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/,Lg=[],qh=null,y$=typeof requestAnimationFrame<"u"&&requestAnimationFrame||function(e){setTimeout(e,16)},je={_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)===a$},_isNumber(e){return Object.prototype.toString.call(e)===l$&&!isNaN(e)&&isFinite(e)},_isString(e){return Object.prototype.toString.call(e)===c$},_isBoolean(e){return Object.prototype.toString.call(e)===u$},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){Lg.push(e),Lg.length===1&&y$(function(){const t=Lg;Lg=[],t.forEach(function(n){n()})})},createCanvasElement(){dE();const e=document.createElement("canvas");try{e.style=e.style||{}}catch{}return e},createImageElement(){return dE(),document.createElement("img")},_isInDocument(e){for(;e=e.parentNode;)if(e==document)return!0;return!1},_urlToImage(e,t){const n=je.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(Kh,h$);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=p$+e;return Kh+e},isCanvasFarblingActive(){if(qh!==null)return qh;if(typeof document>"u")return qh=!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 qh=r,this.releaseCanvas(e),qh},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),Kh+this._rgbToHex(e,t,n)},getSnappedHexColor(e){const t=this._hexToRgb(e);return Kh+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 J1?(t=J1[e],{r:t[0],g:t[1],b:t[2]}):e[0]===Kh?this._hexToRgb(e.substring(1)):e.substr(0,4)===g$?(t=v$.exec(e.replace(/ /g,"")),{r:parseInt(t[1],10),g:parseInt(t[2],10),b:parseInt(t[3],10)}):{r:0,g:0,b:0}},colorToRGBA(e){return e=e||"black",je._namedColorToRBA(e)||je._hex3ColorToRGBA(e)||je._hex4ColorToRGBA(e)||je._hex6ColorToRGBA(e)||je._hex8ColorToRGBA(e)||je._rgbColorToRGBA(e)||je._rgbaColorToRGBA(e)||je._hslColorToRGBA(e)},_namedColorToRBA(e){const t=J1[e.toLowerCase()];return t?{r:t[0],g:t[1],b:t[2],a:1}:null},_rgbColorToRGBA(e){if(e.indexOf("rgb(")===0){e=e.match(/rgb\(([^)]+)\)/)[1];const t=e.split(/ *, */).map(Number);return{r:t[0],g:t[1],b:t[2],a:1}}},_rgbaColorToRGBA(e){if(e.indexOf("rgba(")===0){e=e.match(/rgba\(([^)]+)\)/)[1];const t=e.split(/ *, */).map((n,r)=>n.slice(-1)==="%"?r===3?parseInt(n)/100:parseInt(n)/100*255:Number(n));return{r:t[0],g:t[1],b:t[2],a:t[3]}}},_hex8ColorToRGBA(e){if(e[0]==="#"&&e.length===9)return{r:parseInt(e.slice(1,3),16),g:parseInt(e.slice(3,5),16),b:parseInt(e.slice(5,7),16),a:parseInt(e.slice(7,9),16)/255}},_hex6ColorToRGBA(e){if(e[0]==="#"&&e.length===7)return{r:parseInt(e.slice(1,3),16),g:parseInt(e.slice(3,5),16),b:parseInt(e.slice(5,7),16),a:1}},_hex4ColorToRGBA(e){if(e[0]==="#"&&e.length===5)return{r:parseInt(e[1]+e[1],16),g:parseInt(e[2]+e[2],16),b:parseInt(e[3]+e[3],16),a:parseInt(e[4]+e[4],16)/255}},_hex3ColorToRGBA(e){if(e[0]==="#"&&e.length===4)return{r:parseInt(e[1]+e[1],16),g:parseInt(e[2]+e[2],16),b:parseInt(e[3]+e[3],16),a:1}},_hslColorToRGBA(e){if(/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.test(e)){const[t,...n]=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(e),r=Number(n[0])/360,o=Number(n[1])/100,i=Number(n[2])/100;let s,a,l;if(o===0)return l=i*255,{r:Math.round(l),g:Math.round(l),b:Math.round(l),a:1};i<.5?s=i*(1+o):s=i+o-i*o;const u=2*i-s,d=[0,0,0];for(let f=0;f<3;f++)a=r+1/3*-(f-1),a<0&&a++,a>1&&a--,6*a<1?l=u+(s-u)*6*a:2*a<1?l=s:3*a<2?l=u+(s-u)*(2/3-a)*6:l=u,d[f]=l*255;return{r:Math.round(d[0]),g:Math.round(d[1]),b:Math.round(d[2]),a:1}}},haveIntersection(e,t){return!(t.x>e.x+e.width||t.x+t.width<e.x||t.y>e.y+e.height||t.y+t.height<e.y)},cloneObject(e){const t={};for(const n in e)this._isPlainObject(e[n])?t[n]=this.cloneObject(e[n]):this._isArray(e[n])?t[n]=this.cloneArray(e[n]):t[n]=e[n];return t},cloneArray(e){return e.slice(0)},degToRad(e){return e*d$},radToDeg(e){return e*f$},_degToRad(e){return je.warn("Util._degToRad is removed. Please use public Util.degToRad instead."),je.degToRad(e)},_radToDeg(e){return je.warn("Util._radToDeg is removed. Please use public Util.radToDeg instead."),je.radToDeg(e)},_getRotation(e){return Pt.angleDeg?je.radToDeg(e):e},_capitalize(e){return e.charAt(0).toUpperCase()+e.slice(1)},throw(e){throw new Error(fE+e)},error(e){console.error(fE+e)},warn(e){Pt.showWarnings&&console.warn(m$+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=je.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=je._getProjectionToSegment(i.x,i.y,a.x,a.y,e.x,e.y),u=l[0],d=l[1],f=l[2];f<o&&(r.x=u,r.y=d,o=f)}),r},_prepareArrayForTween(e,t,n){const r=[],o=[];if(e.length>t.length){const s=t;t=e,e=s}for(let s=0;s<e.length;s+=2)r.push({x:e[s],y:e[s+1]});for(let s=0;s<t.length;s+=2)o.push({x:t[s],y:t[s+1]});const i=[];return o.forEach(function(s){const a=je._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||je._isElement(e[n]))if(t.configurable)delete e[n];else return null;else if(je._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){Pt.releaseCanvasOnDestroy&&e.forEach(t=>{t.width=0,t.height=0})},drawRoundedRectPath(e,t,n,r){let o=t<0?t:0,i=n<0?n:0;t=Math.abs(t),n=Math.abs(n);let s=0,a=0,l=0,u=0;typeof r=="number"?s=a=l=u=Math.min(r,t/2,n/2):(s=Math.min(r[0]||0,t/2,n/2),a=Math.min(r[1]||0,t/2,n/2),u=Math.min(r[2]||0,t/2,n/2),l=Math.min(r[3]||0,t/2,n/2)),e.moveTo(o+s,i),e.lineTo(o+t-a,i),e.arc(o+t-a,i+a,a,Math.PI*3/2,0,!1),e.lineTo(o+t,i+n-u),e.arc(o+t-u,i+n-u,u,0,Math.PI/2,!1),e.lineTo(o+l,i+n),e.arc(o+l,i+n-l,l,Math.PI/2,Math.PI,!1),e.lineTo(o,i+s),e.arc(o+s,i+s,s,Math.PI,Math.PI*3/2,!1)},drawRoundedPolygonPath(e,t,n,r,o){r=Math.abs(r);for(let i=0;i<n;i++){const s=t[(i-1+n)%n],a=t[i],l=t[(i+1)%n],u={x:a.x-s.x,y:a.y-s.y},d={x:l.x-a.x,y:l.y-a.y},f=Math.hypot(u.x,u.y),p=Math.hypot(d.x,d.y);let g;typeof o=="number"?g=o:g=i<o.length?o[i]:0,g=r*Math.cos(Math.PI/n)*Math.min(1,g/r*2);const v={x:u.x/f,y:u.y/f},y={x:d.x/p,y:d.y/p},_={x:a.x-v.x*g,y:a.y-v.y*g},w={x:a.x+y.x*g,y:a.y+y.y*g};i===0?e.moveTo(_.x,_.y):e.lineTo(_.x,_.y),e.arcTo(a.x,a.y,w.x,w.y,g)}}};function b$(e){const t=[],n=e.length,r=je;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 hE=",",w$="(",C$=")",k$="([",S$="])",_$=";",A$="()",I$="=",pE=["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"],E$=["fillStyle","strokeStyle","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY","letterSpacing","lineCap","lineDashOffset","lineJoin","lineWidth","miterLimit","direction","font","textAlign","textBaseline","globalAlpha","globalCompositeOperation","imageSmoothingEnabled","filter"],T$=100,Og=null;function mE(){if(Og!==null)return Og;try{const e=je.createCanvasElement().getContext("2d");return e?!!e&&"filter"in e:(Og=!1,!1)}catch{return Og=!1,!1}}var Dg=class{constructor(e){this.canvas=e,Pt.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+=A$:je._isArray(l[0])?o+=k$+l.join(hE)+S$:(t&&(l=l.map(u=>typeof u=="number"?Math.floor(u):u)),o+=w$+l.join(hE)+C$)):(o+=s.property,e||(o+=I$+s.val)),o+=_$;return o}clearTrace(){this.traceArr=[]}_trace(e){let t=this.traceArr,n;t.push(e),n=t.length,n>=T$&&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=pE.length,n=this.setAttr,r,o;const i=function(s){let a=e[s],l;e[s]=function(){return o=b$(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(pE[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)}};E$.forEach(function(e){Object.defineProperty(Dg.prototype,e,{get(){return this._context[e]},set(t){this._context[e]=t}})});var x$=class extends Dg{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)}},R$=class extends Dg{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()}}},Pg;function M$(){if(Pg)return Pg;const e=je.createCanvasElement(),t=e.getContext("2d");return Pg=(function(){return(Pt._global.devicePixelRatio||1)/(t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1)})(),je.releaseCanvas(e),Pg}var e2=class{constructor(e){this.pixelRatio=1,this.width=0,this.height=0,this.isCache=!1;const t=(e||{}).pixelRatio||Pt.pixelRatio||M$();this.pixelRatio=t,this._canvas=je.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 je.error("Unable to get data URL. "+r.message+" For more info read https://konvajs.org/docs/posts/Tainted_Canvas.html."),""}}}},ic=class extends e2{constructor(e={width:0,height:0,willReadFrequently:!1}){super(e),this.context=new x$(this,{willReadFrequently:e.willReadFrequently}),this.setSize(e.width,e.height)}},t2=class extends e2{constructor(e={width:0,height:0}){super(e),this.hitCanvas=!0,this.context=new R$(this),this.setSize(e.width,e.height)}},or={get isDragging(){let e=!1;return or._dragElements.forEach(t=>{t.dragStatus==="dragging"&&(e=!0)}),e},justDragged:!1,get node(){let e;return or._dragElements.forEach(t=>{e=t.node}),e},_dragElements:new Map,_drag(e){const t=[];or._dragElements.forEach((n,r)=>{const{node:o}=n,i=o.getStage();i.setPointersPositions(e),n.pointerId===void 0&&(n.pointerId=je._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=[];or._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")&&(or.justDragged=!0,Pt._mouseListenClick=!1,Pt._touchListenClick=!1,Pt._pointerListenClick=!1,n.dragStatus="stopped");const i=n.node.getLayer()||n.node instanceof Pt.Stage&&n.node;i&&t.indexOf(i)===-1&&t.push(i)}),t.forEach(n=>{n.draw()})},_endDragAfter(e){or._dragElements.forEach((t,n)=>{t.dragStatus==="stopped"&&t.node.fire("dragend",{type:"dragend",target:t.node,evt:e},!0),t.dragStatus!=="dragging"&&or._dragElements.delete(n)})}};Pt.isBrowser&&(window.addEventListener("mouseup",or._endDragBefore,!0),window.addEventListener("touchend",or._endDragBefore,!0),window.addEventListener("touchcancel",or._endDragBefore,!0),window.addEventListener("mousemove",or._drag),window.addEventListener("touchmove",or._drag),window.addEventListener("mouseup",or._endDragAfter,!1),window.addEventListener("touchend",or._endDragAfter,!1),window.addEventListener("touchcancel",or._endDragAfter,!1));function sc(e){return je._isString(e)?'"'+e+'"':Object.prototype.toString.call(e)==="[object Number]"||je._isBoolean(e)?e:Object.prototype.toString.call(e)}function gE(e){return e>255?255:e<0?0:Math.round(e)}function Mt(){if(Pt.isUnminified)return function(e,t){return je._isNumber(e)||je.warn(sc(e)+' is a not valid value for "'+t+'" attribute. The value should be a number.'),e}}function Fg(e){if(Pt.isUnminified)return function(t,n){let r=je._isNumber(t),o=je._isArray(t)&&t.length==e;return!r&&!o&&je.warn(sc(t)+' is a not valid value for "'+n+'" attribute. The value should be a number or Array<number>('+e+")"),t}}function n2(){if(Pt.isUnminified)return function(e,t){return je._isNumber(e)||e==="auto"||je.warn(sc(e)+' is a not valid value for "'+t+'" attribute. The value should be a number or "auto".'),e}}function ru(){if(Pt.isUnminified)return function(e,t){return je._isString(e)||je.warn(sc(e)+' is a not valid value for "'+t+'" attribute. The value should be a string.'),e}}function vE(){if(Pt.isUnminified)return function(e,t){const n=je._isString(e),r=Object.prototype.toString.call(e)==="[object CanvasGradient]"||e&&e.addColorStop;return n||r||je.warn(sc(e)+' is a not valid value for "'+t+'" attribute. The value should be a string or a native gradient.'),e}}function L$(){if(Pt.isUnminified)return function(e,t){const n=Int8Array?Object.getPrototypeOf(Int8Array):null;return n&&e instanceof n||(je._isArray(e)?e.forEach(function(r){je._isNumber(r)||je.warn('"'+t+'" attribute has non numeric element '+r+". Make sure that all elements are numbers.")}):je.warn(sc(e)+' is a not valid value for "'+t+'" attribute. The value should be a array of numbers.')),e}}function xs(){if(Pt.isUnminified)return function(e,t){return e===!0||e===!1||je.warn(sc(e)+' is a not valid value for "'+t+'" attribute. The value should be a boolean.'),e}}function O$(e){if(Pt.isUnminified)return function(t,n){return t==null||je.isObject(t)||je.warn(sc(t)+' is a not valid value for "'+n+'" attribute. The value should be an object with properties '+e),t}}var Yh="get",Xh="set",we={addGetterSetter(e,t,n,r,o){we.addGetter(e,t,n),we.addSetter(e,t,r,o),we.addOverloadedGetterSetter(e,t)},addGetter(e,t,n){const r=Yh+je._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=Xh+je._capitalize(t);e.prototype[o]||we.overWriteSetter(e,t,n,r)},overWriteSetter(e,t,n,r){const o=Xh+je._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=je._capitalize,a=Yh+s(t),l=Xh+s(t);e.prototype[a]=function(){const d={};for(let f=0;f<i;f++){const p=n[f];d[p]=this.getAttr(t+s(p))}return d};const u=O$(n);e.prototype[l]=function(d){const f=this.attrs[t];r&&(d=r.call(this,d,t)),u&&u.call(this,d,t);for(const p in d)d.hasOwnProperty(p)&&this._setAttr(t+s(p),d[p]);return d||n.forEach(p=>{this._setAttr(t+s(p),void 0)}),this._fireChangeEvent(t,f,d),o&&o.call(this),this},we.addOverloadedGetterSetter(e,t)},addOverloadedGetterSetter(e,t){const n=je._capitalize(t),r=Xh+n,o=Yh+n;e.prototype[t]=function(){return arguments.length?(this[r](arguments[0]),this):this[o]()}},addDeprecatedGetterSetter(e,t,n,r){je.error("Adding deprecated "+t);const o=Yh+je._capitalize(t),i=t+" property is deprecated and will be removed soon. Look at Konva change log for more information.";e.prototype[o]=function(){je.error(i);const s=this.attrs[t];return s===void 0?n:s},we.addSetter(e,t,r,function(){je.error(i)}),we.addOverloadedGetterSetter(e,t)},backCompat(e,t){je.each(t,function(n,r){const o=e.prototype[r],i=Yh+je._capitalize(n),s=Xh+je._capitalize(n);function a(){o.apply(this,arguments),je.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 D$(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=Pt.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=Pt.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=Pt.Filters;l&&l.Contrast&&l.Contrast.call(this,s)}}case"grayscale":return function(i){const s=Pt.Filters;s&&s.Grayscale&&s.Grayscale.call(this,i)};case"sepia":return function(i){const s=Pt.Filters;s&&s.Sepia&&s.Sepia.call(this,i)};case"invert":return function(i){const s=Pt.Filters;s&&s.Invert&&s.Invert.call(this,i)};default:je.warn(`CSS filter "${r}" is not supported in fallback mode. Consider using function filters for better compatibility.`);break}}return()=>{}}var Ng="absoluteOpacity",yE="allEventListeners",fl="absoluteTransform",bE="absoluteScale",ou="canvas",P$="Change",F$="children",N$="konva",r2="listening",B$="mouseenter",z$="mouseleave",V$="pointerenter",j$="pointerleave",U$="touchenter",$$="touchleave",wE="set",CE="Shape",Bg=" ",kE="stage",ac="transform",H$="Stage",o2="visible",G$=["xChange.konva","yChange.konva","scaleXChange.konva","scaleYChange.konva","skewXChange.konva","skewYChange.konva","rotationChange.konva","offsetXChange.konva","offsetYChange.konva","transformsEnabledChange.konva"].join(Bg),W$=1,Nt=class Lp{constructor(t){this._id=W$++,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===ac||t===fl)&&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===ac||t===fl)&&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(Bg);this.on(o,()=>{this._clearCache(t)}),this._attachedDepsListeners.set(t,!0)}return this._getCache(t,r)}_getCanvasCache(){return this._cache.get(ou)}_clearSelfAndDescendantCache(t){this._clearCache(t),t===fl&&this.fire("absoluteTransformChange")}clearCache(){if(this._cache.has(ou)){const{scene:t,filter:n,hit:r}=this._cache.get(ou);je.releaseCanvas(t._canvas,n._canvas,r._canvas),this._cache.delete(ou)}return this._clearSelfAndDescendantCache(),this._requestDraw(),this}cache(t){const n=t||{};let r={};(n.x===void 0||n.y===void 0||n.width===void 0||n.height===void 0)&&(r=this.getClientRect({skipTransform:!0,relativeTo:this.getParent()||void 0}));let o=Math.ceil(n.width||r.width),i=Math.ceil(n.height||r.height),s=n.pixelRatio,a=n.x===void 0?Math.floor(r.x):n.x,l=n.y===void 0?Math.floor(r.y):n.y,u=n.offset||0,d=n.drawBorder||!1,f=n.hitCanvasPixelRatio||1;if(!o||!i){je.error("Can not cache the node. Width or height of the node equals 0. Caching is skipped.");return}const p=Math.abs(Math.round(r.x)-a)>.5?1:0,g=Math.abs(Math.round(r.y)-l)>.5?1:0;o+=u*2+p,i+=u*2+g,a-=u,l-=u;const v=new ic({pixelRatio:s,width:o,height:i}),y=new ic({pixelRatio:s,width:0,height:0,willReadFrequently:!0}),_=new t2({pixelRatio:f,width:o,height:i}),w=v.getContext(),E=_.getContext(),k=new ic({width:v.width/v.pixelRatio+Math.abs(a),height:v.height/v.pixelRatio+Math.abs(l),pixelRatio:v.pixelRatio}),C=k.getContext();return _.isCache=!0,v.isCache=!0,this._cache.delete(ou),this._filterUpToDate=!1,n.imageSmoothingEnabled===!1&&(v.getContext()._context.imageSmoothingEnabled=!1,y.getContext()._context.imageSmoothingEnabled=!1),w.save(),E.save(),C.save(),w.translate(-a,-l),E.translate(-a,-l),C.translate(-a,-l),k.x=a,k.y=l,this._isUnderCache=!0,this._clearSelfAndDescendantCache(Ng),this._clearSelfAndDescendantCache(bE),this.drawScene(v,this,k),this.drawHit(_,this),this._isUnderCache=!1,w.restore(),E.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()),je.releaseCanvas(k._canvas),this._cache.set(ou,{scene:v,filter:y,hit:_,x:a,y:l}),this._requestDraw(),this}isCached(){return this._cache.has(ou)}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"&&mE(),typeof t[p]!="string"||!mE()){d=!1;break}const f=r.pixelRatio;if(o.setSize(r.width/r.pixelRatio,r.height/r.pixelRatio),d){const p=t.join(" ");return i.save(),i.setAttr("filter",p),i.drawImage(r._canvas,0,0,r.getWidth()/f,r.getHeight()/f),i.restore(),this._filterUpToDate=!0,o}try{for(s=t.length,i.clear(),i.drawImage(r._canvas,0,0,r.getWidth()/f,r.getHeight()/f),a=i.getImageData(0,0,o.getWidth(),o.getHeight()),l=0;l<s;l++)u=t[l],typeof u=="string"&&(u=D$(u)),u.call(this,a),i.putImageData(a,0,0)}catch(p){je.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(yE),t.length===3)return this._delegate.apply(this,t);const o=n.split(Bg);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(Bg),o=r.length,i,s,a,l,u,d;if(this._cache&&this._cache.delete(yE),!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=je.cloneObject(i),i.currentTarget=s[a],r.call(s[a],i)}),this}remove(){return this.isDragging()&&this.stopDrag(),or._dragElements.delete(this._id),or._dragElements.forEach((t,n)=>{this.isAncestorOf(t.node)&&or._dragElements.delete(n)}),this._remove(),this}_clearCaches(){this._clearSelfAndDescendantCache(fl),this._clearSelfAndDescendantCache(Ng),this._clearSelfAndDescendantCache(bE),this._clearSelfAndDescendantCache(kE),this._clearSelfAndDescendantCache(o2),this._clearSelfAndDescendantCache(r2)}_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"+je._capitalize(t);return je._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!==F$&&(r=wE+je._capitalize(n),je._isFunction(this[r])?this[r](t[n]):this._setAttr(n,t[n]))}),this}isListening(){return this._getCache(r2,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(o2,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;or._dragElements.forEach(s=>{s.dragStatus==="dragging"&&(s.node.nodeType==="Stage"||s.node.getLayer()===r)&&(o=!0)});const i=!n&&!Pt.hitOnDragEnabled&&(o||Pt.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!==CE&&(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!==H$&&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(ac),this._clearSelfAndDescendantCache(fl)),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 Ts,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(ac);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(ac),this._clearSelfAndDescendantCache(fl),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 je.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 je.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 je.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 je.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 je.warn("Node has no parent. zIndex parameter is ignored."),this;(t<0||t>=this.parent.children.length)&&je.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(Ng,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=je.isObject(r)&&!je._isPlainObject(r)&&!je._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 je._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],je.isValidSelector(i)||(je.warn('Selector "'+i+'" is invalid. Allowed selectors examples are "#foo", ".bar" or "Group".'),je.warn('If you have a custom shape with such className, please change it to start with upper letter like "Triangle".'),je.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(kE,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(fl,this._getAbsoluteTransform)}_getAbsoluteTransform(t){let n;if(t)return n=new Ts,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(fl)||new Ts,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(ac,this._getTransform)}_getTransform(){var t,n;const r=this._cache.get(ac)||new Ts;r.reset();const o=this.x(),i=this.y(),s=Pt.getAngle(this.rotation()),a=(t=this.attrs.scaleX)!==null&&t!==void 0?t:1,l=(n=this.attrs.scaleY)!==null&&n!==void 0?n:1,u=this.attrs.skewX||0,d=this.attrs.skewY||0,f=this.attrs.offsetX||0,p=this.attrs.offsetY||0;return(o!==0||i!==0)&&r.translate(o,i),s!==0&&r.rotate(s),(u!==0||d!==0)&&r.skew(u,d),(a!==1||l!==1)&&r.scale(a,l),(f!==0||p!==0)&&r.translate(-1*f,-1*p),r.dirty=!1,r}clone(t){let n=je.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(N$)<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 ic({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 ic({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,je._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():Pt.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+P$,{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[wE+je._capitalize(t)];return je._isFunction(r)?r.call(this,n):this._setAttr(t,n),this}_requestDraw(){if(Pt.autoDrawEnabled){const t=this.getLayer()||this.getStage();t?.batchDraw()}}_setAttr(t,n){const r=this.attrs[t];r===n&&!je.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===CE&&(n.target=this);const o=[B$,z$,V$,j$,U$,$$];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=Lp.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,Lp.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;or._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){or._dragElements.has(this._id)||this._createDragElement(t);const r=or._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:je.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=or._dragElements.get(this._id);n&&(n.dragStatus="stopped"),or._endDragBefore(t),or._endDragAfter(t)}setDraggable(t){this._setAttr("draggable",t),this._dragChange()}isDragging(){const t=or._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||Pt.dragButtons.indexOf(t.evt.button)>=0)||this.isDragging())return;let n=!1;or._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=or._dragElements.get(this._id),n=t&&t.dragStatus==="dragging",r=t&&t.dragStatus==="ready";n?this.stopDrag():r&&or._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 je.haveIntersection(r,this.getClientRect())}static create(t,n){return je._isString(t)&&(t=JSON.parse(t)),this._createNode(t,n)}static _createNode(t,n){let r=Lp.prototype.getClassName.call(t),o=t.children,i,s,a;n&&(t.attrs.container=n),Pt[r]||(je.warn('Can not find a node with class name "'+r+'". Fallback to "Shape".'),r="Shape");const l=Pt[r];if(i=new l(t.attrs),o)for(s=o.length,a=0;a<s;a++)i.add(Lp._createNode(o[a]));return i}};Nt.protoListenerMap=new Map,Nt.prototype.nodeType="Node",Nt.prototype._attrsAffectingSize=[],Nt.prototype.eventListeners={},Nt.prototype.on(G$,function(){if(this._batchingTransformChange){this._needClearTransformCache=!0;return}this._clearCache(ac),this._clearSelfAndDescendantCache(fl)}),Nt.prototype.on("visibleChange.konva",function(){this._clearSelfAndDescendantCache(o2)}),Nt.prototype.on("listeningChange.konva",function(){this._clearSelfAndDescendantCache(r2)}),Nt.prototype.on("opacityChange.konva",function(){this._clearSelfAndDescendantCache(Ng)});var Sr=we.addGetterSetter;Sr(Nt,"zIndex"),Sr(Nt,"absolutePosition"),Sr(Nt,"position"),Sr(Nt,"x",0,Mt()),Sr(Nt,"y",0,Mt()),Sr(Nt,"globalCompositeOperation","source-over",ru()),Sr(Nt,"opacity",1,Mt()),Sr(Nt,"name","",ru()),Sr(Nt,"id","",ru()),Sr(Nt,"rotation",0,Mt()),we.addComponentsGetterSetter(Nt,"scale",["x","y"]),Sr(Nt,"scaleX",1,Mt()),Sr(Nt,"scaleY",1,Mt()),we.addComponentsGetterSetter(Nt,"skew",["x","y"]),Sr(Nt,"skewX",0,Mt()),Sr(Nt,"skewY",0,Mt()),we.addComponentsGetterSetter(Nt,"offset",["x","y"]),Sr(Nt,"offsetX",0,Mt()),Sr(Nt,"offsetY",0,Mt()),Sr(Nt,"dragDistance",void 0,Mt()),Sr(Nt,"width",0,Mt()),Sr(Nt,"height",0,Mt()),Sr(Nt,"listening",!0,xs()),Sr(Nt,"preventDefault",!0,xs()),Sr(Nt,"filters",void 0,function(e){return this._filterUpToDate=!1,e}),Sr(Nt,"visible",!0,xs()),Sr(Nt,"transformsEnabled","all",ru()),Sr(Nt,"size"),Sr(Nt,"dragBoundFunc"),Sr(Nt,"draggable",!1,xs()),we.backCompat(Nt,{rotateDeg:"rotate",setRotationDeg:"setRotation",getRotationDeg:"getRotation"});var Yi=class extends Nt{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=Nt.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=Nt.prototype.clone.call(this,e);return this.getChildren().forEach(function(n){t.add(n.clone())}),t}getAllIntersections(e){const t=[];return this.find("Shape").forEach(n=>{n.isVisible()&&n.intersects(e)&&t.push(n)}),t}_clearSelfAndDescendantCache(e){var t;super._clearSelfAndDescendantCache(e),!this.isCached()&&((t=this.children)===null||t===void 0||t.forEach(function(n){n._clearSelfAndDescendantCache(e)}))}_setChildrenIndices(){var e;(e=this.children)===null||e===void 0||e.forEach(function(t,n){t.index=n}),this._requestDraw()}drawScene(e,t,n){const r=this.getLayer(),o=e||r&&r.getCanvas(),i=o&&o.getContext(),s=this._getCanvasCache(),a=s&&s.scene,l=o&&o.isCache;if(!this.isVisible()&&!l)return this;if(a){i.save();const u=this.getAbsoluteTransform(t).getMatrix();i.transform(u[0],u[1],u[2],u[3],u[4],u[5]),this._drawCachedSceneCanvas(i),i.restore()}else this._drawChildren("drawScene",o,t,n);return this}drawHit(e,t){if(!this.shouldDrawHit(t))return this;const n=this.getLayer(),r=e||n&&n.hitCanvas,o=r&&r.getContext(),i=this._getCanvasCache();if(i&&i.hit){o.save();const s=this.getAbsoluteTransform(t).getMatrix();o.transform(s[0],s[1],s[2],s[3],s[4],s[5]),this._drawCachedHitCanvas(o),o.restore()}else this._drawChildren("drawHit",r,t);return this}_drawChildren(e,t,n,r){var o;const i=t&&t.getContext(),s=this.clipWidth(),a=this.clipHeight(),l=this.clipFunc(),u=typeof s=="number"&&typeof a=="number"||l,d=n===this;if(u){i.save();const p=this.getAbsoluteTransform(n);let g=p.getMatrix();i.transform(g[0],g[1],g[2],g[3],g[4],g[5]),i.beginPath();let v;if(l)v=l.call(this,i,this);else{const y=this.clipX(),_=this.clipY();i.rect(y||0,_||0,s,a)}i.clip.apply(i,v),g=p.copy().invert().getMatrix(),i.transform(g[0],g[1],g[2],g[3],g[4],g[5])}const f=!d&&this.globalCompositeOperation()!=="source-over"&&e==="drawScene";f&&(i.save(),i._applyGlobalCompositeOperation(this)),(o=this.children)===null||o===void 0||o.forEach(function(p){p[e](t,n,r)}),f&&i.restore(),u&&i.restore()}getClientRect(e={}){var t;const n=e.skipTransform,r=e.relativeTo;let o,i,s,a,l={x:1/0,y:1/0,width:0,height:0};const u=this;(t=this.children)===null||t===void 0||t.forEach(function(p){if(!p.visible())return;const g=p.getClientRect({relativeTo:u,skipShadow:e.skipShadow,skipStroke:e.skipStroke});g.width===0&&g.height===0||(o===void 0?(o=g.x,i=g.y,s=g.x+g.width,a=g.y+g.height):(o=Math.min(o,g.x),i=Math.min(i,g.y),s=Math.max(s,g.x+g.width),a=Math.max(a,g.y+g.height)))});const d=this.find("Shape");let f=!1;for(let p=0;p<d.length;p++)if(d[p]._isVisible(this)){f=!0;break}return f&&o!==void 0?l={x:o,y:i,width:s-o,height:a-i}:l={x:0,y:0,width:0,height:0},n?l:this._transformedRect(l,r)}};we.addComponentsGetterSetter(Yi,"clip",["x","y","width","height"]),we.addGetterSetter(Yi,"clipX",void 0,Mt()),we.addGetterSetter(Yi,"clipY",void 0,Mt()),we.addGetterSetter(Yi,"clipWidth",void 0,Mt()),we.addGetterSetter(Yi,"clipHeight",void 0,Mt()),we.addGetterSetter(Yi,"clipFunc");var Zh=new Map,SE=Pt._global.PointerEvent!==void 0;function i2(e){return Zh.get(e)}function s2(e){return{evt:e,pointerId:e.pointerId}}function _E(e,t){return Zh.get(e)===t}function AE(e,t){Qh(e),t.getStage()&&(Zh.set(e,t),SE&&t._fire("gotpointercapture",s2(new PointerEvent("gotpointercapture"))))}function Qh(e,t){const n=Zh.get(e);if(!n)return;const r=n.getStage();r&&r.content,Zh.delete(e),SE&&n._fire("lostpointercapture",s2(new PointerEvent("lostpointercapture")))}var K$="Stage",q$="string",IE="px",Y$="mouseout",EE="mouseleave",TE="mouseover",xE="mouseenter",RE="mousemove",ME="mousedown",LE="mouseup",Jh="pointermove",ep="pointerdown",Vd="pointerup",tp="pointercancel",X$="lostpointercapture",zg="pointerout",np="pointerleave",Vg="pointerover",jg="pointerenter",a2="contextmenu",OE="touchstart",DE="touchend",PE="touchmove",FE="touchcancel",l2="wheel",Z$=5,Q$=[[xE,"_pointerenter"],[ME,"_pointerdown"],[RE,"_pointermove"],[LE,"_pointerup"],[EE,"_pointerleave"],[OE,"_pointerdown"],[PE,"_pointermove"],[DE,"_pointerup"],[FE,"_pointercancel"],[TE,"_pointerover"],[l2,"_wheel"],[a2,"_contextmenu"],[ep,"_pointerdown"],[Jh,"_pointermove"],[Vd,"_pointerup"],[tp,"_pointercancel"],[np,"_pointerleave"],[X$,"_lostpointercapture"]],c2={mouse:{[zg]:Y$,[np]:EE,[Vg]:TE,[jg]:xE,[Jh]:RE,[ep]:ME,[Vd]:LE,[tp]:"mousecancel",pointerclick:"click",pointerdblclick:"dblclick"},touch:{[zg]:"touchout",[np]:"touchleave",[Vg]:"touchover",[jg]:"touchenter",[Jh]:PE,[ep]:OE,[Vd]:DE,[tp]:FE,pointerclick:"tap",pointerdblclick:"dbltap"},pointer:{[zg]:zg,[np]:np,[Vg]:Vg,[jg]:jg,[Jh]:Jh,[ep]:ep,[Vd]:Vd,[tp]:tp,pointerclick:"pointerclick",pointerdblclick:"pointerdblclick"}},rp=e=>e.indexOf("pointer")>=0?"pointer":e.indexOf("touch")>=0?"touch":"mouse",jd=e=>{const t=rp(e);if(t==="pointer")return Pt.pointerEventsEnabled&&c2.pointer;if(t==="touch")return c2.touch;if(t==="mouse")return c2.mouse};function NE(e={}){return(e.clipFunc||e.clipWidth||e.clipHeight)&&je.warn("Stage does not support clipping. Please use clip for Layers or Groups."),e}var J$="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);",op=[],Ug=class extends Yi{constructor(e){super(NE(e)),this._pointerPositions=[],this._changedPointerPositions=[],this._buildDOM(),this._bindContentEvents(),op.push(this),this.on("widthChange.konva heightChange.konva",this._resizeDOM),this.on("visibleChange.konva",this._checkVisibility),this.on("clipWidthChange.konva clipHeightChange.konva clipFuncChange.konva",()=>{NE(this.attrs)}),this._checkVisibility()}_validateAdd(e){const t=e.getType()==="Layer",n=e.getType()==="FastLayer";t||n||je.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===q$){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"),Yi.prototype.clone.call(this,e)}destroy(){super.destroy();const e=this.content;e&&je._isInDocument(e)&&this.container().removeChild(e);const t=op.indexOf(this);return t>-1&&op.splice(t,1),je.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}:(je.warn(J$),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 ic({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+IE,this.content.style.height=t+IE),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>Z$&&je.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(),Pt.isBrowser&&this.content.appendChild(e.canvas._canvas),this}getParent(){return null}getLayer(){return null}hasPointerCapture(e){return _E(e,this)}setPointerCapture(e){AE(e,this)}releaseCapture(e){Qh(e,this)}getLayers(){return this.children}_bindContentEvents(){Pt.isBrowser&&Q$.forEach(([e,t])=>{this.content.addEventListener(e,n=>{this[t](n)},{passive:!1})})}_pointerenter(e){this.setPointersPositions(e);const t=jd(e.type);t&&this._fire(t.pointerenter,{evt:e,target:this,currentTarget:this})}_pointerover(e){this.setPointersPositions(e);const t=jd(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=jd(e.type),n=rp(e.type);if(!t)return;this.setPointersPositions(e);const r=this._getTargetShape(n),o=!(Pt.isDragging()||Pt.isTransforming())||Pt.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=jd(e.type),n=rp(e.type);if(!t)return;this.setPointersPositions(e);let r=!1;this._changedPointerPositions.forEach(o=>{const i=this.getIntersection(o);if(or.justDragged=!1,Pt["_"+n+"ListenClick"]=!0,!i||!i.isListening()){this[n+"ClickStartShape"]=void 0;return}Pt.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=jd(e.type),n=rp(e.type);if(!t)return;const r=e.type.indexOf("touch")>=0||e.pointerType==="touch";if(Pt.isDragging()&&or.node.preventDefault()&&e.cancelable&&r&&e.preventDefault(),this.setPointersPositions(e),!(!(Pt.isDragging()||Pt.isTransforming())||Pt.hitOnDragEnabled))return;const o={};let i=!1;const s=this._getTargetShape(n);this._changedPointerPositions.forEach(a=>{const l=i2(a.id)||this.getIntersection(a),u=a.id,d={evt:e,pointerId:u},f=s!==l;if(f&&s&&(s._fireAndBubble(t.pointerout,{...d},l),s._fireAndBubble(t.pointerleave,{...d},l)),l){if(o[l._id])return;o[l._id]=!0}l&&l.isListening()?(i=!0,f&&(l._fireAndBubble(t.pointerover,{...d},s),l._fireAndBubble(t.pointerenter,{...d},s),this[n+"targetShape"]=l),l._fireAndBubble(t.pointermove,{...d})):s&&(this._fire(t.pointerover,{evt:e,target:this,currentTarget:this,pointerId:u}),this[n+"targetShape"]=null)}),i||this._fire(t.pointermove,{evt:e,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id})}_pointerup(e){const t=jd(e.type),n=rp(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=i2(a.id)||this.getIntersection(a);if(l){if(l.releaseCapture(a.id),i[l._id])return;i[l._id]=!0}const u=a.id,d={evt:e,pointerId:u};let f=!1;Pt["_"+n+"InDblClickWindow"]?(f=!0,clearTimeout(this[n+"DblTimeout"])):or.justDragged||(Pt["_"+n+"InDblClickWindow"]=!0,clearTimeout(this[n+"DblTimeout"])),this[n+"DblTimeout"]=setTimeout(function(){Pt["_"+n+"InDblClickWindow"]=!1},Pt.dblClickWindow),l&&l.isListening()?(s=!0,this[n+"ClickEndShape"]=l,l._fireAndBubble(t.pointerup,{...d}),Pt["_"+n+"ListenClick"]&&r&&r===l&&(l._fireAndBubble(t.pointerclick,{...d}),f&&o&&o===l&&l._fireAndBubble(t.pointerdblclick,{...d}))):(this[n+"ClickEndShape"]=null,s||(this._fire(t.pointerup,{evt:e,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),s=!0),Pt["_"+n+"ListenClick"]&&this._fire(t.pointerclick,{evt:e,target:this,currentTarget:this,pointerId:u}),f&&this._fire(t.pointerdblclick,{evt:e,target:this,currentTarget:this,pointerId:u}))}),s||this._fire(t.pointerup,{evt:e,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),Pt["_"+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(a2,{evt:e}):this._fire(a2,{evt:e,target:this,currentTarget:this})}_wheel(e){this.setPointersPositions(e);const t=this.getIntersection(this.getPointerPosition());t&&t.isListening()?t._fireAndBubble(l2,{evt:e}):this._fire(l2,{evt:e,target:this,currentTarget:this})}_pointercancel(e){this.setPointersPositions(e);const t=i2(e.pointerId)||this.getIntersection(this.getPointerPosition());t&&t._fireAndBubble(Vd,s2(e)),Qh(e.pointerId)}_lostpointercapture(e){Qh(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:je._getFirstPointerId(e)}],this._changedPointerPositions=[{x:n,y:r,id:je._getFirstPointerId(e)}])}_setPointerPosition(e){je.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 ic({width:this.width(),height:this.height()}),this.bufferHitCanvas=new t2({pixelRatio:1,width:this.width(),height:this.height()}),!Pt.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 je.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}};Ug.prototype.nodeType=K$,Yr(Ug),we.addGetterSetter(Ug,"container"),Pt.isBrowser&&document.addEventListener("visibilitychange",()=>{op.forEach(e=>{e.batchDraw()})});var BE="hasShadow",zE="shadowRGBA",VE="patternImage",jE="linearGradient",UE="radialGradient",$g;function u2(){return $g||($g=je.createCanvasElement().getContext("2d"),$g)}var ip={};function eH(e){const t=this.attrs.fillRule;t?e.fill(t):e.fill()}function tH(e){e.stroke()}function nH(e){const t=this.attrs.fillRule;t?e.fill(t):e.fill()}function rH(e){e.stroke()}function oH(){this._clearCache(BE)}function iH(){this._clearCache(zE)}function sH(){this._clearCache(VE)}function aH(){this._clearCache(jE)}function lH(){this._clearCache(UE)}var Et=class extends Nt{constructor(e){super(e);let t,n=0;for(;t=je.getHitColor(),!(t&&!(t in ip));)if(n++,n>=1e4){je.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=je.getRandomColor();break}this.colorKey=t,ip[t]=this}getContext(){return je.warn("shape.getContext() method is deprecated. Please do not use it."),this.getLayer().getContext()}getCanvas(){return je.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(BE,this._hasShadow)}_hasShadow(){return this.shadowEnabled()&&this.shadowOpacity()!==0&&!!(this.shadowColor()||this.shadowBlur()||this.shadowOffsetX()||this.shadowOffsetY())}_getFillPattern(){return this._getCache(VE,this.__getFillPattern)}__getFillPattern(){if(this.fillPatternImage()){const e=u2().createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(e&&e.setTransform){const t=new Ts;t.translate(this.fillPatternX(),this.fillPatternY()),t.rotate(Pt.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(jE,this.__getLinearGradient)}__getLinearGradient(){const e=this.fillLinearGradientColorStops();if(e){const t=u2(),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(UE,this.__getRadialGradient)}__getRadialGradient(){const e=this.fillRadialGradientColorStops();if(e){const t=u2(),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(zE,this._getShadowRGBA)}_getShadowRGBA(){if(!this.hasShadow())return;const e=je.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 Nt.prototype.destroy.call(this),delete ip[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){je.warn("strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead."),e?this.hitStrokeWidth("auto"):this.hitStrokeWidth(0)}getStrokeHitEnabled(){return this.hitStrokeWidth()!==0}getSelfRect(){const e=this.size();return{x:this._centroid?-e.width/2:0,y:this._centroid?-e.height/2:0,width:e.width,height:e.height}}getClientRect(e={}){let t=!1,n=this.getParent();for(;n;){if(n.isCached()){t=!0;break}n=n.getParent()}const r=e.skipTransform,o=e.relativeTo||t&&this.getStage()||void 0,i=this.getSelfRect(),s=!e.skipStroke&&this.hasStroke()&&this.strokeWidth()||0,a=i.width+s,l=i.height+s,u=!e.skipShadow&&this.hasShadow(),d=u?this.shadowOffsetX():0,f=u?this.shadowOffsetY():0,p=a+Math.abs(d),g=l+Math.abs(f),v=u&&this.shadowBlur()||0,y={width:p+v*2,height:g+v*2,x:-(s/2+v)+Math.min(d,0)+i.x,y:-(s/2+v)+Math.min(f,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,f=d.getContext();n?(f.save(),f.setTransform(1,0,0,1,0,0),f.clearRect(0,0,d.width,d.height),f.restore()):f.clear(),f.save(),f._applyLineJoin(this),f._applyMiterLimit(this);const p=this.getAbsoluteTransform(t).getMatrix();f.transform(p[0],p[1],p[2],p[3],p[4],p[5]),s.call(this,f,this),f.restore();const g=d.pixelRatio;a&&o._applyShadow(this),u||(o._applyOpacity(this),o._applyGlobalCompositeOperation(this)),o.drawImage(d._canvas,d.x||0,d.y||0,d.width/g,d.height/g)}else{if(o._applyLineJoin(this),o._applyMiterLimit(this),!u){const d=this.getAbsoluteTransform(t).getMatrix();o.transform(d[0],d[1],d[2],d[3],d[4],d[5]),o._applyOpacity(this),o._applyGlobalCompositeOperation(this)}a&&o._applyShadow(this),s.call(this,o,this)}return o.restore(),this}drawHit(e,t,n=!1){if(!this.shouldDrawHit(t,n))return this;const r=this.getLayer(),o=e||r.hitCanvas,i=o&&o.getContext(),s=this.hitFunc()||this.sceneFunc(),a=this._getCanvasCache(),l=a&&a.hit;if(this.colorKey||je.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=je._hexToRgb(this.colorKey);for(let f=0;f<u;f+=4)l[f+3]>e?(l[f]=d.r,l[f+1]=d.g,l[f+2]=d.b,l[f+3]=255):l[f+3]=0;o.putImageData(a,0,0)}catch(a){je.error("Unable to draw hit graph from cached scene canvas. "+a.message)}return this}hasPointerCapture(e){return _E(e,this)}setPointerCapture(e){AE(e,this)}releaseCapture(e){Qh(e,this)}};Et.prototype._fillFunc=eH,Et.prototype._strokeFunc=tH,Et.prototype._fillFuncHit=nH,Et.prototype._strokeFuncHit=rH,Et.prototype._centroid=!1,Et.prototype.nodeType="Shape",Yr(Et),Et.prototype.eventListeners={},Et.prototype.on("shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",oH),Et.prototype.on("shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",iH),Et.prototype.on("fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",sH),Et.prototype.on("fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",aH),Et.prototype.on("fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",lH),we.addGetterSetter(Et,"stroke",void 0,vE()),we.addGetterSetter(Et,"strokeWidth",2,Mt()),we.addGetterSetter(Et,"fillAfterStrokeEnabled",!1),we.addGetterSetter(Et,"hitStrokeWidth","auto",n2()),we.addGetterSetter(Et,"strokeHitEnabled",!0,xs()),we.addGetterSetter(Et,"perfectDrawEnabled",!0,xs()),we.addGetterSetter(Et,"shadowForStrokeEnabled",!0,xs()),we.addGetterSetter(Et,"lineJoin"),we.addGetterSetter(Et,"lineCap"),we.addGetterSetter(Et,"miterLimit"),we.addGetterSetter(Et,"sceneFunc"),we.addGetterSetter(Et,"hitFunc"),we.addGetterSetter(Et,"dash"),we.addGetterSetter(Et,"dashOffset",0,Mt()),we.addGetterSetter(Et,"shadowColor",void 0,ru()),we.addGetterSetter(Et,"shadowBlur",0,Mt()),we.addGetterSetter(Et,"shadowOpacity",1,Mt()),we.addComponentsGetterSetter(Et,"shadowOffset",["x","y"]),we.addGetterSetter(Et,"shadowOffsetX",0,Mt()),we.addGetterSetter(Et,"shadowOffsetY",0,Mt()),we.addGetterSetter(Et,"fillPatternImage"),we.addGetterSetter(Et,"fill",void 0,vE()),we.addGetterSetter(Et,"fillPatternX",0,Mt()),we.addGetterSetter(Et,"fillPatternY",0,Mt()),we.addGetterSetter(Et,"fillLinearGradientColorStops"),we.addGetterSetter(Et,"strokeLinearGradientColorStops"),we.addGetterSetter(Et,"fillRadialGradientStartRadius",0),we.addGetterSetter(Et,"fillRadialGradientEndRadius",0),we.addGetterSetter(Et,"fillRadialGradientColorStops"),we.addGetterSetter(Et,"fillPatternRepeat","repeat"),we.addGetterSetter(Et,"fillEnabled",!0),we.addGetterSetter(Et,"strokeEnabled",!0),we.addGetterSetter(Et,"shadowEnabled",!0),we.addGetterSetter(Et,"dashEnabled",!0),we.addGetterSetter(Et,"strokeScaleEnabled",!0),we.addGetterSetter(Et,"fillPriority","color"),we.addComponentsGetterSetter(Et,"fillPatternOffset",["x","y"]),we.addGetterSetter(Et,"fillPatternOffsetX",0,Mt()),we.addGetterSetter(Et,"fillPatternOffsetY",0,Mt()),we.addComponentsGetterSetter(Et,"fillPatternScale",["x","y"]),we.addGetterSetter(Et,"fillPatternScaleX",1,Mt()),we.addGetterSetter(Et,"fillPatternScaleY",1,Mt()),we.addComponentsGetterSetter(Et,"fillLinearGradientStartPoint",["x","y"]),we.addComponentsGetterSetter(Et,"strokeLinearGradientStartPoint",["x","y"]),we.addGetterSetter(Et,"fillLinearGradientStartPointX",0),we.addGetterSetter(Et,"strokeLinearGradientStartPointX",0),we.addGetterSetter(Et,"fillLinearGradientStartPointY",0),we.addGetterSetter(Et,"strokeLinearGradientStartPointY",0),we.addComponentsGetterSetter(Et,"fillLinearGradientEndPoint",["x","y"]),we.addComponentsGetterSetter(Et,"strokeLinearGradientEndPoint",["x","y"]),we.addGetterSetter(Et,"fillLinearGradientEndPointX",0),we.addGetterSetter(Et,"strokeLinearGradientEndPointX",0),we.addGetterSetter(Et,"fillLinearGradientEndPointY",0),we.addGetterSetter(Et,"strokeLinearGradientEndPointY",0),we.addComponentsGetterSetter(Et,"fillRadialGradientStartPoint",["x","y"]),we.addGetterSetter(Et,"fillRadialGradientStartPointX",0),we.addGetterSetter(Et,"fillRadialGradientStartPointY",0),we.addComponentsGetterSetter(Et,"fillRadialGradientEndPoint",["x","y"]),we.addGetterSetter(Et,"fillRadialGradientEndPointX",0),we.addGetterSetter(Et,"fillRadialGradientEndPointY",0),we.addGetterSetter(Et,"fillPatternRotation",0),we.addGetterSetter(Et,"fillRule",void 0,ru()),we.backCompat(Et,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"});var cH="beforeDraw",uH="draw",$E=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],dH=$E.length,iu=class extends Yi{constructor(e){super(e),this.canvas=new ic,this.hitCanvas=new t2({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(){Nt.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(!Nt.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(Nt.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(Nt.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 Nt.prototype.remove.call(this),e&&e.parentNode&&je._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"&&je.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(),Nt.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(){je.warn('Can not change width of layer. Use "stage.width(value)" function instead.')}getHeight(){if(this.parent)return this.parent.height()}setHeight(){je.warn('Can not change height of layer. Use "stage.height(value)" function instead.')}batchDraw(){return this._waitingForDraw||(this._waitingForDraw=!0,je.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<dH;r++){const o=$E[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=ip[je.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(cH,{node:this}),this.clearBeforeDraw()&&o.getContext().clear(),Yi.prototype.drawScene.call(this,o,t,n),this._fire(uH,{node:this}),this}drawHit(e,t){const n=this.getLayer(),r=e||n&&n.hitCanvas;return n&&n.clearBeforeDraw()&&n.getHitCanvas().getContext().clear(),Yi.prototype.drawHit.call(this,r,t),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(e){je.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening(e)}getHitGraphEnabled(e){return je.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 je.releaseCanvas(this.getNativeCanvasElement(),this.getHitCanvas()._canvas),super.destroy()}};iu.prototype.nodeType="Layer",Yr(iu),we.addGetterSetter(iu,"imageSmoothingEnabled",!0),we.addGetterSetter(iu,"clearBeforeDraw",!0),we.addGetterSetter(iu,"hitGraphEnabled",!0,xs());var d2=class extends iu{constructor(e){super(e),this.listening(!1),je.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.')}};d2.prototype.nodeType="FastLayer",Yr(d2);var Ud=class extends Yi{_validateAdd(e){const t=e.getType();t!=="Group"&&t!=="Shape"&&je.throw("You may only add groups and shapes to groups.")}};Ud.prototype.nodeType="Group",Yr(Ud);var f2=(function(){return nu.performance&&nu.performance.now?function(){return nu.performance.now()}:function(){return new Date().getTime()}})(),$d=class Tf{constructor(t,n){this.id=Tf.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:f2(),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=Tf.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=f2(),Tf._addAnimation(this),this}stop(){return Tf._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(f2());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=Tf;t.animations.length?(t._runFrames(),je.requestAnimFrame(t._animationLoop)):t.animRunning=!1}static _handleAnimation(){this.animRunning||(this.animRunning=!0,je.requestAnimFrame(this._animationLoop))}};$d.animations=[],$d.animIdCounter=0,$d.animRunning=!1;var fH={node:1,duration:1,easing:1,onFinish:1,yoyo:1},hH=1,HE=2,GE=3,WE=["fill","stroke","shadowColor"],pH=0,mH=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=HE,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")}reverse(){this.state=GE,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===HE?this.setTime(e):this.state===GE&&this.setTime(this.duration-e)}pause(){this.state=hH,this.fire("onPause")}getTimer(){return new Date().getTime()}},Hg=class lo{constructor(t){const n=this,r=t.node,o=r._id,i=t.easing||sp.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=pH++;const u=r.getLayer()||(r instanceof Pt.Stage?r.getLayers():null);u||je.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."),this.anim=new $d(function(){n.tween.onEnterFrame()},u),this.tween=new mH(l,function(d){n._tweenFunc(d)},i,0,1,a*1e3,s),this._addListeners(),lo.attrs[o]||(lo.attrs[o]={}),lo.attrs[o][this._id]||(lo.attrs[o][this._id]={}),lo.tweens[o]||(lo.tweens[o]={});for(l in t)fH[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=lo.tweens[o][t];d&&delete lo.attrs[o][d][t];let f=r.getAttr(t);if(je._isArray(n))if(i=[],s=Math.max(n.length,f.length),t==="points"&&n.length!==f.length&&(n.length>f.length?(l=f,f=je._prepareArrayForTween(f,n,r.closed())):(a=n,n=je._prepareArrayForTween(n,f,r.closed()))),t.indexOf("fill")===0)for(let p=0;p<s;p++)if(p%2===0)i.push(n[p]-f[p]);else{const g=je.colorToRGBA(f[p]);u=je.colorToRGBA(n[p]),f[p]=g,i.push({r:u.r-g.r,g:u.g-g.g,b:u.b-g.b,a:u.a-g.a})}else for(let p=0;p<s;p++)i.push(n[p]-f[p]);else WE.indexOf(t)!==-1?(f=je.colorToRGBA(f),u=je.colorToRGBA(n),i={r:u.r-f.r,g:u.g-f.g,b:u.b-f.b,a:u.a-f.a}):i=n-f;lo.attrs[o][this._id][t]={start:f,diff:i,end:n,trueEnd:a,trueStart:l},lo.tweens[o][t]=this._id}_tweenFunc(t){const n=this.node,r=lo.attrs[n._id][this._id];let o,i,s,a,l,u,d,f;for(o in r){if(i=r[o],s=i.start,a=i.diff,f=i.end,je._isArray(s))if(l=[],d=Math.max(s.length,f.length),o.indexOf("fill")===0)for(u=0;u<d;u++)u%2===0?l.push((s[u]||0)+a[u]*t):l.push("rgba("+Math.round(s[u].r+a[u].r*t)+","+Math.round(s[u].g+a[u].g*t)+","+Math.round(s[u].b+a[u].b*t)+","+(s[u].a+a[u].a*t)+")");else for(u=0;u<d;u++)l.push((s[u]||0)+a[u]*t);else WE.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=lo.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=lo.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=lo.tweens[t];this.pause(),this.anim&&this.anim.stop();for(const o in r)delete lo.tweens[t][o];delete lo.attrs[t][n],lo.tweens[t]&&(Object.keys(lo.tweens[t]).length===0&&delete lo.tweens[t],Object.keys(lo.attrs[t]).length===0&&delete lo.attrs[t])}};Hg.attrs={},Hg.tweens={},Nt.prototype.to=function(e){const t=e.onFinish;e.node=this,e.onFinish=function(){this.destroy(),t&&t()},new Hg(e).play()};var sp={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-sp.BounceEaseOut(r-e,0,n,r)+t},BounceEaseInOut(e,t,n,r){return e<r/2?sp.BounceEaseIn(e*2,0,n,r)*.5+t:sp.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}},KE=je._assign(Pt,{Util:je,Transform:Ts,Node:Nt,Container:Yi,Stage:Ug,stages:op,Layer:iu,FastLayer:d2,Group:Ud,DD:or,Shape:Et,shapes:ip,Animation:$d,Tween:Hg,Easings:sp,Context:Dg,Canvas:e2}),hl=class extends Et{_sceneFunc(e){const t=Pt.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=Pt.getAngle(n?360-this.angle():this.angle()),o=Math.cos(Math.min(r,Math.PI)),i=1,s=Math.sin(Math.min(Math.max(Math.PI,r),3*Math.PI/2)),a=Math.sin(Math.min(r,Math.PI/2)),l=o*(o>0?e:t),u=i*t,d=s*(s>0?e:t),f=a*(a>0?t:e);return{x:l,y:n?-1*f:d,width:u-l,height:f-d}}};hl.prototype._centroid=!0,hl.prototype.className="Arc",hl.prototype._attrsAffectingSize=["innerRadius","outerRadius","angle","clockwise"],Yr(hl),we.addGetterSetter(hl,"innerRadius",0,Mt()),we.addGetterSetter(hl,"outerRadius",0,Mt()),we.addGetterSetter(hl,"angle",0,Mt()),we.addGetterSetter(hl,"clockwise",!1,xs());function h2(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 qE(e,t){const n=e.length,r=[];for(let o=2;o<n-2;o+=2){const i=h2(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 gH(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 pl=class extends Et{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():qE(this.points(),this.tension())}_getTensionPointsClosed(){const e=this.points(),t=e.length,n=this.tension(),r=h2(e[t-2],e[t-1],e[0],e[1],e[2],e[3],n),o=h2(e[t-4],e[t-3],e[t-2],e[t-1],e[0],e[1],n),i=qE(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],...gH(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}}};pl.prototype.className="Line",pl.prototype._attrsAffectingSize=["points","bezier","tension"],Yr(pl),we.addGetterSetter(pl,"closed",!1),we.addGetterSetter(pl,"bezier",!1),we.addGetterSetter(pl,"tension",0,Mt()),we.addGetterSetter(pl,"points",[],L$());var vH=[[],[],[-.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]],yH=[[],[],[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]],bH=[[1],[1,1],[1,2,1],[1,3,3,1]],YE=(e,t,n)=>{let r,o;const s=n/2;r=0;for(let a=0;a<20;a++)o=s*vH[20][a]+s,r+=yH[20][a]*wH(e,t,o);return s*r},XE=(e,t,n)=>{n===void 0&&(n=1);const r=e[0]-2*e[1]+e[2],o=t[0]-2*t[1]+t[2],i=2*e[1]-2*e[0],s=2*t[1]-2*t[0],a=4*(r*r+o*o),l=4*(r*i+o*s),u=i*i+s*s;if(a===0)return n*Math.sqrt(Math.pow(e[2]-e[0],2)+Math.pow(t[2]-t[0],2));const d=l/(2*a),f=u/a,p=n+d,g=f-d*d,v=p*p+g>0?Math.sqrt(p*p+g):0,y=d*d+g>0?Math.sqrt(d*d+g):0,_=d+Math.sqrt(d*d+g)!==0?g*Math.log(Math.abs((p+v)/(d+y))):0;return Math.sqrt(a)/2*(p*v-d*y+_)};function wH(e,t,n){const r=p2(1,n,e),o=p2(1,n,t),i=r*r+o*o;return Math.sqrt(i)}var p2=(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+=bH[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 p2(e-1,t,o)}},ZE=(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},hs=class Bi extends Et{constructor(t){super(t),this.dataArray=[],this.pathLength=0,this._readDataAttribute(),this.on("dataChange.konva",function(){this._readDataAttribute()})}_readDataAttribute(){this.dataArray=Bi.parsePathData(this.data()),this.pathLength=Bi.getPathLength(this.dataArray)}_sceneFunc(t){const n=this.dataArray;t.beginPath();let r=!1;for(let o=0;o<n.length;o++){const i=n[o].command,s=n[o].points;switch(i){case"L":t.lineTo(s[0],s[1]);break;case"M":t.moveTo(s[0],s[1]);break;case"C":t.bezierCurveTo(s[0],s[1],s[2],s[3],s[4],s[5]);break;case"Q":t.quadraticCurveTo(s[0],s[1],s[2],s[3]);break;case"A":const a=s[0],l=s[1],u=s[2],d=s[3],f=s[4],p=s[5],g=s[6],v=s[7],y=u>d?u:d,_=u>d?1:u/d,w=u>d?d/u:1;t.translate(a,l),t.rotate(g),t.scale(_,w),t.arc(0,0,y,f,f+p,1-v),t.scale(1/_,1/w),t.rotate(-g),t.translate(-a,-l);break;case"z":r=!0,t.closePath();break}}!r&&!this.hasFill()?t.strokeShape(this):t.fillStrokeShape(this)}getSelfRect(){let t=[];this.dataArray.forEach(function(l){if(l.command==="A"){const u=l.points[4],d=l.points[5],f=l.points[4]+d;let p=Math.PI/180;if(Math.abs(u-f)<p&&(p=Math.abs(u-f)),d<0)for(let g=u-p;g>f;g-=p){const v=Bi.getPointOnEllipticalArc(l.points[0],l.points[1],l.points[2],l.points[3],g,0);t.push(v.x,v.y)}else for(let g=u+p;g<f;g+=p){const v=Bi.getPointOnEllipticalArc(l.points[0],l.points[1],l.points[2],l.points[3],g,0);t.push(v.x,v.y)}}else if(l.command==="C")for(let u=0;u<=1;u+=.01){const d=Bi.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 Bi.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 Bi.getPointOnLine(t,s.start.x,s.start.y,a[0],a[1]);case"C":return Bi.getPointOnCubicBezier(ZE(t,Bi.getPathLength(n),y=>YE([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 Bi.getPointOnQuadraticBezier(ZE(t,Bi.getPathLength(n),y=>XE([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],f=a[3],p=a[5],g=a[6];let v=a[4];return v+=p*t/s.pathLength,Bi.getPointOnEllipticalArc(l,u,d,f,v,g)}return null}static getPointOnLine(t,n,r,o,i,s,a){s=s??n,a=a??r;const l=this.getLineLength(n,r,o,i);if(l<1e-10)return{x:n,y:r};if(o===n)return{x:s,y:a+(i>r?t:-t)};const u=(i-r)/(o-n),d=Math.sqrt(t*t/(1+u*u))*(o<n?-1:1),f=u*d;if(Math.abs(a-r-u*(s-n))<1e-10)return{x:s+d,y:a+f};const p=((s-n)*(o-n)+(a-r)*(i-r))/(l*l),g=n+p*(o-n),v=r+p*(i-r),y=this.getLineLength(s,a,g,v),_=Math.sqrt(t*t-y*y),w=Math.sqrt(_*_/(1+u*u))*(o<n?-1:1),E=u*w;return{x:g+w,y:v+E}}static getPointOnCubicBezier(t,n,r,o,i,s,a,l,u){function d(v){return v*v*v}function f(v){return 3*v*v*(1-v)}function p(v){return 3*v*(1-v)*(1-v)}function g(v){return(1-v)*(1-v)*(1-v)}return{x:l*d(t)+s*f(t)+o*p(t)+n*g(t),y:u*d(t)+a*f(t)+i*p(t)+r*g(t)}}static getPointOnQuadraticBezier(t,n,r,o,i,s,a){function l(f){return f*f}function u(f){return 2*f*(1-f)}function d(f){return(1-f)*(1-f)}return{x:s*l(t)+o*u(t)+n*d(t),y:a*l(t)+i*u(t)+r*d(t)}}static getPointOnEllipticalArc(t,n,r,o,i,s){const a=Math.cos(s),l=Math.sin(s),u={x:r*Math.cos(i),y:o*Math.sin(i)};return{x:t+(u.x*a-u.y*l),y:n+(u.x*l+u.y*a)}}static parsePathData(t){if(!t)return[];let n=t;const r=["m","M","l","L","v","V","h","H","z","Z","c","C","q","Q","t","T","s","S","a","A"];n=n.replace(new RegExp(" ","g"),",");for(let f=0;f<r.length;f++)n=n.replace(new RegExp(r[f],"g"),"|"+r[f]);const o=n.split("|"),i=[],s=[];let a=0,l=0;const u=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:e[-+]?\d+)?)/gi;let d;for(let f=1;f<o.length;f++){let p=o[f],g=p.charAt(0);for(p=p.slice(1),s.length=0;d=u.exec(p);)s.push(d[0]);let v=[],y=g==="A"||g==="a"?0:-1;for(let _=0,w=s.length;_<w;_++){const E=s[_];if(E==="00"){v.push(0,0),y>=0&&(y+=2,y>=7&&(y-=7));continue}if(y>=0){if(y===3){if(/^[01]{2}\d+(?:\.\d+)?$/.test(E)){v.push(parseInt(E[0],10)),v.push(parseInt(E[1],10)),v.push(parseFloat(E.slice(2))),y+=3,y>=7&&(y-=7);continue}if(E==="11"||E==="10"||E==="01"){v.push(parseInt(E[0],10)),v.push(parseInt(E[1],10)),y+=2,y>=7&&(y-=7);continue}if(E==="0"||E==="1"){v.push(parseInt(E,10)),y+=1,y>=7&&(y-=7);continue}}else if(y===4){if(/^[01]\d+(?:\.\d+)?$/.test(E)){v.push(parseInt(E[0],10)),v.push(parseFloat(E.slice(1))),y+=2,y>=7&&(y-=7);continue}if(E==="0"||E==="1"){v.push(parseInt(E,10)),y+=1,y>=7&&(y-=7);continue}}const k=parseFloat(E);isNaN(k)?v.push(0):v.push(k),y+=1,y>=7&&(y-=7)}else{const k=parseFloat(E);isNaN(k)?v.push(0):v.push(k)}}for(;v.length>0&&!isNaN(v[0]);){let _="",w=[];const E=a,k=l;let C,x,D,P,W,N,L,j,M,B;switch(g){case"l":a+=v.shift(),l+=v.shift(),_="L",w.push(a,l);break;case"L":a=v.shift(),l=v.shift(),w.push(a,l);break;case"m":const R=v.shift(),re=v.shift();if(a+=R,l+=re,_="M",i.length>2&&i[i.length-1].command==="z"){for(let te=i.length-2;te>=0;te--)if(i[te].command==="M"){a=i[te].points[0]+R,l=i[te].points[1]+re;break}}w.push(a,l),g="l";break;case"M":a=v.shift(),l=v.shift(),_="M",w.push(a,l),g="L";break;case"h":a+=v.shift(),_="L",w.push(a,l);break;case"H":a=v.shift(),_="L",w.push(a,l);break;case"v":l+=v.shift(),_="L",w.push(a,l);break;case"V":l=v.shift(),_="L",w.push(a,l);break;case"C":w.push(v.shift(),v.shift(),v.shift(),v.shift()),a=v.shift(),l=v.shift(),w.push(a,l);break;case"c":w.push(a+v.shift(),l+v.shift(),a+v.shift(),l+v.shift()),a+=v.shift(),l+=v.shift(),_="C",w.push(a,l);break;case"S":x=a,D=l,C=i[i.length-1],C.command==="C"&&(x=a+(a-C.points[2]),D=l+(l-C.points[3])),w.push(x,D,v.shift(),v.shift()),a=v.shift(),l=v.shift(),_="C",w.push(a,l);break;case"s":x=a,D=l,C=i[i.length-1],C.command==="C"&&(x=a+(a-C.points[2]),D=l+(l-C.points[3])),w.push(x,D,a+v.shift(),l+v.shift()),a+=v.shift(),l+=v.shift(),_="C",w.push(a,l);break;case"Q":w.push(v.shift(),v.shift()),a=v.shift(),l=v.shift(),w.push(a,l);break;case"q":w.push(a+v.shift(),l+v.shift()),a+=v.shift(),l+=v.shift(),_="Q",w.push(a,l);break;case"T":x=a,D=l,C=i[i.length-1],C.command==="Q"&&(x=a+(a-C.points[0]),D=l+(l-C.points[1])),a=v.shift(),l=v.shift(),_="Q",w.push(x,D,a,l);break;case"t":x=a,D=l,C=i[i.length-1],C.command==="Q"&&(x=a+(a-C.points[0]),D=l+(l-C.points[1])),a+=v.shift(),l+=v.shift(),_="Q",w.push(x,D,a,l);break;case"A":P=v.shift(),W=v.shift(),N=v.shift(),L=v.shift(),j=v.shift(),M=a,B=l,a=v.shift(),l=v.shift(),_="A",w=this.convertEndpointToCenterParameterization(M,B,a,l,L,j,P,W,N);break;case"a":P=v.shift(),W=v.shift(),N=v.shift(),L=v.shift(),j=v.shift(),M=a,B=l,a+=v.shift(),l+=v.shift(),_="A",w=this.convertEndpointToCenterParameterization(M,B,a,l,L,j,P,W,N);break}i.push({command:_||g,points:w,start:{x:E,y:k},pathLength:this.calcLength(E,k,_||g,w)})}(g==="z"||g==="Z")&&i.push({command:"z",points:[],start:void 0,pathLength:0})}return i}static calcLength(t,n,r,o){let i,s,a,l;const u=Bi;switch(r){case"L":return u.getLineLength(t,n,o[0],o[1]);case"C":return YE([t,o[0],o[2],o[4]],[n,o[1],o[3],o[5]],1);case"Q":return XE([t,o[0],o[2]],[n,o[1],o[3]],1);case"A":i=0;const d=o[4],f=o[5],p=o[4]+f;let g=Math.PI/180;if(Math.abs(d-p)<g&&(g=Math.abs(d-p)),s=u.getPointOnEllipticalArc(o[0],o[1],o[2],o[3],d,0),f<0)for(l=d-g;l>p;l-=g)a=u.getPointOnEllipticalArc(o[0],o[1],o[2],o[3],l,0),i+=u.getLineLength(s.x,s.y,a.x,a.y),s=a;else for(l=d+g;l<p;l+=g)a=u.getPointOnEllipticalArc(o[0],o[1],o[2],o[3],l,0),i+=u.getLineLength(s.x,s.y,a.x,a.y),s=a;return a=u.getPointOnEllipticalArc(o[0],o[1],o[2],o[3],p,0),i+=u.getLineLength(s.x,s.y,a.x,a.y),i}return 0}static convertEndpointToCenterParameterization(t,n,r,o,i,s,a,l,u){const d=u*(Math.PI/180),f=Math.cos(d)*(t-r)/2+Math.sin(d)*(n-o)/2,p=-1*Math.sin(d)*(t-r)/2+Math.cos(d)*(n-o)/2,g=f*f/(a*a)+p*p/(l*l);g>1&&(a*=Math.sqrt(g),l*=Math.sqrt(g));let v=Math.sqrt((a*a*(l*l)-a*a*(p*p)-l*l*(f*f))/(a*a*(p*p)+l*l*(f*f)));i===s&&(v*=-1),isNaN(v)&&(v=0);const y=v*a*p/l,_=v*-l*f/a,w=(t+r)/2+Math.cos(d)*y-Math.sin(d)*_,E=(n+o)/2+Math.sin(d)*y+Math.cos(d)*_,k=function(L){return Math.sqrt(L[0]*L[0]+L[1]*L[1])},C=function(L,j){return(L[0]*j[0]+L[1]*j[1])/(k(L)*k(j))},x=function(L,j){return(L[0]*j[1]<L[1]*j[0]?-1:1)*Math.acos(C(L,j))},D=x([1,0],[(f-y)/a,(p-_)/l]),P=[(f-y)/a,(p-_)/l],W=[(-1*f-y)/a,(-1*p-_)/l];let N=x(P,W);return C(P,W)<=-1&&(N=Math.PI),C(P,W)>=1&&(N=0),s===0&&N>0&&(N=N-2*Math.PI),s===1&&N<0&&(N=N+2*Math.PI),[w,E,a,l,D,N,d,s]}};hs.prototype.className="Path",hs.prototype._attrsAffectingSize=["data"],Yr(hs),we.addGetterSetter(hs,"data");var su=class extends pl{_sceneFunc(e){super._sceneFunc(e);const t=Math.PI*2,n=this.points();let r=n;const o=this.tension()!==0&&n.length>4;o&&(r=this.getTensionPoints());const i=this.pointerLength(),s=n.length;let a,l;if(o){const f=[r[r.length-4],r[r.length-3],r[r.length-2],r[r.length-1],n[s-2],n[s-1]],p=hs.calcLength(r[r.length-4],r[r.length-3],"C",f),g=hs.getPointOnQuadraticBezier(Math.min(1,1-i/p),f[0],f[1],f[2],f[3],f[4],f[5]);a=n[s-2]-g.x,l=n[s-1]-g.y}else a=n[s-2]-n[s-4],l=n[s-1]-n[s-3];const u=(Math.atan2(l,a)+t)%t,d=this.pointerWidth();this.pointerAtEnding()&&(e.save(),e.beginPath(),e.translate(n[s-2],n[s-1]),e.rotate(u),e.moveTo(0,0),e.lineTo(-i,d/2),e.lineTo(-i,-d/2),e.closePath(),e.restore(),this.__fillStroke(e)),this.pointerAtBeginning()&&(e.save(),e.beginPath(),e.translate(n[0],n[1]),o?(a=(r[0]+r[2])/2-n[0],l=(r[1]+r[3])/2-n[1]):(a=n[2]-n[0],l=n[3]-n[1]),e.rotate((Math.atan2(-l,-a)+t)%t),e.moveTo(0,0),e.lineTo(-i,d/2),e.lineTo(-i,-d/2),e.closePath(),e.restore(),this.__fillStroke(e))}__fillStroke(e){const t=this.dashEnabled();t&&(this.attrs.dashEnabled=!1,e.setLineDash([])),e.fillStrokeShape(this),t&&(this.attrs.dashEnabled=!0)}getSelfRect(){const e=super.getSelfRect(),t=this.pointerWidth()/2;return{x:e.x,y:e.y-t,width:e.width,height:e.height+t*2}}};su.prototype.className="Arrow",Yr(su),we.addGetterSetter(su,"pointerLength",10,Mt()),we.addGetterSetter(su,"pointerWidth",10,Mt()),we.addGetterSetter(su,"pointerAtBeginning",!1),we.addGetterSetter(su,"pointerAtEnding",!0);var Hd=class extends Et{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.attrs.radius||0,0,Math.PI*2,!1),e.closePath(),e.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(e){this.radius()!==e/2&&this.radius(e/2)}setHeight(e){this.radius()!==e/2&&this.radius(e/2)}};Hd.prototype._centroid=!0,Hd.prototype.className="Circle",Hd.prototype._attrsAffectingSize=["radius"],Yr(Hd),we.addGetterSetter(Hd,"radius",0,Mt());var lc=class extends Et{_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)}};lc.prototype.className="Ellipse",lc.prototype._centroid=!0,lc.prototype._attrsAffectingSize=["radiusX","radiusY"],Yr(lc),we.addComponentsGetterSetter(lc,"radius",["x","y"]),we.addGetterSetter(lc,"radiusX",0,Mt()),we.addGetterSetter(lc,"radiusY",0,Mt());var Rs=class l5 extends Et{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?je.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?je.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=je.createImageElement();o.onload=function(){n(new l5({image:o}))},o.onerror=r,o.crossOrigin="Anonymous",o.src=t}};Rs.prototype.className="Image",Rs.prototype._attrsAffectingSize=["image"],Yr(Rs),we.addGetterSetter(Rs,"cornerRadius",0,Fg(4)),we.addGetterSetter(Rs,"image"),we.addComponentsGetterSetter(Rs,"crop",["x","y","width","height"]),we.addGetterSetter(Rs,"cropX",0,Mt()),we.addGetterSetter(Rs,"cropY",0,Mt()),we.addGetterSetter(Rs,"cropWidth",0,Mt()),we.addGetterSetter(Rs,"cropHeight",0,Mt());var QE=["fontFamily","fontSize","fontStyle","padding","lineHeight","text","width","height","pointerDirection","pointerWidth","pointerHeight"],CH="Change.konva",kH="none",m2="up",g2="right",v2="down",y2="left",SH=QE.length,b2=class extends Ud{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<SH;n++)e.on(QE[n]+CH,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 m2:s=n/2,a=-1*l;break;case g2:s=n+i,a=r/2;break;case v2:s=n/2,a=r+l;break;case y2: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})}}};b2.prototype.className="Label",Yr(b2);var au=class extends Et{_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===m2&&(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===g2&&(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===v2&&(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===y2&&(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===m2?(t-=r,s+=r):o===v2?s+=r:o===y2?(e-=n*1.5,i+=n):o===g2&&(i+=n*1.5),{x:e,y:t,width:i,height:s}}};au.prototype.className="Tag",Yr(au),we.addGetterSetter(au,"pointerDirection",kH),we.addGetterSetter(au,"pointerWidth",0,Mt()),we.addGetterSetter(au,"pointerHeight",0,Mt()),we.addGetterSetter(au,"cornerRadius",0,Fg(4));var ap=class extends Et{_sceneFunc(e){const t=this.cornerRadius(),n=this.width(),r=this.height();e.beginPath(),t?je.drawRoundedRectPath(e,n,r,t):e.rect(0,0,n,r),e.closePath(),e.fillStrokeShape(this)}};ap.prototype.className="Rect",Yr(ap),we.addGetterSetter(ap,"cornerRadius",0,Fg(4));var cc=class extends Et{_sceneFunc(e){const t=this._getPoints(),n=this.radius(),r=this.sides(),o=this.cornerRadius();if(e.beginPath(),o)je.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)}};cc.prototype.className="RegularPolygon",cc.prototype._centroid=!0,cc.prototype._attrsAffectingSize=["radius"],Yr(cc),we.addGetterSetter(cc,"radius",0,Mt()),we.addGetterSetter(cc,"sides",0,Mt()),we.addGetterSetter(cc,"cornerRadius",0,Fg(4));var JE=Math.PI*2,lu=class extends Et{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.innerRadius(),0,JE,!1),e.moveTo(this.outerRadius(),0),e.arc(0,0,this.outerRadius(),JE,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)}};lu.prototype.className="Ring",lu.prototype._centroid=!0,lu.prototype._attrsAffectingSize=["innerRadius","outerRadius"],Yr(lu),we.addGetterSetter(lu,"innerRadius",0,Mt()),we.addGetterSetter(lu,"outerRadius",0,Mt());var ba=class extends Et{constructor(e){super(e),this._updated=!0,this.anim=new $d(()=>{const t=this._updated;return this._updated=!1,t}),this.on("animationChange.konva",function(){this.frameIndex(0)}),this.on("frameIndexChange.konva",function(){this._updated=!0}),this.on("frameRateChange.konva",function(){this.anim.isRunning()&&(clearInterval(this.interval),this._setInterval())})}_sceneFunc(e){const t=this.animation(),n=this.frameIndex(),r=n*4,o=this.animations()[t],i=this.frameOffsets(),s=o[r+0],a=o[r+1],l=o[r+2],u=o[r+3],d=this.image();if((this.hasFill()||this.hasStroke())&&(e.beginPath(),e.rect(0,0,l,u),e.closePath(),e.fillStrokeShape(this)),d)if(i){const f=i[t],p=n*2;e.drawImage(d,s,a,l,u,f[p+0],f[p+1],l,u)}else e.drawImage(d,s,a,l,u,0,0,l,u)}_hitFunc(e){const t=this.animation(),n=this.frameIndex(),r=n*4,o=this.animations()[t],i=this.frameOffsets(),s=o[r+2],a=o[r+3];if(e.beginPath(),i){const l=i[t],u=n*2;e.rect(l[u+0],l[u+1],s,a)}else e.rect(0,0,s,a);e.closePath(),e.fillShape(this)}_useBufferCanvas(){return super._useBufferCanvas(!0)}_setInterval(){const e=this;this.interval=setInterval(function(){e._updateIndex()},1e3/this.frameRate())}start(){if(this.isRunning())return;const e=this.getLayer();this.anim.setLayers(e),this._setInterval(),this.anim.start()}stop(){this.anim.stop(),clearInterval(this.interval)}isRunning(){return this.anim.isRunning()}_updateIndex(){const e=this.frameIndex(),t=this.animation();e<this.animations()[t].length/4-1?this.frameIndex(e+1):this.frameIndex(0)}};ba.prototype.className="Sprite",Yr(ba),we.addGetterSetter(ba,"animation"),we.addGetterSetter(ba,"animations"),we.addGetterSetter(ba,"frameOffsets"),we.addGetterSetter(ba,"image"),we.addGetterSetter(ba,"frameIndex",0,Mt()),we.addGetterSetter(ba,"frameRate",17,Mt()),we.backCompat(ba,{index:"frameIndex",getIndex:"getFrameIndex",setIndex:"setFrameIndex"});var uc=class extends Et{_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)}};uc.prototype.className="Star",uc.prototype._centroid=!0,uc.prototype._attrsAffectingSize=["innerRadius","outerRadius"],Yr(uc),we.addGetterSetter(uc,"numPoints",5,Mt()),we.addGetterSetter(uc,"innerRadius",0,Mt()),we.addGetterSetter(uc,"outerRadius",0,Mt());function dc(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 Gd="auto",_H="center",eT="inherit",lp="justify",AH="Change.konva",tT="2d",nT="-",rT="left",IH="text",EH="Text",TH="top",xH="bottom",oT="middle",iT="normal",RH="px ",Gg=" ",MH="right",sT="rtl",LH="word",OH="char",aT="none",w2="β¦",lT=["direction","fontFamily","fontSize","fontStyle","fontVariant","padding","align","verticalAlign","lineHeight","text","width","height","wrap","ellipsis","letterSpacing"],DH=lT.length,cp=null;function PH(){if(cp!==null)return cp;cp=!1;try{const e=document.createElement("canvas");e.width=10,e.height=10;const t=e.getContext(tT);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){cp=!0;break}}}catch{}return cp}function FH(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 Wg;function C2(){return Wg||(Wg=je.createCanvasElement().getContext(tT),Wg)}function NH(e){e.fillText(this._partialText,this._partialTextX,this._partialTextY)}function BH(e){e.setAttr("miterLimit",2),e.strokeText(this._partialText,this._partialTextX,this._partialTextY)}function zH(e){return e=e||{},!e.fillLinearGradientColorStops&&!e.fillRadialGradientColorStops&&!e.fillPatternImage&&(e.fill=e.fill||"black"),e}var xr=class extends Et{constructor(e){super(zH(e)),this._partialTextX=0,this._partialTextY=0;for(let t=0;t<DH;t++)this.on(lT[t]+AH,this._setTextData);this._setTextData()}_sceneFunc(e){var t,n;const r=this.textArr,o=r.length;if(!this.text())return;let i=this.padding(),s=this.fontSize(),a=this.lineHeight()*s,l=this.verticalAlign(),u=this.direction(),d=0,f=this.align(),p=this.getWidth(),g=this.letterSpacing(),v=this.charRenderFunc(),y=this.fill(),_=this.textDecoration(),w=this.underlineOffset(),E=_.indexOf("underline")!==-1,k=_.indexOf("line-through")!==-1,C;u=u===eT?e.direction:u;let x=a/2,D=oT;if(!Pt.legacyTextRendering){const P=this.measureSize("M");D="alphabetic",x=(((t=P.fontBoundingBoxAscent)!==null&&t!==void 0?t:P.actualBoundingBoxAscent)-((n=P.fontBoundingBoxDescent)!==null&&n!==void 0?n:P.actualBoundingBoxDescent))/2+a/2}for(u===sT&&e.setAttr("direction",u),e.setAttr("font",this._getContextFont()),e.setAttr("textBaseline",D),e.setAttr("textAlign",rT),l===oT?d=(this.getHeight()-o*a-i*2)/2:l===xH&&(d=this.getHeight()-o*a-i*2),e.translate(i,d+i),C=0;C<o;C++){let P=0,W=0;const N=r[C],L=N.text,j=N.width,M=N.lastInParagraph;if(e.save(),f===MH?P+=p-j-i*2:f===_H&&(P+=(p-j-i*2)/2),E){e.save(),e.beginPath();const R=w??(Pt.legacyTextRendering?Math.round(s/2):Math.round(s/4)),re=P,te=x+W+R;e.moveTo(re,te);const Y=f===lp&&!M?p-i*2:j;e.lineTo(re+Math.round(Y),te),e.lineWidth=s/15,e.strokeStyle=this._getLinearGradient()||y,e.stroke(),e.restore()}const B=P;if(u!==sT&&(g!==0||f===lp||v)){const R=L.split(" ").length-1,re=dc(L);for(let te=0;te<re.length;te++){const Y=re[te];if(Y===" "&&!M&&f===lp&&(P+=(p-i*2-j)/R),this._partialTextX=P,this._partialTextY=x+W,this._partialText=Y,v){e.save();const X=r.slice(0,C).reduce((U,Oe)=>U+dc(Oe.text).length,0);v({char:Y,index:te+X,x:P,y:x+W,lineIndex:C,column:te,isLastInLine:M,width:this.measureSize(Y).width,context:e})}e.fillStrokeShape(this),v&&e.restore(),P+=this.measureSize(Y).width+g}}else g!==0&&e.setAttr("letterSpacing",`${g}px`),this._partialTextX=P,this._partialTextY=x+W,this._partialText=L,e.fillStrokeShape(this);if(k){e.save(),e.beginPath();const R=Pt.legacyTextRendering?0:-Math.round(s/4),re=B;e.moveTo(re,x+W+R);const te=f===lp&&!M?p-i*2:j;e.lineTo(re+Math.round(te),x+W+R),e.lineWidth=s/15,e.strokeStyle=this._getLinearGradient()||y,e.stroke(),e.restore()}e.restore(),o>1&&(x+=a)}}_hitFunc(e){const t=this.getWidth(),n=this.getHeight();e.beginPath(),e.rect(0,0,t,n),e.closePath(),e.fillStrokeShape(this)}setText(e){const t=je._isString(e)?e:e==null?"":e+"";return this._setAttr(IH,t),this}getWidth(){return this.attrs.width===Gd||this.attrs.width===void 0?this.getTextWidth()+this.padding()*2:this.attrs.width}getHeight(){return this.attrs.height===Gd||this.attrs.height===void 0?this.fontSize()*this.textArr.length*this.lineHeight()+this.padding()*2:this.attrs.height}getTextWidth(){return this.textWidth}getTextHeight(){return je.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}measureSize(e){var t,n,r,o,i,s,a,l,u,d,f;let p=C2(),g=this.fontSize(),v;p.save(),p.font=this._getContextFont(),v=p.measureText(e),p.restore();const y=g/100;return{actualBoundingBoxAscent:(t=v.actualBoundingBoxAscent)!==null&&t!==void 0?t:71.58203125*y,actualBoundingBoxDescent:(n=v.actualBoundingBoxDescent)!==null&&n!==void 0?n:0,actualBoundingBoxLeft:(r=v.actualBoundingBoxLeft)!==null&&r!==void 0?r:-7.421875*y,actualBoundingBoxRight:(o=v.actualBoundingBoxRight)!==null&&o!==void 0?o:75.732421875*y,alphabeticBaseline:(i=v.alphabeticBaseline)!==null&&i!==void 0?i:0,emHeightAscent:(s=v.emHeightAscent)!==null&&s!==void 0?s:100*y,emHeightDescent:(a=v.emHeightDescent)!==null&&a!==void 0?a:-20*y,fontBoundingBoxAscent:(l=v.fontBoundingBoxAscent)!==null&&l!==void 0?l:91*y,fontBoundingBoxDescent:(u=v.fontBoundingBoxDescent)!==null&&u!==void 0?u:21*y,hangingBaseline:(d=v.hangingBaseline)!==null&&d!==void 0?d:72.80000305175781*y,ideographicBaseline:(f=v.ideographicBaseline)!==null&&f!==void 0?f:-21*y,width:v.width,height:g}}_getContextFont(){return this.fontStyle()+Gg+this.fontVariant()+Gg+(this.fontSize()+RH)+FH(this.fontFamily())}_addTextLine(e){this.align()===lp&&(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 C2().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!==Gd&&o!==void 0,a=i!==Gd&&i!==void 0,l=this.padding(),u=o-l*2,d=i-l*2,f=0,p=this.wrap(),g=p!==OH&&p!==aT,v=this.ellipsis();this.textArr=[],C2().font=this._getContextFont();const y=v?this._getTextWidth(w2):0;for(let _=0,w=e.length;_<w;++_){let E=e[_],k=this._getTextWidth(E);if(s&&k>u)for(;E.length>0;){let C=0,x=dc(E).length,D="",P=0;for(;C<x;){const W=C+x>>>1,N=dc(E).slice(0,W+1).join(""),L=this._getTextWidth(N);(v&&a&&f+r>d?L+y:L)<=u?(C=W+1,D=N,P=L):x=W}if(D){if(g){const W=dc(E),N=dc(D),L=W[N.length],j=L===Gg||L===nT;let M;if(j&&P<=u)M=N.length;else{const B=N.lastIndexOf(Gg),R=N.lastIndexOf(nT);M=Math.max(B,R)+1}M>0&&(C=M,D=W.slice(0,C).join(""),P=this._getTextWidth(D))}if(D=D.trimRight(),this._addTextLine(D),n=Math.max(n,P),f+=r,this._shouldHandleEllipsis(f)){this._tryToAddEllipsisToLastLine();break}if(E=dc(E).slice(C).join("").trimLeft(),E.length>0&&(k=this._getTextWidth(E),k<=u)){this._addTextLine(E),f+=r,n=Math.max(n,k);break}}else break}else this._addTextLine(E),f+=r,n=Math.max(n,k),this._shouldHandleEllipsis(f)&&_<w-1&&this._tryToAddEllipsisToLastLine();if(this.textArr[this.textArr.length-1]&&(this.textArr[this.textArr.length-1].lastInParagraph=!0),a&&f+r>d)break}this.textHeight=t,this.textWidth=n}_shouldHandleEllipsis(e){const t=+this.fontSize(),n=this.lineHeight()*t,r=this.attrs.height,o=r!==Gd&&r!==void 0,i=r-this.padding()*2;return this.wrap()===aT||o&&e+n>i}_tryToAddEllipsisToLastLine(){const e=this.attrs.width,t=e!==Gd&&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+w2)<n||(o.text=o.text.slice(0,o.text.length-3))),this.textArr.splice(this.textArr.length-1,1),this._addTextLine(o.text+w2))}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&&PH()?!0:super._useBufferCanvas()}};xr.prototype._fillFunc=NH,xr.prototype._strokeFunc=BH,xr.prototype.className=EH,xr.prototype._attrsAffectingSize=["text","fontSize","padding","wrap","lineHeight","letterSpacing"],Yr(xr),we.overWriteSetter(xr,"width",n2()),we.overWriteSetter(xr,"height",n2()),we.addGetterSetter(xr,"direction",eT),we.addGetterSetter(xr,"fontFamily","Arial"),we.addGetterSetter(xr,"fontSize",12,Mt()),we.addGetterSetter(xr,"fontStyle",iT),we.addGetterSetter(xr,"fontVariant",iT),we.addGetterSetter(xr,"padding",0,Mt()),we.addGetterSetter(xr,"align",rT),we.addGetterSetter(xr,"verticalAlign",TH),we.addGetterSetter(xr,"lineHeight",1,Mt()),we.addGetterSetter(xr,"wrap",LH),we.addGetterSetter(xr,"ellipsis",!1,xs()),we.addGetterSetter(xr,"letterSpacing",0,Mt()),we.addGetterSetter(xr,"text","",ru()),we.addGetterSetter(xr,"textDecoration",""),we.addGetterSetter(xr,"underlineOffset",void 0,Mt()),we.addGetterSetter(xr,"charRenderFunc",void 0);var VH="",cT="normal";function uT(e){e.fillText(this.partialText,0,0)}function dT(e){e.strokeText(this.partialText,0,0)}var Co=class extends Et{constructor(e){super(e),this.dummyCanvas=je.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 hs.getPathLength(this.dataArray)}_getPointAtLength(e){return!this.attrs.data||e>this.pathLength?null:hs.getPointAtLengthOfDataArray(e,this.dataArray)}_readDataAttribute(){this.dataArray=hs.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 je.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}setText(e){return xr.prototype.setText.call(this,e)}_getContextFont(){return xr.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=dc(this.text()),t=[];let n=0;for(let p=0;p<e.length;p++)t.push({char:e[p],width:this._getTextSize(e[p]).width}),n+=t[p].width;const{width:r,height:o}=this._getTextSize(this.attrs.text);if(this.textWidth=n,this.textHeight=o,this.glyphInfo=[],!this.attrs.data)return null;const i=this.letterSpacing(),s=this.align(),a=this.kerningFunc(),l=Math.max(0,n-r),u=Math.max(this.textWidth+((this.attrs.text||"").length-1)*i,0);let d=0;s==="center"&&(d=Math.max(0,this.pathLength/2-u/2)),s==="right"&&(d=Math.max(0,this.pathLength-u));let f=d;for(let p=0;p<t.length;p++){const g=this._getPointAtLength(f);if(!g)return;const v=t[p].char;let y=t[p].width+i;if(v===" "&&s==="justify"){const D=this.text().split(" ").length-1;y+=(this.pathLength-u)/D}const _=f+y,w=this._getPointAtLength(_>this.pathLength&&_-this.pathLength<=l?this.pathLength:_);if(!w)return;const E=hs.getLineLength(g.x,g.y,w.x,w.y);let k=0;if(a)try{k=a(t[p-1].char,v)*this.fontSize()}catch{k=0}g.x+=k,w.x+=k,this.textWidth+=k;const C=hs.getPointOnLine(k+E/2,g.x,g.y,w.x,w.y),x=Math.atan2(w.y-g.y,w.x-g.x);this.glyphInfo.push({transposeX:C.x,transposeY:C.y,text:e[p],rotation:x,p0:g,p1:w,width:E}),f+=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 je.releaseCanvas(this.dummyCanvas),super.destroy()}};Co.prototype._fillFunc=uT,Co.prototype._strokeFunc=dT,Co.prototype._fillFuncHit=uT,Co.prototype._strokeFuncHit=dT,Co.prototype.className="TextPath",Co.prototype._attrsAffectingSize=["text","fontSize","data"],Yr(Co),we.addGetterSetter(Co,"data"),we.addGetterSetter(Co,"fontFamily","Arial"),we.addGetterSetter(Co,"fontSize",12,Mt()),we.addGetterSetter(Co,"fontStyle",cT),we.addGetterSetter(Co,"align","left"),we.addGetterSetter(Co,"letterSpacing",0,Mt()),we.addGetterSetter(Co,"textBaseline","middle"),we.addGetterSetter(Co,"fontVariant",cT),we.addGetterSetter(Co,"text",VH),we.addGetterSetter(Co,"textDecoration",""),we.addGetterSetter(Co,"kerningFunc",void 0);var fT="tr-konva",jH=["resizeEnabledChange","rotateAnchorOffsetChange","rotateAnchorAngleChange","rotateEnabledChange","enabledAnchorsChange","anchorSizeChange","borderEnabledChange","borderStrokeChange","borderStrokeWidthChange","borderDashChange","anchorStrokeChange","anchorStrokeWidthChange","anchorFillChange","anchorCornerRadiusChange","ignoreStrokeChange","anchorStyleFuncChange"].map(e=>e+`.${fT}`).join(" "),hT="nodesRect",UH=["widthChange","heightChange","scaleXChange","scaleYChange","skewXChange","skewYChange","rotationChange","offsetXChange","offsetYChange","transformsEnabledChange","strokeWidthChange","draggableChange"],$H={"top-left":-45,"top-center":0,"top-right":45,"middle-right":-90,"middle-left":90,"bottom-left":-135,"bottom-center":180,"bottom-right":135},HH="ontouchstart"in Pt._global;function GH(e,t,n){if(e==="rotater")return n;t+=je.degToRad($H[e]||0);const r=(je.radToDeg(t)%360+360)%360;return je._inRange(r,337.5,360)||je._inRange(r,0,22.5)?"ns-resize":je._inRange(r,22.5,67.5)?"nesw-resize":je._inRange(r,67.5,112.5)?"ew-resize":je._inRange(r,112.5,157.5)?"nwse-resize":je._inRange(r,157.5,202.5)?"ns-resize":je._inRange(r,202.5,247.5)?"nesw-resize":je._inRange(r,247.5,292.5)?"ew-resize":je._inRange(r,292.5,337.5)?"nwse-resize":(je.error("Transformer has unknown angle for cursor detection: "+r),"pointer")}var Kg=["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"];function WH(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 pT(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 KH(e,t){return pT(e,t,WH(e))}function qH(e,t,n){let r=t;for(let o=0;o<e.length;o++){const i=Pt.getAngle(e[o]),s=Math.abs(i-t)%(Math.PI*2);Math.min(s,Math.PI*2-s)<n&&(r=i)}return r}var k2=0,Zn=class extends Ud{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(jH,this.update),this.getNode()&&this.update()}attachTo(e){return this.setNode(e),this}setNode(e){return je.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 fT+this._id}setNodes(e=[]){this._nodes&&this._nodes.length&&this.detach();const t=e.filter(n=>n.isAncestorOf(this)?(je.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(UH.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(hT),this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")}_getNodeRect(){return this._getCache(hT,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=(Pt.getAngle(e.getAbsoluteRotation())+Math.PI*2)%(Math.PI*2);return pT({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},-Pt.getAngle(t),{x:0,y:0})}__getNodeRect(){if(!this.getNode())return{x:-1e8,y:-1e8,width:0,height:0,rotation:0};const e=[];this.nodes().map(a=>{const l=a.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),u=[{x:l.x,y:l.y},{x:l.x+l.width,y:l.y},{x:l.x+l.width,y:l.y+l.height},{x:l.x,y:l.y+l.height}],d=a.getAbsoluteTransform();u.forEach(function(f){const p=d.point(f);e.push(p)})});const t=new Ts;t.rotate(-Pt.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:Pt.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(),Kg.forEach(e=>{this._createAnchor(e)}),this._createAnchor("rotater"),this._elementsCreated=!0}_createAnchor(e){const t=new ap({stroke:"rgb(0, 161, 255)",fill:"white",strokeWidth:1,name:e+" _anchor",dragDistance:0,draggable:!0,hitStrokeWidth:HH?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=GH(e,Pt.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 Et({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=je.degToRad(a),d=Math.sin(u),f=-Math.cos(u),p=i/2,g=s/2;let v=1/0;f<0?v=Math.min(v,-g/f):f>0&&(v=Math.min(v,(s-g)/f)),d<0?v=Math.min(v,-p/d):d>0&&(v=Math.min(v,(i-p)/d));const y=p+d*v,_=g+f*v,w=je._sign(s),E=y+d*l*w,k=_+f*l*w;t.moveTo(y,_),t.lineTo(E,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},k2++,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 E=Pt.getAngle(this.rotateAnchorAngle());let k=Math.atan2(-n,t)+Math.PI/2-E;w.height<0&&(k-=Math.PI);const C=Pt.getAngle(this.rotation())+k,x=Pt.getAngle(this.rotationSnapTolerance()),D=KH(w,qH(this.rotationSnaps(),C,x)-w.rotation);this._fitNodesInto(D,e);return}const d=this.shiftBehavior();let f;d==="inverted"?f=this.keepRatio()&&!e.shiftKey:d==="none"?f=this.keepRatio():f=this.keepRatio()||e.shiftKey;let p=this.centeredScaling()||e.altKey;if(this._movingAnchorName==="top-left"){if(f){const w=p?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-right").x(),y:this.findOne(".bottom-right").y()};r=Math.sqrt(Math.pow(w.x-o.x(),2)+Math.pow(w.y-o.y(),2));const E=this.findOne(".top-left").x()>w.x?-1:1,k=this.findOne(".top-left").y()>w.y?-1:1;t=r*this.cos*E,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(f){const w=p?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-left").x(),y:this.findOne(".bottom-left").y()};r=Math.sqrt(Math.pow(o.x()-w.x,2)+Math.pow(w.y-o.y(),2));const E=this.findOne(".top-right").x()<w.x?-1:1,k=this.findOne(".top-right").y()>w.y?-1:1;t=r*this.cos*E,n=r*this.sin*k,this.findOne(".top-right").x(w.x+t),this.findOne(".top-right").y(w.y-n)}var g=o.position();this.findOne(".top-left").y(g.y),this.findOne(".bottom-right").x(g.x)}else if(this._movingAnchorName==="middle-left")this.findOne(".top-left").x(o.x());else if(this._movingAnchorName==="middle-right")this.findOne(".bottom-right").x(o.x());else if(this._movingAnchorName==="bottom-left"){if(f){const w=p?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-right").x(),y:this.findOne(".top-right").y()};r=Math.sqrt(Math.pow(w.x-o.x(),2)+Math.pow(o.y()-w.y,2));const E=w.x<o.x()?-1:1,k=o.y()<w.y?-1:1;t=r*this.cos*E,n=r*this.sin*k,o.x(w.x-t),o.y(w.y+n)}g=o.position(),this.findOne(".top-left").x(g.x),this.findOne(".bottom-right").y(g.y)}else if(this._movingAnchorName==="bottom-center")this.findOne(".bottom-right").y(o.y());else if(this._movingAnchorName==="bottom-right"){if(f){const w=p?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-left").x(),y:this.findOne(".top-left").y()};r=Math.sqrt(Math.pow(o.x()-w.x,2)+Math.pow(o.y()-w.y,2));const E=this.findOne(".bottom-right").x()<w.x?-1:1,k=this.findOne(".bottom-right").y()<w.y?-1:1;t=r*this.cos*E,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"),E=this.findOne(".bottom-right"),k=w.x(),C=w.y(),x=this.getWidth()-E.x(),D=this.getHeight()-E.y();E.move({x:-k,y:-C}),w.move({x,y:D})}const v=this.findOne(".top-left").getAbsolutePosition();t=v.x,n=v.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:Pt.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();k2--,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(je._inRange(e.width,-this.padding()*2-r,r)){this.update();return}if(je._inRange(e.height,-this.padding()*2-r,r)){this.update();return}const o=new Ts;if(o.rotate(Pt.getAngle(this.rotation())),this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf("left")>=0){const f=o.point({x:-this.padding()*2,y:0});e.x+=f.x,e.y+=f.y,e.width+=this.padding()*2,this._movingAnchorName=this._movingAnchorName.replace("left","right"),this._anchorDragOffset.x-=f.x,this._anchorDragOffset.y-=f.y}else if(this._movingAnchorName&&e.width<0&&this._movingAnchorName.indexOf("right")>=0){const f=o.point({x:this.padding()*2,y:0});this._movingAnchorName=this._movingAnchorName.replace("right","left"),this._anchorDragOffset.x-=f.x,this._anchorDragOffset.y-=f.y,e.width+=this.padding()*2}if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf("top")>=0){const f=o.point({x:0,y:-this.padding()*2});e.x+=f.x,e.y+=f.y,this._movingAnchorName=this._movingAnchorName.replace("top","bottom"),this._anchorDragOffset.x-=f.x,this._anchorDragOffset.y-=f.y,e.height+=this.padding()*2}else if(this._movingAnchorName&&e.height<0&&this._movingAnchorName.indexOf("bottom")>=0){const f=o.point({x:0,y:this.padding()*2});this._movingAnchorName=this._movingAnchorName.replace("bottom","top"),this._anchorDragOffset.x-=f.x,this._anchorDragOffset.y-=f.y,e.height+=this.padding()*2}if(this.boundBoxFunc()){const f=this.boundBoxFunc()(n,e);f?e=f:je.warn("boundBoxFunc returned falsy. You should return new bound rect from it!")}const i=1e7,s=new Ts;s.translate(n.x,n.y),s.rotate(n.rotation),s.scale(n.width/i,n.height/i);const a=new Ts,l=e.width/i,u=e.height/i;this.flipEnabled()===!1?(a.translate(e.x,e.y),a.rotate(e.rotation),a.translate(e.width<0?e.width:0,e.height<0?e.height:0),a.scale(Math.abs(l),Math.abs(u))):(a.translate(e.x,e.y),a.rotate(e.rotation),a.scale(l,u));const d=a.multiply(s.invert());this._nodes.forEach(f=>{var p;if(!f.getStage())return;const g=f.getParent().getAbsoluteTransform(),v=f.getTransform().copy();v.translate(f.offsetX(),f.offsetY());const y=new Ts;y.multiply(g.copy().invert()).multiply(d).multiply(g).multiply(v);const _=y.decompose();f.setAttrs(_),(p=f.getLayer())===null||p===void 0||p.batchDraw()}),this.rotation(je._getRotation(e.rotation)),this._nodes.forEach(f=>{this._fire("transform",{evt:t,target:f}),f._fire("transform",{evt:t,target:f})}),this._resetTransformCache(),this.update(),this.getLayer().batchDraw()}forceUpdate(){this._resetTransformCache(),this.update()}_batchChangeChild(e,t){this.findOne(e).setAttrs(t)}update(){var e;const t=this._getNodeRect();this.rotation(je._getRotation(t.rotation));const n=t.width,r=t.height,o=this.enabledAnchors(),i=this.resizeEnabled(),s=this.padding(),a=this.anchorSize(),l=this.find("._anchor");l.forEach(x=>{x.setAttrs({width:a,height:a,offsetX:a/2,offsetY:a/2,stroke:this.anchorStroke(),strokeWidth:this.anchorStrokeWidth(),fill:this.anchorFill(),cornerRadius:this.anchorCornerRadius()})}),this._batchChangeChild(".top-left",{x:0,y:0,offsetX:a/2+s,offsetY:a/2+s,visible:i&&o.indexOf("top-left")>=0}),this._batchChangeChild(".top-center",{x:n/2,y:0,offsetY:a/2+s,visible:i&&o.indexOf("top-center")>=0}),this._batchChangeChild(".top-right",{x:n,y:0,offsetX:a/2-s,offsetY:a/2+s,visible:i&&o.indexOf("top-right")>=0}),this._batchChangeChild(".middle-left",{x:0,y:r/2,offsetX:a/2+s,visible:i&&o.indexOf("middle-left")>=0}),this._batchChangeChild(".middle-right",{x:n,y:r/2,offsetX:a/2-s,visible:i&&o.indexOf("middle-right")>=0}),this._batchChangeChild(".bottom-left",{x:0,y:r,offsetX:a/2+s,offsetY:a/2-s,visible:i&&o.indexOf("bottom-left")>=0}),this._batchChangeChild(".bottom-center",{x:n/2,y:r,offsetY:a/2-s,visible:i&&o.indexOf("bottom-center")>=0}),this._batchChangeChild(".bottom-right",{x:n,y:r,offsetX:a/2-s,offsetY:a/2-s,visible:i&&o.indexOf("bottom-right")>=0});const u=this.rotateAnchorAngle(),d=this.rotateAnchorOffset(),f=je.degToRad(u),p=Math.sin(f),g=-Math.cos(f),v=n/2,y=r/2;let _=1/0;g<0?_=Math.min(_,-y/g):g>0&&(_=Math.min(_,(r-y)/g)),p<0?_=Math.min(_,-v/p):p>0&&(_=Math.min(_,(n-v)/p));const w=v+p*_,E=y+g*_,k=je._sign(r);this._batchChangeChild(".rotater",{x:w+p*d*k,y:E+g*d*k-s*g,visible:this.rotateEnabled()}),this._batchChangeChild(".back",{width:n,height:r,visible:this.borderEnabled(),stroke:this.borderStroke(),strokeWidth:this.borderStrokeWidth(),dash:this.borderDash(),draggable:this.nodes().some(x=>x.draggable()),x:0,y:0});const C=this.anchorStyleFunc();C&&l.forEach(x=>{C(x)}),(e=this.getLayer())===null||e===void 0||e.batchDraw()}isTransforming(){return this._transforming}stopTransform(){if(this._transforming){this._removeEvents();const e=this.findOne("."+this._movingAnchorName);e&&e.stopDrag()}}destroy(){return this.getStage()&&this._cursorChange&&this.getStage().content&&(this.getStage().content.style.cursor=""),Ud.prototype.destroy.call(this),this.detach(),this._removeEvents(),this}add(...e){return this._elementsCreated?(je.error("You cannot add external nodes to the Transformer. Use tr.nodes([node]) instead."),this):super.add(...e)}toObject(){return Nt.prototype.toObject.call(this)}clone(e){return Nt.prototype.clone.call(this,e)}getClientRect(){return this.nodes().length>0?super.getClientRect():{x:0,y:0,width:0,height:0}}};Zn.isTransforming=()=>k2>0;function YH(e){return e instanceof Array||je.warn("enabledAnchors value should be an array"),e instanceof Array&&e.forEach(function(t){Kg.indexOf(t)===-1&&je.warn("Unknown anchor name: "+t+". Available names are: "+Kg.join(", "))}),e||[]}Zn.prototype.className="Transformer",Yr(Zn),we.addGetterSetter(Zn,"enabledAnchors",Kg,YH),we.addGetterSetter(Zn,"flipEnabled",!0,xs()),we.addGetterSetter(Zn,"resizeEnabled",!0),we.addGetterSetter(Zn,"anchorSize",10,Mt()),we.addGetterSetter(Zn,"rotateEnabled",!0),we.addGetterSetter(Zn,"rotateLineVisible",!0),we.addGetterSetter(Zn,"rotationSnaps",[]),we.addGetterSetter(Zn,"rotateAnchorOffset",50,Mt()),we.addGetterSetter(Zn,"rotateAnchorAngle",0,Mt()),we.addGetterSetter(Zn,"rotateAnchorCursor","crosshair"),we.addGetterSetter(Zn,"rotationSnapTolerance",5,Mt()),we.addGetterSetter(Zn,"borderEnabled",!0),we.addGetterSetter(Zn,"anchorStroke","rgb(0, 161, 255)"),we.addGetterSetter(Zn,"anchorStrokeWidth",1,Mt()),we.addGetterSetter(Zn,"anchorFill","white"),we.addGetterSetter(Zn,"anchorCornerRadius",0,Mt()),we.addGetterSetter(Zn,"borderStroke","rgb(0, 161, 255)"),we.addGetterSetter(Zn,"borderStrokeWidth",1,Mt()),we.addGetterSetter(Zn,"borderDash"),we.addGetterSetter(Zn,"keepRatio",!0),we.addGetterSetter(Zn,"shiftBehavior","default"),we.addGetterSetter(Zn,"centeredScaling",!1),we.addGetterSetter(Zn,"ignoreStroke",!1),we.addGetterSetter(Zn,"padding",0,Mt()),we.addGetterSetter(Zn,"nodes"),we.addGetterSetter(Zn,"node"),we.addGetterSetter(Zn,"boundBoxFunc"),we.addGetterSetter(Zn,"anchorDragBoundFunc"),we.addGetterSetter(Zn,"anchorStyleFunc"),we.addGetterSetter(Zn,"shouldOverdrawWholeArea",!1),we.addGetterSetter(Zn,"useSingleNodeRotation",!0),we.backCompat(Zn,{lineEnabled:"borderEnabled",rotateHandlerOffset:"rotateAnchorOffset",enabledHandlers:"enabledAnchors"});var ml=class extends Et{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.radius(),0,Pt.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)}};ml.prototype.className="Wedge",ml.prototype._centroid=!0,ml.prototype._attrsAffectingSize=["radius"],Yr(ml),we.addGetterSetter(ml,"radius",0,Mt()),we.addGetterSetter(ml,"angle",0,Mt()),we.addGetterSetter(ml,"clockwise",!1),we.backCompat(ml,{angleDeg:"angle",getAngleDeg:"getAngle",setAngleDeg:"setAngle"});function mT(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}var XH=[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],ZH=[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 QH(e,t){const n=e.data,r=e.width,o=e.height;let i,s,a,l,u,d,f,p,g,v,y,_,w,E,k,C,x,D,P,W;const N=t+t+1,L=r-1,j=o-1,M=t+1,B=M*(M+1)/2,R=new mT,re=XH[t],te=ZH[t];let Y=null,X=R,U=null,Oe=null;for(let me=1;me<N;me++)X=X.next=new mT,me===M&&(Y=X);X.next=R,a=s=0;for(let me=0;me<o;me++){_=w=E=k=l=u=d=f=0,p=M*(C=n[s]),g=M*(x=n[s+1]),v=M*(D=n[s+2]),y=M*(P=n[s+3]),l+=B*C,u+=B*x,d+=B*D,f+=B*P,X=R;for(let ce=0;ce<M;ce++)X.r=C,X.g=x,X.b=D,X.a=P,X=X.next;for(let ce=1;ce<M;ce++)i=s+((L<ce?L:ce)<<2),l+=(X.r=C=n[i])*(W=M-ce),u+=(X.g=x=n[i+1])*W,d+=(X.b=D=n[i+2])*W,f+=(X.a=P=n[i+3])*W,_+=C,w+=x,E+=D,k+=P,X=X.next;U=R,Oe=Y;for(let ce=0;ce<r;ce++)n[s+3]=P=f*re>>te,P!==0?(P=255/P,n[s]=(l*re>>te)*P,n[s+1]=(u*re>>te)*P,n[s+2]=(d*re>>te)*P):n[s]=n[s+1]=n[s+2]=0,l-=p,u-=g,d-=v,f-=y,p-=U.r,g-=U.g,v-=U.b,y-=U.a,i=a+((i=ce+t+1)<L?i:L)<<2,_+=U.r=n[i],w+=U.g=n[i+1],E+=U.b=n[i+2],k+=U.a=n[i+3],l+=_,u+=w,d+=E,f+=k,U=U.next,p+=C=Oe.r,g+=x=Oe.g,v+=D=Oe.b,y+=P=Oe.a,_-=C,w-=x,E-=D,k-=P,Oe=Oe.next,s+=4;a+=r}for(let me=0;me<r;me++){w=E=k=_=u=d=f=l=0,s=me<<2,p=M*(C=n[s]),g=M*(x=n[s+1]),v=M*(D=n[s+2]),y=M*(P=n[s+3]),l+=B*C,u+=B*x,d+=B*D,f+=B*P,X=R;for(let ve=0;ve<M;ve++)X.r=C,X.g=x,X.b=D,X.a=P,X=X.next;let ce=r;for(let ve=1;ve<=t;ve++)s=ce+me<<2,l+=(X.r=C=n[s])*(W=M-ve),u+=(X.g=x=n[s+1])*W,d+=(X.b=D=n[s+2])*W,f+=(X.a=P=n[s+3])*W,_+=C,w+=x,E+=D,k+=P,X=X.next,ve<j&&(ce+=r);s=me,U=R,Oe=Y;for(let ve=0;ve<o;ve++)i=s<<2,n[i+3]=P=f*re>>te,P>0?(P=255/P,n[i]=(l*re>>te)*P,n[i+1]=(u*re>>te)*P,n[i+2]=(d*re>>te)*P):n[i]=n[i+1]=n[i+2]=0,l-=p,u-=g,d-=v,f-=y,p-=U.r,g-=U.g,v-=U.b,y-=U.a,i=me+((i=ve+M)<j?i:j)*r<<2,l+=_+=U.r=n[i],u+=w+=U.g=n[i+1],d+=E+=U.b=n[i+2],f+=k+=U.a=n[i+3],U=U.next,p+=C=Oe.r,g+=x=Oe.g,v+=D=Oe.b,y+=P=Oe.a,_-=C,w-=x,E-=D,k-=P,Oe=Oe.next,s+=r}}var JH=function(t){const n=Math.round(this.blurRadius());n>0&&QH(t,n)};we.addGetterSetter(Nt,"blurRadius",0,Mt(),we.afterSetFilter);var eG=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};we.addGetterSetter(Nt,"brightness",0,Mt(),we.afterSetFilter);var tG=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)},nG=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};we.addGetterSetter(Nt,"contrast",0,Mt(),we.afterSetFilter);var rG=function(e){var t,n,r,o,i,s,a,l,u;const d=e.data,f=e.width,p=e.height,g=Math.min(1,Math.max(0,(n=(t=this.embossStrength)===null||t===void 0?void 0:t.call(this))!==null&&n!==void 0?n:.5)),v=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=g*10,E=v*255,k=y*Math.PI/180,C=Math.cos(k),x=Math.sin(k),D=128/1020*w,P=new Uint8ClampedArray(d),W=new Float32Array(f*p);for(let B=0,R=0;R<d.length;R+=4,B++)W[B]=.2126*P[R]+.7152*P[R+1]+.0722*P[R+2];const N=[-1,0,1,-2,0,2,-1,0,1],L=[-1,-2,-1,0,0,0,1,2,1],j=[-f-1,-f,-f+1,-1,0,1,f-1,f,f+1],M=B=>B<0?0:B>255?255:B;for(let B=1;B<p-1;B++)for(let R=1;R<f-1;R++){const re=B*f+R;let te=0,Y=0;te+=W[re+j[0]]*N[0],Y+=W[re+j[0]]*L[0],te+=W[re+j[1]]*N[1],Y+=W[re+j[1]]*L[1],te+=W[re+j[2]]*N[2],Y+=W[re+j[2]]*L[2],te+=W[re+j[3]]*N[3],Y+=W[re+j[3]]*L[3],te+=W[re+j[5]]*N[5],Y+=W[re+j[5]]*L[5],te+=W[re+j[6]]*N[6],Y+=W[re+j[6]]*L[6],te+=W[re+j[7]]*N[7],Y+=W[re+j[7]]*L[7],te+=W[re+j[8]]*N[8],Y+=W[re+j[8]]*L[8];const X=M(E+(C*te+x*Y)*D),U=re*4;if(_){const Oe=X-E;d[U]=M(P[U]+Oe),d[U+1]=M(P[U+1]+Oe),d[U+2]=M(P[U+2]+Oe),d[U+3]=P[U+3]}else d[U]=d[U+1]=d[U+2]=X,d[U+3]=P[U+3]}for(let B=0;B<f;B++){let R=B*4,re=((p-1)*f+B)*4;d[R]=P[R],d[R+1]=P[R+1],d[R+2]=P[R+2],d[R+3]=P[R+3],d[re]=P[re],d[re+1]=P[re+1],d[re+2]=P[re+2],d[re+3]=P[re+3]}for(let B=1;B<p-1;B++){let R=B*f*4,re=(B*f+(f-1))*4;d[R]=P[R],d[R+1]=P[R+1],d[R+2]=P[R+2],d[R+3]=P[R+3],d[re]=P[re],d[re+1]=P[re+1],d[re+2]=P[re+2],d[re+3]=P[re+3]}return e};we.addGetterSetter(Nt,"embossStrength",.5,Mt(),we.afterSetFilter),we.addGetterSetter(Nt,"embossWhiteLevel",.5,Mt(),we.afterSetFilter),we.addGetterSetter(Nt,"embossDirection","top-left",void 0,we.afterSetFilter),we.addGetterSetter(Nt,"embossBlend",!1,void 0,we.afterSetFilter);function S2(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 oG=function(e){const t=e.data,n=t.length;let r=t[0],o=r,i,s=t[1],a=s,l,u=t[2],d=u,f;const p=this.enhance();if(p===0)return;for(let 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),f=t[k+2],f<u?u=f:f>d&&(d=f);o===r&&(o=255,r=0),a===s&&(a=255,s=0),d===u&&(d=255,u=0);let g,v,y,_,w,E;if(p>0)g=o+p*(255-o),v=r-p*(r-0),y=a+p*(255-a),_=s-p*(s-0),w=d+p*(255-d),E=u-p*(u-0);else{const k=(o+r)*.5;g=o+p*(o-k),v=r+p*(r-k);const C=(a+s)*.5;y=a+p*(a-C),_=s+p*(s-C);const x=(d+u)*.5;w=d+p*(d-x),E=u+p*(u-x)}for(let k=0;k<n;k+=4)t[k+0]=S2(t[k+0],r,o,v,g),t[k+1]=S2(t[k+1],s,a,_,y),t[k+2]=S2(t[k+2],u,d,E,w)};we.addGetterSetter(Nt,"enhance",0,Mt(),we.afterSetFilter);var iG=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}};we.addGetterSetter(Nt,"hue",0,Mt(),we.afterSetFilter),we.addGetterSetter(Nt,"saturation",0,Mt(),we.afterSetFilter),we.addGetterSetter(Nt,"luminance",0,Mt(),we.afterSetFilter);var sG=function(e){const t=e.data,n=t.length,r=1,o=Math.pow(2,this.saturation()),i=Math.abs(this.hue()+360)%360,s=this.luminance()*127,a=r*o*Math.cos(i*Math.PI/180),l=r*o*Math.sin(i*Math.PI/180),u=.299*r+.701*a+.167*l,d=.587*r-.587*a+.33*l,f=.114*r-.114*a-.497*l,p=.299*r-.299*a-.328*l,g=.587*r+.413*a+.035*l,v=.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 E,k,C,x;for(let D=0;D<n;D+=4)E=t[D+0],k=t[D+1],C=t[D+2],x=t[D+3],t[D+0]=u*E+d*k+f*C+s,t[D+1]=p*E+g*k+v*C+s,t[D+2]=y*E+_*k+w*C+s,t[D+3]=x},aG=function(e){const t=e.data,n=t.length,r=Math.pow(2,this.value()),o=Math.pow(2,this.saturation()),i=Math.abs(this.hue()+360)%360,s=r*o*Math.cos(i*Math.PI/180),a=r*o*Math.sin(i*Math.PI/180),l=.299*r+.701*s+.167*a,u=.587*r-.587*s+.33*a,d=.114*r-.114*s-.497*a,f=.299*r-.299*s-.328*a,p=.587*r+.413*s+.035*a,g=.114*r-.114*s+.293*a,v=.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 E=t[w+0],k=t[w+1],C=t[w+2],x=t[w+3];t[w+0]=l*E+u*k+d*C,t[w+1]=f*E+p*k+g*C,t[w+2]=v*E+y*k+_*C,t[w+3]=x}};we.addGetterSetter(Nt,"hue",0,Mt(),we.afterSetFilter),we.addGetterSetter(Nt,"saturation",0,Mt(),we.afterSetFilter),we.addGetterSetter(Nt,"value",0,Mt(),we.afterSetFilter);var lG=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]},cG=function(e,t,n){const r=e.data,o=t.data,i=e.width,s=e.height,a=n.polarCenterX||i/2,l=n.polarCenterY||s/2;let u=Math.sqrt(a*a+l*l),d=i-a,f=s-l;const p=Math.sqrt(d*d+f*f);u=p>u?p:u;const g=s,v=i,y=360/v*Math.PI/180;for(let _=0;_<v;_+=1){const w=Math.sin(_*y),E=Math.cos(_*y);for(let k=0;k<g;k+=1){d=Math.floor(a+u*k/g*E),f=Math.floor(l+u*k/g*w);let C=(f*i+d)*4;const x=r[C+0],D=r[C+1],P=r[C+2],W=r[C+3];C=(_+k*i)*4,o[C+0]=x,o[C+1]=D,o[C+2]=P,o[C+3]=W}}},uG=function(e,t,n){const r=e.data,o=t.data,i=e.width,s=e.height,a=n.polarCenterX||i/2,l=n.polarCenterY||s/2;let u=Math.sqrt(a*a+l*l),d=i-a,f=s-l;const p=Math.sqrt(d*d+f*f);u=p>u?p:u;const g=s,v=i,y=n.polarRotation||0;let _,w;for(d=0;d<i;d+=1)for(f=0;f<s;f+=1){const E=d-a,k=f-l,C=Math.sqrt(E*E+k*k)*g/u;let x=(Math.atan2(k,E)*180/Math.PI+360+y)%360;x=x*v/360,_=Math.floor(x),w=Math.floor(C);let D=(w*i+_)*4;const P=r[D+0],W=r[D+1],N=r[D+2],L=r[D+3];D=(f*i+d)*4,o[D+0]=P,o[D+1]=W,o[D+2]=N,o[D+3]=L}},dG=function(e){const t=e.width,n=e.height;let r,o,i,s,a,l,u,d,f,p,g=Math.round(this.kaleidoscopePower());const v=Math.round(this.kaleidoscopeAngle()),y=Math.floor(t*(v%360)/360);if(g<1)return;const _=je.createCanvasElement();_.width=t,_.height=n;const w=_.getContext("2d").getImageData(0,0,t,n);je.releaseCanvas(_),cG(e,w,{polarCenterX:t/2,polarCenterY:n/2});let E=t/Math.pow(2,g);for(;E<=8;)E=E*2,g-=1;E=Math.ceil(E);let k=E,C=0,x=k,D=1;for(y+E>t&&(C=k,x=0,D=-1),o=0;o<n;o+=1)for(r=C;r!==x;r+=D)i=Math.round(r+y)%t,f=(t*o+i)*4,a=w.data[f+0],l=w.data[f+1],u=w.data[f+2],d=w.data[f+3],p=(t*o+r)*4,w.data[p+0]=a,w.data[p+1]=l,w.data[p+2]=u,w.data[p+3]=d;for(o=0;o<n;o+=1)for(k=Math.floor(E),s=0;s<g;s+=1){for(r=0;r<k+1;r+=1)f=(t*o+r)*4,a=w.data[f+0],l=w.data[f+1],u=w.data[f+2],d=w.data[f+3],p=(t*o+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}uG(w,e,{polarRotation:0})};we.addGetterSetter(Nt,"kaleidoscopePower",2,Mt(),we.afterSetFilter),we.addGetterSetter(Nt,"kaleidoscopeAngle",0,Mt(),we.afterSetFilter);function qg(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 up(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 fG(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 hG(e,t){const n=qg(e,0,0),r=qg(e,e.width-1,0),o=qg(e,0,e.height-1),i=qg(e,e.width-1,e.height-1),s=t||10;if(up(n,r)<s&&up(r,i)<s&&up(i,o)<s&&up(o,n)<s){const a=fG([r,n,i,o]),l=[];for(let u=0;u<e.width*e.height;u++)l[u]=up(a,[e.data[u*4],e.data[u*4+1],e.data[u*4+2]])<s?0:255;return l}}function pG(e,t){for(let n=0;n<e.width*e.height;n++)e.data[4*n+3]=t[n]}function mG(e,t,n){const r=[1,1,1,1,0,1,1,1,1],o=Math.round(Math.sqrt(r.length)),i=Math.floor(o/2),s=[];for(let a=0;a<n;a++)for(let l=0;l<t;l++){const u=a*t+l;let d=0;for(let f=0;f<o;f++)for(let p=0;p<o;p++){const g=a+f-i,v=l+p-i;if(g>=0&&g<n&&v>=0&&v<t){const y=g*t+v,_=r[f*o+p];d+=e[y]*_}}s[u]=d===2040?255:0}return s}function gG(e,t,n){const r=[1,1,1,1,1,1,1,1,1],o=Math.round(Math.sqrt(r.length)),i=Math.floor(o/2),s=[];for(let a=0;a<n;a++)for(let l=0;l<t;l++){const u=a*t+l;let d=0;for(let f=0;f<o;f++)for(let p=0;p<o;p++){const g=a+f-i,v=l+p-i;if(g>=0&&g<n&&v>=0&&v<t){const y=g*t+v,_=r[f*o+p];d+=e[y]*_}}s[u]=d>=1020?255:0}return s}function vG(e,t,n){const r=[.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111],o=Math.round(Math.sqrt(r.length)),i=Math.floor(o/2),s=[];for(let a=0;a<n;a++)for(let l=0;l<t;l++){const u=a*t+l;let d=0;for(let f=0;f<o;f++)for(let p=0;p<o;p++){const g=a+f-i,v=l+p-i;if(g>=0&&g<n&&v>=0&&v<t){const y=g*t+v,_=r[f*o+p];d+=e[y]*_}}s[u]=d}return s}var yG=function(e){let t=hG(e,this.threshold());return t&&(t=mG(t,e.width,e.height),t=gG(t,e.width,e.height),t=vG(t,e.width,e.height),pG(e,t)),e};we.addGetterSetter(Nt,"threshold",0,Mt(),we.afterSetFilter);var bG=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()};we.addGetterSetter(Nt,"noise",.2,Mt(),we.afterSetFilter);var wG=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){je.error("pixelSize value can not be <= 0");return}for(let a=0;a<o;a+=1)for(let l=0;l<i;l+=1){let u=0,d=0,f=0,p=0;const g=a*t,v=g+t,y=l*t,_=y+t;let w=0;for(let E=g;E<v;E+=1)if(!(E>=n))for(let k=y;k<_;k+=1){if(k>=r)continue;const C=(n*k+E)*4;u+=s[C+0],d+=s[C+1],f+=s[C+2],p+=s[C+3],w+=1}u=u/w,d=d/w,f=f/w,p=p/w;for(let E=g;E<v;E+=1)if(!(E>=n))for(let k=y;k<_;k+=1){if(k>=r)continue;const C=(n*k+E)*4;s[C+0]=u,s[C+1]=d,s[C+2]=f,s[C+3]=p}}};we.addGetterSetter(Nt,"pixelSize",8,Mt(),we.afterSetFilter);var CG=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};we.addGetterSetter(Nt,"levels",.5,Mt(),we.afterSetFilter);var kG=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]}};we.addGetterSetter(Nt,"red",0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)}),we.addGetterSetter(Nt,"green",0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)}),we.addGetterSetter(Nt,"blue",0,gE,we.afterSetFilter);var SG=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}};we.addGetterSetter(Nt,"red",0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)}),we.addGetterSetter(Nt,"green",0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)}),we.addGetterSetter(Nt,"blue",0,gE,we.afterSetFilter),we.addGetterSetter(Nt,"alpha",1,function(e){return this._filterUpToDate=!1,e>1?1:e<0?0:e});var _G=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)}},AG=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},IG=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};we.addGetterSetter(Nt,"threshold",.5,Mt(),we.afterSetFilter);var EG=KE.Util._assign(KE,{Arc:hl,Arrow:su,Circle:Hd,Ellipse:lc,Image:Rs,Label:b2,Tag:au,Line:pl,Path:hs,Rect:ap,RegularPolygon:cc,Ring:lu,Sprite:ba,Star:uc,Text:xr,TextPath:Co,Transformer:Zn,Wedge:ml,Filters:{Blur:JH,Brightness:tG,Brighten:eG,Contrast:nG,Emboss:rG,Enhance:oG,Grayscale:iG,HSL:sG,HSV:aG,Invert:lG,Kaleidoscope:dG,Mask:yG,Noise:bG,Pixelate:wG,Posterize:CG,RGB:kG,RGBA:SG,Sepia:_G,Solarize:AG,Threshold:IG}}),TG=EG;Wt();var xG=["dialog","floating"],gT=["top-right","top-left","bottom-right","bottom-left","top-center","bottom-center"];function RG(e){if(!e||typeof e!="object")throw new Error("SurfaceManager: request must be a non-null object.");if(!xG.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&&!gT.includes(e.floating.placement))throw new Error(`SurfaceManager: floating.placement must be one of ${gT.join(", ")}, got "${e.floating.placement}".`)}var MG=class{activeDialog=qr(null);activeFloating=qr(null);#e=!1;#t=1;#n;constructor({getModuleConfig:e}){this.#n=e}open(e){if(this.#e)return this.#u(e);RG(e);const t=this.#d(e),{component:n,props:r,render:o}=this.#f(t);let i,s=!1;const a=new Promise(g=>{i=v=>s?!1:(s=!0,g(v),!0)});let l;const u=g=>{i({status:"submitted",data:g})&&this.#o(l)},d=g=>{i({status:"closed",reason:g})&&this.#o(l)};l={id:t.id,mode:t.mode,request:t,component:n,props:r,render:o,resolve:u,close:d,settle:g=>i(g),get settled(){return s}};const f=t.mode==="dialog"?"activeDialog":"activeFloating",p=this[f].value;return p&&!p.settled&&p.settle({status:"replaced",replacedBy:t.id}),this[f].value=l,{id:t.id,mode:t.mode,close:g=>this.#r(l,g),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"})}}},LG="https://docs.superdoc.dev/guides/migration/document-api",vT=new Set;function Yg(e,t){vT.has(e)||(vT.add(e),console.warn(t))}var OG={state:"editor.state",view:"editor.view",schema:"editor.schema",commands:"editor.commands",chain:"editor.chain()",can:"editor.can()",dispatch:"editor.dispatch()"},yT=Symbol.for("superdoc:rawEditor"),bT=new WeakMap;function wT(e){return!e||e[yT]?e:new Proxy(e,{get(t,n){if(n===yT)return t;const r=OG[n];r&&Yg(`deprecated:${String(n)}`,`[SuperDoc] ${r} is deprecated and will be removed in a future version. Use the Document API (editor.doc) instead. See ${LG}`);const o=Reflect.get(t,n,t);if(typeof o=="function"){let i=bT.get(t);return i||(i=new Map,bT.set(t,i)),i.has(n)||i.set(n,o.bind(t)),i.get(n)}return o}})}var CT=["review","original","final","off"],DG=["original","markup","final"],PG=["paired","independent"],kT=Symbol.for("@superdoc/trackChanges:normalized"),ST=new Set;function _2(e,t){ST.has(e)||(ST.add(e),console.warn(`[SuperDoc] ${e} is deprecated β use ${t} instead.`))}function _T(e,t,n){return typeof e=="boolean"?e:typeof t=="boolean"?t:n}function FG(e,t,n){return typeof e=="string"&&CT.includes(e)?e:typeof t=="string"&&CT.includes(t)?t:n}function NG(e){return typeof e!="string"||!DG.includes(e)?null:e}function BG(e){return e==="markup"?"review":e}function zG(e){return typeof e=="string"&&PG.includes(e)?e:null}function VG(e){return e==="grouped"?"paired":e==="separate"?"independent":null}function jG(e){return e==="paired"?"grouped":"separate"}function Ms(e){return!e||typeof e!="object"||Array.isArray(e)?null:e}function A2(e){const t=e[kT]===!0,n=Ms(e.viewing),r=NG(n?.trackedChanges);Ms(e.modules)||(e.modules={});const o=Ms(e.trackChanges),i=Ms(e.modules.trackChanges),s=Ms(e.layoutEngineOptions?.trackedChanges);t||(o&&Object.prototype.hasOwnProperty.call(o,"visible")&&_2("config.trackChanges.visible","config.viewing.trackedChanges"),i&&_2("config.modules.trackChanges","config.trackChanges for behavior and config.viewing.trackedChanges for viewing projection"),s&&_2("config.layoutEngineOptions.trackedChanges","config.viewing.trackedChanges for display and config.trackChanges.enabled for behavior"));const a=r?r==="markup":_T(o?.visible,i?.visible,!1),l=_T(o?.enabled,i?.enabled,typeof s?.enabled=="boolean"?s.enabled:!0),u=VG(o?.replacementMode)??zG(i?.replacements)??"paired",d=Ms(o?.authorColors)??Ms(i?.authorColors),f=d||void 0,p=Ms(o?.semanticColors)??Ms(i?.semanticColors),g=p||void 0,v=e.documentMode==="viewing",y=v?a?"review":"original":"review",_=r?v?BG(r):"review":FG(i?.mode,s?.mode,y),w={visible:a,mode:_,enabled:l,replacements:u};return f&&(w.authorColors=f),g&&(w.semanticColors=g),e.modules.trackChanges=w,e.trackChanges={visible:a,enabled:l,replacementMode:jG(u)},f&&(e.trackChanges.authorColors=f),g&&(e.trackChanges.semanticColors=g),Ms(e.layoutEngineOptions)||(e.layoutEngineOptions={}),e.layoutEngineOptions.trackedChanges={mode:_,enabled:l},typeof n?.comments=="boolean"&&(Ms(e.comments)||(e.comments={}),e.comments.visible=n.comments),Object.defineProperty(e,kT,{value:!0,writable:!0,configurable:!0,enumerable:!1}),w}var I2=Object.freeze({id:null,name:"Default SuperDoc user",email:null});function UG(e){return!e||typeof e!="object"?{...I2}:{...I2,...e}}var Xg=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"}),Xi=e=>Array.isArray(e),$G=e=>Xe(e),HG=e=>typeof e.onSelect=="function",E2=Object.freeze({toolbar:!0,comments:!0,contextMenu:!0,loading:!0,search:!1,linkPopover:!1,ruler:!1,contentControls:!0}),GG=Object.freeze(["left","center","right"]),WG=Object.freeze({compact:32,default:80,wide:120}),KG=e=>Object.prototype.hasOwnProperty.call(E2,e),HQ=Object.freeze(Object.keys(E2).filter(KG));function AT(e,t){const n=e?.[t];return n===!1?!1:n===void 0?E2[t]:!0}function qG(e,t){const n=e?.[t];return $G(n)?n:{}}var IT=Object.freeze(["level","readOnly","allowResolve","permissionResolver"]);function YG(e){if(!("panel"in e)&&!("highlights"in e))return e;const{panel:t,highlights:n,...r}=e;return r}function XG(e){if(!IT.some(n=>n in e))return e;const t={...e};for(const n of IT)delete t[n];return t}function ET(e){const t={...e},n=tu(e.sections,e.customItems),r=tu(e.defaultItems,e.includeDefaultItems);return delete t.customItems,delete t.includeDefaultItems,wi(t,{sections:n,defaultItems:r})}var TT=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 ZG(e){return Xe(e)?Object.fromEntries(Object.entries(e).filter(([t,n])=>TT[t]!==void 0&&n!==void 0).map(([t,n])=>[TT[t],n])):{}}function xT(e){const t={...e};return delete t.strings,delete t.replaceControls,delete t.includeTrackedDeletions,wi(t,ZG(e.strings),{replaceEnabled:tu(e.replaceControls,e.replaceEnabled),includeDeletedText:tu(e.includeTrackedDeletions,e.includeDeletedText)})}var QG=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"}),JG=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 Zg(e,t){return t[String(e)]??e}function T2(e,t){if(!Xe(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])=>[Zg(i,t),s]))}function RT(e){return Xi(e)?e.map(t=>Zg(t,Xg)):e}function MT(e){return Xe(e)?Object.fromEntries(Object.entries(e).map(([t,n])=>[t,RT(n)])):e}function eW(e,t){if(!Xe(e)||!Xi(t))return e;const n={...e};for(const r of t){if(!Xe(r))continue;const o=r.region??"center";n[o]===void 0&&(n[o]=[])}return n}var tW=Object.freeze({watermark:"center","page-number":"center","formatting-marks":"right","table-of-contents":"center"});function nW(e,t){if(!Xe(e)||!Xi(t))return e;const n=Object.fromEntries(Object.entries(e).map(([o,i])=>[o,Xi(i)?[...i]:i])),r=new Set(Object.values(n).flatMap(o=>Xi(o)?o:[]).map(o=>Zg(o,Xg)));for(const o of t){const i=Zg(o,Xg);if(r.has(i))continue;const s=tW[o];if(!s)continue;const a=n[s];n[s]=Xi(a)?[...a,o]:[o],r.add(i)}return n}function LT(e,t){return eW(nW(e,t.includeItems),t.customItems)}function rW(e){return Xi(e)?e.map(t=>{if(!Xe(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 oW(e){return Xi(e)?e.map(t=>{if(!Xe(t)||typeof t.id!="string")return t;const n=t.size??"default",r=t.type==="separator"?void 0:WG[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"&&Xi(t.options)&&(i.options=t.options.map(s=>Xe(s)?{...s,key:s.value??s.id,value:s.value??s.id}:s),i.dropdownValueKey="value"),HG(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 iW(e){const t={...e},n=tu(e.items,Xe(e.groups)?e.groups:void 0),r=Xe(e.items)&&Object.keys(e.items).length===0?{center:[]}:n,o=LT(r,e),i=o===void 0?e.groups:MT(o),s=T2(e.icons,QG),a=wi(T2(e.texts,{}),T2(e.strings,JG)),l=Xi(e.includeItems)?new Set(e.includeItems):null,u=Xe(r)?new Set(Object.values(r).flatMap(d=>Xi(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,wi(t,{groups:i,excludeItems:RT(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:rW(e.fontOptions),customButtons:e.customItems===void 0?e.customButtons:oW(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 OT(e={}){const t=e.ui,n=t===!1,r=Xe(t)?t:void 0,o=B=>!n&&AT(r,B),i=B=>n?!1:r?.[B]===void 0?void 0:AT(r,B),s=B=>n?{}:qG(r,B),a=n||i("ruler")===!1,l=n||i("linkPopover")===!1,u=l?void 0:tu(s("linkPopover").popoverResolver,e.modules?.links?.popoverResolver),d=i("contentControls")??(!n&&e.modules?.contentControls?.chrome!=="none"),f=e.modules?.contentControls?.chrome==="none"?void 0:e.modules?.contentControls?.chrome,p=s("toolbar"),g=iW(p),v=Xe(p.items),y=e.modules?.toolbar,_=Xe(y)?y:{},w=e.modules?.contextMenu??e.modules?.slashMenu,E=Xe(w)?w:{},k=e.modules?.surfaces?.findReplace,C=xT(Xe(k)?k:{}),x=Xe(_.groups)?MT(LT(_.groups,p)):_.groups,D=[g.groups,x],P=D.find(Xe),W=D.find(Xi),N=v?Object.keys(g.groups??{}):tu(W,_.toolbarGroups,e.toolbarGroups),L=Xi(N)?N.map(String):null,j=(B,R)=>Object.prototype.hasOwnProperty.call(B,R),M=P&&L?Object.fromEntries([...L.filter(B=>j(P,B)),...Object.keys(P).filter(B=>!GG.includes(B))].map(B=>[B,P[B]])):P;return{enabled:!n,toolbar:{enabled:o("toolbar"),container:n?null:[p.container,_.selector,e.toolbar].find(B=>B!==void 0)??null,options:n?{}:{...wi(_,g),groups:M,toolbarGroups:N,icons:wi(e.toolbarIcons,_.icons,g.icons),texts:wi(e.toolbarTexts,_.texts,g.texts)}},comments:{enabled:(i("comments")??(!n&&e.modules?.comments!==!1))&&s("comments").panel!==!1,highlights:s("comments").highlights!==!1,options:n?{}:wI(XG(YG(s("comments"))))||{}},contextMenu:{enabled:i("contextMenu")??(!n&&e.disableContextMenu!==!0),suppressed:n||i("contextMenu")===!1,options:n?{}:wi(ET(E),ET(s("contextMenu")))},loading:{enabled:o("loading")},search:{enabled:i("search")??(!n&&!!e.modules?.surfaces?.findReplace),options:n?{}:wi(C,xT(s("search")))},linkPopover:{enabled:typeof u=="function",suppressed:l,options:wi(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?wi({chrome:f},s("contentControls")):{chrome:"none"}}}}var sW=e=>e==="read"||e==="write"||e==="resolve";function DT(e={}){const t=Xe(e.interaction)?e.interaction:{},n=Xe(t.comments)?t.comments:{},r=Xe(t.trackedChanges)?t.trackedChanges:{},o=Xe(e.modules?.comments)?e.modules.comments:{},i=(n.readOnly??o.readOnly??!1)===!0,s=(n.allowResolve??o.allowResolve??!0)!==!1,a=n.level,l=sW(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 PT(e={}){const t=Xe(e.surfaces)?e.surfaces:{},n=Xe(e.modules?.surfaces)?e.modules.surfaces:{},r=t.resolver===void 0?n.resolver:t.resolver;return{resolver:typeof r=="function"?r:null,dialog:wi(n.dialog,t.dialog),floating:wi(n.floating,t.floating)}}var aW="https://docs.superdoc.dev/editor/fonts/";function lW(e){return e==="localhost"||e.endsWith(".localhost")||e==="0.0.0.0"||e==="::1"||e==="[::1]"||e.startsWith("127.")}function cW(e,t,n=typeof window>"u"?"":window.location.hostname){if(!lW(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: ${aW}`)}var uW=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(`[${Tg}]`);if(!n)return null;const r=n.getAttribute(Tg),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{}}},dW=["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"],FT=[{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:dW,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"}],NT=new Map(FT.map(e=>[e.name,e])),fW=FT.map(e=>e.name);function x2(e){return NT.get(e)??null}function BT(e){const t=NT.get(e);return t?.disposition==="controller-routed"?t.commandId:null}var hW=(e,t)=>{let n=e.replace(/[^0-9.]/g,"");return n=parseFloat(n),isNaN(n)&&(n=t),n=parseFloat(n),n},pW=(e,t,n)=>{let r,o,i,s=0;n||(n={});const a=()=>{s=n.leading===!1?0:Date.now(),r=null,i=e(...o),r||(o=null)},l=(...u)=>{const d=Date.now();!s&&n.leading===!1&&(s=d);const f=t-(d-s);return o=u,f<=0||f>t?(r&&(clearTimeout(r),r=null),s=d,i=e(...u),r||(o=null)):!r&&n.trailing!==!1&&(r=setTimeout(a,f)),i};return l.cancel=function(){clearTimeout(r),s=0,r=o=null},l};Wt(),On();var mW={class:"sd-toolbar-icon"},gW=["innerHTML"],vW={__name:"ToolbarButtonIcon",props:{name:{type:String,required:!0},color:{type:String,default:null},icon:{type:String,default:null}},setup(e){const t=e,n=ke(()=>{if(t.name==="color")return{backgroundColor:t.color||"#111111"};if(t.name==="highlight")return{backgroundColor:t.color||"#D6D6D6"}}),r=ke(()=>["color","highlight"].includes(t.name));return(o,i)=>(ge(),Ce("div",mW,[he("div",{class:gn(["sd-toolbar-icon__icon",[`sd-toolbar-icon__icon--${t.name}`]]),innerHTML:e.icon},null,10,gW),r.value?(ge(),Ce("div",{key:0,class:"color-bar",style:Nn(n.value)},null,4)):pt("",!0)]))}},zT=Rn(vW,[["__scopeId","data-v-65ecd5b1"]]);Wt(),On();var yW=["role","aria-label","aria-disabled"],bW=["data-item"],wW=["data-item"],CW={key:1,class:"sd-button-label"},kW=["data-item","aria-label"],SW=["innerHTML"],_W={key:2},AW=["onKeydown","id"],IW=["placeholder","onKeydown","id","data-item"],EW=["data-item","innerHTML"],TW={"aria-live":"polite",class:"sd-visually-hidden"},xW={__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}=Vr(),o=e,{name:i,active:s,icon:a,label:l,hideLabel:u,iconColor:d,hasCaret:f,splitButton:p,disabled:g,expand:v,inlineTextInputVisible:y,hasInlineTextInput:_,minWidth:w,style:E,attributes:k}=o.toolbarItem,C=ke(()=>!!p?.value&&!!f?.value),x=ke(()=>i?.value??""),D=oe(""),P=oe(null),{isHighContrastMode:W}=ds();Kt(()=>l?.value,Re=>{document.activeElement!==P.value&&(D.value=Re==null?"":String(Re))},{immediate:!0});const N=()=>{_&&Tt(()=>{P.value?.focus(),P.value?.select()}),n("buttonClick")},L=Re=>{g?.value||(Re?.stopPropagation(),n("mainClick"))},j=()=>{C.value||N()},M=Re=>{if(C.value){L(Re);return}N()},B=Re=>{Re.preventDefault(),o.allowEnterPropagation||Re.stopPropagation(),M(Re)},R=Re=>{const $e=o.toolbarItem?.nestedOptions?.value??[],ot=Re.trim();if(!ot)return"";const kt=$e.find(gt=>typeof gt?.label=="string"&>.label.toLowerCase()===ot.toLowerCase());return kt?.label?kt.label:$e.find(gt=>typeof gt?.label=="string"&>.label.toLowerCase().startsWith(ot.toLowerCase()))?.label??ot},re=()=>{const Re=String(D.value??"").trim();let $e=Re;if(x.value==="fontSize"){const ot=Number.parseFloat(Re);$e=Re.match(/^\d+(\.5)?$/)?Re:Number.isFinite(ot)?Math.floor(ot).toString():""}else x.value==="fontFamily"&&($e=R(Re));return $e?(n("textSubmit",$e),D.value=$e,!0):!1},te=Re=>{const $e=Re?.currentTarget;$e instanceof HTMLInputElement&&($e.focus({preventScroll:!0}),$e.select())},Y=Re=>{requestAnimationFrame(()=>{const $e=document.getElementById(`inlineTextInput-${Re}`);$e instanceof HTMLInputElement&&($e.focus({preventScroll:!0}),$e.select())})},X=()=>{const Re=document.querySelector('[role="textbox"][aria-label*="SuperDoc body"], .ProseMirror');return Re instanceof HTMLElement?(Re.focus({preventScroll:!0}),!0):!1},U=()=>{const Re=r?.$toolbar?.pendingSelectionCapture,$e=()=>{Re&&typeof r?.$toolbar?.ui?.selection?.restore=="function"&&r.$toolbar.ui.selection.restore(Re)};if(X()){$e();return}typeof r?.$toolbar?.superdoc?.focus=="function"&&(r.$toolbar.superdoc.focus(),$e())},Oe=()=>{re()&&U()},me=Re=>{if(re(),Re.shiftKey){x.value==="fontSize"&&(Re.preventDefault(),Tt(()=>Y("fontFamily")));return}if(Re.preventDefault(),x.value==="fontFamily"){Tt(()=>Y("fontSize"));return}x.value==="fontSize"&&Tt(U)},ce=ke(()=>E.value?E.value:{minWidth:o.minWidth}),ve=ke(()=>v?.value?kr.dropdownCaretUp:kr.dropdownCaretDown);return(Re,$e)=>(ge(),Ce("div",{class:gn(["sd-toolbar-item",rt(k).className]),style:Nn(ce.value),role:e.isOverflowItem?"menuitem":"button","aria-label":rt(k).ariaLabel,"aria-disabled":rt(g)?"true":void 0,"data-sd-part":"toolbar-item",onClick:j,onKeydown:$e[9]||($e[9]=yi(ot=>B(ot),["enter"])),tabindex:"0"},[he("div",{class:gn(["sd-toolbar-button",{"sd-active":rt(s),"sd-disabled":rt(g),narrow:e.isNarrow,wide:e.isWide,split:C.value,"has-inline-text-input":rt(_),"high-contrast":rt(W)}]),"data-item":`btn-${rt(i)||""}`},[C.value?(ge(),Ce("div",{key:0,class:"sd-toolbar-button__main","data-item":`btn-${rt(i)||""}-main`,onClick:$e[0]||($e[0]=ot=>L(ot))},[rt(a)?(ge(),xn(zT,{key:0,color:rt(d),class:"sd-toolbar-icon",icon:rt(a),name:rt(i)},null,8,["color","icon","name"])):pt("",!0),rt(l)&&!rt(u)&&!rt(y)?(ge(),Ce("div",CW,Rt(rt(l)),1)):pt("",!0)],8,wW)):pt("",!0),C.value?(ge(),Ce("div",{key:1,class:"sd-toolbar-button__caret","data-item":`btn-${rt(i)||""}-caret`,"aria-label":`${rt(k).ariaLabel} options`,role:"button"},[he("div",{class:"sd-dropdown-caret",innerHTML:ve.value,style:Nn({opacity:rt(g)?.6:1})},null,12,SW)],8,kW)):(ge(),Ce(Xt,{key:2},[rt(a)?(ge(),xn(zT,{key:0,color:rt(d),class:"sd-toolbar-icon",icon:rt(a),name:rt(i)},null,8,["color","icon","name"])):pt("",!0),rt(l)&&!rt(u)&&(!rt(y)||x.value==="fontFamily")?(ge(),Ce("div",{key:1,class:gn(["sd-button-label",{"sd-visually-hidden":rt(y)&&x.value==="fontFamily"}])},Rt(rt(l)),3)):pt("",!0),rt(y)?(ge(),Ce("span",_W,[rt(i)==="fontSize"?Vi((ge(),Ce("input",{key:0,"onUpdate:modelValue":$e[1]||($e[1]=ot=>D.value=ot),onKeydown:[yi(pn(Oe,["stop","prevent"]),["enter"]),$e[2]||($e[2]=yi(ot=>me(ot),["tab"]))],onClick:$e[3]||($e[3]=pn(ot=>te(ot),["stop"])),onFocus:$e[4]||($e[4]=ot=>te(ot)),type:"text",class:gn(["button-text-input button-text-input--font-size",{"high-contrast":rt(W)}]),id:"inlineTextInput-"+rt(i),autocomplete:"off",ref_key:"inlineInput",ref:P},null,42,AW)),[[Hi,D.value]]):Vi((ge(),Ce("input",{key:1,"onUpdate:modelValue":$e[5]||($e[5]=ot=>D.value=ot),placeholder:rt(l),onKeydown:[yi(pn(Oe,["stop","prevent"]),["enter"]),$e[6]||($e[6]=yi(ot=>me(ot),["tab"]))],onClick:$e[7]||($e[7]=pn(ot=>te(ot),["stop"])),onFocus:$e[8]||($e[8]=ot=>te(ot)),type:"text",class:gn(["button-text-input",{"button-text-input--font-family":x.value==="fontFamily","high-contrast":rt(W)}]),id:"inlineTextInput-"+rt(i),"data-item":x.value==="fontFamily"?`btn-${rt(i)}-input`:void 0,autocomplete:"off",ref_key:"inlineInput",ref:P},null,42,IW)),[[Hi,D.value]])])):pt("",!0),rt(f)?(ge(),Ce("div",{key:3,class:"sd-dropdown-caret","data-item":`btn-${rt(i)||""}-toggle`,innerHTML:ve.value,style:Nn({opacity:rt(g)?.6:1})},null,12,EW)):pt("",!0)],64)),he("div",TW,Rt(`${rt(k).ariaLabel} ${rt(s)?"selected":"unset"}`),1)],10,bW)],46,yW))}},R2=Rn(xW,[["__scopeId","data-v-96796456"]]);Wt(),On();var RW={class:"toolbar-separator",role:"separator","aria-label":"Toolbar separator"},MW={__name:"ToolbarSeparator",props:{active:{type:Boolean,default:!1}},emits:["command"],setup(e,{emit:t}){const{isHighContrastMode:n}=ds(),r=()=>n.value?"#000":"var(--sd-ui-border, #dbdbdb)";return(o,i)=>(ge(),Ce("div",RW,[he("div",{class:"separator-inner",style:Nn({backgroundColor:r()})},null,4)]))}},LW=Rn(MW,[["__scopeId","data-v-cb82253a"]]);Wt(),On();var OW={class:"toolbar-dropdown"},DW=["data-superdoc-ui-owner"],PW=["onClick"],FW={key:0,class:"toolbar-dropdown-option__icon"},NW={class:"toolbar-dropdown-option__label"},Qg='button, [href], input, select, textarea, [role="button"], [tabindex]:not([tabindex="-1"])',BW={__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=OC(),s=ea("sdToolbarOwnerId",null),a=oe(null),l=oe(null),u=oe({top:"0px",left:"0px",maxHeight:"none"}),d=oe([]),f=oe(-1),p=ke(()=>!!r.show),g=oe(document.fullscreenElement),v=ke(()=>p.value&&g.value?g.value:document.body),y=ke(()=>r.options.some(de=>de?.type==="render")),_=ke(()=>!!i.menu),w=ke(()=>typeof r.menuProps!="function"?{}:r.menuProps()||{}),E=ke(()=>{const{class:de,style:H,...A}=w.value;return A}),k=ke(()=>["toolbar-dropdown-menu",w.value.class,{"toolbar-dropdown-menu--render-only":_.value||r.options.length>0&&r.options.every(de=>de&&de.type==="render")}]),C=ke(()=>{const de=w.value.style||{};return{...r.contentStyle,...de}}),x=ke(()=>({...C.value,position:"fixed",top:u.value.top,left:u.value.left,maxHeight:u.value.maxHeight,zIndex:2e3})),D=de=>{o("update:show",de)},P=()=>{p.value&&D(!1)},W=()=>{if(!a.value)return;const de=a.value.getBoundingClientRect(),H=l.value,A=H?.offsetWidth??0,ne=H?.scrollHeight??H?.offsetHeight??0,V=window.innerWidth||document.documentElement.clientWidth||0,Q=window.innerHeight||document.documentElement.clientHeight||0,K=8,ee=4,le=de.bottom+ee,be=de.top-ee,G=Math.max(0,Q-le-K),pe=Math.max(0,be-K),Ee=G<ne&&pe>G,Se=Ee?pe:G,Ge=Ee?Math.max(K,be-(ne?Math.min(ne,Se):Se)):le;let ht=de.left;r.placement==="bottom-end"&&(ht=de.right-A);const Me=Math.max(K,V-A-K);ht=Math.min(Math.max(K,ht),Me),u.value={top:`${Ge}px`,left:`${ht}px`,maxHeight:`${Se}px`}},N=async()=>{g.value=document.fullscreenElement,p.value&&(await Tt(),W())},L=()=>{r.disabled||D(!p.value)},j=de=>typeof r.nodeProps!="function"?{}:r.nodeProps(de)||{},M=de=>{de?.disabled||de?.type!=="render"&&(o("select",de?.key,de),P())},B=de=>de?.type==="render",R=de=>!de?.disabled&&de?.type!=="render",re=de=>typeof de?.icon=="function"||!!de?.icon,te=de=>typeof de?.icon=="function"?de.icon(de):de?.icon||null,Y=de=>de?typeof de=="string"?de.split(/\s+/).includes("sd-selected"):Array.isArray(de)?de.some(Y):typeof de=="object"?!!de["sd-selected"]:!1:!1,X=de=>Y(de?.props?.class)||Y(de?.class),U=()=>r.options.map((de,H)=>R(de)?H:-1).filter(de=>de>=0),Oe=()=>{const de=r.options.findIndex(H=>R(H)&&X(H));return de>=0?de:U()[0]??-1},me=(de,H)=>{if(!de){delete d.value[H];return}d.value[H]=de},ce=()=>{d.value.forEach((H,A)=>{H&&H.setAttribute("tabindex",A===f.value?"0":"-1")});const de=d.value[f.value];de&&typeof de.focus=="function"&&(de.focus(),de.scrollIntoView?.({block:"nearest",inline:"nearest"}))},ve=de=>{const H=U();if(!H.length){f.value=-1;return}const A=H.indexOf(f.value);if(A<0){f.value=de>0?H[0]:H[H.length-1];return}const ne=(A+de+H.length)%H.length;f.value=H[ne]},Re=()=>{let de=r.options[f.value];if(!R(de)){const H=U()[0];de=H===void 0?null:r.options[H]}de&&M(de)},$e=Pl({name:"ToolbarDropdownRenderOption",props:{option:{type:Object,required:!0}},setup(de){return()=>typeof de.option.render!="function"?null:de.option.render()}}),ot=Pl({name:"ToolbarDropdownOptionIcon",props:{option:{type:Object,required:!0}},setup(de){return()=>{const H=te(de.option);return typeof H=="string"?no("span",{innerHTML:H}):H}}}),kt=de=>{if(!p.value)return;const H=de.target;if(!(H instanceof Element))return;const A=a.value?.contains(H),ne=l.value?.contains(H);A||ne||r.hasOpenChild&&H.closest('[data-sd-part="dropdown-menu"]')||P()},gt=oe(null),Bt=()=>{const de=a.value,H=document.activeElement;if(de&&H instanceof HTMLElement&&de.contains(H)){gt.value=H;return}gt.value=de?.matches?.(Qg)?de:de?.querySelector(Qg)},Fe=()=>{const de=gt.value;if(de instanceof HTMLElement&&document.contains(de)){de.focus();return}const H=a.value;if(!H)return;const A=H.matches?.(Qg)?H:H.querySelector(Qg);if(A instanceof HTMLElement){A.focus();return}H.setAttribute("tabindex","-1"),H.focus()};t({focusTrigger:Fe});const Le=de=>{if(!p.value)return;const{key:H}=de;if(["Escape","ArrowDown","ArrowUp","Enter"].includes(H)){if(H==="Escape"){if(!r.closeOnEscape)return;de.preventDefault(),P(),Tt(()=>{requestAnimationFrame(Fe)});return}if(!(y.value||_.value)){if(de.preventDefault(),H==="ArrowDown"){ve(1),ce();return}if(H==="ArrowUp"){ve(-1),ce();return}H==="Enter"&&Re()}}};return Kt(p,async de=>{if(!de){f.value=-1,d.value=[];return}Bt(),await Tt(),W(),!(y.value||_.value)&&(f.value=Oe(),await Tt(),ce())},{immediate:!0}),Kt(p,de=>{de?(document.addEventListener("pointerdown",kt,!0),document.addEventListener("keydown",Le,!0),window.addEventListener("resize",W),window.addEventListener("scroll",W,!0)):(document.removeEventListener("pointerdown",kt,!0),document.removeEventListener("keydown",Le,!0),window.removeEventListener("resize",W),window.removeEventListener("scroll",W,!0))},{immediate:!0}),tr(()=>{document.addEventListener("fullscreenchange",N)}),wr(()=>{document.removeEventListener("fullscreenchange",N),document.removeEventListener("pointerdown",kt,!0),document.removeEventListener("keydown",Le,!0),window.removeEventListener("resize",W),window.removeEventListener("scroll",W,!0)}),(de,H)=>(ge(),Ce("div",OW,[he("div",{ref_key:"triggerRef",ref:a,class:"toolbar-dropdown-trigger","data-sd-part":"dropdown-trigger",onClick:L},[Yu(de.$slots,"trigger",{},void 0,!0)],512),(ge(),xn(Bl,{to:v.value},[vn(km,{name:"fade-in-scale-up-transition"},{default:Mo(()=>[p.value?(ge(),Ce("div",na({key:0,ref_key:"menuRef",ref:l,"data-sd-part":"dropdown-menu",class:k.value,style:x.value},E.value,{"data-superdoc-ui-owner":rt(s)}),[_.value?Yu(de.$slots,"menu",{key:0},void 0,!0):pt("",!0),(ge(!0),Ce(Xt,null,Wn(_.value?[]:e.options,(A,ne)=>(ge(),Ce("div",na({key:A.key,ref_for:!0,ref:V=>me(V,ne),class:["toolbar-dropdown-option",[A.class,A.props?.class,{"sd-disabled":A.disabled,"sd-render":B(A)}]],tabindex:"-1",onClick:V=>M(A)},{ref_for:!0},{...A.props,...j(A)}),[B(A)?(ge(),xn(rt($e),{key:0,option:A},null,8,["option"])):(ge(),Ce(Xt,{key:1},[re(A)?(ge(),Ce("span",FW,[vn(rt(ot),{option:A},null,8,["option"])])):pt("",!0),he("span",NW,Rt(A.label),1)],64))],16,PW))),128))],16,DW)):pt("",!0)]),_:3})],8,["to"]))]))}},VT=Rn(BW,[["__scopeId","data-v-e6f71d76"]]),jT=e=>{const t=e?.target;t instanceof Element&&(t.closest('input, textarea, [contenteditable="true"]')||e.preventDefault())},fc=(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})};Wt(),On();var zW={__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=oe(null),i=ke(()=>r.toolbarItem.expand.value),s=ke(()=>r.overflowItems.some(d=>d.type==="dropdown"&&rt(d.expand))),a=ke(()=>({...r.toolbarItem,active:i.value})),l=d=>{if(d!==i.value){if(d){n("buttonClick",r.toolbarItem);return}n("close")}},u=({item:d,argument:f,option:p})=>{d.name.value==="watermark"&&(n("close"),o.value?.focusTrigger()),n("command",{item:d,argument:f,option:p})};return(d,f)=>(ge(),xn(VT,{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:Mo(()=>[vn(R2,{"toolbar-item":a.value,"allow-enter-propagation":!0},null,8,["toolbar-item"])]),menu:Mo(()=>[vn(tv,{class:"superdoc-toolbar-overflow","toolbar-items":e.overflowItems,"ui-font-family":r.uiFontFamily,"from-overflow":"",onMousedown:rt(jT),onCommand:u},null,8,["toolbar-items","ui-font-family","onMousedown"])]),_:1},8,["close-on-escape","has-open-child","content-style","show"]))}},VW=Rn(zW,[["__scopeId","data-v-1227fcf9"]]),UT=e=>String(e??"").trim().toLowerCase(),Jg=(e,t)=>{const n=UT(e);if(!n)return-1;for(let r=0;r<t.length;r+=1)if(UT(t[r]).startsWith(n))return r;return-1},jW=(e,t,{autocomplete:n=!0}={})=>{const r=String(e??""),o=Jg(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}},UW=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},$W=e=>e<=31||e===127,HW=e=>e===32||e===160||e===65279,GW=e=>Array.from(String(e)).filter(t=>!$W(t.charCodeAt(0))).join(""),WW=e=>{let t="",n=!1;for(const r of String(e)){if(HW(r.charCodeAt(0))){n=t.length>0;continue}n&&(t+=" "),n=!1,t+=r}return t},KW=e=>{const t=String(e??"").split(",")[0]??"",n=GW(t);return WW(UW(n)).trim()},qW=1,YW=1638,XW=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<qW?"":String(Math.min(r,YW))};Wt(),On();var ZW=["data-item"],QW=["id","value","disabled","aria-label","aria-expanded","aria-controls","aria-activedescendant","data-item"],JW=["data-item","aria-label","disabled"],eK=["innerHTML"],tK=["data-superdoc-ui-owner","id","aria-label"],nK=["id","aria-selected","aria-label","onMousedown","onMouseenter"],rK={class:"toolbar-dropdown-option__label"},oK={class:"sd-button-label sd-font-combobox__legacy-label","aria-hidden":"true"},iK={__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}=ds(),i=ea("sdToolbarOwnerId",null),s=oe(null),a=oe(null),l=oe(null),u=oe([]),d=oe(!1),f=oe(!1),p=oe(-1),g=oe(""),v=oe(""),y=oe(!1),_=oe({top:"0px",left:"0px",minWidth:"0px",maxHeight:"none"}),w=ke(()=>n.item.nestedOptions?.value??[]),E=ke(()=>w.value.map(G=>String(G?.label??""))),k=ke(()=>String(n.item.label?.value??"")),C=ke(()=>!!n.item.disabled?.value),x=ke(()=>String(n.item.name?.value??"")),D=ke(()=>n.item.attributes?.value?.ariaLabel??"Font family"),P=ke(()=>d.value?v.value:k.value),W=ke(()=>`sd-${x.value||"combobox"}-listbox-${n.item.id?.value??"default"}`),N=G=>`${W.value}-option-${G}`,L=ke(()=>f.value&&p.value>=0?N(p.value):void 0),j=ke(()=>f.value?kr.dropdownCaretUp:kr.dropdownCaretDown),M=G=>{const pe=String(G??"").trim().toLowerCase();return w.value.find(Ee=>String(Ee?.label??"").trim().toLowerCase()===pe)?.props?.style?.fontFamily||G||n.uiFontFamily},B=ke(()=>n.showPreview?{fontFamily:M(d.value?v.value:k.value)}:{fontFamily:n.uiFontFamily}),R=()=>{const G=n.item.selectedValue?.value;if(G){const pe=w.value.findIndex(Ee=>Ee?.key===G);if(pe>=0)return pe}return E.value.findIndex(pe=>pe.toLowerCase()===k.value.toLowerCase())},re=(G,pe)=>{const Ee=s.value;if(!(!Ee||typeof Ee.setSelectionRange!="function"))try{Ee.setSelectionRange(G,pe)}catch{}},te=()=>{u.value[p.value]?.scrollIntoView?.({block:"nearest",inline:"nearest"})},Y=()=>{u.value[p.value]?.focus?.()},X=()=>{const G=a.value;if(!G)return;const pe=G.getBoundingClientRect(),Ee=l.value,Se=Ee?.scrollHeight??Ee?.offsetHeight??0,Ge=window.innerHeight||document.documentElement.clientHeight||0,ht=window.innerWidth||document.documentElement.clientWidth||0,Me=8,qe=4,Jt=pe.bottom+qe,St=pe.top-qe,Ut=Math.max(0,Ge-Jt-Me),Lt=Math.max(0,St-Me),mn=Ut<Se&&Lt>Ut,ut=mn?Lt:Ut,en=mn?Math.max(Me,St-(Se?Math.min(Se,ut):ut)):Jt,Tn=Math.min(Math.max(Me,pe.left),Math.max(Me,ht-pe.width-Me));_.value={top:`${en}px`,left:`${Tn}px`,minWidth:`${pe.width}px`,maxHeight:`${ut}px`}},U=ke(()=>({position:"fixed",top:_.value.top,left:_.value.left,minWidth:_.value.minWidth,maxHeight:_.value.maxHeight,fontFamily:n.uiFontFamily,zIndex:2e3})),Oe=G=>{n.item.expand&&typeof n.item.expand=="object"&&"value"in n.item.expand&&(n.item.expand.value=G)},me=(G,{focusInput:pe=!1,focusOption:Ee=!1}={})=>{if(C.value||!w.value.length){Oe(!1);return}f.value=!0,Oe(!0),p.value=G??-1,pe&&(d.value=!0,v.value=k.value,s.value?.focus()),Tt(()=>{X(),te(),Ee&&Y()})},ce=({syncItem:G=!0}={})=>{f.value=!1,p.value=-1,G&&Oe(!1)},ve=()=>{ce(),d.value=!1,g.value="",v.value=k.value},Re=()=>{C.value||(f.value||r("item-clicked"),d.value=!0,g.value="",v.value=k.value,Tt(()=>re(0,v.value.length)))},$e=G=>{if(C.value)return;const pe=document.activeElement===s.value;if(r("item-clicked"),d.value=!0,pe||(g.value="",v.value=k.value,G.preventDefault(),s.value?.focus({preventScroll:!0}),re(0,k.value.length)),!f.value){const Ee=R();me(Ee>=0?Ee:0)}},ot=G=>{const pe=G.relatedTarget;pe instanceof Node&&a.value?.contains(pe)||pe instanceof Node&&l.value?.contains(pe)||ve()},kt=G=>{if(y.value)return;const pe=G.target,Ee=pe.value,Se=typeof pe.selectionStart=="number"?pe.selectionStart:Ee.length,Ge=typeof pe.selectionEnd=="number"?pe.selectionEnd:Se,ht=typeof G.inputType=="string"&&G.inputType.startsWith("delete"),Me=Se===Ee.length&&Ge===Ee.length;g.value=Ee;const qe=jW(Ee,E.value,{autocomplete:!ht&&Me});v.value=qe.display,pe.value=qe.display,qe.display===Ee&&!Me?re(Se,Ge):re(qe.selectionStart,qe.selectionEnd),f.value&&(p.value=qe.matchIndex,Tt(te))},gt=G=>{y.value=!1,kt(G)},Bt=G=>{if(!w.value.length)return;const pe=w.value.length,Ee=p.value<0?G>0?-1:0:p.value;p.value=(Ee+G+pe)%pe,Tt(te)},Fe=(G,pe)=>{r("item-clicked"),r("command",{item:n.item,argument:G,option:pe}),pe&&(n.item.selectedValue.value=pe.key)},Le=G=>{G&&(Fe(G.value??G.label,G),d.value=!1,g.value="",v.value=G.label,ce())},de=()=>{if(f.value&&p.value>=0)return Le(w.value[p.value]),!0;const G=Jg(g.value,E.value);if(G>=0)return Le(w.value[G]),!0;const pe=n.normalizeValue(g.value);return pe?(Fe(pe,null),d.value=!1,g.value="",v.value=pe,ce(),!0):!1},H=G=>{if(!(G.isComposing||y.value||G.keyCode===229)&&!(G.ctrlKey||G.metaKey||G.altKey))switch(G.key){case"ArrowDown":if(G.preventDefault(),f.value)Y();else{const pe=Jg(g.value,E.value),Ee=pe>=0?pe:R();me(Ee>=0?Ee:0,{focusOption:!0})}break;case"ArrowUp":if(G.preventDefault(),f.value)Y();else{const pe=Jg(g.value,E.value),Ee=pe>=0?pe:R();me(Ee>=0?Ee:w.value.length-1,{focusOption:!0})}break;case"Enter":G.preventDefault(),de()&&r("editor-handoff"),s.value?.blur();break;case"Tab":G.preventDefault(),de(),ce(),s.value?.blur(),r("tab-out",G);break;case"Escape":G.preventDefault(),ve(),Tt(()=>s.value?.focus());break;default:break}},A=G=>{if(G.preventDefault(),!C.value)if(r("item-clicked"),f.value)ce(),s.value?.focus();else{const pe=R();me(pe>=0?pe:0,{focusOption:!0})}},ne=(G,pe)=>{G.preventDefault(),Le(pe),r("editor-handoff"),s.value?.blur()},V=G=>{p.value=G},Q=G=>{if(!(G.ctrlKey||G.metaKey||G.altKey))switch(G.key){case"ArrowDown":G.preventDefault(),Bt(1),Y();break;case"ArrowUp":G.preventDefault(),Bt(-1),Y();break;case"Enter":G.preventDefault(),p.value>=0&&(Le(w.value[p.value]),r("editor-handoff"));break;case"Escape":G.preventDefault(),ve(),Tt(()=>s.value?.focus());break;case"Tab":G.preventDefault(),p.value>=0?Le(w.value[p.value]):ce(),r("tab-out",{shiftKey:G.shiftKey,target:s.value});break;default:break}},K=G=>{if(!f.value)return;const pe=G.target;pe instanceof Element&&(a.value?.contains(pe)||l.value?.contains(pe)||ve())};Kt(f,G=>{G?(document.addEventListener("pointerdown",K,!0),window.addEventListener("resize",X),window.addEventListener("scroll",X,!0)):(document.removeEventListener("pointerdown",K,!0),window.removeEventListener("resize",X),window.removeEventListener("scroll",X,!0),u.value=[])},{immediate:!0}),wr(()=>{document.removeEventListener("pointerdown",K,!0),window.removeEventListener("resize",X),window.removeEventListener("scroll",X,!0)});const ee=(G,pe)=>{if(!G){delete u.value[pe];return}u.value[pe]=G},le=G=>G===p.value,be=G=>G?.key&&G.key===n.item.selectedValue?.value;return Kt(k,G=>{d.value||(v.value=G)}),Kt(()=>!!n.item.expand?.value,G=>{if(G&&!f.value){const pe=R();me(pe>=0?pe:0,{focusInput:!0});return}!G&&f.value&&ce({syncItem:!1})}),(G,pe)=>(ge(),Ce("div",{ref_key:"rootRef",ref:a,class:gn(["sd-font-combobox sd-toolbar-split-field",{"sd-disabled":C.value,"high-contrast":rt(o)}]),style:Nn(n.item.style?.value),"data-item":`btn-${x.value}`},[he("span",{class:"sd-font-combobox__field sd-toolbar-split-field__main",onMousedown:$e},[he("input",{ref_key:"inputRef",ref:s,id:`inlineTextInput-${x.value}`,class:"button-text-input sd-font-combobox__input",type:"text",role:"combobox",autocomplete:"off",spellcheck:"false",value:P.value,style:Nn(B.value),disabled:C.value,"aria-label":D.value,"aria-expanded":f.value?"true":"false","aria-controls":W.value,"aria-activedescendant":L.value,"aria-haspopup":"listbox","aria-autocomplete":"both","data-item":`btn-${x.value}-input`,onFocus:Re,onBlur:ot,onInput:kt,onKeydown:H,onCompositionstart:pe[0]||(pe[0]=Ee=>y.value=!0),onCompositionend:gt},null,44,QW)],32),he("button",{type:"button",class:"sd-font-combobox__caret sd-toolbar-split-field__caret","data-item":`btn-${x.value}-toggle`,tabindex:"-1","aria-label":`${D.value} options`,disabled:C.value,onMousedown:A},[he("span",{class:"sd-dropdown-caret",innerHTML:j.value},null,8,eK)],40,JW),(ge(),xn(Bl,{to:"body"},[f.value?(ge(),Ce("div",{key:0,ref_key:"popupRef",ref:l,role:"listbox","data-sd-part":"dropdown-menu","data-superdoc-ui-owner":rt(i),id:W.value,"aria-label":D.value,class:gn(["sd-font-combobox__listbox",{"high-contrast":rt(o)}]),style:Nn(U.value)},[(ge(!0),Ce(Xt,null,Wn(w.value,(Ee,Se)=>(ge(),Ce("div",na({key:Ee.key,ref_for:!0,ref:Ge=>ee(Ge,Se),id:N(Se),role:"option",tabindex:"-1",class:["toolbar-dropdown-option sd-font-combobox__option",{"sd-active":le(Se),"sd-selected":be(Ee)}],"aria-selected":be(Ee)?"true":"false","aria-label":`${D.value} - ${Ee.label}`},{ref_for:!0},Ee.props,{onMousedown:Ge=>ne(Ge,Ee),onMouseenter:Ge=>V(Se),onKeydown:Q}),[he("span",rK,Rt(Ee.label),1)],16,nK))),128))],14,tK)):pt("",!0)])),he("span",oK,Rt(k.value),1)],14,ZW))}},$T=Rn(iK,[["__scopeId","data-v-eb442535"]]);Wt();var sK={__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)=>(ge(),xn($T,{item:n.item,"ui-font-family":n.uiFontFamily,"show-preview":!0,"normalize-value":rt(KW),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"]))}};Wt();var aK={__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)=>(ge(),xn($T,{item:n.item,"ui-font-family":n.uiFontFamily,"show-preview":!1,"normalize-value":rt(XW),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"]))}};Wt(),On();var lK=2500,cK=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=DC(),r=oe(!1),o=oe(null),i=oe(null),s=oe({top:"0px",left:"0px",below:!1});let a=null,l=null,u=null;const d=ke(()=>["sd-tooltip-content",s.value.below&&"sd-tooltip-below",n.class]),f=ke(()=>({...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)},g=()=>{l&&(window.clearTimeout(l),l=null)},v=()=>{u&&(window.clearTimeout(u),u=null)},y=()=>{v(),u=window.setTimeout(()=>{u=null,E()},lK)},_=()=>{if(!o.value||!i.value)return;const j=o.value.getBoundingClientRect(),M=i.value.offsetWidth,B=i.value.offsetHeight,R=window.innerWidth||document.documentElement.clientWidth||0,re=window.innerHeight||document.documentElement.clientHeight||0,te=8;let Y=j.left+j.width/2-M/2;Y=Math.max(te,Math.min(Y,R-M-te));const X=j.top-B-10,U=X<te,Oe=U?j.bottom+10:X,me=Math.max(te,Math.min(Oe,re-B-te));s.value={top:`${me}px`,left:`${Y}px`,below:U}},w=async()=>{t.disabled||(p(),g(),!r.value&&(r.value=!0,y(),await Tt(),_()))},E=()=>{g(),p(),v(),r.value&&(r.value=!1)},k=()=>{if(p(),g(),!r.value){if(t.delay===0){w();return}l=window.setTimeout(()=>{l=null,w()},t.delay)}},C=()=>{if(g(),p(),!!r.value){if(t.duration===0){E();return}a=window.setTimeout(()=>{a=null,E()},t.duration)}},x=()=>{t.trigger==="hover"&&k()},D=()=>{t.trigger==="hover"&&C()},P=()=>{g(),p()},W=()=>{C()},N=j=>{j.key==="Escape"&&E()},L=j=>{(j.key==="Enter"||j.key===" ")&&E()};return Kt(()=>t.disabled,j=>{j&&E()}),Kt(r,j=>{j?(window.addEventListener("resize",_),window.addEventListener("scroll",_,!0),document.addEventListener("keydown",N,!0)):(window.removeEventListener("resize",_),window.removeEventListener("scroll",_,!0),document.removeEventListener("keydown",N,!0))}),wr(()=>{g(),p(),v(),window.removeEventListener("resize",_),window.removeEventListener("scroll",_,!0),document.removeEventListener("keydown",N,!0)}),(j,M)=>(ge(),Ce(Xt,null,[he("span",{ref_key:"triggerRef",ref:o,class:"sd-tooltip-trigger",onMouseenter:x,onMouseleave:D,onFocusin:x,onFocusout:D,onClickCapture:E,onKeydownCapture:L},[Yu(j.$slots,"trigger",{},void 0,!0)],544),(ge(),xn(Bl,{to:"body"},[vn(km,{name:"fade-in-scale-up-transition",css:r.value},{default:Mo(()=>[r.value&&!e.disabled?(ge(),Ce("div",{key:0,ref_key:"contentRef",ref:i,class:gn(d.value),style:Nn(f.value),onMouseenter:P,onMouseleave:W},[M[0]||(M[0]=he("span",{class:"sd-tooltip-arrow","aria-hidden":"true"},null,-1)),Yu(j.$slots,"default",{},void 0,!0)],38)):pt("",!0)]),_:3},8,["css"])]))],64))}}),ev=Rn(cK,[["__scopeId","data-v-71c6de4c"]]);Wt(),On();var uK=["onKeydown","tabindex","data-item-id"],dK={key:0},fK={key:0},hK={key:0},pK={key:0},mK={key:0},gK={__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}=Vr(),o=oe([]),i=oe(null),s=e,a=oe(null),{isHighContrastMode:l}=ds(),u=window.matchMedia("(max-width: 768px)").matches,d=ke(()=>s.position==="left"?{minWidth:s.compactSideGroups?"auto":"120px",justifyContent:"flex-start"}:s.position==="right"?{minWidth:s.compactSideGroups?"auto":"120px",justifyContent:"flex-end"}:{flexGrow:u?0:1,justifyContent:"center"}),f=Fe=>Fe.type==="button",p=Fe=>Fe.type==="dropdown",g=Fe=>Fe.type==="dropdown"&&Fe.name?.value==="fontFamily",v=Fe=>Fe.type==="dropdown"&&Fe.name?.value==="fontSize",y=Fe=>Fe.type==="separator",_=Fe=>Fe.type==="overflow",w=Fe=>!!Fe.nestedOptions?.value?.length,E=Fe=>{if(!Fe)return!1;const Le=Fe.expand;return typeof Le=="object"&&Le!==null&&"value"in Le?!!Le.value:!!Le},k=(Fe,Le)=>{Fe?.expand&&(Fe.expand.value=Le)},C=(Fe,Le=void 0)=>{if(Fe.disabled.value)return;if(_(Fe)){const H=!E(Fe);H&&P(),k(Fe,H),a.value=H?Fe:null,n("item-clicked");return}if(p(Fe))return;a.value&&p(a.value)&&E(a.value)&&P(),n("item-clicked");const de=Le!==void 0?Le:Fe.argument?.value;n("command",de===void 0?{item:Fe}:{item:Fe,argument:de})},x=(Fe,Le)=>{Fe.disabled.value||(a.value=null,n("command",{item:Fe,argument:Le}))},D=Fe=>{if(Fe.disabled.value)return;P();const Le=Fe.splitButtonCommand,de=Fe.command,H=Le||de;if(!H)return;const A={...Fe,command:H};n("item-clicked"),n("command",{item:A})},P=()=>{const Fe=r?.$toolbar?.toolbarItems||[],Le=r?.$toolbar?.overflowItems||[],de=[...Fe,...Le];(de.length?de:s.toolbarItems).forEach(H=>{const A=_(H)&&!s.fromOverflow;(p(H)||A)&&k(H,!1)}),a.value=null},W=(Fe,Le)=>{P();const de=Fe.dropdownValueKey.value?Le[Fe.dropdownValueKey.value]:Le.label;n("command",{item:Fe,argument:de,option:Le}),Fe.selectedValue.value=Le.key,Fe.restoreEditorFocus&&fc(r?.$toolbar)},N=Fe=>{n("command",Fe)},L=()=>{P(),n("item-clicked")},j=()=>{const Fe=document.querySelector('[role="textbox"][aria-label*="SuperDoc body"], .ProseMirror');return Fe instanceof HTMLElement?(Fe.focus({preventScroll:!0}),!0):!1},M=()=>{const Fe=r?.$toolbar?.pendingSelectionCapture,Le=()=>{Fe&&typeof r?.$toolbar?.ui?.selection?.restore=="function"&&r.$toolbar.ui.selection.restore(Fe)};if(j()){Le();return}typeof r?.$toolbar?.superdoc?.focus=="function"&&(r.$toolbar.superdoc.focus(),Le())},B=Fe=>!(Fe instanceof HTMLElement)||Fe.classList.contains("sd-disabled")?null:Fe.querySelector("input:not([disabled]), textarea:not([disabled]), select:not([disabled])")||Fe.querySelector('button:not([disabled]), [role="button"]:not(.sd-disabled), [tabindex]:not([tabindex="-1"])'),R=(Fe,Le)=>{const de=Fe?.target?.closest?.(".sd-toolbar-item-ctn");if(!(de instanceof HTMLElement))return!1;let H=Le>0?de.nextElementSibling:de.previousElementSibling;for(;H;){const A=B(H);if(A instanceof HTMLElement)return de.setAttribute("tabindex","-1"),H.setAttribute("tabindex","0"),A.focus(),!0;H=Le>0?H.nextElementSibling:H.previousElementSibling}return!1},re=Fe=>{P();const Le=Fe?.shiftKey?-1:1;R(Fe,Le)||M()},te=Fe=>{if(P(),Fe?.shiftKey){R(Fe,-1)||M();return}M()},Y=()=>{M()},X=Fe=>Fe.nestedOptions?.value?.length?Fe.nestedOptions.value.map(Le=>{const de=Le?.type!=="render"&&Fe.selectedValue.value===Le.key;return{...Le,props:{...Le.props,class:de?"sd-selected":""}}}):[],U=(Fe,Le)=>({role:"menuitem","aria-label":`${Le.attributes.value.ariaLabel} - ${Fe.label}`}),Oe=Fe=>{const Le=Fe.target,de=Fe.target.closest(".sd-toolbar-item-ctn").nextElementSibling;de&&(Le.setAttribute("tabindex","-1"),de.setAttribute("tabindex","0"),de.focus())},me=Fe=>{const Le=Fe.target,de=Fe.target.closest(".sd-toolbar-item-ctn").previousElementSibling;de&&(Le.setAttribute("tabindex","-1"),de.setAttribute("tabindex","0"),de.focus())},ce=Fe=>{const Le=Fe.target.closest(".button-group").nextElementSibling;if(Le)Le.setAttribute("tabindex","0"),Le.focus();else{const de=document.querySelector(".ProseMirror");de&&de.focus()}},ve=Fe=>{const Le=Fe.target.closest(".button-group").previousElementSibling;Le&&(Le.setAttribute("tabindex","0"),Le.focus())},Re=Fe=>{if(!Fe.disabled.value){if(p(Fe)){kt(!E(Fe),Fe);return}C(Fe)}},$e=(Fe,Le)=>{const de=Fe.target.nodeName==="INPUT"||Fe.target.nodeName==="TEXTAREA",H=Le.name.value==="fontSize"||Le.name.value==="fontFamily";if(!(de&&H)&&["Enter"," ","Spacebar","Escape","ArrowRight","ArrowLeft","Tab"].includes(Fe.key))switch(Fe.preventDefault(),Fe.key){case"Enter":case" ":case"Spacebar":Re(Le);break;case"Escape":P();break;case"ArrowRight":P(),Oe(Fe);break;case"ArrowLeft":P(),me(Fe);break;case"Tab":Fe.shiftKey?ve(Fe):ce(Fe);break;default:break}},ot=Fe=>{const Le=o.value.find(de=>!de.classList.contains("sd-disabled"));Le&&(Le.setAttribute("tabindex","0"),Le.focus())},kt=(Fe,Le)=>{if(n("item-clicked"),!Fe){P(),n("dropdown-update-show",!1);return}P(),a.value=Le,k(Le,!0),n("dropdown-update-show",!0)},gt=Fe=>{if(!a.value)return;const Le=Fe.target;Le instanceof Element&&(Le.closest('[data-sd-part="dropdown-menu"]')||i.value?.contains(Le)||P())};return Kt(()=>E(a.value),Fe=>{Fe?document.addEventListener("pointerdown",gt,!0):document.removeEventListener("pointerdown",gt,!0)},{immediate:!0}),wr(()=>{document.removeEventListener("pointerdown",gt,!0)}),(Fe,Le)=>(ge(),Ce("div",{style:Nn(d.value),class:"button-group",role:"group",onFocus:ot,ref_key:"buttonGroupRef",ref:i},[(ge(!0),Ce(Xt,null,Wn(e.toolbarItems,(de,H)=>(ge(),Ce("div",{key:de.id.value,class:gn([{narrow:de.isNarrow.value,wide:de.isWide.value,"sd-disabled":de.disabled.value},"sd-toolbar-item-ctn"]),onKeydown:A=>$e(A,de),ref_for:!0,ref_key:"toolbarItemRefs",ref:o,tabindex:H===0?0:-1,"data-item-id":de.id.value},[y(de)?(ge(),xn(LW,{key:0,style:{width:"20px"}})):pt("",!0),g(de)&&w(de)?(ge(),xn(ev,{key:1,trigger:"hover",disabled:!de.tooltip?.value,"content-style":{fontFamily:s.uiFontFamily}},{trigger:Mo(()=>[vn(sK,{item:de,"ui-font-family":s.uiFontFamily,class:"sd-toolbar-button sd-editor-toolbar-dropdown",onCommand:N,onItemClicked:L,onTabOut:Le[0]||(Le[0]=A=>re(A)),onEditorHandoff:Y},null,8,["item","ui-font-family"])]),default:Mo(()=>[he("div",null,[ji(Rt(de.tooltip)+" ",1),de.disabled.value?(ge(),Ce("span",dK,"(disabled)")):pt("",!0)])]),_:2},1032,["disabled","content-style"])):v(de)&&w(de)?(ge(),xn(ev,{key:2,trigger:"hover",disabled:!de.tooltip?.value,"content-style":{fontFamily:s.uiFontFamily}},{trigger:Mo(()=>[vn(aK,{item:de,"ui-font-family":s.uiFontFamily,class:"sd-toolbar-button sd-editor-toolbar-dropdown",onCommand:N,onItemClicked:L,onTabOut:Le[1]||(Le[1]=A=>te(A)),onEditorHandoff:Y},null,8,["item","ui-font-family"])]),default:Mo(()=>[he("div",null,[ji(Rt(de.tooltip)+" ",1),de.disabled.value?(ge(),Ce("span",fK,"(disabled)")):pt("",!0)])]),_:2},1032,["disabled","content-style"])):p(de)&&de.nestedOptions?.value?.length?(ge(),xn(VT,{key:3,options:X(de),disabled:de.disabled.value,show:E(de),"content-style":{fontFamily:s.uiFontFamily},placement:"bottom-start",class:"sd-toolbar-button sd-editor-toolbar-dropdown",onSelect:(A,ne)=>W(de,ne),"onUpdate:show":A=>kt(A,de),style:Nn(de.dropdownStyles.value),"menu-props":()=>({role:"menu",style:{fontFamily:s.uiFontFamily},class:["sd-toolbar-dropdown-menu",{"high-contrast":rt(l)}]}),"node-props":A=>U(A,de)},{trigger:Mo(()=>[vn(ev,{trigger:"hover",disabled:!de.tooltip?.value,"content-style":{fontFamily:s.uiFontFamily}},{trigger:Mo(()=>[vn(R2,{"toolbar-item":de,disabled:de.disabled.value,"allow-enter-propagation":!0,onTextSubmit:A=>x(de,A),onMainClick:A=>D(de)},null,8,["toolbar-item","disabled","onTextSubmit","onMainClick"])]),default:Mo(()=>[he("div",null,[ji(Rt(de.tooltip)+" ",1),de.disabled.value?(ge(),Ce("span",hK,"(disabled)")):pt("",!0)])]),_:2},1032,["disabled","content-style"])]),_:2},1032,["options","disabled","show","content-style","onSelect","onUpdate:show","style","menu-props","node-props"])):f(de)?(ge(),xn(ev,{key:4,trigger:"hover",class:"sd-editor-toolbar-tooltip","content-style":{fontFamily:s.uiFontFamily}},{trigger:Mo(()=>[vn(R2,{"toolbar-item":de,"is-overflow-item":e.fromOverflow,onTextSubmit:A=>x(de,A),onButtonClick:A=>C(de)},null,8,["toolbar-item","is-overflow-item","onTextSubmit","onButtonClick"])]),default:Mo(()=>[de.tooltip?(ge(),Ce("div",pK,[ji(Rt(de.tooltip)+" ",1),de.disabled.value?(ge(),Ce("span",mK,"(disabled)")):pt("",!0)])):pt("",!0)]),_:2},1032,["content-style"])):pt("",!0),_(de)&&e.overflowItems.length?(ge(),xn(VW,{key:5,"toolbar-item":de,"ui-font-family":s.uiFontFamily,onButtonClick:A=>C(de),"overflow-items":e.overflowItems,onClose:P,onCommand:Le[2]||(Le[2]=A=>n("command",A))},null,8,["toolbar-item","ui-font-family","onButtonClick","overflow-items"])):pt("",!0)],42,uK))),128))],36))}},tv=Rn(gK,[["__scopeId","data-v-fb216897"]]),vK=[["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"]],yK=vK.map(([e,t])=>({label:e,key:e,props:{style:{fontFamily:`${e}, ${t}`},"data-item":"btn-fontFamily-option"}}));function bK(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 wK=[{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"}}],dp={sm:768,md:1024,lg:1280,xl:1410},CK={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"},HT={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"},kK=Object.values(HT);Wt(),On();var SK=["data-superdoc-ui-owner"],_K="Arial, Helvetica, sans-serif",AK={__name:"Toolbar",emits:["command","toggle","select"],setup(e,{emit:t}){const{proxy:n}=Vr();Sy("sdToolbarOwnerId",z1(n.$toolbar.superdoc));let r=oe(1);const o=oe(null),i=oe(0),s=oe(!1);let a=null,l=null,u=n.$toolbar.getAvailableWidth();const d=ke(()=>{const j=n?.$toolbar?.config?.uiDisplayFallbackFont;return typeof j=="string"&&j.trim()?j.trim():_K}),f=n.$toolbar.config?.toolbarGroups?.includes("left"),p=n.$toolbar.config?.toolbarGroups?.includes("right"),g=j=>(i.value,n.$toolbar.getToolbarItemByGroup(j)),v=()=>{s.value=n.$toolbar.getAvailableWidth()<=dp.lg},y=()=>{const j=o.value,M=j?.ownerDocument,B=M?.activeElement;if(!j?.contains(B))return null;const R=B.closest('[data-sd-part="toolbar-item"]')??B.querySelector('[data-sd-part="toolbar-item"]');if(!R||B!==R&&!B.contains(R))return null;const re=R.querySelector("[data-item]")?.getAttribute("data-item");return re?()=>{const te=o.value;if(!te?.isConnected||B.isConnected||M.activeElement!==M.body)return;const Y=[...te.querySelectorAll("[data-item]")];for(const X of[re,"btn-overflow"]){const U=Y.find(Oe=>Oe.getAttribute("data-item")===X)?.closest('[data-sd-part="toolbar-item"]');if(U&&U.getAttribute("aria-disabled")!=="true"){U.focus({preventScroll:!0});return}}}:null},_=async j=>{r.value+=1,await Tt(),j?.()},E=pW(async()=>{const j=n.$toolbar.getAvailableWidth();if(j===u)return;u=j;const M=y();await n.$toolbar.onToolbarResize(),v(),await _(M)},300),k=()=>{const j=y();u=n.$toolbar.getAvailableWidth(),v(),_(j)},C=()=>{i.value+=1};function x(){E.cancel(),window.removeEventListener("resize",E),n.$toolbar.off?.("toolbar-items-changed",k),n.$toolbar.off?.("toolbar-state-change",C),a?.disconnect(),a=null}function D(){x(),window.addEventListener("resize",E),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(()=>{E()}),a.observe(n.$toolbar.toolbarContainer)),v()}tr(D),Ty(D),xy(x),wr(x);const P=()=>{if(!n.$toolbar.activeEditor){l=null,n.$toolbar.pendingSelectionCapture=null;return}l=n.$toolbar.ui?.selection?.capture?.()??null,n.$toolbar.pendingSelectionCapture=l},W=({item:j,argument:M,option:B})=>{const R=BT(j?.name?.value);j?.type==="button"&&!j.isCustomToolbarItem&&["bold","italic","underline","strikethrough"].includes(R)&&n.$toolbar.snapshot?.commands?.[R]?.source==="builtin"||N(),n.$toolbar.emitCommand({item:j,argument:M,option:B})},N=()=>{if(!n.$toolbar.activeEditor)return;const j=n.$toolbar.pendingSelectionCapture??l;j&&typeof n.$toolbar.ui?.selection?.restore=="function"&&n.$toolbar.ui.selection.restore(j)},L=j=>{P(),jT(j)};return(j,M)=>(ge(),Ce("div",{class:"superdoc-toolbar",ref_key:"toolbarRoot",ref:o,key:rt(r),role:"toolbar","aria-label":"Toolbar","data-sd-part":"toolbar","data-editor-ui-surface":"","data-superdoc-ui-owner":rt(z1)(rt(n).$toolbar.superdoc),onMousedown:L},[rt(f)?(ge(),xn(tv,{key:0,tabindex:"0","toolbar-items":g("left"),"overflow-items":rt(n).$toolbar.overflowItems,"compact-side-groups":s.value,"ui-font-family":d.value,position:"left",onCommand:W,class:"superdoc-toolbar-group-side"},null,8,["toolbar-items","overflow-items","compact-side-groups","ui-font-family"])):pt("",!0),vn(tv,{tabindex:"0","toolbar-items":g("center"),"overflow-items":rt(n).$toolbar.overflowItems,"compact-side-groups":s.value,"ui-font-family":d.value,position:"center",onCommand:W},null,8,["toolbar-items","overflow-items","compact-side-groups","ui-font-family"]),rt(p)?(ge(),xn(tv,{key:1,tabindex:"0","toolbar-items":g("right"),"overflow-items":rt(n).$toolbar.overflowItems,"compact-side-groups":s.value,"ui-font-family":d.value,position:"right",onCommand:W,class:"superdoc-toolbar-group-side"},null,8,["toolbar-items","overflow-items","compact-side-groups","ui-font-family"])):pt("",!0)],40,SK))}},IK=Rn(AK,[["__scopeId","data-v-9554df11"]]),EK=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"}}};Wt();var Hn=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=oe(Fa()),n=e.type,r=oe(e.name),o=e.command,i=e.noArgumentCommand,s=oe(e.icon),a=oe(e.group||"center"),l=oe(e.allowWithoutEditor),u=oe(e.attributes||{}),d=!!e.disabled,f=oe(e.disabled),p=oe(!1),g=oe(!1),v=oe(e.style),y=oe(e.isNarrow),_=oe(e.isWide),w=oe(e.minWidth),E=oe(e.layoutWidth),k=oe(e.suppressActiveHighlight||!1),C=oe(e.argument),x=oe(null),D=oe(null),P=oe(e.iconColor),W=oe(e.hasCaret),N=oe(!!e.splitButton),L=e.splitButtonCommand,j=!!e.restoreEditorFocus,M=oe(e.dropdownStyles),B=oe(e.tooltip),R=oe(e.tooltipVisible),re=oe(e.tooltipTimeout),te=oe(e.defaultLabel),Y=oe(e.label),X=oe(e.hideLabel),U=oe(e.inlineTextInputVisible),Oe=oe(e.hasInlineTextInput),me=oe(e.markName),ce=oe(e.labelAttr),ve=oe(e.selectedValue),Re=oe(e.dropdownValueKey),$e=oe(e.inputRef||null),ot=oe([]);if(e.options){if(!Array.isArray(e.options))throw new Error("Invalid toolbar item options - "+e.options);let ne=0;for(let V=0;V<e.options.length;V+=1){const Q=e.options[V];(!Q||typeof Q!="object")&&(ne+=1)}if(ne)throw new Error(`Toolbar item options must all be objects - ${e.name}. ${ne} row(s) are not, so this item is skipped.`);ot.value?.push(...e.options)}const kt=(ne={},...V)=>{Le(ne,...V),!k.value&&(p.value=!0)},gt=()=>{de(),p.value=!1},Bt=ne=>{f.value=ne},Fe=()=>{f.value=d},Le=e.onActivate||(()=>null),de=e.onDeactivate||(()=>null),H=()=>{const ne={};return Object.keys(A).forEach(V=>{A[V].value!==void 0&&(ne[V]=A[V].value)}),ne},A={id:t,name:r,type:n,command:o,noArgumentCommand:i,icon:s,tooltip:B,group:a,attributes:u,disabled:f,active:p,expand:g,nestedOptions:ot,style:v,isNarrow:y,isWide:_,minWidth:w,layoutWidth:E,argument:C,parentItem:D,iconColor:P,hasCaret:W,splitButton:N,splitButtonCommand:L,dropdownStyles:M,tooltipVisible:R,tooltipTimeout:re,defaultLabel:te,label:Y,hideLabel:X,inlineTextInputVisible:U,hasInlineTextInput:Oe,restoreEditorFocus:j,markName:me,labelAttr:ce,childItem:x,allowWithoutEditor:l,dropdownValueKey:Re,selectedValue:ve,inputRef:$e};return{...A,initiallyDisabled:d,unref:H,activate:kt,deactivate:gt,setDisabled:Bt,resetDisabled:Fe,onActivate:Le,onDeactivate:de}};Wt(),On();var TK=["onClick","innerHTML","aria-label","onKeydown"],xK={__name:"AlignmentButtons",emits:["select"],setup(e,{emit:t}){const{isHighContrastMode:n}=ds(),r=t,o=oe([]),i=[{key:"left",ariaLabel:"Align left",icon:kr.alignLeft},{key:"center",ariaLabel:"Align center",icon:kr.alignCenter},{key:"right",ariaLabel:"Align right",icon:kr.alignRight},{key:"justify",ariaLabel:"Justify",icon:kr.alignJustify}],s=d=>{r("select",d)},a=d=>{if(d===o.value.length-1)return;const f=o.value[d+1];f&&(f.setAttribute("tabindex","0"),f.focus())},l=d=>{if(d===0)return;const f=o.value[d-1];f&&(f.setAttribute("tabindex","0"),f.focus())},u=(d,f)=>{switch(d.key){case"ArrowLeft":l(f);break;case"ArrowRight":a(f);break;case"Enter":s(i[f].key);break;default:break}};return tr(()=>{const d=o.value[0];d&&(d.setAttribute("tabindex","0"),d.focus())}),(d,f)=>(ge(),Ce("div",{class:gn(["alignment-buttons",{"high-contrast":rt(n)}])},[(ge(),Ce(Xt,null,Wn(i,(p,g)=>he("div",{key:p.key,class:"sd-button-icon",onClick:v=>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:pn(v=>u(v,g),["prevent"])},null,40,TK)),64))],2))}},RK=Rn(xK,[["__scopeId","data-v-13e5f7a4"]]);Wt(),On();var MK=["onClick","innerHTML","aria-label","onKeydown"],LK={__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}=ds(),r=t,o=e,i=oe([]),s=ke(()=>({width:`${o.iconSize}px`,height:`${o.iconSize}px`})),a=f=>{r("select",f)},l=f=>{if(f===i.value.length-1)return;const p=i.value[f+1];p&&(p.setAttribute("tabindex","0"),p.focus())},u=f=>{if(f===0)return;const p=i.value[f-1];p&&(p.setAttribute("tabindex","0"),p.focus())},d=(f,p)=>{switch(f.key){case"ArrowLeft":u(p);break;case"ArrowRight":l(p);break;case"Enter":a(o.buttons[p].key);break;default:break}};return tr(()=>{const f=i.value[0];f&&(f.setAttribute("tabindex","0"),f.focus())}),(f,p)=>(ge(),Ce("div",{class:gn(["style-buttons-list",{"high-contrast":rt(n)}])},[(ge(!0),Ce(Xt,null,Wn(o.buttons,(g,v)=>(ge(),Ce("div",{key:g.key,class:gn(["sd-button-icon",{"sd-selected":o.selectedStyle===g.key}]),style:Nn(s.value),onClick:y=>a(g.key),innerHTML:g.icon,role:"menuitem","aria-label":g.ariaLabel,ref_for:!0,ref_key:"buttonRefs",ref:i,onKeydown:pn(y=>d(y,v),["prevent"])},null,46,MK))),128))],2))}},GT=Rn(LK,[["__scopeId","data-v-44f37ff6"]]),OK=[{key:"disc",icon:kr.bulletListDisc,ariaLabel:"Opaque circle"},{key:"circle",icon:kr.bulletListCircle,ariaLabel:"Outline circle"},{key:"square",icon:kr.bulletListSquare,ariaLabel:"Opaque square"}],DK=[{key:"decimal",icon:kr.numberedListDecimal,ariaLabel:"1. 2. 3."},{key:"decimal-paren",icon:kr.numberedListDecimalParen,ariaLabel:"1) 2) 3)"},{key:"upper-roman",icon:kr.numberedListUpperRoman,ariaLabel:"I. II. III."},{key:"lower-roman",icon:kr.numberedListLowerRoman,ariaLabel:"i. ii. iii."},{key:"upper-alpha",icon:kr.numberedListUpperAlpha,ariaLabel:"A. B. C."},{key:"upper-alpha-paren",icon:kr.numberedListUpperAlphaParen,ariaLabel:"A) B) C)"},{key:"lower-alpha",icon:kr.numberedListLowerAlpha,ariaLabel:"a. b. c."},{key:"lower-alpha-paren",icon:kr.numberedListLowerAlphaParen,ariaLabel:"a) b) c)"}];Wt(),On();var PK=["onClick","onKeydown"],FK={class:"document-mode-column icon-column"},NK=["innerHTML"],BK={class:"document-mode-column text-column"},zK={class:"document-mode-type"},VK={class:"document-mode-description"},jK={__name:"DocumentMode",props:{options:{type:Array}},emits:["select"],setup(e,{emit:t}){const n=t,r=oe([]),{isHighContrastMode:o}=ds(),i=e,s=d=>{n("select",d)},a=d=>{if(d===r.value.length-1)return;const f=r.value[d+1];f&&(f.setAttribute("tabindex","0"),f.focus())},l=d=>{if(d===0)return;const f=r.value[d-1];f&&(f.setAttribute("tabindex","0"),f.focus())},u=(d,f)=>{switch(d.key){case"ArrowDown":a(f);break;case"ArrowUp":l(f);break;case"Enter":s(i.options[f]);break;default:break}};return tr(()=>{r.value[0].setAttribute("tabindex","0"),r.value[0].focus()}),(d,f)=>(ge(),Ce("div",{class:gn(["document-mode",{"high-contrast":rt(o)}])},[(ge(!0),Ce(Xt,null,Wn(e.options,(p,g)=>(ge(),Ce("div",{class:gn(["sd-option-item",{"sd-disabled":p.disabled}]),onClick:v=>s(p),"data-item":"btn-documentMode-option",role:"menuitem",ref_for:!0,ref_key:"documentModeRefs",ref:r,onKeydown:pn(v=>u(v,g),["prevent"])},[he("div",FK,[he("div",{class:"icon-column__icon",innerHTML:p.icon},null,8,NK)]),he("div",BK,[he("div",zK,Rt(p.label),1),he("div",VK,Rt(p.description),1)])],42,PK))),256))],2))}},UK=Rn(jK,[["__scopeId","data-v-bee14d7a"]]);Wt(),On();var $K={class:"linked-style-buttons","data-editor-ui-surface":""},HK=["onClick","onKeydown","aria-label"],GK=["title","aria-label","onClick"],WK=["innerHTML"],KK={__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=oe([]),o=e,i=g=>{n("select",g)},s=g=>{n("update",g)},a=g=>{if(g===r.value.length-1)return;const v=r.value[g+1];v.setAttribute("tabindex","0"),v.focus()},l=g=>{if(g===0)return;const v=r.value[g-1];v.setAttribute("tabindex","0"),v.focus()},u=(g,v,y)=>{switch(g.key){case"ArrowDown":a(v);break;case"ArrowUp":l(v);break;case"Enter":g.preventDefault(),i(y);break;default:break}},d=g=>g?.name??g?.id??"",f=g=>{const v=g?.preview?.css;return v&&typeof v=="object"?v:void 0},p=()=>{r.value[0]&&(r.value[0].setAttribute("tabindex","0"),r.value[0].focus())};return tr(p),Kt(()=>o.styles.length,async(g,v)=>{g===0||v!==0||(await Tt(),p())}),(g,v)=>(ge(),Ce("div",$K,[(ge(!0),Ce(Xt,null,Wn(o.styles,(y,_)=>(ge(),Ce("div",{key:y.id??_,class:gn(["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},[he("div",{class:"style-name","data-item":"btn-linkedStyles-option",style:Nn(f(y))},Rt(d(y)),5),he("button",{type:"button",class:"style-update","data-item":"btn-linkedStyles-update",title:o.updateLabel,"aria-label":`${o.updateLabel}: ${d(y)}`,onClick:pn(w=>s(y),["stop"]),onKeydown:v[0]||(v[0]=pn(()=>{},["stop"]))},[he("span",{class:"style-update-icon",innerHTML:rt(kr).paintbrush},null,8,WK)],40,GK)],42,HK))),128))]))}},qK=Rn(KK,[["__scopeId","data-v-b5a32523"]]);Wt(),On();var YK=["placeholder"],XK={class:"sd-ai-writer__footer"},ZK={key:0,class:"sd-ai-writer__error",role:"alert"},QK=["disabled"],JK="https://sd-dev-express-gateway-i6xtm.ondigitalocean.app/insights",eq="You are an expert copywriter and you are immersed in a document editor. Only write what is asked for.",tq={__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=oe(""),r=oe(!1),o=oe(""),i=oe(null),s=ke(()=>t.selectedText?"Insert prompt to update text":"Insert prompt to generate text"),a=ke(()=>n.value.trim().length>0&&!r.value);tr(()=>{Tt(()=>{i.value?.focus()})});function l(v){if(typeof v=="string")return v;if(!v||typeof v!="object")return"";const y=v.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 v.value=="string"?v.value:typeof v.text=="string"?v.text:""}async function u(v){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: ${v}`:`Generate text based on the following prompt: ${v}`,E=await fetch(t.endpoint||JK,{method:"POST",headers:y,body:JSON.stringify({stream:!1,context:eq,insights:[{type:"custom_prompt",name:_?"text_rewrite":"text_generation",message:w,format:[{value:""}]}]})});if(!E.ok){const C=await E.text().catch(()=>"");throw new Error(C||`AI request failed with ${E.status}`)}const k=l((E.headers.get("content-type")||"").includes("application/json")?await E.json():await E.text()).trim();if(!k)throw new Error("AI returned no text.");return k}function d(v){return!v||typeof v!="object"?!0:!(v.success===!1||v.ok===!1)}function f(v){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:v}),w=!0):t.target&&typeof y.insert=="function"?(_=y.insert({target:t.target,value:v,type:"text"}),w=!0):typeof y.insert=="function"&&(_=y.insert({value:v,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{f(await u(n.value.trim())),t.handleClose()}catch(v){o.value=v instanceof Error?v.message:String(v)}finally{r.value=!1}}}function g(v){v.key!=="Enter"||v.shiftKey||(v.preventDefault(),p())}return(v,y)=>(ge(),Ce("form",{class:"sd-ai-writer","data-item":"ai-writer",onSubmit:pn(p,["prevent"])},[Vi(he("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:g},null,40,YK),[[Hi,n.value]]),he("div",XK,[o.value?(ge(),Ce("p",ZK,Rt(o.value),1)):pt("",!0),he("button",{class:"sd-ai-writer__submit",type:"submit",disabled:!a.value},Rt(r.value?"Generating":"Generate"),9,QK)])],32))}},nq=Rn(tq,[["__scopeId","data-v-67f6c6f7"]]);Wt(),On();var rq=["aria-label","onClick","onKeydown"],oq=["innerHTML"],iq=["innerHTML"],nv=7,sq={__name:"IconGridRow",props:{icons:{type:Array,required:!0},activeColor:{type:Object,required:!1}},emits:["select","clickoutside"],setup(e,{emit:t}){const n=t,r=e,o=ke(()=>v=>r.activeColor.value?r.activeColor.value.toUpperCase()===v.value:!1),i=(v,y)=>y===5||["#FFFFFF","#FAFF09"].includes(v)?{color:"#000"}:{color:"#FFF"},s=v=>{n("select",v.value)},a=oe([]),l=oe([]);tr(()=>{if(!r.icons.every(y=>Array.isArray(y)))throw new Error("icon props must be 2d array");const v=l.value[0];v&&(v.setAttribute("tabindex","0"),v.focus({preventScroll:!0}))});const u=(v,y)=>{const _=nv*v+y+1,w=l.value[_];w&&(w.setAttribute("tabindex","0"),w.focus({preventScroll:!0}))},d=(v,y)=>{const _=nv*v+y-1,w=l.value[_];w&&(w.setAttribute("tabindex","0"),w.focus({preventScroll:!0}))},f=(v,y)=>{const _=y+nv*(v+1),w=l.value[_];w&&(w.setAttribute("tabindex","0"),w.focus({preventScroll:!0}))},p=(v,y)=>{const _=y+nv*(v-1),w=l.value[_];w&&(w.setAttribute("tabindex","0"),w.focus({preventScroll:!0}))},g=(v,y,_,w)=>{switch(v.key){case"ArrowRight":u(y,_);break;case"ArrowLeft":d(y,_);break;case"ArrowDown":f(y,_);break;case"ArrowUp":p(y,_);break;case"Enter":s(w);break;case"Escape":n("clickoutside");break;default:break}};return(v,y)=>(ge(!0),Ce(Xt,null,Wn(e.icons,(_,w)=>(ge(),Ce("div",{class:"sd-option-row",key:w,role:"group",ref_for:!0,ref_key:"rowRefs",ref:a},[(ge(!0),Ce(Xt,null,Wn(_,(E,k)=>(ge(),Ce("div",{class:"sd-option",key:k,"aria-label":E.label,role:"menuitem",ref_for:!0,ref_key:"iconRefs",ref:l,onClick:pn(C=>s(E),["stop","prevent"]),onKeydown:pn(C=>g(C,w,k,E),["prevent"])},[he("div",{class:"sd-option__icon",innerHTML:E.icon,style:Nn(E.style)},null,12,oq),o.value(E)?(ge(),Ce("div",{key:0,class:"sd-option__check",innerHTML:rt(kr).colorOptionCheck,style:Nn(i(E.value,k))},null,12,iq)):pt("",!0)],40,rq))),128))]))),128))}},WT=Rn(sq,[["__scopeId","data-v-05eb02fc"]]),aq=`<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
|
`;Wt(),On();var lq={class:"options-grid-wrap"},cq=["innerHTML"],uq={class:"option-grid-ctn"},dq={__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)=>(ge(),Ce("div",lq,[e.hasNoneIcon?(ge(),Ce("div",{key:0,class:"none-option",role:"menuitem","aria-label":"Clear color selection",onClick:i[0]||(i[0]=s=>r("none"))},[he("span",{innerHTML:rt(aq),class:"none-icon"},null,8,cq),i[1]||(i[1]=ji(" None ",-1))])):pt("",!0),he("div",uq,[vn(WT,{icons:e.icons,"active-color":e.activeColor,onSelect:r},null,8,["icons","active-color"]),e.customIcons.flat().length?(ge(),Ce(Xt,{key:0},[i[2]||(i[2]=he("span",{class:"option-grid-ctn__subtitle"},"Custom colors",-1)),vn(WT,{icons:e.customIcons,"active-color":e.activeColor,onSelect:r},null,8,["icons","active-color"])],64)):pt("",!0)])]))}},fq=Rn(dq,[["__scopeId","data-v-52b0283a"]]);Wt();var hq=e=>{e.expand.value=!1},on=(e,t=null)=>({label:t,icon:kr.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}),hq(t),fc(e)};return no("div",{},[no(fq,{icons:pq,customIcons:n,activeColor:t.iconColor,hasNoneIcon:r,onSelect:o})])},pq=[[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")]];Wt(),On();var mq=["data-cols","data-rows","onKeydown","onClick"],gq=["aria-valuetext"],rv=5,vq={__name:"TableGrid",emits:["select","clickoutside"],setup(e,{emit:t}){const n=t,r=oe(0),o=oe(0),{isHighContrastMode:i}=ds(),s=oe([]),a=f=>{let p=f.target;if(p.dataset.grid)return;let g=[...p.parentElement.querySelectorAll("[data-item]")],v=parseInt(p.dataset.cols,10),y=parseInt(p.dataset.rows,10);l(g,v,y)},l=(f,p,g)=>{o.value=p,r.value=g;for(let v=0;v<f.length;v++){let y=f[v],_=parseInt(y.dataset.cols,10),w=parseInt(y.dataset.rows,10);_<=p&&w<=g?y.classList.add("sd-selected"):y.classList.remove("sd-selected")}},u=({cols:f,rows:p})=>{n("select",{cols:f,rows:p})},d=(f,p,g)=>{let v=p-1,y=g-1;switch(f.key){case"ArrowRight":{if(v>=4)return;const _=y*rv;s.value[_+v+1].setAttribute("tabindex","0"),s.value[_+v+1].focus(),l(s.value,p+1,g);break}case"ArrowLeft":{if(v<=0)return;const _=y*rv;s.value[_+v-1].setAttribute("tabindex","0"),s.value[_+v-1].focus(),l(s.value,p-1,g);break}case"ArrowDown":{if(y>=4)return;const _=(y+1)*rv;s.value[_+v].setAttribute("tabindex","0"),s.value[_+v].focus(),l(s.value,p,g+1);break}case"ArrowUp":{if(y<=0)return;const _=(y-1)*rv;s.value[_+v].setAttribute("tabindex","0"),s.value[_+v].focus(),l(s.value,p,g-1);break}case"Enter":u({cols:p,rows:g});break;default:break}};return tr(()=>{s.value[0].setAttribute("tabindex","0"),s.value[0].focus(),l(s.value,1,1)}),(f,p)=>(ge(),Ce("div",{class:gn(["toolbar-table-grid-wrapper",{"high-contrast":rt(i)}])},[he("div",{class:"toolbar-table-grid",onMouseover:a,"data-grid":"true"},[(ge(),Ce(Xt,null,Wn(5,g=>(ge(),Ce(Xt,{key:g},[(ge(),Ce(Xt,null,Wn(5,v=>he("div",{class:"toolbar-table-grid__item",key:`${g}_${v}`,"data-cols":v,"data-rows":g,"data-item":"true",ref_for:!0,ref_key:"tableGridItems",ref:s,onKeydown:pn(y=>d(y,v,g),["prevent"]),onClick:pn(y=>u({cols:v,rows:g}),["stop","prevent"])},null,40,mq)),64))],64))),64))],32),he("div",{class:"toolbar-table-grid-value","aria-valuetext":`${r.value} x ${o.value}`},Rt(r.value)+" x "+Rt(o.value),9,gq)],2))}},yq=Rn(vq,[["__scopeId","data-v-b87d6ca2"]]);Wt(),On();var bq={class:"toolbar-table-actions"},wq=["onClick","data-item","ariaLabel"],Cq={class:"toolbar-table-actions__icon"},kq=["innerHTML"],Sq={class:"toolbar-table-actions__label"},_q={__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)=>(ge(),Ce("div",bq,[(ge(!0),Ce(Xt,null,Wn(e.options,s=>(ge(),Ce("div",{class:gn(["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"},[he("div",Cq,[he("div",{class:"toolbar-table-actions__icon-wrapper",innerHTML:s.icon},null,8,kq)]),he("div",Sq,Rt(s.label),1)],10,wq))),256))]))}},Aq=Rn(_q,[["__scopeId","data-v-0cdad084"]]);Wt(),On();var Iq=["aria-busy"],Eq=["aria-disabled"],Tq={class:"sd-page-number-menu__row-label","aria-hidden":"true"},xq=["aria-checked","aria-label","title","tabindex","data-position","data-alignment","onClick"],Rq={class:"sd-page-number-menu__page",viewBox:"0 0 36 46","aria-hidden":"true",focusable:"false"},Mq=["x","y"],Lq={class:"sd-page-number-menu__check"},Oq=["disabled"],Dq={class:"sd-page-number-menu__format"},Pq={class:"sd-page-number-menu__field"},Fq=["disabled"],Nq=["value"],Bq={class:"sd-page-number-menu__start"},zq={class:"sd-page-number-menu__check"},Vq=["disabled"],jq=["disabled","onKeydown"],Uq={key:0,class:"sd-page-number-menu__error",role:"alert"},$q={key:1,class:"sd-page-number-menu__note",role:"status"},Hq={class:"sd-page-number-menu__actions"},Gq=["disabled"],Wq=["disabled"],Kq=["disabled"],qq={class:"sd-page-number-menu__cursor-text"},Yq={__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(Le=>r.map(de=>({position:Le.value,alignment:de.value,label:`${Le.label}, ${de.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}=ds(),d=t.initialChoice??{},f=oe(d.position==="top"?"top":"bottom"),p=oe(r.some(Le=>Le.value===d.alignment)?d.alignment:"right"),g=oe(d.showOnFirstPage!==!1),v=oe("decimal"),y=oe(!1),_=oe(1),w=oe(null),E=oe(typeof t.loadCurrent=="function");let k=Promise.resolve();const C=oe(!1),x=oe(!1),D=oe(""),P=oe([]),W=ke(()=>t.pageNumbersState?.enabled===!0),N=ke(()=>t.atCursorState?.enabled===!0),L=ke(()=>(w.value?.placements?.length??0)>0),j=ke(()=>s.some(Le=>Le.value===v.value)?[...i,...s]:i),M=ke(()=>o.findIndex(Le=>Le.position===f.value&&Le.alignment===p.value)),B=ke(()=>{if(M.value>=0)return M.value;const Le=n.findIndex(de=>de.value===f.value);return Math.max(0,Le)*r.length}),R=ke(()=>L.value?"Apply":"Add page numbers"),re=ke(()=>W.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."),te=ke(()=>N.value?"In the header or footer youβre editing":t.inHeaderFooter?"Place the cursor without selecting text":"Click into a header or footer first"),Y=ke(()=>{const Le=typeof navigator>"u"?"":navigator.platform||navigator.userAgent||"";return/Mac|iPhone|iPad/i.test(Le)?"β₯β§βP":"Ctrl+Alt+Shift+P"});function X(Le){return Le.position===f.value&&Le.alignment===p.value}function U(){C.value=!0,D.value=""}function Oe(Le,{focus:de=!1}={}){f.value=Le.position,p.value=Le.alignment,U(),de&&Tt(()=>P.value[o.indexOf(Le)]?.focus())}function me(Le){const de=B.value,H=Math.floor(de/r.length),A=de%r.length,ne={ArrowLeft:[H,Math.max(0,A-1)],ArrowRight:[H,Math.min(r.length-1,A+1)],ArrowUp:[Math.max(0,H-1),A],ArrowDown:[Math.min(n.length-1,H+1),A],Home:[H,0],End:[H,r.length-1]}[Le.key];return ne?(Le.preventDefault(),Oe(o[ne[0]*r.length+ne[1]],{focus:!0}),!0):!1}function ce(Le){me(Le)||(Le.key==="Enter"?(Le.preventDefault(),gt()):Le.key===" "&&Le.preventDefault())}function ve(Le){if(w.value=Le&&Array.isArray(Le.placements)?Le:null,!w.value||C.value)return;const de=w.value.placements.find(H=>H.kind==="footer"&&H.alignment)??w.value.placements.find(H=>H.alignment)??w.value.placements[0];de&&(f.value=de.kind==="header"?"top":"bottom",p.value=de.alignment??null,g.value=w.value.showOnFirstPage!==!1),v.value=w.value.format??"decimal",y.value=typeof w.value.start=="number",_.value=typeof w.value.start=="number"?w.value.start:1,Tt(()=>P.value[B.value]?.focus({preventScroll:!0}))}function Re(){const Le=w.value,de=f.value==="top"?"header":"footer",H=Le?.placements?.find(V=>V.kind===de)??null,A={position:f.value};p.value&&(!H||H.alignment!==p.value)&&(A.alignment=p.value),(!L.value||g.value!==(Le?.showOnFirstPage!==!1))&&(A.showOnFirstPage=g.value),v.value!==(Le?.format??"decimal")&&(A.format=v.value);const ne=y.value?$e():null;return ne!==(Le?.start??null)&&(A.start=ne),A}function $e(){const Le=Math.floor(Number(_.value));return Number.isFinite(Le)&&Le>=0?Le:1}function ot(Le,de){const H=Le?.failure?.details;return H?.reason==="page-number-has-content"?`A page number shares its line with other text. Edit the ${H.kind==="header"?"header":"footer"} directly to change it.`:H?.reason==="page-number-exists"?"This section already has page numbers.":de==="remove"?"Page numbers couldnβt be removed. Try again.":L.value?"Page numbers couldnβt be changed. Try again.":"Page numbers couldnβt be added. Try again."}async function kt(Le,de){if(!(!W.value||x.value)){x.value=!0,D.value="";try{await k;const{execute:H,outcome:A}=de(),ne=await H();if(ne===!0||ne?.success===!0){t.close(A);return}D.value=ot(ne,Le)}catch{D.value=ot(null,Le)}finally{x.value=!1}}}function gt(){return kt("apply",()=>{const Le=Re();return{execute:()=>t.applyPageNumbers(Le),outcome:{action:"apply",choice:{position:f.value,alignment:p.value,showOnFirstPage:g.value}}}})}function Bt(){return kt("remove",()=>({execute:()=>t.removePageNumbers(),outcome:{action:"remove",kinds:(w.value?.placements??[]).map(Le=>Le.kind)}}))}function Fe(){if(!N.value||x.value)return;x.value=!0;let Le;try{Le=t.insertAtCursor()}catch{Le=void 0}t.close({action:"cursor"}),Promise.resolve(Le).catch(()=>{})}return tr(()=>{Tt(()=>P.value[B.value]?.focus({preventScroll:!0})),typeof t.loadCurrent=="function"&&(k=Promise.resolve().then(()=>t.loadCurrent()).then(ve,()=>ve(null)).finally(()=>{E.value=!1}))}),(Le,de)=>(ge(),Ce("div",{class:gn(["sd-page-number-menu",{"high-contrast":rt(u)}]),role:"group","aria-labelledby":"sd-page-number-menu-title","aria-busy":E.value||void 0,"data-sd-page-number-menu":""},[de[9]||(de[9]=he("div",{id:"sd-page-number-menu-title",class:"sd-page-number-menu__title"},"Page numbers",-1)),he("div",{class:"sd-page-number-menu__grid",role:"radiogroup","aria-label":"Position","aria-disabled":!W.value||void 0},[(ge(),Ce(Xt,null,Wn(n,(H,A)=>(ge(),Ce(Xt,{key:H.value},[he("div",Tq,Rt(H.label),1),(ge(!0),Ce(Xt,null,Wn(rt(o).slice(A*3,A*3+3),ne=>(ge(),Ce("button",{key:`${ne.position}-${ne.alignment}`,ref_for:!0,ref:V=>P.value[rt(o).indexOf(ne)]=V,type:"button",role:"radio",class:gn(["sd-page-number-menu__tile",{"is-selected":X(ne)}]),"aria-checked":X(ne),"aria-label":ne.label,title:ne.label,tabindex:rt(o).indexOf(ne)===B.value?0:-1,"data-position":ne.position,"data-alignment":ne.alignment,onClick:V=>Oe(ne),onDblclick:gt,onKeydown:ce},[(ge(),Ce("svg",Rq,[de[4]||(de[4]=ik('<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)),he("rect",{class:"sd-page-number-menu__chip",x:a[ne.alignment],y:l[ne.position],width:"8",height:"5",rx:"1.5"},null,8,Mq)]))],42,xq))),128))],64))),64))],8,Eq),he("label",Lq,[Vi(he("input",{"onUpdate:modelValue":de[0]||(de[0]=H=>g.value=H),type:"checkbox",disabled:!W.value,"data-sd-page-number-first-page":"",onChange:U},null,40,Oq),[[ad,g.value]]),de[5]||(de[5]=he("span",null,"Show on first page",-1))]),he("div",Dq,[he("label",Pq,[de[6]||(de[6]=he("span",null,"Format",-1)),Vi(he("select",{"onUpdate:modelValue":de[1]||(de[1]=H=>v.value=H),disabled:!W.value,"data-sd-page-number-format":"",onChange:U},[(ge(!0),Ce(Xt,null,Wn(j.value,H=>(ge(),Ce("option",{key:H.value,value:H.value},Rt(H.label),9,Nq))),128))],40,Fq),[[Im,v.value]])]),he("div",Bq,[he("label",zq,[Vi(he("input",{"onUpdate:modelValue":de[2]||(de[2]=H=>y.value=H),type:"checkbox",disabled:!W.value,"data-sd-page-number-restart":"",onChange:U},null,40,Vq),[[ad,y.value]]),de[7]||(de[7]=he("span",null,"Start at",-1))]),Vi(he("input",{"onUpdate:modelValue":de[3]||(de[3]=H=>_.value=H),type:"number",min:"0",step:"1",inputmode:"numeric","aria-label":"First page number",disabled:!W.value||!y.value,"data-sd-page-number-start":"",onInput:U,onKeydown:yi(pn(gt,["prevent"]),["enter"])},null,40,jq),[[Hi,_.value,void 0,{number:!0}]])])]),D.value?(ge(),Ce("p",Uq,Rt(D.value),1)):re.value?(ge(),Ce("p",$q,Rt(re.value),1)):pt("",!0),he("div",Hq,[L.value?(ge(),Ce("button",{key:0,type:"button",class:"sd-page-number-menu__remove",disabled:!W.value||x.value,"aria-label":"Remove page numbers","data-sd-page-number-remove":"",onClick:Bt}," Remove ",8,Gq)):pt("",!0),he("button",{type:"button",class:"sd-page-number-menu__add",disabled:!W.value||x.value,"data-sd-page-number-add":"",onClick:gt},Rt(R.value),9,Wq)]),de[10]||(de[10]=he("div",{class:"sd-page-number-menu__divider",role:"separator"},null,-1)),he("button",{type:"button",class:"sd-page-number-menu__cursor",disabled:!N.value||x.value,"data-sd-page-number-at-cursor":"",onClick:Fe},[he("span",qq,[de[8]||(de[8]=he("span",null,"Insert at cursor",-1)),he("small",null,Rt(te.value),1)]),he("kbd",null,Rt(Y.value),1)],8,Kq)],10,Iq))}},Xq=Rn(Yq,[["__scopeId","data-v-30327fd0"]]),L2="sd-page-number-flash",Zq=1400,KT=e=>new Promise(t=>{typeof e?.requestAnimationFrame=="function"?e.requestAnimationFrame(()=>t()):setTimeout(t,16)});async function qT(e,t){const n=e?.ownerDocument?.defaultView;if(!e||!n)return;await KT(n),await KT(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(L2),i.classList.add(L2),n.setTimeout(()=>i.classList.remove(L2),Zq)}var Qq=`<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
|
-
`;Wt();var Zi=e=>{e.expand.value=!1},O2=(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")},Jq=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},YT=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 Jq(r))n.add(o);return e.filter(r=>n.has(r))},eY=e=>{const t=e.find(o=>o.type==="overflow"),n=e.filter(o=>o!==t),r=new Set(YT(n));return e.filter(o=>o===t||r.has(o))};function D2(e,t){const n={...e};return t?n.href=t:delete n.href,n}function XT(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 tY(e){return typeof e?.quotedText=="string"?e.quotedText:typeof e?.text=="string"?e.text:""}function P2(e){return e.ui?.selection?.get?.()??e.ui?.selection?.current?.()??null}function nY(e){return!!(e.config?.superdoc?.config?.modules?.ai||e.superdoc?.config?.modules?.ai)}function rY(e){return e.config?.superdoc?.config?.modules?.ai??e.superdoc?.config?.modules?.ai??{}}var oY=({superToolbar:e,toolbarIcons:t,toolbarTexts:n,toolbarFonts:r,hideButtons:o,availableWidth:i,role:s,isDev:a=!1,configuredItemNames:l,configuredItemOrder:u,excludedItemNames:d,additionalItems:f=[]}={})=>{const p=Hn({type:"button",name:"bold",command:"toggleBold",icon:t.bold,tooltip:n.bold,attributes:{ariaLabel:"Bold"}}),g=(r??yK).map(EK),v=Hn({type:"dropdown",name:"fontFamily",tooltip:n.fontFamily,command:"setFontFamily",defaultLabel:"Arial",label:"Arial",markName:"textStyle",labelAttr:"fontFamily",hasCaret:!0,hasInlineTextInput:!0,inlineTextInputVisible:!0,isWide:!0,style:{width:"116px"},suppressActiveHighlight:!0,attributes:{ariaLabel:"Font family"},options:g,onActivate:({fontFamily:dt}={},_t=!1)=>{if(_t){v.label.value="",v.selectedValue.value="";return}if(!dt)return;dt=dt.split(",")[0];const zt=un=>un.value??un.label,sn=g.find(un=>zt(un)===v.defaultLabel.value),kn=g.find(un=>zt(un)===dt);kn?(v.label.value=kn.label,v.selectedValue.value=kn.key):sn?(v.label.value=dt,v.selectedValue.value=sn.key):(v.label.value=dt,v.selectedValue.value="")},onDeactivate:()=>{const dt=g.find(_t=>(_t.value??_t.label)===v.defaultLabel.value);v.label.value=dt?.label??v.defaultLabel.value,v.selectedValue.value=dt?.key??""}}),y=Hn({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 _(dt){const _t=P2(e),zt=_t?.selectionTarget??XT(_t?.target),sn=_t?.empty?"":tY(_t),kn=rY(e),un=()=>Zi(dt),qt=()=>{const Jn=e.pendingSelectionCapture;Jn&&typeof e.ui?.selection?.restore=="function"&&e.ui.selection.restore(Jn)};return no("div",{},[no(nq,{handleClose:un,selectedText:sn,target:zt,doc:e.superdoc?.activeEditor?.doc??null,apiKey:kn?.apiKey||e.config?.aiApiKey||"",endpoint:kn?.endpoint||e.config?.aiEndpoint||"",restoreSelection:qt})])}const w=wK,E=Hn({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:dt},_t=!1)=>{if(_t){E.label.value="",E.selectedValue.value="";return}const zt=w.find(qt=>qt.label===String(E.defaultLabel.value));if(!dt){E.label.value=E.defaultLabel.value,zt?E.selectedValue.value=zt.key:E.selectedValue.value="";return}let sn=hW(dt,12);sn<8&&(sn=8),sn>96&&(sn=96);let kn=String(sn);const un=w.find(qt=>qt.label===kn||qt.key===kn);un?E.selectedValue.value=un.key:E.selectedValue.value="",E.label.value=kn},onDeactivate:()=>{E.label.value=E.defaultLabel.value;const dt=w.find(_t=>_t.label===String(E.defaultLabel.value));dt?E.selectedValue.value=dt.key:E.selectedValue.value=""}}),k=()=>Hn({type:"separator",name:"separator",isNarrow:!0}),C=Hn({type:"button",name:"italic",command:"toggleItalic",icon:t.italic,active:!1,tooltip:n.italic,attributes:{ariaLabel:"Italic"}}),x=Hn({type:"button",name:"underline",command:"toggleUnderline",icon:t.underline,active:!1,tooltip:n.underline,attributes:{ariaLabel:"Underline"}}),D=Hn({type:"button",name:"strike",command:"toggleStrike",icon:t.strikethrough,active:!1,tooltip:n.strikethrough,attributes:{ariaLabel:"Strikethrough"}}),P=Hn({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,P,[],!0)}],onActivate:({color:dt})=>{P.iconColor.value=dt||""},onDeactivate:()=>P.iconColor.value=""}),W=Hn({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,W)}],onActivate:({color:dt})=>{W.iconColor.value=dt},onDeactivate:()=>W.iconColor.value="#000"}),N=Hn({type:"button",name:"search",allowWithoutEditor:!0,active:!1,icon:t.search,tooltip:n.search,group:"right",attributes:{ariaLabel:"Search"}}),L=Hn({type:"dropdown",name:"link",markName:"link",icon:t.link,active:!1,tooltip:n.link,attributes:{ariaLabel:"Link dropdown"},options:[{type:"render",key:"linkDropdown",render:()=>j(L)}],onActivate:({href:dt})=>{L.attributes.value=D2(L.attributes.value,dt)},onDeactivate:()=>{L.attributes.value=D2(L.attributes.value,null),L.expand.value=!1}});function j(dt){const _t=e.pendingSelectionCapture,zt=P2(e),sn=zt?.quotedText&&JSON.stringify(zt.selectionTarget??zt.target)!==JSON.stringify(_t?.selectionTarget??_t?.target)?zt:_t??zt,kn=sn?.selectionTarget??XT(sn?.target)??sn?.target,un=()=>{sn===_t&&typeof e.ui?.selection?.restore=="function"&&e.ui.selection.restore(_t)};return no("div",{},[no(y4,{ui:e.ui,linkItem:dt,textTarget:kn,selectedText:sn?.quotedText??null,restoreSelection:un,closePopover:()=>{Zi(dt),fc(e)},goToAnchor:()=>{Zi(dt);const qt=dt.attributes.value?.href;if(!qt)return;const Jn=qt.slice(1),Yo=(e.ui?.viewport?.getHost?.()??null)?.querySelector?.(`a[name='${Jn}']`);Yo&&b4(Yo)}})])}const M=Hn({type:"options",name:"linkInput",command:"toggleLink",active:!1});L.childItem=M,M.parentItem=L;const B=Hn({type:"button",name:"image",command:"startImageUpload",icon:t.image,active:!1,tooltip:n.image,disabled:!1,attributes:{ariaLabel:"Image"}}),R=Hn({type:"button",name:"tableOfContents",command:"insertTableOfContents",icon:t.tableOfContents,active:!1,tooltip:n.tableOfContents,disabled:!1,attributes:{ariaLabel:"Table of contents"}}),re=Hn({type:"button",name:"watermark",icon:t.watermark,tooltip:n.watermark,allowWithoutEditor:!0,disabled:!0,attributes:{ariaLabel:n.watermark}}),te=Hn({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:()=>X(te)}]});let Y=null;function X(dt){const _t=e.ui,zt=qt=>_t?.commands?.get?.(qt)?.getState?.()??null,sn=()=>{Zi(dt),Fe.expand.value&&Zi(Fe),fc(e)},kn=P2(e),un=kn?.selectionTarget?.story??kn?.selectionTarget?.start?.story??kn?.target?.story??null;return no(Xq,{pageNumbersState:zt("page-numbers-apply"),atCursorState:zt("page-number-insert"),inHeaderFooter:un?.storyType==="headerFooterPart"||un?.storyType==="headerFooterSlot",suggesting:_t?.document?.getSnapshot?.()?.mode==="suggesting",initialChoice:Y,loadCurrent:()=>_t?wN(_t):Promise.resolve(null),applyPageNumbers:qt=>Qc(_t,"page-numbers-apply",qt),removePageNumbers:()=>Qc(_t,"page-numbers-remove"),insertAtCursor:()=>Qc(_t,"page-number-insert"),close:qt=>{sn();const Jn=_t?.viewport?.getHost?.();if(qt?.action==="apply")Y=qt.choice,qT(Jn,qt.choice.position==="top"?"header":"footer");else if(qt?.action==="remove")for(const Yo of new Set(qt.kinds))qT(Jn,Yo)}})}const U=Hn({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(U)}]});function Oe(dt){return no("div",{},[no(yq,{onSelect:zt=>{e.emitCommand({item:dt,argument:zt}),Zi(dt),fc(e)}})])}const me=Hn({type:"dropdown",name:"tableActions",command:"executeTableCommand",tooltip:n.tableActions,icon:t.tableActions,hideLabel:!0,disabled:!0,attributes:{ariaLabel:"Table actions"},options:[{type:"render",render:()=>ve(me)}]}),ce=[{label:n.addRowBefore,command:"addRowBefore",icon:t.addRowBefore,props:{"data-item":"btn-tableActions-option",ariaLabel:"Add row before"}},{label:n.addRowAfter,command:"addRowAfter",icon:t.addRowAfter,props:{"data-item":"btn-tableActions-option",ariaLabel:"Add row after"}},{label:n.addColumnBefore,command:"addColumnBefore",icon:t.addColumnBefore,props:{"data-item":"btn-tableActions-option",ariaLabel:"Add column before"}},{label:n.addColumnAfter,command:"addColumnAfter",icon:t.addColumnAfter,bottomBorder:!0,props:{"data-item":"btn-tableActions-option",ariaLabel:"Add column after"}},{label:n.deleteRow,command:"deleteRow",icon:t.deleteRow,props:{"data-item":"btn-tableActions-option",ariaLabel:"Delete row"}},{label:n.deleteColumn,command:"deleteColumn",icon:t.deleteColumn,props:{"data-item":"btn-tableActions-option",ariaLabel:"Delete column"}},{label:n.deleteTable,command:"deleteTable",icon:t.deleteTable,props:{"data-item":"btn-tableActions-option",ariaLabel:"Delete table"}},{label:n.removeBorders,command:"deleteCellAndTableBorders",icon:t.deleteBorders,bottomBorder:!0,props:{"data-item":"btn-tableActions-option",ariaLabel:"Delete cell and table borders"}},{label:n.mergeCells,command:"mergeCells",icon:t.mergeCells,props:{"data-item":"btn-tableActions-option",ariaLabel:"Merge cells"}},{label:n.splitCell,command:"splitCell",icon:t.splitCell,props:{"data-item":"btn-tableActions-option",ariaLabel:"Split cells"}},{label:n.fixTables,command:"fixTables",icon:t.fixTables,props:{"data-item":"btn-tableActions-option",ariaLabel:"Fix tables"}}];function ve(dt){return no(Aq,{options:ce,onSelect:_t=>{Zi(dt);const{command:zt}=_t;e.emitCommand({item:dt,argument:{command:zt}}),fc(e)}})}const Re=Hn({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:()=>no("div",{},[no(RK,{onSelect:_t=>{Zi(Re);const zt={...Re,command:"setTextAlign"};zt.command="setTextAlign",e.emitCommand({item:zt,argument:_t}),$e(Re,_t),fc(e)}})]),key:"alignment"}],onActivate:({textAlign:dt})=>{$e(Re,dt)},onDeactivate:()=>{$e(Re,"left")}}),$e=(dt,_t)=>{let zt=_t==="both"?"justify":_t,sn={left:t.alignLeft,right:t.alignRight,center:t.alignCenter,justify:t.alignJustify},kn=sn[zt]??sn.left;dt.icon.value=kn},ot=Hn({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 dt=_t=>{Zi(ot);const zt={...ot,command:"toggleBulletListStyle"};e.emitCommand({item:zt,argument:_t})};return no(GT,{buttons:OK,iconSize:25,selectedStyle:ot.selectedValue.value,onSelect:dt})}}]}),kt=Hn({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 dt=_t=>{Zi(kt);const zt={...kt,command:"toggleOrderedListStyle"};e.emitCommand({item:zt,argument:_t})};return no(GT,{buttons:DK,iconSize:30,selectedStyle:kt.selectedValue.value,onSelect:dt})}}]}),gt=Hn({type:"button",name:"indentleft",command:"decreaseTextIndent",icon:t.indentLeft,active:!1,tooltip:n.indentLeft,disabled:!1,attributes:{ariaLabel:"Left indent"}}),Bt=Hn({type:"button",name:"indentright",command:"increaseTextIndent",icon:t.indentRight,active:!1,tooltip:n.indentRight,disabled:!1,attributes:{ariaLabel:"Right indent"}}),Fe=Hn({type:"overflow",name:"overflow",command:null,icon:t.overflow,active:!1,disabled:!1,attributes:{ariaLabel:"Overflow items"}}),Le=Hn({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:dt})=>{dt&&(Le.label.value=dt)}}),de=Hn({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:dt})=>{dt&&(de.label.value=dt)}}),H=Hn({type:"button",name:"undo",disabled:!0,tooltip:n.undo,command:"undo",icon:t.undo,group:"left",attributes:{ariaLabel:"Undo"}}),A=Hn({type:"button",disabled:!0,name:"redo",tooltip:n.redo,command:"redo",icon:t.redo,group:"left",attributes:{ariaLabel:"Redo"}}),ne=Hn({type:"button",disabled:!1,name:"acceptTrackedChangeBySelection",tooltip:n.trackChangesAccept,command:"acceptTrackedChangeFromToolbar",icon:t.trackChangesAccept,group:"left",attributes:{ariaLabel:"Accept tracked changes"}}),V=Hn({type:"button",disabled:!1,name:"rejectTrackedChangeOnSelection",tooltip:n.trackChangesReject,command:"rejectTrackedChangeFromToolbar",icon:t.trackChangesReject,group:"left",attributes:{ariaLabel:"Reject tracked changes"}}),Q=Hn({type:"button",name:"clearFormatting",command:"clearFormat",tooltip:n.clearFormatting,icon:t.clearFormatting,attributes:{ariaLabel:"Clear formatting"}}),K=Hn({type:"button",name:"copyFormat",tooltip:n.copyFormat,icon:t.copyFormat,command:"copyFormat",active:!1,attributes:{ariaLabel:"Copy formatting"}}),ee=(dt,_t)=>dt==="editor"?_t:dt==="suggester"?_t.filter(zt=>zt.value==="suggesting"):_t.filter(zt=>zt.value==="viewing"),le=dt=>dt==="editor"?"Editing":dt==="suggester"?"Suggesting":"Viewing",be=Hn({type:"dropdown",name:"documentMode",command:"setDocumentMode",allowWithoutEditor:!0,icon:t.documentMode,defaultLabel:le(s),label:le(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:()=>pe(be)}]}),G=[{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 pe(dt){return no(UK,{options:ee(s,G),onSelect:_t=>{const zt=e.superdoc?.activeEditor??e.activeEditor;Zi(dt);const{label:sn,icon:kn,value:un}=_t;be.label.value=sn,be.icon.value=kn,e.emitCommand({item:be,argument:un}),fc(e,zt)}})}const Ee=new Map([["separator",20],["zoom",71],["measurementUnit",52],["fontFamily",118],["fontSize",57],["textAlign",40],["linkedStyles",142],["documentMode",47],["default",32]]),Se=["search","ruler","undo","overflow","documentMode"],Ge=Hn({type:"button",name:"ruler",command:"toggleRuler",allowWithoutEditor:!0,icon:t.ruler,active:!1,tooltip:n.ruler,attributes:{ariaLabel:"Ruler"}}),ht=Hn({type:"button",name:"formattingMarks",command:"toggleFormattingMarks",allowWithoutEditor:!0,icon:t.formattingMarks,active:!1,tooltip:n.formattingMarks,attributes:{ariaLabel:"Formatting marks"}}),Me=Hn({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 dt=sn=>{Zi(Me);const kn=typeof sn=="string"?sn:sn?.id??null;if(!kn)return;const un={...Me,command:"setLinkedStyle"};e.emitCommand({item:un,argument:kn})},_t=sn=>{Zi(Me);const kn=typeof sn=="string"?sn:sn?.id??null;kn&&e.updateLinkedStyleToMatchSelection?.(kn)},zt=e.getActiveLinkedStyleId?.()??null;return no("div",{},[no(qK,{styles:e.getLinkedStyleOptions?.()??[],onSelect:dt,onUpdate:_t,updateLabel:n.updateLinkedStyle,selectedOption:zt})])}}],onActivate:({styleId:dt,styleName:_t})=>{const zt=_t||dt;Me.label.value=dt&&dt!=="Normal"?String(zt):n.formatText,Me.disabled.value=!1},onDeactivate:()=>{Me.disabled.value=!0,Me.label.value=n.formatText}}),qe=(dt,_t)=>{if(_t.value==dt)return no("div",{innerHTML:Qq,class:"dropdown-select-icon"})},Jt=Hn({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(dt=>({label:dt.toFixed(2),key:dt,icon:()=>qe(dt,Jt.selectedValue),props:{"data-item":"btn-lineHeight-option"}}))}),St=20,Ut=32,Lt=["linkedStyles","clearFormatting","copyFormat","formattingMarks"],mn=["zoom","fontFamily","fontSize","redo"],ut=i<=dp.lg,en=e.config?.showFormattingMarksButton===!0,Tn=e.config?.showTableOfContentsButton===!0;ut&&(be.attributes.value={...be.attributes.value,className:`${be.attributes.value.className} sd-toolbar-item--doc-mode-compact`}),ut&&(Me.attributes.value={...Me.attributes.value,className:`${Me.attributes.value.className} sd-toolbar-item--linked-styles-compact`});let Cn=[H,A,ne,V,N,Le,v,k(),E,k(),p,C,x,D,W,P,k(),L,B,...Tn?[R]:[],...e.config?.showWatermarkButton||l?.has("watermark")?[re]:[],...e.config?.showPageNumberButton||l?.has("pageNumber")?[te]:[],U,me,k(),Re,ot,kt,gt,Bt,Jt,k(),Me,k(),Ge,de,...en?[ht]:[],K,Q,...nY(e)?[y]:[],Fe,be,...f];if(i<=dp.md&&o&&(Cn=Cn.filter(dt=>dt.type!=="separator")),e.config.mode!=="docx"){const dt=Cn.findIndex(zt=>zt.name.value==="linkedStyles");Cn.splice(dt-1,2);const _t=["ruler","zoom","undo","redo"];Cn=Cn.filter(zt=>!_t.includes(zt.name.value))}const ar=[];a||(s==="viewer"&&ar.push(ne,V),Cn=Cn.filter(dt=>!ar.includes(dt))),l&&(Cn=Cn.filter(dt=>dt.name.value==="overflow"||dt.isCustomToolbarItem||l.has(dt.name.value))),d?.size&&(Cn=Cn.filter(dt=>!d.has(dt.name.value))),Cn=eY(Cn);const pr=dt=>Se.includes(dt.name.value),Vn=Cn.find(dt=>dt.name.value==="overflow"),Gn=Cn.filter(dt=>dt!==Vn);if(u){const dt=new Map(u.map((zt,sn)=>[zt,sn])),_t=zt=>dt.get(zt.name.value)??Number.MAX_SAFE_INTEGER;Gn.sort((zt,sn)=>_t(zt)-_t(sn))}const lr=dt=>{const _t=[],zt=[],sn=Gn.filter(pr).reduce((un,qt)=>un+O2(qt,Ee),0);let kn=Ut+sn+(dt&&Vn?O2(Vn,Ee):0);return Gn.forEach((un,qt)=>{const Jn=O2(un,Ee);if(un.type==="separator"&&Gn[qt-1]?.name.value==="linkedStyles"&&_t.includes(Gn[qt-1])){_t.push(un);return}if(i<dp.xl+St&&Lt.includes(un.name.value)&&o){_t.push(un);return}if(i<dp.sm&&mn.includes(un.name.value)&&o){_t.push(un);return}if(pr(un)){zt.push(un);return}kn+Jn<=i||!o?(zt.push(un),kn+=Jn):_t.push(un)}),{visibleItems:zt,overflowItems:_t}};let{visibleItems:Rr,overflowItems:ai}=lr(!1);if(o&&Vn&&ai.some(dt=>dt.type!=="separator")){({visibleItems:Rr,overflowItems:ai}=lr(!0));const dt=Cn.indexOf(Vn),_t=Rr.findIndex(zt=>Cn.indexOf(zt)>dt);_t===-1?Rr.push(Vn):Rr.splice(_t,0,Vn)}return Rr=YT(Rr),{defaultItems:Rr,overflowItems:ai.filter(dt=>dt.type!=="separator")}},ZT={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"},iY=e=>e?typeof e!="string"?e instanceof HTMLElement?e:null:e.startsWith("#")||e.startsWith(".")?document.querySelector(e):document.getElementById(e):null;Wt();var sY=CK,aY=HT;function F2(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 lY(e){return`${((typeof e=="object"||typeof e=="function")&&e!==null&&"message"in e?e.message:void 0)??String(e)}`}function cY(e){return typeof e=="object"&&e!==null&&"addEventListener"in e&&typeof e.addEventListener=="function"&&"removeEventListener"in e&&typeof e.removeEventListener=="function"}function uY(e){return e!==null&&"closest"in e&&typeof e.closest=="function"}function JT(e){return BT(e)??sY[e]??null}function ov(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?Qc(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 F2(i)?Promise.resolve(i).then(a=>{s(a),r.onSettled?.()},a=>{r.onError?.(a),r.onSettled?.()}):(s(i),r.onSettled?.()),!0}var dY=["page-numbers-apply","page-number-insert"],fY=new Set(["bold","italic","underline","strike","color","highlight","link","clearFormatting","textAlign","list","numberedlist","indentleft","indentright","lineHeight","linkedStyles"]),hY=new Set(["list","numberedlist"]);function pY(e,t){if(e==="fontFamily"||e==="fontSize"||hY.has(e)&&t?.disabled&&t?.supported!==!1&&t?.reason==null)return!0;if(!fY.has(e))return!1;const n=t?.reason;return n==="range-selection-required"||n==="selection-required"}function ex(e){return!!(uY(e)&&e.closest("[data-editor-ui-surface], .toolbar-dropdown-menu, .sd-toolbar-dropdown-menu, .sd-tooltip-content"))}function mY(e){return["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key)}var gY=new Set([...fW,...Object.keys(Xg),"ai","overflow","tableOfContents"]),vY=class extends Gv.default{#e;#t;#n;#r;constructor(e={}){if(super(),this.config={selector:null,toolbarGroups:["left","center","right"],role:"editor",icons:{...kr},texts:{...ZT},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=qr([]),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={...kr,...this.config.icons},this.config.texts={...ZT,...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=iY(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=Gc(IK),this.app.directive("click-outside",qb),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||bK(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(gY),l=s.map((w,E)=>{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@${E}>`}::${lY(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 f=null;if(r){const w=Object.values(r).flatMap(k=>k),E=l.filter(k=>u.has(k.group?.value||"center")).map(k=>k.name.value);f=[...new Set([...w,...E])]}const{defaultItems:p,overflowItems:g}=oY({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:f,excludedItemNames:i,additionalItems:d});f===null&&(f=[...p.map(w=>w.name.value),...g.map(w=>w.name.value)]);const v=g.filter(w=>f.includes(w.name.value)&&!i.has(w.name.value)),y=v.length?[...f,"overflow"]:f,_=p.filter(w=>y.includes(w.name.value)).filter(w=>!i.has(w.name.value));if(r){const w=new Map(f.map((D,P)=>[D,P])),E=D=>w.get(D.name.value)??Number.MAX_SAFE_INTEGER,k=_.find(D=>D.name.value==="overflow"),C=new Map(_.map((D,P)=>[D,P])),x=_.filter(D=>D!==k);if(x.sort((D,P)=>E(D)-E(P)),k){const D=C.get(k)??-1,P=x.findIndex(W=>(C.get(W)??-1)>D);P===-1?x.push(k):x.splice(P,0,k)}_.splice(0,_.length,...x),v.sort((D,P)=>E(D)-E(P))}if(r)for(const[w,E]of Object.entries(r))for(const k of _)E.includes(k.name.value)&&(k.group.value=w);this.toolbarItems=_,this.overflowItems=v}#i(e){const t=Hn({...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 F2(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=kK.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=dY.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(x2(t)?.disposition==="host-routed")return e.setDisabled(!this.#y(t)),this.#v(t)?e.activate():e.deactivate(),!0;const n=JT(t);if(!n)return!1;const r=this.snapshot?.commands?.[n];pY(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=D2(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.#D(),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")}#D(){this.#C().forEach(e=>{const{allowWithoutEditor:t}=e;t?.value||e.setDisabled(!0)})}#P(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"?aY[i]:void 0;return s?ov(this.ui,s,void 0,r):!1}if(x2(n)?.disposition==="unsupported")return!0;const o=JT(n);return o?ov(this.ui,o,t,r):!1}#k(){return this.snapshot?.commands?.image?.disabled||(this.#e||(this.#e=qP({ownerDocument:this.toolbarContainer?.ownerDocument??document,onPick:async e=>{const t=await WP(e,this.superdoc?.config?.handleImageUpload);ov(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=cY(e)?e:document,n=s=>{ex(s.target)||this.ui?.formatPainter.setPointerSelecting(!0)},r=s=>{this.ui?.formatPainter.setPointerSelecting(!1),!ex(s.target)&&this.ui?.formatPainter.notifyPointerUp()},o=s=>{if(s.key==="Escape"){this.ui?.formatPainter.cancel();return}mY(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(x2(r)?.disposition==="host-routed"){this.#P(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});F2(a)&&Promise.resolve(a).catch(l=>this.#p(l,r))}this.updateToolbarState();return}if(e?.isCustomToolbarItem&&typeof o=="string"){if(!ov(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 yY(e){return new vY(e)}Wt();var bY=['[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(", "),wY=800,tx=typeof Blob=="function"?Object.getOwnPropertyDescriptor(Blob.prototype,"size")?.get:void 0,nx=e=>{if(!tx)return!1;try{return tx.call(e),!0}catch{return!1}};function CY(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 kY=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"]),SY=["original","markup","final"],_Y=["review","original","final","off"];function rx(e){return SY.includes(e)}function AY(e){return e==="markup"?"review":e}function ox(e){return _Y.includes(e)}function IY(e){const t=e.modules?.trackChanges?.mode;if(ox(t))return t;const n=e.layoutEngineOptions?.trackedChanges?.mode;return ox(n)?n:null}function iv(e,t){const n=e.viewing,r=rx(n?.trackedChanges)?n.trackedChanges:null,o=r?AY(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 EY(e,t){const n=new N8.default;return e.forEach((r,o)=>{n.file(t[o],r)}),n.generateAsync({type:"blob",compression:"DEFLATE"})}function TY(e,t){const n=e.composedPath();if(!n.includes(t))return null;const r=n.find(a=>a instanceof HTMLElement&&a.matches(bY));if(!r)return null;const o=n.some(a=>a instanceof HTMLElement&&a.classList.contains(Lm.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 xY(e){if(!e||typeof e!="object")return[];const t=e.items;return Array.isArray(t)?t:[]}function ix(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 sx(e){const t=e.selectionTarget??e.target;if(!t)return null;try{return JSON.stringify(t)}catch{return null}}function RY(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 Ci(e){return!!(e&&typeof e=="object"&&e.editorVersion===2)}function ax(e){return typeof e=="string"&&e.length>0?e:null}function lx(e){return e?Ci(e)?ax(e.documentId??e.options?.documentId??null):ax(typeof e.getDocumentId=="function"?e.getDocumentId():e.options?.documentId):null}function MY(e){if(!e||Ci(e))return null;const t=e;return t.documentRenderer??t.presentationEditor??null}function Ls(e){if(!e)return null;if(Ci(e))return e.fonts??null;const t=MY(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 fp=class extends Gv.default{static{this.allowedTypes=[jr,Qa]}#e;#t;#n;#r;#o;#c;#d;#f;#u;#m;#h;#i;#s;#g;#C;#_;#v;#y;#I;#R;#T;#O;#E;#D;#P;#b;#k;get uiConfig(){return this.#k}#x;get interactionConfig(){return this.#x}#A;get surfacesConfig(){return this.#A}#p;#F;#w;#l;#L;#N;#M;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()+wY))},this.#D=n=>{this.listenerCount("content-control:active-change")>0&&!CY(n)&&(this.#v="keyboard",this.#y=null)},this.#P=n=>{this.#q(n)},this.#b=null,this.#k=OT({}),this.#x=DT({}),this.#A=PT({}),this.version="0.0.0",this.users=[],this.whiteboard=null,this.colors=[],this.readyEditors=0,this.#F=!1,this.#w=[],this.#l=new uW,this.#L=null,this.#N=!1,this.#M=null,this.config={selector:"#superdoc",documentMode:"editing",allowSelectionInViewMode:!1,role:"editor",documents:[],editorExtensions:[],colors:[],users:[],user:{...I2},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.#j=null,!e.selector)throw new Error("SuperDoc: selector is required");const t=typeof e.selector=="string"?document.querySelector(e.selector):e.selector;if(!(t instanceof HTMLElement))throw new Error("SuperDoc: selector must be a valid CSS selector string or DOM element");this.#t=A5(this,e,()=>this.version,t),this.#p=new MG({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.#D,!0),t.addEventListener("click",this.#P,!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#q(e){const t=this.#s;if(!t)return;const n=TY(e,t),r=this.activeEditor?.doc?.contentControls?.list;if(!(!n||typeof r!="function"))try{const o=await r();if(this.#e)return;const i=ix(xY(o).find(s=>s.id===n));i&&this.emit("content-control:click",{target:i,source:"pointer"})}catch{return}}async#Y(e,t){this.#M=IY(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),A2(this.config),this.config.documents=this.config.documents||[],this.config.layoutEngineOptions=this.config.layoutEngineOptions||{};const n=this.config.viewOptions?.layout==="web",r=this.config.layoutEngineOptions?.flowMode==="semantic";if(!n&&r&&(console.warn("[SuperDoc] flowMode 'semantic' is only valid with web layout. Coercing to 'paginated'."),this.config.layoutEngineOptions.flowMode="paginated"),this.editorVersion=2,this.#Ue(),this.config.user=UG(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=wI(this.config.modules.comments),this.#k=OT(this.config),this.#x=DT(this.config),this.#A=PT(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.8",this.#ne("π¦ [superdoc] Using SuperDoc version:",this.version),this.superdocId=e.superdocId||Fa(),this.colors=this.config.colors??[],this.#Te(),this.#be(),await eO(),this.#e)return;if(await this.#ke(this.config.modules),this.#e){this.#ye();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.#L||(this.#L=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.#Ce(),this.#Z(),this.#Ge(),this.#X()}#X(){if(this.#F=!1,this.#w=[],this.#we(),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 r$({Renderer:TG,enabled:t}),this.emit("whiteboard:init",{whiteboard:this.whiteboard})}get requiredNumberOfEditors(){return this.#S("requiredNumberOfEditors").documents.filter(e=>e.type===jr).length}get ui(){return this.#b||(this.#b=cB({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")&&Rf(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=sx(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=>ix(s.items.find(_=>_.id===y)));if(l.some(y=>y===null))return;const u=l,d=a===e,f=u.length===t.length&&u.every((y,_)=>y.id===t[_]?.id);if(d&&f)return;if(u.length===0&&t.length===0){e=a;return}const p=d?t[0]??null:null;e=a,t=u;const g=sx(this.#b.selection.getSnapshot()),v=this.#T;this.emit("content-control:active-change",{active:u[0]??null,previous:p,activePath:u,source:g&&v?.editor===a&&v.key===g?v.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=>Wl(e.data)?{...e,data:n0(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}#be(){const e=this.config.document,t=!!e&&typeof e=="object"&&(Wl(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=o0(e);this.config.documents=[{id:Fa(),...o}]}else n&&(this.config.documents=[{id:Fa(),type:jr,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=o0(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||Fa()}}))}#we(){const{app:e,pinia:t,superdocStore:n,commentsStore:r,highContrastModeStore:o}=HU({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&&BL(this),this.#ie()}#a(e,t){t&&this.on(e,t)}#Ce(){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.#Se(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#ke({collaboration:e}={}){return e?(this.isCollaborative=!1,this.config.documents.length===0&&(this.config.documents=[{id:Fa(),type:jr,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}}#Se(e){this.#se(),Ci(e)&&(this.#Ae(e),this.#Ie(e),this.#_e(e))}#_e(e){const t=e.connection;if(!t||typeof t.subscribe!="function")return;const{documentId:n}=t;this.#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:RY(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}#Ae(e){const t=e.presence;if(!t||typeof t.subscribe!="function")return;const n=JU(()=>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)}}#Ie(e){const t=e.lock;if(!t||typeof t.subscribe!="function")return;const n=r=>{this.#e||this.#U(!!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}}#Ee(e,t){return JSON.stringify(e??null)===JSON.stringify(t??null)}#U(e,t){this.isLocked===e&&this.#Ee(this.lockedBy,t)||(this.isLocked=e,this.lockedBy=t,this.#ne("π¦ [superdoc] Locking superdoc:",e,t,`
|
|
107
|
+
`;Wt();var Zi=e=>{e.expand.value=!1},O2=(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")},Jq=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},YT=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 Jq(r))n.add(o);return e.filter(r=>n.has(r))},eY=e=>{const t=e.find(o=>o.type==="overflow"),n=e.filter(o=>o!==t),r=new Set(YT(n));return e.filter(o=>o===t||r.has(o))};function D2(e,t){const n={...e};return t?n.href=t:delete n.href,n}function XT(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 tY(e){return typeof e?.quotedText=="string"?e.quotedText:typeof e?.text=="string"?e.text:""}function P2(e){return e.ui?.selection?.get?.()??e.ui?.selection?.current?.()??null}function nY(e){return!!(e.config?.superdoc?.config?.modules?.ai||e.superdoc?.config?.modules?.ai)}function rY(e){return e.config?.superdoc?.config?.modules?.ai??e.superdoc?.config?.modules?.ai??{}}var oY=({superToolbar:e,toolbarIcons:t,toolbarTexts:n,toolbarFonts:r,hideButtons:o,availableWidth:i,role:s,isDev:a=!1,configuredItemNames:l,configuredItemOrder:u,excludedItemNames:d,additionalItems:f=[]}={})=>{const p=Hn({type:"button",name:"bold",command:"toggleBold",icon:t.bold,tooltip:n.bold,attributes:{ariaLabel:"Bold"}}),g=(r??yK).map(EK),v=Hn({type:"dropdown",name:"fontFamily",tooltip:n.fontFamily,command:"setFontFamily",defaultLabel:"Arial",label:"Arial",markName:"textStyle",labelAttr:"fontFamily",hasCaret:!0,hasInlineTextInput:!0,inlineTextInputVisible:!0,isWide:!0,style:{width:"116px"},suppressActiveHighlight:!0,attributes:{ariaLabel:"Font family"},options:g,onActivate:({fontFamily:dt}={},_t=!1)=>{if(_t){v.label.value="",v.selectedValue.value="";return}if(!dt)return;dt=dt.split(",")[0];const zt=un=>un.value??un.label,sn=g.find(un=>zt(un)===v.defaultLabel.value),kn=g.find(un=>zt(un)===dt);kn?(v.label.value=kn.label,v.selectedValue.value=kn.key):sn?(v.label.value=dt,v.selectedValue.value=sn.key):(v.label.value=dt,v.selectedValue.value="")},onDeactivate:()=>{const dt=g.find(_t=>(_t.value??_t.label)===v.defaultLabel.value);v.label.value=dt?.label??v.defaultLabel.value,v.selectedValue.value=dt?.key??""}}),y=Hn({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 _(dt){const _t=P2(e),zt=_t?.selectionTarget??XT(_t?.target),sn=_t?.empty?"":tY(_t),kn=rY(e),un=()=>Zi(dt),qt=()=>{const Jn=e.pendingSelectionCapture;Jn&&typeof e.ui?.selection?.restore=="function"&&e.ui.selection.restore(Jn)};return no("div",{},[no(nq,{handleClose:un,selectedText:sn,target:zt,doc:e.superdoc?.activeEditor?.doc??null,apiKey:kn?.apiKey||e.config?.aiApiKey||"",endpoint:kn?.endpoint||e.config?.aiEndpoint||"",restoreSelection:qt})])}const w=wK,E=Hn({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:dt},_t=!1)=>{if(_t){E.label.value="",E.selectedValue.value="";return}const zt=w.find(qt=>qt.label===String(E.defaultLabel.value));if(!dt){E.label.value=E.defaultLabel.value,zt?E.selectedValue.value=zt.key:E.selectedValue.value="";return}let sn=hW(dt,12);sn<8&&(sn=8),sn>96&&(sn=96);let kn=String(sn);const un=w.find(qt=>qt.label===kn||qt.key===kn);un?E.selectedValue.value=un.key:E.selectedValue.value="",E.label.value=kn},onDeactivate:()=>{E.label.value=E.defaultLabel.value;const dt=w.find(_t=>_t.label===String(E.defaultLabel.value));dt?E.selectedValue.value=dt.key:E.selectedValue.value=""}}),k=()=>Hn({type:"separator",name:"separator",isNarrow:!0}),C=Hn({type:"button",name:"italic",command:"toggleItalic",icon:t.italic,active:!1,tooltip:n.italic,attributes:{ariaLabel:"Italic"}}),x=Hn({type:"button",name:"underline",command:"toggleUnderline",icon:t.underline,active:!1,tooltip:n.underline,attributes:{ariaLabel:"Underline"}}),D=Hn({type:"button",name:"strike",command:"toggleStrike",icon:t.strikethrough,active:!1,tooltip:n.strikethrough,attributes:{ariaLabel:"Strikethrough"}}),P=Hn({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,P,[],!0)}],onActivate:({color:dt})=>{P.iconColor.value=dt||""},onDeactivate:()=>P.iconColor.value=""}),W=Hn({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,W)}],onActivate:({color:dt})=>{W.iconColor.value=dt},onDeactivate:()=>W.iconColor.value="#000"}),N=Hn({type:"button",name:"search",allowWithoutEditor:!0,active:!1,icon:t.search,tooltip:n.search,group:"right",attributes:{ariaLabel:"Search"}}),L=Hn({type:"dropdown",name:"link",markName:"link",icon:t.link,active:!1,tooltip:n.link,attributes:{ariaLabel:"Link dropdown"},options:[{type:"render",key:"linkDropdown",render:()=>j(L)}],onActivate:({href:dt})=>{L.attributes.value=D2(L.attributes.value,dt)},onDeactivate:()=>{L.attributes.value=D2(L.attributes.value,null),L.expand.value=!1}});function j(dt){const _t=e.pendingSelectionCapture,zt=P2(e),sn=zt?.quotedText&&JSON.stringify(zt.selectionTarget??zt.target)!==JSON.stringify(_t?.selectionTarget??_t?.target)?zt:_t??zt,kn=sn?.selectionTarget??XT(sn?.target)??sn?.target,un=()=>{sn===_t&&typeof e.ui?.selection?.restore=="function"&&e.ui.selection.restore(_t)};return no("div",{},[no(y4,{ui:e.ui,linkItem:dt,textTarget:kn,selectedText:sn?.quotedText??null,restoreSelection:un,closePopover:()=>{Zi(dt),fc(e)},goToAnchor:()=>{Zi(dt);const qt=dt.attributes.value?.href;if(!qt)return;const Jn=qt.slice(1),Yo=(e.ui?.viewport?.getHost?.()??null)?.querySelector?.(`a[name='${Jn}']`);Yo&&b4(Yo)}})])}const M=Hn({type:"options",name:"linkInput",command:"toggleLink",active:!1});L.childItem=M,M.parentItem=L;const B=Hn({type:"button",name:"image",command:"startImageUpload",icon:t.image,active:!1,tooltip:n.image,disabled:!1,attributes:{ariaLabel:"Image"}}),R=Hn({type:"button",name:"tableOfContents",command:"insertTableOfContents",icon:t.tableOfContents,active:!1,tooltip:n.tableOfContents,disabled:!1,attributes:{ariaLabel:"Table of contents"}}),re=Hn({type:"button",name:"watermark",icon:t.watermark,tooltip:n.watermark,allowWithoutEditor:!0,disabled:!0,attributes:{ariaLabel:n.watermark}}),te=Hn({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:()=>X(te)}]});let Y=null;function X(dt){const _t=e.ui,zt=qt=>_t?.commands?.get?.(qt)?.getState?.()??null,sn=()=>{Zi(dt),Fe.expand.value&&Zi(Fe),fc(e)},kn=P2(e),un=kn?.selectionTarget?.story??kn?.selectionTarget?.start?.story??kn?.target?.story??null;return no(Xq,{pageNumbersState:zt("page-numbers-apply"),atCursorState:zt("page-number-insert"),inHeaderFooter:un?.storyType==="headerFooterPart"||un?.storyType==="headerFooterSlot",suggesting:_t?.document?.getSnapshot?.()?.mode==="suggesting",initialChoice:Y,loadCurrent:()=>_t?wN(_t):Promise.resolve(null),applyPageNumbers:qt=>Qc(_t,"page-numbers-apply",qt),removePageNumbers:()=>Qc(_t,"page-numbers-remove"),insertAtCursor:()=>Qc(_t,"page-number-insert"),close:qt=>{sn();const Jn=_t?.viewport?.getHost?.();if(qt?.action==="apply")Y=qt.choice,qT(Jn,qt.choice.position==="top"?"header":"footer");else if(qt?.action==="remove")for(const Yo of new Set(qt.kinds))qT(Jn,Yo)}})}const U=Hn({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(U)}]});function Oe(dt){return no("div",{},[no(yq,{onSelect:zt=>{e.emitCommand({item:dt,argument:zt}),Zi(dt),fc(e)}})])}const me=Hn({type:"dropdown",name:"tableActions",command:"executeTableCommand",tooltip:n.tableActions,icon:t.tableActions,hideLabel:!0,disabled:!0,attributes:{ariaLabel:"Table actions"},options:[{type:"render",render:()=>ve(me)}]}),ce=[{label:n.addRowBefore,command:"addRowBefore",icon:t.addRowBefore,props:{"data-item":"btn-tableActions-option",ariaLabel:"Add row before"}},{label:n.addRowAfter,command:"addRowAfter",icon:t.addRowAfter,props:{"data-item":"btn-tableActions-option",ariaLabel:"Add row after"}},{label:n.addColumnBefore,command:"addColumnBefore",icon:t.addColumnBefore,props:{"data-item":"btn-tableActions-option",ariaLabel:"Add column before"}},{label:n.addColumnAfter,command:"addColumnAfter",icon:t.addColumnAfter,bottomBorder:!0,props:{"data-item":"btn-tableActions-option",ariaLabel:"Add column after"}},{label:n.deleteRow,command:"deleteRow",icon:t.deleteRow,props:{"data-item":"btn-tableActions-option",ariaLabel:"Delete row"}},{label:n.deleteColumn,command:"deleteColumn",icon:t.deleteColumn,props:{"data-item":"btn-tableActions-option",ariaLabel:"Delete column"}},{label:n.deleteTable,command:"deleteTable",icon:t.deleteTable,props:{"data-item":"btn-tableActions-option",ariaLabel:"Delete table"}},{label:n.removeBorders,command:"deleteCellAndTableBorders",icon:t.deleteBorders,bottomBorder:!0,props:{"data-item":"btn-tableActions-option",ariaLabel:"Delete cell and table borders"}},{label:n.mergeCells,command:"mergeCells",icon:t.mergeCells,props:{"data-item":"btn-tableActions-option",ariaLabel:"Merge cells"}},{label:n.splitCell,command:"splitCell",icon:t.splitCell,props:{"data-item":"btn-tableActions-option",ariaLabel:"Split cells"}},{label:n.fixTables,command:"fixTables",icon:t.fixTables,props:{"data-item":"btn-tableActions-option",ariaLabel:"Fix tables"}}];function ve(dt){return no(Aq,{options:ce,onSelect:_t=>{Zi(dt);const{command:zt}=_t;e.emitCommand({item:dt,argument:{command:zt}}),fc(e)}})}const Re=Hn({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:()=>no("div",{},[no(RK,{onSelect:_t=>{Zi(Re);const zt={...Re,command:"setTextAlign"};zt.command="setTextAlign",e.emitCommand({item:zt,argument:_t}),$e(Re,_t),fc(e)}})]),key:"alignment"}],onActivate:({textAlign:dt})=>{$e(Re,dt)},onDeactivate:()=>{$e(Re,"left")}}),$e=(dt,_t)=>{let zt=_t==="both"?"justify":_t,sn={left:t.alignLeft,right:t.alignRight,center:t.alignCenter,justify:t.alignJustify},kn=sn[zt]??sn.left;dt.icon.value=kn},ot=Hn({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 dt=_t=>{Zi(ot);const zt={...ot,command:"toggleBulletListStyle"};e.emitCommand({item:zt,argument:_t})};return no(GT,{buttons:OK,iconSize:25,selectedStyle:ot.selectedValue.value,onSelect:dt})}}]}),kt=Hn({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 dt=_t=>{Zi(kt);const zt={...kt,command:"toggleOrderedListStyle"};e.emitCommand({item:zt,argument:_t})};return no(GT,{buttons:DK,iconSize:30,selectedStyle:kt.selectedValue.value,onSelect:dt})}}]}),gt=Hn({type:"button",name:"indentleft",command:"decreaseTextIndent",icon:t.indentLeft,active:!1,tooltip:n.indentLeft,disabled:!1,attributes:{ariaLabel:"Left indent"}}),Bt=Hn({type:"button",name:"indentright",command:"increaseTextIndent",icon:t.indentRight,active:!1,tooltip:n.indentRight,disabled:!1,attributes:{ariaLabel:"Right indent"}}),Fe=Hn({type:"overflow",name:"overflow",command:null,icon:t.overflow,active:!1,disabled:!1,attributes:{ariaLabel:"Overflow items"}}),Le=Hn({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:dt})=>{dt&&(Le.label.value=dt)}}),de=Hn({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:dt})=>{dt&&(de.label.value=dt)}}),H=Hn({type:"button",name:"undo",disabled:!0,tooltip:n.undo,command:"undo",icon:t.undo,group:"left",attributes:{ariaLabel:"Undo"}}),A=Hn({type:"button",disabled:!0,name:"redo",tooltip:n.redo,command:"redo",icon:t.redo,group:"left",attributes:{ariaLabel:"Redo"}}),ne=Hn({type:"button",disabled:!1,name:"acceptTrackedChangeBySelection",tooltip:n.trackChangesAccept,command:"acceptTrackedChangeFromToolbar",icon:t.trackChangesAccept,group:"left",attributes:{ariaLabel:"Accept tracked changes"}}),V=Hn({type:"button",disabled:!1,name:"rejectTrackedChangeOnSelection",tooltip:n.trackChangesReject,command:"rejectTrackedChangeFromToolbar",icon:t.trackChangesReject,group:"left",attributes:{ariaLabel:"Reject tracked changes"}}),Q=Hn({type:"button",name:"clearFormatting",command:"clearFormat",tooltip:n.clearFormatting,icon:t.clearFormatting,attributes:{ariaLabel:"Clear formatting"}}),K=Hn({type:"button",name:"copyFormat",tooltip:n.copyFormat,icon:t.copyFormat,command:"copyFormat",active:!1,attributes:{ariaLabel:"Copy formatting"}}),ee=(dt,_t)=>dt==="editor"?_t:dt==="suggester"?_t.filter(zt=>zt.value==="suggesting"):_t.filter(zt=>zt.value==="viewing"),le=dt=>dt==="editor"?"Editing":dt==="suggester"?"Suggesting":"Viewing",be=Hn({type:"dropdown",name:"documentMode",command:"setDocumentMode",allowWithoutEditor:!0,icon:t.documentMode,defaultLabel:le(s),label:le(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:()=>pe(be)}]}),G=[{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 pe(dt){return no(UK,{options:ee(s,G),onSelect:_t=>{const zt=e.superdoc?.activeEditor??e.activeEditor;Zi(dt);const{label:sn,icon:kn,value:un}=_t;be.label.value=sn,be.icon.value=kn,e.emitCommand({item:be,argument:un}),fc(e,zt)}})}const Ee=new Map([["separator",20],["zoom",71],["measurementUnit",52],["fontFamily",118],["fontSize",57],["textAlign",40],["linkedStyles",142],["documentMode",47],["default",32]]),Se=["search","ruler","undo","overflow","documentMode"],Ge=Hn({type:"button",name:"ruler",command:"toggleRuler",allowWithoutEditor:!0,icon:t.ruler,active:!1,tooltip:n.ruler,attributes:{ariaLabel:"Ruler"}}),ht=Hn({type:"button",name:"formattingMarks",command:"toggleFormattingMarks",allowWithoutEditor:!0,icon:t.formattingMarks,active:!1,tooltip:n.formattingMarks,attributes:{ariaLabel:"Formatting marks"}}),Me=Hn({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 dt=sn=>{Zi(Me);const kn=typeof sn=="string"?sn:sn?.id??null;if(!kn)return;const un={...Me,command:"setLinkedStyle"};e.emitCommand({item:un,argument:kn})},_t=sn=>{Zi(Me);const kn=typeof sn=="string"?sn:sn?.id??null;kn&&e.updateLinkedStyleToMatchSelection?.(kn)},zt=e.getActiveLinkedStyleId?.()??null;return no("div",{},[no(qK,{styles:e.getLinkedStyleOptions?.()??[],onSelect:dt,onUpdate:_t,updateLabel:n.updateLinkedStyle,selectedOption:zt})])}}],onActivate:({styleId:dt,styleName:_t})=>{const zt=_t||dt;Me.label.value=dt&&dt!=="Normal"?String(zt):n.formatText,Me.disabled.value=!1},onDeactivate:()=>{Me.disabled.value=!0,Me.label.value=n.formatText}}),qe=(dt,_t)=>{if(_t.value==dt)return no("div",{innerHTML:Qq,class:"dropdown-select-icon"})},Jt=Hn({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(dt=>({label:dt.toFixed(2),key:dt,icon:()=>qe(dt,Jt.selectedValue),props:{"data-item":"btn-lineHeight-option"}}))}),St=20,Ut=32,Lt=["linkedStyles","clearFormatting","copyFormat","formattingMarks"],mn=["zoom","fontFamily","fontSize","redo"],ut=i<=dp.lg,en=e.config?.showFormattingMarksButton===!0,Tn=e.config?.showTableOfContentsButton===!0;ut&&(be.attributes.value={...be.attributes.value,className:`${be.attributes.value.className} sd-toolbar-item--doc-mode-compact`}),ut&&(Me.attributes.value={...Me.attributes.value,className:`${Me.attributes.value.className} sd-toolbar-item--linked-styles-compact`});let Cn=[H,A,ne,V,N,Le,v,k(),E,k(),p,C,x,D,W,P,k(),L,B,...Tn?[R]:[],...e.config?.showWatermarkButton||l?.has("watermark")?[re]:[],...e.config?.showPageNumberButton||l?.has("pageNumber")?[te]:[],U,me,k(),Re,ot,kt,gt,Bt,Jt,k(),Me,k(),Ge,de,...en?[ht]:[],K,Q,...nY(e)?[y]:[],Fe,be,...f];if(i<=dp.md&&o&&(Cn=Cn.filter(dt=>dt.type!=="separator")),e.config.mode!=="docx"){const dt=Cn.findIndex(zt=>zt.name.value==="linkedStyles");Cn.splice(dt-1,2);const _t=["ruler","zoom","undo","redo"];Cn=Cn.filter(zt=>!_t.includes(zt.name.value))}const ar=[];a||(s==="viewer"&&ar.push(ne,V),Cn=Cn.filter(dt=>!ar.includes(dt))),l&&(Cn=Cn.filter(dt=>dt.name.value==="overflow"||dt.isCustomToolbarItem||l.has(dt.name.value))),d?.size&&(Cn=Cn.filter(dt=>!d.has(dt.name.value))),Cn=eY(Cn);const pr=dt=>Se.includes(dt.name.value),Vn=Cn.find(dt=>dt.name.value==="overflow"),Gn=Cn.filter(dt=>dt!==Vn);if(u){const dt=new Map(u.map((zt,sn)=>[zt,sn])),_t=zt=>dt.get(zt.name.value)??Number.MAX_SAFE_INTEGER;Gn.sort((zt,sn)=>_t(zt)-_t(sn))}const lr=dt=>{const _t=[],zt=[],sn=Gn.filter(pr).reduce((un,qt)=>un+O2(qt,Ee),0);let kn=Ut+sn+(dt&&Vn?O2(Vn,Ee):0);return Gn.forEach((un,qt)=>{const Jn=O2(un,Ee);if(un.type==="separator"&&Gn[qt-1]?.name.value==="linkedStyles"&&_t.includes(Gn[qt-1])){_t.push(un);return}if(i<dp.xl+St&&Lt.includes(un.name.value)&&o){_t.push(un);return}if(i<dp.sm&&mn.includes(un.name.value)&&o){_t.push(un);return}if(pr(un)){zt.push(un);return}kn+Jn<=i||!o?(zt.push(un),kn+=Jn):_t.push(un)}),{visibleItems:zt,overflowItems:_t}};let{visibleItems:Rr,overflowItems:ai}=lr(!1);if(o&&Vn&&ai.some(dt=>dt.type!=="separator")){({visibleItems:Rr,overflowItems:ai}=lr(!0));const dt=Cn.indexOf(Vn),_t=Rr.findIndex(zt=>Cn.indexOf(zt)>dt);_t===-1?Rr.push(Vn):Rr.splice(_t,0,Vn)}return Rr=YT(Rr),{defaultItems:Rr,overflowItems:ai.filter(dt=>dt.type!=="separator")}},ZT={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"},iY=e=>e?typeof e!="string"?e instanceof HTMLElement?e:null:e.startsWith("#")||e.startsWith(".")?document.querySelector(e):document.getElementById(e):null;Wt();var sY=CK,aY=HT;function F2(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 lY(e){return`${((typeof e=="object"||typeof e=="function")&&e!==null&&"message"in e?e.message:void 0)??String(e)}`}function cY(e){return typeof e=="object"&&e!==null&&"addEventListener"in e&&typeof e.addEventListener=="function"&&"removeEventListener"in e&&typeof e.removeEventListener=="function"}function uY(e){return e!==null&&"closest"in e&&typeof e.closest=="function"}function JT(e){return BT(e)??sY[e]??null}function ov(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?Qc(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 F2(i)?Promise.resolve(i).then(a=>{s(a),r.onSettled?.()},a=>{r.onError?.(a),r.onSettled?.()}):(s(i),r.onSettled?.()),!0}var dY=["page-numbers-apply","page-number-insert"],fY=new Set(["bold","italic","underline","strike","color","highlight","link","clearFormatting","textAlign","list","numberedlist","indentleft","indentright","lineHeight","linkedStyles"]),hY=new Set(["list","numberedlist"]);function pY(e,t){if(e==="fontFamily"||e==="fontSize"||hY.has(e)&&t?.disabled&&t?.supported!==!1&&t?.reason==null)return!0;if(!fY.has(e))return!1;const n=t?.reason;return n==="range-selection-required"||n==="selection-required"}function ex(e){return!!(uY(e)&&e.closest("[data-editor-ui-surface], .toolbar-dropdown-menu, .sd-toolbar-dropdown-menu, .sd-tooltip-content"))}function mY(e){return["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key)}var gY=new Set([...fW,...Object.keys(Xg),"ai","overflow","tableOfContents"]),vY=class extends Gv.default{#e;#t;#n;#r;constructor(e={}){if(super(),this.config={selector:null,toolbarGroups:["left","center","right"],role:"editor",icons:{...kr},texts:{...ZT},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=qr([]),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={...kr,...this.config.icons},this.config.texts={...ZT,...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=iY(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=Gc(IK),this.app.directive("click-outside",qb),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||bK(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(gY),l=s.map((w,E)=>{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@${E}>`}::${lY(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 f=null;if(r){const w=Object.values(r).flatMap(k=>k),E=l.filter(k=>u.has(k.group?.value||"center")).map(k=>k.name.value);f=[...new Set([...w,...E])]}const{defaultItems:p,overflowItems:g}=oY({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:f,excludedItemNames:i,additionalItems:d});f===null&&(f=[...p.map(w=>w.name.value),...g.map(w=>w.name.value)]);const v=g.filter(w=>f.includes(w.name.value)&&!i.has(w.name.value)),y=v.length?[...f,"overflow"]:f,_=p.filter(w=>y.includes(w.name.value)).filter(w=>!i.has(w.name.value));if(r){const w=new Map(f.map((D,P)=>[D,P])),E=D=>w.get(D.name.value)??Number.MAX_SAFE_INTEGER,k=_.find(D=>D.name.value==="overflow"),C=new Map(_.map((D,P)=>[D,P])),x=_.filter(D=>D!==k);if(x.sort((D,P)=>E(D)-E(P)),k){const D=C.get(k)??-1,P=x.findIndex(W=>(C.get(W)??-1)>D);P===-1?x.push(k):x.splice(P,0,k)}_.splice(0,_.length,...x),v.sort((D,P)=>E(D)-E(P))}if(r)for(const[w,E]of Object.entries(r))for(const k of _)E.includes(k.name.value)&&(k.group.value=w);this.toolbarItems=_,this.overflowItems=v}#i(e){const t=Hn({...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 F2(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=kK.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=dY.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(x2(t)?.disposition==="host-routed")return e.setDisabled(!this.#y(t)),this.#v(t)?e.activate():e.deactivate(),!0;const n=JT(t);if(!n)return!1;const r=this.snapshot?.commands?.[n];pY(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=D2(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.#D(),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")}#D(){this.#C().forEach(e=>{const{allowWithoutEditor:t}=e;t?.value||e.setDisabled(!0)})}#P(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"?aY[i]:void 0;return s?ov(this.ui,s,void 0,r):!1}if(x2(n)?.disposition==="unsupported")return!0;const o=JT(n);return o?ov(this.ui,o,t,r):!1}#k(){return this.snapshot?.commands?.image?.disabled||(this.#e||(this.#e=qP({ownerDocument:this.toolbarContainer?.ownerDocument??document,onPick:async e=>{const t=await WP(e,this.superdoc?.config?.handleImageUpload);ov(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=cY(e)?e:document,n=s=>{ex(s.target)||this.ui?.formatPainter.setPointerSelecting(!0)},r=s=>{this.ui?.formatPainter.setPointerSelecting(!1),!ex(s.target)&&this.ui?.formatPainter.notifyPointerUp()},o=s=>{if(s.key==="Escape"){this.ui?.formatPainter.cancel();return}mY(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(x2(r)?.disposition==="host-routed"){this.#P(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});F2(a)&&Promise.resolve(a).catch(l=>this.#p(l,r))}this.updateToolbarState();return}if(e?.isCustomToolbarItem&&typeof o=="string"){if(!ov(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 yY(e){return new vY(e)}Wt();var bY=['[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(", "),wY=800,tx=typeof Blob=="function"?Object.getOwnPropertyDescriptor(Blob.prototype,"size")?.get:void 0,nx=e=>{if(!tx)return!1;try{return tx.call(e),!0}catch{return!1}};function CY(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 kY=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"]),SY=["original","markup","final"],_Y=["review","original","final","off"];function rx(e){return SY.includes(e)}function AY(e){return e==="markup"?"review":e}function ox(e){return _Y.includes(e)}function IY(e){const t=e.modules?.trackChanges?.mode;if(ox(t))return t;const n=e.layoutEngineOptions?.trackedChanges?.mode;return ox(n)?n:null}function iv(e,t){const n=e.viewing,r=rx(n?.trackedChanges)?n.trackedChanges:null,o=r?AY(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 EY(e,t){const n=new N8.default;return e.forEach((r,o)=>{n.file(t[o],r)}),n.generateAsync({type:"blob",compression:"DEFLATE"})}function TY(e,t){const n=e.composedPath();if(!n.includes(t))return null;const r=n.find(a=>a instanceof HTMLElement&&a.matches(bY));if(!r)return null;const o=n.some(a=>a instanceof HTMLElement&&a.classList.contains(Lm.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 xY(e){if(!e||typeof e!="object")return[];const t=e.items;return Array.isArray(t)?t:[]}function ix(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 sx(e){const t=e.selectionTarget??e.target;if(!t)return null;try{return JSON.stringify(t)}catch{return null}}function RY(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 Ci(e){return!!(e&&typeof e=="object"&&e.editorVersion===2)}function ax(e){return typeof e=="string"&&e.length>0?e:null}function lx(e){return e?Ci(e)?ax(e.documentId??e.options?.documentId??null):ax(typeof e.getDocumentId=="function"?e.getDocumentId():e.options?.documentId):null}function MY(e){if(!e||Ci(e))return null;const t=e;return t.documentRenderer??t.presentationEditor??null}function Ls(e){if(!e)return null;if(Ci(e))return e.fonts??null;const t=MY(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 fp=class extends Gv.default{static{this.allowedTypes=[jr,Qa]}#e;#t;#n;#r;#o;#c;#d;#f;#u;#m;#h;#i;#s;#g;#C;#_;#v;#y;#I;#R;#T;#O;#E;#D;#P;#b;#k;get uiConfig(){return this.#k}#x;get interactionConfig(){return this.#x}#A;get surfacesConfig(){return this.#A}#p;#F;#w;#l;#L;#N;#M;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()+wY))},this.#D=n=>{this.listenerCount("content-control:active-change")>0&&!CY(n)&&(this.#v="keyboard",this.#y=null)},this.#P=n=>{this.#q(n)},this.#b=null,this.#k=OT({}),this.#x=DT({}),this.#A=PT({}),this.version="0.0.0",this.users=[],this.whiteboard=null,this.colors=[],this.readyEditors=0,this.#F=!1,this.#w=[],this.#l=new uW,this.#L=null,this.#N=!1,this.#M=null,this.config={selector:"#superdoc",documentMode:"editing",allowSelectionInViewMode:!1,role:"editor",documents:[],editorExtensions:[],colors:[],users:[],user:{...I2},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.#j=null,!e.selector)throw new Error("SuperDoc: selector is required");const t=typeof e.selector=="string"?document.querySelector(e.selector):e.selector;if(!(t instanceof HTMLElement))throw new Error("SuperDoc: selector must be a valid CSS selector string or DOM element");this.#t=A5(this,e,()=>this.version,t),this.#p=new MG({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.#D,!0),t.addEventListener("click",this.#P,!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#q(e){const t=this.#s;if(!t)return;const n=TY(e,t),r=this.activeEditor?.doc?.contentControls?.list;if(!(!n||typeof r!="function"))try{const o=await r();if(this.#e)return;const i=ix(xY(o).find(s=>s.id===n));i&&this.emit("content-control:click",{target:i,source:"pointer"})}catch{return}}async#Y(e,t){this.#M=IY(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),A2(this.config),this.config.documents=this.config.documents||[],this.config.layoutEngineOptions=this.config.layoutEngineOptions||{};const n=this.config.viewOptions?.layout==="web",r=this.config.layoutEngineOptions?.flowMode==="semantic";if(!n&&r&&(console.warn("[SuperDoc] flowMode 'semantic' is only valid with web layout. Coercing to 'paginated'."),this.config.layoutEngineOptions.flowMode="paginated"),this.editorVersion=2,this.#Ue(),this.config.user=UG(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=wI(this.config.modules.comments),this.#k=OT(this.config),this.#x=DT(this.config),this.#A=PT(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.9",this.#ne("π¦ [superdoc] Using SuperDoc version:",this.version),this.superdocId=e.superdocId||Fa(),this.colors=this.config.colors??[],this.#Te(),this.#be(),await eO(),this.#e)return;if(await this.#ke(this.config.modules),this.#e){this.#ye();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.#L||(this.#L=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.#Ce(),this.#Z(),this.#Ge(),this.#X()}#X(){if(this.#F=!1,this.#w=[],this.#we(),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 r$({Renderer:TG,enabled:t}),this.emit("whiteboard:init",{whiteboard:this.whiteboard})}get requiredNumberOfEditors(){return this.#S("requiredNumberOfEditors").documents.filter(e=>e.type===jr).length}get ui(){return this.#b||(this.#b=cB({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")&&Rf(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=sx(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=>ix(s.items.find(_=>_.id===y)));if(l.some(y=>y===null))return;const u=l,d=a===e,f=u.length===t.length&&u.every((y,_)=>y.id===t[_]?.id);if(d&&f)return;if(u.length===0&&t.length===0){e=a;return}const p=d?t[0]??null:null;e=a,t=u;const g=sx(this.#b.selection.getSnapshot()),v=this.#T;this.emit("content-control:active-change",{active:u[0]??null,previous:p,activePath:u,source:g&&v?.editor===a&&v.key===g?v.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=>Wl(e.data)?{...e,data:n0(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}#be(){const e=this.config.document,t=!!e&&typeof e=="object"&&(Wl(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=o0(e);this.config.documents=[{id:Fa(),...o}]}else n&&(this.config.documents=[{id:Fa(),type:jr,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=o0(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||Fa()}}))}#we(){const{app:e,pinia:t,superdocStore:n,commentsStore:r,highContrastModeStore:o}=HU({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&&BL(this),this.#ie()}#a(e,t){t&&this.on(e,t)}#Ce(){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.#Se(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#ke({collaboration:e}={}){return e?(this.isCollaborative=!1,this.config.documents.length===0&&(this.config.documents=[{id:Fa(),type:jr,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}}#Se(e){this.#se(),Ci(e)&&(this.#Ae(e),this.#Ie(e),this.#_e(e))}#_e(e){const t=e.connection;if(!t||typeof t.subscribe!="function")return;const{documentId:n}=t;this.#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:RY(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}#Ae(e){const t=e.presence;if(!t||typeof t.subscribe!="function")return;const n=JU(()=>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)}}#Ie(e){const t=e.lock;if(!t||typeof t.subscribe!="function")return;const n=r=>{this.#e||this.#U(!!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}}#Ee(e,t){return JSON.stringify(e??null)===JSON.stringify(t??null)}#U(e,t){this.isLocked===e&&this.#Ee(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}))}#Te(){const e=this.config.user;if(!e||e.color)return;const t=this.colors.length>0?this.colors:kY,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.#ue(e);if(this.#xe(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.#Ne(),o=this.#Me(),i=this.#Re();this.#Oe();try{this.#h=i;const s=await this.#Pe(t,r);this.#Fe(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}#xe(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})}#Re(){return{isLocked:this.isLocked,lockedBy:this.lockedBy?{...this.lockedBy}:null}}#Me(){const e=this.config.documents.find(r=>r.type===jr),t=this.superdocStore?.documents.find(r=>r.id===e.id)??null,n=t?Bn(t):null;return{isCollaborative:this.isCollaborative,configV2Collaboration:e.v2Collaboration??null,configData:e.data,storeDoc:t,storeV2Collaboration:this.#De(n),storeData:t?.data}}#Le(e){this.#h=null;const t=this.config.documents.find(n=>n.type===jr);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))}#Oe(){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.`)}#De(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=Bn(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.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===jr),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(!Ci(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}}#Fe(e,t){const n=this.#le({...t,roomMode:"join"});e.configDoc.v2Collaboration=n,this.#H(e.storeDoc,n)}async#Ne(){const e=this.activeEditor;if(Ci(e)&&typeof e.save=="function"){const r=await e.save();return this.#B(r)}const t=this.config.documents.find(r=>r.type===jr),n=(this.superdocStore?.documents.find(r=>r.id===t.id)??null)?.data??t.data;if(n instanceof Blob)return n;if(Wl(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(Wl(e))return n0(e,jr);throw new Error("SuperDoc: active v2 editor returned an unsupported DOCX save payload")}#ce(e,t){const n=lx(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===jr);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(!Ci(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.#ue(e)}#ue(e){const t=this.config,n=t.documents.find(a=>a.type===jr),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=JS({collaboration:e.collaboration,v2Collaboration:i,legacyCollaboration:o,documentType:jr,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===jr),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=xm({actor:e});t&&this.users.some(n=>xm({actor:n})===t)||this.users.push(e)}removeSharedUser(e){this.#$("removeSharedUser");const t=typeof e=="string"?Wb(e):"",n=typeof e=="string"?`email:${t}`:xm({actor:e});this.users=this.users.filter(r=>{const o=xm({actor:r});return n?o!==n:t?Wb(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=nx(i)?i:Wl(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:wT(e)})}broadcastEditorCreate(e){this.readyEditors++,this.broadcastReady(),this.#je(e),this.emit("editorCreate",{editor:wT(e)})}#de(e){if(!this.#e){if(!this.#F){this.#w.push(e);return}this.emit(e)}}broadcastSourceComplete(){this.#de("source:complete")}broadcastSourceSignalsComplete(){this.#de("source:signals-complete")}#J;#ee;#je(e){if(!e||typeof e.on!="function"||this.#J.has(e))return;this.#J.add(e),e.on("fonts-changed",n=>{this.#fe(e)&&this.#G(e,n)});const t=(e.documentRenderer??e.presentationEditor)?.getLastFontsChangedPayload?.();t&&this.#fe(e)&&this.#G(e,t)}#fe(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)),cW(t.missingFonts,n)}this.emit("fonts-changed",t)}broadcastEditorDestroy(){this.emit("editorDestroy")}broadcastSidebarToggle(e){this.emit("sidebar-toggle",e)}#Ue(){Array.isArray(this.config.editorExtensions)&&this.config.editorExtensions.length>0&&console.warn("[SuperDoc] `editorExtensions` is ignored by superdoc@2. Use `extensions` with `defineSuperDocExtension`. ProseMirror APIs such as `Node.create`, `Mark.create`, `addPmPlugins`, and custom schemas do not run in v2."),this.config.modules.ai&&console.warn("[SuperDoc] `modules.ai` is deprecated and will be removed in v3. Use `ui.toolbar.customItems` for the action, make the model request in your application, and apply the result with `doc.insert()` or `doc.replace()`.")}#ne(...e){(console.debug?console.debug:console.log)("π¦ π¦ΈββοΈ [superdoc]",...e)}#W;get fonts(){return this.#W||(this.#W={getReport:()=>Ls(this.activeEditor)?.getReport()??[],getMissingFonts:()=>Ls(this.activeEditor)?.getMissingFonts()??[],getDocumentFontOptions:()=>Ls(this.activeEditor)?.getDocumentFontOptions()??[],getFontFamilyOptions:()=>Ls(this.activeEditor)?.getFontFamilyOptions()??[],getDocumentFonts:()=>Ls(this.activeEditor)?.getDocumentFonts()??[],onReport:e=>{const t=this.activeEditor,n=t?Ls(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=Ls(this.activeEditor);if(!t)throw new Error("superdoc.fonts.map requires an active editor");t.map(e)},unmap:e=>{const t=Ls(this.activeEditor);if(!t)throw new Error("superdoc.fonts.unmap requires an active editor");t.unmap(e)},add:e=>{const t=Ls(this.activeEditor);if(!t)throw new Error("superdoc.fonts.add requires an active editor");t.add(e)},preload:e=>{const t=Ls(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.#he(),this.activeEditor=null,this.toolbar?.setActiveEditor?this.toolbar.setActiveEditor(null):this.toolbar&&(this.toolbar.activeEditor=null),e&&this.emit("active-editor-change")}#j;#he(){if(this.#j){try{this.#j()}catch{}this.#j=null}}#$e(e){this.#he();const t=Ls(e);if(!e||!t?.onChanged)return;const n=t.getLastFontsChangedPayload?.();n&&this.#G(e,n),this.#j=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"&&Ci(t)?this.#pe(t):this.#V()}finally{this.#N=!1}}#pe(e){if(Ci(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.#pe(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 al(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=yY({...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 FP(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,A2(this.config),this.#ie();const r={viewing:()=>this.#oe(),editing:()=>this.#We(),suggesting:()=>this.#ge()};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.#K(e)}#me(){return typeof this.config.trackChanges?.enabled=="boolean"?this.config.trackChanges.enabled:typeof this.config.modules?.trackChanges?.enabled=="boolean"?this.config.modules.trackChanges.enabled:!0}#K(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=iv(this.config,this.#M),n={...this.config.viewing},r=typeof e.comments=="boolean",o=rx(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&&A2(this.config),this.#ie(),this.config.documentMode==="viewing")){const i=iv(this.config,this.#M),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.#ge();const e=this.#S("setDocumentMode");if(e.documents.length>0){const t=e.documents[0]?.getEditor();t&&this.setActiveEditor(t)}this.#K({mode:"review",enabled:this.#me()}),e.documents.forEach(t=>{t.restoreComments?.(),this.#re(t,"editing")})}#ge(){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.#K({mode:"review",enabled:this.#me()}),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=iv(this.config,this.#M),r=n.comments,o=n.trackChangesVisible;e.updateTrackedChangesProjection!==!1&&this.#K({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=iv(this.config,this.#M),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){Yg("superdoc.search","[SuperDoc] search() is not supported in superdoc@2. Use superdoc.ui.search.")}goToSearchResult(e){Yg("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=wA(t.availableWidth,t.documentWidth,v1(this.config.zoom?.fitWidth));n!==null&&(this.superdocStore.activeZoom=n)}}this.emit("zoomChange",{zoom:this.getZoom(),mode:e})}}getZoomState(){const e=v1(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(Ci(t)&&typeof t.lock?.setLocked=="function"){t.lock.setLocked(e,e?{...this.user}:null);const n=t.lock.getSnapshot?.();n&&this.#U(!!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.#U(e,e?this.user:null)}getHTML(e={}){return Yg("superdoc.getHTML","[SuperDoc] getHTML() is not supported in superdoc@2 and returns []. Use await superdoc.activeEditor.doc.getHtml({})."),[]}lockSuperdoc(e=!1,t=null){this.#U(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=lE(n||this.config.title),d=await this.exportEditorsToDOCX({commentsType:t,isFinalDoc:i,policies:s,fieldsHighlightColor:l}),f=[...r],p=[...o];if(e.includes("docx")&&d.forEach(v=>{f.push(v),p.push(`${u}.docx`)}),f.length===1)return a?aE(f[0],u,e[0]):f[0];const g=await EY(f,p);return a?aE(g,u,"zip"):g}async replaceFile(e){return(await this.#ve(e)).raw}async replaceDocument(e){const{raw:t,confirmed:n}=await this.#ve(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#ve(e){const t=this.activeEditor;if(Ci(t)&&typeof t.replaceFile=="function"){const r=this.#B(e),o=await t.replaceFile(r),i=o&&typeof o=="object"?o.state:null,s=i===null||i==="review-ready"||i==="editing-ready";return s&&(this.#ce(t,r),this.emit("document-replaced",{editor:t,host:t?.host})),{raw:o,confirmed:s}}const n=t&&!Ci(t)?t.replaceFile:null;if(typeof n=="function"){const r=await n.call(t,e),o=r&&typeof r=="object"?r.state:void 0,i=o==null||o==="review-ready"||o==="editing-ready";return i&&(this.#ce(t,e),this.emit("document-replaced",{editor:t,host:t?.host})),{raw:r,confirmed:i}}throw new Error("SuperDoc: replaceFile is unavailable for the active editor")}async exportEditorsToDOCX({commentsType:e,isFinalDoc:t,policies:n,fieldsHighlightColor:r}={}){n!==void 0&&q1({policies:n,commentsType:e,isFinalDoc:t});const o=this.config?.modules?.comments!==!1;let i,s=!1;const a=()=>(s||(s=!0,e==="clean"?i=[]:o&&this.commentsStore&&typeof this.commentsStore.translateCommentsForExport=="function"&&(i=this.commentsStore.translateCommentsForExport(),Array.isArray(i)||(i=[]))),i),l=new WeakSet,u=d=>{"editor"in d&&d.error&&typeof d.error=="object"&&l.add(d.error)};this.on("exception",u);try{const d=this.#S("exportEditorsToDOCX").documents;if(n!==void 0&&d.some(p=>{if(p.type!=="application/vnd.openxmlformats-officedocument.wordprocessingml.document")return!1;const g=p.getEditor?.();return g?.editorVersion!==2||typeof g.exportDocx!="function"}))throw new Error("Independent DOCX export policies require a mounted V2 exporter for every document.");const f=d.map(async p=>{if(!p||p.type!=="application/vnd.openxmlformats-officedocument.wordprocessingml.document")return null;const g=typeof p.getEditor=="function"?p.getEditor():null,v=()=>nx(p.data)?p.data.type&&p.data.type!=="application/vnd.openxmlformats-officedocument.wordprocessingml.document"?null:p.data:Wl(p.data)?this.#B(p.data):null;if(!g||typeof g.exportDocx!="function")return v();const y=g.editorVersion===2;try{const _=await g.exportDocx(y?{isFinalDoc:t,commentsType:e,policies:n,fieldsHighlightColor:r}:{isFinalDoc:t,comments:a(),commentsType:e,fieldsHighlightColor:r});if(_)return _}catch(_){if((!_||typeof _!="object"||!l.has(_))&&(this.emit("exception",{error:_,document:p}),this.emit("exception",Jj(_,{documentId:p.id,editor:null}))),y)throw _}return v()});return(await Promise.all(f)).filter(p=>p!=null)}finally{this.off("exception",u)}}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(!Ci(n)||typeof n.save!="function")throw new Error(`SuperDoc: save is unavailable for document "${t.id}"`);await n.save()}))}#ye(){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=lx(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 Tt(),!0):!1}destroy(){E5(this),this.#e=!0,this.#w=[],this.#s?.removeEventListener("click",this.#P,!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.#D,!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.#ye(),this.#L?.(),this.#L=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?Ci(this.activeEditor)?this.activeEditor.focus?.(e):this.activeEditor.focus?.():this.#S("focus").documents.find(n=>{const r=n.getEditor?.();return r?(Ci(r)?r.focus?.(e):r.focus?.(),!0):!1})}setHighContrastMode(e){this.activeEditor&&(this.activeEditor.setHighContrastMode?.(e),this.highContrastModeStore?.setHighContrastMode(e))}};Object.defineProperty(fp.prototype.canPerformPermission,Symbol.for("superdoc.internal.permission-method.builtin"),{value:!0}),Wt();var cx="__SUPERDOC_V2_BROWSER_RUNTIME__";function LY(e=globalThis){const t=e[cx];return t&&typeof t=="object"?t:null}function OY(e={},t=globalThis){const n=LY(t)??{},r={...n,...e,vue:e.vue??n.vue??I8};return t[cx]=r,r}OY();var DY={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"},PY=0;function ux(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-${++PY}`}`,l=[];if(i)for(const[u,d]of Object.entries(i)){if(d==null)continue;const f=DY[u];f&&l.push(` ${f}: ${d};`)}if(n!=null&&l.push(` --sd-ui-font-family: ${n};`),r!=null&&l.push(` --sd-ui-radius: ${r};`),o!=null&&l.push(` --sd-ui-shadow: ${o};`),s)for(const[u,d]of Object.entries(s))d!=null&&l.push(` ${u}: ${d};`);return{className:a,css:l.length>0?`.${a} {
|
|
111
111
|
${l.join(`
|
|
112
112
|
`)}
|
|
113
|
-
}`:""}}function FY(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 NY(e){const{className:t,css:n}=ux(e);return FY(t,n),t}function BY(e){return ux(e)}function zY(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 VY=xf({BlankDOCX:()=>jY,DOCX:()=>jr,DocumentLoadError:()=>YS,HTML:()=>vh,PDF:()=>Qa,SuperDoc:()=>fp,buildTheme:()=>BY,compareVersions:()=>O8,createTheme:()=>NY,defineSuperDocExtension:()=>zY,getFileObject:()=>Kb,listPermissionRangeEditors:()=>yN,resolvePermissionRangeEditor:()=>GA}),jY=K_,UY="SUPERDOC_ENGINE_CDN_BASE_URL",dx=Symbol.for("superdoc.docx-engine.cdn-load-state"),sv="superdocDocxEngineStatus";function $Y(e,t,n=null){const r=e?.[UY],o=typeof r=="string"&&r.trim()?r:n;if(typeof o=="string"&&o.trim())return HY(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 HY(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 GY({engineVersion:e,buildBaseUrl:t}){QL(()=>{const n=$Y(globalThis,e,t),r=globalThis[dx],o=r instanceof Map?r:new Map;if(globalThis[dx]=o,!o.has(n)){const i=Promise.all([import(`${n}/dist-cdn/docx-engine.es.js`),WY(`${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 WY(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[sv]==="loaded")return Promise.resolve();const r=n?.dataset[sv]==="loading";return n&&!r&&n.remove(),new Promise((o,i)=>{const s=r?n:document.createElement("link");let a=!1,l;const u=(g,v)=>{a||(a=!0,l?.disconnect(),s.dataset[sv]=g,v())},d=()=>u("loaded",o),f=()=>u("error",()=>i(new Error(`SuperDoc: failed to load DOCX Engine styles from ${t}`))),p=()=>{s.isConnected||u("error",()=>i(new Error(`SuperDoc: DOCX Engine stylesheet was removed while loading from ${t}`)))};s.addEventListener("load",d,{once:!0}),s.addEventListener("error",f,{once:!0}),typeof globalThis.MutationObserver=="function"&&(l=new globalThis.MutationObserver(p),l.observe(document.head,{childList:!0})),r||(s.rel="stylesheet",s.href=t,s.dataset.superdocDocxEngine="true",s.dataset[sv]="loading",document.head.appendChild(s))})}GY({engineVersion:"0.27.0-next.
|
|
113
|
+
}`:""}}function FY(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 NY(e){const{className:t,css:n}=ux(e);return FY(t,n),t}function BY(e){return ux(e)}function zY(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 VY=xf({BlankDOCX:()=>jY,DOCX:()=>jr,DocumentLoadError:()=>YS,HTML:()=>vh,PDF:()=>Qa,SuperDoc:()=>fp,buildTheme:()=>BY,compareVersions:()=>O8,createTheme:()=>NY,defineSuperDocExtension:()=>zY,getFileObject:()=>Kb,listPermissionRangeEditors:()=>yN,resolvePermissionRangeEditor:()=>GA}),jY=K_,UY="SUPERDOC_ENGINE_CDN_BASE_URL",dx=Symbol.for("superdoc.docx-engine.cdn-load-state"),sv="superdocDocxEngineStatus";function $Y(e,t,n=null){const r=e?.[UY],o=typeof r=="string"&&r.trim()?r:n;if(typeof o=="string"&&o.trim())return HY(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 HY(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 GY({engineVersion:e,buildBaseUrl:t}){QL(()=>{const n=$Y(globalThis,e,t),r=globalThis[dx],o=r instanceof Map?r:new Map;if(globalThis[dx]=o,!o.has(n)){const i=Promise.all([import(`${n}/dist-cdn/docx-engine.es.js`),WY(`${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 WY(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[sv]==="loaded")return Promise.resolve();const r=n?.dataset[sv]==="loading";return n&&!r&&n.remove(),new Promise((o,i)=>{const s=r?n:document.createElement("link");let a=!1,l;const u=(g,v)=>{a||(a=!0,l?.disconnect(),s.dataset[sv]=g,v())},d=()=>u("loaded",o),f=()=>u("error",()=>i(new Error(`SuperDoc: failed to load DOCX Engine styles from ${t}`))),p=()=>{s.isConnected||u("error",()=>i(new Error(`SuperDoc: DOCX Engine stylesheet was removed while loading from ${t}`)))};s.addEventListener("load",d,{once:!0}),s.addEventListener("error",f,{once:!0}),typeof globalThis.MutationObserver=="function"&&(l=new globalThis.MutationObserver(p),l.observe(document.head,{childList:!0})),r||(s.rel="stylesheet",s.href=t,s.dataset.superdocDocxEngine="true",s.dataset[sv]="loading",document.head.appendChild(s))})}GY({engineVersion:"0.27.0-next.9",buildBaseUrl:null});for(const[e,t]of Object.entries(VY))e==="SuperDoc"||e==="default"||Object.prototype.hasOwnProperty.call(fp,e)||(fp[e]=t);var KY=fp;return KY})();
|