superdoc 2.4.0-next.50 → 2.4.0-next.52
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/chunks/{create-super-doc-ui-C6qsVKMY.es.js → create-super-doc-ui-B_1l545i.es.js} +2 -0
- package/dist/chunks/{create-super-doc-ui-C7loo2YE.cjs → create-super-doc-ui-DNtHxzz_.cjs} +2 -0
- package/dist/collaboration-upgrade-engine.cjs +1 -1
- package/dist/collaboration-upgrade-engine.es.js +1 -1
- package/dist/layout-engine/contracts/src/graphic-placement.d.ts +35 -6
- package/dist/layout-engine/contracts/src/index.d.ts +28 -5
- package/dist/layout-engine/contracts/src/resolved-layout.d.ts +5 -0
- package/dist/layout-engine/dom-contract/src/class-names.d.ts +2 -0
- package/dist/layout-engine/layout-engine/src/floating-objects.d.ts +2 -2
- package/dist/layout-engine/layout-engine/src/inline-drawing-alignment.d.ts +9 -0
- package/dist/layout-engine/painters/dom/src/renderer.d.ts +6 -0
- package/dist/public/ui-react.cjs +1 -1
- package/dist/public/ui-react.es.js +1 -1
- package/dist/public/ui.cjs +1 -1
- package/dist/public/ui.es.js +1 -1
- package/dist/superdoc.cjs +2 -2
- package/dist/superdoc.es.js +2 -2
- package/dist-cdn/superdoc.min.js +3 -3
- package/package.json +2 -2
package/dist-cdn/superdoc.min.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var SuperDoc=(function(){var lI=Object.create,eh=Object.defineProperty,cI=Object.getOwnPropertyDescriptor,uI=Object.getOwnPropertyNames,dI=Object.getPrototypeOf,D2=Object.prototype.hasOwnProperty,_r=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(r){throw n=[r],r}},O2=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),Ju=(e,t)=>{let n={};for(var r in e)eh(n,r,{get:e[r],enumerable:!0});return t||eh(n,Symbol.toStringTag,{value:"Module"}),n},fI=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(var o=uI(t),i=0,s=o.length,a;i<s;i++)a=o[i],!D2.call(e,a)&&a!==n&&eh(e,a,{get:(l=>t[l]).bind(null,a),enumerable:!(r=cI(t,a))||r.enumerable});return e},F2=(e,t,n)=>(n=e!=null?lI(dI(e)):{},fI(t||!e||!e.__esModule||!D2.call(e,"default")?eh(n,"default",{value:e,enumerable:!0}):n,e)),hI=O2(((e,t)=>{var n=Object.prototype.hasOwnProperty,r="~";function o(){}Object.create&&(o.prototype=Object.create(null),new o().__proto__||(r=!1));function i(c,d,f){this.fn=c,this.context=d,this.once=f||!1}function s(c,d,f,h,g){if(typeof f!="function")throw new TypeError("The listener must be a function");var m=new i(f,h||c,g),v=r?r+d:d;return c._events[v]?c._events[v].fn?c._events[v]=[c._events[v],m]:c._events[v].push(m):(c._events[v]=m,c._eventsCount++),c}function a(c,d){--c._eventsCount===0?c._events=new o:delete c._events[d]}function l(){this._events=new o,this._eventsCount=0}l.prototype.eventNames=function(){var d=[],f,h;if(this._eventsCount===0)return d;for(h in f=this._events)n.call(f,h)&&d.push(r?h.slice(1):h);return Object.getOwnPropertySymbols?d.concat(Object.getOwnPropertySymbols(f)):d},l.prototype.listeners=function(d){var f=r?r+d:d,h=this._events[f];if(!h)return[];if(h.fn)return[h.fn];for(var g=0,m=h.length,v=new Array(m);g<m;g++)v[g]=h[g].fn;return v},l.prototype.listenerCount=function(d){var f=r?r+d:d,h=this._events[f];return h?h.fn?1:h.length:0},l.prototype.emit=function(d,f,h,g,m,v){var k=r?r+d:d;if(!this._events[k])return!1;var C=this._events[k],_=arguments.length,b,w;if(C.fn){switch(C.once&&this.removeListener(d,C.fn,void 0,!0),_){case 1:return C.fn.call(C.context),!0;case 2:return C.fn.call(C.context,f),!0;case 3:return C.fn.call(C.context,f,h),!0;case 4:return C.fn.call(C.context,f,h,g),!0;case 5:return C.fn.call(C.context,f,h,g,m),!0;case 6:return C.fn.call(C.context,f,h,g,m,v),!0}for(w=1,b=new Array(_-1);w<_;w++)b[w-1]=arguments[w];C.fn.apply(C.context,b)}else{var T=C.length,L;for(w=0;w<T;w++)switch(C[w].once&&this.removeListener(d,C[w].fn,void 0,!0),_){case 1:C[w].fn.call(C[w].context);break;case 2:C[w].fn.call(C[w].context,f);break;case 3:C[w].fn.call(C[w].context,f,h);break;case 4:C[w].fn.call(C[w].context,f,h,g);break;default:if(!b)for(L=1,b=new Array(_-1);L<_;L++)b[L-1]=arguments[L];C[w].fn.apply(C[w].context,b)}}return!0},l.prototype.on=function(d,f,h){return s(this,d,f,h,!1)},l.prototype.once=function(d,f,h){return s(this,d,f,h,!0)},l.prototype.removeListener=function(d,f,h,g){var m=r?r+d:d;if(!this._events[m])return this;if(!f)return a(this,m),this;var v=this._events[m];if(v.fn)v.fn===f&&(!g||v.once)&&(!h||v.context===h)&&a(this,m);else{for(var k=0,C=[],_=v.length;k<_;k++)(v[k].fn!==f||g&&!v[k].once||h&&v[k].context!==h)&&C.push(v[k]);C.length?this._events[m]=C.length===1?C[0]:C:a(this,m)}return this},l.prototype.removeAllListeners=function(d){var f;return d?(f=r?r+d:d,this._events[f]&&a(this,f)):(this._events=new o,this._eventsCount=0),this},l.prototype.off=l.prototype.removeListener,l.prototype.addListener=l.prototype.on,l.prefixed=r,l.EventEmitter=l,typeof t<"u"&&(t.exports=l)})),Gm=F2(hI(),1),ko=[];for(let e=0;e<256;++e)ko.push((e+256).toString(16).slice(1));function pI(e,t=0){return(ko[e[t+0]]+ko[e[t+1]]+ko[e[t+2]]+ko[e[t+3]]+"-"+ko[e[t+4]]+ko[e[t+5]]+"-"+ko[e[t+6]]+ko[e[t+7]]+"-"+ko[e[t+8]]+ko[e[t+9]]+"-"+ko[e[t+10]]+ko[e[t+11]]+ko[e[t+12]]+ko[e[t+13]]+ko[e[t+14]]+ko[e[t+15]]).toLowerCase()}var Wm,mI=new Uint8Array(16);function gI(){if(!Wm){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Wm=crypto.getRandomValues.bind(crypto)}return Wm(mI)}var vI=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),N2={randomUUID:vI};function ps(e,t,n){if(N2.randomUUID&&!t&&!e)return N2.randomUUID();e=e||{};const r=e.random??e.rng?.()??gI();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 pI(r)}function ed(e){const t=Object.create(null);for(const n of e.split(","))t[n]=1;return n=>n in t}function bn(e){if(Ot(e)){const t={};for(let n=0;n<e.length;n++){const r=e[n],o=Qn(r)?yI(r):bn(r);if(o)for(const i in o)t[i]=o[i]}return t}else if(Qn(e)||zn(e))return e}function yI(e){const t={};return e.replace(q2,"").split(W2).forEach(n=>{if(n){const r=n.split(K2);r.length>1&&(t[r[0].trim()]=r[1].trim())}}),t}function nn(e){let t="";if(Qn(e))t=e;else if(Ot(e))for(let n=0;n<e.length;n++){const r=nn(e[n]);r&&(t+=r+" ")}else if(zn(e))for(const n in e)e[n]&&(t+=n+" ");return t.trim()}function Km(e){if(!e)return null;let{class:t,style:n}=e;return t&&!Qn(t)&&(e.class=nn(t)),n&&(e.style=bn(n)),e}function B2(e){return!!e||e===""}function bI(e,t){if(e.length!==t.length)return!1;let n=!0;for(let r=0;n&&r<e.length;r++)n=Ks(e[r],t[r]);return n}function Ks(e,t){if(e===t)return!0;let n=Ym(e),r=Ym(t);if(n||r)return n&&r?e.getTime()===t.getTime():!1;if(n=Xo(e),r=Xo(t),n||r)return e===t;if(n=Ot(e),r=Ot(t),n||r)return n&&r?bI(e,t):!1;if(n=zn(e),r=zn(t),n||r){if(!n||!r||Object.keys(e).length!==Object.keys(t).length)return!1;for(const o in e){const i=e.hasOwnProperty(o),s=t.hasOwnProperty(o);if(i&&!s||!i&&s||!Ks(e[o],t[o]))return!1}}return String(e)===String(t)}function th(e,t){return e.findIndex(n=>Ks(n,t))}function wI(e){return e==null?"initial":typeof e=="string"?e===""?" ":e:(typeof e!="number"||Number.isFinite(e),String(e))}var En,Ol,pi,qm,xc,td,Kn,nh,z2,Bn,Ot,Fl,za,Ym,V2,Wt,Qn,Xo,zn,rh,Xm,Nl,j2,nd,rd,Va,od,U2,Or,H2,Uo,Ec,Tc,lo,Bl,Zm,id,sd,$2,ad,G2,W2,K2,q2,Qm,Y2,CI,Jm,jt,eg,oh,tg=_r((()=>{En={},Ol=[],pi=()=>{},qm=()=>!1,xc=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),td=e=>e.startsWith("onUpdate:"),Kn=Object.assign,nh=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},z2=Object.prototype.hasOwnProperty,Bn=(e,t)=>z2.call(e,t),Ot=Array.isArray,Fl=e=>Nl(e)==="[object Map]",za=e=>Nl(e)==="[object Set]",Ym=e=>Nl(e)==="[object Date]",V2=e=>Nl(e)==="[object RegExp]",Wt=e=>typeof e=="function",Qn=e=>typeof e=="string",Xo=e=>typeof e=="symbol",zn=e=>e!==null&&typeof e=="object",rh=e=>(zn(e)||Wt(e))&&Wt(e.then)&&Wt(e.catch),Xm=Object.prototype.toString,Nl=e=>Xm.call(e),j2=e=>Nl(e).slice(8,-1),nd=e=>Nl(e)==="[object Object]",rd=e=>Qn(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,Va=ed(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),od=e=>{const t=Object.create(null);return(n=>t[n]||(t[n]=e(n)))},U2=/-\w/g,Or=od(e=>e.replace(U2,t=>t.slice(1).toUpperCase())),H2=/\B([A-Z])/g,Uo=od(e=>e.replace(H2,"-$1").toLowerCase()),Ec=od(e=>e.charAt(0).toUpperCase()+e.slice(1)),Tc=od(e=>e?`on${Ec(e)}`:""),lo=(e,t)=>!Object.is(e,t),Bl=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},Zm=(e,t,n,r=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:r,value:n})},id=e=>{const t=parseFloat(e);return isNaN(t)?e:t},sd=e=>{const t=Qn(e)?Number(e):NaN;return isNaN(t)?e:t},ad=()=>$2||($2=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}),G2=ed("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"),W2=/;(?![^(]*\))/g,K2=/:([^]+)/,q2=/\/\*[^]*?\*\//g,Qm="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",Y2=ed(Qm),CI=ed(Qm+",async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected"),Jm=e=>!!(e&&e.__v_isRef===!0),jt=e=>Qn(e)?e:e==null?"":Ot(e)||zn(e)&&(e.toString===Xm||!Wt(e.toString))?Jm(e)?jt(e.value):JSON.stringify(e,eg,2):String(e),eg=(e,t)=>Jm(t)?eg(e,t.value):Fl(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((n,[r,o],i)=>(n[oh(r,i)+" =>"]=o,n),{})}:za(t)?{[`Set(${t.size})`]:[...t.values()].map(n=>oh(n))}:Xo(t)?oh(t):zn(t)&&!Ot(t)&&!nd(t)?String(t):t,oh=(e,t="")=>{var n;return Xo(e)?`Symbol(${(n=e.description)!=null?n:t})`:e}}));function ng(e){return new uh(e)}function rg(){return Po}function X2(e,t=!1){Po&&Po.cleanups.push(e)}function Z2(e,t=!1){if(e.flags|=8,t){e.next=dd,dd=e;return}e.next=ud,ud=e}function og(){fg++}function ig(){if(--fg>0)return;if(dd){let t=dd;for(dd=void 0;t;){const n=t.next;t.next=void 0,t.flags&=-9,t=n}}let e;for(;ud;){let t=ud;for(ud=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 Q2(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function J2(e){let t,n=e.depsTail,r=n;for(;r;){const o=r.prevDep;r.version===-1?(r===n&&(n=o),ag(r),kI(r)):t=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=o}e.deps=t,e.depsTail=n}function sg(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(e1(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function e1(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===Mc)||(e.globalVersion=Mc,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!sg(e))))return;e.flags|=2;const t=e.dep,n=nr,r=Ei;nr=e,Ei=!0;try{Q2(e);const o=e.fn(e._value);(t.version===0||lo(o,e._value))&&(e.flags|=128,e._value=o,t.version++)}catch(o){throw t.version++,o}finally{nr=n,Ei=r,J2(e),e.flags&=-3}}function ag(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)ag(i,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function kI(e){const{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}function SI(e,t){e.effect instanceof Lc&&(e=e.effect.fn);const n=new Lc(e);t&&Kn(n,t);try{n.run()}catch(o){throw n.stop(),o}const r=n.run.bind(n);return r.effect=n,r}function _I(e){e.effect.stop()}function qs(){hg.push(Ei),Ei=!1}function Ys(){const e=hg.pop();Ei=e===void 0?!0:e}function t1(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const n=nr;nr=void 0;try{t()}finally{nr=n}}}function n1(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)n1(r)}const n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}function Mo(e,t,n){if(Ei&&nr){let r=hd.get(e);r||hd.set(e,r=new Map);let o=r.get(n);o||(r.set(n,o=new fd),o.map=r,o.key=n),o.track()}}function Xs(e,t,n,r,o,i){const s=hd.get(e);if(!s){Mc++;return}const a=l=>{l&&l.trigger()};if(og(),t==="clear")s.forEach(a);else{const l=Ot(e),c=l&&rd(n);if(l&&n==="length"){const d=Number(r);s.forEach((f,h)=>{(h==="length"||h===Pc||!Xo(h)&&h>=d)&&a(f)})}else switch((n!==void 0||s.has(void 0))&&a(s.get(n)),c&&a(s.get(Pc)),t){case"add":l?c&&a(s.get("length")):(a(s.get(ja)),Fl(e)&&a(s.get(fh)));break;case"delete":l||(a(s.get(ja)),Fl(e)&&a(s.get(fh)));break;case"set":Fl(e)&&a(s.get(ja))}}ig()}function AI(e,t){const n=hd.get(e);return n&&n.get(t)}function Rc(e){const t=Cn(e);return t===e?t:(Mo(t,"iterate",Pc),Zo(e)?t:t.map(Ti))}function ih(e){return Mo(e=Cn(e),"iterate",Pc),e}function ms(e,t){return gs(e)?zl(xi(e)?Ti(t):t):Ti(t)}function lg(e,t,n){const r=ih(e),o=r[t]();return r!==e&&!Zo(e)&&(o._next=o.next,o.next=()=>{const i=o._next();return i.done||(i.value=n(i.value)),i}),o}function Zs(e,t,n,r,o,i){const s=ih(e),a=s!==e&&!Zo(e),l=s[t];if(l!==f1[t]){const f=l.apply(e,i);return a?Ti(f):f}let c=n;s!==e&&(a?c=function(f,h){return n.call(this,ms(e,f),h,e)}:n.length>2&&(c=function(f,h){return n.call(this,f,h,e)}));const d=l.call(s,c,r);return a&&o?o(d):d}function r1(e,t,n,r){const o=ih(e),i=o!==e&&!Zo(e);let s=n,a=!1;o!==e&&(i?(a=r.length===0,s=function(c,d,f){return a&&(a=!1,c=ms(e,c)),n.call(this,c,ms(e,d),f,e)}):n.length>3&&(s=function(c,d,f){return n.call(this,c,d,f,e)}));const l=o[t](s,...r);return a?ms(e,l):l}function cg(e,t,n){const r=Cn(e);Mo(r,"iterate",Pc);const o=r[t](...n);return(o===-1||o===!1)&&cd(n[0])?(n[0]=Cn(n[0]),r[t](...n)):o}function ld(e,t,n=[]){qs(),og();const r=Cn(e)[t].apply(e,n);return ig(),Ys(),r}function II(e){Xo(e)||(e=String(e));const t=Cn(this);return Mo(t,"has",e),t.hasOwnProperty(e)}function xI(e,t,n){return function(...r){const o=this.__v_raw,i=Cn(o),s=Fl(i),a=e==="entries"||e===Symbol.iterator&&s,l=e==="keys"&&s,c=o[e](...r),d=n?hh:t?zl:Ti;return!t&&Mo(i,"iterate",l?fh:ja),Kn(Object.create(c),{next(){const{value:f,done:h}=c.next();return h?{value:f,done:h}:{value:a?[d(f[0]),d(f[1])]:d(f),done:h}}})}}function sh(e){return function(...t){return e==="delete"?!1:e==="clear"?void 0:this}}function EI(e,t){const n={get(r){const o=this.__v_raw,i=Cn(o),s=Cn(r);e||(lo(r,s)&&Mo(i,"get",r),Mo(i,"get",s));const{has:a}=pd(i),l=t?hh:e?zl:Ti;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&&Mo(Cn(r),"iterate",ja),r.size},has(r){const o=this.__v_raw,i=Cn(o),s=Cn(r);return e||(lo(r,s)&&Mo(i,"has",r),Mo(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=Cn(s),l=t?hh:e?zl:Ti;return!e&&Mo(a,"iterate",ja),s.forEach((c,d)=>r.call(o,l(c),l(d),i))}};return Kn(n,e?{add:sh("add"),set:sh("set"),delete:sh("delete"),clear:sh("clear")}:{add(r){const o=Cn(this),i=pd(o),s=Cn(r),a=!t&&!Zo(r)&&!gs(r)?s:r;return i.has.call(o,a)||lo(r,a)&&i.has.call(o,r)||lo(s,a)&&i.has.call(o,s)||(o.add(a),Xs(o,"add",a,a)),this},set(r,o){!t&&!Zo(o)&&!gs(o)&&(o=Cn(o));const i=Cn(this),{has:s,get:a}=pd(i);let l=s.call(i,r);l||(r=Cn(r),l=s.call(i,r));const c=a.call(i,r);return i.set(r,o),l?lo(o,c)&&Xs(i,"set",r,o,c):Xs(i,"add",r,o),this},delete(r){const o=Cn(this),{has:i,get:s}=pd(o);let a=i.call(o,r);a||(r=Cn(r),a=i.call(o,r));const l=s?s.call(o,r):void 0,c=o.delete(r);return a&&Xs(o,"delete",r,void 0,l),c},clear(){const r=Cn(this),o=r.size!==0,i=void 0,s=r.clear();return o&&Xs(r,"clear",void 0,void 0,i),s}}),["keys","values","entries",Symbol.iterator].forEach(r=>{n[r]=xI(r,e,t)}),n}function ah(e,t){const n=EI(e,t);return(r,o,i)=>o==="__v_isReactive"?!e:o==="__v_isReadonly"?e:o==="__v_raw"?r:Reflect.get(Bn(n,o)&&o in r?n:r,o,i)}function TI(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function RI(e){return e.__v_skip||!Object.isExtensible(e)?0:TI(j2(e))}function to(e){return gs(e)?e:ch(e,!1,p1,y1,yg)}function o1(e){return ch(e,!1,g1,b1,bg)}function lh(e){return ch(e,!0,m1,w1,wg)}function LI(e){return ch(e,!0,v1,C1,Cg)}function ch(e,t,n,r,o){if(!zn(e)||e.__v_raw&&!(t&&e.__v_isReactive))return e;const i=RI(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 xi(e){return gs(e)?xi(e.__v_raw):!!(e&&e.__v_isReactive)}function gs(e){return!!(e&&e.__v_isReadonly)}function Zo(e){return!!(e&&e.__v_isShallow)}function cd(e){return e?!!e.__v_raw:!1}function Cn(e){const t=e&&e.__v_raw;return t?Cn(t):e}function no(e){return!Bn(e,"__v_skip")&&Object.isExtensible(e)&&Zm(e,"__v_skip",!0),e}function cr(e){return e?e.__v_isRef===!0:!1}function te(e){return i1(e,!1)}function zr(e){return i1(e,!0)}function i1(e,t){return cr(e)?e:new k1(e,t)}function MI(e){e.dep&&e.dep.trigger()}function Xe(e){return cr(e)?e.value:e}function PI(e){return Wt(e)?e():Xe(e)}function ug(e){return xi(e)?e:new Proxy(e,S1)}function s1(e){return new _1(e)}function a1(e){const t=Ot(e)?new Array(e.length):{};for(const n in e)t[n]=l1(e,n);return t}function dg(e,t,n){return cr(e)?e:Wt(e)?new I1(e):zn(e)&&arguments.length>1?l1(e,t,n):te(e)}function l1(e,t,n){return new A1(e,t,n)}function DI(e,t,n=!1){let r,o;return Wt(e)?r=e:(r=e.get,o=e.set),new x1(r,o,n)}function OI(){return Js}function c1(e,t=!1,n=Js){if(n){let r=gd.get(n);r||gd.set(n,r=[]),r.push(e)}}function FI(e,t,n=En){const{immediate:r,deep:o,once:i,scheduler:s,augmentJob:a,call:l}=n,c=w=>o?w:Zo(w)||o===!1||o===0?Qs(w,1):Qs(w);let d,f,h,g,m=!1,v=!1;if(cr(e)?(f=()=>e.value,m=Zo(e)):xi(e)?(f=()=>c(e),m=!0):Ot(e)?(v=!0,m=e.some(w=>xi(w)||Zo(w)),f=()=>e.map(w=>{if(cr(w))return w.value;if(xi(w))return c(w);if(Wt(w))return l?l(w,2):w()})):Wt(e)?t?f=l?()=>l(e,2):e:f=()=>{if(h){qs();try{h()}finally{Ys()}}const w=Js;Js=d;try{return l?l(e,3,[g]):e(g)}finally{Js=w}}:f=pi,t&&o){const w=f,T=o===!0?1/0:o;f=()=>Qs(w(),T)}const k=rg(),C=()=>{d.stop(),k&&k.active&&nh(k.effects,d)};if(i&&t){const w=t;t=(...T)=>{w(...T),C()}}let _=v?new Array(e.length).fill(md):md;const b=w=>{if(!(!(d.flags&1)||!d.dirty&&!w))if(t){const T=d.run();if(o||m||(v?T.some((L,N)=>lo(L,_[N])):lo(T,_))){h&&h();const L=Js;Js=d;try{const N=[T,_===md?void 0:v&&_[0]===md?[]:_,g];_=T,l?l(t,3,N):t(...N)}finally{Js=L}}}else d.run()};return a&&a(b),d=new Lc(f),d.scheduler=s?()=>s(b,!1):b,g=w=>c1(w,!1,d),h=d.onStop=()=>{const w=gd.get(d);if(w){if(l)l(w,4);else for(const T of w)T();gd.delete(d)}},t?r?b(!0):_=d.run():s?s(b.bind(null,!0),!0):d.run(),C.pause=d.pause.bind(d),C.resume=d.resume.bind(d),C.stop=C,C}function Qs(e,t=1/0,n){if(t<=0||!zn(e)||e.__v_skip||(n=n||new Map,(n.get(e)||0)>=t))return e;if(n.set(e,t),t--,cr(e))Qs(e.value,t,n);else if(Ot(e))for(let r=0;r<e.length;r++)Qs(e[r],t,n);else if(za(e)||Fl(e))e.forEach(r=>{Qs(r,t,n)});else if(nd(e)){for(const r in e)Qs(e[r],t,n);for(const r of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,r)&&Qs(e[r],t,n)}return e}var Po,uh,nr,dh,Lc,fg,ud,dd,Ei,hg,Mc,u1,fd,hd,ja,fh,Pc,d1,f1,h1,pg,mg,gg,vg,p1,m1,g1,v1,hh,pd,y1,b1,w1,C1,yg,bg,wg,Cg,Ti,zl,k1,S1,_1,A1,I1,x1,E1,T1,md,gd,Js,NI=_r((()=>{tg(),uh=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=Po,!e&&Po&&(this.index=(Po.scopes||(Po.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=Po;try{return Po=this,e()}finally{Po=t}}}on(){++this._on===1&&(this.prevScope=Po,Po=this)}off(){this._on>0&&--this._on===0&&(Po=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}}},dh=new WeakSet,Lc=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,Po&&Po.active&&Po.effects.push(this)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,dh.has(this)&&(dh.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||Z2(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,t1(this),Q2(this);const e=nr,t=Ei;nr=this,Ei=!0;try{return this.fn()}finally{J2(this),nr=e,Ei=t,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)ag(e);this.deps=this.depsTail=void 0,t1(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?dh.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){sg(this)&&this.run()}get dirty(){return sg(this)}},fg=0,Ei=!0,hg=[],Mc=0,u1=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}},fd=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(!nr||!Ei||nr===this.computed)return;let t=this.activeLink;if(t===void 0||t.sub!==nr)t=this.activeLink=new u1(nr,this),nr.deps?(t.prevDep=nr.depsTail,nr.depsTail.nextDep=t,nr.depsTail=t):nr.deps=nr.depsTail=t,n1(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=nr.depsTail,t.nextDep=void 0,nr.depsTail.nextDep=t,nr.depsTail=t,nr.deps===t&&(nr.deps=n)}return t}trigger(e){this.version++,Mc++,this.notify(e)}notify(e){og();try{for(let t=this.subs;t;t=t.prevSub)t.sub.notify()&&t.sub.dep.notify()}finally{ig()}}},hd=new WeakMap,ja=Symbol(""),fh=Symbol(""),Pc=Symbol(""),d1={__proto__:null,[Symbol.iterator](){return lg(this,Symbol.iterator,e=>ms(this,e))},concat(...e){return Rc(this).concat(...e.map(t=>Ot(t)?Rc(t):t))},entries(){return lg(this,"entries",e=>(e[1]=ms(this,e[1]),e))},every(e,t){return Zs(this,"every",e,t,void 0,arguments)},filter(e,t){return Zs(this,"filter",e,t,n=>n.map(r=>ms(this,r)),arguments)},find(e,t){return Zs(this,"find",e,t,n=>ms(this,n),arguments)},findIndex(e,t){return Zs(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return Zs(this,"findLast",e,t,n=>ms(this,n),arguments)},findLastIndex(e,t){return Zs(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return Zs(this,"forEach",e,t,void 0,arguments)},includes(...e){return cg(this,"includes",e)},indexOf(...e){return cg(this,"indexOf",e)},join(e){return Rc(this).join(e)},lastIndexOf(...e){return cg(this,"lastIndexOf",e)},map(e,t){return Zs(this,"map",e,t,void 0,arguments)},pop(){return ld(this,"pop")},push(...e){return ld(this,"push",e)},reduce(e,...t){return r1(this,"reduce",e,t)},reduceRight(e,...t){return r1(this,"reduceRight",e,t)},shift(){return ld(this,"shift")},some(e,t){return Zs(this,"some",e,t,void 0,arguments)},splice(...e){return ld(this,"splice",e)},toReversed(){return Rc(this).toReversed()},toSorted(e){return Rc(this).toSorted(e)},toSpliced(...e){return Rc(this).toSpliced(...e)},unshift(...e){return ld(this,"unshift",e)},values(){return lg(this,"values",e=>ms(this,e))}},f1=Array.prototype,h1=ed("__proto__,__v_isRef,__isVue"),pg=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(Xo)),mg=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?Cg:wg:o?bg:yg).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(n)?e:void 0;const i=Ot(e);if(!r){let a;if(i&&(a=d1[t]))return a;if(t==="hasOwnProperty")return II}const s=Reflect.get(e,t,cr(e)?e:n);if((Xo(t)?pg.has(t):h1(t))||(r||Mo(e,"get",t),o))return s;if(cr(s)){const a=i&&rd(t)?s:s.value;return r&&zn(a)?lh(a):a}return zn(s)?r?lh(s):to(s):s}},gg=class extends mg{constructor(e=!1){super(!1,e)}set(e,t,n,r){let o=e[t];const i=Ot(e)&&rd(t);if(!this._isShallow){const l=gs(o);if(!Zo(n)&&!gs(n)&&(o=Cn(o),n=Cn(n)),!i&&cr(o)&&!cr(n))return l||(o.value=n),!0}const s=i?Number(t)<e.length:Bn(e,t),a=Reflect.set(e,t,n,cr(e)?e:r);return e===Cn(r)&&(s?lo(n,o)&&Xs(e,"set",t,n,o):Xs(e,"add",t,n)),a}deleteProperty(e,t){const n=Bn(e,t),r=e[t],o=Reflect.deleteProperty(e,t);return o&&n&&Xs(e,"delete",t,void 0,r),o}has(e,t){const n=Reflect.has(e,t);return(!Xo(t)||!pg.has(t))&&Mo(e,"has",t),n}ownKeys(e){return Mo(e,"iterate",Ot(e)?"length":ja),Reflect.ownKeys(e)}},vg=class extends mg{constructor(e=!1){super(!0,e)}set(e,t){return!0}deleteProperty(e,t){return!0}},p1=new gg,m1=new vg,g1=new gg(!0),v1=new vg(!0),hh=e=>e,pd=e=>Reflect.getPrototypeOf(e),y1={get:ah(!1,!1)},b1={get:ah(!1,!0)},w1={get:ah(!0,!1)},C1={get:ah(!0,!0)},yg=new WeakMap,bg=new WeakMap,wg=new WeakMap,Cg=new WeakMap,Ti=e=>zn(e)?to(e):e,zl=e=>zn(e)?lh(e):e,k1=class{constructor(e,t){this.dep=new fd,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=t?e:Cn(e),this._value=t?e:Ti(e),this.__v_isShallow=t}get value(){return this.dep.track(),this._value}set value(e){const t=this._rawValue,n=this.__v_isShallow||Zo(e)||gs(e);e=n?e:Cn(e),lo(e,t)&&(this._rawValue=e,this._value=n?e:Ti(e),this.dep.trigger())}},S1={get:(e,t,n)=>t==="__v_raw"?e:Xe(Reflect.get(e,t,n)),set:(e,t,n,r)=>{const o=e[t];return cr(o)&&!cr(n)?(o.value=n,!0):Reflect.set(e,t,n,r)}},_1=class{constructor(e){this.__v_isRef=!0,this._value=void 0;const t=this.dep=new fd,{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)}},A1=class{constructor(e,t,n){this._object=e,this._defaultValue=n,this.__v_isRef=!0,this._value=void 0,this._key=Xo(t)?t:String(t),this._raw=Cn(e);let r=!0,o=e;if(!Ot(e)||Xo(this._key)||!rd(this._key))do r=!cd(o)||Zo(o);while(r&&(o=o.__v_raw));this._shallow=r}get value(){let e=this._object[this._key];return this._shallow&&(e=Xe(e)),this._value=e===void 0?this._defaultValue:e}set value(e){if(this._shallow&&cr(this._raw[this._key])){const t=this._object[this._key];if(cr(t)){t.value=e;return}}this._object[this._key]=e}get dep(){return AI(this._raw,this._key)}},I1=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()}},x1=class{constructor(e,t,n){this.fn=e,this.setter=t,this._value=void 0,this.dep=new fd(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=Mc-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!t,this.isSSR=n}notify(){if(this.flags|=16,!(this.flags&8)&&nr!==this)return Z2(this,!0),!0}get value(){const e=this.dep.track();return e1(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}},E1={GET:"get",HAS:"has",ITERATE:"iterate"},T1={SET:"set",ADD:"add",DELETE:"delete",CLEAR:"clear"},md={},gd=new WeakMap,Js=void 0}));function BI(e){jg.push(e)}function zI(){jg.pop()}function VI(e,t){}function Dc(e,t,n,r){try{return r?e(...r):e()}catch(o){Vl(o,t,n)}}function Ri(e,t,n,r){if(Wt(e)){const o=Dc(e,t,n,r);return o&&rh(o)&&o.catch(i=>{Vl(i,t,n)}),o}if(Ot(e)){const o=[];for(let i=0;i<e.length;i++)o.push(Ri(e[i],t,n,r));return o}}function Vl(e,t,n,r=!0){const o=t?t.vnode:null,{errorHandler:i,throwUnhandledErrorInProduction:s}=t&&t.appContext.config||En;if(t){let a=t.parent;const l=t.proxy,c=`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,c)===!1)return}a=a.parent}if(i){qs(),Dc(i,null,10,[e,l,c]),Ys();return}}jI(e,n,o,r,s)}function jI(e,t,n,r=!0,o=!1){if(o)throw e;console.error(e)}function _t(e){const t=Ed||Ug;return e?t.then(this?e.bind(this):e):t}function UI(e){let t=Yi+1,n=Oo.length;for(;t<n;){const r=t+n>>>1,o=Oo[r],i=Bc(o);i<e||i===e&&o.flags&2?t=r+1:n=r}return t}function kg(e){if(!(e.flags&1)){const t=Bc(e),n=Oo[Oo.length-1];!n||!(e.flags&2)&&t>=Bc(n)?Oo.push(e):Oo.splice(UI(t),0,e),e.flags|=1,R1()}}function R1(){Ed||(Ed=Ug.then(M1))}function vd(e){Ot(e)?Hl.push(...e):oa&&e.id===-1?oa.splice($l+1,0,e):e.flags&1||(Hl.push(e),e.flags|=1),R1()}function L1(e,t,n=Yi+1){for(;n<Oo.length;n++){const r=Oo[n];if(r&&r.flags&2){if(e&&r.id!==e.uid)continue;Oo.splice(n,1),n--,r.flags&4&&(r.flags&=-2),r(),r.flags&4||(r.flags&=-2)}}}function ph(e){if(Hl.length){const t=[...new Set(Hl)].sort((n,r)=>Bc(n)-Bc(r));if(Hl.length=0,oa){oa.push(...t);return}for(oa=t,$l=0;$l<oa.length;$l++){const n=oa[$l];n.flags&4&&(n.flags&=-2),n.flags&8||n(),n.flags&=-2}oa=null,$l=0}}function M1(e){try{for(Yi=0;Yi<Oo.length;Yi++){const t=Oo[Yi];t&&!(t.flags&8)&&(t.flags&4&&(t.flags&=-2),Dc(t,t.i,t.i?15:14),t.flags&4||(t.flags&=-2))}}finally{for(;Yi<Oo.length;Yi++){const t=Oo[Yi];t&&(t.flags&=-2)}Yi=-1,Oo.length=0,ph(e),Ed=null,(Oo.length||Hl.length)&&M1(e)}}function P1(e,t){var n,r;zc=e,zc?(zc.enabled=!0,Td.forEach(({event:o,args:i})=>zc.emit(o,...i)),Td=[]):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=>{P1(o,t)}),setTimeout(()=>{zc||(t.__VUE_DEVTOOLS_HOOK_REPLAY__=null,Td=[])},3e3)):Td=[]}function yd(e){const t=co;return co=e,Rd=e&&e.type.__scopeId||null,t}function HI(e){Rd=e}function $I(){Rd=null}function Do(e,t=co,n){if(!t||e._n)return e;const r=(...o)=>{r._d&&Id(-1);const i=yd(t);let s;try{s=e(...o)}finally{yd(i),r._d&&Id(1)}return s};return r._n=!0,r._c=!0,r._d=!0,r}function ea(e,t){if(co===null)return e;const n=xd(co),r=e.dirs||(e.dirs=[]);for(let o=0;o<t.length;o++){let[i,s,a,l=En]=t[o];i&&(Wt(i)&&(i={mounted:i,updated:i}),i.deep&&Qs(s),r.push({dir:i,instance:n,value:s,oldValue:void 0,arg:a,modifiers:l}))}return e}function vs(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&&(qs(),Ri(l,n,8,[e.el,a,e,t]),Ys())}}function D1(e,t){if(uo){let n=uo.provides;const r=uo.parent&&uo.parent.provides;r===n&&(n=uo.provides=Object.create(r)),n[e]=t}}function Ua(e,t,n=!1){const r=dr();if(r||Wa){let o=Wa?Wa._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&&Wt(t)?t.call(r&&r.proxy):t}}function O1(){return!!(dr()||Wa)}function GI(e,t){return bd(e,null,t)}function WI(e,t){return bd(e,null,{flush:"post"})}function F1(e,t){return bd(e,null,{flush:"sync"})}function Ft(e,t,n){return bd(e,t,n)}function bd(e,t,n=En){const{immediate:r,deep:o,flush:i,once:s}=n,a=Kn({},n),l=t&&r||!t&&i!=="post";let c;if(Ya){if(i==="sync"){const g=$g();c=g.__watcherHandles||(g.__watcherHandles=[])}else if(!l){const g=()=>{};return g.stop=pi,g.resume=pi,g.pause=pi,g}}const d=uo;a.call=(g,m,v)=>Ri(g,d,m,v);let f=!1;i==="post"?a.scheduler=g=>{Fr(g,d&&d.suspense)}:i!=="sync"&&(f=!0,a.scheduler=(g,m)=>{m?g():kg(g)}),a.augmentJob=g=>{t&&(g.flags|=4),f&&(g.flags|=2,d&&(g.id=d.uid,g.i=d))};const h=FI(e,t,a);return Ya&&(c?c.push(h):l&&h()),h}function KI(e,t,n){const r=this.proxy,o=Qn(e)?e.includes(".")?N1(r,e):()=>r[e]:e.bind(r,r);let i;Wt(t)?i=t:(i=t.handler,n=t);const s=Kl(this),a=bd(o,i.bind(r),n);return s(),a}function N1(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 mh(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:c,props:d}=e,f=i===2;if(f&&r(s,t,n),(!f||$a(d))&&l&16)for(let h=0;h<c.length;h++)o(c[h],t,n,2);f&&r(a,t,n)}function qI(e,t,n,r,o,i,{o:{nextSibling:s,parentNode:a,querySelector:l,insert:c,createText:d}},f){function h(k,C){let _=C;for(;_;){if(_&&_.nodeType===8){if(_.data==="teleport start anchor")t.targetStart=_;else if(_.data==="teleport anchor"){t.targetAnchor=_,k._lpa=t.targetAnchor&&s(t.targetAnchor);break}}_=s(_)}}function g(k,C){C.anchor=f(s(k),C,a(k),n,r,o,i)}const m=t.target=Ih(t.props,l),v=$a(t.props);if(m){const k=m._lpa||m.firstChild;t.shapeFlag&16&&(v?(g(e,t),h(m,k),t.targetAnchor||Sg(m,t,d,c,a(e)===m?e:null)):(t.anchor=s(e),h(m,k),t.targetAnchor||Sg(m,t,d,c),f(k&&s(k),t,m,n,r,o,i))),wd(t,v)}else v&&t.shapeFlag&16&&(g(e,t),t.targetStart=e,t.targetAnchor=s(e));return t.anchor&&s(t.anchor)}function wd(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 Sg(e,t,n,r,o=null){const i=t.targetStart=n(""),s=t.targetAnchor=n("");return i[Gg]=s,e&&(r(i,e,o),r(s,e,o)),s}function _g(){const e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return Pn(()=>{e.isMounted=!0}),rr(()=>{e.isUnmounting=!0}),e}function B1(e){let t=e[0];if(e.length>1){for(const n of e)if(n.type!==Ar){t=n;break}}return t}function z1(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 Oc(e,t,n,r,o){const{appear:i,mode:s,persisted:a=!1,onBeforeEnter:l,onEnter:c,onAfterEnter:d,onEnterCancelled:f,onBeforeLeave:h,onLeave:g,onAfterLeave:m,onLeaveCancelled:v,onBeforeAppear:k,onAppear:C,onAfterAppear:_,onAppearCancelled:b}=t,w=String(e.key),T=z1(n,e),L=(M,V)=>{M&&Ri(M,r,9,V)},N=(M,V)=>{const q=V[1];L(M,V),Ot(M)?M.every(D=>D.length<=1)&&q():M.length<=1&&q()},H={mode:s,persisted:a,beforeEnter(M){let V=l;if(!n.isMounted)if(i)V=k||l;else return;M[Xi]&&M[Xi](!0);const q=T[w];q&&Ki(e,q)&&q.el[Xi]&&q.el[Xi](),L(V,[M])},enter(M){if(T[w]===e)return;let V=c,q=d,D=f;if(!n.isMounted)if(i)V=C||c,q=_||d,D=b||f;else return;let B=!1;M[Vc]=j=>{B||(B=!0,j?L(D,[M]):L(q,[M]),H.delayedLeave&&H.delayedLeave(),M[Vc]=void 0)};const E=M[Vc].bind(null,!1);V?N(V,[M,E]):E()},leave(M,V){const q=String(e.key);if(M[Vc]&&M[Vc](!0),n.isUnmounting)return V();L(h,[M]);let D=!1;M[Xi]=E=>{D||(D=!0,V(),E?L(v,[M]):L(m,[M]),M[Xi]=void 0,T[q]===e&&delete T[q])};const B=M[Xi].bind(null,!1);T[q]=e,g?N(g,[M,B]):B()},clone(M){const V=Oc(M,t,n,r,o);return o&&o(V),V}};return H}function Ag(e){if(jc(e))return e=ys(e),e.children=null,e}function V1(e){if(!jc(e))return Wg(e.type)&&e.children?B1(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&&Wt(n.default))return n.default()}}function ta(e,t){e.shapeFlag&6&&e.component?(e.transition=t,ta(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 gh(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===$t?(s.patchFlag&128&&o++,r=r.concat(gh(s.children,t,a))):(t||s.type!==Ar)&&r.push(a!=null?ys(s,{key:a}):s)}if(o>1)for(let i=0;i<r.length;i++)r[i].patchFlag=-2;return r}function jl(e,t){return Wt(e)?Kn({name:e.name},t,{setup:e}):e}function YI(){const e=dr();return e?(e.appContext.config.idPrefix||"v")+"-"+e.ids[0]+e.ids[1]++:""}function Ig(e){e.ids=[e.ids[0]+e.ids[2]+++"-",0,0]}function XI(e){const t=dr(),n=zr(null);if(t){const r=t.refs===En?t.refs={}:t.refs;Object.defineProperty(r,e,{enumerable:!0,get:()=>n.value,set:o=>n.value=o})}return n}function j1(e,t){let n;return!!((n=Object.getOwnPropertyDescriptor(e,t))&&!n.configurable)}function Fc(e,t,n,r,o=!1){if(Ot(e)){e.forEach((v,k)=>Fc(v,t&&(Ot(t)?t[k]:t),n,r,o));return}if(ws(r)&&!o){r.shapeFlag&512&&r.type.__asyncResolved&&r.component.subTree.component&&Fc(e,t,n,r.component.subTree);return}const i=r.shapeFlag&4?xd(r.component):r.el,s=o?null:i,{i:a,r:l}=e,c=t&&t.r,d=a.refs===En?a.refs={}:a.refs,f=a.setupState,h=Cn(f),g=f===En?qm:v=>j1(d,v)?!1:Bn(h,v),m=(v,k)=>!(k&&j1(d,k));if(c!=null&&c!==l){if(U1(t),Qn(c))d[c]=null,g(c)&&(f[c]=null);else if(cr(c)){const v=t;m(c,v.k)&&(c.value=null),v.k&&(d[v.k]=null)}}if(Wt(l))Dc(l,a,12,[s,d]);else{const v=Qn(l),k=cr(l);if(v||k){const C=()=>{if(e.f){const _=v?g(l)?f[l]:d[l]:m(l)||!e.k?l.value:d[e.k];if(o)Ot(_)&&nh(_,i);else if(Ot(_))_.includes(i)||_.push(i);else if(v)d[l]=[i],g(l)&&(f[l]=d[l]);else{const b=[i];m(l,e.k)&&(l.value=b),e.k&&(d[e.k]=b)}}else v?(d[l]=s,g(l)&&(f[l]=s)):k&&(m(l,e.k)&&(l.value=s),e.k&&(d[e.k]=s))};if(s){const _=()=>{C(),Ld.delete(e)};_.id=-1,Ld.set(e,_),Fr(_,n)}else U1(e),C()}}}function U1(e){const t=Ld.get(e);t&&(t.flags|=8,Ld.delete(e))}function ZI(e){const{mt:t,p:n,o:{patchProp:r,createText:o,nextSibling:i,parentNode:s,remove:a,insert:l,createComment:c}}=e,d=(b,w)=>{if(!w.hasChildNodes()){n(null,b,w),ph(),w._vnode=b;return}f(w.firstChild,b,null,null,null),ph(),w._vnode=b},f=(b,w,T,L,N,H=!1)=>{H=H||!!w.dynamicChildren;const M=Wl(b)&&b.data==="[",V=()=>v(b,w,T,L,N,M),{type:q,ref:D,shapeFlag:B,patchFlag:E}=w;let j=b.nodeType;w.el=b,E===-2&&(H=!1,w.dynamicChildren=null);let J=null;switch(q){case ia:j!==3?w.children===""?(l(w.el=o(""),s(b),b),J=b):J=V():(b.data!==w.children&&(Gl(),b.data=w.children),J=i(b));break;case Ar:_(b)?(J=i(b),C(w.el=b.content.firstChild,b,T)):j!==8||M?J=V():J=i(b);break;case Ka:if(M&&(b=i(b),j=b.nodeType),j===1||j===3){J=b;const Y=!w.children.length;for(let se=0;se<w.staticCount;se++)Y&&(w.children+=J.nodeType===1?J.outerHTML:J.data),se===w.staticCount-1&&(w.anchor=J),J=i(J);return M?i(J):J}else V();break;case $t:M?J=m(b,w,T,L,N,H):J=V();break;default:if(B&1)(j!==1||w.type.toLowerCase()!==b.tagName.toLowerCase())&&!_(b)?J=V():J=h(b,w,T,L,N,H);else if(B&6){w.slotScopeIds=N;const Y=s(b);if(M?J=k(b):Wl(b)&&b.data==="teleport start"?J=k(b,b.data,"teleport end"):J=i(b),t(w,Y,null,T,L,Md(Y),H),ws(w)&&!w.type.__asyncResolved){let se;M?(se=Gt($t),se.anchor=J?J.previousSibling:Y.lastChild):se=b.nodeType===3?qi(""):Gt("div"),se.el=b,w.component.subTree=se}}else B&64?j!==8?J=V():J=w.type.hydrate(b,w,T,L,N,H,e,g):B&128&&(J=w.type.hydrate(b,w,T,L,Md(s(b)),N,H,e,f))}return D!=null&&Fc(D,null,L,w),J},h=(b,w,T,L,N,H)=>{H=H||!!w.dynamicChildren;const{type:M,props:V,patchFlag:q,shapeFlag:D,dirs:B,transition:E}=w,j=M==="input"||M==="option";if(j||q!==-1){B&&vs(w,null,T,"created");let J=!1;if(_(b)){J=ub(null,E)&&T&&T.vnode.props&&T.vnode.props.appear;const se=b.content.firstChild;if(J){const pe=se.getAttribute("class");pe&&(se.$cls=pe),E.beforeEnter(se)}C(se,b,T),w.el=b=se}if(D&16&&!(V&&(V.innerHTML||V.textContent))){let se=g(b.firstChild,w,b,T,L,N,H);for(;se;){vh(b,1)||Gl();const pe=se;se=se.nextSibling,a(pe)}}else if(D&8){let se=w.children;se[0]===`
|
|
2
2
|
`&&(b.tagName==="PRE"||b.tagName==="TEXTAREA")&&(se=se.slice(1));const{textContent:pe}=b;pe!==se&&pe!==se.replace(/\r\n|\r/g,`
|
|
3
3
|
`)&&(vh(b,0)||Gl(),b.textContent=w.children)}if(V){if(j||!H||q&48){const se=b.tagName.includes("-");for(const pe in V)(j&&(pe.endsWith("value")||pe==="indeterminate")||xc(pe)&&!Va(pe)||pe[0]==="."||se&&!Va(pe))&&r(b,pe,null,V[pe],void 0,T)}else if(V.onClick)r(b,"onClick",null,V.onClick,void 0,T);else if(q&4&&xi(V.style))for(const se in V.style)V.style[se]}let Y;(Y=V&&V.onVnodeBeforeMount)&&Jo(Y,T,w),B&&vs(w,null,T,"beforeMount"),((Y=V&&V.onVnodeMounted)||B||J)&&mb(()=>{Y&&Jo(Y,T,w),J&&E.enter(b),B&&vs(w,null,T,"mounted")},L)}return b.nextSibling},g=(b,w,T,L,N,H,M)=>{M=M||!!w.dynamicChildren;const V=w.children,q=V.length;for(let D=0;D<q;D++){const B=M?V[D]:V[D]=Qo(V[D]),E=B.type===ia;b?(E&&!M&&D+1<q&&Qo(V[D+1]).type===ia&&(l(o(b.data.slice(B.children.length)),T,i(b)),b.data=B.children),b=f(b,B,L,N,H,M)):E&&!B.children?l(B.el=o(""),T):(vh(T,1)||Gl(),n(null,B,T,null,L,N,Md(T),H))}return b},m=(b,w,T,L,N,H)=>{const{slotScopeIds:M}=w;M&&(N=N?N.concat(M):M);const V=s(b),q=g(i(b),w,V,T,L,N,H);return q&&Wl(q)&&q.data==="]"?i(w.anchor=q):(Gl(),l(w.anchor=c("]"),V,q),q)},v=(b,w,T,L,N,H)=>{if(vh(b.parentElement,1)||Gl(),w.el=null,H){const q=k(b);for(;;){const D=i(b);if(D&&D!==q)a(D);else break}}const M=i(b),V=s(b);return a(b),n(null,w,V,M,T,L,Md(V),N),T&&(T.vnode.el=w.el,_h(T,w.el)),M},k=(b,w="[",T="]")=>{let L=0;for(;b;)if(b=i(b),b&&Wl(b)&&(b.data===w&&L++,b.data===T)){if(L===0)return i(b);L--}return b},C=(b,w,T)=>{const L=w.parentNode;L&&L.replaceChild(b,w);let N=T;for(;N;)N.vnode.el===w&&(N.vnode.el=N.subTree.el=b),N=N.parent},_=b=>b.nodeType===1&&b.tagName==="TEMPLATE";return[d,f]}function vh(e,t){if(t===0||t===1)for(;e&&!e.hasAttribute(Qg);)e=e.parentElement;const n=e&&e.getAttribute(Qg);if(n==null)return!1;if(n==="")return!0;{const r=n.split(",");return t===0&&r.includes("children")?!0:r.includes(Pb[t])}}function QI(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 JI(e,t){if(Wl(e)&&e.data==="["){let n=1,r=e.nextSibling;for(;r;){if(r.nodeType===1){if(t(r)===!1)break}else if(Wl(r))if(r.data==="]"){if(--n===0)break}else r.data==="["&&n++;r=r.nextSibling}}else t(e)}function H1(e){Wt(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 c=null,d,f=0;const h=()=>(f++,c=null,g()),g=()=>{let m;return c||(m=c=t().catch(v=>{if(v=v instanceof Error?v:new Error(String(v)),l)return new Promise((k,C)=>{l(v,()=>k(h()),()=>C(v),f+1)});throw v}).then(v=>m!==c&&c?c:(v&&(v.__esModule||v[Symbol.toStringTag]==="Module")&&(v=v.default),d=v,v)))};return jl({name:"AsyncComponentWrapper",__asyncLoader:g,__asyncHydrate(m,v,k){let C=!1;(v.bu||(v.bu=[])).push(()=>C=!0);const _=()=>{C||k()},b=i?()=>{const w=i(_,T=>JI(m,T));w&&(v.bum||(v.bum=[])).push(w)}:_;d?b():g().then(()=>!v.isUnmounted&&b())},get __asyncResolved(){return d},setup(){const m=uo;if(Ig(m),d)return()=>yh(d,m);const v=b=>{c=null,Vl(b,m,13,!r)};if(a&&m.suspense||Ya)return g().then(b=>()=>yh(b,m)).catch(b=>(v(b),()=>r?Gt(r,{error:b}):null));const k=te(!1),C=te(),_=te(!!o);return o&&setTimeout(()=>{_.value=!1},o),s!=null&&setTimeout(()=>{if(!k.value&&!C.value){const b=new Error(`Async component timed out after ${s}ms.`);v(b),C.value=b}},s),g().then(()=>{k.value=!0,m.parent&&jc(m.parent.vnode)&&m.parent.update()}).catch(b=>{v(b),C.value=b}),()=>{if(k.value&&d)return yh(d,m);if(C.value&&r)return Gt(r,{error:C.value});if(n&&!_.value)return yh(n,m)}}})}function yh(e,t){const{ref:n,props:r,children:o,ce:i}=t.vnode,s=Gt(e,r,o);return s.ref=n,s.ce=i,delete t.vnode.ce,s}function Cd(e,t){return Ot(e)?e.some(n=>Cd(n,t)):Qn(e)?e.split(",").includes(t):V2(e)?(e.lastIndex=0,e.test(t)):!1}function xg(e,t){$1(e,"a",t)}function Eg(e,t){$1(e,"da",t)}function $1(e,t,n=uo){const r=e.__wdc||(e.__wdc=()=>{let o=n;for(;o;){if(o.isDeactivated)return;o=o.parent}return e()});if(wh(t,r,n),n){let o=n.parent;for(;o&&o.parent;)jc(o.parent.vnode)&&e5(r,t,n,o),o=o.parent}}function e5(e,t,n,r){const o=wh(t,e,r,!0);Dd(()=>{nh(r[t],o)},n)}function Tg(e){e.shapeFlag&=-257,e.shapeFlag&=-513}function bh(e){return e.shapeFlag&128?e.ssContent:e}function wh(e,t,n=uo,r=!1){if(n){const o=n[e]||(n[e]=[]),i=t.__weh||(t.__weh=(...s)=>{qs();const a=Kl(n),l=Ri(t,n,e,s);return a(),Ys(),l});return r?o.unshift(i):o.push(i),i}}function G1(e,t=uo){wh("ec",e,t)}function t5(e,t){return Lg(Th,e,!0,t)||e}function Rg(e){return Qn(e)?Lg(Th,e,!1)||e:e||rv}function W1(e){return Lg(jb,e)}function Lg(e,t,n=!0,r=!1){const o=co||uo;if(o){const i=o.type;if(e===Th){const a=Vg(i,!1);if(a&&(a===t||a===Or(t)||a===Ec(Or(t))))return i}const s=K1(o[e]||i[e],t)||K1(o.appContext[e],t);return!s&&r?i:s}}function K1(e,t){return e&&(e[t]||e[Or(t)]||e[Ec(Or(t))])}function ur(e,t,n,r){let o;const i=n&&n[r],s=Ot(e);if(s||Qn(e)){const a=s&&xi(e);let l=!1,c=!1;a&&(l=!Zo(e),c=gs(e),e=ih(e)),o=new Array(e.length);for(let d=0,f=e.length;d<f;d++)o[d]=t(l?c?zl(Ti(e[d])):Ti(e[d]):e[d],d,void 0,i&&i[d])}else if(typeof e=="number"){o=new Array(e);for(let a=0;a<e;a++)o[a]=t(a+1,a,void 0,i&&i[a])}else if(zn(e))if(e[Symbol.iterator])o=Array.from(e,(a,l)=>t(a,l,void 0,i&&i[l]));else{const a=Object.keys(e);o=new Array(a.length);for(let l=0,c=a.length;l<c;l++){const d=a[l];o[l]=t(e[d],d,l,i&&i[l])}}else o=[];return n&&(n[r]=o),o}function n5(e,t){for(let n=0;n<t.length;n++){const r=t[n];if(Ot(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 kd(e,t,n={},r,o){if(co.ce||co.parent&&ws(co.parent)&&co.parent.ce){const c=Object.keys(n).length>0;return t!=="default"&&(n.name=t),ye(),an($t,null,[Gt("slot",n,r&&r())],c?-2:64)}let i=e[t];i&&i._c&&(i._d=!1),ye();const s=i&&Mg(i(n)),a=n.key||s&&s.key,l=an($t,{key:(a&&!Xo(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 Mg(e){return e.some(t=>na(t)?!(t.type===Ar||t.type===$t&&!Mg(t.children)):!0)?e:null}function r5(e,t){const n={};for(const r in e)n[t&&/[A-Z]/.test(r)?`on:${r}`:Tc(r)]=e[r];return n}function o5(){return null}function i5(){return null}function s5(e){}function a5(e){}function l5(){return null}function c5(){}function u5(e,t){return null}function d5(){return Y1("useSlots").slots}function q1(){return Y1("useAttrs").attrs}function Y1(e){const t=dr();return t.setupContext||(t.setupContext=Sb(t))}function Sd(e){return Ot(e)?e.reduce((t,n)=>(t[n]=null,t),{}):e}function f5(e,t){const n=Sd(e);for(const r in t){if(r.startsWith("__skip"))continue;let o=n[r];o?Ot(o)||Wt(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 h5(e,t){return!e||!t?e||t:Ot(e)&&Ot(t)?e.concat(t):Kn({},Sd(e),Sd(t))}function p5(e,t){const n={};for(const r in e)t.includes(r)||Object.defineProperty(n,r,{enumerable:!0,get:()=>e[r]});return n}function m5(e){const t=dr(),n=Ya;let r=e();Gc(),n&&$c(!1);const o=()=>{Kl(t),n&&$c(!0)},i=()=>{dr()!==t&&t.scope.off(),Gc(),n&&$c(!1)};return rh(r)&&(r=r.catch(s=>{throw o(),Promise.resolve().then(()=>Promise.resolve().then(i)),s})),[r,()=>{o(),Promise.resolve().then(i)}]}function g5(e){const t=Pg(e),n=e.proxy,r=e.ctx;Ph=!1,t.beforeCreate&&X1(t.beforeCreate,e,"bc");const{data:o,computed:i,methods:s,watch:a,provide:l,inject:c,created:d,beforeMount:f,mounted:h,beforeUpdate:g,updated:m,activated:v,deactivated:k,beforeDestroy:C,beforeUnmount:_,destroyed:b,unmounted:w,render:T,renderTracked:L,renderTriggered:N,errorCaptured:H,serverPrefetch:M,expose:V,inheritAttrs:q,components:D,directives:B,filters:E}=t;if(c&&v5(c,r,null),s)for(const Y in s){const se=s[Y];Wt(se)&&(r[Y]=se.bind(n))}if(o){const Y=o.call(n,n);zn(Y)&&(e.data=to(Y))}if(Ph=!0,i)for(const Y in i){const se=i[Y],pe=Wt(se)?se.bind(n,n):Wt(se.get)?se.get.bind(n,n):pi,Ve=!Wt(se)&&Wt(se.set)?se.set.bind(n):pi,ge=Ce({get:pe,set:Ve});Object.defineProperty(r,Y,{enumerable:!0,configurable:!0,get:()=>ge.value,set:be=>ge.value=be})}if(a)for(const Y in a)Z1(a[Y],r,n,Y);if(l){const Y=Wt(l)?l.call(n):l;Reflect.ownKeys(Y).forEach(se=>{D1(se,Y[se])})}d&&X1(d,e,"c");function J(Y,se){Ot(se)?se.forEach(pe=>Y(pe.bind(n))):se&&Y(se.bind(n))}if(J(Jg,f),J(Pn,h),J(Eh,g),J(Pd,m),J(xg,v),J(Eg,k),J(G1,H),J(nv,L),J(tv,N),J(rr,_),J(Dd,w),J(ev,M),Ot(V))if(V.length){const Y=e.exposed||(e.exposed={});V.forEach(se=>{Object.defineProperty(Y,se,{get:()=>n[se],set:pe=>n[se]=pe,enumerable:!0})})}else e.exposed||(e.exposed={});T&&e.render===pi&&(e.render=T),q!=null&&(e.inheritAttrs=q),D&&(e.components=D),B&&(e.directives=B),M&&Ig(e)}function v5(e,t,n=pi){Ot(e)&&(e=Dg(e));for(const r in e){const o=e[r];let i;zn(o)?"default"in o?i=Ua(o.from||r,o.default,!0):i=Ua(o.from||r):i=Ua(o),cr(i)?Object.defineProperty(t,r,{enumerable:!0,configurable:!0,get:()=>i.value,set:s=>i.value=s}):t[r]=i}}function X1(e,t,n){Ri(Ot(e)?e.map(r=>r.bind(t.proxy)):e.bind(t.proxy),t,n)}function Z1(e,t,n,r){let o=r.includes(".")?N1(n,r):()=>n[r];if(Qn(e)){const i=t[e];Wt(i)&&Ft(o,i)}else if(Wt(e))Ft(o,e.bind(n));else if(zn(e))if(Ot(e))e.forEach(i=>Z1(i,t,n,r));else{const i=Wt(e.handler)?e.handler.bind(n):t[e.handler];Wt(i)&&Ft(o,i,e)}}function Pg(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(c=>Ch(l,c,s,!0)),Ch(l,t,s)),zn(t)&&i.set(t,l),l}function Ch(e,t,n,r=!1){const{mixins:o,extends:i}=t;i&&Ch(e,i,n,!0),o&&o.forEach(s=>Ch(e,s,n,!0));for(const s in t)if(!(r&&s==="expose")){const a=Hb[s]||n&&n[s];e[s]=a?a(e[s],t[s]):t[s]}return e}function Q1(e,t){return t?e?function(){return Kn(Wt(e)?e.call(this,this):e,Wt(t)?t.call(this,this):t)}:t:e}function y5(e,t){return _d(Dg(e),Dg(t))}function Dg(e){if(Ot(e)){const t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function Ho(e,t){return e?[...new Set([].concat(e,t))]:t}function _d(e,t){return e?Kn(Object.create(null),e,t):t}function J1(e,t){return e?Ot(e)&&Ot(t)?[...new Set([...e,...t])]:Kn(Object.create(null),Sd(e),Sd(t??{})):t}function b5(e,t){if(!e)return t;if(!t)return e;const n=Kn(Object.create(null),e);for(const r in t)n[r]=Ho(e[r],t[r]);return n}function eb(){return{app:null,config:{isNativeTag:qm,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 w5(e,t){return function(r,o=null){Wt(r)||(r=Kn({},r)),o!=null&&!zn(o)&&(o=null);const i=eb(),s=new WeakSet,a=[];let l=!1;const c=i.app={_uid:$b++,_component:r,_props:o,_container:null,_context:i,_instance:null,version:hv,get config(){return i.config},set config(d){},use(d,...f){return s.has(d)||(d&&Wt(d.install)?(s.add(d),d.install(c,...f)):Wt(d)&&(s.add(d),d(c,...f))),c},mixin(d){return i.mixins.includes(d)||i.mixins.push(d),c},component(d,f){return f?(i.components[d]=f,c):i.components[d]},directive(d,f){return f?(i.directives[d]=f,c):i.directives[d]},mount(d,f,h){if(!l){const g=c._ceVNode||Gt(r,o);return g.appContext=i,h===!0?h="svg":h===!1&&(h=void 0),f&&t?t(g,d):e(g,d,h),l=!0,c._container=d,d.__vue_app__=c,xd(g.component)}},onUnmount(d){a.push(d)},unmount(){l&&(Ri(a,c._instance,16),e(null,c._container),delete c._container.__vue_app__)},provide(d,f){return i.provides[d]=f,c},runWithContext(d){const f=Wa;Wa=c;try{return d()}finally{Wa=f}}};return c}}function C5(e,t,n=En){const r=dr(),o=Or(t),i=Uo(t),s=ov(e,o),a=s1((l,c)=>{let d,f=En,h;return F1(()=>{const g=e[o];lo(d,g)&&(d=g,c())}),{get(){return l(),n.get?n.get(d):d},set(g){const m=n.set?n.set(g):g;if(!lo(m,d)&&!(f!==En&&lo(g,f)))return;const v=r.vnode.props;v&&(t in v||o in v||i in v)&&(`onUpdate:${t}`in v||`onUpdate:${o}`in v||`onUpdate:${i}`in v)||(d=g,c()),r.emit(`update:${t}`,m),lo(g,m)&&lo(g,f)&&!lo(m,h)&&c(),f=g,h=m}}});return a[Symbol.iterator]=()=>{let l=0;return{next(){return l<2?{value:l++?s||En:a,done:!1}:{done:!0}}}},a}function k5(e,t,...n){if(e.isUnmounted)return;const r=e.vnode.props||En;let o=n;const i=t.startsWith("update:"),s=i&&ov(r,t.slice(7));s&&(s.trim&&(o=n.map(d=>Qn(d)?d.trim():d)),s.number&&(o=n.map(id)));let a,l=r[a=Tc(t)]||r[a=Tc(Or(t))];!l&&i&&(l=r[a=Tc(Uo(t))]),l&&Ri(l,e,6,o);const c=r[a+"Once"];if(c){if(!e.emitted)e.emitted={};else if(e.emitted[a])return;e.emitted[a]=!0,Ri(c,e,6,o)}}function tb(e,t,n=!1){const r=n?Gb:t.emitsCache,o=r.get(e);if(o!==void 0)return o;const i=e.emits;let s={},a=!1;if(!Wt(e)){const l=c=>{const d=tb(c,t,!0);d&&(a=!0,Kn(s,d))};!n&&t.mixins.length&&t.mixins.forEach(l),e.extends&&l(e.extends),e.mixins&&e.mixins.forEach(l)}return!i&&!a?(zn(e)&&r.set(e,null),null):(Ot(i)?i.forEach(l=>s[l]=null):Kn(s,i),zn(e)&&r.set(e,s),s)}function kh(e,t){return!e||!xc(t)?!1:(t=t.slice(2).replace(/Once$/,""),Bn(e,t[0].toLowerCase()+t.slice(1))||Bn(e,Uo(t))||Bn(e,t))}function Sh(e){const{type:t,vnode:n,proxy:r,withProxy:o,propsOptions:[i],slots:s,attrs:a,emit:l,render:c,renderCache:d,props:f,data:h,setupState:g,ctx:m,inheritAttrs:v}=e,k=yd(e);let C,_;try{if(n.shapeFlag&4){const w=o||r,T=w;C=Qo(c.call(T,w,d,f,g,h,m)),_=a}else{const w=t;C=Qo(w.length>1?w(f,{attrs:a,slots:s,emit:l}):w(f,null)),_=t.props?a:Wb(a)}}catch(w){Hc.length=0,Vl(w,e,1),C=Gt(Ar)}let b=C;if(_&&v!==!1){const w=Object.keys(_),{shapeFlag:T}=b;w.length&&T&7&&(i&&w.some(td)&&(_=Kb(_,i)),b=ys(b,_,!1,!0))}return n.dirs&&(b=ys(b,null,!1,!0),b.dirs=b.dirs?b.dirs.concat(n.dirs):n.dirs),n.transition&&ta(b,n.transition),C=b,yd(k),C}function S5(e,t=!0){let n;for(let r=0;r<e.length;r++){const o=e[r];if(na(o)){if(o.type!==Ar||o.children==="v-if"){if(n)return;n=o}}else return}return n}function _5(e,t,n){const{props:r,children:o,component:i}=e,{props:s,children:a,patchFlag:l}=t,c=i.emitsOptions;if(t.dirs||t.transition)return!0;if(n&&l>=0){if(l&1024)return!0;if(l&16)return r?nb(r,s,c):!!s;if(l&8){const d=t.dynamicProps;for(let f=0;f<d.length;f++){const h=d[f];if(rb(s,r,h)&&!kh(c,h))return!0}}}else return(o||a)&&(!a||!a.$stable)?!0:r===s?!1:r?s?nb(r,s,c):!0:!!s;return!1}function nb(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(rb(t,e,i)&&!kh(n,i))return!0}return!1}function rb(e,t,n){const r=e[n],o=t[n];return n==="style"&&zn(r)&&zn(o)?!Ks(r,o):r!==o}function _h({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 A5(e,t,n,r=!1){const o={},i=sv();e.propsDefaults=Object.create(null),ob(e,t,o,i);for(const s in e.propsOptions[0])s in o||(o[s]=void 0);n?e.props=r?o:o1(o):e.type.props?e.props=o:e.props=i,e.attrs=i}function I5(e,t,n,r){const{props:o,attrs:i,vnode:{patchFlag:s}}=e,a=Cn(o),[l]=e.propsOptions;let c=!1;if((r||s>0)&&!(s&16)){if(s&8){const d=e.vnode.dynamicProps;for(let f=0;f<d.length;f++){let h=d[f];if(kh(e.emitsOptions,h))continue;const g=t[h];if(l)if(Bn(i,h))g!==i[h]&&(i[h]=g,c=!0);else{const m=Or(h);o[m]=Og(l,a,m,g,e,!1)}else g!==i[h]&&(i[h]=g,c=!0)}}}else{ob(e,t,o,i)&&(c=!0);let d;for(const f in a)(!t||!Bn(t,f)&&((d=Uo(f))===f||!Bn(t,d)))&&(l?n&&(n[f]!==void 0||n[d]!==void 0)&&(o[f]=Og(l,a,f,void 0,e,!0)):delete o[f]);if(i!==a)for(const f in i)(!t||!Bn(t,f))&&(delete i[f],c=!0)}c&&Xs(e.attrs,"set","")}function ob(e,t,n,r){const[o,i]=e.propsOptions;let s=!1,a;if(t)for(let l in t){if(Va(l))continue;const c=t[l];let d;o&&Bn(o,d=Or(l))?!i||!i.includes(d)?n[d]=c:(a||(a={}))[d]=c:kh(e.emitsOptions,l)||(!(l in r)||c!==r[l])&&(r[l]=c,s=!0)}if(i){const l=Cn(n),c=a||En;for(let d=0;d<i.length;d++){const f=i[d];n[f]=Og(o,l,f,c[f],e,!Bn(c,f))}}return s}function Og(e,t,n,r,o,i){const s=e[n];if(s!=null){const a=Bn(s,"default");if(a&&r===void 0){const l=s.default;if(s.type!==Function&&!s.skipFactory&&Wt(l)){const{propsDefaults:c}=o;if(n in c)r=c[n];else{const d=Kl(o);r=c[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===Uo(n))&&(r=!0))}return r}function ib(e,t,n=!1){const r=n?qb:t.propsCache,o=r.get(e);if(o)return o;const i=e.props,s={},a=[];let l=!1;if(!Wt(e)){const d=f=>{l=!0;const[h,g]=ib(f,t,!0);Kn(s,h),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 zn(e)&&r.set(e,Ol),Ol;if(Ot(i))for(let d=0;d<i.length;d++){const f=Or(i[d]);sb(f)&&(s[f]=En)}else if(i)for(const d in i){const f=Or(d);if(sb(f)){const h=i[d],g=s[f]=Ot(h)||Wt(h)?{type:h}:Kn({},h),m=g.type;let v=!1,k=!0;if(Ot(m))for(let C=0;C<m.length;++C){const _=m[C],b=Wt(_)&&_.name;if(b==="Boolean"){v=!0;break}else b==="String"&&(k=!1)}else v=Wt(m)&&m.name==="Boolean";g[0]=v,g[1]=k,(v||Bn(g,"default"))&&a.push(f)}}const c=[s,a];return zn(e)&&r.set(e,c),c}function sb(e){return e[0]!=="$"&&!Va(e)}function ab(e){return cb(e)}function lb(e){return cb(e,ZI)}function cb(e,t){const n=ad();n.__VUE__=!0;const{insert:r,remove:o,patchProp:i,createElement:s,createText:a,createComment:l,setText:c,setElementText:d,parentNode:f,nextSibling:h,setScopeId:g=pi,insertStaticContent:m}=e,v=(ee,S,ne,O=null,P=null,U=null,$=void 0,Q=null,Z=!!S.dynamicChildren)=>{if(ee===S)return;ee&&!Ki(ee,S)&&(O=je(ee),be(ee,P,U,!0),ee=null),S.patchFlag===-2&&(Z=!1,S.dynamicChildren=null);const{type:K,ref:me,shapeFlag:xe}=S;switch(K){case ia:k(ee,S,ne,O);break;case Ar:C(ee,S,ne,O);break;case Ka:ee==null&&_(S,ne,O,$);break;case $t:D(ee,S,ne,O,P,U,$,Q,Z);break;default:xe&1?T(ee,S,ne,O,P,U,$,Q,Z):xe&6?B(ee,S,ne,O,P,U,$,Q,Z):(xe&64||xe&128)&&K.process(ee,S,ne,O,P,U,$,Q,Z,Te)}me!=null&&P?Fc(me,ee&&ee.ref,U,S||ee,!S):me==null&&ee&&ee.ref!=null&&Fc(ee.ref,null,U,ee,!0)},k=(ee,S,ne,O)=>{if(ee==null)r(S.el=a(S.children),ne,O);else{const P=S.el=ee.el;S.children!==ee.children&&c(P,S.children)}},C=(ee,S,ne,O)=>{ee==null?r(S.el=l(S.children||""),ne,O):S.el=ee.el},_=(ee,S,ne,O)=>{[ee.el,ee.anchor]=m(ee.children,S,ne,O,ee.el,ee.anchor)},b=({el:ee,anchor:S},ne,O)=>{let P;for(;ee&&ee!==S;)P=h(ee),r(ee,ne,O),ee=P;r(S,ne,O)},w=({el:ee,anchor:S})=>{let ne;for(;ee&&ee!==S;)ne=h(ee),o(ee),ee=ne;o(S)},T=(ee,S,ne,O,P,U,$,Q,Z)=>{if(S.type==="svg"?$="svg":S.type==="math"&&($="mathml"),ee==null)L(S,ne,O,P,U,$,Q,Z);else{const K=ee.el&&ee.el._isVueCE?ee.el:null;try{K&&K._beginPatch(),M(ee,S,P,U,$,Q,Z)}finally{K&&K._endPatch()}}},L=(ee,S,ne,O,P,U,$,Q)=>{let Z,K;const{props:me,shapeFlag:xe,transition:he,dirs:Pe}=ee;if(Z=ee.el=s(ee.type,U,me&&me.is,me),xe&8?d(Z,ee.children):xe&16&&H(ee.children,Z,null,O,P,Fg(ee,U),$,Q),Pe&&vs(ee,null,O,"created"),N(Z,ee,ee.scopeId,$,O),me){for(const nt in me)nt!=="value"&&!Va(nt)&&i(Z,nt,null,me[nt],U,O);"value"in me&&i(Z,"value",null,me.value,U),(K=me.onVnodeBeforeMount)&&Jo(K,O,ee)}Pe&&vs(ee,null,O,"beforeMount");const Je=ub(P,he);Je&&he.beforeEnter(Z),r(Z,S,ne),((K=me&&me.onVnodeMounted)||Je||Pe)&&Fr(()=>{K&&Jo(K,O,ee),Je&&he.enter(Z),Pe&&vs(ee,null,O,"mounted")},P)},N=(ee,S,ne,O,P)=>{if(ne&&g(ee,ne),O)for(let U=0;U<O.length;U++)g(ee,O[U]);if(P){let U=P.subTree;if(S===U||Od(U.type)&&(U.ssContent===S||U.ssFallback===S)){const $=P.vnode;N(ee,$,$.scopeId,$.slotScopeIds,P.parent)}}},H=(ee,S,ne,O,P,U,$,Q,Z=0)=>{for(let K=Z;K<ee.length;K++){const me=ee[K]=Q?ra(ee[K]):Qo(ee[K]);v(null,me,S,ne,O,P,U,$,Q)}},M=(ee,S,ne,O,P,U,$)=>{const Q=S.el=ee.el;let{patchFlag:Z,dynamicChildren:K,dirs:me}=S;Z|=ee.patchFlag&16;const xe=ee.props||En,he=S.props||En;let Pe;if(ne&&Ul(ne,!1),(Pe=he.onVnodeBeforeUpdate)&&Jo(Pe,ne,S,ee),me&&vs(S,ee,ne,"beforeUpdate"),ne&&Ul(ne,!0),(xe.innerHTML&&he.innerHTML==null||xe.textContent&&he.textContent==null)&&d(Q,""),K?V(ee.dynamicChildren,K,Q,ne,O,Fg(S,P),U):$||se(ee,S,Q,null,ne,O,Fg(S,P),U,!1),Z>0){if(Z&16)q(Q,xe,he,ne,P);else if(Z&2&&xe.class!==he.class&&i(Q,"class",null,he.class,P),Z&4&&i(Q,"style",xe.style,he.style,P),Z&8){const Je=S.dynamicProps;for(let nt=0;nt<Je.length;nt++){const ut=Je[nt],Ht=xe[ut],He=he[ut];(He!==Ht||ut==="value")&&i(Q,ut,Ht,He,P,ne)}}Z&1&&ee.children!==S.children&&d(Q,S.children)}else!$&&K==null&&q(Q,xe,he,ne,P);((Pe=he.onVnodeUpdated)||me)&&Fr(()=>{Pe&&Jo(Pe,ne,S,ee),me&&vs(S,ee,ne,"updated")},O)},V=(ee,S,ne,O,P,U,$)=>{for(let Q=0;Q<S.length;Q++){const Z=ee[Q],K=S[Q],me=Z.el&&(Z.type===$t||!Ki(Z,K)||Z.shapeFlag&198)?f(Z.el):ne;v(Z,K,me,null,O,P,U,$,!0)}},q=(ee,S,ne,O,P)=>{if(S!==ne){if(S!==En)for(const U in S)!Va(U)&&!(U in ne)&&i(ee,U,S[U],null,P,O);for(const U in ne){if(Va(U))continue;const $=ne[U],Q=S[U];$!==Q&&U!=="value"&&i(ee,U,Q,$,P,O)}"value"in ne&&i(ee,"value",S.value,ne.value,P)}},D=(ee,S,ne,O,P,U,$,Q,Z)=>{const K=S.el=ee?ee.el:a(""),me=S.anchor=ee?ee.anchor:a("");let{patchFlag:xe,dynamicChildren:he,slotScopeIds:Pe}=S;Pe&&(Q=Q?Q.concat(Pe):Pe),ee==null?(r(K,ne,O),r(me,ne,O),H(S.children||[],ne,me,P,U,$,Q,Z)):xe>0&&xe&64&&he&&ee.dynamicChildren&&ee.dynamicChildren.length===he.length?(V(ee.dynamicChildren,he,ne,P,U,$,Q),(S.key!=null||P&&S===P.subTree)&&Ng(ee,S,!0)):se(ee,S,ne,me,P,U,$,Q,Z)},B=(ee,S,ne,O,P,U,$,Q,Z)=>{S.slotScopeIds=Q,ee==null?S.shapeFlag&512?P.ctx.activate(S,ne,O,$,Z):E(S,ne,O,P,U,$,Z):j(ee,S,Z)},E=(ee,S,ne,O,P,U,$)=>{const Q=ee.component=bb(ee,O,P);if(jc(ee)&&(Q.ctx.renderer=Te),Cb(Q,!1,$),Q.asyncDep){if(P&&P.registerDep(Q,J,$),!ee.el){const Z=Q.subTree=Gt(Ar);C(null,Z,S,ne),ee.placeholder=Z.el}}else J(Q,ee,S,ne,P,U,$)},j=(ee,S,ne)=>{const O=S.component=ee.component;if(_5(ee,S,ne))if(O.asyncDep&&!O.asyncResolved){Y(O,S,ne);return}else O.next=S,O.update();else S.el=ee.el,O.vnode=S},J=(ee,S,ne,O,P,U,$)=>{const Q=()=>{if(ee.isMounted){let{next:xe,bu:he,u:Pe,parent:Je,vnode:nt}=ee;{const Mt=db(ee);if(Mt){xe&&(xe.el=nt.el,Y(ee,xe,$)),Mt.asyncDep.then(()=>{Fr(()=>{ee.isUnmounted||K()},P)});return}}let ut=xe,Ht;Ul(ee,!1),xe?(xe.el=nt.el,Y(ee,xe,$)):xe=nt,he&&Bl(he),(Ht=xe.props&&xe.props.onVnodeBeforeUpdate)&&Jo(Ht,Je,xe,nt),Ul(ee,!0);const He=Sh(ee),Vt=ee.subTree;ee.subTree=He,v(Vt,He,f(Vt.el),je(Vt),ee,P,U),xe.el=He.el,ut===null&&_h(ee,He.el),Pe&&Fr(Pe,P),(Ht=xe.props&&xe.props.onVnodeUpdated)&&Fr(()=>Jo(Ht,Je,xe,nt),P)}else{let xe;const{el:he,props:Pe}=S,{bm:Je,m:nt,parent:ut,root:Ht,type:He}=ee,Vt=ws(S);if(Ul(ee,!1),Je&&Bl(Je),!Vt&&(xe=Pe&&Pe.onVnodeBeforeMount)&&Jo(xe,ut,S),Ul(ee,!0),he&&Ye){const Mt=()=>{ee.subTree=Sh(ee),Ye(he,ee.subTree,ee,P,null)};Vt&&He.__asyncHydrate?He.__asyncHydrate(he,ee,Mt):Mt()}else{Ht.ce&&Ht.ce._hasShadowRoot()&&Ht.ce._injectChildStyle(He,ee.parent?ee.parent.type:void 0);const Mt=ee.subTree=Sh(ee);v(null,Mt,ne,O,ee,P,U),S.el=Mt.el}if(nt&&Fr(nt,P),!Vt&&(xe=Pe&&Pe.onVnodeMounted)){const Mt=S;Fr(()=>Jo(xe,ut,Mt),P)}(S.shapeFlag&256||ut&&ws(ut.vnode)&&ut.vnode.shapeFlag&256)&&ee.a&&Fr(ee.a,P),ee.isMounted=!0,S=ne=O=null}};ee.scope.on();const Z=ee.effect=new Lc(Q);ee.scope.off();const K=ee.update=Z.run.bind(Z),me=ee.job=Z.runIfDirty.bind(Z);me.i=ee,me.id=ee.uid,Z.scheduler=()=>kg(me),Ul(ee,!0),K()},Y=(ee,S,ne)=>{S.component=ee;const O=ee.vnode.props;ee.vnode=S,ee.next=null,I5(ee,S.props,O,ne),Zb(ee,S.children,ne),qs(),L1(ee),Ys()},se=(ee,S,ne,O,P,U,$,Q,Z=!1)=>{const K=ee&&ee.children,me=ee?ee.shapeFlag:0,xe=S.children,{patchFlag:he,shapeFlag:Pe}=S;if(he>0){if(he&128){Ve(K,xe,ne,O,P,U,$,Q,Z);return}else if(he&256){pe(K,xe,ne,O,P,U,$,Q,Z);return}}Pe&8?(me&16&&Re(K,P,U),xe!==K&&d(ne,xe)):me&16?Pe&16?Ve(K,xe,ne,O,P,U,$,Q,Z):Re(K,P,U,!0):(me&8&&d(ne,""),Pe&16&&H(xe,ne,O,P,U,$,Q,Z))},pe=(ee,S,ne,O,P,U,$,Q,Z)=>{ee=ee||Ol,S=S||Ol;const K=ee.length,me=S.length,xe=Math.min(K,me);let he;for(he=0;he<xe;he++){const Pe=S[he]=Z?ra(S[he]):Qo(S[he]);v(ee[he],Pe,ne,null,P,U,$,Q,Z)}K>me?Re(ee,P,U,!0,!1,xe):H(S,ne,O,P,U,$,Q,Z,xe)},Ve=(ee,S,ne,O,P,U,$,Q,Z)=>{let K=0;const me=S.length;let xe=ee.length-1,he=me-1;for(;K<=xe&&K<=he;){const Pe=ee[K],Je=S[K]=Z?ra(S[K]):Qo(S[K]);if(Ki(Pe,Je))v(Pe,Je,ne,null,P,U,$,Q,Z);else break;K++}for(;K<=xe&&K<=he;){const Pe=ee[xe],Je=S[he]=Z?ra(S[he]):Qo(S[he]);if(Ki(Pe,Je))v(Pe,Je,ne,null,P,U,$,Q,Z);else break;xe--,he--}if(K>xe){if(K<=he){const Pe=he+1,Je=Pe<me?S[Pe].el:O;for(;K<=he;)v(null,S[K]=Z?ra(S[K]):Qo(S[K]),ne,Je,P,U,$,Q,Z),K++}}else if(K>he)for(;K<=xe;)be(ee[K],P,U,!0),K++;else{const Pe=K,Je=K,nt=new Map;for(K=Je;K<=he;K++){const Kt=S[K]=Z?ra(S[K]):Qo(S[K]);Kt.key!=null&&nt.set(Kt.key,K)}let ut,Ht=0;const He=he-Je+1;let Vt=!1,Mt=0;const sn=new Array(He);for(K=0;K<He;K++)sn[K]=0;for(K=Pe;K<=xe;K++){const Kt=ee[K];if(Ht>=He){be(Kt,P,U,!0);continue}let Qe;if(Kt.key!=null)Qe=nt.get(Kt.key);else for(ut=Je;ut<=he;ut++)if(sn[ut-Je]===0&&Ki(Kt,S[ut])){Qe=ut;break}Qe===void 0?be(Kt,P,U,!0):(sn[Qe-Je]=K+1,Qe>=Mt?Mt=Qe:Vt=!0,v(Kt,S[Qe],ne,null,P,U,$,Q,Z),Ht++)}const qn=Vt?x5(sn):Ol;for(ut=qn.length-1,K=He-1;K>=0;K--){const Kt=Je+K,Qe=S[Kt],Pt=S[Kt+1],It=Kt+1<me?Pt.el||fb(Pt):O;sn[K]===0?v(null,Qe,ne,It,P,U,$,Q,Z):Vt&&(ut<0||K!==qn[ut]?ge(Qe,ne,It,2):ut--)}}},ge=(ee,S,ne,O,P=null)=>{const{el:U,type:$,transition:Q,children:Z,shapeFlag:K}=ee;if(K&6){ge(ee.component.subTree,S,ne,O);return}if(K&128){ee.suspense.move(S,ne,O);return}if(K&64){$.move(ee,S,ne,Te);return}if($===$t){r(U,S,ne);for(let me=0;me<Z.length;me++)ge(Z[me],S,ne,O);r(ee.anchor,S,ne);return}if($===Ka){b(ee,S,ne);return}if(O!==2&&K&1&&Q)if(O===0)Q.beforeEnter(U),r(U,S,ne),Fr(()=>Q.enter(U),P);else{const{leave:me,delayLeave:xe,afterLeave:he}=Q,Pe=()=>{ee.ctx.isUnmounted?o(U):r(U,S,ne)},Je=()=>{U._isLeaving&&U[Xi](!0),me(U,()=>{Pe(),he&&he()})};xe?xe(U,Pe,Je):Je()}else r(U,S,ne)},be=(ee,S,ne,O=!1,P=!1)=>{const{type:U,props:$,ref:Q,children:Z,dynamicChildren:K,shapeFlag:me,patchFlag:xe,dirs:he,cacheIndex:Pe,memo:Je}=ee;if(xe===-2&&(P=!1),Q!=null&&(qs(),Fc(Q,null,ne,ee,!0),Ys()),Pe!=null&&(S.renderCache[Pe]=void 0),me&256){S.ctx.deactivate(ee);return}const nt=me&1&&he,ut=!ws(ee);let Ht;if(ut&&(Ht=$&&$.onVnodeBeforeUnmount)&&Jo(Ht,S,ee),me&6)oe(ee.component,ne,O);else{if(me&128){ee.suspense.unmount(ne,O);return}nt&&vs(ee,null,S,"beforeUnmount"),me&64?ee.type.remove(ee,S,ne,Te,O):K&&!K.hasOnce&&(U!==$t||xe>0&&xe&64)?Re(K,S,ne,!1,!0):(U===$t&&xe&384||!P&&me&16)&&Re(Z,S,ne),O&&ve(ee)}const He=Je!=null&&Pe==null;(ut&&(Ht=$&&$.onVnodeUnmounted)||nt||He)&&Fr(()=>{Ht&&Jo(Ht,S,ee),nt&&vs(ee,null,S,"unmounted"),He&&(ee.el=null)},ne)},ve=ee=>{const{type:S,el:ne,anchor:O,transition:P}=ee;if(S===$t){ke(ne,O);return}if(S===Ka){w(ee);return}const U=()=>{o(ne),P&&!P.persisted&&P.afterLeave&&P.afterLeave()};if(ee.shapeFlag&1&&P&&!P.persisted){const{leave:$,delayLeave:Q}=P,Z=()=>$(ne,U);Q?Q(ee.el,U,Z):Z()}else U()},ke=(ee,S)=>{let ne;for(;ee!==S;)ne=h(ee),o(ee),ee=ne;o(S)},oe=(ee,S,ne)=>{const{bum:O,scope:P,job:U,subTree:$,um:Q,m:Z,a:K}=ee;Ah(Z),Ah(K),O&&Bl(O),P.stop(),U&&(U.flags|=8,be($,ee,S,ne)),Q&&Fr(Q,S),Fr(()=>{ee.isUnmounted=!0},S)},Re=(ee,S,ne,O=!1,P=!1,U=0)=>{for(let $=U;$<ee.length;$++)be(ee[$],S,ne,O,P)},je=ee=>{if(ee.shapeFlag&6)return je(ee.component.subTree);if(ee.shapeFlag&128)return ee.suspense.next();const S=h(ee.anchor||ee.el),ne=S&&S[Gg];return ne?h(ne):S};let tt=!1;const wt=(ee,S,ne)=>{let O;ee==null?S._vnode&&(be(S._vnode,null,null,!0),O=S._vnode.component):v(S._vnode||null,ee,S,null,null,null,ne),S._vnode=ee,tt||(tt=!0,L1(O),ph(),tt=!1)},Te={p:v,um:be,m:ge,r:ve,mt:E,mc:H,pc:se,pbc:V,n:je,o:e};let We,Ye;return t&&([We,Ye]=t(Te)),{render:wt,hydrate:We,createApp:w5(wt,We)}}function Fg({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 Ul({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function ub(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function Ng(e,t,n=!1){const r=e.children,o=t.children;if(Ot(r)&&Ot(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]=ra(o[i]),a.el=s.el),!n&&a.patchFlag!==-2&&Ng(s,a)),a.type===ia&&(a.patchFlag===-1&&(a=o[i]=ra(a)),a.el=s.el),a.type===Ar&&!a.el&&(a.el=s.el)}}function x5(e){const t=e.slice(),n=[0];let r,o,i,s,a;const l=e.length;for(r=0;r<l;r++){const c=e[r];if(c!==0){if(o=n[n.length-1],e[o]<c){t[r]=o,n.push(r);continue}for(i=0,s=n.length-1;i<s;)a=i+s>>1,e[n[a]]<c?i=a+1:s=a;c<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 db(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:db(t)}function Ah(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}function fb(e){if(e.placeholder)return e.placeholder;const t=e.component;return t?fb(t.subTree):null}function Ad(e,t){const n=e.props&&e.props[t];Wt(n)&&n()}function E5(e,t,n,r,o,i,s,a,l){const{p:c,o:{createElement:d}}=l,f=d("div"),h=e.suspense=hb(e,o,r,t,f,n,i,s,a,l);c(null,h.pendingBranch=e.ssContent,f,null,r,h,i,s),h.deps>0?(Ad(e,"onPending"),Ad(e,"onFallback"),c(null,e.ssFallback,t,n,r,null,i,s),Nc(h,e.ssFallback)):h.resolve(!1,!0)}function T5(e,t,n,r,o,i,s,a,{p:l,um:c,o:{createElement:d}}){const f=t.suspense=e.suspense;f.vnode=t,t.el=e.el;const h=t.ssContent,g=t.ssFallback,{activeBranch:m,pendingBranch:v,isInFallback:k,isHydrating:C}=f;if(v)f.pendingBranch=h,Ki(v,h)?(l(v,h,f.hiddenContainer,null,o,f,i,s,a),f.deps<=0?f.resolve():k&&(C||(l(m,g,n,r,o,null,i,s,a),Nc(f,g)))):(f.pendingId=Fh++,C?(f.isHydrating=!1,f.activeBranch=v):c(v,o,f),f.deps=0,f.effects.length=0,f.hiddenContainer=d("div"),k?(l(null,h,f.hiddenContainer,null,o,f,i,s,a),f.deps<=0?f.resolve():(l(m,g,n,r,o,null,i,s,a),Nc(f,g))):m&&Ki(m,h)?(l(m,h,n,r,o,f,i,s,a),f.resolve(!0)):(l(null,h,f.hiddenContainer,null,o,f,i,s,a),f.deps<=0&&f.resolve()));else if(m&&Ki(m,h))l(m,h,n,r,o,f,i,s,a),Nc(f,h);else if(Ad(t,"onPending"),f.pendingBranch=h,h.shapeFlag&512?f.pendingId=h.component.suspenseId:f.pendingId=Fh++,l(null,h,f.hiddenContainer,null,o,f,i,s,a),f.deps<=0)f.resolve();else{const{timeout:_,pendingId:b}=f;_>0?setTimeout(()=>{f.pendingId===b&&f.fallback(g)},_):_===0&&f.fallback(g)}}function hb(e,t,n,r,o,i,s,a,l,c,d=!1){const{p:f,m:h,um:g,n:m,o:{parentNode:v,remove:k}}=c;let C;const _=M5(e);_&&t&&t.pendingBranch&&(C=t.pendingId,t.deps++);const b=e.props?sd(e.props.timeout):void 0,w=i,T={vnode:e,parent:t,parentComponent:n,namespace:s,container:r,hiddenContainer:o,deps:0,pendingId:Fh++,timeout:typeof b=="number"?b:-1,activeBranch:null,isFallbackMountPending:!1,pendingBranch:null,isInFallback:!d,isHydrating:d,isUnmounted:!1,effects:[],resolve(L=!1,N=!1){const{vnode:H,activeBranch:M,pendingBranch:V,pendingId:q,effects:D,parentComponent:B,container:E,isInFallback:j}=T;let J=!1;T.isHydrating?T.isHydrating=!1:L||(J=M&&V.transition&&V.transition.mode==="out-in",J&&(M.transition.afterLeave=()=>{q===T.pendingId&&(h(V,E,i===w?m(M):i,0),vd(D),j&&H.ssFallback&&(H.ssFallback.el=null))}),M&&!T.isFallbackMountPending&&(v(M.el)===E&&(i=m(M)),g(M,B,T,!0),!J&&j&&H.ssFallback&&Fr(()=>H.ssFallback.el=null,T)),J||h(V,E,i,0)),T.isFallbackMountPending=!1,Nc(T,V),T.pendingBranch=null,T.isInFallback=!1;let Y=T.parent,se=!1;for(;Y;){if(Y.pendingBranch){Y.effects.push(...D),se=!0;break}Y=Y.parent}!se&&!J&&vd(D),T.effects=[],_&&t&&t.pendingBranch&&C===t.pendingId&&(t.deps--,t.deps===0&&!N&&t.resolve()),Ad(H,"onResolve")},fallback(L){if(!T.pendingBranch)return;const{vnode:N,activeBranch:H,parentComponent:M,container:V,namespace:q}=T;Ad(N,"onFallback");const D=m(H),B=()=>{T.isFallbackMountPending=!1,T.isInFallback&&(f(null,L,V,D,M,null,q,a,l),Nc(T,L))},E=L.transition&&L.transition.mode==="out-in";E&&(T.isFallbackMountPending=!0,H.transition.afterLeave=B),T.isInFallback=!0,g(H,M,null,!0),E||B()},move(L,N,H){T.activeBranch&&h(T.activeBranch,L,N,H),T.container=L},next(){return T.activeBranch&&m(T.activeBranch)},registerDep(L,N,H){const M=!!T.pendingBranch;M&&T.deps++;const V=L.vnode.el;L.asyncDep.catch(q=>{Vl(q,L,0)}).then(q=>{if(L.isUnmounted||T.isUnmounted||T.pendingId!==L.suspenseId)return;Gc(),L.asyncResolved=!0;const{vnode:D}=L;zg(L,q,!1),V&&(D.el=V);const B=!V&&L.subTree.el;N(L,D,v(V||L.subTree.el),V?null:m(L.subTree),T,s,H),B&&(D.placeholder=null,k(B)),_h(L,D.el),M&&--T.deps===0&&T.resolve()})},unmount(L,N){T.isUnmounted=!0,T.activeBranch&&g(T.activeBranch,n,L,N),T.pendingBranch&&g(T.pendingBranch,n,L,N)}};return T}function R5(e,t,n,r,o,i,s,a,l){const c=t.suspense=hb(t,r,n,e.parentNode,document.createElement("div"),null,o,i,s,a,!0),d=l(e,c.pendingBranch=t.ssContent,n,c,i,s);return c.deps===0&&c.resolve(!1,!0),d}function L5(e){const{shapeFlag:t,children:n}=e,r=t&32;e.ssContent=pb(r?n.default:n),e.ssFallback=r?pb(n.fallback):Gt(Ar)}function pb(e){let t;if(Wt(e)){const n=qa&&e._c;n&&(e._d=!1,ye()),e=e(),n&&(e._d=!0,t=So,gb())}return Ot(e)&&(e=S5(e)),e=Qo(e),t&&!e.dynamicChildren&&(e.dynamicChildren=t.filter(n=>n!==e)),e}function mb(e,t){t&&t.pendingBranch?Ot(e)?t.effects.push(...e):t.effects.push(e):vd(e)}function Nc(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,_h(r,o))}function M5(e){const t=e.props&&e.props.suspensible;return t!=null&&t!==!1}function ye(e=!1){Hc.push(So=e?null:[])}function gb(){Hc.pop(),So=Hc[Hc.length-1]||null}function Id(e,t=!1){qa+=e,e<0&&So&&t&&(So.hasOnce=!0)}function vb(e){return e.dynamicChildren=qa>0?So||Ol:null,gb(),qa>0&&So&&So.push(e),e}function Ie(e,t,n,r,o,i){return vb(Fe(e,t,n,r,o,i,!0))}function an(e,t,n,r,o){return vb(Gt(e,t,n,r,o,!0))}function na(e){return e?e.__v_isVNode===!0:!1}function Ki(e,t){return e.type===t.type&&e.key===t.key}function P5(e){}function Fe(e,t=null,n=null,r=0,o=null,i=e===$t?0:1,s=!1,a=!1){const l={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&dv(t),ref:t&&Fd(t),scopeId:Rd,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:co};return a?(Bg(l,n),i&128&&e.normalize(l)):n&&(l.shapeFlag|=Qn(n)?8:16),qa>0&&!s&&So&&(l.patchFlag>0||i&6)&&l.patchFlag!==32&&So.push(l),l}function D5(e,t=null,n=null,r=0,o=null,i=!1){if((!e||e===rv)&&(e=Ar),na(e)){const a=ys(e,t,!0);return n&&Bg(a,n),qa>0&&!i&&So&&(a.shapeFlag&6?So[So.indexOf(e)]=a:So.push(a)),a.patchFlag=-2,a}if(B5(e)&&(e=e.__vccOpts),t){t=yb(t);let{class:a,style:l}=t;a&&!Qn(a)&&(t.class=nn(a)),zn(l)&&(cd(l)&&!Ot(l)&&(l=Kn({},l)),t.style=bn(l))}const s=Qn(e)?1:Od(e)?128:Wg(e)?64:zn(e)?4:Wt(e)?2:0;return Fe(e,t,n,r,o,s,i,!0)}function yb(e){return e?cd(e)||av(e)?Kn({},e):e:null}function ys(e,t,n=!1,r=!1){const{props:o,ref:i,patchFlag:s,children:a,transition:l}=e,c=t?bs(o||{},t):o,d={__v_isVNode:!0,__v_skip:!0,type:e.type,props:c,key:c&&dv(c),ref:t&&t.ref?n&&i?Ot(i)?i.concat(Fd(t)):[i,Fd(t)]:Fd(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!==$t?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&&ys(e.ssContent),ssFallback:e.ssFallback&&ys(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return l&&r&&ta(d,l.clone(d)),d}function qi(e=" ",t=0){return Gt(ia,null,e,t)}function O5(e,t){const n=Gt(Ka,null,e);return n.staticCount=t,n}function mt(e="",t=!1){return t?(ye(),an(Ar,null,e)):Gt(Ar,null,e)}function Qo(e){return e==null||typeof e=="boolean"?Gt(Ar):Ot(e)?Gt($t,null,e.slice()):na(e)?ra(e):Gt(ia,null,String(e))}function ra(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:ys(e)}function Bg(e,t){let n=0;const{shapeFlag:r}=e;if(t==null)t=null;else if(Ot(t))n=16;else if(typeof t=="object")if(r&65){const o=t.default;o&&(o._c&&(o._d=!1),Bg(e,o()),o._c&&(o._d=!0));return}else{n=32;const o=t._;!o&&!av(t)?t._ctx=co:o===3&&co&&(co.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else Wt(t)?(t={default:t,_ctx:co},n=32):(t=String(t),r&64?(n=16,t=[qi(t)]):n=8);e.children=t,e.shapeFlag|=n}function bs(...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=nn([t.class,r.class]));else if(o==="style")t.style=bn([t.style,r.style]);else if(xc(o)){const i=t[o],s=r[o];s&&i!==s&&!(Ot(i)&&i.includes(s))?t[o]=i?[].concat(i,s):s:s==null&&i==null&&!td(o)&&(t[o]=s)}else o!==""&&(t[o]=r[o])}return t}function Jo(e,t,n,r=null){Ri(e,t,7,[n,r])}function bb(e,t,n){const r=e.type,o=(t?t.appContext:e.appContext)||Jb,i={uid:ew++,vnode:e,type:r,parent:t,appContext:o,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new uh(!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:ib(r,o),emitsOptions:tb(r,o),emit:null,emitted:null,propsDefaults:En,inheritAttrs:r.inheritAttrs,ctx:En,data:En,props:En,attrs:En,slots:En,refs:En,setupState:En,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=k5.bind(null,i),e.ce&&e.ce(i),i}function wb(e){return e.vnode.shapeFlag&4}function Cb(e,t=!1,n=!1){t&&$c(t);const{props:r,children:o}=e.vnode,i=wb(e);A5(e,r,i,t),Xb(e,o,n||t);const s=i?F5(e,t):void 0;return t&&$c(!1),s}function F5(e,t){const n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,Mh);const{setup:r}=n;if(r){qs();const o=e.setupContext=r.length>1?Sb(e):null,i=Kl(e),s=Dc(r,e,0,[e.props,o]),a=rh(s);if(Ys(),i(),(a||e.sp)&&!ws(e)&&Ig(e),a){if(s.then(Gc,Gc),t)return s.then(l=>{zg(e,l,t)}).catch(l=>{Vl(l,e,0)});e.asyncDep=s}else zg(e,s,t)}else kb(e,t)}function zg(e,t,n){Wt(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:zn(t)&&(e.setupState=ug(t)),kb(e,n)}function N5(e){Bh=e,fv=t=>{t.render._rc&&(t.withProxy=new Proxy(t.ctx,Ub))}}function kb(e,t,n){const r=e.type;if(!e.render){if(!t&&Bh&&!r.render){const o=r.template||Pg(e).template;if(o){const{isCustomElement:i,compilerOptions:s}=e.appContext.config,{delimiters:a,compilerOptions:l}=r,c=Kn(Kn({isCustomElement:i,delimiters:a},s),l);r.render=Bh(o,c)}}e.render=r.render||pi,fv&&fv(e)}{const o=Kl(e);qs();try{g5(e)}finally{Ys(),o()}}}function Sb(e){const t=n=>{e.exposed=n||{}};return{attrs:new Proxy(e.attrs,nw),slots:e.slots,emit:e.emit,expose:t}}function xd(e){return e.exposed?e.exposeProxy||(e.exposeProxy=new Proxy(ug(no(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in Uc)return Uc[n](e)},has(t,n){return n in t||n in Uc}})):e.proxy}function Vg(e,t=!0){return Wt(e)?e.displayName||e.name:e.name||t&&e.__name}function B5(e){return Wt(e)&&"__vccOpts"in e}function Vr(e,t,n){try{Id(-1);const r=arguments.length;return r===2?zn(t)&&!Ot(t)?na(t)?Gt(e,null,[t]):Gt(e,t):Gt(e,null,t):(r>3?n=Array.prototype.slice.call(arguments,2):r===3&&na(n)&&(n=[n]),Gt(e,t,n))}finally{Id(1)}}function z5(){}function V5(e,t,n,r){const o=n[r];if(o&&_b(o,e))return o;const i=t();return i.memo=e.slice(),i.cacheIndex=r,n[r]=i}function _b(e,t){const n=e.memo;if(n.length!=t.length)return!1;for(let r=0;r<n.length;r++)if(lo(n[r],t[r]))return!1;return qa>0&&So&&So.push(e),!0}var jg,Ab,Ib,Oo,Yi,Hl,oa,$l,Ug,Ed,Bc,zc,Td,co,Rd,xb,Hg,$g,Ha,Gg,Wg,$a,Eb,Kg,qg,Ih,Tb,Ga,Xi,Vc,mi,xh,Yg,Rb,Xg,Ld,Zg,Gl,Lb,Mb,Md,Wl,Qg,Pb,Db,Ob,Fb,Nb,Bb,zb,ws,jc,Vb,Cs,Jg,Pn,Eh,Pd,rr,Dd,ev,tv,nv,Th,jb,rv,Rh,Uc,Lh,Mh,Ub,Ph,Hb,$b,Wa,ov,Gb,Wb,Kb,iv,sv,av,qb,Dh,Oh,Yb,lv,cv,uv,Xb,Zb,Fr,Od,Fh,Qb,$t,ia,Ar,Ka,Hc,So,qa,dv,Fd,Gt,Jb,ew,uo,dr,Nh,$c,Kl,Gc,Ya,Bh,fv,tw,nw,Ce,hv,rw,ow,iw,sw,aw,j5,U5,H5,lw=_r((()=>{NI(),tg(),jg=[],Ab={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"},Ib={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"},Oo=[],Yi=-1,Hl=[],oa=null,$l=0,Ug=Promise.resolve(),Ed=null,Bc=e=>e.id==null?e.flags&2?-1:1/0:e.id,Td=[],co=null,Rd=null,xb=e=>Do,Hg=Symbol.for("v-scx"),$g=()=>{{const e=Ua(Hg);return e}},Ha=new WeakMap,Gg=Symbol("_vte"),Wg=e=>e.__isTeleport,$a=e=>e&&(e.disabled||e.disabled===""),Eb=e=>e&&(e.defer||e.defer===""),Kg=e=>typeof SVGElement<"u"&&e instanceof SVGElement,qg=e=>typeof MathMLElement=="function"&&e instanceof MathMLElement,Ih=(e,t)=>{const n=e&&e.to;return Qn(n)?t?t(n):null:n},Tb={name:"Teleport",__isTeleport:!0,process(e,t,n,r,o,i,s,a,l,c){const{mc:d,pc:f,pbc:h,o:{insert:g,querySelector:m,createText:v,createComment:k}}=c,C=$a(t.props);let{dynamicChildren:_}=t;const b=(L,N,H)=>{L.shapeFlag&16&&d(L.children,N,H,o,i,s,a,l)},w=(L=t)=>{const N=$a(L.props),H=L.target=Ih(L.props,m),M=Sg(H,L,v,g);H&&(s!=="svg"&&Kg(H)?s="svg":s!=="mathml"&&qg(H)&&(s="mathml"),o&&o.isCE&&(o.ce._teleportTargets||(o.ce._teleportTargets=new Set)).add(H),N||(b(L,H,M),wd(L,!1)))},T=L=>{const N=()=>{Ha.get(L)===N&&(Ha.delete(L),$a(L.props)&&(b(L,n,L.anchor),wd(L,!0)),w(L))};Ha.set(L,N),Fr(N,i)};if(e==null){const L=t.el=v(""),N=t.anchor=v("");if(g(L,n,r),g(N,n,r),Eb(t.props)||i&&i.pendingBranch){T(t);return}C&&(b(t,n,N),wd(t,!0)),w()}else{t.el=e.el;const L=t.anchor=e.anchor,N=Ha.get(e);if(N){N.flags|=8,Ha.delete(e),T(t);return}t.targetStart=e.targetStart;const H=t.target=e.target,M=t.targetAnchor=e.targetAnchor,V=$a(e.props),q=V?n:H,D=V?L:M;if(s==="svg"||Kg(H)?s="svg":(s==="mathml"||qg(H))&&(s="mathml"),_?(h(e.dynamicChildren,_,q,o,i,s,a),Ng(e,t,!0)):l||f(e,t,q,D,o,i,s,a,!1),C)V?t.props&&e.props&&t.props.to!==e.props.to&&(t.props.to=e.props.to):mh(t,n,L,c,1);else if((t.props&&t.props.to)!==(e.props&&e.props.to)){const B=t.target=Ih(t.props,m);B&&mh(t,B,null,c,0)}else V&&mh(t,H,M,c,1);wd(t,C)}},remove(e,t,n,{um:r,o:{remove:o}},i){const{shapeFlag:s,children:a,anchor:l,targetStart:c,targetAnchor:d,target:f,props:h}=e;let g=i||!$a(h);const m=Ha.get(e);if(m&&(m.flags|=8,Ha.delete(e),g=!1),f&&(o(c),o(d)),i&&o(l),s&16)for(let v=0;v<a.length;v++){const k=a[v];r(k,t,n,g,!!k.dynamicChildren)}},move:mh,hydrate:qI},Ga=Tb,Xi=Symbol("_leaveCb"),Vc=Symbol("_enterCb"),mi=[Function,Array],xh={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:mi,onEnter:mi,onAfterEnter:mi,onEnterCancelled:mi,onBeforeLeave:mi,onLeave:mi,onAfterLeave:mi,onLeaveCancelled:mi,onBeforeAppear:mi,onAppear:mi,onAfterAppear:mi,onAppearCancelled:mi},Yg=e=>{const t=e.subTree;return t.component?Yg(t.component):t},Rb={name:"BaseTransition",props:xh,setup(e,{slots:t}){const n=dr(),r=_g();return()=>{const o=t.default&&gh(t.default(),!0);if(!o||!o.length)return;const i=B1(o),s=Cn(e),{mode:a}=s;if(r.isLeaving)return Ag(i);const l=V1(i);if(!l)return Ag(i);let c=Oc(l,s,r,n,f=>c=f);l.type!==Ar&&ta(l,c);let d=n.subTree&&V1(n.subTree);if(d&&d.type!==Ar&&!Ki(d,l)&&Yg(n).type!==Ar){let f=Oc(d,s,r,n);if(ta(d,f),a==="out-in"&&l.type!==Ar)return r.isLeaving=!0,f.afterLeave=()=>{r.isLeaving=!1,n.job.flags&8||n.update(),delete f.afterLeave,d=void 0},Ag(i);a==="in-out"&&l.type!==Ar?f.delayLeave=(h,g,m)=>{const v=z1(r,d);v[String(d.key)]=d,h[Xi]=()=>{g(),h[Xi]=void 0,delete c.delayedLeave,d=void 0},c.delayedLeave=()=>{m(),delete c.delayedLeave,d=void 0}}:d=void 0}else d&&(d=void 0);return i}}},Xg=Rb,Ld=new WeakMap,Zg=!1,Gl=()=>{Zg||(console.error("Hydration completed but contains mismatches."),Zg=!0)},Lb=e=>e.namespaceURI.includes("svg")&&e.tagName!=="foreignObject",Mb=e=>e.namespaceURI.includes("MathML"),Md=e=>{if(e.nodeType===1){if(Lb(e))return"svg";if(Mb(e))return"mathml"}},Wl=e=>e.nodeType===8,Qg="data-allow-mismatch",Pb={0:"text",1:"children",2:"class",3:"style",4:"attribute"},Db=ad().requestIdleCallback||(e=>setTimeout(e,1)),Ob=ad().cancelIdleCallback||(e=>clearTimeout(e)),Fb=(e=1e4)=>t=>{const n=Db(t,{timeout:e});return()=>Ob(n)},Nb=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(QI(o))return t(),r.disconnect(),!1;r.observe(o)}}),()=>r.disconnect()},Bb=e=>t=>{if(e){const n=matchMedia(e);if(n.matches)t();else return n.addEventListener("change",t,{once:!0}),()=>n.removeEventListener("change",t)}},zb=(e=[])=>(t,n)=>{Qn(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},ws=e=>!!e.type.__asyncLoader,jc=e=>e.type.__isKeepAlive,Vb={name:"KeepAlive",__isKeepAlive:!0,props:{include:[String,RegExp,Array],exclude:[String,RegExp,Array],max:[String,Number]},setup(e,{slots:t}){const n=dr(),r=n.ctx;if(!r.renderer)return()=>{const _=t.default&&t.default();return _&&_.length===1?_[0]:_};const o=new Map,i=new Set;let s=null;const a=n.suspense,{renderer:{p:l,m:c,um:d,o:{createElement:f}}}=r,h=f("div");r.activate=(_,b,w,T,L)=>{const N=_.component;c(_,b,w,0,a),l(N.vnode,_,b,w,N,a,T,_.slotScopeIds,L),Fr(()=>{N.isDeactivated=!1,N.a&&Bl(N.a);const H=_.props&&_.props.onVnodeMounted;H&&Jo(H,N.parent,_)},a)},r.deactivate=_=>{const b=_.component;Ah(b.m),Ah(b.a),c(_,h,null,1,a),Fr(()=>{b.da&&Bl(b.da);const w=_.props&&_.props.onVnodeUnmounted;w&&Jo(w,b.parent,_),b.isDeactivated=!0},a)};function g(_){Tg(_),d(_,n,a,!0)}function m(_){o.forEach((b,w)=>{const T=Vg(ws(b)?b.type.__asyncResolved||{}:b.type);T&&!_(T)&&v(w)})}function v(_){const b=o.get(_);b&&(!s||!Ki(b,s))?g(b):s&&Tg(s),o.delete(_),i.delete(_)}Ft(()=>[e.include,e.exclude],([_,b])=>{_&&m(w=>Cd(_,w)),b&&m(w=>!Cd(b,w))},{flush:"post",deep:!0});let k=null;const C=()=>{k!=null&&(Od(n.subTree.type)?Fr(()=>{o.set(k,bh(n.subTree))},n.subTree.suspense):o.set(k,bh(n.subTree)))};return Pn(C),Pd(C),rr(()=>{o.forEach(_=>{const{subTree:b,suspense:w}=n,T=bh(b);if(_.type===T.type&&_.key===T.key){Tg(T);const L=T.component.da;L&&Fr(L,w);return}g(_)})}),()=>{if(k=null,!t.default)return s=null;const _=t.default(),b=_[0];if(_.length>1)return s=null,_;if(!na(b)||!(b.shapeFlag&4)&&!(b.shapeFlag&128))return s=null,b;let w=bh(b);if(w.type===Ar)return s=null,w;const T=w.type,L=Vg(ws(w)?w.type.__asyncResolved||{}:T),{include:N,exclude:H,max:M}=e;if(N&&(!L||!Cd(N,L))||H&&L&&Cd(H,L))return w.shapeFlag&=-257,s=w,b;const V=w.key==null?T:w.key,q=o.get(V);return w.el&&(w=ys(w),b.shapeFlag&128&&(b.ssContent=w)),k=V,q?(w.el=q.el,w.component=q.component,w.transition&&ta(w,w.transition),w.shapeFlag|=512,i.delete(V),i.add(V)):(i.add(V),M&&i.size>parseInt(M,10)&&v(i.values().next().value)),w.shapeFlag|=256,s=w,Od(b.type)?b:w}}},Cs=e=>(t,n=uo)=>{(!Ya||e==="sp")&&wh(e,(...r)=>t(...r),n)},Jg=Cs("bm"),Pn=Cs("m"),Eh=Cs("bu"),Pd=Cs("u"),rr=Cs("bum"),Dd=Cs("um"),ev=Cs("sp"),tv=Cs("rtg"),nv=Cs("rtc"),Th="components",jb="directives",rv=Symbol.for("v-ndc"),Rh=e=>e?wb(e)?xd(e):Rh(e.parent):null,Uc=Kn(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=>Rh(e.parent),$root:e=>Rh(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>Pg(e),$forceUpdate:e=>e.f||(e.f=()=>{kg(e.update)}),$nextTick:e=>e.n||(e.n=_t.bind(e.proxy)),$watch:e=>KI.bind(e)}),Lh=(e,t)=>e!==En&&!e.__isScriptSetup&&Bn(e,t),Mh={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 h=s[t];if(h!==void 0)switch(h){case 1:return r[t];case 2:return o[t];case 4:return n[t];case 3:return i[t]}else{if(Lh(r,t))return s[t]=1,r[t];if(o!==En&&Bn(o,t))return s[t]=2,o[t];if(Bn(i,t))return s[t]=3,i[t];if(n!==En&&Bn(n,t))return s[t]=4,n[t];Ph&&(s[t]=0)}}const c=Uc[t];let d,f;if(c)return t==="$attrs"&&Mo(e.attrs,"get",""),c(e);if((d=a.__cssModules)&&(d=d[t]))return d;if(n!==En&&Bn(n,t))return s[t]=4,n[t];if(f=l.config.globalProperties,Bn(f,t))return f[t]},set({_:e},t,n){const{data:r,setupState:o,ctx:i}=e;return Lh(o,t)?(o[t]=n,!0):r!==En&&Bn(r,t)?(r[t]=n,!0):Bn(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!==En&&a[0]!=="$"&&Bn(e,a)||Lh(t,a)||Bn(i,a)||Bn(r,a)||Bn(Uc,a)||Bn(o.config.globalProperties,a)||(l=s.__cssModules)&&l[a])},defineProperty(e,t,n){return n.get!=null?e._.accessCache[t]=0:Bn(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}},Ub=Kn({},Mh,{get(e,t){if(t!==Symbol.unscopables)return Mh.get(e,t,e)},has(e,t){return t[0]!=="_"&&!G2(t)}}),Ph=!0,Hb={data:Q1,props:J1,emits:J1,methods:_d,computed:_d,beforeCreate:Ho,created:Ho,beforeMount:Ho,mounted:Ho,beforeUpdate:Ho,updated:Ho,beforeDestroy:Ho,beforeUnmount:Ho,destroyed:Ho,unmounted:Ho,activated:Ho,deactivated:Ho,errorCaptured:Ho,serverPrefetch:Ho,components:_d,directives:_d,watch:b5,provide:Q1,inject:y5},$b=0,Wa=null,ov=(e,t)=>t==="modelValue"||t==="model-value"?e.modelModifiers:e[`${t}Modifiers`]||e[`${Or(t)}Modifiers`]||e[`${Uo(t)}Modifiers`],Gb=new WeakMap,Wb=e=>{let t;for(const n in e)(n==="class"||n==="style"||xc(n))&&((t||(t={}))[n]=e[n]);return t},Kb=(e,t)=>{const n={};for(const r in e)(!td(r)||!(r.slice(9)in t))&&(n[r]=e[r]);return n},iv={},sv=()=>Object.create(iv),av=e=>Object.getPrototypeOf(e)===iv,qb=new WeakMap,Dh=e=>e==="_"||e==="_ctx"||e==="$stable",Oh=e=>Ot(e)?e.map(Qo):[Qo(e)],Yb=(e,t,n)=>{if(t._n)return t;const r=Do((...o)=>Oh(t(...o)),n);return r._c=!1,r},lv=(e,t,n)=>{const r=e._ctx;for(const o in e){if(Dh(o))continue;const i=e[o];if(Wt(i))t[o]=Yb(o,i,r);else if(i!=null){const s=Oh(i);t[o]=()=>s}}},cv=(e,t)=>{const n=Oh(t);e.slots.default=()=>n},uv=(e,t,n)=>{for(const r in t)(n||!Dh(r))&&(e[r]=t[r])},Xb=(e,t,n)=>{const r=e.slots=sv();if(e.vnode.shapeFlag&32){const o=t._;o?(uv(r,t,n),n&&Zm(r,"_",o,!0)):lv(t,r)}else t&&cv(e,t)},Zb=(e,t,n)=>{const{vnode:r,slots:o}=e;let i=!0,s=En;if(r.shapeFlag&32){const a=t._;a?n&&a===1?i=!1:uv(o,t,n):(i=!t.$stable,lv(t,o)),s=t}else t&&(cv(e,t),s={default:1});if(i)for(const a in o)!Dh(a)&&s[a]==null&&delete o[a]},Fr=mb,Od=e=>e.__isSuspense,Fh=0,Qb={name:"Suspense",__isSuspense:!0,process(e,t,n,r,o,i,s,a,l,c){if(e==null)E5(t,n,r,o,i,s,a,l,c);else{if(i&&i.deps>0&&!e.suspense.isInFallback){t.suspense=e.suspense,t.suspense.vnode=t,t.el=e.el;return}T5(e,t,n,r,o,s,a,l,c)}},hydrate:R5,normalize:L5},$t=Symbol.for("v-fgt"),ia=Symbol.for("v-txt"),Ar=Symbol.for("v-cmt"),Ka=Symbol.for("v-stc"),Hc=[],So=null,qa=1,dv=({key:e})=>e??null,Fd=({ref:e,ref_key:t,ref_for:n})=>(typeof e=="number"&&(e=""+e),e!=null?Qn(e)||cr(e)||Wt(e)?{i:co,r:e,k:t,f:!!n}:e:null),Gt=D5,Jb=eb(),ew=0,uo=null,dr=()=>uo||co;{const e=ad(),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)}};Nh=t("__VUE_INSTANCE_SETTERS__",n=>uo=n),$c=t("__VUE_SSR_SETTERS__",n=>Ya=n)}Kl=e=>{const t=uo;return Nh(e),e.scope.on(),()=>{e.scope.off(),Nh(t)}},Gc=()=>{uo&&uo.scope.off(),Nh(null)},Ya=!1,tw=()=>!Bh,nw={get(e,t){return Mo(e,"get",""),e[t]}},Ce=(e,t)=>DI(e,t,Ya),hv="3.5.32",rw=pi,ow=Ib,iw=zc,sw=P1,aw={createComponentInstance:bb,setupComponent:Cb,renderComponentRoot:Sh,setCurrentRenderingInstance:yd,isVNode:na,normalizeVNode:Qo,getComponentPublicInstance:xd,ensureValidVNode:Mg,pushWarningContext:BI,popWarningContext:zI},j5=null,U5=null,H5=null}));function cw(e){const t={};for(const D in e)D in Cv||(t[D]=e[D]);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:c=s,appearToClass:d=a,leaveFromClass:f=`${n}-leave-from`,leaveActiveClass:h=`${n}-leave-active`,leaveToClass:g=`${n}-leave-to`}=e,m=$5(o),v=m&&m[0],k=m&&m[1],{onBeforeEnter:C,onEnter:_,onEnterCancelled:b,onLeave:w,onLeaveCancelled:T,onBeforeAppear:L=C,onAppear:N=_,onAppearCancelled:H=b}=t,M=(D,B,E,j)=>{D._enterCancelled=j,Xa(D,B?d:a),Xa(D,B?c:s),E&&E()},V=(D,B)=>{D._isLeaving=!1,Xa(D,f),Xa(D,g),Xa(D,h),B&&B()},q=D=>(B,E)=>{const j=D?N:_,J=()=>M(B,D,E);Za(j,[B,J]),uw(()=>{Xa(B,D?l:i),ks(B,D?d:a),Sv(j)||dw(B,r,v,J)})};return Kn(t,{onBeforeEnter(D){Za(C,[D]),ks(D,i),ks(D,s)},onBeforeAppear(D){Za(L,[D]),ks(D,l),ks(D,c)},onEnter:q(!1),onAppear:q(!0),onLeave(D,B){D._isLeaving=!0;const E=()=>V(D,B);ks(D,f),D._enterCancelled?(ks(D,h),mv(D)):(mv(D),ks(D,h)),uw(()=>{D._isLeaving&&(Xa(D,f),ks(D,g),Sv(w)||dw(D,r,k,E))}),Za(w,[D,E])},onEnterCancelled(D){M(D,!1,void 0,!0),Za(b,[D])},onAppearCancelled(D){M(D,!0,void 0,!0),Za(H,[D])},onLeaveCancelled(D){V(D),Za(T,[D])}})}function $5(e){if(e==null)return null;if(zn(e))return[pv(e.enter),pv(e.leave)];{const t=pv(e);return[t,t]}}function pv(e){return sd(e)}function ks(e,t){t.split(/\s+/).forEach(n=>n&&e.classList.add(n)),(e[ql]||(e[ql]=new Set)).add(t)}function Xa(e,t){t.split(/\s+/).forEach(r=>r&&e.classList.remove(r));const n=e[ql];n&&(n.delete(t),n.size||(e[ql]=void 0))}function uw(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}function dw(e,t,n,r){const o=e._endId=++Pw,i=()=>{o===e._endId&&r()};if(n!=null)return setTimeout(i,n);const{type:s,timeout:a,propCount:l}=fw(e,t);if(!s)return r();const c=s+"end";let d=0;const f=()=>{e.removeEventListener(c,h),i()},h=g=>{g.target===e&&++d>=l&&f()};setTimeout(()=>{d<l&&f()},a+1),e.addEventListener(c,h)}function fw(e,t){const n=window.getComputedStyle(e),r=m=>(n[m]||"").split(", "),o=r(`${aa}Delay`),i=r(`${aa}Duration`),s=hw(o,i),a=r(`${Kc}Delay`),l=r(`${Kc}Duration`),c=hw(a,l);let d=null,f=0,h=0;t===aa?s>0&&(d=aa,f=s,h=i.length):t===Kc?c>0&&(d=Kc,f=c,h=l.length):(f=Math.max(s,c),d=f>0?s>c?aa:Kc:null,h=d?d===aa?i.length:l.length:0);const g=d===aa&&/\b(?:transform|all)(?:,|$)/.test(r(`${aa}Property`).toString());return{type:d,timeout:f,propCount:h,hasTransform:g}}function hw(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((n,r)=>pw(n)+pw(e[r])))}function pw(e){return e==="auto"?0:Number(e.slice(0,-1).replace(",","."))*1e3}function mv(e){return(e?e.ownerDocument:document).body.offsetHeight}function G5(e,t,n){const r=e[ql];r&&(t=(t?[t,...r]:[...r]).join(" ")),t==null?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}function Nd(e,t){e.style.display=t?e[Bd]:"none",e[_v]=!t}function W5(){Av.getSSRProps=({value:e})=>{if(!e)return{style:{display:"none"}}}}function K5(e){const t=dr();if(!t)return;const n=t.ut=(o=e(t.proxy))=>{Array.from(document.querySelectorAll(`[data-v-owner="${t.uid}"]`)).forEach(i=>zh(i,o))},r=()=>{const o=e(t.proxy);t.ce?zh(t.ce,o):gv(t.subTree,o),n(o)};Eh(()=>{vd(r)}),Pn(()=>{Ft(r,pi,{flush:"post"});const o=new MutationObserver(r);o.observe(t.subTree.el.parentNode,{childList:!0}),Dd(()=>o.disconnect())})}function gv(e,t){if(e.shapeFlag&128){const n=e.suspense;e=n.activeBranch,n.pendingBranch&&!n.isHydrating&&n.effects.push(()=>{gv(n.activeBranch,t)})}for(;e.component;)e=e.component.subTree;if(e.shapeFlag&1&&e.el)zh(e.el,t);else if(e.type===$t)e.children.forEach(n=>gv(n,t));else if(e.type===Ka){let{el:n,anchor:r}=e;for(;n&&(zh(n,t),n!==r);)n=n.nextSibling}}function zh(e,t){if(e.nodeType===1){const n=e.style;let r="";for(const o in t){const i=wI(t[o]);n.setProperty(`--${o}`,i),r+=`--${o}: ${i};`}n[Iv]=r}}function q5(e,t,n){const r=e.style,o=Qn(n);let i=!1;if(n&&!o){if(t)if(Qn(t))for(const s of t.split(";")){const a=s.slice(0,s.indexOf(":")).trim();n[a]==null&&Vh(r,a,"")}else for(const s in t)n[s]==null&&Vh(r,s,"");for(const s in n)s==="display"&&(i=!0),Vh(r,s,n[s])}else if(o){if(t!==n){const s=r[Iv];s&&(n+=";"+s),r.cssText=n,i=Dw.test(n)}}else t&&e.removeAttribute("style");Bd in e&&(e[Bd]=i?r.display:"",e[_v]&&(r.display="none"))}function Vh(e,t,n){if(Ot(n))n.forEach(r=>Vh(e,t,r));else if(n==null&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const r=Y5(e,t);xv.test(n)?e.setProperty(Uo(r),n.replace(xv,""),"important"):e[r]=n}}function Y5(e,t){const n=$h[t];if(n)return n;let r=Or(t);if(r!=="filter"&&r in e)return $h[t]=r;r=Ec(r);for(let o=0;o<Ev.length;o++){const i=Ev[o]+r;if(i in e)return $h[t]=i}return t}function mw(e,t,n,r,o,i=Y2(t)){r&&t.startsWith("xlink:")?n==null?e.removeAttributeNS(Tv,t.slice(6,t.length)):e.setAttributeNS(Tv,t,n):n==null||i&&!B2(n)?e.removeAttribute(t):e.setAttribute(t,i?"":Xo(n)?String(n):n)}function gw(e,t,n,r,o){if(t==="innerHTML"||t==="textContent"){n!=null&&(e[t]=t==="innerHTML"?yv(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=B2(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 sa(e,t,n,r){e.addEventListener(t,n,r)}function X5(e,t,n,r){e.removeEventListener(t,n,r)}function Z5(e,t,n,r,o=null){const i=e[Rv]||(e[Rv]={}),s=i[t];if(r&&s)s.value=r;else{const[a,l]=Q5(t);r?sa(e,a,i[t]=J5(r,o),l):s&&(X5(e,a,s,l),i[t]=void 0)}}function Q5(e){let t;if(Lv.test(e)){t={};let n;for(;n=e.match(Lv);)e=e.slice(0,e.length-n[0].length),t[n[0].toLowerCase()]=!0}return[e[2]===":"?e.slice(3):Uo(e.slice(2)),t]}function J5(e,t){const n=r=>{if(!r._vts)r._vts=Date.now();else if(r._vts<=n.attached)return;Ri(e6(r,n.value),t,5,[r])};return n.value=e,n.attached=Fw(),n}function e6(e,t){if(Ot(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 t6(e,t,n,r){if(r)return!!(t==="innerHTML"||t==="textContent"||t in e&&Mv(t)&&Wt(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 Mv(t)&&Qn(n)?!1:t in e}function n6(e,t){const n=e._def.props;if(!n)return!1;const r=Or(t);return Array.isArray(n)?n.some(o=>Or(o)===r):Object.keys(n).some(o=>Or(o)===r)}function vw(e,t,n){let r=jl(e,t);nd(r)&&(r=Kn({},r,t));class o extends Ov{constructor(s){super(r,s,n)}}return o.def=r,o}function yw(e){const t=dr(),n=t&&t.ce;return n||null}function r6(){const e=yw();return e&&e.shadowRoot}function o6(e="$style"){{const t=dr();if(!t)return En;const n=t.type.__cssModules;if(!n)return En;const r=n[e];return r||En}}function i6(e){const t=e.el;t[zd]&&t[zd](),t[Bv]&&t[Bv]()}function s6(e){Nv.set(e,bw(e.el))}function a6(e){const t=Fv.get(e),n=Nv.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,c=1;return i.offsetWidth&&(l=a.width/i.offsetWidth),i.offsetHeight&&(c=a.height/i.offsetHeight),(!Number.isFinite(l)||l===0)&&(l=1),(!Number.isFinite(c)||c===0)&&(c=1),Math.abs(l-1)<.01&&(l=1),Math.abs(c-1)<.01&&(c=1),s.transform=s.webkitTransform=`translate(${r/l}px,${o/c}px)`,s.transitionDuration="0s",e}}function bw(e){const t=e.getBoundingClientRect();return{left:t.left,top:t.top}}function l6(e,t,n){const r=e.cloneNode(),o=e[ql];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}=fw(r);return i.removeChild(r),s}function c6(e){e.target.composing=!0}function ww(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}function Cw(e,t,n){return t&&(e=e.trim()),n&&(e=id(e)),e}function kw(e,{value:t,oldValue:n},r){e._modelValue=t;let o;if(Ot(t))o=th(t,r.props.value)>-1;else if(za(t))o=t.has(r.props.value);else{if(t===n)return;o=Ks(t,_w(e,!0))}e.checked!==o&&(e.checked=o)}function Sw(e,t){const n=e.multiple,r=Ot(t);if(!(n&&!r&&!za(t))){for(let o=0,i=e.options.length;o<i;o++){const s=e.options[o],a=Wc(s);if(n)if(r){const l=typeof a;l==="string"||l==="number"?s.selected=t.some(c=>String(c)===String(a)):s.selected=th(t,a)>-1}else s.selected=t.has(a);else if(Ks(Wc(s),t)){e.selectedIndex!==o&&(e.selectedIndex=o);return}}!n&&e.selectedIndex!==-1&&(e.selectedIndex=-1)}}function Wc(e){return"_value"in e?e._value:e.value}function _w(e,t){const n=t?"_trueValue":"_falseValue";return n in e?e[n]:t}function Aw(e,t){switch(e){case"SELECT":return zv;case"TEXTAREA":return Li;default:switch(t){case"checkbox":return Wh;case"radio":return Kh;default:return Li}}}function jh(e,t,n,r,o){const i=Aw(e.tagName,n.props&&n.props.type)[o];i&&i(e,t,n,r)}function u6(){Li.getSSRProps=({value:e})=>({value:e}),Kh.getSSRProps=({value:e},t)=>{if(t.props&&Ks(t.props.value,e))return{checked:!0}},Wh.getSSRProps=({value:e},t)=>{if(Ot(e)){if(t.props&&th(e,t.props.value)>-1)return{checked:!0}}else if(za(e)){if(t.props&&e.has(t.props.value))return{checked:!0}}else if(e)return{checked:!0}},Vv.getSSRProps=(e,t)=>{if(typeof t.type!="string")return;const n=Aw(t.type.toUpperCase(),t.props&&t.props.type);if(n.getSSRProps)return n.getSSRProps(e,t)}}function Iw(){return Vd||(Vd=ab(jv))}function xw(){return Vd=Uv?Vd:lb(jv),Uv=!0,Vd}function Ew(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function Tw(e){return Qn(e)?document.querySelector(e):e}var Uh,vv,yv,Rw,Lw,Ss,bv,wv,aa,Kc,ql,Cv,kv,Mw,Hh,Za,Sv,Pw,Bd,_v,Av,Iv,Dw,xv,Ev,$h,Tv,Rv,Lv,Gh,Ow,Fw,Mv,Pv,Dv,Nw,Bw,Ov,Fv,Nv,zd,Bv,zw,Vw,la,gi,Li,Wh,Kh,zv,Vv,jw,Uw,en,Hw,ei,jv,Vd,Uv,Hv,$w,Yl,$v,Gv,Gw,d6=_r((()=>{if(lw(),lw(),tg(),Uh=void 0,vv=typeof window<"u"&&window.trustedTypes,vv)try{Uh=vv.createPolicy("vue",{createHTML:e=>e})}catch{}yv=Uh?e=>Uh.createHTML(e):e=>e,Rw="http://www.w3.org/2000/svg",Lw="http://www.w3.org/1998/Math/MathML",Ss=typeof document<"u"?document:null,bv=Ss&&Ss.createElement("template"),wv={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"?Ss.createElementNS(Rw,e):t==="mathml"?Ss.createElementNS(Lw,e):n?Ss.createElement(e,{is:n}):Ss.createElement(e);return e==="select"&&r&&r.multiple!=null&&o.setAttribute("multiple",r.multiple),o},createText:e=>Ss.createTextNode(e),createComment:e=>Ss.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>Ss.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{bv.innerHTML=yv(r==="svg"?`<svg>${e}</svg>`:r==="mathml"?`<math>${e}</math>`:e);const a=bv.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]}},aa="transition",Kc="animation",ql=Symbol("_vtc"),Cv={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},kv=Kn({},xh,Cv),Mw=e=>(e.displayName="Transition",e.props=kv,e),Hh=Mw((e,{slots:t})=>Vr(Xg,cw(e),t)),Za=(e,t=[])=>{Ot(e)?e.forEach(n=>n(...t)):e&&e(...t)},Sv=e=>e?Ot(e)?e.some(t=>t.length>1):e.length>1:!1,Pw=0,Bd=Symbol("_vod"),_v=Symbol("_vsh"),Av={name:"show",beforeMount(e,{value:t},{transition:n}){e[Bd]=e.style.display==="none"?"":e.style.display,n&&t?n.beforeEnter(e):Nd(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),Nd(e,!0),r.enter(e)):r.leave(e,()=>{Nd(e,!1)}):Nd(e,t))},beforeUnmount(e,{value:t}){Nd(e,t)}},Iv=Symbol(""),Dw=/(?:^|;)\s*display\s*:/,xv=/\s*!important$/,Ev=["Webkit","Moz","ms"],$h={},Tv="http://www.w3.org/1999/xlink",Rv=Symbol("_vei"),Lv=/(?:Once|Passive|Capture)$/,Gh=0,Ow=Promise.resolve(),Fw=()=>Gh||(Ow.then(()=>Gh=0),Gh=Date.now()),Mv=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,Pv=(e,t,n,r,o,i)=>{const s=o==="svg";t==="class"?G5(e,r,s):t==="style"?q5(e,n,r):xc(t)?td(t)||Z5(e,t,n,r,i):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):t6(e,t,r,s))?(gw(e,t,r),!e.tagName.includes("-")&&(t==="value"||t==="checked"||t==="selected")&&mw(e,t,r,s,i,t!=="value")):e._isVueCE&&(n6(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!Qn(r)))?gw(e,Or(t),r,i,t):(t==="true-value"?e._trueValue=r:t==="false-value"&&(e._falseValue=r),mw(e,t,r,s))},Dv={},Nw=((e,t)=>vw(e,t,$v)),Bw=typeof HTMLElement<"u"?HTMLElement:class{},Ov=class ZA extends Bw{constructor(t,n={},r=Yl){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!==Yl?this._root=this.shadowRoot:t.shadowRoot!==!1?(this.attachShadow(Kn({},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 ZA){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,_t(()=>{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&&!Ot(i))for(const l in i){const c=i[l];(c===Number||c&&c.type===Number)&&(l in this._props&&(this._props[l]=sd(this._props[l])),(a||(a=Object.create(null)))[Or(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)Bn(this,r)||Object.defineProperty(this,r,{get:()=>Xe(n[r])})}_resolveProps(t){const{props:n}=t,r=Ot(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(Or))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):Dv;const o=Or(t);n&&this._numberProps&&this._numberProps[o]&&(r=sd(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===Dv?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(Uo(t),""):typeof n=="string"||typeof n=="number"?this.setAttribute(Uo(t),n+""):n||this.removeAttribute(Uo(t)),i&&i.observe(this,{attributes:!0})}}_update(){const t=this._createVNode();this._app&&(t.appContext=this._app._context),Hv(t,this._root)}_createVNode(){const t={};this.shadowRoot||(t.onVnodeMounted=t.onVnodeUpdated=this._renderSlots.bind(this));const n=Gt(this._def,Kn(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,nd(s[0])?Kn({detail:s},s[0]):{detail:s}))};r.emit=(i,...s)=>{o(i,s),Uo(i)!==i&&o(Uo(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 c=document.createElement("style");o&&c.setAttribute("nonce",o),c.textContent=t[l],i.insertBefore(c,a||s),a=c,l===0&&(r||this._styleAnchors.set(this._def,c),n&&this._styleAnchors.set(n,c))}}_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 c=n+"-s",d=document.createTreeWalker(l,1);l.setAttribute(c,"");let f;for(;f=d.nextNode();)f.setAttribute(c,"")}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){}},Fv=new WeakMap,Nv=new WeakMap,zd=Symbol("_moveCb"),Bv=Symbol("_enterCb"),zw=e=>(delete e.props.mode,e),Vw=zw({name:"TransitionGroup",props:Kn({},kv,{tag:String,moveClass:String}),setup(e,{slots:t}){const n=dr(),r=_g();let o,i;return Pd(()=>{if(!o.length)return;const s=e.moveClass||`${e.name||"v"}-move`;if(!l6(o[0].el,n.vnode.el,s)){o=[];return}o.forEach(i6),o.forEach(s6);const a=o.filter(a6);mv(n.vnode.el),a.forEach(l=>{const c=l.el,d=c.style;ks(c,s),d.transform=d.webkitTransform=d.transitionDuration="";const f=c[zd]=h=>{h&&h.target!==c||(!h||h.propertyName.endsWith("transform"))&&(c.removeEventListener("transitionend",f),c[zd]=null,Xa(c,s))};c.addEventListener("transitionend",f)}),o=[]}),()=>{const s=Cn(e),a=cw(s);let l=s.tag||$t;if(o=[],i)for(let c=0;c<i.length;c++){const d=i[c];d.el&&d.el instanceof Element&&(o.push(d),ta(d,Oc(d,a,r,n)),Fv.set(d,bw(d.el)))}i=t.default?gh(t.default()):[];for(let c=0;c<i.length;c++){const d=i[c];d.key!=null&&ta(d,Oc(d,a,r,n))}return Gt(l,null,i)}}}),la=e=>{const t=e.props["onUpdate:modelValue"]||!1;return Ot(t)?n=>Bl(t,n):t},gi=Symbol("_assign"),Li={created(e,{modifiers:{lazy:t,trim:n,number:r}},o){e[gi]=la(o);const i=r||o.props&&o.props.type==="number";sa(e,t?"change":"input",s=>{s.target.composing||e[gi](Cw(e.value,n,i))}),(n||i)&&sa(e,"change",()=>{e.value=Cw(e.value,n,i)}),t||(sa(e,"compositionstart",c6),sa(e,"compositionend",ww),sa(e,"change",ww))},mounted(e,{value:t}){e.value=t??""},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:r,trim:o,number:i}},s){if(e[gi]=la(s),e.composing)return;const a=(i||e.type==="number")&&!/^0\d/.test(e.value)?id(e.value):e.value,l=t??"";if(a===l)return;const c=e.getRootNode();(c instanceof Document||c instanceof ShadowRoot)&&c.activeElement===e&&e.type!=="range"&&(r&&t===n||o&&e.value.trim()===l)||(e.value=l)}},Wh={deep:!0,created(e,t,n){e[gi]=la(n),sa(e,"change",()=>{const r=e._modelValue,o=Wc(e),i=e.checked,s=e[gi];if(Ot(r)){const a=th(r,o),l=a!==-1;if(i&&!l)s(r.concat(o));else if(!i&&l){const c=[...r];c.splice(a,1),s(c)}}else if(za(r)){const a=new Set(r);i?a.add(o):a.delete(o),s(a)}else s(_w(e,i))})},mounted:kw,beforeUpdate(e,t,n){e[gi]=la(n),kw(e,t,n)}},Kh={created(e,{value:t},n){e.checked=Ks(t,n.props.value),e[gi]=la(n),sa(e,"change",()=>{e[gi](Wc(e))})},beforeUpdate(e,{value:t,oldValue:n},r){e[gi]=la(r),t!==n&&(e.checked=Ks(t,r.props.value))}},zv={deep:!0,created(e,{value:t,modifiers:{number:n}},r){const o=za(t);sa(e,"change",()=>{const i=Array.prototype.filter.call(e.options,s=>s.selected).map(s=>n?id(Wc(s)):Wc(s));e[gi](e.multiple?o?new Set(i):i:i[0]),e._assigning=!0,_t(()=>{e._assigning=!1})}),e[gi]=la(r)},mounted(e,{value:t}){Sw(e,t)},beforeUpdate(e,t,n){e[gi]=la(n)},updated(e,{value:t}){e._assigning||Sw(e,t)}},Vv={created(e,t,n){jh(e,t,n,null,"created")},mounted(e,t,n){jh(e,t,n,null,"mounted")},beforeUpdate(e,t,n,r){jh(e,t,n,r,"beforeUpdate")},updated(e,t,n,r){jh(e,t,n,r,"updated")}},jw=["ctrl","shift","alt","meta"],Uw={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)=>jw.some(n=>e[`${n}Key`]&&!t.includes(n))},en=(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=Uw[t[s]];if(a&&a(o,t))return}return e(o,...i)}))},Hw={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},ei=(e,t)=>{const n=e._withKeys||(e._withKeys={}),r=t.join(".");return n[r]||(n[r]=(o=>{if(!("key"in o))return;const i=Uo(o.key);if(t.some(s=>s===i||Hw[s]===i))return e(o)}))},jv=Kn({patchProp:Pv},wv),Uv=!1,Hv=((...e)=>{Iw().render(...e)}),$w=((...e)=>{xw().hydrate(...e)}),Yl=((...e)=>{const t=Iw().createApp(...e),{mount:n}=t;return t.mount=r=>{const o=Tw(r);if(!o)return;const i=t._component;!Wt(i)&&!i.render&&!i.template&&(i.template=o.innerHTML),o.nodeType===1&&(o.textContent="");const s=n(o,!1,Ew(o));return o instanceof Element&&(o.removeAttribute("v-cloak"),o.setAttribute("data-v-app","")),s},t}),$v=((...e)=>{const t=xw().createApp(...e),{mount:n}=t;return t.mount=r=>{const o=Tw(r);if(o)return n(o,!0,Ew(o))},t}),Gv=!1,Gw=()=>{Gv||(Gv=!0,u6(),W5())}})),f6=Ju({BaseTransition:()=>Xg,BaseTransitionPropsValidators:()=>xh,Comment:()=>Ar,DeprecationTypes:()=>null,EffectScope:()=>uh,ErrorCodes:()=>Ab,ErrorTypeStrings:()=>ow,Fragment:()=>$t,KeepAlive:()=>Vb,ReactiveEffect:()=>Lc,Static:()=>Ka,Suspense:()=>Qb,Teleport:()=>Ga,Text:()=>ia,TrackOpTypes:()=>E1,Transition:()=>Hh,TransitionGroup:()=>Vw,TriggerOpTypes:()=>T1,VueElement:()=>Ov,assertNumber:()=>VI,callWithAsyncErrorHandling:()=>Ri,callWithErrorHandling:()=>Dc,camelize:()=>Or,capitalize:()=>Ec,cloneVNode:()=>ys,compatUtils:()=>null,compile:()=>Ww,computed:()=>Ce,createApp:()=>Yl,createBlock:()=>an,createCommentVNode:()=>mt,createElementBlock:()=>Ie,createElementVNode:()=>Fe,createHydrationRenderer:()=>lb,createPropsRestProxy:()=>p5,createRenderer:()=>ab,createSSRApp:()=>$v,createSlots:()=>n5,createStaticVNode:()=>O5,createTextVNode:()=>qi,createVNode:()=>Gt,customRef:()=>s1,defineAsyncComponent:()=>H1,defineComponent:()=>jl,defineCustomElement:()=>vw,defineEmits:()=>i5,defineExpose:()=>s5,defineModel:()=>c5,defineOptions:()=>a5,defineProps:()=>o5,defineSSRCustomElement:()=>Nw,defineSlots:()=>l5,devtools:()=>iw,effect:()=>SI,effectScope:()=>ng,getCurrentInstance:()=>dr,getCurrentScope:()=>rg,getCurrentWatcher:()=>OI,getTransitionRawChildren:()=>gh,guardReactiveProps:()=>yb,h:()=>Vr,handleError:()=>Vl,hasInjectionContext:()=>O1,hydrate:()=>$w,hydrateOnIdle:()=>Fb,hydrateOnInteraction:()=>zb,hydrateOnMediaQuery:()=>Bb,hydrateOnVisible:()=>Nb,initCustomFormatter:()=>z5,initDirectivesForSSR:()=>Gw,inject:()=>Ua,isMemoSame:()=>_b,isProxy:()=>cd,isReactive:()=>xi,isReadonly:()=>gs,isRef:()=>cr,isRuntimeOnly:()=>tw,isShallow:()=>Zo,isVNode:()=>na,markRaw:()=>no,mergeDefaults:()=>f5,mergeModels:()=>h5,mergeProps:()=>bs,nextTick:()=>_t,nodeOps:()=>wv,normalizeClass:()=>nn,normalizeProps:()=>Km,normalizeStyle:()=>bn,onActivated:()=>xg,onBeforeMount:()=>Jg,onBeforeUnmount:()=>rr,onBeforeUpdate:()=>Eh,onDeactivated:()=>Eg,onErrorCaptured:()=>G1,onMounted:()=>Pn,onRenderTracked:()=>nv,onRenderTriggered:()=>tv,onScopeDispose:()=>X2,onServerPrefetch:()=>ev,onUnmounted:()=>Dd,onUpdated:()=>Pd,onWatcherCleanup:()=>c1,openBlock:()=>ye,patchProp:()=>Pv,popScopeId:()=>$I,provide:()=>D1,proxyRefs:()=>ug,pushScopeId:()=>HI,queuePostFlushCb:()=>vd,reactive:()=>to,readonly:()=>lh,ref:()=>te,registerRuntimeCompiler:()=>N5,render:()=>Hv,renderList:()=>ur,renderSlot:()=>kd,resolveComponent:()=>t5,resolveDirective:()=>W1,resolveDynamicComponent:()=>Rg,resolveFilter:()=>null,resolveTransitionHooks:()=>Oc,setBlockTracking:()=>Id,setDevtoolsHook:()=>sw,setTransitionHooks:()=>ta,shallowReactive:()=>o1,shallowReadonly:()=>LI,shallowRef:()=>zr,ssrContextKey:()=>Hg,ssrUtils:()=>aw,stop:()=>_I,toDisplayString:()=>jt,toHandlerKey:()=>Tc,toHandlers:()=>r5,toRaw:()=>Cn,toRef:()=>dg,toRefs:()=>a1,toValue:()=>PI,transformVNodeArgs:()=>P5,triggerRef:()=>MI,unref:()=>Xe,useAttrs:()=>q1,useCssModule:()=>o6,useCssVars:()=>K5,useHost:()=>yw,useId:()=>YI,useModel:()=>C5,useSSRContext:()=>$g,useShadowRoot:()=>r6,useSlots:()=>d5,useTemplateRef:()=>XI,useTransitionState:()=>_g,vModelCheckbox:()=>Wh,vModelDynamic:()=>Vv,vModelRadio:()=>Kh,vModelSelect:()=>zv,vModelText:()=>Li,vShow:()=>Av,version:()=>hv,warn:()=>rw,watch:()=>Ft,watchEffect:()=>GI,watchPostEffect:()=>WI,watchSyncEffect:()=>F1,withAsyncContext:()=>m5,withCtx:()=>Do,withDefaults:()=>u5,withDirectives:()=>ea,withKeys:()=>ei,withMemo:()=>V5,withModifiers:()=>en,withScopeId:()=>xb}),Ww,xt=_r((()=>{d6(),Ww=()=>{}})),h6=O2(((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(c,d){if(!o[c]){if(!r[c]){var f=typeof require=="function"&&require;if(!d&&f)return f(c,!0);if(a)return a(c,!0);var h=new Error("Cannot find module '"+c+"'");throw h.code="MODULE_NOT_FOUND",h}var g=o[c]={exports:{}};r[c][0].call(g.exports,function(m){var v=r[c][1][m];return s(v||m)},g,g.exports,n,r,o,i)}return o[c].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 c,d,f,h,g,m,v,k=[],C=0,_=l.length,b=_,w=i.getTypeOf(l)!=="string";C<l.length;)b=_-C,f=w?(c=l[C++],d=C<_?l[C++]:0,C<_?l[C++]:0):(c=l.charCodeAt(C++),d=C<_?l.charCodeAt(C++):0,C<_?l.charCodeAt(C++):0),h=c>>2,g=(3&c)<<4|d>>4,m=1<b?(15&d)<<2|f>>6:64,v=2<b?63&f:64,k.push(a.charAt(h)+a.charAt(g)+a.charAt(m)+a.charAt(v));return k.join("")},o.decode=function(l){var c,d,f,h,g,m,v=0,k=0,C="data:";if(l.substr(0,C.length)===C)throw new Error("Invalid base64 input, it looks like a data url.");var _,b=3*(l=l.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(l.charAt(l.length-1)===a.charAt(64)&&b--,l.charAt(l.length-2)===a.charAt(64)&&b--,b%1!=0)throw new Error("Invalid base64 input, bad content length.");for(_=s.uint8array?new Uint8Array(0|b):new Array(0|b);v<l.length;)c=a.indexOf(l.charAt(v++))<<2|(h=a.indexOf(l.charAt(v++)))>>4,d=(15&h)<<4|(g=a.indexOf(l.charAt(v++)))>>2,f=(3&g)<<6|(m=a.indexOf(l.charAt(v++))),_[k++]=c,g!==64&&(_[k++]=d),m!==64&&(_[k++]=f);return _}},{"./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 c(d,f,h,g,m){this.compressedSize=d,this.uncompressedSize=f,this.crc32=h,this.compression=g,this.compressedContent=m}c.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)}},c.createWorkerFrom=function(d,f,h){return d.pipe(new a).pipe(new l("uncompressedSize")).pipe(f.compressWorker(h)).pipe(new l("compressedSize")).withStreamInfo("compression",f)},r.exports=c},{"./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=[],c=0;c<256;c++){a=c;for(var d=0;d<8;d++)a=1&a?3988292384^a>>>1:a>>>1;l[c]=a}return l})();r.exports=function(a,l){return a!==void 0&&a.length?i.getTypeOf(a)!=="string"?(function(c,d,f,h){var g=s,m=h+f;c^=-1;for(var v=h;v<m;v++)c=c>>>8^g[255&(c^d[v])];return-1^c})(0|l,a,a.length,0):(function(c,d,f,h){var g=s,m=h+f;c^=-1;for(var v=h;v<m;v++)c=c>>>8^g[255&(c^d.charCodeAt(v))];return-1^c})(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"),c=i?"uint8array":"array";function d(f,h){l.call(this,"FlateWorker/"+f),this._pako=null,this._pakoAction=f,this._pakoOptions=h,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(c,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(h){f.push({data:h,meta:f.meta})}},o.compressWorker=function(f){return new d("Deflate",f)},o.uncompressWorker=function(){return new d("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(n,r,o){"use strict";function i(g,m){var v,k="";for(v=0;v<m;v++)k+=String.fromCharCode(255&g),g>>>=8;return k}function s(g,m,v,k,C,_){var b,w,T=g.file,L=g.compression,N=_!==c.utf8encode,H=a.transformTo("string",_(T.name)),M=a.transformTo("string",c.utf8encode(T.name)),V=T.comment,q=a.transformTo("string",_(V)),D=a.transformTo("string",c.utf8encode(V)),B=M.length!==T.name.length,E=D.length!==V.length,j="",J="",Y="",se=T.dir,pe=T.date,Ve={crc32:0,compressedSize:0,uncompressedSize:0};m&&!v||(Ve.crc32=g.crc32,Ve.compressedSize=g.compressedSize,Ve.uncompressedSize=g.uncompressedSize);var ge=0;m&&(ge|=8),N||!B&&!E||(ge|=2048);var be=0,ve=0;se&&(be|=16),C==="UNIX"?(ve=798,be|=(function(oe,Re){var je=oe;return oe||(je=Re?16893:33204),(65535&je)<<16})(T.unixPermissions,se)):(ve=20,be|=(function(oe){return 63&(oe||0)})(T.dosPermissions)),b=pe.getUTCHours(),b<<=6,b|=pe.getUTCMinutes(),b<<=5,b|=pe.getUTCSeconds()/2,w=pe.getUTCFullYear()-1980,w<<=4,w|=pe.getUTCMonth()+1,w<<=5,w|=pe.getUTCDate(),B&&(J=i(1,1)+i(d(H),4)+M,j+="up"+i(J.length,2)+J),E&&(Y=i(1,1)+i(d(q),4)+D,j+="uc"+i(Y.length,2)+Y);var ke="";return ke+=`
|
|
4
|
-
\0`,ke+=i(ge,2),ke+=L.magic,ke+=i(b,2),ke+=i(w,2),ke+=i(Ve.crc32,4),ke+=i(Ve.compressedSize,4),ke+=i(Ve.uncompressedSize,4),ke+=i(H.length,2),ke+=i(j.length,2),{fileRecord:f.LOCAL_FILE_HEADER+ke+H+j,dirRecord:f.CENTRAL_FILE_HEADER+i(ve,2)+ke+i(q.length,2)+"\0\0\0\0"+i(be,4)+i(k,4)+H+j+q}}var a=n("../utils"),l=n("../stream/GenericWorker"),c=n("../utf8"),d=n("../crc32"),f=n("../signature");function h(g,m,v,k){l.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=m,this.zipPlatform=v,this.encodeFileName=k,this.streamFiles=g,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(h,l),h.prototype.push=function(g){var m=g.meta.percent||0,v=this.entriesCount,k=this._sources.length;this.accumulate?this.contentBuffer.push(g):(this.bytesWritten+=g.data.length,l.prototype.push.call(this,{data:g.data,meta:{currentFile:this.currentFile,percent:v?(m+100*(v-k-1))/v:100}}))},h.prototype.openedSource=function(g){this.currentSourceOffset=this.bytesWritten,this.currentFile=g.file.name;var m=this.streamFiles&&!g.file.dir;if(m){var v=s(g,m,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:v.fileRecord,meta:{percent:0}})}else this.accumulate=!0},h.prototype.closedSource=function(g){this.accumulate=!1;var m=this.streamFiles&&!g.file.dir,v=s(g,m,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(v.dirRecord),m)this.push({data:(function(k){return f.DATA_DESCRIPTOR+i(k.crc32,4)+i(k.compressedSize,4)+i(k.uncompressedSize,4)})(g),meta:{percent:100}});else for(this.push({data:v.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},h.prototype.flush=function(){for(var g=this.bytesWritten,m=0;m<this.dirRecords.length;m++)this.push({data:this.dirRecords[m],meta:{percent:100}});var v=this.bytesWritten-g,k=(function(C,_,b,w,T){var L=a.transformTo("string",T(w));return f.CENTRAL_DIRECTORY_END+"\0\0\0\0"+i(C,2)+i(C,2)+i(_,4)+i(b,4)+i(L.length,2)+L})(this.dirRecords.length,v,g,this.zipComment,this.encodeFileName);this.push({data:k,meta:{percent:100}})},h.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},h.prototype.registerPrevious=function(g){this._sources.push(g);var m=this;return g.on("data",function(v){m.processChunk(v)}),g.on("end",function(){m.closedSource(m.previous.streamInfo),m._sources.length?m.prepareNextSource():m.end()}),g.on("error",function(v){m.error(v)}),this},h.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))},h.prototype.error=function(g){var m=this._sources;if(!l.prototype.error.call(this,g))return!1;for(var v=0;v<m.length;v++)try{m[v].error(g)}catch{}return!0},h.prototype.lock=function(){l.prototype.lock.call(this);for(var g=this._sources,m=0;m<g.length;m++)g[m].lock()},r.exports=h},{"../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,c){var d=new s(l.streamFiles,c,l.platform,l.encodeFileName),f=0;try{a.forEach(function(h,g){f++;var m=(function(_,b){var w=_||b,T=i[w];if(!T)throw new Error(w+" is not a valid compression method !");return T})(g.options.compression,l.compression),v=g.options.compressionOptions||l.compressionOptions||{},k=g.dir,C=g.date;g._compressWorker(m,v).withStreamInfo("file",{name:h,dir:k,date:C,comment:g.comment||"",unixPermissions:g.unixPermissions,dosPermissions:g.dosPermissions}).pipe(d)}),d.entriesCount=f}catch(h){d.error(h)}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"),c=n("./stream/Crc32Probe"),d=n("./nodejsUtils");function f(h){return new s.Promise(function(g,m){var v=h.decompressed.getContentWorker().pipe(new c);v.on("error",function(k){m(k)}).on("end",function(){v.streamInfo.crc32!==h.decompressed.crc32?m(new Error("Corrupted zip : CRC32 mismatch")):g()}).resume()})}r.exports=function(h,g){var m=this;return g=i.extend(g||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:a.utf8decode}),d.isNode&&d.isStream(h)?s.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):i.prepareContent("the loaded zip file",h,!0,g.optimizedBinaryString,g.base64).then(function(v){var k=new l(g);return k.load(v),k}).then(function(v){var k=[s.Promise.resolve(v)],C=v.files;if(g.checkCRC32)for(var _=0;_<C.length;_++)k.push(f(C[_]));return s.Promise.all(k)}).then(function(v){for(var k=v.shift(),C=k.files,_=0;_<C.length;_++){var b=C[_],w=b.fileNameStr,T=i.resolve(b.fileNameStr);m.file(T,b.decompressed,{binary:!0,optimizedBinaryString:!0,date:b.date,dir:b.dir,comment:b.fileCommentStr.length?b.fileCommentStr:null,unixPermissions:b.unixPermissions,dosPermissions:b.dosPermissions,createFolders:g.createFolders}),b.dir||(m.file(T).unsafeOriginalName=w)}return k.zipComment.length&&(m.comment=k.zipComment),m})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(n,r,o){"use strict";var i=n("../utils"),s=n("../stream/GenericWorker");function a(l,c){s.call(this,"Nodejs stream input adapter for "+l),this._upstreamEnded=!1,this._bindStream(c)}i.inherits(a,s),a.prototype._bindStream=function(l){var c=this;(this._stream=l).pause(),l.on("data",function(d){c.push({data:d,meta:{percent:0}})}).on("error",function(d){c.isPaused?this.generatedError=d:c.error(d)}).on("end",function(){c.isPaused?c._upstreamEnded=!0:c.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,c){i.call(this,l),this._helper=a;var d=this;a.on("data",function(f,h){d.push(f)||d._helper.pause(),c&&c(h)}).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(w,T,L){var N,H=a.getTypeOf(T),M=a.extend(L||{},d);M.date=M.date||new Date,M.compression!==null&&(M.compression=M.compression.toUpperCase()),typeof M.unixPermissions=="string"&&(M.unixPermissions=parseInt(M.unixPermissions,8)),M.unixPermissions&&16384&M.unixPermissions&&(M.dir=!0),M.dosPermissions&&16&M.dosPermissions&&(M.dir=!0),M.dir&&(w=C(w)),M.createFolders&&(N=k(w))&&_.call(this,N,!0);var V=H==="string"&&M.binary===!1&&M.base64===!1;L&&L.binary!==void 0||(M.binary=!V),(T instanceof f&&T.uncompressedSize===0||M.dir||!T||T.length===0)&&(M.base64=!1,M.binary=!0,T="",M.compression="STORE",H="string");var q=null;q=T instanceof f||T instanceof l?T:m.isNode&&m.isStream(T)?new v(w,T):a.prepareContent(w,T,M.binary,M.optimizedBinaryString,M.base64);var D=new h(w,q,M);this.files[w]=D}var s=n("./utf8"),a=n("./utils"),l=n("./stream/GenericWorker"),c=n("./stream/StreamHelper"),d=n("./defaults"),f=n("./compressedObject"),h=n("./zipObject"),g=n("./generate"),m=n("./nodejsUtils"),v=n("./nodejs/NodejsStreamInputAdapter"),k=function(w){w.slice(-1)==="/"&&(w=w.substring(0,w.length-1));var T=w.lastIndexOf("/");return 0<T?w.substring(0,T):""},C=function(w){return w.slice(-1)!=="/"&&(w+="/"),w},_=function(w,T){return T=T!==void 0?T:d.createFolders,w=C(w),this.files[w]||i.call(this,w,null,{dir:!0,createFolders:T}),this.files[w]};function b(w){return Object.prototype.toString.call(w)==="[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(w){var T,L,N;for(T in this.files)N=this.files[T],(L=T.slice(this.root.length,T.length))&&T.slice(0,this.root.length)===this.root&&w(L,N)},filter:function(w){var T=[];return this.forEach(function(L,N){w(L,N)&&T.push(N)}),T},file:function(w,T,L){if(arguments.length!==1)return w=this.root+w,i.call(this,w,T,L),this;if(b(w)){var N=w;return this.filter(function(M,V){return!V.dir&&N.test(M)})}var H=this.files[this.root+w];return H&&!H.dir?H:null},folder:function(w){if(!w)return this;if(b(w))return this.filter(function(H,M){return M.dir&&w.test(H)});var T=this.root+w,L=_.call(this,T),N=this.clone();return N.root=L.name,N},remove:function(w){w=this.root+w;var T=this.files[w];if(T||(w.slice(-1)!=="/"&&(w+="/"),T=this.files[w]),T&&!T.dir)delete this.files[w];else for(var L=this.filter(function(H,M){return M.name.slice(0,w.length)===w}),N=0;N<L.length;N++)delete this.files[L[N].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(w){var T,L={};try{if((L=a.extend(w||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:s.utf8encode})).type=L.type.toLowerCase(),L.compression=L.compression.toUpperCase(),L.type==="binarystring"&&(L.type="string"),!L.type)throw new Error("No output type specified.");a.checkSupport(L.type),L.platform!=="darwin"&&L.platform!=="freebsd"&&L.platform!=="linux"&&L.platform!=="sunos"||(L.platform="UNIX"),L.platform==="win32"&&(L.platform="DOS");var N=L.comment||this.comment||"";T=g.generateWorker(this,L,N)}catch(H){(T=new l("error")).error(H)}return new c(T,L.type||"string",L.mimeType)},generateAsync:function(w,T){return this.generateInternalStream(w).accumulate(T)},generateNodeStream:function(w,T){return(w=w||{}).type||(w.type="nodebuffer"),this.generateInternalStream(w).toNodejsStream(T)}}},{"./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),c=a.charCodeAt(1),d=a.charCodeAt(2),f=a.charCodeAt(3),h=this.length-4;0<=h;--h)if(this.data[h]===l&&this.data[h+1]===c&&this.data[h+2]===d&&this.data[h+3]===f)return h-this.zero;return-1},s.prototype.readAndCheckSignature=function(a){var l=a.charCodeAt(0),c=a.charCodeAt(1),d=a.charCodeAt(2),f=a.charCodeAt(3),h=this.readData(4);return l===h[0]&&c===h[1]&&d===h[2]&&f===h[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,c=0;for(this.checkOffset(a),l=this.index+a-1;l>=this.index;l--)c=(c<<8)+this.byteAt(l);return this.index+=a,c},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"),c=n("./NodeBufferReader"),d=n("./Uint8ArrayReader");r.exports=function(f){var h=i.getTypeOf(f);return i.checkSupport(h),h!=="string"||s.uint8array?h==="nodebuffer"?new c(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 c=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=c+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 c=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,l.then(function(d){c.dataIsReady=!0,c.data=d,c.max=d&&d.length||0,c.type=i.getTypeOf(d),c.isPaused||c._tickAndRepeat()},function(d){c.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,c=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,c);break;case"uint8array":l=this.data.subarray(this.index,c);break;case"array":case"nodebuffer":l=this.data.slice(this.index,c)}return this.index=c,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"),c=n("../support"),d=n("../external"),f=null;if(c.nodestream)try{f=n("../nodejs/NodejsStreamOutputAdapter")}catch{}function h(m,v){return new d.Promise(function(k,C){var _=[],b=m._internalType,w=m._outputType,T=m._mimeType;m.on("data",function(L,N){_.push(L),v&&v(N)}).on("error",function(L){_=[],C(L)}).on("end",function(){try{k((function(L,N,H){switch(L){case"blob":return i.newBlob(i.transformTo("arraybuffer",N),H);case"base64":return l.encode(N);default:return i.transformTo(L,N)}})(w,(function(L,N){var H,M=0,V=null,q=0;for(H=0;H<N.length;H++)q+=N[H].length;switch(L){case"string":return N.join("");case"array":return Array.prototype.concat.apply([],N);case"uint8array":for(V=new Uint8Array(q),H=0;H<N.length;H++)V.set(N[H],M),M+=N[H].length;return V;case"nodebuffer":return Buffer.concat(N);default:throw new Error("concat : unsupported type '"+L+"'")}})(b,_),T))}catch(L){C(L)}_=[]}).resume()})}function g(m,v,k){var C=v;switch(v){case"blob":case"arraybuffer":C="uint8array";break;case"base64":C="string"}try{this._internalType=C,this._outputType=v,this._mimeType=k,i.checkSupport(C),this._worker=m.pipe(new s(C)),m.lock()}catch(_){this._worker=new a("error"),this._worker.error(_)}}g.prototype={accumulate:function(m){return h(this,m)},on:function(m,v){var k=this;return m==="data"?this._worker.on(m,function(C){v.call(k,C.data,C.meta)}):this._worker.on(m,function(){i.delay(v,arguments,k)}),this},resume:function(){return i.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(m){if(i.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new f(this,{objectMode:this._outputType!=="nodebuffer"},m)}},r.exports=g},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(n,r,o){"use strict";if(o.base64=!0,o.array=!0,o.string=!0,o.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",o.nodebuffer=typeof Buffer<"u",o.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")o.blob=!1;else{var i=new ArrayBuffer(0);try{o.blob=new Blob([i],{type:"application/zip"}).size===0}catch{try{var s=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);s.append(i),o.blob=s.getBlob("application/zip").size===0}catch{o.blob=!1}}}try{o.nodestream=!!n("readable-stream").Readable}catch{o.nodestream=!1}},{"readable-stream":16}],31:[function(n,r,o){"use strict";for(var i=n("./utils"),s=n("./support"),a=n("./nodejsUtils"),l=n("./stream/GenericWorker"),c=new Array(256),d=0;d<256;d++)c[d]=252<=d?6:248<=d?5:240<=d?4:224<=d?3:192<=d?2:1;c[254]=c[254]=1;function f(){l.call(this,"utf-8 decode"),this.leftOver=null}function h(){l.call(this,"utf-8 encode")}o.utf8encode=function(g){return s.nodebuffer?a.newBufferFrom(g,"utf-8"):(function(m){var v,k,C,_,b,w=m.length,T=0;for(_=0;_<w;_++)(64512&(k=m.charCodeAt(_)))==55296&&_+1<w&&(64512&(C=m.charCodeAt(_+1)))==56320&&(k=65536+(k-55296<<10)+(C-56320),_++),T+=k<128?1:k<2048?2:k<65536?3:4;for(v=s.uint8array?new Uint8Array(T):new Array(T),_=b=0;b<T;_++)(64512&(k=m.charCodeAt(_)))==55296&&_+1<w&&(64512&(C=m.charCodeAt(_+1)))==56320&&(k=65536+(k-55296<<10)+(C-56320),_++),k<128?v[b++]=k:(k<2048?v[b++]=192|k>>>6:(k<65536?v[b++]=224|k>>>12:(v[b++]=240|k>>>18,v[b++]=128|k>>>12&63),v[b++]=128|k>>>6&63),v[b++]=128|63&k);return v})(g)},o.utf8decode=function(g){return s.nodebuffer?i.transformTo("nodebuffer",g).toString("utf-8"):(function(m){var v,k,C,_,b=m.length,w=new Array(2*b);for(v=k=0;v<b;)if((C=m[v++])<128)w[k++]=C;else if(4<(_=c[C]))w[k++]=65533,v+=_-1;else{for(C&=_===2?31:_===3?15:7;1<_&&v<b;)C=C<<6|63&m[v++],_--;1<_?w[k++]=65533:C<65536?w[k++]=C:(C-=65536,w[k++]=55296|C>>10&1023,w[k++]=56320|1023&C)}return w.length!==k&&(w.subarray?w=w.subarray(0,k):w.length=k),i.applyFromCharCode(w)})(g=i.transformTo(s.uint8array?"uint8array":"array",g))},i.inherits(f,l),f.prototype.processChunk=function(g){var m=i.transformTo(s.uint8array?"uint8array":"array",g.data);if(this.leftOver&&this.leftOver.length){if(s.uint8array){var v=m;(m=new Uint8Array(v.length+this.leftOver.length)).set(this.leftOver,0),m.set(v,this.leftOver.length)}else m=this.leftOver.concat(m);this.leftOver=null}var k=(function(_,b){var w;for((b=b||_.length)>_.length&&(b=_.length),w=b-1;0<=w&&(192&_[w])==128;)w--;return w<0||w===0?b:w+c[_[w]]>b?w:b})(m),C=m;k!==m.length&&(s.uint8array?(C=m.subarray(0,k),this.leftOver=m.subarray(k,m.length)):(C=m.slice(0,k),this.leftOver=m.slice(k,m.length))),this.push({data:o.utf8decode(C),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(h,l),h.prototype.processChunk=function(g){this.push({data:o.utf8encode(g.data),meta:g.meta})},o.Utf8EncodeWorker=h},{"./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 c(v){return v}function d(v,k){for(var C=0;C<v.length;++C)k[C]=255&v.charCodeAt(C);return k}n("setimmediate"),o.newBlob=function(v,k){o.checkSupport("blob");try{return new Blob([v],{type:k})}catch{try{var C=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return C.append(v),C.getBlob(k)}catch{throw new Error("Bug : can't construct the Blob.")}}};var f={stringifyByChunk:function(v,k,C){var _=[],b=0,w=v.length;if(w<=C)return String.fromCharCode.apply(null,v);for(;b<w;)k==="array"||k==="nodebuffer"?_.push(String.fromCharCode.apply(null,v.slice(b,Math.min(b+C,w)))):_.push(String.fromCharCode.apply(null,v.subarray(b,Math.min(b+C,w)))),b+=C;return _.join("")},stringifyByChar:function(v){for(var k="",C=0;C<v.length;C++)k+=String.fromCharCode(v[C]);return k},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 h(v){var k=65536,C=o.getTypeOf(v),_=!0;if(C==="uint8array"?_=f.applyCanBeUsed.uint8array:C==="nodebuffer"&&(_=f.applyCanBeUsed.nodebuffer),_)for(;1<k;)try{return f.stringifyByChunk(v,C,k)}catch{k=Math.floor(k/2)}return f.stringifyByChar(v)}function g(v,k){for(var C=0;C<v.length;C++)k[C]=v[C];return k}o.applyFromCharCode=h;var m={};m.string={string:c,array:function(v){return d(v,new Array(v.length))},arraybuffer:function(v){return m.string.uint8array(v).buffer},uint8array:function(v){return d(v,new Uint8Array(v.length))},nodebuffer:function(v){return d(v,a.allocBuffer(v.length))}},m.array={string:h,array:c,arraybuffer:function(v){return new Uint8Array(v).buffer},uint8array:function(v){return new Uint8Array(v)},nodebuffer:function(v){return a.newBufferFrom(v)}},m.arraybuffer={string:function(v){return h(new Uint8Array(v))},array:function(v){return g(new Uint8Array(v),new Array(v.byteLength))},arraybuffer:c,uint8array:function(v){return new Uint8Array(v)},nodebuffer:function(v){return a.newBufferFrom(new Uint8Array(v))}},m.uint8array={string:h,array:function(v){return g(v,new Array(v.length))},arraybuffer:function(v){return v.buffer},uint8array:c,nodebuffer:function(v){return a.newBufferFrom(v)}},m.nodebuffer={string:h,array:function(v){return g(v,new Array(v.length))},arraybuffer:function(v){return m.nodebuffer.uint8array(v).buffer},uint8array:function(v){return g(v,new Uint8Array(v.length))},nodebuffer:c},o.transformTo=function(v,k){return k=k||"",v?(o.checkSupport(v),m[o.getTypeOf(k)][v](k)):k},o.resolve=function(v){for(var k=v.split("/"),C=[],_=0;_<k.length;_++){var b=k[_];b==="."||b===""&&_!==0&&_!==k.length-1||(b===".."?C.pop():C.push(b))}return C.join("/")},o.getTypeOf=function(v){return typeof v=="string"?"string":Object.prototype.toString.call(v)==="[object Array]"?"array":i.nodebuffer&&a.isBuffer(v)?"nodebuffer":i.uint8array&&v instanceof Uint8Array?"uint8array":i.arraybuffer&&v instanceof ArrayBuffer?"arraybuffer":void 0},o.checkSupport=function(v){if(!i[v.toLowerCase()])throw new Error(v+" is not supported by this platform")},o.MAX_VALUE_16BITS=65535,o.MAX_VALUE_32BITS=-1,o.pretty=function(v){var k,C,_="";for(C=0;C<(v||"").length;C++)_+="\\x"+((k=v.charCodeAt(C))<16?"0":"")+k.toString(16).toUpperCase();return _},o.delay=function(v,k,C){setImmediate(function(){v.apply(C||null,k||[])})},o.inherits=function(v,k){function C(){}C.prototype=k.prototype,v.prototype=new C},o.extend=function(){var v,k,C={};for(v=0;v<arguments.length;v++)for(k in arguments[v])Object.prototype.hasOwnProperty.call(arguments[v],k)&&C[k]===void 0&&(C[k]=arguments[v][k]);return C},o.prepareContent=function(v,k,C,_,b){return l.Promise.resolve(k).then(function(w){return i.blob&&(w instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(w))!==-1)&&typeof FileReader<"u"?new l.Promise(function(T,L){var N=new FileReader;N.onload=function(H){T(H.target.result)},N.onerror=function(H){L(H.target.error)},N.readAsArrayBuffer(w)}):w}).then(function(w){var T=o.getTypeOf(w);return T?(T==="arraybuffer"?w=o.transformTo("uint8array",w):T==="string"&&(b?w=s.decode(w):C&&_!==!0&&(w=(function(L){return d(L,i.uint8array?new Uint8Array(L.length):new Array(L.length))})(w))),w):l.Promise.reject(new Error("Can't read the data of '"+v+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(n,r,o){"use strict";var i=n("./reader/readerFor"),s=n("./utils"),a=n("./signature"),l=n("./zipEntry"),c=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 h=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+s.pretty(h)+", expected "+s.pretty(f)+")")}},isSignature:function(f,h){var g=this.reader.index;this.reader.setIndex(f);var m=this.reader.readString(4)===h;return this.reader.setIndex(g),m},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var f=this.reader.readData(this.zipCommentLength),h=c.uint8array?"uint8array":"array",g=s.transformTo(h,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,h,g,m=this.zip64EndOfCentralSize-44;0<m;)f=this.reader.readInt(2),h=this.reader.readInt(4),g=this.reader.readData(h),this.zip64ExtensibleData[f]={id:f,length:h,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,h;for(f=0;f<this.files.length;f++)h=this.files[f],this.reader.setIndex(h.localHeaderOffset),this.checkSignature(a.LOCAL_FILE_HEADER),h.readLocalPart(this.reader),h.handleUTF8(),h.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 h=f;if(this.checkSignature(a.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===s.MAX_VALUE_16BITS||this.diskWithCentralDirStart===s.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===s.MAX_VALUE_16BITS||this.centralDirRecords===s.MAX_VALUE_16BITS||this.centralDirSize===s.MAX_VALUE_32BITS||this.centralDirOffset===s.MAX_VALUE_32BITS){if(this.zip64=!0,(f=this.reader.lastIndexOfSignature(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(f),this.checkSignature(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,a.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(a.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(a.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var g=this.centralDirOffset+this.centralDirSize;this.zip64&&(g+=20,g+=12+this.zip64EndOfCentralSize);var m=h-g;if(0<m)this.isSignature(h,a.CENTRAL_FILE_HEADER)||(this.reader.zero=m);else if(m<0)throw new Error("Corrupted zip: missing "+Math.abs(m)+" bytes.")},prepareReader:function(f){this.reader=i(f)},load:function(f){this.prepareReader(f),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},r.exports=d},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(n,r,o){"use strict";var i=n("./reader/readerFor"),s=n("./utils"),a=n("./compressedObject"),l=n("./crc32"),c=n("./utf8"),d=n("./compressions"),f=n("./support");function h(g,m){this.options=g,this.loadOptions=m}h.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(g){var m,v;if(g.skip(22),this.fileNameLength=g.readInt(2),v=g.readInt(2),this.fileName=g.readData(this.fileNameLength),g.skip(v),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if((m=(function(k){for(var C in d)if(Object.prototype.hasOwnProperty.call(d,C)&&d[C].magic===k)return d[C];return null})(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+s.pretty(this.compressionMethod)+" unknown (inner file : "+s.transformTo("string",this.fileName)+")");this.decompressed=new a(this.compressedSize,this.uncompressedSize,this.crc32,m,g.readData(this.compressedSize))},readCentralPart:function(g){this.versionMadeBy=g.readInt(2),g.skip(2),this.bitFlag=g.readInt(2),this.compressionMethod=g.readString(2),this.date=g.readDate(),this.crc32=g.readInt(4),this.compressedSize=g.readInt(4),this.uncompressedSize=g.readInt(4);var m=g.readInt(2);if(this.extraFieldsLength=g.readInt(2),this.fileCommentLength=g.readInt(2),this.diskNumberStart=g.readInt(2),this.internalFileAttributes=g.readInt(2),this.externalFileAttributes=g.readInt(4),this.localHeaderOffset=g.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");g.skip(m),this.readExtraFields(g),this.parseZIP64ExtraField(g),this.fileComment=g.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var g=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),g==0&&(this.dosPermissions=63&this.externalFileAttributes),g==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var g=i(this.extraFields[1].value);this.uncompressedSize===s.MAX_VALUE_32BITS&&(this.uncompressedSize=g.readInt(8)),this.compressedSize===s.MAX_VALUE_32BITS&&(this.compressedSize=g.readInt(8)),this.localHeaderOffset===s.MAX_VALUE_32BITS&&(this.localHeaderOffset=g.readInt(8)),this.diskNumberStart===s.MAX_VALUE_32BITS&&(this.diskNumberStart=g.readInt(4))}},readExtraFields:function(g){var m,v,k,C=g.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});g.index+4<C;)m=g.readInt(2),v=g.readInt(2),k=g.readData(v),this.extraFields[m]={id:m,length:v,value:k};g.setIndex(C)},handleUTF8:function(){var g=f.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=c.utf8decode(this.fileName),this.fileCommentStr=c.utf8decode(this.fileComment);else{var m=this.findExtraFieldUnicodePath();if(m!==null)this.fileNameStr=m;else{var v=s.transformTo(g,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(v)}var k=this.findExtraFieldUnicodeComment();if(k!==null)this.fileCommentStr=k;else{var C=s.transformTo(g,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(C)}}},findExtraFieldUnicodePath:function(){var g=this.extraFields[28789];if(g){var m=i(g.value);return m.readInt(1)!==1||l(this.fileName)!==m.readInt(4)?null:c.utf8decode(m.readData(g.length-5))}return null},findExtraFieldUnicodeComment:function(){var g=this.extraFields[25461];if(g){var m=i(g.value);return m.readInt(1)!==1||l(this.fileComment)!==m.readInt(4)?null:c.utf8decode(m.readData(g.length-5))}return null}},r.exports=h},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(n,r,o){"use strict";function i(m,v,k){this.name=m,this.dir=k.dir,this.date=k.date,this.comment=k.comment,this.unixPermissions=k.unixPermissions,this.dosPermissions=k.dosPermissions,this._data=v,this._dataBinary=k.binary,this.options={compression:k.compression,compressionOptions:k.compressionOptions}}var s=n("./stream/StreamHelper"),a=n("./stream/DataWorker"),l=n("./utf8"),c=n("./compressedObject"),d=n("./stream/GenericWorker");i.prototype={internalStream:function(m){var v=null,k="string";try{if(!m)throw new Error("No output type specified.");var C=(k=m.toLowerCase())==="string"||k==="text";k!=="binarystring"&&k!=="text"||(k="string"),v=this._decompressWorker();var _=!this._dataBinary;_&&!C&&(v=v.pipe(new l.Utf8EncodeWorker)),!_&&C&&(v=v.pipe(new l.Utf8DecodeWorker))}catch(b){(v=new d("error")).error(b)}return new s(v,k,"")},async:function(m,v){return this.internalStream(m).accumulate(v)},nodeStream:function(m,v){return this.internalStream(m||"nodebuffer").toNodejsStream(v)},_compressWorker:function(m,v){if(this._data instanceof c&&this._data.compression.magic===m.magic)return this._data.getCompressedWorker();var k=this._decompressWorker();return this._dataBinary||(k=k.pipe(new l.Utf8EncodeWorker)),c.createWorkerFrom(k,m,v)},_decompressWorker:function(){return this._data instanceof c?this._data.getContentWorker():this._data instanceof d?this._data:new a(this._data)}};for(var f=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],h=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]]=h;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 c=0,d=new l(m),f=i.document.createTextNode("");d.observe(f,{characterData:!0}),s=function(){f.data=c=++c%2}}else if(i.setImmediate||i.MessageChannel===void 0)s="document"in i&&"onreadystatechange"in i.document.createElement("script")?function(){var v=i.document.createElement("script");v.onreadystatechange=function(){m(),v.onreadystatechange=null,v.parentNode.removeChild(v),v=null},i.document.documentElement.appendChild(v)}:function(){setTimeout(m,0)};else{var h=new i.MessageChannel;h.port1.onmessage=m,s=function(){h.port2.postMessage(0)}}var g=[];function m(){var v,k;a=!0;for(var C=g.length;C;){for(k=g,g=[],v=-1;++v<C;)k[v]();C=g.length}a=!1}r.exports=function(v){g.push(v)!==1||a||s()}}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(n,r,o){"use strict";var i=n("immediate");function s(){}var a={},l=["REJECTED"],c=["FULFILLED"],d=["PENDING"];function f(C){if(typeof C!="function")throw new TypeError("resolver must be a function");this.state=d,this.queue=[],this.outcome=void 0,C!==s&&v(this,C)}function h(C,_,b){this.promise=C,typeof _=="function"&&(this.onFulfilled=_,this.callFulfilled=this.otherCallFulfilled),typeof b=="function"&&(this.onRejected=b,this.callRejected=this.otherCallRejected)}function g(C,_,b){i(function(){var w;try{w=_(b)}catch(T){return a.reject(C,T)}w===C?a.reject(C,new TypeError("Cannot resolve promise with itself")):a.resolve(C,w)})}function m(C){var _=C&&C.then;if(C&&(typeof C=="object"||typeof C=="function")&&typeof _=="function")return function(){_.apply(C,arguments)}}function v(C,_){var b=!1;function w(N){b||(b=!0,a.reject(C,N))}function T(N){b||(b=!0,a.resolve(C,N))}var L=k(function(){_(T,w)});L.status==="error"&&w(L.value)}function k(C,_){var b={};try{b.value=C(_),b.status="success"}catch(w){b.status="error",b.value=w}return b}(r.exports=f).prototype.finally=function(C){if(typeof C!="function")return this;var _=this.constructor;return this.then(function(b){return _.resolve(C()).then(function(){return b})},function(b){return _.resolve(C()).then(function(){throw b})})},f.prototype.catch=function(C){return this.then(null,C)},f.prototype.then=function(C,_){if(typeof C!="function"&&this.state===c||typeof _!="function"&&this.state===l)return this;var b=new this.constructor(s);return this.state!==d?g(b,this.state===c?C:_,this.outcome):this.queue.push(new h(b,C,_)),b},h.prototype.callFulfilled=function(C){a.resolve(this.promise,C)},h.prototype.otherCallFulfilled=function(C){g(this.promise,this.onFulfilled,C)},h.prototype.callRejected=function(C){a.reject(this.promise,C)},h.prototype.otherCallRejected=function(C){g(this.promise,this.onRejected,C)},a.resolve=function(C,_){var b=k(m,_);if(b.status==="error")return a.reject(C,b.value);var w=b.value;if(w)v(C,w);else{C.state=c,C.outcome=_;for(var T=-1,L=C.queue.length;++T<L;)C.queue[T].callFulfilled(_)}return C},a.reject=function(C,_){C.state=l,C.outcome=_;for(var b=-1,w=C.queue.length;++b<w;)C.queue[b].callRejected(_);return C},f.resolve=function(C){return C instanceof this?C:a.resolve(new this(s),C)},f.reject=function(C){var _=new this(s);return a.reject(_,C)},f.all=function(C){var _=this;if(Object.prototype.toString.call(C)!=="[object Array]")return this.reject(new TypeError("must be an array"));var b=C.length,w=!1;if(!b)return this.resolve([]);for(var T=new Array(b),L=0,N=-1,H=new this(s);++N<b;)M(C[N],N);return H;function M(V,q){_.resolve(V).then(function(D){T[q]=D,++L!==b||w||(w=!0,a.resolve(H,T))},function(D){w||(w=!0,a.reject(H,D))})}},f.race=function(C){var _=this;if(Object.prototype.toString.call(C)!=="[object Array]")return this.reject(new TypeError("must be an array"));var b=C.length,w=!1;if(!b)return this.resolve([]);for(var T=-1,L=new this(s);++T<b;)N=C[T],_.resolve(N).then(function(H){w||(w=!0,a.resolve(L,H))},function(H){w||(w=!0,a.reject(L,H))});var N;return L}},{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"),c=n("./zlib/zstream"),d=Object.prototype.toString,f=0,h=-1,g=0,m=8;function v(C){if(!(this instanceof v))return new v(C);this.options=s.assign({level:h,method:m,chunkSize:16384,windowBits:15,memLevel:8,strategy:g,to:""},C||{});var _=this.options;_.raw&&0<_.windowBits?_.windowBits=-_.windowBits:_.gzip&&0<_.windowBits&&_.windowBits<16&&(_.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new c,this.strm.avail_out=0;var b=i.deflateInit2(this.strm,_.level,_.method,_.windowBits,_.memLevel,_.strategy);if(b!==f)throw new Error(l[b]);if(_.header&&i.deflateSetHeader(this.strm,_.header),_.dictionary){var w;if(w=typeof _.dictionary=="string"?a.string2buf(_.dictionary):d.call(_.dictionary)==="[object ArrayBuffer]"?new Uint8Array(_.dictionary):_.dictionary,(b=i.deflateSetDictionary(this.strm,w))!==f)throw new Error(l[b]);this._dict_set=!0}}function k(C,_){var b=new v(_);if(b.push(C,!0),b.err)throw b.msg||l[b.err];return b.result}v.prototype.push=function(C,_){var b,w,T=this.strm,L=this.options.chunkSize;if(this.ended)return!1;w=_===~~_?_:_===!0?4:0,typeof C=="string"?T.input=a.string2buf(C):d.call(C)==="[object ArrayBuffer]"?T.input=new Uint8Array(C):T.input=C,T.next_in=0,T.avail_in=T.input.length;do{if(T.avail_out===0&&(T.output=new s.Buf8(L),T.next_out=0,T.avail_out=L),(b=i.deflate(T,w))!==1&&b!==f)return this.onEnd(b),!(this.ended=!0);T.avail_out!==0&&(T.avail_in!==0||w!==4&&w!==2)||(this.options.to==="string"?this.onData(a.buf2binstring(s.shrinkBuf(T.output,T.next_out))):this.onData(s.shrinkBuf(T.output,T.next_out)))}while((0<T.avail_in||T.avail_out===0)&&b!==1);return w===4?(b=i.deflateEnd(this.strm),this.onEnd(b),this.ended=!0,b===f):w!==2||(this.onEnd(f),!(T.avail_out=0))},v.prototype.onData=function(C){this.chunks.push(C)},v.prototype.onEnd=function(C){C===f&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=s.flattenChunks(this.chunks)),this.chunks=[],this.err=C,this.msg=this.strm.msg},o.Deflate=v,o.deflate=k,o.deflateRaw=function(C,_){return(_=_||{}).raw=!0,k(C,_)},o.gzip=function(C,_){return(_=_||{}).gzip=!0,k(C,_)}},{"./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"),c=n("./zlib/messages"),d=n("./zlib/zstream"),f=n("./zlib/gzheader"),h=Object.prototype.toString;function g(v){if(!(this instanceof g))return new g(v);this.options=s.assign({chunkSize:16384,windowBits:0,to:""},v||{});var k=this.options;k.raw&&0<=k.windowBits&&k.windowBits<16&&(k.windowBits=-k.windowBits,k.windowBits===0&&(k.windowBits=-15)),!(0<=k.windowBits&&k.windowBits<16)||v&&v.windowBits||(k.windowBits+=32),15<k.windowBits&&k.windowBits<48&&(15&k.windowBits)==0&&(k.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new d,this.strm.avail_out=0;var C=i.inflateInit2(this.strm,k.windowBits);if(C!==l.Z_OK)throw new Error(c[C]);this.header=new f,i.inflateGetHeader(this.strm,this.header)}function m(v,k){var C=new g(k);if(C.push(v,!0),C.err)throw C.msg||c[C.err];return C.result}g.prototype.push=function(v,k){var C,_,b,w,T,L,N=this.strm,H=this.options.chunkSize,M=this.options.dictionary,V=!1;if(this.ended)return!1;_=k===~~k?k:k===!0?l.Z_FINISH:l.Z_NO_FLUSH,typeof v=="string"?N.input=a.binstring2buf(v):h.call(v)==="[object ArrayBuffer]"?N.input=new Uint8Array(v):N.input=v,N.next_in=0,N.avail_in=N.input.length;do{if(N.avail_out===0&&(N.output=new s.Buf8(H),N.next_out=0,N.avail_out=H),(C=i.inflate(N,l.Z_NO_FLUSH))===l.Z_NEED_DICT&&M&&(L=typeof M=="string"?a.string2buf(M):h.call(M)==="[object ArrayBuffer]"?new Uint8Array(M):M,C=i.inflateSetDictionary(this.strm,L)),C===l.Z_BUF_ERROR&&V===!0&&(C=l.Z_OK,V=!1),C!==l.Z_STREAM_END&&C!==l.Z_OK)return this.onEnd(C),!(this.ended=!0);N.next_out&&(N.avail_out!==0&&C!==l.Z_STREAM_END&&(N.avail_in!==0||_!==l.Z_FINISH&&_!==l.Z_SYNC_FLUSH)||(this.options.to==="string"?(b=a.utf8border(N.output,N.next_out),w=N.next_out-b,T=a.buf2string(N.output,b),N.next_out=w,N.avail_out=H-w,w&&s.arraySet(N.output,N.output,b,w,0),this.onData(T)):this.onData(s.shrinkBuf(N.output,N.next_out)))),N.avail_in===0&&N.avail_out===0&&(V=!0)}while((0<N.avail_in||N.avail_out===0)&&C!==l.Z_STREAM_END);return C===l.Z_STREAM_END&&(_=l.Z_FINISH),_===l.Z_FINISH?(C=i.inflateEnd(this.strm),this.onEnd(C),this.ended=!0,C===l.Z_OK):_!==l.Z_SYNC_FLUSH||(this.onEnd(l.Z_OK),!(N.avail_out=0))},g.prototype.onData=function(v){this.chunks.push(v)},g.prototype.onEnd=function(v){v===l.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=s.flattenChunks(this.chunks)),this.chunks=[],this.err=v,this.msg=this.strm.msg},o.Inflate=g,o.inflate=m,o.inflateRaw=function(v,k){return(k=k||{}).raw=!0,m(v,k)},o.ungzip=m},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(n,r,o){"use strict";var i=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";o.assign=function(l){for(var c=Array.prototype.slice.call(arguments,1);c.length;){var d=c.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,c){return l.length===c?l:l.subarray?l.subarray(0,c):(l.length=c,l)};var s={arraySet:function(l,c,d,f,h){if(c.subarray&&l.subarray)l.set(c.subarray(d,d+f),h);else for(var g=0;g<f;g++)l[h+g]=c[d+g]},flattenChunks:function(l){var c,d,f,h,g,m;for(c=f=0,d=l.length;c<d;c++)f+=l[c].length;for(m=new Uint8Array(f),c=h=0,d=l.length;c<d;c++)g=l[c],m.set(g,h),h+=g.length;return m}},a={arraySet:function(l,c,d,f,h){for(var g=0;g<f;g++)l[h+g]=c[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),c=0;c<256;c++)l[c]=252<=c?6:248<=c?5:240<=c?4:224<=c?3:192<=c?2:1;function d(f,h){if(h<65537&&(f.subarray&&a||!f.subarray&&s))return String.fromCharCode.apply(null,i.shrinkBuf(f,h));for(var g="",m=0;m<h;m++)g+=String.fromCharCode(f[m]);return g}l[254]=l[254]=1,o.string2buf=function(f){var h,g,m,v,k,C=f.length,_=0;for(v=0;v<C;v++)(64512&(g=f.charCodeAt(v)))==55296&&v+1<C&&(64512&(m=f.charCodeAt(v+1)))==56320&&(g=65536+(g-55296<<10)+(m-56320),v++),_+=g<128?1:g<2048?2:g<65536?3:4;for(h=new i.Buf8(_),v=k=0;k<_;v++)(64512&(g=f.charCodeAt(v)))==55296&&v+1<C&&(64512&(m=f.charCodeAt(v+1)))==56320&&(g=65536+(g-55296<<10)+(m-56320),v++),g<128?h[k++]=g:(g<2048?h[k++]=192|g>>>6:(g<65536?h[k++]=224|g>>>12:(h[k++]=240|g>>>18,h[k++]=128|g>>>12&63),h[k++]=128|g>>>6&63),h[k++]=128|63&g);return h},o.buf2binstring=function(f){return d(f,f.length)},o.binstring2buf=function(f){for(var h=new i.Buf8(f.length),g=0,m=h.length;g<m;g++)h[g]=f.charCodeAt(g);return h},o.buf2string=function(f,h){var g,m,v,k,C=h||f.length,_=new Array(2*C);for(g=m=0;g<C;)if((v=f[g++])<128)_[m++]=v;else if(4<(k=l[v]))_[m++]=65533,g+=k-1;else{for(v&=k===2?31:k===3?15:7;1<k&&g<C;)v=v<<6|63&f[g++],k--;1<k?_[m++]=65533:v<65536?_[m++]=v:(v-=65536,_[m++]=55296|v>>10&1023,_[m++]=56320|1023&v)}return d(_,m)},o.utf8border=function(f,h){var g;for((h=h||f.length)>f.length&&(h=f.length),g=h-1;0<=g&&(192&f[g])==128;)g--;return g<0||g===0?h:g+l[f[g]]>h?g:h}},{"./common":41}],43:[function(n,r,o){"use strict";r.exports=function(i,s,a,l){for(var c=65535&i|0,d=i>>>16&65535|0,f=0;a!==0;){for(a-=f=2e3<a?2e3:a;d=d+(c=c+s[l++]|0)|0,--f;);c%=65521,d%=65521}return c|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 c=0;c<8;c++)s=1&s?3988292384^s>>>1:s>>>1;a[l]=s}return a})();r.exports=function(s,a,l,c){var d=i,f=c+l;s^=-1;for(var h=c;h<f;h++)s=s>>>8^d[255&(s^a[h])];return-1^s}},{}],46:[function(n,r,o){"use strict";var i,s=n("../utils/common"),a=n("./trees"),l=n("./adler32"),c=n("./crc32"),d=n("./messages"),f=0,h=4,g=0,m=-2,v=-1,k=4,C=2,_=8,b=9,w=286,T=30,L=19,N=2*w+1,H=15,M=3,V=258,q=V+M+1,D=42,B=113,E=1,j=2,J=3,Y=4;function se(S,ne){return S.msg=d[ne],ne}function pe(S){return(S<<1)-(4<S?9:0)}function Ve(S){for(var ne=S.length;0<=--ne;)S[ne]=0}function ge(S){var ne=S.state,O=ne.pending;O>S.avail_out&&(O=S.avail_out),O!==0&&(s.arraySet(S.output,ne.pending_buf,ne.pending_out,O,S.next_out),S.next_out+=O,ne.pending_out+=O,S.total_out+=O,S.avail_out-=O,ne.pending-=O,ne.pending===0&&(ne.pending_out=0))}function be(S,ne){a._tr_flush_block(S,0<=S.block_start?S.block_start:-1,S.strstart-S.block_start,ne),S.block_start=S.strstart,ge(S.strm)}function ve(S,ne){S.pending_buf[S.pending++]=ne}function ke(S,ne){S.pending_buf[S.pending++]=ne>>>8&255,S.pending_buf[S.pending++]=255&ne}function oe(S,ne){var O,P,U=S.max_chain_length,$=S.strstart,Q=S.prev_length,Z=S.nice_match,K=S.strstart>S.w_size-q?S.strstart-(S.w_size-q):0,me=S.window,xe=S.w_mask,he=S.prev,Pe=S.strstart+V,Je=me[$+Q-1],nt=me[$+Q];S.prev_length>=S.good_match&&(U>>=2),Z>S.lookahead&&(Z=S.lookahead);do if(me[(O=ne)+Q]===nt&&me[O+Q-1]===Je&&me[O]===me[$]&&me[++O]===me[$+1]){$+=2,O++;do;while(me[++$]===me[++O]&&me[++$]===me[++O]&&me[++$]===me[++O]&&me[++$]===me[++O]&&me[++$]===me[++O]&&me[++$]===me[++O]&&me[++$]===me[++O]&&me[++$]===me[++O]&&$<Pe);if(P=V-(Pe-$),$=Pe-V,Q<P){if(S.match_start=ne,Z<=(Q=P))break;Je=me[$+Q-1],nt=me[$+Q]}}while((ne=he[ne&xe])>K&&--U!=0);return Q<=S.lookahead?Q:S.lookahead}function Re(S){var ne,O,P,U,$,Q,Z,K,me,xe,he=S.w_size;do{if(U=S.window_size-S.lookahead-S.strstart,S.strstart>=he+(he-q)){for(s.arraySet(S.window,S.window,he,he,0),S.match_start-=he,S.strstart-=he,S.block_start-=he,ne=O=S.hash_size;P=S.head[--ne],S.head[ne]=he<=P?P-he:0,--O;);for(ne=O=he;P=S.prev[--ne],S.prev[ne]=he<=P?P-he:0,--O;);U+=he}if(S.strm.avail_in===0)break;if(Q=S.strm,Z=S.window,K=S.strstart+S.lookahead,me=U,xe=void 0,xe=Q.avail_in,me<xe&&(xe=me),O=xe===0?0:(Q.avail_in-=xe,s.arraySet(Z,Q.input,Q.next_in,xe,K),Q.state.wrap===1?Q.adler=l(Q.adler,Z,xe,K):Q.state.wrap===2&&(Q.adler=c(Q.adler,Z,xe,K)),Q.next_in+=xe,Q.total_in+=xe,xe),S.lookahead+=O,S.lookahead+S.insert>=M)for($=S.strstart-S.insert,S.ins_h=S.window[$],S.ins_h=(S.ins_h<<S.hash_shift^S.window[$+1])&S.hash_mask;S.insert&&(S.ins_h=(S.ins_h<<S.hash_shift^S.window[$+M-1])&S.hash_mask,S.prev[$&S.w_mask]=S.head[S.ins_h],S.head[S.ins_h]=$,$++,S.insert--,!(S.lookahead+S.insert<M)););}while(S.lookahead<q&&S.strm.avail_in!==0)}function je(S,ne){for(var O,P;;){if(S.lookahead<q){if(Re(S),S.lookahead<q&&ne===f)return E;if(S.lookahead===0)break}if(O=0,S.lookahead>=M&&(S.ins_h=(S.ins_h<<S.hash_shift^S.window[S.strstart+M-1])&S.hash_mask,O=S.prev[S.strstart&S.w_mask]=S.head[S.ins_h],S.head[S.ins_h]=S.strstart),O!==0&&S.strstart-O<=S.w_size-q&&(S.match_length=oe(S,O)),S.match_length>=M)if(P=a._tr_tally(S,S.strstart-S.match_start,S.match_length-M),S.lookahead-=S.match_length,S.match_length<=S.max_lazy_match&&S.lookahead>=M){for(S.match_length--;S.strstart++,S.ins_h=(S.ins_h<<S.hash_shift^S.window[S.strstart+M-1])&S.hash_mask,O=S.prev[S.strstart&S.w_mask]=S.head[S.ins_h],S.head[S.ins_h]=S.strstart,--S.match_length!=0;);S.strstart++}else S.strstart+=S.match_length,S.match_length=0,S.ins_h=S.window[S.strstart],S.ins_h=(S.ins_h<<S.hash_shift^S.window[S.strstart+1])&S.hash_mask;else P=a._tr_tally(S,0,S.window[S.strstart]),S.lookahead--,S.strstart++;if(P&&(be(S,!1),S.strm.avail_out===0))return E}return S.insert=S.strstart<M-1?S.strstart:M-1,ne===h?(be(S,!0),S.strm.avail_out===0?J:Y):S.last_lit&&(be(S,!1),S.strm.avail_out===0)?E:j}function tt(S,ne){for(var O,P,U;;){if(S.lookahead<q){if(Re(S),S.lookahead<q&&ne===f)return E;if(S.lookahead===0)break}if(O=0,S.lookahead>=M&&(S.ins_h=(S.ins_h<<S.hash_shift^S.window[S.strstart+M-1])&S.hash_mask,O=S.prev[S.strstart&S.w_mask]=S.head[S.ins_h],S.head[S.ins_h]=S.strstart),S.prev_length=S.match_length,S.prev_match=S.match_start,S.match_length=M-1,O!==0&&S.prev_length<S.max_lazy_match&&S.strstart-O<=S.w_size-q&&(S.match_length=oe(S,O),S.match_length<=5&&(S.strategy===1||S.match_length===M&&4096<S.strstart-S.match_start)&&(S.match_length=M-1)),S.prev_length>=M&&S.match_length<=S.prev_length){for(U=S.strstart+S.lookahead-M,P=a._tr_tally(S,S.strstart-1-S.prev_match,S.prev_length-M),S.lookahead-=S.prev_length-1,S.prev_length-=2;++S.strstart<=U&&(S.ins_h=(S.ins_h<<S.hash_shift^S.window[S.strstart+M-1])&S.hash_mask,O=S.prev[S.strstart&S.w_mask]=S.head[S.ins_h],S.head[S.ins_h]=S.strstart),--S.prev_length!=0;);if(S.match_available=0,S.match_length=M-1,S.strstart++,P&&(be(S,!1),S.strm.avail_out===0))return E}else if(S.match_available){if((P=a._tr_tally(S,0,S.window[S.strstart-1]))&&be(S,!1),S.strstart++,S.lookahead--,S.strm.avail_out===0)return E}else S.match_available=1,S.strstart++,S.lookahead--}return S.match_available&&(P=a._tr_tally(S,0,S.window[S.strstart-1]),S.match_available=0),S.insert=S.strstart<M-1?S.strstart:M-1,ne===h?(be(S,!0),S.strm.avail_out===0?J:Y):S.last_lit&&(be(S,!1),S.strm.avail_out===0)?E:j}function wt(S,ne,O,P,U){this.good_length=S,this.max_lazy=ne,this.nice_length=O,this.max_chain=P,this.func=U}function Te(){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=_,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*N),this.dyn_dtree=new s.Buf16(2*(2*T+1)),this.bl_tree=new s.Buf16(2*(2*L+1)),Ve(this.dyn_ltree),Ve(this.dyn_dtree),Ve(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new s.Buf16(H+1),this.heap=new s.Buf16(2*w+1),Ve(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new s.Buf16(2*w+1),Ve(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 We(S){var ne;return S&&S.state?(S.total_in=S.total_out=0,S.data_type=C,(ne=S.state).pending=0,ne.pending_out=0,ne.wrap<0&&(ne.wrap=-ne.wrap),ne.status=ne.wrap?D:B,S.adler=ne.wrap===2?0:1,ne.last_flush=f,a._tr_init(ne),g):se(S,m)}function Ye(S){var ne=We(S);return ne===g&&(function(O){O.window_size=2*O.w_size,Ve(O.head),O.max_lazy_match=i[O.level].max_lazy,O.good_match=i[O.level].good_length,O.nice_match=i[O.level].nice_length,O.max_chain_length=i[O.level].max_chain,O.strstart=0,O.block_start=0,O.lookahead=0,O.insert=0,O.match_length=O.prev_length=M-1,O.match_available=0,O.ins_h=0})(S.state),ne}function ee(S,ne,O,P,U,$){if(!S)return m;var Q=1;if(ne===v&&(ne=6),P<0?(Q=0,P=-P):15<P&&(Q=2,P-=16),U<1||b<U||O!==_||P<8||15<P||ne<0||9<ne||$<0||k<$)return se(S,m);P===8&&(P=9);var Z=new Te;return(S.state=Z).strm=S,Z.wrap=Q,Z.gzhead=null,Z.w_bits=P,Z.w_size=1<<Z.w_bits,Z.w_mask=Z.w_size-1,Z.hash_bits=U+7,Z.hash_size=1<<Z.hash_bits,Z.hash_mask=Z.hash_size-1,Z.hash_shift=~~((Z.hash_bits+M-1)/M),Z.window=new s.Buf8(2*Z.w_size),Z.head=new s.Buf16(Z.hash_size),Z.prev=new s.Buf16(Z.w_size),Z.lit_bufsize=1<<U+6,Z.pending_buf_size=4*Z.lit_bufsize,Z.pending_buf=new s.Buf8(Z.pending_buf_size),Z.d_buf=1*Z.lit_bufsize,Z.l_buf=3*Z.lit_bufsize,Z.level=ne,Z.strategy=$,Z.method=O,Ye(S)}i=[new wt(0,0,0,0,function(S,ne){var O=65535;for(O>S.pending_buf_size-5&&(O=S.pending_buf_size-5);;){if(S.lookahead<=1){if(Re(S),S.lookahead===0&&ne===f)return E;if(S.lookahead===0)break}S.strstart+=S.lookahead,S.lookahead=0;var P=S.block_start+O;if((S.strstart===0||S.strstart>=P)&&(S.lookahead=S.strstart-P,S.strstart=P,be(S,!1),S.strm.avail_out===0)||S.strstart-S.block_start>=S.w_size-q&&(be(S,!1),S.strm.avail_out===0))return E}return S.insert=0,ne===h?(be(S,!0),S.strm.avail_out===0?J:Y):(S.strstart>S.block_start&&(be(S,!1),S.strm.avail_out),E)}),new wt(4,4,8,4,je),new wt(4,5,16,8,je),new wt(4,6,32,32,je),new wt(4,4,16,16,tt),new wt(8,16,32,32,tt),new wt(8,16,128,128,tt),new wt(8,32,128,256,tt),new wt(32,128,258,1024,tt),new wt(32,258,258,4096,tt)],o.deflateInit=function(S,ne){return ee(S,ne,_,15,8,0)},o.deflateInit2=ee,o.deflateReset=Ye,o.deflateResetKeep=We,o.deflateSetHeader=function(S,ne){return S&&S.state?S.state.wrap!==2?m:(S.state.gzhead=ne,g):m},o.deflate=function(S,ne){var O,P,U,$;if(!S||!S.state||5<ne||ne<0)return S?se(S,m):m;if(P=S.state,!S.output||!S.input&&S.avail_in!==0||P.status===666&&ne!==h)return se(S,S.avail_out===0?-5:m);if(P.strm=S,O=P.last_flush,P.last_flush=ne,P.status===D)if(P.wrap===2)S.adler=0,ve(P,31),ve(P,139),ve(P,8),P.gzhead?(ve(P,(P.gzhead.text?1:0)+(P.gzhead.hcrc?2:0)+(P.gzhead.extra?4:0)+(P.gzhead.name?8:0)+(P.gzhead.comment?16:0)),ve(P,255&P.gzhead.time),ve(P,P.gzhead.time>>8&255),ve(P,P.gzhead.time>>16&255),ve(P,P.gzhead.time>>24&255),ve(P,P.level===9?2:2<=P.strategy||P.level<2?4:0),ve(P,255&P.gzhead.os),P.gzhead.extra&&P.gzhead.extra.length&&(ve(P,255&P.gzhead.extra.length),ve(P,P.gzhead.extra.length>>8&255)),P.gzhead.hcrc&&(S.adler=c(S.adler,P.pending_buf,P.pending,0)),P.gzindex=0,P.status=69):(ve(P,0),ve(P,0),ve(P,0),ve(P,0),ve(P,0),ve(P,P.level===9?2:2<=P.strategy||P.level<2?4:0),ve(P,3),P.status=B);else{var Q=_+(P.w_bits-8<<4)<<8;Q|=(2<=P.strategy||P.level<2?0:P.level<6?1:P.level===6?2:3)<<6,P.strstart!==0&&(Q|=32),Q+=31-Q%31,P.status=B,ke(P,Q),P.strstart!==0&&(ke(P,S.adler>>>16),ke(P,65535&S.adler)),S.adler=1}if(P.status===69)if(P.gzhead.extra){for(U=P.pending;P.gzindex<(65535&P.gzhead.extra.length)&&(P.pending!==P.pending_buf_size||(P.gzhead.hcrc&&P.pending>U&&(S.adler=c(S.adler,P.pending_buf,P.pending-U,U)),ge(S),U=P.pending,P.pending!==P.pending_buf_size));)ve(P,255&P.gzhead.extra[P.gzindex]),P.gzindex++;P.gzhead.hcrc&&P.pending>U&&(S.adler=c(S.adler,P.pending_buf,P.pending-U,U)),P.gzindex===P.gzhead.extra.length&&(P.gzindex=0,P.status=73)}else P.status=73;if(P.status===73)if(P.gzhead.name){U=P.pending;do{if(P.pending===P.pending_buf_size&&(P.gzhead.hcrc&&P.pending>U&&(S.adler=c(S.adler,P.pending_buf,P.pending-U,U)),ge(S),U=P.pending,P.pending===P.pending_buf_size)){$=1;break}$=P.gzindex<P.gzhead.name.length?255&P.gzhead.name.charCodeAt(P.gzindex++):0,ve(P,$)}while($!==0);P.gzhead.hcrc&&P.pending>U&&(S.adler=c(S.adler,P.pending_buf,P.pending-U,U)),$===0&&(P.gzindex=0,P.status=91)}else P.status=91;if(P.status===91)if(P.gzhead.comment){U=P.pending;do{if(P.pending===P.pending_buf_size&&(P.gzhead.hcrc&&P.pending>U&&(S.adler=c(S.adler,P.pending_buf,P.pending-U,U)),ge(S),U=P.pending,P.pending===P.pending_buf_size)){$=1;break}$=P.gzindex<P.gzhead.comment.length?255&P.gzhead.comment.charCodeAt(P.gzindex++):0,ve(P,$)}while($!==0);P.gzhead.hcrc&&P.pending>U&&(S.adler=c(S.adler,P.pending_buf,P.pending-U,U)),$===0&&(P.status=103)}else P.status=103;if(P.status===103&&(P.gzhead.hcrc?(P.pending+2>P.pending_buf_size&&ge(S),P.pending+2<=P.pending_buf_size&&(ve(P,255&S.adler),ve(P,S.adler>>8&255),S.adler=0,P.status=B)):P.status=B),P.pending!==0){if(ge(S),S.avail_out===0)return P.last_flush=-1,g}else if(S.avail_in===0&&pe(ne)<=pe(O)&&ne!==h)return se(S,-5);if(P.status===666&&S.avail_in!==0)return se(S,-5);if(S.avail_in!==0||P.lookahead!==0||ne!==f&&P.status!==666){var Z=P.strategy===2?(function(K,me){for(var xe;;){if(K.lookahead===0&&(Re(K),K.lookahead===0)){if(me===f)return E;break}if(K.match_length=0,xe=a._tr_tally(K,0,K.window[K.strstart]),K.lookahead--,K.strstart++,xe&&(be(K,!1),K.strm.avail_out===0))return E}return K.insert=0,me===h?(be(K,!0),K.strm.avail_out===0?J:Y):K.last_lit&&(be(K,!1),K.strm.avail_out===0)?E:j})(P,ne):P.strategy===3?(function(K,me){for(var xe,he,Pe,Je,nt=K.window;;){if(K.lookahead<=V){if(Re(K),K.lookahead<=V&&me===f)return E;if(K.lookahead===0)break}if(K.match_length=0,K.lookahead>=M&&0<K.strstart&&(he=nt[Pe=K.strstart-1])===nt[++Pe]&&he===nt[++Pe]&&he===nt[++Pe]){Je=K.strstart+V;do;while(he===nt[++Pe]&&he===nt[++Pe]&&he===nt[++Pe]&&he===nt[++Pe]&&he===nt[++Pe]&&he===nt[++Pe]&&he===nt[++Pe]&&he===nt[++Pe]&&Pe<Je);K.match_length=V-(Je-Pe),K.match_length>K.lookahead&&(K.match_length=K.lookahead)}if(K.match_length>=M?(xe=a._tr_tally(K,1,K.match_length-M),K.lookahead-=K.match_length,K.strstart+=K.match_length,K.match_length=0):(xe=a._tr_tally(K,0,K.window[K.strstart]),K.lookahead--,K.strstart++),xe&&(be(K,!1),K.strm.avail_out===0))return E}return K.insert=0,me===h?(be(K,!0),K.strm.avail_out===0?J:Y):K.last_lit&&(be(K,!1),K.strm.avail_out===0)?E:j})(P,ne):i[P.level].func(P,ne);if(Z!==J&&Z!==Y||(P.status=666),Z===E||Z===J)return S.avail_out===0&&(P.last_flush=-1),g;if(Z===j&&(ne===1?a._tr_align(P):ne!==5&&(a._tr_stored_block(P,0,0,!1),ne===3&&(Ve(P.head),P.lookahead===0&&(P.strstart=0,P.block_start=0,P.insert=0))),ge(S),S.avail_out===0))return P.last_flush=-1,g}return ne!==h?g:P.wrap<=0?1:(P.wrap===2?(ve(P,255&S.adler),ve(P,S.adler>>8&255),ve(P,S.adler>>16&255),ve(P,S.adler>>24&255),ve(P,255&S.total_in),ve(P,S.total_in>>8&255),ve(P,S.total_in>>16&255),ve(P,S.total_in>>24&255)):(ke(P,S.adler>>>16),ke(P,65535&S.adler)),ge(S),0<P.wrap&&(P.wrap=-P.wrap),P.pending!==0?g:1)},o.deflateEnd=function(S){var ne;return S&&S.state?(ne=S.state.status)!==D&&ne!==69&&ne!==73&&ne!==91&&ne!==103&&ne!==B&&ne!==666?se(S,m):(S.state=null,ne===B?se(S,-3):g):m},o.deflateSetDictionary=function(S,ne){var O,P,U,$,Q,Z,K,me,xe=ne.length;if(!S||!S.state||($=(O=S.state).wrap)===2||$===1&&O.status!==D||O.lookahead)return m;for($===1&&(S.adler=l(S.adler,ne,xe,0)),O.wrap=0,xe>=O.w_size&&($===0&&(Ve(O.head),O.strstart=0,O.block_start=0,O.insert=0),me=new s.Buf8(O.w_size),s.arraySet(me,ne,xe-O.w_size,O.w_size,0),ne=me,xe=O.w_size),Q=S.avail_in,Z=S.next_in,K=S.input,S.avail_in=xe,S.next_in=0,S.input=ne,Re(O);O.lookahead>=M;){for(P=O.strstart,U=O.lookahead-(M-1);O.ins_h=(O.ins_h<<O.hash_shift^O.window[P+M-1])&O.hash_mask,O.prev[P&O.w_mask]=O.head[O.ins_h],O.head[O.ins_h]=P,P++,--U;);O.strstart=P,O.lookahead=M-1,Re(O)}return O.strstart+=O.lookahead,O.block_start=O.strstart,O.insert=O.lookahead,O.lookahead=0,O.match_length=O.prev_length=M-1,O.match_available=0,S.next_in=Z,S.input=K,S.avail_in=Q,O.wrap=$,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,c,d,f,h,g,m,v,k,C,_,b,w,T,L,N,H,M,V,q,D,B,E=i.input,j;c=l+(i.avail_in-5),d=i.next_out,j=i.output,f=d-(s-i.avail_out),h=d+(i.avail_out-257),g=a.dmax,m=a.wsize,v=a.whave,k=a.wnext,C=a.window,_=a.hold,b=a.bits,w=a.lencode,T=a.distcode,L=(1<<a.lenbits)-1,N=(1<<a.distbits)-1;e:do{b<15&&(_+=E[l++]<<b,b+=8,_+=E[l++]<<b,b+=8),H=w[_&L];t:for(;;){if(_>>>=M=H>>>24,b-=M,(M=H>>>16&255)===0)j[d++]=65535&H;else{if(!(16&M)){if((64&M)==0){H=w[(65535&H)+(_&(1<<M)-1)];continue t}if(32&M){a.mode=12;break e}i.msg="invalid literal/length code",a.mode=30;break e}V=65535&H,(M&=15)&&(b<M&&(_+=E[l++]<<b,b+=8),V+=_&(1<<M)-1,_>>>=M,b-=M),b<15&&(_+=E[l++]<<b,b+=8,_+=E[l++]<<b,b+=8),H=T[_&N];n:for(;;){if(_>>>=M=H>>>24,b-=M,!(16&(M=H>>>16&255))){if((64&M)==0){H=T[(65535&H)+(_&(1<<M)-1)];continue n}i.msg="invalid distance code",a.mode=30;break e}if(q=65535&H,b<(M&=15)&&(_+=E[l++]<<b,(b+=8)<M&&(_+=E[l++]<<b,b+=8)),g<(q+=_&(1<<M)-1)){i.msg="invalid distance too far back",a.mode=30;break e}if(_>>>=M,b-=M,(M=d-f)<q){if(v<(M=q-M)&&a.sane){i.msg="invalid distance too far back",a.mode=30;break e}if(B=C,(D=0)===k){if(D+=m-M,M<V){for(V-=M;j[d++]=C[D++],--M;);D=d-q,B=j}}else if(k<M){if(D+=m+k-M,(M-=k)<V){for(V-=M;j[d++]=C[D++],--M;);if(D=0,k<V){for(V-=M=k;j[d++]=C[D++],--M;);D=d-q,B=j}}}else if(D+=k-M,M<V){for(V-=M;j[d++]=C[D++],--M;);D=d-q,B=j}for(;2<V;)j[d++]=B[D++],j[d++]=B[D++],j[d++]=B[D++],V-=3;V&&(j[d++]=B[D++],1<V&&(j[d++]=B[D++]))}else{for(D=d-q;j[d++]=j[D++],j[d++]=j[D++],j[d++]=j[D++],2<(V-=3););V&&(j[d++]=j[D++],1<V&&(j[d++]=j[D++]))}break}}break}}while(l<c&&d<h);l-=V=b>>3,_&=(1<<(b-=V<<3))-1,i.next_in=l,i.next_out=d,i.avail_in=l<c?c-l+5:5-(l-c),i.avail_out=d<h?h-d+257:257-(d-h),a.hold=_,a.bits=b}},{}],49:[function(n,r,o){"use strict";var i=n("../utils/common"),s=n("./adler32"),a=n("./crc32"),l=n("./inffast"),c=n("./inftrees"),d=1,f=2,h=0,g=-2,m=1,v=852,k=592;function C(D){return(D>>>24&255)+(D>>>8&65280)+((65280&D)<<8)+((255&D)<<24)}function _(){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 b(D){var B;return D&&D.state?(B=D.state,D.total_in=D.total_out=B.total=0,D.msg="",B.wrap&&(D.adler=1&B.wrap),B.mode=m,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(v),B.distcode=B.distdyn=new i.Buf32(k),B.sane=1,B.back=-1,h):g}function w(D){var B;return D&&D.state?((B=D.state).wsize=0,B.whave=0,B.wnext=0,b(D)):g}function T(D,B){var E,j;return D&&D.state?(j=D.state,B<0?(E=0,B=-B):(E=1+(B>>4),B<48&&(B&=15)),B&&(B<8||15<B)?g:(j.window!==null&&j.wbits!==B&&(j.window=null),j.wrap=E,j.wbits=B,w(D))):g}function L(D,B){var E,j;return D?(j=new _,(D.state=j).window=null,(E=T(D,B))!==h&&(D.state=null),E):g}var N,H,M=!0;function V(D){if(M){var B;for(N=new i.Buf32(512),H=new i.Buf32(32),B=0;B<144;)D.lens[B++]=8;for(;B<256;)D.lens[B++]=9;for(;B<280;)D.lens[B++]=7;for(;B<288;)D.lens[B++]=8;for(c(d,D.lens,0,288,N,0,D.work,{bits:9}),B=0;B<32;)D.lens[B++]=5;c(f,D.lens,0,32,H,0,D.work,{bits:5}),M=!1}D.lencode=N,D.lenbits=9,D.distcode=H,D.distbits=5}function q(D,B,E,j){var J,Y=D.state;return Y.window===null&&(Y.wsize=1<<Y.wbits,Y.wnext=0,Y.whave=0,Y.window=new i.Buf8(Y.wsize)),j>=Y.wsize?(i.arraySet(Y.window,B,E-Y.wsize,Y.wsize,0),Y.wnext=0,Y.whave=Y.wsize):(j<(J=Y.wsize-Y.wnext)&&(J=j),i.arraySet(Y.window,B,E-j,J,Y.wnext),(j-=J)?(i.arraySet(Y.window,B,E-j,j,0),Y.wnext=j,Y.whave=Y.wsize):(Y.wnext+=J,Y.wnext===Y.wsize&&(Y.wnext=0),Y.whave<Y.wsize&&(Y.whave+=J))),0}o.inflateReset=w,o.inflateReset2=T,o.inflateResetKeep=b,o.inflateInit=function(D){return L(D,15)},o.inflateInit2=L,o.inflate=function(D,B){var E,j,J,Y,se,pe,Ve,ge,be,ve,ke,oe,Re,je,tt,wt,Te,We,Ye,ee,S,ne,O,P,U=0,$=new i.Buf8(4),Q=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!D||!D.state||!D.output||!D.input&&D.avail_in!==0)return g;(E=D.state).mode===12&&(E.mode=13),se=D.next_out,J=D.output,Ve=D.avail_out,Y=D.next_in,j=D.input,pe=D.avail_in,ge=E.hold,be=E.bits,ve=pe,ke=Ve,ne=h;e:for(;;)switch(E.mode){case m:if(E.wrap===0){E.mode=13;break}for(;be<16;){if(pe===0)break e;pe--,ge+=j[Y++]<<be,be+=8}if(2&E.wrap&&ge===35615){$[E.check=0]=255&ge,$[1]=ge>>>8&255,E.check=a(E.check,$,2,0),be=ge=0,E.mode=2;break}if(E.flags=0,E.head&&(E.head.done=!1),!(1&E.wrap)||(((255&ge)<<8)+(ge>>8))%31){D.msg="incorrect header check",E.mode=30;break}if((15&ge)!=8){D.msg="unknown compression method",E.mode=30;break}if(be-=4,S=8+(15&(ge>>>=4)),E.wbits===0)E.wbits=S;else if(S>E.wbits){D.msg="invalid window size",E.mode=30;break}E.dmax=1<<S,D.adler=E.check=1,E.mode=512&ge?10:12,be=ge=0;break;case 2:for(;be<16;){if(pe===0)break e;pe--,ge+=j[Y++]<<be,be+=8}if(E.flags=ge,(255&E.flags)!=8){D.msg="unknown compression method",E.mode=30;break}if(57344&E.flags){D.msg="unknown header flags set",E.mode=30;break}E.head&&(E.head.text=ge>>8&1),512&E.flags&&($[0]=255&ge,$[1]=ge>>>8&255,E.check=a(E.check,$,2,0)),be=ge=0,E.mode=3;case 3:for(;be<32;){if(pe===0)break e;pe--,ge+=j[Y++]<<be,be+=8}E.head&&(E.head.time=ge),512&E.flags&&($[0]=255&ge,$[1]=ge>>>8&255,$[2]=ge>>>16&255,$[3]=ge>>>24&255,E.check=a(E.check,$,4,0)),be=ge=0,E.mode=4;case 4:for(;be<16;){if(pe===0)break e;pe--,ge+=j[Y++]<<be,be+=8}E.head&&(E.head.xflags=255&ge,E.head.os=ge>>8),512&E.flags&&($[0]=255&ge,$[1]=ge>>>8&255,E.check=a(E.check,$,2,0)),be=ge=0,E.mode=5;case 5:if(1024&E.flags){for(;be<16;){if(pe===0)break e;pe--,ge+=j[Y++]<<be,be+=8}E.length=ge,E.head&&(E.head.extra_len=ge),512&E.flags&&($[0]=255&ge,$[1]=ge>>>8&255,E.check=a(E.check,$,2,0)),be=ge=0}else E.head&&(E.head.extra=null);E.mode=6;case 6:if(1024&E.flags&&(pe<(oe=E.length)&&(oe=pe),oe&&(E.head&&(S=E.head.extra_len-E.length,E.head.extra||(E.head.extra=new Array(E.head.extra_len)),i.arraySet(E.head.extra,j,Y,oe,S)),512&E.flags&&(E.check=a(E.check,j,oe,Y)),pe-=oe,Y+=oe,E.length-=oe),E.length))break e;E.length=0,E.mode=7;case 7:if(2048&E.flags){if(pe===0)break e;for(oe=0;S=j[Y+oe++],E.head&&S&&E.length<65536&&(E.head.name+=String.fromCharCode(S)),S&&oe<pe;);if(512&E.flags&&(E.check=a(E.check,j,oe,Y)),pe-=oe,Y+=oe,S)break e}else E.head&&(E.head.name=null);E.length=0,E.mode=8;case 8:if(4096&E.flags){if(pe===0)break e;for(oe=0;S=j[Y+oe++],E.head&&S&&E.length<65536&&(E.head.comment+=String.fromCharCode(S)),S&&oe<pe;);if(512&E.flags&&(E.check=a(E.check,j,oe,Y)),pe-=oe,Y+=oe,S)break e}else E.head&&(E.head.comment=null);E.mode=9;case 9:if(512&E.flags){for(;be<16;){if(pe===0)break e;pe--,ge+=j[Y++]<<be,be+=8}if(ge!==(65535&E.check)){D.msg="header crc mismatch",E.mode=30;break}be=ge=0}E.head&&(E.head.hcrc=E.flags>>9&1,E.head.done=!0),D.adler=E.check=0,E.mode=12;break;case 10:for(;be<32;){if(pe===0)break e;pe--,ge+=j[Y++]<<be,be+=8}D.adler=E.check=C(ge),be=ge=0,E.mode=11;case 11:if(E.havedict===0)return D.next_out=se,D.avail_out=Ve,D.next_in=Y,D.avail_in=pe,E.hold=ge,E.bits=be,2;D.adler=E.check=1,E.mode=12;case 12:if(B===5||B===6)break e;case 13:if(E.last){ge>>>=7&be,be-=7&be,E.mode=27;break}for(;be<3;){if(pe===0)break e;pe--,ge+=j[Y++]<<be,be+=8}switch(E.last=1&ge,be-=1,3&(ge>>>=1)){case 0:E.mode=14;break;case 1:if(V(E),E.mode=20,B!==6)break;ge>>>=2,be-=2;break e;case 2:E.mode=17;break;case 3:D.msg="invalid block type",E.mode=30}ge>>>=2,be-=2;break;case 14:for(ge>>>=7&be,be-=7&be;be<32;){if(pe===0)break e;pe--,ge+=j[Y++]<<be,be+=8}if((65535&ge)!=(ge>>>16^65535)){D.msg="invalid stored block lengths",E.mode=30;break}if(E.length=65535&ge,be=ge=0,E.mode=15,B===6)break e;case 15:E.mode=16;case 16:if(oe=E.length){if(pe<oe&&(oe=pe),Ve<oe&&(oe=Ve),oe===0)break e;i.arraySet(J,j,Y,oe,se),pe-=oe,Y+=oe,Ve-=oe,se+=oe,E.length-=oe;break}E.mode=12;break;case 17:for(;be<14;){if(pe===0)break e;pe--,ge+=j[Y++]<<be,be+=8}if(E.nlen=257+(31&ge),ge>>>=5,be-=5,E.ndist=1+(31&ge),ge>>>=5,be-=5,E.ncode=4+(15&ge),ge>>>=4,be-=4,286<E.nlen||30<E.ndist){D.msg="too many length or distance symbols",E.mode=30;break}E.have=0,E.mode=18;case 18:for(;E.have<E.ncode;){for(;be<3;){if(pe===0)break e;pe--,ge+=j[Y++]<<be,be+=8}E.lens[Q[E.have++]]=7&ge,ge>>>=3,be-=3}for(;E.have<19;)E.lens[Q[E.have++]]=0;if(E.lencode=E.lendyn,E.lenbits=7,O={bits:E.lenbits},ne=c(0,E.lens,0,19,E.lencode,0,E.work,O),E.lenbits=O.bits,ne){D.msg="invalid code lengths set",E.mode=30;break}E.have=0,E.mode=19;case 19:for(;E.have<E.nlen+E.ndist;){for(;wt=(U=E.lencode[ge&(1<<E.lenbits)-1])>>>16&255,Te=65535&U,!((tt=U>>>24)<=be);){if(pe===0)break e;pe--,ge+=j[Y++]<<be,be+=8}if(Te<16)ge>>>=tt,be-=tt,E.lens[E.have++]=Te;else{if(Te===16){for(P=tt+2;be<P;){if(pe===0)break e;pe--,ge+=j[Y++]<<be,be+=8}if(ge>>>=tt,be-=tt,E.have===0){D.msg="invalid bit length repeat",E.mode=30;break}S=E.lens[E.have-1],oe=3+(3&ge),ge>>>=2,be-=2}else if(Te===17){for(P=tt+3;be<P;){if(pe===0)break e;pe--,ge+=j[Y++]<<be,be+=8}be-=tt,S=0,oe=3+(7&(ge>>>=tt)),ge>>>=3,be-=3}else{for(P=tt+7;be<P;){if(pe===0)break e;pe--,ge+=j[Y++]<<be,be+=8}be-=tt,S=0,oe=11+(127&(ge>>>=tt)),ge>>>=7,be-=7}if(E.have+oe>E.nlen+E.ndist){D.msg="invalid bit length repeat",E.mode=30;break}for(;oe--;)E.lens[E.have++]=S}}if(E.mode===30)break;if(E.lens[256]===0){D.msg="invalid code -- missing end-of-block",E.mode=30;break}if(E.lenbits=9,O={bits:E.lenbits},ne=c(d,E.lens,0,E.nlen,E.lencode,0,E.work,O),E.lenbits=O.bits,ne){D.msg="invalid literal/lengths set",E.mode=30;break}if(E.distbits=6,E.distcode=E.distdyn,O={bits:E.distbits},ne=c(f,E.lens,E.nlen,E.ndist,E.distcode,0,E.work,O),E.distbits=O.bits,ne){D.msg="invalid distances set",E.mode=30;break}if(E.mode=20,B===6)break e;case 20:E.mode=21;case 21:if(6<=pe&&258<=Ve){D.next_out=se,D.avail_out=Ve,D.next_in=Y,D.avail_in=pe,E.hold=ge,E.bits=be,l(D,ke),se=D.next_out,J=D.output,Ve=D.avail_out,Y=D.next_in,j=D.input,pe=D.avail_in,ge=E.hold,be=E.bits,E.mode===12&&(E.back=-1);break}for(E.back=0;wt=(U=E.lencode[ge&(1<<E.lenbits)-1])>>>16&255,Te=65535&U,!((tt=U>>>24)<=be);){if(pe===0)break e;pe--,ge+=j[Y++]<<be,be+=8}if(wt&&(240&wt)==0){for(We=tt,Ye=wt,ee=Te;wt=(U=E.lencode[ee+((ge&(1<<We+Ye)-1)>>We)])>>>16&255,Te=65535&U,!(We+(tt=U>>>24)<=be);){if(pe===0)break e;pe--,ge+=j[Y++]<<be,be+=8}ge>>>=We,be-=We,E.back+=We}if(ge>>>=tt,be-=tt,E.back+=tt,E.length=Te,wt===0){E.mode=26;break}if(32&wt){E.back=-1,E.mode=12;break}if(64&wt){D.msg="invalid literal/length code",E.mode=30;break}E.extra=15&wt,E.mode=22;case 22:if(E.extra){for(P=E.extra;be<P;){if(pe===0)break e;pe--,ge+=j[Y++]<<be,be+=8}E.length+=ge&(1<<E.extra)-1,ge>>>=E.extra,be-=E.extra,E.back+=E.extra}E.was=E.length,E.mode=23;case 23:for(;wt=(U=E.distcode[ge&(1<<E.distbits)-1])>>>16&255,Te=65535&U,!((tt=U>>>24)<=be);){if(pe===0)break e;pe--,ge+=j[Y++]<<be,be+=8}if((240&wt)==0){for(We=tt,Ye=wt,ee=Te;wt=(U=E.distcode[ee+((ge&(1<<We+Ye)-1)>>We)])>>>16&255,Te=65535&U,!(We+(tt=U>>>24)<=be);){if(pe===0)break e;pe--,ge+=j[Y++]<<be,be+=8}ge>>>=We,be-=We,E.back+=We}if(ge>>>=tt,be-=tt,E.back+=tt,64&wt){D.msg="invalid distance code",E.mode=30;break}E.offset=Te,E.extra=15&wt,E.mode=24;case 24:if(E.extra){for(P=E.extra;be<P;){if(pe===0)break e;pe--,ge+=j[Y++]<<be,be+=8}E.offset+=ge&(1<<E.extra)-1,ge>>>=E.extra,be-=E.extra,E.back+=E.extra}if(E.offset>E.dmax){D.msg="invalid distance too far back",E.mode=30;break}E.mode=25;case 25:if(Ve===0)break e;if(oe=ke-Ve,E.offset>oe){if((oe=E.offset-oe)>E.whave&&E.sane){D.msg="invalid distance too far back",E.mode=30;break}Re=oe>E.wnext?(oe-=E.wnext,E.wsize-oe):E.wnext-oe,oe>E.length&&(oe=E.length),je=E.window}else je=J,Re=se-E.offset,oe=E.length;for(Ve<oe&&(oe=Ve),Ve-=oe,E.length-=oe;J[se++]=je[Re++],--oe;);E.length===0&&(E.mode=21);break;case 26:if(Ve===0)break e;J[se++]=E.length,Ve--,E.mode=21;break;case 27:if(E.wrap){for(;be<32;){if(pe===0)break e;pe--,ge|=j[Y++]<<be,be+=8}if(ke-=Ve,D.total_out+=ke,E.total+=ke,ke&&(D.adler=E.check=E.flags?a(E.check,J,ke,se-ke):s(E.check,J,ke,se-ke)),ke=Ve,(E.flags?ge:C(ge))!==E.check){D.msg="incorrect data check",E.mode=30;break}be=ge=0}E.mode=28;case 28:if(E.wrap&&E.flags){for(;be<32;){if(pe===0)break e;pe--,ge+=j[Y++]<<be,be+=8}if(ge!==(4294967295&E.total)){D.msg="incorrect length check",E.mode=30;break}be=ge=0}E.mode=29;case 29:ne=1;break e;case 30:ne=-3;break e;case 31:return-4;default:return g}return D.next_out=se,D.avail_out=Ve,D.next_in=Y,D.avail_in=pe,E.hold=ge,E.bits=be,(E.wsize||ke!==D.avail_out&&E.mode<30&&(E.mode<27||B!==4))&&q(D,D.output,D.next_out,ke-D.avail_out)?(E.mode=31,-4):(ve-=D.avail_in,ke-=D.avail_out,D.total_in+=ve,D.total_out+=ke,E.total+=ke,E.wrap&&ke&&(D.adler=E.check=E.flags?a(E.check,J,ke,D.next_out-ke):s(E.check,J,ke,D.next_out-ke)),D.data_type=E.bits+(E.last?64:0)+(E.mode===12?128:0)+(E.mode===20||E.mode===15?256:0),(ve==0&&ke===0||B===4)&&ne===h&&(ne=-5),ne)},o.inflateEnd=function(D){if(!D||!D.state)return g;var B=D.state;return B.window&&(B.window=null),D.state=null,h},o.inflateGetHeader=function(D,B){var E;return D&&D.state?(2&(E=D.state).wrap)==0?g:((E.head=B).done=!1,h):g},o.inflateSetDictionary=function(D,B){var E,j=B.length;return D&&D.state?(E=D.state).wrap!==0&&E.mode!==11?g:E.mode===11&&s(1,B,j,0)!==E.check?-3:q(D,B,j,j)?(E.mode=31,-4):(E.havedict=1,h):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],c=[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,h,g,m,v,k,C){var _,b,w,T,L,N,H,M,V,q=C.bits,D=0,B=0,E=0,j=0,J=0,Y=0,se=0,pe=0,Ve=0,ge=0,be=null,ve=0,ke=new i.Buf16(16),oe=new i.Buf16(16),Re=null,je=0;for(D=0;D<=15;D++)ke[D]=0;for(B=0;B<g;B++)ke[f[h+B]]++;for(J=q,j=15;1<=j&&ke[j]===0;j--);if(j<J&&(J=j),j===0)return m[v++]=20971520,m[v++]=20971520,C.bits=1,0;for(E=1;E<j&&ke[E]===0;E++);for(J<E&&(J=E),D=pe=1;D<=15;D++)if(pe<<=1,(pe-=ke[D])<0)return-1;if(0<pe&&(d===0||j!==1))return-1;for(oe[1]=0,D=1;D<15;D++)oe[D+1]=oe[D]+ke[D];for(B=0;B<g;B++)f[h+B]!==0&&(k[oe[f[h+B]]++]=B);if(N=d===0?(be=Re=k,19):d===1?(be=s,ve-=257,Re=a,je-=257,256):(be=l,Re=c,-1),D=E,L=v,se=B=ge=0,w=-1,T=(Ve=1<<(Y=J))-1,d===1&&852<Ve||d===2&&592<Ve)return 1;for(;;){for(H=D-se,V=k[B]<N?(M=0,k[B]):k[B]>N?(M=Re[je+k[B]],be[ve+k[B]]):(M=96,0),_=1<<D-se,E=b=1<<Y;m[L+(ge>>se)+(b-=_)]=H<<24|M<<16|V|0,b!==0;);for(_=1<<D-1;ge&_;)_>>=1;if(_!==0?(ge&=_-1,ge+=_):ge=0,B++,--ke[D]==0){if(D===j)break;D=f[h+k[B]]}if(J<D&&(ge&T)!==w){for(se===0&&(se=J),L+=E,pe=1<<(Y=D-se);Y+se<j&&!((pe-=ke[Y+se])<=0);)Y++,pe<<=1;if(Ve+=1<<Y,d===1&&852<Ve||d===2&&592<Ve)return 1;m[w=ge&T]=J<<24|Y<<16|L-v|0}}return ge!==0&&(m[L+ge]=D-se<<24|4194304),C.bits=J,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(U){for(var $=U.length;0<=--$;)U[$]=0}var c=0,d=29,f=256,h=f+1+d,g=30,m=19,v=2*h+1,k=15,C=16,_=7,b=256,w=16,T=17,L=18,N=[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],H=[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],M=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],V=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],q=new Array(2*(h+2));l(q);var D=new Array(2*g);l(D);var B=new Array(512);l(B);var E=new Array(256);l(E);var j=new Array(d);l(j);var J,Y,se,pe=new Array(g);function Ve(U,$,Q,Z,K){this.static_tree=U,this.extra_bits=$,this.extra_base=Q,this.elems=Z,this.max_length=K,this.has_stree=U&&U.length}function ge(U,$){this.dyn_tree=U,this.max_code=0,this.stat_desc=$}function be(U){return U<256?B[U]:B[256+(U>>>7)]}function ve(U,$){U.pending_buf[U.pending++]=255&$,U.pending_buf[U.pending++]=$>>>8&255}function ke(U,$,Q){U.bi_valid>C-Q?(U.bi_buf|=$<<U.bi_valid&65535,ve(U,U.bi_buf),U.bi_buf=$>>C-U.bi_valid,U.bi_valid+=Q-C):(U.bi_buf|=$<<U.bi_valid&65535,U.bi_valid+=Q)}function oe(U,$,Q){ke(U,Q[2*$],Q[2*$+1])}function Re(U,$){for(var Q=0;Q|=1&U,U>>>=1,Q<<=1,0<--$;);return Q>>>1}function je(U,$,Q){var Z,K,me=new Array(k+1),xe=0;for(Z=1;Z<=k;Z++)me[Z]=xe=xe+Q[Z-1]<<1;for(K=0;K<=$;K++){var he=U[2*K+1];he!==0&&(U[2*K]=Re(me[he]++,he))}}function tt(U){var $;for($=0;$<h;$++)U.dyn_ltree[2*$]=0;for($=0;$<g;$++)U.dyn_dtree[2*$]=0;for($=0;$<m;$++)U.bl_tree[2*$]=0;U.dyn_ltree[2*b]=1,U.opt_len=U.static_len=0,U.last_lit=U.matches=0}function wt(U){8<U.bi_valid?ve(U,U.bi_buf):0<U.bi_valid&&(U.pending_buf[U.pending++]=U.bi_buf),U.bi_buf=0,U.bi_valid=0}function Te(U,$,Q,Z){var K=2*$,me=2*Q;return U[K]<U[me]||U[K]===U[me]&&Z[$]<=Z[Q]}function We(U,$,Q){for(var Z=U.heap[Q],K=Q<<1;K<=U.heap_len&&(K<U.heap_len&&Te($,U.heap[K+1],U.heap[K],U.depth)&&K++,!Te($,Z,U.heap[K],U.depth));)U.heap[Q]=U.heap[K],Q=K,K<<=1;U.heap[Q]=Z}function Ye(U,$,Q){var Z,K,me,xe,he=0;if(U.last_lit!==0)for(;Z=U.pending_buf[U.d_buf+2*he]<<8|U.pending_buf[U.d_buf+2*he+1],K=U.pending_buf[U.l_buf+he],he++,Z===0?oe(U,K,$):(oe(U,(me=E[K])+f+1,$),(xe=N[me])!==0&&ke(U,K-=j[me],xe),oe(U,me=be(--Z),Q),(xe=H[me])!==0&&ke(U,Z-=pe[me],xe)),he<U.last_lit;);oe(U,b,$)}function ee(U,$){var Q,Z,K,me=$.dyn_tree,xe=$.stat_desc.static_tree,he=$.stat_desc.has_stree,Pe=$.stat_desc.elems,Je=-1;for(U.heap_len=0,U.heap_max=v,Q=0;Q<Pe;Q++)me[2*Q]!==0?(U.heap[++U.heap_len]=Je=Q,U.depth[Q]=0):me[2*Q+1]=0;for(;U.heap_len<2;)me[2*(K=U.heap[++U.heap_len]=Je<2?++Je:0)]=1,U.depth[K]=0,U.opt_len--,he&&(U.static_len-=xe[2*K+1]);for($.max_code=Je,Q=U.heap_len>>1;1<=Q;Q--)We(U,me,Q);for(K=Pe;Q=U.heap[1],U.heap[1]=U.heap[U.heap_len--],We(U,me,1),Z=U.heap[1],U.heap[--U.heap_max]=Q,U.heap[--U.heap_max]=Z,me[2*K]=me[2*Q]+me[2*Z],U.depth[K]=(U.depth[Q]>=U.depth[Z]?U.depth[Q]:U.depth[Z])+1,me[2*Q+1]=me[2*Z+1]=K,U.heap[1]=K++,We(U,me,1),2<=U.heap_len;);U.heap[--U.heap_max]=U.heap[1],(function(nt,ut){var Ht,He,Vt,Mt,sn,qn,Kt=ut.dyn_tree,Qe=ut.max_code,Pt=ut.stat_desc.static_tree,It=ut.stat_desc.has_stree,Sn=ut.stat_desc.extra_bits,tn=ut.stat_desc.extra_base,hn=ut.stat_desc.max_length,Vn=0;for(Mt=0;Mt<=k;Mt++)nt.bl_count[Mt]=0;for(Kt[2*nt.heap[nt.heap_max]+1]=0,Ht=nt.heap_max+1;Ht<v;Ht++)hn<(Mt=Kt[2*Kt[2*(He=nt.heap[Ht])+1]+1]+1)&&(Mt=hn,Vn++),Kt[2*He+1]=Mt,Qe<He||(nt.bl_count[Mt]++,sn=0,tn<=He&&(sn=Sn[He-tn]),qn=Kt[2*He],nt.opt_len+=qn*(Mt+sn),It&&(nt.static_len+=qn*(Pt[2*He+1]+sn)));if(Vn!==0){do{for(Mt=hn-1;nt.bl_count[Mt]===0;)Mt--;nt.bl_count[Mt]--,nt.bl_count[Mt+1]+=2,nt.bl_count[hn]--,Vn-=2}while(0<Vn);for(Mt=hn;Mt!==0;Mt--)for(He=nt.bl_count[Mt];He!==0;)Qe<(Vt=nt.heap[--Ht])||(Kt[2*Vt+1]!==Mt&&(nt.opt_len+=(Mt-Kt[2*Vt+1])*Kt[2*Vt],Kt[2*Vt+1]=Mt),He--)}})(U,$),je(me,Je,U.bl_count)}function S(U,$,Q){var Z,K,me=-1,xe=$[1],he=0,Pe=7,Je=4;for(xe===0&&(Pe=138,Je=3),$[2*(Q+1)+1]=65535,Z=0;Z<=Q;Z++)K=xe,xe=$[2*(Z+1)+1],++he<Pe&&K===xe||(he<Je?U.bl_tree[2*K]+=he:K!==0?(K!==me&&U.bl_tree[2*K]++,U.bl_tree[2*w]++):he<=10?U.bl_tree[2*T]++:U.bl_tree[2*L]++,me=K,Je=(he=0)===xe?(Pe=138,3):K===xe?(Pe=6,3):(Pe=7,4))}function ne(U,$,Q){var Z,K,me=-1,xe=$[1],he=0,Pe=7,Je=4;for(xe===0&&(Pe=138,Je=3),Z=0;Z<=Q;Z++)if(K=xe,xe=$[2*(Z+1)+1],!(++he<Pe&&K===xe)){if(he<Je)for(;oe(U,K,U.bl_tree),--he!=0;);else K!==0?(K!==me&&(oe(U,K,U.bl_tree),he--),oe(U,w,U.bl_tree),ke(U,he-3,2)):he<=10?(oe(U,T,U.bl_tree),ke(U,he-3,3)):(oe(U,L,U.bl_tree),ke(U,he-11,7));me=K,Je=(he=0)===xe?(Pe=138,3):K===xe?(Pe=6,3):(Pe=7,4)}}l(pe);var O=!1;function P(U,$,Q,Z){ke(U,(c<<1)+(Z?1:0),3),(function(K,me,xe,he){wt(K),he&&(ve(K,xe),ve(K,~xe)),i.arraySet(K.pending_buf,K.window,me,xe,K.pending),K.pending+=xe})(U,$,Q,!0)}o._tr_init=function(U){O||((function(){var $,Q,Z,K,me,xe=new Array(k+1);for(K=Z=0;K<d-1;K++)for(j[K]=Z,$=0;$<1<<N[K];$++)E[Z++]=K;for(E[Z-1]=K,K=me=0;K<16;K++)for(pe[K]=me,$=0;$<1<<H[K];$++)B[me++]=K;for(me>>=7;K<g;K++)for(pe[K]=me<<7,$=0;$<1<<H[K]-7;$++)B[256+me++]=K;for(Q=0;Q<=k;Q++)xe[Q]=0;for($=0;$<=143;)q[2*$+1]=8,$++,xe[8]++;for(;$<=255;)q[2*$+1]=9,$++,xe[9]++;for(;$<=279;)q[2*$+1]=7,$++,xe[7]++;for(;$<=287;)q[2*$+1]=8,$++,xe[8]++;for(je(q,h+1,xe),$=0;$<g;$++)D[2*$+1]=5,D[2*$]=Re($,5);J=new Ve(q,N,f+1,h,k),Y=new Ve(D,H,0,g,k),se=new Ve(new Array(0),M,0,m,_)})(),O=!0),U.l_desc=new ge(U.dyn_ltree,J),U.d_desc=new ge(U.dyn_dtree,Y),U.bl_desc=new ge(U.bl_tree,se),U.bi_buf=0,U.bi_valid=0,tt(U)},o._tr_stored_block=P,o._tr_flush_block=function(U,$,Q,Z){var K,me,xe=0;0<U.level?(U.strm.data_type===2&&(U.strm.data_type=(function(he){var Pe,Je=4093624447;for(Pe=0;Pe<=31;Pe++,Je>>>=1)if(1&Je&&he.dyn_ltree[2*Pe]!==0)return s;if(he.dyn_ltree[18]!==0||he.dyn_ltree[20]!==0||he.dyn_ltree[26]!==0)return a;for(Pe=32;Pe<f;Pe++)if(he.dyn_ltree[2*Pe]!==0)return a;return s})(U)),ee(U,U.l_desc),ee(U,U.d_desc),xe=(function(he){var Pe;for(S(he,he.dyn_ltree,he.l_desc.max_code),S(he,he.dyn_dtree,he.d_desc.max_code),ee(he,he.bl_desc),Pe=m-1;3<=Pe&&he.bl_tree[2*V[Pe]+1]===0;Pe--);return he.opt_len+=3*(Pe+1)+5+5+4,Pe})(U),K=U.opt_len+3+7>>>3,(me=U.static_len+3+7>>>3)<=K&&(K=me)):K=me=Q+5,Q+4<=K&&$!==-1?P(U,$,Q,Z):U.strategy===4||me===K?(ke(U,2+(Z?1:0),3),Ye(U,q,D)):(ke(U,4+(Z?1:0),3),(function(he,Pe,Je,nt){var ut;for(ke(he,Pe-257,5),ke(he,Je-1,5),ke(he,nt-4,4),ut=0;ut<nt;ut++)ke(he,he.bl_tree[2*V[ut]+1],3);ne(he,he.dyn_ltree,Pe-1),ne(he,he.dyn_dtree,Je-1)})(U,U.l_desc.max_code+1,U.d_desc.max_code+1,xe+1),Ye(U,U.dyn_ltree,U.dyn_dtree)),tt(U),Z&&wt(U)},o._tr_tally=function(U,$,Q){return U.pending_buf[U.d_buf+2*U.last_lit]=$>>>8&255,U.pending_buf[U.d_buf+2*U.last_lit+1]=255&$,U.pending_buf[U.l_buf+U.last_lit]=255&Q,U.last_lit++,$===0?U.dyn_ltree[2*Q]++:(U.matches++,$--,U.dyn_ltree[2*(E[Q]+f+1)]++,U.dyn_dtree[2*be($)]++),U.last_lit===U.lit_bufsize-1},o._tr_align=function(U){ke(U,2,3),oe(U,b,q),(function($){$.bi_valid===16?(ve($,$.bi_buf),$.bi_buf=0,$.bi_valid=0):8<=$.bi_valid&&($.pending_buf[$.pending++]=255&$.bi_buf,$.bi_buf>>=8,$.bi_valid-=8)})(U)}},{"../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,c,d,f,h=1,g={},m=!1,v=s.document,k=Object.getPrototypeOf&&Object.getPrototypeOf(s);k=k&&k.setTimeout?k:s,l={}.toString.call(s.process)==="[object process]"?function(w){process.nextTick(function(){_(w)})}:(function(){if(s.postMessage&&!s.importScripts){var w=!0,T=s.onmessage;return s.onmessage=function(){w=!1},s.postMessage("","*"),s.onmessage=T,w}})()?(f="setImmediate$"+Math.random()+"$",s.addEventListener?s.addEventListener("message",b,!1):s.attachEvent("onmessage",b),function(w){s.postMessage(f+w,"*")}):s.MessageChannel?((d=new MessageChannel).port1.onmessage=function(w){_(w.data)},function(w){d.port2.postMessage(w)}):v&&"onreadystatechange"in v.createElement("script")?(c=v.documentElement,function(w){var T=v.createElement("script");T.onreadystatechange=function(){_(w),T.onreadystatechange=null,c.removeChild(T),T=null},c.appendChild(T)}):function(w){setTimeout(_,0,w)},k.setImmediate=function(w){typeof w!="function"&&(w=new Function(""+w));for(var T=new Array(arguments.length-1),L=0;L<T.length;L++)T[L]=arguments[L+1];return g[h]={callback:w,args:T},l(h),h++},k.clearImmediate=C}function C(w){delete g[w]}function _(w){if(m)setTimeout(_,0,w);else{var T=g[w];if(T){m=!0;try{(function(L){var N=L.callback,H=L.args;switch(H.length){case 0:N();break;case 1:N(H[0]);break;case 2:N(H[0],H[1]);break;case 3:N(H[0],H[1],H[2]);break;default:N.apply(a,H)}})(T)}finally{C(w),m=!1}}}}function b(w){w.source===s&&typeof w.data=="string"&&w.data.indexOf(f)===0&&_(+w.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)})})),Nr="application/vnd.openxmlformats-officedocument.wordprocessingml.document",Xl="application/pdf",qh="text/html",p6={docx:Nr,pdf:Xl,html:qh},Yh={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"};xt();var m6=F2(h6(),1),g6=e=>typeof e!="string"?"":e.trim(),Wv=e=>{if(typeof e!="string")return"";const t=e.trim();return t?t.toLowerCase():""},Kw=e=>{if(typeof e!="string")return"";const t=e.trim();return t?t.toLowerCase():""},jd=e=>{const t=e??{},n=g6(t.id),r=Wv(t.email);return{id:n,email:r,name:typeof t.name=="string"?t.name:"",hasId:n.length>0,hasEmail:r.length>0}},qw=({current:e,other:t})=>{const n=jd(e),r=jd(t);return n.hasId&&r.hasId?n.id===r.id:n.hasEmail&&r.hasEmail?n.email===r.email:!1},qc=({actor:e,fallbackKey:t=""})=>{const n=jd(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 v6(e){return typeof e.captureStackTrace=="function"}var Xh=class extends Error{constructor(e,t){super(e),this.cause=t,this.name="FileObjectError",v6(Error)&&Error.captureStackTrace(this,this.constructor)}},y6=class extends Xh{constructor(e){super("Invalid data URI format: URI must contain exactly one comma separator"),this.uri=e,this.name="InvalidDataUriError"}},b6=class extends Xh{constructor(e,t){super(`Failed to fetch file from URL: ${e}`,t),this.url=e,this.name="FetchFailedError"}},Kv=async(e,t,n)=>{try{if(e.startsWith("data:")&&e.includes(";base64,")){const i=e.split(",");if(i.length!==2)throw new y6(e);const s=atob(i[1]),a=Uint8Array.from(s,l=>l.charCodeAt(0));return new File([a],t,{type:n})}const r=await fetch(e);if(!r.ok)throw new b6(e,new Error(`HTTP ${r.status}: ${r.statusText}`));const o=await r.blob();return new File([o],t,{type:n})}catch(r){throw r instanceof Xh?r:new Xh("Failed to create file object",r)}};function w6(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 Zh=new WeakMap;function Yw(e){return e.ownerDocument??document}function Xw(e,t){const n=Zh.get(t);n?.bindings.delete(e),n&&n.bindings.size===0&&(t.removeEventListener("click",n.listener),Zh.delete(t))}function Zw(e,t){const n=Yw(e);e.__clickOutsideDocument&&e.__clickOutsideDocument!==n&&Xw(e,e.__clickOutsideDocument);let r=Zh.get(n);if(!r){const o=new Map,i=s=>{const a=typeof s.composedPath=="function"?s.composedPath():null;for(const[l,c]of o)(a?.includes(l)??l.contains(s.target))||c.value?.(s)};r={bindings:o,listener:i},Zh.set(n,r),n.addEventListener("click",i)}r.bindings.set(e,t),e.__clickOutsideHandler=r.listener,e.__clickOutsideDocument=n}var qv={mounted(e,t){Zw(e,t)},updated(e,t){Zw(e,t)},unmounted(e){Xw(e,e.__clickOutsideDocument??Yw(e)),delete e.__clickOutsideHandler,delete e.__clickOutsideDocument}};function C6(e){return e[1].user!==void 0}var k6=(e,t)=>{const n=new Set;return Array.from(t.entries()).filter(C6).filter(([r,o])=>{const i=qc({actor:o.user,fallbackKey:r});return!i||n.has(i)?!1:(n.add(i),!0)}).map(([r,o])=>{const i=qc({actor:o.user,fallbackKey:r});let s=e.userColorMap.get(i);return s||(s=o.user.color||(e.config.colors.length>0?e.config.colors[e.colorIndex%e.config.colors.length]:void 0),e.userColorMap.set(i,s),e.colorIndex++),{clientId:r,...o.user,color:s}})},S6=e=>{for(let t=e.length-1;t>0;t--){const n=Math.floor(Math.random()*(t+1));[e[t],e[n]]=[e[n],e[t]]}return e},Qh={PAGE:"superdoc-page",FRAGMENT:"superdoc-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"},vU=[Qh.INLINE_SDT_LABEL,Qh.BLOCK_SDT_LABEL],Qw={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"},_6=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"}}},yU=`.${Qh.BLOCK_SDT}[${Qw.SDT_ID}]`,bU=`[${Qw.DRAGGABLE}="true"]`,A6=typeof window<"u",Jw,Ud=e=>Jw=e,eC=Symbol();function Yv(e){return e&&typeof e=="object"&&Object.prototype.toString.call(e)==="[object Object]"&&typeof e.toJSON!="function"}var Hd;(function(e){e.direct="direct",e.patchObject="patch object",e.patchFunction="patch function"})(Hd||(Hd={}));var tC=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 I6(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 Xv(e,t,n){const r=new XMLHttpRequest;r.open("GET",e),r.responseType="blob",r.onload=function(){x6(r.response,t,n)},r.onerror=function(){console.error("could not download file")},r.send()}function nC(e){const t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch{}return t.status>=200&&t.status<=299}function Jh(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 ep=typeof navigator=="object"?navigator:{userAgent:""},rC=/Macintosh/.test(ep.userAgent)&&/AppleWebKit/.test(ep.userAgent)&&!/Safari/.test(ep.userAgent),x6=A6?typeof HTMLAnchorElement<"u"&&"download"in HTMLAnchorElement.prototype&&!rC?E6:"msSaveOrOpenBlob"in ep?T6:R6:()=>{};function E6(e,t="download",n){const r=document.createElement("a");r.download=t,r.rel="noopener",typeof e=="string"?(r.href=e,r.origin!==location.origin?nC(r.href)?Xv(e,t,n):(r.target="_blank",Jh(r)):Jh(r)):(r.href=URL.createObjectURL(e),setTimeout(function(){URL.revokeObjectURL(r.href)},4e4),setTimeout(function(){Jh(r)},0))}function T6(e,t="download",n){if(typeof e=="string")if(nC(e))Xv(e,t,n);else{const r=document.createElement("a");r.href=e,r.target="_blank",setTimeout(function(){Jh(r)})}else navigator.msSaveOrOpenBlob(I6(e,n),t)}function R6(e,t,n,r){if(r=r||open("","_blank"),r&&(r.document.title=r.document.body.innerText="downloading..."),typeof e=="string")return Xv(e,t,n);const o=e.type==="application/octet-stream",i=/constructor/i.test(String(tC.HTMLElement))||"safari"in tC,s=/CriOS\/[\d]+/.test(navigator.userAgent);if((s||o&&i||rC)&&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:wU}=Object;function L6(){const e=ng(!0),t=e.run(()=>te({}));let n=[],r=[];const o=no({install(i){Ud(o),o._a=i,i.provide(eC,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 oC=()=>{};function iC(e,t,n,r=oC){e.add(t);const o=()=>{e.delete(t)&&r()};return!n&&rg()&&X2(o),o}function Yc(e,...t){e.forEach(n=>{n(...t)})}var M6=e=>e(),sC=Symbol(),Zv=Symbol();function Qv(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];Yv(o)&&Yv(r)&&e.hasOwnProperty(n)&&!cr(r)&&!xi(r)?e[n]=Qv(o,r):e[n]=r}return e}var P6=Symbol();function D6(e){return!Yv(e)||!Object.prototype.hasOwnProperty.call(e,P6)}var{assign:Qa}=Object;function O6(e){return!!(cr(e)&&e.effect)}function F6(e,t,n,r){const{state:o,actions:i,getters:s}=t,a=n.state.value[e];let l;function c(){a||(n.state.value[e]=o?o():{});const d=a1(n.state.value[e]);return Qa(d,i,Object.keys(s||{}).reduce((f,h)=>(f[h]=no(Ce(()=>{Ud(n);const g=n._s.get(e);return s[h].call(g,g)})),f),{}))}return l=aC(e,c,t,n,r,!0),l}function aC(e,t,n={},r,o,i){let s;const a=Qa({actions:{}},n),l={deep:!0};let c,d,f=new Set,h=new Set,g;const m=r.state.value[e];!i&&!m&&(r.state.value[e]={});let v;function k(N){let H;c=d=!1,typeof N=="function"?(N(r.state.value[e]),H={type:Hd.patchFunction,storeId:e,events:g}):(Qv(r.state.value[e],N),H={type:Hd.patchObject,payload:N,storeId:e,events:g});const M=v=Symbol();_t().then(()=>{v===M&&(c=!0)}),d=!0,Yc(f,H,r.state.value[e])}const C=i?function(){const{state:H}=n,M=H?H():{};this.$patch(V=>{Qa(V,M)})}:oC;function _(){s.stop(),f.clear(),h.clear(),r._s.delete(e)}const b=(N,H="")=>{if(sC in N)return N[Zv]=H,N;const M=function(){Ud(r);const V=Array.from(arguments),q=new Set,D=new Set;function B(J){q.add(J)}function E(J){D.add(J)}Yc(h,{args:V,name:M[Zv],store:T,after:B,onError:E});let j;try{j=N.apply(this&&this.$id===e?this:T,V)}catch(J){throw Yc(D,J),J}return j instanceof Promise?j.then(J=>(Yc(q,J),J)).catch(J=>(Yc(D,J),Promise.reject(J))):(Yc(q,j),j)};return M[sC]=!0,M[Zv]=H,M},w={_p:r,$id:e,$onAction:iC.bind(null,h),$patch:k,$reset:C,$subscribe(N,H={}){const M=iC(f,N,H.detached,()=>V()),V=s.run(()=>Ft(()=>r.state.value[e],q=>{(H.flush==="sync"?d:c)&&N({storeId:e,type:Hd.direct,events:g},q)},Qa({},l,H)));return M},$dispose:_},T=to(w);r._s.set(e,T);const L=(r._a&&r._a.runWithContext||M6)(()=>r._e.run(()=>(s=ng()).run(()=>t({action:b}))));for(const N in L){const H=L[N];cr(H)&&!O6(H)||xi(H)?i||(m&&D6(H)&&(cr(H)?H.value=m[N]:Qv(H,m[N])),r.state.value[e][N]=H):typeof H=="function"&&(L[N]=b(H,N),a.actions[N]=H)}return Qa(T,L),Qa(Cn(T),L),Object.defineProperty(T,"$state",{get:()=>r.state.value[e],set:N=>{k(H=>{Qa(H,N)})}}),r._p.forEach(N=>{Qa(T,s.run(()=>N({store:T,app:r._a,pinia:r,options:a})))}),m&&i&&n.hydrate&&n.hydrate(T.$state,m),c=!0,d=!0,T}function lC(e,t,n){let r;const o=typeof t=="function";r=o?n:t;function i(s,a){const l=O1();return s=s||(l?Ua(eC,null):null),s&&Ud(s),s=Jw,s._s.has(e)||(o?aC(e,t,r,s):F6(e,r,s)),s._s.get(e)}return i.$id=e,i}function _s(e){const t=Cn(e),n={};for(const r in t){const o=t[r];o.effect?n[r]=Ce({get:()=>e[r],set(i){e[r]=i}}):(cr(o)||xi(o))&&(n[r]=dg(e,r))}return n}var $d=e=>{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 t=e.name||"document";return new File([e],t,{type:e.type})}return e}return e.originFileObj?$d(e.originFileObj):e.file?$d(e.file):e.raw?$d(e.raw):null},cC=(e="")=>{const t=String(e).toLowerCase();return t.endsWith(".docx")?Nr:t.endsWith(".pdf")?Xl:t.endsWith(".html")||t.endsWith(".htm")?qh:t.endsWith(".md")||t.endsWith(".markdown")?"text/markdown":""},Gd=e=>{const t=$d(e);if(t){const n=t.name||e&&e.name||"document";return{type:t.type||cC(n)||"application/vnd.openxmlformats-officedocument.wordprocessingml.document",data:t,name:n}}if(e&&typeof e=="object"&&"data"in e){const n=$d(e.data);if(n){const r=e.type||n.type||cC(n.name)||"application/vnd.openxmlformats-officedocument.wordprocessingml.document";return{...e,type:r,data:n,name:e.name||n.name||"document"}}}return e};xt();function N6(e,t){const n=e.itemid,r=e,o=t!==null&&typeof t=="object"?to({...t}):te(t),i=te(null);return Ft(o,(a,l)=>{const c={fieldId:n.value,changeTime:Date.now(),oldValue:l,newValue:a,originalField:r};i.value=c}),{value:o}}function B6(e){const t=te(e.itemid),n=te(e.itemicon),r=te(e.itemiconpack),o=te(e.itemdisplaylabel),i=e.itemlinkvalue,s=e.itemplaceholdertext,{value:a}=N6(e,i,te([])),l=te(e.itemtype),c=te(e.itemfieldtype),d=e,f=to({fontFamily:e.fontfamily||"Arial",fontSize:e.font_size||"12pt",originalFontSize:e.original_font_size||"12pt"}),h=te(e.logicrules),g=te(!1),m=to({}),v={SELECT:V6,IMAGEINPUT:z6,CHECKBOXINPUT:j6};return l.value in v&&Object.assign(m,v[l.value](e)),{id:t,icon:n,iconPack:r,label:o,placeholder:s,fieldType:l,fieldSubType:c,value:a,format:te(e.itemformat),logicRules:h,hidden:g,originalJSON:d,fieldStyle:f,valueGetter:e.valueGetter,...m}}function z6(e){return{fontfamily:te(e.fontfamily),iteminputtype:te(e.iteminputtype)}}function V6(e){return{options:te(e.itemoptions)}}function j6(e){const t=te(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 As=()=>new Map,Jv=e=>{const t=As();return e.forEach((n,r)=>{t.set(r,n)}),t},Xc=(e,t,n)=>{let r=e.get(t);return r===void 0&&e.set(t,r=n()),r},U6=(e,t)=>{const n=[];for(const[r,o]of e)n.push(t(o,r));return n},H6=(e,t)=>{for(const[n,r]of e)if(t(r,n))return!0;return!1},Zc=()=>new Set,ey=e=>e[e.length-1],Qc=Array.from,ty=(e,t)=>{for(let n=0;n<e.length;n++)if(!t(e[n],n,e))return!1;return!0},uC=(e,t)=>{for(let n=0;n<e.length;n++)if(t(e[n],n,e))return!0;return!1},$6=(e,t)=>{const n=new Array(e);for(let r=0;r<e;r++)n[r]=t(r,n);return n},tp=Array.isArray,G6=class{constructor(){this._observers=As()}on(e,t){return Xc(this._observers,e,Zc).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 Qc((this._observers.get(e)||As()).values()).forEach(n=>n(...t))}destroy(){this._observers=As()}},ca=Math.floor,np=Math.abs,dC=(e,t)=>e<t?e:t,Jc=(e,t)=>e>t?e:t,CU=Number.isNaN,W6=e=>e!==0?e<0:1/e<0,kU=1,SU=2,_U=4,AU=8,IU=32,xU=64,EU=128,TU=31,RU=63,LU=127,MU=2147483647,fC=Number.MAX_SAFE_INTEGER,hC=Number.MIN_SAFE_INTEGER,K6=Number.isInteger||(e=>typeof e=="number"&&isFinite(e)&&ca(e)===e),PU=Number.isNaN,DU=Number.parseInt,pC=String.fromCharCode,OU=String.fromCodePoint,FU=pC(65535),q6=e=>e.toLowerCase(),Y6=/^\s*/g,X6=e=>e.replace(Y6,""),Z6=/([A-Z])/g,mC=(e,t)=>X6(e.replace(Z6,n=>`${t}${q6(n)}`)),Q6=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},Wd=typeof TextEncoder<"u"?new TextEncoder:null,J6=e=>Wd.encode(e),ex=Wd?J6:Q6,ny=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});ny&&ny.decode(new Uint8Array).length===1&&(ny=null);var tx=(e,t)=>$6(t,()=>e).join(""),Kd=class{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}},ry=()=>new Kd,nx=e=>{let t=e.cpos;for(let n=0;n<e.bufs.length;n++)t+=e.bufs[n].length;return t},ua=e=>{const t=new Uint8Array(nx(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},rx=(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(Jc(n,t)*2),e.cpos=0)},fo=(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},oy=fo,Jn=(e,t)=>{for(;t>127;)fo(e,128|127&t),t=ca(t/128);fo(e,127&t)},iy=(e,t)=>{const n=W6(t);for(n&&(t=-t),fo(e,(t>63?128:0)|(n?64:0)|63&t),t=ca(t/64);t>0;)fo(e,(t>127?128:0)|127&t),t=ca(t/128)},sy=new Uint8Array(3e4),ox=sy.length/3,ix=(e,t)=>{if(t.length<ox){const n=Wd.encodeInto(t,sy).written||0;Jn(e,n);for(let r=0;r<n;r++)fo(e,sy[r])}else vi(e,ex(t))},sx=(e,t)=>{const n=unescape(encodeURIComponent(t)),r=n.length;Jn(e,r);for(let o=0;o<r;o++)fo(e,n.codePointAt(o))},eu=Wd&&Wd.encodeInto?ix:sx,ay=(e,t)=>{const n=e.cbuf.length,r=e.cpos,o=dC(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(Jc(n*2,i)),e.cbuf.set(t.subarray(o)),e.cpos=i)},vi=(e,t)=>{Jn(e,t.byteLength),ay(e,t)},ly=(e,t)=>{rx(e,t);const n=new DataView(e.cbuf.buffer,e.cpos,t);return e.cpos+=t,n},ax=(e,t)=>ly(e,4).setFloat32(0,t,!1),lx=(e,t)=>ly(e,8).setFloat64(0,t,!1),cx=(e,t)=>ly(e,8).setBigInt64(0,t,!1),gC=new DataView(new ArrayBuffer(4)),ux=e=>(gC.setFloat32(0,e),gC.getFloat32(0)===e),qd=(e,t)=>{switch(typeof t){case"string":fo(e,119),eu(e,t);break;case"number":K6(t)&&np(t)<=2147483647?(fo(e,125),iy(e,t)):ux(t)?(fo(e,124),ax(e,t)):(fo(e,123),lx(e,t));break;case"bigint":fo(e,122),cx(e,t);break;case"object":if(t===null)fo(e,126);else if(tp(t)){fo(e,117),Jn(e,t.length);for(let n=0;n<t.length;n++)qd(e,t[n])}else if(t instanceof Uint8Array)fo(e,116),vi(e,t);else{fo(e,118);const n=Object.keys(t);Jn(e,n.length);for(let r=0;r<n.length;r++){const o=n[r];eu(e,o),qd(e,t[o])}}break;case"boolean":fo(e,t?120:121);break;default:fo(e,127)}},vC=class extends Kd{constructor(e){super(),this.w=e,this.s=null,this.count=0}write(e){this.s===e?this.count++:(this.count>0&&Jn(this,this.count-1),this.count=1,this.w(this,e),this.s=e)}},yC=e=>{e.count>0&&(iy(e.encoder,e.count===1?e.s:-e.s),e.count>1&&Jn(e.encoder,e.count-2))},rp=class{constructor(){this.encoder=new Kd,this.s=0,this.count=0}write(e){this.s===e?this.count++:(yC(this),this.count=1,this.s=e)}toUint8Array(){return yC(this),ua(this.encoder)}},bC=e=>{if(e.count>0){const t=e.diff*2+(e.count===1?0:1);iy(e.encoder,t),e.count>1&&Jn(e.encoder,e.count-2)}},cy=class{constructor(){this.encoder=new Kd,this.s=0,this.count=0,this.diff=0}write(e){this.diff===e-this.s?(this.s=e,this.count++):(bC(this),this.count=1,this.diff=e-this.s,this.s=e)}toUint8Array(){return bC(this),ua(this.encoder)}},dx=class{constructor(){this.sarr=[],this.s="",this.lensE=new rp}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 Kd;return this.sarr.push(this.s),this.s="",eu(e,this.sarr.join("")),ay(e,this.lensE.toUint8Array()),ua(e)}},Ja=e=>new Error(e),Zi=()=>{throw Ja("Method unimplemented")},da=()=>{throw Ja("Unexpected case")},NU=crypto.subtle,fx=crypto.getRandomValues.bind(crypto),wC=()=>fx(new Uint32Array(1))[0],hx="10000000-1000-4000-8000-100000000000",px=()=>hx.replace(/[018]/g,e=>(e^wC()&15>>e/4).toString(16)),mx=Date.now,CC=e=>new Promise(e),BU=Promise.all.bind(Promise),kC=e=>e===void 0?null:e,gx=class{constructor(){this.map=new Map}setItem(e,t){this.map.set(e,t)}getItem(e){return this.map.get(e)}},SC=new gx,vx=!0;try{typeof localStorage<"u"&&localStorage&&(SC=localStorage,vx=!1)}catch{}var yx=SC,Yd=Symbol("Equality"),_C=(e,t)=>e===t||!!e?.[Yd]?.(t)||!1,bx=e=>typeof e=="object",wx=Object.assign,Cx=Object.keys,kx=(e,t)=>{for(const n in e)t(e[n],n)},op=e=>Cx(e).length,Sx=e=>{for(const t in e)return!1;return!0},Xd=(e,t)=>{for(const n in e)if(!t(e[n],n))return!1;return!0},uy=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),_x=(e,t)=>e===t||op(e)===op(t)&&Xd(e,(n,r)=>(n!==void 0||uy(t,r))&&_C(t[r],n)),Ax=Object.freeze,AC=e=>{for(const t in e){const n=e[t];(typeof n=="object"||typeof n=="function")&&AC(e[t])}return Ax(e)},dy=(e,t,n=0)=>{try{for(;n<e.length;n++)e[n](...t)}finally{n<e.length&&dy(e,t,n+1)}},ip=(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[Yd]!=null)return e[Yd](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)||!ip(e.get(n),t.get(n)))return!1;break;case void 0:case Object:if(op(e)!==op(t))return!1;for(const n in e)if(!uy(e,n)||!ip(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(!ip(e[n],t[n]))return!1;break;default:return!1}return!0},Ix=(e,t)=>t.includes(e),Zd=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]",zU=typeof navigator<"u"?/Mac/.test(navigator.platform):!1,Is,xx=[],Ex=()=>{if(Is===void 0)if(Zd){Is=As();const e=process.argv;let t=null;for(let n=0;n<e.length;n++){const r=e[n];r[0]==="-"?(t!==null&&Is.set(t,""),t=r):t!==null?(Is.set(t,r),t=null):xx.push(r)}t!==null&&Is.set(t,"")}else typeof location=="object"?(Is=As(),(location.search||"?").slice(1).split("&").forEach(e=>{if(e.length!==0){const[t,n]=e.split("=");Is.set(`--${mC(t,"-")}`,n),Is.set(`-${mC(t,"-")}`,n)}})):Is=As();return Is},fy=e=>Ex().has(e),sp=e=>kC(Zd?process.env[e.toUpperCase().replaceAll("-","_")]:yx.getItem(e)),IC=e=>fy("--"+e)||sp(e)!==null,Tx=IC("production"),Rx=Zd&&Ix(process.env.FORCE_COLOR,["true","1","2"]),Lx=Rx||!fy("--no-colors")&&!IC("no-color")&&(!Zd||process.stdout.isTTY)&&(!Zd||fy("--color")||sp("COLORTERM")!==null||(sp("TERM")||"").includes("color")),Mx=class{constructor(e,t){this.left=e,this.right=t}},fa=(e,t)=>new Mx(e,t),xC=e=>e.next()>=.5,hy=(e,t,n)=>ca(e.next()*(n+1-t)+t),EC=(e,t,n)=>ca(e.next()*(n+1-t)+t),py=(e,t,n)=>EC(e,t,n),Px=e=>pC(py(e,97,122)),Dx=(e,t=0,n=20)=>{const r=py(e,t,n);let o="";for(let i=0;i<r;i++)o+=Px(e);return o},my=(e,t)=>t[py(e,0,t.length-1)],Ox=Symbol("0schema"),Fx=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(tx(" ",(this._rerrs.length-t)*2)+`${n.path!=null?`[${n.path}] `:""}${n.has} doesn't match ${n.expected}. ${n.message}`)}return e.join(`
|
|
4
|
+
\0`,ke+=i(ge,2),ke+=L.magic,ke+=i(b,2),ke+=i(w,2),ke+=i(Ve.crc32,4),ke+=i(Ve.compressedSize,4),ke+=i(Ve.uncompressedSize,4),ke+=i(H.length,2),ke+=i(j.length,2),{fileRecord:f.LOCAL_FILE_HEADER+ke+H+j,dirRecord:f.CENTRAL_FILE_HEADER+i(ve,2)+ke+i(q.length,2)+"\0\0\0\0"+i(be,4)+i(k,4)+H+j+q}}var a=n("../utils"),l=n("../stream/GenericWorker"),c=n("../utf8"),d=n("../crc32"),f=n("../signature");function h(g,m,v,k){l.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=m,this.zipPlatform=v,this.encodeFileName=k,this.streamFiles=g,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(h,l),h.prototype.push=function(g){var m=g.meta.percent||0,v=this.entriesCount,k=this._sources.length;this.accumulate?this.contentBuffer.push(g):(this.bytesWritten+=g.data.length,l.prototype.push.call(this,{data:g.data,meta:{currentFile:this.currentFile,percent:v?(m+100*(v-k-1))/v:100}}))},h.prototype.openedSource=function(g){this.currentSourceOffset=this.bytesWritten,this.currentFile=g.file.name;var m=this.streamFiles&&!g.file.dir;if(m){var v=s(g,m,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:v.fileRecord,meta:{percent:0}})}else this.accumulate=!0},h.prototype.closedSource=function(g){this.accumulate=!1;var m=this.streamFiles&&!g.file.dir,v=s(g,m,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(v.dirRecord),m)this.push({data:(function(k){return f.DATA_DESCRIPTOR+i(k.crc32,4)+i(k.compressedSize,4)+i(k.uncompressedSize,4)})(g),meta:{percent:100}});else for(this.push({data:v.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},h.prototype.flush=function(){for(var g=this.bytesWritten,m=0;m<this.dirRecords.length;m++)this.push({data:this.dirRecords[m],meta:{percent:100}});var v=this.bytesWritten-g,k=(function(C,_,b,w,T){var L=a.transformTo("string",T(w));return f.CENTRAL_DIRECTORY_END+"\0\0\0\0"+i(C,2)+i(C,2)+i(_,4)+i(b,4)+i(L.length,2)+L})(this.dirRecords.length,v,g,this.zipComment,this.encodeFileName);this.push({data:k,meta:{percent:100}})},h.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},h.prototype.registerPrevious=function(g){this._sources.push(g);var m=this;return g.on("data",function(v){m.processChunk(v)}),g.on("end",function(){m.closedSource(m.previous.streamInfo),m._sources.length?m.prepareNextSource():m.end()}),g.on("error",function(v){m.error(v)}),this},h.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))},h.prototype.error=function(g){var m=this._sources;if(!l.prototype.error.call(this,g))return!1;for(var v=0;v<m.length;v++)try{m[v].error(g)}catch{}return!0},h.prototype.lock=function(){l.prototype.lock.call(this);for(var g=this._sources,m=0;m<g.length;m++)g[m].lock()},r.exports=h},{"../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,c){var d=new s(l.streamFiles,c,l.platform,l.encodeFileName),f=0;try{a.forEach(function(h,g){f++;var m=(function(_,b){var w=_||b,T=i[w];if(!T)throw new Error(w+" is not a valid compression method !");return T})(g.options.compression,l.compression),v=g.options.compressionOptions||l.compressionOptions||{},k=g.dir,C=g.date;g._compressWorker(m,v).withStreamInfo("file",{name:h,dir:k,date:C,comment:g.comment||"",unixPermissions:g.unixPermissions,dosPermissions:g.dosPermissions}).pipe(d)}),d.entriesCount=f}catch(h){d.error(h)}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"),c=n("./stream/Crc32Probe"),d=n("./nodejsUtils");function f(h){return new s.Promise(function(g,m){var v=h.decompressed.getContentWorker().pipe(new c);v.on("error",function(k){m(k)}).on("end",function(){v.streamInfo.crc32!==h.decompressed.crc32?m(new Error("Corrupted zip : CRC32 mismatch")):g()}).resume()})}r.exports=function(h,g){var m=this;return g=i.extend(g||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:a.utf8decode}),d.isNode&&d.isStream(h)?s.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):i.prepareContent("the loaded zip file",h,!0,g.optimizedBinaryString,g.base64).then(function(v){var k=new l(g);return k.load(v),k}).then(function(v){var k=[s.Promise.resolve(v)],C=v.files;if(g.checkCRC32)for(var _=0;_<C.length;_++)k.push(f(C[_]));return s.Promise.all(k)}).then(function(v){for(var k=v.shift(),C=k.files,_=0;_<C.length;_++){var b=C[_],w=b.fileNameStr,T=i.resolve(b.fileNameStr);m.file(T,b.decompressed,{binary:!0,optimizedBinaryString:!0,date:b.date,dir:b.dir,comment:b.fileCommentStr.length?b.fileCommentStr:null,unixPermissions:b.unixPermissions,dosPermissions:b.dosPermissions,createFolders:g.createFolders}),b.dir||(m.file(T).unsafeOriginalName=w)}return k.zipComment.length&&(m.comment=k.zipComment),m})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(n,r,o){"use strict";var i=n("../utils"),s=n("../stream/GenericWorker");function a(l,c){s.call(this,"Nodejs stream input adapter for "+l),this._upstreamEnded=!1,this._bindStream(c)}i.inherits(a,s),a.prototype._bindStream=function(l){var c=this;(this._stream=l).pause(),l.on("data",function(d){c.push({data:d,meta:{percent:0}})}).on("error",function(d){c.isPaused?this.generatedError=d:c.error(d)}).on("end",function(){c.isPaused?c._upstreamEnded=!0:c.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,c){i.call(this,l),this._helper=a;var d=this;a.on("data",function(f,h){d.push(f)||d._helper.pause(),c&&c(h)}).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(w,T,L){var N,H=a.getTypeOf(T),M=a.extend(L||{},d);M.date=M.date||new Date,M.compression!==null&&(M.compression=M.compression.toUpperCase()),typeof M.unixPermissions=="string"&&(M.unixPermissions=parseInt(M.unixPermissions,8)),M.unixPermissions&&16384&M.unixPermissions&&(M.dir=!0),M.dosPermissions&&16&M.dosPermissions&&(M.dir=!0),M.dir&&(w=C(w)),M.createFolders&&(N=k(w))&&_.call(this,N,!0);var V=H==="string"&&M.binary===!1&&M.base64===!1;L&&L.binary!==void 0||(M.binary=!V),(T instanceof f&&T.uncompressedSize===0||M.dir||!T||T.length===0)&&(M.base64=!1,M.binary=!0,T="",M.compression="STORE",H="string");var q=null;q=T instanceof f||T instanceof l?T:m.isNode&&m.isStream(T)?new v(w,T):a.prepareContent(w,T,M.binary,M.optimizedBinaryString,M.base64);var D=new h(w,q,M);this.files[w]=D}var s=n("./utf8"),a=n("./utils"),l=n("./stream/GenericWorker"),c=n("./stream/StreamHelper"),d=n("./defaults"),f=n("./compressedObject"),h=n("./zipObject"),g=n("./generate"),m=n("./nodejsUtils"),v=n("./nodejs/NodejsStreamInputAdapter"),k=function(w){w.slice(-1)==="/"&&(w=w.substring(0,w.length-1));var T=w.lastIndexOf("/");return 0<T?w.substring(0,T):""},C=function(w){return w.slice(-1)!=="/"&&(w+="/"),w},_=function(w,T){return T=T!==void 0?T:d.createFolders,w=C(w),this.files[w]||i.call(this,w,null,{dir:!0,createFolders:T}),this.files[w]};function b(w){return Object.prototype.toString.call(w)==="[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(w){var T,L,N;for(T in this.files)N=this.files[T],(L=T.slice(this.root.length,T.length))&&T.slice(0,this.root.length)===this.root&&w(L,N)},filter:function(w){var T=[];return this.forEach(function(L,N){w(L,N)&&T.push(N)}),T},file:function(w,T,L){if(arguments.length!==1)return w=this.root+w,i.call(this,w,T,L),this;if(b(w)){var N=w;return this.filter(function(M,V){return!V.dir&&N.test(M)})}var H=this.files[this.root+w];return H&&!H.dir?H:null},folder:function(w){if(!w)return this;if(b(w))return this.filter(function(H,M){return M.dir&&w.test(H)});var T=this.root+w,L=_.call(this,T),N=this.clone();return N.root=L.name,N},remove:function(w){w=this.root+w;var T=this.files[w];if(T||(w.slice(-1)!=="/"&&(w+="/"),T=this.files[w]),T&&!T.dir)delete this.files[w];else for(var L=this.filter(function(H,M){return M.name.slice(0,w.length)===w}),N=0;N<L.length;N++)delete this.files[L[N].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(w){var T,L={};try{if((L=a.extend(w||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:s.utf8encode})).type=L.type.toLowerCase(),L.compression=L.compression.toUpperCase(),L.type==="binarystring"&&(L.type="string"),!L.type)throw new Error("No output type specified.");a.checkSupport(L.type),L.platform!=="darwin"&&L.platform!=="freebsd"&&L.platform!=="linux"&&L.platform!=="sunos"||(L.platform="UNIX"),L.platform==="win32"&&(L.platform="DOS");var N=L.comment||this.comment||"";T=g.generateWorker(this,L,N)}catch(H){(T=new l("error")).error(H)}return new c(T,L.type||"string",L.mimeType)},generateAsync:function(w,T){return this.generateInternalStream(w).accumulate(T)},generateNodeStream:function(w,T){return(w=w||{}).type||(w.type="nodebuffer"),this.generateInternalStream(w).toNodejsStream(T)}}},{"./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),c=a.charCodeAt(1),d=a.charCodeAt(2),f=a.charCodeAt(3),h=this.length-4;0<=h;--h)if(this.data[h]===l&&this.data[h+1]===c&&this.data[h+2]===d&&this.data[h+3]===f)return h-this.zero;return-1},s.prototype.readAndCheckSignature=function(a){var l=a.charCodeAt(0),c=a.charCodeAt(1),d=a.charCodeAt(2),f=a.charCodeAt(3),h=this.readData(4);return l===h[0]&&c===h[1]&&d===h[2]&&f===h[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,c=0;for(this.checkOffset(a),l=this.index+a-1;l>=this.index;l--)c=(c<<8)+this.byteAt(l);return this.index+=a,c},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"),c=n("./NodeBufferReader"),d=n("./Uint8ArrayReader");r.exports=function(f){var h=i.getTypeOf(f);return i.checkSupport(h),h!=="string"||s.uint8array?h==="nodebuffer"?new c(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 c=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=c+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 c=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,l.then(function(d){c.dataIsReady=!0,c.data=d,c.max=d&&d.length||0,c.type=i.getTypeOf(d),c.isPaused||c._tickAndRepeat()},function(d){c.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,c=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,c);break;case"uint8array":l=this.data.subarray(this.index,c);break;case"array":case"nodebuffer":l=this.data.slice(this.index,c)}return this.index=c,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"),c=n("../support"),d=n("../external"),f=null;if(c.nodestream)try{f=n("../nodejs/NodejsStreamOutputAdapter")}catch{}function h(m,v){return new d.Promise(function(k,C){var _=[],b=m._internalType,w=m._outputType,T=m._mimeType;m.on("data",function(L,N){_.push(L),v&&v(N)}).on("error",function(L){_=[],C(L)}).on("end",function(){try{k((function(L,N,H){switch(L){case"blob":return i.newBlob(i.transformTo("arraybuffer",N),H);case"base64":return l.encode(N);default:return i.transformTo(L,N)}})(w,(function(L,N){var H,M=0,V=null,q=0;for(H=0;H<N.length;H++)q+=N[H].length;switch(L){case"string":return N.join("");case"array":return Array.prototype.concat.apply([],N);case"uint8array":for(V=new Uint8Array(q),H=0;H<N.length;H++)V.set(N[H],M),M+=N[H].length;return V;case"nodebuffer":return Buffer.concat(N);default:throw new Error("concat : unsupported type '"+L+"'")}})(b,_),T))}catch(L){C(L)}_=[]}).resume()})}function g(m,v,k){var C=v;switch(v){case"blob":case"arraybuffer":C="uint8array";break;case"base64":C="string"}try{this._internalType=C,this._outputType=v,this._mimeType=k,i.checkSupport(C),this._worker=m.pipe(new s(C)),m.lock()}catch(_){this._worker=new a("error"),this._worker.error(_)}}g.prototype={accumulate:function(m){return h(this,m)},on:function(m,v){var k=this;return m==="data"?this._worker.on(m,function(C){v.call(k,C.data,C.meta)}):this._worker.on(m,function(){i.delay(v,arguments,k)}),this},resume:function(){return i.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(m){if(i.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new f(this,{objectMode:this._outputType!=="nodebuffer"},m)}},r.exports=g},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(n,r,o){"use strict";if(o.base64=!0,o.array=!0,o.string=!0,o.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",o.nodebuffer=typeof Buffer<"u",o.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")o.blob=!1;else{var i=new ArrayBuffer(0);try{o.blob=new Blob([i],{type:"application/zip"}).size===0}catch{try{var s=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);s.append(i),o.blob=s.getBlob("application/zip").size===0}catch{o.blob=!1}}}try{o.nodestream=!!n("readable-stream").Readable}catch{o.nodestream=!1}},{"readable-stream":16}],31:[function(n,r,o){"use strict";for(var i=n("./utils"),s=n("./support"),a=n("./nodejsUtils"),l=n("./stream/GenericWorker"),c=new Array(256),d=0;d<256;d++)c[d]=252<=d?6:248<=d?5:240<=d?4:224<=d?3:192<=d?2:1;c[254]=c[254]=1;function f(){l.call(this,"utf-8 decode"),this.leftOver=null}function h(){l.call(this,"utf-8 encode")}o.utf8encode=function(g){return s.nodebuffer?a.newBufferFrom(g,"utf-8"):(function(m){var v,k,C,_,b,w=m.length,T=0;for(_=0;_<w;_++)(64512&(k=m.charCodeAt(_)))==55296&&_+1<w&&(64512&(C=m.charCodeAt(_+1)))==56320&&(k=65536+(k-55296<<10)+(C-56320),_++),T+=k<128?1:k<2048?2:k<65536?3:4;for(v=s.uint8array?new Uint8Array(T):new Array(T),_=b=0;b<T;_++)(64512&(k=m.charCodeAt(_)))==55296&&_+1<w&&(64512&(C=m.charCodeAt(_+1)))==56320&&(k=65536+(k-55296<<10)+(C-56320),_++),k<128?v[b++]=k:(k<2048?v[b++]=192|k>>>6:(k<65536?v[b++]=224|k>>>12:(v[b++]=240|k>>>18,v[b++]=128|k>>>12&63),v[b++]=128|k>>>6&63),v[b++]=128|63&k);return v})(g)},o.utf8decode=function(g){return s.nodebuffer?i.transformTo("nodebuffer",g).toString("utf-8"):(function(m){var v,k,C,_,b=m.length,w=new Array(2*b);for(v=k=0;v<b;)if((C=m[v++])<128)w[k++]=C;else if(4<(_=c[C]))w[k++]=65533,v+=_-1;else{for(C&=_===2?31:_===3?15:7;1<_&&v<b;)C=C<<6|63&m[v++],_--;1<_?w[k++]=65533:C<65536?w[k++]=C:(C-=65536,w[k++]=55296|C>>10&1023,w[k++]=56320|1023&C)}return w.length!==k&&(w.subarray?w=w.subarray(0,k):w.length=k),i.applyFromCharCode(w)})(g=i.transformTo(s.uint8array?"uint8array":"array",g))},i.inherits(f,l),f.prototype.processChunk=function(g){var m=i.transformTo(s.uint8array?"uint8array":"array",g.data);if(this.leftOver&&this.leftOver.length){if(s.uint8array){var v=m;(m=new Uint8Array(v.length+this.leftOver.length)).set(this.leftOver,0),m.set(v,this.leftOver.length)}else m=this.leftOver.concat(m);this.leftOver=null}var k=(function(_,b){var w;for((b=b||_.length)>_.length&&(b=_.length),w=b-1;0<=w&&(192&_[w])==128;)w--;return w<0||w===0?b:w+c[_[w]]>b?w:b})(m),C=m;k!==m.length&&(s.uint8array?(C=m.subarray(0,k),this.leftOver=m.subarray(k,m.length)):(C=m.slice(0,k),this.leftOver=m.slice(k,m.length))),this.push({data:o.utf8decode(C),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(h,l),h.prototype.processChunk=function(g){this.push({data:o.utf8encode(g.data),meta:g.meta})},o.Utf8EncodeWorker=h},{"./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 c(v){return v}function d(v,k){for(var C=0;C<v.length;++C)k[C]=255&v.charCodeAt(C);return k}n("setimmediate"),o.newBlob=function(v,k){o.checkSupport("blob");try{return new Blob([v],{type:k})}catch{try{var C=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return C.append(v),C.getBlob(k)}catch{throw new Error("Bug : can't construct the Blob.")}}};var f={stringifyByChunk:function(v,k,C){var _=[],b=0,w=v.length;if(w<=C)return String.fromCharCode.apply(null,v);for(;b<w;)k==="array"||k==="nodebuffer"?_.push(String.fromCharCode.apply(null,v.slice(b,Math.min(b+C,w)))):_.push(String.fromCharCode.apply(null,v.subarray(b,Math.min(b+C,w)))),b+=C;return _.join("")},stringifyByChar:function(v){for(var k="",C=0;C<v.length;C++)k+=String.fromCharCode(v[C]);return k},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 h(v){var k=65536,C=o.getTypeOf(v),_=!0;if(C==="uint8array"?_=f.applyCanBeUsed.uint8array:C==="nodebuffer"&&(_=f.applyCanBeUsed.nodebuffer),_)for(;1<k;)try{return f.stringifyByChunk(v,C,k)}catch{k=Math.floor(k/2)}return f.stringifyByChar(v)}function g(v,k){for(var C=0;C<v.length;C++)k[C]=v[C];return k}o.applyFromCharCode=h;var m={};m.string={string:c,array:function(v){return d(v,new Array(v.length))},arraybuffer:function(v){return m.string.uint8array(v).buffer},uint8array:function(v){return d(v,new Uint8Array(v.length))},nodebuffer:function(v){return d(v,a.allocBuffer(v.length))}},m.array={string:h,array:c,arraybuffer:function(v){return new Uint8Array(v).buffer},uint8array:function(v){return new Uint8Array(v)},nodebuffer:function(v){return a.newBufferFrom(v)}},m.arraybuffer={string:function(v){return h(new Uint8Array(v))},array:function(v){return g(new Uint8Array(v),new Array(v.byteLength))},arraybuffer:c,uint8array:function(v){return new Uint8Array(v)},nodebuffer:function(v){return a.newBufferFrom(new Uint8Array(v))}},m.uint8array={string:h,array:function(v){return g(v,new Array(v.length))},arraybuffer:function(v){return v.buffer},uint8array:c,nodebuffer:function(v){return a.newBufferFrom(v)}},m.nodebuffer={string:h,array:function(v){return g(v,new Array(v.length))},arraybuffer:function(v){return m.nodebuffer.uint8array(v).buffer},uint8array:function(v){return g(v,new Uint8Array(v.length))},nodebuffer:c},o.transformTo=function(v,k){return k=k||"",v?(o.checkSupport(v),m[o.getTypeOf(k)][v](k)):k},o.resolve=function(v){for(var k=v.split("/"),C=[],_=0;_<k.length;_++){var b=k[_];b==="."||b===""&&_!==0&&_!==k.length-1||(b===".."?C.pop():C.push(b))}return C.join("/")},o.getTypeOf=function(v){return typeof v=="string"?"string":Object.prototype.toString.call(v)==="[object Array]"?"array":i.nodebuffer&&a.isBuffer(v)?"nodebuffer":i.uint8array&&v instanceof Uint8Array?"uint8array":i.arraybuffer&&v instanceof ArrayBuffer?"arraybuffer":void 0},o.checkSupport=function(v){if(!i[v.toLowerCase()])throw new Error(v+" is not supported by this platform")},o.MAX_VALUE_16BITS=65535,o.MAX_VALUE_32BITS=-1,o.pretty=function(v){var k,C,_="";for(C=0;C<(v||"").length;C++)_+="\\x"+((k=v.charCodeAt(C))<16?"0":"")+k.toString(16).toUpperCase();return _},o.delay=function(v,k,C){setImmediate(function(){v.apply(C||null,k||[])})},o.inherits=function(v,k){function C(){}C.prototype=k.prototype,v.prototype=new C},o.extend=function(){var v,k,C={};for(v=0;v<arguments.length;v++)for(k in arguments[v])Object.prototype.hasOwnProperty.call(arguments[v],k)&&C[k]===void 0&&(C[k]=arguments[v][k]);return C},o.prepareContent=function(v,k,C,_,b){return l.Promise.resolve(k).then(function(w){return i.blob&&(w instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(w))!==-1)&&typeof FileReader<"u"?new l.Promise(function(T,L){var N=new FileReader;N.onload=function(H){T(H.target.result)},N.onerror=function(H){L(H.target.error)},N.readAsArrayBuffer(w)}):w}).then(function(w){var T=o.getTypeOf(w);return T?(T==="arraybuffer"?w=o.transformTo("uint8array",w):T==="string"&&(b?w=s.decode(w):C&&_!==!0&&(w=(function(L){return d(L,i.uint8array?new Uint8Array(L.length):new Array(L.length))})(w))),w):l.Promise.reject(new Error("Can't read the data of '"+v+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))})}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(n,r,o){"use strict";var i=n("./reader/readerFor"),s=n("./utils"),a=n("./signature"),l=n("./zipEntry"),c=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 h=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+s.pretty(h)+", expected "+s.pretty(f)+")")}},isSignature:function(f,h){var g=this.reader.index;this.reader.setIndex(f);var m=this.reader.readString(4)===h;return this.reader.setIndex(g),m},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var f=this.reader.readData(this.zipCommentLength),h=c.uint8array?"uint8array":"array",g=s.transformTo(h,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,h,g,m=this.zip64EndOfCentralSize-44;0<m;)f=this.reader.readInt(2),h=this.reader.readInt(4),g=this.reader.readData(h),this.zip64ExtensibleData[f]={id:f,length:h,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,h;for(f=0;f<this.files.length;f++)h=this.files[f],this.reader.setIndex(h.localHeaderOffset),this.checkSignature(a.LOCAL_FILE_HEADER),h.readLocalPart(this.reader),h.handleUTF8(),h.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 h=f;if(this.checkSignature(a.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===s.MAX_VALUE_16BITS||this.diskWithCentralDirStart===s.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===s.MAX_VALUE_16BITS||this.centralDirRecords===s.MAX_VALUE_16BITS||this.centralDirSize===s.MAX_VALUE_32BITS||this.centralDirOffset===s.MAX_VALUE_32BITS){if(this.zip64=!0,(f=this.reader.lastIndexOfSignature(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(f),this.checkSignature(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,a.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(a.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(a.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var g=this.centralDirOffset+this.centralDirSize;this.zip64&&(g+=20,g+=12+this.zip64EndOfCentralSize);var m=h-g;if(0<m)this.isSignature(h,a.CENTRAL_FILE_HEADER)||(this.reader.zero=m);else if(m<0)throw new Error("Corrupted zip: missing "+Math.abs(m)+" bytes.")},prepareReader:function(f){this.reader=i(f)},load:function(f){this.prepareReader(f),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},r.exports=d},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(n,r,o){"use strict";var i=n("./reader/readerFor"),s=n("./utils"),a=n("./compressedObject"),l=n("./crc32"),c=n("./utf8"),d=n("./compressions"),f=n("./support");function h(g,m){this.options=g,this.loadOptions=m}h.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(g){var m,v;if(g.skip(22),this.fileNameLength=g.readInt(2),v=g.readInt(2),this.fileName=g.readData(this.fileNameLength),g.skip(v),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if((m=(function(k){for(var C in d)if(Object.prototype.hasOwnProperty.call(d,C)&&d[C].magic===k)return d[C];return null})(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+s.pretty(this.compressionMethod)+" unknown (inner file : "+s.transformTo("string",this.fileName)+")");this.decompressed=new a(this.compressedSize,this.uncompressedSize,this.crc32,m,g.readData(this.compressedSize))},readCentralPart:function(g){this.versionMadeBy=g.readInt(2),g.skip(2),this.bitFlag=g.readInt(2),this.compressionMethod=g.readString(2),this.date=g.readDate(),this.crc32=g.readInt(4),this.compressedSize=g.readInt(4),this.uncompressedSize=g.readInt(4);var m=g.readInt(2);if(this.extraFieldsLength=g.readInt(2),this.fileCommentLength=g.readInt(2),this.diskNumberStart=g.readInt(2),this.internalFileAttributes=g.readInt(2),this.externalFileAttributes=g.readInt(4),this.localHeaderOffset=g.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");g.skip(m),this.readExtraFields(g),this.parseZIP64ExtraField(g),this.fileComment=g.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var g=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),g==0&&(this.dosPermissions=63&this.externalFileAttributes),g==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var g=i(this.extraFields[1].value);this.uncompressedSize===s.MAX_VALUE_32BITS&&(this.uncompressedSize=g.readInt(8)),this.compressedSize===s.MAX_VALUE_32BITS&&(this.compressedSize=g.readInt(8)),this.localHeaderOffset===s.MAX_VALUE_32BITS&&(this.localHeaderOffset=g.readInt(8)),this.diskNumberStart===s.MAX_VALUE_32BITS&&(this.diskNumberStart=g.readInt(4))}},readExtraFields:function(g){var m,v,k,C=g.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});g.index+4<C;)m=g.readInt(2),v=g.readInt(2),k=g.readData(v),this.extraFields[m]={id:m,length:v,value:k};g.setIndex(C)},handleUTF8:function(){var g=f.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=c.utf8decode(this.fileName),this.fileCommentStr=c.utf8decode(this.fileComment);else{var m=this.findExtraFieldUnicodePath();if(m!==null)this.fileNameStr=m;else{var v=s.transformTo(g,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(v)}var k=this.findExtraFieldUnicodeComment();if(k!==null)this.fileCommentStr=k;else{var C=s.transformTo(g,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(C)}}},findExtraFieldUnicodePath:function(){var g=this.extraFields[28789];if(g){var m=i(g.value);return m.readInt(1)!==1||l(this.fileName)!==m.readInt(4)?null:c.utf8decode(m.readData(g.length-5))}return null},findExtraFieldUnicodeComment:function(){var g=this.extraFields[25461];if(g){var m=i(g.value);return m.readInt(1)!==1||l(this.fileComment)!==m.readInt(4)?null:c.utf8decode(m.readData(g.length-5))}return null}},r.exports=h},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(n,r,o){"use strict";function i(m,v,k){this.name=m,this.dir=k.dir,this.date=k.date,this.comment=k.comment,this.unixPermissions=k.unixPermissions,this.dosPermissions=k.dosPermissions,this._data=v,this._dataBinary=k.binary,this.options={compression:k.compression,compressionOptions:k.compressionOptions}}var s=n("./stream/StreamHelper"),a=n("./stream/DataWorker"),l=n("./utf8"),c=n("./compressedObject"),d=n("./stream/GenericWorker");i.prototype={internalStream:function(m){var v=null,k="string";try{if(!m)throw new Error("No output type specified.");var C=(k=m.toLowerCase())==="string"||k==="text";k!=="binarystring"&&k!=="text"||(k="string"),v=this._decompressWorker();var _=!this._dataBinary;_&&!C&&(v=v.pipe(new l.Utf8EncodeWorker)),!_&&C&&(v=v.pipe(new l.Utf8DecodeWorker))}catch(b){(v=new d("error")).error(b)}return new s(v,k,"")},async:function(m,v){return this.internalStream(m).accumulate(v)},nodeStream:function(m,v){return this.internalStream(m||"nodebuffer").toNodejsStream(v)},_compressWorker:function(m,v){if(this._data instanceof c&&this._data.compression.magic===m.magic)return this._data.getCompressedWorker();var k=this._decompressWorker();return this._dataBinary||(k=k.pipe(new l.Utf8EncodeWorker)),c.createWorkerFrom(k,m,v)},_decompressWorker:function(){return this._data instanceof c?this._data.getContentWorker():this._data instanceof d?this._data:new a(this._data)}};for(var f=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],h=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]]=h;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 c=0,d=new l(m),f=i.document.createTextNode("");d.observe(f,{characterData:!0}),s=function(){f.data=c=++c%2}}else if(i.setImmediate||i.MessageChannel===void 0)s="document"in i&&"onreadystatechange"in i.document.createElement("script")?function(){var v=i.document.createElement("script");v.onreadystatechange=function(){m(),v.onreadystatechange=null,v.parentNode.removeChild(v),v=null},i.document.documentElement.appendChild(v)}:function(){setTimeout(m,0)};else{var h=new i.MessageChannel;h.port1.onmessage=m,s=function(){h.port2.postMessage(0)}}var g=[];function m(){var v,k;a=!0;for(var C=g.length;C;){for(k=g,g=[],v=-1;++v<C;)k[v]();C=g.length}a=!1}r.exports=function(v){g.push(v)!==1||a||s()}}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(n,r,o){"use strict";var i=n("immediate");function s(){}var a={},l=["REJECTED"],c=["FULFILLED"],d=["PENDING"];function f(C){if(typeof C!="function")throw new TypeError("resolver must be a function");this.state=d,this.queue=[],this.outcome=void 0,C!==s&&v(this,C)}function h(C,_,b){this.promise=C,typeof _=="function"&&(this.onFulfilled=_,this.callFulfilled=this.otherCallFulfilled),typeof b=="function"&&(this.onRejected=b,this.callRejected=this.otherCallRejected)}function g(C,_,b){i(function(){var w;try{w=_(b)}catch(T){return a.reject(C,T)}w===C?a.reject(C,new TypeError("Cannot resolve promise with itself")):a.resolve(C,w)})}function m(C){var _=C&&C.then;if(C&&(typeof C=="object"||typeof C=="function")&&typeof _=="function")return function(){_.apply(C,arguments)}}function v(C,_){var b=!1;function w(N){b||(b=!0,a.reject(C,N))}function T(N){b||(b=!0,a.resolve(C,N))}var L=k(function(){_(T,w)});L.status==="error"&&w(L.value)}function k(C,_){var b={};try{b.value=C(_),b.status="success"}catch(w){b.status="error",b.value=w}return b}(r.exports=f).prototype.finally=function(C){if(typeof C!="function")return this;var _=this.constructor;return this.then(function(b){return _.resolve(C()).then(function(){return b})},function(b){return _.resolve(C()).then(function(){throw b})})},f.prototype.catch=function(C){return this.then(null,C)},f.prototype.then=function(C,_){if(typeof C!="function"&&this.state===c||typeof _!="function"&&this.state===l)return this;var b=new this.constructor(s);return this.state!==d?g(b,this.state===c?C:_,this.outcome):this.queue.push(new h(b,C,_)),b},h.prototype.callFulfilled=function(C){a.resolve(this.promise,C)},h.prototype.otherCallFulfilled=function(C){g(this.promise,this.onFulfilled,C)},h.prototype.callRejected=function(C){a.reject(this.promise,C)},h.prototype.otherCallRejected=function(C){g(this.promise,this.onRejected,C)},a.resolve=function(C,_){var b=k(m,_);if(b.status==="error")return a.reject(C,b.value);var w=b.value;if(w)v(C,w);else{C.state=c,C.outcome=_;for(var T=-1,L=C.queue.length;++T<L;)C.queue[T].callFulfilled(_)}return C},a.reject=function(C,_){C.state=l,C.outcome=_;for(var b=-1,w=C.queue.length;++b<w;)C.queue[b].callRejected(_);return C},f.resolve=function(C){return C instanceof this?C:a.resolve(new this(s),C)},f.reject=function(C){var _=new this(s);return a.reject(_,C)},f.all=function(C){var _=this;if(Object.prototype.toString.call(C)!=="[object Array]")return this.reject(new TypeError("must be an array"));var b=C.length,w=!1;if(!b)return this.resolve([]);for(var T=new Array(b),L=0,N=-1,H=new this(s);++N<b;)M(C[N],N);return H;function M(V,q){_.resolve(V).then(function(D){T[q]=D,++L!==b||w||(w=!0,a.resolve(H,T))},function(D){w||(w=!0,a.reject(H,D))})}},f.race=function(C){var _=this;if(Object.prototype.toString.call(C)!=="[object Array]")return this.reject(new TypeError("must be an array"));var b=C.length,w=!1;if(!b)return this.resolve([]);for(var T=-1,L=new this(s);++T<b;)N=C[T],_.resolve(N).then(function(H){w||(w=!0,a.resolve(L,H))},function(H){w||(w=!0,a.reject(L,H))});var N;return L}},{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"),c=n("./zlib/zstream"),d=Object.prototype.toString,f=0,h=-1,g=0,m=8;function v(C){if(!(this instanceof v))return new v(C);this.options=s.assign({level:h,method:m,chunkSize:16384,windowBits:15,memLevel:8,strategy:g,to:""},C||{});var _=this.options;_.raw&&0<_.windowBits?_.windowBits=-_.windowBits:_.gzip&&0<_.windowBits&&_.windowBits<16&&(_.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new c,this.strm.avail_out=0;var b=i.deflateInit2(this.strm,_.level,_.method,_.windowBits,_.memLevel,_.strategy);if(b!==f)throw new Error(l[b]);if(_.header&&i.deflateSetHeader(this.strm,_.header),_.dictionary){var w;if(w=typeof _.dictionary=="string"?a.string2buf(_.dictionary):d.call(_.dictionary)==="[object ArrayBuffer]"?new Uint8Array(_.dictionary):_.dictionary,(b=i.deflateSetDictionary(this.strm,w))!==f)throw new Error(l[b]);this._dict_set=!0}}function k(C,_){var b=new v(_);if(b.push(C,!0),b.err)throw b.msg||l[b.err];return b.result}v.prototype.push=function(C,_){var b,w,T=this.strm,L=this.options.chunkSize;if(this.ended)return!1;w=_===~~_?_:_===!0?4:0,typeof C=="string"?T.input=a.string2buf(C):d.call(C)==="[object ArrayBuffer]"?T.input=new Uint8Array(C):T.input=C,T.next_in=0,T.avail_in=T.input.length;do{if(T.avail_out===0&&(T.output=new s.Buf8(L),T.next_out=0,T.avail_out=L),(b=i.deflate(T,w))!==1&&b!==f)return this.onEnd(b),!(this.ended=!0);T.avail_out!==0&&(T.avail_in!==0||w!==4&&w!==2)||(this.options.to==="string"?this.onData(a.buf2binstring(s.shrinkBuf(T.output,T.next_out))):this.onData(s.shrinkBuf(T.output,T.next_out)))}while((0<T.avail_in||T.avail_out===0)&&b!==1);return w===4?(b=i.deflateEnd(this.strm),this.onEnd(b),this.ended=!0,b===f):w!==2||(this.onEnd(f),!(T.avail_out=0))},v.prototype.onData=function(C){this.chunks.push(C)},v.prototype.onEnd=function(C){C===f&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=s.flattenChunks(this.chunks)),this.chunks=[],this.err=C,this.msg=this.strm.msg},o.Deflate=v,o.deflate=k,o.deflateRaw=function(C,_){return(_=_||{}).raw=!0,k(C,_)},o.gzip=function(C,_){return(_=_||{}).gzip=!0,k(C,_)}},{"./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"),c=n("./zlib/messages"),d=n("./zlib/zstream"),f=n("./zlib/gzheader"),h=Object.prototype.toString;function g(v){if(!(this instanceof g))return new g(v);this.options=s.assign({chunkSize:16384,windowBits:0,to:""},v||{});var k=this.options;k.raw&&0<=k.windowBits&&k.windowBits<16&&(k.windowBits=-k.windowBits,k.windowBits===0&&(k.windowBits=-15)),!(0<=k.windowBits&&k.windowBits<16)||v&&v.windowBits||(k.windowBits+=32),15<k.windowBits&&k.windowBits<48&&(15&k.windowBits)==0&&(k.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new d,this.strm.avail_out=0;var C=i.inflateInit2(this.strm,k.windowBits);if(C!==l.Z_OK)throw new Error(c[C]);this.header=new f,i.inflateGetHeader(this.strm,this.header)}function m(v,k){var C=new g(k);if(C.push(v,!0),C.err)throw C.msg||c[C.err];return C.result}g.prototype.push=function(v,k){var C,_,b,w,T,L,N=this.strm,H=this.options.chunkSize,M=this.options.dictionary,V=!1;if(this.ended)return!1;_=k===~~k?k:k===!0?l.Z_FINISH:l.Z_NO_FLUSH,typeof v=="string"?N.input=a.binstring2buf(v):h.call(v)==="[object ArrayBuffer]"?N.input=new Uint8Array(v):N.input=v,N.next_in=0,N.avail_in=N.input.length;do{if(N.avail_out===0&&(N.output=new s.Buf8(H),N.next_out=0,N.avail_out=H),(C=i.inflate(N,l.Z_NO_FLUSH))===l.Z_NEED_DICT&&M&&(L=typeof M=="string"?a.string2buf(M):h.call(M)==="[object ArrayBuffer]"?new Uint8Array(M):M,C=i.inflateSetDictionary(this.strm,L)),C===l.Z_BUF_ERROR&&V===!0&&(C=l.Z_OK,V=!1),C!==l.Z_STREAM_END&&C!==l.Z_OK)return this.onEnd(C),!(this.ended=!0);N.next_out&&(N.avail_out!==0&&C!==l.Z_STREAM_END&&(N.avail_in!==0||_!==l.Z_FINISH&&_!==l.Z_SYNC_FLUSH)||(this.options.to==="string"?(b=a.utf8border(N.output,N.next_out),w=N.next_out-b,T=a.buf2string(N.output,b),N.next_out=w,N.avail_out=H-w,w&&s.arraySet(N.output,N.output,b,w,0),this.onData(T)):this.onData(s.shrinkBuf(N.output,N.next_out)))),N.avail_in===0&&N.avail_out===0&&(V=!0)}while((0<N.avail_in||N.avail_out===0)&&C!==l.Z_STREAM_END);return C===l.Z_STREAM_END&&(_=l.Z_FINISH),_===l.Z_FINISH?(C=i.inflateEnd(this.strm),this.onEnd(C),this.ended=!0,C===l.Z_OK):_!==l.Z_SYNC_FLUSH||(this.onEnd(l.Z_OK),!(N.avail_out=0))},g.prototype.onData=function(v){this.chunks.push(v)},g.prototype.onEnd=function(v){v===l.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=s.flattenChunks(this.chunks)),this.chunks=[],this.err=v,this.msg=this.strm.msg},o.Inflate=g,o.inflate=m,o.inflateRaw=function(v,k){return(k=k||{}).raw=!0,m(v,k)},o.ungzip=m},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(n,r,o){"use strict";var i=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";o.assign=function(l){for(var c=Array.prototype.slice.call(arguments,1);c.length;){var d=c.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,c){return l.length===c?l:l.subarray?l.subarray(0,c):(l.length=c,l)};var s={arraySet:function(l,c,d,f,h){if(c.subarray&&l.subarray)l.set(c.subarray(d,d+f),h);else for(var g=0;g<f;g++)l[h+g]=c[d+g]},flattenChunks:function(l){var c,d,f,h,g,m;for(c=f=0,d=l.length;c<d;c++)f+=l[c].length;for(m=new Uint8Array(f),c=h=0,d=l.length;c<d;c++)g=l[c],m.set(g,h),h+=g.length;return m}},a={arraySet:function(l,c,d,f,h){for(var g=0;g<f;g++)l[h+g]=c[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),c=0;c<256;c++)l[c]=252<=c?6:248<=c?5:240<=c?4:224<=c?3:192<=c?2:1;function d(f,h){if(h<65537&&(f.subarray&&a||!f.subarray&&s))return String.fromCharCode.apply(null,i.shrinkBuf(f,h));for(var g="",m=0;m<h;m++)g+=String.fromCharCode(f[m]);return g}l[254]=l[254]=1,o.string2buf=function(f){var h,g,m,v,k,C=f.length,_=0;for(v=0;v<C;v++)(64512&(g=f.charCodeAt(v)))==55296&&v+1<C&&(64512&(m=f.charCodeAt(v+1)))==56320&&(g=65536+(g-55296<<10)+(m-56320),v++),_+=g<128?1:g<2048?2:g<65536?3:4;for(h=new i.Buf8(_),v=k=0;k<_;v++)(64512&(g=f.charCodeAt(v)))==55296&&v+1<C&&(64512&(m=f.charCodeAt(v+1)))==56320&&(g=65536+(g-55296<<10)+(m-56320),v++),g<128?h[k++]=g:(g<2048?h[k++]=192|g>>>6:(g<65536?h[k++]=224|g>>>12:(h[k++]=240|g>>>18,h[k++]=128|g>>>12&63),h[k++]=128|g>>>6&63),h[k++]=128|63&g);return h},o.buf2binstring=function(f){return d(f,f.length)},o.binstring2buf=function(f){for(var h=new i.Buf8(f.length),g=0,m=h.length;g<m;g++)h[g]=f.charCodeAt(g);return h},o.buf2string=function(f,h){var g,m,v,k,C=h||f.length,_=new Array(2*C);for(g=m=0;g<C;)if((v=f[g++])<128)_[m++]=v;else if(4<(k=l[v]))_[m++]=65533,g+=k-1;else{for(v&=k===2?31:k===3?15:7;1<k&&g<C;)v=v<<6|63&f[g++],k--;1<k?_[m++]=65533:v<65536?_[m++]=v:(v-=65536,_[m++]=55296|v>>10&1023,_[m++]=56320|1023&v)}return d(_,m)},o.utf8border=function(f,h){var g;for((h=h||f.length)>f.length&&(h=f.length),g=h-1;0<=g&&(192&f[g])==128;)g--;return g<0||g===0?h:g+l[f[g]]>h?g:h}},{"./common":41}],43:[function(n,r,o){"use strict";r.exports=function(i,s,a,l){for(var c=65535&i|0,d=i>>>16&65535|0,f=0;a!==0;){for(a-=f=2e3<a?2e3:a;d=d+(c=c+s[l++]|0)|0,--f;);c%=65521,d%=65521}return c|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 c=0;c<8;c++)s=1&s?3988292384^s>>>1:s>>>1;a[l]=s}return a})();r.exports=function(s,a,l,c){var d=i,f=c+l;s^=-1;for(var h=c;h<f;h++)s=s>>>8^d[255&(s^a[h])];return-1^s}},{}],46:[function(n,r,o){"use strict";var i,s=n("../utils/common"),a=n("./trees"),l=n("./adler32"),c=n("./crc32"),d=n("./messages"),f=0,h=4,g=0,m=-2,v=-1,k=4,C=2,_=8,b=9,w=286,T=30,L=19,N=2*w+1,H=15,M=3,V=258,q=V+M+1,D=42,B=113,E=1,j=2,J=3,Y=4;function se(S,ne){return S.msg=d[ne],ne}function pe(S){return(S<<1)-(4<S?9:0)}function Ve(S){for(var ne=S.length;0<=--ne;)S[ne]=0}function ge(S){var ne=S.state,O=ne.pending;O>S.avail_out&&(O=S.avail_out),O!==0&&(s.arraySet(S.output,ne.pending_buf,ne.pending_out,O,S.next_out),S.next_out+=O,ne.pending_out+=O,S.total_out+=O,S.avail_out-=O,ne.pending-=O,ne.pending===0&&(ne.pending_out=0))}function be(S,ne){a._tr_flush_block(S,0<=S.block_start?S.block_start:-1,S.strstart-S.block_start,ne),S.block_start=S.strstart,ge(S.strm)}function ve(S,ne){S.pending_buf[S.pending++]=ne}function ke(S,ne){S.pending_buf[S.pending++]=ne>>>8&255,S.pending_buf[S.pending++]=255&ne}function oe(S,ne){var O,P,U=S.max_chain_length,$=S.strstart,Q=S.prev_length,Z=S.nice_match,K=S.strstart>S.w_size-q?S.strstart-(S.w_size-q):0,me=S.window,xe=S.w_mask,he=S.prev,Pe=S.strstart+V,Je=me[$+Q-1],nt=me[$+Q];S.prev_length>=S.good_match&&(U>>=2),Z>S.lookahead&&(Z=S.lookahead);do if(me[(O=ne)+Q]===nt&&me[O+Q-1]===Je&&me[O]===me[$]&&me[++O]===me[$+1]){$+=2,O++;do;while(me[++$]===me[++O]&&me[++$]===me[++O]&&me[++$]===me[++O]&&me[++$]===me[++O]&&me[++$]===me[++O]&&me[++$]===me[++O]&&me[++$]===me[++O]&&me[++$]===me[++O]&&$<Pe);if(P=V-(Pe-$),$=Pe-V,Q<P){if(S.match_start=ne,Z<=(Q=P))break;Je=me[$+Q-1],nt=me[$+Q]}}while((ne=he[ne&xe])>K&&--U!=0);return Q<=S.lookahead?Q:S.lookahead}function Re(S){var ne,O,P,U,$,Q,Z,K,me,xe,he=S.w_size;do{if(U=S.window_size-S.lookahead-S.strstart,S.strstart>=he+(he-q)){for(s.arraySet(S.window,S.window,he,he,0),S.match_start-=he,S.strstart-=he,S.block_start-=he,ne=O=S.hash_size;P=S.head[--ne],S.head[ne]=he<=P?P-he:0,--O;);for(ne=O=he;P=S.prev[--ne],S.prev[ne]=he<=P?P-he:0,--O;);U+=he}if(S.strm.avail_in===0)break;if(Q=S.strm,Z=S.window,K=S.strstart+S.lookahead,me=U,xe=void 0,xe=Q.avail_in,me<xe&&(xe=me),O=xe===0?0:(Q.avail_in-=xe,s.arraySet(Z,Q.input,Q.next_in,xe,K),Q.state.wrap===1?Q.adler=l(Q.adler,Z,xe,K):Q.state.wrap===2&&(Q.adler=c(Q.adler,Z,xe,K)),Q.next_in+=xe,Q.total_in+=xe,xe),S.lookahead+=O,S.lookahead+S.insert>=M)for($=S.strstart-S.insert,S.ins_h=S.window[$],S.ins_h=(S.ins_h<<S.hash_shift^S.window[$+1])&S.hash_mask;S.insert&&(S.ins_h=(S.ins_h<<S.hash_shift^S.window[$+M-1])&S.hash_mask,S.prev[$&S.w_mask]=S.head[S.ins_h],S.head[S.ins_h]=$,$++,S.insert--,!(S.lookahead+S.insert<M)););}while(S.lookahead<q&&S.strm.avail_in!==0)}function je(S,ne){for(var O,P;;){if(S.lookahead<q){if(Re(S),S.lookahead<q&&ne===f)return E;if(S.lookahead===0)break}if(O=0,S.lookahead>=M&&(S.ins_h=(S.ins_h<<S.hash_shift^S.window[S.strstart+M-1])&S.hash_mask,O=S.prev[S.strstart&S.w_mask]=S.head[S.ins_h],S.head[S.ins_h]=S.strstart),O!==0&&S.strstart-O<=S.w_size-q&&(S.match_length=oe(S,O)),S.match_length>=M)if(P=a._tr_tally(S,S.strstart-S.match_start,S.match_length-M),S.lookahead-=S.match_length,S.match_length<=S.max_lazy_match&&S.lookahead>=M){for(S.match_length--;S.strstart++,S.ins_h=(S.ins_h<<S.hash_shift^S.window[S.strstart+M-1])&S.hash_mask,O=S.prev[S.strstart&S.w_mask]=S.head[S.ins_h],S.head[S.ins_h]=S.strstart,--S.match_length!=0;);S.strstart++}else S.strstart+=S.match_length,S.match_length=0,S.ins_h=S.window[S.strstart],S.ins_h=(S.ins_h<<S.hash_shift^S.window[S.strstart+1])&S.hash_mask;else P=a._tr_tally(S,0,S.window[S.strstart]),S.lookahead--,S.strstart++;if(P&&(be(S,!1),S.strm.avail_out===0))return E}return S.insert=S.strstart<M-1?S.strstart:M-1,ne===h?(be(S,!0),S.strm.avail_out===0?J:Y):S.last_lit&&(be(S,!1),S.strm.avail_out===0)?E:j}function tt(S,ne){for(var O,P,U;;){if(S.lookahead<q){if(Re(S),S.lookahead<q&&ne===f)return E;if(S.lookahead===0)break}if(O=0,S.lookahead>=M&&(S.ins_h=(S.ins_h<<S.hash_shift^S.window[S.strstart+M-1])&S.hash_mask,O=S.prev[S.strstart&S.w_mask]=S.head[S.ins_h],S.head[S.ins_h]=S.strstart),S.prev_length=S.match_length,S.prev_match=S.match_start,S.match_length=M-1,O!==0&&S.prev_length<S.max_lazy_match&&S.strstart-O<=S.w_size-q&&(S.match_length=oe(S,O),S.match_length<=5&&(S.strategy===1||S.match_length===M&&4096<S.strstart-S.match_start)&&(S.match_length=M-1)),S.prev_length>=M&&S.match_length<=S.prev_length){for(U=S.strstart+S.lookahead-M,P=a._tr_tally(S,S.strstart-1-S.prev_match,S.prev_length-M),S.lookahead-=S.prev_length-1,S.prev_length-=2;++S.strstart<=U&&(S.ins_h=(S.ins_h<<S.hash_shift^S.window[S.strstart+M-1])&S.hash_mask,O=S.prev[S.strstart&S.w_mask]=S.head[S.ins_h],S.head[S.ins_h]=S.strstart),--S.prev_length!=0;);if(S.match_available=0,S.match_length=M-1,S.strstart++,P&&(be(S,!1),S.strm.avail_out===0))return E}else if(S.match_available){if((P=a._tr_tally(S,0,S.window[S.strstart-1]))&&be(S,!1),S.strstart++,S.lookahead--,S.strm.avail_out===0)return E}else S.match_available=1,S.strstart++,S.lookahead--}return S.match_available&&(P=a._tr_tally(S,0,S.window[S.strstart-1]),S.match_available=0),S.insert=S.strstart<M-1?S.strstart:M-1,ne===h?(be(S,!0),S.strm.avail_out===0?J:Y):S.last_lit&&(be(S,!1),S.strm.avail_out===0)?E:j}function wt(S,ne,O,P,U){this.good_length=S,this.max_lazy=ne,this.nice_length=O,this.max_chain=P,this.func=U}function Te(){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=_,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*N),this.dyn_dtree=new s.Buf16(2*(2*T+1)),this.bl_tree=new s.Buf16(2*(2*L+1)),Ve(this.dyn_ltree),Ve(this.dyn_dtree),Ve(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new s.Buf16(H+1),this.heap=new s.Buf16(2*w+1),Ve(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new s.Buf16(2*w+1),Ve(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 We(S){var ne;return S&&S.state?(S.total_in=S.total_out=0,S.data_type=C,(ne=S.state).pending=0,ne.pending_out=0,ne.wrap<0&&(ne.wrap=-ne.wrap),ne.status=ne.wrap?D:B,S.adler=ne.wrap===2?0:1,ne.last_flush=f,a._tr_init(ne),g):se(S,m)}function Ye(S){var ne=We(S);return ne===g&&(function(O){O.window_size=2*O.w_size,Ve(O.head),O.max_lazy_match=i[O.level].max_lazy,O.good_match=i[O.level].good_length,O.nice_match=i[O.level].nice_length,O.max_chain_length=i[O.level].max_chain,O.strstart=0,O.block_start=0,O.lookahead=0,O.insert=0,O.match_length=O.prev_length=M-1,O.match_available=0,O.ins_h=0})(S.state),ne}function ee(S,ne,O,P,U,$){if(!S)return m;var Q=1;if(ne===v&&(ne=6),P<0?(Q=0,P=-P):15<P&&(Q=2,P-=16),U<1||b<U||O!==_||P<8||15<P||ne<0||9<ne||$<0||k<$)return se(S,m);P===8&&(P=9);var Z=new Te;return(S.state=Z).strm=S,Z.wrap=Q,Z.gzhead=null,Z.w_bits=P,Z.w_size=1<<Z.w_bits,Z.w_mask=Z.w_size-1,Z.hash_bits=U+7,Z.hash_size=1<<Z.hash_bits,Z.hash_mask=Z.hash_size-1,Z.hash_shift=~~((Z.hash_bits+M-1)/M),Z.window=new s.Buf8(2*Z.w_size),Z.head=new s.Buf16(Z.hash_size),Z.prev=new s.Buf16(Z.w_size),Z.lit_bufsize=1<<U+6,Z.pending_buf_size=4*Z.lit_bufsize,Z.pending_buf=new s.Buf8(Z.pending_buf_size),Z.d_buf=1*Z.lit_bufsize,Z.l_buf=3*Z.lit_bufsize,Z.level=ne,Z.strategy=$,Z.method=O,Ye(S)}i=[new wt(0,0,0,0,function(S,ne){var O=65535;for(O>S.pending_buf_size-5&&(O=S.pending_buf_size-5);;){if(S.lookahead<=1){if(Re(S),S.lookahead===0&&ne===f)return E;if(S.lookahead===0)break}S.strstart+=S.lookahead,S.lookahead=0;var P=S.block_start+O;if((S.strstart===0||S.strstart>=P)&&(S.lookahead=S.strstart-P,S.strstart=P,be(S,!1),S.strm.avail_out===0)||S.strstart-S.block_start>=S.w_size-q&&(be(S,!1),S.strm.avail_out===0))return E}return S.insert=0,ne===h?(be(S,!0),S.strm.avail_out===0?J:Y):(S.strstart>S.block_start&&(be(S,!1),S.strm.avail_out),E)}),new wt(4,4,8,4,je),new wt(4,5,16,8,je),new wt(4,6,32,32,je),new wt(4,4,16,16,tt),new wt(8,16,32,32,tt),new wt(8,16,128,128,tt),new wt(8,32,128,256,tt),new wt(32,128,258,1024,tt),new wt(32,258,258,4096,tt)],o.deflateInit=function(S,ne){return ee(S,ne,_,15,8,0)},o.deflateInit2=ee,o.deflateReset=Ye,o.deflateResetKeep=We,o.deflateSetHeader=function(S,ne){return S&&S.state?S.state.wrap!==2?m:(S.state.gzhead=ne,g):m},o.deflate=function(S,ne){var O,P,U,$;if(!S||!S.state||5<ne||ne<0)return S?se(S,m):m;if(P=S.state,!S.output||!S.input&&S.avail_in!==0||P.status===666&&ne!==h)return se(S,S.avail_out===0?-5:m);if(P.strm=S,O=P.last_flush,P.last_flush=ne,P.status===D)if(P.wrap===2)S.adler=0,ve(P,31),ve(P,139),ve(P,8),P.gzhead?(ve(P,(P.gzhead.text?1:0)+(P.gzhead.hcrc?2:0)+(P.gzhead.extra?4:0)+(P.gzhead.name?8:0)+(P.gzhead.comment?16:0)),ve(P,255&P.gzhead.time),ve(P,P.gzhead.time>>8&255),ve(P,P.gzhead.time>>16&255),ve(P,P.gzhead.time>>24&255),ve(P,P.level===9?2:2<=P.strategy||P.level<2?4:0),ve(P,255&P.gzhead.os),P.gzhead.extra&&P.gzhead.extra.length&&(ve(P,255&P.gzhead.extra.length),ve(P,P.gzhead.extra.length>>8&255)),P.gzhead.hcrc&&(S.adler=c(S.adler,P.pending_buf,P.pending,0)),P.gzindex=0,P.status=69):(ve(P,0),ve(P,0),ve(P,0),ve(P,0),ve(P,0),ve(P,P.level===9?2:2<=P.strategy||P.level<2?4:0),ve(P,3),P.status=B);else{var Q=_+(P.w_bits-8<<4)<<8;Q|=(2<=P.strategy||P.level<2?0:P.level<6?1:P.level===6?2:3)<<6,P.strstart!==0&&(Q|=32),Q+=31-Q%31,P.status=B,ke(P,Q),P.strstart!==0&&(ke(P,S.adler>>>16),ke(P,65535&S.adler)),S.adler=1}if(P.status===69)if(P.gzhead.extra){for(U=P.pending;P.gzindex<(65535&P.gzhead.extra.length)&&(P.pending!==P.pending_buf_size||(P.gzhead.hcrc&&P.pending>U&&(S.adler=c(S.adler,P.pending_buf,P.pending-U,U)),ge(S),U=P.pending,P.pending!==P.pending_buf_size));)ve(P,255&P.gzhead.extra[P.gzindex]),P.gzindex++;P.gzhead.hcrc&&P.pending>U&&(S.adler=c(S.adler,P.pending_buf,P.pending-U,U)),P.gzindex===P.gzhead.extra.length&&(P.gzindex=0,P.status=73)}else P.status=73;if(P.status===73)if(P.gzhead.name){U=P.pending;do{if(P.pending===P.pending_buf_size&&(P.gzhead.hcrc&&P.pending>U&&(S.adler=c(S.adler,P.pending_buf,P.pending-U,U)),ge(S),U=P.pending,P.pending===P.pending_buf_size)){$=1;break}$=P.gzindex<P.gzhead.name.length?255&P.gzhead.name.charCodeAt(P.gzindex++):0,ve(P,$)}while($!==0);P.gzhead.hcrc&&P.pending>U&&(S.adler=c(S.adler,P.pending_buf,P.pending-U,U)),$===0&&(P.gzindex=0,P.status=91)}else P.status=91;if(P.status===91)if(P.gzhead.comment){U=P.pending;do{if(P.pending===P.pending_buf_size&&(P.gzhead.hcrc&&P.pending>U&&(S.adler=c(S.adler,P.pending_buf,P.pending-U,U)),ge(S),U=P.pending,P.pending===P.pending_buf_size)){$=1;break}$=P.gzindex<P.gzhead.comment.length?255&P.gzhead.comment.charCodeAt(P.gzindex++):0,ve(P,$)}while($!==0);P.gzhead.hcrc&&P.pending>U&&(S.adler=c(S.adler,P.pending_buf,P.pending-U,U)),$===0&&(P.status=103)}else P.status=103;if(P.status===103&&(P.gzhead.hcrc?(P.pending+2>P.pending_buf_size&&ge(S),P.pending+2<=P.pending_buf_size&&(ve(P,255&S.adler),ve(P,S.adler>>8&255),S.adler=0,P.status=B)):P.status=B),P.pending!==0){if(ge(S),S.avail_out===0)return P.last_flush=-1,g}else if(S.avail_in===0&&pe(ne)<=pe(O)&&ne!==h)return se(S,-5);if(P.status===666&&S.avail_in!==0)return se(S,-5);if(S.avail_in!==0||P.lookahead!==0||ne!==f&&P.status!==666){var Z=P.strategy===2?(function(K,me){for(var xe;;){if(K.lookahead===0&&(Re(K),K.lookahead===0)){if(me===f)return E;break}if(K.match_length=0,xe=a._tr_tally(K,0,K.window[K.strstart]),K.lookahead--,K.strstart++,xe&&(be(K,!1),K.strm.avail_out===0))return E}return K.insert=0,me===h?(be(K,!0),K.strm.avail_out===0?J:Y):K.last_lit&&(be(K,!1),K.strm.avail_out===0)?E:j})(P,ne):P.strategy===3?(function(K,me){for(var xe,he,Pe,Je,nt=K.window;;){if(K.lookahead<=V){if(Re(K),K.lookahead<=V&&me===f)return E;if(K.lookahead===0)break}if(K.match_length=0,K.lookahead>=M&&0<K.strstart&&(he=nt[Pe=K.strstart-1])===nt[++Pe]&&he===nt[++Pe]&&he===nt[++Pe]){Je=K.strstart+V;do;while(he===nt[++Pe]&&he===nt[++Pe]&&he===nt[++Pe]&&he===nt[++Pe]&&he===nt[++Pe]&&he===nt[++Pe]&&he===nt[++Pe]&&he===nt[++Pe]&&Pe<Je);K.match_length=V-(Je-Pe),K.match_length>K.lookahead&&(K.match_length=K.lookahead)}if(K.match_length>=M?(xe=a._tr_tally(K,1,K.match_length-M),K.lookahead-=K.match_length,K.strstart+=K.match_length,K.match_length=0):(xe=a._tr_tally(K,0,K.window[K.strstart]),K.lookahead--,K.strstart++),xe&&(be(K,!1),K.strm.avail_out===0))return E}return K.insert=0,me===h?(be(K,!0),K.strm.avail_out===0?J:Y):K.last_lit&&(be(K,!1),K.strm.avail_out===0)?E:j})(P,ne):i[P.level].func(P,ne);if(Z!==J&&Z!==Y||(P.status=666),Z===E||Z===J)return S.avail_out===0&&(P.last_flush=-1),g;if(Z===j&&(ne===1?a._tr_align(P):ne!==5&&(a._tr_stored_block(P,0,0,!1),ne===3&&(Ve(P.head),P.lookahead===0&&(P.strstart=0,P.block_start=0,P.insert=0))),ge(S),S.avail_out===0))return P.last_flush=-1,g}return ne!==h?g:P.wrap<=0?1:(P.wrap===2?(ve(P,255&S.adler),ve(P,S.adler>>8&255),ve(P,S.adler>>16&255),ve(P,S.adler>>24&255),ve(P,255&S.total_in),ve(P,S.total_in>>8&255),ve(P,S.total_in>>16&255),ve(P,S.total_in>>24&255)):(ke(P,S.adler>>>16),ke(P,65535&S.adler)),ge(S),0<P.wrap&&(P.wrap=-P.wrap),P.pending!==0?g:1)},o.deflateEnd=function(S){var ne;return S&&S.state?(ne=S.state.status)!==D&&ne!==69&&ne!==73&&ne!==91&&ne!==103&&ne!==B&&ne!==666?se(S,m):(S.state=null,ne===B?se(S,-3):g):m},o.deflateSetDictionary=function(S,ne){var O,P,U,$,Q,Z,K,me,xe=ne.length;if(!S||!S.state||($=(O=S.state).wrap)===2||$===1&&O.status!==D||O.lookahead)return m;for($===1&&(S.adler=l(S.adler,ne,xe,0)),O.wrap=0,xe>=O.w_size&&($===0&&(Ve(O.head),O.strstart=0,O.block_start=0,O.insert=0),me=new s.Buf8(O.w_size),s.arraySet(me,ne,xe-O.w_size,O.w_size,0),ne=me,xe=O.w_size),Q=S.avail_in,Z=S.next_in,K=S.input,S.avail_in=xe,S.next_in=0,S.input=ne,Re(O);O.lookahead>=M;){for(P=O.strstart,U=O.lookahead-(M-1);O.ins_h=(O.ins_h<<O.hash_shift^O.window[P+M-1])&O.hash_mask,O.prev[P&O.w_mask]=O.head[O.ins_h],O.head[O.ins_h]=P,P++,--U;);O.strstart=P,O.lookahead=M-1,Re(O)}return O.strstart+=O.lookahead,O.block_start=O.strstart,O.insert=O.lookahead,O.lookahead=0,O.match_length=O.prev_length=M-1,O.match_available=0,S.next_in=Z,S.input=K,S.avail_in=Q,O.wrap=$,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,c,d,f,h,g,m,v,k,C,_,b,w,T,L,N,H,M,V,q,D,B,E=i.input,j;c=l+(i.avail_in-5),d=i.next_out,j=i.output,f=d-(s-i.avail_out),h=d+(i.avail_out-257),g=a.dmax,m=a.wsize,v=a.whave,k=a.wnext,C=a.window,_=a.hold,b=a.bits,w=a.lencode,T=a.distcode,L=(1<<a.lenbits)-1,N=(1<<a.distbits)-1;e:do{b<15&&(_+=E[l++]<<b,b+=8,_+=E[l++]<<b,b+=8),H=w[_&L];t:for(;;){if(_>>>=M=H>>>24,b-=M,(M=H>>>16&255)===0)j[d++]=65535&H;else{if(!(16&M)){if((64&M)==0){H=w[(65535&H)+(_&(1<<M)-1)];continue t}if(32&M){a.mode=12;break e}i.msg="invalid literal/length code",a.mode=30;break e}V=65535&H,(M&=15)&&(b<M&&(_+=E[l++]<<b,b+=8),V+=_&(1<<M)-1,_>>>=M,b-=M),b<15&&(_+=E[l++]<<b,b+=8,_+=E[l++]<<b,b+=8),H=T[_&N];n:for(;;){if(_>>>=M=H>>>24,b-=M,!(16&(M=H>>>16&255))){if((64&M)==0){H=T[(65535&H)+(_&(1<<M)-1)];continue n}i.msg="invalid distance code",a.mode=30;break e}if(q=65535&H,b<(M&=15)&&(_+=E[l++]<<b,(b+=8)<M&&(_+=E[l++]<<b,b+=8)),g<(q+=_&(1<<M)-1)){i.msg="invalid distance too far back",a.mode=30;break e}if(_>>>=M,b-=M,(M=d-f)<q){if(v<(M=q-M)&&a.sane){i.msg="invalid distance too far back",a.mode=30;break e}if(B=C,(D=0)===k){if(D+=m-M,M<V){for(V-=M;j[d++]=C[D++],--M;);D=d-q,B=j}}else if(k<M){if(D+=m+k-M,(M-=k)<V){for(V-=M;j[d++]=C[D++],--M;);if(D=0,k<V){for(V-=M=k;j[d++]=C[D++],--M;);D=d-q,B=j}}}else if(D+=k-M,M<V){for(V-=M;j[d++]=C[D++],--M;);D=d-q,B=j}for(;2<V;)j[d++]=B[D++],j[d++]=B[D++],j[d++]=B[D++],V-=3;V&&(j[d++]=B[D++],1<V&&(j[d++]=B[D++]))}else{for(D=d-q;j[d++]=j[D++],j[d++]=j[D++],j[d++]=j[D++],2<(V-=3););V&&(j[d++]=j[D++],1<V&&(j[d++]=j[D++]))}break}}break}}while(l<c&&d<h);l-=V=b>>3,_&=(1<<(b-=V<<3))-1,i.next_in=l,i.next_out=d,i.avail_in=l<c?c-l+5:5-(l-c),i.avail_out=d<h?h-d+257:257-(d-h),a.hold=_,a.bits=b}},{}],49:[function(n,r,o){"use strict";var i=n("../utils/common"),s=n("./adler32"),a=n("./crc32"),l=n("./inffast"),c=n("./inftrees"),d=1,f=2,h=0,g=-2,m=1,v=852,k=592;function C(D){return(D>>>24&255)+(D>>>8&65280)+((65280&D)<<8)+((255&D)<<24)}function _(){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 b(D){var B;return D&&D.state?(B=D.state,D.total_in=D.total_out=B.total=0,D.msg="",B.wrap&&(D.adler=1&B.wrap),B.mode=m,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(v),B.distcode=B.distdyn=new i.Buf32(k),B.sane=1,B.back=-1,h):g}function w(D){var B;return D&&D.state?((B=D.state).wsize=0,B.whave=0,B.wnext=0,b(D)):g}function T(D,B){var E,j;return D&&D.state?(j=D.state,B<0?(E=0,B=-B):(E=1+(B>>4),B<48&&(B&=15)),B&&(B<8||15<B)?g:(j.window!==null&&j.wbits!==B&&(j.window=null),j.wrap=E,j.wbits=B,w(D))):g}function L(D,B){var E,j;return D?(j=new _,(D.state=j).window=null,(E=T(D,B))!==h&&(D.state=null),E):g}var N,H,M=!0;function V(D){if(M){var B;for(N=new i.Buf32(512),H=new i.Buf32(32),B=0;B<144;)D.lens[B++]=8;for(;B<256;)D.lens[B++]=9;for(;B<280;)D.lens[B++]=7;for(;B<288;)D.lens[B++]=8;for(c(d,D.lens,0,288,N,0,D.work,{bits:9}),B=0;B<32;)D.lens[B++]=5;c(f,D.lens,0,32,H,0,D.work,{bits:5}),M=!1}D.lencode=N,D.lenbits=9,D.distcode=H,D.distbits=5}function q(D,B,E,j){var J,Y=D.state;return Y.window===null&&(Y.wsize=1<<Y.wbits,Y.wnext=0,Y.whave=0,Y.window=new i.Buf8(Y.wsize)),j>=Y.wsize?(i.arraySet(Y.window,B,E-Y.wsize,Y.wsize,0),Y.wnext=0,Y.whave=Y.wsize):(j<(J=Y.wsize-Y.wnext)&&(J=j),i.arraySet(Y.window,B,E-j,J,Y.wnext),(j-=J)?(i.arraySet(Y.window,B,E-j,j,0),Y.wnext=j,Y.whave=Y.wsize):(Y.wnext+=J,Y.wnext===Y.wsize&&(Y.wnext=0),Y.whave<Y.wsize&&(Y.whave+=J))),0}o.inflateReset=w,o.inflateReset2=T,o.inflateResetKeep=b,o.inflateInit=function(D){return L(D,15)},o.inflateInit2=L,o.inflate=function(D,B){var E,j,J,Y,se,pe,Ve,ge,be,ve,ke,oe,Re,je,tt,wt,Te,We,Ye,ee,S,ne,O,P,U=0,$=new i.Buf8(4),Q=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!D||!D.state||!D.output||!D.input&&D.avail_in!==0)return g;(E=D.state).mode===12&&(E.mode=13),se=D.next_out,J=D.output,Ve=D.avail_out,Y=D.next_in,j=D.input,pe=D.avail_in,ge=E.hold,be=E.bits,ve=pe,ke=Ve,ne=h;e:for(;;)switch(E.mode){case m:if(E.wrap===0){E.mode=13;break}for(;be<16;){if(pe===0)break e;pe--,ge+=j[Y++]<<be,be+=8}if(2&E.wrap&&ge===35615){$[E.check=0]=255&ge,$[1]=ge>>>8&255,E.check=a(E.check,$,2,0),be=ge=0,E.mode=2;break}if(E.flags=0,E.head&&(E.head.done=!1),!(1&E.wrap)||(((255&ge)<<8)+(ge>>8))%31){D.msg="incorrect header check",E.mode=30;break}if((15&ge)!=8){D.msg="unknown compression method",E.mode=30;break}if(be-=4,S=8+(15&(ge>>>=4)),E.wbits===0)E.wbits=S;else if(S>E.wbits){D.msg="invalid window size",E.mode=30;break}E.dmax=1<<S,D.adler=E.check=1,E.mode=512&ge?10:12,be=ge=0;break;case 2:for(;be<16;){if(pe===0)break e;pe--,ge+=j[Y++]<<be,be+=8}if(E.flags=ge,(255&E.flags)!=8){D.msg="unknown compression method",E.mode=30;break}if(57344&E.flags){D.msg="unknown header flags set",E.mode=30;break}E.head&&(E.head.text=ge>>8&1),512&E.flags&&($[0]=255&ge,$[1]=ge>>>8&255,E.check=a(E.check,$,2,0)),be=ge=0,E.mode=3;case 3:for(;be<32;){if(pe===0)break e;pe--,ge+=j[Y++]<<be,be+=8}E.head&&(E.head.time=ge),512&E.flags&&($[0]=255&ge,$[1]=ge>>>8&255,$[2]=ge>>>16&255,$[3]=ge>>>24&255,E.check=a(E.check,$,4,0)),be=ge=0,E.mode=4;case 4:for(;be<16;){if(pe===0)break e;pe--,ge+=j[Y++]<<be,be+=8}E.head&&(E.head.xflags=255&ge,E.head.os=ge>>8),512&E.flags&&($[0]=255&ge,$[1]=ge>>>8&255,E.check=a(E.check,$,2,0)),be=ge=0,E.mode=5;case 5:if(1024&E.flags){for(;be<16;){if(pe===0)break e;pe--,ge+=j[Y++]<<be,be+=8}E.length=ge,E.head&&(E.head.extra_len=ge),512&E.flags&&($[0]=255&ge,$[1]=ge>>>8&255,E.check=a(E.check,$,2,0)),be=ge=0}else E.head&&(E.head.extra=null);E.mode=6;case 6:if(1024&E.flags&&(pe<(oe=E.length)&&(oe=pe),oe&&(E.head&&(S=E.head.extra_len-E.length,E.head.extra||(E.head.extra=new Array(E.head.extra_len)),i.arraySet(E.head.extra,j,Y,oe,S)),512&E.flags&&(E.check=a(E.check,j,oe,Y)),pe-=oe,Y+=oe,E.length-=oe),E.length))break e;E.length=0,E.mode=7;case 7:if(2048&E.flags){if(pe===0)break e;for(oe=0;S=j[Y+oe++],E.head&&S&&E.length<65536&&(E.head.name+=String.fromCharCode(S)),S&&oe<pe;);if(512&E.flags&&(E.check=a(E.check,j,oe,Y)),pe-=oe,Y+=oe,S)break e}else E.head&&(E.head.name=null);E.length=0,E.mode=8;case 8:if(4096&E.flags){if(pe===0)break e;for(oe=0;S=j[Y+oe++],E.head&&S&&E.length<65536&&(E.head.comment+=String.fromCharCode(S)),S&&oe<pe;);if(512&E.flags&&(E.check=a(E.check,j,oe,Y)),pe-=oe,Y+=oe,S)break e}else E.head&&(E.head.comment=null);E.mode=9;case 9:if(512&E.flags){for(;be<16;){if(pe===0)break e;pe--,ge+=j[Y++]<<be,be+=8}if(ge!==(65535&E.check)){D.msg="header crc mismatch",E.mode=30;break}be=ge=0}E.head&&(E.head.hcrc=E.flags>>9&1,E.head.done=!0),D.adler=E.check=0,E.mode=12;break;case 10:for(;be<32;){if(pe===0)break e;pe--,ge+=j[Y++]<<be,be+=8}D.adler=E.check=C(ge),be=ge=0,E.mode=11;case 11:if(E.havedict===0)return D.next_out=se,D.avail_out=Ve,D.next_in=Y,D.avail_in=pe,E.hold=ge,E.bits=be,2;D.adler=E.check=1,E.mode=12;case 12:if(B===5||B===6)break e;case 13:if(E.last){ge>>>=7&be,be-=7&be,E.mode=27;break}for(;be<3;){if(pe===0)break e;pe--,ge+=j[Y++]<<be,be+=8}switch(E.last=1&ge,be-=1,3&(ge>>>=1)){case 0:E.mode=14;break;case 1:if(V(E),E.mode=20,B!==6)break;ge>>>=2,be-=2;break e;case 2:E.mode=17;break;case 3:D.msg="invalid block type",E.mode=30}ge>>>=2,be-=2;break;case 14:for(ge>>>=7&be,be-=7&be;be<32;){if(pe===0)break e;pe--,ge+=j[Y++]<<be,be+=8}if((65535&ge)!=(ge>>>16^65535)){D.msg="invalid stored block lengths",E.mode=30;break}if(E.length=65535&ge,be=ge=0,E.mode=15,B===6)break e;case 15:E.mode=16;case 16:if(oe=E.length){if(pe<oe&&(oe=pe),Ve<oe&&(oe=Ve),oe===0)break e;i.arraySet(J,j,Y,oe,se),pe-=oe,Y+=oe,Ve-=oe,se+=oe,E.length-=oe;break}E.mode=12;break;case 17:for(;be<14;){if(pe===0)break e;pe--,ge+=j[Y++]<<be,be+=8}if(E.nlen=257+(31&ge),ge>>>=5,be-=5,E.ndist=1+(31&ge),ge>>>=5,be-=5,E.ncode=4+(15&ge),ge>>>=4,be-=4,286<E.nlen||30<E.ndist){D.msg="too many length or distance symbols",E.mode=30;break}E.have=0,E.mode=18;case 18:for(;E.have<E.ncode;){for(;be<3;){if(pe===0)break e;pe--,ge+=j[Y++]<<be,be+=8}E.lens[Q[E.have++]]=7&ge,ge>>>=3,be-=3}for(;E.have<19;)E.lens[Q[E.have++]]=0;if(E.lencode=E.lendyn,E.lenbits=7,O={bits:E.lenbits},ne=c(0,E.lens,0,19,E.lencode,0,E.work,O),E.lenbits=O.bits,ne){D.msg="invalid code lengths set",E.mode=30;break}E.have=0,E.mode=19;case 19:for(;E.have<E.nlen+E.ndist;){for(;wt=(U=E.lencode[ge&(1<<E.lenbits)-1])>>>16&255,Te=65535&U,!((tt=U>>>24)<=be);){if(pe===0)break e;pe--,ge+=j[Y++]<<be,be+=8}if(Te<16)ge>>>=tt,be-=tt,E.lens[E.have++]=Te;else{if(Te===16){for(P=tt+2;be<P;){if(pe===0)break e;pe--,ge+=j[Y++]<<be,be+=8}if(ge>>>=tt,be-=tt,E.have===0){D.msg="invalid bit length repeat",E.mode=30;break}S=E.lens[E.have-1],oe=3+(3&ge),ge>>>=2,be-=2}else if(Te===17){for(P=tt+3;be<P;){if(pe===0)break e;pe--,ge+=j[Y++]<<be,be+=8}be-=tt,S=0,oe=3+(7&(ge>>>=tt)),ge>>>=3,be-=3}else{for(P=tt+7;be<P;){if(pe===0)break e;pe--,ge+=j[Y++]<<be,be+=8}be-=tt,S=0,oe=11+(127&(ge>>>=tt)),ge>>>=7,be-=7}if(E.have+oe>E.nlen+E.ndist){D.msg="invalid bit length repeat",E.mode=30;break}for(;oe--;)E.lens[E.have++]=S}}if(E.mode===30)break;if(E.lens[256]===0){D.msg="invalid code -- missing end-of-block",E.mode=30;break}if(E.lenbits=9,O={bits:E.lenbits},ne=c(d,E.lens,0,E.nlen,E.lencode,0,E.work,O),E.lenbits=O.bits,ne){D.msg="invalid literal/lengths set",E.mode=30;break}if(E.distbits=6,E.distcode=E.distdyn,O={bits:E.distbits},ne=c(f,E.lens,E.nlen,E.ndist,E.distcode,0,E.work,O),E.distbits=O.bits,ne){D.msg="invalid distances set",E.mode=30;break}if(E.mode=20,B===6)break e;case 20:E.mode=21;case 21:if(6<=pe&&258<=Ve){D.next_out=se,D.avail_out=Ve,D.next_in=Y,D.avail_in=pe,E.hold=ge,E.bits=be,l(D,ke),se=D.next_out,J=D.output,Ve=D.avail_out,Y=D.next_in,j=D.input,pe=D.avail_in,ge=E.hold,be=E.bits,E.mode===12&&(E.back=-1);break}for(E.back=0;wt=(U=E.lencode[ge&(1<<E.lenbits)-1])>>>16&255,Te=65535&U,!((tt=U>>>24)<=be);){if(pe===0)break e;pe--,ge+=j[Y++]<<be,be+=8}if(wt&&(240&wt)==0){for(We=tt,Ye=wt,ee=Te;wt=(U=E.lencode[ee+((ge&(1<<We+Ye)-1)>>We)])>>>16&255,Te=65535&U,!(We+(tt=U>>>24)<=be);){if(pe===0)break e;pe--,ge+=j[Y++]<<be,be+=8}ge>>>=We,be-=We,E.back+=We}if(ge>>>=tt,be-=tt,E.back+=tt,E.length=Te,wt===0){E.mode=26;break}if(32&wt){E.back=-1,E.mode=12;break}if(64&wt){D.msg="invalid literal/length code",E.mode=30;break}E.extra=15&wt,E.mode=22;case 22:if(E.extra){for(P=E.extra;be<P;){if(pe===0)break e;pe--,ge+=j[Y++]<<be,be+=8}E.length+=ge&(1<<E.extra)-1,ge>>>=E.extra,be-=E.extra,E.back+=E.extra}E.was=E.length,E.mode=23;case 23:for(;wt=(U=E.distcode[ge&(1<<E.distbits)-1])>>>16&255,Te=65535&U,!((tt=U>>>24)<=be);){if(pe===0)break e;pe--,ge+=j[Y++]<<be,be+=8}if((240&wt)==0){for(We=tt,Ye=wt,ee=Te;wt=(U=E.distcode[ee+((ge&(1<<We+Ye)-1)>>We)])>>>16&255,Te=65535&U,!(We+(tt=U>>>24)<=be);){if(pe===0)break e;pe--,ge+=j[Y++]<<be,be+=8}ge>>>=We,be-=We,E.back+=We}if(ge>>>=tt,be-=tt,E.back+=tt,64&wt){D.msg="invalid distance code",E.mode=30;break}E.offset=Te,E.extra=15&wt,E.mode=24;case 24:if(E.extra){for(P=E.extra;be<P;){if(pe===0)break e;pe--,ge+=j[Y++]<<be,be+=8}E.offset+=ge&(1<<E.extra)-1,ge>>>=E.extra,be-=E.extra,E.back+=E.extra}if(E.offset>E.dmax){D.msg="invalid distance too far back",E.mode=30;break}E.mode=25;case 25:if(Ve===0)break e;if(oe=ke-Ve,E.offset>oe){if((oe=E.offset-oe)>E.whave&&E.sane){D.msg="invalid distance too far back",E.mode=30;break}Re=oe>E.wnext?(oe-=E.wnext,E.wsize-oe):E.wnext-oe,oe>E.length&&(oe=E.length),je=E.window}else je=J,Re=se-E.offset,oe=E.length;for(Ve<oe&&(oe=Ve),Ve-=oe,E.length-=oe;J[se++]=je[Re++],--oe;);E.length===0&&(E.mode=21);break;case 26:if(Ve===0)break e;J[se++]=E.length,Ve--,E.mode=21;break;case 27:if(E.wrap){for(;be<32;){if(pe===0)break e;pe--,ge|=j[Y++]<<be,be+=8}if(ke-=Ve,D.total_out+=ke,E.total+=ke,ke&&(D.adler=E.check=E.flags?a(E.check,J,ke,se-ke):s(E.check,J,ke,se-ke)),ke=Ve,(E.flags?ge:C(ge))!==E.check){D.msg="incorrect data check",E.mode=30;break}be=ge=0}E.mode=28;case 28:if(E.wrap&&E.flags){for(;be<32;){if(pe===0)break e;pe--,ge+=j[Y++]<<be,be+=8}if(ge!==(4294967295&E.total)){D.msg="incorrect length check",E.mode=30;break}be=ge=0}E.mode=29;case 29:ne=1;break e;case 30:ne=-3;break e;case 31:return-4;default:return g}return D.next_out=se,D.avail_out=Ve,D.next_in=Y,D.avail_in=pe,E.hold=ge,E.bits=be,(E.wsize||ke!==D.avail_out&&E.mode<30&&(E.mode<27||B!==4))&&q(D,D.output,D.next_out,ke-D.avail_out)?(E.mode=31,-4):(ve-=D.avail_in,ke-=D.avail_out,D.total_in+=ve,D.total_out+=ke,E.total+=ke,E.wrap&&ke&&(D.adler=E.check=E.flags?a(E.check,J,ke,D.next_out-ke):s(E.check,J,ke,D.next_out-ke)),D.data_type=E.bits+(E.last?64:0)+(E.mode===12?128:0)+(E.mode===20||E.mode===15?256:0),(ve==0&&ke===0||B===4)&&ne===h&&(ne=-5),ne)},o.inflateEnd=function(D){if(!D||!D.state)return g;var B=D.state;return B.window&&(B.window=null),D.state=null,h},o.inflateGetHeader=function(D,B){var E;return D&&D.state?(2&(E=D.state).wrap)==0?g:((E.head=B).done=!1,h):g},o.inflateSetDictionary=function(D,B){var E,j=B.length;return D&&D.state?(E=D.state).wrap!==0&&E.mode!==11?g:E.mode===11&&s(1,B,j,0)!==E.check?-3:q(D,B,j,j)?(E.mode=31,-4):(E.havedict=1,h):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],c=[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,h,g,m,v,k,C){var _,b,w,T,L,N,H,M,V,q=C.bits,D=0,B=0,E=0,j=0,J=0,Y=0,se=0,pe=0,Ve=0,ge=0,be=null,ve=0,ke=new i.Buf16(16),oe=new i.Buf16(16),Re=null,je=0;for(D=0;D<=15;D++)ke[D]=0;for(B=0;B<g;B++)ke[f[h+B]]++;for(J=q,j=15;1<=j&&ke[j]===0;j--);if(j<J&&(J=j),j===0)return m[v++]=20971520,m[v++]=20971520,C.bits=1,0;for(E=1;E<j&&ke[E]===0;E++);for(J<E&&(J=E),D=pe=1;D<=15;D++)if(pe<<=1,(pe-=ke[D])<0)return-1;if(0<pe&&(d===0||j!==1))return-1;for(oe[1]=0,D=1;D<15;D++)oe[D+1]=oe[D]+ke[D];for(B=0;B<g;B++)f[h+B]!==0&&(k[oe[f[h+B]]++]=B);if(N=d===0?(be=Re=k,19):d===1?(be=s,ve-=257,Re=a,je-=257,256):(be=l,Re=c,-1),D=E,L=v,se=B=ge=0,w=-1,T=(Ve=1<<(Y=J))-1,d===1&&852<Ve||d===2&&592<Ve)return 1;for(;;){for(H=D-se,V=k[B]<N?(M=0,k[B]):k[B]>N?(M=Re[je+k[B]],be[ve+k[B]]):(M=96,0),_=1<<D-se,E=b=1<<Y;m[L+(ge>>se)+(b-=_)]=H<<24|M<<16|V|0,b!==0;);for(_=1<<D-1;ge&_;)_>>=1;if(_!==0?(ge&=_-1,ge+=_):ge=0,B++,--ke[D]==0){if(D===j)break;D=f[h+k[B]]}if(J<D&&(ge&T)!==w){for(se===0&&(se=J),L+=E,pe=1<<(Y=D-se);Y+se<j&&!((pe-=ke[Y+se])<=0);)Y++,pe<<=1;if(Ve+=1<<Y,d===1&&852<Ve||d===2&&592<Ve)return 1;m[w=ge&T]=J<<24|Y<<16|L-v|0}}return ge!==0&&(m[L+ge]=D-se<<24|4194304),C.bits=J,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(U){for(var $=U.length;0<=--$;)U[$]=0}var c=0,d=29,f=256,h=f+1+d,g=30,m=19,v=2*h+1,k=15,C=16,_=7,b=256,w=16,T=17,L=18,N=[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],H=[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],M=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],V=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],q=new Array(2*(h+2));l(q);var D=new Array(2*g);l(D);var B=new Array(512);l(B);var E=new Array(256);l(E);var j=new Array(d);l(j);var J,Y,se,pe=new Array(g);function Ve(U,$,Q,Z,K){this.static_tree=U,this.extra_bits=$,this.extra_base=Q,this.elems=Z,this.max_length=K,this.has_stree=U&&U.length}function ge(U,$){this.dyn_tree=U,this.max_code=0,this.stat_desc=$}function be(U){return U<256?B[U]:B[256+(U>>>7)]}function ve(U,$){U.pending_buf[U.pending++]=255&$,U.pending_buf[U.pending++]=$>>>8&255}function ke(U,$,Q){U.bi_valid>C-Q?(U.bi_buf|=$<<U.bi_valid&65535,ve(U,U.bi_buf),U.bi_buf=$>>C-U.bi_valid,U.bi_valid+=Q-C):(U.bi_buf|=$<<U.bi_valid&65535,U.bi_valid+=Q)}function oe(U,$,Q){ke(U,Q[2*$],Q[2*$+1])}function Re(U,$){for(var Q=0;Q|=1&U,U>>>=1,Q<<=1,0<--$;);return Q>>>1}function je(U,$,Q){var Z,K,me=new Array(k+1),xe=0;for(Z=1;Z<=k;Z++)me[Z]=xe=xe+Q[Z-1]<<1;for(K=0;K<=$;K++){var he=U[2*K+1];he!==0&&(U[2*K]=Re(me[he]++,he))}}function tt(U){var $;for($=0;$<h;$++)U.dyn_ltree[2*$]=0;for($=0;$<g;$++)U.dyn_dtree[2*$]=0;for($=0;$<m;$++)U.bl_tree[2*$]=0;U.dyn_ltree[2*b]=1,U.opt_len=U.static_len=0,U.last_lit=U.matches=0}function wt(U){8<U.bi_valid?ve(U,U.bi_buf):0<U.bi_valid&&(U.pending_buf[U.pending++]=U.bi_buf),U.bi_buf=0,U.bi_valid=0}function Te(U,$,Q,Z){var K=2*$,me=2*Q;return U[K]<U[me]||U[K]===U[me]&&Z[$]<=Z[Q]}function We(U,$,Q){for(var Z=U.heap[Q],K=Q<<1;K<=U.heap_len&&(K<U.heap_len&&Te($,U.heap[K+1],U.heap[K],U.depth)&&K++,!Te($,Z,U.heap[K],U.depth));)U.heap[Q]=U.heap[K],Q=K,K<<=1;U.heap[Q]=Z}function Ye(U,$,Q){var Z,K,me,xe,he=0;if(U.last_lit!==0)for(;Z=U.pending_buf[U.d_buf+2*he]<<8|U.pending_buf[U.d_buf+2*he+1],K=U.pending_buf[U.l_buf+he],he++,Z===0?oe(U,K,$):(oe(U,(me=E[K])+f+1,$),(xe=N[me])!==0&&ke(U,K-=j[me],xe),oe(U,me=be(--Z),Q),(xe=H[me])!==0&&ke(U,Z-=pe[me],xe)),he<U.last_lit;);oe(U,b,$)}function ee(U,$){var Q,Z,K,me=$.dyn_tree,xe=$.stat_desc.static_tree,he=$.stat_desc.has_stree,Pe=$.stat_desc.elems,Je=-1;for(U.heap_len=0,U.heap_max=v,Q=0;Q<Pe;Q++)me[2*Q]!==0?(U.heap[++U.heap_len]=Je=Q,U.depth[Q]=0):me[2*Q+1]=0;for(;U.heap_len<2;)me[2*(K=U.heap[++U.heap_len]=Je<2?++Je:0)]=1,U.depth[K]=0,U.opt_len--,he&&(U.static_len-=xe[2*K+1]);for($.max_code=Je,Q=U.heap_len>>1;1<=Q;Q--)We(U,me,Q);for(K=Pe;Q=U.heap[1],U.heap[1]=U.heap[U.heap_len--],We(U,me,1),Z=U.heap[1],U.heap[--U.heap_max]=Q,U.heap[--U.heap_max]=Z,me[2*K]=me[2*Q]+me[2*Z],U.depth[K]=(U.depth[Q]>=U.depth[Z]?U.depth[Q]:U.depth[Z])+1,me[2*Q+1]=me[2*Z+1]=K,U.heap[1]=K++,We(U,me,1),2<=U.heap_len;);U.heap[--U.heap_max]=U.heap[1],(function(nt,ut){var Ht,He,Vt,Mt,sn,qn,Kt=ut.dyn_tree,Qe=ut.max_code,Pt=ut.stat_desc.static_tree,It=ut.stat_desc.has_stree,Sn=ut.stat_desc.extra_bits,tn=ut.stat_desc.extra_base,hn=ut.stat_desc.max_length,Vn=0;for(Mt=0;Mt<=k;Mt++)nt.bl_count[Mt]=0;for(Kt[2*nt.heap[nt.heap_max]+1]=0,Ht=nt.heap_max+1;Ht<v;Ht++)hn<(Mt=Kt[2*Kt[2*(He=nt.heap[Ht])+1]+1]+1)&&(Mt=hn,Vn++),Kt[2*He+1]=Mt,Qe<He||(nt.bl_count[Mt]++,sn=0,tn<=He&&(sn=Sn[He-tn]),qn=Kt[2*He],nt.opt_len+=qn*(Mt+sn),It&&(nt.static_len+=qn*(Pt[2*He+1]+sn)));if(Vn!==0){do{for(Mt=hn-1;nt.bl_count[Mt]===0;)Mt--;nt.bl_count[Mt]--,nt.bl_count[Mt+1]+=2,nt.bl_count[hn]--,Vn-=2}while(0<Vn);for(Mt=hn;Mt!==0;Mt--)for(He=nt.bl_count[Mt];He!==0;)Qe<(Vt=nt.heap[--Ht])||(Kt[2*Vt+1]!==Mt&&(nt.opt_len+=(Mt-Kt[2*Vt+1])*Kt[2*Vt],Kt[2*Vt+1]=Mt),He--)}})(U,$),je(me,Je,U.bl_count)}function S(U,$,Q){var Z,K,me=-1,xe=$[1],he=0,Pe=7,Je=4;for(xe===0&&(Pe=138,Je=3),$[2*(Q+1)+1]=65535,Z=0;Z<=Q;Z++)K=xe,xe=$[2*(Z+1)+1],++he<Pe&&K===xe||(he<Je?U.bl_tree[2*K]+=he:K!==0?(K!==me&&U.bl_tree[2*K]++,U.bl_tree[2*w]++):he<=10?U.bl_tree[2*T]++:U.bl_tree[2*L]++,me=K,Je=(he=0)===xe?(Pe=138,3):K===xe?(Pe=6,3):(Pe=7,4))}function ne(U,$,Q){var Z,K,me=-1,xe=$[1],he=0,Pe=7,Je=4;for(xe===0&&(Pe=138,Je=3),Z=0;Z<=Q;Z++)if(K=xe,xe=$[2*(Z+1)+1],!(++he<Pe&&K===xe)){if(he<Je)for(;oe(U,K,U.bl_tree),--he!=0;);else K!==0?(K!==me&&(oe(U,K,U.bl_tree),he--),oe(U,w,U.bl_tree),ke(U,he-3,2)):he<=10?(oe(U,T,U.bl_tree),ke(U,he-3,3)):(oe(U,L,U.bl_tree),ke(U,he-11,7));me=K,Je=(he=0)===xe?(Pe=138,3):K===xe?(Pe=6,3):(Pe=7,4)}}l(pe);var O=!1;function P(U,$,Q,Z){ke(U,(c<<1)+(Z?1:0),3),(function(K,me,xe,he){wt(K),he&&(ve(K,xe),ve(K,~xe)),i.arraySet(K.pending_buf,K.window,me,xe,K.pending),K.pending+=xe})(U,$,Q,!0)}o._tr_init=function(U){O||((function(){var $,Q,Z,K,me,xe=new Array(k+1);for(K=Z=0;K<d-1;K++)for(j[K]=Z,$=0;$<1<<N[K];$++)E[Z++]=K;for(E[Z-1]=K,K=me=0;K<16;K++)for(pe[K]=me,$=0;$<1<<H[K];$++)B[me++]=K;for(me>>=7;K<g;K++)for(pe[K]=me<<7,$=0;$<1<<H[K]-7;$++)B[256+me++]=K;for(Q=0;Q<=k;Q++)xe[Q]=0;for($=0;$<=143;)q[2*$+1]=8,$++,xe[8]++;for(;$<=255;)q[2*$+1]=9,$++,xe[9]++;for(;$<=279;)q[2*$+1]=7,$++,xe[7]++;for(;$<=287;)q[2*$+1]=8,$++,xe[8]++;for(je(q,h+1,xe),$=0;$<g;$++)D[2*$+1]=5,D[2*$]=Re($,5);J=new Ve(q,N,f+1,h,k),Y=new Ve(D,H,0,g,k),se=new Ve(new Array(0),M,0,m,_)})(),O=!0),U.l_desc=new ge(U.dyn_ltree,J),U.d_desc=new ge(U.dyn_dtree,Y),U.bl_desc=new ge(U.bl_tree,se),U.bi_buf=0,U.bi_valid=0,tt(U)},o._tr_stored_block=P,o._tr_flush_block=function(U,$,Q,Z){var K,me,xe=0;0<U.level?(U.strm.data_type===2&&(U.strm.data_type=(function(he){var Pe,Je=4093624447;for(Pe=0;Pe<=31;Pe++,Je>>>=1)if(1&Je&&he.dyn_ltree[2*Pe]!==0)return s;if(he.dyn_ltree[18]!==0||he.dyn_ltree[20]!==0||he.dyn_ltree[26]!==0)return a;for(Pe=32;Pe<f;Pe++)if(he.dyn_ltree[2*Pe]!==0)return a;return s})(U)),ee(U,U.l_desc),ee(U,U.d_desc),xe=(function(he){var Pe;for(S(he,he.dyn_ltree,he.l_desc.max_code),S(he,he.dyn_dtree,he.d_desc.max_code),ee(he,he.bl_desc),Pe=m-1;3<=Pe&&he.bl_tree[2*V[Pe]+1]===0;Pe--);return he.opt_len+=3*(Pe+1)+5+5+4,Pe})(U),K=U.opt_len+3+7>>>3,(me=U.static_len+3+7>>>3)<=K&&(K=me)):K=me=Q+5,Q+4<=K&&$!==-1?P(U,$,Q,Z):U.strategy===4||me===K?(ke(U,2+(Z?1:0),3),Ye(U,q,D)):(ke(U,4+(Z?1:0),3),(function(he,Pe,Je,nt){var ut;for(ke(he,Pe-257,5),ke(he,Je-1,5),ke(he,nt-4,4),ut=0;ut<nt;ut++)ke(he,he.bl_tree[2*V[ut]+1],3);ne(he,he.dyn_ltree,Pe-1),ne(he,he.dyn_dtree,Je-1)})(U,U.l_desc.max_code+1,U.d_desc.max_code+1,xe+1),Ye(U,U.dyn_ltree,U.dyn_dtree)),tt(U),Z&&wt(U)},o._tr_tally=function(U,$,Q){return U.pending_buf[U.d_buf+2*U.last_lit]=$>>>8&255,U.pending_buf[U.d_buf+2*U.last_lit+1]=255&$,U.pending_buf[U.l_buf+U.last_lit]=255&Q,U.last_lit++,$===0?U.dyn_ltree[2*Q]++:(U.matches++,$--,U.dyn_ltree[2*(E[Q]+f+1)]++,U.dyn_dtree[2*be($)]++),U.last_lit===U.lit_bufsize-1},o._tr_align=function(U){ke(U,2,3),oe(U,b,q),(function($){$.bi_valid===16?(ve($,$.bi_buf),$.bi_buf=0,$.bi_valid=0):8<=$.bi_valid&&($.pending_buf[$.pending++]=255&$.bi_buf,$.bi_buf>>=8,$.bi_valid-=8)})(U)}},{"../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,c,d,f,h=1,g={},m=!1,v=s.document,k=Object.getPrototypeOf&&Object.getPrototypeOf(s);k=k&&k.setTimeout?k:s,l={}.toString.call(s.process)==="[object process]"?function(w){process.nextTick(function(){_(w)})}:(function(){if(s.postMessage&&!s.importScripts){var w=!0,T=s.onmessage;return s.onmessage=function(){w=!1},s.postMessage("","*"),s.onmessage=T,w}})()?(f="setImmediate$"+Math.random()+"$",s.addEventListener?s.addEventListener("message",b,!1):s.attachEvent("onmessage",b),function(w){s.postMessage(f+w,"*")}):s.MessageChannel?((d=new MessageChannel).port1.onmessage=function(w){_(w.data)},function(w){d.port2.postMessage(w)}):v&&"onreadystatechange"in v.createElement("script")?(c=v.documentElement,function(w){var T=v.createElement("script");T.onreadystatechange=function(){_(w),T.onreadystatechange=null,c.removeChild(T),T=null},c.appendChild(T)}):function(w){setTimeout(_,0,w)},k.setImmediate=function(w){typeof w!="function"&&(w=new Function(""+w));for(var T=new Array(arguments.length-1),L=0;L<T.length;L++)T[L]=arguments[L+1];return g[h]={callback:w,args:T},l(h),h++},k.clearImmediate=C}function C(w){delete g[w]}function _(w){if(m)setTimeout(_,0,w);else{var T=g[w];if(T){m=!0;try{(function(L){var N=L.callback,H=L.args;switch(H.length){case 0:N();break;case 1:N(H[0]);break;case 2:N(H[0],H[1]);break;case 3:N(H[0],H[1],H[2]);break;default:N.apply(a,H)}})(T)}finally{C(w),m=!1}}}}function b(w){w.source===s&&typeof w.data=="string"&&w.data.indexOf(f)===0&&_(+w.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)})})),Nr="application/vnd.openxmlformats-officedocument.wordprocessingml.document",Xl="application/pdf",qh="text/html",p6={docx:Nr,pdf:Xl,html:qh},Yh={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"};xt();var m6=F2(h6(),1),g6=e=>typeof e!="string"?"":e.trim(),Wv=e=>{if(typeof e!="string")return"";const t=e.trim();return t?t.toLowerCase():""},Kw=e=>{if(typeof e!="string")return"";const t=e.trim();return t?t.toLowerCase():""},jd=e=>{const t=e??{},n=g6(t.id),r=Wv(t.email);return{id:n,email:r,name:typeof t.name=="string"?t.name:"",hasId:n.length>0,hasEmail:r.length>0}},qw=({current:e,other:t})=>{const n=jd(e),r=jd(t);return n.hasId&&r.hasId?n.id===r.id:n.hasEmail&&r.hasEmail?n.email===r.email:!1},qc=({actor:e,fallbackKey:t=""})=>{const n=jd(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 v6(e){return typeof e.captureStackTrace=="function"}var Xh=class extends Error{constructor(e,t){super(e),this.cause=t,this.name="FileObjectError",v6(Error)&&Error.captureStackTrace(this,this.constructor)}},y6=class extends Xh{constructor(e){super("Invalid data URI format: URI must contain exactly one comma separator"),this.uri=e,this.name="InvalidDataUriError"}},b6=class extends Xh{constructor(e,t){super(`Failed to fetch file from URL: ${e}`,t),this.url=e,this.name="FetchFailedError"}},Kv=async(e,t,n)=>{try{if(e.startsWith("data:")&&e.includes(";base64,")){const i=e.split(",");if(i.length!==2)throw new y6(e);const s=atob(i[1]),a=Uint8Array.from(s,l=>l.charCodeAt(0));return new File([a],t,{type:n})}const r=await fetch(e);if(!r.ok)throw new b6(e,new Error(`HTTP ${r.status}: ${r.statusText}`));const o=await r.blob();return new File([o],t,{type:n})}catch(r){throw r instanceof Xh?r:new Xh("Failed to create file object",r)}};function w6(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 Zh=new WeakMap;function Yw(e){return e.ownerDocument??document}function Xw(e,t){const n=Zh.get(t);n?.bindings.delete(e),n&&n.bindings.size===0&&(t.removeEventListener("click",n.listener),Zh.delete(t))}function Zw(e,t){const n=Yw(e);e.__clickOutsideDocument&&e.__clickOutsideDocument!==n&&Xw(e,e.__clickOutsideDocument);let r=Zh.get(n);if(!r){const o=new Map,i=s=>{const a=typeof s.composedPath=="function"?s.composedPath():null;for(const[l,c]of o)(a?.includes(l)??l.contains(s.target))||c.value?.(s)};r={bindings:o,listener:i},Zh.set(n,r),n.addEventListener("click",i)}r.bindings.set(e,t),e.__clickOutsideHandler=r.listener,e.__clickOutsideDocument=n}var qv={mounted(e,t){Zw(e,t)},updated(e,t){Zw(e,t)},unmounted(e){Xw(e,e.__clickOutsideDocument??Yw(e)),delete e.__clickOutsideHandler,delete e.__clickOutsideDocument}};function C6(e){return e[1].user!==void 0}var k6=(e,t)=>{const n=new Set;return Array.from(t.entries()).filter(C6).filter(([r,o])=>{const i=qc({actor:o.user,fallbackKey:r});return!i||n.has(i)?!1:(n.add(i),!0)}).map(([r,o])=>{const i=qc({actor:o.user,fallbackKey:r});let s=e.userColorMap.get(i);return s||(s=o.user.color||(e.config.colors.length>0?e.config.colors[e.colorIndex%e.config.colors.length]:void 0),e.userColorMap.set(i,s),e.colorIndex++),{clientId:r,...o.user,color:s}})},S6=e=>{for(let t=e.length-1;t>0;t--){const n=Math.floor(Math.random()*(t+1));[e[t],e[n]]=[e[n],e[t]]}return e},Qh={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"},vU=[Qh.INLINE_SDT_LABEL,Qh.BLOCK_SDT_LABEL],Qw={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"},_6=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"}}},yU=`.${Qh.BLOCK_SDT}[${Qw.SDT_ID}]`,bU=`[${Qw.DRAGGABLE}="true"]`,A6=typeof window<"u",Jw,Ud=e=>Jw=e,eC=Symbol();function Yv(e){return e&&typeof e=="object"&&Object.prototype.toString.call(e)==="[object Object]"&&typeof e.toJSON!="function"}var Hd;(function(e){e.direct="direct",e.patchObject="patch object",e.patchFunction="patch function"})(Hd||(Hd={}));var tC=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 I6(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 Xv(e,t,n){const r=new XMLHttpRequest;r.open("GET",e),r.responseType="blob",r.onload=function(){x6(r.response,t,n)},r.onerror=function(){console.error("could not download file")},r.send()}function nC(e){const t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch{}return t.status>=200&&t.status<=299}function Jh(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 ep=typeof navigator=="object"?navigator:{userAgent:""},rC=/Macintosh/.test(ep.userAgent)&&/AppleWebKit/.test(ep.userAgent)&&!/Safari/.test(ep.userAgent),x6=A6?typeof HTMLAnchorElement<"u"&&"download"in HTMLAnchorElement.prototype&&!rC?E6:"msSaveOrOpenBlob"in ep?T6:R6:()=>{};function E6(e,t="download",n){const r=document.createElement("a");r.download=t,r.rel="noopener",typeof e=="string"?(r.href=e,r.origin!==location.origin?nC(r.href)?Xv(e,t,n):(r.target="_blank",Jh(r)):Jh(r)):(r.href=URL.createObjectURL(e),setTimeout(function(){URL.revokeObjectURL(r.href)},4e4),setTimeout(function(){Jh(r)},0))}function T6(e,t="download",n){if(typeof e=="string")if(nC(e))Xv(e,t,n);else{const r=document.createElement("a");r.href=e,r.target="_blank",setTimeout(function(){Jh(r)})}else navigator.msSaveOrOpenBlob(I6(e,n),t)}function R6(e,t,n,r){if(r=r||open("","_blank"),r&&(r.document.title=r.document.body.innerText="downloading..."),typeof e=="string")return Xv(e,t,n);const o=e.type==="application/octet-stream",i=/constructor/i.test(String(tC.HTMLElement))||"safari"in tC,s=/CriOS\/[\d]+/.test(navigator.userAgent);if((s||o&&i||rC)&&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:wU}=Object;function L6(){const e=ng(!0),t=e.run(()=>te({}));let n=[],r=[];const o=no({install(i){Ud(o),o._a=i,i.provide(eC,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 oC=()=>{};function iC(e,t,n,r=oC){e.add(t);const o=()=>{e.delete(t)&&r()};return!n&&rg()&&X2(o),o}function Yc(e,...t){e.forEach(n=>{n(...t)})}var M6=e=>e(),sC=Symbol(),Zv=Symbol();function Qv(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];Yv(o)&&Yv(r)&&e.hasOwnProperty(n)&&!cr(r)&&!xi(r)?e[n]=Qv(o,r):e[n]=r}return e}var P6=Symbol();function D6(e){return!Yv(e)||!Object.prototype.hasOwnProperty.call(e,P6)}var{assign:Qa}=Object;function O6(e){return!!(cr(e)&&e.effect)}function F6(e,t,n,r){const{state:o,actions:i,getters:s}=t,a=n.state.value[e];let l;function c(){a||(n.state.value[e]=o?o():{});const d=a1(n.state.value[e]);return Qa(d,i,Object.keys(s||{}).reduce((f,h)=>(f[h]=no(Ce(()=>{Ud(n);const g=n._s.get(e);return s[h].call(g,g)})),f),{}))}return l=aC(e,c,t,n,r,!0),l}function aC(e,t,n={},r,o,i){let s;const a=Qa({actions:{}},n),l={deep:!0};let c,d,f=new Set,h=new Set,g;const m=r.state.value[e];!i&&!m&&(r.state.value[e]={});let v;function k(N){let H;c=d=!1,typeof N=="function"?(N(r.state.value[e]),H={type:Hd.patchFunction,storeId:e,events:g}):(Qv(r.state.value[e],N),H={type:Hd.patchObject,payload:N,storeId:e,events:g});const M=v=Symbol();_t().then(()=>{v===M&&(c=!0)}),d=!0,Yc(f,H,r.state.value[e])}const C=i?function(){const{state:H}=n,M=H?H():{};this.$patch(V=>{Qa(V,M)})}:oC;function _(){s.stop(),f.clear(),h.clear(),r._s.delete(e)}const b=(N,H="")=>{if(sC in N)return N[Zv]=H,N;const M=function(){Ud(r);const V=Array.from(arguments),q=new Set,D=new Set;function B(J){q.add(J)}function E(J){D.add(J)}Yc(h,{args:V,name:M[Zv],store:T,after:B,onError:E});let j;try{j=N.apply(this&&this.$id===e?this:T,V)}catch(J){throw Yc(D,J),J}return j instanceof Promise?j.then(J=>(Yc(q,J),J)).catch(J=>(Yc(D,J),Promise.reject(J))):(Yc(q,j),j)};return M[sC]=!0,M[Zv]=H,M},w={_p:r,$id:e,$onAction:iC.bind(null,h),$patch:k,$reset:C,$subscribe(N,H={}){const M=iC(f,N,H.detached,()=>V()),V=s.run(()=>Ft(()=>r.state.value[e],q=>{(H.flush==="sync"?d:c)&&N({storeId:e,type:Hd.direct,events:g},q)},Qa({},l,H)));return M},$dispose:_},T=to(w);r._s.set(e,T);const L=(r._a&&r._a.runWithContext||M6)(()=>r._e.run(()=>(s=ng()).run(()=>t({action:b}))));for(const N in L){const H=L[N];cr(H)&&!O6(H)||xi(H)?i||(m&&D6(H)&&(cr(H)?H.value=m[N]:Qv(H,m[N])),r.state.value[e][N]=H):typeof H=="function"&&(L[N]=b(H,N),a.actions[N]=H)}return Qa(T,L),Qa(Cn(T),L),Object.defineProperty(T,"$state",{get:()=>r.state.value[e],set:N=>{k(H=>{Qa(H,N)})}}),r._p.forEach(N=>{Qa(T,s.run(()=>N({store:T,app:r._a,pinia:r,options:a})))}),m&&i&&n.hydrate&&n.hydrate(T.$state,m),c=!0,d=!0,T}function lC(e,t,n){let r;const o=typeof t=="function";r=o?n:t;function i(s,a){const l=O1();return s=s||(l?Ua(eC,null):null),s&&Ud(s),s=Jw,s._s.has(e)||(o?aC(e,t,r,s):F6(e,r,s)),s._s.get(e)}return i.$id=e,i}function _s(e){const t=Cn(e),n={};for(const r in t){const o=t[r];o.effect?n[r]=Ce({get:()=>e[r],set(i){e[r]=i}}):(cr(o)||xi(o))&&(n[r]=dg(e,r))}return n}var $d=e=>{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 t=e.name||"document";return new File([e],t,{type:e.type})}return e}return e.originFileObj?$d(e.originFileObj):e.file?$d(e.file):e.raw?$d(e.raw):null},cC=(e="")=>{const t=String(e).toLowerCase();return t.endsWith(".docx")?Nr:t.endsWith(".pdf")?Xl:t.endsWith(".html")||t.endsWith(".htm")?qh:t.endsWith(".md")||t.endsWith(".markdown")?"text/markdown":""},Gd=e=>{const t=$d(e);if(t){const n=t.name||e&&e.name||"document";return{type:t.type||cC(n)||"application/vnd.openxmlformats-officedocument.wordprocessingml.document",data:t,name:n}}if(e&&typeof e=="object"&&"data"in e){const n=$d(e.data);if(n){const r=e.type||n.type||cC(n.name)||"application/vnd.openxmlformats-officedocument.wordprocessingml.document";return{...e,type:r,data:n,name:e.name||n.name||"document"}}}return e};xt();function N6(e,t){const n=e.itemid,r=e,o=t!==null&&typeof t=="object"?to({...t}):te(t),i=te(null);return Ft(o,(a,l)=>{const c={fieldId:n.value,changeTime:Date.now(),oldValue:l,newValue:a,originalField:r};i.value=c}),{value:o}}function B6(e){const t=te(e.itemid),n=te(e.itemicon),r=te(e.itemiconpack),o=te(e.itemdisplaylabel),i=e.itemlinkvalue,s=e.itemplaceholdertext,{value:a}=N6(e,i,te([])),l=te(e.itemtype),c=te(e.itemfieldtype),d=e,f=to({fontFamily:e.fontfamily||"Arial",fontSize:e.font_size||"12pt",originalFontSize:e.original_font_size||"12pt"}),h=te(e.logicrules),g=te(!1),m=to({}),v={SELECT:V6,IMAGEINPUT:z6,CHECKBOXINPUT:j6};return l.value in v&&Object.assign(m,v[l.value](e)),{id:t,icon:n,iconPack:r,label:o,placeholder:s,fieldType:l,fieldSubType:c,value:a,format:te(e.itemformat),logicRules:h,hidden:g,originalJSON:d,fieldStyle:f,valueGetter:e.valueGetter,...m}}function z6(e){return{fontfamily:te(e.fontfamily),iteminputtype:te(e.iteminputtype)}}function V6(e){return{options:te(e.itemoptions)}}function j6(e){const t=te(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 As=()=>new Map,Jv=e=>{const t=As();return e.forEach((n,r)=>{t.set(r,n)}),t},Xc=(e,t,n)=>{let r=e.get(t);return r===void 0&&e.set(t,r=n()),r},U6=(e,t)=>{const n=[];for(const[r,o]of e)n.push(t(o,r));return n},H6=(e,t)=>{for(const[n,r]of e)if(t(r,n))return!0;return!1},Zc=()=>new Set,ey=e=>e[e.length-1],Qc=Array.from,ty=(e,t)=>{for(let n=0;n<e.length;n++)if(!t(e[n],n,e))return!1;return!0},uC=(e,t)=>{for(let n=0;n<e.length;n++)if(t(e[n],n,e))return!0;return!1},$6=(e,t)=>{const n=new Array(e);for(let r=0;r<e;r++)n[r]=t(r,n);return n},tp=Array.isArray,G6=class{constructor(){this._observers=As()}on(e,t){return Xc(this._observers,e,Zc).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 Qc((this._observers.get(e)||As()).values()).forEach(n=>n(...t))}destroy(){this._observers=As()}},ca=Math.floor,np=Math.abs,dC=(e,t)=>e<t?e:t,Jc=(e,t)=>e>t?e:t,CU=Number.isNaN,W6=e=>e!==0?e<0:1/e<0,kU=1,SU=2,_U=4,AU=8,IU=32,xU=64,EU=128,TU=31,RU=63,LU=127,MU=2147483647,fC=Number.MAX_SAFE_INTEGER,hC=Number.MIN_SAFE_INTEGER,K6=Number.isInteger||(e=>typeof e=="number"&&isFinite(e)&&ca(e)===e),PU=Number.isNaN,DU=Number.parseInt,pC=String.fromCharCode,OU=String.fromCodePoint,FU=pC(65535),q6=e=>e.toLowerCase(),Y6=/^\s*/g,X6=e=>e.replace(Y6,""),Z6=/([A-Z])/g,mC=(e,t)=>X6(e.replace(Z6,n=>`${t}${q6(n)}`)),Q6=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},Wd=typeof TextEncoder<"u"?new TextEncoder:null,J6=e=>Wd.encode(e),ex=Wd?J6:Q6,ny=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});ny&&ny.decode(new Uint8Array).length===1&&(ny=null);var tx=(e,t)=>$6(t,()=>e).join(""),Kd=class{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}},ry=()=>new Kd,nx=e=>{let t=e.cpos;for(let n=0;n<e.bufs.length;n++)t+=e.bufs[n].length;return t},ua=e=>{const t=new Uint8Array(nx(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},rx=(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(Jc(n,t)*2),e.cpos=0)},fo=(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},oy=fo,Jn=(e,t)=>{for(;t>127;)fo(e,128|127&t),t=ca(t/128);fo(e,127&t)},iy=(e,t)=>{const n=W6(t);for(n&&(t=-t),fo(e,(t>63?128:0)|(n?64:0)|63&t),t=ca(t/64);t>0;)fo(e,(t>127?128:0)|127&t),t=ca(t/128)},sy=new Uint8Array(3e4),ox=sy.length/3,ix=(e,t)=>{if(t.length<ox){const n=Wd.encodeInto(t,sy).written||0;Jn(e,n);for(let r=0;r<n;r++)fo(e,sy[r])}else vi(e,ex(t))},sx=(e,t)=>{const n=unescape(encodeURIComponent(t)),r=n.length;Jn(e,r);for(let o=0;o<r;o++)fo(e,n.codePointAt(o))},eu=Wd&&Wd.encodeInto?ix:sx,ay=(e,t)=>{const n=e.cbuf.length,r=e.cpos,o=dC(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(Jc(n*2,i)),e.cbuf.set(t.subarray(o)),e.cpos=i)},vi=(e,t)=>{Jn(e,t.byteLength),ay(e,t)},ly=(e,t)=>{rx(e,t);const n=new DataView(e.cbuf.buffer,e.cpos,t);return e.cpos+=t,n},ax=(e,t)=>ly(e,4).setFloat32(0,t,!1),lx=(e,t)=>ly(e,8).setFloat64(0,t,!1),cx=(e,t)=>ly(e,8).setBigInt64(0,t,!1),gC=new DataView(new ArrayBuffer(4)),ux=e=>(gC.setFloat32(0,e),gC.getFloat32(0)===e),qd=(e,t)=>{switch(typeof t){case"string":fo(e,119),eu(e,t);break;case"number":K6(t)&&np(t)<=2147483647?(fo(e,125),iy(e,t)):ux(t)?(fo(e,124),ax(e,t)):(fo(e,123),lx(e,t));break;case"bigint":fo(e,122),cx(e,t);break;case"object":if(t===null)fo(e,126);else if(tp(t)){fo(e,117),Jn(e,t.length);for(let n=0;n<t.length;n++)qd(e,t[n])}else if(t instanceof Uint8Array)fo(e,116),vi(e,t);else{fo(e,118);const n=Object.keys(t);Jn(e,n.length);for(let r=0;r<n.length;r++){const o=n[r];eu(e,o),qd(e,t[o])}}break;case"boolean":fo(e,t?120:121);break;default:fo(e,127)}},vC=class extends Kd{constructor(e){super(),this.w=e,this.s=null,this.count=0}write(e){this.s===e?this.count++:(this.count>0&&Jn(this,this.count-1),this.count=1,this.w(this,e),this.s=e)}},yC=e=>{e.count>0&&(iy(e.encoder,e.count===1?e.s:-e.s),e.count>1&&Jn(e.encoder,e.count-2))},rp=class{constructor(){this.encoder=new Kd,this.s=0,this.count=0}write(e){this.s===e?this.count++:(yC(this),this.count=1,this.s=e)}toUint8Array(){return yC(this),ua(this.encoder)}},bC=e=>{if(e.count>0){const t=e.diff*2+(e.count===1?0:1);iy(e.encoder,t),e.count>1&&Jn(e.encoder,e.count-2)}},cy=class{constructor(){this.encoder=new Kd,this.s=0,this.count=0,this.diff=0}write(e){this.diff===e-this.s?(this.s=e,this.count++):(bC(this),this.count=1,this.diff=e-this.s,this.s=e)}toUint8Array(){return bC(this),ua(this.encoder)}},dx=class{constructor(){this.sarr=[],this.s="",this.lensE=new rp}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 Kd;return this.sarr.push(this.s),this.s="",eu(e,this.sarr.join("")),ay(e,this.lensE.toUint8Array()),ua(e)}},Ja=e=>new Error(e),Zi=()=>{throw Ja("Method unimplemented")},da=()=>{throw Ja("Unexpected case")},NU=crypto.subtle,fx=crypto.getRandomValues.bind(crypto),wC=()=>fx(new Uint32Array(1))[0],hx="10000000-1000-4000-8000-100000000000",px=()=>hx.replace(/[018]/g,e=>(e^wC()&15>>e/4).toString(16)),mx=Date.now,CC=e=>new Promise(e),BU=Promise.all.bind(Promise),kC=e=>e===void 0?null:e,gx=class{constructor(){this.map=new Map}setItem(e,t){this.map.set(e,t)}getItem(e){return this.map.get(e)}},SC=new gx,vx=!0;try{typeof localStorage<"u"&&localStorage&&(SC=localStorage,vx=!1)}catch{}var yx=SC,Yd=Symbol("Equality"),_C=(e,t)=>e===t||!!e?.[Yd]?.(t)||!1,bx=e=>typeof e=="object",wx=Object.assign,Cx=Object.keys,kx=(e,t)=>{for(const n in e)t(e[n],n)},op=e=>Cx(e).length,Sx=e=>{for(const t in e)return!1;return!0},Xd=(e,t)=>{for(const n in e)if(!t(e[n],n))return!1;return!0},uy=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),_x=(e,t)=>e===t||op(e)===op(t)&&Xd(e,(n,r)=>(n!==void 0||uy(t,r))&&_C(t[r],n)),Ax=Object.freeze,AC=e=>{for(const t in e){const n=e[t];(typeof n=="object"||typeof n=="function")&&AC(e[t])}return Ax(e)},dy=(e,t,n=0)=>{try{for(;n<e.length;n++)e[n](...t)}finally{n<e.length&&dy(e,t,n+1)}},ip=(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[Yd]!=null)return e[Yd](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)||!ip(e.get(n),t.get(n)))return!1;break;case void 0:case Object:if(op(e)!==op(t))return!1;for(const n in e)if(!uy(e,n)||!ip(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(!ip(e[n],t[n]))return!1;break;default:return!1}return!0},Ix=(e,t)=>t.includes(e),Zd=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]",zU=typeof navigator<"u"?/Mac/.test(navigator.platform):!1,Is,xx=[],Ex=()=>{if(Is===void 0)if(Zd){Is=As();const e=process.argv;let t=null;for(let n=0;n<e.length;n++){const r=e[n];r[0]==="-"?(t!==null&&Is.set(t,""),t=r):t!==null?(Is.set(t,r),t=null):xx.push(r)}t!==null&&Is.set(t,"")}else typeof location=="object"?(Is=As(),(location.search||"?").slice(1).split("&").forEach(e=>{if(e.length!==0){const[t,n]=e.split("=");Is.set(`--${mC(t,"-")}`,n),Is.set(`-${mC(t,"-")}`,n)}})):Is=As();return Is},fy=e=>Ex().has(e),sp=e=>kC(Zd?process.env[e.toUpperCase().replaceAll("-","_")]:yx.getItem(e)),IC=e=>fy("--"+e)||sp(e)!==null,Tx=IC("production"),Rx=Zd&&Ix(process.env.FORCE_COLOR,["true","1","2"]),Lx=Rx||!fy("--no-colors")&&!IC("no-color")&&(!Zd||process.stdout.isTTY)&&(!Zd||fy("--color")||sp("COLORTERM")!==null||(sp("TERM")||"").includes("color")),Mx=class{constructor(e,t){this.left=e,this.right=t}},fa=(e,t)=>new Mx(e,t),xC=e=>e.next()>=.5,hy=(e,t,n)=>ca(e.next()*(n+1-t)+t),EC=(e,t,n)=>ca(e.next()*(n+1-t)+t),py=(e,t,n)=>EC(e,t,n),Px=e=>pC(py(e,97,122)),Dx=(e,t=0,n=20)=>{const r=py(e,t,n);let o="";for(let i=0;i<r;i++)o+=Px(e);return o},my=(e,t)=>t[py(e,0,t.length-1)],Ox=Symbol("0schema"),Fx=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(tx(" ",(this._rerrs.length-t)*2)+`${n.path!=null?`[${n.path}] `:""}${n.has} doesn't match ${n.expected}. ${n.message}`)}return e.join(`
|
|
5
5
|
`)}},gy=(e,t)=>e===t?!0:e==null||t==null||e.constructor!==t.constructor?!1:e[Yd]?_C(e,t):tp(e)?ty(e,n=>uC(t,r=>gy(n,r))):bx(e)?Xd(e,(n,r)=>gy(n,t[r])):!1,$o=class{static _dilutes=!1;extends(e){let[t,n]=[this.shape,e.shape];return this.constructor._dilutes&&([n,t]=[t,n]),gy(t,n)}equals(e){return this.constructor===e.constructor&&ip(this.shape,e.shape)}[Ox](){return!0}[Yd](e){return this.equals(e)}validate(e){return this.check(e)}check(e,t){Zi()}get nullable(){return tu(this,fp)}get optional(){return new LC(this)}cast(e){return GC(e,this),e}expect(e){return GC(e,this),e}},vy=class extends $o{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}},jr=(e,t=null)=>new vy(e,t),VU=jr(vy),yy=class extends $o{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}},ho=e=>new yy(e),jU=jr(yy),ap=class extends $o{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}},lp=(...e)=>new ap(e),TC=jr(ap),Nx=RegExp.escape||(e=>e.replace(/[().|&,$^[\]]/g,t=>"\\"+t)),RC=e=>{if(ru.check(e))return[Nx(e)];if(TC.check(e))return e.shape.map(t=>t+"");if(UC.check(e))return["[+-]?\\d+.?\\d*"];if(HC.check(e))return[".*"];if(cp.check(e))return e.shape.map(RC).flat(1);da()},Bx=class extends $o{constructor(e){super(),this.shape=e,this._r=new RegExp("^"+e.map(RC).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}},UU=jr(Bx),zx=Symbol("optional"),LC=class extends $o{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[zx](){return!0}},Vx=jr(LC),MC=class extends $o{check(e,t){return t?.extend(null,"never",typeof e),!1}},HU=new MC,$U=jr(MC),PC=class QA extends $o{constructor(t,n=!1){super(),this.shape=t,this._isPartial=n}static _dilutes=!0;get partial(){return new QA(this.shape,!0)}check(t,n){return t==null?(n?.extend(null,"object","null"),!1):Xd(this.shape,(r,o)=>{const i=this._isPartial&&!uy(t,o)||r.check(t[o],n);return!i&&n?.extend(o.toString(),r.toString(),typeof t[o],"Object property does not match"),i})}},jx=e=>new PC(e),Ux=jr(PC),Hx=ho(e=>e!=null&&(e.constructor===Object||e.constructor==null)),DC=class extends $o{constructor(e,t){super(),this.shape={keys:e,values:t}}check(e,t){return e!=null&&Xd(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)})}},OC=(e,t)=>new DC(e,t),$x=jr(DC),FC=class extends $o{constructor(e){super(),this.shape=e}check(e,t){return e!=null&&Xd(this.shape,(n,r)=>{const o=n.check(e[r],t);return!o&&t?.extend(r.toString(),"Tuple",typeof n),o})}},Gx=(...e)=>new FC(e),GU=jr(FC),NC=class extends $o{constructor(e){super(),this.shape=e.length===1?e[0]:new by(e)}check(e,t){const n=tp(e)&&ty(e,r=>this.shape.check(r));return!n&&t?.extend(null,"Array",""),n}},BC=(...e)=>new NC(e),Wx=jr(NC),Kx=ho(e=>tp(e)),zC=class extends $o{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}},qx=(e,t=null)=>new zC(e,t),WU=jr(zC),Yx=qx($o),Xx=class extends $o{constructor(e){super(),this.len=e.length-1,this.args=Gx(...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}},Zx=jr(Xx),Qx=ho(e=>typeof e=="function"),Jx=class extends $o{constructor(e){super(),this.shape=e}check(e,t){const n=ty(this.shape,r=>r.check(e,t));return!n&&t?.extend(null,"Intersectinon",typeof e),n}},KU=jr(Jx,e=>e.shape.length>0),by=class extends $o{static _dilutes=!0;constructor(e){super(),this.shape=e}check(e,t){const n=uC(this.shape,r=>r.check(e,t));return t?.extend(null,"Union",typeof e),n}},tu=(...e)=>e.findIndex(t=>cp.check(t))>=0?tu(...e.map(t=>Qd(t)).map(t=>cp.check(t)?t.shape:[t]).flat(1)):e.length===1?e[0]:new by(e),cp=jr(by),VC=()=>!0,up=ho(VC),eE=jr(yy,e=>e.shape===VC),wy=ho(e=>typeof e=="bigint"),tE=ho(e=>e===wy),jC=ho(e=>typeof e=="symbol"),qU=ho(e=>e===jC),nu=ho(e=>typeof e=="number"),UC=ho(e=>e===nu),ru=ho(e=>typeof e=="string"),HC=ho(e=>e===ru),dp=ho(e=>typeof e=="boolean"),nE=ho(e=>e===dp),$C=lp(void 0),YU=jr(ap,e=>e.shape.length===1&&e.shape[0]===void 0),XU=lp(void 0),fp=lp(null),rE=jr(ap,e=>e.shape.length===1&&e.shape[0]===null),ZU=jr(Uint8Array),QU=jr(vy,e=>e.shape===Uint8Array),oE=tu(nu,ru,fp,$C,wy,dp,jC),JU=(()=>{const e=BC(up),t=OC(ru,up),n=tu(nu,ru,fp,dp,e,t);return e.shape=n,t.shape.values=n,n})(),Qd=e=>{if(Yx.check(e))return e;if(Hx.check(e)){const t={};for(const n in e)t[n]=Qd(e[n]);return jx(t)}else{if(Kx.check(e))return tu(...e.map(Qd));if(oE.check(e))return lp(e);if(Qx.check(e))return jr(e)}da()},GC=Tx?()=>{}:(e,t)=>{const n=new Fx;if(!t.check(e,n))throw Ja(`Expected value to be of type ${t.constructor.name}.
|
|
6
6
|
${n.toString()}`)},iE=class{constructor(e){this.patterns=[],this.$state=e}if(e,t){return this.patterns.push({if:Qd(e),h:t}),this}else(e){return this.if(up,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 Ja("Unhandled pattern")}}},sE=e=>new iE(e),WC=sE(up).if(UC,(e,t)=>hy(t,hC,fC)).if(HC,(e,t)=>Dx(t)).if(nE,(e,t)=>xC(t)).if(tE,(e,t)=>BigInt(hy(t,hC,fC))).if(cp,(e,t)=>ou(t,my(t,e.shape))).if(Ux,(e,t)=>{const n={};for(const r in e.shape){let o=e.shape[r];if(Vx.check(o)){if(xC(t))continue;o=o.shape}n[r]=WC(o,t)}return n}).if(Wx,(e,t)=>{const n=[],r=EC(t,0,42);for(let o=0;o<r;o++)n.push(ou(t,e.shape));return n}).if(TC,(e,t)=>my(t,e.shape)).if(rE,(e,t)=>null).if(Zx,(e,t)=>{const n=ou(t,e.res);return()=>n}).if(eE,(e,t)=>ou(t,my(t,[nu,ru,fp,$C,wy,dp,BC(nu),OC(tu("a","b","c"),nu)]))).if($x,(e,t)=>{const n={},r=hy(t,0,3);for(let o=0;o<r;o++){const i=ou(t,e.shape.keys);n[i]=ou(t,e.shape.values)}return n}).done(),ou=(e,t)=>WC(Qd(t),e),Zl=typeof document<"u"?document:{},eH=ho(e=>e.nodeType===dE),tH=typeof DOMParser<"u"?new DOMParser:null,nH=ho(e=>e.nodeType===lE),rH=ho(e=>e.nodeType===cE),aE=e=>U6(e,(t,n)=>`${n}:${t};`).join(""),lE=Zl.ELEMENT_NODE,cE=Zl.TEXT_NODE,oH=Zl.CDATA_SECTION_NODE,iH=Zl.COMMENT_NODE,uE=Zl.DOCUMENT_NODE,sH=Zl.DOCUMENT_TYPE_NODE,dE=Zl.DOCUMENT_FRAGMENT_NODE,aH=ho(e=>e.nodeType===uE),ha=Symbol,KC=ha(),qC=ha(),fE=ha(),hE=ha(),pE=ha(),YC=ha(),mE=ha(),Cy=ha(),gE=ha(),vE=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},lH=mx(),yE={[KC]:fa("font-weight","bold"),[qC]:fa("font-weight","normal"),[fE]:fa("color","blue"),[pE]:fa("color","green"),[hE]:fa("color","grey"),[YC]:fa("color","red"),[mE]:fa("color","purple"),[Cy]:fa("color","orange"),[gE]:fa("color","black")},bE=e=>{e.length===1&&e[0]?.constructor===Function&&(e=e[0]());const t=[],n=[],r=As();let o=[],i=0;for(;i<e.length;i++){const s=e[i],a=yE[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=aE(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},XC=Lx?bE:vE,wE=(...e)=>{console.log(...XC(e)),ZC.forEach(t=>t.print(e))},CE=(...e)=>{console.warn(...XC(e)),e.unshift(Cy),ZC.forEach(t=>t.print(e))},ZC=Zc(),QC=e=>({[Symbol.iterator](){return this},next:e}),kE=(e,t)=>QC(()=>{let n;do n=e.next();while(!n.done&&!t(n.value));return n}),ky=(e,t)=>QC(()=>{const{done:n,value:r}=e.next();return{done:n,value:n?void 0:t(r)}}),JC=class{constructor(e,t){this.clock=e,this.len=t}},e3=class{constructor(){this.clients=new Map}},t3=(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,c=r[l];l<r.length&&c.clock<a;c=r[++l])f3(e,i,c.clock,c.len,n)}}),SE=(e,t)=>{let n=0,r=e.length-1;for(;n<=r;){const o=ca((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},n3=(e,t)=>{const n=e.clients.get(t.client);return n!==void 0&&SE(n,t.clock)!==null},r3=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 JC(o.clock,Jc(o.len,i.clock+i.len-o.clock)):(r<n&&(t[r]=i),r++)}t.length=r})},o3=(e,t,n,r)=>{Xc(e.clients,t,()=>[]).push(new JC(n,r))},_E=()=>new e3,AE=(e,t)=>{Jn(e.restEncoder,t.clients.size),Qc(t.clients.entries()).sort((n,r)=>r[0]-n[0]).forEach(([n,r])=>{e.resetDsCurVal(),Jn(e.restEncoder,n);const o=r.length;Jn(e.restEncoder,o);for(let i=0;i<o;i++){const s=r[i];e.writeDsClock(s.clock),e.writeDsLen(s.len)}})},i3=wC,Sy=class JA extends G6{constructor({guid:t=px(),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=i3(),this.guid=t,this.collectionid=n,this.share=new Map,this.store=new NE,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=CC(c=>{this.on("load",()=>{this.isLoaded=!0,c(this)})});const l=()=>CC(c=>{const d=f=>{(f===void 0||f===!0)&&(this.off("sync",d),c())};this.on("sync",d)});this.on("sync",c=>{c===!1&&this.isSynced&&(this.whenSynced=l()),this.isSynced=c===void 0||c===!0,this.isSynced&&!this.isLoaded&&this.emit("load",[this])}),this.whenSynced=l()}load(){const t=this._item;t!==null&&!this.shouldLoad&&fr(t.parent.doc,n=>{n.subdocsLoaded.add(this)},null,!0),this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(Qc(this.subdocs).map(t=>t.guid))}transact(t,n=null){return fr(this,t,n)}get(t,n=_o){const r=Xc(this.share,t,()=>{const i=new n;return i._integrate(this,null),i}),o=r.constructor;if(n!==_o&&o!==n)if(o===_o){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,ZE)}getText(t=""){return this.get(t,r8)}getMap(t=""){return this.get(t,Ly)}getXmlElement(t=""){return this.get(t,O3)}getXmlFragment(t=""){return this.get(t,Oy)}toJSON(){const t={};return this.share.forEach((n,r)=>{t[r]=n.toJSON()}),t}destroy(){this.isDestroyed=!0,Qc(this.subdocs).forEach(n=>n.destroy());const t=this._item;if(t!==null){this._item=null;const n=t.content;n.doc=new JA({guid:this.guid,...n.opts,shouldLoad:!1}),n.doc._item=t,fr(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()}},IE=class{constructor(){this.restEncoder=ry()}toUint8Array(){return ua(this.restEncoder)}resetDsCurVal(){}writeDsClock(e){Jn(this.restEncoder,e)}writeDsLen(e){Jn(this.restEncoder,e)}},xE=class extends IE{writeLeftID(e){Jn(this.restEncoder,e.client),Jn(this.restEncoder,e.clock)}writeRightID(e){Jn(this.restEncoder,e.client),Jn(this.restEncoder,e.clock)}writeClient(e){Jn(this.restEncoder,e)}writeInfo(e){oy(this.restEncoder,e)}writeString(e){eu(this.restEncoder,e)}writeParentInfo(e){Jn(this.restEncoder,e?1:0)}writeTypeRef(e){Jn(this.restEncoder,e)}writeLen(e){Jn(this.restEncoder,e)}writeAny(e){qd(this.restEncoder,e)}writeBuf(e){vi(this.restEncoder,e)}writeJSON(e){eu(this.restEncoder,JSON.stringify(e))}writeKey(e){eu(this.restEncoder,e)}},EE=class{constructor(){this.restEncoder=ry(),this.dsCurrVal=0}toUint8Array(){return ua(this.restEncoder)}resetDsCurVal(){this.dsCurrVal=0}writeDsClock(e){const t=e-this.dsCurrVal;this.dsCurrVal=e,Jn(this.restEncoder,t)}writeDsLen(e){e===0&&da(),Jn(this.restEncoder,e-1),this.dsCurrVal+=e}},TE=class extends EE{constructor(){super(),this.keyMap=new Map,this.keyClock=0,this.keyClockEncoder=new cy,this.clientEncoder=new rp,this.leftClockEncoder=new cy,this.rightClockEncoder=new cy,this.infoEncoder=new vC(oy),this.stringEncoder=new dx,this.parentInfoEncoder=new vC(oy),this.typeRefEncoder=new rp,this.lenEncoder=new rp}toUint8Array(){const e=ry();return Jn(e,0),vi(e,this.keyClockEncoder.toUint8Array()),vi(e,this.clientEncoder.toUint8Array()),vi(e,this.leftClockEncoder.toUint8Array()),vi(e,this.rightClockEncoder.toUint8Array()),vi(e,ua(this.infoEncoder)),vi(e,this.stringEncoder.toUint8Array()),vi(e,ua(this.parentInfoEncoder)),vi(e,this.typeRefEncoder.toUint8Array()),vi(e,this.lenEncoder.toUint8Array()),ay(e,ua(this.restEncoder)),ua(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){qd(this.restEncoder,e)}writeBuf(e){vi(this.restEncoder,e)}writeJSON(e){qd(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)}},RE=(e,t,n,r)=>{r=Jc(r,t[0].id.clock);const o=pa(t,r);Jn(e.restEncoder,t.length-o),e.writeClient(n),Jn(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)},LE=(e,t,n)=>{const r=new Map;n.forEach((o,i)=>{ti(t,i)>o&&r.set(i,o)}),Ay(t).forEach((o,i)=>{n.has(i)||r.set(i,0)}),Jn(e.restEncoder,r.size),Qc(r.entries()).sort((o,i)=>i[0]-o[0]).forEach(([o,i])=>{RE(e,t.clients.get(o),o,i)})},ME=(e,t)=>LE(e,t.doc.store,t.beforeState),PE=class{constructor(){this.l=[]}},s3=()=>new PE,a3=(e,t)=>e.l.push(t),l3=(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.")},c3=(e,t,n)=>dy(e.l,[t,n]),hp=class{constructor(e,t){this.client=e,this.clock=t}},pp=(e,t)=>e===t||e!==null&&t!==null&&e.client===t.client&&e.clock===t.clock,Ir=(e,t)=>new hp(e,t),DE=e=>{for(const[t,n]of e.doc.share.entries())if(n===e)return t;throw da()},OE=class{constructor(e,t){this.ds=e,this.sv=t}},FE=(e,t)=>new OE(e,t),cH=FE(_E(),new Map),iu=(e,t)=>t===void 0?!e.deleted:t.sv.has(e.id.client)&&(t.sv.get(e.id.client)||0)>e.id.clock&&!n3(t.ds,e.id),_y=(e,t)=>{const n=Xc(e.meta,_y,Zc),r=e.doc.store;n.has(t)||(t.sv.forEach((o,i)=>{o<ti(r,i)&&el(e,Ir(i,o))}),t3(e,t.ds,o=>{}),n.add(t))},NE=class{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}},Ay=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},ti=(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},u3=(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 da()}n.push(t)},pa=(e,t)=>{let n=0,r=e.length-1,o=e[r],i=o.id.clock;if(i===t)return r;let s=ca(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=ca((n+r)/2)}throw da()},BE=(e,t)=>{const n=e.clients.get(t.client);return n[pa(n,t.clock)]},Iy=BE,xy=(e,t,n)=>{const r=pa(t,n),o=t[r];return o.id.clock<n&&o instanceof yi?(t.splice(r+1,0,z3(e,o,n-o.id.clock)),r+1):r},el=(e,t)=>{const n=e.doc.store.clients.get(t.client);return n[xy(e,n,t.clock)]},d3=(e,t,n)=>{const r=t.clients.get(n.client),o=pa(r,n.clock),i=r[o];return n.clock!==i.id.clock+i.length-1&&i.constructor!==nl&&r.splice(o+1,0,z3(e,i,n.clock-i.id.clock+1)),i},zE=(e,t,n)=>{const r=e.clients.get(t.id.client);r[pa(r,t.id.clock)]=n},f3=(e,t,n,r,o)=>{if(r===0)return;const i=n+r;let s=xy(e,t,n),a;do a=t[s++],i<a.id.clock+a.length&&xy(e,t,i),o(a);while(s<t.length&&t[s].id.clock<i)},VE=class{constructor(e,t,n){this.doc=e,this.deleteSet=new e3,this.beforeState=Ay(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}},h3=(e,t)=>t.deleteSet.clients.size===0&&!H6(t.afterState,(n,r)=>t.beforeState.get(r)!==n)?!1:(r3(t.deleteSet),ME(e,t),AE(e,t.deleteSet),!0),p3=(e,t,n)=>{const r=t._item;(r===null||r.id.clock<(e.beforeState.get(r.id.client)||0)&&!r.deleted)&&Xc(e.changed,t,Zc).add(n)},mp=(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 yi&&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},jE=(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 c=pa(i,a.clock),d=i[c];c<i.length&&d.id.clock<l;d=i[++c]){const f=i[c];if(a.clock+a.len<=f.id.clock)break;f instanceof yi&&f.deleted&&!f.keep&&n(f)&&f.gc(t,!1)}}}},UE=(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=dC(o.length-1,1+pa(o,s.clock+s.len-1));for(let l=a,c=o[l];l>0&&c.id.clock>=s.clock;c=o[l])l-=1+mp(o,l)}})},m3=(e,t)=>{if(t<e.length){const n=e[t],r=n.doc,o=r.store,i=n.deleteSet,s=n._mergeStructs;try{r3(i),n.afterState=Ay(n.doc.store),r.emit("beforeObserverCalls",[n,r]);const a=[];n.changed.forEach((l,c)=>a.push(()=>{(c._item===null||!c._item.deleted)&&c._callObserver(n,l)})),a.push(()=>{n.changedParentTypes.forEach((l,c)=>{c._dEH.l.length>0&&(c._item===null||!c._item.deleted)&&(l=l.filter(d=>d.target._item===null||!d.target._item.deleted),l.forEach(d=>{d.currentTarget=c,d._path=null}),l.sort((d,f)=>d.path.length-f.path.length),a.push(()=>{c3(c._dEH,l,n)}))}),a.push(()=>r.emit("afterTransaction",[n,r])),a.push(()=>{n._needFormattingCleanup&&t8(n)})}),dy(a,[])}finally{r.gc&&jE(i,o,r.gcFilter),UE(i,o),n.afterState.forEach((d,f)=>{const h=n.beforeState.get(f)||0;if(h!==d){const g=o.clients.get(f),m=Jc(pa(g,h),1);for(let v=g.length-1;v>=m;)v-=1+mp(g,v)}});for(let d=s.length-1;d>=0;d--){const{client:f,clock:h}=s[d].id,g=o.clients.get(f),m=pa(g,h);m+1<g.length&&mp(g,m+1)>1||m>0&&mp(g,m)}if(!n.local&&n.afterState.get(r.clientID)!==n.beforeState.get(r.clientID)&&(wE(Cy,KC,"[yjs] ",qC,YC,"Changed the client-id because another client seems to be using it."),r.clientID=i3()),r.emit("afterTransactionCleanup",[n,r]),r._observers.has("update")){const d=new xE;h3(d,n)&&r.emit("update",[d.toUint8Array(),n.origin,r,n])}if(r._observers.has("updateV2")){const d=new TE;h3(d,n)&&r.emit("updateV2",[d.toUint8Array(),n.origin,r,n])}const{subdocsAdded:a,subdocsLoaded:l,subdocsRemoved:c}=n;(a.size>0||c.size>0||l.size>0)&&(a.forEach(d=>{d.clientID=r.clientID,d.collectionid==null&&(d.collectionid=r.collectionid),r.subdocs.add(d)}),c.forEach(d=>r.subdocs.delete(d)),r.emit("subdocs",[{loaded:l,added:a,removed:c},r,n]),c.forEach(d=>d.destroy())),e.length<=t+1?(r._transactionCleanups=[],r.emit("afterAllTransactions",[r,e])):m3(e,t+1)}}},fr=(e,t,n=null,r=!0)=>{const o=e._transactionCleanups;let i=!1,s=null;e._transaction===null&&(i=!0,e._transaction=new VE(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&&m3(o,0)}}return s},g3="You must not compute changes after the event-handler fired.",gp=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=HE(this.currentTarget,this.target))}deletes(e){return n3(this.transaction.deleteSet,e.id)}get keys(){if(this._keys===null){if(this.transaction.doc._transactionCleanups.length===0)throw Ja(g3);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=ey(s.content.getContent());else return;else s!==null&&this.deletes(s)?(o="update",i=ey(s.content.getContent())):(o="add",i=void 0)}else if(this.deletes(r))o="delete",i=ey(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 Ja(g3);const t=this.target,n=Zc(),r=Zc(),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}},HE=(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},Fo=()=>{CE("Invalid access: Add Yjs type to a document before reading data.")},v3=80,Ey=0,$E=class{constructor(e,t){e.marker=!0,this.p=e,this.index=t,this.timestamp=Ey++}},GE=e=>{e.timestamp=Ey++},y3=(e,t,n)=>{e.p.marker=!1,e.p=t,t.marker=!0,e.index=n,e.timestamp=Ey++},WE=(e,t,n)=>{if(e.length>=v3){const r=e.reduce((o,i)=>o.timestamp<i.timestamp?o:i);return y3(r,t,n),r}else{const r=new $E(t,n);return e.push(r),r}},vp=(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)=>np(t-i.index)<np(t-s.index)?i:s);let r=e._start,o=0;for(n!==null&&(r=n.p,o=n.index,GE(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&&np(n.index-o)<r.parent.length/v3?(y3(n,r,o),n):WE(e._searchMarker,r,o)},Jd=(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=Jc(t,o.index+n))}},yp=(e,t,n)=>{const r=e,o=t.changedParentTypes;for(;Xc(o,e,()=>[]).push(n),e._item!==null;)e=e._item.parent;c3(r._eH,n,t)},_o=class{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=s3(),this._dEH=s3(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(e,t){this.doc=e,this._item=t}_copy(){throw Zi()}clone(){throw Zi()}_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){a3(this._eH,e)}observeDeep(e){a3(this._dEH,e)}unobserve(e){l3(this._eH,e)}unobserveDeep(e){l3(this._dEH,e)}toJSON(){}},b3=(e,t,n)=>{e.doc??Fo(),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},w3=e=>{e.doc??Fo();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},ef=(e,t)=>{let n=0,r=e._start;for(e.doc??Fo();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}},C3=(e,t)=>{const n=[];return ef(e,(r,o)=>{n.push(t(r,o,e))}),n},KE=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}}}},k3=(e,t)=>{e.doc??Fo();const n=vp(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}},bp=(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 c=[];const d=()=>{c.length>0&&(o=new yi(Ir(s,ti(a,s)),o,o&&o.lastId,l,l&&l.id,t,null,new Fy(c)),o.integrate(e,0),c=[])};r.forEach(f=>{if(f===null)c.push(f);else switch(f.constructor){case Number:case Object:case Boolean:case Array:case String:c.push(f);break;default:switch(d(),f.constructor){case Uint8Array:case ArrayBuffer:o=new yi(Ir(s,ti(a,s)),o,o&&o.lastId,l,l&&l.id,t,null,new N3(new Uint8Array(f))),o.integrate(e,0);break;case Sy:o=new yi(Ir(s,ti(a,s)),o,o&&o.lastId,l,l&&l.id,t,null,new B3(f)),o.integrate(e,0);break;default:if(f instanceof _o)o=new yi(Ir(s,ti(a,s)),o,o&&o.lastId,l,l&&l.id,t,null,new lu(f)),o.integrate(e,0);else throw new Error("Unexpected content type in insert operation")}}}),d()},S3=()=>Ja("Length exceeded!"),_3=(e,t,n,r)=>{if(n>t._length)throw S3();if(n===0)return t._searchMarker&&Jd(t._searchMarker,n,r.length),bp(e,t,null,r);const o=n,i=vp(t,n);let s=t._start;for(i!==null&&(s=i.p,n-=i.index,n===0&&(s=s.prev,n+=s&&s.countable&&!s.deleted?s.length:0));s!==null;s=s.right)if(!s.deleted&&s.countable){if(n<=s.length){n<s.length&&el(e,Ir(s.id.client,s.id.clock+n));break}n-=s.length}return t._searchMarker&&Jd(t._searchMarker,o,r.length),bp(e,t,s,r)},qE=(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 bp(e,t,r,n)},A3=(e,t,n,r)=>{if(r===0)return;const o=n,i=r,s=vp(t,n);let a=t._start;for(s!==null&&(a=s.p,n-=s.index);a!==null&&n>0;a=a.right)!a.deleted&&a.countable&&(n<a.length&&el(e,Ir(a.id.client,a.id.clock+n)),n-=a.length);for(;r>0&&a!==null;)a.deleted||(r<a.length&&el(e,Ir(a.id.client,a.id.clock+r)),a.delete(e),r-=a.length),a=a.right;if(r>0)throw S3();t._searchMarker&&Jd(t._searchMarker,o,-i+r)},wp=(e,t,n)=>{const r=t._map.get(n);r!==void 0&&r.delete(e)},Ty=(e,t,n,r)=>{const o=t._map.get(n)||null,i=e.doc,s=i.clientID;let a;if(r==null)a=new Fy([r]);else switch(r.constructor){case Number:case Object:case Boolean:case Array:case String:case Date:case BigInt:a=new Fy([r]);break;case Uint8Array:a=new N3(r);break;case Sy:a=new B3(r);break;default:if(r instanceof _o)a=new lu(r);else throw new Error("Unexpected content type")}new yi(Ir(s,ti(i.store,s)),o,o&&o.lastId,null,null,t,n,a).integrate(e,0)},Ry=(e,t)=>{e.doc??Fo();const n=e._map.get(t);return n!==void 0&&!n.deleted?n.content.getContent()[n.length-1]:void 0},I3=e=>{const t={};return e.doc??Fo(),e._map.forEach((n,r)=>{n.deleted||(t[r]=n.content.getContent()[n.length-1])}),t},x3=(e,t)=>{e.doc??Fo();const n=e._map.get(t);return n!==void 0&&!n.deleted},YE=(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&&iu(i,t)&&(n[o]=i.content.getContent()[i.length-1])}),n},Cp=e=>(e.doc??Fo(),kE(e._map.entries(),t=>!t[1].deleted)),XE=class extends gp{},ZE=class $m extends _o{constructor(){super(),this._prelimContent=[],this._searchMarker=[]}static from(t){const n=new $m;return n.push(t),n}_integrate(t,n){super._integrate(t,n),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new $m}clone(){const t=new $m;return t.insert(0,this.toArray().map(n=>n instanceof _o?n.clone():n)),t}get length(){return this.doc??Fo(),this._length}_callObserver(t,n){super._callObserver(t,n),yp(this,t,new XE(this,t))}insert(t,n){this.doc!==null?fr(this.doc,r=>{_3(r,this,t,n)}):this._prelimContent.splice(t,0,...n)}push(t){this.doc!==null?fr(this.doc,n=>{qE(n,this,t)}):this._prelimContent.push(...t)}unshift(t){this.insert(0,t)}delete(t,n=1){this.doc!==null?fr(this.doc,r=>{A3(r,this,t,n)}):this._prelimContent.splice(t,n)}get(t){return k3(this,t)}toArray(){return w3(this)}slice(t=0,n=this.length){return b3(this,t,n)}toJSON(){return this.map(t=>t instanceof _o?t.toJSON():t)}map(t){return C3(this,t)}forEach(t){ef(this,t)}[Symbol.iterator](){return KE(this)}_write(t){t.writeTypeRef(c8)}},QE=class extends gp{constructor(e,t,n){super(e,t),this.keysChanged=n}},Ly=class I2 extends _o{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 I2}clone(){const t=new I2;return this.forEach((n,r)=>{t.set(r,n instanceof _o?n.clone():n)}),t}_callObserver(t,n){yp(this,t,new QE(this,t,n))}toJSON(){this.doc??Fo();const t={};return this._map.forEach((n,r)=>{if(!n.deleted){const o=n.content.getContent()[n.length-1];t[r]=o instanceof _o?o.toJSON():o}}),t}get size(){return[...Cp(this)].length}keys(){return ky(Cp(this),t=>t[0])}values(){return ky(Cp(this),t=>t[1].content.getContent()[t[1].length-1])}entries(){return ky(Cp(this),t=>[t[0],t[1].content.getContent()[t[1].length-1]])}forEach(t){this.doc??Fo(),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?fr(this.doc,n=>{wp(n,this,t)}):this._prelimContent.delete(t)}set(t,n){return this.doc!==null?fr(this.doc,r=>{Ty(r,this,t,n)}):this._prelimContent.set(t,n),n}get(t){return Ry(this,t)}has(t){return x3(this,t)}clear(){this.doc!==null?fr(this.doc,t=>{this.forEach(function(n,r,o){wp(t,o,r)})}):this._prelimContent.clear()}_write(t){t.writeTypeRef(u8)}},tl=(e,t)=>e===t||typeof e=="object"&&typeof t=="object"&&e&&t&&_x(e,t),My=class{constructor(e,t,n,r){this.left=e,this.right=t,this.index=n,this.currentAttributes=r}forward(){this.right===null&&da(),this.right.content.constructor===No?this.right.deleted||su(this.currentAttributes,this.right.content):this.right.deleted||(this.index+=this.right.length),this.left=this.right,this.right=this.right.right}},E3=(e,t,n)=>{for(;t.right!==null&&n>0;)t.right.content.constructor===No?t.right.deleted||su(t.currentAttributes,t.right.content):t.right.deleted||(n<t.right.length&&el(e,Ir(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},kp=(e,t,n,r)=>{const o=new Map,i=r?vp(t,n):null;if(i){const s=new My(i.p.left,i.p,i.index,o);return E3(e,s,n-i.index)}else{const s=new My(null,t._start,0,o);return E3(e,s,n)}},T3=(e,t,n,r)=>{for(;n.right!==null&&(n.right.deleted===!0||n.right.content.constructor===No&&tl(r.get(n.right.content.key),n.right.content.value));)n.right.deleted||r.delete(n.right.content.key),n.forward();const o=e.doc,i=o.clientID;r.forEach((s,a)=>{const l=n.left,c=n.right,d=new yi(Ir(i,ti(o.store,i)),l,l&&l.lastId,c,c&&c.id,t,null,new No(a,s));d.integrate(e,0),n.right=d,n.forward()})},su=(e,t)=>{const{key:n,value:r}=t;r===null?e.delete(n):e.set(n,r)},R3=(e,t)=>{for(;e.right!==null;){if(!(e.right.deleted||e.right.content.constructor===No&&tl(t[e.right.content.key]??null,e.right.content.value)))break;e.forward()}},L3=(e,t,n,r)=>{const o=e.doc,i=o.clientID,s=new Map;for(const a in r){const l=r[a],c=n.currentAttributes.get(a)??null;if(!tl(c,l)){s.set(a,c);const{left:d,right:f}=n;n.right=new yi(Ir(i,ti(o.store,i)),d,d&&d.lastId,f,f&&f.id,t,null,new No(a,l)),n.right.integrate(e,0),n.forward()}}return s},Py=(e,t,n,r,o)=>{n.currentAttributes.forEach((h,g)=>{o[g]===void 0&&(o[g]=null)});const i=e.doc,s=i.clientID;R3(n,o);const a=L3(e,t,n,o),l=r.constructor===String?new au(r):r instanceof _o?new lu(r):new Sp(r);let{left:c,right:d,index:f}=n;t._searchMarker&&Jd(t._searchMarker,n.index,l.getLength()),d=new yi(Ir(s,ti(i.store,s)),c,c&&c.lastId,d,d&&d.id,t,null,l),d.integrate(e,0),n.right=d,n.index=f,n.forward(),T3(e,t,n,a)},M3=(e,t,n,r,o)=>{const i=e.doc,s=i.clientID;R3(n,o);const a=L3(e,t,n,o);e:for(;n.right!==null&&(r>0||a.size>0&&(n.right.deleted||n.right.content.constructor===No));){if(!n.right.deleted)switch(n.right.content.constructor){case No:{const{key:l,value:c}=n.right.content,d=o[l];if(d!==void 0){if(tl(d,c))a.delete(l);else{if(r===0)break e;a.set(l,c)}n.right.delete(e)}else n.currentAttributes.set(l,c);break}default:r<n.right.length&&el(e,Ir(n.right.id.client,n.right.id.clock+r)),r-=n.right.length}n.forward()}if(r>0){let l="";for(;r>0;r--)l+=`
|
|
7
7
|
`;n.right=new yi(Ir(s,ti(i.store,s)),n.left,n.left&&n.left.lastId,n.right,n.right&&n.right.id,t,null,new au(l)),n.right.integrate(e,0),n.forward()}T3(e,t,n,a)},P3=(e,t,n,r,o)=>{let i=t;const s=As();for(;i&&(!i.countable||i.deleted);){if(!i.deleted&&i.content.constructor===No){const c=i.content;s.set(c.key,c)}i=i.right}let a=0,l=!1;for(;t!==i;){if(n===t&&(l=!0),!t.deleted){const c=t.content;if(c.constructor===No){const{key:d,value:f}=c,h=r.get(d)??null;(s.get(d)!==c||h===f)&&(t.delete(e),a++,!l&&(o.get(d)??null)===f&&h!==f&&(h===null?o.delete(d):o.set(d,h))),!l&&!t.deleted&&su(o,c)}}t=t.right}return a},JE=(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===No){const r=t.content.key;n.has(r)?t.delete(e):n.add(r)}t=t.left}},e8=e=>{let t=0;return fr(e.doc,n=>{let r=e._start,o=e._start,i=As();const s=Jv(i);for(;o;)o.deleted===!1&&(o.content.constructor===No?su(s,o.content):(t+=P3(n,r,o,i,s),i=Jv(s),r=o)),o=o.right}),t},t8=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&&f3(e,n.store.clients.get(r),i,o,s=>{!s.deleted&&s.content.constructor===No&&s.constructor!==nl&&t.add(s.parent)})}fr(n,r=>{t3(e,e.deleteSet,o=>{if(o instanceof nl||!o.parent._hasFormatting||t.has(o.parent))return;const i=o.parent;o.content.constructor===No?t.add(i):JE(r,o)});for(const o of t)e8(o)})},D3=(e,t,n)=>{const r=n,o=Jv(t.currentAttributes),i=t.right;for(;n>0&&t.right!==null;){if(t.right.deleted===!1)switch(t.right.content.constructor){case lu:case Sp:case au:n<t.right.length&&el(e,Ir(t.right.id.client,t.right.id.clock+n)),n-=t.right.length,t.right.delete(e)}t.forward()}i&&P3(e,i,t.right,o,t.currentAttributes);const s=(t.left||t.right).parent;return s._searchMarker&&Jd(s._searchMarker,t.index,-r+n),t},n8=class extends gp{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=[];fr(e,n=>{const r=new Map,o=new Map;let i=this.target._start,s=null;const a={};let l="",c=0,d=0;const f=()=>{if(s!==null){let h=null;switch(s){case"delete":d>0&&(h={delete:d}),d=0;break;case"insert":(typeof l=="object"||l.length>0)&&(h={insert:l},r.size>0&&(h.attributes={},r.forEach((g,m)=>{g!==null&&(h.attributes[m]=g)}))),l="";break;case"retain":c>0&&(h={retain:c},Sx(a)||(h.attributes=wx({},a))),c=0}h&&t.push(h),s=null}};for(;i!==null;){switch(i.content.constructor){case lu:case Sp: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"),c+=1);break;case au: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"),c+=i.length);break;case No:{const{key:h,value:g}=i.content;if(this.adds(i)){if(!this.deletes(i)){const m=r.get(h)??null;tl(m,g)?g!==null&&i.delete(n):(s==="retain"&&f(),tl(g,o.get(h)??null)?delete a[h]:a[h]=g)}}else if(this.deletes(i)){o.set(h,g);const m=r.get(h)??null;tl(m,g)||(s==="retain"&&f(),a[h]=m)}else if(!i.deleted){o.set(h,g);const m=a[h];m!==void 0&&(tl(m,g)?m!==null&&i.delete(n):(s==="retain"&&f(),g===null?delete a[h]:a[h]=g))}i.deleted||(s==="insert"&&f(),su(r,i.content));break}}i=i.right}for(f();t.length>0;){const h=t[t.length-1];if(h.retain!==void 0&&h.attributes===void 0)t.pop();else break}}),this._delta=t}return this._delta}},r8=class x2 extends _o{constructor(t){super(),this._pending=t!==void 0?[()=>this.insert(0,t)]:[],this._searchMarker=[],this._hasFormatting=!1}get length(){return this.doc??Fo(),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 x2}clone(){const t=new x2;return t.applyDelta(this.toDelta()),t}_callObserver(t,n){super._callObserver(t,n);const r=new n8(this,t,n);yp(this,t,r),!t.local&&this._hasFormatting&&(t._needFormattingCleanup=!0)}toString(){this.doc??Fo();let t="",n=this._start;for(;n!==null;)!n.deleted&&n.countable&&n.content.constructor===au&&(t+=n.content.str),n=n.right;return t}toJSON(){return this.toString()}applyDelta(t,{sanitize:n=!0}={}){this.doc!==null?fr(this.doc,r=>{const o=new My(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)===`
|
|
@@ -99,10 +99,10 @@ js: import "konva/skia-backend";
|
|
|
99
99
|
`,b_=()=>{if(typeof document>"u")throw new Error(uD)},es=class sI{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 sI(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 c=Math.sqrt(t*t+n*n);l.rotation=n>0?Math.acos(t/c):-Math.acos(t/c),l.scaleX=c,l.scaleY=a/c,l.skewX=(t*r+n*o)/a,l.skewY=0}else if(r!=0||o!=0){const c=Math.sqrt(r*r+o*o);l.rotation=Math.PI/2-(o>0?Math.acos(-r/c):-Math.acos(r/c)),l.scaleX=a/c,l.scaleY=c,l.skewX=0,l.skewY=(t*r+n*o)/a}return l.rotation=Ee._getRotation(l.rotation),l}},dD="[object Array]",fD="[object Number]",hD="[object String]",pD="[object Boolean]",mD=Math.PI/180,gD=180/Math.PI,df="#",vD="",yD="0",bD="Konva warning: ",w_="Konva error: ",wD="rgb(",C0={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]},CD=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/,Bp=[],ff=null,kD=typeof requestAnimationFrame<"u"&&requestAnimationFrame||function(e){setTimeout(e,16)},Ee={_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)===dD},_isNumber(e){return Object.prototype.toString.call(e)===fD&&!isNaN(e)&&isFinite(e)},_isString(e){return Object.prototype.toString.call(e)===hD},_isBoolean(e){return Object.prototype.toString.call(e)===pD},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){Bp.push(e),Bp.length===1&&kD(function(){const t=Bp;Bp=[],t.forEach(function(n){n()})})},createCanvasElement(){b_();const e=document.createElement("canvas");try{e.style=e.style||{}}catch{}return e},createImageElement(){return b_(),document.createElement("img")},_isInDocument(e){for(;e=e.parentNode;)if(e==document)return!0;return!1},_urlToImage(e,t){const n=Ee.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(df,vD);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=yD+e;return df+e},isCanvasFarblingActive(){if(ff!==null)return ff;if(typeof document>"u")return ff=!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 ff=r,this.releaseCanvas(e),ff},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),df+this._rgbToHex(e,t,n)},getSnappedHexColor(e){const t=this._hexToRgb(e);return df+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 C0?(t=C0[e],{r:t[0],g:t[1],b:t[2]}):e[0]===df?this._hexToRgb(e.substring(1)):e.substr(0,4)===wD?(t=CD.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",Ee._namedColorToRBA(e)||Ee._hex3ColorToRGBA(e)||Ee._hex4ColorToRGBA(e)||Ee._hex6ColorToRGBA(e)||Ee._hex8ColorToRGBA(e)||Ee._rgbColorToRGBA(e)||Ee._rgbaColorToRGBA(e)||Ee._hslColorToRGBA(e)},_namedColorToRBA(e){const t=C0[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 c=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=c+(s-c)*6*a:2*a<1?l=s:3*a<2?l=c+(s-c)*(2/3-a)*6:l=c,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*mD},radToDeg(e){return e*gD},_degToRad(e){return Ee.warn("Util._degToRad is removed. Please use public Util.degToRad instead."),Ee.degToRad(e)},_radToDeg(e){return Ee.warn("Util._radToDeg is removed. Please use public Util.radToDeg instead."),Ee.radToDeg(e)},_getRotation(e){return Ct.angleDeg?Ee.radToDeg(e):e},_capitalize(e){return e.charAt(0).toUpperCase()+e.slice(1)},throw(e){throw new Error(w_+e)},error(e){console.error(w_+e)},warn(e){Ct.showWarnings&&console.warn(bD+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 c=(e-n)*(e-n)+(t-r)*(t-r);if(c==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))/c;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=Ee.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=Ee._getProjectionToSegment(i.x,i.y,a.x,a.y,e.x,e.y),c=l[0],d=l[1],f=l[2];f<o&&(r.x=c,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=Ee._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||Ee._isElement(e[n]))if(t.configurable)delete e[n];else return null;else if(Ee._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){Ct.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,c=0;typeof r=="number"?s=a=l=c=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),c=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-c),e.arc(o+t-c,i+n-c,c,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],c={x:a.x-s.x,y:a.y-s.y},d={x:l.x-a.x,y:l.y-a.y},f=Math.hypot(c.x,c.y),h=Math.hypot(d.x,d.y);let g;typeof o=="number"?g=o:g=i<o.length?o[i]:0,g=r*Math.cos(Math.PI/n)*Math.min(1,g/r*2);const m={x:c.x/f,y:c.y/f},v={x:d.x/h,y:d.y/h},k={x:a.x-m.x*g,y:a.y-m.y*g},C={x:a.x+v.x*g,y:a.y+v.y*g};i===0?e.moveTo(k.x,k.y):e.lineTo(k.x,k.y),e.arcTo(a.x,a.y,C.x,C.y,g)}}};function SD(e){const t=[],n=e.length,r=Ee;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 C_=",",_D="(",AD=")",ID="([",xD="])",ED=";",TD="()",RD="=",k_=["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"],LD=["fillStyle","strokeStyle","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY","letterSpacing","lineCap","lineDashOffset","lineJoin","lineWidth","miterLimit","direction","font","textAlign","textBaseline","globalAlpha","globalCompositeOperation","imageSmoothingEnabled","filter"],MD=100,zp=null;function S_(){if(zp!==null)return zp;try{const e=Ee.createCanvasElement().getContext("2d");return e?!!e&&"filter"in e:(zp=!1,!1)}catch{return zp=!1,!1}}var Vp=class{constructor(e){this.canvas=e,Ct.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+=TD:Ee._isArray(l[0])?o+=ID+l.join(C_)+xD:(t&&(l=l.map(c=>typeof c=="number"?Math.floor(c):c)),o+=_D+l.join(C_)+AD)):(o+=s.property,e||(o+=RD+s.val)),o+=ED;return o}clearTrace(){this.traceArr=[]}_trace(e){let t=this.traceArr,n;t.push(e),n=t.length,n>=MD&&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 c=arguments,d=this._context;c.length===3?d.drawImage(e,t,n):c.length===5?d.drawImage(e,t,n,r,o):c.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=k_.length,n=this.setAttr,r,o;const i=function(s){let a=e[s],l;e[s]=function(){return o=SD(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(k_[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)}};LD.forEach(function(e){Object.defineProperty(Vp.prototype,e,{get(){return this._context[e]},set(t){this._context[e]=t}})});var PD=class extends Vp{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(),c=a.x*l,d=a.y*l;this.setAttr("shadowColor",o),this.setAttr("shadowBlur",i*Math.min(Math.abs(c),Math.abs(d))),this.setAttr("shadowOffsetX",s.x*c),this.setAttr("shadowOffsetY",s.y*d)}},DD=class extends Vp{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()}}},jp;function OD(){if(jp)return jp;const e=Ee.createCanvasElement(),t=e.getContext("2d");return jp=(function(){return(Ct._global.devicePixelRatio||1)/(t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1)})(),Ee.releaseCanvas(e),jp}var k0=class{constructor(e){this.pixelRatio=1,this.width=0,this.height=0,this.isCache=!1;const t=(e||{}).pixelRatio||Ct.pixelRatio||OD();this.pixelRatio=t,this._canvas=Ee.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 Ee.error("Unable to get data URL. "+r.message+" For more info read https://konvajs.org/docs/posts/Tainted_Canvas.html."),""}}}},il=class extends k0{constructor(e={width:0,height:0,willReadFrequently:!1}){super(e),this.context=new PD(this,{willReadFrequently:e.willReadFrequently}),this.setSize(e.width,e.height)}},S0=class extends k0{constructor(e={width:0,height:0}){super(e),this.hitCanvas=!0,this.context=new DD(this),this.setSize(e.width,e.height)}},Dn={get isDragging(){let e=!1;return Dn._dragElements.forEach(t=>{t.dragStatus==="dragging"&&(e=!0)}),e},justDragged:!1,get node(){let e;return Dn._dragElements.forEach(t=>{e=t.node}),e},_dragElements:new Map,_drag(e){const t=[];Dn._dragElements.forEach((n,r)=>{const{node:o}=n,i=o.getStage();i.setPointersPositions(e),n.pointerId===void 0&&(n.pointerId=Ee._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=[];Dn._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")&&(Dn.justDragged=!0,Ct._mouseListenClick=!1,Ct._touchListenClick=!1,Ct._pointerListenClick=!1,n.dragStatus="stopped");const i=n.node.getLayer()||n.node instanceof Ct.Stage&&n.node;i&&t.indexOf(i)===-1&&t.push(i)}),t.forEach(n=>{n.draw()})},_endDragAfter(e){Dn._dragElements.forEach((t,n)=>{t.dragStatus==="stopped"&&t.node.fire("dragend",{type:"dragend",target:t.node,evt:e},!0),t.dragStatus!=="dragging"&&Dn._dragElements.delete(n)})}};Ct.isBrowser&&(window.addEventListener("mouseup",Dn._endDragBefore,!0),window.addEventListener("touchend",Dn._endDragBefore,!0),window.addEventListener("touchcancel",Dn._endDragBefore,!0),window.addEventListener("mousemove",Dn._drag),window.addEventListener("touchmove",Dn._drag),window.addEventListener("mouseup",Dn._endDragAfter,!1),window.addEventListener("touchend",Dn._endDragAfter,!1),window.addEventListener("touchcancel",Dn._endDragAfter,!1));function sl(e){return Ee._isString(e)?'"'+e+'"':Object.prototype.toString.call(e)==="[object Number]"||Ee._isBoolean(e)?e:Object.prototype.toString.call(e)}function __(e){return e>255?255:e<0?0:Math.round(e)}function yt(){if(Ct.isUnminified)return function(e,t){return Ee._isNumber(e)||Ee.warn(sl(e)+' is a not valid value for "'+t+'" attribute. The value should be a number.'),e}}function Up(e){if(Ct.isUnminified)return function(t,n){let r=Ee._isNumber(t),o=Ee._isArray(t)&&t.length==e;return!r&&!o&&Ee.warn(sl(t)+' is a not valid value for "'+n+'" attribute. The value should be a number or Array<number>('+e+")"),t}}function _0(){if(Ct.isUnminified)return function(e,t){return Ee._isNumber(e)||e==="auto"||Ee.warn(sl(e)+' is a not valid value for "'+t+'" attribute. The value should be a number or "auto".'),e}}function nc(){if(Ct.isUnminified)return function(e,t){return Ee._isString(e)||Ee.warn(sl(e)+' is a not valid value for "'+t+'" attribute. The value should be a string.'),e}}function A_(){if(Ct.isUnminified)return function(e,t){const n=Ee._isString(e),r=Object.prototype.toString.call(e)==="[object CanvasGradient]"||e&&e.addColorStop;return n||r||Ee.warn(sl(e)+' is a not valid value for "'+t+'" attribute. The value should be a string or a native gradient.'),e}}function FD(){if(Ct.isUnminified)return function(e,t){const n=Int8Array?Object.getPrototypeOf(Int8Array):null;return n&&e instanceof n||(Ee._isArray(e)?e.forEach(function(r){Ee._isNumber(r)||Ee.warn('"'+t+'" attribute has non numeric element '+r+". Make sure that all elements are numbers.")}):Ee.warn(sl(e)+' is a not valid value for "'+t+'" attribute. The value should be a array of numbers.')),e}}function ts(){if(Ct.isUnminified)return function(e,t){return e===!0||e===!1||Ee.warn(sl(e)+' is a not valid value for "'+t+'" attribute. The value should be a boolean.'),e}}function ND(e){if(Ct.isUnminified)return function(t,n){return t==null||Ee.isObject(t)||Ee.warn(sl(t)+' is a not valid value for "'+n+'" attribute. The value should be an object with properties '+e),t}}var hf="get",pf="set",ce={addGetterSetter(e,t,n,r,o){ce.addGetter(e,t,n),ce.addSetter(e,t,r,o),ce.addOverloadedGetterSetter(e,t)},addGetter(e,t,n){const r=hf+Ee._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=pf+Ee._capitalize(t);e.prototype[o]||ce.overWriteSetter(e,t,n,r)},overWriteSetter(e,t,n,r){const o=pf+Ee._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=Ee._capitalize,a=hf+s(t),l=pf+s(t);e.prototype[a]=function(){const d={};for(let f=0;f<i;f++){const h=n[f];d[h]=this.getAttr(t+s(h))}return d};const c=ND(n);e.prototype[l]=function(d){const f=this.attrs[t];r&&(d=r.call(this,d,t)),c&&c.call(this,d,t);for(const h in d)d.hasOwnProperty(h)&&this._setAttr(t+s(h),d[h]);return d||n.forEach(h=>{this._setAttr(t+s(h),void 0)}),this._fireChangeEvent(t,f,d),o&&o.call(this),this},ce.addOverloadedGetterSetter(e,t)},addOverloadedGetterSetter(e,t){const n=Ee._capitalize(t),r=pf+n,o=hf+n;e.prototype[t]=function(){return arguments.length?(this[r](arguments[0]),this):this[o]()}},addDeprecatedGetterSetter(e,t,n,r){Ee.error("Adding deprecated "+t);const o=hf+Ee._capitalize(t),i=t+" property is deprecated and will be removed soon. Look at Konva change log for more information.";e.prototype[o]=function(){Ee.error(i);const s=this.attrs[t];return s===void 0?n:s},ce.addSetter(e,t,r,function(){Ee.error(i)}),ce.addOverloadedGetterSetter(e,t)},backCompat(e,t){Ee.each(t,function(n,r){const o=e.prototype[r],i=hf+Ee._capitalize(n),s=pf+Ee._capitalize(n);function a(){o.apply(this,arguments),Ee.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 BD(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=Ct.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=Ct.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=Ct.Filters;l&&l.Contrast&&l.Contrast.call(this,s)}}case"grayscale":return function(i){const s=Ct.Filters;s&&s.Grayscale&&s.Grayscale.call(this,i)};case"sepia":return function(i){const s=Ct.Filters;s&&s.Sepia&&s.Sepia.call(this,i)};case"invert":return function(i){const s=Ct.Filters;s&&s.Invert&&s.Invert.call(this,i)};default:Ee.warn(`CSS filter "${r}" is not supported in fallback mode. Consider using function filters for better compatibility.`)}}return()=>{}}var Hp="absoluteOpacity",I_="allEventListeners",ya="absoluteTransform",x_="absoluteScale",rc="canvas",zD="Change",VD="children",jD="konva",A0="listening",UD="mouseenter",HD="mouseleave",$D="pointerenter",GD="pointerleave",WD="touchenter",KD="touchleave",E_="set",T_="Shape",$p=" ",R_="stage",al="transform",qD="Stage",I0="visible",YD=["xChange.konva","yChange.konva","scaleXChange.konva","scaleYChange.konva","skewXChange.konva","skewYChange.konva","rotationChange.konva","offsetXChange.konva","offsetYChange.konva","transformsEnabledChange.konva"].join($p),XD=1,St=class Jf{constructor(t){this._id=XD++,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===al||t===ya)&&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===al||t===ya)&&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($p);this.on(o,()=>{this._clearCache(t)}),this._attachedDepsListeners.set(t,!0)}return this._getCache(t,r)}_getCanvasCache(){return this._cache.get(rc)}_clearSelfAndDescendantCache(t){this._clearCache(t),t===ya&&this.fire("absoluteTransformChange")}clearCache(){if(this._cache.has(rc)){const{scene:t,filter:n,hit:r}=this._cache.get(rc);Ee.releaseCanvas(t._canvas,n._canvas,r._canvas),this._cache.delete(rc)}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,c=n.offset||0,d=n.drawBorder||!1,f=n.hitCanvasPixelRatio||1;if(!o||!i){Ee.error("Can not cache the node. Width or height of the node equals 0. Caching is skipped.");return}const h=Math.abs(Math.round(r.x)-a)>.5?1:0,g=Math.abs(Math.round(r.y)-l)>.5?1:0;o+=c*2+h,i+=c*2+g,a-=c,l-=c;const m=new il({pixelRatio:s,width:o,height:i}),v=new il({pixelRatio:s,width:0,height:0,willReadFrequently:!0}),k=new S0({pixelRatio:f,width:o,height:i}),C=m.getContext(),_=k.getContext(),b=new il({width:m.width/m.pixelRatio+Math.abs(a),height:m.height/m.pixelRatio+Math.abs(l),pixelRatio:m.pixelRatio}),w=b.getContext();return k.isCache=!0,m.isCache=!0,this._cache.delete(rc),this._filterUpToDate=!1,n.imageSmoothingEnabled===!1&&(m.getContext()._context.imageSmoothingEnabled=!1,v.getContext()._context.imageSmoothingEnabled=!1),C.save(),_.save(),w.save(),C.translate(-a,-l),_.translate(-a,-l),w.translate(-a,-l),b.x=a,b.y=l,this._isUnderCache=!0,this._clearSelfAndDescendantCache(Hp),this._clearSelfAndDescendantCache(x_),this.drawScene(m,this,b),this.drawHit(k,this),this._isUnderCache=!1,C.restore(),_.restore(),d&&(C.save(),C.beginPath(),C.rect(0,0,o,i),C.closePath(),C.setAttr("strokeStyle","red"),C.setAttr("lineWidth",5),C.stroke(),C.restore()),Ee.releaseCanvas(b._canvas),this._cache.set(rc,{scene:m,filter:v,hit:k,x:a,y:l}),this._requestDraw(),this}isCached(){return this._cache.has(rc)}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(c){const d=l.point(c);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,c;if(!t||t.length===0)return r;if(this._filterUpToDate)return o;let d=!0;for(let h=0;h<t.length;h++)if(typeof t[h]=="string"&&S_(),typeof t[h]!="string"||!S_()){d=!1;break}const f=r.pixelRatio;if(o.setSize(r.width/r.pixelRatio,r.height/r.pixelRatio),d){const h=t.join(" ");return i.save(),i.setAttr("filter",h),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++)c=t[l],typeof c=="string"&&(c=BD(c)),c.call(this,a),i.putImageData(a,0,0)}catch(h){Ee.error("Unable to apply filter. "+h.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(I_),t.length===3)return this._delegate.apply(this,t);const o=n.split($p);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($p),o=r.length,i,s,a,l,c,d;if(this._cache&&this._cache.delete(I_),!t)for(s in this.eventListeners)this._off(s);for(i=0;i<o;i++)if(a=r[i],l=a.split("."),c=l[0],d=l[1],c)this.eventListeners[c]&&this._off(c,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=Ee.cloneObject(i),i.currentTarget=s[a],r.call(s[a],i)}),this}remove(){return this.isDragging()&&this.stopDrag(),Dn._dragElements.delete(this._id),Dn._dragElements.forEach((t,n)=>{this.isAncestorOf(t.node)&&Dn._dragElements.delete(n)}),this._remove(),this}_clearCaches(){this._clearSelfAndDescendantCache(ya),this._clearSelfAndDescendantCache(Hp),this._clearSelfAndDescendantCache(x_),this._clearSelfAndDescendantCache(R_),this._clearSelfAndDescendantCache(I0),this._clearSelfAndDescendantCache(A0)}_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"+Ee._capitalize(t);return Ee._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!==VD&&(r=E_+Ee._capitalize(n),Ee._isFunction(this[r])?this[r](t[n]):this._setAttr(n,t[n]))}),this}isListening(){return this._getCache(A0,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(I0,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;Dn._dragElements.forEach(s=>{s.dragStatus==="dragging"&&(s.node.nodeType==="Stage"||s.node.getLayer()===r)&&(o=!0)});const i=!n&&!Ct.hitOnDragEnabled&&(o||Ct.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!==T_&&(o=o.concat(a.getChildren().slice())),a._id===n._id&&(s=i);o.length>0&&o[0].getDepth()<=t&&l(o)}const c=this.getStage();return n.nodeType!==qD&&c&&l(c.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(al),this._clearSelfAndDescendantCache(ya)),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 es,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(al);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(al),this._clearSelfAndDescendantCache(ya),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 Ee.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 Ee.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 Ee.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 Ee.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 Ee.warn("Node has no parent. zIndex parameter is ignored."),this;(t<0||t>=this.parent.children.length)&&Ee.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(Hp,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=Ee.isObject(r)&&!Ee._isPlainObject(r)&&!Ee._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 Ee._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],Ee.isValidSelector(i)||(Ee.warn('Selector "'+i+'" is invalid. Allowed selectors examples are "#foo", ".bar" or "Group".'),Ee.warn('If you have a custom shape with such className, please change it to start with upper letter like "Triangle".'),Ee.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(R_,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(ya,this._getAbsoluteTransform)}_getAbsoluteTransform(t){let n;if(t)return n=new es,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(ya)||new es,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(al,this._getTransform)}_getTransform(){var t,n;const r=this._cache.get(al)||new es;r.reset();const o=this.x(),i=this.y(),s=Ct.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,c=this.attrs.skewX||0,d=this.attrs.skewY||0,f=this.attrs.offsetX||0,h=this.attrs.offsetY||0;return(o!==0||i!==0)&&r.translate(o,i),s!==0&&r.rotate(s),(c!==0||d!==0)&&r.skew(c,d),(a!==1||l!==1)&&r.scale(a,l),(f!==0||h!==0)&&r.translate(-1*f,-1*h),r.dirty=!1,r}clone(t){let n=Ee.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(jD)<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 il({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(),c=new il({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,c),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,Ee._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():Ct.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+zD,{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[E_+Ee._capitalize(t)];return Ee._isFunction(r)?r.call(this,n):this._setAttr(t,n),this}_requestDraw(){if(Ct.autoDrawEnabled){const t=this.getLayer()||this.getStage();t?.batchDraw()}}_setAttr(t,n){const r=this.attrs[t];r===n&&!Ee.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===T_&&(n.target=this);const o=[UD,HD,$D,GD,WD,KD];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=Jf.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,Jf.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;Dn._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){Dn._dragElements.has(this._id)||this._createDragElement(t);const r=Dn._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:Ee.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=Dn._dragElements.get(this._id);n&&(n.dragStatus="stopped"),Dn._endDragBefore(t),Dn._endDragAfter(t)}setDraggable(t){this._setAttr("draggable",t),this._dragChange()}isDragging(){const t=Dn._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||Ct.dragButtons.indexOf(t.evt.button)>=0)||this.isDragging())return;let n=!1;Dn._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=Dn._dragElements.get(this._id),n=t&&t.dragStatus==="dragging",r=t&&t.dragStatus==="ready";n?this.stopDrag():r&&Dn._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 Ee.haveIntersection(r,this.getClientRect())}static create(t,n){return Ee._isString(t)&&(t=JSON.parse(t)),this._createNode(t,n)}static _createNode(t,n){let r=Jf.prototype.getClassName.call(t),o=t.children,i,s,a;n&&(t.attrs.container=n),Ct[r]||(Ee.warn('Can not find a node with class name "'+r+'". Fallback to "Shape".'),r="Shape");const l=Ct[r];if(i=new l(t.attrs),o)for(s=o.length,a=0;a<s;a++)i.add(Jf._createNode(o[a]));return i}};St.protoListenerMap=new Map,St.prototype.nodeType="Node",St.prototype._attrsAffectingSize=[],St.prototype.eventListeners={},St.prototype.on(YD,function(){if(this._batchingTransformChange){this._needClearTransformCache=!0;return}this._clearCache(al),this._clearSelfAndDescendantCache(ya)}),St.prototype.on("visibleChange.konva",function(){this._clearSelfAndDescendantCache(I0)}),St.prototype.on("listeningChange.konva",function(){this._clearSelfAndDescendantCache(A0)}),St.prototype.on("opacityChange.konva",function(){this._clearSelfAndDescendantCache(Hp)});var er=ce.addGetterSetter;er(St,"zIndex"),er(St,"absolutePosition"),er(St,"position"),er(St,"x",0,yt()),er(St,"y",0,yt()),er(St,"globalCompositeOperation","source-over",nc()),er(St,"opacity",1,yt()),er(St,"name","",nc()),er(St,"id","",nc()),er(St,"rotation",0,yt()),ce.addComponentsGetterSetter(St,"scale",["x","y"]),er(St,"scaleX",1,yt()),er(St,"scaleY",1,yt()),ce.addComponentsGetterSetter(St,"skew",["x","y"]),er(St,"skewX",0,yt()),er(St,"skewY",0,yt()),ce.addComponentsGetterSetter(St,"offset",["x","y"]),er(St,"offsetX",0,yt()),er(St,"offsetY",0,yt()),er(St,"dragDistance",void 0,yt()),er(St,"width",0,yt()),er(St,"height",0,yt()),er(St,"listening",!0,ts()),er(St,"preventDefault",!0,ts()),er(St,"filters",void 0,function(e){return this._filterUpToDate=!1,e}),er(St,"visible",!0,ts()),er(St,"transformsEnabled","all",nc()),er(St,"size"),er(St,"dragBoundFunc"),er(St,"draggable",!1,ts()),ce.backCompat(St,{rotateDeg:"rotate",setRotationDeg:"setRotation",getRotationDeg:"getRotation"});var bi=class extends St{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=St.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=St.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 c=this.getAbsoluteTransform(t).getMatrix();i.transform(c[0],c[1],c[2],c[3],c[4],c[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(),c=typeof s=="number"&&typeof a=="number"||l,d=n===this;if(c){i.save();const h=this.getAbsoluteTransform(n);let g=h.getMatrix();i.transform(g[0],g[1],g[2],g[3],g[4],g[5]),i.beginPath();let m;if(l)m=l.call(this,i,this);else{const v=this.clipX(),k=this.clipY();i.rect(v||0,k||0,s,a)}i.clip.apply(i,m),g=h.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(h){h[e](t,n,r)}),f&&i.restore(),c&&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 c=this;(t=this.children)===null||t===void 0||t.forEach(function(h){if(!h.visible())return;const g=h.getClientRect({relativeTo:c,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 h=0;h<d.length;h++)if(d[h]._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)}};ce.addComponentsGetterSetter(bi,"clip",["x","y","width","height"]),ce.addGetterSetter(bi,"clipX",void 0,yt()),ce.addGetterSetter(bi,"clipY",void 0,yt()),ce.addGetterSetter(bi,"clipWidth",void 0,yt()),ce.addGetterSetter(bi,"clipHeight",void 0,yt()),ce.addGetterSetter(bi,"clipFunc");var mf=new Map,L_=Ct._global.PointerEvent!==void 0;function x0(e){return mf.get(e)}function E0(e){return{evt:e,pointerId:e.pointerId}}function M_(e,t){return mf.get(e)===t}function P_(e,t){gf(e),t.getStage()&&(mf.set(e,t),L_&&t._fire("gotpointercapture",E0(new PointerEvent("gotpointercapture"))))}function gf(e,t){const n=mf.get(e);if(!n)return;const r=n.getStage();r&&r.content,mf.delete(e),L_&&n._fire("lostpointercapture",E0(new PointerEvent("lostpointercapture")))}var ZD="Stage",QD="string",D_="px",JD="mouseout",O_="mouseleave",F_="mouseover",N_="mouseenter",B_="mousemove",z_="mousedown",V_="mouseup",vf="pointermove",yf="pointerdown",mu="pointerup",bf="pointercancel",eO="lostpointercapture",Gp="pointerout",wf="pointerleave",Wp="pointerover",Kp="pointerenter",T0="contextmenu",j_="touchstart",U_="touchend",H_="touchmove",$_="touchcancel",R0="wheel",tO=5,nO=[[N_,"_pointerenter"],[z_,"_pointerdown"],[B_,"_pointermove"],[V_,"_pointerup"],[O_,"_pointerleave"],[j_,"_pointerdown"],[H_,"_pointermove"],[U_,"_pointerup"],[$_,"_pointercancel"],[F_,"_pointerover"],[R0,"_wheel"],[T0,"_contextmenu"],[yf,"_pointerdown"],[vf,"_pointermove"],[mu,"_pointerup"],[bf,"_pointercancel"],[wf,"_pointerleave"],[eO,"_lostpointercapture"]],L0={mouse:{[Gp]:JD,[wf]:O_,[Wp]:F_,[Kp]:N_,[vf]:B_,[yf]:z_,[mu]:V_,[bf]:"mousecancel",pointerclick:"click",pointerdblclick:"dblclick"},touch:{[Gp]:"touchout",[wf]:"touchleave",[Wp]:"touchover",[Kp]:"touchenter",[vf]:H_,[yf]:j_,[mu]:U_,[bf]:$_,pointerclick:"tap",pointerdblclick:"dbltap"},pointer:{[Gp]:Gp,[wf]:wf,[Wp]:Wp,[Kp]:Kp,[vf]:vf,[yf]:yf,[mu]:mu,[bf]:bf,pointerclick:"pointerclick",pointerdblclick:"pointerdblclick"}},Cf=e=>e.indexOf("pointer")>=0?"pointer":e.indexOf("touch")>=0?"touch":"mouse",gu=e=>{const t=Cf(e);if(t==="pointer")return Ct.pointerEventsEnabled&&L0.pointer;if(t==="touch")return L0.touch;if(t==="mouse")return L0.mouse};function G_(e={}){return(e.clipFunc||e.clipWidth||e.clipHeight)&&Ee.warn("Stage does not support clipping. Please use clip for Layers or Groups."),e}var rO="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);",kf=[],qp=class extends bi{constructor(e){super(G_(e)),this._pointerPositions=[],this._changedPointerPositions=[],this._buildDOM(),this._bindContentEvents(),kf.push(this),this.on("widthChange.konva heightChange.konva",this._resizeDOM),this.on("visibleChange.konva",this._checkVisibility),this.on("clipWidthChange.konva clipHeightChange.konva clipFuncChange.konva",()=>{G_(this.attrs)}),this._checkVisibility()}_validateAdd(e){const t=e.getType()==="Layer",n=e.getType()==="FastLayer";t||n||Ee.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===QD){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"),bi.prototype.clone.call(this,e)}destroy(){super.destroy();const e=this.content;e&&Ee._isInDocument(e)&&this.container().removeChild(e);const t=kf.indexOf(this);return t>-1&&kf.splice(t,1),Ee.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}:(Ee.warn(rO),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 il({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+D_,this.content.style.height=t+D_),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>tO&&Ee.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(),Ct.isBrowser&&this.content.appendChild(e.canvas._canvas),this}getParent(){return null}getLayer(){return null}hasPointerCapture(e){return M_(e,this)}setPointerCapture(e){P_(e,this)}releaseCapture(e){gf(e,this)}getLayers(){return this.children}_bindContentEvents(){Ct.isBrowser&&nO.forEach(([e,t])=>{this.content.addEventListener(e,n=>{this[t](n)},{passive:!1})})}_pointerenter(e){this.setPointersPositions(e);const t=gu(e.type);t&&this._fire(t.pointerenter,{evt:e,target:this,currentTarget:this})}_pointerover(e){this.setPointersPositions(e);const t=gu(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=gu(e.type),n=Cf(e.type);if(!t)return;this.setPointersPositions(e);const r=this._getTargetShape(n),o=!(Ct.isDragging()||Ct.isTransforming())||Ct.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=gu(e.type),n=Cf(e.type);if(!t)return;this.setPointersPositions(e);let r=!1;this._changedPointerPositions.forEach(o=>{const i=this.getIntersection(o);if(Dn.justDragged=!1,Ct["_"+n+"ListenClick"]=!0,!i||!i.isListening()){this[n+"ClickStartShape"]=void 0;return}Ct.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=gu(e.type),n=Cf(e.type);if(!t)return;const r=e.type.indexOf("touch")>=0||e.pointerType==="touch";if(Ct.isDragging()&&Dn.node.preventDefault()&&e.cancelable&&r&&e.preventDefault(),this.setPointersPositions(e),!(!(Ct.isDragging()||Ct.isTransforming())||Ct.hitOnDragEnabled))return;const o={};let i=!1;const s=this._getTargetShape(n);this._changedPointerPositions.forEach(a=>{const l=x0(a.id)||this.getIntersection(a),c=a.id,d={evt:e,pointerId:c},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:c}),this[n+"targetShape"]=null)}),i||this._fire(t.pointermove,{evt:e,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id})}_pointerup(e){const t=gu(e.type),n=Cf(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=x0(a.id)||this.getIntersection(a);if(l){if(l.releaseCapture(a.id),i[l._id])return;i[l._id]=!0}const c=a.id,d={evt:e,pointerId:c};let f=!1;Ct["_"+n+"InDblClickWindow"]?(f=!0,clearTimeout(this[n+"DblTimeout"])):Dn.justDragged||(Ct["_"+n+"InDblClickWindow"]=!0,clearTimeout(this[n+"DblTimeout"])),this[n+"DblTimeout"]=setTimeout(function(){Ct["_"+n+"InDblClickWindow"]=!1},Ct.dblClickWindow),l&&l.isListening()?(s=!0,this[n+"ClickEndShape"]=l,l._fireAndBubble(t.pointerup,{...d}),Ct["_"+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),Ct["_"+n+"ListenClick"]&&this._fire(t.pointerclick,{evt:e,target:this,currentTarget:this,pointerId:c}),f&&this._fire(t.pointerdblclick,{evt:e,target:this,currentTarget:this,pointerId:c}))}),s||this._fire(t.pointerup,{evt:e,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),Ct["_"+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(T0,{evt:e}):this._fire(T0,{evt:e,target:this,currentTarget:this})}_wheel(e){this.setPointersPositions(e);const t=this.getIntersection(this.getPointerPosition());t&&t.isListening()?t._fireAndBubble(R0,{evt:e}):this._fire(R0,{evt:e,target:this,currentTarget:this})}_pointercancel(e){this.setPointersPositions(e);const t=x0(e.pointerId)||this.getIntersection(this.getPointerPosition());t&&t._fireAndBubble(mu,E0(e)),gf(e.pointerId)}_lostpointercapture(e){gf(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:Ee._getFirstPointerId(e)}],this._changedPointerPositions=[{x:n,y:r,id:Ee._getFirstPointerId(e)}])}_setPointerPosition(e){Ee.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 il({width:this.width(),height:this.height()}),this.bufferHitCanvas=new S0({pixelRatio:1,width:this.width(),height:this.height()}),!Ct.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 Ee.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}};qp.prototype.nodeType=ZD,wr(qp),ce.addGetterSetter(qp,"container"),Ct.isBrowser&&document.addEventListener("visibilitychange",()=>{kf.forEach(e=>{e.batchDraw()})});var W_="hasShadow",K_="shadowRGBA",q_="patternImage",Y_="linearGradient",X_="radialGradient",Yp;function M0(){return Yp||(Yp=Ee.createCanvasElement().getContext("2d"),Yp)}var Sf={};function oO(e){const t=this.attrs.fillRule;t?e.fill(t):e.fill()}function iO(e){e.stroke()}function sO(e){const t=this.attrs.fillRule;t?e.fill(t):e.fill()}function aO(e){e.stroke()}function lO(){this._clearCache(W_)}function cO(){this._clearCache(K_)}function uO(){this._clearCache(q_)}function dO(){this._clearCache(Y_)}function fO(){this._clearCache(X_)}var pt=class extends St{constructor(e){super(e);let t,n=0;for(;t=Ee.getHitColor(),!(t&&!(t in Sf));)if(n++,n>=1e4){Ee.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=Ee.getRandomColor();break}this.colorKey=t,Sf[t]=this}getContext(){return Ee.warn("shape.getContext() method is deprecated. Please do not use it."),this.getLayer().getContext()}getCanvas(){return Ee.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(W_,this._hasShadow)}_hasShadow(){return this.shadowEnabled()&&this.shadowOpacity()!==0&&!!(this.shadowColor()||this.shadowBlur()||this.shadowOffsetX()||this.shadowOffsetY())}_getFillPattern(){return this._getCache(q_,this.__getFillPattern)}__getFillPattern(){if(this.fillPatternImage()){const e=M0().createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(e&&e.setTransform){const t=new es;t.translate(this.fillPatternX(),this.fillPatternY()),t.rotate(Ct.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(Y_,this.__getLinearGradient)}__getLinearGradient(){const e=this.fillLinearGradientColorStops();if(e){const t=M0(),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(X_,this.__getRadialGradient)}__getRadialGradient(){const e=this.fillRadialGradientColorStops();if(e){const t=M0(),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(K_,this._getShadowRGBA)}_getShadowRGBA(){if(!this.hasShadow())return;const e=Ee.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 St.prototype.destroy.call(this),delete Sf[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){Ee.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,c=!e.skipShadow&&this.hasShadow(),d=c?this.shadowOffsetX():0,f=c?this.shadowOffsetY():0,h=a+Math.abs(d),g=l+Math.abs(f),m=c&&this.shadowBlur()||0,v={width:h+m*2,height:g+m*2,x:-(s/2+m)+Math.min(d,0)+i.x,y:-(s/2+m)+Math.min(f,0)+i.y};return r?v:this._transformedRect(v,o)}drawScene(e,t,n){const r=this.getLayer(),o=(e||r.getCanvas()).getContext(),i=this._getCanvasCache(),s=this.getSceneFunc(),a=this.hasShadow();let l;const c=t===this;if(!this.isVisible()&&!c)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 h=this.getAbsoluteTransform(t).getMatrix();f.transform(h[0],h[1],h[2],h[3],h[4],h[5]),s.call(this,f,this),f.restore();const g=d.pixelRatio;a&&o._applyShadow(this),c||(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),!c){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||Ee.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 c=this.getAbsoluteTransform(t).getMatrix();return i.transform(c[0],c[1],c[2],c[3],c[4],c[5]),this._drawCachedHitCanvas(i),i.restore(),this}if(!s)return this;if(i.save(),i._applyLineJoin(this),i._applyMiterLimit(this),this!==t){const c=this.getAbsoluteTransform(t).getMatrix();i.transform(c[0],c[1],c[2],c[3],c[4],c[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,c=l.length,d=Ee._hexToRgb(this.colorKey);for(let f=0;f<c;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){Ee.error("Unable to draw hit graph from cached scene canvas. "+a.message)}return this}hasPointerCapture(e){return M_(e,this)}setPointerCapture(e){P_(e,this)}releaseCapture(e){gf(e,this)}};pt.prototype._fillFunc=oO,pt.prototype._strokeFunc=iO,pt.prototype._fillFuncHit=sO,pt.prototype._strokeFuncHit=aO,pt.prototype._centroid=!1,pt.prototype.nodeType="Shape",wr(pt),pt.prototype.eventListeners={},pt.prototype.on("shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",lO),pt.prototype.on("shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",cO),pt.prototype.on("fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",uO),pt.prototype.on("fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",dO),pt.prototype.on("fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",fO),ce.addGetterSetter(pt,"stroke",void 0,A_()),ce.addGetterSetter(pt,"strokeWidth",2,yt()),ce.addGetterSetter(pt,"fillAfterStrokeEnabled",!1),ce.addGetterSetter(pt,"hitStrokeWidth","auto",_0()),ce.addGetterSetter(pt,"strokeHitEnabled",!0,ts()),ce.addGetterSetter(pt,"perfectDrawEnabled",!0,ts()),ce.addGetterSetter(pt,"shadowForStrokeEnabled",!0,ts()),ce.addGetterSetter(pt,"lineJoin"),ce.addGetterSetter(pt,"lineCap"),ce.addGetterSetter(pt,"miterLimit"),ce.addGetterSetter(pt,"sceneFunc"),ce.addGetterSetter(pt,"hitFunc"),ce.addGetterSetter(pt,"dash"),ce.addGetterSetter(pt,"dashOffset",0,yt()),ce.addGetterSetter(pt,"shadowColor",void 0,nc()),ce.addGetterSetter(pt,"shadowBlur",0,yt()),ce.addGetterSetter(pt,"shadowOpacity",1,yt()),ce.addComponentsGetterSetter(pt,"shadowOffset",["x","y"]),ce.addGetterSetter(pt,"shadowOffsetX",0,yt()),ce.addGetterSetter(pt,"shadowOffsetY",0,yt()),ce.addGetterSetter(pt,"fillPatternImage"),ce.addGetterSetter(pt,"fill",void 0,A_()),ce.addGetterSetter(pt,"fillPatternX",0,yt()),ce.addGetterSetter(pt,"fillPatternY",0,yt()),ce.addGetterSetter(pt,"fillLinearGradientColorStops"),ce.addGetterSetter(pt,"strokeLinearGradientColorStops"),ce.addGetterSetter(pt,"fillRadialGradientStartRadius",0),ce.addGetterSetter(pt,"fillRadialGradientEndRadius",0),ce.addGetterSetter(pt,"fillRadialGradientColorStops"),ce.addGetterSetter(pt,"fillPatternRepeat","repeat"),ce.addGetterSetter(pt,"fillEnabled",!0),ce.addGetterSetter(pt,"strokeEnabled",!0),ce.addGetterSetter(pt,"shadowEnabled",!0),ce.addGetterSetter(pt,"dashEnabled",!0),ce.addGetterSetter(pt,"strokeScaleEnabled",!0),ce.addGetterSetter(pt,"fillPriority","color"),ce.addComponentsGetterSetter(pt,"fillPatternOffset",["x","y"]),ce.addGetterSetter(pt,"fillPatternOffsetX",0,yt()),ce.addGetterSetter(pt,"fillPatternOffsetY",0,yt()),ce.addComponentsGetterSetter(pt,"fillPatternScale",["x","y"]),ce.addGetterSetter(pt,"fillPatternScaleX",1,yt()),ce.addGetterSetter(pt,"fillPatternScaleY",1,yt()),ce.addComponentsGetterSetter(pt,"fillLinearGradientStartPoint",["x","y"]),ce.addComponentsGetterSetter(pt,"strokeLinearGradientStartPoint",["x","y"]),ce.addGetterSetter(pt,"fillLinearGradientStartPointX",0),ce.addGetterSetter(pt,"strokeLinearGradientStartPointX",0),ce.addGetterSetter(pt,"fillLinearGradientStartPointY",0),ce.addGetterSetter(pt,"strokeLinearGradientStartPointY",0),ce.addComponentsGetterSetter(pt,"fillLinearGradientEndPoint",["x","y"]),ce.addComponentsGetterSetter(pt,"strokeLinearGradientEndPoint",["x","y"]),ce.addGetterSetter(pt,"fillLinearGradientEndPointX",0),ce.addGetterSetter(pt,"strokeLinearGradientEndPointX",0),ce.addGetterSetter(pt,"fillLinearGradientEndPointY",0),ce.addGetterSetter(pt,"strokeLinearGradientEndPointY",0),ce.addComponentsGetterSetter(pt,"fillRadialGradientStartPoint",["x","y"]),ce.addGetterSetter(pt,"fillRadialGradientStartPointX",0),ce.addGetterSetter(pt,"fillRadialGradientStartPointY",0),ce.addComponentsGetterSetter(pt,"fillRadialGradientEndPoint",["x","y"]),ce.addGetterSetter(pt,"fillRadialGradientEndPointX",0),ce.addGetterSetter(pt,"fillRadialGradientEndPointY",0),ce.addGetterSetter(pt,"fillPatternRotation",0),ce.addGetterSetter(pt,"fillRule",void 0,nc()),ce.backCompat(pt,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"});var hO="beforeDraw",pO="draw",Z_=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],mO=Z_.length,oc=class extends bi{constructor(e){super(e),this.canvas=new il,this.hitCanvas=new S0({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(){St.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(!St.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(St.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(St.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 St.prototype.remove.call(this),e&&e.parentNode&&Ee._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"&&Ee.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(),St.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(){Ee.warn('Can not change width of layer. Use "stage.width(value)" function instead.')}getHeight(){if(this.parent)return this.parent.height()}setHeight(){Ee.warn('Can not change height of layer. Use "stage.height(value)" function instead.')}batchDraw(){return this._waitingForDraw||(this._waitingForDraw=!0,Ee.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<mO;r++){const o=Z_[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=Ee.getHitColorKey(n[0],n[1],n[2]),i=Sf[o];return i?{shape:i}:{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(hO,{node:this}),this.clearBeforeDraw()&&o.getContext().clear(),bi.prototype.drawScene.call(this,o,t,n),this._fire(pO,{node:this}),this}drawHit(e,t){const n=this.getLayer(),r=e||n&&n.hitCanvas;return n&&n.clearBeforeDraw()&&n.getHitCanvas().getContext().clear(),bi.prototype.drawHit.call(this,r,t),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(e){Ee.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening(e)}getHitGraphEnabled(e){return Ee.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 Ee.releaseCanvas(this.getNativeCanvasElement(),this.getHitCanvas()._canvas),super.destroy()}};oc.prototype.nodeType="Layer",wr(oc),ce.addGetterSetter(oc,"imageSmoothingEnabled",!0),ce.addGetterSetter(oc,"clearBeforeDraw",!0),ce.addGetterSetter(oc,"hitGraphEnabled",!0,ts());var P0=class extends oc{constructor(e){super(e),this.listening(!1),Ee.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.')}};P0.prototype.nodeType="FastLayer",wr(P0);var vu=class extends bi{_validateAdd(e){const t=e.getType();t!=="Group"&&t!=="Shape"&&Ee.throw("You may only add groups and shapes to groups.")}};vu.prototype.nodeType="Group",wr(vu);var D0=(function(){return tc.performance&&tc.performance.now?function(){return tc.performance.now()}:function(){return new Date().getTime()}})(),yu=class Qu{constructor(t,n){this.id=Qu.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:D0(),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=Qu.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=D0(),Qu._addAnimation(this),this}stop(){return Qu._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(D0());const a=i.length;let l;if(s?l=s.call(o,o.frame)!==!1:l=!0,!!l)for(let c=0;c<a;c++){const d=i[c];d._id!==void 0&&(t[d._id]=d)}}for(const r in t)t.hasOwnProperty(r)&&t[r].batchDraw()}static _animationLoop(){const t=Qu;t.animations.length?(t._runFrames(),Ee.requestAnimFrame(t._animationLoop)):t.animRunning=!1}static _handleAnimation(){this.animRunning||(this.animRunning=!0,Ee.requestAnimFrame(this._animationLoop))}};yu.animations=[],yu.animIdCounter=0,yu.animRunning=!1;var gO={node:1,duration:1,easing:1,onFinish:1,yoyo:1},vO=1,Q_=2,J_=3,e4=["fill","stroke","shadowColor"],yO=0,bO=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=Q_,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")}reverse(){this.state=J_,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===Q_?this.setTime(e):this.state===J_&&this.setTime(this.duration-e)}pause(){this.state=vO,this.fire("onPause")}getTimer(){return new Date().getTime()}},Xp=class Dr{constructor(t){const n=this,r=t.node,o=r._id,i=t.easing||_f.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=yO++;const c=r.getLayer()||(r instanceof Ct.Stage?r.getLayers():null);c||Ee.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."),this.anim=new yu(function(){n.tween.onEnterFrame()},c),this.tween=new bO(l,function(d){n._tweenFunc(d)},i,0,1,a*1e3,s),this._addListeners(),Dr.attrs[o]||(Dr.attrs[o]={}),Dr.attrs[o][this._id]||(Dr.attrs[o][this._id]={}),Dr.tweens[o]||(Dr.tweens[o]={});for(l in t)gO[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,c;const d=Dr.tweens[o][t];d&&delete Dr.attrs[o][d][t];let f=r.getAttr(t);if(Ee._isArray(n))if(i=[],s=Math.max(n.length,f.length),t==="points"&&n.length!==f.length&&(n.length>f.length?(l=f,f=Ee._prepareArrayForTween(f,n,r.closed())):(a=n,n=Ee._prepareArrayForTween(n,f,r.closed()))),t.indexOf("fill")===0)for(let h=0;h<s;h++)if(h%2===0)i.push(n[h]-f[h]);else{const g=Ee.colorToRGBA(f[h]);c=Ee.colorToRGBA(n[h]),f[h]=g,i.push({r:c.r-g.r,g:c.g-g.g,b:c.b-g.b,a:c.a-g.a})}else for(let h=0;h<s;h++)i.push(n[h]-f[h]);else e4.indexOf(t)!==-1?(f=Ee.colorToRGBA(f),c=Ee.colorToRGBA(n),i={r:c.r-f.r,g:c.g-f.g,b:c.b-f.b,a:c.a-f.a}):i=n-f;Dr.attrs[o][this._id][t]={start:f,diff:i,end:n,trueEnd:a,trueStart:l},Dr.tweens[o][t]=this._id}_tweenFunc(t){const n=this.node,r=Dr.attrs[n._id][this._id];let o,i,s,a,l,c,d,f;for(o in r){if(i=r[o],s=i.start,a=i.diff,f=i.end,Ee._isArray(s))if(l=[],d=Math.max(s.length,f.length),o.indexOf("fill")===0)for(c=0;c<d;c++)c%2===0?l.push((s[c]||0)+a[c]*t):l.push("rgba("+Math.round(s[c].r+a[c].r*t)+","+Math.round(s[c].g+a[c].g*t)+","+Math.round(s[c].b+a[c].b*t)+","+(s[c].a+a[c].a*t)+")");else for(c=0;c<d;c++)l.push((s[c]||0)+a[c]*t);else e4.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=Dr.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=Dr.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=Dr.tweens[t];this.pause(),this.anim&&this.anim.stop();for(const o in r)delete Dr.tweens[t][o];delete Dr.attrs[t][n],Dr.tweens[t]&&(Object.keys(Dr.tweens[t]).length===0&&delete Dr.tweens[t],Object.keys(Dr.attrs[t]).length===0&&delete Dr.attrs[t])}};Xp.attrs={},Xp.tweens={},St.prototype.to=function(e){const t=e.onFinish;e.node=this,e.onFinish=function(){this.destroy(),t&&t()},new Xp(e).play()};var _f={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-_f.BounceEaseOut(r-e,0,n,r)+t},BounceEaseInOut(e,t,n,r){return e<r/2?_f.BounceEaseIn(e*2,0,n,r)*.5+t:_f.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}},t4=Ee._assign(Ct,{Util:Ee,Transform:es,Node:St,Container:bi,Stage:qp,stages:kf,Layer:oc,FastLayer:P0,Group:vu,DD:Dn,Shape:pt,shapes:Sf,Animation:yu,Tween:Xp,Easings:_f,Context:Vp,Canvas:k0}),ba=class extends pt{_sceneFunc(e){const t=Ct.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=Ct.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),c=i*t,d=s*(s>0?e:t),f=a*(a>0?t:e);return{x:l,y:n?-1*f:d,width:c-l,height:f-d}}};ba.prototype._centroid=!0,ba.prototype.className="Arc",ba.prototype._attrsAffectingSize=["innerRadius","outerRadius","angle","clockwise"],wr(ba),ce.addGetterSetter(ba,"innerRadius",0,yt()),ce.addGetterSetter(ba,"outerRadius",0,yt()),ce.addGetterSetter(ba,"angle",0,yt()),ce.addGetterSetter(ba,"clockwise",!1,ts());function O0(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)),c=s*a/(a+l),d=s*l/(a+l);return[n-c*(o-e),r-c*(i-t),n+d*(o-e),r+d*(i-t)]}function n4(e,t){const n=e.length,r=[];for(let o=2;o<n-2;o+=2){const i=O0(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 wO(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 wa=class extends pt{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():n4(this.points(),this.tension())}_getTensionPointsClosed(){const e=this.points(),t=e.length,n=this.tension(),r=O0(e[t-2],e[t-1],e[0],e[1],e[2],e[3],n),o=O0(e[t-4],e[t-3],e[t-2],e[t-1],e[0],e[1],n),i=n4(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],...wO(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}}};wa.prototype.className="Line",wa.prototype._attrsAffectingSize=["points","bezier","tension"],wr(wa),ce.addGetterSetter(wa,"closed",!1),ce.addGetterSetter(wa,"bezier",!1),ce.addGetterSetter(wa,"tension",0,yt()),ce.addGetterSetter(wa,"points",[],FD());var CO=[[],[],[-.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]],kO=[[],[],[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]],SO=[[1],[1,1],[1,2,1],[1,3,3,1]],r4=(e,t,n)=>{let r,o;const s=n/2;r=0;for(let a=0;a<20;a++)o=s*CO[20][a]+s,r+=kO[20][a]*_O(e,t,o);return s*r},o4=(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),c=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=c/a,h=n+d,g=f-d*d,m=h*h+g>0?Math.sqrt(h*h+g):0,v=d*d+g>0?Math.sqrt(d*d+g):0,k=d+Math.sqrt(d*d+g)!==0?g*Math.log(Math.abs((h+m)/(d+v))):0;return Math.sqrt(a)/2*(h*m-d*v+k)};function _O(e,t,n){const r=F0(1,n,e),o=F0(1,n,t),i=r*r+o*o;return Math.sqrt(i)}var F0=(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+=SO[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 F0(e-1,t,o)}},i4=(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 c=n(o-i),d=Math.abs(e-c)/t;d<r?(r=d,o-=i):i/=2}if(s++,s>500)break}return o},Pi=class hi extends pt{constructor(t){super(t),this.dataArray=[],this.pathLength=0,this._readDataAttribute(),this.on("dataChange.konva",function(){this._readDataAttribute()})}_readDataAttribute(){this.dataArray=hi.parsePathData(this.data()),this.pathLength=hi.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],c=s[2],d=s[3],f=s[4],h=s[5],g=s[6],m=s[7],v=c>d?c:d,k=c>d?1:c/d,C=c>d?d/c:1;t.translate(a,l),t.rotate(g),t.scale(k,C),t.arc(0,0,v,f,f+h,1-m),t.scale(1/k,1/C),t.rotate(-g),t.translate(-a,-l);break;case"z":r=!0,t.closePath()}}!r&&!this.hasFill()?t.strokeShape(this):t.fillStrokeShape(this)}getSelfRect(){let t=[];this.dataArray.forEach(function(l){if(l.command==="A"){const c=l.points[4],d=l.points[5],f=l.points[4]+d;let h=Math.PI/180;if(Math.abs(c-f)<h&&(h=Math.abs(c-f)),d<0)for(let g=c-h;g>f;g-=h){const m=hi.getPointOnEllipticalArc(l.points[0],l.points[1],l.points[2],l.points[3],g,0);t.push(m.x,m.y)}else for(let g=c+h;g<f;g+=h){const m=hi.getPointOnEllipticalArc(l.points[0],l.points[1],l.points[2],l.points[3],g,0);t.push(m.x,m.y)}}else if(l.command==="C")for(let c=0;c<=1;c+=.01){const d=hi.getPointOnCubicBezier(c,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 hi.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 hi.getPointOnLine(t,s.start.x,s.start.y,a[0],a[1]);case"C":return hi.getPointOnCubicBezier(i4(t,hi.getPathLength(n),v=>r4([s.start.x,a[0],a[2],a[4]],[s.start.y,a[1],a[3],a[5]],v)),s.start.x,s.start.y,a[0],a[1],a[2],a[3],a[4],a[5]);case"Q":return hi.getPointOnQuadraticBezier(i4(t,hi.getPathLength(n),v=>o4([s.start.x,a[0],a[2]],[s.start.y,a[1],a[3]],v)),s.start.x,s.start.y,a[0],a[1],a[2],a[3]);case"A":const l=a[0],c=a[1],d=a[2],f=a[3],h=a[5],g=a[6];let m=a[4];return m+=h*t/s.pathLength,hi.getPointOnEllipticalArc(l,c,d,f,m,g)}return null}static getPointOnLine(t,n,r,o,i,s,a){s=s??n,a=a??r;const l=this.getLineLength(n,r,o,i);if(l<1e-10)return{x:n,y:r};if(o===n)return{x:s,y:a+(i>r?t:-t)};const c=(i-r)/(o-n),d=Math.sqrt(t*t/(1+c*c))*(o<n?-1:1),f=c*d;if(Math.abs(a-r-c*(s-n))<1e-10)return{x:s+d,y:a+f};const h=((s-n)*(o-n)+(a-r)*(i-r))/(l*l),g=n+h*(o-n),m=r+h*(i-r),v=this.getLineLength(s,a,g,m),k=Math.sqrt(t*t-v*v),C=Math.sqrt(k*k/(1+c*c))*(o<n?-1:1),_=c*C;return{x:g+C,y:m+_}}static getPointOnCubicBezier(t,n,r,o,i,s,a,l,c){function d(m){return m*m*m}function f(m){return 3*m*m*(1-m)}function h(m){return 3*m*(1-m)*(1-m)}function g(m){return(1-m)*(1-m)*(1-m)}return{x:l*d(t)+s*f(t)+o*h(t)+n*g(t),y:c*d(t)+a*f(t)+i*h(t)+r*g(t)}}static getPointOnQuadraticBezier(t,n,r,o,i,s,a){function l(f){return f*f}function c(f){return 2*f*(1-f)}function d(f){return(1-f)*(1-f)}return{x:s*l(t)+o*c(t)+n*d(t),y:a*l(t)+i*c(t)+r*d(t)}}static getPointOnEllipticalArc(t,n,r,o,i,s){const a=Math.cos(s),l=Math.sin(s),c={x:r*Math.cos(i),y:o*Math.sin(i)};return{x:t+(c.x*a-c.y*l),y:n+(c.x*l+c.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 c=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:e[-+]?\d+)?)/gi;let d;for(let f=1;f<o.length;f++){let h=o[f],g=h.charAt(0);for(h=h.slice(1),s.length=0;d=c.exec(h);)s.push(d[0]);let m=[],v=g==="A"||g==="a"?0:-1;for(let k=0,C=s.length;k<C;k++){const _=s[k];if(_==="00"){m.push(0,0),v>=0&&(v+=2,v>=7&&(v-=7));continue}if(v>=0){if(v===3){if(/^[01]{2}\d+(?:\.\d+)?$/.test(_)){m.push(parseInt(_[0],10)),m.push(parseInt(_[1],10)),m.push(parseFloat(_.slice(2))),v+=3,v>=7&&(v-=7);continue}if(_==="11"||_==="10"||_==="01"){m.push(parseInt(_[0],10)),m.push(parseInt(_[1],10)),v+=2,v>=7&&(v-=7);continue}if(_==="0"||_==="1"){m.push(parseInt(_,10)),v+=1,v>=7&&(v-=7);continue}}else if(v===4){if(/^[01]\d+(?:\.\d+)?$/.test(_)){m.push(parseInt(_[0],10)),m.push(parseFloat(_.slice(1))),v+=2,v>=7&&(v-=7);continue}if(_==="0"||_==="1"){m.push(parseInt(_,10)),v+=1,v>=7&&(v-=7);continue}}const b=parseFloat(_);isNaN(b)?m.push(0):m.push(b),v+=1,v>=7&&(v-=7)}else{const b=parseFloat(_);isNaN(b)?m.push(0):m.push(b)}}for(;m.length>0&&!isNaN(m[0]);){let k="",C=[];const _=a,b=l;let w,T,L,N,H,M,V,q,D,B;switch(g){case"l":a+=m.shift(),l+=m.shift(),k="L",C.push(a,l);break;case"L":a=m.shift(),l=m.shift(),C.push(a,l);break;case"m":const E=m.shift(),j=m.shift();if(a+=E,l+=j,k="M",i.length>2&&i[i.length-1].command==="z"){for(let J=i.length-2;J>=0;J--)if(i[J].command==="M"){a=i[J].points[0]+E,l=i[J].points[1]+j;break}}C.push(a,l),g="l";break;case"M":a=m.shift(),l=m.shift(),k="M",C.push(a,l),g="L";break;case"h":a+=m.shift(),k="L",C.push(a,l);break;case"H":a=m.shift(),k="L",C.push(a,l);break;case"v":l+=m.shift(),k="L",C.push(a,l);break;case"V":l=m.shift(),k="L",C.push(a,l);break;case"C":C.push(m.shift(),m.shift(),m.shift(),m.shift()),a=m.shift(),l=m.shift(),C.push(a,l);break;case"c":C.push(a+m.shift(),l+m.shift(),a+m.shift(),l+m.shift()),a+=m.shift(),l+=m.shift(),k="C",C.push(a,l);break;case"S":T=a,L=l,w=i[i.length-1],w.command==="C"&&(T=a+(a-w.points[2]),L=l+(l-w.points[3])),C.push(T,L,m.shift(),m.shift()),a=m.shift(),l=m.shift(),k="C",C.push(a,l);break;case"s":T=a,L=l,w=i[i.length-1],w.command==="C"&&(T=a+(a-w.points[2]),L=l+(l-w.points[3])),C.push(T,L,a+m.shift(),l+m.shift()),a+=m.shift(),l+=m.shift(),k="C",C.push(a,l);break;case"Q":C.push(m.shift(),m.shift()),a=m.shift(),l=m.shift(),C.push(a,l);break;case"q":C.push(a+m.shift(),l+m.shift()),a+=m.shift(),l+=m.shift(),k="Q",C.push(a,l);break;case"T":T=a,L=l,w=i[i.length-1],w.command==="Q"&&(T=a+(a-w.points[0]),L=l+(l-w.points[1])),a=m.shift(),l=m.shift(),k="Q",C.push(T,L,a,l);break;case"t":T=a,L=l,w=i[i.length-1],w.command==="Q"&&(T=a+(a-w.points[0]),L=l+(l-w.points[1])),a+=m.shift(),l+=m.shift(),k="Q",C.push(T,L,a,l);break;case"A":N=m.shift(),H=m.shift(),M=m.shift(),V=m.shift(),q=m.shift(),D=a,B=l,a=m.shift(),l=m.shift(),k="A",C=this.convertEndpointToCenterParameterization(D,B,a,l,V,q,N,H,M);break;case"a":N=m.shift(),H=m.shift(),M=m.shift(),V=m.shift(),q=m.shift(),D=a,B=l,a+=m.shift(),l+=m.shift(),k="A",C=this.convertEndpointToCenterParameterization(D,B,a,l,V,q,N,H,M)}i.push({command:k||g,points:C,start:{x:_,y:b},pathLength:this.calcLength(_,b,k||g,C)})}(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 c=hi;switch(r){case"L":return c.getLineLength(t,n,o[0],o[1]);case"C":return r4([t,o[0],o[2],o[4]],[n,o[1],o[3],o[5]],1);case"Q":return o4([t,o[0],o[2]],[n,o[1],o[3]],1);case"A":i=0;const d=o[4],f=o[5],h=o[4]+f;let g=Math.PI/180;if(Math.abs(d-h)<g&&(g=Math.abs(d-h)),s=c.getPointOnEllipticalArc(o[0],o[1],o[2],o[3],d,0),f<0)for(l=d-g;l>h;l-=g)a=c.getPointOnEllipticalArc(o[0],o[1],o[2],o[3],l,0),i+=c.getLineLength(s.x,s.y,a.x,a.y),s=a;else for(l=d+g;l<h;l+=g)a=c.getPointOnEllipticalArc(o[0],o[1],o[2],o[3],l,0),i+=c.getLineLength(s.x,s.y,a.x,a.y),s=a;return a=c.getPointOnEllipticalArc(o[0],o[1],o[2],o[3],h,0),i+=c.getLineLength(s.x,s.y,a.x,a.y),i}return 0}static convertEndpointToCenterParameterization(t,n,r,o,i,s,a,l,c){const d=c*(Math.PI/180),f=Math.cos(d)*(t-r)/2+Math.sin(d)*(n-o)/2,h=-1*Math.sin(d)*(t-r)/2+Math.cos(d)*(n-o)/2,g=f*f/(a*a)+h*h/(l*l);g>1&&(a*=Math.sqrt(g),l*=Math.sqrt(g));let m=Math.sqrt((a*a*(l*l)-a*a*(h*h)-l*l*(f*f))/(a*a*(h*h)+l*l*(f*f)));i===s&&(m*=-1),isNaN(m)&&(m=0);const v=m*a*h/l,k=m*-l*f/a,C=(t+r)/2+Math.cos(d)*v-Math.sin(d)*k,_=(n+o)/2+Math.sin(d)*v+Math.cos(d)*k,b=function(V){return Math.sqrt(V[0]*V[0]+V[1]*V[1])},w=function(V,q){return(V[0]*q[0]+V[1]*q[1])/(b(V)*b(q))},T=function(V,q){return(V[0]*q[1]<V[1]*q[0]?-1:1)*Math.acos(w(V,q))},L=T([1,0],[(f-v)/a,(h-k)/l]),N=[(f-v)/a,(h-k)/l],H=[(-1*f-v)/a,(-1*h-k)/l];let M=T(N,H);return w(N,H)<=-1&&(M=Math.PI),w(N,H)>=1&&(M=0),s===0&&M>0&&(M=M-2*Math.PI),s===1&&M<0&&(M=M+2*Math.PI),[C,_,a,l,L,M,d,s]}};Pi.prototype.className="Path",Pi.prototype._attrsAffectingSize=["data"],wr(Pi),ce.addGetterSetter(Pi,"data");var ic=class extends wa{_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]],h=Pi.calcLength(r[r.length-4],r[r.length-3],"C",f),g=Pi.getPointOnQuadraticBezier(Math.min(1,1-i/h),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 c=(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(c),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}}};ic.prototype.className="Arrow",wr(ic),ce.addGetterSetter(ic,"pointerLength",10,yt()),ce.addGetterSetter(ic,"pointerWidth",10,yt()),ce.addGetterSetter(ic,"pointerAtBeginning",!1),ce.addGetterSetter(ic,"pointerAtEnding",!0);var bu=class extends pt{_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)}};bu.prototype._centroid=!0,bu.prototype.className="Circle",bu.prototype._attrsAffectingSize=["radius"],wr(bu),ce.addGetterSetter(bu,"radius",0,yt());var ll=class extends pt{_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)}};ll.prototype.className="Ellipse",ll.prototype._centroid=!0,ll.prototype._attrsAffectingSize=["radiusX","radiusY"],wr(ll),ce.addComponentsGetterSetter(ll,"radius",["x","y"]),ce.addGetterSetter(ll,"radiusX",0,yt()),ce.addGetterSetter(ll,"radiusY",0,yt());var ns=class aI extends pt{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?Ee.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?Ee.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=Ee.createImageElement();o.onload=function(){n(new aI({image:o}))},o.onerror=r,o.crossOrigin="Anonymous",o.src=t}};ns.prototype.className="Image",ns.prototype._attrsAffectingSize=["image"],wr(ns),ce.addGetterSetter(ns,"cornerRadius",0,Up(4)),ce.addGetterSetter(ns,"image"),ce.addComponentsGetterSetter(ns,"crop",["x","y","width","height"]),ce.addGetterSetter(ns,"cropX",0,yt()),ce.addGetterSetter(ns,"cropY",0,yt()),ce.addGetterSetter(ns,"cropWidth",0,yt()),ce.addGetterSetter(ns,"cropHeight",0,yt());var s4=["fontFamily","fontSize","fontStyle","padding","lineHeight","text","width","height","pointerDirection","pointerWidth","pointerHeight"],AO="Change.konva",IO="none",N0="up",B0="right",z0="down",V0="left",xO=s4.length,j0=class extends vu{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<xO;n++)e.on(s4[n]+AO,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 N0:s=n/2,a=-1*l;break;case B0:s=n+i,a=r/2;break;case z0:s=n/2,a=r+l;break;case V0:s=-1*i,a=r/2}t.setAttrs({x:-1*s,y:-1*a,width:n,height:r}),e.setAttrs({x:-1*s,y:-1*a})}}};j0.prototype.className="Label",wr(j0);var sc=class extends pt{_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,c=0,d=0;typeof s=="number"?a=l=c=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),c=Math.min(s[3]||0,t/2,n/2)),e.beginPath(),e.moveTo(a,0),r===N0&&(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===B0&&(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===z0&&(e.lineTo((t+o)/2,n),e.lineTo(t/2,n+i),e.lineTo((t-o)/2,n)),e.lineTo(c,n),e.arc(c,n-c,c,Math.PI/2,Math.PI,!1),r===V0&&(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===N0?(t-=r,s+=r):o===z0?s+=r:o===V0?(e-=n*1.5,i+=n):o===B0&&(i+=n*1.5),{x:e,y:t,width:i,height:s}}};sc.prototype.className="Tag",wr(sc),ce.addGetterSetter(sc,"pointerDirection",IO),ce.addGetterSetter(sc,"pointerWidth",0,yt()),ce.addGetterSetter(sc,"pointerHeight",0,yt()),ce.addGetterSetter(sc,"cornerRadius",0,Up(4));var Af=class extends pt{_sceneFunc(e){const t=this.cornerRadius(),n=this.width(),r=this.height();e.beginPath(),t?Ee.drawRoundedRectPath(e,n,r,t):e.rect(0,0,n,r),e.closePath(),e.fillStrokeShape(this)}};Af.prototype.className="Rect",wr(Af),ce.addGetterSetter(Af,"cornerRadius",0,Up(4));var cl=class extends pt{_sceneFunc(e){const t=this._getPoints(),n=this.radius(),r=this.sides(),o=this.cornerRadius();if(e.beginPath(),o)Ee.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)}};cl.prototype.className="RegularPolygon",cl.prototype._centroid=!0,cl.prototype._attrsAffectingSize=["radius"],wr(cl),ce.addGetterSetter(cl,"radius",0,yt()),ce.addGetterSetter(cl,"sides",0,yt()),ce.addGetterSetter(cl,"cornerRadius",0,Up(4));var a4=Math.PI*2,ac=class extends pt{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.innerRadius(),0,a4,!1),e.moveTo(this.outerRadius(),0),e.arc(0,0,this.outerRadius(),a4,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)}};ac.prototype.className="Ring",ac.prototype._centroid=!0,ac.prototype._attrsAffectingSize=["innerRadius","outerRadius"],wr(ac),ce.addGetterSetter(ac,"innerRadius",0,yt()),ce.addGetterSetter(ac,"outerRadius",0,yt());var Ms=class extends pt{constructor(e){super(e),this._updated=!0,this.anim=new yu(()=>{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],c=o[r+3],d=this.image();if((this.hasFill()||this.hasStroke())&&(e.beginPath(),e.rect(0,0,l,c),e.closePath(),e.fillStrokeShape(this)),d)if(i){const f=i[t],h=n*2;e.drawImage(d,s,a,l,c,f[h+0],f[h+1],l,c)}else e.drawImage(d,s,a,l,c,0,0,l,c)}_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],c=n*2;e.rect(l[c+0],l[c+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)}};Ms.prototype.className="Sprite",wr(Ms),ce.addGetterSetter(Ms,"animation"),ce.addGetterSetter(Ms,"animations"),ce.addGetterSetter(Ms,"frameOffsets"),ce.addGetterSetter(Ms,"image"),ce.addGetterSetter(Ms,"frameIndex",0,yt()),ce.addGetterSetter(Ms,"frameRate",17,yt()),ce.backCompat(Ms,{index:"frameIndex",getIndex:"getFrameIndex",setIndex:"setFrameIndex"});var ul=class extends pt{_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)}};ul.prototype.className="Star",ul.prototype._centroid=!0,ul.prototype._attrsAffectingSize=["innerRadius","outerRadius"],wr(ul),ce.addGetterSetter(ul,"numPoints",5,yt()),ce.addGetterSetter(ul,"innerRadius",0,yt()),ce.addGetterSetter(ul,"outerRadius",0,yt());function dl(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 wu="auto",EO="center",l4="inherit",If="justify",TO="Change.konva",c4="2d",u4="-",d4="left",RO="text",LO="Text",MO="top",PO="bottom",f4="middle",h4="normal",DO="px ",Zp=" ",OO="right",p4="rtl",FO="word",NO="char",m4="none",U0="…",g4=["direction","fontFamily","fontSize","fontStyle","fontVariant","padding","align","verticalAlign","lineHeight","text","width","height","wrap","ellipsis","letterSpacing"],BO=g4.length,xf=null;function zO(){if(xf!==null)return xf;xf=!1;try{const e=document.createElement("canvas");e.width=10,e.height=10;const t=e.getContext(c4);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){xf=!0;break}}}catch{}return xf}function VO(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 Qp;function H0(){return Qp||(Qp=Ee.createCanvasElement().getContext(c4),Qp)}function jO(e){e.fillText(this._partialText,this._partialTextX,this._partialTextY)}function UO(e){e.setAttr("miterLimit",2),e.strokeText(this._partialText,this._partialTextX,this._partialTextY)}function HO(e){return e=e||{},!e.fillLinearGradientColorStops&&!e.fillRadialGradientColorStops&&!e.fillPatternImage&&(e.fill=e.fill||"black"),e}var ir=class extends pt{constructor(e){super(HO(e)),this._partialTextX=0,this._partialTextY=0;for(let t=0;t<BO;t++)this.on(g4[t]+TO,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(),c=this.direction(),d=0,f=this.align(),h=this.getWidth(),g=this.letterSpacing(),m=this.charRenderFunc(),v=this.fill(),k=this.textDecoration(),C=this.underlineOffset(),_=k.indexOf("underline")!==-1,b=k.indexOf("line-through")!==-1,w;c=c===l4?e.direction:c;let T=a/2,L=f4;if(!Ct.legacyTextRendering){const N=this.measureSize("M");L="alphabetic",T=(((t=N.fontBoundingBoxAscent)!==null&&t!==void 0?t:N.actualBoundingBoxAscent)-((n=N.fontBoundingBoxDescent)!==null&&n!==void 0?n:N.actualBoundingBoxDescent))/2+a/2}for(c===p4&&e.setAttr("direction",c),e.setAttr("font",this._getContextFont()),e.setAttr("textBaseline",L),e.setAttr("textAlign",d4),l===f4?d=(this.getHeight()-o*a-i*2)/2:l===PO&&(d=this.getHeight()-o*a-i*2),e.translate(i,d+i),w=0;w<o;w++){let N=0,H=0;const M=r[w],V=M.text,q=M.width,D=M.lastInParagraph;if(e.save(),f===OO?N+=h-q-i*2:f===EO&&(N+=(h-q-i*2)/2),_){e.save(),e.beginPath();const E=C??(Ct.legacyTextRendering?Math.round(s/2):Math.round(s/4)),j=N,J=T+H+E;e.moveTo(j,J);const Y=f===If&&!D?h-i*2:q;e.lineTo(j+Math.round(Y),J),e.lineWidth=s/15,e.strokeStyle=this._getLinearGradient()||v,e.stroke(),e.restore()}const B=N;if(c!==p4&&(g!==0||f===If||m)){const E=V.split(" ").length-1,j=dl(V);for(let J=0;J<j.length;J++){const Y=j[J];if(Y===" "&&!D&&f===If&&(N+=(h-i*2-q)/E),this._partialTextX=N,this._partialTextY=T+H,this._partialText=Y,m){e.save();const se=r.slice(0,w).reduce((pe,Ve)=>pe+dl(Ve.text).length,0);m({char:Y,index:J+se,x:N,y:T+H,lineIndex:w,column:J,isLastInLine:D,width:this.measureSize(Y).width,context:e})}e.fillStrokeShape(this),m&&e.restore(),N+=this.measureSize(Y).width+g}}else g!==0&&e.setAttr("letterSpacing",`${g}px`),this._partialTextX=N,this._partialTextY=T+H,this._partialText=V,e.fillStrokeShape(this);if(b){e.save(),e.beginPath();const E=Ct.legacyTextRendering?0:-Math.round(s/4),j=B;e.moveTo(j,T+H+E);const J=f===If&&!D?h-i*2:q;e.lineTo(j+Math.round(J),T+H+E),e.lineWidth=s/15,e.strokeStyle=this._getLinearGradient()||v,e.stroke(),e.restore()}e.restore(),o>1&&(T+=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=Ee._isString(e)?e:e==null?"":e+"";return this._setAttr(RO,t),this}getWidth(){return this.attrs.width===wu||this.attrs.width===void 0?this.getTextWidth()+this.padding()*2:this.attrs.width}getHeight(){return this.attrs.height===wu||this.attrs.height===void 0?this.fontSize()*this.textArr.length*this.lineHeight()+this.padding()*2:this.attrs.height}getTextWidth(){return this.textWidth}getTextHeight(){return Ee.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,c,d,f;let h=H0(),g=this.fontSize(),m;h.save(),h.font=this._getContextFont(),m=h.measureText(e),h.restore();const v=g/100;return{actualBoundingBoxAscent:(t=m.actualBoundingBoxAscent)!==null&&t!==void 0?t:71.58203125*v,actualBoundingBoxDescent:(n=m.actualBoundingBoxDescent)!==null&&n!==void 0?n:0,actualBoundingBoxLeft:(r=m.actualBoundingBoxLeft)!==null&&r!==void 0?r:-7.421875*v,actualBoundingBoxRight:(o=m.actualBoundingBoxRight)!==null&&o!==void 0?o:75.732421875*v,alphabeticBaseline:(i=m.alphabeticBaseline)!==null&&i!==void 0?i:0,emHeightAscent:(s=m.emHeightAscent)!==null&&s!==void 0?s:100*v,emHeightDescent:(a=m.emHeightDescent)!==null&&a!==void 0?a:-20*v,fontBoundingBoxAscent:(l=m.fontBoundingBoxAscent)!==null&&l!==void 0?l:91*v,fontBoundingBoxDescent:(c=m.fontBoundingBoxDescent)!==null&&c!==void 0?c:21*v,hangingBaseline:(d=m.hangingBaseline)!==null&&d!==void 0?d:72.80000305175781*v,ideographicBaseline:(f=m.ideographicBaseline)!==null&&f!==void 0?f:-21*v,width:m.width,height:g}}_getContextFont(){return this.fontStyle()+Zp+this.fontVariant()+Zp+(this.fontSize()+DO)+VO(this.fontFamily())}_addTextLine(e){this.align()===If&&(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 H0().measureText(e).width+t*n}_setTextData(){let e=this.text().split(`
|
|
100
100
|
`),t=+this.fontSize(),n=0,r=this.lineHeight()*t,o=this.attrs.width,i=this.attrs.height,s=o!==wu&&o!==void 0,a=i!==wu&&i!==void 0,l=this.padding(),c=o-l*2,d=i-l*2,f=0,h=this.wrap(),g=h!==NO&&h!==m4,m=this.ellipsis();this.textArr=[],H0().font=this._getContextFont();const v=m?this._getTextWidth(U0):0;for(let k=0,C=e.length;k<C;++k){let _=e[k],b=this._getTextWidth(_);if(s&&b>c)for(;_.length>0;){let w=0,T=dl(_).length,L="",N=0;for(;w<T;){const H=w+T>>>1,M=dl(_).slice(0,H+1).join(""),V=this._getTextWidth(M);(m&&a&&f+r>d?V+v:V)<=c?(w=H+1,L=M,N=V):T=H}if(L){if(g){const H=dl(_),M=dl(L),V=H[M.length],q=V===Zp||V===u4;let D;if(q&&N<=c)D=M.length;else{const B=M.lastIndexOf(Zp),E=M.lastIndexOf(u4);D=Math.max(B,E)+1}D>0&&(w=D,L=H.slice(0,w).join(""),N=this._getTextWidth(L))}if(L=L.trimRight(),this._addTextLine(L),n=Math.max(n,N),f+=r,this._shouldHandleEllipsis(f)){this._tryToAddEllipsisToLastLine();break}if(_=dl(_).slice(w).join("").trimLeft(),_.length>0&&(b=this._getTextWidth(_),b<=c)){this._addTextLine(_),f+=r,n=Math.max(n,b);break}}else break}else this._addTextLine(_),f+=r,n=Math.max(n,b),this._shouldHandleEllipsis(f)&&k<C-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!==wu&&r!==void 0,i=r-this.padding()*2;return this.wrap()===m4||o&&e+n>i}_tryToAddEllipsisToLastLine(){const e=this.attrs.width,t=e!==wu&&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+U0)<n||(o.text=o.text.slice(0,o.text.length-3))),this.textArr.splice(this.textArr.length-1,1),this._addTextLine(o.text+U0))}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&&zO()?!0:super._useBufferCanvas()}};ir.prototype._fillFunc=jO,ir.prototype._strokeFunc=UO,ir.prototype.className=LO,ir.prototype._attrsAffectingSize=["text","fontSize","padding","wrap","lineHeight","letterSpacing"],wr(ir),ce.overWriteSetter(ir,"width",_0()),ce.overWriteSetter(ir,"height",_0()),ce.addGetterSetter(ir,"direction",l4),ce.addGetterSetter(ir,"fontFamily","Arial"),ce.addGetterSetter(ir,"fontSize",12,yt()),ce.addGetterSetter(ir,"fontStyle",h4),ce.addGetterSetter(ir,"fontVariant",h4),ce.addGetterSetter(ir,"padding",0,yt()),ce.addGetterSetter(ir,"align",d4),ce.addGetterSetter(ir,"verticalAlign",MO),ce.addGetterSetter(ir,"lineHeight",1,yt()),ce.addGetterSetter(ir,"wrap",FO),ce.addGetterSetter(ir,"ellipsis",!1,ts()),ce.addGetterSetter(ir,"letterSpacing",0,yt()),ce.addGetterSetter(ir,"text","",nc()),ce.addGetterSetter(ir,"textDecoration",""),ce.addGetterSetter(ir,"underlineOffset",void 0,yt()),ce.addGetterSetter(ir,"charRenderFunc",void 0);var $O="",v4="normal";function y4(e){e.fillText(this.partialText,0,0)}function b4(e){e.strokeText(this.partialText,0,0)}var ro=class extends pt{constructor(e){super(e),this.dummyCanvas=Ee.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 Pi.getPathLength(this.dataArray)}_getPointAtLength(e){return!this.attrs.data||e>this.pathLength?null:Pi.getPointAtLengthOfDataArray(e,this.dataArray)}_readDataAttribute(){this.dataArray=Pi.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 Ee.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}setText(e){return ir.prototype.setText.call(this,e)}_getContextFont(){return ir.prototype._getContextFont.call(this)}_getTextSize(e){const t=this.dummyCanvas.getContext("2d");t.save(),t.font=this._getContextFont();const n=t.measureText(e);return t.restore(),{width:n.width,height:parseInt(`${this.fontSize()}`,10)}}_setTextData(){const e=dl(this.text()),t=[];let n=0;for(let h=0;h<e.length;h++)t.push({char:e[h],width:this._getTextSize(e[h]).width}),n+=t[h].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),c=Math.max(this.textWidth+((this.attrs.text||"").length-1)*i,0);let d=0;s==="center"&&(d=Math.max(0,this.pathLength/2-c/2)),s==="right"&&(d=Math.max(0,this.pathLength-c));let f=d;for(let h=0;h<t.length;h++){const g=this._getPointAtLength(f);if(!g)return;const m=t[h].char;let v=t[h].width+i;if(m===" "&&s==="justify"){const L=this.text().split(" ").length-1;v+=(this.pathLength-c)/L}const k=f+v,C=this._getPointAtLength(k>this.pathLength&&k-this.pathLength<=l?this.pathLength:k);if(!C)return;const _=Pi.getLineLength(g.x,g.y,C.x,C.y);let b=0;if(a)try{b=a(t[h-1].char,m)*this.fontSize()}catch{b=0}g.x+=b,C.x+=b,this.textWidth+=b;const w=Pi.getPointOnLine(b+_/2,g.x,g.y,C.x,C.y),T=Math.atan2(C.y-g.y,C.x-g.x);this.glyphInfo.push({transposeX:w.x,transposeY:w.y,text:e[h],rotation:T,p0:g,p1:C,width:_}),f+=v}}getSelfRect(){if(!this.glyphInfo.length)return{x:0,y:0,width:0,height:0};const e=[];this.glyphInfo.forEach(function(l){e.push(l.p0.x),e.push(l.p0.y),e.push(l.p1.x),e.push(l.p1.y)});let t=e[0]||0,n=e[0]||0,r=e[1]||0,o=e[1]||0,i,s;for(let l=0;l<e.length/2;l++)i=e[l*2],s=e[l*2+1],t=Math.min(t,i),n=Math.max(n,i),r=Math.min(r,s),o=Math.max(o,s);const a=this.fontSize();return{x:t-a/2,y:r-a/2,width:n-t+a,height:o-r+a}}destroy(){return Ee.releaseCanvas(this.dummyCanvas),super.destroy()}};ro.prototype._fillFunc=y4,ro.prototype._strokeFunc=b4,ro.prototype._fillFuncHit=y4,ro.prototype._strokeFuncHit=b4,ro.prototype.className="TextPath",ro.prototype._attrsAffectingSize=["text","fontSize","data"],wr(ro),ce.addGetterSetter(ro,"data"),ce.addGetterSetter(ro,"fontFamily","Arial"),ce.addGetterSetter(ro,"fontSize",12,yt()),ce.addGetterSetter(ro,"fontStyle",v4),ce.addGetterSetter(ro,"align","left"),ce.addGetterSetter(ro,"letterSpacing",0,yt()),ce.addGetterSetter(ro,"textBaseline","middle"),ce.addGetterSetter(ro,"fontVariant",v4),ce.addGetterSetter(ro,"text",$O),ce.addGetterSetter(ro,"textDecoration",""),ce.addGetterSetter(ro,"kerningFunc",void 0);var w4="tr-konva",GO=["resizeEnabledChange","rotateAnchorOffsetChange","rotateAnchorAngleChange","rotateEnabledChange","enabledAnchorsChange","anchorSizeChange","borderEnabledChange","borderStrokeChange","borderStrokeWidthChange","borderDashChange","anchorStrokeChange","anchorStrokeWidthChange","anchorFillChange","anchorCornerRadiusChange","ignoreStrokeChange","anchorStyleFuncChange"].map(e=>e+`.${w4}`).join(" "),C4="nodesRect",WO=["widthChange","heightChange","scaleXChange","scaleYChange","skewXChange","skewYChange","rotationChange","offsetXChange","offsetYChange","transformsEnabledChange","strokeWidthChange","draggableChange"],KO={"top-left":-45,"top-center":0,"top-right":45,"middle-right":-90,"middle-left":90,"bottom-left":-135,"bottom-center":180,"bottom-right":135},qO="ontouchstart"in Ct._global;function YO(e,t,n){if(e==="rotater")return n;t+=Ee.degToRad(KO[e]||0);const r=(Ee.radToDeg(t)%360+360)%360;return Ee._inRange(r,337.5,360)||Ee._inRange(r,0,22.5)?"ns-resize":Ee._inRange(r,22.5,67.5)?"nesw-resize":Ee._inRange(r,67.5,112.5)?"ew-resize":Ee._inRange(r,112.5,157.5)?"nwse-resize":Ee._inRange(r,157.5,202.5)?"ns-resize":Ee._inRange(r,202.5,247.5)?"nesw-resize":Ee._inRange(r,247.5,292.5)?"ew-resize":Ee._inRange(r,292.5,337.5)?"nwse-resize":(Ee.error("Transformer has unknown angle for cursor detection: "+r),"pointer")}var Jp=["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"];function XO(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 k4(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 ZO(e,t){return k4(e,t,XO(e))}function QO(e,t,n){let r=t;for(let o=0;o<e.length;o++){const i=Ct.getAngle(e[o]),s=Math.abs(i-t)%(Math.PI*2);Math.min(s,Math.PI*2-s)<n&&(r=i)}return r}var $0=0,Tn=class extends vu{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(GO,this.update),this.getNode()&&this.update()}attachTo(e){return this.setNode(e),this}setNode(e){return Ee.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 w4+this._id}setNodes(e=[]){this._nodes&&this._nodes.length&&this.detach();const t=e.filter(n=>n.isAncestorOf(this)?(Ee.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(WO.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(C4),this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")}_getNodeRect(){return this._getCache(C4,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=(Ct.getAngle(e.getAbsoluteRotation())+Math.PI*2)%(Math.PI*2);return k4({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},-Ct.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()}),c=[{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();c.forEach(function(f){const h=d.point(f);e.push(h)})});const t=new es;t.rotate(-Ct.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:Ct.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(),Jp.forEach(e=>{this._createAnchor(e)}),this._createAnchor("rotater"),this._elementsCreated=!0}_createAnchor(e){const t=new Af({stroke:"rgb(0, 161, 255)",fill:"white",strokeWidth:1,name:e+" _anchor",dragDistance:0,draggable:!0,hitStrokeWidth:qO?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=YO(e,Ct.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 pt({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(),c=Ee.degToRad(a),d=Math.sin(c),f=-Math.cos(c),h=i/2,g=s/2;let m=1/0;f<0?m=Math.min(m,-g/f):f>0&&(m=Math.min(m,(s-g)/f)),d<0?m=Math.min(m,-h/d):d>0&&(m=Math.min(m,(i-h)/d));const v=h+d*m,k=g+f*m,C=Ee._sign(s),_=v+d*l*C,b=k+f*l*C;t.moveTo(v,k),t.lineTo(_,b)}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},$0++,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 c=o.getAbsolutePosition();if(l.x===c.x&&l.y===c.y)return;if(this._movingAnchorName==="rotater"){const C=this._getNodeRect();t=o.x()-C.width/2,n=-o.y()+C.height/2;const _=Ct.getAngle(this.rotateAnchorAngle());let b=Math.atan2(-n,t)+Math.PI/2-_;C.height<0&&(b-=Math.PI);const w=Ct.getAngle(this.rotation())+b,T=Ct.getAngle(this.rotationSnapTolerance()),L=ZO(C,QO(this.rotationSnaps(),w,T)-C.rotation);this._fitNodesInto(L,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 h=this.centeredScaling()||e.altKey;if(this._movingAnchorName==="top-left"){if(f){const C=h?{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(C.x-o.x(),2)+Math.pow(C.y-o.y(),2));const _=this.findOne(".top-left").x()>C.x?-1:1,b=this.findOne(".top-left").y()>C.y?-1:1;t=r*this.cos*_,n=r*this.sin*b,this.findOne(".top-left").x(C.x-t),this.findOne(".top-left").y(C.y-n)}}else if(this._movingAnchorName==="top-center")this.findOne(".top-left").y(o.y());else if(this._movingAnchorName==="top-right"){if(f){const C=h?{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()-C.x,2)+Math.pow(C.y-o.y(),2));const _=this.findOne(".top-right").x()<C.x?-1:1,b=this.findOne(".top-right").y()>C.y?-1:1;t=r*this.cos*_,n=r*this.sin*b,this.findOne(".top-right").x(C.x+t),this.findOne(".top-right").y(C.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 C=h?{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(C.x-o.x(),2)+Math.pow(o.y()-C.y,2));const _=C.x<o.x()?-1:1,b=o.y()<C.y?-1:1;t=r*this.cos*_,n=r*this.sin*b,o.x(C.x-t),o.y(C.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 C=h?{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()-C.x,2)+Math.pow(o.y()-C.y,2));const _=this.findOne(".bottom-right").x()<C.x?-1:1,b=this.findOne(".bottom-right").y()<C.y?-1:1;t=r*this.cos*_,n=r*this.sin*b,this.findOne(".bottom-right").x(C.x+t),this.findOne(".bottom-right").y(C.y+n)}}else console.error(new Error("Wrong position argument of selection resizer: "+this._movingAnchorName));if(h=this.centeredScaling()||e.altKey,h){const C=this.findOne(".top-left"),_=this.findOne(".bottom-right"),b=C.x(),w=C.y(),T=this.getWidth()-_.x(),L=this.getHeight()-_.y();_.move({x:-b,y:-w}),C.move({x:T,y:L})}const m=this.findOne(".top-left").getAbsolutePosition();t=m.x,n=m.y;const v=this.findOne(".bottom-right").x()-this.findOne(".top-left").x(),k=this.findOne(".bottom-right").y()-this.findOne(".top-left").y();this._fitNodesInto({x:t,y:n,width:v,height:k,rotation:Ct.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();$0--,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(Ee._inRange(e.width,-this.padding()*2-r,r)){this.update();return}if(Ee._inRange(e.height,-this.padding()*2-r,r)){this.update();return}const o=new es;if(o.rotate(Ct.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:Ee.warn("boundBoxFunc returned falsy. You should return new bound rect from it!")}const i=1e7,s=new es;s.translate(n.x,n.y),s.rotate(n.rotation),s.scale(n.width/i,n.height/i);const a=new es,l=e.width/i,c=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(c))):(a.translate(e.x,e.y),a.rotate(e.rotation),a.scale(l,c));const d=a.multiply(s.invert());this._nodes.forEach(f=>{var h;if(!f.getStage())return;const g=f.getParent().getAbsoluteTransform(),m=f.getTransform().copy();m.translate(f.offsetX(),f.offsetY());const v=new es;v.multiply(g.copy().invert()).multiply(d).multiply(g).multiply(m);const k=v.decompose();f.setAttrs(k),(h=f.getLayer())===null||h===void 0||h.batchDraw()}),this.rotation(Ee._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(Ee._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(T=>{T.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 c=this.rotateAnchorAngle(),d=this.rotateAnchorOffset(),f=Ee.degToRad(c),h=Math.sin(f),g=-Math.cos(f),m=n/2,v=r/2;let k=1/0;g<0?k=Math.min(k,-v/g):g>0&&(k=Math.min(k,(r-v)/g)),h<0?k=Math.min(k,-m/h):h>0&&(k=Math.min(k,(n-m)/h));const C=m+h*k,_=v+g*k,b=Ee._sign(r);this._batchChangeChild(".rotater",{x:C+h*d*b,y:_+g*d*b-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(T=>T.draggable()),x:0,y:0});const w=this.anchorStyleFunc();w&&l.forEach(T=>{w(T)}),(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=""),vu.prototype.destroy.call(this),this.detach(),this._removeEvents(),this}add(...e){return this._elementsCreated?(Ee.error("You cannot add external nodes to the Transformer. Use tr.nodes([node]) instead."),this):super.add(...e)}toObject(){return St.prototype.toObject.call(this)}clone(e){return St.prototype.clone.call(this,e)}getClientRect(){return this.nodes().length>0?super.getClientRect():{x:0,y:0,width:0,height:0}}};Tn.isTransforming=()=>$0>0;function JO(e){return e instanceof Array||Ee.warn("enabledAnchors value should be an array"),e instanceof Array&&e.forEach(function(t){Jp.indexOf(t)===-1&&Ee.warn("Unknown anchor name: "+t+". Available names are: "+Jp.join(", "))}),e||[]}Tn.prototype.className="Transformer",wr(Tn),ce.addGetterSetter(Tn,"enabledAnchors",Jp,JO),ce.addGetterSetter(Tn,"flipEnabled",!0,ts()),ce.addGetterSetter(Tn,"resizeEnabled",!0),ce.addGetterSetter(Tn,"anchorSize",10,yt()),ce.addGetterSetter(Tn,"rotateEnabled",!0),ce.addGetterSetter(Tn,"rotateLineVisible",!0),ce.addGetterSetter(Tn,"rotationSnaps",[]),ce.addGetterSetter(Tn,"rotateAnchorOffset",50,yt()),ce.addGetterSetter(Tn,"rotateAnchorAngle",0,yt()),ce.addGetterSetter(Tn,"rotateAnchorCursor","crosshair"),ce.addGetterSetter(Tn,"rotationSnapTolerance",5,yt()),ce.addGetterSetter(Tn,"borderEnabled",!0),ce.addGetterSetter(Tn,"anchorStroke","rgb(0, 161, 255)"),ce.addGetterSetter(Tn,"anchorStrokeWidth",1,yt()),ce.addGetterSetter(Tn,"anchorFill","white"),ce.addGetterSetter(Tn,"anchorCornerRadius",0,yt()),ce.addGetterSetter(Tn,"borderStroke","rgb(0, 161, 255)"),ce.addGetterSetter(Tn,"borderStrokeWidth",1,yt()),ce.addGetterSetter(Tn,"borderDash"),ce.addGetterSetter(Tn,"keepRatio",!0),ce.addGetterSetter(Tn,"shiftBehavior","default"),ce.addGetterSetter(Tn,"centeredScaling",!1),ce.addGetterSetter(Tn,"ignoreStroke",!1),ce.addGetterSetter(Tn,"padding",0,yt()),ce.addGetterSetter(Tn,"nodes"),ce.addGetterSetter(Tn,"node"),ce.addGetterSetter(Tn,"boundBoxFunc"),ce.addGetterSetter(Tn,"anchorDragBoundFunc"),ce.addGetterSetter(Tn,"anchorStyleFunc"),ce.addGetterSetter(Tn,"shouldOverdrawWholeArea",!1),ce.addGetterSetter(Tn,"useSingleNodeRotation",!0),ce.backCompat(Tn,{lineEnabled:"borderEnabled",rotateHandlerOffset:"rotateAnchorOffset",enabledHandlers:"enabledAnchors"});var Ca=class extends pt{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.radius(),0,Ct.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)}};Ca.prototype.className="Wedge",Ca.prototype._centroid=!0,Ca.prototype._attrsAffectingSize=["radius"],wr(Ca),ce.addGetterSetter(Ca,"radius",0,yt()),ce.addGetterSetter(Ca,"angle",0,yt()),ce.addGetterSetter(Ca,"clockwise",!1),ce.backCompat(Ca,{angleDeg:"angle",getAngleDeg:"getAngle",setAngleDeg:"setAngle"});function S4(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}var eF=[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],tF=[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 nF(e,t){const n=e.data,r=e.width,o=e.height;let i,s,a,l,c,d,f,h,g,m,v,k,C,_,b,w,T,L,N,H;const M=t+t+1,V=r-1,q=o-1,D=t+1,B=D*(D+1)/2,E=new S4,j=eF[t],J=tF[t];let Y=null,se=E,pe=null,Ve=null;for(let ge=1;ge<M;ge++)se=se.next=new S4,ge===D&&(Y=se);se.next=E,a=s=0;for(let ge=0;ge<o;ge++){k=C=_=b=l=c=d=f=0,h=D*(w=n[s]),g=D*(T=n[s+1]),m=D*(L=n[s+2]),v=D*(N=n[s+3]),l+=B*w,c+=B*T,d+=B*L,f+=B*N,se=E;for(let be=0;be<D;be++)se.r=w,se.g=T,se.b=L,se.a=N,se=se.next;for(let be=1;be<D;be++)i=s+((V<be?V:be)<<2),l+=(se.r=w=n[i])*(H=D-be),c+=(se.g=T=n[i+1])*H,d+=(se.b=L=n[i+2])*H,f+=(se.a=N=n[i+3])*H,k+=w,C+=T,_+=L,b+=N,se=se.next;pe=E,Ve=Y;for(let be=0;be<r;be++)n[s+3]=N=f*j>>J,N!==0?(N=255/N,n[s]=(l*j>>J)*N,n[s+1]=(c*j>>J)*N,n[s+2]=(d*j>>J)*N):n[s]=n[s+1]=n[s+2]=0,l-=h,c-=g,d-=m,f-=v,h-=pe.r,g-=pe.g,m-=pe.b,v-=pe.a,i=a+((i=be+t+1)<V?i:V)<<2,k+=pe.r=n[i],C+=pe.g=n[i+1],_+=pe.b=n[i+2],b+=pe.a=n[i+3],l+=k,c+=C,d+=_,f+=b,pe=pe.next,h+=w=Ve.r,g+=T=Ve.g,m+=L=Ve.b,v+=N=Ve.a,k-=w,C-=T,_-=L,b-=N,Ve=Ve.next,s+=4;a+=r}for(let ge=0;ge<r;ge++){C=_=b=k=c=d=f=l=0,s=ge<<2,h=D*(w=n[s]),g=D*(T=n[s+1]),m=D*(L=n[s+2]),v=D*(N=n[s+3]),l+=B*w,c+=B*T,d+=B*L,f+=B*N,se=E;for(let ve=0;ve<D;ve++)se.r=w,se.g=T,se.b=L,se.a=N,se=se.next;let be=r;for(let ve=1;ve<=t;ve++)s=be+ge<<2,l+=(se.r=w=n[s])*(H=D-ve),c+=(se.g=T=n[s+1])*H,d+=(se.b=L=n[s+2])*H,f+=(se.a=N=n[s+3])*H,k+=w,C+=T,_+=L,b+=N,se=se.next,ve<q&&(be+=r);s=ge,pe=E,Ve=Y;for(let ve=0;ve<o;ve++)i=s<<2,n[i+3]=N=f*j>>J,N>0?(N=255/N,n[i]=(l*j>>J)*N,n[i+1]=(c*j>>J)*N,n[i+2]=(d*j>>J)*N):n[i]=n[i+1]=n[i+2]=0,l-=h,c-=g,d-=m,f-=v,h-=pe.r,g-=pe.g,m-=pe.b,v-=pe.a,i=ge+((i=ve+D)<q?i:q)*r<<2,l+=k+=pe.r=n[i],c+=C+=pe.g=n[i+1],d+=_+=pe.b=n[i+2],f+=b+=pe.a=n[i+3],pe=pe.next,h+=w=Ve.r,g+=T=Ve.g,m+=L=Ve.b,v+=N=Ve.a,k-=w,C-=T,_-=L,b-=N,Ve=Ve.next,s+=r}}var rF=function(t){const n=Math.round(this.blurRadius());n>0&&nF(t,n)};ce.addGetterSetter(St,"blurRadius",0,yt(),ce.afterSetFilter);var oF=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};ce.addGetterSetter(St,"brightness",0,yt(),ce.afterSetFilter);var iF=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)},sF=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};ce.addGetterSetter(St,"contrast",0,yt(),ce.afterSetFilter);var aF=function(e){var t,n,r,o,i,s,a,l,c;const d=e.data,f=e.width,h=e.height,g=Math.min(1,Math.max(0,(n=(t=this.embossStrength)===null||t===void 0?void 0:t.call(this))!==null&&n!==void 0?n:.5)),m=Math.min(1,Math.max(0,(o=(r=this.embossWhiteLevel)===null||r===void 0?void 0:r.call(this))!==null&&o!==void 0?o:.5)),v=(a={"top-left":315,top:270,"top-right":225,right:180,"bottom-right":135,bottom:90,"bottom-left":45,left:0}[(s=(i=this.embossDirection)===null||i===void 0?void 0:i.call(this))!==null&&s!==void 0?s:"top-left"])!==null&&a!==void 0?a:315,k=!!((c=(l=this.embossBlend)===null||l===void 0?void 0:l.call(this))!==null&&c!==void 0&&c),C=g*10,_=m*255,b=v*Math.PI/180,w=Math.cos(b),T=Math.sin(b),L=128/1020*C,N=new Uint8ClampedArray(d),H=new Float32Array(f*h);for(let B=0,E=0;E<d.length;E+=4,B++)H[B]=.2126*N[E]+.7152*N[E+1]+.0722*N[E+2];const M=[-1,0,1,-2,0,2,-1,0,1],V=[-1,-2,-1,0,0,0,1,2,1],q=[-f-1,-f,-f+1,-1,0,1,f-1,f,f+1],D=B=>B<0?0:B>255?255:B;for(let B=1;B<h-1;B++)for(let E=1;E<f-1;E++){const j=B*f+E;let J=0,Y=0;J+=H[j+q[0]]*M[0],Y+=H[j+q[0]]*V[0],J+=H[j+q[1]]*M[1],Y+=H[j+q[1]]*V[1],J+=H[j+q[2]]*M[2],Y+=H[j+q[2]]*V[2],J+=H[j+q[3]]*M[3],Y+=H[j+q[3]]*V[3],J+=H[j+q[5]]*M[5],Y+=H[j+q[5]]*V[5],J+=H[j+q[6]]*M[6],Y+=H[j+q[6]]*V[6],J+=H[j+q[7]]*M[7],Y+=H[j+q[7]]*V[7],J+=H[j+q[8]]*M[8],Y+=H[j+q[8]]*V[8];const se=D(_+(w*J+T*Y)*L),pe=j*4;if(k){const Ve=se-_;d[pe]=D(N[pe]+Ve),d[pe+1]=D(N[pe+1]+Ve),d[pe+2]=D(N[pe+2]+Ve),d[pe+3]=N[pe+3]}else d[pe]=d[pe+1]=d[pe+2]=se,d[pe+3]=N[pe+3]}for(let B=0;B<f;B++){let E=B*4,j=((h-1)*f+B)*4;d[E]=N[E],d[E+1]=N[E+1],d[E+2]=N[E+2],d[E+3]=N[E+3],d[j]=N[j],d[j+1]=N[j+1],d[j+2]=N[j+2],d[j+3]=N[j+3]}for(let B=1;B<h-1;B++){let E=B*f*4,j=(B*f+(f-1))*4;d[E]=N[E],d[E+1]=N[E+1],d[E+2]=N[E+2],d[E+3]=N[E+3],d[j]=N[j],d[j+1]=N[j+1],d[j+2]=N[j+2],d[j+3]=N[j+3]}return e};ce.addGetterSetter(St,"embossStrength",.5,yt(),ce.afterSetFilter),ce.addGetterSetter(St,"embossWhiteLevel",.5,yt(),ce.afterSetFilter),ce.addGetterSetter(St,"embossDirection","top-left",void 0,ce.afterSetFilter),ce.addGetterSetter(St,"embossBlend",!1,void 0,ce.afterSetFilter);function G0(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 lF=function(e){const t=e.data,n=t.length;let r=t[0],o=r,i,s=t[1],a=s,l,c=t[2],d=c,f;const h=this.enhance();if(h===0)return;for(let b=0;b<n;b+=4)i=t[b+0],i<r?r=i:i>o&&(o=i),l=t[b+1],l<s?s=l:l>a&&(a=l),f=t[b+2],f<c?c=f:f>d&&(d=f);o===r&&(o=255,r=0),a===s&&(a=255,s=0),d===c&&(d=255,c=0);let g,m,v,k,C,_;if(h>0)g=o+h*(255-o),m=r-h*(r-0),v=a+h*(255-a),k=s-h*(s-0),C=d+h*(255-d),_=c-h*(c-0);else{const b=(o+r)*.5;g=o+h*(o-b),m=r+h*(r-b);const w=(a+s)*.5;v=a+h*(a-w),k=s+h*(s-w);const T=(d+c)*.5;C=d+h*(d-T),_=c+h*(c-T)}for(let b=0;b<n;b+=4)t[b+0]=G0(t[b+0],r,o,m,g),t[b+1]=G0(t[b+1],s,a,k,v),t[b+2]=G0(t[b+2],c,d,_,C)};ce.addGetterSetter(St,"enhance",0,yt(),ce.afterSetFilter);var cF=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}};ce.addGetterSetter(St,"hue",0,yt(),ce.afterSetFilter),ce.addGetterSetter(St,"saturation",0,yt(),ce.afterSetFilter),ce.addGetterSetter(St,"luminance",0,yt(),ce.afterSetFilter);var uF=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),c=.299*r+.701*a+.167*l,d=.587*r-.587*a+.33*l,f=.114*r-.114*a-.497*l,h=.299*r-.299*a-.328*l,g=.587*r+.413*a+.035*l,m=.114*r-.114*a+.293*l,v=.299*r-.3*a+1.25*l,k=.587*r-.586*a-1.05*l,C=.114*r+.886*a-.2*l;let _,b,w,T;for(let L=0;L<n;L+=4)_=t[L+0],b=t[L+1],w=t[L+2],T=t[L+3],t[L+0]=c*_+d*b+f*w+s,t[L+1]=h*_+g*b+m*w+s,t[L+2]=v*_+k*b+C*w+s,t[L+3]=T},dF=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,c=.587*r-.587*s+.33*a,d=.114*r-.114*s-.497*a,f=.299*r-.299*s-.328*a,h=.587*r+.413*s+.035*a,g=.114*r-.114*s+.293*a,m=.299*r-.3*s+1.25*a,v=.587*r-.586*s-1.05*a,k=.114*r+.886*s-.2*a;for(let C=0;C<n;C+=4){const _=t[C+0],b=t[C+1],w=t[C+2],T=t[C+3];t[C+0]=l*_+c*b+d*w,t[C+1]=f*_+h*b+g*w,t[C+2]=m*_+v*b+k*w,t[C+3]=T}};ce.addGetterSetter(St,"hue",0,yt(),ce.afterSetFilter),ce.addGetterSetter(St,"saturation",0,yt(),ce.afterSetFilter),ce.addGetterSetter(St,"value",0,yt(),ce.afterSetFilter);var fF=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]},hF=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 c=Math.sqrt(a*a+l*l),d=i-a,f=s-l;const h=Math.sqrt(d*d+f*f);c=h>c?h:c;const g=s,m=i,v=360/m*Math.PI/180;for(let k=0;k<m;k+=1){const C=Math.sin(k*v),_=Math.cos(k*v);for(let b=0;b<g;b+=1){d=Math.floor(a+c*b/g*_),f=Math.floor(l+c*b/g*C);let w=(f*i+d)*4;const T=r[w+0],L=r[w+1],N=r[w+2],H=r[w+3];w=(k+b*i)*4,o[w+0]=T,o[w+1]=L,o[w+2]=N,o[w+3]=H}}},pF=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 c=Math.sqrt(a*a+l*l),d=i-a,f=s-l;const h=Math.sqrt(d*d+f*f);c=h>c?h:c;const g=s,m=i,v=n.polarRotation||0;let k,C;for(d=0;d<i;d+=1)for(f=0;f<s;f+=1){const _=d-a,b=f-l,w=Math.sqrt(_*_+b*b)*g/c;let T=(Math.atan2(b,_)*180/Math.PI+360+v)%360;T=T*m/360,k=Math.floor(T),C=Math.floor(w);let L=(C*i+k)*4;const N=r[L+0],H=r[L+1],M=r[L+2],V=r[L+3];L=(f*i+d)*4,o[L+0]=N,o[L+1]=H,o[L+2]=M,o[L+3]=V}},mF=function(e){const t=e.width,n=e.height;let r,o,i,s,a,l,c,d,f,h,g=Math.round(this.kaleidoscopePower());const m=Math.round(this.kaleidoscopeAngle()),v=Math.floor(t*(m%360)/360);if(g<1)return;const k=Ee.createCanvasElement();k.width=t,k.height=n;const C=k.getContext("2d").getImageData(0,0,t,n);Ee.releaseCanvas(k),hF(e,C,{polarCenterX:t/2,polarCenterY:n/2});let _=t/Math.pow(2,g);for(;_<=8;)_=_*2,g-=1;_=Math.ceil(_);let b=_,w=0,T=b,L=1;for(v+_>t&&(w=b,T=0,L=-1),o=0;o<n;o+=1)for(r=w;r!==T;r+=L)i=Math.round(r+v)%t,f=(t*o+i)*4,a=C.data[f+0],l=C.data[f+1],c=C.data[f+2],d=C.data[f+3],h=(t*o+r)*4,C.data[h+0]=a,C.data[h+1]=l,C.data[h+2]=c,C.data[h+3]=d;for(o=0;o<n;o+=1)for(b=Math.floor(_),s=0;s<g;s+=1){for(r=0;r<b+1;r+=1)f=(t*o+r)*4,a=C.data[f+0],l=C.data[f+1],c=C.data[f+2],d=C.data[f+3],h=(t*o+b*2-r-1)*4,C.data[h+0]=a,C.data[h+1]=l,C.data[h+2]=c,C.data[h+3]=d;b*=2}pF(C,e,{polarRotation:0})};ce.addGetterSetter(St,"kaleidoscopePower",2,yt(),ce.afterSetFilter),ce.addGetterSetter(St,"kaleidoscopeAngle",0,yt(),ce.afterSetFilter);function em(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 Ef(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 gF(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 vF(e,t){const n=em(e,0,0),r=em(e,e.width-1,0),o=em(e,0,e.height-1),i=em(e,e.width-1,e.height-1),s=t||10;if(Ef(n,r)<s&&Ef(r,i)<s&&Ef(i,o)<s&&Ef(o,n)<s){const a=gF([r,n,i,o]),l=[];for(let c=0;c<e.width*e.height;c++){const d=Ef(a,[e.data[c*4],e.data[c*4+1],e.data[c*4+2]]);l[c]=d<s?0:255}return l}}function yF(e,t){for(let n=0;n<e.width*e.height;n++)e.data[4*n+3]=t[n]}function bF(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 c=a*t+l;let d=0;for(let f=0;f<o;f++)for(let h=0;h<o;h++){const g=a+f-i,m=l+h-i;if(g>=0&&g<n&&m>=0&&m<t){const v=g*t+m,k=r[f*o+h];d+=e[v]*k}}s[c]=d===2040?255:0}return s}function wF(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 c=a*t+l;let d=0;for(let f=0;f<o;f++)for(let h=0;h<o;h++){const g=a+f-i,m=l+h-i;if(g>=0&&g<n&&m>=0&&m<t){const v=g*t+m,k=r[f*o+h];d+=e[v]*k}}s[c]=d>=1020?255:0}return s}function CF(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 c=a*t+l;let d=0;for(let f=0;f<o;f++)for(let h=0;h<o;h++){const g=a+f-i,m=l+h-i;if(g>=0&&g<n&&m>=0&&m<t){const v=g*t+m,k=r[f*o+h];d+=e[v]*k}}s[c]=d}return s}var kF=function(e){let t=vF(e,this.threshold());return t&&(t=bF(t,e.width,e.height),t=wF(t,e.width,e.height),t=CF(t,e.width,e.height),yF(e,t)),e};ce.addGetterSetter(St,"threshold",0,yt(),ce.afterSetFilter);var SF=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()};ce.addGetterSetter(St,"noise",.2,yt(),ce.afterSetFilter);var _F=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){Ee.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 c=0,d=0,f=0,h=0;const g=a*t,m=g+t,v=l*t,k=v+t;let C=0;for(let _=g;_<m;_+=1)if(!(_>=n))for(let b=v;b<k;b+=1){if(b>=r)continue;const w=(n*b+_)*4;c+=s[w+0],d+=s[w+1],f+=s[w+2],h+=s[w+3],C+=1}c=c/C,d=d/C,f=f/C,h=h/C;for(let _=g;_<m;_+=1)if(!(_>=n))for(let b=v;b<k;b+=1){if(b>=r)continue;const w=(n*b+_)*4;s[w+0]=c,s[w+1]=d,s[w+2]=f,s[w+3]=h}}};ce.addGetterSetter(St,"pixelSize",8,yt(),ce.afterSetFilter);var AF=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};ce.addGetterSetter(St,"levels",.5,yt(),ce.afterSetFilter);var IF=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]}};ce.addGetterSetter(St,"red",0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)}),ce.addGetterSetter(St,"green",0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)}),ce.addGetterSetter(St,"blue",0,__,ce.afterSetFilter);var xF=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}};ce.addGetterSetter(St,"red",0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)}),ce.addGetterSetter(St,"green",0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)}),ce.addGetterSetter(St,"blue",0,__,ce.afterSetFilter),ce.addGetterSetter(St,"alpha",1,function(e){return this._filterUpToDate=!1,e>1?1:e<0?0:e});var EF=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)}},TF=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},RF=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};ce.addGetterSetter(St,"threshold",.5,yt(),ce.afterSetFilter);var LF=t4.Util._assign(t4,{Arc:ba,Arrow:ic,Circle:bu,Ellipse:ll,Image:ns,Label:j0,Tag:sc,Line:wa,Path:Pi,Rect:Af,RegularPolygon:cl,Ring:ac,Sprite:Ms,Star:ul,Text:ir,TextPath:ro,Transformer:Tn,Wedge:Ca,Filters:{Blur:rF,Brightness:iF,Brighten:oF,Contrast:sF,Emboss:aF,Enhance:lF,Grayscale:cF,HSL:uF,HSV:dF,Invert:fF,Kaleidoscope:mF,Mask:kF,Noise:SF,Pixelate:_F,Posterize:AF,RGB:IF,RGBA:xF,Sepia:EF,Solarize:TF,Threshold:RF}}),MF=LF;xt();var PF=["dialog","floating"],_4=["top-right","top-left","bottom-right","bottom-left","top-center","bottom-center"];function DF(e){if(!e||typeof e!="object")throw new Error("SurfaceManager: request must be a non-null object.");if(!PF.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&&!_4.includes(e.floating.placement))throw new Error(`SurfaceManager: floating.placement must be one of ${_4.join(", ")}, got "${e.floating.placement}".`)}var OF=class{activeDialog=zr(null);activeFloating=zr(null);#e=!1;#n=1;#t;constructor({getModuleConfig:e}){this.#t=e}open(e){if(this.#e)return this.#f(e);DF(e);const t=this.#d(e),{component:n,props:r,render:o}=this.#h(t);let i,s=!1;const a=new Promise(g=>{i=m=>s?!1:(s=!0,g(m),!0)});let l;const c=g=>{i({status:"submitted",data:g})&&this.#i(l)},d=g=>{i({status:"closed",reason:g})&&this.#i(l)};l={id:t.id,mode:t.mode,request:t,component:n,props:r,render:o,resolve:c,close:d,settle:g=>i(g),get settled(){return s}};const f=t.mode==="dialog"?"activeDialog":"activeFloating",h=this[f].value;return h&&!h.settled&&h.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.#s(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.#i(e))}#i(e){const t=e.mode==="dialog"?this.activeDialog:this.activeFloating;t.value===e&&(t.value=null)}#s(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.#n++}`,n=this.#t()??{},r=e.mode==="dialog"?n.dialog:n.floating,o=e.mode==="dialog"?{maxWidth:r?.maxWidth,...e.dialog}:e.dialog,i=e.mode==="floating"?{placement:r?.placement??"top-right",width:r?.width,maxWidth:r?.maxWidth,maxHeight:r?.maxHeight,autoFocus:r?.autoFocus??!0,closeOnOutsidePointerDown:r?.closeOnOutsidePointerDown??!1,...e.floating}:e.floating;return{...e,id:t,closeOnEscape:e.closeOnEscape??r?.closeOnEscape??!0,closeOnBackdrop:e.mode==="dialog"?e.closeOnBackdrop??r?.closeOnBackdrop??!0:!1,dialog:o,floating:i}}#h(e){if("component"in e&&e.component!=null)return{component:e.component,props:e.props};if("render"in e&&typeof e.render=="function")return{render:e.render};const t=this.#t()?.resolver;if(typeof t=="function"){const n=t(e);if(n!=null){if(n.type==="none")throw new Error(`SurfaceManager: resolver explicitly suppressed surface for kind "${e.kind}".`);if(n.type==="custom")return{component:n.component,props:n.props};if(n.type==="external")return{render:n.render}}}throw new Error(`SurfaceManager: no renderer resolved for kind "${e.kind}". Provide a resolver via surfaces.resolver, or use a direct-render request.`)}#f(e){return{id:e?.id??`surface-${this.#n++}`,mode:e?.mode??"dialog",close:()=>{},result:Promise.resolve({status:"destroyed"})}}},FF="https://docs.superdoc.dev/guides/migration/document-api",A4=new Set;function NF(e,t){A4.has(e)||(A4.add(e),console.warn(t))}var BF={state:"editor.state",view:"editor.view",schema:"editor.schema",commands:"editor.commands",chain:"editor.chain()",can:"editor.can()",dispatch:"editor.dispatch()"},I4=Symbol.for("superdoc:rawEditor"),x4=new WeakMap;function E4(e){return!e||e[I4]?e:new Proxy(e,{get(t,n){if(n===I4)return t;const r=BF[n];r&&NF(`deprecated:${String(n)}`,`[SuperDoc] ${r} is deprecated and will be removed in a future version. Use the Document API (editor.doc) instead. See ${FF}`);const o=Reflect.get(t,n,t);if(typeof o=="function"){let i=x4.get(t);return i||(i=new Map,x4.set(t,i)),i.has(n)||i.set(n,o.bind(t)),i.get(n)}return o}})}var T4=["review","original","final","off"],zF=["paired","independent"],R4=Symbol.for("@superdoc/trackChanges:normalized"),L4=new Set;function M4(e,t){L4.has(e)||(L4.add(e),console.warn(`[SuperDoc] ${e} is deprecated — use ${t} instead.`))}function P4(e,t,n){return typeof e=="boolean"?e:typeof t=="boolean"?t:n}function VF(e,t,n){return typeof e=="string"&&T4.includes(e)?e:typeof t=="string"&&T4.includes(t)?t:n}function jF(e){return typeof e=="string"&&zF.includes(e)?e:null}function lc(e){return!e||typeof e!="object"||Array.isArray(e)?null:e}function UF(e){const t=e[R4]===!0;lc(e.modules)||(e.modules={});const n=lc(e.modules.trackChanges),r=lc(e.trackChanges),o=lc(e.layoutEngineOptions?.trackedChanges);t||(r&&M4("config.trackChanges","config.modules.trackChanges"),o&&M4("config.layoutEngineOptions.trackedChanges","config.modules.trackChanges"));const i=P4(n?.visible,r?.visible,!1),s=P4(n?.enabled,o?.enabled,!0),a=jF(n?.replacements)??"paired",l=lc(n?.authorColors)?n.authorColors:void 0,c=lc(n?.semanticColors)?n.semanticColors:void 0,d=e.documentMode==="viewing"?i?"review":"original":"review",f=VF(n?.mode,o?.mode,d),h={visible:i,mode:f,enabled:s,replacements:a};return l&&(h.authorColors=l),c&&(h.semanticColors=c),e.modules.trackChanges=h,e.trackChanges={visible:i},lc(e.layoutEngineOptions)||(e.layoutEngineOptions={}),e.layoutEngineOptions.trackedChanges={mode:f,enabled:s},Object.defineProperty(e,R4,{value:!0,writable:!0,configurable:!0,enumerable:!1}),h}var W0=Object.freeze({id:null,name:"Default SuperDoc user",email:null});function HF(e){return!e||typeof e!="object"?{...W0}:{...W0,...e}}var D4=Object.freeze({toolbar:!0,comments:!0,contextMenu:!0,search:!1,linkPopover:!1,ruler:!1,contentControls:!0}),$F=Object.freeze(["left","center","right"]),TH=Object.freeze(Object.keys(D4)),Cu=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function O4(e,t){const n=e?.[t];return n===!1?!1:n===void 0?D4[t]:!0}function GF(e,t){const n=e?.[t];return Cu(n)?n:{}}var F4=Object.freeze(["readOnly","allowResolve","permissionResolver"]);function WF(e){if(!F4.some(n=>n in e))return e;const t={...e};for(const n of F4)delete t[n];return t}function N4(e={}){const t=e.ui,n=t===!1,r=Cu(t)?t:void 0,o=V=>!n&&O4(r,V),i=V=>n?!1:r?.[V]===void 0?void 0:O4(r,V),s=V=>n?{}:GF(r,V),a=n||i("ruler")===!1,l=n||i("linkPopover")===!1,c=l?void 0:h0(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,h=s("toolbar"),g=e.modules?.toolbar,m=Cu(g)?g:{},v=e.modules?.contextMenu??e.modules?.slashMenu,k=Cu(v)?v:{},C=e.modules?.surfaces?.findReplace,_=Cu(C)?C:{},b=[h.groups,m.groups],w=b.find(Cu),T=b.find(Array.isArray),L=h0(T,m.toolbarGroups,e.toolbarGroups),N=Array.isArray(L)?L:null,H=(V,q)=>Object.prototype.hasOwnProperty.call(V,q),M=w&&N?Object.fromEntries([...N.filter(V=>H(w,V)),...Object.keys(w).filter(V=>!$F.includes(V))].map(V=>[V,w[V]])):w;return{enabled:!n,toolbar:{enabled:o("toolbar"),container:n?null:h0(h.container,m.selector,e.toolbar)??null,options:n?{}:{...Ls(m,h),groups:M,toolbarGroups:L,icons:Ls(e.toolbarIcons,m.icons,h.icons),texts:Ls(e.toolbarTexts,m.texts,h.texts)}},comments:{enabled:i("comments")??(!n&&e.modules?.comments!==!1),options:n?{}:Dk(WF(s("comments")))},contextMenu:{enabled:i("contextMenu")??(!n&&e.disableContextMenu!==!0),suppressed:n||i("contextMenu")===!1,options:n?{}:Ls(k,s("contextMenu"))},search:{enabled:i("search")??(!n&&!!e.modules?.surfaces?.findReplace),options:n?{}:Ls(_,s("search"))},linkPopover:{enabled:typeof c=="function",suppressed:l,options:Ls(s("linkPopover"),{popoverResolver:c})},ruler:{enabled:i("ruler")??(!n&&!!e.rulers),suppressed:a,container:a?null:s("ruler").container??e.rulerContainer??null},contentControls:{enabled:d,options:d?Ls({chrome:f},s("contentControls")):{chrome:"none"}}}}var K0=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function B4(e={}){const t=K0(e.interaction)?e.interaction:{},n=K0(t.comments)?t.comments:{},r=K0(e.modules?.comments)?e.modules.comments:{};return{comments:{readOnly:(n.readOnly??r.readOnly??!1)===!0,allowResolve:(n.allowResolve??r.allowResolve??!0)!==!1}}}var z4=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function V4(e={}){const t=z4(e.surfaces)?e.surfaces:{},n=z4(e.modules?.surfaces)?e.modules.surfaces:{},r=t.resolver===void 0?n.resolver:t.resolver;return{resolver:typeof r=="function"?r:null,dialog:Ls(n.dialog,t.dialog),floating:Ls(n.floating,t.floating)}}var KF=class{#e=new Map;#n=new Map;#t=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.#n.get(t):void 0;if(n!==void 0&&n!==e.id)throw new Error(`EditorRuntimeRegistry: root element already registered to runtime "${n}"`);this.#e.set(e.id,e),t&&this.#n.set(t,e.id)}unregister(e){const t=this.#e.get(e);return t?(this.#e.delete(e),t.root&&this.#n.delete(t.root),this.#t===e&&(this.#t=null,this.#i({previousRuntimeId:e,nextRuntimeId:null,reason:"active-runtime-unregistered",legacyEditorProjection:null})),!0):!1}get(e){return this.#e.get(e)??null}getAll(){return Array.from(this.#e.values())}getAllByDocumentId(e){const t=[];for(const n of this.#e.values())n.documentId===e&&t.push(n);return t}getActive(){return this.#t===null?null:this.#e.get(this.#t)}getActiveId(){return this.#t}setActive(e,t){if(e!==null&&!this.#e.has(e))throw new Error(`EditorRuntimeRegistry: cannot activate unknown runtime "${e}"`);if(e===this.#t)return;const n=this.#t;this.#t=e;let r=null;e!==null&&(r=this.#e.get(e).getLegacyEditorProjection?.()??null),this.#i({previousRuntimeId:n,nextRuntimeId:e,reason:t,legacyEditorProjection:r})}resolveFromEventTarget(e){const t=e instanceof Element?e:e instanceof Node?e.parentElement:null;if(!t)return null;const n=t.closest(`[${Dp}]`);if(!n)return null;const r=n.getAttribute(Dp),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.#n.clear(),this.#t=null,this.#r.clear()}#i(e){for(const t of Array.from(this.#r))try{t(e)}catch{}}},lt={notReady:"not-ready",documentApiUnavailable:"document-api-unavailable",documentReadonly:"document-readonly",selectionRequired:"selection-required",rangeSelectionRequired:"range-selection-required",contextUnavailable:"context-unavailable",geometryUnavailable:"geometry-unavailable",targetUnresolved:"target-unresolved",targetNotVisible:"target-not-visible",commandUnsupported:"command-unsupported",commandDeferred:"command-deferred",tableContextUnavailable:"table-context-unavailable",operationUnavailable:"operation-unavailable",bulkDecisionsDisabled:"bulk-decisions-disabled",hostCapabilityUnavailable:"host-capability-unavailable",historyEmpty:"history-empty",searchUnavailable:"search-unavailable",searchInvalidPattern:"search-invalid-pattern",replaceUnsupported:"replace-unsupported",contentControlLocked:"content-control-locked"},j4={bold:"bold",italic:"italic",underline:"underline",strikethrough:"strikethrough",fontFamily:"font-family",fontSize:"font-size",setFontFamily:"setFontFamily",setFontSize:"setFontSize",undo:"undo",redo:"redo",acceptChange:"acceptChange",rejectChange:"rejectChange",acceptAllChanges:"acceptAllChanges",rejectAllChanges:"rejectAllChanges",bulletList:"bullet-list",numberedList:"numbered-list"};function U4(e){const t=n=>typeof n=="string"?n.replace(/\s*pt$/i,"").trim():n;if(typeof e=="string")return t(e);if(e&&typeof e=="object"&&"value"in e){const n=e;return{...n,value:t(n.value)}}return e}function qF(e){const t=(n,r)=>!r&&n>0&&n<=5?n*100:n;if(typeof e=="string"){const n=e.includes("%"),r=Number.parseFloat(e.replace("%","").trim());return Number.isFinite(r)?t(r,n):e}return typeof e=="number"&&Number.isFinite(e)?t(e,!1):e}function YF(e){const t=e&&typeof e=="object"&&"value"in e?e.value:e;if(t==="in"||t==="cm")return t;if(typeof t=="string"){const n=t.trim().toLowerCase();if(n==="in"||n==="inch"||n==="inches")return"in";if(n==="cm"||n==="centimeter"||n==="centimeters"||n==="centimetre"||n==="centimetres")return"cm"}return t}function H4(e){const t=n=>{if(n===null)return null;if(typeof n!="string")return n;const r=n.trim();return r===""?n:/^#[0-9a-fA-F]{6}$/.test(r)?r:/^[0-9a-fA-F]{6}$/.test(r)?`#${r}`:r};if(e&&typeof e=="object"&&"value"in e){const n=e;return{...n,value:t(n.value)}}return t(e)}function q0(e,t){if(e&&typeof e=="object"){const n=e;for(const r of t)if(r in n)return n[r]}return e}function XF(e){const t=q0(e,["alignment","value"]);if(typeof t!="string")return t;const n=t.trim().toLowerCase();return n==="justified"||n==="both"?"justify":n}function ZF(e){const t=q0(e,["line","lineHeight","value"]),n=typeof t=="number"?t:typeof t=="string"?Number.parseFloat(t.trim()):NaN;return!Number.isFinite(n)||n<=0?t:n<=10?Math.round(n*240):Math.round(n)}function QF(e){if(e&&typeof e=="object"&&"role"in e)return e;const t=q0(e,["styleId","value","style"]);return typeof t=="string"?t.trim():t}function JF(e){if(typeof e=="string")return e;if(e&&typeof e=="object"){const t=e.mode;if(typeof t=="string")return t}return e}var eN=lt.commandUnsupported,Ps=lt.tableContextUnavailable,$4=[{id:"bold",family:"inline marks",disposition:"routed",mutates:!0,docRoute:"format.bold",activeMark:"bold",inline:{key:"bold",kind:"toggle"}},{id:"italic",family:"inline marks",disposition:"routed",mutates:!0,docRoute:"format.italic",activeMark:"italic",inline:{key:"italic",kind:"toggle"}},{id:"underline",family:"inline marks",disposition:"routed",mutates:!0,docRoute:"format.underline",activeMark:"underline",inline:{key:"underline",kind:"toggle"}},{id:"strikethrough",family:"inline marks",disposition:"routed",mutates:!0,docRoute:"format.strikethrough",activeMark:"strikethrough",inline:{key:"strike",kind:"toggle"}},{id:"font-family",family:"fonts",disposition:"routed",mutates:!0,docRoute:"format.fontFamily",aliases:["setFontFamily"],inline:{key:"fontFamily",kind:"value-string"}},{id:"font-size",family:"fonts",disposition:"routed",mutates:!0,docRoute:"format.fontSize",aliases:["setFontSize"],normalizePayload:U4,inline:{key:"fontSize",kind:"value-number"}},{id:"setFontFamily",family:"fonts",disposition:"routed",mutates:!0,docRoute:"format.fontFamily",aliasOf:"font-family",inline:{key:"fontFamily",kind:"value-string"}},{id:"setFontSize",family:"fonts",disposition:"routed",mutates:!0,docRoute:"format.fontSize",aliasOf:"font-size",normalizePayload:U4,inline:{key:"fontSize",kind:"value-number"}},{id:"undo",family:"history",disposition:"routed",mutates:!0,docRoute:"history.undo"},{id:"redo",family:"history",disposition:"routed",mutates:!0,docRoute:"history.redo"},{id:"acceptChange",family:"tracked changes",disposition:"routed",mutates:!0,trackDecision:{kind:"accept",scope:"id"},aliases:["track-changes-accept-selection"]},{id:"rejectChange",family:"tracked changes",disposition:"routed",mutates:!0,trackDecision:{kind:"reject",scope:"id"},aliases:["track-changes-reject-selection"]},{id:"acceptAllChanges",family:"tracked changes (bulk)",disposition:"routed",mutates:!0,trackDecision:{kind:"accept",scope:"all"}},{id:"rejectAllChanges",family:"tracked changes (bulk)",disposition:"routed",mutates:!0,trackDecision:{kind:"reject",scope:"all"}},{id:"track-changes-accept-selection",family:"tracked changes",disposition:"routed",mutates:!0,trackDecision:{kind:"accept",scope:"id"},aliasOf:"acceptChange"},{id:"track-changes-reject-selection",family:"tracked changes",disposition:"routed",mutates:!0,trackDecision:{kind:"reject",scope:"id"},aliasOf:"rejectChange"},{id:"zoom",family:"zoom",disposition:"routed",mutates:!1,instanceRoute:"setZoom",valueFrom:"zoom",normalizePayload:qF},{id:"zoom-fit-width",family:"zoom",disposition:"routed",mutates:!1,instanceRoute:"setZoomMode",fixedArg:"fit-width",valueFrom:"zoom"},{id:"document-mode",family:"document",disposition:"routed",mutates:!1,instanceRoute:"setDocumentMode",valueFrom:"documentMode",normalizePayload:JF},{id:"measurement-unit",family:"measurement",disposition:"routed",mutates:!1,instanceRoute:"setMeasurementUnit",valueFrom:"measurementUnit",normalizePayload:YF},{id:"text-color",family:"color",disposition:"routed",mutates:!0,docRoute:"format.color",inline:{key:"color",kind:"value-string"},normalizePayload:H4},{id:"highlight-color",family:"color",disposition:"routed",mutates:!0,docRoute:"format.highlight",inline:{key:"highlight",kind:"value-string"},normalizePayload:H4},{id:"link",family:"links",disposition:"routed",mutates:!0,docRoute:"hyperlinks.wrap",activeMark:"link",link:{kind:"link"}},{id:"text-align",family:"paragraph",disposition:"routed",mutates:!0,docRoute:"format.paragraph.setAlignment",blockParagraph:{kind:"alignment"},normalizePayload:XF},{id:"line-height",family:"paragraph",disposition:"routed",mutates:!0,docRoute:"format.paragraph.setSpacing",blockParagraph:{kind:"spacing-line"},normalizePayload:ZF},{id:"linked-style",family:"paragraph",disposition:"routed",mutates:!0,docRoute:"styles.paragraph.setStyle",blockParagraph:{kind:"style"},normalizePayload:QF},{id:"bullet-list",family:"lists",disposition:"routed",mutates:!0,docRoute:"lists.apply",list:{mode:"toggle-seed",seed:"bullet"}},{id:"numbered-list",family:"lists",disposition:"routed",mutates:!0,docRoute:"lists.apply",list:{mode:"toggle-seed",seed:"ordered"}},{id:"indent-increase",family:"lists/indent",disposition:"routed",mutates:!0,docRoute:"lists.indent",list:{mode:"indent"}},{id:"indent-decrease",family:"lists/indent",disposition:"routed",mutates:!0,docRoute:"lists.outdent",list:{mode:"outdent"}},{id:"direction-ltr",family:"direction",disposition:"routed",mutates:!0,docRoute:"format.paragraph.setDirection",blockParagraph:{kind:"direction",fixedValue:"ltr"}},{id:"direction-rtl",family:"direction",disposition:"routed",mutates:!0,docRoute:"format.paragraph.setDirection",blockParagraph:{kind:"direction",fixedValue:"rtl"}},{id:"clear-formatting",family:"formatting",disposition:"routed",mutates:!0,docRoute:"format.apply",inline:{key:"*",kind:"clear"}},{id:"image",family:"media",disposition:"routed",mutates:!0,docRoute:"create.image",create:{kind:"image"}},{id:"table-of-contents-insert",family:"TOC",disposition:"routed",mutates:!0,docRoute:"create.tableOfContents",create:{kind:"toc"}},{id:"table-insert",family:"tables",disposition:"routed",mutates:!0,docRoute:"create.table",create:{kind:"table"}},{id:"table-add-row-before",family:"tables",disposition:"routed",mutates:!0,docRoute:"tables.insertRow",table:{action:"insert-row-before",op:"insertRow"},reason:Ps},{id:"table-add-row-after",family:"tables",disposition:"routed",mutates:!0,docRoute:"tables.insertRow",table:{action:"insert-row-after",op:"insertRow"},reason:Ps},{id:"table-delete-row",family:"tables",disposition:"routed",mutates:!0,docRoute:"tables.deleteRow",table:{action:"delete-row",op:"deleteRow"},reason:Ps},{id:"table-add-column-before",family:"tables",disposition:"routed",mutates:!0,docRoute:"tables.insertColumn",table:{action:"insert-column-before",op:"insertColumn"},reason:Ps},{id:"table-add-column-after",family:"tables",disposition:"routed",mutates:!0,docRoute:"tables.insertColumn",table:{action:"insert-column-after",op:"insertColumn"},reason:Ps},{id:"table-delete-column",family:"tables",disposition:"routed",mutates:!0,docRoute:"tables.deleteColumn",table:{action:"delete-column",op:"deleteColumn"},reason:Ps},{id:"table-delete",family:"tables",disposition:"routed",mutates:!0,docRoute:"tables.delete",table:{action:"delete-table",op:"delete"},reason:Ps},{id:"table-merge-cells",family:"tables",disposition:"routed",mutates:!0,docRoute:"tables.mergeCells",table:{action:"merge-cells",op:"mergeCells"},reason:Ps},{id:"table-split-cell",family:"tables",disposition:"routed",mutates:!0,docRoute:"tables.splitCell",table:{action:"split-cell",op:"splitCell",requiresCell:!0},reason:Ps},{id:"table-remove-borders",family:"tables",disposition:"routed",mutates:!0,docRoute:"tables.setBorders",table:{action:"remove-borders",op:"setBorders"},reason:Ps},{id:"ruler",family:"UI chrome",disposition:"routed",mutates:!1,instanceRoute:"toggleRuler",valueFrom:"ruler"},{id:"formatting-marks",family:"UI chrome",disposition:"routed",mutates:!1,instanceRoute:"toggleFormattingMarks",valueFrom:"formattingMarks"},{id:"copy-format",family:"formatting",disposition:"routed",mutates:!1},{id:"table-fix",family:"tables",disposition:"unsupported",mutates:!0,reason:eN}],tN=new Map($4.map(e=>[e.id,e])),nN=$4.map(e=>e.id);function ku(e){return tN.get(e)??null}var rN=["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"],G4=[{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:"table",commandId:"table-insert",instanceMethod:null,disposition:"controller-routed",group:"center"},{name:"tableActions",commandId:null,instanceMethod:null,disposition:"shell-owned",group:"center",memberCommandIds:rN,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"}],W4=new Map(G4.map(e=>[e.name,e])),RH=G4.map(e=>e.name);function Y0(e){return W4.get(e)??null}function oN(e){const t=W4.get(e);return t?.disposition==="controller-routed"?t.commandId:null}var iN=".png,.jpg,.jpeg,image/png,image/jpeg",K4=new Set(["image/png","image/jpeg","image/jpg"]),sN=/\.(png|jpe?g)$/i;function aN(e){if(!e)return!1;const t=typeof e.type=="string"?e.type.toLowerCase():"";return t?K4.has(t):sN.test(String(e.name??""))}function q4(e){return new Promise((t,n)=>{const r=new FileReader;r.onload=()=>t(lN(String(r.result),e)),r.onerror=()=>n(r.error??new Error("image-read-failed")),r.readAsDataURL(e)})}function lN(e,t){const n=/^data:([^;,]*);base64,/.exec(e);if(!n)return e;const r=n[1].toLowerCase();if(K4.has(r))return e;const o=String(t?.name??""),i=/\.jpe?g$/i.test(o)?"image/jpeg":/\.png$/i.test(o)?"image/png":null;return i?`data:${i};base64,${e.slice(n[0].length)}`:e}async function cN(e,t){if(typeof t=="function"){const n=await t(e);if(typeof n!="string"||n.trim()==="")throw new Error("handleImageUpload returned an empty result");return n.startsWith("data:")?n:uN(n,e)}return q4(e)}async function uN(e,t){const n=await fetch(e);if(!n.ok)throw new Error(`image fetch failed: ${n.status}`);const r=await n.blob(),o=(/\.(?:png|jpe?g)(?:$|[?#])/i.test(e)?e.split(/[?#]/)[0]:"")||t?.name||"";return q4(o?Object.assign(r,{name:o}):r)}function dN({ownerDocument:e=document,onPick:t,onError:n}={}){const r=e.createElement("input");return r.type="file",r.accept=iN,r.hidden=!0,r.tabIndex=-1,r.setAttribute("data-superdoc-image-picker","true"),r.setAttribute("aria-hidden","true"),r.addEventListener("change",()=>{const o=r.files&&r.files[0];if(r.value="",!!o){if(!aN(o)){n?.(new Error(`unsupported image type: ${o.type||o.name}`));return}try{const i=t?.(o);i&&typeof i.then=="function"&&i.catch(s=>n?.(s))}catch(i){n?.(i)}}}),e.body?.appendChild(r),{input:r,open(){r.click()},destroy(){r.remove()}}}var fN=(e,t)=>{let n=e.replace(/[^0-9.]/g,"");return n=parseFloat(n),isNaN(n)&&(n=t),n=parseFloat(n),n},hN=(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=(...c)=>{const d=Date.now();!s&&n.leading===!1&&(s=d);const f=t-(d-s);return o=c,f<=0||f>t?(r&&(clearTimeout(r),r=null),s=d,i=e(...c),r||(o=null)):!r&&n.trailing!==!1&&(r=setTimeout(a,f)),i};return l.cancel=function(){clearTimeout(r),s=0,r=o=null},l};xt(),fn();var pN={class:"sd-toolbar-icon"},mN=["innerHTML"],gN={__name:"ToolbarButtonIcon",props:{name:{type:String,required:!0},color:{type:String,default:null},icon:{type:String,default:null}},setup(e){const t=e,n=Ce(()=>{if(t.name==="color")return{backgroundColor:t.color||"#111111"};if(t.name==="highlight")return{backgroundColor:t.color||"#D6D6D6"}}),r=Ce(()=>["color","highlight"].includes(t.name));return(o,i)=>(ye(),Ie("div",pN,[Fe("div",{class:nn(["sd-toolbar-icon__icon",[`sd-toolbar-icon__icon--${t.name}`]]),innerHTML:e.icon},null,10,mN),r.value?(ye(),Ie("div",{key:0,class:"color-bar",style:bn(n.value)},null,4)):mt("",!0)]))}},Y4=cn(gN,[["__scopeId","data-v-d7d79424"]]);xt(),fn();var vN=["role","aria-label"],yN=["data-item"],bN=["data-item"],wN={key:1,class:"sd-button-label"},CN=["data-item","aria-label"],kN=["innerHTML"],SN={key:2},_N=["onKeydown","id"],AN=["placeholder","onKeydown","id","data-item"],IN=["data-item","innerHTML"],xN={"aria-live":"polite",class:"sd-visually-hidden"},EN={__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}=dr(),o=e,{name:i,active:s,icon:a,label:l,hideLabel:c,iconColor:d,hasCaret:f,splitButton:h,disabled:g,expand:m,inlineTextInputVisible:v,hasInlineTextInput:k,minWidth:C,style:_,attributes:b}=o.toolbarItem,w=Ce(()=>!!h?.value&&!!f?.value),T=Ce(()=>i?.value??""),L=te(""),N=te(null),{isHighContrastMode:H}=Qi();Ft(()=>l?.value,ke=>{document.activeElement!==N.value&&(L.value=ke==null?"":String(ke))},{immediate:!0});const M=()=>{k&&_t(()=>{N.value?.focus(),N.value?.select()}),n("buttonClick")},V=ke=>{g?.value||(ke?.stopPropagation(),n("mainClick"))},q=()=>{w.value||M()},D=ke=>{if(w.value){V(ke);return}M()},B=ke=>{o.allowEnterPropagation||ke.stopPropagation(),D(ke)},E=ke=>{const oe=o.toolbarItem?.nestedOptions?.value??[],Re=ke.trim();if(!Re)return"";const je=oe.find(tt=>typeof tt?.label=="string"&&tt.label.toLowerCase()===Re.toLowerCase());return je?.label?je.label:oe.find(tt=>typeof tt?.label=="string"&&tt.label.toLowerCase().startsWith(Re.toLowerCase()))?.label??Re},j=()=>{const ke=String(L.value??"").trim();let oe=ke;if(T.value==="fontSize"){const Re=Number.parseFloat(ke);oe=ke.match(/^\d+(\.5)?$/)?ke:Number.isFinite(Re)?Math.floor(Re).toString():""}else T.value==="fontFamily"&&(oe=E(ke));return oe?(n("textSubmit",oe),L.value=oe,!0):!1},J=ke=>{const oe=ke?.currentTarget;oe instanceof HTMLInputElement&&(oe.focus({preventScroll:!0}),oe.select())},Y=ke=>{requestAnimationFrame(()=>{const oe=document.getElementById(`inlineTextInput-${ke}`);oe instanceof HTMLInputElement&&(oe.focus({preventScroll:!0}),oe.select())})},se=()=>{const ke=document.querySelector('[role="textbox"][aria-label*="SuperDoc body"], .ProseMirror');return ke instanceof HTMLElement?(ke.focus({preventScroll:!0}),!0):!1},pe=()=>{const ke=r?.$toolbar?.pendingSelectionCapture,oe=()=>{ke&&typeof r?.$toolbar?.ui?.selection?.restore=="function"&&r.$toolbar.ui.selection.restore(ke)};if(se()){oe();return}typeof r?.$toolbar?.superdoc?.focus=="function"&&(r.$toolbar.superdoc.focus(),oe())},Ve=()=>{j()&&pe()},ge=ke=>{if(j(),ke.shiftKey){T.value==="fontSize"&&(ke.preventDefault(),_t(()=>Y("fontFamily")));return}if(ke.preventDefault(),T.value==="fontFamily"){_t(()=>Y("fontSize"));return}T.value==="fontSize"&&_t(pe)},be=Ce(()=>_.value?_.value:{minWidth:o.minWidth}),ve=Ce(()=>m?.value?or.dropdownCaretUp:or.dropdownCaretDown);return(ke,oe)=>(ye(),Ie("div",{class:nn(["sd-toolbar-item",Xe(b).className]),style:bn(be.value),role:e.isOverflowItem?"menuitem":"button","aria-label":Xe(b).ariaLabel,"data-sd-part":"toolbar-item",onClick:q,onKeydown:oe[9]||(oe[9]=ei(Re=>B(Re),["enter"])),tabindex:"0"},[Fe("div",{class:nn(["sd-toolbar-button",{"sd-active":Xe(s),"sd-disabled":Xe(g),narrow:e.isNarrow,wide:e.isWide,split:w.value,"has-inline-text-input":Xe(k),"high-contrast":Xe(H)}]),"data-item":`btn-${Xe(i)||""}`},[w.value?(ye(),Ie("div",{key:0,class:"sd-toolbar-button__main","data-item":`btn-${Xe(i)||""}-main`,onClick:oe[0]||(oe[0]=Re=>V(Re))},[Xe(a)?(ye(),an(Y4,{key:0,color:Xe(d),class:"sd-toolbar-icon",icon:Xe(a),name:Xe(i)},null,8,["color","icon","name"])):mt("",!0),Xe(l)&&!Xe(c)&&!Xe(v)?(ye(),Ie("div",wN,jt(Xe(l)),1)):mt("",!0)],8,bN)):mt("",!0),w.value?(ye(),Ie("div",{key:1,class:"sd-toolbar-button__caret","data-item":`btn-${Xe(i)||""}-caret`,"aria-label":`${Xe(b).ariaLabel} options`,role:"button"},[Fe("div",{class:"sd-dropdown-caret",innerHTML:ve.value,style:bn({opacity:Xe(g)?.6:1})},null,12,kN)],8,CN)):(ye(),Ie($t,{key:2},[Xe(a)?(ye(),an(Y4,{key:0,color:Xe(d),class:"sd-toolbar-icon",icon:Xe(a),name:Xe(i)},null,8,["color","icon","name"])):mt("",!0),Xe(l)&&!Xe(c)&&(!Xe(v)||T.value==="fontFamily")?(ye(),Ie("div",{key:1,class:nn(["sd-button-label",{"sd-visually-hidden":Xe(v)&&T.value==="fontFamily"}])},jt(Xe(l)),3)):mt("",!0),Xe(v)?(ye(),Ie("span",SN,[Xe(i)==="fontSize"?ea((ye(),Ie("input",{key:0,"onUpdate:modelValue":oe[1]||(oe[1]=Re=>L.value=Re),onKeydown:[ei(en(Ve,["stop","prevent"]),["enter"]),oe[2]||(oe[2]=ei(Re=>ge(Re),["tab"]))],onClick:oe[3]||(oe[3]=en(Re=>J(Re),["stop"])),onFocus:oe[4]||(oe[4]=Re=>J(Re)),type:"text",class:nn(["button-text-input button-text-input--font-size",{"high-contrast":Xe(H)}]),id:"inlineTextInput-"+Xe(i),autocomplete:"off",ref_key:"inlineInput",ref:N},null,42,_N)),[[Li,L.value]]):ea((ye(),Ie("input",{key:1,"onUpdate:modelValue":oe[5]||(oe[5]=Re=>L.value=Re),placeholder:Xe(l),onKeydown:[ei(en(Ve,["stop","prevent"]),["enter"]),oe[6]||(oe[6]=ei(Re=>ge(Re),["tab"]))],onClick:oe[7]||(oe[7]=en(Re=>J(Re),["stop"])),onFocus:oe[8]||(oe[8]=Re=>J(Re)),type:"text",class:nn(["button-text-input",{"button-text-input--font-family":T.value==="fontFamily","high-contrast":Xe(H)}]),id:"inlineTextInput-"+Xe(i),"data-item":T.value==="fontFamily"?`btn-${Xe(i)}-input`:void 0,autocomplete:"off",ref_key:"inlineInput",ref:N},null,42,AN)),[[Li,L.value]])])):mt("",!0),Xe(f)?(ye(),Ie("div",{key:3,class:"sd-dropdown-caret","data-item":`btn-${Xe(i)||""}-toggle`,innerHTML:ve.value,style:bn({opacity:Xe(g)?.6:1})},null,12,IN)):mt("",!0)],64)),Fe("div",xN,jt(`${Xe(b).ariaLabel} ${Xe(s)?"selected":"unset"}`),1)],10,yN)],46,vN))}},X0=cn(EN,[["__scopeId","data-v-dbdea151"]]);xt(),fn();var TN={class:"toolbar-separator",role:"separator","aria-label":"Toolbar separator"},RN={__name:"ToolbarSeparator",props:{active:{type:Boolean,default:!1}},emits:["command"],setup(e,{emit:t}){const{isHighContrastMode:n}=Qi(),r=()=>n.value?"#000":"var(--sd-ui-border, #dbdbdb)";return(o,i)=>(ye(),Ie("div",TN,[Fe("div",{class:"separator-inner",style:bn({backgroundColor:r()})},null,4)]))}},LN=cn(RN,[["__scopeId","data-v-cb82253a"]]);xt(),fn();var MN={class:"overflow-menu"},PN={class:"overflow-menu-trigger"},DN={key:0,class:"overflow-menu_items",role:"group"},ON={__name:"OverflowMenu",props:{toolbarItem:{type:Object,required:!0},overflowItems:{type:Array,required:!0}},emits:["buttonClick","close"],setup(e,{emit:t}){const{proxy:n}=dr(),r=t,o=e,i=Ce(()=>o.toolbarItem.expand.value),s=te(!1),a=Ce(()=>({...o.toolbarItem,active:i.value})),l=()=>{r("buttonClick",o.toolbarItem)},c=({item:f,argument:h})=>{n.$toolbar.emitCommand({item:f,argument:h})},d=f=>{f.key==="Escape"&&i.value&&!s.value&&(f.preventDefault(),r("close"))};return Pn(()=>{document.addEventListener("keydown",d,!0)}),rr(()=>{document.removeEventListener("keydown",d,!0)}),(f,h)=>(ye(),Ie("div",MN,[Fe("div",PN,[Gt(X0,{"toolbar-item":a.value,onButtonClick:l},null,8,["toolbar-item"])]),i.value?(ye(),Ie("div",DN,[Gt(om,{class:"superdoc-toolbar-overflow","toolbar-items":e.overflowItems,"from-overflow":"",onCommand:c,onDropdownUpdateShow:h[0]||(h[0]=g=>s.value=g)},null,8,["toolbar-items"])])):mt("",!0)]))}},FN=cn(ON,[["__scopeId","data-v-504ecd05"]]);xt(),fn();var NN={class:"toolbar-dropdown"},BN=["onClick"],zN={key:0,class:"toolbar-dropdown-option__icon"},VN={class:"toolbar-dropdown-option__label"},tm='button, [href], input, select, textarea, [role="button"], [tabindex]:not([tabindex="-1"])',jN={__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}},emits:["update:show","select"],setup(e,{emit:t}){const n=e,r=t,o=te(null),i=te(null),s=te({top:"0px",left:"0px",maxHeight:"none"}),a=te([]),l=te(-1),c=Ce(()=>!!n.show),d=Ce(()=>n.options.some(oe=>oe?.type==="render")),f=Ce(()=>typeof n.menuProps!="function"?{}:n.menuProps()||{}),h=Ce(()=>{const{class:oe,style:Re,...je}=f.value;return je}),g=Ce(()=>["toolbar-dropdown-menu",f.value.class,{"toolbar-dropdown-menu--render-only":n.options.length>0&&n.options.every(oe=>oe&&oe.type==="render")}]),m=Ce(()=>{const oe=f.value.style||{};return{...n.contentStyle,...oe}}),v=Ce(()=>({...m.value,position:"fixed",top:s.value.top,left:s.value.left,maxHeight:s.value.maxHeight,zIndex:2e3})),k=oe=>{r("update:show",oe)},C=()=>{c.value&&k(!1)},_=()=>{if(!o.value)return;const oe=o.value.getBoundingClientRect(),Re=i.value,je=Re?.offsetWidth??0,tt=Re?.scrollHeight??Re?.offsetHeight??0,wt=window.innerWidth||document.documentElement.clientWidth||0,Te=window.innerHeight||document.documentElement.clientHeight||0,We=8,Ye=4,ee=oe.bottom+Ye,S=oe.top-Ye,ne=Math.max(0,Te-ee-We),O=Math.max(0,S-We),P=ne<tt&&O>ne,U=P?O:ne,$=P?Math.max(We,S-(tt?Math.min(tt,U):U)):ee;let Q=oe.left;n.placement==="bottom-end"&&(Q=oe.right-je);const Z=Math.max(We,wt-je-We);Q=Math.min(Math.max(We,Q),Z),s.value={top:`${$}px`,left:`${Q}px`,maxHeight:`${U}px`}},b=()=>{n.disabled||k(!c.value)},w=oe=>typeof n.nodeProps!="function"?{}:n.nodeProps(oe)||{},T=oe=>{oe?.disabled||oe?.type!=="render"&&(r("select",oe?.key,oe),C())},L=oe=>oe?.type==="render",N=oe=>!oe?.disabled&&oe?.type!=="render",H=oe=>typeof oe?.icon=="function"||!!oe?.icon,M=oe=>typeof oe?.icon=="function"?oe.icon(oe):oe?.icon||null,V=oe=>oe?typeof oe=="string"?oe.split(/\s+/).includes("sd-selected"):Array.isArray(oe)?oe.some(V):typeof oe=="object"?!!oe["sd-selected"]:!1:!1,q=oe=>V(oe?.props?.class)||V(oe?.class),D=()=>n.options.map((oe,Re)=>N(oe)?Re:-1).filter(oe=>oe>=0),B=()=>{const oe=n.options.findIndex(Re=>N(Re)&&q(Re));return oe>=0?oe:D()[0]??-1},E=(oe,Re)=>{if(!oe){delete a.value[Re];return}a.value[Re]=oe},j=()=>{a.value.forEach((Re,je)=>{Re&&Re.setAttribute("tabindex",je===l.value?"0":"-1")});const oe=a.value[l.value];oe&&typeof oe.focus=="function"&&(oe.focus(),oe.scrollIntoView?.({block:"nearest",inline:"nearest"}))},J=oe=>{const Re=D();if(!Re.length){l.value=-1;return}const je=Re.indexOf(l.value);if(je<0){l.value=oe>0?Re[0]:Re[Re.length-1];return}const tt=(je+oe+Re.length)%Re.length;l.value=Re[tt]},Y=()=>{let oe=n.options[l.value];if(!N(oe)){const Re=D()[0];oe=Re===void 0?null:n.options[Re]}oe&&T(oe)},se=jl({name:"ToolbarDropdownRenderOption",props:{option:{type:Object,required:!0}},setup(oe){return()=>typeof oe.option.render!="function"?null:oe.option.render()}}),pe=jl({name:"ToolbarDropdownOptionIcon",props:{option:{type:Object,required:!0}},setup(oe){return()=>M(oe.option)}}),Ve=oe=>{if(!c.value)return;const Re=oe.target;if(!(Re instanceof Element))return;const je=o.value?.contains(Re),tt=i.value?.contains(Re);je||tt||C()},ge=te(null),be=()=>{const oe=o.value,Re=document.activeElement;if(oe&&Re instanceof HTMLElement&&oe.contains(Re)){ge.value=Re;return}ge.value=oe?.matches?.(tm)?oe:oe?.querySelector(tm)},ve=()=>{const oe=ge.value;if(oe instanceof HTMLElement&&document.contains(oe)){oe.focus();return}const Re=o.value;if(!Re)return;const je=Re.matches?.(tm)?Re:Re.querySelector(tm);if(je instanceof HTMLElement){je.focus();return}Re.setAttribute("tabindex","-1"),Re.focus()},ke=oe=>{if(!c.value)return;const{key:Re}=oe;if(["Escape","ArrowDown","ArrowUp","Enter"].includes(Re)){if(Re==="Escape"){oe.preventDefault(),C(),_t(()=>{requestAnimationFrame(ve)});return}if(!d.value){if(oe.preventDefault(),Re==="ArrowDown"){J(1),j();return}if(Re==="ArrowUp"){J(-1),j();return}Re==="Enter"&&Y()}}};return Ft(c,async oe=>{if(!oe){l.value=-1,a.value=[];return}be(),await _t(),_(),!d.value&&(l.value=B(),await _t(),j())},{immediate:!0}),Ft(c,oe=>{oe?(document.addEventListener("pointerdown",Ve,!0),document.addEventListener("keydown",ke,!0),window.addEventListener("resize",_),window.addEventListener("scroll",_,!0)):(document.removeEventListener("pointerdown",Ve,!0),document.removeEventListener("keydown",ke,!0),window.removeEventListener("resize",_),window.removeEventListener("scroll",_,!0))},{immediate:!0}),rr(()=>{document.removeEventListener("pointerdown",Ve,!0),document.removeEventListener("keydown",ke,!0),window.removeEventListener("resize",_),window.removeEventListener("scroll",_,!0)}),(oe,Re)=>(ye(),Ie("div",NN,[Fe("div",{ref_key:"triggerRef",ref:o,class:"toolbar-dropdown-trigger","data-sd-part":"dropdown-trigger",onClick:b},[kd(oe.$slots,"trigger",{},void 0,!0)],512),(ye(),an(Ga,{to:"body"},[Gt(Hh,{name:"fade-in-scale-up-transition"},{default:Do(()=>[c.value?(ye(),Ie("div",bs({key:0,ref_key:"menuRef",ref:i,"data-sd-part":"dropdown-menu",class:g.value,style:v.value},h.value),[(ye(!0),Ie($t,null,ur(e.options,(je,tt)=>(ye(),Ie("div",bs({key:je.key,ref_for:!0,ref:wt=>E(wt,tt),class:["toolbar-dropdown-option",[je.class,je.props?.class,{"sd-disabled":je.disabled,"sd-render":L(je)}]],tabindex:"-1",onClick:wt=>T(je)},{ref_for:!0},{...je.props,...w(je)}),[L(je)?(ye(),an(Xe(se),{key:0,option:je},null,8,["option"])):(ye(),Ie($t,{key:1},[H(je)?(ye(),Ie("span",zN,[Gt(Xe(pe),{option:je},null,8,["option"])])):mt("",!0),Fe("span",VN,jt(je.label),1)],64))],16,BN))),128))],16)):mt("",!0)]),_:1})]))]))}},UN=cn(jN,[["__scopeId","data-v-fef410f7"]]),X4=e=>String(e??"").trim().toLowerCase(),nm=(e,t)=>{const n=X4(e);if(!n)return-1;for(let r=0;r<t.length;r+=1)if(X4(t[r]).startsWith(n))return r;return-1},HN=(e,t,{autocomplete:n=!0}={})=>{const r=String(e??""),o=nm(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}},$N=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},GN=e=>e<=31||e===127,WN=e=>e===32||e===160||e===65279,KN=e=>Array.from(String(e)).filter(t=>!GN(t.charCodeAt(0))).join(""),qN=e=>{let t="",n=!1;for(const r of String(e)){if(WN(r.charCodeAt(0))){n=t.length>0;continue}n&&(t+=" "),n=!1,t+=r}return t},YN=e=>{const t=String(e??"").split(",")[0]??"",n=KN(t);return qN($N(n)).trim()},XN=1,ZN=1638,QN=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<XN?"":String(Math.min(r,ZN))};xt(),fn();var JN=["data-item"],eB=["id","value","disabled","aria-label","aria-expanded","aria-controls","aria-activedescendant","data-item"],tB=["data-item","aria-label","disabled"],nB=["innerHTML"],rB=["id","aria-label"],oB=["id","aria-selected","aria-label","onMousedown","onMouseenter"],iB={class:"toolbar-dropdown-option__label"},sB={class:"sd-button-label sd-font-combobox__legacy-label","aria-hidden":"true"},aB={__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}=Qi(),i=te(null),s=te(null),a=te(null),l=te([]),c=te(!1),d=te(!1),f=te(-1),h=te(""),g=te(""),m=te(!1),v=te({top:"0px",left:"0px",minWidth:"0px",maxHeight:"none"}),k=Ce(()=>n.item.nestedOptions?.value??[]),C=Ce(()=>k.value.map(Z=>String(Z?.label??""))),_=Ce(()=>String(n.item.label?.value??"")),b=Ce(()=>!!n.item.disabled?.value),w=Ce(()=>String(n.item.name?.value??"")),T=Ce(()=>n.item.attributes?.value?.ariaLabel??"Font family"),L=Ce(()=>c.value?g.value:_.value),N=Ce(()=>`sd-${w.value||"combobox"}-listbox-${n.item.id?.value??"default"}`),H=Z=>`${N.value}-option-${Z}`,M=Ce(()=>d.value&&f.value>=0?H(f.value):void 0),V=Ce(()=>d.value?or.dropdownCaretUp:or.dropdownCaretDown),q=Z=>{const K=String(Z??"").trim().toLowerCase();return k.value.find(me=>String(me?.label??"").trim().toLowerCase()===K)?.props?.style?.fontFamily||Z||n.uiFontFamily},D=Ce(()=>n.showPreview?{fontFamily:q(c.value?g.value:_.value)}:{fontFamily:n.uiFontFamily}),B=()=>{const Z=n.item.selectedValue?.value;if(Z){const K=k.value.findIndex(me=>me?.key===Z);if(K>=0)return K}return C.value.findIndex(K=>K.toLowerCase()===_.value.toLowerCase())},E=(Z,K)=>{const me=i.value;if(!(!me||typeof me.setSelectionRange!="function"))try{me.setSelectionRange(Z,K)}catch{}},j=()=>{l.value[f.value]?.scrollIntoView?.({block:"nearest",inline:"nearest"})},J=()=>{l.value[f.value]?.focus?.()},Y=()=>{const Z=s.value;if(!Z)return;const K=Z.getBoundingClientRect(),me=a.value,xe=me?.scrollHeight??me?.offsetHeight??0,he=window.innerHeight||document.documentElement.clientHeight||0,Pe=window.innerWidth||document.documentElement.clientWidth||0,Je=8,nt=4,ut=K.bottom+nt,Ht=K.top-nt,He=Math.max(0,he-ut-Je),Vt=Math.max(0,Ht-Je),Mt=He<xe&&Vt>He,sn=Mt?Vt:He,qn=Mt?Math.max(Je,Ht-(xe?Math.min(xe,sn):sn)):ut,Kt=Math.min(Math.max(Je,K.left),Math.max(Je,Pe-K.width-Je));v.value={top:`${qn}px`,left:`${Kt}px`,minWidth:`${K.width}px`,maxHeight:`${sn}px`}},se=Ce(()=>({position:"fixed",top:v.value.top,left:v.value.left,minWidth:v.value.minWidth,maxHeight:v.value.maxHeight,fontFamily:n.uiFontFamily,zIndex:2e3})),pe=Z=>{n.item.expand&&typeof n.item.expand=="object"&&"value"in n.item.expand&&(n.item.expand.value=Z)},Ve=(Z,{focusInput:K=!1,focusOption:me=!1}={})=>{if(b.value||!k.value.length){pe(!1);return}d.value=!0,pe(!0),f.value=Z??-1,K&&(c.value=!0,g.value=_.value,i.value?.focus()),_t(()=>{Y(),j(),me&&J()})},ge=({syncItem:Z=!0}={})=>{d.value=!1,f.value=-1,Z&&pe(!1)},be=()=>{ge(),c.value=!1,h.value="",g.value=_.value},ve=()=>{b.value||(d.value||r("item-clicked"),c.value=!0,h.value="",g.value=_.value,_t(()=>E(0,g.value.length)))},ke=Z=>{if(b.value)return;const K=document.activeElement===i.value;if(r("item-clicked"),c.value=!0,K||(h.value="",g.value=_.value,Z.preventDefault(),i.value?.focus({preventScroll:!0}),E(0,_.value.length)),!d.value){const me=B();Ve(me>=0?me:0)}},oe=Z=>{const K=Z.relatedTarget;K instanceof Node&&s.value?.contains(K)||K instanceof Node&&a.value?.contains(K)||be()},Re=Z=>{if(m.value)return;const K=Z.target,me=K.value,xe=typeof K.selectionStart=="number"?K.selectionStart:me.length,he=typeof K.selectionEnd=="number"?K.selectionEnd:xe,Pe=typeof Z.inputType=="string"&&Z.inputType.startsWith("delete"),Je=xe===me.length&&he===me.length;h.value=me;const nt=HN(me,C.value,{autocomplete:!Pe&&Je});g.value=nt.display,K.value=nt.display,nt.display===me&&!Je?E(xe,he):E(nt.selectionStart,nt.selectionEnd),d.value&&(f.value=nt.matchIndex,_t(j))},je=Z=>{m.value=!1,Re(Z)},tt=Z=>{if(!k.value.length)return;const K=k.value.length,me=f.value<0?Z>0?-1:0:f.value;f.value=(me+Z+K)%K,_t(j)},wt=(Z,K)=>{r("item-clicked"),r("command",{item:n.item,argument:Z,option:K}),K&&(n.item.selectedValue.value=K.key)},Te=Z=>{Z&&(wt(Z.label,Z),c.value=!1,h.value="",g.value=Z.label,ge())},We=()=>{if(d.value&&f.value>=0)return Te(k.value[f.value]),!0;const Z=nm(h.value,C.value);if(Z>=0)return Te(k.value[Z]),!0;const K=n.normalizeValue(h.value);return K?(wt(K,null),c.value=!1,h.value="",g.value=K,ge(),!0):!1},Ye=Z=>{if(!(Z.isComposing||m.value||Z.keyCode===229)&&!(Z.ctrlKey||Z.metaKey||Z.altKey))switch(Z.key){case"ArrowDown":if(Z.preventDefault(),d.value)J();else{const K=nm(h.value,C.value),me=K>=0?K:B();Ve(me>=0?me:0,{focusOption:!0})}break;case"ArrowUp":if(Z.preventDefault(),d.value)J();else{const K=nm(h.value,C.value),me=K>=0?K:B();Ve(me>=0?me:k.value.length-1,{focusOption:!0})}break;case"Enter":Z.preventDefault(),We()&&r("editor-handoff"),i.value?.blur();break;case"Tab":Z.preventDefault(),We(),ge(),i.value?.blur(),r("tab-out",Z);break;case"Escape":Z.preventDefault(),be(),_t(()=>i.value?.focus())}},ee=Z=>{if(Z.preventDefault(),!b.value)if(r("item-clicked"),d.value)ge(),i.value?.focus();else{const K=B();Ve(K>=0?K:0,{focusOption:!0})}},S=(Z,K)=>{Z.preventDefault(),Te(K),r("editor-handoff"),i.value?.blur()},ne=Z=>{f.value=Z},O=Z=>{if(!(Z.ctrlKey||Z.metaKey||Z.altKey))switch(Z.key){case"ArrowDown":Z.preventDefault(),tt(1),J();break;case"ArrowUp":Z.preventDefault(),tt(-1),J();break;case"Enter":Z.preventDefault(),f.value>=0&&(Te(k.value[f.value]),r("editor-handoff"));break;case"Escape":Z.preventDefault(),be(),_t(()=>i.value?.focus());break;case"Tab":Z.preventDefault(),f.value>=0?Te(k.value[f.value]):ge(),r("tab-out",{shiftKey:Z.shiftKey,target:i.value})}},P=Z=>{if(!d.value)return;const K=Z.target;K instanceof Element&&(s.value?.contains(K)||a.value?.contains(K)||be())};Ft(d,Z=>{Z?(document.addEventListener("pointerdown",P,!0),window.addEventListener("resize",Y),window.addEventListener("scroll",Y,!0)):(document.removeEventListener("pointerdown",P,!0),window.removeEventListener("resize",Y),window.removeEventListener("scroll",Y,!0),l.value=[])},{immediate:!0}),rr(()=>{document.removeEventListener("pointerdown",P,!0),window.removeEventListener("resize",Y),window.removeEventListener("scroll",Y,!0)});const U=(Z,K)=>{if(!Z){delete l.value[K];return}l.value[K]=Z},$=Z=>Z===f.value,Q=Z=>Z?.key&&Z.key===n.item.selectedValue?.value;return Ft(_,Z=>{c.value||(g.value=Z)}),Ft(()=>!!n.item.expand?.value,Z=>{if(Z&&!d.value){const K=B();Ve(K>=0?K:0,{focusInput:!0});return}!Z&&d.value&&ge({syncItem:!1})}),(Z,K)=>(ye(),Ie("div",{ref_key:"rootRef",ref:s,class:nn(["sd-font-combobox sd-toolbar-split-field",{"sd-disabled":b.value,"high-contrast":Xe(o)}]),style:bn(n.item.style?.value),"data-item":`btn-${w.value}`},[Fe("span",{class:"sd-font-combobox__field sd-toolbar-split-field__main",onMousedown:ke},[Fe("input",{ref_key:"inputRef",ref:i,id:`inlineTextInput-${w.value}`,class:"button-text-input sd-font-combobox__input",type:"text",role:"combobox",autocomplete:"off",spellcheck:"false",value:L.value,style:bn(D.value),disabled:b.value,"aria-label":T.value,"aria-expanded":d.value?"true":"false","aria-controls":N.value,"aria-activedescendant":M.value,"aria-haspopup":"listbox","aria-autocomplete":"both","data-item":`btn-${w.value}-input`,onFocus:ve,onBlur:oe,onInput:Re,onKeydown:Ye,onCompositionstart:K[0]||(K[0]=me=>m.value=!0),onCompositionend:je},null,44,eB)],32),Fe("button",{type:"button",class:"sd-font-combobox__caret sd-toolbar-split-field__caret","data-item":`btn-${w.value}-toggle`,tabindex:"-1","aria-label":`${T.value} options`,disabled:b.value,onMousedown:ee},[Fe("span",{class:"sd-dropdown-caret",innerHTML:V.value},null,8,nB)],40,tB),(ye(),an(Ga,{to:"body"},[d.value?(ye(),Ie("div",{key:0,ref_key:"popupRef",ref:a,role:"listbox",id:N.value,"aria-label":T.value,class:nn(["sd-font-combobox__listbox",{"high-contrast":Xe(o)}]),style:bn(se.value)},[(ye(!0),Ie($t,null,ur(k.value,(me,xe)=>(ye(),Ie("div",bs({key:me.key,ref_for:!0,ref:he=>U(he,xe),id:H(xe),role:"option",tabindex:"-1",class:["toolbar-dropdown-option sd-font-combobox__option",{"sd-active":$(xe),"sd-selected":Q(me)}],"aria-selected":Q(me)?"true":"false","aria-label":`${T.value} - ${me.label}`},{ref_for:!0},me.props,{onMousedown:he=>S(he,me),onMouseenter:he=>ne(xe),onKeydown:O}),[Fe("span",iB,jt(me.label),1)],16,oB))),128))],14,rB)):mt("",!0)])),Fe("span",sB,jt(_.value),1)],14,JN))}},Z4=cn(aB,[["__scopeId","data-v-99070b63"]]);xt();var lB={__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)=>(ye(),an(Z4,{item:n.item,"ui-font-family":n.uiFontFamily,"show-preview":!0,"normalize-value":Xe(YN),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"]))}};xt();var cB={__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)=>(ye(),an(Z4,{item:n.item,"ui-font-family":n.uiFontFamily,"show-preview":!1,"normalize-value":Xe(QN),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"]))}};xt(),fn();var uB=2500,dB=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=q1(),r=te(!1),o=te(null),i=te(null),s=te({top:"0px",left:"0px"});let a=null,l=null,c=null;const d=Ce(()=>["sd-tooltip-content",n.class]),f=Ce(()=>({...t.contentStyle,...n.style||{},position:"fixed",top:s.value.top,left:s.value.left,zIndex:2100})),h=()=>{a&&(window.clearTimeout(a),a=null)},g=()=>{l&&(window.clearTimeout(l),l=null)},m=()=>{c&&(window.clearTimeout(c),c=null)},v=()=>{m(),c=window.setTimeout(()=>{c=null,_()},uB)},k=()=>{if(!o.value||!i.value)return;const V=o.value.getBoundingClientRect(),q=i.value.offsetWidth,D=i.value.offsetHeight,B=window.innerWidth||document.documentElement.clientWidth||0,E=8;let j=V.left+V.width/2-q/2;j=Math.max(E,Math.min(j,B-q-E)),s.value={top:`${V.top-D-10}px`,left:`${j}px`}},C=async()=>{t.disabled||(h(),g(),!r.value&&(r.value=!0,v(),await _t(),k()))},_=()=>{g(),h(),m(),r.value&&(r.value=!1)},b=()=>{if(h(),g(),!r.value){if(t.delay===0){C();return}l=window.setTimeout(()=>{l=null,C()},t.delay)}},w=()=>{if(g(),h(),!!r.value){if(t.duration===0){_();return}a=window.setTimeout(()=>{a=null,_()},t.duration)}},T=()=>{t.trigger==="hover"&&b()},L=()=>{t.trigger==="hover"&&w()},N=()=>{g(),h()},H=()=>{w()},M=V=>{V.key==="Escape"&&_()};return Ft(()=>t.disabled,V=>{V&&_()}),Ft(r,V=>{V?(window.addEventListener("resize",k),window.addEventListener("scroll",k,!0),document.addEventListener("keydown",M,!0)):(window.removeEventListener("resize",k),window.removeEventListener("scroll",k,!0),document.removeEventListener("keydown",M,!0))}),rr(()=>{g(),h(),m(),window.removeEventListener("resize",k),window.removeEventListener("scroll",k,!0),document.removeEventListener("keydown",M,!0)}),(V,q)=>(ye(),Ie($t,null,[Fe("span",{ref_key:"triggerRef",ref:o,class:"sd-tooltip-trigger",onMouseenter:T,onMouseleave:L,onFocusin:T,onFocusout:L},[kd(V.$slots,"trigger",{},void 0,!0)],544),(ye(),an(Ga,{to:"body"},[Gt(Hh,{name:"fade-in-scale-up-transition"},{default:Do(()=>[r.value&&!e.disabled?(ye(),Ie("div",{key:0,ref_key:"contentRef",ref:i,class:nn(d.value),style:bn(f.value),onMouseenter:N,onMouseleave:H},[q[0]||(q[0]=Fe("span",{class:"sd-tooltip-arrow","aria-hidden":"true"},null,-1)),kd(V.$slots,"default",{},void 0,!0)],38)):mt("",!0)]),_:3})]))],64))}}),rm=cn(dB,[["__scopeId","data-v-2a872eae"]]),Su=(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})};xt(),fn();var fB=["onKeydown","tabindex","data-item-id"],hB={key:0},pB={key:0},mB={key:0},gB={key:0},vB={key:0},yB={__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}=dr(),o=te([]),i=te(null),s=e,a=te(null),{isHighContrastMode:l}=Qi(),c=window.matchMedia("(max-width: 768px)").matches,d=Ce(()=>s.position==="left"?{minWidth:s.compactSideGroups?"auto":"120px",justifyContent:"flex-start"}:s.position==="right"?{minWidth:s.compactSideGroups?"auto":"120px",justifyContent:"flex-end"}:{flexGrow:c?0:1,justifyContent:"center"}),f=Te=>Te.type==="button",h=Te=>Te.type==="dropdown",g=Te=>Te.type==="dropdown"&&Te.name?.value==="fontFamily",m=Te=>Te.type==="dropdown"&&Te.name?.value==="fontSize",v=Te=>Te.type==="separator",k=Te=>Te.type==="overflow",C=Te=>!!Te.nestedOptions?.value?.length,_=Te=>{if(!Te)return!1;const We=Te.expand;return typeof We=="object"&&We!==null&&"value"in We?!!We.value:!!We},b=(Te,We)=>{Te?.expand&&(Te.expand.value=We)},w=(Te,We=void 0)=>{if(Te.disabled.value)return;if(k(Te)){const ee=!_(Te);ee&&N(),b(Te,ee),a.value=ee?Te:null,n("item-clicked");return}if(h(Te))return;a.value&&h(a.value)&&_(a.value)&&N(),n("item-clicked");const Ye=We!==void 0?We:Te.argument?.value;n("command",Ye===void 0?{item:Te}:{item:Te,argument:Ye})},T=(Te,We)=>{Te.disabled.value||(a.value=null,n("command",{item:Te,argument:We}))},L=Te=>{if(Te.disabled.value)return;N();const We=Te.splitButtonCommand,Ye=Te.command,ee=We||Ye;if(!ee)return;const S={...Te,command:ee};n("item-clicked"),n("command",{item:S})},N=()=>{const Te=r?.$toolbar?.toolbarItems||[],We=r?.$toolbar?.overflowItems||[],Ye=[...Te,...We];(Ye.length?Ye:s.toolbarItems).forEach(ee=>{const S=k(ee)&&!s.fromOverflow;(h(ee)||S)&&b(ee,!1)}),a.value=null},H=(Te,We)=>{N();const Ye=Te.dropdownValueKey.value?We[Te.dropdownValueKey.value]:We.label;n("command",{item:Te,argument:Ye,option:We}),Te.selectedValue.value=We.key,Te.restoreEditorFocus&&Su(r?.$toolbar)},M=Te=>{n("command",Te)},V=()=>{N(),n("item-clicked")},q=()=>{const Te=document.querySelector('[role="textbox"][aria-label*="SuperDoc body"], .ProseMirror');return Te instanceof HTMLElement?(Te.focus({preventScroll:!0}),!0):!1},D=()=>{const Te=r?.$toolbar?.pendingSelectionCapture,We=()=>{Te&&typeof r?.$toolbar?.ui?.selection?.restore=="function"&&r.$toolbar.ui.selection.restore(Te)};if(q()){We();return}typeof r?.$toolbar?.superdoc?.focus=="function"&&(r.$toolbar.superdoc.focus(),We())},B=Te=>!(Te instanceof HTMLElement)||Te.classList.contains("sd-disabled")?null:Te.querySelector("input:not([disabled]), textarea:not([disabled]), select:not([disabled])")||Te.querySelector('button:not([disabled]), [role="button"]:not(.sd-disabled), [tabindex]:not([tabindex="-1"])'),E=(Te,We)=>{const Ye=Te?.target?.closest?.(".sd-toolbar-item-ctn");if(!(Ye instanceof HTMLElement))return!1;let ee=We>0?Ye.nextElementSibling:Ye.previousElementSibling;for(;ee;){const S=B(ee);if(S instanceof HTMLElement)return Ye.setAttribute("tabindex","-1"),ee.setAttribute("tabindex","0"),S.focus(),!0;ee=We>0?ee.nextElementSibling:ee.previousElementSibling}return!1},j=Te=>{N();const We=Te?.shiftKey?-1:1;E(Te,We)||D()},J=Te=>{if(N(),Te?.shiftKey){E(Te,-1)||D();return}D()},Y=()=>{D()},se=Te=>Te.nestedOptions?.value?.length?Te.nestedOptions.value.map(We=>{const Ye=We?.type!=="render"&&Te.selectedValue.value===We.key;return{...We,props:{...We.props,class:Ye?"sd-selected":""}}}):[],pe=(Te,We)=>({role:"menuitem",ariaLabel:`${We.attributes.value.ariaLabel} - ${Te.label}`}),Ve=Te=>{const We=Te.target,Ye=Te.target.closest(".sd-toolbar-item-ctn").nextElementSibling;Ye&&(We.setAttribute("tabindex","-1"),Ye.setAttribute("tabindex","0"),Ye.focus())},ge=Te=>{const We=Te.target,Ye=Te.target.closest(".sd-toolbar-item-ctn").previousElementSibling;Ye&&(We.setAttribute("tabindex","-1"),Ye.setAttribute("tabindex","0"),Ye.focus())},be=Te=>{const We=Te.target.closest(".button-group").nextElementSibling;if(We)We.setAttribute("tabindex","0"),We.focus();else{const Ye=document.querySelector(".ProseMirror");Ye&&Ye.focus()}},ve=Te=>{const We=Te.target.closest(".button-group").previousElementSibling;We&&(We.setAttribute("tabindex","0"),We.focus())},ke=Te=>{if(!Te.disabled.value){if(h(Te)){je(!_(Te),Te);return}w(Te)}},oe=(Te,We)=>{const Ye=Te.target.nodeName==="INPUT"||Te.target.nodeName==="TEXTAREA",ee=We.name.value==="fontSize"||We.name.value==="fontFamily";if(!(Ye&&ee)&&["Enter"," ","Spacebar","Escape","ArrowRight","ArrowLeft","Tab"].includes(Te.key))switch(Te.preventDefault(),Te.key){case"Enter":case" ":case"Spacebar":ke(We);break;case"Escape":N();break;case"ArrowRight":N(),Ve(Te);break;case"ArrowLeft":N(),ge(Te);break;case"Tab":Te.shiftKey?ve(Te):be(Te)}},Re=Te=>{const We=o.value.find(Ye=>!Ye.classList.contains("sd-disabled"));We&&(We.setAttribute("tabindex","0"),We.focus())},je=(Te,We)=>{if(n("item-clicked"),!Te){N(),n("dropdown-update-show",!1);return}N(),a.value=We,b(We,!0),n("dropdown-update-show",!0)},tt=Te=>{if(!a.value)return;const We=Te.target;We instanceof Element&&(We.closest(".sd-toolbar-dropdown-menu")||i.value?.contains(We)||N())};return Ft(()=>_(a.value),Te=>{Te?document.addEventListener("pointerdown",tt,!0):document.removeEventListener("pointerdown",tt,!0)},{immediate:!0}),rr(()=>{document.removeEventListener("pointerdown",tt,!0)}),(Te,We)=>(ye(),Ie("div",{style:bn(d.value),class:"button-group",role:"group",onFocus:Re,ref_key:"buttonGroupRef",ref:i},[(ye(!0),Ie($t,null,ur(e.toolbarItems,(Ye,ee)=>(ye(),Ie("div",{key:Ye.id.value,class:nn([{narrow:Ye.isNarrow.value,wide:Ye.isWide.value,"sd-disabled":Ye.disabled.value},"sd-toolbar-item-ctn"]),onKeydown:S=>oe(S,Ye),ref_for:!0,ref_key:"toolbarItemRefs",ref:o,tabindex:ee===0?0:-1,"data-item-id":Ye.id.value},[v(Ye)?(ye(),an(LN,{key:0,style:{width:"20px"}})):mt("",!0),g(Ye)&&C(Ye)?(ye(),an(rm,{key:1,trigger:"hover",disabled:!Ye.tooltip?.value,"content-style":{fontFamily:s.uiFontFamily}},{trigger:Do(()=>[Gt(lB,{item:Ye,"ui-font-family":s.uiFontFamily,class:"sd-toolbar-button sd-editor-toolbar-dropdown",onCommand:M,onItemClicked:V,onTabOut:We[0]||(We[0]=S=>j(S)),onEditorHandoff:Y},null,8,["item","ui-font-family"])]),default:Do(()=>[Fe("div",null,[qi(jt(Ye.tooltip)+" ",1),Ye.disabled.value?(ye(),Ie("span",hB,"(disabled)")):mt("",!0)])]),_:2},1032,["disabled","content-style"])):m(Ye)&&C(Ye)?(ye(),an(rm,{key:2,trigger:"hover",disabled:!Ye.tooltip?.value,"content-style":{fontFamily:s.uiFontFamily}},{trigger:Do(()=>[Gt(cB,{item:Ye,"ui-font-family":s.uiFontFamily,class:"sd-toolbar-button sd-editor-toolbar-dropdown",onCommand:M,onItemClicked:V,onTabOut:We[1]||(We[1]=S=>J(S)),onEditorHandoff:Y},null,8,["item","ui-font-family"])]),default:Do(()=>[Fe("div",null,[qi(jt(Ye.tooltip)+" ",1),Ye.disabled.value?(ye(),Ie("span",pB,"(disabled)")):mt("",!0)])]),_:2},1032,["disabled","content-style"])):h(Ye)&&Ye.nestedOptions?.value?.length?(ye(),an(UN,{key:3,options:se(Ye),disabled:Ye.disabled.value,show:_(Ye),"content-style":{fontFamily:s.uiFontFamily},placement:"bottom-start",class:"sd-toolbar-button sd-editor-toolbar-dropdown",onSelect:(S,ne)=>H(Ye,ne),"onUpdate:show":S=>je(S,Ye),style:bn(Ye.dropdownStyles.value),"menu-props":()=>({role:"menu",style:{fontFamily:s.uiFontFamily},class:["sd-toolbar-dropdown-menu",{"high-contrast":Xe(l)}]}),"node-props":S=>pe(S,Ye)},{trigger:Do(()=>[Gt(rm,{trigger:"hover",disabled:!Ye.tooltip?.value,"content-style":{fontFamily:s.uiFontFamily}},{trigger:Do(()=>[Gt(X0,{"toolbar-item":Ye,disabled:Ye.disabled.value,"allow-enter-propagation":!0,onTextSubmit:S=>T(Ye,S),onMainClick:S=>L(Ye)},null,8,["toolbar-item","disabled","onTextSubmit","onMainClick"])]),default:Do(()=>[Fe("div",null,[qi(jt(Ye.tooltip)+" ",1),Ye.disabled.value?(ye(),Ie("span",mB,"(disabled)")):mt("",!0)])]),_:2},1032,["disabled","content-style"])]),_:2},1032,["options","disabled","show","content-style","onSelect","onUpdate:show","style","menu-props","node-props"])):f(Ye)?(ye(),an(rm,{key:4,trigger:"hover",class:"sd-editor-toolbar-tooltip","content-style":{fontFamily:s.uiFontFamily}},{trigger:Do(()=>[Gt(X0,{"toolbar-item":Ye,"is-overflow-item":e.fromOverflow,onTextSubmit:S=>T(Ye,S),onButtonClick:S=>w(Ye)},null,8,["toolbar-item","is-overflow-item","onTextSubmit","onButtonClick"])]),default:Do(()=>[Ye.tooltip?(ye(),Ie("div",gB,[qi(jt(Ye.tooltip)+" ",1),Ye.disabled.value?(ye(),Ie("span",vB,"(disabled)")):mt("",!0)])):mt("",!0)]),_:2},1032,["content-style"])):mt("",!0),k(Ye)&&e.overflowItems.length?(ye(),an(FN,{key:5,"toolbar-item":Ye,onButtonClick:S=>w(Ye),"overflow-items":e.overflowItems,onClose:N},null,8,["toolbar-item","onButtonClick","overflow-items"])):mt("",!0)],42,fB))),128))],36))}},om=cn(yB,[["__scopeId","data-v-2bc00f65"]]),bB=[["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"]],wB=bB.map(([e,t])=>({label:e,key:e,props:{style:{fontFamily:`${e}, ${t}`},"data-item":"btn-fontFamily-option"}}));function CB(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 kB=[{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"}}],Tf={sm:768,md:1024,lg:1280,xl:1410},Z0={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"},Q4={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"},J4=Object.values(Q4),LH=[...new Set([...Object.values(Z0),...J4])],SB=new Set(["link"]),MH=new Set(Object.keys(Z0).filter(e=>!SB.has(e)));xt(),fn();var _B="Arial, Helvetica, sans-serif",AB={__name:"Toolbar",emits:["command","toggle","select"],setup(e,{emit:t}){const{proxy:n}=dr();let r=te(1);const o=te(0),i=te(!1);let s=null,a=null;const l=Ce(()=>{const H=n?.$toolbar?.config?.uiDisplayFallbackFont;return typeof H=="string"&&H.trim()?H.trim():_B}),c=n.$toolbar.config?.toolbarGroups?.includes("left"),d=n.$toolbar.config?.toolbarGroups?.includes("right"),f=n.$toolbar.config?.toolbarButtonsExclude||[],h=H=>(o.value,n.$toolbar.getToolbarItemByGroup(H).filter(M=>!f.includes(M.name.value))),g=()=>{i.value=n.$toolbar.getAvailableWidth()<=Tf.lg},v=hN(async()=>{await n.$toolbar.onToolbarResize(),g(),r.value+=1},300),k=()=>{r.value+=1},C=()=>{o.value+=1};function _(){window.removeEventListener("resize",v),n.$toolbar.off?.("toolbar-items-changed",k),n.$toolbar.off?.("toolbar-state-change",C),s?.disconnect(),s=null}function b(){_(),window.addEventListener("resize",v),n.$toolbar.on?.("toolbar-items-changed",k),n.$toolbar.on?.("toolbar-state-change",C),typeof ResizeObserver<"u"&&n.$toolbar.config?.responsiveToContainer&&n.$toolbar.toolbarContainer&&(s=new ResizeObserver(()=>{v()}),s.observe(n.$toolbar.toolbarContainer)),g()}Pn(b),xg(b),Eg(_),rr(_);const w=()=>{if(!n.$toolbar.activeEditor){a=null,n.$toolbar.pendingSelectionCapture=null;return}a=n.$toolbar.ui?.selection?.capture?.()??null,n.$toolbar.pendingSelectionCapture=a},T=({item:H,argument:M,option:V})=>{L(),n.$toolbar.emitCommand({item:H,argument:M,option:V})},L=()=>{const H=n.$toolbar.activeEditor;if(!H)return;const M=n.$toolbar.pendingSelectionCapture??a;if(M&&typeof n.$toolbar.ui?.selection?.restore=="function"){n.$toolbar.ui.selection.restore(M);return}H.commands?.restoreSelection?.()},N=H=>{w(),!H.target.closest('input, textarea, [contenteditable="true"]')&&H.preventDefault()};return(H,M)=>(ye(),Ie("div",{class:"superdoc-toolbar",key:Xe(r),role:"toolbar","aria-label":"Toolbar","data-sd-part":"toolbar","data-editor-ui-surface":"",onMousedown:N},[Xe(c)?(ye(),an(om,{key:0,tabindex:"0","toolbar-items":h("left"),"overflow-items":Xe(n).$toolbar.overflowItems,"compact-side-groups":i.value,"ui-font-family":l.value,position:"left",onCommand:T,class:"superdoc-toolbar-group-side"},null,8,["toolbar-items","overflow-items","compact-side-groups","ui-font-family"])):mt("",!0),Gt(om,{tabindex:"0","toolbar-items":h("center"),"overflow-items":Xe(n).$toolbar.overflowItems,"compact-side-groups":i.value,"ui-font-family":l.value,position:"center",onCommand:T},null,8,["toolbar-items","overflow-items","compact-side-groups","ui-font-family"]),Xe(d)?(ye(),an(om,{key:1,tabindex:"0","toolbar-items":h("right"),"overflow-items":Xe(n).$toolbar.overflowItems,"compact-side-groups":i.value,"ui-font-family":l.value,position:"right",onCommand:T,class:"superdoc-toolbar-group-side"},null,8,["toolbar-items","overflow-items","compact-side-groups","ui-font-family"])):mt("",!0)],32))}},IB=cn(AB,[["__scopeId","data-v-55b5af7a"]]),xB=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"}}};xt();var In=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=te(ps()),n=e.type,r=te(e.name),o=e.command,i=e.noArgumentCommand,s=te(e.icon),a=te(e.group||"center"),l=te(e.allowWithoutEditor),c=te(e.attributes||{}),d=e.disabled||!1,f=te(e.disabled),h=te(!1),g=te(!1),m=te(e.style),v=te(e.isNarrow),k=te(e.isWide),C=te(e.minWidth),_=te(e.suppressActiveHighlight||!1),b=te(e.argument),w=te(null),T=te(null),L=te(e.iconColor),N=te(e.hasCaret),H=te(!!e.splitButton),M=e.splitButtonCommand,V=!!e.restoreEditorFocus,q=te(e.dropdownStyles),D=te(e.tooltip),B=te(e.tooltipVisible),E=te(e.tooltipTimeout),j=te(e.defaultLabel),J=te(e.label),Y=te(e.hideLabel),se=te(e.inlineTextInputVisible),pe=te(e.hasInlineTextInput),Ve=te(e.markName),ge=te(e.labelAttr),be=te(e.selectedValue),ve=te(e.dropdownValueKey),ke=te(e.inputRef||null),oe=te([]);if(e.options){if(!Array.isArray(e.options))throw new Error("Invalid toolbar item options - "+e.options);let S=0;for(let ne=0;ne<e.options.length;ne+=1){const O=e.options[ne];(!O||typeof O!="object")&&(S+=1)}if(S)throw new Error(`Toolbar item options must all be objects - ${e.name}. ${S} row(s) are not, so this item is skipped.`);oe.value?.push(...e.options)}const Re=(S={},...ne)=>{Te(S,...ne),!_.value&&(h.value=!0)},je=()=>{We(),h.value=!1},tt=S=>{f.value=S},wt=()=>{f.value=d},Te=e.onActivate||(()=>null),We=e.onDeactivate||(()=>null),Ye=()=>{const S={};return Object.keys(ee).forEach(ne=>{ee[ne].value!==void 0&&(S[ne]=ee[ne].value)}),S},ee={id:t,name:r,type:n,command:o,noArgumentCommand:i,icon:s,tooltip:D,group:a,attributes:c,disabled:f,active:h,expand:g,nestedOptions:oe,style:m,isNarrow:v,isWide:k,minWidth:C,argument:b,parentItem:T,iconColor:L,hasCaret:N,splitButton:H,splitButtonCommand:M,dropdownStyles:q,tooltipVisible:B,tooltipTimeout:E,defaultLabel:j,label:J,hideLabel:Y,inlineTextInputVisible:se,hasInlineTextInput:pe,restoreEditorFocus:V,markName:Ve,labelAttr:ge,childItem:w,allowWithoutEditor:l,dropdownValueKey:ve,selectedValue:be,inputRef:ke};return{...ee,unref:Ye,activate:Re,deactivate:je,setDisabled:tt,resetDisabled:wt,onActivate:Te,onDeactivate:We}};xt(),fn();var EB=["onClick","innerHTML","aria-label","onKeydown"],TB={__name:"AlignmentButtons",emits:["select"],setup(e,{emit:t}){const{isHighContrastMode:n}=Qi(),r=t,o=te([]),i=[{key:"left",ariaLabel:"Align left",icon:or.alignLeft},{key:"center",ariaLabel:"Align center",icon:or.alignCenter},{key:"right",ariaLabel:"Align right",icon:or.alignRight},{key:"justify",ariaLabel:"Justify",icon:or.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())},c=(d,f)=>{switch(d.key){case"ArrowLeft":l(f);break;case"ArrowRight":a(f);break;case"Enter":s(i[f].key)}};return Pn(()=>{const d=o.value[0];d&&(d.setAttribute("tabindex","0"),d.focus())}),(d,f)=>(ye(),Ie("div",{class:nn(["alignment-buttons",{"high-contrast":Xe(n)}])},[(ye(),Ie($t,null,ur(i,(h,g)=>Fe("div",{key:h.key,class:"sd-button-icon",onClick:m=>s(h.key),innerHTML:h.icon,"data-item":"btn-textAlign-option",role:"menuitem","aria-label":h.ariaLabel,ref_for:!0,ref_key:"alignmentButtonsRefs",ref:o,onKeydown:en(m=>c(m,g),["prevent"])},null,40,EB)),64))],2))}},RB=cn(TB,[["__scopeId","data-v-13e5f7a4"]]);xt(),fn();var LB=["onClick","innerHTML","aria-label","onKeydown"],MB={__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}=Qi(),r=t,o=e,i=te([]),s=Ce(()=>({width:`${o.iconSize}px`,height:`${o.iconSize}px`})),a=f=>{r("select",f)},l=f=>{if(f===i.value.length-1)return;const h=i.value[f+1];h&&(h.setAttribute("tabindex","0"),h.focus())},c=f=>{if(f===0)return;const h=i.value[f-1];h&&(h.setAttribute("tabindex","0"),h.focus())},d=(f,h)=>{switch(f.key){case"ArrowLeft":c(h);break;case"ArrowRight":l(h);break;case"Enter":a(o.buttons[h].key)}};return Pn(()=>{const f=i.value[0];f&&(f.setAttribute("tabindex","0"),f.focus())}),(f,h)=>(ye(),Ie("div",{class:nn(["style-buttons-list",{"high-contrast":Xe(n)}])},[(ye(!0),Ie($t,null,ur(o.buttons,(g,m)=>(ye(),Ie("div",{key:g.key,class:nn(["sd-button-icon",{"sd-selected":o.selectedStyle===g.key}]),style:bn(s.value),onClick:v=>a(g.key),innerHTML:g.icon,role:"menuitem","aria-label":g.ariaLabel,ref_for:!0,ref_key:"buttonRefs",ref:i,onKeydown:en(v=>d(v,m),["prevent"])},null,46,LB))),128))],2))}},eA=cn(MB,[["__scopeId","data-v-44f37ff6"]]),PB=[{key:"disc",icon:or.bulletListDisc,ariaLabel:"Opaque circle"},{key:"circle",icon:or.bulletListCircle,ariaLabel:"Outline circle"},{key:"square",icon:or.bulletListSquare,ariaLabel:"Opaque square"}],DB=[{key:"decimal",icon:or.numberedListDecimal,ariaLabel:"1. 2. 3."},{key:"decimal-paren",icon:or.numberedListDecimalParen,ariaLabel:"1) 2) 3)"},{key:"upper-roman",icon:or.numberedListUpperRoman,ariaLabel:"I. II. III."},{key:"lower-roman",icon:or.numberedListLowerRoman,ariaLabel:"i. ii. iii."},{key:"upper-alpha",icon:or.numberedListUpperAlpha,ariaLabel:"A. B. C."},{key:"upper-alpha-paren",icon:or.numberedListUpperAlphaParen,ariaLabel:"A) B) C)"},{key:"lower-alpha",icon:or.numberedListLowerAlpha,ariaLabel:"a. b. c."},{key:"lower-alpha-paren",icon:or.numberedListLowerAlphaParen,ariaLabel:"a) b) c)"}];xt(),fn();var OB=["onClick","onKeydown"],FB={class:"document-mode-column icon-column"},NB=["innerHTML"],BB={class:"document-mode-column text-column"},zB={class:"document-mode-type"},VB={class:"document-mode-description"},jB={__name:"DocumentMode",props:{options:{type:Array}},emits:["select"],setup(e,{emit:t}){const n=t,r=te([]),{isHighContrastMode:o}=Qi(),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())},c=(d,f)=>{switch(d.key){case"ArrowDown":a(f);break;case"ArrowUp":l(f);break;case"Enter":s(i.options[f])}};return Pn(()=>{r.value[0].setAttribute("tabindex","0"),r.value[0].focus()}),(d,f)=>(ye(),Ie("div",{class:nn(["document-mode",{"high-contrast":Xe(o)}])},[(ye(!0),Ie($t,null,ur(e.options,(h,g)=>(ye(),Ie("div",{class:nn(["sd-option-item",{"sd-disabled":h.disabled}]),onClick:m=>s(h),"data-item":"btn-documentMode-option",role:"menuitem",ref_for:!0,ref_key:"documentModeRefs",ref:r,onKeydown:en(m=>c(m,g),["prevent"])},[Fe("div",FB,[Fe("div",{class:"icon-column__icon",innerHTML:h.icon},null,8,NB)]),Fe("div",BB,[Fe("div",zB,jt(h.label),1),Fe("div",VB,jt(h.description),1)])],42,OB))),256))],2))}},UB=cn(jB,[["__scopeId","data-v-bee14d7a"]]);xt(),fn();var HB={class:"linked-style-buttons","data-editor-ui-surface":""},$B=["onClick","onKeydown","aria-label"],GB={__name:"LinkedStyle",props:{styles:{type:Array,default:()=>[]},selectedOption:{type:String,default:null}},emits:["select"],setup(e,{emit:t}){const n=t,r=te([]),o=e,i=f=>{n("select",f)},s=f=>{if(f===r.value.length-1)return;const h=r.value[f+1];h.setAttribute("tabindex","0"),h.focus()},a=f=>{if(f===0)return;const h=r.value[f-1];h.setAttribute("tabindex","0"),h.focus()},l=(f,h,g)=>{switch(f.key){case"ArrowDown":s(h);break;case"ArrowUp":a(h);break;case"Enter":f.preventDefault(),i(g)}},c=f=>f?.name??f?.id??"",d=f=>{const h=f?.preview?.css;return h&&typeof h=="object"?h:void 0};return Pn(()=>{r.value[0]&&(r.value[0].setAttribute("tabindex","0"),r.value[0].focus())}),(f,h)=>(ye(),Ie("div",HB,[(ye(!0),Ie($t,null,ur(o.styles,(g,m)=>(ye(),Ie("div",{key:g.id??m,class:nn(["style-item",{selected:e.selectedOption===g.id}]),onClick:v=>i(g),onKeydown:v=>l(v,m,g),"aria-label":`Linked style - ${g.id??c(g)}`,ref_for:!0,ref_key:"styleRefs",ref:r},[Fe("div",{class:"style-name","data-item":"btn-linkedStyles-option",style:bn(d(g))},jt(c(g)),5)],42,$B))),128))]))}},WB=cn(GB,[["__scopeId","data-v-43b5dcca"]]);xt(),fn();var KB=["placeholder"],qB={class:"sd-ai-writer__footer"},YB={key:0,class:"sd-ai-writer__error",role:"alert"},XB=["disabled"],ZB="https://sd-dev-express-gateway-i6xtm.ondigitalocean.app/insights",QB="You are an expert copywriter and you are immersed in a document editor. Only write what is asked for.",JB={__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=te(""),r=te(!1),o=te(""),i=te(null),s=Ce(()=>t.selectedText?"Insert prompt to update text":"Insert prompt to generate text"),a=Ce(()=>n.value.trim().length>0&&!r.value);Pn(()=>{_t(()=>{i.value?.focus()})});function l(m){if(typeof m=="string")return m;if(!m||typeof m!="object")return"";const v=m.custom_prompt;if(Array.isArray(v)){const k=v[0];if(k&&typeof k.value=="string")return k.value}return v&&typeof v=="object"&&typeof v.value=="string"?v.value:typeof m.value=="string"?m.value:typeof m.text=="string"?m.text:""}async function c(m){const v={"Content-Type":"application/json"};t.apiKey&&(v["x-api-key"]=t.apiKey);const k=t.selectedText.trim(),C=k?`Rewrite the following text: "${k}" using these instructions: ${m}`:`Generate text based on the following prompt: ${m}`,_=await fetch(t.endpoint||ZB,{method:"POST",headers:v,body:JSON.stringify({stream:!1,context:QB,insights:[{type:"custom_prompt",name:k?"text_rewrite":"text_generation",message:C,format:[{value:""}]}]})});if(!_.ok){const w=await _.text().catch(()=>"");throw new Error(w||`AI request failed with ${_.status}`)}const b=l((_.headers.get("content-type")||"").includes("application/json")?await _.json():await _.text()).trim();if(!b)throw new Error("AI returned no text.");return b}function d(m){return!m||typeof m!="object"?!0:!(m.success===!1||m.ok===!1)}function f(m){const v=t.doc;if(!v)throw new Error("Document API is unavailable.");t.restoreSelection?.();let k=null,C=!1;if(t.selectedText&&t.target&&typeof v.replace=="function"?(k=v.replace({target:t.target,text:m}),C=!0):t.target&&typeof v.insert=="function"?(k=v.insert({target:t.target,value:m,type:"text"}),C=!0):typeof v.insert=="function"&&(k=v.insert({value:m,type:"text"}),C=!0),!C)throw new Error("Document text insertion is unavailable.");if(!d(k))throw new Error("Unable to insert generated text.")}async function h(){if(a.value){o.value="",r.value=!0;try{f(await c(n.value.trim())),t.handleClose()}catch(m){o.value=m instanceof Error?m.message:String(m)}finally{r.value=!1}}}function g(m){m.key!=="Enter"||m.shiftKey||(m.preventDefault(),h())}return(m,v)=>(ye(),Ie("form",{class:"sd-ai-writer","data-item":"ai-writer",onSubmit:en(h,["prevent"])},[ea(Fe("textarea",{ref_key:"textareaRef",ref:i,"onUpdate:modelValue":v[0]||(v[0]=k=>n.value=k),class:"sd-ai-writer__input",placeholder:s.value,rows:"4",onKeydown:g},null,40,KB),[[Li,n.value]]),Fe("div",qB,[o.value?(ye(),Ie("p",YB,jt(o.value),1)):mt("",!0),Fe("button",{class:"sd-ai-writer__submit",type:"submit",disabled:!a.value},jt(r.value?"Generating":"Generate"),9,XB)])],32))}},ez=cn(JB,[["__scopeId","data-v-67f6c6f7"]]);xt(),fn();var tz=["aria-label","onClick","onKeydown"],nz=["innerHTML"],rz=["innerHTML"],im=7,oz={__name:"IconGridRow",props:{icons:{type:Array,required:!0},activeColor:{type:Object,required:!1}},emits:["select","clickoutside"],setup(e,{emit:t}){const n=t,r=e,o=Ce(()=>m=>r.activeColor.value?r.activeColor.value.toUpperCase()===m.value:!1),i=(m,v)=>v===5||["#FFFFFF","#FAFF09"].includes(m)?{color:"#000"}:{color:"#FFF"},s=m=>{n("select",m.value)},a=te([]),l=te([]);Pn(()=>{if(!r.icons.every(v=>Array.isArray(v)))throw new Error("icon props must be 2d array");const m=l.value[0];m&&(m.setAttribute("tabindex","0"),m.focus({preventScroll:!0}))});const c=(m,v)=>{const k=im*m+v+1,C=l.value[k];C&&(C.setAttribute("tabindex","0"),C.focus({preventScroll:!0}))},d=(m,v)=>{const k=im*m+v-1,C=l.value[k];C&&(C.setAttribute("tabindex","0"),C.focus({preventScroll:!0}))},f=(m,v)=>{const k=v+im*(m+1),C=l.value[k];C&&(C.setAttribute("tabindex","0"),C.focus({preventScroll:!0}))},h=(m,v)=>{const k=v+im*(m-1),C=l.value[k];C&&(C.setAttribute("tabindex","0"),C.focus({preventScroll:!0}))},g=(m,v,k,C)=>{switch(m.key){case"ArrowRight":c(v,k);break;case"ArrowLeft":d(v,k);break;case"ArrowDown":f(v,k);break;case"ArrowUp":h(v,k);break;case"Enter":s(C);break;case"Escape":n("clickoutside")}};return(m,v)=>(ye(!0),Ie($t,null,ur(e.icons,(k,C)=>(ye(),Ie("div",{class:"sd-option-row",key:C,role:"group",ref_for:!0,ref_key:"rowRefs",ref:a},[(ye(!0),Ie($t,null,ur(k,(_,b)=>(ye(),Ie("div",{class:"sd-option",key:b,"aria-label":_.label,role:"menuitem",ref_for:!0,ref_key:"iconRefs",ref:l,onClick:en(w=>s(_),["stop","prevent"]),onKeydown:en(w=>g(w,C,b,_),["prevent"])},[Fe("div",{class:"sd-option__icon",innerHTML:_.icon,style:bn(_.style)},null,12,nz),o.value(_)?(ye(),Ie("div",{key:0,class:"sd-option__check",innerHTML:Xe(or).colorOptionCheck,style:bn(i(_.value,b))},null,12,rz)):mt("",!0)],40,tz))),128))]))),128))}},tA=cn(oz,[["__scopeId","data-v-05eb02fc"]]),iz=`<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>
|
|
101
101
|
`;xt(),fn();var sz={class:"options-grid-wrap"},az=["innerHTML"],lz={class:"option-grid-ctn"},cz={__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)=>(ye(),Ie("div",sz,[e.hasNoneIcon?(ye(),Ie("div",{key:0,class:"none-option",role:"menuitem","aria-label":"Clear color selection",onClick:i[0]||(i[0]=s=>r("none"))},[Fe("span",{innerHTML:Xe(iz),class:"none-icon"},null,8,az),i[1]||(i[1]=qi(" None ",-1))])):mt("",!0),Fe("div",lz,[Gt(tA,{icons:e.icons,"active-color":e.activeColor,onSelect:r},null,8,["icons","active-color"]),e.customIcons.flat().length?(ye(),Ie($t,{key:0},[i[2]||(i[2]=Fe("span",{class:"option-grid-ctn__subtitle"},"Custom colors",-1)),Gt(tA,{icons:e.customIcons,"active-color":e.activeColor,onSelect:r},null,8,["icons","active-color"])],64)):mt("",!0)])]))}},uz=cn(cz,[["__scopeId","data-v-52b0283a"]]);xt();var dz=e=>{e.expand.value=!1},Ut=(e,t=null)=>({label:t,icon:or.colorOption,value:e,style:{color:e,boxShadow:"0 0 5px 1px rgba(0, 0, 0, 0.1)",borderRadius:"50%"}}),Q0=(e,t,n=[],r=!1)=>{const o=i=>{t.iconColor.value=i,e.emitCommand({item:t,argument:i}),dz(t),Su(e)};return Vr("div",{},[Vr(uz,{icons:fz,customIcons:n,activeColor:t.iconColor,hasNoneIcon:r,onSelect:o})])},fz=[[Ut("#111111","black"),Ut("#333333","dark gray"),Ut("#5C5C5C","medium gray"),Ut("#858585","light gray"),Ut("#ADADAD","very light gray"),Ut("#D6D6D6","transparent gray"),Ut("#FFFFFF","white")],[Ut("#860028","dark red"),Ut("#D2003F","red"),Ut("#DB3365","coral red"),Ut("#E4668C","light red"),Ut("#ED99B2","pale pink"),Ut("#F6CCD9","transparent pink"),Ut("#FF004D","bright pink")],[Ut("#83015E","dark purple"),Ut("#CD0194","purple"),Ut("#D734A9","orchid"),Ut("#E167BF","light purple"),Ut("#EB99D4","lavender"),Ut("#F5CCEA","transparent pink"),Ut("#FF00A8","neon pink")],[Ut("#8E220A","maroon"),Ut("#DD340F","red-orange"),Ut("#E45C3F","burnt orange"),Ut("#EB856F","peach"),Ut("#F1AE9F","pale peach"),Ut("#F8D6CF","transparent peach"),Ut("#FF7A00","orange")],[Ut("#947D02","olive"),Ut("#E7C302","mustard yellow"),Ut("#ECCF35","yellow"),Ut("#F1DB67","light yellow"),Ut("#F5E79A","very pale yellow"),Ut("#FAF3CC","transparent yellow"),Ut("#FAFF09","neon yellow")],[Ut("#055432","forest green"),Ut("#07834F","green"),Ut("#399C72","medium green"),Ut("#6AB595","light green"),Ut("#9CCDB9","mint"),Ut("#CDE6DC","transparent mint"),Ut("#05F38F","bright teal")],[Ut("#063E7E","navy blue"),Ut("#0A60C5","blue"),Ut("#3B80D1","sky blue"),Ut("#6CA0DC","cornflower blue"),Ut("#9DBFE8","light blue"),Ut("#CEDFF3","very light blue"),Ut("#21c8ce","cyan")],[Ut("#3E027A","deep purple"),Ut("#6103BF","indigo"),Ut("#8136CC","violet"),Ut("#A068D9","lavender pink"),Ut("#C09AE6","light lilac"),Ut("#DFCDF2","transparent lilac"),Ut("#A91DFF","neon purple")]];xt(),fn();var hz=["data-cols","data-rows","onKeydown","onClick"],pz=["aria-valuetext"],sm=5,mz={__name:"TableGrid",emits:["select","clickoutside"],setup(e,{emit:t}){const n=t,r=te(0),o=te(0),{isHighContrastMode:i}=Qi(),s=te([]),a=f=>{let h=f.target;if(h.dataset.grid)return;let g=[...h.parentElement.querySelectorAll("[data-item]")],m=parseInt(h.dataset.cols,10),v=parseInt(h.dataset.rows,10);l(g,m,v)},l=(f,h,g)=>{o.value=h,r.value=g;for(let m=0;m<f.length;m++){let v=f[m],k=parseInt(v.dataset.cols,10),C=parseInt(v.dataset.rows,10);k<=h&&C<=g?v.classList.add("sd-selected"):v.classList.remove("sd-selected")}},c=({cols:f,rows:h})=>{n("select",{cols:f,rows:h})},d=(f,h,g)=>{let m=h-1,v=g-1;switch(f.key){case"ArrowRight":{if(m>=4)return;const k=v*sm;s.value[k+m+1].setAttribute("tabindex","0"),s.value[k+m+1].focus(),l(s.value,h+1,g);break}case"ArrowLeft":{if(m<=0)return;const k=v*sm;s.value[k+m-1].setAttribute("tabindex","0"),s.value[k+m-1].focus(),l(s.value,h-1,g);break}case"ArrowDown":{if(v>=4)return;const k=(v+1)*sm;s.value[k+m].setAttribute("tabindex","0"),s.value[k+m].focus(),l(s.value,h,g+1);break}case"ArrowUp":{if(v<=0)return;const k=(v-1)*sm;s.value[k+m].setAttribute("tabindex","0"),s.value[k+m].focus(),l(s.value,h,g-1);break}case"Enter":c({cols:h,rows:g})}};return Pn(()=>{s.value[0].setAttribute("tabindex","0"),s.value[0].focus(),l(s.value,1,1)}),(f,h)=>(ye(),Ie("div",{class:nn(["toolbar-table-grid-wrapper",{"high-contrast":Xe(i)}])},[Fe("div",{class:"toolbar-table-grid",onMouseover:a,"data-grid":"true"},[(ye(),Ie($t,null,ur(5,g=>(ye(),Ie($t,{key:g},[(ye(),Ie($t,null,ur(5,m=>Fe("div",{class:"toolbar-table-grid__item",key:`${g}_${m}`,"data-cols":m,"data-rows":g,"data-item":"true",ref_for:!0,ref_key:"tableGridItems",ref:s,onKeydown:en(v=>d(v,m,g),["prevent"]),onClick:en(v=>c({cols:m,rows:g}),["stop","prevent"])},null,40,hz)),64))],64))),64))],32),Fe("div",{class:"toolbar-table-grid-value","aria-valuetext":`${r.value} x ${o.value}`},jt(r.value)+" x "+jt(o.value),9,pz)],2))}},gz=cn(mz,[["__scopeId","data-v-b87d6ca2"]]);xt(),fn();var vz={class:"toolbar-table-actions"},yz=["onClick","data-item","ariaLabel"],bz={class:"toolbar-table-actions__icon"},wz=["innerHTML"],Cz={class:"toolbar-table-actions__label"},kz={__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)=>(ye(),Ie("div",vz,[(ye(!0),Ie($t,null,ur(e.options,s=>(ye(),Ie("div",{class:nn(["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"},[Fe("div",bz,[Fe("div",{class:"toolbar-table-actions__icon-wrapper",innerHTML:s.icon},null,8,wz)]),Fe("div",Cz,jt(s.label),1)],10,yz))),256))]))}},Sz=cn(kz,[["__scopeId","data-v-0cdad084"]]),_z=`<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>
|
|
102
|
-
`;xt();var Ds=e=>{e.expand.value=!1};function J0(e,t){const n={...e??{}};return t?n.href=t:delete n.href,n}function nA(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 Az(e){return typeof e?.quotedText=="string"?e.quotedText:typeof e?.text=="string"?e.text:""}function rA(e){return e.ui?.selection?.get?.()??e.ui?.selection?.current?.()??null}function Iz(e){return!!(e.config?.superdoc?.config?.modules?.ai||e.superdoc?.config?.modules?.ai)}function xz(e){return e.config?.superdoc?.config?.modules?.ai??e.superdoc?.config?.modules?.ai??{}}var Ez=({superToolbar:e,toolbarIcons:t,toolbarTexts:n,toolbarFonts:r,hideButtons:o,availableWidth:i,role:s,isDev:a=!1}={})=>{const l=In({type:"button",name:"bold",command:"toggleBold",icon:t.bold,tooltip:n.bold,attributes:{ariaLabel:"Bold"}}),c=(r??wB).map(xB),d=In({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:c,onActivate:({fontFamily:Qe}={},Pt=!1)=>{if(Pt){d.label.value="",d.selectedValue.value="";return}if(!Qe)return;Qe=Qe.split(",")[0],d.label.value=Qe;const It=c.find(tn=>tn.label===d.defaultLabel.value),Sn=c.find(tn=>tn.label===Qe);Sn?d.selectedValue.value=Sn.key:It?d.selectedValue.value=It.key:d.selectedValue.value=""},onDeactivate:()=>{d.label.value=d.defaultLabel.value;const Qe=c.find(Pt=>Pt.label===d.defaultLabel.value);Qe?d.selectedValue.value=Qe.key:d.selectedValue.value=""}}),f=In({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:()=>h(f)}]});function h(Qe){const Pt=rA(e),It=Pt?.selectionTarget??nA(Pt?.target),Sn=Pt?.empty?"":Az(Pt),tn=xz(e),hn=()=>Ds(Qe),Vn=()=>{const pr=e.pendingSelectionCapture;pr&&typeof e.ui?.selection?.restore=="function"&&e.ui.selection.restore(pr)};return Vr("div",{},[Vr(ez,{handleClose:hn,selectedText:Sn,target:It,doc:e.superdoc?.activeEditor?.doc??null,apiKey:tn?.apiKey||e.config?.aiApiKey||"",endpoint:tn?.endpoint||e.config?.aiEndpoint||"",restoreSelection:Vn})])}const g=kB,m=In({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:g,onActivate:({fontSize:Qe},Pt=!1)=>{if(Pt){m.label.value="",m.selectedValue.value="";return}const It=g.find(Vn=>Vn.label===String(m.defaultLabel.value));if(!Qe){m.label.value=m.defaultLabel.value,It?m.selectedValue.value=It.key:m.selectedValue.value="";return}let Sn=fN(Qe,12);Sn<8&&(Sn=8),Sn>96&&(Sn=96);let tn=String(Sn);const hn=g.find(Vn=>Vn.label===tn||Vn.key===tn);hn?m.selectedValue.value=hn.key:m.selectedValue.value="",m.label.value=tn},onDeactivate:()=>{m.label.value=m.defaultLabel.value;const Qe=g.find(Pt=>Pt.label===String(m.defaultLabel.value));Qe?m.selectedValue.value=Qe.key:m.selectedValue.value=""}}),v=In({type:"separator",name:"separator",isNarrow:!0}),k=In({type:"button",name:"italic",command:"toggleItalic",icon:t.italic,active:!1,tooltip:n.italic,attributes:{ariaLabel:"Italic"}}),C=In({type:"button",name:"underline",command:"toggleUnderline",icon:t.underline,active:!1,tooltip:n.underline,attributes:{ariaLabel:"Underline"}}),_=In({type:"button",name:"strike",command:"toggleStrike",icon:t.strikethrough,active:!1,tooltip:n.strikethrough,attributes:{ariaLabel:"Strikethrough"}}),b=In({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:()=>Q0(e,b,[],!0)}],onActivate:({color:Qe})=>{b.iconColor.value=Qe||""},onDeactivate:()=>b.iconColor.value=""}),w=In({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:()=>Q0(e,w)}],onActivate:({color:Qe})=>{w.iconColor.value=Qe},onDeactivate:()=>w.iconColor.value="#000"}),T=In({type:"button",name:"search",allowWithoutEditor:!0,active:!1,icon:t.search,tooltip:n.search,group:"right",attributes:{ariaLabel:"Search"}}),L=In({type:"dropdown",name:"link",markName:"link",icon:t.link,active:!1,tooltip:n.link,attributes:{ariaLabel:"Link dropdown"},options:[{type:"render",key:"linkDropdown",render:()=>N(L)}],onActivate:({href:Qe})=>{L.attributes.value=J0(L.attributes.value,Qe)},onDeactivate:()=>{L.attributes.value=J0(L.attributes.value,null),L.expand.value=!1}});function N(Qe){const Pt=rA(e),It=Pt?.selectionTarget??nA(Pt?.target),Sn=()=>{const tn=e.pendingSelectionCapture;tn&&typeof e.ui?.selection?.restore=="function"&&e.ui.selection.restore(tn)};return Vr("div",{},[Vr(xS,{ui:e.ui,linkItem:Qe,textTarget:It,restoreSelection:Sn,closePopover:()=>{Ds(Qe),Su(e)},goToAnchor:()=>{Ds(Qe);const tn=Qe.attributes.value?.href;if(!tn)return;const hn=tn.slice(1),Vn=(e.ui?.viewport?.getHost?.()??null)?.querySelector?.(`a[name='${hn}']`);Vn&&lf(Vn)}})])}const H=In({type:"options",name:"linkInput",command:"toggleLink",active:!1});L.childItem=H,H.parentItem=L;const M=In({type:"button",name:"image",command:"startImageUpload",icon:t.image,active:!1,tooltip:n.image,disabled:!1,attributes:{ariaLabel:"Image"}}),V=In({type:"button",name:"tableOfContents",command:"insertTableOfContents",icon:t.tableOfContents,active:!1,tooltip:n.tableOfContents,disabled:!1,attributes:{ariaLabel:"Table of contents"}}),q=In({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:()=>D(q)}]});function D(Qe){return Vr("div",{},[Vr(gz,{onSelect:It=>{e.emitCommand({item:Qe,argument:It}),Ds(Qe),Su(e)}})])}const B=In({type:"dropdown",name:"tableActions",command:"executeTableCommand",tooltip:n.tableActions,icon:t.tableActions,hideLabel:!0,disabled:!0,attributes:{ariaLabel:"Table actions"},options:[{type:"render",render:()=>j(B)}]}),E=[{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 j(Qe){return Vr(Sz,{options:E,onSelect:Pt=>{Ds(Qe);const{command:It}=Pt;e.emitCommand({item:Qe,argument:{command:It}})}})}const J=In({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:()=>Vr("div",{},[Vr(RB,{onSelect:Pt=>{Ds(J);const It={...J,command:"setTextAlign"};It.command="setTextAlign",e.emitCommand({item:It,argument:Pt}),Y(J,Pt),Su(e)}})]),key:"alignment"}],onActivate:({textAlign:Qe})=>{Y(J,Qe)},onDeactivate:()=>{Y(J,"left")}}),Y=(Qe,Pt)=>{let It=Pt==="both"?"justify":Pt,Sn={left:t.alignLeft,right:t.alignRight,center:t.alignCenter,justify:t.alignJustify},tn=Sn[It]??Sn.left;Qe.icon.value=tn},se=In({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 Qe=Pt=>{Ds(se);const It={...se,command:"toggleBulletListStyle"};e.emitCommand({item:It,argument:Pt})};return Vr(eA,{buttons:PB,iconSize:25,selectedStyle:se.selectedValue.value,onSelect:Qe})}}]}),pe=In({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 Qe=Pt=>{Ds(pe);const It={...pe,command:"toggleOrderedListStyle"};e.emitCommand({item:It,argument:Pt})};return Vr(eA,{buttons:DB,iconSize:30,selectedStyle:pe.selectedValue.value,onSelect:Qe})}}]}),Ve=In({type:"button",name:"indentleft",command:"decreaseTextIndent",icon:t.indentLeft,active:!1,tooltip:n.indentLeft,disabled:!1,attributes:{ariaLabel:"Left indent"}}),ge=In({type:"button",name:"indentright",command:"increaseTextIndent",icon:t.indentRight,active:!1,tooltip:n.indentRight,disabled:!1,attributes:{ariaLabel:"Right indent"}}),be=In({type:"overflow",name:"overflow",command:null,icon:t.overflow,active:!1,disabled:!1,attributes:{ariaLabel:"Overflow items"}}),ve=In({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:Qe})=>{Qe&&(ve.label.value=Qe)}}),ke=In({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:Qe})=>{Qe&&(ke.label.value=Qe)}}),oe=In({type:"button",name:"undo",disabled:!0,tooltip:n.undo,command:"undo",icon:t.undo,group:"left",attributes:{ariaLabel:"Undo"}}),Re=In({type:"button",disabled:!0,name:"redo",tooltip:n.redo,command:"redo",icon:t.redo,group:"left",attributes:{ariaLabel:"Redo"}}),je=In({type:"button",disabled:!1,name:"acceptTrackedChangeBySelection",tooltip:n.trackChangesAccept,command:"acceptTrackedChangeFromToolbar",icon:t.trackChangesAccept,group:"left",attributes:{ariaLabel:"Accept tracked changes"}}),tt=In({type:"button",disabled:!1,name:"rejectTrackedChangeOnSelection",tooltip:n.trackChangesReject,command:"rejectTrackedChangeFromToolbar",icon:t.trackChangesReject,group:"left",attributes:{ariaLabel:"Reject tracked changes"}}),wt=In({type:"button",name:"clearFormatting",command:"clearFormat",tooltip:n.clearFormatting,icon:t.clearFormatting,attributes:{ariaLabel:"Clear formatting"}}),Te=In({type:"button",name:"copyFormat",tooltip:n.copyFormat,icon:t.copyFormat,command:"copyFormat",active:!1,attributes:{ariaLabel:"Copy formatting"}}),We=(Qe,Pt)=>Qe==="editor"?Pt:Qe==="suggester"?Pt.filter(It=>It.value==="suggesting"):Pt.filter(It=>It.value==="viewing"),Ye=Qe=>Qe==="editor"?"Editing":Qe==="suggester"?"Suggesting":"Viewing",ee=In({type:"dropdown",name:"documentMode",command:"setDocumentMode",allowWithoutEditor:!0,icon:t.documentMode,defaultLabel:Ye(s),label:Ye(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:()=>ne(ee)}]}),S=[{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 ne(Qe){const Pt=We(s,S);return Vr(UB,{options:Pt,onSelect:It=>{const Sn=e.superdoc?.activeEditor??e.activeEditor;Ds(Qe);const{label:tn,icon:hn,value:Vn}=It;ee.label.value=tn,ee.icon.value=hn,e.emitCommand({item:ee,argument:Vn}),Su(e,Sn)}})}const O=new Map([["separator",20],["zoom",71],["measurementUnit",52],["fontFamily",118],["fontSize",57],["textAlign",40],["linkedStyles",142],["documentMode",47],["default",32]]),P=["search","ruler","undo","overflow","documentMode"],U=In({type:"button",name:"ruler",command:"toggleRuler",allowWithoutEditor:!0,icon:t.ruler,active:!1,tooltip:n.ruler,attributes:{ariaLabel:"Ruler"}}),$=In({type:"button",name:"formattingMarks",command:"toggleFormattingMarks",allowWithoutEditor:!0,icon:t.formattingMarks,active:!1,tooltip:n.formattingMarks,attributes:{ariaLabel:"Formatting marks"}}),Q=In({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 Qe=It=>{Ds(Q);const Sn=typeof It=="string"?It:It?.id??null;if(!Sn)return;const tn={...Q,command:"setLinkedStyle"};e.emitCommand({item:tn,argument:Sn})},Pt=e.getActiveLinkedStyleId?.()??null;return Vr("div",{},[Vr(WB,{styles:e.getLinkedStyleOptions?.()??[],onSelect:Qe,selectedOption:Pt})])}}],onActivate:({styleId:Qe,styleName:Pt})=>{const It=Pt||Qe;Q.label.value=Qe&&Qe!=="Normal"?String(It):n.formatText,Q.disabled.value=!1},onDeactivate:()=>{Q.disabled.value=!0,Q.label.value=n.formatText}}),Z=(Qe,Pt)=>{if(Pt.value==Qe)return Vr("div",{innerHTML:_z,class:"dropdown-select-icon"})},K=In({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(Qe=>({label:Qe.toFixed(2),key:Qe,icon:()=>Z(Qe,K.selectedValue),props:{"data-item":"btn-lineHeight-option"}}))}),me=20,xe=32,he=P.reduce((Qe,Pt)=>Qe+(O.get(Pt)||O.get("default")),0),Pe=["linkedStyles","clearFormatting","copyFormat","formattingMarks"],Je=["zoom","fontFamily","fontSize","redo"],nt=i<=Tf.lg,ut=e.config?.showFormattingMarksButton===!0,Ht=e.config?.showTableOfContentsButton===!0;nt&&(ee.attributes.value={...ee.attributes.value,className:`${ee.attributes.value.className} sd-toolbar-item--doc-mode-compact`}),nt&&(Q.attributes.value={...Q.attributes.value,className:`${Q.attributes.value.className} sd-toolbar-item--linked-styles-compact`});let He=[oe,Re,je,tt,T,ve,d,v,m,v,l,k,C,_,w,b,v,L,M,...Ht?[V]:[],q,B,v,J,se,pe,Ve,ge,K,v,Q,v,U,ke,...ut?[$]:[],Te,wt,...Iz(e)?[f]:[],be,ee];if(i<=Tf.md&&o&&(He=He.filter(Qe=>Qe.type!=="separator")),e.config.mode!=="docx"){const Qe=He.findIndex(It=>It.name.value==="linkedStyles");He.splice(Qe-1,2);const Pt=["ruler","zoom","undo","redo"];He=He.filter(It=>!Pt.includes(It.name.value))}const Vt=[];a||(s==="viewer"&&Vt.push(je,tt),He=He.filter(Qe=>!Vt.includes(Qe)));const Mt=Qe=>P.includes(Qe.name.value),sn=[],qn=[];let Kt=xe+he;return He.forEach(Qe=>{const Pt=O.get(Qe.name.value)||O.get("default");if(i<Tf.xl+me&&Pe.includes(Qe.name.value)&&o){if(sn.push(Qe),Qe.name.value==="linkedStyles"){const It=He.findIndex(Sn=>Sn.name.value==="linkedStyles");He.splice(It+1,1)}return}if(i<Tf.sm&&Je.includes(Qe.name.value)&&o){sn.push(Qe);return}if(Mt(Qe)){qn.push(Qe),Kt+=Pt;return}Kt<i||!o?(qn.push(Qe),Kt+=Pt):sn.push(Qe)}),{defaultItems:qn,overflowItems:sn.filter(Qe=>Qe.type!=="separator")}},oA={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",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"},Tz=e=>e?typeof e!="string"?e instanceof HTMLElement?e:null:e.startsWith("#")||e.startsWith(".")?document.querySelector(e):document.getElementById(e):null;xt();function iA(e){return oN(e)??Z0[e]??null}function am(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=n===void 0?o.call(e.commands,t):o.call(e.commands,t,n);return i&&typeof i.then=="function"&&Promise.resolve(i).then(()=>r.onSettled?.(),s=>{r.onError?.(s),r.onSettled?.()}),!0}var Rz=new Set(["bold","italic","underline","strike","color","highlight","link","clearFormatting","textAlign","list","numberedlist","indentleft","indentright","lineHeight","linkedStyles"]),Lz=new Set(["list","numberedlist"]);function Mz(e,t){if(e==="fontFamily"||e==="fontSize"||Lz.has(e)&&t?.disabled&&t?.supported!==!1&&t?.reason==null)return!0;if(!Rz.has(e))return!1;const n=t?.reason;return n==="range-selection-required"||n==="selection-required"}function sA(e){return!!e?.closest?.("[data-editor-ui-surface], .toolbar-dropdown-menu, .sd-toolbar-dropdown-menu, .sd-tooltip-content")}function Pz(e){return["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key)}var Dz=class extends Gm.default{config={selector:null,toolbarGroups:["left","center","right"],role:"editor",icons:{...or},texts:{...oA},fonts:null,hideButtons:!0,responsiveToContainer:!1,mode:"docx",excludeItems:[],groups:null,customButtons:[],showFormattingMarksButton:!1,showTableOfContentsButton:!1};toolbarItems=[];overflowItems=[];#e=null;#n=null;isDev=!1;role="editor";superdoc;toolbarContainer=null;toolbar=null;_detachFontsChanged=null;constructor(e={}){if(super(),this.config={...this.config,...e},this.toolbarItems=[],this.overflowItems=[],this.isDev=e.isDev||!1,this.superdoc=e.superdoc,this.role=e.role||"editor",this.toolbarContainer=null,this.config.icons={...or,...e.icons},this.config.texts={...oA,...e.texts},this.config.hideButtons=e.hideButtons??!0,this.config.responsiveToContainer=e.responsiveToContainer??!1,this.activeEditor=e.editor??this.superdoc?.activeEditor??null,this.ui=null,this.snapshot=null,this._unsubscribeController=null,this._detachFormatPainterModeChange=null,this._customCommandRegs=new Map,this._reportedInvalidCustomItems=new Set,this._lastFontOptionsSignature="",!this.config.selector&&this.config.element&&(this.config.selector=this.config.element),this.toolbarContainer=Tz(this.config.selector),this.toolbarContainer){const t=(this.config?.uiDisplayFallbackFont||"").toString().trim()||"Arial, Helvetica, sans-serif";this.toolbarContainer.style.setProperty("--sd-ui-font-family",t)}try{if(this.#t(),this.#d(),this.#f(),this.#i(),this._lastFontOptionsSignature=this.#o(),!this.toolbarContainer){this.updateToolbarState();return}this.app=Yl(IB),this.app.directive("click-outside",qv),this.app.config.globalProperties.$toolbar=this,this.toolbar=this.app.mount(this.toolbarContainer),this.updateToolbarState()}catch(t){try{this.destroy()}catch{}throw t}}#t(){this.ui=this.superdoc?.ui??null,this.ui&&(this.snapshot=this.ui.toolbar.getSnapshot(),this._unsubscribeController=this.ui.toolbar.subscribe(()=>{this.snapshot=this.ui.toolbar.getSnapshot(),this.updateToolbarState()}),this._detachFormatPainterModeChange=this.ui.formatPainter.onModeChange(e=>{e==="armed"||e==="persistent"?this.#a():this.#S()}))}#r(){this._unsubscribeController?.(),this._unsubscribeController=null,this._detachFormatPainterModeChange?.(),this._detachFormatPainterModeChange=null,this.#S();for(const e of this._customCommandRegs.values())try{e.unregister?.()}catch{}this._customCommandRegs.clear(),this.ui=null,this.snapshot=null}#i(){if(!this.superdoc||typeof this.superdoc.on!="function"||typeof this.superdoc.off!="function")return;const e=()=>{const t=this.#o();t!==this._lastFontOptionsSignature&&(this._lastFontOptionsSignature=t,this.#p()),this.updateToolbarState()};this.superdoc.on("fonts-changed",e),this._detachFontsChanged=()=>{this.superdoc?.off?.("fonts-changed",e)}}#s(){this._detachFontsChanged?.(),this._detachFontsChanged=null}#d(){if(Array.isArray(this.config.groups)){this.config.toolbarGroups=this.config.groups,this.config.groups=null;return}this.config.groups&&!Array.isArray(this.config.groups)&&Object.keys(this.config.groups).length&&(this.config.toolbarGroups=Object.keys(this.config.groups))}getAvailableWidth(){const e=document.documentElement.clientWidth,t=this.toolbarContainer?.offsetWidth??0;return this.config.responsiveToContainer?t:e}#h(e){if(e)return e;const t=this.superdoc?.fonts?.getFontFamilyOptions?.()??[];return CB(t)}#f(){const e=this.getAvailableWidth(),t=this.config.groups&&!Array.isArray(this.config.groups)&&Object.keys(this.config.groups).length>0,{defaultItems:n,overflowItems:r}=Ez({superToolbar:this,toolbarIcons:this.config.icons,toolbarTexts:this.config.texts,toolbarFonts:this.#h(this.config.fonts),hideButtons:this.config.hideButtons,availableWidth:e,role:this.role,isDev:this.isDev}),o=this.config.customButtons||[],i=new Set([...n,...r].map(c=>c.name?.value).filter(Boolean)),s=o.map((c,d)=>{try{if(c?.name&&i.has(c.name))throw new Error(`Toolbar item name "${c.name}" is already taken by another item, so this entry is skipped.`);const f=this.#c(c);return i.add(f.name?.value),f}catch(f){const h=`${c?.name??`<unnamed@${d}>`}::${f?.message??String(f)}`;return this._reportedInvalidCustomItems.has(h)||(this._reportedInvalidCustomItems.add(h),this.#b(f,c?.name??null)),null}}).filter(Boolean);s.length&&n.push(...s);let a=[...n.map(c=>c.name.value),...r.map(c=>c.name.value)];if(t){const c=Object.values(this.config.groups).flatMap(h=>h),d=new Set(Object.keys(this.config.groups)),f=s.filter(h=>d.has(h.group?.value||"center")).map(h=>h.name.value);a=[...new Set([...c,...f])]}const l=n.filter(c=>a.includes(c.name.value)).filter(c=>!this.config.excludeItems.includes(c.name.value));if(t)for(const[c,d]of Object.entries(this.config.groups))for(const f of l)d.includes(f.name.value)&&(f.group.value=c);this.toolbarItems=l,this.overflowItems=r.filter(c=>a.includes(c.name.value))}#c(e){const t=In({...e});t.isCustomToolbarItem=!0;const n=e.command;if(typeof n=="function"&&this.ui?.commands?.register){const r=`__builtin_toolbar__${e.name}`;if(!this._customCommandRegs.has(r)){const o=this.ui.commands.register({id:r,execute:i=>{const s=i?.payload&&typeof i.payload=="object"?i.payload:{};return n({...i,item:t,argument:s.argument,option:s.option})}});this._customCommandRegs.set(r,o)}}return t}#p(){this.#f(),this.emit("toolbar-items-changed")}#o(){if(this.config.fonts)return"custom-fonts";const e=this.superdoc?.fonts?.getFontFamilyOptions?.()??[];return JSON.stringify(e.map(t=>[t.label,t.value,t.previewFamily]))}getToolbarItemByGroup(e){return this.toolbarItems.filter(t=>(t.group?.value||"center")===e)}getToolbarItemByName(e){return this.#l().find(t=>t.name.value===e)}#l(){return[...this.toolbarItems,...this.overflowItems]}getLinkedStyleOptions(){return this.ui?.styles?.getQuickGallery?.()??[]}getActiveLinkedStyleId(){return this.ui?.styles?.getActiveParagraphStyle?.()?.styleId??null}setActiveEditor(e){this.activeEditor=e;const t=this.#o();t!==this._lastFontOptionsSignature&&(this._lastFontOptionsSignature=t,this.#p()),this.ui&&(this.snapshot=this.ui.toolbar.getSnapshot()),this.updateToolbarState()}onToolbarResize=()=>{this.#f(),this.updateToolbarState()};#g(e){return e==="ruler"?!!this.superdoc?.config?.rulers:e==="formattingMarks"?!!this.superdoc?.config?.layoutEngineOptions?.showFormattingMarks:!1}#u(e){return e==="ruler"?typeof this.superdoc?.toggleRuler=="function":e==="formattingMarks"?typeof this.superdoc?.toggleFormattingMarks=="function"||typeof this.superdoc?.setShowFormattingMarks=="function":!1}#y(){const e=this.getToolbarItemByName("documentMode");if(!e)return;const t=(this.snapshot?.commands?.["document-mode"]?.value||"editing").toLowerCase(),n=this.config.texts||{},r=this.config.icons||{},o={editing:{label:n.documentEditingMode||"Editing",icon:r.documentEditingMode||r.documentMode},suggesting:{label:n.documentSuggestingMode||"Suggesting",icon:r.documentSuggestingMode||r.documentMode},viewing:{label:n.documentViewingMode||"Viewing",icon:r.documentViewingMode||r.documentMode}},i=o[t]||o.editing;e.label?.value!==void 0&&(e.label.value=i.label),e.defaultLabel?.value!==void 0&&(e.defaultLabel.value=i.label),e.icon?.value!==void 0&&i.icon&&(e.icon.value=i.icon)}#w(){const e=this.toolbarItems.find(n=>n.name.value==="highlight");if(!e)return;const t={key:"color",type:"render",render:()=>Q0(this,e,[],!0)};e.nestedOptions.value=[t]}#k(e){return!!e?.active&&e?.value==null}#I(e){return!!e&&e.disabled===!1&&e.value==null}#x(e){const t=e.name.value;if(t==="tableActions"){const i=J4.map(s=>this.snapshot?.commands?.[s]).some(s=>s&&!s.disabled);return e.setDisabled(!i),!0}if(t==="search")return e.setDisabled(!1),!0;if(Y0(t)?.disposition==="host-routed")return e.setDisabled(!this.#u(t)),this.#g(t)?e.activate():e.deactivate(),!0;const n=iA(t);if(!n)return!1;const r=this.snapshot?.commands?.[n];Mz(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.#y()},link:()=>{e.active.value=!!r?.active,e.attributes.value=J0(e.attributes.value,r?.value??null)},fontFamily:()=>{if(r?.value!=null){e.activate({fontFamily:r.value});return}if(this.#I(r)){e.activate({},!0);return}e.deactivate()},fontSize:()=>{if(r?.value!=null){e.activate({fontSize:r.value});return}if(this.#k(r)){e.activate({},!0);return}e.deactivate()},color:()=>{r?.value!=null?e.activate({color:r.value}):e.deactivate()},highlight:()=>{r?.value!=null?e.activate({color:r.value}):e.deactivate()},linkedStyles:()=>{const i=r?.value,s=typeof i=="string"?i:i?.styleId,a=i&&typeof i=="object"?i.styleName:null;s?e.activate({styleId:s,styleName:a}):e.label.value=this.config.texts?.formatText||"Format text"},list:()=>{r?.active?(e.activate(),e.selectedValue.value=r.value):(e.deactivate(),e.selectedValue.value=null)},numberedlist:()=>{r?.active?(e.activate(),e.selectedValue.value=r.value):(e.deactivate(),e.selectedValue.value=null)},default:()=>{r?.active?e.activate():e.deactivate()}};return(o[t]??o.default)(),!0}updateToolbarState(){this.#y(),this.#w();const e=this.snapshot?.commands?.["document-mode"]?.value||"editing";!(this.snapshot&&(this.superdoc?.activeEditor??this.activeEditor))||e==="viewing"?(this.#M(),this.#l().forEach(n=>{n.allowWithoutEditor?.value&&this.#x(n)})):this.#l().forEach(n=>{n.resetDisabled(),this.#x(n)});const t=this.getToolbarItemByName("copyFormat");t&&(this.snapshot?.copyFormatActive?t.activate():t.deactivate()),this.emit("toolbar-state-change")}#M(){this.#l().forEach(e=>{const{allowWithoutEditor:t}=e;t?.value||e.setDisabled(!0)})}#P(e,t){const n=this.superdoc;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}#D(e,t){const n=e?.name?.value;if(!n)return!1;const r={onSettled:()=>this.updateToolbarState(),onError:i=>this.#b(i,n)};if(n==="image"&&t==null)return this.#E();if(n==="tableActions"){const i=Q4[t?.command];return i?am(this.ui,i,void 0,r):!1}if(Y0(n)?.disposition==="unsupported")return!0;const o=iA(n);return o?am(this.ui,o,t,r):!1}#E(){return this.snapshot?.commands?.image?.disabled||(this.#e||(this.#e=dN({ownerDocument:this.toolbarContainer?.ownerDocument??document,onPick:async e=>{const t=await cN(e,this.superdoc?.config?.handleImageUpload);am(this.ui,"image",{src:t},{onSettled:()=>this.updateToolbarState(),onError:n=>this.#b(n,"image")})},onError:e=>this.#b(e,"image")})),this.#e.open()),!0}#a(){if(this.#n)return;const e=this.superdoc?.activeEditor?.container??document,t=i=>{sA(i.target)||this.ui.formatPainter.setPointerSelecting(!0)},n=i=>{this.ui.formatPainter.setPointerSelecting(!1),!sA(i.target)&&this.ui.formatPainter.notifyPointerUp()},r=i=>{if(i.key==="Escape"){this.ui.formatPainter.cancel();return}Pz(i)&&this.ui.formatPainter.setKeyboardSelecting(!0)},o=()=>{this.ui.formatPainter.setKeyboardSelecting(!1),this.ui.formatPainter.notifyKeyUp()};e.addEventListener("pointerdown",t),e.addEventListener("pointerup",n),e.addEventListener("keydown",r),e.addEventListener("keyup",o),this.#n=()=>{e.removeEventListener("pointerdown",t),e.removeEventListener("pointerup",n),e.removeEventListener("keydown",r),e.removeEventListener("keyup",o)}}#S(){this.#n&&(this.#n(),this.#n=null)}#b(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(Y0(r)?.disposition==="host-routed"){this.#P(r,t),this.updateToolbarState();return}if(typeof o=="function"){const s=`__builtin_toolbar__${r}`;this._customCommandRegs.has(s)&&this.ui?.commands?.execute?this.ui.commands.execute(s,{argument:t,option:n}):o({item:e,argument:t,option:n,ui:this.ui,superdoc:this.superdoc}),this.updateToolbarState();return}if(e?.isCustomToolbarItem&&typeof o=="string"){if(!am(this.ui,o,t,{onSettled:()=>this.updateToolbarState(),onError:s=>this.#b(s,r)}))throw new Error(`[superdoc toolbar] Command not handled: ${String(o)}`);this.updateToolbarState();return}if(!this.#D(e,t)&&o)throw new Error(`[superdoc toolbar] Command not handled: ${String(o)}`);this.updateToolbarState()}catch(s){this.#b(s,r)}}}destroy(){this.#S(),this.#e?.destroy(),this.#e=null,this.#s(),this.#r(),this.app?.unmount(),this.app=null,this.toolbar=null}};function Oz(e){return new Dz(e)}function Fz(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null||Array.isArray(e)!==Array.isArray(t))return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(t,o)||!Object.is(e[o],t[o]))return!1;return!0}function Nz(e){if(!e||typeof e!="object")return{};const t={};e.fonts&&(t.rFonts={ascii:e.fonts.ascii,hAnsi:e.fonts.hAnsi,eastAsia:e.fonts.eastAsia,cs:e.fonts.cs,asciiTheme:e.fonts.asciiTheme,hAnsiTheme:e.fonts.hAnsiTheme,eastAsiaTheme:e.fonts.eastAsiaTheme,csTheme:e.fonts.csTheme,hint:e.fonts.hint}),e.fontFamily!=null&&(t.fontFamily=e.fontFamily),e.lang&&(t.lang={val:e.lang.val,eastAsia:e.lang.eastAsia,bidi:e.lang.bidi}),e.fontSize!=null&&(t.fontSize=e.fontSize),e.fontSizeCs!=null&&(t.fontSizeCs=e.fontSizeCs);const n=lm(e.color);n!=null&&(t.color=n),e.highlight!=null&&(t.highlight=e.highlight);const r=zz(e.shading);r&&(t.shading=r),e.cs!=null&&(t.cs=e.cs),e.rtl!=null&&(t.rtl=e.rtl),e.bold!=null&&(t.bold=e.bold),e.boldCs!=null&&(t.bCs=e.boldCs),e.italic!=null&&(t.italic=e.italic),e.italicCs!=null&&(t.iCs=e.italicCs);const o=Bz(e.underline);o!==void 0&&(t.underline=o),e.strikethrough!=null&&(t.strike=e.strikethrough),e.doubleStrikethrough!=null&&(t.dstrike=e.doubleStrikethrough),e.caps!=null&&(t.caps=e.caps),e.smallCaps!=null&&(t.smallCaps=e.smallCaps),e.outline!=null&&(t.outline=e.outline),e.shadow!=null&&(t.shadow=e.shadow),e.emboss!=null&&(t.emboss=e.emboss),e.imprint!=null&&(t.imprint=e.imprint),e.verticalAlign!=null&&(t.vertAlign=e.verticalAlign),e.characterSpacing!=null&&(t.letterSpacing=e.characterSpacing),e.characterScale!=null&&(t.charScale=e.characterScale),e.kern!=null&&(t.kerning=e.kern),e.baselineShift!=null&&(t.position=e.baselineShift),e.fitTextWidth!=null&&(t.fitText={val:e.fitTextWidth}),e.vanish!=null&&(t.vanish=e.vanish),e.webHidden!=null&&(t.webHidden=e.webHidden),e.specVanish!=null&&(t.specVanish=e.specVanish);const i=Vz(e.border);return i&&(t.border=i),t}function lm(e){if(e){if(typeof e=="string")return e;if(e.model==="rgb")return e.value;if(e.model==="auto")return"auto"}}function Bz(e){if(e==null)return;const t={};return e.style!=null&&(t.style=e.style),e.color?.model==="rgb"&&(t.color=e.color.value),e.color?.model==="theme"&&(t.themeColor=e.color.theme),Object.keys(t).length>0?t:!0}function zz(e){if(!e)return;const t={},n=lm(e.fill);n!=null&&(t.fill=n);const r=lm(e.color);return r!=null&&(t.color=r),e.pattern!=null&&(t.val=e.pattern),Object.keys(t).length>0?t:void 0}function Vz(e){if(!e)return;const t={};e.style!=null&&(t.val=e.style),e.width!=null&&(t.sz=e.width),e.space!=null&&(t.space=e.space);const n=lm(e.color);return n!=null&&(t.color=n),Object.keys(t).length>0?t:void 0}function cc(e){const t=e?.selectionTarget??e?.target;if(!e||!t)return"";try{return JSON.stringify(t)}catch{return String(t)}}var jz=new Set(["insert-text","replace-text","plain-text-paste","delete-backward","delete-forward","text.insert","text.replace","text.pastePlain","text.deleteBackward","text.deleteForward","structural.enter","structural:enter-split-paragraph","structural:enter-insert-paragraph-before","structural:enter-insert-paragraph-after","structural:shift-enter-line-break","structural:backspace-boundary-merge-with-previous","structural:delete-boundary-merge-with-next","backspace:boundary-merge-with-previous","backspace:list-remove","backspace:list-outdent"]),Uz=e=>e?.type!=="mutation:committed"||e.origin!=="command"?!1:jz.has(e.editableCommandKind);function aA(e){return e.split(",").map(t=>t.trim()).filter(Boolean)}function Hz(e){const t=[],n=o=>{o&&!t.includes(o)&&t.push(o)};n(e.getAttribute("data-track-change-preferred-target-id"));const r=e.getAttribute("data-track-change-ids");if(r)for(const o of aA(r))n(o);return n(e.getAttribute("data-track-change-id")),t}function lA(e,t){if(!e||typeof e.getAttribute!="function")return[];const n=[],r=new Set;let o=[],i=e;for(;i;){const s=i,a=Hz(s),l=a.length>0?s.getAttribute("data-story-key"):null;for(const m of a){const v=`trackedChange:${m}`;if(!r.has(v)){r.add(v);const k={type:"trackedChange",id:m};l&&(k.storyKey=l),n.push(k),o.push(k)}}const c=s.getAttribute("data-layout-story");if(c&&o.length>0){for(const m of o)m.story=c;o=[]}const d=s.getAttribute("data-citation-id");if(d){const m=`citation:${d}`;r.has(m)||(r.add(m),n.push({type:"citation",id:d}))}const f=s.getAttribute("data-comment-ids");if(f)for(const m of aA(f)){const v=`comment:${m}`;r.has(v)||(r.add(v),n.push({type:"comment",id:m}))}const h=s.getAttribute("data-sdt-type"),g=s.getAttribute("data-sdt-id");if(g&&h==="structuredContent"){const m=`contentControl:${g}`;if(!r.has(m)){r.add(m);const v=s.getAttribute("data-sdt-scope"),k=s.getAttribute("data-sdt-tag"),C={type:"contentControl",id:g};(v==="block"||v==="inline")&&(C.scope=v),k&&(C.tag=k),n.push(C)}}if(t&&i===t)break;i=i.parentElement}return n}var mo=()=>({oneOf:[{type:"boolean"},{type:"null"}]}),fl=()=>({oneOf:[{type:"string",minLength:1},{type:"null"}]}),_u=()=>({oneOf:[{type:"number"},{type:"null"}]}),Au=e=>({oneOf:[{type:"object",properties:e,additionalProperties:!1,minProperties:1},{type:"null"}]}),$z={type:"object",properties:{style:{oneOf:[{type:"string",minLength:1},{type:"null"}]},color:{oneOf:[{type:"string",minLength:1},{type:"null"}]},themeColor:{oneOf:[{type:"string",minLength:1},{type:"null"}]}},additionalProperties:!1,minProperties:1},Gz={type:"object",properties:{id:{type:"number"},val:{type:"boolean"}},required:["id"],additionalProperties:!1},Wz=()=>({oneOf:[{type:"boolean"},{type:"null"},$z]}),Kz=()=>({oneOf:[{type:"array",items:Gz,minItems:1},{type:"null"}]});function cm(e,t){return{storage:"mark",markName:e,textStyleAttr:t}}function qz(e){return{storage:"runAttribute",nodeName:"run",runPropertyKey:e}}var e2=(e,t,n)=>({key:e,type:"boolean",ooxmlElement:t,storage:"mark",tracked:!0,carrier:cm(n),schema:mo()}),uc=(e,t,n,r,o)=>({key:e,type:t,ooxmlElement:n,storage:"mark",tracked:!0,carrier:cm("textStyle",o??e),schema:r}),Un=(e,t,n,r,o)=>({key:e,type:t,ooxmlElement:n,storage:"runAttribute",tracked:!1,carrier:qz(o??e),schema:r}),um=[e2("bold","w:b","bold"),e2("italic","w:i","italic"),e2("strike","w:strike","strike"),{key:"underline",type:"object",ooxmlElement:"w:u",storage:"mark",tracked:!0,carrier:cm("underline"),schema:Wz()},{key:"highlight",type:"string",ooxmlElement:"w:highlight",storage:"mark",tracked:!0,carrier:cm("highlight"),schema:fl()},uc("color","string","w:color",fl()),uc("fontSize","number","w:sz",_u()),uc("fontFamily","string","w:rFonts",fl()),uc("letterSpacing","number","w:spacing",_u()),uc("vertAlign","string","w:vertAlign",{oneOf:[{enum:["superscript","subscript","baseline"]},{type:"null"}]}),uc("position","number","w:position",_u()),Un("dstrike","boolean","w:dstrike",mo()),Un("smallCaps","boolean","w:smallCaps",mo()),uc("caps","boolean","w:caps",mo(),"textTransform"),Un("shading","object","w:shd",Au({fill:{oneOf:[{type:"string",minLength:1},{type:"null"}]},color:{oneOf:[{type:"string",minLength:1},{type:"null"}]},val:{oneOf:[{type:"string",minLength:1},{type:"null"}]}})),Un("border","object","w:bdr",Au({val:{oneOf:[{type:"string",minLength:1},{type:"null"}]},sz:{oneOf:[{type:"number"},{type:"null"}]},color:{oneOf:[{type:"string",minLength:1},{type:"null"}]},space:{oneOf:[{type:"number"},{type:"null"}]}}),"borders"),Un("outline","boolean","w:outline",mo()),Un("shadow","boolean","w:shadow",mo()),Un("emboss","boolean","w:emboss",mo()),Un("imprint","boolean","w:imprint",mo()),Un("charScale","number","w:w",_u(),"w"),Un("kerning","number","w:kern",_u(),"kern"),Un("vanish","boolean","w:vanish",mo()),Un("webHidden","boolean","w:webHidden",mo()),Un("specVanish","boolean","w:specVanish",mo()),Un("rtl","boolean","w:rtl",mo()),Un("cs","boolean","w:cs",mo()),Un("bCs","boolean","w:bCs",mo(),"boldCs"),Un("iCs","boolean","w:iCs",mo(),"italicCs"),Un("eastAsianLayout","object","w:eastAsianLayout",Au({id:{oneOf:[{type:"string",minLength:1},{type:"null"}]},combine:{oneOf:[{type:"boolean"},{type:"null"}]},combineBrackets:{oneOf:[{type:"string",minLength:1},{type:"null"}]},vert:{oneOf:[{type:"boolean"},{type:"null"}]},vertCompress:{oneOf:[{type:"boolean"},{type:"null"}]}})),Un("em","string","w:em",fl()),Un("fitText","object","w:fitText",Au({val:{oneOf:[{type:"number"},{type:"null"}]},id:{oneOf:[{type:"string",minLength:1},{type:"null"}]}})),Un("snapToGrid","boolean","w:snapToGrid",mo()),Un("lang","object","w:lang",Au({val:{oneOf:[{type:"string",minLength:1},{type:"null"}]},eastAsia:{oneOf:[{type:"string",minLength:1},{type:"null"}]},bidi:{oneOf:[{type:"string",minLength:1},{type:"null"}]}})),Un("oMath","boolean","w:oMath",mo()),Un("rStyle","string","w:rStyle",fl(),"styleId"),Un("rFonts","object","w:rFonts",Au({ascii:{oneOf:[{type:"string",minLength:1},{type:"null"}]},hAnsi:{oneOf:[{type:"string",minLength:1},{type:"null"}]},eastAsia:{oneOf:[{type:"string",minLength:1},{type:"null"}]},cs:{oneOf:[{type:"string",minLength:1},{type:"null"}]},asciiTheme:{oneOf:[{type:"string",minLength:1},{type:"null"}]},hAnsiTheme:{oneOf:[{type:"string",minLength:1},{type:"null"}]},eastAsiaTheme:{oneOf:[{type:"string",minLength:1},{type:"null"}]},csTheme:{oneOf:[{type:"string",minLength:1},{type:"null"}]},hint:{oneOf:[{type:"string",minLength:1},{type:"null"}]}}),"fontFamily"),Un("fontSizeCs","number","w:szCs",_u()),Un("ligatures","string","w14:ligatures",fl()),Un("numForm","string","w14:numForm",fl()),Un("numSpacing","string","w14:numSpacing",fl()),Un("stylisticSets","array","w14:stylisticSets",Kz()),Un("contextualAlternates","boolean","w14:cntxtAlts",mo())],PH=new Set(um.map(e=>e.key)),Yz=Object.fromEntries(um.map(e=>[e.key,e])),DH={mark:um.filter(e=>e.storage==="mark").map(e=>e.key),runAttribute:um.filter(e=>e.storage==="runAttribute").map(e=>e.key)},t2=new WeakMap;function Xz(e){let t=t2.get(e);return t||(t={refCount:0,generation:0,abortController:new AbortController,inFlight:null,activeMutationTokens:new Set},t2.set(e,t)),t.refCount+=1,t}function Zz(e,t){t.refCount=Math.max(0,t.refCount-1),!(t.refCount>0)&&(t.abortController.abort("ui-controller-destroyed"),t.inFlight=null,t.activeMutationTokens.clear(),t2.delete(e))}var Qz=new Set(Object.values(lt));function n2(e,t){return typeof e=="string"&&Qz.has(e)?e:t}function cA(e){if(e&&typeof e=="object"&&e.ok===!1){const t=e.reason;return t==="host-not-ready"||t==="host-disposed"||t==="editing-mount-required"?{ok:!1,reason:lt.notReady}:{ok:!1,reason:n2(t,lt.targetUnresolved)}}return{ok:!0}}var Jz=["document-replaced","editorCreate","active-editor-change","document-mode-change","zoomChange","measurement-unit-change","viewport-change","fonts-changed"],eV={[j4.bulletList]:"bullet",[j4.numberedList]:"ordered"};function uA(e){return eV[e]??null}var tV={disc:"disc",circle:"circle",square:"square",decimal:"decimal","decimal-paren":"decimalParenthesis","upper-roman":"upperRoman","lower-roman":"lowerRoman","upper-alpha":"upperLetter","upper-alpha-paren":"upperLetterParenthesis","lower-alpha":"lowerLetter","lower-alpha-paren":"lowerLetterParenthesis"};function nV(e){const t=tV[e];return t?{preset:t,behavior:"toggleStyle"}:{}}var rV={status:"ready",empty:!0,target:null,selectionTarget:null,activeMarks:[],activeCommentIds:[],activeChangeIds:[],quotedText:""},oV=[{key:"contentControls",match:"exact",note:"full-document SDT catalog parse (the measured during-load cliff)"},{key:"contentControls:inRange:",match:"prefix",note:"same adapter load() as the catalog, issued per settled selection"},{key:"hyperlinks:",match:"prefix",note:"per-block hyperlink list over the loading story"},{key:"styles:catalog:",match:"prefix",note:"WordStyleModel recompile from package bytes"},{key:"comments",match:"exact",note:"audited: full comments list; stale-served during load"},{key:"trackChanges",match:"exact",note:"audited: shared all-story tracked-changes catalog; stale-served during load"},{key:"trackChanges:all",match:"exact",note:"audited: current-token validation over the shared all-story catalog; consumers fail closed on non-ready"},{key:"tables",match:"exact",note:"reserved: full tables catalog"},{key:"sections",match:"exact",note:"reserved: full sections list"}],iV=new Set(["/word/comments.xml","/word/commentsExtended.xml","/word/commentsIds.xml"]);function sV(e){return oV.some(t=>t.match==="exact"?t.key===e:e.startsWith(t.key))}var dA={ready:0,stale:1,pending:2};function hl(...e){let t="ready";for(const n of e)dA[n]>dA[t]&&(t=n);return t}function Lt(e,t){if(typeof e!="function")return t;try{const n=e();return n===void 0?t:n}catch{return t}}function xr(e){return!!e&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"}function yr(e,t){if(!e)return null;const n=t.split(".");let r=e;for(const o of n){if(r==null)return null;r=r[o]}return typeof r=="function"?r:null}function Xn(e,t="CAPABILITY_UNAVAILABLE"){return{success:!1,failure:{code:t,message:e}}}function Rf(e,t){return{success:!1,failure:{code:"PARTIAL_LINK_EDIT",message:"Hyperlink target was updated, but display text replacement failed."},applied:{href:!0,text:!1},hyperlinkResult:e,textResult:t}}function Lf(e){if(!e||typeof e!="object")return null;const t=e.target;return t&&typeof t=="object"?t:null}function r2(e){if(!e||typeof e!="object")return!1;const t=e,n=i=>{if(!i||typeof i!="object")return!1;const s=i;return s.kind==="text"&&typeof s.blockId=="string"&&typeof s.offset=="number"},r=i=>{if(!i||typeof i!="object")return!1;const s=i,a=s.range;return typeof s.blockId=="string"&&typeof a?.start=="number"&&typeof a.end=="number"};if(Array.isArray(t.segments)){const i=t.segments[0],s=t.segments[t.segments.length-1];return r(i)&&r(s)}if(t.kind==="selection")return n(t.start)&&n(t.end);if(t.kind!=="text"||typeof t.blockId!="string")return!1;const o=t.range;return typeof o?.start=="number"&&typeof o.end=="number"}function fA(e,t){if(!e||typeof e!="object")return null;const n=Lf(e),r=e,o=r.navigationTarget&&typeof r.navigationTarget=="object"?r.navigationTarget:null;if(o?.kind==="block"&&typeof o.blockId=="string"&&o.blockId.length>0){const i={kind:"text",blockId:o.blockId,range:{start:0,end:0},...o.story&&typeof o.story=="object"?{story:o.story}:{},...r.address&&typeof r.address=="object"?{address:r.address}:{}};if(t?.preferStableBlock||!r2(n))return i}return n}function Cr(e){if(!e||typeof e!="object")return"story:body";const t=e,n=typeof t.storyType=="string"?t.storyType:"body";switch(n){case"body":return"story:body";case"headerFooterPart":return`story:headerFooterPart:${typeof t.refId=="string"?t.refId:""}`;case"headerFooterSlot":return JSON.stringify({storyType:n,section:t.section??null,headerFooterKind:t.headerFooterKind??null,variant:t.variant??null,resolution:t.resolution??"effective",onWrite:t.onWrite??"materializeIfInherited"});case"footnote":return`story:footnote:${typeof t.noteId=="string"?t.noteId:""}`;case"endnote":return`story:endnote:${typeof t.noteId=="string"?t.noteId:""}`;case"textbox":return`story:textbox:${typeof t.textboxId=="string"?t.textboxId:""}`;default:return JSON.stringify(t)}}function Mf(e){if(!e||typeof e!="object")return null;const t=e,n=t.address&&typeof t.address=="object"?t.address:null;if(n?.story&&typeof n.story=="object")return n.story;if(t.storyLocator&&typeof t.storyLocator=="object")return t.storyLocator;if(t.trackedChangeStory&&typeof t.trackedChangeStory=="object")return t.trackedChangeStory;const r=Lf(e);if(!r||typeof r!="object")return null;const o=r;if(o.story&&typeof o.story=="object")return o.story;const i=o.address&&typeof o.address=="object"?o.address:null;return i?.story&&typeof i.story=="object"?i.story:null}function Di(e,t,n){return oo(e)!==t?!1:n?Cr(Mf(e))===Cr(n):!0}function dm(e){const t=Mf(e);if(!(!t||Cr(t)===Cr(null)))return t}function aV(e){if(typeof e!="string"||e.length===0)return;const t=_6(e);switch(t.kind){case"body":return;case"footnote":return t.id?{kind:"story",storyType:"footnote",noteId:t.id}:void 0;case"endnote":return t.id?{kind:"story",storyType:"endnote",noteId:t.id}:void 0;case"header":case"footer":return t.id?{kind:"story",storyType:"headerFooterPart",refId:t.id}:void 0;default:return}}function lV(e){if(!(typeof e!="string"||e.length===0||e==="body")){if(e.startsWith("hf:part:")){const t=e.slice(8);return t?{kind:"story",storyType:"headerFooterPart",refId:t}:void 0}if(e.startsWith("fn:")){const t=e.slice(3);return t?{kind:"story",storyType:"footnote",noteId:t}:void 0}if(e.startsWith("en:")){const t=e.slice(3);return t?{kind:"story",storyType:"endnote",noteId:t}:void 0}}}function o2(e){if(!e||typeof e!="object")return null;const t=e.selectionTarget;return t&&typeof t=="object"?t:null}function fm(e){if(!e||typeof e!="object")return null;const t=e.id;return typeof t=="string"&&t.length>0?t:null}function cV(e){if(!e||typeof e!="object")return null;const t=e;if(t.kind!=="selection")return e;const n=t.start;return!n||typeof n!="object"?null:{...t,end:n}}function oo(e){if(!e||typeof e!="object")return null;const t=e,n=t.id??t.commentId??t.changeId;return typeof n=="string"&&n.length>0?n:null}function uV(e){if(!e||typeof e!="object")return null;const t=e,n=t.anchor,r=t.focus,o=n?.visualCaret,i=r?.visualCaret,s=o?.trackChangeId,a=i?.trackChangeId;return typeof s=="string"&&s.length>0&&s===a?s:null}var hA=new WeakMap;function pA(e){const t=[],n=i=>{typeof i=="string"&&i.length>0&&!t.includes(i)&&t.push(i)},r=i=>{if(!i||typeof i!="object")return;const s=i,a=s.sourceIds;if(a&&typeof a=="object"&&(n(a.wordIdInsert),n(a.wordIdDelete),Array.isArray(a.wordIdOther)))for(const f of a.wordIdOther)n(f);const l=s.wordRevisionIds;l&&typeof l=="object"&&(n(l.insert),n(l.delete),n(l.format));const c=s.replacement;if(c&&typeof c=="object")for(const f of[c.inserted,c.deleted])f&&typeof f=="object"&&(n(f.id),n(f.wordId));const d=s.move;if(d&&typeof d=="object")for(const f of[d.source,d.destination])f&&typeof f=="object"&&(n(f.id),n(f.wordId))};r(e);const o=e?.change;return o&&o!==e&&r(o),t}function Os(e){const t=hA.get(e);if(t)return t;const n=new Set,r=new Map;for(const i of e){const s=oo(i);if(s){n.add(s);for(const a of pA(i)){r.has(a)||r.set(a,s);const l=`imported:${a}`;r.has(l)||r.set(l,s)}}}const o={toPublicId(i){if(n.has(i))return i;const s=r.get(i);return s!=null&&n.has(s)?s:null},aliasesFor(i){const s=[i];for(const[a,l]of r)l===i&&!s.includes(a)&&s.push(a);return s}};return hA.set(e,o),o}var mA=new WeakMap,gA=new WeakMap;function dc(e,t){const n=Cr(t);let r=mA.get(e);r||(r=new Map,mA.set(e,r));const o=r.get(n);if(o)return o;const i=Os(e.filter(s=>Cr(Mf(s))===n));return r.set(n,i),i}function dV(e){return!!e&&typeof e=="object"&&e.storyType==="textbox"}function fV(e,t){const n=t.filter(o=>e.some(i=>oo(i)===o&&Mf(i)==null));if(n.length===0)return null;if(n.length===1)return n[0];const r=new Set;for(const o of n){const i=e.find(s=>oo(s)===o);if(i)for(const s of pA(i)){if(r.has(s))return null;r.add(s)}}return n[0]}function hV(e){const t=gA.get(e);if(t)return t;const n=e.filter(o=>Mf(o)!=null),r=n.length===e.length?e:n;return gA.set(e,r),r}function pV(e){const{selectionIds:t,publicIds:n,selection:r,bodyItems:o,allStoryItems:i}=e;if(t.length===0)return null;const s=c=>{for(const d of t){const f=c.toPublicId(d);if(f)return f}return null},a=rs(r),l=Cr(a)===Cr(null);if(i){const c=l?hV(i):i,d=s(dc(c,a));if(d)return d;const f=n?.find(h=>c.some(g=>Di(g,h,a)));return f||(l?s(Os(o)):dV(a)?fV(i,t):null)}return l?s(Os(o))??t[0]??null:null}function mV(e,t){const n=e.find(r=>oo(r)===t||r.importedId===t);return n?n.rootCommentId??n.parentCommentId??oo(n)??t:null}function gV(e){const t=e.selectionTarget;if(t){const s=t.start,a=t.end,l=typeof s?.blockId=="string"?s.blockId:void 0,c=typeof a?.blockId=="string"?a.blockId:l;if(l)return{startBlockId:l,endBlockId:c??l}}const n=e.target,r=n&&Array.isArray(n.segments)?n.segments:[],o=r[0]?.blockId,i=r[r.length-1]?.blockId;return typeof o=="string"?{startBlockId:o,endBlockId:typeof i=="string"?i:o}:null}function Br(e){const t=[],n=s=>{typeof s=="string"&&s.length>0&&!t.includes(s)&&t.push(s)},r=e.target,o=r&&Array.isArray(r.segments)?r.segments:[];for(const s of o)n(s?.blockId);const i=e.selectionTarget;return i&&(n(i.start?.blockId),n(i.end?.blockId)),t}var vV=64;function fc(e){return e.length<=vV}function rs(e){const t=e.target,n=e.selectionTarget,r=n?.start,o=n?.end,i=t?.story??n?.story??r?.story??o?.story;return i&&typeof i=="object"?i:{kind:"story",storyType:"body"}}function Ao(e,t){return{kind:"block",nodeType:"paragraph",nodeId:e,...t&&typeof t=="object"?{story:t}:{}}}function ka(e){return{kind:"block",nodeType:"paragraph",nodeId:e}}function vA(e,t){return{kind:"block",nodeType:"listItem",nodeId:e,...t&&typeof t=="object"?{story:t}:{}}}var yA=720;function Fs(e){return Math.round(e*20)}function Iu(e){return typeof e=="number"&&Number.isFinite(e)}function yV(e){if(!e||typeof e!="object")return null;const t=e.node;if(!t||typeof t!="object")return null;const n=t.kind==="heading"?t.heading??null:t.kind==="paragraph"?t.paragraph??null:null;if(!n)return null;const r=n.resolved,o=n.props,i=r?.indent??o?.indent;if(!i||typeof i!="object")return null;const s=Iu(i.left)?Fs(i.left):Iu(i.start)?Fs(i.start):void 0,a=Iu(i.right)?Fs(i.right):Iu(i.end)?Fs(i.end):void 0,l=Iu(i.firstLine)?Fs(i.firstLine):void 0,c=Iu(i.hanging)?Fs(i.hanging):void 0;return s==null&&a==null&&l==null&&c==null?null:{...s!=null?{left:s}:{},...a!=null?{right:a}:{},...l!=null?{firstLine:l}:{},...c!=null?{hanging:c}:{}}}function i2(e){const t=e.target,n=t&&Array.isArray(t.segments)?t.segments:[],r=t?.story,o=[];for(const i of n){if(!i||typeof i.blockId!="string")continue;const s=i.range;!s||typeof s.start!="number"||typeof s.end!="number"||s.start===s.end||o.push({kind:"text",blockId:i.blockId,range:{start:s.start,end:s.end},...r?{story:r}:{}})}return o}function bV(e){if(!e||typeof e!="object")return[];const t=e,n=t.story,r=[];if(t.kind==="text"&&t.range&&typeof t.blockId=="string"){const o=t.range;return typeof o.start=="number"&&typeof o.end=="number"&&o.start!==o.end&&r.push({kind:"text",blockId:t.blockId,range:{start:Math.min(o.start,o.end),end:Math.max(o.start,o.end)},...n?{story:n}:{}}),r}if(t.kind==="text"&&Array.isArray(t.segments)){for(const o of t.segments){const i=o?.range;typeof o?.blockId=="string"&&typeof i?.start=="number"&&typeof i?.end=="number"&&i.start!==i.end&&r.push({kind:"text",blockId:o.blockId,range:{start:Math.min(i.start,i.end),end:Math.max(i.start,i.end)},...n?{story:n}:{}})}return r}if(t.kind==="selection"){const o=t.start,i=t.end,s=typeof o?.blockId=="string"&&i?.blockId===o.blockId?o.blockId:null;o?.kind==="text"&&i?.kind==="text"&&s&&typeof o.offset=="number"&&typeof i.offset=="number"&&o.offset!==i.offset&&r.push({kind:"text",blockId:s,range:{start:Math.min(o.offset,i.offset),end:Math.max(o.offset,i.offset)},...t.story??o.story?{story:t.story??o.story}:{}})}return r}function Pf(e){if(!e||typeof e!="object")return null;const t=e,n=t.story;if(t.kind==="text"&&t.range&&typeof t.blockId=="string"){const r=t.range;if(typeof r.start=="number"&&typeof r.end=="number"&&r.start===r.end)return{kind:"text",blockId:t.blockId,range:{start:r.start,end:r.end},...n?{story:n}:{}}}if(t.kind==="text"&&Array.isArray(t.segments)){const r=t.segments[0],o=r?.range;if(typeof r?.blockId=="string"&&typeof o?.start=="number"&&typeof o?.end=="number"&&o.start===o.end)return{kind:"text",blockId:r.blockId,range:{start:o.start,end:o.end},...n?{story:n}:{}}}if(t.kind==="selection"){const r=t.start,o=t.end,i=typeof r?.blockId=="string"&&o?.blockId===r.blockId?r.blockId:null;if(r?.kind==="text"&&o?.kind==="text"&&i&&typeof r.offset=="number"&&typeof o.offset=="number"&&r.offset===o.offset)return{kind:"text",blockId:i,range:{start:r.offset,end:r.offset},...t.story??r.story?{story:t.story??r.story}:{}}}return null}function pl(e){return Pf(e.target)??Pf(e.selectionTarget)}var bA=["fontFamily","fontSize","color","highlight"],wV={undo:"history.undo",redo:"history.redo"},Df=["bold","italic","underline","strikethrough"];function s2(e){return bA.includes(e)}function xu(e){const t=e.target,n=t&&Array.isArray(t.segments)?t.segments:[],r=[],o=(l,c,d)=>{typeof l!="string"||typeof c!="number"||typeof d!="number"||r.push({blockId:l,start:Math.min(c,d),end:Math.max(c,d)})};for(const l of n){const c=l?.range;o(l?.blockId,c?.start,c?.end)}if(r.length>0)return r;const i=e.selectionTarget,s=i?.start,a=i?.end;return!s||!a||s.blockId!==a.blockId||o(s.blockId,s.offset,a.offset),r}function os(e){const t=e.target,n=e.selectionTarget,r=n?.start,o=n?.end,i=t?.story??n?.story??r?.story??o?.story;return i&&typeof i=="object"?i:void 0}function CV(e){const t=os(e);if(!t||typeof t!="object")return"body";const n=t;return JSON.stringify({storyType:typeof n.storyType=="string"?n.storyType:"body",refId:typeof n.refId=="string"?n.refId:null,noteId:typeof n.noteId=="string"?n.noteId:null,textboxId:typeof n.textboxId=="string"?n.textboxId:null})}function Sa(e){const t=xu(e);return t.length===0?null:[CV(e),...t.map(n=>`${n.blockId}:${n.start}-${n.end}`)].join("|")}function wA(e){const t=e.selectionTarget;return!t||typeof t!="object"?null:cc({selectionTarget:t})}function kV(e,t){if(e==="fontSize"){const r=typeof t=="number"?t:Number(t);return Number.isFinite(r)&&r>0?String(r):null}if(typeof t!="string")return null;const n=t.trim();return n.length===0?null:e==="color"||e==="highlight"?n.toUpperCase():n}function SV(e,t){return Math.max(e.start,t.start)<Math.min(e.end,t.end)}function _V(e){if(!e)return[];const t=Array.isArray(e.blocks)?e.blocks:[],n=[];for(const r of t){const o=r?.range,i=r?.blockId;typeof i!="string"||typeof o?.start!="number"||typeof o?.end!="number"||n.push({blockId:i,start:Math.min(o.start,o.end),end:Math.max(o.start,o.end)})}return n}function AV(e,t){return e.length!==t.length?!1:e.every((n,r)=>{const o=t[r];return o?.blockId===n.blockId&&o?.start===n.start&&o?.end===n.end})}function CA(e,t){const n=xu(t);if(n.length===0)return null;const r=e&&Array.isArray(e.items)?e.items:[];if(r.length===0)return null;const o=r.find(i=>AV(n,_V(i)));if(o)return o;if(n.length===1){const i=r.find(s=>{const a=s?.address;return a?.kind==="block"&&a.nodeId===n[0].blockId});if(i)return i}return r[0]??null}function IV(e,t){const n=t==="fontSize"?e?.fontSizePt??e?.fontSize:t==="highlight"?e?.highlight??e?.backgroundColor:e?.[t];if(typeof n=="number")return Number.isFinite(n)?String(n):void 0;if(typeof n!="string")return;const r=n.trim();if(r.length!==0)return t==="color"||t==="highlight"?r.toUpperCase():r}function a2(e){if(typeof e!="string")return;const t=e.split(",")[0]?.trim().replace(/^['"]+|['"]+$/g,"").trim();if(!t)return;const n=t.toLowerCase();if(!(n==="serif"||n==="sans-serif"||n==="monospace"||n==="cursive"||n==="fantasy"))return t}function xV(e){if(typeof e!="number"||!Number.isFinite(e)||e<=0)return;const t=Math.round(e*.75*2)/2;if(!(t<=0))return String(t)}function EV(e,t){return e==="fontFamily"?t.toLowerCase():e==="color"||e==="highlight"?t.toUpperCase():t}function kA(e,t){if(!e)return{};const n=new Map;for(const i of xu(t)){const s=n.get(i.blockId)??[];s.push({start:i.start,end:i.end}),n.set(i.blockId,s)}if(n.size===0)return{};const r=Array.isArray(e.blocks)?e.blocks:[],o={};for(const i of bA){const s=new Map;let a=!1,l=!1;for(const c of r){const d=typeof c?.blockId=="string"?c.blockId:null;if(!d)continue;const f=n.get(d);if(!f?.length)continue;const h=Array.isArray(c?.runs)?c.runs:[];for(const g of h){const m=g?.range,v=typeof m?.start=="number"?m.start:null,k=typeof m?.end=="number"?m.end:null;if(v==null||k==null||!f.some(b=>SV(b,{start:v,end:k})))continue;a=!0;const C=IV(g?.styles,i);if(C===void 0){l=!0;continue}const _=EV(i,C);if(s.has(_)||s.set(_,C),s.size>1)break}if(s.size>1)break}a&&!l&&s.size===1&&(o[i]=[...s.values()][0])}return o}function l2(e,t){const n=Br(e)[0];return n?t==="nodeId"?{kind:"after",nodeId:n}:{kind:"after",target:Ao(n)}:{kind:"documentEnd"}}function rn(e,t){const n=e.supported??t!=="unsupported",r=e.enabled??(e.disabled!==void 0?!e.disabled:n);return{enabled:r,disabled:!r,active:e.active??!1,supported:n,value:e.value,source:t,reason:r?void 0:e.reason}}function Of(e){if(!e||typeof e!="object")return null;const t=e,n=t.change,r=n&&typeof n=="object"?n:t;return{...t,id:t.id??r.id,change:r}}function hm(e){const t=e,n=t.change;return n&&typeof n=="object"?n:t}function Ns(e){if(xr(e))return!0;if(e===!1)return!1;if(e===!0||e==null||typeof e!="object")return!0;const t=e;return"success"in t||"failure"in t||"effects"in t?e:t.status!=="rejected"}function pm(e){return!!e&&typeof e=="object"&&e.success===!0}function Io(e){return!(e===!1||e&&typeof e=="object"&&e.success===!1)}function Ff(e){return!!(e&&typeof e=="object"&&!Array.isArray(e))}function c2(e){const t=[],n=r=>{if(!r||typeof r!="object")return;const o=r;if(Array.isArray(o.runs)&&t.push(o),Array.isArray(o.rows))for(const i of o.rows){const s=i?.cells;if(Array.isArray(s))for(const a of s){const l=a;if(Array.isArray(l?.blocks))for(const c of l.blocks)n(c);l?.paragraph&&n(l.paragraph)}}};if(Array.isArray(e))for(const r of e)n(r);return t}function hc(e,t){return e.sourceAnchor?.sourceNodeId===t?!0:e.id===t}function mm(e){return e.trackedChange?.kind==="delete"?0:typeof e.text=="string"?e.text.length:0}function wi(e){let t=!1,n=null,r=null,o=null;for(const i of e)t=i,!Io(i)&&n===null&&(n=i),pm(i)&&(o=i),i!==!1&&(r=i);return n??o??r??t}function TV(e){const t=e?.anchor,n=t?.start,r=t?.end;return typeof n?.blockId!="string"||typeof r?.blockId!="string"||n.blockId!==r.blockId||typeof n.offset!="number"||typeof r.offset!="number"?null:{kind:"selection",start:{kind:"text",blockId:n.blockId,offset:n.offset},end:{kind:"text",blockId:r.blockId,offset:r.offset}}}function RV(e){return e.startsWith("#")?{kind:"anchor",anchor:e.slice(1)}:{kind:"external",url:e}}function gm(e){return ku(e)?.trackDecision??null}function LV(e){return{found:e.length>0,success:e.length>0,rects:e,rect:e[0]}}function ml(e){return{found:!1,success:!1,rects:[],reason:e}}function MV(e,t){if(!t||typeof t.getBoundingClientRect!="function"||e.rects.length===0)return e;let n;try{const o=t.getBoundingClientRect();n={left:o.left,top:o.top}}catch{return e}const r=e.rects.map(o=>({...o,left:o.left-n.left,right:o.right-n.left,top:o.top-n.top,bottom:o.bottom-n.top}));return{...e,rects:r,rect:r[0]}}function PV(e){if(!e||typeof e!="object")return!1;const t=e;if(typeof t.blockId!="string"||!t.range||typeof t.range!="object")return!1;const n=t.range;return Number.isInteger(n.start)&&Number.isInteger(n.end)&&n.start>=0&&n.start<=n.end}function SA(e){if(!e||e.kind!=="text"||!Array.isArray(e.segments)||e.segments.length===0)return null;const t=Array.from(e.segments);if(!t.every(PV))return null;const n=t[0],r=t[t.length-1],o=e.story;return{kind:"selection",start:{kind:"text",blockId:n.blockId,offset:n.range.start,...o?{story:o}:{}},end:{kind:"text",blockId:r.blockId,offset:r.range.end,...o?{story:o}:{}},...o?{story:o}:{}}}function DV(e){return e.selectionTarget?e.selectionTarget:SA(e.target)}function Eu(e){if(e.empty)return null;if(e.selectionTarget)return e.selectionTarget;const t=SA(e.target);return t&&t.start.kind==="text"&&t.end.kind==="text"&&t.start.blockId!==t.end.blockId?null:t}function u2(e){return!e.inline||typeof e.docRoute!="string"?null:e.docRoute.startsWith("format.")?e.docRoute.slice(7):null}var d2={bold:null,italic:null,underline:null,strike:null,color:null,highlight:null,fontFamily:null,fontSize:null,vertAlign:null,smallCaps:null,caps:null,letterSpacing:null,dstrike:null},OV=Object.fromEntries(Object.entries(d2).filter(([e])=>Yz[e]?.tracked===!0));function FV(e,t,n,r){switch(e.kind){case"toggle":{const o=typeof n=="object"&&n!==null&&"value"in n?n.value:n;return typeof o=="boolean"||o===null?{target:t,value:o}:{target:t,value:!r}}case"value-string":{const o=typeof n=="object"&&n!==null&&"value"in n?n.value:n;return o===null?{target:t,value:null}:typeof o!="string"||o.trim()===""?null:{target:t,value:o}}case"value-number":{const o=typeof n=="object"&&n!==null&&"value"in n?n.value:n,i=typeof o=="number"?o:Number(o);return!Number.isFinite(i)||i<=0?null:{target:t,value:i}}case"clear":return{target:t,inline:{...d2}};default:return null}}function NV(e){const t=o=>{if(!o||typeof o!="object")return null;const i=o,s=i.rowIndex,a=i.columnIndex;return typeof s!="number"||!Number.isInteger(s)||typeof a!="number"||!Number.isInteger(a)?null:{rowIndex:s,columnIndex:a}};if(!e)return null;const n=t(e.start),r=t(e.end);return!n||!r?null:{start:n,end:r}}function BV(e,t){const{tableNodeId:n,rowIndex:r,columnIndex:o,cellNodeId:i,mergeRange:s}=t;switch(e){case"insert-row-before":return{nodeId:n,rowIndex:r,position:"above"};case"insert-row-after":return{nodeId:n,rowIndex:r,position:"below"};case"delete-row":return{nodeId:n,rowIndex:r};case"insert-column-before":return{nodeId:n,columnIndex:o,position:"left"};case"insert-column-after":return{nodeId:n,columnIndex:o,position:"right"};case"delete-column":return{nodeId:n,columnIndex:o};case"delete-table":return{nodeId:n};case"merge-cells":{const a=s??{start:{rowIndex:r,columnIndex:o},end:{rowIndex:r,columnIndex:o}};return{nodeId:n,start:a.start,end:a.end}}case"split-cell":return i?{nodeId:i,rows:1,columns:2}:null;case"remove-borders":return{nodeId:n,mode:"applyTo",applyTo:"all",border:null};default:return null}}function zV(e){const t=e.superdoc,n=new Map,r=new Map;let o=null,i=0;const s=[];let a=null,l=0,c=!1,d=Promise.resolve(),f=null,h={mode:"idle",snapshot:null,sourceSelectionKey:null,lastClickAt:0,pointerSelecting:!1,keyboardSelecting:!1},g=0;const m=new Set;let v={},k="",C=null;const _=()=>{const u=t?.activeEditor;return u&&typeof u=="object"?u:null},b=()=>{const u=_()?.doc;return u&&typeof u=="object"?u:null},w=()=>{const u=_()?.v2TrackedChanges;return u&&typeof u=="object"?u:null},T=()=>{const u=_();if(u?.editorVersion!==2)return null;const p=u.reviewWindow;return p&&typeof p=="object"?p:null},L=()=>{const u=T();return!u||typeof u.getSnapshot!="function"?null:Lt(()=>u.getSnapshot(),null)},N=()=>typeof T()?.getSnapshot=="function",H=u=>{const p=u?.status;return p==="ready"||p==="stale"?p:"pending"},M=()=>{const u=_()?.host;return u&&typeof u=="object"?u:null},V=u=>{if(u.storyType!=="headerFooterPart"||typeof u.refId!="string")return null;const p=_(),y=M(),A=p?.pageLayout??y?.pageLayout;if(!A||typeof A!="object")return null;const x=A.getActiveRulerContext,z=y?.resolveHeaderFooterEditTarget;if(typeof x!="function"||typeof z!="function")return null;const W=Lt(()=>x.call(A),null);if(!W||typeof W.pageIndex!="number")return null;for(const re of["header","footer"]){const fe=Lt(()=>z.call(y,{pageIndex:W.pageIndex,kind:re}),null);if(!(fe?.status!=="ready"||fe.refId!==u.refId||typeof fe.sectionId!="string"||!["default","first","even"].includes(String(fe.slotVariant))))return{kind:"story",storyType:"headerFooterSlot",section:{kind:"section",sectionId:fe.sectionId},headerFooterKind:re,variant:fe.slotVariant}}return null},q=()=>{const u=M(),p=u?.getPendingInlineFormat;if(typeof p!="function")return null;const y=Lt(()=>p.call(u),null);return y&&typeof y=="object"?y:null},D=u=>{const p=u2(u);if(!p)return null;const y=q();if(!y||!(p in y))return null;const A=y[p];return u.inline?.kind==="toggle"?A===!0:A!=null&&A!==""},B=u=>{const p=u2(u);if(!p)return;const y=q();if(!y||!(p in y))return;const A=y[p];if(typeof A=="string"&&A!=="")return A;if(typeof A=="number"&&Number.isFinite(A))return String(A)},E=(u,p)=>{const y=M(),A=y?.setPendingInlineFormat;typeof A=="function"&&Lt(()=>A.call(y,u,p),void 0)},j=u=>{const p=M(),y=p?.clearPendingInlineFormat;typeof y=="function"&&Lt(()=>y.call(p,u),void 0)},J=new Set(["bold","italic","underline","strikethrough"]),Y=u=>{const p=q();if(!p)return;const y=Array.isArray(u.activeMarks)?u.activeMarks:[];let A=null;for(const x of Object.keys(p)){const z=p[x];let W;if(J.has(x))W=y.includes(x)===(z===!0);else if(s2(x)){if(z==null)continue;A||(A=xl(u)),W=A[x]===z}else W=!1;W&&j(x)}},se=()=>{const u=_()?.editCommands;return u&&typeof u=="object"?u:null},pe=u=>{const p=se();if(!p||typeof p.getSnapshot!="function")return null;const y=Lt(()=>p.getSnapshot(),null)?.commands?.[u];return y&&typeof y=="object"?y:null},Ve=()=>pe("lists.apply"),ge=u=>{const p=u?.value?.seed;return p==="bullet"||p==="ordered"?p:null},be=u=>{const p=wV[u];return p?pe(p):null},ve=()=>{const u=M();if(!u||typeof u.getTableContext!="function")return null;const p=Lt(()=>u.getTableContext(),null);return p&&typeof p=="object"?p:null},ke=()=>{const u=ve();if(!u||u.inTable!==!0)return null;const p=u.table,y=typeof p?.nodeId=="string"&&p.nodeId.length>0?p.nodeId:null;if(!y)return null;const A=u.row,x=u.column,z=u.cell,W=typeof A?.index=="number"&&Number.isInteger(A.index)?A.index:null,re=typeof x?.index=="number"&&Number.isInteger(x.index)?x.index:null;if(W==null||re==null)return null;const fe=typeof z?.nodeId=="string"&&z.nodeId.length>0?z.nodeId:null,Me=u.cellRange;return{tableNodeId:y,rowIndex:W,columnIndex:re,cellNodeId:fe,mergeRange:NV(Me)}},oe=new Map;let Re=null,je=null,tt=0,wt=0,Te=0;const We=new Set,Ye=(u,p)=>u===p?!0:!u||!p?!1:u.id===p.id&&u.paintedEntityId===p.paintedEntityId&&Cr(u.story)===Cr(p.story),ee=u=>Array.from(We).some(p=>Ye(p,u)),S=u=>{const p=M();if(typeof p?.getHandles!="function")return;const y=Lt(()=>p.getHandles(),null),A=y?.review;if(A){if(u){if(typeof A.setActiveReviewTarget!="function")return;const x=y?.layout;Lt(()=>A.setActiveReviewTarget({entityType:"trackedChange",entityId:u.id,...u.paintedEntityId?{paintedEntityId:u.paintedEntityId}:{},origin:"panel",layoutEpoch:typeof x?.generation=="number"?x.generation:0,story:u.story??{kind:"story",storyType:"body"}}),null);return}typeof A.getActiveReviewTarget!="function"||typeof A.clearActiveReviewTarget!="function"||Lt(()=>A.getActiveReviewTarget(),null)?.entityType==="trackedChange"&&Lt(()=>A.clearActiveReviewTarget(),void 0)}},ne=(u,p)=>{je=u,tt+=1,Te+=1,p?.invalidateQueuedNavigation!==!1&&(wt+=1)},O=new Set;let P,U=!1,$=null;const Q=new Map,Z=new Set;let K=null,me=null,xe=!1,he=null,Pe=0,Je=null,nt=null,ut=null;const Ht=()=>{if(xe||U)return;xe=!0;const u=()=>{xe=!1,U||Dt()};typeof queueMicrotask=="function"?queueMicrotask(u):Promise.resolve().then(u)},He=250,Vt=5e3,Mt=u=>{U||he&&Pe<=u||(he&&clearTimeout(he),Pe=u,he=setTimeout(()=>{he=null,Pe=0,U||Dt()},Math.max(0,u-Date.now())))},sn=new WeakMap;let qn=0;const Kt=u=>{if(!u)return"none";let p=sn.get(u);return p==null&&(p=qn+=1,sn.set(u,p)),`e${p}`};let Qe=0;const Pt=e.superdoc,It=Xz(Pt),Sn=()=>{It.abortController.abort("review-mutation-started"),It.inFlight=null},tn=()=>{It.generation+=1,It.abortController=new AbortController,It.inFlight=null},hn=u=>{const p=It.activeMutationTokens;if(typeof u!="string"||u.length===0||p.has(u))return;const y=p.size===0;p.add(u),y&&Sn()},Vn=u=>{const p=It.activeMutationTokens;typeof u!="string"||!p.delete(u)||p.size===0&&tn()},pr=u=>{const p=w(),y=p?.listTrackedChanges;if(typeof y!="function")return _()?.editorVersion===2?Promise.reject(new Error("v2-tracked-changes-bridge-pending")):u();if(It.activeMutationTokens.size>0)return Promise.reject(new Error("ui-review-catalog-superseded"));const A=It.generation,x=It.inFlight;if(x?.generation===A)return x.promise;const z=It.abortController.signal,W=Me=>{if(z.aborted||A!==It.generation||Me?.reason==="review-hydration-superseded")throw new Error("ui-review-catalog-superseded");return Me},re=y.call(p,{blocking:!1,signal:z});if(!xr(re))return W(re);const fe=Promise.resolve(re).then(W);return It.inFlight={generation:A,promise:fe},fe.then(()=>{It.inFlight?.promise===fe&&(It.inFlight=null)},()=>{It.inFlight?.promise===fe&&(It.inFlight=null)}),fe};let Ur=null,Yn=new Set,wn=null,tr=0,ri=null;const on=()=>`${Kt(_())}|m${Qe}`,Ae=()=>{Ur=null,Yn=new Set},ze=u=>{for(const p of["trackChanges","trackChanges:all"]){const y=Q.get(p);if(!y?.hasSettled||!Array.isArray(y.value))continue;const A=y.value.filter(x=>{const z=oo(x);return!z||!u.has(z)});A.length!==y.value.length&&Q.set(p,{...y,value:A})}},rt=u=>{const p=()=>{if(!U)for(const z of[...O])z(P)},y=Ff(u)?u:null,A=_()?.documentMutationReadiness,x=()=>{const z=globalThis.requestAnimationFrame;return typeof z!="function"?Promise.resolve():new Promise(W=>{let re=!1;const fe=()=>{re||(re=!0,clearTimeout(Me),W())},Me=setTimeout(fe,250);z(()=>z(()=>setTimeout(fe,0)))})};if(y?.success===!0&&typeof y.txId=="string"&&y.txId.length>0&&typeof A?.whenPainted=="function")try{Promise.resolve(A.whenPainted.call(A,y)).then(x,()=>{}).then(p,p);return}catch{}p()},ft=(u,p)=>{const y=P.trackChanges,A=y.items.filter(W=>{const re=oo(W);return!re||!u.has(re)});if(A.length===y.items.length)return;je&&u.has(je.id)&&ne(null);const x=new Set;for(const W of A){const re=hm(W),fe=W,Me=re.author??re.authorEmail??fe.author??fe.authorEmail;typeof Me=="string"&&x.add(Me)}const z=y.items.length-A.length;P={...P,trackChanges:{...y,items:A,total:Math.max(A.length,y.total-z),activeId:y.activeId&&u.has(y.activeId)?null:y.activeId,authors:[...x]}},rt(p)},Et=u=>{const p=P.trackChanges,y=p.items.length>0||p.total!==0||p.activeId!==null||p.authors.length>0;wn=on(),je!==null&&ne(null),P={...P,trackChanges:{...p,items:[],total:0,activeId:null,authors:[]}},y&&rt(u)},Nt=(u,p)=>{if(u.size===0)return;const y=on(),A=Ur===y?Yn:new Set,x=new Set([...u].filter(z=>!A.has(z)));x.size!==0&&(Ur=y,Yn=new Set([...A,...x]),ze(Yn),ft(x,p))},pn=u=>Ur===u&&Yn.size>0?Yn:null,Jt=u=>{const p=on(),y=pn(p),A=u.map(Of).filter(x=>{if(x==null)return!1;const z=oo(x);return z!=null&&!y?.has(z)});for(const x of["trackChanges","trackChanges:all"])Q.set(x,{token:p,value:[...A],hasSettled:!0,inflightToken:null})},Zn=()=>`${on()}|m${mr()}|s${tr}`,Hr=u=>JSON.stringify({t:u.target??null,s:u.selectionTarget??null}),Go=["contentControls:inRange:","query:","effInline:"],Ci=120,qt=180,kn=()=>{const u=M(),p=u?.getDocumentLoadingSnapshot;if(typeof p!="function")return"unknown";const y=Lt(()=>p.call(u),null)?.sourceStage;return y==="opening"||y==="bootstrap-ready"||y==="source-loading"?"loading":y==="source-complete"||y==="source-failed"||y==="source-cancelled"?"complete":"unknown"},jn=new Map,sr=new Map,Yt=new Map;let Rn=null,$r=0,xo=0;const Bo=u=>{const p=on();jn.get(u)!==p&&(jn.set(u,p),Ht())},pc=()=>{const u=Q.get("comments");return u?.hasSettled?Array.isArray(u.value)&&u.value.length>0:u?.inflightToken!=null},gl=(u,p)=>jn.get(u)===p,Wo=()=>{const u=on();let p=!1;for(const[y,A]of sr){if(A!==u){sr.delete(y);continue}if(Yt.get(y)===u)continue;const x=Q.get(y);!x?.hasSettled||x.token!==u||x.inflightToken!=null||(Q.set(y,{...x,token:null,inflightToken:null}),Yt.set(y,u),p=!0)}p&&Ht()},_a=u=>{u==="comments"?$r+=1:xo+=1,Bo(u);let p=!1;return()=>{p||(p=!0,u==="comments"?$r=Math.max(0,$r-1):xo=Math.max(0,xo-1),(u==="comments"?$r:xo)===0&&jn.get(u)===on()&&jn.delete(u),Ht())}},we=u=>{Bo("contentControls")},Be=()=>{const u=Q.get("trackChanges");u?.hasSettled||u?.inflightToken!=null||Bo("trackChanges")},kt=()=>{const u=Q.get("comments");u?.hasSettled||u?.inflightToken!=null||Bo("comments")},it=6500,Hn=250;let Ln=0,go=0,Gr=!1,vo=null;const ki=()=>{if(U||vo)return;const u=()=>{if(vo=null,U)return;const p=Date.now()-Ln;if(oi()||p<it){vo=setTimeout(u,Hn);return}Gr=!1,Dt()};vo=setTimeout(u,0)};let Wr=null,Kr=null;const qr=()=>{const u=M();if(!u||Wr===u)return;Kr&&(Kr(),Kr=null),Wr=u;const p=u.subscribeDocumentLoading;if(typeof p!="function"){Wr=null,Er(it);return}try{const y=z=>{const W=z?.sourceStage;(W==="source-complete"||W==="source-failed"||W==="source-cancelled")&&(Rn=on(),Wo(),Ln=Math.max(Ln,Date.now()),ki())},A=p.call(u,y);typeof A=="function"&&(Kr=A);const x=u.getDocumentLoadingSnapshot;typeof x=="function"&&y(Lt(()=>x.call(u),null))}catch{Wr=null,Er(it)}},io=()=>{const u=_()?.host,p=u?.getForegroundMutationState;if(typeof p!="function")return null;const y=Lt(()=>p.call(u),null);return{active:typeof y?.active=="number"?y.active:0,pending:typeof y?.pending=="number"?y.pending:0}},oi=()=>{const u=io();return!!(u&&(u.active>0||u.pending>0))},Er=(u=Ci)=>{U||Je||(Je=setTimeout(()=>{if(Je=null,U)return;if(nt&&oi()){Er(),Dt();return}const p=nt;nt=null,p===Zn()&&bl("selection",p,mc,zi),Dt()},u))},ss=(u,p)=>{if(!io())return!1;const y=`${u}\0${p}`;return Z.has(y)?!1:(Z.add(y),Er(qt),!0)},Si=u=>{if(K==null||u===K)return me?.timer&&clearTimeout(me.timer),me=null,K=u,!1;if(me?.key===u)return me.ready?(me=null,K=u,!1):!0;me?.timer&&clearTimeout(me.timer);const p={key:u,ready:!1,timer:null};return p.timer=setTimeout(()=>{U||me!==p||(p.timer=null,p.ready=!0,Dt())},qt),me=p,!0},_i=u=>Uz(u),Aa=()=>{Ni(),Dt()};let Oi=null,Fi=!1,Bs=0;const Ia=()=>{Oi=null,Fi=!1,Bs+=1},vl=()=>{const u=_(),p=u?.documentMutationReadiness;if(!u||typeof p?.whenPainted!="function"||(Oi={editor:u,readiness:p,afterEpoch:typeof p.getRenderEpoch=="function"?Lt(()=>p.getRenderEpoch.call(p),null):null},Fi))return;Fi=!0;const y=Bs;(async()=>{for(;!U&&y===Bs;){const x=Oi;if(Oi=null,!x){Fi=!1;return}let z=!1;try{await x.readiness.whenPainted.call(x.readiness,typeof x.afterEpoch=="number"?{afterEpoch:x.afterEpoch}:void 0),z=!0}catch{}if(U||y!==Bs)return;if(_()!==x.editor){Ia();return}z&&Aa()}})()},yl=()=>{ut&&clearTimeout(ut),ut=setTimeout(()=>{ut=null,U||Aa()},500)},bl=(u,p,y,A)=>{let x;try{x=y()}catch{x=void 0}if(!xr(x)){const re={token:p,value:A(x),hasSettled:!0,inflightToken:null,failedToken:null,failureCount:0,retryAtMs:0};return Q.set(u,re),re}const z=Q.get(u),W=z?.failedToken===p;return Q.set(u,{token:z?.token??null,value:z?.value??null,hasSettled:z?.hasSettled??!1,inflightToken:p,failedToken:W?p:null,failureCount:W?z.failureCount??0:0,retryAtMs:0}),Promise.resolve(x).then(re=>{const fe=Q.get(u);!fe||fe.inflightToken!==p||(Q.set(u,{token:p,value:A(re),hasSettled:!0,inflightToken:null,failedToken:null,failureCount:0,retryAtMs:0}),Ht())},()=>{const re=Q.get(u);if(!re||re.inflightToken!==p)return;const fe=re.failedToken===p?(re.failureCount??0)+1:1,Me=Math.min(Vt,He*2**Math.min(fe-1,8)),Ue=Date.now()+Me;Q.set(u,{...re,inflightToken:null,failedToken:p,failureCount:fe,retryAtMs:Ue}),Mt(Ue)}),null},Tr=(u,p,y,A)=>{const x=Q.get(u);if(x&&x.token===p&&x.hasSettled)return{value:x.value,status:"ready"};if(sV(u)&&!gl(u,p)){if(kn()==="loading")return Gr=!0,qr(),x?.hasSettled?{value:x.value,status:"stale"}:{value:null,status:"pending"};if(Gr)return ki(),x?.hasSettled?{value:x.value,status:"stale"}:{value:null,status:"pending"};if(Date.now()-go<it)return Gr=!0,ki(),x?.hasSettled?{value:x.value,status:"stale"}:{value:null,status:"pending"}}if(oi())return Er(),x?.hasSettled?{value:x.value,status:"stale"}:{value:null,status:"pending"};if(x?.failedToken===p&&x.inflightToken==null&&(x.retryAtMs??0)>Date.now())return Mt(x.retryAtMs),x.hasSettled?{value:x.value,status:"stale"}:{value:null,status:"pending"};if(!x&&u.startsWith("effInline:")&&Si(u))return{value:null,status:"pending"};if(!x&&ss(u,p))return{value:null,status:"pending"};if(!x||x.inflightToken!==p){const W=bl(u,p,y,A);if(W)return{value:W.value,status:"ready"}}const z=Q.get(u);return z?.hasSettled?{value:z.value,status:"stale"}:{value:null,status:"pending"}},Nf=u=>{for(const p of Q.keys())u(p)&&Q.delete(p)},wl=u=>{const p=Hr(u),y=wA(u);return new Set([`contentControls:inRange:${p}`,`query:${p}`,...y?[`effInline:${y}`]:[]])},Bf=u=>{const p=wl(u);Nf(y=>Go.some(A=>y.startsWith(A))&&!p.has(y));for(const y of Z){const A=y.split("\0",1)[0];Go.some(x=>A.startsWith(x))&&!p.has(A)&&Z.delete(y)}},as=()=>{const u=_();u!==ri&&(Ia(),ri=u,Q.clear(),he&&clearTimeout(he),he=null,Pe=0,me?.timer&&clearTimeout(me.timer),me=null,K=null,C=null,o=null,nt=null,Z.clear(),jn.clear(),sr.clear(),Yt.clear(),Rn=null,Gr=!1,Kr&&Kr(),Kr=null,Wr=null,Ae(),wn=null)},Ni=()=>{Qe+=1,sr.clear(),Yt.clear(),Rn=null,Ae()},Cl=()=>{const u=wn===on();Ni(),u&&(Jt([]),wn=on()),Dt()},Tu=u=>{if(typeof u!="string"||u.length===0)return Xn("insertText requires a non-empty string.","INVALID_INPUT");if(mr()==="viewing")return Xn("The document is read-only.","DOCUMENT_READONLY");const p=b(),y=p?.insert;if(!p||typeof y!="function")return Xn("insert is unavailable.");const A=p.selection?.current;if(typeof A!="function")return Xn("selection.current is unavailable.");const x=W=>{const re=W&&typeof W=="object"?W:null,fe=re?.selectionTarget??re?.target??null;return!fe||typeof fe!="object"?Xn("insertText requires a live selection target.","PRECONDITION_FAILED"):Lt(()=>Dl(y.call(p,{type:"text",value:u,target:fe}),Xn("insert failed.")),Xn("insert failed."))};let z;try{z=A.call(p.selection)}catch{return Xn("insertText could not resolve the live selection.","PRECONDITION_FAILED")}return xr(z)?Promise.resolve(z).then(x,()=>Xn("insertText could not resolve the live selection.","PRECONDITION_FAILED")):x(z)},Ru=(u,p)=>({payload:u,state:P,editor:_(),superdoc:t,context:p,ui:$,execute:(y,A)=>Ac(y,A),executeAsync:(y,A)=>Em(y,A),doc:b(),selection:P.selection,documentMode:mr(),insertText:Tu}),Bi=u=>u==="editing"||u==="suggesting"||u==="viewing"?u:null,mr=()=>{const u=_(),p=t&&typeof t=="object"?t:null,y=Bi(p?.config?.documentMode),A=Lt(typeof p?.getActiveRuntime=="function"?()=>{const W=p.getActiveRuntime();return typeof W?.getSnapshot=="function"?W.getSnapshot():null}:void 0,null),x=Bi(A?.documentMode),z=Bi(u?.options?.documentMode);return y&&x&&y!==x?y:x??y??z},zf=()=>{const u=t&&typeof t=="object"?t:null,p=u?.interactionConfig?.comments;if(p&&typeof p.readOnly=="boolean")return p.readOnly===!0;const y=u?.config?.modules?.comments;return!!y&&typeof y=="object"&&y.readOnly===!0},ii=()=>{const u=t&&typeof t=="object"?t:null,p=u?.interactionConfig?.comments;if(p&&typeof p.allowResolve=="boolean")return p.allowResolve===!1;const y=u?.config?.modules?.comments;return!!y&&typeof y=="object"&&y.allowResolve===!1},zs=()=>mr()==="viewing"||zf(),zi=u=>u&&typeof u=="object"?u:null,Vs=(u,p)=>{if(!u)return{...rV,status:p};const y=u.target??null,A=typeof u.text=="string"?u.text:"";return{status:p,empty:u.empty===!0,target:y,selectionTarget:u.selectionTarget??null,activeMarks:Array.isArray(u.activeMarks)?u.activeMarks:[],activeCommentIds:Array.isArray(u.activeCommentIds)?u.activeCommentIds:[],activeChangeIds:Array.isArray(u.activeChangeIds)?u.activeChangeIds:[],quotedText:A}},js=()=>{const u=b()?.selection;return Tr("selection",Zn(),()=>u?.current?u.current({includeText:!0}):void 0,zi)},kl=()=>{const{value:u,status:p}=js();return Vs(u,p)},mc=()=>{const u=b()?.selection;return u?.current?u.current({includeText:!0}):void 0},gc=u=>{if(u.empty!==!0)return!1;const p=u.selectionTarget,y=p?.start,A=p?.end;return y?.kind==="text"&&A?.kind==="text"&&typeof y.blockId=="string"&&y.blockId===A.blockId&&typeof y.offset=="number"&&y.offset===A.offset},Sl=u=>{const p=M(),y=p?.readLiveSelectionSyncSnapshot;if(typeof y!="function")return;const A=zi(Lt(()=>y.call(p),null));if(!A||!gc(A))return;const x=Zn(),z=io(),W=!!(z&&(z.active>0||z.pending>0));if(W)nt=x,Er();else if(nt=null,bl("selection",x,mc,zi))return;const re=Q.get("selection"),fe=Array.isArray(A.activeMarks)&&A.activeMarks.length>0?A.activeMarks:Array.isArray(P.selection.activeMarks)?P.selection.activeMarks:[],Me=Array.isArray(A.activeCommentIds)?A.activeCommentIds:[],Ue=uV(u),$e=pl(P.selection),qe=Pf(A.selectionTarget)??Pf(A.target),Ze=$e?.range,Ge=qe?.range,et=!!(z&&z.active>0&&$e&&qe&&$e.blockId===qe.blockId&&Cr($e.story)===Cr(qe.story)&&typeof Ze?.start=="number"&&typeof Ge?.start=="number"&&Math.abs(Ge.start-Ze.start)<=2),ht=Ue!=null||et?P.selection.activeChangeIds.filter(ot=>Ue==null||Os(P.trackChanges.items).aliasesFor(ot).includes(Ue)):[],dt=Array.isArray(A.activeChangeIds)&&A.activeChangeIds.length>0?A.activeChangeIds:ht;Q.set("selection",{token:x,value:{...A,activeMarks:fe,activeCommentIds:Me,activeChangeIds:dt},hasSettled:!0,inflightToken:W?null:re?.inflightToken??null})},ls=async(u=0)=>{const p=b()?.selection,y=p?.current,A=Zn();if(typeof y!="function")return Q.set("selection",{token:A,value:null,hasSettled:!0,inflightToken:null}),Dt(),P.selection;let x;try{x=y.call(p,{includeText:!0}),xr(x)&&(x=await Promise.resolve(x))}catch{x=null}return U?Vs(null,"pending"):Zn()!==A?u<1?ls(u+1):P.selection:(Q.set("selection",{token:A,value:zi(x),hasSettled:!0,inflightToken:null}),Dt(),P.selection)},vc=()=>{const u=b()?.comments;return Tr("comments",on(),()=>u?.list?u.list():void 0,p=>p&&Array.isArray(p.items)?p.items:[])},Us=(u="trackChanges")=>{const p=on(),y=b()?.trackChanges,A=w(),x=typeof A?.listTrackedChanges=="function"?A.listTrackedChanges:null,z=Tr(u,p,()=>x?pr(()=>y?.list?.({in:"all"})):y?.list?y.list({in:"all"}):void 0,W=>{const re=W&&typeof W=="object"?W:null;if(re?.complete===!1||re?.sourceCoverageComplete===!1){if(sr.set(u,p),qr(),Rn===p||kn()==="complete"){const fe=()=>{U||Wo()};typeof queueMicrotask=="function"?queueMicrotask(fe):Promise.resolve().then(fe)}}else sr.get(u)===p&&sr.delete(u);return re&&Array.isArray(re.items)?re.items:[]});return sr.get(u)===p&&z.status==="ready"?{...z,status:"stale"}:z},Vf=u=>{const p=L(),y=N(),A=y?null:vc(),x=y&&Array.isArray(p?.commentItems)?p.commentItems:null,z=y?x:A.value,W=y?H(p):A.status,re=z??[],fe=u.activeCommentIds,Me=Q.get("comments"),Ue=Me?.token===on()&&Me.hasSettled&&Array.isArray(Me.value)?Me.value:null,$e=$r>0?Ue:re;Re&&$e&&!$e.some(Ze=>oo(Ze)===Re)&&(Re=null);const qe=Re??fe[0]??null;return{status:hl(W,u.status),listStatus:W,items:re,total:re.length,activeIds:fe,activeId:qe}},yc=new WeakMap,Vi=u=>{const p=yc.get(u);if(p)return p;const y=u.map(Of).filter(A=>A!=null);return yc.set(u,y),y},_l=new WeakMap,xa=(u,p)=>{const y=_l.get(u);if(y?.suppressedIds===p)return y.value;const A=p?u.filter(x=>{const z=oo(x);return!z||!p.has(z)}):u;return _l.set(u,{suppressedIds:p,value:A}),A},Rr=new WeakMap,bc=u=>{const p=Rr.get(u);if(p)return p;const y=new Set;for(const x of u){const z=hm(x),W=x,re=z.author??z.authorEmail??W.author??W.authorEmail;typeof re=="string"&&y.add(re)}const A=[...y];return Rr.set(u,A),A},si=()=>{const u=on();if(N()){const A=Q.get("trackChanges"),x=A?.token===u&&A.hasSettled&&Array.isArray(A.value)?A.value:L()?.trackedChangeItems;return Array.isArray(x)?Vi(x):null}const{value:p,status:y}=Us("trackChanges:all");return y==="ready"?Vi(p??[]):null},wc=u=>{const p=on(),y=pn(p),A=L(),x=N(),z=x?null:Us(),W=x&&Array.isArray(A?.trackedChangeItems)?A.trackedChangeItems:null,re=x?W:z.value,fe=x?H(A):z.status,Me=xa(Vi(re??[]),y),Ue=si(),$e=je;if($e&&!We.has($e)){const zt=Q.get("trackChanges"),Gn=zt?.token===p&&zt.hasSettled&&Array.isArray(zt.value)?xa(Vi(zt.value),y):null,Wn=xo>0?Gn:$e.story?Ue:Me;Wn&&!Wn.some(Jr=>Di(Jr,$e.id,$e.story))&&ne(null)}const qe=Ue??Me,Ze=dc(qe,rs(u)),Ge=wn===p?[]:y?u.activeChangeIds.filter(zt=>!y.has(zt)):u.activeChangeIds,et=Ge.map(zt=>Ze.toPublicId(zt)??zt),ht=je?.story?dc(qe,je.story):Os(qe),dt=je?ht.toPublicId(je.id)??je.id:null,ot=pV({selectionIds:Ge,publicIds:et,selection:u,bodyItems:Me,allStoryItems:Ue}),Bt=dt??ot;return{status:hl(fe,u.status),items:Me,total:Me.length,activeId:Bt,authors:bc(Me)}},Lu=(u,p)=>{if(!N())return p;Bo("comments");const y=vc(),A=y.value??p.items;return{status:hl(y.status,u.status),listStatus:y.status,items:A,total:A.length,activeIds:u.activeCommentIds,activeId:Re??u.activeCommentIds[0]??null}},ji=(u,p)=>{if(!N())return p;Bo("trackChanges");const y=Us(),A=pn(on()),x=xa(Vi(y.value??p.items),A),z=je?.story?dc(x,je.story):Os(x),W=je?z.toPublicId(je.id)??je.id:p.activeId;return{status:hl(y.status,u.status),items:x,total:x.length,activeId:W,authors:bc(x)}},Cc=u=>{const p=b()?.contentControls,{value:y,status:A}=Tr("contentControls",on(),()=>p?.list?p.list():void 0,re=>re&&Array.isArray(re.items)?re.items:[]),x=y??[],{ids:z,status:W}=jf(p,u);return{status:hl(A,W,u.status),items:x,total:x.length,activeId:z[0]??null,activeIds:z}},Hs=(u,p)=>{if(!u||typeof u.listInRange!="function")return{lockModesById:new Map,status:"ready"};const y=gV(p);if(!y)return{lockModesById:new Map,status:"ready"};const{value:A,status:x}=Tr(`contentControls:inRange:${Hr(p)}`,on(),()=>u.listInRange(y),re=>re&&Array.isArray(re.items)?re.items:[]),z=A??[],W=new Map;for(const re of z)typeof re?.id=="string"&&W.set(re.id,typeof re.lockMode=="string"?re.lockMode:"unlocked");return{lockModesById:W,status:x}},jf=(u,p)=>{const{lockModesById:y,status:A}=Hs(u,p);return{ids:[...y.keys()],status:A}},Mu=()=>{const u=t?.fonts;return{options:$V(UV(Lt(u?.getDocumentFontOptions?()=>u.getDocumentFontOptions():void 0,[])),HV(Lt(u?.getFontFamilyOptions?()=>u.getFontFamilyOptions():void 0,[]))),sizeOptions:GV}},kc=()=>{const u=Lt(t?.getZoomState?()=>t.getZoomState():void 0,null),p=typeof u?.value=="number"?u.value:100,y=u?.mode;return{mode:y==="manual"||y==="fit-width"?y:y==="fixed"?"manual":null,value:p,min:typeof u?.min=="number"?u.min:10,max:typeof u?.max=="number"?u.max:100}},Pu=()=>Lt(t?.getMeasurementUnit?()=>t.getMeasurementUnit():void 0,"in")==="cm"?"cm":"in",Uf=()=>{const u=_();return{ready:u!=null,mode:mr(),dirty:u?!!u.isDirty:!1}},Al=u=>{const p=u.quotedText;if(typeof p!="string"||p.length===0)return null;const y=xu(u);if(y.length===0||!fc(y.map(z=>z.blockId)))return null;const A=u.target,x=y.length===1?Ao(y[0].blockId,A?.story):void 0;return{select:{type:"text",pattern:p,mode:"contains",caseSensitive:!0},...x?{within:x}:{},require:"any"}},Hf=u=>{const p=b()?.query;if(typeof p?.match!="function")return null;const y=Al(u);if(!y)return null;const{value:A}=Tr(`query:${Hr(u)}`,on(),()=>p.match(y),x=>x&&typeof x=="object"?x:null);return CA(A,u)},Du=u=>{const p=M(),y=new Set(Br(u));if(y.size===0)return{};const A=p?.readMountedProjectionBlocksByIds,x=p?.readMountedProjectionBlocks;if(typeof A!="function"&&typeof x!="function")return{};const z=Lt(()=>{if(typeof A!="function")return x.call(p);const et=os(u);return et?A.call(p,[...y],et):A.call(p,[...y])},null);if(!Array.isArray(z))return{};const W=c2(z),re=et=>{const ht={},dt=a2(et.fontFamily);dt&&(ht.fontFamily=dt);const ot=xV(et.fontSize);return ot&&(ht.fontSize=ot),typeof et.color=="string"&&et.color.trim()!==""&&(ht.color=et.color.trim().toUpperCase()),typeof et.highlight=="string"&&et.highlight.trim()!==""&&(ht.highlight=et.highlight.trim().toUpperCase()),ht},fe=pl(u),Me=fe&&typeof fe.range?.start=="number"?fe.range.start:null;if(fe&&Me!==null&&y.has(fe.blockId)){const et=W.find(dt=>hc(dt,fe.blockId)),ht=et&&Array.isArray(et.runs)?et.runs:null;if(ht&&ht.length>0&&ht.every(dt=>dt?.kind==="text"||dt?.kind==="tab")){let dt=0,ot=null;for(const Bt of ht){const zt=mm(Bt);if(Me>=dt&&Me<dt+zt){ot=Bt;break}dt+=zt}if(!ot){for(let Bt=ht.length-1;Bt>=0&&!ot;Bt-=1)ht[Bt]?.kind==="text"&&(ot=ht[Bt]);ot??=ht[ht.length-1]??null}return ot?re(ot):{}}}const Ue=xu(u);if(Ue.length>0){const et=new Set,ht=new Set;let dt=!1,ot=!0;for(const Bt of Ue){const zt=W.find(Jr=>hc(Jr,Bt.blockId));if(!zt)return{};const Gn=Array.isArray(zt.runs)?zt.runs:[];if(Gn.length===0)continue;if(!Gn.every(Jr=>Jr?.kind==="text"||Jr?.kind==="tab")){ot=!1;break}let Wn=0;for(const Jr of Gn){const eo=mm(Jr),Sr=Wn,Pr=Wn+eo;if(Sr<Bt.end&&Pr>Bt.start){dt=!0;const Yo=re(Jr);Yo.fontFamily&&et.add(Yo.fontFamily),Yo.fontSize&&ht.add(Yo.fontSize)}Wn=Pr}}if(ot&&dt){const Bt={};return et.size===1&&(Bt.fontFamily=[...et][0]),ht.size===1&&(Bt.fontSize=[...ht][0]),Bt}}const $e=new Set,qe=new Set;let Ze=!1;for(const et of W){if(![...y].some(dt=>hc(et,dt)))continue;const ht=Array.isArray(et.runs)?et.runs:[];for(const dt of ht){if(dt?.kind!=="text")continue;Ze=!0;const ot=re(dt);ot.fontFamily&&$e.add(ot.fontFamily),ot.fontSize&&qe.add(ot.fontSize)}}if(!Ze)return{};const Ge={};return $e.size===1&&(Ge.fontFamily=[...$e][0]),qe.size===1&&(Ge.fontSize=[...qe][0]),Ge},Ou=u=>{const p=M(),y=new Set(Br(u));if(y.size===0)return{};const A=p?.readMountedProjectionBlocksByIds,x=p?.readMountedProjectionBlocks;if(typeof A!="function"&&typeof x!="function")return{};const z=Lt(()=>{if(typeof A!="function")return x.call(p);const Ge=os(u);return Ge?A.call(p,[...y],Ge):A.call(p,[...y])},null);if(!Array.isArray(z))return{};const W=c2(z),re=Ge=>({bold:Ge.bold===!0,italic:Ge.italic===!0,underline:Ge.underline!=null,strikethrough:Ge.strike===!0}),fe=Ge=>{const et={};for(const ht of Df){const dt=Ge[ht];dt.size===1&&(et[ht]=[...dt][0])}return et},Me=pl(u),Ue=Me&&typeof Me.range?.start=="number"?Me.range.start:null;if(Me&&Ue!==null&&y.has(Me.blockId)){const Ge=W.find(ht=>hc(ht,Me.blockId)),et=Ge&&Array.isArray(Ge.runs)?Ge.runs:null;if(et&&et.length>0&&et.every(ht=>ht?.kind==="text"||ht?.kind==="tab")){let ht=0,dt=null;for(const ot of et){const Bt=mm(ot);if(Ue>=ht&&Ue<ht+Bt){dt=ot;break}ht+=Bt}if(!dt){for(let ot=et.length-1;ot>=0&&!dt;ot-=1)et[ot]?.kind==="text"&&(dt=et[ot]);dt??=et[et.length-1]??null}return dt?re(dt):{}}}const $e=xu(u);if($e.length>0){const Ge={bold:new Set,italic:new Set,underline:new Set,strikethrough:new Set};let et=!1,ht=!0;for(const dt of $e){const ot=W.find(Gn=>hc(Gn,dt.blockId));if(!ot)return{};const Bt=Array.isArray(ot.runs)?ot.runs:[];if(Bt.length===0)continue;if(!Bt.every(Gn=>Gn?.kind==="text"||Gn?.kind==="tab")){ht=!1;break}let zt=0;for(const Gn of Bt){const Wn=mm(Gn),Jr=zt,eo=zt+Wn;if(Jr<dt.end&&eo>dt.start){et=!0;const Sr=re(Gn);for(const Pr of Df)Ge[Pr].add(Sr[Pr])}zt=eo}}if(ht&&et)return fe(Ge)}const qe={bold:new Set,italic:new Set,underline:new Set,strikethrough:new Set};let Ze=!1;for(const Ge of W){if(![...y].some(ht=>hc(Ge,ht)))continue;const et=Array.isArray(Ge.runs)?Ge.runs:[];for(const ht of et){if(ht?.kind!=="text")continue;Ze=!0;const dt=re(ht);for(const ot of Df)qe[ot].add(dt[ot])}}return Ze?fe(qe):{}},Fu=(u,p)=>{if(p.fontFamily!==void 0&&p.fontSize!==void 0&&p.color!==void 0&&p.highlight!==void 0)return{values:p,effectiveUniformityStatus:"ready"};const y=Du(u),A={...y.fontFamily!==void 0?{fontFamily:y.fontFamily}:{},...y.fontSize!==void 0?{fontSize:y.fontSize}:{},...y.color!==void 0?{color:y.color}:{},...y.highlight!==void 0?{highlight:y.highlight}:{},...p};if(!u.empty&&(A.fontFamily===void 0||A.fontSize===void 0)){const x=ai(u);return x.values&&(A.fontFamily===void 0&&x.values.fontFamily!==void 0&&(A.fontFamily=x.values.fontFamily),A.fontSize===void 0&&x.values.fontSize!==void 0&&(A.fontSize=x.values.fontSize)),{values:A,effectiveUniformityStatus:x.status}}return{values:A,effectiveUniformityStatus:"ready"}},Nu=["fontFamily","fontSize","bold","italic","underline","strikethrough"],Bu=u=>{const p=u.selectionTarget;if(!p)return{value:null,status:"ready"};const y=yr(b(),"format.readEffectiveInlineUniformity");if(!y)return{value:null,status:"ready"};const A=wA(u)??Hr(u);return Tr(`effInline:${A}`,on(),()=>y({target:p,offsetSpace:"selection",keys:Nu}),x=>x&&typeof x=="object"?x:null)},ai=u=>{const{value:p,status:y}=Bu(u);if(!p||p.success!==!0)return{values:null,status:y};const A=p.values,x=z=>{const W=A?.[z];if(!(!W||W.state!=="uniform"||typeof W.value!="string"))return z==="fontFamily"?a2(W.value):W.value};return{values:{fontFamily:x("fontFamily"),fontSize:x("fontSize")},status:y}},Sc=u=>{const{value:p,status:y}=Bu(u);if(!p||p.success!==!0)return{values:null,status:y};const A=p.values,x={};for(const z of Df){const W=A?.[z];W?.state==="uniform"&&(W.value==="true"||W.value==="false")&&(x[z]=W.value==="true")}return{values:x,status:y}},Il=(u,p)=>{const y=u.activeMark;if(!y||!Df.includes(y))return null;const A=y,x=Ou(p)[A];if(x!==void 0)return x;const{values:z}=Sc(p),W=z?.[A];return W!==void 0?W:null},$f=async u=>{const p=u.selectionTarget;if(!p)return null;const y=yr(b(),"format.readEffectiveInlineUniformity");if(!y)return null;try{const A=await Promise.resolve(y({target:p,offsetSpace:"selection"}));return A&&typeof A=="object"&&A.success===!0?A:null}catch{return null}},Gf=(u,p,y)=>{const A=y.values;for(const x of["fontFamily","fontSize"]){if(p[x]!==void 0)continue;const z=A?.[x];z?.state==="uniform"&&typeof z.value=="string"?u[x]=x==="fontFamily"?a2(z.value):z.value:delete u[x]}},$s=u=>Fu(u,kA(Hf(u),u)),xl=u=>$s(u).values,Wf=async u=>{const p=b()?.query,y=Al(u);if(typeof p?.match!="function"||!y)return xl(u);try{const A=await Promise.resolve(p.match(y)),x=kA(CA(A&&typeof A=="object"?A:null,u),u),z=Fu(u,x);if(z.effectiveUniformityStatus!=="ready"&&(x.fontFamily===void 0||x.fontSize===void 0)){const W=await $f(u);W&&Gf(z.values,x,W)}return z.values}catch{return xl(u)}},El=async u=>{const p=b();if(p)return typeof p.getNode=="function"?await Promise.resolve(p.getNode(u)):await Promise.resolve(p.getNodeById?.({nodeId:u.nodeId,nodeType:u.nodeType}))},_c=u=>{const p=b()?.query;if(typeof p?.match!="function")return"ready";const y=Al(u);if(!y)return"ready";const{status:A}=Tr(`query:${Hr(u)}`,on(),()=>p.match(y),x=>x&&typeof x=="object"?x:null);return A},zu=u=>{const p=$s(u),y=p.values;if(u.empty)return p;const A=Sa(u);return A?u.status==="ready"&&_c(u)==="ready"&&p.effectiveUniformityStatus==="ready"?(C={key:A,values:y},p):C&&C.key===A?{...p,values:{...C.values,...y}}:p:p},Vu=u=>{const p=b(),y=zu(u),A=y.values;u.status==="ready"&&!u.empty&&_c(u)==="ready"&&y.effectiveUniformityStatus==="ready"&&(v=A,k=`${cc(u)}:${on()}`);const x=p?.contentControls,{lockModesById:z}=Hs(x,u),W={};for(const re of Lr())W[re]=Hu(re,p,u,A,z);return W},zo=u=>u?lt.operationUnavailable:_()?lt.documentApiUnavailable:lt.notReady,Ea=u=>u==="contentLocked"||u==="sdtContentLocked",cs=u=>{for(const p of u.values())if(Ea(p))return lt.contentControlLocked},ju=(u,p,y,A,x)=>{if(!p)return u.scope==="all"?lt.bulkDecisionsDisabled:zo(x);if(y)return lt.documentReadonly;if(u.scope!=="all"&&A.activeChangeIds.length===0)return lt.selectionRequired},Kf=u=>{const p=M(),y=Lt(typeof p?.getCapabilities=="function"?()=>p.getCapabilities():void 0,null)?.editableSubset?.commands;if(Array.isArray(y))return y.find(A=>A?.command===u||A?.id===u)??null;if(y&&typeof y=="object"){const A=y[u];return A&&typeof A=="object"?A:null}return null},Uu=(u,p)=>{if(u.scope!=="all"||typeof p?.[`${u.kind}All`]=="function")return;const y=Kf(`trackedChanges.${u.kind}All`);if(!(y&&(y.status==="supported"||y.enabled===!0)))return lt.bulkDecisionsDisabled},Hu=(u,p,y,A,x=new Map)=>{if(oe.has(u))return rn({supported:!0,enabled:!0,...Lt(oe.get(u).getState?()=>oe.get(u).getState(Ru(void 0)):void 0,{})},"custom");const z=mr()==="viewing",W=uA(u);if(W&&typeof se()?.lists?.apply=="function"){const Ze=Ve(),Ge=typeof Ze?.shippedStatus=="string"?Ze.shippedStatus:null,et=Ge!=="not-shipped"&&Ge!=="disabled";return rn({enabled:et&&(typeof Ze?.enabled=="boolean"?Ze.enabled:!0),active:(et?ge(Ze):null)===W,supported:et,value:Ze?.value},"builtin")}const re=gm(u);if(re){const Ze=p?.trackChanges,Ge=typeof Ze?.decide=="function"||typeof Ze?.[re.kind]=="function",et=typeof Ze?.decide=="function"||typeof Ze?.[`${re.kind}All`]=="function",ht=re.scope==="all"?et:Ge,dt=Uu(re,Ze)??ju(re,ht,zs(),y,p);return rn({enabled:dt==null,active:!1,supported:ht,reason:dt},"builtin")}if(u==="copy-format")return mr()==="viewing"?rn({supported:!0,enabled:!1,active:!1},"builtin"):_()?rn({supported:!0,enabled:!0,active:h.mode!=="idle"},"builtin"):rn({supported:!0,enabled:!1,active:!1,reason:lt.notReady},"builtin");const fe=ku(u);if(!fe)return rn({enabled:!1,active:!1,supported:!1,reason:lt.commandUnsupported},"unsupported");if(fe.disposition!=="routed")return rn({enabled:!1,active:!1,supported:!1,reason:fe.reason??lt.commandUnsupported},fe.disposition==="unsupported"?"unsupported":"builtin");if(fe.instanceRoute)return st(fe);if(fe.table)return gt(fe,p,z);if(fe.inline?.kind==="clear"){if(fe.mutates&&z)return rn({enabled:!1,active:!1,supported:!0,reason:lt.documentReadonly},"builtin");const Ze=cs(x);if(Ze)return rn({enabled:!1,active:!1,supported:!0,reason:Ze},"builtin");const Ge=Br(y).length>0||Eu(y)!=null;return rn({enabled:Ge,active:!1,supported:!0,reason:Ge?void 0:lt.selectionRequired},"builtin")}const Me=fe.docRoute;if(!Me)return rn({enabled:!1,active:!1,supported:!1,reason:lt.commandUnsupported},"unsupported");if(yr(p,Me)==null)return rn({enabled:!1,active:!1,supported:!1,reason:zo(p)},"builtin");const Ue=be(u);if(Ue){const Ze=Ue.shippedStatus,Ge=Ze!=="not-shipped"&&Ze!=="disabled",et=typeof Ue.enabled=="boolean"?Ue.enabled:!0,ht=u==="undo"||u==="redo",dt=ht&&Ue.historyResolved===!1,ot=ht&&Ge&&et===!1&&Ue.reason===null&&!dt,Bt=Ue.reason===void 0?void 0:ot?lt.historyEmpty:dt?lt.notReady:n2(Ue.reason,lt.commandUnsupported);return fe.mutates&&z?rn({enabled:!1,active:!1,supported:Ge,reason:lt.documentReadonly},"builtin"):rn({enabled:Ge&&et,active:!1,supported:Ge,reason:Bt},"builtin")}const $e=Tl(fe,p,y),qe=La(fe,p,y,A);if(fe.list?.mode==="indent"||fe.list?.mode==="outdent")return De(fe,p,z,y,$e,qe);if(fe.list?.mode==="toggle-seed")return Ke(fe,p,z,y,$e,qe);if(fe.mutates&&z)return rn({enabled:!1,active:$e,supported:!0,value:qe,reason:lt.documentReadonly},"builtin");if(fe.inline&&!Eu(y)){const Ze=cs(x);return rn(Ze?{enabled:!1,active:$e,supported:!0,value:qe,reason:Ze}:Br(y).length>0&&typeof M()?.setPendingInlineFormat=="function"?{enabled:!0,active:$e,supported:!0,value:qe}:{enabled:!1,active:$e,supported:!0,value:qe,reason:lt.rangeSelectionRequired},"builtin")}if((fe.blockParagraph||fe.list)&&Br(y).length===0)return rn({enabled:!1,active:$e,supported:!0,value:qe,reason:lt.selectionRequired},"builtin");if(fe.link&&!$e&&i2(y).length===0&&!pl(y))return rn({enabled:!1,active:$e,supported:!0,reason:lt.rangeSelectionRequired},"builtin");if(fe.inline){const Ze=cs(x);if(Ze)return rn({enabled:!1,active:$e,supported:!0,value:qe,reason:Ze},"builtin")}return rn({enabled:!0,active:$e,supported:!0,value:qe},"builtin")};function Ta(u,p){const y=u.address?.anchor,A=y?.start,x=y?.end,z=typeof A?.blockId=="string"?A.blockId:null,W=typeof x?.blockId=="string"?x.blockId:null;if(!z||!W)return!1;const re=typeof A?.offset=="number"?A.offset:null,fe=typeof x?.offset=="number"?x.offset:null;if(re==null||fe==null)return!1;const Me=p.target,Ue=Me&&Array.isArray(Me.segments)?Me.segments:[];for(const $e of Ue){const qe=typeof $e?.blockId=="string"?$e.blockId:null;if(!qe)continue;const Ze=$e.range,Ge=typeof Ze?.start=="number"?Ze.start:null,et=typeof Ze?.end=="number"?Ze.end:null;if(!(Ge==null||et==null)){if(z!==W){if(qe===z&&et>re||qe===W&&Ge<fe)return!0;continue}if(qe===z){if(Ge===et){if(Ge>=re&&Ge<=fe)return!0;continue}if(Math.max(Ge,re)<Math.min(et,fe))return!0}}}return!1}const Ra=(u,p)=>{const y=u?.hyperlinks;if(!y||typeof y.list!="function")return null;const A=Br(p);if(!fc(A))return null;for(const x of A){const z={kind:"block",nodeType:"paragraph",nodeId:x},{value:W}=Tr(`hyperlinks:${x}`,on(),()=>y.list({within:z}),fe=>fe&&typeof fe=="object"?fe:null),re=(W&&Array.isArray(W.items)?W.items:[]).find(fe=>Ta(fe,p));if(re)return re}return null},Tl=(u,p,y)=>{if(u.link)return Ra(p,y)!=null;if(u.list?.mode==="toggle-seed"&&u.list.seed)return $u(p,y)===u.list.seed;const A=D(u);if(A!==null)return A;const x=r.get(u.id),z=Sa(y);if(z&&x?.selectionSignature===z)return x.active;const W=Il(u,y);return W!==null?W:WV(u,y)},La=(u,p,y,A)=>{if(u.inline&&s2(u.inline.key)){const x=B(u);if(x!==void 0)return x;const z=A[u.inline.key];if(z!==void 0)return z;const W=Sa(y),re=W?n.get(u.inline.key):void 0;if(W&&re?.selectionSignature===W)return re.value}if(u.id==="linked-style"){const{style:x}=Xr(y,ar().cache);return!x.styleId||x.mixed?void 0:{styleId:x.styleId,styleName:x.styleName}}if(u.id==="text-align")return le(p,y);if(u.id==="link")return ct(p,y)??void 0},Yr=(u,p,y)=>{const A=u?.lists;if(!A)return{value:null,status:"ready"};const x=y.storyType==="body",z=typeof A.getStateInStory=="function"?()=>A.getStateInStory({target:ka(p),story:y}):x&&typeof A.getState=="function"?()=>A.getState({target:ka(p)}):null;if(!z)return{value:null,status:"ready"};const{value:W,status:re}=Tr(`lists:${Cr(y)}:${p}`,on(),z,fe=>fe&&typeof fe=="object"?fe:null);return{value:W?.success===!0?W:null,status:re}},Ma=(u,p,y)=>Yr(u,p,y).value,Rl=(u,p,y)=>{const A=Ma(u,p,y);return!A||A.isListItem!==!0?null:A.seed==="bullet"||A.seed==="ordered"?A.seed:null},Pa=(u,p,y)=>{const A=Yr(u,p,y),x=A.value;return{value:x&&typeof x.isListItem=="boolean"?x.isListItem:null,status:A.status}},$u=(u,p)=>{const y=Br(p);if(y.length===0||!fc(y))return null;const A=rs(p),x=Rl(u,y[0],A);if(x!=="bullet"&&x!=="ordered")return null;for(const z of y.slice(1))if(Rl(u,z,A)!==x)return null;return x},Da=(u,p,y)=>{if(!u)return{value:null,status:"ready",refreshing:!1};const A=Cr(y),x=A==="story:body";if(x&&typeof u.getNodeById!="function")return{value:null,status:"ready",refreshing:!1};if(!x&&typeof u.getNode!="function")return{value:null,status:"ready",refreshing:!1};const z=`node:${A}:${p}`,W=on(),re=Tr(z,W,()=>x?u.getNodeById({nodeId:p,nodeType:"paragraph"}):u.getNode(Ao(p,y)),Me=>Me&&typeof Me=="object"?Me:null),fe=Q.get(z);return{...re,refreshing:re.status==="stale"&&fe?.inflightToken===W&&fe.failedToken!==W}},Ll=u=>u==="left"||u==="center"||u==="right"||u==="justify"?u:void 0,I=u=>u==="start"||u==="end"||u==="distributed"||u==="numTab"||u==="lowKashida"||u==="mediumKashida"||u==="highKashida"||u==="thaiDistribute",R=(u,p)=>{const y=M(),A=y?.readMountedProjectionBlocksByIds;if(typeof A!="function")return null;const x=os(u),z=Lt(()=>x?A.call(y,[...p],x):A.call(y,[...p]),null);if(!Array.isArray(z))return new Map;const W=c2(z),re=new Map;for(const fe of p){const Me=W.find(Ze=>hc(Ze,fe));if(!Me)continue;const Ue=Me.attrs,$e=Ll(Ue?.alignment),qe=l9(Ue);re.set(fe,$e??(qe==="rtl"?"right":"left"))}return re},X=(u,p,y,A)=>{const{value:x,status:z,refreshing:W}=Da(u,p,y),re=A?.get(p);if(z==="pending")return re?{status:"uniform",value:re}:{status:"pending"};if(z==="stale"&&!W)return{status:"pending"};if(z==="stale"&&re)return{status:"uniform",value:re};if(z==="stale"&&A&&!re)return{status:"unavailable"};if(!x)return{status:"unavailable"};const fe=x.node;if(!fe)return{status:"unavailable"};const Me=fe.kind;if(Me!=="paragraph"&&Me!=="heading")return{status:"unavailable"};const Ue=fe[Me];if(!Ue||typeof Ue!="object")return{status:"unavailable"};const $e=Ue.props?.alignment;if($e==null)return re?{status:"uniform",value:re}:{status:"unavailable"};const qe=Ll($e);return qe?{status:"uniform",value:qe}:I($e)&&re?{status:"uniform",value:re}:{status:"unavailable"}},ie=(u,p)=>{const y=Br(p);if(y.length===0||!fc(y))return{status:"unavailable"};const A=rs(p),x=R(p,y),z=X(u,y[0],A,x);if(z.status!=="uniform")return z;for(const W of y.slice(1)){const re=X(u,W,A,x);if(re.status!=="uniform")return re;if(re.value!==z.value)return{status:"mixed"}}return z},ae=u=>{const p=Br(u);return p.length===0?null:`${Cr(rs(u))}:${p.join(",")}`},le=(u,p)=>{const y=ie(u,p),A=y.status==="uniform"?y.value:void 0,x=o;if(!x)return A;const z=ae(p);return z&&z!==x.selectionSignature?(o=null,A):!z||!x.settled?x.value:y.status!=="pending"?(o=null,A):x.value},de=(u,p)=>{const y=Ll(p),A=ae(u),x=Br(u);if(!y||!A||x.length===0)return null;const z=++i;return o={selectionSignature:A,value:y,generation:z,settled:!1,canReconcile:fc(x)},Dt(),z},ue=(u,p)=>{if(u==null)return;const y=o;if(!(!y||y.generation!==u)){if(!Io(p)){o=null;return}if(!y.canReconcile){o=null;return}y.settled=!0}},Se=async(u,p,y)=>{const A=u?.lists;if(!A)return null;try{const x=y.storyType==="body",z=typeof A.getStateInStory=="function"?await A.getStateInStory({target:ka(p),story:y}):x&&typeof A.getState=="function"?await A.getState({target:ka(p)}):null,W=z&&typeof z=="object"?z:null;return!W||W.success!==!0||typeof W.isListItem!="boolean"?null:W.isListItem}catch{return null}},Le=(u,p,y)=>{const A={resolved:!1,seed:null},x=u?.lists;if(!x)return A;const z=y.storyType==="body",W=typeof x.getStateInStory=="function"?()=>x.getStateInStory({target:ka(p),story:y}):z&&typeof x.getState=="function"?()=>x.getState({target:ka(p)}):null;if(!W)return A;const re=fe=>{const Me=fe&&typeof fe=="object"?fe:null;return!Me||Me.success!==!0||typeof Me.isListItem!="boolean"?A:{resolved:!0,seed:Me.isListItem===!0&&(Me.seed==="bullet"||Me.seed==="ordered")?Me.seed:null}};try{const fe=W();return xr(fe)?Promise.resolve(fe).then(re,()=>A):re(fe)}catch{return A}},Oe=async(u,p,y)=>{if(!u)return null;try{const A=!y||y.storyType==="body",x=y&&typeof u.getNode=="function"?await u.getNode(Ao(p,y)):A&&typeof u.getNodeById=="function"?await u.getNodeById({nodeId:p,nodeType:"paragraph"}):null;return yV(x&&typeof x=="object"?x:null)}catch{return null}},De=(u,p,y,A,x,z)=>{if(u.mutates&&y)return rn({enabled:!1,active:x,supported:!0,value:z,reason:lt.documentReadonly},"builtin");const W=Br(A);if(W.length===0)return rn({enabled:!1,active:x,supported:!0,value:z,reason:lt.selectionRequired},"builtin");const re=u.docRoute?yr(p,u.docRoute):null,fe=yr(p,"format.paragraph.setIndentation"),Me=yr(p,"format.paragraph.clearIndentation"),Ue=u.list?.mode,$e=Ue==="indent"?fe!=null:fe!=null||Me!=null,qe=rs(A);let Ze=null;if(qe.storyType!=="body"){Ze=[];for(const Ge of W){const{value:et,status:ht}=Pa(p,Ge,qe);if(et===null)return ht!=="ready"&&(re!=null||$e)?rn({enabled:!0,active:x,supported:!0,value:z},"builtin"):rn({enabled:!1,active:x,supported:!1,value:z,reason:zo(p)},"builtin");Ze.push(et)}}if(Ze?.some(Ge=>Ge===!0)){const Ge=Ue==="indent"?"lists.indentRange":"lists.outdentRange",et=mr()!=="suggesting"&&Ze.every(dt=>dt===!0)&&yr(p,Ge)!=null,ht=Ue==="outdent"&&yr(p,"lists.outdentInStory")!=null;if(!et&&!ht)return rn({enabled:!1,active:x,supported:!1,value:z,reason:zo(p)},"builtin")}for(const[Ge,et]of W.entries()){const ht=Ze?{value:Ze[Ge]??null,status:"ready"}:Pa(p,et,qe),dt=ht.value;if(dt===!0){if(re!=null)return rn({enabled:!0,active:x,supported:!0,value:z},"builtin");continue}if(dt===!1&&$e){if(qe.storyType!=="body"&&typeof p?.getNode!="function")continue;return rn({enabled:!0,active:x,supported:!0,value:z},"builtin")}if(dt===null)return ht.status!=="ready"&&(re!=null||$e)?rn({enabled:!0,active:x,supported:!0,value:z},"builtin"):rn({enabled:!1,active:x,supported:!1,value:z,reason:zo(p)},"builtin")}return rn({enabled:!1,active:x,supported:!1,value:z,reason:zo(p)},"builtin")},Ke=(u,p,y,A,x,z)=>{if(u.mutates&&y)return rn({enabled:!1,active:x,supported:!0,value:z,reason:lt.documentReadonly},"builtin");const W=Br(A);if(W.length===0)return rn({enabled:!1,active:x,supported:!0,value:z,reason:lt.selectionRequired},"builtin");const re=rs(A),fe=p?.lists;if(!(typeof fe?.getStateInStory=="function"||re.storyType==="body"&&typeof fe?.getState=="function"))return rn({enabled:!1,active:x,supported:!1,value:z,reason:lt.operationUnavailable},"builtin");if(!fc(W))return rn(re.storyType==="body"&&yr(p,"lists.remove")!=null?{enabled:!0,active:x,supported:!0,value:z}:{enabled:!1,active:x,supported:!1,value:z,reason:lt.operationUnavailable},"builtin");const Me=W.map(Ze=>Yr(p,Ze,re));if(Me.some(({status:Ze})=>Ze!=="ready"))return rn({enabled:!0,active:x,supported:!0,value:z},"builtin");if(Me.some(({value:Ze})=>Ze===null))return rn({enabled:!1,active:x,supported:!1,value:z,reason:lt.operationUnavailable},"builtin");const Ue=u.list?.seed,$e=Me.every(({value:Ze})=>Ze?.isListItem===!0&&Ze.seed===Ue);if(re.storyType==="body")return rn(!$e||yr(p,"lists.remove")!=null?{enabled:!0,active:x,supported:!0,value:z}:{enabled:!1,active:x,supported:!1,value:z,reason:lt.operationUnavailable},"builtin");const qe=yr(p,"lists.removeInStory");return rn($e&&qe?{enabled:!0,active:x,supported:!0,value:z}:{enabled:!1,active:x,supported:!1,value:z,reason:lt.operationUnavailable},"builtin")},ct=(u,p)=>{const y=Ra(u,p)?.properties?.href;return typeof y=="string"?y:null},st=u=>{if(!_())return rn({enabled:!1,active:!1,supported:!1,reason:lt.notReady},"builtin");const p=u.instanceRoute;return typeof t?.[p]!="function"?rn({enabled:!1,active:!1,supported:!1,reason:lt.operationUnavailable},"builtin"):rn({enabled:!0,active:vt(u),supported:!0,value:Xt(u)},"builtin")},vt=u=>{const p=t?.config??void 0;return u.valueFrom==="ruler"?!!p?.rulers:u.valueFrom==="formattingMarks"?!!p?.layoutEngineOptions?.showFormattingMarks:!1},gt=(u,p,y)=>{if(y)return rn({enabled:!1,active:!1,supported:!0,reason:lt.documentReadonly},"builtin");const A=ke();return A!=null&&(!u.table.requiresCell||A.cellNodeId!=null)?(u.docRoute?yr(p,u.docRoute):null)==null?rn({enabled:!1,active:!1,supported:!1,reason:zo(p)},"builtin"):rn({enabled:!0,active:!1,supported:!0},"builtin"):rn({enabled:!1,active:!1,supported:!0,reason:lt.tableContextUnavailable},"builtin")},Xt=u=>{if(u.valueFrom==="zoom")return kc().value;if(u.valueFrom==="documentMode")return mr();if(u.valueFrom==="measurementUnit")return Pu();if(u.valueFrom==="ruler"||u.valueFrom==="formattingMarks")return vt(u)},_n=(u,p)=>u.id==="zoom"?typeof p=="number"&&Number.isFinite(p)&&p>0:u.id==="document-mode"?p==="editing"||p==="suggesting"||p==="viewing":u.id==="measurement-unit"?p==="in"||p==="cm":!0,Lr=()=>[...new Set([...nN,...oe.keys()])],Zt="Normal",Mn={ready:!1,status:"ready",catalogRevision:null,quickGallery:[],activeParagraphStyleId:null,activeParagraphStyleName:null,mixedSelection:!1,sourceStatus:null,diagnostics:[]},mn=u=>{const p=b()?.styles;return!p||typeof p.getCatalog!="function"?{value:null,status:"ready"}:Tr(`styles:catalog:${JSON.stringify(u??{})}`,on(),()=>p.getCatalog(u),y=>y&&typeof y=="object"?y:null)},ar=()=>{const u=mn({includePreview:!0});if(!u.value)return{cache:null,status:u.status};const p=mn({view:"quickGallery",includePreview:!0}),y=p.value?p.value.items:u.value.styles.filter(x=>x.visibility.quickGallery),A=new Map;for(const x of u.value.styles)A.set(x.id,x);return{cache:{full:u.value,quickGallery:y,byId:A},status:hl(u.status,p.status)}},so=(u,p,y)=>{const{value:A,status:x}=Da(u,p,y);if(!A)return{ok:!1,styleRef:null,status:x};const z=A.node;if(!z||typeof z!="object")return{ok:!1,styleRef:null,status:x};const W=z.kind,re=typeof W=="string"?z[W]:void 0,fe=re&&typeof re=="object"?re.styleRef:void 0;return{ok:!0,styleRef:typeof fe=="string"&&fe.length>0?fe:null,status:x}},Xr=(u,p)=>{const y=[],A=b();if(!A)return y.push({severity:"warning",code:"active-style-unavailable",message:"Active paragraph style is unavailable: the Document API is not reachable."}),{style:{styleId:null,styleName:null,mixed:!1,diagnostics:y},status:"ready"};const x=Br(u);if(x.length===0)return y.push({severity:"info",code:"active-style-no-selection",message:"No paragraph block is resolvable from the current selection; active paragraph style is unavailable."}),{style:{styleId:null,styleName:null,mixed:!1,diagnostics:y},status:"ready"};if(!fc(x))return y.push({severity:"info",code:"active-style-selection-too-large",message:"Active paragraph style is unavailable for a large multi-paragraph selection."}),{style:{styleId:null,styleName:null,mixed:!1,diagnostics:y},status:"ready"};const z=p?.full.defaults.paragraphStyleId??(p?Zt:null),W=new Set;let re=0,fe=0,Me=0,Ue="ready";const $e=rs(u);for(const Ge of x){const et=so(A,Ge,$e);if(Ue=hl(Ue,et.status),!et.ok){fe+=1;continue}if(!et.styleRef&&!z){Me+=1;continue}const ht=et.styleRef??z;if(!ht){Me+=1;continue}re+=1,W.add(ht)}if(re===0){const Ge=Me>0&&fe===0;return y.push({severity:"warning",code:Ge?"active-style-default-unavailable":"active-style-read-failed",message:Ge?"Selected paragraphs have no explicit style and the style catalogue is unavailable, so the document default cannot be resolved.":"Could not read the paragraph style of any selected block; active paragraph style is unavailable."}),{style:{styleId:null,styleName:null,mixed:!1,diagnostics:y},status:Ue}}const qe=fe+Me;if(qe>0)return y.push({severity:"warning",code:"active-style-partial",message:`Active paragraph style resolved from ${re} of ${re+qe} selected blocks; ${qe} could not be read, so the active style is unavailable.`}),{style:{styleId:null,styleName:null,mixed:!1,diagnostics:y},status:Ue};if(W.size>1)return{style:{styleId:null,styleName:null,mixed:!0,diagnostics:y},status:Ue};const Ze=[...W][0];return{style:{styleId:Ze,styleName:p?.byId.get(Ze)?.name??null,mixed:!1,diagnostics:y},status:Ue}},Ui=u=>{if(!_())return Mn;const{cache:p,status:y}=ar(),{style:A,status:x}=Xr(u,p);let z;return p?z=A.diagnostics.length===0?p.full.diagnostics:[...p.full.diagnostics,...A.diagnostics]:z=[{severity:"warning",code:"catalog-unavailable",message:"The style catalogue is unavailable: the Document API styles surface is not reachable (e.g. viewing mode or a worker-backed editor)."},...A.diagnostics],{ready:!0,status:hl(y,x,u.status),catalogRevision:p?.full.revision??null,quickGallery:p?.quickGallery??[],activeParagraphStyleId:A.styleId,activeParagraphStyleName:A.styleName,mixedSelection:A.mixed,sourceStatus:p?.full.sourceStatus??null,diagnostics:z}},li=()=>{const u=mr(),p=kl();p.status==="ready"&&Bf(p),Y(p);const y=Sa(p);for(const[A,x]of r)(!y||x.selectionSignature!==y||x.settled&&p.status==="ready")&&r.delete(A);return{ready:_()!=null,documentMode:u,document:Uf(),selection:p,toolbar:{context:u,commands:Vu(p),copyFormatActive:h.mode!=="idle"},comments:Vf(p),trackChanges:wc(p),contentControls:Cc(p),zoom:kc(),fonts:Mu(),styles:Ui(p)}},at=u=>{const p=Sa(u);p&&a&&p!==a&&(n.clear(),r.clear()),p&&(a=p)};let dn=null,kr=null,us=null,Hi=null,yo=null,Ko=null,$i=!1;const Gs=()=>{if(U||$i)return;$i=!0;const u=()=>{$i&&($i=!1,!U&&Dt())};typeof queueMicrotask=="function"?queueMicrotask(u):Promise.resolve().then(u)},Ml=()=>{const u=se();if(u!==us&&(Hi&&(Hi(),Hi=null),us=u,!(!u||typeof u.subscribe!="function")))try{const p=u.subscribe(()=>Gs());typeof p=="function"&&(Hi=p)}catch{us=null}},Pl=()=>{const u=T();if(u!==yo&&(Ko&&(Ko(),Ko=null),yo=u,!(!u||typeof u.subscribe!="function")))try{const p=u.subscribe(()=>Dt());typeof p=="function"&&(Ko=p)}catch{yo=null}};let ci=null,Vo=null,Gi=null,ui=null,F=null,G=null;const _e=()=>{const u=_()?.host,p=Lt(u?.getHandles?()=>u.getHandles():void 0,null)?.editing?.selection;return p&&typeof p.subscribe=="function"?p:null},Ne=()=>{const u=_e();if(u!==dn&&(kr&&(kr(),kr=null),dn=u,!!u))try{const p=u.subscribe(y=>{tr+=1,Sl(y),Dt()});typeof p=="function"&&(kr=p)}catch{dn=null}},bt=()=>{const u=_()?.host,p=Lt(u?.getHandles?()=>u.getHandles():void 0,null)?.review;return p&&typeof p.subscribe=="function"?p:null},Qt=u=>u?typeof u.getActiveReviewTarget=="function"?Lt(()=>u.getActiveReviewTarget(),null):typeof u.getSnapshot=="function"?Lt(()=>u.getSnapshot(),null)?.activeReviewTarget??null:null:null;let gn=0;const An=(u,p)=>{const y=(p&&typeof p=="object"?p:null)?.lastInteractionRejection;if(gn>0&&u==null&&y&&typeof y=="object"&&y.code==="review-target-invalidated"&&y.detail==="not-painted")return!1;const A=u&&typeof u=="object"?u:null;let x=null;if(A?.entityType==="trackedChange"&&typeof A.entityId=="string"&&A.entityId.length>0){const z=A.story&&typeof A.story=="object"?A.story:void 0,W=z&&Cr(z)!==Cr(null)?z:void 0,re=typeof A.paintedEntityId=="string"&&A.paintedEntityId.length>0?A.paintedEntityId:null,fe=re??A.entityId,Me=(()=>{if(W){const qe=si(),Ze=qe?dc(qe,W):null;return Ze?.toPublicId(fe)??Ze?.toPublicId(A.entityId)??A.entityId}const $e=Os(Array.isArray(P?.trackChanges.items)?P.trackChanges.items:[]);return $e.toPublicId(fe)??$e.toPublicId(A.entityId)??A.entityId})(),Ue=re??(fe!==Me?fe:null);x={id:Me,...W?{story:W}:{},...Ue&&Ue!==Me?{paintedEntityId:Ue}:{}}}return u==null&&x==null&&je!=null&&ee(je)||Ye(je,x)?!1:(ne(x),!0)},xn=()=>{const u=bt();if(u===ci)return;if(Vo&&(Vo(),Vo=null),ci=u,!u){An(null);return}let p=!0;try{const y=u.subscribe(A=>{const x=A&&typeof A=="object"?A:null,z=x&&Object.prototype.hasOwnProperty.call(x,"activeReviewTarget")?x.activeReviewTarget:Qt(u);!An(z,A)||p||Dt()});typeof y=="function"&&(Vo=y),An(Qt(u))}catch{ci=null}finally{p=!1}},On=()=>{if(dn||mr()!=="viewing")return null;const u=_()?.mount?.container,p=(u&&typeof u=="object"&&"ownerDocument"in u?u.ownerDocument??null:null)??globalThis.document??null;return p&&typeof p.addEventListener=="function"?p:null},ln=()=>{const u=On();if(u===F||(G&&(G(),G=null),F=u,!u))return;const p=()=>{tr+=1,Dt()};u.addEventListener("selectionchange",p),u.addEventListener("pointerup",p,!0),u.addEventListener("mouseup",p,!0),G=()=>{u.removeEventListener("selectionchange",p),u.removeEventListener("pointerup",p,!0),u.removeEventListener("mouseup",p,!0)}};as(),An(Qt(bt())),P=li(),a=Sa(P.selection);const Mr=()=>{const u=_()?.host?.events,p=u&&typeof u.subscribe=="function"?u:null;if(p!==Gi&&(ui&&(ui(),ui=null),Gi=p,!!p))try{const y=p.subscribe(A=>{const x=A?.type;if(x==="review-mutation:started"){hn(A.reviewMutation?.token);return}if(x==="review-mutation:aborted"){Vn(A.reviewMutation?.token),Ht();return}if(x==="mutation:rejected"&&A.reviewMutation&&(Vn(A.reviewMutation.token),Ht()),x==="mutation:committed"&&A.reviewMutation&&Vn(A.reviewMutation.token),x==="source:complete"||x==="source:signals-complete"){Rn=on(),Wo();return}if((x==="mutation:committed"||x==="collaboration:remote-changed")&&(Ln=Date.now()),x==="mutation:committed"||x==="save:completed"||x==="collaboration:remote-changed"){const z=x==="mutation:committed"?zk(A):null;if(z?.allResolved){Jt([]),Et(A.receipt);return}z?.removedIds.size&&Nt(new Set(z.removedIds),A.receipt);const W=x==="mutation:committed"&&_i(A)||x==="collaboration:remote-changed"&&Array.isArray(A.changedStoryIds)&&A.changedStoryIds.length>0;if(W&&(go=Date.now()),x==="mutation:committed"&&W){yl();return}if(z?.removedIds.size&&z.upsertIds.size===0)return;(x==="collaboration:remote-changed"||x==="mutation:committed"&&!W)&&vl();const re=x==="collaboration:remote-changed"&&Array.isArray(A.changedPartUris)&&A.changedPartUris.some(Me=>typeof Me=="string"&&iV.has(Me)),fe=x==="collaboration:remote-changed"&&Array.isArray(A.changedStoryIds)&&A.changedStoryIds.length>0&&pc();re&&!W&&(Gr=!0),Ni(),re&&!W?Bo("comments"):fe&&(Gr=!0,ki()),Dt()}});typeof y=="function"&&(ui=y)}catch{Gi=null}},Dt=()=>{if(U)return;$i=!1,as(),Ne(),Ml(),Pl(),xn(),ln(),Mr();const u=li();at(u.selection),P=u;for(const p of[...O])p(P)},Ai=[],Tt=[],vn=u=>{for(const p of u)try{p()}catch{}},lr=()=>vn(Ai),Fn=()=>vn(Tt),Zr=[];((u,p)=>{if(!(!u||typeof u.on!="function"))for(const y of p){const A=y==="active-editor-change"?()=>{lr(),Fn(),Dt()}:y==="document-replaced"?x=>{const z=x&&typeof x=="object"?x:null,W=z?.editor,re=z?.host,fe=!!W&&W===_(),Me=!!re&&re===M();!fe&&!Me||(Fn(),Q.clear(),Ni(),Dt())}:()=>Dt();try{u.on(y,A),Zr.push(()=>{try{typeof u.off=="function"&&u.off(y,A)}catch{}})}catch{}}})(t,Jz),Ne(),Ml(),Pl(),xn(),ln(),Mr();const jo=(u,p=Fz)=>({get:()=>u(P),subscribe:y=>{let A=u(P);const x=z=>{const W=u(z);p(A,W)||(A=W,y(W))};return O.add(x),()=>O.delete(x)}}),bo=u=>jo(u),qo=u=>{const p=y=>{const A=z=>{try{y(z)}catch{}},x=u.subscribe(A);return A(u.get()),x};return{get:()=>u.get(),getSnapshot:()=>u.get(),observe:p,subscribe:y=>p(A=>y({snapshot:A}))}},Oa=(u,p,y)=>{const A=qo(u),x=qo(p),z=W=>{const re=_a(y);Dt();const fe=x.observe(W);return()=>{fe(),re()}};return{get:A.get,getSnapshot:A.getSnapshot,observe:z,subscribe:W=>z(re=>W({snapshot:re}))}};function Gu(u){return u&&typeof u=="object"&&typeof u.id=="string"?String(u.id):null}function Fa(u){const p=os(u);return p&&Cr(p)!==Cr(null)?p:void 0}function $n(u,p){return{kind:"id",id:u,...p?{story:p}:{}}}function h2(u){if(u.empty)return null;const p=u.selectionTarget,y=p?.start,A=p?.end;if(p?.kind!=="selection"||y?.kind!=="text"||A?.kind!=="text"||typeof y.blockId!="string"||y.blockId!==A.blockId||!Number.isInteger(y.offset)||!Number.isInteger(A.offset)||y.offset<0||A.offset<0||y.offset===A.offset)return null;const x=Math.min(y.offset,A.offset),z=Math.max(y.offset,A.offset),W=os(u);return{kind:"range",coordinateSpace:p.coordinateSpace==="tracked"?"tracked":"visible",range:{kind:"text",...W?{story:W}:{},segments:[{blockId:y.blockId,range:{start:x,end:z}}]}}}function bm(u,p){if(Cr(p)!==Cr(null))return;const y=b()?.trackChanges,A=y?.list;if(typeof A!="function")return;const x=Lt(()=>A.call(y),null);if(xr(x)||!x||typeof x!="object")return;const z=x.items;if(Array.isArray(z))return z.map(Of).find(W=>W!=null&&Di(W,u,p))}function wm(u,p){const y=Cm(u.quotedText);if(!y)return!1;const A=hm(p);return[A.insertedText,A.deletedText,A.excerpt].some(x=>Cm(x)===y)}function Cm(u){return typeof u=="string"?u.replace(/\s+/g," ").trim():""}function km(){const u=P.selection.activeChangeIds[0];if(!u)return"unavailable";const p=os(P.selection),y=(P.trackChanges.status==="ready"?P.trackChanges.items.find(W=>Di(W,u,p)):void 0)??bm(u,p)??si()?.find(W=>Di(W,u,p));if(!y)return"unavailable";const A=hm(y),x=A.type,z=A.grouping;return wm(P.selection,y)?"id":x==="replacement"&&z==="replacement-pair"||(x==="insertion"||x==="deletion"||x==="insert"||x==="delete")&&z==="standalone"?"range":"id"}function Sm(u,p,y,A){const x=()=>w2(u,$n(y,A),y,A);try{const z=w2(u,p,null);if(xr(z))return To(Promise.resolve(z).then(re=>Io(Ns(re))?re:x()));const W=Ns(z);return To(Io(W)?z:x())}catch{return!1}}function _m(u,p){if(u.scope==="all")return{target:{kind:"all"},changeId:null};if(typeof p=="string"&&p.length>0)return{target:{kind:"id",id:p},changeId:p};if(p&&typeof p=="object"){const x=p;if(x.target&&typeof x.target=="object"){const W=x.target;return{target:W,changeId:Gu(W),story:W.story}}const z=typeof x.changeId=="string"?x.changeId:x.id;if(typeof z=="string"&&z.length>0)return{target:$n(z,x.story),changeId:z,story:x.story}}const y=P.selection.activeChangeIds[0],A=Fa(P.selection);return y?{target:$n(y,A),changeId:y,story:A}:null}function p2(u,p){if(u.scope==="id"&&p==null){if(P.selection.activeChangeIds.length>1)return Xf(u.kind,{kind:"ids",ids:P.selection.activeChangeIds},null);if(P.selection.activeChangeIds.length===1&&!P.selection.empty&&P.selection.selectionTarget){const A=km();if(A==="unavailable")return!1;if(A==="range"){const x=h2(P.selection),z=Fa(P.selection);return x?Sm(u.kind,x,P.selection.activeChangeIds[0],z):!1}if(A==="id"){const x=P.selection.activeChangeIds[0],z=os(P.selection),W=z&&Cr(z)!==Cr(null)?z:void 0;return b2(u.kind,W?{id:x,story:W}:x)}}}const y=_m(u,p);return y?Xf(u.kind,y.target,y.changeId,y.story):!1}function Am(u,p){const y=se()?.lists,A=y?.apply;if(typeof A!="function")return!1;const{behavior:x,preset:z,continuity:W}=typeof p=="string"?nV(p):p&&typeof p=="object"?p:{},re={kind:u,behavior:x??"toggle"};z!==void 0&&(re.preset=z),W!==void 0&&(re.continuity=W);try{return To(A.call(y,re))}catch{return!1}}let di=Promise.resolve(!1),Eo=null,Wu=Promise.resolve(!1);const At=async u=>{if(!pm(u))return u;const p=_()?.documentMutationReadiness,y=p?.whenPainted;if(typeof y!="function")return u;const A=typeof u.txId=="string"?u.txId:void 0;try{await y.call(p,A?{txId:A}:void 0)}catch{}return u},Rt=u=>{if(xr(u)){const y=Promise.resolve(u);return{immediate:!0,committed:y.then(A=>Ns(A),()=>!1),settled:y.then(A=>At(Ns(A)),()=>!1)}}const p=Ns(u);return{immediate:p,committed:Promise.resolve(p),settled:At(p)}},yn=()=>{const u=s.shift();if(!u){c=!1,f?.(),f=null;return}try{u.resolve(U?!1:u.mutate())}catch{u.resolve(!1)}},br=()=>{let u=!1;return()=>{u||(u=!0,yn())}},Qr=(u,p)=>{if(!c){c=!0,d=new Promise(z=>{f=z});try{return{result:p(),release:br()}}catch(z){throw c=!1,f?.(),f=null,z}}const y=s.find(z=>z.key===u);if(y)return y.mutate=p,{result:y.result,release:()=>{}};let A;const x=new Promise(z=>{A=z});return s.push({key:u,mutate:p,result:x,resolve:A}),{result:x,release:br()}},wo=new Set(["create.tableOfContents"]),Ii=u=>Xn(`Tracked authoring is not supported for ${u}.`),Wi=u=>{if(mr()==="suggesting")return wo.has(u)?Ii(u):{changeMode:"tracked"}},Ku=()=>mr()==="suggesting"?OV:d2,Co=(u,p,y)=>{const A=Wi(u);return A&&A.success===!1?A:A?p(y,A):p(y)},vj=(u,p,y,A)=>{const x=u.inline;if(!x)return;const z=Ns(A);if(z===!1||typeof z=="object"&&z&&z.success===!1)return;if(x.kind==="clear"){n.clear();return}if(x.kind==="toggle"||!s2(x.key))return;const W=Sa(p);if(!W)return;const re=kV(x.key,y.value);if(re==null){n.delete(x.key);return}n.set(x.key,{selectionSignature:W,value:re})},yj=(u,p,y,A)=>!u.inline||u.inline.kind==="toggle"?A:xr(A)?Promise.resolve(A).then(x=>(vj(u,p,y,x),x)):A,bj=(u,p,y,A)=>{if(u.inline?.kind!=="toggle"||!Io(Ns(A))||typeof y.value!="boolean"&&y.value!==null)return null;const x=Sa(p);if(!x)return null;const z=++l;return r.set(u.id,{selectionSignature:x,active:y.value===!0,generation:z,settled:!1}),Dt(),z},wj=(u,p,y)=>{if(p==null)return;const A=r.get(u.id);if(!(!A||A.generation!==p)){if(!Io(y)){r.delete(u.id);return}A.settled=!0}},Im=(u,p)=>u.then(y=>(p?.(y),Cl(),y),()=>(p?.(!1),Cl(),!1)),To=(u,p)=>{const y=Eo;if(Eo=null,y)return di=Im(y,p),Ns(u);if(xr(u))return di=Im(Rt(u).settled,p),!0;const A=Ns(u);return pm(A)&&typeof _()?.documentMutationReadiness?.whenPainted=="function"?(di=Im(At(A),p),A):(p?.(A),di=Promise.resolve(A),Cl(),A)},Cj=(u,p)=>!u||typeof u!="object"?p:u,Dl=(u,p=Xn("Document API operation failed."))=>{if(xr(u))return Promise.resolve(u).then(A=>Dl(A,p),()=>p);const y=Cj(u,p);return Ni(),pm(y)&&typeof _()?.documentMutationReadiness?.whenPainted=="function"?(Im(At(y)),Dt(),y):(Dt(),y)},kj=(u,p,y,A)=>{const x=[],z=[];for(const W of y){const re=A(W);if(re)try{const fe=Rt(Co(u,p,re));x.push(fe.immediate),z.push(fe.settled)}catch{x.push(!1),z.push(Promise.resolve(!1))}}return Eo=z.length?Promise.all(z).then(W=>wi(W)):null,wi(x)},Sj=(u,p,y,A)=>{const x=[],z=[];for(const W of y){const re=A(W);if(re)try{const fe=Rt(Co(u,p,re));x.push(fe.immediate),z.push(fe.settled)}catch{x.push(!1),z.push(Promise.resolve(!1))}}return Eo=z.length?Promise.all(z).then(W=>wi(W)):null,wi(x)},m2=(u,p,y,A=P.selection)=>{const x=Wi(u);return x&&x.success===!1?x:A.selectionTarget?p(y,{...x??{},offsetSpace:"selection"}):x?p(y,x):p(y)},_j=(u,p,y,A)=>{const x=Ao(p,A);switch(u.kind){case"alignment":{const z=y;return z!=="left"&&z!=="center"&&z!=="right"&&z!=="justify"?null:{target:x,alignment:z}}case"spacing-line":{const z=typeof y=="number"?y:Number(y);return!Number.isFinite(z)||z<=0?null:{target:x,line:z,lineRule:"auto"}}case"style":if(y&&typeof y=="object"){const z=y.role;if(z&&typeof z=="object")return{target:x,role:z}}return typeof y!="string"||y.trim()===""?null:{target:x,styleId:y};case"direction":{const z=u.fixedValue;return z!=="ltr"&&z!=="rtl"?null:{target:x,direction:z}}default:return null}},Aj=(u,p)=>{const y=u.inline,A=u2(u),x=M();if(!y||typeof x?.setPendingInlineFormat!="function")return!1;if(y.kind==="clear")return j(),!0;if(!A)return!1;let z;if(y.kind==="toggle")z=!Tl(u,b(),P.selection);else{const W=p&&typeof p=="object"&&"value"in p?p.value:p;if(y.kind==="value-number"){const re=typeof W=="number"?W:Number(W);z=Number.isFinite(re)&&re>0?re:null}else z=typeof W=="string"&&W.trim()!==""?W:null;if(z===null)return E(A,null),!0}return E(A,z),!0},Ij=()=>{const u=b(),{lockModesById:p}=Hs(u?.contentControls,P.selection);if(cs(p))return!1;const y=[],A=[],x=Ze=>{const Ge=Rt(Ze);y.push(Ge.immediate),A.push(Ge.settled)},z=(Ze,Ge,et)=>{try{x(et?Ze(Ge,et):Ze(Ge))}catch{y.push(!1),A.push(Promise.resolve(!1))}},W=ar().cache?.full.defaults.paragraphStyleId??Zt,re=Eu(P.selection);if(re){const Ze=yr(u,"format.apply");if(Ze)try{x(m2("format.apply",Ze,{target:re,inline:{...Ku()}}))}catch{y.push(!1),A.push(Promise.resolve(!1))}}const fe=yr(u,"format.paragraph.resetDirectFormatting"),Me=yr(u,"styles.paragraph.setStyleRef"),Ue=os(P.selection),$e=!Ue||Ue.storyType==="body",qe=yr(u,$e?"lists.remove":"lists.removeInStory");for(const Ze of Br(P.selection)){const Ge=Ao(Ze,Ue);if(fe&&z(fe,{target:Ge}),qe)try{const et=ka(Ze),ht=Rt(qe($e?{target:et}:{target:et,story:Ue}));A.push(ht.settled.then(dt=>Io(dt)?dt:!0))}catch{}Me&&z(Me,{target:Ge,styleId:W})}if(!re&&mr()!=="suggesting"){const Ze=yr(u,"format.paragraph.setMarkRunProps");if(Ze)for(const Ge of Br(P.selection))z(Ze,{target:Ao(Ge,Ue),markRunProps:{bold:!1,italic:!1,strikethrough:!1,doubleStrikethrough:!1,smallCaps:!1,caps:!1,verticalAlign:"baseline"}})}return Eo=A.length?Promise.all(A).then(Ze=>wi(Ze)):null,wi(y.length?y:[!1])},xj=(u,p,y)=>{const A=Br(P.selection);if(A.length===0)return!1;const x=os(P.selection);return kj(u.docRoute,p,A,z=>_j(u.blockParagraph,z,y,x))},Ej=(u,p,y)=>{const A=b(),x=yr(A,"format.paragraph.setIndentation"),z=yr(A,"format.paragraph.clearIndentation"),W=u.list?.mode,re=rs(P.selection),fe=os(P.selection),Me=async Ue=>{const $e=await Se(A,Ue,re);if($e===!0)return{kind:"list",routeToCall:u.docRoute,opToCall:p,input:{target:vA(Ue)}};if($e===null||fe&&fe.storyType!=="body"&&typeof A?.getNode!="function")return null;const qe=await Oe(A,Ue,fe),Ze={};if(qe?.right!=null&&(Ze.right=qe.right),qe?.firstLine!=null&&(Ze.firstLine=qe.firstLine),qe?.hanging!=null&&(Ze.hanging=qe.hanging),W==="indent")return x?{kind:"paragraph",routeToCall:"format.paragraph.setIndentation",opToCall:x,input:{target:Ao(Ue,fe),left:Math.max(0,qe?.left??0)+yA,...Ze}}:null;const Ge=Math.max(0,(qe?.left??0)-yA);return Ge>0&&(Ze.left=Ge),Object.keys(Ze).length===0?z?{kind:"paragraph",routeToCall:"format.paragraph.clearIndentation",opToCall:z,input:{target:Ao(Ue,fe)}}:x?{kind:"paragraph",routeToCall:"format.paragraph.setIndentation",opToCall:x,input:{target:Ao(Ue,fe),left:0}}:null:x?{kind:"paragraph",routeToCall:"format.paragraph.setIndentation",opToCall:x,input:{target:Ao(Ue,fe),...Ze}}:null};return Eo=(async()=>{const Ue=await Promise.all(y.map(Ge=>Me(Ge).catch(()=>null)));if(Ue.length===y.length&&Ue.every(Ge=>Ge?.kind==="list")&&mr()!=="suggesting"){const Ge=W==="indent"?"lists.indentRange":"lists.outdentRange",et=yr(A,Ge);if(et)try{return await Rt(Co(Ge,et,{paraIds:y,story:re})).settled}catch{return!1}}const $e=re.storyType!=="body"&&Ue.some(Ge=>Ge?.kind==="list"),qe=$e&&W==="outdent"?yr(A,"lists.outdentInStory"):null;if($e&&!qe)return!1;const Ze=Ue.map(Ge=>{if(!Ge)return Promise.resolve(!1);try{return Ge.kind==="list"&&qe?Rt(Co("lists.outdentInStory",qe,{target:Ge.input.target,story:re})).settled:Rt(Co(Ge.routeToCall,Ge.opToCall,Ge.input)).settled}catch{return Promise.resolve(!1)}});return wi(await Promise.all(Ze))})(),!0},Tj=(u,p)=>{const y=u.list,A=b(),x=Br(P.selection);if(x.length===0)return!1;const z=rs(P.selection),W=z.storyType==="body";if(y.mode==="indent"||y.mode==="outdent")return Ej(u,p,x);const re=y.seed,fe=$e=>{if($e.some(dt=>!dt.resolved))return{immediate:!1,settled:null};const qe=$e.every(dt=>dt.seed===re);if(!qe&&!W)return{immediate:!1,settled:null};const Ze=qe?W?"lists.remove":"lists.removeInStory":u.docRoute,Ge=qe?yr(A,Ze):p;if(!Ge)return{immediate:!1,settled:null};const et=[],ht=[];return x.forEach((dt,ot)=>{if(!qe&&$e[ot]?.seed===re)return;const Bt=qe?{target:ka(dt),...W?{}:{story:z}}:{target:ka(dt),seed:re};try{const zt=Rt(Co(Ze,Ge,Bt));et.push(zt.immediate),ht.push(zt.settled)}catch{et.push(!1),ht.push(Promise.resolve(!1))}}),{immediate:wi(et),settled:ht.length?Promise.all(ht).then(dt=>wi(dt)):null}},Me=x.map($e=>Le(A,$e,z));if(Me.some(xr))return Eo=Promise.all(Me).then(async $e=>{const qe=fe($e);return qe.settled?await qe.settled:qe.immediate}),!0;const Ue=fe(Me);return Eo=Ue.settled,Ue.immediate};function qf(u){return u&&typeof u=="object"?u:{}}function Rj(u){if(typeof u=="string")return u;const p=qf(u);if(Object.prototype.hasOwnProperty.call(p,"href"))return p.href;if(Object.prototype.hasOwnProperty.call(p,"value"))return p.value}function Lj(u,p){const y=qf(u).text;return typeof y=="string"&&y.trim()!==""?y:p}function RA(u){const p=qf(u),y=p.capture&&typeof p.capture=="object"?p.capture:null;return p.target??y?.target??y?.selectionTarget??p.selectionTarget??p.textTarget??null}const Mj=u=>{const p=b(),y=p?.hyperlinks;if(!y)return!1;const A=qf(u),x=Rj(u),z=RA(u),W=typeof A.text=="string"?A.text:void 0,re=typeof A.currentText=="string"?A.currentText:void 0,fe=Ff(A.hyperlinkTarget)?A.hyperlinkTarget:null,Me=Ff(A.textTarget)?A.textTarget:null,Ue=Ra(p,P.selection),$e=typeof fe?.storyId=="string"&&typeof fe?.hyperlinkNodeId=="string";if($e&&x===null){const qe=y.remove;if(typeof qe!="function")return!1;try{return Co("hyperlinks.remove",qe,{storyId:fe.storyId,hyperlinkNodeId:fe.hyperlinkNodeId,keepText:!0})}catch{return!1}}if(Ue&&x===null){const qe=y.remove;if(typeof qe!="function")return!1;try{return Co("hyperlinks.remove",qe,{target:Ue.address,mode:"unwrap"})}catch{return!1}}if((Ue||fe)&&typeof x=="string"&&x.trim()!==""){const qe=y.patch,Ze=y.updateTarget;if(!(!$e&&Ue&&typeof qe=="function")&&!($e&&typeof Ze=="function"))return!1;const Ge=typeof W=="string"&&W!==($e?re:Ue?.text??re),et=p?.text?.replace,ht=Ge?$e?Me:TV(Ue?.address):null,dt=Ge&&!!ht&&typeof et=="function";if(Ge&&!dt)return!1;const ot=[],Bt=[];let zt=null,Gn=null,Wn=null,Jr=!1;try{if($e){if(typeof Ze!="function")return!1;const eo=Co("hyperlinks.updateTarget",Ze,{storyId:fe.storyId,hyperlinkNodeId:fe.hyperlinkNodeId,newTarget:RV(x)});Jr=xr(eo);const Sr=Rt(eo);if(!Io(Sr.immediate))return!1;ot.push(Sr.immediate),Bt.push(Sr.settled),zt=Sr.immediate,Gn=Sr.committed,Wn=Sr.settled}else if(Ue){if(typeof qe!="function")return!1;const eo=Co("hyperlinks.patch",qe,{target:Ue.address,patch:{href:x}});Jr=xr(eo);const Sr=Rt(eo);if(!Io(Sr.immediate))return!1;ot.push(Sr.immediate),Bt.push(Sr.settled),zt=Sr.immediate,Gn=Sr.committed,Wn=Sr.settled}}catch{return!1}if(dt){const eo=(Pr,Yo)=>Io(Yo)?wi([Pr,Yo]):Io(Pr)?Rf(Pr,Yo):Yo,Sr=Pr=>{if(!Io(Pr))return Pr;try{const Yo=Rt(Co("text.replace",et,{target:ht,text:W}));return Io(Yo.immediate)?Promise.all([Wn??Promise.resolve(Pr),Yo.settled]).then(([A2,gU])=>eo(A2,gU)):Rf(Pr,Yo.immediate)}catch{return Rf(Pr,!1)}};if(Jr)return Eo=(Gn??Promise.resolve(zt??!1)).then(Sr),wi(ot);try{const Pr=Rt(Co("text.replace",et,{target:ht,text:W}));if(!Io(Pr.immediate))return zt?Rf(zt,Pr.immediate):Pr.immediate;ot.push(Pr.immediate),Bt.push(Pr.settled),Eo=Promise.all([Wn??Promise.resolve(zt??!1),Pr.settled]).then(([Yo,A2])=>eo(Yo,A2))}catch{return zt?Rf(zt,!1):!1}}return!dt&&Bt.length>0&&(Eo=Promise.all(Bt).then(eo=>wi(eo))),wi(ot)}if(typeof x=="string"&&x.trim()!==""){const qe=x.trim(),Ze=y.wrap,Ge=bV(z),et=Ge.length>0?Ge:i2(P.selection);if(et.length>0){if(typeof Ze!="function")return!1;try{return Sj("hyperlinks.wrap",Ze,et,Bt=>({target:Bt,link:{destination:{href:qe}}}))}catch{return!1}}const ht=y.insert,dt=Lj(u,qe);if(typeof ht!="function"||dt.trim()==="")return!1;const ot=Pf(z)??pl(P.selection);if(!ot)return!1;try{return Co("hyperlinks.insert",ht,{target:ot,text:dt,link:{destination:{href:qe}}})}catch{return!1}}return!1},Pj=(u,p,y)=>{const A=u.create.kind,x=y&&typeof y=="object"?y:{};if(A==="table"){const W=Number(x.rows??x.rowCount),re=Number(x.columns??x.cols??x.colCount);if(!Number.isInteger(W)||W<1||!Number.isInteger(re)||re<1)return!1;const fe=pl(P.selection),Me=fe&&typeof fe.blockId=="string"?{kind:"inParagraph",target:Ao(fe.blockId),offset:fe.range?.start??0}:l2(P.selection,"nodeId");try{return Co(u.docRoute,p,{rows:W,columns:re,at:Me})}catch{return!1}}if(A==="image"){const W=x.src??x.value;if(typeof W!="string"||W.trim()==="")return!1;const re=pl(P.selection),fe=rs(P.selection),Me=fe.storyType==="body"?null:fe;let Ue;re&&typeof re.blockId=="string"?Ue={kind:"inParagraph",target:Ao(re.blockId,Me),offset:re.range?.start??0}:(Ue=l2(P.selection,"target"),Me&&Ue.kind==="after"&&(Ue={...Ue,target:{...Ue.target,story:Me}}));const $e={src:W,at:Ue};Me&&($e.in=Ue.kind==="inParagraph"?V(Me)??Me:Me),typeof x.alt=="string"&&($e.alt=x.alt),typeof x.title=="string"&&($e.title=x.title),x.size&&typeof x.size=="object"&&($e.size=x.size);try{return Co(u.docRoute,p,$e)}catch{return!1}}const z={at:l2(P.selection,"target")};typeof x.instruction=="string"&&(z.instruction=x.instruction),x.config&&typeof x.config=="object"&&(z.config=x.config);try{return Co(u.docRoute,p,z)}catch{return!1}},Dj=(u,p)=>{const y=u.table,A=ke();if(!A||y.requiresCell&&!A.cellNodeId)return!1;const x=BV(y.action,A);if(!x)return!1;try{if(y.action==="insert-row-before"||y.action==="insert-row-after"){const z=M(),W=(typeof z?.getHandles=="function"?z.getHandles():null)?.editing?.tables;if(typeof W?.insertRow!="function")return!1;const re=Wi(u.docRoute);return re&&re.success===!1?re:re?W.insertRow(x,re):W.insertRow(x)}return Co(u.docRoute,p,x)}catch{return!1}},Oj=u=>!u||u.disposition!=="routed"?!1:!!(u.inline||u.blockParagraph||u.list||u.link||u.create),Fj=u=>{const p=qf(u);return!!(RA(u)||Ff(p.hyperlinkTarget)||Ff(p.textTarget))},Nj=(u,p,y)=>P.selection.status!=="ready"?!1:gm(u)?.scope==="id"||!p||p.disposition!=="routed"?!0:p.inline?.kind==="clear"?Br(P.selection).length>0||Eu(P.selection)!=null:p.inline?Eu(P.selection)!=null||Br(P.selection).length>0:p.blockParagraph||p.list?Br(P.selection).length>0:p.link?Fj(y)||i2(P.selection).length>0||pl(P.selection)!=null||Tl(p,b(),P.selection):!0,Bj=(u,p)=>{const y=gm(u),A=ku(u);return y?.scope!=="id"&&!Oj(A)?!1:!Nj(u,A,p)},zj=(u,p)=>Bj(u,p)?ls().then(()=>{}):null,Ac=(u,p,y)=>{if(Eo=null,di=Promise.resolve(!1),U)return!1;const A=oe.get(u);if(A)try{const $e=A.execute(Ru(p,y));return To($e)}catch{return!1}const x=uA(u);if(x&&typeof se()?.lists?.apply=="function")return Am(x,p);const z=gm(u);if(z)return p2(z,p);if(u==="copy-format")return To(Vj());const W=ku(u);if(!W||W.disposition!=="routed")return!1;const re=W.normalizePayload?W.normalizePayload(p):p;if(W.instanceRoute){if(!_()||!_n(W,re))return!1;const $e=t?.[W.instanceRoute];if(typeof $e!="function")return!1;try{const qe=W.fixedArg!==void 0?W.fixedArg:re,Ze=$e.call(t,qe);return To(Ze)}catch{return!1}}if(W.inline?.kind==="clear")return W.mutates&&mr()==="viewing"?!1:To(Ij());const fe=W.docRoute;if(!fe||W.mutates&&mr()==="viewing")return!1;const Me=b(),Ue=yr(Me,fe);if(!Ue)return!1;if(W.inline){const{lockModesById:$e}=Hs(Me?.contentControls,P.selection);if(cs($e))return!1;const qe=Eu(P.selection);if(!qe)return P.selection.empty===!1?To(!1):To(Aj(W,re));const Ze=Tl(W,Me,P.selection),Ge=FV(W.inline,qe,re,Ze);if(!Ge)return!1;let et=null;try{const ht=_(),dt=mr(),ot=()=>_()!==ht||b()!==Me||mr()!==dt?!1:m2(fe,Ue,Ge),Bt=Sa(P.selection)??cc(P.selection),zt=W.inline.kind==="toggle"?Qr(`${W.id}:${Bt}`,ot):null;et=zt?.release??null;const Gn=zt?zt.result:ot(),Wn=bj(W,P.selection,Ge,Gn),Jr=yj(W,P.selection,Ge,Gn),eo=To(Jr,Sr=>{wj(W,Wn,Sr),et?.(),et=null});return W.inline.kind==="toggle"&&(Wu=di),eo}catch{return et?.(),!1}}if(W.blockParagraph){const $e=xj(W,Ue,re),qe=W.blockParagraph.kind==="alignment"&&Io($e)?de(P.selection,re):null;return To($e,Ze=>{ue(qe,Ze)})}if(W.list){const $e=Tj(W,Ue);return To($e)}if(W.link){const $e=Mj(re);return To($e)}if(W.create){const $e=Pj(W,Ue,re);return To($e)}if(W.table){const $e=Dj(W,Ue);return To($e)}try{return To(W.mutates?Co(fe,Ue,re):Ue(re))}catch{return!1}},xm=()=>{g+=1,h={mode:"idle",snapshot:null,sourceSelectionKey:null,lastClickAt:h.lastClickAt,pointerSelecting:!1,keyboardSelecting:!1};for(const u of m)u("idle");Dt()},Vj=async()=>{const u=["bold","italic","underline","strikethrough"].filter(Ue=>P.toolbar.commands[Ue]?.active===!0),p=await Wu;await d;const y=Io(p)?u:[],A=500,x=Date.now();if(h.mode!=="idle"){if(h.mode==="armed"&&x-h.lastClickAt<A){h={...h,mode:"persistent",lastClickAt:x};for(const Ue of m)Ue("persistent");return Dt(),!0}return xm(),!1}const z=x-h.lastClickAt<A,W=++g;h={...h,lastClickAt:x};const re=await ls(),fe=`${cc(re)}:${on()}`,Me=await jj(null,re,fe&&fe===k?v:void 0,y);if(W!==g)return!0;h={...h,mode:z?"persistent":"armed",snapshot:Me,sourceSelectionKey:cc(re),lastClickAt:x};for(const Ue of m)Ue(h.mode);return Dt(),!0},jj=async(u,p,y,A=[])=>{const x=p?.target??u?.target;if(!x||x.kind!=="text")return null;const z=Array.isArray(x.segments)?x.segments:[];if(z.length===0)return null;const W=b();if(!W)return null;const re=x.story;let fe=null;for(const Ge of z){const et=(await El(Ao(Ge.blockId,re)))?.node??null;if(!et)continue;const ht=g2(et),dt=Array.isArray(ht?.inlines)?ht.inlines:[],ot=Uj(dt,Ge.range);fe?fe=LA(fe,ot):fe=ot}const Me=fe?Nz(fe):{},Ue={bold:"bold",italic:"italic",underline:"underline",strikethrough:"strike"},$e=new Set([...p?.activeMarks??(Array.isArray(u?.activeMarks)?u.activeMarks:[]),...A]);for(const[Ge,et]of Object.entries(Ue))$e.has(Ge)&&(Me[et]=!0);const qe=y??await Wf(p??Vs(u,"ready"));if(qe.fontFamily&&(Me.fontFamily=qe.fontFamily),qe.color&&(Me.color=qe.color),qe.highlight&&(Me.highlight=qe.highlight),qe.fontSize){const Ge=Number.parseFloat(qe.fontSize);Number.isNaN(Ge)||(Me.fontSize=Ge)}let Ze=null;if(z.length===1){const Ge=z[0],et=(await El(Ao(Ge.blockId,re)))?.node??null;et&&g2(et)&&(Ze=await Hj(et,Ge.blockId,W,re))}return{story:re??null,inline:Me,paragraph:Ze}},g2=u=>u?u.kind==="paragraph"?u.paragraph??null:u.kind==="heading"?u.heading??null:null:null,Uj=(u,p)=>{const y=W=>{const re=W.run;return typeof re?.text=="string"?re.text:""},A=W=>W.run?.props;if(p.start===p.end){let W=0;for(const re of u){const fe=y(re),Me=W,Ue=W+fe.length;if(W=Ue,p.start>=Me&&p.start<=Ue){const $e=A(re);return $e?{...$e}:{}}}return{}}let x=0;const z=[];for(const W of u){const re=y(W),fe=x,Me=x+re.length;if(x=Me,Me<=p.start||fe>=p.end)continue;const Ue=A(W);Ue&&z.push(Ue)}return z.length===0?{}:z.length===1?{...z[0]}:LA(z[0],...z.slice(1))},LA=(u,...p)=>{const y={...u};for(const A of p)for(const x of Object.keys(y)){if(!(x in A)){delete y[x];continue}const z=y[x],W=A[x];(typeof z!=typeof W||JSON.stringify(z)!==JSON.stringify(W))&&delete y[x]}return y},Hj=async(u,p,y,A)=>{const x=g2(u),z=x.props??{},W=x.styleRef??null,re=z.alignment??null,fe=z.spacing??null,Me=z.indent??null,Ue=Me?{...Me.left!=null?{left:Me.left}:{},...Me.right!=null?{right:Me.right}:{},...Me.firstLine!=null?{firstLine:Me.firstLine}:{},...Me.hanging!=null?{hanging:Me.hanging}:{}}:null,$e=z.markRunProps??null,qe=z.numbering?.numId,Ze=typeof qe=="string"?parseInt(qe,10):typeof qe=="number"?qe:NaN,Ge=z.numbering?.level,et=isNaN(Ze)?null:{numId:Ze,...Ge!=null?{level:Ge}:{}};let ht=null;if(et&&typeof y.lists?.getState=="function")try{const dt=await y.lists.getState({target:Ao(p,A)});dt&&typeof y.lists?.getStyle=="function"&&(ht=await y.lists.getStyle(dt)??null)}catch{}return{styleId:W,alignment:re,spacing:fe,indentation:Ue,markRunProps:$e,numbering:et,listStyle:ht}},MA=async()=>{if(h.mode==="idle"||h.pointerSelecting||h.keyboardSelecting)return;const u=b()?.selection,p=async()=>{const W=typeof u?.current=="function"?await Promise.resolve(u.current({includeText:!0})):js().value;return zi(W)},y=()=>new Promise(W=>setTimeout(W,16)),A=8;let x=null,z="";for(let W=0;W<A;W+=1){if(W>0&&await y(),h.mode==="idle"||h.pointerSelecting||h.keyboardSelecting)return;if(x=await p(),!(!x||x.empty)&&(z=cc(x),z!==h.sourceSelectionKey))break}if(x&&!x.empty&&z!==h.sourceSelectionKey){await PA(x);return}if(h.snapshot?.paragraph){const W=await p();if(!W||cc(W)===h.sourceSelectionKey)return;await PA(W)}},PA=async u=>{const p=h.snapshot;if(!p){h.mode==="armed"&&xm();return}const y=b();if(!y)return;const A=Vs(u,"ready"),{lockModesById:x}=Hs(y.contentControls,A);if(cs(x)){Dt();return}const z=u.target,W=u.selectionTarget;if(u.empty!==!0&&Object.keys(p.inline).length>0){const re=yr(y,"format.apply");if(re&&W)try{if(!Io(Ns(await Promise.resolve(m2("format.apply",re,{target:W,inline:p.inline},u))))){Dt();return}}catch{Dt();return}}if(p.paragraph){const re=Array.isArray(z?.segments)?z.segments:[],fe=z?.story;for(const Me of re){const Ue=Ao(Me.blockId,fe),$e=await El(Ue),qe=$e?.node??null,Ze=$e?.address??null;if(!qe)continue;const Ge={kind:"block",nodeType:Ze?.nodeType??qe.kind??"paragraph",nodeId:Me.blockId,...fe&&typeof fe=="object"?{story:fe}:{}},{styleId:et,alignment:ht,spacing:dt,indentation:ot,markRunProps:Bt,numbering:zt,listStyle:Gn}=p.paragraph;if(et&&await y.styles?.paragraph?.setStyle?.({target:Ge,styleId:et}),ht&&await y.format?.paragraph?.setAlignment?.({target:Ge,alignment:ht}),dt){const Wn=dt,Jr=Wn.lineRule??"auto",eo=new Set(["auto","exact","atLeast"]).has(Jr)?Jr:"auto",Sr={...Wn.before!=null?{before:Math.round(Wn.before*20)}:{},...Wn.after!=null?{after:Math.round(Wn.after*20)}:{},...Wn.line!=null?{line:Math.round(eo==="auto"?Wn.line*240:Wn.line*20),lineRule:eo}:{}};await y.format?.paragraph?.setSpacing?.({target:Ge,...Sr})}if(ot){const Wn={...ot.left!=null?{left:Fs(ot.left)}:{},...ot.right!=null?{right:Fs(ot.right)}:{},...ot.firstLine!=null?{firstLine:Fs(ot.firstLine)}:{},...ot.hanging!=null?{hanging:Fs(ot.hanging)}:{}};await y.format?.paragraph?.setIndentation?.({target:Ge,...Wn})}Bt&&await y.format?.paragraph?.setMarkRunProps?.({target:Ge,markRunProps:Bt}),zt&&await y.format?.paragraph?.setNumbering?.({target:Ge,...zt}),Gn&&((await El(Ue))?.address?.nodeType==="listItem"?await y.lists?.applyStyle?.({target:vA(Me.blockId,fe),style:Gn}):zt&&await y.format?.paragraph?.setNumbering?.({target:Ge,...zt}))}}h.mode==="armed"&&xm(),Dt()},Em=(u,p,y)=>{const A=zj(u,p),x=A?A.then(()=>(Ac(u,p,y),di)):(Ac(u,p,y),di);return ku(u)?.inline?.kind==="toggle"&&(Wu=x),x},DA=u=>({id:u,getState:()=>P.toolbar.commands[u]??Hu(u,b(),P.selection,xl(P.selection)),observe:p=>jo(y=>y.toolbar.commands[u]??{enabled:!1,active:!1,supported:!1,source:"unsupported",reason:lt.commandUnsupported}).subscribe(p),execute:p=>Ac(u,p),executeAsync:p=>Em(u,p)}),$j=u=>{oe.set(u.id,u),Dt();const p=()=>{oe.delete(u.id),Dt()};return Object.assign(p,{handle:DA(u.id),unregister:p})},Tm=bo(u=>u.selection),Rm=qo(Tm),OA=()=>{const u=M();if(typeof u?.getHandles!="function")return{reason:lt.hostCapabilityUnavailable};let p=null;try{p=u.getHandles()}catch(A){const x=A?.reason;return{reason:x==="host-not-ready"||x==="host-disposed"||x==="editing-mount-required"?lt.notReady:lt.hostCapabilityUnavailable}}const y=p?.editing?.selectionTargets;return typeof y?.apply!="function"?{reason:lt.hostCapabilityUnavailable}:{helper:y}},Gj=u=>{const p=M();if(typeof p?.getHandles=="function")try{const y=p.getHandles()?.editing?.contentControls;typeof y?.activate=="function"&&y.activate({id:u})}catch{}},FA={get:Rm.get,getSnapshot:Rm.getSnapshot,subscribe:Rm.subscribe,observe:Rm.observe,current:()=>js().value,capture:()=>{const u=Tm.get();return u.empty||!u.target&&!u.selectionTarget?null:{...u,capturedAt:Date.now()}},restore:u=>{const p=x=>(Dt(),{...x,success:x.ok});if(!u||typeof u!="object")return p({ok:!1,reason:lt.targetUnresolved});if(!_())return p({ok:!1,reason:lt.notReady});const y=DV(u);if(!y)return p({ok:!1,reason:lt.targetUnresolved});const A=OA();if(!("helper"in A))return p({ok:!1,reason:A.reason});try{return p(cA(A.helper.apply(y)))}catch{return p({ok:!1,reason:lt.hostCapabilityUnavailable})}},apply:u=>{if(!_())return{ok:!1,reason:lt.notReady};const p=OA();if(!("helper"in p))return{ok:!1,reason:p.reason};try{const y=p.helper.apply(u);return Dt(),cA(y)}catch{return{ok:!1,reason:lt.hostCapabilityUnavailable}}},getAnchorRect:u=>{const p=M();if(typeof p?.getSelectionAnchorRect=="function"){const y=Lt(()=>p.getSelectionAnchorRect(u),null);return y&&typeof y=="object"&&(Number(y.width)>0||Number(y.height)>0)?y:null}return null},getRects:u=>{const p=Tm.get(),y=p.selectionTarget??p.target;if(p.empty||!y)return[];const A=zm.getRect({target:y,relativeTo:u?.relativeTo});return A.found?A.rects:[]}},Wj={get ids(){return Lr()},has:u=>ku(u)!=null||oe.has(u),get:u=>DA(u),execute:Ac,executeAsync:Em,register:$j,getContextMenuItems:u=>{const p=[];for(const y of oe.values()){const A=y.contextMenu;A&&Lt(A.when?()=>A.when(u):void 0,!0)&&p.push({id:y.id,label:A.label,group:A.group,order:A.order,invoke:()=>Ac(y.id,void 0,u)})}return p.sort((y,A)=>(y.order??0)-(A.order??0)||y.label.localeCompare(A.label))}},v2=qo(bo(u=>u.toolbar)),Kj={get:v2.get,getSnapshot:()=>P.toolbar,subscribe:v2.subscribe,observe:v2.observe,execute:Ac,executeAsync:Em},qu=async(u,p)=>{if(!_())return{success:!1,ok:!1,reason:lt.notReady};if(!u)return{success:!1,ok:!1,reason:lt.targetUnresolved};const y=M(),A=y?.scrollTargetIntoView;if(typeof A!="function")return{success:!1,ok:!1,reason:lt.hostCapabilityUnavailable};try{const x={target:u,block:p?.block??"center",behavior:p?.behavior??"smooth"},z=await Promise.resolve(p?.shouldContinue?A.call(y,x,p.shouldContinue):A.call(y,x));return z&&typeof z=="object"&&z.success===!1?{success:!1,ok:!1,reason:n2(z.reason,lt.targetUnresolved)}:{success:!0,ok:!0}}catch{return{success:!1,ok:!1,reason:lt.hostCapabilityUnavailable}}},NA=u=>{if(!u||typeof u!="object")return null;const p=u,y=p.wordRevisionIds&&typeof p.wordRevisionIds=="object"?p.wordRevisionIds:null,A=p.sourceIds&&typeof p.sourceIds=="object"?p.sourceIds:null,x=Array.isArray(A?.wordIdOther)?A.wordIdOther:void 0,z=y?.insert??y?.delete??y?.format??A?.wordIdInsert??A?.wordIdDelete??x?.[0];return typeof z=="string"&&z.length>0?z:null},BA=async(u,p,y,A,x)=>{const z=await qu(p,x);if(z.ok)return z;const W=w(),re=W?.focusTrackedChange;if(typeof re!="function")return z;const fe=y||A?{commentId:u,...y?{trackedChangeStory:y}:{},...A?{importedId:A}:{}}:u;try{const Me=await Promise.resolve(re.call(W,fe));if(Me&&typeof Me=="object"&&Me.ok===!0)return{success:!0,ok:!0}}catch{}return z},Lm=async(u,p,y,A)=>{const x=u==="trackChanges"?A?.story:void 0,z=dt=>{if(!x||!dt||typeof dt!="object")return dt;const ot=dt,Bt=ot.address&&typeof ot.address=="object"?ot.address:null;return ot.story||Bt?.story?dt:{...ot,story:x}},W=u==="trackChanges"?fA:Lf,re=y.find(dt=>Di(dt,p,x)),fe=re&&typeof re=="object"?re:null,Me=u==="trackChanges"&&fe?.type==="move"&&(fe.subtype==="move-to"||fe.subtype==="move-from")?fe.subtype:null,Ue=Me&&typeof fe?.trackedChangeCanonicalId=="string"?fe.trackedChangeCanonicalId:p,$e=dt=>{if(!Me)return u==="trackChanges"?fA(dt,{preferStableBlock:!0}):W(dt);const ot=Lf(dt);if(ot?.kind!=="move")return null;const Bt=Me==="move-to"?ot.destination:ot.source;return r2(Bt)?Bt:null},qe=W(re),Ze=u!=="trackChanges"||!Me&&r2(Lf(re));if(qe&&Ze)return z(qe);const Ge=b()?.[u],et=u==="comments"?{commentId:p}:{id:Ue,...x?{story:x}:{}},ht=Ge?.get;if(typeof ht!="function")return z(qe);try{return z($e(await Promise.resolve(ht.call(Ge,et)))??qe)}catch{return z(qe)}};function zA(u,p){if(zs())return Xn("Comments are read-only.","DOCUMENT_READONLY");if(ii())return Xn("Resolving comments is disabled.","DOCUMENT_READONLY");const y=b()?.comments,A=y?.patch;if(typeof A!="function")return Xn("comments.patch is unavailable.");const x=Xn("comments.patch failed.");return Lt(()=>Dl(A.call(y,{commentId:u,status:p}),x),x)}const Yf=()=>zs()?Xn("Comments are read-only.","DOCUMENT_READONLY"):null,qj=(u,p)=>{const y=p&&typeof p=="object"?p:null;let A=Array.from(u);y?.includeResolved===!1&&(A=A.filter(fe=>fe.status!=="resolved"));const x=Number(y?.offset),z=Number.isInteger(x)&&x>0?x:0,W=Number(y?.limit),re=Number.isInteger(W)&&W>=0?z+W:void 0;return A.slice(z,re)},Yu=bo(u=>u.comments),Mm=Oa(Yu,jo(u=>Lu(u.selection,u.comments)),"comments"),Yj={get:Mm.get,getSnapshot:Mm.getSnapshot,subscribe:Mm.subscribe,observe:Mm.observe,list:u=>{kt();const p=vc();return qj(p.value??Yu.get().items,u)},getById:u=>{const p=Yu.get().items.find(x=>oo(x)===u)??null;if(p)return p;const y=b()?.comments,A=Lt(y?.get?()=>y.get({commentId:u}):void 0,null);return xr(A)?null:A},createFromCapture:(u,p)=>{const y=Yf();if(y)return y;const A=b()?.comments,x=A?.create;if(typeof x!="function")return Xn("comments.create is unavailable.");const z=Xn("comments.create failed.");return Lt(()=>{const W=u&&typeof u=="object"?u.target??u.selectionTarget:null;return W==null?Xn("A range selection is required to comment.","NO_SELECTION"):Dl(x.call(A,{target:W,text:p.text}),z)},z)},createFromSelection:u=>{const p=Yf();if(p)return p;const y=b()?.comments,A=y?.create;if(typeof A!="function")return Xn("comments.create is unavailable.");const x=Tm.get(),z=x.target??x.selectionTarget;if(x.empty||!z)return Xn("A range selection is required to comment.","NO_SELECTION");const W=Xn("comments.create failed.");return Lt(()=>Dl(A.call(y,{target:z,text:u.text}),W),W)},reply:(u,p)=>{const y=Yf();if(y)return y;const A=b()?.comments,x=A?.reply??A?.create;if(typeof x!="function")return Xn("comments.reply is unavailable.");const z=Xn("comments.reply failed.");return Lt(()=>Dl(x===A?.reply?x.call(A,{parentCommentId:u,text:p.text}):x.call(A,{parentCommentId:u,text:p.text}),z),z)},edit:(u,p)=>{const y=Yf();if(y)return y;const A=b()?.comments,x=A?.patch;if(typeof x!="function")return Xn("comments.patch is unavailable.");const z=Xn("comments.patch failed.");return Lt(()=>Dl(x.call(A,{commentId:u,text:p.text}),z),z)},resolve:u=>zA(u,"resolved"),reopen:u=>zA(u,"active"),delete:u=>{const p=Yf();if(p)return p;const y=b()?.comments,A=y?.delete??y?.remove;if(typeof A!="function")return Xn("comments.delete is unavailable.");const x=Xn("comments.delete failed.");return Lt(()=>Dl(A.call(y,{commentId:u}),x),x)},setActive:u=>{if(u==null)return Re=null,Dt(),!0;if(!_())return!1;const p=Yu.get(),y=Q.get("comments"),A=y?.token===on()&&y.hasSettled&&Array.isArray(y.value)?y.value:null,x=A??p.items;if(!A&&p.listStatus!=="ready")return!1;const z=mV(x,u);return!z||!x.some(W=>oo(W)===z)?!1:(Re=z,Dt(),!0)},scrollTo:async u=>{if(!b())return{success:!1,ok:!1,reason:_()?lt.documentApiUnavailable:lt.notReady};const p=await Lm("comments",u,Yu.get().items);return p?qu(p):{success:!1,ok:!1,reason:lt.targetUnresolved}}},fs=bo(u=>u.trackChanges),y2=(u,p)=>{Be();const y=(Us().value??fs.get().items).map(Of).filter($e=>$e!=null&&oo($e)!==null);if(y.length===0)return null;const A=P.trackChanges.activeId,x=je?.id===A?je.story:void 0,z=y.filter($e=>dm($e)==null),W=x||z.length===0?y:z;let re=A?W.findIndex($e=>Di($e,A,x)):-1;re===-1&&A&&x&&(re=W.findIndex($e=>Di($e,A)));const fe=W[re===-1?u>0?0:W.length-1:(re+u+W.length)%W.length],Me=oo(fe),Ue=dm(fe);return ne(Ue?{id:Me,story:Ue}:{id:Me},p),Dt(),Me},VA=async u=>{const p=w(),y=p?.listTrackedChanges;if(typeof y=="function")try{await Promise.resolve(y.call(p,{mode:"visible-window",targetIds:[u],refreshReason:"ui-track-change-reveal-restamp",blocking:!0}))}catch{}};let jA=Promise.resolve();const Xj=u=>{const p=wt;return jA.catch(()=>{}).then(()=>Zj(u,p))},Zj=async(u,p)=>{if(wt!==p)return{success:!1};const y=je,A=y2(u,{invalidateQueuedNavigation:!1});if(A==null)return{success:!1};const x=je,z=tt,W=()=>wt===p&&je===x&&tt===z,re=()=>{W()&&(ne(y,{invalidateQueuedNavigation:!1}),Dt())};x&&We.add(x);try{const fe=await Lm("trackChanges",A,fs.get().items,x?.story?{story:x.story}:void 0);if(!W())return{success:!1};if(!fe)return re(),{success:!1};const Me=fs.get().items.find($e=>Di($e,A,x?.story))??fs.get().items.find($e=>oo($e)===A),Ue=NA(Me);gn+=1;try{const $e=await BA(A,fe,x?.story,Ue,{behavior:"auto",shouldContinue:W});if(!W())return{success:!1};if(!$e.ok&&$e.reason!==lt.targetNotVisible)re(),S(y);else{if($e.ok&&await VA(A),!W())return{success:!1};S(x)}return{success:$e.ok}}finally{gn=Math.max(0,gn-1),gn===0&&(W()?ci&&An(Qt(ci)):S(je))}}finally{x&&We.delete(x)}},UA=u=>{const p=Xj(u);return jA=p.then(()=>{},()=>{}),p},Pm=Oa(fs,jo(u=>ji(u.selection,u.trackChanges)),"trackChanges"),Qj={get:Pm.get,getSnapshot:Pm.getSnapshot,subscribe:Pm.subscribe,observe:Pm.observe,list:()=>{Be();const u=Us().value??fs.get().items,p=pn(on());return u.map(Of).filter(y=>y!=null).filter(y=>{const A=oo(y);return!A||!p?.has(A)})},accept:u=>b2("accept",u),reject:u=>b2("reject",u),acceptAll:()=>Xf("accept",{kind:"all"},null),rejectAll:()=>Xf("reject",{kind:"all"},null),next:()=>y2(1),previous:()=>y2(-1),navigateNext:()=>UA(1),navigatePrevious:()=>UA(-1),getAt:u=>{if(!u||typeof u!="object"||typeof u.x!="number"||typeof u.y!="number")return null;const p=k2(u);if(p.length===0)return null;const y=fs.get().items;let A;for(const x of p){if(x.type!=="trackedChange")continue;let z;if(x.story){if(A===void 0&&(A=si()),!A)continue;z=A}else z=y;const W=z.find(re=>Di(re,x.id,x.story));if(W)return x.story?{id:W.id,item:W,story:x.story}:{id:W.id,item:W}}return null},setActive:u=>{if(u==null)return ne(null),S(null),Dt(),!0;if(!_())return!1;const p=typeof u=="string"?{id:u}:{id:u.id,story:u.story};if(typeof p.id!="string"||p.id.length===0)return!1;const y=p.id;if(p.story){const A=si();if(!A)return!1;const x=dc(A,p.story).toPublicId(p.id)??p.id;if(!A.some(z=>Di(z,x,p.story)))return!1;p.id=x}else{const A=si()??fs.get().items,x=Os(A).toPublicId(p.id)??p.id,z=A.find(W=>oo(W)===x);if(!z)return!1;p.id=x,p.story=dm(z)}return y!==p.id&&(p.paintedEntityId=y),ne(p),S(p),Dt(),!0},scrollTo:async u=>{if(!b())return{success:!1,ok:!1,reason:_()?lt.documentApiUnavailable:lt.notReady};wt+=1,Te+=1;const p=Te,y=fs.get().items,A=Os(y).toPublicId(u)??u,x=y.find(Me=>oo(Me)===A),z=dm(x),W=NA(x),re=je,fe={id:A,...z?{story:z}:{},...A!==u?{paintedEntityId:u}:{}};We.add(fe);try{const Me=await Lm("trackChanges",A,y,z?{story:z}:void 0);if(Te!==p)return{success:!1,ok:!1};if(!Me)return{success:!1,ok:!1,reason:lt.targetUnresolved};ne(fe);const Ue=Te,$e=je,qe=tt,Ze=()=>Te===Ue&&je===$e&&tt===qe,Ge=()=>{Ze()&&(ne(re,{invalidateQueuedNavigation:!1}),Dt())};Dt(),gn+=1;try{const et=await BA(A,Me,z,W,{behavior:"auto",shouldContinue:Ze});if(!Ze())return{success:!1,ok:!1};if(!et.ok&&et.reason!==lt.targetNotVisible)Ge(),S(re);else{if(et.ok&&await VA(A),!Ze())return{success:!1,ok:!1};S(fe)}return et}finally{gn=Math.max(0,gn-1),gn===0&&(Ze()?ci&&An(Qt(ci)):S(je))}}finally{We.delete(fe)}}},b2=(u,p)=>{const{id:y,story:A}=typeof p=="string"?{id:p,story:void 0}:p,x={kind:"id",id:y,...A?{story:A}:{}};return Xf(u,x,y,A)},Xf=(u,p,y,A)=>{try{return To(w2(u,p,y,A))}catch{return!1}},w2=(u,p,y,A)=>{if(zs())return!1;const x=b()?.trackChanges,z=p.kind==="all"||p.scope==="all",W=p.kind==="range",re=p.kind==="ids";if(Uu({kind:u,scope:z?"all":"id"},x))return!1;const fe=z?`${u}All`:u,Me=!W&&!re&&!A&&x&&typeof x[fe]=="function"?x[fe]:null,Ue=x&&typeof x.decide=="function"?x.decide:null;return!Me&&!Ue?!1:Me?Me.call(x,y??{}):Ue.call(x,{decision:u,target:p})},C2=bo(u=>u.contentControls),Zf=u=>C2.get().items.find(p=>p?.id===u)??null,Dm=qo(C2),Jj=(u=>{if(u===void 0)return Dm.get();const p=fm(u);return p?Zf(p):null}),eU={get:(u=>(u!==void 0&&we("api"),Jj(u))),getSnapshot:Dm.getSnapshot,subscribe:Dm.subscribe,observe:Dm.observe,list:()=>(we("api"),C2.get().items),getById:u=>(we("api"),Zf(u)),getRect:u=>{const p=fm(u);if(!p)return ml("unresolved");we("panel");const y=Zf(p);if(!y)return ml("unresolved");const A=o2(y);return A?zm.getRect({target:A}):ml("unavailable")},scrollIntoView:async u=>{const p=fm(u);if(!p)return{success:!1};we("panel");const y=Zf(p);if(!y)return{success:!1};const A=o2(y);return A?{success:(await qu(A,{block:u.block,behavior:u.behavior})).ok}:{success:!1}},focus:async u=>{const p=fm(u);if(!p)return{success:!1,reason:"invalid-id"};if(!_())return{success:!1,reason:"not-ready"};we("panel");const y=Zf(p);if(!y)return{success:!1,reason:"not-found"};const A=o2(y);if(!A)return{success:!1,reason:"not-reachable"};if(!(await qu(A,{block:u.block,behavior:u.behavior})).ok)return{success:!1,reason:"not-reachable"};const x=cV(A);if(!x)return{success:!1,reason:"not-reachable"};const z=FA.apply(x);return!z.ok&&z.reason!==lt.hostCapabilityUnavailable?{success:!1,reason:"not-reachable"}:(Gj(p),{success:!0})}},Om=qo(bo(u=>u.fonts)),tU={get:Om.get,getSnapshot:Om.getSnapshot,subscribe:Om.subscribe,observe:Om.observe,getFamilyOptions:()=>P.fonts.options,getSizeOptions:()=>P.fonts.sizeOptions},Fm=qo(bo(u=>u.zoom)),nU={get:Fm.get,getSnapshot:Fm.getSnapshot,subscribe:Fm.subscribe,observe:Fm.observe,set:u=>{if(typeof t?.setZoom=="function")try{t.setZoom(u),Dt()}catch{}},setMode:u=>{if(typeof t?.setZoomMode=="function")try{t.setZoomMode(u),Dt()}catch{}}},Nm=qo(bo(u=>u.document)),rU={get:Nm.get,getSnapshot:Nm.getSnapshot,subscribe:Nm.subscribe,observe:Nm.observe,setMode:u=>{if(typeof t?.setDocumentMode=="function")try{t.setDocumentMode(u),Dt()}catch{}},export:u=>{if(typeof t?.export=="function")try{return Promise.resolve(t.export(u))}catch{return}},getText:()=>{const u=b(),p=Lt(u?.getText?()=>u.getText({}):void 0,null);return typeof p=="string"?p:p&&typeof p=="object"&&typeof p.text=="string"?p.text:null},replaceFile:u=>{const p=t?.replaceFile??t?.loadDocument??t?.reload;if(typeof p=="function")try{return Promise.resolve(p.call(t,u))}catch{return}}},HA=()=>{if(typeof HTMLElement>"u")return null;const u=_()?.mount?.container;if(u instanceof HTMLElement)return u;const p=t?.element;return p instanceof HTMLElement?p:null},oU=(u,p)=>{if(typeof u!="number"||typeof p!="number"||!Number.isFinite(u)||!Number.isFinite(p))return[];const y=globalThis.document;if(!y||typeof y.elementFromPoint!="function")return[];const A=HA();if(!A)return[];const x=y.elementFromPoint(u,p);if(!x||!A.contains(x))return[];const z=[x],W=ot=>{ot&&A.contains(ot)&&!z.includes(ot)&&z.push(ot)},re=y.elementsFromPoint;if(typeof re=="function"){let ot=[];try{ot=re.call(y,u,p)??[]}catch{ot=[]}for(const Bt of ot)W(Bt)}const fe=[],Me=ot=>{ot&&A.contains(ot)&&!fe.includes(ot)&&!z.includes(ot)&&fe.push(ot)},Ue=ot=>{const Bt=ot.getBoundingClientRect;if(typeof Bt!="function")return!1;let zt;try{zt=Bt.call(ot)}catch{return!1}return zt!=null&&u>=zt.left&&u<=zt.right&&p>=zt.top&&p<=zt.bottom};for(const ot of z){const Bt=ot.querySelectorAll;if(typeof Bt!="function")continue;let zt;try{zt=Bt.call(ot,"[data-track-change-marker]")}catch{continue}for(let Gn=0;Gn<zt.length;Gn+=1)Ue(zt[Gn])&&Me(zt[Gn])}fe.reverse();const $e=[...fe,...z],qe=lA($e[0],A);for(let ot=1;ot<$e.length;ot+=1)for(const Bt of lA($e[ot],A))qe.push(Bt);if(qe.length===0)return qe;const Ze=fs.get().items,Ge=Os(Ze);let et;const ht=new Set,dt=[];for(const ot of qe){if(ot.type!=="trackedChange"){const Wn=`${ot.type}:${ot.id}`;if(ht.has(Wn))continue;ht.add(Wn),dt.push(ot);continue}const Bt=lV(ot.storyKey)??aV(ot.story);let zt;if(Bt){if(et===void 0&&(et=si()),!et||(zt=dc(et,Bt).toPublicId(ot.id),!zt||!et.some(Wn=>Di(Wn,zt,Bt))))continue}else if(zt=Ge.toPublicId(ot.id),!zt)continue;const Gn=`trackedChange:${zt}`;ht.has(Gn)||(ht.add(Gn),dt.push(Bt?{type:"trackedChange",id:zt,story:Bt}:{type:"trackedChange",id:zt}))}return dt};function k2(u,p){return typeof u=="object"?oU(u?.x,u?.y):null}const Xu=new Set;let S2=!1;const $A=u=>{const p=M();if(typeof p?.observeGeometry!="function")return;let y=!1;const A=Lt(()=>{const x=p.observeGeometry(()=>u.schedule());return y=!0,x},null);u.detach=typeof A=="function"?A:null,u.boundHost=y?p:null},Bm=u=>{if(u.detach){try{u.detach()}catch{}u.detach=null}u.boundHost=null},GA=()=>{if(S2=!1,!(U||M()))for(const u of Xu)Bm(u)},iU=()=>{if(!S2){if(S2=!0,typeof queueMicrotask=="function"){queueMicrotask(GA);return}Promise.resolve().then(GA)}},sU=()=>{const u=M();if(!u){iU();return}for(const p of Xu)p.boundHost&&p.boundHost===u||(Bm(p),$A(p),p.schedule())};Ai.push(sU);const zm={getRect:u=>{const p=M(),y=p?.getTargetRects;if(typeof y=="function"){const A=Lt(()=>y.call(p,{target:u.target}),null);return A&&typeof A=="object"?A.success===!0&&Array.isArray(A.rects)?MV(LV(A.rects.filter(x=>x!=null&&typeof x=="object")),u.relativeTo):ml(typeof A.reason=="string"?A.reason:"unresolved"):ml("unresolved")}return ml("unavailable")},observe:u=>{const p=[];let y=0;const A=typeof requestAnimationFrame=="function",x=()=>{if(!A){u();return}y||(y=requestAnimationFrame(()=>{y=0,u()}))},z=jo(re=>({ready:re.ready,selection:re.selection,zoom:re.zoom}));p.push(z.subscribe(()=>x()));const W={schedule:x,detach:null,boundHost:null};return $A(W),Xu.add(W),()=>{Xu.delete(W),Bm(W),y&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(y);for(const re of p.splice(0))try{re()}catch{}}},getHost:()=>HA(),entityAt:k2,contextAt:u=>{const p=!!u&&typeof u.x=="number"&&typeof u.y=="number",y=p?u.x:0,A=p?u.y:0;return{point:{x:y,y:A},entities:p?k2({x:y,y:A}):[],selection:P.selection,position:null,insideSelection:!1}},scrollIntoView:async u=>{const p=u?.target;if(!p)return{success:!1};let y=null;if(p.kind==="entity"){const A=p.entityType==="comment"?"comments":"trackChanges",x=A==="comments"?Yu.get().items:fs.get().items,z=p.entityType==="trackedChange"&&p.story?{story:p.story}:void 0;y=await Lm(A,p.entityId,x,z)}else{const A=p,x=p,z=Array.isArray(A.segments)&&A.segments.length>0?A.segments:x.blockId&&x.range?[{blockId:x.blockId,range:x.range}]:null;if(z){const W=p.story;y={kind:"text",segments:z,...W?{story:W}:{}}}}return y?{success:(await qu(y,{block:u.block??"center",behavior:u.behavior??"smooth"})).ok}:{success:!1}}},WA=u=>{const p=(u&&typeof u=="object"?u:null)?.target;return p&&typeof p=="object"?p:null},KA=u=>`metadata:resolve:${u}`,aU=u=>{const p=b()?.metadata;if(!p||typeof p.resolve!="function")return null;const{value:y}=Tr(KA(u),on(),()=>p.resolve({id:u}),WA);return y},lU=async u=>{const p=b()?.metadata;if(!p||typeof p.resolve!="function")return null;try{const y=on(),A=await Promise.resolve(p.resolve({id:u}));if(y!==on())return null;const x=WA(A);return Q.set(KA(u),{token:y,value:x,hasSettled:!0,inflightToken:null}),x}catch{return null}},cU={getRect:u=>{const p=b()?.metadata;if(!p||typeof p.resolve!="function")return ml("unavailable");const y=aU(u.id);return y?zm.getRect({target:y}):ml("unresolved")},scrollIntoView:async u=>{const p=await lU(u.id);return p?{success:(await qu(p,{block:u.block,behavior:u.behavior})).ok}:{success:!1}}},uU={inTable:!1,tableNodeId:null,rowIndex:null,columnIndex:null,cellNodeId:null,rows:null,columns:null},dU={getContext:()=>{const u=ke();if(!u)return{...uU};const p=ve()?.table;return{inTable:!0,tableNodeId:u.tableNodeId,rowIndex:u.rowIndex,columnIndex:u.columnIndex,cellNodeId:u.cellNodeId,rows:typeof p?.rows=="number"?p.rows:null,columns:typeof p?.columns=="number"?p.columns:null}},isInTable:()=>ke()!=null},Vm={query:"",total:0,activeIndex:-1,open:!1,available:!1,caseSensitive:!1,includeDeletedText:!1,regex:!1,canReplace:!1,reason:lt.searchUnavailable};let Nn={...Vm};const jm=new Set,Na=()=>{const u=M()?.search;return u&&typeof u=="object"?u:null},Ws=()=>{const u=se()?.search;return u&&typeof u=="object"?u:null},Qf=()=>{const u=Na();if(u&&typeof u.setSession=="function")return!0;const p=Ws();return!!p&&typeof p.query=="function"&&typeof p.getState=="function"},hs=()=>{for(const u of[...jm])try{u(Nn)}catch{}},fi=u=>(Nn={...Nn,...u},hs(),Nn);let ao=0,Ic=null;const qA=()=>{const u=Ic;Ic=null,u&&Lt(()=>(u(),null),null)},fU=()=>{ao+=1,qA();const u=Qf();Nn={...Vm,available:u,reason:u?void 0:lt.searchUnavailable},hs()};Tt.push(fU);const hU=u=>{if(!u)return!1;const p=u.queryError;if(p&&typeof p=="object"&&p.code==="invalid-pattern")return!0;const y=u.rejection;return u.status==="rejected"&&!!y&&typeof y=="object"&&y.code==="invalid-pattern"},_2=(u,p=!1)=>{const y=u&&typeof u=="object"?u:null;if(!y)return null;const A=Array.isArray(y.matches)?y.matches:[],x=typeof y.total=="number"&&Number.isFinite(y.total)?y.total:A.length,z=typeof y.activeMatchIndex=="number"?y.activeMatchIndex:typeof y.activeIndex=="number"?y.activeIndex:-1;return{...typeof y.query=="string"?{query:y.query}:{},total:x,activeIndex:z,canReplace:y.canReplace===!0||p,...y.includeDeletedText===!0?{includeDeletedText:!0}:{},...y.regex===!0?{regex:!0}:{},...hU(y)?{invalidPattern:!0}:{}}},Ro=()=>{const u=pe("find.replace"),p=pe("find.replaceAll");return u?.enabled===!0||p?.enabled===!0},Lo=(u,p=!1)=>{const y=_2(u,p);if(!y){fi({total:0,activeIndex:-1,canReplace:!1,reason:void 0});return}fi({...y.query!==void 0?{query:y.query}:{},total:y.total,activeIndex:y.activeIndex,canReplace:y.canReplace,...y.includeDeletedText!==void 0?{includeDeletedText:y.includeDeletedText}:{},...y.regex!==void 0?{regex:y.regex}:{},reason:y.invalidPattern?lt.searchInvalidPattern:void 0})},Ba=()=>{const u=Na();if(u&&typeof u.getState!="function")return Nn={...Nn,available:Qf(),reason:Qf()?void 0:lt.searchUnavailable},Nn;if(!u){const y=Ws();if(y&&typeof y.getState=="function"){const A=_2(Lt(()=>y.getState(),null),Ro());if(A)return Nn={...Nn,...A.query!==void 0?{query:A.query}:{},total:A.total,activeIndex:A.activeIndex,canReplace:A.canReplace,available:!0,reason:A.invalidPattern?lt.searchInvalidPattern:void 0,open:Nn.open||!!A.query},Nn}return Nn={...Vm,query:Nn.query,caseSensitive:Nn.caseSensitive,includeDeletedText:Nn.includeDeletedText},Nn}const p=_2(Lt(()=>u.getState(),null));return p&&(Nn={...Nn,...p.query!==void 0?{query:p.query}:{},total:p.total,activeIndex:p.activeIndex,canReplace:p.canReplace,...p.includeDeletedText!==void 0?{includeDeletedText:p.includeDeletedText}:{},...p.regex!==void 0?{regex:p.regex}:{},available:!0,reason:p.invalidPattern?lt.searchInvalidPattern:void 0,open:Nn.open||!!p.query}),Nn},Zu=u=>{const p=u&&typeof u=="object"?u:null;if(p?.status==="committed")return{ok:!0};if(p?.status==="rejected"&&p.reason==="read-only")return{ok:!1,reason:lt.documentReadonly};const y=p?.rejection;return p?.status==="rejected"&&y&&typeof y=="object"&&y.code==="read-only-document"?{ok:!1,reason:lt.documentReadonly}:{ok:!1,reason:lt.operationUnavailable}},Um=qo({get:()=>Ba(),subscribe:u=>(jm.add(u),()=>jm.delete(u))}),pU={get:Um.get,getSnapshot:Um.getSnapshot,subscribe:Um.subscribe,observe:Um.observe,open:()=>Qf()?(fi({available:!0,open:!0,reason:void 0}),{ok:!0}):(fi({available:!1,open:!1,reason:lt.searchUnavailable}),{ok:!1,reason:lt.searchUnavailable}),close:()=>{if(ao+=1,Ic)qA();else{const u=Na();if(u&&typeof u.clear=="function")Lt(()=>u.clear(),null);else{const p=Ws();p&&typeof p.query=="function"&&Lt(()=>p.query({query:""}),null)}}Nn={...Vm,available:Qf(),reason:void 0},Nn.available||(Nn.reason=lt.searchUnavailable),hs()},search:(u,p)=>{const y=Na(),A=!!p?.caseSensitive,x=p?.includeDeletedText===!0,z=p?.regex===!0,W=++ao;if(!y||typeof y.setSession!="function"){const fe=Ws();if(fe&&typeof fe.query=="function"&&typeof fe.getState=="function"){fi({query:u,caseSensitive:A,includeDeletedText:x,regex:z,available:!0,open:!0,reason:void 0}),Ic=()=>{fe.query({query:""})};const Me=Lt(()=>fe.query({query:u,caseSensitive:A,includeDeletedText:x,regex:z}),null);return xr(Me)?Promise.resolve(Me).then(Ue=>{W===ao&&Lo(Ue,Ro())},()=>{W===ao&&fi({available:!1,reason:lt.searchUnavailable})}):Lo(Me,Ro()),Lo(Lt(()=>fe.getState(),null),Ro()),Nn}return fi({query:u,total:0,activeIndex:-1,available:!1,caseSensitive:A,includeDeletedText:x,regex:z,reason:lt.searchUnavailable})}fi({query:u,caseSensitive:A,includeDeletedText:x,regex:z,available:!0,open:!0,reason:void 0}),Ic=()=>{typeof y.clear=="function"&&y.clear()};const re=Lt(()=>y.setSession(u,{caseSensitive:A,includeDeletedText:x,...z?{regex:!0}:{},highlight:!0}),null);if(Lo(re),u.length>0&&Nn.total===0&&Nn.reason!==lt.searchInvalidPattern){const fe=Ws();if(fe&&typeof fe.query=="function"&&typeof fe.getState=="function"){const Me=Ic;Ic=()=>{Me?.(),fe.query({query:""})};const Ue=Lt(()=>fe.query({query:u,caseSensitive:A,includeDeletedText:x,regex:z}),null);xr(Ue)?Promise.resolve(Ue).then($e=>{W===ao&&Lo($e,Ro())},()=>{W===ao&&fi({available:!1,reason:lt.searchUnavailable})}):Lo(Ue,Ro()),Lo(Lt(()=>fe.getState(),null),Ro())}}return Nn},next:()=>{const u=Na();if(!u||typeof u.next!="function"){const p=Ws();if(!p||typeof p.next!="function"||typeof p.getState!="function")return{ok:!1,reason:lt.searchUnavailable};if(Nn.total===0)return{ok:!1,reason:lt.operationUnavailable};const y=Lt(()=>p.next(),null);if(xr(y)){const A=ao;Promise.resolve(y).then(x=>{A===ao&&Lo(x,Ro())}).catch(()=>{A===ao&&fi({available:!1,reason:lt.searchUnavailable})})}else Lo(y,Ro());return Lo(Lt(()=>p.getState(),null),Ro()),{ok:!0}}return Nn.total===0?{ok:!1,reason:lt.operationUnavailable}:(Lo(Lt(()=>u.next(),null)),{ok:!0})},previous:()=>{const u=Na();if(!u||typeof u.previous!="function"){const p=Ws();if(!p||typeof p.previous!="function"||typeof p.getState!="function")return{ok:!1,reason:lt.searchUnavailable};if(Nn.total===0)return{ok:!1,reason:lt.operationUnavailable};const y=Lt(()=>p.previous(),null);if(xr(y)){const A=ao;Promise.resolve(y).then(x=>{A===ao&&Lo(x,Ro())}).catch(()=>{A===ao&&fi({available:!1,reason:lt.searchUnavailable})})}else Lo(y,Ro());return Lo(Lt(()=>p.getState(),null),Ro()),{ok:!0}}return Nn.total===0?{ok:!1,reason:lt.operationUnavailable}:(Lo(Lt(()=>u.previous(),null)),{ok:!0})},clear:()=>{ao+=1;const u=Na();if(u&&typeof u.clear=="function"&&Lt(()=>u.clear(),null),!u||typeof u.clear!="function"){const p=Ws();p&&typeof p.query=="function"&&Lt(()=>p.query({query:""}),null)}fi({query:"",total:0,activeIndex:-1,canReplace:!1})},replace:u=>{const p=Na();if(!p){const A=Ws();if(!A||typeof A.replace!="function"||typeof A.getState!="function")return{ok:!1,reason:lt.searchUnavailable};if(!Ro())return{ok:!1,reason:lt.operationUnavailable};const x=Lt(()=>A.replace({replacement:typeof u=="string"?u:""}),null);if(xr(x)){const z=ao;Ba(),hs();const W=()=>z===ao;return Promise.resolve(x).then(re=>(W()&&(Lo(re,Ro()),Ba(),hs()),Zu(re)),()=>(W()&&fi({available:!1,reason:lt.searchUnavailable}),{ok:!1,reason:lt.searchUnavailable}))}return Ba(),hs(),Zu(x)}if(typeof p.replaceCurrent!="function")return{ok:!1,reason:lt.operationUnavailable};const y=Lt(()=>p.replaceCurrent(typeof u=="string"?u:""),null);return Ba(),hs(),Zu(y)},replaceAll:u=>{const p=Na();if(!p){const A=Ws();if(!A||typeof A.replaceAll!="function"||typeof A.getState!="function")return{ok:!1,reason:lt.searchUnavailable};if(!Ro())return{ok:!1,reason:lt.operationUnavailable};const x=Lt(()=>A.replaceAll({replacement:typeof u=="string"?u:""}),null);if(xr(x)){const z=ao;Ba(),hs();const W=()=>z===ao;return Promise.resolve(x).then(re=>(W()&&(Lo(re,Ro()),Ba(),hs()),Zu(re)),()=>(W()&&fi({available:!1,reason:lt.searchUnavailable}),{ok:!1,reason:lt.searchUnavailable}))}return Ba(),hs(),Zu(x)}if(typeof p.replaceAll!="function")return{ok:!1,reason:lt.operationUnavailable};const y=Lt(()=>p.replaceAll(typeof u=="string"?u:""),null);return Ba(),hs(),Zu(y)}},YA=bo(u=>u.styles),Hm=qo(YA),mU={get:Hm.get,getSnapshot:Hm.getSnapshot,subscribe:Hm.subscribe,observe:Hm.observe,getCatalog:u=>mn(u).value,getQuickGallery:()=>YA.get().quickGallery,getActiveParagraphStyle:()=>Xr(P.selection,ar().cache).style},XA={select:jo,get state(){return P},selection:FA,commands:Wj,toolbar:Kj,comments:Yj,trackChanges:Qj,contentControls:eU,fonts:tU,zoom:nU,document:rU,viewport:zm,metadata:cU,tables:dU,search:pU,styles:mU,formatPainter:{setPointerSelecting(u){U||(h={...h,pointerSelecting:u})},notifyPointerUp(){U||(h={...h,pointerSelecting:!1},MA())},setKeyboardSelecting(u){U||(h={...h,keyboardSelecting:u})},notifyKeyUp(){U||(h={...h,keyboardSelecting:!1},MA())},cancel(){U||xm()},onModeChange(u){return U?()=>{}:(m.add(u),()=>m.delete(u))}},createScope:()=>{const u=[];return{select:(p,y)=>{const A=jo(p,y);return{get:A.get,subscribe:x=>{const z=A.subscribe(x);return u.push(z),z}}},dispose:()=>{for(const p of u.splice(0))p()}}},destroy:()=>{if(!U){U=!0,Zz(Pt,It),Je&&(clearTimeout(Je),Je=null),he&&(clearTimeout(he),he=null,Pe=0),me?.timer&&(clearTimeout(me.timer),me.timer=null),me=null,ut&&(clearTimeout(ut),ut=null),vo&&(clearTimeout(vo),vo=null),Kr&&Kr(),Kr=null,Wr=null,$r=0,xo=0,jn.clear(),sr.clear(),Yt.clear(),Rn=null,Z.clear();for(const u of Zr.splice(0))u();kr&&kr(),kr=null,dn=null,Hi&&Hi(),Hi=null,us=null,Ko&&Ko(),Ko=null,yo=null,Vo&&Vo(),Vo=null,ci=null,ui&&ui(),ui=null,Gi=null,G&&G(),G=null,F=null;for(const u of Xu)Bm(u);Xu.clear(),O.clear(),jm.clear(),g+=1,m.clear(),ao+=1,oe.clear()}}};return $=XA,XA}var VV=[{value:"Arial",label:"Arial",previewFamily:"Arial, sans-serif"},{value:"Calibri",label:"Calibri",previewFamily:"Calibri, sans-serif"},{value:"Courier New",label:"Courier New",previewFamily:'"Courier New", monospace'},{value:"Georgia",label:"Georgia",previewFamily:"Georgia, serif"},{value:"Times New Roman",label:"Times New Roman",previewFamily:'"Times New Roman", serif'},{value:"Verdana",label:"Verdana",previewFamily:"Verdana, sans-serif"}];function jV(e){const t=e.trim(),n=t[0];if(n==='"'||n==="'"){const o=t.indexOf(n,1);if(o>0)return t.slice(1,o).trim()}const r=t.indexOf(",");return(r===-1?t:t.slice(0,r)).trim().replace(/^["']|["']$/g,"")}function UV(e){if(!Array.isArray(e))return[];const t=[];for(const n of e){if(!n||typeof n!="object")continue;const r=n,o=typeof r.logicalFamily=="string"?jV(r.logicalFamily):"";if(!o)continue;const i=typeof r.previewFamily=="string"&&r.previewFamily.trim()?r.previewFamily.trim():o;t.push({value:o,label:o,previewFamily:i})}return t}function HV(e){if(!Array.isArray(e))return[];const t=[];for(const n of e){if(!n||typeof n!="object")continue;const r=n,o=typeof r.value=="string"?r.value.trim():"";if(!o)continue;const i=typeof r.label=="string"&&r.label.trim()?r.label.trim():o,s=typeof r.previewFamily=="string"&&r.previewFamily.trim()?r.previewFamily.trim():o;t.push({value:o,label:i,previewFamily:s})}return t}function $V(e,t=[]){const n=[],r=new Set,o=s=>{const a=String(s.value).trim().toLowerCase();!a||r.has(a)||(r.add(a),n.push(s))};for(const s of e)o(s);const i=t.length?t:VV;for(const s of i)o(s);return n}var GV=[{value:"8",label:"8"},{value:"9",label:"9"},{value:"10",label:"10"},{value:"11",label:"11"},{value:"12",label:"12"},{value:"14",label:"14"},{value:"16",label:"16"},{value:"18",label:"18"},{value:"24",label:"24"},{value:"36",label:"36"}];function WV(e,t){return e.activeMark?t.activeMarks.includes(e.activeMark):!1}xt();var KV=['[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(", "),qV=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"]);async function YV(e,t){const n=new m6.default;return e.forEach((r,o)=>{n.file(t[o],r)}),n.generateAsync({type:"blob",compression:"DEFLATE"})}function f2(e){return!!(e&&(e.synced===!0||e.isSynced===!0))}function _A(e){try{e.synced=!0}catch{}try{e.isSynced=!0}catch{}}function XV(e,t){if(!e)return()=>{};if(f2(e))return t(),()=>{};const n=typeof e.on=="function"?e.on.bind(e):null,r=typeof e.off=="function"?e.off.bind(e):null;if(!n)return t(),()=>{};let o=!1;const i=()=>{o||(o=!0,r?.("synced",a),r?.("sync",l))},s=()=>{o||(i(),t())},a=()=>{_A(e),s()},l=c=>{c!==!1&&(c===!0||f2(e))&&(_A(e),s())};return n("synced",a),n("sync",l),f2(e)&&s(),i}function ZV(e,t){const n=e.composedPath();if(!n.includes(t))return null;const r=n.find(a=>a instanceof HTMLElement&&a.matches(KV));if(!r)return null;const o=n.some(a=>a instanceof HTMLElement&&a.classList.contains(Qh.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 QV(e){if(!e||typeof e!="object")return[];const t=e.items;return Array.isArray(t)?t:[]}function JV(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 ni(e){return!!(e&&typeof e=="object"&&e.editorVersion===2)}function ej(e){const t=e&&typeof e=="object"?e.code:null;return t==="comment-export-missing-story-reference"||t==="v2-worker-comment-export-mode-unsupported"}function AA(e){return typeof e=="string"&&e.length>0?e:null}function IA(e){return e?ni(e)?AA(e.documentId??e.options?.documentId??null):AA(typeof e.getDocumentId=="function"?e.getDocumentId():e.options?.documentId):null}function tj(e){if(!e||ni(e))return null;const t=e;return t.documentRenderer??t.presentationEditor??null}function is(e){if(!e)return null;if(ni(e))return e.fonts??null;const t=tj(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 vm=class extends Gm.default{static{this.allowedTypes=[Nr,Xl,qh]}#e;#n;#t;#r;#i;#s;#d;#h;#f;#c;#p;get uiConfig(){return this.#p}#o;get interactionConfig(){return this.#o}#l;get surfacesConfig(){return this.#l}#g;#u;#y;#w;constructor(e){if(super(),this.#e=!1,this.#n=!1,this.#t=null,this.#r=null,this.#i=null,this.#s=null,this.#d=null,this.#h=null,this.#f=n=>{this.#k(n)},this.#c=null,this.#p=N4({}),this.#o=B4({}),this.#l=V4({}),this.version="0.0.0",this.users=[],this.whiteboard=null,this.colors=[],this.readyEditors=0,this.pendingCollaborationSaves=0,this.#u=new KF,this.#y=null,this.#w=!1,this.config={selector:"#superdoc",documentMode:"editing",allowSelectionInViewMode:!1,role:"editor",document:{},documents:[],editorExtensions:[],colors:[],users:[],user:{...W0},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.#Z=new WeakSet,this.#Q=null,this.#j=null,this.#L=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.#g=new OF({getModuleConfig:()=>this.#l}),this.#h=t,t.addEventListener("click",this.#f,!0),this.#I(e,t)}async#k(e){const t=this.#h;if(!t)return;const n=ZV(e,t),r=this.activeEditor?.doc?.contentControls?.list;if(!(!n||typeof r!="function"))try{const o=await r();if(this.#e)return;const i=JV(QV(o).find(s=>s.id===n));i&&this.emit("content-control:click",{target:i,source:"pointer"})}catch{return}}async#I(e,t){this.config={...this.config,...e},!this.config.comments||typeof this.config.comments!="object"?this.config.comments={visible:!1}:typeof this.config.comments.visible!="boolean"&&(this.config.comments.visible=!1),UF(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&&this.config.useLayoutEngine&&!r&&(console.warn("[SuperDoc] Web layout uses PM fallback unless layoutEngineOptions.flowMode is set to 'semantic'. Automatically disabling layout engine."),this.config.useLayoutEngine=!1),!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.#ye(),this.config.user=HF(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=Dk(this.config.modules.comments),this.#p=N4(this.config),this.#o=B4(this.config),this.#l=V4(this.config),this.config.disableContextMenu=!this.#p.contextMenu.enabled,this.config.rulers=this.#p.ruler.enabled,this.#p.comments.enabled?this.config.modules.comments===!1&&(this.config.modules.comments={}):this.config.modules.comments=!1,this.#p.comments.enabled){this.config.modules.comments===!0&&(this.config.modules.comments={});const i=this.config.modules.comments;i&&Object.assign(i,this.#o.comments)}if(this.config.colors=S6(this.config.colors),this.userColorMap=new Map,this.colorIndex=0,this.version="2.4.0-next.50",this.#C("🦋 [superdoc] Using SuperDoc version:",this.version),this.superdocId=e.superdocId||ps(),this.colors=this.config.colors??[],this.#D(),await mT(),this.#e)return;if(await this.#b(this.config.modules),this.#e){this.#ue();return}this.config.cspNonce&&this.#P(),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.#y||(this.#y=this.#u.subscribe(i=>{this.#we(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.#d=o,this.#S(),this.#M(),this.#Ce(),this.#x()}#x(){if(this.#E(),this.readyEditors=0,!this.app)throw new Error("SuperDoc: #startRuntime called before #initVueApp populated this.app");this.app.mount(this.#d)}#M(){const e=this.config.modules?.whiteboard,t=e!==!1&&(e?.enabled??!1);this.whiteboard=new aD({Renderer:MF,superdoc:this,enabled:t}),this.emit("whiteboard:init",{whiteboard:this.whiteboard})}get requiredNumberOfEditors(){return this.#m("requiredNumberOfEditors").documents.filter(e=>e.type===Nr).length}get ui(){return this.#c||(this.#c=zV({superdoc:this}),this.#e&&this.#c.destroy()),this.#c}get state(){return{documents:this.#m("state").documents,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}#P(){const e=this.config.cspNonce,t=document.createElement;document.createElement=function(n){const r=t.call(this,n);return n.toLowerCase()==="style"&&r.setAttribute("nonce",e),r}}#D(){const e=this.config.document,t=!!e&&typeof e=="object"&&Object.keys(e)?.length,n=!!e&&typeof e=="string"&&e.length>0,r=!!e&&typeof File=="function"&&e instanceof File,o=!!e&&e instanceof Blob&&!(e instanceof File),i=this.config.documents&&this.config.documents?.length;if(t&&i&&console.warn("🦋 [superdoc] You can only provide one of document or documents"),t){const s=Gd(this.config.document);this.config.documents=[{id:ps(),...s}]}else if(n)this.config.documents=[{id:ps(),type:Nr,url:this.config.document,name:"document.docx"}];else if(r){const s=Gd(this.config.document);this.config.documents=[{id:ps(),...s}]}else if(o){const s=Gd(this.config.document);this.config.documents=[{id:ps(),...s}]}Array.isArray(this.config.documents)&&this.config.documents.length>0&&(this.config.documents=this.config.documents.map(s=>{const a=Gd(s);if(!a||typeof a!="object")return a;const l=typeof a=="object"&&"id"in a&&a.id||s&&typeof s=="object"&&"id"in s&&s.id;return{...a,id:l||ps()}}))}#E(){const{app:e,pinia:t,superdocStore:n,commentsStore:r,highContrastModeStore:o}=YP({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.#g),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&&eT(this),this.#ce()}#a(e,t){t&&this.on(e,t)}#S(){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:active-change",this.config.onContentControlActiveChange),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.on("collaboration-ready",e=>this.#$(e?.editor??null)),this.#a("editor-update",this.config.onEditorUpdate),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)}async#b({collaboration:e}={}){return e?(this.isCollaborative=!1,this.config.documents.length===0&&(this.config.documents=[{id:ps(),type:Nr,name:"document.docx"}]),this.config.v2CollaborationPreflightFailure={code:"collaboration-v1-config-unsupported",message:"SuperDoc v2 cannot use modules.collaboration because it is the SuperDoc v1 collaboration API. SuperDoc did not attach the provider or change the document. Configure Document.v2Collaboration with a v2 room instead."},this.config.documents):this.config.documents}#ee(e,t){this.isCollaborative=!0,this._commentsCollabInitialized=!1,this.ydoc=no(e),this.provider=no(t),this.#_();const n=this.config;this._cleanupAwareness=Y8(t,this,n.user),n.documents.forEach(r=>{r.ydoc=e,r.provider=t,r.role=this.config.role})}#H(){this.#s=null,this.#A(),typeof this._cleanupAwareness=="function"&&(this._cleanupAwareness(),this._cleanupAwareness=null),this.isCollaborative=!1,this._commentsCollabInitialized=!1,this.ydoc=void 0,this.provider=void 0;const e=this.config;delete e.modules.collaboration,e.documents.forEach(t=>{delete t.ydoc,delete t.provider})}#A(){if(this.#r){try{this.#r()}catch{}this.#r=null}if(this.#i){try{this.#i()}catch{}this.#i=null}}#$(e){this.#A(),ni(e)&&(this.#O(e),this.#T(e))}#O(e){const t=e.presence;if(!t||typeof t.subscribe!="function")return;const n=rD(()=>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.#r=t.subscribe(r)}catch(o){console.warn("[SuperDoc] v2 awareness bridge failed to subscribe",o)}}#T(e){const t=e.lock;if(!t||typeof t.subscribe!="function")return;const n=r=>{this.#e||this.#v(!!r.isLocked,this.#F(r.lockedBy??null))};try{if(this.#s&&typeof t.setLocked=="function"){const o=this.#s;t.setLocked(o.isLocked,o.isLocked?o.lockedBy:null),this.#s=null}const r=t.getSnapshot?.();r&&n(r),this.#i=t.subscribe(n)}catch(r){console.warn("[SuperDoc] v2 lock bridge failed to subscribe",r)}}#F(e){return!e||typeof e!="object"||Array.isArray(e)?null:{...e}}#G(e,t){return JSON.stringify(e??null)===JSON.stringify(t??null)}#v(e,t){this.isLocked===e&&this.#G(this.lockedBy,t)||(this.isLocked=e,this.lockedBy=t,this.#C("🦋 [superdoc] Locking superdoc:",e,t,`
|
|
102
|
+
`;xt();var Ds=e=>{e.expand.value=!1};function J0(e,t){const n={...e??{}};return t?n.href=t:delete n.href,n}function nA(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 Az(e){return typeof e?.quotedText=="string"?e.quotedText:typeof e?.text=="string"?e.text:""}function rA(e){return e.ui?.selection?.get?.()??e.ui?.selection?.current?.()??null}function Iz(e){return!!(e.config?.superdoc?.config?.modules?.ai||e.superdoc?.config?.modules?.ai)}function xz(e){return e.config?.superdoc?.config?.modules?.ai??e.superdoc?.config?.modules?.ai??{}}var Ez=({superToolbar:e,toolbarIcons:t,toolbarTexts:n,toolbarFonts:r,hideButtons:o,availableWidth:i,role:s,isDev:a=!1}={})=>{const l=In({type:"button",name:"bold",command:"toggleBold",icon:t.bold,tooltip:n.bold,attributes:{ariaLabel:"Bold"}}),c=(r??wB).map(xB),d=In({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:c,onActivate:({fontFamily:Qe}={},Pt=!1)=>{if(Pt){d.label.value="",d.selectedValue.value="";return}if(!Qe)return;Qe=Qe.split(",")[0],d.label.value=Qe;const It=c.find(tn=>tn.label===d.defaultLabel.value),Sn=c.find(tn=>tn.label===Qe);Sn?d.selectedValue.value=Sn.key:It?d.selectedValue.value=It.key:d.selectedValue.value=""},onDeactivate:()=>{d.label.value=d.defaultLabel.value;const Qe=c.find(Pt=>Pt.label===d.defaultLabel.value);Qe?d.selectedValue.value=Qe.key:d.selectedValue.value=""}}),f=In({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:()=>h(f)}]});function h(Qe){const Pt=rA(e),It=Pt?.selectionTarget??nA(Pt?.target),Sn=Pt?.empty?"":Az(Pt),tn=xz(e),hn=()=>Ds(Qe),Vn=()=>{const pr=e.pendingSelectionCapture;pr&&typeof e.ui?.selection?.restore=="function"&&e.ui.selection.restore(pr)};return Vr("div",{},[Vr(ez,{handleClose:hn,selectedText:Sn,target:It,doc:e.superdoc?.activeEditor?.doc??null,apiKey:tn?.apiKey||e.config?.aiApiKey||"",endpoint:tn?.endpoint||e.config?.aiEndpoint||"",restoreSelection:Vn})])}const g=kB,m=In({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:g,onActivate:({fontSize:Qe},Pt=!1)=>{if(Pt){m.label.value="",m.selectedValue.value="";return}const It=g.find(Vn=>Vn.label===String(m.defaultLabel.value));if(!Qe){m.label.value=m.defaultLabel.value,It?m.selectedValue.value=It.key:m.selectedValue.value="";return}let Sn=fN(Qe,12);Sn<8&&(Sn=8),Sn>96&&(Sn=96);let tn=String(Sn);const hn=g.find(Vn=>Vn.label===tn||Vn.key===tn);hn?m.selectedValue.value=hn.key:m.selectedValue.value="",m.label.value=tn},onDeactivate:()=>{m.label.value=m.defaultLabel.value;const Qe=g.find(Pt=>Pt.label===String(m.defaultLabel.value));Qe?m.selectedValue.value=Qe.key:m.selectedValue.value=""}}),v=In({type:"separator",name:"separator",isNarrow:!0}),k=In({type:"button",name:"italic",command:"toggleItalic",icon:t.italic,active:!1,tooltip:n.italic,attributes:{ariaLabel:"Italic"}}),C=In({type:"button",name:"underline",command:"toggleUnderline",icon:t.underline,active:!1,tooltip:n.underline,attributes:{ariaLabel:"Underline"}}),_=In({type:"button",name:"strike",command:"toggleStrike",icon:t.strikethrough,active:!1,tooltip:n.strikethrough,attributes:{ariaLabel:"Strikethrough"}}),b=In({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:()=>Q0(e,b,[],!0)}],onActivate:({color:Qe})=>{b.iconColor.value=Qe||""},onDeactivate:()=>b.iconColor.value=""}),w=In({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:()=>Q0(e,w)}],onActivate:({color:Qe})=>{w.iconColor.value=Qe},onDeactivate:()=>w.iconColor.value="#000"}),T=In({type:"button",name:"search",allowWithoutEditor:!0,active:!1,icon:t.search,tooltip:n.search,group:"right",attributes:{ariaLabel:"Search"}}),L=In({type:"dropdown",name:"link",markName:"link",icon:t.link,active:!1,tooltip:n.link,attributes:{ariaLabel:"Link dropdown"},options:[{type:"render",key:"linkDropdown",render:()=>N(L)}],onActivate:({href:Qe})=>{L.attributes.value=J0(L.attributes.value,Qe)},onDeactivate:()=>{L.attributes.value=J0(L.attributes.value,null),L.expand.value=!1}});function N(Qe){const Pt=rA(e),It=Pt?.selectionTarget??nA(Pt?.target),Sn=()=>{const tn=e.pendingSelectionCapture;tn&&typeof e.ui?.selection?.restore=="function"&&e.ui.selection.restore(tn)};return Vr("div",{},[Vr(xS,{ui:e.ui,linkItem:Qe,textTarget:It,restoreSelection:Sn,closePopover:()=>{Ds(Qe),Su(e)},goToAnchor:()=>{Ds(Qe);const tn=Qe.attributes.value?.href;if(!tn)return;const hn=tn.slice(1),Vn=(e.ui?.viewport?.getHost?.()??null)?.querySelector?.(`a[name='${hn}']`);Vn&&lf(Vn)}})])}const H=In({type:"options",name:"linkInput",command:"toggleLink",active:!1});L.childItem=H,H.parentItem=L;const M=In({type:"button",name:"image",command:"startImageUpload",icon:t.image,active:!1,tooltip:n.image,disabled:!1,attributes:{ariaLabel:"Image"}}),V=In({type:"button",name:"tableOfContents",command:"insertTableOfContents",icon:t.tableOfContents,active:!1,tooltip:n.tableOfContents,disabled:!1,attributes:{ariaLabel:"Table of contents"}}),q=In({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:()=>D(q)}]});function D(Qe){return Vr("div",{},[Vr(gz,{onSelect:It=>{e.emitCommand({item:Qe,argument:It}),Ds(Qe),Su(e)}})])}const B=In({type:"dropdown",name:"tableActions",command:"executeTableCommand",tooltip:n.tableActions,icon:t.tableActions,hideLabel:!0,disabled:!0,attributes:{ariaLabel:"Table actions"},options:[{type:"render",render:()=>j(B)}]}),E=[{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 j(Qe){return Vr(Sz,{options:E,onSelect:Pt=>{Ds(Qe);const{command:It}=Pt;e.emitCommand({item:Qe,argument:{command:It}})}})}const J=In({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:()=>Vr("div",{},[Vr(RB,{onSelect:Pt=>{Ds(J);const It={...J,command:"setTextAlign"};It.command="setTextAlign",e.emitCommand({item:It,argument:Pt}),Y(J,Pt),Su(e)}})]),key:"alignment"}],onActivate:({textAlign:Qe})=>{Y(J,Qe)},onDeactivate:()=>{Y(J,"left")}}),Y=(Qe,Pt)=>{let It=Pt==="both"?"justify":Pt,Sn={left:t.alignLeft,right:t.alignRight,center:t.alignCenter,justify:t.alignJustify},tn=Sn[It]??Sn.left;Qe.icon.value=tn},se=In({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 Qe=Pt=>{Ds(se);const It={...se,command:"toggleBulletListStyle"};e.emitCommand({item:It,argument:Pt})};return Vr(eA,{buttons:PB,iconSize:25,selectedStyle:se.selectedValue.value,onSelect:Qe})}}]}),pe=In({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 Qe=Pt=>{Ds(pe);const It={...pe,command:"toggleOrderedListStyle"};e.emitCommand({item:It,argument:Pt})};return Vr(eA,{buttons:DB,iconSize:30,selectedStyle:pe.selectedValue.value,onSelect:Qe})}}]}),Ve=In({type:"button",name:"indentleft",command:"decreaseTextIndent",icon:t.indentLeft,active:!1,tooltip:n.indentLeft,disabled:!1,attributes:{ariaLabel:"Left indent"}}),ge=In({type:"button",name:"indentright",command:"increaseTextIndent",icon:t.indentRight,active:!1,tooltip:n.indentRight,disabled:!1,attributes:{ariaLabel:"Right indent"}}),be=In({type:"overflow",name:"overflow",command:null,icon:t.overflow,active:!1,disabled:!1,attributes:{ariaLabel:"Overflow items"}}),ve=In({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:Qe})=>{Qe&&(ve.label.value=Qe)}}),ke=In({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:Qe})=>{Qe&&(ke.label.value=Qe)}}),oe=In({type:"button",name:"undo",disabled:!0,tooltip:n.undo,command:"undo",icon:t.undo,group:"left",attributes:{ariaLabel:"Undo"}}),Re=In({type:"button",disabled:!0,name:"redo",tooltip:n.redo,command:"redo",icon:t.redo,group:"left",attributes:{ariaLabel:"Redo"}}),je=In({type:"button",disabled:!1,name:"acceptTrackedChangeBySelection",tooltip:n.trackChangesAccept,command:"acceptTrackedChangeFromToolbar",icon:t.trackChangesAccept,group:"left",attributes:{ariaLabel:"Accept tracked changes"}}),tt=In({type:"button",disabled:!1,name:"rejectTrackedChangeOnSelection",tooltip:n.trackChangesReject,command:"rejectTrackedChangeFromToolbar",icon:t.trackChangesReject,group:"left",attributes:{ariaLabel:"Reject tracked changes"}}),wt=In({type:"button",name:"clearFormatting",command:"clearFormat",tooltip:n.clearFormatting,icon:t.clearFormatting,attributes:{ariaLabel:"Clear formatting"}}),Te=In({type:"button",name:"copyFormat",tooltip:n.copyFormat,icon:t.copyFormat,command:"copyFormat",active:!1,attributes:{ariaLabel:"Copy formatting"}}),We=(Qe,Pt)=>Qe==="editor"?Pt:Qe==="suggester"?Pt.filter(It=>It.value==="suggesting"):Pt.filter(It=>It.value==="viewing"),Ye=Qe=>Qe==="editor"?"Editing":Qe==="suggester"?"Suggesting":"Viewing",ee=In({type:"dropdown",name:"documentMode",command:"setDocumentMode",allowWithoutEditor:!0,icon:t.documentMode,defaultLabel:Ye(s),label:Ye(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:()=>ne(ee)}]}),S=[{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 ne(Qe){const Pt=We(s,S);return Vr(UB,{options:Pt,onSelect:It=>{const Sn=e.superdoc?.activeEditor??e.activeEditor;Ds(Qe);const{label:tn,icon:hn,value:Vn}=It;ee.label.value=tn,ee.icon.value=hn,e.emitCommand({item:ee,argument:Vn}),Su(e,Sn)}})}const O=new Map([["separator",20],["zoom",71],["measurementUnit",52],["fontFamily",118],["fontSize",57],["textAlign",40],["linkedStyles",142],["documentMode",47],["default",32]]),P=["search","ruler","undo","overflow","documentMode"],U=In({type:"button",name:"ruler",command:"toggleRuler",allowWithoutEditor:!0,icon:t.ruler,active:!1,tooltip:n.ruler,attributes:{ariaLabel:"Ruler"}}),$=In({type:"button",name:"formattingMarks",command:"toggleFormattingMarks",allowWithoutEditor:!0,icon:t.formattingMarks,active:!1,tooltip:n.formattingMarks,attributes:{ariaLabel:"Formatting marks"}}),Q=In({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 Qe=It=>{Ds(Q);const Sn=typeof It=="string"?It:It?.id??null;if(!Sn)return;const tn={...Q,command:"setLinkedStyle"};e.emitCommand({item:tn,argument:Sn})},Pt=e.getActiveLinkedStyleId?.()??null;return Vr("div",{},[Vr(WB,{styles:e.getLinkedStyleOptions?.()??[],onSelect:Qe,selectedOption:Pt})])}}],onActivate:({styleId:Qe,styleName:Pt})=>{const It=Pt||Qe;Q.label.value=Qe&&Qe!=="Normal"?String(It):n.formatText,Q.disabled.value=!1},onDeactivate:()=>{Q.disabled.value=!0,Q.label.value=n.formatText}}),Z=(Qe,Pt)=>{if(Pt.value==Qe)return Vr("div",{innerHTML:_z,class:"dropdown-select-icon"})},K=In({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(Qe=>({label:Qe.toFixed(2),key:Qe,icon:()=>Z(Qe,K.selectedValue),props:{"data-item":"btn-lineHeight-option"}}))}),me=20,xe=32,he=P.reduce((Qe,Pt)=>Qe+(O.get(Pt)||O.get("default")),0),Pe=["linkedStyles","clearFormatting","copyFormat","formattingMarks"],Je=["zoom","fontFamily","fontSize","redo"],nt=i<=Tf.lg,ut=e.config?.showFormattingMarksButton===!0,Ht=e.config?.showTableOfContentsButton===!0;nt&&(ee.attributes.value={...ee.attributes.value,className:`${ee.attributes.value.className} sd-toolbar-item--doc-mode-compact`}),nt&&(Q.attributes.value={...Q.attributes.value,className:`${Q.attributes.value.className} sd-toolbar-item--linked-styles-compact`});let He=[oe,Re,je,tt,T,ve,d,v,m,v,l,k,C,_,w,b,v,L,M,...Ht?[V]:[],q,B,v,J,se,pe,Ve,ge,K,v,Q,v,U,ke,...ut?[$]:[],Te,wt,...Iz(e)?[f]:[],be,ee];if(i<=Tf.md&&o&&(He=He.filter(Qe=>Qe.type!=="separator")),e.config.mode!=="docx"){const Qe=He.findIndex(It=>It.name.value==="linkedStyles");He.splice(Qe-1,2);const Pt=["ruler","zoom","undo","redo"];He=He.filter(It=>!Pt.includes(It.name.value))}const Vt=[];a||(s==="viewer"&&Vt.push(je,tt),He=He.filter(Qe=>!Vt.includes(Qe)));const Mt=Qe=>P.includes(Qe.name.value),sn=[],qn=[];let Kt=xe+he;return He.forEach(Qe=>{const Pt=O.get(Qe.name.value)||O.get("default");if(i<Tf.xl+me&&Pe.includes(Qe.name.value)&&o){if(sn.push(Qe),Qe.name.value==="linkedStyles"){const It=He.findIndex(Sn=>Sn.name.value==="linkedStyles");He.splice(It+1,1)}return}if(i<Tf.sm&&Je.includes(Qe.name.value)&&o){sn.push(Qe);return}if(Mt(Qe)){qn.push(Qe),Kt+=Pt;return}Kt<i||!o?(qn.push(Qe),Kt+=Pt):sn.push(Qe)}),{defaultItems:qn,overflowItems:sn.filter(Qe=>Qe.type!=="separator")}},oA={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",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"},Tz=e=>e?typeof e!="string"?e instanceof HTMLElement?e:null:e.startsWith("#")||e.startsWith(".")?document.querySelector(e):document.getElementById(e):null;xt();function iA(e){return oN(e)??Z0[e]??null}function am(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=n===void 0?o.call(e.commands,t):o.call(e.commands,t,n);return i&&typeof i.then=="function"&&Promise.resolve(i).then(()=>r.onSettled?.(),s=>{r.onError?.(s),r.onSettled?.()}),!0}var Rz=new Set(["bold","italic","underline","strike","color","highlight","link","clearFormatting","textAlign","list","numberedlist","indentleft","indentright","lineHeight","linkedStyles"]),Lz=new Set(["list","numberedlist"]);function Mz(e,t){if(e==="fontFamily"||e==="fontSize"||Lz.has(e)&&t?.disabled&&t?.supported!==!1&&t?.reason==null)return!0;if(!Rz.has(e))return!1;const n=t?.reason;return n==="range-selection-required"||n==="selection-required"}function sA(e){return!!e?.closest?.("[data-editor-ui-surface], .toolbar-dropdown-menu, .sd-toolbar-dropdown-menu, .sd-tooltip-content")}function Pz(e){return["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key)}var Dz=class extends Gm.default{config={selector:null,toolbarGroups:["left","center","right"],role:"editor",icons:{...or},texts:{...oA},fonts:null,hideButtons:!0,responsiveToContainer:!1,mode:"docx",excludeItems:[],groups:null,customButtons:[],showFormattingMarksButton:!1,showTableOfContentsButton:!1};toolbarItems=[];overflowItems=[];#e=null;#n=null;isDev=!1;role="editor";superdoc;toolbarContainer=null;toolbar=null;_detachFontsChanged=null;constructor(e={}){if(super(),this.config={...this.config,...e},this.toolbarItems=[],this.overflowItems=[],this.isDev=e.isDev||!1,this.superdoc=e.superdoc,this.role=e.role||"editor",this.toolbarContainer=null,this.config.icons={...or,...e.icons},this.config.texts={...oA,...e.texts},this.config.hideButtons=e.hideButtons??!0,this.config.responsiveToContainer=e.responsiveToContainer??!1,this.activeEditor=e.editor??this.superdoc?.activeEditor??null,this.ui=null,this.snapshot=null,this._unsubscribeController=null,this._detachFormatPainterModeChange=null,this._customCommandRegs=new Map,this._reportedInvalidCustomItems=new Set,this._lastFontOptionsSignature="",!this.config.selector&&this.config.element&&(this.config.selector=this.config.element),this.toolbarContainer=Tz(this.config.selector),this.toolbarContainer){const t=(this.config?.uiDisplayFallbackFont||"").toString().trim()||"Arial, Helvetica, sans-serif";this.toolbarContainer.style.setProperty("--sd-ui-font-family",t)}try{if(this.#t(),this.#d(),this.#f(),this.#i(),this._lastFontOptionsSignature=this.#o(),!this.toolbarContainer){this.updateToolbarState();return}this.app=Yl(IB),this.app.directive("click-outside",qv),this.app.config.globalProperties.$toolbar=this,this.toolbar=this.app.mount(this.toolbarContainer),this.updateToolbarState()}catch(t){try{this.destroy()}catch{}throw t}}#t(){this.ui=this.superdoc?.ui??null,this.ui&&(this.snapshot=this.ui.toolbar.getSnapshot(),this._unsubscribeController=this.ui.toolbar.subscribe(()=>{this.snapshot=this.ui.toolbar.getSnapshot(),this.updateToolbarState()}),this._detachFormatPainterModeChange=this.ui.formatPainter.onModeChange(e=>{e==="armed"||e==="persistent"?this.#a():this.#S()}))}#r(){this._unsubscribeController?.(),this._unsubscribeController=null,this._detachFormatPainterModeChange?.(),this._detachFormatPainterModeChange=null,this.#S();for(const e of this._customCommandRegs.values())try{e.unregister?.()}catch{}this._customCommandRegs.clear(),this.ui=null,this.snapshot=null}#i(){if(!this.superdoc||typeof this.superdoc.on!="function"||typeof this.superdoc.off!="function")return;const e=()=>{const t=this.#o();t!==this._lastFontOptionsSignature&&(this._lastFontOptionsSignature=t,this.#p()),this.updateToolbarState()};this.superdoc.on("fonts-changed",e),this._detachFontsChanged=()=>{this.superdoc?.off?.("fonts-changed",e)}}#s(){this._detachFontsChanged?.(),this._detachFontsChanged=null}#d(){if(Array.isArray(this.config.groups)){this.config.toolbarGroups=this.config.groups,this.config.groups=null;return}this.config.groups&&!Array.isArray(this.config.groups)&&Object.keys(this.config.groups).length&&(this.config.toolbarGroups=Object.keys(this.config.groups))}getAvailableWidth(){const e=document.documentElement.clientWidth,t=this.toolbarContainer?.offsetWidth??0;return this.config.responsiveToContainer?t:e}#h(e){if(e)return e;const t=this.superdoc?.fonts?.getFontFamilyOptions?.()??[];return CB(t)}#f(){const e=this.getAvailableWidth(),t=this.config.groups&&!Array.isArray(this.config.groups)&&Object.keys(this.config.groups).length>0,{defaultItems:n,overflowItems:r}=Ez({superToolbar:this,toolbarIcons:this.config.icons,toolbarTexts:this.config.texts,toolbarFonts:this.#h(this.config.fonts),hideButtons:this.config.hideButtons,availableWidth:e,role:this.role,isDev:this.isDev}),o=this.config.customButtons||[],i=new Set([...n,...r].map(c=>c.name?.value).filter(Boolean)),s=o.map((c,d)=>{try{if(c?.name&&i.has(c.name))throw new Error(`Toolbar item name "${c.name}" is already taken by another item, so this entry is skipped.`);const f=this.#c(c);return i.add(f.name?.value),f}catch(f){const h=`${c?.name??`<unnamed@${d}>`}::${f?.message??String(f)}`;return this._reportedInvalidCustomItems.has(h)||(this._reportedInvalidCustomItems.add(h),this.#b(f,c?.name??null)),null}}).filter(Boolean);s.length&&n.push(...s);let a=[...n.map(c=>c.name.value),...r.map(c=>c.name.value)];if(t){const c=Object.values(this.config.groups).flatMap(h=>h),d=new Set(Object.keys(this.config.groups)),f=s.filter(h=>d.has(h.group?.value||"center")).map(h=>h.name.value);a=[...new Set([...c,...f])]}const l=n.filter(c=>a.includes(c.name.value)).filter(c=>!this.config.excludeItems.includes(c.name.value));if(t)for(const[c,d]of Object.entries(this.config.groups))for(const f of l)d.includes(f.name.value)&&(f.group.value=c);this.toolbarItems=l,this.overflowItems=r.filter(c=>a.includes(c.name.value))}#c(e){const t=In({...e});t.isCustomToolbarItem=!0;const n=e.command;if(typeof n=="function"&&this.ui?.commands?.register){const r=`__builtin_toolbar__${e.name}`;if(!this._customCommandRegs.has(r)){const o=this.ui.commands.register({id:r,execute:i=>{const s=i?.payload&&typeof i.payload=="object"?i.payload:{};return n({...i,item:t,argument:s.argument,option:s.option})}});this._customCommandRegs.set(r,o)}}return t}#p(){this.#f(),this.emit("toolbar-items-changed")}#o(){if(this.config.fonts)return"custom-fonts";const e=this.superdoc?.fonts?.getFontFamilyOptions?.()??[];return JSON.stringify(e.map(t=>[t.label,t.value,t.previewFamily]))}getToolbarItemByGroup(e){return this.toolbarItems.filter(t=>(t.group?.value||"center")===e)}getToolbarItemByName(e){return this.#l().find(t=>t.name.value===e)}#l(){return[...this.toolbarItems,...this.overflowItems]}getLinkedStyleOptions(){return this.ui?.styles?.getQuickGallery?.()??[]}getActiveLinkedStyleId(){return this.ui?.styles?.getActiveParagraphStyle?.()?.styleId??null}setActiveEditor(e){this.activeEditor=e;const t=this.#o();t!==this._lastFontOptionsSignature&&(this._lastFontOptionsSignature=t,this.#p()),this.ui&&(this.snapshot=this.ui.toolbar.getSnapshot()),this.updateToolbarState()}onToolbarResize=()=>{this.#f(),this.updateToolbarState()};#g(e){return e==="ruler"?!!this.superdoc?.config?.rulers:e==="formattingMarks"?!!this.superdoc?.config?.layoutEngineOptions?.showFormattingMarks:!1}#u(e){return e==="ruler"?typeof this.superdoc?.toggleRuler=="function":e==="formattingMarks"?typeof this.superdoc?.toggleFormattingMarks=="function"||typeof this.superdoc?.setShowFormattingMarks=="function":!1}#y(){const e=this.getToolbarItemByName("documentMode");if(!e)return;const t=(this.snapshot?.commands?.["document-mode"]?.value||"editing").toLowerCase(),n=this.config.texts||{},r=this.config.icons||{},o={editing:{label:n.documentEditingMode||"Editing",icon:r.documentEditingMode||r.documentMode},suggesting:{label:n.documentSuggestingMode||"Suggesting",icon:r.documentSuggestingMode||r.documentMode},viewing:{label:n.documentViewingMode||"Viewing",icon:r.documentViewingMode||r.documentMode}},i=o[t]||o.editing;e.label?.value!==void 0&&(e.label.value=i.label),e.defaultLabel?.value!==void 0&&(e.defaultLabel.value=i.label),e.icon?.value!==void 0&&i.icon&&(e.icon.value=i.icon)}#w(){const e=this.toolbarItems.find(n=>n.name.value==="highlight");if(!e)return;const t={key:"color",type:"render",render:()=>Q0(this,e,[],!0)};e.nestedOptions.value=[t]}#k(e){return!!e?.active&&e?.value==null}#I(e){return!!e&&e.disabled===!1&&e.value==null}#x(e){const t=e.name.value;if(t==="tableActions"){const i=J4.map(s=>this.snapshot?.commands?.[s]).some(s=>s&&!s.disabled);return e.setDisabled(!i),!0}if(t==="search")return e.setDisabled(!1),!0;if(Y0(t)?.disposition==="host-routed")return e.setDisabled(!this.#u(t)),this.#g(t)?e.activate():e.deactivate(),!0;const n=iA(t);if(!n)return!1;const r=this.snapshot?.commands?.[n];Mz(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.#y()},link:()=>{e.active.value=!!r?.active,e.attributes.value=J0(e.attributes.value,r?.value??null)},fontFamily:()=>{if(r?.value!=null){e.activate({fontFamily:r.value});return}if(this.#I(r)){e.activate({},!0);return}e.deactivate()},fontSize:()=>{if(r?.value!=null){e.activate({fontSize:r.value});return}if(this.#k(r)){e.activate({},!0);return}e.deactivate()},color:()=>{r?.value!=null?e.activate({color:r.value}):e.deactivate()},highlight:()=>{r?.value!=null?e.activate({color:r.value}):e.deactivate()},linkedStyles:()=>{const i=r?.value,s=typeof i=="string"?i:i?.styleId,a=i&&typeof i=="object"?i.styleName:null;s?e.activate({styleId:s,styleName:a}):e.label.value=this.config.texts?.formatText||"Format text"},list:()=>{r?.active?(e.activate(),e.selectedValue.value=r.value):(e.deactivate(),e.selectedValue.value=null)},numberedlist:()=>{r?.active?(e.activate(),e.selectedValue.value=r.value):(e.deactivate(),e.selectedValue.value=null)},default:()=>{r?.active?e.activate():e.deactivate()}};return(o[t]??o.default)(),!0}updateToolbarState(){this.#y(),this.#w();const e=this.snapshot?.commands?.["document-mode"]?.value||"editing";!(this.snapshot&&(this.superdoc?.activeEditor??this.activeEditor))||e==="viewing"?(this.#M(),this.#l().forEach(n=>{n.allowWithoutEditor?.value&&this.#x(n)})):this.#l().forEach(n=>{n.resetDisabled(),this.#x(n)});const t=this.getToolbarItemByName("copyFormat");t&&(this.snapshot?.copyFormatActive?t.activate():t.deactivate()),this.emit("toolbar-state-change")}#M(){this.#l().forEach(e=>{const{allowWithoutEditor:t}=e;t?.value||e.setDisabled(!0)})}#P(e,t){const n=this.superdoc;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}#D(e,t){const n=e?.name?.value;if(!n)return!1;const r={onSettled:()=>this.updateToolbarState(),onError:i=>this.#b(i,n)};if(n==="image"&&t==null)return this.#E();if(n==="tableActions"){const i=Q4[t?.command];return i?am(this.ui,i,void 0,r):!1}if(Y0(n)?.disposition==="unsupported")return!0;const o=iA(n);return o?am(this.ui,o,t,r):!1}#E(){return this.snapshot?.commands?.image?.disabled||(this.#e||(this.#e=dN({ownerDocument:this.toolbarContainer?.ownerDocument??document,onPick:async e=>{const t=await cN(e,this.superdoc?.config?.handleImageUpload);am(this.ui,"image",{src:t},{onSettled:()=>this.updateToolbarState(),onError:n=>this.#b(n,"image")})},onError:e=>this.#b(e,"image")})),this.#e.open()),!0}#a(){if(this.#n)return;const e=this.superdoc?.activeEditor?.container??document,t=i=>{sA(i.target)||this.ui.formatPainter.setPointerSelecting(!0)},n=i=>{this.ui.formatPainter.setPointerSelecting(!1),!sA(i.target)&&this.ui.formatPainter.notifyPointerUp()},r=i=>{if(i.key==="Escape"){this.ui.formatPainter.cancel();return}Pz(i)&&this.ui.formatPainter.setKeyboardSelecting(!0)},o=()=>{this.ui.formatPainter.setKeyboardSelecting(!1),this.ui.formatPainter.notifyKeyUp()};e.addEventListener("pointerdown",t),e.addEventListener("pointerup",n),e.addEventListener("keydown",r),e.addEventListener("keyup",o),this.#n=()=>{e.removeEventListener("pointerdown",t),e.removeEventListener("pointerup",n),e.removeEventListener("keydown",r),e.removeEventListener("keyup",o)}}#S(){this.#n&&(this.#n(),this.#n=null)}#b(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(Y0(r)?.disposition==="host-routed"){this.#P(r,t),this.updateToolbarState();return}if(typeof o=="function"){const s=`__builtin_toolbar__${r}`;this._customCommandRegs.has(s)&&this.ui?.commands?.execute?this.ui.commands.execute(s,{argument:t,option:n}):o({item:e,argument:t,option:n,ui:this.ui,superdoc:this.superdoc}),this.updateToolbarState();return}if(e?.isCustomToolbarItem&&typeof o=="string"){if(!am(this.ui,o,t,{onSettled:()=>this.updateToolbarState(),onError:s=>this.#b(s,r)}))throw new Error(`[superdoc toolbar] Command not handled: ${String(o)}`);this.updateToolbarState();return}if(!this.#D(e,t)&&o)throw new Error(`[superdoc toolbar] Command not handled: ${String(o)}`);this.updateToolbarState()}catch(s){this.#b(s,r)}}}destroy(){this.#S(),this.#e?.destroy(),this.#e=null,this.#s(),this.#r(),this.app?.unmount(),this.app=null,this.toolbar=null}};function Oz(e){return new Dz(e)}function Fz(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null||Array.isArray(e)!==Array.isArray(t))return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(t,o)||!Object.is(e[o],t[o]))return!1;return!0}function Nz(e){if(!e||typeof e!="object")return{};const t={};e.fonts&&(t.rFonts={ascii:e.fonts.ascii,hAnsi:e.fonts.hAnsi,eastAsia:e.fonts.eastAsia,cs:e.fonts.cs,asciiTheme:e.fonts.asciiTheme,hAnsiTheme:e.fonts.hAnsiTheme,eastAsiaTheme:e.fonts.eastAsiaTheme,csTheme:e.fonts.csTheme,hint:e.fonts.hint}),e.fontFamily!=null&&(t.fontFamily=e.fontFamily),e.lang&&(t.lang={val:e.lang.val,eastAsia:e.lang.eastAsia,bidi:e.lang.bidi}),e.fontSize!=null&&(t.fontSize=e.fontSize),e.fontSizeCs!=null&&(t.fontSizeCs=e.fontSizeCs);const n=lm(e.color);n!=null&&(t.color=n),e.highlight!=null&&(t.highlight=e.highlight);const r=zz(e.shading);r&&(t.shading=r),e.cs!=null&&(t.cs=e.cs),e.rtl!=null&&(t.rtl=e.rtl),e.bold!=null&&(t.bold=e.bold),e.boldCs!=null&&(t.bCs=e.boldCs),e.italic!=null&&(t.italic=e.italic),e.italicCs!=null&&(t.iCs=e.italicCs);const o=Bz(e.underline);o!==void 0&&(t.underline=o),e.strikethrough!=null&&(t.strike=e.strikethrough),e.doubleStrikethrough!=null&&(t.dstrike=e.doubleStrikethrough),e.caps!=null&&(t.caps=e.caps),e.smallCaps!=null&&(t.smallCaps=e.smallCaps),e.outline!=null&&(t.outline=e.outline),e.shadow!=null&&(t.shadow=e.shadow),e.emboss!=null&&(t.emboss=e.emboss),e.imprint!=null&&(t.imprint=e.imprint),e.verticalAlign!=null&&(t.vertAlign=e.verticalAlign),e.characterSpacing!=null&&(t.letterSpacing=e.characterSpacing),e.characterScale!=null&&(t.charScale=e.characterScale),e.kern!=null&&(t.kerning=e.kern),e.baselineShift!=null&&(t.position=e.baselineShift),e.fitTextWidth!=null&&(t.fitText={val:e.fitTextWidth}),e.vanish!=null&&(t.vanish=e.vanish),e.webHidden!=null&&(t.webHidden=e.webHidden),e.specVanish!=null&&(t.specVanish=e.specVanish);const i=Vz(e.border);return i&&(t.border=i),t}function lm(e){if(e){if(typeof e=="string")return e;if(e.model==="rgb")return e.value;if(e.model==="auto")return"auto"}}function Bz(e){if(e==null)return;const t={};return e.style!=null&&(t.style=e.style),e.color?.model==="rgb"&&(t.color=e.color.value),e.color?.model==="theme"&&(t.themeColor=e.color.theme),Object.keys(t).length>0?t:!0}function zz(e){if(!e)return;const t={},n=lm(e.fill);n!=null&&(t.fill=n);const r=lm(e.color);return r!=null&&(t.color=r),e.pattern!=null&&(t.val=e.pattern),Object.keys(t).length>0?t:void 0}function Vz(e){if(!e)return;const t={};e.style!=null&&(t.val=e.style),e.width!=null&&(t.sz=e.width),e.space!=null&&(t.space=e.space);const n=lm(e.color);return n!=null&&(t.color=n),Object.keys(t).length>0?t:void 0}function cc(e){const t=e?.selectionTarget??e?.target;if(!e||!t)return"";try{return JSON.stringify(t)}catch{return String(t)}}var jz=new Set(["insert-text","replace-text","plain-text-paste","delete-backward","delete-forward","text.insert","text.replace","text.pastePlain","text.deleteBackward","text.deleteForward","structural.enter","structural:enter-split-paragraph","structural:enter-insert-paragraph-before","structural:enter-insert-paragraph-after","structural:shift-enter-line-break","structural:backspace-boundary-merge-with-previous","structural:delete-boundary-merge-with-next","backspace:boundary-merge-with-previous","backspace:list-remove","backspace:list-outdent"]),Uz=e=>e?.type!=="mutation:committed"||e.origin!=="command"?!1:jz.has(e.editableCommandKind);function aA(e){return e.split(",").map(t=>t.trim()).filter(Boolean)}function Hz(e){const t=[],n=o=>{o&&!t.includes(o)&&t.push(o)};n(e.getAttribute("data-track-change-preferred-target-id"));const r=e.getAttribute("data-track-change-ids");if(r)for(const o of aA(r))n(o);return n(e.getAttribute("data-track-change-id")),t}function lA(e,t){if(!e||typeof e.getAttribute!="function")return[];const n=[],r=new Set;let o=[],i=e;for(;i;){const s=i,a=Hz(s),l=a.length>0?s.getAttribute("data-story-key"):null;for(const m of a){const v=`trackedChange:${m}`;if(!r.has(v)){r.add(v);const k={type:"trackedChange",id:m};l&&(k.storyKey=l),n.push(k),o.push(k)}}const c=s.getAttribute("data-layout-story");if(c&&o.length>0){for(const m of o)m.story=c;o=[]}const d=s.getAttribute("data-citation-id");if(d){const m=`citation:${d}`;r.has(m)||(r.add(m),n.push({type:"citation",id:d}))}const f=s.getAttribute("data-comment-ids");if(f)for(const m of aA(f)){const v=`comment:${m}`;r.has(v)||(r.add(v),n.push({type:"comment",id:m}))}const h=s.getAttribute("data-sdt-type"),g=s.getAttribute("data-sdt-id");if(g&&h==="structuredContent"){const m=`contentControl:${g}`;if(!r.has(m)){r.add(m);const v=s.getAttribute("data-sdt-scope"),k=s.getAttribute("data-sdt-tag"),C={type:"contentControl",id:g};(v==="block"||v==="inline")&&(C.scope=v),k&&(C.tag=k),n.push(C)}}if(t&&i===t)break;i=i.parentElement}return n}var mo=()=>({oneOf:[{type:"boolean"},{type:"null"}]}),fl=()=>({oneOf:[{type:"string",minLength:1},{type:"null"}]}),_u=()=>({oneOf:[{type:"number"},{type:"null"}]}),Au=e=>({oneOf:[{type:"object",properties:e,additionalProperties:!1,minProperties:1},{type:"null"}]}),$z={type:"object",properties:{style:{oneOf:[{type:"string",minLength:1},{type:"null"}]},color:{oneOf:[{type:"string",minLength:1},{type:"null"}]},themeColor:{oneOf:[{type:"string",minLength:1},{type:"null"}]}},additionalProperties:!1,minProperties:1},Gz={type:"object",properties:{id:{type:"number"},val:{type:"boolean"}},required:["id"],additionalProperties:!1},Wz=()=>({oneOf:[{type:"boolean"},{type:"null"},$z]}),Kz=()=>({oneOf:[{type:"array",items:Gz,minItems:1},{type:"null"}]});function cm(e,t){return{storage:"mark",markName:e,textStyleAttr:t}}function qz(e){return{storage:"runAttribute",nodeName:"run",runPropertyKey:e}}var e2=(e,t,n)=>({key:e,type:"boolean",ooxmlElement:t,storage:"mark",tracked:!0,carrier:cm(n),schema:mo()}),uc=(e,t,n,r,o)=>({key:e,type:t,ooxmlElement:n,storage:"mark",tracked:!0,carrier:cm("textStyle",o??e),schema:r}),Un=(e,t,n,r,o)=>({key:e,type:t,ooxmlElement:n,storage:"runAttribute",tracked:!1,carrier:qz(o??e),schema:r}),um=[e2("bold","w:b","bold"),e2("italic","w:i","italic"),e2("strike","w:strike","strike"),{key:"underline",type:"object",ooxmlElement:"w:u",storage:"mark",tracked:!0,carrier:cm("underline"),schema:Wz()},{key:"highlight",type:"string",ooxmlElement:"w:highlight",storage:"mark",tracked:!0,carrier:cm("highlight"),schema:fl()},uc("color","string","w:color",fl()),uc("fontSize","number","w:sz",_u()),uc("fontFamily","string","w:rFonts",fl()),uc("letterSpacing","number","w:spacing",_u()),uc("vertAlign","string","w:vertAlign",{oneOf:[{enum:["superscript","subscript","baseline"]},{type:"null"}]}),uc("position","number","w:position",_u()),Un("dstrike","boolean","w:dstrike",mo()),Un("smallCaps","boolean","w:smallCaps",mo()),uc("caps","boolean","w:caps",mo(),"textTransform"),Un("shading","object","w:shd",Au({fill:{oneOf:[{type:"string",minLength:1},{type:"null"}]},color:{oneOf:[{type:"string",minLength:1},{type:"null"}]},val:{oneOf:[{type:"string",minLength:1},{type:"null"}]}})),Un("border","object","w:bdr",Au({val:{oneOf:[{type:"string",minLength:1},{type:"null"}]},sz:{oneOf:[{type:"number"},{type:"null"}]},color:{oneOf:[{type:"string",minLength:1},{type:"null"}]},space:{oneOf:[{type:"number"},{type:"null"}]}}),"borders"),Un("outline","boolean","w:outline",mo()),Un("shadow","boolean","w:shadow",mo()),Un("emboss","boolean","w:emboss",mo()),Un("imprint","boolean","w:imprint",mo()),Un("charScale","number","w:w",_u(),"w"),Un("kerning","number","w:kern",_u(),"kern"),Un("vanish","boolean","w:vanish",mo()),Un("webHidden","boolean","w:webHidden",mo()),Un("specVanish","boolean","w:specVanish",mo()),Un("rtl","boolean","w:rtl",mo()),Un("cs","boolean","w:cs",mo()),Un("bCs","boolean","w:bCs",mo(),"boldCs"),Un("iCs","boolean","w:iCs",mo(),"italicCs"),Un("eastAsianLayout","object","w:eastAsianLayout",Au({id:{oneOf:[{type:"string",minLength:1},{type:"null"}]},combine:{oneOf:[{type:"boolean"},{type:"null"}]},combineBrackets:{oneOf:[{type:"string",minLength:1},{type:"null"}]},vert:{oneOf:[{type:"boolean"},{type:"null"}]},vertCompress:{oneOf:[{type:"boolean"},{type:"null"}]}})),Un("em","string","w:em",fl()),Un("fitText","object","w:fitText",Au({val:{oneOf:[{type:"number"},{type:"null"}]},id:{oneOf:[{type:"string",minLength:1},{type:"null"}]}})),Un("snapToGrid","boolean","w:snapToGrid",mo()),Un("lang","object","w:lang",Au({val:{oneOf:[{type:"string",minLength:1},{type:"null"}]},eastAsia:{oneOf:[{type:"string",minLength:1},{type:"null"}]},bidi:{oneOf:[{type:"string",minLength:1},{type:"null"}]}})),Un("oMath","boolean","w:oMath",mo()),Un("rStyle","string","w:rStyle",fl(),"styleId"),Un("rFonts","object","w:rFonts",Au({ascii:{oneOf:[{type:"string",minLength:1},{type:"null"}]},hAnsi:{oneOf:[{type:"string",minLength:1},{type:"null"}]},eastAsia:{oneOf:[{type:"string",minLength:1},{type:"null"}]},cs:{oneOf:[{type:"string",minLength:1},{type:"null"}]},asciiTheme:{oneOf:[{type:"string",minLength:1},{type:"null"}]},hAnsiTheme:{oneOf:[{type:"string",minLength:1},{type:"null"}]},eastAsiaTheme:{oneOf:[{type:"string",minLength:1},{type:"null"}]},csTheme:{oneOf:[{type:"string",minLength:1},{type:"null"}]},hint:{oneOf:[{type:"string",minLength:1},{type:"null"}]}}),"fontFamily"),Un("fontSizeCs","number","w:szCs",_u()),Un("ligatures","string","w14:ligatures",fl()),Un("numForm","string","w14:numForm",fl()),Un("numSpacing","string","w14:numSpacing",fl()),Un("stylisticSets","array","w14:stylisticSets",Kz()),Un("contextualAlternates","boolean","w14:cntxtAlts",mo())],PH=new Set(um.map(e=>e.key)),Yz=Object.fromEntries(um.map(e=>[e.key,e])),DH={mark:um.filter(e=>e.storage==="mark").map(e=>e.key),runAttribute:um.filter(e=>e.storage==="runAttribute").map(e=>e.key)},t2=new WeakMap;function Xz(e){let t=t2.get(e);return t||(t={refCount:0,generation:0,abortController:new AbortController,inFlight:null,activeMutationTokens:new Set},t2.set(e,t)),t.refCount+=1,t}function Zz(e,t){t.refCount=Math.max(0,t.refCount-1),!(t.refCount>0)&&(t.abortController.abort("ui-controller-destroyed"),t.inFlight=null,t.activeMutationTokens.clear(),t2.delete(e))}var Qz=new Set(Object.values(lt));function n2(e,t){return typeof e=="string"&&Qz.has(e)?e:t}function cA(e){if(e&&typeof e=="object"&&e.ok===!1){const t=e.reason;return t==="host-not-ready"||t==="host-disposed"||t==="editing-mount-required"?{ok:!1,reason:lt.notReady}:{ok:!1,reason:n2(t,lt.targetUnresolved)}}return{ok:!0}}var Jz=["document-replaced","editorCreate","active-editor-change","document-mode-change","zoomChange","measurement-unit-change","viewport-change","fonts-changed"],eV={[j4.bulletList]:"bullet",[j4.numberedList]:"ordered"};function uA(e){return eV[e]??null}var tV={disc:"disc",circle:"circle",square:"square",decimal:"decimal","decimal-paren":"decimalParenthesis","upper-roman":"upperRoman","lower-roman":"lowerRoman","upper-alpha":"upperLetter","upper-alpha-paren":"upperLetterParenthesis","lower-alpha":"lowerLetter","lower-alpha-paren":"lowerLetterParenthesis"};function nV(e){const t=tV[e];return t?{preset:t,behavior:"toggleStyle"}:{}}var rV={status:"ready",empty:!0,target:null,selectionTarget:null,activeMarks:[],activeCommentIds:[],activeChangeIds:[],quotedText:""},oV=[{key:"contentControls",match:"exact",note:"full-document SDT catalog parse (the measured during-load cliff)"},{key:"contentControls:inRange:",match:"prefix",note:"same adapter load() as the catalog, issued per settled selection"},{key:"hyperlinks:",match:"prefix",note:"per-block hyperlink list over the loading story"},{key:"styles:catalog:",match:"prefix",note:"WordStyleModel recompile from package bytes"},{key:"comments",match:"exact",note:"audited: full comments list; stale-served during load"},{key:"trackChanges",match:"exact",note:"audited: shared all-story tracked-changes catalog; stale-served during load"},{key:"trackChanges:all",match:"exact",note:"audited: current-token validation over the shared all-story catalog; consumers fail closed on non-ready"},{key:"tables",match:"exact",note:"reserved: full tables catalog"},{key:"sections",match:"exact",note:"reserved: full sections list"}],iV=new Set(["/word/comments.xml","/word/commentsExtended.xml","/word/commentsIds.xml"]);function sV(e){return oV.some(t=>t.match==="exact"?t.key===e:e.startsWith(t.key))}var dA={ready:0,stale:1,pending:2};function hl(...e){let t="ready";for(const n of e)dA[n]>dA[t]&&(t=n);return t}function Lt(e,t){if(typeof e!="function")return t;try{const n=e();return n===void 0?t:n}catch{return t}}function xr(e){return!!e&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"}function yr(e,t){if(!e)return null;const n=t.split(".");let r=e;for(const o of n){if(r==null)return null;r=r[o]}return typeof r=="function"?r:null}function Xn(e,t="CAPABILITY_UNAVAILABLE"){return{success:!1,failure:{code:t,message:e}}}function Rf(e,t){return{success:!1,failure:{code:"PARTIAL_LINK_EDIT",message:"Hyperlink target was updated, but display text replacement failed."},applied:{href:!0,text:!1},hyperlinkResult:e,textResult:t}}function Lf(e){if(!e||typeof e!="object")return null;const t=e.target;return t&&typeof t=="object"?t:null}function r2(e){if(!e||typeof e!="object")return!1;const t=e,n=i=>{if(!i||typeof i!="object")return!1;const s=i;return s.kind==="text"&&typeof s.blockId=="string"&&typeof s.offset=="number"},r=i=>{if(!i||typeof i!="object")return!1;const s=i,a=s.range;return typeof s.blockId=="string"&&typeof a?.start=="number"&&typeof a.end=="number"};if(Array.isArray(t.segments)){const i=t.segments[0],s=t.segments[t.segments.length-1];return r(i)&&r(s)}if(t.kind==="selection")return n(t.start)&&n(t.end);if(t.kind!=="text"||typeof t.blockId!="string")return!1;const o=t.range;return typeof o?.start=="number"&&typeof o.end=="number"}function fA(e,t){if(!e||typeof e!="object")return null;const n=Lf(e),r=e,o=r.navigationTarget&&typeof r.navigationTarget=="object"?r.navigationTarget:null;if(o?.kind==="block"&&typeof o.blockId=="string"&&o.blockId.length>0){const i={kind:"text",blockId:o.blockId,range:{start:0,end:0},...o.story&&typeof o.story=="object"?{story:o.story}:{},...r.address&&typeof r.address=="object"?{address:r.address}:{}};if(t?.preferStableBlock||!r2(n))return i}return n}function Cr(e){if(!e||typeof e!="object")return"story:body";const t=e,n=typeof t.storyType=="string"?t.storyType:"body";switch(n){case"body":return"story:body";case"headerFooterPart":return`story:headerFooterPart:${typeof t.refId=="string"?t.refId:""}`;case"headerFooterSlot":return JSON.stringify({storyType:n,section:t.section??null,headerFooterKind:t.headerFooterKind??null,variant:t.variant??null,resolution:t.resolution??"effective",onWrite:t.onWrite??"materializeIfInherited"});case"footnote":return`story:footnote:${typeof t.noteId=="string"?t.noteId:""}`;case"endnote":return`story:endnote:${typeof t.noteId=="string"?t.noteId:""}`;case"textbox":return`story:textbox:${typeof t.textboxId=="string"?t.textboxId:""}`;default:return JSON.stringify(t)}}function Mf(e){if(!e||typeof e!="object")return null;const t=e,n=t.address&&typeof t.address=="object"?t.address:null;if(n?.story&&typeof n.story=="object")return n.story;if(t.storyLocator&&typeof t.storyLocator=="object")return t.storyLocator;if(t.trackedChangeStory&&typeof t.trackedChangeStory=="object")return t.trackedChangeStory;const r=Lf(e);if(!r||typeof r!="object")return null;const o=r;if(o.story&&typeof o.story=="object")return o.story;const i=o.address&&typeof o.address=="object"?o.address:null;return i?.story&&typeof i.story=="object"?i.story:null}function Di(e,t,n){return oo(e)!==t?!1:n?Cr(Mf(e))===Cr(n):!0}function dm(e){const t=Mf(e);if(!(!t||Cr(t)===Cr(null)))return t}function aV(e){if(typeof e!="string"||e.length===0)return;const t=_6(e);switch(t.kind){case"body":return;case"footnote":return t.id?{kind:"story",storyType:"footnote",noteId:t.id}:void 0;case"endnote":return t.id?{kind:"story",storyType:"endnote",noteId:t.id}:void 0;case"header":case"footer":return t.id?{kind:"story",storyType:"headerFooterPart",refId:t.id}:void 0;default:return}}function lV(e){if(!(typeof e!="string"||e.length===0||e==="body")){if(e.startsWith("hf:part:")){const t=e.slice(8);return t?{kind:"story",storyType:"headerFooterPart",refId:t}:void 0}if(e.startsWith("fn:")){const t=e.slice(3);return t?{kind:"story",storyType:"footnote",noteId:t}:void 0}if(e.startsWith("en:")){const t=e.slice(3);return t?{kind:"story",storyType:"endnote",noteId:t}:void 0}}}function o2(e){if(!e||typeof e!="object")return null;const t=e.selectionTarget;return t&&typeof t=="object"?t:null}function fm(e){if(!e||typeof e!="object")return null;const t=e.id;return typeof t=="string"&&t.length>0?t:null}function cV(e){if(!e||typeof e!="object")return null;const t=e;if(t.kind!=="selection")return e;const n=t.start;return!n||typeof n!="object"?null:{...t,end:n}}function oo(e){if(!e||typeof e!="object")return null;const t=e,n=t.id??t.commentId??t.changeId;return typeof n=="string"&&n.length>0?n:null}function uV(e){if(!e||typeof e!="object")return null;const t=e,n=t.anchor,r=t.focus,o=n?.visualCaret,i=r?.visualCaret,s=o?.trackChangeId,a=i?.trackChangeId;return typeof s=="string"&&s.length>0&&s===a?s:null}var hA=new WeakMap;function pA(e){const t=[],n=i=>{typeof i=="string"&&i.length>0&&!t.includes(i)&&t.push(i)},r=i=>{if(!i||typeof i!="object")return;const s=i,a=s.sourceIds;if(a&&typeof a=="object"&&(n(a.wordIdInsert),n(a.wordIdDelete),Array.isArray(a.wordIdOther)))for(const f of a.wordIdOther)n(f);const l=s.wordRevisionIds;l&&typeof l=="object"&&(n(l.insert),n(l.delete),n(l.format));const c=s.replacement;if(c&&typeof c=="object")for(const f of[c.inserted,c.deleted])f&&typeof f=="object"&&(n(f.id),n(f.wordId));const d=s.move;if(d&&typeof d=="object")for(const f of[d.source,d.destination])f&&typeof f=="object"&&(n(f.id),n(f.wordId))};r(e);const o=e?.change;return o&&o!==e&&r(o),t}function Os(e){const t=hA.get(e);if(t)return t;const n=new Set,r=new Map;for(const i of e){const s=oo(i);if(s){n.add(s);for(const a of pA(i)){r.has(a)||r.set(a,s);const l=`imported:${a}`;r.has(l)||r.set(l,s)}}}const o={toPublicId(i){if(n.has(i))return i;const s=r.get(i);return s!=null&&n.has(s)?s:null},aliasesFor(i){const s=[i];for(const[a,l]of r)l===i&&!s.includes(a)&&s.push(a);return s}};return hA.set(e,o),o}var mA=new WeakMap,gA=new WeakMap;function dc(e,t){const n=Cr(t);let r=mA.get(e);r||(r=new Map,mA.set(e,r));const o=r.get(n);if(o)return o;const i=Os(e.filter(s=>Cr(Mf(s))===n));return r.set(n,i),i}function dV(e){return!!e&&typeof e=="object"&&e.storyType==="textbox"}function fV(e,t){const n=t.filter(o=>e.some(i=>oo(i)===o&&Mf(i)==null));if(n.length===0)return null;if(n.length===1)return n[0];const r=new Set;for(const o of n){const i=e.find(s=>oo(s)===o);if(i)for(const s of pA(i)){if(r.has(s))return null;r.add(s)}}return n[0]}function hV(e){const t=gA.get(e);if(t)return t;const n=e.filter(o=>Mf(o)!=null),r=n.length===e.length?e:n;return gA.set(e,r),r}function pV(e){const{selectionIds:t,publicIds:n,selection:r,bodyItems:o,allStoryItems:i}=e;if(t.length===0)return null;const s=c=>{for(const d of t){const f=c.toPublicId(d);if(f)return f}return null},a=rs(r),l=Cr(a)===Cr(null);if(i){const c=l?hV(i):i,d=s(dc(c,a));if(d)return d;const f=n?.find(h=>c.some(g=>Di(g,h,a)));return f||(l?s(Os(o)):dV(a)?fV(i,t):null)}return l?s(Os(o))??t[0]??null:null}function mV(e,t){const n=e.find(r=>oo(r)===t||r.importedId===t);return n?n.rootCommentId??n.parentCommentId??oo(n)??t:null}function gV(e){const t=e.selectionTarget;if(t){const s=t.start,a=t.end,l=typeof s?.blockId=="string"?s.blockId:void 0,c=typeof a?.blockId=="string"?a.blockId:l;if(l)return{startBlockId:l,endBlockId:c??l}}const n=e.target,r=n&&Array.isArray(n.segments)?n.segments:[],o=r[0]?.blockId,i=r[r.length-1]?.blockId;return typeof o=="string"?{startBlockId:o,endBlockId:typeof i=="string"?i:o}:null}function Br(e){const t=[],n=s=>{typeof s=="string"&&s.length>0&&!t.includes(s)&&t.push(s)},r=e.target,o=r&&Array.isArray(r.segments)?r.segments:[];for(const s of o)n(s?.blockId);const i=e.selectionTarget;return i&&(n(i.start?.blockId),n(i.end?.blockId)),t}var vV=64;function fc(e){return e.length<=vV}function rs(e){const t=e.target,n=e.selectionTarget,r=n?.start,o=n?.end,i=t?.story??n?.story??r?.story??o?.story;return i&&typeof i=="object"?i:{kind:"story",storyType:"body"}}function Ao(e,t){return{kind:"block",nodeType:"paragraph",nodeId:e,...t&&typeof t=="object"?{story:t}:{}}}function ka(e){return{kind:"block",nodeType:"paragraph",nodeId:e}}function vA(e,t){return{kind:"block",nodeType:"listItem",nodeId:e,...t&&typeof t=="object"?{story:t}:{}}}var yA=720;function Fs(e){return Math.round(e*20)}function Iu(e){return typeof e=="number"&&Number.isFinite(e)}function yV(e){if(!e||typeof e!="object")return null;const t=e.node;if(!t||typeof t!="object")return null;const n=t.kind==="heading"?t.heading??null:t.kind==="paragraph"?t.paragraph??null:null;if(!n)return null;const r=n.resolved,o=n.props,i=r?.indent??o?.indent;if(!i||typeof i!="object")return null;const s=Iu(i.left)?Fs(i.left):Iu(i.start)?Fs(i.start):void 0,a=Iu(i.right)?Fs(i.right):Iu(i.end)?Fs(i.end):void 0,l=Iu(i.firstLine)?Fs(i.firstLine):void 0,c=Iu(i.hanging)?Fs(i.hanging):void 0;return s==null&&a==null&&l==null&&c==null?null:{...s!=null?{left:s}:{},...a!=null?{right:a}:{},...l!=null?{firstLine:l}:{},...c!=null?{hanging:c}:{}}}function i2(e){const t=e.target,n=t&&Array.isArray(t.segments)?t.segments:[],r=t?.story,o=[];for(const i of n){if(!i||typeof i.blockId!="string")continue;const s=i.range;!s||typeof s.start!="number"||typeof s.end!="number"||s.start===s.end||o.push({kind:"text",blockId:i.blockId,range:{start:s.start,end:s.end},...r?{story:r}:{}})}return o}function bV(e){if(!e||typeof e!="object")return[];const t=e,n=t.story,r=[];if(t.kind==="text"&&t.range&&typeof t.blockId=="string"){const o=t.range;return typeof o.start=="number"&&typeof o.end=="number"&&o.start!==o.end&&r.push({kind:"text",blockId:t.blockId,range:{start:Math.min(o.start,o.end),end:Math.max(o.start,o.end)},...n?{story:n}:{}}),r}if(t.kind==="text"&&Array.isArray(t.segments)){for(const o of t.segments){const i=o?.range;typeof o?.blockId=="string"&&typeof i?.start=="number"&&typeof i?.end=="number"&&i.start!==i.end&&r.push({kind:"text",blockId:o.blockId,range:{start:Math.min(i.start,i.end),end:Math.max(i.start,i.end)},...n?{story:n}:{}})}return r}if(t.kind==="selection"){const o=t.start,i=t.end,s=typeof o?.blockId=="string"&&i?.blockId===o.blockId?o.blockId:null;o?.kind==="text"&&i?.kind==="text"&&s&&typeof o.offset=="number"&&typeof i.offset=="number"&&o.offset!==i.offset&&r.push({kind:"text",blockId:s,range:{start:Math.min(o.offset,i.offset),end:Math.max(o.offset,i.offset)},...t.story??o.story?{story:t.story??o.story}:{}})}return r}function Pf(e){if(!e||typeof e!="object")return null;const t=e,n=t.story;if(t.kind==="text"&&t.range&&typeof t.blockId=="string"){const r=t.range;if(typeof r.start=="number"&&typeof r.end=="number"&&r.start===r.end)return{kind:"text",blockId:t.blockId,range:{start:r.start,end:r.end},...n?{story:n}:{}}}if(t.kind==="text"&&Array.isArray(t.segments)){const r=t.segments[0],o=r?.range;if(typeof r?.blockId=="string"&&typeof o?.start=="number"&&typeof o?.end=="number"&&o.start===o.end)return{kind:"text",blockId:r.blockId,range:{start:o.start,end:o.end},...n?{story:n}:{}}}if(t.kind==="selection"){const r=t.start,o=t.end,i=typeof r?.blockId=="string"&&o?.blockId===r.blockId?r.blockId:null;if(r?.kind==="text"&&o?.kind==="text"&&i&&typeof r.offset=="number"&&typeof o.offset=="number"&&r.offset===o.offset)return{kind:"text",blockId:i,range:{start:r.offset,end:r.offset},...t.story??r.story?{story:t.story??r.story}:{}}}return null}function pl(e){return Pf(e.target)??Pf(e.selectionTarget)}var bA=["fontFamily","fontSize","color","highlight"],wV={undo:"history.undo",redo:"history.redo"},Df=["bold","italic","underline","strikethrough"];function s2(e){return bA.includes(e)}function xu(e){const t=e.target,n=t&&Array.isArray(t.segments)?t.segments:[],r=[],o=(l,c,d)=>{typeof l!="string"||typeof c!="number"||typeof d!="number"||r.push({blockId:l,start:Math.min(c,d),end:Math.max(c,d)})};for(const l of n){const c=l?.range;o(l?.blockId,c?.start,c?.end)}if(r.length>0)return r;const i=e.selectionTarget,s=i?.start,a=i?.end;return!s||!a||s.blockId!==a.blockId||o(s.blockId,s.offset,a.offset),r}function os(e){const t=e.target,n=e.selectionTarget,r=n?.start,o=n?.end,i=t?.story??n?.story??r?.story??o?.story;return i&&typeof i=="object"?i:void 0}function CV(e){const t=os(e);if(!t||typeof t!="object")return"body";const n=t;return JSON.stringify({storyType:typeof n.storyType=="string"?n.storyType:"body",refId:typeof n.refId=="string"?n.refId:null,noteId:typeof n.noteId=="string"?n.noteId:null,textboxId:typeof n.textboxId=="string"?n.textboxId:null})}function Sa(e){const t=xu(e);return t.length===0?null:[CV(e),...t.map(n=>`${n.blockId}:${n.start}-${n.end}`)].join("|")}function wA(e){const t=e.selectionTarget;return!t||typeof t!="object"?null:cc({selectionTarget:t})}function kV(e,t){if(e==="fontSize"){const r=typeof t=="number"?t:Number(t);return Number.isFinite(r)&&r>0?String(r):null}if(typeof t!="string")return null;const n=t.trim();return n.length===0?null:e==="color"||e==="highlight"?n.toUpperCase():n}function SV(e,t){return Math.max(e.start,t.start)<Math.min(e.end,t.end)}function _V(e){if(!e)return[];const t=Array.isArray(e.blocks)?e.blocks:[],n=[];for(const r of t){const o=r?.range,i=r?.blockId;typeof i!="string"||typeof o?.start!="number"||typeof o?.end!="number"||n.push({blockId:i,start:Math.min(o.start,o.end),end:Math.max(o.start,o.end)})}return n}function AV(e,t){return e.length!==t.length?!1:e.every((n,r)=>{const o=t[r];return o?.blockId===n.blockId&&o?.start===n.start&&o?.end===n.end})}function CA(e,t){const n=xu(t);if(n.length===0)return null;const r=e&&Array.isArray(e.items)?e.items:[];if(r.length===0)return null;const o=r.find(i=>AV(n,_V(i)));if(o)return o;if(n.length===1){const i=r.find(s=>{const a=s?.address;return a?.kind==="block"&&a.nodeId===n[0].blockId});if(i)return i}return r[0]??null}function IV(e,t){const n=t==="fontSize"?e?.fontSizePt??e?.fontSize:t==="highlight"?e?.highlight??e?.backgroundColor:e?.[t];if(typeof n=="number")return Number.isFinite(n)?String(n):void 0;if(typeof n!="string")return;const r=n.trim();if(r.length!==0)return t==="color"||t==="highlight"?r.toUpperCase():r}function a2(e){if(typeof e!="string")return;const t=e.split(",")[0]?.trim().replace(/^['"]+|['"]+$/g,"").trim();if(!t)return;const n=t.toLowerCase();if(!(n==="serif"||n==="sans-serif"||n==="monospace"||n==="cursive"||n==="fantasy"))return t}function xV(e){if(typeof e!="number"||!Number.isFinite(e)||e<=0)return;const t=Math.round(e*.75*2)/2;if(!(t<=0))return String(t)}function EV(e,t){return e==="fontFamily"?t.toLowerCase():e==="color"||e==="highlight"?t.toUpperCase():t}function kA(e,t){if(!e)return{};const n=new Map;for(const i of xu(t)){const s=n.get(i.blockId)??[];s.push({start:i.start,end:i.end}),n.set(i.blockId,s)}if(n.size===0)return{};const r=Array.isArray(e.blocks)?e.blocks:[],o={};for(const i of bA){const s=new Map;let a=!1,l=!1;for(const c of r){const d=typeof c?.blockId=="string"?c.blockId:null;if(!d)continue;const f=n.get(d);if(!f?.length)continue;const h=Array.isArray(c?.runs)?c.runs:[];for(const g of h){const m=g?.range,v=typeof m?.start=="number"?m.start:null,k=typeof m?.end=="number"?m.end:null;if(v==null||k==null||!f.some(b=>SV(b,{start:v,end:k})))continue;a=!0;const C=IV(g?.styles,i);if(C===void 0){l=!0;continue}const _=EV(i,C);if(s.has(_)||s.set(_,C),s.size>1)break}if(s.size>1)break}a&&!l&&s.size===1&&(o[i]=[...s.values()][0])}return o}function l2(e,t){const n=Br(e)[0];return n?t==="nodeId"?{kind:"after",nodeId:n}:{kind:"after",target:Ao(n)}:{kind:"documentEnd"}}function rn(e,t){const n=e.supported??t!=="unsupported",r=e.enabled??(e.disabled!==void 0?!e.disabled:n);return{enabled:r,disabled:!r,active:e.active??!1,supported:n,value:e.value,source:t,reason:r?void 0:e.reason}}function Of(e){if(!e||typeof e!="object")return null;const t=e,n=t.change,r=n&&typeof n=="object"?n:t;return{...t,id:t.id??r.id,change:r}}function hm(e){const t=e,n=t.change;return n&&typeof n=="object"?n:t}function Ns(e){if(xr(e))return!0;if(e===!1)return!1;if(e===!0||e==null||typeof e!="object")return!0;const t=e;return"success"in t||"failure"in t||"effects"in t?e:t.status!=="rejected"}function pm(e){return!!e&&typeof e=="object"&&e.success===!0}function Io(e){return!(e===!1||e&&typeof e=="object"&&e.success===!1)}function Ff(e){return!!(e&&typeof e=="object"&&!Array.isArray(e))}function c2(e){const t=[],n=r=>{if(!r||typeof r!="object")return;const o=r;if(Array.isArray(o.runs)&&t.push(o),Array.isArray(o.rows))for(const i of o.rows){const s=i?.cells;if(Array.isArray(s))for(const a of s){const l=a;if(Array.isArray(l?.blocks))for(const c of l.blocks)n(c);l?.paragraph&&n(l.paragraph)}}};if(Array.isArray(e))for(const r of e)n(r);return t}function hc(e,t){return e.sourceAnchor?.sourceNodeId===t?!0:e.id===t}function mm(e){return e.trackedChange?.kind==="delete"?0:typeof e.text=="string"?e.text.length:0}function wi(e){let t=!1,n=null,r=null,o=null;for(const i of e)t=i,!Io(i)&&n===null&&(n=i),pm(i)&&(o=i),i!==!1&&(r=i);return n??o??r??t}function TV(e){const t=e?.anchor,n=t?.start,r=t?.end;return typeof n?.blockId!="string"||typeof r?.blockId!="string"||n.blockId!==r.blockId||typeof n.offset!="number"||typeof r.offset!="number"?null:{kind:"selection",start:{kind:"text",blockId:n.blockId,offset:n.offset},end:{kind:"text",blockId:r.blockId,offset:r.offset}}}function RV(e){return e.startsWith("#")?{kind:"anchor",anchor:e.slice(1)}:{kind:"external",url:e}}function gm(e){return ku(e)?.trackDecision??null}function LV(e){return{found:e.length>0,success:e.length>0,rects:e,rect:e[0]}}function ml(e){return{found:!1,success:!1,rects:[],reason:e}}function MV(e,t){if(!t||typeof t.getBoundingClientRect!="function"||e.rects.length===0)return e;let n;try{const o=t.getBoundingClientRect();n={left:o.left,top:o.top}}catch{return e}const r=e.rects.map(o=>({...o,left:o.left-n.left,right:o.right-n.left,top:o.top-n.top,bottom:o.bottom-n.top}));return{...e,rects:r,rect:r[0]}}function PV(e){if(!e||typeof e!="object")return!1;const t=e;if(typeof t.blockId!="string"||!t.range||typeof t.range!="object")return!1;const n=t.range;return Number.isInteger(n.start)&&Number.isInteger(n.end)&&n.start>=0&&n.start<=n.end}function SA(e){if(!e||e.kind!=="text"||!Array.isArray(e.segments)||e.segments.length===0)return null;const t=Array.from(e.segments);if(!t.every(PV))return null;const n=t[0],r=t[t.length-1],o=e.story;return{kind:"selection",start:{kind:"text",blockId:n.blockId,offset:n.range.start,...o?{story:o}:{}},end:{kind:"text",blockId:r.blockId,offset:r.range.end,...o?{story:o}:{}},...o?{story:o}:{}}}function DV(e){return e.selectionTarget?e.selectionTarget:SA(e.target)}function Eu(e){if(e.empty)return null;if(e.selectionTarget)return e.selectionTarget;const t=SA(e.target);return t&&t.start.kind==="text"&&t.end.kind==="text"&&t.start.blockId!==t.end.blockId?null:t}function u2(e){return!e.inline||typeof e.docRoute!="string"?null:e.docRoute.startsWith("format.")?e.docRoute.slice(7):null}var d2={bold:null,italic:null,underline:null,strike:null,color:null,highlight:null,fontFamily:null,fontSize:null,vertAlign:null,smallCaps:null,caps:null,letterSpacing:null,dstrike:null},OV=Object.fromEntries(Object.entries(d2).filter(([e])=>Yz[e]?.tracked===!0));function FV(e,t,n,r){switch(e.kind){case"toggle":{const o=typeof n=="object"&&n!==null&&"value"in n?n.value:n;return typeof o=="boolean"||o===null?{target:t,value:o}:{target:t,value:!r}}case"value-string":{const o=typeof n=="object"&&n!==null&&"value"in n?n.value:n;return o===null?{target:t,value:null}:typeof o!="string"||o.trim()===""?null:{target:t,value:o}}case"value-number":{const o=typeof n=="object"&&n!==null&&"value"in n?n.value:n,i=typeof o=="number"?o:Number(o);return!Number.isFinite(i)||i<=0?null:{target:t,value:i}}case"clear":return{target:t,inline:{...d2}};default:return null}}function NV(e){const t=o=>{if(!o||typeof o!="object")return null;const i=o,s=i.rowIndex,a=i.columnIndex;return typeof s!="number"||!Number.isInteger(s)||typeof a!="number"||!Number.isInteger(a)?null:{rowIndex:s,columnIndex:a}};if(!e)return null;const n=t(e.start),r=t(e.end);return!n||!r?null:{start:n,end:r}}function BV(e,t){const{tableNodeId:n,rowIndex:r,columnIndex:o,cellNodeId:i,mergeRange:s}=t;switch(e){case"insert-row-before":return{nodeId:n,rowIndex:r,position:"above"};case"insert-row-after":return{nodeId:n,rowIndex:r,position:"below"};case"delete-row":return{nodeId:n,rowIndex:r};case"insert-column-before":return{nodeId:n,columnIndex:o,position:"left"};case"insert-column-after":return{nodeId:n,columnIndex:o,position:"right"};case"delete-column":return{nodeId:n,columnIndex:o};case"delete-table":return{nodeId:n};case"merge-cells":{const a=s??{start:{rowIndex:r,columnIndex:o},end:{rowIndex:r,columnIndex:o}};return{nodeId:n,start:a.start,end:a.end}}case"split-cell":return i?{nodeId:i,rows:1,columns:2}:null;case"remove-borders":return{nodeId:n,mode:"applyTo",applyTo:"all",border:null};default:return null}}function zV(e){const t=e.superdoc,n=new Map,r=new Map;let o=null,i=0;const s=[];let a=null,l=0,c=!1,d=Promise.resolve(),f=null,h={mode:"idle",snapshot:null,sourceSelectionKey:null,lastClickAt:0,pointerSelecting:!1,keyboardSelecting:!1},g=0;const m=new Set;let v={},k="",C=null;const _=()=>{const u=t?.activeEditor;return u&&typeof u=="object"?u:null},b=()=>{const u=_()?.doc;return u&&typeof u=="object"?u:null},w=()=>{const u=_()?.v2TrackedChanges;return u&&typeof u=="object"?u:null},T=()=>{const u=_();if(u?.editorVersion!==2)return null;const p=u.reviewWindow;return p&&typeof p=="object"?p:null},L=()=>{const u=T();return!u||typeof u.getSnapshot!="function"?null:Lt(()=>u.getSnapshot(),null)},N=()=>typeof T()?.getSnapshot=="function",H=u=>{const p=u?.status;return p==="ready"||p==="stale"?p:"pending"},M=()=>{const u=_()?.host;return u&&typeof u=="object"?u:null},V=u=>{if(u.storyType!=="headerFooterPart"||typeof u.refId!="string")return null;const p=_(),y=M(),A=p?.pageLayout??y?.pageLayout;if(!A||typeof A!="object")return null;const x=A.getActiveRulerContext,z=y?.resolveHeaderFooterEditTarget;if(typeof x!="function"||typeof z!="function")return null;const W=Lt(()=>x.call(A),null);if(!W||typeof W.pageIndex!="number")return null;for(const re of["header","footer"]){const fe=Lt(()=>z.call(y,{pageIndex:W.pageIndex,kind:re}),null);if(!(fe?.status!=="ready"||fe.refId!==u.refId||typeof fe.sectionId!="string"||!["default","first","even"].includes(String(fe.slotVariant))))return{kind:"story",storyType:"headerFooterSlot",section:{kind:"section",sectionId:fe.sectionId},headerFooterKind:re,variant:fe.slotVariant}}return null},q=()=>{const u=M(),p=u?.getPendingInlineFormat;if(typeof p!="function")return null;const y=Lt(()=>p.call(u),null);return y&&typeof y=="object"?y:null},D=u=>{const p=u2(u);if(!p)return null;const y=q();if(!y||!(p in y))return null;const A=y[p];return u.inline?.kind==="toggle"?A===!0:A!=null&&A!==""},B=u=>{const p=u2(u);if(!p)return;const y=q();if(!y||!(p in y))return;const A=y[p];if(typeof A=="string"&&A!=="")return A;if(typeof A=="number"&&Number.isFinite(A))return String(A)},E=(u,p)=>{const y=M(),A=y?.setPendingInlineFormat;typeof A=="function"&&Lt(()=>A.call(y,u,p),void 0)},j=u=>{const p=M(),y=p?.clearPendingInlineFormat;typeof y=="function"&&Lt(()=>y.call(p,u),void 0)},J=new Set(["bold","italic","underline","strikethrough"]),Y=u=>{const p=q();if(!p)return;const y=Array.isArray(u.activeMarks)?u.activeMarks:[];let A=null;for(const x of Object.keys(p)){const z=p[x];let W;if(J.has(x))W=y.includes(x)===(z===!0);else if(s2(x)){if(z==null)continue;A||(A=xl(u)),W=A[x]===z}else W=!1;W&&j(x)}},se=()=>{const u=_()?.editCommands;return u&&typeof u=="object"?u:null},pe=u=>{const p=se();if(!p||typeof p.getSnapshot!="function")return null;const y=Lt(()=>p.getSnapshot(),null)?.commands?.[u];return y&&typeof y=="object"?y:null},Ve=()=>pe("lists.apply"),ge=u=>{const p=u?.value?.seed;return p==="bullet"||p==="ordered"?p:null},be=u=>{const p=wV[u];return p?pe(p):null},ve=()=>{const u=M();if(!u||typeof u.getTableContext!="function")return null;const p=Lt(()=>u.getTableContext(),null);return p&&typeof p=="object"?p:null},ke=()=>{const u=ve();if(!u||u.inTable!==!0)return null;const p=u.table,y=typeof p?.nodeId=="string"&&p.nodeId.length>0?p.nodeId:null;if(!y)return null;const A=u.row,x=u.column,z=u.cell,W=typeof A?.index=="number"&&Number.isInteger(A.index)?A.index:null,re=typeof x?.index=="number"&&Number.isInteger(x.index)?x.index:null;if(W==null||re==null)return null;const fe=typeof z?.nodeId=="string"&&z.nodeId.length>0?z.nodeId:null,Me=u.cellRange;return{tableNodeId:y,rowIndex:W,columnIndex:re,cellNodeId:fe,mergeRange:NV(Me)}},oe=new Map;let Re=null,je=null,tt=0,wt=0,Te=0;const We=new Set,Ye=(u,p)=>u===p?!0:!u||!p?!1:u.id===p.id&&u.paintedEntityId===p.paintedEntityId&&Cr(u.story)===Cr(p.story),ee=u=>Array.from(We).some(p=>Ye(p,u)),S=u=>{const p=M();if(typeof p?.getHandles!="function")return;const y=Lt(()=>p.getHandles(),null),A=y?.review;if(A){if(u){if(typeof A.setActiveReviewTarget!="function")return;const x=y?.layout;Lt(()=>A.setActiveReviewTarget({entityType:"trackedChange",entityId:u.id,...u.paintedEntityId?{paintedEntityId:u.paintedEntityId}:{},origin:"panel",layoutEpoch:typeof x?.generation=="number"?x.generation:0,story:u.story??{kind:"story",storyType:"body"}}),null);return}typeof A.getActiveReviewTarget!="function"||typeof A.clearActiveReviewTarget!="function"||Lt(()=>A.getActiveReviewTarget(),null)?.entityType==="trackedChange"&&Lt(()=>A.clearActiveReviewTarget(),void 0)}},ne=(u,p)=>{je=u,tt+=1,Te+=1,p?.invalidateQueuedNavigation!==!1&&(wt+=1)},O=new Set;let P,U=!1,$=null;const Q=new Map,Z=new Set;let K=null,me=null,xe=!1,he=null,Pe=0,Je=null,nt=null,ut=null;const Ht=()=>{if(xe||U)return;xe=!0;const u=()=>{xe=!1,U||Dt()};typeof queueMicrotask=="function"?queueMicrotask(u):Promise.resolve().then(u)},He=250,Vt=5e3,Mt=u=>{U||he&&Pe<=u||(he&&clearTimeout(he),Pe=u,he=setTimeout(()=>{he=null,Pe=0,U||Dt()},Math.max(0,u-Date.now())))},sn=new WeakMap;let qn=0;const Kt=u=>{if(!u)return"none";let p=sn.get(u);return p==null&&(p=qn+=1,sn.set(u,p)),`e${p}`};let Qe=0;const Pt=e.superdoc,It=Xz(Pt),Sn=()=>{It.abortController.abort("review-mutation-started"),It.inFlight=null},tn=()=>{It.generation+=1,It.abortController=new AbortController,It.inFlight=null},hn=u=>{const p=It.activeMutationTokens;if(typeof u!="string"||u.length===0||p.has(u))return;const y=p.size===0;p.add(u),y&&Sn()},Vn=u=>{const p=It.activeMutationTokens;typeof u!="string"||!p.delete(u)||p.size===0&&tn()},pr=u=>{const p=w(),y=p?.listTrackedChanges;if(typeof y!="function")return _()?.editorVersion===2?Promise.reject(new Error("v2-tracked-changes-bridge-pending")):u();if(It.activeMutationTokens.size>0)return Promise.reject(new Error("ui-review-catalog-superseded"));const A=It.generation,x=It.inFlight;if(x?.generation===A)return x.promise;const z=It.abortController.signal,W=Me=>{if(z.aborted||A!==It.generation||Me?.reason==="review-hydration-superseded")throw new Error("ui-review-catalog-superseded");return Me},re=y.call(p,{blocking:!1,signal:z});if(!xr(re))return W(re);const fe=Promise.resolve(re).then(W);return It.inFlight={generation:A,promise:fe},fe.then(()=>{It.inFlight?.promise===fe&&(It.inFlight=null)},()=>{It.inFlight?.promise===fe&&(It.inFlight=null)}),fe};let Ur=null,Yn=new Set,wn=null,tr=0,ri=null;const on=()=>`${Kt(_())}|m${Qe}`,Ae=()=>{Ur=null,Yn=new Set},ze=u=>{for(const p of["trackChanges","trackChanges:all"]){const y=Q.get(p);if(!y?.hasSettled||!Array.isArray(y.value))continue;const A=y.value.filter(x=>{const z=oo(x);return!z||!u.has(z)});A.length!==y.value.length&&Q.set(p,{...y,value:A})}},rt=u=>{const p=()=>{if(!U)for(const z of[...O])z(P)},y=Ff(u)?u:null,A=_()?.documentMutationReadiness,x=()=>{const z=globalThis.requestAnimationFrame;return typeof z!="function"?Promise.resolve():new Promise(W=>{let re=!1;const fe=()=>{re||(re=!0,clearTimeout(Me),W())},Me=setTimeout(fe,250);z(()=>z(()=>setTimeout(fe,0)))})};if(y?.success===!0&&typeof y.txId=="string"&&y.txId.length>0&&typeof A?.whenPainted=="function")try{Promise.resolve(A.whenPainted.call(A,y)).then(x,()=>{}).then(p,p);return}catch{}p()},ft=(u,p)=>{const y=P.trackChanges,A=y.items.filter(W=>{const re=oo(W);return!re||!u.has(re)});if(A.length===y.items.length)return;je&&u.has(je.id)&&ne(null);const x=new Set;for(const W of A){const re=hm(W),fe=W,Me=re.author??re.authorEmail??fe.author??fe.authorEmail;typeof Me=="string"&&x.add(Me)}const z=y.items.length-A.length;P={...P,trackChanges:{...y,items:A,total:Math.max(A.length,y.total-z),activeId:y.activeId&&u.has(y.activeId)?null:y.activeId,authors:[...x]}},rt(p)},Et=u=>{const p=P.trackChanges,y=p.items.length>0||p.total!==0||p.activeId!==null||p.authors.length>0;wn=on(),je!==null&&ne(null),P={...P,trackChanges:{...p,items:[],total:0,activeId:null,authors:[]}},y&&rt(u)},Nt=(u,p)=>{if(u.size===0)return;const y=on(),A=Ur===y?Yn:new Set,x=new Set([...u].filter(z=>!A.has(z)));x.size!==0&&(Ur=y,Yn=new Set([...A,...x]),ze(Yn),ft(x,p))},pn=u=>Ur===u&&Yn.size>0?Yn:null,Jt=u=>{const p=on(),y=pn(p),A=u.map(Of).filter(x=>{if(x==null)return!1;const z=oo(x);return z!=null&&!y?.has(z)});for(const x of["trackChanges","trackChanges:all"])Q.set(x,{token:p,value:[...A],hasSettled:!0,inflightToken:null})},Zn=()=>`${on()}|m${mr()}|s${tr}`,Hr=u=>JSON.stringify({t:u.target??null,s:u.selectionTarget??null}),Go=["contentControls:inRange:","query:","effInline:"],Ci=120,qt=180,kn=()=>{const u=M(),p=u?.getDocumentLoadingSnapshot;if(typeof p!="function")return"unknown";const y=Lt(()=>p.call(u),null)?.sourceStage;return y==="opening"||y==="bootstrap-ready"||y==="source-loading"?"loading":y==="source-complete"||y==="source-failed"||y==="source-cancelled"?"complete":"unknown"},jn=new Map,sr=new Map,Yt=new Map;let Rn=null,$r=0,xo=0;const Bo=u=>{const p=on();jn.get(u)!==p&&(jn.set(u,p),Ht())},pc=()=>{const u=Q.get("comments");return u?.hasSettled?Array.isArray(u.value)&&u.value.length>0:u?.inflightToken!=null},gl=(u,p)=>jn.get(u)===p,Wo=()=>{const u=on();let p=!1;for(const[y,A]of sr){if(A!==u){sr.delete(y);continue}if(Yt.get(y)===u)continue;const x=Q.get(y);!x?.hasSettled||x.token!==u||x.inflightToken!=null||(Q.set(y,{...x,token:null,inflightToken:null}),Yt.set(y,u),p=!0)}p&&Ht()},_a=u=>{u==="comments"?$r+=1:xo+=1,Bo(u);let p=!1;return()=>{p||(p=!0,u==="comments"?$r=Math.max(0,$r-1):xo=Math.max(0,xo-1),(u==="comments"?$r:xo)===0&&jn.get(u)===on()&&jn.delete(u),Ht())}},we=u=>{Bo("contentControls")},Be=()=>{const u=Q.get("trackChanges");u?.hasSettled||u?.inflightToken!=null||Bo("trackChanges")},kt=()=>{const u=Q.get("comments");u?.hasSettled||u?.inflightToken!=null||Bo("comments")},it=6500,Hn=250;let Ln=0,go=0,Gr=!1,vo=null;const ki=()=>{if(U||vo)return;const u=()=>{if(vo=null,U)return;const p=Date.now()-Ln;if(oi()||p<it){vo=setTimeout(u,Hn);return}Gr=!1,Dt()};vo=setTimeout(u,0)};let Wr=null,Kr=null;const qr=()=>{const u=M();if(!u||Wr===u)return;Kr&&(Kr(),Kr=null),Wr=u;const p=u.subscribeDocumentLoading;if(typeof p!="function"){Wr=null,Er(it);return}try{const y=z=>{const W=z?.sourceStage;(W==="source-complete"||W==="source-failed"||W==="source-cancelled")&&(Rn=on(),Wo(),Ln=Math.max(Ln,Date.now()),ki())},A=p.call(u,y);typeof A=="function"&&(Kr=A);const x=u.getDocumentLoadingSnapshot;typeof x=="function"&&y(Lt(()=>x.call(u),null))}catch{Wr=null,Er(it)}},io=()=>{const u=_()?.host,p=u?.getForegroundMutationState;if(typeof p!="function")return null;const y=Lt(()=>p.call(u),null);return{active:typeof y?.active=="number"?y.active:0,pending:typeof y?.pending=="number"?y.pending:0}},oi=()=>{const u=io();return!!(u&&(u.active>0||u.pending>0))},Er=(u=Ci)=>{U||Je||(Je=setTimeout(()=>{if(Je=null,U)return;if(nt&&oi()){Er(),Dt();return}const p=nt;nt=null,p===Zn()&&bl("selection",p,mc,zi),Dt()},u))},ss=(u,p)=>{if(!io())return!1;const y=`${u}\0${p}`;return Z.has(y)?!1:(Z.add(y),Er(qt),!0)},Si=u=>{if(K==null||u===K)return me?.timer&&clearTimeout(me.timer),me=null,K=u,!1;if(me?.key===u)return me.ready?(me=null,K=u,!1):!0;me?.timer&&clearTimeout(me.timer);const p={key:u,ready:!1,timer:null};return p.timer=setTimeout(()=>{U||me!==p||(p.timer=null,p.ready=!0,Dt())},qt),me=p,!0},_i=u=>Uz(u),Aa=()=>{Ni(),Dt()};let Oi=null,Fi=!1,Bs=0;const Ia=()=>{Oi=null,Fi=!1,Bs+=1},vl=()=>{const u=_(),p=u?.documentMutationReadiness;if(!u||typeof p?.whenPainted!="function"||(Oi={editor:u,readiness:p,afterEpoch:typeof p.getRenderEpoch=="function"?Lt(()=>p.getRenderEpoch.call(p),null):null},Fi))return;Fi=!0;const y=Bs;(async()=>{for(;!U&&y===Bs;){const x=Oi;if(Oi=null,!x){Fi=!1;return}let z=!1;try{await x.readiness.whenPainted.call(x.readiness,typeof x.afterEpoch=="number"?{afterEpoch:x.afterEpoch}:void 0),z=!0}catch{}if(U||y!==Bs)return;if(_()!==x.editor){Ia();return}z&&Aa()}})()},yl=()=>{ut&&clearTimeout(ut),ut=setTimeout(()=>{ut=null,U||Aa()},500)},bl=(u,p,y,A)=>{let x;try{x=y()}catch{x=void 0}if(!xr(x)){const re={token:p,value:A(x),hasSettled:!0,inflightToken:null,failedToken:null,failureCount:0,retryAtMs:0};return Q.set(u,re),re}const z=Q.get(u),W=z?.failedToken===p;return Q.set(u,{token:z?.token??null,value:z?.value??null,hasSettled:z?.hasSettled??!1,inflightToken:p,failedToken:W?p:null,failureCount:W?z.failureCount??0:0,retryAtMs:0}),Promise.resolve(x).then(re=>{const fe=Q.get(u);!fe||fe.inflightToken!==p||(Q.set(u,{token:p,value:A(re),hasSettled:!0,inflightToken:null,failedToken:null,failureCount:0,retryAtMs:0}),Ht())},()=>{const re=Q.get(u);if(!re||re.inflightToken!==p)return;const fe=re.failedToken===p?(re.failureCount??0)+1:1,Me=Math.min(Vt,He*2**Math.min(fe-1,8)),Ue=Date.now()+Me;Q.set(u,{...re,inflightToken:null,failedToken:p,failureCount:fe,retryAtMs:Ue}),Mt(Ue)}),null},Tr=(u,p,y,A)=>{const x=Q.get(u);if(x&&x.token===p&&x.hasSettled)return{value:x.value,status:"ready"};if(sV(u)&&!gl(u,p)){if(kn()==="loading")return Gr=!0,qr(),x?.hasSettled?{value:x.value,status:"stale"}:{value:null,status:"pending"};if(Gr)return ki(),x?.hasSettled?{value:x.value,status:"stale"}:{value:null,status:"pending"};if(Date.now()-go<it)return Gr=!0,ki(),x?.hasSettled?{value:x.value,status:"stale"}:{value:null,status:"pending"}}if(oi())return Er(),x?.hasSettled?{value:x.value,status:"stale"}:{value:null,status:"pending"};if(x?.failedToken===p&&x.inflightToken==null&&(x.retryAtMs??0)>Date.now())return Mt(x.retryAtMs),x.hasSettled?{value:x.value,status:"stale"}:{value:null,status:"pending"};if(!x&&u.startsWith("effInline:")&&Si(u))return{value:null,status:"pending"};if(!x&&ss(u,p))return{value:null,status:"pending"};if(!x||x.inflightToken!==p){const W=bl(u,p,y,A);if(W)return{value:W.value,status:"ready"}}const z=Q.get(u);return z?.hasSettled?{value:z.value,status:"stale"}:{value:null,status:"pending"}},Nf=u=>{for(const p of Q.keys())u(p)&&Q.delete(p)},wl=u=>{const p=Hr(u),y=wA(u);return new Set([`contentControls:inRange:${p}`,`query:${p}`,...y?[`effInline:${y}`]:[]])},Bf=u=>{const p=wl(u);Nf(y=>Go.some(A=>y.startsWith(A))&&!p.has(y));for(const y of Z){const A=y.split("\0",1)[0];Go.some(x=>A.startsWith(x))&&!p.has(A)&&Z.delete(y)}},as=()=>{const u=_();u!==ri&&(Ia(),ri=u,Q.clear(),he&&clearTimeout(he),he=null,Pe=0,me?.timer&&clearTimeout(me.timer),me=null,K=null,C=null,o=null,nt=null,Z.clear(),jn.clear(),sr.clear(),Yt.clear(),Rn=null,Gr=!1,Kr&&Kr(),Kr=null,Wr=null,Ae(),wn=null)},Ni=()=>{Qe+=1,sr.clear(),Yt.clear(),Rn=null,Ae()},Cl=()=>{const u=wn===on();Ni(),u&&(Jt([]),wn=on()),Dt()},Tu=u=>{if(typeof u!="string"||u.length===0)return Xn("insertText requires a non-empty string.","INVALID_INPUT");if(mr()==="viewing")return Xn("The document is read-only.","DOCUMENT_READONLY");const p=b(),y=p?.insert;if(!p||typeof y!="function")return Xn("insert is unavailable.");const A=p.selection?.current;if(typeof A!="function")return Xn("selection.current is unavailable.");const x=W=>{const re=W&&typeof W=="object"?W:null,fe=re?.selectionTarget??re?.target??null;return!fe||typeof fe!="object"?Xn("insertText requires a live selection target.","PRECONDITION_FAILED"):Lt(()=>Dl(y.call(p,{type:"text",value:u,target:fe}),Xn("insert failed.")),Xn("insert failed."))};let z;try{z=A.call(p.selection)}catch{return Xn("insertText could not resolve the live selection.","PRECONDITION_FAILED")}return xr(z)?Promise.resolve(z).then(x,()=>Xn("insertText could not resolve the live selection.","PRECONDITION_FAILED")):x(z)},Ru=(u,p)=>({payload:u,state:P,editor:_(),superdoc:t,context:p,ui:$,execute:(y,A)=>Ac(y,A),executeAsync:(y,A)=>Em(y,A),doc:b(),selection:P.selection,documentMode:mr(),insertText:Tu}),Bi=u=>u==="editing"||u==="suggesting"||u==="viewing"?u:null,mr=()=>{const u=_(),p=t&&typeof t=="object"?t:null,y=Bi(p?.config?.documentMode),A=Lt(typeof p?.getActiveRuntime=="function"?()=>{const W=p.getActiveRuntime();return typeof W?.getSnapshot=="function"?W.getSnapshot():null}:void 0,null),x=Bi(A?.documentMode),z=Bi(u?.options?.documentMode);return y&&x&&y!==x?y:x??y??z},zf=()=>{const u=t&&typeof t=="object"?t:null,p=u?.interactionConfig?.comments;if(p&&typeof p.readOnly=="boolean")return p.readOnly===!0;const y=u?.config?.modules?.comments;return!!y&&typeof y=="object"&&y.readOnly===!0},ii=()=>{const u=t&&typeof t=="object"?t:null,p=u?.interactionConfig?.comments;if(p&&typeof p.allowResolve=="boolean")return p.allowResolve===!1;const y=u?.config?.modules?.comments;return!!y&&typeof y=="object"&&y.allowResolve===!1},zs=()=>mr()==="viewing"||zf(),zi=u=>u&&typeof u=="object"?u:null,Vs=(u,p)=>{if(!u)return{...rV,status:p};const y=u.target??null,A=typeof u.text=="string"?u.text:"";return{status:p,empty:u.empty===!0,target:y,selectionTarget:u.selectionTarget??null,activeMarks:Array.isArray(u.activeMarks)?u.activeMarks:[],activeCommentIds:Array.isArray(u.activeCommentIds)?u.activeCommentIds:[],activeChangeIds:Array.isArray(u.activeChangeIds)?u.activeChangeIds:[],quotedText:A}},js=()=>{const u=b()?.selection;return Tr("selection",Zn(),()=>u?.current?u.current({includeText:!0}):void 0,zi)},kl=()=>{const{value:u,status:p}=js();return Vs(u,p)},mc=()=>{const u=b()?.selection;return u?.current?u.current({includeText:!0}):void 0},gc=u=>{if(u.empty!==!0)return!1;const p=u.selectionTarget,y=p?.start,A=p?.end;return y?.kind==="text"&&A?.kind==="text"&&typeof y.blockId=="string"&&y.blockId===A.blockId&&typeof y.offset=="number"&&y.offset===A.offset},Sl=u=>{const p=M(),y=p?.readLiveSelectionSyncSnapshot;if(typeof y!="function")return;const A=zi(Lt(()=>y.call(p),null));if(!A||!gc(A))return;const x=Zn(),z=io(),W=!!(z&&(z.active>0||z.pending>0));if(W)nt=x,Er();else if(nt=null,bl("selection",x,mc,zi))return;const re=Q.get("selection"),fe=Array.isArray(A.activeMarks)&&A.activeMarks.length>0?A.activeMarks:Array.isArray(P.selection.activeMarks)?P.selection.activeMarks:[],Me=Array.isArray(A.activeCommentIds)?A.activeCommentIds:[],Ue=uV(u),$e=pl(P.selection),qe=Pf(A.selectionTarget)??Pf(A.target),Ze=$e?.range,Ge=qe?.range,et=!!(z&&z.active>0&&$e&&qe&&$e.blockId===qe.blockId&&Cr($e.story)===Cr(qe.story)&&typeof Ze?.start=="number"&&typeof Ge?.start=="number"&&Math.abs(Ge.start-Ze.start)<=2),ht=Ue!=null||et?P.selection.activeChangeIds.filter(ot=>Ue==null||Os(P.trackChanges.items).aliasesFor(ot).includes(Ue)):[],dt=Array.isArray(A.activeChangeIds)&&A.activeChangeIds.length>0?A.activeChangeIds:ht;Q.set("selection",{token:x,value:{...A,activeMarks:fe,activeCommentIds:Me,activeChangeIds:dt},hasSettled:!0,inflightToken:W?null:re?.inflightToken??null})},ls=async(u=0)=>{const p=b()?.selection,y=p?.current,A=Zn();if(typeof y!="function")return Q.set("selection",{token:A,value:null,hasSettled:!0,inflightToken:null}),Dt(),P.selection;let x;try{x=y.call(p,{includeText:!0}),xr(x)&&(x=await Promise.resolve(x))}catch{x=null}return U?Vs(null,"pending"):Zn()!==A?u<1?ls(u+1):P.selection:(Q.set("selection",{token:A,value:zi(x),hasSettled:!0,inflightToken:null}),Dt(),P.selection)},vc=()=>{const u=b()?.comments;return Tr("comments",on(),()=>u?.list?u.list():void 0,p=>p&&Array.isArray(p.items)?p.items:[])},Us=(u="trackChanges")=>{const p=on(),y=b()?.trackChanges,A=w(),x=typeof A?.listTrackedChanges=="function"?A.listTrackedChanges:null,z=Tr(u,p,()=>x?pr(()=>y?.list?.({in:"all"})):y?.list?y.list({in:"all"}):void 0,W=>{const re=W&&typeof W=="object"?W:null;if(re?.complete===!1||re?.sourceCoverageComplete===!1){if(sr.set(u,p),qr(),Rn===p||kn()==="complete"){const fe=()=>{U||Wo()};typeof queueMicrotask=="function"?queueMicrotask(fe):Promise.resolve().then(fe)}}else sr.get(u)===p&&sr.delete(u);return re&&Array.isArray(re.items)?re.items:[]});return sr.get(u)===p&&z.status==="ready"?{...z,status:"stale"}:z},Vf=u=>{const p=L(),y=N(),A=y?null:vc(),x=y&&Array.isArray(p?.commentItems)?p.commentItems:null,z=y?x:A.value,W=y?H(p):A.status,re=z??[],fe=u.activeCommentIds,Me=Q.get("comments"),Ue=Me?.token===on()&&Me.hasSettled&&Array.isArray(Me.value)?Me.value:null,$e=$r>0?Ue:re;Re&&$e&&!$e.some(Ze=>oo(Ze)===Re)&&(Re=null);const qe=Re??fe[0]??null;return{status:hl(W,u.status),listStatus:W,items:re,total:re.length,activeIds:fe,activeId:qe}},yc=new WeakMap,Vi=u=>{const p=yc.get(u);if(p)return p;const y=u.map(Of).filter(A=>A!=null);return yc.set(u,y),y},_l=new WeakMap,xa=(u,p)=>{const y=_l.get(u);if(y?.suppressedIds===p)return y.value;const A=p?u.filter(x=>{const z=oo(x);return!z||!p.has(z)}):u;return _l.set(u,{suppressedIds:p,value:A}),A},Rr=new WeakMap,bc=u=>{const p=Rr.get(u);if(p)return p;const y=new Set;for(const x of u){const z=hm(x),W=x,re=z.author??z.authorEmail??W.author??W.authorEmail;typeof re=="string"&&y.add(re)}const A=[...y];return Rr.set(u,A),A},si=()=>{const u=on();if(N()){const A=Q.get("trackChanges"),x=A?.token===u&&A.hasSettled&&Array.isArray(A.value)?A.value:L()?.trackedChangeItems;return Array.isArray(x)?Vi(x):null}const{value:p,status:y}=Us("trackChanges:all");return y==="ready"?Vi(p??[]):null},wc=u=>{const p=on(),y=pn(p),A=L(),x=N(),z=x?null:Us(),W=x&&Array.isArray(A?.trackedChangeItems)?A.trackedChangeItems:null,re=x?W:z.value,fe=x?H(A):z.status,Me=xa(Vi(re??[]),y),Ue=si(),$e=je;if($e&&!We.has($e)){const zt=Q.get("trackChanges"),Gn=zt?.token===p&&zt.hasSettled&&Array.isArray(zt.value)?xa(Vi(zt.value),y):null,Wn=xo>0?Gn:$e.story?Ue:Me;Wn&&!Wn.some(Jr=>Di(Jr,$e.id,$e.story))&&ne(null)}const qe=Ue??Me,Ze=dc(qe,rs(u)),Ge=wn===p?[]:y?u.activeChangeIds.filter(zt=>!y.has(zt)):u.activeChangeIds,et=Ge.map(zt=>Ze.toPublicId(zt)??zt),ht=je?.story?dc(qe,je.story):Os(qe),dt=je?ht.toPublicId(je.id)??je.id:null,ot=pV({selectionIds:Ge,publicIds:et,selection:u,bodyItems:Me,allStoryItems:Ue}),Bt=dt??ot;return{status:hl(fe,u.status),items:Me,total:Me.length,activeId:Bt,authors:bc(Me)}},Lu=(u,p)=>{if(!N())return p;Bo("comments");const y=vc(),A=y.value??p.items;return{status:hl(y.status,u.status),listStatus:y.status,items:A,total:A.length,activeIds:u.activeCommentIds,activeId:Re??u.activeCommentIds[0]??null}},ji=(u,p)=>{if(!N())return p;Bo("trackChanges");const y=Us(),A=pn(on()),x=xa(Vi(y.value??p.items),A),z=je?.story?dc(x,je.story):Os(x),W=je?z.toPublicId(je.id)??je.id:p.activeId;return{status:hl(y.status,u.status),items:x,total:x.length,activeId:W,authors:bc(x)}},Cc=u=>{const p=b()?.contentControls,{value:y,status:A}=Tr("contentControls",on(),()=>p?.list?p.list():void 0,re=>re&&Array.isArray(re.items)?re.items:[]),x=y??[],{ids:z,status:W}=jf(p,u);return{status:hl(A,W,u.status),items:x,total:x.length,activeId:z[0]??null,activeIds:z}},Hs=(u,p)=>{if(!u||typeof u.listInRange!="function")return{lockModesById:new Map,status:"ready"};const y=gV(p);if(!y)return{lockModesById:new Map,status:"ready"};const{value:A,status:x}=Tr(`contentControls:inRange:${Hr(p)}`,on(),()=>u.listInRange(y),re=>re&&Array.isArray(re.items)?re.items:[]),z=A??[],W=new Map;for(const re of z)typeof re?.id=="string"&&W.set(re.id,typeof re.lockMode=="string"?re.lockMode:"unlocked");return{lockModesById:W,status:x}},jf=(u,p)=>{const{lockModesById:y,status:A}=Hs(u,p);return{ids:[...y.keys()],status:A}},Mu=()=>{const u=t?.fonts;return{options:$V(UV(Lt(u?.getDocumentFontOptions?()=>u.getDocumentFontOptions():void 0,[])),HV(Lt(u?.getFontFamilyOptions?()=>u.getFontFamilyOptions():void 0,[]))),sizeOptions:GV}},kc=()=>{const u=Lt(t?.getZoomState?()=>t.getZoomState():void 0,null),p=typeof u?.value=="number"?u.value:100,y=u?.mode;return{mode:y==="manual"||y==="fit-width"?y:y==="fixed"?"manual":null,value:p,min:typeof u?.min=="number"?u.min:10,max:typeof u?.max=="number"?u.max:100}},Pu=()=>Lt(t?.getMeasurementUnit?()=>t.getMeasurementUnit():void 0,"in")==="cm"?"cm":"in",Uf=()=>{const u=_();return{ready:u!=null,mode:mr(),dirty:u?!!u.isDirty:!1}},Al=u=>{const p=u.quotedText;if(typeof p!="string"||p.length===0)return null;const y=xu(u);if(y.length===0||!fc(y.map(z=>z.blockId)))return null;const A=u.target,x=y.length===1?Ao(y[0].blockId,A?.story):void 0;return{select:{type:"text",pattern:p,mode:"contains",caseSensitive:!0},...x?{within:x}:{},require:"any"}},Hf=u=>{const p=b()?.query;if(typeof p?.match!="function")return null;const y=Al(u);if(!y)return null;const{value:A}=Tr(`query:${Hr(u)}`,on(),()=>p.match(y),x=>x&&typeof x=="object"?x:null);return CA(A,u)},Du=u=>{const p=M(),y=new Set(Br(u));if(y.size===0)return{};const A=p?.readMountedProjectionBlocksByIds,x=p?.readMountedProjectionBlocks;if(typeof A!="function"&&typeof x!="function")return{};const z=Lt(()=>{if(typeof A!="function")return x.call(p);const et=os(u);return et?A.call(p,[...y],et):A.call(p,[...y])},null);if(!Array.isArray(z))return{};const W=c2(z),re=et=>{const ht={},dt=a2(et.fontFamily);dt&&(ht.fontFamily=dt);const ot=xV(et.fontSize);return ot&&(ht.fontSize=ot),typeof et.color=="string"&&et.color.trim()!==""&&(ht.color=et.color.trim().toUpperCase()),typeof et.highlight=="string"&&et.highlight.trim()!==""&&(ht.highlight=et.highlight.trim().toUpperCase()),ht},fe=pl(u),Me=fe&&typeof fe.range?.start=="number"?fe.range.start:null;if(fe&&Me!==null&&y.has(fe.blockId)){const et=W.find(dt=>hc(dt,fe.blockId)),ht=et&&Array.isArray(et.runs)?et.runs:null;if(ht&&ht.length>0&&ht.every(dt=>dt?.kind==="text"||dt?.kind==="tab")){let dt=0,ot=null;for(const Bt of ht){const zt=mm(Bt);if(Me>=dt&&Me<dt+zt){ot=Bt;break}dt+=zt}if(!ot){for(let Bt=ht.length-1;Bt>=0&&!ot;Bt-=1)ht[Bt]?.kind==="text"&&(ot=ht[Bt]);ot??=ht[ht.length-1]??null}return ot?re(ot):{}}}const Ue=xu(u);if(Ue.length>0){const et=new Set,ht=new Set;let dt=!1,ot=!0;for(const Bt of Ue){const zt=W.find(Jr=>hc(Jr,Bt.blockId));if(!zt)return{};const Gn=Array.isArray(zt.runs)?zt.runs:[];if(Gn.length===0)continue;if(!Gn.every(Jr=>Jr?.kind==="text"||Jr?.kind==="tab")){ot=!1;break}let Wn=0;for(const Jr of Gn){const eo=mm(Jr),Sr=Wn,Pr=Wn+eo;if(Sr<Bt.end&&Pr>Bt.start){dt=!0;const Yo=re(Jr);Yo.fontFamily&&et.add(Yo.fontFamily),Yo.fontSize&&ht.add(Yo.fontSize)}Wn=Pr}}if(ot&&dt){const Bt={};return et.size===1&&(Bt.fontFamily=[...et][0]),ht.size===1&&(Bt.fontSize=[...ht][0]),Bt}}const $e=new Set,qe=new Set;let Ze=!1;for(const et of W){if(![...y].some(dt=>hc(et,dt)))continue;const ht=Array.isArray(et.runs)?et.runs:[];for(const dt of ht){if(dt?.kind!=="text")continue;Ze=!0;const ot=re(dt);ot.fontFamily&&$e.add(ot.fontFamily),ot.fontSize&&qe.add(ot.fontSize)}}if(!Ze)return{};const Ge={};return $e.size===1&&(Ge.fontFamily=[...$e][0]),qe.size===1&&(Ge.fontSize=[...qe][0]),Ge},Ou=u=>{const p=M(),y=new Set(Br(u));if(y.size===0)return{};const A=p?.readMountedProjectionBlocksByIds,x=p?.readMountedProjectionBlocks;if(typeof A!="function"&&typeof x!="function")return{};const z=Lt(()=>{if(typeof A!="function")return x.call(p);const Ge=os(u);return Ge?A.call(p,[...y],Ge):A.call(p,[...y])},null);if(!Array.isArray(z))return{};const W=c2(z),re=Ge=>({bold:Ge.bold===!0,italic:Ge.italic===!0,underline:Ge.underline!=null,strikethrough:Ge.strike===!0}),fe=Ge=>{const et={};for(const ht of Df){const dt=Ge[ht];dt.size===1&&(et[ht]=[...dt][0])}return et},Me=pl(u),Ue=Me&&typeof Me.range?.start=="number"?Me.range.start:null;if(Me&&Ue!==null&&y.has(Me.blockId)){const Ge=W.find(ht=>hc(ht,Me.blockId)),et=Ge&&Array.isArray(Ge.runs)?Ge.runs:null;if(et&&et.length>0&&et.every(ht=>ht?.kind==="text"||ht?.kind==="tab")){let ht=0,dt=null;for(const ot of et){const Bt=mm(ot);if(Ue>=ht&&Ue<ht+Bt){dt=ot;break}ht+=Bt}if(!dt){for(let ot=et.length-1;ot>=0&&!dt;ot-=1)et[ot]?.kind==="text"&&(dt=et[ot]);dt??=et[et.length-1]??null}return dt?re(dt):{}}}const $e=xu(u);if($e.length>0){const Ge={bold:new Set,italic:new Set,underline:new Set,strikethrough:new Set};let et=!1,ht=!0;for(const dt of $e){const ot=W.find(Gn=>hc(Gn,dt.blockId));if(!ot)return{};const Bt=Array.isArray(ot.runs)?ot.runs:[];if(Bt.length===0)continue;if(!Bt.every(Gn=>Gn?.kind==="text"||Gn?.kind==="tab")){ht=!1;break}let zt=0;for(const Gn of Bt){const Wn=mm(Gn),Jr=zt,eo=zt+Wn;if(Jr<dt.end&&eo>dt.start){et=!0;const Sr=re(Gn);for(const Pr of Df)Ge[Pr].add(Sr[Pr])}zt=eo}}if(ht&&et)return fe(Ge)}const qe={bold:new Set,italic:new Set,underline:new Set,strikethrough:new Set};let Ze=!1;for(const Ge of W){if(![...y].some(ht=>hc(Ge,ht)))continue;const et=Array.isArray(Ge.runs)?Ge.runs:[];for(const ht of et){if(ht?.kind!=="text")continue;Ze=!0;const dt=re(ht);for(const ot of Df)qe[ot].add(dt[ot])}}return Ze?fe(qe):{}},Fu=(u,p)=>{if(p.fontFamily!==void 0&&p.fontSize!==void 0&&p.color!==void 0&&p.highlight!==void 0)return{values:p,effectiveUniformityStatus:"ready"};const y=Du(u),A={...y.fontFamily!==void 0?{fontFamily:y.fontFamily}:{},...y.fontSize!==void 0?{fontSize:y.fontSize}:{},...y.color!==void 0?{color:y.color}:{},...y.highlight!==void 0?{highlight:y.highlight}:{},...p};if(!u.empty&&(A.fontFamily===void 0||A.fontSize===void 0)){const x=ai(u);return x.values&&(A.fontFamily===void 0&&x.values.fontFamily!==void 0&&(A.fontFamily=x.values.fontFamily),A.fontSize===void 0&&x.values.fontSize!==void 0&&(A.fontSize=x.values.fontSize)),{values:A,effectiveUniformityStatus:x.status}}return{values:A,effectiveUniformityStatus:"ready"}},Nu=["fontFamily","fontSize","bold","italic","underline","strikethrough"],Bu=u=>{const p=u.selectionTarget;if(!p)return{value:null,status:"ready"};const y=yr(b(),"format.readEffectiveInlineUniformity");if(!y)return{value:null,status:"ready"};const A=wA(u)??Hr(u);return Tr(`effInline:${A}`,on(),()=>y({target:p,offsetSpace:"selection",keys:Nu}),x=>x&&typeof x=="object"?x:null)},ai=u=>{const{value:p,status:y}=Bu(u);if(!p||p.success!==!0)return{values:null,status:y};const A=p.values,x=z=>{const W=A?.[z];if(!(!W||W.state!=="uniform"||typeof W.value!="string"))return z==="fontFamily"?a2(W.value):W.value};return{values:{fontFamily:x("fontFamily"),fontSize:x("fontSize")},status:y}},Sc=u=>{const{value:p,status:y}=Bu(u);if(!p||p.success!==!0)return{values:null,status:y};const A=p.values,x={};for(const z of Df){const W=A?.[z];W?.state==="uniform"&&(W.value==="true"||W.value==="false")&&(x[z]=W.value==="true")}return{values:x,status:y}},Il=(u,p)=>{const y=u.activeMark;if(!y||!Df.includes(y))return null;const A=y,x=Ou(p)[A];if(x!==void 0)return x;const{values:z}=Sc(p),W=z?.[A];return W!==void 0?W:null},$f=async u=>{const p=u.selectionTarget;if(!p)return null;const y=yr(b(),"format.readEffectiveInlineUniformity");if(!y)return null;try{const A=await Promise.resolve(y({target:p,offsetSpace:"selection"}));return A&&typeof A=="object"&&A.success===!0?A:null}catch{return null}},Gf=(u,p,y)=>{const A=y.values;for(const x of["fontFamily","fontSize"]){if(p[x]!==void 0)continue;const z=A?.[x];z?.state==="uniform"&&typeof z.value=="string"?u[x]=x==="fontFamily"?a2(z.value):z.value:delete u[x]}},$s=u=>Fu(u,kA(Hf(u),u)),xl=u=>$s(u).values,Wf=async u=>{const p=b()?.query,y=Al(u);if(typeof p?.match!="function"||!y)return xl(u);try{const A=await Promise.resolve(p.match(y)),x=kA(CA(A&&typeof A=="object"?A:null,u),u),z=Fu(u,x);if(z.effectiveUniformityStatus!=="ready"&&(x.fontFamily===void 0||x.fontSize===void 0)){const W=await $f(u);W&&Gf(z.values,x,W)}return z.values}catch{return xl(u)}},El=async u=>{const p=b();if(p)return typeof p.getNode=="function"?await Promise.resolve(p.getNode(u)):await Promise.resolve(p.getNodeById?.({nodeId:u.nodeId,nodeType:u.nodeType}))},_c=u=>{const p=b()?.query;if(typeof p?.match!="function")return"ready";const y=Al(u);if(!y)return"ready";const{status:A}=Tr(`query:${Hr(u)}`,on(),()=>p.match(y),x=>x&&typeof x=="object"?x:null);return A},zu=u=>{const p=$s(u),y=p.values;if(u.empty)return p;const A=Sa(u);return A?u.status==="ready"&&_c(u)==="ready"&&p.effectiveUniformityStatus==="ready"?(C={key:A,values:y},p):C&&C.key===A?{...p,values:{...C.values,...y}}:p:p},Vu=u=>{const p=b(),y=zu(u),A=y.values;u.status==="ready"&&!u.empty&&_c(u)==="ready"&&y.effectiveUniformityStatus==="ready"&&(v=A,k=`${cc(u)}:${on()}`);const x=p?.contentControls,{lockModesById:z}=Hs(x,u),W={};for(const re of Lr())W[re]=Hu(re,p,u,A,z);return W},zo=u=>u?lt.operationUnavailable:_()?lt.documentApiUnavailable:lt.notReady,Ea=u=>u==="contentLocked"||u==="sdtContentLocked",cs=u=>{for(const p of u.values())if(Ea(p))return lt.contentControlLocked},ju=(u,p,y,A,x)=>{if(!p)return u.scope==="all"?lt.bulkDecisionsDisabled:zo(x);if(y)return lt.documentReadonly;if(u.scope!=="all"&&A.activeChangeIds.length===0)return lt.selectionRequired},Kf=u=>{const p=M(),y=Lt(typeof p?.getCapabilities=="function"?()=>p.getCapabilities():void 0,null)?.editableSubset?.commands;if(Array.isArray(y))return y.find(A=>A?.command===u||A?.id===u)??null;if(y&&typeof y=="object"){const A=y[u];return A&&typeof A=="object"?A:null}return null},Uu=(u,p)=>{if(u.scope!=="all"||typeof p?.[`${u.kind}All`]=="function")return;const y=Kf(`trackedChanges.${u.kind}All`);if(!(y&&(y.status==="supported"||y.enabled===!0)))return lt.bulkDecisionsDisabled},Hu=(u,p,y,A,x=new Map)=>{if(oe.has(u))return rn({supported:!0,enabled:!0,...Lt(oe.get(u).getState?()=>oe.get(u).getState(Ru(void 0)):void 0,{})},"custom");const z=mr()==="viewing",W=uA(u);if(W&&typeof se()?.lists?.apply=="function"){const Ze=Ve(),Ge=typeof Ze?.shippedStatus=="string"?Ze.shippedStatus:null,et=Ge!=="not-shipped"&&Ge!=="disabled";return rn({enabled:et&&(typeof Ze?.enabled=="boolean"?Ze.enabled:!0),active:(et?ge(Ze):null)===W,supported:et,value:Ze?.value},"builtin")}const re=gm(u);if(re){const Ze=p?.trackChanges,Ge=typeof Ze?.decide=="function"||typeof Ze?.[re.kind]=="function",et=typeof Ze?.decide=="function"||typeof Ze?.[`${re.kind}All`]=="function",ht=re.scope==="all"?et:Ge,dt=Uu(re,Ze)??ju(re,ht,zs(),y,p);return rn({enabled:dt==null,active:!1,supported:ht,reason:dt},"builtin")}if(u==="copy-format")return mr()==="viewing"?rn({supported:!0,enabled:!1,active:!1},"builtin"):_()?rn({supported:!0,enabled:!0,active:h.mode!=="idle"},"builtin"):rn({supported:!0,enabled:!1,active:!1,reason:lt.notReady},"builtin");const fe=ku(u);if(!fe)return rn({enabled:!1,active:!1,supported:!1,reason:lt.commandUnsupported},"unsupported");if(fe.disposition!=="routed")return rn({enabled:!1,active:!1,supported:!1,reason:fe.reason??lt.commandUnsupported},fe.disposition==="unsupported"?"unsupported":"builtin");if(fe.instanceRoute)return st(fe);if(fe.table)return gt(fe,p,z);if(fe.inline?.kind==="clear"){if(fe.mutates&&z)return rn({enabled:!1,active:!1,supported:!0,reason:lt.documentReadonly},"builtin");const Ze=cs(x);if(Ze)return rn({enabled:!1,active:!1,supported:!0,reason:Ze},"builtin");const Ge=Br(y).length>0||Eu(y)!=null;return rn({enabled:Ge,active:!1,supported:!0,reason:Ge?void 0:lt.selectionRequired},"builtin")}const Me=fe.docRoute;if(!Me)return rn({enabled:!1,active:!1,supported:!1,reason:lt.commandUnsupported},"unsupported");if(yr(p,Me)==null)return rn({enabled:!1,active:!1,supported:!1,reason:zo(p)},"builtin");const Ue=be(u);if(Ue){const Ze=Ue.shippedStatus,Ge=Ze!=="not-shipped"&&Ze!=="disabled",et=typeof Ue.enabled=="boolean"?Ue.enabled:!0,ht=u==="undo"||u==="redo",dt=ht&&Ue.historyResolved===!1,ot=ht&&Ge&&et===!1&&Ue.reason===null&&!dt,Bt=Ue.reason===void 0?void 0:ot?lt.historyEmpty:dt?lt.notReady:n2(Ue.reason,lt.commandUnsupported);return fe.mutates&&z?rn({enabled:!1,active:!1,supported:Ge,reason:lt.documentReadonly},"builtin"):rn({enabled:Ge&&et,active:!1,supported:Ge,reason:Bt},"builtin")}const $e=Tl(fe,p,y),qe=La(fe,p,y,A);if(fe.list?.mode==="indent"||fe.list?.mode==="outdent")return De(fe,p,z,y,$e,qe);if(fe.list?.mode==="toggle-seed")return Ke(fe,p,z,y,$e,qe);if(fe.mutates&&z)return rn({enabled:!1,active:$e,supported:!0,value:qe,reason:lt.documentReadonly},"builtin");if(fe.inline&&!Eu(y)){const Ze=cs(x);return rn(Ze?{enabled:!1,active:$e,supported:!0,value:qe,reason:Ze}:Br(y).length>0&&typeof M()?.setPendingInlineFormat=="function"?{enabled:!0,active:$e,supported:!0,value:qe}:{enabled:!1,active:$e,supported:!0,value:qe,reason:lt.rangeSelectionRequired},"builtin")}if((fe.blockParagraph||fe.list)&&Br(y).length===0)return rn({enabled:!1,active:$e,supported:!0,value:qe,reason:lt.selectionRequired},"builtin");if(fe.link&&!$e&&i2(y).length===0&&!pl(y))return rn({enabled:!1,active:$e,supported:!0,reason:lt.rangeSelectionRequired},"builtin");if(fe.inline){const Ze=cs(x);if(Ze)return rn({enabled:!1,active:$e,supported:!0,value:qe,reason:Ze},"builtin")}return rn({enabled:!0,active:$e,supported:!0,value:qe},"builtin")};function Ta(u,p){const y=u.address?.anchor,A=y?.start,x=y?.end,z=typeof A?.blockId=="string"?A.blockId:null,W=typeof x?.blockId=="string"?x.blockId:null;if(!z||!W)return!1;const re=typeof A?.offset=="number"?A.offset:null,fe=typeof x?.offset=="number"?x.offset:null;if(re==null||fe==null)return!1;const Me=p.target,Ue=Me&&Array.isArray(Me.segments)?Me.segments:[];for(const $e of Ue){const qe=typeof $e?.blockId=="string"?$e.blockId:null;if(!qe)continue;const Ze=$e.range,Ge=typeof Ze?.start=="number"?Ze.start:null,et=typeof Ze?.end=="number"?Ze.end:null;if(!(Ge==null||et==null)){if(z!==W){if(qe===z&&et>re||qe===W&&Ge<fe)return!0;continue}if(qe===z){if(Ge===et){if(Ge>=re&&Ge<=fe)return!0;continue}if(Math.max(Ge,re)<Math.min(et,fe))return!0}}}return!1}const Ra=(u,p)=>{const y=u?.hyperlinks;if(!y||typeof y.list!="function")return null;const A=Br(p);if(!fc(A))return null;for(const x of A){const z={kind:"block",nodeType:"paragraph",nodeId:x},{value:W}=Tr(`hyperlinks:${x}`,on(),()=>y.list({within:z}),fe=>fe&&typeof fe=="object"?fe:null),re=(W&&Array.isArray(W.items)?W.items:[]).find(fe=>Ta(fe,p));if(re)return re}return null},Tl=(u,p,y)=>{if(u.link)return Ra(p,y)!=null;if(u.list?.mode==="toggle-seed"&&u.list.seed)return $u(p,y)===u.list.seed;const A=D(u);if(A!==null)return A;const x=r.get(u.id),z=Sa(y);if(z&&x?.selectionSignature===z)return x.active;const W=Il(u,y);return W!==null?W:WV(u,y)},La=(u,p,y,A)=>{if(u.inline&&s2(u.inline.key)){const x=B(u);if(x!==void 0)return x;const z=A[u.inline.key];if(z!==void 0)return z;const W=Sa(y),re=W?n.get(u.inline.key):void 0;if(W&&re?.selectionSignature===W)return re.value}if(u.id==="linked-style"){const{style:x}=Xr(y,ar().cache);return!x.styleId||x.mixed?void 0:{styleId:x.styleId,styleName:x.styleName}}if(u.id==="text-align")return le(p,y);if(u.id==="link")return ct(p,y)??void 0},Yr=(u,p,y)=>{const A=u?.lists;if(!A)return{value:null,status:"ready"};const x=y.storyType==="body",z=typeof A.getStateInStory=="function"?()=>A.getStateInStory({target:ka(p),story:y}):x&&typeof A.getState=="function"?()=>A.getState({target:ka(p)}):null;if(!z)return{value:null,status:"ready"};const{value:W,status:re}=Tr(`lists:${Cr(y)}:${p}`,on(),z,fe=>fe&&typeof fe=="object"?fe:null);return{value:W?.success===!0?W:null,status:re}},Ma=(u,p,y)=>Yr(u,p,y).value,Rl=(u,p,y)=>{const A=Ma(u,p,y);return!A||A.isListItem!==!0?null:A.seed==="bullet"||A.seed==="ordered"?A.seed:null},Pa=(u,p,y)=>{const A=Yr(u,p,y),x=A.value;return{value:x&&typeof x.isListItem=="boolean"?x.isListItem:null,status:A.status}},$u=(u,p)=>{const y=Br(p);if(y.length===0||!fc(y))return null;const A=rs(p),x=Rl(u,y[0],A);if(x!=="bullet"&&x!=="ordered")return null;for(const z of y.slice(1))if(Rl(u,z,A)!==x)return null;return x},Da=(u,p,y)=>{if(!u)return{value:null,status:"ready",refreshing:!1};const A=Cr(y),x=A==="story:body";if(x&&typeof u.getNodeById!="function")return{value:null,status:"ready",refreshing:!1};if(!x&&typeof u.getNode!="function")return{value:null,status:"ready",refreshing:!1};const z=`node:${A}:${p}`,W=on(),re=Tr(z,W,()=>x?u.getNodeById({nodeId:p,nodeType:"paragraph"}):u.getNode(Ao(p,y)),Me=>Me&&typeof Me=="object"?Me:null),fe=Q.get(z);return{...re,refreshing:re.status==="stale"&&fe?.inflightToken===W&&fe.failedToken!==W}},Ll=u=>u==="left"||u==="center"||u==="right"||u==="justify"?u:void 0,I=u=>u==="start"||u==="end"||u==="distributed"||u==="numTab"||u==="lowKashida"||u==="mediumKashida"||u==="highKashida"||u==="thaiDistribute",R=(u,p)=>{const y=M(),A=y?.readMountedProjectionBlocksByIds;if(typeof A!="function")return null;const x=os(u),z=Lt(()=>x?A.call(y,[...p],x):A.call(y,[...p]),null);if(!Array.isArray(z))return new Map;const W=c2(z),re=new Map;for(const fe of p){const Me=W.find(Ze=>hc(Ze,fe));if(!Me)continue;const Ue=Me.attrs,$e=Ll(Ue?.alignment),qe=l9(Ue);re.set(fe,$e??(qe==="rtl"?"right":"left"))}return re},X=(u,p,y,A)=>{const{value:x,status:z,refreshing:W}=Da(u,p,y),re=A?.get(p);if(z==="pending")return re?{status:"uniform",value:re}:{status:"pending"};if(z==="stale"&&!W)return{status:"pending"};if(z==="stale"&&re)return{status:"uniform",value:re};if(z==="stale"&&A&&!re)return{status:"unavailable"};if(!x)return{status:"unavailable"};const fe=x.node;if(!fe)return{status:"unavailable"};const Me=fe.kind;if(Me!=="paragraph"&&Me!=="heading")return{status:"unavailable"};const Ue=fe[Me];if(!Ue||typeof Ue!="object")return{status:"unavailable"};const $e=Ue.props?.alignment;if($e==null)return re?{status:"uniform",value:re}:{status:"unavailable"};const qe=Ll($e);return qe?{status:"uniform",value:qe}:I($e)&&re?{status:"uniform",value:re}:{status:"unavailable"}},ie=(u,p)=>{const y=Br(p);if(y.length===0||!fc(y))return{status:"unavailable"};const A=rs(p),x=R(p,y),z=X(u,y[0],A,x);if(z.status!=="uniform")return z;for(const W of y.slice(1)){const re=X(u,W,A,x);if(re.status!=="uniform")return re;if(re.value!==z.value)return{status:"mixed"}}return z},ae=u=>{const p=Br(u);return p.length===0?null:`${Cr(rs(u))}:${p.join(",")}`},le=(u,p)=>{const y=ie(u,p),A=y.status==="uniform"?y.value:void 0,x=o;if(!x)return A;const z=ae(p);return z&&z!==x.selectionSignature?(o=null,A):!z||!x.settled?x.value:y.status!=="pending"?(o=null,A):x.value},de=(u,p)=>{const y=Ll(p),A=ae(u),x=Br(u);if(!y||!A||x.length===0)return null;const z=++i;return o={selectionSignature:A,value:y,generation:z,settled:!1,canReconcile:fc(x)},Dt(),z},ue=(u,p)=>{if(u==null)return;const y=o;if(!(!y||y.generation!==u)){if(!Io(p)){o=null;return}if(!y.canReconcile){o=null;return}y.settled=!0}},Se=async(u,p,y)=>{const A=u?.lists;if(!A)return null;try{const x=y.storyType==="body",z=typeof A.getStateInStory=="function"?await A.getStateInStory({target:ka(p),story:y}):x&&typeof A.getState=="function"?await A.getState({target:ka(p)}):null,W=z&&typeof z=="object"?z:null;return!W||W.success!==!0||typeof W.isListItem!="boolean"?null:W.isListItem}catch{return null}},Le=(u,p,y)=>{const A={resolved:!1,seed:null},x=u?.lists;if(!x)return A;const z=y.storyType==="body",W=typeof x.getStateInStory=="function"?()=>x.getStateInStory({target:ka(p),story:y}):z&&typeof x.getState=="function"?()=>x.getState({target:ka(p)}):null;if(!W)return A;const re=fe=>{const Me=fe&&typeof fe=="object"?fe:null;return!Me||Me.success!==!0||typeof Me.isListItem!="boolean"?A:{resolved:!0,seed:Me.isListItem===!0&&(Me.seed==="bullet"||Me.seed==="ordered")?Me.seed:null}};try{const fe=W();return xr(fe)?Promise.resolve(fe).then(re,()=>A):re(fe)}catch{return A}},Oe=async(u,p,y)=>{if(!u)return null;try{const A=!y||y.storyType==="body",x=y&&typeof u.getNode=="function"?await u.getNode(Ao(p,y)):A&&typeof u.getNodeById=="function"?await u.getNodeById({nodeId:p,nodeType:"paragraph"}):null;return yV(x&&typeof x=="object"?x:null)}catch{return null}},De=(u,p,y,A,x,z)=>{if(u.mutates&&y)return rn({enabled:!1,active:x,supported:!0,value:z,reason:lt.documentReadonly},"builtin");const W=Br(A);if(W.length===0)return rn({enabled:!1,active:x,supported:!0,value:z,reason:lt.selectionRequired},"builtin");const re=u.docRoute?yr(p,u.docRoute):null,fe=yr(p,"format.paragraph.setIndentation"),Me=yr(p,"format.paragraph.clearIndentation"),Ue=u.list?.mode,$e=Ue==="indent"?fe!=null:fe!=null||Me!=null,qe=rs(A);let Ze=null;if(qe.storyType!=="body"){Ze=[];for(const Ge of W){const{value:et,status:ht}=Pa(p,Ge,qe);if(et===null)return ht!=="ready"&&(re!=null||$e)?rn({enabled:!0,active:x,supported:!0,value:z},"builtin"):rn({enabled:!1,active:x,supported:!1,value:z,reason:zo(p)},"builtin");Ze.push(et)}}if(Ze?.some(Ge=>Ge===!0)){const Ge=Ue==="indent"?"lists.indentRange":"lists.outdentRange",et=mr()!=="suggesting"&&Ze.every(dt=>dt===!0)&&yr(p,Ge)!=null,ht=Ue==="outdent"&&yr(p,"lists.outdentInStory")!=null;if(!et&&!ht)return rn({enabled:!1,active:x,supported:!1,value:z,reason:zo(p)},"builtin")}for(const[Ge,et]of W.entries()){const ht=Ze?{value:Ze[Ge]??null,status:"ready"}:Pa(p,et,qe),dt=ht.value;if(dt===!0){if(re!=null)return rn({enabled:!0,active:x,supported:!0,value:z},"builtin");continue}if(dt===!1&&$e){if(qe.storyType!=="body"&&typeof p?.getNode!="function")continue;return rn({enabled:!0,active:x,supported:!0,value:z},"builtin")}if(dt===null)return ht.status!=="ready"&&(re!=null||$e)?rn({enabled:!0,active:x,supported:!0,value:z},"builtin"):rn({enabled:!1,active:x,supported:!1,value:z,reason:zo(p)},"builtin")}return rn({enabled:!1,active:x,supported:!1,value:z,reason:zo(p)},"builtin")},Ke=(u,p,y,A,x,z)=>{if(u.mutates&&y)return rn({enabled:!1,active:x,supported:!0,value:z,reason:lt.documentReadonly},"builtin");const W=Br(A);if(W.length===0)return rn({enabled:!1,active:x,supported:!0,value:z,reason:lt.selectionRequired},"builtin");const re=rs(A),fe=p?.lists;if(!(typeof fe?.getStateInStory=="function"||re.storyType==="body"&&typeof fe?.getState=="function"))return rn({enabled:!1,active:x,supported:!1,value:z,reason:lt.operationUnavailable},"builtin");if(!fc(W))return rn(re.storyType==="body"&&yr(p,"lists.remove")!=null?{enabled:!0,active:x,supported:!0,value:z}:{enabled:!1,active:x,supported:!1,value:z,reason:lt.operationUnavailable},"builtin");const Me=W.map(Ze=>Yr(p,Ze,re));if(Me.some(({status:Ze})=>Ze!=="ready"))return rn({enabled:!0,active:x,supported:!0,value:z},"builtin");if(Me.some(({value:Ze})=>Ze===null))return rn({enabled:!1,active:x,supported:!1,value:z,reason:lt.operationUnavailable},"builtin");const Ue=u.list?.seed,$e=Me.every(({value:Ze})=>Ze?.isListItem===!0&&Ze.seed===Ue);if(re.storyType==="body")return rn(!$e||yr(p,"lists.remove")!=null?{enabled:!0,active:x,supported:!0,value:z}:{enabled:!1,active:x,supported:!1,value:z,reason:lt.operationUnavailable},"builtin");const qe=yr(p,"lists.removeInStory");return rn($e&&qe?{enabled:!0,active:x,supported:!0,value:z}:{enabled:!1,active:x,supported:!1,value:z,reason:lt.operationUnavailable},"builtin")},ct=(u,p)=>{const y=Ra(u,p)?.properties?.href;return typeof y=="string"?y:null},st=u=>{if(!_())return rn({enabled:!1,active:!1,supported:!1,reason:lt.notReady},"builtin");const p=u.instanceRoute;return typeof t?.[p]!="function"?rn({enabled:!1,active:!1,supported:!1,reason:lt.operationUnavailable},"builtin"):rn({enabled:!0,active:vt(u),supported:!0,value:Xt(u)},"builtin")},vt=u=>{const p=t?.config??void 0;return u.valueFrom==="ruler"?!!p?.rulers:u.valueFrom==="formattingMarks"?!!p?.layoutEngineOptions?.showFormattingMarks:!1},gt=(u,p,y)=>{if(y)return rn({enabled:!1,active:!1,supported:!0,reason:lt.documentReadonly},"builtin");const A=ke();return A!=null&&(!u.table.requiresCell||A.cellNodeId!=null)?(u.docRoute?yr(p,u.docRoute):null)==null?rn({enabled:!1,active:!1,supported:!1,reason:zo(p)},"builtin"):rn({enabled:!0,active:!1,supported:!0},"builtin"):rn({enabled:!1,active:!1,supported:!0,reason:lt.tableContextUnavailable},"builtin")},Xt=u=>{if(u.valueFrom==="zoom")return kc().value;if(u.valueFrom==="documentMode")return mr();if(u.valueFrom==="measurementUnit")return Pu();if(u.valueFrom==="ruler"||u.valueFrom==="formattingMarks")return vt(u)},_n=(u,p)=>u.id==="zoom"?typeof p=="number"&&Number.isFinite(p)&&p>0:u.id==="document-mode"?p==="editing"||p==="suggesting"||p==="viewing":u.id==="measurement-unit"?p==="in"||p==="cm":!0,Lr=()=>[...new Set([...nN,...oe.keys()])],Zt="Normal",Mn={ready:!1,status:"ready",catalogRevision:null,quickGallery:[],activeParagraphStyleId:null,activeParagraphStyleName:null,mixedSelection:!1,sourceStatus:null,diagnostics:[]},mn=u=>{const p=b()?.styles;return!p||typeof p.getCatalog!="function"?{value:null,status:"ready"}:Tr(`styles:catalog:${JSON.stringify(u??{})}`,on(),()=>p.getCatalog(u),y=>y&&typeof y=="object"?y:null)},ar=()=>{const u=mn({includePreview:!0});if(!u.value)return{cache:null,status:u.status};const p=mn({view:"quickGallery",includePreview:!0}),y=p.value?p.value.items:u.value.styles.filter(x=>x.visibility.quickGallery),A=new Map;for(const x of u.value.styles)A.set(x.id,x);return{cache:{full:u.value,quickGallery:y,byId:A},status:hl(u.status,p.status)}},so=(u,p,y)=>{const{value:A,status:x}=Da(u,p,y);if(!A)return{ok:!1,styleRef:null,status:x};const z=A.node;if(!z||typeof z!="object")return{ok:!1,styleRef:null,status:x};const W=z.kind,re=typeof W=="string"?z[W]:void 0,fe=re&&typeof re=="object"?re.styleRef:void 0;return{ok:!0,styleRef:typeof fe=="string"&&fe.length>0?fe:null,status:x}},Xr=(u,p)=>{const y=[],A=b();if(!A)return y.push({severity:"warning",code:"active-style-unavailable",message:"Active paragraph style is unavailable: the Document API is not reachable."}),{style:{styleId:null,styleName:null,mixed:!1,diagnostics:y},status:"ready"};const x=Br(u);if(x.length===0)return y.push({severity:"info",code:"active-style-no-selection",message:"No paragraph block is resolvable from the current selection; active paragraph style is unavailable."}),{style:{styleId:null,styleName:null,mixed:!1,diagnostics:y},status:"ready"};if(!fc(x))return y.push({severity:"info",code:"active-style-selection-too-large",message:"Active paragraph style is unavailable for a large multi-paragraph selection."}),{style:{styleId:null,styleName:null,mixed:!1,diagnostics:y},status:"ready"};const z=p?.full.defaults.paragraphStyleId??(p?Zt:null),W=new Set;let re=0,fe=0,Me=0,Ue="ready";const $e=rs(u);for(const Ge of x){const et=so(A,Ge,$e);if(Ue=hl(Ue,et.status),!et.ok){fe+=1;continue}if(!et.styleRef&&!z){Me+=1;continue}const ht=et.styleRef??z;if(!ht){Me+=1;continue}re+=1,W.add(ht)}if(re===0){const Ge=Me>0&&fe===0;return y.push({severity:"warning",code:Ge?"active-style-default-unavailable":"active-style-read-failed",message:Ge?"Selected paragraphs have no explicit style and the style catalogue is unavailable, so the document default cannot be resolved.":"Could not read the paragraph style of any selected block; active paragraph style is unavailable."}),{style:{styleId:null,styleName:null,mixed:!1,diagnostics:y},status:Ue}}const qe=fe+Me;if(qe>0)return y.push({severity:"warning",code:"active-style-partial",message:`Active paragraph style resolved from ${re} of ${re+qe} selected blocks; ${qe} could not be read, so the active style is unavailable.`}),{style:{styleId:null,styleName:null,mixed:!1,diagnostics:y},status:Ue};if(W.size>1)return{style:{styleId:null,styleName:null,mixed:!0,diagnostics:y},status:Ue};const Ze=[...W][0];return{style:{styleId:Ze,styleName:p?.byId.get(Ze)?.name??null,mixed:!1,diagnostics:y},status:Ue}},Ui=u=>{if(!_())return Mn;const{cache:p,status:y}=ar(),{style:A,status:x}=Xr(u,p);let z;return p?z=A.diagnostics.length===0?p.full.diagnostics:[...p.full.diagnostics,...A.diagnostics]:z=[{severity:"warning",code:"catalog-unavailable",message:"The style catalogue is unavailable: the Document API styles surface is not reachable (e.g. viewing mode or a worker-backed editor)."},...A.diagnostics],{ready:!0,status:hl(y,x,u.status),catalogRevision:p?.full.revision??null,quickGallery:p?.quickGallery??[],activeParagraphStyleId:A.styleId,activeParagraphStyleName:A.styleName,mixedSelection:A.mixed,sourceStatus:p?.full.sourceStatus??null,diagnostics:z}},li=()=>{const u=mr(),p=kl();p.status==="ready"&&Bf(p),Y(p);const y=Sa(p);for(const[A,x]of r)(!y||x.selectionSignature!==y||x.settled&&p.status==="ready")&&r.delete(A);return{ready:_()!=null,documentMode:u,document:Uf(),selection:p,toolbar:{context:u,commands:Vu(p),copyFormatActive:h.mode!=="idle"},comments:Vf(p),trackChanges:wc(p),contentControls:Cc(p),zoom:kc(),fonts:Mu(),styles:Ui(p)}},at=u=>{const p=Sa(u);p&&a&&p!==a&&(n.clear(),r.clear()),p&&(a=p)};let dn=null,kr=null,us=null,Hi=null,yo=null,Ko=null,$i=!1;const Gs=()=>{if(U||$i)return;$i=!0;const u=()=>{$i&&($i=!1,!U&&Dt())};typeof queueMicrotask=="function"?queueMicrotask(u):Promise.resolve().then(u)},Ml=()=>{const u=se();if(u!==us&&(Hi&&(Hi(),Hi=null),us=u,!(!u||typeof u.subscribe!="function")))try{const p=u.subscribe(()=>Gs());typeof p=="function"&&(Hi=p)}catch{us=null}},Pl=()=>{const u=T();if(u!==yo&&(Ko&&(Ko(),Ko=null),yo=u,!(!u||typeof u.subscribe!="function")))try{const p=u.subscribe(()=>Dt());typeof p=="function"&&(Ko=p)}catch{yo=null}};let ci=null,Vo=null,Gi=null,ui=null,F=null,G=null;const _e=()=>{const u=_()?.host,p=Lt(u?.getHandles?()=>u.getHandles():void 0,null)?.editing?.selection;return p&&typeof p.subscribe=="function"?p:null},Ne=()=>{const u=_e();if(u!==dn&&(kr&&(kr(),kr=null),dn=u,!!u))try{const p=u.subscribe(y=>{tr+=1,Sl(y),Dt()});typeof p=="function"&&(kr=p)}catch{dn=null}},bt=()=>{const u=_()?.host,p=Lt(u?.getHandles?()=>u.getHandles():void 0,null)?.review;return p&&typeof p.subscribe=="function"?p:null},Qt=u=>u?typeof u.getActiveReviewTarget=="function"?Lt(()=>u.getActiveReviewTarget(),null):typeof u.getSnapshot=="function"?Lt(()=>u.getSnapshot(),null)?.activeReviewTarget??null:null:null;let gn=0;const An=(u,p)=>{const y=(p&&typeof p=="object"?p:null)?.lastInteractionRejection;if(gn>0&&u==null&&y&&typeof y=="object"&&y.code==="review-target-invalidated"&&y.detail==="not-painted")return!1;const A=u&&typeof u=="object"?u:null;let x=null;if(A?.entityType==="trackedChange"&&typeof A.entityId=="string"&&A.entityId.length>0){const z=A.story&&typeof A.story=="object"?A.story:void 0,W=z&&Cr(z)!==Cr(null)?z:void 0,re=typeof A.paintedEntityId=="string"&&A.paintedEntityId.length>0?A.paintedEntityId:null,fe=re??A.entityId,Me=(()=>{if(W){const qe=si(),Ze=qe?dc(qe,W):null;return Ze?.toPublicId(fe)??Ze?.toPublicId(A.entityId)??A.entityId}const $e=Os(Array.isArray(P?.trackChanges.items)?P.trackChanges.items:[]);return $e.toPublicId(fe)??$e.toPublicId(A.entityId)??A.entityId})(),Ue=re??(fe!==Me?fe:null);x={id:Me,...W?{story:W}:{},...Ue&&Ue!==Me?{paintedEntityId:Ue}:{}}}return u==null&&x==null&&je!=null&&ee(je)||Ye(je,x)?!1:(ne(x),!0)},xn=()=>{const u=bt();if(u===ci)return;if(Vo&&(Vo(),Vo=null),ci=u,!u){An(null);return}let p=!0;try{const y=u.subscribe(A=>{const x=A&&typeof A=="object"?A:null,z=x&&Object.prototype.hasOwnProperty.call(x,"activeReviewTarget")?x.activeReviewTarget:Qt(u);!An(z,A)||p||Dt()});typeof y=="function"&&(Vo=y),An(Qt(u))}catch{ci=null}finally{p=!1}},On=()=>{if(dn||mr()!=="viewing")return null;const u=_()?.mount?.container,p=(u&&typeof u=="object"&&"ownerDocument"in u?u.ownerDocument??null:null)??globalThis.document??null;return p&&typeof p.addEventListener=="function"?p:null},ln=()=>{const u=On();if(u===F||(G&&(G(),G=null),F=u,!u))return;const p=()=>{tr+=1,Dt()};u.addEventListener("selectionchange",p),u.addEventListener("pointerup",p,!0),u.addEventListener("mouseup",p,!0),G=()=>{u.removeEventListener("selectionchange",p),u.removeEventListener("pointerup",p,!0),u.removeEventListener("mouseup",p,!0)}};as(),An(Qt(bt())),P=li(),a=Sa(P.selection);const Mr=()=>{const u=_()?.host?.events,p=u&&typeof u.subscribe=="function"?u:null;if(p!==Gi&&(ui&&(ui(),ui=null),Gi=p,!!p))try{const y=p.subscribe(A=>{const x=A?.type;if(x==="review-mutation:started"){hn(A.reviewMutation?.token);return}if(x==="review-mutation:aborted"){Vn(A.reviewMutation?.token),Ht();return}if(x==="mutation:rejected"&&A.reviewMutation&&(Vn(A.reviewMutation.token),Ht()),x==="mutation:committed"&&A.reviewMutation&&Vn(A.reviewMutation.token),x==="source:complete"||x==="source:signals-complete"){Rn=on(),Wo();return}if((x==="mutation:committed"||x==="collaboration:remote-changed")&&(Ln=Date.now()),x==="mutation:committed"||x==="save:completed"||x==="collaboration:remote-changed"){const z=x==="mutation:committed"?zk(A):null;if(z?.allResolved){Jt([]),Et(A.receipt);return}z?.removedIds.size&&Nt(new Set(z.removedIds),A.receipt);const W=x==="mutation:committed"&&_i(A)||x==="collaboration:remote-changed"&&Array.isArray(A.changedStoryIds)&&A.changedStoryIds.length>0;if(W&&(go=Date.now()),x==="mutation:committed"&&W){yl();return}if(z?.removedIds.size&&z.upsertIds.size===0)return;(x==="collaboration:remote-changed"||x==="mutation:committed"&&!W)&&vl();const re=x==="collaboration:remote-changed"&&Array.isArray(A.changedPartUris)&&A.changedPartUris.some(Me=>typeof Me=="string"&&iV.has(Me)),fe=x==="collaboration:remote-changed"&&Array.isArray(A.changedStoryIds)&&A.changedStoryIds.length>0&&pc();re&&!W&&(Gr=!0),Ni(),re&&!W?Bo("comments"):fe&&(Gr=!0,ki()),Dt()}});typeof y=="function"&&(ui=y)}catch{Gi=null}},Dt=()=>{if(U)return;$i=!1,as(),Ne(),Ml(),Pl(),xn(),ln(),Mr();const u=li();at(u.selection),P=u;for(const p of[...O])p(P)},Ai=[],Tt=[],vn=u=>{for(const p of u)try{p()}catch{}},lr=()=>vn(Ai),Fn=()=>vn(Tt),Zr=[];((u,p)=>{if(!(!u||typeof u.on!="function"))for(const y of p){const A=y==="active-editor-change"?()=>{lr(),Fn(),Dt()}:y==="document-replaced"?x=>{const z=x&&typeof x=="object"?x:null,W=z?.editor,re=z?.host,fe=!!W&&W===_(),Me=!!re&&re===M();!fe&&!Me||(Fn(),Q.clear(),Ni(),Dt())}:()=>Dt();try{u.on(y,A),Zr.push(()=>{try{typeof u.off=="function"&&u.off(y,A)}catch{}})}catch{}}})(t,Jz),Ne(),Ml(),Pl(),xn(),ln(),Mr();const jo=(u,p=Fz)=>({get:()=>u(P),subscribe:y=>{let A=u(P);const x=z=>{const W=u(z);p(A,W)||(A=W,y(W))};return O.add(x),()=>O.delete(x)}}),bo=u=>jo(u),qo=u=>{const p=y=>{const A=z=>{try{y(z)}catch{}},x=u.subscribe(A);return A(u.get()),x};return{get:()=>u.get(),getSnapshot:()=>u.get(),observe:p,subscribe:y=>p(A=>y({snapshot:A}))}},Oa=(u,p,y)=>{const A=qo(u),x=qo(p),z=W=>{const re=_a(y);Dt();const fe=x.observe(W);return()=>{fe(),re()}};return{get:A.get,getSnapshot:A.getSnapshot,observe:z,subscribe:W=>z(re=>W({snapshot:re}))}};function Gu(u){return u&&typeof u=="object"&&typeof u.id=="string"?String(u.id):null}function Fa(u){const p=os(u);return p&&Cr(p)!==Cr(null)?p:void 0}function $n(u,p){return{kind:"id",id:u,...p?{story:p}:{}}}function h2(u){if(u.empty)return null;const p=u.selectionTarget,y=p?.start,A=p?.end;if(p?.kind!=="selection"||y?.kind!=="text"||A?.kind!=="text"||typeof y.blockId!="string"||y.blockId!==A.blockId||!Number.isInteger(y.offset)||!Number.isInteger(A.offset)||y.offset<0||A.offset<0||y.offset===A.offset)return null;const x=Math.min(y.offset,A.offset),z=Math.max(y.offset,A.offset),W=os(u);return{kind:"range",coordinateSpace:p.coordinateSpace==="tracked"?"tracked":"visible",range:{kind:"text",...W?{story:W}:{},segments:[{blockId:y.blockId,range:{start:x,end:z}}]}}}function bm(u,p){if(Cr(p)!==Cr(null))return;const y=b()?.trackChanges,A=y?.list;if(typeof A!="function")return;const x=Lt(()=>A.call(y),null);if(xr(x)||!x||typeof x!="object")return;const z=x.items;if(Array.isArray(z))return z.map(Of).find(W=>W!=null&&Di(W,u,p))}function wm(u,p){const y=Cm(u.quotedText);if(!y)return!1;const A=hm(p);return[A.insertedText,A.deletedText,A.excerpt].some(x=>Cm(x)===y)}function Cm(u){return typeof u=="string"?u.replace(/\s+/g," ").trim():""}function km(){const u=P.selection.activeChangeIds[0];if(!u)return"unavailable";const p=os(P.selection),y=(P.trackChanges.status==="ready"?P.trackChanges.items.find(W=>Di(W,u,p)):void 0)??bm(u,p)??si()?.find(W=>Di(W,u,p));if(!y)return"unavailable";const A=hm(y),x=A.type,z=A.grouping;return wm(P.selection,y)?"id":x==="replacement"&&z==="replacement-pair"||(x==="insertion"||x==="deletion"||x==="insert"||x==="delete")&&z==="standalone"?"range":"id"}function Sm(u,p,y,A){const x=()=>w2(u,$n(y,A),y,A);try{const z=w2(u,p,null);if(xr(z))return To(Promise.resolve(z).then(re=>Io(Ns(re))?re:x()));const W=Ns(z);return To(Io(W)?z:x())}catch{return!1}}function _m(u,p){if(u.scope==="all")return{target:{kind:"all"},changeId:null};if(typeof p=="string"&&p.length>0)return{target:{kind:"id",id:p},changeId:p};if(p&&typeof p=="object"){const x=p;if(x.target&&typeof x.target=="object"){const W=x.target;return{target:W,changeId:Gu(W),story:W.story}}const z=typeof x.changeId=="string"?x.changeId:x.id;if(typeof z=="string"&&z.length>0)return{target:$n(z,x.story),changeId:z,story:x.story}}const y=P.selection.activeChangeIds[0],A=Fa(P.selection);return y?{target:$n(y,A),changeId:y,story:A}:null}function p2(u,p){if(u.scope==="id"&&p==null){if(P.selection.activeChangeIds.length>1)return Xf(u.kind,{kind:"ids",ids:P.selection.activeChangeIds},null);if(P.selection.activeChangeIds.length===1&&!P.selection.empty&&P.selection.selectionTarget){const A=km();if(A==="unavailable")return!1;if(A==="range"){const x=h2(P.selection),z=Fa(P.selection);return x?Sm(u.kind,x,P.selection.activeChangeIds[0],z):!1}if(A==="id"){const x=P.selection.activeChangeIds[0],z=os(P.selection),W=z&&Cr(z)!==Cr(null)?z:void 0;return b2(u.kind,W?{id:x,story:W}:x)}}}const y=_m(u,p);return y?Xf(u.kind,y.target,y.changeId,y.story):!1}function Am(u,p){const y=se()?.lists,A=y?.apply;if(typeof A!="function")return!1;const{behavior:x,preset:z,continuity:W}=typeof p=="string"?nV(p):p&&typeof p=="object"?p:{},re={kind:u,behavior:x??"toggle"};z!==void 0&&(re.preset=z),W!==void 0&&(re.continuity=W);try{return To(A.call(y,re))}catch{return!1}}let di=Promise.resolve(!1),Eo=null,Wu=Promise.resolve(!1);const At=async u=>{if(!pm(u))return u;const p=_()?.documentMutationReadiness,y=p?.whenPainted;if(typeof y!="function")return u;const A=typeof u.txId=="string"?u.txId:void 0;try{await y.call(p,A?{txId:A}:void 0)}catch{}return u},Rt=u=>{if(xr(u)){const y=Promise.resolve(u);return{immediate:!0,committed:y.then(A=>Ns(A),()=>!1),settled:y.then(A=>At(Ns(A)),()=>!1)}}const p=Ns(u);return{immediate:p,committed:Promise.resolve(p),settled:At(p)}},yn=()=>{const u=s.shift();if(!u){c=!1,f?.(),f=null;return}try{u.resolve(U?!1:u.mutate())}catch{u.resolve(!1)}},br=()=>{let u=!1;return()=>{u||(u=!0,yn())}},Qr=(u,p)=>{if(!c){c=!0,d=new Promise(z=>{f=z});try{return{result:p(),release:br()}}catch(z){throw c=!1,f?.(),f=null,z}}const y=s.find(z=>z.key===u);if(y)return y.mutate=p,{result:y.result,release:()=>{}};let A;const x=new Promise(z=>{A=z});return s.push({key:u,mutate:p,result:x,resolve:A}),{result:x,release:br()}},wo=new Set(["create.tableOfContents"]),Ii=u=>Xn(`Tracked authoring is not supported for ${u}.`),Wi=u=>{if(mr()==="suggesting")return wo.has(u)?Ii(u):{changeMode:"tracked"}},Ku=()=>mr()==="suggesting"?OV:d2,Co=(u,p,y)=>{const A=Wi(u);return A&&A.success===!1?A:A?p(y,A):p(y)},vj=(u,p,y,A)=>{const x=u.inline;if(!x)return;const z=Ns(A);if(z===!1||typeof z=="object"&&z&&z.success===!1)return;if(x.kind==="clear"){n.clear();return}if(x.kind==="toggle"||!s2(x.key))return;const W=Sa(p);if(!W)return;const re=kV(x.key,y.value);if(re==null){n.delete(x.key);return}n.set(x.key,{selectionSignature:W,value:re})},yj=(u,p,y,A)=>!u.inline||u.inline.kind==="toggle"?A:xr(A)?Promise.resolve(A).then(x=>(vj(u,p,y,x),x)):A,bj=(u,p,y,A)=>{if(u.inline?.kind!=="toggle"||!Io(Ns(A))||typeof y.value!="boolean"&&y.value!==null)return null;const x=Sa(p);if(!x)return null;const z=++l;return r.set(u.id,{selectionSignature:x,active:y.value===!0,generation:z,settled:!1}),Dt(),z},wj=(u,p,y)=>{if(p==null)return;const A=r.get(u.id);if(!(!A||A.generation!==p)){if(!Io(y)){r.delete(u.id);return}A.settled=!0}},Im=(u,p)=>u.then(y=>(p?.(y),Cl(),y),()=>(p?.(!1),Cl(),!1)),To=(u,p)=>{const y=Eo;if(Eo=null,y)return di=Im(y,p),Ns(u);if(xr(u))return di=Im(Rt(u).settled,p),!0;const A=Ns(u);return pm(A)&&typeof _()?.documentMutationReadiness?.whenPainted=="function"?(di=Im(At(A),p),A):(p?.(A),di=Promise.resolve(A),Cl(),A)},Cj=(u,p)=>!u||typeof u!="object"?p:u,Dl=(u,p=Xn("Document API operation failed."))=>{if(xr(u))return Promise.resolve(u).then(A=>Dl(A,p),()=>p);const y=Cj(u,p);return Ni(),pm(y)&&typeof _()?.documentMutationReadiness?.whenPainted=="function"?(Im(At(y)),Dt(),y):(Dt(),y)},kj=(u,p,y,A)=>{const x=[],z=[];for(const W of y){const re=A(W);if(re)try{const fe=Rt(Co(u,p,re));x.push(fe.immediate),z.push(fe.settled)}catch{x.push(!1),z.push(Promise.resolve(!1))}}return Eo=z.length?Promise.all(z).then(W=>wi(W)):null,wi(x)},Sj=(u,p,y,A)=>{const x=[],z=[];for(const W of y){const re=A(W);if(re)try{const fe=Rt(Co(u,p,re));x.push(fe.immediate),z.push(fe.settled)}catch{x.push(!1),z.push(Promise.resolve(!1))}}return Eo=z.length?Promise.all(z).then(W=>wi(W)):null,wi(x)},m2=(u,p,y,A=P.selection)=>{const x=Wi(u);return x&&x.success===!1?x:A.selectionTarget?p(y,{...x??{},offsetSpace:"selection"}):x?p(y,x):p(y)},_j=(u,p,y,A)=>{const x=Ao(p,A);switch(u.kind){case"alignment":{const z=y;return z!=="left"&&z!=="center"&&z!=="right"&&z!=="justify"?null:{target:x,alignment:z}}case"spacing-line":{const z=typeof y=="number"?y:Number(y);return!Number.isFinite(z)||z<=0?null:{target:x,line:z,lineRule:"auto"}}case"style":if(y&&typeof y=="object"){const z=y.role;if(z&&typeof z=="object")return{target:x,role:z}}return typeof y!="string"||y.trim()===""?null:{target:x,styleId:y};case"direction":{const z=u.fixedValue;return z!=="ltr"&&z!=="rtl"?null:{target:x,direction:z}}default:return null}},Aj=(u,p)=>{const y=u.inline,A=u2(u),x=M();if(!y||typeof x?.setPendingInlineFormat!="function")return!1;if(y.kind==="clear")return j(),!0;if(!A)return!1;let z;if(y.kind==="toggle")z=!Tl(u,b(),P.selection);else{const W=p&&typeof p=="object"&&"value"in p?p.value:p;if(y.kind==="value-number"){const re=typeof W=="number"?W:Number(W);z=Number.isFinite(re)&&re>0?re:null}else z=typeof W=="string"&&W.trim()!==""?W:null;if(z===null)return E(A,null),!0}return E(A,z),!0},Ij=()=>{const u=b(),{lockModesById:p}=Hs(u?.contentControls,P.selection);if(cs(p))return!1;const y=[],A=[],x=Ze=>{const Ge=Rt(Ze);y.push(Ge.immediate),A.push(Ge.settled)},z=(Ze,Ge,et)=>{try{x(et?Ze(Ge,et):Ze(Ge))}catch{y.push(!1),A.push(Promise.resolve(!1))}},W=ar().cache?.full.defaults.paragraphStyleId??Zt,re=Eu(P.selection);if(re){const Ze=yr(u,"format.apply");if(Ze)try{x(m2("format.apply",Ze,{target:re,inline:{...Ku()}}))}catch{y.push(!1),A.push(Promise.resolve(!1))}}const fe=yr(u,"format.paragraph.resetDirectFormatting"),Me=yr(u,"styles.paragraph.setStyleRef"),Ue=os(P.selection),$e=!Ue||Ue.storyType==="body",qe=yr(u,$e?"lists.remove":"lists.removeInStory");for(const Ze of Br(P.selection)){const Ge=Ao(Ze,Ue);if(fe&&z(fe,{target:Ge}),qe)try{const et=ka(Ze),ht=Rt(qe($e?{target:et}:{target:et,story:Ue}));A.push(ht.settled.then(dt=>Io(dt)?dt:!0))}catch{}Me&&z(Me,{target:Ge,styleId:W})}if(!re&&mr()!=="suggesting"){const Ze=yr(u,"format.paragraph.setMarkRunProps");if(Ze)for(const Ge of Br(P.selection))z(Ze,{target:Ao(Ge,Ue),markRunProps:{bold:!1,italic:!1,strikethrough:!1,doubleStrikethrough:!1,smallCaps:!1,caps:!1,verticalAlign:"baseline"}})}return Eo=A.length?Promise.all(A).then(Ze=>wi(Ze)):null,wi(y.length?y:[!1])},xj=(u,p,y)=>{const A=Br(P.selection);if(A.length===0)return!1;const x=os(P.selection);return kj(u.docRoute,p,A,z=>_j(u.blockParagraph,z,y,x))},Ej=(u,p,y)=>{const A=b(),x=yr(A,"format.paragraph.setIndentation"),z=yr(A,"format.paragraph.clearIndentation"),W=u.list?.mode,re=rs(P.selection),fe=os(P.selection),Me=async Ue=>{const $e=await Se(A,Ue,re);if($e===!0)return{kind:"list",routeToCall:u.docRoute,opToCall:p,input:{target:vA(Ue)}};if($e===null||fe&&fe.storyType!=="body"&&typeof A?.getNode!="function")return null;const qe=await Oe(A,Ue,fe),Ze={};if(qe?.right!=null&&(Ze.right=qe.right),qe?.firstLine!=null&&(Ze.firstLine=qe.firstLine),qe?.hanging!=null&&(Ze.hanging=qe.hanging),W==="indent")return x?{kind:"paragraph",routeToCall:"format.paragraph.setIndentation",opToCall:x,input:{target:Ao(Ue,fe),left:Math.max(0,qe?.left??0)+yA,...Ze}}:null;const Ge=Math.max(0,(qe?.left??0)-yA);return Ge>0&&(Ze.left=Ge),Object.keys(Ze).length===0?z?{kind:"paragraph",routeToCall:"format.paragraph.clearIndentation",opToCall:z,input:{target:Ao(Ue,fe)}}:x?{kind:"paragraph",routeToCall:"format.paragraph.setIndentation",opToCall:x,input:{target:Ao(Ue,fe),left:0}}:null:x?{kind:"paragraph",routeToCall:"format.paragraph.setIndentation",opToCall:x,input:{target:Ao(Ue,fe),...Ze}}:null};return Eo=(async()=>{const Ue=await Promise.all(y.map(Ge=>Me(Ge).catch(()=>null)));if(Ue.length===y.length&&Ue.every(Ge=>Ge?.kind==="list")&&mr()!=="suggesting"){const Ge=W==="indent"?"lists.indentRange":"lists.outdentRange",et=yr(A,Ge);if(et)try{return await Rt(Co(Ge,et,{paraIds:y,story:re})).settled}catch{return!1}}const $e=re.storyType!=="body"&&Ue.some(Ge=>Ge?.kind==="list"),qe=$e&&W==="outdent"?yr(A,"lists.outdentInStory"):null;if($e&&!qe)return!1;const Ze=Ue.map(Ge=>{if(!Ge)return Promise.resolve(!1);try{return Ge.kind==="list"&&qe?Rt(Co("lists.outdentInStory",qe,{target:Ge.input.target,story:re})).settled:Rt(Co(Ge.routeToCall,Ge.opToCall,Ge.input)).settled}catch{return Promise.resolve(!1)}});return wi(await Promise.all(Ze))})(),!0},Tj=(u,p)=>{const y=u.list,A=b(),x=Br(P.selection);if(x.length===0)return!1;const z=rs(P.selection),W=z.storyType==="body";if(y.mode==="indent"||y.mode==="outdent")return Ej(u,p,x);const re=y.seed,fe=$e=>{if($e.some(dt=>!dt.resolved))return{immediate:!1,settled:null};const qe=$e.every(dt=>dt.seed===re);if(!qe&&!W)return{immediate:!1,settled:null};const Ze=qe?W?"lists.remove":"lists.removeInStory":u.docRoute,Ge=qe?yr(A,Ze):p;if(!Ge)return{immediate:!1,settled:null};const et=[],ht=[];return x.forEach((dt,ot)=>{if(!qe&&$e[ot]?.seed===re)return;const Bt=qe?{target:ka(dt),...W?{}:{story:z}}:{target:ka(dt),seed:re};try{const zt=Rt(Co(Ze,Ge,Bt));et.push(zt.immediate),ht.push(zt.settled)}catch{et.push(!1),ht.push(Promise.resolve(!1))}}),{immediate:wi(et),settled:ht.length?Promise.all(ht).then(dt=>wi(dt)):null}},Me=x.map($e=>Le(A,$e,z));if(Me.some(xr))return Eo=Promise.all(Me).then(async $e=>{const qe=fe($e);return qe.settled?await qe.settled:qe.immediate}),!0;const Ue=fe(Me);return Eo=Ue.settled,Ue.immediate};function qf(u){return u&&typeof u=="object"?u:{}}function Rj(u){if(typeof u=="string")return u;const p=qf(u);if(Object.prototype.hasOwnProperty.call(p,"href"))return p.href;if(Object.prototype.hasOwnProperty.call(p,"value"))return p.value}function Lj(u,p){const y=qf(u).text;return typeof y=="string"&&y.trim()!==""?y:p}function RA(u){const p=qf(u),y=p.capture&&typeof p.capture=="object"?p.capture:null;return p.target??y?.target??y?.selectionTarget??p.selectionTarget??p.textTarget??null}const Mj=u=>{const p=b(),y=p?.hyperlinks;if(!y)return!1;const A=qf(u),x=Rj(u),z=RA(u),W=typeof A.text=="string"?A.text:void 0,re=typeof A.currentText=="string"?A.currentText:void 0,fe=Ff(A.hyperlinkTarget)?A.hyperlinkTarget:null,Me=Ff(A.textTarget)?A.textTarget:null,Ue=Ra(p,P.selection),$e=typeof fe?.storyId=="string"&&typeof fe?.hyperlinkNodeId=="string";if($e&&x===null){const qe=y.remove;if(typeof qe!="function")return!1;try{return Co("hyperlinks.remove",qe,{storyId:fe.storyId,hyperlinkNodeId:fe.hyperlinkNodeId,keepText:!0})}catch{return!1}}if(Ue&&x===null){const qe=y.remove;if(typeof qe!="function")return!1;try{return Co("hyperlinks.remove",qe,{target:Ue.address,mode:"unwrap"})}catch{return!1}}if((Ue||fe)&&typeof x=="string"&&x.trim()!==""){const qe=y.patch,Ze=y.updateTarget;if(!(!$e&&Ue&&typeof qe=="function")&&!($e&&typeof Ze=="function"))return!1;const Ge=typeof W=="string"&&W!==($e?re:Ue?.text??re),et=p?.text?.replace,ht=Ge?$e?Me:TV(Ue?.address):null,dt=Ge&&!!ht&&typeof et=="function";if(Ge&&!dt)return!1;const ot=[],Bt=[];let zt=null,Gn=null,Wn=null,Jr=!1;try{if($e){if(typeof Ze!="function")return!1;const eo=Co("hyperlinks.updateTarget",Ze,{storyId:fe.storyId,hyperlinkNodeId:fe.hyperlinkNodeId,newTarget:RV(x)});Jr=xr(eo);const Sr=Rt(eo);if(!Io(Sr.immediate))return!1;ot.push(Sr.immediate),Bt.push(Sr.settled),zt=Sr.immediate,Gn=Sr.committed,Wn=Sr.settled}else if(Ue){if(typeof qe!="function")return!1;const eo=Co("hyperlinks.patch",qe,{target:Ue.address,patch:{href:x}});Jr=xr(eo);const Sr=Rt(eo);if(!Io(Sr.immediate))return!1;ot.push(Sr.immediate),Bt.push(Sr.settled),zt=Sr.immediate,Gn=Sr.committed,Wn=Sr.settled}}catch{return!1}if(dt){const eo=(Pr,Yo)=>Io(Yo)?wi([Pr,Yo]):Io(Pr)?Rf(Pr,Yo):Yo,Sr=Pr=>{if(!Io(Pr))return Pr;try{const Yo=Rt(Co("text.replace",et,{target:ht,text:W}));return Io(Yo.immediate)?Promise.all([Wn??Promise.resolve(Pr),Yo.settled]).then(([A2,gU])=>eo(A2,gU)):Rf(Pr,Yo.immediate)}catch{return Rf(Pr,!1)}};if(Jr)return Eo=(Gn??Promise.resolve(zt??!1)).then(Sr),wi(ot);try{const Pr=Rt(Co("text.replace",et,{target:ht,text:W}));if(!Io(Pr.immediate))return zt?Rf(zt,Pr.immediate):Pr.immediate;ot.push(Pr.immediate),Bt.push(Pr.settled),Eo=Promise.all([Wn??Promise.resolve(zt??!1),Pr.settled]).then(([Yo,A2])=>eo(Yo,A2))}catch{return zt?Rf(zt,!1):!1}}return!dt&&Bt.length>0&&(Eo=Promise.all(Bt).then(eo=>wi(eo))),wi(ot)}if(typeof x=="string"&&x.trim()!==""){const qe=x.trim(),Ze=y.wrap,Ge=bV(z),et=Ge.length>0?Ge:i2(P.selection);if(et.length>0){if(typeof Ze!="function")return!1;try{return Sj("hyperlinks.wrap",Ze,et,Bt=>({target:Bt,link:{destination:{href:qe}}}))}catch{return!1}}const ht=y.insert,dt=Lj(u,qe);if(typeof ht!="function"||dt.trim()==="")return!1;const ot=Pf(z)??pl(P.selection);if(!ot)return!1;try{return Co("hyperlinks.insert",ht,{target:ot,text:dt,link:{destination:{href:qe}}})}catch{return!1}}return!1},Pj=(u,p,y)=>{const A=u.create.kind,x=y&&typeof y=="object"?y:{};if(A==="table"){const W=Number(x.rows??x.rowCount),re=Number(x.columns??x.cols??x.colCount);if(!Number.isInteger(W)||W<1||!Number.isInteger(re)||re<1)return!1;const fe=pl(P.selection),Me=fe&&typeof fe.blockId=="string"?{kind:"inParagraph",target:Ao(fe.blockId),offset:fe.range?.start??0}:l2(P.selection,"nodeId");try{return Co(u.docRoute,p,{rows:W,columns:re,at:Me})}catch{return!1}}if(A==="image"){const W=x.src??x.value;if(typeof W!="string"||W.trim()==="")return!1;const re=pl(P.selection),fe=rs(P.selection),Me=fe.storyType==="body"?null:fe;let Ue;re&&typeof re.blockId=="string"?Ue={kind:"inParagraph",target:Ao(re.blockId,Me),offset:re.range?.start??0}:(Ue=l2(P.selection,"target"),Me&&Ue.kind==="after"&&(Ue={...Ue,target:{...Ue.target,story:Me}}));const $e={src:W,at:Ue};Me&&($e.in=Ue.kind==="inParagraph"?V(Me)??Me:Me),typeof x.alt=="string"&&($e.alt=x.alt),typeof x.title=="string"&&($e.title=x.title),x.size&&typeof x.size=="object"&&($e.size=x.size);try{return Co(u.docRoute,p,$e)}catch{return!1}}const z={at:l2(P.selection,"target")};typeof x.instruction=="string"&&(z.instruction=x.instruction),x.config&&typeof x.config=="object"&&(z.config=x.config);try{return Co(u.docRoute,p,z)}catch{return!1}},Dj=(u,p)=>{const y=u.table,A=ke();if(!A||y.requiresCell&&!A.cellNodeId)return!1;const x=BV(y.action,A);if(!x)return!1;try{if(y.action==="insert-row-before"||y.action==="insert-row-after"){const z=M(),W=(typeof z?.getHandles=="function"?z.getHandles():null)?.editing?.tables;if(typeof W?.insertRow!="function")return!1;const re=Wi(u.docRoute);return re&&re.success===!1?re:re?W.insertRow(x,re):W.insertRow(x)}return Co(u.docRoute,p,x)}catch{return!1}},Oj=u=>!u||u.disposition!=="routed"?!1:!!(u.inline||u.blockParagraph||u.list||u.link||u.create),Fj=u=>{const p=qf(u);return!!(RA(u)||Ff(p.hyperlinkTarget)||Ff(p.textTarget))},Nj=(u,p,y)=>P.selection.status!=="ready"?!1:gm(u)?.scope==="id"||!p||p.disposition!=="routed"?!0:p.inline?.kind==="clear"?Br(P.selection).length>0||Eu(P.selection)!=null:p.inline?Eu(P.selection)!=null||Br(P.selection).length>0:p.blockParagraph||p.list?Br(P.selection).length>0:p.link?Fj(y)||i2(P.selection).length>0||pl(P.selection)!=null||Tl(p,b(),P.selection):!0,Bj=(u,p)=>{const y=gm(u),A=ku(u);return y?.scope!=="id"&&!Oj(A)?!1:!Nj(u,A,p)},zj=(u,p)=>Bj(u,p)?ls().then(()=>{}):null,Ac=(u,p,y)=>{if(Eo=null,di=Promise.resolve(!1),U)return!1;const A=oe.get(u);if(A)try{const $e=A.execute(Ru(p,y));return To($e)}catch{return!1}const x=uA(u);if(x&&typeof se()?.lists?.apply=="function")return Am(x,p);const z=gm(u);if(z)return p2(z,p);if(u==="copy-format")return To(Vj());const W=ku(u);if(!W||W.disposition!=="routed")return!1;const re=W.normalizePayload?W.normalizePayload(p):p;if(W.instanceRoute){if(!_()||!_n(W,re))return!1;const $e=t?.[W.instanceRoute];if(typeof $e!="function")return!1;try{const qe=W.fixedArg!==void 0?W.fixedArg:re,Ze=$e.call(t,qe);return To(Ze)}catch{return!1}}if(W.inline?.kind==="clear")return W.mutates&&mr()==="viewing"?!1:To(Ij());const fe=W.docRoute;if(!fe||W.mutates&&mr()==="viewing")return!1;const Me=b(),Ue=yr(Me,fe);if(!Ue)return!1;if(W.inline){const{lockModesById:$e}=Hs(Me?.contentControls,P.selection);if(cs($e))return!1;const qe=Eu(P.selection);if(!qe)return P.selection.empty===!1?To(!1):To(Aj(W,re));const Ze=Tl(W,Me,P.selection),Ge=FV(W.inline,qe,re,Ze);if(!Ge)return!1;let et=null;try{const ht=_(),dt=mr(),ot=()=>_()!==ht||b()!==Me||mr()!==dt?!1:m2(fe,Ue,Ge),Bt=Sa(P.selection)??cc(P.selection),zt=W.inline.kind==="toggle"?Qr(`${W.id}:${Bt}`,ot):null;et=zt?.release??null;const Gn=zt?zt.result:ot(),Wn=bj(W,P.selection,Ge,Gn),Jr=yj(W,P.selection,Ge,Gn),eo=To(Jr,Sr=>{wj(W,Wn,Sr),et?.(),et=null});return W.inline.kind==="toggle"&&(Wu=di),eo}catch{return et?.(),!1}}if(W.blockParagraph){const $e=xj(W,Ue,re),qe=W.blockParagraph.kind==="alignment"&&Io($e)?de(P.selection,re):null;return To($e,Ze=>{ue(qe,Ze)})}if(W.list){const $e=Tj(W,Ue);return To($e)}if(W.link){const $e=Mj(re);return To($e)}if(W.create){const $e=Pj(W,Ue,re);return To($e)}if(W.table){const $e=Dj(W,Ue);return To($e)}try{return To(W.mutates?Co(fe,Ue,re):Ue(re))}catch{return!1}},xm=()=>{g+=1,h={mode:"idle",snapshot:null,sourceSelectionKey:null,lastClickAt:h.lastClickAt,pointerSelecting:!1,keyboardSelecting:!1};for(const u of m)u("idle");Dt()},Vj=async()=>{const u=["bold","italic","underline","strikethrough"].filter(Ue=>P.toolbar.commands[Ue]?.active===!0),p=await Wu;await d;const y=Io(p)?u:[],A=500,x=Date.now();if(h.mode!=="idle"){if(h.mode==="armed"&&x-h.lastClickAt<A){h={...h,mode:"persistent",lastClickAt:x};for(const Ue of m)Ue("persistent");return Dt(),!0}return xm(),!1}const z=x-h.lastClickAt<A,W=++g;h={...h,lastClickAt:x};const re=await ls(),fe=`${cc(re)}:${on()}`,Me=await jj(null,re,fe&&fe===k?v:void 0,y);if(W!==g)return!0;h={...h,mode:z?"persistent":"armed",snapshot:Me,sourceSelectionKey:cc(re),lastClickAt:x};for(const Ue of m)Ue(h.mode);return Dt(),!0},jj=async(u,p,y,A=[])=>{const x=p?.target??u?.target;if(!x||x.kind!=="text")return null;const z=Array.isArray(x.segments)?x.segments:[];if(z.length===0)return null;const W=b();if(!W)return null;const re=x.story;let fe=null;for(const Ge of z){const et=(await El(Ao(Ge.blockId,re)))?.node??null;if(!et)continue;const ht=g2(et),dt=Array.isArray(ht?.inlines)?ht.inlines:[],ot=Uj(dt,Ge.range);fe?fe=LA(fe,ot):fe=ot}const Me=fe?Nz(fe):{},Ue={bold:"bold",italic:"italic",underline:"underline",strikethrough:"strike"},$e=new Set([...p?.activeMarks??(Array.isArray(u?.activeMarks)?u.activeMarks:[]),...A]);for(const[Ge,et]of Object.entries(Ue))$e.has(Ge)&&(Me[et]=!0);const qe=y??await Wf(p??Vs(u,"ready"));if(qe.fontFamily&&(Me.fontFamily=qe.fontFamily),qe.color&&(Me.color=qe.color),qe.highlight&&(Me.highlight=qe.highlight),qe.fontSize){const Ge=Number.parseFloat(qe.fontSize);Number.isNaN(Ge)||(Me.fontSize=Ge)}let Ze=null;if(z.length===1){const Ge=z[0],et=(await El(Ao(Ge.blockId,re)))?.node??null;et&&g2(et)&&(Ze=await Hj(et,Ge.blockId,W,re))}return{story:re??null,inline:Me,paragraph:Ze}},g2=u=>u?u.kind==="paragraph"?u.paragraph??null:u.kind==="heading"?u.heading??null:null:null,Uj=(u,p)=>{const y=W=>{const re=W.run;return typeof re?.text=="string"?re.text:""},A=W=>W.run?.props;if(p.start===p.end){let W=0;for(const re of u){const fe=y(re),Me=W,Ue=W+fe.length;if(W=Ue,p.start>=Me&&p.start<=Ue){const $e=A(re);return $e?{...$e}:{}}}return{}}let x=0;const z=[];for(const W of u){const re=y(W),fe=x,Me=x+re.length;if(x=Me,Me<=p.start||fe>=p.end)continue;const Ue=A(W);Ue&&z.push(Ue)}return z.length===0?{}:z.length===1?{...z[0]}:LA(z[0],...z.slice(1))},LA=(u,...p)=>{const y={...u};for(const A of p)for(const x of Object.keys(y)){if(!(x in A)){delete y[x];continue}const z=y[x],W=A[x];(typeof z!=typeof W||JSON.stringify(z)!==JSON.stringify(W))&&delete y[x]}return y},Hj=async(u,p,y,A)=>{const x=g2(u),z=x.props??{},W=x.styleRef??null,re=z.alignment??null,fe=z.spacing??null,Me=z.indent??null,Ue=Me?{...Me.left!=null?{left:Me.left}:{},...Me.right!=null?{right:Me.right}:{},...Me.firstLine!=null?{firstLine:Me.firstLine}:{},...Me.hanging!=null?{hanging:Me.hanging}:{}}:null,$e=z.markRunProps??null,qe=z.numbering?.numId,Ze=typeof qe=="string"?parseInt(qe,10):typeof qe=="number"?qe:NaN,Ge=z.numbering?.level,et=isNaN(Ze)?null:{numId:Ze,...Ge!=null?{level:Ge}:{}};let ht=null;if(et&&typeof y.lists?.getState=="function")try{const dt=await y.lists.getState({target:Ao(p,A)});dt&&typeof y.lists?.getStyle=="function"&&(ht=await y.lists.getStyle(dt)??null)}catch{}return{styleId:W,alignment:re,spacing:fe,indentation:Ue,markRunProps:$e,numbering:et,listStyle:ht}},MA=async()=>{if(h.mode==="idle"||h.pointerSelecting||h.keyboardSelecting)return;const u=b()?.selection,p=async()=>{const W=typeof u?.current=="function"?await Promise.resolve(u.current({includeText:!0})):js().value;return zi(W)},y=()=>new Promise(W=>setTimeout(W,16)),A=8;let x=null,z="";for(let W=0;W<A;W+=1){if(W>0&&await y(),h.mode==="idle"||h.pointerSelecting||h.keyboardSelecting)return;if(x=await p(),!(!x||x.empty)&&(z=cc(x),z!==h.sourceSelectionKey))break}if(x&&!x.empty&&z!==h.sourceSelectionKey){await PA(x);return}if(h.snapshot?.paragraph){const W=await p();if(!W||cc(W)===h.sourceSelectionKey)return;await PA(W)}},PA=async u=>{const p=h.snapshot;if(!p){h.mode==="armed"&&xm();return}const y=b();if(!y)return;const A=Vs(u,"ready"),{lockModesById:x}=Hs(y.contentControls,A);if(cs(x)){Dt();return}const z=u.target,W=u.selectionTarget;if(u.empty!==!0&&Object.keys(p.inline).length>0){const re=yr(y,"format.apply");if(re&&W)try{if(!Io(Ns(await Promise.resolve(m2("format.apply",re,{target:W,inline:p.inline},u))))){Dt();return}}catch{Dt();return}}if(p.paragraph){const re=Array.isArray(z?.segments)?z.segments:[],fe=z?.story;for(const Me of re){const Ue=Ao(Me.blockId,fe),$e=await El(Ue),qe=$e?.node??null,Ze=$e?.address??null;if(!qe)continue;const Ge={kind:"block",nodeType:Ze?.nodeType??qe.kind??"paragraph",nodeId:Me.blockId,...fe&&typeof fe=="object"?{story:fe}:{}},{styleId:et,alignment:ht,spacing:dt,indentation:ot,markRunProps:Bt,numbering:zt,listStyle:Gn}=p.paragraph;if(et&&await y.styles?.paragraph?.setStyle?.({target:Ge,styleId:et}),ht&&await y.format?.paragraph?.setAlignment?.({target:Ge,alignment:ht}),dt){const Wn=dt,Jr=Wn.lineRule??"auto",eo=new Set(["auto","exact","atLeast"]).has(Jr)?Jr:"auto",Sr={...Wn.before!=null?{before:Math.round(Wn.before*20)}:{},...Wn.after!=null?{after:Math.round(Wn.after*20)}:{},...Wn.line!=null?{line:Math.round(eo==="auto"?Wn.line*240:Wn.line*20),lineRule:eo}:{}};await y.format?.paragraph?.setSpacing?.({target:Ge,...Sr})}if(ot){const Wn={...ot.left!=null?{left:Fs(ot.left)}:{},...ot.right!=null?{right:Fs(ot.right)}:{},...ot.firstLine!=null?{firstLine:Fs(ot.firstLine)}:{},...ot.hanging!=null?{hanging:Fs(ot.hanging)}:{}};await y.format?.paragraph?.setIndentation?.({target:Ge,...Wn})}Bt&&await y.format?.paragraph?.setMarkRunProps?.({target:Ge,markRunProps:Bt}),zt&&await y.format?.paragraph?.setNumbering?.({target:Ge,...zt}),Gn&&((await El(Ue))?.address?.nodeType==="listItem"?await y.lists?.applyStyle?.({target:vA(Me.blockId,fe),style:Gn}):zt&&await y.format?.paragraph?.setNumbering?.({target:Ge,...zt}))}}h.mode==="armed"&&xm(),Dt()},Em=(u,p,y)=>{const A=zj(u,p),x=A?A.then(()=>(Ac(u,p,y),di)):(Ac(u,p,y),di);return ku(u)?.inline?.kind==="toggle"&&(Wu=x),x},DA=u=>({id:u,getState:()=>P.toolbar.commands[u]??Hu(u,b(),P.selection,xl(P.selection)),observe:p=>jo(y=>y.toolbar.commands[u]??{enabled:!1,active:!1,supported:!1,source:"unsupported",reason:lt.commandUnsupported}).subscribe(p),execute:p=>Ac(u,p),executeAsync:p=>Em(u,p)}),$j=u=>{oe.set(u.id,u),Dt();const p=()=>{oe.delete(u.id),Dt()};return Object.assign(p,{handle:DA(u.id),unregister:p})},Tm=bo(u=>u.selection),Rm=qo(Tm),OA=()=>{const u=M();if(typeof u?.getHandles!="function")return{reason:lt.hostCapabilityUnavailable};let p=null;try{p=u.getHandles()}catch(A){const x=A?.reason;return{reason:x==="host-not-ready"||x==="host-disposed"||x==="editing-mount-required"?lt.notReady:lt.hostCapabilityUnavailable}}const y=p?.editing?.selectionTargets;return typeof y?.apply!="function"?{reason:lt.hostCapabilityUnavailable}:{helper:y}},Gj=u=>{const p=M();if(typeof p?.getHandles=="function")try{const y=p.getHandles()?.editing?.contentControls;typeof y?.activate=="function"&&y.activate({id:u})}catch{}},FA={get:Rm.get,getSnapshot:Rm.getSnapshot,subscribe:Rm.subscribe,observe:Rm.observe,current:()=>js().value,capture:()=>{const u=Tm.get();return u.empty||!u.target&&!u.selectionTarget?null:{...u,capturedAt:Date.now()}},restore:u=>{const p=x=>(Dt(),{...x,success:x.ok});if(!u||typeof u!="object")return p({ok:!1,reason:lt.targetUnresolved});if(!_())return p({ok:!1,reason:lt.notReady});const y=DV(u);if(!y)return p({ok:!1,reason:lt.targetUnresolved});const A=OA();if(!("helper"in A))return p({ok:!1,reason:A.reason});try{return p(cA(A.helper.apply(y)))}catch{return p({ok:!1,reason:lt.hostCapabilityUnavailable})}},apply:u=>{if(!_())return{ok:!1,reason:lt.notReady};const p=OA();if(!("helper"in p))return{ok:!1,reason:p.reason};try{const y=p.helper.apply(u);return Dt(),cA(y)}catch{return{ok:!1,reason:lt.hostCapabilityUnavailable}}},getAnchorRect:u=>{const p=M();if(typeof p?.getSelectionAnchorRect=="function"){const y=Lt(()=>p.getSelectionAnchorRect(u),null);return y&&typeof y=="object"&&(Number(y.width)>0||Number(y.height)>0)?y:null}return null},getRects:u=>{const p=Tm.get(),y=p.selectionTarget??p.target;if(p.empty||!y)return[];const A=zm.getRect({target:y,relativeTo:u?.relativeTo});return A.found?A.rects:[]}},Wj={get ids(){return Lr()},has:u=>ku(u)!=null||oe.has(u),get:u=>DA(u),execute:Ac,executeAsync:Em,register:$j,getContextMenuItems:u=>{const p=[];for(const y of oe.values()){const A=y.contextMenu;A&&Lt(A.when?()=>A.when(u):void 0,!0)&&p.push({id:y.id,label:A.label,group:A.group,order:A.order,invoke:()=>Ac(y.id,void 0,u)})}return p.sort((y,A)=>(y.order??0)-(A.order??0)||y.label.localeCompare(A.label))}},v2=qo(bo(u=>u.toolbar)),Kj={get:v2.get,getSnapshot:()=>P.toolbar,subscribe:v2.subscribe,observe:v2.observe,execute:Ac,executeAsync:Em},qu=async(u,p)=>{if(!_())return{success:!1,ok:!1,reason:lt.notReady};if(!u)return{success:!1,ok:!1,reason:lt.targetUnresolved};const y=M(),A=y?.scrollTargetIntoView;if(typeof A!="function")return{success:!1,ok:!1,reason:lt.hostCapabilityUnavailable};try{const x={target:u,block:p?.block??"center",behavior:p?.behavior??"smooth"},z=await Promise.resolve(p?.shouldContinue?A.call(y,x,p.shouldContinue):A.call(y,x));return z&&typeof z=="object"&&z.success===!1?{success:!1,ok:!1,reason:n2(z.reason,lt.targetUnresolved)}:{success:!0,ok:!0}}catch{return{success:!1,ok:!1,reason:lt.hostCapabilityUnavailable}}},NA=u=>{if(!u||typeof u!="object")return null;const p=u,y=p.wordRevisionIds&&typeof p.wordRevisionIds=="object"?p.wordRevisionIds:null,A=p.sourceIds&&typeof p.sourceIds=="object"?p.sourceIds:null,x=Array.isArray(A?.wordIdOther)?A.wordIdOther:void 0,z=y?.insert??y?.delete??y?.format??A?.wordIdInsert??A?.wordIdDelete??x?.[0];return typeof z=="string"&&z.length>0?z:null},BA=async(u,p,y,A,x)=>{const z=await qu(p,x);if(z.ok)return z;const W=w(),re=W?.focusTrackedChange;if(typeof re!="function")return z;const fe=y||A?{commentId:u,...y?{trackedChangeStory:y}:{},...A?{importedId:A}:{}}:u;try{const Me=await Promise.resolve(re.call(W,fe));if(Me&&typeof Me=="object"&&Me.ok===!0)return{success:!0,ok:!0}}catch{}return z},Lm=async(u,p,y,A)=>{const x=u==="trackChanges"?A?.story:void 0,z=dt=>{if(!x||!dt||typeof dt!="object")return dt;const ot=dt,Bt=ot.address&&typeof ot.address=="object"?ot.address:null;return ot.story||Bt?.story?dt:{...ot,story:x}},W=u==="trackChanges"?fA:Lf,re=y.find(dt=>Di(dt,p,x)),fe=re&&typeof re=="object"?re:null,Me=u==="trackChanges"&&fe?.type==="move"&&(fe.subtype==="move-to"||fe.subtype==="move-from")?fe.subtype:null,Ue=Me&&typeof fe?.trackedChangeCanonicalId=="string"?fe.trackedChangeCanonicalId:p,$e=dt=>{if(!Me)return u==="trackChanges"?fA(dt,{preferStableBlock:!0}):W(dt);const ot=Lf(dt);if(ot?.kind!=="move")return null;const Bt=Me==="move-to"?ot.destination:ot.source;return r2(Bt)?Bt:null},qe=W(re),Ze=u!=="trackChanges"||!Me&&r2(Lf(re));if(qe&&Ze)return z(qe);const Ge=b()?.[u],et=u==="comments"?{commentId:p}:{id:Ue,...x?{story:x}:{}},ht=Ge?.get;if(typeof ht!="function")return z(qe);try{return z($e(await Promise.resolve(ht.call(Ge,et)))??qe)}catch{return z(qe)}};function zA(u,p){if(zs())return Xn("Comments are read-only.","DOCUMENT_READONLY");if(ii())return Xn("Resolving comments is disabled.","DOCUMENT_READONLY");const y=b()?.comments,A=y?.patch;if(typeof A!="function")return Xn("comments.patch is unavailable.");const x=Xn("comments.patch failed.");return Lt(()=>Dl(A.call(y,{commentId:u,status:p}),x),x)}const Yf=()=>zs()?Xn("Comments are read-only.","DOCUMENT_READONLY"):null,qj=(u,p)=>{const y=p&&typeof p=="object"?p:null;let A=Array.from(u);y?.includeResolved===!1&&(A=A.filter(fe=>fe.status!=="resolved"));const x=Number(y?.offset),z=Number.isInteger(x)&&x>0?x:0,W=Number(y?.limit),re=Number.isInteger(W)&&W>=0?z+W:void 0;return A.slice(z,re)},Yu=bo(u=>u.comments),Mm=Oa(Yu,jo(u=>Lu(u.selection,u.comments)),"comments"),Yj={get:Mm.get,getSnapshot:Mm.getSnapshot,subscribe:Mm.subscribe,observe:Mm.observe,list:u=>{kt();const p=vc();return qj(p.value??Yu.get().items,u)},getById:u=>{const p=Yu.get().items.find(x=>oo(x)===u)??null;if(p)return p;const y=b()?.comments,A=Lt(y?.get?()=>y.get({commentId:u}):void 0,null);return xr(A)?null:A},createFromCapture:(u,p)=>{const y=Yf();if(y)return y;const A=b()?.comments,x=A?.create;if(typeof x!="function")return Xn("comments.create is unavailable.");const z=Xn("comments.create failed.");return Lt(()=>{const W=u&&typeof u=="object"?u.target??u.selectionTarget:null;return W==null?Xn("A range selection is required to comment.","NO_SELECTION"):Dl(x.call(A,{target:W,text:p.text}),z)},z)},createFromSelection:u=>{const p=Yf();if(p)return p;const y=b()?.comments,A=y?.create;if(typeof A!="function")return Xn("comments.create is unavailable.");const x=Tm.get(),z=x.target??x.selectionTarget;if(x.empty||!z)return Xn("A range selection is required to comment.","NO_SELECTION");const W=Xn("comments.create failed.");return Lt(()=>Dl(A.call(y,{target:z,text:u.text}),W),W)},reply:(u,p)=>{const y=Yf();if(y)return y;const A=b()?.comments,x=A?.reply??A?.create;if(typeof x!="function")return Xn("comments.reply is unavailable.");const z=Xn("comments.reply failed.");return Lt(()=>Dl(x===A?.reply?x.call(A,{parentCommentId:u,text:p.text}):x.call(A,{parentCommentId:u,text:p.text}),z),z)},edit:(u,p)=>{const y=Yf();if(y)return y;const A=b()?.comments,x=A?.patch;if(typeof x!="function")return Xn("comments.patch is unavailable.");const z=Xn("comments.patch failed.");return Lt(()=>Dl(x.call(A,{commentId:u,text:p.text}),z),z)},resolve:u=>zA(u,"resolved"),reopen:u=>zA(u,"active"),delete:u=>{const p=Yf();if(p)return p;const y=b()?.comments,A=y?.delete??y?.remove;if(typeof A!="function")return Xn("comments.delete is unavailable.");const x=Xn("comments.delete failed.");return Lt(()=>Dl(A.call(y,{commentId:u}),x),x)},setActive:u=>{if(u==null)return Re=null,Dt(),!0;if(!_())return!1;const p=Yu.get(),y=Q.get("comments"),A=y?.token===on()&&y.hasSettled&&Array.isArray(y.value)?y.value:null,x=A??p.items;if(!A&&p.listStatus!=="ready")return!1;const z=mV(x,u);return!z||!x.some(W=>oo(W)===z)?!1:(Re=z,Dt(),!0)},scrollTo:async u=>{if(!b())return{success:!1,ok:!1,reason:_()?lt.documentApiUnavailable:lt.notReady};const p=await Lm("comments",u,Yu.get().items);return p?qu(p):{success:!1,ok:!1,reason:lt.targetUnresolved}}},fs=bo(u=>u.trackChanges),y2=(u,p)=>{Be();const y=(Us().value??fs.get().items).map(Of).filter($e=>$e!=null&&oo($e)!==null);if(y.length===0)return null;const A=P.trackChanges.activeId,x=je?.id===A?je.story:void 0,z=y.filter($e=>dm($e)==null),W=x||z.length===0?y:z;let re=A?W.findIndex($e=>Di($e,A,x)):-1;re===-1&&A&&x&&(re=W.findIndex($e=>Di($e,A)));const fe=W[re===-1?u>0?0:W.length-1:(re+u+W.length)%W.length],Me=oo(fe),Ue=dm(fe);return ne(Ue?{id:Me,story:Ue}:{id:Me},p),Dt(),Me},VA=async u=>{const p=w(),y=p?.listTrackedChanges;if(typeof y=="function")try{await Promise.resolve(y.call(p,{mode:"visible-window",targetIds:[u],refreshReason:"ui-track-change-reveal-restamp",blocking:!0}))}catch{}};let jA=Promise.resolve();const Xj=u=>{const p=wt;return jA.catch(()=>{}).then(()=>Zj(u,p))},Zj=async(u,p)=>{if(wt!==p)return{success:!1};const y=je,A=y2(u,{invalidateQueuedNavigation:!1});if(A==null)return{success:!1};const x=je,z=tt,W=()=>wt===p&&je===x&&tt===z,re=()=>{W()&&(ne(y,{invalidateQueuedNavigation:!1}),Dt())};x&&We.add(x);try{const fe=await Lm("trackChanges",A,fs.get().items,x?.story?{story:x.story}:void 0);if(!W())return{success:!1};if(!fe)return re(),{success:!1};const Me=fs.get().items.find($e=>Di($e,A,x?.story))??fs.get().items.find($e=>oo($e)===A),Ue=NA(Me);gn+=1;try{const $e=await BA(A,fe,x?.story,Ue,{behavior:"auto",shouldContinue:W});if(!W())return{success:!1};if(!$e.ok&&$e.reason!==lt.targetNotVisible)re(),S(y);else{if($e.ok&&await VA(A),!W())return{success:!1};S(x)}return{success:$e.ok}}finally{gn=Math.max(0,gn-1),gn===0&&(W()?ci&&An(Qt(ci)):S(je))}}finally{x&&We.delete(x)}},UA=u=>{const p=Xj(u);return jA=p.then(()=>{},()=>{}),p},Pm=Oa(fs,jo(u=>ji(u.selection,u.trackChanges)),"trackChanges"),Qj={get:Pm.get,getSnapshot:Pm.getSnapshot,subscribe:Pm.subscribe,observe:Pm.observe,list:()=>{Be();const u=Us().value??fs.get().items,p=pn(on());return u.map(Of).filter(y=>y!=null).filter(y=>{const A=oo(y);return!A||!p?.has(A)})},accept:u=>b2("accept",u),reject:u=>b2("reject",u),acceptAll:()=>Xf("accept",{kind:"all"},null),rejectAll:()=>Xf("reject",{kind:"all"},null),next:()=>y2(1),previous:()=>y2(-1),navigateNext:()=>UA(1),navigatePrevious:()=>UA(-1),getAt:u=>{if(!u||typeof u!="object"||typeof u.x!="number"||typeof u.y!="number")return null;const p=k2(u);if(p.length===0)return null;const y=fs.get().items;let A;for(const x of p){if(x.type!=="trackedChange")continue;let z;if(x.story){if(A===void 0&&(A=si()),!A)continue;z=A}else z=y;const W=z.find(re=>Di(re,x.id,x.story));if(W)return x.story?{id:W.id,item:W,story:x.story}:{id:W.id,item:W}}return null},setActive:u=>{if(u==null)return ne(null),S(null),Dt(),!0;if(!_())return!1;const p=typeof u=="string"?{id:u}:{id:u.id,story:u.story};if(typeof p.id!="string"||p.id.length===0)return!1;const y=p.id;if(p.story){const A=si();if(!A)return!1;const x=dc(A,p.story).toPublicId(p.id)??p.id;if(!A.some(z=>Di(z,x,p.story)))return!1;p.id=x}else{const A=si()??fs.get().items,x=Os(A).toPublicId(p.id)??p.id,z=A.find(W=>oo(W)===x);if(!z)return!1;p.id=x,p.story=dm(z)}return y!==p.id&&(p.paintedEntityId=y),ne(p),S(p),Dt(),!0},scrollTo:async u=>{if(!b())return{success:!1,ok:!1,reason:_()?lt.documentApiUnavailable:lt.notReady};wt+=1,Te+=1;const p=Te,y=fs.get().items,A=Os(y).toPublicId(u)??u,x=y.find(Me=>oo(Me)===A),z=dm(x),W=NA(x),re=je,fe={id:A,...z?{story:z}:{},...A!==u?{paintedEntityId:u}:{}};We.add(fe);try{const Me=await Lm("trackChanges",A,y,z?{story:z}:void 0);if(Te!==p)return{success:!1,ok:!1};if(!Me)return{success:!1,ok:!1,reason:lt.targetUnresolved};ne(fe);const Ue=Te,$e=je,qe=tt,Ze=()=>Te===Ue&&je===$e&&tt===qe,Ge=()=>{Ze()&&(ne(re,{invalidateQueuedNavigation:!1}),Dt())};Dt(),gn+=1;try{const et=await BA(A,Me,z,W,{behavior:"auto",shouldContinue:Ze});if(!Ze())return{success:!1,ok:!1};if(!et.ok&&et.reason!==lt.targetNotVisible)Ge(),S(re);else{if(et.ok&&await VA(A),!Ze())return{success:!1,ok:!1};S(fe)}return et}finally{gn=Math.max(0,gn-1),gn===0&&(Ze()?ci&&An(Qt(ci)):S(je))}}finally{We.delete(fe)}}},b2=(u,p)=>{const{id:y,story:A}=typeof p=="string"?{id:p,story:void 0}:p,x={kind:"id",id:y,...A?{story:A}:{}};return Xf(u,x,y,A)},Xf=(u,p,y,A)=>{try{return To(w2(u,p,y,A))}catch{return!1}},w2=(u,p,y,A)=>{if(zs())return!1;const x=b()?.trackChanges,z=p.kind==="all"||p.scope==="all",W=p.kind==="range",re=p.kind==="ids";if(Uu({kind:u,scope:z?"all":"id"},x))return!1;const fe=z?`${u}All`:u,Me=!W&&!re&&!A&&x&&typeof x[fe]=="function"?x[fe]:null,Ue=x&&typeof x.decide=="function"?x.decide:null;return!Me&&!Ue?!1:Me?Me.call(x,y??{}):Ue.call(x,{decision:u,target:p})},C2=bo(u=>u.contentControls),Zf=u=>C2.get().items.find(p=>p?.id===u)??null,Dm=qo(C2),Jj=(u=>{if(u===void 0)return Dm.get();const p=fm(u);return p?Zf(p):null}),eU={get:(u=>(u!==void 0&&we("api"),Jj(u))),getSnapshot:Dm.getSnapshot,subscribe:Dm.subscribe,observe:Dm.observe,list:()=>(we("api"),C2.get().items),getById:u=>(we("api"),Zf(u)),getRect:u=>{const p=fm(u);if(!p)return ml("unresolved");we("panel");const y=Zf(p);if(!y)return ml("unresolved");const A=o2(y);return A?zm.getRect({target:A}):ml("unavailable")},scrollIntoView:async u=>{const p=fm(u);if(!p)return{success:!1};we("panel");const y=Zf(p);if(!y)return{success:!1};const A=o2(y);return A?{success:(await qu(A,{block:u.block,behavior:u.behavior})).ok}:{success:!1}},focus:async u=>{const p=fm(u);if(!p)return{success:!1,reason:"invalid-id"};if(!_())return{success:!1,reason:"not-ready"};we("panel");const y=Zf(p);if(!y)return{success:!1,reason:"not-found"};const A=o2(y);if(!A)return{success:!1,reason:"not-reachable"};if(!(await qu(A,{block:u.block,behavior:u.behavior})).ok)return{success:!1,reason:"not-reachable"};const x=cV(A);if(!x)return{success:!1,reason:"not-reachable"};const z=FA.apply(x);return!z.ok&&z.reason!==lt.hostCapabilityUnavailable?{success:!1,reason:"not-reachable"}:(Gj(p),{success:!0})}},Om=qo(bo(u=>u.fonts)),tU={get:Om.get,getSnapshot:Om.getSnapshot,subscribe:Om.subscribe,observe:Om.observe,getFamilyOptions:()=>P.fonts.options,getSizeOptions:()=>P.fonts.sizeOptions},Fm=qo(bo(u=>u.zoom)),nU={get:Fm.get,getSnapshot:Fm.getSnapshot,subscribe:Fm.subscribe,observe:Fm.observe,set:u=>{if(typeof t?.setZoom=="function")try{t.setZoom(u),Dt()}catch{}},setMode:u=>{if(typeof t?.setZoomMode=="function")try{t.setZoomMode(u),Dt()}catch{}}},Nm=qo(bo(u=>u.document)),rU={get:Nm.get,getSnapshot:Nm.getSnapshot,subscribe:Nm.subscribe,observe:Nm.observe,setMode:u=>{if(typeof t?.setDocumentMode=="function")try{t.setDocumentMode(u),Dt()}catch{}},export:u=>{if(typeof t?.export=="function")try{return Promise.resolve(t.export(u))}catch{return}},getText:()=>{const u=b(),p=Lt(u?.getText?()=>u.getText({}):void 0,null);return typeof p=="string"?p:p&&typeof p=="object"&&typeof p.text=="string"?p.text:null},replaceFile:u=>{const p=t?.replaceFile??t?.loadDocument??t?.reload;if(typeof p=="function")try{return Promise.resolve(p.call(t,u))}catch{return}}},HA=()=>{if(typeof HTMLElement>"u")return null;const u=_()?.mount?.container;if(u instanceof HTMLElement)return u;const p=t?.element;return p instanceof HTMLElement?p:null},oU=(u,p)=>{if(typeof u!="number"||typeof p!="number"||!Number.isFinite(u)||!Number.isFinite(p))return[];const y=globalThis.document;if(!y||typeof y.elementFromPoint!="function")return[];const A=HA();if(!A)return[];const x=y.elementFromPoint(u,p);if(!x||!A.contains(x))return[];const z=[x],W=ot=>{ot&&A.contains(ot)&&!z.includes(ot)&&z.push(ot)},re=y.elementsFromPoint;if(typeof re=="function"){let ot=[];try{ot=re.call(y,u,p)??[]}catch{ot=[]}for(const Bt of ot)W(Bt)}const fe=[],Me=ot=>{ot&&A.contains(ot)&&!fe.includes(ot)&&!z.includes(ot)&&fe.push(ot)},Ue=ot=>{const Bt=ot.getBoundingClientRect;if(typeof Bt!="function")return!1;let zt;try{zt=Bt.call(ot)}catch{return!1}return zt!=null&&u>=zt.left&&u<=zt.right&&p>=zt.top&&p<=zt.bottom};for(const ot of z){const Bt=ot.querySelectorAll;if(typeof Bt!="function")continue;let zt;try{zt=Bt.call(ot,"[data-track-change-marker]")}catch{continue}for(let Gn=0;Gn<zt.length;Gn+=1)Ue(zt[Gn])&&Me(zt[Gn])}fe.reverse();const $e=[...fe,...z],qe=lA($e[0],A);for(let ot=1;ot<$e.length;ot+=1)for(const Bt of lA($e[ot],A))qe.push(Bt);if(qe.length===0)return qe;const Ze=fs.get().items,Ge=Os(Ze);let et;const ht=new Set,dt=[];for(const ot of qe){if(ot.type!=="trackedChange"){const Wn=`${ot.type}:${ot.id}`;if(ht.has(Wn))continue;ht.add(Wn),dt.push(ot);continue}const Bt=lV(ot.storyKey)??aV(ot.story);let zt;if(Bt){if(et===void 0&&(et=si()),!et||(zt=dc(et,Bt).toPublicId(ot.id),!zt||!et.some(Wn=>Di(Wn,zt,Bt))))continue}else if(zt=Ge.toPublicId(ot.id),!zt)continue;const Gn=`trackedChange:${zt}`;ht.has(Gn)||(ht.add(Gn),dt.push(Bt?{type:"trackedChange",id:zt,story:Bt}:{type:"trackedChange",id:zt}))}return dt};function k2(u,p){return typeof u=="object"?oU(u?.x,u?.y):null}const Xu=new Set;let S2=!1;const $A=u=>{const p=M();if(typeof p?.observeGeometry!="function")return;let y=!1;const A=Lt(()=>{const x=p.observeGeometry(()=>u.schedule());return y=!0,x},null);u.detach=typeof A=="function"?A:null,u.boundHost=y?p:null},Bm=u=>{if(u.detach){try{u.detach()}catch{}u.detach=null}u.boundHost=null},GA=()=>{if(S2=!1,!(U||M()))for(const u of Xu)Bm(u)},iU=()=>{if(!S2){if(S2=!0,typeof queueMicrotask=="function"){queueMicrotask(GA);return}Promise.resolve().then(GA)}},sU=()=>{const u=M();if(!u){iU();return}for(const p of Xu)p.boundHost&&p.boundHost===u||(Bm(p),$A(p),p.schedule())};Ai.push(sU);const zm={getRect:u=>{const p=M(),y=p?.getTargetRects;if(typeof y=="function"){const A=Lt(()=>y.call(p,{target:u.target}),null);return A&&typeof A=="object"?A.success===!0&&Array.isArray(A.rects)?MV(LV(A.rects.filter(x=>x!=null&&typeof x=="object")),u.relativeTo):ml(typeof A.reason=="string"?A.reason:"unresolved"):ml("unresolved")}return ml("unavailable")},observe:u=>{const p=[];let y=0;const A=typeof requestAnimationFrame=="function",x=()=>{if(!A){u();return}y||(y=requestAnimationFrame(()=>{y=0,u()}))},z=jo(re=>({ready:re.ready,selection:re.selection,zoom:re.zoom}));p.push(z.subscribe(()=>x()));const W={schedule:x,detach:null,boundHost:null};return $A(W),Xu.add(W),()=>{Xu.delete(W),Bm(W),y&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(y);for(const re of p.splice(0))try{re()}catch{}}},getHost:()=>HA(),entityAt:k2,contextAt:u=>{const p=!!u&&typeof u.x=="number"&&typeof u.y=="number",y=p?u.x:0,A=p?u.y:0;return{point:{x:y,y:A},entities:p?k2({x:y,y:A}):[],selection:P.selection,position:null,insideSelection:!1}},scrollIntoView:async u=>{const p=u?.target;if(!p)return{success:!1};let y=null;if(p.kind==="entity"){const A=p.entityType==="comment"?"comments":"trackChanges",x=A==="comments"?Yu.get().items:fs.get().items,z=p.entityType==="trackedChange"&&p.story?{story:p.story}:void 0;y=await Lm(A,p.entityId,x,z)}else{const A=p,x=p,z=Array.isArray(A.segments)&&A.segments.length>0?A.segments:x.blockId&&x.range?[{blockId:x.blockId,range:x.range}]:null;if(z){const W=p.story;y={kind:"text",segments:z,...W?{story:W}:{}}}}return y?{success:(await qu(y,{block:u.block??"center",behavior:u.behavior??"smooth"})).ok}:{success:!1}}},WA=u=>{const p=(u&&typeof u=="object"?u:null)?.target;return p&&typeof p=="object"?p:null},KA=u=>`metadata:resolve:${u}`,aU=u=>{const p=b()?.metadata;if(!p||typeof p.resolve!="function")return null;const{value:y}=Tr(KA(u),on(),()=>p.resolve({id:u}),WA);return y},lU=async u=>{const p=b()?.metadata;if(!p||typeof p.resolve!="function")return null;try{const y=on(),A=await Promise.resolve(p.resolve({id:u}));if(y!==on())return null;const x=WA(A);return Q.set(KA(u),{token:y,value:x,hasSettled:!0,inflightToken:null}),x}catch{return null}},cU={getRect:u=>{const p=b()?.metadata;if(!p||typeof p.resolve!="function")return ml("unavailable");const y=aU(u.id);return y?zm.getRect({target:y}):ml("unresolved")},scrollIntoView:async u=>{const p=await lU(u.id);return p?{success:(await qu(p,{block:u.block,behavior:u.behavior})).ok}:{success:!1}}},uU={inTable:!1,tableNodeId:null,rowIndex:null,columnIndex:null,cellNodeId:null,rows:null,columns:null},dU={getContext:()=>{const u=ke();if(!u)return{...uU};const p=ve()?.table;return{inTable:!0,tableNodeId:u.tableNodeId,rowIndex:u.rowIndex,columnIndex:u.columnIndex,cellNodeId:u.cellNodeId,rows:typeof p?.rows=="number"?p.rows:null,columns:typeof p?.columns=="number"?p.columns:null}},isInTable:()=>ke()!=null},Vm={query:"",total:0,activeIndex:-1,open:!1,available:!1,caseSensitive:!1,includeDeletedText:!1,regex:!1,canReplace:!1,reason:lt.searchUnavailable};let Nn={...Vm};const jm=new Set,Na=()=>{const u=M()?.search;return u&&typeof u=="object"?u:null},Ws=()=>{const u=se()?.search;return u&&typeof u=="object"?u:null},Qf=()=>{const u=Na();if(u&&typeof u.setSession=="function")return!0;const p=Ws();return!!p&&typeof p.query=="function"&&typeof p.getState=="function"},hs=()=>{for(const u of[...jm])try{u(Nn)}catch{}},fi=u=>(Nn={...Nn,...u},hs(),Nn);let ao=0,Ic=null;const qA=()=>{const u=Ic;Ic=null,u&&Lt(()=>(u(),null),null)},fU=()=>{ao+=1,qA();const u=Qf();Nn={...Vm,available:u,reason:u?void 0:lt.searchUnavailable},hs()};Tt.push(fU);const hU=u=>{if(!u)return!1;const p=u.queryError;if(p&&typeof p=="object"&&p.code==="invalid-pattern")return!0;const y=u.rejection;return u.status==="rejected"&&!!y&&typeof y=="object"&&y.code==="invalid-pattern"},_2=(u,p=!1)=>{const y=u&&typeof u=="object"?u:null;if(!y)return null;const A=Array.isArray(y.matches)?y.matches:[],x=typeof y.total=="number"&&Number.isFinite(y.total)?y.total:A.length,z=typeof y.activeMatchIndex=="number"?y.activeMatchIndex:typeof y.activeIndex=="number"?y.activeIndex:-1;return{...typeof y.query=="string"?{query:y.query}:{},total:x,activeIndex:z,canReplace:y.canReplace===!0||p,...y.includeDeletedText===!0?{includeDeletedText:!0}:{},...y.regex===!0?{regex:!0}:{},...hU(y)?{invalidPattern:!0}:{}}},Ro=()=>{const u=pe("find.replace"),p=pe("find.replaceAll");return u?.enabled===!0||p?.enabled===!0},Lo=(u,p=!1)=>{const y=_2(u,p);if(!y){fi({total:0,activeIndex:-1,canReplace:!1,reason:void 0});return}fi({...y.query!==void 0?{query:y.query}:{},total:y.total,activeIndex:y.activeIndex,canReplace:y.canReplace,...y.includeDeletedText!==void 0?{includeDeletedText:y.includeDeletedText}:{},...y.regex!==void 0?{regex:y.regex}:{},reason:y.invalidPattern?lt.searchInvalidPattern:void 0})},Ba=()=>{const u=Na();if(u&&typeof u.getState!="function")return Nn={...Nn,available:Qf(),reason:Qf()?void 0:lt.searchUnavailable},Nn;if(!u){const y=Ws();if(y&&typeof y.getState=="function"){const A=_2(Lt(()=>y.getState(),null),Ro());if(A)return Nn={...Nn,...A.query!==void 0?{query:A.query}:{},total:A.total,activeIndex:A.activeIndex,canReplace:A.canReplace,available:!0,reason:A.invalidPattern?lt.searchInvalidPattern:void 0,open:Nn.open||!!A.query},Nn}return Nn={...Vm,query:Nn.query,caseSensitive:Nn.caseSensitive,includeDeletedText:Nn.includeDeletedText},Nn}const p=_2(Lt(()=>u.getState(),null));return p&&(Nn={...Nn,...p.query!==void 0?{query:p.query}:{},total:p.total,activeIndex:p.activeIndex,canReplace:p.canReplace,...p.includeDeletedText!==void 0?{includeDeletedText:p.includeDeletedText}:{},...p.regex!==void 0?{regex:p.regex}:{},available:!0,reason:p.invalidPattern?lt.searchInvalidPattern:void 0,open:Nn.open||!!p.query}),Nn},Zu=u=>{const p=u&&typeof u=="object"?u:null;if(p?.status==="committed")return{ok:!0};if(p?.status==="rejected"&&p.reason==="read-only")return{ok:!1,reason:lt.documentReadonly};const y=p?.rejection;return p?.status==="rejected"&&y&&typeof y=="object"&&y.code==="read-only-document"?{ok:!1,reason:lt.documentReadonly}:{ok:!1,reason:lt.operationUnavailable}},Um=qo({get:()=>Ba(),subscribe:u=>(jm.add(u),()=>jm.delete(u))}),pU={get:Um.get,getSnapshot:Um.getSnapshot,subscribe:Um.subscribe,observe:Um.observe,open:()=>Qf()?(fi({available:!0,open:!0,reason:void 0}),{ok:!0}):(fi({available:!1,open:!1,reason:lt.searchUnavailable}),{ok:!1,reason:lt.searchUnavailable}),close:()=>{if(ao+=1,Ic)qA();else{const u=Na();if(u&&typeof u.clear=="function")Lt(()=>u.clear(),null);else{const p=Ws();p&&typeof p.query=="function"&&Lt(()=>p.query({query:""}),null)}}Nn={...Vm,available:Qf(),reason:void 0},Nn.available||(Nn.reason=lt.searchUnavailable),hs()},search:(u,p)=>{const y=Na(),A=!!p?.caseSensitive,x=p?.includeDeletedText===!0,z=p?.regex===!0,W=++ao;if(!y||typeof y.setSession!="function"){const fe=Ws();if(fe&&typeof fe.query=="function"&&typeof fe.getState=="function"){fi({query:u,caseSensitive:A,includeDeletedText:x,regex:z,available:!0,open:!0,reason:void 0}),Ic=()=>{fe.query({query:""})};const Me=Lt(()=>fe.query({query:u,caseSensitive:A,includeDeletedText:x,regex:z}),null);return xr(Me)?Promise.resolve(Me).then(Ue=>{W===ao&&Lo(Ue,Ro())},()=>{W===ao&&fi({available:!1,reason:lt.searchUnavailable})}):Lo(Me,Ro()),Lo(Lt(()=>fe.getState(),null),Ro()),Nn}return fi({query:u,total:0,activeIndex:-1,available:!1,caseSensitive:A,includeDeletedText:x,regex:z,reason:lt.searchUnavailable})}fi({query:u,caseSensitive:A,includeDeletedText:x,regex:z,available:!0,open:!0,reason:void 0}),Ic=()=>{typeof y.clear=="function"&&y.clear()};const re=Lt(()=>y.setSession(u,{caseSensitive:A,includeDeletedText:x,...z?{regex:!0}:{},highlight:!0}),null);if(Lo(re),u.length>0&&Nn.total===0&&Nn.reason!==lt.searchInvalidPattern){const fe=Ws();if(fe&&typeof fe.query=="function"&&typeof fe.getState=="function"){const Me=Ic;Ic=()=>{Me?.(),fe.query({query:""})};const Ue=Lt(()=>fe.query({query:u,caseSensitive:A,includeDeletedText:x,regex:z}),null);xr(Ue)?Promise.resolve(Ue).then($e=>{W===ao&&Lo($e,Ro())},()=>{W===ao&&fi({available:!1,reason:lt.searchUnavailable})}):Lo(Ue,Ro()),Lo(Lt(()=>fe.getState(),null),Ro())}}return Nn},next:()=>{const u=Na();if(!u||typeof u.next!="function"){const p=Ws();if(!p||typeof p.next!="function"||typeof p.getState!="function")return{ok:!1,reason:lt.searchUnavailable};if(Nn.total===0)return{ok:!1,reason:lt.operationUnavailable};const y=Lt(()=>p.next(),null);if(xr(y)){const A=ao;Promise.resolve(y).then(x=>{A===ao&&Lo(x,Ro())}).catch(()=>{A===ao&&fi({available:!1,reason:lt.searchUnavailable})})}else Lo(y,Ro());return Lo(Lt(()=>p.getState(),null),Ro()),{ok:!0}}return Nn.total===0?{ok:!1,reason:lt.operationUnavailable}:(Lo(Lt(()=>u.next(),null)),{ok:!0})},previous:()=>{const u=Na();if(!u||typeof u.previous!="function"){const p=Ws();if(!p||typeof p.previous!="function"||typeof p.getState!="function")return{ok:!1,reason:lt.searchUnavailable};if(Nn.total===0)return{ok:!1,reason:lt.operationUnavailable};const y=Lt(()=>p.previous(),null);if(xr(y)){const A=ao;Promise.resolve(y).then(x=>{A===ao&&Lo(x,Ro())}).catch(()=>{A===ao&&fi({available:!1,reason:lt.searchUnavailable})})}else Lo(y,Ro());return Lo(Lt(()=>p.getState(),null),Ro()),{ok:!0}}return Nn.total===0?{ok:!1,reason:lt.operationUnavailable}:(Lo(Lt(()=>u.previous(),null)),{ok:!0})},clear:()=>{ao+=1;const u=Na();if(u&&typeof u.clear=="function"&&Lt(()=>u.clear(),null),!u||typeof u.clear!="function"){const p=Ws();p&&typeof p.query=="function"&&Lt(()=>p.query({query:""}),null)}fi({query:"",total:0,activeIndex:-1,canReplace:!1})},replace:u=>{const p=Na();if(!p){const A=Ws();if(!A||typeof A.replace!="function"||typeof A.getState!="function")return{ok:!1,reason:lt.searchUnavailable};if(!Ro())return{ok:!1,reason:lt.operationUnavailable};const x=Lt(()=>A.replace({replacement:typeof u=="string"?u:""}),null);if(xr(x)){const z=ao;Ba(),hs();const W=()=>z===ao;return Promise.resolve(x).then(re=>(W()&&(Lo(re,Ro()),Ba(),hs()),Zu(re)),()=>(W()&&fi({available:!1,reason:lt.searchUnavailable}),{ok:!1,reason:lt.searchUnavailable}))}return Ba(),hs(),Zu(x)}if(typeof p.replaceCurrent!="function")return{ok:!1,reason:lt.operationUnavailable};const y=Lt(()=>p.replaceCurrent(typeof u=="string"?u:""),null);return Ba(),hs(),Zu(y)},replaceAll:u=>{const p=Na();if(!p){const A=Ws();if(!A||typeof A.replaceAll!="function"||typeof A.getState!="function")return{ok:!1,reason:lt.searchUnavailable};if(!Ro())return{ok:!1,reason:lt.operationUnavailable};const x=Lt(()=>A.replaceAll({replacement:typeof u=="string"?u:""}),null);if(xr(x)){const z=ao;Ba(),hs();const W=()=>z===ao;return Promise.resolve(x).then(re=>(W()&&(Lo(re,Ro()),Ba(),hs()),Zu(re)),()=>(W()&&fi({available:!1,reason:lt.searchUnavailable}),{ok:!1,reason:lt.searchUnavailable}))}return Ba(),hs(),Zu(x)}if(typeof p.replaceAll!="function")return{ok:!1,reason:lt.operationUnavailable};const y=Lt(()=>p.replaceAll(typeof u=="string"?u:""),null);return Ba(),hs(),Zu(y)}},YA=bo(u=>u.styles),Hm=qo(YA),mU={get:Hm.get,getSnapshot:Hm.getSnapshot,subscribe:Hm.subscribe,observe:Hm.observe,getCatalog:u=>mn(u).value,getQuickGallery:()=>YA.get().quickGallery,getActiveParagraphStyle:()=>Xr(P.selection,ar().cache).style},XA={select:jo,get state(){return P},selection:FA,commands:Wj,toolbar:Kj,comments:Yj,trackChanges:Qj,contentControls:eU,fonts:tU,zoom:nU,document:rU,viewport:zm,metadata:cU,tables:dU,search:pU,styles:mU,formatPainter:{setPointerSelecting(u){U||(h={...h,pointerSelecting:u})},notifyPointerUp(){U||(h={...h,pointerSelecting:!1},MA())},setKeyboardSelecting(u){U||(h={...h,keyboardSelecting:u})},notifyKeyUp(){U||(h={...h,keyboardSelecting:!1},MA())},cancel(){U||xm()},onModeChange(u){return U?()=>{}:(m.add(u),()=>m.delete(u))}},createScope:()=>{const u=[];return{select:(p,y)=>{const A=jo(p,y);return{get:A.get,subscribe:x=>{const z=A.subscribe(x);return u.push(z),z}}},dispose:()=>{for(const p of u.splice(0))p()}}},destroy:()=>{if(!U){U=!0,Zz(Pt,It),Je&&(clearTimeout(Je),Je=null),he&&(clearTimeout(he),he=null,Pe=0),me?.timer&&(clearTimeout(me.timer),me.timer=null),me=null,ut&&(clearTimeout(ut),ut=null),vo&&(clearTimeout(vo),vo=null),Kr&&Kr(),Kr=null,Wr=null,$r=0,xo=0,jn.clear(),sr.clear(),Yt.clear(),Rn=null,Z.clear();for(const u of Zr.splice(0))u();kr&&kr(),kr=null,dn=null,Hi&&Hi(),Hi=null,us=null,Ko&&Ko(),Ko=null,yo=null,Vo&&Vo(),Vo=null,ci=null,ui&&ui(),ui=null,Gi=null,G&&G(),G=null,F=null;for(const u of Xu)Bm(u);Xu.clear(),O.clear(),jm.clear(),g+=1,m.clear(),ao+=1,oe.clear()}}};return $=XA,XA}var VV=[{value:"Arial",label:"Arial",previewFamily:"Arial, sans-serif"},{value:"Calibri",label:"Calibri",previewFamily:"Calibri, sans-serif"},{value:"Courier New",label:"Courier New",previewFamily:'"Courier New", monospace'},{value:"Georgia",label:"Georgia",previewFamily:"Georgia, serif"},{value:"Times New Roman",label:"Times New Roman",previewFamily:'"Times New Roman", serif'},{value:"Verdana",label:"Verdana",previewFamily:"Verdana, sans-serif"}];function jV(e){const t=e.trim(),n=t[0];if(n==='"'||n==="'"){const o=t.indexOf(n,1);if(o>0)return t.slice(1,o).trim()}const r=t.indexOf(",");return(r===-1?t:t.slice(0,r)).trim().replace(/^["']|["']$/g,"")}function UV(e){if(!Array.isArray(e))return[];const t=[];for(const n of e){if(!n||typeof n!="object")continue;const r=n,o=typeof r.logicalFamily=="string"?jV(r.logicalFamily):"";if(!o)continue;const i=typeof r.previewFamily=="string"&&r.previewFamily.trim()?r.previewFamily.trim():o;t.push({value:o,label:o,previewFamily:i})}return t}function HV(e){if(!Array.isArray(e))return[];const t=[];for(const n of e){if(!n||typeof n!="object")continue;const r=n,o=typeof r.value=="string"?r.value.trim():"";if(!o)continue;const i=typeof r.label=="string"&&r.label.trim()?r.label.trim():o,s=typeof r.previewFamily=="string"&&r.previewFamily.trim()?r.previewFamily.trim():o;t.push({value:o,label:i,previewFamily:s})}return t}function $V(e,t=[]){const n=[],r=new Set,o=s=>{const a=String(s.value).trim().toLowerCase();!a||r.has(a)||(r.add(a),n.push(s))};for(const s of e)o(s);const i=t.length?t:VV;for(const s of i)o(s);return n}var GV=[{value:"8",label:"8"},{value:"9",label:"9"},{value:"10",label:"10"},{value:"11",label:"11"},{value:"12",label:"12"},{value:"14",label:"14"},{value:"16",label:"16"},{value:"18",label:"18"},{value:"24",label:"24"},{value:"36",label:"36"}];function WV(e,t){return e.activeMark?t.activeMarks.includes(e.activeMark):!1}xt();var KV=['[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(", "),qV=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"]);async function YV(e,t){const n=new m6.default;return e.forEach((r,o)=>{n.file(t[o],r)}),n.generateAsync({type:"blob",compression:"DEFLATE"})}function f2(e){return!!(e&&(e.synced===!0||e.isSynced===!0))}function _A(e){try{e.synced=!0}catch{}try{e.isSynced=!0}catch{}}function XV(e,t){if(!e)return()=>{};if(f2(e))return t(),()=>{};const n=typeof e.on=="function"?e.on.bind(e):null,r=typeof e.off=="function"?e.off.bind(e):null;if(!n)return t(),()=>{};let o=!1;const i=()=>{o||(o=!0,r?.("synced",a),r?.("sync",l))},s=()=>{o||(i(),t())},a=()=>{_A(e),s()},l=c=>{c!==!1&&(c===!0||f2(e))&&(_A(e),s())};return n("synced",a),n("sync",l),f2(e)&&s(),i}function ZV(e,t){const n=e.composedPath();if(!n.includes(t))return null;const r=n.find(a=>a instanceof HTMLElement&&a.matches(KV));if(!r)return null;const o=n.some(a=>a instanceof HTMLElement&&a.classList.contains(Qh.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 QV(e){if(!e||typeof e!="object")return[];const t=e.items;return Array.isArray(t)?t:[]}function JV(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 ni(e){return!!(e&&typeof e=="object"&&e.editorVersion===2)}function ej(e){const t=e&&typeof e=="object"?e.code:null;return t==="comment-export-missing-story-reference"||t==="v2-worker-comment-export-mode-unsupported"}function AA(e){return typeof e=="string"&&e.length>0?e:null}function IA(e){return e?ni(e)?AA(e.documentId??e.options?.documentId??null):AA(typeof e.getDocumentId=="function"?e.getDocumentId():e.options?.documentId):null}function tj(e){if(!e||ni(e))return null;const t=e;return t.documentRenderer??t.presentationEditor??null}function is(e){if(!e)return null;if(ni(e))return e.fonts??null;const t=tj(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 vm=class extends Gm.default{static{this.allowedTypes=[Nr,Xl,qh]}#e;#n;#t;#r;#i;#s;#d;#h;#f;#c;#p;get uiConfig(){return this.#p}#o;get interactionConfig(){return this.#o}#l;get surfacesConfig(){return this.#l}#g;#u;#y;#w;constructor(e){if(super(),this.#e=!1,this.#n=!1,this.#t=null,this.#r=null,this.#i=null,this.#s=null,this.#d=null,this.#h=null,this.#f=n=>{this.#k(n)},this.#c=null,this.#p=N4({}),this.#o=B4({}),this.#l=V4({}),this.version="0.0.0",this.users=[],this.whiteboard=null,this.colors=[],this.readyEditors=0,this.pendingCollaborationSaves=0,this.#u=new KF,this.#y=null,this.#w=!1,this.config={selector:"#superdoc",documentMode:"editing",allowSelectionInViewMode:!1,role:"editor",document:{},documents:[],editorExtensions:[],colors:[],users:[],user:{...W0},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.#Z=new WeakSet,this.#Q=null,this.#j=null,this.#L=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.#g=new OF({getModuleConfig:()=>this.#l}),this.#h=t,t.addEventListener("click",this.#f,!0),this.#I(e,t)}async#k(e){const t=this.#h;if(!t)return;const n=ZV(e,t),r=this.activeEditor?.doc?.contentControls?.list;if(!(!n||typeof r!="function"))try{const o=await r();if(this.#e)return;const i=JV(QV(o).find(s=>s.id===n));i&&this.emit("content-control:click",{target:i,source:"pointer"})}catch{return}}async#I(e,t){this.config={...this.config,...e},!this.config.comments||typeof this.config.comments!="object"?this.config.comments={visible:!1}:typeof this.config.comments.visible!="boolean"&&(this.config.comments.visible=!1),UF(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&&this.config.useLayoutEngine&&!r&&(console.warn("[SuperDoc] Web layout uses PM fallback unless layoutEngineOptions.flowMode is set to 'semantic'. Automatically disabling layout engine."),this.config.useLayoutEngine=!1),!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.#ye(),this.config.user=HF(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=Dk(this.config.modules.comments),this.#p=N4(this.config),this.#o=B4(this.config),this.#l=V4(this.config),this.config.disableContextMenu=!this.#p.contextMenu.enabled,this.config.rulers=this.#p.ruler.enabled,this.#p.comments.enabled?this.config.modules.comments===!1&&(this.config.modules.comments={}):this.config.modules.comments=!1,this.#p.comments.enabled){this.config.modules.comments===!0&&(this.config.modules.comments={});const i=this.config.modules.comments;i&&Object.assign(i,this.#o.comments)}if(this.config.colors=S6(this.config.colors),this.userColorMap=new Map,this.colorIndex=0,this.version="2.4.0-next.52",this.#C("🦋 [superdoc] Using SuperDoc version:",this.version),this.superdocId=e.superdocId||ps(),this.colors=this.config.colors??[],this.#D(),await mT(),this.#e)return;if(await this.#b(this.config.modules),this.#e){this.#ue();return}this.config.cspNonce&&this.#P(),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.#y||(this.#y=this.#u.subscribe(i=>{this.#we(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.#d=o,this.#S(),this.#M(),this.#Ce(),this.#x()}#x(){if(this.#E(),this.readyEditors=0,!this.app)throw new Error("SuperDoc: #startRuntime called before #initVueApp populated this.app");this.app.mount(this.#d)}#M(){const e=this.config.modules?.whiteboard,t=e!==!1&&(e?.enabled??!1);this.whiteboard=new aD({Renderer:MF,superdoc:this,enabled:t}),this.emit("whiteboard:init",{whiteboard:this.whiteboard})}get requiredNumberOfEditors(){return this.#m("requiredNumberOfEditors").documents.filter(e=>e.type===Nr).length}get ui(){return this.#c||(this.#c=zV({superdoc:this}),this.#e&&this.#c.destroy()),this.#c}get state(){return{documents:this.#m("state").documents,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}#P(){const e=this.config.cspNonce,t=document.createElement;document.createElement=function(n){const r=t.call(this,n);return n.toLowerCase()==="style"&&r.setAttribute("nonce",e),r}}#D(){const e=this.config.document,t=!!e&&typeof e=="object"&&Object.keys(e)?.length,n=!!e&&typeof e=="string"&&e.length>0,r=!!e&&typeof File=="function"&&e instanceof File,o=!!e&&e instanceof Blob&&!(e instanceof File),i=this.config.documents&&this.config.documents?.length;if(t&&i&&console.warn("🦋 [superdoc] You can only provide one of document or documents"),t){const s=Gd(this.config.document);this.config.documents=[{id:ps(),...s}]}else if(n)this.config.documents=[{id:ps(),type:Nr,url:this.config.document,name:"document.docx"}];else if(r){const s=Gd(this.config.document);this.config.documents=[{id:ps(),...s}]}else if(o){const s=Gd(this.config.document);this.config.documents=[{id:ps(),...s}]}Array.isArray(this.config.documents)&&this.config.documents.length>0&&(this.config.documents=this.config.documents.map(s=>{const a=Gd(s);if(!a||typeof a!="object")return a;const l=typeof a=="object"&&"id"in a&&a.id||s&&typeof s=="object"&&"id"in s&&s.id;return{...a,id:l||ps()}}))}#E(){const{app:e,pinia:t,superdocStore:n,commentsStore:r,highContrastModeStore:o}=YP({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.#g),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&&eT(this),this.#ce()}#a(e,t){t&&this.on(e,t)}#S(){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:active-change",this.config.onContentControlActiveChange),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.on("collaboration-ready",e=>this.#$(e?.editor??null)),this.#a("editor-update",this.config.onEditorUpdate),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)}async#b({collaboration:e}={}){return e?(this.isCollaborative=!1,this.config.documents.length===0&&(this.config.documents=[{id:ps(),type:Nr,name:"document.docx"}]),this.config.v2CollaborationPreflightFailure={code:"collaboration-v1-config-unsupported",message:"SuperDoc v2 cannot use modules.collaboration because it is the SuperDoc v1 collaboration API. SuperDoc did not attach the provider or change the document. Configure Document.v2Collaboration with a v2 room instead."},this.config.documents):this.config.documents}#ee(e,t){this.isCollaborative=!0,this._commentsCollabInitialized=!1,this.ydoc=no(e),this.provider=no(t),this.#_();const n=this.config;this._cleanupAwareness=Y8(t,this,n.user),n.documents.forEach(r=>{r.ydoc=e,r.provider=t,r.role=this.config.role})}#H(){this.#s=null,this.#A(),typeof this._cleanupAwareness=="function"&&(this._cleanupAwareness(),this._cleanupAwareness=null),this.isCollaborative=!1,this._commentsCollabInitialized=!1,this.ydoc=void 0,this.provider=void 0;const e=this.config;delete e.modules.collaboration,e.documents.forEach(t=>{delete t.ydoc,delete t.provider})}#A(){if(this.#r){try{this.#r()}catch{}this.#r=null}if(this.#i){try{this.#i()}catch{}this.#i=null}}#$(e){this.#A(),ni(e)&&(this.#O(e),this.#T(e))}#O(e){const t=e.presence;if(!t||typeof t.subscribe!="function")return;const n=rD(()=>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.#r=t.subscribe(r)}catch(o){console.warn("[SuperDoc] v2 awareness bridge failed to subscribe",o)}}#T(e){const t=e.lock;if(!t||typeof t.subscribe!="function")return;const n=r=>{this.#e||this.#v(!!r.isLocked,this.#F(r.lockedBy??null))};try{if(this.#s&&typeof t.setLocked=="function"){const o=this.#s;t.setLocked(o.isLocked,o.isLocked?o.lockedBy:null),this.#s=null}const r=t.getSnapshot?.();r&&n(r),this.#i=t.subscribe(n)}catch(r){console.warn("[SuperDoc] v2 lock bridge failed to subscribe",r)}}#F(e){return!e||typeof e!="object"||Array.isArray(e)?null:{...e}}#G(e,t){return JSON.stringify(e??null)===JSON.stringify(t??null)}#v(e,t){this.isLocked===e&&this.#G(this.lockedBy,t)||(this.isLocked=e,this.lockedBy=t,this.#C("🦋 [superdoc] Locking superdoc:",e,t,`
|
|
103
103
|
|
|
104
104
|
|
|
105
105
|
`),this.emit("locked",{isLocked:e,lockedBy:t}))}#_(){const e=this.config.user;if(!e||e.color)return;const t=this.colors.length>0?this.colors:qV,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){const{target:t}=this.#pe(e);this.#n=!0;try{const n=await this.#he(),r=this.#W(),o=this.#N();this.#K();try{this.#s=o;const i=await this.#de(t,n);this.#fe(i,t),this.#s=null}catch(i){throw this.#B(r),i}}finally{this.#t=null,this.#n=!1}}#N(){return{isLocked:this.isLocked,lockedBy:this.lockedBy?{...this.lockedBy}:null}}#W(){const e=this.config.documents.find(r=>r.type===Nr),t=this.superdocStore?.documents.find(r=>r.id===e.id)??null,n=t?Cn(t):null;return{isCollaborative:this.isCollaborative,configV2Collaboration:e.v2Collaboration??null,configData:e.data,storeDoc:t,storeV2Collaboration:this.#Y(n),storeData:t?.data}}#B(e){this.#s=null;const t=this.config.documents.find(n=>n.type===Nr);t.v2Collaboration=e.configV2Collaboration,t.data=e.configData,this.isCollaborative=e.isCollaborative,e.storeDoc&&(e.storeDoc.data=e.storeData,this.#z(e.storeDoc,e.storeV2Collaboration))}#K(){if(this.#e)throw new Error("SuperDoc: instance was destroyed during upgrade")}#m(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}#te(e){if(!this.commentsStore)throw new Error(`SuperDoc: ${e} requires the instance to be ready; wait for the "ready" event before calling.`);return this.commentsStore}#R(e){if(!this.superdocStore)throw new Error(`SuperDoc: ${e} requires the instance to be ready; wait for the "ready" event before calling.`)}#q(e,t){const n=this.superdocStore?.documents;if(Array.isArray(n))for(const r of n){const o=Cn(r);o.ydoc&&typeof o.ydoc=="object"&&"value"in o.ydoc&&(o.ydoc.value=e),o.provider&&typeof o.provider=="object"&&"value"in o.provider&&(o.provider.value=t)}}#Y(e){if(!e)return null;const t=e.v2Collaboration;return t&&typeof t=="object"&&"value"in t?t.value:t??null}#z(e,t){const n=Cn(e).v2Collaboration;if(n&&typeof n=="object"&&"value"in n){n.value=t;return}e.v2Collaboration=t}#ne(e){return e.providerFamily==="liveblocks"?{providerType:"liveblocks",documentId:e.documentId,roomMode:e.roomMode,...e.publicApiKey?{publicApiKey:e.publicApiKey}:{},...e.authEndpoint?{authEndpoint:e.authEndpoint}:{}}:e.providerFamily==="hocuspocus"?{providerType:"hocuspocus",documentId:e.documentId,roomMode:e.roomMode,...e.serverUrl?{serverUrl:e.serverUrl}:{},...e.params?{params:e.params}:{},...e.token?{token:e.token}:{}}:{providerType:"y-websocket",documentId:e.documentId,roomMode:e.roomMode,...e.serverUrl?{serverUrl:e.serverUrl}:{},...e.params?{params:e.params}:{}}}async#de(e,t){const n=this.config.documents.find(s=>s.type===Nr),r=this.#m("upgradeToCollaboration").documents.find(s=>s.id===n.id);if(!r)throw new Error("SuperDoc: source document store entry is not available for upgrade");const o=r.getEditor?.();if(!ni(o)||typeof o.upgradeToCollaboration!="function")throw new Error("SuperDoc: live v2 editor cannot attach collaboration in place");const i=this.#ne({...e,roomMode:"create"});return n.v2Collaboration=i,this.#z(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.#ne({...t,roomMode:"join"});e.configDoc.v2Collaboration=n,this.#z(e.storeDoc,n)}async#he(){const e=this.activeEditor;if(ni(e)&&typeof e.save=="function"){const r=await e.save();return this.#X(r)}const t=this.config.documents.find(r=>r.type===Nr),n=(this.superdocStore?.documents.find(r=>r.id===t.id)??null)?.data??t.data;if(n instanceof Blob)return n;if(n instanceof Uint8Array||n instanceof ArrayBuffer)return this.#X(n);throw new Error("SuperDoc: upgradeToCollaboration() requires a live v2 editor save or DOCX Blob source")}#X(e){if(e instanceof Blob)return e;if(e instanceof Uint8Array){const t=new Uint8Array(e.byteLength);return t.set(e),new Blob([t],{type:Nr})}if(e instanceof ArrayBuffer)return new Blob([e],{type:Nr});throw new Error("SuperDoc: active v2 editor returned an unsupported DOCX save payload")}#re(e,t){const n=IA(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.#X(t),i=r.v2Collaboration&&typeof r.v2Collaboration=="object"&&r.v2Collaboration.roomMode==="create"?{...r.v2Collaboration,roomMode:"join"}:null;r.data=o,i&&(r.v2Collaboration=i);const s=this.superdocStore?.documents.find(a=>a.id===r.id)??null;s&&(s.data=o,i&&this.#z(s,i))}#Ae(){const e=this.superdocStore?.documents;if(!e?.length)throw new Error("SuperDoc: no store documents available for upgrade");const t=e[0].getDocumentRuntime?.()||e[0].getEditor?.();if(!t?.attachCollaboration)throw new Error("SuperDoc: editor does not support attachCollaboration");return t}#Ie(){this.#H(),this.#q(null,null)}#xe(e){const n=e.editor??e;return n.options?.collaborationIsReady?Promise.resolve():new Promise(r=>{let o=!1;const i=()=>{o||(o=!0,clearTimeout(s),typeof n.off=="function"&&n.off("collaborationReady",a))},s=setTimeout(()=>{i(),console.warn("[SuperDoc] collaborationReady did not fire within 10 s after collaboration attach. Continuing — collaboration is active but cursor/presence setup may be delayed."),r(void 0)},1e4),a=()=>{i(),r(void 0)};this.#t=()=>{i(),r(void 0)},typeof n.on=="function"?n.on("collaborationReady",a):(i(),r(void 0))})}#Ee(e){return new Promise((n,r)=>{let o,i=!1,s=()=>{};const a=()=>{i=!0,clearTimeout(o),s()};s=XV(e,()=>{i||(a(),n())}),i||(o=setTimeout(()=>{a(),r(new Error("SuperDoc: collaboration provider did not sync within 10000 ms. The provider exposes on/off but never emitted sync(true) or synced."))},1e4)),this.#t=()=>{i||(a(),r(new Error("SuperDoc: instance was destroyed during upgrade")))}})}#pe(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(c=>c.type===Nr);if(n.length===0)throw new Error("SuperDoc: no DOCX document found for upgrade");if(n.length>1)throw new Error("SuperDoc: upgradeToCollaboration() only supports a single DOCX document");if(t.documents.length!==n.length)throw new Error("SuperDoc: upgradeToCollaboration() only supports single-DOCX instances");if(!ni(this.#ge()))throw new Error("SuperDoc: upgradeToCollaboration() requires a ready v2 DOCX editor");const r=n[0],o=r.id;if(typeof o!="string"||o.length===0)throw new Error("SuperDoc: source document is missing its mounted document identity");const i=t.modules?.collaboration,s=e.ydoc||e.provider?{ydoc:e.ydoc,provider:e.provider}:i?{...i}:null,a=e.v2Collaboration??this.#me(r.v2Collaboration)??i?.v2Collaboration??i?.v2??null,l=WS({v2Collaboration:a,legacyCollaboration:s,documentType:Nr,documentCount:t.documents.length,...typeof window<"u"?{authEndpointBaseUrl:window.location.href}:{}});if(!l.ok)throw new Error(`SuperDoc: upgradeToCollaboration() ${l.reason}: ${l.message}`);return{target:l.target}}#me(e){return e&&typeof e=="object"&&"value"in e?e.value:e}#ge(){const e=this.config.documents.find(n=>n.type===Nr),t=this.#m("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.#R("addSharedUser");const t=qc({actor:e});t&&this.users.some(n=>qc({actor:n})===t)||this.users.push(e)}removeSharedUser(e){this.#R("removeSharedUser");const t=typeof e=="string"?Wv(e):"",n=typeof e=="string"?`email:${t}`:qc({actor:e});this.users=this.users.filter(r=>{const o=qc({actor:r});return n?o!==n:t?Wv(r.email)!==t:!0})}onContentError({error:e,editor:t}){const n=t.options?.documentId,r=this.#m("onContentError").documents.find(i=>i.id===n),o=typeof r?.id=="string"?r.id:typeof n=="string"?n:"";this.config.onContentError?.({error:e,editor:t,documentId:o,file:r?.data})}broadcastPdfDocumentReady(){this.emit("pdf:document-ready")}broadcastReady(){this.readyEditors===this.requiredNumberOfEditors&&this.emit("ready",{superdoc:this})}broadcastEditorBeforeCreate(e){this.emit("editorBeforeCreate",{editor:E4(e)})}broadcastEditorCreate(e){this.readyEditors++,this.broadcastReady(),this.#ve(e),this.emit("editorCreate",{editor:E4(e)})}broadcastSourceComplete(){this.emit("source:complete")}broadcastSourceSignalsComplete(){this.emit("source:signals-complete")}#Z;#ve(e){if(!e||typeof e.on!="function"||this.#Z.has(e))return;this.#Z.add(e),e.on("fonts-changed",n=>{this.#oe(e)&&this.#V(n)});const t=(e.documentRenderer??e.presentationEditor)?.getLastFontsChangedPayload?.();t&&this.#oe(e)&&this.#V(t)}#oe(e){return!this.activeEditor||e===this.activeEditor}#Q;#V(e){this.#Q=e,this.emit("fonts-changed",e)}broadcastEditorDestroy(){this.emit("editorDestroy")}broadcastSidebarToggle(e){this.emit("sidebar-toggle",e)}#ye(){Array.isArray(this.config.editorExtensions)&&this.config.editorExtensions.length>0&&console.warn("[SuperDoc] `editorExtensions` is a legacy ProseMirror concept and is ignored by superdoc@2. Use `extensions` with `defineSuperDocExtension`; legacy ProseMirror extensions (Node.create, Mark.create, addPmPlugins, custom schema) do not run in v2.")}#C(...e){(console.debug?console.debug:console.log)("🦋 🦸♀️ [superdoc]",...e)}#j;get fonts(){return this.#j||(this.#j={getReport:()=>is(this.activeEditor)?.getReport()??[],getMissingFonts:()=>is(this.activeEditor)?.getMissingFonts()??[],getDocumentFontOptions:()=>is(this.activeEditor)?.getDocumentFontOptions()??[],getFontFamilyOptions:()=>is(this.activeEditor)?.getFontFamilyOptions()??[],getDocumentFonts:()=>is(this.activeEditor)?.getDocumentFonts()??[],onReport:e=>{const t=this.activeEditor,n=t?is(t)?.getLastFontsChangedPayload?.()??null:this.#Q??null;return n&&e(n),this.on("fonts-changed",e),()=>this.off("fonts-changed",e)},map:e=>{const t=is(this.activeEditor);if(!t)throw new Error("superdoc.fonts.map requires an active editor");t.map(e)},unmap:e=>{const t=is(this.activeEditor);if(!t)throw new Error("superdoc.fonts.unmap requires an active editor");t.unmap(e)},add:e=>{const t=is(this.activeEditor);if(!t)throw new Error("superdoc.fonts.add requires an active editor");t.add(e)},preload:e=>{const t=is(this.activeEditor);if(!t)throw new Error("superdoc.fonts.preload requires an active editor");return t.preload(e)}}),this.#j}#U(){const e=this.activeEditor!==null;this.#ie(),this.activeEditor=null,this.toolbar?.setActiveEditor?this.toolbar.setActiveEditor(null):this.toolbar&&(this.toolbar.activeEditor=null),e&&this.emit("active-editor-change")}#L;#ie(){if(this.#L){try{this.#L()}catch{}this.#L=null}}#be(e){this.#ie();const t=is(e);if(!t?.onChanged)return;const n=t.getLastFontsChangedPayload?.();n&&this.#V(n),this.#L=t.onChanged(r=>this.#V(r))}#we(e,t){this.#w=!0;try{if(e===null){this.#U();return}this.#u.get(e)?.kind==="v2"&&ni(t)?this.#se(t):this.#U()}finally{this.#w=!1}}#se(e){if(ni(e)){!this.#w&&this.#u.getActive()&&this.#u.setActive(null,"set-active-v2-facade");const t=this.activeEditor;this.activeEditor=e,this.#be(e),this.toolbar?.setActiveEditor?.(e),t!==this.activeEditor&&this.emit("active-editor-change");return}this.#U()}setActiveEditor(e){this.#se(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 y-websocket collaboration is wired through document.v2Collaboration, including collaboration-ready, awareness-update, and locked event bridges; arbitrary external { ydoc, provider } adapters remain unsupported"},{feature:"shell.context-menu",status:"supported",reason:"v2 renders the built-in right-click and slash context menu, forwards ui.contextMenu custom items, and honors ui.contextMenu: false for application-owned replacements"},{feature:"shell.page-metrics",status:"supported",reason:"ui-phase4-001: v2 page metrics snapshot (editorVersion: 2, documentId, renderEpoch, layoutGeneration, zoom, pages[], capabilities) available via superdoc.activeEditor.pageMetrics.{ getSnapshot, subscribe, setZoom, scrollToPage, revealBodyTarget, pageIndexForBodyTarget }"},{feature:"shell.zoom",status:"supported",reason:"ui-phase4-001: SuperDoc.setZoom routes to V2EditorHost.setZoom in v2 mode; single CSS-transform wrapper applies scale to the painted document, page metrics viewport coords scale with the same zoom value"},{feature:"shell.ruler-page-margins",status:"supported",reason:"ui-phase4-002: v2 ruler renders against the V2PageMetricsSnapshot and dispatches margin drags through a narrow v2 page-layout bridge (`activeEditor.pageLayout.setMargins(...)`) backed by `doc.sections.setPageMargins(...)`. The v2 page metrics snapshot now reports `capabilities.marginEdit = { supported: true }`"},{feature:"shell.custom-extensions",status:"supported",reason:"superdoc@2 supports customer extensions through `extensions` + `defineSuperDocExtension`; command execution and diagnostics are exposed through the narrow `activeEditor.extensions` facet. Legacy ProseMirror `editorExtensions` are ignored in v2."},{feature:"pdf.viewer",status:"supported",reason:"editorVersion ignored for PDF documents"},{feature:"html.viewer",status:"supported",reason:"editorVersion ignored for HTML documents"}]}get v2(){return this.editorVersion!==2?null:{version:2,featureMatrix:this.getV2FeatureMatrix()}}registerEditorRuntime(e){this.#u.register(e)}unregisterEditorRuntime(e){return this.#u.unregister(e)}getActiveRuntime(){return this.#u.getActive()}setActiveRuntime(e,t){this.#u.setActive(e,t)}resolveRuntimeFromEventTarget(e){return this.#u.resolveFromEventTarget(e)}activateRuntimeFromEventTarget(e,t){const n=this.#u.resolveFromEventTarget(e);return n?(this.#u.setActive(n.id,t),!0):!1}toggleRuler(){const e=this.#m("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 l=this.commentsStore.getComment(s),c=l?.getValues;i=typeof c=="function"?c.call(l):l}const a={superdoc:this,currentUser:this.config.user,comment:i??null,trackedChange:o??null};return va(e,t,n,a)}#Ce(){const e=this.config.modules?.toolbar,t=e&&typeof e=="object"?e:{},n=this.#p.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=Oz({...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 PR(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.#p.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=>{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.#R("setDocumentMode"),e=e.toLowerCase(),this.config.documentMode=e,this.#ce();const t={viewing:()=>this.#le(),editing:()=>this.#ke(),suggesting:()=>this.#ae()};t[e]&&(t[e](),this.emit("document-mode-change",{documentMode:e}))}#J(e,t){const n=typeof e.id=="string"&&e.id.length>0?e.id:null;if(n){const i=this.#u.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){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=>{const r=typeof n.getDocumentRuntime=="function"?n.getDocumentRuntime():null;r?.setTrackedChangesOverrides&&r.setTrackedChangesOverrides(t)})}#ke(){if(this.config.role!=="editor")return this.#ae();const e=this.#m("setDocumentMode");if(e.documents.length>0){const t=e.documents[0]?.getEditor();t&&this.setActiveEditor(t)}this.setTrackedChangesPreferences({mode:"review",enabled:!0}),e.documents.forEach(t=>{t.restoreComments?.(),this.#J(t,"editing")})}#ae(){if(!["editor","suggester"].includes(this.config.role??""))return this.#le();const e=this.#m("setDocumentMode");if(e.documents.length>0){const t=e.documents[0]?.getEditor();t&&this.setActiveEditor(t)}this.setTrackedChangesPreferences({mode:"review",enabled:!0}),e.documents.forEach(t=>{t.restoreComments?.(),this.#J(t,"suggesting")})}#le(){const e=this.#m("setDocumentMode");this.toolbar?.setActiveEditor?this.toolbar.setActiveEditor(null):this.toolbar&&(this.toolbar.activeEditor=null);const t=this.config.comments?.visible===!0,n=this.config.trackChanges?.visible===!0;this.setTrackedChangesPreferences(n?{mode:"review",enabled:!0}:{mode:"original",enabled:!0}),!t&&!n&&this.commentsStore?.clearEditorCommentPositions?.(),e.documents.forEach(r=>{t||n?r.restoreComments?.():r.removeComments?.(),this.#J(r,"viewing")})}#ce(){const e=this.config.comments?.visible===!0,t=this.config.trackChanges?.visible===!0,n=this.config.documentMode==="viewing",r=e||t;this.commentsStore?.setViewingVisibility&&this.commentsStore.setViewingVisibility({documentMode:this.config.documentMode,commentsVisible:e,trackChangesVisible:t});const o=this.superdocStore?.documents;Array.isArray(o)&&o.length>0&&o.forEach(i=>{const s=typeof i.getDocumentRuntime=="function"?i.getDocumentRuntime():null;s?.setViewingCommentOptions&&s.setViewingCommentOptions({emitCommentPositionsInViewing:n&&r,enableCommentsInViewing:n&&e})})}search(e){const t=this.activeEditor?.commands,n=t?.search;if(typeof n=="function")return n.call(t,e,{searchModel:"visible"})}goToSearchResult(e){const t=this.activeEditor?.commands,n=t?.goToSearchResult;if(typeof n=="function")return!!n.call(t,e)}getZoom(){return this.superdocStore?.activeZoom??100}setZoom(e){if(typeof e!="number"||!Number.isFinite(e)||e<=0){console.warn("[SuperDoc] setZoom expects a positive number representing percentage");return}if(!this.superdocStore){console.warn("[SuperDoc] setZoom called before initialization; use config.zoom.initial for the starting zoom");return}this.superdocStore.activeZoom=e,this.superdocStore.zoomMode="manual",this.emit("zoomChange",{zoom:e,mode:"manual"})}setZoomMode(e){if(e!=="manual"&&e!=="fit-width"){console.warn("[SuperDoc] setZoomMode expects 'manual' or 'fit-width'");return}if(!this.superdocStore){console.warn("[SuperDoc] setZoomMode called before initialization; use config.zoom.mode for the starting mode");return}this.superdocStore.zoomMode!==e&&(this.superdocStore.zoomMode=e,this.emit("zoomChange",{zoom:this.getZoom(),mode:e}))}getZoomState(){const e=Ek(this.config.zoom?.fitWidth);return{mode:this.superdocStore?.zoomMode??"manual",value:this.superdocStore?.activeZoom??100,fitZoom:this.superdocStore?.viewportMetrics?.fitZoom??null,min:e.min,max:e.max}}getViewportMetrics(){return this.superdocStore?.viewportMetrics??null}getMeasurementUnit(){return this.superdocStore?.measurementUnit??"in"}setMeasurementUnit(e){if(e!=="in"&&e!=="cm"){console.warn("[SuperDoc] setMeasurementUnit expects 'in' or 'cm'");return}if(!this.superdocStore){console.warn("[SuperDoc] setMeasurementUnit called before initialization; use config.measurementUnit for the starting unit");return}this.superdocStore.measurementUnit!==e&&(this.superdocStore.measurementUnit=e,this.emit("measurement-unit-change",{unit:e}))}setLocked(e=!0){const t=this.activeEditor;if(ni(t)&&typeof t.lock?.setLocked=="function"){t.lock.setLocked(e,e?{...this.user}:null);const n=t.lock.getSnapshot?.();n&&this.#v(!!n.isLocked,this.#F(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.#v(e,e?this.user:null)}getHTML(e={}){const t=[];return this.#m("getHTML").documents.forEach(n=>{const r=n.getEditor?.();r&&t.push(r)}),t.map(n=>n.getHTML(e))}lockSuperdoc(e=!1,t=null){this.#v(e,t)}async export({exportType:e=["docx"],commentsType:t="external",exportedName:n,additionalFiles:r=[],additionalFileNames:o=[],isFinalDoc:i=!1,triggerDownload:s=!0,fieldsHighlightColor:a=null}={}){const l=g_(n||this.config.title),c=await this.exportEditorsToDOCX({commentsType:t,isFinalDoc:i,fieldsHighlightColor:a}),d=[...r],f=[...o];if(e.includes("docx")&&c.forEach(g=>{d.push(g),f.push(`${l}.docx`)}),d.length===1)return s?m_(d[0],l,e[0]):d[0];const h=await YV(d,f);return s?m_(h,l,"zip"):h}async replaceFile(e){const t=this.activeEditor;if(ni(t)&&typeof t.replaceFile=="function"){const r=await t.replaceFile(e),o=r&&typeof r=="object"?r.state:null;return(o===null||o==="review-ready"||o==="editing-ready")&&(this.#re(t,e),this.emit("document-replaced",{editor:t,host:t?.host})),r}const n=t&&!ni(t)?t.replaceFile:null;if(typeof n=="function"){const r=await n.call(t,e),o=r&&typeof r=="object"?r.state:void 0;return(o==null||o==="review-ready"||o==="editing-ready")&&(this.#re(t,e),this.emit("document-replaced",{editor:t,host:t?.host})),r}throw new Error("SuperDoc: replaceFile is unavailable for the active editor")}async exportEditorsToDOCX({commentsType:e,isFinalDoc:t,fieldsHighlightColor:n}={}){const r=this.config?.modules?.comments!==!1;let o,i=!1;const s=()=>(i||(i=!0,e==="clean"?o=[]:r&&this.commentsStore&&typeof this.commentsStore.translateCommentsForExport=="function"&&(o=this.commentsStore.translateCommentsForExport(),Array.isArray(o)||(o=[]))),o),a=new WeakSet,l=c=>{"editor"in c&&c.error&&typeof c.error=="object"&&a.add(c.error)};this.on("exception",l);try{const c=this.#m("exportEditorsToDOCX").documents.map(async d=>{if(!d||d.type!=="application/vnd.openxmlformats-officedocument.wordprocessingml.document")return null;const f=typeof d.getEditor=="function"?d.getEditor():null,h=()=>!d.data||d.data.type&&d.data.type!=="application/vnd.openxmlformats-officedocument.wordprocessingml.document"?null:d.data;if(!f||typeof f.exportDocx!="function")return h();const g=f.editorVersion===2;try{const m=await f.exportDocx(g?{isFinalDoc:t,commentsType:e,fieldsHighlightColor:n}:{isFinalDoc:t,comments:s(),commentsType:e,fieldsHighlightColor:n});if(m)return m}catch(m){if((!m||typeof m!="object"||!a.has(m))&&this.emit("exception",{error:m,document:d}),g&&(e==="clean"||ej(m)))throw m}return h()});return(await Promise.all(c)).filter(d=>d!=null)}finally{this.off("exception",l)}}async#Se(){this.#C("🦋 [superdoc] Triggering collaboration saves");const e=this.#m("save");return new Promise(t=>{e.documents.forEach((n,r)=>{if(this.#C(`Before reset - Doc ${r}: pending = ${this.pendingCollaborationSaves}`),this.pendingCollaborationSaves=0,n.ydoc){this.pendingCollaborationSaves++,this.#C(`After increment - Doc ${r}: pending = ${this.pendingCollaborationSaves}`);const o=n.ydoc.getMap("meta");o.observe(i=>{i.changes.keys.has("immediate-save-finished")&&(this.pendingCollaborationSaves--,this.pendingCollaborationSaves<=0&&t())}),o.set("immediate-save",!0)}}),this.#C(`FINAL pending = ${this.pendingCollaborationSaves}, but we have ${e.documents.filter(n=>n.ydoc).length} docs!`)})}async save(){const e=[this.#Se()];this.#C("🦋 [superdoc] Saving superdoc"),await Promise.all(e),this.#C("🦋 [superdoc] Save complete")}#_e(e,t){const n=e.provider;n&&n!==this.provider&&!t.some(o=>o.provider===n)&&(n.disconnect?.(),n.destroy?.());const r=e.ydoc;r&&r!==this.ydoc&&!t.some(o=>o.ydoc===r)&&r.destroy?.()}#ue(){this.#s=null,this.#A(),typeof this._cleanupAwareness=="function"&&(this._cleanupAwareness(),this._cleanupAwareness=null);const e=this.config;e.socket?.cancelWebsocketRetry?.(),e.socket?.disconnect(),e.socket?.destroy(),this.ydoc?.destroy(),this.provider?.disconnect?.(),this.provider?.destroy?.(),e.documents.forEach(t=>{t.provider?.disconnect?.(),t.provider?.destroy?.(),t.ydoc?.destroy()})}openSurface(e){return this.#g.open(e)}closeSurface(e){this.#g.close(e)}async removeDocument(e){const t=typeof e=="string"?e:String(e??"");if(!t)return!1;const n=this.#m("removeDocument"),r=this.activeEditor,o=IA(r);for(const s of this.#u.getAllByDocumentId(t))this.#u.unregister(s.id);o===t&&r!==null&&this.#U();const i=n.removeDocument(t);return i?(this.#_e(i,n.documents),await _t(),!0):!1}destroy(){this.#e=!0,this.#h?.removeEventListener("click",this.#f,!0),this.#h=null,this.#t&&(this.#t(),this.#t=null),this.#g&&this.#g.destroy(),this.toolbar?.destroy?.(),this.commentsList?.close(),this.commentsList=null,this.app&&(this.#C("[superdoc] Unmounting app"),this.superdocStore?.reset(),this.app.unmount(),this.removeAllListeners(),delete this.app.config.globalProperties.$config,delete this.app.config.globalProperties.$superdoc),this.#c?.destroy(),this.#ue(),this.#y?.(),this.#y=null,this.#u.clear(),this.#d&&(this.#d.remove(),this.#d=null)}focus(e={}){const t=this.getActiveRuntime();if(t?.getCapabilities().lifecycle.canFocus){t.focus(e).catch(n=>{console.warn("[SuperDoc] active editor runtime focus failed",n)});return}this.activeEditor?ni(this.activeEditor)?this.activeEditor.focus?.(e):this.activeEditor.focus?.():this.#m("focus").documents.find(n=>{const r=n.getEditor?.();return r?(ni(r)?r.focus?.(e):r.focus?.(),!0):!1})}setHighContrastMode(e){this.activeEditor&&(this.activeEditor.setHighContrastMode?.(e),this.highContrastModeStore?.setHighContrastMode(e))}};xt();var xA="__SUPERDOC_V2_BROWSER_RUNTIME__";function nj(e=globalThis){const t=e[xA];return t&&typeof t=="object"?t:null}function rj(e={},t=globalThis){const n=nj(t)??{},r={...n,...e,vue:e.vue??n.vue??f6};return t[xA]=r,r}rj();var oj={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"},ij=0;function EA(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-${++ij}`}`,l=[];if(i)for(const[c,d]of Object.entries(i)){if(d==null)continue;const f=oj[c];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[c,d]of Object.entries(s))d!=null&&l.push(` ${c}: ${d};`);return{className:a,css:l.length>0?`.${a} {
|
|
106
106
|
${l.join(`
|
|
107
107
|
`)}
|
|
108
|
-
}`:""}}function sj(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 aj(e){const{className:t,css:n}=EA(e);return sj(t,n),t}function lj(e){return EA(e)}function cj(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 uj=Ju({BlankDOCX:()=>ok,DOCX:()=>Nr,HTML:()=>qh,PDF:()=>Xl,SuperDoc:()=>vm,buildTheme:()=>lj,compareVersions:()=>w6,createTheme:()=>aj,defineSuperDocExtension:()=>cj,getFileObject:()=>Kv}),dj="SUPERDOC_ENGINE_CDN_BASE_URL",TA=Symbol.for("superdoc.docx-engine.cdn-load-state"),ym="superdocDocxEngineStatus";function fj(e,t,n=null){const r=e?.[dj],o=typeof r=="string"&&r.trim()?r:n;if(typeof o=="string"&&o.trim())return hj(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 hj(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 pj({engineVersion:e,buildBaseUrl:t}){hT(()=>{const n=fj(globalThis,e,t),r=globalThis[TA],o=r instanceof Map?r:new Map;if(globalThis[TA]=o,!o.has(n)){const i=Promise.all([import(`${n}/dist-cdn/docx-engine.es.js`),mj(`${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 mj(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[ym]==="loaded")return Promise.resolve();const r=n?.dataset[ym]==="loading";return n&&!r&&n.remove(),new Promise((o,i)=>{const s=r?n:document.createElement("link");let a=!1,l;const c=(g,m)=>{a||(a=!0,l?.disconnect(),s.dataset[ym]=g,m())},d=()=>c("loaded",o),f=()=>c("error",()=>i(new Error(`SuperDoc: failed to load DOCX Engine styles from ${t}`))),h=()=>{s.isConnected||c("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(h),l.observe(document.head,{childList:!0})),r||(s.rel="stylesheet",s.href=t,s.dataset.superdocDocxEngine="true",s.dataset[ym]="loading",document.head.appendChild(s))})}pj({engineVersion:"0.3.0-next.
|
|
108
|
+
}`:""}}function sj(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 aj(e){const{className:t,css:n}=EA(e);return sj(t,n),t}function lj(e){return EA(e)}function cj(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 uj=Ju({BlankDOCX:()=>ok,DOCX:()=>Nr,HTML:()=>qh,PDF:()=>Xl,SuperDoc:()=>vm,buildTheme:()=>lj,compareVersions:()=>w6,createTheme:()=>aj,defineSuperDocExtension:()=>cj,getFileObject:()=>Kv}),dj="SUPERDOC_ENGINE_CDN_BASE_URL",TA=Symbol.for("superdoc.docx-engine.cdn-load-state"),ym="superdocDocxEngineStatus";function fj(e,t,n=null){const r=e?.[dj],o=typeof r=="string"&&r.trim()?r:n;if(typeof o=="string"&&o.trim())return hj(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 hj(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 pj({engineVersion:e,buildBaseUrl:t}){hT(()=>{const n=fj(globalThis,e,t),r=globalThis[TA],o=r instanceof Map?r:new Map;if(globalThis[TA]=o,!o.has(n)){const i=Promise.all([import(`${n}/dist-cdn/docx-engine.es.js`),mj(`${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 mj(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[ym]==="loaded")return Promise.resolve();const r=n?.dataset[ym]==="loading";return n&&!r&&n.remove(),new Promise((o,i)=>{const s=r?n:document.createElement("link");let a=!1,l;const c=(g,m)=>{a||(a=!0,l?.disconnect(),s.dataset[ym]=g,m())},d=()=>c("loaded",o),f=()=>c("error",()=>i(new Error(`SuperDoc: failed to load DOCX Engine styles from ${t}`))),h=()=>{s.isConnected||c("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(h),l.observe(document.head,{childList:!0})),r||(s.rel="stylesheet",s.href=t,s.dataset.superdocDocxEngine="true",s.dataset[ym]="loading",document.head.appendChild(s))})}pj({engineVersion:"0.3.0-next.49",buildBaseUrl:null});for(const[e,t]of Object.entries(uj))e==="SuperDoc"||e==="default"||Object.prototype.hasOwnProperty.call(vm,e)||(vm[e]=t);var gj=vm;return gj})();
|