superdoc 2.11.0 β 2.11.1-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/collaboration-upgrade-engine.cjs +1 -1
- package/dist/collaboration-upgrade-engine.es.js +1 -1
- package/dist/layout-engine/contracts/src/index.d.ts +4 -0
- package/dist/layout-engine/layout-bridge/src/coupled-footnote-pagination.d.ts +59 -0
- package/dist/layout-engine/layout-bridge/src/coupled-footnote-profile.d.ts +37 -0
- package/dist/layout-engine/layout-bridge/src/footnote-content.d.ts +39 -0
- package/dist/layout-engine/layout-bridge/src/footnote-page-certificate.d.ts +38 -0
- package/dist/layout-engine/layout-bridge/src/footnote-page-planner.d.ts +49 -0
- package/dist/layout-engine/layout-bridge/src/incrementalLayout.d.ts +92 -0
- package/dist/layout-engine/layout-engine/src/execution.d.ts +1 -1
- package/dist/layout-engine/layout-engine/src/footnote-anchor-index.d.ts +3 -0
- package/dist/layout-engine/layout-engine/src/footnote-page-flow.d.ts +28 -0
- package/dist/layout-engine/layout-engine/src/index.d.ts +8 -0
- package/dist/layout-engine/layout-engine/src/layout-paragraph.d.ts +4 -0
- package/dist/layout-engine/layout-engine/src/layout-utils.d.ts +2 -0
- package/dist/layout-engine/layout-engine/src/paginator.d.ts +5 -0
- 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 bE=Object.create,Ih=Object.defineProperty,wE=Object.getOwnPropertyDescriptor,CE=Object.getOwnPropertyNames,kE=Object.getPrototypeOf,SE=Object.prototype.hasOwnProperty,Mr=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(r){throw n=[r],r}},A2=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),Dd=(e,t)=>{let n={};for(var r in e)Ih(n,r,{get:e[r],enumerable:!0});return t||Ih(n,Symbol.toStringTag,{value:"Module"}),n},_E=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(var o=CE(t),i=0,s=o.length,a;i<s;i++)a=o[i],!SE.call(e,a)&&a!==n&&Ih(e,a,{get:(l=>t[l]).bind(null,a),enumerable:!(r=wE(t,a))||r.enumerable});return e},I2=(e,t,n)=>(n=e!=null?bE(kE(e)):{},_E(t||!e||!e.__esModule?Ih(n,"default",{value:e,enumerable:!0}):n,e)),AE=A2(((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,p,g){if(typeof f!="function")throw new TypeError("The listener must be a function");var m=new i(f,p||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,p;if(this._eventsCount===0)return d;for(p in f=this._events)n.call(f,p)&&d.push(r?p.slice(1):p);return Object.getOwnPropertySymbols?d.concat(Object.getOwnPropertySymbols(f)):d},l.prototype.listeners=function(d){var f=r?r+d:d,p=this._events[f];if(!p)return[];if(p.fn)return[p.fn];for(var g=0,m=p.length,v=new Array(m);g<m;g++)v[g]=p[g].fn;return v},l.prototype.listenerCount=function(d){var f=r?r+d:d,p=this._events[f];return p?p.fn?1:p.length:0},l.prototype.emit=function(d,f,p,g,m,v){var k=r?r+d:d;if(!this._events[k])return!1;var C=this._events[k],S=arguments.length,w,b;if(C.fn){switch(C.once&&this.removeListener(d,C.fn,void 0,!0),S){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,p),!0;case 4:return C.fn.call(C.context,f,p,g),!0;case 5:return C.fn.call(C.context,f,p,g,m),!0;case 6:return C.fn.call(C.context,f,p,g,m,v),!0}for(b=1,w=new Array(S-1);b<S;b++)w[b-1]=arguments[b];C.fn.apply(C.context,w)}else{var T=C.length,L;for(b=0;b<T;b++)switch(C[b].once&&this.removeListener(d,C[b].fn,void 0,!0),S){case 1:C[b].fn.call(C[b].context);break;case 2:C[b].fn.call(C[b].context,f);break;case 3:C[b].fn.call(C[b].context,f,p);break;case 4:C[b].fn.call(C[b].context,f,p,g);break;default:if(!w)for(L=1,w=new Array(S-1);L<S;L++)w[L-1]=arguments[L];C[b].fn.apply(C[b].context,w)}}return!0},l.prototype.on=function(d,f,p){return s(this,d,f,p,!1)},l.prototype.once=function(d,f,p){return s(this,d,f,p,!0)},l.prototype.removeListener=function(d,f,p,g){var m=r?r+d:d;if(!this._events[m])return this;if(!f)return a(this,m),this;var v=this._events[m];if(v.fn)v.fn===f&&(!g||v.once)&&(!p||v.context===p)&&a(this,m);else{for(var k=0,C=[],S=v.length;k<S;k++)(v[k].fn!==f||g&&!v[k].once||p&&v[k].context!==p)&&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)})),Ig=I2(AE(),1),Co=[];for(let e=0;e<256;++e)Co.push((e+256).toString(16).slice(1));function IE(e,t=0){return(Co[e[t+0]]+Co[e[t+1]]+Co[e[t+2]]+Co[e[t+3]]+"-"+Co[e[t+4]]+Co[e[t+5]]+"-"+Co[e[t+6]]+Co[e[t+7]]+"-"+Co[e[t+8]]+Co[e[t+9]]+"-"+Co[e[t+10]]+Co[e[t+11]]+Co[e[t+12]]+Co[e[t+13]]+Co[e[t+14]]+Co[e[t+15]]).toLowerCase()}var Eg,EE=new Uint8Array(16);function TE(){if(!Eg){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Eg=crypto.getRandomValues.bind(crypto)}return Eg(EE)}var xE=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),E2={randomUUID:xE};function ol(e,t,n){if(E2.randomUUID&&!t&&!e)return E2.randomUUID();e=e||{};const r=e.random??e.rng?.()??TE();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 IE(r)}function Od(e){const t=Object.create(null);for(const n of e.split(","))t[n]=1;return n=>n in t}function bn(e){if(Nt(e)){const t={};for(let n=0;n<e.length;n++){const r=e[n],o=Qn(r)?RE(r):bn(r);if(o)for(const i in o)t[i]=o[i]}return t}else if(Qn(e)||Bn(e))return e}function RE(e){const t={};return e.replace(B2,"").split(F2).forEach(n=>{if(n){const r=n.split(N2);r.length>1&&(t[r[0].trim()]=r[1].trim())}}),t}function Qt(e){let t="";if(Qn(e))t=e;else if(Nt(e))for(let n=0;n<e.length;n++){const r=Qt(e[n]);r&&(t+=r+" ")}else if(Bn(e))for(const n in e)e[n]&&(t+=n+" ");return t.trim()}function Tg(e){if(!e)return null;let{class:t,style:n}=e;return t&&!Qn(t)&&(e.class=Qt(t)),n&&(e.style=bn(n)),e}function T2(e){return!!e||e===""}function LE(e,t){if(e.length!==t.length)return!1;let n=!0;for(let r=0;n&&r<e.length;r++)n=da(e[r],t[r]);return n}function da(e,t){if(e===t)return!0;let n=Rg(e),r=Rg(t);if(n||r)return n&&r?e.getTime()===t.getTime():!1;if(n=ui(e),r=ui(t),n||r)return e===t;if(n=Nt(e),r=Nt(t),n||r)return n&&r?LE(e,t):!1;if(n=Bn(e),r=Bn(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||!da(e[o],t[o]))return!1}}return String(e)===String(t)}function Eh(e,t){return e.findIndex(n=>da(n,t))}function ME(e){return e==null?"initial":typeof e=="string"?e===""?" ":e:(typeof e!="number"||Number.isFinite(e),String(e))}var Rn,tc,Ci,xg,eu,Pd,Gn,Th,x2,Un,Nt,nc,il,Rg,R2,Yt,Qn,ui,Bn,xh,Lg,rc,L2,Fd,Nd,sl,Bd,M2,Hr,D2,Xo,tu,nu,lo,oc,Mg,zd,Vd,O2,jd,P2,F2,N2,B2,Dg,z2,DE,Og,zt,Pg,Rh,Fg=Mr((()=>{Rn={},tc=[],Ci=()=>{},xg=()=>!1,eu=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),Pd=e=>e.startsWith("onUpdate:"),Gn=Object.assign,Th=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},x2=Object.prototype.hasOwnProperty,Un=(e,t)=>x2.call(e,t),Nt=Array.isArray,nc=e=>rc(e)==="[object Map]",il=e=>rc(e)==="[object Set]",Rg=e=>rc(e)==="[object Date]",R2=e=>rc(e)==="[object RegExp]",Yt=e=>typeof e=="function",Qn=e=>typeof e=="string",ui=e=>typeof e=="symbol",Bn=e=>e!==null&&typeof e=="object",xh=e=>(Bn(e)||Yt(e))&&Yt(e.then)&&Yt(e.catch),Lg=Object.prototype.toString,rc=e=>Lg.call(e),L2=e=>rc(e).slice(8,-1),Fd=e=>rc(e)==="[object Object]",Nd=e=>Qn(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,sl=Od(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),Bd=e=>{const t=Object.create(null);return(n=>t[n]||(t[n]=e(n)))},M2=/-\w/g,Hr=Bd(e=>e.replace(M2,t=>t.slice(1).toUpperCase())),D2=/\B([A-Z])/g,Xo=Bd(e=>e.replace(D2,"-$1").toLowerCase()),tu=Bd(e=>e.charAt(0).toUpperCase()+e.slice(1)),nu=Bd(e=>e?`on${tu(e)}`:""),lo=(e,t)=>!Object.is(e,t),oc=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},Mg=(e,t,n,r=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:r,value:n})},zd=e=>{const t=parseFloat(e);return isNaN(t)?e:t},Vd=e=>{const t=Qn(e)?Number(e):NaN;return isNaN(t)?e:t},jd=()=>O2||(O2=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}),P2=Od("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"),F2=/;(?![^(]*\))/g,N2=/:([^]+)/,B2=/\/\*[^]*?\*\//g,Dg="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",z2=Od(Dg),DE=Od(Dg+",async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected"),Og=e=>!!(e&&e.__v_isRef===!0),zt=e=>Qn(e)?e:e==null?"":Nt(e)||Bn(e)&&(e.toString===Lg||!Yt(e.toString))?Og(e)?zt(e.value):JSON.stringify(e,Pg,2):String(e),Pg=(e,t)=>Og(t)?Pg(e,t.value):nc(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((n,[r,o],i)=>(n[Rh(r,i)+" =>"]=o,n),{})}:il(t)?{[`Set(${t.size})`]:[...t.values()].map(n=>Rh(n))}:ui(t)?Rh(t):Bn(t)&&!Nt(t)&&!Fd(t)?String(t):t,Rh=(e,t="")=>{var n;return ui(e)?`Symbol(${(n=e.description)!=null?n:t})`:e}}));function Ng(e){return new Fh(e)}function Bg(){return No}function V2(e,t=!1){No&&No.cleanups.push(e)}function j2(e,t=!1){if(e.flags|=8,t){e.next=Gd,Gd=e;return}e.next=$d,$d=e}function zg(){Kg++}function Vg(){if(--Kg>0)return;if(Gd){let t=Gd;for(Gd=void 0;t;){const n=t.next;t.next=void 0,t.flags&=-9,t=n}}let e;for(;$d;){let t=$d;for($d=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 U2(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function H2(e){let t,n=e.depsTail,r=n;for(;r;){const o=r.prevDep;r.version===-1?(r===n&&(n=o),Ug(r),OE(r)):t=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=o}e.deps=t,e.depsTail=n}function jg(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&($2(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function $2(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===iu)||(e.globalVersion=iu,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!jg(e))))return;e.flags|=2;const t=e.dep,n=sr,r=Bi;sr=e,Bi=!0;try{U2(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{sr=n,Bi=r,H2(e),e.flags&=-3}}function Ug(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)Ug(i,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function OE(e){const{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}function PE(e,t){e.effect instanceof ou&&(e=e.effect.fn);const n=new ou(e);t&&Gn(n,t);try{n.run()}catch(o){throw n.stop(),o}const r=n.run.bind(n);return r.effect=n,r}function FE(e){e.effect.stop()}function fa(){qg.push(Bi),Bi=!1}function ha(){const e=qg.pop();Bi=e===void 0?!0:e}function G2(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const n=sr;sr=void 0;try{t()}finally{sr=n}}}function W2(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)W2(r)}const n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}function Fo(e,t,n){if(Bi&&sr){let r=Kd.get(e);r||Kd.set(e,r=new Map);let o=r.get(n);o||(r.set(n,o=new Wd),o.map=r,o.key=n),o.track()}}function pa(e,t,n,r,o,i){const s=Kd.get(e);if(!s){iu++;return}const a=l=>{l&&l.trigger()};if(zg(),t==="clear")s.forEach(a);else{const l=Nt(e),c=l&&Nd(n);if(l&&n==="length"){const d=Number(r);s.forEach((f,p)=>{(p==="length"||p===su||!ui(p)&&p>=d)&&a(f)})}else switch((n!==void 0||s.has(void 0))&&a(s.get(n)),c&&a(s.get(su)),t){case"add":l?c&&a(s.get("length")):(a(s.get(al)),nc(e)&&a(s.get(Bh)));break;case"delete":l||(a(s.get(al)),nc(e)&&a(s.get(Bh)));break;case"set":nc(e)&&a(s.get(al));break}}Vg()}function NE(e,t){const n=Kd.get(e);return n&&n.get(t)}function ru(e){const t=gn(e);return t===e?t:(Fo(t,"iterate",su),di(e)?t:t.map(zi))}function Lh(e){return Fo(e=gn(e),"iterate",su),e}function Ts(e,t){return xs(e)?ic(Ni(e)?zi(t):t):zi(t)}function Hg(e,t,n){const r=Lh(e),o=r[t]();return r!==e&&!di(e)&&(o._next=o.next,o.next=()=>{const i=o._next();return i.done||(i.value=n(i.value)),i}),o}function ma(e,t,n,r,o,i){const s=Lh(e),a=s!==e&&!di(e),l=s[t];if(l!==n1[t]){const f=l.apply(e,i);return a?zi(f):f}let c=n;s!==e&&(a?c=function(f,p){return n.call(this,Ts(e,f),p,e)}:n.length>2&&(c=function(f,p){return n.call(this,f,p,e)}));const d=l.call(s,c,r);return a&&o?o(d):d}function K2(e,t,n,r){const o=Lh(e),i=o!==e&&!di(e);let s=n,a=!1;o!==e&&(i?(a=r.length===0,s=function(c,d,f){return a&&(a=!1,c=Ts(e,c)),n.call(this,c,Ts(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?Ts(e,l):l}function $g(e,t,n){const r=gn(e);Fo(r,"iterate",su);const o=r[t](...n);return(o===-1||o===!1)&&Hd(n[0])?(n[0]=gn(n[0]),r[t](...n)):o}function Ud(e,t,n=[]){fa(),zg();const r=gn(e)[t].apply(e,n);return Vg(),ha(),r}function BE(e){ui(e)||(e=String(e));const t=gn(this);return Fo(t,"has",e),t.hasOwnProperty(e)}function zE(e,t,n){return function(...r){const o=this.__v_raw,i=gn(o),s=nc(i),a=e==="entries"||e===Symbol.iterator&&s,l=e==="keys"&&s,c=o[e](...r),d=n?zh:t?ic:zi;return!t&&Fo(i,"iterate",l?Bh:al),Gn(Object.create(c),{next(){const{value:f,done:p}=c.next();return p?{value:f,done:p}:{value:a?[d(f[0]),d(f[1])]:d(f),done:p}}})}}function Mh(e){return function(...t){return e==="delete"?!1:e==="clear"?void 0:this}}function VE(e,t){const n={get(r){const o=this.__v_raw,i=gn(o),s=gn(r);e||(lo(r,s)&&Fo(i,"get",r),Fo(i,"get",s));const{has:a}=qd(i),l=t?zh:e?ic:zi;if(a.call(i,r))return l(o.get(r));if(a.call(i,s))return l(o.get(s));o!==i&&o.get(r)},get size(){const r=this.__v_raw;return!e&&Fo(gn(r),"iterate",al),r.size},has(r){const o=this.__v_raw,i=gn(o),s=gn(r);return e||(lo(r,s)&&Fo(i,"has",r),Fo(i,"has",s)),r===s?o.has(r):o.has(r)||o.has(s)},forEach(r,o){const i=this,s=i.__v_raw,a=gn(s),l=t?zh:e?ic:zi;return!e&&Fo(a,"iterate",al),s.forEach((c,d)=>r.call(o,l(c),l(d),i))}};return Gn(n,e?{add:Mh("add"),set:Mh("set"),delete:Mh("delete"),clear:Mh("clear")}:{add(r){const o=gn(this),i=qd(o),s=gn(r),a=!t&&!di(r)&&!xs(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),pa(o,"add",a,a)),this},set(r,o){!t&&!di(o)&&!xs(o)&&(o=gn(o));const i=gn(this),{has:s,get:a}=qd(i);let l=s.call(i,r);l||(r=gn(r),l=s.call(i,r));const c=a.call(i,r);return i.set(r,o),l?lo(o,c)&&pa(i,"set",r,o,c):pa(i,"add",r,o),this},delete(r){const o=gn(this),{has:i,get:s}=qd(o);let a=i.call(o,r);a||(r=gn(r),a=i.call(o,r));const l=s?s.call(o,r):void 0,c=o.delete(r);return a&&pa(o,"delete",r,void 0,l),c},clear(){const r=gn(this),o=r.size!==0,i=void 0,s=r.clear();return o&&pa(r,"clear",void 0,void 0,i),s}}),["keys","values","entries",Symbol.iterator].forEach(r=>{n[r]=zE(r,e,t)}),n}function Dh(e,t){const n=VE(e,t);return(r,o,i)=>o==="__v_isReactive"?!e:o==="__v_isReadonly"?e:o==="__v_raw"?r:Reflect.get(Un(n,o)&&o in r?n:r,o,i)}function jE(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function UE(e){return e.__v_skip||!Object.isExtensible(e)?0:jE(L2(e))}function no(e){return xs(e)?e:Ph(e,!1,o1,l1,Jg)}function q2(e){return Ph(e,!1,s1,c1,ev)}function Oh(e){return Ph(e,!0,i1,u1,tv)}function HE(e){return Ph(e,!0,a1,d1,nv)}function Ph(e,t,n,r,o){if(!Bn(e)||e.__v_raw&&!(t&&e.__v_isReactive))return e;const i=UE(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 Ni(e){return xs(e)?Ni(e.__v_raw):!!(e&&e.__v_isReactive)}function xs(e){return!!(e&&e.__v_isReadonly)}function di(e){return!!(e&&e.__v_isShallow)}function Hd(e){return e?!!e.__v_raw:!1}function gn(e){const t=e&&e.__v_raw;return t?gn(t):e}function ro(e){return!Un(e,"__v_skip")&&Object.isExtensible(e)&&Mg(e,"__v_skip",!0),e}function dr(e){return e?e.__v_isRef===!0:!1}function te(e){return Y2(e,!1)}function $r(e){return Y2(e,!0)}function Y2(e,t){return dr(e)?e:new f1(e,t)}function $E(e){e.dep&&e.dep.trigger()}function et(e){return dr(e)?e.value:e}function GE(e){return Yt(e)?e():et(e)}function Gg(e){return Ni(e)?e:new Proxy(e,h1)}function X2(e){return new p1(e)}function Z2(e){const t=Nt(e)?new Array(e.length):{};for(const n in e)t[n]=Q2(e,n);return t}function Wg(e,t,n){return dr(e)?e:Yt(e)?new g1(e):Bn(e)&&arguments.length>1?Q2(e,t,n):te(e)}function Q2(e,t,n){return new m1(e,t,n)}function WE(e,t,n=!1){let r,o;return Yt(e)?r=e:(r=e.get,o=e.set),new v1(r,o,n)}function KE(){return va}function J2(e,t=!1,n=va){if(n){let r=Xd.get(n);r||Xd.set(n,r=[]),r.push(e)}}function qE(e,t,n=Rn){const{immediate:r,deep:o,once:i,scheduler:s,augmentJob:a,call:l}=n,c=b=>o?b:di(b)||o===!1||o===0?ga(b,1):ga(b);let d,f,p,g,m=!1,v=!1;if(dr(e)?(f=()=>e.value,m=di(e)):Ni(e)?(f=()=>c(e),m=!0):Nt(e)?(v=!0,m=e.some(b=>Ni(b)||di(b)),f=()=>e.map(b=>{if(dr(b))return b.value;if(Ni(b))return c(b);if(Yt(b))return l?l(b,2):b()})):Yt(e)?t?f=l?()=>l(e,2):e:f=()=>{if(p){fa();try{p()}finally{ha()}}const b=va;va=d;try{return l?l(e,3,[g]):e(g)}finally{va=b}}:f=Ci,t&&o){const b=f,T=o===!0?1/0:o;f=()=>ga(b(),T)}const k=Bg(),C=()=>{d.stop(),k&&k.active&&Th(k.effects,d)};if(i&&t){const b=t;t=(...T)=>{b(...T),C()}}let S=v?new Array(e.length).fill(Yd):Yd;const w=b=>{if(!(!(d.flags&1)||!d.dirty&&!b))if(t){const T=d.run();if(o||m||(v?T.some((L,N)=>lo(L,S[N])):lo(T,S))){p&&p();const L=va;va=d;try{const N=[T,S===Yd?void 0:v&&S[0]===Yd?[]:S,g];S=T,l?l(t,3,N):t(...N)}finally{va=L}}}else d.run()};return a&&a(w),d=new ou(f),d.scheduler=s?()=>s(w,!1):w,g=b=>J2(b,!1,d),p=d.onStop=()=>{const b=Xd.get(d);if(b){if(l)l(b,4);else for(const T of b)T();Xd.delete(d)}},t?r?w(!0):S=d.run():s?s(w.bind(null,!0),!0):d.run(),C.pause=d.pause.bind(d),C.resume=d.resume.bind(d),C.stop=C,C}function ga(e,t=1/0,n){if(t<=0||!Bn(e)||e.__v_skip||(n=n||new Map,(n.get(e)||0)>=t))return e;if(n.set(e,t),t--,dr(e))ga(e.value,t,n);else if(Nt(e))for(let r=0;r<e.length;r++)ga(e[r],t,n);else if(il(e)||nc(e))e.forEach(r=>{ga(r,t,n)});else if(Fd(e)){for(const r in e)ga(e[r],t,n);for(const r of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,r)&&ga(e[r],t,n)}return e}var No,Fh,sr,Nh,ou,Kg,$d,Gd,Bi,qg,iu,e1,Wd,Kd,al,Bh,su,t1,n1,r1,Yg,Xg,Zg,Qg,o1,i1,s1,a1,zh,qd,l1,c1,u1,d1,Jg,ev,tv,nv,zi,ic,f1,h1,p1,m1,g1,v1,y1,b1,Yd,Xd,va,YE=Mr((()=>{Fg(),Fh=class{constructor(e=!1){this.detached=e,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this.__v_skip=!0,this.parent=No,!e&&No&&(this.index=(No.scopes||(No.scopes=[])).push(this)-1)}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let e,t;if(this.scopes)for(e=0,t=this.scopes.length;e<t;e++)this.scopes[e].pause();for(e=0,t=this.effects.length;e<t;e++)this.effects[e].pause()}}resume(){if(this._active&&this._isPaused){this._isPaused=!1;let e,t;if(this.scopes)for(e=0,t=this.scopes.length;e<t;e++)this.scopes[e].resume();for(e=0,t=this.effects.length;e<t;e++)this.effects[e].resume()}}run(e){if(this._active){const t=No;try{return No=this,e()}finally{No=t}}}on(){++this._on===1&&(this.prevScope=No,No=this)}off(){this._on>0&&--this._on===0&&(No=this.prevScope,this.prevScope=void 0)}stop(e){if(this._active){this._active=!1;let t,n;for(t=0,n=this.effects.length;t<n;t++)this.effects[t].stop();for(this.effects.length=0,t=0,n=this.cleanups.length;t<n;t++)this.cleanups[t]();if(this.cleanups.length=0,this.scopes){for(t=0,n=this.scopes.length;t<n;t++)this.scopes[t].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!e){const r=this.parent.scopes.pop();r&&r!==this&&(this.parent.scopes[this.index]=r,r.index=this.index)}this.parent=void 0}}},Nh=new WeakSet,ou=class{constructor(e){this.fn=e,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler=void 0,No&&No.active&&No.effects.push(this)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,Nh.has(this)&&(Nh.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||j2(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,G2(this),U2(this);const e=sr,t=Bi;sr=this,Bi=!0;try{return this.fn()}finally{H2(this),sr=e,Bi=t,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)Ug(e);this.deps=this.depsTail=void 0,G2(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?Nh.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){jg(this)&&this.run()}get dirty(){return jg(this)}},Kg=0,Bi=!0,qg=[],iu=0,e1=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}},Wd=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(!sr||!Bi||sr===this.computed)return;let t=this.activeLink;if(t===void 0||t.sub!==sr)t=this.activeLink=new e1(sr,this),sr.deps?(t.prevDep=sr.depsTail,sr.depsTail.nextDep=t,sr.depsTail=t):sr.deps=sr.depsTail=t,W2(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=sr.depsTail,t.nextDep=void 0,sr.depsTail.nextDep=t,sr.depsTail=t,sr.deps===t&&(sr.deps=n)}return t}trigger(e){this.version++,iu++,this.notify(e)}notify(e){zg();try{for(let t=this.subs;t;t=t.prevSub)t.sub.notify()&&t.sub.dep.notify()}finally{Vg()}}},Kd=new WeakMap,al=Symbol(""),Bh=Symbol(""),su=Symbol(""),t1={__proto__:null,[Symbol.iterator](){return Hg(this,Symbol.iterator,e=>Ts(this,e))},concat(...e){return ru(this).concat(...e.map(t=>Nt(t)?ru(t):t))},entries(){return Hg(this,"entries",e=>(e[1]=Ts(this,e[1]),e))},every(e,t){return ma(this,"every",e,t,void 0,arguments)},filter(e,t){return ma(this,"filter",e,t,n=>n.map(r=>Ts(this,r)),arguments)},find(e,t){return ma(this,"find",e,t,n=>Ts(this,n),arguments)},findIndex(e,t){return ma(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return ma(this,"findLast",e,t,n=>Ts(this,n),arguments)},findLastIndex(e,t){return ma(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return ma(this,"forEach",e,t,void 0,arguments)},includes(...e){return $g(this,"includes",e)},indexOf(...e){return $g(this,"indexOf",e)},join(e){return ru(this).join(e)},lastIndexOf(...e){return $g(this,"lastIndexOf",e)},map(e,t){return ma(this,"map",e,t,void 0,arguments)},pop(){return Ud(this,"pop")},push(...e){return Ud(this,"push",e)},reduce(e,...t){return K2(this,"reduce",e,t)},reduceRight(e,...t){return K2(this,"reduceRight",e,t)},shift(){return Ud(this,"shift")},some(e,t){return ma(this,"some",e,t,void 0,arguments)},splice(...e){return Ud(this,"splice",e)},toReversed(){return ru(this).toReversed()},toSorted(e){return ru(this).toSorted(e)},toSpliced(...e){return ru(this).toSpliced(...e)},unshift(...e){return Ud(this,"unshift",e)},values(){return Hg(this,"values",e=>Ts(this,e))}},n1=Array.prototype,r1=Od("__proto__,__v_isRef,__isVue"),Yg=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(ui)),Xg=class{constructor(e=!1,t=!1){this._isReadonly=e,this._isShallow=t}get(e,t,n){if(t==="__v_skip")return e.__v_skip;const r=this._isReadonly,o=this._isShallow;if(t==="__v_isReactive")return!r;if(t==="__v_isReadonly")return r;if(t==="__v_isShallow")return o;if(t==="__v_raw")return n===(r?o?nv:tv:o?ev:Jg).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(n)?e:void 0;const i=Nt(e);if(!r){let a;if(i&&(a=t1[t]))return a;if(t==="hasOwnProperty")return BE}const s=Reflect.get(e,t,dr(e)?e:n);if((ui(t)?Yg.has(t):r1(t))||(r||Fo(e,"get",t),o))return s;if(dr(s)){const a=i&&Nd(t)?s:s.value;return r&&Bn(a)?Oh(a):a}return Bn(s)?r?Oh(s):no(s):s}},Zg=class extends Xg{constructor(e=!1){super(!1,e)}set(e,t,n,r){let o=e[t];const i=Nt(e)&&Nd(t);if(!this._isShallow){const l=xs(o);if(!di(n)&&!xs(n)&&(o=gn(o),n=gn(n)),!i&&dr(o)&&!dr(n))return l||(o.value=n),!0}const s=i?Number(t)<e.length:Un(e,t),a=Reflect.set(e,t,n,dr(e)?e:r);return e===gn(r)&&(s?lo(n,o)&&pa(e,"set",t,n,o):pa(e,"add",t,n)),a}deleteProperty(e,t){const n=Un(e,t),r=e[t],o=Reflect.deleteProperty(e,t);return o&&n&&pa(e,"delete",t,void 0,r),o}has(e,t){const n=Reflect.has(e,t);return(!ui(t)||!Yg.has(t))&&Fo(e,"has",t),n}ownKeys(e){return Fo(e,"iterate",Nt(e)?"length":al),Reflect.ownKeys(e)}},Qg=class extends Xg{constructor(e=!1){super(!0,e)}set(e,t){return!0}deleteProperty(e,t){return!0}},o1=new Zg,i1=new Qg,s1=new Zg(!0),a1=new Qg(!0),zh=e=>e,qd=e=>Reflect.getPrototypeOf(e),l1={get:Dh(!1,!1)},c1={get:Dh(!1,!0)},u1={get:Dh(!0,!1)},d1={get:Dh(!0,!0)},Jg=new WeakMap,ev=new WeakMap,tv=new WeakMap,nv=new WeakMap,zi=e=>Bn(e)?no(e):e,ic=e=>Bn(e)?Oh(e):e,f1=class{constructor(e,t){this.dep=new Wd,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=t?e:gn(e),this._value=t?e:zi(e),this.__v_isShallow=t}get value(){return this.dep.track(),this._value}set value(e){const t=this._rawValue,n=this.__v_isShallow||di(e)||xs(e);e=n?e:gn(e),lo(e,t)&&(this._rawValue=e,this._value=n?e:zi(e),this.dep.trigger())}},h1={get:(e,t,n)=>t==="__v_raw"?e:et(Reflect.get(e,t,n)),set:(e,t,n,r)=>{const o=e[t];return dr(o)&&!dr(n)?(o.value=n,!0):Reflect.set(e,t,n,r)}},p1=class{constructor(e){this.__v_isRef=!0,this._value=void 0;const t=this.dep=new Wd,{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)}},m1=class{constructor(e,t,n){this._object=e,this._defaultValue=n,this.__v_isRef=!0,this._value=void 0,this._key=ui(t)?t:String(t),this._raw=gn(e);let r=!0,o=e;if(!Nt(e)||ui(this._key)||!Nd(this._key))do r=!Hd(o)||di(o);while(r&&(o=o.__v_raw));this._shallow=r}get value(){let e=this._object[this._key];return this._shallow&&(e=et(e)),this._value=e===void 0?this._defaultValue:e}set value(e){if(this._shallow&&dr(this._raw[this._key])){const t=this._object[this._key];if(dr(t)){t.value=e;return}}this._object[this._key]=e}get dep(){return NE(this._raw,this._key)}},g1=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()}},v1=class{constructor(e,t,n){this.fn=e,this.setter=t,this._value=void 0,this.dep=new Wd(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=iu-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!t,this.isSSR=n}notify(){if(this.flags|=16,!(this.flags&8)&&sr!==this)return j2(this,!0),!0}get value(){const e=this.dep.track();return $2(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}},y1={GET:"get",HAS:"has",ITERATE:"iterate"},b1={SET:"set",ADD:"add",DELETE:"delete",CLEAR:"clear"},Yd={},Xd=new WeakMap,va=void 0}));function XE(e){kv.push(e)}function ZE(){kv.pop()}function QE(e,t){}function au(e,t,n,r){try{return r?e(...r):e()}catch(o){sc(o,t,n)}}function Vi(e,t,n,r){if(Yt(e)){const o=au(e,t,n,r);return o&&xh(o)&&o.catch(i=>{sc(i,t,n)}),o}if(Nt(e)){const o=[];for(let i=0;i<e.length;i++)o.push(Vi(e[i],t,n,r));return o}}function sc(e,t,n,r=!0){const o=t?t.vnode:null,{errorHandler:i,throwUnhandledErrorInProduction:s}=t&&t.appContext.config||Rn;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){fa(),au(i,null,10,[e,l,c]),ha();return}}JE(e,n,o,r,s)}function JE(e,t,n,r=!0,o=!1){if(o)throw e;console.error(e)}function kt(e){const t=lf||Sv;return e?t.then(this?e.bind(this):e):t}function e5(e){let t=ns+1,n=Bo.length;for(;t<n;){const r=t+n>>>1,o=Bo[r],i=fu(o);i<e||i===e&&o.flags&2?t=r+1:n=r}return t}function rv(e){if(!(e.flags&1)){const t=fu(e),n=Bo[Bo.length-1];!n||!(e.flags&2)&&t>=fu(n)?Bo.push(e):Bo.splice(e5(t),0,e),e.flags|=1,w1()}}function w1(){lf||(lf=Sv.then(k1))}function Zd(e){Nt(e)?cc.push(...e):ka&&e.id===-1?ka.splice(uc+1,0,e):e.flags&1||(cc.push(e),e.flags|=1),w1()}function C1(e,t,n=ns+1){for(;n<Bo.length;n++){const r=Bo[n];if(r&&r.flags&2){if(e&&r.id!==e.uid)continue;Bo.splice(n,1),n--,r.flags&4&&(r.flags&=-2),r(),r.flags&4||(r.flags&=-2)}}}function Vh(e){if(cc.length){const t=[...new Set(cc)].sort((n,r)=>fu(n)-fu(r));if(cc.length=0,ka){ka.push(...t);return}for(ka=t,uc=0;uc<ka.length;uc++){const n=ka[uc];n.flags&4&&(n.flags&=-2),n.flags&8||n(),n.flags&=-2}ka=null,uc=0}}function k1(e){try{for(ns=0;ns<Bo.length;ns++){const t=Bo[ns];t&&!(t.flags&8)&&(t.flags&4&&(t.flags&=-2),au(t,t.i,t.i?15:14),t.flags&4||(t.flags&=-2))}}finally{for(;ns<Bo.length;ns++){const t=Bo[ns];t&&(t.flags&=-2)}ns=-1,Bo.length=0,Vh(e),lf=null,(Bo.length||cc.length)&&k1(e)}}function S1(e,t){var n,r;hu=e,hu?(hu.enabled=!0,cf.forEach(({event:o,args:i})=>hu.emit(o,...i)),cf=[]):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=>{S1(o,t)}),setTimeout(()=>{hu||(t.__VUE_DEVTOOLS_HOOK_REPLAY__=null,cf=[])},3e3)):cf=[]}function Qd(e){const t=uo;return uo=e,uf=e&&e.type.__scopeId||null,t}function t5(e){uf=e}function n5(){uf=null}function co(e,t=uo,n){if(!t||e._n)return e;const r=(...o)=>{r._d&&sf(-1);const i=Qd(t);let s;try{s=e(...o)}finally{Qd(i),r._d&&sf(1)}return s};return r._n=!0,r._c=!0,r._d=!0,r}function ya(e,t){if(uo===null)return e;const n=af(uo),r=e.dirs||(e.dirs=[]);for(let o=0;o<t.length;o++){let[i,s,a,l=Rn]=t[o];i&&(Yt(i)&&(i={mounted:i,updated:i}),i.deep&&ga(s),r.push({dir:i,instance:n,value:s,oldValue:void 0,arg:a,modifiers:l}))}return e}function Rs(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&&(fa(),Vi(l,n,8,[e.el,a,e,t]),ha())}}function _1(e,t){if(fo){let n=fo.provides;const r=fo.parent&&fo.parent.provides;r===n&&(n=fo.provides=Object.create(r)),n[e]=t}}function ll(e,t,n=!1){const r=vr();if(r||fl){let o=fl?fl._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&&Yt(t)?t.call(r&&r.proxy):t}}function A1(){return!!(vr()||fl)}function r5(e,t){return Jd(e,null,t)}function o5(e,t){return Jd(e,null,{flush:"post"})}function I1(e,t){return Jd(e,null,{flush:"sync"})}function Bt(e,t,n){return Jd(e,t,n)}function Jd(e,t,n=Rn){const{immediate:r,deep:o,flush:i,once:s}=n,a=Gn({},n),l=t&&r||!t&&i!=="post";let c;if(ml){if(i==="sync"){const g=Av();c=g.__watcherHandles||(g.__watcherHandles=[])}else if(!l){const g=()=>{};return g.stop=Ci,g.resume=Ci,g.pause=Ci,g}}const d=fo;a.call=(g,m,v)=>Vi(g,d,m,v);let f=!1;i==="post"?a.scheduler=g=>{Wr(g,d&&d.suspense)}:i!=="sync"&&(f=!0,a.scheduler=(g,m)=>{m?g():rv(g)}),a.augmentJob=g=>{t&&(g.flags|=4),f&&(g.flags|=2,d&&(g.id=d.uid,g.i=d))};const p=qE(e,t,a);return ml&&(c?c.push(p):l&&p()),p}function i5(e,t,n){const r=this.proxy,o=Qn(e)?e.includes(".")?E1(r,e):()=>r[e]:e.bind(r,r);let i;Yt(t)?i=t:(i=t.handler,n=t);const s=hc(this),a=Jd(o,i.bind(r),n);return s(),a}function E1(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 jh(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||ul(d))&&l&16)for(let p=0;p<c.length;p++)o(c[p],t,n,2);f&&r(a,t,n)}function s5(e,t,n,r,o,i,{o:{nextSibling:s,parentNode:a,querySelector:l,insert:c,createText:d}},f){function p(k,C){let S=C;for(;S;){if(S&&S.nodeType===8){if(S.data==="teleport start anchor")t.targetStart=S;else if(S.data==="teleport anchor"){t.targetAnchor=S,k._lpa=t.targetAnchor&&s(t.targetAnchor);break}}S=s(S)}}function g(k,C){C.anchor=f(s(k),C,a(k),n,r,o,i)}const m=t.target=Qh(t.props,l),v=ul(t.props);if(m){const k=m._lpa||m.firstChild;t.shapeFlag&16&&(v?(g(e,t),p(m,k),t.targetAnchor||ov(m,t,d,c,a(e)===m?e:null)):(t.anchor=s(e),p(m,k),t.targetAnchor||ov(m,t,d,c),f(k&&s(k),t,m,n,r,o,i))),ef(t,v)}else v&&t.shapeFlag&16&&(g(e,t),t.targetStart=e,t.targetAnchor=s(e));return t.anchor&&s(t.anchor)}function ef(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 ov(e,t,n,r,o=null){const i=t.targetStart=n(""),s=t.targetAnchor=n("");return i[Iv]=s,e&&(r(i,e,o),r(s,e,o)),s}function iv(){const e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return zn(()=>{e.isMounted=!0}),fr(()=>{e.isUnmounting=!0}),e}function T1(e){let t=e[0];if(e.length>1){for(const n of e)if(n.type!==Dr){t=n;break}}return t}function x1(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 lu(e,t,n,r,o){const{appear:i,mode:s,persisted:a=!1,onBeforeEnter:l,onEnter:c,onAfterEnter:d,onEnterCancelled:f,onBeforeLeave:p,onLeave:g,onAfterLeave:m,onLeaveCancelled:v,onBeforeAppear:k,onAppear:C,onAfterAppear:S,onAppearCancelled:w}=t,b=String(e.key),T=x1(n,e),L=(z,B)=>{z&&Vi(z,r,9,B)},N=(z,B)=>{const Z=B[1];L(z,B),Nt(z)?z.every(R=>R.length<=1)&&Z():z.length<=1&&Z()},H={mode:s,persisted:a,beforeEnter(z){let B=l;if(!n.isMounted)if(i)B=k||l;else return;z[rs]&&z[rs](!0);const Z=T[b];Z&&es(e,Z)&&Z.el[rs]&&Z.el[rs](),L(B,[z])},enter(z){if(T[b]===e)return;let B=c,Z=d,R=f;if(!n.isMounted)if(i)B=C||c,Z=S||d,R=w||f;else return;let K=!1;z[pu]=W=>{K||(K=!0,W?L(R,[z]):L(Z,[z]),H.delayedLeave&&H.delayedLeave(),z[pu]=void 0)};const x=z[pu].bind(null,!1);B?N(B,[z,x]):x()},leave(z,B){const Z=String(e.key);if(z[pu]&&z[pu](!0),n.isUnmounting)return B();L(p,[z]);let R=!1;z[rs]=x=>{R||(R=!0,B(),x?L(v,[z]):L(m,[z]),z[rs]=void 0,T[Z]===e&&delete T[Z])};const K=z[rs].bind(null,!1);T[Z]=e,g?N(g,[z,K]):K()},clone(z){const B=lu(z,t,n,r,o);return o&&o(B),B}};return H}function sv(e){if(mu(e))return e=Ls(e),e.children=null,e}function R1(e){if(!mu(e))return Ev(e.type)&&e.children?T1(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&&Yt(n.default))return n.default()}}function ba(e,t){e.shapeFlag&6&&e.component?(e.transition=t,ba(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 Uh(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===Kt?(s.patchFlag&128&&o++,r=r.concat(Uh(s.children,t,a))):(t||s.type!==Dr)&&r.push(a!=null?Ls(s,{key:a}):s)}if(o>1)for(let i=0;i<r.length;i++)r[i].patchFlag=-2;return r}function ac(e,t){return Yt(e)?Gn({name:e.name},t,{setup:e}):e}function a5(){const e=vr();return e?(e.appContext.config.idPrefix||"v")+"-"+e.ids[0]+e.ids[1]++:""}function av(e){e.ids=[e.ids[0]+e.ids[2]+++"-",0,0]}function l5(e){const t=vr(),n=$r(null);if(t){const r=t.refs===Rn?t.refs={}:t.refs;Object.defineProperty(r,e,{enumerable:!0,get:()=>n.value,set:o=>n.value=o})}return n}function L1(e,t){let n;return!!((n=Object.getOwnPropertyDescriptor(e,t))&&!n.configurable)}function cu(e,t,n,r,o=!1){if(Nt(e)){e.forEach((v,k)=>cu(v,t&&(Nt(t)?t[k]:t),n,r,o));return}if(Ds(r)&&!o){r.shapeFlag&512&&r.type.__asyncResolved&&r.component.subTree.component&&cu(e,t,n,r.component.subTree);return}const i=r.shapeFlag&4?af(r.component):r.el,s=o?null:i,{i:a,r:l}=e,c=t&&t.r,d=a.refs===Rn?a.refs={}:a.refs,f=a.setupState,p=gn(f),g=f===Rn?xg:v=>L1(d,v)?!1:Un(p,v),m=(v,k)=>!(k&&L1(d,k));if(c!=null&&c!==l){if(M1(t),Qn(c))d[c]=null,g(c)&&(f[c]=null);else if(dr(c)){const v=t;m(c,v.k)&&(c.value=null),v.k&&(d[v.k]=null)}}if(Yt(l))au(l,a,12,[s,d]);else{const v=Qn(l),k=dr(l);if(v||k){const C=()=>{if(e.f){const S=v?g(l)?f[l]:d[l]:m(l)||!e.k?l.value:d[e.k];if(o)Nt(S)&&Th(S,i);else if(Nt(S))S.includes(i)||S.push(i);else if(v)d[l]=[i],g(l)&&(f[l]=d[l]);else{const w=[i];m(l,e.k)&&(l.value=w),e.k&&(d[e.k]=w)}}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 S=()=>{C(),df.delete(e)};S.id=-1,df.set(e,S),Wr(S,n)}else M1(e),C()}}}function M1(e){const t=df.get(e);t&&(t.flags|=8,df.delete(e))}function c5(e){const{mt:t,p:n,o:{patchProp:r,createText:o,nextSibling:i,parentNode:s,remove:a,insert:l,createComment:c}}=e,d=(w,b)=>{if(!b.hasChildNodes()){n(null,w,b),Vh(),b._vnode=w;return}f(b.firstChild,w,null,null,null),Vh(),b._vnode=w},f=(w,b,T,L,N,H=!1)=>{H=H||!!b.dynamicChildren;const z=fc(w)&&w.data==="[",B=()=>v(w,b,T,L,N,z),{type:Z,ref:R,shapeFlag:K,patchFlag:x}=b;let W=w.nodeType;b.el=w,x===-2&&(H=!1,b.dynamicChildren=null);let $=null;switch(Z){case Sa:W!==3?b.children===""?(l(b.el=o(""),s(w),w),$=w):$=B():(w.data!==b.children&&(dc(),w.data=b.children),$=i(w));break;case Dr:S(w)?($=i(w),C(b.el=w.content.firstChild,w,T)):W!==8||z?$=B():$=i(w);break;case hl:if(z&&(w=i(w),W=w.nodeType),W===1||W===3){$=w;const ee=!b.children.length;for(let Q=0;Q<b.staticCount;Q++)ee&&(b.children+=$.nodeType===1?$.outerHTML:$.data),Q===b.staticCount-1&&(b.anchor=$),$=i($);return z?i($):$}else B();break;case Kt:z?$=m(w,b,T,L,N,H):$=B();break;default:if(K&1)(W!==1||b.type.toLowerCase()!==w.tagName.toLowerCase())&&!S(w)?$=B():$=p(w,b,T,L,N,H);else if(K&6){b.slotScopeIds=N;const ee=s(w);if(z?$=k(w):fc(w)&&w.data==="teleport start"?$=k(w,w.data,"teleport end"):$=i(w),t(b,ee,null,T,L,ff(ee),H),Ds(b)&&!b.type.__asyncResolved){let Q;z?(Q=qt(Kt),Q.anchor=$?$.previousSibling:ee.lastChild):Q=w.nodeType===3?ts(""):qt("div"),Q.el=w,b.component.subTree=Q}}else K&64?W!==8?$=B():$=b.type.hydrate(w,b,T,L,N,H,e,g):K&128&&($=b.type.hydrate(w,b,T,L,ff(s(w)),N,H,e,f))}return R!=null&&cu(R,null,L,b),$},p=(w,b,T,L,N,H)=>{H=H||!!b.dynamicChildren;const{type:z,props:B,patchFlag:Z,shapeFlag:R,dirs:K,transition:x}=b,W=z==="input"||z==="option";if(W||Z!==-1){K&&Rs(b,null,T,"created");let $=!1;if(S(w)){$=tw(null,x)&&T&&T.vnode.props&&T.vnode.props.appear;const Q=w.content.firstChild;if($){const X=Q.getAttribute("class");X&&(Q.$cls=X),x.beforeEnter(Q)}C(Q,w,T),b.el=w=Q}if(R&16&&!(B&&(B.innerHTML||B.textContent))){let Q=g(w.firstChild,b,w,T,L,N,H);for(;Q;){Hh(w,1)||dc();const X=Q;Q=Q.nextSibling,a(X)}}else if(R&8){let Q=b.children;Q[0]===`
|
|
2
2
|
`&&(w.tagName==="PRE"||w.tagName==="TEXTAREA")&&(Q=Q.slice(1));const{textContent:X}=w;X!==Q&&X!==Q.replace(/\r\n|\r/g,`
|
|
3
3
|
`)&&(Hh(w,0)||dc(),w.textContent=b.children)}if(B){if(W||!H||Z&48){const Q=w.tagName.includes("-");for(const X in B)(W&&(X.endsWith("value")||X==="indeterminate")||eu(X)&&!sl(X)||X[0]==="."||Q&&!sl(X))&&r(w,X,null,B[X],void 0,T)}else if(B.onClick)r(w,"onClick",null,B.onClick,void 0,T);else if(Z&4&&Ni(B.style))for(const Q in B.style)B.style[Q]}let ee;(ee=B&&B.onVnodeBeforeMount)&&hi(ee,T,b),K&&Rs(b,null,T,"beforeMount"),((ee=B&&B.onVnodeMounted)||K||$)&&sw(()=>{ee&&hi(ee,T,b),$&&x.enter(w),K&&Rs(b,null,T,"mounted")},L)}return w.nextSibling},g=(w,b,T,L,N,H,z)=>{z=z||!!b.dynamicChildren;const B=b.children,Z=B.length;for(let R=0;R<Z;R++){const K=z?B[R]:B[R]=fi(B[R]),x=K.type===Sa;w?(x&&!z&&R+1<Z&&fi(B[R+1]).type===Sa&&(l(o(w.data.slice(K.children.length)),T,i(w)),w.data=K.children),w=f(w,K,L,N,H,z)):x&&!K.children?l(K.el=o(""),T):(Hh(T,1)||dc(),n(null,K,T,null,L,N,ff(T),H))}return w},m=(w,b,T,L,N,H)=>{const{slotScopeIds:z}=b;z&&(N=N?N.concat(z):z);const B=s(w),Z=g(i(w),b,B,T,L,N,H);return Z&&fc(Z)&&Z.data==="]"?i(b.anchor=Z):(dc(),l(b.anchor=c("]"),B,Z),Z)},v=(w,b,T,L,N,H)=>{if(Hh(w.parentElement,1)||dc(),b.el=null,H){const Z=k(w);for(;;){const R=i(w);if(R&&R!==Z)a(R);else break}}const z=i(w),B=s(w);return a(w),n(null,b,B,z,T,L,ff(B),N),T&&(T.vnode.el=b.el,Xh(T,b.el)),z},k=(w,b="[",T="]")=>{let L=0;for(;w;)if(w=i(w),w&&fc(w)&&(w.data===b&&L++,w.data===T)){if(L===0)return i(w);L--}return w},C=(w,b,T)=>{const L=b.parentNode;L&&L.replaceChild(w,b);let N=T;for(;N;)N.vnode.el===b&&(N.vnode.el=N.subTree.el=w),N=N.parent},S=w=>w.nodeType===1&&w.tagName==="TEMPLATE";return[d,f]}function Hh(e,t){if(t===0||t===1)for(;e&&!e.hasAttribute(Dv);)e=e.parentElement;const n=e&&e.getAttribute(Dv);if(n==null)return!1;if(n==="")return!0;{const r=n.split(",");return t===0&&r.includes("children")?!0:r.includes(_w[t])}}function u5(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 d5(e,t){if(fc(e)&&e.data==="["){let n=1,r=e.nextSibling;for(;r;){if(r.nodeType===1){if(t(r)===!1)break}else if(fc(r))if(r.data==="]"){if(--n===0)break}else r.data==="["&&n++;r=r.nextSibling}}else t(e)}function D1(e){Yt(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 p=()=>(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(p()),()=>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 ac({name:"AsyncComponentWrapper",__asyncLoader:g,__asyncHydrate(m,v,k){let C=!1;(v.bu||(v.bu=[])).push(()=>C=!0);const S=()=>{C||k()},w=i?()=>{const b=i(S,T=>d5(m,T));b&&(v.bum||(v.bum=[])).push(b)}:S;d?w():g().then(()=>!v.isUnmounted&&w())},get __asyncResolved(){return d},setup(){const m=fo;if(av(m),d)return()=>$h(d,m);const v=w=>{c=null,sc(w,m,13,!r)};if(a&&m.suspense||ml)return g().then(w=>()=>$h(w,m)).catch(w=>(v(w),()=>r?qt(r,{error:w}):null));const k=te(!1),C=te(),S=te(!!o);return o&&setTimeout(()=>{S.value=!1},o),s!=null&&setTimeout(()=>{if(!k.value&&!C.value){const w=new Error(`Async component timed out after ${s}ms.`);v(w),C.value=w}},s),g().then(()=>{k.value=!0,m.parent&&mu(m.parent.vnode)&&m.parent.update()}).catch(w=>{v(w),C.value=w}),()=>{if(k.value&&d)return $h(d,m);if(C.value&&r)return qt(r,{error:C.value});if(n&&!S.value)return $h(n,m)}}})}function $h(e,t){const{ref:n,props:r,children:o,ce:i}=t.vnode,s=qt(e,r,o);return s.ref=n,s.ce=i,delete t.vnode.ce,s}function tf(e,t){return Nt(e)?e.some(n=>tf(n,t)):Qn(e)?e.split(",").includes(t):R2(e)?(e.lastIndex=0,e.test(t)):!1}function lv(e,t){O1(e,"a",t)}function cv(e,t){O1(e,"da",t)}function O1(e,t,n=fo){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;)mu(o.parent.vnode)&&f5(r,t,n,o),o=o.parent}}function f5(e,t,n,r){const o=Wh(t,e,r,!0);pf(()=>{Th(r[t],o)},n)}function uv(e){e.shapeFlag&=-257,e.shapeFlag&=-513}function Gh(e){return e.shapeFlag&128?e.ssContent:e}function Wh(e,t,n=fo,r=!1){if(n){const o=n[e]||(n[e]=[]),i=t.__weh||(t.__weh=(...s)=>{fa();const a=hc(n),l=Vi(t,n,e,s);return a(),ha(),l});return r?o.unshift(i):o.push(i),i}}function P1(e,t=fo){Wh("ec",e,t)}function h5(e,t){return fv(tp,e,!0,t)||e}function dv(e){return Qn(e)?fv(tp,e,!1)||e:e||Bv}function F1(e){return fv(Mw,e)}function fv(e,t,n=!0,r=!1){const o=uo||fo;if(o){const i=o.type;if(e===tp){const a=Cv(i,!1);if(a&&(a===t||a===Hr(t)||a===tu(Hr(t))))return i}const s=N1(o[e]||i[e],t)||N1(o.appContext[e],t);return!s&&r?i:s}}function N1(e,t){return e&&(e[t]||e[Hr(t)]||e[tu(Hr(t))])}function ar(e,t,n,r){let o;const i=n&&n[r],s=Nt(e);if(s||Qn(e)){const a=s&&Ni(e);let l=!1,c=!1;a&&(l=!di(e),c=xs(e),e=Lh(e)),o=new Array(e.length);for(let d=0,f=e.length;d<f;d++)o[d]=t(l?c?ic(zi(e[d])):zi(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(Bn(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 p5(e,t){for(let n=0;n<t.length;n++){const r=t[n];if(Nt(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 uu(e,t,n={},r,o){if(uo.ce||uo.parent&&Ds(uo.parent)&&uo.parent.ce){const c=Object.keys(n).length>0;return t!=="default"&&(n.name=t),ye(),rn(Kt,null,[qt("slot",n,r&&r())],c?-2:64)}let i=e[t];i&&i._c&&(i._d=!1),ye();const s=i&&hv(i(n)),a=n.key||s&&s.key,l=rn(Kt,{key:(a&&!ui(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 hv(e){return e.some(t=>wa(t)?!(t.type===Dr||t.type===Kt&&!hv(t.children)):!0)?e:null}function m5(e,t){const n={};for(const r in e)n[t&&/[A-Z]/.test(r)?`on:${r}`:nu(r)]=e[r];return n}function g5(){return null}function v5(){return null}function y5(e){}function b5(e){}function w5(){return null}function C5(){}function k5(e,t){return null}function B1(){return V1("useSlots").slots}function z1(){return V1("useAttrs").attrs}function V1(e){const t=vr();return t.setupContext||(t.setupContext=pw(t))}function nf(e){return Nt(e)?e.reduce((t,n)=>(t[n]=null,t),{}):e}function S5(e,t){const n=nf(e);for(const r in t){if(r.startsWith("__skip"))continue;let o=n[r];o?Nt(o)||Yt(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 _5(e,t){return!e||!t?e||t:Nt(e)&&Nt(t)?e.concat(t):Gn({},nf(e),nf(t))}function A5(e,t){const n={};for(const r in e)t.includes(r)||Object.defineProperty(n,r,{enumerable:!0,get:()=>e[r]});return n}function I5(e){const t=vr(),n=ml;let r=e();bu(),n&&yu(!1);const o=()=>{hc(t),n&&yu(!0)},i=()=>{vr()!==t&&t.scope.off(),bu(),n&&yu(!1)};return xh(r)&&(r=r.catch(s=>{throw o(),Promise.resolve().then(()=>Promise.resolve().then(i)),s})),[r,()=>{o(),Promise.resolve().then(i)}]}function E5(e){const t=pv(e),n=e.proxy,r=e.ctx;ip=!1,t.beforeCreate&&j1(t.beforeCreate,e,"bc");const{data:o,computed:i,methods:s,watch:a,provide:l,inject:c,created:d,beforeMount:f,mounted:p,beforeUpdate:g,updated:m,activated:v,deactivated:k,beforeDestroy:C,beforeUnmount:S,destroyed:w,unmounted:b,render:T,renderTracked:L,renderTriggered:N,errorCaptured:H,serverPrefetch:z,expose:B,inheritAttrs:Z,components:R,directives:K,filters:x}=t;if(c&&T5(c,r,null),s)for(const ee in s){const Q=s[ee];Yt(Q)&&(r[ee]=Q.bind(n))}if(o){const ee=o.call(n,n);Bn(ee)&&(e.data=no(ee))}if(ip=!0,i)for(const ee in i){const Q=i[ee],X=Yt(Q)?Q.bind(n,n):Yt(Q.get)?Q.get.bind(n,n):Ci,we=!Yt(Q)&&Yt(Q.set)?Q.set.bind(n):Ci,ce=Ce({get:X,set:we});Object.defineProperty(r,ee,{enumerable:!0,configurable:!0,get:()=>ce.value,set:be=>ce.value=be})}if(a)for(const ee in a)U1(a[ee],r,n,ee);if(l){const ee=Yt(l)?l.call(n):l;Reflect.ownKeys(ee).forEach(Q=>{_1(Q,ee[Q])})}d&&j1(d,e,"c");function $(ee,Q){Nt(Q)?Q.forEach(X=>ee(X.bind(n))):Q&&ee(Q.bind(n))}if($(Ov,f),$(zn,p),$(ep,g),$(hf,m),$(lv,v),$(cv,k),$(P1,H),$(Nv,L),$(Fv,N),$(fr,S),$(pf,b),$(Pv,z),Nt(B))if(B.length){const ee=e.exposed||(e.exposed={});B.forEach(Q=>{Object.defineProperty(ee,Q,{get:()=>n[Q],set:X=>n[Q]=X,enumerable:!0})})}else e.exposed||(e.exposed={});T&&e.render===Ci&&(e.render=T),Z!=null&&(e.inheritAttrs=Z),R&&(e.components=R),K&&(e.directives=K),z&&av(e)}function T5(e,t,n=Ci){Nt(e)&&(e=mv(e));for(const r in e){const o=e[r];let i;Bn(o)?"default"in o?i=ll(o.from||r,o.default,!0):i=ll(o.from||r):i=ll(o),dr(i)?Object.defineProperty(t,r,{enumerable:!0,configurable:!0,get:()=>i.value,set:s=>i.value=s}):t[r]=i}}function j1(e,t,n){Vi(Nt(e)?e.map(r=>r.bind(t.proxy)):e.bind(t.proxy),t,n)}function U1(e,t,n,r){let o=r.includes(".")?E1(n,r):()=>n[r];if(Qn(e)){const i=t[e];Yt(i)&&Bt(o,i)}else if(Yt(e))Bt(o,e.bind(n));else if(Bn(e))if(Nt(e))e.forEach(i=>U1(i,t,n,r));else{const i=Yt(e.handler)?e.handler.bind(n):t[e.handler];Yt(i)&&Bt(o,i,e)}}function pv(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=>Kh(l,c,s,!0)),Kh(l,t,s)),Bn(t)&&i.set(t,l),l}function Kh(e,t,n,r=!1){const{mixins:o,extends:i}=t;i&&Kh(e,i,n,!0),o&&o.forEach(s=>Kh(e,s,n,!0));for(const s in t)if(!(r&&s==="expose")){const a=Ow[s]||n&&n[s];e[s]=a?a(e[s],t[s]):t[s]}return e}function H1(e,t){return t?e?function(){return Gn(Yt(e)?e.call(this,this):e,Yt(t)?t.call(this,this):t)}:t:e}function x5(e,t){return rf(mv(e),mv(t))}function mv(e){if(Nt(e)){const t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function Zo(e,t){return e?[...new Set([].concat(e,t))]:t}function rf(e,t){return e?Gn(Object.create(null),e,t):t}function $1(e,t){return e?Nt(e)&&Nt(t)?[...new Set([...e,...t])]:Gn(Object.create(null),nf(e),nf(t??{})):t}function R5(e,t){if(!e)return t;if(!t)return e;const n=Gn(Object.create(null),e);for(const r in t)n[r]=Zo(e[r],t[r]);return n}function G1(){return{app:null,config:{isNativeTag:xg,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 L5(e,t){return function(r,o=null){Yt(r)||(r=Gn({},r)),o!=null&&!Bn(o)&&(o=null);const i=G1(),s=new WeakSet,a=[];let l=!1;const c=i.app={_uid:Pw++,_component:r,_props:o,_container:null,_context:i,_instance:null,version:qv,get config(){return i.config},set config(d){},use(d,...f){return s.has(d)||(d&&Yt(d.install)?(s.add(d),d.install(c,...f)):Yt(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,p){if(!l){const g=c._ceVNode||qt(r,o);return g.appContext=i,p===!0?p="svg":p===!1&&(p=void 0),f&&t?t(g,d):e(g,d,p),l=!0,c._container=d,d.__vue_app__=c,af(g.component)}},onUnmount(d){a.push(d)},unmount(){l&&(Vi(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=fl;fl=c;try{return d()}finally{fl=f}}};return c}}function M5(e,t,n=Rn){const r=vr(),o=Hr(t),i=Xo(t),s=zv(e,o),a=X2((l,c)=>{let d,f=Rn,p;return I1(()=>{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!==Rn&&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,p)&&c(),f=g,p=m}}});return a[Symbol.iterator]=()=>{let l=0;return{next(){return l<2?{value:l++?s||Rn:a,done:!1}:{done:!0}}}},a}function D5(e,t,...n){if(e.isUnmounted)return;const r=e.vnode.props||Rn;let o=n;const i=t.startsWith("update:"),s=i&&zv(r,t.slice(7));s&&(s.trim&&(o=n.map(d=>Qn(d)?d.trim():d)),s.number&&(o=n.map(zd)));let a,l=r[a=nu(t)]||r[a=nu(Hr(t))];!l&&i&&(l=r[a=nu(Xo(t))]),l&&Vi(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,Vi(c,e,6,o)}}function W1(e,t,n=!1){const r=n?Fw:t.emitsCache,o=r.get(e);if(o!==void 0)return o;const i=e.emits;let s={},a=!1;if(!Yt(e)){const l=c=>{const d=W1(c,t,!0);d&&(a=!0,Gn(s,d))};!n&&t.mixins.length&&t.mixins.forEach(l),e.extends&&l(e.extends),e.mixins&&e.mixins.forEach(l)}return!i&&!a?(Bn(e)&&r.set(e,null),null):(Nt(i)?i.forEach(l=>s[l]=null):Gn(s,i),Bn(e)&&r.set(e,s),s)}function qh(e,t){return!e||!eu(t)?!1:(t=t.slice(2).replace(/Once$/,""),Un(e,t[0].toLowerCase()+t.slice(1))||Un(e,Xo(t))||Un(e,t))}function Yh(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:p,setupState:g,ctx:m,inheritAttrs:v}=e,k=Qd(e);let C,S;try{if(n.shapeFlag&4){const b=o||r,T=b;C=fi(c.call(T,b,d,f,g,p,m)),S=a}else{const b=t;C=fi(b.length>1?b(f,{attrs:a,slots:s,emit:l}):b(f,null)),S=t.props?a:Nw(a)}}catch(b){vu.length=0,sc(b,e,1),C=qt(Dr)}let w=C;if(S&&v!==!1){const b=Object.keys(S),{shapeFlag:T}=w;b.length&&T&7&&(i&&b.some(Pd)&&(S=Bw(S,i)),w=Ls(w,S,!1,!0))}return n.dirs&&(w=Ls(w,null,!1,!0),w.dirs=w.dirs?w.dirs.concat(n.dirs):n.dirs),n.transition&&ba(w,n.transition),C=w,Qd(k),C}function O5(e,t=!0){let n;for(let r=0;r<e.length;r++){const o=e[r];if(wa(o)){if(o.type!==Dr||o.children==="v-if"){if(n)return;n=o}}else return}return n}function P5(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?K1(r,s,c):!!s;if(l&8){const d=t.dynamicProps;for(let f=0;f<d.length;f++){const p=d[f];if(q1(s,r,p)&&!qh(c,p))return!0}}}else return(o||a)&&(!a||!a.$stable)?!0:r===s?!1:r?s?K1(r,s,c):!0:!!s;return!1}function K1(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(q1(t,e,i)&&!qh(n,i))return!0}return!1}function q1(e,t,n){const r=e[n],o=t[n];return n==="style"&&Bn(r)&&Bn(o)?!da(r,o):r!==o}function Xh({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 F5(e,t,n,r=!1){const o={},i=jv();e.propsDefaults=Object.create(null),Y1(e,t,o,i);for(const s in e.propsOptions[0])s in o||(o[s]=void 0);n?e.props=r?o:q2(o):e.type.props?e.props=o:e.props=i,e.attrs=i}function N5(e,t,n,r){const{props:o,attrs:i,vnode:{patchFlag:s}}=e,a=gn(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 p=d[f];if(qh(e.emitsOptions,p))continue;const g=t[p];if(l)if(Un(i,p))g!==i[p]&&(i[p]=g,c=!0);else{const m=Hr(p);o[m]=gv(l,a,m,g,e,!1)}else g!==i[p]&&(i[p]=g,c=!0)}}}else{Y1(e,t,o,i)&&(c=!0);let d;for(const f in a)(!t||!Un(t,f)&&((d=Xo(f))===f||!Un(t,d)))&&(l?n&&(n[f]!==void 0||n[d]!==void 0)&&(o[f]=gv(l,a,f,void 0,e,!0)):delete o[f]);if(i!==a)for(const f in i)(!t||!Un(t,f))&&(delete i[f],c=!0)}c&&pa(e.attrs,"set","")}function Y1(e,t,n,r){const[o,i]=e.propsOptions;let s=!1,a;if(t)for(let l in t){if(sl(l))continue;const c=t[l];let d;o&&Un(o,d=Hr(l))?!i||!i.includes(d)?n[d]=c:(a||(a={}))[d]=c:qh(e.emitsOptions,l)||(!(l in r)||c!==r[l])&&(r[l]=c,s=!0)}if(i){const l=gn(n),c=a||Rn;for(let d=0;d<i.length;d++){const f=i[d];n[f]=gv(o,l,f,c[f],e,!Un(c,f))}}return s}function gv(e,t,n,r,o,i){const s=e[n];if(s!=null){const a=Un(s,"default");if(a&&r===void 0){const l=s.default;if(s.type!==Function&&!s.skipFactory&&Yt(l)){const{propsDefaults:c}=o;if(n in c)r=c[n];else{const d=hc(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===Xo(n))&&(r=!0))}return r}function X1(e,t,n=!1){const r=n?zw:t.propsCache,o=r.get(e);if(o)return o;const i=e.props,s={},a=[];let l=!1;if(!Yt(e)){const d=f=>{l=!0;const[p,g]=X1(f,t,!0);Gn(s,p),g&&a.push(...g)};!n&&t.mixins.length&&t.mixins.forEach(d),e.extends&&d(e.extends),e.mixins&&e.mixins.forEach(d)}if(!i&&!l)return Bn(e)&&r.set(e,tc),tc;if(Nt(i))for(let d=0;d<i.length;d++){const f=Hr(i[d]);Z1(f)&&(s[f]=Rn)}else if(i)for(const d in i){const f=Hr(d);if(Z1(f)){const p=i[d],g=s[f]=Nt(p)||Yt(p)?{type:p}:Gn({},p),m=g.type;let v=!1,k=!0;if(Nt(m))for(let C=0;C<m.length;++C){const S=m[C],w=Yt(S)&&S.name;if(w==="Boolean"){v=!0;break}else w==="String"&&(k=!1)}else v=Yt(m)&&m.name==="Boolean";g[0]=v,g[1]=k,(v||Un(g,"default"))&&a.push(f)}}const c=[s,a];return Bn(e)&&r.set(e,c),c}function Z1(e){return e[0]!=="$"&&!sl(e)}function Q1(e){return ew(e)}function J1(e){return ew(e,c5)}function ew(e,t){const n=jd();n.__VUE__=!0;const{insert:r,remove:o,patchProp:i,createElement:s,createText:a,createComment:l,setText:c,setElementText:d,parentNode:f,nextSibling:p,setScopeId:g=Ci,insertStaticContent:m}=e,v=(ne,A,ie,F=null,Y=null,O=null,V=void 0,oe=null,U=!!A.dynamicChildren)=>{if(ne===A)return;ne&&!es(ne,A)&&(F=at(ne),be(ne,Y,O,!0),ne=null),A.patchFlag===-2&&(U=!1,A.dynamicChildren=null);const{type:G,ref:ge,shapeFlag:Ae}=A;switch(G){case Sa:k(ne,A,ie,F);break;case Dr:C(ne,A,ie,F);break;case hl:ne==null&&S(A,ie,F,V);break;case Kt:R(ne,A,ie,F,Y,O,V,oe,U);break;default:Ae&1?T(ne,A,ie,F,Y,O,V,oe,U):Ae&6?K(ne,A,ie,F,Y,O,V,oe,U):(Ae&64||Ae&128)&&G.process(ne,A,ie,F,Y,O,V,oe,U,se)}ge!=null&&Y?cu(ge,ne&&ne.ref,O,A||ne,!A):ge==null&&ne&&ne.ref!=null&&cu(ne.ref,null,O,ne,!0)},k=(ne,A,ie,F)=>{if(ne==null)r(A.el=a(A.children),ie,F);else{const Y=A.el=ne.el;A.children!==ne.children&&c(Y,A.children)}},C=(ne,A,ie,F)=>{ne==null?r(A.el=l(A.children||""),ie,F):A.el=ne.el},S=(ne,A,ie,F)=>{[ne.el,ne.anchor]=m(ne.children,A,ie,F,ne.el,ne.anchor)},w=({el:ne,anchor:A},ie,F)=>{let Y;for(;ne&&ne!==A;)Y=p(ne),r(ne,ie,F),ne=Y;r(A,ie,F)},b=({el:ne,anchor:A})=>{let ie;for(;ne&&ne!==A;)ie=p(ne),o(ne),ne=ie;o(A)},T=(ne,A,ie,F,Y,O,V,oe,U)=>{if(A.type==="svg"?V="svg":A.type==="math"&&(V="mathml"),ne==null)L(A,ie,F,Y,O,V,oe,U);else{const G=ne.el&&ne.el._isVueCE?ne.el:null;try{G&&G._beginPatch(),z(ne,A,Y,O,V,oe,U)}finally{G&&G._endPatch()}}},L=(ne,A,ie,F,Y,O,V,oe)=>{let U,G;const{props:ge,shapeFlag:Ae,transition:Se,dirs:Te}=ne;if(U=ne.el=s(ne.type,O,ge&&ge.is,ge),Ae&8?d(U,ne.children):Ae&16&&H(ne.children,U,null,F,Y,vv(ne,O),V,oe),Te&&Rs(ne,null,F,"created"),N(U,ne,ne.scopeId,V,F),ge){for(const rt in ge)rt!=="value"&&!sl(rt)&&i(U,rt,null,ge[rt],O,F);"value"in ge&&i(U,"value",null,ge.value,O),(G=ge.onVnodeBeforeMount)&&hi(G,F,ne)}Te&&Rs(ne,null,F,"beforeMount");const Ye=tw(Y,Se);Ye&&Se.beforeEnter(U),r(U,A,ie),((G=ge&&ge.onVnodeMounted)||Ye||Te)&&Wr(()=>{G&&hi(G,F,ne),Ye&&Se.enter(U),Te&&Rs(ne,null,F,"mounted")},Y)},N=(ne,A,ie,F,Y)=>{if(ie&&g(ne,ie),F)for(let O=0;O<F.length;O++)g(ne,F[O]);if(Y){let O=Y.subTree;if(A===O||mf(O.type)&&(O.ssContent===A||O.ssFallback===A)){const V=Y.vnode;N(ne,V,V.scopeId,V.slotScopeIds,Y.parent)}}},H=(ne,A,ie,F,Y,O,V,oe,U=0)=>{for(let G=U;G<ne.length;G++){const ge=ne[G]=oe?Ca(ne[G]):fi(ne[G]);v(null,ge,A,ie,F,Y,O,V,oe)}},z=(ne,A,ie,F,Y,O,V)=>{const oe=A.el=ne.el;let{patchFlag:U,dynamicChildren:G,dirs:ge}=A;U|=ne.patchFlag&16;const Ae=ne.props||Rn,Se=A.props||Rn;let Te;if(ie&&lc(ie,!1),(Te=Se.onVnodeBeforeUpdate)&&hi(Te,ie,A,ne),ge&&Rs(A,ne,ie,"beforeUpdate"),ie&&lc(ie,!0),(Ae.innerHTML&&Se.innerHTML==null||Ae.textContent&&Se.textContent==null)&&d(oe,""),G?B(ne.dynamicChildren,G,oe,ie,F,vv(A,Y),O):V||Q(ne,A,oe,null,ie,F,vv(A,Y),O,!1),U>0){if(U&16)Z(oe,Ae,Se,ie,Y);else if(U&2&&Ae.class!==Se.class&&i(oe,"class",null,Se.class,Y),U&4&&i(oe,"style",Ae.style,Se.style,Y),U&8){const Ye=A.dynamicProps;for(let rt=0;rt<Ye.length;rt++){const ht=Ye[rt],Pt=Ae[ht],Ft=Se[ht];(Ft!==Pt||ht==="value")&&i(oe,ht,Pt,Ft,Y,ie)}}U&1&&ne.children!==A.children&&d(oe,A.children)}else!V&&G==null&&Z(oe,Ae,Se,ie,Y);((Te=Se.onVnodeUpdated)||ge)&&Wr(()=>{Te&&hi(Te,ie,A,ne),ge&&Rs(A,ne,ie,"updated")},F)},B=(ne,A,ie,F,Y,O,V)=>{for(let oe=0;oe<A.length;oe++){const U=ne[oe],G=A[oe],ge=U.el&&(U.type===Kt||!es(U,G)||U.shapeFlag&198)?f(U.el):ie;v(U,G,ge,null,F,Y,O,V,!0)}},Z=(ne,A,ie,F,Y)=>{if(A!==ie){if(A!==Rn)for(const O in A)!sl(O)&&!(O in ie)&&i(ne,O,A[O],null,Y,F);for(const O in ie){if(sl(O))continue;const V=ie[O],oe=A[O];V!==oe&&O!=="value"&&i(ne,O,oe,V,Y,F)}"value"in ie&&i(ne,"value",A.value,ie.value,Y)}},R=(ne,A,ie,F,Y,O,V,oe,U)=>{const G=A.el=ne?ne.el:a(""),ge=A.anchor=ne?ne.anchor:a("");let{patchFlag:Ae,dynamicChildren:Se,slotScopeIds:Te}=A;Te&&(oe=oe?oe.concat(Te):Te),ne==null?(r(G,ie,F),r(ge,ie,F),H(A.children||[],ie,ge,Y,O,V,oe,U)):Ae>0&&Ae&64&&Se&&ne.dynamicChildren&&ne.dynamicChildren.length===Se.length?(B(ne.dynamicChildren,Se,ie,Y,O,V,oe),(A.key!=null||Y&&A===Y.subTree)&&yv(ne,A,!0)):Q(ne,A,ie,ge,Y,O,V,oe,U)},K=(ne,A,ie,F,Y,O,V,oe,U)=>{A.slotScopeIds=oe,ne==null?A.shapeFlag&512?Y.ctx.activate(A,ie,F,V,U):x(A,ie,F,Y,O,V,U):W(ne,A,U)},x=(ne,A,ie,F,Y,O,V)=>{const oe=ne.component=uw(ne,F,Y);if(mu(ne)&&(oe.ctx.renderer=se),fw(oe,!1,V),oe.asyncDep){if(Y&&Y.registerDep(oe,$,V),!ne.el){const U=oe.subTree=qt(Dr);C(null,U,A,ie),ne.placeholder=U.el}}else $(oe,ne,A,ie,Y,O,V)},W=(ne,A,ie)=>{const F=A.component=ne.component;if(P5(ne,A,ie))if(F.asyncDep&&!F.asyncResolved){ee(F,A,ie);return}else F.next=A,F.update();else A.el=ne.el,F.vnode=A},$=(ne,A,ie,F,Y,O,V)=>{const oe=()=>{if(ne.isMounted){let{next:Ae,bu:Se,u:Te,parent:Ye,vnode:rt}=ne;{const $e=nw(ne);if($e){Ae&&(Ae.el=rt.el,ee(ne,Ae,V)),$e.asyncDep.then(()=>{Wr(()=>{ne.isUnmounted||G()},Y)});return}}let ht=Ae,Pt;lc(ne,!1),Ae?(Ae.el=rt.el,ee(ne,Ae,V)):Ae=rt,Se&&oc(Se),(Pt=Ae.props&&Ae.props.onVnodeBeforeUpdate)&&hi(Pt,Ye,Ae,rt),lc(ne,!0);const Ft=Yh(ne),Wt=ne.subTree;ne.subTree=Ft,v(Wt,Ft,f(Wt.el),at(Wt),ne,Y,O),Ae.el=Ft.el,ht===null&&Xh(ne,Ft.el),Te&&Wr(Te,Y),(Pt=Ae.props&&Ae.props.onVnodeUpdated)&&Wr(()=>hi(Pt,Ye,Ae,rt),Y)}else{let Ae;const{el:Se,props:Te}=A,{bm:Ye,m:rt,parent:ht,root:Pt,type:Ft}=ne,Wt=Ds(A);if(lc(ne,!1),Ye&&oc(Ye),!Wt&&(Ae=Te&&Te.onVnodeBeforeMount)&&hi(Ae,ht,A),lc(ne,!0),Se&&Ue){const $e=()=>{ne.subTree=Yh(ne),Ue(Se,ne.subTree,ne,Y,null)};Wt&&Ft.__asyncHydrate?Ft.__asyncHydrate(Se,ne,$e):$e()}else{Pt.ce&&Pt.ce._hasShadowRoot()&&Pt.ce._injectChildStyle(Ft,ne.parent?ne.parent.type:void 0);const $e=ne.subTree=Yh(ne);v(null,$e,ie,F,ne,Y,O),A.el=$e.el}if(rt&&Wr(rt,Y),!Wt&&(Ae=Te&&Te.onVnodeMounted)){const $e=A;Wr(()=>hi(Ae,ht,$e),Y)}(A.shapeFlag&256||ht&&Ds(ht.vnode)&&ht.vnode.shapeFlag&256)&&ne.a&&Wr(ne.a,Y),ne.isMounted=!0,A=ie=F=null}};ne.scope.on();const U=ne.effect=new ou(oe);ne.scope.off();const G=ne.update=U.run.bind(U),ge=ne.job=U.runIfDirty.bind(U);ge.i=ne,ge.id=ne.uid,U.scheduler=()=>rv(ge),lc(ne,!0),G()},ee=(ne,A,ie)=>{A.component=ne;const F=ne.vnode.props;ne.vnode=A,ne.next=null,N5(ne,A.props,F,ie),Uw(ne,A.children,ie),fa(),C1(ne),ha()},Q=(ne,A,ie,F,Y,O,V,oe,U=!1)=>{const G=ne&&ne.children,ge=ne?ne.shapeFlag:0,Ae=A.children,{patchFlag:Se,shapeFlag:Te}=A;if(Se>0){if(Se&128){we(G,Ae,ie,F,Y,O,V,oe,U);return}else if(Se&256){X(G,Ae,ie,F,Y,O,V,oe,U);return}}Te&8?(ge&16&&Ze(G,Y,O),Ae!==G&&d(ie,Ae)):ge&16?Te&16?we(G,Ae,ie,F,Y,O,V,oe,U):Ze(G,Y,O,!0):(ge&8&&d(ie,""),Te&16&&H(Ae,ie,F,Y,O,V,oe,U))},X=(ne,A,ie,F,Y,O,V,oe,U)=>{ne=ne||tc,A=A||tc;const G=ne.length,ge=A.length,Ae=Math.min(G,ge);let Se;for(Se=0;Se<Ae;Se++){const Te=A[Se]=U?Ca(A[Se]):fi(A[Se]);v(ne[Se],Te,ie,null,Y,O,V,oe,U)}G>ge?Ze(ne,Y,O,!0,!1,Ae):H(A,ie,F,Y,O,V,oe,U,Ae)},we=(ne,A,ie,F,Y,O,V,oe,U)=>{let G=0;const ge=A.length;let Ae=ne.length-1,Se=ge-1;for(;G<=Ae&&G<=Se;){const Te=ne[G],Ye=A[G]=U?Ca(A[G]):fi(A[G]);if(es(Te,Ye))v(Te,Ye,ie,null,Y,O,V,oe,U);else break;G++}for(;G<=Ae&&G<=Se;){const Te=ne[Ae],Ye=A[Se]=U?Ca(A[Se]):fi(A[Se]);if(es(Te,Ye))v(Te,Ye,ie,null,Y,O,V,oe,U);else break;Ae--,Se--}if(G>Ae){if(G<=Se){const Te=Se+1,Ye=Te<ge?A[Te].el:F;for(;G<=Se;)v(null,A[G]=U?Ca(A[G]):fi(A[G]),ie,Ye,Y,O,V,oe,U),G++}}else if(G>Se)for(;G<=Ae;)be(ne[G],Y,O,!0),G++;else{const Te=G,Ye=G,rt=new Map;for(G=Ye;G<=Se;G++){const Ut=A[G]=U?Ca(A[G]):fi(A[G]);Ut.key!=null&&rt.set(Ut.key,G)}let ht,Pt=0;const Ft=Se-Ye+1;let Wt=!1,$e=0;const cn=new Array(Ft);for(G=0;G<Ft;G++)cn[G]=0;for(G=Te;G<=Ae;G++){const Ut=ne[G];if(Pt>=Ft){be(Ut,Y,O,!0);continue}let In;if(Ut.key!=null)In=rt.get(Ut.key);else for(ht=Ye;ht<=Se;ht++)if(cn[ht-Ye]===0&&es(Ut,A[ht])){In=ht;break}In===void 0?be(Ut,Y,O,!0):(cn[In-Ye]=G+1,In>=$e?$e=In:Wt=!0,v(Ut,A[In],ie,null,Y,O,V,oe,U),Pt++)}const jn=Wt?B5(cn):tc;for(ht=jn.length-1,G=Ft-1;G>=0;G--){const Ut=Ye+G,In=A[Ut],qr=A[Ut+1],Cr=Ut+1<ge?qr.el||rw(qr):F;cn[G]===0?v(null,In,ie,Cr,Y,O,V,oe,U):Wt&&(ht<0||G!==jn[ht]?ce(In,ie,Cr,2):ht--)}}},ce=(ne,A,ie,F,Y=null)=>{const{el:O,type:V,transition:oe,children:U,shapeFlag:G}=ne;if(G&6){ce(ne.component.subTree,A,ie,F);return}if(G&128){ne.suspense.move(A,ie,F);return}if(G&64){V.move(ne,A,ie,se);return}if(V===Kt){r(O,A,ie);for(let ge=0;ge<U.length;ge++)ce(U[ge],A,ie,F);r(ne.anchor,A,ie);return}if(V===hl){w(ne,A,ie);return}if(F!==2&&G&1&&oe)if(F===0)oe.beforeEnter(O),r(O,A,ie),Wr(()=>oe.enter(O),Y);else{const{leave:ge,delayLeave:Ae,afterLeave:Se}=oe,Te=()=>{ne.ctx.isUnmounted?o(O):r(O,A,ie)},Ye=()=>{O._isLeaving&&O[rs](!0),ge(O,()=>{Te(),Se&&Se()})};Ae?Ae(O,Te,Ye):Ye()}else r(O,A,ie)},be=(ne,A,ie,F=!1,Y=!1)=>{const{type:O,props:V,ref:oe,children:U,dynamicChildren:G,shapeFlag:ge,patchFlag:Ae,dirs:Se,cacheIndex:Te,memo:Ye}=ne;if(Ae===-2&&(Y=!1),oe!=null&&(fa(),cu(oe,null,ie,ne,!0),ha()),Te!=null&&(A.renderCache[Te]=void 0),ge&256){A.ctx.deactivate(ne);return}const rt=ge&1&&Se,ht=!Ds(ne);let Pt;if(ht&&(Pt=V&&V.onVnodeBeforeUnmount)&&hi(Pt,A,ne),ge&6)Pe(ne.component,ie,F);else{if(ge&128){ne.suspense.unmount(ie,F);return}rt&&Rs(ne,null,A,"beforeUnmount"),ge&64?ne.type.remove(ne,A,ie,se,F):G&&!G.hasOnce&&(O!==Kt||Ae>0&&Ae&64)?Ze(G,A,ie,!1,!0):(O===Kt&&Ae&384||!Y&&ge&16)&&Ze(U,A,ie),F&&ve(ne)}const Ft=Ye!=null&&Te==null;(ht&&(Pt=V&&V.onVnodeUnmounted)||rt||Ft)&&Wr(()=>{Pt&&hi(Pt,A,ne),rt&&Rs(ne,null,A,"unmounted"),Ft&&(ne.el=null)},ie)},ve=ne=>{const{type:A,el:ie,anchor:F,transition:Y}=ne;if(A===Kt){Ee(ie,F);return}if(A===hl){b(ne);return}const O=()=>{o(ie),Y&&!Y.persisted&&Y.afterLeave&&Y.afterLeave()};if(ne.shapeFlag&1&&Y&&!Y.persisted){const{leave:V,delayLeave:oe}=Y,U=()=>V(ie,O);oe?oe(ne.el,O,U):U()}else O()},Ee=(ne,A)=>{let ie;for(;ne!==A;)ie=p(ne),o(ne),ne=ie;o(A)},Pe=(ne,A,ie)=>{const{bum:F,scope:Y,job:O,subTree:V,um:oe,m:U,a:G}=ne;Zh(U),Zh(G),F&&oc(F),Y.stop(),O&&(O.flags|=8,be(V,ne,A,ie)),oe&&Wr(oe,A),Wr(()=>{ne.isUnmounted=!0},A)},Ze=(ne,A,ie,F=!1,Y=!1,O=0)=>{for(let V=O;V<ne.length;V++)be(ne[V],A,ie,F,Y)},at=ne=>{if(ne.shapeFlag&6)return at(ne.component.subTree);if(ne.shapeFlag&128)return ne.suspense.next();const A=p(ne.anchor||ne.el),ie=A&&A[Iv];return ie?p(ie):A};let Qe=!1;const At=(ne,A,ie)=>{let F;ne==null?A._vnode&&(be(A._vnode,null,null,!0),F=A._vnode.component):v(A._vnode||null,ne,A,null,null,null,ie),A._vnode=ne,Qe||(Qe=!0,C1(F),Vh(),Qe=!1)},se={p:v,um:be,m:ce,r:ve,mt:x,mc:H,pc:Q,pbc:B,n:at,o:e};let Ie,Ue;return t&&([Ie,Ue]=t(se)),{render:At,hydrate:Ie,createApp:L5(At,Ie)}}function vv({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 lc({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function tw(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function yv(e,t,n=!1){const r=e.children,o=t.children;if(Nt(r)&&Nt(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]=Ca(o[i]),a.el=s.el),!n&&a.patchFlag!==-2&&yv(s,a)),a.type===Sa&&(a.patchFlag===-1&&(a=o[i]=Ca(a)),a.el=s.el),a.type===Dr&&!a.el&&(a.el=s.el)}}function B5(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 nw(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:nw(t)}function Zh(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}function rw(e){if(e.placeholder)return e.placeholder;const t=e.component;return t?rw(t.subTree):null}function of(e,t){const n=e.props&&e.props[t];Yt(n)&&n()}function z5(e,t,n,r,o,i,s,a,l){const{p:c,o:{createElement:d}}=l,f=d("div"),p=e.suspense=ow(e,o,r,t,f,n,i,s,a,l);c(null,p.pendingBranch=e.ssContent,f,null,r,p,i,s),p.deps>0?(of(e,"onPending"),of(e,"onFallback"),c(null,e.ssFallback,t,n,r,null,i,s),du(p,e.ssFallback)):p.resolve(!1,!0)}function V5(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 p=t.ssContent,g=t.ssFallback,{activeBranch:m,pendingBranch:v,isInFallback:k,isHydrating:C}=f;if(v)f.pendingBranch=p,es(v,p)?(l(v,p,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),du(f,g)))):(f.pendingId=lp++,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,p,f.hiddenContainer,null,o,f,i,s,a),f.deps<=0?f.resolve():(l(m,g,n,r,o,null,i,s,a),du(f,g))):m&&es(m,p)?(l(m,p,n,r,o,f,i,s,a),f.resolve(!0)):(l(null,p,f.hiddenContainer,null,o,f,i,s,a),f.deps<=0&&f.resolve()));else if(m&&es(m,p))l(m,p,n,r,o,f,i,s,a),du(f,p);else if(of(t,"onPending"),f.pendingBranch=p,p.shapeFlag&512?f.pendingId=p.component.suspenseId:f.pendingId=lp++,l(null,p,f.hiddenContainer,null,o,f,i,s,a),f.deps<=0)f.resolve();else{const{timeout:S,pendingId:w}=f;S>0?setTimeout(()=>{f.pendingId===w&&f.fallback(g)},S):S===0&&f.fallback(g)}}function ow(e,t,n,r,o,i,s,a,l,c,d=!1){const{p:f,m:p,um:g,n:m,o:{parentNode:v,remove:k}}=c;let C;const S=H5(e);S&&t&&t.pendingBranch&&(C=t.pendingId,t.deps++);const w=e.props?Vd(e.props.timeout):void 0,b=i,T={vnode:e,parent:t,parentComponent:n,namespace:s,container:r,hiddenContainer:o,deps:0,pendingId:lp++,timeout:typeof w=="number"?w:-1,activeBranch:null,isFallbackMountPending:!1,pendingBranch:null,isInFallback:!d,isHydrating:d,isUnmounted:!1,effects:[],resolve(L=!1,N=!1){const{vnode:H,activeBranch:z,pendingBranch:B,pendingId:Z,effects:R,parentComponent:K,container:x,isInFallback:W}=T;let $=!1;T.isHydrating?T.isHydrating=!1:L||($=z&&B.transition&&B.transition.mode==="out-in",$&&(z.transition.afterLeave=()=>{Z===T.pendingId&&(p(B,x,i===b?m(z):i,0),Zd(R),W&&H.ssFallback&&(H.ssFallback.el=null))}),z&&!T.isFallbackMountPending&&(v(z.el)===x&&(i=m(z)),g(z,K,T,!0),!$&&W&&H.ssFallback&&Wr(()=>H.ssFallback.el=null,T)),$||p(B,x,i,0)),T.isFallbackMountPending=!1,du(T,B),T.pendingBranch=null,T.isInFallback=!1;let ee=T.parent,Q=!1;for(;ee;){if(ee.pendingBranch){ee.effects.push(...R),Q=!0;break}ee=ee.parent}!Q&&!$&&Zd(R),T.effects=[],S&&t&&t.pendingBranch&&C===t.pendingId&&(t.deps--,t.deps===0&&!N&&t.resolve()),of(H,"onResolve")},fallback(L){if(!T.pendingBranch)return;const{vnode:N,activeBranch:H,parentComponent:z,container:B,namespace:Z}=T;of(N,"onFallback");const R=m(H),K=()=>{T.isFallbackMountPending=!1,T.isInFallback&&(f(null,L,B,R,z,null,Z,a,l),du(T,L))},x=L.transition&&L.transition.mode==="out-in";x&&(T.isFallbackMountPending=!0,H.transition.afterLeave=K),T.isInFallback=!0,g(H,z,null,!0),x||K()},move(L,N,H){T.activeBranch&&p(T.activeBranch,L,N,H),T.container=L},next(){return T.activeBranch&&m(T.activeBranch)},registerDep(L,N,H){const z=!!T.pendingBranch;z&&T.deps++;const B=L.vnode.el;L.asyncDep.catch(Z=>{sc(Z,L,0)}).then(Z=>{if(L.isUnmounted||T.isUnmounted||T.pendingId!==L.suspenseId)return;bu(),L.asyncResolved=!0;const{vnode:R}=L;wv(L,Z,!1),B&&(R.el=B);const K=!B&&L.subTree.el;N(L,R,v(B||L.subTree.el),B?null:m(L.subTree),T,s,H),K&&(R.placeholder=null,k(K)),Xh(L,R.el),z&&--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 j5(e,t,n,r,o,i,s,a,l){const c=t.suspense=ow(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 U5(e){const{shapeFlag:t,children:n}=e,r=t&32;e.ssContent=iw(r?n.default:n),e.ssFallback=r?iw(n.fallback):qt(Dr)}function iw(e){let t;if(Yt(e)){const n=pl&&e._c;n&&(e._d=!1,ye()),e=e(),n&&(e._d=!0,t=ko,aw())}return Nt(e)&&(e=O5(e)),e=fi(e),t&&!e.dynamicChildren&&(e.dynamicChildren=t.filter(n=>n!==e)),e}function sw(e,t){t&&t.pendingBranch?Nt(e)?t.effects.push(...e):t.effects.push(e):Zd(e)}function du(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,Xh(r,o))}function H5(e){const t=e.props&&e.props.suspensible;return t!=null&&t!==!1}function ye(e=!1){vu.push(ko=e?null:[])}function aw(){vu.pop(),ko=vu[vu.length-1]||null}function sf(e,t=!1){pl+=e,e<0&&ko&&t&&(ko.hasOnce=!0)}function lw(e){return e.dynamicChildren=pl>0?ko||tc:null,aw(),pl>0&&ko&&ko.push(e),e}function Me(e,t,n,r,o,i){return lw(He(e,t,n,r,o,i,!0))}function rn(e,t,n,r,o){return lw(qt(e,t,n,r,o,!0))}function wa(e){return e?e.__v_isVNode===!0:!1}function es(e,t){return e.type===t.type&&e.key===t.key}function $5(e){}function He(e,t=null,n=null,r=0,o=null,i=e===Kt?0:1,s=!1,a=!1){const l={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&Wv(t),ref:t&&gf(t),scopeId:uf,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:i,patchFlag:r,dynamicProps:o,dynamicChildren:null,appContext:null,ctx:uo};return a?(bv(l,n),i&128&&e.normalize(l)):n&&(l.shapeFlag|=Qn(n)?8:16),pl>0&&!s&&ko&&(l.patchFlag>0||i&6)&&l.patchFlag!==32&&ko.push(l),l}function G5(e,t=null,n=null,r=0,o=null,i=!1){if((!e||e===Bv)&&(e=Dr),wa(e)){const a=Ls(e,t,!0);return n&&bv(a,n),pl>0&&!i&&ko&&(a.shapeFlag&6?ko[ko.indexOf(e)]=a:ko.push(a)),a.patchFlag=-2,a}if(Y5(e)&&(e=e.__vccOpts),t){t=cw(t);let{class:a,style:l}=t;a&&!Qn(a)&&(t.class=Qt(a)),Bn(l)&&(Hd(l)&&!Nt(l)&&(l=Gn({},l)),t.style=bn(l))}const s=Qn(e)?1:mf(e)?128:Ev(e)?64:Bn(e)?4:Yt(e)?2:0;return He(e,t,n,r,o,s,i,!0)}function cw(e){return e?Hd(e)||Uv(e)?Gn({},e):e:null}function Ls(e,t,n=!1,r=!1){const{props:o,ref:i,patchFlag:s,children:a,transition:l}=e,c=t?Ms(o||{},t):o,d={__v_isVNode:!0,__v_skip:!0,type:e.type,props:c,key:c&&Wv(c),ref:t&&t.ref?n&&i?Nt(i)?i.concat(gf(t)):[i,gf(t)]:gf(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!==Kt?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&&Ls(e.ssContent),ssFallback:e.ssFallback&&Ls(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return l&&r&&ba(d,l.clone(d)),d}function ts(e=" ",t=0){return qt(Sa,null,e,t)}function W5(e,t){const n=qt(hl,null,e);return n.staticCount=t,n}function mt(e="",t=!1){return t?(ye(),rn(Dr,null,e)):qt(Dr,null,e)}function fi(e){return e==null||typeof e=="boolean"?qt(Dr):Nt(e)?qt(Kt,null,e.slice()):wa(e)?Ca(e):qt(Sa,null,String(e))}function Ca(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:Ls(e)}function bv(e,t){let n=0;const{shapeFlag:r}=e;if(t==null)t=null;else if(Nt(t))n=16;else if(typeof t=="object")if(r&65){const o=t.default;o&&(o._c&&(o._d=!1),bv(e,o()),o._c&&(o._d=!0));return}else{n=32;const o=t._;!o&&!Uv(t)?t._ctx=uo:o===3&&uo&&(uo.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else Yt(t)?(t={default:t,_ctx:uo},n=32):(t=String(t),r&64?(n=16,t=[ts(t)]):n=8);e.children=t,e.shapeFlag|=n}function Ms(...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=Qt([t.class,r.class]));else if(o==="style")t.style=bn([t.style,r.style]);else if(eu(o)){const i=t[o],s=r[o];s&&i!==s&&!(Nt(i)&&i.includes(s))?t[o]=i?[].concat(i,s):s:s==null&&i==null&&!Pd(o)&&(t[o]=s)}else o!==""&&(t[o]=r[o])}return t}function hi(e,t,n,r=null){Vi(e,t,7,[n,r])}function uw(e,t,n){const r=e.type,o=(t?t.appContext:e.appContext)||$w,i={uid:Gw++,vnode:e,type:r,parent:t,appContext:o,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new Fh(!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:X1(r,o),emitsOptions:W1(r,o),emit:null,emitted:null,propsDefaults:Rn,inheritAttrs:r.inheritAttrs,ctx:Rn,data:Rn,props:Rn,attrs:Rn,slots:Rn,refs:Rn,setupState:Rn,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=D5.bind(null,i),e.ce&&e.ce(i),i}function dw(e){return e.vnode.shapeFlag&4}function fw(e,t=!1,n=!1){t&&yu(t);const{props:r,children:o}=e.vnode,i=dw(e);F5(e,r,i,t),jw(e,o,n||t);const s=i?K5(e,t):void 0;return t&&yu(!1),s}function K5(e,t){const n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,op);const{setup:r}=n;if(r){fa();const o=e.setupContext=r.length>1?pw(e):null,i=hc(e),s=au(r,e,0,[e.props,o]),a=xh(s);if(ha(),i(),(a||e.sp)&&!Ds(e)&&av(e),a){if(s.then(bu,bu),t)return s.then(l=>{wv(e,l,t)}).catch(l=>{sc(l,e,0)});e.asyncDep=s}else wv(e,s,t)}else hw(e,t)}function wv(e,t,n){Yt(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:Bn(t)&&(e.setupState=Gg(t)),hw(e,n)}function q5(e){up=e,Kv=t=>{t.render._rc&&(t.withProxy=new Proxy(t.ctx,Dw))}}function hw(e,t,n){const r=e.type;if(!e.render){if(!t&&up&&!r.render){const o=r.template||pv(e).template;if(o){const{isCustomElement:i,compilerOptions:s}=e.appContext.config,{delimiters:a,compilerOptions:l}=r,c=Gn(Gn({isCustomElement:i,delimiters:a},s),l);r.render=up(o,c)}}e.render=r.render||Ci,Kv&&Kv(e)}{const o=hc(e);fa();try{E5(e)}finally{ha(),o()}}}function pw(e){const t=n=>{e.exposed=n||{}};return{attrs:new Proxy(e.attrs,Kw),slots:e.slots,emit:e.emit,expose:t}}function af(e){return e.exposed?e.exposeProxy||(e.exposeProxy=new Proxy(Gg(ro(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in gu)return gu[n](e)},has(t,n){return n in t||n in gu}})):e.proxy}function Cv(e,t=!0){return Yt(e)?e.displayName||e.name:e.name||t&&e.__name}function Y5(e){return Yt(e)&&"__vccOpts"in e}function Gr(e,t,n){try{sf(-1);const r=arguments.length;return r===2?Bn(t)&&!Nt(t)?wa(t)?qt(e,null,[t]):qt(e,t):qt(e,null,t):(r>3?n=Array.prototype.slice.call(arguments,2):r===3&&wa(n)&&(n=[n]),qt(e,t,n))}finally{sf(1)}}function X5(){return;function e(t,n,r){const o=t[r];if(Nt(o)&&o.includes(n)||Bn(o)&&n in o||t.extends&&e(t.extends,n,r)||t.mixins&&t.mixins.some(i=>e(i,n,r)))return!0}}function Z5(e,t,n,r){const o=n[r];if(o&&mw(o,e))return o;const i=t();return i.memo=e.slice(),i.cacheIndex=r,n[r]=i}function mw(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 pl>0&&ko&&ko.push(e),!0}var kv,gw,vw,Bo,ns,cc,ka,uc,Sv,lf,fu,hu,cf,uo,uf,yw,_v,Av,cl,Iv,Ev,ul,bw,Tv,xv,Qh,ww,dl,rs,pu,ki,Jh,Rv,Cw,Lv,df,Mv,dc,kw,Sw,ff,fc,Dv,_w,Aw,Iw,Ew,Tw,xw,Rw,Ds,mu,Lw,Os,Ov,zn,ep,hf,fr,pf,Pv,Fv,Nv,tp,Mw,Bv,np,gu,rp,op,Dw,ip,Ow,Pw,fl,zv,Fw,Nw,Bw,Vv,jv,Uv,zw,sp,ap,Vw,Hv,$v,Gv,jw,Uw,Wr,mf,lp,Hw,Kt,Sa,Dr,hl,vu,ko,pl,Wv,gf,qt,$w,Gw,fo,vr,cp,yu,hc,bu,ml,up,Kv,Ww,Kw,Ce,qv,qw,Yw,Xw,Zw,Qw,Q5,J5,eT,Jw=Mr((()=>{YE(),Fg(),kv=[],gw={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"},vw={sp:"serverPrefetch hook",bc:"beforeCreate hook",c:"created hook",bm:"beforeMount hook",m:"mounted hook",bu:"beforeUpdate hook",u:"updated",bum:"beforeUnmount hook",um:"unmounted hook",a:"activated hook",da:"deactivated hook",ec:"errorCaptured hook",rtc:"renderTracked hook",rtg:"renderTriggered hook",0:"setup function",1:"render function",2:"watcher getter",3:"watcher callback",4:"watcher cleanup function",5:"native event handler",6:"component event handler",7:"vnode hook",8:"directive hook",9:"transition hook",10:"app errorHandler",11:"app warnHandler",12:"ref function",13:"async component loader",14:"scheduler flush",15:"component update",16:"app unmount cleanup function"},Bo=[],ns=-1,cc=[],ka=null,uc=0,Sv=Promise.resolve(),lf=null,fu=e=>e.id==null?e.flags&2?-1:1/0:e.id,cf=[],uo=null,uf=null,yw=e=>co,_v=Symbol.for("v-scx"),Av=()=>{{const e=ll(_v);return e}},cl=new WeakMap,Iv=Symbol("_vte"),Ev=e=>e.__isTeleport,ul=e=>e&&(e.disabled||e.disabled===""),bw=e=>e&&(e.defer||e.defer===""),Tv=e=>typeof SVGElement<"u"&&e instanceof SVGElement,xv=e=>typeof MathMLElement=="function"&&e instanceof MathMLElement,Qh=(e,t)=>{const n=e&&e.to;return Qn(n)?t?t(n):null:n},ww={name:"Teleport",__isTeleport:!0,process(e,t,n,r,o,i,s,a,l,c){const{mc:d,pc:f,pbc:p,o:{insert:g,querySelector:m,createText:v,createComment:k}}=c,C=ul(t.props);let{dynamicChildren:S}=t;const w=(L,N,H)=>{L.shapeFlag&16&&d(L.children,N,H,o,i,s,a,l)},b=(L=t)=>{const N=ul(L.props),H=L.target=Qh(L.props,m),z=ov(H,L,v,g);H&&(s!=="svg"&&Tv(H)?s="svg":s!=="mathml"&&xv(H)&&(s="mathml"),o&&o.isCE&&(o.ce._teleportTargets||(o.ce._teleportTargets=new Set)).add(H),N||(w(L,H,z),ef(L,!1)))},T=L=>{const N=()=>{cl.get(L)===N&&(cl.delete(L),ul(L.props)&&(w(L,n,L.anchor),ef(L,!0)),b(L))};cl.set(L,N),Wr(N,i)};if(e==null){const L=t.el=v(""),N=t.anchor=v("");if(g(L,n,r),g(N,n,r),bw(t.props)||i&&i.pendingBranch){T(t);return}C&&(w(t,n,N),ef(t,!0)),b()}else{t.el=e.el;const L=t.anchor=e.anchor,N=cl.get(e);if(N){N.flags|=8,cl.delete(e),T(t);return}t.targetStart=e.targetStart;const H=t.target=e.target,z=t.targetAnchor=e.targetAnchor,B=ul(e.props),Z=B?n:H,R=B?L:z;if(s==="svg"||Tv(H)?s="svg":(s==="mathml"||xv(H))&&(s="mathml"),S?(p(e.dynamicChildren,S,Z,o,i,s,a),yv(e,t,!0)):l||f(e,t,Z,R,o,i,s,a,!1),C)B?t.props&&e.props&&t.props.to!==e.props.to&&(t.props.to=e.props.to):jh(t,n,L,c,1);else if((t.props&&t.props.to)!==(e.props&&e.props.to)){const K=t.target=Qh(t.props,m);K&&jh(t,K,null,c,0)}else B&&jh(t,H,z,c,1);ef(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:p}=e;let g=i||!ul(p);const m=cl.get(e);if(m&&(m.flags|=8,cl.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:jh,hydrate:s5},dl=ww,rs=Symbol("_leaveCb"),pu=Symbol("_enterCb"),ki=[Function,Array],Jh={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:ki,onEnter:ki,onAfterEnter:ki,onEnterCancelled:ki,onBeforeLeave:ki,onLeave:ki,onAfterLeave:ki,onLeaveCancelled:ki,onBeforeAppear:ki,onAppear:ki,onAfterAppear:ki,onAppearCancelled:ki},Rv=e=>{const t=e.subTree;return t.component?Rv(t.component):t},Cw={name:"BaseTransition",props:Jh,setup(e,{slots:t}){const n=vr(),r=iv();return()=>{const o=t.default&&Uh(t.default(),!0);if(!o||!o.length)return;const i=T1(o),s=gn(e),{mode:a}=s;if(r.isLeaving)return sv(i);const l=R1(i);if(!l)return sv(i);let c=lu(l,s,r,n,f=>c=f);l.type!==Dr&&ba(l,c);let d=n.subTree&&R1(n.subTree);if(d&&d.type!==Dr&&!es(d,l)&&Rv(n).type!==Dr){let f=lu(d,s,r,n);if(ba(d,f),a==="out-in"&&l.type!==Dr)return r.isLeaving=!0,f.afterLeave=()=>{r.isLeaving=!1,n.job.flags&8||n.update(),delete f.afterLeave,d=void 0},sv(i);a==="in-out"&&l.type!==Dr?f.delayLeave=(p,g,m)=>{const v=x1(r,d);v[String(d.key)]=d,p[rs]=()=>{g(),p[rs]=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}}},Lv=Cw,df=new WeakMap,Mv=!1,dc=()=>{Mv||(console.error("Hydration completed but contains mismatches."),Mv=!0)},kw=e=>e.namespaceURI.includes("svg")&&e.tagName!=="foreignObject",Sw=e=>e.namespaceURI.includes("MathML"),ff=e=>{if(e.nodeType===1){if(kw(e))return"svg";if(Sw(e))return"mathml"}},fc=e=>e.nodeType===8,Dv="data-allow-mismatch",_w={0:"text",1:"children",2:"class",3:"style",4:"attribute"},Aw=jd().requestIdleCallback||(e=>setTimeout(e,1)),Iw=jd().cancelIdleCallback||(e=>clearTimeout(e)),Ew=(e=1e4)=>t=>{const n=Aw(t,{timeout:e});return()=>Iw(n)},Tw=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(u5(o))return t(),r.disconnect(),!1;r.observe(o)}}),()=>r.disconnect()},xw=e=>t=>{if(e){const n=matchMedia(e);if(n.matches)t();else return n.addEventListener("change",t,{once:!0}),()=>n.removeEventListener("change",t)}},Rw=(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},Ds=e=>!!e.type.__asyncLoader,mu=e=>e.type.__isKeepAlive,Lw={name:"KeepAlive",__isKeepAlive:!0,props:{include:[String,RegExp,Array],exclude:[String,RegExp,Array],max:[String,Number]},setup(e,{slots:t}){const n=vr(),r=n.ctx;if(!r.renderer)return()=>{const S=t.default&&t.default();return S&&S.length===1?S[0]:S};const o=new Map,i=new Set;let s=null;const a=n.suspense,{renderer:{p:l,m:c,um:d,o:{createElement:f}}}=r,p=f("div");r.activate=(S,w,b,T,L)=>{const N=S.component;c(S,w,b,0,a),l(N.vnode,S,w,b,N,a,T,S.slotScopeIds,L),Wr(()=>{N.isDeactivated=!1,N.a&&oc(N.a);const H=S.props&&S.props.onVnodeMounted;H&&hi(H,N.parent,S)},a)},r.deactivate=S=>{const w=S.component;Zh(w.m),Zh(w.a),c(S,p,null,1,a),Wr(()=>{w.da&&oc(w.da);const b=S.props&&S.props.onVnodeUnmounted;b&&hi(b,w.parent,S),w.isDeactivated=!0},a)};function g(S){uv(S),d(S,n,a,!0)}function m(S){o.forEach((w,b)=>{const T=Cv(Ds(w)?w.type.__asyncResolved||{}:w.type);T&&!S(T)&&v(b)})}function v(S){const w=o.get(S);w&&(!s||!es(w,s))?g(w):s&&uv(s),o.delete(S),i.delete(S)}Bt(()=>[e.include,e.exclude],([S,w])=>{S&&m(b=>tf(S,b)),w&&m(b=>!tf(w,b))},{flush:"post",deep:!0});let k=null;const C=()=>{k!=null&&(mf(n.subTree.type)?Wr(()=>{o.set(k,Gh(n.subTree))},n.subTree.suspense):o.set(k,Gh(n.subTree)))};return zn(C),hf(C),fr(()=>{o.forEach(S=>{const{subTree:w,suspense:b}=n,T=Gh(w);if(S.type===T.type&&S.key===T.key){uv(T);const L=T.component.da;L&&Wr(L,b);return}g(S)})}),()=>{if(k=null,!t.default)return s=null;const S=t.default(),w=S[0];if(S.length>1)return s=null,S;if(!wa(w)||!(w.shapeFlag&4)&&!(w.shapeFlag&128))return s=null,w;let b=Gh(w);if(b.type===Dr)return s=null,b;const T=b.type,L=Cv(Ds(b)?b.type.__asyncResolved||{}:T),{include:N,exclude:H,max:z}=e;if(N&&(!L||!tf(N,L))||H&&L&&tf(H,L))return b.shapeFlag&=-257,s=b,w;const B=b.key==null?T:b.key,Z=o.get(B);return b.el&&(b=Ls(b),w.shapeFlag&128&&(w.ssContent=b)),k=B,Z?(b.el=Z.el,b.component=Z.component,b.transition&&ba(b,b.transition),b.shapeFlag|=512,i.delete(B),i.add(B)):(i.add(B),z&&i.size>parseInt(z,10)&&v(i.values().next().value)),b.shapeFlag|=256,s=b,mf(w.type)?w:b}}},Os=e=>(t,n=fo)=>{(!ml||e==="sp")&&Wh(e,(...r)=>t(...r),n)},Ov=Os("bm"),zn=Os("m"),ep=Os("bu"),hf=Os("u"),fr=Os("bum"),pf=Os("um"),Pv=Os("sp"),Fv=Os("rtg"),Nv=Os("rtc"),tp="components",Mw="directives",Bv=Symbol.for("v-ndc"),np=e=>e?dw(e)?af(e):np(e.parent):null,gu=Gn(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=>np(e.parent),$root:e=>np(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>pv(e),$forceUpdate:e=>e.f||(e.f=()=>{rv(e.update)}),$nextTick:e=>e.n||(e.n=kt.bind(e.proxy)),$watch:e=>i5.bind(e)}),rp=(e,t)=>e!==Rn&&!e.__isScriptSetup&&Un(e,t),op={get({_:e},t){if(t==="__v_skip")return!0;const{ctx:n,setupState:r,data:o,props:i,accessCache:s,type:a,appContext:l}=e;if(t[0]!=="$"){const p=s[t];if(p!==void 0)switch(p){case 1:return r[t];case 2:return o[t];case 4:return n[t];case 3:return i[t]}else{if(rp(r,t))return s[t]=1,r[t];if(o!==Rn&&Un(o,t))return s[t]=2,o[t];if(Un(i,t))return s[t]=3,i[t];if(n!==Rn&&Un(n,t))return s[t]=4,n[t];ip&&(s[t]=0)}}const c=gu[t];let d,f;if(c)return t==="$attrs"&&Fo(e.attrs,"get",""),c(e);if((d=a.__cssModules)&&(d=d[t]))return d;if(n!==Rn&&Un(n,t))return s[t]=4,n[t];if(f=l.config.globalProperties,Un(f,t))return f[t]},set({_:e},t,n){const{data:r,setupState:o,ctx:i}=e;return rp(o,t)?(o[t]=n,!0):r!==Rn&&Un(r,t)?(r[t]=n,!0):Un(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!==Rn&&a[0]!=="$"&&Un(e,a)||rp(t,a)||Un(i,a)||Un(r,a)||Un(gu,a)||Un(o.config.globalProperties,a)||(l=s.__cssModules)&&l[a])},defineProperty(e,t,n){return n.get!=null?e._.accessCache[t]=0:Un(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}},Dw=Gn({},op,{get(e,t){if(t!==Symbol.unscopables)return op.get(e,t,e)},has(e,t){return t[0]!=="_"&&!P2(t)}}),ip=!0,Ow={data:H1,props:$1,emits:$1,methods:rf,computed:rf,beforeCreate:Zo,created:Zo,beforeMount:Zo,mounted:Zo,beforeUpdate:Zo,updated:Zo,beforeDestroy:Zo,beforeUnmount:Zo,destroyed:Zo,unmounted:Zo,activated:Zo,deactivated:Zo,errorCaptured:Zo,serverPrefetch:Zo,components:rf,directives:rf,watch:R5,provide:H1,inject:x5},Pw=0,fl=null,zv=(e,t)=>t==="modelValue"||t==="model-value"?e.modelModifiers:e[`${t}Modifiers`]||e[`${Hr(t)}Modifiers`]||e[`${Xo(t)}Modifiers`],Fw=new WeakMap,Nw=e=>{let t;for(const n in e)(n==="class"||n==="style"||eu(n))&&((t||(t={}))[n]=e[n]);return t},Bw=(e,t)=>{const n={};for(const r in e)(!Pd(r)||!(r.slice(9)in t))&&(n[r]=e[r]);return n},Vv={},jv=()=>Object.create(Vv),Uv=e=>Object.getPrototypeOf(e)===Vv,zw=new WeakMap,sp=e=>e==="_"||e==="_ctx"||e==="$stable",ap=e=>Nt(e)?e.map(fi):[fi(e)],Vw=(e,t,n)=>{if(t._n)return t;const r=co((...o)=>ap(t(...o)),n);return r._c=!1,r},Hv=(e,t,n)=>{const r=e._ctx;for(const o in e){if(sp(o))continue;const i=e[o];if(Yt(i))t[o]=Vw(o,i,r);else if(i!=null){const s=ap(i);t[o]=()=>s}}},$v=(e,t)=>{const n=ap(t);e.slots.default=()=>n},Gv=(e,t,n)=>{for(const r in t)(n||!sp(r))&&(e[r]=t[r])},jw=(e,t,n)=>{const r=e.slots=jv();if(e.vnode.shapeFlag&32){const o=t._;o?(Gv(r,t,n),n&&Mg(r,"_",o,!0)):Hv(t,r)}else t&&$v(e,t)},Uw=(e,t,n)=>{const{vnode:r,slots:o}=e;let i=!0,s=Rn;if(r.shapeFlag&32){const a=t._;a?n&&a===1?i=!1:Gv(o,t,n):(i=!t.$stable,Hv(t,o)),s=t}else t&&($v(e,t),s={default:1});if(i)for(const a in o)!sp(a)&&s[a]==null&&delete o[a]},Wr=sw,mf=e=>e.__isSuspense,lp=0,Hw={name:"Suspense",__isSuspense:!0,process(e,t,n,r,o,i,s,a,l,c){if(e==null)z5(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}V5(e,t,n,r,o,s,a,l,c)}},hydrate:j5,normalize:U5},Kt=Symbol.for("v-fgt"),Sa=Symbol.for("v-txt"),Dr=Symbol.for("v-cmt"),hl=Symbol.for("v-stc"),vu=[],ko=null,pl=1,Wv=({key:e})=>e??null,gf=({ref:e,ref_key:t,ref_for:n})=>(typeof e=="number"&&(e=""+e),e!=null?Qn(e)||dr(e)||Yt(e)?{i:uo,r:e,k:t,f:!!n}:e:null),qt=G5,$w=G1(),Gw=0,fo=null,vr=()=>fo||uo;{const e=jd(),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)}};cp=t("__VUE_INSTANCE_SETTERS__",n=>fo=n),yu=t("__VUE_SSR_SETTERS__",n=>ml=n)}hc=e=>{const t=fo;return cp(e),e.scope.on(),()=>{e.scope.off(),cp(t)}},bu=()=>{fo&&fo.scope.off(),cp(null)},ml=!1,Ww=()=>!up,Kw={get(e,t){return Fo(e,"get",""),e[t]}},Ce=(e,t)=>WE(e,t,ml),qv="3.5.32",qw=Ci,Yw=vw,Xw=hu,Zw=S1,Qw={createComponentInstance:uw,setupComponent:fw,renderComponentRoot:Yh,setCurrentRenderingInstance:Qd,isVNode:wa,normalizeVNode:fi,getComponentPublicInstance:af,ensureValidVNode:hv,pushWarningContext:XE,popWarningContext:ZE},Q5=null,J5=null,eT=null}));function eC(e){const t={};for(const R in e)R in ny||(t[R]=e[R]);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:p=`${n}-leave-active`,leaveToClass:g=`${n}-leave-to`}=e,m=tT(o),v=m&&m[0],k=m&&m[1],{onBeforeEnter:C,onEnter:S,onEnterCancelled:w,onLeave:b,onLeaveCancelled:T,onBeforeAppear:L=C,onAppear:N=S,onAppearCancelled:H=w}=t,z=(R,K,x,W)=>{R._enterCancelled=W,gl(R,K?d:a),gl(R,K?c:s),x&&x()},B=(R,K)=>{R._isLeaving=!1,gl(R,f),gl(R,g),gl(R,p),K&&K()},Z=R=>(K,x)=>{const W=R?N:S,$=()=>z(K,R,x);vl(W,[K,$]),tC(()=>{gl(K,R?l:i),Ps(K,R?d:a),oy(W)||nC(K,r,v,$)})};return Gn(t,{onBeforeEnter(R){vl(C,[R]),Ps(R,i),Ps(R,s)},onBeforeAppear(R){vl(L,[R]),Ps(R,l),Ps(R,c)},onEnter:Z(!1),onAppear:Z(!0),onLeave(R,K){R._isLeaving=!0;const x=()=>B(R,K);Ps(R,f),R._enterCancelled?(Ps(R,p),Xv(R)):(Xv(R),Ps(R,p)),tC(()=>{R._isLeaving&&(gl(R,f),Ps(R,g),oy(b)||nC(R,r,k,x))}),vl(b,[R,x])},onEnterCancelled(R){z(R,!1,void 0,!0),vl(w,[R])},onAppearCancelled(R){z(R,!0,void 0,!0),vl(H,[R])},onLeaveCancelled(R){B(R),vl(T,[R])}})}function tT(e){if(e==null)return null;if(Bn(e))return[Yv(e.enter),Yv(e.leave)];{const t=Yv(e);return[t,t]}}function Yv(e){return Vd(e)}function Ps(e,t){t.split(/\s+/).forEach(n=>n&&e.classList.add(n)),(e[pc]||(e[pc]=new Set)).add(t)}function gl(e,t){t.split(/\s+/).forEach(r=>r&&e.classList.remove(r));const n=e[pc];n&&(n.delete(t),n.size||(e[pc]=void 0))}function tC(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}function nC(e,t,n,r){const o=e._endId=++_C,i=()=>{o===e._endId&&r()};if(n!=null)return setTimeout(i,n);const{type:s,timeout:a,propCount:l}=rC(e,t);if(!s)return r();const c=s+"end";let d=0;const f=()=>{e.removeEventListener(c,p),i()},p=g=>{g.target===e&&++d>=l&&f()};setTimeout(()=>{d<l&&f()},a+1),e.addEventListener(c,p)}function rC(e,t){const n=window.getComputedStyle(e),r=m=>(n[m]||"").split(", "),o=r(`${Aa}Delay`),i=r(`${Aa}Duration`),s=oC(o,i),a=r(`${Cu}Delay`),l=r(`${Cu}Duration`),c=oC(a,l);let d=null,f=0,p=0;t===Aa?s>0&&(d=Aa,f=s,p=i.length):t===Cu?c>0&&(d=Cu,f=c,p=l.length):(f=Math.max(s,c),d=f>0?s>c?Aa:Cu:null,p=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:p,hasTransform:g}}function oC(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((n,r)=>iC(n)+iC(e[r])))}function iC(e){return e==="auto"?0:Number(e.slice(0,-1).replace(",","."))*1e3}function Xv(e){return(e?e.ownerDocument:document).body.offsetHeight}function nT(e,t,n){const r=e[pc];r&&(t=(t?[t,...r]:[...r]).join(" ")),t==null?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}function vf(e,t){e.style.display=t?e[yf]:"none",e[iy]=!t}function rT(){sy.getSSRProps=({value:e})=>{if(!e)return{style:{display:"none"}}}}function oT(e){const t=vr();if(!t)return;const n=t.ut=(o=e(t.proxy))=>{Array.from(document.querySelectorAll(`[data-v-owner="${t.uid}"]`)).forEach(i=>dp(i,o))},r=()=>{const o=e(t.proxy);t.ce?dp(t.ce,o):Zv(t.subTree,o),n(o)};ep(()=>{Zd(r)}),zn(()=>{Bt(r,Ci,{flush:"post"});const o=new MutationObserver(r);o.observe(t.subTree.el.parentNode,{childList:!0}),pf(()=>o.disconnect())})}function Zv(e,t){if(e.shapeFlag&128){const n=e.suspense;e=n.activeBranch,n.pendingBranch&&!n.isHydrating&&n.effects.push(()=>{Zv(n.activeBranch,t)})}for(;e.component;)e=e.component.subTree;if(e.shapeFlag&1&&e.el)dp(e.el,t);else if(e.type===Kt)e.children.forEach(n=>Zv(n,t));else if(e.type===hl){let{el:n,anchor:r}=e;for(;n&&(dp(n,t),n!==r);)n=n.nextSibling}}function dp(e,t){if(e.nodeType===1){const n=e.style;let r="";for(const o in t){const i=ME(t[o]);n.setProperty(`--${o}`,i),r+=`--${o}: ${i};`}n[ay]=r}}function iT(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&&fp(r,a,"")}else for(const s in t)n[s]==null&&fp(r,s,"");for(const s in n)s==="display"&&(i=!0),fp(r,s,n[s])}else if(o){if(t!==n){const s=r[ay];s&&(n+=";"+s),r.cssText=n,i=AC.test(n)}}else t&&e.removeAttribute("style");yf in e&&(e[yf]=i?r.display:"",e[iy]&&(r.display="none"))}function fp(e,t,n){if(Nt(n))n.forEach(r=>fp(e,t,r));else if(n==null&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const r=sT(e,t);ly.test(n)?e.setProperty(Xo(r),n.replace(ly,""),"important"):e[r]=n}}function sT(e,t){const n=gp[t];if(n)return n;let r=Hr(t);if(r!=="filter"&&r in e)return gp[t]=r;r=tu(r);for(let o=0;o<cy.length;o++){const i=cy[o]+r;if(i in e)return gp[t]=i}return t}function sC(e,t,n,r,o,i=z2(t)){r&&t.startsWith("xlink:")?n==null?e.removeAttributeNS(uy,t.slice(6,t.length)):e.setAttributeNS(uy,t,n):n==null||i&&!T2(n)?e.removeAttribute(t):e.setAttribute(t,i?"":ui(n)?String(n):n)}function aC(e,t,n,r,o){if(t==="innerHTML"||t==="textContent"){n!=null&&(e[t]=t==="innerHTML"?Jv(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=T2(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 _a(e,t,n,r){e.addEventListener(t,n,r)}function aT(e,t,n,r){e.removeEventListener(t,n,r)}function lT(e,t,n,r,o=null){const i=e[dy]||(e[dy]={}),s=i[t];if(r&&s)s.value=r;else{const[a,l]=cT(t);r?_a(e,a,i[t]=uT(r,o),l):s&&(aT(e,a,s,l),i[t]=void 0)}}function cT(e){let t;if(fy.test(e)){t={};let n;for(;n=e.match(fy);)e=e.slice(0,e.length-n[0].length),t[n[0].toLowerCase()]=!0}return[e[2]===":"?e.slice(3):Xo(e.slice(2)),t]}function uT(e,t){const n=r=>{if(!r._vts)r._vts=Date.now();else if(r._vts<=n.attached)return;Vi(dT(r,n.value),t,5,[r])};return n.value=e,n.attached=EC(),n}function dT(e,t){if(Nt(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 fT(e,t,n,r){if(r)return!!(t==="innerHTML"||t==="textContent"||t in e&&hy(t)&&Yt(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 hy(t)&&Qn(n)?!1:t in e}function hT(e,t){const n=e._def.props;if(!n)return!1;const r=Hr(t);return Array.isArray(n)?n.some(o=>Hr(o)===r):Object.keys(n).some(o=>Hr(o)===r)}function lC(e,t,n){let r=ac(e,t);Fd(r)&&(r=Gn({},r,t));class o extends gy{constructor(s){super(r,s,n)}}return o.def=r,o}function cC(e){const t=vr(),n=t&&t.ce;return n||null}function pT(){const e=cC();return e&&e.shadowRoot}function mT(e="$style"){{const t=vr();if(!t)return Rn;const n=t.type.__cssModules;if(!n)return Rn;const r=n[e];return r||Rn}}function gT(e){const t=e.el;t[bf]&&t[bf](),t[by]&&t[by]()}function vT(e){yy.set(e,uC(e.el))}function yT(e){const t=vy.get(e),n=yy.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 uC(e){const t=e.getBoundingClientRect();return{left:t.left,top:t.top}}function bT(e,t,n){const r=e.cloneNode(),o=e[pc];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}=rC(r);return i.removeChild(r),s}function wT(e){e.target.composing=!0}function dC(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}function fC(e,t,n){return t&&(e=e.trim()),n&&(e=zd(e)),e}function hC(e,{value:t,oldValue:n},r){e._modelValue=t;let o;if(Nt(t))o=Eh(t,r.props.value)>-1;else if(il(t))o=t.has(r.props.value);else{if(t===n)return;o=da(t,mC(e,!0))}e.checked!==o&&(e.checked=o)}function pC(e,t){const n=e.multiple,r=Nt(t);if(!(n&&!r&&!il(t))){for(let o=0,i=e.options.length;o<i;o++){const s=e.options[o],a=wu(s);if(n)if(r){const l=typeof a;l==="string"||l==="number"?s.selected=t.some(c=>String(c)===String(a)):s.selected=Eh(t,a)>-1}else s.selected=t.has(a);else if(da(wu(s),t)){e.selectedIndex!==o&&(e.selectedIndex=o);return}}!n&&e.selectedIndex!==-1&&(e.selectedIndex=-1)}}function wu(e){return"_value"in e?e._value:e.value}function mC(e,t){const n=t?"_trueValue":"_falseValue";return n in e?e[n]:t}function gC(e,t){switch(e){case"SELECT":return wy;case"TEXTAREA":return ji;default:switch(t){case"checkbox":return yp;case"radio":return bp;default:return ji}}}function hp(e,t,n,r,o){const i=gC(e.tagName,n.props&&n.props.type)[o];i&&i(e,t,n,r)}function CT(){ji.getSSRProps=({value:e})=>({value:e}),bp.getSSRProps=({value:e},t)=>{if(t.props&&da(t.props.value,e))return{checked:!0}},yp.getSSRProps=({value:e},t)=>{if(Nt(e)){if(t.props&&Eh(e,t.props.value)>-1)return{checked:!0}}else if(il(e)){if(t.props&&e.has(t.props.value))return{checked:!0}}else if(e)return{checked:!0}},Cy.getSSRProps=(e,t)=>{if(typeof t.type!="string")return;const n=gC(t.type.toUpperCase(),t.props&&t.props.type);if(n.getSSRProps)return n.getSSRProps(e,t)}}function vC(){return wf||(wf=Q1(ky))}function yC(){return wf=Sy?wf:J1(ky),Sy=!0,wf}function bC(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function wC(e){return Qn(e)?document.querySelector(e):e}var pp,Qv,Jv,CC,kC,Fs,ey,ty,Aa,Cu,pc,ny,ry,SC,mp,vl,oy,_C,yf,iy,sy,ay,AC,ly,cy,gp,uy,dy,fy,vp,IC,EC,hy,py,my,TC,xC,gy,vy,yy,bf,by,RC,LC,Ia,Si,ji,yp,bp,wy,Cy,MC,DC,Zt,OC,pi,ky,wf,Sy,_y,PC,mc,Ay,Iy,FC,kT=Mr((()=>{if(Jw(),Jw(),Fg(),pp=void 0,Qv=typeof window<"u"&&window.trustedTypes,Qv)try{pp=Qv.createPolicy("vue",{createHTML:e=>e})}catch{}Jv=pp?e=>pp.createHTML(e):e=>e,CC="http://www.w3.org/2000/svg",kC="http://www.w3.org/1998/Math/MathML",Fs=typeof document<"u"?document:null,ey=Fs&&Fs.createElement("template"),ty={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"?Fs.createElementNS(CC,e):t==="mathml"?Fs.createElementNS(kC,e):n?Fs.createElement(e,{is:n}):Fs.createElement(e);return e==="select"&&r&&r.multiple!=null&&o.setAttribute("multiple",r.multiple),o},createText:e=>Fs.createTextNode(e),createComment:e=>Fs.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>Fs.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{ey.innerHTML=Jv(r==="svg"?`<svg>${e}</svg>`:r==="mathml"?`<math>${e}</math>`:e);const a=ey.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",Cu="animation",pc=Symbol("_vtc"),ny={name:String,type:String,css:{type:Boolean,default:!0},duration:[String,Number,Object],enterFromClass:String,enterActiveClass:String,enterToClass:String,appearFromClass:String,appearActiveClass:String,appearToClass:String,leaveFromClass:String,leaveActiveClass:String,leaveToClass:String},ry=Gn({},Jh,ny),SC=e=>(e.displayName="Transition",e.props=ry,e),mp=SC((e,{slots:t})=>Gr(Lv,eC(e),t)),vl=(e,t=[])=>{Nt(e)?e.forEach(n=>n(...t)):e&&e(...t)},oy=e=>e?Nt(e)?e.some(t=>t.length>1):e.length>1:!1,_C=0,yf=Symbol("_vod"),iy=Symbol("_vsh"),sy={name:"show",beforeMount(e,{value:t},{transition:n}){e[yf]=e.style.display==="none"?"":e.style.display,n&&t?n.beforeEnter(e):vf(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),vf(e,!0),r.enter(e)):r.leave(e,()=>{vf(e,!1)}):vf(e,t))},beforeUnmount(e,{value:t}){vf(e,t)}},ay=Symbol(""),AC=/(?:^|;)\s*display\s*:/,ly=/\s*!important$/,cy=["Webkit","Moz","ms"],gp={},uy="http://www.w3.org/1999/xlink",dy=Symbol("_vei"),fy=/(?:Once|Passive|Capture)$/,vp=0,IC=Promise.resolve(),EC=()=>vp||(IC.then(()=>vp=0),vp=Date.now()),hy=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,py=(e,t,n,r,o,i)=>{const s=o==="svg";t==="class"?nT(e,r,s):t==="style"?iT(e,n,r):eu(t)?Pd(t)||lT(e,t,n,r,i):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):fT(e,t,r,s))?(aC(e,t,r),!e.tagName.includes("-")&&(t==="value"||t==="checked"||t==="selected")&&sC(e,t,r,s,i,t!=="value")):e._isVueCE&&(hT(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!Qn(r)))?aC(e,Hr(t),r,i,t):(t==="true-value"?e._trueValue=r:t==="false-value"&&(e._falseValue=r),sC(e,t,r,s))},my={},TC=((e,t)=>lC(e,t,Ay)),xC=typeof HTMLElement<"u"?HTMLElement:class{},gy=class lE extends xC{constructor(t,n={},r=mc){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!==mc?this._root=this.shadowRoot:t.shadowRoot!==!1?(this.attachShadow(Gn({},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 lE){this._parent=t;break}this._instance||(this._resolved?this._mount(this._def):t&&t._pendingResolve?this._pendingResolve=t._pendingResolve.then(()=>{this._pendingResolve=void 0,this._resolveDef()}):this._resolveDef())}_setParent(t=this._parent){t&&(this._instance.parent=t._instance,this._inheritParentContext(t))}_inheritParentContext(t=this._parent){t&&this._app&&Object.setPrototypeOf(this._app._context.provides,t._instance.provides)}disconnectedCallback(){this._connected=!1,kt(()=>{this._connected||(this._ob&&(this._ob.disconnect(),this._ob=null),this._app&&this._app.unmount(),this._instance&&(this._instance.ce=void 0),this._app=this._instance=null,this._teleportTargets&&(this._teleportTargets.clear(),this._teleportTargets=void 0))})}_processMutations(t){for(const n of t)this._setAttr(n.attributeName)}_resolveDef(){if(this._pendingResolve)return;for(let r=0;r<this.attributes.length;r++)this._setAttr(this.attributes[r].name);this._ob=new MutationObserver(this._processMutations.bind(this)),this._ob.observe(this,{attributes:!0});const t=(r,o=!1)=>{this._resolved=!0,this._pendingResolve=void 0;const{props:i,styles:s}=r;let a;if(i&&!Nt(i))for(const l in i){const c=i[l];(c===Number||c&&c.type===Number)&&(l in this._props&&(this._props[l]=Vd(this._props[l])),(a||(a=Object.create(null)))[Hr(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)Un(this,r)||Object.defineProperty(this,r,{get:()=>et(n[r])})}_resolveProps(t){const{props:n}=t,r=Nt(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(Hr))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):my;const o=Hr(t);n&&this._numberProps&&this._numberProps[o]&&(r=Vd(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===my?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(Xo(t),""):typeof n=="string"||typeof n=="number"?this.setAttribute(Xo(t),n+""):n||this.removeAttribute(Xo(t)),i&&i.observe(this,{attributes:!0})}}_update(){const t=this._createVNode();this._app&&(t.appContext=this._app._context),_y(t,this._root)}_createVNode(){const t={};this.shadowRoot||(t.onVnodeMounted=t.onVnodeUpdated=this._renderSlots.bind(this));const n=qt(this._def,Gn(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,Fd(s[0])?Gn({detail:s},s[0]):{detail:s}))};r.emit=(i,...s)=>{o(i,s),Xo(i)!==i&&o(Xo(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){}},vy=new WeakMap,yy=new WeakMap,bf=Symbol("_moveCb"),by=Symbol("_enterCb"),RC=e=>(delete e.props.mode,e),LC=RC({name:"TransitionGroup",props:Gn({},ry,{tag:String,moveClass:String}),setup(e,{slots:t}){const n=vr(),r=iv();let o,i;return hf(()=>{if(!o.length)return;const s=e.moveClass||`${e.name||"v"}-move`;if(!bT(o[0].el,n.vnode.el,s)){o=[];return}o.forEach(gT),o.forEach(vT);const a=o.filter(yT);Xv(n.vnode.el),a.forEach(l=>{const c=l.el,d=c.style;Ps(c,s),d.transform=d.webkitTransform=d.transitionDuration="";const f=c[bf]=p=>{p&&p.target!==c||(!p||p.propertyName.endsWith("transform"))&&(c.removeEventListener("transitionend",f),c[bf]=null,gl(c,s))};c.addEventListener("transitionend",f)}),o=[]}),()=>{const s=gn(e),a=eC(s);let l=s.tag||Kt;if(o=[],i)for(let c=0;c<i.length;c++){const d=i[c];d.el&&d.el instanceof Element&&(o.push(d),ba(d,lu(d,a,r,n)),vy.set(d,uC(d.el)))}i=t.default?Uh(t.default()):[];for(let c=0;c<i.length;c++){const d=i[c];d.key!=null&&ba(d,lu(d,a,r,n))}return qt(l,null,i)}}}),Ia=e=>{const t=e.props["onUpdate:modelValue"]||!1;return Nt(t)?n=>oc(t,n):t},Si=Symbol("_assign"),ji={created(e,{modifiers:{lazy:t,trim:n,number:r}},o){e[Si]=Ia(o);const i=r||o.props&&o.props.type==="number";_a(e,t?"change":"input",s=>{s.target.composing||e[Si](fC(e.value,n,i))}),(n||i)&&_a(e,"change",()=>{e.value=fC(e.value,n,i)}),t||(_a(e,"compositionstart",wT),_a(e,"compositionend",dC),_a(e,"change",dC))},mounted(e,{value:t}){e.value=t??""},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:r,trim:o,number:i}},s){if(e[Si]=Ia(s),e.composing)return;const a=(i||e.type==="number")&&!/^0\d/.test(e.value)?zd(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)}},yp={deep:!0,created(e,t,n){e[Si]=Ia(n),_a(e,"change",()=>{const r=e._modelValue,o=wu(e),i=e.checked,s=e[Si];if(Nt(r)){const a=Eh(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(il(r)){const a=new Set(r);i?a.add(o):a.delete(o),s(a)}else s(mC(e,i))})},mounted:hC,beforeUpdate(e,t,n){e[Si]=Ia(n),hC(e,t,n)}},bp={created(e,{value:t},n){e.checked=da(t,n.props.value),e[Si]=Ia(n),_a(e,"change",()=>{e[Si](wu(e))})},beforeUpdate(e,{value:t,oldValue:n},r){e[Si]=Ia(r),t!==n&&(e.checked=da(t,r.props.value))}},wy={deep:!0,created(e,{value:t,modifiers:{number:n}},r){const o=il(t);_a(e,"change",()=>{const i=Array.prototype.filter.call(e.options,s=>s.selected).map(s=>n?zd(wu(s)):wu(s));e[Si](e.multiple?o?new Set(i):i:i[0]),e._assigning=!0,kt(()=>{e._assigning=!1})}),e[Si]=Ia(r)},mounted(e,{value:t}){pC(e,t)},beforeUpdate(e,t,n){e[Si]=Ia(n)},updated(e,{value:t}){e._assigning||pC(e,t)}},Cy={created(e,t,n){hp(e,t,n,null,"created")},mounted(e,t,n){hp(e,t,n,null,"mounted")},beforeUpdate(e,t,n,r){hp(e,t,n,r,"beforeUpdate")},updated(e,t,n,r){hp(e,t,n,r,"updated")}},MC=["ctrl","shift","alt","meta"],DC={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)=>MC.some(n=>e[`${n}Key`]&&!t.includes(n))},Zt=(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=DC[t[s]];if(a&&a(o,t))return}return e(o,...i)}))},OC={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},pi=(e,t)=>{const n=e._withKeys||(e._withKeys={}),r=t.join(".");return n[r]||(n[r]=(o=>{if(!("key"in o))return;const i=Xo(o.key);if(t.some(s=>s===i||OC[s]===i))return e(o)}))},ky=Gn({patchProp:py},ty),Sy=!1,_y=((...e)=>{vC().render(...e)}),PC=((...e)=>{yC().hydrate(...e)}),mc=((...e)=>{const t=vC().createApp(...e),{mount:n}=t;return t.mount=r=>{const o=wC(r);if(!o)return;const i=t._component;!Yt(i)&&!i.render&&!i.template&&(i.template=o.innerHTML),o.nodeType===1&&(o.textContent="");const s=n(o,!1,bC(o));return o instanceof Element&&(o.removeAttribute("v-cloak"),o.setAttribute("data-v-app","")),s},t}),Ay=((...e)=>{const t=yC().createApp(...e),{mount:n}=t;return t.mount=r=>{const o=wC(r);if(o)return n(o,!0,bC(o))},t}),Iy=!1,FC=()=>{Iy||(Iy=!0,CT(),rT())}})),ST=Dd({BaseTransition:()=>Lv,BaseTransitionPropsValidators:()=>Jh,Comment:()=>Dr,DeprecationTypes:()=>null,EffectScope:()=>Fh,ErrorCodes:()=>gw,ErrorTypeStrings:()=>Yw,Fragment:()=>Kt,KeepAlive:()=>Lw,ReactiveEffect:()=>ou,Static:()=>hl,Suspense:()=>Hw,Teleport:()=>dl,Text:()=>Sa,TrackOpTypes:()=>y1,Transition:()=>mp,TransitionGroup:()=>LC,TriggerOpTypes:()=>b1,VueElement:()=>gy,assertNumber:()=>QE,callWithAsyncErrorHandling:()=>Vi,callWithErrorHandling:()=>au,camelize:()=>Hr,capitalize:()=>tu,cloneVNode:()=>Ls,compatUtils:()=>null,compile:()=>NC,computed:()=>Ce,createApp:()=>mc,createBlock:()=>rn,createCommentVNode:()=>mt,createElementBlock:()=>Me,createElementVNode:()=>He,createHydrationRenderer:()=>J1,createPropsRestProxy:()=>A5,createRenderer:()=>Q1,createSSRApp:()=>Ay,createSlots:()=>p5,createStaticVNode:()=>W5,createTextVNode:()=>ts,createVNode:()=>qt,customRef:()=>X2,defineAsyncComponent:()=>D1,defineComponent:()=>ac,defineCustomElement:()=>lC,defineEmits:()=>v5,defineExpose:()=>y5,defineModel:()=>C5,defineOptions:()=>b5,defineProps:()=>g5,defineSSRCustomElement:()=>TC,defineSlots:()=>w5,devtools:()=>Xw,effect:()=>PE,effectScope:()=>Ng,getCurrentInstance:()=>vr,getCurrentScope:()=>Bg,getCurrentWatcher:()=>KE,getTransitionRawChildren:()=>Uh,guardReactiveProps:()=>cw,h:()=>Gr,handleError:()=>sc,hasInjectionContext:()=>A1,hydrate:()=>PC,hydrateOnIdle:()=>Ew,hydrateOnInteraction:()=>Rw,hydrateOnMediaQuery:()=>xw,hydrateOnVisible:()=>Tw,initCustomFormatter:()=>X5,initDirectivesForSSR:()=>FC,inject:()=>ll,isMemoSame:()=>mw,isProxy:()=>Hd,isReactive:()=>Ni,isReadonly:()=>xs,isRef:()=>dr,isRuntimeOnly:()=>Ww,isShallow:()=>di,isVNode:()=>wa,markRaw:()=>ro,mergeDefaults:()=>S5,mergeModels:()=>_5,mergeProps:()=>Ms,nextTick:()=>kt,nodeOps:()=>ty,normalizeClass:()=>Qt,normalizeProps:()=>Tg,normalizeStyle:()=>bn,onActivated:()=>lv,onBeforeMount:()=>Ov,onBeforeUnmount:()=>fr,onBeforeUpdate:()=>ep,onDeactivated:()=>cv,onErrorCaptured:()=>P1,onMounted:()=>zn,onRenderTracked:()=>Nv,onRenderTriggered:()=>Fv,onScopeDispose:()=>V2,onServerPrefetch:()=>Pv,onUnmounted:()=>pf,onUpdated:()=>hf,onWatcherCleanup:()=>J2,openBlock:()=>ye,patchProp:()=>py,popScopeId:()=>n5,provide:()=>_1,proxyRefs:()=>Gg,pushScopeId:()=>t5,queuePostFlushCb:()=>Zd,reactive:()=>no,readonly:()=>Oh,ref:()=>te,registerRuntimeCompiler:()=>q5,render:()=>_y,renderList:()=>ar,renderSlot:()=>uu,resolveComponent:()=>h5,resolveDirective:()=>F1,resolveDynamicComponent:()=>dv,resolveFilter:()=>null,resolveTransitionHooks:()=>lu,setBlockTracking:()=>sf,setDevtoolsHook:()=>Zw,setTransitionHooks:()=>ba,shallowReactive:()=>q2,shallowReadonly:()=>HE,shallowRef:()=>$r,ssrContextKey:()=>_v,ssrUtils:()=>Qw,stop:()=>FE,toDisplayString:()=>zt,toHandlerKey:()=>nu,toHandlers:()=>m5,toRaw:()=>gn,toRef:()=>Wg,toRefs:()=>Z2,toValue:()=>GE,transformVNodeArgs:()=>$5,triggerRef:()=>$E,unref:()=>et,useAttrs:()=>z1,useCssModule:()=>mT,useCssVars:()=>oT,useHost:()=>cC,useId:()=>a5,useModel:()=>M5,useSSRContext:()=>Av,useShadowRoot:()=>pT,useSlots:()=>B1,useTemplateRef:()=>l5,useTransitionState:()=>iv,vModelCheckbox:()=>yp,vModelDynamic:()=>Cy,vModelRadio:()=>bp,vModelSelect:()=>wy,vModelText:()=>ji,vShow:()=>sy,version:()=>qv,warn:()=>qw,watch:()=>Bt,watchEffect:()=>r5,watchPostEffect:()=>o5,watchSyncEffect:()=>I1,withAsyncContext:()=>I5,withCtx:()=>co,withDefaults:()=>k5,withDirectives:()=>ya,withKeys:()=>pi,withMemo:()=>Z5,withModifiers:()=>Zt,withScopeId:()=>yw}),NC,Rt=Mr((()=>{kT(),NC=()=>{}})),_T=A2(((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 p=new Error("Cannot find module '"+c+"'");throw p.code="MODULE_NOT_FOUND",p}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,p,g,m,v,k=[],C=0,S=l.length,w=S,b=i.getTypeOf(l)!=="string";C<l.length;)w=S-C,f=b?(c=l[C++],d=C<S?l[C++]:0,C<S?l[C++]:0):(c=l.charCodeAt(C++),d=C<S?l.charCodeAt(C++):0,C<S?l.charCodeAt(C++):0),p=c>>2,g=(3&c)<<4|d>>4,m=1<w?(15&d)<<2|f>>6:64,v=2<w?63&f:64,k.push(a.charAt(p)+a.charAt(g)+a.charAt(m)+a.charAt(v));return k.join("")},o.decode=function(l){var c,d,f,p,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 S,w=3*(l=l.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(l.charAt(l.length-1)===a.charAt(64)&&w--,l.charAt(l.length-2)===a.charAt(64)&&w--,w%1!=0)throw new Error("Invalid base64 input, bad content length.");for(S=s.uint8array?new Uint8Array(0|w):new Array(0|w);v<l.length;)c=a.indexOf(l.charAt(v++))<<2|(p=a.indexOf(l.charAt(v++)))>>4,d=(15&p)<<4|(g=a.indexOf(l.charAt(v++)))>>2,f=(3&g)<<6|(m=a.indexOf(l.charAt(v++))),S[k++]=c,g!==64&&(S[k++]=d),m!==64&&(S[k++]=f);return S}},{"./support":30,"./utils":32}],2:[function(n,r,o){"use strict";var i=n("./external"),s=n("./stream/DataWorker"),a=n("./stream/Crc32Probe"),l=n("./stream/DataLengthProbe");function c(d,f,p,g,m){this.compressedSize=d,this.uncompressedSize=f,this.crc32=p,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,p){return d.pipe(new a).pipe(new l("uncompressedSize")).pipe(f.compressWorker(p)).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,p){var g=s,m=p+f;c^=-1;for(var v=p;v<m;v++)c=c>>>8^g[255&(c^d[v])];return-1^c})(0|l,a,a.length,0):(function(c,d,f,p){var g=s,m=p+f;c^=-1;for(var v=p;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,p){l.call(this,"FlateWorker/"+f),this._pako=null,this._pakoAction=f,this._pakoOptions=p,this.meta={}}o.magic="\b\0",a.inherits(d,l),d.prototype.processChunk=function(f){this.meta=f.meta,this._pako===null&&this._createPako(),this._pako.push(a.transformTo(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(p){f.push({data:p,meta:f.meta})}},o.compressWorker=function(f){return new d("Deflate",f)},o.uncompressWorker=function(){return new d("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(n,r,o){"use strict";function i(g,m){var v,k="";for(v=0;v<m;v++)k+=String.fromCharCode(255&g),g>>>=8;return k}function s(g,m,v,k,C,S){var w,b,T=g.file,L=g.compression,N=S!==c.utf8encode,H=a.transformTo("string",S(T.name)),z=a.transformTo("string",c.utf8encode(T.name)),B=T.comment,Z=a.transformTo("string",S(B)),R=a.transformTo("string",c.utf8encode(B)),K=z.length!==T.name.length,x=R.length!==B.length,W="",$="",ee="",Q=T.dir,X=T.date,we={crc32:0,compressedSize:0,uncompressedSize:0};m&&!v||(we.crc32=g.crc32,we.compressedSize=g.compressedSize,we.uncompressedSize=g.uncompressedSize);var ce=0;m&&(ce|=8),N||!K&&!x||(ce|=2048);var be=0,ve=0;Q&&(be|=16),C==="UNIX"?(ve=798,be|=(function(Pe,Ze){var at=Pe;return Pe||(at=Ze?16893:33204),(65535&at)<<16})(T.unixPermissions,Q)):(ve=20,be|=(function(Pe){return 63&(Pe||0)})(T.dosPermissions)),w=X.getUTCHours(),w<<=6,w|=X.getUTCMinutes(),w<<=5,w|=X.getUTCSeconds()/2,b=X.getUTCFullYear()-1980,b<<=4,b|=X.getUTCMonth()+1,b<<=5,b|=X.getUTCDate(),K&&($=i(1,1)+i(d(H),4)+z,W+="up"+i($.length,2)+$),x&&(ee=i(1,1)+i(d(Z),4)+R,W+="uc"+i(ee.length,2)+ee);var Ee="";return Ee+=`
|
|
4
|
-
\0`,Ee+=i(ce,2),Ee+=L.magic,Ee+=i(w,2),Ee+=i(b,2),Ee+=i(we.crc32,4),Ee+=i(we.compressedSize,4),Ee+=i(we.uncompressedSize,4),Ee+=i(H.length,2),Ee+=i(W.length,2),{fileRecord:f.LOCAL_FILE_HEADER+Ee+H+W,dirRecord:f.CENTRAL_FILE_HEADER+i(ve,2)+Ee+i(Z.length,2)+"\0\0\0\0"+i(be,4)+i(k,4)+H+W+Z}}var a=n("../utils"),l=n("../stream/GenericWorker"),c=n("../utf8"),d=n("../crc32"),f=n("../signature");function p(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(p,l),p.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}}))},p.prototype.openedSource=function(g){this.currentSourceOffset=this.bytesWritten,this.currentFile=g.file.name;var m=this.streamFiles&&!g.file.dir;if(m){var v=s(g,m,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:v.fileRecord,meta:{percent:0}})}else this.accumulate=!0},p.prototype.closedSource=function(g){this.accumulate=!1;var m=this.streamFiles&&!g.file.dir,v=s(g,m,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(v.dirRecord),m)this.push({data:(function(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},p.prototype.flush=function(){for(var g=this.bytesWritten,m=0;m<this.dirRecords.length;m++)this.push({data:this.dirRecords[m],meta:{percent:100}});var v=this.bytesWritten-g,k=(function(C,S,w,b,T){var L=a.transformTo("string",T(b));return f.CENTRAL_DIRECTORY_END+"\0\0\0\0"+i(C,2)+i(C,2)+i(S,4)+i(w,4)+i(L.length,2)+L})(this.dirRecords.length,v,g,this.zipComment,this.encodeFileName);this.push({data:k,meta:{percent:100}})},p.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},p.prototype.registerPrevious=function(g){this._sources.push(g);var m=this;return g.on("data",function(v){m.processChunk(v)}),g.on("end",function(){m.closedSource(m.previous.streamInfo),m._sources.length?m.prepareNextSource():m.end()}),g.on("error",function(v){m.error(v)}),this},p.prototype.resume=function(){return!!l.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},p.prototype.error=function(g){var m=this._sources;if(!l.prototype.error.call(this,g))return!1;for(var v=0;v<m.length;v++)try{m[v].error(g)}catch{}return!0},p.prototype.lock=function(){l.prototype.lock.call(this);for(var g=this._sources,m=0;m<g.length;m++)g[m].lock()},r.exports=p},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(n,r,o){"use strict";var i=n("../compressions"),s=n("./ZipFileWorker");o.generateWorker=function(a,l,c){var d=new s(l.streamFiles,c,l.platform,l.encodeFileName),f=0;try{a.forEach(function(p,g){f++;var m=(function(S,w){var b=S||w,T=i[b];if(!T)throw new Error(b+" 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:p,dir:k,date:C,comment:g.comment||"",unixPermissions:g.unixPermissions,dosPermissions:g.dosPermissions}).pipe(d)}),d.entriesCount=f}catch(p){d.error(p)}return d}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(n,r,o){"use strict";function i(){if(!(this instanceof i))return new i;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var s=new i;for(var a in this)typeof this[a]!="function"&&(s[a]=this[a]);return s}}(i.prototype=n("./object")).loadAsync=n("./load"),i.support=n("./support"),i.defaults=n("./defaults"),i.version="3.10.1",i.loadAsync=function(s,a){return new i().loadAsync(s,a)},i.external=n("./external"),r.exports=i},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(n,r,o){"use strict";var i=n("./utils"),s=n("./external"),a=n("./utf8"),l=n("./zipEntries"),c=n("./stream/Crc32Probe"),d=n("./nodejsUtils");function f(p){return new s.Promise(function(g,m){var v=p.decompressed.getContentWorker().pipe(new c);v.on("error",function(k){m(k)}).on("end",function(){v.streamInfo.crc32!==p.decompressed.crc32?m(new Error("Corrupted zip : CRC32 mismatch")):g()}).resume()})}r.exports=function(p,g){var m=this;return g=i.extend(g||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:a.utf8decode}),d.isNode&&d.isStream(p)?s.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):i.prepareContent("the loaded zip file",p,!0,g.optimizedBinaryString,g.base64).then(function(v){var 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 S=0;S<C.length;S++)k.push(f(C[S]));return s.Promise.all(k)}).then(function(v){for(var k=v.shift(),C=k.files,S=0;S<C.length;S++){var w=C[S],b=w.fileNameStr,T=i.resolve(w.fileNameStr);m.file(T,w.decompressed,{binary:!0,optimizedBinaryString:!0,date:w.date,dir:w.dir,comment:w.fileCommentStr.length?w.fileCommentStr:null,unixPermissions:w.unixPermissions,dosPermissions:w.dosPermissions,createFolders:g.createFolders}),w.dir||(m.file(T).unsafeOriginalName=b)}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,p){d.push(f)||d._helper.pause(),c&&c(p)}).on("error",function(f){d.emit("error",f)}).on("end",function(){d.push(null)})}n("../utils").inherits(s,i),s.prototype._read=function(){this._helper.resume()},r.exports=s},{"../utils":32,"readable-stream":16}],14:[function(n,r,o){"use strict";r.exports={isNode:typeof Buffer<"u",newBufferFrom:function(i,s){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(i,s);if(typeof i=="number")throw new Error('The "data" argument must not be a number');return new Buffer(i,s)},allocBuffer:function(i){if(Buffer.alloc)return Buffer.alloc(i);var s=new Buffer(i);return s.fill(0),s},isBuffer:function(i){return Buffer.isBuffer(i)},isStream:function(i){return i&&typeof i.on=="function"&&typeof i.pause=="function"&&typeof i.resume=="function"}}},{}],15:[function(n,r,o){"use strict";function i(b,T,L){var N,H=a.getTypeOf(T),z=a.extend(L||{},d);z.date=z.date||new Date,z.compression!==null&&(z.compression=z.compression.toUpperCase()),typeof z.unixPermissions=="string"&&(z.unixPermissions=parseInt(z.unixPermissions,8)),z.unixPermissions&&16384&z.unixPermissions&&(z.dir=!0),z.dosPermissions&&16&z.dosPermissions&&(z.dir=!0),z.dir&&(b=C(b)),z.createFolders&&(N=k(b))&&S.call(this,N,!0);var B=H==="string"&&z.binary===!1&&z.base64===!1;L&&L.binary!==void 0||(z.binary=!B),(T instanceof f&&T.uncompressedSize===0||z.dir||!T||T.length===0)&&(z.base64=!1,z.binary=!0,T="",z.compression="STORE",H="string");var Z=null;Z=T instanceof f||T instanceof l?T:m.isNode&&m.isStream(T)?new v(b,T):a.prepareContent(b,T,z.binary,z.optimizedBinaryString,z.base64);var R=new p(b,Z,z);this.files[b]=R}var s=n("./utf8"),a=n("./utils"),l=n("./stream/GenericWorker"),c=n("./stream/StreamHelper"),d=n("./defaults"),f=n("./compressedObject"),p=n("./zipObject"),g=n("./generate"),m=n("./nodejsUtils"),v=n("./nodejs/NodejsStreamInputAdapter"),k=function(b){b.slice(-1)==="/"&&(b=b.substring(0,b.length-1));var T=b.lastIndexOf("/");return 0<T?b.substring(0,T):""},C=function(b){return b.slice(-1)!=="/"&&(b+="/"),b},S=function(b,T){return T=T!==void 0?T:d.createFolders,b=C(b),this.files[b]||i.call(this,b,null,{dir:!0,createFolders:T}),this.files[b]};function w(b){return Object.prototype.toString.call(b)==="[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(b){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&&b(L,N)},filter:function(b){var T=[];return this.forEach(function(L,N){b(L,N)&&T.push(N)}),T},file:function(b,T,L){if(arguments.length!==1)return b=this.root+b,i.call(this,b,T,L),this;if(w(b)){var N=b;return this.filter(function(z,B){return!B.dir&&N.test(z)})}var H=this.files[this.root+b];return H&&!H.dir?H:null},folder:function(b){if(!b)return this;if(w(b))return this.filter(function(H,z){return z.dir&&b.test(H)});var T=this.root+b,L=S.call(this,T),N=this.clone();return N.root=L.name,N},remove:function(b){b=this.root+b;var T=this.files[b];if(T||(b.slice(-1)!=="/"&&(b+="/"),T=this.files[b]),T&&!T.dir)delete this.files[b];else for(var L=this.filter(function(H,z){return z.name.slice(0,b.length)===b}),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(b){var T,L={};try{if((L=a.extend(b||{},{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(b,T){return this.generateInternalStream(b).accumulate(T)},generateNodeStream:function(b,T){return(b=b||{}).type||(b.type="nodebuffer"),this.generateInternalStream(b).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),p=this.length-4;0<=p;--p)if(this.data[p]===l&&this.data[p+1]===c&&this.data[p+2]===d&&this.data[p+3]===f)return p-this.zero;return-1},s.prototype.readAndCheckSignature=function(a){var l=a.charCodeAt(0),c=a.charCodeAt(1),d=a.charCodeAt(2),f=a.charCodeAt(3),p=this.readData(4);return l===p[0]&&c===p[1]&&d===p[2]&&f===p[3]},s.prototype.readData=function(a){if(this.checkOffset(a),a===0)return[];var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=s},{"../utils":32,"./DataReader":18}],18:[function(n,r,o){"use strict";var i=n("../utils");function s(a){this.data=a,this.length=a.length,this.index=0,this.zero=0}s.prototype={checkOffset:function(a){this.checkIndex(this.index+a)},checkIndex:function(a){if(this.length<this.zero+a||a<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+a+"). Corrupted zip ?")},setIndex:function(a){this.checkIndex(a),this.index=a},skip:function(a){this.setIndex(this.index+a)},byteAt:function(){},readInt:function(a){var l,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 p=i.getTypeOf(f);return i.checkSupport(p),p!=="string"||s.uint8array?p==="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 p(m,v){return new d.Promise(function(k,C){var S=[],w=m._internalType,b=m._outputType,T=m._mimeType;m.on("data",function(L,N){S.push(L),v&&v(N)}).on("error",function(L){S=[],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)}})(b,(function(L,N){var H,z=0,B=null,Z=0;for(H=0;H<N.length;H++)Z+=N[H].length;switch(L){case"string":return N.join("");case"array":return Array.prototype.concat.apply([],N);case"uint8array":for(B=new Uint8Array(Z),H=0;H<N.length;H++)B.set(N[H],z),z+=N[H].length;return B;case"nodebuffer":return Buffer.concat(N);default:throw new Error("concat : unsupported type '"+L+"'")}})(w,S),T))}catch(L){C(L)}S=[]}).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(S){this._worker=new a("error"),this._worker.error(S)}}g.prototype={accumulate:function(m){return p(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 p(){l.call(this,"utf-8 encode")}o.utf8encode=function(g){return s.nodebuffer?a.newBufferFrom(g,"utf-8"):(function(m){var v,k,C,S,w,b=m.length,T=0;for(S=0;S<b;S++)(64512&(k=m.charCodeAt(S)))==55296&&S+1<b&&(64512&(C=m.charCodeAt(S+1)))==56320&&(k=65536+(k-55296<<10)+(C-56320),S++),T+=k<128?1:k<2048?2:k<65536?3:4;for(v=s.uint8array?new Uint8Array(T):new Array(T),S=w=0;w<T;S++)(64512&(k=m.charCodeAt(S)))==55296&&S+1<b&&(64512&(C=m.charCodeAt(S+1)))==56320&&(k=65536+(k-55296<<10)+(C-56320),S++),k<128?v[w++]=k:(k<2048?v[w++]=192|k>>>6:(k<65536?v[w++]=224|k>>>12:(v[w++]=240|k>>>18,v[w++]=128|k>>>12&63),v[w++]=128|k>>>6&63),v[w++]=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,S,w=m.length,b=new Array(2*w);for(v=k=0;v<w;)if((C=m[v++])<128)b[k++]=C;else if(4<(S=c[C]))b[k++]=65533,v+=S-1;else{for(C&=S===2?31:S===3?15:7;1<S&&v<w;)C=C<<6|63&m[v++],S--;1<S?b[k++]=65533:C<65536?b[k++]=C:(C-=65536,b[k++]=55296|C>>10&1023,b[k++]=56320|1023&C)}return b.length!==k&&(b.subarray?b=b.subarray(0,k):b.length=k),i.applyFromCharCode(b)})(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(S,w){var b;for((w=w||S.length)>S.length&&(w=S.length),b=w-1;0<=b&&(192&S[b])==128;)b--;return b<0||b===0?w:b+c[S[b]]>w?b:w})(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(p,l),p.prototype.processChunk=function(g){this.push({data:o.utf8encode(g.data),meta:g.meta})},o.Utf8EncodeWorker=p},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(n,r,o){"use strict";var i=n("./support"),s=n("./base64"),a=n("./nodejsUtils"),l=n("./external");function 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 S=[],w=0,b=v.length;if(b<=C)return String.fromCharCode.apply(null,v);for(;w<b;)k==="array"||k==="nodebuffer"?S.push(String.fromCharCode.apply(null,v.slice(w,Math.min(w+C,b)))):S.push(String.fromCharCode.apply(null,v.subarray(w,Math.min(w+C,b)))),w+=C;return S.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 p(v){var k=65536,C=o.getTypeOf(v),S=!0;if(C==="uint8array"?S=f.applyCanBeUsed.uint8array:C==="nodebuffer"&&(S=f.applyCanBeUsed.nodebuffer),S)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=p;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:p,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 p(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:p,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:p,array:function(v){return g(v,new Array(v.length))},arraybuffer:function(v){return m.nodebuffer.uint8array(v).buffer},uint8array:function(v){return g(v,new Uint8Array(v.length))},nodebuffer: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=[],S=0;S<k.length;S++){var w=k[S];w==="."||w===""&&S!==0&&S!==k.length-1||(w===".."?C.pop():C.push(w))}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,S="";for(C=0;C<(v||"").length;C++)S+="\\x"+((k=v.charCodeAt(C))<16?"0":"")+k.toString(16).toUpperCase();return S},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,S,w){return l.Promise.resolve(k).then(function(b){return i.blob&&(b instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(b))!==-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(b)}):b}).then(function(b){var T=o.getTypeOf(b);return T?(T==="arraybuffer"?b=o.transformTo("uint8array",b):T==="string"&&(w?b=s.decode(b):C&&S!==!0&&(b=(function(L){return d(L,i.uint8array?new Uint8Array(L.length):new Array(L.length))})(b))),b):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 p=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+s.pretty(p)+", expected "+s.pretty(f)+")")}},isSignature:function(f,p){var g=this.reader.index;this.reader.setIndex(f);var m=this.reader.readString(4)===p;return this.reader.setIndex(g),m},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var f=this.reader.readData(this.zipCommentLength),p=c.uint8array?"uint8array":"array",g=s.transformTo(p,f);this.zipComment=this.loadOptions.decodeFileName(g)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var f,p,g,m=this.zip64EndOfCentralSize-44;0<m;)f=this.reader.readInt(2),p=this.reader.readInt(4),g=this.reader.readData(p),this.zip64ExtensibleData[f]={id:f,length:p,value:g}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var f,p;for(f=0;f<this.files.length;f++)p=this.files[f],this.reader.setIndex(p.localHeaderOffset),this.checkSignature(a.LOCAL_FILE_HEADER),p.readLocalPart(this.reader),p.handleUTF8(),p.processAttributes()},readCentralDir:function(){var f;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(a.CENTRAL_FILE_HEADER);)(f=new l({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(f);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var f=this.reader.lastIndexOfSignature(a.CENTRAL_DIRECTORY_END);if(f<0)throw this.isSignature(0,a.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(f);var p=f;if(this.checkSignature(a.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===s.MAX_VALUE_16BITS||this.diskWithCentralDirStart===s.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===s.MAX_VALUE_16BITS||this.centralDirRecords===s.MAX_VALUE_16BITS||this.centralDirSize===s.MAX_VALUE_32BITS||this.centralDirOffset===s.MAX_VALUE_32BITS){if(this.zip64=!0,(f=this.reader.lastIndexOfSignature(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(f),this.checkSignature(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,a.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(a.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(a.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var g=this.centralDirOffset+this.centralDirSize;this.zip64&&(g+=20,g+=12+this.zip64EndOfCentralSize);var m=p-g;if(0<m)this.isSignature(p,a.CENTRAL_FILE_HEADER)||(this.reader.zero=m);else if(m<0)throw new Error("Corrupted zip: missing "+Math.abs(m)+" bytes.")},prepareReader:function(f){this.reader=i(f)},load:function(f){this.prepareReader(f),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},r.exports=d},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(n,r,o){"use strict";var i=n("./reader/readerFor"),s=n("./utils"),a=n("./compressedObject"),l=n("./crc32"),c=n("./utf8"),d=n("./compressions"),f=n("./support");function p(g,m){this.options=g,this.loadOptions=m}p.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(g){var m,v;if(g.skip(22),this.fileNameLength=g.readInt(2),v=g.readInt(2),this.fileName=g.readData(this.fileNameLength),g.skip(v),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if((m=(function(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=p},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(n,r,o){"use strict";function i(m,v,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 S=!this._dataBinary;S&&!C&&(v=v.pipe(new l.Utf8EncodeWorker)),!S&&C&&(v=v.pipe(new l.Utf8DecodeWorker))}catch(w){(v=new d("error")).error(w)}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"],p=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},g=0;g<f.length;g++)i.prototype[f[g]]=p;r.exports=i},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(n,r,o){(function(i){"use strict";var s,a,l=i.MutationObserver||i.WebKitMutationObserver;if(l){var 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 p=new i.MessageChannel;p.port1.onmessage=m,s=function(){p.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 p(C,S,w){this.promise=C,typeof S=="function"&&(this.onFulfilled=S,this.callFulfilled=this.otherCallFulfilled),typeof w=="function"&&(this.onRejected=w,this.callRejected=this.otherCallRejected)}function g(C,S,w){i(function(){var b;try{b=S(w)}catch(T){return a.reject(C,T)}b===C?a.reject(C,new TypeError("Cannot resolve promise with itself")):a.resolve(C,b)})}function m(C){var S=C&&C.then;if(C&&(typeof C=="object"||typeof C=="function")&&typeof S=="function")return function(){S.apply(C,arguments)}}function v(C,S){var w=!1;function b(N){w||(w=!0,a.reject(C,N))}function T(N){w||(w=!0,a.resolve(C,N))}var L=k(function(){S(T,b)});L.status==="error"&&b(L.value)}function k(C,S){var w={};try{w.value=C(S),w.status="success"}catch(b){w.status="error",w.value=b}return w}(r.exports=f).prototype.finally=function(C){if(typeof C!="function")return this;var S=this.constructor;return this.then(function(w){return S.resolve(C()).then(function(){return w})},function(w){return S.resolve(C()).then(function(){throw w})})},f.prototype.catch=function(C){return this.then(null,C)},f.prototype.then=function(C,S){if(typeof C!="function"&&this.state===c||typeof S!="function"&&this.state===l)return this;var w=new this.constructor(s);return this.state!==d?g(w,this.state===c?C:S,this.outcome):this.queue.push(new p(w,C,S)),w},p.prototype.callFulfilled=function(C){a.resolve(this.promise,C)},p.prototype.otherCallFulfilled=function(C){g(this.promise,this.onFulfilled,C)},p.prototype.callRejected=function(C){a.reject(this.promise,C)},p.prototype.otherCallRejected=function(C){g(this.promise,this.onRejected,C)},a.resolve=function(C,S){var w=k(m,S);if(w.status==="error")return a.reject(C,w.value);var b=w.value;if(b)v(C,b);else{C.state=c,C.outcome=S;for(var T=-1,L=C.queue.length;++T<L;)C.queue[T].callFulfilled(S)}return C},a.reject=function(C,S){C.state=l,C.outcome=S;for(var w=-1,b=C.queue.length;++w<b;)C.queue[w].callRejected(S);return C},f.resolve=function(C){return C instanceof this?C:a.resolve(new this(s),C)},f.reject=function(C){var S=new this(s);return a.reject(S,C)},f.all=function(C){var S=this;if(Object.prototype.toString.call(C)!=="[object Array]")return this.reject(new TypeError("must be an array"));var w=C.length,b=!1;if(!w)return this.resolve([]);for(var T=new Array(w),L=0,N=-1,H=new this(s);++N<w;)z(C[N],N);return H;function z(B,Z){S.resolve(B).then(function(R){T[Z]=R,++L!==w||b||(b=!0,a.resolve(H,T))},function(R){b||(b=!0,a.reject(H,R))})}},f.race=function(C){var S=this;if(Object.prototype.toString.call(C)!=="[object Array]")return this.reject(new TypeError("must be an array"));var w=C.length,b=!1;if(!w)return this.resolve([]);for(var T=-1,L=new this(s);++T<w;)N=C[T],S.resolve(N).then(function(H){b||(b=!0,a.resolve(L,H))},function(H){b||(b=!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,p=-1,g=0,m=8;function v(C){if(!(this instanceof v))return new v(C);this.options=s.assign({level:p,method:m,chunkSize:16384,windowBits:15,memLevel:8,strategy:g,to:""},C||{});var S=this.options;S.raw&&0<S.windowBits?S.windowBits=-S.windowBits:S.gzip&&0<S.windowBits&&S.windowBits<16&&(S.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new c,this.strm.avail_out=0;var w=i.deflateInit2(this.strm,S.level,S.method,S.windowBits,S.memLevel,S.strategy);if(w!==f)throw new Error(l[w]);if(S.header&&i.deflateSetHeader(this.strm,S.header),S.dictionary){var b;if(b=typeof S.dictionary=="string"?a.string2buf(S.dictionary):d.call(S.dictionary)==="[object ArrayBuffer]"?new Uint8Array(S.dictionary):S.dictionary,(w=i.deflateSetDictionary(this.strm,b))!==f)throw new Error(l[w]);this._dict_set=!0}}function k(C,S){var w=new v(S);if(w.push(C,!0),w.err)throw w.msg||l[w.err];return w.result}v.prototype.push=function(C,S){var w,b,T=this.strm,L=this.options.chunkSize;if(this.ended)return!1;b=S===~~S?S:S===!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),(w=i.deflate(T,b))!==1&&w!==f)return this.onEnd(w),!(this.ended=!0);T.avail_out!==0&&(T.avail_in!==0||b!==4&&b!==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)&&w!==1);return b===4?(w=i.deflateEnd(this.strm),this.onEnd(w),this.ended=!0,w===f):b!==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,S){return(S=S||{}).raw=!0,k(C,S)},o.gzip=function(C,S){return(S=S||{}).gzip=!0,k(C,S)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(n,r,o){"use strict";var i=n("./zlib/inflate"),s=n("./utils/common"),a=n("./utils/strings"),l=n("./zlib/constants"),c=n("./zlib/messages"),d=n("./zlib/zstream"),f=n("./zlib/gzheader"),p=Object.prototype.toString;function g(v){if(!(this instanceof g))return new g(v);this.options=s.assign({chunkSize:16384,windowBits:0,to:""},v||{});var 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,S,w,b,T,L,N=this.strm,H=this.options.chunkSize,z=this.options.dictionary,B=!1;if(this.ended)return!1;S=k===~~k?k:k===!0?l.Z_FINISH:l.Z_NO_FLUSH,typeof v=="string"?N.input=a.binstring2buf(v):p.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&&z&&(L=typeof z=="string"?a.string2buf(z):p.call(z)==="[object ArrayBuffer]"?new Uint8Array(z):z,C=i.inflateSetDictionary(this.strm,L)),C===l.Z_BUF_ERROR&&B===!0&&(C=l.Z_OK,B=!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||S!==l.Z_FINISH&&S!==l.Z_SYNC_FLUSH)||(this.options.to==="string"?(w=a.utf8border(N.output,N.next_out),b=N.next_out-w,T=a.buf2string(N.output,w),N.next_out=b,N.avail_out=H-b,b&&s.arraySet(N.output,N.output,w,b,0),this.onData(T)):this.onData(s.shrinkBuf(N.output,N.next_out)))),N.avail_in===0&&N.avail_out===0&&(B=!0)}while((0<N.avail_in||N.avail_out===0)&&C!==l.Z_STREAM_END);return C===l.Z_STREAM_END&&(S=l.Z_FINISH),S===l.Z_FINISH?(C=i.inflateEnd(this.strm),this.onEnd(C),this.ended=!0,C===l.Z_OK):S!==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,p){if(c.subarray&&l.subarray)l.set(c.subarray(d,d+f),p);else for(var g=0;g<f;g++)l[p+g]=c[d+g]},flattenChunks:function(l){var c,d,f,p,g,m;for(c=f=0,d=l.length;c<d;c++)f+=l[c].length;for(m=new Uint8Array(f),c=p=0,d=l.length;c<d;c++)g=l[c],m.set(g,p),p+=g.length;return m}},a={arraySet:function(l,c,d,f,p){for(var g=0;g<f;g++)l[p+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,p){if(p<65537&&(f.subarray&&a||!f.subarray&&s))return String.fromCharCode.apply(null,i.shrinkBuf(f,p));for(var g="",m=0;m<p;m++)g+=String.fromCharCode(f[m]);return g}l[254]=l[254]=1,o.string2buf=function(f){var p,g,m,v,k,C=f.length,S=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++),S+=g<128?1:g<2048?2:g<65536?3:4;for(p=new i.Buf8(S),v=k=0;k<S;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?p[k++]=g:(g<2048?p[k++]=192|g>>>6:(g<65536?p[k++]=224|g>>>12:(p[k++]=240|g>>>18,p[k++]=128|g>>>12&63),p[k++]=128|g>>>6&63),p[k++]=128|63&g);return p},o.buf2binstring=function(f){return d(f,f.length)},o.binstring2buf=function(f){for(var p=new i.Buf8(f.length),g=0,m=p.length;g<m;g++)p[g]=f.charCodeAt(g);return p},o.buf2string=function(f,p){var g,m,v,k,C=p||f.length,S=new Array(2*C);for(g=m=0;g<C;)if((v=f[g++])<128)S[m++]=v;else if(4<(k=l[v]))S[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?S[m++]=65533:v<65536?S[m++]=v:(v-=65536,S[m++]=55296|v>>10&1023,S[m++]=56320|1023&v)}return d(S,m)},o.utf8border=function(f,p){var g;for((p=p||f.length)>f.length&&(p=f.length),g=p-1;0<=g&&(192&f[g])==128;)g--;return g<0||g===0?p:g+l[f[g]]>p?g:p}},{"./common":41}],43:[function(n,r,o){"use strict";r.exports=function(i,s,a,l){for(var 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 p=c;p<f;p++)s=s>>>8^d[255&(s^a[p])];return-1^s}},{}],46:[function(n,r,o){"use strict";var i,s=n("../utils/common"),a=n("./trees"),l=n("./adler32"),c=n("./crc32"),d=n("./messages"),f=0,p=4,g=0,m=-2,v=-1,k=4,C=2,S=8,w=9,b=286,T=30,L=19,N=2*b+1,H=15,z=3,B=258,Z=B+z+1,R=42,K=113,x=1,W=2,$=3,ee=4;function Q(A,ie){return A.msg=d[ie],ie}function X(A){return(A<<1)-(4<A?9:0)}function we(A){for(var ie=A.length;0<=--ie;)A[ie]=0}function ce(A){var ie=A.state,F=ie.pending;F>A.avail_out&&(F=A.avail_out),F!==0&&(s.arraySet(A.output,ie.pending_buf,ie.pending_out,F,A.next_out),A.next_out+=F,ie.pending_out+=F,A.total_out+=F,A.avail_out-=F,ie.pending-=F,ie.pending===0&&(ie.pending_out=0))}function be(A,ie){a._tr_flush_block(A,0<=A.block_start?A.block_start:-1,A.strstart-A.block_start,ie),A.block_start=A.strstart,ce(A.strm)}function ve(A,ie){A.pending_buf[A.pending++]=ie}function Ee(A,ie){A.pending_buf[A.pending++]=ie>>>8&255,A.pending_buf[A.pending++]=255&ie}function Pe(A,ie){var F,Y,O=A.max_chain_length,V=A.strstart,oe=A.prev_length,U=A.nice_match,G=A.strstart>A.w_size-Z?A.strstart-(A.w_size-Z):0,ge=A.window,Ae=A.w_mask,Se=A.prev,Te=A.strstart+B,Ye=ge[V+oe-1],rt=ge[V+oe];A.prev_length>=A.good_match&&(O>>=2),U>A.lookahead&&(U=A.lookahead);do if(ge[(F=ie)+oe]===rt&&ge[F+oe-1]===Ye&&ge[F]===ge[V]&&ge[++F]===ge[V+1]){V+=2,F++;do;while(ge[++V]===ge[++F]&&ge[++V]===ge[++F]&&ge[++V]===ge[++F]&&ge[++V]===ge[++F]&&ge[++V]===ge[++F]&&ge[++V]===ge[++F]&&ge[++V]===ge[++F]&&ge[++V]===ge[++F]&&V<Te);if(Y=B-(Te-V),V=Te-B,oe<Y){if(A.match_start=ie,U<=(oe=Y))break;Ye=ge[V+oe-1],rt=ge[V+oe]}}while((ie=Se[ie&Ae])>G&&--O!=0);return oe<=A.lookahead?oe:A.lookahead}function Ze(A){var ie,F,Y,O,V,oe,U,G,ge,Ae,Se=A.w_size;do{if(O=A.window_size-A.lookahead-A.strstart,A.strstart>=Se+(Se-Z)){for(s.arraySet(A.window,A.window,Se,Se,0),A.match_start-=Se,A.strstart-=Se,A.block_start-=Se,ie=F=A.hash_size;Y=A.head[--ie],A.head[ie]=Se<=Y?Y-Se:0,--F;);for(ie=F=Se;Y=A.prev[--ie],A.prev[ie]=Se<=Y?Y-Se:0,--F;);O+=Se}if(A.strm.avail_in===0)break;if(oe=A.strm,U=A.window,G=A.strstart+A.lookahead,ge=O,Ae=void 0,Ae=oe.avail_in,ge<Ae&&(Ae=ge),F=Ae===0?0:(oe.avail_in-=Ae,s.arraySet(U,oe.input,oe.next_in,Ae,G),oe.state.wrap===1?oe.adler=l(oe.adler,U,Ae,G):oe.state.wrap===2&&(oe.adler=c(oe.adler,U,Ae,G)),oe.next_in+=Ae,oe.total_in+=Ae,Ae),A.lookahead+=F,A.lookahead+A.insert>=z)for(V=A.strstart-A.insert,A.ins_h=A.window[V],A.ins_h=(A.ins_h<<A.hash_shift^A.window[V+1])&A.hash_mask;A.insert&&(A.ins_h=(A.ins_h<<A.hash_shift^A.window[V+z-1])&A.hash_mask,A.prev[V&A.w_mask]=A.head[A.ins_h],A.head[A.ins_h]=V,V++,A.insert--,!(A.lookahead+A.insert<z)););}while(A.lookahead<Z&&A.strm.avail_in!==0)}function at(A,ie){for(var F,Y;;){if(A.lookahead<Z){if(Ze(A),A.lookahead<Z&&ie===f)return x;if(A.lookahead===0)break}if(F=0,A.lookahead>=z&&(A.ins_h=(A.ins_h<<A.hash_shift^A.window[A.strstart+z-1])&A.hash_mask,F=A.prev[A.strstart&A.w_mask]=A.head[A.ins_h],A.head[A.ins_h]=A.strstart),F!==0&&A.strstart-F<=A.w_size-Z&&(A.match_length=Pe(A,F)),A.match_length>=z)if(Y=a._tr_tally(A,A.strstart-A.match_start,A.match_length-z),A.lookahead-=A.match_length,A.match_length<=A.max_lazy_match&&A.lookahead>=z){for(A.match_length--;A.strstart++,A.ins_h=(A.ins_h<<A.hash_shift^A.window[A.strstart+z-1])&A.hash_mask,F=A.prev[A.strstart&A.w_mask]=A.head[A.ins_h],A.head[A.ins_h]=A.strstart,--A.match_length!=0;);A.strstart++}else A.strstart+=A.match_length,A.match_length=0,A.ins_h=A.window[A.strstart],A.ins_h=(A.ins_h<<A.hash_shift^A.window[A.strstart+1])&A.hash_mask;else Y=a._tr_tally(A,0,A.window[A.strstart]),A.lookahead--,A.strstart++;if(Y&&(be(A,!1),A.strm.avail_out===0))return x}return A.insert=A.strstart<z-1?A.strstart:z-1,ie===p?(be(A,!0),A.strm.avail_out===0?$:ee):A.last_lit&&(be(A,!1),A.strm.avail_out===0)?x:W}function Qe(A,ie){for(var F,Y,O;;){if(A.lookahead<Z){if(Ze(A),A.lookahead<Z&&ie===f)return x;if(A.lookahead===0)break}if(F=0,A.lookahead>=z&&(A.ins_h=(A.ins_h<<A.hash_shift^A.window[A.strstart+z-1])&A.hash_mask,F=A.prev[A.strstart&A.w_mask]=A.head[A.ins_h],A.head[A.ins_h]=A.strstart),A.prev_length=A.match_length,A.prev_match=A.match_start,A.match_length=z-1,F!==0&&A.prev_length<A.max_lazy_match&&A.strstart-F<=A.w_size-Z&&(A.match_length=Pe(A,F),A.match_length<=5&&(A.strategy===1||A.match_length===z&&4096<A.strstart-A.match_start)&&(A.match_length=z-1)),A.prev_length>=z&&A.match_length<=A.prev_length){for(O=A.strstart+A.lookahead-z,Y=a._tr_tally(A,A.strstart-1-A.prev_match,A.prev_length-z),A.lookahead-=A.prev_length-1,A.prev_length-=2;++A.strstart<=O&&(A.ins_h=(A.ins_h<<A.hash_shift^A.window[A.strstart+z-1])&A.hash_mask,F=A.prev[A.strstart&A.w_mask]=A.head[A.ins_h],A.head[A.ins_h]=A.strstart),--A.prev_length!=0;);if(A.match_available=0,A.match_length=z-1,A.strstart++,Y&&(be(A,!1),A.strm.avail_out===0))return x}else if(A.match_available){if((Y=a._tr_tally(A,0,A.window[A.strstart-1]))&&be(A,!1),A.strstart++,A.lookahead--,A.strm.avail_out===0)return x}else A.match_available=1,A.strstart++,A.lookahead--}return A.match_available&&(Y=a._tr_tally(A,0,A.window[A.strstart-1]),A.match_available=0),A.insert=A.strstart<z-1?A.strstart:z-1,ie===p?(be(A,!0),A.strm.avail_out===0?$:ee):A.last_lit&&(be(A,!1),A.strm.avail_out===0)?x:W}function At(A,ie,F,Y,O){this.good_length=A,this.max_lazy=ie,this.nice_length=F,this.max_chain=Y,this.func=O}function se(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=S,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new s.Buf16(2*N),this.dyn_dtree=new s.Buf16(2*(2*T+1)),this.bl_tree=new s.Buf16(2*(2*L+1)),we(this.dyn_ltree),we(this.dyn_dtree),we(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*b+1),we(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new s.Buf16(2*b+1),we(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 Ie(A){var ie;return A&&A.state?(A.total_in=A.total_out=0,A.data_type=C,(ie=A.state).pending=0,ie.pending_out=0,ie.wrap<0&&(ie.wrap=-ie.wrap),ie.status=ie.wrap?R:K,A.adler=ie.wrap===2?0:1,ie.last_flush=f,a._tr_init(ie),g):Q(A,m)}function Ue(A){var ie=Ie(A);return ie===g&&(function(F){F.window_size=2*F.w_size,we(F.head),F.max_lazy_match=i[F.level].max_lazy,F.good_match=i[F.level].good_length,F.nice_match=i[F.level].nice_length,F.max_chain_length=i[F.level].max_chain,F.strstart=0,F.block_start=0,F.lookahead=0,F.insert=0,F.match_length=F.prev_length=z-1,F.match_available=0,F.ins_h=0})(A.state),ie}function ne(A,ie,F,Y,O,V){if(!A)return m;var oe=1;if(ie===v&&(ie=6),Y<0?(oe=0,Y=-Y):15<Y&&(oe=2,Y-=16),O<1||w<O||F!==S||Y<8||15<Y||ie<0||9<ie||V<0||k<V)return Q(A,m);Y===8&&(Y=9);var U=new se;return(A.state=U).strm=A,U.wrap=oe,U.gzhead=null,U.w_bits=Y,U.w_size=1<<U.w_bits,U.w_mask=U.w_size-1,U.hash_bits=O+7,U.hash_size=1<<U.hash_bits,U.hash_mask=U.hash_size-1,U.hash_shift=~~((U.hash_bits+z-1)/z),U.window=new s.Buf8(2*U.w_size),U.head=new s.Buf16(U.hash_size),U.prev=new s.Buf16(U.w_size),U.lit_bufsize=1<<O+6,U.pending_buf_size=4*U.lit_bufsize,U.pending_buf=new s.Buf8(U.pending_buf_size),U.d_buf=1*U.lit_bufsize,U.l_buf=3*U.lit_bufsize,U.level=ie,U.strategy=V,U.method=F,Ue(A)}i=[new At(0,0,0,0,function(A,ie){var F=65535;for(F>A.pending_buf_size-5&&(F=A.pending_buf_size-5);;){if(A.lookahead<=1){if(Ze(A),A.lookahead===0&&ie===f)return x;if(A.lookahead===0)break}A.strstart+=A.lookahead,A.lookahead=0;var Y=A.block_start+F;if((A.strstart===0||A.strstart>=Y)&&(A.lookahead=A.strstart-Y,A.strstart=Y,be(A,!1),A.strm.avail_out===0)||A.strstart-A.block_start>=A.w_size-Z&&(be(A,!1),A.strm.avail_out===0))return x}return A.insert=0,ie===p?(be(A,!0),A.strm.avail_out===0?$:ee):(A.strstart>A.block_start&&(be(A,!1),A.strm.avail_out),x)}),new At(4,4,8,4,at),new At(4,5,16,8,at),new At(4,6,32,32,at),new At(4,4,16,16,Qe),new At(8,16,32,32,Qe),new At(8,16,128,128,Qe),new At(8,32,128,256,Qe),new At(32,128,258,1024,Qe),new At(32,258,258,4096,Qe)],o.deflateInit=function(A,ie){return ne(A,ie,S,15,8,0)},o.deflateInit2=ne,o.deflateReset=Ue,o.deflateResetKeep=Ie,o.deflateSetHeader=function(A,ie){return A&&A.state?A.state.wrap!==2?m:(A.state.gzhead=ie,g):m},o.deflate=function(A,ie){var F,Y,O,V;if(!A||!A.state||5<ie||ie<0)return A?Q(A,m):m;if(Y=A.state,!A.output||!A.input&&A.avail_in!==0||Y.status===666&&ie!==p)return Q(A,A.avail_out===0?-5:m);if(Y.strm=A,F=Y.last_flush,Y.last_flush=ie,Y.status===R)if(Y.wrap===2)A.adler=0,ve(Y,31),ve(Y,139),ve(Y,8),Y.gzhead?(ve(Y,(Y.gzhead.text?1:0)+(Y.gzhead.hcrc?2:0)+(Y.gzhead.extra?4:0)+(Y.gzhead.name?8:0)+(Y.gzhead.comment?16:0)),ve(Y,255&Y.gzhead.time),ve(Y,Y.gzhead.time>>8&255),ve(Y,Y.gzhead.time>>16&255),ve(Y,Y.gzhead.time>>24&255),ve(Y,Y.level===9?2:2<=Y.strategy||Y.level<2?4:0),ve(Y,255&Y.gzhead.os),Y.gzhead.extra&&Y.gzhead.extra.length&&(ve(Y,255&Y.gzhead.extra.length),ve(Y,Y.gzhead.extra.length>>8&255)),Y.gzhead.hcrc&&(A.adler=c(A.adler,Y.pending_buf,Y.pending,0)),Y.gzindex=0,Y.status=69):(ve(Y,0),ve(Y,0),ve(Y,0),ve(Y,0),ve(Y,0),ve(Y,Y.level===9?2:2<=Y.strategy||Y.level<2?4:0),ve(Y,3),Y.status=K);else{var oe=S+(Y.w_bits-8<<4)<<8;oe|=(2<=Y.strategy||Y.level<2?0:Y.level<6?1:Y.level===6?2:3)<<6,Y.strstart!==0&&(oe|=32),oe+=31-oe%31,Y.status=K,Ee(Y,oe),Y.strstart!==0&&(Ee(Y,A.adler>>>16),Ee(Y,65535&A.adler)),A.adler=1}if(Y.status===69)if(Y.gzhead.extra){for(O=Y.pending;Y.gzindex<(65535&Y.gzhead.extra.length)&&(Y.pending!==Y.pending_buf_size||(Y.gzhead.hcrc&&Y.pending>O&&(A.adler=c(A.adler,Y.pending_buf,Y.pending-O,O)),ce(A),O=Y.pending,Y.pending!==Y.pending_buf_size));)ve(Y,255&Y.gzhead.extra[Y.gzindex]),Y.gzindex++;Y.gzhead.hcrc&&Y.pending>O&&(A.adler=c(A.adler,Y.pending_buf,Y.pending-O,O)),Y.gzindex===Y.gzhead.extra.length&&(Y.gzindex=0,Y.status=73)}else Y.status=73;if(Y.status===73)if(Y.gzhead.name){O=Y.pending;do{if(Y.pending===Y.pending_buf_size&&(Y.gzhead.hcrc&&Y.pending>O&&(A.adler=c(A.adler,Y.pending_buf,Y.pending-O,O)),ce(A),O=Y.pending,Y.pending===Y.pending_buf_size)){V=1;break}V=Y.gzindex<Y.gzhead.name.length?255&Y.gzhead.name.charCodeAt(Y.gzindex++):0,ve(Y,V)}while(V!==0);Y.gzhead.hcrc&&Y.pending>O&&(A.adler=c(A.adler,Y.pending_buf,Y.pending-O,O)),V===0&&(Y.gzindex=0,Y.status=91)}else Y.status=91;if(Y.status===91)if(Y.gzhead.comment){O=Y.pending;do{if(Y.pending===Y.pending_buf_size&&(Y.gzhead.hcrc&&Y.pending>O&&(A.adler=c(A.adler,Y.pending_buf,Y.pending-O,O)),ce(A),O=Y.pending,Y.pending===Y.pending_buf_size)){V=1;break}V=Y.gzindex<Y.gzhead.comment.length?255&Y.gzhead.comment.charCodeAt(Y.gzindex++):0,ve(Y,V)}while(V!==0);Y.gzhead.hcrc&&Y.pending>O&&(A.adler=c(A.adler,Y.pending_buf,Y.pending-O,O)),V===0&&(Y.status=103)}else Y.status=103;if(Y.status===103&&(Y.gzhead.hcrc?(Y.pending+2>Y.pending_buf_size&&ce(A),Y.pending+2<=Y.pending_buf_size&&(ve(Y,255&A.adler),ve(Y,A.adler>>8&255),A.adler=0,Y.status=K)):Y.status=K),Y.pending!==0){if(ce(A),A.avail_out===0)return Y.last_flush=-1,g}else if(A.avail_in===0&&X(ie)<=X(F)&&ie!==p)return Q(A,-5);if(Y.status===666&&A.avail_in!==0)return Q(A,-5);if(A.avail_in!==0||Y.lookahead!==0||ie!==f&&Y.status!==666){var U=Y.strategy===2?(function(G,ge){for(var Ae;;){if(G.lookahead===0&&(Ze(G),G.lookahead===0)){if(ge===f)return x;break}if(G.match_length=0,Ae=a._tr_tally(G,0,G.window[G.strstart]),G.lookahead--,G.strstart++,Ae&&(be(G,!1),G.strm.avail_out===0))return x}return G.insert=0,ge===p?(be(G,!0),G.strm.avail_out===0?$:ee):G.last_lit&&(be(G,!1),G.strm.avail_out===0)?x:W})(Y,ie):Y.strategy===3?(function(G,ge){for(var Ae,Se,Te,Ye,rt=G.window;;){if(G.lookahead<=B){if(Ze(G),G.lookahead<=B&&ge===f)return x;if(G.lookahead===0)break}if(G.match_length=0,G.lookahead>=z&&0<G.strstart&&(Se=rt[Te=G.strstart-1])===rt[++Te]&&Se===rt[++Te]&&Se===rt[++Te]){Ye=G.strstart+B;do;while(Se===rt[++Te]&&Se===rt[++Te]&&Se===rt[++Te]&&Se===rt[++Te]&&Se===rt[++Te]&&Se===rt[++Te]&&Se===rt[++Te]&&Se===rt[++Te]&&Te<Ye);G.match_length=B-(Ye-Te),G.match_length>G.lookahead&&(G.match_length=G.lookahead)}if(G.match_length>=z?(Ae=a._tr_tally(G,1,G.match_length-z),G.lookahead-=G.match_length,G.strstart+=G.match_length,G.match_length=0):(Ae=a._tr_tally(G,0,G.window[G.strstart]),G.lookahead--,G.strstart++),Ae&&(be(G,!1),G.strm.avail_out===0))return x}return G.insert=0,ge===p?(be(G,!0),G.strm.avail_out===0?$:ee):G.last_lit&&(be(G,!1),G.strm.avail_out===0)?x:W})(Y,ie):i[Y.level].func(Y,ie);if(U!==$&&U!==ee||(Y.status=666),U===x||U===$)return A.avail_out===0&&(Y.last_flush=-1),g;if(U===W&&(ie===1?a._tr_align(Y):ie!==5&&(a._tr_stored_block(Y,0,0,!1),ie===3&&(we(Y.head),Y.lookahead===0&&(Y.strstart=0,Y.block_start=0,Y.insert=0))),ce(A),A.avail_out===0))return Y.last_flush=-1,g}return ie!==p?g:Y.wrap<=0?1:(Y.wrap===2?(ve(Y,255&A.adler),ve(Y,A.adler>>8&255),ve(Y,A.adler>>16&255),ve(Y,A.adler>>24&255),ve(Y,255&A.total_in),ve(Y,A.total_in>>8&255),ve(Y,A.total_in>>16&255),ve(Y,A.total_in>>24&255)):(Ee(Y,A.adler>>>16),Ee(Y,65535&A.adler)),ce(A),0<Y.wrap&&(Y.wrap=-Y.wrap),Y.pending!==0?g:1)},o.deflateEnd=function(A){var ie;return A&&A.state?(ie=A.state.status)!==R&&ie!==69&&ie!==73&&ie!==91&&ie!==103&&ie!==K&&ie!==666?Q(A,m):(A.state=null,ie===K?Q(A,-3):g):m},o.deflateSetDictionary=function(A,ie){var F,Y,O,V,oe,U,G,ge,Ae=ie.length;if(!A||!A.state||(V=(F=A.state).wrap)===2||V===1&&F.status!==R||F.lookahead)return m;for(V===1&&(A.adler=l(A.adler,ie,Ae,0)),F.wrap=0,Ae>=F.w_size&&(V===0&&(we(F.head),F.strstart=0,F.block_start=0,F.insert=0),ge=new s.Buf8(F.w_size),s.arraySet(ge,ie,Ae-F.w_size,F.w_size,0),ie=ge,Ae=F.w_size),oe=A.avail_in,U=A.next_in,G=A.input,A.avail_in=Ae,A.next_in=0,A.input=ie,Ze(F);F.lookahead>=z;){for(Y=F.strstart,O=F.lookahead-(z-1);F.ins_h=(F.ins_h<<F.hash_shift^F.window[Y+z-1])&F.hash_mask,F.prev[Y&F.w_mask]=F.head[F.ins_h],F.head[F.ins_h]=Y,Y++,--O;);F.strstart=Y,F.lookahead=z-1,Ze(F)}return F.strstart+=F.lookahead,F.block_start=F.strstart,F.insert=F.lookahead,F.lookahead=0,F.match_length=F.prev_length=z-1,F.match_available=0,A.next_in=U,A.input=G,A.avail_in=oe,F.wrap=V,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,p,g,m,v,k,C,S,w,b,T,L,N,H,z,B,Z,R,K,x=i.input,W;c=l+(i.avail_in-5),d=i.next_out,W=i.output,f=d-(s-i.avail_out),p=d+(i.avail_out-257),g=a.dmax,m=a.wsize,v=a.whave,k=a.wnext,C=a.window,S=a.hold,w=a.bits,b=a.lencode,T=a.distcode,L=(1<<a.lenbits)-1,N=(1<<a.distbits)-1;e:do{w<15&&(S+=x[l++]<<w,w+=8,S+=x[l++]<<w,w+=8),H=b[S&L];t:for(;;){if(S>>>=z=H>>>24,w-=z,(z=H>>>16&255)===0)W[d++]=65535&H;else{if(!(16&z)){if((64&z)==0){H=b[(65535&H)+(S&(1<<z)-1)];continue t}if(32&z){a.mode=12;break e}i.msg="invalid literal/length code",a.mode=30;break e}B=65535&H,(z&=15)&&(w<z&&(S+=x[l++]<<w,w+=8),B+=S&(1<<z)-1,S>>>=z,w-=z),w<15&&(S+=x[l++]<<w,w+=8,S+=x[l++]<<w,w+=8),H=T[S&N];n:for(;;){if(S>>>=z=H>>>24,w-=z,!(16&(z=H>>>16&255))){if((64&z)==0){H=T[(65535&H)+(S&(1<<z)-1)];continue n}i.msg="invalid distance code",a.mode=30;break e}if(Z=65535&H,w<(z&=15)&&(S+=x[l++]<<w,(w+=8)<z&&(S+=x[l++]<<w,w+=8)),g<(Z+=S&(1<<z)-1)){i.msg="invalid distance too far back",a.mode=30;break e}if(S>>>=z,w-=z,(z=d-f)<Z){if(v<(z=Z-z)&&a.sane){i.msg="invalid distance too far back",a.mode=30;break e}if(K=C,(R=0)===k){if(R+=m-z,z<B){for(B-=z;W[d++]=C[R++],--z;);R=d-Z,K=W}}else if(k<z){if(R+=m+k-z,(z-=k)<B){for(B-=z;W[d++]=C[R++],--z;);if(R=0,k<B){for(B-=z=k;W[d++]=C[R++],--z;);R=d-Z,K=W}}}else if(R+=k-z,z<B){for(B-=z;W[d++]=C[R++],--z;);R=d-Z,K=W}for(;2<B;)W[d++]=K[R++],W[d++]=K[R++],W[d++]=K[R++],B-=3;B&&(W[d++]=K[R++],1<B&&(W[d++]=K[R++]))}else{for(R=d-Z;W[d++]=W[R++],W[d++]=W[R++],W[d++]=W[R++],2<(B-=3););B&&(W[d++]=W[R++],1<B&&(W[d++]=W[R++]))}break}}break}}while(l<c&&d<p);l-=B=w>>3,S&=(1<<(w-=B<<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<p?p-d+257:257-(d-p),a.hold=S,a.bits=w}},{}],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,p=0,g=-2,m=1,v=852,k=592;function C(R){return(R>>>24&255)+(R>>>8&65280)+((65280&R)<<8)+((255&R)<<24)}function S(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new i.Buf16(320),this.work=new i.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function w(R){var K;return R&&R.state?(K=R.state,R.total_in=R.total_out=K.total=0,R.msg="",K.wrap&&(R.adler=1&K.wrap),K.mode=m,K.last=0,K.havedict=0,K.dmax=32768,K.head=null,K.hold=0,K.bits=0,K.lencode=K.lendyn=new i.Buf32(v),K.distcode=K.distdyn=new i.Buf32(k),K.sane=1,K.back=-1,p):g}function b(R){var K;return R&&R.state?((K=R.state).wsize=0,K.whave=0,K.wnext=0,w(R)):g}function T(R,K){var x,W;return R&&R.state?(W=R.state,K<0?(x=0,K=-K):(x=1+(K>>4),K<48&&(K&=15)),K&&(K<8||15<K)?g:(W.window!==null&&W.wbits!==K&&(W.window=null),W.wrap=x,W.wbits=K,b(R))):g}function L(R,K){var x,W;return R?(W=new S,(R.state=W).window=null,(x=T(R,K))!==p&&(R.state=null),x):g}var N,H,z=!0;function B(R){if(z){var K;for(N=new i.Buf32(512),H=new i.Buf32(32),K=0;K<144;)R.lens[K++]=8;for(;K<256;)R.lens[K++]=9;for(;K<280;)R.lens[K++]=7;for(;K<288;)R.lens[K++]=8;for(c(d,R.lens,0,288,N,0,R.work,{bits:9}),K=0;K<32;)R.lens[K++]=5;c(f,R.lens,0,32,H,0,R.work,{bits:5}),z=!1}R.lencode=N,R.lenbits=9,R.distcode=H,R.distbits=5}function Z(R,K,x,W){var $,ee=R.state;return ee.window===null&&(ee.wsize=1<<ee.wbits,ee.wnext=0,ee.whave=0,ee.window=new i.Buf8(ee.wsize)),W>=ee.wsize?(i.arraySet(ee.window,K,x-ee.wsize,ee.wsize,0),ee.wnext=0,ee.whave=ee.wsize):(W<($=ee.wsize-ee.wnext)&&($=W),i.arraySet(ee.window,K,x-W,$,ee.wnext),(W-=$)?(i.arraySet(ee.window,K,x-W,W,0),ee.wnext=W,ee.whave=ee.wsize):(ee.wnext+=$,ee.wnext===ee.wsize&&(ee.wnext=0),ee.whave<ee.wsize&&(ee.whave+=$))),0}o.inflateReset=b,o.inflateReset2=T,o.inflateResetKeep=w,o.inflateInit=function(R){return L(R,15)},o.inflateInit2=L,o.inflate=function(R,K){var x,W,$,ee,Q,X,we,ce,be,ve,Ee,Pe,Ze,at,Qe,At,se,Ie,Ue,ne,A,ie,F,Y,O=0,V=new i.Buf8(4),oe=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!R||!R.state||!R.output||!R.input&&R.avail_in!==0)return g;(x=R.state).mode===12&&(x.mode=13),Q=R.next_out,$=R.output,we=R.avail_out,ee=R.next_in,W=R.input,X=R.avail_in,ce=x.hold,be=x.bits,ve=X,Ee=we,ie=p;e:for(;;)switch(x.mode){case m:if(x.wrap===0){x.mode=13;break}for(;be<16;){if(X===0)break e;X--,ce+=W[ee++]<<be,be+=8}if(2&x.wrap&&ce===35615){V[x.check=0]=255&ce,V[1]=ce>>>8&255,x.check=a(x.check,V,2,0),be=ce=0,x.mode=2;break}if(x.flags=0,x.head&&(x.head.done=!1),!(1&x.wrap)||(((255&ce)<<8)+(ce>>8))%31){R.msg="incorrect header check",x.mode=30;break}if((15&ce)!=8){R.msg="unknown compression method",x.mode=30;break}if(be-=4,A=8+(15&(ce>>>=4)),x.wbits===0)x.wbits=A;else if(A>x.wbits){R.msg="invalid window size",x.mode=30;break}x.dmax=1<<A,R.adler=x.check=1,x.mode=512&ce?10:12,be=ce=0;break;case 2:for(;be<16;){if(X===0)break e;X--,ce+=W[ee++]<<be,be+=8}if(x.flags=ce,(255&x.flags)!=8){R.msg="unknown compression method",x.mode=30;break}if(57344&x.flags){R.msg="unknown header flags set",x.mode=30;break}x.head&&(x.head.text=ce>>8&1),512&x.flags&&(V[0]=255&ce,V[1]=ce>>>8&255,x.check=a(x.check,V,2,0)),be=ce=0,x.mode=3;case 3:for(;be<32;){if(X===0)break e;X--,ce+=W[ee++]<<be,be+=8}x.head&&(x.head.time=ce),512&x.flags&&(V[0]=255&ce,V[1]=ce>>>8&255,V[2]=ce>>>16&255,V[3]=ce>>>24&255,x.check=a(x.check,V,4,0)),be=ce=0,x.mode=4;case 4:for(;be<16;){if(X===0)break e;X--,ce+=W[ee++]<<be,be+=8}x.head&&(x.head.xflags=255&ce,x.head.os=ce>>8),512&x.flags&&(V[0]=255&ce,V[1]=ce>>>8&255,x.check=a(x.check,V,2,0)),be=ce=0,x.mode=5;case 5:if(1024&x.flags){for(;be<16;){if(X===0)break e;X--,ce+=W[ee++]<<be,be+=8}x.length=ce,x.head&&(x.head.extra_len=ce),512&x.flags&&(V[0]=255&ce,V[1]=ce>>>8&255,x.check=a(x.check,V,2,0)),be=ce=0}else x.head&&(x.head.extra=null);x.mode=6;case 6:if(1024&x.flags&&(X<(Pe=x.length)&&(Pe=X),Pe&&(x.head&&(A=x.head.extra_len-x.length,x.head.extra||(x.head.extra=new Array(x.head.extra_len)),i.arraySet(x.head.extra,W,ee,Pe,A)),512&x.flags&&(x.check=a(x.check,W,Pe,ee)),X-=Pe,ee+=Pe,x.length-=Pe),x.length))break e;x.length=0,x.mode=7;case 7:if(2048&x.flags){if(X===0)break e;for(Pe=0;A=W[ee+Pe++],x.head&&A&&x.length<65536&&(x.head.name+=String.fromCharCode(A)),A&&Pe<X;);if(512&x.flags&&(x.check=a(x.check,W,Pe,ee)),X-=Pe,ee+=Pe,A)break e}else x.head&&(x.head.name=null);x.length=0,x.mode=8;case 8:if(4096&x.flags){if(X===0)break e;for(Pe=0;A=W[ee+Pe++],x.head&&A&&x.length<65536&&(x.head.comment+=String.fromCharCode(A)),A&&Pe<X;);if(512&x.flags&&(x.check=a(x.check,W,Pe,ee)),X-=Pe,ee+=Pe,A)break e}else x.head&&(x.head.comment=null);x.mode=9;case 9:if(512&x.flags){for(;be<16;){if(X===0)break e;X--,ce+=W[ee++]<<be,be+=8}if(ce!==(65535&x.check)){R.msg="header crc mismatch",x.mode=30;break}be=ce=0}x.head&&(x.head.hcrc=x.flags>>9&1,x.head.done=!0),R.adler=x.check=0,x.mode=12;break;case 10:for(;be<32;){if(X===0)break e;X--,ce+=W[ee++]<<be,be+=8}R.adler=x.check=C(ce),be=ce=0,x.mode=11;case 11:if(x.havedict===0)return R.next_out=Q,R.avail_out=we,R.next_in=ee,R.avail_in=X,x.hold=ce,x.bits=be,2;R.adler=x.check=1,x.mode=12;case 12:if(K===5||K===6)break e;case 13:if(x.last){ce>>>=7&be,be-=7&be,x.mode=27;break}for(;be<3;){if(X===0)break e;X--,ce+=W[ee++]<<be,be+=8}switch(x.last=1&ce,be-=1,3&(ce>>>=1)){case 0:x.mode=14;break;case 1:if(B(x),x.mode=20,K!==6)break;ce>>>=2,be-=2;break e;case 2:x.mode=17;break;case 3:R.msg="invalid block type",x.mode=30}ce>>>=2,be-=2;break;case 14:for(ce>>>=7&be,be-=7&be;be<32;){if(X===0)break e;X--,ce+=W[ee++]<<be,be+=8}if((65535&ce)!=(ce>>>16^65535)){R.msg="invalid stored block lengths",x.mode=30;break}if(x.length=65535&ce,be=ce=0,x.mode=15,K===6)break e;case 15:x.mode=16;case 16:if(Pe=x.length){if(X<Pe&&(Pe=X),we<Pe&&(Pe=we),Pe===0)break e;i.arraySet($,W,ee,Pe,Q),X-=Pe,ee+=Pe,we-=Pe,Q+=Pe,x.length-=Pe;break}x.mode=12;break;case 17:for(;be<14;){if(X===0)break e;X--,ce+=W[ee++]<<be,be+=8}if(x.nlen=257+(31&ce),ce>>>=5,be-=5,x.ndist=1+(31&ce),ce>>>=5,be-=5,x.ncode=4+(15&ce),ce>>>=4,be-=4,286<x.nlen||30<x.ndist){R.msg="too many length or distance symbols",x.mode=30;break}x.have=0,x.mode=18;case 18:for(;x.have<x.ncode;){for(;be<3;){if(X===0)break e;X--,ce+=W[ee++]<<be,be+=8}x.lens[oe[x.have++]]=7&ce,ce>>>=3,be-=3}for(;x.have<19;)x.lens[oe[x.have++]]=0;if(x.lencode=x.lendyn,x.lenbits=7,F={bits:x.lenbits},ie=c(0,x.lens,0,19,x.lencode,0,x.work,F),x.lenbits=F.bits,ie){R.msg="invalid code lengths set",x.mode=30;break}x.have=0,x.mode=19;case 19:for(;x.have<x.nlen+x.ndist;){for(;At=(O=x.lencode[ce&(1<<x.lenbits)-1])>>>16&255,se=65535&O,!((Qe=O>>>24)<=be);){if(X===0)break e;X--,ce+=W[ee++]<<be,be+=8}if(se<16)ce>>>=Qe,be-=Qe,x.lens[x.have++]=se;else{if(se===16){for(Y=Qe+2;be<Y;){if(X===0)break e;X--,ce+=W[ee++]<<be,be+=8}if(ce>>>=Qe,be-=Qe,x.have===0){R.msg="invalid bit length repeat",x.mode=30;break}A=x.lens[x.have-1],Pe=3+(3&ce),ce>>>=2,be-=2}else if(se===17){for(Y=Qe+3;be<Y;){if(X===0)break e;X--,ce+=W[ee++]<<be,be+=8}be-=Qe,A=0,Pe=3+(7&(ce>>>=Qe)),ce>>>=3,be-=3}else{for(Y=Qe+7;be<Y;){if(X===0)break e;X--,ce+=W[ee++]<<be,be+=8}be-=Qe,A=0,Pe=11+(127&(ce>>>=Qe)),ce>>>=7,be-=7}if(x.have+Pe>x.nlen+x.ndist){R.msg="invalid bit length repeat",x.mode=30;break}for(;Pe--;)x.lens[x.have++]=A}}if(x.mode===30)break;if(x.lens[256]===0){R.msg="invalid code -- missing end-of-block",x.mode=30;break}if(x.lenbits=9,F={bits:x.lenbits},ie=c(d,x.lens,0,x.nlen,x.lencode,0,x.work,F),x.lenbits=F.bits,ie){R.msg="invalid literal/lengths set",x.mode=30;break}if(x.distbits=6,x.distcode=x.distdyn,F={bits:x.distbits},ie=c(f,x.lens,x.nlen,x.ndist,x.distcode,0,x.work,F),x.distbits=F.bits,ie){R.msg="invalid distances set",x.mode=30;break}if(x.mode=20,K===6)break e;case 20:x.mode=21;case 21:if(6<=X&&258<=we){R.next_out=Q,R.avail_out=we,R.next_in=ee,R.avail_in=X,x.hold=ce,x.bits=be,l(R,Ee),Q=R.next_out,$=R.output,we=R.avail_out,ee=R.next_in,W=R.input,X=R.avail_in,ce=x.hold,be=x.bits,x.mode===12&&(x.back=-1);break}for(x.back=0;At=(O=x.lencode[ce&(1<<x.lenbits)-1])>>>16&255,se=65535&O,!((Qe=O>>>24)<=be);){if(X===0)break e;X--,ce+=W[ee++]<<be,be+=8}if(At&&(240&At)==0){for(Ie=Qe,Ue=At,ne=se;At=(O=x.lencode[ne+((ce&(1<<Ie+Ue)-1)>>Ie)])>>>16&255,se=65535&O,!(Ie+(Qe=O>>>24)<=be);){if(X===0)break e;X--,ce+=W[ee++]<<be,be+=8}ce>>>=Ie,be-=Ie,x.back+=Ie}if(ce>>>=Qe,be-=Qe,x.back+=Qe,x.length=se,At===0){x.mode=26;break}if(32&At){x.back=-1,x.mode=12;break}if(64&At){R.msg="invalid literal/length code",x.mode=30;break}x.extra=15&At,x.mode=22;case 22:if(x.extra){for(Y=x.extra;be<Y;){if(X===0)break e;X--,ce+=W[ee++]<<be,be+=8}x.length+=ce&(1<<x.extra)-1,ce>>>=x.extra,be-=x.extra,x.back+=x.extra}x.was=x.length,x.mode=23;case 23:for(;At=(O=x.distcode[ce&(1<<x.distbits)-1])>>>16&255,se=65535&O,!((Qe=O>>>24)<=be);){if(X===0)break e;X--,ce+=W[ee++]<<be,be+=8}if((240&At)==0){for(Ie=Qe,Ue=At,ne=se;At=(O=x.distcode[ne+((ce&(1<<Ie+Ue)-1)>>Ie)])>>>16&255,se=65535&O,!(Ie+(Qe=O>>>24)<=be);){if(X===0)break e;X--,ce+=W[ee++]<<be,be+=8}ce>>>=Ie,be-=Ie,x.back+=Ie}if(ce>>>=Qe,be-=Qe,x.back+=Qe,64&At){R.msg="invalid distance code",x.mode=30;break}x.offset=se,x.extra=15&At,x.mode=24;case 24:if(x.extra){for(Y=x.extra;be<Y;){if(X===0)break e;X--,ce+=W[ee++]<<be,be+=8}x.offset+=ce&(1<<x.extra)-1,ce>>>=x.extra,be-=x.extra,x.back+=x.extra}if(x.offset>x.dmax){R.msg="invalid distance too far back",x.mode=30;break}x.mode=25;case 25:if(we===0)break e;if(Pe=Ee-we,x.offset>Pe){if((Pe=x.offset-Pe)>x.whave&&x.sane){R.msg="invalid distance too far back",x.mode=30;break}Ze=Pe>x.wnext?(Pe-=x.wnext,x.wsize-Pe):x.wnext-Pe,Pe>x.length&&(Pe=x.length),at=x.window}else at=$,Ze=Q-x.offset,Pe=x.length;for(we<Pe&&(Pe=we),we-=Pe,x.length-=Pe;$[Q++]=at[Ze++],--Pe;);x.length===0&&(x.mode=21);break;case 26:if(we===0)break e;$[Q++]=x.length,we--,x.mode=21;break;case 27:if(x.wrap){for(;be<32;){if(X===0)break e;X--,ce|=W[ee++]<<be,be+=8}if(Ee-=we,R.total_out+=Ee,x.total+=Ee,Ee&&(R.adler=x.check=x.flags?a(x.check,$,Ee,Q-Ee):s(x.check,$,Ee,Q-Ee)),Ee=we,(x.flags?ce:C(ce))!==x.check){R.msg="incorrect data check",x.mode=30;break}be=ce=0}x.mode=28;case 28:if(x.wrap&&x.flags){for(;be<32;){if(X===0)break e;X--,ce+=W[ee++]<<be,be+=8}if(ce!==(4294967295&x.total)){R.msg="incorrect length check",x.mode=30;break}be=ce=0}x.mode=29;case 29:ie=1;break e;case 30:ie=-3;break e;case 31:return-4;default:return g}return R.next_out=Q,R.avail_out=we,R.next_in=ee,R.avail_in=X,x.hold=ce,x.bits=be,(x.wsize||Ee!==R.avail_out&&x.mode<30&&(x.mode<27||K!==4))&&Z(R,R.output,R.next_out,Ee-R.avail_out)?(x.mode=31,-4):(ve-=R.avail_in,Ee-=R.avail_out,R.total_in+=ve,R.total_out+=Ee,x.total+=Ee,x.wrap&&Ee&&(R.adler=x.check=x.flags?a(x.check,$,Ee,R.next_out-Ee):s(x.check,$,Ee,R.next_out-Ee)),R.data_type=x.bits+(x.last?64:0)+(x.mode===12?128:0)+(x.mode===20||x.mode===15?256:0),(ve==0&&Ee===0||K===4)&&ie===p&&(ie=-5),ie)},o.inflateEnd=function(R){if(!R||!R.state)return g;var K=R.state;return K.window&&(K.window=null),R.state=null,p},o.inflateGetHeader=function(R,K){var x;return R&&R.state?(2&(x=R.state).wrap)==0?g:((x.head=K).done=!1,p):g},o.inflateSetDictionary=function(R,K){var x,W=K.length;return R&&R.state?(x=R.state).wrap!==0&&x.mode!==11?g:x.mode===11&&s(1,K,W,0)!==x.check?-3:Z(R,K,W,W)?(x.mode=31,-4):(x.havedict=1,p):g},o.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(n,r,o){"use strict";var i=n("../utils/common"),s=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],a=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],l=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],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,p,g,m,v,k,C){var S,w,b,T,L,N,H,z,B,Z=C.bits,R=0,K=0,x=0,W=0,$=0,ee=0,Q=0,X=0,we=0,ce=0,be=null,ve=0,Ee=new i.Buf16(16),Pe=new i.Buf16(16),Ze=null,at=0;for(R=0;R<=15;R++)Ee[R]=0;for(K=0;K<g;K++)Ee[f[p+K]]++;for($=Z,W=15;1<=W&&Ee[W]===0;W--);if(W<$&&($=W),W===0)return m[v++]=20971520,m[v++]=20971520,C.bits=1,0;for(x=1;x<W&&Ee[x]===0;x++);for($<x&&($=x),R=X=1;R<=15;R++)if(X<<=1,(X-=Ee[R])<0)return-1;if(0<X&&(d===0||W!==1))return-1;for(Pe[1]=0,R=1;R<15;R++)Pe[R+1]=Pe[R]+Ee[R];for(K=0;K<g;K++)f[p+K]!==0&&(k[Pe[f[p+K]]++]=K);if(N=d===0?(be=Ze=k,19):d===1?(be=s,ve-=257,Ze=a,at-=257,256):(be=l,Ze=c,-1),R=x,L=v,Q=K=ce=0,b=-1,T=(we=1<<(ee=$))-1,d===1&&852<we||d===2&&592<we)return 1;for(;;){for(H=R-Q,B=k[K]<N?(z=0,k[K]):k[K]>N?(z=Ze[at+k[K]],be[ve+k[K]]):(z=96,0),S=1<<R-Q,x=w=1<<ee;m[L+(ce>>Q)+(w-=S)]=H<<24|z<<16|B|0,w!==0;);for(S=1<<R-1;ce&S;)S>>=1;if(S!==0?(ce&=S-1,ce+=S):ce=0,K++,--Ee[R]==0){if(R===W)break;R=f[p+k[K]]}if($<R&&(ce&T)!==b){for(Q===0&&(Q=$),L+=x,X=1<<(ee=R-Q);ee+Q<W&&!((X-=Ee[ee+Q])<=0);)ee++,X<<=1;if(we+=1<<ee,d===1&&852<we||d===2&&592<we)return 1;m[b=ce&T]=$<<24|ee<<16|L-v|0}}return ce!==0&&(m[L+ce]=R-Q<<24|4194304),C.bits=$,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(O){for(var V=O.length;0<=--V;)O[V]=0}var c=0,d=29,f=256,p=f+1+d,g=30,m=19,v=2*p+1,k=15,C=16,S=7,w=256,b=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],z=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],B=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],Z=new Array(2*(p+2));l(Z);var R=new Array(2*g);l(R);var K=new Array(512);l(K);var x=new Array(256);l(x);var W=new Array(d);l(W);var $,ee,Q,X=new Array(g);function we(O,V,oe,U,G){this.static_tree=O,this.extra_bits=V,this.extra_base=oe,this.elems=U,this.max_length=G,this.has_stree=O&&O.length}function ce(O,V){this.dyn_tree=O,this.max_code=0,this.stat_desc=V}function be(O){return O<256?K[O]:K[256+(O>>>7)]}function ve(O,V){O.pending_buf[O.pending++]=255&V,O.pending_buf[O.pending++]=V>>>8&255}function Ee(O,V,oe){O.bi_valid>C-oe?(O.bi_buf|=V<<O.bi_valid&65535,ve(O,O.bi_buf),O.bi_buf=V>>C-O.bi_valid,O.bi_valid+=oe-C):(O.bi_buf|=V<<O.bi_valid&65535,O.bi_valid+=oe)}function Pe(O,V,oe){Ee(O,oe[2*V],oe[2*V+1])}function Ze(O,V){for(var oe=0;oe|=1&O,O>>>=1,oe<<=1,0<--V;);return oe>>>1}function at(O,V,oe){var U,G,ge=new Array(k+1),Ae=0;for(U=1;U<=k;U++)ge[U]=Ae=Ae+oe[U-1]<<1;for(G=0;G<=V;G++){var Se=O[2*G+1];Se!==0&&(O[2*G]=Ze(ge[Se]++,Se))}}function Qe(O){var V;for(V=0;V<p;V++)O.dyn_ltree[2*V]=0;for(V=0;V<g;V++)O.dyn_dtree[2*V]=0;for(V=0;V<m;V++)O.bl_tree[2*V]=0;O.dyn_ltree[2*w]=1,O.opt_len=O.static_len=0,O.last_lit=O.matches=0}function At(O){8<O.bi_valid?ve(O,O.bi_buf):0<O.bi_valid&&(O.pending_buf[O.pending++]=O.bi_buf),O.bi_buf=0,O.bi_valid=0}function se(O,V,oe,U){var G=2*V,ge=2*oe;return O[G]<O[ge]||O[G]===O[ge]&&U[V]<=U[oe]}function Ie(O,V,oe){for(var U=O.heap[oe],G=oe<<1;G<=O.heap_len&&(G<O.heap_len&&se(V,O.heap[G+1],O.heap[G],O.depth)&&G++,!se(V,U,O.heap[G],O.depth));)O.heap[oe]=O.heap[G],oe=G,G<<=1;O.heap[oe]=U}function Ue(O,V,oe){var U,G,ge,Ae,Se=0;if(O.last_lit!==0)for(;U=O.pending_buf[O.d_buf+2*Se]<<8|O.pending_buf[O.d_buf+2*Se+1],G=O.pending_buf[O.l_buf+Se],Se++,U===0?Pe(O,G,V):(Pe(O,(ge=x[G])+f+1,V),(Ae=N[ge])!==0&&Ee(O,G-=W[ge],Ae),Pe(O,ge=be(--U),oe),(Ae=H[ge])!==0&&Ee(O,U-=X[ge],Ae)),Se<O.last_lit;);Pe(O,w,V)}function ne(O,V){var oe,U,G,ge=V.dyn_tree,Ae=V.stat_desc.static_tree,Se=V.stat_desc.has_stree,Te=V.stat_desc.elems,Ye=-1;for(O.heap_len=0,O.heap_max=v,oe=0;oe<Te;oe++)ge[2*oe]!==0?(O.heap[++O.heap_len]=Ye=oe,O.depth[oe]=0):ge[2*oe+1]=0;for(;O.heap_len<2;)ge[2*(G=O.heap[++O.heap_len]=Ye<2?++Ye:0)]=1,O.depth[G]=0,O.opt_len--,Se&&(O.static_len-=Ae[2*G+1]);for(V.max_code=Ye,oe=O.heap_len>>1;1<=oe;oe--)Ie(O,ge,oe);for(G=Te;oe=O.heap[1],O.heap[1]=O.heap[O.heap_len--],Ie(O,ge,1),U=O.heap[1],O.heap[--O.heap_max]=oe,O.heap[--O.heap_max]=U,ge[2*G]=ge[2*oe]+ge[2*U],O.depth[G]=(O.depth[oe]>=O.depth[U]?O.depth[oe]:O.depth[U])+1,ge[2*oe+1]=ge[2*U+1]=G,O.heap[1]=G++,Ie(O,ge,1),2<=O.heap_len;);O.heap[--O.heap_max]=O.heap[1],(function(rt,ht){var Pt,Ft,Wt,$e,cn,jn,Ut=ht.dyn_tree,In=ht.max_code,qr=ht.stat_desc.static_tree,Cr=ht.stat_desc.has_stree,Er=ht.stat_desc.extra_bits,Je=ht.stat_desc.extra_base,wt=ht.stat_desc.max_length,Dt=0;for($e=0;$e<=k;$e++)rt.bl_count[$e]=0;for(Ut[2*rt.heap[rt.heap_max]+1]=0,Pt=rt.heap_max+1;Pt<v;Pt++)wt<($e=Ut[2*Ut[2*(Ft=rt.heap[Pt])+1]+1]+1)&&($e=wt,Dt++),Ut[2*Ft+1]=$e,In<Ft||(rt.bl_count[$e]++,cn=0,Je<=Ft&&(cn=Er[Ft-Je]),jn=Ut[2*Ft],rt.opt_len+=jn*($e+cn),Cr&&(rt.static_len+=jn*(qr[2*Ft+1]+cn)));if(Dt!==0){do{for($e=wt-1;rt.bl_count[$e]===0;)$e--;rt.bl_count[$e]--,rt.bl_count[$e+1]+=2,rt.bl_count[wt]--,Dt-=2}while(0<Dt);for($e=wt;$e!==0;$e--)for(Ft=rt.bl_count[$e];Ft!==0;)In<(Wt=rt.heap[--Pt])||(Ut[2*Wt+1]!==$e&&(rt.opt_len+=($e-Ut[2*Wt+1])*Ut[2*Wt],Ut[2*Wt+1]=$e),Ft--)}})(O,V),at(ge,Ye,O.bl_count)}function A(O,V,oe){var U,G,ge=-1,Ae=V[1],Se=0,Te=7,Ye=4;for(Ae===0&&(Te=138,Ye=3),V[2*(oe+1)+1]=65535,U=0;U<=oe;U++)G=Ae,Ae=V[2*(U+1)+1],++Se<Te&&G===Ae||(Se<Ye?O.bl_tree[2*G]+=Se:G!==0?(G!==ge&&O.bl_tree[2*G]++,O.bl_tree[2*b]++):Se<=10?O.bl_tree[2*T]++:O.bl_tree[2*L]++,ge=G,Ye=(Se=0)===Ae?(Te=138,3):G===Ae?(Te=6,3):(Te=7,4))}function ie(O,V,oe){var U,G,ge=-1,Ae=V[1],Se=0,Te=7,Ye=4;for(Ae===0&&(Te=138,Ye=3),U=0;U<=oe;U++)if(G=Ae,Ae=V[2*(U+1)+1],!(++Se<Te&&G===Ae)){if(Se<Ye)for(;Pe(O,G,O.bl_tree),--Se!=0;);else G!==0?(G!==ge&&(Pe(O,G,O.bl_tree),Se--),Pe(O,b,O.bl_tree),Ee(O,Se-3,2)):Se<=10?(Pe(O,T,O.bl_tree),Ee(O,Se-3,3)):(Pe(O,L,O.bl_tree),Ee(O,Se-11,7));ge=G,Ye=(Se=0)===Ae?(Te=138,3):G===Ae?(Te=6,3):(Te=7,4)}}l(X);var F=!1;function Y(O,V,oe,U){Ee(O,(c<<1)+(U?1:0),3),(function(G,ge,Ae,Se){At(G),Se&&(ve(G,Ae),ve(G,~Ae)),i.arraySet(G.pending_buf,G.window,ge,Ae,G.pending),G.pending+=Ae})(O,V,oe,!0)}o._tr_init=function(O){F||((function(){var V,oe,U,G,ge,Ae=new Array(k+1);for(G=U=0;G<d-1;G++)for(W[G]=U,V=0;V<1<<N[G];V++)x[U++]=G;for(x[U-1]=G,G=ge=0;G<16;G++)for(X[G]=ge,V=0;V<1<<H[G];V++)K[ge++]=G;for(ge>>=7;G<g;G++)for(X[G]=ge<<7,V=0;V<1<<H[G]-7;V++)K[256+ge++]=G;for(oe=0;oe<=k;oe++)Ae[oe]=0;for(V=0;V<=143;)Z[2*V+1]=8,V++,Ae[8]++;for(;V<=255;)Z[2*V+1]=9,V++,Ae[9]++;for(;V<=279;)Z[2*V+1]=7,V++,Ae[7]++;for(;V<=287;)Z[2*V+1]=8,V++,Ae[8]++;for(at(Z,p+1,Ae),V=0;V<g;V++)R[2*V+1]=5,R[2*V]=Ze(V,5);$=new we(Z,N,f+1,p,k),ee=new we(R,H,0,g,k),Q=new we(new Array(0),z,0,m,S)})(),F=!0),O.l_desc=new ce(O.dyn_ltree,$),O.d_desc=new ce(O.dyn_dtree,ee),O.bl_desc=new ce(O.bl_tree,Q),O.bi_buf=0,O.bi_valid=0,Qe(O)},o._tr_stored_block=Y,o._tr_flush_block=function(O,V,oe,U){var G,ge,Ae=0;0<O.level?(O.strm.data_type===2&&(O.strm.data_type=(function(Se){var Te,Ye=4093624447;for(Te=0;Te<=31;Te++,Ye>>>=1)if(1&Ye&&Se.dyn_ltree[2*Te]!==0)return s;if(Se.dyn_ltree[18]!==0||Se.dyn_ltree[20]!==0||Se.dyn_ltree[26]!==0)return a;for(Te=32;Te<f;Te++)if(Se.dyn_ltree[2*Te]!==0)return a;return s})(O)),ne(O,O.l_desc),ne(O,O.d_desc),Ae=(function(Se){var Te;for(A(Se,Se.dyn_ltree,Se.l_desc.max_code),A(Se,Se.dyn_dtree,Se.d_desc.max_code),ne(Se,Se.bl_desc),Te=m-1;3<=Te&&Se.bl_tree[2*B[Te]+1]===0;Te--);return Se.opt_len+=3*(Te+1)+5+5+4,Te})(O),G=O.opt_len+3+7>>>3,(ge=O.static_len+3+7>>>3)<=G&&(G=ge)):G=ge=oe+5,oe+4<=G&&V!==-1?Y(O,V,oe,U):O.strategy===4||ge===G?(Ee(O,2+(U?1:0),3),Ue(O,Z,R)):(Ee(O,4+(U?1:0),3),(function(Se,Te,Ye,rt){var ht;for(Ee(Se,Te-257,5),Ee(Se,Ye-1,5),Ee(Se,rt-4,4),ht=0;ht<rt;ht++)Ee(Se,Se.bl_tree[2*B[ht]+1],3);ie(Se,Se.dyn_ltree,Te-1),ie(Se,Se.dyn_dtree,Ye-1)})(O,O.l_desc.max_code+1,O.d_desc.max_code+1,Ae+1),Ue(O,O.dyn_ltree,O.dyn_dtree)),Qe(O),U&&At(O)},o._tr_tally=function(O,V,oe){return O.pending_buf[O.d_buf+2*O.last_lit]=V>>>8&255,O.pending_buf[O.d_buf+2*O.last_lit+1]=255&V,O.pending_buf[O.l_buf+O.last_lit]=255&oe,O.last_lit++,V===0?O.dyn_ltree[2*oe]++:(O.matches++,V--,O.dyn_ltree[2*(x[oe]+f+1)]++,O.dyn_dtree[2*be(V)]++),O.last_lit===O.lit_bufsize-1},o._tr_align=function(O){Ee(O,2,3),Pe(O,w,Z),(function(V){V.bi_valid===16?(ve(V,V.bi_buf),V.bi_buf=0,V.bi_valid=0):8<=V.bi_valid&&(V.pending_buf[V.pending++]=255&V.bi_buf,V.bi_buf>>=8,V.bi_valid-=8)})(O)}},{"../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,p=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(b){process.nextTick(function(){S(b)})}:(function(){if(s.postMessage&&!s.importScripts){var b=!0,T=s.onmessage;return s.onmessage=function(){b=!1},s.postMessage("","*"),s.onmessage=T,b}})()?(f="setImmediate$"+Math.random()+"$",s.addEventListener?s.addEventListener("message",w,!1):s.attachEvent("onmessage",w),function(b){s.postMessage(f+b,"*")}):s.MessageChannel?((d=new MessageChannel).port1.onmessage=function(b){S(b.data)},function(b){d.port2.postMessage(b)}):v&&"onreadystatechange"in v.createElement("script")?(c=v.documentElement,function(b){var T=v.createElement("script");T.onreadystatechange=function(){S(b),T.onreadystatechange=null,c.removeChild(T),T=null},c.appendChild(T)}):function(b){setTimeout(S,0,b)},k.setImmediate=function(b){typeof b!="function"&&(b=new Function(""+b));for(var T=new Array(arguments.length-1),L=0;L<T.length;L++)T[L]=arguments[L+1];return g[p]={callback:b,args:T},l(p),p++},k.clearImmediate=C}function C(b){delete g[b]}function S(b){if(m)setTimeout(S,0,b);else{var T=g[b];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(b),m=!1}}}}function w(b){b.source===s&&typeof b.data=="string"&&b.data.indexOf(f)===0&&S(+b.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)})})),Ar="application/vnd.openxmlformats-officedocument.wordprocessingml.document",Ea="application/pdf",ku="text/html",AT={docx:Ar,pdf:Ea,html:ku},wp={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"};Rt();var IT=I2(_T(),1),ET=e=>typeof e!="string"?"":e.trim(),Ey=e=>{if(typeof e!="string")return"";const t=e.trim();return t?t.toLowerCase():""},Cp=e=>{if(typeof e!="string")return"";const t=e.trim();return t?t.toLowerCase():""},gc=e=>{const t=e??{},n=ET(t.id),r=Ey(t.email);return{id:n,email:r,name:typeof t.name=="string"?t.name:"",hasId:n.length>0,hasEmail:r.length>0}},BC=({current:e,other:t})=>{const n=gc(e),r=gc(t);return n.hasId&&r.hasId?n.id===r.id:n.hasEmail&&r.hasEmail?n.email===r.email:!1},Su=({actor:e,fallbackKey:t=""})=>{const n=gc(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 TT(e){return typeof e.captureStackTrace=="function"}var kp=class extends Error{constructor(e,t){super(e),this.cause=t,this.name="FileObjectError",TT(Error)&&Error.captureStackTrace(this,this.constructor)}},xT=class extends kp{constructor(e){super("Invalid data URI format: URI must contain exactly one comma separator"),this.uri=e,this.name="InvalidDataUriError"}},RT=class extends kp{constructor(e,t){super(`Failed to fetch file from URL: ${e}`,t),this.url=e,this.name="FetchFailedError"}},Ty=async(e,t,n)=>{try{if(e.startsWith("data:")&&e.includes(";base64,")){const i=e.split(",");if(i.length!==2)throw new xT(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 RT(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 kp?r:new kp("Failed to create file object",r)}};function LT(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 Sp=new WeakMap;function zC(e){return e.ownerDocument??document}function VC(e,t){const n=Sp.get(t);n?.bindings.delete(e),n&&n.bindings.size===0&&(t.removeEventListener("click",n.listener),Sp.delete(t))}function jC(e,t){const n=zC(e);e.__clickOutsideDocument&&e.__clickOutsideDocument!==n&&VC(e,e.__clickOutsideDocument);let r=Sp.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},Sp.set(n,r),n.addEventListener("click",i)}r.bindings.set(e,t),e.__clickOutsideHandler=r.listener,e.__clickOutsideDocument=n}var xy={mounted(e,t){jC(e,t)},updated(e,t){jC(e,t)},unmounted(e){VC(e,e.__clickOutsideDocument??zC(e)),delete e.__clickOutsideHandler,delete e.__clickOutsideDocument}};function MT(e){return e[1].user!==void 0}var DT=(e,t)=>{const n=new Set;return Array.from(t.entries()).filter(MT).filter(([r,o])=>{const i=Su({actor:o.user,fallbackKey:r});return!i||n.has(i)?!1:(n.add(i),!0)}).map(([r,o])=>{const i=Su({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}})},OT=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},PT="https://ingest.superdoc.dev/v1/collect",j$="community-and-eval-agplv3";function FT(){try{return"2.11.0"}catch{return"unknown"}}var NT=class{constructor(e){this.enabled=e.enabled,this.endpoint=e.endpoint||PT,this.licenseKey=e.licenseKey||"",this.metadata=e.metadata,this.superdocVersion=FT()}getBrowserInfo(){return typeof window>"u"?{userAgent:"",currentUrl:"",hostname:"",screenSize:{width:0,height:0}}:{userAgent:window.navigator.userAgent,currentUrl:window.location.origin,hostname:window.location.hostname,screenSize:{width:window.screen.width,height:window.screen.height}}}trackDocumentOpen(e,t=null){if(!this.enabled)return;const n={timestamp:new Date().toISOString(),documentId:e,documentCreatedAt:t};this.sendEvent(n)}async sendEvent(e){const t={superdocVersion:this.superdocVersion,browserInfo:this.getBrowserInfo(),...this.metadata&&{metadata:this.metadata},events:[e]};try{await fetch(this.endpoint,{method:"POST",headers:{"Content-Type":"application/json","X-License-Key":this.licenseKey},body:JSON.stringify(t),credentials:"omit"})}catch{}}},_p={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"},U$=[_p.INLINE_SDT_LABEL,_p.BLOCK_SDT_LABEL],UC={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"},BT=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"}}},H$=`.${_p.BLOCK_SDT}[${UC.SDT_ID}]`,$$=`[${UC.DRAGGABLE}="true"]`,zT=typeof window<"u",HC,Cf=e=>HC=e,$C=Symbol();function Ry(e){return e&&typeof e=="object"&&Object.prototype.toString.call(e)==="[object Object]"&&typeof e.toJSON!="function"}var kf;(function(e){e.direct="direct",e.patchObject="patch object",e.patchFunction="patch function"})(kf||(kf={}));var GC=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 VT(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 Ly(e,t,n){const r=new XMLHttpRequest;r.open("GET",e),r.responseType="blob",r.onload=function(){jT(r.response,t,n)},r.onerror=function(){console.error("could not download file")},r.send()}function WC(e){const t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch{}return t.status>=200&&t.status<=299}function Ap(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 Ip=typeof navigator=="object"?navigator:{userAgent:""},KC=/Macintosh/.test(Ip.userAgent)&&/AppleWebKit/.test(Ip.userAgent)&&!/Safari/.test(Ip.userAgent),jT=zT?typeof HTMLAnchorElement<"u"&&"download"in HTMLAnchorElement.prototype&&!KC?UT:"msSaveOrOpenBlob"in Ip?HT:$T:()=>{};function UT(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?WC(r.href)?Ly(e,t,n):(r.target="_blank",Ap(r)):Ap(r)):(r.href=URL.createObjectURL(e),setTimeout(function(){URL.revokeObjectURL(r.href)},4e4),setTimeout(function(){Ap(r)},0))}function HT(e,t="download",n){if(typeof e=="string")if(WC(e))Ly(e,t,n);else{const r=document.createElement("a");r.href=e,r.target="_blank",setTimeout(function(){Ap(r)})}else navigator.msSaveOrOpenBlob(VT(e,n),t)}function $T(e,t,n,r){if(r=r||open("","_blank"),r&&(r.document.title=r.document.body.innerText="downloading..."),typeof e=="string")return Ly(e,t,n);const o=e.type==="application/octet-stream",i=/constructor/i.test(String(GC.HTMLElement))||"safari"in GC,s=/CriOS\/[\d]+/.test(navigator.userAgent);if((s||o&&i||KC)&&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:G$}=Object;function GT(){const e=Ng(!0),t=e.run(()=>te({}));let n=[],r=[];const o=ro({install(i){Cf(o),o._a=i,i.provide($C,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 qC=()=>{};function YC(e,t,n,r=qC){e.add(t);const o=()=>{e.delete(t)&&r()};return!n&&Bg()&&V2(o),o}function _u(e,...t){e.forEach(n=>{n(...t)})}var WT=e=>e(),XC=Symbol(),My=Symbol();function Dy(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];Ry(o)&&Ry(r)&&e.hasOwnProperty(n)&&!dr(r)&&!Ni(r)?e[n]=Dy(o,r):e[n]=r}return e}var KT=Symbol();function qT(e){return!Ry(e)||!Object.prototype.hasOwnProperty.call(e,KT)}var{assign:yl}=Object;function YT(e){return!!(dr(e)&&e.effect)}function XT(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=Z2(n.state.value[e]);return yl(d,i,Object.keys(s||{}).reduce((f,p)=>(f[p]=ro(Ce(()=>{Cf(n);const g=n._s.get(e);return s[p].call(g,g)})),f),{}))}return l=ZC(e,c,t,n,r,!0),l}function ZC(e,t,n={},r,o,i){let s;const a=yl({actions:{}},n),l={deep:!0};let c,d,f=new Set,p=new Set,g;const m=r.state.value[e];!i&&!m&&(r.state.value[e]={});let v;function k(L){let N;c=d=!1,typeof L=="function"?(L(r.state.value[e]),N={type:kf.patchFunction,storeId:e,events:g}):(Dy(r.state.value[e],L),N={type:kf.patchObject,payload:L,storeId:e,events:g});const H=v=Symbol();kt().then(()=>{v===H&&(c=!0)}),d=!0,_u(f,N,r.state.value[e])}const C=i?function(){const{state:N}=n,H=N?N():{};this.$patch(z=>{yl(z,H)})}:qC;function S(){s.stop(),f.clear(),p.clear(),r._s.delete(e)}const w=(L,N="")=>{if(XC in L)return L[My]=N,L;const H=function(){Cf(r);const z=Array.from(arguments),B=new Set,Z=new Set;function R(W){B.add(W)}function K(W){Z.add(W)}_u(p,{args:z,name:H[My],store:b,after:R,onError:K});let x;try{x=L.apply(this&&this.$id===e?this:b,z)}catch(W){throw _u(Z,W),W}return x instanceof Promise?x.then(W=>(_u(B,W),W)).catch(W=>(_u(Z,W),Promise.reject(W))):(_u(B,x),x)};return H[XC]=!0,H[My]=N,H},b=no({_p:r,$id:e,$onAction:YC.bind(null,p),$patch:k,$reset:C,$subscribe(L,N={}){const H=YC(f,L,N.detached,()=>z()),z=s.run(()=>Bt(()=>r.state.value[e],B=>{(N.flush==="sync"?d:c)&&L({storeId:e,type:kf.direct,events:g},B)},yl({},l,N)));return H},$dispose:S});r._s.set(e,b);const T=(r._a&&r._a.runWithContext||WT)(()=>r._e.run(()=>(s=Ng()).run(()=>t({action:w}))));for(const L in T){const N=T[L];dr(N)&&!YT(N)||Ni(N)?i||(m&&qT(N)&&(dr(N)?N.value=m[L]:Dy(N,m[L])),r.state.value[e][L]=N):typeof N=="function"&&(T[L]=w(N,L),a.actions[L]=N)}return yl(b,T),yl(gn(b),T),Object.defineProperty(b,"$state",{get:()=>r.state.value[e],set:L=>{k(N=>{yl(N,L)})}}),r._p.forEach(L=>{yl(b,s.run(()=>L({store:b,app:r._a,pinia:r,options:a})))}),m&&i&&n.hydrate&&n.hydrate(b.$state,m),c=!0,d=!0,b}function QC(e,t,n){let r;const o=typeof t=="function";r=o?n:t;function i(s,a){const l=A1();return s=s||(l?ll($C,null):null),s&&Cf(s),s=HC,s._s.has(e)||(o?ZC(e,t,r,s):XT(e,r,s)),s._s.get(e)}return i.$id=e,i}function Ns(e){const t=gn(e),n={};for(const r in t){const o=t[r];o.effect?n[r]=Ce({get:()=>e[r],set(i){e[r]=i}}):(dr(o)||Ni(o))&&(n[r]=Wg(e,r))}return n}var Sf=(e,t="document")=>{if(!e)return null;if(typeof File=="function"&&e instanceof File)return e;if(typeof Blob=="function"&&e instanceof Blob){if(typeof File=="function"){const n=e.name||t;return new File([e],n,{type:e.type})}return e}return e.originFileObj?Sf(e.originFileObj,e.name||t):e.file?Sf(e.file,e.name||t):e.raw?Sf(e.raw,e.name||t):null},JC=Object.getOwnPropertyDescriptor(ArrayBuffer.prototype,"byteLength")?.get,ZT=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Uint8Array.prototype),Symbol.toStringTag)?.get,bl=e=>{if(ArrayBuffer.isView(e))return ZT?.call(e)==="Uint8Array";if(!JC)return!1;try{return JC.call(e),!0}catch{return!1}},Oy=e=>{if(e instanceof Uint8Array)return e;const t=ArrayBuffer.isView(e)?e:new Uint8Array(e);return Uint8Array.from(t)},Py=(e,t)=>new Blob([Oy(e)],{type:t}),Fy=e=>{switch(e.toLowerCase()){case"docx":case Ar:return Ar;case"pdf":case Ea:return Ea;case"html":case ku:return ku;default:return e}},Ep=(e="")=>{const t=String(e).toLowerCase();return t.endsWith(".docx")?Ar:t.endsWith(".pdf")?Ea:t.endsWith(".html")||t.endsWith(".htm")?ku:t.endsWith(".md")||t.endsWith(".markdown")?"text/markdown":""},QT=e=>e==="application/vnd.openxmlformats-officedocument.wordprocessingml.document"?"document.docx":e==="application/pdf"?"document.pdf":e==="text/html"?"document.html":"document",JT="application/octet-stream",Ny=e=>{if(bl(e))return{type:Ar,data:Oy(e),name:"document.docx"};const t=Sf(e);if(t){const n=e&&typeof e.name=="string"?e.name:"",r=t.name||"",o=Ep(n),i=o||Ep(r),s=t.type.toLowerCase()===JT,a=s&&o?n:r||n||"document",l=s&&i?i:t.type||i||"application/vnd.openxmlformats-officedocument.wordprocessingml.document";let c=t;return s&&i&&typeof File=="function"&&t instanceof File?c=new File([t],a,{type:l,lastModified:t.lastModified}):s&&i&&typeof Blob=="function"&&t instanceof Blob&&(c=new Blob([t],{type:l})),{type:l,data:c,name:a}}if(e&&typeof e=="object"&&"data"in e){if(bl(e.data)){const r=Fy(e.type||Ep(e.name)||"application/vnd.openxmlformats-officedocument.wordprocessingml.document");return{...e,type:r,data:r==="application/vnd.openxmlformats-officedocument.wordprocessingml.document"?Oy(e.data):Py(e.data,r),name:e.name||QT(r)}}const n=Sf(e.data,e.name);if(n){const r=typeof e.type=="string"&&e.type?Fy(e.type):"",o=r||n.type||Ep(n.name)||"application/vnd.openxmlformats-officedocument.wordprocessingml.document",i=!n.type||!!(r&&n.type!==r);let s=n;return i&&typeof File=="function"&&n instanceof File?s=new File([n],n.name,{type:o,lastModified:n.lastModified}):i&&typeof Blob=="function"&&n instanceof Blob&&(s=new Blob([n],{type:o})),{...e,type:o,data:s,name:e.name||n.name||"document"}}}if(e&&typeof e=="object"&&"url"in e&&typeof e.type=="string"){const n=Fy(e.type);if(n!==e.type)return{...e,type:n}}return e};Rt();function ex(e,t){const n=e.itemid,r=e,o=t!==null&&typeof t=="object"?no({...t}):te(t),i=te(null);return Bt(o,(a,l)=>{const c={fieldId:n.value,changeTime:Date.now(),oldValue:l,newValue:a,originalField:r};i.value=c}),{value:o}}function tx(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}=ex(e,i,te([])),l=te(e.itemtype),c=te(e.itemfieldtype),d=e,f=no({fontFamily:e.fontfamily||"Arial",fontSize:e.font_size||"12pt",originalFontSize:e.original_font_size||"12pt"}),p=te(e.logicrules),g=te(!1),m=no({}),v={SELECT:rx,IMAGEINPUT:nx,CHECKBOXINPUT:ox};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:p,hidden:g,originalJSON:d,fieldStyle:f,valueGetter:e.valueGetter,...m}}function nx(e){return{fontfamily:te(e.fontfamily),iteminputtype:te(e.iteminputtype)}}function rx(e){return{options:te(e.itemoptions)}}function ox(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 Bs=()=>new Map,By=e=>{const t=Bs();return e.forEach((n,r)=>{t.set(r,n)}),t},Au=(e,t,n)=>{let r=e.get(t);return r===void 0&&e.set(t,r=n()),r},ix=(e,t)=>{const n=[];for(const[r,o]of e)n.push(t(o,r));return n},sx=(e,t)=>{for(const[n,r]of e)if(t(r,n))return!0;return!1},Iu=()=>new Set,zy=e=>e[e.length-1],Eu=Array.from,Vy=(e,t)=>{for(let n=0;n<e.length;n++)if(!t(e[n],n,e))return!1;return!0},e3=(e,t)=>{for(let n=0;n<e.length;n++)if(t(e[n],n,e))return!0;return!1},ax=(e,t)=>{const n=new Array(e);for(let r=0;r<e;r++)n[r]=t(r,n);return n},Tp=Array.isArray,lx=class{constructor(){this._observers=Bs()}on(e,t){return Au(this._observers,e,Iu).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 Eu((this._observers.get(e)||Bs()).values()).forEach(n=>n(...t))}destroy(){this._observers=Bs()}},Ta=Math.floor,xp=Math.abs,t3=(e,t)=>e<t?e:t,Tu=(e,t)=>e>t?e:t,W$=Number.isNaN,cx=e=>e!==0?e<0:1/e<0,K$=1,q$=2,Y$=4,X$=8,Z$=32,Q$=64,J$=128,ux=1<<17,dx=1<<18,fx=1<<19,hx=1<<20,px=1<<21,mx=1<<22,gx=1<<23,vx=1<<24,yx=1<<25,bx=1<<26,wx=1<<27,Cx=1<<28,kx=1<<29,Sx=1<<30,eG=31,tG=63,nG=127,rG=ux-1,oG=dx-1,iG=fx-1,sG=hx-1,aG=px-1,lG=mx-1,cG=gx-1,uG=vx-1,dG=yx-1,fG=bx-1,hG=wx-1,pG=Cx-1,mG=kx-1,gG=Sx-1,vG=2147483647,n3=Number.MAX_SAFE_INTEGER,r3=Number.MIN_SAFE_INTEGER,_x=Number.isInteger||(e=>typeof e=="number"&&isFinite(e)&&Ta(e)===e),yG=Number.isNaN,bG=Number.parseInt,o3=String.fromCharCode,wG=String.fromCodePoint,CG=o3(65535),Ax=e=>e.toLowerCase(),Ix=/^\s*/g,Ex=e=>e.replace(Ix,""),Tx=/([A-Z])/g,i3=(e,t)=>Ex(e.replace(Tx,n=>`${t}${Ax(n)}`)),xx=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},_f=typeof TextEncoder<"u"?new TextEncoder:null,Rx=e=>_f.encode(e),Lx=_f?Rx:xx,jy=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});jy&&jy.decode(new Uint8Array).length===1&&(jy=null);var Mx=(e,t)=>ax(t,()=>e).join(""),Af=class{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}},Uy=()=>new Af,Dx=e=>{let t=e.cpos;for(let n=0;n<e.bufs.length;n++)t+=e.bufs[n].length;return t},xa=e=>{const t=new Uint8Array(Dx(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},Ox=(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(Tu(n,t)*2),e.cpos=0)},ho=(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},Hy=ho,Jn=(e,t)=>{for(;t>127;)ho(e,128|127&t),t=Ta(t/128);ho(e,127&t)},$y=(e,t)=>{const n=cx(t);for(n&&(t=-t),ho(e,(t>63?128:0)|(n?64:0)|63&t),t=Ta(t/64);t>0;)ho(e,(t>127?128:0)|127&t),t=Ta(t/128)},Gy=new Uint8Array(3e4),Px=Gy.length/3,Fx=(e,t)=>{if(t.length<Px){const n=_f.encodeInto(t,Gy).written||0;Jn(e,n);for(let r=0;r<n;r++)ho(e,Gy[r])}else _i(e,Lx(t))},Nx=(e,t)=>{const n=unescape(encodeURIComponent(t)),r=n.length;Jn(e,r);for(let o=0;o<r;o++)ho(e,n.codePointAt(o))},xu=_f&&_f.encodeInto?Fx:Nx,Wy=(e,t)=>{const n=e.cbuf.length,r=e.cpos,o=t3(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(Tu(n*2,i)),e.cbuf.set(t.subarray(o)),e.cpos=i)},_i=(e,t)=>{Jn(e,t.byteLength),Wy(e,t)},Ky=(e,t)=>{Ox(e,t);const n=new DataView(e.cbuf.buffer,e.cpos,t);return e.cpos+=t,n},Bx=(e,t)=>Ky(e,4).setFloat32(0,t,!1),zx=(e,t)=>Ky(e,8).setFloat64(0,t,!1),Vx=(e,t)=>Ky(e,8).setBigInt64(0,t,!1),s3=new DataView(new ArrayBuffer(4)),jx=e=>(s3.setFloat32(0,e),s3.getFloat32(0)===e),If=(e,t)=>{switch(typeof t){case"string":ho(e,119),xu(e,t);break;case"number":_x(t)&&xp(t)<=2147483647?(ho(e,125),$y(e,t)):jx(t)?(ho(e,124),Bx(e,t)):(ho(e,123),zx(e,t));break;case"bigint":ho(e,122),Vx(e,t);break;case"object":if(t===null)ho(e,126);else if(Tp(t)){ho(e,117),Jn(e,t.length);for(let n=0;n<t.length;n++)If(e,t[n])}else if(t instanceof Uint8Array)ho(e,116),_i(e,t);else{ho(e,118);const n=Object.keys(t);Jn(e,n.length);for(let r=0;r<n.length;r++){const o=n[r];xu(e,o),If(e,t[o])}}break;case"boolean":ho(e,t?120:121);break;default:ho(e,127)}},a3=class extends Af{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)}},l3=e=>{e.count>0&&($y(e.encoder,e.count===1?e.s:-e.s),e.count>1&&Jn(e.encoder,e.count-2))},Rp=class{constructor(){this.encoder=new Af,this.s=0,this.count=0}write(e){this.s===e?this.count++:(l3(this),this.count=1,this.s=e)}toUint8Array(){return l3(this),xa(this.encoder)}},c3=e=>{if(e.count>0){const t=e.diff*2+(e.count===1?0:1);$y(e.encoder,t),e.count>1&&Jn(e.encoder,e.count-2)}},qy=class{constructor(){this.encoder=new Af,this.s=0,this.count=0,this.diff=0}write(e){this.diff===e-this.s?(this.s=e,this.count++):(c3(this),this.count=1,this.diff=e-this.s,this.s=e)}toUint8Array(){return c3(this),xa(this.encoder)}},Ux=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 Af;return this.sarr.push(this.s),this.s="",xu(e,this.sarr.join("")),Wy(e,this.lensE.toUint8Array()),xa(e)}},wl=e=>new Error(e),os=()=>{throw wl("Method unimplemented")},Ra=()=>{throw wl("Unexpected case")},kG=crypto.subtle,Hx=crypto.getRandomValues.bind(crypto),u3=()=>Hx(new Uint32Array(1))[0],$x="10000000-1000-4000-8000-100000000000",Gx=()=>$x.replace(/[018]/g,e=>(e^u3()&15>>e/4).toString(16)),Wx=Date.now,d3=e=>new Promise(e),SG=Promise.all.bind(Promise),f3=e=>e===void 0?null:e,Kx=class{constructor(){this.map=new Map}setItem(e,t){this.map.set(e,t)}getItem(e){return this.map.get(e)}},h3=new Kx,qx=!0;try{typeof localStorage<"u"&&localStorage&&(h3=localStorage,qx=!1)}catch{}var Yx=h3,Ef=Symbol("Equality"),p3=(e,t)=>e===t||!!e?.[Ef]?.(t)||!1,Xx=e=>typeof e=="object",Zx=Object.assign,Qx=Object.keys,Jx=(e,t)=>{for(const n in e)t(e[n],n)},Lp=e=>Qx(e).length,e6=e=>{for(const t in e)return!1;return!0},Tf=(e,t)=>{for(const n in e)if(!t(e[n],n))return!1;return!0},Yy=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),t6=(e,t)=>e===t||Lp(e)===Lp(t)&&Tf(e,(n,r)=>(n!==void 0||Yy(t,r))&&p3(t[r],n)),n6=Object.freeze,m3=e=>{for(const t in e){const n=e[t];(typeof n=="object"||typeof n=="function")&&m3(e[t])}return n6(e)},Xy=(e,t,n=0)=>{try{for(;n<e.length;n++)e[n](...t)}finally{n<e.length&&Xy(e,t,n+1)}},Mp=(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[Ef]!=null)return e[Ef](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)||!Mp(e.get(n),t.get(n)))return!1;break;case void 0:case Object:if(Lp(e)!==Lp(t))return!1;for(const n in e)if(!Yy(e,n)||!Mp(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(!Mp(e[n],t[n]))return!1;break;default:return!1}return!0},r6=(e,t)=>t.includes(e),xf=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]",_G=typeof navigator<"u"?/Mac/.test(navigator.platform):!1,zs,o6=[],i6=()=>{if(zs===void 0)if(xf){zs=Bs();const e=process.argv;let t=null;for(let n=0;n<e.length;n++){const r=e[n];r[0]==="-"?(t!==null&&zs.set(t,""),t=r):t!==null?(zs.set(t,r),t=null):o6.push(r)}t!==null&&zs.set(t,"")}else typeof location=="object"?(zs=Bs(),(location.search||"?").slice(1).split("&").forEach(e=>{if(e.length!==0){const[t,n]=e.split("=");zs.set(`--${i3(t,"-")}`,n),zs.set(`-${i3(t,"-")}`,n)}})):zs=Bs();return zs},Zy=e=>i6().has(e),Dp=e=>f3(xf?process.env[e.toUpperCase().replaceAll("-","_")]:Yx.getItem(e)),g3=e=>Zy("--"+e)||Dp(e)!==null,s6=g3("production"),a6=xf&&r6(process.env.FORCE_COLOR,["true","1","2"]),l6=a6||!Zy("--no-colors")&&!g3("no-color")&&(!xf||process.stdout.isTTY)&&(!xf||Zy("--color")||Dp("COLORTERM")!==null||(Dp("TERM")||"").includes("color")),c6=class{constructor(e,t){this.left=e,this.right=t}},La=(e,t)=>new c6(e,t),v3=e=>e.next()>=.5,Qy=(e,t,n)=>Ta(e.next()*(n+1-t)+t),y3=(e,t,n)=>Ta(e.next()*(n+1-t)+t),Jy=(e,t,n)=>y3(e,t,n),u6=e=>o3(Jy(e,97,122)),d6=(e,t=0,n=20)=>{const r=Jy(e,t,n);let o="";for(let i=0;i<r;i++)o+=u6(e);return o},e0=(e,t)=>t[Jy(e,0,t.length-1)],f6=Symbol("0schema"),h6=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(Mx(" ",(this._rerrs.length-t)*2)+`${n.path!=null?`[${n.path}] `:""}${n.has} doesn't match ${n.expected}. ${n.message}`)}return e.join(`
|
|
4
|
+
\0`,Ee+=i(ce,2),Ee+=L.magic,Ee+=i(w,2),Ee+=i(b,2),Ee+=i(we.crc32,4),Ee+=i(we.compressedSize,4),Ee+=i(we.uncompressedSize,4),Ee+=i(H.length,2),Ee+=i(W.length,2),{fileRecord:f.LOCAL_FILE_HEADER+Ee+H+W,dirRecord:f.CENTRAL_FILE_HEADER+i(ve,2)+Ee+i(Z.length,2)+"\0\0\0\0"+i(be,4)+i(k,4)+H+W+Z}}var a=n("../utils"),l=n("../stream/GenericWorker"),c=n("../utf8"),d=n("../crc32"),f=n("../signature");function p(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(p,l),p.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}}))},p.prototype.openedSource=function(g){this.currentSourceOffset=this.bytesWritten,this.currentFile=g.file.name;var m=this.streamFiles&&!g.file.dir;if(m){var v=s(g,m,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:v.fileRecord,meta:{percent:0}})}else this.accumulate=!0},p.prototype.closedSource=function(g){this.accumulate=!1;var m=this.streamFiles&&!g.file.dir,v=s(g,m,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(v.dirRecord),m)this.push({data:(function(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},p.prototype.flush=function(){for(var g=this.bytesWritten,m=0;m<this.dirRecords.length;m++)this.push({data:this.dirRecords[m],meta:{percent:100}});var v=this.bytesWritten-g,k=(function(C,S,w,b,T){var L=a.transformTo("string",T(b));return f.CENTRAL_DIRECTORY_END+"\0\0\0\0"+i(C,2)+i(C,2)+i(S,4)+i(w,4)+i(L.length,2)+L})(this.dirRecords.length,v,g,this.zipComment,this.encodeFileName);this.push({data:k,meta:{percent:100}})},p.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},p.prototype.registerPrevious=function(g){this._sources.push(g);var m=this;return g.on("data",function(v){m.processChunk(v)}),g.on("end",function(){m.closedSource(m.previous.streamInfo),m._sources.length?m.prepareNextSource():m.end()}),g.on("error",function(v){m.error(v)}),this},p.prototype.resume=function(){return!!l.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},p.prototype.error=function(g){var m=this._sources;if(!l.prototype.error.call(this,g))return!1;for(var v=0;v<m.length;v++)try{m[v].error(g)}catch{}return!0},p.prototype.lock=function(){l.prototype.lock.call(this);for(var g=this._sources,m=0;m<g.length;m++)g[m].lock()},r.exports=p},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(n,r,o){"use strict";var i=n("../compressions"),s=n("./ZipFileWorker");o.generateWorker=function(a,l,c){var d=new s(l.streamFiles,c,l.platform,l.encodeFileName),f=0;try{a.forEach(function(p,g){f++;var m=(function(S,w){var b=S||w,T=i[b];if(!T)throw new Error(b+" 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:p,dir:k,date:C,comment:g.comment||"",unixPermissions:g.unixPermissions,dosPermissions:g.dosPermissions}).pipe(d)}),d.entriesCount=f}catch(p){d.error(p)}return d}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(n,r,o){"use strict";function i(){if(!(this instanceof i))return new i;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var s=new i;for(var a in this)typeof this[a]!="function"&&(s[a]=this[a]);return s}}(i.prototype=n("./object")).loadAsync=n("./load"),i.support=n("./support"),i.defaults=n("./defaults"),i.version="3.10.1",i.loadAsync=function(s,a){return new i().loadAsync(s,a)},i.external=n("./external"),r.exports=i},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(n,r,o){"use strict";var i=n("./utils"),s=n("./external"),a=n("./utf8"),l=n("./zipEntries"),c=n("./stream/Crc32Probe"),d=n("./nodejsUtils");function f(p){return new s.Promise(function(g,m){var v=p.decompressed.getContentWorker().pipe(new c);v.on("error",function(k){m(k)}).on("end",function(){v.streamInfo.crc32!==p.decompressed.crc32?m(new Error("Corrupted zip : CRC32 mismatch")):g()}).resume()})}r.exports=function(p,g){var m=this;return g=i.extend(g||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:a.utf8decode}),d.isNode&&d.isStream(p)?s.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):i.prepareContent("the loaded zip file",p,!0,g.optimizedBinaryString,g.base64).then(function(v){var 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 S=0;S<C.length;S++)k.push(f(C[S]));return s.Promise.all(k)}).then(function(v){for(var k=v.shift(),C=k.files,S=0;S<C.length;S++){var w=C[S],b=w.fileNameStr,T=i.resolve(w.fileNameStr);m.file(T,w.decompressed,{binary:!0,optimizedBinaryString:!0,date:w.date,dir:w.dir,comment:w.fileCommentStr.length?w.fileCommentStr:null,unixPermissions:w.unixPermissions,dosPermissions:w.dosPermissions,createFolders:g.createFolders}),w.dir||(m.file(T).unsafeOriginalName=b)}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,p){d.push(f)||d._helper.pause(),c&&c(p)}).on("error",function(f){d.emit("error",f)}).on("end",function(){d.push(null)})}n("../utils").inherits(s,i),s.prototype._read=function(){this._helper.resume()},r.exports=s},{"../utils":32,"readable-stream":16}],14:[function(n,r,o){"use strict";r.exports={isNode:typeof Buffer<"u",newBufferFrom:function(i,s){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(i,s);if(typeof i=="number")throw new Error('The "data" argument must not be a number');return new Buffer(i,s)},allocBuffer:function(i){if(Buffer.alloc)return Buffer.alloc(i);var s=new Buffer(i);return s.fill(0),s},isBuffer:function(i){return Buffer.isBuffer(i)},isStream:function(i){return i&&typeof i.on=="function"&&typeof i.pause=="function"&&typeof i.resume=="function"}}},{}],15:[function(n,r,o){"use strict";function i(b,T,L){var N,H=a.getTypeOf(T),z=a.extend(L||{},d);z.date=z.date||new Date,z.compression!==null&&(z.compression=z.compression.toUpperCase()),typeof z.unixPermissions=="string"&&(z.unixPermissions=parseInt(z.unixPermissions,8)),z.unixPermissions&&16384&z.unixPermissions&&(z.dir=!0),z.dosPermissions&&16&z.dosPermissions&&(z.dir=!0),z.dir&&(b=C(b)),z.createFolders&&(N=k(b))&&S.call(this,N,!0);var B=H==="string"&&z.binary===!1&&z.base64===!1;L&&L.binary!==void 0||(z.binary=!B),(T instanceof f&&T.uncompressedSize===0||z.dir||!T||T.length===0)&&(z.base64=!1,z.binary=!0,T="",z.compression="STORE",H="string");var Z=null;Z=T instanceof f||T instanceof l?T:m.isNode&&m.isStream(T)?new v(b,T):a.prepareContent(b,T,z.binary,z.optimizedBinaryString,z.base64);var R=new p(b,Z,z);this.files[b]=R}var s=n("./utf8"),a=n("./utils"),l=n("./stream/GenericWorker"),c=n("./stream/StreamHelper"),d=n("./defaults"),f=n("./compressedObject"),p=n("./zipObject"),g=n("./generate"),m=n("./nodejsUtils"),v=n("./nodejs/NodejsStreamInputAdapter"),k=function(b){b.slice(-1)==="/"&&(b=b.substring(0,b.length-1));var T=b.lastIndexOf("/");return 0<T?b.substring(0,T):""},C=function(b){return b.slice(-1)!=="/"&&(b+="/"),b},S=function(b,T){return T=T!==void 0?T:d.createFolders,b=C(b),this.files[b]||i.call(this,b,null,{dir:!0,createFolders:T}),this.files[b]};function w(b){return Object.prototype.toString.call(b)==="[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(b){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&&b(L,N)},filter:function(b){var T=[];return this.forEach(function(L,N){b(L,N)&&T.push(N)}),T},file:function(b,T,L){if(arguments.length!==1)return b=this.root+b,i.call(this,b,T,L),this;if(w(b)){var N=b;return this.filter(function(z,B){return!B.dir&&N.test(z)})}var H=this.files[this.root+b];return H&&!H.dir?H:null},folder:function(b){if(!b)return this;if(w(b))return this.filter(function(H,z){return z.dir&&b.test(H)});var T=this.root+b,L=S.call(this,T),N=this.clone();return N.root=L.name,N},remove:function(b){b=this.root+b;var T=this.files[b];if(T||(b.slice(-1)!=="/"&&(b+="/"),T=this.files[b]),T&&!T.dir)delete this.files[b];else for(var L=this.filter(function(H,z){return z.name.slice(0,b.length)===b}),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(b){var T,L={};try{if((L=a.extend(b||{},{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(b,T){return this.generateInternalStream(b).accumulate(T)},generateNodeStream:function(b,T){return(b=b||{}).type||(b.type="nodebuffer"),this.generateInternalStream(b).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),p=this.length-4;0<=p;--p)if(this.data[p]===l&&this.data[p+1]===c&&this.data[p+2]===d&&this.data[p+3]===f)return p-this.zero;return-1},s.prototype.readAndCheckSignature=function(a){var l=a.charCodeAt(0),c=a.charCodeAt(1),d=a.charCodeAt(2),f=a.charCodeAt(3),p=this.readData(4);return l===p[0]&&c===p[1]&&d===p[2]&&f===p[3]},s.prototype.readData=function(a){if(this.checkOffset(a),a===0)return[];var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=s},{"../utils":32,"./DataReader":18}],18:[function(n,r,o){"use strict";var i=n("../utils");function s(a){this.data=a,this.length=a.length,this.index=0,this.zero=0}s.prototype={checkOffset:function(a){this.checkIndex(this.index+a)},checkIndex:function(a){if(this.length<this.zero+a||a<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+a+"). Corrupted zip ?")},setIndex:function(a){this.checkIndex(a),this.index=a},skip:function(a){this.setIndex(this.index+a)},byteAt:function(){},readInt:function(a){var l,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 p=i.getTypeOf(f);return i.checkSupport(p),p!=="string"||s.uint8array?p==="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 p(m,v){return new d.Promise(function(k,C){var S=[],w=m._internalType,b=m._outputType,T=m._mimeType;m.on("data",function(L,N){S.push(L),v&&v(N)}).on("error",function(L){S=[],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)}})(b,(function(L,N){var H,z=0,B=null,Z=0;for(H=0;H<N.length;H++)Z+=N[H].length;switch(L){case"string":return N.join("");case"array":return Array.prototype.concat.apply([],N);case"uint8array":for(B=new Uint8Array(Z),H=0;H<N.length;H++)B.set(N[H],z),z+=N[H].length;return B;case"nodebuffer":return Buffer.concat(N);default:throw new Error("concat : unsupported type '"+L+"'")}})(w,S),T))}catch(L){C(L)}S=[]}).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(S){this._worker=new a("error"),this._worker.error(S)}}g.prototype={accumulate:function(m){return p(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 p(){l.call(this,"utf-8 encode")}o.utf8encode=function(g){return s.nodebuffer?a.newBufferFrom(g,"utf-8"):(function(m){var v,k,C,S,w,b=m.length,T=0;for(S=0;S<b;S++)(64512&(k=m.charCodeAt(S)))==55296&&S+1<b&&(64512&(C=m.charCodeAt(S+1)))==56320&&(k=65536+(k-55296<<10)+(C-56320),S++),T+=k<128?1:k<2048?2:k<65536?3:4;for(v=s.uint8array?new Uint8Array(T):new Array(T),S=w=0;w<T;S++)(64512&(k=m.charCodeAt(S)))==55296&&S+1<b&&(64512&(C=m.charCodeAt(S+1)))==56320&&(k=65536+(k-55296<<10)+(C-56320),S++),k<128?v[w++]=k:(k<2048?v[w++]=192|k>>>6:(k<65536?v[w++]=224|k>>>12:(v[w++]=240|k>>>18,v[w++]=128|k>>>12&63),v[w++]=128|k>>>6&63),v[w++]=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,S,w=m.length,b=new Array(2*w);for(v=k=0;v<w;)if((C=m[v++])<128)b[k++]=C;else if(4<(S=c[C]))b[k++]=65533,v+=S-1;else{for(C&=S===2?31:S===3?15:7;1<S&&v<w;)C=C<<6|63&m[v++],S--;1<S?b[k++]=65533:C<65536?b[k++]=C:(C-=65536,b[k++]=55296|C>>10&1023,b[k++]=56320|1023&C)}return b.length!==k&&(b.subarray?b=b.subarray(0,k):b.length=k),i.applyFromCharCode(b)})(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(S,w){var b;for((w=w||S.length)>S.length&&(w=S.length),b=w-1;0<=b&&(192&S[b])==128;)b--;return b<0||b===0?w:b+c[S[b]]>w?b:w})(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(p,l),p.prototype.processChunk=function(g){this.push({data:o.utf8encode(g.data),meta:g.meta})},o.Utf8EncodeWorker=p},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(n,r,o){"use strict";var i=n("./support"),s=n("./base64"),a=n("./nodejsUtils"),l=n("./external");function 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 S=[],w=0,b=v.length;if(b<=C)return String.fromCharCode.apply(null,v);for(;w<b;)k==="array"||k==="nodebuffer"?S.push(String.fromCharCode.apply(null,v.slice(w,Math.min(w+C,b)))):S.push(String.fromCharCode.apply(null,v.subarray(w,Math.min(w+C,b)))),w+=C;return S.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 p(v){var k=65536,C=o.getTypeOf(v),S=!0;if(C==="uint8array"?S=f.applyCanBeUsed.uint8array:C==="nodebuffer"&&(S=f.applyCanBeUsed.nodebuffer),S)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=p;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:p,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 p(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:p,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:p,array:function(v){return g(v,new Array(v.length))},arraybuffer:function(v){return m.nodebuffer.uint8array(v).buffer},uint8array:function(v){return g(v,new Uint8Array(v.length))},nodebuffer: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=[],S=0;S<k.length;S++){var w=k[S];w==="."||w===""&&S!==0&&S!==k.length-1||(w===".."?C.pop():C.push(w))}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,S="";for(C=0;C<(v||"").length;C++)S+="\\x"+((k=v.charCodeAt(C))<16?"0":"")+k.toString(16).toUpperCase();return S},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,S,w){return l.Promise.resolve(k).then(function(b){return i.blob&&(b instanceof Blob||["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(b))!==-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(b)}):b}).then(function(b){var T=o.getTypeOf(b);return T?(T==="arraybuffer"?b=o.transformTo("uint8array",b):T==="string"&&(w?b=s.decode(b):C&&S!==!0&&(b=(function(L){return d(L,i.uint8array?new Uint8Array(L.length):new Array(L.length))})(b))),b):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 p=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+s.pretty(p)+", expected "+s.pretty(f)+")")}},isSignature:function(f,p){var g=this.reader.index;this.reader.setIndex(f);var m=this.reader.readString(4)===p;return this.reader.setIndex(g),m},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var f=this.reader.readData(this.zipCommentLength),p=c.uint8array?"uint8array":"array",g=s.transformTo(p,f);this.zipComment=this.loadOptions.decodeFileName(g)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var f,p,g,m=this.zip64EndOfCentralSize-44;0<m;)f=this.reader.readInt(2),p=this.reader.readInt(4),g=this.reader.readData(p),this.zip64ExtensibleData[f]={id:f,length:p,value:g}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var f,p;for(f=0;f<this.files.length;f++)p=this.files[f],this.reader.setIndex(p.localHeaderOffset),this.checkSignature(a.LOCAL_FILE_HEADER),p.readLocalPart(this.reader),p.handleUTF8(),p.processAttributes()},readCentralDir:function(){var f;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(a.CENTRAL_FILE_HEADER);)(f=new l({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(f);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var f=this.reader.lastIndexOfSignature(a.CENTRAL_DIRECTORY_END);if(f<0)throw this.isSignature(0,a.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(f);var p=f;if(this.checkSignature(a.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===s.MAX_VALUE_16BITS||this.diskWithCentralDirStart===s.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===s.MAX_VALUE_16BITS||this.centralDirRecords===s.MAX_VALUE_16BITS||this.centralDirSize===s.MAX_VALUE_32BITS||this.centralDirOffset===s.MAX_VALUE_32BITS){if(this.zip64=!0,(f=this.reader.lastIndexOfSignature(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(f),this.checkSignature(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,a.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(a.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(a.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var g=this.centralDirOffset+this.centralDirSize;this.zip64&&(g+=20,g+=12+this.zip64EndOfCentralSize);var m=p-g;if(0<m)this.isSignature(p,a.CENTRAL_FILE_HEADER)||(this.reader.zero=m);else if(m<0)throw new Error("Corrupted zip: missing "+Math.abs(m)+" bytes.")},prepareReader:function(f){this.reader=i(f)},load:function(f){this.prepareReader(f),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},r.exports=d},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(n,r,o){"use strict";var i=n("./reader/readerFor"),s=n("./utils"),a=n("./compressedObject"),l=n("./crc32"),c=n("./utf8"),d=n("./compressions"),f=n("./support");function p(g,m){this.options=g,this.loadOptions=m}p.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(g){var m,v;if(g.skip(22),this.fileNameLength=g.readInt(2),v=g.readInt(2),this.fileName=g.readData(this.fileNameLength),g.skip(v),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if((m=(function(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=p},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(n,r,o){"use strict";function i(m,v,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 S=!this._dataBinary;S&&!C&&(v=v.pipe(new l.Utf8EncodeWorker)),!S&&C&&(v=v.pipe(new l.Utf8DecodeWorker))}catch(w){(v=new d("error")).error(w)}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"],p=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},g=0;g<f.length;g++)i.prototype[f[g]]=p;r.exports=i},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(n,r,o){(function(i){"use strict";var s,a,l=i.MutationObserver||i.WebKitMutationObserver;if(l){var 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 p=new i.MessageChannel;p.port1.onmessage=m,s=function(){p.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 p(C,S,w){this.promise=C,typeof S=="function"&&(this.onFulfilled=S,this.callFulfilled=this.otherCallFulfilled),typeof w=="function"&&(this.onRejected=w,this.callRejected=this.otherCallRejected)}function g(C,S,w){i(function(){var b;try{b=S(w)}catch(T){return a.reject(C,T)}b===C?a.reject(C,new TypeError("Cannot resolve promise with itself")):a.resolve(C,b)})}function m(C){var S=C&&C.then;if(C&&(typeof C=="object"||typeof C=="function")&&typeof S=="function")return function(){S.apply(C,arguments)}}function v(C,S){var w=!1;function b(N){w||(w=!0,a.reject(C,N))}function T(N){w||(w=!0,a.resolve(C,N))}var L=k(function(){S(T,b)});L.status==="error"&&b(L.value)}function k(C,S){var w={};try{w.value=C(S),w.status="success"}catch(b){w.status="error",w.value=b}return w}(r.exports=f).prototype.finally=function(C){if(typeof C!="function")return this;var S=this.constructor;return this.then(function(w){return S.resolve(C()).then(function(){return w})},function(w){return S.resolve(C()).then(function(){throw w})})},f.prototype.catch=function(C){return this.then(null,C)},f.prototype.then=function(C,S){if(typeof C!="function"&&this.state===c||typeof S!="function"&&this.state===l)return this;var w=new this.constructor(s);return this.state!==d?g(w,this.state===c?C:S,this.outcome):this.queue.push(new p(w,C,S)),w},p.prototype.callFulfilled=function(C){a.resolve(this.promise,C)},p.prototype.otherCallFulfilled=function(C){g(this.promise,this.onFulfilled,C)},p.prototype.callRejected=function(C){a.reject(this.promise,C)},p.prototype.otherCallRejected=function(C){g(this.promise,this.onRejected,C)},a.resolve=function(C,S){var w=k(m,S);if(w.status==="error")return a.reject(C,w.value);var b=w.value;if(b)v(C,b);else{C.state=c,C.outcome=S;for(var T=-1,L=C.queue.length;++T<L;)C.queue[T].callFulfilled(S)}return C},a.reject=function(C,S){C.state=l,C.outcome=S;for(var w=-1,b=C.queue.length;++w<b;)C.queue[w].callRejected(S);return C},f.resolve=function(C){return C instanceof this?C:a.resolve(new this(s),C)},f.reject=function(C){var S=new this(s);return a.reject(S,C)},f.all=function(C){var S=this;if(Object.prototype.toString.call(C)!=="[object Array]")return this.reject(new TypeError("must be an array"));var w=C.length,b=!1;if(!w)return this.resolve([]);for(var T=new Array(w),L=0,N=-1,H=new this(s);++N<w;)z(C[N],N);return H;function z(B,Z){S.resolve(B).then(function(R){T[Z]=R,++L!==w||b||(b=!0,a.resolve(H,T))},function(R){b||(b=!0,a.reject(H,R))})}},f.race=function(C){var S=this;if(Object.prototype.toString.call(C)!=="[object Array]")return this.reject(new TypeError("must be an array"));var w=C.length,b=!1;if(!w)return this.resolve([]);for(var T=-1,L=new this(s);++T<w;)N=C[T],S.resolve(N).then(function(H){b||(b=!0,a.resolve(L,H))},function(H){b||(b=!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,p=-1,g=0,m=8;function v(C){if(!(this instanceof v))return new v(C);this.options=s.assign({level:p,method:m,chunkSize:16384,windowBits:15,memLevel:8,strategy:g,to:""},C||{});var S=this.options;S.raw&&0<S.windowBits?S.windowBits=-S.windowBits:S.gzip&&0<S.windowBits&&S.windowBits<16&&(S.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new c,this.strm.avail_out=0;var w=i.deflateInit2(this.strm,S.level,S.method,S.windowBits,S.memLevel,S.strategy);if(w!==f)throw new Error(l[w]);if(S.header&&i.deflateSetHeader(this.strm,S.header),S.dictionary){var b;if(b=typeof S.dictionary=="string"?a.string2buf(S.dictionary):d.call(S.dictionary)==="[object ArrayBuffer]"?new Uint8Array(S.dictionary):S.dictionary,(w=i.deflateSetDictionary(this.strm,b))!==f)throw new Error(l[w]);this._dict_set=!0}}function k(C,S){var w=new v(S);if(w.push(C,!0),w.err)throw w.msg||l[w.err];return w.result}v.prototype.push=function(C,S){var w,b,T=this.strm,L=this.options.chunkSize;if(this.ended)return!1;b=S===~~S?S:S===!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),(w=i.deflate(T,b))!==1&&w!==f)return this.onEnd(w),!(this.ended=!0);T.avail_out!==0&&(T.avail_in!==0||b!==4&&b!==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)&&w!==1);return b===4?(w=i.deflateEnd(this.strm),this.onEnd(w),this.ended=!0,w===f):b!==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,S){return(S=S||{}).raw=!0,k(C,S)},o.gzip=function(C,S){return(S=S||{}).gzip=!0,k(C,S)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(n,r,o){"use strict";var i=n("./zlib/inflate"),s=n("./utils/common"),a=n("./utils/strings"),l=n("./zlib/constants"),c=n("./zlib/messages"),d=n("./zlib/zstream"),f=n("./zlib/gzheader"),p=Object.prototype.toString;function g(v){if(!(this instanceof g))return new g(v);this.options=s.assign({chunkSize:16384,windowBits:0,to:""},v||{});var 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,S,w,b,T,L,N=this.strm,H=this.options.chunkSize,z=this.options.dictionary,B=!1;if(this.ended)return!1;S=k===~~k?k:k===!0?l.Z_FINISH:l.Z_NO_FLUSH,typeof v=="string"?N.input=a.binstring2buf(v):p.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&&z&&(L=typeof z=="string"?a.string2buf(z):p.call(z)==="[object ArrayBuffer]"?new Uint8Array(z):z,C=i.inflateSetDictionary(this.strm,L)),C===l.Z_BUF_ERROR&&B===!0&&(C=l.Z_OK,B=!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||S!==l.Z_FINISH&&S!==l.Z_SYNC_FLUSH)||(this.options.to==="string"?(w=a.utf8border(N.output,N.next_out),b=N.next_out-w,T=a.buf2string(N.output,w),N.next_out=b,N.avail_out=H-b,b&&s.arraySet(N.output,N.output,w,b,0),this.onData(T)):this.onData(s.shrinkBuf(N.output,N.next_out)))),N.avail_in===0&&N.avail_out===0&&(B=!0)}while((0<N.avail_in||N.avail_out===0)&&C!==l.Z_STREAM_END);return C===l.Z_STREAM_END&&(S=l.Z_FINISH),S===l.Z_FINISH?(C=i.inflateEnd(this.strm),this.onEnd(C),this.ended=!0,C===l.Z_OK):S!==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,p){if(c.subarray&&l.subarray)l.set(c.subarray(d,d+f),p);else for(var g=0;g<f;g++)l[p+g]=c[d+g]},flattenChunks:function(l){var c,d,f,p,g,m;for(c=f=0,d=l.length;c<d;c++)f+=l[c].length;for(m=new Uint8Array(f),c=p=0,d=l.length;c<d;c++)g=l[c],m.set(g,p),p+=g.length;return m}},a={arraySet:function(l,c,d,f,p){for(var g=0;g<f;g++)l[p+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,p){if(p<65537&&(f.subarray&&a||!f.subarray&&s))return String.fromCharCode.apply(null,i.shrinkBuf(f,p));for(var g="",m=0;m<p;m++)g+=String.fromCharCode(f[m]);return g}l[254]=l[254]=1,o.string2buf=function(f){var p,g,m,v,k,C=f.length,S=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++),S+=g<128?1:g<2048?2:g<65536?3:4;for(p=new i.Buf8(S),v=k=0;k<S;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?p[k++]=g:(g<2048?p[k++]=192|g>>>6:(g<65536?p[k++]=224|g>>>12:(p[k++]=240|g>>>18,p[k++]=128|g>>>12&63),p[k++]=128|g>>>6&63),p[k++]=128|63&g);return p},o.buf2binstring=function(f){return d(f,f.length)},o.binstring2buf=function(f){for(var p=new i.Buf8(f.length),g=0,m=p.length;g<m;g++)p[g]=f.charCodeAt(g);return p},o.buf2string=function(f,p){var g,m,v,k,C=p||f.length,S=new Array(2*C);for(g=m=0;g<C;)if((v=f[g++])<128)S[m++]=v;else if(4<(k=l[v]))S[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?S[m++]=65533:v<65536?S[m++]=v:(v-=65536,S[m++]=55296|v>>10&1023,S[m++]=56320|1023&v)}return d(S,m)},o.utf8border=function(f,p){var g;for((p=p||f.length)>f.length&&(p=f.length),g=p-1;0<=g&&(192&f[g])==128;)g--;return g<0||g===0?p:g+l[f[g]]>p?g:p}},{"./common":41}],43:[function(n,r,o){"use strict";r.exports=function(i,s,a,l){for(var 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 p=c;p<f;p++)s=s>>>8^d[255&(s^a[p])];return-1^s}},{}],46:[function(n,r,o){"use strict";var i,s=n("../utils/common"),a=n("./trees"),l=n("./adler32"),c=n("./crc32"),d=n("./messages"),f=0,p=4,g=0,m=-2,v=-1,k=4,C=2,S=8,w=9,b=286,T=30,L=19,N=2*b+1,H=15,z=3,B=258,Z=B+z+1,R=42,K=113,x=1,W=2,$=3,ee=4;function Q(A,ie){return A.msg=d[ie],ie}function X(A){return(A<<1)-(4<A?9:0)}function we(A){for(var ie=A.length;0<=--ie;)A[ie]=0}function ce(A){var ie=A.state,F=ie.pending;F>A.avail_out&&(F=A.avail_out),F!==0&&(s.arraySet(A.output,ie.pending_buf,ie.pending_out,F,A.next_out),A.next_out+=F,ie.pending_out+=F,A.total_out+=F,A.avail_out-=F,ie.pending-=F,ie.pending===0&&(ie.pending_out=0))}function be(A,ie){a._tr_flush_block(A,0<=A.block_start?A.block_start:-1,A.strstart-A.block_start,ie),A.block_start=A.strstart,ce(A.strm)}function ve(A,ie){A.pending_buf[A.pending++]=ie}function Ee(A,ie){A.pending_buf[A.pending++]=ie>>>8&255,A.pending_buf[A.pending++]=255&ie}function Pe(A,ie){var F,Y,O=A.max_chain_length,V=A.strstart,oe=A.prev_length,U=A.nice_match,G=A.strstart>A.w_size-Z?A.strstart-(A.w_size-Z):0,ge=A.window,Ae=A.w_mask,Se=A.prev,Te=A.strstart+B,Ye=ge[V+oe-1],rt=ge[V+oe];A.prev_length>=A.good_match&&(O>>=2),U>A.lookahead&&(U=A.lookahead);do if(ge[(F=ie)+oe]===rt&&ge[F+oe-1]===Ye&&ge[F]===ge[V]&&ge[++F]===ge[V+1]){V+=2,F++;do;while(ge[++V]===ge[++F]&&ge[++V]===ge[++F]&&ge[++V]===ge[++F]&&ge[++V]===ge[++F]&&ge[++V]===ge[++F]&&ge[++V]===ge[++F]&&ge[++V]===ge[++F]&&ge[++V]===ge[++F]&&V<Te);if(Y=B-(Te-V),V=Te-B,oe<Y){if(A.match_start=ie,U<=(oe=Y))break;Ye=ge[V+oe-1],rt=ge[V+oe]}}while((ie=Se[ie&Ae])>G&&--O!=0);return oe<=A.lookahead?oe:A.lookahead}function Ze(A){var ie,F,Y,O,V,oe,U,G,ge,Ae,Se=A.w_size;do{if(O=A.window_size-A.lookahead-A.strstart,A.strstart>=Se+(Se-Z)){for(s.arraySet(A.window,A.window,Se,Se,0),A.match_start-=Se,A.strstart-=Se,A.block_start-=Se,ie=F=A.hash_size;Y=A.head[--ie],A.head[ie]=Se<=Y?Y-Se:0,--F;);for(ie=F=Se;Y=A.prev[--ie],A.prev[ie]=Se<=Y?Y-Se:0,--F;);O+=Se}if(A.strm.avail_in===0)break;if(oe=A.strm,U=A.window,G=A.strstart+A.lookahead,ge=O,Ae=void 0,Ae=oe.avail_in,ge<Ae&&(Ae=ge),F=Ae===0?0:(oe.avail_in-=Ae,s.arraySet(U,oe.input,oe.next_in,Ae,G),oe.state.wrap===1?oe.adler=l(oe.adler,U,Ae,G):oe.state.wrap===2&&(oe.adler=c(oe.adler,U,Ae,G)),oe.next_in+=Ae,oe.total_in+=Ae,Ae),A.lookahead+=F,A.lookahead+A.insert>=z)for(V=A.strstart-A.insert,A.ins_h=A.window[V],A.ins_h=(A.ins_h<<A.hash_shift^A.window[V+1])&A.hash_mask;A.insert&&(A.ins_h=(A.ins_h<<A.hash_shift^A.window[V+z-1])&A.hash_mask,A.prev[V&A.w_mask]=A.head[A.ins_h],A.head[A.ins_h]=V,V++,A.insert--,!(A.lookahead+A.insert<z)););}while(A.lookahead<Z&&A.strm.avail_in!==0)}function at(A,ie){for(var F,Y;;){if(A.lookahead<Z){if(Ze(A),A.lookahead<Z&&ie===f)return x;if(A.lookahead===0)break}if(F=0,A.lookahead>=z&&(A.ins_h=(A.ins_h<<A.hash_shift^A.window[A.strstart+z-1])&A.hash_mask,F=A.prev[A.strstart&A.w_mask]=A.head[A.ins_h],A.head[A.ins_h]=A.strstart),F!==0&&A.strstart-F<=A.w_size-Z&&(A.match_length=Pe(A,F)),A.match_length>=z)if(Y=a._tr_tally(A,A.strstart-A.match_start,A.match_length-z),A.lookahead-=A.match_length,A.match_length<=A.max_lazy_match&&A.lookahead>=z){for(A.match_length--;A.strstart++,A.ins_h=(A.ins_h<<A.hash_shift^A.window[A.strstart+z-1])&A.hash_mask,F=A.prev[A.strstart&A.w_mask]=A.head[A.ins_h],A.head[A.ins_h]=A.strstart,--A.match_length!=0;);A.strstart++}else A.strstart+=A.match_length,A.match_length=0,A.ins_h=A.window[A.strstart],A.ins_h=(A.ins_h<<A.hash_shift^A.window[A.strstart+1])&A.hash_mask;else Y=a._tr_tally(A,0,A.window[A.strstart]),A.lookahead--,A.strstart++;if(Y&&(be(A,!1),A.strm.avail_out===0))return x}return A.insert=A.strstart<z-1?A.strstart:z-1,ie===p?(be(A,!0),A.strm.avail_out===0?$:ee):A.last_lit&&(be(A,!1),A.strm.avail_out===0)?x:W}function Qe(A,ie){for(var F,Y,O;;){if(A.lookahead<Z){if(Ze(A),A.lookahead<Z&&ie===f)return x;if(A.lookahead===0)break}if(F=0,A.lookahead>=z&&(A.ins_h=(A.ins_h<<A.hash_shift^A.window[A.strstart+z-1])&A.hash_mask,F=A.prev[A.strstart&A.w_mask]=A.head[A.ins_h],A.head[A.ins_h]=A.strstart),A.prev_length=A.match_length,A.prev_match=A.match_start,A.match_length=z-1,F!==0&&A.prev_length<A.max_lazy_match&&A.strstart-F<=A.w_size-Z&&(A.match_length=Pe(A,F),A.match_length<=5&&(A.strategy===1||A.match_length===z&&4096<A.strstart-A.match_start)&&(A.match_length=z-1)),A.prev_length>=z&&A.match_length<=A.prev_length){for(O=A.strstart+A.lookahead-z,Y=a._tr_tally(A,A.strstart-1-A.prev_match,A.prev_length-z),A.lookahead-=A.prev_length-1,A.prev_length-=2;++A.strstart<=O&&(A.ins_h=(A.ins_h<<A.hash_shift^A.window[A.strstart+z-1])&A.hash_mask,F=A.prev[A.strstart&A.w_mask]=A.head[A.ins_h],A.head[A.ins_h]=A.strstart),--A.prev_length!=0;);if(A.match_available=0,A.match_length=z-1,A.strstart++,Y&&(be(A,!1),A.strm.avail_out===0))return x}else if(A.match_available){if((Y=a._tr_tally(A,0,A.window[A.strstart-1]))&&be(A,!1),A.strstart++,A.lookahead--,A.strm.avail_out===0)return x}else A.match_available=1,A.strstart++,A.lookahead--}return A.match_available&&(Y=a._tr_tally(A,0,A.window[A.strstart-1]),A.match_available=0),A.insert=A.strstart<z-1?A.strstart:z-1,ie===p?(be(A,!0),A.strm.avail_out===0?$:ee):A.last_lit&&(be(A,!1),A.strm.avail_out===0)?x:W}function At(A,ie,F,Y,O){this.good_length=A,this.max_lazy=ie,this.nice_length=F,this.max_chain=Y,this.func=O}function se(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=S,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new s.Buf16(2*N),this.dyn_dtree=new s.Buf16(2*(2*T+1)),this.bl_tree=new s.Buf16(2*(2*L+1)),we(this.dyn_ltree),we(this.dyn_dtree),we(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*b+1),we(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new s.Buf16(2*b+1),we(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 Ie(A){var ie;return A&&A.state?(A.total_in=A.total_out=0,A.data_type=C,(ie=A.state).pending=0,ie.pending_out=0,ie.wrap<0&&(ie.wrap=-ie.wrap),ie.status=ie.wrap?R:K,A.adler=ie.wrap===2?0:1,ie.last_flush=f,a._tr_init(ie),g):Q(A,m)}function Ue(A){var ie=Ie(A);return ie===g&&(function(F){F.window_size=2*F.w_size,we(F.head),F.max_lazy_match=i[F.level].max_lazy,F.good_match=i[F.level].good_length,F.nice_match=i[F.level].nice_length,F.max_chain_length=i[F.level].max_chain,F.strstart=0,F.block_start=0,F.lookahead=0,F.insert=0,F.match_length=F.prev_length=z-1,F.match_available=0,F.ins_h=0})(A.state),ie}function ne(A,ie,F,Y,O,V){if(!A)return m;var oe=1;if(ie===v&&(ie=6),Y<0?(oe=0,Y=-Y):15<Y&&(oe=2,Y-=16),O<1||w<O||F!==S||Y<8||15<Y||ie<0||9<ie||V<0||k<V)return Q(A,m);Y===8&&(Y=9);var U=new se;return(A.state=U).strm=A,U.wrap=oe,U.gzhead=null,U.w_bits=Y,U.w_size=1<<U.w_bits,U.w_mask=U.w_size-1,U.hash_bits=O+7,U.hash_size=1<<U.hash_bits,U.hash_mask=U.hash_size-1,U.hash_shift=~~((U.hash_bits+z-1)/z),U.window=new s.Buf8(2*U.w_size),U.head=new s.Buf16(U.hash_size),U.prev=new s.Buf16(U.w_size),U.lit_bufsize=1<<O+6,U.pending_buf_size=4*U.lit_bufsize,U.pending_buf=new s.Buf8(U.pending_buf_size),U.d_buf=1*U.lit_bufsize,U.l_buf=3*U.lit_bufsize,U.level=ie,U.strategy=V,U.method=F,Ue(A)}i=[new At(0,0,0,0,function(A,ie){var F=65535;for(F>A.pending_buf_size-5&&(F=A.pending_buf_size-5);;){if(A.lookahead<=1){if(Ze(A),A.lookahead===0&&ie===f)return x;if(A.lookahead===0)break}A.strstart+=A.lookahead,A.lookahead=0;var Y=A.block_start+F;if((A.strstart===0||A.strstart>=Y)&&(A.lookahead=A.strstart-Y,A.strstart=Y,be(A,!1),A.strm.avail_out===0)||A.strstart-A.block_start>=A.w_size-Z&&(be(A,!1),A.strm.avail_out===0))return x}return A.insert=0,ie===p?(be(A,!0),A.strm.avail_out===0?$:ee):(A.strstart>A.block_start&&(be(A,!1),A.strm.avail_out),x)}),new At(4,4,8,4,at),new At(4,5,16,8,at),new At(4,6,32,32,at),new At(4,4,16,16,Qe),new At(8,16,32,32,Qe),new At(8,16,128,128,Qe),new At(8,32,128,256,Qe),new At(32,128,258,1024,Qe),new At(32,258,258,4096,Qe)],o.deflateInit=function(A,ie){return ne(A,ie,S,15,8,0)},o.deflateInit2=ne,o.deflateReset=Ue,o.deflateResetKeep=Ie,o.deflateSetHeader=function(A,ie){return A&&A.state?A.state.wrap!==2?m:(A.state.gzhead=ie,g):m},o.deflate=function(A,ie){var F,Y,O,V;if(!A||!A.state||5<ie||ie<0)return A?Q(A,m):m;if(Y=A.state,!A.output||!A.input&&A.avail_in!==0||Y.status===666&&ie!==p)return Q(A,A.avail_out===0?-5:m);if(Y.strm=A,F=Y.last_flush,Y.last_flush=ie,Y.status===R)if(Y.wrap===2)A.adler=0,ve(Y,31),ve(Y,139),ve(Y,8),Y.gzhead?(ve(Y,(Y.gzhead.text?1:0)+(Y.gzhead.hcrc?2:0)+(Y.gzhead.extra?4:0)+(Y.gzhead.name?8:0)+(Y.gzhead.comment?16:0)),ve(Y,255&Y.gzhead.time),ve(Y,Y.gzhead.time>>8&255),ve(Y,Y.gzhead.time>>16&255),ve(Y,Y.gzhead.time>>24&255),ve(Y,Y.level===9?2:2<=Y.strategy||Y.level<2?4:0),ve(Y,255&Y.gzhead.os),Y.gzhead.extra&&Y.gzhead.extra.length&&(ve(Y,255&Y.gzhead.extra.length),ve(Y,Y.gzhead.extra.length>>8&255)),Y.gzhead.hcrc&&(A.adler=c(A.adler,Y.pending_buf,Y.pending,0)),Y.gzindex=0,Y.status=69):(ve(Y,0),ve(Y,0),ve(Y,0),ve(Y,0),ve(Y,0),ve(Y,Y.level===9?2:2<=Y.strategy||Y.level<2?4:0),ve(Y,3),Y.status=K);else{var oe=S+(Y.w_bits-8<<4)<<8;oe|=(2<=Y.strategy||Y.level<2?0:Y.level<6?1:Y.level===6?2:3)<<6,Y.strstart!==0&&(oe|=32),oe+=31-oe%31,Y.status=K,Ee(Y,oe),Y.strstart!==0&&(Ee(Y,A.adler>>>16),Ee(Y,65535&A.adler)),A.adler=1}if(Y.status===69)if(Y.gzhead.extra){for(O=Y.pending;Y.gzindex<(65535&Y.gzhead.extra.length)&&(Y.pending!==Y.pending_buf_size||(Y.gzhead.hcrc&&Y.pending>O&&(A.adler=c(A.adler,Y.pending_buf,Y.pending-O,O)),ce(A),O=Y.pending,Y.pending!==Y.pending_buf_size));)ve(Y,255&Y.gzhead.extra[Y.gzindex]),Y.gzindex++;Y.gzhead.hcrc&&Y.pending>O&&(A.adler=c(A.adler,Y.pending_buf,Y.pending-O,O)),Y.gzindex===Y.gzhead.extra.length&&(Y.gzindex=0,Y.status=73)}else Y.status=73;if(Y.status===73)if(Y.gzhead.name){O=Y.pending;do{if(Y.pending===Y.pending_buf_size&&(Y.gzhead.hcrc&&Y.pending>O&&(A.adler=c(A.adler,Y.pending_buf,Y.pending-O,O)),ce(A),O=Y.pending,Y.pending===Y.pending_buf_size)){V=1;break}V=Y.gzindex<Y.gzhead.name.length?255&Y.gzhead.name.charCodeAt(Y.gzindex++):0,ve(Y,V)}while(V!==0);Y.gzhead.hcrc&&Y.pending>O&&(A.adler=c(A.adler,Y.pending_buf,Y.pending-O,O)),V===0&&(Y.gzindex=0,Y.status=91)}else Y.status=91;if(Y.status===91)if(Y.gzhead.comment){O=Y.pending;do{if(Y.pending===Y.pending_buf_size&&(Y.gzhead.hcrc&&Y.pending>O&&(A.adler=c(A.adler,Y.pending_buf,Y.pending-O,O)),ce(A),O=Y.pending,Y.pending===Y.pending_buf_size)){V=1;break}V=Y.gzindex<Y.gzhead.comment.length?255&Y.gzhead.comment.charCodeAt(Y.gzindex++):0,ve(Y,V)}while(V!==0);Y.gzhead.hcrc&&Y.pending>O&&(A.adler=c(A.adler,Y.pending_buf,Y.pending-O,O)),V===0&&(Y.status=103)}else Y.status=103;if(Y.status===103&&(Y.gzhead.hcrc?(Y.pending+2>Y.pending_buf_size&&ce(A),Y.pending+2<=Y.pending_buf_size&&(ve(Y,255&A.adler),ve(Y,A.adler>>8&255),A.adler=0,Y.status=K)):Y.status=K),Y.pending!==0){if(ce(A),A.avail_out===0)return Y.last_flush=-1,g}else if(A.avail_in===0&&X(ie)<=X(F)&&ie!==p)return Q(A,-5);if(Y.status===666&&A.avail_in!==0)return Q(A,-5);if(A.avail_in!==0||Y.lookahead!==0||ie!==f&&Y.status!==666){var U=Y.strategy===2?(function(G,ge){for(var Ae;;){if(G.lookahead===0&&(Ze(G),G.lookahead===0)){if(ge===f)return x;break}if(G.match_length=0,Ae=a._tr_tally(G,0,G.window[G.strstart]),G.lookahead--,G.strstart++,Ae&&(be(G,!1),G.strm.avail_out===0))return x}return G.insert=0,ge===p?(be(G,!0),G.strm.avail_out===0?$:ee):G.last_lit&&(be(G,!1),G.strm.avail_out===0)?x:W})(Y,ie):Y.strategy===3?(function(G,ge){for(var Ae,Se,Te,Ye,rt=G.window;;){if(G.lookahead<=B){if(Ze(G),G.lookahead<=B&&ge===f)return x;if(G.lookahead===0)break}if(G.match_length=0,G.lookahead>=z&&0<G.strstart&&(Se=rt[Te=G.strstart-1])===rt[++Te]&&Se===rt[++Te]&&Se===rt[++Te]){Ye=G.strstart+B;do;while(Se===rt[++Te]&&Se===rt[++Te]&&Se===rt[++Te]&&Se===rt[++Te]&&Se===rt[++Te]&&Se===rt[++Te]&&Se===rt[++Te]&&Se===rt[++Te]&&Te<Ye);G.match_length=B-(Ye-Te),G.match_length>G.lookahead&&(G.match_length=G.lookahead)}if(G.match_length>=z?(Ae=a._tr_tally(G,1,G.match_length-z),G.lookahead-=G.match_length,G.strstart+=G.match_length,G.match_length=0):(Ae=a._tr_tally(G,0,G.window[G.strstart]),G.lookahead--,G.strstart++),Ae&&(be(G,!1),G.strm.avail_out===0))return x}return G.insert=0,ge===p?(be(G,!0),G.strm.avail_out===0?$:ee):G.last_lit&&(be(G,!1),G.strm.avail_out===0)?x:W})(Y,ie):i[Y.level].func(Y,ie);if(U!==$&&U!==ee||(Y.status=666),U===x||U===$)return A.avail_out===0&&(Y.last_flush=-1),g;if(U===W&&(ie===1?a._tr_align(Y):ie!==5&&(a._tr_stored_block(Y,0,0,!1),ie===3&&(we(Y.head),Y.lookahead===0&&(Y.strstart=0,Y.block_start=0,Y.insert=0))),ce(A),A.avail_out===0))return Y.last_flush=-1,g}return ie!==p?g:Y.wrap<=0?1:(Y.wrap===2?(ve(Y,255&A.adler),ve(Y,A.adler>>8&255),ve(Y,A.adler>>16&255),ve(Y,A.adler>>24&255),ve(Y,255&A.total_in),ve(Y,A.total_in>>8&255),ve(Y,A.total_in>>16&255),ve(Y,A.total_in>>24&255)):(Ee(Y,A.adler>>>16),Ee(Y,65535&A.adler)),ce(A),0<Y.wrap&&(Y.wrap=-Y.wrap),Y.pending!==0?g:1)},o.deflateEnd=function(A){var ie;return A&&A.state?(ie=A.state.status)!==R&&ie!==69&&ie!==73&&ie!==91&&ie!==103&&ie!==K&&ie!==666?Q(A,m):(A.state=null,ie===K?Q(A,-3):g):m},o.deflateSetDictionary=function(A,ie){var F,Y,O,V,oe,U,G,ge,Ae=ie.length;if(!A||!A.state||(V=(F=A.state).wrap)===2||V===1&&F.status!==R||F.lookahead)return m;for(V===1&&(A.adler=l(A.adler,ie,Ae,0)),F.wrap=0,Ae>=F.w_size&&(V===0&&(we(F.head),F.strstart=0,F.block_start=0,F.insert=0),ge=new s.Buf8(F.w_size),s.arraySet(ge,ie,Ae-F.w_size,F.w_size,0),ie=ge,Ae=F.w_size),oe=A.avail_in,U=A.next_in,G=A.input,A.avail_in=Ae,A.next_in=0,A.input=ie,Ze(F);F.lookahead>=z;){for(Y=F.strstart,O=F.lookahead-(z-1);F.ins_h=(F.ins_h<<F.hash_shift^F.window[Y+z-1])&F.hash_mask,F.prev[Y&F.w_mask]=F.head[F.ins_h],F.head[F.ins_h]=Y,Y++,--O;);F.strstart=Y,F.lookahead=z-1,Ze(F)}return F.strstart+=F.lookahead,F.block_start=F.strstart,F.insert=F.lookahead,F.lookahead=0,F.match_length=F.prev_length=z-1,F.match_available=0,A.next_in=U,A.input=G,A.avail_in=oe,F.wrap=V,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,p,g,m,v,k,C,S,w,b,T,L,N,H,z,B,Z,R,K,x=i.input,W;c=l+(i.avail_in-5),d=i.next_out,W=i.output,f=d-(s-i.avail_out),p=d+(i.avail_out-257),g=a.dmax,m=a.wsize,v=a.whave,k=a.wnext,C=a.window,S=a.hold,w=a.bits,b=a.lencode,T=a.distcode,L=(1<<a.lenbits)-1,N=(1<<a.distbits)-1;e:do{w<15&&(S+=x[l++]<<w,w+=8,S+=x[l++]<<w,w+=8),H=b[S&L];t:for(;;){if(S>>>=z=H>>>24,w-=z,(z=H>>>16&255)===0)W[d++]=65535&H;else{if(!(16&z)){if((64&z)==0){H=b[(65535&H)+(S&(1<<z)-1)];continue t}if(32&z){a.mode=12;break e}i.msg="invalid literal/length code",a.mode=30;break e}B=65535&H,(z&=15)&&(w<z&&(S+=x[l++]<<w,w+=8),B+=S&(1<<z)-1,S>>>=z,w-=z),w<15&&(S+=x[l++]<<w,w+=8,S+=x[l++]<<w,w+=8),H=T[S&N];n:for(;;){if(S>>>=z=H>>>24,w-=z,!(16&(z=H>>>16&255))){if((64&z)==0){H=T[(65535&H)+(S&(1<<z)-1)];continue n}i.msg="invalid distance code",a.mode=30;break e}if(Z=65535&H,w<(z&=15)&&(S+=x[l++]<<w,(w+=8)<z&&(S+=x[l++]<<w,w+=8)),g<(Z+=S&(1<<z)-1)){i.msg="invalid distance too far back",a.mode=30;break e}if(S>>>=z,w-=z,(z=d-f)<Z){if(v<(z=Z-z)&&a.sane){i.msg="invalid distance too far back",a.mode=30;break e}if(K=C,(R=0)===k){if(R+=m-z,z<B){for(B-=z;W[d++]=C[R++],--z;);R=d-Z,K=W}}else if(k<z){if(R+=m+k-z,(z-=k)<B){for(B-=z;W[d++]=C[R++],--z;);if(R=0,k<B){for(B-=z=k;W[d++]=C[R++],--z;);R=d-Z,K=W}}}else if(R+=k-z,z<B){for(B-=z;W[d++]=C[R++],--z;);R=d-Z,K=W}for(;2<B;)W[d++]=K[R++],W[d++]=K[R++],W[d++]=K[R++],B-=3;B&&(W[d++]=K[R++],1<B&&(W[d++]=K[R++]))}else{for(R=d-Z;W[d++]=W[R++],W[d++]=W[R++],W[d++]=W[R++],2<(B-=3););B&&(W[d++]=W[R++],1<B&&(W[d++]=W[R++]))}break}}break}}while(l<c&&d<p);l-=B=w>>3,S&=(1<<(w-=B<<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<p?p-d+257:257-(d-p),a.hold=S,a.bits=w}},{}],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,p=0,g=-2,m=1,v=852,k=592;function C(R){return(R>>>24&255)+(R>>>8&65280)+((65280&R)<<8)+((255&R)<<24)}function S(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new i.Buf16(320),this.work=new i.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function w(R){var K;return R&&R.state?(K=R.state,R.total_in=R.total_out=K.total=0,R.msg="",K.wrap&&(R.adler=1&K.wrap),K.mode=m,K.last=0,K.havedict=0,K.dmax=32768,K.head=null,K.hold=0,K.bits=0,K.lencode=K.lendyn=new i.Buf32(v),K.distcode=K.distdyn=new i.Buf32(k),K.sane=1,K.back=-1,p):g}function b(R){var K;return R&&R.state?((K=R.state).wsize=0,K.whave=0,K.wnext=0,w(R)):g}function T(R,K){var x,W;return R&&R.state?(W=R.state,K<0?(x=0,K=-K):(x=1+(K>>4),K<48&&(K&=15)),K&&(K<8||15<K)?g:(W.window!==null&&W.wbits!==K&&(W.window=null),W.wrap=x,W.wbits=K,b(R))):g}function L(R,K){var x,W;return R?(W=new S,(R.state=W).window=null,(x=T(R,K))!==p&&(R.state=null),x):g}var N,H,z=!0;function B(R){if(z){var K;for(N=new i.Buf32(512),H=new i.Buf32(32),K=0;K<144;)R.lens[K++]=8;for(;K<256;)R.lens[K++]=9;for(;K<280;)R.lens[K++]=7;for(;K<288;)R.lens[K++]=8;for(c(d,R.lens,0,288,N,0,R.work,{bits:9}),K=0;K<32;)R.lens[K++]=5;c(f,R.lens,0,32,H,0,R.work,{bits:5}),z=!1}R.lencode=N,R.lenbits=9,R.distcode=H,R.distbits=5}function Z(R,K,x,W){var $,ee=R.state;return ee.window===null&&(ee.wsize=1<<ee.wbits,ee.wnext=0,ee.whave=0,ee.window=new i.Buf8(ee.wsize)),W>=ee.wsize?(i.arraySet(ee.window,K,x-ee.wsize,ee.wsize,0),ee.wnext=0,ee.whave=ee.wsize):(W<($=ee.wsize-ee.wnext)&&($=W),i.arraySet(ee.window,K,x-W,$,ee.wnext),(W-=$)?(i.arraySet(ee.window,K,x-W,W,0),ee.wnext=W,ee.whave=ee.wsize):(ee.wnext+=$,ee.wnext===ee.wsize&&(ee.wnext=0),ee.whave<ee.wsize&&(ee.whave+=$))),0}o.inflateReset=b,o.inflateReset2=T,o.inflateResetKeep=w,o.inflateInit=function(R){return L(R,15)},o.inflateInit2=L,o.inflate=function(R,K){var x,W,$,ee,Q,X,we,ce,be,ve,Ee,Pe,Ze,at,Qe,At,se,Ie,Ue,ne,A,ie,F,Y,O=0,V=new i.Buf8(4),oe=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!R||!R.state||!R.output||!R.input&&R.avail_in!==0)return g;(x=R.state).mode===12&&(x.mode=13),Q=R.next_out,$=R.output,we=R.avail_out,ee=R.next_in,W=R.input,X=R.avail_in,ce=x.hold,be=x.bits,ve=X,Ee=we,ie=p;e:for(;;)switch(x.mode){case m:if(x.wrap===0){x.mode=13;break}for(;be<16;){if(X===0)break e;X--,ce+=W[ee++]<<be,be+=8}if(2&x.wrap&&ce===35615){V[x.check=0]=255&ce,V[1]=ce>>>8&255,x.check=a(x.check,V,2,0),be=ce=0,x.mode=2;break}if(x.flags=0,x.head&&(x.head.done=!1),!(1&x.wrap)||(((255&ce)<<8)+(ce>>8))%31){R.msg="incorrect header check",x.mode=30;break}if((15&ce)!=8){R.msg="unknown compression method",x.mode=30;break}if(be-=4,A=8+(15&(ce>>>=4)),x.wbits===0)x.wbits=A;else if(A>x.wbits){R.msg="invalid window size",x.mode=30;break}x.dmax=1<<A,R.adler=x.check=1,x.mode=512&ce?10:12,be=ce=0;break;case 2:for(;be<16;){if(X===0)break e;X--,ce+=W[ee++]<<be,be+=8}if(x.flags=ce,(255&x.flags)!=8){R.msg="unknown compression method",x.mode=30;break}if(57344&x.flags){R.msg="unknown header flags set",x.mode=30;break}x.head&&(x.head.text=ce>>8&1),512&x.flags&&(V[0]=255&ce,V[1]=ce>>>8&255,x.check=a(x.check,V,2,0)),be=ce=0,x.mode=3;case 3:for(;be<32;){if(X===0)break e;X--,ce+=W[ee++]<<be,be+=8}x.head&&(x.head.time=ce),512&x.flags&&(V[0]=255&ce,V[1]=ce>>>8&255,V[2]=ce>>>16&255,V[3]=ce>>>24&255,x.check=a(x.check,V,4,0)),be=ce=0,x.mode=4;case 4:for(;be<16;){if(X===0)break e;X--,ce+=W[ee++]<<be,be+=8}x.head&&(x.head.xflags=255&ce,x.head.os=ce>>8),512&x.flags&&(V[0]=255&ce,V[1]=ce>>>8&255,x.check=a(x.check,V,2,0)),be=ce=0,x.mode=5;case 5:if(1024&x.flags){for(;be<16;){if(X===0)break e;X--,ce+=W[ee++]<<be,be+=8}x.length=ce,x.head&&(x.head.extra_len=ce),512&x.flags&&(V[0]=255&ce,V[1]=ce>>>8&255,x.check=a(x.check,V,2,0)),be=ce=0}else x.head&&(x.head.extra=null);x.mode=6;case 6:if(1024&x.flags&&(X<(Pe=x.length)&&(Pe=X),Pe&&(x.head&&(A=x.head.extra_len-x.length,x.head.extra||(x.head.extra=new Array(x.head.extra_len)),i.arraySet(x.head.extra,W,ee,Pe,A)),512&x.flags&&(x.check=a(x.check,W,Pe,ee)),X-=Pe,ee+=Pe,x.length-=Pe),x.length))break e;x.length=0,x.mode=7;case 7:if(2048&x.flags){if(X===0)break e;for(Pe=0;A=W[ee+Pe++],x.head&&A&&x.length<65536&&(x.head.name+=String.fromCharCode(A)),A&&Pe<X;);if(512&x.flags&&(x.check=a(x.check,W,Pe,ee)),X-=Pe,ee+=Pe,A)break e}else x.head&&(x.head.name=null);x.length=0,x.mode=8;case 8:if(4096&x.flags){if(X===0)break e;for(Pe=0;A=W[ee+Pe++],x.head&&A&&x.length<65536&&(x.head.comment+=String.fromCharCode(A)),A&&Pe<X;);if(512&x.flags&&(x.check=a(x.check,W,Pe,ee)),X-=Pe,ee+=Pe,A)break e}else x.head&&(x.head.comment=null);x.mode=9;case 9:if(512&x.flags){for(;be<16;){if(X===0)break e;X--,ce+=W[ee++]<<be,be+=8}if(ce!==(65535&x.check)){R.msg="header crc mismatch",x.mode=30;break}be=ce=0}x.head&&(x.head.hcrc=x.flags>>9&1,x.head.done=!0),R.adler=x.check=0,x.mode=12;break;case 10:for(;be<32;){if(X===0)break e;X--,ce+=W[ee++]<<be,be+=8}R.adler=x.check=C(ce),be=ce=0,x.mode=11;case 11:if(x.havedict===0)return R.next_out=Q,R.avail_out=we,R.next_in=ee,R.avail_in=X,x.hold=ce,x.bits=be,2;R.adler=x.check=1,x.mode=12;case 12:if(K===5||K===6)break e;case 13:if(x.last){ce>>>=7&be,be-=7&be,x.mode=27;break}for(;be<3;){if(X===0)break e;X--,ce+=W[ee++]<<be,be+=8}switch(x.last=1&ce,be-=1,3&(ce>>>=1)){case 0:x.mode=14;break;case 1:if(B(x),x.mode=20,K!==6)break;ce>>>=2,be-=2;break e;case 2:x.mode=17;break;case 3:R.msg="invalid block type",x.mode=30}ce>>>=2,be-=2;break;case 14:for(ce>>>=7&be,be-=7&be;be<32;){if(X===0)break e;X--,ce+=W[ee++]<<be,be+=8}if((65535&ce)!=(ce>>>16^65535)){R.msg="invalid stored block lengths",x.mode=30;break}if(x.length=65535&ce,be=ce=0,x.mode=15,K===6)break e;case 15:x.mode=16;case 16:if(Pe=x.length){if(X<Pe&&(Pe=X),we<Pe&&(Pe=we),Pe===0)break e;i.arraySet($,W,ee,Pe,Q),X-=Pe,ee+=Pe,we-=Pe,Q+=Pe,x.length-=Pe;break}x.mode=12;break;case 17:for(;be<14;){if(X===0)break e;X--,ce+=W[ee++]<<be,be+=8}if(x.nlen=257+(31&ce),ce>>>=5,be-=5,x.ndist=1+(31&ce),ce>>>=5,be-=5,x.ncode=4+(15&ce),ce>>>=4,be-=4,286<x.nlen||30<x.ndist){R.msg="too many length or distance symbols",x.mode=30;break}x.have=0,x.mode=18;case 18:for(;x.have<x.ncode;){for(;be<3;){if(X===0)break e;X--,ce+=W[ee++]<<be,be+=8}x.lens[oe[x.have++]]=7&ce,ce>>>=3,be-=3}for(;x.have<19;)x.lens[oe[x.have++]]=0;if(x.lencode=x.lendyn,x.lenbits=7,F={bits:x.lenbits},ie=c(0,x.lens,0,19,x.lencode,0,x.work,F),x.lenbits=F.bits,ie){R.msg="invalid code lengths set",x.mode=30;break}x.have=0,x.mode=19;case 19:for(;x.have<x.nlen+x.ndist;){for(;At=(O=x.lencode[ce&(1<<x.lenbits)-1])>>>16&255,se=65535&O,!((Qe=O>>>24)<=be);){if(X===0)break e;X--,ce+=W[ee++]<<be,be+=8}if(se<16)ce>>>=Qe,be-=Qe,x.lens[x.have++]=se;else{if(se===16){for(Y=Qe+2;be<Y;){if(X===0)break e;X--,ce+=W[ee++]<<be,be+=8}if(ce>>>=Qe,be-=Qe,x.have===0){R.msg="invalid bit length repeat",x.mode=30;break}A=x.lens[x.have-1],Pe=3+(3&ce),ce>>>=2,be-=2}else if(se===17){for(Y=Qe+3;be<Y;){if(X===0)break e;X--,ce+=W[ee++]<<be,be+=8}be-=Qe,A=0,Pe=3+(7&(ce>>>=Qe)),ce>>>=3,be-=3}else{for(Y=Qe+7;be<Y;){if(X===0)break e;X--,ce+=W[ee++]<<be,be+=8}be-=Qe,A=0,Pe=11+(127&(ce>>>=Qe)),ce>>>=7,be-=7}if(x.have+Pe>x.nlen+x.ndist){R.msg="invalid bit length repeat",x.mode=30;break}for(;Pe--;)x.lens[x.have++]=A}}if(x.mode===30)break;if(x.lens[256]===0){R.msg="invalid code -- missing end-of-block",x.mode=30;break}if(x.lenbits=9,F={bits:x.lenbits},ie=c(d,x.lens,0,x.nlen,x.lencode,0,x.work,F),x.lenbits=F.bits,ie){R.msg="invalid literal/lengths set",x.mode=30;break}if(x.distbits=6,x.distcode=x.distdyn,F={bits:x.distbits},ie=c(f,x.lens,x.nlen,x.ndist,x.distcode,0,x.work,F),x.distbits=F.bits,ie){R.msg="invalid distances set",x.mode=30;break}if(x.mode=20,K===6)break e;case 20:x.mode=21;case 21:if(6<=X&&258<=we){R.next_out=Q,R.avail_out=we,R.next_in=ee,R.avail_in=X,x.hold=ce,x.bits=be,l(R,Ee),Q=R.next_out,$=R.output,we=R.avail_out,ee=R.next_in,W=R.input,X=R.avail_in,ce=x.hold,be=x.bits,x.mode===12&&(x.back=-1);break}for(x.back=0;At=(O=x.lencode[ce&(1<<x.lenbits)-1])>>>16&255,se=65535&O,!((Qe=O>>>24)<=be);){if(X===0)break e;X--,ce+=W[ee++]<<be,be+=8}if(At&&(240&At)==0){for(Ie=Qe,Ue=At,ne=se;At=(O=x.lencode[ne+((ce&(1<<Ie+Ue)-1)>>Ie)])>>>16&255,se=65535&O,!(Ie+(Qe=O>>>24)<=be);){if(X===0)break e;X--,ce+=W[ee++]<<be,be+=8}ce>>>=Ie,be-=Ie,x.back+=Ie}if(ce>>>=Qe,be-=Qe,x.back+=Qe,x.length=se,At===0){x.mode=26;break}if(32&At){x.back=-1,x.mode=12;break}if(64&At){R.msg="invalid literal/length code",x.mode=30;break}x.extra=15&At,x.mode=22;case 22:if(x.extra){for(Y=x.extra;be<Y;){if(X===0)break e;X--,ce+=W[ee++]<<be,be+=8}x.length+=ce&(1<<x.extra)-1,ce>>>=x.extra,be-=x.extra,x.back+=x.extra}x.was=x.length,x.mode=23;case 23:for(;At=(O=x.distcode[ce&(1<<x.distbits)-1])>>>16&255,se=65535&O,!((Qe=O>>>24)<=be);){if(X===0)break e;X--,ce+=W[ee++]<<be,be+=8}if((240&At)==0){for(Ie=Qe,Ue=At,ne=se;At=(O=x.distcode[ne+((ce&(1<<Ie+Ue)-1)>>Ie)])>>>16&255,se=65535&O,!(Ie+(Qe=O>>>24)<=be);){if(X===0)break e;X--,ce+=W[ee++]<<be,be+=8}ce>>>=Ie,be-=Ie,x.back+=Ie}if(ce>>>=Qe,be-=Qe,x.back+=Qe,64&At){R.msg="invalid distance code",x.mode=30;break}x.offset=se,x.extra=15&At,x.mode=24;case 24:if(x.extra){for(Y=x.extra;be<Y;){if(X===0)break e;X--,ce+=W[ee++]<<be,be+=8}x.offset+=ce&(1<<x.extra)-1,ce>>>=x.extra,be-=x.extra,x.back+=x.extra}if(x.offset>x.dmax){R.msg="invalid distance too far back",x.mode=30;break}x.mode=25;case 25:if(we===0)break e;if(Pe=Ee-we,x.offset>Pe){if((Pe=x.offset-Pe)>x.whave&&x.sane){R.msg="invalid distance too far back",x.mode=30;break}Ze=Pe>x.wnext?(Pe-=x.wnext,x.wsize-Pe):x.wnext-Pe,Pe>x.length&&(Pe=x.length),at=x.window}else at=$,Ze=Q-x.offset,Pe=x.length;for(we<Pe&&(Pe=we),we-=Pe,x.length-=Pe;$[Q++]=at[Ze++],--Pe;);x.length===0&&(x.mode=21);break;case 26:if(we===0)break e;$[Q++]=x.length,we--,x.mode=21;break;case 27:if(x.wrap){for(;be<32;){if(X===0)break e;X--,ce|=W[ee++]<<be,be+=8}if(Ee-=we,R.total_out+=Ee,x.total+=Ee,Ee&&(R.adler=x.check=x.flags?a(x.check,$,Ee,Q-Ee):s(x.check,$,Ee,Q-Ee)),Ee=we,(x.flags?ce:C(ce))!==x.check){R.msg="incorrect data check",x.mode=30;break}be=ce=0}x.mode=28;case 28:if(x.wrap&&x.flags){for(;be<32;){if(X===0)break e;X--,ce+=W[ee++]<<be,be+=8}if(ce!==(4294967295&x.total)){R.msg="incorrect length check",x.mode=30;break}be=ce=0}x.mode=29;case 29:ie=1;break e;case 30:ie=-3;break e;case 31:return-4;default:return g}return R.next_out=Q,R.avail_out=we,R.next_in=ee,R.avail_in=X,x.hold=ce,x.bits=be,(x.wsize||Ee!==R.avail_out&&x.mode<30&&(x.mode<27||K!==4))&&Z(R,R.output,R.next_out,Ee-R.avail_out)?(x.mode=31,-4):(ve-=R.avail_in,Ee-=R.avail_out,R.total_in+=ve,R.total_out+=Ee,x.total+=Ee,x.wrap&&Ee&&(R.adler=x.check=x.flags?a(x.check,$,Ee,R.next_out-Ee):s(x.check,$,Ee,R.next_out-Ee)),R.data_type=x.bits+(x.last?64:0)+(x.mode===12?128:0)+(x.mode===20||x.mode===15?256:0),(ve==0&&Ee===0||K===4)&&ie===p&&(ie=-5),ie)},o.inflateEnd=function(R){if(!R||!R.state)return g;var K=R.state;return K.window&&(K.window=null),R.state=null,p},o.inflateGetHeader=function(R,K){var x;return R&&R.state?(2&(x=R.state).wrap)==0?g:((x.head=K).done=!1,p):g},o.inflateSetDictionary=function(R,K){var x,W=K.length;return R&&R.state?(x=R.state).wrap!==0&&x.mode!==11?g:x.mode===11&&s(1,K,W,0)!==x.check?-3:Z(R,K,W,W)?(x.mode=31,-4):(x.havedict=1,p):g},o.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(n,r,o){"use strict";var i=n("../utils/common"),s=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],a=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],l=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],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,p,g,m,v,k,C){var S,w,b,T,L,N,H,z,B,Z=C.bits,R=0,K=0,x=0,W=0,$=0,ee=0,Q=0,X=0,we=0,ce=0,be=null,ve=0,Ee=new i.Buf16(16),Pe=new i.Buf16(16),Ze=null,at=0;for(R=0;R<=15;R++)Ee[R]=0;for(K=0;K<g;K++)Ee[f[p+K]]++;for($=Z,W=15;1<=W&&Ee[W]===0;W--);if(W<$&&($=W),W===0)return m[v++]=20971520,m[v++]=20971520,C.bits=1,0;for(x=1;x<W&&Ee[x]===0;x++);for($<x&&($=x),R=X=1;R<=15;R++)if(X<<=1,(X-=Ee[R])<0)return-1;if(0<X&&(d===0||W!==1))return-1;for(Pe[1]=0,R=1;R<15;R++)Pe[R+1]=Pe[R]+Ee[R];for(K=0;K<g;K++)f[p+K]!==0&&(k[Pe[f[p+K]]++]=K);if(N=d===0?(be=Ze=k,19):d===1?(be=s,ve-=257,Ze=a,at-=257,256):(be=l,Ze=c,-1),R=x,L=v,Q=K=ce=0,b=-1,T=(we=1<<(ee=$))-1,d===1&&852<we||d===2&&592<we)return 1;for(;;){for(H=R-Q,B=k[K]<N?(z=0,k[K]):k[K]>N?(z=Ze[at+k[K]],be[ve+k[K]]):(z=96,0),S=1<<R-Q,x=w=1<<ee;m[L+(ce>>Q)+(w-=S)]=H<<24|z<<16|B|0,w!==0;);for(S=1<<R-1;ce&S;)S>>=1;if(S!==0?(ce&=S-1,ce+=S):ce=0,K++,--Ee[R]==0){if(R===W)break;R=f[p+k[K]]}if($<R&&(ce&T)!==b){for(Q===0&&(Q=$),L+=x,X=1<<(ee=R-Q);ee+Q<W&&!((X-=Ee[ee+Q])<=0);)ee++,X<<=1;if(we+=1<<ee,d===1&&852<we||d===2&&592<we)return 1;m[b=ce&T]=$<<24|ee<<16|L-v|0}}return ce!==0&&(m[L+ce]=R-Q<<24|4194304),C.bits=$,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(O){for(var V=O.length;0<=--V;)O[V]=0}var c=0,d=29,f=256,p=f+1+d,g=30,m=19,v=2*p+1,k=15,C=16,S=7,w=256,b=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],z=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],B=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],Z=new Array(2*(p+2));l(Z);var R=new Array(2*g);l(R);var K=new Array(512);l(K);var x=new Array(256);l(x);var W=new Array(d);l(W);var $,ee,Q,X=new Array(g);function we(O,V,oe,U,G){this.static_tree=O,this.extra_bits=V,this.extra_base=oe,this.elems=U,this.max_length=G,this.has_stree=O&&O.length}function ce(O,V){this.dyn_tree=O,this.max_code=0,this.stat_desc=V}function be(O){return O<256?K[O]:K[256+(O>>>7)]}function ve(O,V){O.pending_buf[O.pending++]=255&V,O.pending_buf[O.pending++]=V>>>8&255}function Ee(O,V,oe){O.bi_valid>C-oe?(O.bi_buf|=V<<O.bi_valid&65535,ve(O,O.bi_buf),O.bi_buf=V>>C-O.bi_valid,O.bi_valid+=oe-C):(O.bi_buf|=V<<O.bi_valid&65535,O.bi_valid+=oe)}function Pe(O,V,oe){Ee(O,oe[2*V],oe[2*V+1])}function Ze(O,V){for(var oe=0;oe|=1&O,O>>>=1,oe<<=1,0<--V;);return oe>>>1}function at(O,V,oe){var U,G,ge=new Array(k+1),Ae=0;for(U=1;U<=k;U++)ge[U]=Ae=Ae+oe[U-1]<<1;for(G=0;G<=V;G++){var Se=O[2*G+1];Se!==0&&(O[2*G]=Ze(ge[Se]++,Se))}}function Qe(O){var V;for(V=0;V<p;V++)O.dyn_ltree[2*V]=0;for(V=0;V<g;V++)O.dyn_dtree[2*V]=0;for(V=0;V<m;V++)O.bl_tree[2*V]=0;O.dyn_ltree[2*w]=1,O.opt_len=O.static_len=0,O.last_lit=O.matches=0}function At(O){8<O.bi_valid?ve(O,O.bi_buf):0<O.bi_valid&&(O.pending_buf[O.pending++]=O.bi_buf),O.bi_buf=0,O.bi_valid=0}function se(O,V,oe,U){var G=2*V,ge=2*oe;return O[G]<O[ge]||O[G]===O[ge]&&U[V]<=U[oe]}function Ie(O,V,oe){for(var U=O.heap[oe],G=oe<<1;G<=O.heap_len&&(G<O.heap_len&&se(V,O.heap[G+1],O.heap[G],O.depth)&&G++,!se(V,U,O.heap[G],O.depth));)O.heap[oe]=O.heap[G],oe=G,G<<=1;O.heap[oe]=U}function Ue(O,V,oe){var U,G,ge,Ae,Se=0;if(O.last_lit!==0)for(;U=O.pending_buf[O.d_buf+2*Se]<<8|O.pending_buf[O.d_buf+2*Se+1],G=O.pending_buf[O.l_buf+Se],Se++,U===0?Pe(O,G,V):(Pe(O,(ge=x[G])+f+1,V),(Ae=N[ge])!==0&&Ee(O,G-=W[ge],Ae),Pe(O,ge=be(--U),oe),(Ae=H[ge])!==0&&Ee(O,U-=X[ge],Ae)),Se<O.last_lit;);Pe(O,w,V)}function ne(O,V){var oe,U,G,ge=V.dyn_tree,Ae=V.stat_desc.static_tree,Se=V.stat_desc.has_stree,Te=V.stat_desc.elems,Ye=-1;for(O.heap_len=0,O.heap_max=v,oe=0;oe<Te;oe++)ge[2*oe]!==0?(O.heap[++O.heap_len]=Ye=oe,O.depth[oe]=0):ge[2*oe+1]=0;for(;O.heap_len<2;)ge[2*(G=O.heap[++O.heap_len]=Ye<2?++Ye:0)]=1,O.depth[G]=0,O.opt_len--,Se&&(O.static_len-=Ae[2*G+1]);for(V.max_code=Ye,oe=O.heap_len>>1;1<=oe;oe--)Ie(O,ge,oe);for(G=Te;oe=O.heap[1],O.heap[1]=O.heap[O.heap_len--],Ie(O,ge,1),U=O.heap[1],O.heap[--O.heap_max]=oe,O.heap[--O.heap_max]=U,ge[2*G]=ge[2*oe]+ge[2*U],O.depth[G]=(O.depth[oe]>=O.depth[U]?O.depth[oe]:O.depth[U])+1,ge[2*oe+1]=ge[2*U+1]=G,O.heap[1]=G++,Ie(O,ge,1),2<=O.heap_len;);O.heap[--O.heap_max]=O.heap[1],(function(rt,ht){var Pt,Ft,Wt,$e,cn,jn,Ut=ht.dyn_tree,In=ht.max_code,qr=ht.stat_desc.static_tree,Cr=ht.stat_desc.has_stree,Er=ht.stat_desc.extra_bits,Je=ht.stat_desc.extra_base,wt=ht.stat_desc.max_length,Dt=0;for($e=0;$e<=k;$e++)rt.bl_count[$e]=0;for(Ut[2*rt.heap[rt.heap_max]+1]=0,Pt=rt.heap_max+1;Pt<v;Pt++)wt<($e=Ut[2*Ut[2*(Ft=rt.heap[Pt])+1]+1]+1)&&($e=wt,Dt++),Ut[2*Ft+1]=$e,In<Ft||(rt.bl_count[$e]++,cn=0,Je<=Ft&&(cn=Er[Ft-Je]),jn=Ut[2*Ft],rt.opt_len+=jn*($e+cn),Cr&&(rt.static_len+=jn*(qr[2*Ft+1]+cn)));if(Dt!==0){do{for($e=wt-1;rt.bl_count[$e]===0;)$e--;rt.bl_count[$e]--,rt.bl_count[$e+1]+=2,rt.bl_count[wt]--,Dt-=2}while(0<Dt);for($e=wt;$e!==0;$e--)for(Ft=rt.bl_count[$e];Ft!==0;)In<(Wt=rt.heap[--Pt])||(Ut[2*Wt+1]!==$e&&(rt.opt_len+=($e-Ut[2*Wt+1])*Ut[2*Wt],Ut[2*Wt+1]=$e),Ft--)}})(O,V),at(ge,Ye,O.bl_count)}function A(O,V,oe){var U,G,ge=-1,Ae=V[1],Se=0,Te=7,Ye=4;for(Ae===0&&(Te=138,Ye=3),V[2*(oe+1)+1]=65535,U=0;U<=oe;U++)G=Ae,Ae=V[2*(U+1)+1],++Se<Te&&G===Ae||(Se<Ye?O.bl_tree[2*G]+=Se:G!==0?(G!==ge&&O.bl_tree[2*G]++,O.bl_tree[2*b]++):Se<=10?O.bl_tree[2*T]++:O.bl_tree[2*L]++,ge=G,Ye=(Se=0)===Ae?(Te=138,3):G===Ae?(Te=6,3):(Te=7,4))}function ie(O,V,oe){var U,G,ge=-1,Ae=V[1],Se=0,Te=7,Ye=4;for(Ae===0&&(Te=138,Ye=3),U=0;U<=oe;U++)if(G=Ae,Ae=V[2*(U+1)+1],!(++Se<Te&&G===Ae)){if(Se<Ye)for(;Pe(O,G,O.bl_tree),--Se!=0;);else G!==0?(G!==ge&&(Pe(O,G,O.bl_tree),Se--),Pe(O,b,O.bl_tree),Ee(O,Se-3,2)):Se<=10?(Pe(O,T,O.bl_tree),Ee(O,Se-3,3)):(Pe(O,L,O.bl_tree),Ee(O,Se-11,7));ge=G,Ye=(Se=0)===Ae?(Te=138,3):G===Ae?(Te=6,3):(Te=7,4)}}l(X);var F=!1;function Y(O,V,oe,U){Ee(O,(c<<1)+(U?1:0),3),(function(G,ge,Ae,Se){At(G),Se&&(ve(G,Ae),ve(G,~Ae)),i.arraySet(G.pending_buf,G.window,ge,Ae,G.pending),G.pending+=Ae})(O,V,oe,!0)}o._tr_init=function(O){F||((function(){var V,oe,U,G,ge,Ae=new Array(k+1);for(G=U=0;G<d-1;G++)for(W[G]=U,V=0;V<1<<N[G];V++)x[U++]=G;for(x[U-1]=G,G=ge=0;G<16;G++)for(X[G]=ge,V=0;V<1<<H[G];V++)K[ge++]=G;for(ge>>=7;G<g;G++)for(X[G]=ge<<7,V=0;V<1<<H[G]-7;V++)K[256+ge++]=G;for(oe=0;oe<=k;oe++)Ae[oe]=0;for(V=0;V<=143;)Z[2*V+1]=8,V++,Ae[8]++;for(;V<=255;)Z[2*V+1]=9,V++,Ae[9]++;for(;V<=279;)Z[2*V+1]=7,V++,Ae[7]++;for(;V<=287;)Z[2*V+1]=8,V++,Ae[8]++;for(at(Z,p+1,Ae),V=0;V<g;V++)R[2*V+1]=5,R[2*V]=Ze(V,5);$=new we(Z,N,f+1,p,k),ee=new we(R,H,0,g,k),Q=new we(new Array(0),z,0,m,S)})(),F=!0),O.l_desc=new ce(O.dyn_ltree,$),O.d_desc=new ce(O.dyn_dtree,ee),O.bl_desc=new ce(O.bl_tree,Q),O.bi_buf=0,O.bi_valid=0,Qe(O)},o._tr_stored_block=Y,o._tr_flush_block=function(O,V,oe,U){var G,ge,Ae=0;0<O.level?(O.strm.data_type===2&&(O.strm.data_type=(function(Se){var Te,Ye=4093624447;for(Te=0;Te<=31;Te++,Ye>>>=1)if(1&Ye&&Se.dyn_ltree[2*Te]!==0)return s;if(Se.dyn_ltree[18]!==0||Se.dyn_ltree[20]!==0||Se.dyn_ltree[26]!==0)return a;for(Te=32;Te<f;Te++)if(Se.dyn_ltree[2*Te]!==0)return a;return s})(O)),ne(O,O.l_desc),ne(O,O.d_desc),Ae=(function(Se){var Te;for(A(Se,Se.dyn_ltree,Se.l_desc.max_code),A(Se,Se.dyn_dtree,Se.d_desc.max_code),ne(Se,Se.bl_desc),Te=m-1;3<=Te&&Se.bl_tree[2*B[Te]+1]===0;Te--);return Se.opt_len+=3*(Te+1)+5+5+4,Te})(O),G=O.opt_len+3+7>>>3,(ge=O.static_len+3+7>>>3)<=G&&(G=ge)):G=ge=oe+5,oe+4<=G&&V!==-1?Y(O,V,oe,U):O.strategy===4||ge===G?(Ee(O,2+(U?1:0),3),Ue(O,Z,R)):(Ee(O,4+(U?1:0),3),(function(Se,Te,Ye,rt){var ht;for(Ee(Se,Te-257,5),Ee(Se,Ye-1,5),Ee(Se,rt-4,4),ht=0;ht<rt;ht++)Ee(Se,Se.bl_tree[2*B[ht]+1],3);ie(Se,Se.dyn_ltree,Te-1),ie(Se,Se.dyn_dtree,Ye-1)})(O,O.l_desc.max_code+1,O.d_desc.max_code+1,Ae+1),Ue(O,O.dyn_ltree,O.dyn_dtree)),Qe(O),U&&At(O)},o._tr_tally=function(O,V,oe){return O.pending_buf[O.d_buf+2*O.last_lit]=V>>>8&255,O.pending_buf[O.d_buf+2*O.last_lit+1]=255&V,O.pending_buf[O.l_buf+O.last_lit]=255&oe,O.last_lit++,V===0?O.dyn_ltree[2*oe]++:(O.matches++,V--,O.dyn_ltree[2*(x[oe]+f+1)]++,O.dyn_dtree[2*be(V)]++),O.last_lit===O.lit_bufsize-1},o._tr_align=function(O){Ee(O,2,3),Pe(O,w,Z),(function(V){V.bi_valid===16?(ve(V,V.bi_buf),V.bi_buf=0,V.bi_valid=0):8<=V.bi_valid&&(V.pending_buf[V.pending++]=255&V.bi_buf,V.bi_buf>>=8,V.bi_valid-=8)})(O)}},{"../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,p=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(b){process.nextTick(function(){S(b)})}:(function(){if(s.postMessage&&!s.importScripts){var b=!0,T=s.onmessage;return s.onmessage=function(){b=!1},s.postMessage("","*"),s.onmessage=T,b}})()?(f="setImmediate$"+Math.random()+"$",s.addEventListener?s.addEventListener("message",w,!1):s.attachEvent("onmessage",w),function(b){s.postMessage(f+b,"*")}):s.MessageChannel?((d=new MessageChannel).port1.onmessage=function(b){S(b.data)},function(b){d.port2.postMessage(b)}):v&&"onreadystatechange"in v.createElement("script")?(c=v.documentElement,function(b){var T=v.createElement("script");T.onreadystatechange=function(){S(b),T.onreadystatechange=null,c.removeChild(T),T=null},c.appendChild(T)}):function(b){setTimeout(S,0,b)},k.setImmediate=function(b){typeof b!="function"&&(b=new Function(""+b));for(var T=new Array(arguments.length-1),L=0;L<T.length;L++)T[L]=arguments[L+1];return g[p]={callback:b,args:T},l(p),p++},k.clearImmediate=C}function C(b){delete g[b]}function S(b){if(m)setTimeout(S,0,b);else{var T=g[b];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(b),m=!1}}}}function w(b){b.source===s&&typeof b.data=="string"&&b.data.indexOf(f)===0&&S(+b.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)})})),Ar="application/vnd.openxmlformats-officedocument.wordprocessingml.document",Ea="application/pdf",ku="text/html",AT={docx:Ar,pdf:Ea,html:ku},wp={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"};Rt();var IT=I2(_T(),1),ET=e=>typeof e!="string"?"":e.trim(),Ey=e=>{if(typeof e!="string")return"";const t=e.trim();return t?t.toLowerCase():""},Cp=e=>{if(typeof e!="string")return"";const t=e.trim();return t?t.toLowerCase():""},gc=e=>{const t=e??{},n=ET(t.id),r=Ey(t.email);return{id:n,email:r,name:typeof t.name=="string"?t.name:"",hasId:n.length>0,hasEmail:r.length>0}},BC=({current:e,other:t})=>{const n=gc(e),r=gc(t);return n.hasId&&r.hasId?n.id===r.id:n.hasEmail&&r.hasEmail?n.email===r.email:!1},Su=({actor:e,fallbackKey:t=""})=>{const n=gc(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 TT(e){return typeof e.captureStackTrace=="function"}var kp=class extends Error{constructor(e,t){super(e),this.cause=t,this.name="FileObjectError",TT(Error)&&Error.captureStackTrace(this,this.constructor)}},xT=class extends kp{constructor(e){super("Invalid data URI format: URI must contain exactly one comma separator"),this.uri=e,this.name="InvalidDataUriError"}},RT=class extends kp{constructor(e,t){super(`Failed to fetch file from URL: ${e}`,t),this.url=e,this.name="FetchFailedError"}},Ty=async(e,t,n)=>{try{if(e.startsWith("data:")&&e.includes(";base64,")){const i=e.split(",");if(i.length!==2)throw new xT(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 RT(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 kp?r:new kp("Failed to create file object",r)}};function LT(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 Sp=new WeakMap;function zC(e){return e.ownerDocument??document}function VC(e,t){const n=Sp.get(t);n?.bindings.delete(e),n&&n.bindings.size===0&&(t.removeEventListener("click",n.listener),Sp.delete(t))}function jC(e,t){const n=zC(e);e.__clickOutsideDocument&&e.__clickOutsideDocument!==n&&VC(e,e.__clickOutsideDocument);let r=Sp.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},Sp.set(n,r),n.addEventListener("click",i)}r.bindings.set(e,t),e.__clickOutsideHandler=r.listener,e.__clickOutsideDocument=n}var xy={mounted(e,t){jC(e,t)},updated(e,t){jC(e,t)},unmounted(e){VC(e,e.__clickOutsideDocument??zC(e)),delete e.__clickOutsideHandler,delete e.__clickOutsideDocument}};function MT(e){return e[1].user!==void 0}var DT=(e,t)=>{const n=new Set;return Array.from(t.entries()).filter(MT).filter(([r,o])=>{const i=Su({actor:o.user,fallbackKey:r});return!i||n.has(i)?!1:(n.add(i),!0)}).map(([r,o])=>{const i=Su({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}})},OT=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},PT="https://ingest.superdoc.dev/v1/collect",j$="community-and-eval-agplv3";function FT(){try{return"2.11.1-next.2"}catch{return"unknown"}}var NT=class{constructor(e){this.enabled=e.enabled,this.endpoint=e.endpoint||PT,this.licenseKey=e.licenseKey||"",this.metadata=e.metadata,this.superdocVersion=FT()}getBrowserInfo(){return typeof window>"u"?{userAgent:"",currentUrl:"",hostname:"",screenSize:{width:0,height:0}}:{userAgent:window.navigator.userAgent,currentUrl:window.location.origin,hostname:window.location.hostname,screenSize:{width:window.screen.width,height:window.screen.height}}}trackDocumentOpen(e,t=null){if(!this.enabled)return;const n={timestamp:new Date().toISOString(),documentId:e,documentCreatedAt:t};this.sendEvent(n)}async sendEvent(e){const t={superdocVersion:this.superdocVersion,browserInfo:this.getBrowserInfo(),...this.metadata&&{metadata:this.metadata},events:[e]};try{await fetch(this.endpoint,{method:"POST",headers:{"Content-Type":"application/json","X-License-Key":this.licenseKey},body:JSON.stringify(t),credentials:"omit"})}catch{}}},_p={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"},U$=[_p.INLINE_SDT_LABEL,_p.BLOCK_SDT_LABEL],UC={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"},BT=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"}}},H$=`.${_p.BLOCK_SDT}[${UC.SDT_ID}]`,$$=`[${UC.DRAGGABLE}="true"]`,zT=typeof window<"u",HC,Cf=e=>HC=e,$C=Symbol();function Ry(e){return e&&typeof e=="object"&&Object.prototype.toString.call(e)==="[object Object]"&&typeof e.toJSON!="function"}var kf;(function(e){e.direct="direct",e.patchObject="patch object",e.patchFunction="patch function"})(kf||(kf={}));var GC=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 VT(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 Ly(e,t,n){const r=new XMLHttpRequest;r.open("GET",e),r.responseType="blob",r.onload=function(){jT(r.response,t,n)},r.onerror=function(){console.error("could not download file")},r.send()}function WC(e){const t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch{}return t.status>=200&&t.status<=299}function Ap(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 Ip=typeof navigator=="object"?navigator:{userAgent:""},KC=/Macintosh/.test(Ip.userAgent)&&/AppleWebKit/.test(Ip.userAgent)&&!/Safari/.test(Ip.userAgent),jT=zT?typeof HTMLAnchorElement<"u"&&"download"in HTMLAnchorElement.prototype&&!KC?UT:"msSaveOrOpenBlob"in Ip?HT:$T:()=>{};function UT(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?WC(r.href)?Ly(e,t,n):(r.target="_blank",Ap(r)):Ap(r)):(r.href=URL.createObjectURL(e),setTimeout(function(){URL.revokeObjectURL(r.href)},4e4),setTimeout(function(){Ap(r)},0))}function HT(e,t="download",n){if(typeof e=="string")if(WC(e))Ly(e,t,n);else{const r=document.createElement("a");r.href=e,r.target="_blank",setTimeout(function(){Ap(r)})}else navigator.msSaveOrOpenBlob(VT(e,n),t)}function $T(e,t,n,r){if(r=r||open("","_blank"),r&&(r.document.title=r.document.body.innerText="downloading..."),typeof e=="string")return Ly(e,t,n);const o=e.type==="application/octet-stream",i=/constructor/i.test(String(GC.HTMLElement))||"safari"in GC,s=/CriOS\/[\d]+/.test(navigator.userAgent);if((s||o&&i||KC)&&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:G$}=Object;function GT(){const e=Ng(!0),t=e.run(()=>te({}));let n=[],r=[];const o=ro({install(i){Cf(o),o._a=i,i.provide($C,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 qC=()=>{};function YC(e,t,n,r=qC){e.add(t);const o=()=>{e.delete(t)&&r()};return!n&&Bg()&&V2(o),o}function _u(e,...t){e.forEach(n=>{n(...t)})}var WT=e=>e(),XC=Symbol(),My=Symbol();function Dy(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];Ry(o)&&Ry(r)&&e.hasOwnProperty(n)&&!dr(r)&&!Ni(r)?e[n]=Dy(o,r):e[n]=r}return e}var KT=Symbol();function qT(e){return!Ry(e)||!Object.prototype.hasOwnProperty.call(e,KT)}var{assign:yl}=Object;function YT(e){return!!(dr(e)&&e.effect)}function XT(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=Z2(n.state.value[e]);return yl(d,i,Object.keys(s||{}).reduce((f,p)=>(f[p]=ro(Ce(()=>{Cf(n);const g=n._s.get(e);return s[p].call(g,g)})),f),{}))}return l=ZC(e,c,t,n,r,!0),l}function ZC(e,t,n={},r,o,i){let s;const a=yl({actions:{}},n),l={deep:!0};let c,d,f=new Set,p=new Set,g;const m=r.state.value[e];!i&&!m&&(r.state.value[e]={});let v;function k(L){let N;c=d=!1,typeof L=="function"?(L(r.state.value[e]),N={type:kf.patchFunction,storeId:e,events:g}):(Dy(r.state.value[e],L),N={type:kf.patchObject,payload:L,storeId:e,events:g});const H=v=Symbol();kt().then(()=>{v===H&&(c=!0)}),d=!0,_u(f,N,r.state.value[e])}const C=i?function(){const{state:N}=n,H=N?N():{};this.$patch(z=>{yl(z,H)})}:qC;function S(){s.stop(),f.clear(),p.clear(),r._s.delete(e)}const w=(L,N="")=>{if(XC in L)return L[My]=N,L;const H=function(){Cf(r);const z=Array.from(arguments),B=new Set,Z=new Set;function R(W){B.add(W)}function K(W){Z.add(W)}_u(p,{args:z,name:H[My],store:b,after:R,onError:K});let x;try{x=L.apply(this&&this.$id===e?this:b,z)}catch(W){throw _u(Z,W),W}return x instanceof Promise?x.then(W=>(_u(B,W),W)).catch(W=>(_u(Z,W),Promise.reject(W))):(_u(B,x),x)};return H[XC]=!0,H[My]=N,H},b=no({_p:r,$id:e,$onAction:YC.bind(null,p),$patch:k,$reset:C,$subscribe(L,N={}){const H=YC(f,L,N.detached,()=>z()),z=s.run(()=>Bt(()=>r.state.value[e],B=>{(N.flush==="sync"?d:c)&&L({storeId:e,type:kf.direct,events:g},B)},yl({},l,N)));return H},$dispose:S});r._s.set(e,b);const T=(r._a&&r._a.runWithContext||WT)(()=>r._e.run(()=>(s=Ng()).run(()=>t({action:w}))));for(const L in T){const N=T[L];dr(N)&&!YT(N)||Ni(N)?i||(m&&qT(N)&&(dr(N)?N.value=m[L]:Dy(N,m[L])),r.state.value[e][L]=N):typeof N=="function"&&(T[L]=w(N,L),a.actions[L]=N)}return yl(b,T),yl(gn(b),T),Object.defineProperty(b,"$state",{get:()=>r.state.value[e],set:L=>{k(N=>{yl(N,L)})}}),r._p.forEach(L=>{yl(b,s.run(()=>L({store:b,app:r._a,pinia:r,options:a})))}),m&&i&&n.hydrate&&n.hydrate(b.$state,m),c=!0,d=!0,b}function QC(e,t,n){let r;const o=typeof t=="function";r=o?n:t;function i(s,a){const l=A1();return s=s||(l?ll($C,null):null),s&&Cf(s),s=HC,s._s.has(e)||(o?ZC(e,t,r,s):XT(e,r,s)),s._s.get(e)}return i.$id=e,i}function Ns(e){const t=gn(e),n={};for(const r in t){const o=t[r];o.effect?n[r]=Ce({get:()=>e[r],set(i){e[r]=i}}):(dr(o)||Ni(o))&&(n[r]=Wg(e,r))}return n}var Sf=(e,t="document")=>{if(!e)return null;if(typeof File=="function"&&e instanceof File)return e;if(typeof Blob=="function"&&e instanceof Blob){if(typeof File=="function"){const n=e.name||t;return new File([e],n,{type:e.type})}return e}return e.originFileObj?Sf(e.originFileObj,e.name||t):e.file?Sf(e.file,e.name||t):e.raw?Sf(e.raw,e.name||t):null},JC=Object.getOwnPropertyDescriptor(ArrayBuffer.prototype,"byteLength")?.get,ZT=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Uint8Array.prototype),Symbol.toStringTag)?.get,bl=e=>{if(ArrayBuffer.isView(e))return ZT?.call(e)==="Uint8Array";if(!JC)return!1;try{return JC.call(e),!0}catch{return!1}},Oy=e=>{if(e instanceof Uint8Array)return e;const t=ArrayBuffer.isView(e)?e:new Uint8Array(e);return Uint8Array.from(t)},Py=(e,t)=>new Blob([Oy(e)],{type:t}),Fy=e=>{switch(e.toLowerCase()){case"docx":case Ar:return Ar;case"pdf":case Ea:return Ea;case"html":case ku:return ku;default:return e}},Ep=(e="")=>{const t=String(e).toLowerCase();return t.endsWith(".docx")?Ar:t.endsWith(".pdf")?Ea:t.endsWith(".html")||t.endsWith(".htm")?ku:t.endsWith(".md")||t.endsWith(".markdown")?"text/markdown":""},QT=e=>e==="application/vnd.openxmlformats-officedocument.wordprocessingml.document"?"document.docx":e==="application/pdf"?"document.pdf":e==="text/html"?"document.html":"document",JT="application/octet-stream",Ny=e=>{if(bl(e))return{type:Ar,data:Oy(e),name:"document.docx"};const t=Sf(e);if(t){const n=e&&typeof e.name=="string"?e.name:"",r=t.name||"",o=Ep(n),i=o||Ep(r),s=t.type.toLowerCase()===JT,a=s&&o?n:r||n||"document",l=s&&i?i:t.type||i||"application/vnd.openxmlformats-officedocument.wordprocessingml.document";let c=t;return s&&i&&typeof File=="function"&&t instanceof File?c=new File([t],a,{type:l,lastModified:t.lastModified}):s&&i&&typeof Blob=="function"&&t instanceof Blob&&(c=new Blob([t],{type:l})),{type:l,data:c,name:a}}if(e&&typeof e=="object"&&"data"in e){if(bl(e.data)){const r=Fy(e.type||Ep(e.name)||"application/vnd.openxmlformats-officedocument.wordprocessingml.document");return{...e,type:r,data:r==="application/vnd.openxmlformats-officedocument.wordprocessingml.document"?Oy(e.data):Py(e.data,r),name:e.name||QT(r)}}const n=Sf(e.data,e.name);if(n){const r=typeof e.type=="string"&&e.type?Fy(e.type):"",o=r||n.type||Ep(n.name)||"application/vnd.openxmlformats-officedocument.wordprocessingml.document",i=!n.type||!!(r&&n.type!==r);let s=n;return i&&typeof File=="function"&&n instanceof File?s=new File([n],n.name,{type:o,lastModified:n.lastModified}):i&&typeof Blob=="function"&&n instanceof Blob&&(s=new Blob([n],{type:o})),{...e,type:o,data:s,name:e.name||n.name||"document"}}}if(e&&typeof e=="object"&&"url"in e&&typeof e.type=="string"){const n=Fy(e.type);if(n!==e.type)return{...e,type:n}}return e};Rt();function ex(e,t){const n=e.itemid,r=e,o=t!==null&&typeof t=="object"?no({...t}):te(t),i=te(null);return Bt(o,(a,l)=>{const c={fieldId:n.value,changeTime:Date.now(),oldValue:l,newValue:a,originalField:r};i.value=c}),{value:o}}function tx(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}=ex(e,i,te([])),l=te(e.itemtype),c=te(e.itemfieldtype),d=e,f=no({fontFamily:e.fontfamily||"Arial",fontSize:e.font_size||"12pt",originalFontSize:e.original_font_size||"12pt"}),p=te(e.logicrules),g=te(!1),m=no({}),v={SELECT:rx,IMAGEINPUT:nx,CHECKBOXINPUT:ox};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:p,hidden:g,originalJSON:d,fieldStyle:f,valueGetter:e.valueGetter,...m}}function nx(e){return{fontfamily:te(e.fontfamily),iteminputtype:te(e.iteminputtype)}}function rx(e){return{options:te(e.itemoptions)}}function ox(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 Bs=()=>new Map,By=e=>{const t=Bs();return e.forEach((n,r)=>{t.set(r,n)}),t},Au=(e,t,n)=>{let r=e.get(t);return r===void 0&&e.set(t,r=n()),r},ix=(e,t)=>{const n=[];for(const[r,o]of e)n.push(t(o,r));return n},sx=(e,t)=>{for(const[n,r]of e)if(t(r,n))return!0;return!1},Iu=()=>new Set,zy=e=>e[e.length-1],Eu=Array.from,Vy=(e,t)=>{for(let n=0;n<e.length;n++)if(!t(e[n],n,e))return!1;return!0},e3=(e,t)=>{for(let n=0;n<e.length;n++)if(t(e[n],n,e))return!0;return!1},ax=(e,t)=>{const n=new Array(e);for(let r=0;r<e;r++)n[r]=t(r,n);return n},Tp=Array.isArray,lx=class{constructor(){this._observers=Bs()}on(e,t){return Au(this._observers,e,Iu).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 Eu((this._observers.get(e)||Bs()).values()).forEach(n=>n(...t))}destroy(){this._observers=Bs()}},Ta=Math.floor,xp=Math.abs,t3=(e,t)=>e<t?e:t,Tu=(e,t)=>e>t?e:t,W$=Number.isNaN,cx=e=>e!==0?e<0:1/e<0,K$=1,q$=2,Y$=4,X$=8,Z$=32,Q$=64,J$=128,ux=1<<17,dx=1<<18,fx=1<<19,hx=1<<20,px=1<<21,mx=1<<22,gx=1<<23,vx=1<<24,yx=1<<25,bx=1<<26,wx=1<<27,Cx=1<<28,kx=1<<29,Sx=1<<30,eG=31,tG=63,nG=127,rG=ux-1,oG=dx-1,iG=fx-1,sG=hx-1,aG=px-1,lG=mx-1,cG=gx-1,uG=vx-1,dG=yx-1,fG=bx-1,hG=wx-1,pG=Cx-1,mG=kx-1,gG=Sx-1,vG=2147483647,n3=Number.MAX_SAFE_INTEGER,r3=Number.MIN_SAFE_INTEGER,_x=Number.isInteger||(e=>typeof e=="number"&&isFinite(e)&&Ta(e)===e),yG=Number.isNaN,bG=Number.parseInt,o3=String.fromCharCode,wG=String.fromCodePoint,CG=o3(65535),Ax=e=>e.toLowerCase(),Ix=/^\s*/g,Ex=e=>e.replace(Ix,""),Tx=/([A-Z])/g,i3=(e,t)=>Ex(e.replace(Tx,n=>`${t}${Ax(n)}`)),xx=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},_f=typeof TextEncoder<"u"?new TextEncoder:null,Rx=e=>_f.encode(e),Lx=_f?Rx:xx,jy=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});jy&&jy.decode(new Uint8Array).length===1&&(jy=null);var Mx=(e,t)=>ax(t,()=>e).join(""),Af=class{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}},Uy=()=>new Af,Dx=e=>{let t=e.cpos;for(let n=0;n<e.bufs.length;n++)t+=e.bufs[n].length;return t},xa=e=>{const t=new Uint8Array(Dx(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},Ox=(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(Tu(n,t)*2),e.cpos=0)},ho=(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},Hy=ho,Jn=(e,t)=>{for(;t>127;)ho(e,128|127&t),t=Ta(t/128);ho(e,127&t)},$y=(e,t)=>{const n=cx(t);for(n&&(t=-t),ho(e,(t>63?128:0)|(n?64:0)|63&t),t=Ta(t/64);t>0;)ho(e,(t>127?128:0)|127&t),t=Ta(t/128)},Gy=new Uint8Array(3e4),Px=Gy.length/3,Fx=(e,t)=>{if(t.length<Px){const n=_f.encodeInto(t,Gy).written||0;Jn(e,n);for(let r=0;r<n;r++)ho(e,Gy[r])}else _i(e,Lx(t))},Nx=(e,t)=>{const n=unescape(encodeURIComponent(t)),r=n.length;Jn(e,r);for(let o=0;o<r;o++)ho(e,n.codePointAt(o))},xu=_f&&_f.encodeInto?Fx:Nx,Wy=(e,t)=>{const n=e.cbuf.length,r=e.cpos,o=t3(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(Tu(n*2,i)),e.cbuf.set(t.subarray(o)),e.cpos=i)},_i=(e,t)=>{Jn(e,t.byteLength),Wy(e,t)},Ky=(e,t)=>{Ox(e,t);const n=new DataView(e.cbuf.buffer,e.cpos,t);return e.cpos+=t,n},Bx=(e,t)=>Ky(e,4).setFloat32(0,t,!1),zx=(e,t)=>Ky(e,8).setFloat64(0,t,!1),Vx=(e,t)=>Ky(e,8).setBigInt64(0,t,!1),s3=new DataView(new ArrayBuffer(4)),jx=e=>(s3.setFloat32(0,e),s3.getFloat32(0)===e),If=(e,t)=>{switch(typeof t){case"string":ho(e,119),xu(e,t);break;case"number":_x(t)&&xp(t)<=2147483647?(ho(e,125),$y(e,t)):jx(t)?(ho(e,124),Bx(e,t)):(ho(e,123),zx(e,t));break;case"bigint":ho(e,122),Vx(e,t);break;case"object":if(t===null)ho(e,126);else if(Tp(t)){ho(e,117),Jn(e,t.length);for(let n=0;n<t.length;n++)If(e,t[n])}else if(t instanceof Uint8Array)ho(e,116),_i(e,t);else{ho(e,118);const n=Object.keys(t);Jn(e,n.length);for(let r=0;r<n.length;r++){const o=n[r];xu(e,o),If(e,t[o])}}break;case"boolean":ho(e,t?120:121);break;default:ho(e,127)}},a3=class extends Af{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)}},l3=e=>{e.count>0&&($y(e.encoder,e.count===1?e.s:-e.s),e.count>1&&Jn(e.encoder,e.count-2))},Rp=class{constructor(){this.encoder=new Af,this.s=0,this.count=0}write(e){this.s===e?this.count++:(l3(this),this.count=1,this.s=e)}toUint8Array(){return l3(this),xa(this.encoder)}},c3=e=>{if(e.count>0){const t=e.diff*2+(e.count===1?0:1);$y(e.encoder,t),e.count>1&&Jn(e.encoder,e.count-2)}},qy=class{constructor(){this.encoder=new Af,this.s=0,this.count=0,this.diff=0}write(e){this.diff===e-this.s?(this.s=e,this.count++):(c3(this),this.count=1,this.diff=e-this.s,this.s=e)}toUint8Array(){return c3(this),xa(this.encoder)}},Ux=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 Af;return this.sarr.push(this.s),this.s="",xu(e,this.sarr.join("")),Wy(e,this.lensE.toUint8Array()),xa(e)}},wl=e=>new Error(e),os=()=>{throw wl("Method unimplemented")},Ra=()=>{throw wl("Unexpected case")},kG=crypto.subtle,Hx=crypto.getRandomValues.bind(crypto),u3=()=>Hx(new Uint32Array(1))[0],$x="10000000-1000-4000-8000-100000000000",Gx=()=>$x.replace(/[018]/g,e=>(e^u3()&15>>e/4).toString(16)),Wx=Date.now,d3=e=>new Promise(e),SG=Promise.all.bind(Promise),f3=e=>e===void 0?null:e,Kx=class{constructor(){this.map=new Map}setItem(e,t){this.map.set(e,t)}getItem(e){return this.map.get(e)}},h3=new Kx,qx=!0;try{typeof localStorage<"u"&&localStorage&&(h3=localStorage,qx=!1)}catch{}var Yx=h3,Ef=Symbol("Equality"),p3=(e,t)=>e===t||!!e?.[Ef]?.(t)||!1,Xx=e=>typeof e=="object",Zx=Object.assign,Qx=Object.keys,Jx=(e,t)=>{for(const n in e)t(e[n],n)},Lp=e=>Qx(e).length,e6=e=>{for(const t in e)return!1;return!0},Tf=(e,t)=>{for(const n in e)if(!t(e[n],n))return!1;return!0},Yy=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),t6=(e,t)=>e===t||Lp(e)===Lp(t)&&Tf(e,(n,r)=>(n!==void 0||Yy(t,r))&&p3(t[r],n)),n6=Object.freeze,m3=e=>{for(const t in e){const n=e[t];(typeof n=="object"||typeof n=="function")&&m3(e[t])}return n6(e)},Xy=(e,t,n=0)=>{try{for(;n<e.length;n++)e[n](...t)}finally{n<e.length&&Xy(e,t,n+1)}},Mp=(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[Ef]!=null)return e[Ef](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)||!Mp(e.get(n),t.get(n)))return!1;break;case void 0:case Object:if(Lp(e)!==Lp(t))return!1;for(const n in e)if(!Yy(e,n)||!Mp(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(!Mp(e[n],t[n]))return!1;break;default:return!1}return!0},r6=(e,t)=>t.includes(e),xf=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]",_G=typeof navigator<"u"?/Mac/.test(navigator.platform):!1,zs,o6=[],i6=()=>{if(zs===void 0)if(xf){zs=Bs();const e=process.argv;let t=null;for(let n=0;n<e.length;n++){const r=e[n];r[0]==="-"?(t!==null&&zs.set(t,""),t=r):t!==null?(zs.set(t,r),t=null):o6.push(r)}t!==null&&zs.set(t,"")}else typeof location=="object"?(zs=Bs(),(location.search||"?").slice(1).split("&").forEach(e=>{if(e.length!==0){const[t,n]=e.split("=");zs.set(`--${i3(t,"-")}`,n),zs.set(`-${i3(t,"-")}`,n)}})):zs=Bs();return zs},Zy=e=>i6().has(e),Dp=e=>f3(xf?process.env[e.toUpperCase().replaceAll("-","_")]:Yx.getItem(e)),g3=e=>Zy("--"+e)||Dp(e)!==null,s6=g3("production"),a6=xf&&r6(process.env.FORCE_COLOR,["true","1","2"]),l6=a6||!Zy("--no-colors")&&!g3("no-color")&&(!xf||process.stdout.isTTY)&&(!xf||Zy("--color")||Dp("COLORTERM")!==null||(Dp("TERM")||"").includes("color")),c6=class{constructor(e,t){this.left=e,this.right=t}},La=(e,t)=>new c6(e,t),v3=e=>e.next()>=.5,Qy=(e,t,n)=>Ta(e.next()*(n+1-t)+t),y3=(e,t,n)=>Ta(e.next()*(n+1-t)+t),Jy=(e,t,n)=>y3(e,t,n),u6=e=>o3(Jy(e,97,122)),d6=(e,t=0,n=20)=>{const r=Jy(e,t,n);let o="";for(let i=0;i<r;i++)o+=u6(e);return o},e0=(e,t)=>t[Jy(e,0,t.length-1)],f6=Symbol("0schema"),h6=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(Mx(" ",(this._rerrs.length-t)*2)+`${n.path!=null?`[${n.path}] `:""}${n.has} doesn't match ${n.expected}. ${n.message}`)}return e.join(`
|
|
5
5
|
`)}},t0=(e,t)=>e===t?!0:e==null||t==null||e.constructor!==t.constructor?!1:e[Ef]?p3(e,t):Tp(e)?Vy(e,n=>e3(t,r=>t0(n,r))):Xx(e)?Tf(e,(n,r)=>t0(n,t[r])):!1,Qo=class{static _dilutes=!1;extends(e){let[t,n]=[this.shape,e.shape];return this.constructor._dilutes&&([n,t]=[t,n]),t0(t,n)}equals(e){return this.constructor===e.constructor&&Mp(this.shape,e.shape)}[f6](){return!0}[Ef](e){return this.equals(e)}validate(e){return this.check(e)}check(e,t){os()}get nullable(){return Ru(this,zp)}get optional(){return new C3(this)}cast(e){return P3(e,this),e}expect(e){return P3(e,this),e}},n0=class extends Qo{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}},Xr=(e,t=null)=>new n0(e,t),AG=Xr(n0),r0=class extends Qo{constructor(e){super(),this.shape=e}check(e,t){const n=this.shape(e);return!n&&t?.extend(null,"custom prop",e?.constructor.name,"failed to check custom prop"),n}},po=e=>new r0(e),IG=Xr(r0),Op=class extends Qo{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}},Pp=(...e)=>new Op(e),b3=Xr(Op),p6=RegExp.escape||(e=>e.replace(/[().|&,$^[\]]/g,t=>"\\"+t)),w3=e=>{if(Mu.check(e))return[p6(e)];if(b3.check(e))return e.shape.map(t=>t+"");if(M3.check(e))return["[+-]?\\d+.?\\d*"];if(D3.check(e))return[".*"];if(Fp.check(e))return e.shape.map(w3).flat(1);Ra()},m6=class extends Qo{constructor(e){super(),this.shape=e,this._r=new RegExp("^"+e.map(w3).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}},EG=Xr(m6),g6=Symbol("optional"),C3=class extends Qo{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[g6](){return!0}},v6=Xr(C3),k3=class extends Qo{check(e,t){return t?.extend(null,"never",typeof e),!1}},TG=new k3,xG=Xr(k3),S3=class cE extends Qo{constructor(t,n=!1){super(),this.shape=t,this._isPartial=n}static _dilutes=!0;get partial(){return new cE(this.shape,!0)}check(t,n){return t==null?(n?.extend(null,"object","null"),!1):Tf(this.shape,(r,o)=>{const i=this._isPartial&&!Yy(t,o)||r.check(t[o],n);return!i&&n?.extend(o.toString(),r.toString(),typeof t[o],"Object property does not match"),i})}},y6=e=>new S3(e),b6=Xr(S3),w6=po(e=>e!=null&&(e.constructor===Object||e.constructor==null)),_3=class extends Qo{constructor(e,t){super(),this.shape={keys:e,values:t}}check(e,t){return e!=null&&Tf(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)})}},A3=(e,t)=>new _3(e,t),C6=Xr(_3),I3=class extends Qo{constructor(e){super(),this.shape=e}check(e,t){return e!=null&&Tf(this.shape,(n,r)=>{const o=n.check(e[r],t);return!o&&t?.extend(r.toString(),"Tuple",typeof n),o})}},k6=(...e)=>new I3(e),RG=Xr(I3),E3=class extends Qo{constructor(e){super(),this.shape=e.length===1?e[0]:new o0(e)}check(e,t){const n=Tp(e)&&Vy(e,r=>this.shape.check(r));return!n&&t?.extend(null,"Array",""),n}},T3=(...e)=>new E3(e),S6=Xr(E3),_6=po(e=>Tp(e)),x3=class extends Qo{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}},A6=(e,t=null)=>new x3(e,t),LG=Xr(x3),I6=A6(Qo),E6=class extends Qo{constructor(e){super(),this.len=e.length-1,this.args=k6(...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}},T6=Xr(E6),x6=po(e=>typeof e=="function"),R6=class extends Qo{constructor(e){super(),this.shape=e}check(e,t){const n=Vy(this.shape,r=>r.check(e,t));return!n&&t?.extend(null,"Intersectinon",typeof e),n}},MG=Xr(R6,e=>e.shape.length>0),o0=class extends Qo{static _dilutes=!0;constructor(e){super(),this.shape=e}check(e,t){const n=e3(this.shape,r=>r.check(e,t));return t?.extend(null,"Union",typeof e),n}},Ru=(...e)=>e.findIndex(t=>Fp.check(t))>=0?Ru(...e.map(t=>Rf(t)).map(t=>Fp.check(t)?t.shape:[t]).flat(1)):e.length===1?e[0]:new o0(e),Fp=Xr(o0),R3=()=>!0,Np=po(R3),L6=Xr(r0,e=>e.shape===R3),i0=po(e=>typeof e=="bigint"),M6=po(e=>e===i0),L3=po(e=>typeof e=="symbol"),DG=po(e=>e===L3),Lu=po(e=>typeof e=="number"),M3=po(e=>e===Lu),Mu=po(e=>typeof e=="string"),D3=po(e=>e===Mu),Bp=po(e=>typeof e=="boolean"),D6=po(e=>e===Bp),O3=Pp(void 0),OG=Xr(Op,e=>e.shape.length===1&&e.shape[0]===void 0),PG=Pp(void 0),zp=Pp(null),O6=Xr(Op,e=>e.shape.length===1&&e.shape[0]===null),FG=Xr(Uint8Array),NG=Xr(n0,e=>e.shape===Uint8Array),P6=Ru(Lu,Mu,zp,O3,i0,Bp,L3),BG=(()=>{const e=T3(Np),t=A3(Mu,Np),n=Ru(Lu,Mu,zp,Bp,e,t);return e.shape=n,t.shape.values=n,n})(),Rf=e=>{if(I6.check(e))return e;if(w6.check(e)){const t={};for(const n in e)t[n]=Rf(e[n]);return y6(t)}else{if(_6.check(e))return Ru(...e.map(Rf));if(P6.check(e))return Pp(e);if(x6.check(e))return Xr(e)}Ra()},P3=s6?()=>{}:(e,t)=>{const n=new h6;if(!t.check(e,n))throw wl(`Expected value to be of type ${t.constructor.name}.
|
|
6
6
|
${n.toString()}`)},F6=class{constructor(e){this.patterns=[],this.$state=e}if(e,t){return this.patterns.push({if:Rf(e),h:t}),this}else(e){return this.if(Np,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 wl("Unhandled pattern")}}},N6=e=>new F6(e),F3=N6(Np).if(M3,(e,t)=>Qy(t,r3,n3)).if(D3,(e,t)=>d6(t)).if(D6,(e,t)=>v3(t)).if(M6,(e,t)=>BigInt(Qy(t,r3,n3))).if(Fp,(e,t)=>Du(t,e0(t,e.shape))).if(b6,(e,t)=>{const n={};for(const r in e.shape){let o=e.shape[r];if(v6.check(o)){if(v3(t))continue;o=o.shape}n[r]=F3(o,t)}return n}).if(S6,(e,t)=>{const n=[],r=y3(t,0,42);for(let o=0;o<r;o++)n.push(Du(t,e.shape));return n}).if(b3,(e,t)=>e0(t,e.shape)).if(O6,(e,t)=>null).if(T6,(e,t)=>{const n=Du(t,e.res);return()=>n}).if(L6,(e,t)=>Du(t,e0(t,[Lu,Mu,zp,O3,i0,Bp,T3(Lu),A3(Ru("a","b","c"),Lu)]))).if(C6,(e,t)=>{const n={},r=Qy(t,0,3);for(let o=0;o<r;o++){const i=Du(t,e.shape.keys);n[i]=Du(t,e.shape.values)}return n}).done(),Du=(e,t)=>F3(Rf(t),e),vc=typeof document<"u"?document:{},zG=po(e=>e.nodeType===U6),VG=typeof DOMParser<"u"?new DOMParser:null,jG=po(e=>e.nodeType===z6),UG=po(e=>e.nodeType===V6),B6=e=>ix(e,(t,n)=>`${n}:${t};`).join(""),z6=vc.ELEMENT_NODE,V6=vc.TEXT_NODE,HG=vc.CDATA_SECTION_NODE,$G=vc.COMMENT_NODE,j6=vc.DOCUMENT_NODE,GG=vc.DOCUMENT_TYPE_NODE,U6=vc.DOCUMENT_FRAGMENT_NODE,WG=po(e=>e.nodeType===j6),Ma=Symbol,N3=Ma(),B3=Ma(),H6=Ma(),$6=Ma(),G6=Ma(),z3=Ma(),W6=Ma(),s0=Ma(),K6=Ma(),q6=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},KG=Wx(),Y6={[N3]:La("font-weight","bold"),[B3]:La("font-weight","normal"),[H6]:La("color","blue"),[G6]:La("color","green"),[$6]:La("color","grey"),[z3]:La("color","red"),[W6]:La("color","purple"),[s0]:La("color","orange"),[K6]:La("color","black")},X6=e=>{e.length===1&&e[0]?.constructor===Function&&(e=e[0]());const t=[],n=[],r=Bs();let o=[],i=0;for(;i<e.length;i++){const s=e[i],a=Y6[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=B6(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},V3=l6?X6:q6,Z6=(...e)=>{console.log(...V3(e)),j3.forEach(t=>t.print(e))},Q6=(...e)=>{console.warn(...V3(e)),e.unshift(s0),j3.forEach(t=>t.print(e))},j3=Iu(),U3=e=>({[Symbol.iterator](){return this},next:e}),J6=(e,t)=>U3(()=>{let n;do n=e.next();while(!n.done&&!t(n.value));return n}),a0=(e,t)=>U3(()=>{const{done:n,value:r}=e.next();return{done:n,value:n?void 0:t(r)}}),H3=class{constructor(e,t){this.clock=e,this.len=t}},$3=class{constructor(){this.clients=new Map}},G3=(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])nk(e,i,c.clock,c.len,n)}}),e8=(e,t)=>{let n=0,r=e.length-1;for(;n<=r;){const o=Ta((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},W3=(e,t)=>{const n=e.clients.get(t.client);return n!==void 0&&e8(n,t.clock)!==null},K3=e=>{e.clients.forEach(t=>{t.sort((o,i)=>o.clock-i.clock);let n,r;for(n=1,r=1;n<t.length;n++){const o=t[r-1],i=t[n];o.clock+o.len>=i.clock?t[r-1]=new H3(o.clock,Tu(o.len,i.clock+i.len-o.clock)):(r<n&&(t[r]=i),r++)}t.length=r})},q3=(e,t,n,r)=>{Au(e.clients,t,()=>[]).push(new H3(n,r))},t8=()=>new $3,n8=(e,t)=>{Jn(e.restEncoder,t.clients.size),Eu(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)}})},Y3=u3,l0=class uE extends lx{constructor({guid:t=Gx(),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=Y3(),this.guid=t,this.collectionid=n,this.share=new Map,this.store=new p8,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=d3(c=>{this.on("load",()=>{this.isLoaded=!0,c(this)})});const l=()=>d3(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&&hr(t.parent.doc,n=>{n.subdocsLoaded.add(this)},null,!0),this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(Eu(this.subdocs).map(t=>t.guid))}transact(t,n=null){return hr(this,t,n)}get(t,n=So){const r=Au(this.share,t,()=>{const i=new n;return i._integrate(this,null),i}),o=r.constructor;if(n!==So&&o!==n)if(o===So){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,T8)}getText(t=""){return this.get(t,O8)}getMap(t=""){return this.get(t,g0)}getXmlElement(t=""){return this.get(t,Ak)}getXmlFragment(t=""){return this.get(t,w0)}toJSON(){const t={};return this.share.forEach((n,r)=>{t[r]=n.toJSON()}),t}destroy(){this.isDestroyed=!0,Eu(this.subdocs).forEach(n=>n.destroy());const t=this._item;if(t!==null){this._item=null;const n=t.content;n.doc=new uE({guid:this.guid,...n.opts,shouldLoad:!1}),n.doc._item=t,hr(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()}},r8=class{constructor(){this.restEncoder=Uy()}toUint8Array(){return xa(this.restEncoder)}resetDsCurVal(){}writeDsClock(e){Jn(this.restEncoder,e)}writeDsLen(e){Jn(this.restEncoder,e)}},o8=class extends r8{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){Hy(this.restEncoder,e)}writeString(e){xu(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){If(this.restEncoder,e)}writeBuf(e){_i(this.restEncoder,e)}writeJSON(e){xu(this.restEncoder,JSON.stringify(e))}writeKey(e){xu(this.restEncoder,e)}},i8=class{constructor(){this.restEncoder=Uy(),this.dsCurrVal=0}toUint8Array(){return xa(this.restEncoder)}resetDsCurVal(){this.dsCurrVal=0}writeDsClock(e){const t=e-this.dsCurrVal;this.dsCurrVal=e,Jn(this.restEncoder,t)}writeDsLen(e){e===0&&Ra(),Jn(this.restEncoder,e-1),this.dsCurrVal+=e}},s8=class extends i8{constructor(){super(),this.keyMap=new Map,this.keyClock=0,this.keyClockEncoder=new qy,this.clientEncoder=new Rp,this.leftClockEncoder=new qy,this.rightClockEncoder=new qy,this.infoEncoder=new a3(Hy),this.stringEncoder=new Ux,this.parentInfoEncoder=new a3(Hy),this.typeRefEncoder=new Rp,this.lenEncoder=new Rp}toUint8Array(){const e=Uy();return Jn(e,0),_i(e,this.keyClockEncoder.toUint8Array()),_i(e,this.clientEncoder.toUint8Array()),_i(e,this.leftClockEncoder.toUint8Array()),_i(e,this.rightClockEncoder.toUint8Array()),_i(e,xa(this.infoEncoder)),_i(e,this.stringEncoder.toUint8Array()),_i(e,xa(this.parentInfoEncoder)),_i(e,this.typeRefEncoder.toUint8Array()),_i(e,this.lenEncoder.toUint8Array()),Wy(e,xa(this.restEncoder)),xa(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){If(this.restEncoder,e)}writeBuf(e){_i(this.restEncoder,e)}writeJSON(e){If(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)}},a8=(e,t,n,r)=>{r=Tu(r,t[0].id.clock);const o=Da(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)},l8=(e,t,n)=>{const r=new Map;n.forEach((o,i)=>{mi(t,i)>o&&r.set(i,o)}),u0(t).forEach((o,i)=>{n.has(i)||r.set(i,0)}),Jn(e.restEncoder,r.size),Eu(r.entries()).sort((o,i)=>i[0]-o[0]).forEach(([o,i])=>{a8(e,t.clients.get(o),o,i)})},c8=(e,t)=>l8(e,t.doc.store,t.beforeState),u8=class{constructor(){this.l=[]}},X3=()=>new u8,Z3=(e,t)=>e.l.push(t),Q3=(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.")},J3=(e,t,n)=>Xy(e.l,[t,n]),Vp=class{constructor(e,t){this.client=e,this.clock=t}},jp=(e,t)=>e===t||e!==null&&t!==null&&e.client===t.client&&e.clock===t.clock,Or=(e,t)=>new Vp(e,t),d8=e=>{for(const[t,n]of e.doc.share.entries())if(n===e)return t;throw Ra()},f8=class{constructor(e,t){this.ds=e,this.sv=t}},h8=(e,t)=>new f8(e,t),qG=h8(t8(),new Map),Ou=(e,t)=>t===void 0?!e.deleted:t.sv.has(e.id.client)&&(t.sv.get(e.id.client)||0)>e.id.clock&&!W3(t.ds,e.id),c0=(e,t)=>{const n=Au(e.meta,c0,Iu),r=e.doc.store;n.has(t)||(t.sv.forEach((o,i)=>{o<mi(r,i)&&Cl(e,Or(i,o))}),G3(e,t.ds,o=>{}),n.add(t))},p8=class{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}},u0=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},mi=(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},ek=(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 Ra()}n.push(t)},Da=(e,t)=>{let n=0,r=e.length-1,o=e[r],i=o.id.clock;if(i===t)return r;let s=Ta(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=Ta((n+r)/2)}throw Ra()},m8=(e,t)=>{const n=e.clients.get(t.client);return n[Da(n,t.clock)]},d0=m8,f0=(e,t,n)=>{const r=Da(t,n),o=t[r];return o.id.clock<n&&o instanceof Ai?(t.splice(r+1,0,xk(e,o,n-o.id.clock)),r+1):r},Cl=(e,t)=>{const n=e.doc.store.clients.get(t.client);return n[f0(e,n,t.clock)]},tk=(e,t,n)=>{const r=t.clients.get(n.client),o=Da(r,n.clock),i=r[o];return n.clock!==i.id.clock+i.length-1&&i.constructor!==Sl&&r.splice(o+1,0,xk(e,i,n.clock-i.id.clock+1)),i},g8=(e,t,n)=>{const r=e.clients.get(t.id.client);r[Da(r,t.id.clock)]=n},nk=(e,t,n,r,o)=>{if(r===0)return;const i=n+r;let s=f0(e,t,n),a;do a=t[s++],i<a.id.clock+a.length&&f0(e,t,i),o(a);while(s<t.length&&t[s].id.clock<i)},v8=class{constructor(e,t,n){this.doc=e,this.deleteSet=new $3,this.beforeState=u0(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}},rk=(e,t)=>t.deleteSet.clients.size===0&&!sx(t.afterState,(n,r)=>t.beforeState.get(r)!==n)?!1:(K3(t.deleteSet),c8(e,t),n8(e,t.deleteSet),!0),ok=(e,t,n)=>{const r=t._item;(r===null||r.id.clock<(e.beforeState.get(r.id.client)||0)&&!r.deleted)&&Au(e.changed,t,Iu).add(n)},Up=(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 Ai&&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},y8=(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=Da(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 Ai&&f.deleted&&!f.keep&&n(f)&&f.gc(t,!1)}}}},b8=(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=t3(o.length-1,1+Da(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+Up(o,l)}})},ik=(e,t)=>{if(t<e.length){const n=e[t],r=n.doc,o=r.store,i=n.deleteSet,s=n._mergeStructs;try{K3(i),n.afterState=u0(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(()=>{J3(c._dEH,l,n)}))}),a.push(()=>r.emit("afterTransaction",[n,r])),a.push(()=>{n._needFormattingCleanup&&M8(n)})}),Xy(a,[])}finally{r.gc&&y8(i,o,r.gcFilter),b8(i,o),n.afterState.forEach((d,f)=>{const p=n.beforeState.get(f)||0;if(p!==d){const g=o.clients.get(f),m=Tu(Da(g,p),1);for(let v=g.length-1;v>=m;)v-=1+Up(g,v)}});for(let d=s.length-1;d>=0;d--){const{client:f,clock:p}=s[d].id,g=o.clients.get(f),m=Da(g,p);m+1<g.length&&Up(g,m+1)>1||m>0&&Up(g,m)}if(!n.local&&n.afterState.get(r.clientID)!==n.beforeState.get(r.clientID)&&(Z6(s0,N3,"[yjs] ",B3,z3,"Changed the client-id because another client seems to be using it."),r.clientID=Y3()),r.emit("afterTransactionCleanup",[n,r]),r._observers.has("update")){const d=new o8;rk(d,n)&&r.emit("update",[d.toUint8Array(),n.origin,r,n])}if(r._observers.has("updateV2")){const d=new s8;rk(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])):ik(e,t+1)}}},hr=(e,t,n=null,r=!0)=>{const o=e._transactionCleanups;let i=!1,s=null;e._transaction===null&&(i=!0,e._transaction=new v8(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&&ik(o,0)}}return s},sk="You must not compute changes after the event-handler fired.",Hp=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=w8(this.currentTarget,this.target))}deletes(e){return W3(this.transaction.deleteSet,e.id)}get keys(){if(this._keys===null){if(this.transaction.doc._transactionCleanups.length===0)throw wl(sk);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=zy(s.content.getContent());else return;else s!==null&&this.deletes(s)?(o="update",i=zy(s.content.getContent())):(o="add",i=void 0)}else if(this.deletes(r))o="delete",i=zy(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 wl(sk);const t=this.target,n=Iu(),r=Iu(),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}},w8=(e,t)=>{const n=[];for(;t._item!==null&&t!==e;){if(t._item.parentSub!==null)n.unshift(t._item.parentSub);else{let r=0,o=t._item.parent._start;for(;o!==t._item&&o!==null;)!o.deleted&&o.countable&&(r+=o.length),o=o.right;n.unshift(r)}t=t._item.parent}return n},zo=()=>{Q6("Invalid access: Add Yjs type to a document before reading data.")},ak=80,h0=0,C8=class{constructor(e,t){e.marker=!0,this.p=e,this.index=t,this.timestamp=h0++}},k8=e=>{e.timestamp=h0++},lk=(e,t,n)=>{e.p.marker=!1,e.p=t,t.marker=!0,e.index=n,e.timestamp=h0++},S8=(e,t,n)=>{if(e.length>=ak){const r=e.reduce((o,i)=>o.timestamp<i.timestamp?o:i);return lk(r,t,n),r}else{const r=new C8(t,n);return e.push(r),r}},$p=(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)=>xp(t-i.index)<xp(t-s.index)?i:s);let r=e._start,o=0;for(n!==null&&(r=n.p,o=n.index,k8(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&&xp(n.index-o)<r.parent.length/ak?(lk(n,r,o),n):S8(e._searchMarker,r,o)},Lf=(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=Tu(t,o.index+n))}},Gp=(e,t,n)=>{const r=e,o=t.changedParentTypes;for(;Au(o,e,()=>[]).push(n),e._item!==null;)e=e._item.parent;J3(r._eH,n,t)},So=class{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=X3(),this._dEH=X3(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(e,t){this.doc=e,this._item=t}_copy(){throw os()}clone(){throw os()}_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){Z3(this._eH,e)}observeDeep(e){Z3(this._dEH,e)}unobserve(e){Q3(this._eH,e)}unobserveDeep(e){Q3(this._dEH,e)}toJSON(){}},ck=(e,t,n)=>{e.doc??zo(),t<0&&(t=e._length+t),n<0&&(n=e._length+n);let r=n-t;const o=[];let i=e._start;for(;i!==null&&r>0;){if(i.countable&&!i.deleted){const s=i.content.getContent();if(s.length<=t)t-=s.length;else{for(let a=t;a<s.length&&r>0;a++)o.push(s[a]),r--;t=0}}i=i.right}return o},uk=e=>{e.doc??zo();const t=[];let n=e._start;for(;n!==null;){if(n.countable&&!n.deleted){const r=n.content.getContent();for(let o=0;o<r.length;o++)t.push(r[o])}n=n.right}return t},Mf=(e,t)=>{let n=0,r=e._start;for(e.doc??zo();r!==null;){if(r.countable&&!r.deleted){const o=r.content.getContent();for(let i=0;i<o.length;i++)t(o[i],n++,e)}r=r.right}},dk=(e,t)=>{const n=[];return Mf(e,(r,o)=>{n.push(t(r,o,e))}),n},_8=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}}}},fk=(e,t)=>{e.doc??zo();const n=$p(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}},Wp=(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 Ai(Or(s,mi(a,s)),o,o&&o.lastId,l,l&&l.id,t,null,new C0(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 Ai(Or(s,mi(a,s)),o,o&&o.lastId,l,l&&l.id,t,null,new Ek(new Uint8Array(f))),o.integrate(e,0);break;case l0:o=new Ai(Or(s,mi(a,s)),o,o&&o.lastId,l,l&&l.id,t,null,new Tk(f)),o.integrate(e,0);break;default:if(f instanceof So)o=new Ai(Or(s,mi(a,s)),o,o&&o.lastId,l,l&&l.id,t,null,new Nu(f)),o.integrate(e,0);else throw new Error("Unexpected content type in insert operation")}}}),d()},hk=()=>wl("Length exceeded!"),pk=(e,t,n,r)=>{if(n>t._length)throw hk();if(n===0)return t._searchMarker&&Lf(t._searchMarker,n,r.length),Wp(e,t,null,r);const o=n,i=$p(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&&Cl(e,Or(s.id.client,s.id.clock+n));break}n-=s.length}return t._searchMarker&&Lf(t._searchMarker,o,r.length),Wp(e,t,s,r)},A8=(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 Wp(e,t,r,n)},mk=(e,t,n,r)=>{if(r===0)return;const o=n,i=r,s=$p(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&&Cl(e,Or(a.id.client,a.id.clock+n)),n-=a.length);for(;r>0&&a!==null;)a.deleted||(r<a.length&&Cl(e,Or(a.id.client,a.id.clock+r)),a.delete(e),r-=a.length),a=a.right;if(r>0)throw hk();t._searchMarker&&Lf(t._searchMarker,o,-i+r)},Kp=(e,t,n)=>{const r=t._map.get(n);r!==void 0&&r.delete(e)},p0=(e,t,n,r)=>{const o=t._map.get(n)||null,i=e.doc,s=i.clientID;let a;if(r==null)a=new C0([r]);else switch(r.constructor){case Number:case Object:case Boolean:case Array:case String:case Date:case BigInt:a=new C0([r]);break;case Uint8Array:a=new Ek(r);break;case l0:a=new Tk(r);break;default:if(r instanceof So)a=new Nu(r);else throw new Error("Unexpected content type")}new Ai(Or(s,mi(i.store,s)),o,o&&o.lastId,null,null,t,n,a).integrate(e,0)},m0=(e,t)=>{e.doc??zo();const n=e._map.get(t);return n!==void 0&&!n.deleted?n.content.getContent()[n.length-1]:void 0},gk=e=>{const t={};return e.doc??zo(),e._map.forEach((n,r)=>{n.deleted||(t[r]=n.content.getContent()[n.length-1])}),t},vk=(e,t)=>{e.doc??zo();const n=e._map.get(t);return n!==void 0&&!n.deleted},I8=(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&&Ou(i,t)&&(n[o]=i.content.getContent()[i.length-1])}),n},qp=e=>(e.doc??zo(),J6(e._map.entries(),t=>!t[1].deleted)),E8=class extends Hp{},T8=class Ag extends So{constructor(){super(),this._prelimContent=[],this._searchMarker=[]}static from(t){const n=new Ag;return n.push(t),n}_integrate(t,n){super._integrate(t,n),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new Ag}clone(){const t=new Ag;return t.insert(0,this.toArray().map(n=>n instanceof So?n.clone():n)),t}get length(){return this.doc??zo(),this._length}_callObserver(t,n){super._callObserver(t,n),Gp(this,t,new E8(this,t))}insert(t,n){this.doc!==null?hr(this.doc,r=>{pk(r,this,t,n)}):this._prelimContent.splice(t,0,...n)}push(t){this.doc!==null?hr(this.doc,n=>{A8(n,this,t)}):this._prelimContent.push(...t)}unshift(t){this.insert(0,t)}delete(t,n=1){this.doc!==null?hr(this.doc,r=>{mk(r,this,t,n)}):this._prelimContent.splice(t,n)}get(t){return fk(this,t)}toArray(){return uk(this)}slice(t=0,n=this.length){return ck(this,t,n)}toJSON(){return this.map(t=>t instanceof So?t.toJSON():t)}map(t){return dk(this,t)}forEach(t){Mf(this,t)}[Symbol.iterator](){return _8(this)}_write(t){t.writeTypeRef(V8)}},x8=class extends Hp{constructor(e,t,n){super(e,t),this.keysChanged=n}},g0=class v2 extends So{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 v2}clone(){const t=new v2;return this.forEach((n,r)=>{t.set(r,n instanceof So?n.clone():n)}),t}_callObserver(t,n){Gp(this,t,new x8(this,t,n))}toJSON(){this.doc??zo();const t={};return this._map.forEach((n,r)=>{if(!n.deleted){const o=n.content.getContent()[n.length-1];t[r]=o instanceof So?o.toJSON():o}}),t}get size(){return[...qp(this)].length}keys(){return a0(qp(this),t=>t[0])}values(){return a0(qp(this),t=>t[1].content.getContent()[t[1].length-1])}entries(){return a0(qp(this),t=>[t[0],t[1].content.getContent()[t[1].length-1]])}forEach(t){this.doc??zo(),this._map.forEach((n,r)=>{n.deleted||t(n.content.getContent()[n.length-1],r,this)})}[Symbol.iterator](){return this.entries()}delete(t){this.doc!==null?hr(this.doc,n=>{Kp(n,this,t)}):this._prelimContent.delete(t)}set(t,n){return this.doc!==null?hr(this.doc,r=>{p0(r,this,t,n)}):this._prelimContent.set(t,n),n}get(t){return m0(this,t)}has(t){return vk(this,t)}clear(){this.doc!==null?hr(this.doc,t=>{this.forEach(function(n,r,o){Kp(t,o,r)})}):this._prelimContent.clear()}_write(t){t.writeTypeRef(j8)}},kl=(e,t)=>e===t||typeof e=="object"&&typeof t=="object"&&e&&t&&t6(e,t),v0=class{constructor(e,t,n,r){this.left=e,this.right=t,this.index=n,this.currentAttributes=r}forward(){this.right===null&&Ra(),this.right.content.constructor===Vo?this.right.deleted||Pu(this.currentAttributes,this.right.content):this.right.deleted||(this.index+=this.right.length),this.left=this.right,this.right=this.right.right}},yk=(e,t,n)=>{for(;t.right!==null&&n>0;)t.right.content.constructor===Vo?t.right.deleted||Pu(t.currentAttributes,t.right.content):t.right.deleted||(n<t.right.length&&Cl(e,Or(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},Yp=(e,t,n,r)=>{const o=new Map,i=r?$p(t,n):null;if(i){const s=new v0(i.p.left,i.p,i.index,o);return yk(e,s,n-i.index)}else{const s=new v0(null,t._start,0,o);return yk(e,s,n)}},bk=(e,t,n,r)=>{for(;n.right!==null&&(n.right.deleted===!0||n.right.content.constructor===Vo&&kl(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 Ai(Or(i,mi(o.store,i)),l,l&&l.lastId,c,c&&c.id,t,null,new Vo(a,s));d.integrate(e,0),n.right=d,n.forward()})},Pu=(e,t)=>{const{key:n,value:r}=t;r===null?e.delete(n):e.set(n,r)},wk=(e,t)=>{for(;e.right!==null;){if(!(e.right.deleted||e.right.content.constructor===Vo&&kl(t[e.right.content.key]??null,e.right.content.value)))break;e.forward()}},Ck=(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(!kl(c,l)){s.set(a,c);const{left:d,right:f}=n;n.right=new Ai(Or(i,mi(o.store,i)),d,d&&d.lastId,f,f&&f.id,t,null,new Vo(a,l)),n.right.integrate(e,0),n.forward()}}return s},y0=(e,t,n,r,o)=>{n.currentAttributes.forEach((p,g)=>{o[g]===void 0&&(o[g]=null)});const i=e.doc,s=i.clientID;wk(n,o);const a=Ck(e,t,n,o),l=r.constructor===String?new Fu(r):r instanceof So?new Nu(r):new Xp(r);let{left:c,right:d,index:f}=n;t._searchMarker&&Lf(t._searchMarker,n.index,l.getLength()),d=new Ai(Or(s,mi(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(),bk(e,t,n,a)},kk=(e,t,n,r,o)=>{const i=e.doc,s=i.clientID;wk(n,o);const a=Ck(e,t,n,o);e:for(;n.right!==null&&(r>0||a.size>0&&(n.right.deleted||n.right.content.constructor===Vo));){if(!n.right.deleted)switch(n.right.content.constructor){case Vo:{const{key:l,value:c}=n.right.content,d=o[l];if(d!==void 0){if(kl(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&&Cl(e,Or(n.right.id.client,n.right.id.clock+r)),r-=n.right.length;break}n.forward()}if(r>0){let l="";for(;r>0;r--)l+=`
|
|
7
7
|
`;n.right=new Ai(Or(s,mi(i.store,s)),n.left,n.left&&n.left.lastId,n.right,n.right&&n.right.id,t,null,new Fu(l)),n.right.integrate(e,0),n.forward()}bk(e,t,n,a)},Sk=(e,t,n,r,o)=>{let i=t;const s=Bs();for(;i&&(!i.countable||i.deleted);){if(!i.deleted&&i.content.constructor===Vo){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===Vo){const{key:d,value:f}=c,p=r.get(d)??null;(s.get(d)!==c||p===f)&&(t.delete(e),a++,!l&&(o.get(d)??null)===f&&p!==f&&(p===null?o.delete(d):o.set(d,p))),!l&&!t.deleted&&Pu(o,c)}}t=t.right}return a},R8=(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===Vo){const r=t.content.key;n.has(r)?t.delete(e):n.add(r)}t=t.left}},L8=e=>{let t=0;return hr(e.doc,n=>{let r=e._start,o=e._start,i=Bs();const s=By(i);for(;o;)o.deleted===!1&&(o.content.constructor===Vo?Pu(s,o.content):(t+=Sk(n,r,o,i,s),i=By(s),r=o)),o=o.right}),t},M8=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&&nk(e,n.store.clients.get(r),i,o,s=>{!s.deleted&&s.content.constructor===Vo&&s.constructor!==Sl&&t.add(s.parent)})}hr(n,r=>{G3(e,e.deleteSet,o=>{if(o instanceof Sl||!o.parent._hasFormatting||t.has(o.parent))return;const i=o.parent;o.content.constructor===Vo?t.add(i):R8(r,o)});for(const o of t)L8(o)})},_k=(e,t,n)=>{const r=n,o=By(t.currentAttributes),i=t.right;for(;n>0&&t.right!==null;){if(t.right.deleted===!1)switch(t.right.content.constructor){case Nu:case Xp:case Fu:n<t.right.length&&Cl(e,Or(t.right.id.client,t.right.id.clock+n)),n-=t.right.length,t.right.delete(e);break}t.forward()}i&&Sk(e,i,t.right,o,t.currentAttributes);const s=(t.left||t.right).parent;return s._searchMarker&&Lf(s._searchMarker,t.index,-r+n),t},D8=class extends Hp{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=[];hr(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 p=null;switch(s){case"delete":d>0&&(p={delete:d}),d=0;break;case"insert":(typeof l=="object"||l.length>0)&&(p={insert:l},r.size>0&&(p.attributes={},r.forEach((g,m)=>{g!==null&&(p.attributes[m]=g)}))),l="";break;case"retain":c>0&&(p={retain:c},e6(a)||(p.attributes=Zx({},a))),c=0;break}p&&t.push(p),s=null}};for(;i!==null;){switch(i.content.constructor){case Nu:case Xp: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 Fu: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 Vo:{const{key:p,value:g}=i.content;if(this.adds(i)){if(!this.deletes(i)){const m=r.get(p)??null;kl(m,g)?g!==null&&i.delete(n):(s==="retain"&&f(),kl(g,o.get(p)??null)?delete a[p]:a[p]=g)}}else if(this.deletes(i)){o.set(p,g);const m=r.get(p)??null;kl(m,g)||(s==="retain"&&f(),a[p]=m)}else if(!i.deleted){o.set(p,g);const m=a[p];m!==void 0&&(kl(m,g)?m!==null&&i.delete(n):(s==="retain"&&f(),g===null?delete a[p]:a[p]=g))}i.deleted||(s==="insert"&&f(),Pu(r,i.content));break}}i=i.right}for(f();t.length>0;){const p=t[t.length-1];if(p.retain!==void 0&&p.attributes===void 0)t.pop();else break}}),this._delta=t}return this._delta}},O8=class y2 extends So{constructor(t){super(),this._pending=t!==void 0?[()=>this.insert(0,t)]:[],this._searchMarker=[],this._hasFormatting=!1}get length(){return this.doc??zo(),this._length}_integrate(t,n){super._integrate(t,n);try{this._pending.forEach(r=>r())}catch(r){console.error(r)}this._pending=null}_copy(){return new y2}clone(){const t=new y2;return t.applyDelta(this.toDelta()),t}_callObserver(t,n){super._callObserver(t,n);const r=new D8(this,t,n);Gp(this,t,r),!t.local&&this._hasFormatting&&(t._needFormattingCleanup=!0)}toString(){this.doc??zo();let t="",n=this._start;for(;n!==null;)!n.deleted&&n.countable&&n.content.constructor===Fu&&(t+=n.content.str),n=n.right;return t}toJSON(){return this.toString()}applyDelta(t,{sanitize:n=!0}={}){this.doc!==null?hr(this.doc,r=>{const o=new v0(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
|
`,g4=()=>{if(typeof document>"u")throw new Error(_F)},as=class vE{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 vE(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=De._getRotation(l.rotation),l}},AF="[object Array]",IF="[object Number]",EF="[object String]",TF="[object Boolean]",xF=Math.PI/180,RF=180/Math.PI,Hf="#",LF="",MF="0",DF="Konva warning: ",v4="Konva error: ",OF="rgb(",lb={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]},PF=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/,fm=[],$f=null,FF=typeof requestAnimationFrame<"u"&&requestAnimationFrame||function(e){setTimeout(e,16)},De={_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)===AF},_isNumber(e){return Object.prototype.toString.call(e)===IF&&!isNaN(e)&&isFinite(e)},_isString(e){return Object.prototype.toString.call(e)===EF},_isBoolean(e){return Object.prototype.toString.call(e)===TF},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){fm.push(e),fm.length===1&&FF(function(){const t=fm;fm=[],t.forEach(function(n){n()})})},createCanvasElement(){g4();const e=document.createElement("canvas");try{e.style=e.style||{}}catch{}return e},createImageElement(){return g4(),document.createElement("img")},_isInDocument(e){for(;e=e.parentNode;)if(e==document)return!0;return!1},_urlToImage(e,t){const n=De.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(Hf,LF);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=MF+e;return Hf+e},isCanvasFarblingActive(){if($f!==null)return $f;if(typeof document>"u")return $f=!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 $f=r,this.releaseCanvas(e),$f},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),Hf+this._rgbToHex(e,t,n)},getSnappedHexColor(e){const t=this._hexToRgb(e);return Hf+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 lb?(t=lb[e],{r:t[0],g:t[1],b:t[2]}):e[0]===Hf?this._hexToRgb(e.substring(1)):e.substr(0,4)===OF?(t=PF.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",De._namedColorToRBA(e)||De._hex3ColorToRGBA(e)||De._hex4ColorToRGBA(e)||De._hex6ColorToRGBA(e)||De._hex8ColorToRGBA(e)||De._rgbColorToRGBA(e)||De._rgbaColorToRGBA(e)||De._hslColorToRGBA(e)},_namedColorToRBA(e){const t=lb[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*xF},radToDeg(e){return e*RF},_degToRad(e){return De.warn("Util._degToRad is removed. Please use public Util.degToRad instead."),De.degToRad(e)},_radToDeg(e){return De.warn("Util._radToDeg is removed. Please use public Util.radToDeg instead."),De.radToDeg(e)},_getRotation(e){return St.angleDeg?De.radToDeg(e):e},_capitalize(e){return e.charAt(0).toUpperCase()+e.slice(1)},throw(e){throw new Error(v4+e)},error(e){console.error(v4+e)},warn(e){St.showWarnings&&console.warn(DF+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=De.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=De._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=De._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||De._isElement(e[n]))if(t.configurable)delete e[n];else return null;else if(De._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){St.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),p=Math.hypot(d.x,d.y);let g;typeof o=="number"?g=o:g=i<o.length?o[i]:0,g=r*Math.cos(Math.PI/n)*Math.min(1,g/r*2);const m={x:c.x/f,y:c.y/f},v={x:d.x/p,y:d.y/p},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 NF(e){const t=[],n=e.length,r=De;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 y4=",",BF="(",zF=")",VF="([",jF="])",UF=";",HF="()",$F="=",b4=["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"],GF=["fillStyle","strokeStyle","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY","letterSpacing","lineCap","lineDashOffset","lineJoin","lineWidth","miterLimit","direction","font","textAlign","textBaseline","globalAlpha","globalCompositeOperation","imageSmoothingEnabled","filter"],WF=100,hm=null;function w4(){if(hm!==null)return hm;try{const e=De.createCanvasElement().getContext("2d");return e?!!e&&"filter"in e:(hm=!1,!1)}catch{return hm=!1,!1}}var pm=class{constructor(e){this.canvas=e,St.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+=HF:De._isArray(l[0])?o+=VF+l.join(y4)+jF:(t&&(l=l.map(c=>typeof c=="number"?Math.floor(c):c)),o+=BF+l.join(y4)+zF)):(o+=s.property,e||(o+=$F+s.val)),o+=UF;return o}clearTrace(){this.traceArr=[]}_trace(e){let t=this.traceArr,n;t.push(e),n=t.length,n>=WF&&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=b4.length,n=this.setAttr,r,o;const i=function(s){let a=e[s],l;e[s]=function(){return o=NF(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(b4[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)}};GF.forEach(function(e){Object.defineProperty(pm.prototype,e,{get(){return this._context[e]},set(t){this._context[e]=t}})});var KF=class extends pm{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)}},qF=class extends pm{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()}}},mm;function YF(){if(mm)return mm;const e=De.createCanvasElement(),t=e.getContext("2d");return mm=(function(){return(St._global.devicePixelRatio||1)/(t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1)})(),De.releaseCanvas(e),mm}var cb=class{constructor(e){this.pixelRatio=1,this.width=0,this.height=0,this.isCache=!1;const t=(e||{}).pixelRatio||St.pixelRatio||YF();this.pixelRatio=t,this._canvas=De.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 De.error("Unable to get data URL. "+r.message+" For more info read https://konvajs.org/docs/posts/Tainted_Canvas.html."),""}}}},El=class extends cb{constructor(e={width:0,height:0,willReadFrequently:!1}){super(e),this.context=new KF(this,{willReadFrequently:e.willReadFrequently}),this.setSize(e.width,e.height)}},ub=class extends cb{constructor(e={width:0,height:0}){super(e),this.hitCanvas=!0,this.context=new qF(this),this.setSize(e.width,e.height)}},Vn={get isDragging(){let e=!1;return Vn._dragElements.forEach(t=>{t.dragStatus==="dragging"&&(e=!0)}),e},justDragged:!1,get node(){let e;return Vn._dragElements.forEach(t=>{e=t.node}),e},_dragElements:new Map,_drag(e){const t=[];Vn._dragElements.forEach((n,r)=>{const{node:o}=n,i=o.getStage();i.setPointersPositions(e),n.pointerId===void 0&&(n.pointerId=De._getFirstPointerId(e));const s=i._changedPointerPositions.find(a=>a.id===n.pointerId);if(s){if(n.dragStatus!=="dragging"){const a=o.dragDistance();if(Math.max(Math.abs(s.x-n.startPointerPos.x),Math.abs(s.y-n.startPointerPos.y))<a||(o.startDrag({evt:e}),!o.isDragging()))return}o._setDragPosition(e,n),t.push(o)}}),t.forEach(n=>{n.getStage()&&n.fire("dragmove",{type:"dragmove",target:n,evt:e},!0)})},_endDragBefore(e){const t=[];Vn._dragElements.forEach(n=>{const{node:r}=n,o=r.getStage();if(e&&o.setPointersPositions(e),!o._changedPointerPositions.find(s=>s.id===n.pointerId))return;(n.dragStatus==="dragging"||n.dragStatus==="stopped")&&(Vn.justDragged=!0,St._mouseListenClick=!1,St._touchListenClick=!1,St._pointerListenClick=!1,n.dragStatus="stopped");const i=n.node.getLayer()||n.node instanceof St.Stage&&n.node;i&&t.indexOf(i)===-1&&t.push(i)}),t.forEach(n=>{n.draw()})},_endDragAfter(e){Vn._dragElements.forEach((t,n)=>{t.dragStatus==="stopped"&&t.node.fire("dragend",{type:"dragend",target:t.node,evt:e},!0),t.dragStatus!=="dragging"&&Vn._dragElements.delete(n)})}};St.isBrowser&&(window.addEventListener("mouseup",Vn._endDragBefore,!0),window.addEventListener("touchend",Vn._endDragBefore,!0),window.addEventListener("touchcancel",Vn._endDragBefore,!0),window.addEventListener("mousemove",Vn._drag),window.addEventListener("touchmove",Vn._drag),window.addEventListener("mouseup",Vn._endDragAfter,!1),window.addEventListener("touchend",Vn._endDragAfter,!1),window.addEventListener("touchcancel",Vn._endDragAfter,!1));function Tl(e){return De._isString(e)?'"'+e+'"':Object.prototype.toString.call(e)==="[object Number]"||De._isBoolean(e)?e:Object.prototype.toString.call(e)}function C4(e){return e>255?255:e<0?0:Math.round(e)}function yt(){if(St.isUnminified)return function(e,t){return De._isNumber(e)||De.warn(Tl(e)+' is a not valid value for "'+t+'" attribute. The value should be a number.'),e}}function gm(e){if(St.isUnminified)return function(t,n){let r=De._isNumber(t),o=De._isArray(t)&&t.length==e;return!r&&!o&&De.warn(Tl(t)+' is a not valid value for "'+n+'" attribute. The value should be a number or Array<number>('+e+")"),t}}function db(){if(St.isUnminified)return function(e,t){return De._isNumber(e)||e==="auto"||De.warn(Tl(e)+' is a not valid value for "'+t+'" attribute. The value should be a number or "auto".'),e}}function kc(){if(St.isUnminified)return function(e,t){return De._isString(e)||De.warn(Tl(e)+' is a not valid value for "'+t+'" attribute. The value should be a string.'),e}}function k4(){if(St.isUnminified)return function(e,t){const n=De._isString(e),r=Object.prototype.toString.call(e)==="[object CanvasGradient]"||e&&e.addColorStop;return n||r||De.warn(Tl(e)+' is a not valid value for "'+t+'" attribute. The value should be a string or a native gradient.'),e}}function XF(){if(St.isUnminified)return function(e,t){const n=Int8Array?Object.getPrototypeOf(Int8Array):null;return n&&e instanceof n||(De._isArray(e)?e.forEach(function(r){De._isNumber(r)||De.warn('"'+t+'" attribute has non numeric element '+r+". Make sure that all elements are numbers.")}):De.warn(Tl(e)+' is a not valid value for "'+t+'" attribute. The value should be a array of numbers.')),e}}function ls(){if(St.isUnminified)return function(e,t){return e===!0||e===!1||De.warn(Tl(e)+' is a not valid value for "'+t+'" attribute. The value should be a boolean.'),e}}function ZF(e){if(St.isUnminified)return function(t,n){return t==null||De.isObject(t)||De.warn(Tl(t)+' is a not valid value for "'+n+'" attribute. The value should be an object with properties '+e),t}}var Gf="get",Wf="set",me={addGetterSetter(e,t,n,r,o){me.addGetter(e,t,n),me.addSetter(e,t,r,o),me.addOverloadedGetterSetter(e,t)},addGetter(e,t,n){const r=Gf+De._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=Wf+De._capitalize(t);e.prototype[o]||me.overWriteSetter(e,t,n,r)},overWriteSetter(e,t,n,r){const o=Wf+De._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=De._capitalize,a=Gf+s(t),l=Wf+s(t);e.prototype[a]=function(){const d={};for(let f=0;f<i;f++){const p=n[f];d[p]=this.getAttr(t+s(p))}return d};const c=ZF(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 p in d)d.hasOwnProperty(p)&&this._setAttr(t+s(p),d[p]);return d||n.forEach(p=>{this._setAttr(t+s(p),void 0)}),this._fireChangeEvent(t,f,d),o&&o.call(this),this},me.addOverloadedGetterSetter(e,t)},addOverloadedGetterSetter(e,t){const n=De._capitalize(t),r=Wf+n,o=Gf+n;e.prototype[t]=function(){return arguments.length?(this[r](arguments[0]),this):this[o]()}},addDeprecatedGetterSetter(e,t,n,r){De.error("Adding deprecated "+t);const o=Gf+De._capitalize(t),i=t+" property is deprecated and will be removed soon. Look at Konva change log for more information.";e.prototype[o]=function(){De.error(i);const s=this.attrs[t];return s===void 0?n:s},me.addSetter(e,t,r,function(){De.error(i)}),me.addOverloadedGetterSetter(e,t)},backCompat(e,t){De.each(t,function(n,r){const o=e.prototype[r],i=Gf+De._capitalize(n),s=Wf+De._capitalize(n);function a(){o.apply(this,arguments),De.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 QF(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=St.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=St.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=St.Filters;l&&l.Contrast&&l.Contrast.call(this,s)}}case"grayscale":return function(i){const s=St.Filters;s&&s.Grayscale&&s.Grayscale.call(this,i)};case"sepia":return function(i){const s=St.Filters;s&&s.Sepia&&s.Sepia.call(this,i)};case"invert":return function(i){const s=St.Filters;s&&s.Invert&&s.Invert.call(this,i)};default:De.warn(`CSS filter "${r}" is not supported in fallback mode. Consider using function filters for better compatibility.`);break}}return()=>{}}var vm="absoluteOpacity",S4="allEventListeners",Na="absoluteTransform",_4="absoluteScale",Sc="canvas",JF="Change",eN="children",tN="konva",fb="listening",nN="mouseenter",rN="mouseleave",oN="pointerenter",iN="pointerleave",sN="touchenter",aN="touchleave",A4="set",I4="Shape",ym=" ",E4="stage",xl="transform",lN="Stage",hb="visible",cN=["xChange.konva","yChange.konva","scaleXChange.konva","scaleYChange.konva","skewXChange.konva","skewYChange.konva","rotationChange.konva","offsetXChange.konva","offsetYChange.konva","transformsEnabledChange.konva"].join(ym),uN=1,_t=class Ah{constructor(t){this._id=uN++,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===xl||t===Na)&&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===xl||t===Na)&&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(ym);this.on(o,()=>{this._clearCache(t)}),this._attachedDepsListeners.set(t,!0)}return this._getCache(t,r)}_getCanvasCache(){return this._cache.get(Sc)}_clearSelfAndDescendantCache(t){this._clearCache(t),t===Na&&this.fire("absoluteTransformChange")}clearCache(){if(this._cache.has(Sc)){const{scene:t,filter:n,hit:r}=this._cache.get(Sc);De.releaseCanvas(t._canvas,n._canvas,r._canvas),this._cache.delete(Sc)}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){De.error("Can not cache the node. Width or height of the node equals 0. Caching is skipped.");return}const p=Math.abs(Math.round(r.x)-a)>.5?1:0,g=Math.abs(Math.round(r.y)-l)>.5?1:0;o+=c*2+p,i+=c*2+g,a-=c,l-=c;const m=new El({pixelRatio:s,width:o,height:i}),v=new El({pixelRatio:s,width:0,height:0,willReadFrequently:!0}),k=new ub({pixelRatio:f,width:o,height:i}),C=m.getContext(),S=k.getContext(),w=new El({width:m.width/m.pixelRatio+Math.abs(a),height:m.height/m.pixelRatio+Math.abs(l),pixelRatio:m.pixelRatio}),b=w.getContext();return k.isCache=!0,m.isCache=!0,this._cache.delete(Sc),this._filterUpToDate=!1,n.imageSmoothingEnabled===!1&&(m.getContext()._context.imageSmoothingEnabled=!1,v.getContext()._context.imageSmoothingEnabled=!1),C.save(),S.save(),b.save(),C.translate(-a,-l),S.translate(-a,-l),b.translate(-a,-l),w.x=a,w.y=l,this._isUnderCache=!0,this._clearSelfAndDescendantCache(vm),this._clearSelfAndDescendantCache(_4),this.drawScene(m,this,w),this.drawHit(k,this),this._isUnderCache=!1,C.restore(),S.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()),De.releaseCanvas(w._canvas),this._cache.set(Sc,{scene:m,filter:v,hit:k,x:a,y:l}),this._requestDraw(),this}isCached(){return this._cache.has(Sc)}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 p=0;p<t.length;p++)if(typeof t[p]=="string"&&w4(),typeof t[p]!="string"||!w4()){d=!1;break}const f=r.pixelRatio;if(o.setSize(r.width/r.pixelRatio,r.height/r.pixelRatio),d){const p=t.join(" ");return i.save(),i.setAttr("filter",p),i.drawImage(r._canvas,0,0,r.getWidth()/f,r.getHeight()/f),i.restore(),this._filterUpToDate=!0,o}try{for(s=t.length,i.clear(),i.drawImage(r._canvas,0,0,r.getWidth()/f,r.getHeight()/f),a=i.getImageData(0,0,o.getWidth(),o.getHeight()),l=0;l<s;l++)c=t[l],typeof c=="string"&&(c=QF(c)),c.call(this,a),i.putImageData(a,0,0)}catch(p){De.error("Unable to apply filter. "+p.message+" This post my help you https://konvajs.org/docs/posts/Tainted_Canvas.html.")}return this._filterUpToDate=!0,o}on(...t){const n=t[0],r=t[1];if(t[2],this._cache&&this._cache.delete(S4),t.length===3)return this._delegate.apply(this,t);const o=n.split(ym);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(ym),o=r.length,i,s,a,l,c,d;if(this._cache&&this._cache.delete(S4),!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=De.cloneObject(i),i.currentTarget=s[a],r.call(s[a],i)}),this}remove(){return this.isDragging()&&this.stopDrag(),Vn._dragElements.delete(this._id),Vn._dragElements.forEach((t,n)=>{this.isAncestorOf(t.node)&&Vn._dragElements.delete(n)}),this._remove(),this}_clearCaches(){this._clearSelfAndDescendantCache(Na),this._clearSelfAndDescendantCache(vm),this._clearSelfAndDescendantCache(_4),this._clearSelfAndDescendantCache(E4),this._clearSelfAndDescendantCache(hb),this._clearSelfAndDescendantCache(fb)}_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"+De._capitalize(t);return De._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!==eN&&(r=A4+De._capitalize(n),De._isFunction(this[r])?this[r](t[n]):this._setAttr(n,t[n]))}),this}isListening(){return this._getCache(fb,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(hb,this._isVisible)}_isVisible(t){if(!this.visible())return!1;const n=this.getParent();return n&&n!==t&&this!==t?n._isVisible(t):!0}shouldDrawHit(t,n=!1){if(t)return this._isVisible(t)&&this._isListening(t);const r=this.getLayer();let o=!1;Vn._dragElements.forEach(s=>{s.dragStatus==="dragging"&&(s.node.nodeType==="Stage"||s.node.getLayer()===r)&&(o=!0)});const i=!n&&!St.hitOnDragEnabled&&(o||St.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!==I4&&(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!==lN&&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(xl),this._clearSelfAndDescendantCache(Na)),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 as,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(xl);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(xl),this._clearSelfAndDescendantCache(Na),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 De.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 De.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 De.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 De.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 De.warn("Node has no parent. zIndex parameter is ignored."),this;(t<0||t>=this.parent.children.length)&&De.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(vm,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=De.isObject(r)&&!De._isPlainObject(r)&&!De._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 De._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],De.isValidSelector(i)||(De.warn('Selector "'+i+'" is invalid. Allowed selectors examples are "#foo", ".bar" or "Group".'),De.warn('If you have a custom shape with such className, please change it to start with upper letter like "Triangle".'),De.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(E4,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(Na,this._getAbsoluteTransform)}_getAbsoluteTransform(t){let n;if(t)return n=new as,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(Na)||new as,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(xl,this._getTransform)}_getTransform(){var t,n;const r=this._cache.get(xl)||new as;r.reset();const o=this.x(),i=this.y(),s=St.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,p=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||p!==0)&&r.translate(-1*f,-1*p),r.dirty=!1,r}clone(t){let n=De.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(tN)<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 El({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 El({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,De._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():St.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+JF,{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[A4+De._capitalize(t)];return De._isFunction(r)?r.call(this,n):this._setAttr(t,n),this}_requestDraw(){if(St.autoDrawEnabled){const t=this.getLayer()||this.getStage();t?.batchDraw()}}_setAttr(t,n){const r=this.attrs[t];r===n&&!De.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===I4&&(n.target=this);const o=[nN,rN,oN,iN,sN,aN];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=Ah.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,Ah.protoListenerMap.set(o,i)}return s}_fire(t,n){n=n||{},n.currentTarget=this,n.type=t;const r=this._getProtoListeners(t);if(r){const i=r.slice();for(let s=0;s<i.length;s++)i[s].handler.call(this,n)}const o=this.eventListeners[t];if(o){const i=o.slice(),s=i.length;for(let l=0;l<i.length;l++)i[l].handler.call(this,n);const a=this.eventListeners[t];if(a)for(let l=s;l<a.length;l++)a[l].handler.call(this,n)}}draw(){return this.drawScene(),this.drawHit(),this}_createDragElement(t){const n=t?t.pointerId:void 0,r=this.getStage(),o=this.getAbsolutePosition();if(!r)return;const i=r._getPointerById(n)||r._changedPointerPositions[0]||o;Vn._dragElements.set(this._id,{node:this,startPointerPos:i,offset:{x:i.x-o.x,y:i.y-o.y},dragStatus:"ready",pointerId:n,startEvent:t})}startDrag(t,n=!0){Vn._dragElements.has(this._id)||this._createDragElement(t);const r=Vn._dragElements.get(this._id);r.dragStatus="dragging",this.fire("dragstart",{type:"dragstart",target:this,evt:r.startEvent&&r.startEvent.evt||t&&t.evt},n)}_setDragPosition(t,n){const r=this.getStage()._getPointerById(n.pointerId);if(!r)return;let o={x:r.x-n.offset.x,y:r.y-n.offset.y};const i=this.dragBoundFunc();if(i!==void 0){const s=i.call(this,o,t);s?o=s:De.warn("dragBoundFunc did not return any value. That is unexpected behavior. You must return new absolute position from dragBoundFunc.")}(!this._lastPos||this._lastPos.x!==o.x||this._lastPos.y!==o.y)&&(this.setAbsolutePosition(o),this._requestDraw()),this._lastPos=o}stopDrag(t){const n=Vn._dragElements.get(this._id);n&&(n.dragStatus="stopped"),Vn._endDragBefore(t),Vn._endDragAfter(t)}setDraggable(t){this._setAttr("draggable",t),this._dragChange()}isDragging(){const t=Vn._dragElements.get(this._id);return t?t.dragStatus==="dragging":!1}_listenDrag(){this._dragCleanup(),this.on("mousedown.konva touchstart.konva",function(t){if(!(t.evt.button===void 0||St.dragButtons.indexOf(t.evt.button)>=0)||this.isDragging())return;let n=!1;Vn._dragElements.forEach(r=>{this.isAncestorOf(r.node)&&(n=!0)}),n||this._createDragElement(t)})}_dragChange(){if(this.attrs.draggable)this._listenDrag();else{if(this._dragCleanup(),!this.getStage())return;const t=Vn._dragElements.get(this._id),n=t&&t.dragStatus==="dragging",r=t&&t.dragStatus==="ready";n?this.stopDrag():r&&Vn._dragElements.delete(this._id)}}_dragCleanup(){this.off("mousedown.konva"),this.off("touchstart.konva")}isClientRectOnScreen(t={x:0,y:0}){const n=this.getStage();if(!n)return!1;const r={x:-t.x,y:-t.y,width:n.width()+2*t.x,height:n.height()+2*t.y};return De.haveIntersection(r,this.getClientRect())}static create(t,n){return De._isString(t)&&(t=JSON.parse(t)),this._createNode(t,n)}static _createNode(t,n){let r=Ah.prototype.getClassName.call(t),o=t.children,i,s,a;n&&(t.attrs.container=n),St[r]||(De.warn('Can not find a node with class name "'+r+'". Fallback to "Shape".'),r="Shape");const l=St[r];if(i=new l(t.attrs),o)for(s=o.length,a=0;a<s;a++)i.add(Ah._createNode(o[a]));return i}};_t.protoListenerMap=new Map,_t.prototype.nodeType="Node",_t.prototype._attrsAffectingSize=[],_t.prototype.eventListeners={},_t.prototype.on(cN,function(){if(this._batchingTransformChange){this._needClearTransformCache=!0;return}this._clearCache(xl),this._clearSelfAndDescendantCache(Na)}),_t.prototype.on("visibleChange.konva",function(){this._clearSelfAndDescendantCache(hb)}),_t.prototype.on("listeningChange.konva",function(){this._clearSelfAndDescendantCache(fb)}),_t.prototype.on("opacityChange.konva",function(){this._clearSelfAndDescendantCache(vm)});var er=me.addGetterSetter;er(_t,"zIndex"),er(_t,"absolutePosition"),er(_t,"position"),er(_t,"x",0,yt()),er(_t,"y",0,yt()),er(_t,"globalCompositeOperation","source-over",kc()),er(_t,"opacity",1,yt()),er(_t,"name","",kc()),er(_t,"id","",kc()),er(_t,"rotation",0,yt()),me.addComponentsGetterSetter(_t,"scale",["x","y"]),er(_t,"scaleX",1,yt()),er(_t,"scaleY",1,yt()),me.addComponentsGetterSetter(_t,"skew",["x","y"]),er(_t,"skewX",0,yt()),er(_t,"skewY",0,yt()),me.addComponentsGetterSetter(_t,"offset",["x","y"]),er(_t,"offsetX",0,yt()),er(_t,"offsetY",0,yt()),er(_t,"dragDistance",void 0,yt()),er(_t,"width",0,yt()),er(_t,"height",0,yt()),er(_t,"listening",!0,ls()),er(_t,"preventDefault",!0,ls()),er(_t,"filters",void 0,function(e){return this._filterUpToDate=!1,e}),er(_t,"visible",!0,ls()),er(_t,"transformsEnabled","all",kc()),er(_t,"size"),er(_t,"dragBoundFunc"),er(_t,"draggable",!1,ls()),me.backCompat(_t,{rotateDeg:"rotate",setRotationDeg:"setRotation",getRotationDeg:"getRotation"});var Ii=class extends _t{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=_t.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=_t.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 p=this.getAbsoluteTransform(n);let g=p.getMatrix();i.transform(g[0],g[1],g[2],g[3],g[4],g[5]),i.beginPath();let m;if(l)m=l.call(this,i,this);else{const v=this.clipX(),k=this.clipY();i.rect(v||0,k||0,s,a)}i.clip.apply(i,m),g=p.copy().invert().getMatrix(),i.transform(g[0],g[1],g[2],g[3],g[4],g[5])}const f=!d&&this.globalCompositeOperation()!=="source-over"&&e==="drawScene";f&&(i.save(),i._applyGlobalCompositeOperation(this)),(o=this.children)===null||o===void 0||o.forEach(function(p){p[e](t,n,r)}),f&&i.restore(),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(p){if(!p.visible())return;const g=p.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 p=0;p<d.length;p++)if(d[p]._isVisible(this)){f=!0;break}return f&&o!==void 0?l={x:o,y:i,width:s-o,height:a-i}:l={x:0,y:0,width:0,height:0},n?l:this._transformedRect(l,r)}};me.addComponentsGetterSetter(Ii,"clip",["x","y","width","height"]),me.addGetterSetter(Ii,"clipX",void 0,yt()),me.addGetterSetter(Ii,"clipY",void 0,yt()),me.addGetterSetter(Ii,"clipWidth",void 0,yt()),me.addGetterSetter(Ii,"clipHeight",void 0,yt()),me.addGetterSetter(Ii,"clipFunc");var Kf=new Map,T4=St._global.PointerEvent!==void 0;function pb(e){return Kf.get(e)}function mb(e){return{evt:e,pointerId:e.pointerId}}function x4(e,t){return Kf.get(e)===t}function R4(e,t){qf(e),t.getStage()&&(Kf.set(e,t),T4&&t._fire("gotpointercapture",mb(new PointerEvent("gotpointercapture"))))}function qf(e,t){const n=Kf.get(e);if(!n)return;const r=n.getStage();r&&r.content,Kf.delete(e),T4&&n._fire("lostpointercapture",mb(new PointerEvent("lostpointercapture")))}var dN="Stage",fN="string",L4="px",hN="mouseout",M4="mouseleave",D4="mouseover",O4="mouseenter",P4="mousemove",F4="mousedown",N4="mouseup",Yf="pointermove",Xf="pointerdown",$u="pointerup",Zf="pointercancel",pN="lostpointercapture",bm="pointerout",Qf="pointerleave",wm="pointerover",Cm="pointerenter",gb="contextmenu",B4="touchstart",z4="touchend",V4="touchmove",j4="touchcancel",vb="wheel",mN=5,gN=[[O4,"_pointerenter"],[F4,"_pointerdown"],[P4,"_pointermove"],[N4,"_pointerup"],[M4,"_pointerleave"],[B4,"_pointerdown"],[V4,"_pointermove"],[z4,"_pointerup"],[j4,"_pointercancel"],[D4,"_pointerover"],[vb,"_wheel"],[gb,"_contextmenu"],[Xf,"_pointerdown"],[Yf,"_pointermove"],[$u,"_pointerup"],[Zf,"_pointercancel"],[Qf,"_pointerleave"],[pN,"_lostpointercapture"]],yb={mouse:{[bm]:hN,[Qf]:M4,[wm]:D4,[Cm]:O4,[Yf]:P4,[Xf]:F4,[$u]:N4,[Zf]:"mousecancel",pointerclick:"click",pointerdblclick:"dblclick"},touch:{[bm]:"touchout",[Qf]:"touchleave",[wm]:"touchover",[Cm]:"touchenter",[Yf]:V4,[Xf]:B4,[$u]:z4,[Zf]:j4,pointerclick:"tap",pointerdblclick:"dbltap"},pointer:{[bm]:bm,[Qf]:Qf,[wm]:wm,[Cm]:Cm,[Yf]:Yf,[Xf]:Xf,[$u]:$u,[Zf]:Zf,pointerclick:"pointerclick",pointerdblclick:"pointerdblclick"}},Jf=e=>e.indexOf("pointer")>=0?"pointer":e.indexOf("touch")>=0?"touch":"mouse",Gu=e=>{const t=Jf(e);if(t==="pointer")return St.pointerEventsEnabled&&yb.pointer;if(t==="touch")return yb.touch;if(t==="mouse")return yb.mouse};function U4(e={}){return(e.clipFunc||e.clipWidth||e.clipHeight)&&De.warn("Stage does not support clipping. Please use clip for Layers or Groups."),e}var vN="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);",eh=[],km=class extends Ii{constructor(e){super(U4(e)),this._pointerPositions=[],this._changedPointerPositions=[],this._buildDOM(),this._bindContentEvents(),eh.push(this),this.on("widthChange.konva heightChange.konva",this._resizeDOM),this.on("visibleChange.konva",this._checkVisibility),this.on("clipWidthChange.konva clipHeightChange.konva clipFuncChange.konva",()=>{U4(this.attrs)}),this._checkVisibility()}_validateAdd(e){const t=e.getType()==="Layer",n=e.getType()==="FastLayer";t||n||De.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===fN){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"),Ii.prototype.clone.call(this,e)}destroy(){super.destroy();const e=this.content;e&&De._isInDocument(e)&&this.container().removeChild(e);const t=eh.indexOf(this);return t>-1&&eh.splice(t,1),De.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}:(De.warn(vN),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 El({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+L4,this.content.style.height=t+L4),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>mN&&De.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(),St.isBrowser&&this.content.appendChild(e.canvas._canvas),this}getParent(){return null}getLayer(){return null}hasPointerCapture(e){return x4(e,this)}setPointerCapture(e){R4(e,this)}releaseCapture(e){qf(e,this)}getLayers(){return this.children}_bindContentEvents(){St.isBrowser&&gN.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=Jf(e.type);if(!t)return;this.setPointersPositions(e);const r=this._getTargetShape(n),o=!(St.isDragging()||St.isTransforming())||St.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=Jf(e.type);if(!t)return;this.setPointersPositions(e);let r=!1;this._changedPointerPositions.forEach(o=>{const i=this.getIntersection(o);if(Vn.justDragged=!1,St["_"+n+"ListenClick"]=!0,!i||!i.isListening()){this[n+"ClickStartShape"]=void 0;return}St.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=Jf(e.type);if(!t)return;const r=e.type.indexOf("touch")>=0||e.pointerType==="touch";if(St.isDragging()&&Vn.node.preventDefault()&&e.cancelable&&r&&e.preventDefault(),this.setPointersPositions(e),!(!(St.isDragging()||St.isTransforming())||St.hitOnDragEnabled))return;const o={};let i=!1;const s=this._getTargetShape(n);this._changedPointerPositions.forEach(a=>{const l=pb(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=Jf(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=pb(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;St["_"+n+"InDblClickWindow"]?(f=!0,clearTimeout(this[n+"DblTimeout"])):Vn.justDragged||(St["_"+n+"InDblClickWindow"]=!0,clearTimeout(this[n+"DblTimeout"])),this[n+"DblTimeout"]=setTimeout(function(){St["_"+n+"InDblClickWindow"]=!1},St.dblClickWindow),l&&l.isListening()?(s=!0,this[n+"ClickEndShape"]=l,l._fireAndBubble(t.pointerup,{...d}),St["_"+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),St["_"+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}),St["_"+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(gb,{evt:e}):this._fire(gb,{evt:e,target:this,currentTarget:this})}_wheel(e){this.setPointersPositions(e);const t=this.getIntersection(this.getPointerPosition());t&&t.isListening()?t._fireAndBubble(vb,{evt:e}):this._fire(vb,{evt:e,target:this,currentTarget:this})}_pointercancel(e){this.setPointersPositions(e);const t=pb(e.pointerId)||this.getIntersection(this.getPointerPosition());t&&t._fireAndBubble($u,mb(e)),qf(e.pointerId)}_lostpointercapture(e){qf(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:De._getFirstPointerId(e)}],this._changedPointerPositions=[{x:n,y:r,id:De._getFirstPointerId(e)}])}_setPointerPosition(e){De.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 El({width:this.width(),height:this.height()}),this.bufferHitCanvas=new ub({pixelRatio:1,width:this.width(),height:this.height()}),!St.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 De.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}};km.prototype.nodeType=dN,Ir(km),me.addGetterSetter(km,"container"),St.isBrowser&&document.addEventListener("visibilitychange",()=>{eh.forEach(e=>{e.batchDraw()})});var H4="hasShadow",$4="shadowRGBA",G4="patternImage",W4="linearGradient",K4="radialGradient",Sm;function bb(){return Sm||(Sm=De.createCanvasElement().getContext("2d"),Sm)}var th={};function yN(e){const t=this.attrs.fillRule;t?e.fill(t):e.fill()}function bN(e){e.stroke()}function wN(e){const t=this.attrs.fillRule;t?e.fill(t):e.fill()}function CN(e){e.stroke()}function kN(){this._clearCache(H4)}function SN(){this._clearCache($4)}function _N(){this._clearCache(G4)}function AN(){this._clearCache(W4)}function IN(){this._clearCache(K4)}var gt=class extends _t{constructor(e){super(e);let t,n=0;for(;t=De.getHitColor(),!(t&&!(t in th));)if(n++,n>=1e4){De.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=De.getRandomColor();break}this.colorKey=t,th[t]=this}getContext(){return De.warn("shape.getContext() method is deprecated. Please do not use it."),this.getLayer().getContext()}getCanvas(){return De.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(H4,this._hasShadow)}_hasShadow(){return this.shadowEnabled()&&this.shadowOpacity()!==0&&!!(this.shadowColor()||this.shadowBlur()||this.shadowOffsetX()||this.shadowOffsetY())}_getFillPattern(){return this._getCache(G4,this.__getFillPattern)}__getFillPattern(){if(this.fillPatternImage()){const e=bb().createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(e&&e.setTransform){const t=new as;t.translate(this.fillPatternX(),this.fillPatternY()),t.rotate(St.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(W4,this.__getLinearGradient)}__getLinearGradient(){const e=this.fillLinearGradientColorStops();if(e){const t=bb(),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(K4,this.__getRadialGradient)}__getRadialGradient(){const e=this.fillRadialGradientColorStops();if(e){const t=bb(),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($4,this._getShadowRGBA)}_getShadowRGBA(){if(!this.hasShadow())return;const e=De.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 _t.prototype.destroy.call(this),delete th[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){De.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,p=a+Math.abs(d),g=l+Math.abs(f),m=c&&this.shadowBlur()||0,v={width:p+m*2,height:g+m*2,x:-(s/2+m)+Math.min(d,0)+i.x,y:-(s/2+m)+Math.min(f,0)+i.y};return r?v:this._transformedRect(v,o)}drawScene(e,t,n){const r=this.getLayer(),o=(e||r.getCanvas()).getContext(),i=this._getCanvasCache(),s=this.getSceneFunc(),a=this.hasShadow();let l;const 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 p=this.getAbsoluteTransform(t).getMatrix();f.transform(p[0],p[1],p[2],p[3],p[4],p[5]),s.call(this,f,this),f.restore();const g=d.pixelRatio;a&&o._applyShadow(this),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||De.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=De._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){De.error("Unable to draw hit graph from cached scene canvas. "+a.message)}return this}hasPointerCapture(e){return x4(e,this)}setPointerCapture(e){R4(e,this)}releaseCapture(e){qf(e,this)}};gt.prototype._fillFunc=yN,gt.prototype._strokeFunc=bN,gt.prototype._fillFuncHit=wN,gt.prototype._strokeFuncHit=CN,gt.prototype._centroid=!1,gt.prototype.nodeType="Shape",Ir(gt),gt.prototype.eventListeners={},gt.prototype.on("shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",kN),gt.prototype.on("shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",SN),gt.prototype.on("fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",_N),gt.prototype.on("fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",AN),gt.prototype.on("fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",IN),me.addGetterSetter(gt,"stroke",void 0,k4()),me.addGetterSetter(gt,"strokeWidth",2,yt()),me.addGetterSetter(gt,"fillAfterStrokeEnabled",!1),me.addGetterSetter(gt,"hitStrokeWidth","auto",db()),me.addGetterSetter(gt,"strokeHitEnabled",!0,ls()),me.addGetterSetter(gt,"perfectDrawEnabled",!0,ls()),me.addGetterSetter(gt,"shadowForStrokeEnabled",!0,ls()),me.addGetterSetter(gt,"lineJoin"),me.addGetterSetter(gt,"lineCap"),me.addGetterSetter(gt,"miterLimit"),me.addGetterSetter(gt,"sceneFunc"),me.addGetterSetter(gt,"hitFunc"),me.addGetterSetter(gt,"dash"),me.addGetterSetter(gt,"dashOffset",0,yt()),me.addGetterSetter(gt,"shadowColor",void 0,kc()),me.addGetterSetter(gt,"shadowBlur",0,yt()),me.addGetterSetter(gt,"shadowOpacity",1,yt()),me.addComponentsGetterSetter(gt,"shadowOffset",["x","y"]),me.addGetterSetter(gt,"shadowOffsetX",0,yt()),me.addGetterSetter(gt,"shadowOffsetY",0,yt()),me.addGetterSetter(gt,"fillPatternImage"),me.addGetterSetter(gt,"fill",void 0,k4()),me.addGetterSetter(gt,"fillPatternX",0,yt()),me.addGetterSetter(gt,"fillPatternY",0,yt()),me.addGetterSetter(gt,"fillLinearGradientColorStops"),me.addGetterSetter(gt,"strokeLinearGradientColorStops"),me.addGetterSetter(gt,"fillRadialGradientStartRadius",0),me.addGetterSetter(gt,"fillRadialGradientEndRadius",0),me.addGetterSetter(gt,"fillRadialGradientColorStops"),me.addGetterSetter(gt,"fillPatternRepeat","repeat"),me.addGetterSetter(gt,"fillEnabled",!0),me.addGetterSetter(gt,"strokeEnabled",!0),me.addGetterSetter(gt,"shadowEnabled",!0),me.addGetterSetter(gt,"dashEnabled",!0),me.addGetterSetter(gt,"strokeScaleEnabled",!0),me.addGetterSetter(gt,"fillPriority","color"),me.addComponentsGetterSetter(gt,"fillPatternOffset",["x","y"]),me.addGetterSetter(gt,"fillPatternOffsetX",0,yt()),me.addGetterSetter(gt,"fillPatternOffsetY",0,yt()),me.addComponentsGetterSetter(gt,"fillPatternScale",["x","y"]),me.addGetterSetter(gt,"fillPatternScaleX",1,yt()),me.addGetterSetter(gt,"fillPatternScaleY",1,yt()),me.addComponentsGetterSetter(gt,"fillLinearGradientStartPoint",["x","y"]),me.addComponentsGetterSetter(gt,"strokeLinearGradientStartPoint",["x","y"]),me.addGetterSetter(gt,"fillLinearGradientStartPointX",0),me.addGetterSetter(gt,"strokeLinearGradientStartPointX",0),me.addGetterSetter(gt,"fillLinearGradientStartPointY",0),me.addGetterSetter(gt,"strokeLinearGradientStartPointY",0),me.addComponentsGetterSetter(gt,"fillLinearGradientEndPoint",["x","y"]),me.addComponentsGetterSetter(gt,"strokeLinearGradientEndPoint",["x","y"]),me.addGetterSetter(gt,"fillLinearGradientEndPointX",0),me.addGetterSetter(gt,"strokeLinearGradientEndPointX",0),me.addGetterSetter(gt,"fillLinearGradientEndPointY",0),me.addGetterSetter(gt,"strokeLinearGradientEndPointY",0),me.addComponentsGetterSetter(gt,"fillRadialGradientStartPoint",["x","y"]),me.addGetterSetter(gt,"fillRadialGradientStartPointX",0),me.addGetterSetter(gt,"fillRadialGradientStartPointY",0),me.addComponentsGetterSetter(gt,"fillRadialGradientEndPoint",["x","y"]),me.addGetterSetter(gt,"fillRadialGradientEndPointX",0),me.addGetterSetter(gt,"fillRadialGradientEndPointY",0),me.addGetterSetter(gt,"fillPatternRotation",0),me.addGetterSetter(gt,"fillRule",void 0,kc()),me.backCompat(gt,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"});var EN="beforeDraw",TN="draw",q4=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],xN=q4.length,_c=class extends Ii{constructor(e){super(e),this.canvas=new El,this.hitCanvas=new ub({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(){_t.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(!_t.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(_t.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(_t.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 _t.prototype.remove.call(this),e&&e.parentNode&&De._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"&&De.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(),_t.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(){De.warn('Can not change width of layer. Use "stage.width(value)" function instead.')}getHeight(){if(this.parent)return this.parent.height()}setHeight(){De.warn('Can not change height of layer. Use "stage.height(value)" function instead.')}batchDraw(){return this._waitingForDraw||(this._waitingForDraw=!0,De.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<xN;r++){const o=q4[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=th[De.getHitColorKey(n[0],n[1],n[2])];return o?{shape:o}:{antialiased:!0}}else if(r>0)return{antialiased:!0};return{}}drawScene(e,t,n){const r=this.getLayer(),o=e||r&&r.getCanvas();return this._fire(EN,{node:this}),this.clearBeforeDraw()&&o.getContext().clear(),Ii.prototype.drawScene.call(this,o,t,n),this._fire(TN,{node:this}),this}drawHit(e,t){const n=this.getLayer(),r=e||n&&n.hitCanvas;return n&&n.clearBeforeDraw()&&n.getHitCanvas().getContext().clear(),Ii.prototype.drawHit.call(this,r,t),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(e){De.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening(e)}getHitGraphEnabled(e){return De.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 De.releaseCanvas(this.getNativeCanvasElement(),this.getHitCanvas()._canvas),super.destroy()}};_c.prototype.nodeType="Layer",Ir(_c),me.addGetterSetter(_c,"imageSmoothingEnabled",!0),me.addGetterSetter(_c,"clearBeforeDraw",!0),me.addGetterSetter(_c,"hitGraphEnabled",!0,ls());var wb=class extends _c{constructor(e){super(e),this.listening(!1),De.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.')}};wb.prototype.nodeType="FastLayer",Ir(wb);var Wu=class extends Ii{_validateAdd(e){const t=e.getType();t!=="Group"&&t!=="Shape"&&De.throw("You may only add groups and shapes to groups.")}};Wu.prototype.nodeType="Group",Ir(Wu);var Cb=(function(){return Cc.performance&&Cc.performance.now?function(){return Cc.performance.now()}:function(){return new Date().getTime()}})(),Ku=class Md{constructor(t,n){this.id=Md.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:Cb(),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=Md.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=Cb(),Md._addAnimation(this),this}stop(){return Md._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(Cb());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=Md;t.animations.length?(t._runFrames(),De.requestAnimFrame(t._animationLoop)):t.animRunning=!1}static _handleAnimation(){this.animRunning||(this.animRunning=!0,De.requestAnimFrame(this._animationLoop))}};Ku.animations=[],Ku.animIdCounter=0,Ku.animRunning=!1;var RN={node:1,duration:1,easing:1,onFinish:1,yoyo:1},LN=1,Y4=2,X4=3,Z4=["fill","stroke","shadowColor"],MN=0,DN=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=Y4,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")}reverse(){this.state=X4,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===Y4?this.setTime(e):this.state===X4&&this.setTime(this.duration-e)}pause(){this.state=LN,this.fire("onPause")}getTimer(){return new Date().getTime()}},_m=class Ur{constructor(t){const n=this,r=t.node,o=r._id,i=t.easing||nh.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=MN++;const c=r.getLayer()||(r instanceof St.Stage?r.getLayers():null);c||De.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."),this.anim=new Ku(function(){n.tween.onEnterFrame()},c),this.tween=new DN(l,function(d){n._tweenFunc(d)},i,0,1,a*1e3,s),this._addListeners(),Ur.attrs[o]||(Ur.attrs[o]={}),Ur.attrs[o][this._id]||(Ur.attrs[o][this._id]={}),Ur.tweens[o]||(Ur.tweens[o]={});for(l in t)RN[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=Ur.tweens[o][t];d&&delete Ur.attrs[o][d][t];let f=r.getAttr(t);if(De._isArray(n))if(i=[],s=Math.max(n.length,f.length),t==="points"&&n.length!==f.length&&(n.length>f.length?(l=f,f=De._prepareArrayForTween(f,n,r.closed())):(a=n,n=De._prepareArrayForTween(n,f,r.closed()))),t.indexOf("fill")===0)for(let p=0;p<s;p++)if(p%2===0)i.push(n[p]-f[p]);else{const g=De.colorToRGBA(f[p]);c=De.colorToRGBA(n[p]),f[p]=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 p=0;p<s;p++)i.push(n[p]-f[p]);else Z4.indexOf(t)!==-1?(f=De.colorToRGBA(f),c=De.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;Ur.attrs[o][this._id][t]={start:f,diff:i,end:n,trueEnd:a,trueStart:l},Ur.tweens[o][t]=this._id}_tweenFunc(t){const n=this.node,r=Ur.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,De._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 Z4.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=Ur.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=Ur.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=Ur.tweens[t];this.pause(),this.anim&&this.anim.stop();for(const o in r)delete Ur.tweens[t][o];delete Ur.attrs[t][n],Ur.tweens[t]&&(Object.keys(Ur.tweens[t]).length===0&&delete Ur.tweens[t],Object.keys(Ur.attrs[t]).length===0&&delete Ur.attrs[t])}};_m.attrs={},_m.tweens={},_t.prototype.to=function(e){const t=e.onFinish;e.node=this,e.onFinish=function(){this.destroy(),t&&t()},new _m(e).play()};var nh={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-nh.BounceEaseOut(r-e,0,n,r)+t},BounceEaseInOut(e,t,n,r){return e<r/2?nh.BounceEaseIn(e*2,0,n,r)*.5+t:nh.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}},Q4=De._assign(St,{Util:De,Transform:as,Node:_t,Container:Ii,Stage:km,stages:eh,Layer:_c,FastLayer:wb,Group:Wu,DD:Vn,Shape:gt,shapes:th,Animation:Ku,Tween:_m,Easings:nh,Context:pm,Canvas:cb}),Ba=class extends gt{_sceneFunc(e){const t=St.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=St.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"],Ir(Ba),me.addGetterSetter(Ba,"innerRadius",0,yt()),me.addGetterSetter(Ba,"outerRadius",0,yt()),me.addGetterSetter(Ba,"angle",0,yt()),me.addGetterSetter(Ba,"clockwise",!1,ls());function kb(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 J4(e,t){const n=e.length,r=[];for(let o=2;o<n-2;o+=2){const i=kb(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 ON(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 za=class extends gt{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():J4(this.points(),this.tension())}_getTensionPointsClosed(){const e=this.points(),t=e.length,n=this.tension(),r=kb(e[t-2],e[t-1],e[0],e[1],e[2],e[3],n),o=kb(e[t-4],e[t-3],e[t-2],e[t-1],e[0],e[1],n),i=J4(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],...ON(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}}};za.prototype.className="Line",za.prototype._attrsAffectingSize=["points","bezier","tension"],Ir(za),me.addGetterSetter(za,"closed",!1),me.addGetterSetter(za,"bezier",!1),me.addGetterSetter(za,"tension",0,yt()),me.addGetterSetter(za,"points",[],XF());var PN=[[],[],[-.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]],FN=[[],[],[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]],NN=[[1],[1,1],[1,2,1],[1,3,3,1]],eA=(e,t,n)=>{let r,o;const s=n/2;r=0;for(let a=0;a<20;a++)o=s*PN[20][a]+s,r+=FN[20][a]*BN(e,t,o);return s*r},tA=(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,p=n+d,g=f-d*d,m=p*p+g>0?Math.sqrt(p*p+g):0,v=d*d+g>0?Math.sqrt(d*d+g):0,k=d+Math.sqrt(d*d+g)!==0?g*Math.log(Math.abs((p+m)/(d+v))):0;return Math.sqrt(a)/2*(p*m-d*v+k)};function BN(e,t,n){const r=Sb(1,n,e),o=Sb(1,n,t),i=r*r+o*o;return Math.sqrt(i)}var Sb=(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+=NN[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 Sb(e-1,t,o)}},nA=(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},Hi=class wi extends gt{constructor(t){super(t),this.dataArray=[],this.pathLength=0,this._readDataAttribute(),this.on("dataChange.konva",function(){this._readDataAttribute()})}_readDataAttribute(){this.dataArray=wi.parsePathData(this.data()),this.pathLength=wi.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],p=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+p,1-m),t.scale(1/k,1/C),t.rotate(-g),t.translate(-a,-l);break;case"z":r=!0,t.closePath();break}}!r&&!this.hasFill()?t.strokeShape(this):t.fillStrokeShape(this)}getSelfRect(){let t=[];this.dataArray.forEach(function(l){if(l.command==="A"){const c=l.points[4],d=l.points[5],f=l.points[4]+d;let p=Math.PI/180;if(Math.abs(c-f)<p&&(p=Math.abs(c-f)),d<0)for(let g=c-p;g>f;g-=p){const m=wi.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+p;g<f;g+=p){const m=wi.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=wi.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 wi.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 wi.getPointOnLine(t,s.start.x,s.start.y,a[0],a[1]);case"C":return wi.getPointOnCubicBezier(nA(t,wi.getPathLength(n),v=>eA([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 wi.getPointOnQuadraticBezier(nA(t,wi.getPathLength(n),v=>tA([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],p=a[5],g=a[6];let m=a[4];return m+=p*t/s.pathLength,wi.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 p=((s-n)*(o-n)+(a-r)*(i-r))/(l*l),g=n+p*(o-n),m=r+p*(i-r),v=this.getLineLength(s,a,g,m),k=Math.sqrt(t*t-v*v),C=Math.sqrt(k*k/(1+c*c))*(o<n?-1:1),S=c*C;return{x:g+C,y:m+S}}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 p(m){return 3*m*(1-m)*(1-m)}function g(m){return(1-m)*(1-m)*(1-m)}return{x:l*d(t)+s*f(t)+o*p(t)+n*g(t),y:c*d(t)+a*f(t)+i*p(t)+r*g(t)}}static getPointOnQuadraticBezier(t,n,r,o,i,s,a){function l(f){return f*f}function 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 p=o[f],g=p.charAt(0);for(p=p.slice(1),s.length=0;d=c.exec(p);)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=s[k];if(S==="00"){m.push(0,0),v>=0&&(v+=2,v>=7&&(v-=7));continue}if(v>=0){if(v===3){if(/^[01]{2}\d+(?:\.\d+)?$/.test(S)){m.push(parseInt(S[0],10)),m.push(parseInt(S[1],10)),m.push(parseFloat(S.slice(2))),v+=3,v>=7&&(v-=7);continue}if(S==="11"||S==="10"||S==="01"){m.push(parseInt(S[0],10)),m.push(parseInt(S[1],10)),v+=2,v>=7&&(v-=7);continue}if(S==="0"||S==="1"){m.push(parseInt(S,10)),v+=1,v>=7&&(v-=7);continue}}else if(v===4){if(/^[01]\d+(?:\.\d+)?$/.test(S)){m.push(parseInt(S[0],10)),m.push(parseFloat(S.slice(1))),v+=2,v>=7&&(v-=7);continue}if(S==="0"||S==="1"){m.push(parseInt(S,10)),v+=1,v>=7&&(v-=7);continue}}const w=parseFloat(S);isNaN(w)?m.push(0):m.push(w),v+=1,v>=7&&(v-=7)}else{const w=parseFloat(S);isNaN(w)?m.push(0):m.push(w)}}for(;m.length>0&&!isNaN(m[0]);){let k="",C=[];const S=a,w=l;let b,T,L,N,H,z,B,Z,R,K;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 x=m.shift(),W=m.shift();if(a+=x,l+=W,k="M",i.length>2&&i[i.length-1].command==="z"){for(let $=i.length-2;$>=0;$--)if(i[$].command==="M"){a=i[$].points[0]+x,l=i[$].points[1]+W;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,b=i[i.length-1],b.command==="C"&&(T=a+(a-b.points[2]),L=l+(l-b.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,b=i[i.length-1],b.command==="C"&&(T=a+(a-b.points[2]),L=l+(l-b.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,b=i[i.length-1],b.command==="Q"&&(T=a+(a-b.points[0]),L=l+(l-b.points[1])),a=m.shift(),l=m.shift(),k="Q",C.push(T,L,a,l);break;case"t":T=a,L=l,b=i[i.length-1],b.command==="Q"&&(T=a+(a-b.points[0]),L=l+(l-b.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(),z=m.shift(),B=m.shift(),Z=m.shift(),R=a,K=l,a=m.shift(),l=m.shift(),k="A",C=this.convertEndpointToCenterParameterization(R,K,a,l,B,Z,N,H,z);break;case"a":N=m.shift(),H=m.shift(),z=m.shift(),B=m.shift(),Z=m.shift(),R=a,K=l,a+=m.shift(),l+=m.shift(),k="A",C=this.convertEndpointToCenterParameterization(R,K,a,l,B,Z,N,H,z);break}i.push({command:k||g,points:C,start:{x:S,y:w},pathLength:this.calcLength(S,w,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=wi;switch(r){case"L":return c.getLineLength(t,n,o[0],o[1]);case"C":return eA([t,o[0],o[2],o[4]],[n,o[1],o[3],o[5]],1);case"Q":return tA([t,o[0],o[2]],[n,o[1],o[3]],1);case"A":i=0;const d=o[4],f=o[5],p=o[4]+f;let g=Math.PI/180;if(Math.abs(d-p)<g&&(g=Math.abs(d-p)),s=c.getPointOnEllipticalArc(o[0],o[1],o[2],o[3],d,0),f<0)for(l=d-g;l>p;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<p;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],p,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,p=-1*Math.sin(d)*(t-r)/2+Math.cos(d)*(n-o)/2,g=f*f/(a*a)+p*p/(l*l);g>1&&(a*=Math.sqrt(g),l*=Math.sqrt(g));let m=Math.sqrt((a*a*(l*l)-a*a*(p*p)-l*l*(f*f))/(a*a*(p*p)+l*l*(f*f)));i===s&&(m*=-1),isNaN(m)&&(m=0);const v=m*a*p/l,k=m*-l*f/a,C=(t+r)/2+Math.cos(d)*v-Math.sin(d)*k,S=(n+o)/2+Math.sin(d)*v+Math.cos(d)*k,w=function(B){return Math.sqrt(B[0]*B[0]+B[1]*B[1])},b=function(B,Z){return(B[0]*Z[0]+B[1]*Z[1])/(w(B)*w(Z))},T=function(B,Z){return(B[0]*Z[1]<B[1]*Z[0]?-1:1)*Math.acos(b(B,Z))},L=T([1,0],[(f-v)/a,(p-k)/l]),N=[(f-v)/a,(p-k)/l],H=[(-1*f-v)/a,(-1*p-k)/l];let z=T(N,H);return b(N,H)<=-1&&(z=Math.PI),b(N,H)>=1&&(z=0),s===0&&z>0&&(z=z-2*Math.PI),s===1&&z<0&&(z=z+2*Math.PI),[C,S,a,l,L,z,d,s]}};Hi.prototype.className="Path",Hi.prototype._attrsAffectingSize=["data"],Ir(Hi),me.addGetterSetter(Hi,"data");var Ac=class extends za{_sceneFunc(e){super._sceneFunc(e);const t=Math.PI*2,n=this.points();let r=n;const o=this.tension()!==0&&n.length>4;o&&(r=this.getTensionPoints());const i=this.pointerLength(),s=n.length;let a,l;if(o){const f=[r[r.length-4],r[r.length-3],r[r.length-2],r[r.length-1],n[s-2],n[s-1]],p=Hi.calcLength(r[r.length-4],r[r.length-3],"C",f),g=Hi.getPointOnQuadraticBezier(Math.min(1,1-i/p),f[0],f[1],f[2],f[3],f[4],f[5]);a=n[s-2]-g.x,l=n[s-1]-g.y}else a=n[s-2]-n[s-4],l=n[s-1]-n[s-3];const 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}}};Ac.prototype.className="Arrow",Ir(Ac),me.addGetterSetter(Ac,"pointerLength",10,yt()),me.addGetterSetter(Ac,"pointerWidth",10,yt()),me.addGetterSetter(Ac,"pointerAtBeginning",!1),me.addGetterSetter(Ac,"pointerAtEnding",!0);var qu=class extends gt{_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)}};qu.prototype._centroid=!0,qu.prototype.className="Circle",qu.prototype._attrsAffectingSize=["radius"],Ir(qu),me.addGetterSetter(qu,"radius",0,yt());var Rl=class extends gt{_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)}};Rl.prototype.className="Ellipse",Rl.prototype._centroid=!0,Rl.prototype._attrsAffectingSize=["radiusX","radiusY"],Ir(Rl),me.addComponentsGetterSetter(Rl,"radius",["x","y"]),me.addGetterSetter(Rl,"radiusX",0,yt()),me.addGetterSetter(Rl,"radiusY",0,yt());var cs=class yE extends gt{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?De.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?De.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=De.createImageElement();o.onload=function(){n(new yE({image:o}))},o.onerror=r,o.crossOrigin="Anonymous",o.src=t}};cs.prototype.className="Image",cs.prototype._attrsAffectingSize=["image"],Ir(cs),me.addGetterSetter(cs,"cornerRadius",0,gm(4)),me.addGetterSetter(cs,"image"),me.addComponentsGetterSetter(cs,"crop",["x","y","width","height"]),me.addGetterSetter(cs,"cropX",0,yt()),me.addGetterSetter(cs,"cropY",0,yt()),me.addGetterSetter(cs,"cropWidth",0,yt()),me.addGetterSetter(cs,"cropHeight",0,yt());var rA=["fontFamily","fontSize","fontStyle","padding","lineHeight","text","width","height","pointerDirection","pointerWidth","pointerHeight"],zN="Change.konva",VN="none",_b="up",Ab="right",Ib="down",Eb="left",jN=rA.length,Tb=class extends Wu{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<jN;n++)e.on(rA[n]+zN,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 _b:s=n/2,a=-1*l;break;case Ab:s=n+i,a=r/2;break;case Ib:s=n/2,a=r+l;break;case Eb:s=-1*i,a=r/2;break}t.setAttrs({x:-1*s,y:-1*a,width:n,height:r}),e.setAttrs({x:-1*s,y:-1*a})}}};Tb.prototype.className="Label",Ir(Tb);var Ic=class extends gt{_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===_b&&(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===Ab&&(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===Ib&&(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===Eb&&(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===_b?(t-=r,s+=r):o===Ib?s+=r:o===Eb?(e-=n*1.5,i+=n):o===Ab&&(i+=n*1.5),{x:e,y:t,width:i,height:s}}};Ic.prototype.className="Tag",Ir(Ic),me.addGetterSetter(Ic,"pointerDirection",VN),me.addGetterSetter(Ic,"pointerWidth",0,yt()),me.addGetterSetter(Ic,"pointerHeight",0,yt()),me.addGetterSetter(Ic,"cornerRadius",0,gm(4));var rh=class extends gt{_sceneFunc(e){const t=this.cornerRadius(),n=this.width(),r=this.height();e.beginPath(),t?De.drawRoundedRectPath(e,n,r,t):e.rect(0,0,n,r),e.closePath(),e.fillStrokeShape(this)}};rh.prototype.className="Rect",Ir(rh),me.addGetterSetter(rh,"cornerRadius",0,gm(4));var Ll=class extends gt{_sceneFunc(e){const t=this._getPoints(),n=this.radius(),r=this.sides(),o=this.cornerRadius();if(e.beginPath(),o)De.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)}};Ll.prototype.className="RegularPolygon",Ll.prototype._centroid=!0,Ll.prototype._attrsAffectingSize=["radius"],Ir(Ll),me.addGetterSetter(Ll,"radius",0,yt()),me.addGetterSetter(Ll,"sides",0,yt()),me.addGetterSetter(Ll,"cornerRadius",0,gm(4));var oA=Math.PI*2,Ec=class extends gt{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.innerRadius(),0,oA,!1),e.moveTo(this.outerRadius(),0),e.arc(0,0,this.outerRadius(),oA,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)}};Ec.prototype.className="Ring",Ec.prototype._centroid=!0,Ec.prototype._attrsAffectingSize=["innerRadius","outerRadius"],Ir(Ec),me.addGetterSetter(Ec,"innerRadius",0,yt()),me.addGetterSetter(Ec,"outerRadius",0,yt());var $s=class extends gt{constructor(e){super(e),this._updated=!0,this.anim=new Ku(()=>{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],p=n*2;e.drawImage(d,s,a,l,c,f[p+0],f[p+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)}};$s.prototype.className="Sprite",Ir($s),me.addGetterSetter($s,"animation"),me.addGetterSetter($s,"animations"),me.addGetterSetter($s,"frameOffsets"),me.addGetterSetter($s,"image"),me.addGetterSetter($s,"frameIndex",0,yt()),me.addGetterSetter($s,"frameRate",17,yt()),me.backCompat($s,{index:"frameIndex",getIndex:"getFrameIndex",setIndex:"setFrameIndex"});var Ml=class extends gt{_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)}};Ml.prototype.className="Star",Ml.prototype._centroid=!0,Ml.prototype._attrsAffectingSize=["innerRadius","outerRadius"],Ir(Ml),me.addGetterSetter(Ml,"numPoints",5,yt()),me.addGetterSetter(Ml,"innerRadius",0,yt()),me.addGetterSetter(Ml,"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 Yu="auto",UN="center",iA="inherit",oh="justify",HN="Change.konva",sA="2d",aA="-",lA="left",$N="text",GN="Text",WN="top",KN="bottom",cA="middle",uA="normal",qN="px ",Am=" ",YN="right",dA="rtl",XN="word",ZN="char",fA="none",xb="β¦",hA=["direction","fontFamily","fontSize","fontStyle","fontVariant","padding","align","verticalAlign","lineHeight","text","width","height","wrap","ellipsis","letterSpacing"],QN=hA.length,ih=null;function JN(){if(ih!==null)return ih;ih=!1;try{const e=document.createElement("canvas");e.width=10,e.height=10;const t=e.getContext(sA);if(t){t.globalAlpha=0,t.shadowColor="black",t.shadowBlur=5,t.shadowOffsetX=5,t.shadowOffsetY=5,t.fillStyle="black",t.font="10px Arial",t.fillText("X",0,10);const n=t.getImageData(0,0,10,10).data;for(let r=3;r<n.length;r+=4)if(n[r]>0){ih=!0;break}}}catch{}return ih}function eB(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 Im;function Rb(){return Im||(Im=De.createCanvasElement().getContext(sA),Im)}function tB(e){e.fillText(this._partialText,this._partialTextX,this._partialTextY)}function nB(e){e.setAttr("miterLimit",2),e.strokeText(this._partialText,this._partialTextX,this._partialTextY)}function rB(e){return e=e||{},!e.fillLinearGradientColorStops&&!e.fillRadialGradientColorStops&&!e.fillPatternImage&&(e.fill=e.fill||"black"),e}var cr=class extends gt{constructor(e){super(rB(e)),this._partialTextX=0,this._partialTextY=0;for(let t=0;t<QN;t++)this.on(hA[t]+HN,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(),p=this.getWidth(),g=this.letterSpacing(),m=this.charRenderFunc(),v=this.fill(),k=this.textDecoration(),C=this.underlineOffset(),S=k.indexOf("underline")!==-1,w=k.indexOf("line-through")!==-1,b;c=c===iA?e.direction:c;let T=a/2,L=cA;if(!St.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===dA&&e.setAttr("direction",c),e.setAttr("font",this._getContextFont()),e.setAttr("textBaseline",L),e.setAttr("textAlign",lA),l===cA?d=(this.getHeight()-o*a-i*2)/2:l===KN&&(d=this.getHeight()-o*a-i*2),e.translate(i,d+i),b=0;b<o;b++){let N=0,H=0;const z=r[b],B=z.text,Z=z.width,R=z.lastInParagraph;if(e.save(),f===YN?N+=p-Z-i*2:f===UN&&(N+=(p-Z-i*2)/2),S){e.save(),e.beginPath();const x=C??(St.legacyTextRendering?Math.round(s/2):Math.round(s/4)),W=N,$=T+H+x;e.moveTo(W,$);const ee=f===oh&&!R?p-i*2:Z;e.lineTo(W+Math.round(ee),$),e.lineWidth=s/15,e.strokeStyle=this._getLinearGradient()||v,e.stroke(),e.restore()}const K=N;if(c!==dA&&(g!==0||f===oh||m)){const x=B.split(" ").length-1,W=Dl(B);for(let $=0;$<W.length;$++){const ee=W[$];if(ee===" "&&!R&&f===oh&&(N+=(p-i*2-Z)/x),this._partialTextX=N,this._partialTextY=T+H,this._partialText=ee,m){e.save();const Q=r.slice(0,b).reduce((X,we)=>X+Dl(we.text).length,0);m({char:ee,index:$+Q,x:N,y:T+H,lineIndex:b,column:$,isLastInLine:R,width:this.measureSize(ee).width,context:e})}e.fillStrokeShape(this),m&&e.restore(),N+=this.measureSize(ee).width+g}}else g!==0&&e.setAttr("letterSpacing",`${g}px`),this._partialTextX=N,this._partialTextY=T+H,this._partialText=B,e.fillStrokeShape(this);if(w){e.save(),e.beginPath();const x=St.legacyTextRendering?0:-Math.round(s/4),W=K;e.moveTo(W,T+H+x);const $=f===oh&&!R?p-i*2:Z;e.lineTo(W+Math.round($),T+H+x),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=De._isString(e)?e:e==null?"":e+"";return this._setAttr($N,t),this}getWidth(){return this.attrs.width===Yu||this.attrs.width===void 0?this.getTextWidth()+this.padding()*2:this.attrs.width}getHeight(){return this.attrs.height===Yu||this.attrs.height===void 0?this.fontSize()*this.textArr.length*this.lineHeight()+this.padding()*2:this.attrs.height}getTextWidth(){return this.textWidth}getTextHeight(){return De.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 p=Rb(),g=this.fontSize(),m;p.save(),p.font=this._getContextFont(),m=p.measureText(e),p.restore();const v=g/100;return{actualBoundingBoxAscent:(t=m.actualBoundingBoxAscent)!==null&&t!==void 0?t:71.58203125*v,actualBoundingBoxDescent:(n=m.actualBoundingBoxDescent)!==null&&n!==void 0?n:0,actualBoundingBoxLeft:(r=m.actualBoundingBoxLeft)!==null&&r!==void 0?r:-7.421875*v,actualBoundingBoxRight:(o=m.actualBoundingBoxRight)!==null&&o!==void 0?o:75.732421875*v,alphabeticBaseline:(i=m.alphabeticBaseline)!==null&&i!==void 0?i:0,emHeightAscent:(s=m.emHeightAscent)!==null&&s!==void 0?s:100*v,emHeightDescent:(a=m.emHeightDescent)!==null&&a!==void 0?a:-20*v,fontBoundingBoxAscent:(l=m.fontBoundingBoxAscent)!==null&&l!==void 0?l:91*v,fontBoundingBoxDescent:(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()+Am+this.fontVariant()+Am+(this.fontSize()+qN)+eB(this.fontFamily())}_addTextLine(e){this.align()===oh&&(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 Rb().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!==Yu&&o!==void 0,a=i!==Yu&&i!==void 0,l=this.padding(),c=o-l*2,d=i-l*2,f=0,p=this.wrap(),g=p!==ZN&&p!==fA,m=this.ellipsis();this.textArr=[],Rb().font=this._getContextFont();const v=m?this._getTextWidth(xb):0;for(let k=0,C=e.length;k<C;++k){let S=e[k],w=this._getTextWidth(S);if(s&&w>c)for(;S.length>0;){let b=0,T=Dl(S).length,L="",N=0;for(;b<T;){const H=b+T>>>1,z=Dl(S).slice(0,H+1).join(""),B=this._getTextWidth(z);(m&&a&&f+r>d?B+v:B)<=c?(b=H+1,L=z,N=B):T=H}if(L){if(g){const H=Dl(S),z=Dl(L),B=H[z.length],Z=B===Am||B===aA;let R;if(Z&&N<=c)R=z.length;else{const K=z.lastIndexOf(Am),x=z.lastIndexOf(aA);R=Math.max(K,x)+1}R>0&&(b=R,L=H.slice(0,b).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(S=Dl(S).slice(b).join("").trimLeft(),S.length>0&&(w=this._getTextWidth(S),w<=c)){this._addTextLine(S),f+=r,n=Math.max(n,w);break}}else break}else this._addTextLine(S),f+=r,n=Math.max(n,w),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!==Yu&&r!==void 0,i=r-this.padding()*2;return this.wrap()===fA||o&&e+n>i}_tryToAddEllipsisToLastLine(){const e=this.attrs.width,t=e!==Yu&&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+xb)<n||(o.text=o.text.slice(0,o.text.length-3))),this.textArr.splice(this.textArr.length-1,1),this._addTextLine(o.text+xb))}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&&JN()?!0:super._useBufferCanvas()}};cr.prototype._fillFunc=tB,cr.prototype._strokeFunc=nB,cr.prototype.className=GN,cr.prototype._attrsAffectingSize=["text","fontSize","padding","wrap","lineHeight","letterSpacing"],Ir(cr),me.overWriteSetter(cr,"width",db()),me.overWriteSetter(cr,"height",db()),me.addGetterSetter(cr,"direction",iA),me.addGetterSetter(cr,"fontFamily","Arial"),me.addGetterSetter(cr,"fontSize",12,yt()),me.addGetterSetter(cr,"fontStyle",uA),me.addGetterSetter(cr,"fontVariant",uA),me.addGetterSetter(cr,"padding",0,yt()),me.addGetterSetter(cr,"align",lA),me.addGetterSetter(cr,"verticalAlign",WN),me.addGetterSetter(cr,"lineHeight",1,yt()),me.addGetterSetter(cr,"wrap",XN),me.addGetterSetter(cr,"ellipsis",!1,ls()),me.addGetterSetter(cr,"letterSpacing",0,yt()),me.addGetterSetter(cr,"text","",kc()),me.addGetterSetter(cr,"textDecoration",""),me.addGetterSetter(cr,"underlineOffset",void 0,yt()),me.addGetterSetter(cr,"charRenderFunc",void 0);var oB="",pA="normal";function mA(e){e.fillText(this.partialText,0,0)}function gA(e){e.strokeText(this.partialText,0,0)}var oo=class extends gt{constructor(e){super(e),this.dummyCanvas=De.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 Hi.getPathLength(this.dataArray)}_getPointAtLength(e){return!this.attrs.data||e>this.pathLength?null:Hi.getPointAtLengthOfDataArray(e,this.dataArray)}_readDataAttribute(){this.dataArray=Hi.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 De.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}setText(e){return cr.prototype.setText.call(this,e)}_getContextFont(){return cr.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 p=0;p<e.length;p++)t.push({char:e[p],width:this._getTextSize(e[p]).width}),n+=t[p].width;const{width:r,height:o}=this._getTextSize(this.attrs.text);if(this.textWidth=n,this.textHeight=o,this.glyphInfo=[],!this.attrs.data)return null;const i=this.letterSpacing(),s=this.align(),a=this.kerningFunc(),l=Math.max(0,n-r),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 p=0;p<t.length;p++){const g=this._getPointAtLength(f);if(!g)return;const m=t[p].char;let v=t[p].width+i;if(m===" "&&s==="justify"){const 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 S=Hi.getLineLength(g.x,g.y,C.x,C.y);let w=0;if(a)try{w=a(t[p-1].char,m)*this.fontSize()}catch{w=0}g.x+=w,C.x+=w,this.textWidth+=w;const b=Hi.getPointOnLine(w+S/2,g.x,g.y,C.x,C.y),T=Math.atan2(C.y-g.y,C.x-g.x);this.glyphInfo.push({transposeX:b.x,transposeY:b.y,text:e[p],rotation:T,p0:g,p1:C,width:S}),f+=v}}getSelfRect(){if(!this.glyphInfo.length)return{x:0,y:0,width:0,height:0};const e=[];this.glyphInfo.forEach(function(l){e.push(l.p0.x),e.push(l.p0.y),e.push(l.p1.x),e.push(l.p1.y)});let t=e[0]||0,n=e[0]||0,r=e[1]||0,o=e[1]||0,i,s;for(let l=0;l<e.length/2;l++)i=e[l*2],s=e[l*2+1],t=Math.min(t,i),n=Math.max(n,i),r=Math.min(r,s),o=Math.max(o,s);const a=this.fontSize();return{x:t-a/2,y:r-a/2,width:n-t+a,height:o-r+a}}destroy(){return De.releaseCanvas(this.dummyCanvas),super.destroy()}};oo.prototype._fillFunc=mA,oo.prototype._strokeFunc=gA,oo.prototype._fillFuncHit=mA,oo.prototype._strokeFuncHit=gA,oo.prototype.className="TextPath",oo.prototype._attrsAffectingSize=["text","fontSize","data"],Ir(oo),me.addGetterSetter(oo,"data"),me.addGetterSetter(oo,"fontFamily","Arial"),me.addGetterSetter(oo,"fontSize",12,yt()),me.addGetterSetter(oo,"fontStyle",pA),me.addGetterSetter(oo,"align","left"),me.addGetterSetter(oo,"letterSpacing",0,yt()),me.addGetterSetter(oo,"textBaseline","middle"),me.addGetterSetter(oo,"fontVariant",pA),me.addGetterSetter(oo,"text",oB),me.addGetterSetter(oo,"textDecoration",""),me.addGetterSetter(oo,"kerningFunc",void 0);var vA="tr-konva",iB=["resizeEnabledChange","rotateAnchorOffsetChange","rotateAnchorAngleChange","rotateEnabledChange","enabledAnchorsChange","anchorSizeChange","borderEnabledChange","borderStrokeChange","borderStrokeWidthChange","borderDashChange","anchorStrokeChange","anchorStrokeWidthChange","anchorFillChange","anchorCornerRadiusChange","ignoreStrokeChange","anchorStyleFuncChange"].map(e=>e+`.${vA}`).join(" "),yA="nodesRect",sB=["widthChange","heightChange","scaleXChange","scaleYChange","skewXChange","skewYChange","rotationChange","offsetXChange","offsetYChange","transformsEnabledChange","strokeWidthChange","draggableChange"],aB={"top-left":-45,"top-center":0,"top-right":45,"middle-right":-90,"middle-left":90,"bottom-left":-135,"bottom-center":180,"bottom-right":135},lB="ontouchstart"in St._global;function cB(e,t,n){if(e==="rotater")return n;t+=De.degToRad(aB[e]||0);const r=(De.radToDeg(t)%360+360)%360;return De._inRange(r,337.5,360)||De._inRange(r,0,22.5)?"ns-resize":De._inRange(r,22.5,67.5)?"nesw-resize":De._inRange(r,67.5,112.5)?"ew-resize":De._inRange(r,112.5,157.5)?"nwse-resize":De._inRange(r,157.5,202.5)?"ns-resize":De._inRange(r,202.5,247.5)?"nesw-resize":De._inRange(r,247.5,292.5)?"ew-resize":De._inRange(r,292.5,337.5)?"nwse-resize":(De.error("Transformer has unknown angle for cursor detection: "+r),"pointer")}var Em=["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"];function uB(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 bA(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 dB(e,t){return bA(e,t,uB(e))}function fB(e,t,n){let r=t;for(let o=0;o<e.length;o++){const i=St.getAngle(e[o]),s=Math.abs(i-t)%(Math.PI*2);Math.min(s,Math.PI*2-s)<n&&(r=i)}return r}var Lb=0,Ln=class extends Wu{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(iB,this.update),this.getNode()&&this.update()}attachTo(e){return this.setNode(e),this}setNode(e){return De.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 vA+this._id}setNodes(e=[]){this._nodes&&this._nodes.length&&this.detach();const t=e.filter(n=>n.isAncestorOf(this)?(De.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(sB.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(yA),this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")}_getNodeRect(){return this._getCache(yA,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=(St.getAngle(e.getAbsoluteRotation())+Math.PI*2)%(Math.PI*2);return bA({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},-St.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 p=d.point(f);e.push(p)})});const t=new as;t.rotate(-St.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:St.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(),Em.forEach(e=>{this._createAnchor(e)}),this._createAnchor("rotater"),this._elementsCreated=!0}_createAnchor(e){const t=new rh({stroke:"rgb(0, 161, 255)",fill:"white",strokeWidth:1,name:e+" _anchor",dragDistance:0,draggable:!0,hitStrokeWidth:lB?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=cB(e,St.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 gt({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=De.degToRad(a),d=Math.sin(c),f=-Math.cos(c),p=i/2,g=s/2;let m=1/0;f<0?m=Math.min(m,-g/f):f>0&&(m=Math.min(m,(s-g)/f)),d<0?m=Math.min(m,-p/d):d>0&&(m=Math.min(m,(i-p)/d));const v=p+d*m,k=g+f*m,C=De._sign(s),S=v+d*l*C,w=k+f*l*C;t.moveTo(v,k),t.lineTo(S,w)}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},Lb++,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 S=St.getAngle(this.rotateAnchorAngle());let w=Math.atan2(-n,t)+Math.PI/2-S;C.height<0&&(w-=Math.PI);const b=St.getAngle(this.rotation())+w,T=St.getAngle(this.rotationSnapTolerance()),L=dB(C,fB(this.rotationSnaps(),b,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 p=this.centeredScaling()||e.altKey;if(this._movingAnchorName==="top-left"){if(f){const C=p?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-right").x(),y:this.findOne(".bottom-right").y()};r=Math.sqrt(Math.pow(C.x-o.x(),2)+Math.pow(C.y-o.y(),2));const S=this.findOne(".top-left").x()>C.x?-1:1,w=this.findOne(".top-left").y()>C.y?-1:1;t=r*this.cos*S,n=r*this.sin*w,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=p?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-left").x(),y:this.findOne(".bottom-left").y()};r=Math.sqrt(Math.pow(o.x()-C.x,2)+Math.pow(C.y-o.y(),2));const S=this.findOne(".top-right").x()<C.x?-1:1,w=this.findOne(".top-right").y()>C.y?-1:1;t=r*this.cos*S,n=r*this.sin*w,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=p?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-right").x(),y:this.findOne(".top-right").y()};r=Math.sqrt(Math.pow(C.x-o.x(),2)+Math.pow(o.y()-C.y,2));const S=C.x<o.x()?-1:1,w=o.y()<C.y?-1:1;t=r*this.cos*S,n=r*this.sin*w,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=p?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-left").x(),y:this.findOne(".top-left").y()};r=Math.sqrt(Math.pow(o.x()-C.x,2)+Math.pow(o.y()-C.y,2));const S=this.findOne(".bottom-right").x()<C.x?-1:1,w=this.findOne(".bottom-right").y()<C.y?-1:1;t=r*this.cos*S,n=r*this.sin*w,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(p=this.centeredScaling()||e.altKey,p){const C=this.findOne(".top-left"),S=this.findOne(".bottom-right"),w=C.x(),b=C.y(),T=this.getWidth()-S.x(),L=this.getHeight()-S.y();S.move({x:-w,y:-b}),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:St.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();Lb--,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(De._inRange(e.width,-this.padding()*2-r,r)){this.update();return}if(De._inRange(e.height,-this.padding()*2-r,r)){this.update();return}const o=new as;if(o.rotate(St.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:De.warn("boundBoxFunc returned falsy. You should return new bound rect from it!")}const i=1e7,s=new as;s.translate(n.x,n.y),s.rotate(n.rotation),s.scale(n.width/i,n.height/i);const a=new as,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 p;if(!f.getStage())return;const g=f.getParent().getAbsoluteTransform(),m=f.getTransform().copy();m.translate(f.offsetX(),f.offsetY());const v=new as;v.multiply(g.copy().invert()).multiply(d).multiply(g).multiply(m);const k=v.decompose();f.setAttrs(k),(p=f.getLayer())===null||p===void 0||p.batchDraw()}),this.rotation(De._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(De._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=De.degToRad(c),p=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)),p<0?k=Math.min(k,-m/p):p>0&&(k=Math.min(k,(n-m)/p));const C=m+p*k,S=v+g*k,w=De._sign(r);this._batchChangeChild(".rotater",{x:C+p*d*w,y:S+g*d*w-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 b=this.anchorStyleFunc();b&&l.forEach(T=>{b(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=""),Wu.prototype.destroy.call(this),this.detach(),this._removeEvents(),this}add(...e){return this._elementsCreated?(De.error("You cannot add external nodes to the Transformer. Use tr.nodes([node]) instead."),this):super.add(...e)}toObject(){return _t.prototype.toObject.call(this)}clone(e){return _t.prototype.clone.call(this,e)}getClientRect(){return this.nodes().length>0?super.getClientRect():{x:0,y:0,width:0,height:0}}};Ln.isTransforming=()=>Lb>0;function hB(e){return e instanceof Array||De.warn("enabledAnchors value should be an array"),e instanceof Array&&e.forEach(function(t){Em.indexOf(t)===-1&&De.warn("Unknown anchor name: "+t+". Available names are: "+Em.join(", "))}),e||[]}Ln.prototype.className="Transformer",Ir(Ln),me.addGetterSetter(Ln,"enabledAnchors",Em,hB),me.addGetterSetter(Ln,"flipEnabled",!0,ls()),me.addGetterSetter(Ln,"resizeEnabled",!0),me.addGetterSetter(Ln,"anchorSize",10,yt()),me.addGetterSetter(Ln,"rotateEnabled",!0),me.addGetterSetter(Ln,"rotateLineVisible",!0),me.addGetterSetter(Ln,"rotationSnaps",[]),me.addGetterSetter(Ln,"rotateAnchorOffset",50,yt()),me.addGetterSetter(Ln,"rotateAnchorAngle",0,yt()),me.addGetterSetter(Ln,"rotateAnchorCursor","crosshair"),me.addGetterSetter(Ln,"rotationSnapTolerance",5,yt()),me.addGetterSetter(Ln,"borderEnabled",!0),me.addGetterSetter(Ln,"anchorStroke","rgb(0, 161, 255)"),me.addGetterSetter(Ln,"anchorStrokeWidth",1,yt()),me.addGetterSetter(Ln,"anchorFill","white"),me.addGetterSetter(Ln,"anchorCornerRadius",0,yt()),me.addGetterSetter(Ln,"borderStroke","rgb(0, 161, 255)"),me.addGetterSetter(Ln,"borderStrokeWidth",1,yt()),me.addGetterSetter(Ln,"borderDash"),me.addGetterSetter(Ln,"keepRatio",!0),me.addGetterSetter(Ln,"shiftBehavior","default"),me.addGetterSetter(Ln,"centeredScaling",!1),me.addGetterSetter(Ln,"ignoreStroke",!1),me.addGetterSetter(Ln,"padding",0,yt()),me.addGetterSetter(Ln,"nodes"),me.addGetterSetter(Ln,"node"),me.addGetterSetter(Ln,"boundBoxFunc"),me.addGetterSetter(Ln,"anchorDragBoundFunc"),me.addGetterSetter(Ln,"anchorStyleFunc"),me.addGetterSetter(Ln,"shouldOverdrawWholeArea",!1),me.addGetterSetter(Ln,"useSingleNodeRotation",!0),me.backCompat(Ln,{lineEnabled:"borderEnabled",rotateHandlerOffset:"rotateAnchorOffset",enabledHandlers:"enabledAnchors"});var Va=class extends gt{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.radius(),0,St.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)}};Va.prototype.className="Wedge",Va.prototype._centroid=!0,Va.prototype._attrsAffectingSize=["radius"],Ir(Va),me.addGetterSetter(Va,"radius",0,yt()),me.addGetterSetter(Va,"angle",0,yt()),me.addGetterSetter(Va,"clockwise",!1),me.backCompat(Va,{angleDeg:"angle",getAngleDeg:"getAngle",setAngleDeg:"setAngle"});function wA(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}var pB=[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],mB=[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 gB(e,t){const n=e.data,r=e.width,o=e.height;let i,s,a,l,c,d,f,p,g,m,v,k,C,S,w,b,T,L,N,H;const z=t+t+1,B=r-1,Z=o-1,R=t+1,K=R*(R+1)/2,x=new wA,W=pB[t],$=mB[t];let ee=null,Q=x,X=null,we=null;for(let ce=1;ce<z;ce++)Q=Q.next=new wA,ce===R&&(ee=Q);Q.next=x,a=s=0;for(let ce=0;ce<o;ce++){k=C=S=w=l=c=d=f=0,p=R*(b=n[s]),g=R*(T=n[s+1]),m=R*(L=n[s+2]),v=R*(N=n[s+3]),l+=K*b,c+=K*T,d+=K*L,f+=K*N,Q=x;for(let be=0;be<R;be++)Q.r=b,Q.g=T,Q.b=L,Q.a=N,Q=Q.next;for(let be=1;be<R;be++)i=s+((B<be?B:be)<<2),l+=(Q.r=b=n[i])*(H=R-be),c+=(Q.g=T=n[i+1])*H,d+=(Q.b=L=n[i+2])*H,f+=(Q.a=N=n[i+3])*H,k+=b,C+=T,S+=L,w+=N,Q=Q.next;X=x,we=ee;for(let be=0;be<r;be++)n[s+3]=N=f*W>>$,N!==0?(N=255/N,n[s]=(l*W>>$)*N,n[s+1]=(c*W>>$)*N,n[s+2]=(d*W>>$)*N):n[s]=n[s+1]=n[s+2]=0,l-=p,c-=g,d-=m,f-=v,p-=X.r,g-=X.g,m-=X.b,v-=X.a,i=a+((i=be+t+1)<B?i:B)<<2,k+=X.r=n[i],C+=X.g=n[i+1],S+=X.b=n[i+2],w+=X.a=n[i+3],l+=k,c+=C,d+=S,f+=w,X=X.next,p+=b=we.r,g+=T=we.g,m+=L=we.b,v+=N=we.a,k-=b,C-=T,S-=L,w-=N,we=we.next,s+=4;a+=r}for(let ce=0;ce<r;ce++){C=S=w=k=c=d=f=l=0,s=ce<<2,p=R*(b=n[s]),g=R*(T=n[s+1]),m=R*(L=n[s+2]),v=R*(N=n[s+3]),l+=K*b,c+=K*T,d+=K*L,f+=K*N,Q=x;for(let ve=0;ve<R;ve++)Q.r=b,Q.g=T,Q.b=L,Q.a=N,Q=Q.next;let be=r;for(let ve=1;ve<=t;ve++)s=be+ce<<2,l+=(Q.r=b=n[s])*(H=R-ve),c+=(Q.g=T=n[s+1])*H,d+=(Q.b=L=n[s+2])*H,f+=(Q.a=N=n[s+3])*H,k+=b,C+=T,S+=L,w+=N,Q=Q.next,ve<Z&&(be+=r);s=ce,X=x,we=ee;for(let ve=0;ve<o;ve++)i=s<<2,n[i+3]=N=f*W>>$,N>0?(N=255/N,n[i]=(l*W>>$)*N,n[i+1]=(c*W>>$)*N,n[i+2]=(d*W>>$)*N):n[i]=n[i+1]=n[i+2]=0,l-=p,c-=g,d-=m,f-=v,p-=X.r,g-=X.g,m-=X.b,v-=X.a,i=ce+((i=ve+R)<Z?i:Z)*r<<2,l+=k+=X.r=n[i],c+=C+=X.g=n[i+1],d+=S+=X.b=n[i+2],f+=w+=X.a=n[i+3],X=X.next,p+=b=we.r,g+=T=we.g,m+=L=we.b,v+=N=we.a,k-=b,C-=T,S-=L,w-=N,we=we.next,s+=r}}var vB=function(t){const n=Math.round(this.blurRadius());n>0&&gB(t,n)};me.addGetterSetter(_t,"blurRadius",0,yt(),me.afterSetFilter);var yB=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};me.addGetterSetter(_t,"brightness",0,yt(),me.afterSetFilter);var bB=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)},wB=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};me.addGetterSetter(_t,"contrast",0,yt(),me.afterSetFilter);var CB=function(e){var t,n,r,o,i,s,a,l,c;const d=e.data,f=e.width,p=e.height,g=Math.min(1,Math.max(0,(n=(t=this.embossStrength)===null||t===void 0?void 0:t.call(this))!==null&&n!==void 0?n:.5)),m=Math.min(1,Math.max(0,(o=(r=this.embossWhiteLevel)===null||r===void 0?void 0:r.call(this))!==null&&o!==void 0?o:.5)),v=(a={"top-left":315,top:270,"top-right":225,right:180,"bottom-right":135,bottom:90,"bottom-left":45,left:0}[(s=(i=this.embossDirection)===null||i===void 0?void 0:i.call(this))!==null&&s!==void 0?s:"top-left"])!==null&&a!==void 0?a:315,k=!!((c=(l=this.embossBlend)===null||l===void 0?void 0:l.call(this))!==null&&c!==void 0&&c),C=g*10,S=m*255,w=v*Math.PI/180,b=Math.cos(w),T=Math.sin(w),L=128/1020*C,N=new Uint8ClampedArray(d),H=new Float32Array(f*p);for(let K=0,x=0;x<d.length;x+=4,K++)H[K]=.2126*N[x]+.7152*N[x+1]+.0722*N[x+2];const z=[-1,0,1,-2,0,2,-1,0,1],B=[-1,-2,-1,0,0,0,1,2,1],Z=[-f-1,-f,-f+1,-1,0,1,f-1,f,f+1],R=K=>K<0?0:K>255?255:K;for(let K=1;K<p-1;K++)for(let x=1;x<f-1;x++){const W=K*f+x;let $=0,ee=0;$+=H[W+Z[0]]*z[0],ee+=H[W+Z[0]]*B[0],$+=H[W+Z[1]]*z[1],ee+=H[W+Z[1]]*B[1],$+=H[W+Z[2]]*z[2],ee+=H[W+Z[2]]*B[2],$+=H[W+Z[3]]*z[3],ee+=H[W+Z[3]]*B[3],$+=H[W+Z[5]]*z[5],ee+=H[W+Z[5]]*B[5],$+=H[W+Z[6]]*z[6],ee+=H[W+Z[6]]*B[6],$+=H[W+Z[7]]*z[7],ee+=H[W+Z[7]]*B[7],$+=H[W+Z[8]]*z[8],ee+=H[W+Z[8]]*B[8];const Q=R(S+(b*$+T*ee)*L),X=W*4;if(k){const we=Q-S;d[X]=R(N[X]+we),d[X+1]=R(N[X+1]+we),d[X+2]=R(N[X+2]+we),d[X+3]=N[X+3]}else d[X]=d[X+1]=d[X+2]=Q,d[X+3]=N[X+3]}for(let K=0;K<f;K++){let x=K*4,W=((p-1)*f+K)*4;d[x]=N[x],d[x+1]=N[x+1],d[x+2]=N[x+2],d[x+3]=N[x+3],d[W]=N[W],d[W+1]=N[W+1],d[W+2]=N[W+2],d[W+3]=N[W+3]}for(let K=1;K<p-1;K++){let x=K*f*4,W=(K*f+(f-1))*4;d[x]=N[x],d[x+1]=N[x+1],d[x+2]=N[x+2],d[x+3]=N[x+3],d[W]=N[W],d[W+1]=N[W+1],d[W+2]=N[W+2],d[W+3]=N[W+3]}return e};me.addGetterSetter(_t,"embossStrength",.5,yt(),me.afterSetFilter),me.addGetterSetter(_t,"embossWhiteLevel",.5,yt(),me.afterSetFilter),me.addGetterSetter(_t,"embossDirection","top-left",void 0,me.afterSetFilter),me.addGetterSetter(_t,"embossBlend",!1,void 0,me.afterSetFilter);function Mb(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 kB=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 p=this.enhance();if(p===0)return;for(let w=0;w<n;w+=4)i=t[w+0],i<r?r=i:i>o&&(o=i),l=t[w+1],l<s?s=l:l>a&&(a=l),f=t[w+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,S;if(p>0)g=o+p*(255-o),m=r-p*(r-0),v=a+p*(255-a),k=s-p*(s-0),C=d+p*(255-d),S=c-p*(c-0);else{const w=(o+r)*.5;g=o+p*(o-w),m=r+p*(r-w);const b=(a+s)*.5;v=a+p*(a-b),k=s+p*(s-b);const T=(d+c)*.5;C=d+p*(d-T),S=c+p*(c-T)}for(let w=0;w<n;w+=4)t[w+0]=Mb(t[w+0],r,o,m,g),t[w+1]=Mb(t[w+1],s,a,k,v),t[w+2]=Mb(t[w+2],c,d,S,C)};me.addGetterSetter(_t,"enhance",0,yt(),me.afterSetFilter);var SB=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}};me.addGetterSetter(_t,"hue",0,yt(),me.afterSetFilter),me.addGetterSetter(_t,"saturation",0,yt(),me.afterSetFilter),me.addGetterSetter(_t,"luminance",0,yt(),me.afterSetFilter);var _B=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,p=.299*r-.299*a-.328*l,g=.587*r+.413*a+.035*l,m=.114*r-.114*a+.293*l,v=.299*r-.3*a+1.25*l,k=.587*r-.586*a-1.05*l,C=.114*r+.886*a-.2*l;let S,w,b,T;for(let L=0;L<n;L+=4)S=t[L+0],w=t[L+1],b=t[L+2],T=t[L+3],t[L+0]=c*S+d*w+f*b+s,t[L+1]=p*S+g*w+m*b+s,t[L+2]=v*S+k*w+C*b+s,t[L+3]=T},AB=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,p=.587*r+.413*s+.035*a,g=.114*r-.114*s+.293*a,m=.299*r-.3*s+1.25*a,v=.587*r-.586*s-1.05*a,k=.114*r+.886*s-.2*a;for(let C=0;C<n;C+=4){const S=t[C+0],w=t[C+1],b=t[C+2],T=t[C+3];t[C+0]=l*S+c*w+d*b,t[C+1]=f*S+p*w+g*b,t[C+2]=m*S+v*w+k*b,t[C+3]=T}};me.addGetterSetter(_t,"hue",0,yt(),me.afterSetFilter),me.addGetterSetter(_t,"saturation",0,yt(),me.afterSetFilter),me.addGetterSetter(_t,"value",0,yt(),me.afterSetFilter);var IB=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]},EB=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 p=Math.sqrt(d*d+f*f);c=p>c?p: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),S=Math.cos(k*v);for(let w=0;w<g;w+=1){d=Math.floor(a+c*w/g*S),f=Math.floor(l+c*w/g*C);let b=(f*i+d)*4;const T=r[b+0],L=r[b+1],N=r[b+2],H=r[b+3];b=(k+w*i)*4,o[b+0]=T,o[b+1]=L,o[b+2]=N,o[b+3]=H}}},TB=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 p=Math.sqrt(d*d+f*f);c=p>c?p: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 S=d-a,w=f-l,b=Math.sqrt(S*S+w*w)*g/c;let T=(Math.atan2(w,S)*180/Math.PI+360+v)%360;T=T*m/360,k=Math.floor(T),C=Math.floor(b);let L=(C*i+k)*4;const N=r[L+0],H=r[L+1],z=r[L+2],B=r[L+3];L=(f*i+d)*4,o[L+0]=N,o[L+1]=H,o[L+2]=z,o[L+3]=B}},xB=function(e){const t=e.width,n=e.height;let r,o,i,s,a,l,c,d,f,p,g=Math.round(this.kaleidoscopePower());const m=Math.round(this.kaleidoscopeAngle()),v=Math.floor(t*(m%360)/360);if(g<1)return;const k=De.createCanvasElement();k.width=t,k.height=n;const C=k.getContext("2d").getImageData(0,0,t,n);De.releaseCanvas(k),EB(e,C,{polarCenterX:t/2,polarCenterY:n/2});let S=t/Math.pow(2,g);for(;S<=8;)S=S*2,g-=1;S=Math.ceil(S);let w=S,b=0,T=w,L=1;for(v+S>t&&(b=w,T=0,L=-1),o=0;o<n;o+=1)for(r=b;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],p=(t*o+r)*4,C.data[p+0]=a,C.data[p+1]=l,C.data[p+2]=c,C.data[p+3]=d;for(o=0;o<n;o+=1)for(w=Math.floor(S),s=0;s<g;s+=1){for(r=0;r<w+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],p=(t*o+w*2-r-1)*4,C.data[p+0]=a,C.data[p+1]=l,C.data[p+2]=c,C.data[p+3]=d;w*=2}TB(C,e,{polarRotation:0})};me.addGetterSetter(_t,"kaleidoscopePower",2,yt(),me.afterSetFilter),me.addGetterSetter(_t,"kaleidoscopeAngle",0,yt(),me.afterSetFilter);function Tm(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 sh(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 RB(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 LB(e,t){const n=Tm(e,0,0),r=Tm(e,e.width-1,0),o=Tm(e,0,e.height-1),i=Tm(e,e.width-1,e.height-1),s=t||10;if(sh(n,r)<s&&sh(r,i)<s&&sh(i,o)<s&&sh(o,n)<s){const a=RB([r,n,i,o]),l=[];for(let c=0;c<e.width*e.height;c++)l[c]=sh(a,[e.data[c*4],e.data[c*4+1],e.data[c*4+2]])<s?0:255;return l}}function MB(e,t){for(let n=0;n<e.width*e.height;n++)e.data[4*n+3]=t[n]}function DB(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 p=0;p<o;p++){const g=a+f-i,m=l+p-i;if(g>=0&&g<n&&m>=0&&m<t){const v=g*t+m,k=r[f*o+p];d+=e[v]*k}}s[c]=d===2040?255:0}return s}function OB(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 p=0;p<o;p++){const g=a+f-i,m=l+p-i;if(g>=0&&g<n&&m>=0&&m<t){const v=g*t+m,k=r[f*o+p];d+=e[v]*k}}s[c]=d>=1020?255:0}return s}function PB(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 p=0;p<o;p++){const g=a+f-i,m=l+p-i;if(g>=0&&g<n&&m>=0&&m<t){const v=g*t+m,k=r[f*o+p];d+=e[v]*k}}s[c]=d}return s}var FB=function(e){let t=LB(e,this.threshold());return t&&(t=DB(t,e.width,e.height),t=OB(t,e.width,e.height),t=PB(t,e.width,e.height),MB(e,t)),e};me.addGetterSetter(_t,"threshold",0,yt(),me.afterSetFilter);var NB=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()};me.addGetterSetter(_t,"noise",.2,yt(),me.afterSetFilter);var BB=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){De.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,p=0;const g=a*t,m=g+t,v=l*t,k=v+t;let C=0;for(let S=g;S<m;S+=1)if(!(S>=n))for(let w=v;w<k;w+=1){if(w>=r)continue;const b=(n*w+S)*4;c+=s[b+0],d+=s[b+1],f+=s[b+2],p+=s[b+3],C+=1}c=c/C,d=d/C,f=f/C,p=p/C;for(let S=g;S<m;S+=1)if(!(S>=n))for(let w=v;w<k;w+=1){if(w>=r)continue;const b=(n*w+S)*4;s[b+0]=c,s[b+1]=d,s[b+2]=f,s[b+3]=p}}};me.addGetterSetter(_t,"pixelSize",8,yt(),me.afterSetFilter);var zB=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};me.addGetterSetter(_t,"levels",.5,yt(),me.afterSetFilter);var VB=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]}};me.addGetterSetter(_t,"red",0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)}),me.addGetterSetter(_t,"green",0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)}),me.addGetterSetter(_t,"blue",0,C4,me.afterSetFilter);var jB=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}};me.addGetterSetter(_t,"red",0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)}),me.addGetterSetter(_t,"green",0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)}),me.addGetterSetter(_t,"blue",0,C4,me.afterSetFilter),me.addGetterSetter(_t,"alpha",1,function(e){return this._filterUpToDate=!1,e>1?1:e<0?0:e});var UB=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)}},HB=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},$B=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};me.addGetterSetter(_t,"threshold",.5,yt(),me.afterSetFilter);var GB=Q4.Util._assign(Q4,{Arc:Ba,Arrow:Ac,Circle:qu,Ellipse:Rl,Image:cs,Label:Tb,Tag:Ic,Line:za,Path:Hi,Rect:rh,RegularPolygon:Ll,Ring:Ec,Sprite:$s,Star:Ml,Text:cr,TextPath:oo,Transformer:Ln,Wedge:Va,Filters:{Blur:vB,Brightness:bB,Brighten:yB,Contrast:wB,Emboss:CB,Enhance:kB,Grayscale:SB,HSL:_B,HSV:AB,Invert:IB,Kaleidoscope:xB,Mask:FB,Noise:NB,Pixelate:BB,Posterize:zB,RGB:VB,RGBA:jB,Sepia:UB,Solarize:HB,Threshold:$B}}),WB=GB;Rt();var KB=["dialog","floating"],CA=["top-right","top-left","bottom-right","bottom-left","top-center","bottom-center"];function qB(e){if(!e||typeof e!="object")throw new Error("SurfaceManager: request must be a non-null object.");if(!KB.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&&!CA.includes(e.floating.placement))throw new Error(`SurfaceManager: floating.placement must be one of ${CA.join(", ")}, got "${e.floating.placement}".`)}var YB=class{activeDialog=$r(null);activeFloating=$r(null);#e=!1;#n=1;#t;constructor({getModuleConfig:e}){this.#t=e}open(e){if(this.#e)return this.#c(e);qB(e);const t=this.#d(e),{component:n,props:r,render:o}=this.#u(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",p=this[f].value;return p&&!p.settled&&p.settle({status:"replaced",replacedBy:t.id}),this[f].value=l,{id:t.id,mode:t.mode,close:g=>this.#o(l,g),result:a}}close(e,t){if(e!=null){const o=this.#s(e);o&&this.#o(o,t);return}const n=this.activeDialog.value;if(n&&!n.settled){this.#o(n,t);return}const r=this.activeFloating.value;r&&!r.settled&&this.#o(r,t)}settleAll(e){for(const t of[this.activeDialog,this.activeFloating]){const n=t.value;n&&!n.settled&&n.settle(e),t.value=null}}destroy(){this.#e=!0,this.settleAll({status:"destroyed"})}#o(e,t){e.settled||(e.settle({status:"closed",reason:t}),this.#i(e))}#i(e){const t=e.mode==="dialog"?this.activeDialog:this.activeFloating;t.value===e&&(t.value=null)}#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}}#u(e){if("component"in e&&e.component!=null)return{component:e.component,props:e.props};if("render"in e&&typeof e.render=="function")return{render:e.render};const t=this.#t()?.resolver;if(typeof t=="function"){const n=t(e);if(n!=null){if(n.type==="none")throw new Error(`SurfaceManager: resolver explicitly suppressed surface for kind "${e.kind}".`);if(n.type==="custom")return{component:n.component,props:n.props};if(n.type==="external")return{render:n.render}}}throw new Error(`SurfaceManager: no renderer resolved for kind "${e.kind}". Provide a resolver via surfaces.resolver, or use a direct-render request.`)}#c(e){return{id:e?.id??`surface-${this.#n++}`,mode:e?.mode??"dialog",close:()=>{},result:Promise.resolve({status:"destroyed"})}}},XB="https://docs.superdoc.dev/guides/migration/document-api",kA=new Set;function ZB(e,t){kA.has(e)||(kA.add(e),console.warn(t))}var QB={state:"editor.state",view:"editor.view",schema:"editor.schema",commands:"editor.commands",chain:"editor.chain()",can:"editor.can()",dispatch:"editor.dispatch()"},SA=Symbol.for("superdoc:rawEditor"),_A=new WeakMap;function AA(e){return!e||e[SA]?e:new Proxy(e,{get(t,n){if(n===SA)return t;const r=QB[n];r&&ZB(`deprecated:${String(n)}`,`[SuperDoc] ${r} is deprecated and will be removed in a future version. Use the Document API (editor.doc) instead. See ${XB}`);const o=Reflect.get(t,n,t);if(typeof o=="function"){let i=_A.get(t);return i||(i=new Map,_A.set(t,i)),i.has(n)||i.set(n,o.bind(t)),i.get(n)}return o}})}var IA=["review","original","final","off"],JB=["original","markup","final"],ez=["paired","independent"],EA=Symbol.for("@superdoc/trackChanges:normalized"),TA=new Set;function xm(e,t){TA.has(e)||(TA.add(e),console.warn(`[SuperDoc] ${e} is deprecated β use ${t} instead.`))}function xA(e,t,n){return typeof e=="boolean"?e:typeof t=="boolean"?t:n}function tz(e,t,n){return typeof e=="string"&&IA.includes(e)?e:typeof t=="string"&&IA.includes(t)?t:n}function nz(e){return typeof e!="string"||!JB.includes(e)?null:e}function rz(e){return e==="markup"?"review":e}function oz(e){return typeof e=="string"&&ez.includes(e)?e:null}function ja(e){return!e||typeof e!="object"||Array.isArray(e)?null:e}function Db(e){const t=e[EA]===!0,n=ja(e.viewing),r=nz(n?.trackedChanges);ja(e.modules)||(e.modules={});const o=ja(e.modules.trackChanges),i=ja(e.trackChanges),s=ja(e.layoutEngineOptions?.trackedChanges);t||(i&&xm("config.trackChanges","config.viewing.trackedChanges"),s&&xm("config.layoutEngineOptions.trackedChanges","config.viewing.trackedChanges for display and config.modules.trackChanges for behavior"),o&&Object.prototype.hasOwnProperty.call(o,"visible")&&xm("config.modules.trackChanges.visible","config.viewing.trackedChanges"),o&&Object.prototype.hasOwnProperty.call(o,"mode")&&xm("config.modules.trackChanges.mode","config.viewing.trackedChanges"));const a=r?r==="markup":xA(o?.visible,i?.visible,!1),l=xA(o?.enabled,s?.enabled,!0),c=oz(o?.replacements)??"paired",d=ja(o?.authorColors)?o.authorColors:void 0,f=ja(o?.semanticColors)?o.semanticColors:void 0,p=e.documentMode==="viewing",g=p?a?"review":"original":"review",m=r?p?rz(r):"review":tz(o?.mode,s?.mode,g),v={visible:a,mode:m,enabled:l,replacements:c};return d&&(v.authorColors=d),f&&(v.semanticColors=f),e.modules.trackChanges=v,e.trackChanges={visible:a},ja(e.layoutEngineOptions)||(e.layoutEngineOptions={}),e.layoutEngineOptions.trackedChanges={mode:m,enabled:l},typeof n?.comments=="boolean"&&(ja(e.comments)||(e.comments={}),e.comments.visible=n.comments),Object.defineProperty(e,EA,{value:!0,writable:!0,configurable:!0,enumerable:!1}),v}var Ob=Object.freeze({id:null,name:"Default SuperDoc user",email:null});function iz(e){return!e||typeof e!="object"?{...Ob}:{...Ob,...e}}var Rm=Object.freeze({"font-family":"fontFamily","font-size":"fontSize",strikethrough:"strike","highlight-color":"highlight","text-color":"color","table-of-contents":"tableOfContents","table-actions":"tableActions","text-align":"textAlign","bullet-list":"list","numbered-list":"numberedlist","indent-decrease":"indentleft","indent-increase":"indentright","line-height":"lineHeight","linked-style":"linkedStyles","measurement-unit":"measurementUnit","formatting-marks":"formattingMarks","copy-format":"copyFormat","clear-formatting":"clearFormatting","document-mode":"documentMode","track-changes-accept-selection":"acceptTrackedChangeBySelection","track-changes-reject-selection":"rejectTrackedChangeOnSelection"}),RA=Object.freeze({toolbar:!0,comments:!0,contextMenu:!0,loading:!0,search:!1,linkPopover:!1,ruler:!1,contentControls:!0}),sz=Object.freeze(["left","center","right"]),az=Object.freeze({compact:32,default:80,wide:120}),mW=Object.freeze(Object.keys(RA)),Zr=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function LA(e,t){const n=e?.[t];return n===!1?!1:n===void 0?RA[t]:!0}function lz(e,t){const n=e?.[t];return Zr(n)?n:{}}var MA=Object.freeze(["level","readOnly","allowResolve","permissionResolver"]);function cz(e){if(!MA.some(n=>n in e))return e;const t={...e};for(const n of MA)delete t[n];return t}function DA(e){const t={...e},n=Il(e.sections,e.customItems),r=Il(e.defaultItems,e.includeDefaultItems);return delete t.customItems,delete t.includeDefaultItems,Jo(t,{sections:n,defaultItems:r})}var OA=Object.freeze({findPlaceholder:"findPlaceholder",findAriaLabel:"findAriaLabel",replacePlaceholder:"replacePlaceholder",replaceAriaLabel:"replaceAriaLabel",noResults:"noResultsLabel",previousMatchTitle:"previousMatchLabel",previousMatchAriaLabel:"previousMatchAriaLabel",nextMatchTitle:"nextMatchLabel",nextMatchAriaLabel:"nextMatchAriaLabel",closeTitle:"closeLabel",closeAriaLabel:"closeAriaLabel",replace:"replaceLabel",replaceAll:"replaceAllLabel",toggleReplaceTitle:"toggleReplaceLabel",toggleReplaceAriaLabel:"toggleReplaceAriaLabel",matchCase:"matchCaseLabel",matchCaseAriaLabel:"matchCaseAriaLabel",ignoreDiacritics:"ignoreDiacriticsLabel",ignoreDiacriticsAriaLabel:"ignoreDiacriticsAriaLabel",regex:"regexLabel",regexAriaLabel:"regexAriaLabel",invalidPattern:"invalidPatternLabel"});function uz(e){return Zr(e)?Object.fromEntries(Object.entries(e).filter(([t,n])=>OA[t]!==void 0&&n!==void 0).map(([t,n])=>[OA[t],n])):{}}function PA(e){const t={...e};return delete t.strings,delete t.replaceControls,delete t.includeTrackedDeletions,Jo(t,uz(e.strings),{replaceEnabled:Il(e.replaceControls,e.replaceEnabled),includeDeletedText:Il(e.includeTrackedDeletions,e.includeDeletedText)})}var dz=Object.freeze({"text-color":"color","table-of-contents":"tableOfContents","align-left":"alignLeft","align-right":"alignRight","align-center":"alignCenter","align-justify":"alignJustify","bullet-list":"bulletList","numbered-list":"numberedList","indent-decrease":"indentLeft","indent-increase":"indentRight","copy-format":"copyFormat","clear-formatting":"clearFormatting","track-changes-accept-selection":"trackChangesAccept","track-changes-reject-selection":"trackChangesReject","document-mode":"documentMode","document-mode-editing":"documentEditingMode","document-mode-suggesting":"documentSuggestingMode","document-mode-viewing":"documentViewingMode","highlight-color":"highlight","linked-style":"paintbrush","table-actions":"tableActions","split-cell":"splitCell","merge-cells":"mergeCells","insert-row-before":"addRowBefore","insert-row-after":"addRowAfter","insert-column-before":"addColumnBefore","insert-column-after":"addColumnAfter","delete-row":"deleteRow","delete-column":"deleteColumn","delete-table":"deleteTable","remove-borders":"deleteBorders","fix-tables":"fixTables","line-height":"lineHeight","formatting-marks":"formattingMarks"}),fz=Object.freeze({"font-family":"fontFamily","font-size":"fontSize","highlight-color":"highlight","text-color":"color","table-of-contents":"tableOfContents","table-actions":"tableActions","insert-row-before":"addRowBefore","insert-row-after":"addRowAfter","insert-column-before":"addColumnBefore","insert-column-after":"addColumnAfter","delete-row":"deleteRow","delete-column":"deleteColumn","delete-table":"deleteTable","remove-borders":"removeBorders","merge-cells":"mergeCells","split-cell":"splitCell","fix-tables":"fixTables","text-align":"textAlign","bullet-list":"bulletList","numbered-list":"numberedList","indent-decrease":"indentLeft","indent-increase":"indentRight","measurement-unit":"measurementUnit","track-changes-accept-selection":"trackChangesAccept","track-changes-reject-selection":"trackChangesReject","clear-formatting":"clearFormatting","copy-format":"copyFormat","line-height":"lineHeight","linked-style-label":"formatText","formatting-marks":"formattingMarks","document-mode-editing":"documentEditingMode","document-mode-suggesting":"documentSuggestingMode","document-mode-viewing":"documentViewingMode","document-mode-editing-description":"documentEditingModeDescription","document-mode-suggesting-description":"documentSuggestingModeDescription","document-mode-viewing-description":"documentViewingModeDescription","linked-style":"linkedStyles"});function Lm(e,t){return t[e]??e}function Pb(e,t){if(!Zr(e))return;const n=Object.entries(e),r=n.filter(([i])=>t[i]===void 0),o=n.filter(([i])=>t[i]!==void 0);return Object.fromEntries([...r,...o].map(([i,s])=>[Lm(i,t),s]))}function FA(e){return Array.isArray(e)?e.map(t=>Lm(t,Rm)):e}function NA(e){return Zr(e)?Object.fromEntries(Object.entries(e).map(([t,n])=>[t,FA(n)])):e}function hz(e,t){if(!Zr(e)||!Array.isArray(t))return e;const n={...e};for(const r of t){if(!Zr(r))continue;const o=r.region??"center";n[o]===void 0&&(n[o]=[])}return n}var pz=Object.freeze({"formatting-marks":"right","table-of-contents":"center"});function mz(e,t){if(!Zr(e)||!Array.isArray(t))return e;const n=Object.fromEntries(Object.entries(e).map(([o,i])=>[o,Array.isArray(i)?[...i]:i])),r=new Set(Object.values(n).flatMap(o=>Array.isArray(o)?o:[]).map(o=>Lm(o,Rm)));for(const o of t){const i=Lm(o,Rm);if(r.has(i))continue;const s=pz[o];s&&(Array.isArray(n[s])||(n[s]=[]),n[s].push(o),r.add(i))}return n}function BA(e,t){return hz(mz(e,t.includeItems),t.customItems)}function gz(e){return Array.isArray(e)?e.map(t=>{if(!Zr(t))return t;const{value:n,label:r,previewFamily:o}=t;return{key:n,value:n,label:r,...o?{props:{style:{fontFamily:o}}}:{}}}):e}function vz(e){return Array.isArray(e)?e.map(t=>{if(!Zr(t)||typeof t.id!="string")return t;const n=t.size??"default",r=t.type==="separator"?void 0:az[n],o={...t,name:t.id,group:t.region,isNarrow:n==="compact",isWide:n==="wide",...r?{layoutWidth:r,style:{...t.style,width:`${r-2}px`}}:{}};return t.label&&(o.defaultLabel===void 0&&(o.defaultLabel=t.label),o.attributes={...t.attributes,ariaLabel:t.attributes?.ariaLabel??t.label}),t.type==="dropdown"&&Array.isArray(t.options)&&(o.options=t.options.map(i=>Zr(i)?{...i,key:i.value??i.id,value:i.value??i.id}:i),o.dropdownValueKey="value"),typeof t.onSelect=="function"&&(o.command=({item:i,argument:s,payload:a,...l})=>t.onSelect({...l,value:s})),delete o.id,delete o.region,delete o.size,delete o.onSelect,o}):e}function yz(e){const t={...e},n=Il(e.items,Zr(e.groups)?e.groups:void 0),r=Zr(e.items)&&Object.keys(e.items).length===0?{center:[]}:n,o=BA(r,e),i=o===void 0?e.groups:NA(o),s=Pb(e.icons,dz),a=Jo(Pb(e.texts,{}),Pb(e.strings,fz)),l=Array.isArray(e.includeItems)?new Set(e.includeItems):null,c=Zr(r)?new Set(Object.values(r).flatMap(d=>Array.isArray(d)?d:[])):new Set;return delete t.items,delete t.includeItems,delete t.overflow,delete t.responsiveTo,delete t.fontOptions,delete t.customItems,delete t.strings,Jo(t,{groups:i,excludeItems:FA(e.excludeItems),icons:s,texts:a,hideButtons:e.overflow===void 0?e.hideButtons:e.overflow==="menu",responsiveToContainer:e.responsiveTo===void 0?e.responsiveToContainer:e.responsiveTo==="container",fonts:e.fontOptions===void 0?e.fonts:gz(e.fontOptions),customButtons:e.customItems===void 0?e.customButtons:vz(e.customItems),showFormattingMarksButton:l===null&&!c.has("formatting-marks")?e.showFormattingMarksButton:c.has("formatting-marks")||l?.has("formatting-marks"),showTableOfContentsButton:l===null&&!c.has("table-of-contents")?e.showTableOfContentsButton:c.has("table-of-contents")||l?.has("table-of-contents")})}function zA(e={}){const t=e.ui,n=t===!1,r=Zr(t)?t:void 0,o=K=>!n&&LA(r,K),i=K=>n?!1:r?.[K]===void 0?void 0:LA(r,K),s=K=>n?{}:lz(r,K),a=n||i("ruler")===!1,l=n||i("linkPopover")===!1,c=l?void 0:Il(s("linkPopover").popoverResolver,e.modules?.links?.popoverResolver),d=i("contentControls")??(!n&&e.modules?.contentControls?.chrome!=="none"),f=e.modules?.contentControls?.chrome==="none"?void 0:e.modules?.contentControls?.chrome,p=s("toolbar"),g=yz(p),m=Zr(p.items),v=e.modules?.toolbar,k=Zr(v)?v:{},C=e.modules?.contextMenu??e.modules?.slashMenu,S=Zr(C)?C:{},w=e.modules?.surfaces?.findReplace,b=PA(Zr(w)?w:{}),T=Zr(k.groups)?NA(BA(k.groups,p)):k.groups,L=[g.groups,T],N=L.find(Zr),H=L.find(Array.isArray),z=m?Object.keys(g.groups??{}):Il(H,k.toolbarGroups,e.toolbarGroups),B=Array.isArray(z)?z:null,Z=(K,x)=>Object.prototype.hasOwnProperty.call(K,x),R=N&&B?Object.fromEntries([...B.filter(K=>Z(N,K)),...Object.keys(N).filter(K=>!sz.includes(K))].map(K=>[K,N[K]])):N;return{enabled:!n,toolbar:{enabled:o("toolbar"),container:n?null:Il(g.container,k.selector,e.toolbar)??null,options:n?{}:{...Jo(k,g),groups:R,toolbarGroups:z,icons:Jo(e.toolbarIcons,k.icons,g.icons),texts:Jo(e.toolbarTexts,k.texts,g.texts)}},comments:{enabled:i("comments")??(!n&&e.modules?.comments!==!1),options:n?{}:SS(cz(s("comments")))},contextMenu:{enabled:i("contextMenu")??(!n&&e.disableContextMenu!==!0),suppressed:n||i("contextMenu")===!1,options:n?{}:Jo(DA(S),DA(s("contextMenu")))},loading:{enabled:o("loading")},search:{enabled:i("search")??(!n&&!!e.modules?.surfaces?.findReplace),options:n?{}:Jo(b,PA(s("search")))},linkPopover:{enabled:typeof c=="function",suppressed:l,options:Jo(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?Jo({chrome:f},s("contentControls")):{chrome:"none"}}}}var Mm=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),bz=e=>e==="read"||e==="write"||e==="resolve";function VA(e={}){const t=Mm(e.interaction)?e.interaction:{},n=Mm(t.comments)?t.comments:{},r=Mm(t.trackedChanges)?t.trackedChanges:{},o=Mm(e.modules?.comments)?e.modules.comments:{},i=(n.readOnly??o.readOnly??!1)===!0,s=(n.allowResolve??o.allowResolve??!0)!==!1,a=bz(n.level),l=a?n.level:i?"read":s?"resolve":"write",c=r.allowDecisions;return{comments:{level:l,readOnly:a?l==="read":i,allowResolve:a?l==="resolve":s},trackedChanges:{allowDecisions:typeof c=="boolean"?c:!i}}}var jA=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function UA(e={}){const t=jA(e.surfaces)?e.surfaces:{},n=jA(e.modules?.surfaces)?e.modules.surfaces:{},r=t.resolver===void 0?n.resolver:t.resolver;return{resolver:typeof r=="function"?r:null,dialog:Jo(n.dialog,t.dialog),floating:Jo(n.floating,t.floating)}}var wz=class{#e=new Map;#n=new Map;#t=null;#o=new Set;register(e){if(this.#e.has(e.id))throw new Error(`EditorRuntimeRegistry: duplicate runtime id "${e.id}"`);const t=e.root,n=t?this.#n.get(t):void 0;if(n!==void 0&&n!==e.id)throw new Error(`EditorRuntimeRegistry: root element already registered to runtime "${n}"`);this.#e.set(e.id,e),t&&this.#n.set(t,e.id)}unregister(e){const t=this.#e.get(e);return t?(this.#e.delete(e),t.root&&this.#n.delete(t.root),this.#t===e&&(this.#t=null,this.#i({previousRuntimeId:e,nextRuntimeId:null,reason:"active-runtime-unregistered",legacyEditorProjection:null})),!0):!1}get(e){return this.#e.get(e)??null}getAll(){return Array.from(this.#e.values())}getAllByDocumentId(e){const t=[];for(const n of this.#e.values())n.documentId===e&&t.push(n);return t}getActive(){return this.#t===null?null:this.#e.get(this.#t)}getActiveId(){return this.#t}setActive(e,t){if(e!==null&&!this.#e.has(e))throw new Error(`EditorRuntimeRegistry: cannot activate unknown runtime "${e}"`);if(e===this.#t)return;const n=this.#t;this.#t=e;let r=null;e!==null&&(r=this.#e.get(e).getLegacyEditorProjection?.()??null),this.#i({previousRuntimeId:n,nextRuntimeId:e,reason:t,legacyEditorProjection:r})}resolveFromEventTarget(e){const t=e instanceof Element?e:e instanceof Node?e.parentElement:null;if(!t)return null;const n=t.closest(`[${lm}]`);if(!n)return null;const r=n.getAttribute(lm),o=r?this.get(r):null;return o&&o.root===n?o:null}subscribe(e){return this.#o.add(e),()=>{this.#o.delete(e)}}clear(){this.#e.clear(),this.#n.clear(),this.#t=null,this.#o.clear()}#i(e){for(const t of Array.from(this.#o))try{t(e)}catch{}}},lt={notReady:"not-ready",documentApiUnavailable:"document-api-unavailable",documentReadonly:"document-readonly",trackedChangeDecisionsDisabled:"tracked-change-decisions-disabled",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",permissionDenied:"permission-denied"},HA={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 $A(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 Cz(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 kz(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 GA(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 Fb(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 Sz(e){const t=Fb(e,["alignment","value"]);if(typeof t!="string")return t;const n=t.trim().toLowerCase();return n==="justified"||n==="both"?"justify":n}function _z(e){const t=Fb(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 Az(e){if(e&&typeof e=="object"&&"role"in e)return e;const t=Fb(e,["styleId","value","style"]);return typeof t=="string"?t.trim():t}function Iz(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 Ez=lt.commandUnsupported,Gs=lt.tableContextUnavailable,WA=[{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:$A,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:$A,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:Cz},{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:Iz},{id:"measurement-unit",family:"measurement",disposition:"routed",mutates:!1,instanceRoute:"setMeasurementUnit",valueFrom:"measurementUnit",normalizePayload:kz},{id:"text-color",family:"color",disposition:"routed",mutates:!0,docRoute:"format.color",inline:{key:"color",kind:"value-string"},normalizePayload:GA},{id:"highlight-color",family:"color",disposition:"routed",mutates:!0,docRoute:"format.highlight",inline:{key:"highlight",kind:"value-string"},normalizePayload:GA},{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:Sz},{id:"line-height",family:"paragraph",disposition:"routed",mutates:!0,docRoute:"format.paragraph.setSpacing",blockParagraph:{kind:"spacing-line"},normalizePayload:_z},{id:"linked-style",family:"paragraph",disposition:"routed",mutates:!0,docRoute:"styles.paragraph.setStyle",blockParagraph:{kind:"style"},normalizePayload:Az},{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:Gs},{id:"table-add-row-after",family:"tables",disposition:"routed",mutates:!0,docRoute:"tables.insertRow",table:{action:"insert-row-after",op:"insertRow"},reason:Gs},{id:"table-delete-row",family:"tables",disposition:"routed",mutates:!0,docRoute:"tables.deleteRow",table:{action:"delete-row",op:"deleteRow"},reason:Gs},{id:"table-add-column-before",family:"tables",disposition:"routed",mutates:!0,docRoute:"tables.insertColumn",table:{action:"insert-column-before",op:"insertColumn"},reason:Gs},{id:"table-add-column-after",family:"tables",disposition:"routed",mutates:!0,docRoute:"tables.insertColumn",table:{action:"insert-column-after",op:"insertColumn"},reason:Gs},{id:"table-delete-column",family:"tables",disposition:"routed",mutates:!0,docRoute:"tables.deleteColumn",table:{action:"delete-column",op:"deleteColumn"},reason:Gs},{id:"table-delete",family:"tables",disposition:"routed",mutates:!0,docRoute:"tables.delete",table:{action:"delete-table",op:"delete"},reason:Gs},{id:"table-merge-cells",family:"tables",disposition:"routed",mutates:!0,docRoute:"tables.mergeCells",table:{action:"merge-cells",op:"mergeCells"},reason:Gs},{id:"table-split-cell",family:"tables",disposition:"routed",mutates:!0,docRoute:"tables.splitCell",table:{action:"split-cell",op:"splitCell",requiresCell:!0},reason:Gs},{id:"table-remove-borders",family:"tables",disposition:"routed",mutates:!0,docRoute:"tables.setBorders",table:{action:"remove-borders",op:"setBorders"},reason:Gs},{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:Ez}],Tz=new Map(WA.map(e=>[e.id,e])),xz=WA.map(e=>e.id);function Xu(e){return Tz.get(e)??null}var Rz=["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"],KA=[{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:Rz,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"}],qA=new Map(KA.map(e=>[e.name,e])),Lz=KA.map(e=>e.name);function Nb(e){return qA.get(e)??null}function Mz(e){const t=qA.get(e);return t?.disposition==="controller-routed"?t.commandId:null}var Dz=".png,.jpg,.jpeg,image/png,image/jpeg",YA=new Set(["image/png","image/jpeg","image/jpg"]),Oz=/\.(png|jpe?g)$/i;function Pz(e){if(!e)return!1;const t=typeof e.type=="string"?e.type.toLowerCase():"";return t?YA.has(t):Oz.test(String(e.name??""))}function XA(e){return new Promise((t,n)=>{const r=new FileReader;r.onload=()=>t(Fz(String(r.result),e)),r.onerror=()=>n(r.error??new Error("image-read-failed")),r.readAsDataURL(e)})}function Fz(e,t){const n=/^data:([^;,]*);base64,/.exec(e);if(!n)return e;const r=n[1].toLowerCase();if(YA.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 Nz(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:Bz(n,e)}return XA(e)}async function Bz(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 XA(o?Object.assign(r,{name:o}):r)}function zz({ownerDocument:e=document,onPick:t,onError:n}={}){const r=e.createElement("input");return r.type="file",r.accept=Dz,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(!Pz(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 Vz=(e,t)=>{let n=e.replace(/[^0-9.]/g,"");return n=parseFloat(n),isNaN(n)&&(n=t),n=parseFloat(n),n},jz=(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};Rt(),vn();var Uz={class:"sd-toolbar-icon"},Hz=["innerHTML"],$z={__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(),Me("div",Uz,[He("div",{class:Qt(["sd-toolbar-icon__icon",[`sd-toolbar-icon__icon--${t.name}`]]),innerHTML:e.icon},null,10,Hz),r.value?(ye(),Me("div",{key:0,class:"color-bar",style:bn(n.value)},null,4)):mt("",!0)]))}},ZA=fn($z,[["__scopeId","data-v-d7d79424"]]);Rt(),vn();var Gz=["role","aria-label","aria-disabled"],Wz=["data-item"],Kz=["data-item"],qz={key:1,class:"sd-button-label"},Yz=["data-item","aria-label"],Xz=["innerHTML"],Zz={key:2},Qz=["onKeydown","id"],Jz=["placeholder","onKeydown","id","data-item"],eV=["data-item","innerHTML"],tV={"aria-live":"polite",class:"sd-visually-hidden"},nV={__name:"ToolbarButton",props:{iconColor:{type:String,default:null},active:{type:Boolean,default:!1},isNarrow:{type:Boolean,default:!1},isWide:{type:Boolean,default:!1},toolbarItem:{type:Object,required:!0},defaultLabel:{type:String,default:null},isOverflowItem:{type:Boolean,default:!1},allowEnterPropagation:{type:Boolean,default:!1}},emits:["buttonClick","textSubmit","mainClick"],setup(e,{emit:t}){const n=t,{proxy:r}=vr(),o=e,{name:i,active:s,icon:a,label:l,hideLabel:c,iconColor:d,hasCaret:f,splitButton:p,disabled:g,expand:m,inlineTextInputVisible:v,hasInlineTextInput:k,minWidth:C,style:S,attributes:w}=o.toolbarItem,b=Ce(()=>!!p?.value&&!!f?.value),T=Ce(()=>i?.value??""),L=te(""),N=te(null),{isHighContrastMode:H}=is();Bt(()=>l?.value,Ee=>{document.activeElement!==N.value&&(L.value=Ee==null?"":String(Ee))},{immediate:!0});const z=()=>{k&&kt(()=>{N.value?.focus(),N.value?.select()}),n("buttonClick")},B=Ee=>{g?.value||(Ee?.stopPropagation(),n("mainClick"))},Z=()=>{b.value||z()},R=Ee=>{if(b.value){B(Ee);return}z()},K=Ee=>{o.allowEnterPropagation||Ee.stopPropagation(),R(Ee)},x=Ee=>{const Pe=o.toolbarItem?.nestedOptions?.value??[],Ze=Ee.trim();if(!Ze)return"";const at=Pe.find(Qe=>typeof Qe?.label=="string"&&Qe.label.toLowerCase()===Ze.toLowerCase());return at?.label?at.label:Pe.find(Qe=>typeof Qe?.label=="string"&&Qe.label.toLowerCase().startsWith(Ze.toLowerCase()))?.label??Ze},W=()=>{const Ee=String(L.value??"").trim();let Pe=Ee;if(T.value==="fontSize"){const Ze=Number.parseFloat(Ee);Pe=Ee.match(/^\d+(\.5)?$/)?Ee:Number.isFinite(Ze)?Math.floor(Ze).toString():""}else T.value==="fontFamily"&&(Pe=x(Ee));return Pe?(n("textSubmit",Pe),L.value=Pe,!0):!1},$=Ee=>{const Pe=Ee?.currentTarget;Pe instanceof HTMLInputElement&&(Pe.focus({preventScroll:!0}),Pe.select())},ee=Ee=>{requestAnimationFrame(()=>{const Pe=document.getElementById(`inlineTextInput-${Ee}`);Pe instanceof HTMLInputElement&&(Pe.focus({preventScroll:!0}),Pe.select())})},Q=()=>{const Ee=document.querySelector('[role="textbox"][aria-label*="SuperDoc body"], .ProseMirror');return Ee instanceof HTMLElement?(Ee.focus({preventScroll:!0}),!0):!1},X=()=>{const Ee=r?.$toolbar?.pendingSelectionCapture,Pe=()=>{Ee&&typeof r?.$toolbar?.ui?.selection?.restore=="function"&&r.$toolbar.ui.selection.restore(Ee)};if(Q()){Pe();return}typeof r?.$toolbar?.superdoc?.focus=="function"&&(r.$toolbar.superdoc.focus(),Pe())},we=()=>{W()&&X()},ce=Ee=>{if(W(),Ee.shiftKey){T.value==="fontSize"&&(Ee.preventDefault(),kt(()=>ee("fontFamily")));return}if(Ee.preventDefault(),T.value==="fontFamily"){kt(()=>ee("fontSize"));return}T.value==="fontSize"&&kt(X)},be=Ce(()=>S.value?S.value:{minWidth:o.minWidth}),ve=Ce(()=>m?.value?lr.dropdownCaretUp:lr.dropdownCaretDown);return(Ee,Pe)=>(ye(),Me("div",{class:Qt(["sd-toolbar-item",et(w).className]),style:bn(be.value),role:e.isOverflowItem?"menuitem":"button","aria-label":et(w).ariaLabel,"aria-disabled":et(g)?"true":void 0,"data-sd-part":"toolbar-item",onClick:Z,onKeydown:Pe[9]||(Pe[9]=pi(Ze=>K(Ze),["enter"])),tabindex:"0"},[He("div",{class:Qt(["sd-toolbar-button",{"sd-active":et(s),"sd-disabled":et(g),narrow:e.isNarrow,wide:e.isWide,split:b.value,"has-inline-text-input":et(k),"high-contrast":et(H)}]),"data-item":`btn-${et(i)||""}`},[b.value?(ye(),Me("div",{key:0,class:"sd-toolbar-button__main","data-item":`btn-${et(i)||""}-main`,onClick:Pe[0]||(Pe[0]=Ze=>B(Ze))},[et(a)?(ye(),rn(ZA,{key:0,color:et(d),class:"sd-toolbar-icon",icon:et(a),name:et(i)},null,8,["color","icon","name"])):mt("",!0),et(l)&&!et(c)&&!et(v)?(ye(),Me("div",qz,zt(et(l)),1)):mt("",!0)],8,Kz)):mt("",!0),b.value?(ye(),Me("div",{key:1,class:"sd-toolbar-button__caret","data-item":`btn-${et(i)||""}-caret`,"aria-label":`${et(w).ariaLabel} options`,role:"button"},[He("div",{class:"sd-dropdown-caret",innerHTML:ve.value,style:bn({opacity:et(g)?.6:1})},null,12,Xz)],8,Yz)):(ye(),Me(Kt,{key:2},[et(a)?(ye(),rn(ZA,{key:0,color:et(d),class:"sd-toolbar-icon",icon:et(a),name:et(i)},null,8,["color","icon","name"])):mt("",!0),et(l)&&!et(c)&&(!et(v)||T.value==="fontFamily")?(ye(),Me("div",{key:1,class:Qt(["sd-button-label",{"sd-visually-hidden":et(v)&&T.value==="fontFamily"}])},zt(et(l)),3)):mt("",!0),et(v)?(ye(),Me("span",Zz,[et(i)==="fontSize"?ya((ye(),Me("input",{key:0,"onUpdate:modelValue":Pe[1]||(Pe[1]=Ze=>L.value=Ze),onKeydown:[pi(Zt(we,["stop","prevent"]),["enter"]),Pe[2]||(Pe[2]=pi(Ze=>ce(Ze),["tab"]))],onClick:Pe[3]||(Pe[3]=Zt(Ze=>$(Ze),["stop"])),onFocus:Pe[4]||(Pe[4]=Ze=>$(Ze)),type:"text",class:Qt(["button-text-input button-text-input--font-size",{"high-contrast":et(H)}]),id:"inlineTextInput-"+et(i),autocomplete:"off",ref_key:"inlineInput",ref:N},null,42,Qz)),[[ji,L.value]]):ya((ye(),Me("input",{key:1,"onUpdate:modelValue":Pe[5]||(Pe[5]=Ze=>L.value=Ze),placeholder:et(l),onKeydown:[pi(Zt(we,["stop","prevent"]),["enter"]),Pe[6]||(Pe[6]=pi(Ze=>ce(Ze),["tab"]))],onClick:Pe[7]||(Pe[7]=Zt(Ze=>$(Ze),["stop"])),onFocus:Pe[8]||(Pe[8]=Ze=>$(Ze)),type:"text",class:Qt(["button-text-input",{"button-text-input--font-family":T.value==="fontFamily","high-contrast":et(H)}]),id:"inlineTextInput-"+et(i),"data-item":T.value==="fontFamily"?`btn-${et(i)}-input`:void 0,autocomplete:"off",ref_key:"inlineInput",ref:N},null,42,Jz)),[[ji,L.value]])])):mt("",!0),et(f)?(ye(),Me("div",{key:3,class:"sd-dropdown-caret","data-item":`btn-${et(i)||""}-toggle`,innerHTML:ve.value,style:bn({opacity:et(g)?.6:1})},null,12,eV)):mt("",!0)],64)),He("div",tV,zt(`${et(w).ariaLabel} ${et(s)?"selected":"unset"}`),1)],10,Wz)],46,Gz))}},Bb=fn(nV,[["__scopeId","data-v-22817fa7"]]);Rt(),vn();var rV={class:"toolbar-separator",role:"separator","aria-label":"Toolbar separator"},oV={__name:"ToolbarSeparator",props:{active:{type:Boolean,default:!1}},emits:["command"],setup(e,{emit:t}){const{isHighContrastMode:n}=is(),r=()=>n.value?"#000":"var(--sd-ui-border, #dbdbdb)";return(o,i)=>(ye(),Me("div",rV,[He("div",{class:"separator-inner",style:bn({backgroundColor:r()})},null,4)]))}},iV=fn(oV,[["__scopeId","data-v-cb82253a"]]);Rt(),vn();var sV={class:"toolbar-dropdown"},aV=["onClick"],lV={key:0,class:"toolbar-dropdown-option__icon"},cV={class:"toolbar-dropdown-option__label"},Dm='button, [href], input, select, textarea, [role="button"], [tabindex]:not([tabindex="-1"])',uV={__name:"ToolbarDropdown",props:{options:{type:Array,default:()=>[]},show:{type:Boolean,required:!0},placement:{type:String,default:"bottom-start"},disabled:{type:Boolean,default:!1},contentStyle:{type:Object,default:()=>({})},menuProps:{type:Function,default:null},nodeProps:{type:Function,default:null},closeOnEscape:{type:Boolean,default:!0},hasOpenChild:{type:Boolean,default:!1}},emits:["update:show","select"],setup(e,{emit:t}){const n=e,r=t,o=B1(),i=te(null),s=te(null),a=te({top:"0px",left:"0px",maxHeight:"none"}),l=te([]),c=te(-1),d=Ce(()=>!!n.show),f=te(document.fullscreenElement),p=Ce(()=>d.value&&f.value?f.value:document.body),g=Ce(()=>n.options.some(se=>se?.type==="render")),m=Ce(()=>!!o.menu),v=Ce(()=>typeof n.menuProps!="function"?{}:n.menuProps()||{}),k=Ce(()=>{const{class:se,style:Ie,...Ue}=v.value;return Ue}),C=Ce(()=>["toolbar-dropdown-menu",v.value.class,{"toolbar-dropdown-menu--render-only":m.value||n.options.length>0&&n.options.every(se=>se&&se.type==="render")}]),S=Ce(()=>{const se=v.value.style||{};return{...n.contentStyle,...se}}),w=Ce(()=>({...S.value,position:"fixed",top:a.value.top,left:a.value.left,maxHeight:a.value.maxHeight,zIndex:2e3})),b=se=>{r("update:show",se)},T=()=>{d.value&&b(!1)},L=()=>{if(!i.value)return;const se=i.value.getBoundingClientRect(),Ie=s.value,Ue=Ie?.offsetWidth??0,ne=Ie?.scrollHeight??Ie?.offsetHeight??0,A=window.innerWidth||document.documentElement.clientWidth||0,ie=window.innerHeight||document.documentElement.clientHeight||0,F=8,Y=4,O=se.bottom+Y,V=se.top-Y,oe=Math.max(0,ie-O-F),U=Math.max(0,V-F),G=oe<ne&&U>oe,ge=G?U:oe,Ae=G?Math.max(F,V-(ne?Math.min(ne,ge):ge)):O;let Se=se.left;n.placement==="bottom-end"&&(Se=se.right-Ue);const Te=Math.max(F,A-Ue-F);Se=Math.min(Math.max(F,Se),Te),a.value={top:`${Ae}px`,left:`${Se}px`,maxHeight:`${ge}px`}},N=async()=>{f.value=document.fullscreenElement,d.value&&(await kt(),L())},H=()=>{n.disabled||b(!d.value)},z=se=>typeof n.nodeProps!="function"?{}:n.nodeProps(se)||{},B=se=>{se?.disabled||se?.type!=="render"&&(r("select",se?.key,se),T())},Z=se=>se?.type==="render",R=se=>!se?.disabled&&se?.type!=="render",K=se=>typeof se?.icon=="function"||!!se?.icon,x=se=>typeof se?.icon=="function"?se.icon(se):se?.icon||null,W=se=>se?typeof se=="string"?se.split(/\s+/).includes("sd-selected"):Array.isArray(se)?se.some(W):typeof se=="object"?!!se["sd-selected"]:!1:!1,$=se=>W(se?.props?.class)||W(se?.class),ee=()=>n.options.map((se,Ie)=>R(se)?Ie:-1).filter(se=>se>=0),Q=()=>{const se=n.options.findIndex(Ie=>R(Ie)&&$(Ie));return se>=0?se:ee()[0]??-1},X=(se,Ie)=>{if(!se){delete l.value[Ie];return}l.value[Ie]=se},we=()=>{l.value.forEach((Ie,Ue)=>{Ie&&Ie.setAttribute("tabindex",Ue===c.value?"0":"-1")});const se=l.value[c.value];se&&typeof se.focus=="function"&&(se.focus(),se.scrollIntoView?.({block:"nearest",inline:"nearest"}))},ce=se=>{const Ie=ee();if(!Ie.length){c.value=-1;return}const Ue=Ie.indexOf(c.value);if(Ue<0){c.value=se>0?Ie[0]:Ie[Ie.length-1];return}const ne=(Ue+se+Ie.length)%Ie.length;c.value=Ie[ne]},be=()=>{let se=n.options[c.value];if(!R(se)){const Ie=ee()[0];se=Ie===void 0?null:n.options[Ie]}se&&B(se)},ve=ac({name:"ToolbarDropdownRenderOption",props:{option:{type:Object,required:!0}},setup(se){return()=>typeof se.option.render!="function"?null:se.option.render()}}),Ee=ac({name:"ToolbarDropdownOptionIcon",props:{option:{type:Object,required:!0}},setup(se){return()=>{const Ie=x(se.option);return typeof Ie=="string"?Gr("span",{innerHTML:Ie}):Ie}}}),Pe=se=>{if(!d.value)return;const Ie=se.target;if(!(Ie instanceof Element))return;const Ue=i.value?.contains(Ie),ne=s.value?.contains(Ie);Ue||ne||n.hasOpenChild&&Ie.closest('[data-sd-part="dropdown-menu"]')||T()},Ze=te(null),at=()=>{const se=i.value,Ie=document.activeElement;if(se&&Ie instanceof HTMLElement&&se.contains(Ie)){Ze.value=Ie;return}Ze.value=se?.matches?.(Dm)?se:se?.querySelector(Dm)},Qe=()=>{const se=Ze.value;if(se instanceof HTMLElement&&document.contains(se)){se.focus();return}const Ie=i.value;if(!Ie)return;const Ue=Ie.matches?.(Dm)?Ie:Ie.querySelector(Dm);if(Ue instanceof HTMLElement){Ue.focus();return}Ie.setAttribute("tabindex","-1"),Ie.focus()},At=se=>{if(!d.value)return;const{key:Ie}=se;if(["Escape","ArrowDown","ArrowUp","Enter"].includes(Ie)){if(Ie==="Escape"){if(!n.closeOnEscape)return;se.preventDefault(),T(),kt(()=>{requestAnimationFrame(Qe)});return}if(!(g.value||m.value)){if(se.preventDefault(),Ie==="ArrowDown"){ce(1),we();return}if(Ie==="ArrowUp"){ce(-1),we();return}Ie==="Enter"&&be()}}};return Bt(d,async se=>{if(!se){c.value=-1,l.value=[];return}at(),await kt(),L(),!(g.value||m.value)&&(c.value=Q(),await kt(),we())},{immediate:!0}),Bt(d,se=>{se?(document.addEventListener("pointerdown",Pe,!0),document.addEventListener("keydown",At,!0),window.addEventListener("resize",L),window.addEventListener("scroll",L,!0)):(document.removeEventListener("pointerdown",Pe,!0),document.removeEventListener("keydown",At,!0),window.removeEventListener("resize",L),window.removeEventListener("scroll",L,!0))},{immediate:!0}),zn(()=>{document.addEventListener("fullscreenchange",N)}),fr(()=>{document.removeEventListener("fullscreenchange",N),document.removeEventListener("pointerdown",Pe,!0),document.removeEventListener("keydown",At,!0),window.removeEventListener("resize",L),window.removeEventListener("scroll",L,!0)}),(se,Ie)=>(ye(),Me("div",sV,[He("div",{ref_key:"triggerRef",ref:i,class:"toolbar-dropdown-trigger","data-sd-part":"dropdown-trigger",onClick:H},[uu(se.$slots,"trigger",{},void 0,!0)],512),(ye(),rn(dl,{to:p.value},[qt(mp,{name:"fade-in-scale-up-transition"},{default:co(()=>[d.value?(ye(),Me("div",Ms({key:0,ref_key:"menuRef",ref:s,"data-sd-part":"dropdown-menu",class:C.value,style:w.value},k.value),[m.value?uu(se.$slots,"menu",{key:0},void 0,!0):mt("",!0),(ye(!0),Me(Kt,null,ar(m.value?[]:e.options,(Ue,ne)=>(ye(),Me("div",Ms({key:Ue.key,ref_for:!0,ref:A=>X(A,ne),class:["toolbar-dropdown-option",[Ue.class,Ue.props?.class,{"sd-disabled":Ue.disabled,"sd-render":Z(Ue)}]],tabindex:"-1",onClick:A=>B(Ue)},{ref_for:!0},{...Ue.props,...z(Ue)}),[Z(Ue)?(ye(),rn(et(ve),{key:0,option:Ue},null,8,["option"])):(ye(),Me(Kt,{key:1},[K(Ue)?(ye(),Me("span",lV,[qt(et(Ee),{option:Ue},null,8,["option"])])):mt("",!0),He("span",cV,zt(Ue.label),1)],64))],16,aV))),128))],16)):mt("",!0)]),_:3})],8,["to"]))]))}},QA=fn(uV,[["__scopeId","data-v-764d5fd7"]]),JA=e=>{const t=e?.target;t instanceof Element&&(t.closest('input, textarea, [contenteditable="true"]')||e.preventDefault())},Tc=(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})};Rt(),vn();var dV={__name:"OverflowMenu",props:{toolbarItem:{type:Object,required:!0},overflowItems:{type:Array,required:!0},uiFontFamily:{type:String,default:"Arial, Helvetica, sans-serif"}},emits:["buttonClick","close","command"],setup(e,{emit:t}){const n=t,r=e,o=Ce(()=>r.toolbarItem.expand.value),i=te(!1),s=Ce(()=>({...r.toolbarItem,active:o.value})),a=c=>{if(c!==o.value){if(c){n("buttonClick",r.toolbarItem);return}n("close")}},l=({item:c,argument:d,option:f})=>{n("command",{item:c,argument:d,option:f})};return(c,d)=>(ye(),rn(QA,{class:"overflow-menu","close-on-escape":!i.value,"has-open-child":i.value,"content-style":{width:"200px",padding:"4px 8px",fontFamily:r.uiFontFamily},options:[],placement:"bottom-end",show:o.value,"onUpdate:show":a,"menu-props":()=>({role:"group",class:["overflow-menu_items","sd-toolbar-overflow-menu"]})},{trigger:co(()=>[qt(Bb,{"toolbar-item":s.value},null,8,["toolbar-item"])]),menu:co(()=>[qt(Fm,{class:"superdoc-toolbar-overflow","toolbar-items":e.overflowItems,"ui-font-family":r.uiFontFamily,"from-overflow":"",onMousedown:et(JA),onCommand:l,onDropdownUpdateShow:d[0]||(d[0]=f=>i.value=f)},null,8,["toolbar-items","ui-font-family","onMousedown"])]),_:1},8,["close-on-escape","has-open-child","content-style","show"]))}},fV=fn(dV,[["__scopeId","data-v-975959f9"]]),eI=e=>String(e??"").trim().toLowerCase(),Om=(e,t)=>{const n=eI(e);if(!n)return-1;for(let r=0;r<t.length;r+=1)if(eI(t[r]).startsWith(n))return r;return-1},hV=(e,t,{autocomplete:n=!0}={})=>{const r=String(e??""),o=Om(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}},pV=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},mV=e=>e<=31||e===127,gV=e=>e===32||e===160||e===65279,vV=e=>Array.from(String(e)).filter(t=>!mV(t.charCodeAt(0))).join(""),yV=e=>{let t="",n=!1;for(const r of String(e)){if(gV(r.charCodeAt(0))){n=t.length>0;continue}n&&(t+=" "),n=!1,t+=r}return t},bV=e=>{const t=String(e??"").split(",")[0]??"",n=vV(t);return yV(pV(n)).trim()},wV=1,CV=1638,kV=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<wV?"":String(Math.min(r,CV))};Rt(),vn();var SV=["data-item"],_V=["id","value","disabled","aria-label","aria-expanded","aria-controls","aria-activedescendant","data-item"],AV=["data-item","aria-label","disabled"],IV=["innerHTML"],EV=["id","aria-label"],TV=["id","aria-selected","aria-label","onMousedown","onMouseenter"],xV={class:"toolbar-dropdown-option__label"},RV={class:"sd-button-label sd-font-combobox__legacy-label","aria-hidden":"true"},LV={__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}=is(),i=te(null),s=te(null),a=te(null),l=te([]),c=te(!1),d=te(!1),f=te(-1),p=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(U=>String(U?.label??""))),S=Ce(()=>String(n.item.label?.value??"")),w=Ce(()=>!!n.item.disabled?.value),b=Ce(()=>String(n.item.name?.value??"")),T=Ce(()=>n.item.attributes?.value?.ariaLabel??"Font family"),L=Ce(()=>c.value?g.value:S.value),N=Ce(()=>`sd-${b.value||"combobox"}-listbox-${n.item.id?.value??"default"}`),H=U=>`${N.value}-option-${U}`,z=Ce(()=>d.value&&f.value>=0?H(f.value):void 0),B=Ce(()=>d.value?lr.dropdownCaretUp:lr.dropdownCaretDown),Z=U=>{const G=String(U??"").trim().toLowerCase();return k.value.find(ge=>String(ge?.label??"").trim().toLowerCase()===G)?.props?.style?.fontFamily||U||n.uiFontFamily},R=Ce(()=>n.showPreview?{fontFamily:Z(c.value?g.value:S.value)}:{fontFamily:n.uiFontFamily}),K=()=>{const U=n.item.selectedValue?.value;if(U){const G=k.value.findIndex(ge=>ge?.key===U);if(G>=0)return G}return C.value.findIndex(G=>G.toLowerCase()===S.value.toLowerCase())},x=(U,G)=>{const ge=i.value;if(!(!ge||typeof ge.setSelectionRange!="function"))try{ge.setSelectionRange(U,G)}catch{}},W=()=>{l.value[f.value]?.scrollIntoView?.({block:"nearest",inline:"nearest"})},$=()=>{l.value[f.value]?.focus?.()},ee=()=>{const U=s.value;if(!U)return;const G=U.getBoundingClientRect(),ge=a.value,Ae=ge?.scrollHeight??ge?.offsetHeight??0,Se=window.innerHeight||document.documentElement.clientHeight||0,Te=window.innerWidth||document.documentElement.clientWidth||0,Ye=8,rt=4,ht=G.bottom+rt,Pt=G.top-rt,Ft=Math.max(0,Se-ht-Ye),Wt=Math.max(0,Pt-Ye),$e=Ft<Ae&&Wt>Ft,cn=$e?Wt:Ft,jn=$e?Math.max(Ye,Pt-(Ae?Math.min(Ae,cn):cn)):ht,Ut=Math.min(Math.max(Ye,G.left),Math.max(Ye,Te-G.width-Ye));v.value={top:`${jn}px`,left:`${Ut}px`,minWidth:`${G.width}px`,maxHeight:`${cn}px`}},Q=Ce(()=>({position:"fixed",top:v.value.top,left:v.value.left,minWidth:v.value.minWidth,maxHeight:v.value.maxHeight,fontFamily:n.uiFontFamily,zIndex:2e3})),X=U=>{n.item.expand&&typeof n.item.expand=="object"&&"value"in n.item.expand&&(n.item.expand.value=U)},we=(U,{focusInput:G=!1,focusOption:ge=!1}={})=>{if(w.value||!k.value.length){X(!1);return}d.value=!0,X(!0),f.value=U??-1,G&&(c.value=!0,g.value=S.value,i.value?.focus()),kt(()=>{ee(),W(),ge&&$()})},ce=({syncItem:U=!0}={})=>{d.value=!1,f.value=-1,U&&X(!1)},be=()=>{ce(),c.value=!1,p.value="",g.value=S.value},ve=()=>{w.value||(d.value||r("item-clicked"),c.value=!0,p.value="",g.value=S.value,kt(()=>x(0,g.value.length)))},Ee=U=>{if(w.value)return;const G=document.activeElement===i.value;if(r("item-clicked"),c.value=!0,G||(p.value="",g.value=S.value,U.preventDefault(),i.value?.focus({preventScroll:!0}),x(0,S.value.length)),!d.value){const ge=K();we(ge>=0?ge:0)}},Pe=U=>{const G=U.relatedTarget;G instanceof Node&&s.value?.contains(G)||G instanceof Node&&a.value?.contains(G)||be()},Ze=U=>{if(m.value)return;const G=U.target,ge=G.value,Ae=typeof G.selectionStart=="number"?G.selectionStart:ge.length,Se=typeof G.selectionEnd=="number"?G.selectionEnd:Ae,Te=typeof U.inputType=="string"&&U.inputType.startsWith("delete"),Ye=Ae===ge.length&&Se===ge.length;p.value=ge;const rt=hV(ge,C.value,{autocomplete:!Te&&Ye});g.value=rt.display,G.value=rt.display,rt.display===ge&&!Ye?x(Ae,Se):x(rt.selectionStart,rt.selectionEnd),d.value&&(f.value=rt.matchIndex,kt(W))},at=U=>{m.value=!1,Ze(U)},Qe=U=>{if(!k.value.length)return;const G=k.value.length,ge=f.value<0?U>0?-1:0:f.value;f.value=(ge+U+G)%G,kt(W)},At=(U,G)=>{r("item-clicked"),r("command",{item:n.item,argument:U,option:G}),G&&(n.item.selectedValue.value=G.key)},se=U=>{U&&(At(U.value??U.label,U),c.value=!1,p.value="",g.value=U.label,ce())},Ie=()=>{if(d.value&&f.value>=0)return se(k.value[f.value]),!0;const U=Om(p.value,C.value);if(U>=0)return se(k.value[U]),!0;const G=n.normalizeValue(p.value);return G?(At(G,null),c.value=!1,p.value="",g.value=G,ce(),!0):!1},Ue=U=>{if(!(U.isComposing||m.value||U.keyCode===229)&&!(U.ctrlKey||U.metaKey||U.altKey))switch(U.key){case"ArrowDown":if(U.preventDefault(),d.value)$();else{const G=Om(p.value,C.value),ge=G>=0?G:K();we(ge>=0?ge:0,{focusOption:!0})}break;case"ArrowUp":if(U.preventDefault(),d.value)$();else{const G=Om(p.value,C.value),ge=G>=0?G:K();we(ge>=0?ge:k.value.length-1,{focusOption:!0})}break;case"Enter":U.preventDefault(),Ie()&&r("editor-handoff"),i.value?.blur();break;case"Tab":U.preventDefault(),Ie(),ce(),i.value?.blur(),r("tab-out",U);break;case"Escape":U.preventDefault(),be(),kt(()=>i.value?.focus());break;default:break}},ne=U=>{if(U.preventDefault(),!w.value)if(r("item-clicked"),d.value)ce(),i.value?.focus();else{const G=K();we(G>=0?G:0,{focusOption:!0})}},A=(U,G)=>{U.preventDefault(),se(G),r("editor-handoff"),i.value?.blur()},ie=U=>{f.value=U},F=U=>{if(!(U.ctrlKey||U.metaKey||U.altKey))switch(U.key){case"ArrowDown":U.preventDefault(),Qe(1),$();break;case"ArrowUp":U.preventDefault(),Qe(-1),$();break;case"Enter":U.preventDefault(),f.value>=0&&(se(k.value[f.value]),r("editor-handoff"));break;case"Escape":U.preventDefault(),be(),kt(()=>i.value?.focus());break;case"Tab":U.preventDefault(),f.value>=0?se(k.value[f.value]):ce(),r("tab-out",{shiftKey:U.shiftKey,target:i.value});break;default:break}},Y=U=>{if(!d.value)return;const G=U.target;G instanceof Element&&(s.value?.contains(G)||a.value?.contains(G)||be())};Bt(d,U=>{U?(document.addEventListener("pointerdown",Y,!0),window.addEventListener("resize",ee),window.addEventListener("scroll",ee,!0)):(document.removeEventListener("pointerdown",Y,!0),window.removeEventListener("resize",ee),window.removeEventListener("scroll",ee,!0),l.value=[])},{immediate:!0}),fr(()=>{document.removeEventListener("pointerdown",Y,!0),window.removeEventListener("resize",ee),window.removeEventListener("scroll",ee,!0)});const O=(U,G)=>{if(!U){delete l.value[G];return}l.value[G]=U},V=U=>U===f.value,oe=U=>U?.key&&U.key===n.item.selectedValue?.value;return Bt(S,U=>{c.value||(g.value=U)}),Bt(()=>!!n.item.expand?.value,U=>{if(U&&!d.value){const G=K();we(G>=0?G:0,{focusInput:!0});return}!U&&d.value&&ce({syncItem:!1})}),(U,G)=>(ye(),Me("div",{ref_key:"rootRef",ref:s,class:Qt(["sd-font-combobox sd-toolbar-split-field",{"sd-disabled":w.value,"high-contrast":et(o)}]),style:bn(n.item.style?.value),"data-item":`btn-${b.value}`},[He("span",{class:"sd-font-combobox__field sd-toolbar-split-field__main",onMousedown:Ee},[He("input",{ref_key:"inputRef",ref:i,id:`inlineTextInput-${b.value}`,class:"button-text-input sd-font-combobox__input",type:"text",role:"combobox",autocomplete:"off",spellcheck:"false",value:L.value,style:bn(R.value),disabled:w.value,"aria-label":T.value,"aria-expanded":d.value?"true":"false","aria-controls":N.value,"aria-activedescendant":z.value,"aria-haspopup":"listbox","aria-autocomplete":"both","data-item":`btn-${b.value}-input`,onFocus:ve,onBlur:Pe,onInput:Ze,onKeydown:Ue,onCompositionstart:G[0]||(G[0]=ge=>m.value=!0),onCompositionend:at},null,44,_V)],32),He("button",{type:"button",class:"sd-font-combobox__caret sd-toolbar-split-field__caret","data-item":`btn-${b.value}-toggle`,tabindex:"-1","aria-label":`${T.value} options`,disabled:w.value,onMousedown:ne},[He("span",{class:"sd-dropdown-caret",innerHTML:B.value},null,8,IV)],40,AV),(ye(),rn(dl,{to:"body"},[d.value?(ye(),Me("div",{key:0,ref_key:"popupRef",ref:a,role:"listbox",id:N.value,"aria-label":T.value,class:Qt(["sd-font-combobox__listbox",{"high-contrast":et(o)}]),style:bn(Q.value)},[(ye(!0),Me(Kt,null,ar(k.value,(ge,Ae)=>(ye(),Me("div",Ms({key:ge.key,ref_for:!0,ref:Se=>O(Se,Ae),id:H(Ae),role:"option",tabindex:"-1",class:["toolbar-dropdown-option sd-font-combobox__option",{"sd-active":V(Ae),"sd-selected":oe(ge)}],"aria-selected":oe(ge)?"true":"false","aria-label":`${T.value} - ${ge.label}`},{ref_for:!0},ge.props,{onMousedown:Se=>A(Se,ge),onMouseenter:Se=>ie(Ae),onKeydown:F}),[He("span",xV,zt(ge.label),1)],16,TV))),128))],14,EV)):mt("",!0)])),He("span",RV,zt(S.value),1)],14,SV))}},tI=fn(LV,[["__scopeId","data-v-53e0af20"]]);Rt();var MV={__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(),rn(tI,{item:n.item,"ui-font-family":n.uiFontFamily,"show-preview":!0,"normalize-value":et(bV),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"]))}};Rt();var DV={__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(),rn(tI,{item:n.item,"ui-font-family":n.uiFontFamily,"show-preview":!1,"normalize-value":et(kV),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"]))}};Rt(),vn();var OV=["data-placement"],PV=2500,FV=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=z1(),r=te(!1),o=te(null),i=te(null),s=te({top:"0px",left:"0px"}),a=te("top");let l=null,c=null,d=null;const f=Ce(()=>["sd-tooltip-content",n.class]),p=Ce(()=>({...t.contentStyle,...n.style||{},position:"fixed",top:s.value.top,left:s.value.left,zIndex:2100})),g=()=>{l&&(window.clearTimeout(l),l=null)},m=()=>{c&&(window.clearTimeout(c),c=null)},v=()=>{d&&(window.clearTimeout(d),d=null)},k=()=>{v(),d=window.setTimeout(()=>{d=null,b()},PV)},C=(R,K)=>{const x=window.getComputedStyle(R),W=parseFloat(x[K]);return Number.isFinite(W)?x.boxSizing==="border-box"?W:(K==="width"?["paddingLeft","paddingRight","borderLeftWidth","borderRightWidth"]:["paddingTop","paddingBottom","borderTopWidth","borderBottomWidth"]).reduce(($,ee)=>$+(parseFloat(x[ee])||0),W):K==="width"?R.offsetWidth:R.offsetHeight},S=()=>{if(!o.value||!i.value)return;const R=o.value.getBoundingClientRect(),K=C(i.value,"width"),x=C(i.value,"height"),W=window.innerWidth||document.documentElement.clientWidth||0,$=document.documentElement.clientHeight||window.innerHeight||0,ee=8,Q=10;let X=R.left+R.width/2-K/2;X=Math.max(ee,Math.min(X,W-K-ee));const we=R.top-x-Q,ce=R.bottom+Q,be=we>=ee,ve=ce+x<=$-ee,Ee=R.top-Q,Pe=$-R.bottom-Q;be?a.value="top":ve?a.value="bottom":a.value=Ee>=Pe?"top":"bottom";const Ze=a.value==="top"?we:ce,at=Math.min(ee,Math.max(0,$-x)),Qe=Math.max(at,$-x-ee);s.value={top:`${Math.max(at,Math.min(Ze,Qe))}px`,left:`${X}px`}},w=async()=>{t.disabled||(g(),m(),!r.value&&(r.value=!0,k(),await kt(),S()))},b=()=>{m(),g(),v(),r.value&&(r.value=!1)},T=()=>{if(g(),m(),!r.value){if(t.delay===0){w();return}c=window.setTimeout(()=>{c=null,w()},t.delay)}},L=()=>{if(m(),g(),!!r.value){if(t.duration===0){b();return}l=window.setTimeout(()=>{l=null,b()},t.duration)}},N=()=>{t.trigger==="hover"&&T()},H=()=>{t.trigger==="hover"&&L()},z=()=>{m(),g()},B=()=>{L()},Z=R=>{R.key==="Escape"&&b()};return Bt(()=>t.disabled,R=>{R&&b()}),Bt(r,R=>{R?(window.addEventListener("resize",S),window.addEventListener("scroll",S,!0),document.addEventListener("keydown",Z,!0)):(window.removeEventListener("resize",S),window.removeEventListener("scroll",S,!0),document.removeEventListener("keydown",Z,!0))}),fr(()=>{m(),g(),v(),window.removeEventListener("resize",S),window.removeEventListener("scroll",S,!0),document.removeEventListener("keydown",Z,!0)}),(R,K)=>(ye(),Me(Kt,null,[He("span",{ref_key:"triggerRef",ref:o,class:"sd-tooltip-trigger",onMouseenter:N,onMouseleave:H,onFocusin:N,onFocusout:H},[uu(R.$slots,"trigger",{},void 0,!0)],544),(ye(),rn(dl,{to:"body"},[qt(mp,{name:"fade-in-scale-up-transition"},{default:co(()=>[r.value&&!e.disabled?(ye(),Me("div",{key:0,ref_key:"contentRef",ref:i,class:Qt(f.value),style:bn(p.value),"data-placement":a.value,onMouseenter:z,onMouseleave:B},[K[0]||(K[0]=He("span",{class:"sd-tooltip-arrow","aria-hidden":"true"},null,-1)),uu(R.$slots,"default",{},void 0,!0)],46,OV)):mt("",!0)]),_:3})]))],64))}}),Pm=fn(FV,[["__scopeId","data-v-88d296cd"]]);Rt(),vn();var NV=["onKeydown","tabindex","data-item-id"],BV={key:0},zV={key:0},VV={key:0},jV={key:0},UV={key:0},HV={__name:"ButtonGroup",props:{toolbarItems:{type:Array,required:!0},overflowItems:{type:Array,default:()=>[]},uiFontFamily:{type:String,default:"Arial, Helvetica, sans-serif"},position:{type:String,default:"left"},fromOverflow:{type:Boolean,default:!1},compactSideGroups:{type:Boolean,default:!1}},emits:["command","item-clicked","dropdown-update-show"],setup(e,{emit:t}){const n=t,{proxy:r}=vr(),o=te([]),i=te(null),s=e,a=te(null),{isHighContrastMode:l}=is(),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=se=>se.type==="button",p=se=>se.type==="dropdown",g=se=>se.type==="dropdown"&&se.name?.value==="fontFamily",m=se=>se.type==="dropdown"&&se.name?.value==="fontSize",v=se=>se.type==="separator",k=se=>se.type==="overflow",C=se=>!!se.nestedOptions?.value?.length,S=se=>{if(!se)return!1;const Ie=se.expand;return typeof Ie=="object"&&Ie!==null&&"value"in Ie?!!Ie.value:!!Ie},w=(se,Ie)=>{se?.expand&&(se.expand.value=Ie)},b=(se,Ie=void 0)=>{if(se.disabled.value)return;if(k(se)){const ne=!S(se);ne&&N(),w(se,ne),a.value=ne?se:null,n("item-clicked");return}if(p(se))return;a.value&&p(a.value)&&S(a.value)&&N(),n("item-clicked");const Ue=Ie!==void 0?Ie:se.argument?.value;n("command",Ue===void 0?{item:se}:{item:se,argument:Ue})},T=(se,Ie)=>{se.disabled.value||(a.value=null,n("command",{item:se,argument:Ie}))},L=se=>{if(se.disabled.value)return;N();const Ie=se.splitButtonCommand,Ue=se.command,ne=Ie||Ue;if(!ne)return;const A={...se,command:ne};n("item-clicked"),n("command",{item:A})},N=()=>{const se=r?.$toolbar?.toolbarItems||[],Ie=r?.$toolbar?.overflowItems||[],Ue=[...se,...Ie];(Ue.length?Ue:s.toolbarItems).forEach(ne=>{const A=k(ne)&&!s.fromOverflow;(p(ne)||A)&&w(ne,!1)}),a.value=null},H=(se,Ie)=>{N();const Ue=se.dropdownValueKey.value?Ie[se.dropdownValueKey.value]:Ie.label;n("command",{item:se,argument:Ue,option:Ie}),se.selectedValue.value=Ie.key,se.restoreEditorFocus&&Tc(r?.$toolbar)},z=se=>{n("command",se)},B=()=>{N(),n("item-clicked")},Z=()=>{const se=document.querySelector('[role="textbox"][aria-label*="SuperDoc body"], .ProseMirror');return se instanceof HTMLElement?(se.focus({preventScroll:!0}),!0):!1},R=()=>{const se=r?.$toolbar?.pendingSelectionCapture,Ie=()=>{se&&typeof r?.$toolbar?.ui?.selection?.restore=="function"&&r.$toolbar.ui.selection.restore(se)};if(Z()){Ie();return}typeof r?.$toolbar?.superdoc?.focus=="function"&&(r.$toolbar.superdoc.focus(),Ie())},K=se=>!(se instanceof HTMLElement)||se.classList.contains("sd-disabled")?null:se.querySelector("input:not([disabled]), textarea:not([disabled]), select:not([disabled])")||se.querySelector('button:not([disabled]), [role="button"]:not(.sd-disabled), [tabindex]:not([tabindex="-1"])'),x=(se,Ie)=>{const Ue=se?.target?.closest?.(".sd-toolbar-item-ctn");if(!(Ue instanceof HTMLElement))return!1;let ne=Ie>0?Ue.nextElementSibling:Ue.previousElementSibling;for(;ne;){const A=K(ne);if(A instanceof HTMLElement)return Ue.setAttribute("tabindex","-1"),ne.setAttribute("tabindex","0"),A.focus(),!0;ne=Ie>0?ne.nextElementSibling:ne.previousElementSibling}return!1},W=se=>{N();const Ie=se?.shiftKey?-1:1;x(se,Ie)||R()},$=se=>{if(N(),se?.shiftKey){x(se,-1)||R();return}R()},ee=()=>{R()},Q=se=>se.nestedOptions?.value?.length?se.nestedOptions.value.map(Ie=>{const Ue=Ie?.type!=="render"&&se.selectedValue.value===Ie.key;return{...Ie,props:{...Ie.props,class:Ue?"sd-selected":""}}}):[],X=(se,Ie)=>({role:"menuitem","aria-label":`${Ie.attributes.value.ariaLabel} - ${se.label}`}),we=se=>{const Ie=se.target,Ue=se.target.closest(".sd-toolbar-item-ctn").nextElementSibling;Ue&&(Ie.setAttribute("tabindex","-1"),Ue.setAttribute("tabindex","0"),Ue.focus())},ce=se=>{const Ie=se.target,Ue=se.target.closest(".sd-toolbar-item-ctn").previousElementSibling;Ue&&(Ie.setAttribute("tabindex","-1"),Ue.setAttribute("tabindex","0"),Ue.focus())},be=se=>{const Ie=se.target.closest(".button-group").nextElementSibling;if(Ie)Ie.setAttribute("tabindex","0"),Ie.focus();else{const Ue=document.querySelector(".ProseMirror");Ue&&Ue.focus()}},ve=se=>{const Ie=se.target.closest(".button-group").previousElementSibling;Ie&&(Ie.setAttribute("tabindex","0"),Ie.focus())},Ee=se=>{if(!se.disabled.value){if(p(se)){at(!S(se),se);return}b(se)}},Pe=(se,Ie)=>{const Ue=se.target.nodeName==="INPUT"||se.target.nodeName==="TEXTAREA",ne=Ie.name.value==="fontSize"||Ie.name.value==="fontFamily";if(!(Ue&&ne)&&["Enter"," ","Spacebar","Escape","ArrowRight","ArrowLeft","Tab"].includes(se.key))switch(se.preventDefault(),se.key){case"Enter":case" ":case"Spacebar":Ee(Ie);break;case"Escape":N();break;case"ArrowRight":N(),we(se);break;case"ArrowLeft":N(),ce(se);break;case"Tab":se.shiftKey?ve(se):be(se);break;default:break}},Ze=se=>{const Ie=o.value.find(Ue=>!Ue.classList.contains("sd-disabled"));Ie&&(Ie.setAttribute("tabindex","0"),Ie.focus())},at=(se,Ie)=>{if(n("item-clicked"),!se){N(),n("dropdown-update-show",!1);return}N(),a.value=Ie,w(Ie,!0),n("dropdown-update-show",!0)},Qe=se=>{if(!a.value)return;const Ie=se.target;Ie instanceof Element&&(Ie.closest('[data-sd-part="dropdown-menu"]')||i.value?.contains(Ie)||N())};return Bt(()=>S(a.value),se=>{se?document.addEventListener("pointerdown",Qe,!0):document.removeEventListener("pointerdown",Qe,!0)},{immediate:!0}),fr(()=>{document.removeEventListener("pointerdown",Qe,!0)}),(se,Ie)=>(ye(),Me("div",{style:bn(d.value),class:"button-group",role:"group",onFocus:Ze,ref_key:"buttonGroupRef",ref:i},[(ye(!0),Me(Kt,null,ar(e.toolbarItems,(Ue,ne)=>(ye(),Me("div",{key:Ue.id.value,class:Qt([{narrow:Ue.isNarrow.value,wide:Ue.isWide.value,"sd-disabled":Ue.disabled.value},"sd-toolbar-item-ctn"]),onKeydown:A=>Pe(A,Ue),ref_for:!0,ref_key:"toolbarItemRefs",ref:o,tabindex:ne===0?0:-1,"data-item-id":Ue.id.value},[v(Ue)?(ye(),rn(iV,{key:0,style:{width:"20px"}})):mt("",!0),g(Ue)&&C(Ue)?(ye(),rn(Pm,{key:1,trigger:"hover",disabled:!Ue.tooltip?.value,"content-style":{fontFamily:s.uiFontFamily}},{trigger:co(()=>[qt(MV,{item:Ue,"ui-font-family":s.uiFontFamily,class:"sd-toolbar-button sd-editor-toolbar-dropdown",onCommand:z,onItemClicked:B,onTabOut:Ie[0]||(Ie[0]=A=>W(A)),onEditorHandoff:ee},null,8,["item","ui-font-family"])]),default:co(()=>[He("div",null,[ts(zt(Ue.tooltip)+" ",1),Ue.disabled.value?(ye(),Me("span",BV,"(disabled)")):mt("",!0)])]),_:2},1032,["disabled","content-style"])):m(Ue)&&C(Ue)?(ye(),rn(Pm,{key:2,trigger:"hover",disabled:!Ue.tooltip?.value,"content-style":{fontFamily:s.uiFontFamily}},{trigger:co(()=>[qt(DV,{item:Ue,"ui-font-family":s.uiFontFamily,class:"sd-toolbar-button sd-editor-toolbar-dropdown",onCommand:z,onItemClicked:B,onTabOut:Ie[1]||(Ie[1]=A=>$(A)),onEditorHandoff:ee},null,8,["item","ui-font-family"])]),default:co(()=>[He("div",null,[ts(zt(Ue.tooltip)+" ",1),Ue.disabled.value?(ye(),Me("span",zV,"(disabled)")):mt("",!0)])]),_:2},1032,["disabled","content-style"])):p(Ue)&&Ue.nestedOptions?.value?.length?(ye(),rn(QA,{key:3,options:Q(Ue),disabled:Ue.disabled.value,show:S(Ue),"content-style":{fontFamily:s.uiFontFamily},placement:"bottom-start",class:"sd-toolbar-button sd-editor-toolbar-dropdown",onSelect:(A,ie)=>H(Ue,ie),"onUpdate:show":A=>at(A,Ue),style:bn(Ue.dropdownStyles.value),"menu-props":()=>({role:"menu",style:{fontFamily:s.uiFontFamily},class:["sd-toolbar-dropdown-menu",{"high-contrast":et(l)}]}),"node-props":A=>X(A,Ue)},{trigger:co(()=>[qt(Pm,{trigger:"hover",disabled:!Ue.tooltip?.value,"content-style":{fontFamily:s.uiFontFamily}},{trigger:co(()=>[qt(Bb,{"toolbar-item":Ue,disabled:Ue.disabled.value,"allow-enter-propagation":!0,onTextSubmit:A=>T(Ue,A),onMainClick:A=>L(Ue)},null,8,["toolbar-item","disabled","onTextSubmit","onMainClick"])]),default:co(()=>[He("div",null,[ts(zt(Ue.tooltip)+" ",1),Ue.disabled.value?(ye(),Me("span",VV,"(disabled)")):mt("",!0)])]),_:2},1032,["disabled","content-style"])]),_:2},1032,["options","disabled","show","content-style","onSelect","onUpdate:show","style","menu-props","node-props"])):f(Ue)?(ye(),rn(Pm,{key:4,trigger:"hover",class:"sd-editor-toolbar-tooltip","content-style":{fontFamily:s.uiFontFamily}},{trigger:co(()=>[qt(Bb,{"toolbar-item":Ue,"is-overflow-item":e.fromOverflow,onTextSubmit:A=>T(Ue,A),onButtonClick:A=>b(Ue)},null,8,["toolbar-item","is-overflow-item","onTextSubmit","onButtonClick"])]),default:co(()=>[Ue.tooltip?(ye(),Me("div",jV,[ts(zt(Ue.tooltip)+" ",1),Ue.disabled.value?(ye(),Me("span",UV,"(disabled)")):mt("",!0)])):mt("",!0)]),_:2},1032,["content-style"])):mt("",!0),k(Ue)&&e.overflowItems.length?(ye(),rn(fV,{key:5,"toolbar-item":Ue,"ui-font-family":s.uiFontFamily,onButtonClick:A=>b(Ue),"overflow-items":e.overflowItems,onClose:N,onCommand:Ie[2]||(Ie[2]=A=>n("command",A))},null,8,["toolbar-item","ui-font-family","onButtonClick","overflow-items"])):mt("",!0)],42,NV))),128))],36))}},Fm=fn(HV,[["__scopeId","data-v-8d7a9de1"]]),$V=[["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"]],GV=$V.map(([e,t])=>({label:e,key:e,props:{style:{fontFamily:`${e}, ${t}`},"data-item":"btn-fontFamily-option"}}));function WV(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 KV=[{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"}}],ah={sm:768,md:1024,lg:1280,xl:1410},zb={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"},nI={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"},rI=Object.values(nI),gW=[...new Set([...Object.values(zb),...rI])],qV=new Set(["link"]),vW=new Set(Object.keys(zb).filter(e=>!qV.has(e)));Rt(),vn();var YV="Arial, Helvetica, sans-serif",XV={__name:"Toolbar",emits:["command","toggle","select"],setup(e,{emit:t}){const{proxy:n}=vr();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():YV}),c=n.$toolbar.config?.toolbarGroups?.includes("left"),d=n.$toolbar.config?.toolbarGroups?.includes("right"),f=n.$toolbar.config?.toolbarButtonsExclude||[],p=H=>(o.value,n.$toolbar.getToolbarItemByGroup(H).filter(z=>!f.includes(z.name.value))),g=()=>{i.value=n.$toolbar.getAvailableWidth()<=ah.lg},v=jz(async()=>{await n.$toolbar.onToolbarResize(),g(),r.value+=1},300),k=()=>{r.value+=1},C=()=>{o.value+=1};function S(){window.removeEventListener("resize",v),n.$toolbar.off?.("toolbar-items-changed",k),n.$toolbar.off?.("toolbar-state-change",C),s?.disconnect(),s=null}function w(){S(),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()}zn(w),lv(w),cv(S),fr(S);const b=()=>{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:z,option:B})=>{L(),n.$toolbar.emitCommand({item:H,argument:z,option:B})},L=()=>{const H=n.$toolbar.activeEditor;if(!H)return;const z=n.$toolbar.pendingSelectionCapture??a;if(z&&typeof n.$toolbar.ui?.selection?.restore=="function"){n.$toolbar.ui.selection.restore(z);return}H.commands?.restoreSelection?.()},N=H=>{b(),JA(H)};return(H,z)=>(ye(),Me("div",{class:"superdoc-toolbar",key:et(r),role:"toolbar","aria-label":"Toolbar","data-sd-part":"toolbar","data-editor-ui-surface":"",onMousedown:N},[et(c)?(ye(),rn(Fm,{key:0,tabindex:"0","toolbar-items":p("left"),"overflow-items":et(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),qt(Fm,{tabindex:"0","toolbar-items":p("center"),"overflow-items":et(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"]),et(d)?(ye(),rn(Fm,{key:1,tabindex:"0","toolbar-items":p("right"),"overflow-items":et(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))}},ZV=fn(XV,[["__scopeId","data-v-ed19716b"]]),QV=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"}}};Rt();var xn=e=>{if(!["button","options","separator","dropdown","overflow"].includes(e.type))throw new Error("Invalid toolbar item type - "+e.type);if(e.type==="button"&&!e.defaultLabel&&!e.icon)throw new Error(`Toolbar button item needs either "icon" or "defaultLabel" - ${e.name}. "label" is the live label and is not a substitute for "defaultLabel".`);if(!e.name)throw new Error("Invalid toolbar item name - "+e.name);const t=te(ol()),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,f=te(e.disabled),p=te(!1),g=te(!1),m=te(e.style),v=te(e.isNarrow),k=te(e.isWide),C=te(e.minWidth),S=te(e.layoutWidth),w=te(e.suppressActiveHighlight||!1),b=te(e.argument),T=te(null),L=te(null),N=te(e.iconColor),H=te(e.hasCaret),z=te(!!e.splitButton),B=e.splitButtonCommand,Z=!!e.restoreEditorFocus,R=te(e.dropdownStyles),K=te(e.tooltip),x=te(e.tooltipVisible),W=te(e.tooltipTimeout),$=te(e.defaultLabel),ee=te(e.label),Q=te(e.hideLabel),X=te(e.inlineTextInputVisible),we=te(e.hasInlineTextInput),ce=te(e.markName),be=te(e.labelAttr),ve=te(e.selectedValue),Ee=te(e.dropdownValueKey),Pe=te(e.inputRef||null),Ze=te([]);if(e.options){if(!Array.isArray(e.options))throw new Error("Invalid toolbar item options - "+e.options);let ie=0;for(let F=0;F<e.options.length;F+=1){const Y=e.options[F];(!Y||typeof Y!="object")&&(ie+=1)}if(ie)throw new Error(`Toolbar item options must all be objects - ${e.name}. ${ie} row(s) are not, so this item is skipped.`);Ze.value?.push(...e.options)}const at=(ie={},...F)=>{Ie(ie,...F),!w.value&&(p.value=!0)},Qe=()=>{Ue(),p.value=!1},At=ie=>{f.value=ie},se=()=>{f.value=d},Ie=e.onActivate||(()=>null),Ue=e.onDeactivate||(()=>null),ne=()=>{const ie={};return Object.keys(A).forEach(F=>{A[F].value!==void 0&&(ie[F]=A[F].value)}),ie},A={id:t,name:r,type:n,command:o,noArgumentCommand:i,icon:s,tooltip:K,group:a,attributes:c,disabled:f,active:p,expand:g,nestedOptions:Ze,style:m,isNarrow:v,isWide:k,minWidth:C,layoutWidth:S,argument:b,parentItem:L,iconColor:N,hasCaret:H,splitButton:z,splitButtonCommand:B,dropdownStyles:R,tooltipVisible:x,tooltipTimeout:W,defaultLabel:$,label:ee,hideLabel:Q,inlineTextInputVisible:X,hasInlineTextInput:we,restoreEditorFocus:Z,markName:ce,labelAttr:be,childItem:T,allowWithoutEditor:l,dropdownValueKey:Ee,selectedValue:ve,inputRef:Pe};return{...A,initiallyDisabled:d,unref:ne,activate:at,deactivate:Qe,setDisabled:At,resetDisabled:se,onActivate:Ie,onDeactivate:Ue}};Rt(),vn();var JV=["onClick","innerHTML","aria-label","onKeydown"],ej={__name:"AlignmentButtons",emits:["select"],setup(e,{emit:t}){const{isHighContrastMode:n}=is(),r=t,o=te([]),i=[{key:"left",ariaLabel:"Align left",icon:lr.alignLeft},{key:"center",ariaLabel:"Align center",icon:lr.alignCenter},{key:"right",ariaLabel:"Align right",icon:lr.alignRight},{key:"justify",ariaLabel:"Justify",icon:lr.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);break;default:break}};return zn(()=>{const d=o.value[0];d&&(d.setAttribute("tabindex","0"),d.focus())}),(d,f)=>(ye(),Me("div",{class:Qt(["alignment-buttons",{"high-contrast":et(n)}])},[(ye(),Me(Kt,null,ar(i,(p,g)=>He("div",{key:p.key,class:"sd-button-icon",onClick:m=>s(p.key),innerHTML:p.icon,"data-item":"btn-textAlign-option",role:"menuitem","aria-label":p.ariaLabel,ref_for:!0,ref_key:"alignmentButtonsRefs",ref:o,onKeydown:Zt(m=>c(m,g),["prevent"])},null,40,JV)),64))],2))}},tj=fn(ej,[["__scopeId","data-v-13e5f7a4"]]);Rt(),vn();var nj=["onClick","innerHTML","aria-label","onKeydown"],rj={__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}=is(),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 p=i.value[f+1];p&&(p.setAttribute("tabindex","0"),p.focus())},c=f=>{if(f===0)return;const p=i.value[f-1];p&&(p.setAttribute("tabindex","0"),p.focus())},d=(f,p)=>{switch(f.key){case"ArrowLeft":c(p);break;case"ArrowRight":l(p);break;case"Enter":a(o.buttons[p].key);break;default:break}};return zn(()=>{const f=i.value[0];f&&(f.setAttribute("tabindex","0"),f.focus())}),(f,p)=>(ye(),Me("div",{class:Qt(["style-buttons-list",{"high-contrast":et(n)}])},[(ye(!0),Me(Kt,null,ar(o.buttons,(g,m)=>(ye(),Me("div",{key:g.key,class:Qt(["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:Zt(v=>d(v,m),["prevent"])},null,46,nj))),128))],2))}},oI=fn(rj,[["__scopeId","data-v-44f37ff6"]]),oj=[{key:"disc",icon:lr.bulletListDisc,ariaLabel:"Opaque circle"},{key:"circle",icon:lr.bulletListCircle,ariaLabel:"Outline circle"},{key:"square",icon:lr.bulletListSquare,ariaLabel:"Opaque square"}],ij=[{key:"decimal",icon:lr.numberedListDecimal,ariaLabel:"1. 2. 3."},{key:"decimal-paren",icon:lr.numberedListDecimalParen,ariaLabel:"1) 2) 3)"},{key:"upper-roman",icon:lr.numberedListUpperRoman,ariaLabel:"I. II. III."},{key:"lower-roman",icon:lr.numberedListLowerRoman,ariaLabel:"i. ii. iii."},{key:"upper-alpha",icon:lr.numberedListUpperAlpha,ariaLabel:"A. B. C."},{key:"upper-alpha-paren",icon:lr.numberedListUpperAlphaParen,ariaLabel:"A) B) C)"},{key:"lower-alpha",icon:lr.numberedListLowerAlpha,ariaLabel:"a. b. c."},{key:"lower-alpha-paren",icon:lr.numberedListLowerAlphaParen,ariaLabel:"a) b) c)"}];Rt(),vn();var sj=["onClick","onKeydown"],aj={class:"document-mode-column icon-column"},lj=["innerHTML"],cj={class:"document-mode-column text-column"},uj={class:"document-mode-type"},dj={class:"document-mode-description"},fj={__name:"DocumentMode",props:{options:{type:Array}},emits:["select"],setup(e,{emit:t}){const n=t,r=te([]),{isHighContrastMode:o}=is(),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]);break;default:break}};return zn(()=>{r.value[0].setAttribute("tabindex","0"),r.value[0].focus()}),(d,f)=>(ye(),Me("div",{class:Qt(["document-mode",{"high-contrast":et(o)}])},[(ye(!0),Me(Kt,null,ar(e.options,(p,g)=>(ye(),Me("div",{class:Qt(["sd-option-item",{"sd-disabled":p.disabled}]),onClick:m=>s(p),"data-item":"btn-documentMode-option",role:"menuitem",ref_for:!0,ref_key:"documentModeRefs",ref:r,onKeydown:Zt(m=>c(m,g),["prevent"])},[He("div",aj,[He("div",{class:"icon-column__icon",innerHTML:p.icon},null,8,lj)]),He("div",cj,[He("div",uj,zt(p.label),1),He("div",dj,zt(p.description),1)])],42,sj))),256))],2))}},hj=fn(fj,[["__scopeId","data-v-bee14d7a"]]);Rt(),vn();var pj={class:"linked-style-buttons","data-editor-ui-surface":""},mj=["onClick","onKeydown","aria-label"],gj={__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=p=>{n("select",p)},s=p=>{if(p===r.value.length-1)return;const g=r.value[p+1];g.setAttribute("tabindex","0"),g.focus()},a=p=>{if(p===0)return;const g=r.value[p-1];g.setAttribute("tabindex","0"),g.focus()},l=(p,g,m)=>{switch(p.key){case"ArrowDown":s(g);break;case"ArrowUp":a(g);break;case"Enter":p.preventDefault(),i(m);break;default:break}},c=p=>p?.name??p?.id??"",d=p=>{const g=p?.preview?.css;return g&&typeof g=="object"?g:void 0},f=()=>{r.value[0]&&(r.value[0].setAttribute("tabindex","0"),r.value[0].focus())};return zn(f),Bt(()=>o.styles.length,async(p,g)=>{p===0||g!==0||(await kt(),f())}),(p,g)=>(ye(),Me("div",pj,[(ye(!0),Me(Kt,null,ar(o.styles,(m,v)=>(ye(),Me("div",{key:m.id??v,class:Qt(["style-item",{selected:e.selectedOption===m.id}]),onClick:k=>i(m),onKeydown:k=>l(k,v,m),"aria-label":`Linked style - ${m.id??c(m)}`,ref_for:!0,ref_key:"styleRefs",ref:r},[He("div",{class:"style-name","data-item":"btn-linkedStyles-option",style:bn(d(m))},zt(c(m)),5)],42,mj))),128))]))}},vj=fn(gj,[["__scopeId","data-v-74c8924b"]]);Rt(),vn();var yj=["placeholder"],bj={class:"sd-ai-writer__footer"},wj={key:0,class:"sd-ai-writer__error",role:"alert"},Cj=["disabled"],kj="https://sd-dev-express-gateway-i6xtm.ondigitalocean.app/insights",Sj="You are an expert copywriter and you are immersed in a document editor. Only write what is asked for.",_j={__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);zn(()=>{kt(()=>{i.value?.focus()})});function l(m){if(typeof m=="string")return m;if(!m||typeof m!="object")return"";const v=m.custom_prompt;if(Array.isArray(v)){const 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}`,S=await fetch(t.endpoint||kj,{method:"POST",headers:v,body:JSON.stringify({stream:!1,context:Sj,insights:[{type:"custom_prompt",name:k?"text_rewrite":"text_generation",message:C,format:[{value:""}]}]})});if(!S.ok){const b=await S.text().catch(()=>"");throw new Error(b||`AI request failed with ${S.status}`)}const w=l((S.headers.get("content-type")||"").includes("application/json")?await S.json():await S.text()).trim();if(!w)throw new Error("AI returned no text.");return w}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 p(){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(),p())}return(m,v)=>(ye(),Me("form",{class:"sd-ai-writer","data-item":"ai-writer",onSubmit:Zt(p,["prevent"])},[ya(He("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,yj),[[ji,n.value]]),He("div",bj,[o.value?(ye(),Me("p",wj,zt(o.value),1)):mt("",!0),He("button",{class:"sd-ai-writer__submit",type:"submit",disabled:!a.value},zt(r.value?"Generating":"Generate"),9,Cj)])],32))}},Aj=fn(_j,[["__scopeId","data-v-67f6c6f7"]]);Rt(),vn();var Ij=["aria-label","onClick","onKeydown"],Ej=["innerHTML"],Tj=["innerHTML"],Nm=7,xj={__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([]);zn(()=>{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=Nm*m+v+1,C=l.value[k];C&&(C.setAttribute("tabindex","0"),C.focus({preventScroll:!0}))},d=(m,v)=>{const k=Nm*m+v-1,C=l.value[k];C&&(C.setAttribute("tabindex","0"),C.focus({preventScroll:!0}))},f=(m,v)=>{const k=v+Nm*(m+1),C=l.value[k];C&&(C.setAttribute("tabindex","0"),C.focus({preventScroll:!0}))},p=(m,v)=>{const k=v+Nm*(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":p(v,k);break;case"Enter":s(C);break;case"Escape":n("clickoutside");break;default:break}};return(m,v)=>(ye(!0),Me(Kt,null,ar(e.icons,(k,C)=>(ye(),Me("div",{class:"sd-option-row",key:C,role:"group",ref_for:!0,ref_key:"rowRefs",ref:a},[(ye(!0),Me(Kt,null,ar(k,(S,w)=>(ye(),Me("div",{class:"sd-option",key:w,"aria-label":S.label,role:"menuitem",ref_for:!0,ref_key:"iconRefs",ref:l,onClick:Zt(b=>s(S),["stop","prevent"]),onKeydown:Zt(b=>g(b,C,w,S),["prevent"])},[He("div",{class:"sd-option__icon",innerHTML:S.icon,style:bn(S.style)},null,12,Ej),o.value(S)?(ye(),Me("div",{key:0,class:"sd-option__check",innerHTML:et(lr).colorOptionCheck,style:bn(i(S.value,w))},null,12,Tj)):mt("",!0)],40,Ij))),128))]))),128))}},iI=fn(xj,[["__scopeId","data-v-05eb02fc"]]),Rj=`<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
|
`;Rt(),vn();var Lj={class:"options-grid-wrap"},Mj=["innerHTML"],Dj={class:"option-grid-ctn"},Oj={__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(),Me("div",Lj,[e.hasNoneIcon?(ye(),Me("div",{key:0,class:"none-option",role:"menuitem","aria-label":"Clear color selection",onClick:i[0]||(i[0]=s=>r("none"))},[He("span",{innerHTML:et(Rj),class:"none-icon"},null,8,Mj),i[1]||(i[1]=ts(" None ",-1))])):mt("",!0),He("div",Dj,[qt(iI,{icons:e.icons,"active-color":e.activeColor,onSelect:r},null,8,["icons","active-color"]),e.customIcons.flat().length?(ye(),Me(Kt,{key:0},[i[2]||(i[2]=He("span",{class:"option-grid-ctn__subtitle"},"Custom colors",-1)),qt(iI,{icons:e.customIcons,"active-color":e.activeColor,onSelect:r},null,8,["icons","active-color"])],64)):mt("",!0)])]))}},Pj=fn(Oj,[["__scopeId","data-v-52b0283a"]]);Rt();var Fj=e=>{e.expand.value=!1},Gt=(e,t=null)=>({label:t,icon:lr.colorOption,value:e,style:{color:e,boxShadow:"0 0 5px 1px rgba(0, 0, 0, 0.1)",borderRadius:"50%"}}),Vb=(e,t,n=[],r=!1)=>{const o=i=>{t.iconColor.value=i,e.emitCommand({item:t,argument:i}),Fj(t),Tc(e)};return Gr("div",{},[Gr(Pj,{icons:Nj,customIcons:n,activeColor:t.iconColor,hasNoneIcon:r,onSelect:o})])},Nj=[[Gt("#111111","black"),Gt("#333333","dark gray"),Gt("#5C5C5C","medium gray"),Gt("#858585","light gray"),Gt("#ADADAD","very light gray"),Gt("#D6D6D6","transparent gray"),Gt("#FFFFFF","white")],[Gt("#860028","dark red"),Gt("#D2003F","red"),Gt("#DB3365","coral red"),Gt("#E4668C","light red"),Gt("#ED99B2","pale pink"),Gt("#F6CCD9","transparent pink"),Gt("#FF004D","bright pink")],[Gt("#83015E","dark purple"),Gt("#CD0194","purple"),Gt("#D734A9","orchid"),Gt("#E167BF","light purple"),Gt("#EB99D4","lavender"),Gt("#F5CCEA","transparent pink"),Gt("#FF00A8","neon pink")],[Gt("#8E220A","maroon"),Gt("#DD340F","red-orange"),Gt("#E45C3F","burnt orange"),Gt("#EB856F","peach"),Gt("#F1AE9F","pale peach"),Gt("#F8D6CF","transparent peach"),Gt("#FF7A00","orange")],[Gt("#947D02","olive"),Gt("#E7C302","mustard yellow"),Gt("#ECCF35","yellow"),Gt("#F1DB67","light yellow"),Gt("#F5E79A","very pale yellow"),Gt("#FAF3CC","transparent yellow"),Gt("#FAFF09","neon yellow")],[Gt("#055432","forest green"),Gt("#07834F","green"),Gt("#399C72","medium green"),Gt("#6AB595","light green"),Gt("#9CCDB9","mint"),Gt("#CDE6DC","transparent mint"),Gt("#05F38F","bright teal")],[Gt("#063E7E","navy blue"),Gt("#0A60C5","blue"),Gt("#3B80D1","sky blue"),Gt("#6CA0DC","cornflower blue"),Gt("#9DBFE8","light blue"),Gt("#CEDFF3","very light blue"),Gt("#21c8ce","cyan")],[Gt("#3E027A","deep purple"),Gt("#6103BF","indigo"),Gt("#8136CC","violet"),Gt("#A068D9","lavender pink"),Gt("#C09AE6","light lilac"),Gt("#DFCDF2","transparent lilac"),Gt("#A91DFF","neon purple")]];Rt(),vn();var Bj=["data-cols","data-rows","onKeydown","onClick"],zj=["aria-valuetext"],Bm=5,Vj={__name:"TableGrid",emits:["select","clickoutside"],setup(e,{emit:t}){const n=t,r=te(0),o=te(0),{isHighContrastMode:i}=is(),s=te([]),a=f=>{let p=f.target;if(p.dataset.grid)return;let g=[...p.parentElement.querySelectorAll("[data-item]")],m=parseInt(p.dataset.cols,10),v=parseInt(p.dataset.rows,10);l(g,m,v)},l=(f,p,g)=>{o.value=p,r.value=g;for(let m=0;m<f.length;m++){let v=f[m],k=parseInt(v.dataset.cols,10),C=parseInt(v.dataset.rows,10);k<=p&&C<=g?v.classList.add("sd-selected"):v.classList.remove("sd-selected")}},c=({cols:f,rows:p})=>{n("select",{cols:f,rows:p})},d=(f,p,g)=>{let m=p-1,v=g-1;switch(f.key){case"ArrowRight":{if(m>=4)return;const k=v*Bm;s.value[k+m+1].setAttribute("tabindex","0"),s.value[k+m+1].focus(),l(s.value,p+1,g);break}case"ArrowLeft":{if(m<=0)return;const k=v*Bm;s.value[k+m-1].setAttribute("tabindex","0"),s.value[k+m-1].focus(),l(s.value,p-1,g);break}case"ArrowDown":{if(v>=4)return;const k=(v+1)*Bm;s.value[k+m].setAttribute("tabindex","0"),s.value[k+m].focus(),l(s.value,p,g+1);break}case"ArrowUp":{if(v<=0)return;const k=(v-1)*Bm;s.value[k+m].setAttribute("tabindex","0"),s.value[k+m].focus(),l(s.value,p,g-1);break}case"Enter":c({cols:p,rows:g});break;default:break}};return zn(()=>{s.value[0].setAttribute("tabindex","0"),s.value[0].focus(),l(s.value,1,1)}),(f,p)=>(ye(),Me("div",{class:Qt(["toolbar-table-grid-wrapper",{"high-contrast":et(i)}])},[He("div",{class:"toolbar-table-grid",onMouseover:a,"data-grid":"true"},[(ye(),Me(Kt,null,ar(5,g=>(ye(),Me(Kt,{key:g},[(ye(),Me(Kt,null,ar(5,m=>He("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:Zt(v=>d(v,m,g),["prevent"]),onClick:Zt(v=>c({cols:m,rows:g}),["stop","prevent"])},null,40,Bj)),64))],64))),64))],32),He("div",{class:"toolbar-table-grid-value","aria-valuetext":`${r.value} x ${o.value}`},zt(r.value)+" x "+zt(o.value),9,zj)],2))}},jj=fn(Vj,[["__scopeId","data-v-b87d6ca2"]]);Rt(),vn();var Uj={class:"toolbar-table-actions"},Hj=["onClick","data-item","ariaLabel"],$j={class:"toolbar-table-actions__icon"},Gj=["innerHTML"],Wj={class:"toolbar-table-actions__label"},Kj={__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(),Me("div",Uj,[(ye(!0),Me(Kt,null,ar(e.options,s=>(ye(),Me("div",{class:Qt(["toolbar-table-actions__item",{"toolbar-table-actions__item--border":s.bottomBorder}]),onClick:a=>r(s),"data-item":s.props?.["data-item"]||"",ariaLabel:s.props?.ariaLabel,role:"menuitem"},[He("div",$j,[He("div",{class:"toolbar-table-actions__icon-wrapper",innerHTML:s.icon},null,8,Gj)]),He("div",Wj,zt(s.label),1)],10,Hj))),256))]))}},qj=fn(Kj,[["__scopeId","data-v-0cdad084"]]),Yj=`<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
|
-
`;Rt();var Ws=e=>{e.expand.value=!1},jb=(e,t)=>{const n=e.layoutWidth?.value;return Number.isFinite(n)&&n>0?n:e.type==="separator"?t.get("separator"):t.get(e.name.value)||t.get("default")};function Ub(e,t){const n={...e};return t?n.href=t:delete n.href,n}function sI(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 Xj(e){return typeof e?.quotedText=="string"?e.quotedText:typeof e?.text=="string"?e.text:""}function aI(e){return e.ui?.selection?.get?.()??e.ui?.selection?.current?.()??null}function Zj(e){return!!(e.config?.superdoc?.config?.modules?.ai||e.superdoc?.config?.modules?.ai)}function Qj(e){return e.config?.superdoc?.config?.modules?.ai??e.superdoc?.config?.modules?.ai??{}}var Jj=({superToolbar:e,toolbarIcons:t,toolbarTexts:n,toolbarFonts:r,hideButtons:o,availableWidth:i,role:s,isDev:a=!1,configuredItemNames:l,excludedItemNames:c,additionalItems:d=[]}={})=>{const f=xn({type:"button",name:"bold",command:"toggleBold",icon:t.bold,tooltip:n.bold,attributes:{ariaLabel:"Bold"}}),p=(r??GV).map(QV),g=xn({type:"dropdown",name:"fontFamily",tooltip:n.fontFamily,command:"setFontFamily",defaultLabel:"Arial",label:"Arial",markName:"textStyle",labelAttr:"fontFamily",hasCaret:!0,hasInlineTextInput:!0,inlineTextInputVisible:!0,isWide:!0,style:{width:"116px"},suppressActiveHighlight:!0,attributes:{ariaLabel:"Font family"},options:p,onActivate:({fontFamily:Je}={},wt=!1)=>{if(wt){g.label.value="",g.selectedValue.value="";return}if(!Je)return;Je=Je.split(",")[0];const Dt=en=>en.value??en.label,sn=p.find(en=>Dt(en)===g.defaultLabel.value),pn=p.find(en=>Dt(en)===Je);pn?(g.label.value=pn.label,g.selectedValue.value=pn.key):sn?(g.label.value=Je,g.selectedValue.value=sn.key):(g.label.value=Je,g.selectedValue.value="")},onDeactivate:()=>{const Je=p.find(wt=>(wt.value??wt.label)===g.defaultLabel.value);g.label.value=Je?.label??g.defaultLabel.value,g.selectedValue.value=Je?.key??""}}),m=xn({type:"dropdown",name:"ai",dropdownStyles:{padding:0,outline:"none"},tooltip:n.ai,icon:t.ai,hideLabel:!0,hasCaret:!1,isWide:!0,suppressActiveHighlight:!0,attributes:{ariaLabel:"AI"},options:[{type:"render",key:"ai",render:()=>v(m)}]});function v(Je){const wt=aI(e),Dt=wt?.selectionTarget??sI(wt?.target),sn=wt?.empty?"":Xj(wt),pn=Qj(e),en=()=>Ws(Je),wn=()=>{const tn=e.pendingSelectionCapture;tn&&typeof e.ui?.selection?.restore=="function"&&e.ui.selection.restore(tn)};return Gr("div",{},[Gr(Aj,{handleClose:en,selectedText:sn,target:Dt,doc:e.superdoc?.activeEditor?.doc??null,apiKey:pn?.apiKey||e.config?.aiApiKey||"",endpoint:pn?.endpoint||e.config?.aiEndpoint||"",restoreSelection:wn})])}const k=KV,C=xn({type:"dropdown",name:"fontSize",defaultLabel:"12",label:"12",style:{width:"56px"},markName:"textStyle",labelAttr:"fontSize",tooltip:n.fontSize,hasCaret:!0,hasInlineTextInput:!0,inlineTextInputVisible:!0,suppressActiveHighlight:!0,isWide:!0,command:"setFontSize",attributes:{ariaLabel:"Font size"},options:k,onActivate:({fontSize:Je},wt=!1)=>{if(wt){C.label.value="",C.selectedValue.value="";return}const Dt=k.find(wn=>wn.label===String(C.defaultLabel.value));if(!Je){C.label.value=C.defaultLabel.value,Dt?C.selectedValue.value=Dt.key:C.selectedValue.value="";return}let sn=Vz(Je,12);sn<8&&(sn=8),sn>96&&(sn=96);let pn=String(sn);const en=k.find(wn=>wn.label===pn||wn.key===pn);en?C.selectedValue.value=en.key:C.selectedValue.value="",C.label.value=pn},onDeactivate:()=>{C.label.value=C.defaultLabel.value;const Je=k.find(wt=>wt.label===String(C.defaultLabel.value));Je?C.selectedValue.value=Je.key:C.selectedValue.value=""}}),S=()=>xn({type:"separator",name:"separator",isNarrow:!0}),w=xn({type:"button",name:"italic",command:"toggleItalic",icon:t.italic,active:!1,tooltip:n.italic,attributes:{ariaLabel:"Italic"}}),b=xn({type:"button",name:"underline",command:"toggleUnderline",icon:t.underline,active:!1,tooltip:n.underline,attributes:{ariaLabel:"Underline"}}),T=xn({type:"button",name:"strike",command:"toggleStrike",icon:t.strikethrough,active:!1,tooltip:n.strikethrough,attributes:{ariaLabel:"Strikethrough"}}),L=xn({type:"dropdown",name:"highlight",icon:t.highlight,hideLabel:!0,markName:"highlight",labelAttr:"color",active:!1,tooltip:n.highlight,command:"setHighlight",noArgumentCommand:"unsetHighlight",suppressActiveHighlight:!0,attributes:{ariaLabel:"Highlight"},options:[{key:"color",type:"render",render:()=>Vb(e,L,[],!0)}],onActivate:({color:Je})=>{L.iconColor.value=Je||""},onDeactivate:()=>L.iconColor.value=""}),N=xn({type:"dropdown",name:"color",icon:t.color,hideLabel:!0,markName:"textStyle",labelAttr:"color",active:!1,tooltip:n.color,command:"setColor",suppressActiveHighlight:!0,attributes:{ariaLabel:"Color"},options:[{key:"color",type:"render",render:()=>Vb(e,N)}],onActivate:({color:Je})=>{N.iconColor.value=Je},onDeactivate:()=>N.iconColor.value="#000"}),H=xn({type:"button",name:"search",allowWithoutEditor:!0,active:!1,icon:t.search,tooltip:n.search,group:"right",attributes:{ariaLabel:"Search"}}),z=xn({type:"dropdown",name:"link",markName:"link",icon:t.link,active:!1,tooltip:n.link,attributes:{ariaLabel:"Link dropdown"},options:[{type:"render",key:"linkDropdown",render:()=>B(z)}],onActivate:({href:Je})=>{z.attributes.value=Ub(z.attributes.value,Je)},onDeactivate:()=>{z.attributes.value=Ub(z.attributes.value,null),z.expand.value=!1}});function B(Je){const wt=aI(e),Dt=wt?.selectionTarget??sI(wt?.target),sn=()=>{const pn=e.pendingSelectionCapture;pn&&typeof e.ui?.selection?.restore=="function"&&e.ui.selection.restore(pn)};return Gr("div",{},[Gr(y_,{ui:e.ui,linkItem:Je,textTarget:Dt,restoreSelection:sn,closePopover:()=>{Ws(Je),Tc(e)},goToAnchor:()=>{Ws(Je);const pn=Je.attributes.value?.href;if(!pn)return;const en=pn.slice(1),wn=(e.ui?.viewport?.getHost?.()??null)?.querySelector?.(`a[name='${en}']`);wn&&b_(wn)}})])}const Z=xn({type:"options",name:"linkInput",command:"toggleLink",active:!1});z.childItem=Z,Z.parentItem=z;const R=xn({type:"button",name:"image",command:"startImageUpload",icon:t.image,active:!1,tooltip:n.image,disabled:!1,attributes:{ariaLabel:"Image"}}),K=xn({type:"button",name:"tableOfContents",command:"insertTableOfContents",icon:t.tableOfContents,active:!1,tooltip:n.tableOfContents,disabled:!1,attributes:{ariaLabel:"Table of contents"}}),x=xn({type:"dropdown",name:"table",icon:t.table,hideLabel:!0,labelAttr:"table",active:!1,tooltip:n.table,command:"insertTable",suppressActiveHighlight:!0,attributes:{ariaLabel:"Table"},options:[{key:"table",type:"render",render:()=>W(x)}]});function W(Je){return Gr("div",{},[Gr(jj,{onSelect:Dt=>{e.emitCommand({item:Je,argument:Dt}),Ws(Je),Tc(e)}})])}const $=xn({type:"dropdown",name:"tableActions",command:"executeTableCommand",tooltip:n.tableActions,icon:t.tableActions,hideLabel:!0,disabled:!0,attributes:{ariaLabel:"Table actions"},options:[{type:"render",render:()=>Q($)}]}),ee=[{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 Q(Je){return Gr(qj,{options:ee,onSelect:wt=>{Ws(Je);const{command:Dt}=wt;e.emitCommand({item:Je,argument:{command:Dt}}),Tc(e)}})}const X=xn({type:"dropdown",name:"textAlign",tooltip:n.textAlign,icon:t.alignLeft,command:"setTextAlign",hasCaret:!0,markName:"textAlign",labelAttr:"textAlign",suppressActiveHighlight:!0,attributes:{ariaLabel:"Text align"},options:[{type:"render",render:()=>Gr("div",{},[Gr(tj,{onSelect:wt=>{Ws(X);const Dt={...X,command:"setTextAlign"};Dt.command="setTextAlign",e.emitCommand({item:Dt,argument:wt}),we(X,wt),Tc(e)}})]),key:"alignment"}],onActivate:({textAlign:Je})=>{we(X,Je)},onDeactivate:()=>{we(X,"left")}}),we=(Je,wt)=>{let Dt=wt==="both"?"justify":wt,sn={left:t.alignLeft,right:t.alignRight,center:t.alignCenter,justify:t.alignJustify},pn=sn[Dt]??sn.left;Je.icon.value=pn},ce=xn({type:"dropdown",name:"list",command:"toggleBulletListStyle",splitButton:!0,splitButtonCommand:"toggleBulletList",icon:t.bulletList,hasCaret:!0,tooltip:n.bulletList,restoreEditorFocus:!0,attributes:{ariaLabel:"Bullet list"},options:[{type:"render",key:"bullet-style-buttons",render:()=>{const Je=wt=>{Ws(ce);const Dt={...ce,command:"toggleBulletListStyle"};e.emitCommand({item:Dt,argument:wt})};return Gr(oI,{buttons:oj,iconSize:25,selectedStyle:ce.selectedValue.value,onSelect:Je})}}]}),be=xn({type:"dropdown",name:"numberedlist",command:"toggleOrderedListStyle",splitButton:!0,splitButtonCommand:"toggleOrderedList",icon:t.numberedList,hasCaret:!0,tooltip:n.numberedList,restoreEditorFocus:!0,attributes:{ariaLabel:"Numbered list"},options:[{type:"render",key:"numbered-style-buttons",render:()=>{const Je=wt=>{Ws(be);const Dt={...be,command:"toggleOrderedListStyle"};e.emitCommand({item:Dt,argument:wt})};return Gr(oI,{buttons:ij,iconSize:30,selectedStyle:be.selectedValue.value,onSelect:Je})}}]}),ve=xn({type:"button",name:"indentleft",command:"decreaseTextIndent",icon:t.indentLeft,active:!1,tooltip:n.indentLeft,disabled:!1,attributes:{ariaLabel:"Left indent"}}),Ee=xn({type:"button",name:"indentright",command:"increaseTextIndent",icon:t.indentRight,active:!1,tooltip:n.indentRight,disabled:!1,attributes:{ariaLabel:"Right indent"}}),Pe=xn({type:"overflow",name:"overflow",command:null,icon:t.overflow,active:!1,disabled:!1,attributes:{ariaLabel:"Overflow items"}}),Ze=xn({type:"dropdown",name:"zoom",allowWithoutEditor:!0,tooltip:n.zoom,defaultLabel:"100%",label:"100%",hasCaret:!0,command:"setZoom",isWide:!0,style:{width:"71px",minWidth:"71px"},inlineTextInputVisible:!1,hasInlineTextInput:!0,attributes:{ariaLabel:"Zoom"},options:[{label:"50%",key:.5,props:{"data-item":"btn-zoom-option"}},{label:"75%",key:.75,props:{"data-item":"btn-zoom-option"}},{label:"90%",key:.9,props:{"data-item":"btn-zoom-option"}},{label:"100%",key:1,props:{"data-item":"btn-zoom-option"}},{label:"125%",key:1.25,props:{"data-item":"btn-zoom-option"}},{label:"150%",key:1.5,props:{"data-item":"btn-zoom-option"}},{label:"200%",key:2,props:{"data-item":"btn-zoom-option"}}],onActivate:({zoom:Je})=>{Je&&(Ze.label.value=Je)}}),at=xn({type:"dropdown",name:"measurementUnit",allowWithoutEditor:!0,tooltip:n.measurementUnit,defaultLabel:"in",label:"in",hasCaret:!0,command:"setMeasurementUnit",group:"right",style:{width:"52px",minWidth:"52px"},inlineTextInputVisible:!1,hasInlineTextInput:!1,attributes:{ariaLabel:"Measurement unit"},options:[{label:"Inches",key:"in",props:{"data-item":"btn-measurement-unit-option"}},{label:"Centimeters",key:"cm",props:{"data-item":"btn-measurement-unit-option"}}],onActivate:({measurementUnit:Je})=>{Je&&(at.label.value=Je)}}),Qe=xn({type:"button",name:"undo",disabled:!0,tooltip:n.undo,command:"undo",icon:t.undo,group:"left",attributes:{ariaLabel:"Undo"}}),At=xn({type:"button",disabled:!0,name:"redo",tooltip:n.redo,command:"redo",icon:t.redo,group:"left",attributes:{ariaLabel:"Redo"}}),se=xn({type:"button",disabled:!1,name:"acceptTrackedChangeBySelection",tooltip:n.trackChangesAccept,command:"acceptTrackedChangeFromToolbar",icon:t.trackChangesAccept,group:"left",attributes:{ariaLabel:"Accept tracked changes"}}),Ie=xn({type:"button",disabled:!1,name:"rejectTrackedChangeOnSelection",tooltip:n.trackChangesReject,command:"rejectTrackedChangeFromToolbar",icon:t.trackChangesReject,group:"left",attributes:{ariaLabel:"Reject tracked changes"}}),Ue=xn({type:"button",name:"clearFormatting",command:"clearFormat",tooltip:n.clearFormatting,icon:t.clearFormatting,attributes:{ariaLabel:"Clear formatting"}}),ne=xn({type:"button",name:"copyFormat",tooltip:n.copyFormat,icon:t.copyFormat,command:"copyFormat",active:!1,attributes:{ariaLabel:"Copy formatting"}}),A=(Je,wt)=>Je==="editor"?wt:Je==="suggester"?wt.filter(Dt=>Dt.value==="suggesting"):wt.filter(Dt=>Dt.value==="viewing"),ie=Je=>Je==="editor"?"Editing":Je==="suggester"?"Suggesting":"Viewing",F=xn({type:"dropdown",name:"documentMode",command:"setDocumentMode",allowWithoutEditor:!0,icon:t.documentMode,defaultLabel:ie(s),label:ie(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:()=>O(F)}]}),Y=[{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 O(Je){return Gr(hj,{options:A(s,Y),onSelect:wt=>{const Dt=e.superdoc?.activeEditor??e.activeEditor;Ws(Je);const{label:sn,icon:pn,value:en}=wt;F.label.value=sn,F.icon.value=pn,e.emitCommand({item:F,argument:en}),Tc(e,Dt)}})}const V=new Map([["separator",20],["zoom",71],["measurementUnit",52],["fontFamily",118],["fontSize",57],["textAlign",40],["linkedStyles",142],["documentMode",47],["default",32]]),oe=["search","ruler","undo","overflow","documentMode"],U=xn({type:"button",name:"ruler",command:"toggleRuler",allowWithoutEditor:!0,icon:t.ruler,active:!1,tooltip:n.ruler,attributes:{ariaLabel:"Ruler"}}),G=xn({type:"button",name:"formattingMarks",command:"toggleFormattingMarks",allowWithoutEditor:!0,icon:t.formattingMarks,active:!1,tooltip:n.formattingMarks,attributes:{ariaLabel:"Formatting marks"}}),ge=xn({type:"dropdown",name:"linkedStyles",command:"setLinkedStyle",tooltip:n.linkedStyles,icon:t.paintbrush,defaultLabel:n.formatText,label:n.formatText,hasCaret:!0,isWide:!0,style:{width:"140px"},suppressActiveHighlight:!0,disabled:!1,attributes:{className:"sd-toolbar-item--linked-styles",ariaLabel:"Linked styles"},options:[{type:"render",key:"linkedStyle",render:()=>{const Je=Dt=>{Ws(ge);const sn=typeof Dt=="string"?Dt:Dt?.id??null;if(!sn)return;const pn={...ge,command:"setLinkedStyle"};e.emitCommand({item:pn,argument:sn})},wt=e.getActiveLinkedStyleId?.()??null;return Gr("div",{},[Gr(vj,{styles:e.getLinkedStyleOptions?.()??[],onSelect:Je,selectedOption:wt})])}}],onActivate:({styleId:Je,styleName:wt})=>{const Dt=wt||Je;ge.label.value=Je&&Je!=="Normal"?String(Dt):n.formatText,ge.disabled.value=!1},onDeactivate:()=>{ge.disabled.value=!0,ge.label.value=n.formatText}}),Ae=(Je,wt)=>{if(wt.value==Je)return Gr("div",{innerHTML:Yj,class:"dropdown-select-icon"})},Se=xn({type:"dropdown",name:"lineHeight",tooltip:n.lineHeight,icon:t.lineHeight,hasCaret:!1,hasInlineTextInput:!1,hideLabel:!0,inlineTextInputVisible:!1,suppressActiveHighlight:!0,restoreEditorFocus:!0,isWide:!1,command:"setLineHeight",dropdownValueKey:"key",selectedValue:"1",attributes:{ariaLabel:"Line height"},options:[1,1.15,1.5,2,2.5,3].map(Je=>({label:Je.toFixed(2),key:Je,icon:()=>Ae(Je,Se.selectedValue),props:{"data-item":"btn-lineHeight-option"}}))}),Te=20,Ye=32,rt=["linkedStyles","clearFormatting","copyFormat","formattingMarks"],ht=["zoom","fontFamily","fontSize","redo"],Pt=i<=ah.lg,Ft=e.config?.showFormattingMarksButton===!0,Wt=e.config?.showTableOfContentsButton===!0;Pt&&(F.attributes.value={...F.attributes.value,className:`${F.attributes.value.className} sd-toolbar-item--doc-mode-compact`}),Pt&&(ge.attributes.value={...ge.attributes.value,className:`${ge.attributes.value.className} sd-toolbar-item--linked-styles-compact`});let $e=[Qe,At,se,Ie,H,Ze,g,S(),C,S(),f,w,b,T,N,L,S(),z,R,...Wt?[K]:[],x,$,S(),X,ce,be,ve,Ee,Se,S(),ge,S(),U,at,...Ft?[G]:[],ne,Ue,...Zj(e)?[m]:[],Pe,F,...d];if(i<=ah.md&&o&&($e=$e.filter(Je=>Je.type!=="separator")),e.config.mode!=="docx"){const Je=$e.findIndex(Dt=>Dt.name.value==="linkedStyles");$e.splice(Je-1,2);const wt=["ruler","zoom","undo","redo"];$e=$e.filter(Dt=>!wt.includes(Dt.name.value))}const cn=[];a||(s==="viewer"&&cn.push(se,Ie),$e=$e.filter(Je=>!cn.includes(Je))),l&&($e=$e.filter(Je=>Je.name.value==="overflow"||Je.isCustomToolbarItem||l.has(Je.name.value))),c?.size&&($e=$e.filter(Je=>!c.has(Je.name.value)));const jn=Je=>oe.includes(Je.name.value),Ut=$e.find(Je=>Je.name.value==="overflow"),In=$e.filter(Je=>Je!==Ut),qr=Je=>{const wt=[],Dt=[],sn=In.filter(jn).reduce((en,wn)=>en+jb(wn,V),0);let pn=Ye+sn+(Je&&Ut?jb(Ut,V):0);return In.forEach((en,wn)=>{const tn=jb(en,V);if(en.type==="separator"&&In[wn-1]?.name.value==="linkedStyles"&&wt.includes(In[wn-1])){wt.push(en);return}if(i<ah.xl+Te&&rt.includes(en.name.value)&&o){wt.push(en);return}if(i<ah.sm&&ht.includes(en.name.value)&&o){wt.push(en);return}if(jn(en)){Dt.push(en);return}pn+tn<=i||!o?(Dt.push(en),pn+=tn):wt.push(en)}),{visibleItems:Dt,overflowItems:wt}};let{visibleItems:Cr,overflowItems:Er}=qr(!1);if(o&&Ut&&Er.some(Je=>Je.type!=="separator")){({visibleItems:Cr,overflowItems:Er}=qr(!0));const Je=$e.indexOf(Ut),wt=Cr.findIndex(Dt=>$e.indexOf(Dt)>Je);wt===-1?Cr.push(Ut):Cr.splice(wt,0,Ut)}return{defaultItems:Cr,overflowItems:Er.filter(Je=>Je.type!=="separator")}},lI={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"},eU=e=>e?typeof e!="string"?e instanceof HTMLElement?e:null:e.startsWith("#")||e.startsWith(".")?document.querySelector(e):document.getElementById(e):null;Rt();function cI(e){return Mz(e)??zb[e]??null}function zm(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),s=a=>{!r.reportUnhandled||a!==!1||r.onError?.(new Error(`[superdoc toolbar] Command "${t}" did not run. Check that it is enabled and has the required input.`))};return i&&typeof i.then=="function"?Promise.resolve(i).then(a=>{s(a),r.onSettled?.()},a=>{r.onError?.(a),r.onSettled?.()}):(s(i),r.onSettled?.()),!0}var tU=new Set(["bold","italic","underline","strike","color","highlight","link","clearFormatting","textAlign","list","numberedlist","indentleft","indentright","lineHeight","linkedStyles"]),nU=new Set(["list","numberedlist"]);function rU(e,t){if(e==="fontFamily"||e==="fontSize"||nU.has(e)&&t?.disabled&&t?.supported!==!1&&t?.reason==null)return!0;if(!tU.has(e))return!1;const n=t?.reason;return n==="range-selection-required"||n==="selection-required"}function uI(e){return!!e?.closest?.("[data-editor-ui-surface], .toolbar-dropdown-menu, .sd-toolbar-dropdown-menu, .sd-tooltip-content")}function oU(e){return["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key)}var iU=new Set([...Lz,...Object.keys(Rm),"ai","overflow","tableOfContents"]),sU=class extends Ig.default{config={selector:null,toolbarGroups:["left","center","right"],role:"editor",icons:{...lr},texts:{...lI},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;_linkedStyleOptions=$r([]);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={...lr,...e.icons},this.config.texts={...lI,...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=eU(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.#c(),this.#i(),this._lastFontOptionsSignature=this.#r(),!this.toolbarContainer){this.updateToolbarState();return}this.app=mc(ZV),this.app.directive("click-outside",xy),this.app.config.globalProperties.$toolbar=this,this.toolbar=this.app.mount(this.toolbarContainer),this.updateToolbarState()}catch(t){try{this.destroy()}catch{}throw t}}#t(){this.ui=this.superdoc?.ui??null,this.ui&&(this.snapshot=this.ui.toolbar.getSnapshot(),this._unsubscribeController=this.ui.toolbar.subscribe(()=>{this.snapshot=this.ui.toolbar.getSnapshot(),this.getToolbarItemByName("linkedStyles")?.expand.value&&this.#p(),this.updateToolbarState()}),this._detachFormatPainterModeChange=this.ui.formatPainter.onModeChange(e=>{e==="armed"||e==="persistent"?this.#f():this.#C()}))}#o(){this._unsubscribeController?.(),this._unsubscribeController=null,this._detachFormatPainterModeChange?.(),this._detachFormatPainterModeChange=null,this.#C();for(const e of this._customCommandRegs.values())try{e.unregister?.()}catch{}this._customCommandRegs.clear(),this.ui=null,this.snapshot=null}#i(){if(!this.superdoc||typeof this.superdoc.on!="function"||typeof this.superdoc.off!="function")return;const e=()=>{const t=this.#r();t!==this._lastFontOptionsSignature&&(this._lastFontOptionsSignature=t,this.#g()),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}#u(e){return e||WV(this.superdoc?.fonts?.getFontFamilyOptions?.()??[])}#c(){const e=this.getAvailableWidth(),t=new Map(this.#a().filter(k=>k.isCustomToolbarItem&&k.type==="dropdown").map(k=>[k.name.value,k.selectedValue.value])),n=this.config.groups&&!Array.isArray(this.config.groups)&&Object.keys(this.config.groups).length>0,r=n?new Set(Object.values(this.config.groups).flatMap(k=>k)):null,o=new Set(this.config.excludeItems),i=this.config.customButtons||[],s=new Set(iU),a=i.map((k,C)=>{try{if(k?.name&&s.has(k.name))throw new Error(`Toolbar item name "${k.name}" is already taken by another item, so this entry is skipped.`);const S=this.#h(k);return t.has(S.name.value)&&(S.selectedValue.value=t.get(S.name.value)),s.add(S.name?.value),S}catch(S){const w=`${k?.name??`<unnamed@${C}>`}::${S?.message??String(S)}`;return this._reportedInvalidCustomItems.has(w)||(this._reportedInvalidCustomItems.add(w),this.#m(S,k?.name??null)),null}}).filter(Boolean),l=n?new Set(Object.keys(this.config.groups)):null,c=l?a.filter(k=>l.has(k.group?.value||"center")):a,{defaultItems:d,overflowItems:f}=Jj({superToolbar:this,toolbarIcons:this.config.icons,toolbarTexts:this.config.texts,toolbarFonts:this.#u(this.config.fonts),hideButtons:this.config.hideButtons,availableWidth:e,role:this.role,isDev:this.isDev,configuredItemNames:r,excludedItemNames:o,additionalItems:c});let p=[...d.map(k=>k.name.value),...f.map(k=>k.name.value)];if(n){const k=Object.values(this.config.groups).flatMap(S=>S),C=a.filter(S=>l.has(S.group?.value||"center")).map(S=>S.name.value);p=[...new Set([...k,...C])]}const g=f.filter(k=>p.includes(k.name.value)&&!o.has(k.name.value)),m=g.length?[...p,"overflow"]:p,v=d.filter(k=>m.includes(k.name.value)).filter(k=>!o.has(k.name.value));if(n)for(const[k,C]of Object.entries(this.config.groups))for(const S of v)C.includes(S.name.value)&&(S.group.value=k);this.toolbarItems=v,this.overflowItems=g}#h(e){const t=xn({...e});t.isCustomToolbarItem=!0;const n=e.command;if(typeof n=="function"&&this.ui?.commands?.register){const r=`__builtin_toolbar__${e.name}`;if(!this._customCommandRegs.has(r)){const o=this.ui.commands.register({id:r,execute:i=>{const s=i?.payload&&typeof i.payload=="object"?i.payload:{};try{const a=n({...i,item:t,argument:s.argument,option:s.option});return a&&typeof a.then=="function"?Promise.resolve(a).catch(l=>(this.#m(l,e.name),!1)):a}catch(a){return this.#m(a,e.name),!1}}});this._customCommandRegs.set(r,o)}}return t}#g(){this.#c(),this.emit("toolbar-items-changed")}#r(){if(this.config.fonts)return"custom-fonts";const e=this.superdoc?.fonts?.getFontFamilyOptions?.()??[];return JSON.stringify(e.map(t=>[t.label,t.value,t.previewFamily]))}getToolbarItemByGroup(e){return this.toolbarItems.filter(t=>(t.group?.value||"center")===e)}getToolbarItemByName(e){return this.#a().find(t=>t.name.value===e)}#a(){return[...this.toolbarItems,...this.overflowItems]}getLinkedStyleOptions(){return this.#p(),this._linkedStyleOptions.value}#p(){this.ui?.styles?.getCatalog?.({includePreview:!0});const e=this.ui?.styles?.getCatalog?.({view:"quickGallery",includePreview:!0})?.items??this.ui?.styles?.getQuickGallery?.()??[];e!==this._linkedStyleOptions.value&&(this._linkedStyleOptions.value=e)}getActiveLinkedStyleId(){return this.ui?.styles?.getActiveParagraphStyle?.()?.styleId??null}setActiveEditor(e){this.activeEditor=e;const t=this.#r();t!==this._lastFontOptionsSignature&&(this._lastFontOptionsSignature=t,this.#g()),this.ui&&(this.snapshot=this.ui.toolbar.getSnapshot()),this.updateToolbarState()}onToolbarResize=()=>{this.#c(),this.updateToolbarState()};#k(e){return e==="ruler"?!!this.superdoc?.config?.rulers:e==="formattingMarks"?!!this.superdoc?.config?.layoutEngineOptions?.showFormattingMarks:!1}#b(e){return e==="ruler"?typeof this.superdoc?.toggleRuler=="function":e==="formattingMarks"?typeof this.superdoc?.toggleFormattingMarks=="function"||typeof this.superdoc?.setShowFormattingMarks=="function":!1}#A(){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)}#S(){const e=this.toolbarItems.find(n=>n.name.value==="highlight");if(!e)return;const t={key:"color",type:"render",render:()=>Vb(this,e,[],!0)};e.nestedOptions.value=[t]}#L(e){return!!e?.active&&e?.value==null}#D(e){return!!e&&e.disabled===!1&&e.value==null}#v(e){const t=e.name.value;if(e.isCustomToolbarItem&&typeof e.command=="string"){const i=this.snapshot?.commands?.[e.command];return e.setDisabled(e.initiallyDisabled||!i||!!i.disabled),i?.active?e.activate():e.deactivate(),!0}if(t==="tableActions"){const i=rI.map(s=>this.snapshot?.commands?.[s]).some(s=>s&&!s.disabled);return e.setDisabled(!i),!0}if(t==="search")return e.setDisabled(this.superdoc?.uiConfig?.search?.enabled!==!0),!0;if(Nb(t)?.disposition==="host-routed")return e.setDisabled(!this.#b(t)),this.#k(t)?e.activate():e.deactivate(),!0;const n=cI(t);if(!n)return!1;const r=this.snapshot?.commands?.[n];rU(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.#A()},link:()=>{e.active.value=!!r?.active,e.attributes.value=Ub(e.attributes.value,r?.value??null)},fontFamily:()=>{if(r?.value!=null){e.activate({fontFamily:r.value});return}if(this.#D(r)){e.activate({},!0);return}e.deactivate()},fontSize:()=>{if(r?.value!=null){e.activate({fontSize:r.value});return}if(this.#L(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.#A(),this.#S();const e=this.snapshot?.commands?.["document-mode"]?.value||"editing";!(this.snapshot&&(this.superdoc?.activeEditor??this.activeEditor))||e==="viewing"?(this.#w(),this.#a().forEach(n=>{const r=n.isCustomToolbarItem&&typeof n.command=="string";(n.allowWithoutEditor?.value||r)&&this.#v(n)})):this.#a().forEach(n=>{n.resetDisabled(),this.#v(n)});const t=this.getToolbarItemByName("copyFormat");t&&(this.snapshot?.copyFormatActive?t.activate():t.deactivate()),this.emit("toolbar-state-change")}#w(){this.#a().forEach(e=>{const{allowWithoutEditor:t}=e;t?.value||e.setDisabled(!0)})}#T(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}#x(e,t){const n=e?.name?.value;if(!n)return!1;const r={onSettled:()=>this.updateToolbarState(),onError:i=>this.#m(i,n)};if(n==="image"&&t==null)return this.#I();if(n==="tableActions"){const i=nI[t?.command];return i?zm(this.ui,i,void 0,r):!1}if(Nb(n)?.disposition==="unsupported")return!0;const o=cI(n);return o?zm(this.ui,o,t,r):!1}#I(){return this.snapshot?.commands?.image?.disabled||(this.#e||(this.#e=zz({ownerDocument:this.toolbarContainer?.ownerDocument??document,onPick:async e=>{const t=await Nz(e,this.superdoc?.config?.handleImageUpload);zm(this.ui,"image",{src:t},{onSettled:()=>this.updateToolbarState(),onError:n=>this.#m(n,"image")})},onError:e=>this.#m(e,"image")})),this.#e.open()),!0}#f(){if(this.#n)return;const e=this.superdoc?.activeEditor?.container??document,t=i=>{uI(i.target)||this.ui.formatPainter.setPointerSelecting(!0)},n=i=>{this.ui.formatPainter.setPointerSelecting(!1),!uI(i.target)&&this.ui.formatPainter.notifyPointerUp()},r=i=>{if(i.key==="Escape"){this.ui.formatPainter.cancel();return}oU(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)}}#C(){this.#n&&(this.#n(),this.#n=null)}#m(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(Nb(r)?.disposition==="host-routed"){this.#T(r,t),this.updateToolbarState();return}if(typeof o=="function"){const s=`__builtin_toolbar__${r}`;if(this._customCommandRegs.has(s)&&this.ui?.commands?.execute)this.ui.commands.execute(s,{argument:t,option:n});else{const a=o({item:e,argument:t,option:n,ui:this.ui,superdoc:this.superdoc});a&&typeof a.then=="function"&&Promise.resolve(a).catch(l=>this.#m(l,r))}this.updateToolbarState();return}if(e?.isCustomToolbarItem&&typeof o=="string"){if(!zm(this.ui,o,t,{onSettled:()=>this.updateToolbarState(),onError:s=>this.#m(s,r),reportUnhandled:!0}))throw new Error(`[superdoc toolbar] Command not handled: ${String(o)}`);this.updateToolbarState();return}if(!this.#x(e,t)&&o)throw new Error(`[superdoc toolbar] Command not handled: ${String(o)}`);this.updateToolbarState()}catch(s){this.#m(s,r)}}}destroy(){this.#C(),this.#e?.destroy(),this.#e=null,this.#s(),this.#o(),this.app?.unmount(),this.app=null,this.toolbar=null}};function aU(e){return new sU(e)}function lU(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 cU(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=Vm(e.color);n!=null&&(t.color=n),e.highlight!=null&&(t.highlight=e.highlight);const r=dU(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=uU(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=fU(e.border);return i&&(t.border=i),t}function Vm(e){if(e){if(typeof e=="string")return e;if(e.model==="rgb")return e.value;if(e.model==="auto")return"auto"}}function uU(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 dU(e){if(!e)return;const t={},n=Vm(e.fill);n!=null&&(t.fill=n);const r=Vm(e.color);return r!=null&&(t.color=r),e.pattern!=null&&(t.val=e.pattern),Object.keys(t).length>0?t:void 0}function fU(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=Vm(e.color);return n!=null&&(t.color=n),Object.keys(t).length>0?t:void 0}function xc(e){const t=e?.selectionTarget??e?.target;if(!e||!t)return"";try{return JSON.stringify(t)}catch{return String(t)}}var hU=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"]),pU=e=>e?.type!=="mutation:committed"||e.origin!=="command"?!1:hU.has(e.editableCommandKind);function dI(e){return e.split(",").map(t=>t.trim()).filter(Boolean)}function mU(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 dI(r))n(o);return n(e.getAttribute("data-track-change-id")),t}function fI(e,t){if(!e||typeof e.getAttribute!="function")return[];const n=[],r=new Set;let o=[],i=e;for(;i;){const s=i,a=mU(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 dI(f)){const v=`comment:${m}`;r.has(v)||(r.add(v),n.push({type:"comment",id:m}))}const p=s.getAttribute("data-sdt-type"),g=s.getAttribute("data-sdt-id");if(g&&p==="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 go=()=>({oneOf:[{type:"boolean"},{type:"null"}]}),Ol=()=>({oneOf:[{type:"string",minLength:1},{type:"null"}]}),Zu=()=>({oneOf:[{type:"number"},{type:"null"}]}),Qu=e=>({oneOf:[{type:"object",properties:e,additionalProperties:!1,minProperties:1},{type:"null"}]}),gU={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},vU={type:"object",properties:{id:{type:"number"},val:{type:"boolean"}},required:["id"],additionalProperties:!1},yU=()=>({oneOf:[{type:"boolean"},{type:"null"},gU]}),bU=()=>({oneOf:[{type:"array",items:vU,minItems:1},{type:"null"}]});function jm(e,t){return{storage:"mark",markName:e,textStyleAttr:t}}function wU(e){return{storage:"runAttribute",nodeName:"run",runPropertyKey:e}}var Hb=(e,t,n)=>({key:e,type:"boolean",ooxmlElement:t,storage:"mark",tracked:!0,carrier:jm(n),schema:go()}),Rc=(e,t,n,r,o)=>({key:e,type:t,ooxmlElement:n,storage:"mark",tracked:!0,carrier:jm("textStyle",o??e),schema:r}),Hn=(e,t,n,r,o)=>({key:e,type:t,ooxmlElement:n,storage:"runAttribute",tracked:!1,carrier:wU(o??e),schema:r}),Um=[Hb("bold","w:b","bold"),Hb("italic","w:i","italic"),Hb("strike","w:strike","strike"),{key:"underline",type:"object",ooxmlElement:"w:u",storage:"mark",tracked:!0,carrier:jm("underline"),schema:yU()},{key:"highlight",type:"string",ooxmlElement:"w:highlight",storage:"mark",tracked:!0,carrier:jm("highlight"),schema:Ol()},Rc("color","string","w:color",Ol()),Rc("fontSize","number","w:sz",Zu()),Rc("fontFamily","string","w:rFonts",Ol()),Rc("letterSpacing","number","w:spacing",Zu()),Rc("vertAlign","string","w:vertAlign",{oneOf:[{enum:["superscript","subscript","baseline"]},{type:"null"}]}),Rc("position","number","w:position",Zu()),Hn("dstrike","boolean","w:dstrike",go()),Hn("smallCaps","boolean","w:smallCaps",go()),Rc("caps","boolean","w:caps",go(),"textTransform"),Hn("shading","object","w:shd",Qu({fill:{oneOf:[{type:"string",minLength:1},{type:"null"}]},color:{oneOf:[{type:"string",minLength:1},{type:"null"}]},val:{oneOf:[{type:"string",minLength:1},{type:"null"}]}})),Hn("border","object","w:bdr",Qu({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"),Hn("outline","boolean","w:outline",go()),Hn("shadow","boolean","w:shadow",go()),Hn("emboss","boolean","w:emboss",go()),Hn("imprint","boolean","w:imprint",go()),Hn("charScale","number","w:w",Zu(),"w"),Hn("kerning","number","w:kern",Zu(),"kern"),Hn("vanish","boolean","w:vanish",go()),Hn("webHidden","boolean","w:webHidden",go()),Hn("specVanish","boolean","w:specVanish",go()),Hn("rtl","boolean","w:rtl",go()),Hn("cs","boolean","w:cs",go()),Hn("bCs","boolean","w:bCs",go(),"boldCs"),Hn("iCs","boolean","w:iCs",go(),"italicCs"),Hn("eastAsianLayout","object","w:eastAsianLayout",Qu({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"}]}})),Hn("em","string","w:em",Ol()),Hn("fitText","object","w:fitText",Qu({val:{oneOf:[{type:"number"},{type:"null"}]},id:{oneOf:[{type:"string",minLength:1},{type:"null"}]}})),Hn("snapToGrid","boolean","w:snapToGrid",go()),Hn("lang","object","w:lang",Qu({val:{oneOf:[{type:"string",minLength:1},{type:"null"}]},eastAsia:{oneOf:[{type:"string",minLength:1},{type:"null"}]},bidi:{oneOf:[{type:"string",minLength:1},{type:"null"}]}})),Hn("oMath","boolean","w:oMath",go()),Hn("rStyle","string","w:rStyle",Ol(),"styleId"),Hn("rFonts","object","w:rFonts",Qu({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"),Hn("fontSizeCs","number","w:szCs",Zu()),Hn("ligatures","string","w14:ligatures",Ol()),Hn("numForm","string","w14:numForm",Ol()),Hn("numSpacing","string","w14:numSpacing",Ol()),Hn("stylisticSets","array","w14:stylisticSets",bU()),Hn("contextualAlternates","boolean","w14:cntxtAlts",go())],yW=new Set(Um.map(e=>e.key)),CU=Object.fromEntries(Um.map(e=>[e.key,e])),bW={mark:Um.filter(e=>e.storage==="mark").map(e=>e.key),runAttribute:Um.filter(e=>e.storage==="runAttribute").map(e=>e.key)};function Ua(){return typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now()}function Hm(){const e=globalThis;return{sink:typeof e.__superdocV2BenchPipelineTiming=="function"?e.__superdocV2BenchPipelineTiming:null,workerContext:e.__superdocV2BenchWorkerMessageContext??null}}function $b(e){const{sink:t}=Hm();if(t)try{t(e)}catch{}}var Gb=new WeakMap;function kU(e){let t=Gb.get(e);return t||(t={refCount:0,generation:0,abortController:new AbortController,inFlight:null,activeMutationTokens:new Set},Gb.set(e,t)),t.refCount+=1,t}function SU(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(),Gb.delete(e))}var _U=new Set(Object.values(lt));function $m(e,t){return typeof e=="string"&&_U.has(e)?e:t}function hI(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:$m(t,lt.targetUnresolved)}}return{ok:!0}}var AU=["document-replaced","editorCreate","active-editor-change","document-mode-change","zoomChange","measurement-unit-change","viewport-change","fonts-changed"],IU={[HA.bulletList]:"bullet",[HA.numberedList]:"ordered"};function pI(e){return IU[e]??null}var EU={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 TU(e){const t=EU[e];return t?{preset:t,behavior:"toggleStyle"}:{}}var xU={status:"ready",empty:!0,target:null,selectionTarget:null,activeMarks:[],activeCommentIds:[],activeChangeIds:[],quotedText:""},RU=[{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"}],LU=new Set(["/word/comments.xml","/word/commentsExtended.xml","/word/commentsIds.xml"]);function MU(e){return RU.some(t=>t.match==="exact"?t.key===e:e.startsWith(t.key))}var mI={ready:0,stale:1,pending:2};function Pl(...e){let t="ready";for(const n of e)mI[n]>mI[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 Pr(e){return!!e&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"}function wr(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 Yn(e,t="CAPABILITY_UNAVAILABLE"){return{success:!1,failure:{code:t,message:e}}}function lh(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 ch(e){if(!e||typeof e!="object")return null;const t=e.target;return t&&typeof t=="object"?t:null}function Wb(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 gI(e,t){if(!e||typeof e!="object")return null;const n=ch(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||!Wb(n))return i}return n}function tr(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 uh(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=ch(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 $i(e,t,n){return Kr(e)!==t?!1:n?tr(uh(e))===tr(n):!0}function Gm(e){const t=uh(e);if(!(!t||tr(t)===tr(null)))return t}function DU(e){if(typeof e!="string"||e.length===0)return;const t=BT(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 OU(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 Kb(e){if(!e||typeof e!="object")return null;const t=e.selectionTarget;return t&&typeof t=="object"?t:null}function Wm(e){if(!e||typeof e!="object")return null;const t=e.id;return typeof t=="string"&&t.length>0?t:null}function PU(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 Kr(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 Ju(e){return typeof e=="string"?e.trim():""}function FU(e,t){const n=t??{},r=Ju(n.id).toLowerCase(),o=Ju(e.authorId).toLowerCase();if(r&&o)return r===o;const i=Ju(n.email).toLowerCase(),s=Ju(e.authorEmail).toLowerCase();if(i&&s)return i===s;if(r||i||o||s)return!1;const a=Ju(e.author).replace(/\s+/g," ").toLowerCase();if(!a)return!0;const l=Ju(n.name).replace(/\s+/g," ").toLowerCase();return!!(l&&l===a)}function NU(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 vI=new WeakMap;function yI(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 Ks(e){const t=vI.get(e);if(t)return t;const n=new Set,r=new Map;for(const i of e){const s=Kr(i);if(s){n.add(s);for(const a of yI(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 vI.set(e,o),o}var bI=new WeakMap,wI=new WeakMap;function Lc(e,t){const n=tr(t);let r=bI.get(e);r||(r=new Map,bI.set(e,r));const o=r.get(n);if(o)return o;const i=Ks(e.filter(s=>tr(uh(s))===n));return r.set(n,i),i}function BU(e){return!!e&&typeof e=="object"&&e.storyType==="textbox"}function zU(e,t){const n=t.filter(o=>e.some(i=>Kr(i)===o&&uh(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=>Kr(s)===o);if(i)for(const s of yI(i)){if(r.has(s))return null;r.add(s)}}return n[0]}function VU(e){const t=wI.get(e);if(t)return t;const n=e.filter(o=>uh(o)!=null),r=n.length===e.length?e:n;return wI.set(e,r),r}function jU(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=us(r),l=tr(a)===tr(null);if(i){const c=l?VU(i):i,d=s(Lc(c,a));if(d)return d;const f=n?.find(p=>c.some(g=>$i(g,p,a)));return f||(l?s(Ks(o)):BU(a)?zU(i,t):null)}return l?s(Ks(o))??t[0]??null:null}function UU(e,t){const n=e.find(r=>Kr(r)===t||r.importedId===t);return n?n.rootCommentId??n.parentCommentId??Kr(n)??t:null}function HU(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 Fr(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 $U=64;function Mc(e){return e.length<=$U}function us(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 _o(e,t){return{kind:"block",nodeType:"paragraph",nodeId:e,...t&&typeof t=="object"?{story:t}:{}}}function Ha(e){return{kind:"block",nodeType:"paragraph",nodeId:e}}function CI(e,t){return{kind:"block",nodeType:"listItem",nodeId:e,...t&&typeof t=="object"?{story:t}:{}}}var kI=720;function qs(e){return Math.round(e*20)}function ed(e){return typeof e=="number"&&Number.isFinite(e)}function GU(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=ed(i.left)?qs(i.left):ed(i.start)?qs(i.start):void 0,a=ed(i.right)?qs(i.right):ed(i.end)?qs(i.end):void 0,l=ed(i.firstLine)?qs(i.firstLine):void 0,c=ed(i.hanging)?qs(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 qb(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 WU(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 dh(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 Ys(e){return dh(e.target)??dh(e.selectionTarget)}var SI=["fontFamily","fontSize","color","highlight"],KU={undo:"history.undo",redo:"history.redo"},fh=["bold","italic","underline","strikethrough"];function Yb(e){return SI.includes(e)}function td(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 ds(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 qU(e){const t=ds(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 $a(e){const t=td(e);return t.length===0?null:[qU(e),...t.map(n=>`${n.blockId}:${n.start}-${n.end}`)].join("|")}function _I(e){const t=e.selectionTarget;return!t||typeof t!="object"?null:xc({selectionTarget:t})}function YU(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 XU(e,t){return Math.max(e.start,t.start)<Math.min(e.end,t.end)}function ZU(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 QU(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 AI(e,t){const n=td(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=>QU(n,ZU(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 JU(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 Xb(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 eH(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 tH(e,t){return e==="fontFamily"?t.toLowerCase():e==="color"||e==="highlight"?t.toUpperCase():t}function II(e,t){if(!e)return{};const n=new Map;for(const i of td(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 SI){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 p=Array.isArray(c?.runs)?c.runs:[];for(const g of p){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(w=>XU(w,{start:v,end:k})))continue;a=!0;const C=JU(g?.styles,i);if(C===void 0){l=!0;continue}const S=tH(i,C);if(s.has(S)||s.set(S,C),s.size>1)break}if(s.size>1)break}a&&!l&&s.size===1&&(o[i]=[...s.values()][0])}return o}function Zb(e,t){const n=Fr(e)[0];return n?t==="nodeId"?{kind:"after",nodeId:n}:{kind:"after",target:_o(n)}:{kind:"documentEnd"}}function Jt(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 nd(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 rd(e){const t=e,n=t.change;return n&&typeof n=="object"?n:t}function Xs(e){if(Pr(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 Km(e){return!!e&&typeof e=="object"&&e.success===!0}function Ao(e){return!(e===!1||e&&typeof e=="object"&&e.success===!1)}function hh(e){return!!(e&&typeof e=="object"&&!Array.isArray(e))}function Qb(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 Dc(e,t){return e.sourceAnchor?.sourceNodeId===t?!0:e.id===t}function qm(e){return e.trackedChange?.kind==="delete"?0:typeof e.text=="string"?e.text.length:0}function Ei(e){let t=!1,n=null,r=null,o=null;for(const i of e)t=i,!Ao(i)&&n===null&&(n=i),Km(i)&&(o=i),i!==!1&&(r=i);return n??o??r??t}function nH(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 rH(e){return e.startsWith("#")?{kind:"anchor",anchor:e.slice(1)}:{kind:"external",url:e}}function Ym(e){return Xu(e)?.trackDecision??null}function oH(e){return{found:e.length>0,success:e.length>0,rects:e,rect:e[0]}}function Fl(e){return{found:!1,success:!1,rects:[],reason:e}}function iH(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 sH(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 EI(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(sH))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 aH(e){return e.selectionTarget?e.selectionTarget:EI(e.target)}function od(e){if(e.empty)return null;if(e.selectionTarget)return e.selectionTarget;const t=EI(e.target);return t&&t.start.kind==="text"&&t.end.kind==="text"&&t.start.blockId!==t.end.blockId?null:t}function Jb(e){return!e.inline||typeof e.docRoute!="string"?null:e.docRoute.startsWith("format.")?e.docRoute.slice(7):null}var e2={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},lH=Object.fromEntries(Object.entries(e2).filter(([e])=>CU[e]?.tracked===!0));function cH(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:{...e2}};default:return null}}function uH(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 dH(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 fH(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,p={mode:"idle",snapshot:null,sourceSelectionKey:null,lastClickAt:0,pointerSelecting:!1,keyboardSelecting:!1},g=0;const m=new Set;let v={},k="",C=null;const S=()=>{const u=t?.activeEditor;return u&&typeof u=="object"?u:null},w={open:()=>{if(V)return{ok:!1,reason:lt.notReady};const u=S();if(!u)return{ok:!1,reason:lt.notReady};const h=u.contextMenu;if(!h||typeof h!="object"||typeof h.open!="function")return{ok:!1,reason:lt.operationUnavailable};try{const y=h.open();return y&&typeof y=="object"&&y.ok===!1?{ok:!1,reason:$m(y.reason,lt.operationUnavailable)}:{ok:!0}}catch{return{ok:!1,reason:lt.operationUnavailable}}},close:()=>{if(V)return;const u=S()?.contextMenu;if(!(!u||typeof u!="object"||typeof u.close!="function"))try{u.close()}catch{}}},b=()=>{const u=S()?.doc;return u&&typeof u=="object"?u:null},T=()=>{const u=S()?.v2TrackedChanges;return u&&typeof u=="object"?u:null},L=()=>{const u=S();if(u?.editorVersion!==2)return null;const h=u.reviewWindow;return h&&typeof h=="object"?h:null},N=()=>{const u=L();return!u||typeof u.getSnapshot!="function"?null:Lt(()=>u.getSnapshot(),null)},H=()=>typeof L()?.getSnapshot=="function",z=u=>{const h=u?.status;return h==="ready"||h==="stale"?h:"pending"},B=()=>{const u=S()?.host;return u&&typeof u=="object"?u:null},Z=u=>{if(u.storyType!=="headerFooterPart"||typeof u.refId!="string")return null;const h=S(),y=B(),_=h?.pageLayout??y?.pageLayout;if(!_||typeof _!="object")return null;const E=_.getActiveRulerContext,P=y?.resolveHeaderFooterEditTarget;if(typeof E!="function"||typeof P!="function")return null;const j=Lt(()=>E.call(_),null);if(!j||typeof j.pageIndex!="number")return null;for(const re of["header","footer"]){const ue=Lt(()=>P.call(y,{pageIndex:j.pageIndex,kind:re}),null);if(!(ue?.status!=="ready"||ue.refId!==u.refId||typeof ue.sectionId!="string"||!["default","first","even"].includes(String(ue.slotVariant))))return{kind:"story",storyType:"headerFooterSlot",section:{kind:"section",sectionId:ue.sectionId},headerFooterKind:re,variant:ue.slotVariant}}return null},R=()=>{const u=B(),h=u?.getPendingInlineFormat;if(typeof h!="function")return null;const y=Lt(()=>h.call(u),null);return y&&typeof y=="object"?y:null},K=u=>{const h=Jb(u);if(!h)return null;const y=R();if(!y||!(h in y))return null;const _=y[h];return u.inline?.kind==="toggle"?_===!0:_!=null&&_!==""},x=u=>{const h=Jb(u);if(!h)return;const y=R();if(!y||!(h in y))return;const _=y[h];if(typeof _=="string"&&_!=="")return _;if(typeof _=="number"&&Number.isFinite(_))return String(_)},W=(u,h)=>{const y=B(),_=y?.setPendingInlineFormat;typeof _=="function"&&Lt(()=>_.call(y,u,h),void 0)},$=u=>{const h=B(),y=h?.clearPendingInlineFormat;typeof y=="function"&&Lt(()=>y.call(h,u),void 0)},ee=new Set(["bold","italic","underline","strikethrough"]),Q=u=>{const h=R();if(!h)return;const y=Array.isArray(u.activeMarks)?u.activeMarks:[];let _=null;for(const E of Object.keys(h)){const P=h[E];let j;if(ee.has(E)){if(P===!1)continue;j=y.includes(E)===(P===!0)}else if(Yb(E)){if(P==null)continue;_||(_=Xa(u)),j=_[E]===P}else j=!1;j&&$(E)}},X=()=>{const u=S()?.editCommands;return u&&typeof u=="object"?u:null},we=u=>{const h=X();if(!h||typeof h.getSnapshot!="function")return null;const y=Lt(()=>h.getSnapshot(),null)?.commands?.[u];return y&&typeof y=="object"?y:null},ce=()=>we("lists.apply"),be=u=>{const h=u?.value?.seed;return h==="bullet"||h==="ordered"?h:null},ve=u=>{const h=KU[u];return h?we(h):null},Ee=()=>{const u=B();if(!u||typeof u.getTableContext!="function")return null;const h=Lt(()=>u.getTableContext(),null);return h&&typeof h=="object"?h:null},Pe=()=>{const u=Ee();if(!u||u.inTable!==!0)return null;const h=u.table,y=typeof h?.nodeId=="string"&&h.nodeId.length>0?h.nodeId:null;if(!y)return null;const _=u.row,E=u.column,P=u.cell,j=typeof _?.index=="number"&&Number.isInteger(_.index)?_.index:null,re=typeof E?.index=="number"&&Number.isInteger(E.index)?E.index:null;if(j==null||re==null)return null;const ue=typeof P?.nodeId=="string"&&P.nodeId.length>0?P.nodeId:null,xe=u.cellRange;return{tableNodeId:y,rowIndex:j,columnIndex:re,cellNodeId:ue,mergeRange:uH(xe)}},Ze=new Map;let at=null,Qe=null,At=0,se=0,Ie=0;const Ue=new Set,ne=(u,h)=>u===h?!0:!u||!h?!1:u.id===h.id&&u.paintedEntityId===h.paintedEntityId&&tr(u.story)===tr(h.story),A=u=>Array.from(Ue).some(h=>ne(h,u)),ie=u=>{const h=B();if(typeof h?.getHandles!="function")return;const y=Lt(()=>h.getHandles(),null),_=y?.review;if(_){if(u){if(typeof _.setActiveReviewTarget!="function")return;const E=y?.layout;Lt(()=>_.setActiveReviewTarget({entityType:"trackedChange",entityId:u.id,...u.paintedEntityId?{paintedEntityId:u.paintedEntityId}:{},origin:"panel",layoutEpoch:typeof E?.generation=="number"?E.generation:0,story:u.story??{kind:"story",storyType:"body"}}),null);return}typeof _.getActiveReviewTarget!="function"||typeof _.clearActiveReviewTarget!="function"||Lt(()=>_.getActiveReviewTarget(),null)?.entityType==="trackedChange"&&Lt(()=>_.clearActiveReviewTarget(),void 0)}},F=(u,h)=>{Qe=u,At+=1,Ie+=1,h?.invalidateQueuedNavigation!==!1&&(se+=1)},Y=new Set;let O,V=!1,oe=null;const U=new Map,G=new Set;let ge=null,Ae=null,Se=!1,Te=null,Ye=0,rt=null,ht=null,Pt=null;const Ft=[],Wt=()=>{if(Se||V)return;Se=!0;const u=()=>{Se=!1,V||de("async-read-settled")};typeof queueMicrotask=="function"?queueMicrotask(u):Promise.resolve().then(u)},$e=250,cn=5e3,jn=u=>{V||Te&&Ye<=u||(Te&&clearTimeout(Te),Ye=u,Te=setTimeout(()=>{Te=null,Ye=0,V||de()},Math.max(0,u-Date.now())))},Ut=new WeakMap;let In=0;const qr=u=>{if(!u)return"none";let h=Ut.get(u);return h==null&&(h=In+=1,Ut.set(u,h)),`e${h}`};let Cr=0;const Er=e.superdoc,Je=kU(Er),wt=()=>{Je.abortController.abort("review-mutation-started"),Je.inFlight=null},Dt=()=>{Je.generation+=1,Je.abortController=new AbortController,Je.inFlight=null},sn=u=>{const h=Je.activeMutationTokens;if(typeof u!="string"||u.length===0||h.has(u))return;const y=h.size===0;h.add(u),y&&wt()},pn=u=>{const h=Je.activeMutationTokens;typeof u!="string"||!h.delete(u)||h.size===0&&Dt()},en=u=>{const h=T(),y=h?.listTrackedChanges;if(typeof y!="function")return S()?.editorVersion===2?Promise.reject(new Error("v2-tracked-changes-bridge-pending")):u();if(Je.activeMutationTokens.size>0)return Promise.reject(new Error("ui-review-catalog-superseded"));const _=Je.generation,E=Je.inFlight;if(E?.generation===_)return E.promise;const P=Je.abortController.signal,j=xe=>{if(P.aborted||_!==Je.generation||xe?.reason==="review-hydration-superseded")throw new Error("ui-review-catalog-superseded");return xe},re=y.call(h,{blocking:!1,signal:P});if(!Pr(re))return j(re);const ue=Promise.resolve(re).then(j);return Je.inFlight={generation:_,promise:ue},ue.then(()=>{Je.inFlight?.promise===ue&&(Je.inFlight=null)},()=>{Je.inFlight?.promise===ue&&(Je.inFlight=null)}),ue};let wn=null,tn=new Set,nr=null,vo=0,ze=null;const Re=()=>`${qr(S())}|m${Cr}`,tt=()=>{wn=null,tn=new Set},Ct=u=>{for(const h of["trackChanges","trackChanges:all"]){const y=U.get(h);if(!y?.hasSettled||!Array.isArray(y.value))continue;const _=y.value.filter(E=>{const P=Kr(E);return!P||!u.has(P)});_.length!==y.value.length&&U.set(h,{...y,value:_})}},xt=u=>{const h=()=>{if(!V)for(const P of[...Y])P(O)},y=hh(u)?u:null,_=S()?.documentMutationReadiness,E=()=>{const P=globalThis.requestAnimationFrame;return typeof P!="function"?Promise.resolve():new Promise(j=>{let re=!1;const ue=()=>{re||(re=!0,clearTimeout(xe),j())},xe=setTimeout(ue,250);P(()=>P(()=>setTimeout(ue,0)))})};if(y?.success===!0&&typeof y.txId=="string"&&y.txId.length>0&&typeof _?.whenPainted=="function")try{Promise.resolve(_.whenPainted.call(_,y)).then(E,()=>{}).then(h,h);return}catch{}h()},Mt=(u,h)=>{const y=O.trackChanges,_=y.items.filter(j=>{const re=Kr(j);return!re||!u.has(re)});if(_.length===y.items.length)return;Qe&&u.has(Qe.id)&&F(null);const E=new Set;for(const j of _){const re=rd(j),ue=j,xe=re.author??re.authorEmail??ue.author??ue.authorEmail;typeof xe=="string"&&E.add(xe)}const P=y.items.length-_.length;O={...O,trackChanges:{...y,items:_,total:Math.max(_.length,y.total-P),activeId:y.activeId&&u.has(y.activeId)?null:y.activeId,authors:[...E]}},xt(h)},En=u=>{const h=O.trackChanges,y=h.items.length>0||h.total!==0||h.activeId!==null||h.authors.length>0;nr=Re(),Qe!==null&&F(null),O={...O,trackChanges:{...h,items:[],total:0,activeId:null,authors:[]}},y&&xt(u)},Ht=(u,h)=>{if(u.size===0)return;const y=Re(),_=wn===y?tn:new Set,E=new Set([...u].filter(P=>!_.has(P)));E.size!==0&&(wn=y,tn=new Set([..._,...E]),Ct(tn),Mt(E,h))},un=u=>wn===u&&tn.size>0?tn:null,io=u=>{const h=Re(),y=un(h),_=u.map(nd).filter(E=>{if(E==null)return!1;const P=Kr(E);return P!=null&&!y?.has(P)});for(const E of["trackChanges","trackChanges:all"])U.set(E,{token:h,value:[..._],hasSettled:!0,inflightToken:null})},Qr=()=>`${Re()}|m${ir()}|s${vo}`,jo=u=>JSON.stringify({t:u.target??null,s:u.selectionTarget??null}),on=["contentControls:inRange:","query:","effInline:"],rr=120,Xn=180,Io=()=>{const u=B(),h=u?.getDocumentLoadingSnapshot;if(typeof h!="function")return"unknown";const y=Lt(()=>h.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"},Xt=new Map,an=new Map,or=new Map;let Yr=null,Uo=0,Gi=0;const Ho=u=>{const h=Re();Xt.get(u)!==h&&(Xt.set(u,h),Wt())},Nl=()=>{const u=U.get("comments");return u?.hasSettled?Array.isArray(u.value)&&u.value.length>0:u?.inflightToken!=null},Zs=(u,h)=>Xt.get(u)===h,hs=()=>{const u=Re();let h=!1;for(const[y,_]of an){if(_!==u){an.delete(y);continue}if(or.get(y)===u)continue;const E=U.get(y);!E?.hasSettled||E.token!==u||E.inflightToken!=null||(U.set(y,{...E,token:null,inflightToken:null}),or.set(y,u),h=!0)}h&&Wt()},Bl=u=>{u==="comments"?Uo+=1:Gi+=1,Ho(u);let h=!1;return()=>{h||(h=!0,u==="comments"?Uo=Math.max(0,Uo-1):Gi=Math.max(0,Gi-1),(u==="comments"?Uo:Gi)===0&&Xt.get(u)===Re()&&Xt.delete(u),Wt())}},ei=u=>{Ho("contentControls")},Ti=()=>{const u=U.get("trackChanges");u?.hasSettled||u?.inflightToken!=null||Ho("trackChanges")},_e=()=>{const u=U.get("comments");u?.hasSettled||u?.inflightToken!=null||Ho("comments")},Fe=6500,vt=250;let dt=0,Mn=0,mn=!1,ur=null;const Nr=()=>{if(V||ur)return;const u=()=>{if(ur=null,V)return;const h=Date.now()-dt;if(Br()||h<Fe){ur=setTimeout(u,vt);return}mn=!1,de()};ur=setTimeout(u,0)};let Eo=null,Tr=null;const To=()=>{const u=B();if(!u||Eo===u)return;Tr&&(Tr(),Tr=null),Eo=u;const h=u.subscribeDocumentLoading;if(typeof h!="function"){Eo=null,xi(Fe);return}try{const y=P=>{const j=P?.sourceStage;(j==="source-complete"||j==="source-failed"||j==="source-cancelled")&&(Yr=Re(),hs(),dt=Math.max(dt,Date.now()),Nr())},_=h.call(u,y);typeof _=="function"&&(Tr=_);const E=u.getDocumentLoadingSnapshot;typeof E=="function"&&y(Lt(()=>E.call(u),null))}catch{Eo=null,xi(Fe)}},ti=()=>{const u=S()?.host,h=u?.getForegroundMutationState;if(typeof h!="function")return null;const y=Lt(()=>h.call(u),null);return{active:typeof y?.active=="number"?y.active:0,pending:typeof y?.pending=="number"?y.pending:0}},Br=()=>{const u=ti();return!!(u&&(u.active>0||u.pending>0))},xi=(u=rr)=>{V||rt||(rt=setTimeout(()=>{if(rt=null,V)return;if(ht&&Br()){xi(),de();return}const h=ht;ht=null,h===Qr()&&na("selection",h,Ul,qi),de()},u))},zl=(u,h)=>{if(!ti())return!1;const y=`${u}\0${h}`;return G.has(y)?!1:(G.add(y),xi(Xn),!0)},Jr=u=>{if(ge==null||u===ge)return Ae?.timer&&clearTimeout(Ae.timer),Ae=null,ge=u,!1;if(Ae?.key===u)return Ae.ready?(Ae=null,ge=u,!1):!0;Ae?.timer&&clearTimeout(Ae.timer);const h={key:u,ready:!1,timer:null};return h.timer=setTimeout(()=>{V||Ae!==h||(h.timer=null,h.ready=!0,de())},Xn),Ae=h,!0},Qs=u=>pU(u),Js=()=>{ra(),de()};let Ri=null,Wi=null,Ga=!1,ps=0,ea=!1,yo=0;const ms=()=>{Ri=null,Ga=!1,ps+=1},ta=()=>{Wi=null,ea=!1,yo+=1},Wa=()=>{const u=S(),h=u?.documentMutationReadiness;if(!u||typeof h?.whenPainted!="function"||(Ri={editor:u,readiness:h,afterEpoch:typeof h.getRenderEpoch=="function"?Lt(()=>h.getRenderEpoch.call(h),null):null},Ga))return;Ga=!0;const y=ps;(async()=>{for(;!V&&y===ps;){const E=Ri;if(Ri=null,!E){Ga=!1;return}let P=!1;try{await E.readiness.whenPainted.call(E.readiness,typeof E.afterEpoch=="number"?{afterEpoch:E.afterEpoch}:void 0),P=!0}catch{}if(V||y!==ps)return;if(S()!==E.editor){ms();return}P&&Js()}})()},Ka=()=>{const u=S(),h=u?.documentMutationReadiness;if(!u||typeof h?.whenPainted!="function")return!1;if(Wi={editor:u,readiness:h,afterEpoch:typeof h.getRenderEpoch=="function"?Lt(()=>h.getRenderEpoch.call(h),null):null},ea)return!0;ea=!0;const y=yo;return(async()=>{for(;!V&&y===yo;){const E=Wi;if(Wi=null,!E){ea=!1;return}let P=!1;try{await E.readiness.whenPainted.call(E.readiness,typeof E.afterEpoch=="number"?{afterEpoch:E.afterEpoch}:void 0),P=!0}catch{}if(V||y!==yo)return;if(S()!==E.editor){ta();return}Wi||(vo+=1,zc(),de(P?"post-paint-selection":"post-paint-selection-failed"))}})(),!0},gs=()=>{Pt&&clearTimeout(Pt),Pt=setTimeout(()=>{Pt=null,V||Js()},500)},na=(u,h,y,_)=>{let E;try{E=y()}catch{E=void 0}if(!Pr(E)){const re={token:h,value:_(E),hasSettled:!0,inflightToken:null,failedToken:null,failureCount:0,retryAtMs:0};return U.set(u,re),re}const P=U.get(u),j=P?.failedToken===h;return U.set(u,{token:P?.token??null,value:P?.value??null,hasSettled:P?.hasSettled??!1,inflightToken:h,failedToken:j?h:null,failureCount:j?P.failureCount??0:0,retryAtMs:0}),Promise.resolve(E).then(re=>{const ue=U.get(u);if(!ue||ue.inflightToken!==h)return;U.set(u,{token:h,value:_(re),hasSettled:!0,inflightToken:null,failedToken:null,failureCount:0,retryAtMs:0});const{sink:xe,workerContext:Ve}=Hm();if(xe){const Be=Ua();Ft.push({key:u,settledAtMs:Be,commandId:Ve?.commandId??null,commandKind:Ve?.commandKind??null}),$b({stage:"superdoc-ui-async-read-settled",atMs:Be,key:u,settledAtMs:Be,commandId:Ve?.commandId??null,commandKind:Ve?.commandKind??null})}Wt()},()=>{const re=U.get(u);if(!re||re.inflightToken!==h)return;const ue=re.failedToken===h?(re.failureCount??0)+1:1,xe=Math.min(cn,$e*2**Math.min(ue-1,8)),Ve=Date.now()+xe;U.set(u,{...re,inflightToken:null,failedToken:h,failureCount:ue,retryAtMs:Ve}),jn(Ve)}),null},zr=(u,h,y,_)=>{const E=U.get(u);if(E&&E.token===h&&E.hasSettled)return{value:E.value,status:"ready"};if(MU(u)&&!Zs(u,h)){if(Io()==="loading")return mn=!0,To(),E?.hasSettled?{value:E.value,status:"stale"}:{value:null,status:"pending"};if(mn)return Nr(),E?.hasSettled?{value:E.value,status:"stale"}:{value:null,status:"pending"};if(Date.now()-Mn<Fe)return mn=!0,Nr(),E?.hasSettled?{value:E.value,status:"stale"}:{value:null,status:"pending"}}if(Br())return xi(),E?.hasSettled?{value:E.value,status:"stale"}:{value:null,status:"pending"};if(E?.failedToken===h&&E.inflightToken==null&&(E.retryAtMs??0)>Date.now())return jn(E.retryAtMs),E.hasSettled?{value:E.value,status:"stale"}:{value:null,status:"pending"};if(!E&&u.startsWith("effInline:")&&Jr(u))return{value:null,status:"pending"};if(!E&&zl(u,h))return{value:null,status:"pending"};if(!E||E.inflightToken!==h){const j=na(u,h,y,_);if(j)return{value:j.value,status:"ready"}}const P=U.get(u);return P?.hasSettled?{value:P.value,status:"stale"}:{value:null,status:"pending"}},qa=u=>{for(const h of U.keys())u(h)&&U.delete(h)},Oc=u=>{const h=jo(u),y=_I(u);return new Set([`contentControls:inRange:${h}`,`query:${h}`,...y?[`effInline:${y}`]:[]])},Li=u=>{const h=Oc(u);qa(y=>on.some(_=>y.startsWith(_))&&!h.has(y));for(const y of G){const _=y.split("\0",1)[0];on.some(E=>_.startsWith(E))&&!h.has(_)&&G.delete(y)}},id=()=>{const u=S();u!==ze&&(ms(),ta(),ze=u,U.clear(),Te&&clearTimeout(Te),Te=null,Ye=0,Ae?.timer&&clearTimeout(Ae.timer),Ae=null,ge=null,C=null,o=null,ht=null,G.clear(),Xt.clear(),an.clear(),or.clear(),Yr=null,mn=!1,Tr&&Tr(),Tr=null,Eo=null,tt(),nr=null)},ra=()=>{Cr+=1,an.clear(),or.clear(),Yr=null,tt()},Pc=()=>{const u=nr===Re();ra(),u&&(io([]),nr=Re()),de()},Mi=u=>{if(typeof u!="string"||u.length===0)return Yn("insertText requires a non-empty string.","INVALID_INPUT");if(ir()==="viewing")return Yn("The document is read-only.","DOCUMENT_READONLY");const h=b(),y=h?.insert;if(!h||typeof y!="function")return Yn("insert is unavailable.");const _=h.selection?.current;if(typeof _!="function")return Yn("selection.current is unavailable.");const E=j=>{const re=j&&typeof j=="object"?j:null,ue=re?.selectionTarget??re?.target??null;return!ue||typeof ue!="object"?Yn("insertText requires a live selection target.","PRECONDITION_FAILED"):Lt(()=>gr(y.call(h,{type:"text",value:u,target:ue}),Yn("insert failed.")),Yn("insert failed."))};let P;try{P=_.call(h.selection)}catch{return Yn("insertText could not resolve the live selection.","PRECONDITION_FAILED")}return Pr(P)?Promise.resolve(P).then(E,()=>Yn("insertText could not resolve the live selection.","PRECONDITION_FAILED")):E(P)},Fc=(u,h)=>({payload:u,state:O,editor:S(),superdoc:t,context:h,ui:oe,execute:(y,_)=>Qc(y,_),executeAsync:(y,_)=>cg(y,_),doc:b(),selection:O.selection,documentMode:ir(),insertText:Mi}),Ki=u=>u==="editing"||u==="suggesting"||u==="viewing"?u:null,ir=()=>{const u=S(),h=t&&typeof t=="object"?t:null,y=Ki(h?.config?.documentMode),_=Lt(typeof h?.getActiveRuntime=="function"?()=>{const j=h.getActiveRuntime();return typeof j?.getSnapshot=="function"?j.getSnapshot():null}:void 0,null),E=Ki(_?.documentMode),P=Ki(u?.options?.documentMode);return y&&E&&y!==E?y:E??y??P},Nc=()=>{const u=t&&typeof t=="object"?t:null,h=u?.interactionConfig?.comments;if(h&&typeof h.readOnly=="boolean")return h.readOnly===!0;const y=u?.config?.modules?.comments;return!!y&&typeof y=="object"&&y.readOnly===!0},Bc=()=>{if(ir()==="viewing")return lt.documentReadonly;const u=(t&&typeof t=="object"?t:null)?.interactionConfig?.trackedChanges;return u&&typeof u.allowDecisions=="boolean"?u.allowDecisions?void 0:lt.trackedChangeDecisionsDisabled:Nc()?lt.documentReadonly:void 0},sd=()=>{const u=t&&typeof t=="object"?t:null,h=u?.interactionConfig?.comments;if(h&&typeof h.allowResolve=="boolean")return h.allowResolve===!1;const y=u?.config?.modules?.comments;return!!y&&typeof y=="object"&&y.allowResolve===!1},Vl=()=>ir()==="viewing"||Nc(),ad=()=>Bc()!=null,qi=u=>u&&typeof u=="object"?u:null,vs=(u,h)=>{if(!u)return{...xU,status:h};const y=u.target??null,_=typeof u.text=="string"?u.text:"";return{status:h,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:_}},jl=()=>{const u=b()?.selection;return zr("selection",Qr(),()=>u?.current?u.current({includeText:!0}):void 0,qi)},ys=()=>{const{value:u,status:h}=jl();return vs(u,h)},Ul=()=>{const u=b()?.selection;return u?.current?u.current({includeText:!0}):void 0},ld=u=>{if(u.empty!==!0)return!1;const h=u.selectionTarget,y=h?.start,_=h?.end;return y?.kind==="text"&&_?.kind==="text"&&typeof y.blockId=="string"&&y.blockId===_.blockId&&typeof y.offset=="number"&&y.offset===_.offset},zc=u=>{const h=B(),y=h?.readLiveSelectionSyncSnapshot;if(typeof y!="function")return;const _=qi(Lt(()=>y.call(h),null));if(!_||!ld(_))return;const E=Qr(),P=ti(),j=!!(P&&(P.active>0||P.pending>0));if(j)ht=E,xi();else if(ht=null,na("selection",E,Ul,qi))return;const re=U.get("selection"),ue=Array.isArray(_.activeMarks)&&_.activeMarks.length>0?_.activeMarks:Array.isArray(O.selection.activeMarks)?O.selection.activeMarks:[],xe=Array.isArray(_.activeCommentIds)?_.activeCommentIds:[],Ve=NU(u),Be=Ys(O.selection),Ke=dh(_.selectionTarget)??dh(_.target),qe=Be?.range,We=Ke?.range,Ge=!!(P&&P.active>0&&Be&&Ke&&Be.blockId===Ke.blockId&&tr(Be.story)===tr(Ke.story)&&typeof qe?.start=="number"&&typeof We?.start=="number"&&Math.abs(We.start-qe.start)<=2),st=Ve!=null||Ge?O.selection.activeChangeIds.filter(Xe=>Ve==null||Ks(O.trackChanges.items).aliasesFor(Xe).includes(Ve)):[],it=Array.isArray(_.activeChangeIds)&&_.activeChangeIds.length>0?_.activeChangeIds:st;U.set("selection",{token:E,value:{..._,activeMarks:ue,activeCommentIds:xe,activeChangeIds:it},hasSettled:!0,inflightToken:j?null:re?.inflightToken??null})},Yi=async(u=0)=>{const h=b()?.selection,y=h?.current,_=Qr();if(typeof y!="function")return U.set("selection",{token:_,value:null,hasSettled:!0,inflightToken:null}),de(),O.selection;let E;try{E=y.call(h,{includeText:!0}),Pr(E)&&(E=await Promise.resolve(E))}catch{E=null}return V?vs(null,"pending"):Qr()!==_?u<1?Yi(u+1):O.selection:(U.set("selection",{token:_,value:qi(E),hasSettled:!0,inflightToken:null}),de(),O.selection)},mr=()=>{const u=b()?.comments;return zr("comments",Re(),()=>u?.list?u.list():void 0,h=>h&&Array.isArray(h.items)?h.items:[])},oa=(u="trackChanges")=>{const h=Re(),y=b()?.trackChanges,_=T(),E=typeof _?.listTrackedChanges=="function"?_.listTrackedChanges:null,P=zr(u,h,()=>E?en(()=>y?.list?.({in:"all"})):y?.list?y.list({in:"all"}):void 0,j=>{const re=j&&typeof j=="object"?j:null;if(re?.complete===!1||re?.sourceCoverageComplete===!1){if(an.set(u,h),To(),Yr===h||Io()==="complete"){const ue=()=>{V||hs()};typeof queueMicrotask=="function"?queueMicrotask(ue):Promise.resolve().then(ue)}}else an.get(u)===h&&an.delete(u);return re&&Array.isArray(re.items)?re.items:[]});return an.get(u)===h&&P.status==="ready"?{...P,status:"stale"}:P},Vc=u=>{const h=N(),y=H(),_=y?null:mr(),E=y&&Array.isArray(h?.commentItems)?h.commentItems:null,P=y?E:_.value,j=y?z(h):_.status,re=P??[],ue=u.activeCommentIds,xe=U.get("comments"),Ve=xe?.token===Re()&&xe.hasSettled&&Array.isArray(xe.value)?xe.value:null,Be=Uo>0?Ve:re;at&&Be&&!Be.some(qe=>Kr(qe)===at)&&(at=null);const Ke=at??ue[0]??null;return{status:Pl(j,u.status),listStatus:j,items:re,total:re.length,activeIds:ue,activeId:Ke}},Ya=new WeakMap,Di=u=>{const h=Ya.get(u);if(h)return h;const y=u.map(nd).filter(_=>_!=null);return Ya.set(u,y),y},Xi=new WeakMap,Hl=(u,h)=>{const y=Xi.get(u);if(y?.suppressedIds===h)return y.value;const _=h?u.filter(E=>{const P=Kr(E);return!P||!h.has(P)}):u;return Xi.set(u,{suppressedIds:h,value:_}),_},cd=new WeakMap,ud=u=>{const h=cd.get(u);if(h)return h;const y=new Set;for(const E of u){const P=rd(E),j=E,re=P.author??P.authorEmail??j.author??j.authorEmail;typeof re=="string"&&y.add(re)}const _=[...y];return cd.set(u,_),_},bs=()=>{const u=Re();if(H()){const _=U.get("trackChanges"),E=_?.token===u&&_.hasSettled&&Array.isArray(_.value)?_.value:N()?.trackedChangeItems;return Array.isArray(E)?Di(E):null}const{value:h,status:y}=oa("trackChanges:all");return y==="ready"?Di(h??[]):null},$l=u=>{const h=Re(),y=un(h),_=N(),E=H(),P=E?null:oa(),j=E&&Array.isArray(_?.trackedChangeItems)?_.trackedChangeItems:null,re=E?j:P.value,ue=E?z(_):P.status,xe=Hl(Di(re??[]),y),Ve=bs(),Be=Qe;if(Be&&!Ue.has(Be)){const Et=U.get("trackChanges"),Sn=Et?.token===h&&Et.hasSettled&&Array.isArray(Et.value)?Hl(Di(Et.value),y):null,_n=Gi>0?Sn:Be.story?Ve:xe;_n&&!_n.some(_r=>$i(_r,Be.id,Be.story))&&F(null)}const Ke=Ve??xe,qe=Lc(Ke,us(u)),We=nr===h?[]:y?u.activeChangeIds.filter(Et=>!y.has(Et)):u.activeChangeIds,Ge=We.map(Et=>qe.toPublicId(Et)??Et),st=Qe?.story?Lc(Ke,Qe.story):Ks(Ke),it=Qe?st.toPublicId(Qe.id)??Qe.id:null,Xe=jU({selectionIds:We,publicIds:Ge,selection:u,bodyItems:xe,allStoryItems:Ve}),It=it??Xe;return{status:Pl(ue,u.status),items:xe,total:xe.length,activeId:It,authors:ud(xe)}},jc=(u,h)=>{if(!H())return h;Ho("comments");const y=mr(),_=y.value??h.items;return{status:Pl(y.status,u.status),listStatus:y.status,items:_,total:_.length,activeIds:u.activeCommentIds,activeId:at??u.activeCommentIds[0]??null}},ph=(u,h)=>{if(!H())return h;Ho("trackChanges");const y=oa(),_=un(Re()),E=Hl(Di(y.value??h.items),_),P=Qe?.story?Lc(E,Qe.story):Ks(E),j=Qe?P.toPublicId(Qe.id)??Qe.id:h.activeId;return{status:Pl(y.status,u.status),items:E,total:E.length,activeId:j,authors:ud(E)}};let dd=null,fd=[];const Uc=(u,h)=>{const y=Re();return h==="ready"?(dd=y,fd=u,{items:u,status:h}):h==="pending"&&dd===y?{items:fd,status:"stale"}:{items:u,status:h}},mh=u=>{const h=b()?.contentControls,{value:y,status:_}=zr("contentControls",Re(),()=>h?.list?h.list():void 0,Be=>Be&&Array.isArray(Be.items)?Be.items:[]),E=y??[],{items:P,status:j}=Hc(h,u),re=new Map(P.map(Be=>[Be.id,Be])),ue=new Set(E.map(Be=>Be.id)),xe=[...E.map(Be=>re.get(Be.id)??Be),...P.filter(Be=>!ue.has(Be.id))],Ve=P.map(Be=>Be.id);return{status:Pl(_,j,u.status),items:xe,total:xe.length,activeId:Ve[0]??null,activeIds:Ve}},ws=(u,h)=>{if(!u||typeof u.listInRange!="function")return{lockModesById:new Map,rows:[],status:"ready"};const y=HU(h);if(!y)return{lockModesById:new Map,rows:[],status:"ready"};const{value:_,status:E}=zr(`contentControls:inRange:${jo(h)}`,Re(),()=>u.listInRange(y),re=>re&&Array.isArray(re.items)?re.items:[]),P=_??[],j=new Map;for(const re of P)typeof re?.id=="string"&&j.set(re.id,typeof re.lockMode=="string"?re.lockMode:"unlocked");return{lockModesById:j,rows:P,status:E}},Hc=(u,h)=>{const{rows:y,status:_}=ws(u,h),E=h.selectionTarget,P=h.target;let j=E?.start;if(E){if(E.kind!=="selection"||j?.kind!=="text"||typeof j.blockId!="string"||typeof j.offset!="number")return Uc([],_)}else{const Ge=P?.kind==="text"&&Array.isArray(P.segments)?P.segments[0]:void 0,st=Ge?.range;if(typeof Ge?.blockId!="string"||typeof st?.start!="number")return Uc([],_);j={kind:"text",blockId:Ge.blockId,offset:st.start,story:P?.story}}const re=(P?.coordinateSpace!=="tracked"&&Array.isArray(P?.segments)?P.segments:[]).find(Ge=>Ge.blockId===j.blockId),ue=re?.range,xe=re&&typeof re.blockId=="string"&&typeof ue?.start=="number"?{kind:"text",blockId:re.blockId,offset:ue.start,story:P?.story??j.story}:null,Ve=(E?E.coordinateSpace:P?.coordinateSpace)==="tracked"?"tracked":"visible",Be=Ve==="tracked"?xe:j,Ke=Fr(h),qe=Ke.indexOf((Be??j).blockId),We=y.map((Ge,st)=>({item:Ge,index:st})).filter(({item:Ge})=>{const st=Ge.selectionTarget,it=st?.coordinateSpace==="tracked"?"tracked":"visible";if(it==="tracked"&&Ve!=="tracked")return!1;const Xe=it==="tracked"?j:Be;if(!Xe)return!1;const It=st?.start,Et=st?.end;if(st?.kind!=="selection"||It?.kind!=="text"||Et?.kind!=="text"||typeof It.blockId!="string"||typeof Et.blockId!="string"||typeof It.offset!="number"||typeof Et.offset!="number"||tr(st.story??It.story??Et.story)!==tr(E?.story??Xe.story))return!1;if(It.blockId===Et.blockId){if(Xe.blockId!==It.blockId)return!1;const _r=Math.min(It.offset,Et.offset),Rr=Math.max(It.offset,Et.offset);return _r===Rr?Xe.offset===_r:Xe.offset>=_r&&Xe.offset<Rr}if(Xe.blockId===It.blockId)return Xe.offset>=It.offset;if(Xe.blockId===Et.blockId)return Xe.offset<Et.offset;if(qe===-1)return!1;const Sn=Ke.indexOf(It.blockId),_n=Ke.indexOf(Et.blockId);return Sn!==-1&&_n!==-1?qe>Math.min(Sn,_n)&&qe<Math.max(Sn,_n):Sn!==-1?qe>Sn:_n!==-1?qe<_n:!0}).sort((Ge,st)=>{const it=Ge.item.selectionTarget,Xe=st.item.selectionTarget,It=it.start.kind==="text"&&it.end.kind==="text"&&it.start.blockId===it.end.blockId,Et=Xe.start.kind==="text"&&Xe.end.kind==="text"&&Xe.start.blockId===Xe.end.blockId;if(It!==Et)return It?-1:1;if(Ge.item.kind!==st.item.kind)return Ge.item.kind==="inline"?-1:1;if(It&&Et&&it.start.kind==="text"&&it.end.kind==="text"&&Xe.start.kind==="text"&&Xe.end.kind==="text"){const Sn=Math.abs(it.end.offset-it.start.offset),_n=Math.abs(Xe.end.offset-Xe.start.offset);if(Sn!==_n)return Sn-_n}return st.index-Ge.index}).map(({item:Ge})=>Ge);return Uc(We,_)},hd=()=>{const u=t?.fonts;return{options:vH(mH(Lt(u?.getDocumentFontOptions?()=>u.getDocumentFontOptions():void 0,[])),gH(Lt(u?.getFontFamilyOptions?()=>u.getFontFamilyOptions():void 0,[]))),sizeOptions:yH}},$c=()=>{const u=Lt(t?.getZoomState?()=>t.getZoomState():void 0,null),h=typeof u?.value=="number"?u.value:100,y=u?.mode;return{mode:y==="manual"||y==="fit-width"?y:y==="fixed"?"manual":null,value:h,min:typeof u?.min=="number"?u.min:10,max:typeof u?.max=="number"?u.max:100}},Gc=()=>Lt(t?.getMeasurementUnit?()=>t.getMeasurementUnit():void 0,"in")==="cm"?"cm":"in",Wc=()=>{const u=S();return{ready:u!=null,mode:ir(),dirty:u?!!u.isDirty:!1}},Kc=u=>{const h=u.quotedText;if(typeof h!="string"||h.length===0)return null;const y=td(u);if(y.length===0||!Mc(y.map(P=>P.blockId)))return null;const _=u.target,E=y.length===1?_o(y[0].blockId,_?.story):void 0;return{select:{type:"text",pattern:h,mode:"contains",caseSensitive:!0},...E?{within:E}:{},require:"any"}},pd=u=>{const h=b()?.query;if(typeof h?.match!="function")return null;const y=Kc(u);if(!y)return null;const{value:_}=zr(`query:${jo(u)}`,Re(),()=>h.match(y),E=>E&&typeof E=="object"?E:null);return AI(_,u)},Gl=u=>{const h=B(),y=new Set(Fr(u));if(y.size===0)return{};const _=h?.readMountedProjectionBlocksByIds,E=h?.readMountedProjectionBlocks;if(typeof _!="function"&&typeof E!="function")return{};const P=Lt(()=>{if(typeof _!="function")return E.call(h);const Ge=ds(u);return Ge?_.call(h,[...y],Ge):_.call(h,[...y])},null);if(!Array.isArray(P))return{};const j=Qb(P),re=Ge=>{const st={},it=Xb(Ge.fontFamily);it&&(st.fontFamily=it);const Xe=eH(Ge.fontSize);return Xe&&(st.fontSize=Xe),typeof Ge.color=="string"&&Ge.color.trim()!==""&&(st.color=Ge.color.trim().toUpperCase()),typeof Ge.highlight=="string"&&Ge.highlight.trim()!==""&&(st.highlight=Ge.highlight.trim().toUpperCase()),st},ue=Ys(u),xe=ue&&typeof ue.range?.start=="number"?ue.range.start:null;if(ue&&xe!==null&&y.has(ue.blockId)){const Ge=j.find(it=>Dc(it,ue.blockId)),st=Ge&&Array.isArray(Ge.runs)?Ge.runs:null;if(st&&st.length>0&&st.every(it=>it?.kind==="text"||it?.kind==="tab")){let it=0,Xe=null;for(const It of st){const Et=qm(It);if(xe>=it&&xe<it+Et){Xe=It;break}it+=Et}if(!Xe){for(let It=st.length-1;It>=0&&!Xe;It-=1)st[It]?.kind==="text"&&(Xe=st[It]);Xe??=st[st.length-1]??null}return Xe?re(Xe):{}}}const Ve=td(u);if(Ve.length>0){const Ge=new Set,st=new Set;let it=!1,Xe=!0;for(const It of Ve){const Et=j.find(_r=>Dc(_r,It.blockId));if(!Et)return{};const Sn=Array.isArray(Et.runs)?Et.runs:[];if(Sn.length===0)continue;if(!Sn.every(_r=>_r?.kind==="text"||_r?.kind==="tab")){Xe=!1;break}let _n=0;for(const _r of Sn){const Rr=qm(_r),Lr=_n,jr=_n+Rr;if(Lr<It.end&&jr>It.start){it=!0;const ci=re(_r);ci.fontFamily&&Ge.add(ci.fontFamily),ci.fontSize&&st.add(ci.fontSize)}_n=jr}}if(Xe&&it){const It={};return Ge.size===1&&(It.fontFamily=[...Ge][0]),st.size===1&&(It.fontSize=[...st][0]),It}}const Be=new Set,Ke=new Set;let qe=!1;for(const Ge of j){if(![...y].some(it=>Dc(Ge,it)))continue;const st=Array.isArray(Ge.runs)?Ge.runs:[];for(const it of st){if(it?.kind!=="text")continue;qe=!0;const Xe=re(it);Xe.fontFamily&&Be.add(Xe.fontFamily),Xe.fontSize&&Ke.add(Xe.fontSize)}}if(!qe)return{};const We={};return Be.size===1&&(We.fontFamily=[...Be][0]),Ke.size===1&&(We.fontSize=[...Ke][0]),We},gh=u=>{const h=B(),y=new Set(Fr(u));if(y.size===0)return{};const _=h?.readMountedProjectionBlocksByIds,E=h?.readMountedProjectionBlocks;if(typeof _!="function"&&typeof E!="function")return{};const P=Lt(()=>{if(typeof _!="function")return E.call(h);const We=ds(u);return We?_.call(h,[...y],We):_.call(h,[...y])},null);if(!Array.isArray(P))return{};const j=Qb(P),re=We=>({bold:We.bold===!0,italic:We.italic===!0,underline:We.underline!=null,strikethrough:We.strike===!0}),ue=We=>{const Ge={};for(const st of fh){const it=We[st];it.size===1&&(Ge[st]=[...it][0])}return Ge},xe=Ys(u),Ve=xe&&typeof xe.range?.start=="number"?xe.range.start:null;if(xe&&Ve!==null&&y.has(xe.blockId)){const We=j.find(st=>Dc(st,xe.blockId)),Ge=We&&Array.isArray(We.runs)?We.runs:null;if(Ge&&Ge.length>0&&Ge.every(st=>st?.kind==="text"||st?.kind==="tab")){let st=0,it=null;for(const Xe of Ge){const It=qm(Xe);if(Ve>=st&&Ve<st+It){it=Xe;break}st+=It}if(!it){for(let Xe=Ge.length-1;Xe>=0&&!it;Xe-=1)Ge[Xe]?.kind==="text"&&(it=Ge[Xe]);it??=Ge[Ge.length-1]??null}return it?re(it):{}}}const Be=td(u);if(Be.length>0){const We={bold:new Set,italic:new Set,underline:new Set,strikethrough:new Set};let Ge=!1,st=!0;for(const it of Be){const Xe=j.find(Sn=>Dc(Sn,it.blockId));if(!Xe)return{};const It=Array.isArray(Xe.runs)?Xe.runs:[];if(It.length===0)continue;if(!It.every(Sn=>Sn?.kind==="text"||Sn?.kind==="tab")){st=!1;break}let Et=0;for(const Sn of It){const _n=qm(Sn),_r=Et,Rr=Et+_n;if(_r<it.end&&Rr>it.start){Ge=!0;const Lr=re(Sn);for(const jr of fh)We[jr].add(Lr[jr])}Et=Rr}}if(st&&Ge)return ue(We)}const Ke={bold:new Set,italic:new Set,underline:new Set,strikethrough:new Set};let qe=!1;for(const We of j){if(![...y].some(st=>Dc(We,st)))continue;const Ge=Array.isArray(We.runs)?We.runs:[];for(const st of Ge){if(st?.kind!=="text")continue;qe=!0;const it=re(st);for(const Xe of fh)Ke[Xe].add(it[Xe])}}return qe?ue(Ke):{}},md=(u,h)=>{if(h.fontFamily!==void 0&&h.fontSize!==void 0&&h.color!==void 0&&h.highlight!==void 0)return{values:h,effectiveUniformityStatus:"ready"};const y=Gl(u),_={...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}:{},...h};if(!u.empty&&(_.fontFamily===void 0||_.fontSize===void 0)){const E=yd(u);return E.values&&(_.fontFamily===void 0&&E.values.fontFamily!==void 0&&(_.fontFamily=E.values.fontFamily),_.fontSize===void 0&&E.values.fontSize!==void 0&&(_.fontSize=E.values.fontSize)),{values:_,effectiveUniformityStatus:E.status}}return{values:_,effectiveUniformityStatus:"ready"}},gd=["fontFamily","fontSize","bold","italic","underline","strikethrough"],vd=u=>{const h=u.selectionTarget;if(!h)return{value:null,status:"ready"};const y=wr(b(),"format.readEffectiveInlineUniformity");if(!y)return{value:null,status:"ready"};const _=_I(u)??jo(u);return zr(`effInline:${_}`,Re(),()=>y({target:h,offsetSpace:"selection",keys:gd}),E=>E&&typeof E=="object"?E:null)},yd=u=>{const{value:h,status:y}=vd(u);if(!h||h.success!==!0)return{values:null,status:y};const _=h.values,E=P=>{const j=_?.[P];if(!(!j||j.state!=="uniform"||typeof j.value!="string"))return P==="fontFamily"?Xb(j.value):j.value};return{values:{fontFamily:E("fontFamily"),fontSize:E("fontSize")},status:y}},bd=u=>{const{value:h,status:y}=vd(u);if(!h||h.success!==!0)return{values:null,status:y};const _=h.values,E={};for(const P of fh){const j=_?.[P];j?.state==="uniform"&&(j.value==="true"||j.value==="false")&&(E[P]=j.value==="true")}return{values:E,status:y}},vh=(u,h)=>{const y=u.activeMark;if(!y||!fh.includes(y))return null;const _=y,E=gh(h)[_];if(E!==void 0)return E;const{values:P}=bd(h),j=P?.[_];return j!==void 0?j:null},wd=async u=>{const h=u.selectionTarget;if(!h)return null;const y=wr(b(),"format.readEffectiveInlineUniformity");if(!y)return null;try{const _=await Promise.resolve(y({target:h,offsetSpace:"selection"}));return _&&typeof _=="object"&&_.success===!0?_:null}catch{return null}},Cd=(u,h,y)=>{const _=y.values;for(const E of["fontFamily","fontSize"]){if(h[E]!==void 0)continue;const P=_?.[E];P?.state==="uniform"&&typeof P.value=="string"?u[E]=E==="fontFamily"?Xb(P.value):P.value:delete u[E]}},$o=u=>md(u,II(pd(u),u)),Xa=u=>$o(u).values,qc=async u=>{const h=b()?.query,y=Kc(u);if(typeof h?.match!="function"||!y)return Xa(u);try{const _=await Promise.resolve(h.match(y)),E=II(AI(_&&typeof _=="object"?_:null,u),u),P=md(u,E);if(P.effectiveUniformityStatus!=="ready"&&(E.fontFamily===void 0||E.fontSize===void 0)){const j=await wd(u);j&&Cd(P.values,E,j)}return P.values}catch{return Xa(u)}},Wl=async u=>{const h=b();if(h)return typeof h.getNode=="function"?await Promise.resolve(h.getNode(u)):await Promise.resolve(h.getNodeById?.({nodeId:u.nodeId,nodeType:u.nodeType}))},Yc=u=>{const h=b()?.query;if(typeof h?.match!="function")return"ready";const y=Kc(u);if(!y)return"ready";const{status:_}=zr(`query:${jo(u)}`,Re(),()=>h.match(y),E=>E&&typeof E=="object"?E:null);return _},Za=u=>{const h=$o(u),y=h.values;if(u.empty)return h;const _=$a(u);return _?u.status==="ready"&&Yc(u)==="ready"&&h.effectiveUniformityStatus==="ready"?(C={key:_,values:y},h):C&&C.key===_?{...h,values:{...C.values,...y}}:h:h},yh=u=>{const h=b(),y=Za(u),_=y.values;u.status==="ready"&&!u.empty&&Yc(u)==="ready"&&y.effectiveUniformityStatus==="ready"&&(v=_,k=`${xc(u)}:${Re()}`);const E=h?.contentControls,{lockModesById:P}=ws(E,u),j={};for(const re of ri())j[re]=I(re,h,u,_,P);return j},xo=u=>u?lt.operationUnavailable:S()?lt.documentApiUnavailable:lt.notReady,Ro=u=>u==="contentLocked"||u==="sdtContentLocked",Cs=u=>{for(const h of u.values())if(Ro(h))return lt.contentControlLocked},Xc=(u,h,y,_,E)=>{if(!h)return u.scope==="all"?lt.bulkDecisionsDisabled:xo(E);if(y)return y;if(u.scope!=="all"&&_.activeChangeIds.length===0)return lt.selectionRequired},kd=u=>{const h=O?.trackChanges?.items?.find(j=>Kr(j)===u);if(h)return rd(h);const y=Lt(()=>b()?.trackChanges?.list?.(),null);if(!y||typeof y!="object"||typeof y.then=="function")return null;const _=y.items;if(!Array.isArray(_))return null;const E=_.find(j=>Kr(j)===u);if(!E)return null;const P=nd(E);return P?rd(P):E},ks=(u,h)=>{const y=t.canPerformPermission;if(typeof y!="function"||h.length===0)return;const _=t.config&&typeof t.config=="object"?t.config.user:null;for(const E of h){const P=kd(E)??{id:E},j=FU(P,_),re=u==="accept"?j?"RESOLVE_OWN":"RESOLVE_OTHER":j?"REJECT_OWN":"REJECT_OTHER";let ue;try{ue=y.call(t,{permission:re,trackedChange:P,comment:null})}catch{return}if(ue===!1)return lt.permissionDenied}},ia=u=>{const h=B(),y=Lt(typeof h?.getCapabilities=="function"?()=>h.getCapabilities():void 0,null)?.editableSubset?.commands;if(Array.isArray(y))return y.find(_=>_?.command===u||_?.id===u)??null;if(y&&typeof y=="object"){const _=y[u];return _&&typeof _=="object"?_:null}return null},Sd=(u,h)=>{if(u.scope!=="all"||typeof h?.[`${u.kind}All`]=="function")return;const y=ia(`trackedChanges.${u.kind}All`);if(!(y&&(y.status==="supported"||y.enabled===!0)))return lt.bulkDecisionsDisabled},I=(u,h,y,_,E=new Map)=>{if(Ze.has(u))return Jt({supported:!0,enabled:!0,...Lt(Ze.get(u).getState?()=>Ze.get(u).getState(Fc(void 0)):void 0,{})},"custom");const P=ir()==="viewing",j=pI(u);if(j&&typeof X()?.lists?.apply=="function"){const qe=ce(),We=typeof qe?.shippedStatus=="string"?qe.shippedStatus:null,Ge=We!=="not-shipped"&&We!=="disabled",st=Ge&&(typeof qe?.enabled=="boolean"?qe.enabled:!0),it=Ge?be(qe):null;return Jt(P?{enabled:!1,active:it===j,supported:Ge,value:qe?.value,reason:lt.documentReadonly}:{enabled:st,active:it===j,supported:Ge,value:qe?.value},"builtin")}const re=Ym(u);if(re){const qe=h?.trackChanges,We=typeof qe?.decide=="function"||typeof qe?.[re.kind]=="function",Ge=typeof qe?.decide=="function"||typeof qe?.[`${re.kind}All`]=="function",st=re.scope==="all"?Ge:We,it=Sd(re,qe)??Xc(re,st,Bc(),y,h)??(re.scope==="all"?void 0:ks(re.kind,y.activeChangeIds));return Jt({enabled:it==null,active:!1,supported:st,reason:it},"builtin")}if(u==="copy-format")return ir()==="viewing"?Jt({supported:!0,enabled:!1,active:!1},"builtin"):S()?Jt({supported:!0,enabled:!0,active:p.mode!=="idle"},"builtin"):Jt({supported:!0,enabled:!1,active:!1,reason:lt.notReady},"builtin");const ue=Xu(u);if(!ue)return Jt({enabled:!1,active:!1,supported:!1,reason:lt.commandUnsupported},"unsupported");if(ue.disposition!=="routed")return Jt({enabled:!1,active:!1,supported:!1,reason:ue.reason??lt.commandUnsupported},ue.disposition==="unsupported"?"unsupported":"builtin");if(ue.instanceRoute)return Zi(ue);if(ue.table)return ut(ue,h,P);if(ue.inline?.kind==="clear"){if(ue.mutates&&P)return Jt({enabled:!1,active:!1,supported:!0,reason:lt.documentReadonly},"builtin");const qe=Cs(E);if(qe)return Jt({enabled:!1,active:!1,supported:!0,reason:qe},"builtin");const We=Fr(y).length>0||od(y)!=null;return Jt({enabled:We,active:!1,supported:!0,reason:We?void 0:lt.selectionRequired},"builtin")}const xe=ue.docRoute;if(!xe)return Jt({enabled:!1,active:!1,supported:!1,reason:lt.commandUnsupported},"unsupported");if(wr(h,xe)==null)return Jt({enabled:!1,active:!1,supported:!1,reason:xo(h)},"builtin");const Ve=ve(u);if(Ve){const qe=Ve.shippedStatus,We=qe!=="not-shipped"&&qe!=="disabled",Ge=typeof Ve.enabled=="boolean"?Ve.enabled:!0,st=u==="undo"||u==="redo",it=st&&Ve.historyResolved===!1,Xe=st&&We&&Ge===!1&&Ve.reason===null&&!it,It=Ve.reason===void 0?void 0:Xe?lt.historyEmpty:it?lt.notReady:$m(Ve.reason,lt.commandUnsupported);return ue.mutates&&P?Jt({enabled:!1,active:!1,supported:We,reason:lt.documentReadonly},"builtin"):Jt({enabled:We&&Ge,active:!1,supported:We,reason:It},"builtin")}const Be=le(ue,h,y),Ke=ae(ue,h,y,_);if(ue.list?.mode==="indent"||ue.list?.mode==="outdent")return kr(ue,h,P,y,Be,Ke);if(ue.list?.mode==="toggle-seed")return so(ue,h,P,y,Be,Ke);if(ue.mutates&&P)return Jt({enabled:!1,active:Be,supported:!0,value:Ke,reason:lt.documentReadonly},"builtin");if(ue.inline&&!od(y)){const qe=Cs(E);return Jt(qe?{enabled:!1,active:Be,supported:!0,value:Ke,reason:qe}:Fr(y).length>0&&typeof B()?.setPendingInlineFormat=="function"?{enabled:!0,active:Be,supported:!0,value:Ke}:{enabled:!1,active:Be,supported:!0,value:Ke,reason:lt.rangeSelectionRequired},"builtin")}if((ue.blockParagraph||ue.list)&&Fr(y).length===0)return Jt({enabled:!1,active:Be,supported:!0,value:Ke,reason:lt.selectionRequired},"builtin");if(ue.link&&!Be&&qb(y).length===0&&!Ys(y))return Jt({enabled:!1,active:Be,supported:!0,reason:lt.rangeSelectionRequired},"builtin");if(ue.inline){const qe=Cs(E);if(qe)return Jt({enabled:!1,active:Be,supported:!0,value:Ke,reason:qe},"builtin")}return Jt({enabled:!0,active:Be,supported:!0,value:Ke},"builtin")};function M(u,h){const y=u.address?.anchor,_=y?.start,E=y?.end,P=typeof _?.blockId=="string"?_.blockId:null,j=typeof E?.blockId=="string"?E.blockId:null;if(!P||!j)return!1;const re=typeof _?.offset=="number"?_.offset:null,ue=typeof E?.offset=="number"?E.offset:null;if(re==null||ue==null)return!1;const xe=h.target,Ve=xe&&Array.isArray(xe.segments)?xe.segments:[];for(const Be of Ve){const Ke=typeof Be?.blockId=="string"?Be.blockId:null;if(!Ke)continue;const qe=Be.range,We=typeof qe?.start=="number"?qe.start:null,Ge=typeof qe?.end=="number"?qe.end:null;if(!(We==null||Ge==null)){if(P!==j){if(Ke===P&&Ge>re||Ke===j&&We<ue)return!0;continue}if(Ke===P){if(We===Ge){if(We>=re&&We<=ue)return!0;continue}if(Math.max(We,re)<Math.min(Ge,ue))return!0}}}return!1}const J=(u,h)=>{const y=u?.hyperlinks;if(!y||typeof y.list!="function")return null;const _=Fr(h);if(!Mc(_))return null;for(const E of _){const P={kind:"block",nodeType:"paragraph",nodeId:E},{value:j}=zr(`hyperlinks:${E}`,Re(),()=>y.list({within:P}),ue=>ue&&typeof ue=="object"?ue:null),re=(j&&Array.isArray(j.items)?j.items:[]).find(ue=>M(ue,h));if(re)return re}return null},le=(u,h,y)=>{if(u.link)return J(h,y)!=null;if(u.list?.mode==="toggle-seed"&&u.list.seed)return Oe(h,y)===u.list.seed;const _=K(u);if(_!==null)return _;const E=r.get(u.id),P=$a(y);if(P&&E?.selectionSignature===P)return E.active;const j=vh(u,y);return j!==null?j:bH(u,y)},ae=(u,h,y,_)=>{if(u.inline&&Yb(u.inline.key)){const E=x(u);if(E!==void 0)return E;const P=_[u.inline.key];if(P!==void 0)return P;const j=$a(y),re=j?n.get(u.inline.key):void 0;if(j&&re?.selectionSignature===j)return re.value}if(u.id==="linked-style"){const{style:E}=Qa(y,oi().cache);return!E.styleId||E.mixed?void 0:{styleId:E.styleId,styleName:E.styleName}}if(u.id==="text-align")return Vt(h,y);if(u.id==="link")return bo(h,y)??void 0},pe=(u,h,y)=>{const _=u?.lists;if(!_)return{value:null,status:"ready"};const E=y.storyType==="body",P=typeof _.getStateInStory=="function"?()=>_.getStateInStory({target:Ha(h),story:y}):E&&typeof _.getState=="function"?()=>_.getState({target:Ha(h)}):null;if(!P)return{value:null,status:"ready"};const{value:j,status:re}=zr(`lists:${tr(y)}:${h}`,Re(),P,ue=>ue&&typeof ue=="object"?ue:null);return{value:j?.success===!0?j:null,status:re}},fe=(u,h,y)=>pe(u,h,y).value,he=(u,h,y)=>{const _=fe(u,h,y);return!_||_.isListItem!==!0?null:_.seed==="bullet"||_.seed==="ordered"?_.seed:null},ke=(u,h,y)=>{const _=pe(u,h,y),E=_.value;return{value:E&&typeof E.isListItem=="boolean"?E.isListItem:null,status:_.status}},Oe=(u,h)=>{const y=Fr(h);if(y.length===0||!Mc(y))return null;const _=us(h),E=he(u,y[0],_);if(E!=="bullet"&&E!=="ordered")return null;for(const P of y.slice(1))if(he(u,P,_)!==E)return null;return E},je=(u,h,y)=>{if(!u)return{value:null,status:"ready",refreshing:!1};const _=tr(y),E=_==="story:body";if(E&&typeof u.getNodeById!="function")return{value:null,status:"ready",refreshing:!1};if(!E&&typeof u.getNode!="function")return{value:null,status:"ready",refreshing:!1};const P=`node:${_}:${h}`,j=Re(),re=zr(P,j,()=>E?u.getNodeById({nodeId:h,nodeType:"paragraph"}):u.getNode(_o(h,y)),xe=>xe&&typeof xe=="object"?xe:null),ue=U.get(P);return{...re,refreshing:re.status==="stale"&&ue?.inflightToken===j&&ue.failedToken!==j}},Le=u=>u==="left"||u==="center"||u==="right"||u==="justify"?u:void 0,nt=u=>u==="start"||u==="end"||u==="distributed"||u==="numTab"||u==="lowKashida"||u==="mediumKashida"||u==="highKashida"||u==="thaiDistribute",ct=(u,h)=>{const y=B(),_=y?.readMountedProjectionBlocksByIds;if(typeof _!="function")return null;const E=ds(u),P=Lt(()=>E?_.call(y,[...h],E):_.call(y,[...h]),null);if(!Array.isArray(P))return new Map;const j=Qb(P),re=new Map;for(const ue of h){const xe=j.find(qe=>Dc(qe,ue));if(!xe)continue;const Ve=xe.attrs,Be=Le(Ve?.alignment),Ke=qM(Ve);re.set(ue,Be??(Ke==="rtl"?"right":"left"))}return re},ot=(u,h,y,_)=>{const{value:E,status:P,refreshing:j}=je(u,h,y),re=_?.get(h);if(P==="pending")return re?{status:"uniform",value:re}:{status:"pending"};if(P==="stale"&&!j)return{status:"pending"};if(P==="stale"&&re)return{status:"uniform",value:re};if(P==="stale"&&_&&!re)return{status:"unavailable"};if(!E)return{status:"unavailable"};const ue=E.node;if(!ue)return{status:"unavailable"};const xe=ue.kind;if(xe!=="paragraph"&&xe!=="heading")return{status:"unavailable"};const Ve=ue[xe];if(!Ve||typeof Ve!="object")return{status:"unavailable"};const Be=Ve.props?.alignment;if(Be==null)return re?{status:"uniform",value:re}:{status:"unavailable"};const Ke=Le(Be);return Ke?{status:"uniform",value:Ke}:nt(Be)&&re?{status:"uniform",value:re}:{status:"unavailable"}},bt=(u,h)=>{const y=Fr(h);if(y.length===0||!Mc(y))return{status:"unavailable"};const _=us(h),E=ct(h,y),P=ot(u,y[0],_,E);if(P.status!=="uniform")return P;for(const j of y.slice(1)){const re=ot(u,j,_,E);if(re.status!=="uniform")return re;if(re.value!==P.value)return{status:"mixed"}}return P},ft=u=>{const h=Fr(u);return h.length===0?null:`${tr(us(u))}:${h.join(",")}`},Vt=(u,h)=>{const y=bt(u,h),_=y.status==="uniform"?y.value:void 0,E=o;if(!E)return _;const P=ft(h);return P&&P!==E.selectionSignature?(o=null,_):!P||!E.settled?E.value:y.status!=="pending"?(o=null,_):E.value},On=(u,h)=>{const y=Le(h),_=ft(u),E=Fr(u);if(!y||!_||E.length===0)return null;const P=++i;return o={selectionSignature:_,value:y,generation:P,settled:!1,canReconcile:Mc(E)},de(),P},xr=(u,h)=>{if(u==null)return;const y=o;if(!(!y||y.generation!==u)){if(!Ao(h)){o=null;return}if(!y.canReconcile){o=null;return}y.settled=!0}},jt=async(u,h,y)=>{const _=u?.lists;if(!_)return null;try{const E=y.storyType==="body",P=typeof _.getStateInStory=="function"?await _.getStateInStory({target:Ha(h),story:y}):E&&typeof _.getState=="function"?await _.getState({target:Ha(h)}):null,j=P&&typeof P=="object"?P:null;return!j||j.success!==!0||typeof j.isListItem!="boolean"?null:j.isListItem}catch{return null}},Pn=(u,h,y)=>{const _={resolved:!1,seed:null},E=u?.lists;if(!E)return _;const P=y.storyType==="body",j=typeof E.getStateInStory=="function"?()=>E.getStateInStory({target:Ha(h),story:y}):P&&typeof E.getState=="function"?()=>E.getState({target:Ha(h)}):null;if(!j)return _;const re=ue=>{const xe=ue&&typeof ue=="object"?ue:null;return!xe||xe.success!==!0||typeof xe.isListItem!="boolean"?_:{resolved:!0,seed:xe.isListItem===!0&&(xe.seed==="bullet"||xe.seed==="ordered")?xe.seed:null}};try{const ue=j();return Pr(ue)?Promise.resolve(ue).then(re,()=>_):re(ue)}catch{return _}},kn=async(u,h,y)=>{if(!u)return null;try{const _=!y||y.storyType==="body",E=y&&typeof u.getNode=="function"?await u.getNode(_o(h,y)):_&&typeof u.getNodeById=="function"?await u.getNodeById({nodeId:h,nodeType:"paragraph"}):null;return GU(E&&typeof E=="object"?E:null)}catch{return null}},kr=(u,h,y,_,E,P)=>{if(u.mutates&&y)return Jt({enabled:!1,active:E,supported:!0,value:P,reason:lt.documentReadonly},"builtin");const j=Fr(_);if(j.length===0)return Jt({enabled:!1,active:E,supported:!0,value:P,reason:lt.selectionRequired},"builtin");const re=u.docRoute?wr(h,u.docRoute):null,ue=wr(h,"format.paragraph.setIndentation"),xe=wr(h,"format.paragraph.clearIndentation"),Ve=u.list?.mode,Be=Ve==="indent"?ue!=null:ue!=null||xe!=null,Ke=us(_);let qe=null;if(Ke.storyType!=="body"){qe=[];for(const We of j){const{value:Ge,status:st}=ke(h,We,Ke);if(Ge===null)return st!=="ready"&&(re!=null||Be)?Jt({enabled:!0,active:E,supported:!0,value:P},"builtin"):Jt({enabled:!1,active:E,supported:!1,value:P,reason:xo(h)},"builtin");qe.push(Ge)}}if(qe?.some(We=>We===!0)){const We=Ve==="indent"?"lists.indentRange":"lists.outdentRange",Ge=ir()!=="suggesting"&&qe.every(it=>it===!0)&&wr(h,We)!=null,st=Ve==="outdent"&&wr(h,"lists.outdentInStory")!=null;if(!Ge&&!st)return Jt({enabled:!1,active:E,supported:!1,value:P,reason:xo(h)},"builtin")}for(const[We,Ge]of j.entries()){const st=qe?{value:qe[We]??null,status:"ready"}:ke(h,Ge,Ke),it=st.value;if(it===!0){if(re!=null)return Jt({enabled:!0,active:E,supported:!0,value:P},"builtin");continue}if(it===!1&&Be){if(Ke.storyType!=="body"&&typeof h?.getNode!="function")continue;return Jt({enabled:!0,active:E,supported:!0,value:P},"builtin")}if(it===null)return st.status!=="ready"&&(re!=null||Be)?Jt({enabled:!0,active:E,supported:!0,value:P},"builtin"):Jt({enabled:!1,active:E,supported:!1,value:P,reason:xo(h)},"builtin")}return Jt({enabled:!1,active:E,supported:!1,value:P,reason:xo(h)},"builtin")},so=(u,h,y,_,E,P)=>{if(u.mutates&&y)return Jt({enabled:!1,active:E,supported:!0,value:P,reason:lt.documentReadonly},"builtin");const j=Fr(_);if(j.length===0)return Jt({enabled:!1,active:E,supported:!0,value:P,reason:lt.selectionRequired},"builtin");const re=us(_),ue=h?.lists;if(!(typeof ue?.getStateInStory=="function"||re.storyType==="body"&&typeof ue?.getState=="function"))return Jt({enabled:!1,active:E,supported:!1,value:P,reason:lt.operationUnavailable},"builtin");if(!Mc(j))return Jt(re.storyType==="body"&&wr(h,"lists.remove")!=null?{enabled:!0,active:E,supported:!0,value:P}:{enabled:!1,active:E,supported:!1,value:P,reason:lt.operationUnavailable},"builtin");const xe=j.map(qe=>pe(h,qe,re));if(xe.some(({status:qe})=>qe!=="ready"))return Jt({enabled:!0,active:E,supported:!0,value:P},"builtin");if(xe.some(({value:qe})=>qe===null))return Jt({enabled:!1,active:E,supported:!1,value:P,reason:lt.operationUnavailable},"builtin");const Ve=u.list?.seed,Be=xe.every(({value:qe})=>qe?.isListItem===!0&&qe.seed===Ve);if(re.storyType==="body")return Jt(!Be||wr(h,"lists.remove")!=null?{enabled:!0,active:E,supported:!0,value:P}:{enabled:!1,active:E,supported:!1,value:P,reason:lt.operationUnavailable},"builtin");const Ke=wr(h,"lists.removeInStory");return Jt(Be&&Ke?{enabled:!0,active:E,supported:!0,value:P}:{enabled:!1,active:E,supported:!1,value:P,reason:lt.operationUnavailable},"builtin")},bo=(u,h)=>{const y=J(u,h)?.properties?.href;return typeof y=="string"?y:null},Zi=u=>{if(!S())return Jt({enabled:!1,active:!1,supported:!1,reason:lt.notReady},"builtin");const h=u.instanceRoute;return typeof t?.[h]!="function"?Jt({enabled:!1,active:!1,supported:!1,reason:lt.operationUnavailable},"builtin"):Jt({enabled:!0,active:ni(u),supported:!0,value:yn(u)},"builtin")},ni=u=>{const h=t?.config??void 0;return u.valueFrom==="ruler"?!!h?.rulers:u.valueFrom==="formattingMarks"?!!h?.layoutEngineOptions?.showFormattingMarks:!1},ut=(u,h,y)=>{if(y)return Jt({enabled:!1,active:!1,supported:!0,reason:lt.documentReadonly},"builtin");const _=Pe();return _!=null&&(!u.table.requiresCell||_.cellNodeId!=null)?(u.docRoute?wr(h,u.docRoute):null)==null?Jt({enabled:!1,active:!1,supported:!1,reason:xo(h)},"builtin"):Jt({enabled:!0,active:!1,supported:!0},"builtin"):Jt({enabled:!1,active:!1,supported:!0,reason:lt.tableContextUnavailable},"builtin")},yn=u=>{if(u.valueFrom==="zoom")return $c().value;if(u.valueFrom==="documentMode")return ir();if(u.valueFrom==="measurementUnit")return Gc();if(u.valueFrom==="ruler"||u.valueFrom==="formattingMarks")return ni(u)},Lo=(u,h)=>u.id==="zoom"?typeof h=="number"&&Number.isFinite(h)&&h>0:u.id==="document-mode"?h==="editing"||h==="suggesting"||h==="viewing":u.id==="measurement-unit"?h==="in"||h==="cm":!0,ri=()=>[...new Set([...xz,...Ze.keys()])],sa="Normal",wo={ready:!1,status:"ready",catalogRevision:null,quickGallery:[],activeParagraphStyleId:null,activeParagraphStyleName:null,mixedSelection:!1,sourceStatus:null,diagnostics:[]},vi=u=>`styles:catalog:${JSON.stringify(u??{})}`,Qi=u=>{const h=b()?.styles;return!h||typeof h.getCatalog!="function"?{value:null,status:"ready"}:zr(vi(u),Re(),()=>h.getCatalog(u),y=>y&&typeof y=="object"?y:null)},oi=()=>{const u=Qi({includePreview:!0});if(!u.value)return{cache:null,status:u.status};const h=Qi({view:"quickGallery",includePreview:!0}),y=h.value?h.value.items:u.value.styles.filter(E=>E.visibility.quickGallery),_=new Map;for(const E of u.value.styles)_.set(E.id,E);return{cache:{full:u.value,quickGallery:y,byId:_},status:Pl(u.status,h.status)}},Ss=(u,h,y)=>{const{value:_,status:E}=je(u,h,y);if(!_)return{ok:!1,styleRef:null,status:E};const P=_.node;if(!P||typeof P!="object")return{ok:!1,styleRef:null,status:E};const j=P.kind,re=typeof j=="string"?P[j]:void 0,ue=re&&typeof re=="object"?re.styleRef:void 0;return{ok:!0,styleRef:typeof ue=="string"&&ue.length>0?ue:null,status:E}},Qa=(u,h)=>{const y=[],_=b();if(!_)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 E=Fr(u);if(E.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(!Mc(E))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 P=h?.full.defaults.paragraphStyleId??(h?sa:null),j=new Set;let re=0,ue=0,xe=0,Ve="ready";const Be=us(u);for(const We of E){const Ge=Ss(_,We,Be);if(Ve=Pl(Ve,Ge.status),!Ge.ok){ue+=1;continue}if(!Ge.styleRef&&!P){xe+=1;continue}const st=Ge.styleRef??P;if(!st){xe+=1;continue}re+=1,j.add(st)}if(re===0){const We=xe>0&&ue===0;return y.push({severity:"warning",code:We?"active-style-default-unavailable":"active-style-read-failed",message:We?"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:Ve}}const Ke=ue+xe;if(Ke>0)return y.push({severity:"warning",code:"active-style-partial",message:`Active paragraph style resolved from ${re} of ${re+Ke} selected blocks; ${Ke} could not be read, so the active style is unavailable.`}),{style:{styleId:null,styleName:null,mixed:!1,diagnostics:y},status:Ve};if(j.size>1)return{style:{styleId:null,styleName:null,mixed:!0,diagnostics:y},status:Ve};const qe=[...j][0];return{style:{styleId:qe,styleName:h?.byId.get(qe)?.name??null,mixed:!1,diagnostics:y},status:Ve}},Kl=u=>{if(!S())return wo;const{cache:h,status:y}=oi(),{style:_,status:E}=Qa(u,h);let P;return h?P=_.diagnostics.length===0?h.full.diagnostics:[...h.full.diagnostics,..._.diagnostics]:P=[{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)."},..._.diagnostics],{ready:!0,status:Pl(y,E,u.status),catalogRevision:h?.full.revision??null,quickGallery:h?.quickGallery??[],activeParagraphStyleId:_.styleId,activeParagraphStyleName:_.styleName,mixedSelection:_.mixed,sourceStatus:h?.full.sourceStatus??null,diagnostics:P}},Ji=(u="direct")=>{const{sink:h}=Hm(),y=h?Ua():0,_={},E=(xe,Ve)=>{if(!h)return Ve();const Be=Ua();try{return Ve()}finally{_[xe]=Ua()-Be}},P=E("documentMode",ir),j=E("selection",ys);j.status==="ready"&&Li(j),Q(j);const re=$a(j);for(const[xe,Ve]of r)(!re||Ve.selectionSignature!==re||Ve.settled&&j.status==="ready")&&r.delete(xe);const ue={ready:S()!=null,documentMode:P,document:E("document",Wc),selection:j,toolbar:{context:P,commands:E("toolbarCommands",()=>yh(j)),copyFormatActive:p.mode!=="idle"},comments:E("comments",()=>Vc(j)),trackChanges:E("trackChanges",()=>$l(j)),contentControls:E("contentControls",()=>mh(j)),zoom:E("zoom",$c),fonts:E("fonts",hd),styles:E("styles",()=>Kl(j))};if(h){const xe=Ua();$b({stage:"superdoc-ui-compute-state",atMs:xe,reason:u,startedAtMs:y,completedAtMs:xe,durationMs:xe-y,phaseMs:_,asyncReadSettlements:Ft.splice(0)})}return ue},Ja=u=>{const h=$a(u);h&&a&&h!==a&&(n.clear(),r.clear()),h&&(a=h)};let Go=null,Mo=null,_s=null,Do=null,ii=null,Oi=null,Pi=!1;const _d=()=>{if(V||Pi)return;Pi=!0;const u=()=>{Pi&&(Pi=!1,!V&&de())};typeof queueMicrotask=="function"?queueMicrotask(u):Promise.resolve().then(u)},ql=()=>{const u=X();if(u!==_s&&(Do&&(Do(),Do=null),_s=u,!(!u||typeof u.subscribe!="function")))try{const h=u.subscribe(()=>_d());typeof h=="function"&&(Do=h)}catch{_s=null}},el=()=>{const u=L();if(u!==ii&&(Oi&&(Oi(),Oi=null),ii=u,!(!u||typeof u.subscribe!="function")))try{const h=u.subscribe(()=>de());typeof h=="function"&&(Oi=h)}catch{ii=null}};let si=null,ai=null,Yl=null,As=null,Xl=null,Ot=null;const Wn=()=>{const u=S()?.host,h=Lt(u?.getHandles?()=>u.getHandles():void 0,null)?.editing?.selection;return h&&typeof h.subscribe=="function"?h:null},Vr=()=>{const u=B(),h=u?.readLiveSelectionSyncSnapshot;if(typeof h!="function")return!1;const y=qi(Lt(()=>h.call(u),null));if(!y||!ld(y))return!1;const _=vs(y,"ready"),E=Ys(O.selection),P=Ys(_);if(E&&P&&E.blockId===P.blockId&&tr(E.story)===tr(P.story))return!1;const j=Gl(_),re=O.toolbar.commands["font-family"]?.value,ue=O.toolbar.commands["font-size"]?.value,xe=typeof re=="string"&&re.length>0,Ve=typeof ue=="string"&&ue.length>0||typeof ue=="number"&&Number.isFinite(ue);return xe&&j.fontFamily===void 0||Ve&&j.fontSize===void 0},Zn=()=>{const u=Wn();if(u!==Go&&(Mo&&(Mo(),Mo=null),Go=u,!!u))try{const h=u.subscribe(y=>{Br()&&Vr()&&Ka()||(vo+=1,zc(y),de("host-selection"))});typeof h=="function"&&(Mo=h)}catch{Go=null}},eo=()=>{const u=S()?.host,h=Lt(u?.getHandles?()=>u.getHandles():void 0,null)?.review;return h&&typeof h.subscribe=="function"?h:null},li=u=>u?typeof u.getActiveReviewTarget=="function"?Lt(()=>u.getActiveReviewTarget(),null):typeof u.getSnapshot=="function"?Lt(()=>u.getSnapshot(),null)?.activeReviewTarget??null:null:null;let Wo=0;const yi=(u,h)=>{const y=(h&&typeof h=="object"?h:null)?.lastInteractionRejection;if(u==null&&y&&typeof y=="object"&&y.code==="review-target-invalidated"&&y.detail==="not-painted"&&Qe)return!1;const _=u&&typeof u=="object"?u:null;let E=null;if(_?.entityType==="trackedChange"&&typeof _.entityId=="string"&&_.entityId.length>0){const P=_.story&&typeof _.story=="object"?_.story:void 0,j=P&&tr(P)!==tr(null)?P:void 0,re=typeof _.paintedEntityId=="string"&&_.paintedEntityId.length>0?_.paintedEntityId:null,ue=re??_.entityId,xe=(()=>{if(j){const Ke=bs(),qe=Ke?Lc(Ke,j):null;return qe?.toPublicId(ue)??qe?.toPublicId(_.entityId)??_.entityId}const Be=Ks(Array.isArray(O?.trackChanges.items)?O.trackChanges.items:[]);return Be.toPublicId(ue)??Be.toPublicId(_.entityId)??_.entityId})(),Ve=re??(ue!==xe?ue:null);E={id:xe,...j?{story:j}:{},...Ve&&Ve!==xe?{paintedEntityId:Ve}:{}}}return u==null&&E==null&&Qe!=null&&A(Qe)||ne(Qe,E)?!1:(F(E),!0)},Zc=()=>{const u=eo();if(u===si)return;if(ai&&(ai(),ai=null),si=u,!u){yi(null);return}let h=!0;try{const y=u.subscribe(_=>{const E=_&&typeof _=="object"?_:null,P=E&&Object.prototype.hasOwnProperty.call(E,"activeReviewTarget")?E.activeReviewTarget:li(u);!yi(P,_)||h||de()});typeof y=="function"&&(ai=y),yi(li(u))}catch{si=null}finally{h=!1}},Zl=()=>{if(Go||ir()!=="viewing")return null;const u=S()?.mount?.container,h=(u&&typeof u=="object"&&"ownerDocument"in u?u.ownerDocument??null:null)??globalThis.document??null;return h&&typeof h.addEventListener=="function"?h:null},D=()=>{const u=Zl();if(u===Xl||(Ot&&(Ot(),Ot=null),Xl=u,!u))return;const h=()=>{vo+=1,de()};u.addEventListener("selectionchange",h),u.addEventListener("pointerup",h,!0),u.addEventListener("mouseup",h,!0),Ot=()=>{u.removeEventListener("selectionchange",h),u.removeEventListener("pointerup",h,!0),u.removeEventListener("mouseup",h,!0)}};id(),yi(li(eo())),O=Ji("initial"),a=$a(O.selection);const q=()=>{const u=S()?.host?.events,h=u&&typeof u.subscribe=="function"?u:null;if(h!==Yl&&(As&&(As(),As=null),Yl=h,!!h))try{const y=h.subscribe(_=>{const E=_?.type;if(E==="review-mutation:started"){sn(_.reviewMutation?.token);return}if(E==="review-mutation:aborted"){pn(_.reviewMutation?.token),Wt();return}if(E==="mutation:rejected"&&_.reviewMutation&&(pn(_.reviewMutation.token),Wt()),E==="mutation:committed"&&_.reviewMutation&&pn(_.reviewMutation.token),E==="source:complete"||E==="source:signals-complete"){Yr=Re(),hs();return}if((E==="mutation:committed"||E==="collaboration:remote-changed")&&(dt=Date.now()),E==="mutation:committed"||E==="save:completed"||E==="collaboration:remote-changed"){const P=E==="mutation:committed"?TS(_):null;if(P?.allResolved){io([]),En(_.receipt);return}P?.removedIds.size&&Ht(new Set(P.removedIds),_.receipt);const j=E==="mutation:committed"&&Qs(_)||E==="collaboration:remote-changed"&&Array.isArray(_.changedStoryIds)&&_.changedStoryIds.length>0;if(j&&(Mn=Date.now()),E==="mutation:committed"&&j){gs();return}if(P?.removedIds.size&&P.upsertIds.size===0)return;(E==="collaboration:remote-changed"||E==="mutation:committed"&&!j)&&Wa();const re=E==="collaboration:remote-changed"&&Array.isArray(_.changedPartUris)&&_.changedPartUris.some(xe=>typeof xe=="string"&&LU.has(xe)),ue=E==="collaboration:remote-changed"&&Array.isArray(_.changedStoryIds)&&_.changedStoryIds.length>0&&Nl();re&&!j&&(mn=!0),ra(),re&&!j?Ho("comments"):ue&&(mn=!0,Nr()),de()}});typeof y=="function"&&(As=y)}catch{Yl=null}},de=(u="unspecified")=>{if(V)return;const{sink:h}=Hm(),y=h?Ua():0;Pi=!1,id(),Zn(),ql(),el(),Zc(),D(),q();const _=Ji(u);Ja(_.selection),O=_;let E=0,P=0;for(const j of[...Y]){if(!h){j(O);continue}const re=Ua();j(O);const ue=Ua()-re;E+=ue,P=Math.max(P,ue)}if(h){const j=Ua();$b({stage:"superdoc-ui-recompute",atMs:j,reason:u,startedAtMs:y,completedAtMs:j,durationMs:j-y,listenerCount:Y.size,listenerTotalMs:E,listenerMaxMs:P})}},Ne=[],pt=[],nn=u=>{for(const h of u)try{h()}catch{}},dn=()=>nn(Ne),Nn=()=>nn(pt),Fn=[];((u,h)=>{if(!(!u||typeof u.on!="function"))for(const y of h){const _=y==="active-editor-change"?()=>{dn(),Nn(),de()}:y==="document-replaced"?E=>{const P=E&&typeof E=="object"?E:null,j=P?.editor,re=P?.host,ue=!!j&&j===S(),xe=!!re&&re===B();!ue&&!xe||(Nn(),U.clear(),ra(),de())}:()=>de();try{u.on(y,_),Fn.push(()=>{try{typeof u.off=="function"&&u.off(y,_)}catch{}})}catch{}}})(t,AU),Zn(),ql(),el(),Zc(),D(),q();const Kn=(u,h=lU)=>({get:()=>u(O),subscribe:y=>{let _=u(O);const E=P=>{const j=u(P);h(_,j)||(_=j,y(j))};return Y.add(E),()=>Y.delete(E)}}),Cn=u=>Kn(u),Tn=u=>{const h=y=>{const _=P=>{try{y(P)}catch{}},E=u.subscribe(_);return _(u.get()),E};return{get:()=>u.get(),getSnapshot:()=>u.get(),observe:h,subscribe:y=>h(_=>y({snapshot:_}))}},tl=(u,h,y)=>{const _=Tn(u),E=Tn(h),P=j=>{const re=Bl(y);de();const ue=E.observe(j);return()=>{ue(),re()}};return{get:_.get,getSnapshot:_.getSnapshot,observe:P,subscribe:j=>P(re=>j({snapshot:re}))}};function Ql(u){return u&&typeof u=="object"&&typeof u.id=="string"?String(u.id):null}function Ko(u){const h=ds(u);return h&&tr(h)!==tr(null)?h:void 0}function aa(u,h){return{kind:"id",id:u,...h?{story:h}:{}}}function Jl(u){if(u.empty)return null;const h=u.selectionTarget,y=h?.start,_=h?.end;if(h?.kind!=="selection"||y?.kind!=="text"||_?.kind!=="text"||typeof y.blockId!="string"||y.blockId!==_.blockId||!Number.isInteger(y.offset)||!Number.isInteger(_.offset)||y.offset<0||_.offset<0||y.offset===_.offset)return null;const E=Math.min(y.offset,_.offset),P=Math.max(y.offset,_.offset),j=ds(u);return{kind:"range",coordinateSpace:h.coordinateSpace==="tracked"?"tracked":"visible",range:{kind:"text",...j?{story:j}:{},segments:[{blockId:y.blockId,range:{start:E,end:P}}]}}}function n2(u,h){if(tr(h)!==tr(null))return;const y=b()?.trackChanges,_=y?.list;if(typeof _!="function")return;const E=Lt(()=>_.call(y),null);if(Pr(E)||!E||typeof E!="object")return;const P=E.items;if(Array.isArray(P))return P.map(nd).find(j=>j!=null&&$i(j,u,h))}function r2(u,h){const y=bh(u.quotedText);if(!y)return!1;const _=rd(h);return[_.insertedText,_.deletedText,_.excerpt].some(E=>bh(E)===y)}function bh(u){return typeof u=="string"?u.replace(/\s+/g," ").trim():""}function Jm(){const u=O.selection.activeChangeIds[0];if(!u)return"unavailable";const h=ds(O.selection),y=(O.trackChanges.status==="ready"?O.trackChanges.items.find(j=>$i(j,u,h)):void 0)??n2(u,h)??bs()?.find(j=>$i(j,u,h));if(!y)return"unavailable";const _=rd(y),E=_.type,P=_.grouping;return r2(O.selection,y)?"id":E==="replacement"&&P==="replacement-pair"||(E==="insertion"||E==="deletion"||E==="insert"||E==="delete")&&P==="standalone"?"range":"id"}function o2(u,h,y,_){const E=()=>d2(u,aa(y,_),y,_);try{const P=d2(u,h,y,_);if(Pr(P))return An(Promise.resolve(P).then(re=>Ao(Xs(re))?re:E()));const j=Xs(P);return An(Ao(j)?P:E())}catch{return!1}}function eg(u,h){if(u.scope==="all")return{target:{kind:"all"},changeId:null};if(typeof h=="string"&&h.length>0)return{target:{kind:"id",id:h},changeId:h};if(h&&typeof h=="object"){const E=h;if(E.target&&typeof E.target=="object"){const j=E.target;return{target:j,changeId:Ql(j),story:j.story}}const P=typeof E.changeId=="string"?E.changeId:E.id;if(typeof P=="string"&&P.length>0)return{target:aa(P,E.story),changeId:P,story:E.story}}const y=O.selection.activeChangeIds[0],_=Ko(O.selection);return y?{target:aa(y,_),changeId:y,story:_}:null}function i2(u,h){if(u.scope==="id"&&h==null){if(O.selection.activeChangeIds.length>1)return kh(u.kind,{kind:"ids",ids:O.selection.activeChangeIds},null);if(O.selection.activeChangeIds.length===1&&!O.selection.empty&&O.selection.selectionTarget){const _=Jm();if(_==="unavailable")return!1;if(_==="range"){const E=Jl(O.selection),P=Ko(O.selection);return E?o2(u.kind,E,O.selection.activeChangeIds[0],P):!1}if(_==="id"){const E=O.selection.activeChangeIds[0],P=ds(O.selection),j=P&&tr(P)!==tr(null)?P:void 0;return u2(u.kind,j?{id:E,story:j}:E)}}}const y=eg(u,h);return y?kh(u.kind,y.target,y.changeId,y.story):!1}function s2(u,h){const y=X()?.lists,_=y?.apply;if(typeof _!="function")return!1;const{behavior:E,preset:P,continuity:j}=typeof h=="string"?TU(h):h&&typeof h=="object"?h:{},re={kind:u,behavior:E??"toggle"};P!==void 0&&(re.preset=P),j!==void 0&&(re.continuity=j);try{return An(_.call(y,re))}catch{return!1}}let la=Promise.resolve(!1),qo=null,qn=Promise.resolve(!1);const Ad=async u=>{if(!Km(u))return u;const h=S()?.documentMutationReadiness,y=h?.whenPainted;if(typeof y!="function")return u;const _=typeof u.txId=="string"?u.txId:void 0;try{await y.call(h,_?{txId:_}:void 0)}catch{}return u},Yo=u=>{if(Pr(u)){const y=Promise.resolve(u);return{immediate:!0,committed:y.then(_=>Xs(_),()=>!1),settled:y.then(_=>Ad(Xs(_)),()=>!1)}}const h=Xs(u);return{immediate:h,committed:Promise.resolve(h),settled:Ad(h)}},tg=()=>{const u=s.shift();if(!u){c=!1,f?.(),f=null;return}try{u.resolve(V?!1:u.mutate())}catch{u.resolve(!1)}},ng=()=>{let u=!1;return()=>{u||(u=!0,tg())}},rg=(u,h)=>{if(!c){c=!0,d=new Promise(P=>{f=P});try{return{result:h(),release:ng()}}catch(P){throw c=!1,f?.(),f=null,P}}const y=s.find(P=>P.key===u);if(y)return y.mutate=h,{result:y.result,release:()=>{}};let _;const E=new Promise(P=>{_=P});return s.push({key:u,mutate:h,result:E,resolve:_}),{result:E,release:ng()}},og=new Set(["create.tableOfContents"]),ig=u=>Yn(`Tracked authoring is not supported for ${u}.`),Id=u=>{if(ir()==="suggesting")return og.has(u)?ig(u):{changeMode:"tracked"}},sg=()=>ir()==="suggesting"?lH:e2,Sr=(u,h,y)=>{const _=Id(u);return _&&_.success===!1?_:_?h(y,_):h(y)},Ed=(u,h,y,_)=>{const E=u.inline;if(!E)return;const P=Xs(_);if(P===!1||typeof P=="object"&&P&&P.success===!1)return;if(E.kind==="clear"){n.clear();return}if(E.kind==="toggle"||!Yb(E.key))return;const j=$a(h);if(!j)return;const re=YU(E.key,y.value);if(re==null){n.delete(E.key);return}n.set(E.key,{selectionSignature:j,value:re})},ag=(u,h,y,_)=>!u.inline||u.inline.kind==="toggle"?_:Pr(_)?Promise.resolve(_).then(E=>(Ed(u,h,y,E),E)):_,Tt=(u,h,y,_)=>{if(u.inline?.kind!=="toggle"||!Ao(Xs(_))||typeof y.value!="boolean"&&y.value!==null)return null;const E=$a(h);if(!E)return null;const P=++l;return r.set(u.id,{selectionSignature:E,active:y.value===!0,generation:P,settled:!1}),de(),P},$t=(u,h,y)=>{if(h==null)return;const _=r.get(u.id);if(!(!_||_.generation!==h)){if(!Ao(y)){r.delete(u.id);return}_.settled=!0}},ln=(u,h)=>u.then(y=>(h?.(y),Pc(),y),()=>(h?.(!1),Pc(),!1)),An=(u,h)=>{const y=qo;if(qo=null,y)return la=ln(y,h),Xs(u);if(Pr(u))return la=ln(Yo(u).settled,h),!0;const _=Xs(u);return Km(_)&&typeof S()?.documentMutationReadiness?.whenPainted=="function"?(la=ln(Ad(_),h),_):(h?.(_),la=Promise.resolve(_),Pc(),_)},to=(u,h)=>!u||typeof u!="object"?h:u,gr=(u,h=Yn("Document API operation failed."))=>{if(Pr(u))return Promise.resolve(u).then(_=>gr(_,h),()=>h);const y=to(u,h);return ra(),Km(y)&&typeof S()?.documentMutationReadiness?.whenPainted=="function"?(ln(Ad(y)),de(),y):(de(),y)},Fi=(u,h,y,_)=>{const E=[],P=[];for(const j of y){const re=_(j);if(re)try{const ue=Yo(Sr(u,h,re));E.push(ue.immediate),P.push(ue.settled)}catch{E.push(!1),P.push(Promise.resolve(!1))}}return qo=P.length?Promise.all(P).then(j=>Ei(j)):null,Ei(E)},ca=(u,h,y,_)=>{const E=[],P=[];for(const j of y){const re=_(j);if(re)try{const ue=Yo(Sr(u,h,re));E.push(ue.immediate),P.push(ue.settled)}catch{E.push(!1),P.push(Promise.resolve(!1))}}return qo=P.length?Promise.all(P).then(j=>Ei(j)):null,Ei(E)},ec=(u,h,y,_=O.selection)=>{const E=Id(u);return E&&E.success===!1?E:_.selectionTarget?h(y,{...E,offsetSpace:"selection"}):E?h(y,E):h(y)},YH=(u,h,y,_)=>{const E=_o(h,_);switch(u.kind){case"alignment":{const P=y;return P!=="left"&&P!=="center"&&P!=="right"&&P!=="justify"?null:{target:E,alignment:P}}case"spacing-line":{const P=typeof y=="number"?y:Number(y);return!Number.isFinite(P)||P<=0?null:{target:E,line:P,lineRule:"auto"}}case"style":if(y&&typeof y=="object"){const P=y.role;if(P&&typeof P=="object")return{target:E,role:P}}return typeof y!="string"||y.trim()===""?null:{target:E,styleId:y};case"direction":{const P=u.fixedValue;return P!=="ltr"&&P!=="rtl"?null:{target:E,direction:P}}default:return null}},XH=(u,h)=>{const y=u.inline,_=Jb(u),E=B();if(!y||typeof E?.setPendingInlineFormat!="function")return!1;if(y.kind==="clear")return $(),!0;if(!_)return!1;let P;if(y.kind==="toggle")P=!le(u,b(),O.selection);else{const j=h&&typeof h=="object"&&"value"in h?h.value:h;if(y.kind==="value-number"){const re=typeof j=="number"?j:Number(j);P=Number.isFinite(re)&&re>0?re:null}else P=typeof j=="string"&&j.trim()!==""?j:null;if(P===null)return W(_,null),!0}return W(_,P),!0},ZH=()=>{const u=b(),{lockModesById:h}=ws(u?.contentControls,O.selection);if(Cs(h))return!1;const y=[],_=[],E=qe=>{const We=Yo(qe);y.push(We.immediate),_.push(We.settled)},P=(qe,We,Ge)=>{try{E(Ge?qe(We,Ge):qe(We))}catch{y.push(!1),_.push(Promise.resolve(!1))}},j=oi().cache?.full.defaults.paragraphStyleId??sa,re=od(O.selection);if(re){const qe=wr(u,"format.apply");if(qe)try{E(ec("format.apply",qe,{target:re,inline:{...sg()}}))}catch{y.push(!1),_.push(Promise.resolve(!1))}}const ue=wr(u,"format.paragraph.resetDirectFormatting"),xe=wr(u,"styles.paragraph.setStyleRef"),Ve=ds(O.selection),Be=!Ve||Ve.storyType==="body",Ke=wr(u,Be?"lists.remove":"lists.removeInStory");for(const qe of Fr(O.selection)){const We=_o(qe,Ve);if(ue&&P(ue,{target:We}),Ke)try{const Ge=Ha(qe),st=Yo(Ke(Be?{target:Ge}:{target:Ge,story:Ve}));_.push(st.settled.then(it=>Ao(it)?it:!0))}catch{}xe&&P(xe,{target:We,styleId:j})}if(!re&&ir()!=="suggesting"){const qe=wr(u,"format.paragraph.setMarkRunProps");if(qe)for(const We of Fr(O.selection))P(qe,{target:_o(We,Ve),markRunProps:{bold:!1,italic:!1,strikethrough:!1,doubleStrikethrough:!1,smallCaps:!1,caps:!1,verticalAlign:"baseline"}})}return qo=_.length?Promise.all(_).then(qe=>Ei(qe)):null,Ei(y.length?y:[!1])},QH=(u,h,y)=>{const _=Fr(O.selection);if(_.length===0)return!1;const E=ds(O.selection);return Fi(u.docRoute,h,_,P=>YH(u.blockParagraph,P,y,E))},JH=(u,h,y)=>{const _=b(),E=wr(_,"format.paragraph.setIndentation"),P=wr(_,"format.paragraph.clearIndentation"),j=u.list?.mode,re=us(O.selection),ue=ds(O.selection),xe=async Ve=>{const Be=await jt(_,Ve,re);if(Be===!0)return{kind:"list",routeToCall:u.docRoute,opToCall:h,input:{target:CI(Ve)}};if(Be===null||ue&&ue.storyType!=="body"&&typeof _?.getNode!="function")return null;const Ke=await kn(_,Ve,ue),qe={};if(Ke?.right!=null&&(qe.right=Ke.right),Ke?.firstLine!=null&&(qe.firstLine=Ke.firstLine),Ke?.hanging!=null&&(qe.hanging=Ke.hanging),j==="indent")return E?{kind:"paragraph",routeToCall:"format.paragraph.setIndentation",opToCall:E,input:{target:_o(Ve,ue),left:Math.max(0,Ke?.left??0)+kI,...qe}}:null;const We=Math.max(0,(Ke?.left??0)-kI);return We>0&&(qe.left=We),Object.keys(qe).length===0?P?{kind:"paragraph",routeToCall:"format.paragraph.clearIndentation",opToCall:P,input:{target:_o(Ve,ue)}}:E?{kind:"paragraph",routeToCall:"format.paragraph.setIndentation",opToCall:E,input:{target:_o(Ve,ue),left:0}}:null:E?{kind:"paragraph",routeToCall:"format.paragraph.setIndentation",opToCall:E,input:{target:_o(Ve,ue),...qe}}:null};return qo=(async()=>{const Ve=await Promise.all(y.map(We=>xe(We).catch(()=>null)));if(Ve.length===y.length&&Ve.every(We=>We?.kind==="list")&&ir()!=="suggesting"){const We=j==="indent"?"lists.indentRange":"lists.outdentRange",Ge=wr(_,We);if(Ge)try{return await Yo(Sr(We,Ge,{paraIds:y,story:re})).settled}catch{return!1}}const Be=re.storyType!=="body"&&Ve.some(We=>We?.kind==="list"),Ke=Be&&j==="outdent"?wr(_,"lists.outdentInStory"):null;if(Be&&!Ke)return!1;const qe=Ve.map(We=>{if(!We)return Promise.resolve(!1);try{return We.kind==="list"&&Ke?Yo(Sr("lists.outdentInStory",Ke,{target:We.input.target,story:re})).settled:Yo(Sr(We.routeToCall,We.opToCall,We.input)).settled}catch{return Promise.resolve(!1)}});return Ei(await Promise.all(qe))})(),!0},e$=(u,h)=>{const y=u.list,_=b(),E=Fr(O.selection);if(E.length===0)return!1;const P=us(O.selection),j=P.storyType==="body";if(y.mode==="indent"||y.mode==="outdent")return JH(u,h,E);const re=y.seed,ue=Be=>{if(Be.some(it=>!it.resolved))return{immediate:!1,settled:null};const Ke=Be.every(it=>it.seed===re);if(!Ke&&!j)return{immediate:!1,settled:null};const qe=Ke?j?"lists.remove":"lists.removeInStory":u.docRoute,We=Ke?wr(_,qe):h;if(!We)return{immediate:!1,settled:null};const Ge=[],st=[];return E.forEach((it,Xe)=>{if(!Ke&&Be[Xe]?.seed===re)return;const It=Ke?{target:Ha(it),...j?{}:{story:P}}:{target:Ha(it),seed:re};try{const Et=Yo(Sr(qe,We,It));Ge.push(Et.immediate),st.push(Et.settled)}catch{Ge.push(!1),st.push(Promise.resolve(!1))}}),{immediate:Ei(Ge),settled:st.length?Promise.all(st).then(it=>Ei(it)):null}},xe=E.map(Be=>Pn(_,Be,P));if(xe.some(Pr))return qo=Promise.all(xe).then(async Be=>{const Ke=ue(Be);return Ke.settled?await Ke.settled:Ke.immediate}),!0;const Ve=ue(xe);return qo=Ve.settled,Ve.immediate};function wh(u){return u&&typeof u=="object"?u:{}}function t$(u){if(typeof u=="string")return u;const h=wh(u);if(Object.prototype.hasOwnProperty.call(h,"href"))return h.href;if(Object.prototype.hasOwnProperty.call(h,"value"))return h.value}function n$(u,h){const y=wh(u).text;return typeof y=="string"&&y.trim()!==""?y:h}function VI(u){const h=wh(u),y=h.capture&&typeof h.capture=="object"?h.capture:null;return h.target??y?.target??y?.selectionTarget??h.selectionTarget??h.textTarget??null}const r$=u=>{const h=b(),y=h?.hyperlinks;if(!y)return!1;const _=wh(u),E=t$(u),P=VI(u),j=typeof _.text=="string"?_.text:void 0,re=typeof _.currentText=="string"?_.currentText:void 0,ue=hh(_.hyperlinkTarget)?_.hyperlinkTarget:null,xe=hh(_.textTarget)?_.textTarget:null,Ve=J(h,O.selection),Be=typeof ue?.storyId=="string"&&typeof ue?.hyperlinkNodeId=="string";if(Be&&E===null){const Ke=y.remove;if(typeof Ke!="function")return!1;try{return Sr("hyperlinks.remove",Ke,{storyId:ue.storyId,hyperlinkNodeId:ue.hyperlinkNodeId,keepText:!0})}catch{return!1}}if(Ve&&E===null){const Ke=y.remove;if(typeof Ke!="function")return!1;try{return Sr("hyperlinks.remove",Ke,{target:Ve.address,mode:"unwrap"})}catch{return!1}}if((Ve||ue)&&typeof E=="string"&&E.trim()!==""){const Ke=y.patch,qe=y.updateTarget;if(!(!Be&&Ve&&typeof Ke=="function")&&!(Be&&typeof qe=="function"))return!1;const We=typeof j=="string"&&j!==(Be?re:Ve?.text??re),Ge=h?.text?.replace,st=We?Be?xe:nH(Ve?.address):null,it=We&&!!st&&typeof Ge=="function";if(We&&!it)return!1;const Xe=[],It=[];let Et=null,Sn=null,_n=null,_r=!1;try{if(Be){if(typeof qe!="function")return!1;const Rr=Sr("hyperlinks.updateTarget",qe,{storyId:ue.storyId,hyperlinkNodeId:ue.hyperlinkNodeId,newTarget:rH(E)});_r=Pr(Rr);const Lr=Yo(Rr);if(!Ao(Lr.immediate))return!1;Xe.push(Lr.immediate),It.push(Lr.settled),Et=Lr.immediate,Sn=Lr.committed,_n=Lr.settled}else if(Ve){if(typeof Ke!="function")return!1;const Rr=Sr("hyperlinks.patch",Ke,{target:Ve.address,patch:{href:E}});_r=Pr(Rr);const Lr=Yo(Rr);if(!Ao(Lr.immediate))return!1;Xe.push(Lr.immediate),It.push(Lr.settled),Et=Lr.immediate,Sn=Lr.committed,_n=Lr.settled}}catch{return!1}if(it){const Rr=(jr,ci)=>Ao(ci)?Ei([jr,ci]):Ao(jr)?lh(jr,ci):ci,Lr=jr=>{if(!Ao(jr))return jr;try{const ci=Yo(Sr("text.replace",Ge,{target:st,text:j}));return Ao(ci.immediate)?Promise.all([_n??Promise.resolve(jr),ci.settled]).then(([g2,V$])=>Rr(g2,V$)):lh(jr,ci.immediate)}catch{return lh(jr,!1)}};if(_r)return qo=(Sn??Promise.resolve(Et??!1)).then(Lr),Ei(Xe);try{const jr=Yo(Sr("text.replace",Ge,{target:st,text:j}));if(!Ao(jr.immediate))return Et?lh(Et,jr.immediate):jr.immediate;Xe.push(jr.immediate),It.push(jr.settled),qo=Promise.all([_n??Promise.resolve(Et??!1),jr.settled]).then(([ci,g2])=>Rr(ci,g2))}catch{return Et?lh(Et,!1):!1}}return!it&&It.length>0&&(qo=Promise.all(It).then(Rr=>Ei(Rr))),Ei(Xe)}if(typeof E=="string"&&E.trim()!==""){const Ke=E.trim(),qe=y.wrap,We=WU(P),Ge=We.length>0?We:qb(O.selection);if(Ge.length>0){if(typeof qe!="function")return!1;try{return ca("hyperlinks.wrap",qe,Ge,It=>({target:It,link:{destination:{href:Ke}}}))}catch{return!1}}const st=y.insert,it=n$(u,Ke);if(typeof st!="function"||it.trim()==="")return!1;const Xe=dh(P)??Ys(O.selection);if(!Xe)return!1;try{return Sr("hyperlinks.insert",st,{target:Xe,text:it,link:{destination:{href:Ke}}})}catch{return!1}}return!1},o$=(u,h,y)=>{const _=u.create.kind,E=y&&typeof y=="object"?y:{};if(_==="table"){const j=Number(E.rows??E.rowCount),re=Number(E.columns??E.cols??E.colCount);if(!Number.isInteger(j)||j<1||!Number.isInteger(re)||re<1)return!1;const ue=Ys(O.selection),xe=ue&&typeof ue.blockId=="string"?{kind:"inParagraph",target:_o(ue.blockId),offset:ue.range?.start??0}:Zb(O.selection,"nodeId");try{return Sr(u.docRoute,h,{rows:j,columns:re,at:xe})}catch{return!1}}if(_==="image"){const j=E.src??E.value;if(typeof j!="string"||j.trim()==="")return!1;const re=Ys(O.selection),ue=us(O.selection),xe=ue.storyType==="body"?null:ue;let Ve;re&&typeof re.blockId=="string"?Ve={kind:"inParagraph",target:_o(re.blockId,xe),offset:re.range?.start??0}:(Ve=Zb(O.selection,"target"),xe&&Ve.kind==="after"&&(Ve={...Ve,target:{...Ve.target,story:xe}}));const Be={src:j,at:Ve};xe&&(Be.in=Ve.kind==="inParagraph"?Z(xe)??xe:xe),typeof E.alt=="string"&&(Be.alt=E.alt),typeof E.title=="string"&&(Be.title=E.title),E.size&&typeof E.size=="object"&&(Be.size=E.size);try{return Sr(u.docRoute,h,Be)}catch{return!1}}const P={at:Zb(O.selection,"target")};typeof E.instruction=="string"&&(P.instruction=E.instruction),E.config&&typeof E.config=="object"&&(P.config=E.config);try{return Sr(u.docRoute,h,P)}catch{return!1}},i$=(u,h)=>{const y=u.table,_=Pe();if(!_||y.requiresCell&&!_.cellNodeId)return!1;const E=dH(y.action,_);if(!E)return!1;try{if(y.action==="insert-row-before"||y.action==="insert-row-after"){const P=B(),j=(typeof P?.getHandles=="function"?P.getHandles():null)?.editing?.tables;if(typeof j?.insertRow!="function")return!1;const re=Id(u.docRoute);return re&&re.success===!1?re:re?j.insertRow(E,re):j.insertRow(E)}if(y.action==="insert-column-before"||y.action==="insert-column-after"){const P=B(),j=(typeof P?.getHandles=="function"?P.getHandles():null)?.editing?.tables;if(typeof j?.insertColumn!="function")return!1;const re=Id(u.docRoute);return re&&re.success===!1?re:re?j.insertColumn(E,_.rowIndex,re):j.insertColumn(E,_.rowIndex)}return Sr(u.docRoute,h,E)}catch{return!1}},s$=u=>!u||u.disposition!=="routed"?!1:!!(u.inline||u.blockParagraph||u.list||u.link||u.create),a$=u=>{const h=wh(u);return!!(VI(u)||hh(h.hyperlinkTarget)||hh(h.textTarget))},l$=(u,h,y)=>O.selection.status!=="ready"?!1:Ym(u)?.scope==="id"||!h||h.disposition!=="routed"?!0:h.inline?.kind==="clear"?Fr(O.selection).length>0||od(O.selection)!=null:h.inline?od(O.selection)!=null||Fr(O.selection).length>0:h.blockParagraph||h.list?Fr(O.selection).length>0:h.link?a$(y)||qb(O.selection).length>0||Ys(O.selection)!=null||le(h,b(),O.selection):!0,c$=(u,h)=>{const y=Ym(u),_=Xu(u);return y?.scope!=="id"&&!s$(_)?!1:!l$(u,_,h)},u$=(u,h)=>c$(u,h)?Yi().then(()=>{}):null,Qc=(u,h,y)=>{if(qo=null,la=Promise.resolve(!1),V)return!1;const _=Ze.get(u);if(_)try{const Be=_.execute(Fc(h,y));return An(Be)}catch{return!1}const E=pI(u);if(E){if(ir()==="viewing")return!1;if(typeof X()?.lists?.apply=="function")return s2(E,h)}const P=Ym(u);if(P)return i2(P,h);if(u==="copy-format")return An(d$());const j=Xu(u);if(!j||j.disposition!=="routed")return!1;const re=j.normalizePayload?j.normalizePayload(h):h;if(j.instanceRoute){if(!S()||!Lo(j,re))return!1;const Be=t?.[j.instanceRoute];if(typeof Be!="function")return!1;try{const Ke=j.fixedArg!==void 0?j.fixedArg:re,qe=Be.call(t,Ke);return An(qe)}catch{return!1}}if(j.inline?.kind==="clear")return j.mutates&&ir()==="viewing"?!1:An(ZH());const ue=j.docRoute;if(!ue||j.mutates&&ir()==="viewing")return!1;const xe=b(),Ve=wr(xe,ue);if(!Ve)return!1;if(j.inline){const{lockModesById:Be}=ws(xe?.contentControls,O.selection);if(Cs(Be))return!1;const Ke=od(O.selection);if(!Ke)return O.selection.empty===!1?An(!1):An(XH(j,re));const qe=le(j,xe,O.selection),We=cH(j.inline,Ke,re,qe);if(!We)return!1;let Ge=null;try{const st=S(),it=ir(),Xe=()=>S()!==st||b()!==xe||ir()!==it?!1:ec(ue,Ve,We),It=$a(O.selection)??xc(O.selection),Et=j.inline.kind==="toggle"?rg(`${j.id}:${It}`,Xe):null;Ge=Et?.release??null;const Sn=Et?Et.result:Xe(),_n=Tt(j,O.selection,We,Sn),_r=ag(j,O.selection,We,Sn),Rr=An(_r,Lr=>{$t(j,_n,Lr),Ge?.(),Ge=null});return j.inline.kind==="toggle"&&(qn=la),Rr}catch{return Ge?.(),!1}}if(j.blockParagraph){const Be=QH(j,Ve,re),Ke=j.blockParagraph.kind==="alignment"&&Ao(Be)?On(O.selection,re):null;return An(Be,qe=>{xr(Ke,qe)})}if(j.list){const Be=e$(j,Ve);return An(Be)}if(j.link){const Be=r$(re);return An(Be)}if(j.create){const Be=o$(j,Ve,re);return An(Be)}if(j.table){const Be=i$(j,Ve);return An(Be)}try{return An(j.mutates?Sr(ue,Ve,re):Ve(re))}catch{return!1}},lg=()=>{g+=1,p={mode:"idle",snapshot:null,sourceSelectionKey:null,lastClickAt:p.lastClickAt,pointerSelecting:!1,keyboardSelecting:!1};for(const u of m)u("idle");de()},d$=async()=>{const u=["bold","italic","underline","strikethrough"].filter(Ve=>O.toolbar.commands[Ve]?.active===!0),h=await qn;await d;const y=Ao(h)?u:[],_=500,E=Date.now();if(p.mode!=="idle"){if(p.mode==="armed"&&E-p.lastClickAt<_){p={...p,mode:"persistent",lastClickAt:E};for(const Ve of m)Ve("persistent");return de(),!0}return lg(),!1}const P=E-p.lastClickAt<_,j=++g;p={...p,lastClickAt:E};const re=await Yi(),ue=`${xc(re)}:${Re()}`,xe=await f$(null,re,ue&&ue===k?v:void 0,y);if(j!==g)return!0;p={...p,mode:P?"persistent":"armed",snapshot:xe,sourceSelectionKey:xc(re),lastClickAt:E};for(const Ve of m)Ve(p.mode);return de(),!0},f$=async(u,h,y,_=[])=>{const E=h?.target??u?.target;if(!E||E.kind!=="text")return null;const P=Array.isArray(E.segments)?E.segments:[];if(P.length===0)return null;const j=b();if(!j)return null;const re=E.story;let ue=null;for(const We of P){const Ge=(await Wl(_o(We.blockId,re)))?.node??null;if(!Ge)continue;const st=a2(Ge),it=Array.isArray(st?.inlines)?st.inlines:[],Xe=h$(it,We.range);ue?ue=jI(ue,Xe):ue=Xe}const xe=ue?cU(ue):{},Ve={bold:"bold",italic:"italic",underline:"underline",strikethrough:"strike"},Be=new Set([...h?.activeMarks??(Array.isArray(u?.activeMarks)?u.activeMarks:[]),..._]);for(const[We,Ge]of Object.entries(Ve))Be.has(We)&&(xe[Ge]=!0);const Ke=y??await qc(h??vs(u,"ready"));if(Ke.fontFamily&&(xe.fontFamily=Ke.fontFamily),Ke.color&&(xe.color=Ke.color),Ke.highlight&&(xe.highlight=Ke.highlight),Ke.fontSize){const We=Number.parseFloat(Ke.fontSize);Number.isNaN(We)||(xe.fontSize=We)}let qe=null;if(P.length===1){const We=P[0],Ge=(await Wl(_o(We.blockId,re)))?.node??null;Ge&&a2(Ge)&&(qe=await p$(Ge,We.blockId,j,re))}return{story:re??null,inline:xe,paragraph:qe}},a2=u=>u?u.kind==="paragraph"?u.paragraph??null:u.kind==="heading"?u.heading??null:null:null,h$=(u,h)=>{const y=j=>{const re=j.run;return typeof re?.text=="string"?re.text:""},_=j=>j.run?.props;if(h.start===h.end){let j=0;for(const re of u){const ue=y(re),xe=j,Ve=j+ue.length;if(j=Ve,h.start>=xe&&h.start<=Ve){const Be=_(re);return Be?{...Be}:{}}}return{}}let E=0;const P=[];for(const j of u){const re=y(j),ue=E,xe=E+re.length;if(E=xe,xe<=h.start||ue>=h.end)continue;const Ve=_(j);Ve&&P.push(Ve)}return P.length===0?{}:P.length===1?{...P[0]}:jI(P[0],...P.slice(1))},jI=(u,...h)=>{const y={...u};for(const _ of h)for(const E of Object.keys(y)){if(!(E in _)){delete y[E];continue}const P=y[E],j=_[E];(typeof P!=typeof j||JSON.stringify(P)!==JSON.stringify(j))&&delete y[E]}return y},p$=async(u,h,y,_)=>{const E=a2(u),P=E.props??{},j=E.styleRef??null,re=P.alignment??null,ue=P.spacing??null,xe=P.indent??null,Ve=xe?{...xe.left!=null?{left:xe.left}:{},...xe.right!=null?{right:xe.right}:{},...xe.firstLine!=null?{firstLine:xe.firstLine}:{},...xe.hanging!=null?{hanging:xe.hanging}:{}}:null,Be=P.markRunProps??null,Ke=P.numbering?.numId,qe=typeof Ke=="string"?parseInt(Ke,10):typeof Ke=="number"?Ke:NaN,We=P.numbering?.level,Ge=isNaN(qe)?null:{numId:qe,...We!=null?{level:We}:{}};let st=null;if(Ge&&typeof y.lists?.getState=="function")try{const it=await y.lists.getState({target:_o(h,_)});it&&typeof y.lists?.getStyle=="function"&&(st=await y.lists.getStyle(it)??null)}catch{}return{styleId:j,alignment:re,spacing:ue,indentation:Ve,markRunProps:Be,numbering:Ge,listStyle:st}},UI=async()=>{if(p.mode==="idle"||p.pointerSelecting||p.keyboardSelecting)return;const u=b()?.selection,h=async()=>{const j=typeof u?.current=="function"?await Promise.resolve(u.current({includeText:!0})):jl().value;return qi(j)},y=()=>new Promise(j=>setTimeout(j,16)),_=8;let E=null,P="";for(let j=0;j<_;j+=1){if(j>0&&await y(),p.mode==="idle"||p.pointerSelecting||p.keyboardSelecting)return;if(E=await h(),!(!E||E.empty)&&(P=xc(E),P!==p.sourceSelectionKey))break}if(E&&!E.empty&&P!==p.sourceSelectionKey){await HI(E);return}if(p.snapshot?.paragraph){const j=await h();if(!j||xc(j)===p.sourceSelectionKey)return;await HI(j)}},HI=async u=>{const h=p.snapshot;if(!h){p.mode==="armed"&&lg();return}const y=b();if(!y)return;const _=vs(u,"ready"),{lockModesById:E}=ws(y.contentControls,_);if(Cs(E)){de();return}const P=u.target,j=u.selectionTarget;if(u.empty!==!0&&Object.keys(h.inline).length>0){const re=wr(y,"format.apply");if(re&&j)try{if(!Ao(Xs(await Promise.resolve(ec("format.apply",re,{target:j,inline:h.inline},u))))){de();return}}catch{de();return}}if(h.paragraph){const re=Array.isArray(P?.segments)?P.segments:[],ue=P?.story;for(const xe of re){const Ve=_o(xe.blockId,ue),Be=await Wl(Ve),Ke=Be?.node??null,qe=Be?.address??null;if(!Ke)continue;const We={kind:"block",nodeType:qe?.nodeType??Ke.kind??"paragraph",nodeId:xe.blockId,...ue&&typeof ue=="object"?{story:ue}:{}},{styleId:Ge,alignment:st,spacing:it,indentation:Xe,markRunProps:It,numbering:Et,listStyle:Sn}=h.paragraph;if(Ge&&await y.styles?.paragraph?.setStyle?.({target:We,styleId:Ge}),st&&await y.format?.paragraph?.setAlignment?.({target:We,alignment:st}),it){const _n=it,_r=_n.lineRule??"auto",Rr=new Set(["auto","exact","atLeast"]).has(_r)?_r:"auto",Lr={..._n.before!=null?{before:Math.round(_n.before*20)}:{},..._n.after!=null?{after:Math.round(_n.after*20)}:{},..._n.line!=null?{line:Math.round(Rr==="auto"?_n.line*240:_n.line*20),lineRule:Rr}:{}};await y.format?.paragraph?.setSpacing?.({target:We,...Lr})}if(Xe){const _n={...Xe.left!=null?{left:qs(Xe.left)}:{},...Xe.right!=null?{right:qs(Xe.right)}:{},...Xe.firstLine!=null?{firstLine:qs(Xe.firstLine)}:{},...Xe.hanging!=null?{hanging:qs(Xe.hanging)}:{}};await y.format?.paragraph?.setIndentation?.({target:We,..._n})}It&&await y.format?.paragraph?.setMarkRunProps?.({target:We,markRunProps:It}),Et&&await y.format?.paragraph?.setNumbering?.({target:We,...Et}),Sn&&((await Wl(Ve))?.address?.nodeType==="listItem"?await y.lists?.applyStyle?.({target:CI(xe.blockId,ue),style:Sn}):Et&&await y.format?.paragraph?.setNumbering?.({target:We,...Et}))}}p.mode==="armed"&&lg(),de()},cg=(u,h,y)=>{const _=u$(u,h),E=_?_.then(()=>(Qc(u,h,y),la)):(Qc(u,h,y),la);return Xu(u)?.inline?.kind==="toggle"&&(qn=E),E},$I=u=>({id:u,getState:()=>O.toolbar.commands[u]??I(u,b(),O.selection,Xa(O.selection)),observe:h=>Kn(y=>y.toolbar.commands[u]??{enabled:!1,active:!1,supported:!1,source:"unsupported",reason:lt.commandUnsupported}).subscribe(h),execute:h=>Qc(u,h),executeAsync:h=>cg(u,h)}),m$=u=>{Ze.set(u.id,u),de();const h=()=>{Ze.delete(u.id),de()};return Object.assign(h,{handle:$I(u.id),unregister:h})},ug=Cn(u=>u.selection),dg=Tn(ug),GI=()=>{const u=B();if(typeof u?.getHandles!="function")return{reason:lt.hostCapabilityUnavailable};let h=null;try{h=u.getHandles()}catch(_){const E=_?.reason;return{reason:E==="host-not-ready"||E==="host-disposed"||E==="editing-mount-required"?lt.notReady:lt.hostCapabilityUnavailable}}const y=h?.editing?.selectionTargets;return typeof y?.apply!="function"?{reason:lt.hostCapabilityUnavailable}:{helper:y}},g$=u=>{const h=B();if(typeof h?.getHandles=="function")try{const y=h.getHandles()?.editing?.contentControls;typeof y?.activate=="function"&&y.activate({id:u})}catch{}},WI={get:dg.get,getSnapshot:dg.getSnapshot,subscribe:dg.subscribe,observe:dg.observe,current:()=>jl().value,capture:()=>{const u=ug.get();return u.empty||!u.target&&!u.selectionTarget?null:{...u,capturedAt:Date.now()}},restore:u=>{const h=E=>(de(),{...E,success:E.ok});if(!u||typeof u!="object")return h({ok:!1,reason:lt.targetUnresolved});if(!S())return h({ok:!1,reason:lt.notReady});const y=aH(u);if(!y)return h({ok:!1,reason:lt.targetUnresolved});const _=GI();if(!("helper"in _))return h({ok:!1,reason:_.reason});try{return h(hI(_.helper.apply(y)))}catch{return h({ok:!1,reason:lt.hostCapabilityUnavailable})}},apply:u=>{if(!S())return{ok:!1,reason:lt.notReady};const h=GI();if(!("helper"in h))return{ok:!1,reason:h.reason};try{const y=h.helper.apply(u);return de(),hI(y)}catch{return{ok:!1,reason:lt.hostCapabilityUnavailable}}},getAnchorRect:u=>{const h=B();if(typeof h?.getSelectionAnchorRect=="function"){const y=Lt(()=>h.getSelectionAnchorRect(u),null);return y&&typeof y=="object"&&(Number(y.width)>0||Number(y.height)>0)?y:null}return null},getRects:u=>{const h=ug.get(),y=h.selectionTarget??h.target;if(h.empty||!y)return[];const _=wg.getRect({target:y,relativeTo:u?.relativeTo});return _.found?_.rects:[]}},v$={get ids(){return ri()},has:u=>Xu(u)!=null||Ze.has(u),get:u=>$I(u),execute:Qc,executeAsync:cg,register:m$,getContextMenuItems:u=>{const h=[];for(const y of Ze.values()){const _=y.contextMenu;_&&Lt(_.when?()=>_.when(u):void 0,!0)&&h.push({id:y.id,label:_.label,group:_.group,order:_.order,invoke:()=>Qc(y.id,void 0,u)})}return h.sort((y,_)=>(y.order??0)-(_.order??0)||y.label.localeCompare(_.label))}},l2=Tn(Cn(u=>u.toolbar)),y$={get:l2.get,getSnapshot:()=>O.toolbar,subscribe:l2.subscribe,observe:l2.observe,execute:Qc,executeAsync:cg},Td=async(u,h)=>{if(!S())return{success:!1,ok:!1,reason:lt.notReady};if(!u)return{success:!1,ok:!1,reason:lt.targetUnresolved};const y=B(),_=y?.scrollTargetIntoView;if(typeof _!="function")return{success:!1,ok:!1,reason:lt.hostCapabilityUnavailable};try{const E={target:u,block:h?.block??"center",behavior:h?.behavior??"smooth"},P=await Promise.resolve(h?.shouldContinue?_.call(y,E,h.shouldContinue):_.call(y,E));return P&&typeof P=="object"&&P.success===!1?{success:!1,ok:!1,reason:$m(P.reason,lt.targetUnresolved)}:{success:!0,ok:!0}}catch{return{success:!1,ok:!1,reason:lt.hostCapabilityUnavailable}}},KI=u=>{if(!u||typeof u!="object")return null;const h=u,y=h.wordRevisionIds&&typeof h.wordRevisionIds=="object"?h.wordRevisionIds:null,_=h.sourceIds&&typeof h.sourceIds=="object"?h.sourceIds:null,E=Array.isArray(_?.wordIdOther)?_.wordIdOther:void 0,P=y?.insert??y?.delete??y?.format??_?.wordIdInsert??_?.wordIdDelete??E?.[0];return typeof P=="string"&&P.length>0?P:null},qI=async(u,h,y,_,E)=>{const P=await Td(h,E);if(P.ok)return P;const j=T(),re=j?.focusTrackedChange;if(typeof re!="function")return P;const ue=y||_?{commentId:u,...y?{trackedChangeStory:y}:{},..._?{importedId:_}:{}}:u;try{const xe=await Promise.resolve(re.call(j,ue));if(xe&&typeof xe=="object"&&xe.ok===!0)return{success:!0,ok:!0}}catch{}return P},fg=async(u,h,y,_)=>{const E=u==="trackChanges"?_?.story:void 0,P=it=>{if(!E||!it||typeof it!="object")return it;const Xe=it,It=Xe.address&&typeof Xe.address=="object"?Xe.address:null;return Xe.story||It?.story?it:{...Xe,story:E}},j=u==="trackChanges"?gI:ch,re=y.find(it=>$i(it,h,E)),ue=re&&typeof re=="object"?re:null,xe=u==="trackChanges"&&ue?.type==="move"&&(ue.subtype==="move-to"||ue.subtype==="move-from")?ue.subtype:null,Ve=xe&&typeof ue?.trackedChangeCanonicalId=="string"?ue.trackedChangeCanonicalId:h,Be=it=>{if(!xe)return u==="trackChanges"?gI(it,{preferStableBlock:!0}):j(it);const Xe=ch(it);if(Xe?.kind!=="move")return null;const It=xe==="move-to"?Xe.destination:Xe.source;return Wb(It)?It:null},Ke=j(re),qe=u!=="trackChanges"||!xe&&Wb(ch(re));if(Ke&&qe)return P(Ke);const We=b()?.[u],Ge=u==="comments"?{commentId:h}:{id:Ve,...E?{story:E}:{}},st=We?.get;if(typeof st!="function")return P(Ke);try{return P(Be(await Promise.resolve(st.call(We,Ge)))??Ke)}catch{return P(Ke)}};function YI(u,h){if(Vl())return Yn("Comments are read-only.","DOCUMENT_READONLY");if(sd())return Yn("Resolving comments is disabled.","DOCUMENT_READONLY");const y=b()?.comments,_=y?.patch;if(typeof _!="function")return Yn("comments.patch is unavailable.");const E=Yn("comments.patch failed.");return Lt(()=>gr(_.call(y,{commentId:u,status:h}),E),E)}const Ch=()=>Vl()?Yn("Comments are read-only.","DOCUMENT_READONLY"):null,b$=(u,h)=>{const y=h&&typeof h=="object"?h:null;let _=Array.from(u);y?.includeResolved===!1&&(_=_.filter(ue=>ue.status!=="resolved"));const E=Number(y?.offset),P=Number.isInteger(E)&&E>0?E:0,j=Number(y?.limit),re=Number.isInteger(j)&&j>=0?P+j:void 0;return _.slice(P,re)},xd=Cn(u=>u.comments),hg=tl(xd,Kn(u=>jc(u.selection,u.comments)),"comments"),w$={get:hg.get,getSnapshot:hg.getSnapshot,subscribe:hg.subscribe,observe:hg.observe,list:u=>{_e();const h=mr();return b$(h.value??xd.get().items,u)},getById:u=>{const h=xd.get().items.find(E=>Kr(E)===u)??null;if(h)return h;const y=b()?.comments,_=Lt(y?.get?()=>y.get({commentId:u}):void 0,null);return Pr(_)?null:_},createFromCapture:(u,h)=>{const y=Ch();if(y)return y;const _=b()?.comments,E=_?.create;if(typeof E!="function")return Yn("comments.create is unavailable.");const P=Yn("comments.create failed.");return Lt(()=>{const j=u&&typeof u=="object"?u.target??u.selectionTarget:null;return j==null?Yn("A range selection is required to comment.","NO_SELECTION"):gr(E.call(_,{target:j,text:h.text}),P)},P)},createFromSelection:u=>{const h=Ch();if(h)return h;const y=b()?.comments,_=y?.create;if(typeof _!="function")return Yn("comments.create is unavailable.");const E=ug.get(),P=E.target??E.selectionTarget;if(E.empty||!P)return Yn("A range selection is required to comment.","NO_SELECTION");const j=Yn("comments.create failed.");return Lt(()=>gr(_.call(y,{target:P,text:u.text}),j),j)},reply:(u,h)=>{const y=Ch();if(y)return y;const _=b()?.comments,E=_?.reply??_?.create;if(typeof E!="function")return Yn("comments.reply is unavailable.");const P=Yn("comments.reply failed.");return Lt(()=>gr(E===_?.reply?E.call(_,{parentCommentId:u,text:h.text}):E.call(_,{parentCommentId:u,text:h.text}),P),P)},edit:(u,h)=>{const y=Ch();if(y)return y;const _=b()?.comments,E=_?.patch;if(typeof E!="function")return Yn("comments.patch is unavailable.");const P=Yn("comments.patch failed.");return Lt(()=>gr(E.call(_,{commentId:u,text:h.text}),P),P)},resolve:u=>YI(u,"resolved"),reopen:u=>YI(u,"active"),delete:u=>{const h=Ch();if(h)return h;const y=b()?.comments,_=y?.delete??y?.remove;if(typeof _!="function")return Yn("comments.delete is unavailable.");const E=Yn("comments.delete failed.");return Lt(()=>gr(_.call(y,{commentId:u}),E),E)},setActive:u=>{if(u==null)return at=null,de(),!0;if(!S())return!1;const h=xd.get(),y=U.get("comments"),_=y?.token===Re()&&y.hasSettled&&Array.isArray(y.value)?y.value:null,E=_??h.items;if(!_&&h.listStatus!=="ready")return!1;const P=UU(E,u);return!P||!E.some(j=>Kr(j)===P)?!1:(at=P,de(),!0)},scrollTo:async u=>{if(!b())return{success:!1,ok:!1,reason:S()?lt.documentApiUnavailable:lt.notReady};const h=await fg("comments",u,xd.get().items);return h?Td(h):{success:!1,ok:!1,reason:lt.targetUnresolved}}},Is=Cn(u=>u.trackChanges),c2=(u,h)=>{Ti();const y=(oa().value??Is.get().items).map(nd).filter(Be=>Be!=null&&Kr(Be)!==null);if(y.length===0)return null;const _=O.trackChanges.activeId,E=Qe?.id===_?Qe.story:void 0,P=y.filter(Be=>Gm(Be)==null),j=E||P.length===0?y:P;let re=_?j.findIndex(Be=>$i(Be,_,E)):-1;re===-1&&_&&E&&(re=j.findIndex(Be=>$i(Be,_)));const ue=j[re===-1?u>0?0:j.length-1:(re+u+j.length)%j.length],xe=Kr(ue),Ve=Gm(ue);return F(Ve?{id:xe,story:Ve}:{id:xe},h),de(),xe},XI=async u=>{const h=T(),y=h?.listTrackedChanges;if(typeof y=="function")try{await Promise.resolve(y.call(h,{mode:"visible-window",targetIds:[u],refreshReason:"ui-track-change-reveal-restamp",blocking:!0}))}catch{}};let ZI=Promise.resolve();const C$=u=>{const h=se;return ZI.catch(()=>{}).then(()=>k$(u,h))},k$=async(u,h)=>{if(se!==h)return{success:!1};const y=Qe,_=c2(u,{invalidateQueuedNavigation:!1});if(_==null)return{success:!1};const E=Qe,P=At,j=()=>se===h&&Qe===E&&At===P,re=()=>{j()&&(F(y,{invalidateQueuedNavigation:!1}),de())};E&&Ue.add(E);try{const ue=await fg("trackChanges",_,Is.get().items,E?.story?{story:E.story}:void 0);if(!j())return{success:!1};if(!ue)return re(),{success:!1};const xe=Is.get().items.find(Be=>$i(Be,_,E?.story))??Is.get().items.find(Be=>Kr(Be)===_),Ve=KI(xe);Wo+=1;try{const Be=await qI(_,ue,E?.story,Ve,{behavior:"auto",shouldContinue:j});if(!j())return{success:!1};if(!Be.ok&&Be.reason!==lt.targetNotVisible)re(),ie(y);else{if(Be.ok&&await XI(_),!j())return{success:!1};ie(E)}return{success:Be.ok}}finally{Wo=Math.max(0,Wo-1),Wo===0&&(j()?si&&yi(li(si)):ie(Qe))}}finally{E&&Ue.delete(E)}},QI=u=>{const h=C$(u);return ZI=h.then(()=>{},()=>{}),h},pg=tl(Is,Kn(u=>ph(u.selection,u.trackChanges)),"trackChanges"),S$={get:pg.get,getSnapshot:pg.getSnapshot,subscribe:pg.subscribe,observe:pg.observe,list:()=>{Ti();const u=oa().value??Is.get().items,h=un(Re());return u.map(nd).filter(y=>y!=null).filter(y=>{const _=Kr(y);return!_||!h?.has(_)})},accept:u=>u2("accept",u),reject:u=>u2("reject",u),acceptAll:()=>kh("accept",{kind:"all"},null),rejectAll:()=>kh("reject",{kind:"all"},null),next:()=>c2(1),previous:()=>c2(-1),navigateNext:()=>QI(1),navigatePrevious:()=>QI(-1),getAt:u=>{if(!u||typeof u!="object"||typeof u.x!="number"||typeof u.y!="number")return null;const h=h2(u);if(h.length===0)return null;const y=Is.get().items;let _;for(const E of h){if(E.type!=="trackedChange")continue;let P;if(E.story){if(_===void 0&&(_=bs()),!_)continue;P=_}else P=y;const j=P.find(re=>$i(re,E.id,E.story));if(j)return E.story?{id:j.id,item:j,story:E.story}:{id:j.id,item:j}}return null},setActive:u=>{if(u==null)return F(null),ie(null),de(),!0;if(!S())return!1;const h=typeof u=="string"?{id:u}:{id:u.id,story:u.story};if(typeof h.id!="string"||h.id.length===0)return!1;const y=h.id;if(h.story){const _=bs();if(!_)return!1;const E=Lc(_,h.story).toPublicId(h.id)??h.id;if(!_.some(P=>$i(P,E,h.story)))return!1;h.id=E}else{const _=bs()??Is.get().items,E=Ks(_).toPublicId(h.id)??h.id,P=_.find(j=>Kr(j)===E);if(!P)return!1;h.id=E,h.story=Gm(P)}return y!==h.id&&(h.paintedEntityId=y),F(h),ie(h),de(),!0},scrollTo:async u=>{if(!b())return{success:!1,ok:!1,reason:S()?lt.documentApiUnavailable:lt.notReady};se+=1,Ie+=1;const h=Ie,y=Is.get().items,_=Ks(y).toPublicId(u)??u,E=y.find(xe=>Kr(xe)===_),P=Gm(E),j=KI(E),re=Qe,ue={id:_,...P?{story:P}:{},..._!==u?{paintedEntityId:u}:{}};Ue.add(ue);try{const xe=await fg("trackChanges",_,y,P?{story:P}:void 0);if(Ie!==h)return{success:!1,ok:!1};if(!xe)return{success:!1,ok:!1,reason:lt.targetUnresolved};F(ue);const Ve=Ie,Be=Qe,Ke=At,qe=()=>Ie===Ve&&Qe===Be&&At===Ke,We=()=>{qe()&&(F(re,{invalidateQueuedNavigation:!1}),de())};de(),Wo+=1;try{const Ge=await qI(_,xe,P,j,{behavior:"auto",shouldContinue:qe});if(!qe())return{success:!1,ok:!1};if(!Ge.ok&&Ge.reason!==lt.targetNotVisible)We(),ie(re);else{if(Ge.ok&&await XI(_),!qe())return{success:!1,ok:!1};ie(ue)}return Ge}finally{Wo=Math.max(0,Wo-1),Wo===0&&(qe()?si&&yi(li(si)):ie(Qe))}}finally{Ue.delete(ue)}}},u2=(u,h)=>{const{id:y,story:_}=typeof h=="string"?{id:h,story:void 0}:h,E={kind:"id",id:y,..._?{story:_}:{}};return kh(u,E,y,_)},kh=(u,h,y,_)=>{try{return An(d2(u,h,y,_))}catch{return!1}},d2=(u,h,y,_)=>{if(ad())return!1;const E=b()?.trackChanges,P=h.kind==="all"||h.scope==="all",j=h.kind==="range",re=h.kind==="ids",ue=P?[]:re&&Array.isArray(h.ids)?h.ids.filter(Ke=>typeof Ke=="string"&&Ke.length>0):y?[y]:[];if(ue.length>0&&ks(u,ue)||Sd({kind:u,scope:P?"all":"id"},E))return!1;const xe=P?`${u}All`:u,Ve=!j&&!re&&!_&&E&&typeof E[xe]=="function"?E[xe]:null,Be=E&&typeof E.decide=="function"?E.decide:null;return!Ve&&!Be?!1:Ve?Ve.call(E,y??{}):Be.call(E,{decision:u,target:h})},f2=Cn(u=>u.contentControls),Sh=u=>f2.get().items.find(h=>h?.id===u)??null,mg=Tn(f2),_$=(u=>{if(u===void 0)return mg.get();const h=Wm(u);return h?Sh(h):null}),A$={get:(u=>(u!==void 0&&ei("api"),_$(u))),getSnapshot:mg.getSnapshot,subscribe:mg.subscribe,observe:mg.observe,list:()=>(ei("api"),f2.get().items),getById:u=>(ei("api"),Sh(u)),getRect:u=>{const h=Wm(u);if(!h)return Fl("unresolved");ei("panel");const y=Sh(h);if(!y)return Fl("unresolved");const _=Kb(y);return _?wg.getRect({target:_}):Fl("unavailable")},scrollIntoView:async u=>{const h=Wm(u);if(!h)return{success:!1};ei("panel");const y=Sh(h);if(!y)return{success:!1};const _=Kb(y);return _?{success:(await Td(_,{block:u.block,behavior:u.behavior})).ok}:{success:!1}},focus:async u=>{const h=Wm(u);if(!h)return{success:!1,reason:"invalid-id"};if(!S())return{success:!1,reason:"not-ready"};ei("panel");const y=Sh(h);if(!y)return{success:!1,reason:"not-found"};const _=Kb(y);if(!_)return{success:!1,reason:"not-reachable"};if(!(await Td(_,{block:u.block,behavior:u.behavior})).ok)return{success:!1,reason:"not-reachable"};const E=PU(_);if(!E)return{success:!1,reason:"not-reachable"};const P=WI.apply(E);return!P.ok&&P.reason!==lt.hostCapabilityUnavailable?{success:!1,reason:"not-reachable"}:(g$(h),{success:!0})}},gg=Tn(Cn(u=>u.fonts)),I$={get:gg.get,getSnapshot:gg.getSnapshot,subscribe:gg.subscribe,observe:gg.observe,getFamilyOptions:()=>O.fonts.options,getSizeOptions:()=>O.fonts.sizeOptions},vg=Tn(Cn(u=>u.zoom)),E$={get:vg.get,getSnapshot:vg.getSnapshot,subscribe:vg.subscribe,observe:vg.observe,set:u=>{if(typeof t?.setZoom=="function")try{t.setZoom(u),de()}catch{}},setMode:u=>{if(typeof t?.setZoomMode=="function")try{t.setZoomMode(u),de()}catch{}}},yg=Tn(Cn(u=>u.document)),T$={get:yg.get,getSnapshot:yg.getSnapshot,subscribe:yg.subscribe,observe:yg.observe,setMode:u=>{if(typeof t?.setDocumentMode=="function")try{t.setDocumentMode(u),de()}catch{}},export:u=>{if(typeof t?.export=="function")try{return Promise.resolve(t.export(u))}catch{return}},getText:()=>{const u=b(),h=Lt(u?.getText?()=>u.getText({}):void 0,null);return typeof h=="string"?h:h&&typeof h=="object"&&typeof h.text=="string"?h.text:null},replaceFile:u=>{const h=t?.replaceFile??t?.loadDocument??t?.reload;if(typeof h=="function")try{return Promise.resolve(h.call(t,u))}catch{return}}},JI=()=>{if(typeof HTMLElement>"u")return null;const u=S()?.mount?.container;if(u instanceof HTMLElement)return u;const h=t?.element;return h instanceof HTMLElement?h:null},x$=(u,h)=>{if(typeof u!="number"||typeof h!="number"||!Number.isFinite(u)||!Number.isFinite(h))return[];const y=globalThis.document;if(!y||typeof y.elementFromPoint!="function")return[];const _=JI();if(!_)return[];const E=y.elementFromPoint(u,h);if(!E||!_.contains(E))return[];const P=[E],j=Xe=>{Xe&&_.contains(Xe)&&!P.includes(Xe)&&P.push(Xe)},re=y.elementsFromPoint;if(typeof re=="function"){let Xe=[];try{Xe=re.call(y,u,h)??[]}catch{Xe=[]}for(const It of Xe)j(It)}const ue=[],xe=Xe=>{Xe&&_.contains(Xe)&&!ue.includes(Xe)&&!P.includes(Xe)&&ue.push(Xe)},Ve=Xe=>{const It=Xe.getBoundingClientRect;if(typeof It!="function")return!1;let Et;try{Et=It.call(Xe)}catch{return!1}return Et!=null&&u>=Et.left&&u<=Et.right&&h>=Et.top&&h<=Et.bottom};for(const Xe of P){const It=Xe.querySelectorAll;if(typeof It!="function")continue;let Et;try{Et=It.call(Xe,"[data-track-change-marker]")}catch{continue}for(let Sn=0;Sn<Et.length;Sn+=1)Ve(Et[Sn])&&xe(Et[Sn])}ue.reverse();const Be=[...ue,...P],Ke=fI(Be[0],_);for(let Xe=1;Xe<Be.length;Xe+=1)for(const It of fI(Be[Xe],_))Ke.push(It);if(Ke.length===0)return Ke;const qe=Is.get().items,We=Ks(qe);let Ge;const st=new Set,it=[];for(const Xe of Ke){if(Xe.type!=="trackedChange"){const _n=`${Xe.type}:${Xe.id}`;if(st.has(_n))continue;st.add(_n),it.push(Xe);continue}const It=OU(Xe.storyKey)??DU(Xe.story);let Et;if(It){if(Ge===void 0&&(Ge=bs()),!Ge||(Et=Lc(Ge,It).toPublicId(Xe.id),!Et||!Ge.some(_n=>$i(_n,Et,It))))continue}else if(Et=We.toPublicId(Xe.id),!Et)continue;const Sn=`trackedChange:${Et}`;st.has(Sn)||(st.add(Sn),it.push(It?{type:"trackedChange",id:Et,story:It}:{type:"trackedChange",id:Et}))}return it};function h2(u,h){return typeof u=="object"?x$(u?.x,u?.y):null}const Rd=new Set;let p2=!1;const eE=u=>{const h=B();if(typeof h?.observeGeometry!="function")return;let y=!1;const _=Lt(()=>{const E=h.observeGeometry(()=>u.schedule());return y=!0,E},null);u.detach=typeof _=="function"?_:null,u.boundHost=y?h:null},bg=u=>{if(u.detach){try{u.detach()}catch{}u.detach=null}u.boundHost=null},tE=()=>{if(p2=!1,!(V||B()))for(const u of Rd)bg(u)},R$=()=>{if(!p2){if(p2=!0,typeof queueMicrotask=="function"){queueMicrotask(tE);return}Promise.resolve().then(tE)}},L$=()=>{const u=B();if(!u){R$();return}for(const h of Rd)h.boundHost&&h.boundHost===u||(bg(h),eE(h),h.schedule())};Ne.push(L$);const wg={getRect:u=>{const h=B(),y=h?.getTargetRects;if(typeof y=="function"){const _=Lt(()=>y.call(h,{target:u.target}),null);return _&&typeof _=="object"?_.success===!0&&Array.isArray(_.rects)?iH(oH(_.rects.filter(E=>E!=null&&typeof E=="object")),u.relativeTo):Fl(typeof _.reason=="string"?_.reason:"unresolved"):Fl("unresolved")}return Fl("unavailable")},observe:u=>{const h=[];let y=0;const _=typeof requestAnimationFrame=="function",E=()=>{if(!_){u();return}y||(y=requestAnimationFrame(()=>{y=0,u()}))},P=Kn(re=>({ready:re.ready,selection:re.selection,zoom:re.zoom}));h.push(P.subscribe(()=>E()));const j={schedule:E,detach:null,boundHost:null};return eE(j),Rd.add(j),()=>{Rd.delete(j),bg(j),y&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(y);for(const re of h.splice(0))try{re()}catch{}}},getHost:()=>JI(),entityAt:h2,contextAt:u=>{const h=!!u&&typeof u.x=="number"&&typeof u.y=="number",y=h?u.x:0,_=h?u.y:0;return{point:{x:y,y:_},entities:h?h2({x:y,y:_}):[],selection:O.selection,position:null,insideSelection:!1}},scrollIntoView:async u=>{const h=u?.target;if(!h)return{success:!1};let y=null;if(h.kind==="entity"){const _=h.entityType==="comment"?"comments":"trackChanges",E=_==="comments"?xd.get().items:Is.get().items,P=h.entityType==="trackedChange"&&h.story?{story:h.story}:void 0;y=await fg(_,h.entityId,E,P)}else{const _=h,E=h,P=Array.isArray(_.segments)&&_.segments.length>0?_.segments:E.blockId&&E.range?[{blockId:E.blockId,range:E.range}]:null;if(P){const j=h.story;y={kind:"text",segments:P,...j?{story:j}:{}}}}return y?{success:(await Td(y,{block:u.block??"center",behavior:u.behavior??"smooth"})).ok}:{success:!1}}},nE=u=>{const h=(u&&typeof u=="object"?u:null)?.target;return h&&typeof h=="object"?h:null},rE=u=>`metadata:resolve:${u}`,M$=u=>{const h=b()?.metadata;if(!h||typeof h.resolve!="function")return null;const{value:y}=zr(rE(u),Re(),()=>h.resolve({id:u}),nE);return y},D$=async u=>{const h=b()?.metadata;if(!h||typeof h.resolve!="function")return null;try{const y=Re(),_=await Promise.resolve(h.resolve({id:u}));if(y!==Re())return null;const E=nE(_);return U.set(rE(u),{token:y,value:E,hasSettled:!0,inflightToken:null}),E}catch{return null}},O$={getRect:u=>{const h=b()?.metadata;if(!h||typeof h.resolve!="function")return Fl("unavailable");const y=M$(u.id);return y?wg.getRect({target:y}):Fl("unresolved")},scrollIntoView:async u=>{const h=await D$(u.id);return h?{success:(await Td(h,{block:u.block,behavior:u.behavior})).ok}:{success:!1}}},P$={inTable:!1,tableNodeId:null,rowIndex:null,columnIndex:null,cellNodeId:null,rows:null,columns:null},F$={getContext:()=>{const u=Pe();if(!u)return{...P$};const h=Ee()?.table;return{inTable:!0,tableNodeId:u.tableNodeId,rowIndex:u.rowIndex,columnIndex:u.columnIndex,cellNodeId:u.cellNodeId,rows:typeof h?.rows=="number"?h.rows:null,columns:typeof h?.columns=="number"?h.columns:null}},isInTable:()=>Pe()!=null},Cg={query:"",total:0,activeIndex:-1,open:!1,available:!1,caseSensitive:!1,includeTrackedDeletions:!1,includeDeletedText:!1,regex:!1,canReplace:!1,reason:lt.searchUnavailable};let Dn={...Cg};const kg=new Set,nl=()=>{const u=B()?.search;return u&&typeof u=="object"?u:null},ua=()=>{const u=X()?.search;return u&&typeof u=="object"?u:null},_h=()=>{const u=nl();if(u&&typeof u.setSession=="function")return!0;const h=ua();return!!h&&typeof h.query=="function"&&typeof h.getState=="function"},Es=()=>{for(const u of[...kg])try{u(Dn)}catch{}},bi=u=>{Dn={...Dn,...u};const h=u.includeTrackedDeletions??u.includeDeletedText;return h!==void 0&&(Dn.includeTrackedDeletions=h,Dn.includeDeletedText=h),Es(),Dn};let ao=0,Jc=null;const oE=()=>{const u=Jc;Jc=null,u&&Lt(()=>(u(),null),null)},N$=()=>{ao+=1,oE();const u=_h();Dn={...Cg,available:u,reason:u?void 0:lt.searchUnavailable},Es()};pt.push(N$);const B$=u=>{if(!u)return!1;const h=u.queryError;if(h&&typeof h=="object"&&h.code==="invalid-pattern")return!0;const y=u.rejection;return u.status==="rejected"&&!!y&&typeof y=="object"&&y.code==="invalid-pattern"},m2=(u,h=!1)=>{const y=u&&typeof u=="object"?u:null;if(!y)return null;const _=Array.isArray(y.matches)?y.matches:[],E=typeof y.total=="number"&&Number.isFinite(y.total)?y.total:_.length,P=typeof y.activeMatchIndex=="number"?y.activeMatchIndex:typeof y.activeIndex=="number"?y.activeIndex:-1;return{...typeof y.query=="string"?{query:y.query}:{},total:E,activeIndex:P,canReplace:y.canReplace===!0||h,...typeof y.includeDeletedText=="boolean"?{includeDeletedText:y.includeDeletedText}:{},...y.regex===!0?{regex:!0}:{},...B$(y)?{invalidPattern:!0}:{}}},Oo=()=>{const u=we("find.replace"),h=we("find.replaceAll");return u?.enabled===!0||h?.enabled===!0},Po=(u,h=!1)=>{const y=m2(u,h);if(!y){bi({total:0,activeIndex:-1,canReplace:!1,reason:void 0});return}bi({...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})},rl=()=>{const u=nl();if(u&&typeof u.getState!="function")return Dn={...Dn,available:_h(),reason:_h()?void 0:lt.searchUnavailable},Dn;if(!u){const y=ua();if(y&&typeof y.getState=="function"){const _=m2(Lt(()=>y.getState(),null),Oo());if(_)return Dn={...Dn,..._.query!==void 0?{query:_.query}:{},total:_.total,activeIndex:_.activeIndex,canReplace:_.canReplace,available:!0,reason:_.invalidPattern?lt.searchInvalidPattern:void 0,open:Dn.open||!!_.query},Dn}return Dn={...Cg,query:Dn.query,caseSensitive:Dn.caseSensitive,includeTrackedDeletions:Dn.includeTrackedDeletions,includeDeletedText:Dn.includeDeletedText},Dn}const h=m2(Lt(()=>u.getState(),null));return h&&(Dn={...Dn,...h.query!==void 0?{query:h.query}:{},total:h.total,activeIndex:h.activeIndex,canReplace:h.canReplace,...h.includeDeletedText!==void 0?{includeDeletedText:h.includeDeletedText}:{},...h.includeDeletedText!==void 0?{includeTrackedDeletions:h.includeDeletedText}:{},...h.regex!==void 0?{regex:h.regex}:{},available:!0,reason:h.invalidPattern?lt.searchInvalidPattern:void 0,open:Dn.open||!!h.query}),Dn},Ld=u=>{const h=u&&typeof u=="object"?u:null;if(h?.status==="committed")return{ok:!0};if(h?.status==="rejected"&&h.reason==="read-only")return{ok:!1,reason:lt.documentReadonly};const y=h?.rejection;return h?.status==="rejected"&&y&&typeof y=="object"&&y.code==="read-only-document"?{ok:!1,reason:lt.documentReadonly}:{ok:!1,reason:lt.operationUnavailable}},Sg=Tn({get:()=>rl(),subscribe:u=>(kg.add(u),()=>kg.delete(u))}),iE={get:Sg.get,getSnapshot:Sg.getSnapshot,subscribe:Sg.subscribe,observe:Sg.observe,open:()=>_h()?(bi({available:!0,open:!0,reason:void 0}),{ok:!0}):(bi({available:!1,open:!1,reason:lt.searchUnavailable}),{ok:!1,reason:lt.searchUnavailable}),close:()=>{if(ao+=1,Jc)oE();else{const u=nl();if(u&&typeof u.clear=="function")Lt(()=>u.clear(),null);else{const h=ua();h&&typeof h.query=="function"&&Lt(()=>h.query({query:""}),null)}}Dn={...Cg,available:_h(),reason:void 0},Dn.available||(Dn.reason=lt.searchUnavailable),Es()},find:(u,h)=>{const y=nl(),_=!!h?.caseSensitive,E=(h?.includeTrackedDeletions??h?.includeDeletedText)===!0,P=h?.regex===!0,j=++ao;if(!y||typeof y.setSession!="function"){const ue=ua();if(ue&&typeof ue.query=="function"&&typeof ue.getState=="function"){bi({query:u,caseSensitive:_,includeDeletedText:E,regex:P,available:!0,open:!0,reason:void 0}),Jc=()=>{ue.query({query:""})};const xe=Lt(()=>ue.query({query:u,caseSensitive:_,includeDeletedText:E,regex:P}),null);return Pr(xe)?Promise.resolve(xe).then(Ve=>{j===ao&&Po(Ve,Oo())},()=>{j===ao&&bi({available:!1,reason:lt.searchUnavailable})}):Po(xe,Oo()),Po(Lt(()=>ue.getState(),null),Oo()),Dn}return bi({query:u,total:0,activeIndex:-1,available:!1,caseSensitive:_,includeDeletedText:E,regex:P,reason:lt.searchUnavailable})}bi({query:u,caseSensitive:_,includeDeletedText:E,regex:P,available:!0,open:!0,reason:void 0}),Jc=()=>{typeof y.clear=="function"&&y.clear()};const re=Lt(()=>y.setSession(u,{caseSensitive:_,includeDeletedText:E,...P?{regex:!0}:{},highlight:!0}),null);if(Po(re),u.length>0&&Dn.total===0&&Dn.reason!==lt.searchInvalidPattern){const ue=ua();if(ue&&typeof ue.query=="function"&&typeof ue.getState=="function"){const xe=Jc;Jc=()=>{xe?.(),ue.query({query:""})};const Ve=Lt(()=>ue.query({query:u,caseSensitive:_,includeDeletedText:E,regex:P}),null);Pr(Ve)?Promise.resolve(Ve).then(Be=>{j===ao&&Po(Be,Oo())},()=>{j===ao&&bi({available:!1,reason:lt.searchUnavailable})}):Po(Ve,Oo()),Po(Lt(()=>ue.getState(),null),Oo())}}return Dn},search:(u,h)=>iE.find(u,h),next:()=>{const u=nl();if(!u||typeof u.next!="function"){const h=ua();if(!h||typeof h.next!="function"||typeof h.getState!="function")return{ok:!1,reason:lt.searchUnavailable};if(Dn.total===0)return{ok:!1,reason:lt.operationUnavailable};const y=Lt(()=>h.next(),null);if(Pr(y)){const _=ao;Promise.resolve(y).then(E=>{_===ao&&Po(E,Oo())}).catch(()=>{_===ao&&bi({available:!1,reason:lt.searchUnavailable})})}else Po(y,Oo());return Po(Lt(()=>h.getState(),null),Oo()),{ok:!0}}return Dn.total===0?{ok:!1,reason:lt.operationUnavailable}:(Po(Lt(()=>u.next(),null)),{ok:!0})},previous:()=>{const u=nl();if(!u||typeof u.previous!="function"){const h=ua();if(!h||typeof h.previous!="function"||typeof h.getState!="function")return{ok:!1,reason:lt.searchUnavailable};if(Dn.total===0)return{ok:!1,reason:lt.operationUnavailable};const y=Lt(()=>h.previous(),null);if(Pr(y)){const _=ao;Promise.resolve(y).then(E=>{_===ao&&Po(E,Oo())}).catch(()=>{_===ao&&bi({available:!1,reason:lt.searchUnavailable})})}else Po(y,Oo());return Po(Lt(()=>h.getState(),null),Oo()),{ok:!0}}return Dn.total===0?{ok:!1,reason:lt.operationUnavailable}:(Po(Lt(()=>u.previous(),null)),{ok:!0})},clear:()=>{ao+=1;const u=nl();if(u&&typeof u.clear=="function"&&Lt(()=>u.clear(),null),!u||typeof u.clear!="function"){const h=ua();h&&typeof h.query=="function"&&Lt(()=>h.query({query:""}),null)}bi({query:"",total:0,activeIndex:-1,canReplace:!1})},replace:u=>{const h=nl();if(!h){const _=ua();if(!_||typeof _.replace!="function"||typeof _.getState!="function")return{ok:!1,reason:lt.searchUnavailable};if(!Oo())return{ok:!1,reason:lt.operationUnavailable};const E=Lt(()=>_.replace({replacement:typeof u=="string"?u:""}),null);if(Pr(E)){const P=ao;rl(),Es();const j=()=>P===ao;return Promise.resolve(E).then(re=>(j()&&(Po(re,Oo()),rl(),Es()),Ld(re)),()=>(j()&&bi({available:!1,reason:lt.searchUnavailable}),{ok:!1,reason:lt.searchUnavailable}))}return rl(),Es(),Ld(E)}if(typeof h.replaceCurrent!="function")return{ok:!1,reason:lt.operationUnavailable};const y=Lt(()=>h.replaceCurrent(typeof u=="string"?u:""),null);return rl(),Es(),Ld(y)},replaceAll:u=>{const h=nl();if(!h){const _=ua();if(!_||typeof _.replaceAll!="function"||typeof _.getState!="function")return{ok:!1,reason:lt.searchUnavailable};if(!Oo())return{ok:!1,reason:lt.operationUnavailable};const E=Lt(()=>_.replaceAll({replacement:typeof u=="string"?u:""}),null);if(Pr(E)){const P=ao;rl(),Es();const j=()=>P===ao;return Promise.resolve(E).then(re=>(j()&&(Po(re,Oo()),rl(),Es()),Ld(re)),()=>(j()&&bi({available:!1,reason:lt.searchUnavailable}),{ok:!1,reason:lt.searchUnavailable}))}return rl(),Es(),Ld(E)}if(typeof h.replaceAll!="function")return{ok:!1,reason:lt.operationUnavailable};const y=Lt(()=>h.replaceAll(typeof u=="string"?u:""),null);return rl(),Es(),Ld(y)}},sE=Cn(u=>u.styles),_g=Tn(sE),z$={get:_g.get,getSnapshot:_g.getSnapshot,subscribe:_g.subscribe,observe:_g.observe,getCatalog:u=>(Ho(vi(u)),Qi(u).value),getQuickGallery:()=>sE.get().quickGallery,getActiveParagraphStyle:()=>Qa(O.selection,oi().cache).style},aE={select:Kn,get state(){return O},selection:WI,commands:v$,toolbar:y$,comments:w$,trackChanges:S$,contentControls:A$,fonts:I$,zoom:E$,document:T$,viewport:wg,metadata:O$,tables:F$,search:iE,contextMenu:w,styles:z$,formatPainter:{setPointerSelecting(u){V||(p={...p,pointerSelecting:u})},notifyPointerUp(){V||(p={...p,pointerSelecting:!1},UI())},setKeyboardSelecting(u){V||(p={...p,keyboardSelecting:u})},notifyKeyUp(){V||(p={...p,keyboardSelecting:!1},UI())},cancel(){V||lg()},onModeChange(u){return V?()=>{}:(m.add(u),()=>m.delete(u))}},createScope:()=>{const u=[];return{select:(h,y)=>{const _=Kn(h,y);return{get:_.get,subscribe:E=>{const P=_.subscribe(E);return u.push(P),P}}},dispose:()=>{for(const h of u.splice(0))h()}}},destroy:()=>{if(!V){V=!0,SU(Er,Je),rt&&(clearTimeout(rt),rt=null),Te&&(clearTimeout(Te),Te=null,Ye=0),Ae?.timer&&(clearTimeout(Ae.timer),Ae.timer=null),Ae=null,Pt&&(clearTimeout(Pt),Pt=null),ur&&(clearTimeout(ur),ur=null),Tr&&Tr(),Tr=null,Eo=null,Uo=0,Gi=0,Xt.clear(),an.clear(),or.clear(),Yr=null,G.clear();for(const u of Fn.splice(0))u();Mo&&Mo(),Mo=null,Go=null,Do&&Do(),Do=null,_s=null,Oi&&Oi(),Oi=null,ii=null,ai&&ai(),ai=null,si=null,As&&As(),As=null,Yl=null,Ot&&Ot(),Ot=null,Xl=null;for(const u of Rd)bg(u);Rd.clear(),Y.clear(),kg.clear(),g+=1,m.clear(),ao+=1,Ze.clear()}}};return oe=aE,aE}var hH=[{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 pH(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 mH(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"?pH(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 gH(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 vH(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:hH;for(const s of i)o(s);return n}var yH=[{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 bH(e,t){return e.activeMark?t.activeMarks.includes(e.activeMark):!1}Rt();var wH=['[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(", "),CH=800,TI=typeof Blob=="function"?Object.getOwnPropertyDescriptor(Blob.prototype,"size")?.get:void 0,xI=e=>{if(!TI)return!1;try{return TI.call(e),!0}catch{return!1}};function kH(e){return e.key==="Alt"||e.key==="Control"||e.key==="Meta"||e.key==="Shift"||(e.ctrlKey||e.metaKey)&&e.shiftKey&&!e.altKey&&(e.code==="Digit8"||e.key==="8"||e.key==="*")?!0:(e.ctrlKey||e.metaKey)&&["b","c","f","i","s","u"].includes(e.key.toLowerCase())}var SH=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"]),_H=["original","markup","final"],AH=["review","original","final","off"];function RI(e){return _H.includes(e)}function IH(e){return e==="markup"?"review":e}function LI(e){return AH.includes(e)}function EH(e){const t=e.modules?.trackChanges?.mode;if(LI(t))return t;const n=e.layoutEngineOptions?.trackedChanges?.mode;return LI(n)?n:null}function Xm(e,t){const n=e.viewing,r=RI(n?.trackedChanges)?n.trackedChanges:null,o=r?IH(r):t||(e.trackChanges?.visible===!0?"review":"original");return{comments:typeof n?.comments=="boolean"?n.comments:e.comments?.visible===!0,renderMode:o,trackChangesVisible:r?r==="markup":e.trackChanges?.visible===!0}}async function TH(e,t){const n=new IT.default;return e.forEach((r,o)=>{n.file(t[o],r)}),n.generateAsync({type:"blob",compression:"DEFLATE"})}function t2(e){return!!(e&&(e.synced===!0||e.isSynced===!0))}function MI(e){try{e.synced=!0}catch{}try{e.isSynced=!0}catch{}}function xH(e,t){if(!e)return()=>{};if(t2(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=()=>{MI(e),s()},l=c=>{c!==!1&&(c===!0||t2(e))&&(MI(e),s())};return n("synced",a),n("sync",l),t2(e)&&s(),i}function RH(e,t){const n=e.composedPath();if(!n.includes(t))return null;const r=n.find(a=>a instanceof HTMLElement&&a.matches(wH));if(!r)return null;const o=n.some(a=>a instanceof HTMLElement&&a.classList.contains(_p.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 LH(e){if(!e||typeof e!="object")return[];const t=e.items;return Array.isArray(t)?t:[]}function DI(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 OI(e){const t=e.selectionTarget??e.target;if(!t)return null;try{return JSON.stringify(t)}catch{return null}}function gi(e){return!!(e&&typeof e=="object"&&e.editorVersion===2)}function MH(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 PI(e){return typeof e=="string"&&e.length>0?e:null}function FI(e){return e?gi(e)?PI(e.documentId??e.options?.documentId??null):PI(typeof e.getDocumentId=="function"?e.getDocumentId():e.options?.documentId):null}function DH(e){if(!e||gi(e))return null;const t=e;return t.documentRenderer??t.presentationEditor??null}function fs(e){if(!e)return null;if(gi(e))return e.fonts??null;const t=DH(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 Zm=class extends Ig.default{static{this.allowedTypes=[Ar,Ea,ku]}#e;#n;#t;#o;#i;#s;#d;#u;#c;#h;#g;#r;#a;#p;#k;#b;#A;#S;#L;#D;#v;#w;get uiConfig(){return this.#w}#T;get interactionConfig(){return this.#T}#x;get surfacesConfig(){return this.#x}#I;#f;#C;#m;#R;constructor(e){if(super(),this.#e=!1,this.#n=!1,this.#t=null,this.#o=null,this.#i=null,this.#s=null,this.#d=null,this.#u=null,this.#c=null,this.#h=!1,this.#g=!1,this.#r=null,this.#a=null,this.#p=!1,this.#k=null,this.#b=null,this.#A=n=>{this.listenerCount("content-control:active-change")>0&&(this.#p||(this.#k=n.pointerId),this.#p=!0,this.#r="pointer",this.#a=null)},this.#S=n=>{n.pointerId===this.#k&&(this.#p=!1,this.#k=null,this.#r??="pointer",this.#r==="pointer"&&(this.#a=Date.now()+CH))},this.#L=n=>{this.listenerCount("content-control:active-change")>0&&!kH(n)&&(this.#r="keyboard",this.#a=null)},this.#D=n=>{this.#z(n)},this.#v=null,this.#w=zA({}),this.#T=VA({}),this.#x=UA({}),this.version="0.0.0",this.users=[],this.whiteboard=null,this.colors=[],this.readyEditors=0,this.pendingCollaborationSaves=0,this.#f=new wz,this.#C=null,this.#m=!1,this.#R=null,this.config={selector:"#superdoc",documentMode:"editing",allowSelectionInViewMode:!1,role:"editor",documents:[],editorExtensions:[],colors:[],users:[],user:{...Ob},layoutEngineOptions:{},modules:{},licenseKey:void 0,telemetry:{enabled:!0},title:"SuperDoc",conversations:[],isInternal:!1,comments:{visible:!1},toolbarGroups:["left","center","right"],toolbarIcons:{},toolbarTexts:{},uiDisplayFallbackFont:"Arial, Helvetica, sans-serif",isDev:!1,disablePiniaDevtools:!1,onEditorBeforeCreate:()=>null,onEditorCreate:()=>null,onEditorDestroy:()=>null,onSourceComplete:()=>null,onSourceSignalsComplete:()=>null,onContentError:()=>null,onReady:()=>null,onCommentsUpdate:()=>null,onContentControlActiveChange:()=>null,onContentControlClick:()=>null,onAwarenessUpdate:()=>null,onLocked:()=>null,onPdfDocumentReady:()=>null,onSidebarToggle:()=>null,onCollaborationReady:()=>null,onEditorUpdate:()=>null,onCommentsListChange:()=>null,onException:()=>null,onListDefinitionsChange:()=>null,onPaginationUpdate:()=>null,onTransaction:()=>null,disableContextMenu:!1,viewOptions:{layout:"print"},useLayoutEngine:!0},this.#ne=new WeakSet,this.#re=null,this.#W=null,this.#B=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.#I=new YB({getModuleConfig:()=>this.#x}),this.#u=t,t.addEventListener("pointerdown",this.#A,!0),t.ownerDocument.addEventListener("pointerup",this.#S,!0),t.ownerDocument.addEventListener("pointercancel",this.#S,!0),t.addEventListener("keydown",this.#L,!0),t.addEventListener("click",this.#D,!0),this.#l("content-control:active-change",e.onContentControlActiveChange),this.#Y(e,t),this.#g=!0,this.listenerCount("content-control:active-change")>0&&this.ui}async#z(e){const t=this.#u;if(!t)return;const n=RH(e,t),r=this.activeEditor?.doc?.contentControls?.list;if(!(!n||typeof r!="function"))try{const o=await r();if(this.#e)return;const i=DI(LH(o).find(s=>s.id===n));i&&this.emit("content-control:click",{target:i,source:"pointer"})}catch{return}}async#Y(e,t){this.#R=EH(e),this.config={...this.config,...e,modules:{...this.config.modules,...e.modules},layoutEngineOptions:{...this.config.layoutEngineOptions,...e.layoutEngineOptions}},typeof this.config.viewing?.comments=="boolean"&&(this.config.comments={...this.config.comments,visible:this.config.viewing.comments}),!this.config.comments||typeof this.config.comments!="object"?this.config.comments={visible:!1}:typeof this.config.comments.visible!="boolean"&&(this.config.comments.visible=!1),Db(this.config),this.config.documents=this.config.documents||[],this.config.layoutEngineOptions=this.config.layoutEngineOptions||{};const n=this.config.viewOptions?.layout==="web",r=this.config.layoutEngineOptions?.flowMode==="semantic";if(!n&&r&&(console.warn("[SuperDoc] flowMode 'semantic' is only valid with web layout. Coercing to 'paginated'."),this.config.layoutEngineOptions.flowMode="paginated"),this.editorVersion=2,this.#Le(),this.config.user=iz(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=SS(this.config.modules.comments),this.#w=zA(this.config),this.#T=VA(this.config),this.#x=UA(this.config),this.config.disableContextMenu=!this.#w.contextMenu.enabled,this.config.rulers=this.#w.ruler.enabled,this.#w.comments.enabled?this.config.modules.comments===!1&&(this.config.modules.comments={}):this.config.modules.comments=!1,this.#w.comments.enabled){this.config.modules.comments===!0&&(this.config.modules.comments={});const i=this.config.modules.comments;i&&(i.readOnly=this.#T.comments.readOnly,i.allowResolve=this.#T.comments.allowResolve)}if(this.config.colors=OT(this.config.colors),this.userColorMap=new Map,this.colorIndex=0,this.version="2.11.0",this.#E("π¦ [superdoc] Using SuperDoc version:",this.version),this.superdocId=e.superdocId||ol(),this.colors=this.config.colors??[],this.#_(),await WR(),this.#e)return;if(await this.#j(this.config.modules),this.#e){this.#me();return}this.user=this.config.user,this.users=this.config.users||[],this.socket=null,this.isDev=this.config.isDev||!1,this.activeEditor=null,this.comments=[],this.#C||(this.#C=this.#f.subscribe(i=>{this.#De(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.#Z(),this.#O(),this.#Oe(),this.#V()}#V(){if(this.#M(),this.readyEditors=0,!this.app)throw new Error("SuperDoc: #startRuntime called before #initVueApp populated this.app");this.app.mount(this.#d)}#O(){const e=this.config.modules?.whiteboard,t=e!==!1&&(e?.enabled??!1);this.whiteboard=new CF({Renderer:WB,superdoc:this,enabled:t}),this.emit("whiteboard:init",{whiteboard:this.whiteboard})}get requiredNumberOfEditors(){return this.#y("requiredNumberOfEditors").documents.filter(e=>e.type===Ar).length}get ui(){return this.#v||(this.#v=fH({superdoc:this}),this.#e&&this.#v.destroy()),this.#X(),this.#v}on(e,t,n){return super.on(e,t,n),e==="content-control:active-change"&&this.#g&&this.ui,this}addListener(e,t,n){return super.addListener(e,t,n),e==="content-control:active-change"&&this.#g&&this.ui,this}once(e,t,n){return super.once(e,t,n),e==="content-control:active-change"&&this.#g&&this.ui,this}removeListener(e,t,n,r){return super.removeListener(e,t,n,r),this.#P(),this}off(e,t,n,r){return super.off(e,t,n,r),this.#P(),this}removeAllListeners(e){return super.removeAllListeners(e),this.#P(),this}#P(){this.listenerCount("content-control:active-change")>0||(this.#c?.(),this.#c=null,this.#b=null,this.#r=null,this.#a=null,this.#p=!1,this.#k=null)}#X(){if(this.#c||this.#h||!this.#v||this.#e||this.listenerCount("content-control:active-change")===0)return;let e=null,t=[],n=null,r=null,o=!0;this.#h=!0;try{n=this.#v.selection.observe(s=>{if(o){o=!1;return}if(s.status!=="ready")return;const a=OI(s);if(!a)return;this.#r==="pointer"&&this.#a!==null&&Date.now()>this.#a&&(this.#r=null,this.#a=null);const l=this.#r??(this.#p?"pointer":null),c=this.activeEditor;(l||this.#b?.editor!==c||this.#b.key!==a)&&(this.#b={editor:c,key:a,source:l??"keyboard"}),this.#r=null,this.#a=null}),r=this.#v.contentControls.observe(s=>{const a=this.activeEditor,l=s.activeIds.map(v=>DI(s.items.find(k=>k.id===v)));if(l.some(v=>v===null))return;const c=l,d=a===e,f=c.length===t.length&&c.every((v,k)=>v.id===t[k]?.id);if(d&&f)return;if(c.length===0&&t.length===0){e=a;return}const p=d?t[0]??null:null;e=a,t=c;const g=OI(this.#v.selection.getSnapshot()),m=this.#b;this.emit("content-control:active-change",{active:c[0]??null,previous:p,activePath:c,source:g&&m?.editor===a&&m.key===g?m.source:"keyboard"})});const i=()=>{n?.(),r?.()};this.#e||this.listenerCount("content-control:active-change")===0?i():this.#c=i}catch(i){throw n?.(),r?.(),i}finally{this.#h=!1}}get state(){return{documents:this.#y("state").documents.map(e=>bl(e.data)?{...e,data:Py(e.data,e.type||"application/vnd.openxmlformats-officedocument.wordprocessingml.document")}:e),users:this.users}}getDocumentRuntimeForDocument(e){return typeof e!="string"||e.length===0?null:(this.superdocStore?.documents??[]).find(t=>t?.getEditor?.()?.options?.documentId===e)?.getDocumentRuntime?.()??null}getComment(e){return typeof e!="string"||e.length===0?null:this.commentsStore?.getComment?.(e)??null}get element(){return typeof this.config.selector=="string"?document.querySelector(this.config.selector):this.config.selector}#_(){const e=this.config.document,t=!!e&&typeof e=="object"&&(bl(e)||typeof Blob=="function"&&e instanceof Blob||Object.keys(e).length>0),n=typeof e=="string"&&e.length>0,r=this.config.documents&&this.config.documents?.length;if((t||n)&&r&&console.warn("π¦ [superdoc] You can only provide one of document or documents"),t){const o=Ny(e);this.config.documents=[{id:ol(),...o}]}else n&&(this.config.documents=[{id:ol(),type:Ar,url:this.config.document,name:"document.docx"}]);Array.isArray(this.config.documents)&&this.config.documents.length>0&&(this.config.documents=this.config.documents.map(o=>{const i=Ny(o);if(!i||typeof i!="object")return i;const s=typeof i=="object"&&"id"in i&&i.id||o&&typeof o=="object"&&"id"in o&&o.id;return{...i,id:s||ol()}}))}#M(){const{app:e,pinia:t,superdocStore:n,commentsStore:r,highContrastModeStore:o}=lF({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.#I),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&&LR(this),this.#se()}#l(e,t){t&&this.on(e,t)}#Z(){this.#l("editorBeforeCreate",this.config.onEditorBeforeCreate),this.#l("editorCreate",this.config.onEditorCreate),this.#l("editorDestroy",this.config.onEditorDestroy),this.#l("source:complete",this.config.onSourceComplete),this.#l("source:signals-complete",this.config.onSourceSignalsComplete),this.#l("ready",this.config.onReady),this.#l("comments-update",this.config.onCommentsUpdate),this.#l("content-control:click",this.config.onContentControlClick),this.#l("awareness-update",this.config.onAwarenessUpdate),this.#l("locked",this.config.onLocked),this.#l("pdf:document-ready",this.config.onPdfDocumentReady),this.#l("sidebar-toggle",this.config.onSidebarToggle),this.#l("collaboration-ready",this.config.onCollaborationReady),this.on("collaboration-ready",e=>this.#J(e?.editor??null)),this.#l("editor-update",this.config.onEditorUpdate),this.#l("tracked-changes:bulk-decision",this.config.onTrackedChangesBulkDecision),this.on("content-error",this.onContentError),this.#l("exception",this.config.onException),this.#l("list-definitions-change",this.config.onListDefinitionsChange),this.#l("pagination-update",this.config.onPaginationUpdate),this.#l("fonts-resolved",this.config.onFontsResolved),this.#l("fonts-changed",this.config.onFontsChanged),this.#l("zoomChange",this.config.onZoomChange),this.#l("viewport-change",this.config.onViewportChange),this.#l("page-margins-change",this.config.onPageMarginsChange)}async#j({collaboration:e}={}){return e?(this.isCollaborative=!1,this.config.documents.length===0&&(this.config.documents=[{id:ol(),type:Ar,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}#ae(e,t){this.isCollaborative=!0,this._commentsCollabInitialized=!1,this.ydoc=ro(e),this.provider=ro(t),this.#ve();const n=this.config;this._cleanupAwareness=IR(t,this,n.user),n.documents.forEach(r=>{r.ydoc=e,r.provider=t,r.role=this.config.role})}#Q(){this.#s=null,this.#F(),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})}#F(){if(this.#o){try{this.#o()}catch{}this.#o=null}if(this.#i){try{this.#i()}catch{}this.#i=null}}#J(e){this.#F(),gi(e)&&(this.#ee(e),this.#te(e))}#ee(e){const t=e.presence;if(!t||typeof t.subscribe!="function")return;const n=vF(()=>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.#o=t.subscribe(r)}catch(o){console.warn("[SuperDoc] v2 awareness bridge failed to subscribe",o)}}#te(e){const t=e.lock;if(!t||typeof t.subscribe!="function")return;const n=r=>{this.#e||this.#U(!!r.isLocked,this.#le(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)}}#le(e){return!e||typeof e!="object"||Array.isArray(e)?null:{...e}}#ge(e,t){return JSON.stringify(e??null)===JSON.stringify(t??null)}#U(e,t){this.isLocked===e&&this.#ge(this.lockedBy,t)||(this.isLocked=e,this.lockedBy=t,this.#E("π¦ [superdoc] Locking superdoc:",e,t,`
|
|
102
|
+
`;Rt();var Ws=e=>{e.expand.value=!1},jb=(e,t)=>{const n=e.layoutWidth?.value;return Number.isFinite(n)&&n>0?n:e.type==="separator"?t.get("separator"):t.get(e.name.value)||t.get("default")};function Ub(e,t){const n={...e};return t?n.href=t:delete n.href,n}function sI(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 Xj(e){return typeof e?.quotedText=="string"?e.quotedText:typeof e?.text=="string"?e.text:""}function aI(e){return e.ui?.selection?.get?.()??e.ui?.selection?.current?.()??null}function Zj(e){return!!(e.config?.superdoc?.config?.modules?.ai||e.superdoc?.config?.modules?.ai)}function Qj(e){return e.config?.superdoc?.config?.modules?.ai??e.superdoc?.config?.modules?.ai??{}}var Jj=({superToolbar:e,toolbarIcons:t,toolbarTexts:n,toolbarFonts:r,hideButtons:o,availableWidth:i,role:s,isDev:a=!1,configuredItemNames:l,excludedItemNames:c,additionalItems:d=[]}={})=>{const f=xn({type:"button",name:"bold",command:"toggleBold",icon:t.bold,tooltip:n.bold,attributes:{ariaLabel:"Bold"}}),p=(r??GV).map(QV),g=xn({type:"dropdown",name:"fontFamily",tooltip:n.fontFamily,command:"setFontFamily",defaultLabel:"Arial",label:"Arial",markName:"textStyle",labelAttr:"fontFamily",hasCaret:!0,hasInlineTextInput:!0,inlineTextInputVisible:!0,isWide:!0,style:{width:"116px"},suppressActiveHighlight:!0,attributes:{ariaLabel:"Font family"},options:p,onActivate:({fontFamily:Je}={},wt=!1)=>{if(wt){g.label.value="",g.selectedValue.value="";return}if(!Je)return;Je=Je.split(",")[0];const Dt=en=>en.value??en.label,sn=p.find(en=>Dt(en)===g.defaultLabel.value),pn=p.find(en=>Dt(en)===Je);pn?(g.label.value=pn.label,g.selectedValue.value=pn.key):sn?(g.label.value=Je,g.selectedValue.value=sn.key):(g.label.value=Je,g.selectedValue.value="")},onDeactivate:()=>{const Je=p.find(wt=>(wt.value??wt.label)===g.defaultLabel.value);g.label.value=Je?.label??g.defaultLabel.value,g.selectedValue.value=Je?.key??""}}),m=xn({type:"dropdown",name:"ai",dropdownStyles:{padding:0,outline:"none"},tooltip:n.ai,icon:t.ai,hideLabel:!0,hasCaret:!1,isWide:!0,suppressActiveHighlight:!0,attributes:{ariaLabel:"AI"},options:[{type:"render",key:"ai",render:()=>v(m)}]});function v(Je){const wt=aI(e),Dt=wt?.selectionTarget??sI(wt?.target),sn=wt?.empty?"":Xj(wt),pn=Qj(e),en=()=>Ws(Je),wn=()=>{const tn=e.pendingSelectionCapture;tn&&typeof e.ui?.selection?.restore=="function"&&e.ui.selection.restore(tn)};return Gr("div",{},[Gr(Aj,{handleClose:en,selectedText:sn,target:Dt,doc:e.superdoc?.activeEditor?.doc??null,apiKey:pn?.apiKey||e.config?.aiApiKey||"",endpoint:pn?.endpoint||e.config?.aiEndpoint||"",restoreSelection:wn})])}const k=KV,C=xn({type:"dropdown",name:"fontSize",defaultLabel:"12",label:"12",style:{width:"56px"},markName:"textStyle",labelAttr:"fontSize",tooltip:n.fontSize,hasCaret:!0,hasInlineTextInput:!0,inlineTextInputVisible:!0,suppressActiveHighlight:!0,isWide:!0,command:"setFontSize",attributes:{ariaLabel:"Font size"},options:k,onActivate:({fontSize:Je},wt=!1)=>{if(wt){C.label.value="",C.selectedValue.value="";return}const Dt=k.find(wn=>wn.label===String(C.defaultLabel.value));if(!Je){C.label.value=C.defaultLabel.value,Dt?C.selectedValue.value=Dt.key:C.selectedValue.value="";return}let sn=Vz(Je,12);sn<8&&(sn=8),sn>96&&(sn=96);let pn=String(sn);const en=k.find(wn=>wn.label===pn||wn.key===pn);en?C.selectedValue.value=en.key:C.selectedValue.value="",C.label.value=pn},onDeactivate:()=>{C.label.value=C.defaultLabel.value;const Je=k.find(wt=>wt.label===String(C.defaultLabel.value));Je?C.selectedValue.value=Je.key:C.selectedValue.value=""}}),S=()=>xn({type:"separator",name:"separator",isNarrow:!0}),w=xn({type:"button",name:"italic",command:"toggleItalic",icon:t.italic,active:!1,tooltip:n.italic,attributes:{ariaLabel:"Italic"}}),b=xn({type:"button",name:"underline",command:"toggleUnderline",icon:t.underline,active:!1,tooltip:n.underline,attributes:{ariaLabel:"Underline"}}),T=xn({type:"button",name:"strike",command:"toggleStrike",icon:t.strikethrough,active:!1,tooltip:n.strikethrough,attributes:{ariaLabel:"Strikethrough"}}),L=xn({type:"dropdown",name:"highlight",icon:t.highlight,hideLabel:!0,markName:"highlight",labelAttr:"color",active:!1,tooltip:n.highlight,command:"setHighlight",noArgumentCommand:"unsetHighlight",suppressActiveHighlight:!0,attributes:{ariaLabel:"Highlight"},options:[{key:"color",type:"render",render:()=>Vb(e,L,[],!0)}],onActivate:({color:Je})=>{L.iconColor.value=Je||""},onDeactivate:()=>L.iconColor.value=""}),N=xn({type:"dropdown",name:"color",icon:t.color,hideLabel:!0,markName:"textStyle",labelAttr:"color",active:!1,tooltip:n.color,command:"setColor",suppressActiveHighlight:!0,attributes:{ariaLabel:"Color"},options:[{key:"color",type:"render",render:()=>Vb(e,N)}],onActivate:({color:Je})=>{N.iconColor.value=Je},onDeactivate:()=>N.iconColor.value="#000"}),H=xn({type:"button",name:"search",allowWithoutEditor:!0,active:!1,icon:t.search,tooltip:n.search,group:"right",attributes:{ariaLabel:"Search"}}),z=xn({type:"dropdown",name:"link",markName:"link",icon:t.link,active:!1,tooltip:n.link,attributes:{ariaLabel:"Link dropdown"},options:[{type:"render",key:"linkDropdown",render:()=>B(z)}],onActivate:({href:Je})=>{z.attributes.value=Ub(z.attributes.value,Je)},onDeactivate:()=>{z.attributes.value=Ub(z.attributes.value,null),z.expand.value=!1}});function B(Je){const wt=aI(e),Dt=wt?.selectionTarget??sI(wt?.target),sn=()=>{const pn=e.pendingSelectionCapture;pn&&typeof e.ui?.selection?.restore=="function"&&e.ui.selection.restore(pn)};return Gr("div",{},[Gr(y_,{ui:e.ui,linkItem:Je,textTarget:Dt,restoreSelection:sn,closePopover:()=>{Ws(Je),Tc(e)},goToAnchor:()=>{Ws(Je);const pn=Je.attributes.value?.href;if(!pn)return;const en=pn.slice(1),wn=(e.ui?.viewport?.getHost?.()??null)?.querySelector?.(`a[name='${en}']`);wn&&b_(wn)}})])}const Z=xn({type:"options",name:"linkInput",command:"toggleLink",active:!1});z.childItem=Z,Z.parentItem=z;const R=xn({type:"button",name:"image",command:"startImageUpload",icon:t.image,active:!1,tooltip:n.image,disabled:!1,attributes:{ariaLabel:"Image"}}),K=xn({type:"button",name:"tableOfContents",command:"insertTableOfContents",icon:t.tableOfContents,active:!1,tooltip:n.tableOfContents,disabled:!1,attributes:{ariaLabel:"Table of contents"}}),x=xn({type:"dropdown",name:"table",icon:t.table,hideLabel:!0,labelAttr:"table",active:!1,tooltip:n.table,command:"insertTable",suppressActiveHighlight:!0,attributes:{ariaLabel:"Table"},options:[{key:"table",type:"render",render:()=>W(x)}]});function W(Je){return Gr("div",{},[Gr(jj,{onSelect:Dt=>{e.emitCommand({item:Je,argument:Dt}),Ws(Je),Tc(e)}})])}const $=xn({type:"dropdown",name:"tableActions",command:"executeTableCommand",tooltip:n.tableActions,icon:t.tableActions,hideLabel:!0,disabled:!0,attributes:{ariaLabel:"Table actions"},options:[{type:"render",render:()=>Q($)}]}),ee=[{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 Q(Je){return Gr(qj,{options:ee,onSelect:wt=>{Ws(Je);const{command:Dt}=wt;e.emitCommand({item:Je,argument:{command:Dt}}),Tc(e)}})}const X=xn({type:"dropdown",name:"textAlign",tooltip:n.textAlign,icon:t.alignLeft,command:"setTextAlign",hasCaret:!0,markName:"textAlign",labelAttr:"textAlign",suppressActiveHighlight:!0,attributes:{ariaLabel:"Text align"},options:[{type:"render",render:()=>Gr("div",{},[Gr(tj,{onSelect:wt=>{Ws(X);const Dt={...X,command:"setTextAlign"};Dt.command="setTextAlign",e.emitCommand({item:Dt,argument:wt}),we(X,wt),Tc(e)}})]),key:"alignment"}],onActivate:({textAlign:Je})=>{we(X,Je)},onDeactivate:()=>{we(X,"left")}}),we=(Je,wt)=>{let Dt=wt==="both"?"justify":wt,sn={left:t.alignLeft,right:t.alignRight,center:t.alignCenter,justify:t.alignJustify},pn=sn[Dt]??sn.left;Je.icon.value=pn},ce=xn({type:"dropdown",name:"list",command:"toggleBulletListStyle",splitButton:!0,splitButtonCommand:"toggleBulletList",icon:t.bulletList,hasCaret:!0,tooltip:n.bulletList,restoreEditorFocus:!0,attributes:{ariaLabel:"Bullet list"},options:[{type:"render",key:"bullet-style-buttons",render:()=>{const Je=wt=>{Ws(ce);const Dt={...ce,command:"toggleBulletListStyle"};e.emitCommand({item:Dt,argument:wt})};return Gr(oI,{buttons:oj,iconSize:25,selectedStyle:ce.selectedValue.value,onSelect:Je})}}]}),be=xn({type:"dropdown",name:"numberedlist",command:"toggleOrderedListStyle",splitButton:!0,splitButtonCommand:"toggleOrderedList",icon:t.numberedList,hasCaret:!0,tooltip:n.numberedList,restoreEditorFocus:!0,attributes:{ariaLabel:"Numbered list"},options:[{type:"render",key:"numbered-style-buttons",render:()=>{const Je=wt=>{Ws(be);const Dt={...be,command:"toggleOrderedListStyle"};e.emitCommand({item:Dt,argument:wt})};return Gr(oI,{buttons:ij,iconSize:30,selectedStyle:be.selectedValue.value,onSelect:Je})}}]}),ve=xn({type:"button",name:"indentleft",command:"decreaseTextIndent",icon:t.indentLeft,active:!1,tooltip:n.indentLeft,disabled:!1,attributes:{ariaLabel:"Left indent"}}),Ee=xn({type:"button",name:"indentright",command:"increaseTextIndent",icon:t.indentRight,active:!1,tooltip:n.indentRight,disabled:!1,attributes:{ariaLabel:"Right indent"}}),Pe=xn({type:"overflow",name:"overflow",command:null,icon:t.overflow,active:!1,disabled:!1,attributes:{ariaLabel:"Overflow items"}}),Ze=xn({type:"dropdown",name:"zoom",allowWithoutEditor:!0,tooltip:n.zoom,defaultLabel:"100%",label:"100%",hasCaret:!0,command:"setZoom",isWide:!0,style:{width:"71px",minWidth:"71px"},inlineTextInputVisible:!1,hasInlineTextInput:!0,attributes:{ariaLabel:"Zoom"},options:[{label:"50%",key:.5,props:{"data-item":"btn-zoom-option"}},{label:"75%",key:.75,props:{"data-item":"btn-zoom-option"}},{label:"90%",key:.9,props:{"data-item":"btn-zoom-option"}},{label:"100%",key:1,props:{"data-item":"btn-zoom-option"}},{label:"125%",key:1.25,props:{"data-item":"btn-zoom-option"}},{label:"150%",key:1.5,props:{"data-item":"btn-zoom-option"}},{label:"200%",key:2,props:{"data-item":"btn-zoom-option"}}],onActivate:({zoom:Je})=>{Je&&(Ze.label.value=Je)}}),at=xn({type:"dropdown",name:"measurementUnit",allowWithoutEditor:!0,tooltip:n.measurementUnit,defaultLabel:"in",label:"in",hasCaret:!0,command:"setMeasurementUnit",group:"right",style:{width:"52px",minWidth:"52px"},inlineTextInputVisible:!1,hasInlineTextInput:!1,attributes:{ariaLabel:"Measurement unit"},options:[{label:"Inches",key:"in",props:{"data-item":"btn-measurement-unit-option"}},{label:"Centimeters",key:"cm",props:{"data-item":"btn-measurement-unit-option"}}],onActivate:({measurementUnit:Je})=>{Je&&(at.label.value=Je)}}),Qe=xn({type:"button",name:"undo",disabled:!0,tooltip:n.undo,command:"undo",icon:t.undo,group:"left",attributes:{ariaLabel:"Undo"}}),At=xn({type:"button",disabled:!0,name:"redo",tooltip:n.redo,command:"redo",icon:t.redo,group:"left",attributes:{ariaLabel:"Redo"}}),se=xn({type:"button",disabled:!1,name:"acceptTrackedChangeBySelection",tooltip:n.trackChangesAccept,command:"acceptTrackedChangeFromToolbar",icon:t.trackChangesAccept,group:"left",attributes:{ariaLabel:"Accept tracked changes"}}),Ie=xn({type:"button",disabled:!1,name:"rejectTrackedChangeOnSelection",tooltip:n.trackChangesReject,command:"rejectTrackedChangeFromToolbar",icon:t.trackChangesReject,group:"left",attributes:{ariaLabel:"Reject tracked changes"}}),Ue=xn({type:"button",name:"clearFormatting",command:"clearFormat",tooltip:n.clearFormatting,icon:t.clearFormatting,attributes:{ariaLabel:"Clear formatting"}}),ne=xn({type:"button",name:"copyFormat",tooltip:n.copyFormat,icon:t.copyFormat,command:"copyFormat",active:!1,attributes:{ariaLabel:"Copy formatting"}}),A=(Je,wt)=>Je==="editor"?wt:Je==="suggester"?wt.filter(Dt=>Dt.value==="suggesting"):wt.filter(Dt=>Dt.value==="viewing"),ie=Je=>Je==="editor"?"Editing":Je==="suggester"?"Suggesting":"Viewing",F=xn({type:"dropdown",name:"documentMode",command:"setDocumentMode",allowWithoutEditor:!0,icon:t.documentMode,defaultLabel:ie(s),label:ie(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:()=>O(F)}]}),Y=[{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 O(Je){return Gr(hj,{options:A(s,Y),onSelect:wt=>{const Dt=e.superdoc?.activeEditor??e.activeEditor;Ws(Je);const{label:sn,icon:pn,value:en}=wt;F.label.value=sn,F.icon.value=pn,e.emitCommand({item:F,argument:en}),Tc(e,Dt)}})}const V=new Map([["separator",20],["zoom",71],["measurementUnit",52],["fontFamily",118],["fontSize",57],["textAlign",40],["linkedStyles",142],["documentMode",47],["default",32]]),oe=["search","ruler","undo","overflow","documentMode"],U=xn({type:"button",name:"ruler",command:"toggleRuler",allowWithoutEditor:!0,icon:t.ruler,active:!1,tooltip:n.ruler,attributes:{ariaLabel:"Ruler"}}),G=xn({type:"button",name:"formattingMarks",command:"toggleFormattingMarks",allowWithoutEditor:!0,icon:t.formattingMarks,active:!1,tooltip:n.formattingMarks,attributes:{ariaLabel:"Formatting marks"}}),ge=xn({type:"dropdown",name:"linkedStyles",command:"setLinkedStyle",tooltip:n.linkedStyles,icon:t.paintbrush,defaultLabel:n.formatText,label:n.formatText,hasCaret:!0,isWide:!0,style:{width:"140px"},suppressActiveHighlight:!0,disabled:!1,attributes:{className:"sd-toolbar-item--linked-styles",ariaLabel:"Linked styles"},options:[{type:"render",key:"linkedStyle",render:()=>{const Je=Dt=>{Ws(ge);const sn=typeof Dt=="string"?Dt:Dt?.id??null;if(!sn)return;const pn={...ge,command:"setLinkedStyle"};e.emitCommand({item:pn,argument:sn})},wt=e.getActiveLinkedStyleId?.()??null;return Gr("div",{},[Gr(vj,{styles:e.getLinkedStyleOptions?.()??[],onSelect:Je,selectedOption:wt})])}}],onActivate:({styleId:Je,styleName:wt})=>{const Dt=wt||Je;ge.label.value=Je&&Je!=="Normal"?String(Dt):n.formatText,ge.disabled.value=!1},onDeactivate:()=>{ge.disabled.value=!0,ge.label.value=n.formatText}}),Ae=(Je,wt)=>{if(wt.value==Je)return Gr("div",{innerHTML:Yj,class:"dropdown-select-icon"})},Se=xn({type:"dropdown",name:"lineHeight",tooltip:n.lineHeight,icon:t.lineHeight,hasCaret:!1,hasInlineTextInput:!1,hideLabel:!0,inlineTextInputVisible:!1,suppressActiveHighlight:!0,restoreEditorFocus:!0,isWide:!1,command:"setLineHeight",dropdownValueKey:"key",selectedValue:"1",attributes:{ariaLabel:"Line height"},options:[1,1.15,1.5,2,2.5,3].map(Je=>({label:Je.toFixed(2),key:Je,icon:()=>Ae(Je,Se.selectedValue),props:{"data-item":"btn-lineHeight-option"}}))}),Te=20,Ye=32,rt=["linkedStyles","clearFormatting","copyFormat","formattingMarks"],ht=["zoom","fontFamily","fontSize","redo"],Pt=i<=ah.lg,Ft=e.config?.showFormattingMarksButton===!0,Wt=e.config?.showTableOfContentsButton===!0;Pt&&(F.attributes.value={...F.attributes.value,className:`${F.attributes.value.className} sd-toolbar-item--doc-mode-compact`}),Pt&&(ge.attributes.value={...ge.attributes.value,className:`${ge.attributes.value.className} sd-toolbar-item--linked-styles-compact`});let $e=[Qe,At,se,Ie,H,Ze,g,S(),C,S(),f,w,b,T,N,L,S(),z,R,...Wt?[K]:[],x,$,S(),X,ce,be,ve,Ee,Se,S(),ge,S(),U,at,...Ft?[G]:[],ne,Ue,...Zj(e)?[m]:[],Pe,F,...d];if(i<=ah.md&&o&&($e=$e.filter(Je=>Je.type!=="separator")),e.config.mode!=="docx"){const Je=$e.findIndex(Dt=>Dt.name.value==="linkedStyles");$e.splice(Je-1,2);const wt=["ruler","zoom","undo","redo"];$e=$e.filter(Dt=>!wt.includes(Dt.name.value))}const cn=[];a||(s==="viewer"&&cn.push(se,Ie),$e=$e.filter(Je=>!cn.includes(Je))),l&&($e=$e.filter(Je=>Je.name.value==="overflow"||Je.isCustomToolbarItem||l.has(Je.name.value))),c?.size&&($e=$e.filter(Je=>!c.has(Je.name.value)));const jn=Je=>oe.includes(Je.name.value),Ut=$e.find(Je=>Je.name.value==="overflow"),In=$e.filter(Je=>Je!==Ut),qr=Je=>{const wt=[],Dt=[],sn=In.filter(jn).reduce((en,wn)=>en+jb(wn,V),0);let pn=Ye+sn+(Je&&Ut?jb(Ut,V):0);return In.forEach((en,wn)=>{const tn=jb(en,V);if(en.type==="separator"&&In[wn-1]?.name.value==="linkedStyles"&&wt.includes(In[wn-1])){wt.push(en);return}if(i<ah.xl+Te&&rt.includes(en.name.value)&&o){wt.push(en);return}if(i<ah.sm&&ht.includes(en.name.value)&&o){wt.push(en);return}if(jn(en)){Dt.push(en);return}pn+tn<=i||!o?(Dt.push(en),pn+=tn):wt.push(en)}),{visibleItems:Dt,overflowItems:wt}};let{visibleItems:Cr,overflowItems:Er}=qr(!1);if(o&&Ut&&Er.some(Je=>Je.type!=="separator")){({visibleItems:Cr,overflowItems:Er}=qr(!0));const Je=$e.indexOf(Ut),wt=Cr.findIndex(Dt=>$e.indexOf(Dt)>Je);wt===-1?Cr.push(Ut):Cr.splice(wt,0,Ut)}return{defaultItems:Cr,overflowItems:Er.filter(Je=>Je.type!=="separator")}},lI={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"},eU=e=>e?typeof e!="string"?e instanceof HTMLElement?e:null:e.startsWith("#")||e.startsWith(".")?document.querySelector(e):document.getElementById(e):null;Rt();function cI(e){return Mz(e)??zb[e]??null}function zm(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),s=a=>{!r.reportUnhandled||a!==!1||r.onError?.(new Error(`[superdoc toolbar] Command "${t}" did not run. Check that it is enabled and has the required input.`))};return i&&typeof i.then=="function"?Promise.resolve(i).then(a=>{s(a),r.onSettled?.()},a=>{r.onError?.(a),r.onSettled?.()}):(s(i),r.onSettled?.()),!0}var tU=new Set(["bold","italic","underline","strike","color","highlight","link","clearFormatting","textAlign","list","numberedlist","indentleft","indentright","lineHeight","linkedStyles"]),nU=new Set(["list","numberedlist"]);function rU(e,t){if(e==="fontFamily"||e==="fontSize"||nU.has(e)&&t?.disabled&&t?.supported!==!1&&t?.reason==null)return!0;if(!tU.has(e))return!1;const n=t?.reason;return n==="range-selection-required"||n==="selection-required"}function uI(e){return!!e?.closest?.("[data-editor-ui-surface], .toolbar-dropdown-menu, .sd-toolbar-dropdown-menu, .sd-tooltip-content")}function oU(e){return["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key)}var iU=new Set([...Lz,...Object.keys(Rm),"ai","overflow","tableOfContents"]),sU=class extends Ig.default{config={selector:null,toolbarGroups:["left","center","right"],role:"editor",icons:{...lr},texts:{...lI},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;_linkedStyleOptions=$r([]);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={...lr,...e.icons},this.config.texts={...lI,...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=eU(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.#c(),this.#i(),this._lastFontOptionsSignature=this.#r(),!this.toolbarContainer){this.updateToolbarState();return}this.app=mc(ZV),this.app.directive("click-outside",xy),this.app.config.globalProperties.$toolbar=this,this.toolbar=this.app.mount(this.toolbarContainer),this.updateToolbarState()}catch(t){try{this.destroy()}catch{}throw t}}#t(){this.ui=this.superdoc?.ui??null,this.ui&&(this.snapshot=this.ui.toolbar.getSnapshot(),this._unsubscribeController=this.ui.toolbar.subscribe(()=>{this.snapshot=this.ui.toolbar.getSnapshot(),this.getToolbarItemByName("linkedStyles")?.expand.value&&this.#p(),this.updateToolbarState()}),this._detachFormatPainterModeChange=this.ui.formatPainter.onModeChange(e=>{e==="armed"||e==="persistent"?this.#f():this.#C()}))}#o(){this._unsubscribeController?.(),this._unsubscribeController=null,this._detachFormatPainterModeChange?.(),this._detachFormatPainterModeChange=null,this.#C();for(const e of this._customCommandRegs.values())try{e.unregister?.()}catch{}this._customCommandRegs.clear(),this.ui=null,this.snapshot=null}#i(){if(!this.superdoc||typeof this.superdoc.on!="function"||typeof this.superdoc.off!="function")return;const e=()=>{const t=this.#r();t!==this._lastFontOptionsSignature&&(this._lastFontOptionsSignature=t,this.#g()),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}#u(e){return e||WV(this.superdoc?.fonts?.getFontFamilyOptions?.()??[])}#c(){const e=this.getAvailableWidth(),t=new Map(this.#a().filter(k=>k.isCustomToolbarItem&&k.type==="dropdown").map(k=>[k.name.value,k.selectedValue.value])),n=this.config.groups&&!Array.isArray(this.config.groups)&&Object.keys(this.config.groups).length>0,r=n?new Set(Object.values(this.config.groups).flatMap(k=>k)):null,o=new Set(this.config.excludeItems),i=this.config.customButtons||[],s=new Set(iU),a=i.map((k,C)=>{try{if(k?.name&&s.has(k.name))throw new Error(`Toolbar item name "${k.name}" is already taken by another item, so this entry is skipped.`);const S=this.#h(k);return t.has(S.name.value)&&(S.selectedValue.value=t.get(S.name.value)),s.add(S.name?.value),S}catch(S){const w=`${k?.name??`<unnamed@${C}>`}::${S?.message??String(S)}`;return this._reportedInvalidCustomItems.has(w)||(this._reportedInvalidCustomItems.add(w),this.#m(S,k?.name??null)),null}}).filter(Boolean),l=n?new Set(Object.keys(this.config.groups)):null,c=l?a.filter(k=>l.has(k.group?.value||"center")):a,{defaultItems:d,overflowItems:f}=Jj({superToolbar:this,toolbarIcons:this.config.icons,toolbarTexts:this.config.texts,toolbarFonts:this.#u(this.config.fonts),hideButtons:this.config.hideButtons,availableWidth:e,role:this.role,isDev:this.isDev,configuredItemNames:r,excludedItemNames:o,additionalItems:c});let p=[...d.map(k=>k.name.value),...f.map(k=>k.name.value)];if(n){const k=Object.values(this.config.groups).flatMap(S=>S),C=a.filter(S=>l.has(S.group?.value||"center")).map(S=>S.name.value);p=[...new Set([...k,...C])]}const g=f.filter(k=>p.includes(k.name.value)&&!o.has(k.name.value)),m=g.length?[...p,"overflow"]:p,v=d.filter(k=>m.includes(k.name.value)).filter(k=>!o.has(k.name.value));if(n)for(const[k,C]of Object.entries(this.config.groups))for(const S of v)C.includes(S.name.value)&&(S.group.value=k);this.toolbarItems=v,this.overflowItems=g}#h(e){const t=xn({...e});t.isCustomToolbarItem=!0;const n=e.command;if(typeof n=="function"&&this.ui?.commands?.register){const r=`__builtin_toolbar__${e.name}`;if(!this._customCommandRegs.has(r)){const o=this.ui.commands.register({id:r,execute:i=>{const s=i?.payload&&typeof i.payload=="object"?i.payload:{};try{const a=n({...i,item:t,argument:s.argument,option:s.option});return a&&typeof a.then=="function"?Promise.resolve(a).catch(l=>(this.#m(l,e.name),!1)):a}catch(a){return this.#m(a,e.name),!1}}});this._customCommandRegs.set(r,o)}}return t}#g(){this.#c(),this.emit("toolbar-items-changed")}#r(){if(this.config.fonts)return"custom-fonts";const e=this.superdoc?.fonts?.getFontFamilyOptions?.()??[];return JSON.stringify(e.map(t=>[t.label,t.value,t.previewFamily]))}getToolbarItemByGroup(e){return this.toolbarItems.filter(t=>(t.group?.value||"center")===e)}getToolbarItemByName(e){return this.#a().find(t=>t.name.value===e)}#a(){return[...this.toolbarItems,...this.overflowItems]}getLinkedStyleOptions(){return this.#p(),this._linkedStyleOptions.value}#p(){this.ui?.styles?.getCatalog?.({includePreview:!0});const e=this.ui?.styles?.getCatalog?.({view:"quickGallery",includePreview:!0})?.items??this.ui?.styles?.getQuickGallery?.()??[];e!==this._linkedStyleOptions.value&&(this._linkedStyleOptions.value=e)}getActiveLinkedStyleId(){return this.ui?.styles?.getActiveParagraphStyle?.()?.styleId??null}setActiveEditor(e){this.activeEditor=e;const t=this.#r();t!==this._lastFontOptionsSignature&&(this._lastFontOptionsSignature=t,this.#g()),this.ui&&(this.snapshot=this.ui.toolbar.getSnapshot()),this.updateToolbarState()}onToolbarResize=()=>{this.#c(),this.updateToolbarState()};#k(e){return e==="ruler"?!!this.superdoc?.config?.rulers:e==="formattingMarks"?!!this.superdoc?.config?.layoutEngineOptions?.showFormattingMarks:!1}#b(e){return e==="ruler"?typeof this.superdoc?.toggleRuler=="function":e==="formattingMarks"?typeof this.superdoc?.toggleFormattingMarks=="function"||typeof this.superdoc?.setShowFormattingMarks=="function":!1}#A(){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)}#S(){const e=this.toolbarItems.find(n=>n.name.value==="highlight");if(!e)return;const t={key:"color",type:"render",render:()=>Vb(this,e,[],!0)};e.nestedOptions.value=[t]}#L(e){return!!e?.active&&e?.value==null}#D(e){return!!e&&e.disabled===!1&&e.value==null}#v(e){const t=e.name.value;if(e.isCustomToolbarItem&&typeof e.command=="string"){const i=this.snapshot?.commands?.[e.command];return e.setDisabled(e.initiallyDisabled||!i||!!i.disabled),i?.active?e.activate():e.deactivate(),!0}if(t==="tableActions"){const i=rI.map(s=>this.snapshot?.commands?.[s]).some(s=>s&&!s.disabled);return e.setDisabled(!i),!0}if(t==="search")return e.setDisabled(this.superdoc?.uiConfig?.search?.enabled!==!0),!0;if(Nb(t)?.disposition==="host-routed")return e.setDisabled(!this.#b(t)),this.#k(t)?e.activate():e.deactivate(),!0;const n=cI(t);if(!n)return!1;const r=this.snapshot?.commands?.[n];rU(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.#A()},link:()=>{e.active.value=!!r?.active,e.attributes.value=Ub(e.attributes.value,r?.value??null)},fontFamily:()=>{if(r?.value!=null){e.activate({fontFamily:r.value});return}if(this.#D(r)){e.activate({},!0);return}e.deactivate()},fontSize:()=>{if(r?.value!=null){e.activate({fontSize:r.value});return}if(this.#L(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.#A(),this.#S();const e=this.snapshot?.commands?.["document-mode"]?.value||"editing";!(this.snapshot&&(this.superdoc?.activeEditor??this.activeEditor))||e==="viewing"?(this.#w(),this.#a().forEach(n=>{const r=n.isCustomToolbarItem&&typeof n.command=="string";(n.allowWithoutEditor?.value||r)&&this.#v(n)})):this.#a().forEach(n=>{n.resetDisabled(),this.#v(n)});const t=this.getToolbarItemByName("copyFormat");t&&(this.snapshot?.copyFormatActive?t.activate():t.deactivate()),this.emit("toolbar-state-change")}#w(){this.#a().forEach(e=>{const{allowWithoutEditor:t}=e;t?.value||e.setDisabled(!0)})}#T(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}#x(e,t){const n=e?.name?.value;if(!n)return!1;const r={onSettled:()=>this.updateToolbarState(),onError:i=>this.#m(i,n)};if(n==="image"&&t==null)return this.#I();if(n==="tableActions"){const i=nI[t?.command];return i?zm(this.ui,i,void 0,r):!1}if(Nb(n)?.disposition==="unsupported")return!0;const o=cI(n);return o?zm(this.ui,o,t,r):!1}#I(){return this.snapshot?.commands?.image?.disabled||(this.#e||(this.#e=zz({ownerDocument:this.toolbarContainer?.ownerDocument??document,onPick:async e=>{const t=await Nz(e,this.superdoc?.config?.handleImageUpload);zm(this.ui,"image",{src:t},{onSettled:()=>this.updateToolbarState(),onError:n=>this.#m(n,"image")})},onError:e=>this.#m(e,"image")})),this.#e.open()),!0}#f(){if(this.#n)return;const e=this.superdoc?.activeEditor?.container??document,t=i=>{uI(i.target)||this.ui.formatPainter.setPointerSelecting(!0)},n=i=>{this.ui.formatPainter.setPointerSelecting(!1),!uI(i.target)&&this.ui.formatPainter.notifyPointerUp()},r=i=>{if(i.key==="Escape"){this.ui.formatPainter.cancel();return}oU(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)}}#C(){this.#n&&(this.#n(),this.#n=null)}#m(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(Nb(r)?.disposition==="host-routed"){this.#T(r,t),this.updateToolbarState();return}if(typeof o=="function"){const s=`__builtin_toolbar__${r}`;if(this._customCommandRegs.has(s)&&this.ui?.commands?.execute)this.ui.commands.execute(s,{argument:t,option:n});else{const a=o({item:e,argument:t,option:n,ui:this.ui,superdoc:this.superdoc});a&&typeof a.then=="function"&&Promise.resolve(a).catch(l=>this.#m(l,r))}this.updateToolbarState();return}if(e?.isCustomToolbarItem&&typeof o=="string"){if(!zm(this.ui,o,t,{onSettled:()=>this.updateToolbarState(),onError:s=>this.#m(s,r),reportUnhandled:!0}))throw new Error(`[superdoc toolbar] Command not handled: ${String(o)}`);this.updateToolbarState();return}if(!this.#x(e,t)&&o)throw new Error(`[superdoc toolbar] Command not handled: ${String(o)}`);this.updateToolbarState()}catch(s){this.#m(s,r)}}}destroy(){this.#C(),this.#e?.destroy(),this.#e=null,this.#s(),this.#o(),this.app?.unmount(),this.app=null,this.toolbar=null}};function aU(e){return new sU(e)}function lU(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 cU(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=Vm(e.color);n!=null&&(t.color=n),e.highlight!=null&&(t.highlight=e.highlight);const r=dU(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=uU(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=fU(e.border);return i&&(t.border=i),t}function Vm(e){if(e){if(typeof e=="string")return e;if(e.model==="rgb")return e.value;if(e.model==="auto")return"auto"}}function uU(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 dU(e){if(!e)return;const t={},n=Vm(e.fill);n!=null&&(t.fill=n);const r=Vm(e.color);return r!=null&&(t.color=r),e.pattern!=null&&(t.val=e.pattern),Object.keys(t).length>0?t:void 0}function fU(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=Vm(e.color);return n!=null&&(t.color=n),Object.keys(t).length>0?t:void 0}function xc(e){const t=e?.selectionTarget??e?.target;if(!e||!t)return"";try{return JSON.stringify(t)}catch{return String(t)}}var hU=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"]),pU=e=>e?.type!=="mutation:committed"||e.origin!=="command"?!1:hU.has(e.editableCommandKind);function dI(e){return e.split(",").map(t=>t.trim()).filter(Boolean)}function mU(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 dI(r))n(o);return n(e.getAttribute("data-track-change-id")),t}function fI(e,t){if(!e||typeof e.getAttribute!="function")return[];const n=[],r=new Set;let o=[],i=e;for(;i;){const s=i,a=mU(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 dI(f)){const v=`comment:${m}`;r.has(v)||(r.add(v),n.push({type:"comment",id:m}))}const p=s.getAttribute("data-sdt-type"),g=s.getAttribute("data-sdt-id");if(g&&p==="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 go=()=>({oneOf:[{type:"boolean"},{type:"null"}]}),Ol=()=>({oneOf:[{type:"string",minLength:1},{type:"null"}]}),Zu=()=>({oneOf:[{type:"number"},{type:"null"}]}),Qu=e=>({oneOf:[{type:"object",properties:e,additionalProperties:!1,minProperties:1},{type:"null"}]}),gU={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},vU={type:"object",properties:{id:{type:"number"},val:{type:"boolean"}},required:["id"],additionalProperties:!1},yU=()=>({oneOf:[{type:"boolean"},{type:"null"},gU]}),bU=()=>({oneOf:[{type:"array",items:vU,minItems:1},{type:"null"}]});function jm(e,t){return{storage:"mark",markName:e,textStyleAttr:t}}function wU(e){return{storage:"runAttribute",nodeName:"run",runPropertyKey:e}}var Hb=(e,t,n)=>({key:e,type:"boolean",ooxmlElement:t,storage:"mark",tracked:!0,carrier:jm(n),schema:go()}),Rc=(e,t,n,r,o)=>({key:e,type:t,ooxmlElement:n,storage:"mark",tracked:!0,carrier:jm("textStyle",o??e),schema:r}),Hn=(e,t,n,r,o)=>({key:e,type:t,ooxmlElement:n,storage:"runAttribute",tracked:!1,carrier:wU(o??e),schema:r}),Um=[Hb("bold","w:b","bold"),Hb("italic","w:i","italic"),Hb("strike","w:strike","strike"),{key:"underline",type:"object",ooxmlElement:"w:u",storage:"mark",tracked:!0,carrier:jm("underline"),schema:yU()},{key:"highlight",type:"string",ooxmlElement:"w:highlight",storage:"mark",tracked:!0,carrier:jm("highlight"),schema:Ol()},Rc("color","string","w:color",Ol()),Rc("fontSize","number","w:sz",Zu()),Rc("fontFamily","string","w:rFonts",Ol()),Rc("letterSpacing","number","w:spacing",Zu()),Rc("vertAlign","string","w:vertAlign",{oneOf:[{enum:["superscript","subscript","baseline"]},{type:"null"}]}),Rc("position","number","w:position",Zu()),Hn("dstrike","boolean","w:dstrike",go()),Hn("smallCaps","boolean","w:smallCaps",go()),Rc("caps","boolean","w:caps",go(),"textTransform"),Hn("shading","object","w:shd",Qu({fill:{oneOf:[{type:"string",minLength:1},{type:"null"}]},color:{oneOf:[{type:"string",minLength:1},{type:"null"}]},val:{oneOf:[{type:"string",minLength:1},{type:"null"}]}})),Hn("border","object","w:bdr",Qu({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"),Hn("outline","boolean","w:outline",go()),Hn("shadow","boolean","w:shadow",go()),Hn("emboss","boolean","w:emboss",go()),Hn("imprint","boolean","w:imprint",go()),Hn("charScale","number","w:w",Zu(),"w"),Hn("kerning","number","w:kern",Zu(),"kern"),Hn("vanish","boolean","w:vanish",go()),Hn("webHidden","boolean","w:webHidden",go()),Hn("specVanish","boolean","w:specVanish",go()),Hn("rtl","boolean","w:rtl",go()),Hn("cs","boolean","w:cs",go()),Hn("bCs","boolean","w:bCs",go(),"boldCs"),Hn("iCs","boolean","w:iCs",go(),"italicCs"),Hn("eastAsianLayout","object","w:eastAsianLayout",Qu({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"}]}})),Hn("em","string","w:em",Ol()),Hn("fitText","object","w:fitText",Qu({val:{oneOf:[{type:"number"},{type:"null"}]},id:{oneOf:[{type:"string",minLength:1},{type:"null"}]}})),Hn("snapToGrid","boolean","w:snapToGrid",go()),Hn("lang","object","w:lang",Qu({val:{oneOf:[{type:"string",minLength:1},{type:"null"}]},eastAsia:{oneOf:[{type:"string",minLength:1},{type:"null"}]},bidi:{oneOf:[{type:"string",minLength:1},{type:"null"}]}})),Hn("oMath","boolean","w:oMath",go()),Hn("rStyle","string","w:rStyle",Ol(),"styleId"),Hn("rFonts","object","w:rFonts",Qu({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"),Hn("fontSizeCs","number","w:szCs",Zu()),Hn("ligatures","string","w14:ligatures",Ol()),Hn("numForm","string","w14:numForm",Ol()),Hn("numSpacing","string","w14:numSpacing",Ol()),Hn("stylisticSets","array","w14:stylisticSets",bU()),Hn("contextualAlternates","boolean","w14:cntxtAlts",go())],yW=new Set(Um.map(e=>e.key)),CU=Object.fromEntries(Um.map(e=>[e.key,e])),bW={mark:Um.filter(e=>e.storage==="mark").map(e=>e.key),runAttribute:Um.filter(e=>e.storage==="runAttribute").map(e=>e.key)};function Ua(){return typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now()}function Hm(){const e=globalThis;return{sink:typeof e.__superdocV2BenchPipelineTiming=="function"?e.__superdocV2BenchPipelineTiming:null,workerContext:e.__superdocV2BenchWorkerMessageContext??null}}function $b(e){const{sink:t}=Hm();if(t)try{t(e)}catch{}}var Gb=new WeakMap;function kU(e){let t=Gb.get(e);return t||(t={refCount:0,generation:0,abortController:new AbortController,inFlight:null,activeMutationTokens:new Set},Gb.set(e,t)),t.refCount+=1,t}function SU(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(),Gb.delete(e))}var _U=new Set(Object.values(lt));function $m(e,t){return typeof e=="string"&&_U.has(e)?e:t}function hI(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:$m(t,lt.targetUnresolved)}}return{ok:!0}}var AU=["document-replaced","editorCreate","active-editor-change","document-mode-change","zoomChange","measurement-unit-change","viewport-change","fonts-changed"],IU={[HA.bulletList]:"bullet",[HA.numberedList]:"ordered"};function pI(e){return IU[e]??null}var EU={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 TU(e){const t=EU[e];return t?{preset:t,behavior:"toggleStyle"}:{}}var xU={status:"ready",empty:!0,target:null,selectionTarget:null,activeMarks:[],activeCommentIds:[],activeChangeIds:[],quotedText:""},RU=[{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"}],LU=new Set(["/word/comments.xml","/word/commentsExtended.xml","/word/commentsIds.xml"]);function MU(e){return RU.some(t=>t.match==="exact"?t.key===e:e.startsWith(t.key))}var mI={ready:0,stale:1,pending:2};function Pl(...e){let t="ready";for(const n of e)mI[n]>mI[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 Pr(e){return!!e&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"}function wr(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 Yn(e,t="CAPABILITY_UNAVAILABLE"){return{success:!1,failure:{code:t,message:e}}}function lh(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 ch(e){if(!e||typeof e!="object")return null;const t=e.target;return t&&typeof t=="object"?t:null}function Wb(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 gI(e,t){if(!e||typeof e!="object")return null;const n=ch(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||!Wb(n))return i}return n}function tr(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 uh(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=ch(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 $i(e,t,n){return Kr(e)!==t?!1:n?tr(uh(e))===tr(n):!0}function Gm(e){const t=uh(e);if(!(!t||tr(t)===tr(null)))return t}function DU(e){if(typeof e!="string"||e.length===0)return;const t=BT(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 OU(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 Kb(e){if(!e||typeof e!="object")return null;const t=e.selectionTarget;return t&&typeof t=="object"?t:null}function Wm(e){if(!e||typeof e!="object")return null;const t=e.id;return typeof t=="string"&&t.length>0?t:null}function PU(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 Kr(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 Ju(e){return typeof e=="string"?e.trim():""}function FU(e,t){const n=t??{},r=Ju(n.id).toLowerCase(),o=Ju(e.authorId).toLowerCase();if(r&&o)return r===o;const i=Ju(n.email).toLowerCase(),s=Ju(e.authorEmail).toLowerCase();if(i&&s)return i===s;if(r||i||o||s)return!1;const a=Ju(e.author).replace(/\s+/g," ").toLowerCase();if(!a)return!0;const l=Ju(n.name).replace(/\s+/g," ").toLowerCase();return!!(l&&l===a)}function NU(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 vI=new WeakMap;function yI(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 Ks(e){const t=vI.get(e);if(t)return t;const n=new Set,r=new Map;for(const i of e){const s=Kr(i);if(s){n.add(s);for(const a of yI(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 vI.set(e,o),o}var bI=new WeakMap,wI=new WeakMap;function Lc(e,t){const n=tr(t);let r=bI.get(e);r||(r=new Map,bI.set(e,r));const o=r.get(n);if(o)return o;const i=Ks(e.filter(s=>tr(uh(s))===n));return r.set(n,i),i}function BU(e){return!!e&&typeof e=="object"&&e.storyType==="textbox"}function zU(e,t){const n=t.filter(o=>e.some(i=>Kr(i)===o&&uh(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=>Kr(s)===o);if(i)for(const s of yI(i)){if(r.has(s))return null;r.add(s)}}return n[0]}function VU(e){const t=wI.get(e);if(t)return t;const n=e.filter(o=>uh(o)!=null),r=n.length===e.length?e:n;return wI.set(e,r),r}function jU(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=us(r),l=tr(a)===tr(null);if(i){const c=l?VU(i):i,d=s(Lc(c,a));if(d)return d;const f=n?.find(p=>c.some(g=>$i(g,p,a)));return f||(l?s(Ks(o)):BU(a)?zU(i,t):null)}return l?s(Ks(o))??t[0]??null:null}function UU(e,t){const n=e.find(r=>Kr(r)===t||r.importedId===t);return n?n.rootCommentId??n.parentCommentId??Kr(n)??t:null}function HU(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 Fr(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 $U=64;function Mc(e){return e.length<=$U}function us(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 _o(e,t){return{kind:"block",nodeType:"paragraph",nodeId:e,...t&&typeof t=="object"?{story:t}:{}}}function Ha(e){return{kind:"block",nodeType:"paragraph",nodeId:e}}function CI(e,t){return{kind:"block",nodeType:"listItem",nodeId:e,...t&&typeof t=="object"?{story:t}:{}}}var kI=720;function qs(e){return Math.round(e*20)}function ed(e){return typeof e=="number"&&Number.isFinite(e)}function GU(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=ed(i.left)?qs(i.left):ed(i.start)?qs(i.start):void 0,a=ed(i.right)?qs(i.right):ed(i.end)?qs(i.end):void 0,l=ed(i.firstLine)?qs(i.firstLine):void 0,c=ed(i.hanging)?qs(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 qb(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 WU(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 dh(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 Ys(e){return dh(e.target)??dh(e.selectionTarget)}var SI=["fontFamily","fontSize","color","highlight"],KU={undo:"history.undo",redo:"history.redo"},fh=["bold","italic","underline","strikethrough"];function Yb(e){return SI.includes(e)}function td(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 ds(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 qU(e){const t=ds(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 $a(e){const t=td(e);return t.length===0?null:[qU(e),...t.map(n=>`${n.blockId}:${n.start}-${n.end}`)].join("|")}function _I(e){const t=e.selectionTarget;return!t||typeof t!="object"?null:xc({selectionTarget:t})}function YU(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 XU(e,t){return Math.max(e.start,t.start)<Math.min(e.end,t.end)}function ZU(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 QU(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 AI(e,t){const n=td(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=>QU(n,ZU(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 JU(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 Xb(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 eH(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 tH(e,t){return e==="fontFamily"?t.toLowerCase():e==="color"||e==="highlight"?t.toUpperCase():t}function II(e,t){if(!e)return{};const n=new Map;for(const i of td(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 SI){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 p=Array.isArray(c?.runs)?c.runs:[];for(const g of p){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(w=>XU(w,{start:v,end:k})))continue;a=!0;const C=JU(g?.styles,i);if(C===void 0){l=!0;continue}const S=tH(i,C);if(s.has(S)||s.set(S,C),s.size>1)break}if(s.size>1)break}a&&!l&&s.size===1&&(o[i]=[...s.values()][0])}return o}function Zb(e,t){const n=Fr(e)[0];return n?t==="nodeId"?{kind:"after",nodeId:n}:{kind:"after",target:_o(n)}:{kind:"documentEnd"}}function Jt(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 nd(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 rd(e){const t=e,n=t.change;return n&&typeof n=="object"?n:t}function Xs(e){if(Pr(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 Km(e){return!!e&&typeof e=="object"&&e.success===!0}function Ao(e){return!(e===!1||e&&typeof e=="object"&&e.success===!1)}function hh(e){return!!(e&&typeof e=="object"&&!Array.isArray(e))}function Qb(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 Dc(e,t){return e.sourceAnchor?.sourceNodeId===t?!0:e.id===t}function qm(e){return e.trackedChange?.kind==="delete"?0:typeof e.text=="string"?e.text.length:0}function Ei(e){let t=!1,n=null,r=null,o=null;for(const i of e)t=i,!Ao(i)&&n===null&&(n=i),Km(i)&&(o=i),i!==!1&&(r=i);return n??o??r??t}function nH(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 rH(e){return e.startsWith("#")?{kind:"anchor",anchor:e.slice(1)}:{kind:"external",url:e}}function Ym(e){return Xu(e)?.trackDecision??null}function oH(e){return{found:e.length>0,success:e.length>0,rects:e,rect:e[0]}}function Fl(e){return{found:!1,success:!1,rects:[],reason:e}}function iH(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 sH(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 EI(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(sH))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 aH(e){return e.selectionTarget?e.selectionTarget:EI(e.target)}function od(e){if(e.empty)return null;if(e.selectionTarget)return e.selectionTarget;const t=EI(e.target);return t&&t.start.kind==="text"&&t.end.kind==="text"&&t.start.blockId!==t.end.blockId?null:t}function Jb(e){return!e.inline||typeof e.docRoute!="string"?null:e.docRoute.startsWith("format.")?e.docRoute.slice(7):null}var e2={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},lH=Object.fromEntries(Object.entries(e2).filter(([e])=>CU[e]?.tracked===!0));function cH(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:{...e2}};default:return null}}function uH(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 dH(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 fH(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,p={mode:"idle",snapshot:null,sourceSelectionKey:null,lastClickAt:0,pointerSelecting:!1,keyboardSelecting:!1},g=0;const m=new Set;let v={},k="",C=null;const S=()=>{const u=t?.activeEditor;return u&&typeof u=="object"?u:null},w={open:()=>{if(V)return{ok:!1,reason:lt.notReady};const u=S();if(!u)return{ok:!1,reason:lt.notReady};const h=u.contextMenu;if(!h||typeof h!="object"||typeof h.open!="function")return{ok:!1,reason:lt.operationUnavailable};try{const y=h.open();return y&&typeof y=="object"&&y.ok===!1?{ok:!1,reason:$m(y.reason,lt.operationUnavailable)}:{ok:!0}}catch{return{ok:!1,reason:lt.operationUnavailable}}},close:()=>{if(V)return;const u=S()?.contextMenu;if(!(!u||typeof u!="object"||typeof u.close!="function"))try{u.close()}catch{}}},b=()=>{const u=S()?.doc;return u&&typeof u=="object"?u:null},T=()=>{const u=S()?.v2TrackedChanges;return u&&typeof u=="object"?u:null},L=()=>{const u=S();if(u?.editorVersion!==2)return null;const h=u.reviewWindow;return h&&typeof h=="object"?h:null},N=()=>{const u=L();return!u||typeof u.getSnapshot!="function"?null:Lt(()=>u.getSnapshot(),null)},H=()=>typeof L()?.getSnapshot=="function",z=u=>{const h=u?.status;return h==="ready"||h==="stale"?h:"pending"},B=()=>{const u=S()?.host;return u&&typeof u=="object"?u:null},Z=u=>{if(u.storyType!=="headerFooterPart"||typeof u.refId!="string")return null;const h=S(),y=B(),_=h?.pageLayout??y?.pageLayout;if(!_||typeof _!="object")return null;const E=_.getActiveRulerContext,P=y?.resolveHeaderFooterEditTarget;if(typeof E!="function"||typeof P!="function")return null;const j=Lt(()=>E.call(_),null);if(!j||typeof j.pageIndex!="number")return null;for(const re of["header","footer"]){const ue=Lt(()=>P.call(y,{pageIndex:j.pageIndex,kind:re}),null);if(!(ue?.status!=="ready"||ue.refId!==u.refId||typeof ue.sectionId!="string"||!["default","first","even"].includes(String(ue.slotVariant))))return{kind:"story",storyType:"headerFooterSlot",section:{kind:"section",sectionId:ue.sectionId},headerFooterKind:re,variant:ue.slotVariant}}return null},R=()=>{const u=B(),h=u?.getPendingInlineFormat;if(typeof h!="function")return null;const y=Lt(()=>h.call(u),null);return y&&typeof y=="object"?y:null},K=u=>{const h=Jb(u);if(!h)return null;const y=R();if(!y||!(h in y))return null;const _=y[h];return u.inline?.kind==="toggle"?_===!0:_!=null&&_!==""},x=u=>{const h=Jb(u);if(!h)return;const y=R();if(!y||!(h in y))return;const _=y[h];if(typeof _=="string"&&_!=="")return _;if(typeof _=="number"&&Number.isFinite(_))return String(_)},W=(u,h)=>{const y=B(),_=y?.setPendingInlineFormat;typeof _=="function"&&Lt(()=>_.call(y,u,h),void 0)},$=u=>{const h=B(),y=h?.clearPendingInlineFormat;typeof y=="function"&&Lt(()=>y.call(h,u),void 0)},ee=new Set(["bold","italic","underline","strikethrough"]),Q=u=>{const h=R();if(!h)return;const y=Array.isArray(u.activeMarks)?u.activeMarks:[];let _=null;for(const E of Object.keys(h)){const P=h[E];let j;if(ee.has(E)){if(P===!1)continue;j=y.includes(E)===(P===!0)}else if(Yb(E)){if(P==null)continue;_||(_=Xa(u)),j=_[E]===P}else j=!1;j&&$(E)}},X=()=>{const u=S()?.editCommands;return u&&typeof u=="object"?u:null},we=u=>{const h=X();if(!h||typeof h.getSnapshot!="function")return null;const y=Lt(()=>h.getSnapshot(),null)?.commands?.[u];return y&&typeof y=="object"?y:null},ce=()=>we("lists.apply"),be=u=>{const h=u?.value?.seed;return h==="bullet"||h==="ordered"?h:null},ve=u=>{const h=KU[u];return h?we(h):null},Ee=()=>{const u=B();if(!u||typeof u.getTableContext!="function")return null;const h=Lt(()=>u.getTableContext(),null);return h&&typeof h=="object"?h:null},Pe=()=>{const u=Ee();if(!u||u.inTable!==!0)return null;const h=u.table,y=typeof h?.nodeId=="string"&&h.nodeId.length>0?h.nodeId:null;if(!y)return null;const _=u.row,E=u.column,P=u.cell,j=typeof _?.index=="number"&&Number.isInteger(_.index)?_.index:null,re=typeof E?.index=="number"&&Number.isInteger(E.index)?E.index:null;if(j==null||re==null)return null;const ue=typeof P?.nodeId=="string"&&P.nodeId.length>0?P.nodeId:null,xe=u.cellRange;return{tableNodeId:y,rowIndex:j,columnIndex:re,cellNodeId:ue,mergeRange:uH(xe)}},Ze=new Map;let at=null,Qe=null,At=0,se=0,Ie=0;const Ue=new Set,ne=(u,h)=>u===h?!0:!u||!h?!1:u.id===h.id&&u.paintedEntityId===h.paintedEntityId&&tr(u.story)===tr(h.story),A=u=>Array.from(Ue).some(h=>ne(h,u)),ie=u=>{const h=B();if(typeof h?.getHandles!="function")return;const y=Lt(()=>h.getHandles(),null),_=y?.review;if(_){if(u){if(typeof _.setActiveReviewTarget!="function")return;const E=y?.layout;Lt(()=>_.setActiveReviewTarget({entityType:"trackedChange",entityId:u.id,...u.paintedEntityId?{paintedEntityId:u.paintedEntityId}:{},origin:"panel",layoutEpoch:typeof E?.generation=="number"?E.generation:0,story:u.story??{kind:"story",storyType:"body"}}),null);return}typeof _.getActiveReviewTarget!="function"||typeof _.clearActiveReviewTarget!="function"||Lt(()=>_.getActiveReviewTarget(),null)?.entityType==="trackedChange"&&Lt(()=>_.clearActiveReviewTarget(),void 0)}},F=(u,h)=>{Qe=u,At+=1,Ie+=1,h?.invalidateQueuedNavigation!==!1&&(se+=1)},Y=new Set;let O,V=!1,oe=null;const U=new Map,G=new Set;let ge=null,Ae=null,Se=!1,Te=null,Ye=0,rt=null,ht=null,Pt=null;const Ft=[],Wt=()=>{if(Se||V)return;Se=!0;const u=()=>{Se=!1,V||de("async-read-settled")};typeof queueMicrotask=="function"?queueMicrotask(u):Promise.resolve().then(u)},$e=250,cn=5e3,jn=u=>{V||Te&&Ye<=u||(Te&&clearTimeout(Te),Ye=u,Te=setTimeout(()=>{Te=null,Ye=0,V||de()},Math.max(0,u-Date.now())))},Ut=new WeakMap;let In=0;const qr=u=>{if(!u)return"none";let h=Ut.get(u);return h==null&&(h=In+=1,Ut.set(u,h)),`e${h}`};let Cr=0;const Er=e.superdoc,Je=kU(Er),wt=()=>{Je.abortController.abort("review-mutation-started"),Je.inFlight=null},Dt=()=>{Je.generation+=1,Je.abortController=new AbortController,Je.inFlight=null},sn=u=>{const h=Je.activeMutationTokens;if(typeof u!="string"||u.length===0||h.has(u))return;const y=h.size===0;h.add(u),y&&wt()},pn=u=>{const h=Je.activeMutationTokens;typeof u!="string"||!h.delete(u)||h.size===0&&Dt()},en=u=>{const h=T(),y=h?.listTrackedChanges;if(typeof y!="function")return S()?.editorVersion===2?Promise.reject(new Error("v2-tracked-changes-bridge-pending")):u();if(Je.activeMutationTokens.size>0)return Promise.reject(new Error("ui-review-catalog-superseded"));const _=Je.generation,E=Je.inFlight;if(E?.generation===_)return E.promise;const P=Je.abortController.signal,j=xe=>{if(P.aborted||_!==Je.generation||xe?.reason==="review-hydration-superseded")throw new Error("ui-review-catalog-superseded");return xe},re=y.call(h,{blocking:!1,signal:P});if(!Pr(re))return j(re);const ue=Promise.resolve(re).then(j);return Je.inFlight={generation:_,promise:ue},ue.then(()=>{Je.inFlight?.promise===ue&&(Je.inFlight=null)},()=>{Je.inFlight?.promise===ue&&(Je.inFlight=null)}),ue};let wn=null,tn=new Set,nr=null,vo=0,ze=null;const Re=()=>`${qr(S())}|m${Cr}`,tt=()=>{wn=null,tn=new Set},Ct=u=>{for(const h of["trackChanges","trackChanges:all"]){const y=U.get(h);if(!y?.hasSettled||!Array.isArray(y.value))continue;const _=y.value.filter(E=>{const P=Kr(E);return!P||!u.has(P)});_.length!==y.value.length&&U.set(h,{...y,value:_})}},xt=u=>{const h=()=>{if(!V)for(const P of[...Y])P(O)},y=hh(u)?u:null,_=S()?.documentMutationReadiness,E=()=>{const P=globalThis.requestAnimationFrame;return typeof P!="function"?Promise.resolve():new Promise(j=>{let re=!1;const ue=()=>{re||(re=!0,clearTimeout(xe),j())},xe=setTimeout(ue,250);P(()=>P(()=>setTimeout(ue,0)))})};if(y?.success===!0&&typeof y.txId=="string"&&y.txId.length>0&&typeof _?.whenPainted=="function")try{Promise.resolve(_.whenPainted.call(_,y)).then(E,()=>{}).then(h,h);return}catch{}h()},Mt=(u,h)=>{const y=O.trackChanges,_=y.items.filter(j=>{const re=Kr(j);return!re||!u.has(re)});if(_.length===y.items.length)return;Qe&&u.has(Qe.id)&&F(null);const E=new Set;for(const j of _){const re=rd(j),ue=j,xe=re.author??re.authorEmail??ue.author??ue.authorEmail;typeof xe=="string"&&E.add(xe)}const P=y.items.length-_.length;O={...O,trackChanges:{...y,items:_,total:Math.max(_.length,y.total-P),activeId:y.activeId&&u.has(y.activeId)?null:y.activeId,authors:[...E]}},xt(h)},En=u=>{const h=O.trackChanges,y=h.items.length>0||h.total!==0||h.activeId!==null||h.authors.length>0;nr=Re(),Qe!==null&&F(null),O={...O,trackChanges:{...h,items:[],total:0,activeId:null,authors:[]}},y&&xt(u)},Ht=(u,h)=>{if(u.size===0)return;const y=Re(),_=wn===y?tn:new Set,E=new Set([...u].filter(P=>!_.has(P)));E.size!==0&&(wn=y,tn=new Set([..._,...E]),Ct(tn),Mt(E,h))},un=u=>wn===u&&tn.size>0?tn:null,io=u=>{const h=Re(),y=un(h),_=u.map(nd).filter(E=>{if(E==null)return!1;const P=Kr(E);return P!=null&&!y?.has(P)});for(const E of["trackChanges","trackChanges:all"])U.set(E,{token:h,value:[..._],hasSettled:!0,inflightToken:null})},Qr=()=>`${Re()}|m${ir()}|s${vo}`,jo=u=>JSON.stringify({t:u.target??null,s:u.selectionTarget??null}),on=["contentControls:inRange:","query:","effInline:"],rr=120,Xn=180,Io=()=>{const u=B(),h=u?.getDocumentLoadingSnapshot;if(typeof h!="function")return"unknown";const y=Lt(()=>h.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"},Xt=new Map,an=new Map,or=new Map;let Yr=null,Uo=0,Gi=0;const Ho=u=>{const h=Re();Xt.get(u)!==h&&(Xt.set(u,h),Wt())},Nl=()=>{const u=U.get("comments");return u?.hasSettled?Array.isArray(u.value)&&u.value.length>0:u?.inflightToken!=null},Zs=(u,h)=>Xt.get(u)===h,hs=()=>{const u=Re();let h=!1;for(const[y,_]of an){if(_!==u){an.delete(y);continue}if(or.get(y)===u)continue;const E=U.get(y);!E?.hasSettled||E.token!==u||E.inflightToken!=null||(U.set(y,{...E,token:null,inflightToken:null}),or.set(y,u),h=!0)}h&&Wt()},Bl=u=>{u==="comments"?Uo+=1:Gi+=1,Ho(u);let h=!1;return()=>{h||(h=!0,u==="comments"?Uo=Math.max(0,Uo-1):Gi=Math.max(0,Gi-1),(u==="comments"?Uo:Gi)===0&&Xt.get(u)===Re()&&Xt.delete(u),Wt())}},ei=u=>{Ho("contentControls")},Ti=()=>{const u=U.get("trackChanges");u?.hasSettled||u?.inflightToken!=null||Ho("trackChanges")},_e=()=>{const u=U.get("comments");u?.hasSettled||u?.inflightToken!=null||Ho("comments")},Fe=6500,vt=250;let dt=0,Mn=0,mn=!1,ur=null;const Nr=()=>{if(V||ur)return;const u=()=>{if(ur=null,V)return;const h=Date.now()-dt;if(Br()||h<Fe){ur=setTimeout(u,vt);return}mn=!1,de()};ur=setTimeout(u,0)};let Eo=null,Tr=null;const To=()=>{const u=B();if(!u||Eo===u)return;Tr&&(Tr(),Tr=null),Eo=u;const h=u.subscribeDocumentLoading;if(typeof h!="function"){Eo=null,xi(Fe);return}try{const y=P=>{const j=P?.sourceStage;(j==="source-complete"||j==="source-failed"||j==="source-cancelled")&&(Yr=Re(),hs(),dt=Math.max(dt,Date.now()),Nr())},_=h.call(u,y);typeof _=="function"&&(Tr=_);const E=u.getDocumentLoadingSnapshot;typeof E=="function"&&y(Lt(()=>E.call(u),null))}catch{Eo=null,xi(Fe)}},ti=()=>{const u=S()?.host,h=u?.getForegroundMutationState;if(typeof h!="function")return null;const y=Lt(()=>h.call(u),null);return{active:typeof y?.active=="number"?y.active:0,pending:typeof y?.pending=="number"?y.pending:0}},Br=()=>{const u=ti();return!!(u&&(u.active>0||u.pending>0))},xi=(u=rr)=>{V||rt||(rt=setTimeout(()=>{if(rt=null,V)return;if(ht&&Br()){xi(),de();return}const h=ht;ht=null,h===Qr()&&na("selection",h,Ul,qi),de()},u))},zl=(u,h)=>{if(!ti())return!1;const y=`${u}\0${h}`;return G.has(y)?!1:(G.add(y),xi(Xn),!0)},Jr=u=>{if(ge==null||u===ge)return Ae?.timer&&clearTimeout(Ae.timer),Ae=null,ge=u,!1;if(Ae?.key===u)return Ae.ready?(Ae=null,ge=u,!1):!0;Ae?.timer&&clearTimeout(Ae.timer);const h={key:u,ready:!1,timer:null};return h.timer=setTimeout(()=>{V||Ae!==h||(h.timer=null,h.ready=!0,de())},Xn),Ae=h,!0},Qs=u=>pU(u),Js=()=>{ra(),de()};let Ri=null,Wi=null,Ga=!1,ps=0,ea=!1,yo=0;const ms=()=>{Ri=null,Ga=!1,ps+=1},ta=()=>{Wi=null,ea=!1,yo+=1},Wa=()=>{const u=S(),h=u?.documentMutationReadiness;if(!u||typeof h?.whenPainted!="function"||(Ri={editor:u,readiness:h,afterEpoch:typeof h.getRenderEpoch=="function"?Lt(()=>h.getRenderEpoch.call(h),null):null},Ga))return;Ga=!0;const y=ps;(async()=>{for(;!V&&y===ps;){const E=Ri;if(Ri=null,!E){Ga=!1;return}let P=!1;try{await E.readiness.whenPainted.call(E.readiness,typeof E.afterEpoch=="number"?{afterEpoch:E.afterEpoch}:void 0),P=!0}catch{}if(V||y!==ps)return;if(S()!==E.editor){ms();return}P&&Js()}})()},Ka=()=>{const u=S(),h=u?.documentMutationReadiness;if(!u||typeof h?.whenPainted!="function")return!1;if(Wi={editor:u,readiness:h,afterEpoch:typeof h.getRenderEpoch=="function"?Lt(()=>h.getRenderEpoch.call(h),null):null},ea)return!0;ea=!0;const y=yo;return(async()=>{for(;!V&&y===yo;){const E=Wi;if(Wi=null,!E){ea=!1;return}let P=!1;try{await E.readiness.whenPainted.call(E.readiness,typeof E.afterEpoch=="number"?{afterEpoch:E.afterEpoch}:void 0),P=!0}catch{}if(V||y!==yo)return;if(S()!==E.editor){ta();return}Wi||(vo+=1,zc(),de(P?"post-paint-selection":"post-paint-selection-failed"))}})(),!0},gs=()=>{Pt&&clearTimeout(Pt),Pt=setTimeout(()=>{Pt=null,V||Js()},500)},na=(u,h,y,_)=>{let E;try{E=y()}catch{E=void 0}if(!Pr(E)){const re={token:h,value:_(E),hasSettled:!0,inflightToken:null,failedToken:null,failureCount:0,retryAtMs:0};return U.set(u,re),re}const P=U.get(u),j=P?.failedToken===h;return U.set(u,{token:P?.token??null,value:P?.value??null,hasSettled:P?.hasSettled??!1,inflightToken:h,failedToken:j?h:null,failureCount:j?P.failureCount??0:0,retryAtMs:0}),Promise.resolve(E).then(re=>{const ue=U.get(u);if(!ue||ue.inflightToken!==h)return;U.set(u,{token:h,value:_(re),hasSettled:!0,inflightToken:null,failedToken:null,failureCount:0,retryAtMs:0});const{sink:xe,workerContext:Ve}=Hm();if(xe){const Be=Ua();Ft.push({key:u,settledAtMs:Be,commandId:Ve?.commandId??null,commandKind:Ve?.commandKind??null}),$b({stage:"superdoc-ui-async-read-settled",atMs:Be,key:u,settledAtMs:Be,commandId:Ve?.commandId??null,commandKind:Ve?.commandKind??null})}Wt()},()=>{const re=U.get(u);if(!re||re.inflightToken!==h)return;const ue=re.failedToken===h?(re.failureCount??0)+1:1,xe=Math.min(cn,$e*2**Math.min(ue-1,8)),Ve=Date.now()+xe;U.set(u,{...re,inflightToken:null,failedToken:h,failureCount:ue,retryAtMs:Ve}),jn(Ve)}),null},zr=(u,h,y,_)=>{const E=U.get(u);if(E&&E.token===h&&E.hasSettled)return{value:E.value,status:"ready"};if(MU(u)&&!Zs(u,h)){if(Io()==="loading")return mn=!0,To(),E?.hasSettled?{value:E.value,status:"stale"}:{value:null,status:"pending"};if(mn)return Nr(),E?.hasSettled?{value:E.value,status:"stale"}:{value:null,status:"pending"};if(Date.now()-Mn<Fe)return mn=!0,Nr(),E?.hasSettled?{value:E.value,status:"stale"}:{value:null,status:"pending"}}if(Br())return xi(),E?.hasSettled?{value:E.value,status:"stale"}:{value:null,status:"pending"};if(E?.failedToken===h&&E.inflightToken==null&&(E.retryAtMs??0)>Date.now())return jn(E.retryAtMs),E.hasSettled?{value:E.value,status:"stale"}:{value:null,status:"pending"};if(!E&&u.startsWith("effInline:")&&Jr(u))return{value:null,status:"pending"};if(!E&&zl(u,h))return{value:null,status:"pending"};if(!E||E.inflightToken!==h){const j=na(u,h,y,_);if(j)return{value:j.value,status:"ready"}}const P=U.get(u);return P?.hasSettled?{value:P.value,status:"stale"}:{value:null,status:"pending"}},qa=u=>{for(const h of U.keys())u(h)&&U.delete(h)},Oc=u=>{const h=jo(u),y=_I(u);return new Set([`contentControls:inRange:${h}`,`query:${h}`,...y?[`effInline:${y}`]:[]])},Li=u=>{const h=Oc(u);qa(y=>on.some(_=>y.startsWith(_))&&!h.has(y));for(const y of G){const _=y.split("\0",1)[0];on.some(E=>_.startsWith(E))&&!h.has(_)&&G.delete(y)}},id=()=>{const u=S();u!==ze&&(ms(),ta(),ze=u,U.clear(),Te&&clearTimeout(Te),Te=null,Ye=0,Ae?.timer&&clearTimeout(Ae.timer),Ae=null,ge=null,C=null,o=null,ht=null,G.clear(),Xt.clear(),an.clear(),or.clear(),Yr=null,mn=!1,Tr&&Tr(),Tr=null,Eo=null,tt(),nr=null)},ra=()=>{Cr+=1,an.clear(),or.clear(),Yr=null,tt()},Pc=()=>{const u=nr===Re();ra(),u&&(io([]),nr=Re()),de()},Mi=u=>{if(typeof u!="string"||u.length===0)return Yn("insertText requires a non-empty string.","INVALID_INPUT");if(ir()==="viewing")return Yn("The document is read-only.","DOCUMENT_READONLY");const h=b(),y=h?.insert;if(!h||typeof y!="function")return Yn("insert is unavailable.");const _=h.selection?.current;if(typeof _!="function")return Yn("selection.current is unavailable.");const E=j=>{const re=j&&typeof j=="object"?j:null,ue=re?.selectionTarget??re?.target??null;return!ue||typeof ue!="object"?Yn("insertText requires a live selection target.","PRECONDITION_FAILED"):Lt(()=>gr(y.call(h,{type:"text",value:u,target:ue}),Yn("insert failed.")),Yn("insert failed."))};let P;try{P=_.call(h.selection)}catch{return Yn("insertText could not resolve the live selection.","PRECONDITION_FAILED")}return Pr(P)?Promise.resolve(P).then(E,()=>Yn("insertText could not resolve the live selection.","PRECONDITION_FAILED")):E(P)},Fc=(u,h)=>({payload:u,state:O,editor:S(),superdoc:t,context:h,ui:oe,execute:(y,_)=>Qc(y,_),executeAsync:(y,_)=>cg(y,_),doc:b(),selection:O.selection,documentMode:ir(),insertText:Mi}),Ki=u=>u==="editing"||u==="suggesting"||u==="viewing"?u:null,ir=()=>{const u=S(),h=t&&typeof t=="object"?t:null,y=Ki(h?.config?.documentMode),_=Lt(typeof h?.getActiveRuntime=="function"?()=>{const j=h.getActiveRuntime();return typeof j?.getSnapshot=="function"?j.getSnapshot():null}:void 0,null),E=Ki(_?.documentMode),P=Ki(u?.options?.documentMode);return y&&E&&y!==E?y:E??y??P},Nc=()=>{const u=t&&typeof t=="object"?t:null,h=u?.interactionConfig?.comments;if(h&&typeof h.readOnly=="boolean")return h.readOnly===!0;const y=u?.config?.modules?.comments;return!!y&&typeof y=="object"&&y.readOnly===!0},Bc=()=>{if(ir()==="viewing")return lt.documentReadonly;const u=(t&&typeof t=="object"?t:null)?.interactionConfig?.trackedChanges;return u&&typeof u.allowDecisions=="boolean"?u.allowDecisions?void 0:lt.trackedChangeDecisionsDisabled:Nc()?lt.documentReadonly:void 0},sd=()=>{const u=t&&typeof t=="object"?t:null,h=u?.interactionConfig?.comments;if(h&&typeof h.allowResolve=="boolean")return h.allowResolve===!1;const y=u?.config?.modules?.comments;return!!y&&typeof y=="object"&&y.allowResolve===!1},Vl=()=>ir()==="viewing"||Nc(),ad=()=>Bc()!=null,qi=u=>u&&typeof u=="object"?u:null,vs=(u,h)=>{if(!u)return{...xU,status:h};const y=u.target??null,_=typeof u.text=="string"?u.text:"";return{status:h,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:_}},jl=()=>{const u=b()?.selection;return zr("selection",Qr(),()=>u?.current?u.current({includeText:!0}):void 0,qi)},ys=()=>{const{value:u,status:h}=jl();return vs(u,h)},Ul=()=>{const u=b()?.selection;return u?.current?u.current({includeText:!0}):void 0},ld=u=>{if(u.empty!==!0)return!1;const h=u.selectionTarget,y=h?.start,_=h?.end;return y?.kind==="text"&&_?.kind==="text"&&typeof y.blockId=="string"&&y.blockId===_.blockId&&typeof y.offset=="number"&&y.offset===_.offset},zc=u=>{const h=B(),y=h?.readLiveSelectionSyncSnapshot;if(typeof y!="function")return;const _=qi(Lt(()=>y.call(h),null));if(!_||!ld(_))return;const E=Qr(),P=ti(),j=!!(P&&(P.active>0||P.pending>0));if(j)ht=E,xi();else if(ht=null,na("selection",E,Ul,qi))return;const re=U.get("selection"),ue=Array.isArray(_.activeMarks)&&_.activeMarks.length>0?_.activeMarks:Array.isArray(O.selection.activeMarks)?O.selection.activeMarks:[],xe=Array.isArray(_.activeCommentIds)?_.activeCommentIds:[],Ve=NU(u),Be=Ys(O.selection),Ke=dh(_.selectionTarget)??dh(_.target),qe=Be?.range,We=Ke?.range,Ge=!!(P&&P.active>0&&Be&&Ke&&Be.blockId===Ke.blockId&&tr(Be.story)===tr(Ke.story)&&typeof qe?.start=="number"&&typeof We?.start=="number"&&Math.abs(We.start-qe.start)<=2),st=Ve!=null||Ge?O.selection.activeChangeIds.filter(Xe=>Ve==null||Ks(O.trackChanges.items).aliasesFor(Xe).includes(Ve)):[],it=Array.isArray(_.activeChangeIds)&&_.activeChangeIds.length>0?_.activeChangeIds:st;U.set("selection",{token:E,value:{..._,activeMarks:ue,activeCommentIds:xe,activeChangeIds:it},hasSettled:!0,inflightToken:j?null:re?.inflightToken??null})},Yi=async(u=0)=>{const h=b()?.selection,y=h?.current,_=Qr();if(typeof y!="function")return U.set("selection",{token:_,value:null,hasSettled:!0,inflightToken:null}),de(),O.selection;let E;try{E=y.call(h,{includeText:!0}),Pr(E)&&(E=await Promise.resolve(E))}catch{E=null}return V?vs(null,"pending"):Qr()!==_?u<1?Yi(u+1):O.selection:(U.set("selection",{token:_,value:qi(E),hasSettled:!0,inflightToken:null}),de(),O.selection)},mr=()=>{const u=b()?.comments;return zr("comments",Re(),()=>u?.list?u.list():void 0,h=>h&&Array.isArray(h.items)?h.items:[])},oa=(u="trackChanges")=>{const h=Re(),y=b()?.trackChanges,_=T(),E=typeof _?.listTrackedChanges=="function"?_.listTrackedChanges:null,P=zr(u,h,()=>E?en(()=>y?.list?.({in:"all"})):y?.list?y.list({in:"all"}):void 0,j=>{const re=j&&typeof j=="object"?j:null;if(re?.complete===!1||re?.sourceCoverageComplete===!1){if(an.set(u,h),To(),Yr===h||Io()==="complete"){const ue=()=>{V||hs()};typeof queueMicrotask=="function"?queueMicrotask(ue):Promise.resolve().then(ue)}}else an.get(u)===h&&an.delete(u);return re&&Array.isArray(re.items)?re.items:[]});return an.get(u)===h&&P.status==="ready"?{...P,status:"stale"}:P},Vc=u=>{const h=N(),y=H(),_=y?null:mr(),E=y&&Array.isArray(h?.commentItems)?h.commentItems:null,P=y?E:_.value,j=y?z(h):_.status,re=P??[],ue=u.activeCommentIds,xe=U.get("comments"),Ve=xe?.token===Re()&&xe.hasSettled&&Array.isArray(xe.value)?xe.value:null,Be=Uo>0?Ve:re;at&&Be&&!Be.some(qe=>Kr(qe)===at)&&(at=null);const Ke=at??ue[0]??null;return{status:Pl(j,u.status),listStatus:j,items:re,total:re.length,activeIds:ue,activeId:Ke}},Ya=new WeakMap,Di=u=>{const h=Ya.get(u);if(h)return h;const y=u.map(nd).filter(_=>_!=null);return Ya.set(u,y),y},Xi=new WeakMap,Hl=(u,h)=>{const y=Xi.get(u);if(y?.suppressedIds===h)return y.value;const _=h?u.filter(E=>{const P=Kr(E);return!P||!h.has(P)}):u;return Xi.set(u,{suppressedIds:h,value:_}),_},cd=new WeakMap,ud=u=>{const h=cd.get(u);if(h)return h;const y=new Set;for(const E of u){const P=rd(E),j=E,re=P.author??P.authorEmail??j.author??j.authorEmail;typeof re=="string"&&y.add(re)}const _=[...y];return cd.set(u,_),_},bs=()=>{const u=Re();if(H()){const _=U.get("trackChanges"),E=_?.token===u&&_.hasSettled&&Array.isArray(_.value)?_.value:N()?.trackedChangeItems;return Array.isArray(E)?Di(E):null}const{value:h,status:y}=oa("trackChanges:all");return y==="ready"?Di(h??[]):null},$l=u=>{const h=Re(),y=un(h),_=N(),E=H(),P=E?null:oa(),j=E&&Array.isArray(_?.trackedChangeItems)?_.trackedChangeItems:null,re=E?j:P.value,ue=E?z(_):P.status,xe=Hl(Di(re??[]),y),Ve=bs(),Be=Qe;if(Be&&!Ue.has(Be)){const Et=U.get("trackChanges"),Sn=Et?.token===h&&Et.hasSettled&&Array.isArray(Et.value)?Hl(Di(Et.value),y):null,_n=Gi>0?Sn:Be.story?Ve:xe;_n&&!_n.some(_r=>$i(_r,Be.id,Be.story))&&F(null)}const Ke=Ve??xe,qe=Lc(Ke,us(u)),We=nr===h?[]:y?u.activeChangeIds.filter(Et=>!y.has(Et)):u.activeChangeIds,Ge=We.map(Et=>qe.toPublicId(Et)??Et),st=Qe?.story?Lc(Ke,Qe.story):Ks(Ke),it=Qe?st.toPublicId(Qe.id)??Qe.id:null,Xe=jU({selectionIds:We,publicIds:Ge,selection:u,bodyItems:xe,allStoryItems:Ve}),It=it??Xe;return{status:Pl(ue,u.status),items:xe,total:xe.length,activeId:It,authors:ud(xe)}},jc=(u,h)=>{if(!H())return h;Ho("comments");const y=mr(),_=y.value??h.items;return{status:Pl(y.status,u.status),listStatus:y.status,items:_,total:_.length,activeIds:u.activeCommentIds,activeId:at??u.activeCommentIds[0]??null}},ph=(u,h)=>{if(!H())return h;Ho("trackChanges");const y=oa(),_=un(Re()),E=Hl(Di(y.value??h.items),_),P=Qe?.story?Lc(E,Qe.story):Ks(E),j=Qe?P.toPublicId(Qe.id)??Qe.id:h.activeId;return{status:Pl(y.status,u.status),items:E,total:E.length,activeId:j,authors:ud(E)}};let dd=null,fd=[];const Uc=(u,h)=>{const y=Re();return h==="ready"?(dd=y,fd=u,{items:u,status:h}):h==="pending"&&dd===y?{items:fd,status:"stale"}:{items:u,status:h}},mh=u=>{const h=b()?.contentControls,{value:y,status:_}=zr("contentControls",Re(),()=>h?.list?h.list():void 0,Be=>Be&&Array.isArray(Be.items)?Be.items:[]),E=y??[],{items:P,status:j}=Hc(h,u),re=new Map(P.map(Be=>[Be.id,Be])),ue=new Set(E.map(Be=>Be.id)),xe=[...E.map(Be=>re.get(Be.id)??Be),...P.filter(Be=>!ue.has(Be.id))],Ve=P.map(Be=>Be.id);return{status:Pl(_,j,u.status),items:xe,total:xe.length,activeId:Ve[0]??null,activeIds:Ve}},ws=(u,h)=>{if(!u||typeof u.listInRange!="function")return{lockModesById:new Map,rows:[],status:"ready"};const y=HU(h);if(!y)return{lockModesById:new Map,rows:[],status:"ready"};const{value:_,status:E}=zr(`contentControls:inRange:${jo(h)}`,Re(),()=>u.listInRange(y),re=>re&&Array.isArray(re.items)?re.items:[]),P=_??[],j=new Map;for(const re of P)typeof re?.id=="string"&&j.set(re.id,typeof re.lockMode=="string"?re.lockMode:"unlocked");return{lockModesById:j,rows:P,status:E}},Hc=(u,h)=>{const{rows:y,status:_}=ws(u,h),E=h.selectionTarget,P=h.target;let j=E?.start;if(E){if(E.kind!=="selection"||j?.kind!=="text"||typeof j.blockId!="string"||typeof j.offset!="number")return Uc([],_)}else{const Ge=P?.kind==="text"&&Array.isArray(P.segments)?P.segments[0]:void 0,st=Ge?.range;if(typeof Ge?.blockId!="string"||typeof st?.start!="number")return Uc([],_);j={kind:"text",blockId:Ge.blockId,offset:st.start,story:P?.story}}const re=(P?.coordinateSpace!=="tracked"&&Array.isArray(P?.segments)?P.segments:[]).find(Ge=>Ge.blockId===j.blockId),ue=re?.range,xe=re&&typeof re.blockId=="string"&&typeof ue?.start=="number"?{kind:"text",blockId:re.blockId,offset:ue.start,story:P?.story??j.story}:null,Ve=(E?E.coordinateSpace:P?.coordinateSpace)==="tracked"?"tracked":"visible",Be=Ve==="tracked"?xe:j,Ke=Fr(h),qe=Ke.indexOf((Be??j).blockId),We=y.map((Ge,st)=>({item:Ge,index:st})).filter(({item:Ge})=>{const st=Ge.selectionTarget,it=st?.coordinateSpace==="tracked"?"tracked":"visible";if(it==="tracked"&&Ve!=="tracked")return!1;const Xe=it==="tracked"?j:Be;if(!Xe)return!1;const It=st?.start,Et=st?.end;if(st?.kind!=="selection"||It?.kind!=="text"||Et?.kind!=="text"||typeof It.blockId!="string"||typeof Et.blockId!="string"||typeof It.offset!="number"||typeof Et.offset!="number"||tr(st.story??It.story??Et.story)!==tr(E?.story??Xe.story))return!1;if(It.blockId===Et.blockId){if(Xe.blockId!==It.blockId)return!1;const _r=Math.min(It.offset,Et.offset),Rr=Math.max(It.offset,Et.offset);return _r===Rr?Xe.offset===_r:Xe.offset>=_r&&Xe.offset<Rr}if(Xe.blockId===It.blockId)return Xe.offset>=It.offset;if(Xe.blockId===Et.blockId)return Xe.offset<Et.offset;if(qe===-1)return!1;const Sn=Ke.indexOf(It.blockId),_n=Ke.indexOf(Et.blockId);return Sn!==-1&&_n!==-1?qe>Math.min(Sn,_n)&&qe<Math.max(Sn,_n):Sn!==-1?qe>Sn:_n!==-1?qe<_n:!0}).sort((Ge,st)=>{const it=Ge.item.selectionTarget,Xe=st.item.selectionTarget,It=it.start.kind==="text"&&it.end.kind==="text"&&it.start.blockId===it.end.blockId,Et=Xe.start.kind==="text"&&Xe.end.kind==="text"&&Xe.start.blockId===Xe.end.blockId;if(It!==Et)return It?-1:1;if(Ge.item.kind!==st.item.kind)return Ge.item.kind==="inline"?-1:1;if(It&&Et&&it.start.kind==="text"&&it.end.kind==="text"&&Xe.start.kind==="text"&&Xe.end.kind==="text"){const Sn=Math.abs(it.end.offset-it.start.offset),_n=Math.abs(Xe.end.offset-Xe.start.offset);if(Sn!==_n)return Sn-_n}return st.index-Ge.index}).map(({item:Ge})=>Ge);return Uc(We,_)},hd=()=>{const u=t?.fonts;return{options:vH(mH(Lt(u?.getDocumentFontOptions?()=>u.getDocumentFontOptions():void 0,[])),gH(Lt(u?.getFontFamilyOptions?()=>u.getFontFamilyOptions():void 0,[]))),sizeOptions:yH}},$c=()=>{const u=Lt(t?.getZoomState?()=>t.getZoomState():void 0,null),h=typeof u?.value=="number"?u.value:100,y=u?.mode;return{mode:y==="manual"||y==="fit-width"?y:y==="fixed"?"manual":null,value:h,min:typeof u?.min=="number"?u.min:10,max:typeof u?.max=="number"?u.max:100}},Gc=()=>Lt(t?.getMeasurementUnit?()=>t.getMeasurementUnit():void 0,"in")==="cm"?"cm":"in",Wc=()=>{const u=S();return{ready:u!=null,mode:ir(),dirty:u?!!u.isDirty:!1}},Kc=u=>{const h=u.quotedText;if(typeof h!="string"||h.length===0)return null;const y=td(u);if(y.length===0||!Mc(y.map(P=>P.blockId)))return null;const _=u.target,E=y.length===1?_o(y[0].blockId,_?.story):void 0;return{select:{type:"text",pattern:h,mode:"contains",caseSensitive:!0},...E?{within:E}:{},require:"any"}},pd=u=>{const h=b()?.query;if(typeof h?.match!="function")return null;const y=Kc(u);if(!y)return null;const{value:_}=zr(`query:${jo(u)}`,Re(),()=>h.match(y),E=>E&&typeof E=="object"?E:null);return AI(_,u)},Gl=u=>{const h=B(),y=new Set(Fr(u));if(y.size===0)return{};const _=h?.readMountedProjectionBlocksByIds,E=h?.readMountedProjectionBlocks;if(typeof _!="function"&&typeof E!="function")return{};const P=Lt(()=>{if(typeof _!="function")return E.call(h);const Ge=ds(u);return Ge?_.call(h,[...y],Ge):_.call(h,[...y])},null);if(!Array.isArray(P))return{};const j=Qb(P),re=Ge=>{const st={},it=Xb(Ge.fontFamily);it&&(st.fontFamily=it);const Xe=eH(Ge.fontSize);return Xe&&(st.fontSize=Xe),typeof Ge.color=="string"&&Ge.color.trim()!==""&&(st.color=Ge.color.trim().toUpperCase()),typeof Ge.highlight=="string"&&Ge.highlight.trim()!==""&&(st.highlight=Ge.highlight.trim().toUpperCase()),st},ue=Ys(u),xe=ue&&typeof ue.range?.start=="number"?ue.range.start:null;if(ue&&xe!==null&&y.has(ue.blockId)){const Ge=j.find(it=>Dc(it,ue.blockId)),st=Ge&&Array.isArray(Ge.runs)?Ge.runs:null;if(st&&st.length>0&&st.every(it=>it?.kind==="text"||it?.kind==="tab")){let it=0,Xe=null;for(const It of st){const Et=qm(It);if(xe>=it&&xe<it+Et){Xe=It;break}it+=Et}if(!Xe){for(let It=st.length-1;It>=0&&!Xe;It-=1)st[It]?.kind==="text"&&(Xe=st[It]);Xe??=st[st.length-1]??null}return Xe?re(Xe):{}}}const Ve=td(u);if(Ve.length>0){const Ge=new Set,st=new Set;let it=!1,Xe=!0;for(const It of Ve){const Et=j.find(_r=>Dc(_r,It.blockId));if(!Et)return{};const Sn=Array.isArray(Et.runs)?Et.runs:[];if(Sn.length===0)continue;if(!Sn.every(_r=>_r?.kind==="text"||_r?.kind==="tab")){Xe=!1;break}let _n=0;for(const _r of Sn){const Rr=qm(_r),Lr=_n,jr=_n+Rr;if(Lr<It.end&&jr>It.start){it=!0;const ci=re(_r);ci.fontFamily&&Ge.add(ci.fontFamily),ci.fontSize&&st.add(ci.fontSize)}_n=jr}}if(Xe&&it){const It={};return Ge.size===1&&(It.fontFamily=[...Ge][0]),st.size===1&&(It.fontSize=[...st][0]),It}}const Be=new Set,Ke=new Set;let qe=!1;for(const Ge of j){if(![...y].some(it=>Dc(Ge,it)))continue;const st=Array.isArray(Ge.runs)?Ge.runs:[];for(const it of st){if(it?.kind!=="text")continue;qe=!0;const Xe=re(it);Xe.fontFamily&&Be.add(Xe.fontFamily),Xe.fontSize&&Ke.add(Xe.fontSize)}}if(!qe)return{};const We={};return Be.size===1&&(We.fontFamily=[...Be][0]),Ke.size===1&&(We.fontSize=[...Ke][0]),We},gh=u=>{const h=B(),y=new Set(Fr(u));if(y.size===0)return{};const _=h?.readMountedProjectionBlocksByIds,E=h?.readMountedProjectionBlocks;if(typeof _!="function"&&typeof E!="function")return{};const P=Lt(()=>{if(typeof _!="function")return E.call(h);const We=ds(u);return We?_.call(h,[...y],We):_.call(h,[...y])},null);if(!Array.isArray(P))return{};const j=Qb(P),re=We=>({bold:We.bold===!0,italic:We.italic===!0,underline:We.underline!=null,strikethrough:We.strike===!0}),ue=We=>{const Ge={};for(const st of fh){const it=We[st];it.size===1&&(Ge[st]=[...it][0])}return Ge},xe=Ys(u),Ve=xe&&typeof xe.range?.start=="number"?xe.range.start:null;if(xe&&Ve!==null&&y.has(xe.blockId)){const We=j.find(st=>Dc(st,xe.blockId)),Ge=We&&Array.isArray(We.runs)?We.runs:null;if(Ge&&Ge.length>0&&Ge.every(st=>st?.kind==="text"||st?.kind==="tab")){let st=0,it=null;for(const Xe of Ge){const It=qm(Xe);if(Ve>=st&&Ve<st+It){it=Xe;break}st+=It}if(!it){for(let Xe=Ge.length-1;Xe>=0&&!it;Xe-=1)Ge[Xe]?.kind==="text"&&(it=Ge[Xe]);it??=Ge[Ge.length-1]??null}return it?re(it):{}}}const Be=td(u);if(Be.length>0){const We={bold:new Set,italic:new Set,underline:new Set,strikethrough:new Set};let Ge=!1,st=!0;for(const it of Be){const Xe=j.find(Sn=>Dc(Sn,it.blockId));if(!Xe)return{};const It=Array.isArray(Xe.runs)?Xe.runs:[];if(It.length===0)continue;if(!It.every(Sn=>Sn?.kind==="text"||Sn?.kind==="tab")){st=!1;break}let Et=0;for(const Sn of It){const _n=qm(Sn),_r=Et,Rr=Et+_n;if(_r<it.end&&Rr>it.start){Ge=!0;const Lr=re(Sn);for(const jr of fh)We[jr].add(Lr[jr])}Et=Rr}}if(st&&Ge)return ue(We)}const Ke={bold:new Set,italic:new Set,underline:new Set,strikethrough:new Set};let qe=!1;for(const We of j){if(![...y].some(st=>Dc(We,st)))continue;const Ge=Array.isArray(We.runs)?We.runs:[];for(const st of Ge){if(st?.kind!=="text")continue;qe=!0;const it=re(st);for(const Xe of fh)Ke[Xe].add(it[Xe])}}return qe?ue(Ke):{}},md=(u,h)=>{if(h.fontFamily!==void 0&&h.fontSize!==void 0&&h.color!==void 0&&h.highlight!==void 0)return{values:h,effectiveUniformityStatus:"ready"};const y=Gl(u),_={...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}:{},...h};if(!u.empty&&(_.fontFamily===void 0||_.fontSize===void 0)){const E=yd(u);return E.values&&(_.fontFamily===void 0&&E.values.fontFamily!==void 0&&(_.fontFamily=E.values.fontFamily),_.fontSize===void 0&&E.values.fontSize!==void 0&&(_.fontSize=E.values.fontSize)),{values:_,effectiveUniformityStatus:E.status}}return{values:_,effectiveUniformityStatus:"ready"}},gd=["fontFamily","fontSize","bold","italic","underline","strikethrough"],vd=u=>{const h=u.selectionTarget;if(!h)return{value:null,status:"ready"};const y=wr(b(),"format.readEffectiveInlineUniformity");if(!y)return{value:null,status:"ready"};const _=_I(u)??jo(u);return zr(`effInline:${_}`,Re(),()=>y({target:h,offsetSpace:"selection",keys:gd}),E=>E&&typeof E=="object"?E:null)},yd=u=>{const{value:h,status:y}=vd(u);if(!h||h.success!==!0)return{values:null,status:y};const _=h.values,E=P=>{const j=_?.[P];if(!(!j||j.state!=="uniform"||typeof j.value!="string"))return P==="fontFamily"?Xb(j.value):j.value};return{values:{fontFamily:E("fontFamily"),fontSize:E("fontSize")},status:y}},bd=u=>{const{value:h,status:y}=vd(u);if(!h||h.success!==!0)return{values:null,status:y};const _=h.values,E={};for(const P of fh){const j=_?.[P];j?.state==="uniform"&&(j.value==="true"||j.value==="false")&&(E[P]=j.value==="true")}return{values:E,status:y}},vh=(u,h)=>{const y=u.activeMark;if(!y||!fh.includes(y))return null;const _=y,E=gh(h)[_];if(E!==void 0)return E;const{values:P}=bd(h),j=P?.[_];return j!==void 0?j:null},wd=async u=>{const h=u.selectionTarget;if(!h)return null;const y=wr(b(),"format.readEffectiveInlineUniformity");if(!y)return null;try{const _=await Promise.resolve(y({target:h,offsetSpace:"selection"}));return _&&typeof _=="object"&&_.success===!0?_:null}catch{return null}},Cd=(u,h,y)=>{const _=y.values;for(const E of["fontFamily","fontSize"]){if(h[E]!==void 0)continue;const P=_?.[E];P?.state==="uniform"&&typeof P.value=="string"?u[E]=E==="fontFamily"?Xb(P.value):P.value:delete u[E]}},$o=u=>md(u,II(pd(u),u)),Xa=u=>$o(u).values,qc=async u=>{const h=b()?.query,y=Kc(u);if(typeof h?.match!="function"||!y)return Xa(u);try{const _=await Promise.resolve(h.match(y)),E=II(AI(_&&typeof _=="object"?_:null,u),u),P=md(u,E);if(P.effectiveUniformityStatus!=="ready"&&(E.fontFamily===void 0||E.fontSize===void 0)){const j=await wd(u);j&&Cd(P.values,E,j)}return P.values}catch{return Xa(u)}},Wl=async u=>{const h=b();if(h)return typeof h.getNode=="function"?await Promise.resolve(h.getNode(u)):await Promise.resolve(h.getNodeById?.({nodeId:u.nodeId,nodeType:u.nodeType}))},Yc=u=>{const h=b()?.query;if(typeof h?.match!="function")return"ready";const y=Kc(u);if(!y)return"ready";const{status:_}=zr(`query:${jo(u)}`,Re(),()=>h.match(y),E=>E&&typeof E=="object"?E:null);return _},Za=u=>{const h=$o(u),y=h.values;if(u.empty)return h;const _=$a(u);return _?u.status==="ready"&&Yc(u)==="ready"&&h.effectiveUniformityStatus==="ready"?(C={key:_,values:y},h):C&&C.key===_?{...h,values:{...C.values,...y}}:h:h},yh=u=>{const h=b(),y=Za(u),_=y.values;u.status==="ready"&&!u.empty&&Yc(u)==="ready"&&y.effectiveUniformityStatus==="ready"&&(v=_,k=`${xc(u)}:${Re()}`);const E=h?.contentControls,{lockModesById:P}=ws(E,u),j={};for(const re of ri())j[re]=I(re,h,u,_,P);return j},xo=u=>u?lt.operationUnavailable:S()?lt.documentApiUnavailable:lt.notReady,Ro=u=>u==="contentLocked"||u==="sdtContentLocked",Cs=u=>{for(const h of u.values())if(Ro(h))return lt.contentControlLocked},Xc=(u,h,y,_,E)=>{if(!h)return u.scope==="all"?lt.bulkDecisionsDisabled:xo(E);if(y)return y;if(u.scope!=="all"&&_.activeChangeIds.length===0)return lt.selectionRequired},kd=u=>{const h=O?.trackChanges?.items?.find(j=>Kr(j)===u);if(h)return rd(h);const y=Lt(()=>b()?.trackChanges?.list?.(),null);if(!y||typeof y!="object"||typeof y.then=="function")return null;const _=y.items;if(!Array.isArray(_))return null;const E=_.find(j=>Kr(j)===u);if(!E)return null;const P=nd(E);return P?rd(P):E},ks=(u,h)=>{const y=t.canPerformPermission;if(typeof y!="function"||h.length===0)return;const _=t.config&&typeof t.config=="object"?t.config.user:null;for(const E of h){const P=kd(E)??{id:E},j=FU(P,_),re=u==="accept"?j?"RESOLVE_OWN":"RESOLVE_OTHER":j?"REJECT_OWN":"REJECT_OTHER";let ue;try{ue=y.call(t,{permission:re,trackedChange:P,comment:null})}catch{return}if(ue===!1)return lt.permissionDenied}},ia=u=>{const h=B(),y=Lt(typeof h?.getCapabilities=="function"?()=>h.getCapabilities():void 0,null)?.editableSubset?.commands;if(Array.isArray(y))return y.find(_=>_?.command===u||_?.id===u)??null;if(y&&typeof y=="object"){const _=y[u];return _&&typeof _=="object"?_:null}return null},Sd=(u,h)=>{if(u.scope!=="all"||typeof h?.[`${u.kind}All`]=="function")return;const y=ia(`trackedChanges.${u.kind}All`);if(!(y&&(y.status==="supported"||y.enabled===!0)))return lt.bulkDecisionsDisabled},I=(u,h,y,_,E=new Map)=>{if(Ze.has(u))return Jt({supported:!0,enabled:!0,...Lt(Ze.get(u).getState?()=>Ze.get(u).getState(Fc(void 0)):void 0,{})},"custom");const P=ir()==="viewing",j=pI(u);if(j&&typeof X()?.lists?.apply=="function"){const qe=ce(),We=typeof qe?.shippedStatus=="string"?qe.shippedStatus:null,Ge=We!=="not-shipped"&&We!=="disabled",st=Ge&&(typeof qe?.enabled=="boolean"?qe.enabled:!0),it=Ge?be(qe):null;return Jt(P?{enabled:!1,active:it===j,supported:Ge,value:qe?.value,reason:lt.documentReadonly}:{enabled:st,active:it===j,supported:Ge,value:qe?.value},"builtin")}const re=Ym(u);if(re){const qe=h?.trackChanges,We=typeof qe?.decide=="function"||typeof qe?.[re.kind]=="function",Ge=typeof qe?.decide=="function"||typeof qe?.[`${re.kind}All`]=="function",st=re.scope==="all"?Ge:We,it=Sd(re,qe)??Xc(re,st,Bc(),y,h)??(re.scope==="all"?void 0:ks(re.kind,y.activeChangeIds));return Jt({enabled:it==null,active:!1,supported:st,reason:it},"builtin")}if(u==="copy-format")return ir()==="viewing"?Jt({supported:!0,enabled:!1,active:!1},"builtin"):S()?Jt({supported:!0,enabled:!0,active:p.mode!=="idle"},"builtin"):Jt({supported:!0,enabled:!1,active:!1,reason:lt.notReady},"builtin");const ue=Xu(u);if(!ue)return Jt({enabled:!1,active:!1,supported:!1,reason:lt.commandUnsupported},"unsupported");if(ue.disposition!=="routed")return Jt({enabled:!1,active:!1,supported:!1,reason:ue.reason??lt.commandUnsupported},ue.disposition==="unsupported"?"unsupported":"builtin");if(ue.instanceRoute)return Zi(ue);if(ue.table)return ut(ue,h,P);if(ue.inline?.kind==="clear"){if(ue.mutates&&P)return Jt({enabled:!1,active:!1,supported:!0,reason:lt.documentReadonly},"builtin");const qe=Cs(E);if(qe)return Jt({enabled:!1,active:!1,supported:!0,reason:qe},"builtin");const We=Fr(y).length>0||od(y)!=null;return Jt({enabled:We,active:!1,supported:!0,reason:We?void 0:lt.selectionRequired},"builtin")}const xe=ue.docRoute;if(!xe)return Jt({enabled:!1,active:!1,supported:!1,reason:lt.commandUnsupported},"unsupported");if(wr(h,xe)==null)return Jt({enabled:!1,active:!1,supported:!1,reason:xo(h)},"builtin");const Ve=ve(u);if(Ve){const qe=Ve.shippedStatus,We=qe!=="not-shipped"&&qe!=="disabled",Ge=typeof Ve.enabled=="boolean"?Ve.enabled:!0,st=u==="undo"||u==="redo",it=st&&Ve.historyResolved===!1,Xe=st&&We&&Ge===!1&&Ve.reason===null&&!it,It=Ve.reason===void 0?void 0:Xe?lt.historyEmpty:it?lt.notReady:$m(Ve.reason,lt.commandUnsupported);return ue.mutates&&P?Jt({enabled:!1,active:!1,supported:We,reason:lt.documentReadonly},"builtin"):Jt({enabled:We&&Ge,active:!1,supported:We,reason:It},"builtin")}const Be=le(ue,h,y),Ke=ae(ue,h,y,_);if(ue.list?.mode==="indent"||ue.list?.mode==="outdent")return kr(ue,h,P,y,Be,Ke);if(ue.list?.mode==="toggle-seed")return so(ue,h,P,y,Be,Ke);if(ue.mutates&&P)return Jt({enabled:!1,active:Be,supported:!0,value:Ke,reason:lt.documentReadonly},"builtin");if(ue.inline&&!od(y)){const qe=Cs(E);return Jt(qe?{enabled:!1,active:Be,supported:!0,value:Ke,reason:qe}:Fr(y).length>0&&typeof B()?.setPendingInlineFormat=="function"?{enabled:!0,active:Be,supported:!0,value:Ke}:{enabled:!1,active:Be,supported:!0,value:Ke,reason:lt.rangeSelectionRequired},"builtin")}if((ue.blockParagraph||ue.list)&&Fr(y).length===0)return Jt({enabled:!1,active:Be,supported:!0,value:Ke,reason:lt.selectionRequired},"builtin");if(ue.link&&!Be&&qb(y).length===0&&!Ys(y))return Jt({enabled:!1,active:Be,supported:!0,reason:lt.rangeSelectionRequired},"builtin");if(ue.inline){const qe=Cs(E);if(qe)return Jt({enabled:!1,active:Be,supported:!0,value:Ke,reason:qe},"builtin")}return Jt({enabled:!0,active:Be,supported:!0,value:Ke},"builtin")};function M(u,h){const y=u.address?.anchor,_=y?.start,E=y?.end,P=typeof _?.blockId=="string"?_.blockId:null,j=typeof E?.blockId=="string"?E.blockId:null;if(!P||!j)return!1;const re=typeof _?.offset=="number"?_.offset:null,ue=typeof E?.offset=="number"?E.offset:null;if(re==null||ue==null)return!1;const xe=h.target,Ve=xe&&Array.isArray(xe.segments)?xe.segments:[];for(const Be of Ve){const Ke=typeof Be?.blockId=="string"?Be.blockId:null;if(!Ke)continue;const qe=Be.range,We=typeof qe?.start=="number"?qe.start:null,Ge=typeof qe?.end=="number"?qe.end:null;if(!(We==null||Ge==null)){if(P!==j){if(Ke===P&&Ge>re||Ke===j&&We<ue)return!0;continue}if(Ke===P){if(We===Ge){if(We>=re&&We<=ue)return!0;continue}if(Math.max(We,re)<Math.min(Ge,ue))return!0}}}return!1}const J=(u,h)=>{const y=u?.hyperlinks;if(!y||typeof y.list!="function")return null;const _=Fr(h);if(!Mc(_))return null;for(const E of _){const P={kind:"block",nodeType:"paragraph",nodeId:E},{value:j}=zr(`hyperlinks:${E}`,Re(),()=>y.list({within:P}),ue=>ue&&typeof ue=="object"?ue:null),re=(j&&Array.isArray(j.items)?j.items:[]).find(ue=>M(ue,h));if(re)return re}return null},le=(u,h,y)=>{if(u.link)return J(h,y)!=null;if(u.list?.mode==="toggle-seed"&&u.list.seed)return Oe(h,y)===u.list.seed;const _=K(u);if(_!==null)return _;const E=r.get(u.id),P=$a(y);if(P&&E?.selectionSignature===P)return E.active;const j=vh(u,y);return j!==null?j:bH(u,y)},ae=(u,h,y,_)=>{if(u.inline&&Yb(u.inline.key)){const E=x(u);if(E!==void 0)return E;const P=_[u.inline.key];if(P!==void 0)return P;const j=$a(y),re=j?n.get(u.inline.key):void 0;if(j&&re?.selectionSignature===j)return re.value}if(u.id==="linked-style"){const{style:E}=Qa(y,oi().cache);return!E.styleId||E.mixed?void 0:{styleId:E.styleId,styleName:E.styleName}}if(u.id==="text-align")return Vt(h,y);if(u.id==="link")return bo(h,y)??void 0},pe=(u,h,y)=>{const _=u?.lists;if(!_)return{value:null,status:"ready"};const E=y.storyType==="body",P=typeof _.getStateInStory=="function"?()=>_.getStateInStory({target:Ha(h),story:y}):E&&typeof _.getState=="function"?()=>_.getState({target:Ha(h)}):null;if(!P)return{value:null,status:"ready"};const{value:j,status:re}=zr(`lists:${tr(y)}:${h}`,Re(),P,ue=>ue&&typeof ue=="object"?ue:null);return{value:j?.success===!0?j:null,status:re}},fe=(u,h,y)=>pe(u,h,y).value,he=(u,h,y)=>{const _=fe(u,h,y);return!_||_.isListItem!==!0?null:_.seed==="bullet"||_.seed==="ordered"?_.seed:null},ke=(u,h,y)=>{const _=pe(u,h,y),E=_.value;return{value:E&&typeof E.isListItem=="boolean"?E.isListItem:null,status:_.status}},Oe=(u,h)=>{const y=Fr(h);if(y.length===0||!Mc(y))return null;const _=us(h),E=he(u,y[0],_);if(E!=="bullet"&&E!=="ordered")return null;for(const P of y.slice(1))if(he(u,P,_)!==E)return null;return E},je=(u,h,y)=>{if(!u)return{value:null,status:"ready",refreshing:!1};const _=tr(y),E=_==="story:body";if(E&&typeof u.getNodeById!="function")return{value:null,status:"ready",refreshing:!1};if(!E&&typeof u.getNode!="function")return{value:null,status:"ready",refreshing:!1};const P=`node:${_}:${h}`,j=Re(),re=zr(P,j,()=>E?u.getNodeById({nodeId:h,nodeType:"paragraph"}):u.getNode(_o(h,y)),xe=>xe&&typeof xe=="object"?xe:null),ue=U.get(P);return{...re,refreshing:re.status==="stale"&&ue?.inflightToken===j&&ue.failedToken!==j}},Le=u=>u==="left"||u==="center"||u==="right"||u==="justify"?u:void 0,nt=u=>u==="start"||u==="end"||u==="distributed"||u==="numTab"||u==="lowKashida"||u==="mediumKashida"||u==="highKashida"||u==="thaiDistribute",ct=(u,h)=>{const y=B(),_=y?.readMountedProjectionBlocksByIds;if(typeof _!="function")return null;const E=ds(u),P=Lt(()=>E?_.call(y,[...h],E):_.call(y,[...h]),null);if(!Array.isArray(P))return new Map;const j=Qb(P),re=new Map;for(const ue of h){const xe=j.find(qe=>Dc(qe,ue));if(!xe)continue;const Ve=xe.attrs,Be=Le(Ve?.alignment),Ke=qM(Ve);re.set(ue,Be??(Ke==="rtl"?"right":"left"))}return re},ot=(u,h,y,_)=>{const{value:E,status:P,refreshing:j}=je(u,h,y),re=_?.get(h);if(P==="pending")return re?{status:"uniform",value:re}:{status:"pending"};if(P==="stale"&&!j)return{status:"pending"};if(P==="stale"&&re)return{status:"uniform",value:re};if(P==="stale"&&_&&!re)return{status:"unavailable"};if(!E)return{status:"unavailable"};const ue=E.node;if(!ue)return{status:"unavailable"};const xe=ue.kind;if(xe!=="paragraph"&&xe!=="heading")return{status:"unavailable"};const Ve=ue[xe];if(!Ve||typeof Ve!="object")return{status:"unavailable"};const Be=Ve.props?.alignment;if(Be==null)return re?{status:"uniform",value:re}:{status:"unavailable"};const Ke=Le(Be);return Ke?{status:"uniform",value:Ke}:nt(Be)&&re?{status:"uniform",value:re}:{status:"unavailable"}},bt=(u,h)=>{const y=Fr(h);if(y.length===0||!Mc(y))return{status:"unavailable"};const _=us(h),E=ct(h,y),P=ot(u,y[0],_,E);if(P.status!=="uniform")return P;for(const j of y.slice(1)){const re=ot(u,j,_,E);if(re.status!=="uniform")return re;if(re.value!==P.value)return{status:"mixed"}}return P},ft=u=>{const h=Fr(u);return h.length===0?null:`${tr(us(u))}:${h.join(",")}`},Vt=(u,h)=>{const y=bt(u,h),_=y.status==="uniform"?y.value:void 0,E=o;if(!E)return _;const P=ft(h);return P&&P!==E.selectionSignature?(o=null,_):!P||!E.settled?E.value:y.status!=="pending"?(o=null,_):E.value},On=(u,h)=>{const y=Le(h),_=ft(u),E=Fr(u);if(!y||!_||E.length===0)return null;const P=++i;return o={selectionSignature:_,value:y,generation:P,settled:!1,canReconcile:Mc(E)},de(),P},xr=(u,h)=>{if(u==null)return;const y=o;if(!(!y||y.generation!==u)){if(!Ao(h)){o=null;return}if(!y.canReconcile){o=null;return}y.settled=!0}},jt=async(u,h,y)=>{const _=u?.lists;if(!_)return null;try{const E=y.storyType==="body",P=typeof _.getStateInStory=="function"?await _.getStateInStory({target:Ha(h),story:y}):E&&typeof _.getState=="function"?await _.getState({target:Ha(h)}):null,j=P&&typeof P=="object"?P:null;return!j||j.success!==!0||typeof j.isListItem!="boolean"?null:j.isListItem}catch{return null}},Pn=(u,h,y)=>{const _={resolved:!1,seed:null},E=u?.lists;if(!E)return _;const P=y.storyType==="body",j=typeof E.getStateInStory=="function"?()=>E.getStateInStory({target:Ha(h),story:y}):P&&typeof E.getState=="function"?()=>E.getState({target:Ha(h)}):null;if(!j)return _;const re=ue=>{const xe=ue&&typeof ue=="object"?ue:null;return!xe||xe.success!==!0||typeof xe.isListItem!="boolean"?_:{resolved:!0,seed:xe.isListItem===!0&&(xe.seed==="bullet"||xe.seed==="ordered")?xe.seed:null}};try{const ue=j();return Pr(ue)?Promise.resolve(ue).then(re,()=>_):re(ue)}catch{return _}},kn=async(u,h,y)=>{if(!u)return null;try{const _=!y||y.storyType==="body",E=y&&typeof u.getNode=="function"?await u.getNode(_o(h,y)):_&&typeof u.getNodeById=="function"?await u.getNodeById({nodeId:h,nodeType:"paragraph"}):null;return GU(E&&typeof E=="object"?E:null)}catch{return null}},kr=(u,h,y,_,E,P)=>{if(u.mutates&&y)return Jt({enabled:!1,active:E,supported:!0,value:P,reason:lt.documentReadonly},"builtin");const j=Fr(_);if(j.length===0)return Jt({enabled:!1,active:E,supported:!0,value:P,reason:lt.selectionRequired},"builtin");const re=u.docRoute?wr(h,u.docRoute):null,ue=wr(h,"format.paragraph.setIndentation"),xe=wr(h,"format.paragraph.clearIndentation"),Ve=u.list?.mode,Be=Ve==="indent"?ue!=null:ue!=null||xe!=null,Ke=us(_);let qe=null;if(Ke.storyType!=="body"){qe=[];for(const We of j){const{value:Ge,status:st}=ke(h,We,Ke);if(Ge===null)return st!=="ready"&&(re!=null||Be)?Jt({enabled:!0,active:E,supported:!0,value:P},"builtin"):Jt({enabled:!1,active:E,supported:!1,value:P,reason:xo(h)},"builtin");qe.push(Ge)}}if(qe?.some(We=>We===!0)){const We=Ve==="indent"?"lists.indentRange":"lists.outdentRange",Ge=ir()!=="suggesting"&&qe.every(it=>it===!0)&&wr(h,We)!=null,st=Ve==="outdent"&&wr(h,"lists.outdentInStory")!=null;if(!Ge&&!st)return Jt({enabled:!1,active:E,supported:!1,value:P,reason:xo(h)},"builtin")}for(const[We,Ge]of j.entries()){const st=qe?{value:qe[We]??null,status:"ready"}:ke(h,Ge,Ke),it=st.value;if(it===!0){if(re!=null)return Jt({enabled:!0,active:E,supported:!0,value:P},"builtin");continue}if(it===!1&&Be){if(Ke.storyType!=="body"&&typeof h?.getNode!="function")continue;return Jt({enabled:!0,active:E,supported:!0,value:P},"builtin")}if(it===null)return st.status!=="ready"&&(re!=null||Be)?Jt({enabled:!0,active:E,supported:!0,value:P},"builtin"):Jt({enabled:!1,active:E,supported:!1,value:P,reason:xo(h)},"builtin")}return Jt({enabled:!1,active:E,supported:!1,value:P,reason:xo(h)},"builtin")},so=(u,h,y,_,E,P)=>{if(u.mutates&&y)return Jt({enabled:!1,active:E,supported:!0,value:P,reason:lt.documentReadonly},"builtin");const j=Fr(_);if(j.length===0)return Jt({enabled:!1,active:E,supported:!0,value:P,reason:lt.selectionRequired},"builtin");const re=us(_),ue=h?.lists;if(!(typeof ue?.getStateInStory=="function"||re.storyType==="body"&&typeof ue?.getState=="function"))return Jt({enabled:!1,active:E,supported:!1,value:P,reason:lt.operationUnavailable},"builtin");if(!Mc(j))return Jt(re.storyType==="body"&&wr(h,"lists.remove")!=null?{enabled:!0,active:E,supported:!0,value:P}:{enabled:!1,active:E,supported:!1,value:P,reason:lt.operationUnavailable},"builtin");const xe=j.map(qe=>pe(h,qe,re));if(xe.some(({status:qe})=>qe!=="ready"))return Jt({enabled:!0,active:E,supported:!0,value:P},"builtin");if(xe.some(({value:qe})=>qe===null))return Jt({enabled:!1,active:E,supported:!1,value:P,reason:lt.operationUnavailable},"builtin");const Ve=u.list?.seed,Be=xe.every(({value:qe})=>qe?.isListItem===!0&&qe.seed===Ve);if(re.storyType==="body")return Jt(!Be||wr(h,"lists.remove")!=null?{enabled:!0,active:E,supported:!0,value:P}:{enabled:!1,active:E,supported:!1,value:P,reason:lt.operationUnavailable},"builtin");const Ke=wr(h,"lists.removeInStory");return Jt(Be&&Ke?{enabled:!0,active:E,supported:!0,value:P}:{enabled:!1,active:E,supported:!1,value:P,reason:lt.operationUnavailable},"builtin")},bo=(u,h)=>{const y=J(u,h)?.properties?.href;return typeof y=="string"?y:null},Zi=u=>{if(!S())return Jt({enabled:!1,active:!1,supported:!1,reason:lt.notReady},"builtin");const h=u.instanceRoute;return typeof t?.[h]!="function"?Jt({enabled:!1,active:!1,supported:!1,reason:lt.operationUnavailable},"builtin"):Jt({enabled:!0,active:ni(u),supported:!0,value:yn(u)},"builtin")},ni=u=>{const h=t?.config??void 0;return u.valueFrom==="ruler"?!!h?.rulers:u.valueFrom==="formattingMarks"?!!h?.layoutEngineOptions?.showFormattingMarks:!1},ut=(u,h,y)=>{if(y)return Jt({enabled:!1,active:!1,supported:!0,reason:lt.documentReadonly},"builtin");const _=Pe();return _!=null&&(!u.table.requiresCell||_.cellNodeId!=null)?(u.docRoute?wr(h,u.docRoute):null)==null?Jt({enabled:!1,active:!1,supported:!1,reason:xo(h)},"builtin"):Jt({enabled:!0,active:!1,supported:!0},"builtin"):Jt({enabled:!1,active:!1,supported:!0,reason:lt.tableContextUnavailable},"builtin")},yn=u=>{if(u.valueFrom==="zoom")return $c().value;if(u.valueFrom==="documentMode")return ir();if(u.valueFrom==="measurementUnit")return Gc();if(u.valueFrom==="ruler"||u.valueFrom==="formattingMarks")return ni(u)},Lo=(u,h)=>u.id==="zoom"?typeof h=="number"&&Number.isFinite(h)&&h>0:u.id==="document-mode"?h==="editing"||h==="suggesting"||h==="viewing":u.id==="measurement-unit"?h==="in"||h==="cm":!0,ri=()=>[...new Set([...xz,...Ze.keys()])],sa="Normal",wo={ready:!1,status:"ready",catalogRevision:null,quickGallery:[],activeParagraphStyleId:null,activeParagraphStyleName:null,mixedSelection:!1,sourceStatus:null,diagnostics:[]},vi=u=>`styles:catalog:${JSON.stringify(u??{})}`,Qi=u=>{const h=b()?.styles;return!h||typeof h.getCatalog!="function"?{value:null,status:"ready"}:zr(vi(u),Re(),()=>h.getCatalog(u),y=>y&&typeof y=="object"?y:null)},oi=()=>{const u=Qi({includePreview:!0});if(!u.value)return{cache:null,status:u.status};const h=Qi({view:"quickGallery",includePreview:!0}),y=h.value?h.value.items:u.value.styles.filter(E=>E.visibility.quickGallery),_=new Map;for(const E of u.value.styles)_.set(E.id,E);return{cache:{full:u.value,quickGallery:y,byId:_},status:Pl(u.status,h.status)}},Ss=(u,h,y)=>{const{value:_,status:E}=je(u,h,y);if(!_)return{ok:!1,styleRef:null,status:E};const P=_.node;if(!P||typeof P!="object")return{ok:!1,styleRef:null,status:E};const j=P.kind,re=typeof j=="string"?P[j]:void 0,ue=re&&typeof re=="object"?re.styleRef:void 0;return{ok:!0,styleRef:typeof ue=="string"&&ue.length>0?ue:null,status:E}},Qa=(u,h)=>{const y=[],_=b();if(!_)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 E=Fr(u);if(E.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(!Mc(E))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 P=h?.full.defaults.paragraphStyleId??(h?sa:null),j=new Set;let re=0,ue=0,xe=0,Ve="ready";const Be=us(u);for(const We of E){const Ge=Ss(_,We,Be);if(Ve=Pl(Ve,Ge.status),!Ge.ok){ue+=1;continue}if(!Ge.styleRef&&!P){xe+=1;continue}const st=Ge.styleRef??P;if(!st){xe+=1;continue}re+=1,j.add(st)}if(re===0){const We=xe>0&&ue===0;return y.push({severity:"warning",code:We?"active-style-default-unavailable":"active-style-read-failed",message:We?"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:Ve}}const Ke=ue+xe;if(Ke>0)return y.push({severity:"warning",code:"active-style-partial",message:`Active paragraph style resolved from ${re} of ${re+Ke} selected blocks; ${Ke} could not be read, so the active style is unavailable.`}),{style:{styleId:null,styleName:null,mixed:!1,diagnostics:y},status:Ve};if(j.size>1)return{style:{styleId:null,styleName:null,mixed:!0,diagnostics:y},status:Ve};const qe=[...j][0];return{style:{styleId:qe,styleName:h?.byId.get(qe)?.name??null,mixed:!1,diagnostics:y},status:Ve}},Kl=u=>{if(!S())return wo;const{cache:h,status:y}=oi(),{style:_,status:E}=Qa(u,h);let P;return h?P=_.diagnostics.length===0?h.full.diagnostics:[...h.full.diagnostics,..._.diagnostics]:P=[{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)."},..._.diagnostics],{ready:!0,status:Pl(y,E,u.status),catalogRevision:h?.full.revision??null,quickGallery:h?.quickGallery??[],activeParagraphStyleId:_.styleId,activeParagraphStyleName:_.styleName,mixedSelection:_.mixed,sourceStatus:h?.full.sourceStatus??null,diagnostics:P}},Ji=(u="direct")=>{const{sink:h}=Hm(),y=h?Ua():0,_={},E=(xe,Ve)=>{if(!h)return Ve();const Be=Ua();try{return Ve()}finally{_[xe]=Ua()-Be}},P=E("documentMode",ir),j=E("selection",ys);j.status==="ready"&&Li(j),Q(j);const re=$a(j);for(const[xe,Ve]of r)(!re||Ve.selectionSignature!==re||Ve.settled&&j.status==="ready")&&r.delete(xe);const ue={ready:S()!=null,documentMode:P,document:E("document",Wc),selection:j,toolbar:{context:P,commands:E("toolbarCommands",()=>yh(j)),copyFormatActive:p.mode!=="idle"},comments:E("comments",()=>Vc(j)),trackChanges:E("trackChanges",()=>$l(j)),contentControls:E("contentControls",()=>mh(j)),zoom:E("zoom",$c),fonts:E("fonts",hd),styles:E("styles",()=>Kl(j))};if(h){const xe=Ua();$b({stage:"superdoc-ui-compute-state",atMs:xe,reason:u,startedAtMs:y,completedAtMs:xe,durationMs:xe-y,phaseMs:_,asyncReadSettlements:Ft.splice(0)})}return ue},Ja=u=>{const h=$a(u);h&&a&&h!==a&&(n.clear(),r.clear()),h&&(a=h)};let Go=null,Mo=null,_s=null,Do=null,ii=null,Oi=null,Pi=!1;const _d=()=>{if(V||Pi)return;Pi=!0;const u=()=>{Pi&&(Pi=!1,!V&&de())};typeof queueMicrotask=="function"?queueMicrotask(u):Promise.resolve().then(u)},ql=()=>{const u=X();if(u!==_s&&(Do&&(Do(),Do=null),_s=u,!(!u||typeof u.subscribe!="function")))try{const h=u.subscribe(()=>_d());typeof h=="function"&&(Do=h)}catch{_s=null}},el=()=>{const u=L();if(u!==ii&&(Oi&&(Oi(),Oi=null),ii=u,!(!u||typeof u.subscribe!="function")))try{const h=u.subscribe(()=>de());typeof h=="function"&&(Oi=h)}catch{ii=null}};let si=null,ai=null,Yl=null,As=null,Xl=null,Ot=null;const Wn=()=>{const u=S()?.host,h=Lt(u?.getHandles?()=>u.getHandles():void 0,null)?.editing?.selection;return h&&typeof h.subscribe=="function"?h:null},Vr=()=>{const u=B(),h=u?.readLiveSelectionSyncSnapshot;if(typeof h!="function")return!1;const y=qi(Lt(()=>h.call(u),null));if(!y||!ld(y))return!1;const _=vs(y,"ready"),E=Ys(O.selection),P=Ys(_);if(E&&P&&E.blockId===P.blockId&&tr(E.story)===tr(P.story))return!1;const j=Gl(_),re=O.toolbar.commands["font-family"]?.value,ue=O.toolbar.commands["font-size"]?.value,xe=typeof re=="string"&&re.length>0,Ve=typeof ue=="string"&&ue.length>0||typeof ue=="number"&&Number.isFinite(ue);return xe&&j.fontFamily===void 0||Ve&&j.fontSize===void 0},Zn=()=>{const u=Wn();if(u!==Go&&(Mo&&(Mo(),Mo=null),Go=u,!!u))try{const h=u.subscribe(y=>{Br()&&Vr()&&Ka()||(vo+=1,zc(y),de("host-selection"))});typeof h=="function"&&(Mo=h)}catch{Go=null}},eo=()=>{const u=S()?.host,h=Lt(u?.getHandles?()=>u.getHandles():void 0,null)?.review;return h&&typeof h.subscribe=="function"?h:null},li=u=>u?typeof u.getActiveReviewTarget=="function"?Lt(()=>u.getActiveReviewTarget(),null):typeof u.getSnapshot=="function"?Lt(()=>u.getSnapshot(),null)?.activeReviewTarget??null:null:null;let Wo=0;const yi=(u,h)=>{const y=(h&&typeof h=="object"?h:null)?.lastInteractionRejection;if(u==null&&y&&typeof y=="object"&&y.code==="review-target-invalidated"&&y.detail==="not-painted"&&Qe)return!1;const _=u&&typeof u=="object"?u:null;let E=null;if(_?.entityType==="trackedChange"&&typeof _.entityId=="string"&&_.entityId.length>0){const P=_.story&&typeof _.story=="object"?_.story:void 0,j=P&&tr(P)!==tr(null)?P:void 0,re=typeof _.paintedEntityId=="string"&&_.paintedEntityId.length>0?_.paintedEntityId:null,ue=re??_.entityId,xe=(()=>{if(j){const Ke=bs(),qe=Ke?Lc(Ke,j):null;return qe?.toPublicId(ue)??qe?.toPublicId(_.entityId)??_.entityId}const Be=Ks(Array.isArray(O?.trackChanges.items)?O.trackChanges.items:[]);return Be.toPublicId(ue)??Be.toPublicId(_.entityId)??_.entityId})(),Ve=re??(ue!==xe?ue:null);E={id:xe,...j?{story:j}:{},...Ve&&Ve!==xe?{paintedEntityId:Ve}:{}}}return u==null&&E==null&&Qe!=null&&A(Qe)||ne(Qe,E)?!1:(F(E),!0)},Zc=()=>{const u=eo();if(u===si)return;if(ai&&(ai(),ai=null),si=u,!u){yi(null);return}let h=!0;try{const y=u.subscribe(_=>{const E=_&&typeof _=="object"?_:null,P=E&&Object.prototype.hasOwnProperty.call(E,"activeReviewTarget")?E.activeReviewTarget:li(u);!yi(P,_)||h||de()});typeof y=="function"&&(ai=y),yi(li(u))}catch{si=null}finally{h=!1}},Zl=()=>{if(Go||ir()!=="viewing")return null;const u=S()?.mount?.container,h=(u&&typeof u=="object"&&"ownerDocument"in u?u.ownerDocument??null:null)??globalThis.document??null;return h&&typeof h.addEventListener=="function"?h:null},D=()=>{const u=Zl();if(u===Xl||(Ot&&(Ot(),Ot=null),Xl=u,!u))return;const h=()=>{vo+=1,de()};u.addEventListener("selectionchange",h),u.addEventListener("pointerup",h,!0),u.addEventListener("mouseup",h,!0),Ot=()=>{u.removeEventListener("selectionchange",h),u.removeEventListener("pointerup",h,!0),u.removeEventListener("mouseup",h,!0)}};id(),yi(li(eo())),O=Ji("initial"),a=$a(O.selection);const q=()=>{const u=S()?.host?.events,h=u&&typeof u.subscribe=="function"?u:null;if(h!==Yl&&(As&&(As(),As=null),Yl=h,!!h))try{const y=h.subscribe(_=>{const E=_?.type;if(E==="review-mutation:started"){sn(_.reviewMutation?.token);return}if(E==="review-mutation:aborted"){pn(_.reviewMutation?.token),Wt();return}if(E==="mutation:rejected"&&_.reviewMutation&&(pn(_.reviewMutation.token),Wt()),E==="mutation:committed"&&_.reviewMutation&&pn(_.reviewMutation.token),E==="source:complete"||E==="source:signals-complete"){Yr=Re(),hs();return}if((E==="mutation:committed"||E==="collaboration:remote-changed")&&(dt=Date.now()),E==="mutation:committed"||E==="save:completed"||E==="collaboration:remote-changed"){const P=E==="mutation:committed"?TS(_):null;if(P?.allResolved){io([]),En(_.receipt);return}P?.removedIds.size&&Ht(new Set(P.removedIds),_.receipt);const j=E==="mutation:committed"&&Qs(_)||E==="collaboration:remote-changed"&&Array.isArray(_.changedStoryIds)&&_.changedStoryIds.length>0;if(j&&(Mn=Date.now()),E==="mutation:committed"&&j){gs();return}if(P?.removedIds.size&&P.upsertIds.size===0)return;(E==="collaboration:remote-changed"||E==="mutation:committed"&&!j)&&Wa();const re=E==="collaboration:remote-changed"&&Array.isArray(_.changedPartUris)&&_.changedPartUris.some(xe=>typeof xe=="string"&&LU.has(xe)),ue=E==="collaboration:remote-changed"&&Array.isArray(_.changedStoryIds)&&_.changedStoryIds.length>0&&Nl();re&&!j&&(mn=!0),ra(),re&&!j?Ho("comments"):ue&&(mn=!0,Nr()),de()}});typeof y=="function"&&(As=y)}catch{Yl=null}},de=(u="unspecified")=>{if(V)return;const{sink:h}=Hm(),y=h?Ua():0;Pi=!1,id(),Zn(),ql(),el(),Zc(),D(),q();const _=Ji(u);Ja(_.selection),O=_;let E=0,P=0;for(const j of[...Y]){if(!h){j(O);continue}const re=Ua();j(O);const ue=Ua()-re;E+=ue,P=Math.max(P,ue)}if(h){const j=Ua();$b({stage:"superdoc-ui-recompute",atMs:j,reason:u,startedAtMs:y,completedAtMs:j,durationMs:j-y,listenerCount:Y.size,listenerTotalMs:E,listenerMaxMs:P})}},Ne=[],pt=[],nn=u=>{for(const h of u)try{h()}catch{}},dn=()=>nn(Ne),Nn=()=>nn(pt),Fn=[];((u,h)=>{if(!(!u||typeof u.on!="function"))for(const y of h){const _=y==="active-editor-change"?()=>{dn(),Nn(),de()}:y==="document-replaced"?E=>{const P=E&&typeof E=="object"?E:null,j=P?.editor,re=P?.host,ue=!!j&&j===S(),xe=!!re&&re===B();!ue&&!xe||(Nn(),U.clear(),ra(),de())}:()=>de();try{u.on(y,_),Fn.push(()=>{try{typeof u.off=="function"&&u.off(y,_)}catch{}})}catch{}}})(t,AU),Zn(),ql(),el(),Zc(),D(),q();const Kn=(u,h=lU)=>({get:()=>u(O),subscribe:y=>{let _=u(O);const E=P=>{const j=u(P);h(_,j)||(_=j,y(j))};return Y.add(E),()=>Y.delete(E)}}),Cn=u=>Kn(u),Tn=u=>{const h=y=>{const _=P=>{try{y(P)}catch{}},E=u.subscribe(_);return _(u.get()),E};return{get:()=>u.get(),getSnapshot:()=>u.get(),observe:h,subscribe:y=>h(_=>y({snapshot:_}))}},tl=(u,h,y)=>{const _=Tn(u),E=Tn(h),P=j=>{const re=Bl(y);de();const ue=E.observe(j);return()=>{ue(),re()}};return{get:_.get,getSnapshot:_.getSnapshot,observe:P,subscribe:j=>P(re=>j({snapshot:re}))}};function Ql(u){return u&&typeof u=="object"&&typeof u.id=="string"?String(u.id):null}function Ko(u){const h=ds(u);return h&&tr(h)!==tr(null)?h:void 0}function aa(u,h){return{kind:"id",id:u,...h?{story:h}:{}}}function Jl(u){if(u.empty)return null;const h=u.selectionTarget,y=h?.start,_=h?.end;if(h?.kind!=="selection"||y?.kind!=="text"||_?.kind!=="text"||typeof y.blockId!="string"||y.blockId!==_.blockId||!Number.isInteger(y.offset)||!Number.isInteger(_.offset)||y.offset<0||_.offset<0||y.offset===_.offset)return null;const E=Math.min(y.offset,_.offset),P=Math.max(y.offset,_.offset),j=ds(u);return{kind:"range",coordinateSpace:h.coordinateSpace==="tracked"?"tracked":"visible",range:{kind:"text",...j?{story:j}:{},segments:[{blockId:y.blockId,range:{start:E,end:P}}]}}}function n2(u,h){if(tr(h)!==tr(null))return;const y=b()?.trackChanges,_=y?.list;if(typeof _!="function")return;const E=Lt(()=>_.call(y),null);if(Pr(E)||!E||typeof E!="object")return;const P=E.items;if(Array.isArray(P))return P.map(nd).find(j=>j!=null&&$i(j,u,h))}function r2(u,h){const y=bh(u.quotedText);if(!y)return!1;const _=rd(h);return[_.insertedText,_.deletedText,_.excerpt].some(E=>bh(E)===y)}function bh(u){return typeof u=="string"?u.replace(/\s+/g," ").trim():""}function Jm(){const u=O.selection.activeChangeIds[0];if(!u)return"unavailable";const h=ds(O.selection),y=(O.trackChanges.status==="ready"?O.trackChanges.items.find(j=>$i(j,u,h)):void 0)??n2(u,h)??bs()?.find(j=>$i(j,u,h));if(!y)return"unavailable";const _=rd(y),E=_.type,P=_.grouping;return r2(O.selection,y)?"id":E==="replacement"&&P==="replacement-pair"||(E==="insertion"||E==="deletion"||E==="insert"||E==="delete")&&P==="standalone"?"range":"id"}function o2(u,h,y,_){const E=()=>d2(u,aa(y,_),y,_);try{const P=d2(u,h,y,_);if(Pr(P))return An(Promise.resolve(P).then(re=>Ao(Xs(re))?re:E()));const j=Xs(P);return An(Ao(j)?P:E())}catch{return!1}}function eg(u,h){if(u.scope==="all")return{target:{kind:"all"},changeId:null};if(typeof h=="string"&&h.length>0)return{target:{kind:"id",id:h},changeId:h};if(h&&typeof h=="object"){const E=h;if(E.target&&typeof E.target=="object"){const j=E.target;return{target:j,changeId:Ql(j),story:j.story}}const P=typeof E.changeId=="string"?E.changeId:E.id;if(typeof P=="string"&&P.length>0)return{target:aa(P,E.story),changeId:P,story:E.story}}const y=O.selection.activeChangeIds[0],_=Ko(O.selection);return y?{target:aa(y,_),changeId:y,story:_}:null}function i2(u,h){if(u.scope==="id"&&h==null){if(O.selection.activeChangeIds.length>1)return kh(u.kind,{kind:"ids",ids:O.selection.activeChangeIds},null);if(O.selection.activeChangeIds.length===1&&!O.selection.empty&&O.selection.selectionTarget){const _=Jm();if(_==="unavailable")return!1;if(_==="range"){const E=Jl(O.selection),P=Ko(O.selection);return E?o2(u.kind,E,O.selection.activeChangeIds[0],P):!1}if(_==="id"){const E=O.selection.activeChangeIds[0],P=ds(O.selection),j=P&&tr(P)!==tr(null)?P:void 0;return u2(u.kind,j?{id:E,story:j}:E)}}}const y=eg(u,h);return y?kh(u.kind,y.target,y.changeId,y.story):!1}function s2(u,h){const y=X()?.lists,_=y?.apply;if(typeof _!="function")return!1;const{behavior:E,preset:P,continuity:j}=typeof h=="string"?TU(h):h&&typeof h=="object"?h:{},re={kind:u,behavior:E??"toggle"};P!==void 0&&(re.preset=P),j!==void 0&&(re.continuity=j);try{return An(_.call(y,re))}catch{return!1}}let la=Promise.resolve(!1),qo=null,qn=Promise.resolve(!1);const Ad=async u=>{if(!Km(u))return u;const h=S()?.documentMutationReadiness,y=h?.whenPainted;if(typeof y!="function")return u;const _=typeof u.txId=="string"?u.txId:void 0;try{await y.call(h,_?{txId:_}:void 0)}catch{}return u},Yo=u=>{if(Pr(u)){const y=Promise.resolve(u);return{immediate:!0,committed:y.then(_=>Xs(_),()=>!1),settled:y.then(_=>Ad(Xs(_)),()=>!1)}}const h=Xs(u);return{immediate:h,committed:Promise.resolve(h),settled:Ad(h)}},tg=()=>{const u=s.shift();if(!u){c=!1,f?.(),f=null;return}try{u.resolve(V?!1:u.mutate())}catch{u.resolve(!1)}},ng=()=>{let u=!1;return()=>{u||(u=!0,tg())}},rg=(u,h)=>{if(!c){c=!0,d=new Promise(P=>{f=P});try{return{result:h(),release:ng()}}catch(P){throw c=!1,f?.(),f=null,P}}const y=s.find(P=>P.key===u);if(y)return y.mutate=h,{result:y.result,release:()=>{}};let _;const E=new Promise(P=>{_=P});return s.push({key:u,mutate:h,result:E,resolve:_}),{result:E,release:ng()}},og=new Set(["create.tableOfContents"]),ig=u=>Yn(`Tracked authoring is not supported for ${u}.`),Id=u=>{if(ir()==="suggesting")return og.has(u)?ig(u):{changeMode:"tracked"}},sg=()=>ir()==="suggesting"?lH:e2,Sr=(u,h,y)=>{const _=Id(u);return _&&_.success===!1?_:_?h(y,_):h(y)},Ed=(u,h,y,_)=>{const E=u.inline;if(!E)return;const P=Xs(_);if(P===!1||typeof P=="object"&&P&&P.success===!1)return;if(E.kind==="clear"){n.clear();return}if(E.kind==="toggle"||!Yb(E.key))return;const j=$a(h);if(!j)return;const re=YU(E.key,y.value);if(re==null){n.delete(E.key);return}n.set(E.key,{selectionSignature:j,value:re})},ag=(u,h,y,_)=>!u.inline||u.inline.kind==="toggle"?_:Pr(_)?Promise.resolve(_).then(E=>(Ed(u,h,y,E),E)):_,Tt=(u,h,y,_)=>{if(u.inline?.kind!=="toggle"||!Ao(Xs(_))||typeof y.value!="boolean"&&y.value!==null)return null;const E=$a(h);if(!E)return null;const P=++l;return r.set(u.id,{selectionSignature:E,active:y.value===!0,generation:P,settled:!1}),de(),P},$t=(u,h,y)=>{if(h==null)return;const _=r.get(u.id);if(!(!_||_.generation!==h)){if(!Ao(y)){r.delete(u.id);return}_.settled=!0}},ln=(u,h)=>u.then(y=>(h?.(y),Pc(),y),()=>(h?.(!1),Pc(),!1)),An=(u,h)=>{const y=qo;if(qo=null,y)return la=ln(y,h),Xs(u);if(Pr(u))return la=ln(Yo(u).settled,h),!0;const _=Xs(u);return Km(_)&&typeof S()?.documentMutationReadiness?.whenPainted=="function"?(la=ln(Ad(_),h),_):(h?.(_),la=Promise.resolve(_),Pc(),_)},to=(u,h)=>!u||typeof u!="object"?h:u,gr=(u,h=Yn("Document API operation failed."))=>{if(Pr(u))return Promise.resolve(u).then(_=>gr(_,h),()=>h);const y=to(u,h);return ra(),Km(y)&&typeof S()?.documentMutationReadiness?.whenPainted=="function"?(ln(Ad(y)),de(),y):(de(),y)},Fi=(u,h,y,_)=>{const E=[],P=[];for(const j of y){const re=_(j);if(re)try{const ue=Yo(Sr(u,h,re));E.push(ue.immediate),P.push(ue.settled)}catch{E.push(!1),P.push(Promise.resolve(!1))}}return qo=P.length?Promise.all(P).then(j=>Ei(j)):null,Ei(E)},ca=(u,h,y,_)=>{const E=[],P=[];for(const j of y){const re=_(j);if(re)try{const ue=Yo(Sr(u,h,re));E.push(ue.immediate),P.push(ue.settled)}catch{E.push(!1),P.push(Promise.resolve(!1))}}return qo=P.length?Promise.all(P).then(j=>Ei(j)):null,Ei(E)},ec=(u,h,y,_=O.selection)=>{const E=Id(u);return E&&E.success===!1?E:_.selectionTarget?h(y,{...E,offsetSpace:"selection"}):E?h(y,E):h(y)},YH=(u,h,y,_)=>{const E=_o(h,_);switch(u.kind){case"alignment":{const P=y;return P!=="left"&&P!=="center"&&P!=="right"&&P!=="justify"?null:{target:E,alignment:P}}case"spacing-line":{const P=typeof y=="number"?y:Number(y);return!Number.isFinite(P)||P<=0?null:{target:E,line:P,lineRule:"auto"}}case"style":if(y&&typeof y=="object"){const P=y.role;if(P&&typeof P=="object")return{target:E,role:P}}return typeof y!="string"||y.trim()===""?null:{target:E,styleId:y};case"direction":{const P=u.fixedValue;return P!=="ltr"&&P!=="rtl"?null:{target:E,direction:P}}default:return null}},XH=(u,h)=>{const y=u.inline,_=Jb(u),E=B();if(!y||typeof E?.setPendingInlineFormat!="function")return!1;if(y.kind==="clear")return $(),!0;if(!_)return!1;let P;if(y.kind==="toggle")P=!le(u,b(),O.selection);else{const j=h&&typeof h=="object"&&"value"in h?h.value:h;if(y.kind==="value-number"){const re=typeof j=="number"?j:Number(j);P=Number.isFinite(re)&&re>0?re:null}else P=typeof j=="string"&&j.trim()!==""?j:null;if(P===null)return W(_,null),!0}return W(_,P),!0},ZH=()=>{const u=b(),{lockModesById:h}=ws(u?.contentControls,O.selection);if(Cs(h))return!1;const y=[],_=[],E=qe=>{const We=Yo(qe);y.push(We.immediate),_.push(We.settled)},P=(qe,We,Ge)=>{try{E(Ge?qe(We,Ge):qe(We))}catch{y.push(!1),_.push(Promise.resolve(!1))}},j=oi().cache?.full.defaults.paragraphStyleId??sa,re=od(O.selection);if(re){const qe=wr(u,"format.apply");if(qe)try{E(ec("format.apply",qe,{target:re,inline:{...sg()}}))}catch{y.push(!1),_.push(Promise.resolve(!1))}}const ue=wr(u,"format.paragraph.resetDirectFormatting"),xe=wr(u,"styles.paragraph.setStyleRef"),Ve=ds(O.selection),Be=!Ve||Ve.storyType==="body",Ke=wr(u,Be?"lists.remove":"lists.removeInStory");for(const qe of Fr(O.selection)){const We=_o(qe,Ve);if(ue&&P(ue,{target:We}),Ke)try{const Ge=Ha(qe),st=Yo(Ke(Be?{target:Ge}:{target:Ge,story:Ve}));_.push(st.settled.then(it=>Ao(it)?it:!0))}catch{}xe&&P(xe,{target:We,styleId:j})}if(!re&&ir()!=="suggesting"){const qe=wr(u,"format.paragraph.setMarkRunProps");if(qe)for(const We of Fr(O.selection))P(qe,{target:_o(We,Ve),markRunProps:{bold:!1,italic:!1,strikethrough:!1,doubleStrikethrough:!1,smallCaps:!1,caps:!1,verticalAlign:"baseline"}})}return qo=_.length?Promise.all(_).then(qe=>Ei(qe)):null,Ei(y.length?y:[!1])},QH=(u,h,y)=>{const _=Fr(O.selection);if(_.length===0)return!1;const E=ds(O.selection);return Fi(u.docRoute,h,_,P=>YH(u.blockParagraph,P,y,E))},JH=(u,h,y)=>{const _=b(),E=wr(_,"format.paragraph.setIndentation"),P=wr(_,"format.paragraph.clearIndentation"),j=u.list?.mode,re=us(O.selection),ue=ds(O.selection),xe=async Ve=>{const Be=await jt(_,Ve,re);if(Be===!0)return{kind:"list",routeToCall:u.docRoute,opToCall:h,input:{target:CI(Ve)}};if(Be===null||ue&&ue.storyType!=="body"&&typeof _?.getNode!="function")return null;const Ke=await kn(_,Ve,ue),qe={};if(Ke?.right!=null&&(qe.right=Ke.right),Ke?.firstLine!=null&&(qe.firstLine=Ke.firstLine),Ke?.hanging!=null&&(qe.hanging=Ke.hanging),j==="indent")return E?{kind:"paragraph",routeToCall:"format.paragraph.setIndentation",opToCall:E,input:{target:_o(Ve,ue),left:Math.max(0,Ke?.left??0)+kI,...qe}}:null;const We=Math.max(0,(Ke?.left??0)-kI);return We>0&&(qe.left=We),Object.keys(qe).length===0?P?{kind:"paragraph",routeToCall:"format.paragraph.clearIndentation",opToCall:P,input:{target:_o(Ve,ue)}}:E?{kind:"paragraph",routeToCall:"format.paragraph.setIndentation",opToCall:E,input:{target:_o(Ve,ue),left:0}}:null:E?{kind:"paragraph",routeToCall:"format.paragraph.setIndentation",opToCall:E,input:{target:_o(Ve,ue),...qe}}:null};return qo=(async()=>{const Ve=await Promise.all(y.map(We=>xe(We).catch(()=>null)));if(Ve.length===y.length&&Ve.every(We=>We?.kind==="list")&&ir()!=="suggesting"){const We=j==="indent"?"lists.indentRange":"lists.outdentRange",Ge=wr(_,We);if(Ge)try{return await Yo(Sr(We,Ge,{paraIds:y,story:re})).settled}catch{return!1}}const Be=re.storyType!=="body"&&Ve.some(We=>We?.kind==="list"),Ke=Be&&j==="outdent"?wr(_,"lists.outdentInStory"):null;if(Be&&!Ke)return!1;const qe=Ve.map(We=>{if(!We)return Promise.resolve(!1);try{return We.kind==="list"&&Ke?Yo(Sr("lists.outdentInStory",Ke,{target:We.input.target,story:re})).settled:Yo(Sr(We.routeToCall,We.opToCall,We.input)).settled}catch{return Promise.resolve(!1)}});return Ei(await Promise.all(qe))})(),!0},e$=(u,h)=>{const y=u.list,_=b(),E=Fr(O.selection);if(E.length===0)return!1;const P=us(O.selection),j=P.storyType==="body";if(y.mode==="indent"||y.mode==="outdent")return JH(u,h,E);const re=y.seed,ue=Be=>{if(Be.some(it=>!it.resolved))return{immediate:!1,settled:null};const Ke=Be.every(it=>it.seed===re);if(!Ke&&!j)return{immediate:!1,settled:null};const qe=Ke?j?"lists.remove":"lists.removeInStory":u.docRoute,We=Ke?wr(_,qe):h;if(!We)return{immediate:!1,settled:null};const Ge=[],st=[];return E.forEach((it,Xe)=>{if(!Ke&&Be[Xe]?.seed===re)return;const It=Ke?{target:Ha(it),...j?{}:{story:P}}:{target:Ha(it),seed:re};try{const Et=Yo(Sr(qe,We,It));Ge.push(Et.immediate),st.push(Et.settled)}catch{Ge.push(!1),st.push(Promise.resolve(!1))}}),{immediate:Ei(Ge),settled:st.length?Promise.all(st).then(it=>Ei(it)):null}},xe=E.map(Be=>Pn(_,Be,P));if(xe.some(Pr))return qo=Promise.all(xe).then(async Be=>{const Ke=ue(Be);return Ke.settled?await Ke.settled:Ke.immediate}),!0;const Ve=ue(xe);return qo=Ve.settled,Ve.immediate};function wh(u){return u&&typeof u=="object"?u:{}}function t$(u){if(typeof u=="string")return u;const h=wh(u);if(Object.prototype.hasOwnProperty.call(h,"href"))return h.href;if(Object.prototype.hasOwnProperty.call(h,"value"))return h.value}function n$(u,h){const y=wh(u).text;return typeof y=="string"&&y.trim()!==""?y:h}function VI(u){const h=wh(u),y=h.capture&&typeof h.capture=="object"?h.capture:null;return h.target??y?.target??y?.selectionTarget??h.selectionTarget??h.textTarget??null}const r$=u=>{const h=b(),y=h?.hyperlinks;if(!y)return!1;const _=wh(u),E=t$(u),P=VI(u),j=typeof _.text=="string"?_.text:void 0,re=typeof _.currentText=="string"?_.currentText:void 0,ue=hh(_.hyperlinkTarget)?_.hyperlinkTarget:null,xe=hh(_.textTarget)?_.textTarget:null,Ve=J(h,O.selection),Be=typeof ue?.storyId=="string"&&typeof ue?.hyperlinkNodeId=="string";if(Be&&E===null){const Ke=y.remove;if(typeof Ke!="function")return!1;try{return Sr("hyperlinks.remove",Ke,{storyId:ue.storyId,hyperlinkNodeId:ue.hyperlinkNodeId,keepText:!0})}catch{return!1}}if(Ve&&E===null){const Ke=y.remove;if(typeof Ke!="function")return!1;try{return Sr("hyperlinks.remove",Ke,{target:Ve.address,mode:"unwrap"})}catch{return!1}}if((Ve||ue)&&typeof E=="string"&&E.trim()!==""){const Ke=y.patch,qe=y.updateTarget;if(!(!Be&&Ve&&typeof Ke=="function")&&!(Be&&typeof qe=="function"))return!1;const We=typeof j=="string"&&j!==(Be?re:Ve?.text??re),Ge=h?.text?.replace,st=We?Be?xe:nH(Ve?.address):null,it=We&&!!st&&typeof Ge=="function";if(We&&!it)return!1;const Xe=[],It=[];let Et=null,Sn=null,_n=null,_r=!1;try{if(Be){if(typeof qe!="function")return!1;const Rr=Sr("hyperlinks.updateTarget",qe,{storyId:ue.storyId,hyperlinkNodeId:ue.hyperlinkNodeId,newTarget:rH(E)});_r=Pr(Rr);const Lr=Yo(Rr);if(!Ao(Lr.immediate))return!1;Xe.push(Lr.immediate),It.push(Lr.settled),Et=Lr.immediate,Sn=Lr.committed,_n=Lr.settled}else if(Ve){if(typeof Ke!="function")return!1;const Rr=Sr("hyperlinks.patch",Ke,{target:Ve.address,patch:{href:E}});_r=Pr(Rr);const Lr=Yo(Rr);if(!Ao(Lr.immediate))return!1;Xe.push(Lr.immediate),It.push(Lr.settled),Et=Lr.immediate,Sn=Lr.committed,_n=Lr.settled}}catch{return!1}if(it){const Rr=(jr,ci)=>Ao(ci)?Ei([jr,ci]):Ao(jr)?lh(jr,ci):ci,Lr=jr=>{if(!Ao(jr))return jr;try{const ci=Yo(Sr("text.replace",Ge,{target:st,text:j}));return Ao(ci.immediate)?Promise.all([_n??Promise.resolve(jr),ci.settled]).then(([g2,V$])=>Rr(g2,V$)):lh(jr,ci.immediate)}catch{return lh(jr,!1)}};if(_r)return qo=(Sn??Promise.resolve(Et??!1)).then(Lr),Ei(Xe);try{const jr=Yo(Sr("text.replace",Ge,{target:st,text:j}));if(!Ao(jr.immediate))return Et?lh(Et,jr.immediate):jr.immediate;Xe.push(jr.immediate),It.push(jr.settled),qo=Promise.all([_n??Promise.resolve(Et??!1),jr.settled]).then(([ci,g2])=>Rr(ci,g2))}catch{return Et?lh(Et,!1):!1}}return!it&&It.length>0&&(qo=Promise.all(It).then(Rr=>Ei(Rr))),Ei(Xe)}if(typeof E=="string"&&E.trim()!==""){const Ke=E.trim(),qe=y.wrap,We=WU(P),Ge=We.length>0?We:qb(O.selection);if(Ge.length>0){if(typeof qe!="function")return!1;try{return ca("hyperlinks.wrap",qe,Ge,It=>({target:It,link:{destination:{href:Ke}}}))}catch{return!1}}const st=y.insert,it=n$(u,Ke);if(typeof st!="function"||it.trim()==="")return!1;const Xe=dh(P)??Ys(O.selection);if(!Xe)return!1;try{return Sr("hyperlinks.insert",st,{target:Xe,text:it,link:{destination:{href:Ke}}})}catch{return!1}}return!1},o$=(u,h,y)=>{const _=u.create.kind,E=y&&typeof y=="object"?y:{};if(_==="table"){const j=Number(E.rows??E.rowCount),re=Number(E.columns??E.cols??E.colCount);if(!Number.isInteger(j)||j<1||!Number.isInteger(re)||re<1)return!1;const ue=Ys(O.selection),xe=ue&&typeof ue.blockId=="string"?{kind:"inParagraph",target:_o(ue.blockId),offset:ue.range?.start??0}:Zb(O.selection,"nodeId");try{return Sr(u.docRoute,h,{rows:j,columns:re,at:xe})}catch{return!1}}if(_==="image"){const j=E.src??E.value;if(typeof j!="string"||j.trim()==="")return!1;const re=Ys(O.selection),ue=us(O.selection),xe=ue.storyType==="body"?null:ue;let Ve;re&&typeof re.blockId=="string"?Ve={kind:"inParagraph",target:_o(re.blockId,xe),offset:re.range?.start??0}:(Ve=Zb(O.selection,"target"),xe&&Ve.kind==="after"&&(Ve={...Ve,target:{...Ve.target,story:xe}}));const Be={src:j,at:Ve};xe&&(Be.in=Ve.kind==="inParagraph"?Z(xe)??xe:xe),typeof E.alt=="string"&&(Be.alt=E.alt),typeof E.title=="string"&&(Be.title=E.title),E.size&&typeof E.size=="object"&&(Be.size=E.size);try{return Sr(u.docRoute,h,Be)}catch{return!1}}const P={at:Zb(O.selection,"target")};typeof E.instruction=="string"&&(P.instruction=E.instruction),E.config&&typeof E.config=="object"&&(P.config=E.config);try{return Sr(u.docRoute,h,P)}catch{return!1}},i$=(u,h)=>{const y=u.table,_=Pe();if(!_||y.requiresCell&&!_.cellNodeId)return!1;const E=dH(y.action,_);if(!E)return!1;try{if(y.action==="insert-row-before"||y.action==="insert-row-after"){const P=B(),j=(typeof P?.getHandles=="function"?P.getHandles():null)?.editing?.tables;if(typeof j?.insertRow!="function")return!1;const re=Id(u.docRoute);return re&&re.success===!1?re:re?j.insertRow(E,re):j.insertRow(E)}if(y.action==="insert-column-before"||y.action==="insert-column-after"){const P=B(),j=(typeof P?.getHandles=="function"?P.getHandles():null)?.editing?.tables;if(typeof j?.insertColumn!="function")return!1;const re=Id(u.docRoute);return re&&re.success===!1?re:re?j.insertColumn(E,_.rowIndex,re):j.insertColumn(E,_.rowIndex)}return Sr(u.docRoute,h,E)}catch{return!1}},s$=u=>!u||u.disposition!=="routed"?!1:!!(u.inline||u.blockParagraph||u.list||u.link||u.create),a$=u=>{const h=wh(u);return!!(VI(u)||hh(h.hyperlinkTarget)||hh(h.textTarget))},l$=(u,h,y)=>O.selection.status!=="ready"?!1:Ym(u)?.scope==="id"||!h||h.disposition!=="routed"?!0:h.inline?.kind==="clear"?Fr(O.selection).length>0||od(O.selection)!=null:h.inline?od(O.selection)!=null||Fr(O.selection).length>0:h.blockParagraph||h.list?Fr(O.selection).length>0:h.link?a$(y)||qb(O.selection).length>0||Ys(O.selection)!=null||le(h,b(),O.selection):!0,c$=(u,h)=>{const y=Ym(u),_=Xu(u);return y?.scope!=="id"&&!s$(_)?!1:!l$(u,_,h)},u$=(u,h)=>c$(u,h)?Yi().then(()=>{}):null,Qc=(u,h,y)=>{if(qo=null,la=Promise.resolve(!1),V)return!1;const _=Ze.get(u);if(_)try{const Be=_.execute(Fc(h,y));return An(Be)}catch{return!1}const E=pI(u);if(E){if(ir()==="viewing")return!1;if(typeof X()?.lists?.apply=="function")return s2(E,h)}const P=Ym(u);if(P)return i2(P,h);if(u==="copy-format")return An(d$());const j=Xu(u);if(!j||j.disposition!=="routed")return!1;const re=j.normalizePayload?j.normalizePayload(h):h;if(j.instanceRoute){if(!S()||!Lo(j,re))return!1;const Be=t?.[j.instanceRoute];if(typeof Be!="function")return!1;try{const Ke=j.fixedArg!==void 0?j.fixedArg:re,qe=Be.call(t,Ke);return An(qe)}catch{return!1}}if(j.inline?.kind==="clear")return j.mutates&&ir()==="viewing"?!1:An(ZH());const ue=j.docRoute;if(!ue||j.mutates&&ir()==="viewing")return!1;const xe=b(),Ve=wr(xe,ue);if(!Ve)return!1;if(j.inline){const{lockModesById:Be}=ws(xe?.contentControls,O.selection);if(Cs(Be))return!1;const Ke=od(O.selection);if(!Ke)return O.selection.empty===!1?An(!1):An(XH(j,re));const qe=le(j,xe,O.selection),We=cH(j.inline,Ke,re,qe);if(!We)return!1;let Ge=null;try{const st=S(),it=ir(),Xe=()=>S()!==st||b()!==xe||ir()!==it?!1:ec(ue,Ve,We),It=$a(O.selection)??xc(O.selection),Et=j.inline.kind==="toggle"?rg(`${j.id}:${It}`,Xe):null;Ge=Et?.release??null;const Sn=Et?Et.result:Xe(),_n=Tt(j,O.selection,We,Sn),_r=ag(j,O.selection,We,Sn),Rr=An(_r,Lr=>{$t(j,_n,Lr),Ge?.(),Ge=null});return j.inline.kind==="toggle"&&(qn=la),Rr}catch{return Ge?.(),!1}}if(j.blockParagraph){const Be=QH(j,Ve,re),Ke=j.blockParagraph.kind==="alignment"&&Ao(Be)?On(O.selection,re):null;return An(Be,qe=>{xr(Ke,qe)})}if(j.list){const Be=e$(j,Ve);return An(Be)}if(j.link){const Be=r$(re);return An(Be)}if(j.create){const Be=o$(j,Ve,re);return An(Be)}if(j.table){const Be=i$(j,Ve);return An(Be)}try{return An(j.mutates?Sr(ue,Ve,re):Ve(re))}catch{return!1}},lg=()=>{g+=1,p={mode:"idle",snapshot:null,sourceSelectionKey:null,lastClickAt:p.lastClickAt,pointerSelecting:!1,keyboardSelecting:!1};for(const u of m)u("idle");de()},d$=async()=>{const u=["bold","italic","underline","strikethrough"].filter(Ve=>O.toolbar.commands[Ve]?.active===!0),h=await qn;await d;const y=Ao(h)?u:[],_=500,E=Date.now();if(p.mode!=="idle"){if(p.mode==="armed"&&E-p.lastClickAt<_){p={...p,mode:"persistent",lastClickAt:E};for(const Ve of m)Ve("persistent");return de(),!0}return lg(),!1}const P=E-p.lastClickAt<_,j=++g;p={...p,lastClickAt:E};const re=await Yi(),ue=`${xc(re)}:${Re()}`,xe=await f$(null,re,ue&&ue===k?v:void 0,y);if(j!==g)return!0;p={...p,mode:P?"persistent":"armed",snapshot:xe,sourceSelectionKey:xc(re),lastClickAt:E};for(const Ve of m)Ve(p.mode);return de(),!0},f$=async(u,h,y,_=[])=>{const E=h?.target??u?.target;if(!E||E.kind!=="text")return null;const P=Array.isArray(E.segments)?E.segments:[];if(P.length===0)return null;const j=b();if(!j)return null;const re=E.story;let ue=null;for(const We of P){const Ge=(await Wl(_o(We.blockId,re)))?.node??null;if(!Ge)continue;const st=a2(Ge),it=Array.isArray(st?.inlines)?st.inlines:[],Xe=h$(it,We.range);ue?ue=jI(ue,Xe):ue=Xe}const xe=ue?cU(ue):{},Ve={bold:"bold",italic:"italic",underline:"underline",strikethrough:"strike"},Be=new Set([...h?.activeMarks??(Array.isArray(u?.activeMarks)?u.activeMarks:[]),..._]);for(const[We,Ge]of Object.entries(Ve))Be.has(We)&&(xe[Ge]=!0);const Ke=y??await qc(h??vs(u,"ready"));if(Ke.fontFamily&&(xe.fontFamily=Ke.fontFamily),Ke.color&&(xe.color=Ke.color),Ke.highlight&&(xe.highlight=Ke.highlight),Ke.fontSize){const We=Number.parseFloat(Ke.fontSize);Number.isNaN(We)||(xe.fontSize=We)}let qe=null;if(P.length===1){const We=P[0],Ge=(await Wl(_o(We.blockId,re)))?.node??null;Ge&&a2(Ge)&&(qe=await p$(Ge,We.blockId,j,re))}return{story:re??null,inline:xe,paragraph:qe}},a2=u=>u?u.kind==="paragraph"?u.paragraph??null:u.kind==="heading"?u.heading??null:null:null,h$=(u,h)=>{const y=j=>{const re=j.run;return typeof re?.text=="string"?re.text:""},_=j=>j.run?.props;if(h.start===h.end){let j=0;for(const re of u){const ue=y(re),xe=j,Ve=j+ue.length;if(j=Ve,h.start>=xe&&h.start<=Ve){const Be=_(re);return Be?{...Be}:{}}}return{}}let E=0;const P=[];for(const j of u){const re=y(j),ue=E,xe=E+re.length;if(E=xe,xe<=h.start||ue>=h.end)continue;const Ve=_(j);Ve&&P.push(Ve)}return P.length===0?{}:P.length===1?{...P[0]}:jI(P[0],...P.slice(1))},jI=(u,...h)=>{const y={...u};for(const _ of h)for(const E of Object.keys(y)){if(!(E in _)){delete y[E];continue}const P=y[E],j=_[E];(typeof P!=typeof j||JSON.stringify(P)!==JSON.stringify(j))&&delete y[E]}return y},p$=async(u,h,y,_)=>{const E=a2(u),P=E.props??{},j=E.styleRef??null,re=P.alignment??null,ue=P.spacing??null,xe=P.indent??null,Ve=xe?{...xe.left!=null?{left:xe.left}:{},...xe.right!=null?{right:xe.right}:{},...xe.firstLine!=null?{firstLine:xe.firstLine}:{},...xe.hanging!=null?{hanging:xe.hanging}:{}}:null,Be=P.markRunProps??null,Ke=P.numbering?.numId,qe=typeof Ke=="string"?parseInt(Ke,10):typeof Ke=="number"?Ke:NaN,We=P.numbering?.level,Ge=isNaN(qe)?null:{numId:qe,...We!=null?{level:We}:{}};let st=null;if(Ge&&typeof y.lists?.getState=="function")try{const it=await y.lists.getState({target:_o(h,_)});it&&typeof y.lists?.getStyle=="function"&&(st=await y.lists.getStyle(it)??null)}catch{}return{styleId:j,alignment:re,spacing:ue,indentation:Ve,markRunProps:Be,numbering:Ge,listStyle:st}},UI=async()=>{if(p.mode==="idle"||p.pointerSelecting||p.keyboardSelecting)return;const u=b()?.selection,h=async()=>{const j=typeof u?.current=="function"?await Promise.resolve(u.current({includeText:!0})):jl().value;return qi(j)},y=()=>new Promise(j=>setTimeout(j,16)),_=8;let E=null,P="";for(let j=0;j<_;j+=1){if(j>0&&await y(),p.mode==="idle"||p.pointerSelecting||p.keyboardSelecting)return;if(E=await h(),!(!E||E.empty)&&(P=xc(E),P!==p.sourceSelectionKey))break}if(E&&!E.empty&&P!==p.sourceSelectionKey){await HI(E);return}if(p.snapshot?.paragraph){const j=await h();if(!j||xc(j)===p.sourceSelectionKey)return;await HI(j)}},HI=async u=>{const h=p.snapshot;if(!h){p.mode==="armed"&&lg();return}const y=b();if(!y)return;const _=vs(u,"ready"),{lockModesById:E}=ws(y.contentControls,_);if(Cs(E)){de();return}const P=u.target,j=u.selectionTarget;if(u.empty!==!0&&Object.keys(h.inline).length>0){const re=wr(y,"format.apply");if(re&&j)try{if(!Ao(Xs(await Promise.resolve(ec("format.apply",re,{target:j,inline:h.inline},u))))){de();return}}catch{de();return}}if(h.paragraph){const re=Array.isArray(P?.segments)?P.segments:[],ue=P?.story;for(const xe of re){const Ve=_o(xe.blockId,ue),Be=await Wl(Ve),Ke=Be?.node??null,qe=Be?.address??null;if(!Ke)continue;const We={kind:"block",nodeType:qe?.nodeType??Ke.kind??"paragraph",nodeId:xe.blockId,...ue&&typeof ue=="object"?{story:ue}:{}},{styleId:Ge,alignment:st,spacing:it,indentation:Xe,markRunProps:It,numbering:Et,listStyle:Sn}=h.paragraph;if(Ge&&await y.styles?.paragraph?.setStyle?.({target:We,styleId:Ge}),st&&await y.format?.paragraph?.setAlignment?.({target:We,alignment:st}),it){const _n=it,_r=_n.lineRule??"auto",Rr=new Set(["auto","exact","atLeast"]).has(_r)?_r:"auto",Lr={..._n.before!=null?{before:Math.round(_n.before*20)}:{},..._n.after!=null?{after:Math.round(_n.after*20)}:{},..._n.line!=null?{line:Math.round(Rr==="auto"?_n.line*240:_n.line*20),lineRule:Rr}:{}};await y.format?.paragraph?.setSpacing?.({target:We,...Lr})}if(Xe){const _n={...Xe.left!=null?{left:qs(Xe.left)}:{},...Xe.right!=null?{right:qs(Xe.right)}:{},...Xe.firstLine!=null?{firstLine:qs(Xe.firstLine)}:{},...Xe.hanging!=null?{hanging:qs(Xe.hanging)}:{}};await y.format?.paragraph?.setIndentation?.({target:We,..._n})}It&&await y.format?.paragraph?.setMarkRunProps?.({target:We,markRunProps:It}),Et&&await y.format?.paragraph?.setNumbering?.({target:We,...Et}),Sn&&((await Wl(Ve))?.address?.nodeType==="listItem"?await y.lists?.applyStyle?.({target:CI(xe.blockId,ue),style:Sn}):Et&&await y.format?.paragraph?.setNumbering?.({target:We,...Et}))}}p.mode==="armed"&&lg(),de()},cg=(u,h,y)=>{const _=u$(u,h),E=_?_.then(()=>(Qc(u,h,y),la)):(Qc(u,h,y),la);return Xu(u)?.inline?.kind==="toggle"&&(qn=E),E},$I=u=>({id:u,getState:()=>O.toolbar.commands[u]??I(u,b(),O.selection,Xa(O.selection)),observe:h=>Kn(y=>y.toolbar.commands[u]??{enabled:!1,active:!1,supported:!1,source:"unsupported",reason:lt.commandUnsupported}).subscribe(h),execute:h=>Qc(u,h),executeAsync:h=>cg(u,h)}),m$=u=>{Ze.set(u.id,u),de();const h=()=>{Ze.delete(u.id),de()};return Object.assign(h,{handle:$I(u.id),unregister:h})},ug=Cn(u=>u.selection),dg=Tn(ug),GI=()=>{const u=B();if(typeof u?.getHandles!="function")return{reason:lt.hostCapabilityUnavailable};let h=null;try{h=u.getHandles()}catch(_){const E=_?.reason;return{reason:E==="host-not-ready"||E==="host-disposed"||E==="editing-mount-required"?lt.notReady:lt.hostCapabilityUnavailable}}const y=h?.editing?.selectionTargets;return typeof y?.apply!="function"?{reason:lt.hostCapabilityUnavailable}:{helper:y}},g$=u=>{const h=B();if(typeof h?.getHandles=="function")try{const y=h.getHandles()?.editing?.contentControls;typeof y?.activate=="function"&&y.activate({id:u})}catch{}},WI={get:dg.get,getSnapshot:dg.getSnapshot,subscribe:dg.subscribe,observe:dg.observe,current:()=>jl().value,capture:()=>{const u=ug.get();return u.empty||!u.target&&!u.selectionTarget?null:{...u,capturedAt:Date.now()}},restore:u=>{const h=E=>(de(),{...E,success:E.ok});if(!u||typeof u!="object")return h({ok:!1,reason:lt.targetUnresolved});if(!S())return h({ok:!1,reason:lt.notReady});const y=aH(u);if(!y)return h({ok:!1,reason:lt.targetUnresolved});const _=GI();if(!("helper"in _))return h({ok:!1,reason:_.reason});try{return h(hI(_.helper.apply(y)))}catch{return h({ok:!1,reason:lt.hostCapabilityUnavailable})}},apply:u=>{if(!S())return{ok:!1,reason:lt.notReady};const h=GI();if(!("helper"in h))return{ok:!1,reason:h.reason};try{const y=h.helper.apply(u);return de(),hI(y)}catch{return{ok:!1,reason:lt.hostCapabilityUnavailable}}},getAnchorRect:u=>{const h=B();if(typeof h?.getSelectionAnchorRect=="function"){const y=Lt(()=>h.getSelectionAnchorRect(u),null);return y&&typeof y=="object"&&(Number(y.width)>0||Number(y.height)>0)?y:null}return null},getRects:u=>{const h=ug.get(),y=h.selectionTarget??h.target;if(h.empty||!y)return[];const _=wg.getRect({target:y,relativeTo:u?.relativeTo});return _.found?_.rects:[]}},v$={get ids(){return ri()},has:u=>Xu(u)!=null||Ze.has(u),get:u=>$I(u),execute:Qc,executeAsync:cg,register:m$,getContextMenuItems:u=>{const h=[];for(const y of Ze.values()){const _=y.contextMenu;_&&Lt(_.when?()=>_.when(u):void 0,!0)&&h.push({id:y.id,label:_.label,group:_.group,order:_.order,invoke:()=>Qc(y.id,void 0,u)})}return h.sort((y,_)=>(y.order??0)-(_.order??0)||y.label.localeCompare(_.label))}},l2=Tn(Cn(u=>u.toolbar)),y$={get:l2.get,getSnapshot:()=>O.toolbar,subscribe:l2.subscribe,observe:l2.observe,execute:Qc,executeAsync:cg},Td=async(u,h)=>{if(!S())return{success:!1,ok:!1,reason:lt.notReady};if(!u)return{success:!1,ok:!1,reason:lt.targetUnresolved};const y=B(),_=y?.scrollTargetIntoView;if(typeof _!="function")return{success:!1,ok:!1,reason:lt.hostCapabilityUnavailable};try{const E={target:u,block:h?.block??"center",behavior:h?.behavior??"smooth"},P=await Promise.resolve(h?.shouldContinue?_.call(y,E,h.shouldContinue):_.call(y,E));return P&&typeof P=="object"&&P.success===!1?{success:!1,ok:!1,reason:$m(P.reason,lt.targetUnresolved)}:{success:!0,ok:!0}}catch{return{success:!1,ok:!1,reason:lt.hostCapabilityUnavailable}}},KI=u=>{if(!u||typeof u!="object")return null;const h=u,y=h.wordRevisionIds&&typeof h.wordRevisionIds=="object"?h.wordRevisionIds:null,_=h.sourceIds&&typeof h.sourceIds=="object"?h.sourceIds:null,E=Array.isArray(_?.wordIdOther)?_.wordIdOther:void 0,P=y?.insert??y?.delete??y?.format??_?.wordIdInsert??_?.wordIdDelete??E?.[0];return typeof P=="string"&&P.length>0?P:null},qI=async(u,h,y,_,E)=>{const P=await Td(h,E);if(P.ok)return P;const j=T(),re=j?.focusTrackedChange;if(typeof re!="function")return P;const ue=y||_?{commentId:u,...y?{trackedChangeStory:y}:{},..._?{importedId:_}:{}}:u;try{const xe=await Promise.resolve(re.call(j,ue));if(xe&&typeof xe=="object"&&xe.ok===!0)return{success:!0,ok:!0}}catch{}return P},fg=async(u,h,y,_)=>{const E=u==="trackChanges"?_?.story:void 0,P=it=>{if(!E||!it||typeof it!="object")return it;const Xe=it,It=Xe.address&&typeof Xe.address=="object"?Xe.address:null;return Xe.story||It?.story?it:{...Xe,story:E}},j=u==="trackChanges"?gI:ch,re=y.find(it=>$i(it,h,E)),ue=re&&typeof re=="object"?re:null,xe=u==="trackChanges"&&ue?.type==="move"&&(ue.subtype==="move-to"||ue.subtype==="move-from")?ue.subtype:null,Ve=xe&&typeof ue?.trackedChangeCanonicalId=="string"?ue.trackedChangeCanonicalId:h,Be=it=>{if(!xe)return u==="trackChanges"?gI(it,{preferStableBlock:!0}):j(it);const Xe=ch(it);if(Xe?.kind!=="move")return null;const It=xe==="move-to"?Xe.destination:Xe.source;return Wb(It)?It:null},Ke=j(re),qe=u!=="trackChanges"||!xe&&Wb(ch(re));if(Ke&&qe)return P(Ke);const We=b()?.[u],Ge=u==="comments"?{commentId:h}:{id:Ve,...E?{story:E}:{}},st=We?.get;if(typeof st!="function")return P(Ke);try{return P(Be(await Promise.resolve(st.call(We,Ge)))??Ke)}catch{return P(Ke)}};function YI(u,h){if(Vl())return Yn("Comments are read-only.","DOCUMENT_READONLY");if(sd())return Yn("Resolving comments is disabled.","DOCUMENT_READONLY");const y=b()?.comments,_=y?.patch;if(typeof _!="function")return Yn("comments.patch is unavailable.");const E=Yn("comments.patch failed.");return Lt(()=>gr(_.call(y,{commentId:u,status:h}),E),E)}const Ch=()=>Vl()?Yn("Comments are read-only.","DOCUMENT_READONLY"):null,b$=(u,h)=>{const y=h&&typeof h=="object"?h:null;let _=Array.from(u);y?.includeResolved===!1&&(_=_.filter(ue=>ue.status!=="resolved"));const E=Number(y?.offset),P=Number.isInteger(E)&&E>0?E:0,j=Number(y?.limit),re=Number.isInteger(j)&&j>=0?P+j:void 0;return _.slice(P,re)},xd=Cn(u=>u.comments),hg=tl(xd,Kn(u=>jc(u.selection,u.comments)),"comments"),w$={get:hg.get,getSnapshot:hg.getSnapshot,subscribe:hg.subscribe,observe:hg.observe,list:u=>{_e();const h=mr();return b$(h.value??xd.get().items,u)},getById:u=>{const h=xd.get().items.find(E=>Kr(E)===u)??null;if(h)return h;const y=b()?.comments,_=Lt(y?.get?()=>y.get({commentId:u}):void 0,null);return Pr(_)?null:_},createFromCapture:(u,h)=>{const y=Ch();if(y)return y;const _=b()?.comments,E=_?.create;if(typeof E!="function")return Yn("comments.create is unavailable.");const P=Yn("comments.create failed.");return Lt(()=>{const j=u&&typeof u=="object"?u.target??u.selectionTarget:null;return j==null?Yn("A range selection is required to comment.","NO_SELECTION"):gr(E.call(_,{target:j,text:h.text}),P)},P)},createFromSelection:u=>{const h=Ch();if(h)return h;const y=b()?.comments,_=y?.create;if(typeof _!="function")return Yn("comments.create is unavailable.");const E=ug.get(),P=E.target??E.selectionTarget;if(E.empty||!P)return Yn("A range selection is required to comment.","NO_SELECTION");const j=Yn("comments.create failed.");return Lt(()=>gr(_.call(y,{target:P,text:u.text}),j),j)},reply:(u,h)=>{const y=Ch();if(y)return y;const _=b()?.comments,E=_?.reply??_?.create;if(typeof E!="function")return Yn("comments.reply is unavailable.");const P=Yn("comments.reply failed.");return Lt(()=>gr(E===_?.reply?E.call(_,{parentCommentId:u,text:h.text}):E.call(_,{parentCommentId:u,text:h.text}),P),P)},edit:(u,h)=>{const y=Ch();if(y)return y;const _=b()?.comments,E=_?.patch;if(typeof E!="function")return Yn("comments.patch is unavailable.");const P=Yn("comments.patch failed.");return Lt(()=>gr(E.call(_,{commentId:u,text:h.text}),P),P)},resolve:u=>YI(u,"resolved"),reopen:u=>YI(u,"active"),delete:u=>{const h=Ch();if(h)return h;const y=b()?.comments,_=y?.delete??y?.remove;if(typeof _!="function")return Yn("comments.delete is unavailable.");const E=Yn("comments.delete failed.");return Lt(()=>gr(_.call(y,{commentId:u}),E),E)},setActive:u=>{if(u==null)return at=null,de(),!0;if(!S())return!1;const h=xd.get(),y=U.get("comments"),_=y?.token===Re()&&y.hasSettled&&Array.isArray(y.value)?y.value:null,E=_??h.items;if(!_&&h.listStatus!=="ready")return!1;const P=UU(E,u);return!P||!E.some(j=>Kr(j)===P)?!1:(at=P,de(),!0)},scrollTo:async u=>{if(!b())return{success:!1,ok:!1,reason:S()?lt.documentApiUnavailable:lt.notReady};const h=await fg("comments",u,xd.get().items);return h?Td(h):{success:!1,ok:!1,reason:lt.targetUnresolved}}},Is=Cn(u=>u.trackChanges),c2=(u,h)=>{Ti();const y=(oa().value??Is.get().items).map(nd).filter(Be=>Be!=null&&Kr(Be)!==null);if(y.length===0)return null;const _=O.trackChanges.activeId,E=Qe?.id===_?Qe.story:void 0,P=y.filter(Be=>Gm(Be)==null),j=E||P.length===0?y:P;let re=_?j.findIndex(Be=>$i(Be,_,E)):-1;re===-1&&_&&E&&(re=j.findIndex(Be=>$i(Be,_)));const ue=j[re===-1?u>0?0:j.length-1:(re+u+j.length)%j.length],xe=Kr(ue),Ve=Gm(ue);return F(Ve?{id:xe,story:Ve}:{id:xe},h),de(),xe},XI=async u=>{const h=T(),y=h?.listTrackedChanges;if(typeof y=="function")try{await Promise.resolve(y.call(h,{mode:"visible-window",targetIds:[u],refreshReason:"ui-track-change-reveal-restamp",blocking:!0}))}catch{}};let ZI=Promise.resolve();const C$=u=>{const h=se;return ZI.catch(()=>{}).then(()=>k$(u,h))},k$=async(u,h)=>{if(se!==h)return{success:!1};const y=Qe,_=c2(u,{invalidateQueuedNavigation:!1});if(_==null)return{success:!1};const E=Qe,P=At,j=()=>se===h&&Qe===E&&At===P,re=()=>{j()&&(F(y,{invalidateQueuedNavigation:!1}),de())};E&&Ue.add(E);try{const ue=await fg("trackChanges",_,Is.get().items,E?.story?{story:E.story}:void 0);if(!j())return{success:!1};if(!ue)return re(),{success:!1};const xe=Is.get().items.find(Be=>$i(Be,_,E?.story))??Is.get().items.find(Be=>Kr(Be)===_),Ve=KI(xe);Wo+=1;try{const Be=await qI(_,ue,E?.story,Ve,{behavior:"auto",shouldContinue:j});if(!j())return{success:!1};if(!Be.ok&&Be.reason!==lt.targetNotVisible)re(),ie(y);else{if(Be.ok&&await XI(_),!j())return{success:!1};ie(E)}return{success:Be.ok}}finally{Wo=Math.max(0,Wo-1),Wo===0&&(j()?si&&yi(li(si)):ie(Qe))}}finally{E&&Ue.delete(E)}},QI=u=>{const h=C$(u);return ZI=h.then(()=>{},()=>{}),h},pg=tl(Is,Kn(u=>ph(u.selection,u.trackChanges)),"trackChanges"),S$={get:pg.get,getSnapshot:pg.getSnapshot,subscribe:pg.subscribe,observe:pg.observe,list:()=>{Ti();const u=oa().value??Is.get().items,h=un(Re());return u.map(nd).filter(y=>y!=null).filter(y=>{const _=Kr(y);return!_||!h?.has(_)})},accept:u=>u2("accept",u),reject:u=>u2("reject",u),acceptAll:()=>kh("accept",{kind:"all"},null),rejectAll:()=>kh("reject",{kind:"all"},null),next:()=>c2(1),previous:()=>c2(-1),navigateNext:()=>QI(1),navigatePrevious:()=>QI(-1),getAt:u=>{if(!u||typeof u!="object"||typeof u.x!="number"||typeof u.y!="number")return null;const h=h2(u);if(h.length===0)return null;const y=Is.get().items;let _;for(const E of h){if(E.type!=="trackedChange")continue;let P;if(E.story){if(_===void 0&&(_=bs()),!_)continue;P=_}else P=y;const j=P.find(re=>$i(re,E.id,E.story));if(j)return E.story?{id:j.id,item:j,story:E.story}:{id:j.id,item:j}}return null},setActive:u=>{if(u==null)return F(null),ie(null),de(),!0;if(!S())return!1;const h=typeof u=="string"?{id:u}:{id:u.id,story:u.story};if(typeof h.id!="string"||h.id.length===0)return!1;const y=h.id;if(h.story){const _=bs();if(!_)return!1;const E=Lc(_,h.story).toPublicId(h.id)??h.id;if(!_.some(P=>$i(P,E,h.story)))return!1;h.id=E}else{const _=bs()??Is.get().items,E=Ks(_).toPublicId(h.id)??h.id,P=_.find(j=>Kr(j)===E);if(!P)return!1;h.id=E,h.story=Gm(P)}return y!==h.id&&(h.paintedEntityId=y),F(h),ie(h),de(),!0},scrollTo:async u=>{if(!b())return{success:!1,ok:!1,reason:S()?lt.documentApiUnavailable:lt.notReady};se+=1,Ie+=1;const h=Ie,y=Is.get().items,_=Ks(y).toPublicId(u)??u,E=y.find(xe=>Kr(xe)===_),P=Gm(E),j=KI(E),re=Qe,ue={id:_,...P?{story:P}:{},..._!==u?{paintedEntityId:u}:{}};Ue.add(ue);try{const xe=await fg("trackChanges",_,y,P?{story:P}:void 0);if(Ie!==h)return{success:!1,ok:!1};if(!xe)return{success:!1,ok:!1,reason:lt.targetUnresolved};F(ue);const Ve=Ie,Be=Qe,Ke=At,qe=()=>Ie===Ve&&Qe===Be&&At===Ke,We=()=>{qe()&&(F(re,{invalidateQueuedNavigation:!1}),de())};de(),Wo+=1;try{const Ge=await qI(_,xe,P,j,{behavior:"auto",shouldContinue:qe});if(!qe())return{success:!1,ok:!1};if(!Ge.ok&&Ge.reason!==lt.targetNotVisible)We(),ie(re);else{if(Ge.ok&&await XI(_),!qe())return{success:!1,ok:!1};ie(ue)}return Ge}finally{Wo=Math.max(0,Wo-1),Wo===0&&(qe()?si&&yi(li(si)):ie(Qe))}}finally{Ue.delete(ue)}}},u2=(u,h)=>{const{id:y,story:_}=typeof h=="string"?{id:h,story:void 0}:h,E={kind:"id",id:y,..._?{story:_}:{}};return kh(u,E,y,_)},kh=(u,h,y,_)=>{try{return An(d2(u,h,y,_))}catch{return!1}},d2=(u,h,y,_)=>{if(ad())return!1;const E=b()?.trackChanges,P=h.kind==="all"||h.scope==="all",j=h.kind==="range",re=h.kind==="ids",ue=P?[]:re&&Array.isArray(h.ids)?h.ids.filter(Ke=>typeof Ke=="string"&&Ke.length>0):y?[y]:[];if(ue.length>0&&ks(u,ue)||Sd({kind:u,scope:P?"all":"id"},E))return!1;const xe=P?`${u}All`:u,Ve=!j&&!re&&!_&&E&&typeof E[xe]=="function"?E[xe]:null,Be=E&&typeof E.decide=="function"?E.decide:null;return!Ve&&!Be?!1:Ve?Ve.call(E,y??{}):Be.call(E,{decision:u,target:h})},f2=Cn(u=>u.contentControls),Sh=u=>f2.get().items.find(h=>h?.id===u)??null,mg=Tn(f2),_$=(u=>{if(u===void 0)return mg.get();const h=Wm(u);return h?Sh(h):null}),A$={get:(u=>(u!==void 0&&ei("api"),_$(u))),getSnapshot:mg.getSnapshot,subscribe:mg.subscribe,observe:mg.observe,list:()=>(ei("api"),f2.get().items),getById:u=>(ei("api"),Sh(u)),getRect:u=>{const h=Wm(u);if(!h)return Fl("unresolved");ei("panel");const y=Sh(h);if(!y)return Fl("unresolved");const _=Kb(y);return _?wg.getRect({target:_}):Fl("unavailable")},scrollIntoView:async u=>{const h=Wm(u);if(!h)return{success:!1};ei("panel");const y=Sh(h);if(!y)return{success:!1};const _=Kb(y);return _?{success:(await Td(_,{block:u.block,behavior:u.behavior})).ok}:{success:!1}},focus:async u=>{const h=Wm(u);if(!h)return{success:!1,reason:"invalid-id"};if(!S())return{success:!1,reason:"not-ready"};ei("panel");const y=Sh(h);if(!y)return{success:!1,reason:"not-found"};const _=Kb(y);if(!_)return{success:!1,reason:"not-reachable"};if(!(await Td(_,{block:u.block,behavior:u.behavior})).ok)return{success:!1,reason:"not-reachable"};const E=PU(_);if(!E)return{success:!1,reason:"not-reachable"};const P=WI.apply(E);return!P.ok&&P.reason!==lt.hostCapabilityUnavailable?{success:!1,reason:"not-reachable"}:(g$(h),{success:!0})}},gg=Tn(Cn(u=>u.fonts)),I$={get:gg.get,getSnapshot:gg.getSnapshot,subscribe:gg.subscribe,observe:gg.observe,getFamilyOptions:()=>O.fonts.options,getSizeOptions:()=>O.fonts.sizeOptions},vg=Tn(Cn(u=>u.zoom)),E$={get:vg.get,getSnapshot:vg.getSnapshot,subscribe:vg.subscribe,observe:vg.observe,set:u=>{if(typeof t?.setZoom=="function")try{t.setZoom(u),de()}catch{}},setMode:u=>{if(typeof t?.setZoomMode=="function")try{t.setZoomMode(u),de()}catch{}}},yg=Tn(Cn(u=>u.document)),T$={get:yg.get,getSnapshot:yg.getSnapshot,subscribe:yg.subscribe,observe:yg.observe,setMode:u=>{if(typeof t?.setDocumentMode=="function")try{t.setDocumentMode(u),de()}catch{}},export:u=>{if(typeof t?.export=="function")try{return Promise.resolve(t.export(u))}catch{return}},getText:()=>{const u=b(),h=Lt(u?.getText?()=>u.getText({}):void 0,null);return typeof h=="string"?h:h&&typeof h=="object"&&typeof h.text=="string"?h.text:null},replaceFile:u=>{const h=t?.replaceFile??t?.loadDocument??t?.reload;if(typeof h=="function")try{return Promise.resolve(h.call(t,u))}catch{return}}},JI=()=>{if(typeof HTMLElement>"u")return null;const u=S()?.mount?.container;if(u instanceof HTMLElement)return u;const h=t?.element;return h instanceof HTMLElement?h:null},x$=(u,h)=>{if(typeof u!="number"||typeof h!="number"||!Number.isFinite(u)||!Number.isFinite(h))return[];const y=globalThis.document;if(!y||typeof y.elementFromPoint!="function")return[];const _=JI();if(!_)return[];const E=y.elementFromPoint(u,h);if(!E||!_.contains(E))return[];const P=[E],j=Xe=>{Xe&&_.contains(Xe)&&!P.includes(Xe)&&P.push(Xe)},re=y.elementsFromPoint;if(typeof re=="function"){let Xe=[];try{Xe=re.call(y,u,h)??[]}catch{Xe=[]}for(const It of Xe)j(It)}const ue=[],xe=Xe=>{Xe&&_.contains(Xe)&&!ue.includes(Xe)&&!P.includes(Xe)&&ue.push(Xe)},Ve=Xe=>{const It=Xe.getBoundingClientRect;if(typeof It!="function")return!1;let Et;try{Et=It.call(Xe)}catch{return!1}return Et!=null&&u>=Et.left&&u<=Et.right&&h>=Et.top&&h<=Et.bottom};for(const Xe of P){const It=Xe.querySelectorAll;if(typeof It!="function")continue;let Et;try{Et=It.call(Xe,"[data-track-change-marker]")}catch{continue}for(let Sn=0;Sn<Et.length;Sn+=1)Ve(Et[Sn])&&xe(Et[Sn])}ue.reverse();const Be=[...ue,...P],Ke=fI(Be[0],_);for(let Xe=1;Xe<Be.length;Xe+=1)for(const It of fI(Be[Xe],_))Ke.push(It);if(Ke.length===0)return Ke;const qe=Is.get().items,We=Ks(qe);let Ge;const st=new Set,it=[];for(const Xe of Ke){if(Xe.type!=="trackedChange"){const _n=`${Xe.type}:${Xe.id}`;if(st.has(_n))continue;st.add(_n),it.push(Xe);continue}const It=OU(Xe.storyKey)??DU(Xe.story);let Et;if(It){if(Ge===void 0&&(Ge=bs()),!Ge||(Et=Lc(Ge,It).toPublicId(Xe.id),!Et||!Ge.some(_n=>$i(_n,Et,It))))continue}else if(Et=We.toPublicId(Xe.id),!Et)continue;const Sn=`trackedChange:${Et}`;st.has(Sn)||(st.add(Sn),it.push(It?{type:"trackedChange",id:Et,story:It}:{type:"trackedChange",id:Et}))}return it};function h2(u,h){return typeof u=="object"?x$(u?.x,u?.y):null}const Rd=new Set;let p2=!1;const eE=u=>{const h=B();if(typeof h?.observeGeometry!="function")return;let y=!1;const _=Lt(()=>{const E=h.observeGeometry(()=>u.schedule());return y=!0,E},null);u.detach=typeof _=="function"?_:null,u.boundHost=y?h:null},bg=u=>{if(u.detach){try{u.detach()}catch{}u.detach=null}u.boundHost=null},tE=()=>{if(p2=!1,!(V||B()))for(const u of Rd)bg(u)},R$=()=>{if(!p2){if(p2=!0,typeof queueMicrotask=="function"){queueMicrotask(tE);return}Promise.resolve().then(tE)}},L$=()=>{const u=B();if(!u){R$();return}for(const h of Rd)h.boundHost&&h.boundHost===u||(bg(h),eE(h),h.schedule())};Ne.push(L$);const wg={getRect:u=>{const h=B(),y=h?.getTargetRects;if(typeof y=="function"){const _=Lt(()=>y.call(h,{target:u.target}),null);return _&&typeof _=="object"?_.success===!0&&Array.isArray(_.rects)?iH(oH(_.rects.filter(E=>E!=null&&typeof E=="object")),u.relativeTo):Fl(typeof _.reason=="string"?_.reason:"unresolved"):Fl("unresolved")}return Fl("unavailable")},observe:u=>{const h=[];let y=0;const _=typeof requestAnimationFrame=="function",E=()=>{if(!_){u();return}y||(y=requestAnimationFrame(()=>{y=0,u()}))},P=Kn(re=>({ready:re.ready,selection:re.selection,zoom:re.zoom}));h.push(P.subscribe(()=>E()));const j={schedule:E,detach:null,boundHost:null};return eE(j),Rd.add(j),()=>{Rd.delete(j),bg(j),y&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(y);for(const re of h.splice(0))try{re()}catch{}}},getHost:()=>JI(),entityAt:h2,contextAt:u=>{const h=!!u&&typeof u.x=="number"&&typeof u.y=="number",y=h?u.x:0,_=h?u.y:0;return{point:{x:y,y:_},entities:h?h2({x:y,y:_}):[],selection:O.selection,position:null,insideSelection:!1}},scrollIntoView:async u=>{const h=u?.target;if(!h)return{success:!1};let y=null;if(h.kind==="entity"){const _=h.entityType==="comment"?"comments":"trackChanges",E=_==="comments"?xd.get().items:Is.get().items,P=h.entityType==="trackedChange"&&h.story?{story:h.story}:void 0;y=await fg(_,h.entityId,E,P)}else{const _=h,E=h,P=Array.isArray(_.segments)&&_.segments.length>0?_.segments:E.blockId&&E.range?[{blockId:E.blockId,range:E.range}]:null;if(P){const j=h.story;y={kind:"text",segments:P,...j?{story:j}:{}}}}return y?{success:(await Td(y,{block:u.block??"center",behavior:u.behavior??"smooth"})).ok}:{success:!1}}},nE=u=>{const h=(u&&typeof u=="object"?u:null)?.target;return h&&typeof h=="object"?h:null},rE=u=>`metadata:resolve:${u}`,M$=u=>{const h=b()?.metadata;if(!h||typeof h.resolve!="function")return null;const{value:y}=zr(rE(u),Re(),()=>h.resolve({id:u}),nE);return y},D$=async u=>{const h=b()?.metadata;if(!h||typeof h.resolve!="function")return null;try{const y=Re(),_=await Promise.resolve(h.resolve({id:u}));if(y!==Re())return null;const E=nE(_);return U.set(rE(u),{token:y,value:E,hasSettled:!0,inflightToken:null}),E}catch{return null}},O$={getRect:u=>{const h=b()?.metadata;if(!h||typeof h.resolve!="function")return Fl("unavailable");const y=M$(u.id);return y?wg.getRect({target:y}):Fl("unresolved")},scrollIntoView:async u=>{const h=await D$(u.id);return h?{success:(await Td(h,{block:u.block,behavior:u.behavior})).ok}:{success:!1}}},P$={inTable:!1,tableNodeId:null,rowIndex:null,columnIndex:null,cellNodeId:null,rows:null,columns:null},F$={getContext:()=>{const u=Pe();if(!u)return{...P$};const h=Ee()?.table;return{inTable:!0,tableNodeId:u.tableNodeId,rowIndex:u.rowIndex,columnIndex:u.columnIndex,cellNodeId:u.cellNodeId,rows:typeof h?.rows=="number"?h.rows:null,columns:typeof h?.columns=="number"?h.columns:null}},isInTable:()=>Pe()!=null},Cg={query:"",total:0,activeIndex:-1,open:!1,available:!1,caseSensitive:!1,includeTrackedDeletions:!1,includeDeletedText:!1,regex:!1,canReplace:!1,reason:lt.searchUnavailable};let Dn={...Cg};const kg=new Set,nl=()=>{const u=B()?.search;return u&&typeof u=="object"?u:null},ua=()=>{const u=X()?.search;return u&&typeof u=="object"?u:null},_h=()=>{const u=nl();if(u&&typeof u.setSession=="function")return!0;const h=ua();return!!h&&typeof h.query=="function"&&typeof h.getState=="function"},Es=()=>{for(const u of[...kg])try{u(Dn)}catch{}},bi=u=>{Dn={...Dn,...u};const h=u.includeTrackedDeletions??u.includeDeletedText;return h!==void 0&&(Dn.includeTrackedDeletions=h,Dn.includeDeletedText=h),Es(),Dn};let ao=0,Jc=null;const oE=()=>{const u=Jc;Jc=null,u&&Lt(()=>(u(),null),null)},N$=()=>{ao+=1,oE();const u=_h();Dn={...Cg,available:u,reason:u?void 0:lt.searchUnavailable},Es()};pt.push(N$);const B$=u=>{if(!u)return!1;const h=u.queryError;if(h&&typeof h=="object"&&h.code==="invalid-pattern")return!0;const y=u.rejection;return u.status==="rejected"&&!!y&&typeof y=="object"&&y.code==="invalid-pattern"},m2=(u,h=!1)=>{const y=u&&typeof u=="object"?u:null;if(!y)return null;const _=Array.isArray(y.matches)?y.matches:[],E=typeof y.total=="number"&&Number.isFinite(y.total)?y.total:_.length,P=typeof y.activeMatchIndex=="number"?y.activeMatchIndex:typeof y.activeIndex=="number"?y.activeIndex:-1;return{...typeof y.query=="string"?{query:y.query}:{},total:E,activeIndex:P,canReplace:y.canReplace===!0||h,...typeof y.includeDeletedText=="boolean"?{includeDeletedText:y.includeDeletedText}:{},...y.regex===!0?{regex:!0}:{},...B$(y)?{invalidPattern:!0}:{}}},Oo=()=>{const u=we("find.replace"),h=we("find.replaceAll");return u?.enabled===!0||h?.enabled===!0},Po=(u,h=!1)=>{const y=m2(u,h);if(!y){bi({total:0,activeIndex:-1,canReplace:!1,reason:void 0});return}bi({...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})},rl=()=>{const u=nl();if(u&&typeof u.getState!="function")return Dn={...Dn,available:_h(),reason:_h()?void 0:lt.searchUnavailable},Dn;if(!u){const y=ua();if(y&&typeof y.getState=="function"){const _=m2(Lt(()=>y.getState(),null),Oo());if(_)return Dn={...Dn,..._.query!==void 0?{query:_.query}:{},total:_.total,activeIndex:_.activeIndex,canReplace:_.canReplace,available:!0,reason:_.invalidPattern?lt.searchInvalidPattern:void 0,open:Dn.open||!!_.query},Dn}return Dn={...Cg,query:Dn.query,caseSensitive:Dn.caseSensitive,includeTrackedDeletions:Dn.includeTrackedDeletions,includeDeletedText:Dn.includeDeletedText},Dn}const h=m2(Lt(()=>u.getState(),null));return h&&(Dn={...Dn,...h.query!==void 0?{query:h.query}:{},total:h.total,activeIndex:h.activeIndex,canReplace:h.canReplace,...h.includeDeletedText!==void 0?{includeDeletedText:h.includeDeletedText}:{},...h.includeDeletedText!==void 0?{includeTrackedDeletions:h.includeDeletedText}:{},...h.regex!==void 0?{regex:h.regex}:{},available:!0,reason:h.invalidPattern?lt.searchInvalidPattern:void 0,open:Dn.open||!!h.query}),Dn},Ld=u=>{const h=u&&typeof u=="object"?u:null;if(h?.status==="committed")return{ok:!0};if(h?.status==="rejected"&&h.reason==="read-only")return{ok:!1,reason:lt.documentReadonly};const y=h?.rejection;return h?.status==="rejected"&&y&&typeof y=="object"&&y.code==="read-only-document"?{ok:!1,reason:lt.documentReadonly}:{ok:!1,reason:lt.operationUnavailable}},Sg=Tn({get:()=>rl(),subscribe:u=>(kg.add(u),()=>kg.delete(u))}),iE={get:Sg.get,getSnapshot:Sg.getSnapshot,subscribe:Sg.subscribe,observe:Sg.observe,open:()=>_h()?(bi({available:!0,open:!0,reason:void 0}),{ok:!0}):(bi({available:!1,open:!1,reason:lt.searchUnavailable}),{ok:!1,reason:lt.searchUnavailable}),close:()=>{if(ao+=1,Jc)oE();else{const u=nl();if(u&&typeof u.clear=="function")Lt(()=>u.clear(),null);else{const h=ua();h&&typeof h.query=="function"&&Lt(()=>h.query({query:""}),null)}}Dn={...Cg,available:_h(),reason:void 0},Dn.available||(Dn.reason=lt.searchUnavailable),Es()},find:(u,h)=>{const y=nl(),_=!!h?.caseSensitive,E=(h?.includeTrackedDeletions??h?.includeDeletedText)===!0,P=h?.regex===!0,j=++ao;if(!y||typeof y.setSession!="function"){const ue=ua();if(ue&&typeof ue.query=="function"&&typeof ue.getState=="function"){bi({query:u,caseSensitive:_,includeDeletedText:E,regex:P,available:!0,open:!0,reason:void 0}),Jc=()=>{ue.query({query:""})};const xe=Lt(()=>ue.query({query:u,caseSensitive:_,includeDeletedText:E,regex:P}),null);return Pr(xe)?Promise.resolve(xe).then(Ve=>{j===ao&&Po(Ve,Oo())},()=>{j===ao&&bi({available:!1,reason:lt.searchUnavailable})}):Po(xe,Oo()),Po(Lt(()=>ue.getState(),null),Oo()),Dn}return bi({query:u,total:0,activeIndex:-1,available:!1,caseSensitive:_,includeDeletedText:E,regex:P,reason:lt.searchUnavailable})}bi({query:u,caseSensitive:_,includeDeletedText:E,regex:P,available:!0,open:!0,reason:void 0}),Jc=()=>{typeof y.clear=="function"&&y.clear()};const re=Lt(()=>y.setSession(u,{caseSensitive:_,includeDeletedText:E,...P?{regex:!0}:{},highlight:!0}),null);if(Po(re),u.length>0&&Dn.total===0&&Dn.reason!==lt.searchInvalidPattern){const ue=ua();if(ue&&typeof ue.query=="function"&&typeof ue.getState=="function"){const xe=Jc;Jc=()=>{xe?.(),ue.query({query:""})};const Ve=Lt(()=>ue.query({query:u,caseSensitive:_,includeDeletedText:E,regex:P}),null);Pr(Ve)?Promise.resolve(Ve).then(Be=>{j===ao&&Po(Be,Oo())},()=>{j===ao&&bi({available:!1,reason:lt.searchUnavailable})}):Po(Ve,Oo()),Po(Lt(()=>ue.getState(),null),Oo())}}return Dn},search:(u,h)=>iE.find(u,h),next:()=>{const u=nl();if(!u||typeof u.next!="function"){const h=ua();if(!h||typeof h.next!="function"||typeof h.getState!="function")return{ok:!1,reason:lt.searchUnavailable};if(Dn.total===0)return{ok:!1,reason:lt.operationUnavailable};const y=Lt(()=>h.next(),null);if(Pr(y)){const _=ao;Promise.resolve(y).then(E=>{_===ao&&Po(E,Oo())}).catch(()=>{_===ao&&bi({available:!1,reason:lt.searchUnavailable})})}else Po(y,Oo());return Po(Lt(()=>h.getState(),null),Oo()),{ok:!0}}return Dn.total===0?{ok:!1,reason:lt.operationUnavailable}:(Po(Lt(()=>u.next(),null)),{ok:!0})},previous:()=>{const u=nl();if(!u||typeof u.previous!="function"){const h=ua();if(!h||typeof h.previous!="function"||typeof h.getState!="function")return{ok:!1,reason:lt.searchUnavailable};if(Dn.total===0)return{ok:!1,reason:lt.operationUnavailable};const y=Lt(()=>h.previous(),null);if(Pr(y)){const _=ao;Promise.resolve(y).then(E=>{_===ao&&Po(E,Oo())}).catch(()=>{_===ao&&bi({available:!1,reason:lt.searchUnavailable})})}else Po(y,Oo());return Po(Lt(()=>h.getState(),null),Oo()),{ok:!0}}return Dn.total===0?{ok:!1,reason:lt.operationUnavailable}:(Po(Lt(()=>u.previous(),null)),{ok:!0})},clear:()=>{ao+=1;const u=nl();if(u&&typeof u.clear=="function"&&Lt(()=>u.clear(),null),!u||typeof u.clear!="function"){const h=ua();h&&typeof h.query=="function"&&Lt(()=>h.query({query:""}),null)}bi({query:"",total:0,activeIndex:-1,canReplace:!1})},replace:u=>{const h=nl();if(!h){const _=ua();if(!_||typeof _.replace!="function"||typeof _.getState!="function")return{ok:!1,reason:lt.searchUnavailable};if(!Oo())return{ok:!1,reason:lt.operationUnavailable};const E=Lt(()=>_.replace({replacement:typeof u=="string"?u:""}),null);if(Pr(E)){const P=ao;rl(),Es();const j=()=>P===ao;return Promise.resolve(E).then(re=>(j()&&(Po(re,Oo()),rl(),Es()),Ld(re)),()=>(j()&&bi({available:!1,reason:lt.searchUnavailable}),{ok:!1,reason:lt.searchUnavailable}))}return rl(),Es(),Ld(E)}if(typeof h.replaceCurrent!="function")return{ok:!1,reason:lt.operationUnavailable};const y=Lt(()=>h.replaceCurrent(typeof u=="string"?u:""),null);return rl(),Es(),Ld(y)},replaceAll:u=>{const h=nl();if(!h){const _=ua();if(!_||typeof _.replaceAll!="function"||typeof _.getState!="function")return{ok:!1,reason:lt.searchUnavailable};if(!Oo())return{ok:!1,reason:lt.operationUnavailable};const E=Lt(()=>_.replaceAll({replacement:typeof u=="string"?u:""}),null);if(Pr(E)){const P=ao;rl(),Es();const j=()=>P===ao;return Promise.resolve(E).then(re=>(j()&&(Po(re,Oo()),rl(),Es()),Ld(re)),()=>(j()&&bi({available:!1,reason:lt.searchUnavailable}),{ok:!1,reason:lt.searchUnavailable}))}return rl(),Es(),Ld(E)}if(typeof h.replaceAll!="function")return{ok:!1,reason:lt.operationUnavailable};const y=Lt(()=>h.replaceAll(typeof u=="string"?u:""),null);return rl(),Es(),Ld(y)}},sE=Cn(u=>u.styles),_g=Tn(sE),z$={get:_g.get,getSnapshot:_g.getSnapshot,subscribe:_g.subscribe,observe:_g.observe,getCatalog:u=>(Ho(vi(u)),Qi(u).value),getQuickGallery:()=>sE.get().quickGallery,getActiveParagraphStyle:()=>Qa(O.selection,oi().cache).style},aE={select:Kn,get state(){return O},selection:WI,commands:v$,toolbar:y$,comments:w$,trackChanges:S$,contentControls:A$,fonts:I$,zoom:E$,document:T$,viewport:wg,metadata:O$,tables:F$,search:iE,contextMenu:w,styles:z$,formatPainter:{setPointerSelecting(u){V||(p={...p,pointerSelecting:u})},notifyPointerUp(){V||(p={...p,pointerSelecting:!1},UI())},setKeyboardSelecting(u){V||(p={...p,keyboardSelecting:u})},notifyKeyUp(){V||(p={...p,keyboardSelecting:!1},UI())},cancel(){V||lg()},onModeChange(u){return V?()=>{}:(m.add(u),()=>m.delete(u))}},createScope:()=>{const u=[];return{select:(h,y)=>{const _=Kn(h,y);return{get:_.get,subscribe:E=>{const P=_.subscribe(E);return u.push(P),P}}},dispose:()=>{for(const h of u.splice(0))h()}}},destroy:()=>{if(!V){V=!0,SU(Er,Je),rt&&(clearTimeout(rt),rt=null),Te&&(clearTimeout(Te),Te=null,Ye=0),Ae?.timer&&(clearTimeout(Ae.timer),Ae.timer=null),Ae=null,Pt&&(clearTimeout(Pt),Pt=null),ur&&(clearTimeout(ur),ur=null),Tr&&Tr(),Tr=null,Eo=null,Uo=0,Gi=0,Xt.clear(),an.clear(),or.clear(),Yr=null,G.clear();for(const u of Fn.splice(0))u();Mo&&Mo(),Mo=null,Go=null,Do&&Do(),Do=null,_s=null,Oi&&Oi(),Oi=null,ii=null,ai&&ai(),ai=null,si=null,As&&As(),As=null,Yl=null,Ot&&Ot(),Ot=null,Xl=null;for(const u of Rd)bg(u);Rd.clear(),Y.clear(),kg.clear(),g+=1,m.clear(),ao+=1,Ze.clear()}}};return oe=aE,aE}var hH=[{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 pH(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 mH(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"?pH(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 gH(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 vH(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:hH;for(const s of i)o(s);return n}var yH=[{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 bH(e,t){return e.activeMark?t.activeMarks.includes(e.activeMark):!1}Rt();var wH=['[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(", "),CH=800,TI=typeof Blob=="function"?Object.getOwnPropertyDescriptor(Blob.prototype,"size")?.get:void 0,xI=e=>{if(!TI)return!1;try{return TI.call(e),!0}catch{return!1}};function kH(e){return e.key==="Alt"||e.key==="Control"||e.key==="Meta"||e.key==="Shift"||(e.ctrlKey||e.metaKey)&&e.shiftKey&&!e.altKey&&(e.code==="Digit8"||e.key==="8"||e.key==="*")?!0:(e.ctrlKey||e.metaKey)&&["b","c","f","i","s","u"].includes(e.key.toLowerCase())}var SH=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"]),_H=["original","markup","final"],AH=["review","original","final","off"];function RI(e){return _H.includes(e)}function IH(e){return e==="markup"?"review":e}function LI(e){return AH.includes(e)}function EH(e){const t=e.modules?.trackChanges?.mode;if(LI(t))return t;const n=e.layoutEngineOptions?.trackedChanges?.mode;return LI(n)?n:null}function Xm(e,t){const n=e.viewing,r=RI(n?.trackedChanges)?n.trackedChanges:null,o=r?IH(r):t||(e.trackChanges?.visible===!0?"review":"original");return{comments:typeof n?.comments=="boolean"?n.comments:e.comments?.visible===!0,renderMode:o,trackChangesVisible:r?r==="markup":e.trackChanges?.visible===!0}}async function TH(e,t){const n=new IT.default;return e.forEach((r,o)=>{n.file(t[o],r)}),n.generateAsync({type:"blob",compression:"DEFLATE"})}function t2(e){return!!(e&&(e.synced===!0||e.isSynced===!0))}function MI(e){try{e.synced=!0}catch{}try{e.isSynced=!0}catch{}}function xH(e,t){if(!e)return()=>{};if(t2(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=()=>{MI(e),s()},l=c=>{c!==!1&&(c===!0||t2(e))&&(MI(e),s())};return n("synced",a),n("sync",l),t2(e)&&s(),i}function RH(e,t){const n=e.composedPath();if(!n.includes(t))return null;const r=n.find(a=>a instanceof HTMLElement&&a.matches(wH));if(!r)return null;const o=n.some(a=>a instanceof HTMLElement&&a.classList.contains(_p.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 LH(e){if(!e||typeof e!="object")return[];const t=e.items;return Array.isArray(t)?t:[]}function DI(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 OI(e){const t=e.selectionTarget??e.target;if(!t)return null;try{return JSON.stringify(t)}catch{return null}}function gi(e){return!!(e&&typeof e=="object"&&e.editorVersion===2)}function MH(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 PI(e){return typeof e=="string"&&e.length>0?e:null}function FI(e){return e?gi(e)?PI(e.documentId??e.options?.documentId??null):PI(typeof e.getDocumentId=="function"?e.getDocumentId():e.options?.documentId):null}function DH(e){if(!e||gi(e))return null;const t=e;return t.documentRenderer??t.presentationEditor??null}function fs(e){if(!e)return null;if(gi(e))return e.fonts??null;const t=DH(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 Zm=class extends Ig.default{static{this.allowedTypes=[Ar,Ea,ku]}#e;#n;#t;#o;#i;#s;#d;#u;#c;#h;#g;#r;#a;#p;#k;#b;#A;#S;#L;#D;#v;#w;get uiConfig(){return this.#w}#T;get interactionConfig(){return this.#T}#x;get surfacesConfig(){return this.#x}#I;#f;#C;#m;#R;constructor(e){if(super(),this.#e=!1,this.#n=!1,this.#t=null,this.#o=null,this.#i=null,this.#s=null,this.#d=null,this.#u=null,this.#c=null,this.#h=!1,this.#g=!1,this.#r=null,this.#a=null,this.#p=!1,this.#k=null,this.#b=null,this.#A=n=>{this.listenerCount("content-control:active-change")>0&&(this.#p||(this.#k=n.pointerId),this.#p=!0,this.#r="pointer",this.#a=null)},this.#S=n=>{n.pointerId===this.#k&&(this.#p=!1,this.#k=null,this.#r??="pointer",this.#r==="pointer"&&(this.#a=Date.now()+CH))},this.#L=n=>{this.listenerCount("content-control:active-change")>0&&!kH(n)&&(this.#r="keyboard",this.#a=null)},this.#D=n=>{this.#z(n)},this.#v=null,this.#w=zA({}),this.#T=VA({}),this.#x=UA({}),this.version="0.0.0",this.users=[],this.whiteboard=null,this.colors=[],this.readyEditors=0,this.pendingCollaborationSaves=0,this.#f=new wz,this.#C=null,this.#m=!1,this.#R=null,this.config={selector:"#superdoc",documentMode:"editing",allowSelectionInViewMode:!1,role:"editor",documents:[],editorExtensions:[],colors:[],users:[],user:{...Ob},layoutEngineOptions:{},modules:{},licenseKey:void 0,telemetry:{enabled:!0},title:"SuperDoc",conversations:[],isInternal:!1,comments:{visible:!1},toolbarGroups:["left","center","right"],toolbarIcons:{},toolbarTexts:{},uiDisplayFallbackFont:"Arial, Helvetica, sans-serif",isDev:!1,disablePiniaDevtools:!1,onEditorBeforeCreate:()=>null,onEditorCreate:()=>null,onEditorDestroy:()=>null,onSourceComplete:()=>null,onSourceSignalsComplete:()=>null,onContentError:()=>null,onReady:()=>null,onCommentsUpdate:()=>null,onContentControlActiveChange:()=>null,onContentControlClick:()=>null,onAwarenessUpdate:()=>null,onLocked:()=>null,onPdfDocumentReady:()=>null,onSidebarToggle:()=>null,onCollaborationReady:()=>null,onEditorUpdate:()=>null,onCommentsListChange:()=>null,onException:()=>null,onListDefinitionsChange:()=>null,onPaginationUpdate:()=>null,onTransaction:()=>null,disableContextMenu:!1,viewOptions:{layout:"print"},useLayoutEngine:!0},this.#ne=new WeakSet,this.#re=null,this.#W=null,this.#B=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.#I=new YB({getModuleConfig:()=>this.#x}),this.#u=t,t.addEventListener("pointerdown",this.#A,!0),t.ownerDocument.addEventListener("pointerup",this.#S,!0),t.ownerDocument.addEventListener("pointercancel",this.#S,!0),t.addEventListener("keydown",this.#L,!0),t.addEventListener("click",this.#D,!0),this.#l("content-control:active-change",e.onContentControlActiveChange),this.#Y(e,t),this.#g=!0,this.listenerCount("content-control:active-change")>0&&this.ui}async#z(e){const t=this.#u;if(!t)return;const n=RH(e,t),r=this.activeEditor?.doc?.contentControls?.list;if(!(!n||typeof r!="function"))try{const o=await r();if(this.#e)return;const i=DI(LH(o).find(s=>s.id===n));i&&this.emit("content-control:click",{target:i,source:"pointer"})}catch{return}}async#Y(e,t){this.#R=EH(e),this.config={...this.config,...e,modules:{...this.config.modules,...e.modules},layoutEngineOptions:{...this.config.layoutEngineOptions,...e.layoutEngineOptions}},typeof this.config.viewing?.comments=="boolean"&&(this.config.comments={...this.config.comments,visible:this.config.viewing.comments}),!this.config.comments||typeof this.config.comments!="object"?this.config.comments={visible:!1}:typeof this.config.comments.visible!="boolean"&&(this.config.comments.visible=!1),Db(this.config),this.config.documents=this.config.documents||[],this.config.layoutEngineOptions=this.config.layoutEngineOptions||{};const n=this.config.viewOptions?.layout==="web",r=this.config.layoutEngineOptions?.flowMode==="semantic";if(!n&&r&&(console.warn("[SuperDoc] flowMode 'semantic' is only valid with web layout. Coercing to 'paginated'."),this.config.layoutEngineOptions.flowMode="paginated"),this.editorVersion=2,this.#Le(),this.config.user=iz(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=SS(this.config.modules.comments),this.#w=zA(this.config),this.#T=VA(this.config),this.#x=UA(this.config),this.config.disableContextMenu=!this.#w.contextMenu.enabled,this.config.rulers=this.#w.ruler.enabled,this.#w.comments.enabled?this.config.modules.comments===!1&&(this.config.modules.comments={}):this.config.modules.comments=!1,this.#w.comments.enabled){this.config.modules.comments===!0&&(this.config.modules.comments={});const i=this.config.modules.comments;i&&(i.readOnly=this.#T.comments.readOnly,i.allowResolve=this.#T.comments.allowResolve)}if(this.config.colors=OT(this.config.colors),this.userColorMap=new Map,this.colorIndex=0,this.version="2.11.1-next.2",this.#E("π¦ [superdoc] Using SuperDoc version:",this.version),this.superdocId=e.superdocId||ol(),this.colors=this.config.colors??[],this.#_(),await WR(),this.#e)return;if(await this.#j(this.config.modules),this.#e){this.#me();return}this.user=this.config.user,this.users=this.config.users||[],this.socket=null,this.isDev=this.config.isDev||!1,this.activeEditor=null,this.comments=[],this.#C||(this.#C=this.#f.subscribe(i=>{this.#De(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.#Z(),this.#O(),this.#Oe(),this.#V()}#V(){if(this.#M(),this.readyEditors=0,!this.app)throw new Error("SuperDoc: #startRuntime called before #initVueApp populated this.app");this.app.mount(this.#d)}#O(){const e=this.config.modules?.whiteboard,t=e!==!1&&(e?.enabled??!1);this.whiteboard=new CF({Renderer:WB,superdoc:this,enabled:t}),this.emit("whiteboard:init",{whiteboard:this.whiteboard})}get requiredNumberOfEditors(){return this.#y("requiredNumberOfEditors").documents.filter(e=>e.type===Ar).length}get ui(){return this.#v||(this.#v=fH({superdoc:this}),this.#e&&this.#v.destroy()),this.#X(),this.#v}on(e,t,n){return super.on(e,t,n),e==="content-control:active-change"&&this.#g&&this.ui,this}addListener(e,t,n){return super.addListener(e,t,n),e==="content-control:active-change"&&this.#g&&this.ui,this}once(e,t,n){return super.once(e,t,n),e==="content-control:active-change"&&this.#g&&this.ui,this}removeListener(e,t,n,r){return super.removeListener(e,t,n,r),this.#P(),this}off(e,t,n,r){return super.off(e,t,n,r),this.#P(),this}removeAllListeners(e){return super.removeAllListeners(e),this.#P(),this}#P(){this.listenerCount("content-control:active-change")>0||(this.#c?.(),this.#c=null,this.#b=null,this.#r=null,this.#a=null,this.#p=!1,this.#k=null)}#X(){if(this.#c||this.#h||!this.#v||this.#e||this.listenerCount("content-control:active-change")===0)return;let e=null,t=[],n=null,r=null,o=!0;this.#h=!0;try{n=this.#v.selection.observe(s=>{if(o){o=!1;return}if(s.status!=="ready")return;const a=OI(s);if(!a)return;this.#r==="pointer"&&this.#a!==null&&Date.now()>this.#a&&(this.#r=null,this.#a=null);const l=this.#r??(this.#p?"pointer":null),c=this.activeEditor;(l||this.#b?.editor!==c||this.#b.key!==a)&&(this.#b={editor:c,key:a,source:l??"keyboard"}),this.#r=null,this.#a=null}),r=this.#v.contentControls.observe(s=>{const a=this.activeEditor,l=s.activeIds.map(v=>DI(s.items.find(k=>k.id===v)));if(l.some(v=>v===null))return;const c=l,d=a===e,f=c.length===t.length&&c.every((v,k)=>v.id===t[k]?.id);if(d&&f)return;if(c.length===0&&t.length===0){e=a;return}const p=d?t[0]??null:null;e=a,t=c;const g=OI(this.#v.selection.getSnapshot()),m=this.#b;this.emit("content-control:active-change",{active:c[0]??null,previous:p,activePath:c,source:g&&m?.editor===a&&m.key===g?m.source:"keyboard"})});const i=()=>{n?.(),r?.()};this.#e||this.listenerCount("content-control:active-change")===0?i():this.#c=i}catch(i){throw n?.(),r?.(),i}finally{this.#h=!1}}get state(){return{documents:this.#y("state").documents.map(e=>bl(e.data)?{...e,data:Py(e.data,e.type||"application/vnd.openxmlformats-officedocument.wordprocessingml.document")}:e),users:this.users}}getDocumentRuntimeForDocument(e){return typeof e!="string"||e.length===0?null:(this.superdocStore?.documents??[]).find(t=>t?.getEditor?.()?.options?.documentId===e)?.getDocumentRuntime?.()??null}getComment(e){return typeof e!="string"||e.length===0?null:this.commentsStore?.getComment?.(e)??null}get element(){return typeof this.config.selector=="string"?document.querySelector(this.config.selector):this.config.selector}#_(){const e=this.config.document,t=!!e&&typeof e=="object"&&(bl(e)||typeof Blob=="function"&&e instanceof Blob||Object.keys(e).length>0),n=typeof e=="string"&&e.length>0,r=this.config.documents&&this.config.documents?.length;if((t||n)&&r&&console.warn("π¦ [superdoc] You can only provide one of document or documents"),t){const o=Ny(e);this.config.documents=[{id:ol(),...o}]}else n&&(this.config.documents=[{id:ol(),type:Ar,url:this.config.document,name:"document.docx"}]);Array.isArray(this.config.documents)&&this.config.documents.length>0&&(this.config.documents=this.config.documents.map(o=>{const i=Ny(o);if(!i||typeof i!="object")return i;const s=typeof i=="object"&&"id"in i&&i.id||o&&typeof o=="object"&&"id"in o&&o.id;return{...i,id:s||ol()}}))}#M(){const{app:e,pinia:t,superdocStore:n,commentsStore:r,highContrastModeStore:o}=lF({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.#I),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&&LR(this),this.#se()}#l(e,t){t&&this.on(e,t)}#Z(){this.#l("editorBeforeCreate",this.config.onEditorBeforeCreate),this.#l("editorCreate",this.config.onEditorCreate),this.#l("editorDestroy",this.config.onEditorDestroy),this.#l("source:complete",this.config.onSourceComplete),this.#l("source:signals-complete",this.config.onSourceSignalsComplete),this.#l("ready",this.config.onReady),this.#l("comments-update",this.config.onCommentsUpdate),this.#l("content-control:click",this.config.onContentControlClick),this.#l("awareness-update",this.config.onAwarenessUpdate),this.#l("locked",this.config.onLocked),this.#l("pdf:document-ready",this.config.onPdfDocumentReady),this.#l("sidebar-toggle",this.config.onSidebarToggle),this.#l("collaboration-ready",this.config.onCollaborationReady),this.on("collaboration-ready",e=>this.#J(e?.editor??null)),this.#l("editor-update",this.config.onEditorUpdate),this.#l("tracked-changes:bulk-decision",this.config.onTrackedChangesBulkDecision),this.on("content-error",this.onContentError),this.#l("exception",this.config.onException),this.#l("list-definitions-change",this.config.onListDefinitionsChange),this.#l("pagination-update",this.config.onPaginationUpdate),this.#l("fonts-resolved",this.config.onFontsResolved),this.#l("fonts-changed",this.config.onFontsChanged),this.#l("zoomChange",this.config.onZoomChange),this.#l("viewport-change",this.config.onViewportChange),this.#l("page-margins-change",this.config.onPageMarginsChange)}async#j({collaboration:e}={}){return e?(this.isCollaborative=!1,this.config.documents.length===0&&(this.config.documents=[{id:ol(),type:Ar,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}#ae(e,t){this.isCollaborative=!0,this._commentsCollabInitialized=!1,this.ydoc=ro(e),this.provider=ro(t),this.#ve();const n=this.config;this._cleanupAwareness=IR(t,this,n.user),n.documents.forEach(r=>{r.ydoc=e,r.provider=t,r.role=this.config.role})}#Q(){this.#s=null,this.#F(),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})}#F(){if(this.#o){try{this.#o()}catch{}this.#o=null}if(this.#i){try{this.#i()}catch{}this.#i=null}}#J(e){this.#F(),gi(e)&&(this.#ee(e),this.#te(e))}#ee(e){const t=e.presence;if(!t||typeof t.subscribe!="function")return;const n=vF(()=>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.#o=t.subscribe(r)}catch(o){console.warn("[SuperDoc] v2 awareness bridge failed to subscribe",o)}}#te(e){const t=e.lock;if(!t||typeof t.subscribe!="function")return;const n=r=>{this.#e||this.#U(!!r.isLocked,this.#le(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)}}#le(e){return!e||typeof e!="object"||Array.isArray(e)?null:{...e}}#ge(e,t){return JSON.stringify(e??null)===JSON.stringify(t??null)}#U(e,t){this.isLocked===e&&this.#ge(this.lockedBy,t)||(this.isLocked=e,this.lockedBy=t,this.#E("π¦ [superdoc] Locking superdoc:",e,t,`
|
|
103
103
|
|
|
104
104
|
|
|
105
105
|
`),this.emit("locked",{isLocked:e,lockedBy:t}))}#ve(){const e=this.config.user;if(!e||e.color)return;const t=this.colors.length>0?this.colors:SH,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.#Ee(e);this.#n=!0;try{const n=await this.#Ie(),r=this.#be(),o=this.#ye();this.#Ce();try{this.#s=o;const i=await this.#_e(t,n);this.#Ae(i,t),this.#s=null}catch(i){throw this.#we(r),i}}finally{this.#t=null,this.#n=!1}}#ye(){return{isLocked:this.isLocked,lockedBy:this.lockedBy?{...this.lockedBy}:null}}#be(){const e=this.config.documents.find(r=>r.type===Ar),t=this.superdocStore?.documents.find(r=>r.id===e.id)??null,n=t?gn(t):null;return{isCollaborative:this.isCollaborative,configV2Collaboration:e.v2Collaboration??null,configData:e.data,storeDoc:t,storeV2Collaboration:this.#Se(n),storeData:t?.data}}#we(e){this.#s=null;const t=this.config.documents.find(n=>n.type===Ar);t.v2Collaboration=e.configV2Collaboration,t.data=e.configData,this.isCollaborative=e.isCollaborative,e.storeDoc&&(e.storeDoc.data=e.storeData,this.#$(e.storeDoc,e.storeV2Collaboration))}#Ce(){if(this.#e)throw new Error("SuperDoc: instance was destroyed during upgrade")}#y(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}#Be(e){if(!this.commentsStore)throw new Error(`SuperDoc: ${e} requires the instance to be ready; wait for the "ready" event before calling.`);return this.commentsStore}#H(e){if(!this.superdocStore)throw new Error(`SuperDoc: ${e} requires the instance to be ready; wait for the "ready" event before calling.`)}#ke(e,t){const n=this.superdocStore?.documents;if(Array.isArray(n))for(const r of n){const o=gn(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)}}#Se(e){if(!e)return null;const t=e.v2Collaboration;return t&&typeof t=="object"&&"value"in t?t.value:t??null}#$(e,t){const n=gn(e).v2Collaboration;if(n&&typeof n=="object"&&"value"in n){n.value=t;return}e.v2Collaboration=t}#ce(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#_e(e,t){const n=this.config.documents.find(s=>s.type===Ar),r=this.#y("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(!gi(o)||typeof o.upgradeToCollaboration!="function")throw new Error("SuperDoc: live v2 editor cannot attach collaboration in place");const i=this.#ce({...e,roomMode:"create"});return n.v2Collaboration=i,this.#$(r,i),this.isCollaborative=!0,await o.upgradeToCollaboration(t,i),n.data=t,r.data=t,{configDoc:n,storeDoc:r}}#Ae(e,t){const n=this.#ce({...t,roomMode:"join"});e.configDoc.v2Collaboration=n,this.#$(e.storeDoc,n)}async#Ie(){const e=this.activeEditor;if(gi(e)&&typeof e.save=="function"){const r=await e.save();return this.#N(r)}const t=this.config.documents.find(r=>r.type===Ar),n=(this.superdocStore?.documents.find(r=>r.id===t.id)??null)?.data??t.data;if(n instanceof Blob)return n;if(bl(n))return this.#N(n);throw new Error("SuperDoc: upgradeToCollaboration() requires a live v2 editor save or DOCX Blob source")}#N(e){if(e instanceof Blob)return e;if(bl(e))return Py(e,Ar);throw new Error("SuperDoc: active v2 editor returned an unsupported DOCX save payload")}#ue(e,t){const n=FI(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.#N(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.#$(s,i))}#ze(){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}#Ve(){this.#Q(),this.#ke(null,null)}#je(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))})}#Ue(e){return new Promise((n,r)=>{let o,i=!1,s=()=>{};const a=()=>{i=!0,clearTimeout(o),s()};s=xH(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")))}})}#Ee(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(l=>l.type===Ar);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(!gi(this.#xe()))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=V_({v2Collaboration:e.v2Collaboration??this.#Te(r.v2Collaboration)??i?.v2Collaboration??i?.v2??null,legacyCollaboration:s,documentType:Ar,documentCount:t.documents.length,...typeof window<"u"?{authEndpointBaseUrl:window.location.href}:{}});if(!a.ok)throw new Error(`SuperDoc: upgradeToCollaboration() ${a.reason}: ${a.message}`);return{target:a.target}}#Te(e){return e&&typeof e=="object"&&"value"in e?e.value:e}#xe(){const e=this.config.documents.find(n=>n.type===Ar),t=this.#y("upgradeToCollaboration").documents.find(n=>n.id===e.id)?.getEditor?.();if(!t)throw new Error("SuperDoc: source editor not yet created β wait for the ready event before upgrading");return t}addSharedUser(e){this.#H("addSharedUser");const t=Su({actor:e});t&&this.users.some(n=>Su({actor:n})===t)||this.users.push(e)}removeSharedUser(e){this.#H("removeSharedUser");const t=typeof e=="string"?Ey(e):"",n=typeof e=="string"?`email:${t}`:Su({actor:e});this.users=this.users.filter(r=>{const o=Su({actor:r});return n?o!==n:t?Ey(r.email)!==t:!0})}onContentError({error:e,editor:t}){const n=t.options?.documentId,r=this.#y("onContentError").documents.find(a=>a.id===n),o=typeof r?.id=="string"?r.id:typeof n=="string"?n:"",i=r?.data,s=xI(i)?i:bl(i)?this.#N(i):i==null?i:void 0;this.config.onContentError?.({error:e,editor:t,documentId:o,file:s})}broadcastPdfDocumentReady(){this.emit("pdf:document-ready")}broadcastReady(){this.readyEditors===this.requiredNumberOfEditors&&this.emit("ready",{superdoc:this})}broadcastEditorBeforeCreate(e){this.emit("editorBeforeCreate",{editor:AA(e)})}broadcastEditorCreate(e){this.readyEditors++,this.broadcastReady(),this.#Re(e),this.emit("editorCreate",{editor:AA(e)})}broadcastSourceComplete(){this.emit("source:complete")}broadcastSourceSignalsComplete(){this.emit("source:signals-complete")}#ne;#Re(e){if(!e||typeof e.on!="function"||this.#ne.has(e))return;this.#ne.add(e),e.on("fonts-changed",n=>{this.#de(e)&&this.#G(n)});const t=(e.documentRenderer??e.presentationEditor)?.getLastFontsChangedPayload?.();t&&this.#de(e)&&this.#G(t)}#de(e){return!this.activeEditor||e===this.activeEditor}#re;#G(e){this.#re=e,this.emit("fonts-changed",e)}broadcastEditorDestroy(){this.emit("editorDestroy")}broadcastSidebarToggle(e){this.emit("sidebar-toggle",e)}#Le(){Array.isArray(this.config.editorExtensions)&&this.config.editorExtensions.length>0&&console.warn("[SuperDoc] `editorExtensions` is ignored by superdoc@2. Use `extensions` with `defineSuperDocExtension`. ProseMirror APIs such as `Node.create`, `Mark.create`, `addPmPlugins`, and custom schemas do not run in v2."),this.config.modules.ai&&console.warn("[SuperDoc] `modules.ai` is deprecated and will be removed in v3. Use `ui.toolbar.customItems` for the action, make the model request in your application, and apply the result with `doc.insert()` or `doc.replace()`.")}#E(...e){(console.debug?console.debug:console.log)("π¦ π¦ΈββοΈ [superdoc]",...e)}#W;get fonts(){return this.#W||(this.#W={getReport:()=>fs(this.activeEditor)?.getReport()??[],getMissingFonts:()=>fs(this.activeEditor)?.getMissingFonts()??[],getDocumentFontOptions:()=>fs(this.activeEditor)?.getDocumentFontOptions()??[],getFontFamilyOptions:()=>fs(this.activeEditor)?.getFontFamilyOptions()??[],getDocumentFonts:()=>fs(this.activeEditor)?.getDocumentFonts()??[],onReport:e=>{const t=this.activeEditor,n=t?fs(t)?.getLastFontsChangedPayload?.()??null:this.#re??null;return n&&e(n),this.on("fonts-changed",e),()=>this.off("fonts-changed",e)},map:e=>{if(!e||typeof e!="object"||Array.isArray(e))throw new TypeError("superdoc.fonts.map requires a mapping object, for example { Aptos: 'Carlito' }");const t=fs(this.activeEditor);if(!t)throw new Error("superdoc.fonts.map requires an active editor");t.map(e)},unmap:e=>{const t=fs(this.activeEditor);if(!t)throw new Error("superdoc.fonts.unmap requires an active editor");t.unmap(e)},add:e=>{const t=fs(this.activeEditor);if(!t)throw new Error("superdoc.fonts.add requires an active editor");t.add(e)},preload:e=>{const t=fs(this.activeEditor);if(!t)throw new Error("superdoc.fonts.preload requires an active editor");return t.preload(e)}}),this.#W}#K(){const e=this.activeEditor!==null;this.#fe(),this.activeEditor=null,this.toolbar?.setActiveEditor?this.toolbar.setActiveEditor(null):this.toolbar&&(this.toolbar.activeEditor=null),e&&this.emit("active-editor-change")}#B;#fe(){if(this.#B){try{this.#B()}catch{}this.#B=null}}#Me(e){this.#fe();const t=fs(e);if(!t?.onChanged)return;const n=t.getLastFontsChangedPayload?.();n&&this.#G(n),this.#B=t.onChanged(r=>this.#G(r))}#De(e,t){this.#m=!0;try{if(e===null){this.#K();return}this.#f.get(e)?.kind==="v2"&&gi(t)?this.#he(t):this.#K()}finally{this.#m=!1}}#he(e){if(gi(e)){!this.#m&&this.#f.getActive()&&this.#f.setActive(null,"set-active-v2-facade");const t=this.activeEditor;this.activeEditor=e,this.#Me(e),this.toolbar?.setActiveEditor?.(e),t!==this.activeEditor&&this.emit("active-editor-change");return}this.#K()}setActiveEditor(e){this.#he(e)}getV2FeatureMatrix(){return[{feature:"source.docx-bytes",status:"supported",reason:"SuperDoc normalizes File/Blob/ArrayBuffer/Uint8Array DOCX inputs for the separate DOCX Engine dependency"},{feature:"source.url",status:"supported",reason:"shell-owned source normalization resolves URL-backed DOCX inputs before opening the injected v2 editor"},{feature:"source.blank",status:"supported",reason:"shell-owned blank-document seeding resolves to DOCX bytes before mounting the injected v2 editor"},{feature:"execution.browser-worker",status:"supported",reason:"the shipped public v2 shell opens DOCX documents through the browser-worker path by default when collaboration is not active"},{feature:"distribution.cdn-iife",status:"supported",reason:"the CDN/IIFE distribution ships the public bundle plus the emitted v2 browser-worker asset and opens DOCX documents through the worker-backed v2 runtime"},{feature:"docx.open-render",status:"supported",reason:"superdoc@2 opens and renders DOCX documents through its DOCX Engine dependency"},{feature:"docx.review-handles",status:"supported",reason:"Comment/tracked-change list + decide via v2 host handles"},{feature:"shell.toolbar",status:"supported",reason:"new SuperDoc({ toolbar }) mounts the rendered built-in toolbar shell and the superdoc.toolbar handle, both backed by the V2 command controller and the internal compatibility catalog. Explicit item-level limits stay fail-closed in the shared command matrix (for example search replace and copyFormat)."},{feature:"shell.rich-formatting",status:"supported",reason:"Rich inline, paragraph, and list formatting route through the V2 command controller and public Document API (format.* / styles.* / lists.*): bold, italic, underline, strikethrough, font family/size, text/highlight color, alignment, line spacing, linked styles, bullet/numbered lists, indent, and clear formatting."},{feature:"shell.comments-sidebar",status:"supported",reason:"ui-phase3-002: v2 comments adapter routes create/reply/edit/resolve/delete through V2EditorHost.dispatch"},{feature:"shell.comments-sidebar.reopen",status:"supported",reason:'ui-phase3-002: v2 comments sidebar reopens resolved threads through the v2 comments adapter (activeEditor.doc.comments.patch({ status: "active" }))'},{feature:"shell.tracked-change-sidebar",status:"supported",reason:"SD-3722: v2 tracked-change adapter lists and decides exact body, header/footer-part, and note targets"},{feature:"shell.tracked-change-sidebar.bulk",status:"supported",reason:"SD-4039/SD-4040: the shipped v2 command posture exposes all-story Accept All and Reject All through the canonical doc.trackChanges.decide({ target: { kind: 'all' } }) mutation"},{feature:"shell.tracked-change-sidebar.non-body",status:"supported",reason:"SD-3722: public v2 shell hydrates and targets header/footer-part and note tracked changes"},{feature:"shell.comments-sidebar.persistence",status:"supported",reason:"ui-phase3-004: comment create/reply/edit/resolve/delete persist through SuperDoc.export() β re-mount via the v2 host save bridge"},{feature:"shell.tracked-change-sidebar.persistence",status:"supported",reason:"ui-phase3-004: tracked-change accept/reject persist through SuperDoc.export() β re-mount via the v2 host save bridge"},{feature:"shell.comments-sidebar.author-required",status:"supported",reason:"ui-phase3-004: v2 comments adapter surfaces commentCommandsReason=author-required from the host capability matrix; write controls disable and forced dispatch reports ok:false"},{feature:"shell.find-replace",status:"supported",reason:"Ctrl/Cmd+F opens the SuperDoc find/replace surface in v2; find/navigation/replace/replaceAll route through the single host search session (host.search) via ui.search, with replace failing closed in viewing/read-only mode"},{feature:"shell.ai-writer",status:"supported",reason:"built-in toolbar renders the modules.ai-gated AI writer and applies generated text through the public Document API facade"},{feature:"shell.collaboration",status:"supported",reason:"v2 single-doc 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.#f.register(e)}unregisterEditorRuntime(e){return this.#f.unregister(e)}getActiveRuntime(){return this.#f.getActive()}setActiveRuntime(e,t){this.#f.setActive(e,t)}resolveRuntimeFromEventTarget(e){return this.#f.resolveFromEventTarget(e)}activateRuntimeFromEventTarget(e,t){const n=this.#f.resolveFromEventTarget(e);return n?(this.#f.setActive(n.id,t),!0):!1}toggleRuler(){const e=this.#y("toggleRuler");this.config.rulers=!this.config.rulers,e.documents.forEach(t=>{t.rulers=this.config.rulers}),this.toolbar?.updateToolbarState?.()}canPerformPermission({permission:e,role:t=this.config.role,isInternal:n=this.config.isInternal,comment:r=null,trackedChange:o=null}={}){if(!e)return!1;let i=r??o?.comment??null;const s=o?.commentId||o?.id;if(!i&&s&&this.commentsStore?.getComment){const a=this.commentsStore.getComment(s),l=a?.getValues;i=typeof l=="function"?l.call(a):a}return Fa(e,t,n,{superdoc:this,currentUser:this.config.user,comment:i??null,trackedChange:o??null})}#Oe(){const e=this.config.modules?.toolbar,t=e&&typeof e=="object"?e:{},n=this.#w.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=aU({...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 bM(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.#w.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.#H("setDocumentMode");const t=e.toLowerCase(),n=this.config.role==="viewer"?"viewing":this.config.role==="suggester"&&t==="editing"?"suggesting":t;this.config.documentMode=n,Db(this.config),this.#se();const r={viewing:()=>this.#ie(),editing:()=>this.#Pe(),suggesting:()=>this.#pe()};r[n]&&(r[n](),this.emit("document-mode-change",{documentMode:n}))}#oe(e,t){const n=typeof e.id=="string"&&e.id.length>0?e.id:null;if(n){const i=this.#f.getAllByDocumentId(n);if(i.length>0){for(const s of i)s.setDocumentMode(t);return}}const r=typeof e.getDocumentRuntime=="function"?e.getDocumentRuntime():null;if(typeof r?.setDocumentMode=="function"){r.setDocumentMode(t);return}const o=typeof e.getEditor=="function"?e.getEditor():null;o&&typeof o.setDocumentMode=="function"&&o.setDocumentMode(t)}setTrackedChangesPreferences(e){typeof e?.enabled=="boolean"&&(this.config.modules.trackChanges={...this.config.modules.trackChanges,enabled:e.enabled}),this.#q(e)}#q(e){const t=e&&Object.keys(e).length?{...e}:void 0;this.config.layoutEngineOptions||(this.config.layoutEngineOptions={}),this.config.layoutEngineOptions.trackedChanges=t,this.superdocStore?.documents?.forEach(n=>{let r=!1;const o=typeof n.id=="string"&&n.id.length>0?n.id:null;if(o)for(const s of this.#f.getAllByDocumentId(o))s.setTrackedChangesRenderOptions(t),r=!0;if(r)return;const i=typeof n.getDocumentRuntime=="function"?n.getDocumentRuntime():null;i?.setTrackedChangesOverrides&&i.setTrackedChangesOverrides(t)})}setViewingOptions(e){if(!e||typeof e!="object")return;this.#H("setViewingOptions");const t=Xm(this.config,this.#R),n={...this.config.viewing},r=typeof e.comments=="boolean",o=RI(e.trackedChanges);if(!(!r&&!o)&&(r&&(n.comments=e.comments),o&&(n.trackedChanges=e.trackedChanges),this.config.viewing=n,typeof n.comments=="boolean"&&(this.config.comments={...this.config.comments,visible:n.comments}),o&&Db(this.config),this.#se(),this.config.documentMode==="viewing")){const i=Xm(this.config,this.#R),s=t.comments||t.trackChangesVisible,a=i.comments||i.trackChangesVisible;this.#ie({updateTrackedChangesProjection:o,updateCommentVisibility:s!==a})}}#Pe(){if(this.config.role!=="editor")return this.#pe();const e=this.#y("setDocumentMode");if(e.documents.length>0){const t=e.documents[0]?.getEditor();t&&this.setActiveEditor(t)}this.#q({mode:"review",enabled:!0}),e.documents.forEach(t=>{t.restoreComments?.(),this.#oe(t,"editing")})}#pe(){if(!["editor","suggester"].includes(this.config.role??""))return this.#ie();const e=this.#y("setDocumentMode");if(e.documents.length>0){const t=e.documents[0]?.getEditor();t&&this.setActiveEditor(t)}this.#q({mode:"review",enabled:!0}),e.documents.forEach(t=>{t.restoreComments?.(),this.#oe(t,"suggesting")})}#ie(e={}){const t=this.#y("setDocumentMode");this.toolbar?.setActiveEditor?this.toolbar.setActiveEditor(null):this.toolbar&&(this.toolbar.activeEditor=null);const n=Xm(this.config,this.#R),r=n.comments,o=n.trackChangesVisible;e.updateTrackedChangesProjection!==!1&&this.#q({mode:n.renderMode,enabled:this.config.modules.trackChanges?.enabled??!0}),e.updateCommentVisibility!==!1&&!r&&!o&&this.commentsStore?.clearEditorCommentPositions?.(),t.documents.forEach(i=>{e.updateCommentVisibility!==!1&&(r||o?i.restoreComments?.():i.removeComments?.()),this.#oe(i,"viewing")})}#se(){const e=Xm(this.config,this.#R),t=e.comments,n=e.trackChangesVisible,r=this.config.documentMode==="viewing",o=t||n;this.commentsStore?.setViewingVisibility&&this.commentsStore.setViewingVisibility({documentMode:this.config.documentMode,commentsVisible:t,trackChangesVisible:n});const i=this.superdocStore?.documents;Array.isArray(i)&&i.length>0&&i.forEach(s=>{const a=typeof s.getDocumentRuntime=="function"?s.getDocumentRuntime():null;a?.setViewingCommentOptions&&a.setViewingCommentOptions({emitCommentPositionsInViewing:r&&o,enableCommentsInViewing:r&&t})})}search(e){const t=this.activeEditor?.commands,n=t?.search;if(typeof n=="function")return n.call(t,e,{searchModel:"visible"})}goToSearchResult(e){const t=this.activeEditor?.commands,n=t?.goToSearchResult;if(typeof n=="function")return!!n.call(t,e)}getZoom(){return this.superdocStore?.activeZoom??100}setZoom(e){if(typeof e!="number"||!Number.isFinite(e)||e<=0){console.warn("[SuperDoc] setZoom expects a positive number representing percentage");return}if(!this.superdocStore){console.warn("[SuperDoc] setZoom called before initialization; use config.zoom.initial for the starting zoom");return}this.superdocStore.activeZoom=e,this.superdocStore.zoomMode="manual",this.emit("zoomChange",{zoom:e,mode:"manual"})}setZoomMode(e){if(e!=="manual"&&e!=="fit-width"){console.warn("[SuperDoc] setZoomMode expects 'manual' or 'fit-width'");return}if(!this.superdocStore){console.warn("[SuperDoc] setZoomMode called before initialization; use config.zoom.mode for the starting mode");return}this.superdocStore.zoomMode!==e&&(this.superdocStore.zoomMode=e,this.emit("zoomChange",{zoom:this.getZoom(),mode:e}))}getZoomState(){const e=vS(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(gi(t)&&typeof t.lock?.setLocked=="function"){t.lock.setLocked(e,e?{...this.user}:null);const n=t.lock.getSnapshot?.();n&&this.#U(!!n.isLocked,this.#le(n.lockedBy??null));return}this.config.documents.forEach(n=>{const r=n.ydoc;if(!r)return;const o=r.getMap("meta");r.transact(()=>{o.set("locked",e),e?o.set("lockedBy",this.user):o.delete("lockedBy")})}),this.#U(e,e?this.user:null)}getHTML(e={}){const t=[];return this.#y("getHTML").documents.forEach(n=>{const r=n.getEditor?.();r&&t.push(r)}),t.map(n=>n.getHTML(e))}lockSuperdoc(e=!1,t=null){this.#U(e,t)}async export({exportType:e=["docx"],commentsType:t="external",exportedName:n,additionalFiles:r=[],additionalFileNames:o=[],isFinalDoc:i=!1,triggerDownload:s=!0,fieldsHighlightColor:a=null}={}){if(!Array.isArray(e)||e.length!==1||e[0]!=="docx")throw new TypeError('SuperDoc.export() only supports exportType: ["docx"].');const l=h4(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?f4(d[0],l,e[0]):d[0];const p=await TH(d,f);return s?f4(p,l,"zip"):p}async replaceFile(e){const t=this.activeEditor;if(gi(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.#ue(t,e),this.emit("document-replaced",{editor:t,host:t?.host})),r}const n=t&&!gi(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.#ue(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.#y("exportEditorsToDOCX").documents.map(async d=>{if(!d||d.type!=="application/vnd.openxmlformats-officedocument.wordprocessingml.document")return null;const f=typeof d.getEditor=="function"?d.getEditor():null,p=()=>xI(d.data)?d.data.type&&d.data.type!=="application/vnd.openxmlformats-officedocument.wordprocessingml.document"?null:d.data:bl(d.data)?this.#N(d.data):null;if(!f||typeof f.exportDocx!="function")return p();const g=f.editorVersion===2;try{const m=await f.exportDocx(g?{isFinalDoc:t,commentsType:e,fieldsHighlightColor:n}:{isFinalDoc:t,comments:s(),commentsType:e,fieldsHighlightColor:n});if(m)return m}catch(m){if((!m||typeof m!="object"||!a.has(m))&&this.emit("exception",{error:m,document:d}),g&&(e==="clean"||MH(m)))throw m}return p()});return(await Promise.all(c)).filter(d=>d!=null)}finally{this.off("exception",l)}}async#Fe(){this.#E("π¦ [superdoc] Triggering collaboration saves");const e=this.#y("save");return new Promise(t=>{e.documents.forEach((n,r)=>{if(this.#E(`Before reset - Doc ${r}: pending = ${this.pendingCollaborationSaves}`),this.pendingCollaborationSaves=0,n.ydoc){this.pendingCollaborationSaves++,this.#E(`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.#E(`FINAL pending = ${this.pendingCollaborationSaves}, but we have ${e.documents.filter(n=>n.ydoc).length} docs!`)})}async save(){const e=[this.#Fe()];this.#E("π¦ [superdoc] Saving superdoc"),await Promise.all(e),this.#E("π¦ [superdoc] Save complete")}#Ne(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?.()}#me(){this.#s=null,this.#F(),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.#I.open(e)}closeSurface(e){this.#I.close(e)}async removeDocument(e){const t=typeof e=="string"?e:String(e??"");if(!t)return!1;const n=this.#y("removeDocument"),r=this.activeEditor,o=FI(r);for(const s of this.#f.getAllByDocumentId(t))this.#f.unregister(s.id);o===t&&r!==null&&this.#K();const i=n.removeDocument(t);return i?(this.#Ne(i,n.documents),await kt(),!0):!1}destroy(){this.#e=!0,this.#u?.removeEventListener("click",this.#D,!0),this.#u?.removeEventListener("pointerdown",this.#A,!0),this.#u?.ownerDocument.removeEventListener("pointerup",this.#S,!0),this.#u?.ownerDocument.removeEventListener("pointercancel",this.#S,!0),this.#u?.removeEventListener("keydown",this.#L,!0),this.#u=null,this.#c?.(),this.#c=null,this.#t&&(this.#t(),this.#t=null),this.#I&&this.#I.destroy(),this.toolbar?.destroy?.(),this.commentsList?.close(),this.commentsList=null,this.app&&(this.#E("[superdoc] Unmounting app"),this.superdocStore?.reset(),this.app.unmount(),this.removeAllListeners(),delete this.app.config.globalProperties.$config,delete this.app.config.globalProperties.$superdoc),this.#v?.destroy(),this.#me(),this.#C?.(),this.#C=null,this.#f.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?gi(this.activeEditor)?this.activeEditor.focus?.(e):this.activeEditor.focus?.():this.#y("focus").documents.find(n=>{const r=n.getEditor?.();return r?(gi(r)?r.focus?.(e):r.focus?.(),!0):!1})}setHighContrastMode(e){this.activeEditor&&(this.activeEditor.setHighContrastMode?.(e),this.highContrastModeStore?.setHighContrastMode(e))}};Rt();var NI="__SUPERDOC_V2_BROWSER_RUNTIME__";function OH(e=globalThis){const t=e[NI];return t&&typeof t=="object"?t:null}function PH(e={},t=globalThis){const n=OH(t)??{},r={...n,...e,vue:e.vue??n.vue??ST};return t[NI]=r,r}PH();var FH={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"},NH=0;function BI(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-${++NH}`}`,l=[];if(i)for(const[c,d]of Object.entries(i)){if(d==null)continue;const f=FH[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 BH(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 zH(e){const{className:t,css:n}=BI(e);return BH(t,n),t}function VH(e){return BI(e)}function jH(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 UH=Dd({BlankDOCX:()=>Kk,DOCX:()=>Ar,HTML:()=>ku,PDF:()=>Ea,SuperDoc:()=>Zm,buildTheme:()=>VH,compareVersions:()=>LT,createTheme:()=>zH,defineSuperDocExtension:()=>jH,getFileObject:()=>Ty}),HH="SUPERDOC_ENGINE_CDN_BASE_URL",zI=Symbol.for("superdoc.docx-engine.cdn-load-state"),Qm="superdocDocxEngineStatus";function $H(e,t,n=null){const r=e?.[HH],o=typeof r=="string"&&r.trim()?r:n;if(typeof o=="string"&&o.trim())return GH(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 GH(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 WH({engineVersion:e,buildBaseUrl:t}){$R(()=>{const n=$H(globalThis,e,t),r=globalThis[zI],o=r instanceof Map?r:new Map;if(globalThis[zI]=o,!o.has(n)){const i=Promise.all([import(`${n}/dist-cdn/docx-engine.es.js`),KH(`${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 KH(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[Qm]==="loaded")return Promise.resolve();const r=n?.dataset[Qm]==="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[Qm]=g,m())},d=()=>c("loaded",o),f=()=>c("error",()=>i(new Error(`SuperDoc: failed to load DOCX Engine styles from ${t}`))),p=()=>{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(p),l.observe(document.head,{childList:!0})),r||(s.rel="stylesheet",s.href=t,s.dataset.superdocDocxEngine="true",s.dataset[Qm]="loading",document.head.appendChild(s))})}WH({engineVersion:"0.10.
|
|
108
|
+
}`:""}}function BH(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 zH(e){const{className:t,css:n}=BI(e);return BH(t,n),t}function VH(e){return BI(e)}function jH(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 UH=Dd({BlankDOCX:()=>Kk,DOCX:()=>Ar,HTML:()=>ku,PDF:()=>Ea,SuperDoc:()=>Zm,buildTheme:()=>VH,compareVersions:()=>LT,createTheme:()=>zH,defineSuperDocExtension:()=>jH,getFileObject:()=>Ty}),HH="SUPERDOC_ENGINE_CDN_BASE_URL",zI=Symbol.for("superdoc.docx-engine.cdn-load-state"),Qm="superdocDocxEngineStatus";function $H(e,t,n=null){const r=e?.[HH],o=typeof r=="string"&&r.trim()?r:n;if(typeof o=="string"&&o.trim())return GH(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 GH(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 WH({engineVersion:e,buildBaseUrl:t}){$R(()=>{const n=$H(globalThis,e,t),r=globalThis[zI],o=r instanceof Map?r:new Map;if(globalThis[zI]=o,!o.has(n)){const i=Promise.all([import(`${n}/dist-cdn/docx-engine.es.js`),KH(`${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 KH(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[Qm]==="loaded")return Promise.resolve();const r=n?.dataset[Qm]==="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[Qm]=g,m())},d=()=>c("loaded",o),f=()=>c("error",()=>i(new Error(`SuperDoc: failed to load DOCX Engine styles from ${t}`))),p=()=>{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(p),l.observe(document.head,{childList:!0})),r||(s.rel="stylesheet",s.href=t,s.dataset.superdocDocxEngine="true",s.dataset[Qm]="loading",document.head.appendChild(s))})}WH({engineVersion:"0.10.1-next.2",buildBaseUrl:null});for(const[e,t]of Object.entries(UH))e==="SuperDoc"||e==="default"||Object.prototype.hasOwnProperty.call(Zm,e)||(Zm[e]=t);var qH=Zm;return qH})();
|