superdoc 2.12.0 β 2.12.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/document-api/src/content-controls/content-controls.types.d.ts +3 -0
- package/dist/document-api/src/types/blocks.types.d.ts +1 -1
- package/dist/document-api/src/types/extract.types.d.ts +1 -1
- package/dist/document-api/src/types/info.types.d.ts +1 -1
- package/dist/document-api/src/types/paragraph.types.d.ts +2 -1
- package/dist/document-api/src/types/sd-nodes.d.ts +2 -1
- package/dist/superdoc.cjs +2 -2
- package/dist/superdoc.es.js +2 -2
- package/dist-cdn/superdoc.min.js +3 -3
- package/package.json +2 -2
package/dist-cdn/superdoc.min.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var SuperDoc=(function(){var EE=Object.create,Dh=Object.defineProperty,TE=Object.getOwnPropertyDescriptor,xE=Object.getOwnPropertyNames,RE=Object.getPrototypeOf,ME=Object.prototype.hasOwnProperty,Dr=(e,t,n)=>()=>{if(n)throw n[0];try{return e&&(t=e(e=0)),t}catch(r){throw n=[r],r}},R2=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),Dd=(e,t)=>{let n={};for(var r in e)Dh(n,r,{get:e[r],enumerable:!0});return t||Dh(n,Symbol.toStringTag,{value:"Module"}),n},LE=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(var o=xE(t),i=0,s=o.length,a;i<s;i++)a=o[i],!ME.call(e,a)&&a!==n&&Dh(e,a,{get:(l=>t[l]).bind(null,a),enumerable:!(r=TE(t,a))||r.enumerable});return e},M2=(e,t,n)=>(n=e!=null?EE(RE(e)):{},LE(t||!e||!e.__esModule?Dh(n,"default",{value:e,enumerable:!0}):n,e)),DE=R2(((e,t)=>{var n=Object.prototype.hasOwnProperty,r="~";function o(){}Object.create&&(o.prototype=Object.create(null),new o().__proto__||(r=!1));function i(u,d,f){this.fn=u,this.context=d,this.once=f||!1}function s(u,d,f,p,g){if(typeof f!="function")throw new TypeError("The listener must be a function");var m=new i(f,p||u,g),v=r?r+d:d;return u._events[v]?u._events[v].fn?u._events[v]=[u._events[v],m]:u._events[v].push(m):(u._events[v]=m,u._eventsCount++),u}function a(u,d){--u._eventsCount===0?u._events=new o:delete u._events[d]}function l(){this._events=new o,this._eventsCount=0}l.prototype.eventNames=function(){var d=[],f,p;if(this._eventsCount===0)return d;for(p in f=this._events)n.call(f,p)&&d.push(r?p.slice(1):p);return Object.getOwnPropertySymbols?d.concat(Object.getOwnPropertySymbols(f)):d},l.prototype.listeners=function(d){var f=r?r+d:d,p=this._events[f];if(!p)return[];if(p.fn)return[p.fn];for(var g=0,m=p.length,v=new Array(m);g<m;g++)v[g]=p[g].fn;return v},l.prototype.listenerCount=function(d){var f=r?r+d:d,p=this._events[f];return p?p.fn?1:p.length:0},l.prototype.emit=function(d,f,p,g,m,v){var C=r?r+d:d;if(!this._events[C])return!1;var w=this._events[C],S=arguments.length,k,b;if(w.fn){switch(w.once&&this.removeListener(d,w.fn,void 0,!0),S){case 1:return w.fn.call(w.context),!0;case 2:return w.fn.call(w.context,f),!0;case 3:return w.fn.call(w.context,f,p),!0;case 4:return w.fn.call(w.context,f,p,g),!0;case 5:return w.fn.call(w.context,f,p,g,m),!0;case 6:return w.fn.call(w.context,f,p,g,m,v),!0}for(b=1,k=new Array(S-1);b<S;b++)k[b-1]=arguments[b];w.fn.apply(w.context,k)}else{var T=w.length,L;for(b=0;b<T;b++)switch(w[b].once&&this.removeListener(d,w[b].fn,void 0,!0),S){case 1:w[b].fn.call(w[b].context);break;case 2:w[b].fn.call(w[b].context,f);break;case 3:w[b].fn.call(w[b].context,f,p);break;case 4:w[b].fn.call(w[b].context,f,p,g);break;default:if(!k)for(L=1,k=new Array(S-1);L<S;L++)k[L-1]=arguments[L];w[b].fn.apply(w[b].context,k)}}return!0},l.prototype.on=function(d,f,p){return s(this,d,f,p,!1)},l.prototype.once=function(d,f,p){return s(this,d,f,p,!0)},l.prototype.removeListener=function(d,f,p,g){var m=r?r+d:d;if(!this._events[m])return this;if(!f)return a(this,m),this;var v=this._events[m];if(v.fn)v.fn===f&&(!g||v.once)&&(!p||v.context===p)&&a(this,m);else{for(var C=0,w=[],S=v.length;C<S;C++)(v[C].fn!==f||g&&!v[C].once||p&&v[C].context!==p)&&w.push(v[C]);w.length?this._events[m]=w.length===1?w[0]:w:a(this,m)}return this},l.prototype.removeAllListeners=function(d){var f;return d?(f=r?r+d:d,this._events[f]&&a(this,f)):(this._events=new o,this._eventsCount=0),this},l.prototype.off=l.prototype.removeListener,l.prototype.addListener=l.prototype.on,l.prefixed=r,l.EventEmitter=l,typeof t<"u"&&(t.exports=l)})),Mg=M2(DE(),1),Ao=[];for(let e=0;e<256;++e)Ao.push((e+256).toString(16).slice(1));function OE(e,t=0){return(Ao[e[t+0]]+Ao[e[t+1]]+Ao[e[t+2]]+Ao[e[t+3]]+"-"+Ao[e[t+4]]+Ao[e[t+5]]+"-"+Ao[e[t+6]]+Ao[e[t+7]]+"-"+Ao[e[t+8]]+Ao[e[t+9]]+"-"+Ao[e[t+10]]+Ao[e[t+11]]+Ao[e[t+12]]+Ao[e[t+13]]+Ao[e[t+14]]+Ao[e[t+15]]).toLowerCase()}var Lg,PE=new Uint8Array(16);function FE(){if(!Lg){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Lg=crypto.getRandomValues.bind(crypto)}return Lg(PE)}var NE=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),L2={randomUUID:NE};function ol(e,t,n){if(L2.randomUUID&&!t&&!e)return L2.randomUUID();e=e||{};const r=e.random??e.rng?.()??FE();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 OE(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=Jn(r)?BE(r):bn(r);if(o)for(const i in o)t[i]=o[i]}return t}else if(Jn(e)||zn(e))return e}function BE(e){const t={};return e.replace(H2,"").split(V2).forEach(n=>{if(n){const r=n.split(U2);r.length>1&&(t[r[0].trim()]=r[1].trim())}}),t}function Jt(e){let t="";if(Jn(e))t=e;else if(Nt(e))for(let n=0;n<e.length;n++){const r=Jt(e[n]);r&&(t+=r+" ")}else if(zn(e))for(const n in e)e[n]&&(t+=n+" ");return t.trim()}function Dg(e){if(!e)return null;let{class:t,style:n}=e;return t&&!Jn(t)&&(e.class=Jt(t)),n&&(e.style=bn(n)),e}function D2(e){return!!e||e===""}function zE(e,t){if(e.length!==t.length)return!1;let n=!0;for(let r=0;n&&r<e.length;r++)n=ia(e[r],t[r]);return n}function ia(e,t){if(e===t)return!0;let n=Pg(e),r=Pg(t);if(n||r)return n&&r?e.getTime()===t.getTime():!1;if(n=si(e),r=si(t),n||r)return e===t;if(n=Nt(e),r=Nt(t),n||r)return n&&r?zE(e,t):!1;if(n=zn(e),r=zn(t),n||r){if(!n||!r||Object.keys(e).length!==Object.keys(t).length)return!1;for(const o in e){const i=e.hasOwnProperty(o),s=t.hasOwnProperty(o);if(i&&!s||!i&&s||!ia(e[o],t[o]))return!1}}return String(e)===String(t)}function Oh(e,t){return e.findIndex(n=>ia(n,t))}function jE(e){return e==null?"initial":typeof e=="string"?e===""?" ":e:(typeof e!="number"||Number.isFinite(e),String(e))}var Ln,nc,Ci,Og,Yc,Pd,Kn,Ph,O2,$n,Nt,rc,il,Pg,P2,Yt,Jn,si,zn,Fh,Fg,oc,F2,Fd,Nd,sl,Bd,N2,jr,B2,qo,Xc,Zc,fo,ic,Ng,zd,jd,z2,Vd,j2,V2,U2,H2,Bg,$2,VE,zg,zt,jg,Nh,Vg=Dr((()=>{Ln={},nc=[],Ci=()=>{},Og=()=>!1,Yc=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),Pd=e=>e.startsWith("onUpdate:"),Kn=Object.assign,Ph=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},O2=Object.prototype.hasOwnProperty,$n=(e,t)=>O2.call(e,t),Nt=Array.isArray,rc=e=>oc(e)==="[object Map]",il=e=>oc(e)==="[object Set]",Pg=e=>oc(e)==="[object Date]",P2=e=>oc(e)==="[object RegExp]",Yt=e=>typeof e=="function",Jn=e=>typeof e=="string",si=e=>typeof e=="symbol",zn=e=>e!==null&&typeof e=="object",Fh=e=>(zn(e)||Yt(e))&&Yt(e.then)&&Yt(e.catch),Fg=Object.prototype.toString,oc=e=>Fg.call(e),F2=e=>oc(e).slice(8,-1),Fd=e=>oc(e)==="[object Object]",Nd=e=>Jn(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)))},N2=/-\w/g,jr=Bd(e=>e.replace(N2,t=>t.slice(1).toUpperCase())),B2=/\B([A-Z])/g,qo=Bd(e=>e.replace(B2,"-$1").toLowerCase()),Xc=Bd(e=>e.charAt(0).toUpperCase()+e.slice(1)),Zc=Bd(e=>e?`on${Xc(e)}`:""),fo=(e,t)=>!Object.is(e,t),ic=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},Ng=(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},jd=e=>{const t=Jn(e)?Number(e):NaN;return isNaN(t)?e:t},Vd=()=>z2||(z2=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}),j2=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"),V2=/;(?![^(]*\))/g,U2=/:([^]+)/,H2=/\/\*[^]*?\*\//g,Bg="itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly",$2=Od(Bg),VE=Od(Bg+",async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected"),zg=e=>!!(e&&e.__v_isRef===!0),zt=e=>Jn(e)?e:e==null?"":Nt(e)||zn(e)&&(e.toString===Fg||!Yt(e.toString))?zg(e)?zt(e.value):JSON.stringify(e,jg,2):String(e),jg=(e,t)=>zg(t)?jg(e,t.value):rc(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((n,[r,o],i)=>(n[Nh(r,i)+" =>"]=o,n),{})}:il(t)?{[`Set(${t.size})`]:[...t.values()].map(n=>Nh(n))}:si(t)?Nh(t):zn(t)&&!Nt(t)&&!Fd(t)?String(t):t,Nh=(e,t="")=>{var n;return si(e)?`Symbol(${(n=e.description)!=null?n:t})`:e}}));function Ug(e){return new Hh(e)}function Hg(){return No}function G2(e,t=!1){No&&No.cleanups.push(e)}function W2(e,t=!1){if(e.flags|=8,t){e.next=Gd,Gd=e;return}e.next=$d,$d=e}function $g(){Qg++}function Gg(){if(--Qg>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 K2(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function q2(e){let t,n=e.depsTail,r=n;for(;r;){const o=r.prevDep;r.version===-1?(r===n&&(n=o),Kg(r),UE(r)):t=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=o}e.deps=t,e.depsTail=n}function Wg(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(Y2(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function Y2(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===eu)||(e.globalVersion=eu,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!Wg(e))))return;e.flags|=2;const t=e.dep,n=sr,r=zi;sr=e,zi=!0;try{K2(e);const o=e.fn(e._value);(t.version===0||fo(o,e._value))&&(e.flags|=128,e._value=o,t.version++)}catch(o){throw t.version++,o}finally{sr=n,zi=r,q2(e),e.flags&=-3}}function Kg(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)Kg(i,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function UE(e){const{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}function HE(e,t){e.effect instanceof Jc&&(e=e.effect.fn);const n=new Jc(e);t&&Kn(n,t);try{n.run()}catch(o){throw n.stop(),o}const r=n.run.bind(n);return r.effect=n,r}function $E(e){e.effect.stop()}function sa(){Jg.push(zi),zi=!1}function aa(){const e=Jg.pop();zi=e===void 0?!0:e}function X2(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const n=sr;sr=void 0;try{t()}finally{sr=n}}}function Z2(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)Z2(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(zi&&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 la(e,t,n,r,o,i){const s=Kd.get(e);if(!s){eu++;return}const a=l=>{l&&l.trigger()};if($g(),t==="clear")s.forEach(a);else{const l=Nt(e),u=l&&Nd(n);if(l&&n==="length"){const d=Number(r);s.forEach((f,p)=>{(p==="length"||p===tu||!si(p)&&p>=d)&&a(f)})}else switch((n!==void 0||s.has(void 0))&&a(s.get(n)),u&&a(s.get(tu)),t){case"add":l?u&&a(s.get("length")):(a(s.get(al)),rc(e)&&a(s.get(Gh)));break;case"delete":l||(a(s.get(al)),rc(e)&&a(s.get(Gh)));break;case"set":rc(e)&&a(s.get(al));break}}Gg()}function GE(e,t){const n=Kd.get(e);return n&&n.get(t)}function Qc(e){const t=gn(e);return t===e?t:(Fo(t,"iterate",tu),ai(e)?t:t.map(ji))}function Bh(e){return Fo(e=gn(e),"iterate",tu),e}function _s(e,t){return As(e)?sc(Bi(e)?ji(t):t):ji(t)}function qg(e,t,n){const r=Bh(e),o=r[t]();return r!==e&&!ai(e)&&(o._next=o.next,o.next=()=>{const i=o._next();return i.done||(i.value=n(i.value)),i}),o}function ca(e,t,n,r,o,i){const s=Bh(e),a=s!==e&&!ai(e),l=s[t];if(l!==a1[t]){const f=l.apply(e,i);return a?ji(f):f}let u=n;s!==e&&(a?u=function(f,p){return n.call(this,_s(e,f),p,e)}:n.length>2&&(u=function(f,p){return n.call(this,f,p,e)}));const d=l.call(s,u,r);return a&&o?o(d):d}function Q2(e,t,n,r){const o=Bh(e),i=o!==e&&!ai(e);let s=n,a=!1;o!==e&&(i?(a=r.length===0,s=function(u,d,f){return a&&(a=!1,u=_s(e,u)),n.call(this,u,_s(e,d),f,e)}):n.length>3&&(s=function(u,d,f){return n.call(this,u,d,f,e)}));const l=o[t](s,...r);return a?_s(e,l):l}function Yg(e,t,n){const r=gn(e);Fo(r,"iterate",tu);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=[]){sa(),$g();const r=gn(e)[t].apply(e,n);return Gg(),aa(),r}function WE(e){si(e)||(e=String(e));const t=gn(this);return Fo(t,"has",e),t.hasOwnProperty(e)}function KE(e,t,n){return function(...r){const o=this.__v_raw,i=gn(o),s=rc(i),a=e==="entries"||e===Symbol.iterator&&s,l=e==="keys"&&s,u=o[e](...r),d=n?Wh:t?sc:ji;return!t&&Fo(i,"iterate",l?Gh:al),Kn(Object.create(u),{next(){const{value:f,done:p}=u.next();return p?{value:f,done:p}:{value:a?[d(f[0]),d(f[1])]:d(f),done:p}}})}}function zh(e){return function(...t){return e==="delete"?!1:e==="clear"?void 0:this}}function qE(e,t){const n={get(r){const o=this.__v_raw,i=gn(o),s=gn(r);e||(fo(r,s)&&Fo(i,"get",r),Fo(i,"get",s));const{has:a}=qd(i),l=t?Wh:e?sc:ji;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||(fo(r,s)&&Fo(i,"has",r),Fo(i,"has",s)),r===s?o.has(r):o.has(r)||o.has(s)},forEach(r,o){const i=this,s=i.__v_raw,a=gn(s),l=t?Wh:e?sc:ji;return!e&&Fo(a,"iterate",al),s.forEach((u,d)=>r.call(o,l(u),l(d),i))}};return Kn(n,e?{add:zh("add"),set:zh("set"),delete:zh("delete"),clear:zh("clear")}:{add(r){const o=gn(this),i=qd(o),s=gn(r),a=!t&&!ai(r)&&!As(r)?s:r;return i.has.call(o,a)||fo(r,a)&&i.has.call(o,r)||fo(s,a)&&i.has.call(o,s)||(o.add(a),la(o,"add",a,a)),this},set(r,o){!t&&!ai(o)&&!As(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 u=a.call(i,r);return i.set(r,o),l?fo(o,u)&&la(i,"set",r,o,u):la(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,u=o.delete(r);return a&&la(o,"delete",r,void 0,l),u},clear(){const r=gn(this),o=r.size!==0,i=void 0,s=r.clear();return o&&la(r,"clear",void 0,void 0,i),s}}),["keys","values","entries",Symbol.iterator].forEach(r=>{n[r]=KE(r,e,t)}),n}function jh(e,t){const n=qE(e,t);return(r,o,i)=>o==="__v_isReactive"?!e:o==="__v_isReadonly"?e:o==="__v_raw"?r:Reflect.get($n(n,o)&&o in r?n:r,o,i)}function YE(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function XE(e){return e.__v_skip||!Object.isExtensible(e)?0:YE(F2(e))}function oo(e){return As(e)?e:Uh(e,!1,c1,h1,ov)}function J2(e){return Uh(e,!1,d1,p1,iv)}function Vh(e){return Uh(e,!0,u1,m1,sv)}function ZE(e){return Uh(e,!0,f1,g1,av)}function Uh(e,t,n,r,o){if(!zn(e)||e.__v_raw&&!(t&&e.__v_isReactive))return e;const i=XE(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 Bi(e){return As(e)?Bi(e.__v_raw):!!(e&&e.__v_isReactive)}function As(e){return!!(e&&e.__v_isReadonly)}function ai(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 io(e){return!$n(e,"__v_skip")&&Object.isExtensible(e)&&Ng(e,"__v_skip",!0),e}function ur(e){return e?e.__v_isRef===!0:!1}function te(e){return e1(e,!1)}function Vr(e){return e1(e,!0)}function e1(e,t){return ur(e)?e:new v1(e,t)}function QE(e){e.dep&&e.dep.trigger()}function Je(e){return ur(e)?e.value:e}function JE(e){return Yt(e)?e():Je(e)}function Xg(e){return Bi(e)?e:new Proxy(e,y1)}function t1(e){return new b1(e)}function n1(e){const t=Nt(e)?new Array(e.length):{};for(const n in e)t[n]=r1(e,n);return t}function Zg(e,t,n){return ur(e)?e:Yt(e)?new C1(e):zn(e)&&arguments.length>1?r1(e,t,n):te(e)}function r1(e,t,n){return new w1(e,t,n)}function e5(e,t,n=!1){let r,o;return Yt(e)?r=e:(r=e.get,o=e.set),new k1(r,o,n)}function t5(){return da}function o1(e,t=!1,n=da){if(n){let r=Xd.get(n);r||Xd.set(n,r=[]),r.push(e)}}function n5(e,t,n=Ln){const{immediate:r,deep:o,once:i,scheduler:s,augmentJob:a,call:l}=n,u=b=>o?b:ai(b)||o===!1||o===0?ua(b,1):ua(b);let d,f,p,g,m=!1,v=!1;if(ur(e)?(f=()=>e.value,m=ai(e)):Bi(e)?(f=()=>u(e),m=!0):Nt(e)?(v=!0,m=e.some(b=>Bi(b)||ai(b)),f=()=>e.map(b=>{if(ur(b))return b.value;if(Bi(b))return u(b);if(Yt(b))return l?l(b,2):b()})):Yt(e)?t?f=l?()=>l(e,2):e:f=()=>{if(p){sa();try{p()}finally{aa()}}const b=da;da=d;try{return l?l(e,3,[g]):e(g)}finally{da=b}}:f=Ci,t&&o){const b=f,T=o===!0?1/0:o;f=()=>ua(b(),T)}const C=Hg(),w=()=>{d.stop(),C&&C.active&&Ph(C.effects,d)};if(i&&t){const b=t;t=(...T)=>{b(...T),w()}}let S=v?new Array(e.length).fill(Yd):Yd;const k=b=>{if(!(!(d.flags&1)||!d.dirty&&!b))if(t){const T=d.run();if(o||m||(v?T.some((L,z)=>fo(L,S[z])):fo(T,S))){p&&p();const L=da;da=d;try{const z=[T,S===Yd?void 0:v&&S[0]===Yd?[]:S,g];S=T,l?l(t,3,z):t(...z)}finally{da=L}}}else d.run()};return a&&a(k),d=new Jc(f),d.scheduler=s?()=>s(k,!1):k,g=b=>o1(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?k(!0):S=d.run():s?s(k.bind(null,!0),!0):d.run(),w.pause=d.pause.bind(d),w.resume=d.resume.bind(d),w.stop=w,w}function ua(e,t=1/0,n){if(t<=0||!zn(e)||e.__v_skip||(n=n||new Map,(n.get(e)||0)>=t))return e;if(n.set(e,t),t--,ur(e))ua(e.value,t,n);else if(Nt(e))for(let r=0;r<e.length;r++)ua(e[r],t,n);else if(il(e)||rc(e))e.forEach(r=>{ua(r,t,n)});else if(Fd(e)){for(const r in e)ua(e[r],t,n);for(const r of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,r)&&ua(e[r],t,n)}return e}var No,Hh,sr,$h,Jc,Qg,$d,Gd,zi,Jg,eu,i1,Wd,Kd,al,Gh,tu,s1,a1,l1,ev,tv,nv,rv,c1,u1,d1,f1,Wh,qd,h1,p1,m1,g1,ov,iv,sv,av,ji,sc,v1,y1,b1,w1,C1,k1,S1,_1,Yd,Xd,da,r5=Dr((()=>{Vg(),Hh=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}}},$h=new WeakSet,Jc=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,$h.has(this)&&($h.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||W2(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,X2(this),K2(this);const e=sr,t=zi;sr=this,zi=!0;try{return this.fn()}finally{q2(this),sr=e,zi=t,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)Kg(e);this.deps=this.depsTail=void 0,X2(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?$h.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){Wg(this)&&this.run()}get dirty(){return Wg(this)}},Qg=0,zi=!0,Jg=[],eu=0,i1=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||!zi||sr===this.computed)return;let t=this.activeLink;if(t===void 0||t.sub!==sr)t=this.activeLink=new i1(sr,this),sr.deps?(t.prevDep=sr.depsTail,sr.depsTail.nextDep=t,sr.depsTail=t):sr.deps=sr.depsTail=t,Z2(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++,eu++,this.notify(e)}notify(e){$g();try{for(let t=this.subs;t;t=t.prevSub)t.sub.notify()&&t.sub.dep.notify()}finally{Gg()}}},Kd=new WeakMap,al=Symbol(""),Gh=Symbol(""),tu=Symbol(""),s1={__proto__:null,[Symbol.iterator](){return qg(this,Symbol.iterator,e=>_s(this,e))},concat(...e){return Qc(this).concat(...e.map(t=>Nt(t)?Qc(t):t))},entries(){return qg(this,"entries",e=>(e[1]=_s(this,e[1]),e))},every(e,t){return ca(this,"every",e,t,void 0,arguments)},filter(e,t){return ca(this,"filter",e,t,n=>n.map(r=>_s(this,r)),arguments)},find(e,t){return ca(this,"find",e,t,n=>_s(this,n),arguments)},findIndex(e,t){return ca(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return ca(this,"findLast",e,t,n=>_s(this,n),arguments)},findLastIndex(e,t){return ca(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return ca(this,"forEach",e,t,void 0,arguments)},includes(...e){return Yg(this,"includes",e)},indexOf(...e){return Yg(this,"indexOf",e)},join(e){return Qc(this).join(e)},lastIndexOf(...e){return Yg(this,"lastIndexOf",e)},map(e,t){return ca(this,"map",e,t,void 0,arguments)},pop(){return Ud(this,"pop")},push(...e){return Ud(this,"push",e)},reduce(e,...t){return Q2(this,"reduce",e,t)},reduceRight(e,...t){return Q2(this,"reduceRight",e,t)},shift(){return Ud(this,"shift")},some(e,t){return ca(this,"some",e,t,void 0,arguments)},splice(...e){return Ud(this,"splice",e)},toReversed(){return Qc(this).toReversed()},toSorted(e){return Qc(this).toSorted(e)},toSpliced(...e){return Qc(this).toSpliced(...e)},unshift(...e){return Ud(this,"unshift",e)},values(){return qg(this,"values",e=>_s(this,e))}},a1=Array.prototype,l1=Od("__proto__,__v_isRef,__isVue"),ev=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(si)),tv=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?av:sv:o?iv:ov).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(n)?e:void 0;const i=Nt(e);if(!r){let a;if(i&&(a=s1[t]))return a;if(t==="hasOwnProperty")return WE}const s=Reflect.get(e,t,ur(e)?e:n);if((si(t)?ev.has(t):l1(t))||(r||Fo(e,"get",t),o))return s;if(ur(s)){const a=i&&Nd(t)?s:s.value;return r&&zn(a)?Vh(a):a}return zn(s)?r?Vh(s):oo(s):s}},nv=class extends tv{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=As(o);if(!ai(n)&&!As(n)&&(o=gn(o),n=gn(n)),!i&&ur(o)&&!ur(n))return l||(o.value=n),!0}const s=i?Number(t)<e.length:$n(e,t),a=Reflect.set(e,t,n,ur(e)?e:r);return e===gn(r)&&(s?fo(n,o)&&la(e,"set",t,n,o):la(e,"add",t,n)),a}deleteProperty(e,t){const n=$n(e,t),r=e[t],o=Reflect.deleteProperty(e,t);return o&&n&&la(e,"delete",t,void 0,r),o}has(e,t){const n=Reflect.has(e,t);return(!si(t)||!ev.has(t))&&Fo(e,"has",t),n}ownKeys(e){return Fo(e,"iterate",Nt(e)?"length":al),Reflect.ownKeys(e)}},rv=class extends tv{constructor(e=!1){super(!0,e)}set(e,t){return!0}deleteProperty(e,t){return!0}},c1=new nv,u1=new rv,d1=new nv(!0),f1=new rv(!0),Wh=e=>e,qd=e=>Reflect.getPrototypeOf(e),h1={get:jh(!1,!1)},p1={get:jh(!1,!0)},m1={get:jh(!0,!1)},g1={get:jh(!0,!0)},ov=new WeakMap,iv=new WeakMap,sv=new WeakMap,av=new WeakMap,ji=e=>zn(e)?oo(e):e,sc=e=>zn(e)?Vh(e):e,v1=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:ji(e),this.__v_isShallow=t}get value(){return this.dep.track(),this._value}set value(e){const t=this._rawValue,n=this.__v_isShallow||ai(e)||As(e);e=n?e:gn(e),fo(e,t)&&(this._rawValue=e,this._value=n?e:ji(e),this.dep.trigger())}},y1={get:(e,t,n)=>t==="__v_raw"?e:Je(Reflect.get(e,t,n)),set:(e,t,n,r)=>{const o=e[t];return ur(o)&&!ur(n)?(o.value=n,!0):Reflect.set(e,t,n,r)}},b1=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)}},w1=class{constructor(e,t,n){this._object=e,this._defaultValue=n,this.__v_isRef=!0,this._value=void 0,this._key=si(t)?t:String(t),this._raw=gn(e);let r=!0,o=e;if(!Nt(e)||si(this._key)||!Nd(this._key))do r=!Hd(o)||ai(o);while(r&&(o=o.__v_raw));this._shallow=r}get value(){let e=this._object[this._key];return this._shallow&&(e=Je(e)),this._value=e===void 0?this._defaultValue:e}set value(e){if(this._shallow&&ur(this._raw[this._key])){const t=this._object[this._key];if(ur(t)){t.value=e;return}}this._object[this._key]=e}get dep(){return GE(this._raw,this._key)}},C1=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()}},k1=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=eu-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 W2(this,!0),!0}get value(){const e=this.dep.track();return Y2(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}},S1={GET:"get",HAS:"has",ITERATE:"iterate"},_1={SET:"set",ADD:"add",DELETE:"delete",CLEAR:"clear"},Yd={},Xd=new WeakMap,da=void 0}));function o5(e){Ev.push(e)}function i5(){Ev.pop()}function s5(e,t){}function nu(e,t,n,r){try{return r?e(...r):e()}catch(o){ac(o,t,n)}}function Vi(e,t,n,r){if(Yt(e)){const o=nu(e,t,n,r);return o&&Fh(o)&&o.catch(i=>{ac(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 ac(e,t,n,r=!0){const o=t?t.vnode:null,{errorHandler:i,throwUnhandledErrorInProduction:s}=t&&t.appContext.config||Ln;if(t){let a=t.parent;const l=t.proxy,u=`https://vuejs.org/error-reference/#runtime-${n}`;for(;a;){const d=a.ec;if(d){for(let f=0;f<d.length;f++)if(d[f](e,l,u)===!1)return}a=a.parent}if(i){sa(),nu(i,null,10,[e,l,u]),aa();return}}a5(e,n,o,r,s)}function a5(e,t,n,r=!0,o=!1){if(o)throw e;console.error(e)}function kt(e){const t=lf||Tv;return e?t.then(this?e.bind(this):e):t}function l5(e){let t=os+1,n=Bo.length;for(;t<n;){const r=t+n>>>1,o=Bo[r],i=au(o);i<e||i===e&&o.flags&2?t=r+1:n=r}return t}function lv(e){if(!(e.flags&1)){const t=au(e),n=Bo[Bo.length-1];!n||!(e.flags&2)&&t>=au(n)?Bo.push(e):Bo.splice(l5(t),0,e),e.flags|=1,A1()}}function A1(){lf||(lf=Tv.then(E1))}function Zd(e){Nt(e)?uc.push(...e):ga&&e.id===-1?ga.splice(dc+1,0,e):e.flags&1||(uc.push(e),e.flags|=1),A1()}function I1(e,t,n=os+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 Kh(e){if(uc.length){const t=[...new Set(uc)].sort((n,r)=>au(n)-au(r));if(uc.length=0,ga){ga.push(...t);return}for(ga=t,dc=0;dc<ga.length;dc++){const n=ga[dc];n.flags&4&&(n.flags&=-2),n.flags&8||n(),n.flags&=-2}ga=null,dc=0}}function E1(e){try{for(os=0;os<Bo.length;os++){const t=Bo[os];t&&!(t.flags&8)&&(t.flags&4&&(t.flags&=-2),nu(t,t.i,t.i?15:14),t.flags&4||(t.flags&=-2))}}finally{for(;os<Bo.length;os++){const t=Bo[os];t&&(t.flags&=-2)}os=-1,Bo.length=0,Kh(e),lf=null,(Bo.length||uc.length)&&E1(e)}}function T1(e,t){var n,r;lu=e,lu?(lu.enabled=!0,cf.forEach(({event:o,args:i})=>lu.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=>{T1(o,t)}),setTimeout(()=>{lu||(t.__VUE_DEVTOOLS_HOOK_REPLAY__=null,cf=[])},3e3)):cf=[]}function Qd(e){const t=po;return po=e,uf=e&&e.type.__scopeId||null,t}function c5(e){uf=e}function u5(){uf=null}function ho(e,t=po,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 fa(e,t){if(po===null)return e;const n=af(po),r=e.dirs||(e.dirs=[]);for(let o=0;o<t.length;o++){let[i,s,a,l=Ln]=t[o];i&&(Yt(i)&&(i={mounted:i,updated:i}),i.deep&&ua(s),r.push({dir:i,instance:n,value:s,oldValue:void 0,arg:a,modifiers:l}))}return e}function Is(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&&(sa(),Vi(l,n,8,[e.el,a,e,t]),aa())}}function x1(e,t){if(mo){let n=mo.provides;const r=mo.parent&&mo.parent.provides;r===n&&(n=mo.provides=Object.create(r)),n[e]=t}}function ll(e,t,n=!1){const r=mr();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 R1(){return!!(mr()||fl)}function d5(e,t){return Jd(e,null,t)}function f5(e,t){return Jd(e,null,{flush:"post"})}function M1(e,t){return Jd(e,null,{flush:"sync"})}function Bt(e,t,n){return Jd(e,t,n)}function Jd(e,t,n=Ln){const{immediate:r,deep:o,flush:i,once:s}=n,a=Kn({},n),l=t&&r||!t&&i!=="post";let u;if(ml){if(i==="sync"){const g=Rv();u=g.__watcherHandles||(g.__watcherHandles=[])}else if(!l){const g=()=>{};return g.stop=Ci,g.resume=Ci,g.pause=Ci,g}}const d=mo;a.call=(g,m,v)=>Vi(g,d,m,v);let f=!1;i==="post"?a.scheduler=g=>{Hr(g,d&&d.suspense)}:i!=="sync"&&(f=!0,a.scheduler=(g,m)=>{m?g():lv(g)}),a.augmentJob=g=>{t&&(g.flags|=4),f&&(g.flags|=2,d&&(g.id=d.uid,g.i=d))};const p=n5(e,t,a);return ml&&(u?u.push(p):l&&p()),p}function h5(e,t,n){const r=this.proxy,o=Jn(e)?e.includes(".")?L1(r,e):()=>r[e]:e.bind(r,r);let i;Yt(t)?i=t:(i=t.handler,n=t);const s=pc(this),a=Jd(o,i.bind(r),n);return s(),a}function L1(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 qh(e,t,n,{o:{insert:r},m:o},i=2){i===0&&r(e.targetAnchor,t,n);const{el:s,anchor:a,shapeFlag:l,children:u,props:d}=e,f=i===2;if(f&&r(s,t,n),(!f||ul(d))&&l&16)for(let p=0;p<u.length;p++)o(u[p],t,n,2);f&&r(a,t,n)}function p5(e,t,n,r,o,i,{o:{nextSibling:s,parentNode:a,querySelector:l,insert:u,createText:d}},f){function p(C,w){let S=w;for(;S;){if(S&&S.nodeType===8){if(S.data==="teleport start anchor")t.targetStart=S;else if(S.data==="teleport anchor"){t.targetAnchor=S,C._lpa=t.targetAnchor&&s(t.targetAnchor);break}}S=s(S)}}function g(C,w){w.anchor=f(s(C),w,a(C),n,r,o,i)}const m=t.target=ip(t.props,l),v=ul(t.props);if(m){const C=m._lpa||m.firstChild;t.shapeFlag&16&&(v?(g(e,t),p(m,C),t.targetAnchor||cv(m,t,d,u,a(e)===m?e:null)):(t.anchor=s(e),p(m,C),t.targetAnchor||cv(m,t,d,u),f(C&&s(C),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 cv(e,t,n,r,o=null){const i=t.targetStart=n(""),s=t.targetAnchor=n("");return i[Mv]=s,e&&(r(i,e,o),r(s,e,o)),s}function uv(){const e={isMounted:!1,isLeaving:!1,isUnmounting:!1,leavingVNodes:new Map};return jn(()=>{e.isMounted=!0}),dr(()=>{e.isUnmounting=!0}),e}function D1(e){let t=e[0];if(e.length>1){for(const n of e)if(n.type!==Or){t=n;break}}return t}function O1(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 ru(e,t,n,r,o){const{appear:i,mode:s,persisted:a=!1,onBeforeEnter:l,onEnter:u,onAfterEnter:d,onEnterCancelled:f,onBeforeLeave:p,onLeave:g,onAfterLeave:m,onLeaveCancelled:v,onBeforeAppear:C,onAppear:w,onAfterAppear:S,onAppearCancelled:k}=t,b=String(e.key),T=O1(n,e),L=(U,j)=>{U&&Vi(U,r,9,j)},z=(U,j)=>{const Z=j[1];L(U,j),Nt(U)?U.every(R=>R.length<=1)&&Z():U.length<=1&&Z()},G={mode:s,persisted:a,beforeEnter(U){let j=l;if(!n.isMounted)if(i)j=C||l;else return;U[is]&&U[is](!0);const Z=T[b];Z&&ns(e,Z)&&Z.el[is]&&Z.el[is](),L(j,[U])},enter(U){if(T[b]===e)return;let j=u,Z=d,R=f;if(!n.isMounted)if(i)j=w||u,Z=S||d,R=k||f;else return;let K=!1;U[cu]=W=>{K||(K=!0,W?L(R,[U]):L(Z,[U]),G.delayedLeave&&G.delayedLeave(),U[cu]=void 0)};const x=U[cu].bind(null,!1);j?z(j,[U,x]):x()},leave(U,j){const Z=String(e.key);if(U[cu]&&U[cu](!0),n.isUnmounting)return j();L(p,[U]);let R=!1;U[is]=x=>{R||(R=!0,j(),x?L(v,[U]):L(m,[U]),U[is]=void 0,T[Z]===e&&delete T[Z])};const K=U[is].bind(null,!1);T[Z]=e,g?z(g,[U,K]):K()},clone(U){const j=ru(U,t,n,r,o);return o&&o(j),j}};return G}function dv(e){if(uu(e))return e=Es(e),e.children=null,e}function P1(e){if(!uu(e))return Lv(e.type)&&e.children?D1(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 ha(e,t){e.shapeFlag&6&&e.component?(e.transition=t,ha(e.component.subTree,t)):e.shapeFlag&128?(e.ssContent.transition=t.clone(e.ssContent),e.ssFallback.transition=t.clone(e.ssFallback)):e.transition=t}function Yh(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(Yh(s.children,t,a))):(t||s.type!==Or)&&r.push(a!=null?Es(s,{key:a}):s)}if(o>1)for(let i=0;i<r.length;i++)r[i].patchFlag=-2;return r}function lc(e,t){return Yt(e)?Kn({name:e.name},t,{setup:e}):e}function m5(){const e=mr();return e?(e.appContext.config.idPrefix||"v")+"-"+e.ids[0]+e.ids[1]++:""}function fv(e){e.ids=[e.ids[0]+e.ids[2]+++"-",0,0]}function g5(e){const t=mr(),n=Vr(null);if(t){const r=t.refs===Ln?t.refs={}:t.refs;Object.defineProperty(r,e,{enumerable:!0,get:()=>n.value,set:o=>n.value=o})}return n}function F1(e,t){let n;return!!((n=Object.getOwnPropertyDescriptor(e,t))&&!n.configurable)}function ou(e,t,n,r,o=!1){if(Nt(e)){e.forEach((v,C)=>ou(v,t&&(Nt(t)?t[C]:t),n,r,o));return}if(xs(r)&&!o){r.shapeFlag&512&&r.type.__asyncResolved&&r.component.subTree.component&&ou(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,u=t&&t.r,d=a.refs===Ln?a.refs={}:a.refs,f=a.setupState,p=gn(f),g=f===Ln?Og:v=>F1(d,v)?!1:$n(p,v),m=(v,C)=>!(C&&F1(d,C));if(u!=null&&u!==l){if(N1(t),Jn(u))d[u]=null,g(u)&&(f[u]=null);else if(ur(u)){const v=t;m(u,v.k)&&(u.value=null),v.k&&(d[v.k]=null)}}if(Yt(l))nu(l,a,12,[s,d]);else{const v=Jn(l),C=ur(l);if(v||C){const w=()=>{if(e.f){const S=v?g(l)?f[l]:d[l]:m(l)||!e.k?l.value:d[e.k];if(o)Nt(S)&&Ph(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 k=[i];m(l,e.k)&&(l.value=k),e.k&&(d[e.k]=k)}}else v?(d[l]=s,g(l)&&(f[l]=s)):C&&(m(l,e.k)&&(l.value=s),e.k&&(d[e.k]=s))};if(s){const S=()=>{w(),df.delete(e)};S.id=-1,df.set(e,S),Hr(S,n)}else N1(e),w()}}}function N1(e){const t=df.get(e);t&&(t.flags|=8,df.delete(e))}function v5(e){const{mt:t,p:n,o:{patchProp:r,createText:o,nextSibling:i,parentNode:s,remove:a,insert:l,createComment:u}}=e,d=(k,b)=>{if(!b.hasChildNodes()){n(null,k,b),Kh(),b._vnode=k;return}f(b.firstChild,k,null,null,null),Kh(),b._vnode=k},f=(k,b,T,L,z,G=!1)=>{G=G||!!b.dynamicChildren;const U=hc(k)&&k.data==="[",j=()=>v(k,b,T,L,z,U),{type:Z,ref:R,shapeFlag:K,patchFlag:x}=b;let W=k.nodeType;b.el=k,x===-2&&(G=!1,b.dynamicChildren=null);let $=null;switch(Z){case va:W!==3?b.children===""?(l(b.el=o(""),s(k),k),$=k):$=j():(k.data!==b.children&&(fc(),k.data=b.children),$=i(k));break;case Or:S(k)?($=i(k),w(b.el=k.content.firstChild,k,T)):W!==8||U?$=j():$=i(k);break;case hl:if(U&&(k=i(k),W=k.nodeType),W===1||W===3){$=k;const J=!b.children.length;for(let Q=0;Q<b.staticCount;Q++)J&&(b.children+=$.nodeType===1?$.outerHTML:$.data),Q===b.staticCount-1&&(b.anchor=$),$=i($);return U?i($):$}else j();break;case Kt:U?$=m(k,b,T,L,z,G):$=j();break;default:if(K&1)(W!==1||b.type.toLowerCase()!==k.tagName.toLowerCase())&&!S(k)?$=j():$=p(k,b,T,L,z,G);else if(K&6){b.slotScopeIds=z;const J=s(k);if(U?$=C(k):hc(k)&&k.data==="teleport start"?$=C(k,k.data,"teleport end"):$=i(k),t(b,J,null,T,L,ff(J),G),xs(b)&&!b.type.__asyncResolved){let Q;U?(Q=qt(Kt),Q.anchor=$?$.previousSibling:J.lastChild):Q=k.nodeType===3?rs(""):qt("div"),Q.el=k,b.component.subTree=Q}}else K&64?W!==8?$=j():$=b.type.hydrate(k,b,T,L,z,G,e,g):K&128&&($=b.type.hydrate(k,b,T,L,ff(s(k)),z,G,e,f))}return R!=null&&ou(R,null,L,b),$},p=(k,b,T,L,z,G)=>{G=G||!!b.dynamicChildren;const{type:U,props:j,patchFlag:Z,shapeFlag:R,dirs:K,transition:x}=b,W=U==="input"||U==="option";if(W||Z!==-1){K&&Is(b,null,T,"created");let $=!1;if(S(k)){$=sw(null,x)&&T&&T.vnode.props&&T.vnode.props.appear;const Q=k.content.firstChild;if($){const Y=Q.getAttribute("class");Y&&(Q.$cls=Y),x.beforeEnter(Q)}w(Q,k,T),b.el=k=Q}if(R&16&&!(j&&(j.innerHTML||j.textContent))){let Q=g(k.firstChild,b,k,T,L,z,G);for(;Q;){Xh(k,1)||fc();const Y=Q;Q=Q.nextSibling,a(Y)}}else if(R&8){let Q=b.children;Q[0]===`
|
|
2
2
|
`&&(k.tagName==="PRE"||k.tagName==="TEXTAREA")&&(Q=Q.slice(1));const{textContent:Y}=k;Y!==Q&&Y!==Q.replace(/\r\n|\r/g,`
|
|
3
3
|
`)&&(Xh(k,0)||fc(),k.textContent=b.children)}if(j){if(W||!G||Z&48){const Q=k.tagName.includes("-");for(const Y in j)(W&&(Y.endsWith("value")||Y==="indeterminate")||Yc(Y)&&!sl(Y)||Y[0]==="."||Q&&!sl(Y))&&r(k,Y,null,j[Y],void 0,T)}else if(j.onClick)r(k,"onClick",null,j.onClick,void 0,T);else if(Z&4&&Bi(j.style))for(const Q in j.style)j.style[Q]}let J;(J=j&&j.onVnodeBeforeMount)&&ci(J,T,b),K&&Is(b,null,T,"beforeMount"),((J=j&&j.onVnodeMounted)||K||$)&&dw(()=>{J&&ci(J,T,b),$&&x.enter(k),K&&Is(b,null,T,"mounted")},L)}return k.nextSibling},g=(k,b,T,L,z,G,U)=>{U=U||!!b.dynamicChildren;const j=b.children,Z=j.length;for(let R=0;R<Z;R++){const K=U?j[R]:j[R]=li(j[R]),x=K.type===va;k?(x&&!U&&R+1<Z&&li(j[R+1]).type===va&&(l(o(k.data.slice(K.children.length)),T,i(k)),k.data=K.children),k=f(k,K,L,z,G,U)):x&&!K.children?l(K.el=o(""),T):(Xh(T,1)||fc(),n(null,K,T,null,L,z,ff(T),G))}return k},m=(k,b,T,L,z,G)=>{const{slotScopeIds:U}=b;U&&(z=z?z.concat(U):U);const j=s(k),Z=g(i(k),b,j,T,L,z,G);return Z&&hc(Z)&&Z.data==="]"?i(b.anchor=Z):(fc(),l(b.anchor=u("]"),j,Z),Z)},v=(k,b,T,L,z,G)=>{if(Xh(k.parentElement,1)||fc(),b.el=null,G){const Z=C(k);for(;;){const R=i(k);if(R&&R!==Z)a(R);else break}}const U=i(k),j=s(k);return a(k),n(null,b,j,U,T,L,ff(j),z),T&&(T.vnode.el=b.el,rp(T,b.el)),U},C=(k,b="[",T="]")=>{let L=0;for(;k;)if(k=i(k),k&&hc(k)&&(k.data===b&&L++,k.data===T)){if(L===0)return i(k);L--}return k},w=(k,b,T)=>{const L=b.parentNode;L&&L.replaceChild(k,b);let z=T;for(;z;)z.vnode.el===b&&(z.vnode.el=z.subTree.el=k),z=z.parent},S=k=>k.nodeType===1&&k.tagName==="TEMPLATE";return[d,f]}function Xh(e,t){if(t===0||t===1)for(;e&&!e.hasAttribute(Bv);)e=e.parentElement;const n=e&&e.getAttribute(Bv);if(n==null)return!1;if(n==="")return!0;{const r=n.split(",");return t===0&&r.includes("children")?!0:r.includes(xw[t])}}function y5(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 b5(e,t){if(hc(e)&&e.data==="["){let n=1,r=e.nextSibling;for(;r;){if(r.nodeType===1){if(t(r)===!1)break}else if(hc(r))if(r.data==="]"){if(--n===0)break}else r.data==="["&&n++;r=r.nextSibling}}else t(e)}function B1(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 u=null,d,f=0;const p=()=>(f++,u=null,g()),g=()=>{let m;return u||(m=u=t().catch(v=>{if(v=v instanceof Error?v:new Error(String(v)),l)return new Promise((C,w)=>{l(v,()=>C(p()),()=>w(v),f+1)});throw v}).then(v=>m!==u&&u?u:(v&&(v.__esModule||v[Symbol.toStringTag]==="Module")&&(v=v.default),d=v,v)))};return lc({name:"AsyncComponentWrapper",__asyncLoader:g,__asyncHydrate(m,v,C){let w=!1;(v.bu||(v.bu=[])).push(()=>w=!0);const S=()=>{w||C()},k=i?()=>{const b=i(S,T=>b5(m,T));b&&(v.bum||(v.bum=[])).push(b)}:S;d?k():g().then(()=>!v.isUnmounted&&k())},get __asyncResolved(){return d},setup(){const m=mo;if(fv(m),d)return()=>Zh(d,m);const v=k=>{u=null,ac(k,m,13,!r)};if(a&&m.suspense||ml)return g().then(k=>()=>Zh(k,m)).catch(k=>(v(k),()=>r?qt(r,{error:k}):null));const C=te(!1),w=te(),S=te(!!o);return o&&setTimeout(()=>{S.value=!1},o),s!=null&&setTimeout(()=>{if(!C.value&&!w.value){const k=new Error(`Async component timed out after ${s}ms.`);v(k),w.value=k}},s),g().then(()=>{C.value=!0,m.parent&&uu(m.parent.vnode)&&m.parent.update()}).catch(k=>{v(k),w.value=k}),()=>{if(C.value&&d)return Zh(d,m);if(w.value&&r)return qt(r,{error:w.value});if(n&&!S.value)return Zh(n,m)}}})}function Zh(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)):Jn(e)?e.split(",").includes(t):P2(e)?(e.lastIndex=0,e.test(t)):!1}function hv(e,t){z1(e,"a",t)}function pv(e,t){z1(e,"da",t)}function z1(e,t,n=mo){const r=e.__wdc||(e.__wdc=()=>{let o=n;for(;o;){if(o.isDeactivated)return;o=o.parent}return e()});if(Jh(t,r,n),n){let o=n.parent;for(;o&&o.parent;)uu(o.parent.vnode)&&w5(r,t,n,o),o=o.parent}}function w5(e,t,n,r){const o=Jh(t,e,r,!0);pf(()=>{Ph(r[t],o)},n)}function mv(e){e.shapeFlag&=-257,e.shapeFlag&=-513}function Qh(e){return e.shapeFlag&128?e.ssContent:e}function Jh(e,t,n=mo,r=!1){if(n){const o=n[e]||(n[e]=[]),i=t.__weh||(t.__weh=(...s)=>{sa();const a=pc(n),l=Vi(t,n,e,s);return a(),aa(),l});return r?o.unshift(i):o.push(i),i}}function j1(e,t=mo){Jh("ec",e,t)}function C5(e,t){return vv(lp,e,!0,t)||e}function gv(e){return Jn(e)?vv(lp,e,!1)||e:e||Hv}function V1(e){return vv(Nw,e)}function vv(e,t,n=!0,r=!1){const o=po||mo;if(o){const i=o.type;if(e===lp){const a=Iv(i,!1);if(a&&(a===t||a===jr(t)||a===Xc(jr(t))))return i}const s=U1(o[e]||i[e],t)||U1(o.appContext[e],t);return!s&&r?i:s}}function U1(e,t){return e&&(e[t]||e[jr(t)]||e[Xc(jr(t))])}function ar(e,t,n,r){let o;const i=n&&n[r],s=Nt(e);if(s||Jn(e)){const a=s&&Bi(e);let l=!1,u=!1;a&&(l=!ai(e),u=As(e),e=Bh(e)),o=new Array(e.length);for(let d=0,f=e.length;d<f;d++)o[d]=t(l?u?sc(ji(e[d])):ji(e[d]):e[d],d,void 0,i&&i[d])}else if(typeof e=="number"){o=new Array(e);for(let a=0;a<e;a++)o[a]=t(a+1,a,void 0,i&&i[a])}else if(zn(e))if(e[Symbol.iterator])o=Array.from(e,(a,l)=>t(a,l,void 0,i&&i[l]));else{const a=Object.keys(e);o=new Array(a.length);for(let l=0,u=a.length;l<u;l++){const d=a[l];o[l]=t(e[d],d,l,i&&i[l])}}else o=[];return n&&(n[r]=o),o}function k5(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 iu(e,t,n={},r,o){if(po.ce||po.parent&&xs(po.parent)&&po.parent.ce){const u=Object.keys(n).length>0;return t!=="default"&&(n.name=t),ge(),an(Kt,null,[qt("slot",n,r&&r())],u?-2:64)}let i=e[t];i&&i._c&&(i._d=!1),ge();const s=i&&yv(i(n)),a=n.key||s&&s.key,l=an(Kt,{key:(a&&!si(a)?a:`_${t}`)+(!s&&r?"_fb":"")},s||(r?r():[]),s&&e._===1?64:-2);return!o&&l.scopeId&&(l.slotScopeIds=[l.scopeId+"-s"]),i&&i._c&&(i._d=!0),l}function yv(e){return e.some(t=>pa(t)?!(t.type===Or||t.type===Kt&&!yv(t.children)):!0)?e:null}function S5(e,t){const n={};for(const r in e)n[t&&/[A-Z]/.test(r)?`on:${r}`:Zc(r)]=e[r];return n}function _5(){return null}function A5(){return null}function I5(e){}function E5(e){}function T5(){return null}function x5(){}function R5(e,t){return null}function H1(){return G1("useSlots").slots}function $1(){return G1("useAttrs").attrs}function G1(e){const t=mr();return t.setupContext||(t.setupContext=bw(t))}function nf(e){return Nt(e)?e.reduce((t,n)=>(t[n]=null,t),{}):e}function M5(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 L5(e,t){return!e||!t?e||t:Nt(e)&&Nt(t)?e.concat(t):Kn({},nf(e),nf(t))}function D5(e,t){const n={};for(const r in e)t.includes(r)||Object.defineProperty(n,r,{enumerable:!0,get:()=>e[r]});return n}function O5(e){const t=mr(),n=ml;let r=e();pu(),n&&hu(!1);const o=()=>{pc(t),n&&hu(!0)},i=()=>{mr()!==t&&t.scope.off(),pu(),n&&hu(!1)};return Fh(r)&&(r=r.catch(s=>{throw o(),Promise.resolve().then(()=>Promise.resolve().then(i)),s})),[r,()=>{o(),Promise.resolve().then(i)}]}function P5(e){const t=bv(e),n=e.proxy,r=e.ctx;fp=!1,t.beforeCreate&&W1(t.beforeCreate,e,"bc");const{data:o,computed:i,methods:s,watch:a,provide:l,inject:u,created:d,beforeMount:f,mounted:p,beforeUpdate:g,updated:m,activated:v,deactivated:C,beforeDestroy:w,beforeUnmount:S,destroyed:k,unmounted:b,render:T,renderTracked:L,renderTriggered:z,errorCaptured:G,serverPrefetch:U,expose:j,inheritAttrs:Z,components:R,directives:K,filters:x}=t;if(u&&F5(u,r,null),s)for(const J in s){const Q=s[J];Yt(Q)&&(r[J]=Q.bind(n))}if(o){const J=o.call(n,n);zn(J)&&(e.data=oo(J))}if(fp=!0,i)for(const J in i){const Q=i[J],Y=Yt(Q)?Q.bind(n,n):Yt(Q.get)?Q.get.bind(n,n):Ci,Ce=!Yt(Q)&&Yt(Q.set)?Q.set.bind(n):Ci,fe=ke({get:Y,set:Ce});Object.defineProperty(r,J,{enumerable:!0,configurable:!0,get:()=>fe.value,set:ve=>fe.value=ve})}if(a)for(const J in a)K1(a[J],r,n,J);if(l){const J=Yt(l)?l.call(n):l;Reflect.ownKeys(J).forEach(Q=>{x1(Q,J[Q])})}d&&W1(d,e,"c");function $(J,Q){Nt(Q)?Q.forEach(Y=>J(Y.bind(n))):Q&&J(Q.bind(n))}if($(zv,f),$(jn,p),$(ap,g),$(hf,m),$(hv,v),$(pv,C),$(j1,G),$(Uv,L),$(Vv,z),$(dr,S),$(pf,b),$(jv,U),Nt(j))if(j.length){const J=e.exposed||(e.exposed={});j.forEach(Q=>{Object.defineProperty(J,Q,{get:()=>n[Q],set:Y=>n[Q]=Y,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),U&&fv(e)}function F5(e,t,n=Ci){Nt(e)&&(e=wv(e));for(const r in e){const o=e[r];let i;zn(o)?"default"in o?i=ll(o.from||r,o.default,!0):i=ll(o.from||r):i=ll(o),ur(i)?Object.defineProperty(t,r,{enumerable:!0,configurable:!0,get:()=>i.value,set:s=>i.value=s}):t[r]=i}}function W1(e,t,n){Vi(Nt(e)?e.map(r=>r.bind(t.proxy)):e.bind(t.proxy),t,n)}function K1(e,t,n,r){let o=r.includes(".")?L1(n,r):()=>n[r];if(Jn(e)){const i=t[e];Yt(i)&&Bt(o,i)}else if(Yt(e))Bt(o,e.bind(n));else if(zn(e))if(Nt(e))e.forEach(i=>K1(i,t,n,r));else{const i=Yt(e.handler)?e.handler.bind(n):t[e.handler];Yt(i)&&Bt(o,i,e)}}function bv(e){const t=e.type,{mixins:n,extends:r}=t,{mixins:o,optionsCache:i,config:{optionMergeStrategies:s}}=e.appContext,a=i.get(t);let l;return a?l=a:!o.length&&!n&&!r?l=t:(l={},o.length&&o.forEach(u=>ep(l,u,s,!0)),ep(l,t,s)),zn(t)&&i.set(t,l),l}function ep(e,t,n,r=!1){const{mixins:o,extends:i}=t;i&&ep(e,i,n,!0),o&&o.forEach(s=>ep(e,s,n,!0));for(const s in t)if(!(r&&s==="expose")){const a=zw[s]||n&&n[s];e[s]=a?a(e[s],t[s]):t[s]}return e}function q1(e,t){return t?e?function(){return Kn(Yt(e)?e.call(this,this):e,Yt(t)?t.call(this,this):t)}:t:e}function N5(e,t){return rf(wv(e),wv(t))}function wv(e){if(Nt(e)){const t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function Yo(e,t){return e?[...new Set([].concat(e,t))]:t}function rf(e,t){return e?Kn(Object.create(null),e,t):t}function Y1(e,t){return e?Nt(e)&&Nt(t)?[...new Set([...e,...t])]:Kn(Object.create(null),nf(e),nf(t??{})):t}function B5(e,t){if(!e)return t;if(!t)return e;const n=Kn(Object.create(null),e);for(const r in t)n[r]=Yo(e[r],t[r]);return n}function X1(){return{app:null,config:{isNativeTag:Og,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 z5(e,t){return function(r,o=null){Yt(r)||(r=Kn({},r)),o!=null&&!zn(o)&&(o=null);const i=X1(),s=new WeakSet,a=[];let l=!1;const u=i.app={_uid:jw++,_component:r,_props:o,_container:null,_context:i,_instance:null,version:Jv,get config(){return i.config},set config(d){},use(d,...f){return s.has(d)||(d&&Yt(d.install)?(s.add(d),d.install(u,...f)):Yt(d)&&(s.add(d),d(u,...f))),u},mixin(d){return i.mixins.includes(d)||i.mixins.push(d),u},component(d,f){return f?(i.components[d]=f,u):i.components[d]},directive(d,f){return f?(i.directives[d]=f,u):i.directives[d]},mount(d,f,p){if(!l){const g=u._ceVNode||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,u._container=d,d.__vue_app__=u,af(g.component)}},onUnmount(d){a.push(d)},unmount(){l&&(Vi(a,u._instance,16),e(null,u._container),delete u._container.__vue_app__)},provide(d,f){return i.provides[d]=f,u},runWithContext(d){const f=fl;fl=u;try{return d()}finally{fl=f}}};return u}}function j5(e,t,n=Ln){const r=mr(),o=jr(t),i=qo(t),s=$v(e,o),a=t1((l,u)=>{let d,f=Ln,p;return M1(()=>{const g=e[o];fo(d,g)&&(d=g,u())}),{get(){return l(),n.get?n.get(d):d},set(g){const m=n.set?n.set(g):g;if(!fo(m,d)&&!(f!==Ln&&fo(g,f)))return;const v=r.vnode.props;v&&(t in v||o in v||i in v)&&(`onUpdate:${t}`in v||`onUpdate:${o}`in v||`onUpdate:${i}`in v)||(d=g,u()),r.emit(`update:${t}`,m),fo(g,m)&&fo(g,f)&&!fo(m,p)&&u(),f=g,p=m}}});return a[Symbol.iterator]=()=>{let l=0;return{next(){return l<2?{value:l++?s||Ln:a,done:!1}:{done:!0}}}},a}function V5(e,t,...n){if(e.isUnmounted)return;const r=e.vnode.props||Ln;let o=n;const i=t.startsWith("update:"),s=i&&$v(r,t.slice(7));s&&(s.trim&&(o=n.map(d=>Jn(d)?d.trim():d)),s.number&&(o=n.map(zd)));let a,l=r[a=Zc(t)]||r[a=Zc(jr(t))];!l&&i&&(l=r[a=Zc(qo(t))]),l&&Vi(l,e,6,o);const u=r[a+"Once"];if(u){if(!e.emitted)e.emitted={};else if(e.emitted[a])return;e.emitted[a]=!0,Vi(u,e,6,o)}}function Z1(e,t,n=!1){const r=n?Vw: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=u=>{const d=Z1(u,t,!0);d&&(a=!0,Kn(s,d))};!n&&t.mixins.length&&t.mixins.forEach(l),e.extends&&l(e.extends),e.mixins&&e.mixins.forEach(l)}return!i&&!a?(zn(e)&&r.set(e,null),null):(Nt(i)?i.forEach(l=>s[l]=null):Kn(s,i),zn(e)&&r.set(e,s),s)}function tp(e,t){return!e||!Yc(t)?!1:(t=t.slice(2).replace(/Once$/,""),$n(e,t[0].toLowerCase()+t.slice(1))||$n(e,qo(t))||$n(e,t))}function np(e){const{type:t,vnode:n,proxy:r,withProxy:o,propsOptions:[i],slots:s,attrs:a,emit:l,render:u,renderCache:d,props:f,data:p,setupState:g,ctx:m,inheritAttrs:v}=e,C=Qd(e);let w,S;try{if(n.shapeFlag&4){const b=o||r,T=b;w=li(u.call(T,b,d,f,g,p,m)),S=a}else{const b=t;w=li(b.length>1?b(f,{attrs:a,slots:s,emit:l}):b(f,null)),S=t.props?a:Uw(a)}}catch(b){fu.length=0,ac(b,e,1),w=qt(Or)}let k=w;if(S&&v!==!1){const b=Object.keys(S),{shapeFlag:T}=k;b.length&&T&7&&(i&&b.some(Pd)&&(S=Hw(S,i)),k=Es(k,S,!1,!0))}return n.dirs&&(k=Es(k,null,!1,!0),k.dirs=k.dirs?k.dirs.concat(n.dirs):n.dirs),n.transition&&ha(k,n.transition),w=k,Qd(C),w}function U5(e,t=!0){let n;for(let r=0;r<e.length;r++){const o=e[r];if(pa(o)){if(o.type!==Or||o.children==="v-if"){if(n)return;n=o}}else return}return n}function H5(e,t,n){const{props:r,children:o,component:i}=e,{props:s,children:a,patchFlag:l}=t,u=i.emitsOptions;if(t.dirs||t.transition)return!0;if(n&&l>=0){if(l&1024)return!0;if(l&16)return r?Q1(r,s,u):!!s;if(l&8){const d=t.dynamicProps;for(let f=0;f<d.length;f++){const p=d[f];if(J1(s,r,p)&&!tp(u,p))return!0}}}else return(o||a)&&(!a||!a.$stable)?!0:r===s?!1:r?s?Q1(r,s,u):!0:!!s;return!1}function Q1(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(J1(t,e,i)&&!tp(n,i))return!0}return!1}function J1(e,t,n){const r=e[n],o=t[n];return n==="style"&&zn(r)&&zn(o)?!ia(r,o):r!==o}function rp({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 $5(e,t,n,r=!1){const o={},i=Wv();e.propsDefaults=Object.create(null),ew(e,t,o,i);for(const s in e.propsOptions[0])s in o||(o[s]=void 0);n?e.props=r?o:J2(o):e.type.props?e.props=o:e.props=i,e.attrs=i}function G5(e,t,n,r){const{props:o,attrs:i,vnode:{patchFlag:s}}=e,a=gn(o),[l]=e.propsOptions;let u=!1;if((r||s>0)&&!(s&16)){if(s&8){const d=e.vnode.dynamicProps;for(let f=0;f<d.length;f++){let p=d[f];if(tp(e.emitsOptions,p))continue;const g=t[p];if(l)if($n(i,p))g!==i[p]&&(i[p]=g,u=!0);else{const m=jr(p);o[m]=Cv(l,a,m,g,e,!1)}else g!==i[p]&&(i[p]=g,u=!0)}}}else{ew(e,t,o,i)&&(u=!0);let d;for(const f in a)(!t||!$n(t,f)&&((d=qo(f))===f||!$n(t,d)))&&(l?n&&(n[f]!==void 0||n[d]!==void 0)&&(o[f]=Cv(l,a,f,void 0,e,!0)):delete o[f]);if(i!==a)for(const f in i)(!t||!$n(t,f))&&(delete i[f],u=!0)}u&&la(e.attrs,"set","")}function ew(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 u=t[l];let d;o&&$n(o,d=jr(l))?!i||!i.includes(d)?n[d]=u:(a||(a={}))[d]=u:tp(e.emitsOptions,l)||(!(l in r)||u!==r[l])&&(r[l]=u,s=!0)}if(i){const l=gn(n),u=a||Ln;for(let d=0;d<i.length;d++){const f=i[d];n[f]=Cv(o,l,f,u[f],e,!$n(u,f))}}return s}function Cv(e,t,n,r,o,i){const s=e[n];if(s!=null){const a=$n(s,"default");if(a&&r===void 0){const l=s.default;if(s.type!==Function&&!s.skipFactory&&Yt(l)){const{propsDefaults:u}=o;if(n in u)r=u[n];else{const d=pc(o);r=u[n]=l.call(null,t),d()}}else r=l;o.ce&&o.ce._setProp(n,r)}s[0]&&(i&&!a?r=!1:s[1]&&(r===""||r===qo(n))&&(r=!0))}return r}function tw(e,t,n=!1){const r=n?$w: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]=tw(f,t,!0);Kn(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 zn(e)&&r.set(e,nc),nc;if(Nt(i))for(let d=0;d<i.length;d++){const f=jr(i[d]);nw(f)&&(s[f]=Ln)}else if(i)for(const d in i){const f=jr(d);if(nw(f)){const p=i[d],g=s[f]=Nt(p)||Yt(p)?{type:p}:Kn({},p),m=g.type;let v=!1,C=!0;if(Nt(m))for(let w=0;w<m.length;++w){const S=m[w],k=Yt(S)&&S.name;if(k==="Boolean"){v=!0;break}else k==="String"&&(C=!1)}else v=Yt(m)&&m.name==="Boolean";g[0]=v,g[1]=C,(v||$n(g,"default"))&&a.push(f)}}const u=[s,a];return zn(e)&&r.set(e,u),u}function nw(e){return e[0]!=="$"&&!sl(e)}function rw(e){return iw(e)}function ow(e){return iw(e,v5)}function iw(e,t){const n=Vd();n.__VUE__=!0;const{insert:r,remove:o,patchProp:i,createElement:s,createText:a,createComment:l,setText:u,setElementText:d,parentNode:f,nextSibling:p,setScopeId:g=Ci,insertStaticContent:m}=e,v=(re,I,se,N=null,q=null,O=null,ee=void 0,ye=null,P=!!I.dynamicChildren)=>{if(re===I)return;re&&!ns(re,I)&&(N=lt(re),ve(re,q,O,!0),re=null),I.patchFlag===-2&&(P=!1,I.dynamicChildren=null);const{type:B,ref:ce,shapeFlag:_e}=I;switch(B){case va:C(re,I,se,N);break;case Or:w(re,I,se,N);break;case hl:re==null&&S(I,se,N,ee);break;case Kt:R(re,I,se,N,q,O,ee,ye,P);break;default:_e&1?T(re,I,se,N,q,O,ee,ye,P):_e&6?K(re,I,se,N,q,O,ee,ye,P):(_e&64||_e&128)&&B.process(re,I,se,N,q,O,ee,ye,P,ae)}ce!=null&&q?ou(ce,re&&re.ref,O,I||re,!I):ce==null&&re&&re.ref!=null&&ou(re.ref,null,O,re,!0)},C=(re,I,se,N)=>{if(re==null)r(I.el=a(I.children),se,N);else{const q=I.el=re.el;I.children!==re.children&&u(q,I.children)}},w=(re,I,se,N)=>{re==null?r(I.el=l(I.children||""),se,N):I.el=re.el},S=(re,I,se,N)=>{[re.el,re.anchor]=m(re.children,I,se,N,re.el,re.anchor)},k=({el:re,anchor:I},se,N)=>{let q;for(;re&&re!==I;)q=p(re),r(re,se,N),re=q;r(I,se,N)},b=({el:re,anchor:I})=>{let se;for(;re&&re!==I;)se=p(re),o(re),re=se;o(I)},T=(re,I,se,N,q,O,ee,ye,P)=>{if(I.type==="svg"?ee="svg":I.type==="math"&&(ee="mathml"),re==null)L(I,se,N,q,O,ee,ye,P);else{const B=re.el&&re.el._isVueCE?re.el:null;try{B&&B._beginPatch(),U(re,I,q,O,ee,ye,P)}finally{B&&B._endPatch()}}},L=(re,I,se,N,q,O,ee,ye)=>{let P,B;const{props:ce,shapeFlag:_e,transition:Ae,dirs:De}=re;if(P=re.el=s(re.type,O,ce&&ce.is,ce),_e&8?d(P,re.children):_e&16&&G(re.children,P,null,N,q,kv(re,O),ee,ye),De&&Is(re,null,N,"created"),z(P,re,re.scopeId,ee,N),ce){for(const ot in ce)ot!=="value"&&!sl(ot)&&i(P,ot,null,ce[ot],O,N);"value"in ce&&i(P,"value",null,ce.value,O),(B=ce.onVnodeBeforeMount)&&ci(B,N,re)}De&&Is(re,null,N,"beforeMount");const Ye=sw(q,Ae);Ye&&Ae.beforeEnter(P),r(P,I,se),((B=ce&&ce.onVnodeMounted)||Ye||De)&&Hr(()=>{B&&ci(B,N,re),Ye&&Ae.enter(P),De&&Is(re,null,N,"mounted")},q)},z=(re,I,se,N,q)=>{if(se&&g(re,se),N)for(let O=0;O<N.length;O++)g(re,N[O]);if(q){let O=q.subTree;if(I===O||mf(O.type)&&(O.ssContent===I||O.ssFallback===I)){const ee=q.vnode;z(re,ee,ee.scopeId,ee.slotScopeIds,q.parent)}}},G=(re,I,se,N,q,O,ee,ye,P=0)=>{for(let B=P;B<re.length;B++){const ce=re[B]=ye?ma(re[B]):li(re[B]);v(null,ce,I,se,N,q,O,ee,ye)}},U=(re,I,se,N,q,O,ee)=>{const ye=I.el=re.el;let{patchFlag:P,dynamicChildren:B,dirs:ce}=I;P|=re.patchFlag&16;const _e=re.props||Ln,Ae=I.props||Ln;let De;if(se&&cc(se,!1),(De=Ae.onVnodeBeforeUpdate)&&ci(De,se,I,re),ce&&Is(I,re,se,"beforeUpdate"),se&&cc(se,!0),(_e.innerHTML&&Ae.innerHTML==null||_e.textContent&&Ae.textContent==null)&&d(ye,""),B?j(re.dynamicChildren,B,ye,se,N,kv(I,q),O):ee||Q(re,I,ye,null,se,N,kv(I,q),O,!1),P>0){if(P&16)Z(ye,_e,Ae,se,q);else if(P&2&&_e.class!==Ae.class&&i(ye,"class",null,Ae.class,q),P&4&&i(ye,"style",_e.style,Ae.style,q),P&8){const Ye=I.dynamicProps;for(let ot=0;ot<Ye.length;ot++){const gt=Ye[ot],xt=_e[gt],Tt=Ae[gt];(Tt!==xt||gt==="value")&&i(ye,gt,xt,Tt,q,se)}}P&1&&re.children!==I.children&&d(ye,I.children)}else!ee&&B==null&&Z(ye,_e,Ae,se,q);((De=Ae.onVnodeUpdated)||ce)&&Hr(()=>{De&&ci(De,se,I,re),ce&&Is(I,re,se,"updated")},N)},j=(re,I,se,N,q,O,ee)=>{for(let ye=0;ye<I.length;ye++){const P=re[ye],B=I[ye],ce=P.el&&(P.type===Kt||!ns(P,B)||P.shapeFlag&198)?f(P.el):se;v(P,B,ce,null,N,q,O,ee,!0)}},Z=(re,I,se,N,q)=>{if(I!==se){if(I!==Ln)for(const O in I)!sl(O)&&!(O in se)&&i(re,O,I[O],null,q,N);for(const O in se){if(sl(O))continue;const ee=se[O],ye=I[O];ee!==ye&&O!=="value"&&i(re,O,ye,ee,q,N)}"value"in se&&i(re,"value",I.value,se.value,q)}},R=(re,I,se,N,q,O,ee,ye,P)=>{const B=I.el=re?re.el:a(""),ce=I.anchor=re?re.anchor:a("");let{patchFlag:_e,dynamicChildren:Ae,slotScopeIds:De}=I;De&&(ye=ye?ye.concat(De):De),re==null?(r(B,se,N),r(ce,se,N),G(I.children||[],se,ce,q,O,ee,ye,P)):_e>0&&_e&64&&Ae&&re.dynamicChildren&&re.dynamicChildren.length===Ae.length?(j(re.dynamicChildren,Ae,se,q,O,ee,ye),(I.key!=null||q&&I===q.subTree)&&Sv(re,I,!0)):Q(re,I,se,ce,q,O,ee,ye,P)},K=(re,I,se,N,q,O,ee,ye,P)=>{I.slotScopeIds=ye,re==null?I.shapeFlag&512?q.ctx.activate(I,se,N,ee,P):x(I,se,N,q,O,ee,P):W(re,I,P)},x=(re,I,se,N,q,O,ee)=>{const ye=re.component=mw(re,N,q);if(uu(re)&&(ye.ctx.renderer=ae),vw(ye,!1,ee),ye.asyncDep){if(q&&q.registerDep(ye,$,ee),!re.el){const P=ye.subTree=qt(Or);w(null,P,I,se),re.placeholder=P.el}}else $(ye,re,I,se,q,O,ee)},W=(re,I,se)=>{const N=I.component=re.component;if(H5(re,I,se))if(N.asyncDep&&!N.asyncResolved){J(N,I,se);return}else N.next=I,N.update();else I.el=re.el,N.vnode=I},$=(re,I,se,N,q,O,ee)=>{const ye=()=>{if(re.isMounted){let{next:_e,bu:Ae,u:De,parent:Ye,vnode:ot}=re;{const je=aw(re);if(je){_e&&(_e.el=ot.el,J(re,_e,ee)),je.asyncDep.then(()=>{Hr(()=>{re.isUnmounted||B()},q)});return}}let gt=_e,xt;cc(re,!1),_e?(_e.el=ot.el,J(re,_e,ee)):_e=ot,Ae&&ic(Ae),(xt=_e.props&&_e.props.onVnodeBeforeUpdate)&&ci(xt,Ye,_e,ot),cc(re,!0);const Tt=np(re),$t=re.subTree;re.subTree=Tt,v($t,Tt,f($t.el),lt($t),re,q,O),_e.el=Tt.el,gt===null&&rp(re,Tt.el),De&&Hr(De,q),(xt=_e.props&&_e.props.onVnodeUpdated)&&Hr(()=>ci(xt,Ye,_e,ot),q)}else{let _e;const{el:Ae,props:De}=I,{bm:Ye,m:ot,parent:gt,root:xt,type:Tt}=re,$t=xs(I);if(cc(re,!1),Ye&&ic(Ye),!$t&&(_e=De&&De.onVnodeBeforeMount)&&ci(_e,gt,I),cc(re,!0),Ae&&He){const je=()=>{re.subTree=np(re),He(Ae,re.subTree,re,q,null)};$t&&Tt.__asyncHydrate?Tt.__asyncHydrate(Ae,re,je):je()}else{xt.ce&&xt.ce._hasShadowRoot()&&xt.ce._injectChildStyle(Tt,re.parent?re.parent.type:void 0);const je=re.subTree=np(re);v(null,je,se,N,re,q,O),I.el=je.el}if(ot&&Hr(ot,q),!$t&&(_e=De&&De.onVnodeMounted)){const je=I;Hr(()=>ci(_e,gt,je),q)}(I.shapeFlag&256||gt&&xs(gt.vnode)&>.vnode.shapeFlag&256)&&re.a&&Hr(re.a,q),re.isMounted=!0,I=se=N=null}};re.scope.on();const P=re.effect=new Jc(ye);re.scope.off();const B=re.update=P.run.bind(P),ce=re.job=P.runIfDirty.bind(P);ce.i=re,ce.id=re.uid,P.scheduler=()=>lv(ce),cc(re,!0),B()},J=(re,I,se)=>{I.component=re;const N=re.vnode.props;re.vnode=I,re.next=null,G5(re,I.props,N,se),Kw(re,I.children,se),sa(),I1(re),aa()},Q=(re,I,se,N,q,O,ee,ye,P=!1)=>{const B=re&&re.children,ce=re?re.shapeFlag:0,_e=I.children,{patchFlag:Ae,shapeFlag:De}=I;if(Ae>0){if(Ae&128){Ce(B,_e,se,N,q,O,ee,ye,P);return}else if(Ae&256){Y(B,_e,se,N,q,O,ee,ye,P);return}}De&8?(ce&16&&Ze(B,q,O),_e!==B&&d(se,_e)):ce&16?De&16?Ce(B,_e,se,N,q,O,ee,ye,P):Ze(B,q,O,!0):(ce&8&&d(se,""),De&16&&G(_e,se,N,q,O,ee,ye,P))},Y=(re,I,se,N,q,O,ee,ye,P)=>{re=re||nc,I=I||nc;const B=re.length,ce=I.length,_e=Math.min(B,ce);let Ae;for(Ae=0;Ae<_e;Ae++){const De=I[Ae]=P?ma(I[Ae]):li(I[Ae]);v(re[Ae],De,se,null,q,O,ee,ye,P)}B>ce?Ze(re,q,O,!0,!1,_e):G(I,se,N,q,O,ee,ye,P,_e)},Ce=(re,I,se,N,q,O,ee,ye,P)=>{let B=0;const ce=I.length;let _e=re.length-1,Ae=ce-1;for(;B<=_e&&B<=Ae;){const De=re[B],Ye=I[B]=P?ma(I[B]):li(I[B]);if(ns(De,Ye))v(De,Ye,se,null,q,O,ee,ye,P);else break;B++}for(;B<=_e&&B<=Ae;){const De=re[_e],Ye=I[Ae]=P?ma(I[Ae]):li(I[Ae]);if(ns(De,Ye))v(De,Ye,se,null,q,O,ee,ye,P);else break;_e--,Ae--}if(B>_e){if(B<=Ae){const De=Ae+1,Ye=De<ce?I[De].el:N;for(;B<=Ae;)v(null,I[B]=P?ma(I[B]):li(I[B]),se,Ye,q,O,ee,ye,P),B++}}else if(B>Ae)for(;B<=_e;)ve(re[B],q,O,!0),B++;else{const De=B,Ye=B,ot=new Map;for(B=Ye;B<=Ae;B++){const jt=I[B]=P?ma(I[B]):li(I[B]);jt.key!=null&&ot.set(jt.key,B)}let gt,xt=0;const Tt=Ae-Ye+1;let $t=!1,je=0;const rn=new Array(Tt);for(B=0;B<Tt;B++)rn[B]=0;for(B=De;B<=_e;B++){const jt=re[B];if(xt>=Tt){ve(jt,q,O,!0);continue}let En;if(jt.key!=null)En=ot.get(jt.key);else for(gt=Ye;gt<=Ae;gt++)if(rn[gt-Ye]===0&&ns(jt,I[gt])){En=gt;break}En===void 0?ve(jt,q,O,!0):(rn[En-Ye]=B+1,En>=je?je=En:$t=!0,v(jt,I[En],se,null,q,O,ee,ye,P),xt++)}const Un=$t?W5(rn):nc;for(gt=Un.length-1,B=Tt-1;B>=0;B--){const jt=Ye+B,En=I[jt],Gr=I[jt+1],br=jt+1<ce?Gr.el||lw(Gr):N;rn[B]===0?v(null,En,se,br,q,O,ee,ye,P):$t&&(gt<0||B!==Un[gt]?fe(En,se,br,2):gt--)}}},fe=(re,I,se,N,q=null)=>{const{el:O,type:ee,transition:ye,children:P,shapeFlag:B}=re;if(B&6){fe(re.component.subTree,I,se,N);return}if(B&128){re.suspense.move(I,se,N);return}if(B&64){ee.move(re,I,se,ae);return}if(ee===Kt){r(O,I,se);for(let ce=0;ce<P.length;ce++)fe(P[ce],I,se,N);r(re.anchor,I,se);return}if(ee===hl){k(re,I,se);return}if(N!==2&&B&1&&ye)if(N===0)ye.beforeEnter(O),r(O,I,se),Hr(()=>ye.enter(O),q);else{const{leave:ce,delayLeave:_e,afterLeave:Ae}=ye,De=()=>{re.ctx.isUnmounted?o(O):r(O,I,se)},Ye=()=>{O._isLeaving&&O[is](!0),ce(O,()=>{De(),Ae&&Ae()})};_e?_e(O,De,Ye):Ye()}else r(O,I,se)},ve=(re,I,se,N=!1,q=!1)=>{const{type:O,props:ee,ref:ye,children:P,dynamicChildren:B,shapeFlag:ce,patchFlag:_e,dirs:Ae,cacheIndex:De,memo:Ye}=re;if(_e===-2&&(q=!1),ye!=null&&(sa(),ou(ye,null,se,re,!0),aa()),De!=null&&(I.renderCache[De]=void 0),ce&256){I.ctx.deactivate(re);return}const ot=ce&1&&Ae,gt=!xs(re);let xt;if(gt&&(xt=ee&&ee.onVnodeBeforeUnmount)&&ci(xt,I,re),ce&6)Fe(re.component,se,N);else{if(ce&128){re.suspense.unmount(se,N);return}ot&&Is(re,null,I,"beforeUnmount"),ce&64?re.type.remove(re,I,se,ae,N):B&&!B.hasOnce&&(O!==Kt||_e>0&&_e&64)?Ze(B,I,se,!1,!0):(O===Kt&&_e&384||!q&&ce&16)&&Ze(P,I,se),N&&me(re)}const Tt=Ye!=null&&De==null;(gt&&(xt=ee&&ee.onVnodeUnmounted)||ot||Tt)&&Hr(()=>{xt&&ci(xt,I,re),ot&&Is(re,null,I,"unmounted"),Tt&&(re.el=null)},se)},me=re=>{const{type:I,el:se,anchor:N,transition:q}=re;if(I===Kt){Ee(se,N);return}if(I===hl){b(re);return}const O=()=>{o(se),q&&!q.persisted&&q.afterLeave&&q.afterLeave()};if(re.shapeFlag&1&&q&&!q.persisted){const{leave:ee,delayLeave:ye}=q,P=()=>ee(se,O);ye?ye(re.el,O,P):P()}else O()},Ee=(re,I)=>{let se;for(;re!==I;)se=p(re),o(re),re=se;o(I)},Fe=(re,I,se)=>{const{bum:N,scope:q,job:O,subTree:ee,um:ye,m:P,a:B}=re;op(P),op(B),N&&ic(N),q.stop(),O&&(O.flags|=8,ve(ee,re,I,se)),ye&&Hr(ye,I),Hr(()=>{re.isUnmounted=!0},I)},Ze=(re,I,se,N=!1,q=!1,O=0)=>{for(let ee=O;ee<re.length;ee++)ve(re[ee],I,se,N,q)},lt=re=>{if(re.shapeFlag&6)return lt(re.component.subTree);if(re.shapeFlag&128)return re.suspense.next();const I=p(re.anchor||re.el),se=I&&I[Mv];return se?p(se):I};let et=!1;const Et=(re,I,se)=>{let N;re==null?I._vnode&&(ve(I._vnode,null,null,!0),N=I._vnode.component):v(I._vnode||null,re,I,null,null,null,se),I._vnode=re,et||(et=!0,I1(N),Kh(),et=!1)},ae={p:v,um:ve,m:fe,r:me,mt:x,mc:G,pc:Q,pbc:j,n:lt,o:e};let Ie,He;return t&&([Ie,He]=t(ae)),{render:Et,hydrate:Ie,createApp:z5(Et,Ie)}}function kv({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 cc({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function sw(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function Sv(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]=ma(o[i]),a.el=s.el),!n&&a.patchFlag!==-2&&Sv(s,a)),a.type===va&&(a.patchFlag===-1&&(a=o[i]=ma(a)),a.el=s.el),a.type===Or&&!a.el&&(a.el=s.el)}}function W5(e){const t=e.slice(),n=[0];let r,o,i,s,a;const l=e.length;for(r=0;r<l;r++){const u=e[r];if(u!==0){if(o=n[n.length-1],e[o]<u){t[r]=o,n.push(r);continue}for(i=0,s=n.length-1;i<s;)a=i+s>>1,e[n[a]]<u?i=a+1:s=a;u<e[n[i]]&&(i>0&&(t[r]=n[i-1]),n[i]=r)}}for(i=n.length,s=n[i-1];i-- >0;)n[i]=s,s=t[s];return n}function aw(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:aw(t)}function op(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}function lw(e){if(e.placeholder)return e.placeholder;const t=e.component;return t?lw(t.subTree):null}function of(e,t){const n=e.props&&e.props[t];Yt(n)&&n()}function K5(e,t,n,r,o,i,s,a,l){const{p:u,o:{createElement:d}}=l,f=d("div"),p=e.suspense=cw(e,o,r,t,f,n,i,s,a,l);u(null,p.pendingBranch=e.ssContent,f,null,r,p,i,s),p.deps>0?(of(e,"onPending"),of(e,"onFallback"),u(null,e.ssFallback,t,n,r,null,i,s),su(p,e.ssFallback)):p.resolve(!1,!0)}function q5(e,t,n,r,o,i,s,a,{p:l,um:u,o:{createElement:d}}){const f=t.suspense=e.suspense;f.vnode=t,t.el=e.el;const p=t.ssContent,g=t.ssFallback,{activeBranch:m,pendingBranch:v,isInFallback:C,isHydrating:w}=f;if(v)f.pendingBranch=p,ns(v,p)?(l(v,p,f.hiddenContainer,null,o,f,i,s,a),f.deps<=0?f.resolve():C&&(w||(l(m,g,n,r,o,null,i,s,a),su(f,g)))):(f.pendingId=mp++,w?(f.isHydrating=!1,f.activeBranch=v):u(v,o,f),f.deps=0,f.effects.length=0,f.hiddenContainer=d("div"),C?(l(null,p,f.hiddenContainer,null,o,f,i,s,a),f.deps<=0?f.resolve():(l(m,g,n,r,o,null,i,s,a),su(f,g))):m&&ns(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&&ns(m,p))l(m,p,n,r,o,f,i,s,a),su(f,p);else if(of(t,"onPending"),f.pendingBranch=p,p.shapeFlag&512?f.pendingId=p.component.suspenseId:f.pendingId=mp++,l(null,p,f.hiddenContainer,null,o,f,i,s,a),f.deps<=0)f.resolve();else{const{timeout:S,pendingId:k}=f;S>0?setTimeout(()=>{f.pendingId===k&&f.fallback(g)},S):S===0&&f.fallback(g)}}function cw(e,t,n,r,o,i,s,a,l,u,d=!1){const{p:f,m:p,um:g,n:m,o:{parentNode:v,remove:C}}=u;let w;const S=Z5(e);S&&t&&t.pendingBranch&&(w=t.pendingId,t.deps++);const k=e.props?jd(e.props.timeout):void 0,b=i,T={vnode:e,parent:t,parentComponent:n,namespace:s,container:r,hiddenContainer:o,deps:0,pendingId:mp++,timeout:typeof k=="number"?k:-1,activeBranch:null,isFallbackMountPending:!1,pendingBranch:null,isInFallback:!d,isHydrating:d,isUnmounted:!1,effects:[],resolve(L=!1,z=!1){const{vnode:G,activeBranch:U,pendingBranch:j,pendingId:Z,effects:R,parentComponent:K,container:x,isInFallback:W}=T;let $=!1;T.isHydrating?T.isHydrating=!1:L||($=U&&j.transition&&j.transition.mode==="out-in",$&&(U.transition.afterLeave=()=>{Z===T.pendingId&&(p(j,x,i===b?m(U):i,0),Zd(R),W&&G.ssFallback&&(G.ssFallback.el=null))}),U&&!T.isFallbackMountPending&&(v(U.el)===x&&(i=m(U)),g(U,K,T,!0),!$&&W&&G.ssFallback&&Hr(()=>G.ssFallback.el=null,T)),$||p(j,x,i,0)),T.isFallbackMountPending=!1,su(T,j),T.pendingBranch=null,T.isInFallback=!1;let J=T.parent,Q=!1;for(;J;){if(J.pendingBranch){J.effects.push(...R),Q=!0;break}J=J.parent}!Q&&!$&&Zd(R),T.effects=[],S&&t&&t.pendingBranch&&w===t.pendingId&&(t.deps--,t.deps===0&&!z&&t.resolve()),of(G,"onResolve")},fallback(L){if(!T.pendingBranch)return;const{vnode:z,activeBranch:G,parentComponent:U,container:j,namespace:Z}=T;of(z,"onFallback");const R=m(G),K=()=>{T.isFallbackMountPending=!1,T.isInFallback&&(f(null,L,j,R,U,null,Z,a,l),su(T,L))},x=L.transition&&L.transition.mode==="out-in";x&&(T.isFallbackMountPending=!0,G.transition.afterLeave=K),T.isInFallback=!0,g(G,U,null,!0),x||K()},move(L,z,G){T.activeBranch&&p(T.activeBranch,L,z,G),T.container=L},next(){return T.activeBranch&&m(T.activeBranch)},registerDep(L,z,G){const U=!!T.pendingBranch;U&&T.deps++;const j=L.vnode.el;L.asyncDep.catch(Z=>{ac(Z,L,0)}).then(Z=>{if(L.isUnmounted||T.isUnmounted||T.pendingId!==L.suspenseId)return;pu(),L.asyncResolved=!0;const{vnode:R}=L;Av(L,Z,!1),j&&(R.el=j);const K=!j&&L.subTree.el;z(L,R,v(j||L.subTree.el),j?null:m(L.subTree),T,s,G),K&&(R.placeholder=null,C(K)),rp(L,R.el),U&&--T.deps===0&&T.resolve()})},unmount(L,z){T.isUnmounted=!0,T.activeBranch&&g(T.activeBranch,n,L,z),T.pendingBranch&&g(T.pendingBranch,n,L,z)}};return T}function Y5(e,t,n,r,o,i,s,a,l){const u=t.suspense=cw(t,r,n,e.parentNode,document.createElement("div"),null,o,i,s,a,!0),d=l(e,u.pendingBranch=t.ssContent,n,u,i,s);return u.deps===0&&u.resolve(!1,!0),d}function X5(e){const{shapeFlag:t,children:n}=e,r=t&32;e.ssContent=uw(r?n.default:n),e.ssFallback=r?uw(n.fallback):qt(Or)}function uw(e){let t;if(Yt(e)){const n=pl&&e._c;n&&(e._d=!1,ge()),e=e(),n&&(e._d=!0,t=Io,fw())}return Nt(e)&&(e=U5(e)),e=li(e),t&&!e.dynamicChildren&&(e.dynamicChildren=t.filter(n=>n!==e)),e}function dw(e,t){t&&t.pendingBranch?Nt(e)?t.effects.push(...e):t.effects.push(e):Zd(e)}function su(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,rp(r,o))}function Z5(e){const t=e.props&&e.props.suspensible;return t!=null&&t!==!1}function ge(e=!1){fu.push(Io=e?null:[])}function fw(){fu.pop(),Io=fu[fu.length-1]||null}function sf(e,t=!1){pl+=e,e<0&&Io&&t&&(Io.hasOnce=!0)}function hw(e){return e.dynamicChildren=pl>0?Io||nc:null,fw(),pl>0&&Io&&Io.push(e),e}function Le(e,t,n,r,o,i){return hw($e(e,t,n,r,o,i,!0))}function an(e,t,n,r,o){return hw(qt(e,t,n,r,o,!0))}function pa(e){return e?e.__v_isVNode===!0:!1}function ns(e,t){return e.type===t.type&&e.key===t.key}function Q5(e){}function $e(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&&Zv(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:po};return a?(_v(l,n),i&128&&e.normalize(l)):n&&(l.shapeFlag|=Jn(n)?8:16),pl>0&&!s&&Io&&(l.patchFlag>0||i&6)&&l.patchFlag!==32&&Io.push(l),l}function J5(e,t=null,n=null,r=0,o=null,i=!1){if((!e||e===Hv)&&(e=Or),pa(e)){const a=Es(e,t,!0);return n&&_v(a,n),pl>0&&!i&&Io&&(a.shapeFlag&6?Io[Io.indexOf(e)]=a:Io.push(a)),a.patchFlag=-2,a}if(rT(e)&&(e=e.__vccOpts),t){t=pw(t);let{class:a,style:l}=t;a&&!Jn(a)&&(t.class=Jt(a)),zn(l)&&(Hd(l)&&!Nt(l)&&(l=Kn({},l)),t.style=bn(l))}const s=Jn(e)?1:mf(e)?128:Lv(e)?64:zn(e)?4:Yt(e)?2:0;return $e(e,t,n,r,o,s,i,!0)}function pw(e){return e?Hd(e)||Kv(e)?Kn({},e):e:null}function Es(e,t,n=!1,r=!1){const{props:o,ref:i,patchFlag:s,children:a,transition:l}=e,u=t?Ts(o||{},t):o,d={__v_isVNode:!0,__v_skip:!0,type:e.type,props:u,key:u&&Zv(u),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&&Es(e.ssContent),ssFallback:e.ssFallback&&Es(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return l&&r&&ha(d,l.clone(d)),d}function rs(e=" ",t=0){return qt(va,null,e,t)}function eT(e,t){const n=qt(hl,null,e);return n.staticCount=t,n}function ht(e="",t=!1){return t?(ge(),an(Or,null,e)):qt(Or,null,e)}function li(e){return e==null||typeof e=="boolean"?qt(Or):Nt(e)?qt(Kt,null,e.slice()):pa(e)?ma(e):qt(va,null,String(e))}function ma(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:Es(e)}function _v(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),_v(e,o()),o._c&&(o._d=!0));return}else{n=32;const o=t._;!o&&!Kv(t)?t._ctx=po:o===3&&po&&(po.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else Yt(t)?(t={default:t,_ctx:po},n=32):(t=String(t),r&64?(n=16,t=[rs(t)]):n=8);e.children=t,e.shapeFlag|=n}function Ts(...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=Jt([t.class,r.class]));else if(o==="style")t.style=bn([t.style,r.style]);else if(Yc(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 ci(e,t,n,r=null){Vi(e,t,7,[n,r])}function mw(e,t,n){const r=e.type,o=(t?t.appContext:e.appContext)||Yw,i={uid:Xw++,vnode:e,type:r,parent:t,appContext:o,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new Hh(!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:tw(r,o),emitsOptions:Z1(r,o),emit:null,emitted:null,propsDefaults:Ln,inheritAttrs:r.inheritAttrs,ctx:Ln,data:Ln,props:Ln,attrs:Ln,slots:Ln,refs:Ln,setupState:Ln,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=V5.bind(null,i),e.ce&&e.ce(i),i}function gw(e){return e.vnode.shapeFlag&4}function vw(e,t=!1,n=!1){t&&hu(t);const{props:r,children:o}=e.vnode,i=gw(e);$5(e,r,i,t),Ww(e,o,n||t);const s=i?tT(e,t):void 0;return t&&hu(!1),s}function tT(e,t){const n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,dp);const{setup:r}=n;if(r){sa();const o=e.setupContext=r.length>1?bw(e):null,i=pc(e),s=nu(r,e,0,[e.props,o]),a=Fh(s);if(aa(),i(),(a||e.sp)&&!xs(e)&&fv(e),a){if(s.then(pu,pu),t)return s.then(l=>{Av(e,l,t)}).catch(l=>{ac(l,e,0)});e.asyncDep=s}else Av(e,s,t)}else yw(e,t)}function Av(e,t,n){Yt(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:zn(t)&&(e.setupState=Xg(t)),yw(e,n)}function nT(e){vp=e,Qv=t=>{t.render._rc&&(t.withProxy=new Proxy(t.ctx,Bw))}}function yw(e,t,n){const r=e.type;if(!e.render){if(!t&&vp&&!r.render){const o=r.template||bv(e).template;if(o){const{isCustomElement:i,compilerOptions:s}=e.appContext.config,{delimiters:a,compilerOptions:l}=r,u=Kn(Kn({isCustomElement:i,delimiters:a},s),l);r.render=vp(o,u)}}e.render=r.render||Ci,Qv&&Qv(e)}{const o=pc(e);sa();try{P5(e)}finally{aa(),o()}}}function bw(e){const t=n=>{e.exposed=n||{}};return{attrs:new Proxy(e.attrs,Qw),slots:e.slots,emit:e.emit,expose:t}}function af(e){return e.exposed?e.exposeProxy||(e.exposeProxy=new Proxy(Xg(io(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in du)return du[n](e)},has(t,n){return n in t||n in du}})):e.proxy}function Iv(e,t=!0){return Yt(e)?e.displayName||e.name:e.name||t&&e.__name}function rT(e){return Yt(e)&&"__vccOpts"in e}function Ur(e,t,n){try{sf(-1);const r=arguments.length;return r===2?zn(t)&&!Nt(t)?pa(t)?qt(e,null,[t]):qt(e,t):qt(e,null,t):(r>3?n=Array.prototype.slice.call(arguments,2):r===3&&pa(n)&&(n=[n]),qt(e,t,n))}finally{sf(1)}}function oT(){return;function e(t,n,r){const o=t[r];if(Nt(o)&&o.includes(n)||zn(o)&&n in o||t.extends&&e(t.extends,n,r)||t.mixins&&t.mixins.some(i=>e(i,n,r)))return!0}}function iT(e,t,n,r){const o=n[r];if(o&&ww(o,e))return o;const i=t();return i.memo=e.slice(),i.cacheIndex=r,n[r]=i}function ww(e,t){const n=e.memo;if(n.length!=t.length)return!1;for(let r=0;r<n.length;r++)if(fo(n[r],t[r]))return!1;return pl>0&&Io&&Io.push(e),!0}var Ev,Cw,kw,Bo,os,uc,ga,dc,Tv,lf,au,lu,cf,po,uf,Sw,xv,Rv,cl,Mv,Lv,ul,_w,Dv,Ov,ip,Aw,dl,is,cu,ki,sp,Pv,Iw,Fv,df,Nv,fc,Ew,Tw,ff,hc,Bv,xw,Rw,Mw,Lw,Dw,Ow,Pw,xs,uu,Fw,Rs,zv,jn,ap,hf,dr,pf,jv,Vv,Uv,lp,Nw,Hv,cp,du,up,dp,Bw,fp,zw,jw,fl,$v,Vw,Uw,Hw,Gv,Wv,Kv,$w,hp,pp,Gw,qv,Yv,Xv,Ww,Kw,Hr,mf,mp,qw,Kt,va,Or,hl,fu,Io,pl,Zv,gf,qt,Yw,Xw,mo,mr,gp,hu,pc,pu,ml,vp,Qv,Zw,Qw,ke,Jv,Jw,eC,tC,nC,rC,sT,aT,lT,oC=Dr((()=>{r5(),Vg(),Ev=[],Cw={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"},kw={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=[],os=-1,uc=[],ga=null,dc=0,Tv=Promise.resolve(),lf=null,au=e=>e.id==null?e.flags&2?-1:1/0:e.id,cf=[],po=null,uf=null,Sw=e=>ho,xv=Symbol.for("v-scx"),Rv=()=>{{const e=ll(xv);return e}},cl=new WeakMap,Mv=Symbol("_vte"),Lv=e=>e.__isTeleport,ul=e=>e&&(e.disabled||e.disabled===""),_w=e=>e&&(e.defer||e.defer===""),Dv=e=>typeof SVGElement<"u"&&e instanceof SVGElement,Ov=e=>typeof MathMLElement=="function"&&e instanceof MathMLElement,ip=(e,t)=>{const n=e&&e.to;return Jn(n)?t?t(n):null:n},Aw={name:"Teleport",__isTeleport:!0,process(e,t,n,r,o,i,s,a,l,u){const{mc:d,pc:f,pbc:p,o:{insert:g,querySelector:m,createText:v,createComment:C}}=u,w=ul(t.props);let{dynamicChildren:S}=t;const k=(L,z,G)=>{L.shapeFlag&16&&d(L.children,z,G,o,i,s,a,l)},b=(L=t)=>{const z=ul(L.props),G=L.target=ip(L.props,m),U=cv(G,L,v,g);G&&(s!=="svg"&&Dv(G)?s="svg":s!=="mathml"&&Ov(G)&&(s="mathml"),o&&o.isCE&&(o.ce._teleportTargets||(o.ce._teleportTargets=new Set)).add(G),z||(k(L,G,U),ef(L,!1)))},T=L=>{const z=()=>{cl.get(L)===z&&(cl.delete(L),ul(L.props)&&(k(L,n,L.anchor),ef(L,!0)),b(L))};cl.set(L,z),Hr(z,i)};if(e==null){const L=t.el=v(""),z=t.anchor=v("");if(g(L,n,r),g(z,n,r),_w(t.props)||i&&i.pendingBranch){T(t);return}w&&(k(t,n,z),ef(t,!0)),b()}else{t.el=e.el;const L=t.anchor=e.anchor,z=cl.get(e);if(z){z.flags|=8,cl.delete(e),T(t);return}t.targetStart=e.targetStart;const G=t.target=e.target,U=t.targetAnchor=e.targetAnchor,j=ul(e.props),Z=j?n:G,R=j?L:U;if(s==="svg"||Dv(G)?s="svg":(s==="mathml"||Ov(G))&&(s="mathml"),S?(p(e.dynamicChildren,S,Z,o,i,s,a),Sv(e,t,!0)):l||f(e,t,Z,R,o,i,s,a,!1),w)j?t.props&&e.props&&t.props.to!==e.props.to&&(t.props.to=e.props.to):qh(t,n,L,u,1);else if((t.props&&t.props.to)!==(e.props&&e.props.to)){const K=t.target=ip(t.props,m);K&&qh(t,K,null,u,0)}else j&&qh(t,G,U,u,1);ef(t,w)}},remove(e,t,n,{um:r,o:{remove:o}},i){const{shapeFlag:s,children:a,anchor:l,targetStart:u,targetAnchor:d,target:f,props:p}=e;let g=i||!ul(p);const m=cl.get(e);if(m&&(m.flags|=8,cl.delete(e),g=!1),f&&(o(u),o(d)),i&&o(l),s&16)for(let v=0;v<a.length;v++){const C=a[v];r(C,t,n,g,!!C.dynamicChildren)}},move:qh,hydrate:p5},dl=Aw,is=Symbol("_leaveCb"),cu=Symbol("_enterCb"),ki=[Function,Array],sp={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},Pv=e=>{const t=e.subTree;return t.component?Pv(t.component):t},Iw={name:"BaseTransition",props:sp,setup(e,{slots:t}){const n=mr(),r=uv();return()=>{const o=t.default&&Yh(t.default(),!0);if(!o||!o.length)return;const i=D1(o),s=gn(e),{mode:a}=s;if(r.isLeaving)return dv(i);const l=P1(i);if(!l)return dv(i);let u=ru(l,s,r,n,f=>u=f);l.type!==Or&&ha(l,u);let d=n.subTree&&P1(n.subTree);if(d&&d.type!==Or&&!ns(d,l)&&Pv(n).type!==Or){let f=ru(d,s,r,n);if(ha(d,f),a==="out-in"&&l.type!==Or)return r.isLeaving=!0,f.afterLeave=()=>{r.isLeaving=!1,n.job.flags&8||n.update(),delete f.afterLeave,d=void 0},dv(i);a==="in-out"&&l.type!==Or?f.delayLeave=(p,g,m)=>{const v=O1(r,d);v[String(d.key)]=d,p[is]=()=>{g(),p[is]=void 0,delete u.delayedLeave,d=void 0},u.delayedLeave=()=>{m(),delete u.delayedLeave,d=void 0}}:d=void 0}else d&&(d=void 0);return i}}},Fv=Iw,df=new WeakMap,Nv=!1,fc=()=>{Nv||(console.error("Hydration completed but contains mismatches."),Nv=!0)},Ew=e=>e.namespaceURI.includes("svg")&&e.tagName!=="foreignObject",Tw=e=>e.namespaceURI.includes("MathML"),ff=e=>{if(e.nodeType===1){if(Ew(e))return"svg";if(Tw(e))return"mathml"}},hc=e=>e.nodeType===8,Bv="data-allow-mismatch",xw={0:"text",1:"children",2:"class",3:"style",4:"attribute"},Rw=Vd().requestIdleCallback||(e=>setTimeout(e,1)),Mw=Vd().cancelIdleCallback||(e=>clearTimeout(e)),Lw=(e=1e4)=>t=>{const n=Rw(t,{timeout:e});return()=>Mw(n)},Dw=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(y5(o))return t(),r.disconnect(),!1;r.observe(o)}}),()=>r.disconnect()},Ow=e=>t=>{if(e){const n=matchMedia(e);if(n.matches)t();else return n.addEventListener("change",t,{once:!0}),()=>n.removeEventListener("change",t)}},Pw=(e=[])=>(t,n)=>{Jn(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},xs=e=>!!e.type.__asyncLoader,uu=e=>e.type.__isKeepAlive,Fw={name:"KeepAlive",__isKeepAlive:!0,props:{include:[String,RegExp,Array],exclude:[String,RegExp,Array],max:[String,Number]},setup(e,{slots:t}){const n=mr(),r=n.ctx;if(!r.renderer)return()=>{const S=t.default&&t.default();return S&&S.length===1?S[0]:S};const o=new Map,i=new Set;let s=null;const a=n.suspense,{renderer:{p:l,m:u,um:d,o:{createElement:f}}}=r,p=f("div");r.activate=(S,k,b,T,L)=>{const z=S.component;u(S,k,b,0,a),l(z.vnode,S,k,b,z,a,T,S.slotScopeIds,L),Hr(()=>{z.isDeactivated=!1,z.a&&ic(z.a);const G=S.props&&S.props.onVnodeMounted;G&&ci(G,z.parent,S)},a)},r.deactivate=S=>{const k=S.component;op(k.m),op(k.a),u(S,p,null,1,a),Hr(()=>{k.da&&ic(k.da);const b=S.props&&S.props.onVnodeUnmounted;b&&ci(b,k.parent,S),k.isDeactivated=!0},a)};function g(S){mv(S),d(S,n,a,!0)}function m(S){o.forEach((k,b)=>{const T=Iv(xs(k)?k.type.__asyncResolved||{}:k.type);T&&!S(T)&&v(b)})}function v(S){const k=o.get(S);k&&(!s||!ns(k,s))?g(k):s&&mv(s),o.delete(S),i.delete(S)}Bt(()=>[e.include,e.exclude],([S,k])=>{S&&m(b=>tf(S,b)),k&&m(b=>!tf(k,b))},{flush:"post",deep:!0});let C=null;const w=()=>{C!=null&&(mf(n.subTree.type)?Hr(()=>{o.set(C,Qh(n.subTree))},n.subTree.suspense):o.set(C,Qh(n.subTree)))};return jn(w),hf(w),dr(()=>{o.forEach(S=>{const{subTree:k,suspense:b}=n,T=Qh(k);if(S.type===T.type&&S.key===T.key){mv(T);const L=T.component.da;L&&Hr(L,b);return}g(S)})}),()=>{if(C=null,!t.default)return s=null;const S=t.default(),k=S[0];if(S.length>1)return s=null,S;if(!pa(k)||!(k.shapeFlag&4)&&!(k.shapeFlag&128))return s=null,k;let b=Qh(k);if(b.type===Or)return s=null,b;const T=b.type,L=Iv(xs(b)?b.type.__asyncResolved||{}:T),{include:z,exclude:G,max:U}=e;if(z&&(!L||!tf(z,L))||G&&L&&tf(G,L))return b.shapeFlag&=-257,s=b,k;const j=b.key==null?T:b.key,Z=o.get(j);return b.el&&(b=Es(b),k.shapeFlag&128&&(k.ssContent=b)),C=j,Z?(b.el=Z.el,b.component=Z.component,b.transition&&ha(b,b.transition),b.shapeFlag|=512,i.delete(j),i.add(j)):(i.add(j),U&&i.size>parseInt(U,10)&&v(i.values().next().value)),b.shapeFlag|=256,s=b,mf(k.type)?k:b}}},Rs=e=>(t,n=mo)=>{(!ml||e==="sp")&&Jh(e,(...r)=>t(...r),n)},zv=Rs("bm"),jn=Rs("m"),ap=Rs("bu"),hf=Rs("u"),dr=Rs("bum"),pf=Rs("um"),jv=Rs("sp"),Vv=Rs("rtg"),Uv=Rs("rtc"),lp="components",Nw="directives",Hv=Symbol.for("v-ndc"),cp=e=>e?gw(e)?af(e):cp(e.parent):null,du=Kn(Object.create(null),{$:e=>e,$el:e=>e.vnode.el,$data:e=>e.data,$props:e=>e.props,$attrs:e=>e.attrs,$slots:e=>e.slots,$refs:e=>e.refs,$parent:e=>cp(e.parent),$root:e=>cp(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>bv(e),$forceUpdate:e=>e.f||(e.f=()=>{lv(e.update)}),$nextTick:e=>e.n||(e.n=kt.bind(e.proxy)),$watch:e=>h5.bind(e)}),up=(e,t)=>e!==Ln&&!e.__isScriptSetup&&$n(e,t),dp={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(up(r,t))return s[t]=1,r[t];if(o!==Ln&&$n(o,t))return s[t]=2,o[t];if($n(i,t))return s[t]=3,i[t];if(n!==Ln&&$n(n,t))return s[t]=4,n[t];fp&&(s[t]=0)}}const u=du[t];let d,f;if(u)return t==="$attrs"&&Fo(e.attrs,"get",""),u(e);if((d=a.__cssModules)&&(d=d[t]))return d;if(n!==Ln&&$n(n,t))return s[t]=4,n[t];if(f=l.config.globalProperties,$n(f,t))return f[t]},set({_:e},t,n){const{data:r,setupState:o,ctx:i}=e;return up(o,t)?(o[t]=n,!0):r!==Ln&&$n(r,t)?(r[t]=n,!0):$n(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!==Ln&&a[0]!=="$"&&$n(e,a)||up(t,a)||$n(i,a)||$n(r,a)||$n(du,a)||$n(o.config.globalProperties,a)||(l=s.__cssModules)&&l[a])},defineProperty(e,t,n){return n.get!=null?e._.accessCache[t]=0:$n(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}},Bw=Kn({},dp,{get(e,t){if(t!==Symbol.unscopables)return dp.get(e,t,e)},has(e,t){return t[0]!=="_"&&!j2(t)}}),fp=!0,zw={data:q1,props:Y1,emits:Y1,methods:rf,computed:rf,beforeCreate:Yo,created:Yo,beforeMount:Yo,mounted:Yo,beforeUpdate:Yo,updated:Yo,beforeDestroy:Yo,beforeUnmount:Yo,destroyed:Yo,unmounted:Yo,activated:Yo,deactivated:Yo,errorCaptured:Yo,serverPrefetch:Yo,components:rf,directives:rf,watch:B5,provide:q1,inject:N5},jw=0,fl=null,$v=(e,t)=>t==="modelValue"||t==="model-value"?e.modelModifiers:e[`${t}Modifiers`]||e[`${jr(t)}Modifiers`]||e[`${qo(t)}Modifiers`],Vw=new WeakMap,Uw=e=>{let t;for(const n in e)(n==="class"||n==="style"||Yc(n))&&((t||(t={}))[n]=e[n]);return t},Hw=(e,t)=>{const n={};for(const r in e)(!Pd(r)||!(r.slice(9)in t))&&(n[r]=e[r]);return n},Gv={},Wv=()=>Object.create(Gv),Kv=e=>Object.getPrototypeOf(e)===Gv,$w=new WeakMap,hp=e=>e==="_"||e==="_ctx"||e==="$stable",pp=e=>Nt(e)?e.map(li):[li(e)],Gw=(e,t,n)=>{if(t._n)return t;const r=ho((...o)=>pp(t(...o)),n);return r._c=!1,r},qv=(e,t,n)=>{const r=e._ctx;for(const o in e){if(hp(o))continue;const i=e[o];if(Yt(i))t[o]=Gw(o,i,r);else if(i!=null){const s=pp(i);t[o]=()=>s}}},Yv=(e,t)=>{const n=pp(t);e.slots.default=()=>n},Xv=(e,t,n)=>{for(const r in t)(n||!hp(r))&&(e[r]=t[r])},Ww=(e,t,n)=>{const r=e.slots=Wv();if(e.vnode.shapeFlag&32){const o=t._;o?(Xv(r,t,n),n&&Ng(r,"_",o,!0)):qv(t,r)}else t&&Yv(e,t)},Kw=(e,t,n)=>{const{vnode:r,slots:o}=e;let i=!0,s=Ln;if(r.shapeFlag&32){const a=t._;a?n&&a===1?i=!1:Xv(o,t,n):(i=!t.$stable,qv(t,o)),s=t}else t&&(Yv(e,t),s={default:1});if(i)for(const a in o)!hp(a)&&s[a]==null&&delete o[a]},Hr=dw,mf=e=>e.__isSuspense,mp=0,qw={name:"Suspense",__isSuspense:!0,process(e,t,n,r,o,i,s,a,l,u){if(e==null)K5(t,n,r,o,i,s,a,l,u);else{if(i&&i.deps>0&&!e.suspense.isInFallback){t.suspense=e.suspense,t.suspense.vnode=t,t.el=e.el;return}q5(e,t,n,r,o,s,a,l,u)}},hydrate:Y5,normalize:X5},Kt=Symbol.for("v-fgt"),va=Symbol.for("v-txt"),Or=Symbol.for("v-cmt"),hl=Symbol.for("v-stc"),fu=[],Io=null,pl=1,Zv=({key:e})=>e??null,gf=({ref:e,ref_key:t,ref_for:n})=>(typeof e=="number"&&(e=""+e),e!=null?Jn(e)||ur(e)||Yt(e)?{i:po,r:e,k:t,f:!!n}:e:null),qt=J5,Yw=X1(),Xw=0,mo=null,mr=()=>mo||po;{const e=Vd(),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)}};gp=t("__VUE_INSTANCE_SETTERS__",n=>mo=n),hu=t("__VUE_SSR_SETTERS__",n=>ml=n)}pc=e=>{const t=mo;return gp(e),e.scope.on(),()=>{e.scope.off(),gp(t)}},pu=()=>{mo&&mo.scope.off(),gp(null)},ml=!1,Zw=()=>!vp,Qw={get(e,t){return Fo(e,"get",""),e[t]}},ke=(e,t)=>e5(e,t,ml),Jv="3.5.32",Jw=Ci,eC=kw,tC=lu,nC=T1,rC={createComponentInstance:mw,setupComponent:vw,renderComponentRoot:np,setCurrentRenderingInstance:Qd,isVNode:pa,normalizeVNode:li,getComponentPublicInstance:af,ensureValidVNode:yv,pushWarningContext:o5,popWarningContext:i5},sT=null,aT=null,lT=null}));function iC(e){const t={};for(const R in e)R in ay||(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:u=s,appearToClass:d=a,leaveFromClass:f=`${n}-leave-from`,leaveActiveClass:p=`${n}-leave-active`,leaveToClass:g=`${n}-leave-to`}=e,m=cT(o),v=m&&m[0],C=m&&m[1],{onBeforeEnter:w,onEnter:S,onEnterCancelled:k,onLeave:b,onLeaveCancelled:T,onBeforeAppear:L=w,onAppear:z=S,onAppearCancelled:G=k}=t,U=(R,K,x,W)=>{R._enterCancelled=W,gl(R,K?d:a),gl(R,K?u:s),x&&x()},j=(R,K)=>{R._isLeaving=!1,gl(R,f),gl(R,g),gl(R,p),K&&K()},Z=R=>(K,x)=>{const W=R?z:S,$=()=>U(K,R,x);vl(W,[K,$]),sC(()=>{gl(K,R?l:i),Ms(K,R?d:a),cy(W)||aC(K,r,v,$)})};return Kn(t,{onBeforeEnter(R){vl(w,[R]),Ms(R,i),Ms(R,s)},onBeforeAppear(R){vl(L,[R]),Ms(R,l),Ms(R,u)},onEnter:Z(!1),onAppear:Z(!0),onLeave(R,K){R._isLeaving=!0;const x=()=>j(R,K);Ms(R,f),R._enterCancelled?(Ms(R,p),ty(R)):(ty(R),Ms(R,p)),sC(()=>{R._isLeaving&&(gl(R,f),Ms(R,g),cy(b)||aC(R,r,C,x))}),vl(b,[R,x])},onEnterCancelled(R){U(R,!1,void 0,!0),vl(k,[R])},onAppearCancelled(R){U(R,!0,void 0,!0),vl(G,[R])},onLeaveCancelled(R){j(R),vl(T,[R])}})}function cT(e){if(e==null)return null;if(zn(e))return[ey(e.enter),ey(e.leave)];{const t=ey(e);return[t,t]}}function ey(e){return jd(e)}function Ms(e,t){t.split(/\s+/).forEach(n=>n&&e.classList.add(n)),(e[mc]||(e[mc]=new Set)).add(t)}function gl(e,t){t.split(/\s+/).forEach(r=>r&&e.classList.remove(r));const n=e[mc];n&&(n.delete(t),n.size||(e[mc]=void 0))}function sC(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}function aC(e,t,n,r){const o=e._endId=++xC,i=()=>{o===e._endId&&r()};if(n!=null)return setTimeout(i,n);const{type:s,timeout:a,propCount:l}=lC(e,t);if(!s)return r();const u=s+"end";let d=0;const f=()=>{e.removeEventListener(u,p),i()},p=g=>{g.target===e&&++d>=l&&f()};setTimeout(()=>{d<l&&f()},a+1),e.addEventListener(u,p)}function lC(e,t){const n=window.getComputedStyle(e),r=m=>(n[m]||"").split(", "),o=r(`${ba}Delay`),i=r(`${ba}Duration`),s=cC(o,i),a=r(`${gu}Delay`),l=r(`${gu}Duration`),u=cC(a,l);let d=null,f=0,p=0;t===ba?s>0&&(d=ba,f=s,p=i.length):t===gu?u>0&&(d=gu,f=u,p=l.length):(f=Math.max(s,u),d=f>0?s>u?ba:gu:null,p=d?d===ba?i.length:l.length:0);const g=d===ba&&/\b(?:transform|all)(?:,|$)/.test(r(`${ba}Property`).toString());return{type:d,timeout:f,propCount:p,hasTransform:g}}function cC(e,t){for(;e.length<t.length;)e=e.concat(e);return Math.max(...t.map((n,r)=>uC(n)+uC(e[r])))}function uC(e){return e==="auto"?0:Number(e.slice(0,-1).replace(",","."))*1e3}function ty(e){return(e?e.ownerDocument:document).body.offsetHeight}function uT(e,t,n){const r=e[mc];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[uy]=!t}function dT(){dy.getSSRProps=({value:e})=>{if(!e)return{style:{display:"none"}}}}function fT(e){const t=mr();if(!t)return;const n=t.ut=(o=e(t.proxy))=>{Array.from(document.querySelectorAll(`[data-v-owner="${t.uid}"]`)).forEach(i=>yp(i,o))},r=()=>{const o=e(t.proxy);t.ce?yp(t.ce,o):ny(t.subTree,o),n(o)};ap(()=>{Zd(r)}),jn(()=>{Bt(r,Ci,{flush:"post"});const o=new MutationObserver(r);o.observe(t.subTree.el.parentNode,{childList:!0}),pf(()=>o.disconnect())})}function ny(e,t){if(e.shapeFlag&128){const n=e.suspense;e=n.activeBranch,n.pendingBranch&&!n.isHydrating&&n.effects.push(()=>{ny(n.activeBranch,t)})}for(;e.component;)e=e.component.subTree;if(e.shapeFlag&1&&e.el)yp(e.el,t);else if(e.type===Kt)e.children.forEach(n=>ny(n,t));else if(e.type===hl){let{el:n,anchor:r}=e;for(;n&&(yp(n,t),n!==r);)n=n.nextSibling}}function yp(e,t){if(e.nodeType===1){const n=e.style;let r="";for(const o in t){const i=jE(t[o]);n.setProperty(`--${o}`,i),r+=`--${o}: ${i};`}n[fy]=r}}function hT(e,t,n){const r=e.style,o=Jn(n);let i=!1;if(n&&!o){if(t)if(Jn(t))for(const s of t.split(";")){const a=s.slice(0,s.indexOf(":")).trim();n[a]==null&&bp(r,a,"")}else for(const s in t)n[s]==null&&bp(r,s,"");for(const s in n)s==="display"&&(i=!0),bp(r,s,n[s])}else if(o){if(t!==n){const s=r[fy];s&&(n+=";"+s),r.cssText=n,i=RC.test(n)}}else t&&e.removeAttribute("style");yf in e&&(e[yf]=i?r.display:"",e[uy]&&(r.display="none"))}function bp(e,t,n){if(Nt(n))n.forEach(r=>bp(e,t,r));else if(n==null&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const r=pT(e,t);hy.test(n)?e.setProperty(qo(r),n.replace(hy,""),"important"):e[r]=n}}function pT(e,t){const n=Sp[t];if(n)return n;let r=jr(t);if(r!=="filter"&&r in e)return Sp[t]=r;r=Xc(r);for(let o=0;o<py.length;o++){const i=py[o]+r;if(i in e)return Sp[t]=i}return t}function dC(e,t,n,r,o,i=$2(t)){r&&t.startsWith("xlink:")?n==null?e.removeAttributeNS(my,t.slice(6,t.length)):e.setAttributeNS(my,t,n):n==null||i&&!D2(n)?e.removeAttribute(t):e.setAttribute(t,i?"":si(n)?String(n):n)}function fC(e,t,n,r,o){if(t==="innerHTML"||t==="textContent"){n!=null&&(e[t]=t==="innerHTML"?oy(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=D2(n):n==null&&a==="string"?(n="",s=!0):a==="number"&&(n=0,s=!0)}try{e[t]=n}catch{}s&&e.removeAttribute(o||t)}function ya(e,t,n,r){e.addEventListener(t,n,r)}function mT(e,t,n,r){e.removeEventListener(t,n,r)}function gT(e,t,n,r,o=null){const i=e[gy]||(e[gy]={}),s=i[t];if(r&&s)s.value=r;else{const[a,l]=vT(t);r?ya(e,a,i[t]=yT(r,o),l):s&&(mT(e,a,s,l),i[t]=void 0)}}function vT(e){let t;if(vy.test(e)){t={};let n;for(;n=e.match(vy);)e=e.slice(0,e.length-n[0].length),t[n[0].toLowerCase()]=!0}return[e[2]===":"?e.slice(3):qo(e.slice(2)),t]}function yT(e,t){const n=r=>{if(!r._vts)r._vts=Date.now();else if(r._vts<=n.attached)return;Vi(bT(r,n.value),t,5,[r])};return n.value=e,n.attached=LC(),n}function bT(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 wT(e,t,n,r){if(r)return!!(t==="innerHTML"||t==="textContent"||t in e&&yy(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 yy(t)&&Jn(n)?!1:t in e}function CT(e,t){const n=e._def.props;if(!n)return!1;const r=jr(t);return Array.isArray(n)?n.some(o=>jr(o)===r):Object.keys(n).some(o=>jr(o)===r)}function hC(e,t,n){let r=lc(e,t);Fd(r)&&(r=Kn({},r,t));class o extends Cy{constructor(s){super(r,s,n)}}return o.def=r,o}function pC(e){const t=mr(),n=t&&t.ce;return n||null}function kT(){const e=pC();return e&&e.shadowRoot}function ST(e="$style"){{const t=mr();if(!t)return Ln;const n=t.type.__cssModules;if(!n)return Ln;const r=n[e];return r||Ln}}function _T(e){const t=e.el;t[bf]&&t[bf](),t[_y]&&t[_y]()}function AT(e){Sy.set(e,mC(e.el))}function IT(e){const t=ky.get(e),n=Sy.get(e),r=t.left-n.left,o=t.top-n.top;if(r||o){const i=e.el,s=i.style,a=i.getBoundingClientRect();let l=1,u=1;return i.offsetWidth&&(l=a.width/i.offsetWidth),i.offsetHeight&&(u=a.height/i.offsetHeight),(!Number.isFinite(l)||l===0)&&(l=1),(!Number.isFinite(u)||u===0)&&(u=1),Math.abs(l-1)<.01&&(l=1),Math.abs(u-1)<.01&&(u=1),s.transform=s.webkitTransform=`translate(${r/l}px,${o/u}px)`,s.transitionDuration="0s",e}}function mC(e){const t=e.getBoundingClientRect();return{left:t.left,top:t.top}}function ET(e,t,n){const r=e.cloneNode(),o=e[mc];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}=lC(r);return i.removeChild(r),s}function TT(e){e.target.composing=!0}function gC(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}function vC(e,t,n){return t&&(e=e.trim()),n&&(e=zd(e)),e}function yC(e,{value:t,oldValue:n},r){e._modelValue=t;let o;if(Nt(t))o=Oh(t,r.props.value)>-1;else if(il(t))o=t.has(r.props.value);else{if(t===n)return;o=ia(t,wC(e,!0))}e.checked!==o&&(e.checked=o)}function bC(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=mu(s);if(n)if(r){const l=typeof a;l==="string"||l==="number"?s.selected=t.some(u=>String(u)===String(a)):s.selected=Oh(t,a)>-1}else s.selected=t.has(a);else if(ia(mu(s),t)){e.selectedIndex!==o&&(e.selectedIndex=o);return}}!n&&e.selectedIndex!==-1&&(e.selectedIndex=-1)}}function mu(e){return"_value"in e?e._value:e.value}function wC(e,t){const n=t?"_trueValue":"_falseValue";return n in e?e[n]:t}function CC(e,t){switch(e){case"SELECT":return Ay;case"TEXTAREA":return Ui;default:switch(t){case"checkbox":return Ap;case"radio":return Ip;default:return Ui}}}function wp(e,t,n,r,o){const i=CC(e.tagName,n.props&&n.props.type)[o];i&&i(e,t,n,r)}function xT(){Ui.getSSRProps=({value:e})=>({value:e}),Ip.getSSRProps=({value:e},t)=>{if(t.props&&ia(t.props.value,e))return{checked:!0}},Ap.getSSRProps=({value:e},t)=>{if(Nt(e)){if(t.props&&Oh(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}},Iy.getSSRProps=(e,t)=>{if(typeof t.type!="string")return;const n=CC(t.type.toUpperCase(),t.props&&t.props.type);if(n.getSSRProps)return n.getSSRProps(e,t)}}function kC(){return wf||(wf=rw(Ey))}function SC(){return wf=Ty?wf:ow(Ey),Ty=!0,wf}function _C(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function AC(e){return Jn(e)?document.querySelector(e):e}var Cp,ry,oy,IC,EC,Ls,iy,sy,ba,gu,mc,ay,ly,TC,kp,vl,cy,xC,yf,uy,dy,fy,RC,hy,py,Sp,my,gy,vy,_p,MC,LC,yy,by,wy,DC,OC,Cy,ky,Sy,bf,_y,PC,FC,wa,Si,Ui,Ap,Ip,Ay,Iy,NC,BC,Qt,zC,ui,Ey,wf,Ty,xy,jC,gc,Ry,My,VC,RT=Dr((()=>{if(oC(),oC(),Vg(),Cp=void 0,ry=typeof window<"u"&&window.trustedTypes,ry)try{Cp=ry.createPolicy("vue",{createHTML:e=>e})}catch{}oy=Cp?e=>Cp.createHTML(e):e=>e,IC="http://www.w3.org/2000/svg",EC="http://www.w3.org/1998/Math/MathML",Ls=typeof document<"u"?document:null,iy=Ls&&Ls.createElement("template"),sy={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"?Ls.createElementNS(IC,e):t==="mathml"?Ls.createElementNS(EC,e):n?Ls.createElement(e,{is:n}):Ls.createElement(e);return e==="select"&&r&&r.multiple!=null&&o.setAttribute("multiple",r.multiple),o},createText:e=>Ls.createTextNode(e),createComment:e=>Ls.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>Ls.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{iy.innerHTML=oy(r==="svg"?`<svg>${e}</svg>`:r==="mathml"?`<math>${e}</math>`:e);const a=iy.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]}},ba="transition",gu="animation",mc=Symbol("_vtc"),ay={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},ly=Kn({},sp,ay),TC=e=>(e.displayName="Transition",e.props=ly,e),kp=TC((e,{slots:t})=>Ur(Fv,iC(e),t)),vl=(e,t=[])=>{Nt(e)?e.forEach(n=>n(...t)):e&&e(...t)},cy=e=>e?Nt(e)?e.some(t=>t.length>1):e.length>1:!1,xC=0,yf=Symbol("_vod"),uy=Symbol("_vsh"),dy={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)}},fy=Symbol(""),RC=/(?:^|;)\s*display\s*:/,hy=/\s*!important$/,py=["Webkit","Moz","ms"],Sp={},my="http://www.w3.org/1999/xlink",gy=Symbol("_vei"),vy=/(?:Once|Passive|Capture)$/,_p=0,MC=Promise.resolve(),LC=()=>_p||(MC.then(()=>_p=0),_p=Date.now()),yy=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,by=(e,t,n,r,o,i)=>{const s=o==="svg";t==="class"?uT(e,r,s):t==="style"?hT(e,n,r):Yc(t)?Pd(t)||gT(e,t,n,r,i):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):wT(e,t,r,s))?(fC(e,t,r),!e.tagName.includes("-")&&(t==="value"||t==="checked"||t==="selected")&&dC(e,t,r,s,i,t!=="value")):e._isVueCE&&(CT(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!Jn(r)))?fC(e,jr(t),r,i,t):(t==="true-value"?e._trueValue=r:t==="false-value"&&(e._falseValue=r),dC(e,t,r,s))},wy={},DC=((e,t)=>hC(e,t,Ry)),OC=typeof HTMLElement<"u"?HTMLElement:class{},Cy=class gE extends OC{constructor(t,n={},r=gc){super(),this._def=t,this._props=n,this._createApp=r,this._isVueCE=!0,this._instance=null,this._app=null,this._nonce=this._def.nonce,this._connected=!1,this._resolved=!1,this._patching=!1,this._dirty=!1,this._numberProps=null,this._styleChildren=new WeakSet,this._styleAnchors=new WeakMap,this._ob=null,this.shadowRoot&&r!==gc?this._root=this.shadowRoot:t.shadowRoot!==!1?(this.attachShadow(Kn({},t.shadowRootOptions,{mode:"open"})),this._root=this.shadowRoot):this._root=this}connectedCallback(){if(!this.isConnected)return;!this.shadowRoot&&!this._resolved&&this._parseSlots(),this._connected=!0;let t=this;for(;t=t&&(t.assignedSlot||t.parentNode||t.host);)if(t instanceof gE){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 u=i[l];(u===Number||u&&u.type===Number)&&(l in this._props&&(this._props[l]=jd(this._props[l])),(a||(a=Object.create(null)))[jr(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)$n(this,r)||Object.defineProperty(this,r,{get:()=>Je(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(jr))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):wy;const o=jr(t);n&&this._numberProps&&this._numberProps[o]&&(r=jd(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===wy?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(qo(t),""):typeof n=="string"||typeof n=="number"?this.setAttribute(qo(t),n+""):n||this.removeAttribute(qo(t)),i&&i.observe(this,{attributes:!0})}}_update(){const t=this._createVNode();this._app&&(t.appContext=this._app._context),xy(t,this._root)}_createVNode(){const t={};this.shadowRoot||(t.onVnodeMounted=t.onVnodeUpdated=this._renderSlots.bind(this));const n=qt(this._def,Kn(t,this._props));return this._instance||(n.ce=r=>{this._instance=r,r.ce=this,r.isCE=!0;const o=(i,s)=>{this.dispatchEvent(new CustomEvent(i,Fd(s[0])?Kn({detail:s},s[0]):{detail:s}))};r.emit=(i,...s)=>{o(i,s),qo(i)!==i&&o(qo(i),s)},this._setParent()}),n}_applyStyles(t,n,r){if(!t)return;if(n){if(n===this._def||this._styleChildren.has(n))return;this._styleChildren.add(n)}const o=this._nonce,i=this.shadowRoot,s=r?this._getStyleAnchor(r)||this._getStyleAnchor(this._def):this._getRootStyleInsertionAnchor(i);let a=null;for(let l=t.length-1;l>=0;l--){const u=document.createElement("style");o&&u.setAttribute("nonce",o),u.textContent=t[l],i.insertBefore(u,a||s),a=u,l===0&&(r||this._styleAnchors.set(this._def,u),n&&this._styleAnchors.set(n,u))}}_getStyleAnchor(t){if(!t)return null;const n=this._styleAnchors.get(t);return n&&n.parentNode===this.shadowRoot?n:(n&&this._styleAnchors.delete(t),null)}_getRootStyleInsertionAnchor(t){for(let n=0;n<t.childNodes.length;n++){const r=t.childNodes[n];if(!(r instanceof HTMLStyleElement))return r}return null}_parseSlots(){const t=this._slots={};let n;for(;n=this.firstChild;){const r=n.nodeType===1&&n.getAttribute("slot")||"default";(t[r]||(t[r]=[])).push(n),this.removeChild(n)}}_renderSlots(){const t=this._getSlots(),n=this._instance.type.__scopeId;for(let r=0;r<t.length;r++){const o=t[r],i=o.getAttribute("name")||"default",s=this._slots[i],a=o.parentNode;if(s)for(const l of s){if(n&&l.nodeType===1){const u=n+"-s",d=document.createTreeWalker(l,1);l.setAttribute(u,"");let f;for(;f=d.nextNode();)f.setAttribute(u,"")}a.insertBefore(l,o)}else for(;o.firstChild;)a.insertBefore(o.firstChild,o);a.removeChild(o)}}_getSlots(){const t=[this];this._teleportTargets&&t.push(...this._teleportTargets);const n=new Set;for(const r of t){const o=r.querySelectorAll("slot");for(let i=0;i<o.length;i++)n.add(o[i])}return Array.from(n)}_injectChildStyle(t,n){this._applyStyles(t.styles,t,n)}_beginPatch(){this._patching=!0,this._dirty=!1}_endPatch(){this._patching=!1,this._dirty&&this._instance&&this._update()}_hasShadowRoot(){return this._def.shadowRoot!==!1}_removeChildStyle(t){}},ky=new WeakMap,Sy=new WeakMap,bf=Symbol("_moveCb"),_y=Symbol("_enterCb"),PC=e=>(delete e.props.mode,e),FC=PC({name:"TransitionGroup",props:Kn({},ly,{tag:String,moveClass:String}),setup(e,{slots:t}){const n=mr(),r=uv();let o,i;return hf(()=>{if(!o.length)return;const s=e.moveClass||`${e.name||"v"}-move`;if(!ET(o[0].el,n.vnode.el,s)){o=[];return}o.forEach(_T),o.forEach(AT);const a=o.filter(IT);ty(n.vnode.el),a.forEach(l=>{const u=l.el,d=u.style;Ms(u,s),d.transform=d.webkitTransform=d.transitionDuration="";const f=u[bf]=p=>{p&&p.target!==u||(!p||p.propertyName.endsWith("transform"))&&(u.removeEventListener("transitionend",f),u[bf]=null,gl(u,s))};u.addEventListener("transitionend",f)}),o=[]}),()=>{const s=gn(e),a=iC(s);let l=s.tag||Kt;if(o=[],i)for(let u=0;u<i.length;u++){const d=i[u];d.el&&d.el instanceof Element&&(o.push(d),ha(d,ru(d,a,r,n)),ky.set(d,mC(d.el)))}i=t.default?Yh(t.default()):[];for(let u=0;u<i.length;u++){const d=i[u];d.key!=null&&ha(d,ru(d,a,r,n))}return qt(l,null,i)}}}),wa=e=>{const t=e.props["onUpdate:modelValue"]||!1;return Nt(t)?n=>ic(t,n):t},Si=Symbol("_assign"),Ui={created(e,{modifiers:{lazy:t,trim:n,number:r}},o){e[Si]=wa(o);const i=r||o.props&&o.props.type==="number";ya(e,t?"change":"input",s=>{s.target.composing||e[Si](vC(e.value,n,i))}),(n||i)&&ya(e,"change",()=>{e.value=vC(e.value,n,i)}),t||(ya(e,"compositionstart",TT),ya(e,"compositionend",gC),ya(e,"change",gC))},mounted(e,{value:t}){e.value=t??""},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:r,trim:o,number:i}},s){if(e[Si]=wa(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 u=e.getRootNode();(u instanceof Document||u instanceof ShadowRoot)&&u.activeElement===e&&e.type!=="range"&&(r&&t===n||o&&e.value.trim()===l)||(e.value=l)}},Ap={deep:!0,created(e,t,n){e[Si]=wa(n),ya(e,"change",()=>{const r=e._modelValue,o=mu(e),i=e.checked,s=e[Si];if(Nt(r)){const a=Oh(r,o),l=a!==-1;if(i&&!l)s(r.concat(o));else if(!i&&l){const u=[...r];u.splice(a,1),s(u)}}else if(il(r)){const a=new Set(r);i?a.add(o):a.delete(o),s(a)}else s(wC(e,i))})},mounted:yC,beforeUpdate(e,t,n){e[Si]=wa(n),yC(e,t,n)}},Ip={created(e,{value:t},n){e.checked=ia(t,n.props.value),e[Si]=wa(n),ya(e,"change",()=>{e[Si](mu(e))})},beforeUpdate(e,{value:t,oldValue:n},r){e[Si]=wa(r),t!==n&&(e.checked=ia(t,r.props.value))}},Ay={deep:!0,created(e,{value:t,modifiers:{number:n}},r){const o=il(t);ya(e,"change",()=>{const i=Array.prototype.filter.call(e.options,s=>s.selected).map(s=>n?zd(mu(s)):mu(s));e[Si](e.multiple?o?new Set(i):i:i[0]),e._assigning=!0,kt(()=>{e._assigning=!1})}),e[Si]=wa(r)},mounted(e,{value:t}){bC(e,t)},beforeUpdate(e,t,n){e[Si]=wa(n)},updated(e,{value:t}){e._assigning||bC(e,t)}},Iy={created(e,t,n){wp(e,t,n,null,"created")},mounted(e,t,n){wp(e,t,n,null,"mounted")},beforeUpdate(e,t,n,r){wp(e,t,n,r,"beforeUpdate")},updated(e,t,n,r){wp(e,t,n,r,"updated")}},NC=["ctrl","shift","alt","meta"],BC={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)=>NC.some(n=>e[`${n}Key`]&&!t.includes(n))},Qt=(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=BC[t[s]];if(a&&a(o,t))return}return e(o,...i)}))},zC={esc:"escape",space:" ",up:"arrow-up",left:"arrow-left",right:"arrow-right",down:"arrow-down",delete:"backspace"},ui=(e,t)=>{const n=e._withKeys||(e._withKeys={}),r=t.join(".");return n[r]||(n[r]=(o=>{if(!("key"in o))return;const i=qo(o.key);if(t.some(s=>s===i||zC[s]===i))return e(o)}))},Ey=Kn({patchProp:by},sy),Ty=!1,xy=((...e)=>{kC().render(...e)}),jC=((...e)=>{SC().hydrate(...e)}),gc=((...e)=>{const t=kC().createApp(...e),{mount:n}=t;return t.mount=r=>{const o=AC(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,_C(o));return o instanceof Element&&(o.removeAttribute("v-cloak"),o.setAttribute("data-v-app","")),s},t}),Ry=((...e)=>{const t=SC().createApp(...e),{mount:n}=t;return t.mount=r=>{const o=AC(r);if(o)return n(o,!0,_C(o))},t}),My=!1,VC=()=>{My||(My=!0,xT(),dT())}})),MT=Dd({BaseTransition:()=>Fv,BaseTransitionPropsValidators:()=>sp,Comment:()=>Or,DeprecationTypes:()=>null,EffectScope:()=>Hh,ErrorCodes:()=>Cw,ErrorTypeStrings:()=>eC,Fragment:()=>Kt,KeepAlive:()=>Fw,ReactiveEffect:()=>Jc,Static:()=>hl,Suspense:()=>qw,Teleport:()=>dl,Text:()=>va,TrackOpTypes:()=>S1,Transition:()=>kp,TransitionGroup:()=>FC,TriggerOpTypes:()=>_1,VueElement:()=>Cy,assertNumber:()=>s5,callWithAsyncErrorHandling:()=>Vi,callWithErrorHandling:()=>nu,camelize:()=>jr,capitalize:()=>Xc,cloneVNode:()=>Es,compatUtils:()=>null,compile:()=>UC,computed:()=>ke,createApp:()=>gc,createBlock:()=>an,createCommentVNode:()=>ht,createElementBlock:()=>Le,createElementVNode:()=>$e,createHydrationRenderer:()=>ow,createPropsRestProxy:()=>D5,createRenderer:()=>rw,createSSRApp:()=>Ry,createSlots:()=>k5,createStaticVNode:()=>eT,createTextVNode:()=>rs,createVNode:()=>qt,customRef:()=>t1,defineAsyncComponent:()=>B1,defineComponent:()=>lc,defineCustomElement:()=>hC,defineEmits:()=>A5,defineExpose:()=>I5,defineModel:()=>x5,defineOptions:()=>E5,defineProps:()=>_5,defineSSRCustomElement:()=>DC,defineSlots:()=>T5,devtools:()=>tC,effect:()=>HE,effectScope:()=>Ug,getCurrentInstance:()=>mr,getCurrentScope:()=>Hg,getCurrentWatcher:()=>t5,getTransitionRawChildren:()=>Yh,guardReactiveProps:()=>pw,h:()=>Ur,handleError:()=>ac,hasInjectionContext:()=>R1,hydrate:()=>jC,hydrateOnIdle:()=>Lw,hydrateOnInteraction:()=>Pw,hydrateOnMediaQuery:()=>Ow,hydrateOnVisible:()=>Dw,initCustomFormatter:()=>oT,initDirectivesForSSR:()=>VC,inject:()=>ll,isMemoSame:()=>ww,isProxy:()=>Hd,isReactive:()=>Bi,isReadonly:()=>As,isRef:()=>ur,isRuntimeOnly:()=>Zw,isShallow:()=>ai,isVNode:()=>pa,markRaw:()=>io,mergeDefaults:()=>M5,mergeModels:()=>L5,mergeProps:()=>Ts,nextTick:()=>kt,nodeOps:()=>sy,normalizeClass:()=>Jt,normalizeProps:()=>Dg,normalizeStyle:()=>bn,onActivated:()=>hv,onBeforeMount:()=>zv,onBeforeUnmount:()=>dr,onBeforeUpdate:()=>ap,onDeactivated:()=>pv,onErrorCaptured:()=>j1,onMounted:()=>jn,onRenderTracked:()=>Uv,onRenderTriggered:()=>Vv,onScopeDispose:()=>G2,onServerPrefetch:()=>jv,onUnmounted:()=>pf,onUpdated:()=>hf,onWatcherCleanup:()=>o1,openBlock:()=>ge,patchProp:()=>by,popScopeId:()=>u5,provide:()=>x1,proxyRefs:()=>Xg,pushScopeId:()=>c5,queuePostFlushCb:()=>Zd,reactive:()=>oo,readonly:()=>Vh,ref:()=>te,registerRuntimeCompiler:()=>nT,render:()=>xy,renderList:()=>ar,renderSlot:()=>iu,resolveComponent:()=>C5,resolveDirective:()=>V1,resolveDynamicComponent:()=>gv,resolveFilter:()=>null,resolveTransitionHooks:()=>ru,setBlockTracking:()=>sf,setDevtoolsHook:()=>nC,setTransitionHooks:()=>ha,shallowReactive:()=>J2,shallowReadonly:()=>ZE,shallowRef:()=>Vr,ssrContextKey:()=>xv,ssrUtils:()=>rC,stop:()=>$E,toDisplayString:()=>zt,toHandlerKey:()=>Zc,toHandlers:()=>S5,toRaw:()=>gn,toRef:()=>Zg,toRefs:()=>n1,toValue:()=>JE,transformVNodeArgs:()=>Q5,triggerRef:()=>QE,unref:()=>Je,useAttrs:()=>$1,useCssModule:()=>ST,useCssVars:()=>fT,useHost:()=>pC,useId:()=>m5,useModel:()=>j5,useSSRContext:()=>Rv,useShadowRoot:()=>kT,useSlots:()=>H1,useTemplateRef:()=>g5,useTransitionState:()=>uv,vModelCheckbox:()=>Ap,vModelDynamic:()=>Iy,vModelRadio:()=>Ip,vModelSelect:()=>Ay,vModelText:()=>Ui,vShow:()=>dy,version:()=>Jv,warn:()=>Jw,watch:()=>Bt,watchEffect:()=>d5,watchPostEffect:()=>f5,watchSyncEffect:()=>M1,withAsyncContext:()=>O5,withCtx:()=>ho,withDefaults:()=>R5,withDirectives:()=>fa,withKeys:()=>ui,withMemo:()=>iT,withModifiers:()=>Qt,withScopeId:()=>Sw}),UC,Dt=Dr((()=>{RT(),UC=()=>{}})),LT=R2(((e,t)=>{(function(n){typeof e=="object"&&typeof t<"u"?t.exports=n():typeof define=="function"&&define.amd?define([],n):(typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:this).JSZip=n()})(function(){return(function n(r,o,i){function s(u,d){if(!o[u]){if(!r[u]){var f=typeof require=="function"&&require;if(!d&&f)return f(u,!0);if(a)return a(u,!0);var p=new Error("Cannot find module '"+u+"'");throw p.code="MODULE_NOT_FOUND",p}var g=o[u]={exports:{}};r[u][0].call(g.exports,function(m){var v=r[u][1][m];return s(v||m)},g,g.exports,n,r,o,i)}return o[u].exports}for(var a=typeof require=="function"&&require,l=0;l<i.length;l++)s(i[l]);return s})({1:[function(n,r,o){"use strict";var i=n("./utils"),s=n("./support"),a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";o.encode=function(l){for(var u,d,f,p,g,m,v,C=[],w=0,S=l.length,k=S,b=i.getTypeOf(l)!=="string";w<l.length;)k=S-w,f=b?(u=l[w++],d=w<S?l[w++]:0,w<S?l[w++]:0):(u=l.charCodeAt(w++),d=w<S?l.charCodeAt(w++):0,w<S?l.charCodeAt(w++):0),p=u>>2,g=(3&u)<<4|d>>4,m=1<k?(15&d)<<2|f>>6:64,v=2<k?63&f:64,C.push(a.charAt(p)+a.charAt(g)+a.charAt(m)+a.charAt(v));return C.join("")},o.decode=function(l){var u,d,f,p,g,m,v=0,C=0,w="data:";if(l.substr(0,w.length)===w)throw new Error("Invalid base64 input, it looks like a data url.");var S,k=3*(l=l.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(l.charAt(l.length-1)===a.charAt(64)&&k--,l.charAt(l.length-2)===a.charAt(64)&&k--,k%1!=0)throw new Error("Invalid base64 input, bad content length.");for(S=s.uint8array?new Uint8Array(0|k):new Array(0|k);v<l.length;)u=a.indexOf(l.charAt(v++))<<2|(p=a.indexOf(l.charAt(v++)))>>4,d=(15&p)<<4|(g=a.indexOf(l.charAt(v++)))>>2,f=(3&g)<<6|(m=a.indexOf(l.charAt(v++))),S[C++]=u,g!==64&&(S[C++]=d),m!==64&&(S[C++]=f);return S}},{"./support":30,"./utils":32}],2:[function(n,r,o){"use strict";var i=n("./external"),s=n("./stream/DataWorker"),a=n("./stream/Crc32Probe"),l=n("./stream/DataLengthProbe");function u(d,f,p,g,m){this.compressedSize=d,this.uncompressedSize=f,this.crc32=p,this.compression=g,this.compressedContent=m}u.prototype={getContentWorker:function(){var d=new s(i.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new l("data_length")),f=this;return d.on("end",function(){if(this.streamInfo.data_length!==f.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),d},getCompressedWorker:function(){return new s(i.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},u.createWorkerFrom=function(d,f,p){return d.pipe(new a).pipe(new l("uncompressedSize")).pipe(f.compressWorker(p)).pipe(new l("compressedSize")).withStreamInfo("compression",f)},r.exports=u},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(n,r,o){"use strict";var i=n("./stream/GenericWorker");o.STORE={magic:"\0\0",compressWorker:function(){return new i("STORE compression")},uncompressWorker:function(){return new i("STORE decompression")}},o.DEFLATE=n("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(n,r,o){"use strict";var i=n("./utils"),s=(function(){for(var a,l=[],u=0;u<256;u++){a=u;for(var d=0;d<8;d++)a=1&a?3988292384^a>>>1:a>>>1;l[u]=a}return l})();r.exports=function(a,l){return a!==void 0&&a.length?i.getTypeOf(a)!=="string"?(function(u,d,f,p){var g=s,m=p+f;u^=-1;for(var v=p;v<m;v++)u=u>>>8^g[255&(u^d[v])];return-1^u})(0|l,a,a.length,0):(function(u,d,f,p){var g=s,m=p+f;u^=-1;for(var v=p;v<m;v++)u=u>>>8^g[255&(u^d.charCodeAt(v))];return-1^u})(0|l,a,a.length,0):0}},{"./utils":32}],5:[function(n,r,o){"use strict";o.base64=!1,o.binary=!1,o.dir=!1,o.createFolders=!0,o.date=null,o.compression=null,o.compressionOptions=null,o.comment=null,o.unixPermissions=null,o.dosPermissions=null},{}],6:[function(n,r,o){"use strict";var i=null;i=typeof Promise<"u"?Promise:n("lie"),r.exports={Promise:i}},{lie:37}],7:[function(n,r,o){"use strict";var i=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",s=n("pako"),a=n("./utils"),l=n("./stream/GenericWorker"),u=i?"uint8array":"array";function d(f,p){l.call(this,"FlateWorker/"+f),this._pako=null,this._pakoAction=f,this._pakoOptions=p,this.meta={}}o.magic="\b\0",a.inherits(d,l),d.prototype.processChunk=function(f){this.meta=f.meta,this._pako===null&&this._createPako(),this._pako.push(a.transformTo(u,f.data),!1)},d.prototype.flush=function(){l.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},d.prototype.cleanUp=function(){l.prototype.cleanUp.call(this),this._pako=null},d.prototype._createPako=function(){this._pako=new s[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var f=this;this._pako.onData=function(p){f.push({data:p,meta:f.meta})}},o.compressWorker=function(f){return new d("Deflate",f)},o.uncompressWorker=function(){return new d("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(n,r,o){"use strict";function i(g,m){var v,C="";for(v=0;v<m;v++)C+=String.fromCharCode(255&g),g>>>=8;return C}function s(g,m,v,C,w,S){var k,b,T=g.file,L=g.compression,z=S!==u.utf8encode,G=a.transformTo("string",S(T.name)),U=a.transformTo("string",u.utf8encode(T.name)),j=T.comment,Z=a.transformTo("string",S(j)),R=a.transformTo("string",u.utf8encode(j)),K=U.length!==T.name.length,x=R.length!==j.length,W="",$="",J="",Q=T.dir,Y=T.date,Ce={crc32:0,compressedSize:0,uncompressedSize:0};m&&!v||(Ce.crc32=g.crc32,Ce.compressedSize=g.compressedSize,Ce.uncompressedSize=g.uncompressedSize);var fe=0;m&&(fe|=8),z||!K&&!x||(fe|=2048);var ve=0,me=0;Q&&(ve|=16),w==="UNIX"?(me=798,ve|=(function(Fe,Ze){var lt=Fe;return Fe||(lt=Ze?16893:33204),(65535<)<<16})(T.unixPermissions,Q)):(me=20,ve|=(function(Fe){return 63&(Fe||0)})(T.dosPermissions)),k=Y.getUTCHours(),k<<=6,k|=Y.getUTCMinutes(),k<<=5,k|=Y.getUTCSeconds()/2,b=Y.getUTCFullYear()-1980,b<<=4,b|=Y.getUTCMonth()+1,b<<=5,b|=Y.getUTCDate(),K&&($=i(1,1)+i(d(G),4)+U,W+="up"+i($.length,2)+$),x&&(J=i(1,1)+i(d(Z),4)+R,W+="uc"+i(J.length,2)+J);var Ee="";return Ee+=`
|
|
4
|
-
\0`,Ee+=i(fe,2),Ee+=L.magic,Ee+=i(k,2),Ee+=i(b,2),Ee+=i(Ce.crc32,4),Ee+=i(Ce.compressedSize,4),Ee+=i(Ce.uncompressedSize,4),Ee+=i(G.length,2),Ee+=i(W.length,2),{fileRecord:f.LOCAL_FILE_HEADER+Ee+G+W,dirRecord:f.CENTRAL_FILE_HEADER+i(me,2)+Ee+i(Z.length,2)+"\0\0\0\0"+i(ve,4)+i(C,4)+G+W+Z}}var a=n("../utils"),l=n("../stream/GenericWorker"),u=n("../utf8"),d=n("../crc32"),f=n("../signature");function p(g,m,v,C){l.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=m,this.zipPlatform=v,this.encodeFileName=C,this.streamFiles=g,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(p,l),p.prototype.push=function(g){var m=g.meta.percent||0,v=this.entriesCount,C=this._sources.length;this.accumulate?this.contentBuffer.push(g):(this.bytesWritten+=g.data.length,l.prototype.push.call(this,{data:g.data,meta:{currentFile:this.currentFile,percent:v?(m+100*(v-C-1))/v:100}}))},p.prototype.openedSource=function(g){this.currentSourceOffset=this.bytesWritten,this.currentFile=g.file.name;var m=this.streamFiles&&!g.file.dir;if(m){var v=s(g,m,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:v.fileRecord,meta:{percent:0}})}else this.accumulate=!0},p.prototype.closedSource=function(g){this.accumulate=!1;var m=this.streamFiles&&!g.file.dir,v=s(g,m,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(v.dirRecord),m)this.push({data:(function(C){return f.DATA_DESCRIPTOR+i(C.crc32,4)+i(C.compressedSize,4)+i(C.uncompressedSize,4)})(g),meta:{percent:100}});else for(this.push({data:v.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},p.prototype.flush=function(){for(var g=this.bytesWritten,m=0;m<this.dirRecords.length;m++)this.push({data:this.dirRecords[m],meta:{percent:100}});var v=this.bytesWritten-g,C=(function(w,S,k,b,T){var L=a.transformTo("string",T(b));return f.CENTRAL_DIRECTORY_END+"\0\0\0\0"+i(w,2)+i(w,2)+i(S,4)+i(k,4)+i(L.length,2)+L})(this.dirRecords.length,v,g,this.zipComment,this.encodeFileName);this.push({data:C,meta:{percent:100}})},p.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},p.prototype.registerPrevious=function(g){this._sources.push(g);var m=this;return g.on("data",function(v){m.processChunk(v)}),g.on("end",function(){m.closedSource(m.previous.streamInfo),m._sources.length?m.prepareNextSource():m.end()}),g.on("error",function(v){m.error(v)}),this},p.prototype.resume=function(){return!!l.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},p.prototype.error=function(g){var m=this._sources;if(!l.prototype.error.call(this,g))return!1;for(var v=0;v<m.length;v++)try{m[v].error(g)}catch{}return!0},p.prototype.lock=function(){l.prototype.lock.call(this);for(var g=this._sources,m=0;m<g.length;m++)g[m].lock()},r.exports=p},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(n,r,o){"use strict";var i=n("../compressions"),s=n("./ZipFileWorker");o.generateWorker=function(a,l,u){var d=new s(l.streamFiles,u,l.platform,l.encodeFileName),f=0;try{a.forEach(function(p,g){f++;var m=(function(S,k){var b=S||k,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||{},C=g.dir,w=g.date;g._compressWorker(m,v).withStreamInfo("file",{name:p,dir:C,date:w,comment:g.comment||"",unixPermissions:g.unixPermissions,dosPermissions:g.dosPermissions}).pipe(d)}),d.entriesCount=f}catch(p){d.error(p)}return d}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(n,r,o){"use strict";function i(){if(!(this instanceof i))return new i;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var s=new i;for(var a in this)typeof this[a]!="function"&&(s[a]=this[a]);return s}}(i.prototype=n("./object")).loadAsync=n("./load"),i.support=n("./support"),i.defaults=n("./defaults"),i.version="3.10.1",i.loadAsync=function(s,a){return new i().loadAsync(s,a)},i.external=n("./external"),r.exports=i},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(n,r,o){"use strict";var i=n("./utils"),s=n("./external"),a=n("./utf8"),l=n("./zipEntries"),u=n("./stream/Crc32Probe"),d=n("./nodejsUtils");function f(p){return new s.Promise(function(g,m){var v=p.decompressed.getContentWorker().pipe(new u);v.on("error",function(C){m(C)}).on("end",function(){v.streamInfo.crc32!==p.decompressed.crc32?m(new Error("Corrupted zip : CRC32 mismatch")):g()}).resume()})}r.exports=function(p,g){var m=this;return g=i.extend(g||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:a.utf8decode}),d.isNode&&d.isStream(p)?s.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):i.prepareContent("the loaded zip file",p,!0,g.optimizedBinaryString,g.base64).then(function(v){var C=new l(g);return C.load(v),C}).then(function(v){var C=[s.Promise.resolve(v)],w=v.files;if(g.checkCRC32)for(var S=0;S<w.length;S++)C.push(f(w[S]));return s.Promise.all(C)}).then(function(v){for(var C=v.shift(),w=C.files,S=0;S<w.length;S++){var k=w[S],b=k.fileNameStr,T=i.resolve(k.fileNameStr);m.file(T,k.decompressed,{binary:!0,optimizedBinaryString:!0,date:k.date,dir:k.dir,comment:k.fileCommentStr.length?k.fileCommentStr:null,unixPermissions:k.unixPermissions,dosPermissions:k.dosPermissions,createFolders:g.createFolders}),k.dir||(m.file(T).unsafeOriginalName=b)}return C.zipComment.length&&(m.comment=C.zipComment),m})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(n,r,o){"use strict";var i=n("../utils"),s=n("../stream/GenericWorker");function a(l,u){s.call(this,"Nodejs stream input adapter for "+l),this._upstreamEnded=!1,this._bindStream(u)}i.inherits(a,s),a.prototype._bindStream=function(l){var u=this;(this._stream=l).pause(),l.on("data",function(d){u.push({data:d,meta:{percent:0}})}).on("error",function(d){u.isPaused?this.generatedError=d:u.error(d)}).on("end",function(){u.isPaused?u._upstreamEnded=!0:u.end()})},a.prototype.pause=function(){return!!s.prototype.pause.call(this)&&(this._stream.pause(),!0)},a.prototype.resume=function(){return!!s.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},r.exports=a},{"../stream/GenericWorker":28,"../utils":32}],13:[function(n,r,o){"use strict";var i=n("readable-stream").Readable;function s(a,l,u){i.call(this,l),this._helper=a;var d=this;a.on("data",function(f,p){d.push(f)||d._helper.pause(),u&&u(p)}).on("error",function(f){d.emit("error",f)}).on("end",function(){d.push(null)})}n("../utils").inherits(s,i),s.prototype._read=function(){this._helper.resume()},r.exports=s},{"../utils":32,"readable-stream":16}],14:[function(n,r,o){"use strict";r.exports={isNode:typeof Buffer<"u",newBufferFrom:function(i,s){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(i,s);if(typeof i=="number")throw new Error('The "data" argument must not be a number');return new Buffer(i,s)},allocBuffer:function(i){if(Buffer.alloc)return Buffer.alloc(i);var s=new Buffer(i);return s.fill(0),s},isBuffer:function(i){return Buffer.isBuffer(i)},isStream:function(i){return i&&typeof i.on=="function"&&typeof i.pause=="function"&&typeof i.resume=="function"}}},{}],15:[function(n,r,o){"use strict";function i(b,T,L){var z,G=a.getTypeOf(T),U=a.extend(L||{},d);U.date=U.date||new Date,U.compression!==null&&(U.compression=U.compression.toUpperCase()),typeof U.unixPermissions=="string"&&(U.unixPermissions=parseInt(U.unixPermissions,8)),U.unixPermissions&&16384&U.unixPermissions&&(U.dir=!0),U.dosPermissions&&16&U.dosPermissions&&(U.dir=!0),U.dir&&(b=w(b)),U.createFolders&&(z=C(b))&&S.call(this,z,!0);var j=G==="string"&&U.binary===!1&&U.base64===!1;L&&L.binary!==void 0||(U.binary=!j),(T instanceof f&&T.uncompressedSize===0||U.dir||!T||T.length===0)&&(U.base64=!1,U.binary=!0,T="",U.compression="STORE",G="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,U.binary,U.optimizedBinaryString,U.base64);var R=new p(b,Z,U);this.files[b]=R}var s=n("./utf8"),a=n("./utils"),l=n("./stream/GenericWorker"),u=n("./stream/StreamHelper"),d=n("./defaults"),f=n("./compressedObject"),p=n("./zipObject"),g=n("./generate"),m=n("./nodejsUtils"),v=n("./nodejs/NodejsStreamInputAdapter"),C=function(b){b.slice(-1)==="/"&&(b=b.substring(0,b.length-1));var T=b.lastIndexOf("/");return 0<T?b.substring(0,T):""},w=function(b){return b.slice(-1)!=="/"&&(b+="/"),b},S=function(b,T){return T=T!==void 0?T:d.createFolders,b=w(b),this.files[b]||i.call(this,b,null,{dir:!0,createFolders:T}),this.files[b]};function k(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,z;for(T in this.files)z=this.files[T],(L=T.slice(this.root.length,T.length))&&T.slice(0,this.root.length)===this.root&&b(L,z)},filter:function(b){var T=[];return this.forEach(function(L,z){b(L,z)&&T.push(z)}),T},file:function(b,T,L){if(arguments.length!==1)return b=this.root+b,i.call(this,b,T,L),this;if(k(b)){var z=b;return this.filter(function(U,j){return!j.dir&&z.test(U)})}var G=this.files[this.root+b];return G&&!G.dir?G:null},folder:function(b){if(!b)return this;if(k(b))return this.filter(function(G,U){return U.dir&&b.test(G)});var T=this.root+b,L=S.call(this,T),z=this.clone();return z.root=L.name,z},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(G,U){return U.name.slice(0,b.length)===b}),z=0;z<L.length;z++)delete this.files[L[z].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(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 z=L.comment||this.comment||"";T=g.generateWorker(this,L,z)}catch(G){(T=new l("error")).error(G)}return new u(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),u=a.charCodeAt(1),d=a.charCodeAt(2),f=a.charCodeAt(3),p=this.length-4;0<=p;--p)if(this.data[p]===l&&this.data[p+1]===u&&this.data[p+2]===d&&this.data[p+3]===f)return p-this.zero;return-1},s.prototype.readAndCheckSignature=function(a){var l=a.charCodeAt(0),u=a.charCodeAt(1),d=a.charCodeAt(2),f=a.charCodeAt(3),p=this.readData(4);return l===p[0]&&u===p[1]&&d===p[2]&&f===p[3]},s.prototype.readData=function(a){if(this.checkOffset(a),a===0)return[];var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=s},{"../utils":32,"./DataReader":18}],18:[function(n,r,o){"use strict";var i=n("../utils");function s(a){this.data=a,this.length=a.length,this.index=0,this.zero=0}s.prototype={checkOffset:function(a){this.checkIndex(this.index+a)},checkIndex:function(a){if(this.length<this.zero+a||a<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+a+"). Corrupted zip ?")},setIndex:function(a){this.checkIndex(a),this.index=a},skip:function(a){this.setIndex(this.index+a)},byteAt:function(){},readInt:function(a){var l,u=0;for(this.checkOffset(a),l=this.index+a-1;l>=this.index;l--)u=(u<<8)+this.byteAt(l);return this.index+=a,u},readString:function(a){return i.transformTo("string",this.readData(a))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var a=this.readInt(4);return new Date(Date.UTC(1980+(a>>25&127),(a>>21&15)-1,a>>16&31,a>>11&31,a>>5&63,(31&a)<<1))}},r.exports=s},{"../utils":32}],19:[function(n,r,o){"use strict";var i=n("./Uint8ArrayReader");function s(a){i.call(this,a)}n("../utils").inherits(s,i),s.prototype.readData=function(a){this.checkOffset(a);var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=s},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(n,r,o){"use strict";var i=n("./DataReader");function s(a){i.call(this,a)}n("../utils").inherits(s,i),s.prototype.byteAt=function(a){return this.data.charCodeAt(this.zero+a)},s.prototype.lastIndexOfSignature=function(a){return this.data.lastIndexOf(a)-this.zero},s.prototype.readAndCheckSignature=function(a){return a===this.readData(4)},s.prototype.readData=function(a){this.checkOffset(a);var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=s},{"../utils":32,"./DataReader":18}],21:[function(n,r,o){"use strict";var i=n("./ArrayReader");function s(a){i.call(this,a)}n("../utils").inherits(s,i),s.prototype.readData=function(a){if(this.checkOffset(a),a===0)return new Uint8Array(0);var l=this.data.subarray(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=s},{"../utils":32,"./ArrayReader":17}],22:[function(n,r,o){"use strict";var i=n("../utils"),s=n("../support"),a=n("./ArrayReader"),l=n("./StringReader"),u=n("./NodeBufferReader"),d=n("./Uint8ArrayReader");r.exports=function(f){var p=i.getTypeOf(f);return i.checkSupport(p),p!=="string"||s.uint8array?p==="nodebuffer"?new u(f):s.uint8array?new d(i.transformTo("uint8array",f)):new a(i.transformTo("array",f)):new l(f)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(n,r,o){"use strict";o.LOCAL_FILE_HEADER="PK",o.CENTRAL_FILE_HEADER="PK",o.CENTRAL_DIRECTORY_END="PK",o.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",o.ZIP64_CENTRAL_DIRECTORY_END="PK",o.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(n,r,o){"use strict";var i=n("./GenericWorker"),s=n("../utils");function a(l){i.call(this,"ConvertWorker to "+l),this.destType=l}s.inherits(a,i),a.prototype.processChunk=function(l){this.push({data:s.transformTo(this.destType,l.data),meta:l.meta})},r.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(n,r,o){"use strict";var i=n("./GenericWorker"),s=n("../crc32");function a(){i.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}n("../utils").inherits(a,i),a.prototype.processChunk=function(l){this.streamInfo.crc32=s(l.data,this.streamInfo.crc32||0),this.push(l)},r.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(n,r,o){"use strict";var i=n("../utils"),s=n("./GenericWorker");function a(l){s.call(this,"DataLengthProbe for "+l),this.propName=l,this.withStreamInfo(l,0)}i.inherits(a,s),a.prototype.processChunk=function(l){if(l){var u=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=u+l.data.length}s.prototype.processChunk.call(this,l)},r.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(n,r,o){"use strict";var i=n("../utils"),s=n("./GenericWorker");function a(l){s.call(this,"DataWorker");var u=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,l.then(function(d){u.dataIsReady=!0,u.data=d,u.max=d&&d.length||0,u.type=i.getTypeOf(d),u.isPaused||u._tickAndRepeat()},function(d){u.error(d)})}i.inherits(a,s),a.prototype.cleanUp=function(){s.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!s.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,i.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(i.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var l=null,u=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":l=this.data.substring(this.index,u);break;case"uint8array":l=this.data.subarray(this.index,u);break;case"array":case"nodebuffer":l=this.data.slice(this.index,u)}return this.index=u,this.push({data:l,meta:{percent:this.max?this.index/this.max*100:0}})},r.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(n,r,o){"use strict";function i(s){this.name=s||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}i.prototype={push:function(s){this.emit("data",s)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(s){this.emit("error",s)}return!0},error:function(s){return!this.isFinished&&(this.isPaused?this.generatedError=s:(this.isFinished=!0,this.emit("error",s),this.previous&&this.previous.error(s),this.cleanUp()),!0)},on:function(s,a){return this._listeners[s].push(a),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(s,a){if(this._listeners[s])for(var l=0;l<this._listeners[s].length;l++)this._listeners[s][l].call(this,a)},pipe:function(s){return s.registerPrevious(this)},registerPrevious:function(s){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=s.streamInfo,this.mergeStreamInfo(),this.previous=s;var a=this;return s.on("data",function(l){a.processChunk(l)}),s.on("end",function(){a.end()}),s.on("error",function(l){a.error(l)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var s=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),s=!0),this.previous&&this.previous.resume(),!s},flush:function(){},processChunk:function(s){this.push(s)},withStreamInfo:function(s,a){return this.extraStreamInfo[s]=a,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var s in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,s)&&(this.streamInfo[s]=this.extraStreamInfo[s])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var s="Worker "+this.name;return this.previous?this.previous+" -> "+s:s}},r.exports=i},{}],29:[function(n,r,o){"use strict";var i=n("../utils"),s=n("./ConvertWorker"),a=n("./GenericWorker"),l=n("../base64"),u=n("../support"),d=n("../external"),f=null;if(u.nodestream)try{f=n("../nodejs/NodejsStreamOutputAdapter")}catch{}function p(m,v){return new d.Promise(function(C,w){var S=[],k=m._internalType,b=m._outputType,T=m._mimeType;m.on("data",function(L,z){S.push(L),v&&v(z)}).on("error",function(L){S=[],w(L)}).on("end",function(){try{C((function(L,z,G){switch(L){case"blob":return i.newBlob(i.transformTo("arraybuffer",z),G);case"base64":return l.encode(z);default:return i.transformTo(L,z)}})(b,(function(L,z){var G,U=0,j=null,Z=0;for(G=0;G<z.length;G++)Z+=z[G].length;switch(L){case"string":return z.join("");case"array":return Array.prototype.concat.apply([],z);case"uint8array":for(j=new Uint8Array(Z),G=0;G<z.length;G++)j.set(z[G],U),U+=z[G].length;return j;case"nodebuffer":return Buffer.concat(z);default:throw new Error("concat : unsupported type '"+L+"'")}})(k,S),T))}catch(L){w(L)}S=[]}).resume()})}function g(m,v,C){var w=v;switch(v){case"blob":case"arraybuffer":w="uint8array";break;case"base64":w="string"}try{this._internalType=w,this._outputType=v,this._mimeType=C,i.checkSupport(w),this._worker=m.pipe(new s(w)),m.lock()}catch(S){this._worker=new a("error"),this._worker.error(S)}}g.prototype={accumulate:function(m){return p(this,m)},on:function(m,v){var C=this;return m==="data"?this._worker.on(m,function(w){v.call(C,w.data,w.meta)}):this._worker.on(m,function(){i.delay(v,arguments,C)}),this},resume:function(){return i.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(m){if(i.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new f(this,{objectMode:this._outputType!=="nodebuffer"},m)}},r.exports=g},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(n,r,o){"use strict";if(o.base64=!0,o.array=!0,o.string=!0,o.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",o.nodebuffer=typeof Buffer<"u",o.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")o.blob=!1;else{var i=new ArrayBuffer(0);try{o.blob=new Blob([i],{type:"application/zip"}).size===0}catch{try{var s=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);s.append(i),o.blob=s.getBlob("application/zip").size===0}catch{o.blob=!1}}}try{o.nodestream=!!n("readable-stream").Readable}catch{o.nodestream=!1}},{"readable-stream":16}],31:[function(n,r,o){"use strict";for(var i=n("./utils"),s=n("./support"),a=n("./nodejsUtils"),l=n("./stream/GenericWorker"),u=new Array(256),d=0;d<256;d++)u[d]=252<=d?6:248<=d?5:240<=d?4:224<=d?3:192<=d?2:1;u[254]=u[254]=1;function f(){l.call(this,"utf-8 decode"),this.leftOver=null}function p(){l.call(this,"utf-8 encode")}o.utf8encode=function(g){return s.nodebuffer?a.newBufferFrom(g,"utf-8"):(function(m){var v,C,w,S,k,b=m.length,T=0;for(S=0;S<b;S++)(64512&(C=m.charCodeAt(S)))==55296&&S+1<b&&(64512&(w=m.charCodeAt(S+1)))==56320&&(C=65536+(C-55296<<10)+(w-56320),S++),T+=C<128?1:C<2048?2:C<65536?3:4;for(v=s.uint8array?new Uint8Array(T):new Array(T),S=k=0;k<T;S++)(64512&(C=m.charCodeAt(S)))==55296&&S+1<b&&(64512&(w=m.charCodeAt(S+1)))==56320&&(C=65536+(C-55296<<10)+(w-56320),S++),C<128?v[k++]=C:(C<2048?v[k++]=192|C>>>6:(C<65536?v[k++]=224|C>>>12:(v[k++]=240|C>>>18,v[k++]=128|C>>>12&63),v[k++]=128|C>>>6&63),v[k++]=128|63&C);return v})(g)},o.utf8decode=function(g){return s.nodebuffer?i.transformTo("nodebuffer",g).toString("utf-8"):(function(m){var v,C,w,S,k=m.length,b=new Array(2*k);for(v=C=0;v<k;)if((w=m[v++])<128)b[C++]=w;else if(4<(S=u[w]))b[C++]=65533,v+=S-1;else{for(w&=S===2?31:S===3?15:7;1<S&&v<k;)w=w<<6|63&m[v++],S--;1<S?b[C++]=65533:w<65536?b[C++]=w:(w-=65536,b[C++]=55296|w>>10&1023,b[C++]=56320|1023&w)}return b.length!==C&&(b.subarray?b=b.subarray(0,C):b.length=C),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 C=(function(S,k){var b;for((k=k||S.length)>S.length&&(k=S.length),b=k-1;0<=b&&(192&S[b])==128;)b--;return b<0||b===0?k:b+u[S[b]]>k?b:k})(m),w=m;C!==m.length&&(s.uint8array?(w=m.subarray(0,C),this.leftOver=m.subarray(C,m.length)):(w=m.slice(0,C),this.leftOver=m.slice(C,m.length))),this.push({data:o.utf8decode(w),meta:g.meta})},f.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:o.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},o.Utf8DecodeWorker=f,i.inherits(p,l),p.prototype.processChunk=function(g){this.push({data:o.utf8encode(g.data),meta:g.meta})},o.Utf8EncodeWorker=p},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(n,r,o){"use strict";var i=n("./support"),s=n("./base64"),a=n("./nodejsUtils"),l=n("./external");function u(v){return v}function d(v,C){for(var w=0;w<v.length;++w)C[w]=255&v.charCodeAt(w);return C}n("setimmediate"),o.newBlob=function(v,C){o.checkSupport("blob");try{return new Blob([v],{type:C})}catch{try{var w=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return w.append(v),w.getBlob(C)}catch{throw new Error("Bug : can't construct the Blob.")}}};var f={stringifyByChunk:function(v,C,w){var S=[],k=0,b=v.length;if(b<=w)return String.fromCharCode.apply(null,v);for(;k<b;)C==="array"||C==="nodebuffer"?S.push(String.fromCharCode.apply(null,v.slice(k,Math.min(k+w,b)))):S.push(String.fromCharCode.apply(null,v.subarray(k,Math.min(k+w,b)))),k+=w;return S.join("")},stringifyByChar:function(v){for(var C="",w=0;w<v.length;w++)C+=String.fromCharCode(v[w]);return C},applyCanBeUsed:{uint8array:(function(){try{return i.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}})(),nodebuffer:(function(){try{return i.nodebuffer&&String.fromCharCode.apply(null,a.allocBuffer(1)).length===1}catch{return!1}})()}};function p(v){var C=65536,w=o.getTypeOf(v),S=!0;if(w==="uint8array"?S=f.applyCanBeUsed.uint8array:w==="nodebuffer"&&(S=f.applyCanBeUsed.nodebuffer),S)for(;1<C;)try{return f.stringifyByChunk(v,w,C)}catch{C=Math.floor(C/2)}return f.stringifyByChar(v)}function g(v,C){for(var w=0;w<v.length;w++)C[w]=v[w];return C}o.applyFromCharCode=p;var m={};m.string={string:u,array:function(v){return d(v,new Array(v.length))},arraybuffer:function(v){return m.string.uint8array(v).buffer},uint8array:function(v){return d(v,new Uint8Array(v.length))},nodebuffer:function(v){return d(v,a.allocBuffer(v.length))}},m.array={string:p,array:u,arraybuffer:function(v){return new Uint8Array(v).buffer},uint8array:function(v){return new Uint8Array(v)},nodebuffer:function(v){return a.newBufferFrom(v)}},m.arraybuffer={string:function(v){return p(new Uint8Array(v))},array:function(v){return g(new Uint8Array(v),new Array(v.byteLength))},arraybuffer:u,uint8array:function(v){return new Uint8Array(v)},nodebuffer:function(v){return a.newBufferFrom(new Uint8Array(v))}},m.uint8array={string:p,array:function(v){return g(v,new Array(v.length))},arraybuffer:function(v){return v.buffer},uint8array:u,nodebuffer:function(v){return a.newBufferFrom(v)}},m.nodebuffer={string:p,array:function(v){return g(v,new Array(v.length))},arraybuffer:function(v){return m.nodebuffer.uint8array(v).buffer},uint8array:function(v){return g(v,new Uint8Array(v.length))},nodebuffer:u},o.transformTo=function(v,C){return C=C||"",v?(o.checkSupport(v),m[o.getTypeOf(C)][v](C)):C},o.resolve=function(v){for(var C=v.split("/"),w=[],S=0;S<C.length;S++){var k=C[S];k==="."||k===""&&S!==0&&S!==C.length-1||(k===".."?w.pop():w.push(k))}return w.join("/")},o.getTypeOf=function(v){return typeof v=="string"?"string":Object.prototype.toString.call(v)==="[object Array]"?"array":i.nodebuffer&&a.isBuffer(v)?"nodebuffer":i.uint8array&&v instanceof Uint8Array?"uint8array":i.arraybuffer&&v instanceof ArrayBuffer?"arraybuffer":void 0},o.checkSupport=function(v){if(!i[v.toLowerCase()])throw new Error(v+" is not supported by this platform")},o.MAX_VALUE_16BITS=65535,o.MAX_VALUE_32BITS=-1,o.pretty=function(v){var C,w,S="";for(w=0;w<(v||"").length;w++)S+="\\x"+((C=v.charCodeAt(w))<16?"0":"")+C.toString(16).toUpperCase();return S},o.delay=function(v,C,w){setImmediate(function(){v.apply(w||null,C||[])})},o.inherits=function(v,C){function w(){}w.prototype=C.prototype,v.prototype=new w},o.extend=function(){var v,C,w={};for(v=0;v<arguments.length;v++)for(C in arguments[v])Object.prototype.hasOwnProperty.call(arguments[v],C)&&w[C]===void 0&&(w[C]=arguments[v][C]);return w},o.prepareContent=function(v,C,w,S,k){return l.Promise.resolve(C).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 z=new FileReader;z.onload=function(G){T(G.target.result)},z.onerror=function(G){L(G.target.error)},z.readAsArrayBuffer(b)}):b}).then(function(b){var T=o.getTypeOf(b);return T?(T==="arraybuffer"?b=o.transformTo("uint8array",b):T==="string"&&(k?b=s.decode(b):w&&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"),u=n("./support");function d(f){this.files=[],this.loadOptions=f}d.prototype={checkSignature:function(f){if(!this.reader.readAndCheckSignature(f)){this.reader.index-=4;var p=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+s.pretty(p)+", expected "+s.pretty(f)+")")}},isSignature:function(f,p){var g=this.reader.index;this.reader.setIndex(f);var m=this.reader.readString(4)===p;return this.reader.setIndex(g),m},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var f=this.reader.readData(this.zipCommentLength),p=u.uint8array?"uint8array":"array",g=s.transformTo(p,f);this.zipComment=this.loadOptions.decodeFileName(g)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var f,p,g,m=this.zip64EndOfCentralSize-44;0<m;)f=this.reader.readInt(2),p=this.reader.readInt(4),g=this.reader.readData(p),this.zip64ExtensibleData[f]={id:f,length:p,value:g}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var f,p;for(f=0;f<this.files.length;f++)p=this.files[f],this.reader.setIndex(p.localHeaderOffset),this.checkSignature(a.LOCAL_FILE_HEADER),p.readLocalPart(this.reader),p.handleUTF8(),p.processAttributes()},readCentralDir:function(){var f;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(a.CENTRAL_FILE_HEADER);)(f=new l({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(f);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var f=this.reader.lastIndexOfSignature(a.CENTRAL_DIRECTORY_END);if(f<0)throw this.isSignature(0,a.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(f);var p=f;if(this.checkSignature(a.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===s.MAX_VALUE_16BITS||this.diskWithCentralDirStart===s.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===s.MAX_VALUE_16BITS||this.centralDirRecords===s.MAX_VALUE_16BITS||this.centralDirSize===s.MAX_VALUE_32BITS||this.centralDirOffset===s.MAX_VALUE_32BITS){if(this.zip64=!0,(f=this.reader.lastIndexOfSignature(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(f),this.checkSignature(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,a.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(a.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(a.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var g=this.centralDirOffset+this.centralDirSize;this.zip64&&(g+=20,g+=12+this.zip64EndOfCentralSize);var m=p-g;if(0<m)this.isSignature(p,a.CENTRAL_FILE_HEADER)||(this.reader.zero=m);else if(m<0)throw new Error("Corrupted zip: missing "+Math.abs(m)+" bytes.")},prepareReader:function(f){this.reader=i(f)},load:function(f){this.prepareReader(f),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},r.exports=d},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(n,r,o){"use strict";var i=n("./reader/readerFor"),s=n("./utils"),a=n("./compressedObject"),l=n("./crc32"),u=n("./utf8"),d=n("./compressions"),f=n("./support");function p(g,m){this.options=g,this.loadOptions=m}p.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(g){var m,v;if(g.skip(22),this.fileNameLength=g.readInt(2),v=g.readInt(2),this.fileName=g.readData(this.fileNameLength),g.skip(v),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if((m=(function(C){for(var w in d)if(Object.prototype.hasOwnProperty.call(d,w)&&d[w].magic===C)return d[w];return null})(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+s.pretty(this.compressionMethod)+" unknown (inner file : "+s.transformTo("string",this.fileName)+")");this.decompressed=new a(this.compressedSize,this.uncompressedSize,this.crc32,m,g.readData(this.compressedSize))},readCentralPart:function(g){this.versionMadeBy=g.readInt(2),g.skip(2),this.bitFlag=g.readInt(2),this.compressionMethod=g.readString(2),this.date=g.readDate(),this.crc32=g.readInt(4),this.compressedSize=g.readInt(4),this.uncompressedSize=g.readInt(4);var m=g.readInt(2);if(this.extraFieldsLength=g.readInt(2),this.fileCommentLength=g.readInt(2),this.diskNumberStart=g.readInt(2),this.internalFileAttributes=g.readInt(2),this.externalFileAttributes=g.readInt(4),this.localHeaderOffset=g.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");g.skip(m),this.readExtraFields(g),this.parseZIP64ExtraField(g),this.fileComment=g.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var g=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),g==0&&(this.dosPermissions=63&this.externalFileAttributes),g==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var g=i(this.extraFields[1].value);this.uncompressedSize===s.MAX_VALUE_32BITS&&(this.uncompressedSize=g.readInt(8)),this.compressedSize===s.MAX_VALUE_32BITS&&(this.compressedSize=g.readInt(8)),this.localHeaderOffset===s.MAX_VALUE_32BITS&&(this.localHeaderOffset=g.readInt(8)),this.diskNumberStart===s.MAX_VALUE_32BITS&&(this.diskNumberStart=g.readInt(4))}},readExtraFields:function(g){var m,v,C,w=g.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});g.index+4<w;)m=g.readInt(2),v=g.readInt(2),C=g.readData(v),this.extraFields[m]={id:m,length:v,value:C};g.setIndex(w)},handleUTF8:function(){var g=f.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=u.utf8decode(this.fileName),this.fileCommentStr=u.utf8decode(this.fileComment);else{var m=this.findExtraFieldUnicodePath();if(m!==null)this.fileNameStr=m;else{var v=s.transformTo(g,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(v)}var C=this.findExtraFieldUnicodeComment();if(C!==null)this.fileCommentStr=C;else{var w=s.transformTo(g,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(w)}}},findExtraFieldUnicodePath:function(){var g=this.extraFields[28789];if(g){var m=i(g.value);return m.readInt(1)!==1||l(this.fileName)!==m.readInt(4)?null:u.utf8decode(m.readData(g.length-5))}return null},findExtraFieldUnicodeComment:function(){var g=this.extraFields[25461];if(g){var m=i(g.value);return m.readInt(1)!==1||l(this.fileComment)!==m.readInt(4)?null:u.utf8decode(m.readData(g.length-5))}return null}},r.exports=p},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(n,r,o){"use strict";function i(m,v,C){this.name=m,this.dir=C.dir,this.date=C.date,this.comment=C.comment,this.unixPermissions=C.unixPermissions,this.dosPermissions=C.dosPermissions,this._data=v,this._dataBinary=C.binary,this.options={compression:C.compression,compressionOptions:C.compressionOptions}}var s=n("./stream/StreamHelper"),a=n("./stream/DataWorker"),l=n("./utf8"),u=n("./compressedObject"),d=n("./stream/GenericWorker");i.prototype={internalStream:function(m){var v=null,C="string";try{if(!m)throw new Error("No output type specified.");var w=(C=m.toLowerCase())==="string"||C==="text";C!=="binarystring"&&C!=="text"||(C="string"),v=this._decompressWorker();var S=!this._dataBinary;S&&!w&&(v=v.pipe(new l.Utf8EncodeWorker)),!S&&w&&(v=v.pipe(new l.Utf8DecodeWorker))}catch(k){(v=new d("error")).error(k)}return new s(v,C,"")},async:function(m,v){return this.internalStream(m).accumulate(v)},nodeStream:function(m,v){return this.internalStream(m||"nodebuffer").toNodejsStream(v)},_compressWorker:function(m,v){if(this._data instanceof u&&this._data.compression.magic===m.magic)return this._data.getCompressedWorker();var C=this._decompressWorker();return this._dataBinary||(C=C.pipe(new l.Utf8EncodeWorker)),u.createWorkerFrom(C,m,v)},_decompressWorker:function(){return this._data instanceof u?this._data.getContentWorker():this._data instanceof d?this._data:new a(this._data)}};for(var f=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],p=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},g=0;g<f.length;g++)i.prototype[f[g]]=p;r.exports=i},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(n,r,o){(function(i){"use strict";var s,a,l=i.MutationObserver||i.WebKitMutationObserver;if(l){var u=0,d=new l(m),f=i.document.createTextNode("");d.observe(f,{characterData:!0}),s=function(){f.data=u=++u%2}}else if(i.setImmediate||i.MessageChannel===void 0)s="document"in i&&"onreadystatechange"in i.document.createElement("script")?function(){var v=i.document.createElement("script");v.onreadystatechange=function(){m(),v.onreadystatechange=null,v.parentNode.removeChild(v),v=null},i.document.documentElement.appendChild(v)}:function(){setTimeout(m,0)};else{var p=new i.MessageChannel;p.port1.onmessage=m,s=function(){p.port2.postMessage(0)}}var g=[];function m(){var v,C;a=!0;for(var w=g.length;w;){for(C=g,g=[],v=-1;++v<w;)C[v]();w=g.length}a=!1}r.exports=function(v){g.push(v)!==1||a||s()}}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(n,r,o){"use strict";var i=n("immediate");function s(){}var a={},l=["REJECTED"],u=["FULFILLED"],d=["PENDING"];function f(w){if(typeof w!="function")throw new TypeError("resolver must be a function");this.state=d,this.queue=[],this.outcome=void 0,w!==s&&v(this,w)}function p(w,S,k){this.promise=w,typeof S=="function"&&(this.onFulfilled=S,this.callFulfilled=this.otherCallFulfilled),typeof k=="function"&&(this.onRejected=k,this.callRejected=this.otherCallRejected)}function g(w,S,k){i(function(){var b;try{b=S(k)}catch(T){return a.reject(w,T)}b===w?a.reject(w,new TypeError("Cannot resolve promise with itself")):a.resolve(w,b)})}function m(w){var S=w&&w.then;if(w&&(typeof w=="object"||typeof w=="function")&&typeof S=="function")return function(){S.apply(w,arguments)}}function v(w,S){var k=!1;function b(z){k||(k=!0,a.reject(w,z))}function T(z){k||(k=!0,a.resolve(w,z))}var L=C(function(){S(T,b)});L.status==="error"&&b(L.value)}function C(w,S){var k={};try{k.value=w(S),k.status="success"}catch(b){k.status="error",k.value=b}return k}(r.exports=f).prototype.finally=function(w){if(typeof w!="function")return this;var S=this.constructor;return this.then(function(k){return S.resolve(w()).then(function(){return k})},function(k){return S.resolve(w()).then(function(){throw k})})},f.prototype.catch=function(w){return this.then(null,w)},f.prototype.then=function(w,S){if(typeof w!="function"&&this.state===u||typeof S!="function"&&this.state===l)return this;var k=new this.constructor(s);return this.state!==d?g(k,this.state===u?w:S,this.outcome):this.queue.push(new p(k,w,S)),k},p.prototype.callFulfilled=function(w){a.resolve(this.promise,w)},p.prototype.otherCallFulfilled=function(w){g(this.promise,this.onFulfilled,w)},p.prototype.callRejected=function(w){a.reject(this.promise,w)},p.prototype.otherCallRejected=function(w){g(this.promise,this.onRejected,w)},a.resolve=function(w,S){var k=C(m,S);if(k.status==="error")return a.reject(w,k.value);var b=k.value;if(b)v(w,b);else{w.state=u,w.outcome=S;for(var T=-1,L=w.queue.length;++T<L;)w.queue[T].callFulfilled(S)}return w},a.reject=function(w,S){w.state=l,w.outcome=S;for(var k=-1,b=w.queue.length;++k<b;)w.queue[k].callRejected(S);return w},f.resolve=function(w){return w instanceof this?w:a.resolve(new this(s),w)},f.reject=function(w){var S=new this(s);return a.reject(S,w)},f.all=function(w){var S=this;if(Object.prototype.toString.call(w)!=="[object Array]")return this.reject(new TypeError("must be an array"));var k=w.length,b=!1;if(!k)return this.resolve([]);for(var T=new Array(k),L=0,z=-1,G=new this(s);++z<k;)U(w[z],z);return G;function U(j,Z){S.resolve(j).then(function(R){T[Z]=R,++L!==k||b||(b=!0,a.resolve(G,T))},function(R){b||(b=!0,a.reject(G,R))})}},f.race=function(w){var S=this;if(Object.prototype.toString.call(w)!=="[object Array]")return this.reject(new TypeError("must be an array"));var k=w.length,b=!1;if(!k)return this.resolve([]);for(var T=-1,L=new this(s);++T<k;)z=w[T],S.resolve(z).then(function(G){b||(b=!0,a.resolve(L,G))},function(G){b||(b=!0,a.reject(L,G))});var z;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"),u=n("./zlib/zstream"),d=Object.prototype.toString,f=0,p=-1,g=0,m=8;function v(w){if(!(this instanceof v))return new v(w);this.options=s.assign({level:p,method:m,chunkSize:16384,windowBits:15,memLevel:8,strategy:g,to:""},w||{});var S=this.options;S.raw&&0<S.windowBits?S.windowBits=-S.windowBits:S.gzip&&0<S.windowBits&&S.windowBits<16&&(S.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new u,this.strm.avail_out=0;var k=i.deflateInit2(this.strm,S.level,S.method,S.windowBits,S.memLevel,S.strategy);if(k!==f)throw new Error(l[k]);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,(k=i.deflateSetDictionary(this.strm,b))!==f)throw new Error(l[k]);this._dict_set=!0}}function C(w,S){var k=new v(S);if(k.push(w,!0),k.err)throw k.msg||l[k.err];return k.result}v.prototype.push=function(w,S){var k,b,T=this.strm,L=this.options.chunkSize;if(this.ended)return!1;b=S===~~S?S:S===!0?4:0,typeof w=="string"?T.input=a.string2buf(w):d.call(w)==="[object ArrayBuffer]"?T.input=new Uint8Array(w):T.input=w,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),(k=i.deflate(T,b))!==1&&k!==f)return this.onEnd(k),!(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)&&k!==1);return b===4?(k=i.deflateEnd(this.strm),this.onEnd(k),this.ended=!0,k===f):b!==2||(this.onEnd(f),!(T.avail_out=0))},v.prototype.onData=function(w){this.chunks.push(w)},v.prototype.onEnd=function(w){w===f&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=s.flattenChunks(this.chunks)),this.chunks=[],this.err=w,this.msg=this.strm.msg},o.Deflate=v,o.deflate=C,o.deflateRaw=function(w,S){return(S=S||{}).raw=!0,C(w,S)},o.gzip=function(w,S){return(S=S||{}).gzip=!0,C(w,S)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(n,r,o){"use strict";var i=n("./zlib/inflate"),s=n("./utils/common"),a=n("./utils/strings"),l=n("./zlib/constants"),u=n("./zlib/messages"),d=n("./zlib/zstream"),f=n("./zlib/gzheader"),p=Object.prototype.toString;function g(v){if(!(this instanceof g))return new g(v);this.options=s.assign({chunkSize:16384,windowBits:0,to:""},v||{});var C=this.options;C.raw&&0<=C.windowBits&&C.windowBits<16&&(C.windowBits=-C.windowBits,C.windowBits===0&&(C.windowBits=-15)),!(0<=C.windowBits&&C.windowBits<16)||v&&v.windowBits||(C.windowBits+=32),15<C.windowBits&&C.windowBits<48&&(15&C.windowBits)==0&&(C.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new d,this.strm.avail_out=0;var w=i.inflateInit2(this.strm,C.windowBits);if(w!==l.Z_OK)throw new Error(u[w]);this.header=new f,i.inflateGetHeader(this.strm,this.header)}function m(v,C){var w=new g(C);if(w.push(v,!0),w.err)throw w.msg||u[w.err];return w.result}g.prototype.push=function(v,C){var w,S,k,b,T,L,z=this.strm,G=this.options.chunkSize,U=this.options.dictionary,j=!1;if(this.ended)return!1;S=C===~~C?C:C===!0?l.Z_FINISH:l.Z_NO_FLUSH,typeof v=="string"?z.input=a.binstring2buf(v):p.call(v)==="[object ArrayBuffer]"?z.input=new Uint8Array(v):z.input=v,z.next_in=0,z.avail_in=z.input.length;do{if(z.avail_out===0&&(z.output=new s.Buf8(G),z.next_out=0,z.avail_out=G),(w=i.inflate(z,l.Z_NO_FLUSH))===l.Z_NEED_DICT&&U&&(L=typeof U=="string"?a.string2buf(U):p.call(U)==="[object ArrayBuffer]"?new Uint8Array(U):U,w=i.inflateSetDictionary(this.strm,L)),w===l.Z_BUF_ERROR&&j===!0&&(w=l.Z_OK,j=!1),w!==l.Z_STREAM_END&&w!==l.Z_OK)return this.onEnd(w),!(this.ended=!0);z.next_out&&(z.avail_out!==0&&w!==l.Z_STREAM_END&&(z.avail_in!==0||S!==l.Z_FINISH&&S!==l.Z_SYNC_FLUSH)||(this.options.to==="string"?(k=a.utf8border(z.output,z.next_out),b=z.next_out-k,T=a.buf2string(z.output,k),z.next_out=b,z.avail_out=G-b,b&&s.arraySet(z.output,z.output,k,b,0),this.onData(T)):this.onData(s.shrinkBuf(z.output,z.next_out)))),z.avail_in===0&&z.avail_out===0&&(j=!0)}while((0<z.avail_in||z.avail_out===0)&&w!==l.Z_STREAM_END);return w===l.Z_STREAM_END&&(S=l.Z_FINISH),S===l.Z_FINISH?(w=i.inflateEnd(this.strm),this.onEnd(w),this.ended=!0,w===l.Z_OK):S!==l.Z_SYNC_FLUSH||(this.onEnd(l.Z_OK),!(z.avail_out=0))},g.prototype.onData=function(v){this.chunks.push(v)},g.prototype.onEnd=function(v){v===l.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=s.flattenChunks(this.chunks)),this.chunks=[],this.err=v,this.msg=this.strm.msg},o.Inflate=g,o.inflate=m,o.inflateRaw=function(v,C){return(C=C||{}).raw=!0,m(v,C)},o.ungzip=m},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(n,r,o){"use strict";var i=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";o.assign=function(l){for(var u=Array.prototype.slice.call(arguments,1);u.length;){var d=u.shift();if(d){if(typeof d!="object")throw new TypeError(d+"must be non-object");for(var f in d)d.hasOwnProperty(f)&&(l[f]=d[f])}}return l},o.shrinkBuf=function(l,u){return l.length===u?l:l.subarray?l.subarray(0,u):(l.length=u,l)};var s={arraySet:function(l,u,d,f,p){if(u.subarray&&l.subarray)l.set(u.subarray(d,d+f),p);else for(var g=0;g<f;g++)l[p+g]=u[d+g]},flattenChunks:function(l){var u,d,f,p,g,m;for(u=f=0,d=l.length;u<d;u++)f+=l[u].length;for(m=new Uint8Array(f),u=p=0,d=l.length;u<d;u++)g=l[u],m.set(g,p),p+=g.length;return m}},a={arraySet:function(l,u,d,f,p){for(var g=0;g<f;g++)l[p+g]=u[d+g]},flattenChunks:function(l){return[].concat.apply([],l)}};o.setTyped=function(l){l?(o.Buf8=Uint8Array,o.Buf16=Uint16Array,o.Buf32=Int32Array,o.assign(o,s)):(o.Buf8=Array,o.Buf16=Array,o.Buf32=Array,o.assign(o,a))},o.setTyped(i)},{}],42:[function(n,r,o){"use strict";var i=n("./common"),s=!0,a=!0;try{String.fromCharCode.apply(null,[0])}catch{s=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{a=!1}for(var l=new i.Buf8(256),u=0;u<256;u++)l[u]=252<=u?6:248<=u?5:240<=u?4:224<=u?3:192<=u?2:1;function d(f,p){if(p<65537&&(f.subarray&&a||!f.subarray&&s))return String.fromCharCode.apply(null,i.shrinkBuf(f,p));for(var g="",m=0;m<p;m++)g+=String.fromCharCode(f[m]);return g}l[254]=l[254]=1,o.string2buf=function(f){var p,g,m,v,C,w=f.length,S=0;for(v=0;v<w;v++)(64512&(g=f.charCodeAt(v)))==55296&&v+1<w&&(64512&(m=f.charCodeAt(v+1)))==56320&&(g=65536+(g-55296<<10)+(m-56320),v++),S+=g<128?1:g<2048?2:g<65536?3:4;for(p=new i.Buf8(S),v=C=0;C<S;v++)(64512&(g=f.charCodeAt(v)))==55296&&v+1<w&&(64512&(m=f.charCodeAt(v+1)))==56320&&(g=65536+(g-55296<<10)+(m-56320),v++),g<128?p[C++]=g:(g<2048?p[C++]=192|g>>>6:(g<65536?p[C++]=224|g>>>12:(p[C++]=240|g>>>18,p[C++]=128|g>>>12&63),p[C++]=128|g>>>6&63),p[C++]=128|63&g);return p},o.buf2binstring=function(f){return d(f,f.length)},o.binstring2buf=function(f){for(var p=new i.Buf8(f.length),g=0,m=p.length;g<m;g++)p[g]=f.charCodeAt(g);return p},o.buf2string=function(f,p){var g,m,v,C,w=p||f.length,S=new Array(2*w);for(g=m=0;g<w;)if((v=f[g++])<128)S[m++]=v;else if(4<(C=l[v]))S[m++]=65533,g+=C-1;else{for(v&=C===2?31:C===3?15:7;1<C&&g<w;)v=v<<6|63&f[g++],C--;1<C?S[m++]=65533:v<65536?S[m++]=v:(v-=65536,S[m++]=55296|v>>10&1023,S[m++]=56320|1023&v)}return d(S,m)},o.utf8border=function(f,p){var g;for((p=p||f.length)>f.length&&(p=f.length),g=p-1;0<=g&&(192&f[g])==128;)g--;return g<0||g===0?p:g+l[f[g]]>p?g:p}},{"./common":41}],43:[function(n,r,o){"use strict";r.exports=function(i,s,a,l){for(var u=65535&i|0,d=i>>>16&65535|0,f=0;a!==0;){for(a-=f=2e3<a?2e3:a;d=d+(u=u+s[l++]|0)|0,--f;);u%=65521,d%=65521}return u|d<<16|0}},{}],44:[function(n,r,o){"use strict";r.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(n,r,o){"use strict";var i=(function(){for(var s,a=[],l=0;l<256;l++){s=l;for(var u=0;u<8;u++)s=1&s?3988292384^s>>>1:s>>>1;a[l]=s}return a})();r.exports=function(s,a,l,u){var d=i,f=u+l;s^=-1;for(var p=u;p<f;p++)s=s>>>8^d[255&(s^a[p])];return-1^s}},{}],46:[function(n,r,o){"use strict";var i,s=n("../utils/common"),a=n("./trees"),l=n("./adler32"),u=n("./crc32"),d=n("./messages"),f=0,p=4,g=0,m=-2,v=-1,C=4,w=2,S=8,k=9,b=286,T=30,L=19,z=2*b+1,G=15,U=3,j=258,Z=j+U+1,R=42,K=113,x=1,W=2,$=3,J=4;function Q(I,se){return I.msg=d[se],se}function Y(I){return(I<<1)-(4<I?9:0)}function Ce(I){for(var se=I.length;0<=--se;)I[se]=0}function fe(I){var se=I.state,N=se.pending;N>I.avail_out&&(N=I.avail_out),N!==0&&(s.arraySet(I.output,se.pending_buf,se.pending_out,N,I.next_out),I.next_out+=N,se.pending_out+=N,I.total_out+=N,I.avail_out-=N,se.pending-=N,se.pending===0&&(se.pending_out=0))}function ve(I,se){a._tr_flush_block(I,0<=I.block_start?I.block_start:-1,I.strstart-I.block_start,se),I.block_start=I.strstart,fe(I.strm)}function me(I,se){I.pending_buf[I.pending++]=se}function Ee(I,se){I.pending_buf[I.pending++]=se>>>8&255,I.pending_buf[I.pending++]=255&se}function Fe(I,se){var N,q,O=I.max_chain_length,ee=I.strstart,ye=I.prev_length,P=I.nice_match,B=I.strstart>I.w_size-Z?I.strstart-(I.w_size-Z):0,ce=I.window,_e=I.w_mask,Ae=I.prev,De=I.strstart+j,Ye=ce[ee+ye-1],ot=ce[ee+ye];I.prev_length>=I.good_match&&(O>>=2),P>I.lookahead&&(P=I.lookahead);do if(ce[(N=se)+ye]===ot&&ce[N+ye-1]===Ye&&ce[N]===ce[ee]&&ce[++N]===ce[ee+1]){ee+=2,N++;do;while(ce[++ee]===ce[++N]&&ce[++ee]===ce[++N]&&ce[++ee]===ce[++N]&&ce[++ee]===ce[++N]&&ce[++ee]===ce[++N]&&ce[++ee]===ce[++N]&&ce[++ee]===ce[++N]&&ce[++ee]===ce[++N]&&ee<De);if(q=j-(De-ee),ee=De-j,ye<q){if(I.match_start=se,P<=(ye=q))break;Ye=ce[ee+ye-1],ot=ce[ee+ye]}}while((se=Ae[se&_e])>B&&--O!=0);return ye<=I.lookahead?ye:I.lookahead}function Ze(I){var se,N,q,O,ee,ye,P,B,ce,_e,Ae=I.w_size;do{if(O=I.window_size-I.lookahead-I.strstart,I.strstart>=Ae+(Ae-Z)){for(s.arraySet(I.window,I.window,Ae,Ae,0),I.match_start-=Ae,I.strstart-=Ae,I.block_start-=Ae,se=N=I.hash_size;q=I.head[--se],I.head[se]=Ae<=q?q-Ae:0,--N;);for(se=N=Ae;q=I.prev[--se],I.prev[se]=Ae<=q?q-Ae:0,--N;);O+=Ae}if(I.strm.avail_in===0)break;if(ye=I.strm,P=I.window,B=I.strstart+I.lookahead,ce=O,_e=void 0,_e=ye.avail_in,ce<_e&&(_e=ce),N=_e===0?0:(ye.avail_in-=_e,s.arraySet(P,ye.input,ye.next_in,_e,B),ye.state.wrap===1?ye.adler=l(ye.adler,P,_e,B):ye.state.wrap===2&&(ye.adler=u(ye.adler,P,_e,B)),ye.next_in+=_e,ye.total_in+=_e,_e),I.lookahead+=N,I.lookahead+I.insert>=U)for(ee=I.strstart-I.insert,I.ins_h=I.window[ee],I.ins_h=(I.ins_h<<I.hash_shift^I.window[ee+1])&I.hash_mask;I.insert&&(I.ins_h=(I.ins_h<<I.hash_shift^I.window[ee+U-1])&I.hash_mask,I.prev[ee&I.w_mask]=I.head[I.ins_h],I.head[I.ins_h]=ee,ee++,I.insert--,!(I.lookahead+I.insert<U)););}while(I.lookahead<Z&&I.strm.avail_in!==0)}function lt(I,se){for(var N,q;;){if(I.lookahead<Z){if(Ze(I),I.lookahead<Z&&se===f)return x;if(I.lookahead===0)break}if(N=0,I.lookahead>=U&&(I.ins_h=(I.ins_h<<I.hash_shift^I.window[I.strstart+U-1])&I.hash_mask,N=I.prev[I.strstart&I.w_mask]=I.head[I.ins_h],I.head[I.ins_h]=I.strstart),N!==0&&I.strstart-N<=I.w_size-Z&&(I.match_length=Fe(I,N)),I.match_length>=U)if(q=a._tr_tally(I,I.strstart-I.match_start,I.match_length-U),I.lookahead-=I.match_length,I.match_length<=I.max_lazy_match&&I.lookahead>=U){for(I.match_length--;I.strstart++,I.ins_h=(I.ins_h<<I.hash_shift^I.window[I.strstart+U-1])&I.hash_mask,N=I.prev[I.strstart&I.w_mask]=I.head[I.ins_h],I.head[I.ins_h]=I.strstart,--I.match_length!=0;);I.strstart++}else I.strstart+=I.match_length,I.match_length=0,I.ins_h=I.window[I.strstart],I.ins_h=(I.ins_h<<I.hash_shift^I.window[I.strstart+1])&I.hash_mask;else q=a._tr_tally(I,0,I.window[I.strstart]),I.lookahead--,I.strstart++;if(q&&(ve(I,!1),I.strm.avail_out===0))return x}return I.insert=I.strstart<U-1?I.strstart:U-1,se===p?(ve(I,!0),I.strm.avail_out===0?$:J):I.last_lit&&(ve(I,!1),I.strm.avail_out===0)?x:W}function et(I,se){for(var N,q,O;;){if(I.lookahead<Z){if(Ze(I),I.lookahead<Z&&se===f)return x;if(I.lookahead===0)break}if(N=0,I.lookahead>=U&&(I.ins_h=(I.ins_h<<I.hash_shift^I.window[I.strstart+U-1])&I.hash_mask,N=I.prev[I.strstart&I.w_mask]=I.head[I.ins_h],I.head[I.ins_h]=I.strstart),I.prev_length=I.match_length,I.prev_match=I.match_start,I.match_length=U-1,N!==0&&I.prev_length<I.max_lazy_match&&I.strstart-N<=I.w_size-Z&&(I.match_length=Fe(I,N),I.match_length<=5&&(I.strategy===1||I.match_length===U&&4096<I.strstart-I.match_start)&&(I.match_length=U-1)),I.prev_length>=U&&I.match_length<=I.prev_length){for(O=I.strstart+I.lookahead-U,q=a._tr_tally(I,I.strstart-1-I.prev_match,I.prev_length-U),I.lookahead-=I.prev_length-1,I.prev_length-=2;++I.strstart<=O&&(I.ins_h=(I.ins_h<<I.hash_shift^I.window[I.strstart+U-1])&I.hash_mask,N=I.prev[I.strstart&I.w_mask]=I.head[I.ins_h],I.head[I.ins_h]=I.strstart),--I.prev_length!=0;);if(I.match_available=0,I.match_length=U-1,I.strstart++,q&&(ve(I,!1),I.strm.avail_out===0))return x}else if(I.match_available){if((q=a._tr_tally(I,0,I.window[I.strstart-1]))&&ve(I,!1),I.strstart++,I.lookahead--,I.strm.avail_out===0)return x}else I.match_available=1,I.strstart++,I.lookahead--}return I.match_available&&(q=a._tr_tally(I,0,I.window[I.strstart-1]),I.match_available=0),I.insert=I.strstart<U-1?I.strstart:U-1,se===p?(ve(I,!0),I.strm.avail_out===0?$:J):I.last_lit&&(ve(I,!1),I.strm.avail_out===0)?x:W}function Et(I,se,N,q,O){this.good_length=I,this.max_lazy=se,this.nice_length=N,this.max_chain=q,this.func=O}function ae(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=S,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new s.Buf16(2*z),this.dyn_dtree=new s.Buf16(2*(2*T+1)),this.bl_tree=new s.Buf16(2*(2*L+1)),Ce(this.dyn_ltree),Ce(this.dyn_dtree),Ce(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new s.Buf16(G+1),this.heap=new s.Buf16(2*b+1),Ce(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new s.Buf16(2*b+1),Ce(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(I){var se;return I&&I.state?(I.total_in=I.total_out=0,I.data_type=w,(se=I.state).pending=0,se.pending_out=0,se.wrap<0&&(se.wrap=-se.wrap),se.status=se.wrap?R:K,I.adler=se.wrap===2?0:1,se.last_flush=f,a._tr_init(se),g):Q(I,m)}function He(I){var se=Ie(I);return se===g&&(function(N){N.window_size=2*N.w_size,Ce(N.head),N.max_lazy_match=i[N.level].max_lazy,N.good_match=i[N.level].good_length,N.nice_match=i[N.level].nice_length,N.max_chain_length=i[N.level].max_chain,N.strstart=0,N.block_start=0,N.lookahead=0,N.insert=0,N.match_length=N.prev_length=U-1,N.match_available=0,N.ins_h=0})(I.state),se}function re(I,se,N,q,O,ee){if(!I)return m;var ye=1;if(se===v&&(se=6),q<0?(ye=0,q=-q):15<q&&(ye=2,q-=16),O<1||k<O||N!==S||q<8||15<q||se<0||9<se||ee<0||C<ee)return Q(I,m);q===8&&(q=9);var P=new ae;return(I.state=P).strm=I,P.wrap=ye,P.gzhead=null,P.w_bits=q,P.w_size=1<<P.w_bits,P.w_mask=P.w_size-1,P.hash_bits=O+7,P.hash_size=1<<P.hash_bits,P.hash_mask=P.hash_size-1,P.hash_shift=~~((P.hash_bits+U-1)/U),P.window=new s.Buf8(2*P.w_size),P.head=new s.Buf16(P.hash_size),P.prev=new s.Buf16(P.w_size),P.lit_bufsize=1<<O+6,P.pending_buf_size=4*P.lit_bufsize,P.pending_buf=new s.Buf8(P.pending_buf_size),P.d_buf=1*P.lit_bufsize,P.l_buf=3*P.lit_bufsize,P.level=se,P.strategy=ee,P.method=N,He(I)}i=[new Et(0,0,0,0,function(I,se){var N=65535;for(N>I.pending_buf_size-5&&(N=I.pending_buf_size-5);;){if(I.lookahead<=1){if(Ze(I),I.lookahead===0&&se===f)return x;if(I.lookahead===0)break}I.strstart+=I.lookahead,I.lookahead=0;var q=I.block_start+N;if((I.strstart===0||I.strstart>=q)&&(I.lookahead=I.strstart-q,I.strstart=q,ve(I,!1),I.strm.avail_out===0)||I.strstart-I.block_start>=I.w_size-Z&&(ve(I,!1),I.strm.avail_out===0))return x}return I.insert=0,se===p?(ve(I,!0),I.strm.avail_out===0?$:J):(I.strstart>I.block_start&&(ve(I,!1),I.strm.avail_out),x)}),new Et(4,4,8,4,lt),new Et(4,5,16,8,lt),new Et(4,6,32,32,lt),new Et(4,4,16,16,et),new Et(8,16,32,32,et),new Et(8,16,128,128,et),new Et(8,32,128,256,et),new Et(32,128,258,1024,et),new Et(32,258,258,4096,et)],o.deflateInit=function(I,se){return re(I,se,S,15,8,0)},o.deflateInit2=re,o.deflateReset=He,o.deflateResetKeep=Ie,o.deflateSetHeader=function(I,se){return I&&I.state?I.state.wrap!==2?m:(I.state.gzhead=se,g):m},o.deflate=function(I,se){var N,q,O,ee;if(!I||!I.state||5<se||se<0)return I?Q(I,m):m;if(q=I.state,!I.output||!I.input&&I.avail_in!==0||q.status===666&&se!==p)return Q(I,I.avail_out===0?-5:m);if(q.strm=I,N=q.last_flush,q.last_flush=se,q.status===R)if(q.wrap===2)I.adler=0,me(q,31),me(q,139),me(q,8),q.gzhead?(me(q,(q.gzhead.text?1:0)+(q.gzhead.hcrc?2:0)+(q.gzhead.extra?4:0)+(q.gzhead.name?8:0)+(q.gzhead.comment?16:0)),me(q,255&q.gzhead.time),me(q,q.gzhead.time>>8&255),me(q,q.gzhead.time>>16&255),me(q,q.gzhead.time>>24&255),me(q,q.level===9?2:2<=q.strategy||q.level<2?4:0),me(q,255&q.gzhead.os),q.gzhead.extra&&q.gzhead.extra.length&&(me(q,255&q.gzhead.extra.length),me(q,q.gzhead.extra.length>>8&255)),q.gzhead.hcrc&&(I.adler=u(I.adler,q.pending_buf,q.pending,0)),q.gzindex=0,q.status=69):(me(q,0),me(q,0),me(q,0),me(q,0),me(q,0),me(q,q.level===9?2:2<=q.strategy||q.level<2?4:0),me(q,3),q.status=K);else{var ye=S+(q.w_bits-8<<4)<<8;ye|=(2<=q.strategy||q.level<2?0:q.level<6?1:q.level===6?2:3)<<6,q.strstart!==0&&(ye|=32),ye+=31-ye%31,q.status=K,Ee(q,ye),q.strstart!==0&&(Ee(q,I.adler>>>16),Ee(q,65535&I.adler)),I.adler=1}if(q.status===69)if(q.gzhead.extra){for(O=q.pending;q.gzindex<(65535&q.gzhead.extra.length)&&(q.pending!==q.pending_buf_size||(q.gzhead.hcrc&&q.pending>O&&(I.adler=u(I.adler,q.pending_buf,q.pending-O,O)),fe(I),O=q.pending,q.pending!==q.pending_buf_size));)me(q,255&q.gzhead.extra[q.gzindex]),q.gzindex++;q.gzhead.hcrc&&q.pending>O&&(I.adler=u(I.adler,q.pending_buf,q.pending-O,O)),q.gzindex===q.gzhead.extra.length&&(q.gzindex=0,q.status=73)}else q.status=73;if(q.status===73)if(q.gzhead.name){O=q.pending;do{if(q.pending===q.pending_buf_size&&(q.gzhead.hcrc&&q.pending>O&&(I.adler=u(I.adler,q.pending_buf,q.pending-O,O)),fe(I),O=q.pending,q.pending===q.pending_buf_size)){ee=1;break}ee=q.gzindex<q.gzhead.name.length?255&q.gzhead.name.charCodeAt(q.gzindex++):0,me(q,ee)}while(ee!==0);q.gzhead.hcrc&&q.pending>O&&(I.adler=u(I.adler,q.pending_buf,q.pending-O,O)),ee===0&&(q.gzindex=0,q.status=91)}else q.status=91;if(q.status===91)if(q.gzhead.comment){O=q.pending;do{if(q.pending===q.pending_buf_size&&(q.gzhead.hcrc&&q.pending>O&&(I.adler=u(I.adler,q.pending_buf,q.pending-O,O)),fe(I),O=q.pending,q.pending===q.pending_buf_size)){ee=1;break}ee=q.gzindex<q.gzhead.comment.length?255&q.gzhead.comment.charCodeAt(q.gzindex++):0,me(q,ee)}while(ee!==0);q.gzhead.hcrc&&q.pending>O&&(I.adler=u(I.adler,q.pending_buf,q.pending-O,O)),ee===0&&(q.status=103)}else q.status=103;if(q.status===103&&(q.gzhead.hcrc?(q.pending+2>q.pending_buf_size&&fe(I),q.pending+2<=q.pending_buf_size&&(me(q,255&I.adler),me(q,I.adler>>8&255),I.adler=0,q.status=K)):q.status=K),q.pending!==0){if(fe(I),I.avail_out===0)return q.last_flush=-1,g}else if(I.avail_in===0&&Y(se)<=Y(N)&&se!==p)return Q(I,-5);if(q.status===666&&I.avail_in!==0)return Q(I,-5);if(I.avail_in!==0||q.lookahead!==0||se!==f&&q.status!==666){var P=q.strategy===2?(function(B,ce){for(var _e;;){if(B.lookahead===0&&(Ze(B),B.lookahead===0)){if(ce===f)return x;break}if(B.match_length=0,_e=a._tr_tally(B,0,B.window[B.strstart]),B.lookahead--,B.strstart++,_e&&(ve(B,!1),B.strm.avail_out===0))return x}return B.insert=0,ce===p?(ve(B,!0),B.strm.avail_out===0?$:J):B.last_lit&&(ve(B,!1),B.strm.avail_out===0)?x:W})(q,se):q.strategy===3?(function(B,ce){for(var _e,Ae,De,Ye,ot=B.window;;){if(B.lookahead<=j){if(Ze(B),B.lookahead<=j&&ce===f)return x;if(B.lookahead===0)break}if(B.match_length=0,B.lookahead>=U&&0<B.strstart&&(Ae=ot[De=B.strstart-1])===ot[++De]&&Ae===ot[++De]&&Ae===ot[++De]){Ye=B.strstart+j;do;while(Ae===ot[++De]&&Ae===ot[++De]&&Ae===ot[++De]&&Ae===ot[++De]&&Ae===ot[++De]&&Ae===ot[++De]&&Ae===ot[++De]&&Ae===ot[++De]&&De<Ye);B.match_length=j-(Ye-De),B.match_length>B.lookahead&&(B.match_length=B.lookahead)}if(B.match_length>=U?(_e=a._tr_tally(B,1,B.match_length-U),B.lookahead-=B.match_length,B.strstart+=B.match_length,B.match_length=0):(_e=a._tr_tally(B,0,B.window[B.strstart]),B.lookahead--,B.strstart++),_e&&(ve(B,!1),B.strm.avail_out===0))return x}return B.insert=0,ce===p?(ve(B,!0),B.strm.avail_out===0?$:J):B.last_lit&&(ve(B,!1),B.strm.avail_out===0)?x:W})(q,se):i[q.level].func(q,se);if(P!==$&&P!==J||(q.status=666),P===x||P===$)return I.avail_out===0&&(q.last_flush=-1),g;if(P===W&&(se===1?a._tr_align(q):se!==5&&(a._tr_stored_block(q,0,0,!1),se===3&&(Ce(q.head),q.lookahead===0&&(q.strstart=0,q.block_start=0,q.insert=0))),fe(I),I.avail_out===0))return q.last_flush=-1,g}return se!==p?g:q.wrap<=0?1:(q.wrap===2?(me(q,255&I.adler),me(q,I.adler>>8&255),me(q,I.adler>>16&255),me(q,I.adler>>24&255),me(q,255&I.total_in),me(q,I.total_in>>8&255),me(q,I.total_in>>16&255),me(q,I.total_in>>24&255)):(Ee(q,I.adler>>>16),Ee(q,65535&I.adler)),fe(I),0<q.wrap&&(q.wrap=-q.wrap),q.pending!==0?g:1)},o.deflateEnd=function(I){var se;return I&&I.state?(se=I.state.status)!==R&&se!==69&&se!==73&&se!==91&&se!==103&&se!==K&&se!==666?Q(I,m):(I.state=null,se===K?Q(I,-3):g):m},o.deflateSetDictionary=function(I,se){var N,q,O,ee,ye,P,B,ce,_e=se.length;if(!I||!I.state||(ee=(N=I.state).wrap)===2||ee===1&&N.status!==R||N.lookahead)return m;for(ee===1&&(I.adler=l(I.adler,se,_e,0)),N.wrap=0,_e>=N.w_size&&(ee===0&&(Ce(N.head),N.strstart=0,N.block_start=0,N.insert=0),ce=new s.Buf8(N.w_size),s.arraySet(ce,se,_e-N.w_size,N.w_size,0),se=ce,_e=N.w_size),ye=I.avail_in,P=I.next_in,B=I.input,I.avail_in=_e,I.next_in=0,I.input=se,Ze(N);N.lookahead>=U;){for(q=N.strstart,O=N.lookahead-(U-1);N.ins_h=(N.ins_h<<N.hash_shift^N.window[q+U-1])&N.hash_mask,N.prev[q&N.w_mask]=N.head[N.ins_h],N.head[N.ins_h]=q,q++,--O;);N.strstart=q,N.lookahead=U-1,Ze(N)}return N.strstart+=N.lookahead,N.block_start=N.strstart,N.insert=N.lookahead,N.lookahead=0,N.match_length=N.prev_length=U-1,N.match_available=0,I.next_in=P,I.input=B,I.avail_in=ye,N.wrap=ee,g},o.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(n,r,o){"use strict";r.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(n,r,o){"use strict";r.exports=function(i,s){var a=i.state,l=i.next_in,u,d,f,p,g,m,v,C,w,S,k,b,T,L,z,G,U,j,Z,R,K,x=i.input,W;u=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,C=a.wnext,w=a.window,S=a.hold,k=a.bits,b=a.lencode,T=a.distcode,L=(1<<a.lenbits)-1,z=(1<<a.distbits)-1;e:do{k<15&&(S+=x[l++]<<k,k+=8,S+=x[l++]<<k,k+=8),G=b[S&L];t:for(;;){if(S>>>=U=G>>>24,k-=U,(U=G>>>16&255)===0)W[d++]=65535&G;else{if(!(16&U)){if((64&U)==0){G=b[(65535&G)+(S&(1<<U)-1)];continue t}if(32&U){a.mode=12;break e}i.msg="invalid literal/length code",a.mode=30;break e}j=65535&G,(U&=15)&&(k<U&&(S+=x[l++]<<k,k+=8),j+=S&(1<<U)-1,S>>>=U,k-=U),k<15&&(S+=x[l++]<<k,k+=8,S+=x[l++]<<k,k+=8),G=T[S&z];n:for(;;){if(S>>>=U=G>>>24,k-=U,!(16&(U=G>>>16&255))){if((64&U)==0){G=T[(65535&G)+(S&(1<<U)-1)];continue n}i.msg="invalid distance code",a.mode=30;break e}if(Z=65535&G,k<(U&=15)&&(S+=x[l++]<<k,(k+=8)<U&&(S+=x[l++]<<k,k+=8)),g<(Z+=S&(1<<U)-1)){i.msg="invalid distance too far back",a.mode=30;break e}if(S>>>=U,k-=U,(U=d-f)<Z){if(v<(U=Z-U)&&a.sane){i.msg="invalid distance too far back",a.mode=30;break e}if(K=w,(R=0)===C){if(R+=m-U,U<j){for(j-=U;W[d++]=w[R++],--U;);R=d-Z,K=W}}else if(C<U){if(R+=m+C-U,(U-=C)<j){for(j-=U;W[d++]=w[R++],--U;);if(R=0,C<j){for(j-=U=C;W[d++]=w[R++],--U;);R=d-Z,K=W}}}else if(R+=C-U,U<j){for(j-=U;W[d++]=w[R++],--U;);R=d-Z,K=W}for(;2<j;)W[d++]=K[R++],W[d++]=K[R++],W[d++]=K[R++],j-=3;j&&(W[d++]=K[R++],1<j&&(W[d++]=K[R++]))}else{for(R=d-Z;W[d++]=W[R++],W[d++]=W[R++],W[d++]=W[R++],2<(j-=3););j&&(W[d++]=W[R++],1<j&&(W[d++]=W[R++]))}break}}break}}while(l<u&&d<p);l-=j=k>>3,S&=(1<<(k-=j<<3))-1,i.next_in=l,i.next_out=d,i.avail_in=l<u?u-l+5:5-(l-u),i.avail_out=d<p?p-d+257:257-(d-p),a.hold=S,a.bits=k}},{}],49:[function(n,r,o){"use strict";var i=n("../utils/common"),s=n("./adler32"),a=n("./crc32"),l=n("./inffast"),u=n("./inftrees"),d=1,f=2,p=0,g=-2,m=1,v=852,C=592;function w(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 k(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(C),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,k(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 z,G,U=!0;function j(R){if(U){var K;for(z=new i.Buf32(512),G=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(u(d,R.lens,0,288,z,0,R.work,{bits:9}),K=0;K<32;)R.lens[K++]=5;u(f,R.lens,0,32,G,0,R.work,{bits:5}),U=!1}R.lencode=z,R.lenbits=9,R.distcode=G,R.distbits=5}function Z(R,K,x,W){var $,J=R.state;return J.window===null&&(J.wsize=1<<J.wbits,J.wnext=0,J.whave=0,J.window=new i.Buf8(J.wsize)),W>=J.wsize?(i.arraySet(J.window,K,x-J.wsize,J.wsize,0),J.wnext=0,J.whave=J.wsize):(W<($=J.wsize-J.wnext)&&($=W),i.arraySet(J.window,K,x-W,$,J.wnext),(W-=$)?(i.arraySet(J.window,K,x-W,W,0),J.wnext=W,J.whave=J.wsize):(J.wnext+=$,J.wnext===J.wsize&&(J.wnext=0),J.whave<J.wsize&&(J.whave+=$))),0}o.inflateReset=b,o.inflateReset2=T,o.inflateResetKeep=k,o.inflateInit=function(R){return L(R,15)},o.inflateInit2=L,o.inflate=function(R,K){var x,W,$,J,Q,Y,Ce,fe,ve,me,Ee,Fe,Ze,lt,et,Et,ae,Ie,He,re,I,se,N,q,O=0,ee=new i.Buf8(4),ye=[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,Ce=R.avail_out,J=R.next_in,W=R.input,Y=R.avail_in,fe=x.hold,ve=x.bits,me=Y,Ee=Ce,se=p;e:for(;;)switch(x.mode){case m:if(x.wrap===0){x.mode=13;break}for(;ve<16;){if(Y===0)break e;Y--,fe+=W[J++]<<ve,ve+=8}if(2&x.wrap&&fe===35615){ee[x.check=0]=255&fe,ee[1]=fe>>>8&255,x.check=a(x.check,ee,2,0),ve=fe=0,x.mode=2;break}if(x.flags=0,x.head&&(x.head.done=!1),!(1&x.wrap)||(((255&fe)<<8)+(fe>>8))%31){R.msg="incorrect header check",x.mode=30;break}if((15&fe)!=8){R.msg="unknown compression method",x.mode=30;break}if(ve-=4,I=8+(15&(fe>>>=4)),x.wbits===0)x.wbits=I;else if(I>x.wbits){R.msg="invalid window size",x.mode=30;break}x.dmax=1<<I,R.adler=x.check=1,x.mode=512&fe?10:12,ve=fe=0;break;case 2:for(;ve<16;){if(Y===0)break e;Y--,fe+=W[J++]<<ve,ve+=8}if(x.flags=fe,(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=fe>>8&1),512&x.flags&&(ee[0]=255&fe,ee[1]=fe>>>8&255,x.check=a(x.check,ee,2,0)),ve=fe=0,x.mode=3;case 3:for(;ve<32;){if(Y===0)break e;Y--,fe+=W[J++]<<ve,ve+=8}x.head&&(x.head.time=fe),512&x.flags&&(ee[0]=255&fe,ee[1]=fe>>>8&255,ee[2]=fe>>>16&255,ee[3]=fe>>>24&255,x.check=a(x.check,ee,4,0)),ve=fe=0,x.mode=4;case 4:for(;ve<16;){if(Y===0)break e;Y--,fe+=W[J++]<<ve,ve+=8}x.head&&(x.head.xflags=255&fe,x.head.os=fe>>8),512&x.flags&&(ee[0]=255&fe,ee[1]=fe>>>8&255,x.check=a(x.check,ee,2,0)),ve=fe=0,x.mode=5;case 5:if(1024&x.flags){for(;ve<16;){if(Y===0)break e;Y--,fe+=W[J++]<<ve,ve+=8}x.length=fe,x.head&&(x.head.extra_len=fe),512&x.flags&&(ee[0]=255&fe,ee[1]=fe>>>8&255,x.check=a(x.check,ee,2,0)),ve=fe=0}else x.head&&(x.head.extra=null);x.mode=6;case 6:if(1024&x.flags&&(Y<(Fe=x.length)&&(Fe=Y),Fe&&(x.head&&(I=x.head.extra_len-x.length,x.head.extra||(x.head.extra=new Array(x.head.extra_len)),i.arraySet(x.head.extra,W,J,Fe,I)),512&x.flags&&(x.check=a(x.check,W,Fe,J)),Y-=Fe,J+=Fe,x.length-=Fe),x.length))break e;x.length=0,x.mode=7;case 7:if(2048&x.flags){if(Y===0)break e;for(Fe=0;I=W[J+Fe++],x.head&&I&&x.length<65536&&(x.head.name+=String.fromCharCode(I)),I&&Fe<Y;);if(512&x.flags&&(x.check=a(x.check,W,Fe,J)),Y-=Fe,J+=Fe,I)break e}else x.head&&(x.head.name=null);x.length=0,x.mode=8;case 8:if(4096&x.flags){if(Y===0)break e;for(Fe=0;I=W[J+Fe++],x.head&&I&&x.length<65536&&(x.head.comment+=String.fromCharCode(I)),I&&Fe<Y;);if(512&x.flags&&(x.check=a(x.check,W,Fe,J)),Y-=Fe,J+=Fe,I)break e}else x.head&&(x.head.comment=null);x.mode=9;case 9:if(512&x.flags){for(;ve<16;){if(Y===0)break e;Y--,fe+=W[J++]<<ve,ve+=8}if(fe!==(65535&x.check)){R.msg="header crc mismatch",x.mode=30;break}ve=fe=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(;ve<32;){if(Y===0)break e;Y--,fe+=W[J++]<<ve,ve+=8}R.adler=x.check=w(fe),ve=fe=0,x.mode=11;case 11:if(x.havedict===0)return R.next_out=Q,R.avail_out=Ce,R.next_in=J,R.avail_in=Y,x.hold=fe,x.bits=ve,2;R.adler=x.check=1,x.mode=12;case 12:if(K===5||K===6)break e;case 13:if(x.last){fe>>>=7&ve,ve-=7&ve,x.mode=27;break}for(;ve<3;){if(Y===0)break e;Y--,fe+=W[J++]<<ve,ve+=8}switch(x.last=1&fe,ve-=1,3&(fe>>>=1)){case 0:x.mode=14;break;case 1:if(j(x),x.mode=20,K!==6)break;fe>>>=2,ve-=2;break e;case 2:x.mode=17;break;case 3:R.msg="invalid block type",x.mode=30}fe>>>=2,ve-=2;break;case 14:for(fe>>>=7&ve,ve-=7&ve;ve<32;){if(Y===0)break e;Y--,fe+=W[J++]<<ve,ve+=8}if((65535&fe)!=(fe>>>16^65535)){R.msg="invalid stored block lengths",x.mode=30;break}if(x.length=65535&fe,ve=fe=0,x.mode=15,K===6)break e;case 15:x.mode=16;case 16:if(Fe=x.length){if(Y<Fe&&(Fe=Y),Ce<Fe&&(Fe=Ce),Fe===0)break e;i.arraySet($,W,J,Fe,Q),Y-=Fe,J+=Fe,Ce-=Fe,Q+=Fe,x.length-=Fe;break}x.mode=12;break;case 17:for(;ve<14;){if(Y===0)break e;Y--,fe+=W[J++]<<ve,ve+=8}if(x.nlen=257+(31&fe),fe>>>=5,ve-=5,x.ndist=1+(31&fe),fe>>>=5,ve-=5,x.ncode=4+(15&fe),fe>>>=4,ve-=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(;ve<3;){if(Y===0)break e;Y--,fe+=W[J++]<<ve,ve+=8}x.lens[ye[x.have++]]=7&fe,fe>>>=3,ve-=3}for(;x.have<19;)x.lens[ye[x.have++]]=0;if(x.lencode=x.lendyn,x.lenbits=7,N={bits:x.lenbits},se=u(0,x.lens,0,19,x.lencode,0,x.work,N),x.lenbits=N.bits,se){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(;Et=(O=x.lencode[fe&(1<<x.lenbits)-1])>>>16&255,ae=65535&O,!((et=O>>>24)<=ve);){if(Y===0)break e;Y--,fe+=W[J++]<<ve,ve+=8}if(ae<16)fe>>>=et,ve-=et,x.lens[x.have++]=ae;else{if(ae===16){for(q=et+2;ve<q;){if(Y===0)break e;Y--,fe+=W[J++]<<ve,ve+=8}if(fe>>>=et,ve-=et,x.have===0){R.msg="invalid bit length repeat",x.mode=30;break}I=x.lens[x.have-1],Fe=3+(3&fe),fe>>>=2,ve-=2}else if(ae===17){for(q=et+3;ve<q;){if(Y===0)break e;Y--,fe+=W[J++]<<ve,ve+=8}ve-=et,I=0,Fe=3+(7&(fe>>>=et)),fe>>>=3,ve-=3}else{for(q=et+7;ve<q;){if(Y===0)break e;Y--,fe+=W[J++]<<ve,ve+=8}ve-=et,I=0,Fe=11+(127&(fe>>>=et)),fe>>>=7,ve-=7}if(x.have+Fe>x.nlen+x.ndist){R.msg="invalid bit length repeat",x.mode=30;break}for(;Fe--;)x.lens[x.have++]=I}}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,N={bits:x.lenbits},se=u(d,x.lens,0,x.nlen,x.lencode,0,x.work,N),x.lenbits=N.bits,se){R.msg="invalid literal/lengths set",x.mode=30;break}if(x.distbits=6,x.distcode=x.distdyn,N={bits:x.distbits},se=u(f,x.lens,x.nlen,x.ndist,x.distcode,0,x.work,N),x.distbits=N.bits,se){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<=Y&&258<=Ce){R.next_out=Q,R.avail_out=Ce,R.next_in=J,R.avail_in=Y,x.hold=fe,x.bits=ve,l(R,Ee),Q=R.next_out,$=R.output,Ce=R.avail_out,J=R.next_in,W=R.input,Y=R.avail_in,fe=x.hold,ve=x.bits,x.mode===12&&(x.back=-1);break}for(x.back=0;Et=(O=x.lencode[fe&(1<<x.lenbits)-1])>>>16&255,ae=65535&O,!((et=O>>>24)<=ve);){if(Y===0)break e;Y--,fe+=W[J++]<<ve,ve+=8}if(Et&&(240&Et)==0){for(Ie=et,He=Et,re=ae;Et=(O=x.lencode[re+((fe&(1<<Ie+He)-1)>>Ie)])>>>16&255,ae=65535&O,!(Ie+(et=O>>>24)<=ve);){if(Y===0)break e;Y--,fe+=W[J++]<<ve,ve+=8}fe>>>=Ie,ve-=Ie,x.back+=Ie}if(fe>>>=et,ve-=et,x.back+=et,x.length=ae,Et===0){x.mode=26;break}if(32&Et){x.back=-1,x.mode=12;break}if(64&Et){R.msg="invalid literal/length code",x.mode=30;break}x.extra=15&Et,x.mode=22;case 22:if(x.extra){for(q=x.extra;ve<q;){if(Y===0)break e;Y--,fe+=W[J++]<<ve,ve+=8}x.length+=fe&(1<<x.extra)-1,fe>>>=x.extra,ve-=x.extra,x.back+=x.extra}x.was=x.length,x.mode=23;case 23:for(;Et=(O=x.distcode[fe&(1<<x.distbits)-1])>>>16&255,ae=65535&O,!((et=O>>>24)<=ve);){if(Y===0)break e;Y--,fe+=W[J++]<<ve,ve+=8}if((240&Et)==0){for(Ie=et,He=Et,re=ae;Et=(O=x.distcode[re+((fe&(1<<Ie+He)-1)>>Ie)])>>>16&255,ae=65535&O,!(Ie+(et=O>>>24)<=ve);){if(Y===0)break e;Y--,fe+=W[J++]<<ve,ve+=8}fe>>>=Ie,ve-=Ie,x.back+=Ie}if(fe>>>=et,ve-=et,x.back+=et,64&Et){R.msg="invalid distance code",x.mode=30;break}x.offset=ae,x.extra=15&Et,x.mode=24;case 24:if(x.extra){for(q=x.extra;ve<q;){if(Y===0)break e;Y--,fe+=W[J++]<<ve,ve+=8}x.offset+=fe&(1<<x.extra)-1,fe>>>=x.extra,ve-=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(Ce===0)break e;if(Fe=Ee-Ce,x.offset>Fe){if((Fe=x.offset-Fe)>x.whave&&x.sane){R.msg="invalid distance too far back",x.mode=30;break}Ze=Fe>x.wnext?(Fe-=x.wnext,x.wsize-Fe):x.wnext-Fe,Fe>x.length&&(Fe=x.length),lt=x.window}else lt=$,Ze=Q-x.offset,Fe=x.length;for(Ce<Fe&&(Fe=Ce),Ce-=Fe,x.length-=Fe;$[Q++]=lt[Ze++],--Fe;);x.length===0&&(x.mode=21);break;case 26:if(Ce===0)break e;$[Q++]=x.length,Ce--,x.mode=21;break;case 27:if(x.wrap){for(;ve<32;){if(Y===0)break e;Y--,fe|=W[J++]<<ve,ve+=8}if(Ee-=Ce,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=Ce,(x.flags?fe:w(fe))!==x.check){R.msg="incorrect data check",x.mode=30;break}ve=fe=0}x.mode=28;case 28:if(x.wrap&&x.flags){for(;ve<32;){if(Y===0)break e;Y--,fe+=W[J++]<<ve,ve+=8}if(fe!==(4294967295&x.total)){R.msg="incorrect length check",x.mode=30;break}ve=fe=0}x.mode=29;case 29:se=1;break e;case 30:se=-3;break e;case 31:return-4;default:return g}return R.next_out=Q,R.avail_out=Ce,R.next_in=J,R.avail_in=Y,x.hold=fe,x.bits=ve,(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):(me-=R.avail_in,Ee-=R.avail_out,R.total_in+=me,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),(me==0&&Ee===0||K===4)&&se===p&&(se=-5),se)},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],u=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];r.exports=function(d,f,p,g,m,v,C,w){var S,k,b,T,L,z,G,U,j,Z=w.bits,R=0,K=0,x=0,W=0,$=0,J=0,Q=0,Y=0,Ce=0,fe=0,ve=null,me=0,Ee=new i.Buf16(16),Fe=new i.Buf16(16),Ze=null,lt=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,w.bits=1,0;for(x=1;x<W&&Ee[x]===0;x++);for($<x&&($=x),R=Y=1;R<=15;R++)if(Y<<=1,(Y-=Ee[R])<0)return-1;if(0<Y&&(d===0||W!==1))return-1;for(Fe[1]=0,R=1;R<15;R++)Fe[R+1]=Fe[R]+Ee[R];for(K=0;K<g;K++)f[p+K]!==0&&(C[Fe[f[p+K]]++]=K);if(z=d===0?(ve=Ze=C,19):d===1?(ve=s,me-=257,Ze=a,lt-=257,256):(ve=l,Ze=u,-1),R=x,L=v,Q=K=fe=0,b=-1,T=(Ce=1<<(J=$))-1,d===1&&852<Ce||d===2&&592<Ce)return 1;for(;;){for(G=R-Q,j=C[K]<z?(U=0,C[K]):C[K]>z?(U=Ze[lt+C[K]],ve[me+C[K]]):(U=96,0),S=1<<R-Q,x=k=1<<J;m[L+(fe>>Q)+(k-=S)]=G<<24|U<<16|j|0,k!==0;);for(S=1<<R-1;fe&S;)S>>=1;if(S!==0?(fe&=S-1,fe+=S):fe=0,K++,--Ee[R]==0){if(R===W)break;R=f[p+C[K]]}if($<R&&(fe&T)!==b){for(Q===0&&(Q=$),L+=x,Y=1<<(J=R-Q);J+Q<W&&!((Y-=Ee[J+Q])<=0);)J++,Y<<=1;if(Ce+=1<<J,d===1&&852<Ce||d===2&&592<Ce)return 1;m[b=fe&T]=$<<24|J<<16|L-v|0}}return fe!==0&&(m[L+fe]=R-Q<<24|4194304),w.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 ee=O.length;0<=--ee;)O[ee]=0}var u=0,d=29,f=256,p=f+1+d,g=30,m=19,v=2*p+1,C=15,w=16,S=7,k=256,b=16,T=17,L=18,z=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],G=[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],U=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],j=[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 $,J,Q,Y=new Array(g);function Ce(O,ee,ye,P,B){this.static_tree=O,this.extra_bits=ee,this.extra_base=ye,this.elems=P,this.max_length=B,this.has_stree=O&&O.length}function fe(O,ee){this.dyn_tree=O,this.max_code=0,this.stat_desc=ee}function ve(O){return O<256?K[O]:K[256+(O>>>7)]}function me(O,ee){O.pending_buf[O.pending++]=255&ee,O.pending_buf[O.pending++]=ee>>>8&255}function Ee(O,ee,ye){O.bi_valid>w-ye?(O.bi_buf|=ee<<O.bi_valid&65535,me(O,O.bi_buf),O.bi_buf=ee>>w-O.bi_valid,O.bi_valid+=ye-w):(O.bi_buf|=ee<<O.bi_valid&65535,O.bi_valid+=ye)}function Fe(O,ee,ye){Ee(O,ye[2*ee],ye[2*ee+1])}function Ze(O,ee){for(var ye=0;ye|=1&O,O>>>=1,ye<<=1,0<--ee;);return ye>>>1}function lt(O,ee,ye){var P,B,ce=new Array(C+1),_e=0;for(P=1;P<=C;P++)ce[P]=_e=_e+ye[P-1]<<1;for(B=0;B<=ee;B++){var Ae=O[2*B+1];Ae!==0&&(O[2*B]=Ze(ce[Ae]++,Ae))}}function et(O){var ee;for(ee=0;ee<p;ee++)O.dyn_ltree[2*ee]=0;for(ee=0;ee<g;ee++)O.dyn_dtree[2*ee]=0;for(ee=0;ee<m;ee++)O.bl_tree[2*ee]=0;O.dyn_ltree[2*k]=1,O.opt_len=O.static_len=0,O.last_lit=O.matches=0}function Et(O){8<O.bi_valid?me(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 ae(O,ee,ye,P){var B=2*ee,ce=2*ye;return O[B]<O[ce]||O[B]===O[ce]&&P[ee]<=P[ye]}function Ie(O,ee,ye){for(var P=O.heap[ye],B=ye<<1;B<=O.heap_len&&(B<O.heap_len&&ae(ee,O.heap[B+1],O.heap[B],O.depth)&&B++,!ae(ee,P,O.heap[B],O.depth));)O.heap[ye]=O.heap[B],ye=B,B<<=1;O.heap[ye]=P}function He(O,ee,ye){var P,B,ce,_e,Ae=0;if(O.last_lit!==0)for(;P=O.pending_buf[O.d_buf+2*Ae]<<8|O.pending_buf[O.d_buf+2*Ae+1],B=O.pending_buf[O.l_buf+Ae],Ae++,P===0?Fe(O,B,ee):(Fe(O,(ce=x[B])+f+1,ee),(_e=z[ce])!==0&&Ee(O,B-=W[ce],_e),Fe(O,ce=ve(--P),ye),(_e=G[ce])!==0&&Ee(O,P-=Y[ce],_e)),Ae<O.last_lit;);Fe(O,k,ee)}function re(O,ee){var ye,P,B,ce=ee.dyn_tree,_e=ee.stat_desc.static_tree,Ae=ee.stat_desc.has_stree,De=ee.stat_desc.elems,Ye=-1;for(O.heap_len=0,O.heap_max=v,ye=0;ye<De;ye++)ce[2*ye]!==0?(O.heap[++O.heap_len]=Ye=ye,O.depth[ye]=0):ce[2*ye+1]=0;for(;O.heap_len<2;)ce[2*(B=O.heap[++O.heap_len]=Ye<2?++Ye:0)]=1,O.depth[B]=0,O.opt_len--,Ae&&(O.static_len-=_e[2*B+1]);for(ee.max_code=Ye,ye=O.heap_len>>1;1<=ye;ye--)Ie(O,ce,ye);for(B=De;ye=O.heap[1],O.heap[1]=O.heap[O.heap_len--],Ie(O,ce,1),P=O.heap[1],O.heap[--O.heap_max]=ye,O.heap[--O.heap_max]=P,ce[2*B]=ce[2*ye]+ce[2*P],O.depth[B]=(O.depth[ye]>=O.depth[P]?O.depth[ye]:O.depth[P])+1,ce[2*ye+1]=ce[2*P+1]=B,O.heap[1]=B++,Ie(O,ce,1),2<=O.heap_len;);O.heap[--O.heap_max]=O.heap[1],(function(ot,gt){var xt,Tt,$t,je,rn,Un,jt=gt.dyn_tree,En=gt.max_code,Gr=gt.stat_desc.static_tree,br=gt.stat_desc.has_stree,Ir=gt.stat_desc.extra_bits,Qe=gt.stat_desc.extra_base,wt=gt.stat_desc.max_length,Pt=0;for(je=0;je<=C;je++)ot.bl_count[je]=0;for(jt[2*ot.heap[ot.heap_max]+1]=0,xt=ot.heap_max+1;xt<v;xt++)wt<(je=jt[2*jt[2*(Tt=ot.heap[xt])+1]+1]+1)&&(je=wt,Pt++),jt[2*Tt+1]=je,En<Tt||(ot.bl_count[je]++,rn=0,Qe<=Tt&&(rn=Ir[Tt-Qe]),Un=jt[2*Tt],ot.opt_len+=Un*(je+rn),br&&(ot.static_len+=Un*(Gr[2*Tt+1]+rn)));if(Pt!==0){do{for(je=wt-1;ot.bl_count[je]===0;)je--;ot.bl_count[je]--,ot.bl_count[je+1]+=2,ot.bl_count[wt]--,Pt-=2}while(0<Pt);for(je=wt;je!==0;je--)for(Tt=ot.bl_count[je];Tt!==0;)En<($t=ot.heap[--xt])||(jt[2*$t+1]!==je&&(ot.opt_len+=(je-jt[2*$t+1])*jt[2*$t],jt[2*$t+1]=je),Tt--)}})(O,ee),lt(ce,Ye,O.bl_count)}function I(O,ee,ye){var P,B,ce=-1,_e=ee[1],Ae=0,De=7,Ye=4;for(_e===0&&(De=138,Ye=3),ee[2*(ye+1)+1]=65535,P=0;P<=ye;P++)B=_e,_e=ee[2*(P+1)+1],++Ae<De&&B===_e||(Ae<Ye?O.bl_tree[2*B]+=Ae:B!==0?(B!==ce&&O.bl_tree[2*B]++,O.bl_tree[2*b]++):Ae<=10?O.bl_tree[2*T]++:O.bl_tree[2*L]++,ce=B,Ye=(Ae=0)===_e?(De=138,3):B===_e?(De=6,3):(De=7,4))}function se(O,ee,ye){var P,B,ce=-1,_e=ee[1],Ae=0,De=7,Ye=4;for(_e===0&&(De=138,Ye=3),P=0;P<=ye;P++)if(B=_e,_e=ee[2*(P+1)+1],!(++Ae<De&&B===_e)){if(Ae<Ye)for(;Fe(O,B,O.bl_tree),--Ae!=0;);else B!==0?(B!==ce&&(Fe(O,B,O.bl_tree),Ae--),Fe(O,b,O.bl_tree),Ee(O,Ae-3,2)):Ae<=10?(Fe(O,T,O.bl_tree),Ee(O,Ae-3,3)):(Fe(O,L,O.bl_tree),Ee(O,Ae-11,7));ce=B,Ye=(Ae=0)===_e?(De=138,3):B===_e?(De=6,3):(De=7,4)}}l(Y);var N=!1;function q(O,ee,ye,P){Ee(O,(u<<1)+(P?1:0),3),(function(B,ce,_e,Ae){Et(B),Ae&&(me(B,_e),me(B,~_e)),i.arraySet(B.pending_buf,B.window,ce,_e,B.pending),B.pending+=_e})(O,ee,ye,!0)}o._tr_init=function(O){N||((function(){var ee,ye,P,B,ce,_e=new Array(C+1);for(B=P=0;B<d-1;B++)for(W[B]=P,ee=0;ee<1<<z[B];ee++)x[P++]=B;for(x[P-1]=B,B=ce=0;B<16;B++)for(Y[B]=ce,ee=0;ee<1<<G[B];ee++)K[ce++]=B;for(ce>>=7;B<g;B++)for(Y[B]=ce<<7,ee=0;ee<1<<G[B]-7;ee++)K[256+ce++]=B;for(ye=0;ye<=C;ye++)_e[ye]=0;for(ee=0;ee<=143;)Z[2*ee+1]=8,ee++,_e[8]++;for(;ee<=255;)Z[2*ee+1]=9,ee++,_e[9]++;for(;ee<=279;)Z[2*ee+1]=7,ee++,_e[7]++;for(;ee<=287;)Z[2*ee+1]=8,ee++,_e[8]++;for(lt(Z,p+1,_e),ee=0;ee<g;ee++)R[2*ee+1]=5,R[2*ee]=Ze(ee,5);$=new Ce(Z,z,f+1,p,C),J=new Ce(R,G,0,g,C),Q=new Ce(new Array(0),U,0,m,S)})(),N=!0),O.l_desc=new fe(O.dyn_ltree,$),O.d_desc=new fe(O.dyn_dtree,J),O.bl_desc=new fe(O.bl_tree,Q),O.bi_buf=0,O.bi_valid=0,et(O)},o._tr_stored_block=q,o._tr_flush_block=function(O,ee,ye,P){var B,ce,_e=0;0<O.level?(O.strm.data_type===2&&(O.strm.data_type=(function(Ae){var De,Ye=4093624447;for(De=0;De<=31;De++,Ye>>>=1)if(1&Ye&&Ae.dyn_ltree[2*De]!==0)return s;if(Ae.dyn_ltree[18]!==0||Ae.dyn_ltree[20]!==0||Ae.dyn_ltree[26]!==0)return a;for(De=32;De<f;De++)if(Ae.dyn_ltree[2*De]!==0)return a;return s})(O)),re(O,O.l_desc),re(O,O.d_desc),_e=(function(Ae){var De;for(I(Ae,Ae.dyn_ltree,Ae.l_desc.max_code),I(Ae,Ae.dyn_dtree,Ae.d_desc.max_code),re(Ae,Ae.bl_desc),De=m-1;3<=De&&Ae.bl_tree[2*j[De]+1]===0;De--);return Ae.opt_len+=3*(De+1)+5+5+4,De})(O),B=O.opt_len+3+7>>>3,(ce=O.static_len+3+7>>>3)<=B&&(B=ce)):B=ce=ye+5,ye+4<=B&&ee!==-1?q(O,ee,ye,P):O.strategy===4||ce===B?(Ee(O,2+(P?1:0),3),He(O,Z,R)):(Ee(O,4+(P?1:0),3),(function(Ae,De,Ye,ot){var gt;for(Ee(Ae,De-257,5),Ee(Ae,Ye-1,5),Ee(Ae,ot-4,4),gt=0;gt<ot;gt++)Ee(Ae,Ae.bl_tree[2*j[gt]+1],3);se(Ae,Ae.dyn_ltree,De-1),se(Ae,Ae.dyn_dtree,Ye-1)})(O,O.l_desc.max_code+1,O.d_desc.max_code+1,_e+1),He(O,O.dyn_ltree,O.dyn_dtree)),et(O),P&&Et(O)},o._tr_tally=function(O,ee,ye){return O.pending_buf[O.d_buf+2*O.last_lit]=ee>>>8&255,O.pending_buf[O.d_buf+2*O.last_lit+1]=255&ee,O.pending_buf[O.l_buf+O.last_lit]=255&ye,O.last_lit++,ee===0?O.dyn_ltree[2*ye]++:(O.matches++,ee--,O.dyn_ltree[2*(x[ye]+f+1)]++,O.dyn_dtree[2*ve(ee)]++),O.last_lit===O.lit_bufsize-1},o._tr_align=function(O){Ee(O,2,3),Fe(O,k,Z),(function(ee){ee.bi_valid===16?(me(ee,ee.bi_buf),ee.bi_buf=0,ee.bi_valid=0):8<=ee.bi_valid&&(ee.pending_buf[ee.pending++]=255&ee.bi_buf,ee.bi_buf>>=8,ee.bi_valid-=8)})(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,u,d,f,p=1,g={},m=!1,v=s.document,C=Object.getPrototypeOf&&Object.getPrototypeOf(s);C=C&&C.setTimeout?C:s,l={}.toString.call(s.process)==="[object process]"?function(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",k,!1):s.attachEvent("onmessage",k),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")?(u=v.documentElement,function(b){var T=v.createElement("script");T.onreadystatechange=function(){S(b),T.onreadystatechange=null,u.removeChild(T),T=null},u.appendChild(T)}):function(b){setTimeout(S,0,b)},C.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++},C.clearImmediate=w}function w(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 z=L.callback,G=L.args;switch(G.length){case 0:z();break;case 1:z(G[0]);break;case 2:z(G[0],G[1]);break;case 3:z(G[0],G[1],G[2]);break;default:z.apply(a,G)}})(T)}finally{w(b),m=!1}}}}function k(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)})})),_r="application/vnd.openxmlformats-officedocument.wordprocessingml.document",Ca="application/pdf",vu="text/html",DT={docx:_r,pdf:Ca,html:vu},Ep={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"};Dt();var OT=M2(LT(),1),PT=e=>typeof e!="string"?"":e.trim(),Ly=e=>{if(typeof e!="string")return"";const t=e.trim();return t?t.toLowerCase():""},Tp=e=>{if(typeof e!="string")return"";const t=e.trim();return t?t.toLowerCase():""},vc=e=>{const t=e??{},n=PT(t.id),r=Ly(t.email);return{id:n,email:r,name:typeof t.name=="string"?t.name:"",hasId:n.length>0,hasEmail:r.length>0}},HC=({current:e,other:t})=>{const n=vc(e),r=vc(t);return n.hasId&&r.hasId?n.id===r.id:n.hasEmail&&r.hasEmail?n.email===r.email:!1},yu=({actor:e,fallbackKey:t=""})=>{const n=vc(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 FT(e){return typeof e.captureStackTrace=="function"}var xp=class extends Error{constructor(e,t){super(e),this.cause=t,this.name="FileObjectError",FT(Error)&&Error.captureStackTrace(this,this.constructor)}},NT=class extends xp{constructor(e){super("Invalid data URI format: URI must contain exactly one comma separator"),this.uri=e,this.name="InvalidDataUriError"}},BT=class extends xp{constructor(e,t){super(`Failed to fetch file from URL: ${e}`,t),this.url=e,this.name="FetchFailedError"}},Dy=async(e,t,n)=>{try{if(e.startsWith("data:")&&e.includes(";base64,")){const i=e.split(",");if(i.length!==2)throw new NT(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 BT(e,new Error(`HTTP ${r.status}: ${r.statusText}`));const o=await r.blob();return new File([o],t,{type:n})}catch(r){throw r instanceof xp?r:new xp("Failed to create file object",r)}};function zT(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 Rp=new WeakMap;function $C(e){return e.ownerDocument??document}function GC(e,t){const n=Rp.get(t);n?.bindings.delete(e),n&&n.bindings.size===0&&(t.removeEventListener("click",n.listener),Rp.delete(t))}function WC(e,t){const n=$C(e);e.__clickOutsideDocument&&e.__clickOutsideDocument!==n&&GC(e,e.__clickOutsideDocument);let r=Rp.get(n);if(!r){const o=new Map,i=s=>{const a=typeof s.composedPath=="function"?s.composedPath():null;for(const[l,u]of o)(a?.includes(l)??l.contains(s.target))||u.value?.(s)};r={bindings:o,listener:i},Rp.set(n,r),n.addEventListener("click",i)}r.bindings.set(e,t),e.__clickOutsideHandler=r.listener,e.__clickOutsideDocument=n}var Oy={mounted(e,t){WC(e,t)},updated(e,t){WC(e,t)},unmounted(e){GC(e,e.__clickOutsideDocument??$C(e)),delete e.__clickOutsideHandler,delete e.__clickOutsideDocument}};function jT(e){return e[1].user!==void 0}var VT=(e,t)=>{const n=new Set;return Array.from(t.entries()).filter(jT).filter(([r,o])=>{const i=yu({actor:o.user,fallbackKey:r});return!i||n.has(i)?!1:(n.add(i),!0)}).map(([r,o])=>{const i=yu({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}})},UT=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},HT="https://ingest.superdoc.dev/v1/collect",X$="community-and-eval-agplv3";function $T(){try{return"2.12.0"}catch{return"unknown"}}var GT=class{constructor(e){this.enabled=e.enabled,this.endpoint=e.endpoint||HT,this.licenseKey=e.licenseKey||"",this.metadata=e.metadata,this.superdocVersion=$T()}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{}}},Mp={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"},Z$=[Mp.INLINE_SDT_LABEL,Mp.BLOCK_SDT_LABEL],KC={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"},WT=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"}}},Q$=`.${Mp.BLOCK_SDT}[${KC.SDT_ID}]`,J$=`[${KC.DRAGGABLE}="true"]`,KT=typeof window<"u",qC,Cf=e=>qC=e,YC=Symbol();function Py(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 XC=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 qT(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 Fy(e,t,n){const r=new XMLHttpRequest;r.open("GET",e),r.responseType="blob",r.onload=function(){YT(r.response,t,n)},r.onerror=function(){console.error("could not download file")},r.send()}function ZC(e){const t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch{}return t.status>=200&&t.status<=299}function Lp(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 Dp=typeof navigator=="object"?navigator:{userAgent:""},QC=/Macintosh/.test(Dp.userAgent)&&/AppleWebKit/.test(Dp.userAgent)&&!/Safari/.test(Dp.userAgent),YT=KT?typeof HTMLAnchorElement<"u"&&"download"in HTMLAnchorElement.prototype&&!QC?XT:"msSaveOrOpenBlob"in Dp?ZT:QT:()=>{};function XT(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?ZC(r.href)?Fy(e,t,n):(r.target="_blank",Lp(r)):Lp(r)):(r.href=URL.createObjectURL(e),setTimeout(function(){URL.revokeObjectURL(r.href)},4e4),setTimeout(function(){Lp(r)},0))}function ZT(e,t="download",n){if(typeof e=="string")if(ZC(e))Fy(e,t,n);else{const r=document.createElement("a");r.href=e,r.target="_blank",setTimeout(function(){Lp(r)})}else navigator.msSaveOrOpenBlob(qT(e,n),t)}function QT(e,t,n,r){if(r=r||open("","_blank"),r&&(r.document.title=r.document.body.innerText="downloading..."),typeof e=="string")return Fy(e,t,n);const o=e.type==="application/octet-stream",i=/constructor/i.test(String(XC.HTMLElement))||"safari"in XC,s=/CriOS\/[\d]+/.test(navigator.userAgent);if((s||o&&i||QC)&&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:eG}=Object;function JT(){const e=Ug(!0),t=e.run(()=>te({}));let n=[],r=[];const o=io({install(i){Cf(o),o._a=i,i.provide(YC,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 JC=()=>{};function ek(e,t,n,r=JC){e.add(t);const o=()=>{e.delete(t)&&r()};return!n&&Hg()&&G2(o),o}function bu(e,...t){e.forEach(n=>{n(...t)})}var ex=e=>e(),tk=Symbol(),Ny=Symbol();function By(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];Py(o)&&Py(r)&&e.hasOwnProperty(n)&&!ur(r)&&!Bi(r)?e[n]=By(o,r):e[n]=r}return e}var tx=Symbol();function nx(e){return!Py(e)||!Object.prototype.hasOwnProperty.call(e,tx)}var{assign:yl}=Object;function rx(e){return!!(ur(e)&&e.effect)}function ox(e,t,n,r){const{state:o,actions:i,getters:s}=t,a=n.state.value[e];let l;function u(){a||(n.state.value[e]=o?o():{});const d=n1(n.state.value[e]);return yl(d,i,Object.keys(s||{}).reduce((f,p)=>(f[p]=io(ke(()=>{Cf(n);const g=n._s.get(e);return s[p].call(g,g)})),f),{}))}return l=nk(e,u,t,n,r,!0),l}function nk(e,t,n={},r,o,i){let s;const a=yl({actions:{}},n),l={deep:!0};let u,d,f=new Set,p=new Set,g;const m=r.state.value[e];!i&&!m&&(r.state.value[e]={});let v;function C(L){let z;u=d=!1,typeof L=="function"?(L(r.state.value[e]),z={type:kf.patchFunction,storeId:e,events:g}):(By(r.state.value[e],L),z={type:kf.patchObject,payload:L,storeId:e,events:g});const G=v=Symbol();kt().then(()=>{v===G&&(u=!0)}),d=!0,bu(f,z,r.state.value[e])}const w=i?function(){const{state:z}=n,G=z?z():{};this.$patch(U=>{yl(U,G)})}:JC;function S(){s.stop(),f.clear(),p.clear(),r._s.delete(e)}const k=(L,z="")=>{if(tk in L)return L[Ny]=z,L;const G=function(){Cf(r);const U=Array.from(arguments),j=new Set,Z=new Set;function R(W){j.add(W)}function K(W){Z.add(W)}bu(p,{args:U,name:G[Ny],store:b,after:R,onError:K});let x;try{x=L.apply(this&&this.$id===e?this:b,U)}catch(W){throw bu(Z,W),W}return x instanceof Promise?x.then(W=>(bu(j,W),W)).catch(W=>(bu(Z,W),Promise.reject(W))):(bu(j,x),x)};return G[tk]=!0,G[Ny]=z,G},b=oo({_p:r,$id:e,$onAction:ek.bind(null,p),$patch:C,$reset:w,$subscribe(L,z={}){const G=ek(f,L,z.detached,()=>U()),U=s.run(()=>Bt(()=>r.state.value[e],j=>{(z.flush==="sync"?d:u)&&L({storeId:e,type:kf.direct,events:g},j)},yl({},l,z)));return G},$dispose:S});r._s.set(e,b);const T=(r._a&&r._a.runWithContext||ex)(()=>r._e.run(()=>(s=Ug()).run(()=>t({action:k}))));for(const L in T){const z=T[L];ur(z)&&!rx(z)||Bi(z)?i||(m&&nx(z)&&(ur(z)?z.value=m[L]:By(z,m[L])),r.state.value[e][L]=z):typeof z=="function"&&(T[L]=k(z,L),a.actions[L]=z)}return yl(b,T),yl(gn(b),T),Object.defineProperty(b,"$state",{get:()=>r.state.value[e],set:L=>{C(z=>{yl(z,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),u=!0,d=!0,b}function rk(e,t,n){let r;const o=typeof t=="function";r=o?n:t;function i(s,a){const l=R1();return s=s||(l?ll(YC,null):null),s&&Cf(s),s=qC,s._s.has(e)||(o?nk(e,t,r,s):ox(e,r,s)),s._s.get(e)}return i.$id=e,i}function Ds(e){const t=gn(e),n={};for(const r in t){const o=t[r];o.effect?n[r]=ke({get:()=>e[r],set(i){e[r]=i}}):(ur(o)||Bi(o))&&(n[r]=Zg(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},ok=Object.getOwnPropertyDescriptor(ArrayBuffer.prototype,"byteLength")?.get,ix=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Uint8Array.prototype),Symbol.toStringTag)?.get,bl=e=>{if(ArrayBuffer.isView(e))return ix?.call(e)==="Uint8Array";if(!ok)return!1;try{return ok.call(e),!0}catch{return!1}},zy=e=>{if(e instanceof Uint8Array)return e;const t=ArrayBuffer.isView(e)?e:new Uint8Array(e);return Uint8Array.from(t)},jy=(e,t)=>new Blob([zy(e)],{type:t}),Vy=e=>{switch(e.toLowerCase()){case"docx":case _r:return _r;case"pdf":case Ca:return Ca;case"html":case vu:return vu;default:return e}},Op=(e="")=>{const t=String(e).toLowerCase();return t.endsWith(".docx")?_r:t.endsWith(".pdf")?Ca:t.endsWith(".html")||t.endsWith(".htm")?vu:t.endsWith(".md")||t.endsWith(".markdown")?"text/markdown":""},sx=e=>e==="application/vnd.openxmlformats-officedocument.wordprocessingml.document"?"document.docx":e==="application/pdf"?"document.pdf":e==="text/html"?"document.html":"document",ax="application/octet-stream",Uy=e=>{if(bl(e))return{type:_r,data:zy(e),name:"document.docx"};const t=Sf(e);if(t){const n=e&&typeof e.name=="string"?e.name:"",r=t.name||"",o=Op(n),i=o||Op(r),s=t.type.toLowerCase()===ax,a=s&&o?n:r||n||"document",l=s&&i?i:t.type||i||"application/vnd.openxmlformats-officedocument.wordprocessingml.document";let u=t;return s&&i&&typeof File=="function"&&t instanceof File?u=new File([t],a,{type:l,lastModified:t.lastModified}):s&&i&&typeof Blob=="function"&&t instanceof Blob&&(u=new Blob([t],{type:l})),{type:l,data:u,name:a}}if(e&&typeof e=="object"&&"data"in e){if(bl(e.data)){const r=Vy(e.type||Op(e.name)||"application/vnd.openxmlformats-officedocument.wordprocessingml.document");return{...e,type:r,data:r==="application/vnd.openxmlformats-officedocument.wordprocessingml.document"?zy(e.data):jy(e.data,r),name:e.name||sx(r)}}const n=Sf(e.data,e.name);if(n){const r=typeof e.type=="string"&&e.type?Vy(e.type):"",o=r||n.type||Op(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=Vy(e.type);if(n!==e.type)return{...e,type:n}}return e};Dt();function lx(e,t){const n=e.itemid,r=e,o=t!==null&&typeof t=="object"?oo({...t}):te(t),i=te(null);return Bt(o,(a,l)=>{const u={fieldId:n.value,changeTime:Date.now(),oldValue:l,newValue:a,originalField:r};i.value=u}),{value:o}}function cx(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}=lx(e,i,te([])),l=te(e.itemtype),u=te(e.itemfieldtype),d=e,f=oo({fontFamily:e.fontfamily||"Arial",fontSize:e.font_size||"12pt",originalFontSize:e.original_font_size||"12pt"}),p=te(e.logicrules),g=te(!1),m=oo({}),v={SELECT:dx,IMAGEINPUT:ux,CHECKBOXINPUT:fx};return l.value in v&&Object.assign(m,v[l.value](e)),{id:t,icon:n,iconPack:r,label:o,placeholder:s,fieldType:l,fieldSubType:u,value:a,format:te(e.itemformat),logicRules:p,hidden:g,originalJSON:d,fieldStyle:f,valueGetter:e.valueGetter,...m}}function ux(e){return{fontfamily:te(e.fontfamily),iteminputtype:te(e.iteminputtype)}}function dx(e){return{options:te(e.itemoptions)}}function fx(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 Os=()=>new Map,Hy=e=>{const t=Os();return e.forEach((n,r)=>{t.set(r,n)}),t},wu=(e,t,n)=>{let r=e.get(t);return r===void 0&&e.set(t,r=n()),r},hx=(e,t)=>{const n=[];for(const[r,o]of e)n.push(t(o,r));return n},px=(e,t)=>{for(const[n,r]of e)if(t(r,n))return!0;return!1},Cu=()=>new Set,$y=e=>e[e.length-1],ku=Array.from,Gy=(e,t)=>{for(let n=0;n<e.length;n++)if(!t(e[n],n,e))return!1;return!0},ik=(e,t)=>{for(let n=0;n<e.length;n++)if(t(e[n],n,e))return!0;return!1},mx=(e,t)=>{const n=new Array(e);for(let r=0;r<e;r++)n[r]=t(r,n);return n},Pp=Array.isArray,gx=class{constructor(){this._observers=Os()}on(e,t){return wu(this._observers,e,Cu).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 ku((this._observers.get(e)||Os()).values()).forEach(n=>n(...t))}destroy(){this._observers=Os()}},ka=Math.floor,Fp=Math.abs,sk=(e,t)=>e<t?e:t,Su=(e,t)=>e>t?e:t,tG=Number.isNaN,vx=e=>e!==0?e<0:1/e<0,nG=1,rG=2,oG=4,iG=8,sG=32,aG=64,lG=128,yx=1<<17,bx=1<<18,wx=1<<19,Cx=1<<20,kx=1<<21,Sx=1<<22,_x=1<<23,Ax=1<<24,Ix=1<<25,Ex=1<<26,Tx=1<<27,xx=1<<28,Rx=1<<29,Mx=1<<30,cG=31,uG=63,dG=127,fG=yx-1,hG=bx-1,pG=wx-1,mG=Cx-1,gG=kx-1,vG=Sx-1,yG=_x-1,bG=Ax-1,wG=Ix-1,CG=Ex-1,kG=Tx-1,SG=xx-1,_G=Rx-1,AG=Mx-1,IG=2147483647,ak=Number.MAX_SAFE_INTEGER,lk=Number.MIN_SAFE_INTEGER,Lx=Number.isInteger||(e=>typeof e=="number"&&isFinite(e)&&ka(e)===e),EG=Number.isNaN,TG=Number.parseInt,ck=String.fromCharCode,xG=String.fromCodePoint,RG=ck(65535),Dx=e=>e.toLowerCase(),Ox=/^\s*/g,Px=e=>e.replace(Ox,""),Fx=/([A-Z])/g,uk=(e,t)=>Px(e.replace(Fx,n=>`${t}${Dx(n)}`)),Nx=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,Bx=e=>_f.encode(e),zx=_f?Bx:Nx,Wy=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});Wy&&Wy.decode(new Uint8Array).length===1&&(Wy=null);var jx=(e,t)=>mx(t,()=>e).join(""),Af=class{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}},Ky=()=>new Af,Vx=e=>{let t=e.cpos;for(let n=0;n<e.bufs.length;n++)t+=e.bufs[n].length;return t},Sa=e=>{const t=new Uint8Array(Vx(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},Ux=(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(Su(n,t)*2),e.cpos=0)},go=(e,t)=>{const n=e.cbuf.length;e.cpos===n&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(n*2),e.cpos=0),e.cbuf[e.cpos++]=t},qy=go,er=(e,t)=>{for(;t>127;)go(e,128|127&t),t=ka(t/128);go(e,127&t)},Yy=(e,t)=>{const n=vx(t);for(n&&(t=-t),go(e,(t>63?128:0)|(n?64:0)|63&t),t=ka(t/64);t>0;)go(e,(t>127?128:0)|127&t),t=ka(t/128)},Xy=new Uint8Array(3e4),Hx=Xy.length/3,$x=(e,t)=>{if(t.length<Hx){const n=_f.encodeInto(t,Xy).written||0;er(e,n);for(let r=0;r<n;r++)go(e,Xy[r])}else _i(e,zx(t))},Gx=(e,t)=>{const n=unescape(encodeURIComponent(t)),r=n.length;er(e,r);for(let o=0;o<r;o++)go(e,n.codePointAt(o))},_u=_f&&_f.encodeInto?$x:Gx,Zy=(e,t)=>{const n=e.cbuf.length,r=e.cpos,o=sk(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(Su(n*2,i)),e.cbuf.set(t.subarray(o)),e.cpos=i)},_i=(e,t)=>{er(e,t.byteLength),Zy(e,t)},Qy=(e,t)=>{Ux(e,t);const n=new DataView(e.cbuf.buffer,e.cpos,t);return e.cpos+=t,n},Wx=(e,t)=>Qy(e,4).setFloat32(0,t,!1),Kx=(e,t)=>Qy(e,8).setFloat64(0,t,!1),qx=(e,t)=>Qy(e,8).setBigInt64(0,t,!1),dk=new DataView(new ArrayBuffer(4)),Yx=e=>(dk.setFloat32(0,e),dk.getFloat32(0)===e),If=(e,t)=>{switch(typeof t){case"string":go(e,119),_u(e,t);break;case"number":Lx(t)&&Fp(t)<=2147483647?(go(e,125),Yy(e,t)):Yx(t)?(go(e,124),Wx(e,t)):(go(e,123),Kx(e,t));break;case"bigint":go(e,122),qx(e,t);break;case"object":if(t===null)go(e,126);else if(Pp(t)){go(e,117),er(e,t.length);for(let n=0;n<t.length;n++)If(e,t[n])}else if(t instanceof Uint8Array)go(e,116),_i(e,t);else{go(e,118);const n=Object.keys(t);er(e,n.length);for(let r=0;r<n.length;r++){const o=n[r];_u(e,o),If(e,t[o])}}break;case"boolean":go(e,t?120:121);break;default:go(e,127)}},fk=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&&er(this,this.count-1),this.count=1,this.w(this,e),this.s=e)}},hk=e=>{e.count>0&&(Yy(e.encoder,e.count===1?e.s:-e.s),e.count>1&&er(e.encoder,e.count-2))},Np=class{constructor(){this.encoder=new Af,this.s=0,this.count=0}write(e){this.s===e?this.count++:(hk(this),this.count=1,this.s=e)}toUint8Array(){return hk(this),Sa(this.encoder)}},pk=e=>{if(e.count>0){const t=e.diff*2+(e.count===1?0:1);Yy(e.encoder,t),e.count>1&&er(e.encoder,e.count-2)}},Jy=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++):(pk(this),this.count=1,this.diff=e-this.s,this.s=e)}toUint8Array(){return pk(this),Sa(this.encoder)}},Xx=class{constructor(){this.sarr=[],this.s="",this.lensE=new Np}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="",_u(e,this.sarr.join("")),Zy(e,this.lensE.toUint8Array()),Sa(e)}},wl=e=>new Error(e),ss=()=>{throw wl("Method unimplemented")},_a=()=>{throw wl("Unexpected case")},MG=crypto.subtle,Zx=crypto.getRandomValues.bind(crypto),mk=()=>Zx(new Uint32Array(1))[0],Qx="10000000-1000-4000-8000-100000000000",Jx=()=>Qx.replace(/[018]/g,e=>(e^mk()&15>>e/4).toString(16)),e6=Date.now,gk=e=>new Promise(e),LG=Promise.all.bind(Promise),vk=e=>e===void 0?null:e,t6=class{constructor(){this.map=new Map}setItem(e,t){this.map.set(e,t)}getItem(e){return this.map.get(e)}},yk=new t6,n6=!0;try{typeof localStorage<"u"&&localStorage&&(yk=localStorage,n6=!1)}catch{}var r6=yk,Ef=Symbol("Equality"),bk=(e,t)=>e===t||!!e?.[Ef]?.(t)||!1,o6=e=>typeof e=="object",i6=Object.assign,s6=Object.keys,a6=(e,t)=>{for(const n in e)t(e[n],n)},Bp=e=>s6(e).length,l6=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},e0=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),c6=(e,t)=>e===t||Bp(e)===Bp(t)&&Tf(e,(n,r)=>(n!==void 0||e0(t,r))&&bk(t[r],n)),u6=Object.freeze,wk=e=>{for(const t in e){const n=e[t];(typeof n=="object"||typeof n=="function")&&wk(e[t])}return u6(e)},t0=(e,t,n=0)=>{try{for(;n<e.length;n++)e[n](...t)}finally{n<e.length&&t0(e,t,n+1)}},zp=(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)||!zp(e.get(n),t.get(n)))return!1;break;case void 0:case Object:if(Bp(e)!==Bp(t))return!1;for(const n in e)if(!e0(e,n)||!zp(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(!zp(e[n],t[n]))return!1;break;default:return!1}return!0},d6=(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]",DG=typeof navigator<"u"?/Mac/.test(navigator.platform):!1,Ps,f6=[],h6=()=>{if(Ps===void 0)if(xf){Ps=Os();const e=process.argv;let t=null;for(let n=0;n<e.length;n++){const r=e[n];r[0]==="-"?(t!==null&&Ps.set(t,""),t=r):t!==null?(Ps.set(t,r),t=null):f6.push(r)}t!==null&&Ps.set(t,"")}else typeof location=="object"?(Ps=Os(),(location.search||"?").slice(1).split("&").forEach(e=>{if(e.length!==0){const[t,n]=e.split("=");Ps.set(`--${uk(t,"-")}`,n),Ps.set(`-${uk(t,"-")}`,n)}})):Ps=Os();return Ps},n0=e=>h6().has(e),jp=e=>vk(xf?process.env[e.toUpperCase().replaceAll("-","_")]:r6.getItem(e)),Ck=e=>n0("--"+e)||jp(e)!==null,p6=Ck("production"),m6=xf&&d6(process.env.FORCE_COLOR,["true","1","2"]),g6=m6||!n0("--no-colors")&&!Ck("no-color")&&(!xf||process.stdout.isTTY)&&(!xf||n0("--color")||jp("COLORTERM")!==null||(jp("TERM")||"").includes("color")),v6=class{constructor(e,t){this.left=e,this.right=t}},Aa=(e,t)=>new v6(e,t),kk=e=>e.next()>=.5,r0=(e,t,n)=>ka(e.next()*(n+1-t)+t),Sk=(e,t,n)=>ka(e.next()*(n+1-t)+t),o0=(e,t,n)=>Sk(e,t,n),y6=e=>ck(o0(e,97,122)),b6=(e,t=0,n=20)=>{const r=o0(e,t,n);let o="";for(let i=0;i<r;i++)o+=y6(e);return o},i0=(e,t)=>t[o0(e,0,t.length-1)],w6=Symbol("0schema"),C6=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(jx(" ",(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(fe,2),Ee+=L.magic,Ee+=i(k,2),Ee+=i(b,2),Ee+=i(Ce.crc32,4),Ee+=i(Ce.compressedSize,4),Ee+=i(Ce.uncompressedSize,4),Ee+=i(G.length,2),Ee+=i(W.length,2),{fileRecord:f.LOCAL_FILE_HEADER+Ee+G+W,dirRecord:f.CENTRAL_FILE_HEADER+i(me,2)+Ee+i(Z.length,2)+"\0\0\0\0"+i(ve,4)+i(C,4)+G+W+Z}}var a=n("../utils"),l=n("../stream/GenericWorker"),u=n("../utf8"),d=n("../crc32"),f=n("../signature");function p(g,m,v,C){l.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=m,this.zipPlatform=v,this.encodeFileName=C,this.streamFiles=g,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(p,l),p.prototype.push=function(g){var m=g.meta.percent||0,v=this.entriesCount,C=this._sources.length;this.accumulate?this.contentBuffer.push(g):(this.bytesWritten+=g.data.length,l.prototype.push.call(this,{data:g.data,meta:{currentFile:this.currentFile,percent:v?(m+100*(v-C-1))/v:100}}))},p.prototype.openedSource=function(g){this.currentSourceOffset=this.bytesWritten,this.currentFile=g.file.name;var m=this.streamFiles&&!g.file.dir;if(m){var v=s(g,m,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:v.fileRecord,meta:{percent:0}})}else this.accumulate=!0},p.prototype.closedSource=function(g){this.accumulate=!1;var m=this.streamFiles&&!g.file.dir,v=s(g,m,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(v.dirRecord),m)this.push({data:(function(C){return f.DATA_DESCRIPTOR+i(C.crc32,4)+i(C.compressedSize,4)+i(C.uncompressedSize,4)})(g),meta:{percent:100}});else for(this.push({data:v.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},p.prototype.flush=function(){for(var g=this.bytesWritten,m=0;m<this.dirRecords.length;m++)this.push({data:this.dirRecords[m],meta:{percent:100}});var v=this.bytesWritten-g,C=(function(w,S,k,b,T){var L=a.transformTo("string",T(b));return f.CENTRAL_DIRECTORY_END+"\0\0\0\0"+i(w,2)+i(w,2)+i(S,4)+i(k,4)+i(L.length,2)+L})(this.dirRecords.length,v,g,this.zipComment,this.encodeFileName);this.push({data:C,meta:{percent:100}})},p.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},p.prototype.registerPrevious=function(g){this._sources.push(g);var m=this;return g.on("data",function(v){m.processChunk(v)}),g.on("end",function(){m.closedSource(m.previous.streamInfo),m._sources.length?m.prepareNextSource():m.end()}),g.on("error",function(v){m.error(v)}),this},p.prototype.resume=function(){return!!l.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},p.prototype.error=function(g){var m=this._sources;if(!l.prototype.error.call(this,g))return!1;for(var v=0;v<m.length;v++)try{m[v].error(g)}catch{}return!0},p.prototype.lock=function(){l.prototype.lock.call(this);for(var g=this._sources,m=0;m<g.length;m++)g[m].lock()},r.exports=p},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(n,r,o){"use strict";var i=n("../compressions"),s=n("./ZipFileWorker");o.generateWorker=function(a,l,u){var d=new s(l.streamFiles,u,l.platform,l.encodeFileName),f=0;try{a.forEach(function(p,g){f++;var m=(function(S,k){var b=S||k,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||{},C=g.dir,w=g.date;g._compressWorker(m,v).withStreamInfo("file",{name:p,dir:C,date:w,comment:g.comment||"",unixPermissions:g.unixPermissions,dosPermissions:g.dosPermissions}).pipe(d)}),d.entriesCount=f}catch(p){d.error(p)}return d}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(n,r,o){"use strict";function i(){if(!(this instanceof i))return new i;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var s=new i;for(var a in this)typeof this[a]!="function"&&(s[a]=this[a]);return s}}(i.prototype=n("./object")).loadAsync=n("./load"),i.support=n("./support"),i.defaults=n("./defaults"),i.version="3.10.1",i.loadAsync=function(s,a){return new i().loadAsync(s,a)},i.external=n("./external"),r.exports=i},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(n,r,o){"use strict";var i=n("./utils"),s=n("./external"),a=n("./utf8"),l=n("./zipEntries"),u=n("./stream/Crc32Probe"),d=n("./nodejsUtils");function f(p){return new s.Promise(function(g,m){var v=p.decompressed.getContentWorker().pipe(new u);v.on("error",function(C){m(C)}).on("end",function(){v.streamInfo.crc32!==p.decompressed.crc32?m(new Error("Corrupted zip : CRC32 mismatch")):g()}).resume()})}r.exports=function(p,g){var m=this;return g=i.extend(g||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:a.utf8decode}),d.isNode&&d.isStream(p)?s.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):i.prepareContent("the loaded zip file",p,!0,g.optimizedBinaryString,g.base64).then(function(v){var C=new l(g);return C.load(v),C}).then(function(v){var C=[s.Promise.resolve(v)],w=v.files;if(g.checkCRC32)for(var S=0;S<w.length;S++)C.push(f(w[S]));return s.Promise.all(C)}).then(function(v){for(var C=v.shift(),w=C.files,S=0;S<w.length;S++){var k=w[S],b=k.fileNameStr,T=i.resolve(k.fileNameStr);m.file(T,k.decompressed,{binary:!0,optimizedBinaryString:!0,date:k.date,dir:k.dir,comment:k.fileCommentStr.length?k.fileCommentStr:null,unixPermissions:k.unixPermissions,dosPermissions:k.dosPermissions,createFolders:g.createFolders}),k.dir||(m.file(T).unsafeOriginalName=b)}return C.zipComment.length&&(m.comment=C.zipComment),m})}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(n,r,o){"use strict";var i=n("../utils"),s=n("../stream/GenericWorker");function a(l,u){s.call(this,"Nodejs stream input adapter for "+l),this._upstreamEnded=!1,this._bindStream(u)}i.inherits(a,s),a.prototype._bindStream=function(l){var u=this;(this._stream=l).pause(),l.on("data",function(d){u.push({data:d,meta:{percent:0}})}).on("error",function(d){u.isPaused?this.generatedError=d:u.error(d)}).on("end",function(){u.isPaused?u._upstreamEnded=!0:u.end()})},a.prototype.pause=function(){return!!s.prototype.pause.call(this)&&(this._stream.pause(),!0)},a.prototype.resume=function(){return!!s.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},r.exports=a},{"../stream/GenericWorker":28,"../utils":32}],13:[function(n,r,o){"use strict";var i=n("readable-stream").Readable;function s(a,l,u){i.call(this,l),this._helper=a;var d=this;a.on("data",function(f,p){d.push(f)||d._helper.pause(),u&&u(p)}).on("error",function(f){d.emit("error",f)}).on("end",function(){d.push(null)})}n("../utils").inherits(s,i),s.prototype._read=function(){this._helper.resume()},r.exports=s},{"../utils":32,"readable-stream":16}],14:[function(n,r,o){"use strict";r.exports={isNode:typeof Buffer<"u",newBufferFrom:function(i,s){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(i,s);if(typeof i=="number")throw new Error('The "data" argument must not be a number');return new Buffer(i,s)},allocBuffer:function(i){if(Buffer.alloc)return Buffer.alloc(i);var s=new Buffer(i);return s.fill(0),s},isBuffer:function(i){return Buffer.isBuffer(i)},isStream:function(i){return i&&typeof i.on=="function"&&typeof i.pause=="function"&&typeof i.resume=="function"}}},{}],15:[function(n,r,o){"use strict";function i(b,T,L){var z,G=a.getTypeOf(T),U=a.extend(L||{},d);U.date=U.date||new Date,U.compression!==null&&(U.compression=U.compression.toUpperCase()),typeof U.unixPermissions=="string"&&(U.unixPermissions=parseInt(U.unixPermissions,8)),U.unixPermissions&&16384&U.unixPermissions&&(U.dir=!0),U.dosPermissions&&16&U.dosPermissions&&(U.dir=!0),U.dir&&(b=w(b)),U.createFolders&&(z=C(b))&&S.call(this,z,!0);var j=G==="string"&&U.binary===!1&&U.base64===!1;L&&L.binary!==void 0||(U.binary=!j),(T instanceof f&&T.uncompressedSize===0||U.dir||!T||T.length===0)&&(U.base64=!1,U.binary=!0,T="",U.compression="STORE",G="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,U.binary,U.optimizedBinaryString,U.base64);var R=new p(b,Z,U);this.files[b]=R}var s=n("./utf8"),a=n("./utils"),l=n("./stream/GenericWorker"),u=n("./stream/StreamHelper"),d=n("./defaults"),f=n("./compressedObject"),p=n("./zipObject"),g=n("./generate"),m=n("./nodejsUtils"),v=n("./nodejs/NodejsStreamInputAdapter"),C=function(b){b.slice(-1)==="/"&&(b=b.substring(0,b.length-1));var T=b.lastIndexOf("/");return 0<T?b.substring(0,T):""},w=function(b){return b.slice(-1)!=="/"&&(b+="/"),b},S=function(b,T){return T=T!==void 0?T:d.createFolders,b=w(b),this.files[b]||i.call(this,b,null,{dir:!0,createFolders:T}),this.files[b]};function k(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,z;for(T in this.files)z=this.files[T],(L=T.slice(this.root.length,T.length))&&T.slice(0,this.root.length)===this.root&&b(L,z)},filter:function(b){var T=[];return this.forEach(function(L,z){b(L,z)&&T.push(z)}),T},file:function(b,T,L){if(arguments.length!==1)return b=this.root+b,i.call(this,b,T,L),this;if(k(b)){var z=b;return this.filter(function(U,j){return!j.dir&&z.test(U)})}var G=this.files[this.root+b];return G&&!G.dir?G:null},folder:function(b){if(!b)return this;if(k(b))return this.filter(function(G,U){return U.dir&&b.test(G)});var T=this.root+b,L=S.call(this,T),z=this.clone();return z.root=L.name,z},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(G,U){return U.name.slice(0,b.length)===b}),z=0;z<L.length;z++)delete this.files[L[z].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(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 z=L.comment||this.comment||"";T=g.generateWorker(this,L,z)}catch(G){(T=new l("error")).error(G)}return new u(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),u=a.charCodeAt(1),d=a.charCodeAt(2),f=a.charCodeAt(3),p=this.length-4;0<=p;--p)if(this.data[p]===l&&this.data[p+1]===u&&this.data[p+2]===d&&this.data[p+3]===f)return p-this.zero;return-1},s.prototype.readAndCheckSignature=function(a){var l=a.charCodeAt(0),u=a.charCodeAt(1),d=a.charCodeAt(2),f=a.charCodeAt(3),p=this.readData(4);return l===p[0]&&u===p[1]&&d===p[2]&&f===p[3]},s.prototype.readData=function(a){if(this.checkOffset(a),a===0)return[];var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=s},{"../utils":32,"./DataReader":18}],18:[function(n,r,o){"use strict";var i=n("../utils");function s(a){this.data=a,this.length=a.length,this.index=0,this.zero=0}s.prototype={checkOffset:function(a){this.checkIndex(this.index+a)},checkIndex:function(a){if(this.length<this.zero+a||a<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+a+"). Corrupted zip ?")},setIndex:function(a){this.checkIndex(a),this.index=a},skip:function(a){this.setIndex(this.index+a)},byteAt:function(){},readInt:function(a){var l,u=0;for(this.checkOffset(a),l=this.index+a-1;l>=this.index;l--)u=(u<<8)+this.byteAt(l);return this.index+=a,u},readString:function(a){return i.transformTo("string",this.readData(a))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var a=this.readInt(4);return new Date(Date.UTC(1980+(a>>25&127),(a>>21&15)-1,a>>16&31,a>>11&31,a>>5&63,(31&a)<<1))}},r.exports=s},{"../utils":32}],19:[function(n,r,o){"use strict";var i=n("./Uint8ArrayReader");function s(a){i.call(this,a)}n("../utils").inherits(s,i),s.prototype.readData=function(a){this.checkOffset(a);var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=s},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(n,r,o){"use strict";var i=n("./DataReader");function s(a){i.call(this,a)}n("../utils").inherits(s,i),s.prototype.byteAt=function(a){return this.data.charCodeAt(this.zero+a)},s.prototype.lastIndexOfSignature=function(a){return this.data.lastIndexOf(a)-this.zero},s.prototype.readAndCheckSignature=function(a){return a===this.readData(4)},s.prototype.readData=function(a){this.checkOffset(a);var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=s},{"../utils":32,"./DataReader":18}],21:[function(n,r,o){"use strict";var i=n("./ArrayReader");function s(a){i.call(this,a)}n("../utils").inherits(s,i),s.prototype.readData=function(a){if(this.checkOffset(a),a===0)return new Uint8Array(0);var l=this.data.subarray(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},r.exports=s},{"../utils":32,"./ArrayReader":17}],22:[function(n,r,o){"use strict";var i=n("../utils"),s=n("../support"),a=n("./ArrayReader"),l=n("./StringReader"),u=n("./NodeBufferReader"),d=n("./Uint8ArrayReader");r.exports=function(f){var p=i.getTypeOf(f);return i.checkSupport(p),p!=="string"||s.uint8array?p==="nodebuffer"?new u(f):s.uint8array?new d(i.transformTo("uint8array",f)):new a(i.transformTo("array",f)):new l(f)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(n,r,o){"use strict";o.LOCAL_FILE_HEADER="PK",o.CENTRAL_FILE_HEADER="PK",o.CENTRAL_DIRECTORY_END="PK",o.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",o.ZIP64_CENTRAL_DIRECTORY_END="PK",o.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(n,r,o){"use strict";var i=n("./GenericWorker"),s=n("../utils");function a(l){i.call(this,"ConvertWorker to "+l),this.destType=l}s.inherits(a,i),a.prototype.processChunk=function(l){this.push({data:s.transformTo(this.destType,l.data),meta:l.meta})},r.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(n,r,o){"use strict";var i=n("./GenericWorker"),s=n("../crc32");function a(){i.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}n("../utils").inherits(a,i),a.prototype.processChunk=function(l){this.streamInfo.crc32=s(l.data,this.streamInfo.crc32||0),this.push(l)},r.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(n,r,o){"use strict";var i=n("../utils"),s=n("./GenericWorker");function a(l){s.call(this,"DataLengthProbe for "+l),this.propName=l,this.withStreamInfo(l,0)}i.inherits(a,s),a.prototype.processChunk=function(l){if(l){var u=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=u+l.data.length}s.prototype.processChunk.call(this,l)},r.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(n,r,o){"use strict";var i=n("../utils"),s=n("./GenericWorker");function a(l){s.call(this,"DataWorker");var u=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,l.then(function(d){u.dataIsReady=!0,u.data=d,u.max=d&&d.length||0,u.type=i.getTypeOf(d),u.isPaused||u._tickAndRepeat()},function(d){u.error(d)})}i.inherits(a,s),a.prototype.cleanUp=function(){s.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!s.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,i.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(i.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var l=null,u=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":l=this.data.substring(this.index,u);break;case"uint8array":l=this.data.subarray(this.index,u);break;case"array":case"nodebuffer":l=this.data.slice(this.index,u)}return this.index=u,this.push({data:l,meta:{percent:this.max?this.index/this.max*100:0}})},r.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(n,r,o){"use strict";function i(s){this.name=s||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}i.prototype={push:function(s){this.emit("data",s)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(s){this.emit("error",s)}return!0},error:function(s){return!this.isFinished&&(this.isPaused?this.generatedError=s:(this.isFinished=!0,this.emit("error",s),this.previous&&this.previous.error(s),this.cleanUp()),!0)},on:function(s,a){return this._listeners[s].push(a),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(s,a){if(this._listeners[s])for(var l=0;l<this._listeners[s].length;l++)this._listeners[s][l].call(this,a)},pipe:function(s){return s.registerPrevious(this)},registerPrevious:function(s){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=s.streamInfo,this.mergeStreamInfo(),this.previous=s;var a=this;return s.on("data",function(l){a.processChunk(l)}),s.on("end",function(){a.end()}),s.on("error",function(l){a.error(l)}),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var s=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),s=!0),this.previous&&this.previous.resume(),!s},flush:function(){},processChunk:function(s){this.push(s)},withStreamInfo:function(s,a){return this.extraStreamInfo[s]=a,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var s in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,s)&&(this.streamInfo[s]=this.extraStreamInfo[s])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var s="Worker "+this.name;return this.previous?this.previous+" -> "+s:s}},r.exports=i},{}],29:[function(n,r,o){"use strict";var i=n("../utils"),s=n("./ConvertWorker"),a=n("./GenericWorker"),l=n("../base64"),u=n("../support"),d=n("../external"),f=null;if(u.nodestream)try{f=n("../nodejs/NodejsStreamOutputAdapter")}catch{}function p(m,v){return new d.Promise(function(C,w){var S=[],k=m._internalType,b=m._outputType,T=m._mimeType;m.on("data",function(L,z){S.push(L),v&&v(z)}).on("error",function(L){S=[],w(L)}).on("end",function(){try{C((function(L,z,G){switch(L){case"blob":return i.newBlob(i.transformTo("arraybuffer",z),G);case"base64":return l.encode(z);default:return i.transformTo(L,z)}})(b,(function(L,z){var G,U=0,j=null,Z=0;for(G=0;G<z.length;G++)Z+=z[G].length;switch(L){case"string":return z.join("");case"array":return Array.prototype.concat.apply([],z);case"uint8array":for(j=new Uint8Array(Z),G=0;G<z.length;G++)j.set(z[G],U),U+=z[G].length;return j;case"nodebuffer":return Buffer.concat(z);default:throw new Error("concat : unsupported type '"+L+"'")}})(k,S),T))}catch(L){w(L)}S=[]}).resume()})}function g(m,v,C){var w=v;switch(v){case"blob":case"arraybuffer":w="uint8array";break;case"base64":w="string"}try{this._internalType=w,this._outputType=v,this._mimeType=C,i.checkSupport(w),this._worker=m.pipe(new s(w)),m.lock()}catch(S){this._worker=new a("error"),this._worker.error(S)}}g.prototype={accumulate:function(m){return p(this,m)},on:function(m,v){var C=this;return m==="data"?this._worker.on(m,function(w){v.call(C,w.data,w.meta)}):this._worker.on(m,function(){i.delay(v,arguments,C)}),this},resume:function(){return i.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(m){if(i.checkSupport("nodestream"),this._outputType!=="nodebuffer")throw new Error(this._outputType+" is not supported by this method");return new f(this,{objectMode:this._outputType!=="nodebuffer"},m)}},r.exports=g},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(n,r,o){"use strict";if(o.base64=!0,o.array=!0,o.string=!0,o.arraybuffer=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u",o.nodebuffer=typeof Buffer<"u",o.uint8array=typeof Uint8Array<"u",typeof ArrayBuffer>"u")o.blob=!1;else{var i=new ArrayBuffer(0);try{o.blob=new Blob([i],{type:"application/zip"}).size===0}catch{try{var s=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);s.append(i),o.blob=s.getBlob("application/zip").size===0}catch{o.blob=!1}}}try{o.nodestream=!!n("readable-stream").Readable}catch{o.nodestream=!1}},{"readable-stream":16}],31:[function(n,r,o){"use strict";for(var i=n("./utils"),s=n("./support"),a=n("./nodejsUtils"),l=n("./stream/GenericWorker"),u=new Array(256),d=0;d<256;d++)u[d]=252<=d?6:248<=d?5:240<=d?4:224<=d?3:192<=d?2:1;u[254]=u[254]=1;function f(){l.call(this,"utf-8 decode"),this.leftOver=null}function p(){l.call(this,"utf-8 encode")}o.utf8encode=function(g){return s.nodebuffer?a.newBufferFrom(g,"utf-8"):(function(m){var v,C,w,S,k,b=m.length,T=0;for(S=0;S<b;S++)(64512&(C=m.charCodeAt(S)))==55296&&S+1<b&&(64512&(w=m.charCodeAt(S+1)))==56320&&(C=65536+(C-55296<<10)+(w-56320),S++),T+=C<128?1:C<2048?2:C<65536?3:4;for(v=s.uint8array?new Uint8Array(T):new Array(T),S=k=0;k<T;S++)(64512&(C=m.charCodeAt(S)))==55296&&S+1<b&&(64512&(w=m.charCodeAt(S+1)))==56320&&(C=65536+(C-55296<<10)+(w-56320),S++),C<128?v[k++]=C:(C<2048?v[k++]=192|C>>>6:(C<65536?v[k++]=224|C>>>12:(v[k++]=240|C>>>18,v[k++]=128|C>>>12&63),v[k++]=128|C>>>6&63),v[k++]=128|63&C);return v})(g)},o.utf8decode=function(g){return s.nodebuffer?i.transformTo("nodebuffer",g).toString("utf-8"):(function(m){var v,C,w,S,k=m.length,b=new Array(2*k);for(v=C=0;v<k;)if((w=m[v++])<128)b[C++]=w;else if(4<(S=u[w]))b[C++]=65533,v+=S-1;else{for(w&=S===2?31:S===3?15:7;1<S&&v<k;)w=w<<6|63&m[v++],S--;1<S?b[C++]=65533:w<65536?b[C++]=w:(w-=65536,b[C++]=55296|w>>10&1023,b[C++]=56320|1023&w)}return b.length!==C&&(b.subarray?b=b.subarray(0,C):b.length=C),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 C=(function(S,k){var b;for((k=k||S.length)>S.length&&(k=S.length),b=k-1;0<=b&&(192&S[b])==128;)b--;return b<0||b===0?k:b+u[S[b]]>k?b:k})(m),w=m;C!==m.length&&(s.uint8array?(w=m.subarray(0,C),this.leftOver=m.subarray(C,m.length)):(w=m.slice(0,C),this.leftOver=m.slice(C,m.length))),this.push({data:o.utf8decode(w),meta:g.meta})},f.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:o.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},o.Utf8DecodeWorker=f,i.inherits(p,l),p.prototype.processChunk=function(g){this.push({data:o.utf8encode(g.data),meta:g.meta})},o.Utf8EncodeWorker=p},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(n,r,o){"use strict";var i=n("./support"),s=n("./base64"),a=n("./nodejsUtils"),l=n("./external");function u(v){return v}function d(v,C){for(var w=0;w<v.length;++w)C[w]=255&v.charCodeAt(w);return C}n("setimmediate"),o.newBlob=function(v,C){o.checkSupport("blob");try{return new Blob([v],{type:C})}catch{try{var w=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return w.append(v),w.getBlob(C)}catch{throw new Error("Bug : can't construct the Blob.")}}};var f={stringifyByChunk:function(v,C,w){var S=[],k=0,b=v.length;if(b<=w)return String.fromCharCode.apply(null,v);for(;k<b;)C==="array"||C==="nodebuffer"?S.push(String.fromCharCode.apply(null,v.slice(k,Math.min(k+w,b)))):S.push(String.fromCharCode.apply(null,v.subarray(k,Math.min(k+w,b)))),k+=w;return S.join("")},stringifyByChar:function(v){for(var C="",w=0;w<v.length;w++)C+=String.fromCharCode(v[w]);return C},applyCanBeUsed:{uint8array:(function(){try{return i.uint8array&&String.fromCharCode.apply(null,new Uint8Array(1)).length===1}catch{return!1}})(),nodebuffer:(function(){try{return i.nodebuffer&&String.fromCharCode.apply(null,a.allocBuffer(1)).length===1}catch{return!1}})()}};function p(v){var C=65536,w=o.getTypeOf(v),S=!0;if(w==="uint8array"?S=f.applyCanBeUsed.uint8array:w==="nodebuffer"&&(S=f.applyCanBeUsed.nodebuffer),S)for(;1<C;)try{return f.stringifyByChunk(v,w,C)}catch{C=Math.floor(C/2)}return f.stringifyByChar(v)}function g(v,C){for(var w=0;w<v.length;w++)C[w]=v[w];return C}o.applyFromCharCode=p;var m={};m.string={string:u,array:function(v){return d(v,new Array(v.length))},arraybuffer:function(v){return m.string.uint8array(v).buffer},uint8array:function(v){return d(v,new Uint8Array(v.length))},nodebuffer:function(v){return d(v,a.allocBuffer(v.length))}},m.array={string:p,array:u,arraybuffer:function(v){return new Uint8Array(v).buffer},uint8array:function(v){return new Uint8Array(v)},nodebuffer:function(v){return a.newBufferFrom(v)}},m.arraybuffer={string:function(v){return p(new Uint8Array(v))},array:function(v){return g(new Uint8Array(v),new Array(v.byteLength))},arraybuffer:u,uint8array:function(v){return new Uint8Array(v)},nodebuffer:function(v){return a.newBufferFrom(new Uint8Array(v))}},m.uint8array={string:p,array:function(v){return g(v,new Array(v.length))},arraybuffer:function(v){return v.buffer},uint8array:u,nodebuffer:function(v){return a.newBufferFrom(v)}},m.nodebuffer={string:p,array:function(v){return g(v,new Array(v.length))},arraybuffer:function(v){return m.nodebuffer.uint8array(v).buffer},uint8array:function(v){return g(v,new Uint8Array(v.length))},nodebuffer:u},o.transformTo=function(v,C){return C=C||"",v?(o.checkSupport(v),m[o.getTypeOf(C)][v](C)):C},o.resolve=function(v){for(var C=v.split("/"),w=[],S=0;S<C.length;S++){var k=C[S];k==="."||k===""&&S!==0&&S!==C.length-1||(k===".."?w.pop():w.push(k))}return w.join("/")},o.getTypeOf=function(v){return typeof v=="string"?"string":Object.prototype.toString.call(v)==="[object Array]"?"array":i.nodebuffer&&a.isBuffer(v)?"nodebuffer":i.uint8array&&v instanceof Uint8Array?"uint8array":i.arraybuffer&&v instanceof ArrayBuffer?"arraybuffer":void 0},o.checkSupport=function(v){if(!i[v.toLowerCase()])throw new Error(v+" is not supported by this platform")},o.MAX_VALUE_16BITS=65535,o.MAX_VALUE_32BITS=-1,o.pretty=function(v){var C,w,S="";for(w=0;w<(v||"").length;w++)S+="\\x"+((C=v.charCodeAt(w))<16?"0":"")+C.toString(16).toUpperCase();return S},o.delay=function(v,C,w){setImmediate(function(){v.apply(w||null,C||[])})},o.inherits=function(v,C){function w(){}w.prototype=C.prototype,v.prototype=new w},o.extend=function(){var v,C,w={};for(v=0;v<arguments.length;v++)for(C in arguments[v])Object.prototype.hasOwnProperty.call(arguments[v],C)&&w[C]===void 0&&(w[C]=arguments[v][C]);return w},o.prepareContent=function(v,C,w,S,k){return l.Promise.resolve(C).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 z=new FileReader;z.onload=function(G){T(G.target.result)},z.onerror=function(G){L(G.target.error)},z.readAsArrayBuffer(b)}):b}).then(function(b){var T=o.getTypeOf(b);return T?(T==="arraybuffer"?b=o.transformTo("uint8array",b):T==="string"&&(k?b=s.decode(b):w&&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"),u=n("./support");function d(f){this.files=[],this.loadOptions=f}d.prototype={checkSignature:function(f){if(!this.reader.readAndCheckSignature(f)){this.reader.index-=4;var p=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+s.pretty(p)+", expected "+s.pretty(f)+")")}},isSignature:function(f,p){var g=this.reader.index;this.reader.setIndex(f);var m=this.reader.readString(4)===p;return this.reader.setIndex(g),m},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var f=this.reader.readData(this.zipCommentLength),p=u.uint8array?"uint8array":"array",g=s.transformTo(p,f);this.zipComment=this.loadOptions.decodeFileName(g)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var f,p,g,m=this.zip64EndOfCentralSize-44;0<m;)f=this.reader.readInt(2),p=this.reader.readInt(4),g=this.reader.readData(p),this.zip64ExtensibleData[f]={id:f,length:p,value:g}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var f,p;for(f=0;f<this.files.length;f++)p=this.files[f],this.reader.setIndex(p.localHeaderOffset),this.checkSignature(a.LOCAL_FILE_HEADER),p.readLocalPart(this.reader),p.handleUTF8(),p.processAttributes()},readCentralDir:function(){var f;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(a.CENTRAL_FILE_HEADER);)(f=new l({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(f);if(this.centralDirRecords!==this.files.length&&this.centralDirRecords!==0&&this.files.length===0)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var f=this.reader.lastIndexOfSignature(a.CENTRAL_DIRECTORY_END);if(f<0)throw this.isSignature(0,a.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(f);var p=f;if(this.checkSignature(a.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===s.MAX_VALUE_16BITS||this.diskWithCentralDirStart===s.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===s.MAX_VALUE_16BITS||this.centralDirRecords===s.MAX_VALUE_16BITS||this.centralDirSize===s.MAX_VALUE_32BITS||this.centralDirOffset===s.MAX_VALUE_32BITS){if(this.zip64=!0,(f=this.reader.lastIndexOfSignature(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(f),this.checkSignature(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,a.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(a.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(a.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var g=this.centralDirOffset+this.centralDirSize;this.zip64&&(g+=20,g+=12+this.zip64EndOfCentralSize);var m=p-g;if(0<m)this.isSignature(p,a.CENTRAL_FILE_HEADER)||(this.reader.zero=m);else if(m<0)throw new Error("Corrupted zip: missing "+Math.abs(m)+" bytes.")},prepareReader:function(f){this.reader=i(f)},load:function(f){this.prepareReader(f),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},r.exports=d},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(n,r,o){"use strict";var i=n("./reader/readerFor"),s=n("./utils"),a=n("./compressedObject"),l=n("./crc32"),u=n("./utf8"),d=n("./compressions"),f=n("./support");function p(g,m){this.options=g,this.loadOptions=m}p.prototype={isEncrypted:function(){return(1&this.bitFlag)==1},useUTF8:function(){return(2048&this.bitFlag)==2048},readLocalPart:function(g){var m,v;if(g.skip(22),this.fileNameLength=g.readInt(2),v=g.readInt(2),this.fileName=g.readData(this.fileNameLength),g.skip(v),this.compressedSize===-1||this.uncompressedSize===-1)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if((m=(function(C){for(var w in d)if(Object.prototype.hasOwnProperty.call(d,w)&&d[w].magic===C)return d[w];return null})(this.compressionMethod))===null)throw new Error("Corrupted zip : compression "+s.pretty(this.compressionMethod)+" unknown (inner file : "+s.transformTo("string",this.fileName)+")");this.decompressed=new a(this.compressedSize,this.uncompressedSize,this.crc32,m,g.readData(this.compressedSize))},readCentralPart:function(g){this.versionMadeBy=g.readInt(2),g.skip(2),this.bitFlag=g.readInt(2),this.compressionMethod=g.readString(2),this.date=g.readDate(),this.crc32=g.readInt(4),this.compressedSize=g.readInt(4),this.uncompressedSize=g.readInt(4);var m=g.readInt(2);if(this.extraFieldsLength=g.readInt(2),this.fileCommentLength=g.readInt(2),this.diskNumberStart=g.readInt(2),this.internalFileAttributes=g.readInt(2),this.externalFileAttributes=g.readInt(4),this.localHeaderOffset=g.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");g.skip(m),this.readExtraFields(g),this.parseZIP64ExtraField(g),this.fileComment=g.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var g=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),g==0&&(this.dosPermissions=63&this.externalFileAttributes),g==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var g=i(this.extraFields[1].value);this.uncompressedSize===s.MAX_VALUE_32BITS&&(this.uncompressedSize=g.readInt(8)),this.compressedSize===s.MAX_VALUE_32BITS&&(this.compressedSize=g.readInt(8)),this.localHeaderOffset===s.MAX_VALUE_32BITS&&(this.localHeaderOffset=g.readInt(8)),this.diskNumberStart===s.MAX_VALUE_32BITS&&(this.diskNumberStart=g.readInt(4))}},readExtraFields:function(g){var m,v,C,w=g.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});g.index+4<w;)m=g.readInt(2),v=g.readInt(2),C=g.readData(v),this.extraFields[m]={id:m,length:v,value:C};g.setIndex(w)},handleUTF8:function(){var g=f.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=u.utf8decode(this.fileName),this.fileCommentStr=u.utf8decode(this.fileComment);else{var m=this.findExtraFieldUnicodePath();if(m!==null)this.fileNameStr=m;else{var v=s.transformTo(g,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(v)}var C=this.findExtraFieldUnicodeComment();if(C!==null)this.fileCommentStr=C;else{var w=s.transformTo(g,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(w)}}},findExtraFieldUnicodePath:function(){var g=this.extraFields[28789];if(g){var m=i(g.value);return m.readInt(1)!==1||l(this.fileName)!==m.readInt(4)?null:u.utf8decode(m.readData(g.length-5))}return null},findExtraFieldUnicodeComment:function(){var g=this.extraFields[25461];if(g){var m=i(g.value);return m.readInt(1)!==1||l(this.fileComment)!==m.readInt(4)?null:u.utf8decode(m.readData(g.length-5))}return null}},r.exports=p},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(n,r,o){"use strict";function i(m,v,C){this.name=m,this.dir=C.dir,this.date=C.date,this.comment=C.comment,this.unixPermissions=C.unixPermissions,this.dosPermissions=C.dosPermissions,this._data=v,this._dataBinary=C.binary,this.options={compression:C.compression,compressionOptions:C.compressionOptions}}var s=n("./stream/StreamHelper"),a=n("./stream/DataWorker"),l=n("./utf8"),u=n("./compressedObject"),d=n("./stream/GenericWorker");i.prototype={internalStream:function(m){var v=null,C="string";try{if(!m)throw new Error("No output type specified.");var w=(C=m.toLowerCase())==="string"||C==="text";C!=="binarystring"&&C!=="text"||(C="string"),v=this._decompressWorker();var S=!this._dataBinary;S&&!w&&(v=v.pipe(new l.Utf8EncodeWorker)),!S&&w&&(v=v.pipe(new l.Utf8DecodeWorker))}catch(k){(v=new d("error")).error(k)}return new s(v,C,"")},async:function(m,v){return this.internalStream(m).accumulate(v)},nodeStream:function(m,v){return this.internalStream(m||"nodebuffer").toNodejsStream(v)},_compressWorker:function(m,v){if(this._data instanceof u&&this._data.compression.magic===m.magic)return this._data.getCompressedWorker();var C=this._decompressWorker();return this._dataBinary||(C=C.pipe(new l.Utf8EncodeWorker)),u.createWorkerFrom(C,m,v)},_decompressWorker:function(){return this._data instanceof u?this._data.getContentWorker():this._data instanceof d?this._data:new a(this._data)}};for(var f=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],p=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},g=0;g<f.length;g++)i.prototype[f[g]]=p;r.exports=i},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(n,r,o){(function(i){"use strict";var s,a,l=i.MutationObserver||i.WebKitMutationObserver;if(l){var u=0,d=new l(m),f=i.document.createTextNode("");d.observe(f,{characterData:!0}),s=function(){f.data=u=++u%2}}else if(i.setImmediate||i.MessageChannel===void 0)s="document"in i&&"onreadystatechange"in i.document.createElement("script")?function(){var v=i.document.createElement("script");v.onreadystatechange=function(){m(),v.onreadystatechange=null,v.parentNode.removeChild(v),v=null},i.document.documentElement.appendChild(v)}:function(){setTimeout(m,0)};else{var p=new i.MessageChannel;p.port1.onmessage=m,s=function(){p.port2.postMessage(0)}}var g=[];function m(){var v,C;a=!0;for(var w=g.length;w;){for(C=g,g=[],v=-1;++v<w;)C[v]();w=g.length}a=!1}r.exports=function(v){g.push(v)!==1||a||s()}}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}],37:[function(n,r,o){"use strict";var i=n("immediate");function s(){}var a={},l=["REJECTED"],u=["FULFILLED"],d=["PENDING"];function f(w){if(typeof w!="function")throw new TypeError("resolver must be a function");this.state=d,this.queue=[],this.outcome=void 0,w!==s&&v(this,w)}function p(w,S,k){this.promise=w,typeof S=="function"&&(this.onFulfilled=S,this.callFulfilled=this.otherCallFulfilled),typeof k=="function"&&(this.onRejected=k,this.callRejected=this.otherCallRejected)}function g(w,S,k){i(function(){var b;try{b=S(k)}catch(T){return a.reject(w,T)}b===w?a.reject(w,new TypeError("Cannot resolve promise with itself")):a.resolve(w,b)})}function m(w){var S=w&&w.then;if(w&&(typeof w=="object"||typeof w=="function")&&typeof S=="function")return function(){S.apply(w,arguments)}}function v(w,S){var k=!1;function b(z){k||(k=!0,a.reject(w,z))}function T(z){k||(k=!0,a.resolve(w,z))}var L=C(function(){S(T,b)});L.status==="error"&&b(L.value)}function C(w,S){var k={};try{k.value=w(S),k.status="success"}catch(b){k.status="error",k.value=b}return k}(r.exports=f).prototype.finally=function(w){if(typeof w!="function")return this;var S=this.constructor;return this.then(function(k){return S.resolve(w()).then(function(){return k})},function(k){return S.resolve(w()).then(function(){throw k})})},f.prototype.catch=function(w){return this.then(null,w)},f.prototype.then=function(w,S){if(typeof w!="function"&&this.state===u||typeof S!="function"&&this.state===l)return this;var k=new this.constructor(s);return this.state!==d?g(k,this.state===u?w:S,this.outcome):this.queue.push(new p(k,w,S)),k},p.prototype.callFulfilled=function(w){a.resolve(this.promise,w)},p.prototype.otherCallFulfilled=function(w){g(this.promise,this.onFulfilled,w)},p.prototype.callRejected=function(w){a.reject(this.promise,w)},p.prototype.otherCallRejected=function(w){g(this.promise,this.onRejected,w)},a.resolve=function(w,S){var k=C(m,S);if(k.status==="error")return a.reject(w,k.value);var b=k.value;if(b)v(w,b);else{w.state=u,w.outcome=S;for(var T=-1,L=w.queue.length;++T<L;)w.queue[T].callFulfilled(S)}return w},a.reject=function(w,S){w.state=l,w.outcome=S;for(var k=-1,b=w.queue.length;++k<b;)w.queue[k].callRejected(S);return w},f.resolve=function(w){return w instanceof this?w:a.resolve(new this(s),w)},f.reject=function(w){var S=new this(s);return a.reject(S,w)},f.all=function(w){var S=this;if(Object.prototype.toString.call(w)!=="[object Array]")return this.reject(new TypeError("must be an array"));var k=w.length,b=!1;if(!k)return this.resolve([]);for(var T=new Array(k),L=0,z=-1,G=new this(s);++z<k;)U(w[z],z);return G;function U(j,Z){S.resolve(j).then(function(R){T[Z]=R,++L!==k||b||(b=!0,a.resolve(G,T))},function(R){b||(b=!0,a.reject(G,R))})}},f.race=function(w){var S=this;if(Object.prototype.toString.call(w)!=="[object Array]")return this.reject(new TypeError("must be an array"));var k=w.length,b=!1;if(!k)return this.resolve([]);for(var T=-1,L=new this(s);++T<k;)z=w[T],S.resolve(z).then(function(G){b||(b=!0,a.resolve(L,G))},function(G){b||(b=!0,a.reject(L,G))});var z;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"),u=n("./zlib/zstream"),d=Object.prototype.toString,f=0,p=-1,g=0,m=8;function v(w){if(!(this instanceof v))return new v(w);this.options=s.assign({level:p,method:m,chunkSize:16384,windowBits:15,memLevel:8,strategy:g,to:""},w||{});var S=this.options;S.raw&&0<S.windowBits?S.windowBits=-S.windowBits:S.gzip&&0<S.windowBits&&S.windowBits<16&&(S.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new u,this.strm.avail_out=0;var k=i.deflateInit2(this.strm,S.level,S.method,S.windowBits,S.memLevel,S.strategy);if(k!==f)throw new Error(l[k]);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,(k=i.deflateSetDictionary(this.strm,b))!==f)throw new Error(l[k]);this._dict_set=!0}}function C(w,S){var k=new v(S);if(k.push(w,!0),k.err)throw k.msg||l[k.err];return k.result}v.prototype.push=function(w,S){var k,b,T=this.strm,L=this.options.chunkSize;if(this.ended)return!1;b=S===~~S?S:S===!0?4:0,typeof w=="string"?T.input=a.string2buf(w):d.call(w)==="[object ArrayBuffer]"?T.input=new Uint8Array(w):T.input=w,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),(k=i.deflate(T,b))!==1&&k!==f)return this.onEnd(k),!(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)&&k!==1);return b===4?(k=i.deflateEnd(this.strm),this.onEnd(k),this.ended=!0,k===f):b!==2||(this.onEnd(f),!(T.avail_out=0))},v.prototype.onData=function(w){this.chunks.push(w)},v.prototype.onEnd=function(w){w===f&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=s.flattenChunks(this.chunks)),this.chunks=[],this.err=w,this.msg=this.strm.msg},o.Deflate=v,o.deflate=C,o.deflateRaw=function(w,S){return(S=S||{}).raw=!0,C(w,S)},o.gzip=function(w,S){return(S=S||{}).gzip=!0,C(w,S)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(n,r,o){"use strict";var i=n("./zlib/inflate"),s=n("./utils/common"),a=n("./utils/strings"),l=n("./zlib/constants"),u=n("./zlib/messages"),d=n("./zlib/zstream"),f=n("./zlib/gzheader"),p=Object.prototype.toString;function g(v){if(!(this instanceof g))return new g(v);this.options=s.assign({chunkSize:16384,windowBits:0,to:""},v||{});var C=this.options;C.raw&&0<=C.windowBits&&C.windowBits<16&&(C.windowBits=-C.windowBits,C.windowBits===0&&(C.windowBits=-15)),!(0<=C.windowBits&&C.windowBits<16)||v&&v.windowBits||(C.windowBits+=32),15<C.windowBits&&C.windowBits<48&&(15&C.windowBits)==0&&(C.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new d,this.strm.avail_out=0;var w=i.inflateInit2(this.strm,C.windowBits);if(w!==l.Z_OK)throw new Error(u[w]);this.header=new f,i.inflateGetHeader(this.strm,this.header)}function m(v,C){var w=new g(C);if(w.push(v,!0),w.err)throw w.msg||u[w.err];return w.result}g.prototype.push=function(v,C){var w,S,k,b,T,L,z=this.strm,G=this.options.chunkSize,U=this.options.dictionary,j=!1;if(this.ended)return!1;S=C===~~C?C:C===!0?l.Z_FINISH:l.Z_NO_FLUSH,typeof v=="string"?z.input=a.binstring2buf(v):p.call(v)==="[object ArrayBuffer]"?z.input=new Uint8Array(v):z.input=v,z.next_in=0,z.avail_in=z.input.length;do{if(z.avail_out===0&&(z.output=new s.Buf8(G),z.next_out=0,z.avail_out=G),(w=i.inflate(z,l.Z_NO_FLUSH))===l.Z_NEED_DICT&&U&&(L=typeof U=="string"?a.string2buf(U):p.call(U)==="[object ArrayBuffer]"?new Uint8Array(U):U,w=i.inflateSetDictionary(this.strm,L)),w===l.Z_BUF_ERROR&&j===!0&&(w=l.Z_OK,j=!1),w!==l.Z_STREAM_END&&w!==l.Z_OK)return this.onEnd(w),!(this.ended=!0);z.next_out&&(z.avail_out!==0&&w!==l.Z_STREAM_END&&(z.avail_in!==0||S!==l.Z_FINISH&&S!==l.Z_SYNC_FLUSH)||(this.options.to==="string"?(k=a.utf8border(z.output,z.next_out),b=z.next_out-k,T=a.buf2string(z.output,k),z.next_out=b,z.avail_out=G-b,b&&s.arraySet(z.output,z.output,k,b,0),this.onData(T)):this.onData(s.shrinkBuf(z.output,z.next_out)))),z.avail_in===0&&z.avail_out===0&&(j=!0)}while((0<z.avail_in||z.avail_out===0)&&w!==l.Z_STREAM_END);return w===l.Z_STREAM_END&&(S=l.Z_FINISH),S===l.Z_FINISH?(w=i.inflateEnd(this.strm),this.onEnd(w),this.ended=!0,w===l.Z_OK):S!==l.Z_SYNC_FLUSH||(this.onEnd(l.Z_OK),!(z.avail_out=0))},g.prototype.onData=function(v){this.chunks.push(v)},g.prototype.onEnd=function(v){v===l.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=s.flattenChunks(this.chunks)),this.chunks=[],this.err=v,this.msg=this.strm.msg},o.Inflate=g,o.inflate=m,o.inflateRaw=function(v,C){return(C=C||{}).raw=!0,m(v,C)},o.ungzip=m},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(n,r,o){"use strict";var i=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";o.assign=function(l){for(var u=Array.prototype.slice.call(arguments,1);u.length;){var d=u.shift();if(d){if(typeof d!="object")throw new TypeError(d+"must be non-object");for(var f in d)d.hasOwnProperty(f)&&(l[f]=d[f])}}return l},o.shrinkBuf=function(l,u){return l.length===u?l:l.subarray?l.subarray(0,u):(l.length=u,l)};var s={arraySet:function(l,u,d,f,p){if(u.subarray&&l.subarray)l.set(u.subarray(d,d+f),p);else for(var g=0;g<f;g++)l[p+g]=u[d+g]},flattenChunks:function(l){var u,d,f,p,g,m;for(u=f=0,d=l.length;u<d;u++)f+=l[u].length;for(m=new Uint8Array(f),u=p=0,d=l.length;u<d;u++)g=l[u],m.set(g,p),p+=g.length;return m}},a={arraySet:function(l,u,d,f,p){for(var g=0;g<f;g++)l[p+g]=u[d+g]},flattenChunks:function(l){return[].concat.apply([],l)}};o.setTyped=function(l){l?(o.Buf8=Uint8Array,o.Buf16=Uint16Array,o.Buf32=Int32Array,o.assign(o,s)):(o.Buf8=Array,o.Buf16=Array,o.Buf32=Array,o.assign(o,a))},o.setTyped(i)},{}],42:[function(n,r,o){"use strict";var i=n("./common"),s=!0,a=!0;try{String.fromCharCode.apply(null,[0])}catch{s=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{a=!1}for(var l=new i.Buf8(256),u=0;u<256;u++)l[u]=252<=u?6:248<=u?5:240<=u?4:224<=u?3:192<=u?2:1;function d(f,p){if(p<65537&&(f.subarray&&a||!f.subarray&&s))return String.fromCharCode.apply(null,i.shrinkBuf(f,p));for(var g="",m=0;m<p;m++)g+=String.fromCharCode(f[m]);return g}l[254]=l[254]=1,o.string2buf=function(f){var p,g,m,v,C,w=f.length,S=0;for(v=0;v<w;v++)(64512&(g=f.charCodeAt(v)))==55296&&v+1<w&&(64512&(m=f.charCodeAt(v+1)))==56320&&(g=65536+(g-55296<<10)+(m-56320),v++),S+=g<128?1:g<2048?2:g<65536?3:4;for(p=new i.Buf8(S),v=C=0;C<S;v++)(64512&(g=f.charCodeAt(v)))==55296&&v+1<w&&(64512&(m=f.charCodeAt(v+1)))==56320&&(g=65536+(g-55296<<10)+(m-56320),v++),g<128?p[C++]=g:(g<2048?p[C++]=192|g>>>6:(g<65536?p[C++]=224|g>>>12:(p[C++]=240|g>>>18,p[C++]=128|g>>>12&63),p[C++]=128|g>>>6&63),p[C++]=128|63&g);return p},o.buf2binstring=function(f){return d(f,f.length)},o.binstring2buf=function(f){for(var p=new i.Buf8(f.length),g=0,m=p.length;g<m;g++)p[g]=f.charCodeAt(g);return p},o.buf2string=function(f,p){var g,m,v,C,w=p||f.length,S=new Array(2*w);for(g=m=0;g<w;)if((v=f[g++])<128)S[m++]=v;else if(4<(C=l[v]))S[m++]=65533,g+=C-1;else{for(v&=C===2?31:C===3?15:7;1<C&&g<w;)v=v<<6|63&f[g++],C--;1<C?S[m++]=65533:v<65536?S[m++]=v:(v-=65536,S[m++]=55296|v>>10&1023,S[m++]=56320|1023&v)}return d(S,m)},o.utf8border=function(f,p){var g;for((p=p||f.length)>f.length&&(p=f.length),g=p-1;0<=g&&(192&f[g])==128;)g--;return g<0||g===0?p:g+l[f[g]]>p?g:p}},{"./common":41}],43:[function(n,r,o){"use strict";r.exports=function(i,s,a,l){for(var u=65535&i|0,d=i>>>16&65535|0,f=0;a!==0;){for(a-=f=2e3<a?2e3:a;d=d+(u=u+s[l++]|0)|0,--f;);u%=65521,d%=65521}return u|d<<16|0}},{}],44:[function(n,r,o){"use strict";r.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(n,r,o){"use strict";var i=(function(){for(var s,a=[],l=0;l<256;l++){s=l;for(var u=0;u<8;u++)s=1&s?3988292384^s>>>1:s>>>1;a[l]=s}return a})();r.exports=function(s,a,l,u){var d=i,f=u+l;s^=-1;for(var p=u;p<f;p++)s=s>>>8^d[255&(s^a[p])];return-1^s}},{}],46:[function(n,r,o){"use strict";var i,s=n("../utils/common"),a=n("./trees"),l=n("./adler32"),u=n("./crc32"),d=n("./messages"),f=0,p=4,g=0,m=-2,v=-1,C=4,w=2,S=8,k=9,b=286,T=30,L=19,z=2*b+1,G=15,U=3,j=258,Z=j+U+1,R=42,K=113,x=1,W=2,$=3,J=4;function Q(I,se){return I.msg=d[se],se}function Y(I){return(I<<1)-(4<I?9:0)}function Ce(I){for(var se=I.length;0<=--se;)I[se]=0}function fe(I){var se=I.state,N=se.pending;N>I.avail_out&&(N=I.avail_out),N!==0&&(s.arraySet(I.output,se.pending_buf,se.pending_out,N,I.next_out),I.next_out+=N,se.pending_out+=N,I.total_out+=N,I.avail_out-=N,se.pending-=N,se.pending===0&&(se.pending_out=0))}function ve(I,se){a._tr_flush_block(I,0<=I.block_start?I.block_start:-1,I.strstart-I.block_start,se),I.block_start=I.strstart,fe(I.strm)}function me(I,se){I.pending_buf[I.pending++]=se}function Ee(I,se){I.pending_buf[I.pending++]=se>>>8&255,I.pending_buf[I.pending++]=255&se}function Fe(I,se){var N,q,O=I.max_chain_length,ee=I.strstart,ye=I.prev_length,P=I.nice_match,B=I.strstart>I.w_size-Z?I.strstart-(I.w_size-Z):0,ce=I.window,_e=I.w_mask,Ae=I.prev,De=I.strstart+j,Ye=ce[ee+ye-1],ot=ce[ee+ye];I.prev_length>=I.good_match&&(O>>=2),P>I.lookahead&&(P=I.lookahead);do if(ce[(N=se)+ye]===ot&&ce[N+ye-1]===Ye&&ce[N]===ce[ee]&&ce[++N]===ce[ee+1]){ee+=2,N++;do;while(ce[++ee]===ce[++N]&&ce[++ee]===ce[++N]&&ce[++ee]===ce[++N]&&ce[++ee]===ce[++N]&&ce[++ee]===ce[++N]&&ce[++ee]===ce[++N]&&ce[++ee]===ce[++N]&&ce[++ee]===ce[++N]&&ee<De);if(q=j-(De-ee),ee=De-j,ye<q){if(I.match_start=se,P<=(ye=q))break;Ye=ce[ee+ye-1],ot=ce[ee+ye]}}while((se=Ae[se&_e])>B&&--O!=0);return ye<=I.lookahead?ye:I.lookahead}function Ze(I){var se,N,q,O,ee,ye,P,B,ce,_e,Ae=I.w_size;do{if(O=I.window_size-I.lookahead-I.strstart,I.strstart>=Ae+(Ae-Z)){for(s.arraySet(I.window,I.window,Ae,Ae,0),I.match_start-=Ae,I.strstart-=Ae,I.block_start-=Ae,se=N=I.hash_size;q=I.head[--se],I.head[se]=Ae<=q?q-Ae:0,--N;);for(se=N=Ae;q=I.prev[--se],I.prev[se]=Ae<=q?q-Ae:0,--N;);O+=Ae}if(I.strm.avail_in===0)break;if(ye=I.strm,P=I.window,B=I.strstart+I.lookahead,ce=O,_e=void 0,_e=ye.avail_in,ce<_e&&(_e=ce),N=_e===0?0:(ye.avail_in-=_e,s.arraySet(P,ye.input,ye.next_in,_e,B),ye.state.wrap===1?ye.adler=l(ye.adler,P,_e,B):ye.state.wrap===2&&(ye.adler=u(ye.adler,P,_e,B)),ye.next_in+=_e,ye.total_in+=_e,_e),I.lookahead+=N,I.lookahead+I.insert>=U)for(ee=I.strstart-I.insert,I.ins_h=I.window[ee],I.ins_h=(I.ins_h<<I.hash_shift^I.window[ee+1])&I.hash_mask;I.insert&&(I.ins_h=(I.ins_h<<I.hash_shift^I.window[ee+U-1])&I.hash_mask,I.prev[ee&I.w_mask]=I.head[I.ins_h],I.head[I.ins_h]=ee,ee++,I.insert--,!(I.lookahead+I.insert<U)););}while(I.lookahead<Z&&I.strm.avail_in!==0)}function lt(I,se){for(var N,q;;){if(I.lookahead<Z){if(Ze(I),I.lookahead<Z&&se===f)return x;if(I.lookahead===0)break}if(N=0,I.lookahead>=U&&(I.ins_h=(I.ins_h<<I.hash_shift^I.window[I.strstart+U-1])&I.hash_mask,N=I.prev[I.strstart&I.w_mask]=I.head[I.ins_h],I.head[I.ins_h]=I.strstart),N!==0&&I.strstart-N<=I.w_size-Z&&(I.match_length=Fe(I,N)),I.match_length>=U)if(q=a._tr_tally(I,I.strstart-I.match_start,I.match_length-U),I.lookahead-=I.match_length,I.match_length<=I.max_lazy_match&&I.lookahead>=U){for(I.match_length--;I.strstart++,I.ins_h=(I.ins_h<<I.hash_shift^I.window[I.strstart+U-1])&I.hash_mask,N=I.prev[I.strstart&I.w_mask]=I.head[I.ins_h],I.head[I.ins_h]=I.strstart,--I.match_length!=0;);I.strstart++}else I.strstart+=I.match_length,I.match_length=0,I.ins_h=I.window[I.strstart],I.ins_h=(I.ins_h<<I.hash_shift^I.window[I.strstart+1])&I.hash_mask;else q=a._tr_tally(I,0,I.window[I.strstart]),I.lookahead--,I.strstart++;if(q&&(ve(I,!1),I.strm.avail_out===0))return x}return I.insert=I.strstart<U-1?I.strstart:U-1,se===p?(ve(I,!0),I.strm.avail_out===0?$:J):I.last_lit&&(ve(I,!1),I.strm.avail_out===0)?x:W}function et(I,se){for(var N,q,O;;){if(I.lookahead<Z){if(Ze(I),I.lookahead<Z&&se===f)return x;if(I.lookahead===0)break}if(N=0,I.lookahead>=U&&(I.ins_h=(I.ins_h<<I.hash_shift^I.window[I.strstart+U-1])&I.hash_mask,N=I.prev[I.strstart&I.w_mask]=I.head[I.ins_h],I.head[I.ins_h]=I.strstart),I.prev_length=I.match_length,I.prev_match=I.match_start,I.match_length=U-1,N!==0&&I.prev_length<I.max_lazy_match&&I.strstart-N<=I.w_size-Z&&(I.match_length=Fe(I,N),I.match_length<=5&&(I.strategy===1||I.match_length===U&&4096<I.strstart-I.match_start)&&(I.match_length=U-1)),I.prev_length>=U&&I.match_length<=I.prev_length){for(O=I.strstart+I.lookahead-U,q=a._tr_tally(I,I.strstart-1-I.prev_match,I.prev_length-U),I.lookahead-=I.prev_length-1,I.prev_length-=2;++I.strstart<=O&&(I.ins_h=(I.ins_h<<I.hash_shift^I.window[I.strstart+U-1])&I.hash_mask,N=I.prev[I.strstart&I.w_mask]=I.head[I.ins_h],I.head[I.ins_h]=I.strstart),--I.prev_length!=0;);if(I.match_available=0,I.match_length=U-1,I.strstart++,q&&(ve(I,!1),I.strm.avail_out===0))return x}else if(I.match_available){if((q=a._tr_tally(I,0,I.window[I.strstart-1]))&&ve(I,!1),I.strstart++,I.lookahead--,I.strm.avail_out===0)return x}else I.match_available=1,I.strstart++,I.lookahead--}return I.match_available&&(q=a._tr_tally(I,0,I.window[I.strstart-1]),I.match_available=0),I.insert=I.strstart<U-1?I.strstart:U-1,se===p?(ve(I,!0),I.strm.avail_out===0?$:J):I.last_lit&&(ve(I,!1),I.strm.avail_out===0)?x:W}function Et(I,se,N,q,O){this.good_length=I,this.max_lazy=se,this.nice_length=N,this.max_chain=q,this.func=O}function ae(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=S,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new s.Buf16(2*z),this.dyn_dtree=new s.Buf16(2*(2*T+1)),this.bl_tree=new s.Buf16(2*(2*L+1)),Ce(this.dyn_ltree),Ce(this.dyn_dtree),Ce(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new s.Buf16(G+1),this.heap=new s.Buf16(2*b+1),Ce(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new s.Buf16(2*b+1),Ce(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(I){var se;return I&&I.state?(I.total_in=I.total_out=0,I.data_type=w,(se=I.state).pending=0,se.pending_out=0,se.wrap<0&&(se.wrap=-se.wrap),se.status=se.wrap?R:K,I.adler=se.wrap===2?0:1,se.last_flush=f,a._tr_init(se),g):Q(I,m)}function He(I){var se=Ie(I);return se===g&&(function(N){N.window_size=2*N.w_size,Ce(N.head),N.max_lazy_match=i[N.level].max_lazy,N.good_match=i[N.level].good_length,N.nice_match=i[N.level].nice_length,N.max_chain_length=i[N.level].max_chain,N.strstart=0,N.block_start=0,N.lookahead=0,N.insert=0,N.match_length=N.prev_length=U-1,N.match_available=0,N.ins_h=0})(I.state),se}function re(I,se,N,q,O,ee){if(!I)return m;var ye=1;if(se===v&&(se=6),q<0?(ye=0,q=-q):15<q&&(ye=2,q-=16),O<1||k<O||N!==S||q<8||15<q||se<0||9<se||ee<0||C<ee)return Q(I,m);q===8&&(q=9);var P=new ae;return(I.state=P).strm=I,P.wrap=ye,P.gzhead=null,P.w_bits=q,P.w_size=1<<P.w_bits,P.w_mask=P.w_size-1,P.hash_bits=O+7,P.hash_size=1<<P.hash_bits,P.hash_mask=P.hash_size-1,P.hash_shift=~~((P.hash_bits+U-1)/U),P.window=new s.Buf8(2*P.w_size),P.head=new s.Buf16(P.hash_size),P.prev=new s.Buf16(P.w_size),P.lit_bufsize=1<<O+6,P.pending_buf_size=4*P.lit_bufsize,P.pending_buf=new s.Buf8(P.pending_buf_size),P.d_buf=1*P.lit_bufsize,P.l_buf=3*P.lit_bufsize,P.level=se,P.strategy=ee,P.method=N,He(I)}i=[new Et(0,0,0,0,function(I,se){var N=65535;for(N>I.pending_buf_size-5&&(N=I.pending_buf_size-5);;){if(I.lookahead<=1){if(Ze(I),I.lookahead===0&&se===f)return x;if(I.lookahead===0)break}I.strstart+=I.lookahead,I.lookahead=0;var q=I.block_start+N;if((I.strstart===0||I.strstart>=q)&&(I.lookahead=I.strstart-q,I.strstart=q,ve(I,!1),I.strm.avail_out===0)||I.strstart-I.block_start>=I.w_size-Z&&(ve(I,!1),I.strm.avail_out===0))return x}return I.insert=0,se===p?(ve(I,!0),I.strm.avail_out===0?$:J):(I.strstart>I.block_start&&(ve(I,!1),I.strm.avail_out),x)}),new Et(4,4,8,4,lt),new Et(4,5,16,8,lt),new Et(4,6,32,32,lt),new Et(4,4,16,16,et),new Et(8,16,32,32,et),new Et(8,16,128,128,et),new Et(8,32,128,256,et),new Et(32,128,258,1024,et),new Et(32,258,258,4096,et)],o.deflateInit=function(I,se){return re(I,se,S,15,8,0)},o.deflateInit2=re,o.deflateReset=He,o.deflateResetKeep=Ie,o.deflateSetHeader=function(I,se){return I&&I.state?I.state.wrap!==2?m:(I.state.gzhead=se,g):m},o.deflate=function(I,se){var N,q,O,ee;if(!I||!I.state||5<se||se<0)return I?Q(I,m):m;if(q=I.state,!I.output||!I.input&&I.avail_in!==0||q.status===666&&se!==p)return Q(I,I.avail_out===0?-5:m);if(q.strm=I,N=q.last_flush,q.last_flush=se,q.status===R)if(q.wrap===2)I.adler=0,me(q,31),me(q,139),me(q,8),q.gzhead?(me(q,(q.gzhead.text?1:0)+(q.gzhead.hcrc?2:0)+(q.gzhead.extra?4:0)+(q.gzhead.name?8:0)+(q.gzhead.comment?16:0)),me(q,255&q.gzhead.time),me(q,q.gzhead.time>>8&255),me(q,q.gzhead.time>>16&255),me(q,q.gzhead.time>>24&255),me(q,q.level===9?2:2<=q.strategy||q.level<2?4:0),me(q,255&q.gzhead.os),q.gzhead.extra&&q.gzhead.extra.length&&(me(q,255&q.gzhead.extra.length),me(q,q.gzhead.extra.length>>8&255)),q.gzhead.hcrc&&(I.adler=u(I.adler,q.pending_buf,q.pending,0)),q.gzindex=0,q.status=69):(me(q,0),me(q,0),me(q,0),me(q,0),me(q,0),me(q,q.level===9?2:2<=q.strategy||q.level<2?4:0),me(q,3),q.status=K);else{var ye=S+(q.w_bits-8<<4)<<8;ye|=(2<=q.strategy||q.level<2?0:q.level<6?1:q.level===6?2:3)<<6,q.strstart!==0&&(ye|=32),ye+=31-ye%31,q.status=K,Ee(q,ye),q.strstart!==0&&(Ee(q,I.adler>>>16),Ee(q,65535&I.adler)),I.adler=1}if(q.status===69)if(q.gzhead.extra){for(O=q.pending;q.gzindex<(65535&q.gzhead.extra.length)&&(q.pending!==q.pending_buf_size||(q.gzhead.hcrc&&q.pending>O&&(I.adler=u(I.adler,q.pending_buf,q.pending-O,O)),fe(I),O=q.pending,q.pending!==q.pending_buf_size));)me(q,255&q.gzhead.extra[q.gzindex]),q.gzindex++;q.gzhead.hcrc&&q.pending>O&&(I.adler=u(I.adler,q.pending_buf,q.pending-O,O)),q.gzindex===q.gzhead.extra.length&&(q.gzindex=0,q.status=73)}else q.status=73;if(q.status===73)if(q.gzhead.name){O=q.pending;do{if(q.pending===q.pending_buf_size&&(q.gzhead.hcrc&&q.pending>O&&(I.adler=u(I.adler,q.pending_buf,q.pending-O,O)),fe(I),O=q.pending,q.pending===q.pending_buf_size)){ee=1;break}ee=q.gzindex<q.gzhead.name.length?255&q.gzhead.name.charCodeAt(q.gzindex++):0,me(q,ee)}while(ee!==0);q.gzhead.hcrc&&q.pending>O&&(I.adler=u(I.adler,q.pending_buf,q.pending-O,O)),ee===0&&(q.gzindex=0,q.status=91)}else q.status=91;if(q.status===91)if(q.gzhead.comment){O=q.pending;do{if(q.pending===q.pending_buf_size&&(q.gzhead.hcrc&&q.pending>O&&(I.adler=u(I.adler,q.pending_buf,q.pending-O,O)),fe(I),O=q.pending,q.pending===q.pending_buf_size)){ee=1;break}ee=q.gzindex<q.gzhead.comment.length?255&q.gzhead.comment.charCodeAt(q.gzindex++):0,me(q,ee)}while(ee!==0);q.gzhead.hcrc&&q.pending>O&&(I.adler=u(I.adler,q.pending_buf,q.pending-O,O)),ee===0&&(q.status=103)}else q.status=103;if(q.status===103&&(q.gzhead.hcrc?(q.pending+2>q.pending_buf_size&&fe(I),q.pending+2<=q.pending_buf_size&&(me(q,255&I.adler),me(q,I.adler>>8&255),I.adler=0,q.status=K)):q.status=K),q.pending!==0){if(fe(I),I.avail_out===0)return q.last_flush=-1,g}else if(I.avail_in===0&&Y(se)<=Y(N)&&se!==p)return Q(I,-5);if(q.status===666&&I.avail_in!==0)return Q(I,-5);if(I.avail_in!==0||q.lookahead!==0||se!==f&&q.status!==666){var P=q.strategy===2?(function(B,ce){for(var _e;;){if(B.lookahead===0&&(Ze(B),B.lookahead===0)){if(ce===f)return x;break}if(B.match_length=0,_e=a._tr_tally(B,0,B.window[B.strstart]),B.lookahead--,B.strstart++,_e&&(ve(B,!1),B.strm.avail_out===0))return x}return B.insert=0,ce===p?(ve(B,!0),B.strm.avail_out===0?$:J):B.last_lit&&(ve(B,!1),B.strm.avail_out===0)?x:W})(q,se):q.strategy===3?(function(B,ce){for(var _e,Ae,De,Ye,ot=B.window;;){if(B.lookahead<=j){if(Ze(B),B.lookahead<=j&&ce===f)return x;if(B.lookahead===0)break}if(B.match_length=0,B.lookahead>=U&&0<B.strstart&&(Ae=ot[De=B.strstart-1])===ot[++De]&&Ae===ot[++De]&&Ae===ot[++De]){Ye=B.strstart+j;do;while(Ae===ot[++De]&&Ae===ot[++De]&&Ae===ot[++De]&&Ae===ot[++De]&&Ae===ot[++De]&&Ae===ot[++De]&&Ae===ot[++De]&&Ae===ot[++De]&&De<Ye);B.match_length=j-(Ye-De),B.match_length>B.lookahead&&(B.match_length=B.lookahead)}if(B.match_length>=U?(_e=a._tr_tally(B,1,B.match_length-U),B.lookahead-=B.match_length,B.strstart+=B.match_length,B.match_length=0):(_e=a._tr_tally(B,0,B.window[B.strstart]),B.lookahead--,B.strstart++),_e&&(ve(B,!1),B.strm.avail_out===0))return x}return B.insert=0,ce===p?(ve(B,!0),B.strm.avail_out===0?$:J):B.last_lit&&(ve(B,!1),B.strm.avail_out===0)?x:W})(q,se):i[q.level].func(q,se);if(P!==$&&P!==J||(q.status=666),P===x||P===$)return I.avail_out===0&&(q.last_flush=-1),g;if(P===W&&(se===1?a._tr_align(q):se!==5&&(a._tr_stored_block(q,0,0,!1),se===3&&(Ce(q.head),q.lookahead===0&&(q.strstart=0,q.block_start=0,q.insert=0))),fe(I),I.avail_out===0))return q.last_flush=-1,g}return se!==p?g:q.wrap<=0?1:(q.wrap===2?(me(q,255&I.adler),me(q,I.adler>>8&255),me(q,I.adler>>16&255),me(q,I.adler>>24&255),me(q,255&I.total_in),me(q,I.total_in>>8&255),me(q,I.total_in>>16&255),me(q,I.total_in>>24&255)):(Ee(q,I.adler>>>16),Ee(q,65535&I.adler)),fe(I),0<q.wrap&&(q.wrap=-q.wrap),q.pending!==0?g:1)},o.deflateEnd=function(I){var se;return I&&I.state?(se=I.state.status)!==R&&se!==69&&se!==73&&se!==91&&se!==103&&se!==K&&se!==666?Q(I,m):(I.state=null,se===K?Q(I,-3):g):m},o.deflateSetDictionary=function(I,se){var N,q,O,ee,ye,P,B,ce,_e=se.length;if(!I||!I.state||(ee=(N=I.state).wrap)===2||ee===1&&N.status!==R||N.lookahead)return m;for(ee===1&&(I.adler=l(I.adler,se,_e,0)),N.wrap=0,_e>=N.w_size&&(ee===0&&(Ce(N.head),N.strstart=0,N.block_start=0,N.insert=0),ce=new s.Buf8(N.w_size),s.arraySet(ce,se,_e-N.w_size,N.w_size,0),se=ce,_e=N.w_size),ye=I.avail_in,P=I.next_in,B=I.input,I.avail_in=_e,I.next_in=0,I.input=se,Ze(N);N.lookahead>=U;){for(q=N.strstart,O=N.lookahead-(U-1);N.ins_h=(N.ins_h<<N.hash_shift^N.window[q+U-1])&N.hash_mask,N.prev[q&N.w_mask]=N.head[N.ins_h],N.head[N.ins_h]=q,q++,--O;);N.strstart=q,N.lookahead=U-1,Ze(N)}return N.strstart+=N.lookahead,N.block_start=N.strstart,N.insert=N.lookahead,N.lookahead=0,N.match_length=N.prev_length=U-1,N.match_available=0,I.next_in=P,I.input=B,I.avail_in=ye,N.wrap=ee,g},o.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(n,r,o){"use strict";r.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(n,r,o){"use strict";r.exports=function(i,s){var a=i.state,l=i.next_in,u,d,f,p,g,m,v,C,w,S,k,b,T,L,z,G,U,j,Z,R,K,x=i.input,W;u=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,C=a.wnext,w=a.window,S=a.hold,k=a.bits,b=a.lencode,T=a.distcode,L=(1<<a.lenbits)-1,z=(1<<a.distbits)-1;e:do{k<15&&(S+=x[l++]<<k,k+=8,S+=x[l++]<<k,k+=8),G=b[S&L];t:for(;;){if(S>>>=U=G>>>24,k-=U,(U=G>>>16&255)===0)W[d++]=65535&G;else{if(!(16&U)){if((64&U)==0){G=b[(65535&G)+(S&(1<<U)-1)];continue t}if(32&U){a.mode=12;break e}i.msg="invalid literal/length code",a.mode=30;break e}j=65535&G,(U&=15)&&(k<U&&(S+=x[l++]<<k,k+=8),j+=S&(1<<U)-1,S>>>=U,k-=U),k<15&&(S+=x[l++]<<k,k+=8,S+=x[l++]<<k,k+=8),G=T[S&z];n:for(;;){if(S>>>=U=G>>>24,k-=U,!(16&(U=G>>>16&255))){if((64&U)==0){G=T[(65535&G)+(S&(1<<U)-1)];continue n}i.msg="invalid distance code",a.mode=30;break e}if(Z=65535&G,k<(U&=15)&&(S+=x[l++]<<k,(k+=8)<U&&(S+=x[l++]<<k,k+=8)),g<(Z+=S&(1<<U)-1)){i.msg="invalid distance too far back",a.mode=30;break e}if(S>>>=U,k-=U,(U=d-f)<Z){if(v<(U=Z-U)&&a.sane){i.msg="invalid distance too far back",a.mode=30;break e}if(K=w,(R=0)===C){if(R+=m-U,U<j){for(j-=U;W[d++]=w[R++],--U;);R=d-Z,K=W}}else if(C<U){if(R+=m+C-U,(U-=C)<j){for(j-=U;W[d++]=w[R++],--U;);if(R=0,C<j){for(j-=U=C;W[d++]=w[R++],--U;);R=d-Z,K=W}}}else if(R+=C-U,U<j){for(j-=U;W[d++]=w[R++],--U;);R=d-Z,K=W}for(;2<j;)W[d++]=K[R++],W[d++]=K[R++],W[d++]=K[R++],j-=3;j&&(W[d++]=K[R++],1<j&&(W[d++]=K[R++]))}else{for(R=d-Z;W[d++]=W[R++],W[d++]=W[R++],W[d++]=W[R++],2<(j-=3););j&&(W[d++]=W[R++],1<j&&(W[d++]=W[R++]))}break}}break}}while(l<u&&d<p);l-=j=k>>3,S&=(1<<(k-=j<<3))-1,i.next_in=l,i.next_out=d,i.avail_in=l<u?u-l+5:5-(l-u),i.avail_out=d<p?p-d+257:257-(d-p),a.hold=S,a.bits=k}},{}],49:[function(n,r,o){"use strict";var i=n("../utils/common"),s=n("./adler32"),a=n("./crc32"),l=n("./inffast"),u=n("./inftrees"),d=1,f=2,p=0,g=-2,m=1,v=852,C=592;function w(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 k(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(C),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,k(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 z,G,U=!0;function j(R){if(U){var K;for(z=new i.Buf32(512),G=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(u(d,R.lens,0,288,z,0,R.work,{bits:9}),K=0;K<32;)R.lens[K++]=5;u(f,R.lens,0,32,G,0,R.work,{bits:5}),U=!1}R.lencode=z,R.lenbits=9,R.distcode=G,R.distbits=5}function Z(R,K,x,W){var $,J=R.state;return J.window===null&&(J.wsize=1<<J.wbits,J.wnext=0,J.whave=0,J.window=new i.Buf8(J.wsize)),W>=J.wsize?(i.arraySet(J.window,K,x-J.wsize,J.wsize,0),J.wnext=0,J.whave=J.wsize):(W<($=J.wsize-J.wnext)&&($=W),i.arraySet(J.window,K,x-W,$,J.wnext),(W-=$)?(i.arraySet(J.window,K,x-W,W,0),J.wnext=W,J.whave=J.wsize):(J.wnext+=$,J.wnext===J.wsize&&(J.wnext=0),J.whave<J.wsize&&(J.whave+=$))),0}o.inflateReset=b,o.inflateReset2=T,o.inflateResetKeep=k,o.inflateInit=function(R){return L(R,15)},o.inflateInit2=L,o.inflate=function(R,K){var x,W,$,J,Q,Y,Ce,fe,ve,me,Ee,Fe,Ze,lt,et,Et,ae,Ie,He,re,I,se,N,q,O=0,ee=new i.Buf8(4),ye=[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,Ce=R.avail_out,J=R.next_in,W=R.input,Y=R.avail_in,fe=x.hold,ve=x.bits,me=Y,Ee=Ce,se=p;e:for(;;)switch(x.mode){case m:if(x.wrap===0){x.mode=13;break}for(;ve<16;){if(Y===0)break e;Y--,fe+=W[J++]<<ve,ve+=8}if(2&x.wrap&&fe===35615){ee[x.check=0]=255&fe,ee[1]=fe>>>8&255,x.check=a(x.check,ee,2,0),ve=fe=0,x.mode=2;break}if(x.flags=0,x.head&&(x.head.done=!1),!(1&x.wrap)||(((255&fe)<<8)+(fe>>8))%31){R.msg="incorrect header check",x.mode=30;break}if((15&fe)!=8){R.msg="unknown compression method",x.mode=30;break}if(ve-=4,I=8+(15&(fe>>>=4)),x.wbits===0)x.wbits=I;else if(I>x.wbits){R.msg="invalid window size",x.mode=30;break}x.dmax=1<<I,R.adler=x.check=1,x.mode=512&fe?10:12,ve=fe=0;break;case 2:for(;ve<16;){if(Y===0)break e;Y--,fe+=W[J++]<<ve,ve+=8}if(x.flags=fe,(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=fe>>8&1),512&x.flags&&(ee[0]=255&fe,ee[1]=fe>>>8&255,x.check=a(x.check,ee,2,0)),ve=fe=0,x.mode=3;case 3:for(;ve<32;){if(Y===0)break e;Y--,fe+=W[J++]<<ve,ve+=8}x.head&&(x.head.time=fe),512&x.flags&&(ee[0]=255&fe,ee[1]=fe>>>8&255,ee[2]=fe>>>16&255,ee[3]=fe>>>24&255,x.check=a(x.check,ee,4,0)),ve=fe=0,x.mode=4;case 4:for(;ve<16;){if(Y===0)break e;Y--,fe+=W[J++]<<ve,ve+=8}x.head&&(x.head.xflags=255&fe,x.head.os=fe>>8),512&x.flags&&(ee[0]=255&fe,ee[1]=fe>>>8&255,x.check=a(x.check,ee,2,0)),ve=fe=0,x.mode=5;case 5:if(1024&x.flags){for(;ve<16;){if(Y===0)break e;Y--,fe+=W[J++]<<ve,ve+=8}x.length=fe,x.head&&(x.head.extra_len=fe),512&x.flags&&(ee[0]=255&fe,ee[1]=fe>>>8&255,x.check=a(x.check,ee,2,0)),ve=fe=0}else x.head&&(x.head.extra=null);x.mode=6;case 6:if(1024&x.flags&&(Y<(Fe=x.length)&&(Fe=Y),Fe&&(x.head&&(I=x.head.extra_len-x.length,x.head.extra||(x.head.extra=new Array(x.head.extra_len)),i.arraySet(x.head.extra,W,J,Fe,I)),512&x.flags&&(x.check=a(x.check,W,Fe,J)),Y-=Fe,J+=Fe,x.length-=Fe),x.length))break e;x.length=0,x.mode=7;case 7:if(2048&x.flags){if(Y===0)break e;for(Fe=0;I=W[J+Fe++],x.head&&I&&x.length<65536&&(x.head.name+=String.fromCharCode(I)),I&&Fe<Y;);if(512&x.flags&&(x.check=a(x.check,W,Fe,J)),Y-=Fe,J+=Fe,I)break e}else x.head&&(x.head.name=null);x.length=0,x.mode=8;case 8:if(4096&x.flags){if(Y===0)break e;for(Fe=0;I=W[J+Fe++],x.head&&I&&x.length<65536&&(x.head.comment+=String.fromCharCode(I)),I&&Fe<Y;);if(512&x.flags&&(x.check=a(x.check,W,Fe,J)),Y-=Fe,J+=Fe,I)break e}else x.head&&(x.head.comment=null);x.mode=9;case 9:if(512&x.flags){for(;ve<16;){if(Y===0)break e;Y--,fe+=W[J++]<<ve,ve+=8}if(fe!==(65535&x.check)){R.msg="header crc mismatch",x.mode=30;break}ve=fe=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(;ve<32;){if(Y===0)break e;Y--,fe+=W[J++]<<ve,ve+=8}R.adler=x.check=w(fe),ve=fe=0,x.mode=11;case 11:if(x.havedict===0)return R.next_out=Q,R.avail_out=Ce,R.next_in=J,R.avail_in=Y,x.hold=fe,x.bits=ve,2;R.adler=x.check=1,x.mode=12;case 12:if(K===5||K===6)break e;case 13:if(x.last){fe>>>=7&ve,ve-=7&ve,x.mode=27;break}for(;ve<3;){if(Y===0)break e;Y--,fe+=W[J++]<<ve,ve+=8}switch(x.last=1&fe,ve-=1,3&(fe>>>=1)){case 0:x.mode=14;break;case 1:if(j(x),x.mode=20,K!==6)break;fe>>>=2,ve-=2;break e;case 2:x.mode=17;break;case 3:R.msg="invalid block type",x.mode=30}fe>>>=2,ve-=2;break;case 14:for(fe>>>=7&ve,ve-=7&ve;ve<32;){if(Y===0)break e;Y--,fe+=W[J++]<<ve,ve+=8}if((65535&fe)!=(fe>>>16^65535)){R.msg="invalid stored block lengths",x.mode=30;break}if(x.length=65535&fe,ve=fe=0,x.mode=15,K===6)break e;case 15:x.mode=16;case 16:if(Fe=x.length){if(Y<Fe&&(Fe=Y),Ce<Fe&&(Fe=Ce),Fe===0)break e;i.arraySet($,W,J,Fe,Q),Y-=Fe,J+=Fe,Ce-=Fe,Q+=Fe,x.length-=Fe;break}x.mode=12;break;case 17:for(;ve<14;){if(Y===0)break e;Y--,fe+=W[J++]<<ve,ve+=8}if(x.nlen=257+(31&fe),fe>>>=5,ve-=5,x.ndist=1+(31&fe),fe>>>=5,ve-=5,x.ncode=4+(15&fe),fe>>>=4,ve-=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(;ve<3;){if(Y===0)break e;Y--,fe+=W[J++]<<ve,ve+=8}x.lens[ye[x.have++]]=7&fe,fe>>>=3,ve-=3}for(;x.have<19;)x.lens[ye[x.have++]]=0;if(x.lencode=x.lendyn,x.lenbits=7,N={bits:x.lenbits},se=u(0,x.lens,0,19,x.lencode,0,x.work,N),x.lenbits=N.bits,se){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(;Et=(O=x.lencode[fe&(1<<x.lenbits)-1])>>>16&255,ae=65535&O,!((et=O>>>24)<=ve);){if(Y===0)break e;Y--,fe+=W[J++]<<ve,ve+=8}if(ae<16)fe>>>=et,ve-=et,x.lens[x.have++]=ae;else{if(ae===16){for(q=et+2;ve<q;){if(Y===0)break e;Y--,fe+=W[J++]<<ve,ve+=8}if(fe>>>=et,ve-=et,x.have===0){R.msg="invalid bit length repeat",x.mode=30;break}I=x.lens[x.have-1],Fe=3+(3&fe),fe>>>=2,ve-=2}else if(ae===17){for(q=et+3;ve<q;){if(Y===0)break e;Y--,fe+=W[J++]<<ve,ve+=8}ve-=et,I=0,Fe=3+(7&(fe>>>=et)),fe>>>=3,ve-=3}else{for(q=et+7;ve<q;){if(Y===0)break e;Y--,fe+=W[J++]<<ve,ve+=8}ve-=et,I=0,Fe=11+(127&(fe>>>=et)),fe>>>=7,ve-=7}if(x.have+Fe>x.nlen+x.ndist){R.msg="invalid bit length repeat",x.mode=30;break}for(;Fe--;)x.lens[x.have++]=I}}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,N={bits:x.lenbits},se=u(d,x.lens,0,x.nlen,x.lencode,0,x.work,N),x.lenbits=N.bits,se){R.msg="invalid literal/lengths set",x.mode=30;break}if(x.distbits=6,x.distcode=x.distdyn,N={bits:x.distbits},se=u(f,x.lens,x.nlen,x.ndist,x.distcode,0,x.work,N),x.distbits=N.bits,se){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<=Y&&258<=Ce){R.next_out=Q,R.avail_out=Ce,R.next_in=J,R.avail_in=Y,x.hold=fe,x.bits=ve,l(R,Ee),Q=R.next_out,$=R.output,Ce=R.avail_out,J=R.next_in,W=R.input,Y=R.avail_in,fe=x.hold,ve=x.bits,x.mode===12&&(x.back=-1);break}for(x.back=0;Et=(O=x.lencode[fe&(1<<x.lenbits)-1])>>>16&255,ae=65535&O,!((et=O>>>24)<=ve);){if(Y===0)break e;Y--,fe+=W[J++]<<ve,ve+=8}if(Et&&(240&Et)==0){for(Ie=et,He=Et,re=ae;Et=(O=x.lencode[re+((fe&(1<<Ie+He)-1)>>Ie)])>>>16&255,ae=65535&O,!(Ie+(et=O>>>24)<=ve);){if(Y===0)break e;Y--,fe+=W[J++]<<ve,ve+=8}fe>>>=Ie,ve-=Ie,x.back+=Ie}if(fe>>>=et,ve-=et,x.back+=et,x.length=ae,Et===0){x.mode=26;break}if(32&Et){x.back=-1,x.mode=12;break}if(64&Et){R.msg="invalid literal/length code",x.mode=30;break}x.extra=15&Et,x.mode=22;case 22:if(x.extra){for(q=x.extra;ve<q;){if(Y===0)break e;Y--,fe+=W[J++]<<ve,ve+=8}x.length+=fe&(1<<x.extra)-1,fe>>>=x.extra,ve-=x.extra,x.back+=x.extra}x.was=x.length,x.mode=23;case 23:for(;Et=(O=x.distcode[fe&(1<<x.distbits)-1])>>>16&255,ae=65535&O,!((et=O>>>24)<=ve);){if(Y===0)break e;Y--,fe+=W[J++]<<ve,ve+=8}if((240&Et)==0){for(Ie=et,He=Et,re=ae;Et=(O=x.distcode[re+((fe&(1<<Ie+He)-1)>>Ie)])>>>16&255,ae=65535&O,!(Ie+(et=O>>>24)<=ve);){if(Y===0)break e;Y--,fe+=W[J++]<<ve,ve+=8}fe>>>=Ie,ve-=Ie,x.back+=Ie}if(fe>>>=et,ve-=et,x.back+=et,64&Et){R.msg="invalid distance code",x.mode=30;break}x.offset=ae,x.extra=15&Et,x.mode=24;case 24:if(x.extra){for(q=x.extra;ve<q;){if(Y===0)break e;Y--,fe+=W[J++]<<ve,ve+=8}x.offset+=fe&(1<<x.extra)-1,fe>>>=x.extra,ve-=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(Ce===0)break e;if(Fe=Ee-Ce,x.offset>Fe){if((Fe=x.offset-Fe)>x.whave&&x.sane){R.msg="invalid distance too far back",x.mode=30;break}Ze=Fe>x.wnext?(Fe-=x.wnext,x.wsize-Fe):x.wnext-Fe,Fe>x.length&&(Fe=x.length),lt=x.window}else lt=$,Ze=Q-x.offset,Fe=x.length;for(Ce<Fe&&(Fe=Ce),Ce-=Fe,x.length-=Fe;$[Q++]=lt[Ze++],--Fe;);x.length===0&&(x.mode=21);break;case 26:if(Ce===0)break e;$[Q++]=x.length,Ce--,x.mode=21;break;case 27:if(x.wrap){for(;ve<32;){if(Y===0)break e;Y--,fe|=W[J++]<<ve,ve+=8}if(Ee-=Ce,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=Ce,(x.flags?fe:w(fe))!==x.check){R.msg="incorrect data check",x.mode=30;break}ve=fe=0}x.mode=28;case 28:if(x.wrap&&x.flags){for(;ve<32;){if(Y===0)break e;Y--,fe+=W[J++]<<ve,ve+=8}if(fe!==(4294967295&x.total)){R.msg="incorrect length check",x.mode=30;break}ve=fe=0}x.mode=29;case 29:se=1;break e;case 30:se=-3;break e;case 31:return-4;default:return g}return R.next_out=Q,R.avail_out=Ce,R.next_in=J,R.avail_in=Y,x.hold=fe,x.bits=ve,(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):(me-=R.avail_in,Ee-=R.avail_out,R.total_in+=me,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),(me==0&&Ee===0||K===4)&&se===p&&(se=-5),se)},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],u=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];r.exports=function(d,f,p,g,m,v,C,w){var S,k,b,T,L,z,G,U,j,Z=w.bits,R=0,K=0,x=0,W=0,$=0,J=0,Q=0,Y=0,Ce=0,fe=0,ve=null,me=0,Ee=new i.Buf16(16),Fe=new i.Buf16(16),Ze=null,lt=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,w.bits=1,0;for(x=1;x<W&&Ee[x]===0;x++);for($<x&&($=x),R=Y=1;R<=15;R++)if(Y<<=1,(Y-=Ee[R])<0)return-1;if(0<Y&&(d===0||W!==1))return-1;for(Fe[1]=0,R=1;R<15;R++)Fe[R+1]=Fe[R]+Ee[R];for(K=0;K<g;K++)f[p+K]!==0&&(C[Fe[f[p+K]]++]=K);if(z=d===0?(ve=Ze=C,19):d===1?(ve=s,me-=257,Ze=a,lt-=257,256):(ve=l,Ze=u,-1),R=x,L=v,Q=K=fe=0,b=-1,T=(Ce=1<<(J=$))-1,d===1&&852<Ce||d===2&&592<Ce)return 1;for(;;){for(G=R-Q,j=C[K]<z?(U=0,C[K]):C[K]>z?(U=Ze[lt+C[K]],ve[me+C[K]]):(U=96,0),S=1<<R-Q,x=k=1<<J;m[L+(fe>>Q)+(k-=S)]=G<<24|U<<16|j|0,k!==0;);for(S=1<<R-1;fe&S;)S>>=1;if(S!==0?(fe&=S-1,fe+=S):fe=0,K++,--Ee[R]==0){if(R===W)break;R=f[p+C[K]]}if($<R&&(fe&T)!==b){for(Q===0&&(Q=$),L+=x,Y=1<<(J=R-Q);J+Q<W&&!((Y-=Ee[J+Q])<=0);)J++,Y<<=1;if(Ce+=1<<J,d===1&&852<Ce||d===2&&592<Ce)return 1;m[b=fe&T]=$<<24|J<<16|L-v|0}}return fe!==0&&(m[L+fe]=R-Q<<24|4194304),w.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 ee=O.length;0<=--ee;)O[ee]=0}var u=0,d=29,f=256,p=f+1+d,g=30,m=19,v=2*p+1,C=15,w=16,S=7,k=256,b=16,T=17,L=18,z=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],G=[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],U=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],j=[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 $,J,Q,Y=new Array(g);function Ce(O,ee,ye,P,B){this.static_tree=O,this.extra_bits=ee,this.extra_base=ye,this.elems=P,this.max_length=B,this.has_stree=O&&O.length}function fe(O,ee){this.dyn_tree=O,this.max_code=0,this.stat_desc=ee}function ve(O){return O<256?K[O]:K[256+(O>>>7)]}function me(O,ee){O.pending_buf[O.pending++]=255&ee,O.pending_buf[O.pending++]=ee>>>8&255}function Ee(O,ee,ye){O.bi_valid>w-ye?(O.bi_buf|=ee<<O.bi_valid&65535,me(O,O.bi_buf),O.bi_buf=ee>>w-O.bi_valid,O.bi_valid+=ye-w):(O.bi_buf|=ee<<O.bi_valid&65535,O.bi_valid+=ye)}function Fe(O,ee,ye){Ee(O,ye[2*ee],ye[2*ee+1])}function Ze(O,ee){for(var ye=0;ye|=1&O,O>>>=1,ye<<=1,0<--ee;);return ye>>>1}function lt(O,ee,ye){var P,B,ce=new Array(C+1),_e=0;for(P=1;P<=C;P++)ce[P]=_e=_e+ye[P-1]<<1;for(B=0;B<=ee;B++){var Ae=O[2*B+1];Ae!==0&&(O[2*B]=Ze(ce[Ae]++,Ae))}}function et(O){var ee;for(ee=0;ee<p;ee++)O.dyn_ltree[2*ee]=0;for(ee=0;ee<g;ee++)O.dyn_dtree[2*ee]=0;for(ee=0;ee<m;ee++)O.bl_tree[2*ee]=0;O.dyn_ltree[2*k]=1,O.opt_len=O.static_len=0,O.last_lit=O.matches=0}function Et(O){8<O.bi_valid?me(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 ae(O,ee,ye,P){var B=2*ee,ce=2*ye;return O[B]<O[ce]||O[B]===O[ce]&&P[ee]<=P[ye]}function Ie(O,ee,ye){for(var P=O.heap[ye],B=ye<<1;B<=O.heap_len&&(B<O.heap_len&&ae(ee,O.heap[B+1],O.heap[B],O.depth)&&B++,!ae(ee,P,O.heap[B],O.depth));)O.heap[ye]=O.heap[B],ye=B,B<<=1;O.heap[ye]=P}function He(O,ee,ye){var P,B,ce,_e,Ae=0;if(O.last_lit!==0)for(;P=O.pending_buf[O.d_buf+2*Ae]<<8|O.pending_buf[O.d_buf+2*Ae+1],B=O.pending_buf[O.l_buf+Ae],Ae++,P===0?Fe(O,B,ee):(Fe(O,(ce=x[B])+f+1,ee),(_e=z[ce])!==0&&Ee(O,B-=W[ce],_e),Fe(O,ce=ve(--P),ye),(_e=G[ce])!==0&&Ee(O,P-=Y[ce],_e)),Ae<O.last_lit;);Fe(O,k,ee)}function re(O,ee){var ye,P,B,ce=ee.dyn_tree,_e=ee.stat_desc.static_tree,Ae=ee.stat_desc.has_stree,De=ee.stat_desc.elems,Ye=-1;for(O.heap_len=0,O.heap_max=v,ye=0;ye<De;ye++)ce[2*ye]!==0?(O.heap[++O.heap_len]=Ye=ye,O.depth[ye]=0):ce[2*ye+1]=0;for(;O.heap_len<2;)ce[2*(B=O.heap[++O.heap_len]=Ye<2?++Ye:0)]=1,O.depth[B]=0,O.opt_len--,Ae&&(O.static_len-=_e[2*B+1]);for(ee.max_code=Ye,ye=O.heap_len>>1;1<=ye;ye--)Ie(O,ce,ye);for(B=De;ye=O.heap[1],O.heap[1]=O.heap[O.heap_len--],Ie(O,ce,1),P=O.heap[1],O.heap[--O.heap_max]=ye,O.heap[--O.heap_max]=P,ce[2*B]=ce[2*ye]+ce[2*P],O.depth[B]=(O.depth[ye]>=O.depth[P]?O.depth[ye]:O.depth[P])+1,ce[2*ye+1]=ce[2*P+1]=B,O.heap[1]=B++,Ie(O,ce,1),2<=O.heap_len;);O.heap[--O.heap_max]=O.heap[1],(function(ot,gt){var xt,Tt,$t,je,rn,Un,jt=gt.dyn_tree,En=gt.max_code,Gr=gt.stat_desc.static_tree,br=gt.stat_desc.has_stree,Ir=gt.stat_desc.extra_bits,Qe=gt.stat_desc.extra_base,wt=gt.stat_desc.max_length,Pt=0;for(je=0;je<=C;je++)ot.bl_count[je]=0;for(jt[2*ot.heap[ot.heap_max]+1]=0,xt=ot.heap_max+1;xt<v;xt++)wt<(je=jt[2*jt[2*(Tt=ot.heap[xt])+1]+1]+1)&&(je=wt,Pt++),jt[2*Tt+1]=je,En<Tt||(ot.bl_count[je]++,rn=0,Qe<=Tt&&(rn=Ir[Tt-Qe]),Un=jt[2*Tt],ot.opt_len+=Un*(je+rn),br&&(ot.static_len+=Un*(Gr[2*Tt+1]+rn)));if(Pt!==0){do{for(je=wt-1;ot.bl_count[je]===0;)je--;ot.bl_count[je]--,ot.bl_count[je+1]+=2,ot.bl_count[wt]--,Pt-=2}while(0<Pt);for(je=wt;je!==0;je--)for(Tt=ot.bl_count[je];Tt!==0;)En<($t=ot.heap[--xt])||(jt[2*$t+1]!==je&&(ot.opt_len+=(je-jt[2*$t+1])*jt[2*$t],jt[2*$t+1]=je),Tt--)}})(O,ee),lt(ce,Ye,O.bl_count)}function I(O,ee,ye){var P,B,ce=-1,_e=ee[1],Ae=0,De=7,Ye=4;for(_e===0&&(De=138,Ye=3),ee[2*(ye+1)+1]=65535,P=0;P<=ye;P++)B=_e,_e=ee[2*(P+1)+1],++Ae<De&&B===_e||(Ae<Ye?O.bl_tree[2*B]+=Ae:B!==0?(B!==ce&&O.bl_tree[2*B]++,O.bl_tree[2*b]++):Ae<=10?O.bl_tree[2*T]++:O.bl_tree[2*L]++,ce=B,Ye=(Ae=0)===_e?(De=138,3):B===_e?(De=6,3):(De=7,4))}function se(O,ee,ye){var P,B,ce=-1,_e=ee[1],Ae=0,De=7,Ye=4;for(_e===0&&(De=138,Ye=3),P=0;P<=ye;P++)if(B=_e,_e=ee[2*(P+1)+1],!(++Ae<De&&B===_e)){if(Ae<Ye)for(;Fe(O,B,O.bl_tree),--Ae!=0;);else B!==0?(B!==ce&&(Fe(O,B,O.bl_tree),Ae--),Fe(O,b,O.bl_tree),Ee(O,Ae-3,2)):Ae<=10?(Fe(O,T,O.bl_tree),Ee(O,Ae-3,3)):(Fe(O,L,O.bl_tree),Ee(O,Ae-11,7));ce=B,Ye=(Ae=0)===_e?(De=138,3):B===_e?(De=6,3):(De=7,4)}}l(Y);var N=!1;function q(O,ee,ye,P){Ee(O,(u<<1)+(P?1:0),3),(function(B,ce,_e,Ae){Et(B),Ae&&(me(B,_e),me(B,~_e)),i.arraySet(B.pending_buf,B.window,ce,_e,B.pending),B.pending+=_e})(O,ee,ye,!0)}o._tr_init=function(O){N||((function(){var ee,ye,P,B,ce,_e=new Array(C+1);for(B=P=0;B<d-1;B++)for(W[B]=P,ee=0;ee<1<<z[B];ee++)x[P++]=B;for(x[P-1]=B,B=ce=0;B<16;B++)for(Y[B]=ce,ee=0;ee<1<<G[B];ee++)K[ce++]=B;for(ce>>=7;B<g;B++)for(Y[B]=ce<<7,ee=0;ee<1<<G[B]-7;ee++)K[256+ce++]=B;for(ye=0;ye<=C;ye++)_e[ye]=0;for(ee=0;ee<=143;)Z[2*ee+1]=8,ee++,_e[8]++;for(;ee<=255;)Z[2*ee+1]=9,ee++,_e[9]++;for(;ee<=279;)Z[2*ee+1]=7,ee++,_e[7]++;for(;ee<=287;)Z[2*ee+1]=8,ee++,_e[8]++;for(lt(Z,p+1,_e),ee=0;ee<g;ee++)R[2*ee+1]=5,R[2*ee]=Ze(ee,5);$=new Ce(Z,z,f+1,p,C),J=new Ce(R,G,0,g,C),Q=new Ce(new Array(0),U,0,m,S)})(),N=!0),O.l_desc=new fe(O.dyn_ltree,$),O.d_desc=new fe(O.dyn_dtree,J),O.bl_desc=new fe(O.bl_tree,Q),O.bi_buf=0,O.bi_valid=0,et(O)},o._tr_stored_block=q,o._tr_flush_block=function(O,ee,ye,P){var B,ce,_e=0;0<O.level?(O.strm.data_type===2&&(O.strm.data_type=(function(Ae){var De,Ye=4093624447;for(De=0;De<=31;De++,Ye>>>=1)if(1&Ye&&Ae.dyn_ltree[2*De]!==0)return s;if(Ae.dyn_ltree[18]!==0||Ae.dyn_ltree[20]!==0||Ae.dyn_ltree[26]!==0)return a;for(De=32;De<f;De++)if(Ae.dyn_ltree[2*De]!==0)return a;return s})(O)),re(O,O.l_desc),re(O,O.d_desc),_e=(function(Ae){var De;for(I(Ae,Ae.dyn_ltree,Ae.l_desc.max_code),I(Ae,Ae.dyn_dtree,Ae.d_desc.max_code),re(Ae,Ae.bl_desc),De=m-1;3<=De&&Ae.bl_tree[2*j[De]+1]===0;De--);return Ae.opt_len+=3*(De+1)+5+5+4,De})(O),B=O.opt_len+3+7>>>3,(ce=O.static_len+3+7>>>3)<=B&&(B=ce)):B=ce=ye+5,ye+4<=B&&ee!==-1?q(O,ee,ye,P):O.strategy===4||ce===B?(Ee(O,2+(P?1:0),3),He(O,Z,R)):(Ee(O,4+(P?1:0),3),(function(Ae,De,Ye,ot){var gt;for(Ee(Ae,De-257,5),Ee(Ae,Ye-1,5),Ee(Ae,ot-4,4),gt=0;gt<ot;gt++)Ee(Ae,Ae.bl_tree[2*j[gt]+1],3);se(Ae,Ae.dyn_ltree,De-1),se(Ae,Ae.dyn_dtree,Ye-1)})(O,O.l_desc.max_code+1,O.d_desc.max_code+1,_e+1),He(O,O.dyn_ltree,O.dyn_dtree)),et(O),P&&Et(O)},o._tr_tally=function(O,ee,ye){return O.pending_buf[O.d_buf+2*O.last_lit]=ee>>>8&255,O.pending_buf[O.d_buf+2*O.last_lit+1]=255&ee,O.pending_buf[O.l_buf+O.last_lit]=255&ye,O.last_lit++,ee===0?O.dyn_ltree[2*ye]++:(O.matches++,ee--,O.dyn_ltree[2*(x[ye]+f+1)]++,O.dyn_dtree[2*ve(ee)]++),O.last_lit===O.lit_bufsize-1},o._tr_align=function(O){Ee(O,2,3),Fe(O,k,Z),(function(ee){ee.bi_valid===16?(me(ee,ee.bi_buf),ee.bi_buf=0,ee.bi_valid=0):8<=ee.bi_valid&&(ee.pending_buf[ee.pending++]=255&ee.bi_buf,ee.bi_buf>>=8,ee.bi_valid-=8)})(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,u,d,f,p=1,g={},m=!1,v=s.document,C=Object.getPrototypeOf&&Object.getPrototypeOf(s);C=C&&C.setTimeout?C:s,l={}.toString.call(s.process)==="[object process]"?function(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",k,!1):s.attachEvent("onmessage",k),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")?(u=v.documentElement,function(b){var T=v.createElement("script");T.onreadystatechange=function(){S(b),T.onreadystatechange=null,u.removeChild(T),T=null},u.appendChild(T)}):function(b){setTimeout(S,0,b)},C.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++},C.clearImmediate=w}function w(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 z=L.callback,G=L.args;switch(G.length){case 0:z();break;case 1:z(G[0]);break;case 2:z(G[0],G[1]);break;case 3:z(G[0],G[1],G[2]);break;default:z.apply(a,G)}})(T)}finally{w(b),m=!1}}}}function k(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)})})),_r="application/vnd.openxmlformats-officedocument.wordprocessingml.document",Ca="application/pdf",vu="text/html",DT={docx:_r,pdf:Ca,html:vu},Ep={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"};Dt();var OT=M2(LT(),1),PT=e=>typeof e!="string"?"":e.trim(),Ly=e=>{if(typeof e!="string")return"";const t=e.trim();return t?t.toLowerCase():""},Tp=e=>{if(typeof e!="string")return"";const t=e.trim();return t?t.toLowerCase():""},vc=e=>{const t=e??{},n=PT(t.id),r=Ly(t.email);return{id:n,email:r,name:typeof t.name=="string"?t.name:"",hasId:n.length>0,hasEmail:r.length>0}},HC=({current:e,other:t})=>{const n=vc(e),r=vc(t);return n.hasId&&r.hasId?n.id===r.id:n.hasEmail&&r.hasEmail?n.email===r.email:!1},yu=({actor:e,fallbackKey:t=""})=>{const n=vc(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 FT(e){return typeof e.captureStackTrace=="function"}var xp=class extends Error{constructor(e,t){super(e),this.cause=t,this.name="FileObjectError",FT(Error)&&Error.captureStackTrace(this,this.constructor)}},NT=class extends xp{constructor(e){super("Invalid data URI format: URI must contain exactly one comma separator"),this.uri=e,this.name="InvalidDataUriError"}},BT=class extends xp{constructor(e,t){super(`Failed to fetch file from URL: ${e}`,t),this.url=e,this.name="FetchFailedError"}},Dy=async(e,t,n)=>{try{if(e.startsWith("data:")&&e.includes(";base64,")){const i=e.split(",");if(i.length!==2)throw new NT(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 BT(e,new Error(`HTTP ${r.status}: ${r.statusText}`));const o=await r.blob();return new File([o],t,{type:n})}catch(r){throw r instanceof xp?r:new xp("Failed to create file object",r)}};function zT(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 Rp=new WeakMap;function $C(e){return e.ownerDocument??document}function GC(e,t){const n=Rp.get(t);n?.bindings.delete(e),n&&n.bindings.size===0&&(t.removeEventListener("click",n.listener),Rp.delete(t))}function WC(e,t){const n=$C(e);e.__clickOutsideDocument&&e.__clickOutsideDocument!==n&&GC(e,e.__clickOutsideDocument);let r=Rp.get(n);if(!r){const o=new Map,i=s=>{const a=typeof s.composedPath=="function"?s.composedPath():null;for(const[l,u]of o)(a?.includes(l)??l.contains(s.target))||u.value?.(s)};r={bindings:o,listener:i},Rp.set(n,r),n.addEventListener("click",i)}r.bindings.set(e,t),e.__clickOutsideHandler=r.listener,e.__clickOutsideDocument=n}var Oy={mounted(e,t){WC(e,t)},updated(e,t){WC(e,t)},unmounted(e){GC(e,e.__clickOutsideDocument??$C(e)),delete e.__clickOutsideHandler,delete e.__clickOutsideDocument}};function jT(e){return e[1].user!==void 0}var VT=(e,t)=>{const n=new Set;return Array.from(t.entries()).filter(jT).filter(([r,o])=>{const i=yu({actor:o.user,fallbackKey:r});return!i||n.has(i)?!1:(n.add(i),!0)}).map(([r,o])=>{const i=yu({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}})},UT=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},HT="https://ingest.superdoc.dev/v1/collect",X$="community-and-eval-agplv3";function $T(){try{return"2.12.1-next.2"}catch{return"unknown"}}var GT=class{constructor(e){this.enabled=e.enabled,this.endpoint=e.endpoint||HT,this.licenseKey=e.licenseKey||"",this.metadata=e.metadata,this.superdocVersion=$T()}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{}}},Mp={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"},Z$=[Mp.INLINE_SDT_LABEL,Mp.BLOCK_SDT_LABEL],KC={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"},WT=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"}}},Q$=`.${Mp.BLOCK_SDT}[${KC.SDT_ID}]`,J$=`[${KC.DRAGGABLE}="true"]`,KT=typeof window<"u",qC,Cf=e=>qC=e,YC=Symbol();function Py(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 XC=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 qT(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 Fy(e,t,n){const r=new XMLHttpRequest;r.open("GET",e),r.responseType="blob",r.onload=function(){YT(r.response,t,n)},r.onerror=function(){console.error("could not download file")},r.send()}function ZC(e){const t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch{}return t.status>=200&&t.status<=299}function Lp(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 Dp=typeof navigator=="object"?navigator:{userAgent:""},QC=/Macintosh/.test(Dp.userAgent)&&/AppleWebKit/.test(Dp.userAgent)&&!/Safari/.test(Dp.userAgent),YT=KT?typeof HTMLAnchorElement<"u"&&"download"in HTMLAnchorElement.prototype&&!QC?XT:"msSaveOrOpenBlob"in Dp?ZT:QT:()=>{};function XT(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?ZC(r.href)?Fy(e,t,n):(r.target="_blank",Lp(r)):Lp(r)):(r.href=URL.createObjectURL(e),setTimeout(function(){URL.revokeObjectURL(r.href)},4e4),setTimeout(function(){Lp(r)},0))}function ZT(e,t="download",n){if(typeof e=="string")if(ZC(e))Fy(e,t,n);else{const r=document.createElement("a");r.href=e,r.target="_blank",setTimeout(function(){Lp(r)})}else navigator.msSaveOrOpenBlob(qT(e,n),t)}function QT(e,t,n,r){if(r=r||open("","_blank"),r&&(r.document.title=r.document.body.innerText="downloading..."),typeof e=="string")return Fy(e,t,n);const o=e.type==="application/octet-stream",i=/constructor/i.test(String(XC.HTMLElement))||"safari"in XC,s=/CriOS\/[\d]+/.test(navigator.userAgent);if((s||o&&i||QC)&&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:eG}=Object;function JT(){const e=Ug(!0),t=e.run(()=>te({}));let n=[],r=[];const o=io({install(i){Cf(o),o._a=i,i.provide(YC,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 JC=()=>{};function ek(e,t,n,r=JC){e.add(t);const o=()=>{e.delete(t)&&r()};return!n&&Hg()&&G2(o),o}function bu(e,...t){e.forEach(n=>{n(...t)})}var ex=e=>e(),tk=Symbol(),Ny=Symbol();function By(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];Py(o)&&Py(r)&&e.hasOwnProperty(n)&&!ur(r)&&!Bi(r)?e[n]=By(o,r):e[n]=r}return e}var tx=Symbol();function nx(e){return!Py(e)||!Object.prototype.hasOwnProperty.call(e,tx)}var{assign:yl}=Object;function rx(e){return!!(ur(e)&&e.effect)}function ox(e,t,n,r){const{state:o,actions:i,getters:s}=t,a=n.state.value[e];let l;function u(){a||(n.state.value[e]=o?o():{});const d=n1(n.state.value[e]);return yl(d,i,Object.keys(s||{}).reduce((f,p)=>(f[p]=io(ke(()=>{Cf(n);const g=n._s.get(e);return s[p].call(g,g)})),f),{}))}return l=nk(e,u,t,n,r,!0),l}function nk(e,t,n={},r,o,i){let s;const a=yl({actions:{}},n),l={deep:!0};let u,d,f=new Set,p=new Set,g;const m=r.state.value[e];!i&&!m&&(r.state.value[e]={});let v;function C(L){let z;u=d=!1,typeof L=="function"?(L(r.state.value[e]),z={type:kf.patchFunction,storeId:e,events:g}):(By(r.state.value[e],L),z={type:kf.patchObject,payload:L,storeId:e,events:g});const G=v=Symbol();kt().then(()=>{v===G&&(u=!0)}),d=!0,bu(f,z,r.state.value[e])}const w=i?function(){const{state:z}=n,G=z?z():{};this.$patch(U=>{yl(U,G)})}:JC;function S(){s.stop(),f.clear(),p.clear(),r._s.delete(e)}const k=(L,z="")=>{if(tk in L)return L[Ny]=z,L;const G=function(){Cf(r);const U=Array.from(arguments),j=new Set,Z=new Set;function R(W){j.add(W)}function K(W){Z.add(W)}bu(p,{args:U,name:G[Ny],store:b,after:R,onError:K});let x;try{x=L.apply(this&&this.$id===e?this:b,U)}catch(W){throw bu(Z,W),W}return x instanceof Promise?x.then(W=>(bu(j,W),W)).catch(W=>(bu(Z,W),Promise.reject(W))):(bu(j,x),x)};return G[tk]=!0,G[Ny]=z,G},b=oo({_p:r,$id:e,$onAction:ek.bind(null,p),$patch:C,$reset:w,$subscribe(L,z={}){const G=ek(f,L,z.detached,()=>U()),U=s.run(()=>Bt(()=>r.state.value[e],j=>{(z.flush==="sync"?d:u)&&L({storeId:e,type:kf.direct,events:g},j)},yl({},l,z)));return G},$dispose:S});r._s.set(e,b);const T=(r._a&&r._a.runWithContext||ex)(()=>r._e.run(()=>(s=Ug()).run(()=>t({action:k}))));for(const L in T){const z=T[L];ur(z)&&!rx(z)||Bi(z)?i||(m&&nx(z)&&(ur(z)?z.value=m[L]:By(z,m[L])),r.state.value[e][L]=z):typeof z=="function"&&(T[L]=k(z,L),a.actions[L]=z)}return yl(b,T),yl(gn(b),T),Object.defineProperty(b,"$state",{get:()=>r.state.value[e],set:L=>{C(z=>{yl(z,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),u=!0,d=!0,b}function rk(e,t,n){let r;const o=typeof t=="function";r=o?n:t;function i(s,a){const l=R1();return s=s||(l?ll(YC,null):null),s&&Cf(s),s=qC,s._s.has(e)||(o?nk(e,t,r,s):ox(e,r,s)),s._s.get(e)}return i.$id=e,i}function Ds(e){const t=gn(e),n={};for(const r in t){const o=t[r];o.effect?n[r]=ke({get:()=>e[r],set(i){e[r]=i}}):(ur(o)||Bi(o))&&(n[r]=Zg(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},ok=Object.getOwnPropertyDescriptor(ArrayBuffer.prototype,"byteLength")?.get,ix=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Uint8Array.prototype),Symbol.toStringTag)?.get,bl=e=>{if(ArrayBuffer.isView(e))return ix?.call(e)==="Uint8Array";if(!ok)return!1;try{return ok.call(e),!0}catch{return!1}},zy=e=>{if(e instanceof Uint8Array)return e;const t=ArrayBuffer.isView(e)?e:new Uint8Array(e);return Uint8Array.from(t)},jy=(e,t)=>new Blob([zy(e)],{type:t}),Vy=e=>{switch(e.toLowerCase()){case"docx":case _r:return _r;case"pdf":case Ca:return Ca;case"html":case vu:return vu;default:return e}},Op=(e="")=>{const t=String(e).toLowerCase();return t.endsWith(".docx")?_r:t.endsWith(".pdf")?Ca:t.endsWith(".html")||t.endsWith(".htm")?vu:t.endsWith(".md")||t.endsWith(".markdown")?"text/markdown":""},sx=e=>e==="application/vnd.openxmlformats-officedocument.wordprocessingml.document"?"document.docx":e==="application/pdf"?"document.pdf":e==="text/html"?"document.html":"document",ax="application/octet-stream",Uy=e=>{if(bl(e))return{type:_r,data:zy(e),name:"document.docx"};const t=Sf(e);if(t){const n=e&&typeof e.name=="string"?e.name:"",r=t.name||"",o=Op(n),i=o||Op(r),s=t.type.toLowerCase()===ax,a=s&&o?n:r||n||"document",l=s&&i?i:t.type||i||"application/vnd.openxmlformats-officedocument.wordprocessingml.document";let u=t;return s&&i&&typeof File=="function"&&t instanceof File?u=new File([t],a,{type:l,lastModified:t.lastModified}):s&&i&&typeof Blob=="function"&&t instanceof Blob&&(u=new Blob([t],{type:l})),{type:l,data:u,name:a}}if(e&&typeof e=="object"&&"data"in e){if(bl(e.data)){const r=Vy(e.type||Op(e.name)||"application/vnd.openxmlformats-officedocument.wordprocessingml.document");return{...e,type:r,data:r==="application/vnd.openxmlformats-officedocument.wordprocessingml.document"?zy(e.data):jy(e.data,r),name:e.name||sx(r)}}const n=Sf(e.data,e.name);if(n){const r=typeof e.type=="string"&&e.type?Vy(e.type):"",o=r||n.type||Op(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=Vy(e.type);if(n!==e.type)return{...e,type:n}}return e};Dt();function lx(e,t){const n=e.itemid,r=e,o=t!==null&&typeof t=="object"?oo({...t}):te(t),i=te(null);return Bt(o,(a,l)=>{const u={fieldId:n.value,changeTime:Date.now(),oldValue:l,newValue:a,originalField:r};i.value=u}),{value:o}}function cx(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}=lx(e,i,te([])),l=te(e.itemtype),u=te(e.itemfieldtype),d=e,f=oo({fontFamily:e.fontfamily||"Arial",fontSize:e.font_size||"12pt",originalFontSize:e.original_font_size||"12pt"}),p=te(e.logicrules),g=te(!1),m=oo({}),v={SELECT:dx,IMAGEINPUT:ux,CHECKBOXINPUT:fx};return l.value in v&&Object.assign(m,v[l.value](e)),{id:t,icon:n,iconPack:r,label:o,placeholder:s,fieldType:l,fieldSubType:u,value:a,format:te(e.itemformat),logicRules:p,hidden:g,originalJSON:d,fieldStyle:f,valueGetter:e.valueGetter,...m}}function ux(e){return{fontfamily:te(e.fontfamily),iteminputtype:te(e.iteminputtype)}}function dx(e){return{options:te(e.itemoptions)}}function fx(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 Os=()=>new Map,Hy=e=>{const t=Os();return e.forEach((n,r)=>{t.set(r,n)}),t},wu=(e,t,n)=>{let r=e.get(t);return r===void 0&&e.set(t,r=n()),r},hx=(e,t)=>{const n=[];for(const[r,o]of e)n.push(t(o,r));return n},px=(e,t)=>{for(const[n,r]of e)if(t(r,n))return!0;return!1},Cu=()=>new Set,$y=e=>e[e.length-1],ku=Array.from,Gy=(e,t)=>{for(let n=0;n<e.length;n++)if(!t(e[n],n,e))return!1;return!0},ik=(e,t)=>{for(let n=0;n<e.length;n++)if(t(e[n],n,e))return!0;return!1},mx=(e,t)=>{const n=new Array(e);for(let r=0;r<e;r++)n[r]=t(r,n);return n},Pp=Array.isArray,gx=class{constructor(){this._observers=Os()}on(e,t){return wu(this._observers,e,Cu).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 ku((this._observers.get(e)||Os()).values()).forEach(n=>n(...t))}destroy(){this._observers=Os()}},ka=Math.floor,Fp=Math.abs,sk=(e,t)=>e<t?e:t,Su=(e,t)=>e>t?e:t,tG=Number.isNaN,vx=e=>e!==0?e<0:1/e<0,nG=1,rG=2,oG=4,iG=8,sG=32,aG=64,lG=128,yx=1<<17,bx=1<<18,wx=1<<19,Cx=1<<20,kx=1<<21,Sx=1<<22,_x=1<<23,Ax=1<<24,Ix=1<<25,Ex=1<<26,Tx=1<<27,xx=1<<28,Rx=1<<29,Mx=1<<30,cG=31,uG=63,dG=127,fG=yx-1,hG=bx-1,pG=wx-1,mG=Cx-1,gG=kx-1,vG=Sx-1,yG=_x-1,bG=Ax-1,wG=Ix-1,CG=Ex-1,kG=Tx-1,SG=xx-1,_G=Rx-1,AG=Mx-1,IG=2147483647,ak=Number.MAX_SAFE_INTEGER,lk=Number.MIN_SAFE_INTEGER,Lx=Number.isInteger||(e=>typeof e=="number"&&isFinite(e)&&ka(e)===e),EG=Number.isNaN,TG=Number.parseInt,ck=String.fromCharCode,xG=String.fromCodePoint,RG=ck(65535),Dx=e=>e.toLowerCase(),Ox=/^\s*/g,Px=e=>e.replace(Ox,""),Fx=/([A-Z])/g,uk=(e,t)=>Px(e.replace(Fx,n=>`${t}${Dx(n)}`)),Nx=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,Bx=e=>_f.encode(e),zx=_f?Bx:Nx,Wy=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});Wy&&Wy.decode(new Uint8Array).length===1&&(Wy=null);var jx=(e,t)=>mx(t,()=>e).join(""),Af=class{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}},Ky=()=>new Af,Vx=e=>{let t=e.cpos;for(let n=0;n<e.bufs.length;n++)t+=e.bufs[n].length;return t},Sa=e=>{const t=new Uint8Array(Vx(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},Ux=(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(Su(n,t)*2),e.cpos=0)},go=(e,t)=>{const n=e.cbuf.length;e.cpos===n&&(e.bufs.push(e.cbuf),e.cbuf=new Uint8Array(n*2),e.cpos=0),e.cbuf[e.cpos++]=t},qy=go,er=(e,t)=>{for(;t>127;)go(e,128|127&t),t=ka(t/128);go(e,127&t)},Yy=(e,t)=>{const n=vx(t);for(n&&(t=-t),go(e,(t>63?128:0)|(n?64:0)|63&t),t=ka(t/64);t>0;)go(e,(t>127?128:0)|127&t),t=ka(t/128)},Xy=new Uint8Array(3e4),Hx=Xy.length/3,$x=(e,t)=>{if(t.length<Hx){const n=_f.encodeInto(t,Xy).written||0;er(e,n);for(let r=0;r<n;r++)go(e,Xy[r])}else _i(e,zx(t))},Gx=(e,t)=>{const n=unescape(encodeURIComponent(t)),r=n.length;er(e,r);for(let o=0;o<r;o++)go(e,n.codePointAt(o))},_u=_f&&_f.encodeInto?$x:Gx,Zy=(e,t)=>{const n=e.cbuf.length,r=e.cpos,o=sk(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(Su(n*2,i)),e.cbuf.set(t.subarray(o)),e.cpos=i)},_i=(e,t)=>{er(e,t.byteLength),Zy(e,t)},Qy=(e,t)=>{Ux(e,t);const n=new DataView(e.cbuf.buffer,e.cpos,t);return e.cpos+=t,n},Wx=(e,t)=>Qy(e,4).setFloat32(0,t,!1),Kx=(e,t)=>Qy(e,8).setFloat64(0,t,!1),qx=(e,t)=>Qy(e,8).setBigInt64(0,t,!1),dk=new DataView(new ArrayBuffer(4)),Yx=e=>(dk.setFloat32(0,e),dk.getFloat32(0)===e),If=(e,t)=>{switch(typeof t){case"string":go(e,119),_u(e,t);break;case"number":Lx(t)&&Fp(t)<=2147483647?(go(e,125),Yy(e,t)):Yx(t)?(go(e,124),Wx(e,t)):(go(e,123),Kx(e,t));break;case"bigint":go(e,122),qx(e,t);break;case"object":if(t===null)go(e,126);else if(Pp(t)){go(e,117),er(e,t.length);for(let n=0;n<t.length;n++)If(e,t[n])}else if(t instanceof Uint8Array)go(e,116),_i(e,t);else{go(e,118);const n=Object.keys(t);er(e,n.length);for(let r=0;r<n.length;r++){const o=n[r];_u(e,o),If(e,t[o])}}break;case"boolean":go(e,t?120:121);break;default:go(e,127)}},fk=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&&er(this,this.count-1),this.count=1,this.w(this,e),this.s=e)}},hk=e=>{e.count>0&&(Yy(e.encoder,e.count===1?e.s:-e.s),e.count>1&&er(e.encoder,e.count-2))},Np=class{constructor(){this.encoder=new Af,this.s=0,this.count=0}write(e){this.s===e?this.count++:(hk(this),this.count=1,this.s=e)}toUint8Array(){return hk(this),Sa(this.encoder)}},pk=e=>{if(e.count>0){const t=e.diff*2+(e.count===1?0:1);Yy(e.encoder,t),e.count>1&&er(e.encoder,e.count-2)}},Jy=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++):(pk(this),this.count=1,this.diff=e-this.s,this.s=e)}toUint8Array(){return pk(this),Sa(this.encoder)}},Xx=class{constructor(){this.sarr=[],this.s="",this.lensE=new Np}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="",_u(e,this.sarr.join("")),Zy(e,this.lensE.toUint8Array()),Sa(e)}},wl=e=>new Error(e),ss=()=>{throw wl("Method unimplemented")},_a=()=>{throw wl("Unexpected case")},MG=crypto.subtle,Zx=crypto.getRandomValues.bind(crypto),mk=()=>Zx(new Uint32Array(1))[0],Qx="10000000-1000-4000-8000-100000000000",Jx=()=>Qx.replace(/[018]/g,e=>(e^mk()&15>>e/4).toString(16)),e6=Date.now,gk=e=>new Promise(e),LG=Promise.all.bind(Promise),vk=e=>e===void 0?null:e,t6=class{constructor(){this.map=new Map}setItem(e,t){this.map.set(e,t)}getItem(e){return this.map.get(e)}},yk=new t6,n6=!0;try{typeof localStorage<"u"&&localStorage&&(yk=localStorage,n6=!1)}catch{}var r6=yk,Ef=Symbol("Equality"),bk=(e,t)=>e===t||!!e?.[Ef]?.(t)||!1,o6=e=>typeof e=="object",i6=Object.assign,s6=Object.keys,a6=(e,t)=>{for(const n in e)t(e[n],n)},Bp=e=>s6(e).length,l6=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},e0=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),c6=(e,t)=>e===t||Bp(e)===Bp(t)&&Tf(e,(n,r)=>(n!==void 0||e0(t,r))&&bk(t[r],n)),u6=Object.freeze,wk=e=>{for(const t in e){const n=e[t];(typeof n=="object"||typeof n=="function")&&wk(e[t])}return u6(e)},t0=(e,t,n=0)=>{try{for(;n<e.length;n++)e[n](...t)}finally{n<e.length&&t0(e,t,n+1)}},zp=(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)||!zp(e.get(n),t.get(n)))return!1;break;case void 0:case Object:if(Bp(e)!==Bp(t))return!1;for(const n in e)if(!e0(e,n)||!zp(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(!zp(e[n],t[n]))return!1;break;default:return!1}return!0},d6=(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]",DG=typeof navigator<"u"?/Mac/.test(navigator.platform):!1,Ps,f6=[],h6=()=>{if(Ps===void 0)if(xf){Ps=Os();const e=process.argv;let t=null;for(let n=0;n<e.length;n++){const r=e[n];r[0]==="-"?(t!==null&&Ps.set(t,""),t=r):t!==null?(Ps.set(t,r),t=null):f6.push(r)}t!==null&&Ps.set(t,"")}else typeof location=="object"?(Ps=Os(),(location.search||"?").slice(1).split("&").forEach(e=>{if(e.length!==0){const[t,n]=e.split("=");Ps.set(`--${uk(t,"-")}`,n),Ps.set(`-${uk(t,"-")}`,n)}})):Ps=Os();return Ps},n0=e=>h6().has(e),jp=e=>vk(xf?process.env[e.toUpperCase().replaceAll("-","_")]:r6.getItem(e)),Ck=e=>n0("--"+e)||jp(e)!==null,p6=Ck("production"),m6=xf&&d6(process.env.FORCE_COLOR,["true","1","2"]),g6=m6||!n0("--no-colors")&&!Ck("no-color")&&(!xf||process.stdout.isTTY)&&(!xf||n0("--color")||jp("COLORTERM")!==null||(jp("TERM")||"").includes("color")),v6=class{constructor(e,t){this.left=e,this.right=t}},Aa=(e,t)=>new v6(e,t),kk=e=>e.next()>=.5,r0=(e,t,n)=>ka(e.next()*(n+1-t)+t),Sk=(e,t,n)=>ka(e.next()*(n+1-t)+t),o0=(e,t,n)=>Sk(e,t,n),y6=e=>ck(o0(e,97,122)),b6=(e,t=0,n=20)=>{const r=o0(e,t,n);let o="";for(let i=0;i<r;i++)o+=y6(e);return o},i0=(e,t)=>t[o0(e,0,t.length-1)],w6=Symbol("0schema"),C6=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(jx(" ",(this._rerrs.length-t)*2)+`${n.path!=null?`[${n.path}] `:""}${n.has} doesn't match ${n.expected}. ${n.message}`)}return e.join(`
|
|
5
5
|
`)}},s0=(e,t)=>e===t?!0:e==null||t==null||e.constructor!==t.constructor?!1:e[Ef]?bk(e,t):Pp(e)?Gy(e,n=>ik(t,r=>s0(n,r))):o6(e)?Tf(e,(n,r)=>s0(n,t[r])):!1,Xo=class{static _dilutes=!1;extends(e){let[t,n]=[this.shape,e.shape];return this.constructor._dilutes&&([n,t]=[t,n]),s0(t,n)}equals(e){return this.constructor===e.constructor&&zp(this.shape,e.shape)}[w6](){return!0}[Ef](e){return this.equals(e)}validate(e){return this.check(e)}check(e,t){ss()}get nullable(){return Au(this,Wp)}get optional(){return new Ik(this)}cast(e){return jk(e,this),e}expect(e){return jk(e,this),e}},a0=class extends Xo{constructor(e,t){super(),this.shape=e,this._c=t}check(e,t=void 0){const n=e?.constructor===this.shape&&(this._c==null||this._c(e));return!n&&t?.extend(null,this.shape.name,e?.constructor.name,e?.constructor!==this.shape?"Constructor match failed":"Check failed"),n}},Zr=(e,t=null)=>new a0(e,t),OG=Zr(a0),l0=class extends Xo{constructor(e){super(),this.shape=e}check(e,t){const n=this.shape(e);return!n&&t?.extend(null,"custom prop",e?.constructor.name,"failed to check custom prop"),n}},vo=e=>new l0(e),PG=Zr(l0),Vp=class extends Xo{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}},Up=(...e)=>new Vp(e),_k=Zr(Vp),k6=RegExp.escape||(e=>e.replace(/[().|&,$^[\]]/g,t=>"\\"+t)),Ak=e=>{if(Eu.check(e))return[k6(e)];if(_k.check(e))return e.shape.map(t=>t+"");if(Nk.check(e))return["[+-]?\\d+.?\\d*"];if(Bk.check(e))return[".*"];if(Hp.check(e))return e.shape.map(Ak).flat(1);_a()},S6=class extends Xo{constructor(e){super(),this.shape=e,this._r=new RegExp("^"+e.map(Ak).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}},FG=Zr(S6),_6=Symbol("optional"),Ik=class extends Xo{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[_6](){return!0}},A6=Zr(Ik),Ek=class extends Xo{check(e,t){return t?.extend(null,"never",typeof e),!1}},NG=new Ek,BG=Zr(Ek),Tk=class vE extends Xo{constructor(t,n=!1){super(),this.shape=t,this._isPartial=n}static _dilutes=!0;get partial(){return new vE(this.shape,!0)}check(t,n){return t==null?(n?.extend(null,"object","null"),!1):Tf(this.shape,(r,o)=>{const i=this._isPartial&&!e0(t,o)||r.check(t[o],n);return!i&&n?.extend(o.toString(),r.toString(),typeof t[o],"Object property does not match"),i})}},I6=e=>new Tk(e),E6=Zr(Tk),T6=vo(e=>e!=null&&(e.constructor===Object||e.constructor==null)),xk=class extends Xo{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)})}},Rk=(e,t)=>new xk(e,t),x6=Zr(xk),Mk=class extends Xo{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})}},R6=(...e)=>new Mk(e),zG=Zr(Mk),Lk=class extends Xo{constructor(e){super(),this.shape=e.length===1?e[0]:new c0(e)}check(e,t){const n=Pp(e)&&Gy(e,r=>this.shape.check(r));return!n&&t?.extend(null,"Array",""),n}},Dk=(...e)=>new Lk(e),M6=Zr(Lk),L6=vo(e=>Pp(e)),Ok=class extends Xo{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}},D6=(e,t=null)=>new Ok(e,t),jG=Zr(Ok),O6=D6(Xo),P6=class extends Xo{constructor(e){super(),this.len=e.length-1,this.args=R6(...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}},F6=Zr(P6),N6=vo(e=>typeof e=="function"),B6=class extends Xo{constructor(e){super(),this.shape=e}check(e,t){const n=Gy(this.shape,r=>r.check(e,t));return!n&&t?.extend(null,"Intersectinon",typeof e),n}},VG=Zr(B6,e=>e.shape.length>0),c0=class extends Xo{static _dilutes=!0;constructor(e){super(),this.shape=e}check(e,t){const n=ik(this.shape,r=>r.check(e,t));return t?.extend(null,"Union",typeof e),n}},Au=(...e)=>e.findIndex(t=>Hp.check(t))>=0?Au(...e.map(t=>Rf(t)).map(t=>Hp.check(t)?t.shape:[t]).flat(1)):e.length===1?e[0]:new c0(e),Hp=Zr(c0),Pk=()=>!0,$p=vo(Pk),z6=Zr(l0,e=>e.shape===Pk),u0=vo(e=>typeof e=="bigint"),j6=vo(e=>e===u0),Fk=vo(e=>typeof e=="symbol"),UG=vo(e=>e===Fk),Iu=vo(e=>typeof e=="number"),Nk=vo(e=>e===Iu),Eu=vo(e=>typeof e=="string"),Bk=vo(e=>e===Eu),Gp=vo(e=>typeof e=="boolean"),V6=vo(e=>e===Gp),zk=Up(void 0),HG=Zr(Vp,e=>e.shape.length===1&&e.shape[0]===void 0),$G=Up(void 0),Wp=Up(null),U6=Zr(Vp,e=>e.shape.length===1&&e.shape[0]===null),GG=Zr(Uint8Array),WG=Zr(a0,e=>e.shape===Uint8Array),H6=Au(Iu,Eu,Wp,zk,u0,Gp,Fk),KG=(()=>{const e=Dk($p),t=Rk(Eu,$p),n=Au(Iu,Eu,Wp,Gp,e,t);return e.shape=n,t.shape.values=n,n})(),Rf=e=>{if(O6.check(e))return e;if(T6.check(e)){const t={};for(const n in e)t[n]=Rf(e[n]);return I6(t)}else{if(L6.check(e))return Au(...e.map(Rf));if(H6.check(e))return Up(e);if(N6.check(e))return Zr(e)}_a()},jk=p6?()=>{}:(e,t)=>{const n=new C6;if(!t.check(e,n))throw wl(`Expected value to be of type ${t.constructor.name}.
|
|
6
6
|
${n.toString()}`)},$6=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($p,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")}}},G6=e=>new $6(e),Vk=G6($p).if(Nk,(e,t)=>r0(t,lk,ak)).if(Bk,(e,t)=>b6(t)).if(V6,(e,t)=>kk(t)).if(j6,(e,t)=>BigInt(r0(t,lk,ak))).if(Hp,(e,t)=>Tu(t,i0(t,e.shape))).if(E6,(e,t)=>{const n={};for(const r in e.shape){let o=e.shape[r];if(A6.check(o)){if(kk(t))continue;o=o.shape}n[r]=Vk(o,t)}return n}).if(M6,(e,t)=>{const n=[],r=Sk(t,0,42);for(let o=0;o<r;o++)n.push(Tu(t,e.shape));return n}).if(_k,(e,t)=>i0(t,e.shape)).if(U6,(e,t)=>null).if(F6,(e,t)=>{const n=Tu(t,e.res);return()=>n}).if(z6,(e,t)=>Tu(t,i0(t,[Iu,Eu,Wp,zk,u0,Gp,Dk(Iu),Rk(Au("a","b","c"),Iu)]))).if(x6,(e,t)=>{const n={},r=r0(t,0,3);for(let o=0;o<r;o++){const i=Tu(t,e.shape.keys);n[i]=Tu(t,e.shape.values)}return n}).done(),Tu=(e,t)=>Vk(Rf(t),e),yc=typeof document<"u"?document:{},qG=vo(e=>e.nodeType===X6),YG=typeof DOMParser<"u"?new DOMParser:null,XG=vo(e=>e.nodeType===K6),ZG=vo(e=>e.nodeType===q6),W6=e=>hx(e,(t,n)=>`${n}:${t};`).join(""),K6=yc.ELEMENT_NODE,q6=yc.TEXT_NODE,QG=yc.CDATA_SECTION_NODE,JG=yc.COMMENT_NODE,Y6=yc.DOCUMENT_NODE,eW=yc.DOCUMENT_TYPE_NODE,X6=yc.DOCUMENT_FRAGMENT_NODE,tW=vo(e=>e.nodeType===Y6),Ia=Symbol,Uk=Ia(),Hk=Ia(),Z6=Ia(),Q6=Ia(),J6=Ia(),$k=Ia(),e8=Ia(),d0=Ia(),t8=Ia(),n8=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},nW=e6(),r8={[Uk]:Aa("font-weight","bold"),[Hk]:Aa("font-weight","normal"),[Z6]:Aa("color","blue"),[J6]:Aa("color","green"),[Q6]:Aa("color","grey"),[$k]:Aa("color","red"),[e8]:Aa("color","purple"),[d0]:Aa("color","orange"),[t8]:Aa("color","black")},o8=e=>{e.length===1&&e[0]?.constructor===Function&&(e=e[0]());const t=[],n=[],r=Os();let o=[],i=0;for(;i<e.length;i++){const s=e[i],a=r8[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=W6(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},Gk=g6?o8:n8,i8=(...e)=>{console.log(...Gk(e)),Wk.forEach(t=>t.print(e))},s8=(...e)=>{console.warn(...Gk(e)),e.unshift(d0),Wk.forEach(t=>t.print(e))},Wk=Cu(),Kk=e=>({[Symbol.iterator](){return this},next:e}),a8=(e,t)=>Kk(()=>{let n;do n=e.next();while(!n.done&&!t(n.value));return n}),f0=(e,t)=>Kk(()=>{const{done:n,value:r}=e.next();return{done:n,value:n?void 0:t(r)}}),qk=class{constructor(e,t){this.clock=e,this.len=t}},Yk=class{constructor(){this.clients=new Map}},Xk=(e,t,n)=>t.clients.forEach((r,o)=>{const i=e.doc.store.clients.get(o);if(i!=null){const s=i[i.length-1],a=s.id.clock+s.length;for(let l=0,u=r[l];l<r.length&&u.clock<a;u=r[++l])a3(e,i,u.clock,u.len,n)}}),l8=(e,t)=>{let n=0,r=e.length-1;for(;n<=r;){const o=ka((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},Zk=(e,t)=>{const n=e.clients.get(t.client);return n!==void 0&&l8(n,t.clock)!==null},Qk=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 qk(o.clock,Su(o.len,i.clock+i.len-o.clock)):(r<n&&(t[r]=i),r++)}t.length=r})},Jk=(e,t,n,r)=>{wu(e.clients,t,()=>[]).push(new qk(n,r))},c8=()=>new Yk,u8=(e,t)=>{er(e.restEncoder,t.clients.size),ku(t.clients.entries()).sort((n,r)=>r[0]-n[0]).forEach(([n,r])=>{e.resetDsCurVal(),er(e.restEncoder,n);const o=r.length;er(e.restEncoder,o);for(let i=0;i<o;i++){const s=r[i];e.writeDsClock(s.clock),e.writeDsLen(s.len)}})},e3=mk,h0=class yE extends gx{constructor({guid:t=Jx(),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=e3(),this.guid=t,this.collectionid=n,this.share=new Map,this.store=new k8,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=gk(u=>{this.on("load",()=>{this.isLoaded=!0,u(this)})});const l=()=>gk(u=>{const d=f=>{(f===void 0||f===!0)&&(this.off("sync",d),u())};this.on("sync",d)});this.on("sync",u=>{u===!1&&this.isSynced&&(this.whenSynced=l()),this.isSynced=u===void 0||u===!0,this.isSynced&&!this.isLoaded&&this.emit("load",[this])}),this.whenSynced=l()}load(){const t=this._item;t!==null&&!this.shouldLoad&&fr(t.parent.doc,n=>{n.subdocsLoaded.add(this)},null,!0),this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(ku(this.subdocs).map(t=>t.guid))}transact(t,n=null){return fr(this,t,n)}get(t,n=Eo){const r=wu(this.share,t,()=>{const i=new n;return i._integrate(this,null),i}),o=r.constructor;if(n!==Eo&&o!==n)if(o===Eo){const i=new n;i._map=r._map,r._map.forEach(s=>{for(;s!==null;s=s.left)s.parent=i}),i._start=r._start;for(let s=i._start;s!==null;s=s.right)s.parent=i;return i._length=r._length,this.share.set(t,i),i._integrate(this,null),i}else throw new Error(`Type with the name ${t} has already been defined with a different constructor`);return r}getArray(t=""){return this.get(t,F8)}getText(t=""){return this.get(t,U8)}getMap(t=""){return this.get(t,C0)}getXmlElement(t=""){return this.get(t,R3)}getXmlFragment(t=""){return this.get(t,A0)}toJSON(){const t={};return this.share.forEach((n,r)=>{t[r]=n.toJSON()}),t}destroy(){this.isDestroyed=!0,ku(this.subdocs).forEach(n=>n.destroy());const t=this._item;if(t!==null){this._item=null;const n=t.content;n.doc=new yE({guid:this.guid,...n.opts,shouldLoad:!1}),n.doc._item=t,fr(t.parent.doc,r=>{const o=n.doc;t.deleted||r.subdocsAdded.add(o),r.subdocsRemoved.add(this)},null,!0)}this.emit("destroyed",[!0]),this.emit("destroy",[this]),super.destroy()}},d8=class{constructor(){this.restEncoder=Ky()}toUint8Array(){return Sa(this.restEncoder)}resetDsCurVal(){}writeDsClock(e){er(this.restEncoder,e)}writeDsLen(e){er(this.restEncoder,e)}},f8=class extends d8{writeLeftID(e){er(this.restEncoder,e.client),er(this.restEncoder,e.clock)}writeRightID(e){er(this.restEncoder,e.client),er(this.restEncoder,e.clock)}writeClient(e){er(this.restEncoder,e)}writeInfo(e){qy(this.restEncoder,e)}writeString(e){_u(this.restEncoder,e)}writeParentInfo(e){er(this.restEncoder,e?1:0)}writeTypeRef(e){er(this.restEncoder,e)}writeLen(e){er(this.restEncoder,e)}writeAny(e){If(this.restEncoder,e)}writeBuf(e){_i(this.restEncoder,e)}writeJSON(e){_u(this.restEncoder,JSON.stringify(e))}writeKey(e){_u(this.restEncoder,e)}},h8=class{constructor(){this.restEncoder=Ky(),this.dsCurrVal=0}toUint8Array(){return Sa(this.restEncoder)}resetDsCurVal(){this.dsCurrVal=0}writeDsClock(e){const t=e-this.dsCurrVal;this.dsCurrVal=e,er(this.restEncoder,t)}writeDsLen(e){e===0&&_a(),er(this.restEncoder,e-1),this.dsCurrVal+=e}},p8=class extends h8{constructor(){super(),this.keyMap=new Map,this.keyClock=0,this.keyClockEncoder=new Jy,this.clientEncoder=new Np,this.leftClockEncoder=new Jy,this.rightClockEncoder=new Jy,this.infoEncoder=new fk(qy),this.stringEncoder=new Xx,this.parentInfoEncoder=new fk(qy),this.typeRefEncoder=new Np,this.lenEncoder=new Np}toUint8Array(){const e=Ky();return er(e,0),_i(e,this.keyClockEncoder.toUint8Array()),_i(e,this.clientEncoder.toUint8Array()),_i(e,this.leftClockEncoder.toUint8Array()),_i(e,this.rightClockEncoder.toUint8Array()),_i(e,Sa(this.infoEncoder)),_i(e,this.stringEncoder.toUint8Array()),_i(e,Sa(this.parentInfoEncoder)),_i(e,this.typeRefEncoder.toUint8Array()),_i(e,this.lenEncoder.toUint8Array()),Zy(e,Sa(this.restEncoder)),Sa(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)}},m8=(e,t,n,r)=>{r=Su(r,t[0].id.clock);const o=Ea(t,r);er(e.restEncoder,t.length-o),e.writeClient(n),er(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)},g8=(e,t,n)=>{const r=new Map;n.forEach((o,i)=>{di(t,i)>o&&r.set(i,o)}),m0(t).forEach((o,i)=>{n.has(i)||r.set(i,0)}),er(e.restEncoder,r.size),ku(r.entries()).sort((o,i)=>i[0]-o[0]).forEach(([o,i])=>{m8(e,t.clients.get(o),o,i)})},v8=(e,t)=>g8(e,t.doc.store,t.beforeState),y8=class{constructor(){this.l=[]}},t3=()=>new y8,n3=(e,t)=>e.l.push(t),r3=(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.")},o3=(e,t,n)=>t0(e.l,[t,n]),Kp=class{constructor(e,t){this.client=e,this.clock=t}},qp=(e,t)=>e===t||e!==null&&t!==null&&e.client===t.client&&e.clock===t.clock,Pr=(e,t)=>new Kp(e,t),b8=e=>{for(const[t,n]of e.doc.share.entries())if(n===e)return t;throw _a()},w8=class{constructor(e,t){this.ds=e,this.sv=t}},C8=(e,t)=>new w8(e,t),rW=C8(c8(),new Map),xu=(e,t)=>t===void 0?!e.deleted:t.sv.has(e.id.client)&&(t.sv.get(e.id.client)||0)>e.id.clock&&!Zk(t.ds,e.id),p0=(e,t)=>{const n=wu(e.meta,p0,Cu),r=e.doc.store;n.has(t)||(t.sv.forEach((o,i)=>{o<di(r,i)&&Cl(e,Pr(i,o))}),Xk(e,t.ds,o=>{}),n.add(t))},k8=class{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}},m0=e=>{const t=new Map;return e.clients.forEach((n,r)=>{const o=n[n.length-1];t.set(r,o.id.clock+o.length)}),t},di=(e,t)=>{const n=e.clients.get(t);if(n===void 0)return 0;const r=n[n.length-1];return r.id.clock+r.length},i3=(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 _a()}n.push(t)},Ea=(e,t)=>{let n=0,r=e.length-1,o=e[r],i=o.id.clock;if(i===t)return r;let s=ka(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=ka((n+r)/2)}throw _a()},S8=(e,t)=>{const n=e.clients.get(t.client);return n[Ea(n,t.clock)]},g0=S8,v0=(e,t,n)=>{const r=Ea(t,n),o=t[r];return o.id.clock<n&&o instanceof Ai?(t.splice(r+1,0,O3(e,o,n-o.id.clock)),r+1):r},Cl=(e,t)=>{const n=e.doc.store.clients.get(t.client);return n[v0(e,n,t.clock)]},s3=(e,t,n)=>{const r=t.clients.get(n.client),o=Ea(r,n.clock),i=r[o];return n.clock!==i.id.clock+i.length-1&&i.constructor!==Sl&&r.splice(o+1,0,O3(e,i,n.clock-i.id.clock+1)),i},_8=(e,t,n)=>{const r=e.clients.get(t.id.client);r[Ea(r,t.id.clock)]=n},a3=(e,t,n,r,o)=>{if(r===0)return;const i=n+r;let s=v0(e,t,n),a;do a=t[s++],i<a.id.clock+a.length&&v0(e,t,i),o(a);while(s<t.length&&t[s].id.clock<i)},A8=class{constructor(e,t,n){this.doc=e,this.deleteSet=new Yk,this.beforeState=m0(e.store),this.afterState=new Map,this.changed=new Map,this.changedParentTypes=new Map,this._mergeStructs=[],this.origin=t,this.meta=new Map,this.local=n,this.subdocsAdded=new Set,this.subdocsRemoved=new Set,this.subdocsLoaded=new Set,this._needFormattingCleanup=!1}},l3=(e,t)=>t.deleteSet.clients.size===0&&!px(t.afterState,(n,r)=>t.beforeState.get(r)!==n)?!1:(Qk(t.deleteSet),v8(e,t),u8(e,t.deleteSet),!0),c3=(e,t,n)=>{const r=t._item;(r===null||r.id.clock<(e.beforeState.get(r.id.client)||0)&&!r.deleted)&&wu(e.changed,t,Cu).add(n)},Yp=(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},I8=(e,t,n)=>{for(const[r,o]of e.clients.entries()){const i=t.clients.get(r);for(let s=o.length-1;s>=0;s--){const a=o[s],l=a.clock+a.len;for(let u=Ea(i,a.clock),d=i[u];u<i.length&&d.id.clock<l;d=i[++u]){const f=i[u];if(a.clock+a.len<=f.id.clock)break;f instanceof Ai&&f.deleted&&!f.keep&&n(f)&&f.gc(t,!1)}}}},E8=(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=sk(o.length-1,1+Ea(o,s.clock+s.len-1));for(let l=a,u=o[l];l>0&&u.id.clock>=s.clock;u=o[l])l-=1+Yp(o,l)}})},u3=(e,t)=>{if(t<e.length){const n=e[t],r=n.doc,o=r.store,i=n.deleteSet,s=n._mergeStructs;try{Qk(i),n.afterState=m0(n.doc.store),r.emit("beforeObserverCalls",[n,r]);const a=[];n.changed.forEach((l,u)=>a.push(()=>{(u._item===null||!u._item.deleted)&&u._callObserver(n,l)})),a.push(()=>{n.changedParentTypes.forEach((l,u)=>{u._dEH.l.length>0&&(u._item===null||!u._item.deleted)&&(l=l.filter(d=>d.target._item===null||!d.target._item.deleted),l.forEach(d=>{d.currentTarget=u,d._path=null}),l.sort((d,f)=>d.path.length-f.path.length),a.push(()=>{o3(u._dEH,l,n)}))}),a.push(()=>r.emit("afterTransaction",[n,r])),a.push(()=>{n._needFormattingCleanup&&j8(n)})}),t0(a,[])}finally{r.gc&&I8(i,o,r.gcFilter),E8(i,o),n.afterState.forEach((d,f)=>{const p=n.beforeState.get(f)||0;if(p!==d){const g=o.clients.get(f),m=Su(Ea(g,p),1);for(let v=g.length-1;v>=m;)v-=1+Yp(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=Ea(g,p);m+1<g.length&&Yp(g,m+1)>1||m>0&&Yp(g,m)}if(!n.local&&n.afterState.get(r.clientID)!==n.beforeState.get(r.clientID)&&(i8(d0,Uk,"[yjs] ",Hk,$k,"Changed the client-id because another client seems to be using it."),r.clientID=e3()),r.emit("afterTransactionCleanup",[n,r]),r._observers.has("update")){const d=new f8;l3(d,n)&&r.emit("update",[d.toUint8Array(),n.origin,r,n])}if(r._observers.has("updateV2")){const d=new p8;l3(d,n)&&r.emit("updateV2",[d.toUint8Array(),n.origin,r,n])}const{subdocsAdded:a,subdocsLoaded:l,subdocsRemoved:u}=n;(a.size>0||u.size>0||l.size>0)&&(a.forEach(d=>{d.clientID=r.clientID,d.collectionid==null&&(d.collectionid=r.collectionid),r.subdocs.add(d)}),u.forEach(d=>r.subdocs.delete(d)),r.emit("subdocs",[{loaded:l,added:a,removed:u},r,n]),u.forEach(d=>d.destroy())),e.length<=t+1?(r._transactionCleanups=[],r.emit("afterAllTransactions",[r,e])):u3(e,t+1)}}},fr=(e,t,n=null,r=!0)=>{const o=e._transactionCleanups;let i=!1,s=null;e._transaction===null&&(i=!0,e._transaction=new A8(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&&u3(o,0)}}return s},d3="You must not compute changes after the event-handler fired.",Xp=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=T8(this.currentTarget,this.target))}deletes(e){return Zk(this.transaction.deleteSet,e.id)}get keys(){if(this._keys===null){if(this.transaction.doc._transactionCleanups.length===0)throw wl(d3);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=$y(s.content.getContent());else return;else s!==null&&this.deletes(s)?(o="update",i=$y(s.content.getContent())):(o="add",i=void 0)}else if(this.deletes(r))o="delete",i=$y(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(d3);const t=this.target,n=Cu(),r=Cu(),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}},T8=(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=()=>{s8("Invalid access: Add Yjs type to a document before reading data.")},f3=80,y0=0,x8=class{constructor(e,t){e.marker=!0,this.p=e,this.index=t,this.timestamp=y0++}},R8=e=>{e.timestamp=y0++},h3=(e,t,n)=>{e.p.marker=!1,e.p=t,t.marker=!0,e.index=n,e.timestamp=y0++},M8=(e,t,n)=>{if(e.length>=f3){const r=e.reduce((o,i)=>o.timestamp<i.timestamp?o:i);return h3(r,t,n),r}else{const r=new x8(t,n);return e.push(r),r}},Zp=(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)=>Fp(t-i.index)<Fp(t-s.index)?i:s);let r=e._start,o=0;for(n!==null&&(r=n.p,o=n.index,R8(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&&Fp(n.index-o)<r.parent.length/f3?(h3(n,r,o),n):M8(e._searchMarker,r,o)},Mf=(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=Su(t,o.index+n))}},Qp=(e,t,n)=>{const r=e,o=t.changedParentTypes;for(;wu(o,e,()=>[]).push(n),e._item!==null;)e=e._item.parent;o3(r._eH,n,t)},Eo=class{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=t3(),this._dEH=t3(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(e,t){this.doc=e,this._item=t}_copy(){throw ss()}clone(){throw ss()}_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){n3(this._eH,e)}observeDeep(e){n3(this._dEH,e)}unobserve(e){r3(this._eH,e)}unobserveDeep(e){r3(this._dEH,e)}toJSON(){}},p3=(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},m3=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},Lf=(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}},g3=(e,t)=>{const n=[];return Lf(e,(r,o)=>{n.push(t(r,o,e))}),n},L8=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}}}},v3=(e,t)=>{e.doc??zo();const n=Zp(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}},Jp=(e,t,n,r)=>{let o=n;const i=e.doc,s=i.clientID,a=i.store,l=n===null?t._start:n.right;let u=[];const d=()=>{u.length>0&&(o=new Ai(Pr(s,di(a,s)),o,o&&o.lastId,l,l&&l.id,t,null,new I0(u)),o.integrate(e,0),u=[])};r.forEach(f=>{if(f===null)u.push(f);else switch(f.constructor){case Number:case Object:case Boolean:case Array:case String:u.push(f);break;default:switch(d(),f.constructor){case Uint8Array:case ArrayBuffer:o=new Ai(Pr(s,di(a,s)),o,o&&o.lastId,l,l&&l.id,t,null,new L3(new Uint8Array(f))),o.integrate(e,0);break;case h0:o=new Ai(Pr(s,di(a,s)),o,o&&o.lastId,l,l&&l.id,t,null,new D3(f)),o.integrate(e,0);break;default:if(f instanceof Eo)o=new Ai(Pr(s,di(a,s)),o,o&&o.lastId,l,l&&l.id,t,null,new Lu(f)),o.integrate(e,0);else throw new Error("Unexpected content type in insert operation")}}}),d()},y3=()=>wl("Length exceeded!"),b3=(e,t,n,r)=>{if(n>t._length)throw y3();if(n===0)return t._searchMarker&&Mf(t._searchMarker,n,r.length),Jp(e,t,null,r);const o=n,i=Zp(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,Pr(s.id.client,s.id.clock+n));break}n-=s.length}return t._searchMarker&&Mf(t._searchMarker,o,r.length),Jp(e,t,s,r)},D8=(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 Jp(e,t,r,n)},w3=(e,t,n,r)=>{if(r===0)return;const o=n,i=r,s=Zp(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,Pr(a.id.client,a.id.clock+n)),n-=a.length);for(;r>0&&a!==null;)a.deleted||(r<a.length&&Cl(e,Pr(a.id.client,a.id.clock+r)),a.delete(e),r-=a.length),a=a.right;if(r>0)throw y3();t._searchMarker&&Mf(t._searchMarker,o,-i+r)},em=(e,t,n)=>{const r=t._map.get(n);r!==void 0&&r.delete(e)},b0=(e,t,n,r)=>{const o=t._map.get(n)||null,i=e.doc,s=i.clientID;let a;if(r==null)a=new I0([r]);else switch(r.constructor){case Number:case Object:case Boolean:case Array:case String:case Date:case BigInt:a=new I0([r]);break;case Uint8Array:a=new L3(r);break;case h0:a=new D3(r);break;default:if(r instanceof Eo)a=new Lu(r);else throw new Error("Unexpected content type")}new Ai(Pr(s,di(i.store,s)),o,o&&o.lastId,null,null,t,n,a).integrate(e,0)},w0=(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},C3=e=>{const t={};return e.doc??zo(),e._map.forEach((n,r)=>{n.deleted||(t[r]=n.content.getContent()[n.length-1])}),t},k3=(e,t)=>{e.doc??zo();const n=e._map.get(t);return n!==void 0&&!n.deleted},O8=(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&&xu(i,t)&&(n[o]=i.content.getContent()[i.length-1])}),n},tm=e=>(e.doc??zo(),a8(e._map.entries(),t=>!t[1].deleted)),P8=class extends Xp{},F8=class Rg extends Eo{constructor(){super(),this._prelimContent=[],this._searchMarker=[]}static from(t){const n=new Rg;return n.push(t),n}_integrate(t,n){super._integrate(t,n),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new Rg}clone(){const t=new Rg;return t.insert(0,this.toArray().map(n=>n instanceof Eo?n.clone():n)),t}get length(){return this.doc??zo(),this._length}_callObserver(t,n){super._callObserver(t,n),Qp(this,t,new P8(this,t))}insert(t,n){this.doc!==null?fr(this.doc,r=>{b3(r,this,t,n)}):this._prelimContent.splice(t,0,...n)}push(t){this.doc!==null?fr(this.doc,n=>{D8(n,this,t)}):this._prelimContent.push(...t)}unshift(t){this.insert(0,t)}delete(t,n=1){this.doc!==null?fr(this.doc,r=>{w3(r,this,t,n)}):this._prelimContent.splice(t,n)}get(t){return v3(this,t)}toArray(){return m3(this)}slice(t=0,n=this.length){return p3(this,t,n)}toJSON(){return this.map(t=>t instanceof Eo?t.toJSON():t)}map(t){return g3(this,t)}forEach(t){Lf(this,t)}[Symbol.iterator](){return L8(this)}_write(t){t.writeTypeRef(q8)}},N8=class extends Xp{constructor(e,t,n){super(e,t),this.keysChanged=n}},C0=class k2 extends Eo{constructor(t){super(),this._prelimContent=null,t===void 0?this._prelimContent=new Map:this._prelimContent=new Map(t)}_integrate(t,n){super._integrate(t,n),this._prelimContent.forEach((r,o)=>{this.set(o,r)}),this._prelimContent=null}_copy(){return new k2}clone(){const t=new k2;return this.forEach((n,r)=>{t.set(r,n instanceof Eo?n.clone():n)}),t}_callObserver(t,n){Qp(this,t,new N8(this,t,n))}toJSON(){this.doc??zo();const t={};return this._map.forEach((n,r)=>{if(!n.deleted){const o=n.content.getContent()[n.length-1];t[r]=o instanceof Eo?o.toJSON():o}}),t}get size(){return[...tm(this)].length}keys(){return f0(tm(this),t=>t[0])}values(){return f0(tm(this),t=>t[1].content.getContent()[t[1].length-1])}entries(){return f0(tm(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?fr(this.doc,n=>{em(n,this,t)}):this._prelimContent.delete(t)}set(t,n){return this.doc!==null?fr(this.doc,r=>{b0(r,this,t,n)}):this._prelimContent.set(t,n),n}get(t){return w0(this,t)}has(t){return k3(this,t)}clear(){this.doc!==null?fr(this.doc,t=>{this.forEach(function(n,r,o){em(t,o,r)})}):this._prelimContent.clear()}_write(t){t.writeTypeRef(Y8)}},kl=(e,t)=>e===t||typeof e=="object"&&typeof t=="object"&&e&&t&&c6(e,t),k0=class{constructor(e,t,n,r){this.left=e,this.right=t,this.index=n,this.currentAttributes=r}forward(){this.right===null&&_a(),this.right.content.constructor===jo?this.right.deleted||Ru(this.currentAttributes,this.right.content):this.right.deleted||(this.index+=this.right.length),this.left=this.right,this.right=this.right.right}},S3=(e,t,n)=>{for(;t.right!==null&&n>0;)t.right.content.constructor===jo?t.right.deleted||Ru(t.currentAttributes,t.right.content):t.right.deleted||(n<t.right.length&&Cl(e,Pr(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},nm=(e,t,n,r)=>{const o=new Map,i=r?Zp(t,n):null;if(i){const s=new k0(i.p.left,i.p,i.index,o);return S3(e,s,n-i.index)}else{const s=new k0(null,t._start,0,o);return S3(e,s,n)}},_3=(e,t,n,r)=>{for(;n.right!==null&&(n.right.deleted===!0||n.right.content.constructor===jo&&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,u=n.right,d=new Ai(Pr(i,di(o.store,i)),l,l&&l.lastId,u,u&&u.id,t,null,new jo(a,s));d.integrate(e,0),n.right=d,n.forward()})},Ru=(e,t)=>{const{key:n,value:r}=t;r===null?e.delete(n):e.set(n,r)},A3=(e,t)=>{for(;e.right!==null;){if(!(e.right.deleted||e.right.content.constructor===jo&&kl(t[e.right.content.key]??null,e.right.content.value)))break;e.forward()}},I3=(e,t,n,r)=>{const o=e.doc,i=o.clientID,s=new Map;for(const a in r){const l=r[a],u=n.currentAttributes.get(a)??null;if(!kl(u,l)){s.set(a,u);const{left:d,right:f}=n;n.right=new Ai(Pr(i,di(o.store,i)),d,d&&d.lastId,f,f&&f.id,t,null,new jo(a,l)),n.right.integrate(e,0),n.forward()}}return s},S0=(e,t,n,r,o)=>{n.currentAttributes.forEach((p,g)=>{o[g]===void 0&&(o[g]=null)});const i=e.doc,s=i.clientID;A3(n,o);const a=I3(e,t,n,o),l=r.constructor===String?new Mu(r):r instanceof Eo?new Lu(r):new rm(r);let{left:u,right:d,index:f}=n;t._searchMarker&&Mf(t._searchMarker,n.index,l.getLength()),d=new Ai(Pr(s,di(i.store,s)),u,u&&u.lastId,d,d&&d.id,t,null,l),d.integrate(e,0),n.right=d,n.index=f,n.forward(),_3(e,t,n,a)},E3=(e,t,n,r,o)=>{const i=e.doc,s=i.clientID;A3(n,o);const a=I3(e,t,n,o);e:for(;n.right!==null&&(r>0||a.size>0&&(n.right.deleted||n.right.content.constructor===jo));){if(!n.right.deleted)switch(n.right.content.constructor){case jo:{const{key:l,value:u}=n.right.content,d=o[l];if(d!==void 0){if(kl(d,u))a.delete(l);else{if(r===0)break e;a.set(l,u)}n.right.delete(e)}else n.currentAttributes.set(l,u);break}default:r<n.right.length&&Cl(e,Pr(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(Pr(s,di(i.store,s)),n.left,n.left&&n.left.lastId,n.right,n.right&&n.right.id,t,null,new Mu(l)),n.right.integrate(e,0),n.forward()}_3(e,t,n,a)},T3=(e,t,n,r,o)=>{let i=t;const s=Os();for(;i&&(!i.countable||i.deleted);){if(!i.deleted&&i.content.constructor===jo){const u=i.content;s.set(u.key,u)}i=i.right}let a=0,l=!1;for(;t!==i;){if(n===t&&(l=!0),!t.deleted){const u=t.content;if(u.constructor===jo){const{key:d,value:f}=u,p=r.get(d)??null;(s.get(d)!==u||p===f)&&(t.delete(e),a++,!l&&(o.get(d)??null)===f&&p!==f&&(p===null?o.delete(d):o.set(d,p))),!l&&!t.deleted&&Ru(o,u)}}t=t.right}return a},B8=(e,t)=>{for(;t&&t.right&&(t.right.deleted||!t.right.countable);)t=t.right;const n=new Set;for(;t&&(t.deleted||!t.countable);){if(!t.deleted&&t.content.constructor===jo){const r=t.content.key;n.has(r)?t.delete(e):n.add(r)}t=t.left}},z8=e=>{let t=0;return fr(e.doc,n=>{let r=e._start,o=e._start,i=Os();const s=Hy(i);for(;o;)o.deleted===!1&&(o.content.constructor===jo?Ru(s,o.content):(t+=T3(n,r,o,i,s),i=Hy(s),r=o)),o=o.right}),t},j8=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&&a3(e,n.store.clients.get(r),i,o,s=>{!s.deleted&&s.content.constructor===jo&&s.constructor!==Sl&&t.add(s.parent)})}fr(n,r=>{Xk(e,e.deleteSet,o=>{if(o instanceof Sl||!o.parent._hasFormatting||t.has(o.parent))return;const i=o.parent;o.content.constructor===jo?t.add(i):B8(r,o)});for(const o of t)z8(o)})},x3=(e,t,n)=>{const r=n,o=Hy(t.currentAttributes),i=t.right;for(;n>0&&t.right!==null;){if(t.right.deleted===!1)switch(t.right.content.constructor){case Lu:case rm:case Mu:n<t.right.length&&Cl(e,Pr(t.right.id.client,t.right.id.clock+n)),n-=t.right.length,t.right.delete(e);break}t.forward()}i&&T3(e,i,t.right,o,t.currentAttributes);const s=(t.left||t.right).parent;return s._searchMarker&&Mf(s._searchMarker,t.index,-r+n),t},V8=class extends Xp{constructor(e,t,n){super(e,t),this.childListChanged=!1,this.keysChanged=new Set,n.forEach(r=>{r===null?this.childListChanged=!0:this.keysChanged.add(r)})}get changes(){if(this._changes===null){const e={keys:this.keys,delta:this.delta,added:new Set,deleted:new Set};this._changes=e}return this._changes}get delta(){if(this._delta===null){const e=this.target.doc,t=[];fr(e,n=>{const r=new Map,o=new Map;let i=this.target._start,s=null;const a={};let l="",u=0,d=0;const f=()=>{if(s!==null){let p=null;switch(s){case"delete":d>0&&(p={delete:d}),d=0;break;case"insert":(typeof l=="object"||l.length>0)&&(p={insert:l},r.size>0&&(p.attributes={},r.forEach((g,m)=>{g!==null&&(p.attributes[m]=g)}))),l="";break;case"retain":u>0&&(p={retain:u},l6(a)||(p.attributes=i6({},a))),u=0;break}p&&t.push(p),s=null}};for(;i!==null;){switch(i.content.constructor){case Lu:case rm:this.adds(i)?this.deletes(i)||(f(),s="insert",l=i.content.getContent()[0],f()):this.deletes(i)?(s!=="delete"&&(f(),s="delete"),d+=1):i.deleted||(s!=="retain"&&(f(),s="retain"),u+=1);break;case Mu:this.adds(i)?this.deletes(i)||(s!=="insert"&&(f(),s="insert"),l+=i.content.str):this.deletes(i)?(s!=="delete"&&(f(),s="delete"),d+=i.length):i.deleted||(s!=="retain"&&(f(),s="retain"),u+=i.length);break;case jo:{const{key:p,value:g}=i.content;if(this.adds(i)){if(!this.deletes(i)){const m=r.get(p)??null;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(),Ru(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}},U8=class S2 extends Eo{constructor(t){super(),this._pending=t!==void 0?[()=>this.insert(0,t)]:[],this._searchMarker=[],this._hasFormatting=!1}get length(){return this.doc??zo(),this._length}_integrate(t,n){super._integrate(t,n);try{this._pending.forEach(r=>r())}catch(r){console.error(r)}this._pending=null}_copy(){return new S2}clone(){const t=new S2;return t.applyDelta(this.toDelta()),t}_callObserver(t,n){super._callObserver(t,n);const r=new V8(this,t,n);Qp(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===Mu&&(t+=n.content.str),n=n.right;return t}toJSON(){return this.toString()}applyDelta(t,{sanitize:n=!0}={}){this.doc!==null?fr(this.doc,r=>{const o=new k0(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
|
`,kA=()=>{if(typeof document>"u")throw new Error(MF)},cs=class AE{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 AE(this.m)}copyInto(t){t.m[0]=this.m[0],t.m[1]=this.m[1],t.m[2]=this.m[2],t.m[3]=this.m[3],t.m[4]=this.m[4],t.m[5]=this.m[5]}point(t){const n=this.m;return{x:n[0]*t.x+n[2]*t.y+n[4],y:n[1]*t.x+n[3]*t.y+n[5]}}translate(t,n){return this.m[4]+=this.m[0]*t+this.m[2]*n,this.m[5]+=this.m[1]*t+this.m[3]*n,this}scale(t,n){return this.m[0]*=t,this.m[1]*=t,this.m[2]*=n,this.m[3]*=n,this}rotate(t){const n=Math.cos(t),r=Math.sin(t),o=this.m[0]*n+this.m[2]*r,i=this.m[1]*n+this.m[3]*r,s=this.m[0]*-r+this.m[2]*n,a=this.m[1]*-r+this.m[3]*n;return this.m[0]=o,this.m[1]=i,this.m[2]=s,this.m[3]=a,this}getTranslation(){return{x:this.m[4],y:this.m[5]}}skew(t,n){const r=this.m[0]+this.m[2]*n,o=this.m[1]+this.m[3]*n,i=this.m[2]+this.m[0]*t,s=this.m[3]+this.m[1]*t;return this.m[0]=r,this.m[1]=o,this.m[2]=i,this.m[3]=s,this}multiply(t){const n=this.m[0]*t.m[0]+this.m[2]*t.m[1],r=this.m[1]*t.m[0]+this.m[3]*t.m[1],o=this.m[0]*t.m[2]+this.m[2]*t.m[3],i=this.m[1]*t.m[2]+this.m[3]*t.m[3],s=this.m[0]*t.m[4]+this.m[2]*t.m[5]+this.m[4],a=this.m[1]*t.m[4]+this.m[3]*t.m[5]+this.m[5];return this.m[0]=n,this.m[1]=r,this.m[2]=o,this.m[3]=i,this.m[4]=s,this.m[5]=a,this}invert(){const t=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),n=this.m[3]*t,r=-this.m[1]*t,o=-this.m[2]*t,i=this.m[0]*t,s=t*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),a=t*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);return this.m[0]=n,this.m[1]=r,this.m[2]=o,this.m[3]=i,this.m[4]=s,this.m[5]=a,this}getMatrix(){return this.m}decompose(){const t=this.m[0],n=this.m[1],r=this.m[2],o=this.m[3],i=this.m[4],s=this.m[5],a=t*o-n*r,l={x:i,y:s,rotation:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(t!=0||n!=0){const u=Math.sqrt(t*t+n*n);l.rotation=n>0?Math.acos(t/u):-Math.acos(t/u),l.scaleX=u,l.scaleY=a/u,l.skewX=(t*r+n*o)/a,l.skewY=0}else if(r!=0||o!=0){const u=Math.sqrt(r*r+o*o);l.rotation=Math.PI/2-(o>0?Math.acos(-r/u):-Math.acos(r/u)),l.scaleX=a/u,l.scaleY=u,l.skewX=0,l.skewY=(t*r+n*o)/a}return l.rotation=Oe._getRotation(l.rotation),l}},LF="[object Array]",DF="[object Number]",OF="[object String]",PF="[object Boolean]",FF=Math.PI/180,NF=180/Math.PI,Hf="#",BF="",zF="0",jF="Konva warning: ",SA="Konva error: ",VF="rgb(",hb={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]},UF=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/,bm=[],$f=null,HF=typeof requestAnimationFrame<"u"&&requestAnimationFrame||function(e){setTimeout(e,16)},Oe={_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)===LF},_isNumber(e){return Object.prototype.toString.call(e)===DF&&!isNaN(e)&&isFinite(e)},_isString(e){return Object.prototype.toString.call(e)===OF},_isBoolean(e){return Object.prototype.toString.call(e)===PF},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){bm.push(e),bm.length===1&&HF(function(){const t=bm;bm=[],t.forEach(function(n){n()})})},createCanvasElement(){kA();const e=document.createElement("canvas");try{e.style=e.style||{}}catch{}return e},createImageElement(){return kA(),document.createElement("img")},_isInDocument(e){for(;e=e.parentNode;)if(e==document)return!0;return!1},_urlToImage(e,t){const n=Oe.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,BF);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=zF+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 hb?(t=hb[e],{r:t[0],g:t[1],b:t[2]}):e[0]===Hf?this._hexToRgb(e.substring(1)):e.substr(0,4)===VF?(t=UF.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",Oe._namedColorToRBA(e)||Oe._hex3ColorToRGBA(e)||Oe._hex4ColorToRGBA(e)||Oe._hex6ColorToRGBA(e)||Oe._hex8ColorToRGBA(e)||Oe._rgbColorToRGBA(e)||Oe._rgbaColorToRGBA(e)||Oe._hslColorToRGBA(e)},_namedColorToRBA(e){const t=hb[e.toLowerCase()];return t?{r:t[0],g:t[1],b:t[2],a:1}:null},_rgbColorToRGBA(e){if(e.indexOf("rgb(")===0){e=e.match(/rgb\(([^)]+)\)/)[1];const t=e.split(/ *, */).map(Number);return{r:t[0],g:t[1],b:t[2],a:1}}},_rgbaColorToRGBA(e){if(e.indexOf("rgba(")===0){e=e.match(/rgba\(([^)]+)\)/)[1];const t=e.split(/ *, */).map((n,r)=>n.slice(-1)==="%"?r===3?parseInt(n)/100:parseInt(n)/100*255:Number(n));return{r:t[0],g:t[1],b:t[2],a:t[3]}}},_hex8ColorToRGBA(e){if(e[0]==="#"&&e.length===9)return{r:parseInt(e.slice(1,3),16),g:parseInt(e.slice(3,5),16),b:parseInt(e.slice(5,7),16),a:parseInt(e.slice(7,9),16)/255}},_hex6ColorToRGBA(e){if(e[0]==="#"&&e.length===7)return{r:parseInt(e.slice(1,3),16),g:parseInt(e.slice(3,5),16),b:parseInt(e.slice(5,7),16),a:1}},_hex4ColorToRGBA(e){if(e[0]==="#"&&e.length===5)return{r:parseInt(e[1]+e[1],16),g:parseInt(e[2]+e[2],16),b:parseInt(e[3]+e[3],16),a:parseInt(e[4]+e[4],16)/255}},_hex3ColorToRGBA(e){if(e[0]==="#"&&e.length===4)return{r:parseInt(e[1]+e[1],16),g:parseInt(e[2]+e[2],16),b:parseInt(e[3]+e[3],16),a:1}},_hslColorToRGBA(e){if(/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.test(e)){const[t,...n]=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(e),r=Number(n[0])/360,o=Number(n[1])/100,i=Number(n[2])/100;let s,a,l;if(o===0)return l=i*255,{r:Math.round(l),g:Math.round(l),b:Math.round(l),a:1};i<.5?s=i*(1+o):s=i+o-i*o;const u=2*i-s,d=[0,0,0];for(let f=0;f<3;f++)a=r+1/3*-(f-1),a<0&&a++,a>1&&a--,6*a<1?l=u+(s-u)*6*a:2*a<1?l=s:3*a<2?l=u+(s-u)*(2/3-a)*6:l=u,d[f]=l*255;return{r:Math.round(d[0]),g:Math.round(d[1]),b:Math.round(d[2]),a:1}}},haveIntersection(e,t){return!(t.x>e.x+e.width||t.x+t.width<e.x||t.y>e.y+e.height||t.y+t.height<e.y)},cloneObject(e){const t={};for(const n in e)this._isPlainObject(e[n])?t[n]=this.cloneObject(e[n]):this._isArray(e[n])?t[n]=this.cloneArray(e[n]):t[n]=e[n];return t},cloneArray(e){return e.slice(0)},degToRad(e){return e*FF},radToDeg(e){return e*NF},_degToRad(e){return Oe.warn("Util._degToRad is removed. Please use public Util.degToRad instead."),Oe.degToRad(e)},_radToDeg(e){return Oe.warn("Util._radToDeg is removed. Please use public Util.radToDeg instead."),Oe.radToDeg(e)},_getRotation(e){return St.angleDeg?Oe.radToDeg(e):e},_capitalize(e){return e.charAt(0).toUpperCase()+e.slice(1)},throw(e){throw new Error(SA+e)},error(e){console.error(SA+e)},warn(e){St.showWarnings&&console.warn(jF+e)},each(e,t){for(const n in e)t(n,e[n])},_inRange(e,t,n){return t<=e&&e<n},_getProjectionToSegment(e,t,n,r,o,i){let s,a,l;const u=(e-n)*(e-n)+(t-r)*(t-r);if(u==0)s=e,a=t,l=(o-n)*(o-n)+(i-r)*(i-r);else{const d=((o-e)*(n-e)+(i-t)*(r-t))/u;d<0?(s=e,a=t,l=(e-o)*(e-o)+(t-i)*(t-i)):d>1?(s=n,a=r,l=(n-o)*(n-o)+(r-i)*(r-i)):(s=e+d*(n-e),a=t+d*(r-t),l=(s-o)*(s-o)+(a-i)*(a-i))}return[s,a,l]},_getProjectionToLine(e,t,n){const r=Oe.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=Oe._getProjectionToSegment(i.x,i.y,a.x,a.y,e.x,e.y),u=l[0],d=l[1],f=l[2];f<o&&(r.x=u,r.y=d,o=f)}),r},_prepareArrayForTween(e,t,n){const r=[],o=[];if(e.length>t.length){const s=t;t=e,e=s}for(let s=0;s<e.length;s+=2)r.push({x:e[s],y:e[s+1]});for(let s=0;s<t.length;s+=2)o.push({x:t[s],y:t[s+1]});const i=[];return o.forEach(function(s){const a=Oe._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||Oe._isElement(e[n]))if(t.configurable)delete e[n];else return null;else if(Oe._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,u=0;typeof r=="number"?s=a=l=u=Math.min(r,t/2,n/2):(s=Math.min(r[0]||0,t/2,n/2),a=Math.min(r[1]||0,t/2,n/2),u=Math.min(r[2]||0,t/2,n/2),l=Math.min(r[3]||0,t/2,n/2)),e.moveTo(o+s,i),e.lineTo(o+t-a,i),e.arc(o+t-a,i+a,a,Math.PI*3/2,0,!1),e.lineTo(o+t,i+n-u),e.arc(o+t-u,i+n-u,u,0,Math.PI/2,!1),e.lineTo(o+l,i+n),e.arc(o+l,i+n-l,l,Math.PI/2,Math.PI,!1),e.lineTo(o,i+s),e.arc(o+s,i+s,s,Math.PI,Math.PI*3/2,!1)},drawRoundedPolygonPath(e,t,n,r,o){r=Math.abs(r);for(let i=0;i<n;i++){const s=t[(i-1+n)%n],a=t[i],l=t[(i+1)%n],u={x:a.x-s.x,y:a.y-s.y},d={x:l.x-a.x,y:l.y-a.y},f=Math.hypot(u.x,u.y),p=Math.hypot(d.x,d.y);let g;typeof o=="number"?g=o:g=i<o.length?o[i]:0,g=r*Math.cos(Math.PI/n)*Math.min(1,g/r*2);const m={x:u.x/f,y:u.y/f},v={x:d.x/p,y:d.y/p},C={x:a.x-m.x*g,y:a.y-m.y*g},w={x:a.x+v.x*g,y:a.y+v.y*g};i===0?e.moveTo(C.x,C.y):e.lineTo(C.x,C.y),e.arcTo(a.x,a.y,w.x,w.y,g)}}};function $F(e){const t=[],n=e.length,r=Oe;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 _A=",",GF="(",WF=")",KF="([",qF="])",YF=";",XF="()",ZF="=",AA=["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"],QF=["fillStyle","strokeStyle","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY","letterSpacing","lineCap","lineDashOffset","lineJoin","lineWidth","miterLimit","direction","font","textAlign","textBaseline","globalAlpha","globalCompositeOperation","imageSmoothingEnabled","filter"],JF=100,wm=null;function IA(){if(wm!==null)return wm;try{const e=Oe.createCanvasElement().getContext("2d");return e?!!e&&"filter"in e:(wm=!1,!1)}catch{return wm=!1,!1}}var Cm=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+=XF:Oe._isArray(l[0])?o+=KF+l.join(_A)+qF:(t&&(l=l.map(u=>typeof u=="number"?Math.floor(u):u)),o+=GF+l.join(_A)+WF)):(o+=s.property,e||(o+=ZF+s.val)),o+=YF;return o}clearTrace(){this.traceArr=[]}_trace(e){let t=this.traceArr,n;t.push(e),n=t.length,n>=JF&&t.shift()}reset(){const e=this.getCanvas().getPixelRatio();this.setTransform(1*e,0,0,1*e,0,0)}getCanvas(){return this.canvas}clear(e){const t=this.getCanvas();e?this.clearRect(e.x||0,e.y||0,e.width||0,e.height||0):this.clearRect(0,0,t.getWidth()/t.pixelRatio,t.getHeight()/t.pixelRatio)}_applyLineCap(e){const t=e.attrs.lineCap;t&&this.setAttr("lineCap",t)}_applyOpacity(e){const t=e.getAbsoluteOpacity();t!==1&&this.setAttr("globalAlpha",t)}_applyLineJoin(e){const t=e.attrs.lineJoin;t&&this.setAttr("lineJoin",t)}_applyMiterLimit(e){const t=e.attrs.miterLimit;t!=null&&this.setAttr("miterLimit",t)}setAttr(e,t){this._context[e]=t}arc(e,t,n,r,o,i){this._context.arc(e,t,n,r,o,i)}arcTo(e,t,n,r,o){this._context.arcTo(e,t,n,r,o)}beginPath(){this._context.beginPath()}bezierCurveTo(e,t,n,r,o,i){this._context.bezierCurveTo(e,t,n,r,o,i)}clearRect(e,t,n,r){this._context.clearRect(e,t,n,r)}clip(...e){this._context.clip.apply(this._context,e)}closePath(){this._context.closePath()}createImageData(e,t){const n=arguments;if(n.length===2)return this._context.createImageData(e,t);if(n.length===1)return this._context.createImageData(e)}createLinearGradient(e,t,n,r){return this._context.createLinearGradient(e,t,n,r)}createPattern(e,t){return this._context.createPattern(e,t)}createRadialGradient(e,t,n,r,o,i){return this._context.createRadialGradient(e,t,n,r,o,i)}drawImage(e,t,n,r,o,i,s,a,l){const u=arguments,d=this._context;u.length===3?d.drawImage(e,t,n):u.length===5?d.drawImage(e,t,n,r,o):u.length===9&&d.drawImage(e,t,n,r,o,i,s,a,l)}ellipse(e,t,n,r,o,i,s,a){this._context.ellipse(e,t,n,r,o,i,s,a)}isPointInPath(e,t,n,r){return n?this._context.isPointInPath(n,e,t,r):this._context.isPointInPath(e,t,r)}fill(...e){this._context.fill.apply(this._context,e)}fillRect(e,t,n,r){this._context.fillRect(e,t,n,r)}strokeRect(e,t,n,r){this._context.strokeRect(e,t,n,r)}fillText(e,t,n,r){r?this._context.fillText(e,t,n,r):this._context.fillText(e,t,n)}measureText(e){return this._context.measureText(e)}getImageData(e,t,n,r){return this._context.getImageData(e,t,n,r)}lineTo(e,t){this._context.lineTo(e,t)}moveTo(e,t){this._context.moveTo(e,t)}rect(e,t,n,r){this._context.rect(e,t,n,r)}roundRect(e,t,n,r,o){this._context.roundRect(e,t,n,r,o)}putImageData(e,t,n){this._context.putImageData(e,t,n)}quadraticCurveTo(e,t,n,r){this._context.quadraticCurveTo(e,t,n,r)}restore(){this._context.restore()}rotate(e){this._context.rotate(e)}save(){this._context.save()}scale(e,t){this._context.scale(e,t)}setLineDash(e){this._context.setLineDash?this._context.setLineDash(e):"mozDash"in this._context?this._context.mozDash=e:"webkitLineDash"in this._context&&(this._context.webkitLineDash=e)}getLineDash(){return this._context.getLineDash()}setTransform(e,t,n,r,o,i){this._context.setTransform(e,t,n,r,o,i)}stroke(e){e?this._context.stroke(e):this._context.stroke()}strokeText(e,t,n,r){this._context.strokeText(e,t,n,r)}transform(e,t,n,r,o,i){this._context.transform(e,t,n,r,o,i)}translate(e,t){this._context.translate(e,t)}_enableTrace(){let e=this,t=AA.length,n=this.setAttr,r,o;const i=function(s){let a=e[s],l;e[s]=function(){return o=$F(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(AA[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)}};QF.forEach(function(e){Object.defineProperty(Cm.prototype,e,{get(){return this._context[e]},set(t){this._context[e]=t}})});var eN=class extends Cm{constructor(e,{willReadFrequently:t=!1}={}){super(e),this._context=e._canvas.getContext("2d",{willReadFrequently:t})}_fillColor(e){const t=e.fill();this.setAttr("fillStyle",t),e._fillFunc(this)}_fillPattern(e){this.setAttr("fillStyle",e._getFillPattern()),e._fillFunc(this)}_fillLinearGradient(e){const t=e._getLinearGradient();t&&(this.setAttr("fillStyle",t),e._fillFunc(this))}_fillRadialGradient(e){const t=e._getRadialGradient();t&&(this.setAttr("fillStyle",t),e._fillFunc(this))}_fill(e){const t=e.fill(),n=e.getFillPriority();if(t&&n==="color"){this._fillColor(e);return}const r=e.getFillPatternImage();if(r&&n==="pattern"){this._fillPattern(e);return}const o=e.getFillLinearGradientColorStops();if(o&&n==="linear-gradient"){this._fillLinearGradient(e);return}const i=e.getFillRadialGradientColorStops();if(i&&n==="radial-gradient"){this._fillRadialGradient(e);return}t?this._fillColor(e):r?this._fillPattern(e):o?this._fillLinearGradient(e):i&&this._fillRadialGradient(e)}_strokeLinearGradient(e){const t=e.getStrokeLinearGradientStartPoint(),n=e.getStrokeLinearGradientEndPoint(),r=e.getStrokeLinearGradientColorStops(),o=this.createLinearGradient(t.x,t.y,n.x,n.y);if(r){for(let i=0;i<r.length;i+=2)o.addColorStop(r[i],r[i+1]);this.setAttr("strokeStyle",o)}}_stroke(e){const t=e.dash(),n=e.getStrokeScaleEnabled();if(e.hasStroke()){if(!n){this.save();const r=this.getCanvas().getPixelRatio();this.setTransform(r,0,0,r,0,0)}this._applyLineCap(e),t&&e.dashEnabled()&&(this.setLineDash(t),this.setAttr("lineDashOffset",e.dashOffset())),this.setAttr("lineWidth",e.strokeWidth()),e.getShadowForStrokeEnabled()||this.setAttr("shadowColor","rgba(0,0,0,0)"),e.getStrokeLinearGradientColorStops()?this._strokeLinearGradient(e):this.setAttr("strokeStyle",e.stroke()),e._strokeFunc(this),n||this.restore()}}_applyShadow(e){var t,n,r;const o=(t=e.getShadowRGBA())!==null&&t!==void 0?t:"black",i=(n=e.getShadowBlur())!==null&&n!==void 0?n:5,s=(r=e.getShadowOffset())!==null&&r!==void 0?r:{x:0,y:0},a=e.getAbsoluteScale(),l=this.canvas.getPixelRatio(),u=a.x*l,d=a.y*l;this.setAttr("shadowColor",o),this.setAttr("shadowBlur",i*Math.min(Math.abs(u),Math.abs(d))),this.setAttr("shadowOffsetX",s.x*u),this.setAttr("shadowOffsetY",s.y*d)}},tN=class extends Cm{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()}}},km;function nN(){if(km)return km;const e=Oe.createCanvasElement(),t=e.getContext("2d");return km=(function(){return(St._global.devicePixelRatio||1)/(t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1)})(),Oe.releaseCanvas(e),km}var pb=class{constructor(e){this.pixelRatio=1,this.width=0,this.height=0,this.isCache=!1;const t=(e||{}).pixelRatio||St.pixelRatio||nN();this.pixelRatio=t,this._canvas=Oe.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 Oe.error("Unable to get data URL. "+r.message+" For more info read https://konvajs.org/docs/posts/Tainted_Canvas.html."),""}}}},El=class extends pb{constructor(e={width:0,height:0,willReadFrequently:!1}){super(e),this.context=new eN(this,{willReadFrequently:e.willReadFrequently}),this.setSize(e.width,e.height)}},mb=class extends pb{constructor(e={width:0,height:0}){super(e),this.hitCanvas=!0,this.context=new tN(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=Oe._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 Oe._isString(e)?'"'+e+'"':Object.prototype.toString.call(e)==="[object Number]"||Oe._isBoolean(e)?e:Object.prototype.toString.call(e)}function EA(e){return e>255?255:e<0?0:Math.round(e)}function bt(){if(St.isUnminified)return function(e,t){return Oe._isNumber(e)||Oe.warn(Tl(e)+' is a not valid value for "'+t+'" attribute. The value should be a number.'),e}}function Sm(e){if(St.isUnminified)return function(t,n){let r=Oe._isNumber(t),o=Oe._isArray(t)&&t.length==e;return!r&&!o&&Oe.warn(Tl(t)+' is a not valid value for "'+n+'" attribute. The value should be a number or Array<number>('+e+")"),t}}function gb(){if(St.isUnminified)return function(e,t){return Oe._isNumber(e)||e==="auto"||Oe.warn(Tl(e)+' is a not valid value for "'+t+'" attribute. The value should be a number or "auto".'),e}}function Sc(){if(St.isUnminified)return function(e,t){return Oe._isString(e)||Oe.warn(Tl(e)+' is a not valid value for "'+t+'" attribute. The value should be a string.'),e}}function TA(){if(St.isUnminified)return function(e,t){const n=Oe._isString(e),r=Object.prototype.toString.call(e)==="[object CanvasGradient]"||e&&e.addColorStop;return n||r||Oe.warn(Tl(e)+' is a not valid value for "'+t+'" attribute. The value should be a string or a native gradient.'),e}}function rN(){if(St.isUnminified)return function(e,t){const n=Int8Array?Object.getPrototypeOf(Int8Array):null;return n&&e instanceof n||(Oe._isArray(e)?e.forEach(function(r){Oe._isNumber(r)||Oe.warn('"'+t+'" attribute has non numeric element '+r+". Make sure that all elements are numbers.")}):Oe.warn(Tl(e)+' is a not valid value for "'+t+'" attribute. The value should be a array of numbers.')),e}}function us(){if(St.isUnminified)return function(e,t){return e===!0||e===!1||Oe.warn(Tl(e)+' is a not valid value for "'+t+'" attribute. The value should be a boolean.'),e}}function oN(e){if(St.isUnminified)return function(t,n){return t==null||Oe.isObject(t)||Oe.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",pe={addGetterSetter(e,t,n,r,o){pe.addGetter(e,t,n),pe.addSetter(e,t,r,o),pe.addOverloadedGetterSetter(e,t)},addGetter(e,t,n){const r=Gf+Oe._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+Oe._capitalize(t);e.prototype[o]||pe.overWriteSetter(e,t,n,r)},overWriteSetter(e,t,n,r){const o=Wf+Oe._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=Oe._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 u=oN(n);e.prototype[l]=function(d){const f=this.attrs[t];r&&(d=r.call(this,d,t)),u&&u.call(this,d,t);for(const p in d)d.hasOwnProperty(p)&&this._setAttr(t+s(p),d[p]);return d||n.forEach(p=>{this._setAttr(t+s(p),void 0)}),this._fireChangeEvent(t,f,d),o&&o.call(this),this},pe.addOverloadedGetterSetter(e,t)},addOverloadedGetterSetter(e,t){const n=Oe._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){Oe.error("Adding deprecated "+t);const o=Gf+Oe._capitalize(t),i=t+" property is deprecated and will be removed soon. Look at Konva change log for more information.";e.prototype[o]=function(){Oe.error(i);const s=this.attrs[t];return s===void 0?n:s},pe.addSetter(e,t,r,function(){Oe.error(i)}),pe.addOverloadedGetterSetter(e,t)},backCompat(e,t){Oe.each(t,function(n,r){const o=e.prototype[r],i=Gf+Oe._capitalize(n),s=Wf+Oe._capitalize(n);function a(){o.apply(this,arguments),Oe.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 iN(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:Oe.warn(`CSS filter "${r}" is not supported in fallback mode. Consider using function filters for better compatibility.`);break}}return()=>{}}var _m="absoluteOpacity",xA="allEventListeners",Ma="absoluteTransform",RA="absoluteScale",_c="canvas",sN="Change",aN="children",lN="konva",vb="listening",cN="mouseenter",uN="mouseleave",dN="pointerenter",fN="pointerleave",hN="touchenter",pN="touchleave",MA="set",LA="Shape",Am=" ",DA="stage",xl="transform",mN="Stage",yb="visible",gN=["xChange.konva","yChange.konva","scaleXChange.konva","scaleYChange.konva","skewXChange.konva","skewYChange.konva","rotationChange.konva","offsetXChange.konva","offsetYChange.konva","transformsEnabledChange.konva"].join(Am),vN=1,At=class Lh{constructor(t){this._id=vN++,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===Ma)&&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===Ma)&&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(Am);this.on(o,()=>{this._clearCache(t)}),this._attachedDepsListeners.set(t,!0)}return this._getCache(t,r)}_getCanvasCache(){return this._cache.get(_c)}_clearSelfAndDescendantCache(t){this._clearCache(t),t===Ma&&this.fire("absoluteTransformChange")}clearCache(){if(this._cache.has(_c)){const{scene:t,filter:n,hit:r}=this._cache.get(_c);Oe.releaseCanvas(t._canvas,n._canvas,r._canvas),this._cache.delete(_c)}return this._clearSelfAndDescendantCache(),this._requestDraw(),this}cache(t){const n=t||{};let r={};(n.x===void 0||n.y===void 0||n.width===void 0||n.height===void 0)&&(r=this.getClientRect({skipTransform:!0,relativeTo:this.getParent()||void 0}));let o=Math.ceil(n.width||r.width),i=Math.ceil(n.height||r.height),s=n.pixelRatio,a=n.x===void 0?Math.floor(r.x):n.x,l=n.y===void 0?Math.floor(r.y):n.y,u=n.offset||0,d=n.drawBorder||!1,f=n.hitCanvasPixelRatio||1;if(!o||!i){Oe.error("Can not cache the node. Width or height of the node equals 0. Caching is skipped.");return}const p=Math.abs(Math.round(r.x)-a)>.5?1:0,g=Math.abs(Math.round(r.y)-l)>.5?1:0;o+=u*2+p,i+=u*2+g,a-=u,l-=u;const m=new El({pixelRatio:s,width:o,height:i}),v=new El({pixelRatio:s,width:0,height:0,willReadFrequently:!0}),C=new mb({pixelRatio:f,width:o,height:i}),w=m.getContext(),S=C.getContext(),k=new El({width:m.width/m.pixelRatio+Math.abs(a),height:m.height/m.pixelRatio+Math.abs(l),pixelRatio:m.pixelRatio}),b=k.getContext();return C.isCache=!0,m.isCache=!0,this._cache.delete(_c),this._filterUpToDate=!1,n.imageSmoothingEnabled===!1&&(m.getContext()._context.imageSmoothingEnabled=!1,v.getContext()._context.imageSmoothingEnabled=!1),w.save(),S.save(),b.save(),w.translate(-a,-l),S.translate(-a,-l),b.translate(-a,-l),k.x=a,k.y=l,this._isUnderCache=!0,this._clearSelfAndDescendantCache(_m),this._clearSelfAndDescendantCache(RA),this.drawScene(m,this,k),this.drawHit(C,this),this._isUnderCache=!1,w.restore(),S.restore(),d&&(w.save(),w.beginPath(),w.rect(0,0,o,i),w.closePath(),w.setAttr("strokeStyle","red"),w.setAttr("lineWidth",5),w.stroke(),w.restore()),Oe.releaseCanvas(k._canvas),this._cache.set(_c,{scene:m,filter:v,hit:C,x:a,y:l}),this._requestDraw(),this}isCached(){return this._cache.has(_c)}getClientRect(t){throw new Error('abstract "getClientRect" method call')}_transformedRect(t,n){const r=[{x:t.x,y:t.y},{x:t.x+t.width,y:t.y},{x:t.x+t.width,y:t.y+t.height},{x:t.x,y:t.y+t.height}];let o=1/0,i=1/0,s=-1/0,a=-1/0;const l=this.getAbsoluteTransform(n);return r.forEach(function(u){const d=l.point(u);o===void 0&&(o=s=d.x,i=a=d.y),o=Math.min(o,d.x),i=Math.min(i,d.y),s=Math.max(s,d.x),a=Math.max(a,d.y)}),{x:o,y:i,width:s-o,height:a-i}}_drawCachedSceneCanvas(t){t.save(),t._applyOpacity(this),t._applyGlobalCompositeOperation(this);const n=this._getCanvasCache();t.translate(n.x,n.y);const r=this._getCachedSceneCanvas(),o=r.pixelRatio;t.drawImage(r._canvas,0,0,r.width/o,r.height/o),t.restore()}_drawCachedHitCanvas(t){const n=this._getCanvasCache(),r=n.hit;t.save(),t.translate(n.x,n.y),t.drawImage(r._canvas,0,0,r.width/r.pixelRatio,r.height/r.pixelRatio),t.restore()}_getCachedSceneCanvas(){let t=this.filters(),n=this._getCanvasCache(),r=n.scene,o=n.filter,i=o.getContext(),s,a,l,u;if(!t||t.length===0)return r;if(this._filterUpToDate)return o;let d=!0;for(let p=0;p<t.length;p++)if(typeof t[p]=="string"&&IA(),typeof t[p]!="string"||!IA()){d=!1;break}const f=r.pixelRatio;if(o.setSize(r.width/r.pixelRatio,r.height/r.pixelRatio),d){const p=t.join(" ");return i.save(),i.setAttr("filter",p),i.drawImage(r._canvas,0,0,r.getWidth()/f,r.getHeight()/f),i.restore(),this._filterUpToDate=!0,o}try{for(s=t.length,i.clear(),i.drawImage(r._canvas,0,0,r.getWidth()/f,r.getHeight()/f),a=i.getImageData(0,0,o.getWidth(),o.getHeight()),l=0;l<s;l++)u=t[l],typeof u=="string"&&(u=iN(u)),u.call(this,a),i.putImageData(a,0,0)}catch(p){Oe.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(xA),t.length===3)return this._delegate.apply(this,t);const o=n.split(Am);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(Am),o=r.length,i,s,a,l,u,d;if(this._cache&&this._cache.delete(xA),!t)for(s in this.eventListeners)this._off(s);for(i=0;i<o;i++)if(a=r[i],l=a.split("."),u=l[0],d=l[1],u)this.eventListeners[u]&&this._off(u,d,n);else for(s in this.eventListeners)this._off(s,d,n);return this}dispatchEvent(t){const n={target:this,type:t.type,evt:t};return this.fire(t.type,n),this}addEventListener(t,n){return this.on(t,function(r){n.call(this,r.evt)}),this}removeEventListener(t){return this.off(t),this}_delegate(t,n,r){const o=this;return this.on(t,function(i){const s=i.target.findAncestors(n,!0,o);for(let a=0;a<s.length;a++)i=Oe.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(Ma),this._clearSelfAndDescendantCache(_m),this._clearSelfAndDescendantCache(RA),this._clearSelfAndDescendantCache(DA),this._clearSelfAndDescendantCache(yb),this._clearSelfAndDescendantCache(vb)}_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"+Oe._capitalize(t);return Oe._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!==aN&&(r=MA+Oe._capitalize(n),Oe._isFunction(this[r])?this[r](t[n]):this._setAttr(n,t[n]))}),this}isListening(){return this._getCache(vb,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(yb,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!==LA&&(o=o.concat(a.getChildren().slice())),a._id===n._id&&(s=i);o.length>0&&o[0].getDepth()<=t&&l(o)}const u=this.getStage();return n.nodeType!==mN&&u&&l(u.getChildren()),r}getDepth(){let t=0,n=this.parent;for(;n;)t++,n=n.parent;return t}_batchTransformChanges(t){this._batchingTransformChange=!0,t(),this._batchingTransformChange=!1,this._needClearTransformCache&&(this._clearCache(xl),this._clearSelfAndDescendantCache(Ma)),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 cs,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(Ma),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 Oe.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 Oe.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 Oe.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 Oe.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 Oe.warn("Node has no parent. zIndex parameter is ignored."),this;(t<0||t>=this.parent.children.length)&&Oe.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(_m,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=Oe.isObject(r)&&!Oe._isPlainObject(r)&&!Oe._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 Oe._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],Oe.isValidSelector(i)||(Oe.warn('Selector "'+i+'" is invalid. Allowed selectors examples are "#foo", ".bar" or "Group".'),Oe.warn('If you have a custom shape with such className, please change it to start with upper letter like "Triangle".'),Oe.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(DA,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(Ma,this._getAbsoluteTransform)}_getAbsoluteTransform(t){let n;if(t)return n=new cs,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(Ma)||new cs,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 cs;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,u=this.attrs.skewX||0,d=this.attrs.skewY||0,f=this.attrs.offsetX||0,p=this.attrs.offsetY||0;return(o!==0||i!==0)&&r.translate(o,i),s!==0&&r.rotate(s),(u!==0||d!==0)&&r.skew(u,d),(a!==1||l!==1)&&r.scale(a,l),(f!==0||p!==0)&&r.translate(-1*f,-1*p),r.dirty=!1,r}clone(t){let n=Oe.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(lN)<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(),u=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,u),l.restore(),a}toCanvas(t){return this._toKonvaCanvas(t)._canvas}toDataURL(t){t=t||{};const n=t.mimeType||null,r=t.quality||null,o=this._toKonvaCanvas(t).toDataURL(n,r);return t.callback&&t.callback(o),o}toImage(t){return new Promise((n,r)=>{try{const o=t?.callback;o&&delete t.callback,Oe._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+sN,{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[MA+Oe._capitalize(t)];return Oe._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&&!Oe.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===LA&&(n.target=this);const o=[cN,uN,dN,fN,hN,pN];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=Lh.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,Lh.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:Oe.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 Oe.haveIntersection(r,this.getClientRect())}static create(t,n){return Oe._isString(t)&&(t=JSON.parse(t)),this._createNode(t,n)}static _createNode(t,n){let r=Lh.prototype.getClassName.call(t),o=t.children,i,s,a;n&&(t.attrs.container=n),St[r]||(Oe.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(Lh._createNode(o[a]));return i}};At.protoListenerMap=new Map,At.prototype.nodeType="Node",At.prototype._attrsAffectingSize=[],At.prototype.eventListeners={},At.prototype.on(gN,function(){if(this._batchingTransformChange){this._needClearTransformCache=!0;return}this._clearCache(xl),this._clearSelfAndDescendantCache(Ma)}),At.prototype.on("visibleChange.konva",function(){this._clearSelfAndDescendantCache(yb)}),At.prototype.on("listeningChange.konva",function(){this._clearSelfAndDescendantCache(vb)}),At.prototype.on("opacityChange.konva",function(){this._clearSelfAndDescendantCache(_m)});var tr=pe.addGetterSetter;tr(At,"zIndex"),tr(At,"absolutePosition"),tr(At,"position"),tr(At,"x",0,bt()),tr(At,"y",0,bt()),tr(At,"globalCompositeOperation","source-over",Sc()),tr(At,"opacity",1,bt()),tr(At,"name","",Sc()),tr(At,"id","",Sc()),tr(At,"rotation",0,bt()),pe.addComponentsGetterSetter(At,"scale",["x","y"]),tr(At,"scaleX",1,bt()),tr(At,"scaleY",1,bt()),pe.addComponentsGetterSetter(At,"skew",["x","y"]),tr(At,"skewX",0,bt()),tr(At,"skewY",0,bt()),pe.addComponentsGetterSetter(At,"offset",["x","y"]),tr(At,"offsetX",0,bt()),tr(At,"offsetY",0,bt()),tr(At,"dragDistance",void 0,bt()),tr(At,"width",0,bt()),tr(At,"height",0,bt()),tr(At,"listening",!0,us()),tr(At,"preventDefault",!0,us()),tr(At,"filters",void 0,function(e){return this._filterUpToDate=!1,e}),tr(At,"visible",!0,us()),tr(At,"transformsEnabled","all",Sc()),tr(At,"size"),tr(At,"dragBoundFunc"),tr(At,"draggable",!1,us()),pe.backCompat(At,{rotateDeg:"rotate",setRotationDeg:"setRotation",getRotationDeg:"getRotation"});var Ii=class extends At{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=At.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=At.prototype.clone.call(this,e);return this.getChildren().forEach(function(n){t.add(n.clone())}),t}getAllIntersections(e){const t=[];return this.find("Shape").forEach(n=>{n.isVisible()&&n.intersects(e)&&t.push(n)}),t}_clearSelfAndDescendantCache(e){var t;super._clearSelfAndDescendantCache(e),!this.isCached()&&((t=this.children)===null||t===void 0||t.forEach(function(n){n._clearSelfAndDescendantCache(e)}))}_setChildrenIndices(){var e;(e=this.children)===null||e===void 0||e.forEach(function(t,n){t.index=n}),this._requestDraw()}drawScene(e,t,n){const r=this.getLayer(),o=e||r&&r.getCanvas(),i=o&&o.getContext(),s=this._getCanvasCache(),a=s&&s.scene,l=o&&o.isCache;if(!this.isVisible()&&!l)return this;if(a){i.save();const u=this.getAbsoluteTransform(t).getMatrix();i.transform(u[0],u[1],u[2],u[3],u[4],u[5]),this._drawCachedSceneCanvas(i),i.restore()}else this._drawChildren("drawScene",o,t,n);return this}drawHit(e,t){if(!this.shouldDrawHit(t))return this;const n=this.getLayer(),r=e||n&&n.hitCanvas,o=r&&r.getContext(),i=this._getCanvasCache();if(i&&i.hit){o.save();const s=this.getAbsoluteTransform(t).getMatrix();o.transform(s[0],s[1],s[2],s[3],s[4],s[5]),this._drawCachedHitCanvas(o),o.restore()}else this._drawChildren("drawHit",r,t);return this}_drawChildren(e,t,n,r){var o;const i=t&&t.getContext(),s=this.clipWidth(),a=this.clipHeight(),l=this.clipFunc(),u=typeof s=="number"&&typeof a=="number"||l,d=n===this;if(u){i.save();const p=this.getAbsoluteTransform(n);let g=p.getMatrix();i.transform(g[0],g[1],g[2],g[3],g[4],g[5]),i.beginPath();let m;if(l)m=l.call(this,i,this);else{const v=this.clipX(),C=this.clipY();i.rect(v||0,C||0,s,a)}i.clip.apply(i,m),g=p.copy().invert().getMatrix(),i.transform(g[0],g[1],g[2],g[3],g[4],g[5])}const f=!d&&this.globalCompositeOperation()!=="source-over"&&e==="drawScene";f&&(i.save(),i._applyGlobalCompositeOperation(this)),(o=this.children)===null||o===void 0||o.forEach(function(p){p[e](t,n,r)}),f&&i.restore(),u&&i.restore()}getClientRect(e={}){var t;const n=e.skipTransform,r=e.relativeTo;let o,i,s,a,l={x:1/0,y:1/0,width:0,height:0};const u=this;(t=this.children)===null||t===void 0||t.forEach(function(p){if(!p.visible())return;const g=p.getClientRect({relativeTo:u,skipShadow:e.skipShadow,skipStroke:e.skipStroke});g.width===0&&g.height===0||(o===void 0?(o=g.x,i=g.y,s=g.x+g.width,a=g.y+g.height):(o=Math.min(o,g.x),i=Math.min(i,g.y),s=Math.max(s,g.x+g.width),a=Math.max(a,g.y+g.height)))});const d=this.find("Shape");let f=!1;for(let p=0;p<d.length;p++)if(d[p]._isVisible(this)){f=!0;break}return f&&o!==void 0?l={x:o,y:i,width:s-o,height:a-i}:l={x:0,y:0,width:0,height:0},n?l:this._transformedRect(l,r)}};pe.addComponentsGetterSetter(Ii,"clip",["x","y","width","height"]),pe.addGetterSetter(Ii,"clipX",void 0,bt()),pe.addGetterSetter(Ii,"clipY",void 0,bt()),pe.addGetterSetter(Ii,"clipWidth",void 0,bt()),pe.addGetterSetter(Ii,"clipHeight",void 0,bt()),pe.addGetterSetter(Ii,"clipFunc");var Kf=new Map,OA=St._global.PointerEvent!==void 0;function bb(e){return Kf.get(e)}function wb(e){return{evt:e,pointerId:e.pointerId}}function PA(e,t){return Kf.get(e)===t}function FA(e,t){qf(e),t.getStage()&&(Kf.set(e,t),OA&&t._fire("gotpointercapture",wb(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),OA&&n._fire("lostpointercapture",wb(new PointerEvent("lostpointercapture")))}var yN="Stage",bN="string",NA="px",wN="mouseout",BA="mouseleave",zA="mouseover",jA="mouseenter",VA="mousemove",UA="mousedown",HA="mouseup",Yf="pointermove",Xf="pointerdown",zu="pointerup",Zf="pointercancel",CN="lostpointercapture",Im="pointerout",Qf="pointerleave",Em="pointerover",Tm="pointerenter",Cb="contextmenu",$A="touchstart",GA="touchend",WA="touchmove",KA="touchcancel",kb="wheel",kN=5,SN=[[jA,"_pointerenter"],[UA,"_pointerdown"],[VA,"_pointermove"],[HA,"_pointerup"],[BA,"_pointerleave"],[$A,"_pointerdown"],[WA,"_pointermove"],[GA,"_pointerup"],[KA,"_pointercancel"],[zA,"_pointerover"],[kb,"_wheel"],[Cb,"_contextmenu"],[Xf,"_pointerdown"],[Yf,"_pointermove"],[zu,"_pointerup"],[Zf,"_pointercancel"],[Qf,"_pointerleave"],[CN,"_lostpointercapture"]],Sb={mouse:{[Im]:wN,[Qf]:BA,[Em]:zA,[Tm]:jA,[Yf]:VA,[Xf]:UA,[zu]:HA,[Zf]:"mousecancel",pointerclick:"click",pointerdblclick:"dblclick"},touch:{[Im]:"touchout",[Qf]:"touchleave",[Em]:"touchover",[Tm]:"touchenter",[Yf]:WA,[Xf]:$A,[zu]:GA,[Zf]:KA,pointerclick:"tap",pointerdblclick:"dbltap"},pointer:{[Im]:Im,[Qf]:Qf,[Em]:Em,[Tm]:Tm,[Yf]:Yf,[Xf]:Xf,[zu]:zu,[Zf]:Zf,pointerclick:"pointerclick",pointerdblclick:"pointerdblclick"}},Jf=e=>e.indexOf("pointer")>=0?"pointer":e.indexOf("touch")>=0?"touch":"mouse",ju=e=>{const t=Jf(e);if(t==="pointer")return St.pointerEventsEnabled&&Sb.pointer;if(t==="touch")return Sb.touch;if(t==="mouse")return Sb.mouse};function qA(e={}){return(e.clipFunc||e.clipWidth||e.clipHeight)&&Oe.warn("Stage does not support clipping. Please use clip for Layers or Groups."),e}var _N="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=[],xm=class extends Ii{constructor(e){super(qA(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",()=>{qA(this.attrs)}),this._checkVisibility()}_validateAdd(e){const t=e.getType()==="Layer",n=e.getType()==="FastLayer";t||n||Oe.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===bN){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&&Oe._isInDocument(e)&&this.container().removeChild(e);const t=eh.indexOf(this);return t>-1&&eh.splice(t,1),Oe.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}:(Oe.warn(_N),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+NA,this.content.style.height=t+NA),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>kN&&Oe.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 PA(e,this)}setPointerCapture(e){FA(e,this)}releaseCapture(e){qf(e,this)}getLayers(){return this.children}_bindContentEvents(){St.isBrowser&&SN.forEach(([e,t])=>{this.content.addEventListener(e,n=>{this[t](n)},{passive:!1})})}_pointerenter(e){this.setPointersPositions(e);const t=ju(e.type);t&&this._fire(t.pointerenter,{evt:e,target:this,currentTarget:this})}_pointerover(e){this.setPointersPositions(e);const t=ju(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=ju(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=ju(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=ju(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=bb(a.id)||this.getIntersection(a),u=a.id,d={evt:e,pointerId:u},f=s!==l;if(f&&s&&(s._fireAndBubble(t.pointerout,{...d},l),s._fireAndBubble(t.pointerleave,{...d},l)),l){if(o[l._id])return;o[l._id]=!0}l&&l.isListening()?(i=!0,f&&(l._fireAndBubble(t.pointerover,{...d},s),l._fireAndBubble(t.pointerenter,{...d},s),this[n+"targetShape"]=l),l._fireAndBubble(t.pointermove,{...d})):s&&(this._fire(t.pointerover,{evt:e,target:this,currentTarget:this,pointerId:u}),this[n+"targetShape"]=null)}),i||this._fire(t.pointermove,{evt:e,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id})}_pointerup(e){const t=ju(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=bb(a.id)||this.getIntersection(a);if(l){if(l.releaseCapture(a.id),i[l._id])return;i[l._id]=!0}const u=a.id,d={evt:e,pointerId:u};let f=!1;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:u}),f&&this._fire(t.pointerdblclick,{evt:e,target:this,currentTarget:this,pointerId:u}))}),s||this._fire(t.pointerup,{evt:e,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),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(Cb,{evt:e}):this._fire(Cb,{evt:e,target:this,currentTarget:this})}_wheel(e){this.setPointersPositions(e);const t=this.getIntersection(this.getPointerPosition());t&&t.isListening()?t._fireAndBubble(kb,{evt:e}):this._fire(kb,{evt:e,target:this,currentTarget:this})}_pointercancel(e){this.setPointersPositions(e);const t=bb(e.pointerId)||this.getIntersection(this.getPointerPosition());t&&t._fireAndBubble(zu,wb(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:Oe._getFirstPointerId(e)}],this._changedPointerPositions=[{x:n,y:r,id:Oe._getFirstPointerId(e)}])}_setPointerPosition(e){Oe.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 mb({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 Oe.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}};xm.prototype.nodeType=yN,Ar(xm),pe.addGetterSetter(xm,"container"),St.isBrowser&&document.addEventListener("visibilitychange",()=>{eh.forEach(e=>{e.batchDraw()})});var YA="hasShadow",XA="shadowRGBA",ZA="patternImage",QA="linearGradient",JA="radialGradient",Rm;function _b(){return Rm||(Rm=Oe.createCanvasElement().getContext("2d"),Rm)}var th={};function AN(e){const t=this.attrs.fillRule;t?e.fill(t):e.fill()}function IN(e){e.stroke()}function EN(e){const t=this.attrs.fillRule;t?e.fill(t):e.fill()}function TN(e){e.stroke()}function xN(){this._clearCache(YA)}function RN(){this._clearCache(XA)}function MN(){this._clearCache(ZA)}function LN(){this._clearCache(QA)}function DN(){this._clearCache(JA)}var mt=class extends At{constructor(e){super(e);let t,n=0;for(;t=Oe.getHitColor(),!(t&&!(t in th));)if(n++,n>=1e4){Oe.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=Oe.getRandomColor();break}this.colorKey=t,th[t]=this}getContext(){return Oe.warn("shape.getContext() method is deprecated. Please do not use it."),this.getLayer().getContext()}getCanvas(){return Oe.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(YA,this._hasShadow)}_hasShadow(){return this.shadowEnabled()&&this.shadowOpacity()!==0&&!!(this.shadowColor()||this.shadowBlur()||this.shadowOffsetX()||this.shadowOffsetY())}_getFillPattern(){return this._getCache(ZA,this.__getFillPattern)}__getFillPattern(){if(this.fillPatternImage()){const e=_b().createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(e&&e.setTransform){const t=new cs;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(QA,this.__getLinearGradient)}__getLinearGradient(){const e=this.fillLinearGradientColorStops();if(e){const t=_b(),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(JA,this.__getRadialGradient)}__getRadialGradient(){const e=this.fillRadialGradientColorStops();if(e){const t=_b(),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(XA,this._getShadowRGBA)}_getShadowRGBA(){if(!this.hasShadow())return;const e=Oe.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 At.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){Oe.warn("strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead."),e?this.hitStrokeWidth("auto"):this.hitStrokeWidth(0)}getStrokeHitEnabled(){return this.hitStrokeWidth()!==0}getSelfRect(){const e=this.size();return{x:this._centroid?-e.width/2:0,y:this._centroid?-e.height/2:0,width:e.width,height:e.height}}getClientRect(e={}){let t=!1,n=this.getParent();for(;n;){if(n.isCached()){t=!0;break}n=n.getParent()}const r=e.skipTransform,o=e.relativeTo||t&&this.getStage()||void 0,i=this.getSelfRect(),s=!e.skipStroke&&this.hasStroke()&&this.strokeWidth()||0,a=i.width+s,l=i.height+s,u=!e.skipShadow&&this.hasShadow(),d=u?this.shadowOffsetX():0,f=u?this.shadowOffsetY():0,p=a+Math.abs(d),g=l+Math.abs(f),m=u&&this.shadowBlur()||0,v={width:p+m*2,height:g+m*2,x:-(s/2+m)+Math.min(d,0)+i.x,y:-(s/2+m)+Math.min(f,0)+i.y};return r?v:this._transformedRect(v,o)}drawScene(e,t,n){const r=this.getLayer(),o=(e||r.getCanvas()).getContext(),i=this._getCanvasCache(),s=this.getSceneFunc(),a=this.hasShadow();let l;const u=t===this;if(!this.isVisible()&&!u)return this;if(i){o.save();const d=this.getAbsoluteTransform(t).getMatrix();return o.transform(d[0],d[1],d[2],d[3],d[4],d[5]),this._drawCachedSceneCanvas(o),o.restore(),this}if(!s)return this;if(o.save(),this._useBufferCanvas()){l=this.getStage();const d=n||l.bufferCanvas,f=d.getContext();n?(f.save(),f.setTransform(1,0,0,1,0,0),f.clearRect(0,0,d.width,d.height),f.restore()):f.clear(),f.save(),f._applyLineJoin(this),f._applyMiterLimit(this);const p=this.getAbsoluteTransform(t).getMatrix();f.transform(p[0],p[1],p[2],p[3],p[4],p[5]),s.call(this,f,this),f.restore();const g=d.pixelRatio;a&&o._applyShadow(this),u||(o._applyOpacity(this),o._applyGlobalCompositeOperation(this)),o.drawImage(d._canvas,d.x||0,d.y||0,d.width/g,d.height/g)}else{if(o._applyLineJoin(this),o._applyMiterLimit(this),!u){const d=this.getAbsoluteTransform(t).getMatrix();o.transform(d[0],d[1],d[2],d[3],d[4],d[5]),o._applyOpacity(this),o._applyGlobalCompositeOperation(this)}a&&o._applyShadow(this),s.call(this,o,this)}return o.restore(),this}drawHit(e,t,n=!1){if(!this.shouldDrawHit(t,n))return this;const r=this.getLayer(),o=e||r.hitCanvas,i=o&&o.getContext(),s=this.hitFunc()||this.sceneFunc(),a=this._getCanvasCache(),l=a&&a.hit;if(this.colorKey||Oe.warn("Looks like your canvas has a destroyed shape in it. Do not reuse shape after you destroyed it. If you want to reuse shape you should call remove() instead of destroy()"),l){i.save();const u=this.getAbsoluteTransform(t).getMatrix();return i.transform(u[0],u[1],u[2],u[3],u[4],u[5]),this._drawCachedHitCanvas(i),i.restore(),this}if(!s)return this;if(i.save(),i._applyLineJoin(this),i._applyMiterLimit(this),this!==t){const u=this.getAbsoluteTransform(t).getMatrix();i.transform(u[0],u[1],u[2],u[3],u[4],u[5])}return s.call(this,i,this),i.restore(),this}drawHitFromCache(e=0){const t=this._getCanvasCache(),n=this._getCachedSceneCanvas(),r=t.hit,o=r.getContext(),i=r.getWidth(),s=r.getHeight();o.clear(),o.drawImage(n._canvas,0,0,i,s);try{const a=o.getImageData(0,0,i,s),l=a.data,u=l.length,d=Oe._hexToRgb(this.colorKey);for(let f=0;f<u;f+=4)l[f+3]>e?(l[f]=d.r,l[f+1]=d.g,l[f+2]=d.b,l[f+3]=255):l[f+3]=0;o.putImageData(a,0,0)}catch(a){Oe.error("Unable to draw hit graph from cached scene canvas. "+a.message)}return this}hasPointerCapture(e){return PA(e,this)}setPointerCapture(e){FA(e,this)}releaseCapture(e){qf(e,this)}};mt.prototype._fillFunc=AN,mt.prototype._strokeFunc=IN,mt.prototype._fillFuncHit=EN,mt.prototype._strokeFuncHit=TN,mt.prototype._centroid=!1,mt.prototype.nodeType="Shape",Ar(mt),mt.prototype.eventListeners={},mt.prototype.on("shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",xN),mt.prototype.on("shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",RN),mt.prototype.on("fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",MN),mt.prototype.on("fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",LN),mt.prototype.on("fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",DN),pe.addGetterSetter(mt,"stroke",void 0,TA()),pe.addGetterSetter(mt,"strokeWidth",2,bt()),pe.addGetterSetter(mt,"fillAfterStrokeEnabled",!1),pe.addGetterSetter(mt,"hitStrokeWidth","auto",gb()),pe.addGetterSetter(mt,"strokeHitEnabled",!0,us()),pe.addGetterSetter(mt,"perfectDrawEnabled",!0,us()),pe.addGetterSetter(mt,"shadowForStrokeEnabled",!0,us()),pe.addGetterSetter(mt,"lineJoin"),pe.addGetterSetter(mt,"lineCap"),pe.addGetterSetter(mt,"miterLimit"),pe.addGetterSetter(mt,"sceneFunc"),pe.addGetterSetter(mt,"hitFunc"),pe.addGetterSetter(mt,"dash"),pe.addGetterSetter(mt,"dashOffset",0,bt()),pe.addGetterSetter(mt,"shadowColor",void 0,Sc()),pe.addGetterSetter(mt,"shadowBlur",0,bt()),pe.addGetterSetter(mt,"shadowOpacity",1,bt()),pe.addComponentsGetterSetter(mt,"shadowOffset",["x","y"]),pe.addGetterSetter(mt,"shadowOffsetX",0,bt()),pe.addGetterSetter(mt,"shadowOffsetY",0,bt()),pe.addGetterSetter(mt,"fillPatternImage"),pe.addGetterSetter(mt,"fill",void 0,TA()),pe.addGetterSetter(mt,"fillPatternX",0,bt()),pe.addGetterSetter(mt,"fillPatternY",0,bt()),pe.addGetterSetter(mt,"fillLinearGradientColorStops"),pe.addGetterSetter(mt,"strokeLinearGradientColorStops"),pe.addGetterSetter(mt,"fillRadialGradientStartRadius",0),pe.addGetterSetter(mt,"fillRadialGradientEndRadius",0),pe.addGetterSetter(mt,"fillRadialGradientColorStops"),pe.addGetterSetter(mt,"fillPatternRepeat","repeat"),pe.addGetterSetter(mt,"fillEnabled",!0),pe.addGetterSetter(mt,"strokeEnabled",!0),pe.addGetterSetter(mt,"shadowEnabled",!0),pe.addGetterSetter(mt,"dashEnabled",!0),pe.addGetterSetter(mt,"strokeScaleEnabled",!0),pe.addGetterSetter(mt,"fillPriority","color"),pe.addComponentsGetterSetter(mt,"fillPatternOffset",["x","y"]),pe.addGetterSetter(mt,"fillPatternOffsetX",0,bt()),pe.addGetterSetter(mt,"fillPatternOffsetY",0,bt()),pe.addComponentsGetterSetter(mt,"fillPatternScale",["x","y"]),pe.addGetterSetter(mt,"fillPatternScaleX",1,bt()),pe.addGetterSetter(mt,"fillPatternScaleY",1,bt()),pe.addComponentsGetterSetter(mt,"fillLinearGradientStartPoint",["x","y"]),pe.addComponentsGetterSetter(mt,"strokeLinearGradientStartPoint",["x","y"]),pe.addGetterSetter(mt,"fillLinearGradientStartPointX",0),pe.addGetterSetter(mt,"strokeLinearGradientStartPointX",0),pe.addGetterSetter(mt,"fillLinearGradientStartPointY",0),pe.addGetterSetter(mt,"strokeLinearGradientStartPointY",0),pe.addComponentsGetterSetter(mt,"fillLinearGradientEndPoint",["x","y"]),pe.addComponentsGetterSetter(mt,"strokeLinearGradientEndPoint",["x","y"]),pe.addGetterSetter(mt,"fillLinearGradientEndPointX",0),pe.addGetterSetter(mt,"strokeLinearGradientEndPointX",0),pe.addGetterSetter(mt,"fillLinearGradientEndPointY",0),pe.addGetterSetter(mt,"strokeLinearGradientEndPointY",0),pe.addComponentsGetterSetter(mt,"fillRadialGradientStartPoint",["x","y"]),pe.addGetterSetter(mt,"fillRadialGradientStartPointX",0),pe.addGetterSetter(mt,"fillRadialGradientStartPointY",0),pe.addComponentsGetterSetter(mt,"fillRadialGradientEndPoint",["x","y"]),pe.addGetterSetter(mt,"fillRadialGradientEndPointX",0),pe.addGetterSetter(mt,"fillRadialGradientEndPointY",0),pe.addGetterSetter(mt,"fillPatternRotation",0),pe.addGetterSetter(mt,"fillRule",void 0,Sc()),pe.backCompat(mt,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"});var ON="beforeDraw",PN="draw",e4=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],FN=e4.length,Ac=class extends Ii{constructor(e){super(e),this.canvas=new El,this.hitCanvas=new mb({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(){At.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(!At.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(At.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(At.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 At.prototype.remove.call(this),e&&e.parentNode&&Oe._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"&&Oe.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(),At.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(){Oe.warn('Can not change width of layer. Use "stage.width(value)" function instead.')}getHeight(){if(this.parent)return this.parent.height()}setHeight(){Oe.warn('Can not change height of layer. Use "stage.height(value)" function instead.')}batchDraw(){return this._waitingForDraw||(this._waitingForDraw=!0,Oe.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<FN;r++){const o=e4[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[Oe.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(ON,{node:this}),this.clearBeforeDraw()&&o.getContext().clear(),Ii.prototype.drawScene.call(this,o,t,n),this._fire(PN,{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){Oe.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening(e)}getHitGraphEnabled(e){return Oe.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 Oe.releaseCanvas(this.getNativeCanvasElement(),this.getHitCanvas()._canvas),super.destroy()}};Ac.prototype.nodeType="Layer",Ar(Ac),pe.addGetterSetter(Ac,"imageSmoothingEnabled",!0),pe.addGetterSetter(Ac,"clearBeforeDraw",!0),pe.addGetterSetter(Ac,"hitGraphEnabled",!0,us());var Ab=class extends Ac{constructor(e){super(e),this.listening(!1),Oe.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.')}};Ab.prototype.nodeType="FastLayer",Ar(Ab);var Vu=class extends Ii{_validateAdd(e){const t=e.getType();t!=="Group"&&t!=="Shape"&&Oe.throw("You may only add groups and shapes to groups.")}};Vu.prototype.nodeType="Group",Ar(Vu);var Ib=(function(){return kc.performance&&kc.performance.now?function(){return kc.performance.now()}:function(){return new Date().getTime()}})(),Uu=class Ld{constructor(t,n){this.id=Ld.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:Ib(),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=Ld.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=Ib(),Ld._addAnimation(this),this}stop(){return Ld._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(Ib());const a=i.length;let l;if(s?l=s.call(o,o.frame)!==!1:l=!0,!!l)for(let u=0;u<a;u++){const d=i[u];d._id!==void 0&&(t[d._id]=d)}}for(const r in t)t.hasOwnProperty(r)&&t[r].batchDraw()}static _animationLoop(){const t=Ld;t.animations.length?(t._runFrames(),Oe.requestAnimFrame(t._animationLoop)):t.animRunning=!1}static _handleAnimation(){this.animRunning||(this.animRunning=!0,Oe.requestAnimFrame(this._animationLoop))}};Uu.animations=[],Uu.animIdCounter=0,Uu.animRunning=!1;var NN={node:1,duration:1,easing:1,onFinish:1,yoyo:1},BN=1,t4=2,n4=3,r4=["fill","stroke","shadowColor"],zN=0,jN=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=t4,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")}reverse(){this.state=n4,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===t4?this.setTime(e):this.state===n4&&this.setTime(this.duration-e)}pause(){this.state=BN,this.fire("onPause")}getTimer(){return new Date().getTime()}},Mm=class zr{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=zN++;const u=r.getLayer()||(r instanceof St.Stage?r.getLayers():null);u||Oe.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."),this.anim=new Uu(function(){n.tween.onEnterFrame()},u),this.tween=new jN(l,function(d){n._tweenFunc(d)},i,0,1,a*1e3,s),this._addListeners(),zr.attrs[o]||(zr.attrs[o]={}),zr.attrs[o][this._id]||(zr.attrs[o][this._id]={}),zr.tweens[o]||(zr.tweens[o]={});for(l in t)NN[l]===void 0&&this._addAttr(l,t[l]);this.reset(),this.onFinish=t.onFinish,this.onReset=t.onReset,this.onUpdate=t.onUpdate}_addAttr(t,n){const r=this.node,o=r._id;let i,s,a,l,u;const d=zr.tweens[o][t];d&&delete zr.attrs[o][d][t];let f=r.getAttr(t);if(Oe._isArray(n))if(i=[],s=Math.max(n.length,f.length),t==="points"&&n.length!==f.length&&(n.length>f.length?(l=f,f=Oe._prepareArrayForTween(f,n,r.closed())):(a=n,n=Oe._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=Oe.colorToRGBA(f[p]);u=Oe.colorToRGBA(n[p]),f[p]=g,i.push({r:u.r-g.r,g:u.g-g.g,b:u.b-g.b,a:u.a-g.a})}else for(let p=0;p<s;p++)i.push(n[p]-f[p]);else r4.indexOf(t)!==-1?(f=Oe.colorToRGBA(f),u=Oe.colorToRGBA(n),i={r:u.r-f.r,g:u.g-f.g,b:u.b-f.b,a:u.a-f.a}):i=n-f;zr.attrs[o][this._id][t]={start:f,diff:i,end:n,trueEnd:a,trueStart:l},zr.tweens[o][t]=this._id}_tweenFunc(t){const n=this.node,r=zr.attrs[n._id][this._id];let o,i,s,a,l,u,d,f;for(o in r){if(i=r[o],s=i.start,a=i.diff,f=i.end,Oe._isArray(s))if(l=[],d=Math.max(s.length,f.length),o.indexOf("fill")===0)for(u=0;u<d;u++)u%2===0?l.push((s[u]||0)+a[u]*t):l.push("rgba("+Math.round(s[u].r+a[u].r*t)+","+Math.round(s[u].g+a[u].g*t)+","+Math.round(s[u].b+a[u].b*t)+","+(s[u].a+a[u].a*t)+")");else for(u=0;u<d;u++)l.push((s[u]||0)+a[u]*t);else r4.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=zr.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=zr.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=zr.tweens[t];this.pause(),this.anim&&this.anim.stop();for(const o in r)delete zr.tweens[t][o];delete zr.attrs[t][n],zr.tweens[t]&&(Object.keys(zr.tweens[t]).length===0&&delete zr.tweens[t],Object.keys(zr.attrs[t]).length===0&&delete zr.attrs[t])}};Mm.attrs={},Mm.tweens={},At.prototype.to=function(e){const t=e.onFinish;e.node=this,e.onFinish=function(){this.destroy(),t&&t()},new Mm(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}},o4=Oe._assign(St,{Util:Oe,Transform:cs,Node:At,Container:Ii,Stage:xm,stages:eh,Layer:Ac,FastLayer:Ab,Group:Vu,DD:Vn,Shape:mt,shapes:th,Animation:Uu,Tween:Mm,Easings:nh,Context:Cm,Canvas:pb}),La=class extends mt{_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),u=i*t,d=s*(s>0?e:t),f=a*(a>0?t:e);return{x:l,y:n?-1*f:d,width:u-l,height:f-d}}};La.prototype._centroid=!0,La.prototype.className="Arc",La.prototype._attrsAffectingSize=["innerRadius","outerRadius","angle","clockwise"],Ar(La),pe.addGetterSetter(La,"innerRadius",0,bt()),pe.addGetterSetter(La,"outerRadius",0,bt()),pe.addGetterSetter(La,"angle",0,bt()),pe.addGetterSetter(La,"clockwise",!1,us());function Eb(e,t,n,r,o,i,s){const a=Math.sqrt(Math.pow(n-e,2)+Math.pow(r-t,2)),l=Math.sqrt(Math.pow(o-n,2)+Math.pow(i-r,2)),u=s*a/(a+l),d=s*l/(a+l);return[n-u*(o-e),r-u*(i-t),n+d*(o-e),r+d*(i-t)]}function i4(e,t){const n=e.length,r=[];for(let o=2;o<n-2;o+=2){const i=Eb(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 VN(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 Da=class extends mt{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():i4(this.points(),this.tension())}_getTensionPointsClosed(){const e=this.points(),t=e.length,n=this.tension(),r=Eb(e[t-2],e[t-1],e[0],e[1],e[2],e[3],n),o=Eb(e[t-4],e[t-3],e[t-2],e[t-1],e[0],e[1],n),i=i4(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],...VN(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}}};Da.prototype.className="Line",Da.prototype._attrsAffectingSize=["points","bezier","tension"],Ar(Da),pe.addGetterSetter(Da,"closed",!1),pe.addGetterSetter(Da,"bezier",!1),pe.addGetterSetter(Da,"tension",0,bt()),pe.addGetterSetter(Da,"points",[],rN());var UN=[[],[],[-.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]],HN=[[],[],[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]],$N=[[1],[1,1],[1,2,1],[1,3,3,1]],s4=(e,t,n)=>{let r,o;const s=n/2;r=0;for(let a=0;a<20;a++)o=s*UN[20][a]+s,r+=HN[20][a]*GN(e,t,o);return s*r},a4=(e,t,n)=>{n===void 0&&(n=1);const r=e[0]-2*e[1]+e[2],o=t[0]-2*t[1]+t[2],i=2*e[1]-2*e[0],s=2*t[1]-2*t[0],a=4*(r*r+o*o),l=4*(r*i+o*s),u=i*i+s*s;if(a===0)return n*Math.sqrt(Math.pow(e[2]-e[0],2)+Math.pow(t[2]-t[0],2));const d=l/(2*a),f=u/a,p=n+d,g=f-d*d,m=p*p+g>0?Math.sqrt(p*p+g):0,v=d*d+g>0?Math.sqrt(d*d+g):0,C=d+Math.sqrt(d*d+g)!==0?g*Math.log(Math.abs((p+m)/(d+v))):0;return Math.sqrt(a)/2*(p*m-d*v+C)};function GN(e,t,n){const r=Tb(1,n,e),o=Tb(1,n,t),i=r*r+o*o;return Math.sqrt(i)}var Tb=(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+=$N[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 Tb(e-1,t,o)}},l4=(e,t,n)=>{let r=1,o=e/t,i=(e-n(o))/t,s=0;for(;r>.001;){const a=n(o+i),l=Math.abs(e-a)/t;if(l<r)r=l,o+=i;else{const u=n(o-i),d=Math.abs(e-u)/t;d<r?(r=d,o-=i):i/=2}if(s++,s>500)break}return o},$i=class wi extends mt{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],u=s[2],d=s[3],f=s[4],p=s[5],g=s[6],m=s[7],v=u>d?u:d,C=u>d?1:u/d,w=u>d?d/u:1;t.translate(a,l),t.rotate(g),t.scale(C,w),t.arc(0,0,v,f,f+p,1-m),t.scale(1/C,1/w),t.rotate(-g),t.translate(-a,-l);break;case"z":r=!0,t.closePath();break}}!r&&!this.hasFill()?t.strokeShape(this):t.fillStrokeShape(this)}getSelfRect(){let t=[];this.dataArray.forEach(function(l){if(l.command==="A"){const u=l.points[4],d=l.points[5],f=l.points[4]+d;let p=Math.PI/180;if(Math.abs(u-f)<p&&(p=Math.abs(u-f)),d<0)for(let g=u-p;g>f;g-=p){const m=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=u+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 u=0;u<=1;u+=.01){const d=wi.getPointOnCubicBezier(u,l.start.x,l.start.y,l.points[0],l.points[1],l.points[2],l.points[3],l.points[4],l.points[5]);t.push(d.x,d.y)}else t=t.concat(l.points)});let n=t[0],r=t[0],o=t[1],i=t[1],s,a;for(let l=0;l<t.length/2;l++)s=t[l*2],a=t[l*2+1],isNaN(s)||(n=Math.min(n,s),r=Math.max(r,s)),isNaN(a)||(o=Math.min(o,a),i=Math.max(i,a));return{x:n,y:o,width:r-n,height:i-o}}getLength(){return this.pathLength}getPointAtLength(t){return 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(l4(t,wi.getPathLength(n),v=>s4([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(l4(t,wi.getPathLength(n),v=>a4([s.start.x,a[0],a[2]],[s.start.y,a[1],a[3]],v)),s.start.x,s.start.y,a[0],a[1],a[2],a[3]);case"A":const l=a[0],u=a[1],d=a[2],f=a[3],p=a[5],g=a[6];let m=a[4];return m+=p*t/s.pathLength,wi.getPointOnEllipticalArc(l,u,d,f,m,g)}return null}static getPointOnLine(t,n,r,o,i,s,a){s=s??n,a=a??r;const l=this.getLineLength(n,r,o,i);if(l<1e-10)return{x:n,y:r};if(o===n)return{x:s,y:a+(i>r?t:-t)};const u=(i-r)/(o-n),d=Math.sqrt(t*t/(1+u*u))*(o<n?-1:1),f=u*d;if(Math.abs(a-r-u*(s-n))<1e-10)return{x:s+d,y:a+f};const p=((s-n)*(o-n)+(a-r)*(i-r))/(l*l),g=n+p*(o-n),m=r+p*(i-r),v=this.getLineLength(s,a,g,m),C=Math.sqrt(t*t-v*v),w=Math.sqrt(C*C/(1+u*u))*(o<n?-1:1),S=u*w;return{x:g+w,y:m+S}}static getPointOnCubicBezier(t,n,r,o,i,s,a,l,u){function d(m){return m*m*m}function f(m){return 3*m*m*(1-m)}function p(m){return 3*m*(1-m)*(1-m)}function g(m){return(1-m)*(1-m)*(1-m)}return{x:l*d(t)+s*f(t)+o*p(t)+n*g(t),y:u*d(t)+a*f(t)+i*p(t)+r*g(t)}}static getPointOnQuadraticBezier(t,n,r,o,i,s,a){function l(f){return f*f}function u(f){return 2*f*(1-f)}function d(f){return(1-f)*(1-f)}return{x:s*l(t)+o*u(t)+n*d(t),y:a*l(t)+i*u(t)+r*d(t)}}static getPointOnEllipticalArc(t,n,r,o,i,s){const a=Math.cos(s),l=Math.sin(s),u={x:r*Math.cos(i),y:o*Math.sin(i)};return{x:t+(u.x*a-u.y*l),y:n+(u.x*l+u.y*a)}}static parsePathData(t){if(!t)return[];let n=t;const r=["m","M","l","L","v","V","h","H","z","Z","c","C","q","Q","t","T","s","S","a","A"];n=n.replace(new RegExp(" ","g"),",");for(let f=0;f<r.length;f++)n=n.replace(new RegExp(r[f],"g"),"|"+r[f]);const o=n.split("|"),i=[],s=[];let a=0,l=0;const u=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:e[-+]?\d+)?)/gi;let d;for(let f=1;f<o.length;f++){let p=o[f],g=p.charAt(0);for(p=p.slice(1),s.length=0;d=u.exec(p);)s.push(d[0]);let m=[],v=g==="A"||g==="a"?0:-1;for(let C=0,w=s.length;C<w;C++){const S=s[C];if(S==="00"){m.push(0,0),v>=0&&(v+=2,v>=7&&(v-=7));continue}if(v>=0){if(v===3){if(/^[01]{2}\d+(?:\.\d+)?$/.test(S)){m.push(parseInt(S[0],10)),m.push(parseInt(S[1],10)),m.push(parseFloat(S.slice(2))),v+=3,v>=7&&(v-=7);continue}if(S==="11"||S==="10"||S==="01"){m.push(parseInt(S[0],10)),m.push(parseInt(S[1],10)),v+=2,v>=7&&(v-=7);continue}if(S==="0"||S==="1"){m.push(parseInt(S,10)),v+=1,v>=7&&(v-=7);continue}}else if(v===4){if(/^[01]\d+(?:\.\d+)?$/.test(S)){m.push(parseInt(S[0],10)),m.push(parseFloat(S.slice(1))),v+=2,v>=7&&(v-=7);continue}if(S==="0"||S==="1"){m.push(parseInt(S,10)),v+=1,v>=7&&(v-=7);continue}}const k=parseFloat(S);isNaN(k)?m.push(0):m.push(k),v+=1,v>=7&&(v-=7)}else{const k=parseFloat(S);isNaN(k)?m.push(0):m.push(k)}}for(;m.length>0&&!isNaN(m[0]);){let C="",w=[];const S=a,k=l;let b,T,L,z,G,U,j,Z,R,K;switch(g){case"l":a+=m.shift(),l+=m.shift(),C="L",w.push(a,l);break;case"L":a=m.shift(),l=m.shift(),w.push(a,l);break;case"m":const x=m.shift(),W=m.shift();if(a+=x,l+=W,C="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}}w.push(a,l),g="l";break;case"M":a=m.shift(),l=m.shift(),C="M",w.push(a,l),g="L";break;case"h":a+=m.shift(),C="L",w.push(a,l);break;case"H":a=m.shift(),C="L",w.push(a,l);break;case"v":l+=m.shift(),C="L",w.push(a,l);break;case"V":l=m.shift(),C="L",w.push(a,l);break;case"C":w.push(m.shift(),m.shift(),m.shift(),m.shift()),a=m.shift(),l=m.shift(),w.push(a,l);break;case"c":w.push(a+m.shift(),l+m.shift(),a+m.shift(),l+m.shift()),a+=m.shift(),l+=m.shift(),C="C",w.push(a,l);break;case"S":T=a,L=l,b=i[i.length-1],b.command==="C"&&(T=a+(a-b.points[2]),L=l+(l-b.points[3])),w.push(T,L,m.shift(),m.shift()),a=m.shift(),l=m.shift(),C="C",w.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])),w.push(T,L,a+m.shift(),l+m.shift()),a+=m.shift(),l+=m.shift(),C="C",w.push(a,l);break;case"Q":w.push(m.shift(),m.shift()),a=m.shift(),l=m.shift(),w.push(a,l);break;case"q":w.push(a+m.shift(),l+m.shift()),a+=m.shift(),l+=m.shift(),C="Q",w.push(a,l);break;case"T":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(),C="Q",w.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(),C="Q",w.push(T,L,a,l);break;case"A":z=m.shift(),G=m.shift(),U=m.shift(),j=m.shift(),Z=m.shift(),R=a,K=l,a=m.shift(),l=m.shift(),C="A",w=this.convertEndpointToCenterParameterization(R,K,a,l,j,Z,z,G,U);break;case"a":z=m.shift(),G=m.shift(),U=m.shift(),j=m.shift(),Z=m.shift(),R=a,K=l,a+=m.shift(),l+=m.shift(),C="A",w=this.convertEndpointToCenterParameterization(R,K,a,l,j,Z,z,G,U);break}i.push({command:C||g,points:w,start:{x:S,y:k},pathLength:this.calcLength(S,k,C||g,w)})}(g==="z"||g==="Z")&&i.push({command:"z",points:[],start:void 0,pathLength:0})}return i}static calcLength(t,n,r,o){let i,s,a,l;const u=wi;switch(r){case"L":return u.getLineLength(t,n,o[0],o[1]);case"C":return s4([t,o[0],o[2],o[4]],[n,o[1],o[3],o[5]],1);case"Q":return a4([t,o[0],o[2]],[n,o[1],o[3]],1);case"A":i=0;const d=o[4],f=o[5],p=o[4]+f;let g=Math.PI/180;if(Math.abs(d-p)<g&&(g=Math.abs(d-p)),s=u.getPointOnEllipticalArc(o[0],o[1],o[2],o[3],d,0),f<0)for(l=d-g;l>p;l-=g)a=u.getPointOnEllipticalArc(o[0],o[1],o[2],o[3],l,0),i+=u.getLineLength(s.x,s.y,a.x,a.y),s=a;else for(l=d+g;l<p;l+=g)a=u.getPointOnEllipticalArc(o[0],o[1],o[2],o[3],l,0),i+=u.getLineLength(s.x,s.y,a.x,a.y),s=a;return a=u.getPointOnEllipticalArc(o[0],o[1],o[2],o[3],p,0),i+=u.getLineLength(s.x,s.y,a.x,a.y),i}return 0}static convertEndpointToCenterParameterization(t,n,r,o,i,s,a,l,u){const d=u*(Math.PI/180),f=Math.cos(d)*(t-r)/2+Math.sin(d)*(n-o)/2,p=-1*Math.sin(d)*(t-r)/2+Math.cos(d)*(n-o)/2,g=f*f/(a*a)+p*p/(l*l);g>1&&(a*=Math.sqrt(g),l*=Math.sqrt(g));let m=Math.sqrt((a*a*(l*l)-a*a*(p*p)-l*l*(f*f))/(a*a*(p*p)+l*l*(f*f)));i===s&&(m*=-1),isNaN(m)&&(m=0);const v=m*a*p/l,C=m*-l*f/a,w=(t+r)/2+Math.cos(d)*v-Math.sin(d)*C,S=(n+o)/2+Math.sin(d)*v+Math.cos(d)*C,k=function(j){return Math.sqrt(j[0]*j[0]+j[1]*j[1])},b=function(j,Z){return(j[0]*Z[0]+j[1]*Z[1])/(k(j)*k(Z))},T=function(j,Z){return(j[0]*Z[1]<j[1]*Z[0]?-1:1)*Math.acos(b(j,Z))},L=T([1,0],[(f-v)/a,(p-C)/l]),z=[(f-v)/a,(p-C)/l],G=[(-1*f-v)/a,(-1*p-C)/l];let U=T(z,G);return b(z,G)<=-1&&(U=Math.PI),b(z,G)>=1&&(U=0),s===0&&U>0&&(U=U-2*Math.PI),s===1&&U<0&&(U=U+2*Math.PI),[w,S,a,l,L,U,d,s]}};$i.prototype.className="Path",$i.prototype._attrsAffectingSize=["data"],Ar($i),pe.addGetterSetter($i,"data");var Ic=class extends Da{_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=$i.calcLength(r[r.length-4],r[r.length-3],"C",f),g=$i.getPointOnQuadraticBezier(Math.min(1,1-i/p),f[0],f[1],f[2],f[3],f[4],f[5]);a=n[s-2]-g.x,l=n[s-1]-g.y}else a=n[s-2]-n[s-4],l=n[s-1]-n[s-3];const u=(Math.atan2(l,a)+t)%t,d=this.pointerWidth();this.pointerAtEnding()&&(e.save(),e.beginPath(),e.translate(n[s-2],n[s-1]),e.rotate(u),e.moveTo(0,0),e.lineTo(-i,d/2),e.lineTo(-i,-d/2),e.closePath(),e.restore(),this.__fillStroke(e)),this.pointerAtBeginning()&&(e.save(),e.beginPath(),e.translate(n[0],n[1]),o?(a=(r[0]+r[2])/2-n[0],l=(r[1]+r[3])/2-n[1]):(a=n[2]-n[0],l=n[3]-n[1]),e.rotate((Math.atan2(-l,-a)+t)%t),e.moveTo(0,0),e.lineTo(-i,d/2),e.lineTo(-i,-d/2),e.closePath(),e.restore(),this.__fillStroke(e))}__fillStroke(e){const t=this.dashEnabled();t&&(this.attrs.dashEnabled=!1,e.setLineDash([])),e.fillStrokeShape(this),t&&(this.attrs.dashEnabled=!0)}getSelfRect(){const e=super.getSelfRect(),t=this.pointerWidth()/2;return{x:e.x,y:e.y-t,width:e.width,height:e.height+t*2}}};Ic.prototype.className="Arrow",Ar(Ic),pe.addGetterSetter(Ic,"pointerLength",10,bt()),pe.addGetterSetter(Ic,"pointerWidth",10,bt()),pe.addGetterSetter(Ic,"pointerAtBeginning",!1),pe.addGetterSetter(Ic,"pointerAtEnding",!0);var Hu=class extends mt{_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)}};Hu.prototype._centroid=!0,Hu.prototype.className="Circle",Hu.prototype._attrsAffectingSize=["radius"],Ar(Hu),pe.addGetterSetter(Hu,"radius",0,bt());var Rl=class extends mt{_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"],Ar(Rl),pe.addComponentsGetterSetter(Rl,"radius",["x","y"]),pe.addGetterSetter(Rl,"radiusX",0,bt()),pe.addGetterSetter(Rl,"radiusY",0,bt());var ds=class IE extends mt{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?Oe.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?Oe.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=Oe.createImageElement();o.onload=function(){n(new IE({image:o}))},o.onerror=r,o.crossOrigin="Anonymous",o.src=t}};ds.prototype.className="Image",ds.prototype._attrsAffectingSize=["image"],Ar(ds),pe.addGetterSetter(ds,"cornerRadius",0,Sm(4)),pe.addGetterSetter(ds,"image"),pe.addComponentsGetterSetter(ds,"crop",["x","y","width","height"]),pe.addGetterSetter(ds,"cropX",0,bt()),pe.addGetterSetter(ds,"cropY",0,bt()),pe.addGetterSetter(ds,"cropWidth",0,bt()),pe.addGetterSetter(ds,"cropHeight",0,bt());var c4=["fontFamily","fontSize","fontStyle","padding","lineHeight","text","width","height","pointerDirection","pointerWidth","pointerHeight"],WN="Change.konva",KN="none",xb="up",Rb="right",Mb="down",Lb="left",qN=c4.length,Db=class extends Vu{constructor(e){super(e),this.on("add.konva",function(t){this._addListeners(t.child),this._sync()})}getText(){return this.find("Text")[0]}getTag(){return this.find("Tag")[0]}_addListeners(e){let t=this,n;const r=function(){t._sync()};for(n=0;n<qN;n++)e.on(c4[n]+WN,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 xb:s=n/2,a=-1*l;break;case Rb:s=n+i,a=r/2;break;case Mb:s=n/2,a=r+l;break;case Lb: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})}}};Db.prototype.className="Label",Ar(Db);var Ec=class extends mt{_sceneFunc(e){const t=this.width(),n=this.height(),r=this.pointerDirection(),o=this.pointerWidth(),i=this.pointerHeight(),s=this.cornerRadius();let a=0,l=0,u=0,d=0;typeof s=="number"?a=l=u=d=Math.min(s,t/2,n/2):(a=Math.min(s[0]||0,t/2,n/2),l=Math.min(s[1]||0,t/2,n/2),d=Math.min(s[2]||0,t/2,n/2),u=Math.min(s[3]||0,t/2,n/2)),e.beginPath(),e.moveTo(a,0),r===xb&&(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===Rb&&(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===Mb&&(e.lineTo((t+o)/2,n),e.lineTo(t/2,n+i),e.lineTo((t-o)/2,n)),e.lineTo(u,n),e.arc(u,n-u,u,Math.PI/2,Math.PI,!1),r===Lb&&(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===xb?(t-=r,s+=r):o===Mb?s+=r:o===Lb?(e-=n*1.5,i+=n):o===Rb&&(i+=n*1.5),{x:e,y:t,width:i,height:s}}};Ec.prototype.className="Tag",Ar(Ec),pe.addGetterSetter(Ec,"pointerDirection",KN),pe.addGetterSetter(Ec,"pointerWidth",0,bt()),pe.addGetterSetter(Ec,"pointerHeight",0,bt()),pe.addGetterSetter(Ec,"cornerRadius",0,Sm(4));var rh=class extends mt{_sceneFunc(e){const t=this.cornerRadius(),n=this.width(),r=this.height();e.beginPath(),t?Oe.drawRoundedRectPath(e,n,r,t):e.rect(0,0,n,r),e.closePath(),e.fillStrokeShape(this)}};rh.prototype.className="Rect",Ar(rh),pe.addGetterSetter(rh,"cornerRadius",0,Sm(4));var Ml=class extends mt{_sceneFunc(e){const t=this._getPoints(),n=this.radius(),r=this.sides(),o=this.cornerRadius();if(e.beginPath(),o)Oe.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)}};Ml.prototype.className="RegularPolygon",Ml.prototype._centroid=!0,Ml.prototype._attrsAffectingSize=["radius"],Ar(Ml),pe.addGetterSetter(Ml,"radius",0,bt()),pe.addGetterSetter(Ml,"sides",0,bt()),pe.addGetterSetter(Ml,"cornerRadius",0,Sm(4));var u4=Math.PI*2,Tc=class extends mt{_sceneFunc(e){e.beginPath(),e.arc(0,0,this.innerRadius(),0,u4,!1),e.moveTo(this.outerRadius(),0),e.arc(0,0,this.outerRadius(),u4,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)}};Tc.prototype.className="Ring",Tc.prototype._centroid=!0,Tc.prototype._attrsAffectingSize=["innerRadius","outerRadius"],Ar(Tc),pe.addGetterSetter(Tc,"innerRadius",0,bt()),pe.addGetterSetter(Tc,"outerRadius",0,bt());var js=class extends mt{constructor(e){super(e),this._updated=!0,this.anim=new Uu(()=>{const t=this._updated;return this._updated=!1,t}),this.on("animationChange.konva",function(){this.frameIndex(0)}),this.on("frameIndexChange.konva",function(){this._updated=!0}),this.on("frameRateChange.konva",function(){this.anim.isRunning()&&(clearInterval(this.interval),this._setInterval())})}_sceneFunc(e){const t=this.animation(),n=this.frameIndex(),r=n*4,o=this.animations()[t],i=this.frameOffsets(),s=o[r+0],a=o[r+1],l=o[r+2],u=o[r+3],d=this.image();if((this.hasFill()||this.hasStroke())&&(e.beginPath(),e.rect(0,0,l,u),e.closePath(),e.fillStrokeShape(this)),d)if(i){const f=i[t],p=n*2;e.drawImage(d,s,a,l,u,f[p+0],f[p+1],l,u)}else e.drawImage(d,s,a,l,u,0,0,l,u)}_hitFunc(e){const t=this.animation(),n=this.frameIndex(),r=n*4,o=this.animations()[t],i=this.frameOffsets(),s=o[r+2],a=o[r+3];if(e.beginPath(),i){const l=i[t],u=n*2;e.rect(l[u+0],l[u+1],s,a)}else e.rect(0,0,s,a);e.closePath(),e.fillShape(this)}_useBufferCanvas(){return super._useBufferCanvas(!0)}_setInterval(){const e=this;this.interval=setInterval(function(){e._updateIndex()},1e3/this.frameRate())}start(){if(this.isRunning())return;const e=this.getLayer();this.anim.setLayers(e),this._setInterval(),this.anim.start()}stop(){this.anim.stop(),clearInterval(this.interval)}isRunning(){return this.anim.isRunning()}_updateIndex(){const e=this.frameIndex(),t=this.animation();e<this.animations()[t].length/4-1?this.frameIndex(e+1):this.frameIndex(0)}};js.prototype.className="Sprite",Ar(js),pe.addGetterSetter(js,"animation"),pe.addGetterSetter(js,"animations"),pe.addGetterSetter(js,"frameOffsets"),pe.addGetterSetter(js,"image"),pe.addGetterSetter(js,"frameIndex",0,bt()),pe.addGetterSetter(js,"frameRate",17,bt()),pe.backCompat(js,{index:"frameIndex",getIndex:"getFrameIndex",setIndex:"setFrameIndex"});var Ll=class extends mt{_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)}};Ll.prototype.className="Star",Ll.prototype._centroid=!0,Ll.prototype._attrsAffectingSize=["innerRadius","outerRadius"],Ar(Ll),pe.addGetterSetter(Ll,"numPoints",5,bt()),pe.addGetterSetter(Ll,"innerRadius",0,bt()),pe.addGetterSetter(Ll,"outerRadius",0,bt());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 $u="auto",YN="center",d4="inherit",oh="justify",XN="Change.konva",f4="2d",h4="-",p4="left",ZN="text",QN="Text",JN="top",eB="bottom",m4="middle",g4="normal",tB="px ",Lm=" ",nB="right",v4="rtl",rB="word",oB="char",y4="none",Ob="β¦",b4=["direction","fontFamily","fontSize","fontStyle","fontVariant","padding","align","verticalAlign","lineHeight","text","width","height","wrap","ellipsis","letterSpacing"],iB=b4.length,ih=null;function sB(){if(ih!==null)return ih;ih=!1;try{const e=document.createElement("canvas");e.width=10,e.height=10;const t=e.getContext(f4);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 aB(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 Dm;function Pb(){return Dm||(Dm=Oe.createCanvasElement().getContext(f4),Dm)}function lB(e){e.fillText(this._partialText,this._partialTextX,this._partialTextY)}function cB(e){e.setAttr("miterLimit",2),e.strokeText(this._partialText,this._partialTextX,this._partialTextY)}function uB(e){return e=e||{},!e.fillLinearGradientColorStops&&!e.fillRadialGradientColorStops&&!e.fillPatternImage&&(e.fill=e.fill||"black"),e}var cr=class extends mt{constructor(e){super(uB(e)),this._partialTextX=0,this._partialTextY=0;for(let t=0;t<iB;t++)this.on(b4[t]+XN,this._setTextData);this._setTextData()}_sceneFunc(e){var t,n;const r=this.textArr,o=r.length;if(!this.text())return;let i=this.padding(),s=this.fontSize(),a=this.lineHeight()*s,l=this.verticalAlign(),u=this.direction(),d=0,f=this.align(),p=this.getWidth(),g=this.letterSpacing(),m=this.charRenderFunc(),v=this.fill(),C=this.textDecoration(),w=this.underlineOffset(),S=C.indexOf("underline")!==-1,k=C.indexOf("line-through")!==-1,b;u=u===d4?e.direction:u;let T=a/2,L=m4;if(!St.legacyTextRendering){const z=this.measureSize("M");L="alphabetic",T=(((t=z.fontBoundingBoxAscent)!==null&&t!==void 0?t:z.actualBoundingBoxAscent)-((n=z.fontBoundingBoxDescent)!==null&&n!==void 0?n:z.actualBoundingBoxDescent))/2+a/2}for(u===v4&&e.setAttr("direction",u),e.setAttr("font",this._getContextFont()),e.setAttr("textBaseline",L),e.setAttr("textAlign",p4),l===m4?d=(this.getHeight()-o*a-i*2)/2:l===eB&&(d=this.getHeight()-o*a-i*2),e.translate(i,d+i),b=0;b<o;b++){let z=0,G=0;const U=r[b],j=U.text,Z=U.width,R=U.lastInParagraph;if(e.save(),f===nB?z+=p-Z-i*2:f===YN&&(z+=(p-Z-i*2)/2),S){e.save(),e.beginPath();const x=w??(St.legacyTextRendering?Math.round(s/2):Math.round(s/4)),W=z,$=T+G+x;e.moveTo(W,$);const J=f===oh&&!R?p-i*2:Z;e.lineTo(W+Math.round(J),$),e.lineWidth=s/15,e.strokeStyle=this._getLinearGradient()||v,e.stroke(),e.restore()}const K=z;if(u!==v4&&(g!==0||f===oh||m)){const x=j.split(" ").length-1,W=Dl(j);for(let $=0;$<W.length;$++){const J=W[$];if(J===" "&&!R&&f===oh&&(z+=(p-i*2-Z)/x),this._partialTextX=z,this._partialTextY=T+G,this._partialText=J,m){e.save();const Q=r.slice(0,b).reduce((Y,Ce)=>Y+Dl(Ce.text).length,0);m({char:J,index:$+Q,x:z,y:T+G,lineIndex:b,column:$,isLastInLine:R,width:this.measureSize(J).width,context:e})}e.fillStrokeShape(this),m&&e.restore(),z+=this.measureSize(J).width+g}}else g!==0&&e.setAttr("letterSpacing",`${g}px`),this._partialTextX=z,this._partialTextY=T+G,this._partialText=j,e.fillStrokeShape(this);if(k){e.save(),e.beginPath();const x=St.legacyTextRendering?0:-Math.round(s/4),W=K;e.moveTo(W,T+G+x);const $=f===oh&&!R?p-i*2:Z;e.lineTo(W+Math.round($),T+G+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=Oe._isString(e)?e:e==null?"":e+"";return this._setAttr(ZN,t),this}getWidth(){return this.attrs.width===$u||this.attrs.width===void 0?this.getTextWidth()+this.padding()*2:this.attrs.width}getHeight(){return this.attrs.height===$u||this.attrs.height===void 0?this.fontSize()*this.textArr.length*this.lineHeight()+this.padding()*2:this.attrs.height}getTextWidth(){return this.textWidth}getTextHeight(){return Oe.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}measureSize(e){var t,n,r,o,i,s,a,l,u,d,f;let p=Pb(),g=this.fontSize(),m;p.save(),p.font=this._getContextFont(),m=p.measureText(e),p.restore();const v=g/100;return{actualBoundingBoxAscent:(t=m.actualBoundingBoxAscent)!==null&&t!==void 0?t:71.58203125*v,actualBoundingBoxDescent:(n=m.actualBoundingBoxDescent)!==null&&n!==void 0?n:0,actualBoundingBoxLeft:(r=m.actualBoundingBoxLeft)!==null&&r!==void 0?r:-7.421875*v,actualBoundingBoxRight:(o=m.actualBoundingBoxRight)!==null&&o!==void 0?o:75.732421875*v,alphabeticBaseline:(i=m.alphabeticBaseline)!==null&&i!==void 0?i:0,emHeightAscent:(s=m.emHeightAscent)!==null&&s!==void 0?s:100*v,emHeightDescent:(a=m.emHeightDescent)!==null&&a!==void 0?a:-20*v,fontBoundingBoxAscent:(l=m.fontBoundingBoxAscent)!==null&&l!==void 0?l:91*v,fontBoundingBoxDescent:(u=m.fontBoundingBoxDescent)!==null&&u!==void 0?u:21*v,hangingBaseline:(d=m.hangingBaseline)!==null&&d!==void 0?d:72.80000305175781*v,ideographicBaseline:(f=m.ideographicBaseline)!==null&&f!==void 0?f:-21*v,width:m.width,height:g}}_getContextFont(){return this.fontStyle()+Lm+this.fontVariant()+Lm+(this.fontSize()+tB)+aB(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 Pb().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!==$u&&o!==void 0,a=i!==$u&&i!==void 0,l=this.padding(),u=o-l*2,d=i-l*2,f=0,p=this.wrap(),g=p!==oB&&p!==y4,m=this.ellipsis();this.textArr=[],Pb().font=this._getContextFont();const v=m?this._getTextWidth(Ob):0;for(let C=0,w=e.length;C<w;++C){let S=e[C],k=this._getTextWidth(S);if(s&&k>u)for(;S.length>0;){let b=0,T=Dl(S).length,L="",z=0;for(;b<T;){const G=b+T>>>1,U=Dl(S).slice(0,G+1).join(""),j=this._getTextWidth(U);(m&&a&&f+r>d?j+v:j)<=u?(b=G+1,L=U,z=j):T=G}if(L){if(g){const G=Dl(S),U=Dl(L),j=G[U.length],Z=j===Lm||j===h4;let R;if(Z&&z<=u)R=U.length;else{const K=U.lastIndexOf(Lm),x=U.lastIndexOf(h4);R=Math.max(K,x)+1}R>0&&(b=R,L=G.slice(0,b).join(""),z=this._getTextWidth(L))}if(L=L.trimRight(),this._addTextLine(L),n=Math.max(n,z),f+=r,this._shouldHandleEllipsis(f)){this._tryToAddEllipsisToLastLine();break}if(S=Dl(S).slice(b).join("").trimLeft(),S.length>0&&(k=this._getTextWidth(S),k<=u)){this._addTextLine(S),f+=r,n=Math.max(n,k);break}}else break}else this._addTextLine(S),f+=r,n=Math.max(n,k),this._shouldHandleEllipsis(f)&&C<w-1&&this._tryToAddEllipsisToLastLine();if(this.textArr[this.textArr.length-1]&&(this.textArr[this.textArr.length-1].lastInParagraph=!0),a&&f+r>d)break}this.textHeight=t,this.textWidth=n}_shouldHandleEllipsis(e){const t=+this.fontSize(),n=this.lineHeight()*t,r=this.attrs.height,o=r!==$u&&r!==void 0,i=r-this.padding()*2;return this.wrap()===y4||o&&e+n>i}_tryToAddEllipsisToLastLine(){const e=this.attrs.width,t=e!==$u&&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+Ob)<n||(o.text=o.text.slice(0,o.text.length-3))),this.textArr.splice(this.textArr.length-1,1),this._addTextLine(o.text+Ob))}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&&sB()?!0:super._useBufferCanvas()}};cr.prototype._fillFunc=lB,cr.prototype._strokeFunc=cB,cr.prototype.className=QN,cr.prototype._attrsAffectingSize=["text","fontSize","padding","wrap","lineHeight","letterSpacing"],Ar(cr),pe.overWriteSetter(cr,"width",gb()),pe.overWriteSetter(cr,"height",gb()),pe.addGetterSetter(cr,"direction",d4),pe.addGetterSetter(cr,"fontFamily","Arial"),pe.addGetterSetter(cr,"fontSize",12,bt()),pe.addGetterSetter(cr,"fontStyle",g4),pe.addGetterSetter(cr,"fontVariant",g4),pe.addGetterSetter(cr,"padding",0,bt()),pe.addGetterSetter(cr,"align",p4),pe.addGetterSetter(cr,"verticalAlign",JN),pe.addGetterSetter(cr,"lineHeight",1,bt()),pe.addGetterSetter(cr,"wrap",rB),pe.addGetterSetter(cr,"ellipsis",!1,us()),pe.addGetterSetter(cr,"letterSpacing",0,bt()),pe.addGetterSetter(cr,"text","",Sc()),pe.addGetterSetter(cr,"textDecoration",""),pe.addGetterSetter(cr,"underlineOffset",void 0,bt()),pe.addGetterSetter(cr,"charRenderFunc",void 0);var dB="",w4="normal";function C4(e){e.fillText(this.partialText,0,0)}function k4(e){e.strokeText(this.partialText,0,0)}var so=class extends mt{constructor(e){super(e),this.dummyCanvas=Oe.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 $i.getPathLength(this.dataArray)}_getPointAtLength(e){return!this.attrs.data||e>this.pathLength?null:$i.getPointAtLengthOfDataArray(e,this.dataArray)}_readDataAttribute(){this.dataArray=$i.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 Oe.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),u=Math.max(this.textWidth+((this.attrs.text||"").length-1)*i,0);let d=0;s==="center"&&(d=Math.max(0,this.pathLength/2-u/2)),s==="right"&&(d=Math.max(0,this.pathLength-u));let f=d;for(let p=0;p<t.length;p++){const g=this._getPointAtLength(f);if(!g)return;const m=t[p].char;let v=t[p].width+i;if(m===" "&&s==="justify"){const L=this.text().split(" ").length-1;v+=(this.pathLength-u)/L}const C=f+v,w=this._getPointAtLength(C>this.pathLength&&C-this.pathLength<=l?this.pathLength:C);if(!w)return;const S=$i.getLineLength(g.x,g.y,w.x,w.y);let k=0;if(a)try{k=a(t[p-1].char,m)*this.fontSize()}catch{k=0}g.x+=k,w.x+=k,this.textWidth+=k;const b=$i.getPointOnLine(k+S/2,g.x,g.y,w.x,w.y),T=Math.atan2(w.y-g.y,w.x-g.x);this.glyphInfo.push({transposeX:b.x,transposeY:b.y,text:e[p],rotation:T,p0:g,p1:w,width:S}),f+=v}}getSelfRect(){if(!this.glyphInfo.length)return{x:0,y:0,width:0,height:0};const e=[];this.glyphInfo.forEach(function(l){e.push(l.p0.x),e.push(l.p0.y),e.push(l.p1.x),e.push(l.p1.y)});let t=e[0]||0,n=e[0]||0,r=e[1]||0,o=e[1]||0,i,s;for(let l=0;l<e.length/2;l++)i=e[l*2],s=e[l*2+1],t=Math.min(t,i),n=Math.max(n,i),r=Math.min(r,s),o=Math.max(o,s);const a=this.fontSize();return{x:t-a/2,y:r-a/2,width:n-t+a,height:o-r+a}}destroy(){return Oe.releaseCanvas(this.dummyCanvas),super.destroy()}};so.prototype._fillFunc=C4,so.prototype._strokeFunc=k4,so.prototype._fillFuncHit=C4,so.prototype._strokeFuncHit=k4,so.prototype.className="TextPath",so.prototype._attrsAffectingSize=["text","fontSize","data"],Ar(so),pe.addGetterSetter(so,"data"),pe.addGetterSetter(so,"fontFamily","Arial"),pe.addGetterSetter(so,"fontSize",12,bt()),pe.addGetterSetter(so,"fontStyle",w4),pe.addGetterSetter(so,"align","left"),pe.addGetterSetter(so,"letterSpacing",0,bt()),pe.addGetterSetter(so,"textBaseline","middle"),pe.addGetterSetter(so,"fontVariant",w4),pe.addGetterSetter(so,"text",dB),pe.addGetterSetter(so,"textDecoration",""),pe.addGetterSetter(so,"kerningFunc",void 0);var S4="tr-konva",fB=["resizeEnabledChange","rotateAnchorOffsetChange","rotateAnchorAngleChange","rotateEnabledChange","enabledAnchorsChange","anchorSizeChange","borderEnabledChange","borderStrokeChange","borderStrokeWidthChange","borderDashChange","anchorStrokeChange","anchorStrokeWidthChange","anchorFillChange","anchorCornerRadiusChange","ignoreStrokeChange","anchorStyleFuncChange"].map(e=>e+`.${S4}`).join(" "),_4="nodesRect",hB=["widthChange","heightChange","scaleXChange","scaleYChange","skewXChange","skewYChange","rotationChange","offsetXChange","offsetYChange","transformsEnabledChange","strokeWidthChange","draggableChange"],pB={"top-left":-45,"top-center":0,"top-right":45,"middle-right":-90,"middle-left":90,"bottom-left":-135,"bottom-center":180,"bottom-right":135},mB="ontouchstart"in St._global;function gB(e,t,n){if(e==="rotater")return n;t+=Oe.degToRad(pB[e]||0);const r=(Oe.radToDeg(t)%360+360)%360;return Oe._inRange(r,337.5,360)||Oe._inRange(r,0,22.5)?"ns-resize":Oe._inRange(r,22.5,67.5)?"nesw-resize":Oe._inRange(r,67.5,112.5)?"ew-resize":Oe._inRange(r,112.5,157.5)?"nwse-resize":Oe._inRange(r,157.5,202.5)?"ns-resize":Oe._inRange(r,202.5,247.5)?"nesw-resize":Oe._inRange(r,247.5,292.5)?"ew-resize":Oe._inRange(r,292.5,337.5)?"nwse-resize":(Oe.error("Transformer has unknown angle for cursor detection: "+r),"pointer")}var Om=["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"];function vB(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 A4(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 yB(e,t){return A4(e,t,vB(e))}function bB(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 Fb=0,Dn=class extends Vu{constructor(e){super(e),this._movingAnchorName=null,this._transforming=!1,this._elementsCreated=!1,this._createElements(),this._handleMouseMove=this._handleMouseMove.bind(this),this._handleMouseUp=this._handleMouseUp.bind(this),this.update=this.update.bind(this),this.on(fB,this.update),this.getNode()&&this.update()}attachTo(e){return this.setNode(e),this}setNode(e){return Oe.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 S4+this._id}setNodes(e=[]){this._nodes&&this._nodes.length&&this.detach();const t=e.filter(n=>n.isAncestorOf(this)?(Oe.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(hB.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(_4),this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")}_getNodeRect(){return this._getCache(_4,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 A4({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()}),u=[{x:l.x,y:l.y},{x:l.x+l.width,y:l.y},{x:l.x+l.width,y:l.y+l.height},{x:l.x,y:l.y+l.height}],d=a.getAbsoluteTransform();u.forEach(function(f){const p=d.point(f);e.push(p)})});const t=new cs;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(),Om.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:mB?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=gB(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 mt({name:"back",width:0,height:0,sceneFunc(t,n){const r=n.getParent(),o=r.padding(),i=n.width(),s=n.height();if(t.beginPath(),t.rect(-o,-o,i+o*2,s+o*2),r.rotateEnabled()&&r.rotateLineVisible()){const a=r.rotateAnchorAngle(),l=r.rotateAnchorOffset(),u=Oe.degToRad(a),d=Math.sin(u),f=-Math.cos(u),p=i/2,g=s/2;let m=1/0;f<0?m=Math.min(m,-g/f):f>0&&(m=Math.min(m,(s-g)/f)),d<0?m=Math.min(m,-p/d):d>0&&(m=Math.min(m,(i-p)/d));const v=p+d*m,C=g+f*m,w=Oe._sign(s),S=v+d*l*w,k=C+f*l*w;t.moveTo(v,C),t.lineTo(S,k)}t.fillStrokeShape(n)},hitFunc:(t,n)=>{if(!this.shouldOverdrawWholeArea())return;const r=this.padding();t.beginPath(),t.rect(-r,-r,n.width()+r*2,n.height()+r*2),t.fillStrokeShape(n)}});this.add(e),this._proxyDrag(e),e.on("dragstart",t=>{t.cancelBubble=!0}),e.on("dragmove",t=>{t.cancelBubble=!0}),e.on("dragend",t=>{t.cancelBubble=!0}),this.on("dragmove",t=>{this.update()})}_handleMouseDown(e){if(this._transforming)return;this._movingAnchorName=e.target.name().split(" ")[0];const t=this._getNodeRect(),n=t.width,r=t.height,o=Math.sqrt(Math.pow(n,2)+Math.pow(r,2));this.sin=Math.abs(r/o),this.cos=Math.abs(n/o),typeof window<"u"&&(window.addEventListener("mousemove",this._handleMouseMove),window.addEventListener("touchmove",this._handleMouseMove),window.addEventListener("mouseup",this._handleMouseUp,!0),window.addEventListener("touchend",this._handleMouseUp,!0)),this._transforming=!0;const i=e.target.getAbsolutePosition(),s=e.target.getStage().getPointerPosition();this._anchorDragOffset={x:s.x-i.x,y:s.y-i.y},Fb++,this._fire("transformstart",{evt:e.evt,target:this.getNode()}),this._nodes.forEach(a=>{a._fire("transformstart",{evt:e.evt,target:a})})}_handleMouseMove(e){let t,n,r;const o=this.findOne("."+this._movingAnchorName),i=o.getStage();i.setPointersPositions(e);const s=i.getPointerPosition();let a={x:s.x-this._anchorDragOffset.x,y:s.y-this._anchorDragOffset.y};const l=o.getAbsolutePosition();this.anchorDragBoundFunc()&&(a=this.anchorDragBoundFunc()(l,a,e)),o.setAbsolutePosition(a);const u=o.getAbsolutePosition();if(l.x===u.x&&l.y===u.y)return;if(this._movingAnchorName==="rotater"){const w=this._getNodeRect();t=o.x()-w.width/2,n=-o.y()+w.height/2;const S=St.getAngle(this.rotateAnchorAngle());let k=Math.atan2(-n,t)+Math.PI/2-S;w.height<0&&(k-=Math.PI);const b=St.getAngle(this.rotation())+k,T=St.getAngle(this.rotationSnapTolerance()),L=yB(w,bB(this.rotationSnaps(),b,T)-w.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 w=p?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-right").x(),y:this.findOne(".bottom-right").y()};r=Math.sqrt(Math.pow(w.x-o.x(),2)+Math.pow(w.y-o.y(),2));const S=this.findOne(".top-left").x()>w.x?-1:1,k=this.findOne(".top-left").y()>w.y?-1:1;t=r*this.cos*S,n=r*this.sin*k,this.findOne(".top-left").x(w.x-t),this.findOne(".top-left").y(w.y-n)}}else if(this._movingAnchorName==="top-center")this.findOne(".top-left").y(o.y());else if(this._movingAnchorName==="top-right"){if(f){const w=p?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-left").x(),y:this.findOne(".bottom-left").y()};r=Math.sqrt(Math.pow(o.x()-w.x,2)+Math.pow(w.y-o.y(),2));const S=this.findOne(".top-right").x()<w.x?-1:1,k=this.findOne(".top-right").y()>w.y?-1:1;t=r*this.cos*S,n=r*this.sin*k,this.findOne(".top-right").x(w.x+t),this.findOne(".top-right").y(w.y-n)}var g=o.position();this.findOne(".top-left").y(g.y),this.findOne(".bottom-right").x(g.x)}else if(this._movingAnchorName==="middle-left")this.findOne(".top-left").x(o.x());else if(this._movingAnchorName==="middle-right")this.findOne(".bottom-right").x(o.x());else if(this._movingAnchorName==="bottom-left"){if(f){const w=p?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-right").x(),y:this.findOne(".top-right").y()};r=Math.sqrt(Math.pow(w.x-o.x(),2)+Math.pow(o.y()-w.y,2));const S=w.x<o.x()?-1:1,k=o.y()<w.y?-1:1;t=r*this.cos*S,n=r*this.sin*k,o.x(w.x-t),o.y(w.y+n)}g=o.position(),this.findOne(".top-left").x(g.x),this.findOne(".bottom-right").y(g.y)}else if(this._movingAnchorName==="bottom-center")this.findOne(".bottom-right").y(o.y());else if(this._movingAnchorName==="bottom-right"){if(f){const w=p?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-left").x(),y:this.findOne(".top-left").y()};r=Math.sqrt(Math.pow(o.x()-w.x,2)+Math.pow(o.y()-w.y,2));const S=this.findOne(".bottom-right").x()<w.x?-1:1,k=this.findOne(".bottom-right").y()<w.y?-1:1;t=r*this.cos*S,n=r*this.sin*k,this.findOne(".bottom-right").x(w.x+t),this.findOne(".bottom-right").y(w.y+n)}}else console.error(new Error("Wrong position argument of selection resizer: "+this._movingAnchorName));if(p=this.centeredScaling()||e.altKey,p){const w=this.findOne(".top-left"),S=this.findOne(".bottom-right"),k=w.x(),b=w.y(),T=this.getWidth()-S.x(),L=this.getHeight()-S.y();S.move({x:-k,y:-b}),w.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(),C=this.findOne(".bottom-right").y()-this.findOne(".top-left").y();this._fitNodesInto({x:t,y:n,width:v,height:C,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();Fb--,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(Oe._inRange(e.width,-this.padding()*2-r,r)){this.update();return}if(Oe._inRange(e.height,-this.padding()*2-r,r)){this.update();return}const o=new cs;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:Oe.warn("boundBoxFunc returned falsy. You should return new bound rect from it!")}const i=1e7,s=new cs;s.translate(n.x,n.y),s.rotate(n.rotation),s.scale(n.width/i,n.height/i);const a=new cs,l=e.width/i,u=e.height/i;this.flipEnabled()===!1?(a.translate(e.x,e.y),a.rotate(e.rotation),a.translate(e.width<0?e.width:0,e.height<0?e.height:0),a.scale(Math.abs(l),Math.abs(u))):(a.translate(e.x,e.y),a.rotate(e.rotation),a.scale(l,u));const d=a.multiply(s.invert());this._nodes.forEach(f=>{var p;if(!f.getStage())return;const g=f.getParent().getAbsoluteTransform(),m=f.getTransform().copy();m.translate(f.offsetX(),f.offsetY());const v=new cs;v.multiply(g.copy().invert()).multiply(d).multiply(g).multiply(m);const C=v.decompose();f.setAttrs(C),(p=f.getLayer())===null||p===void 0||p.batchDraw()}),this.rotation(Oe._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(Oe._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 u=this.rotateAnchorAngle(),d=this.rotateAnchorOffset(),f=Oe.degToRad(u),p=Math.sin(f),g=-Math.cos(f),m=n/2,v=r/2;let C=1/0;g<0?C=Math.min(C,-v/g):g>0&&(C=Math.min(C,(r-v)/g)),p<0?C=Math.min(C,-m/p):p>0&&(C=Math.min(C,(n-m)/p));const w=m+p*C,S=v+g*C,k=Oe._sign(r);this._batchChangeChild(".rotater",{x:w+p*d*k,y:S+g*d*k-s*g,visible:this.rotateEnabled()}),this._batchChangeChild(".back",{width:n,height:r,visible:this.borderEnabled(),stroke:this.borderStroke(),strokeWidth:this.borderStrokeWidth(),dash:this.borderDash(),draggable:this.nodes().some(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=""),Vu.prototype.destroy.call(this),this.detach(),this._removeEvents(),this}add(...e){return this._elementsCreated?(Oe.error("You cannot add external nodes to the Transformer. Use tr.nodes([node]) instead."),this):super.add(...e)}toObject(){return At.prototype.toObject.call(this)}clone(e){return At.prototype.clone.call(this,e)}getClientRect(){return this.nodes().length>0?super.getClientRect():{x:0,y:0,width:0,height:0}}};Dn.isTransforming=()=>Fb>0;function wB(e){return e instanceof Array||Oe.warn("enabledAnchors value should be an array"),e instanceof Array&&e.forEach(function(t){Om.indexOf(t)===-1&&Oe.warn("Unknown anchor name: "+t+". Available names are: "+Om.join(", "))}),e||[]}Dn.prototype.className="Transformer",Ar(Dn),pe.addGetterSetter(Dn,"enabledAnchors",Om,wB),pe.addGetterSetter(Dn,"flipEnabled",!0,us()),pe.addGetterSetter(Dn,"resizeEnabled",!0),pe.addGetterSetter(Dn,"anchorSize",10,bt()),pe.addGetterSetter(Dn,"rotateEnabled",!0),pe.addGetterSetter(Dn,"rotateLineVisible",!0),pe.addGetterSetter(Dn,"rotationSnaps",[]),pe.addGetterSetter(Dn,"rotateAnchorOffset",50,bt()),pe.addGetterSetter(Dn,"rotateAnchorAngle",0,bt()),pe.addGetterSetter(Dn,"rotateAnchorCursor","crosshair"),pe.addGetterSetter(Dn,"rotationSnapTolerance",5,bt()),pe.addGetterSetter(Dn,"borderEnabled",!0),pe.addGetterSetter(Dn,"anchorStroke","rgb(0, 161, 255)"),pe.addGetterSetter(Dn,"anchorStrokeWidth",1,bt()),pe.addGetterSetter(Dn,"anchorFill","white"),pe.addGetterSetter(Dn,"anchorCornerRadius",0,bt()),pe.addGetterSetter(Dn,"borderStroke","rgb(0, 161, 255)"),pe.addGetterSetter(Dn,"borderStrokeWidth",1,bt()),pe.addGetterSetter(Dn,"borderDash"),pe.addGetterSetter(Dn,"keepRatio",!0),pe.addGetterSetter(Dn,"shiftBehavior","default"),pe.addGetterSetter(Dn,"centeredScaling",!1),pe.addGetterSetter(Dn,"ignoreStroke",!1),pe.addGetterSetter(Dn,"padding",0,bt()),pe.addGetterSetter(Dn,"nodes"),pe.addGetterSetter(Dn,"node"),pe.addGetterSetter(Dn,"boundBoxFunc"),pe.addGetterSetter(Dn,"anchorDragBoundFunc"),pe.addGetterSetter(Dn,"anchorStyleFunc"),pe.addGetterSetter(Dn,"shouldOverdrawWholeArea",!1),pe.addGetterSetter(Dn,"useSingleNodeRotation",!0),pe.backCompat(Dn,{lineEnabled:"borderEnabled",rotateHandlerOffset:"rotateAnchorOffset",enabledHandlers:"enabledAnchors"});var Oa=class extends mt{_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)}};Oa.prototype.className="Wedge",Oa.prototype._centroid=!0,Oa.prototype._attrsAffectingSize=["radius"],Ar(Oa),pe.addGetterSetter(Oa,"radius",0,bt()),pe.addGetterSetter(Oa,"angle",0,bt()),pe.addGetterSetter(Oa,"clockwise",!1),pe.backCompat(Oa,{angleDeg:"angle",getAngleDeg:"getAngle",setAngleDeg:"setAngle"});function I4(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}var CB=[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],kB=[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 SB(e,t){const n=e.data,r=e.width,o=e.height;let i,s,a,l,u,d,f,p,g,m,v,C,w,S,k,b,T,L,z,G;const U=t+t+1,j=r-1,Z=o-1,R=t+1,K=R*(R+1)/2,x=new I4,W=CB[t],$=kB[t];let J=null,Q=x,Y=null,Ce=null;for(let fe=1;fe<U;fe++)Q=Q.next=new I4,fe===R&&(J=Q);Q.next=x,a=s=0;for(let fe=0;fe<o;fe++){C=w=S=k=l=u=d=f=0,p=R*(b=n[s]),g=R*(T=n[s+1]),m=R*(L=n[s+2]),v=R*(z=n[s+3]),l+=K*b,u+=K*T,d+=K*L,f+=K*z,Q=x;for(let ve=0;ve<R;ve++)Q.r=b,Q.g=T,Q.b=L,Q.a=z,Q=Q.next;for(let ve=1;ve<R;ve++)i=s+((j<ve?j:ve)<<2),l+=(Q.r=b=n[i])*(G=R-ve),u+=(Q.g=T=n[i+1])*G,d+=(Q.b=L=n[i+2])*G,f+=(Q.a=z=n[i+3])*G,C+=b,w+=T,S+=L,k+=z,Q=Q.next;Y=x,Ce=J;for(let ve=0;ve<r;ve++)n[s+3]=z=f*W>>$,z!==0?(z=255/z,n[s]=(l*W>>$)*z,n[s+1]=(u*W>>$)*z,n[s+2]=(d*W>>$)*z):n[s]=n[s+1]=n[s+2]=0,l-=p,u-=g,d-=m,f-=v,p-=Y.r,g-=Y.g,m-=Y.b,v-=Y.a,i=a+((i=ve+t+1)<j?i:j)<<2,C+=Y.r=n[i],w+=Y.g=n[i+1],S+=Y.b=n[i+2],k+=Y.a=n[i+3],l+=C,u+=w,d+=S,f+=k,Y=Y.next,p+=b=Ce.r,g+=T=Ce.g,m+=L=Ce.b,v+=z=Ce.a,C-=b,w-=T,S-=L,k-=z,Ce=Ce.next,s+=4;a+=r}for(let fe=0;fe<r;fe++){w=S=k=C=u=d=f=l=0,s=fe<<2,p=R*(b=n[s]),g=R*(T=n[s+1]),m=R*(L=n[s+2]),v=R*(z=n[s+3]),l+=K*b,u+=K*T,d+=K*L,f+=K*z,Q=x;for(let me=0;me<R;me++)Q.r=b,Q.g=T,Q.b=L,Q.a=z,Q=Q.next;let ve=r;for(let me=1;me<=t;me++)s=ve+fe<<2,l+=(Q.r=b=n[s])*(G=R-me),u+=(Q.g=T=n[s+1])*G,d+=(Q.b=L=n[s+2])*G,f+=(Q.a=z=n[s+3])*G,C+=b,w+=T,S+=L,k+=z,Q=Q.next,me<Z&&(ve+=r);s=fe,Y=x,Ce=J;for(let me=0;me<o;me++)i=s<<2,n[i+3]=z=f*W>>$,z>0?(z=255/z,n[i]=(l*W>>$)*z,n[i+1]=(u*W>>$)*z,n[i+2]=(d*W>>$)*z):n[i]=n[i+1]=n[i+2]=0,l-=p,u-=g,d-=m,f-=v,p-=Y.r,g-=Y.g,m-=Y.b,v-=Y.a,i=fe+((i=me+R)<Z?i:Z)*r<<2,l+=C+=Y.r=n[i],u+=w+=Y.g=n[i+1],d+=S+=Y.b=n[i+2],f+=k+=Y.a=n[i+3],Y=Y.next,p+=b=Ce.r,g+=T=Ce.g,m+=L=Ce.b,v+=z=Ce.a,C-=b,w-=T,S-=L,k-=z,Ce=Ce.next,s+=r}}var _B=function(t){const n=Math.round(this.blurRadius());n>0&&SB(t,n)};pe.addGetterSetter(At,"blurRadius",0,bt(),pe.afterSetFilter);var AB=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};pe.addGetterSetter(At,"brightness",0,bt(),pe.afterSetFilter);var IB=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)},EB=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};pe.addGetterSetter(At,"contrast",0,bt(),pe.afterSetFilter);var TB=function(e){var t,n,r,o,i,s,a,l,u;const d=e.data,f=e.width,p=e.height,g=Math.min(1,Math.max(0,(n=(t=this.embossStrength)===null||t===void 0?void 0:t.call(this))!==null&&n!==void 0?n:.5)),m=Math.min(1,Math.max(0,(o=(r=this.embossWhiteLevel)===null||r===void 0?void 0:r.call(this))!==null&&o!==void 0?o:.5)),v=(a={"top-left":315,top:270,"top-right":225,right:180,"bottom-right":135,bottom:90,"bottom-left":45,left:0}[(s=(i=this.embossDirection)===null||i===void 0?void 0:i.call(this))!==null&&s!==void 0?s:"top-left"])!==null&&a!==void 0?a:315,C=!!((u=(l=this.embossBlend)===null||l===void 0?void 0:l.call(this))!==null&&u!==void 0&&u),w=g*10,S=m*255,k=v*Math.PI/180,b=Math.cos(k),T=Math.sin(k),L=128/1020*w,z=new Uint8ClampedArray(d),G=new Float32Array(f*p);for(let K=0,x=0;x<d.length;x+=4,K++)G[K]=.2126*z[x]+.7152*z[x+1]+.0722*z[x+2];const U=[-1,0,1,-2,0,2,-1,0,1],j=[-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,J=0;$+=G[W+Z[0]]*U[0],J+=G[W+Z[0]]*j[0],$+=G[W+Z[1]]*U[1],J+=G[W+Z[1]]*j[1],$+=G[W+Z[2]]*U[2],J+=G[W+Z[2]]*j[2],$+=G[W+Z[3]]*U[3],J+=G[W+Z[3]]*j[3],$+=G[W+Z[5]]*U[5],J+=G[W+Z[5]]*j[5],$+=G[W+Z[6]]*U[6],J+=G[W+Z[6]]*j[6],$+=G[W+Z[7]]*U[7],J+=G[W+Z[7]]*j[7],$+=G[W+Z[8]]*U[8],J+=G[W+Z[8]]*j[8];const Q=R(S+(b*$+T*J)*L),Y=W*4;if(C){const Ce=Q-S;d[Y]=R(z[Y]+Ce),d[Y+1]=R(z[Y+1]+Ce),d[Y+2]=R(z[Y+2]+Ce),d[Y+3]=z[Y+3]}else d[Y]=d[Y+1]=d[Y+2]=Q,d[Y+3]=z[Y+3]}for(let K=0;K<f;K++){let x=K*4,W=((p-1)*f+K)*4;d[x]=z[x],d[x+1]=z[x+1],d[x+2]=z[x+2],d[x+3]=z[x+3],d[W]=z[W],d[W+1]=z[W+1],d[W+2]=z[W+2],d[W+3]=z[W+3]}for(let K=1;K<p-1;K++){let x=K*f*4,W=(K*f+(f-1))*4;d[x]=z[x],d[x+1]=z[x+1],d[x+2]=z[x+2],d[x+3]=z[x+3],d[W]=z[W],d[W+1]=z[W+1],d[W+2]=z[W+2],d[W+3]=z[W+3]}return e};pe.addGetterSetter(At,"embossStrength",.5,bt(),pe.afterSetFilter),pe.addGetterSetter(At,"embossWhiteLevel",.5,bt(),pe.afterSetFilter),pe.addGetterSetter(At,"embossDirection","top-left",void 0,pe.afterSetFilter),pe.addGetterSetter(At,"embossBlend",!1,void 0,pe.afterSetFilter);function Nb(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 xB=function(e){const t=e.data,n=t.length;let r=t[0],o=r,i,s=t[1],a=s,l,u=t[2],d=u,f;const p=this.enhance();if(p===0)return;for(let k=0;k<n;k+=4)i=t[k+0],i<r?r=i:i>o&&(o=i),l=t[k+1],l<s?s=l:l>a&&(a=l),f=t[k+2],f<u?u=f:f>d&&(d=f);o===r&&(o=255,r=0),a===s&&(a=255,s=0),d===u&&(d=255,u=0);let g,m,v,C,w,S;if(p>0)g=o+p*(255-o),m=r-p*(r-0),v=a+p*(255-a),C=s-p*(s-0),w=d+p*(255-d),S=u-p*(u-0);else{const k=(o+r)*.5;g=o+p*(o-k),m=r+p*(r-k);const b=(a+s)*.5;v=a+p*(a-b),C=s+p*(s-b);const T=(d+u)*.5;w=d+p*(d-T),S=u+p*(u-T)}for(let k=0;k<n;k+=4)t[k+0]=Nb(t[k+0],r,o,m,g),t[k+1]=Nb(t[k+1],s,a,C,v),t[k+2]=Nb(t[k+2],u,d,S,w)};pe.addGetterSetter(At,"enhance",0,bt(),pe.afterSetFilter);var RB=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}};pe.addGetterSetter(At,"hue",0,bt(),pe.afterSetFilter),pe.addGetterSetter(At,"saturation",0,bt(),pe.afterSetFilter),pe.addGetterSetter(At,"luminance",0,bt(),pe.afterSetFilter);var MB=function(e){const t=e.data,n=t.length,r=1,o=Math.pow(2,this.saturation()),i=Math.abs(this.hue()+360)%360,s=this.luminance()*127,a=r*o*Math.cos(i*Math.PI/180),l=r*o*Math.sin(i*Math.PI/180),u=.299*r+.701*a+.167*l,d=.587*r-.587*a+.33*l,f=.114*r-.114*a-.497*l,p=.299*r-.299*a-.328*l,g=.587*r+.413*a+.035*l,m=.114*r-.114*a+.293*l,v=.299*r-.3*a+1.25*l,C=.587*r-.586*a-1.05*l,w=.114*r+.886*a-.2*l;let S,k,b,T;for(let L=0;L<n;L+=4)S=t[L+0],k=t[L+1],b=t[L+2],T=t[L+3],t[L+0]=u*S+d*k+f*b+s,t[L+1]=p*S+g*k+m*b+s,t[L+2]=v*S+C*k+w*b+s,t[L+3]=T},LB=function(e){const t=e.data,n=t.length,r=Math.pow(2,this.value()),o=Math.pow(2,this.saturation()),i=Math.abs(this.hue()+360)%360,s=r*o*Math.cos(i*Math.PI/180),a=r*o*Math.sin(i*Math.PI/180),l=.299*r+.701*s+.167*a,u=.587*r-.587*s+.33*a,d=.114*r-.114*s-.497*a,f=.299*r-.299*s-.328*a,p=.587*r+.413*s+.035*a,g=.114*r-.114*s+.293*a,m=.299*r-.3*s+1.25*a,v=.587*r-.586*s-1.05*a,C=.114*r+.886*s-.2*a;for(let w=0;w<n;w+=4){const S=t[w+0],k=t[w+1],b=t[w+2],T=t[w+3];t[w+0]=l*S+u*k+d*b,t[w+1]=f*S+p*k+g*b,t[w+2]=m*S+v*k+C*b,t[w+3]=T}};pe.addGetterSetter(At,"hue",0,bt(),pe.afterSetFilter),pe.addGetterSetter(At,"saturation",0,bt(),pe.afterSetFilter),pe.addGetterSetter(At,"value",0,bt(),pe.afterSetFilter);var DB=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]},OB=function(e,t,n){const r=e.data,o=t.data,i=e.width,s=e.height,a=n.polarCenterX||i/2,l=n.polarCenterY||s/2;let u=Math.sqrt(a*a+l*l),d=i-a,f=s-l;const p=Math.sqrt(d*d+f*f);u=p>u?p:u;const g=s,m=i,v=360/m*Math.PI/180;for(let C=0;C<m;C+=1){const w=Math.sin(C*v),S=Math.cos(C*v);for(let k=0;k<g;k+=1){d=Math.floor(a+u*k/g*S),f=Math.floor(l+u*k/g*w);let b=(f*i+d)*4;const T=r[b+0],L=r[b+1],z=r[b+2],G=r[b+3];b=(C+k*i)*4,o[b+0]=T,o[b+1]=L,o[b+2]=z,o[b+3]=G}}},PB=function(e,t,n){const r=e.data,o=t.data,i=e.width,s=e.height,a=n.polarCenterX||i/2,l=n.polarCenterY||s/2;let u=Math.sqrt(a*a+l*l),d=i-a,f=s-l;const p=Math.sqrt(d*d+f*f);u=p>u?p:u;const g=s,m=i,v=n.polarRotation||0;let C,w;for(d=0;d<i;d+=1)for(f=0;f<s;f+=1){const S=d-a,k=f-l,b=Math.sqrt(S*S+k*k)*g/u;let T=(Math.atan2(k,S)*180/Math.PI+360+v)%360;T=T*m/360,C=Math.floor(T),w=Math.floor(b);let L=(w*i+C)*4;const z=r[L+0],G=r[L+1],U=r[L+2],j=r[L+3];L=(f*i+d)*4,o[L+0]=z,o[L+1]=G,o[L+2]=U,o[L+3]=j}},FB=function(e){const t=e.width,n=e.height;let r,o,i,s,a,l,u,d,f,p,g=Math.round(this.kaleidoscopePower());const m=Math.round(this.kaleidoscopeAngle()),v=Math.floor(t*(m%360)/360);if(g<1)return;const C=Oe.createCanvasElement();C.width=t,C.height=n;const w=C.getContext("2d").getImageData(0,0,t,n);Oe.releaseCanvas(C),OB(e,w,{polarCenterX:t/2,polarCenterY:n/2});let S=t/Math.pow(2,g);for(;S<=8;)S=S*2,g-=1;S=Math.ceil(S);let k=S,b=0,T=k,L=1;for(v+S>t&&(b=k,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=w.data[f+0],l=w.data[f+1],u=w.data[f+2],d=w.data[f+3],p=(t*o+r)*4,w.data[p+0]=a,w.data[p+1]=l,w.data[p+2]=u,w.data[p+3]=d;for(o=0;o<n;o+=1)for(k=Math.floor(S),s=0;s<g;s+=1){for(r=0;r<k+1;r+=1)f=(t*o+r)*4,a=w.data[f+0],l=w.data[f+1],u=w.data[f+2],d=w.data[f+3],p=(t*o+k*2-r-1)*4,w.data[p+0]=a,w.data[p+1]=l,w.data[p+2]=u,w.data[p+3]=d;k*=2}PB(w,e,{polarRotation:0})};pe.addGetterSetter(At,"kaleidoscopePower",2,bt(),pe.afterSetFilter),pe.addGetterSetter(At,"kaleidoscopeAngle",0,bt(),pe.afterSetFilter);function Pm(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 NB(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 BB(e,t){const n=Pm(e,0,0),r=Pm(e,e.width-1,0),o=Pm(e,0,e.height-1),i=Pm(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=NB([r,n,i,o]),l=[];for(let u=0;u<e.width*e.height;u++)l[u]=sh(a,[e.data[u*4],e.data[u*4+1],e.data[u*4+2]])<s?0:255;return l}}function zB(e,t){for(let n=0;n<e.width*e.height;n++)e.data[4*n+3]=t[n]}function jB(e,t,n){const r=[1,1,1,1,0,1,1,1,1],o=Math.round(Math.sqrt(r.length)),i=Math.floor(o/2),s=[];for(let a=0;a<n;a++)for(let l=0;l<t;l++){const u=a*t+l;let d=0;for(let f=0;f<o;f++)for(let p=0;p<o;p++){const g=a+f-i,m=l+p-i;if(g>=0&&g<n&&m>=0&&m<t){const v=g*t+m,C=r[f*o+p];d+=e[v]*C}}s[u]=d===2040?255:0}return s}function VB(e,t,n){const r=[1,1,1,1,1,1,1,1,1],o=Math.round(Math.sqrt(r.length)),i=Math.floor(o/2),s=[];for(let a=0;a<n;a++)for(let l=0;l<t;l++){const u=a*t+l;let d=0;for(let f=0;f<o;f++)for(let p=0;p<o;p++){const g=a+f-i,m=l+p-i;if(g>=0&&g<n&&m>=0&&m<t){const v=g*t+m,C=r[f*o+p];d+=e[v]*C}}s[u]=d>=1020?255:0}return s}function UB(e,t,n){const r=[.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111],o=Math.round(Math.sqrt(r.length)),i=Math.floor(o/2),s=[];for(let a=0;a<n;a++)for(let l=0;l<t;l++){const u=a*t+l;let d=0;for(let f=0;f<o;f++)for(let p=0;p<o;p++){const g=a+f-i,m=l+p-i;if(g>=0&&g<n&&m>=0&&m<t){const v=g*t+m,C=r[f*o+p];d+=e[v]*C}}s[u]=d}return s}var HB=function(e){let t=BB(e,this.threshold());return t&&(t=jB(t,e.width,e.height),t=VB(t,e.width,e.height),t=UB(t,e.width,e.height),zB(e,t)),e};pe.addGetterSetter(At,"threshold",0,bt(),pe.afterSetFilter);var $B=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()};pe.addGetterSetter(At,"noise",.2,bt(),pe.afterSetFilter);var GB=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){Oe.error("pixelSize value can not be <= 0");return}for(let a=0;a<o;a+=1)for(let l=0;l<i;l+=1){let u=0,d=0,f=0,p=0;const g=a*t,m=g+t,v=l*t,C=v+t;let w=0;for(let S=g;S<m;S+=1)if(!(S>=n))for(let k=v;k<C;k+=1){if(k>=r)continue;const b=(n*k+S)*4;u+=s[b+0],d+=s[b+1],f+=s[b+2],p+=s[b+3],w+=1}u=u/w,d=d/w,f=f/w,p=p/w;for(let S=g;S<m;S+=1)if(!(S>=n))for(let k=v;k<C;k+=1){if(k>=r)continue;const b=(n*k+S)*4;s[b+0]=u,s[b+1]=d,s[b+2]=f,s[b+3]=p}}};pe.addGetterSetter(At,"pixelSize",8,bt(),pe.afterSetFilter);var WB=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};pe.addGetterSetter(At,"levels",.5,bt(),pe.afterSetFilter);var KB=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]}};pe.addGetterSetter(At,"red",0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)}),pe.addGetterSetter(At,"green",0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)}),pe.addGetterSetter(At,"blue",0,EA,pe.afterSetFilter);var qB=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}};pe.addGetterSetter(At,"red",0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)}),pe.addGetterSetter(At,"green",0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)}),pe.addGetterSetter(At,"blue",0,EA,pe.afterSetFilter),pe.addGetterSetter(At,"alpha",1,function(e){return this._filterUpToDate=!1,e>1?1:e<0?0:e});var YB=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)}},XB=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},ZB=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};pe.addGetterSetter(At,"threshold",.5,bt(),pe.afterSetFilter);var QB=o4.Util._assign(o4,{Arc:La,Arrow:Ic,Circle:Hu,Ellipse:Rl,Image:ds,Label:Db,Tag:Ec,Line:Da,Path:$i,Rect:rh,RegularPolygon:Ml,Ring:Tc,Sprite:js,Star:Ll,Text:cr,TextPath:so,Transformer:Dn,Wedge:Oa,Filters:{Blur:_B,Brightness:IB,Brighten:AB,Contrast:EB,Emboss:TB,Enhance:xB,Grayscale:RB,HSL:MB,HSV:LB,Invert:DB,Kaleidoscope:FB,Mask:HB,Noise:$B,Pixelate:GB,Posterize:WB,RGB:KB,RGBA:qB,Sepia:YB,Solarize:XB,Threshold:ZB}}),JB=QB;Dt();var ez=["dialog","floating"],E4=["top-right","top-left","bottom-right","bottom-left","top-center","bottom-center"];function tz(e){if(!e||typeof e!="object")throw new Error("SurfaceManager: request must be a non-null object.");if(!ez.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&&!E4.includes(e.floating.placement))throw new Error(`SurfaceManager: floating.placement must be one of ${E4.join(", ")}, got "${e.floating.placement}".`)}var nz=class{activeDialog=Vr(null);activeFloating=Vr(null);#e=!1;#n=1;#t;constructor({getModuleConfig:e}){this.#t=e}open(e){if(this.#e)return this.#c(e);tz(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 u=g=>{i({status:"submitted",data:g})&&this.#i(l)},d=g=>{i({status:"closed",reason:g})&&this.#i(l)};l={id:t.id,mode:t.mode,request:t,component:n,props:r,render:o,resolve:u,close:d,settle:g=>i(g),get settled(){return s}};const f=t.mode==="dialog"?"activeDialog":"activeFloating",p=this[f].value;return p&&!p.settled&&p.settle({status:"replaced",replacedBy:t.id}),this[f].value=l,{id:t.id,mode:t.mode,close:g=>this.#o(l,g),result:a}}close(e,t){if(e!=null){const o=this.#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"})}}},rz="https://docs.superdoc.dev/guides/migration/document-api",T4=new Set;function oz(e,t){T4.has(e)||(T4.add(e),console.warn(t))}var iz={state:"editor.state",view:"editor.view",schema:"editor.schema",commands:"editor.commands",chain:"editor.chain()",can:"editor.can()",dispatch:"editor.dispatch()"},x4=Symbol.for("superdoc:rawEditor"),R4=new WeakMap;function M4(e){return!e||e[x4]?e:new Proxy(e,{get(t,n){if(n===x4)return t;const r=iz[n];r&&oz(`deprecated:${String(n)}`,`[SuperDoc] ${r} is deprecated and will be removed in a future version. Use the Document API (editor.doc) instead. See ${rz}`);const o=Reflect.get(t,n,t);if(typeof o=="function"){let i=R4.get(t);return i||(i=new Map,R4.set(t,i)),i.has(n)||i.set(n,o.bind(t)),i.get(n)}return o}})}var L4=["review","original","final","off"],sz=["original","markup","final"],az=["paired","independent"],D4=Symbol.for("@superdoc/trackChanges:normalized"),O4=new Set;function Fm(e,t){O4.has(e)||(O4.add(e),console.warn(`[SuperDoc] ${e} is deprecated β use ${t} instead.`))}function P4(e,t,n){return typeof e=="boolean"?e:typeof t=="boolean"?t:n}function lz(e,t,n){return typeof e=="string"&&L4.includes(e)?e:typeof t=="string"&&L4.includes(t)?t:n}function cz(e){return typeof e!="string"||!sz.includes(e)?null:e}function uz(e){return e==="markup"?"review":e}function dz(e){return typeof e=="string"&&az.includes(e)?e:null}function Pa(e){return!e||typeof e!="object"||Array.isArray(e)?null:e}function Bb(e){const t=e[D4]===!0,n=Pa(e.viewing),r=cz(n?.trackedChanges);Pa(e.modules)||(e.modules={});const o=Pa(e.modules.trackChanges),i=Pa(e.trackChanges),s=Pa(e.layoutEngineOptions?.trackedChanges);t||(i&&Fm("config.trackChanges","config.viewing.trackedChanges"),s&&Fm("config.layoutEngineOptions.trackedChanges","config.viewing.trackedChanges for display and config.modules.trackChanges for behavior"),o&&Object.prototype.hasOwnProperty.call(o,"visible")&&Fm("config.modules.trackChanges.visible","config.viewing.trackedChanges"),o&&Object.prototype.hasOwnProperty.call(o,"mode")&&Fm("config.modules.trackChanges.mode","config.viewing.trackedChanges"));const a=r?r==="markup":P4(o?.visible,i?.visible,!1),l=P4(o?.enabled,s?.enabled,!0),u=dz(o?.replacements)??"paired",d=Pa(o?.authorColors)?o.authorColors:void 0,f=Pa(o?.semanticColors)?o.semanticColors:void 0,p=e.documentMode==="viewing",g=p?a?"review":"original":"review",m=r?p?uz(r):"review":lz(o?.mode,s?.mode,g),v={visible:a,mode:m,enabled:l,replacements:u};return d&&(v.authorColors=d),f&&(v.semanticColors=f),e.modules.trackChanges=v,e.trackChanges={visible:a},Pa(e.layoutEngineOptions)||(e.layoutEngineOptions={}),e.layoutEngineOptions.trackedChanges={mode:m,enabled:l},typeof n?.comments=="boolean"&&(Pa(e.comments)||(e.comments={}),e.comments.visible=n.comments),Object.defineProperty(e,D4,{value:!0,writable:!0,configurable:!0,enumerable:!1}),v}var zb=Object.freeze({id:null,name:"Default SuperDoc user",email:null});function fz(e){return!e||typeof e!="object"?{...zb}:{...zb,...e}}var Nm=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"}),F4=Object.freeze({toolbar:!0,comments:!0,contextMenu:!0,loading:!0,search:!1,linkPopover:!1,ruler:!1,contentControls:!0}),hz=Object.freeze(["left","center","right"]),pz=Object.freeze({compact:32,default:80,wide:120}),_W=Object.freeze(Object.keys(F4)),Qr=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function N4(e,t){const n=e?.[t];return n===!1?!1:n===void 0?F4[t]:!0}function mz(e,t){const n=e?.[t];return Qr(n)?n:{}}var B4=Object.freeze(["level","readOnly","allowResolve","permissionResolver"]);function gz(e){if(!B4.some(n=>n in e))return e;const t={...e};for(const n of B4)delete t[n];return t}function z4(e){const t={...e},n=Il(e.sections,e.customItems),r=Il(e.defaultItems,e.includeDefaultItems);return delete t.customItems,delete t.includeDefaultItems,Zo(t,{sections:n,defaultItems:r})}var j4=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 vz(e){return Qr(e)?Object.fromEntries(Object.entries(e).filter(([t,n])=>j4[t]!==void 0&&n!==void 0).map(([t,n])=>[j4[t],n])):{}}function V4(e){const t={...e};return delete t.strings,delete t.replaceControls,delete t.includeTrackedDeletions,Zo(t,vz(e.strings),{replaceEnabled:Il(e.replaceControls,e.replaceEnabled),includeDeletedText:Il(e.includeTrackedDeletions,e.includeDeletedText)})}var yz=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"}),bz=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 Bm(e,t){return t[e]??e}function jb(e,t){if(!Qr(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])=>[Bm(i,t),s]))}function U4(e){return Array.isArray(e)?e.map(t=>Bm(t,Nm)):e}function H4(e){return Qr(e)?Object.fromEntries(Object.entries(e).map(([t,n])=>[t,U4(n)])):e}function wz(e,t){if(!Qr(e)||!Array.isArray(t))return e;const n={...e};for(const r of t){if(!Qr(r))continue;const o=r.region??"center";n[o]===void 0&&(n[o]=[])}return n}var Cz=Object.freeze({"formatting-marks":"right","table-of-contents":"center"});function kz(e,t){if(!Qr(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=>Bm(o,Nm)));for(const o of t){const i=Bm(o,Nm);if(r.has(i))continue;const s=Cz[o];s&&(Array.isArray(n[s])||(n[s]=[]),n[s].push(o),r.add(i))}return n}function $4(e,t){return wz(kz(e,t.includeItems),t.customItems)}function Sz(e){return Array.isArray(e)?e.map(t=>{if(!Qr(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 _z(e){return Array.isArray(e)?e.map(t=>{if(!Qr(t)||typeof t.id!="string")return t;const n=t.size??"default",r=t.type==="separator"?void 0:pz[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=>Qr(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 Az(e){const t={...e},n=Il(e.items,Qr(e.groups)?e.groups:void 0),r=Qr(e.items)&&Object.keys(e.items).length===0?{center:[]}:n,o=$4(r,e),i=o===void 0?e.groups:H4(o),s=jb(e.icons,yz),a=Zo(jb(e.texts,{}),jb(e.strings,bz)),l=Array.isArray(e.includeItems)?new Set(e.includeItems):null,u=Qr(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,Zo(t,{groups:i,excludeItems:U4(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:Sz(e.fontOptions),customButtons:e.customItems===void 0?e.customButtons:_z(e.customItems),showFormattingMarksButton:l===null&&!u.has("formatting-marks")?e.showFormattingMarksButton:u.has("formatting-marks")||l?.has("formatting-marks"),showTableOfContentsButton:l===null&&!u.has("table-of-contents")?e.showTableOfContentsButton:u.has("table-of-contents")||l?.has("table-of-contents")})}function G4(e={}){const t=e.ui,n=t===!1,r=Qr(t)?t:void 0,o=K=>!n&&N4(r,K),i=K=>n?!1:r?.[K]===void 0?void 0:N4(r,K),s=K=>n?{}:mz(r,K),a=n||i("ruler")===!1,l=n||i("linkPopover")===!1,u=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=Az(p),m=Qr(p.items),v=e.modules?.toolbar,C=Qr(v)?v:{},w=e.modules?.contextMenu??e.modules?.slashMenu,S=Qr(w)?w:{},k=e.modules?.surfaces?.findReplace,b=V4(Qr(k)?k:{}),T=Qr(C.groups)?H4($4(C.groups,p)):C.groups,L=[g.groups,T],z=L.find(Qr),G=L.find(Array.isArray),U=m?Object.keys(g.groups??{}):Il(G,C.toolbarGroups,e.toolbarGroups),j=Array.isArray(U)?U:null,Z=(K,x)=>Object.prototype.hasOwnProperty.call(K,x),R=z&&j?Object.fromEntries([...j.filter(K=>Z(z,K)),...Object.keys(z).filter(K=>!hz.includes(K))].map(K=>[K,z[K]])):z;return{enabled:!n,toolbar:{enabled:o("toolbar"),container:n?null:Il(g.container,C.selector,e.toolbar)??null,options:n?{}:{...Zo(C,g),groups:R,toolbarGroups:U,icons:Zo(e.toolbarIcons,C.icons,g.icons),texts:Zo(e.toolbarTexts,C.texts,g.texts)}},comments:{enabled:i("comments")??(!n&&e.modules?.comments!==!1),options:n?{}:TS(gz(s("comments")))},contextMenu:{enabled:i("contextMenu")??(!n&&e.disableContextMenu!==!0),suppressed:n||i("contextMenu")===!1,options:n?{}:Zo(z4(S),z4(s("contextMenu")))},loading:{enabled:o("loading")},search:{enabled:i("search")??(!n&&!!e.modules?.surfaces?.findReplace),options:n?{}:Zo(b,V4(s("search")))},linkPopover:{enabled:typeof u=="function",suppressed:l,options:Zo(s("linkPopover"),{popoverResolver:u})},ruler:{enabled:i("ruler")??(!n&&!!e.rulers),suppressed:a,container:a?null:s("ruler").container??e.rulerContainer??null},contentControls:{enabled:d,options:d?Zo({chrome:f},s("contentControls")):{chrome:"none"}}}}var zm=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Iz=e=>e==="read"||e==="write"||e==="resolve";function W4(e={}){const t=zm(e.interaction)?e.interaction:{},n=zm(t.comments)?t.comments:{},r=zm(t.trackedChanges)?t.trackedChanges:{},o=zm(e.modules?.comments)?e.modules.comments:{},i=(n.readOnly??o.readOnly??!1)===!0,s=(n.allowResolve??o.allowResolve??!0)!==!1,a=Iz(n.level),l=a?n.level:i?"read":s?"resolve":"write",u=r.allowDecisions;return{comments:{level:l,readOnly:a?l==="read":i,allowResolve:a?l==="resolve":s},trackedChanges:{allowDecisions:typeof u=="boolean"?u:!i}}}var K4=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function q4(e={}){const t=K4(e.surfaces)?e.surfaces:{},n=K4(e.modules?.surfaces)?e.modules.surfaces:{},r=t.resolver===void 0?n.resolver:t.resolver;return{resolver:typeof r=="function"?r:null,dialog:Zo(n.dialog,t.dialog),floating:Zo(n.floating,t.floating)}}var Ez=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(`[${mm}]`);if(!n)return null;const r=n.getAttribute(mm),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{}}},at={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"},Y4={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 X4(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 Tz(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 xz(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 Z4(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 Vb(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 Rz(e){const t=Vb(e,["alignment","value"]);if(typeof t!="string")return t;const n=t.trim().toLowerCase();return n==="justified"||n==="both"?"justify":n}function Mz(e){const t=Vb(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 Lz(e){if(e&&typeof e=="object"&&"role"in e)return e;const t=Vb(e,["styleId","value","style"]);return typeof t=="string"?t.trim():t}function Dz(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 Oz=at.commandUnsupported,Vs=at.tableContextUnavailable,Q4=[{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:X4,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:X4,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:Tz},{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:Dz},{id:"measurement-unit",family:"measurement",disposition:"routed",mutates:!1,instanceRoute:"setMeasurementUnit",valueFrom:"measurementUnit",normalizePayload:xz},{id:"text-color",family:"color",disposition:"routed",mutates:!0,docRoute:"format.color",inline:{key:"color",kind:"value-string"},normalizePayload:Z4},{id:"highlight-color",family:"color",disposition:"routed",mutates:!0,docRoute:"format.highlight",inline:{key:"highlight",kind:"value-string"},normalizePayload:Z4},{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:Rz},{id:"line-height",family:"paragraph",disposition:"routed",mutates:!0,docRoute:"format.paragraph.setSpacing",blockParagraph:{kind:"spacing-line"},normalizePayload:Mz},{id:"linked-style",family:"paragraph",disposition:"routed",mutates:!0,docRoute:"styles.paragraph.setStyle",blockParagraph:{kind:"style"},normalizePayload:Lz},{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:Vs},{id:"table-add-row-after",family:"tables",disposition:"routed",mutates:!0,docRoute:"tables.insertRow",table:{action:"insert-row-after",op:"insertRow"},reason:Vs},{id:"table-delete-row",family:"tables",disposition:"routed",mutates:!0,docRoute:"tables.deleteRow",table:{action:"delete-row",op:"deleteRow"},reason:Vs},{id:"table-add-column-before",family:"tables",disposition:"routed",mutates:!0,docRoute:"tables.insertColumn",table:{action:"insert-column-before",op:"insertColumn"},reason:Vs},{id:"table-add-column-after",family:"tables",disposition:"routed",mutates:!0,docRoute:"tables.insertColumn",table:{action:"insert-column-after",op:"insertColumn"},reason:Vs},{id:"table-delete-column",family:"tables",disposition:"routed",mutates:!0,docRoute:"tables.deleteColumn",table:{action:"delete-column",op:"deleteColumn"},reason:Vs},{id:"table-delete",family:"tables",disposition:"routed",mutates:!0,docRoute:"tables.delete",table:{action:"delete-table",op:"delete"},reason:Vs},{id:"table-merge-cells",family:"tables",disposition:"routed",mutates:!0,docRoute:"tables.mergeCells",table:{action:"merge-cells",op:"mergeCells"},reason:Vs},{id:"table-split-cell",family:"tables",disposition:"routed",mutates:!0,docRoute:"tables.splitCell",table:{action:"split-cell",op:"splitCell",requiresCell:!0},reason:Vs},{id:"table-remove-borders",family:"tables",disposition:"routed",mutates:!0,docRoute:"tables.setBorders",table:{action:"remove-borders",op:"setBorders"},reason:Vs},{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:Oz}],Pz=new Map(Q4.map(e=>[e.id,e])),Fz=Q4.map(e=>e.id);function Gu(e){return Pz.get(e)??null}var Nz=["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"],J4=[{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:Nz,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"}],eI=new Map(J4.map(e=>[e.name,e])),Bz=J4.map(e=>e.name);function Ub(e){return eI.get(e)??null}function zz(e){const t=eI.get(e);return t?.disposition==="controller-routed"?t.commandId:null}var jz=".png,.jpg,.jpeg,image/png,image/jpeg",tI=new Set(["image/png","image/jpeg","image/jpg"]),Vz=/\.(png|jpe?g)$/i;function Uz(e){if(!e)return!1;const t=typeof e.type=="string"?e.type.toLowerCase():"";return t?tI.has(t):Vz.test(String(e.name??""))}function nI(e){return new Promise((t,n)=>{const r=new FileReader;r.onload=()=>t(Hz(String(r.result),e)),r.onerror=()=>n(r.error??new Error("image-read-failed")),r.readAsDataURL(e)})}function Hz(e,t){const n=/^data:([^;,]*);base64,/.exec(e);if(!n)return e;const r=n[1].toLowerCase();if(tI.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 $z(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:Gz(n,e)}return nI(e)}async function Gz(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 nI(o?Object.assign(r,{name:o}):r)}function Wz({ownerDocument:e=document,onPick:t,onError:n}={}){const r=e.createElement("input");return r.type="file",r.accept=jz,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(!Uz(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 Kz=(e,t)=>{let n=e.replace(/[^0-9.]/g,"");return n=parseFloat(n),isNaN(n)&&(n=t),n=parseFloat(n),n},qz=(e,t,n)=>{let r,o,i,s=0;n||(n={});const a=()=>{s=n.leading===!1?0:Date.now(),r=null,i=e(...o),r||(o=null)},l=(...u)=>{const d=Date.now();!s&&n.leading===!1&&(s=d);const f=t-(d-s);return o=u,f<=0||f>t?(r&&(clearTimeout(r),r=null),s=d,i=e(...u),r||(o=null)):!r&&n.trailing!==!1&&(r=setTimeout(a,f)),i};return l.cancel=function(){clearTimeout(r),s=0,r=o=null},l};Dt(),vn();var Yz={class:"sd-toolbar-icon"},Xz=["innerHTML"],Zz={__name:"ToolbarButtonIcon",props:{name:{type:String,required:!0},color:{type:String,default:null},icon:{type:String,default:null}},setup(e){const t=e,n=ke(()=>{if(t.name==="color")return{backgroundColor:t.color||"#111111"};if(t.name==="highlight")return{backgroundColor:t.color||"#D6D6D6"}}),r=ke(()=>["color","highlight"].includes(t.name));return(o,i)=>(ge(),Le("div",Yz,[$e("div",{class:Jt(["sd-toolbar-icon__icon",[`sd-toolbar-icon__icon--${t.name}`]]),innerHTML:e.icon},null,10,Xz),r.value?(ge(),Le("div",{key:0,class:"color-bar",style:bn(n.value)},null,4)):ht("",!0)]))}},rI=fn(Zz,[["__scopeId","data-v-d7d79424"]]);Dt(),vn();var Qz=["role","aria-label","aria-disabled"],Jz=["data-item"],ej=["data-item"],tj={key:1,class:"sd-button-label"},nj=["data-item","aria-label"],rj=["innerHTML"],oj={key:2},ij=["onKeydown","id"],sj=["placeholder","onKeydown","id","data-item"],aj=["data-item","innerHTML"],lj={"aria-live":"polite",class:"sd-visually-hidden"},cj={__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}=mr(),o=e,{name:i,active:s,icon:a,label:l,hideLabel:u,iconColor:d,hasCaret:f,splitButton:p,disabled:g,expand:m,inlineTextInputVisible:v,hasInlineTextInput:C,minWidth:w,style:S,attributes:k}=o.toolbarItem,b=ke(()=>!!p?.value&&!!f?.value),T=ke(()=>i?.value??""),L=te(""),z=te(null),{isHighContrastMode:G}=as();Bt(()=>l?.value,Ee=>{document.activeElement!==z.value&&(L.value=Ee==null?"":String(Ee))},{immediate:!0});const U=()=>{C&&kt(()=>{z.value?.focus(),z.value?.select()}),n("buttonClick")},j=Ee=>{g?.value||(Ee?.stopPropagation(),n("mainClick"))},Z=()=>{b.value||U()},R=Ee=>{if(b.value){j(Ee);return}U()},K=Ee=>{o.allowEnterPropagation||Ee.stopPropagation(),R(Ee)},x=Ee=>{const Fe=o.toolbarItem?.nestedOptions?.value??[],Ze=Ee.trim();if(!Ze)return"";const lt=Fe.find(et=>typeof et?.label=="string"&&et.label.toLowerCase()===Ze.toLowerCase());return lt?.label?lt.label:Fe.find(et=>typeof et?.label=="string"&&et.label.toLowerCase().startsWith(Ze.toLowerCase()))?.label??Ze},W=()=>{const Ee=String(L.value??"").trim();let Fe=Ee;if(T.value==="fontSize"){const Ze=Number.parseFloat(Ee);Fe=Ee.match(/^\d+(\.5)?$/)?Ee:Number.isFinite(Ze)?Math.floor(Ze).toString():""}else T.value==="fontFamily"&&(Fe=x(Ee));return Fe?(n("textSubmit",Fe),L.value=Fe,!0):!1},$=Ee=>{const Fe=Ee?.currentTarget;Fe instanceof HTMLInputElement&&(Fe.focus({preventScroll:!0}),Fe.select())},J=Ee=>{requestAnimationFrame(()=>{const Fe=document.getElementById(`inlineTextInput-${Ee}`);Fe instanceof HTMLInputElement&&(Fe.focus({preventScroll:!0}),Fe.select())})},Q=()=>{const Ee=document.querySelector('[role="textbox"][aria-label*="SuperDoc body"], .ProseMirror');return Ee instanceof HTMLElement?(Ee.focus({preventScroll:!0}),!0):!1},Y=()=>{const Ee=r?.$toolbar?.pendingSelectionCapture,Fe=()=>{Ee&&typeof r?.$toolbar?.ui?.selection?.restore=="function"&&r.$toolbar.ui.selection.restore(Ee)};if(Q()){Fe();return}typeof r?.$toolbar?.superdoc?.focus=="function"&&(r.$toolbar.superdoc.focus(),Fe())},Ce=()=>{W()&&Y()},fe=Ee=>{if(W(),Ee.shiftKey){T.value==="fontSize"&&(Ee.preventDefault(),kt(()=>J("fontFamily")));return}if(Ee.preventDefault(),T.value==="fontFamily"){kt(()=>J("fontSize"));return}T.value==="fontSize"&&kt(Y)},ve=ke(()=>S.value?S.value:{minWidth:o.minWidth}),me=ke(()=>m?.value?lr.dropdownCaretUp:lr.dropdownCaretDown);return(Ee,Fe)=>(ge(),Le("div",{class:Jt(["sd-toolbar-item",Je(k).className]),style:bn(ve.value),role:e.isOverflowItem?"menuitem":"button","aria-label":Je(k).ariaLabel,"aria-disabled":Je(g)?"true":void 0,"data-sd-part":"toolbar-item",onClick:Z,onKeydown:Fe[9]||(Fe[9]=ui(Ze=>K(Ze),["enter"])),tabindex:"0"},[$e("div",{class:Jt(["sd-toolbar-button",{"sd-active":Je(s),"sd-disabled":Je(g),narrow:e.isNarrow,wide:e.isWide,split:b.value,"has-inline-text-input":Je(C),"high-contrast":Je(G)}]),"data-item":`btn-${Je(i)||""}`},[b.value?(ge(),Le("div",{key:0,class:"sd-toolbar-button__main","data-item":`btn-${Je(i)||""}-main`,onClick:Fe[0]||(Fe[0]=Ze=>j(Ze))},[Je(a)?(ge(),an(rI,{key:0,color:Je(d),class:"sd-toolbar-icon",icon:Je(a),name:Je(i)},null,8,["color","icon","name"])):ht("",!0),Je(l)&&!Je(u)&&!Je(v)?(ge(),Le("div",tj,zt(Je(l)),1)):ht("",!0)],8,ej)):ht("",!0),b.value?(ge(),Le("div",{key:1,class:"sd-toolbar-button__caret","data-item":`btn-${Je(i)||""}-caret`,"aria-label":`${Je(k).ariaLabel} options`,role:"button"},[$e("div",{class:"sd-dropdown-caret",innerHTML:me.value,style:bn({opacity:Je(g)?.6:1})},null,12,rj)],8,nj)):(ge(),Le(Kt,{key:2},[Je(a)?(ge(),an(rI,{key:0,color:Je(d),class:"sd-toolbar-icon",icon:Je(a),name:Je(i)},null,8,["color","icon","name"])):ht("",!0),Je(l)&&!Je(u)&&(!Je(v)||T.value==="fontFamily")?(ge(),Le("div",{key:1,class:Jt(["sd-button-label",{"sd-visually-hidden":Je(v)&&T.value==="fontFamily"}])},zt(Je(l)),3)):ht("",!0),Je(v)?(ge(),Le("span",oj,[Je(i)==="fontSize"?fa((ge(),Le("input",{key:0,"onUpdate:modelValue":Fe[1]||(Fe[1]=Ze=>L.value=Ze),onKeydown:[ui(Qt(Ce,["stop","prevent"]),["enter"]),Fe[2]||(Fe[2]=ui(Ze=>fe(Ze),["tab"]))],onClick:Fe[3]||(Fe[3]=Qt(Ze=>$(Ze),["stop"])),onFocus:Fe[4]||(Fe[4]=Ze=>$(Ze)),type:"text",class:Jt(["button-text-input button-text-input--font-size",{"high-contrast":Je(G)}]),id:"inlineTextInput-"+Je(i),autocomplete:"off",ref_key:"inlineInput",ref:z},null,42,ij)),[[Ui,L.value]]):fa((ge(),Le("input",{key:1,"onUpdate:modelValue":Fe[5]||(Fe[5]=Ze=>L.value=Ze),placeholder:Je(l),onKeydown:[ui(Qt(Ce,["stop","prevent"]),["enter"]),Fe[6]||(Fe[6]=ui(Ze=>fe(Ze),["tab"]))],onClick:Fe[7]||(Fe[7]=Qt(Ze=>$(Ze),["stop"])),onFocus:Fe[8]||(Fe[8]=Ze=>$(Ze)),type:"text",class:Jt(["button-text-input",{"button-text-input--font-family":T.value==="fontFamily","high-contrast":Je(G)}]),id:"inlineTextInput-"+Je(i),"data-item":T.value==="fontFamily"?`btn-${Je(i)}-input`:void 0,autocomplete:"off",ref_key:"inlineInput",ref:z},null,42,sj)),[[Ui,L.value]])])):ht("",!0),Je(f)?(ge(),Le("div",{key:3,class:"sd-dropdown-caret","data-item":`btn-${Je(i)||""}-toggle`,innerHTML:me.value,style:bn({opacity:Je(g)?.6:1})},null,12,aj)):ht("",!0)],64)),$e("div",lj,zt(`${Je(k).ariaLabel} ${Je(s)?"selected":"unset"}`),1)],10,Jz)],46,Qz))}},Hb=fn(cj,[["__scopeId","data-v-22817fa7"]]);Dt(),vn();var uj={class:"toolbar-separator",role:"separator","aria-label":"Toolbar separator"},dj={__name:"ToolbarSeparator",props:{active:{type:Boolean,default:!1}},emits:["command"],setup(e,{emit:t}){const{isHighContrastMode:n}=as(),r=()=>n.value?"#000":"var(--sd-ui-border, #dbdbdb)";return(o,i)=>(ge(),Le("div",uj,[$e("div",{class:"separator-inner",style:bn({backgroundColor:r()})},null,4)]))}},fj=fn(dj,[["__scopeId","data-v-cb82253a"]]);Dt(),vn();var hj={class:"toolbar-dropdown"},pj=["onClick"],mj={key:0,class:"toolbar-dropdown-option__icon"},gj={class:"toolbar-dropdown-option__label"},jm='button, [href], input, select, textarea, [role="button"], [tabindex]:not([tabindex="-1"])',vj={__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=H1(),i=te(null),s=te(null),a=te({top:"0px",left:"0px",maxHeight:"none"}),l=te([]),u=te(-1),d=ke(()=>!!n.show),f=te(document.fullscreenElement),p=ke(()=>d.value&&f.value?f.value:document.body),g=ke(()=>n.options.some(ae=>ae?.type==="render")),m=ke(()=>!!o.menu),v=ke(()=>typeof n.menuProps!="function"?{}:n.menuProps()||{}),C=ke(()=>{const{class:ae,style:Ie,...He}=v.value;return He}),w=ke(()=>["toolbar-dropdown-menu",v.value.class,{"toolbar-dropdown-menu--render-only":m.value||n.options.length>0&&n.options.every(ae=>ae&&ae.type==="render")}]),S=ke(()=>{const ae=v.value.style||{};return{...n.contentStyle,...ae}}),k=ke(()=>({...S.value,position:"fixed",top:a.value.top,left:a.value.left,maxHeight:a.value.maxHeight,zIndex:2e3})),b=ae=>{r("update:show",ae)},T=()=>{d.value&&b(!1)},L=()=>{if(!i.value)return;const ae=i.value.getBoundingClientRect(),Ie=s.value,He=Ie?.offsetWidth??0,re=Ie?.scrollHeight??Ie?.offsetHeight??0,I=window.innerWidth||document.documentElement.clientWidth||0,se=window.innerHeight||document.documentElement.clientHeight||0,N=8,q=4,O=ae.bottom+q,ee=ae.top-q,ye=Math.max(0,se-O-N),P=Math.max(0,ee-N),B=ye<re&&P>ye,ce=B?P:ye,_e=B?Math.max(N,ee-(re?Math.min(re,ce):ce)):O;let Ae=ae.left;n.placement==="bottom-end"&&(Ae=ae.right-He);const De=Math.max(N,I-He-N);Ae=Math.min(Math.max(N,Ae),De),a.value={top:`${_e}px`,left:`${Ae}px`,maxHeight:`${ce}px`}},z=async()=>{f.value=document.fullscreenElement,d.value&&(await kt(),L())},G=()=>{n.disabled||b(!d.value)},U=ae=>typeof n.nodeProps!="function"?{}:n.nodeProps(ae)||{},j=ae=>{ae?.disabled||ae?.type!=="render"&&(r("select",ae?.key,ae),T())},Z=ae=>ae?.type==="render",R=ae=>!ae?.disabled&&ae?.type!=="render",K=ae=>typeof ae?.icon=="function"||!!ae?.icon,x=ae=>typeof ae?.icon=="function"?ae.icon(ae):ae?.icon||null,W=ae=>ae?typeof ae=="string"?ae.split(/\s+/).includes("sd-selected"):Array.isArray(ae)?ae.some(W):typeof ae=="object"?!!ae["sd-selected"]:!1:!1,$=ae=>W(ae?.props?.class)||W(ae?.class),J=()=>n.options.map((ae,Ie)=>R(ae)?Ie:-1).filter(ae=>ae>=0),Q=()=>{const ae=n.options.findIndex(Ie=>R(Ie)&&$(Ie));return ae>=0?ae:J()[0]??-1},Y=(ae,Ie)=>{if(!ae){delete l.value[Ie];return}l.value[Ie]=ae},Ce=()=>{l.value.forEach((Ie,He)=>{Ie&&Ie.setAttribute("tabindex",He===u.value?"0":"-1")});const ae=l.value[u.value];ae&&typeof ae.focus=="function"&&(ae.focus(),ae.scrollIntoView?.({block:"nearest",inline:"nearest"}))},fe=ae=>{const Ie=J();if(!Ie.length){u.value=-1;return}const He=Ie.indexOf(u.value);if(He<0){u.value=ae>0?Ie[0]:Ie[Ie.length-1];return}const re=(He+ae+Ie.length)%Ie.length;u.value=Ie[re]},ve=()=>{let ae=n.options[u.value];if(!R(ae)){const Ie=J()[0];ae=Ie===void 0?null:n.options[Ie]}ae&&j(ae)},me=lc({name:"ToolbarDropdownRenderOption",props:{option:{type:Object,required:!0}},setup(ae){return()=>typeof ae.option.render!="function"?null:ae.option.render()}}),Ee=lc({name:"ToolbarDropdownOptionIcon",props:{option:{type:Object,required:!0}},setup(ae){return()=>{const Ie=x(ae.option);return typeof Ie=="string"?Ur("span",{innerHTML:Ie}):Ie}}}),Fe=ae=>{if(!d.value)return;const Ie=ae.target;if(!(Ie instanceof Element))return;const He=i.value?.contains(Ie),re=s.value?.contains(Ie);He||re||n.hasOpenChild&&Ie.closest('[data-sd-part="dropdown-menu"]')||T()},Ze=te(null),lt=()=>{const ae=i.value,Ie=document.activeElement;if(ae&&Ie instanceof HTMLElement&&ae.contains(Ie)){Ze.value=Ie;return}Ze.value=ae?.matches?.(jm)?ae:ae?.querySelector(jm)},et=()=>{const ae=Ze.value;if(ae instanceof HTMLElement&&document.contains(ae)){ae.focus();return}const Ie=i.value;if(!Ie)return;const He=Ie.matches?.(jm)?Ie:Ie.querySelector(jm);if(He instanceof HTMLElement){He.focus();return}Ie.setAttribute("tabindex","-1"),Ie.focus()},Et=ae=>{if(!d.value)return;const{key:Ie}=ae;if(["Escape","ArrowDown","ArrowUp","Enter"].includes(Ie)){if(Ie==="Escape"){if(!n.closeOnEscape)return;ae.preventDefault(),T(),kt(()=>{requestAnimationFrame(et)});return}if(!(g.value||m.value)){if(ae.preventDefault(),Ie==="ArrowDown"){fe(1),Ce();return}if(Ie==="ArrowUp"){fe(-1),Ce();return}Ie==="Enter"&&ve()}}};return Bt(d,async ae=>{if(!ae){u.value=-1,l.value=[];return}lt(),await kt(),L(),!(g.value||m.value)&&(u.value=Q(),await kt(),Ce())},{immediate:!0}),Bt(d,ae=>{ae?(document.addEventListener("pointerdown",Fe,!0),document.addEventListener("keydown",Et,!0),window.addEventListener("resize",L),window.addEventListener("scroll",L,!0)):(document.removeEventListener("pointerdown",Fe,!0),document.removeEventListener("keydown",Et,!0),window.removeEventListener("resize",L),window.removeEventListener("scroll",L,!0))},{immediate:!0}),jn(()=>{document.addEventListener("fullscreenchange",z)}),dr(()=>{document.removeEventListener("fullscreenchange",z),document.removeEventListener("pointerdown",Fe,!0),document.removeEventListener("keydown",Et,!0),window.removeEventListener("resize",L),window.removeEventListener("scroll",L,!0)}),(ae,Ie)=>(ge(),Le("div",hj,[$e("div",{ref_key:"triggerRef",ref:i,class:"toolbar-dropdown-trigger","data-sd-part":"dropdown-trigger",onClick:G},[iu(ae.$slots,"trigger",{},void 0,!0)],512),(ge(),an(dl,{to:p.value},[qt(kp,{name:"fade-in-scale-up-transition"},{default:ho(()=>[d.value?(ge(),Le("div",Ts({key:0,ref_key:"menuRef",ref:s,"data-sd-part":"dropdown-menu",class:w.value,style:k.value},C.value),[m.value?iu(ae.$slots,"menu",{key:0},void 0,!0):ht("",!0),(ge(!0),Le(Kt,null,ar(m.value?[]:e.options,(He,re)=>(ge(),Le("div",Ts({key:He.key,ref_for:!0,ref:I=>Y(I,re),class:["toolbar-dropdown-option",[He.class,He.props?.class,{"sd-disabled":He.disabled,"sd-render":Z(He)}]],tabindex:"-1",onClick:I=>j(He)},{ref_for:!0},{...He.props,...U(He)}),[Z(He)?(ge(),an(Je(me),{key:0,option:He},null,8,["option"])):(ge(),Le(Kt,{key:1},[K(He)?(ge(),Le("span",mj,[qt(Je(Ee),{option:He},null,8,["option"])])):ht("",!0),$e("span",gj,zt(He.label),1)],64))],16,pj))),128))],16)):ht("",!0)]),_:3})],8,["to"]))]))}},oI=fn(vj,[["__scopeId","data-v-764d5fd7"]]),iI=e=>{const t=e?.target;t instanceof Element&&(t.closest('input, textarea, [contenteditable="true"]')||e.preventDefault())},xc=(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})};Dt(),vn();var yj={__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=ke(()=>r.toolbarItem.expand.value),i=te(!1),s=ke(()=>({...r.toolbarItem,active:o.value})),a=u=>{if(u!==o.value){if(u){n("buttonClick",r.toolbarItem);return}n("close")}},l=({item:u,argument:d,option:f})=>{n("command",{item:u,argument:d,option:f})};return(u,d)=>(ge(),an(oI,{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:ho(()=>[qt(Hb,{"toolbar-item":s.value},null,8,["toolbar-item"])]),menu:ho(()=>[qt(Hm,{class:"superdoc-toolbar-overflow","toolbar-items":e.overflowItems,"ui-font-family":r.uiFontFamily,"from-overflow":"",onMousedown:Je(iI),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"]))}},bj=fn(yj,[["__scopeId","data-v-975959f9"]]),sI=e=>String(e??"").trim().toLowerCase(),Vm=(e,t)=>{const n=sI(e);if(!n)return-1;for(let r=0;r<t.length;r+=1)if(sI(t[r]).startsWith(n))return r;return-1},wj=(e,t,{autocomplete:n=!0}={})=>{const r=String(e??""),o=Vm(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}},Cj=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},kj=e=>e<=31||e===127,Sj=e=>e===32||e===160||e===65279,_j=e=>Array.from(String(e)).filter(t=>!kj(t.charCodeAt(0))).join(""),Aj=e=>{let t="",n=!1;for(const r of String(e)){if(Sj(r.charCodeAt(0))){n=t.length>0;continue}n&&(t+=" "),n=!1,t+=r}return t},Ij=e=>{const t=String(e??"").split(",")[0]??"",n=_j(t);return Aj(Cj(n)).trim()},Ej=1,Tj=1638,xj=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<Ej?"":String(Math.min(r,Tj))};Dt(),vn();var Rj=["data-item"],Mj=["id","value","disabled","aria-label","aria-expanded","aria-controls","aria-activedescendant","data-item"],Lj=["data-item","aria-label","disabled"],Dj=["innerHTML"],Oj=["id","aria-label"],Pj=["id","aria-selected","aria-label","onMousedown","onMouseenter"],Fj={class:"toolbar-dropdown-option__label"},Nj={class:"sd-button-label sd-font-combobox__legacy-label","aria-hidden":"true"},Bj={__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}=as(),i=te(null),s=te(null),a=te(null),l=te([]),u=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"}),C=ke(()=>n.item.nestedOptions?.value??[]),w=ke(()=>C.value.map(P=>String(P?.label??""))),S=ke(()=>String(n.item.label?.value??"")),k=ke(()=>!!n.item.disabled?.value),b=ke(()=>String(n.item.name?.value??"")),T=ke(()=>n.item.attributes?.value?.ariaLabel??"Font family"),L=ke(()=>u.value?g.value:S.value),z=ke(()=>`sd-${b.value||"combobox"}-listbox-${n.item.id?.value??"default"}`),G=P=>`${z.value}-option-${P}`,U=ke(()=>d.value&&f.value>=0?G(f.value):void 0),j=ke(()=>d.value?lr.dropdownCaretUp:lr.dropdownCaretDown),Z=P=>{const B=String(P??"").trim().toLowerCase();return C.value.find(ce=>String(ce?.label??"").trim().toLowerCase()===B)?.props?.style?.fontFamily||P||n.uiFontFamily},R=ke(()=>n.showPreview?{fontFamily:Z(u.value?g.value:S.value)}:{fontFamily:n.uiFontFamily}),K=()=>{const P=n.item.selectedValue?.value;if(P){const B=C.value.findIndex(ce=>ce?.key===P);if(B>=0)return B}return w.value.findIndex(B=>B.toLowerCase()===S.value.toLowerCase())},x=(P,B)=>{const ce=i.value;if(!(!ce||typeof ce.setSelectionRange!="function"))try{ce.setSelectionRange(P,B)}catch{}},W=()=>{l.value[f.value]?.scrollIntoView?.({block:"nearest",inline:"nearest"})},$=()=>{l.value[f.value]?.focus?.()},J=()=>{const P=s.value;if(!P)return;const B=P.getBoundingClientRect(),ce=a.value,_e=ce?.scrollHeight??ce?.offsetHeight??0,Ae=window.innerHeight||document.documentElement.clientHeight||0,De=window.innerWidth||document.documentElement.clientWidth||0,Ye=8,ot=4,gt=B.bottom+ot,xt=B.top-ot,Tt=Math.max(0,Ae-gt-Ye),$t=Math.max(0,xt-Ye),je=Tt<_e&&$t>Tt,rn=je?$t:Tt,Un=je?Math.max(Ye,xt-(_e?Math.min(_e,rn):rn)):gt,jt=Math.min(Math.max(Ye,B.left),Math.max(Ye,De-B.width-Ye));v.value={top:`${Un}px`,left:`${jt}px`,minWidth:`${B.width}px`,maxHeight:`${rn}px`}},Q=ke(()=>({position:"fixed",top:v.value.top,left:v.value.left,minWidth:v.value.minWidth,maxHeight:v.value.maxHeight,fontFamily:n.uiFontFamily,zIndex:2e3})),Y=P=>{n.item.expand&&typeof n.item.expand=="object"&&"value"in n.item.expand&&(n.item.expand.value=P)},Ce=(P,{focusInput:B=!1,focusOption:ce=!1}={})=>{if(k.value||!C.value.length){Y(!1);return}d.value=!0,Y(!0),f.value=P??-1,B&&(u.value=!0,g.value=S.value,i.value?.focus()),kt(()=>{J(),W(),ce&&$()})},fe=({syncItem:P=!0}={})=>{d.value=!1,f.value=-1,P&&Y(!1)},ve=()=>{fe(),u.value=!1,p.value="",g.value=S.value},me=()=>{k.value||(d.value||r("item-clicked"),u.value=!0,p.value="",g.value=S.value,kt(()=>x(0,g.value.length)))},Ee=P=>{if(k.value)return;const B=document.activeElement===i.value;if(r("item-clicked"),u.value=!0,B||(p.value="",g.value=S.value,P.preventDefault(),i.value?.focus({preventScroll:!0}),x(0,S.value.length)),!d.value){const ce=K();Ce(ce>=0?ce:0)}},Fe=P=>{const B=P.relatedTarget;B instanceof Node&&s.value?.contains(B)||B instanceof Node&&a.value?.contains(B)||ve()},Ze=P=>{if(m.value)return;const B=P.target,ce=B.value,_e=typeof B.selectionStart=="number"?B.selectionStart:ce.length,Ae=typeof B.selectionEnd=="number"?B.selectionEnd:_e,De=typeof P.inputType=="string"&&P.inputType.startsWith("delete"),Ye=_e===ce.length&&Ae===ce.length;p.value=ce;const ot=wj(ce,w.value,{autocomplete:!De&&Ye});g.value=ot.display,B.value=ot.display,ot.display===ce&&!Ye?x(_e,Ae):x(ot.selectionStart,ot.selectionEnd),d.value&&(f.value=ot.matchIndex,kt(W))},lt=P=>{m.value=!1,Ze(P)},et=P=>{if(!C.value.length)return;const B=C.value.length,ce=f.value<0?P>0?-1:0:f.value;f.value=(ce+P+B)%B,kt(W)},Et=(P,B)=>{r("item-clicked"),r("command",{item:n.item,argument:P,option:B}),B&&(n.item.selectedValue.value=B.key)},ae=P=>{P&&(Et(P.value??P.label,P),u.value=!1,p.value="",g.value=P.label,fe())},Ie=()=>{if(d.value&&f.value>=0)return ae(C.value[f.value]),!0;const P=Vm(p.value,w.value);if(P>=0)return ae(C.value[P]),!0;const B=n.normalizeValue(p.value);return B?(Et(B,null),u.value=!1,p.value="",g.value=B,fe(),!0):!1},He=P=>{if(!(P.isComposing||m.value||P.keyCode===229)&&!(P.ctrlKey||P.metaKey||P.altKey))switch(P.key){case"ArrowDown":if(P.preventDefault(),d.value)$();else{const B=Vm(p.value,w.value),ce=B>=0?B:K();Ce(ce>=0?ce:0,{focusOption:!0})}break;case"ArrowUp":if(P.preventDefault(),d.value)$();else{const B=Vm(p.value,w.value),ce=B>=0?B:K();Ce(ce>=0?ce:C.value.length-1,{focusOption:!0})}break;case"Enter":P.preventDefault(),Ie()&&r("editor-handoff"),i.value?.blur();break;case"Tab":P.preventDefault(),Ie(),fe(),i.value?.blur(),r("tab-out",P);break;case"Escape":P.preventDefault(),ve(),kt(()=>i.value?.focus());break;default:break}},re=P=>{if(P.preventDefault(),!k.value)if(r("item-clicked"),d.value)fe(),i.value?.focus();else{const B=K();Ce(B>=0?B:0,{focusOption:!0})}},I=(P,B)=>{P.preventDefault(),ae(B),r("editor-handoff"),i.value?.blur()},se=P=>{f.value=P},N=P=>{if(!(P.ctrlKey||P.metaKey||P.altKey))switch(P.key){case"ArrowDown":P.preventDefault(),et(1),$();break;case"ArrowUp":P.preventDefault(),et(-1),$();break;case"Enter":P.preventDefault(),f.value>=0&&(ae(C.value[f.value]),r("editor-handoff"));break;case"Escape":P.preventDefault(),ve(),kt(()=>i.value?.focus());break;case"Tab":P.preventDefault(),f.value>=0?ae(C.value[f.value]):fe(),r("tab-out",{shiftKey:P.shiftKey,target:i.value});break;default:break}},q=P=>{if(!d.value)return;const B=P.target;B instanceof Element&&(s.value?.contains(B)||a.value?.contains(B)||ve())};Bt(d,P=>{P?(document.addEventListener("pointerdown",q,!0),window.addEventListener("resize",J),window.addEventListener("scroll",J,!0)):(document.removeEventListener("pointerdown",q,!0),window.removeEventListener("resize",J),window.removeEventListener("scroll",J,!0),l.value=[])},{immediate:!0}),dr(()=>{document.removeEventListener("pointerdown",q,!0),window.removeEventListener("resize",J),window.removeEventListener("scroll",J,!0)});const O=(P,B)=>{if(!P){delete l.value[B];return}l.value[B]=P},ee=P=>P===f.value,ye=P=>P?.key&&P.key===n.item.selectedValue?.value;return Bt(S,P=>{u.value||(g.value=P)}),Bt(()=>!!n.item.expand?.value,P=>{if(P&&!d.value){const B=K();Ce(B>=0?B:0,{focusInput:!0});return}!P&&d.value&&fe({syncItem:!1})}),(P,B)=>(ge(),Le("div",{ref_key:"rootRef",ref:s,class:Jt(["sd-font-combobox sd-toolbar-split-field",{"sd-disabled":k.value,"high-contrast":Je(o)}]),style:bn(n.item.style?.value),"data-item":`btn-${b.value}`},[$e("span",{class:"sd-font-combobox__field sd-toolbar-split-field__main",onMousedown:Ee},[$e("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:k.value,"aria-label":T.value,"aria-expanded":d.value?"true":"false","aria-controls":z.value,"aria-activedescendant":U.value,"aria-haspopup":"listbox","aria-autocomplete":"both","data-item":`btn-${b.value}-input`,onFocus:me,onBlur:Fe,onInput:Ze,onKeydown:He,onCompositionstart:B[0]||(B[0]=ce=>m.value=!0),onCompositionend:lt},null,44,Mj)],32),$e("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:k.value,onMousedown:re},[$e("span",{class:"sd-dropdown-caret",innerHTML:j.value},null,8,Dj)],40,Lj),(ge(),an(dl,{to:"body"},[d.value?(ge(),Le("div",{key:0,ref_key:"popupRef",ref:a,role:"listbox",id:z.value,"aria-label":T.value,class:Jt(["sd-font-combobox__listbox",{"high-contrast":Je(o)}]),style:bn(Q.value)},[(ge(!0),Le(Kt,null,ar(C.value,(ce,_e)=>(ge(),Le("div",Ts({key:ce.key,ref_for:!0,ref:Ae=>O(Ae,_e),id:G(_e),role:"option",tabindex:"-1",class:["toolbar-dropdown-option sd-font-combobox__option",{"sd-active":ee(_e),"sd-selected":ye(ce)}],"aria-selected":ye(ce)?"true":"false","aria-label":`${T.value} - ${ce.label}`},{ref_for:!0},ce.props,{onMousedown:Ae=>I(Ae,ce),onMouseenter:Ae=>se(_e),onKeydown:N}),[$e("span",Fj,zt(ce.label),1)],16,Pj))),128))],14,Oj)):ht("",!0)])),$e("span",Nj,zt(S.value),1)],14,Rj))}},aI=fn(Bj,[["__scopeId","data-v-53e0af20"]]);Dt();var zj={__name:"FontFamilyCombobox",props:{item:{type:Object,required:!0},uiFontFamily:{type:String,default:"Arial, Helvetica, sans-serif"}},emits:["command","item-clicked","tab-out","editor-handoff"],setup(e,{emit:t}){const n=e,r=t;return(o,i)=>(ge(),an(aI,{item:n.item,"ui-font-family":n.uiFontFamily,"show-preview":!0,"normalize-value":Je(Ij),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"]))}};Dt();var jj={__name:"FontSizeCombobox",props:{item:{type:Object,required:!0},uiFontFamily:{type:String,default:"Arial, Helvetica, sans-serif"}},emits:["command","item-clicked","tab-out","editor-handoff"],setup(e,{emit:t}){const n=e,r=t;return(o,i)=>(ge(),an(aI,{item:n.item,"ui-font-family":n.uiFontFamily,"show-preview":!1,"normalize-value":Je(xj),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"]))}};Dt(),vn();var Vj=["data-placement"],Uj=2500,Hj=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=$1(),r=te(!1),o=te(null),i=te(null),s=te({top:"0px",left:"0px"}),a=te("top");let l=null,u=null,d=null;const f=ke(()=>["sd-tooltip-content",n.class]),p=ke(()=>({...t.contentStyle,...n.style||{},position:"fixed",top:s.value.top,left:s.value.left,zIndex:2100})),g=()=>{l&&(window.clearTimeout(l),l=null)},m=()=>{u&&(window.clearTimeout(u),u=null)},v=()=>{d&&(window.clearTimeout(d),d=null)},C=()=>{v(),d=window.setTimeout(()=>{d=null,b()},Uj)},w=(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(($,J)=>$+(parseFloat(x[J])||0),W):K==="width"?R.offsetWidth:R.offsetHeight},S=()=>{if(!o.value||!i.value)return;const R=o.value.getBoundingClientRect(),K=w(i.value,"width"),x=w(i.value,"height"),W=window.innerWidth||document.documentElement.clientWidth||0,$=document.documentElement.clientHeight||window.innerHeight||0,J=8,Q=10;let Y=R.left+R.width/2-K/2;Y=Math.max(J,Math.min(Y,W-K-J));const Ce=R.top-x-Q,fe=R.bottom+Q,ve=Ce>=J,me=fe+x<=$-J,Ee=R.top-Q,Fe=$-R.bottom-Q;ve?a.value="top":me?a.value="bottom":a.value=Ee>=Fe?"top":"bottom";const Ze=a.value==="top"?Ce:fe,lt=Math.min(J,Math.max(0,$-x)),et=Math.max(lt,$-x-J);s.value={top:`${Math.max(lt,Math.min(Ze,et))}px`,left:`${Y}px`}},k=async()=>{t.disabled||(g(),m(),!r.value&&(r.value=!0,C(),await kt(),S()))},b=()=>{m(),g(),v(),r.value&&(r.value=!1)},T=()=>{if(g(),m(),!r.value){if(t.delay===0){k();return}u=window.setTimeout(()=>{u=null,k()},t.delay)}},L=()=>{if(m(),g(),!!r.value){if(t.duration===0){b();return}l=window.setTimeout(()=>{l=null,b()},t.duration)}},z=()=>{t.trigger==="hover"&&T()},G=()=>{t.trigger==="hover"&&L()},U=()=>{m(),g()},j=()=>{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))}),dr(()=>{m(),g(),v(),window.removeEventListener("resize",S),window.removeEventListener("scroll",S,!0),document.removeEventListener("keydown",Z,!0)}),(R,K)=>(ge(),Le(Kt,null,[$e("span",{ref_key:"triggerRef",ref:o,class:"sd-tooltip-trigger",onMouseenter:z,onMouseleave:G,onFocusin:z,onFocusout:G},[iu(R.$slots,"trigger",{},void 0,!0)],544),(ge(),an(dl,{to:"body"},[qt(kp,{name:"fade-in-scale-up-transition"},{default:ho(()=>[r.value&&!e.disabled?(ge(),Le("div",{key:0,ref_key:"contentRef",ref:i,class:Jt(f.value),style:bn(p.value),"data-placement":a.value,onMouseenter:U,onMouseleave:j},[K[0]||(K[0]=$e("span",{class:"sd-tooltip-arrow","aria-hidden":"true"},null,-1)),iu(R.$slots,"default",{},void 0,!0)],46,Vj)):ht("",!0)]),_:3})]))],64))}}),Um=fn(Hj,[["__scopeId","data-v-88d296cd"]]);Dt(),vn();var $j=["onKeydown","tabindex","data-item-id"],Gj={key:0},Wj={key:0},Kj={key:0},qj={key:0},Yj={key:0},Xj={__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}=mr(),o=te([]),i=te(null),s=e,a=te(null),{isHighContrastMode:l}=as(),u=window.matchMedia("(max-width: 768px)").matches,d=ke(()=>s.position==="left"?{minWidth:s.compactSideGroups?"auto":"120px",justifyContent:"flex-start"}:s.position==="right"?{minWidth:s.compactSideGroups?"auto":"120px",justifyContent:"flex-end"}:{flexGrow:u?0:1,justifyContent:"center"}),f=ae=>ae.type==="button",p=ae=>ae.type==="dropdown",g=ae=>ae.type==="dropdown"&&ae.name?.value==="fontFamily",m=ae=>ae.type==="dropdown"&&ae.name?.value==="fontSize",v=ae=>ae.type==="separator",C=ae=>ae.type==="overflow",w=ae=>!!ae.nestedOptions?.value?.length,S=ae=>{if(!ae)return!1;const Ie=ae.expand;return typeof Ie=="object"&&Ie!==null&&"value"in Ie?!!Ie.value:!!Ie},k=(ae,Ie)=>{ae?.expand&&(ae.expand.value=Ie)},b=(ae,Ie=void 0)=>{if(ae.disabled.value)return;if(C(ae)){const re=!S(ae);re&&z(),k(ae,re),a.value=re?ae:null,n("item-clicked");return}if(p(ae))return;a.value&&p(a.value)&&S(a.value)&&z(),n("item-clicked");const He=Ie!==void 0?Ie:ae.argument?.value;n("command",He===void 0?{item:ae}:{item:ae,argument:He})},T=(ae,Ie)=>{ae.disabled.value||(a.value=null,n("command",{item:ae,argument:Ie}))},L=ae=>{if(ae.disabled.value)return;z();const Ie=ae.splitButtonCommand,He=ae.command,re=Ie||He;if(!re)return;const I={...ae,command:re};n("item-clicked"),n("command",{item:I})},z=()=>{const ae=r?.$toolbar?.toolbarItems||[],Ie=r?.$toolbar?.overflowItems||[],He=[...ae,...Ie];(He.length?He:s.toolbarItems).forEach(re=>{const I=C(re)&&!s.fromOverflow;(p(re)||I)&&k(re,!1)}),a.value=null},G=(ae,Ie)=>{z();const He=ae.dropdownValueKey.value?Ie[ae.dropdownValueKey.value]:Ie.label;n("command",{item:ae,argument:He,option:Ie}),ae.selectedValue.value=Ie.key,ae.restoreEditorFocus&&xc(r?.$toolbar)},U=ae=>{n("command",ae)},j=()=>{z(),n("item-clicked")},Z=()=>{const ae=document.querySelector('[role="textbox"][aria-label*="SuperDoc body"], .ProseMirror');return ae instanceof HTMLElement?(ae.focus({preventScroll:!0}),!0):!1},R=()=>{const ae=r?.$toolbar?.pendingSelectionCapture,Ie=()=>{ae&&typeof r?.$toolbar?.ui?.selection?.restore=="function"&&r.$toolbar.ui.selection.restore(ae)};if(Z()){Ie();return}typeof r?.$toolbar?.superdoc?.focus=="function"&&(r.$toolbar.superdoc.focus(),Ie())},K=ae=>!(ae instanceof HTMLElement)||ae.classList.contains("sd-disabled")?null:ae.querySelector("input:not([disabled]), textarea:not([disabled]), select:not([disabled])")||ae.querySelector('button:not([disabled]), [role="button"]:not(.sd-disabled), [tabindex]:not([tabindex="-1"])'),x=(ae,Ie)=>{const He=ae?.target?.closest?.(".sd-toolbar-item-ctn");if(!(He instanceof HTMLElement))return!1;let re=Ie>0?He.nextElementSibling:He.previousElementSibling;for(;re;){const I=K(re);if(I instanceof HTMLElement)return He.setAttribute("tabindex","-1"),re.setAttribute("tabindex","0"),I.focus(),!0;re=Ie>0?re.nextElementSibling:re.previousElementSibling}return!1},W=ae=>{z();const Ie=ae?.shiftKey?-1:1;x(ae,Ie)||R()},$=ae=>{if(z(),ae?.shiftKey){x(ae,-1)||R();return}R()},J=()=>{R()},Q=ae=>ae.nestedOptions?.value?.length?ae.nestedOptions.value.map(Ie=>{const He=Ie?.type!=="render"&&ae.selectedValue.value===Ie.key;return{...Ie,props:{...Ie.props,class:He?"sd-selected":""}}}):[],Y=(ae,Ie)=>({role:"menuitem","aria-label":`${Ie.attributes.value.ariaLabel} - ${ae.label}`}),Ce=ae=>{const Ie=ae.target,He=ae.target.closest(".sd-toolbar-item-ctn").nextElementSibling;He&&(Ie.setAttribute("tabindex","-1"),He.setAttribute("tabindex","0"),He.focus())},fe=ae=>{const Ie=ae.target,He=ae.target.closest(".sd-toolbar-item-ctn").previousElementSibling;He&&(Ie.setAttribute("tabindex","-1"),He.setAttribute("tabindex","0"),He.focus())},ve=ae=>{const Ie=ae.target.closest(".button-group").nextElementSibling;if(Ie)Ie.setAttribute("tabindex","0"),Ie.focus();else{const He=document.querySelector(".ProseMirror");He&&He.focus()}},me=ae=>{const Ie=ae.target.closest(".button-group").previousElementSibling;Ie&&(Ie.setAttribute("tabindex","0"),Ie.focus())},Ee=ae=>{if(!ae.disabled.value){if(p(ae)){lt(!S(ae),ae);return}b(ae)}},Fe=(ae,Ie)=>{const He=ae.target.nodeName==="INPUT"||ae.target.nodeName==="TEXTAREA",re=Ie.name.value==="fontSize"||Ie.name.value==="fontFamily";if(!(He&&re)&&["Enter"," ","Spacebar","Escape","ArrowRight","ArrowLeft","Tab"].includes(ae.key))switch(ae.preventDefault(),ae.key){case"Enter":case" ":case"Spacebar":Ee(Ie);break;case"Escape":z();break;case"ArrowRight":z(),Ce(ae);break;case"ArrowLeft":z(),fe(ae);break;case"Tab":ae.shiftKey?me(ae):ve(ae);break;default:break}},Ze=ae=>{const Ie=o.value.find(He=>!He.classList.contains("sd-disabled"));Ie&&(Ie.setAttribute("tabindex","0"),Ie.focus())},lt=(ae,Ie)=>{if(n("item-clicked"),!ae){z(),n("dropdown-update-show",!1);return}z(),a.value=Ie,k(Ie,!0),n("dropdown-update-show",!0)},et=ae=>{if(!a.value)return;const Ie=ae.target;Ie instanceof Element&&(Ie.closest('[data-sd-part="dropdown-menu"]')||i.value?.contains(Ie)||z())};return Bt(()=>S(a.value),ae=>{ae?document.addEventListener("pointerdown",et,!0):document.removeEventListener("pointerdown",et,!0)},{immediate:!0}),dr(()=>{document.removeEventListener("pointerdown",et,!0)}),(ae,Ie)=>(ge(),Le("div",{style:bn(d.value),class:"button-group",role:"group",onFocus:Ze,ref_key:"buttonGroupRef",ref:i},[(ge(!0),Le(Kt,null,ar(e.toolbarItems,(He,re)=>(ge(),Le("div",{key:He.id.value,class:Jt([{narrow:He.isNarrow.value,wide:He.isWide.value,"sd-disabled":He.disabled.value},"sd-toolbar-item-ctn"]),onKeydown:I=>Fe(I,He),ref_for:!0,ref_key:"toolbarItemRefs",ref:o,tabindex:re===0?0:-1,"data-item-id":He.id.value},[v(He)?(ge(),an(fj,{key:0,style:{width:"20px"}})):ht("",!0),g(He)&&w(He)?(ge(),an(Um,{key:1,trigger:"hover",disabled:!He.tooltip?.value,"content-style":{fontFamily:s.uiFontFamily}},{trigger:ho(()=>[qt(zj,{item:He,"ui-font-family":s.uiFontFamily,class:"sd-toolbar-button sd-editor-toolbar-dropdown",onCommand:U,onItemClicked:j,onTabOut:Ie[0]||(Ie[0]=I=>W(I)),onEditorHandoff:J},null,8,["item","ui-font-family"])]),default:ho(()=>[$e("div",null,[rs(zt(He.tooltip)+" ",1),He.disabled.value?(ge(),Le("span",Gj,"(disabled)")):ht("",!0)])]),_:2},1032,["disabled","content-style"])):m(He)&&w(He)?(ge(),an(Um,{key:2,trigger:"hover",disabled:!He.tooltip?.value,"content-style":{fontFamily:s.uiFontFamily}},{trigger:ho(()=>[qt(jj,{item:He,"ui-font-family":s.uiFontFamily,class:"sd-toolbar-button sd-editor-toolbar-dropdown",onCommand:U,onItemClicked:j,onTabOut:Ie[1]||(Ie[1]=I=>$(I)),onEditorHandoff:J},null,8,["item","ui-font-family"])]),default:ho(()=>[$e("div",null,[rs(zt(He.tooltip)+" ",1),He.disabled.value?(ge(),Le("span",Wj,"(disabled)")):ht("",!0)])]),_:2},1032,["disabled","content-style"])):p(He)&&He.nestedOptions?.value?.length?(ge(),an(oI,{key:3,options:Q(He),disabled:He.disabled.value,show:S(He),"content-style":{fontFamily:s.uiFontFamily},placement:"bottom-start",class:"sd-toolbar-button sd-editor-toolbar-dropdown",onSelect:(I,se)=>G(He,se),"onUpdate:show":I=>lt(I,He),style:bn(He.dropdownStyles.value),"menu-props":()=>({role:"menu",style:{fontFamily:s.uiFontFamily},class:["sd-toolbar-dropdown-menu",{"high-contrast":Je(l)}]}),"node-props":I=>Y(I,He)},{trigger:ho(()=>[qt(Um,{trigger:"hover",disabled:!He.tooltip?.value,"content-style":{fontFamily:s.uiFontFamily}},{trigger:ho(()=>[qt(Hb,{"toolbar-item":He,disabled:He.disabled.value,"allow-enter-propagation":!0,onTextSubmit:I=>T(He,I),onMainClick:I=>L(He)},null,8,["toolbar-item","disabled","onTextSubmit","onMainClick"])]),default:ho(()=>[$e("div",null,[rs(zt(He.tooltip)+" ",1),He.disabled.value?(ge(),Le("span",Kj,"(disabled)")):ht("",!0)])]),_:2},1032,["disabled","content-style"])]),_:2},1032,["options","disabled","show","content-style","onSelect","onUpdate:show","style","menu-props","node-props"])):f(He)?(ge(),an(Um,{key:4,trigger:"hover",class:"sd-editor-toolbar-tooltip","content-style":{fontFamily:s.uiFontFamily}},{trigger:ho(()=>[qt(Hb,{"toolbar-item":He,"is-overflow-item":e.fromOverflow,onTextSubmit:I=>T(He,I),onButtonClick:I=>b(He)},null,8,["toolbar-item","is-overflow-item","onTextSubmit","onButtonClick"])]),default:ho(()=>[He.tooltip?(ge(),Le("div",qj,[rs(zt(He.tooltip)+" ",1),He.disabled.value?(ge(),Le("span",Yj,"(disabled)")):ht("",!0)])):ht("",!0)]),_:2},1032,["content-style"])):ht("",!0),C(He)&&e.overflowItems.length?(ge(),an(bj,{key:5,"toolbar-item":He,"ui-font-family":s.uiFontFamily,onButtonClick:I=>b(He),"overflow-items":e.overflowItems,onClose:z,onCommand:Ie[2]||(Ie[2]=I=>n("command",I))},null,8,["toolbar-item","ui-font-family","onButtonClick","overflow-items"])):ht("",!0)],42,$j))),128))],36))}},Hm=fn(Xj,[["__scopeId","data-v-8d7a9de1"]]),Zj=[["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"]],Qj=Zj.map(([e,t])=>({label:e,key:e,props:{style:{fontFamily:`${e}, ${t}`},"data-item":"btn-fontFamily-option"}}));function Jj(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 eV=[{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},$b={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"},lI={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"},cI=Object.values(lI),AW=[...new Set([...Object.values($b),...cI])],tV=new Set(["link"]),IW=new Set(Object.keys($b).filter(e=>!tV.has(e)));Dt(),vn();var nV="Arial, Helvetica, sans-serif",rV={__name:"Toolbar",emits:["command","toggle","select"],setup(e,{emit:t}){const{proxy:n}=mr();let r=te(1);const o=te(0),i=te(!1);let s=null,a=null;const l=ke(()=>{const G=n?.$toolbar?.config?.uiDisplayFallbackFont;return typeof G=="string"&&G.trim()?G.trim():nV}),u=n.$toolbar.config?.toolbarGroups?.includes("left"),d=n.$toolbar.config?.toolbarGroups?.includes("right"),f=n.$toolbar.config?.toolbarButtonsExclude||[],p=G=>(o.value,n.$toolbar.getToolbarItemByGroup(G).filter(U=>!f.includes(U.name.value))),g=()=>{i.value=n.$toolbar.getAvailableWidth()<=ah.lg},v=qz(async()=>{await n.$toolbar.onToolbarResize(),g(),r.value+=1},300),C=()=>{r.value+=1},w=()=>{o.value+=1};function S(){window.removeEventListener("resize",v),n.$toolbar.off?.("toolbar-items-changed",C),n.$toolbar.off?.("toolbar-state-change",w),s?.disconnect(),s=null}function k(){S(),window.addEventListener("resize",v),n.$toolbar.on?.("toolbar-items-changed",C),n.$toolbar.on?.("toolbar-state-change",w),typeof ResizeObserver<"u"&&n.$toolbar.config?.responsiveToContainer&&n.$toolbar.toolbarContainer&&(s=new ResizeObserver(()=>{v()}),s.observe(n.$toolbar.toolbarContainer)),g()}jn(k),hv(k),pv(S),dr(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:G,argument:U,option:j})=>{L(),n.$toolbar.emitCommand({item:G,argument:U,option:j})},L=()=>{const G=n.$toolbar.activeEditor;if(!G)return;const U=n.$toolbar.pendingSelectionCapture??a;if(U&&typeof n.$toolbar.ui?.selection?.restore=="function"){n.$toolbar.ui.selection.restore(U);return}G.commands?.restoreSelection?.()},z=G=>{b(),iI(G)};return(G,U)=>(ge(),Le("div",{class:"superdoc-toolbar",key:Je(r),role:"toolbar","aria-label":"Toolbar","data-sd-part":"toolbar","data-editor-ui-surface":"",onMousedown:z},[Je(u)?(ge(),an(Hm,{key:0,tabindex:"0","toolbar-items":p("left"),"overflow-items":Je(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"])):ht("",!0),qt(Hm,{tabindex:"0","toolbar-items":p("center"),"overflow-items":Je(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"]),Je(d)?(ge(),an(Hm,{key:1,tabindex:"0","toolbar-items":p("right"),"overflow-items":Je(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"])):ht("",!0)],32))}},oV=fn(rV,[["__scopeId","data-v-ed19716b"]]),iV=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"}}};Dt();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),u=te(e.attributes||{}),d=!!e.disabled,f=te(e.disabled),p=te(!1),g=te(!1),m=te(e.style),v=te(e.isNarrow),C=te(e.isWide),w=te(e.minWidth),S=te(e.layoutWidth),k=te(e.suppressActiveHighlight||!1),b=te(e.argument),T=te(null),L=te(null),z=te(e.iconColor),G=te(e.hasCaret),U=te(!!e.splitButton),j=e.splitButtonCommand,Z=!!e.restoreEditorFocus,R=te(e.dropdownStyles),K=te(e.tooltip),x=te(e.tooltipVisible),W=te(e.tooltipTimeout),$=te(e.defaultLabel),J=te(e.label),Q=te(e.hideLabel),Y=te(e.inlineTextInputVisible),Ce=te(e.hasInlineTextInput),fe=te(e.markName),ve=te(e.labelAttr),me=te(e.selectedValue),Ee=te(e.dropdownValueKey),Fe=te(e.inputRef||null),Ze=te([]);if(e.options){if(!Array.isArray(e.options))throw new Error("Invalid toolbar item options - "+e.options);let se=0;for(let N=0;N<e.options.length;N+=1){const q=e.options[N];(!q||typeof q!="object")&&(se+=1)}if(se)throw new Error(`Toolbar item options must all be objects - ${e.name}. ${se} row(s) are not, so this item is skipped.`);Ze.value?.push(...e.options)}const lt=(se={},...N)=>{Ie(se,...N),!k.value&&(p.value=!0)},et=()=>{He(),p.value=!1},Et=se=>{f.value=se},ae=()=>{f.value=d},Ie=e.onActivate||(()=>null),He=e.onDeactivate||(()=>null),re=()=>{const se={};return Object.keys(I).forEach(N=>{I[N].value!==void 0&&(se[N]=I[N].value)}),se},I={id:t,name:r,type:n,command:o,noArgumentCommand:i,icon:s,tooltip:K,group:a,attributes:u,disabled:f,active:p,expand:g,nestedOptions:Ze,style:m,isNarrow:v,isWide:C,minWidth:w,layoutWidth:S,argument:b,parentItem:L,iconColor:z,hasCaret:G,splitButton:U,splitButtonCommand:j,dropdownStyles:R,tooltipVisible:x,tooltipTimeout:W,defaultLabel:$,label:J,hideLabel:Q,inlineTextInputVisible:Y,hasInlineTextInput:Ce,restoreEditorFocus:Z,markName:fe,labelAttr:ve,childItem:T,allowWithoutEditor:l,dropdownValueKey:Ee,selectedValue:me,inputRef:Fe};return{...I,initiallyDisabled:d,unref:re,activate:lt,deactivate:et,setDisabled:Et,resetDisabled:ae,onActivate:Ie,onDeactivate:He}};Dt(),vn();var sV=["onClick","innerHTML","aria-label","onKeydown"],aV={__name:"AlignmentButtons",emits:["select"],setup(e,{emit:t}){const{isHighContrastMode:n}=as(),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())},u=(d,f)=>{switch(d.key){case"ArrowLeft":l(f);break;case"ArrowRight":a(f);break;case"Enter":s(i[f].key);break;default:break}};return jn(()=>{const d=o.value[0];d&&(d.setAttribute("tabindex","0"),d.focus())}),(d,f)=>(ge(),Le("div",{class:Jt(["alignment-buttons",{"high-contrast":Je(n)}])},[(ge(),Le(Kt,null,ar(i,(p,g)=>$e("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:Qt(m=>u(m,g),["prevent"])},null,40,sV)),64))],2))}},lV=fn(aV,[["__scopeId","data-v-13e5f7a4"]]);Dt(),vn();var cV=["onClick","innerHTML","aria-label","onKeydown"],uV={__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}=as(),r=t,o=e,i=te([]),s=ke(()=>({width:`${o.iconSize}px`,height:`${o.iconSize}px`})),a=f=>{r("select",f)},l=f=>{if(f===i.value.length-1)return;const p=i.value[f+1];p&&(p.setAttribute("tabindex","0"),p.focus())},u=f=>{if(f===0)return;const p=i.value[f-1];p&&(p.setAttribute("tabindex","0"),p.focus())},d=(f,p)=>{switch(f.key){case"ArrowLeft":u(p);break;case"ArrowRight":l(p);break;case"Enter":a(o.buttons[p].key);break;default:break}};return jn(()=>{const f=i.value[0];f&&(f.setAttribute("tabindex","0"),f.focus())}),(f,p)=>(ge(),Le("div",{class:Jt(["style-buttons-list",{"high-contrast":Je(n)}])},[(ge(!0),Le(Kt,null,ar(o.buttons,(g,m)=>(ge(),Le("div",{key:g.key,class:Jt(["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:Qt(v=>d(v,m),["prevent"])},null,46,cV))),128))],2))}},uI=fn(uV,[["__scopeId","data-v-44f37ff6"]]),dV=[{key:"disc",icon:lr.bulletListDisc,ariaLabel:"Opaque circle"},{key:"circle",icon:lr.bulletListCircle,ariaLabel:"Outline circle"},{key:"square",icon:lr.bulletListSquare,ariaLabel:"Opaque square"}],fV=[{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)"}];Dt(),vn();var hV=["onClick","onKeydown"],pV={class:"document-mode-column icon-column"},mV=["innerHTML"],gV={class:"document-mode-column text-column"},vV={class:"document-mode-type"},yV={class:"document-mode-description"},bV={__name:"DocumentMode",props:{options:{type:Array}},emits:["select"],setup(e,{emit:t}){const n=t,r=te([]),{isHighContrastMode:o}=as(),i=e,s=d=>{n("select",d)},a=d=>{if(d===r.value.length-1)return;const f=r.value[d+1];f&&(f.setAttribute("tabindex","0"),f.focus())},l=d=>{if(d===0)return;const f=r.value[d-1];f&&(f.setAttribute("tabindex","0"),f.focus())},u=(d,f)=>{switch(d.key){case"ArrowDown":a(f);break;case"ArrowUp":l(f);break;case"Enter":s(i.options[f]);break;default:break}};return jn(()=>{r.value[0].setAttribute("tabindex","0"),r.value[0].focus()}),(d,f)=>(ge(),Le("div",{class:Jt(["document-mode",{"high-contrast":Je(o)}])},[(ge(!0),Le(Kt,null,ar(e.options,(p,g)=>(ge(),Le("div",{class:Jt(["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:Qt(m=>u(m,g),["prevent"])},[$e("div",pV,[$e("div",{class:"icon-column__icon",innerHTML:p.icon},null,8,mV)]),$e("div",gV,[$e("div",vV,zt(p.label),1),$e("div",yV,zt(p.description),1)])],42,hV))),256))],2))}},wV=fn(bV,[["__scopeId","data-v-bee14d7a"]]);Dt(),vn();var CV={class:"linked-style-buttons","data-editor-ui-surface":""},kV=["onClick","onKeydown","aria-label"],SV={__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}},u=p=>p?.name??p?.id??"",d=p=>{const g=p?.preview?.css;return g&&typeof g=="object"?g:void 0},f=()=>{r.value[0]&&(r.value[0].setAttribute("tabindex","0"),r.value[0].focus())};return jn(f),Bt(()=>o.styles.length,async(p,g)=>{p===0||g!==0||(await kt(),f())}),(p,g)=>(ge(),Le("div",CV,[(ge(!0),Le(Kt,null,ar(o.styles,(m,v)=>(ge(),Le("div",{key:m.id??v,class:Jt(["style-item",{selected:e.selectedOption===m.id}]),onClick:C=>i(m),onKeydown:C=>l(C,v,m),"aria-label":`Linked style - ${m.id??u(m)}`,ref_for:!0,ref_key:"styleRefs",ref:r},[$e("div",{class:"style-name","data-item":"btn-linkedStyles-option",style:bn(d(m))},zt(u(m)),5)],42,kV))),128))]))}},_V=fn(SV,[["__scopeId","data-v-74c8924b"]]);Dt(),vn();var AV=["placeholder"],IV={class:"sd-ai-writer__footer"},EV={key:0,class:"sd-ai-writer__error",role:"alert"},TV=["disabled"],xV="https://sd-dev-express-gateway-i6xtm.ondigitalocean.app/insights",RV="You are an expert copywriter and you are immersed in a document editor. Only write what is asked for.",MV={__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=ke(()=>t.selectedText?"Insert prompt to update text":"Insert prompt to generate text"),a=ke(()=>n.value.trim().length>0&&!r.value);jn(()=>{kt(()=>{i.value?.focus()})});function l(m){if(typeof m=="string")return m;if(!m||typeof m!="object")return"";const v=m.custom_prompt;if(Array.isArray(v)){const C=v[0];if(C&&typeof C.value=="string")return C.value}return v&&typeof v=="object"&&typeof v.value=="string"?v.value:typeof m.value=="string"?m.value:typeof m.text=="string"?m.text:""}async function u(m){const v={"Content-Type":"application/json"};t.apiKey&&(v["x-api-key"]=t.apiKey);const C=t.selectedText.trim(),w=C?`Rewrite the following text: "${C}" using these instructions: ${m}`:`Generate text based on the following prompt: ${m}`,S=await fetch(t.endpoint||xV,{method:"POST",headers:v,body:JSON.stringify({stream:!1,context:RV,insights:[{type:"custom_prompt",name:C?"text_rewrite":"text_generation",message:w,format:[{value:""}]}]})});if(!S.ok){const b=await S.text().catch(()=>"");throw new Error(b||`AI request failed with ${S.status}`)}const k=l((S.headers.get("content-type")||"").includes("application/json")?await S.json():await S.text()).trim();if(!k)throw new Error("AI returned no text.");return k}function d(m){return!m||typeof m!="object"?!0:!(m.success===!1||m.ok===!1)}function f(m){const v=t.doc;if(!v)throw new Error("Document API is unavailable.");t.restoreSelection?.();let C=null,w=!1;if(t.selectedText&&t.target&&typeof v.replace=="function"?(C=v.replace({target:t.target,text:m}),w=!0):t.target&&typeof v.insert=="function"?(C=v.insert({target:t.target,value:m,type:"text"}),w=!0):typeof v.insert=="function"&&(C=v.insert({value:m,type:"text"}),w=!0),!w)throw new Error("Document text insertion is unavailable.");if(!d(C))throw new Error("Unable to insert generated text.")}async function p(){if(a.value){o.value="",r.value=!0;try{f(await u(n.value.trim())),t.handleClose()}catch(m){o.value=m instanceof Error?m.message:String(m)}finally{r.value=!1}}}function g(m){m.key!=="Enter"||m.shiftKey||(m.preventDefault(),p())}return(m,v)=>(ge(),Le("form",{class:"sd-ai-writer","data-item":"ai-writer",onSubmit:Qt(p,["prevent"])},[fa($e("textarea",{ref_key:"textareaRef",ref:i,"onUpdate:modelValue":v[0]||(v[0]=C=>n.value=C),class:"sd-ai-writer__input",placeholder:s.value,rows:"4",onKeydown:g},null,40,AV),[[Ui,n.value]]),$e("div",IV,[o.value?(ge(),Le("p",EV,zt(o.value),1)):ht("",!0),$e("button",{class:"sd-ai-writer__submit",type:"submit",disabled:!a.value},zt(r.value?"Generating":"Generate"),9,TV)])],32))}},LV=fn(MV,[["__scopeId","data-v-67f6c6f7"]]);Dt(),vn();var DV=["aria-label","onClick","onKeydown"],OV=["innerHTML"],PV=["innerHTML"],$m=7,FV={__name:"IconGridRow",props:{icons:{type:Array,required:!0},activeColor:{type:Object,required:!1}},emits:["select","clickoutside"],setup(e,{emit:t}){const n=t,r=e,o=ke(()=>m=>r.activeColor.value?r.activeColor.value.toUpperCase()===m.value:!1),i=(m,v)=>v===5||["#FFFFFF","#FAFF09"].includes(m)?{color:"#000"}:{color:"#FFF"},s=m=>{n("select",m.value)},a=te([]),l=te([]);jn(()=>{if(!r.icons.every(v=>Array.isArray(v)))throw new Error("icon props must be 2d array");const m=l.value[0];m&&(m.setAttribute("tabindex","0"),m.focus({preventScroll:!0}))});const u=(m,v)=>{const C=$m*m+v+1,w=l.value[C];w&&(w.setAttribute("tabindex","0"),w.focus({preventScroll:!0}))},d=(m,v)=>{const C=$m*m+v-1,w=l.value[C];w&&(w.setAttribute("tabindex","0"),w.focus({preventScroll:!0}))},f=(m,v)=>{const C=v+$m*(m+1),w=l.value[C];w&&(w.setAttribute("tabindex","0"),w.focus({preventScroll:!0}))},p=(m,v)=>{const C=v+$m*(m-1),w=l.value[C];w&&(w.setAttribute("tabindex","0"),w.focus({preventScroll:!0}))},g=(m,v,C,w)=>{switch(m.key){case"ArrowRight":u(v,C);break;case"ArrowLeft":d(v,C);break;case"ArrowDown":f(v,C);break;case"ArrowUp":p(v,C);break;case"Enter":s(w);break;case"Escape":n("clickoutside");break;default:break}};return(m,v)=>(ge(!0),Le(Kt,null,ar(e.icons,(C,w)=>(ge(),Le("div",{class:"sd-option-row",key:w,role:"group",ref_for:!0,ref_key:"rowRefs",ref:a},[(ge(!0),Le(Kt,null,ar(C,(S,k)=>(ge(),Le("div",{class:"sd-option",key:k,"aria-label":S.label,role:"menuitem",ref_for:!0,ref_key:"iconRefs",ref:l,onClick:Qt(b=>s(S),["stop","prevent"]),onKeydown:Qt(b=>g(b,w,k,S),["prevent"])},[$e("div",{class:"sd-option__icon",innerHTML:S.icon,style:bn(S.style)},null,12,OV),o.value(S)?(ge(),Le("div",{key:0,class:"sd-option__check",innerHTML:Je(lr).colorOptionCheck,style:bn(i(S.value,k))},null,12,PV)):ht("",!0)],40,DV))),128))]))),128))}},dI=fn(FV,[["__scopeId","data-v-05eb02fc"]]),NV=`<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
|
`;Dt(),vn();var BV={class:"options-grid-wrap"},zV=["innerHTML"],jV={class:"option-grid-ctn"},VV={__name:"IconGrid",props:{icons:{type:Array,required:!0},customIcons:{type:Array,required:!1},activeColor:{type:Object,required:!1},hasNoneIcon:{type:Boolean,required:!1}},emits:["select","clickoutside"],setup(e,{emit:t}){const n=t,r=o=>{n("select",o)};return(o,i)=>(ge(),Le("div",BV,[e.hasNoneIcon?(ge(),Le("div",{key:0,class:"none-option",role:"menuitem","aria-label":"Clear color selection",onClick:i[0]||(i[0]=s=>r("none"))},[$e("span",{innerHTML:Je(NV),class:"none-icon"},null,8,zV),i[1]||(i[1]=rs(" None ",-1))])):ht("",!0),$e("div",jV,[qt(dI,{icons:e.icons,"active-color":e.activeColor,onSelect:r},null,8,["icons","active-color"]),e.customIcons.flat().length?(ge(),Le(Kt,{key:0},[i[2]||(i[2]=$e("span",{class:"option-grid-ctn__subtitle"},"Custom colors",-1)),qt(dI,{icons:e.customIcons,"active-color":e.activeColor,onSelect:r},null,8,["icons","active-color"])],64)):ht("",!0)])]))}},UV=fn(VV,[["__scopeId","data-v-52b0283a"]]);Dt();var HV=e=>{e.expand.value=!1},Ht=(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%"}}),Gb=(e,t,n=[],r=!1)=>{const o=i=>{t.iconColor.value=i,e.emitCommand({item:t,argument:i}),HV(t),xc(e)};return Ur("div",{},[Ur(UV,{icons:$V,customIcons:n,activeColor:t.iconColor,hasNoneIcon:r,onSelect:o})])},$V=[[Ht("#111111","black"),Ht("#333333","dark gray"),Ht("#5C5C5C","medium gray"),Ht("#858585","light gray"),Ht("#ADADAD","very light gray"),Ht("#D6D6D6","transparent gray"),Ht("#FFFFFF","white")],[Ht("#860028","dark red"),Ht("#D2003F","red"),Ht("#DB3365","coral red"),Ht("#E4668C","light red"),Ht("#ED99B2","pale pink"),Ht("#F6CCD9","transparent pink"),Ht("#FF004D","bright pink")],[Ht("#83015E","dark purple"),Ht("#CD0194","purple"),Ht("#D734A9","orchid"),Ht("#E167BF","light purple"),Ht("#EB99D4","lavender"),Ht("#F5CCEA","transparent pink"),Ht("#FF00A8","neon pink")],[Ht("#8E220A","maroon"),Ht("#DD340F","red-orange"),Ht("#E45C3F","burnt orange"),Ht("#EB856F","peach"),Ht("#F1AE9F","pale peach"),Ht("#F8D6CF","transparent peach"),Ht("#FF7A00","orange")],[Ht("#947D02","olive"),Ht("#E7C302","mustard yellow"),Ht("#ECCF35","yellow"),Ht("#F1DB67","light yellow"),Ht("#F5E79A","very pale yellow"),Ht("#FAF3CC","transparent yellow"),Ht("#FAFF09","neon yellow")],[Ht("#055432","forest green"),Ht("#07834F","green"),Ht("#399C72","medium green"),Ht("#6AB595","light green"),Ht("#9CCDB9","mint"),Ht("#CDE6DC","transparent mint"),Ht("#05F38F","bright teal")],[Ht("#063E7E","navy blue"),Ht("#0A60C5","blue"),Ht("#3B80D1","sky blue"),Ht("#6CA0DC","cornflower blue"),Ht("#9DBFE8","light blue"),Ht("#CEDFF3","very light blue"),Ht("#21c8ce","cyan")],[Ht("#3E027A","deep purple"),Ht("#6103BF","indigo"),Ht("#8136CC","violet"),Ht("#A068D9","lavender pink"),Ht("#C09AE6","light lilac"),Ht("#DFCDF2","transparent lilac"),Ht("#A91DFF","neon purple")]];Dt(),vn();var GV=["data-cols","data-rows","onKeydown","onClick"],WV=["aria-valuetext"],Gm=5,KV={__name:"TableGrid",emits:["select","clickoutside"],setup(e,{emit:t}){const n=t,r=te(0),o=te(0),{isHighContrastMode:i}=as(),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],C=parseInt(v.dataset.cols,10),w=parseInt(v.dataset.rows,10);C<=p&&w<=g?v.classList.add("sd-selected"):v.classList.remove("sd-selected")}},u=({cols:f,rows:p})=>{n("select",{cols:f,rows:p})},d=(f,p,g)=>{let m=p-1,v=g-1;switch(f.key){case"ArrowRight":{if(m>=4)return;const C=v*Gm;s.value[C+m+1].setAttribute("tabindex","0"),s.value[C+m+1].focus(),l(s.value,p+1,g);break}case"ArrowLeft":{if(m<=0)return;const C=v*Gm;s.value[C+m-1].setAttribute("tabindex","0"),s.value[C+m-1].focus(),l(s.value,p-1,g);break}case"ArrowDown":{if(v>=4)return;const C=(v+1)*Gm;s.value[C+m].setAttribute("tabindex","0"),s.value[C+m].focus(),l(s.value,p,g+1);break}case"ArrowUp":{if(v<=0)return;const C=(v-1)*Gm;s.value[C+m].setAttribute("tabindex","0"),s.value[C+m].focus(),l(s.value,p,g-1);break}case"Enter":u({cols:p,rows:g});break;default:break}};return jn(()=>{s.value[0].setAttribute("tabindex","0"),s.value[0].focus(),l(s.value,1,1)}),(f,p)=>(ge(),Le("div",{class:Jt(["toolbar-table-grid-wrapper",{"high-contrast":Je(i)}])},[$e("div",{class:"toolbar-table-grid",onMouseover:a,"data-grid":"true"},[(ge(),Le(Kt,null,ar(5,g=>(ge(),Le(Kt,{key:g},[(ge(),Le(Kt,null,ar(5,m=>$e("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:Qt(v=>d(v,m,g),["prevent"]),onClick:Qt(v=>u({cols:m,rows:g}),["stop","prevent"])},null,40,GV)),64))],64))),64))],32),$e("div",{class:"toolbar-table-grid-value","aria-valuetext":`${r.value} x ${o.value}`},zt(r.value)+" x "+zt(o.value),9,WV)],2))}},qV=fn(KV,[["__scopeId","data-v-b87d6ca2"]]);Dt(),vn();var YV={class:"toolbar-table-actions"},XV=["onClick","data-item","ariaLabel"],ZV={class:"toolbar-table-actions__icon"},QV=["innerHTML"],JV={class:"toolbar-table-actions__label"},eU={__name:"TableActions",props:{options:{type:Array}},emits:["select"],setup(e,{emit:t}){const n=t,r=o=>{n("select",{command:o.command})};return(o,i)=>(ge(),Le("div",YV,[(ge(!0),Le(Kt,null,ar(e.options,s=>(ge(),Le("div",{class:Jt(["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"},[$e("div",ZV,[$e("div",{class:"toolbar-table-actions__icon-wrapper",innerHTML:s.icon},null,8,QV)]),$e("div",JV,zt(s.label),1)],10,XV))),256))]))}},tU=fn(eU,[["__scopeId","data-v-0cdad084"]]),nU=`<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
|
-
`;Dt();var Us=e=>{e.expand.value=!1},Wb=(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 Kb(e,t){const n={...e};return t?n.href=t:delete n.href,n}function fI(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 rU(e){return typeof e?.quotedText=="string"?e.quotedText:typeof e?.text=="string"?e.text:""}function hI(e){return e.ui?.selection?.get?.()??e.ui?.selection?.current?.()??null}function oU(e){return!!(e.config?.superdoc?.config?.modules?.ai||e.superdoc?.config?.modules?.ai)}function iU(e){return e.config?.superdoc?.config?.modules?.ai??e.superdoc?.config?.modules?.ai??{}}var sU=({superToolbar:e,toolbarIcons:t,toolbarTexts:n,toolbarFonts:r,hideButtons:o,availableWidth:i,role:s,isDev:a=!1,configuredItemNames:l,excludedItemNames:u,additionalItems:d=[]}={})=>{const f=xn({type:"button",name:"bold",command:"toggleBold",icon:t.bold,tooltip:n.bold,attributes:{ariaLabel:"Bold"}}),p=(r??Qj).map(iV),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:Qe}={},wt=!1)=>{if(wt){g.label.value="",g.selectedValue.value="";return}if(!Qe)return;Qe=Qe.split(",")[0];const Pt=tn=>tn.value??tn.label,cn=p.find(tn=>Pt(tn)===g.defaultLabel.value),pn=p.find(tn=>Pt(tn)===Qe);pn?(g.label.value=pn.label,g.selectedValue.value=pn.key):cn?(g.label.value=Qe,g.selectedValue.value=cn.key):(g.label.value=Qe,g.selectedValue.value="")},onDeactivate:()=>{const Qe=p.find(wt=>(wt.value??wt.label)===g.defaultLabel.value);g.label.value=Qe?.label??g.defaultLabel.value,g.selectedValue.value=Qe?.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(Qe){const wt=hI(e),Pt=wt?.selectionTarget??fI(wt?.target),cn=wt?.empty?"":rU(wt),pn=iU(e),tn=()=>Us(Qe),wn=()=>{const nn=e.pendingSelectionCapture;nn&&typeof e.ui?.selection?.restore=="function"&&e.ui.selection.restore(nn)};return Ur("div",{},[Ur(LV,{handleClose:tn,selectedText:cn,target:Pt,doc:e.superdoc?.activeEditor?.doc??null,apiKey:pn?.apiKey||e.config?.aiApiKey||"",endpoint:pn?.endpoint||e.config?.aiEndpoint||"",restoreSelection:wn})])}const C=eV,w=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:C,onActivate:({fontSize:Qe},wt=!1)=>{if(wt){w.label.value="",w.selectedValue.value="";return}const Pt=C.find(wn=>wn.label===String(w.defaultLabel.value));if(!Qe){w.label.value=w.defaultLabel.value,Pt?w.selectedValue.value=Pt.key:w.selectedValue.value="";return}let cn=Kz(Qe,12);cn<8&&(cn=8),cn>96&&(cn=96);let pn=String(cn);const tn=C.find(wn=>wn.label===pn||wn.key===pn);tn?w.selectedValue.value=tn.key:w.selectedValue.value="",w.label.value=pn},onDeactivate:()=>{w.label.value=w.defaultLabel.value;const Qe=C.find(wt=>wt.label===String(w.defaultLabel.value));Qe?w.selectedValue.value=Qe.key:w.selectedValue.value=""}}),S=()=>xn({type:"separator",name:"separator",isNarrow:!0}),k=xn({type:"button",name:"italic",command:"toggleItalic",icon:t.italic,active:!1,tooltip:n.italic,attributes:{ariaLabel:"Italic"}}),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:()=>Gb(e,L,[],!0)}],onActivate:({color:Qe})=>{L.iconColor.value=Qe||""},onDeactivate:()=>L.iconColor.value=""}),z=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:()=>Gb(e,z)}],onActivate:({color:Qe})=>{z.iconColor.value=Qe},onDeactivate:()=>z.iconColor.value="#000"}),G=xn({type:"button",name:"search",allowWithoutEditor:!0,active:!1,icon:t.search,tooltip:n.search,group:"right",attributes:{ariaLabel:"Search"}}),U=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:()=>j(U)}],onActivate:({href:Qe})=>{U.attributes.value=Kb(U.attributes.value,Qe)},onDeactivate:()=>{U.attributes.value=Kb(U.attributes.value,null),U.expand.value=!1}});function j(Qe){const wt=hI(e),Pt=wt?.selectionTarget??fI(wt?.target),cn=()=>{const pn=e.pendingSelectionCapture;pn&&typeof e.ui?.selection?.restore=="function"&&e.ui.selection.restore(pn)};return Ur("div",{},[Ur(__,{ui:e.ui,linkItem:Qe,textTarget:Pt,restoreSelection:cn,closePopover:()=>{Us(Qe),xc(e)},goToAnchor:()=>{Us(Qe);const pn=Qe.attributes.value?.href;if(!pn)return;const tn=pn.slice(1),wn=(e.ui?.viewport?.getHost?.()??null)?.querySelector?.(`a[name='${tn}']`);wn&&A_(wn)}})])}const Z=xn({type:"options",name:"linkInput",command:"toggleLink",active:!1});U.childItem=Z,Z.parentItem=U;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(Qe){return Ur("div",{},[Ur(qV,{onSelect:Pt=>{e.emitCommand({item:Qe,argument:Pt}),Us(Qe),xc(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($)}]}),J=[{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(Qe){return Ur(tU,{options:J,onSelect:wt=>{Us(Qe);const{command:Pt}=wt;e.emitCommand({item:Qe,argument:{command:Pt}}),xc(e)}})}const Y=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:()=>Ur("div",{},[Ur(lV,{onSelect:wt=>{Us(Y);const Pt={...Y,command:"setTextAlign"};Pt.command="setTextAlign",e.emitCommand({item:Pt,argument:wt}),Ce(Y,wt),xc(e)}})]),key:"alignment"}],onActivate:({textAlign:Qe})=>{Ce(Y,Qe)},onDeactivate:()=>{Ce(Y,"left")}}),Ce=(Qe,wt)=>{let Pt=wt==="both"?"justify":wt,cn={left:t.alignLeft,right:t.alignRight,center:t.alignCenter,justify:t.alignJustify},pn=cn[Pt]??cn.left;Qe.icon.value=pn},fe=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 Qe=wt=>{Us(fe);const Pt={...fe,command:"toggleBulletListStyle"};e.emitCommand({item:Pt,argument:wt})};return Ur(uI,{buttons:dV,iconSize:25,selectedStyle:fe.selectedValue.value,onSelect:Qe})}}]}),ve=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 Qe=wt=>{Us(ve);const Pt={...ve,command:"toggleOrderedListStyle"};e.emitCommand({item:Pt,argument:wt})};return Ur(uI,{buttons:fV,iconSize:30,selectedStyle:ve.selectedValue.value,onSelect:Qe})}}]}),me=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"}}),Fe=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:Qe})=>{Qe&&(Ze.label.value=Qe)}}),lt=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:Qe})=>{Qe&&(lt.label.value=Qe)}}),et=xn({type:"button",name:"undo",disabled:!0,tooltip:n.undo,command:"undo",icon:t.undo,group:"left",attributes:{ariaLabel:"Undo"}}),Et=xn({type:"button",disabled:!0,name:"redo",tooltip:n.redo,command:"redo",icon:t.redo,group:"left",attributes:{ariaLabel:"Redo"}}),ae=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"}}),He=xn({type:"button",name:"clearFormatting",command:"clearFormat",tooltip:n.clearFormatting,icon:t.clearFormatting,attributes:{ariaLabel:"Clear formatting"}}),re=xn({type:"button",name:"copyFormat",tooltip:n.copyFormat,icon:t.copyFormat,command:"copyFormat",active:!1,attributes:{ariaLabel:"Copy formatting"}}),I=(Qe,wt)=>Qe==="editor"?wt:Qe==="suggester"?wt.filter(Pt=>Pt.value==="suggesting"):wt.filter(Pt=>Pt.value==="viewing"),se=Qe=>Qe==="editor"?"Editing":Qe==="suggester"?"Suggesting":"Viewing",N=xn({type:"dropdown",name:"documentMode",command:"setDocumentMode",allowWithoutEditor:!0,icon:t.documentMode,defaultLabel:se(s),label:se(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(N)}]}),q=[{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(Qe){return Ur(wV,{options:I(s,q),onSelect:wt=>{const Pt=e.superdoc?.activeEditor??e.activeEditor;Us(Qe);const{label:cn,icon:pn,value:tn}=wt;N.label.value=cn,N.icon.value=pn,e.emitCommand({item:N,argument:tn}),xc(e,Pt)}})}const ee=new Map([["separator",20],["zoom",71],["measurementUnit",52],["fontFamily",118],["fontSize",57],["textAlign",40],["linkedStyles",142],["documentMode",47],["default",32]]),ye=["search","ruler","undo","overflow","documentMode"],P=xn({type:"button",name:"ruler",command:"toggleRuler",allowWithoutEditor:!0,icon:t.ruler,active:!1,tooltip:n.ruler,attributes:{ariaLabel:"Ruler"}}),B=xn({type:"button",name:"formattingMarks",command:"toggleFormattingMarks",allowWithoutEditor:!0,icon:t.formattingMarks,active:!1,tooltip:n.formattingMarks,attributes:{ariaLabel:"Formatting marks"}}),ce=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 Qe=Pt=>{Us(ce);const cn=typeof Pt=="string"?Pt:Pt?.id??null;if(!cn)return;const pn={...ce,command:"setLinkedStyle"};e.emitCommand({item:pn,argument:cn})},wt=e.getActiveLinkedStyleId?.()??null;return Ur("div",{},[Ur(_V,{styles:e.getLinkedStyleOptions?.()??[],onSelect:Qe,selectedOption:wt})])}}],onActivate:({styleId:Qe,styleName:wt})=>{const Pt=wt||Qe;ce.label.value=Qe&&Qe!=="Normal"?String(Pt):n.formatText,ce.disabled.value=!1},onDeactivate:()=>{ce.disabled.value=!0,ce.label.value=n.formatText}}),_e=(Qe,wt)=>{if(wt.value==Qe)return Ur("div",{innerHTML:nU,class:"dropdown-select-icon"})},Ae=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(Qe=>({label:Qe.toFixed(2),key:Qe,icon:()=>_e(Qe,Ae.selectedValue),props:{"data-item":"btn-lineHeight-option"}}))}),De=20,Ye=32,ot=["linkedStyles","clearFormatting","copyFormat","formattingMarks"],gt=["zoom","fontFamily","fontSize","redo"],xt=i<=ah.lg,Tt=e.config?.showFormattingMarksButton===!0,$t=e.config?.showTableOfContentsButton===!0;xt&&(N.attributes.value={...N.attributes.value,className:`${N.attributes.value.className} sd-toolbar-item--doc-mode-compact`}),xt&&(ce.attributes.value={...ce.attributes.value,className:`${ce.attributes.value.className} sd-toolbar-item--linked-styles-compact`});let je=[et,Et,ae,Ie,G,Ze,g,S(),w,S(),f,k,b,T,z,L,S(),U,R,...$t?[K]:[],x,$,S(),Y,fe,ve,me,Ee,Ae,S(),ce,S(),P,lt,...Tt?[B]:[],re,He,...oU(e)?[m]:[],Fe,N,...d];if(i<=ah.md&&o&&(je=je.filter(Qe=>Qe.type!=="separator")),e.config.mode!=="docx"){const Qe=je.findIndex(Pt=>Pt.name.value==="linkedStyles");je.splice(Qe-1,2);const wt=["ruler","zoom","undo","redo"];je=je.filter(Pt=>!wt.includes(Pt.name.value))}const rn=[];a||(s==="viewer"&&rn.push(ae,Ie),je=je.filter(Qe=>!rn.includes(Qe))),l&&(je=je.filter(Qe=>Qe.name.value==="overflow"||Qe.isCustomToolbarItem||l.has(Qe.name.value))),u?.size&&(je=je.filter(Qe=>!u.has(Qe.name.value)));const Un=Qe=>ye.includes(Qe.name.value),jt=je.find(Qe=>Qe.name.value==="overflow"),En=je.filter(Qe=>Qe!==jt),Gr=Qe=>{const wt=[],Pt=[],cn=En.filter(Un).reduce((tn,wn)=>tn+Wb(wn,ee),0);let pn=Ye+cn+(Qe&&jt?Wb(jt,ee):0);return En.forEach((tn,wn)=>{const nn=Wb(tn,ee);if(tn.type==="separator"&&En[wn-1]?.name.value==="linkedStyles"&&wt.includes(En[wn-1])){wt.push(tn);return}if(i<ah.xl+De&&ot.includes(tn.name.value)&&o){wt.push(tn);return}if(i<ah.sm&>.includes(tn.name.value)&&o){wt.push(tn);return}if(Un(tn)){Pt.push(tn);return}pn+nn<=i||!o?(Pt.push(tn),pn+=nn):wt.push(tn)}),{visibleItems:Pt,overflowItems:wt}};let{visibleItems:br,overflowItems:Ir}=Gr(!1);if(o&&jt&&Ir.some(Qe=>Qe.type!=="separator")){({visibleItems:br,overflowItems:Ir}=Gr(!0));const Qe=je.indexOf(jt),wt=br.findIndex(Pt=>je.indexOf(Pt)>Qe);wt===-1?br.push(jt):br.splice(wt,0,jt)}return{defaultItems:br,overflowItems:Ir.filter(Qe=>Qe.type!=="separator")}},pI={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"},aU=e=>e?typeof e!="string"?e instanceof HTMLElement?e:null:e.startsWith("#")||e.startsWith(".")?document.querySelector(e):document.getElementById(e):null;Dt();function mI(e){return zz(e)??$b[e]??null}function Wm(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 lU=new Set(["bold","italic","underline","strike","color","highlight","link","clearFormatting","textAlign","list","numberedlist","indentleft","indentright","lineHeight","linkedStyles"]),cU=new Set(["list","numberedlist"]);function uU(e,t){if(e==="fontFamily"||e==="fontSize"||cU.has(e)&&t?.disabled&&t?.supported!==!1&&t?.reason==null)return!0;if(!lU.has(e))return!1;const n=t?.reason;return n==="range-selection-required"||n==="selection-required"}function gI(e){return!!e?.closest?.("[data-editor-ui-surface], .toolbar-dropdown-menu, .sd-toolbar-dropdown-menu, .sd-tooltip-content")}function dU(e){return["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key)}var fU=new Set([...Bz,...Object.keys(Nm),"ai","overflow","tableOfContents"]),hU=class extends Mg.default{config={selector:null,toolbarGroups:["left","center","right"],role:"editor",icons:{...lr},texts:{...pI},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=Vr([]);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={...pI,...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=aU(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=gc(oV),this.app.directive("click-outside",Oy),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||Jj(this.superdoc?.fonts?.getFontFamilyOptions?.()??[])}#c(){const e=this.getAvailableWidth(),t=new Map(this.#a().filter(C=>C.isCustomToolbarItem&&C.type==="dropdown").map(C=>[C.name.value,C.selectedValue.value])),n=this.config.groups&&!Array.isArray(this.config.groups)&&Object.keys(this.config.groups).length>0,r=n?new Set(Object.values(this.config.groups).flatMap(C=>C)):null,o=new Set(this.config.excludeItems),i=this.config.customButtons||[],s=new Set(fU),a=i.map((C,w)=>{try{if(C?.name&&s.has(C.name))throw new Error(`Toolbar item name "${C.name}" is already taken by another item, so this entry is skipped.`);const S=this.#h(C);return t.has(S.name.value)&&(S.selectedValue.value=t.get(S.name.value)),s.add(S.name?.value),S}catch(S){const k=`${C?.name??`<unnamed@${w}>`}::${S?.message??String(S)}`;return this._reportedInvalidCustomItems.has(k)||(this._reportedInvalidCustomItems.add(k),this.#m(S,C?.name??null)),null}}).filter(Boolean),l=n?new Set(Object.keys(this.config.groups)):null,u=l?a.filter(C=>l.has(C.group?.value||"center")):a,{defaultItems:d,overflowItems:f}=sU({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:u});let p=[...d.map(C=>C.name.value),...f.map(C=>C.name.value)];if(n){const C=Object.values(this.config.groups).flatMap(S=>S),w=a.filter(S=>l.has(S.group?.value||"center")).map(S=>S.name.value);p=[...new Set([...C,...w])]}const g=f.filter(C=>p.includes(C.name.value)&&!o.has(C.name.value)),m=g.length?[...p,"overflow"]:p,v=d.filter(C=>m.includes(C.name.value)).filter(C=>!o.has(C.name.value));if(n)for(const[C,w]of Object.entries(this.config.groups))for(const S of v)w.includes(S.name.value)&&(S.group.value=C);this.toolbarItems=v,this.overflowItems=g}#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:()=>Gb(this,e,[],!0)};e.nestedOptions.value=[t]}#M(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=cI.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(Ub(t)?.disposition==="host-routed")return e.setDisabled(!this.#b(t)),this.#k(t)?e.activate():e.deactivate(),!0;const n=mI(t);if(!n)return!1;const r=this.snapshot?.commands?.[n];uU(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=Kb(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.#M(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=lI[t?.command];return i?Wm(this.ui,i,void 0,r):!1}if(Ub(n)?.disposition==="unsupported")return!0;const o=mI(n);return o?Wm(this.ui,o,t,r):!1}#I(){return this.snapshot?.commands?.image?.disabled||(this.#e||(this.#e=Wz({ownerDocument:this.toolbarContainer?.ownerDocument??document,onPick:async e=>{const t=await $z(e,this.superdoc?.config?.handleImageUpload);Wm(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=>{gI(i.target)||this.ui.formatPainter.setPointerSelecting(!0)},n=i=>{this.ui.formatPainter.setPointerSelecting(!1),!gI(i.target)&&this.ui.formatPainter.notifyPointerUp()},r=i=>{if(i.key==="Escape"){this.ui.formatPainter.cancel();return}dU(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(Ub(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(!Wm(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 pU(e){return new hU(e)}function mU(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 gU(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=Km(e.color);n!=null&&(t.color=n),e.highlight!=null&&(t.highlight=e.highlight);const r=yU(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=vU(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=bU(e.border);return i&&(t.border=i),t}function Km(e){if(e){if(typeof e=="string")return e;if(e.model==="rgb")return e.value;if(e.model==="auto")return"auto"}}function vU(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 yU(e){if(!e)return;const t={},n=Km(e.fill);n!=null&&(t.fill=n);const r=Km(e.color);return r!=null&&(t.color=r),e.pattern!=null&&(t.val=e.pattern),Object.keys(t).length>0?t:void 0}function bU(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=Km(e.color);return n!=null&&(t.color=n),Object.keys(t).length>0?t:void 0}function Rc(e){const t=e?.selectionTarget??e?.target;if(!e||!t)return"";try{return JSON.stringify(t)}catch{return String(t)}}var wU=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"]),CU=e=>e?.type!=="mutation:committed"||e.origin!=="command"?!1:wU.has(e.editableCommandKind);function vI(e){return e.split(",").map(t=>t.trim()).filter(Boolean)}function kU(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 vI(r))n(o);return n(e.getAttribute("data-track-change-id")),t}function yI(e,t){if(!e||typeof e.getAttribute!="function")return[];const n=[],r=new Set;let o=[],i=e;for(;i;){const s=i,a=kU(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 C={type:"trackedChange",id:m};l&&(C.storyKey=l),n.push(C),o.push(C)}}const u=s.getAttribute("data-layout-story");if(u&&o.length>0){for(const m of o)m.story=u;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 vI(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"),C=s.getAttribute("data-sdt-tag"),w={type:"contentControl",id:g};(v==="block"||v==="inline")&&(w.scope=v),C&&(w.tag=C),n.push(w)}}if(t&&i===t)break;i=i.parentElement}return n}var bo=()=>({oneOf:[{type:"boolean"},{type:"null"}]}),Ol=()=>({oneOf:[{type:"string",minLength:1},{type:"null"}]}),Wu=()=>({oneOf:[{type:"number"},{type:"null"}]}),Ku=e=>({oneOf:[{type:"object",properties:e,additionalProperties:!1,minProperties:1},{type:"null"}]}),SU={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},_U={type:"object",properties:{id:{type:"number"},val:{type:"boolean"}},required:["id"],additionalProperties:!1},AU=()=>({oneOf:[{type:"boolean"},{type:"null"},SU]}),IU=()=>({oneOf:[{type:"array",items:_U,minItems:1},{type:"null"}]});function qm(e,t){return{storage:"mark",markName:e,textStyleAttr:t}}function EU(e){return{storage:"runAttribute",nodeName:"run",runPropertyKey:e}}var qb=(e,t,n)=>({key:e,type:"boolean",ooxmlElement:t,storage:"mark",tracked:!0,carrier:qm(n),schema:bo()}),Mc=(e,t,n,r,o)=>({key:e,type:t,ooxmlElement:n,storage:"mark",tracked:!0,carrier:qm("textStyle",o??e),schema:r}),Gn=(e,t,n,r,o)=>({key:e,type:t,ooxmlElement:n,storage:"runAttribute",tracked:!1,carrier:EU(o??e),schema:r}),Ym=[qb("bold","w:b","bold"),qb("italic","w:i","italic"),qb("strike","w:strike","strike"),{key:"underline",type:"object",ooxmlElement:"w:u",storage:"mark",tracked:!0,carrier:qm("underline"),schema:AU()},{key:"highlight",type:"string",ooxmlElement:"w:highlight",storage:"mark",tracked:!0,carrier:qm("highlight"),schema:Ol()},Mc("color","string","w:color",Ol()),Mc("fontSize","number","w:sz",Wu()),Mc("fontFamily","string","w:rFonts",Ol()),Mc("letterSpacing","number","w:spacing",Wu()),Mc("vertAlign","string","w:vertAlign",{oneOf:[{enum:["superscript","subscript","baseline"]},{type:"null"}]}),Mc("position","number","w:position",Wu()),Gn("dstrike","boolean","w:dstrike",bo()),Gn("smallCaps","boolean","w:smallCaps",bo()),Mc("caps","boolean","w:caps",bo(),"textTransform"),Gn("shading","object","w:shd",Ku({fill:{oneOf:[{type:"string",minLength:1},{type:"null"}]},color:{oneOf:[{type:"string",minLength:1},{type:"null"}]},val:{oneOf:[{type:"string",minLength:1},{type:"null"}]}})),Gn("border","object","w:bdr",Ku({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"),Gn("outline","boolean","w:outline",bo()),Gn("shadow","boolean","w:shadow",bo()),Gn("emboss","boolean","w:emboss",bo()),Gn("imprint","boolean","w:imprint",bo()),Gn("charScale","number","w:w",Wu(),"w"),Gn("kerning","number","w:kern",Wu(),"kern"),Gn("vanish","boolean","w:vanish",bo()),Gn("webHidden","boolean","w:webHidden",bo()),Gn("specVanish","boolean","w:specVanish",bo()),Gn("rtl","boolean","w:rtl",bo()),Gn("cs","boolean","w:cs",bo()),Gn("bCs","boolean","w:bCs",bo(),"boldCs"),Gn("iCs","boolean","w:iCs",bo(),"italicCs"),Gn("eastAsianLayout","object","w:eastAsianLayout",Ku({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"}]}})),Gn("em","string","w:em",Ol()),Gn("fitText","object","w:fitText",Ku({val:{oneOf:[{type:"number"},{type:"null"}]},id:{oneOf:[{type:"string",minLength:1},{type:"null"}]}})),Gn("snapToGrid","boolean","w:snapToGrid",bo()),Gn("lang","object","w:lang",Ku({val:{oneOf:[{type:"string",minLength:1},{type:"null"}]},eastAsia:{oneOf:[{type:"string",minLength:1},{type:"null"}]},bidi:{oneOf:[{type:"string",minLength:1},{type:"null"}]}})),Gn("oMath","boolean","w:oMath",bo()),Gn("rStyle","string","w:rStyle",Ol(),"styleId"),Gn("rFonts","object","w:rFonts",Ku({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"),Gn("fontSizeCs","number","w:szCs",Wu()),Gn("ligatures","string","w14:ligatures",Ol()),Gn("numForm","string","w14:numForm",Ol()),Gn("numSpacing","string","w14:numSpacing",Ol()),Gn("stylisticSets","array","w14:stylisticSets",IU()),Gn("contextualAlternates","boolean","w14:cntxtAlts",bo())],EW=new Set(Ym.map(e=>e.key)),TU=Object.fromEntries(Ym.map(e=>[e.key,e])),TW={mark:Ym.filter(e=>e.storage==="mark").map(e=>e.key),runAttribute:Ym.filter(e=>e.storage==="runAttribute").map(e=>e.key)};function Fa(){return typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now()}function Xm(){const e=globalThis;return{sink:typeof e.__superdocV2BenchPipelineTiming=="function"?e.__superdocV2BenchPipelineTiming:null,workerContext:e.__superdocV2BenchWorkerMessageContext??null}}function Yb(e){const{sink:t}=Xm();if(t)try{t(e)}catch{}}var Xb=new WeakMap;function xU(e){let t=Xb.get(e);return t||(t={refCount:0,generation:0,abortController:new AbortController,inFlight:null,activeMutationTokens:new Set},Xb.set(e,t)),t.refCount+=1,t}function RU(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(),Xb.delete(e))}var MU=new Set(Object.values(at));function Zm(e,t){return typeof e=="string"&&MU.has(e)?e:t}function bI(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:at.notReady}:{ok:!1,reason:Zm(t,at.targetUnresolved)}}return{ok:!0}}var LU=["document-replaced","editorCreate","active-editor-change","document-mode-change","zoomChange","measurement-unit-change","viewport-change","fonts-changed"],DU={[Y4.bulletList]:"bullet",[Y4.numberedList]:"ordered"};function wI(e){return DU[e]??null}var OU={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 PU(e){const t=OU[e];return t?{preset:t,behavior:"toggleStyle"}:{}}var FU={status:"ready",empty:!0,target:null,selectionTarget:null,activeMarks:[],activeCommentIds:[],activeChangeIds:[],quotedText:""},NU=[{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"}],BU=new Set(["/word/comments.xml","/word/commentsExtended.xml","/word/commentsIds.xml"]);function zU(e){return NU.some(t=>t.match==="exact"?t.key===e:e.startsWith(t.key))}var CI={ready:0,stale:1,pending:2};function Pl(...e){let t="ready";for(const n of e)CI[n]>CI[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 Fr(e){return!!e&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"}function yr(e,t){if(!e)return null;const n=t.split(".");let r=e;for(const o of n){if(r==null)return null;r=r[o]}return typeof r=="function"?r:null}function Xn(e,t="CAPABILITY_UNAVAILABLE"){return{success:!1,failure:{code:t,message:e}}}function 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 Zb(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 kI(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||!Zb(n))return i}return n}function nr(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 Ei(e,t,n){return $r(e)!==t?!1:n?nr(uh(e))===nr(n):!0}function dh(e){const t=uh(e);if(!(!t||nr(t)===nr(null)))return t}function jU(e){if(typeof e!="string"||e.length===0)return;const t=WT(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 VU(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 Qb(e){if(!e||typeof e!="object")return null;const t=e.selectionTarget;return t&&typeof t=="object"?t:null}function Qm(e){if(!e||typeof e!="object")return null;const t=e.id;return typeof t=="string"&&t.length>0?t:null}function UU(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 $r(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 qu(e){return typeof e=="string"?e.trim():""}function HU(e,t){const n=t??{},r=qu(n.id).toLowerCase(),o=qu(e.authorId).toLowerCase();if(r&&o)return r===o;const i=qu(n.email).toLowerCase(),s=qu(e.authorEmail).toLowerCase();if(i&&s)return i===s;if(r||i||o||s)return!1;const a=qu(e.author).replace(/\s+/g," ").toLowerCase();if(!a)return!0;const l=qu(n.name).replace(/\s+/g," ").toLowerCase();return!!(l&&l===a)}function $U(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 SI=new WeakMap;function _I(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 u=s.replacement;if(u&&typeof u=="object")for(const f of[u.inserted,u.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 Hs(e){const t=SI.get(e);if(t)return t;const n=new Set,r=new Map;for(const i of e){const s=$r(i);if(s){n.add(s);for(const a of _I(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 SI.set(e,o),o}var AI=new WeakMap,II=new WeakMap;function Fl(e,t){const n=nr(t);let r=AI.get(e);r||(r=new Map,AI.set(e,r));const o=r.get(n);if(o)return o;const i=Hs(e.filter(s=>nr(uh(s))===n));return r.set(n,i),i}function GU(e){return!!e&&typeof e=="object"&&e.storyType==="textbox"}function WU(e,t){const n=t.filter(o=>e.some(i=>$r(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=>$r(s)===o);if(i)for(const s of _I(i)){if(r.has(s))return null;r.add(s)}}return n[0]}function KU(e){const t=II.get(e);if(t)return t;const n=e.filter(o=>uh(o)!=null),r=n.length===e.length?e:n;return II.set(e,r),r}function qU(e){const{selectionIds:t,publicIds:n,selection:r,bodyItems:o,allStoryItems:i}=e;if(t.length===0)return null;const s=u=>{for(const d of t){const f=u.toPublicId(d);if(f)return f}return null},a=fs(r),l=nr(a)===nr(null);if(i){const u=l?KU(i):i,d=s(Fl(u,a));if(d)return d;const f=n?.find(p=>u.some(g=>Ei(g,p,a)));return f||(l?s(Hs(o)):GU(a)?WU(i,t):null)}return l?s(Hs(o))??t[0]??null:null}function YU(e,t){const n=e.find(r=>$r(r)===t||r.importedId===t);return n?n.rootCommentId??n.parentCommentId??$r(n)??t:null}function XU(e){const t=e.selectionTarget;if(t){const s=t.start,a=t.end,l=typeof s?.blockId=="string"?s.blockId:void 0,u=typeof a?.blockId=="string"?a.blockId:l;if(l)return{startBlockId:l,endBlockId:u??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 Nr(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 ZU=64;function Lc(e){return e.length<=ZU}function fs(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 To(e,t){return{kind:"block",nodeType:"paragraph",nodeId:e,...t&&typeof t=="object"?{story:t}:{}}}function Na(e){return{kind:"block",nodeType:"paragraph",nodeId:e}}function EI(e,t){return{kind:"block",nodeType:"listItem",nodeId:e,...t&&typeof t=="object"?{story:t}:{}}}var TI=720;function $s(e){return Math.round(e*20)}function Yu(e){return typeof e=="number"&&Number.isFinite(e)}function QU(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=Yu(i.left)?$s(i.left):Yu(i.start)?$s(i.start):void 0,a=Yu(i.right)?$s(i.right):Yu(i.end)?$s(i.end):void 0,l=Yu(i.firstLine)?$s(i.firstLine):void 0,u=Yu(i.hanging)?$s(i.hanging):void 0;return s==null&&a==null&&l==null&&u==null?null:{...s!=null?{left:s}:{},...a!=null?{right:a}:{},...l!=null?{firstLine:l}:{},...u!=null?{hanging:u}:{}}}function Jb(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 JU(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 fh(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 Gs(e){return fh(e.target)??fh(e.selectionTarget)}var xI=["fontFamily","fontSize","color","highlight"],eH={undo:"history.undo",redo:"history.redo"},hh=["bold","italic","underline","strikethrough"];function e2(e){return xI.includes(e)}function Xu(e){const t=e.target,n=t&&Array.isArray(t.segments)?t.segments:[],r=[],o=(l,u,d)=>{typeof l!="string"||typeof u!="number"||typeof d!="number"||r.push({blockId:l,start:Math.min(u,d),end:Math.max(u,d)})};for(const l of n){const u=l?.range;o(l?.blockId,u?.start,u?.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 hs(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 tH(e){const t=hs(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 Ba(e){const t=Xu(e);return t.length===0?null:[tH(e),...t.map(n=>`${n.blockId}:${n.start}-${n.end}`)].join("|")}function RI(e){const t=e.selectionTarget;return!t||typeof t!="object"?null:Rc({selectionTarget:t})}function nH(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 rH(e,t){return Math.max(e.start,t.start)<Math.min(e.end,t.end)}function oH(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 iH(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 MI(e,t){const n=Xu(t);if(n.length===0)return null;const r=e&&Array.isArray(e.items)?e.items:[];if(r.length===0)return null;const o=r.find(i=>iH(n,oH(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 sH(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 t2(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 aH(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 lH(e,t){return e==="fontFamily"?t.toLowerCase():e==="color"||e==="highlight"?t.toUpperCase():t}function LI(e,t){if(!e)return{};const n=new Map;for(const i of Xu(t)){const s=n.get(i.blockId)??[];s.push({start:i.start,end:i.end}),n.set(i.blockId,s)}if(n.size===0)return{};const r=Array.isArray(e.blocks)?e.blocks:[],o={};for(const i of xI){const s=new Map;let a=!1,l=!1;for(const u of r){const d=typeof u?.blockId=="string"?u.blockId:null;if(!d)continue;const f=n.get(d);if(!f?.length)continue;const p=Array.isArray(u?.runs)?u.runs:[];for(const g of p){const m=g?.range,v=typeof m?.start=="number"?m.start:null,C=typeof m?.end=="number"?m.end:null;if(v==null||C==null||!f.some(k=>rH(k,{start:v,end:C})))continue;a=!0;const w=sH(g?.styles,i);if(w===void 0){l=!0;continue}const S=lH(i,w);if(s.has(S)||s.set(S,w),s.size>1)break}if(s.size>1)break}a&&!l&&s.size===1&&(o[i]=[...s.values()][0])}return o}function n2(e,t){const n=Nr(e)[0];return n?t==="nodeId"?{kind:"after",nodeId:n}:{kind:"after",target:To(n)}:{kind:"documentEnd"}}function en(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 Zu(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 Qu(e){const t=e,n=t.change;return n&&typeof n=="object"?n:t}function Ws(e){if(Fr(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 Jm(e){return!!e&&typeof e=="object"&&e.success===!0}function xo(e){return!(e===!1||e&&typeof e=="object"&&e.success===!1)}function ph(e){return!!(e&&typeof e=="object"&&!Array.isArray(e))}function r2(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 u of l.blocks)n(u);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 eg(e){return e.trackedChange?.kind==="delete"?0:typeof e.text=="string"?e.text.length:0}function Ti(e){let t=!1,n=null,r=null,o=null;for(const i of e)t=i,!xo(i)&&n===null&&(n=i),Jm(i)&&(o=i),i!==!1&&(r=i);return n??o??r??t}function cH(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 uH(e){return e.startsWith("#")?{kind:"anchor",anchor:e.slice(1)}:{kind:"external",url:e}}function tg(e){return Gu(e)?.trackDecision??null}function dH(e){return{found:e.length>0,success:e.length>0,rects:e,rect:e[0]}}function Nl(e){return{found:!1,success:!1,rects:[],reason:e}}function fH(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 hH(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 DI(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(hH))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 pH(e){return e.selectionTarget?e.selectionTarget:DI(e.target)}function Ju(e){if(e.empty)return null;if(e.selectionTarget)return e.selectionTarget;const t=DI(e.target);return t&&t.start.kind==="text"&&t.end.kind==="text"&&t.start.blockId!==t.end.blockId?null:t}function o2(e){return!e.inline||typeof e.docRoute!="string"?null:e.docRoute.startsWith("format.")?e.docRoute.slice(7):null}var i2={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},mH=Object.fromEntries(Object.entries(i2).filter(([e])=>TU[e]?.tracked===!0));function gH(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:{...i2}};default:return null}}function vH(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 yH(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 bH(e){const t=e.superdoc,n=new Map,r=new Map;let o=null,i=0;const s=[];let a=null,l=0,u=!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={},C="",w=null;const S=()=>{const c=t?.activeEditor;return c&&typeof c=="object"?c:null},k={open:()=>{if(ee)return{ok:!1,reason:at.notReady};const c=S();if(!c)return{ok:!1,reason:at.notReady};const h=c.contextMenu;if(!h||typeof h!="object"||typeof h.open!="function")return{ok:!1,reason:at.operationUnavailable};try{const y=h.open();return y&&typeof y=="object"&&y.ok===!1?{ok:!1,reason:Zm(y.reason,at.operationUnavailable)}:{ok:!0}}catch{return{ok:!1,reason:at.operationUnavailable}}},close:()=>{if(ee)return;const c=S()?.contextMenu;if(!(!c||typeof c!="object"||typeof c.close!="function"))try{c.close()}catch{}},contextAt:sE},b=()=>{const c=S()?.doc;return c&&typeof c=="object"?c:null},T=()=>{const c=S()?.v2TrackedChanges;return c&&typeof c=="object"?c:null},L=()=>{const c=S();if(c?.editorVersion!==2)return null;const h=c.reviewWindow;return h&&typeof h=="object"?h:null},z=()=>{const c=L();return!c||typeof c.getSnapshot!="function"?null:Lt(()=>c.getSnapshot(),null)},G=()=>typeof L()?.getSnapshot=="function",U=c=>{const h=c?.status;return h==="ready"||h==="stale"?h:"pending"},j=()=>{const c=S()?.host;return c&&typeof c=="object"?c:null},Z=c=>{if(c.storyType!=="headerFooterPart"||typeof c.refId!="string")return null;const h=S(),y=j(),_=h?.pageLayout??y?.pageLayout;if(!_||typeof _!="object")return null;const E=_.getActiveRulerContext,F=y?.resolveHeaderFooterEditTarget;if(typeof E!="function"||typeof F!="function")return null;const H=Lt(()=>E.call(_),null);if(!H||typeof H.pageIndex!="number")return null;for(const ie of["header","footer"]){const he=Lt(()=>F.call(y,{pageIndex:H.pageIndex,kind:ie}),null);if(!(he?.status!=="ready"||he.refId!==c.refId||typeof he.sectionId!="string"||!["default","first","even"].includes(String(he.slotVariant))))return{kind:"story",storyType:"headerFooterSlot",section:{kind:"section",sectionId:he.sectionId},headerFooterKind:ie,variant:he.slotVariant}}return null},R=()=>{const c=j(),h=c?.getPendingInlineFormat;if(typeof h!="function")return null;const y=Lt(()=>h.call(c),null);return y&&typeof y=="object"?y:null},K=c=>{const h=o2(c);if(!h)return null;const y=R();if(!y||!(h in y))return null;const _=y[h];return c.inline?.kind==="toggle"?_===!0:_!=null&&_!==""},x=c=>{const h=o2(c);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=(c,h)=>{const y=j(),_=y?.setPendingInlineFormat;typeof _=="function"&&Lt(()=>_.call(y,c,h),void 0)},$=c=>{const h=j(),y=h?.clearPendingInlineFormat;typeof y=="function"&&Lt(()=>y.call(h,c),void 0)},J=new Set(["bold","italic","underline","strikethrough"]),Q=c=>{const h=R();if(!h)return;const y=Array.isArray(c.activeMarks)?c.activeMarks:[];let _=null;for(const E of Object.keys(h)){const F=h[E];let H;if(J.has(E)){if(F===!1)continue;H=y.includes(E)===(F===!0)}else if(e2(E)){if(F==null)continue;_||(_=Mo(c)),H=_[E]===F}else H=!1;H&&$(E)}},Y=()=>{const c=S()?.editCommands;return c&&typeof c=="object"?c:null},Ce=c=>{const h=Y();if(!h||typeof h.getSnapshot!="function")return null;const y=Lt(()=>h.getSnapshot(),null)?.commands?.[c];return y&&typeof y=="object"?y:null},fe=()=>Ce("lists.apply"),ve=c=>{const h=c?.value?.seed;return h==="bullet"||h==="ordered"?h:null},me=c=>{const h=eH[c];return h?Ce(h):null},Ee=()=>{const c=j();if(!c||typeof c.getTableContext!="function")return null;const h=Lt(()=>c.getTableContext(),null);return h&&typeof h=="object"?h:null},Fe=()=>{const c=Ee();if(!c||c.inTable!==!0)return null;const h=c.table,y=typeof h?.nodeId=="string"&&h.nodeId.length>0?h.nodeId:null;if(!y)return null;const _=c.row,E=c.column,F=c.cell,H=typeof _?.index=="number"&&Number.isInteger(_.index)?_.index:null,ie=typeof E?.index=="number"&&Number.isInteger(E.index)?E.index:null;if(H==null||ie==null)return null;const he=typeof F?.nodeId=="string"&&F.nodeId.length>0?F.nodeId:null,Me=c.cellRange;return{tableNodeId:y,rowIndex:H,columnIndex:ie,cellNodeId:he,mergeRange:vH(Me)}},Ze=new Map;let lt=null,et=null,Et=0,ae=0,Ie=0;const He=new Set,re=(c,h)=>c===h?!0:!c||!h?!1:c.id===h.id&&c.paintedEntityId===h.paintedEntityId&&nr(c.story)===nr(h.story),I=c=>Array.from(He).some(h=>re(h,c)),se=c=>{const h=j();if(typeof h?.getHandles!="function")return;const y=Lt(()=>h.getHandles(),null),_=y?.review;if(_){if(c){if(typeof _.setActiveReviewTarget!="function")return;const E=y?.layout;Lt(()=>_.setActiveReviewTarget({entityType:"trackedChange",entityId:c.id,...c.paintedEntityId?{paintedEntityId:c.paintedEntityId}:{},origin:"panel",layoutEpoch:typeof E?.generation=="number"?E.generation:0,story:c.story??{kind:"story",storyType:"body"}}),null);return}typeof _.getActiveReviewTarget!="function"||typeof _.clearActiveReviewTarget!="function"||Lt(()=>_.getActiveReviewTarget(),null)?.entityType==="trackedChange"&&Lt(()=>_.clearActiveReviewTarget(),void 0)}},N=(c,h)=>{et=c,Et+=1,Ie+=1,h?.invalidateQueuedNavigation!==!1&&(ae+=1)},q=new Set;let O,ee=!1,ye=null;const P=new Map,B=new Set;let ce=null,_e=null,Ae=!1,De=null,Ye=0,ot=null,gt=null,xt=null;const Tt=[],$t=()=>{if(Ae||ee)return;Ae=!0;const c=()=>{Ae=!1,ee||V("async-read-settled")};typeof queueMicrotask=="function"?queueMicrotask(c):Promise.resolve().then(c)},je=250,rn=5e3,Un=c=>{ee||De&&Ye<=c||(De&&clearTimeout(De),Ye=c,De=setTimeout(()=>{De=null,Ye=0,ee||V()},Math.max(0,c-Date.now())))},jt=new WeakMap;let En=0;const Gr=c=>{if(!c)return"none";let h=jt.get(c);return h==null&&(h=En+=1,jt.set(c,h)),`e${h}`};let br=0;const Ir=e.superdoc,Qe=xU(Ir),wt=()=>{Qe.abortController.abort("review-mutation-started"),Qe.inFlight=null},Pt=()=>{Qe.generation+=1,Qe.abortController=new AbortController,Qe.inFlight=null},cn=c=>{const h=Qe.activeMutationTokens;if(typeof c!="string"||c.length===0||h.has(c))return;const y=h.size===0;h.add(c),y&&wt()},pn=c=>{const h=Qe.activeMutationTokens;typeof c!="string"||!h.delete(c)||h.size===0&&Pt()},tn=c=>{const h=T(),y=h?.listTrackedChanges;if(typeof y!="function")return S()?.editorVersion===2?Promise.reject(new Error("v2-tracked-changes-bridge-pending")):c();if(Qe.activeMutationTokens.size>0)return Promise.reject(new Error("ui-review-catalog-superseded"));const _=Qe.generation,E=Qe.inFlight;if(E?.generation===_)return E.promise;const F=Qe.abortController.signal,H=Me=>{if(F.aborted||_!==Qe.generation||Me?.reason==="review-hydration-superseded")throw new Error("ui-review-catalog-superseded");return Me},ie=y.call(h,{blocking:!1,signal:F});if(!Fr(ie))return H(ie);const he=Promise.resolve(ie).then(H);return Qe.inFlight={generation:_,promise:he},he.then(()=>{Qe.inFlight?.promise===he&&(Qe.inFlight=null)},()=>{Qe.inFlight?.promise===he&&(Qe.inFlight=null)}),he};let wn=null,nn=new Set,rr=null,wo=0,Ue=null;const xe=()=>`${Gr(S())}|m${br}`,tt=()=>{wn=null,nn=new Set},Ct=c=>{for(const h of["trackChanges","trackChanges:all"]){const y=P.get(h);if(!y?.hasSettled||!Array.isArray(y.value))continue;const _=y.value.filter(E=>{const F=$r(E);return!F||!c.has(F)});_.length!==y.value.length&&P.set(h,{...y,value:_})}},Mt=c=>{const h=()=>{if(!ee)for(const F of[...q])F(O)},y=ph(c)?c:null,_=S()?.documentMutationReadiness,E=()=>{const F=globalThis.requestAnimationFrame;return typeof F!="function"?Promise.resolve():new Promise(H=>{let ie=!1;const he=()=>{ie||(ie=!0,clearTimeout(Me),H())},Me=setTimeout(he,250);F(()=>F(()=>setTimeout(he,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()},Ot=(c,h)=>{const y=O.trackChanges,_=y.items.filter(H=>{const ie=$r(H);return!ie||!c.has(ie)});if(_.length===y.items.length)return;et&&c.has(et.id)&&N(null);const E=new Set;for(const H of _){const ie=Qu(H),he=H,Me=ie.author??ie.authorEmail??he.author??he.authorEmail;typeof Me=="string"&&E.add(Me)}const F=y.items.length-_.length;O={...O,trackChanges:{...y,items:_,total:Math.max(_.length,y.total-F),activeId:y.activeId&&c.has(y.activeId)?null:y.activeId,authors:[...E]}},Mt(h)},Tn=c=>{const h=O.trackChanges,y=h.items.length>0||h.total!==0||h.activeId!==null||h.authors.length>0;rr=xe(),et!==null&&N(null),O={...O,trackChanges:{...h,items:[],total:0,activeId:null,authors:[]}},y&&Mt(c)},Vt=(c,h)=>{if(c.size===0)return;const y=xe(),_=wn===y?nn:new Set,E=new Set([...c].filter(F=>!_.has(F)));E.size!==0&&(wn=y,nn=new Set([..._,...E]),Ct(nn),Ot(E,h))},dn=c=>wn===c&&nn.size>0?nn:null,ao=c=>{const h=xe(),y=dn(h),_=c.map(Zu).filter(E=>{if(E==null)return!1;const F=$r(E);return F!=null&&!y?.has(F)});for(const E of["trackChanges","trackChanges:all"])P.set(E,{token:h,value:[..._],hasSettled:!0,inflightToken:null})},Jr=()=>`${xe()}|m${qn()}|s${wo}`,Vo=c=>JSON.stringify({t:c.target??null,s:c.selectionTarget??null}),ln=["contentControls:inRange:","query:","effInline:"],or=120,Zn=180,Ro=()=>{const c=j(),h=c?.getDocumentLoadingSnapshot;if(typeof h!="function")return"unknown";const y=Lt(()=>h.call(c),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,un=new Map,ir=new Map;let Wr=null;const lo={comments:0,trackChanges:0,contentControls:0},Qo=c=>{const h=xe();Xt.get(c)!==h&&(Xt.set(c,h),$t())},za=()=>{const c=P.get("comments");return c?.hasSettled?Array.isArray(c.value)&&c.value.length>0:c?.inflightToken!=null},Bl=(c,h)=>Xt.get(c)===h,Gi=()=>{const c=xe();let h=!1;for(const[y,_]of un){if(_!==c){un.delete(y);continue}if(ir.get(y)===c)continue;const E=P.get(y);!E?.hasSettled||E.token!==c||E.inflightToken!=null||(P.set(y,{...E,token:null,inflightToken:null}),ir.set(y,c),h=!0)}h&&$t()},ja=c=>{lo[c]+=1,Qo(c);let h=!1;return()=>{h||(h=!0,lo[c]=Math.max(0,lo[c]-1),lo[c]===0&&Xt.get(c)===xe()&&Xt.delete(c),$t())}},xi=c=>{Qo("contentControls")},ms=()=>{const c=P.get("trackChanges");c?.hasSettled||c?.inflightToken!=null||Qo("trackChanges")},Wi=()=>{const c=P.get("comments");c?.hasSettled||c?.inflightToken!=null||Qo("comments")},Se=6500,Ve=250;let pt=0,dt=0,Cn=!1,mn=null;const Er=()=>{if(ee||mn)return;const c=()=>{if(mn=null,ee)return;const h=Date.now()-pt;if(Uo()||h<Se){mn=setTimeout(c,Ve);return}Cn=!1,V()};mn=setTimeout(c,0)};let wr=null,Kr=null;const Jo=()=>{const c=j();if(!c||wr===c)return;Kr&&(Kr(),Kr=null),wr=c;const h=c.subscribeDocumentLoading;if(typeof h!="function"){wr=null,Cr(Se);return}try{const y=F=>{const H=F?.sourceStage;(H==="source-complete"||H==="source-failed"||H==="source-cancelled")&&(Wr=xe(),Gi(),pt=Math.max(pt,Date.now()),Er())},_=h.call(c,y);typeof _=="function"&&(Kr=_);const E=c.getDocumentLoadingSnapshot;typeof E=="function"&&y(Lt(()=>E.call(c),null))}catch{wr=null,Cr(Se)}},Co=()=>{const c=S()?.host,h=c?.getForegroundMutationState;if(typeof h!="function")return null;const y=Lt(()=>h.call(c),null);return{active:typeof y?.active=="number"?y.active:0,pending:typeof y?.pending=="number"?y.pending:0}},Uo=()=>{const c=Co();return!!(c&&(c.active>0||c.pending>0))},Cr=(c=or)=>{ee||ot||(ot=setTimeout(()=>{if(ot=null,ee)return;if(gt&&Uo()){Cr(),V();return}const h=gt;gt=null,h===Jr()&&Ri("selection",h,Yi,qi),V()},c))},zl=(c,h)=>{if(!Co())return!1;const y=`${c}\0${h}`;return B.has(y)?!1:(B.add(y),Cr(Zn),!0)},jl=c=>{if(ce==null||c===ce)return _e?.timer&&clearTimeout(_e.timer),_e=null,ce=c,!1;if(_e?.key===c)return _e.ready?(_e=null,ce=c,!1):!0;_e?.timer&&clearTimeout(_e.timer);const h={key:c,ready:!1,timer:null};return h.timer=setTimeout(()=>{ee||_e!==h||(h.timer=null,h.ready=!0,V())},Zn),_e=h,!0},eo=c=>CU(c),gs=()=>{Wa(),V()};let Ki=null,hi=null,vs=!1,Va=0,ys=!1,Ks=0;const Ho=()=>{Ki=null,vs=!1,Va+=1},bs=()=>{hi=null,ys=!1,Ks+=1},Ua=()=>{const c=S(),h=c?.documentMutationReadiness;if(!c||typeof h?.whenPainted!="function"||(Ki={editor:c,readiness:h,afterEpoch:typeof h.getRenderEpoch=="function"?Lt(()=>h.getRenderEpoch.call(h),null):null},vs))return;vs=!0;const y=Va;(async()=>{for(;!ee&&y===Va;){const E=Ki;if(Ki=null,!E){vs=!1;return}let F=!1;try{await E.readiness.whenPainted.call(E.readiness,typeof E.afterEpoch=="number"?{afterEpoch:E.afterEpoch}:void 0),F=!0}catch{}if(ee||y!==Va)return;if(S()!==E.editor){Ho();return}F&&gs()}})()},Ha=()=>{const c=S(),h=c?.documentMutationReadiness;if(!c||typeof h?.whenPainted!="function")return!1;if(hi={editor:c,readiness:h,afterEpoch:typeof h.getRenderEpoch=="function"?Lt(()=>h.getRenderEpoch.call(h),null):null},ys)return!0;ys=!0;const y=Ks;return(async()=>{for(;!ee&&y===Ks;){const E=hi;if(hi=null,!E){ys=!1;return}let F=!1;try{await E.readiness.whenPainted.call(E.readiness,typeof E.afterEpoch=="number"?{afterEpoch:E.afterEpoch}:void 0),F=!0}catch{}if(ee||y!==Ks)return;if(S()!==E.editor){bs();return}hi||(wo+=1,nd(),V(F?"post-paint-selection":"post-paint-selection-failed"))}})(),!0},$a=()=>{xt&&clearTimeout(xt),xt=setTimeout(()=>{xt=null,ee||gs()},500)},Ri=(c,h,y,_)=>{let E;try{E=y()}catch{E=void 0}if(!Fr(E)){const ie={token:h,value:_(E),hasSettled:!0,inflightToken:null,failedToken:null,failureCount:0,retryAtMs:0};return P.set(c,ie),ie}const F=P.get(c),H=F?.failedToken===h;return P.set(c,{token:F?.token??null,value:F?.value??null,hasSettled:F?.hasSettled??!1,inflightToken:h,failedToken:H?h:null,failureCount:H?F.failureCount??0:0,retryAtMs:0}),Promise.resolve(E).then(ie=>{const he=P.get(c);if(!he||he.inflightToken!==h)return;P.set(c,{token:h,value:_(ie),hasSettled:!0,inflightToken:null,failedToken:null,failureCount:0,retryAtMs:0});const{sink:Me,workerContext:ze}=Xm();if(Me){const Ne=Fa();Tt.push({key:c,settledAtMs:Ne,commandId:ze?.commandId??null,commandKind:ze?.commandKind??null}),Yb({stage:"superdoc-ui-async-read-settled",atMs:Ne,key:c,settledAtMs:Ne,commandId:ze?.commandId??null,commandKind:ze?.commandKind??null})}$t()},()=>{const ie=P.get(c);if(!ie||ie.inflightToken!==h)return;const he=ie.failedToken===h?(ie.failureCount??0)+1:1,Me=Math.min(rn,je*2**Math.min(he-1,8)),ze=Date.now()+Me;P.set(c,{...ie,inflightToken:null,failedToken:h,failureCount:he,retryAtMs:ze}),Un(ze)}),null},to=(c,h,y,_)=>{const E=P.get(c);if(E&&E.token===h&&E.hasSettled)return{value:E.value,status:"ready"};if(zU(c)&&!Bl(c,h)){if(Ro()==="loading")return Cn=!0,Jo(),E?.hasSettled?{value:E.value,status:"stale"}:{value:null,status:"pending"};if(Cn)return Er(),E?.hasSettled?{value:E.value,status:"stale"}:{value:null,status:"pending"};if(Date.now()-dt<Se)return Cn=!0,Er(),E?.hasSettled?{value:E.value,status:"stale"}:{value:null,status:"pending"}}if(Uo())return Cr(),E?.hasSettled?{value:E.value,status:"stale"}:{value:null,status:"pending"};if(E?.failedToken===h&&E.inflightToken==null&&(E.retryAtMs??0)>Date.now())return Un(E.retryAtMs),E.hasSettled?{value:E.value,status:"stale"}:{value:null,status:"pending"};if(!E&&c.startsWith("effInline:")&&jl(c))return{value:null,status:"pending"};if(!E&&zl(c,h))return{value:null,status:"pending"};if(!E||E.inflightToken!==h){const H=Ri(c,h,y,_);if(H)return{value:H.value,status:"ready"}}const F=P.get(c);return F?.hasSettled?{value:F.value,status:"stale"}:{value:null,status:"pending"}},qs=c=>{for(const h of P.keys())c(h)&&P.delete(h)},Ga=c=>{const h=Vo(c),y=RI(c);return new Set([`contentControls:inRange:${h}`,`query:${h}`,...y?[`effInline:${y}`]:[]])},Oc=c=>{const h=Ga(c);qs(y=>ln.some(_=>y.startsWith(_))&&!h.has(y));for(const y of B){const _=y.split("\0",1)[0];ln.some(E=>_.startsWith(E))&&!h.has(_)&&B.delete(y)}},pi=()=>{const c=S();c!==Ue&&(Ho(),bs(),Ue=c,P.clear(),De&&clearTimeout(De),De=null,Ye=0,_e?.timer&&clearTimeout(_e.timer),_e=null,ce=null,w=null,o=null,gt=null,B.clear(),Xt.clear(),un.clear(),ir.clear(),Wr=null,Cn=!1,Kr&&Kr(),Kr=null,wr=null,tt(),rr=null)},Wa=()=>{br+=1,un.clear(),ir.clear(),Wr=null,tt()},Vl=()=>{const c=rr===xe();Wa(),c&&(ao([]),rr=xe()),V()},mh=c=>{if(typeof c!="string"||c.length===0)return Xn("insertText requires a non-empty string.","INVALID_INPUT");if(qn()==="viewing")return Xn("The document is read-only.","DOCUMENT_READONLY");const h=b(),y=h?.insert;if(!h||typeof y!="function")return Xn("insert is unavailable.");const _=h.selection?.current;if(typeof _!="function")return Xn("selection.current is unavailable.");const E=H=>{const ie=H&&typeof H=="object"?H:null,he=ie?.selectionTarget??ie?.target??null;return!he||typeof he!="object"?Xn("insertText requires a live selection target.","PRECONDITION_FAILED"):Lt(()=>Oo(y.call(h,{type:"text",value:c,target:he}),Xn("insert failed.")),Xn("insert failed."))};let F;try{F=_.call(h.selection)}catch{return Xn("insertText could not resolve the live selection.","PRECONDITION_FAILED")}return Fr(F)?Promise.resolve(F).then(E,()=>Xn("insertText could not resolve the live selection.","PRECONDITION_FAILED")):E(F)},mi=(c,h)=>({payload:c,state:O,editor:S(),superdoc:t,context:h,ui:ye,execute:(y,_)=>Wc(y,_),executeAsync:(y,_)=>fg(y,_),doc:b(),selection:O.selection,documentMode:qn(),insertText:mh}),Ul=c=>c==="editing"||c==="suggesting"||c==="viewing"?c:null,qn=()=>{const c=S(),h=t&&typeof t=="object"?t:null,y=Ul(h?.config?.documentMode),_=Lt(typeof h?.getActiveRuntime=="function"?()=>{const H=h.getActiveRuntime();return typeof H?.getSnapshot=="function"?H.getSnapshot():null}:void 0,null),E=Ul(_?.documentMode),F=Ul(c?.options?.documentMode);return y&&E&&y!==E?y:E??y??F},Hl=()=>{const c=t&&typeof t=="object"?t:null,h=c?.interactionConfig?.comments;if(h&&typeof h.readOnly=="boolean")return h.readOnly===!0;const y=c?.config?.modules?.comments;return!!y&&typeof y=="object"&&y.readOnly===!0},Pc=()=>{if(qn()==="viewing")return at.documentReadonly;const c=(t&&typeof t=="object"?t:null)?.interactionConfig?.trackedChanges;return c&&typeof c.allowDecisions=="boolean"?c.allowDecisions?void 0:at.trackedChangeDecisionsDisabled:Hl()?at.documentReadonly:void 0},ed=()=>{const c=t&&typeof t=="object"?t:null,h=c?.interactionConfig?.comments;if(h&&typeof h.allowResolve=="boolean")return h.allowResolve===!1;const y=c?.config?.modules?.comments;return!!y&&typeof y=="object"&&y.allowResolve===!1},Fc=()=>qn()==="viewing"||Hl(),Nc=()=>Pc()!=null,qi=c=>c&&typeof c=="object"?c:null,Ys=(c,h)=>{if(!c)return{...FU,status:h};const y=c.target??null,_=typeof c.text=="string"?c.text:"";return{status:h,empty:c.empty===!0,target:y,selectionTarget:c.selectionTarget??null,activeMarks:Array.isArray(c.activeMarks)?c.activeMarks:[],activeCommentIds:Array.isArray(c.activeCommentIds)?c.activeCommentIds:[],activeChangeIds:Array.isArray(c.activeChangeIds)?c.activeChangeIds:[],quotedText:_}},Ka=()=>{const c=b()?.selection;return to("selection",Jr(),()=>c?.current?c.current({includeText:!0}):void 0,qi)},td=()=>{const{value:c,status:h}=Ka();return Ys(c,h)},Yi=()=>{const c=b()?.selection;return c?.current?c.current({includeText:!0}):void 0},$l=c=>{if(c.empty!==!0)return!1;const h=c.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},nd=c=>{const h=j(),y=h?.readLiveSelectionSyncSnapshot;if(typeof y!="function")return;const _=qi(Lt(()=>y.call(h),null));if(!_||!$l(_))return;const E=Jr(),F=Co(),H=!!(F&&(F.active>0||F.pending>0));if(H)gt=E,Cr();else if(gt=null,Ri("selection",E,Yi,qi))return;const ie=P.get("selection"),he=Array.isArray(_.activeMarks)&&_.activeMarks.length>0?_.activeMarks:Array.isArray(O.selection.activeMarks)?O.selection.activeMarks:[],Me=Array.isArray(_.activeCommentIds)?_.activeCommentIds:[],ze=$U(c),Ne=Gs(O.selection),qe=fh(_.selectionTarget)??fh(_.target),Xe=Ne?.range,We=qe?.range,Ge=!!(F&&F.active>0&&Ne&&qe&&Ne.blockId===qe.blockId&&nr(Ne.story)===nr(qe.story)&&typeof Xe?.start=="number"&&typeof We?.start=="number"&&Math.abs(We.start-Xe.start)<=2),it=ze!=null||Ge?O.selection.activeChangeIds.filter(Ke=>ze==null||Hs(O.trackChanges.items).aliasesFor(Ke).includes(ze)):[],ut=Array.isArray(_.activeChangeIds)&&_.activeChangeIds.length>0?_.activeChangeIds:it;P.set("selection",{token:E,value:{..._,activeMarks:he,activeCommentIds:Me,activeChangeIds:ut},hasSettled:!0,inflightToken:H?null:ie?.inflightToken??null})},Gl=async(c=0)=>{const h=b()?.selection,y=h?.current,_=Jr();if(typeof y!="function")return P.set("selection",{token:_,value:null,hasSettled:!0,inflightToken:null}),V(),O.selection;let E;try{E=y.call(h,{includeText:!0}),Fr(E)&&(E=await Promise.resolve(E))}catch{E=null}return ee?Ys(null,"pending"):Jr()!==_?c<1?Gl(c+1):O.selection:(P.set("selection",{token:_,value:qi(E),hasSettled:!0,inflightToken:null}),V(),O.selection)},Xi=()=>{const c=b()?.comments;return to("comments",xe(),()=>c?.list?c.list():void 0,h=>h&&Array.isArray(h.items)?h.items:[])},Yn=(c="trackChanges")=>{const h=xe(),y=b()?.trackChanges,_=T(),E=typeof _?.listTrackedChanges=="function"?_.listTrackedChanges:null,F=to(c,h,()=>E?tn(()=>y?.list?.({in:"all"})):y?.list?y.list({in:"all"}):void 0,H=>{const ie=H&&typeof H=="object"?H:null;if(ie?.complete===!1||ie?.sourceCoverageComplete===!1){if(un.set(c,h),Jo(),Wr===h||Ro()==="complete"){const he=()=>{ee||Gi()};typeof queueMicrotask=="function"?queueMicrotask(he):Promise.resolve().then(he)}}else un.get(c)===h&&un.delete(c);return ie&&Array.isArray(ie.items)?ie.items:[]});return un.get(c)===h&&F.status==="ready"?{...F,status:"stale"}:F},rd=c=>{const h=z(),y=G(),_=y?null:Xi(),E=y&&Array.isArray(h?.commentItems)?h.commentItems:null,F=y?E:_.value,H=y?U(h):_.status,ie=F??[],he=c.activeCommentIds,Me=P.get("comments"),ze=Me?.token===xe()&&Me.hasSettled&&Array.isArray(Me.value)?Me.value:null,Ne=lo.comments>0?ze:ie;lt&&Ne&&!Ne.some(Xe=>$r(Xe)===lt)&&(lt=null);const qe=lt??he[0]??null;return{status:Pl(H,c.status),listStatus:H,items:ie,total:ie.length,activeIds:he,activeId:qe}},Wl=new WeakMap,ws=c=>{const h=Wl.get(c);if(h)return h;const y=c.map(Zu).filter(_=>_!=null);return Wl.set(c,y),y},Xs=new WeakMap,Bc=(c,h)=>{const y=Xs.get(c);if(y?.suppressedIds===h)return y.value;const _=h?c.filter(E=>{const F=$r(E);return!F||!h.has(F)}):c;return Xs.set(c,{suppressedIds:h,value:_}),_},od=new WeakMap,id=c=>{const h=od.get(c);if(h)return h;const y=new Set;for(const E of c){const F=Qu(E),H=E,ie=F.author??F.authorEmail??H.author??H.authorEmail;typeof ie=="string"&&y.add(ie)}const _=[...y];return od.set(c,_),_},Mi=()=>{const c=xe();if(G()){const _=P.get("trackChanges"),E=_?.token===c&&_.hasSettled&&Array.isArray(_.value)?_.value:z()?.trackedChangeItems;return Array.isArray(E)?ws(E):null}const{value:h,status:y}=Yn("trackChanges:all");return y==="ready"?ws(h??[]):null},sd=c=>{const h=xe(),y=dn(h),_=z(),E=G(),F=E?null:Yn(),H=E&&Array.isArray(_?.trackedChangeItems)?_.trackedChangeItems:null,ie=E?H:F.value,he=E?U(_):F.status,Me=Bc(ws(ie??[]),y),ze=Mi(),Ne=et;if(Ne&&!He.has(Ne)){const It=P.get("trackChanges"),_n=It?.token===h&&It.hasSettled&&Array.isArray(It.value)?Bc(ws(It.value),y):null,An=lo.trackChanges>0?_n:Ne.story?ze:Me;An&&!An.some(Sr=>Ei(Sr,Ne.id,Ne.story))&&N(null)}const qe=ze??Me,Xe=Fl(qe,fs(c)),We=rr===h?[]:y?c.activeChangeIds.filter(It=>!y.has(It)):c.activeChangeIds,Ge=We.map(It=>Xe.toPublicId(It)??It),it=et?.story?Fl(qe,et.story):Hs(qe),ut=et?it.toPublicId(et.id)??et.id:null,Ke=qU({selectionIds:We,publicIds:Ge,selection:c,bodyItems:Me,allStoryItems:ze}),_t=ut??Ke;return{status:Pl(he,c.status),items:Me,total:Me.length,activeId:_t,authors:id(Me)}},Kl=(c,h)=>{if(!G())return h;Qo("comments");const y=Xi(),_=y.value??h.items;return{status:Pl(y.status,c.status),listStatus:y.status,items:_,total:_.length,activeIds:c.activeCommentIds,activeId:lt??c.activeCommentIds[0]??null}},Zi=(c,h)=>{if(!G())return h;Qo("trackChanges");const y=Yn(),_=dn(xe()),E=Bc(ws(y.value??h.items),_),F=et?.story?Fl(E,et.story):Hs(E),H=et?F.toPublicId(et.id)??et.id:h.activeId;return{status:Pl(y.status,c.status),items:E,total:E.length,activeId:H,authors:id(E)}};let zc=null,ad=[];const jc=(c,h)=>{const y=xe();return h==="ready"?(zc=y,ad=c,{items:c,status:h}):h==="pending"&&zc===y?{items:ad,status:"stale"}:{items:c,status:h}},gh=c=>{const h=b()?.contentControls,{value:y,status:_}=to("contentControls",xe(),()=>h?.list?h.list():void 0,Ne=>Ne&&Array.isArray(Ne.items)?Ne.items:[]),E=y??[],{items:F,status:H}=ql(h,c),ie=new Map(F.map(Ne=>[Ne.id,Ne])),he=new Set(E.map(Ne=>Ne.id)),Me=[...E.map(Ne=>ie.get(Ne.id)??Ne),...F.filter(Ne=>!he.has(Ne.id))],ze=F.map(Ne=>Ne.id);return{status:Pl(_,H,c.status),items:Me,total:Me.length,activeId:ze[0]??null,activeIds:ze}},qa=(c,h)=>{if(!c||typeof c.listInRange!="function")return{lockModesById:new Map,rows:[],status:"ready"};const y=XU(h);if(!y)return{lockModesById:new Map,rows:[],status:"ready"};const{value:_,status:E}=to(`contentControls:inRange:${Vo(h)}`,xe(),()=>c.listInRange(y),ie=>ie&&Array.isArray(ie.items)?ie.items:[]),F=_??[],H=new Map;for(const ie of F)typeof ie?.id=="string"&&H.set(ie.id,typeof ie.lockMode=="string"?ie.lockMode:"unlocked");return{lockModesById:H,rows:F,status:E}},ql=(c,h)=>{const{rows:y,status:_}=qa(c,h),E=h.selectionTarget,F=h.target;let H=E?.start;if(E){if(E.kind!=="selection"||H?.kind!=="text"||typeof H.blockId!="string"||typeof H.offset!="number")return jc([],_)}else{const Ge=F?.kind==="text"&&Array.isArray(F.segments)?F.segments[0]:void 0,it=Ge?.range;if(typeof Ge?.blockId!="string"||typeof it?.start!="number")return jc([],_);H={kind:"text",blockId:Ge.blockId,offset:it.start,story:F?.story}}const ie=(F?.coordinateSpace!=="tracked"&&Array.isArray(F?.segments)?F.segments:[]).find(Ge=>Ge.blockId===H.blockId),he=ie?.range,Me=ie&&typeof ie.blockId=="string"&&typeof he?.start=="number"?{kind:"text",blockId:ie.blockId,offset:he.start,story:F?.story??H.story}:null,ze=(E?E.coordinateSpace:F?.coordinateSpace)==="tracked"?"tracked":"visible",Ne=ze==="tracked"?Me:H,qe=Nr(h),Xe=qe.indexOf((Ne??H).blockId),We=y.map((Ge,it)=>({item:Ge,index:it})).filter(({item:Ge})=>{const it=Ge.selectionTarget,ut=it?.coordinateSpace==="tracked"?"tracked":"visible";if(ut==="tracked"&&ze!=="tracked")return!1;const Ke=ut==="tracked"?H:Ne;if(!Ke)return!1;const _t=it?.start,It=it?.end;if(it?.kind!=="selection"||_t?.kind!=="text"||It?.kind!=="text"||typeof _t.blockId!="string"||typeof It.blockId!="string"||typeof _t.offset!="number"||typeof It.offset!="number"||nr(it.story??_t.story??It.story)!==nr(E?.story??Ke.story))return!1;if(_t.blockId===It.blockId){if(Ke.blockId!==_t.blockId)return!1;const Sr=Math.min(_t.offset,It.offset),Mr=Math.max(_t.offset,It.offset);return Sr===Mr?Ke.offset===Sr:Ke.offset>=Sr&&Ke.offset<Mr}if(Ke.blockId===_t.blockId)return Ke.offset>=_t.offset;if(Ke.blockId===It.blockId)return Ke.offset<It.offset;if(Xe===-1)return!1;const _n=qe.indexOf(_t.blockId),An=qe.indexOf(It.blockId);return _n!==-1&&An!==-1?Xe>Math.min(_n,An)&&Xe<Math.max(_n,An):_n!==-1?Xe>_n:An!==-1?Xe<An:!0}).sort((Ge,it)=>{const ut=Ge.item.selectionTarget,Ke=it.item.selectionTarget,_t=ut.start.kind==="text"&&ut.end.kind==="text"&&ut.start.blockId===ut.end.blockId,It=Ke.start.kind==="text"&&Ke.end.kind==="text"&&Ke.start.blockId===Ke.end.blockId;if(_t!==It)return _t?-1:1;if(Ge.item.kind!==it.item.kind)return Ge.item.kind==="inline"?-1:1;if(_t&&It&&ut.start.kind==="text"&&ut.end.kind==="text"&&Ke.start.kind==="text"&&Ke.end.kind==="text"){const _n=Math.abs(ut.end.offset-ut.start.offset),An=Math.abs(Ke.end.offset-Ke.start.offset);if(_n!==An)return _n-An}return it.index-Ge.index}).map(({item:Ge})=>Ge);return jc(We,_)},ld=()=>{const c=t?.fonts;return{options:_H(kH(Lt(c?.getDocumentFontOptions?()=>c.getDocumentFontOptions():void 0,[])),SH(Lt(c?.getFontFamilyOptions?()=>c.getFontFamilyOptions():void 0,[]))),sizeOptions:AH}},Vc=()=>{const c=Lt(t?.getZoomState?()=>t.getZoomState():void 0,null),h=typeof c?.value=="number"?c.value:100,y=c?.mode;return{mode:y==="manual"||y==="fit-width"?y:y==="fixed"?"manual":null,value:h,min:typeof c?.min=="number"?c.min:10,max:typeof c?.max=="number"?c.max:100}},cd=()=>Lt(t?.getMeasurementUnit?()=>t.getMeasurementUnit():void 0,"in")==="cm"?"cm":"in",ud=()=>{const c=S();return{ready:c!=null,mode:qn(),dirty:c?!!c.isDirty:!1}},Yl=c=>{const h=c.quotedText;if(typeof h!="string"||h.length===0)return null;const y=Xu(c);if(y.length===0||!Lc(y.map(F=>F.blockId)))return null;const _=c.target,E=y.length===1?To(y[0].blockId,_?.story):void 0;return{select:{type:"text",pattern:h,mode:"contains",caseSensitive:!0},...E?{within:E}:{},require:"any"}},vh=c=>{const h=b()?.query;if(typeof h?.match!="function")return null;const y=Yl(c);if(!y)return null;const{value:_}=to(`query:${Vo(c)}`,xe(),()=>h.match(y),E=>E&&typeof E=="object"?E:null);return MI(_,c)},Xl=c=>{const h=j(),y=new Set(Nr(c));if(y.size===0)return{};const _=h?.readMountedProjectionBlocksByIds,E=h?.readMountedProjectionBlocks;if(typeof _!="function"&&typeof E!="function")return{};const F=Lt(()=>{if(typeof _!="function")return E.call(h);const Ge=hs(c);return Ge?_.call(h,[...y],Ge):_.call(h,[...y])},null);if(!Array.isArray(F))return{};const H=r2(F),ie=Ge=>{const it={},ut=t2(Ge.fontFamily);ut&&(it.fontFamily=ut);const Ke=aH(Ge.fontSize);return Ke&&(it.fontSize=Ke),typeof Ge.color=="string"&&Ge.color.trim()!==""&&(it.color=Ge.color.trim().toUpperCase()),typeof Ge.highlight=="string"&&Ge.highlight.trim()!==""&&(it.highlight=Ge.highlight.trim().toUpperCase()),it},he=Gs(c),Me=he&&typeof he.range?.start=="number"?he.range.start:null;if(he&&Me!==null&&y.has(he.blockId)){const Ge=H.find(ut=>Dc(ut,he.blockId)),it=Ge&&Array.isArray(Ge.runs)?Ge.runs:null;if(it&&it.length>0&&it.every(ut=>ut?.kind==="text"||ut?.kind==="tab")){let ut=0,Ke=null;for(const _t of it){const It=eg(_t);if(Me>=ut&&Me<ut+It){Ke=_t;break}ut+=It}if(!Ke){for(let _t=it.length-1;_t>=0&&!Ke;_t-=1)it[_t]?.kind==="text"&&(Ke=it[_t]);Ke??=it[it.length-1]??null}return Ke?ie(Ke):{}}}const ze=Xu(c);if(ze.length>0){const Ge=new Set,it=new Set;let ut=!1,Ke=!0;for(const _t of ze){const It=H.find(Sr=>Dc(Sr,_t.blockId));if(!It)return{};const _n=Array.isArray(It.runs)?It.runs:[];if(_n.length===0)continue;if(!_n.every(Sr=>Sr?.kind==="text"||Sr?.kind==="tab")){Ke=!1;break}let An=0;for(const Sr of _n){const Mr=eg(Sr),Lr=An,Br=An+Mr;if(Lr<_t.end&&Br>_t.start){ut=!0;const ii=ie(Sr);ii.fontFamily&&Ge.add(ii.fontFamily),ii.fontSize&&it.add(ii.fontSize)}An=Br}}if(Ke&&ut){const _t={};return Ge.size===1&&(_t.fontFamily=[...Ge][0]),it.size===1&&(_t.fontSize=[...it][0]),_t}}const Ne=new Set,qe=new Set;let Xe=!1;for(const Ge of H){if(![...y].some(ut=>Dc(Ge,ut)))continue;const it=Array.isArray(Ge.runs)?Ge.runs:[];for(const ut of it){if(ut?.kind!=="text")continue;Xe=!0;const Ke=ie(ut);Ke.fontFamily&&Ne.add(Ke.fontFamily),Ke.fontSize&&qe.add(Ke.fontSize)}}if(!Xe)return{};const We={};return Ne.size===1&&(We.fontFamily=[...Ne][0]),qe.size===1&&(We.fontSize=[...qe][0]),We},dd=c=>{const h=j(),y=new Set(Nr(c));if(y.size===0)return{};const _=h?.readMountedProjectionBlocksByIds,E=h?.readMountedProjectionBlocks;if(typeof _!="function"&&typeof E!="function")return{};const F=Lt(()=>{if(typeof _!="function")return E.call(h);const We=hs(c);return We?_.call(h,[...y],We):_.call(h,[...y])},null);if(!Array.isArray(F))return{};const H=r2(F),ie=We=>({bold:We.bold===!0,italic:We.italic===!0,underline:We.underline!=null,strikethrough:We.strike===!0}),he=We=>{const Ge={};for(const it of hh){const ut=We[it];ut.size===1&&(Ge[it]=[...ut][0])}return Ge},Me=Gs(c),ze=Me&&typeof Me.range?.start=="number"?Me.range.start:null;if(Me&&ze!==null&&y.has(Me.blockId)){const We=H.find(it=>Dc(it,Me.blockId)),Ge=We&&Array.isArray(We.runs)?We.runs:null;if(Ge&&Ge.length>0&&Ge.every(it=>it?.kind==="text"||it?.kind==="tab")){let it=0,ut=null;for(const Ke of Ge){const _t=eg(Ke);if(ze>=it&&ze<it+_t){ut=Ke;break}it+=_t}if(!ut){for(let Ke=Ge.length-1;Ke>=0&&!ut;Ke-=1)Ge[Ke]?.kind==="text"&&(ut=Ge[Ke]);ut??=Ge[Ge.length-1]??null}return ut?ie(ut):{}}}const Ne=Xu(c);if(Ne.length>0){const We={bold:new Set,italic:new Set,underline:new Set,strikethrough:new Set};let Ge=!1,it=!0;for(const ut of Ne){const Ke=H.find(_n=>Dc(_n,ut.blockId));if(!Ke)return{};const _t=Array.isArray(Ke.runs)?Ke.runs:[];if(_t.length===0)continue;if(!_t.every(_n=>_n?.kind==="text"||_n?.kind==="tab")){it=!1;break}let It=0;for(const _n of _t){const An=eg(_n),Sr=It,Mr=It+An;if(Sr<ut.end&&Mr>ut.start){Ge=!0;const Lr=ie(_n);for(const Br of hh)We[Br].add(Lr[Br])}It=Mr}}if(it&&Ge)return he(We)}const qe={bold:new Set,italic:new Set,underline:new Set,strikethrough:new Set};let Xe=!1;for(const We of H){if(![...y].some(it=>Dc(We,it)))continue;const Ge=Array.isArray(We.runs)?We.runs:[];for(const it of Ge){if(it?.kind!=="text")continue;Xe=!0;const ut=ie(it);for(const Ke of hh)qe[Ke].add(ut[Ke])}}return Xe?he(qe):{}},fd=(c,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=Xl(c),_={...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(!c.empty&&(_.fontFamily===void 0||_.fontSize===void 0)){const E=yh(c);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"}},hd=["fontFamily","fontSize","bold","italic","underline","strikethrough"],Zl=c=>{const h=c.selectionTarget;if(!h)return{value:null,status:"ready"};const y=yr(b(),"format.readEffectiveInlineUniformity");if(!y)return{value:null,status:"ready"};const _=RI(c)??Vo(c);return to(`effInline:${_}`,xe(),()=>y({target:h,offsetSpace:"selection",keys:hd}),E=>E&&typeof E=="object"?E:null)},yh=c=>{const{value:h,status:y}=Zl(c);if(!h||h.success!==!0)return{values:null,status:y};const _=h.values,E=F=>{const H=_?.[F];if(!(!H||H.state!=="uniform"||typeof H.value!="string"))return F==="fontFamily"?t2(H.value):H.value};return{values:{fontFamily:E("fontFamily"),fontSize:E("fontSize")},status:y}},pd=c=>{const{value:h,status:y}=Zl(c);if(!h||h.success!==!0)return{values:null,status:y};const _=h.values,E={};for(const F of hh){const H=_?.[F];H?.state==="uniform"&&(H.value==="true"||H.value==="false")&&(E[F]=H.value==="true")}return{values:E,status:y}},Uc=(c,h)=>{const y=c.activeMark;if(!y||!hh.includes(y))return null;const _=y,E=dd(h)[_];if(E!==void 0)return E;const{values:F}=pd(h),H=F?.[_];return H!==void 0?H:null},bh=async c=>{const h=c.selectionTarget;if(!h)return null;const y=yr(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}},wh=(c,h,y)=>{const _=y.values;for(const E of["fontFamily","fontSize"]){if(h[E]!==void 0)continue;const F=_?.[E];F?.state==="uniform"&&typeof F.value=="string"?c[E]=E==="fontFamily"?t2(F.value):F.value:delete c[E]}},md=c=>fd(c,LI(vh(c),c)),Mo=c=>md(c).values,gd=async c=>{const h=b()?.query,y=Yl(c);if(typeof h?.match!="function"||!y)return Mo(c);try{const _=await Promise.resolve(h.match(y)),E=LI(MI(_&&typeof _=="object"?_:null,c),c),F=fd(c,E);if(F.effectiveUniformityStatus!=="ready"&&(E.fontFamily===void 0||E.fontSize===void 0)){const H=await bh(c);H&&wh(F.values,E,H)}return F.values}catch{return Mo(c)}},Zs=async c=>{const h=b();if(h)return typeof h.getNode=="function"?await Promise.resolve(h.getNode(c)):await Promise.resolve(h.getNodeById?.({nodeId:c.nodeId,nodeType:c.nodeType}))},vd=c=>{const h=b()?.query;if(typeof h?.match!="function")return"ready";const y=Yl(c);if(!y)return"ready";const{status:_}=to(`query:${Vo(c)}`,xe(),()=>h.match(y),E=>E&&typeof E=="object"?E:null);return _},yd=c=>{const h=md(c),y=h.values;if(c.empty)return h;const _=Ba(c);return _?c.status==="ready"&&vd(c)==="ready"&&h.effectiveUniformityStatus==="ready"?(w={key:_,values:y},h):w&&w.key===_?{...h,values:{...w.values,...y}}:h:h},Ya=c=>{const h=b(),y=yd(c),_=y.values;c.status==="ready"&&!c.empty&&vd(c)==="ready"&&y.effectiveUniformityStatus==="ready"&&(v=_,C=`${Rc(c)}:${xe()}`);const E=h?.contentControls,{lockModesById:F}=qa(E,c),H={};for(const ie of co())H[ie]=ko(ie,h,c,_,F);return H},Qi=c=>c?at.operationUnavailable:S()?at.documentApiUnavailable:at.notReady,Ch=c=>c==="contentLocked"||c==="sdtContentLocked",Qs=c=>{for(const h of c.values())if(Ch(h))return at.contentControlLocked},bd=(c,h,y,_,E)=>{if(!h)return c.scope==="all"?at.bulkDecisionsDisabled:Qi(E);if(y)return y;if(c.scope!=="all"&&_.activeChangeIds.length===0)return at.selectionRequired},Hc=c=>{const h=O?.trackChanges?.items?.find(H=>$r(H)===c);if(h)return Qu(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(H=>$r(H)===c);if(!E)return null;const F=Zu(E);return F?Qu(F):E},Ql=(c,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 F=Hc(E)??{id:E},H=HU(F,_),ie=c==="accept"?H?"RESOLVE_OWN":"RESOLVE_OTHER":H?"REJECT_OWN":"REJECT_OTHER";let he;try{he=y.call(t,{permission:ie,trackedChange:F,comment:null})}catch{return}if(he===!1)return at.permissionDenied}},Js=c=>{const h=j(),y=Lt(typeof h?.getCapabilities=="function"?()=>h.getCapabilities():void 0,null)?.editableSubset?.commands;if(Array.isArray(y))return y.find(_=>_?.command===c||_?.id===c)??null;if(y&&typeof y=="object"){const _=y[c];return _&&typeof _=="object"?_:null}return null},ei=(c,h)=>{if(c.scope!=="all"||typeof h?.[`${c.kind}All`]=="function")return;const y=Js(`trackedChanges.${c.kind}All`);if(!(y&&(y.status==="supported"||y.enabled===!0)))return at.bulkDecisionsDisabled},ko=(c,h,y,_,E=new Map)=>{if(Ze.has(c))return en({supported:!0,enabled:!0,...Lt(Ze.get(c).getState?()=>Ze.get(c).getState(mi(void 0)):void 0,{})},"custom");const F=qn()==="viewing",H=wI(c);if(H&&typeof Y()?.lists?.apply=="function"){const Xe=fe(),We=typeof Xe?.shippedStatus=="string"?Xe.shippedStatus:null,Ge=We!=="not-shipped"&&We!=="disabled",it=Ge&&(typeof Xe?.enabled=="boolean"?Xe.enabled:!0),ut=Ge?ve(Xe):null;return en(F?{enabled:!1,active:ut===H,supported:Ge,value:Xe?.value,reason:at.documentReadonly}:{enabled:it,active:ut===H,supported:Ge,value:Xe?.value},"builtin")}const ie=tg(c);if(ie){const Xe=h?.trackChanges,We=typeof Xe?.decide=="function"||typeof Xe?.[ie.kind]=="function",Ge=typeof Xe?.decide=="function"||typeof Xe?.[`${ie.kind}All`]=="function",it=ie.scope==="all"?Ge:We,ut=ei(ie,Xe)??bd(ie,it,Pc(),y,h)??(ie.scope==="all"?void 0:Ql(ie.kind,y.activeChangeIds));return en({enabled:ut==null,active:!1,supported:it,reason:ut},"builtin")}if(c==="copy-format")return qn()==="viewing"?en({supported:!0,enabled:!1,active:!1},"builtin"):S()?en({supported:!0,enabled:!0,active:p.mode!=="idle"},"builtin"):en({supported:!0,enabled:!1,active:!1,reason:at.notReady},"builtin");const he=Gu(c);if(!he)return en({enabled:!1,active:!1,supported:!1,reason:at.commandUnsupported},"unsupported");if(he.disposition!=="routed")return en({enabled:!1,active:!1,supported:!1,reason:he.reason??at.commandUnsupported},he.disposition==="unsupported"?"unsupported":"builtin");if(he.instanceRoute)return no(he);if(he.table)return Nn(he,h,F);if(he.inline?.kind==="clear"){if(he.mutates&&F)return en({enabled:!1,active:!1,supported:!0,reason:at.documentReadonly},"builtin");const Xe=Qs(E);if(Xe)return en({enabled:!1,active:!1,supported:!0,reason:Xe},"builtin");const We=Nr(y).length>0||Ju(y)!=null;return en({enabled:We,active:!1,supported:!0,reason:We?void 0:at.selectionRequired},"builtin")}const Me=he.docRoute;if(!Me)return en({enabled:!1,active:!1,supported:!1,reason:at.commandUnsupported},"unsupported");if(yr(h,Me)==null)return en({enabled:!1,active:!1,supported:!1,reason:Qi(h)},"builtin");const ze=me(c);if(ze){const Xe=ze.shippedStatus,We=Xe!=="not-shipped"&&Xe!=="disabled",Ge=typeof ze.enabled=="boolean"?ze.enabled:!0,it=c==="undo"||c==="redo",ut=it&&ze.historyResolved===!1,Ke=it&&We&&Ge===!1&&ze.reason===null&&!ut,_t=ze.reason===void 0?void 0:Ke?at.historyEmpty:ut?at.notReady:Zm(ze.reason,at.commandUnsupported);return he.mutates&&F?en({enabled:!1,active:!1,supported:We,reason:at.documentReadonly},"builtin"):en({enabled:We&&Ge,active:!1,supported:We,reason:_t},"builtin")}const Ne=ec(he,h,y),qe=Sh(he,h,y,_);if(he.list?.mode==="indent"||he.list?.mode==="outdent")return vt(he,h,F,y,Ne,qe);if(he.list?.mode==="toggle-seed")return Gt(he,h,F,y,Ne,qe);if(he.mutates&&F)return en({enabled:!1,active:Ne,supported:!0,value:qe,reason:at.documentReadonly},"builtin");if(he.inline&&!Ju(y)){const Xe=Qs(E);return en(Xe?{enabled:!1,active:Ne,supported:!0,value:qe,reason:Xe}:Nr(y).length>0&&typeof j()?.setPendingInlineFormat=="function"?{enabled:!0,active:Ne,supported:!0,value:qe}:{enabled:!1,active:Ne,supported:!0,value:qe,reason:at.rangeSelectionRequired},"builtin")}if((he.blockParagraph||he.list)&&Nr(y).length===0)return en({enabled:!1,active:Ne,supported:!0,value:qe,reason:at.selectionRequired},"builtin");if(he.link&&!Ne&&Jb(y).length===0&&!Gs(y))return en({enabled:!1,active:Ne,supported:!0,reason:at.rangeSelectionRequired},"builtin");if(he.inline){const Xe=Qs(E);if(Xe)return en({enabled:!1,active:Ne,supported:!0,value:qe,reason:Xe},"builtin")}return en({enabled:!0,active:Ne,supported:!0,value:qe},"builtin")};function kh(c,h){const y=c.address?.anchor,_=y?.start,E=y?.end,F=typeof _?.blockId=="string"?_.blockId:null,H=typeof E?.blockId=="string"?E.blockId:null;if(!F||!H)return!1;const ie=typeof _?.offset=="number"?_.offset:null,he=typeof E?.offset=="number"?E.offset:null;if(ie==null||he==null)return!1;const Me=h.target,ze=Me&&Array.isArray(Me.segments)?Me.segments:[];for(const Ne of ze){const qe=typeof Ne?.blockId=="string"?Ne.blockId:null;if(!qe)continue;const Xe=Ne.range,We=typeof Xe?.start=="number"?Xe.start:null,Ge=typeof Xe?.end=="number"?Xe.end:null;if(!(We==null||Ge==null)){if(F!==H){if(qe===F&&Ge>ie||qe===H&&We<he)return!0;continue}if(qe===F){if(We===Ge){if(We>=ie&&We<=he)return!0;continue}if(Math.max(We,ie)<Math.min(Ge,he))return!0}}}return!1}const Jl=(c,h)=>{const y=c?.hyperlinks;if(!y||typeof y.list!="function")return null;const _=Nr(h);if(!Lc(_))return null;for(const E of _){const F={kind:"block",nodeType:"paragraph",nodeId:E},{value:H}=to(`hyperlinks:${E}`,xe(),()=>y.list({within:F}),he=>he&&typeof he=="object"?he:null),ie=(H&&Array.isArray(H.items)?H.items:[]).find(he=>kh(he,h));if(ie)return ie}return null},ec=(c,h,y)=>{if(c.link)return Jl(h,y)!=null;if(c.list?.mode==="toggle-seed"&&c.list.seed)return X(h,y)===c.list.seed;const _=K(c);if(_!==null)return _;const E=r.get(c.id),F=Ba(y);if(F&&E?.selectionSignature===F)return E.active;const H=Uc(c,y);return H!==null?H:IH(c,y)},Sh=(c,h,y,_)=>{if(c.inline&&e2(c.inline.key)){const E=x(c);if(E!==void 0)return E;const F=_[c.inline.key];if(F!==void 0)return F;const H=Ba(y),ie=H?n.get(c.inline.key):void 0;if(H&&ie?.selectionSignature===H)return ie.value}if(c.id==="linked-style"){const{style:E}=gi(y,on().cache);return!E.styleId||E.mixed?void 0:{styleId:E.styleId,styleName:E.styleName}}if(c.id==="text-align")return Be(h,y);if(c.id==="link")return On(h,y)??void 0},Ji=(c,h,y)=>{const _=c?.lists;if(!_)return{value:null,status:"ready"};const E=y.storyType==="body",F=typeof _.getStateInStory=="function"?()=>_.getStateInStory({target:Na(h),story:y}):E&&typeof _.getState=="function"?()=>_.getState({target:Na(h)}):null;if(!F)return{value:null,status:"ready"};const{value:H,status:ie}=to(`lists:${nr(y)}:${h}`,xe(),F,he=>he&&typeof he=="object"?he:null);return{value:H?.success===!0?H:null,status:ie}},wd=(c,h,y)=>Ji(c,h,y).value,A=(c,h,y)=>{const _=wd(c,h,y);return!_||_.isListItem!==!0?null:_.seed==="bullet"||_.seed==="ordered"?_.seed:null},M=(c,h,y)=>{const _=Ji(c,h,y),E=_.value;return{value:E&&typeof E.isListItem=="boolean"?E.isListItem:null,status:_.status}},X=(c,h)=>{const y=Nr(h);if(y.length===0||!Lc(y))return null;const _=fs(h),E=A(c,y[0],_);if(E!=="bullet"&&E!=="ordered")return null;for(const F of y.slice(1))if(A(c,F,_)!==E)return null;return E},oe=(c,h,y)=>{if(!c)return{value:null,status:"ready",refreshing:!1};const _=nr(y),E=_==="story:body";if(E&&typeof c.getNodeById!="function")return{value:null,status:"ready",refreshing:!1};if(!E&&typeof c.getNode!="function")return{value:null,status:"ready",refreshing:!1};const F=`node:${_}:${h}`,H=xe(),ie=to(F,H,()=>E?c.getNodeById({nodeId:h,nodeType:"paragraph"}):c.getNode(To(h,y)),Me=>Me&&typeof Me=="object"?Me:null),he=P.get(F);return{...ie,refreshing:ie.status==="stale"&&he?.inflightToken===H&&he.failedToken!==H}},ne=c=>c==="left"||c==="center"||c==="right"||c==="justify"?c:void 0,ue=c=>c==="start"||c==="end"||c==="distributed"||c==="numTab"||c==="lowKashida"||c==="mediumKashida"||c==="highKashida"||c==="thaiDistribute",le=(c,h)=>{const y=j(),_=y?.readMountedProjectionBlocksByIds;if(typeof _!="function")return null;const E=hs(c),F=Lt(()=>E?_.call(y,[...h],E):_.call(y,[...h]),null);if(!Array.isArray(F))return new Map;const H=r2(F),ie=new Map;for(const he of h){const Me=H.find(Xe=>Dc(Xe,he));if(!Me)continue;const ze=Me.attrs,Ne=ne(ze?.alignment),qe=n9(ze);ie.set(he,Ne??(qe==="rtl"?"right":"left"))}return ie},de=(c,h,y,_)=>{const{value:E,status:F,refreshing:H}=oe(c,h,y),ie=_?.get(h);if(F==="pending")return ie?{status:"uniform",value:ie}:{status:"pending"};if(F==="stale"&&!H)return{status:"pending"};if(F==="stale"&&ie)return{status:"uniform",value:ie};if(F==="stale"&&_&&!ie)return{status:"unavailable"};if(!E)return{status:"unavailable"};const he=E.node;if(!he)return{status:"unavailable"};const Me=he.kind;if(Me!=="paragraph"&&Me!=="heading")return{status:"unavailable"};const ze=he[Me];if(!ze||typeof ze!="object")return{status:"unavailable"};const Ne=ze.props?.alignment;if(Ne==null)return ie?{status:"uniform",value:ie}:{status:"unavailable"};const qe=ne(Ne);return qe?{status:"uniform",value:qe}:ue(Ne)&&ie?{status:"uniform",value:ie}:{status:"unavailable"}},we=(c,h)=>{const y=Nr(h);if(y.length===0||!Lc(y))return{status:"unavailable"};const _=fs(h),E=le(h,y),F=de(c,y[0],_,E);if(F.status!=="uniform")return F;for(const H of y.slice(1)){const ie=de(c,H,_,E);if(ie.status!=="uniform")return ie;if(ie.value!==F.value)return{status:"mixed"}}return F},Te=c=>{const h=Nr(c);return h.length===0?null:`${nr(fs(c))}:${h.join(",")}`},Be=(c,h)=>{const y=we(c,h),_=y.status==="uniform"?y.value:void 0,E=o;if(!E)return _;const F=Te(h);return F&&F!==E.selectionSignature?(o=null,_):!F||!E.settled?E.value:y.status!=="pending"?(o=null,_):E.value},Re=(c,h)=>{const y=ne(h),_=Te(c),E=Nr(c);if(!y||!_||E.length===0)return null;const F=++i;return o={selectionSignature:_,value:y,generation:F,settled:!1,canReconcile:Lc(E)},V(),F},rt=(c,h)=>{if(c==null)return;const y=o;if(!(!y||y.generation!==c)){if(!xo(h)){o=null;return}if(!y.canReconcile){o=null;return}y.settled=!0}},ct=async(c,h,y)=>{const _=c?.lists;if(!_)return null;try{const E=y.storyType==="body",F=typeof _.getStateInStory=="function"?await _.getStateInStory({target:Na(h),story:y}):E&&typeof _.getState=="function"?await _.getState({target:Na(h)}):null,H=F&&typeof F=="object"?F:null;return!H||H.success!==!0||typeof H.isListItem!="boolean"?null:H.isListItem}catch{return null}},nt=(c,h,y)=>{const _={resolved:!1,seed:null},E=c?.lists;if(!E)return _;const F=y.storyType==="body",H=typeof E.getStateInStory=="function"?()=>E.getStateInStory({target:Na(h),story:y}):F&&typeof E.getState=="function"?()=>E.getState({target:Na(h)}):null;if(!H)return _;const ie=he=>{const Me=he&&typeof he=="object"?he:null;return!Me||Me.success!==!0||typeof Me.isListItem!="boolean"?_:{resolved:!0,seed:Me.isListItem===!0&&(Me.seed==="bullet"||Me.seed==="ordered")?Me.seed:null}};try{const he=H();return Fr(he)?Promise.resolve(he).then(ie,()=>_):ie(he)}catch{return _}},yt=async(c,h,y)=>{if(!c)return null;try{const _=!y||y.storyType==="body",E=y&&typeof c.getNode=="function"?await c.getNode(To(h,y)):_&&typeof c.getNodeById=="function"?await c.getNodeById({nodeId:h,nodeType:"paragraph"}):null;return QU(E&&typeof E=="object"?E:null)}catch{return null}},vt=(c,h,y,_,E,F)=>{if(c.mutates&&y)return en({enabled:!1,active:E,supported:!0,value:F,reason:at.documentReadonly},"builtin");const H=Nr(_);if(H.length===0)return en({enabled:!1,active:E,supported:!0,value:F,reason:at.selectionRequired},"builtin");const ie=c.docRoute?yr(h,c.docRoute):null,he=yr(h,"format.paragraph.setIndentation"),Me=yr(h,"format.paragraph.clearIndentation"),ze=c.list?.mode,Ne=ze==="indent"?he!=null:he!=null||Me!=null,qe=fs(_);let Xe=null;if(qe.storyType!=="body"){Xe=[];for(const We of H){const{value:Ge,status:it}=M(h,We,qe);if(Ge===null)return it!=="ready"&&(ie!=null||Ne)?en({enabled:!0,active:E,supported:!0,value:F},"builtin"):en({enabled:!1,active:E,supported:!1,value:F,reason:Qi(h)},"builtin");Xe.push(Ge)}}if(Xe?.some(We=>We===!0)){const We=ze==="indent"?"lists.indentRange":"lists.outdentRange",Ge=qn()!=="suggesting"&&Xe.every(ut=>ut===!0)&&yr(h,We)!=null,it=ze==="outdent"&&yr(h,"lists.outdentInStory")!=null;if(!Ge&&!it)return en({enabled:!1,active:E,supported:!1,value:F,reason:Qi(h)},"builtin")}for(const[We,Ge]of H.entries()){const it=Xe?{value:Xe[We]??null,status:"ready"}:M(h,Ge,qe),ut=it.value;if(ut===!0){if(ie!=null)return en({enabled:!0,active:E,supported:!0,value:F},"builtin");continue}if(ut===!1&&Ne){if(qe.storyType!=="body"&&typeof h?.getNode!="function")continue;return en({enabled:!0,active:E,supported:!0,value:F},"builtin")}if(ut===null)return it.status!=="ready"&&(ie!=null||Ne)?en({enabled:!0,active:E,supported:!0,value:F},"builtin"):en({enabled:!1,active:E,supported:!1,value:F,reason:Qi(h)},"builtin")}return en({enabled:!1,active:E,supported:!1,value:F,reason:Qi(h)},"builtin")},Gt=(c,h,y,_,E,F)=>{if(c.mutates&&y)return en({enabled:!1,active:E,supported:!0,value:F,reason:at.documentReadonly},"builtin");const H=Nr(_);if(H.length===0)return en({enabled:!1,active:E,supported:!0,value:F,reason:at.selectionRequired},"builtin");const ie=fs(_),he=h?.lists;if(!(typeof he?.getStateInStory=="function"||ie.storyType==="body"&&typeof he?.getState=="function"))return en({enabled:!1,active:E,supported:!1,value:F,reason:at.operationUnavailable},"builtin");if(!Lc(H))return en(ie.storyType==="body"&&yr(h,"lists.remove")!=null?{enabled:!0,active:E,supported:!0,value:F}:{enabled:!1,active:E,supported:!1,value:F,reason:at.operationUnavailable},"builtin");const Me=H.map(Xe=>Ji(h,Xe,ie));if(Me.some(({status:Xe})=>Xe!=="ready"))return en({enabled:!0,active:E,supported:!0,value:F},"builtin");if(Me.some(({value:Xe})=>Xe===null))return en({enabled:!1,active:E,supported:!1,value:F,reason:at.operationUnavailable},"builtin");const ze=c.list?.seed,Ne=Me.every(({value:Xe})=>Xe?.isListItem===!0&&Xe.seed===ze);if(ie.storyType==="body")return en(!Ne||yr(h,"lists.remove")!=null?{enabled:!0,active:E,supported:!0,value:F}:{enabled:!1,active:E,supported:!1,value:F,reason:at.operationUnavailable},"builtin");const qe=yr(h,"lists.removeInStory");return en(Ne&&qe?{enabled:!0,active:E,supported:!0,value:F}:{enabled:!1,active:E,supported:!1,value:F,reason:at.operationUnavailable},"builtin")},On=(c,h)=>{const y=Jl(c,h)?.properties?.href;return typeof y=="string"?y:null},no=c=>{if(!S())return en({enabled:!1,active:!1,supported:!1,reason:at.notReady},"builtin");const h=c.instanceRoute;return typeof t?.[h]!="function"?en({enabled:!1,active:!1,supported:!1,reason:at.operationUnavailable},"builtin"):en({enabled:!0,active:Zt(c),supported:!0,value:kn(c)},"builtin")},Zt=c=>{const h=t?.config??void 0;return c.valueFrom==="ruler"?!!h?.rulers:c.valueFrom==="formattingMarks"?!!h?.layoutEngineOptions?.showFormattingMarks:!1},Nn=(c,h,y)=>{if(y)return en({enabled:!1,active:!1,supported:!0,reason:at.documentReadonly},"builtin");const _=Fe();return _!=null&&(!c.table.requiresCell||_.cellNodeId!=null)?(c.docRoute?yr(h,c.docRoute):null)==null?en({enabled:!1,active:!1,supported:!1,reason:Qi(h)},"builtin"):en({enabled:!0,active:!1,supported:!0},"builtin"):en({enabled:!1,active:!1,supported:!0,reason:at.tableContextUnavailable},"builtin")},kn=c=>{if(c.valueFrom==="zoom")return Vc().value;if(c.valueFrom==="documentMode")return qn();if(c.valueFrom==="measurementUnit")return cd();if(c.valueFrom==="ruler"||c.valueFrom==="formattingMarks")return Zt(c)},kr=(c,h)=>c.id==="zoom"?typeof h=="number"&&Number.isFinite(h)&&h>0:c.id==="document-mode"?h==="editing"||h==="suggesting"||h==="viewing":c.id==="measurement-unit"?h==="in"||h==="cm":!0,co=()=>[...new Set([...Fz,...Ze.keys()])],pr="Normal",ti={ready:!1,status:"ready",catalogRevision:null,quickGallery:[],activeParagraphStyleId:null,activeParagraphStyleName:null,mixedSelection:!1,sourceStatus:null,diagnostics:[]},$o=c=>`styles:catalog:${JSON.stringify(c??{})}`,st=c=>{const h=b()?.styles;return!h||typeof h.getCatalog!="function"?{value:null,status:"ready"}:to($o(c),xe(),()=>h.getCatalog(c),y=>y&&typeof y=="object"?y:null)},on=()=>{const c=st({includePreview:!0});if(!c.value)return{cache:null,status:c.status};const h=st({view:"quickGallery",includePreview:!0}),y=h.value?h.value.items:c.value.styles.filter(E=>E.visibility.quickGallery),_=new Map;for(const E of c.value.styles)_.set(E.id,E);return{cache:{full:c.value,quickGallery:y,byId:_},status:Pl(c.status,h.status)}},uo=(c,h,y)=>{const{value:_,status:E}=oe(c,h,y);if(!_)return{ok:!1,styleRef:null,status:E};const F=_.node;if(!F||typeof F!="object")return{ok:!1,styleRef:null,status:E};const H=F.kind,ie=typeof H=="string"?F[H]:void 0,he=ie&&typeof ie=="object"?ie.styleRef:void 0;return{ok:!0,styleRef:typeof he=="string"&&he.length>0?he:null,status:E}},gi=(c,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=Nr(c);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(!Lc(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 F=h?.full.defaults.paragraphStyleId??(h?pr:null),H=new Set;let ie=0,he=0,Me=0,ze="ready";const Ne=fs(c);for(const We of E){const Ge=uo(_,We,Ne);if(ze=Pl(ze,Ge.status),!Ge.ok){he+=1;continue}if(!Ge.styleRef&&!F){Me+=1;continue}const it=Ge.styleRef??F;if(!it){Me+=1;continue}ie+=1,H.add(it)}if(ie===0){const We=Me>0&&he===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:ze}}const qe=he+Me;if(qe>0)return y.push({severity:"warning",code:"active-style-partial",message:`Active paragraph style resolved from ${ie} of ${ie+qe} selected blocks; ${qe} could not be read, so the active style is unavailable.`}),{style:{styleId:null,styleName:null,mixed:!1,diagnostics:y},status:ze};if(H.size>1)return{style:{styleId:null,styleName:null,mixed:!0,diagnostics:y},status:ze};const Xe=[...H][0];return{style:{styleId:Xe,styleName:h?.byId.get(Xe)?.name??null,mixed:!1,diagnostics:y},status:ze}},Cd=c=>{if(!S())return ti;const{cache:h,status:y}=on(),{style:_,status:E}=gi(c,h);let F;return h?F=_.diagnostics.length===0?h.full.diagnostics:[...h.full.diagnostics,..._.diagnostics]:F=[{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,c.status),catalogRevision:h?.full.revision??null,quickGallery:h?.quickGallery??[],activeParagraphStyleId:_.styleId,activeParagraphStyleName:_.styleName,mixedSelection:_.mixed,sourceStatus:h?.full.sourceStatus??null,diagnostics:F}},Lo=(c="direct")=>{const{sink:h}=Xm(),y=h?Fa():0,_={},E=(Me,ze)=>{if(!h)return ze();const Ne=Fa();try{return ze()}finally{_[Me]=Fa()-Ne}},F=E("documentMode",qn),H=E("selection",td);H.status==="ready"&&Oc(H),Q(H);const ie=Ba(H);for(const[Me,ze]of r)(!ie||ze.selectionSignature!==ie||ze.settled&&H.status==="ready")&&r.delete(Me);const he={ready:S()!=null,documentMode:F,document:E("document",ud),selection:H,toolbar:{context:F,commands:E("toolbarCommands",()=>Ya(H)),copyFormatActive:p.mode!=="idle"},comments:E("comments",()=>rd(H)),trackChanges:E("trackChanges",()=>sd(H)),contentControls:E("contentControls",()=>gh(H)),zoom:E("zoom",Vc),fonts:E("fonts",ld),styles:E("styles",()=>Cd(H))};if(h){const Me=Fa();Yb({stage:"superdoc-ui-compute-state",atMs:Me,reason:c,startedAtMs:y,completedAtMs:Me,durationMs:Me-y,phaseMs:_,asyncReadSettlements:Tt.splice(0)})}return he},ea=c=>{const h=Ba(c);h&&a&&h!==a&&(n.clear(),r.clear()),h&&(a=h)};let Cs=null,ro=null,Li=null,Di=null,Oi=null,So=null,vi=!1;const Xa=()=>{if(ee||vi)return;vi=!0;const c=()=>{vi&&(vi=!1,!ee&&V())};typeof queueMicrotask=="function"?queueMicrotask(c):Promise.resolve().then(c)},Za=()=>{const c=Y();if(c!==Li&&(Di&&(Di(),Di=null),Li=c,!(!c||typeof c.subscribe!="function")))try{const h=c.subscribe(()=>Xa());typeof h=="function"&&(Di=h)}catch{Li=null}},Qa=()=>{const c=L();if(c!==Oi&&(So&&(So(),So=null),Oi=c,!(!c||typeof c.subscribe!="function")))try{const h=c.subscribe(()=>V());typeof h=="function"&&(So=h)}catch{Oi=null}};let Go=null,_o=null,Ja=null,yi=null,tc=null,Pi=null;const $c=()=>{const c=S()?.host,h=Lt(c?.getHandles?()=>c.getHandles():void 0,null)?.editing?.selection;return h&&typeof h.subscribe=="function"?h:null},kd=()=>{const c=j(),h=c?.readLiveSelectionSyncSnapshot;if(typeof h!="function")return!1;const y=qi(Lt(()=>h.call(c),null));if(!y||!$l(y))return!1;const _=Ys(y,"ready"),E=Gs(O.selection),F=Gs(_);if(E&&F&&E.blockId===F.blockId&&nr(E.story)===nr(F.story))return!1;const H=Xl(_),ie=O.toolbar.commands["font-family"]?.value,he=O.toolbar.commands["font-size"]?.value,Me=typeof ie=="string"&&ie.length>0,ze=typeof he=="string"&&he.length>0||typeof he=="number"&&Number.isFinite(he);return Me&&H.fontFamily===void 0||ze&&H.fontSize===void 0},ks=()=>{const c=$c();if(c!==Cs&&(ro&&(ro(),ro=null),Cs=c,!!c))try{const h=c.subscribe(y=>{Uo()&&kd()&&Ha()||(wo+=1,nd(y),V("host-selection"))});typeof h=="function"&&(ro=h)}catch{Cs=null}},Sd=()=>{const c=S()?.host,h=Lt(c?.getHandles?()=>c.getHandles():void 0,null)?.review;return h&&typeof h.subscribe=="function"?h:null},el=c=>c?typeof c.getActiveReviewTarget=="function"?Lt(()=>c.getActiveReviewTarget(),null):typeof c.getSnapshot=="function"?Lt(()=>c.getSnapshot(),null)?.activeReviewTarget??null:null:null;let Fi=0;const Ft=(c,h)=>{const y=(h&&typeof h=="object"?h:null)?.lastInteractionRejection;if(c==null&&y&&typeof y=="object"&&y.code==="review-target-invalidated"&&y.detail==="not-painted"&&et)return!1;const _=c&&typeof c=="object"?c:null;let E=null;if(_?.entityType==="trackedChange"&&typeof _.entityId=="string"&&_.entityId.length>0){const F=_.story&&typeof _.story=="object"?_.story:void 0,H=F&&nr(F)!==nr(null)?F:void 0,ie=typeof _.paintedEntityId=="string"&&_.paintedEntityId.length>0?_.paintedEntityId:null,he=ie??_.entityId,Me=(()=>{if(H){const qe=Mi(),Xe=qe?Fl(qe,H):null;return Xe?.toPublicId(he)??Xe?.toPublicId(_.entityId)??_.entityId}const Ne=Hs(Array.isArray(O?.trackChanges.items)?O.trackChanges.items:[]);return Ne.toPublicId(he)??Ne.toPublicId(_.entityId)??_.entityId})(),ze=ie??(he!==Me?he:null);E={id:Me,...H?{story:H}:{},...ze&&ze!==Me?{paintedEntityId:ze}:{}}}return c==null&&E==null&&et!=null&&I(et)||re(et,E)?!1:(N(E),!0)},Wn=()=>{const c=Sd();if(c===Go)return;if(_o&&(_o(),_o=null),Go=c,!c){Ft(null);return}let h=!0;try{const y=c.subscribe(_=>{const E=_&&typeof _=="object"?_:null,F=E&&Object.prototype.hasOwnProperty.call(E,"activeReviewTarget")?E.activeReviewTarget:el(c);!Ft(F,_)||h||V()});typeof y=="function"&&(_o=y),Ft(el(c))}catch{Go=null}finally{h=!1}},qr=()=>{if(Cs||qn()!=="viewing")return null;const c=S()?.mount?.container,h=(c&&typeof c=="object"&&"ownerDocument"in c?c.ownerDocument??null:null)??globalThis.document??null;return h&&typeof h.addEventListener=="function"?h:null},Qn=()=>{const c=qr();if(c===tc||(Pi&&(Pi(),Pi=null),tc=c,!c))return;const h=()=>{wo+=1,V()};c.addEventListener("selectionchange",h),c.addEventListener("pointerup",h,!0),c.addEventListener("mouseup",h,!0),Pi=()=>{c.removeEventListener("selectionchange",h),c.removeEventListener("pointerup",h,!0),c.removeEventListener("mouseup",h,!0)}};pi(),Ft(el(Sd())),O=Lo("initial"),a=Ba(O.selection);const D=()=>{const c=S()?.host?.events,h=c&&typeof c.subscribe=="function"?c:null;if(h!==Ja&&(yi&&(yi(),yi=null),Ja=h,!!h))try{const y=h.subscribe(_=>{const E=_?.type;if(E==="review-mutation:started"){cn(_.reviewMutation?.token);return}if(E==="review-mutation:aborted"){pn(_.reviewMutation?.token),$t();return}if(E==="mutation:rejected"&&_.reviewMutation&&(pn(_.reviewMutation.token),$t()),E==="mutation:committed"&&_.reviewMutation&&pn(_.reviewMutation.token),E==="source:complete"||E==="source:signals-complete"){Wr=xe(),Gi();return}if((E==="mutation:committed"||E==="collaboration:remote-changed")&&(pt=Date.now()),E==="mutation:committed"||E==="save:completed"||E==="collaboration:remote-changed"){const F=E==="mutation:committed"?OS(_):null;if(F?.allResolved){ao([]),Tn(_.receipt);return}F?.removedIds.size&&Vt(new Set(F.removedIds),_.receipt);const H=E==="mutation:committed"&&eo(_)||E==="collaboration:remote-changed"&&Array.isArray(_.changedStoryIds)&&_.changedStoryIds.length>0;if(H&&(dt=Date.now()),E==="mutation:committed"&&H){$a();return}if(F?.removedIds.size&&F.upsertIds.size===0)return;(E==="collaboration:remote-changed"||E==="mutation:committed"&&!H)&&Ua();const ie=E==="collaboration:remote-changed"&&Array.isArray(_.changedPartUris)&&_.changedPartUris.some(Me=>typeof Me=="string"&&BU.has(Me)),he=E==="collaboration:remote-changed"&&Array.isArray(_.changedStoryIds)&&_.changedStoryIds.length>0&&za();ie&&!H&&(Cn=!0),Wa(),ie&&!H?Qo("comments"):he&&(Cn=!0,Er()),V()}});typeof y=="function"&&(yi=y)}catch{Ja=null}},V=(c="unspecified")=>{if(ee)return;const{sink:h}=Xm(),y=h?Fa():0;vi=!1,pi(),ks(),Za(),Qa(),Wn(),Qn(),D();const _=Lo(c);ea(_.selection),O=_;let E=0,F=0;for(const H of[...q]){if(!h){H(O);continue}const ie=Fa();H(O);const he=Fa()-ie;E+=he,F=Math.max(F,he)}if(h){const H=Fa();Yb({stage:"superdoc-ui-recompute",atMs:H,reason:c,startedAtMs:y,completedAtMs:H,durationMs:H-y,listenerCount:q.size,listenerTotalMs:E,listenerMaxMs:F})}},be=[],Pe=[],ft=[],Wt=c=>{for(const h of c)try{h()}catch{}},sn=()=>Wt(be),Rn=()=>Wt(Pe),Pn=()=>Wt(ft),Hn=[];((c,h)=>{if(!(!c||typeof c.on!="function"))for(const y of h){const _=y==="active-editor-change"?()=>{sn(),Rn(),V()}:y==="document-replaced"?E=>{const F=E&&typeof E=="object"?E:null,H=F?.editor,ie=F?.host,he=!!H&&H===S(),Me=!!ie&&ie===j();!he&&!Me||(Rn(),P.clear(),Wa(),V())}:y==="document-mode-change"?()=>{V(),Pn()}:()=>V();try{c.on(y,_),Hn.push(()=>{try{typeof c.off=="function"&&c.off(y,_)}catch{}})}catch{}}})(t,LU),ks(),Za(),Qa(),Wn(),Qn(),D();const Sn=(c,h=mU)=>({get:()=>c(O),subscribe:y=>{let _=c(O);const E=F=>{const H=c(F);h(_,H)||(_=H,y(H))};return q.add(E),()=>q.delete(E)}}),Mn=c=>Sn(c),Do=c=>{const h=y=>{const _=F=>{try{y(F)}catch{}},E=c.subscribe(_);return _(c.get()),E};return{get:()=>c.get(),getSnapshot:()=>c.get(),observe:h,subscribe:y=>h(_=>y({snapshot:_}))}},ta=(c,h,y)=>{const _=Do(c),E=Do(h),F=H=>{const ie=ja(y);V();const he=E.observe(H);return()=>{he(),ie()}};return{get:_.get,getSnapshot:_.getSnapshot,observe:F,subscribe:H=>F(ie=>H({snapshot:ie}))}};function ni(c){return c&&typeof c=="object"&&typeof c.id=="string"?String(c.id):null}function tl(c){const h=hs(c);return h&&nr(h)!==nr(null)?h:void 0}function na(c,h){return{kind:"id",id:c,...h?{story:h}:{}}}function a2(c){if(c.empty)return null;const h=c.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),F=Math.max(y.offset,_.offset),H=hs(c);return{kind:"range",coordinateSpace:h.coordinateSpace==="tracked"?"tracked":"visible",range:{kind:"text",...H?{story:H}:{},segments:[{blockId:y.blockId,range:{start:E,end:F}}]}}}function l2(c,h){if(nr(h)!==nr(null))return;const y=b()?.trackChanges,_=y?.list;if(typeof _!="function")return;const E=Lt(()=>_.call(y),null);if(Fr(E)||!E||typeof E!="object")return;const F=E.items;if(Array.isArray(F))return F.map(Zu).find(H=>H!=null&&Ei(H,c,h))}function ig(c,h){const y=_h(c.quotedText);if(!y)return!1;const _=Qu(h);return[_.insertedText,_.deletedText,_.excerpt].some(E=>_h(E)===y)}function _h(c){return typeof c=="string"?c.replace(/\s+/g," ").trim():""}function c2(){const c=O.selection.activeChangeIds[0];if(!c)return"unavailable";const h=hs(O.selection),y=(O.trackChanges.status==="ready"?O.trackChanges.items.find(H=>Ei(H,c,h)):void 0)??l2(c,h)??Mi()?.find(H=>Ei(H,c,h));if(!y)return"unavailable";const _=Qu(y),E=_.type,F=_.grouping;return ig(O.selection,y)?"id":E==="replacement"&&F==="replacement-pair"||(E==="insertion"||E==="deletion"||E==="insert"||E==="delete")&&F==="standalone"?"range":"id"}function sg(c,h,y,_){const E=()=>v2(c,na(y,_),y,_);try{const F=v2(c,h,y,_);if(Fr(F))return Bn(Promise.resolve(F).then(ie=>xo(Ws(ie))?ie:E()));const H=Ws(F);return Bn(xo(H)?F:E())}catch{return!1}}function ag(c){if(typeof c=="string"&&c.length>0)return{target:{kind:"id",id:c},changeId:c};if(c&&typeof c=="object"){const h=c;if(h.target&&typeof h.target=="object"){const _=h.target;return{target:_,changeId:ni(_),story:_.story}}const y=typeof h.changeId=="string"?h.changeId:h.id;if(typeof y=="string"&&y.length>0)return{target:na(y,h.story),changeId:y,story:h.story}}return null}function u2(c,h){if(c.scope==="all")return{target:{kind:"all"},changeId:null};const y=ag(h);if(y)return y;const _=O.selection.activeChangeIds[0],E=tl(O.selection);return _?{target:na(_,E),changeId:_,story:E}:null}function d2(c,h){if(c.scope==="id"&&h==null){if(O.selection.activeChangeIds.length>1)return Kc(c.kind,{kind:"ids",ids:O.selection.activeChangeIds},null);if(O.selection.activeChangeIds.length===1&&!O.selection.empty&&O.selection.selectionTarget){const _=c2();if(_==="unavailable")return!1;if(_==="range"){const E=a2(O.selection),F=tl(O.selection);return E?sg(c.kind,E,O.selection.activeChangeIds[0],F):!1}if(_==="id"){const E=O.selection.activeChangeIds[0],F=hs(O.selection),H=F&&nr(F)!==nr(null)?F:void 0;return xh(c.kind,H?{id:E,story:H}:E)}}}const y=u2(c,h);return y?Kc(c.kind,y.target,y.changeId,y.story):!1}function Ah(c,h){const y=Y()?.lists,_=y?.apply;if(typeof _!="function")return!1;const{behavior:E,preset:F,continuity:H}=typeof h=="string"?PU(h):h&&typeof h=="object"?h:{},ie={kind:c,behavior:E??"toggle"};F!==void 0&&(ie.preset=F),H!==void 0&&(ie.continuity=H);try{return Bn(_.call(y,ie))}catch{return!1}}let Fn=Promise.resolve(!1),ri=null,_d=Promise.resolve(!1);const Gc=async c=>{if(!Jm(c))return c;const h=S()?.documentMutationReadiness,y=h?.whenPainted;if(typeof y!="function")return c;const _=typeof c.txId=="string"?c.txId:void 0;try{await y.call(h,_?{txId:_}:void 0)}catch{}return c},oi=c=>{if(Fr(c)){const y=Promise.resolve(c);return{immediate:!0,committed:y.then(_=>Ws(_),()=>!1),settled:y.then(_=>Gc(Ws(_)),()=>!1)}}const h=Ws(c);return{immediate:h,committed:Promise.resolve(h),settled:Gc(h)}},lg=()=>{const c=s.shift();if(!c){u=!1,f?.(),f=null;return}try{c.resolve(ee?!1:c.mutate())}catch{c.resolve(!1)}},Ih=()=>{let c=!1;return()=>{c||(c=!0,lg())}},cg=(c,h)=>{if(!u){u=!0,d=new Promise(F=>{f=F});try{return{result:h(),release:Ih()}}catch(F){throw u=!1,f?.(),f=null,F}}const y=s.find(F=>F.key===c);if(y)return y.mutate=h,{result:y.result,release:()=>{}};let _;const E=new Promise(F=>{_=F});return s.push({key:c,mutate:h,result:E,resolve:_}),{result:E,release:Ih()}},f2=new Set(["create.tableOfContents"]),ug=c=>Xn(`Tracked authoring is not supported for ${c}.`),ra=c=>{if(qn()==="suggesting")return f2.has(c)?ug(c):{changeMode:"tracked"}},Ad=()=>qn()==="suggesting"?mH:i2,Yr=(c,h,y)=>{const _=ra(c);return _&&_.success===!1?_:_?h(y,_):h(y)},Rt=(c,h,y,_)=>{const E=c.inline;if(!E)return;const F=Ws(_);if(F===!1||typeof F=="object"&&F&&F.success===!1)return;if(E.kind==="clear"){n.clear();return}if(E.kind==="toggle"||!e2(E.key))return;const H=Ba(h);if(!H)return;const ie=nH(E.key,y.value);if(ie==null){n.delete(E.key);return}n.set(E.key,{selectionSignature:H,value:ie})},Ut=(c,h,y,_)=>!c.inline||c.inline.kind==="toggle"?_:Fr(_)?Promise.resolve(_).then(E=>(Rt(c,h,y,E),E)):_,yn=(c,h,y,_)=>{if(c.inline?.kind!=="toggle"||!xo(Ws(_))||typeof y.value!="boolean"&&y.value!==null)return null;const E=Ba(h);if(!E)return null;const F=++l;return r.set(c.id,{selectionSignature:E,active:y.value===!0,generation:F,settled:!1}),V(),F},xr=(c,h,y)=>{if(h==null)return;const _=r.get(c.id);if(!(!_||_.generation!==h)){if(!xo(y)){r.delete(c.id);return}_.settled=!0}},Rr=(c,h)=>c.then(y=>(h?.(y),Vl(),y),()=>(h?.(!1),Vl(),!1)),Bn=(c,h)=>{const y=ri;if(ri=null,y)return Fn=Rr(y,h),Ws(c);if(Fr(c))return Fn=Rr(oi(c).settled,h),!0;const _=Ws(c);return Jm(_)&&typeof S()?.documentMutationReadiness?.whenPainted=="function"?(Fn=Rr(Gc(_),h),_):(h?.(_),Fn=Promise.resolve(_),Vl(),_)},Ni=(c,h)=>!c||typeof c!="object"?h:c,Oo=(c,h=Xn("Document API operation failed."))=>{if(Fr(c))return Promise.resolve(c).then(_=>Oo(_,h),()=>h);const y=Ni(c,h);return Wa(),Jm(y)&&typeof S()?.documentMutationReadiness?.whenPainted=="function"?(Rr(Gc(y)),V(),y):(V(),y)},Id=(c,h,y,_)=>{const E=[],F=[];for(const H of y){const ie=_(H);if(ie)try{const he=oi(Yr(c,h,ie));E.push(he.immediate),F.push(he.settled)}catch{E.push(!1),F.push(Promise.resolve(!1))}}return ri=F.length?Promise.all(F).then(H=>Ti(H)):null,Ti(E)},n$=(c,h,y,_)=>{const E=[],F=[];for(const H of y){const ie=_(H);if(ie)try{const he=oi(Yr(c,h,ie));E.push(he.immediate),F.push(he.settled)}catch{E.push(!1),F.push(Promise.resolve(!1))}}return ri=F.length?Promise.all(F).then(H=>Ti(H)):null,Ti(E)},h2=(c,h,y,_=O.selection)=>{const E=ra(c);return E&&E.success===!1?E:_.selectionTarget?h(y,{...E,offsetSpace:"selection"}):E?h(y,E):h(y)},r$=(c,h,y,_)=>{const E=To(h,_);switch(c.kind){case"alignment":{const F=y;return F!=="left"&&F!=="center"&&F!=="right"&&F!=="justify"?null:{target:E,alignment:F}}case"spacing-line":{const F=typeof y=="number"?y:Number(y);return!Number.isFinite(F)||F<=0?null:{target:E,line:F,lineRule:"auto"}}case"style":if(y&&typeof y=="object"){const F=y.role;if(F&&typeof F=="object")return{target:E,role:F}}return typeof y!="string"||y.trim()===""?null:{target:E,styleId:y};case"direction":{const F=c.fixedValue;return F!=="ltr"&&F!=="rtl"?null:{target:E,direction:F}}default:return null}},o$=(c,h)=>{const y=c.inline,_=o2(c),E=j();if(!y||typeof E?.setPendingInlineFormat!="function")return!1;if(y.kind==="clear")return $(),!0;if(!_)return!1;let F;if(y.kind==="toggle")F=!ec(c,b(),O.selection);else{const H=h&&typeof h=="object"&&"value"in h?h.value:h;if(y.kind==="value-number"){const ie=typeof H=="number"?H:Number(H);F=Number.isFinite(ie)&&ie>0?ie:null}else F=typeof H=="string"&&H.trim()!==""?H:null;if(F===null)return W(_,null),!0}return W(_,F),!0},i$=()=>{const c=b(),{lockModesById:h}=qa(c?.contentControls,O.selection);if(Qs(h))return!1;const y=[],_=[],E=Xe=>{const We=oi(Xe);y.push(We.immediate),_.push(We.settled)},F=(Xe,We,Ge)=>{try{E(Ge?Xe(We,Ge):Xe(We))}catch{y.push(!1),_.push(Promise.resolve(!1))}},H=on().cache?.full.defaults.paragraphStyleId??pr,ie=Ju(O.selection);if(ie){const Xe=yr(c,"format.apply");if(Xe)try{E(h2("format.apply",Xe,{target:ie,inline:{...Ad()}}))}catch{y.push(!1),_.push(Promise.resolve(!1))}}const he=yr(c,"format.paragraph.resetDirectFormatting"),Me=yr(c,"styles.paragraph.setStyleRef"),ze=hs(O.selection),Ne=!ze||ze.storyType==="body",qe=yr(c,Ne?"lists.remove":"lists.removeInStory");for(const Xe of Nr(O.selection)){const We=To(Xe,ze);if(he&&F(he,{target:We}),qe)try{const Ge=Na(Xe),it=oi(qe(Ne?{target:Ge}:{target:Ge,story:ze}));_.push(it.settled.then(ut=>xo(ut)?ut:!0))}catch{}Me&&F(Me,{target:We,styleId:H})}if(!ie&&qn()!=="suggesting"){const Xe=yr(c,"format.paragraph.setMarkRunProps");if(Xe)for(const We of Nr(O.selection))F(Xe,{target:To(We,ze),markRunProps:{bold:!1,italic:!1,strikethrough:!1,doubleStrikethrough:!1,smallCaps:!1,caps:!1,verticalAlign:"baseline"}})}return ri=_.length?Promise.all(_).then(Xe=>Ti(Xe)):null,Ti(y.length?y:[!1])},s$=(c,h,y)=>{const _=Nr(O.selection);if(_.length===0)return!1;const E=hs(O.selection);return Id(c.docRoute,h,_,F=>r$(c.blockParagraph,F,y,E))},a$=(c,h,y)=>{const _=b(),E=yr(_,"format.paragraph.setIndentation"),F=yr(_,"format.paragraph.clearIndentation"),H=c.list?.mode,ie=fs(O.selection),he=hs(O.selection),Me=async ze=>{const Ne=await ct(_,ze,ie);if(Ne===!0)return{kind:"list",routeToCall:c.docRoute,opToCall:h,input:{target:EI(ze)}};if(Ne===null||he&&he.storyType!=="body"&&typeof _?.getNode!="function")return null;const qe=await yt(_,ze,he),Xe={};if(qe?.right!=null&&(Xe.right=qe.right),qe?.firstLine!=null&&(Xe.firstLine=qe.firstLine),qe?.hanging!=null&&(Xe.hanging=qe.hanging),H==="indent")return E?{kind:"paragraph",routeToCall:"format.paragraph.setIndentation",opToCall:E,input:{target:To(ze,he),left:Math.max(0,qe?.left??0)+TI,...Xe}}:null;const We=Math.max(0,(qe?.left??0)-TI);return We>0&&(Xe.left=We),Object.keys(Xe).length===0?F?{kind:"paragraph",routeToCall:"format.paragraph.clearIndentation",opToCall:F,input:{target:To(ze,he)}}:E?{kind:"paragraph",routeToCall:"format.paragraph.setIndentation",opToCall:E,input:{target:To(ze,he),left:0}}:null:E?{kind:"paragraph",routeToCall:"format.paragraph.setIndentation",opToCall:E,input:{target:To(ze,he),...Xe}}:null};return ri=(async()=>{const ze=await Promise.all(y.map(We=>Me(We).catch(()=>null)));if(ze.length===y.length&&ze.every(We=>We?.kind==="list")&&qn()!=="suggesting"){const We=H==="indent"?"lists.indentRange":"lists.outdentRange",Ge=yr(_,We);if(Ge)try{return await oi(Yr(We,Ge,{paraIds:y,story:ie})).settled}catch{return!1}}const Ne=ie.storyType!=="body"&&ze.some(We=>We?.kind==="list"),qe=Ne&&H==="outdent"?yr(_,"lists.outdentInStory"):null;if(Ne&&!qe)return!1;const Xe=ze.map(We=>{if(!We)return Promise.resolve(!1);try{return We.kind==="list"&&qe?oi(Yr("lists.outdentInStory",qe,{target:We.input.target,story:ie})).settled:oi(Yr(We.routeToCall,We.opToCall,We.input)).settled}catch{return Promise.resolve(!1)}});return Ti(await Promise.all(Xe))})(),!0},l$=(c,h)=>{const y=c.list,_=b(),E=Nr(O.selection);if(E.length===0)return!1;const F=fs(O.selection),H=F.storyType==="body";if(y.mode==="indent"||y.mode==="outdent")return a$(c,h,E);const ie=y.seed,he=Ne=>{if(Ne.some(ut=>!ut.resolved))return{immediate:!1,settled:null};const qe=Ne.every(ut=>ut.seed===ie);if(!qe&&!H)return{immediate:!1,settled:null};const Xe=qe?H?"lists.remove":"lists.removeInStory":c.docRoute,We=qe?yr(_,Xe):h;if(!We)return{immediate:!1,settled:null};const Ge=[],it=[];return E.forEach((ut,Ke)=>{if(!qe&&Ne[Ke]?.seed===ie)return;const _t=qe?{target:Na(ut),...H?{}:{story:F}}:{target:Na(ut),seed:ie};try{const It=oi(Yr(Xe,We,_t));Ge.push(It.immediate),it.push(It.settled)}catch{Ge.push(!1),it.push(Promise.resolve(!1))}}),{immediate:Ti(Ge),settled:it.length?Promise.all(it).then(ut=>Ti(ut)):null}},Me=E.map(Ne=>nt(_,Ne,F));if(Me.some(Fr))return ri=Promise.all(Me).then(async Ne=>{const qe=he(Ne);return qe.settled?await qe.settled:qe.immediate}),!0;const ze=he(Me);return ri=ze.settled,ze.immediate};function Eh(c){return c&&typeof c=="object"?c:{}}function c$(c){if(typeof c=="string")return c;const h=Eh(c);if(Object.prototype.hasOwnProperty.call(h,"href"))return h.href;if(Object.prototype.hasOwnProperty.call(h,"value"))return h.value}function u$(c,h){const y=Eh(c).text;return typeof y=="string"&&y.trim()!==""?y:h}function WI(c){const h=Eh(c),y=h.capture&&typeof h.capture=="object"?h.capture:null;return h.target??y?.target??y?.selectionTarget??h.selectionTarget??h.textTarget??null}const d$=c=>{const h=b(),y=h?.hyperlinks;if(!y)return!1;const _=Eh(c),E=c$(c),F=WI(c),H=typeof _.text=="string"?_.text:void 0,ie=typeof _.currentText=="string"?_.currentText:void 0,he=ph(_.hyperlinkTarget)?_.hyperlinkTarget:null,Me=ph(_.textTarget)?_.textTarget:null,ze=Jl(h,O.selection),Ne=typeof he?.storyId=="string"&&typeof he?.hyperlinkNodeId=="string";if(Ne&&E===null){const qe=y.remove;if(typeof qe!="function")return!1;try{return Yr("hyperlinks.remove",qe,{storyId:he.storyId,hyperlinkNodeId:he.hyperlinkNodeId,keepText:!0})}catch{return!1}}if(ze&&E===null){const qe=y.remove;if(typeof qe!="function")return!1;try{return Yr("hyperlinks.remove",qe,{target:ze.address,mode:"unwrap"})}catch{return!1}}if((ze||he)&&typeof E=="string"&&E.trim()!==""){const qe=y.patch,Xe=y.updateTarget;if(!(!Ne&&ze&&typeof qe=="function")&&!(Ne&&typeof Xe=="function"))return!1;const We=typeof H=="string"&&H!==(Ne?ie:ze?.text??ie),Ge=h?.text?.replace,it=We?Ne?Me:cH(ze?.address):null,ut=We&&!!it&&typeof Ge=="function";if(We&&!ut)return!1;const Ke=[],_t=[];let It=null,_n=null,An=null,Sr=!1;try{if(Ne){if(typeof Xe!="function")return!1;const Mr=Yr("hyperlinks.updateTarget",Xe,{storyId:he.storyId,hyperlinkNodeId:he.hyperlinkNodeId,newTarget:uH(E)});Sr=Fr(Mr);const Lr=oi(Mr);if(!xo(Lr.immediate))return!1;Ke.push(Lr.immediate),_t.push(Lr.settled),It=Lr.immediate,_n=Lr.committed,An=Lr.settled}else if(ze){if(typeof qe!="function")return!1;const Mr=Yr("hyperlinks.patch",qe,{target:ze.address,patch:{href:E}});Sr=Fr(Mr);const Lr=oi(Mr);if(!xo(Lr.immediate))return!1;Ke.push(Lr.immediate),_t.push(Lr.settled),It=Lr.immediate,_n=Lr.committed,An=Lr.settled}}catch{return!1}if(ut){const Mr=(Br,ii)=>xo(ii)?Ti([Br,ii]):xo(Br)?lh(Br,ii):ii,Lr=Br=>{if(!xo(Br))return Br;try{const ii=oi(Yr("text.replace",Ge,{target:it,text:H}));return xo(ii.immediate)?Promise.all([An??Promise.resolve(Br),ii.settled]).then(([C2,Y$])=>Mr(C2,Y$)):lh(Br,ii.immediate)}catch{return lh(Br,!1)}};if(Sr)return ri=(_n??Promise.resolve(It??!1)).then(Lr),Ti(Ke);try{const Br=oi(Yr("text.replace",Ge,{target:it,text:H}));if(!xo(Br.immediate))return It?lh(It,Br.immediate):Br.immediate;Ke.push(Br.immediate),_t.push(Br.settled),ri=Promise.all([An??Promise.resolve(It??!1),Br.settled]).then(([ii,C2])=>Mr(ii,C2))}catch{return It?lh(It,!1):!1}}return!ut&&_t.length>0&&(ri=Promise.all(_t).then(Mr=>Ti(Mr))),Ti(Ke)}if(typeof E=="string"&&E.trim()!==""){const qe=E.trim(),Xe=y.wrap,We=JU(F),Ge=We.length>0?We:Jb(O.selection);if(Ge.length>0){if(typeof Xe!="function")return!1;try{return n$("hyperlinks.wrap",Xe,Ge,_t=>({target:_t,link:{destination:{href:qe}}}))}catch{return!1}}const it=y.insert,ut=u$(c,qe);if(typeof it!="function"||ut.trim()==="")return!1;const Ke=fh(F)??Gs(O.selection);if(!Ke)return!1;try{return Yr("hyperlinks.insert",it,{target:Ke,text:ut,link:{destination:{href:qe}}})}catch{return!1}}return!1},f$=(c,h,y)=>{const _=c.create.kind,E=y&&typeof y=="object"?y:{};if(_==="table"){const H=Number(E.rows??E.rowCount),ie=Number(E.columns??E.cols??E.colCount);if(!Number.isInteger(H)||H<1||!Number.isInteger(ie)||ie<1)return!1;const he=Gs(O.selection),Me=he&&typeof he.blockId=="string"?{kind:"inParagraph",target:To(he.blockId),offset:he.range?.start??0}:n2(O.selection,"nodeId");try{return Yr(c.docRoute,h,{rows:H,columns:ie,at:Me})}catch{return!1}}if(_==="image"){const H=E.src??E.value;if(typeof H!="string"||H.trim()==="")return!1;const ie=Gs(O.selection),he=fs(O.selection),Me=he.storyType==="body"?null:he;let ze;ie&&typeof ie.blockId=="string"?ze={kind:"inParagraph",target:To(ie.blockId,Me),offset:ie.range?.start??0}:(ze=n2(O.selection,"target"),Me&&ze.kind==="after"&&(ze={...ze,target:{...ze.target,story:Me}}));const Ne={src:H,at:ze};Me&&(Ne.in=ze.kind==="inParagraph"?Z(Me)??Me:Me),typeof E.alt=="string"&&(Ne.alt=E.alt),typeof E.title=="string"&&(Ne.title=E.title),E.size&&typeof E.size=="object"&&(Ne.size=E.size);try{return Yr(c.docRoute,h,Ne)}catch{return!1}}const F={at:n2(O.selection,"target")};typeof E.instruction=="string"&&(F.instruction=E.instruction),E.config&&typeof E.config=="object"&&(F.config=E.config);try{return Yr(c.docRoute,h,F)}catch{return!1}},h$=(c,h)=>{const y=c.table,_=Fe();if(!_||y.requiresCell&&!_.cellNodeId)return!1;const E=yH(y.action,_);if(!E)return!1;try{if(y.action==="insert-row-before"||y.action==="insert-row-after"){const F=j(),H=(typeof F?.getHandles=="function"?F.getHandles():null)?.editing?.tables;if(typeof H?.insertRow!="function")return!1;const ie=ra(c.docRoute);return ie&&ie.success===!1?ie:ie?H.insertRow(E,ie):H.insertRow(E)}if(y.action==="insert-column-before"||y.action==="insert-column-after"){const F=j(),H=(typeof F?.getHandles=="function"?F.getHandles():null)?.editing?.tables;if(typeof H?.insertColumn!="function")return!1;const ie=ra(c.docRoute);return ie&&ie.success===!1?ie:ie?H.insertColumn(E,_.rowIndex,ie):H.insertColumn(E,_.rowIndex)}return Yr(c.docRoute,h,E)}catch{return!1}},p$=c=>!c||c.disposition!=="routed"?!1:!!(c.inline||c.blockParagraph||c.list||c.link||c.create),m$=c=>{const h=Eh(c);return!!(WI(c)||ph(h.hyperlinkTarget)||ph(h.textTarget))},g$=(c,h,y)=>O.selection.status!=="ready"?!1:tg(c)?.scope==="id"||!h||h.disposition!=="routed"?!0:h.inline?.kind==="clear"?Nr(O.selection).length>0||Ju(O.selection)!=null:h.inline?Ju(O.selection)!=null||Nr(O.selection).length>0:h.blockParagraph||h.list?Nr(O.selection).length>0:h.link?m$(y)||Jb(O.selection).length>0||Gs(O.selection)!=null||ec(h,b(),O.selection):!0,v$=(c,h)=>{const y=tg(c),_=Gu(c);return y?.scope==="id"&&ag(h)||y?.scope!=="id"&&!p$(_)?!1:!g$(c,_,h)},y$=(c,h)=>v$(c,h)?Gl().then(()=>{}):null,Wc=(c,h,y)=>{if(ri=null,Fn=Promise.resolve(!1),ee)return!1;const _=Ze.get(c);if(_)try{const Ne=_.execute(mi(h,y));return Bn(Ne)}catch{return!1}const E=wI(c);if(E){if(qn()==="viewing")return!1;if(typeof Y()?.lists?.apply=="function")return Ah(E,h)}const F=tg(c);if(F)return d2(F,h);if(c==="copy-format")return Bn(b$());const H=Gu(c);if(!H||H.disposition!=="routed")return!1;const ie=H.normalizePayload?H.normalizePayload(h):h;if(H.instanceRoute){if(!S()||!kr(H,ie))return!1;const Ne=t?.[H.instanceRoute];if(typeof Ne!="function")return!1;try{const qe=H.fixedArg!==void 0?H.fixedArg:ie,Xe=Ne.call(t,qe);return Bn(Xe)}catch{return!1}}if(H.inline?.kind==="clear")return H.mutates&&qn()==="viewing"?!1:Bn(i$());const he=H.docRoute;if(!he||H.mutates&&qn()==="viewing")return!1;const Me=b(),ze=yr(Me,he);if(!ze)return!1;if(H.inline){const{lockModesById:Ne}=qa(Me?.contentControls,O.selection);if(Qs(Ne))return!1;const qe=Ju(O.selection);if(!qe)return O.selection.empty===!1?Bn(!1):Bn(o$(H,ie));const Xe=ec(H,Me,O.selection),We=gH(H.inline,qe,ie,Xe);if(!We)return!1;let Ge=null;try{const it=S(),ut=qn(),Ke=()=>S()!==it||b()!==Me||qn()!==ut?!1:h2(he,ze,We),_t=Ba(O.selection)??Rc(O.selection),It=H.inline.kind==="toggle"?cg(`${H.id}:${_t}`,Ke):null;Ge=It?.release??null;const _n=It?It.result:Ke(),An=yn(H,O.selection,We,_n),Sr=Ut(H,O.selection,We,_n),Mr=Bn(Sr,Lr=>{xr(H,An,Lr),Ge?.(),Ge=null});return H.inline.kind==="toggle"&&(_d=Fn),Mr}catch{return Ge?.(),!1}}if(H.blockParagraph){const Ne=s$(H,ze,ie),qe=H.blockParagraph.kind==="alignment"&&xo(Ne)?Re(O.selection,ie):null;return Bn(Ne,Xe=>{rt(qe,Xe)})}if(H.list){const Ne=l$(H,ze);return Bn(Ne)}if(H.link){const Ne=d$(ie);return Bn(Ne)}if(H.create){const Ne=f$(H,ze,ie);return Bn(Ne)}if(H.table){const Ne=h$(H,ze);return Bn(Ne)}try{return Bn(H.mutates?Yr(he,ze,ie):ze(ie))}catch{return!1}},dg=()=>{g+=1,p={mode:"idle",snapshot:null,sourceSelectionKey:null,lastClickAt:p.lastClickAt,pointerSelecting:!1,keyboardSelecting:!1};for(const c of m)c("idle");V()},b$=async()=>{const c=["bold","italic","underline","strikethrough"].filter(ze=>O.toolbar.commands[ze]?.active===!0),h=await _d;await d;const y=xo(h)?c:[],_=500,E=Date.now();if(p.mode!=="idle"){if(p.mode==="armed"&&E-p.lastClickAt<_){p={...p,mode:"persistent",lastClickAt:E};for(const ze of m)ze("persistent");return V(),!0}return dg(),!1}const F=E-p.lastClickAt<_,H=++g;p={...p,lastClickAt:E};const ie=await Gl(),he=`${Rc(ie)}:${xe()}`,Me=await w$(null,ie,he&&he===C?v:void 0,y);if(H!==g)return!0;p={...p,mode:F?"persistent":"armed",snapshot:Me,sourceSelectionKey:Rc(ie),lastClickAt:E};for(const ze of m)ze(p.mode);return V(),!0},w$=async(c,h,y,_=[])=>{const E=h?.target??c?.target;if(!E||E.kind!=="text")return null;const F=Array.isArray(E.segments)?E.segments:[];if(F.length===0)return null;const H=b();if(!H)return null;const ie=E.story;let he=null;for(const We of F){const Ge=(await Zs(To(We.blockId,ie)))?.node??null;if(!Ge)continue;const it=p2(Ge),ut=Array.isArray(it?.inlines)?it.inlines:[],Ke=C$(ut,We.range);he?he=KI(he,Ke):he=Ke}const Me=he?gU(he):{},ze={bold:"bold",italic:"italic",underline:"underline",strikethrough:"strike"},Ne=new Set([...h?.activeMarks??(Array.isArray(c?.activeMarks)?c.activeMarks:[]),..._]);for(const[We,Ge]of Object.entries(ze))Ne.has(We)&&(Me[Ge]=!0);const qe=y??await gd(h??Ys(c,"ready"));if(qe.fontFamily&&(Me.fontFamily=qe.fontFamily),qe.color&&(Me.color=qe.color),qe.highlight&&(Me.highlight=qe.highlight),qe.fontSize){const We=Number.parseFloat(qe.fontSize);Number.isNaN(We)||(Me.fontSize=We)}let Xe=null;if(F.length===1){const We=F[0],Ge=(await Zs(To(We.blockId,ie)))?.node??null;Ge&&p2(Ge)&&(Xe=await k$(Ge,We.blockId,H,ie))}return{story:ie??null,inline:Me,paragraph:Xe}},p2=c=>c?c.kind==="paragraph"?c.paragraph??null:c.kind==="heading"?c.heading??null:null:null,C$=(c,h)=>{const y=H=>{const ie=H.run;return typeof ie?.text=="string"?ie.text:""},_=H=>H.run?.props;if(h.start===h.end){let H=0;for(const ie of c){const he=y(ie),Me=H,ze=H+he.length;if(H=ze,h.start>=Me&&h.start<=ze){const Ne=_(ie);return Ne?{...Ne}:{}}}return{}}let E=0;const F=[];for(const H of c){const ie=y(H),he=E,Me=E+ie.length;if(E=Me,Me<=h.start||he>=h.end)continue;const ze=_(H);ze&&F.push(ze)}return F.length===0?{}:F.length===1?{...F[0]}:KI(F[0],...F.slice(1))},KI=(c,...h)=>{const y={...c};for(const _ of h)for(const E of Object.keys(y)){if(!(E in _)){delete y[E];continue}const F=y[E],H=_[E];(typeof F!=typeof H||JSON.stringify(F)!==JSON.stringify(H))&&delete y[E]}return y},k$=async(c,h,y,_)=>{const E=p2(c),F=E.props??{},H=E.styleRef??null,ie=F.alignment??null,he=F.spacing??null,Me=F.indent??null,ze=Me?{...Me.left!=null?{left:Me.left}:{},...Me.right!=null?{right:Me.right}:{},...Me.firstLine!=null?{firstLine:Me.firstLine}:{},...Me.hanging!=null?{hanging:Me.hanging}:{}}:null,Ne=F.markRunProps??null,qe=F.numbering?.numId,Xe=typeof qe=="string"?parseInt(qe,10):typeof qe=="number"?qe:NaN,We=F.numbering?.level,Ge=isNaN(Xe)?null:{numId:Xe,...We!=null?{level:We}:{}};let it=null;if(Ge&&typeof y.lists?.getState=="function")try{const ut=await y.lists.getState({target:To(h,_)});ut&&typeof y.lists?.getStyle=="function"&&(it=await y.lists.getStyle(ut)??null)}catch{}return{styleId:H,alignment:ie,spacing:he,indentation:ze,markRunProps:Ne,numbering:Ge,listStyle:it}},qI=async()=>{if(p.mode==="idle"||p.pointerSelecting||p.keyboardSelecting)return;const c=b()?.selection,h=async()=>{const H=typeof c?.current=="function"?await Promise.resolve(c.current({includeText:!0})):Ka().value;return qi(H)},y=()=>new Promise(H=>setTimeout(H,16)),_=8;let E=null,F="";for(let H=0;H<_;H+=1){if(H>0&&await y(),p.mode==="idle"||p.pointerSelecting||p.keyboardSelecting)return;if(E=await h(),!(!E||E.empty)&&(F=Rc(E),F!==p.sourceSelectionKey))break}if(E&&!E.empty&&F!==p.sourceSelectionKey){await YI(E);return}if(p.snapshot?.paragraph){const H=await h();if(!H||Rc(H)===p.sourceSelectionKey)return;await YI(H)}},YI=async c=>{const h=p.snapshot;if(!h){p.mode==="armed"&&dg();return}const y=b();if(!y)return;const _=Ys(c,"ready"),{lockModesById:E}=qa(y.contentControls,_);if(Qs(E)){V();return}const F=c.target,H=c.selectionTarget;if(c.empty!==!0&&Object.keys(h.inline).length>0){const ie=yr(y,"format.apply");if(ie&&H)try{if(!xo(Ws(await Promise.resolve(h2("format.apply",ie,{target:H,inline:h.inline},c))))){V();return}}catch{V();return}}if(h.paragraph){const ie=Array.isArray(F?.segments)?F.segments:[],he=F?.story;for(const Me of ie){const ze=To(Me.blockId,he),Ne=await Zs(ze),qe=Ne?.node??null,Xe=Ne?.address??null;if(!qe)continue;const We={kind:"block",nodeType:Xe?.nodeType??qe.kind??"paragraph",nodeId:Me.blockId,...he&&typeof he=="object"?{story:he}:{}},{styleId:Ge,alignment:it,spacing:ut,indentation:Ke,markRunProps:_t,numbering:It,listStyle:_n}=h.paragraph;if(Ge&&await y.styles?.paragraph?.setStyle?.({target:We,styleId:Ge}),it&&await y.format?.paragraph?.setAlignment?.({target:We,alignment:it}),ut){const An=ut,Sr=An.lineRule??"auto",Mr=new Set(["auto","exact","atLeast"]).has(Sr)?Sr:"auto",Lr={...An.before!=null?{before:Math.round(An.before*20)}:{},...An.after!=null?{after:Math.round(An.after*20)}:{},...An.line!=null?{line:Math.round(Mr==="auto"?An.line*240:An.line*20),lineRule:Mr}:{}};await y.format?.paragraph?.setSpacing?.({target:We,...Lr})}if(Ke){const An={...Ke.left!=null?{left:$s(Ke.left)}:{},...Ke.right!=null?{right:$s(Ke.right)}:{},...Ke.firstLine!=null?{firstLine:$s(Ke.firstLine)}:{},...Ke.hanging!=null?{hanging:$s(Ke.hanging)}:{}};await y.format?.paragraph?.setIndentation?.({target:We,...An})}_t&&await y.format?.paragraph?.setMarkRunProps?.({target:We,markRunProps:_t}),It&&await y.format?.paragraph?.setNumbering?.({target:We,...It}),_n&&((await Zs(ze))?.address?.nodeType==="listItem"?await y.lists?.applyStyle?.({target:EI(Me.blockId,he),style:_n}):It&&await y.format?.paragraph?.setNumbering?.({target:We,...It}))}}p.mode==="armed"&&dg(),V()},fg=(c,h,y)=>{const _=y$(c,h),E=_?_.then(()=>(Wc(c,h,y),Fn)):(Wc(c,h,y),Fn);return Gu(c)?.inline?.kind==="toggle"&&(_d=E),E},XI=c=>({id:c,getState:()=>O.toolbar.commands[c]??ko(c,b(),O.selection,Mo(O.selection)),observe:h=>Sn(y=>y.toolbar.commands[c]??{enabled:!1,active:!1,supported:!1,source:"unsupported",reason:at.commandUnsupported}).subscribe(h),execute:h=>Wc(c,h),executeAsync:h=>fg(c,h)}),S$=c=>{Ze.set(c.id,c),V();const h=()=>{Ze.delete(c.id),V()};return Object.assign(h,{handle:XI(c.id),unregister:h})},hg=Mn(c=>c.selection),pg=Do(hg),ZI=()=>{const c=j();if(typeof c?.getHandles!="function")return{reason:at.hostCapabilityUnavailable};let h=null;try{h=c.getHandles()}catch(_){const E=_?.reason;return{reason:E==="host-not-ready"||E==="host-disposed"||E==="editing-mount-required"?at.notReady:at.hostCapabilityUnavailable}}const y=h?.editing?.selectionTargets;return typeof y?.apply!="function"?{reason:at.hostCapabilityUnavailable}:{helper:y}},_$=c=>{const h=j();if(typeof h?.getHandles=="function")try{const y=h.getHandles()?.editing?.contentControls;typeof y?.activate=="function"&&y.activate({id:c})}catch{}},QI={get:pg.get,getSnapshot:pg.getSnapshot,subscribe:pg.subscribe,observe:pg.observe,current:()=>Ka().value,capture:()=>{const c=hg.get();return c.empty||!c.target&&!c.selectionTarget?null:{...c,capturedAt:Date.now()}},restore:c=>{const h=E=>(V(),{...E,success:E.ok});if(!c||typeof c!="object")return h({ok:!1,reason:at.targetUnresolved});if(!S())return h({ok:!1,reason:at.notReady});const y=pH(c);if(!y)return h({ok:!1,reason:at.targetUnresolved});const _=ZI();if(!("helper"in _))return h({ok:!1,reason:_.reason});try{return h(bI(_.helper.apply(y)))}catch{return h({ok:!1,reason:at.hostCapabilityUnavailable})}},apply:c=>{if(!S())return{ok:!1,reason:at.notReady};const h=ZI();if(!("helper"in h))return{ok:!1,reason:h.reason};try{const y=h.helper.apply(c);return V(),bI(y)}catch{return{ok:!1,reason:at.hostCapabilityUnavailable}}},getAnchorRect:c=>{const h=j();if(typeof h?.getSelectionAnchorRect=="function"){const y=Lt(()=>h.getSelectionAnchorRect(c),null);return y&&typeof y=="object"&&(Number(y.width)>0||Number(y.height)>0)?y:null}return null},getRects:c=>{const h=hg.get(),y=h.selectionTarget??h.target;if(h.empty||!y)return[];const _=Ag.getRect({target:y,relativeTo:c?.relativeTo});return _.found?_.rects:[]}},A$={get ids(){return co()},has:c=>Gu(c)!=null||Ze.has(c),get:c=>XI(c),execute:Wc,executeAsync:fg,register:S$,getContextMenuItems:c=>{const h=[];for(const y of Ze.values()){const _=y.contextMenu;_&&Lt(_.when?()=>_.when(c):void 0,!0)&&h.push({id:y.id,label:_.label,group:_.group,order:_.order,invoke:()=>Wc(y.id,void 0,c)})}return h.sort((y,_)=>(y.order??0)-(_.order??0)||y.label.localeCompare(_.label))}},m2=Do(Mn(c=>c.toolbar)),I$={get:m2.get,getSnapshot:()=>O.toolbar,subscribe:m2.subscribe,observe:m2.observe,execute:Wc,executeAsync:fg},Ed=async(c,h)=>{if(!S())return{success:!1,ok:!1,reason:at.notReady};if(!c)return{success:!1,ok:!1,reason:at.targetUnresolved};const y=j(),_=y?.scrollTargetIntoView;if(typeof _!="function")return{success:!1,ok:!1,reason:at.hostCapabilityUnavailable};try{const E={target:c,block:h?.block??"center",behavior:h?.behavior??"smooth"},F=await Promise.resolve(h?.shouldContinue?_.call(y,E,h.shouldContinue):_.call(y,E));return F&&typeof F=="object"&&F.success===!1?{success:!1,ok:!1,reason:Zm(F.reason,at.targetUnresolved)}:{success:!0,ok:!0}}catch{return{success:!1,ok:!1,reason:at.hostCapabilityUnavailable}}},JI=c=>{if(!c||typeof c!="object")return null;const h=c,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,F=y?.insert??y?.delete??y?.format??_?.wordIdInsert??_?.wordIdDelete??E?.[0];return typeof F=="string"&&F.length>0?F:null},eE=async(c,h,y,_,E)=>{const F=await Ed(h,E);if(F.ok)return F;const H=T(),ie=H?.focusTrackedChange;if(typeof ie!="function")return F;const he=y||_?{commentId:c,...y?{trackedChangeStory:y}:{},..._?{importedId:_}:{}}:c;try{const Me=await Promise.resolve(ie.call(H,he));if(Me&&typeof Me=="object"&&Me.ok===!0)return{success:!0,ok:!0}}catch{}return F},mg=async(c,h,y,_)=>{const E=c==="trackChanges"?_?.story:void 0,F=c==="trackChanges"?_?.matchStory??E:void 0,H=Ke=>{if(!E||!Ke||typeof Ke!="object")return Ke;const _t=Ke,It=_t.address&&typeof _t.address=="object"?_t.address:null;return _t.story||It?.story?Ke:{..._t,story:E}},ie=c==="trackChanges"?kI:ch,he=y.find(Ke=>Ei(Ke,h,F)),Me=he&&typeof he=="object"?he:null,ze=c==="trackChanges"&&Me?.type==="move"&&(Me.subtype==="move-to"||Me.subtype==="move-from")?Me.subtype:null,Ne=ze&&typeof Me?.trackedChangeCanonicalId=="string"?Me.trackedChangeCanonicalId:h,qe=Ke=>{if(!ze)return c==="trackChanges"?kI(Ke,{preferStableBlock:!0}):ie(Ke);const _t=ch(Ke);if(_t?.kind!=="move")return null;const It=ze==="move-to"?_t.destination:_t.source;return Zb(It)?It:null},Xe=ie(he),We=c!=="trackChanges"||!ze&&Zb(ch(he));if(Xe&&We)return H(Xe);const Ge=b()?.[c],it=c==="comments"?{commentId:h}:{id:Ne,...E?{story:E}:{}},ut=Ge?.get;if(typeof ut!="function")return H(Xe);try{return H(qe(await Promise.resolve(ut.call(Ge,it)))??Xe)}catch{return H(Xe)}};function tE(c,h){if(Fc())return Xn("Comments are read-only.","DOCUMENT_READONLY");if(ed())return Xn("Resolving comments is disabled.","DOCUMENT_READONLY");const y=b()?.comments,_=y?.patch;if(typeof _!="function")return Xn("comments.patch is unavailable.");const E=Xn("comments.patch failed.");return Lt(()=>Oo(_.call(y,{commentId:c,status:h}),E),E)}const Th=()=>Fc()?Xn("Comments are read-only.","DOCUMENT_READONLY"):null,E$=(c,h)=>{const y=h&&typeof h=="object"?h:null;let _=Array.from(c);y?.includeResolved===!1&&(_=_.filter(he=>he.status!=="resolved"));const E=Number(y?.offset),F=Number.isInteger(E)&&E>0?E:0,H=Number(y?.limit),ie=Number.isInteger(H)&&H>=0?F+H:void 0;return _.slice(F,ie)},Td=Mn(c=>c.comments),gg=ta(Td,Sn(c=>Kl(c.selection,c.comments)),"comments"),T$={get:gg.get,getSnapshot:gg.getSnapshot,subscribe:gg.subscribe,observe:gg.observe,list:c=>{Wi();const h=Xi();return E$(h.value??Td.get().items,c)},getById:c=>{const h=Td.get().items.find(E=>$r(E)===c)??null;if(h)return h;const y=b()?.comments,_=Lt(y?.get?()=>y.get({commentId:c}):void 0,null);return Fr(_)?null:_},createFromCapture:(c,h)=>{const y=Th();if(y)return y;const _=b()?.comments,E=_?.create;if(typeof E!="function")return Xn("comments.create is unavailable.");const F=Xn("comments.create failed.");return Lt(()=>{const H=c&&typeof c=="object"?c.target??c.selectionTarget:null;return H==null?Xn("A range selection is required to comment.","NO_SELECTION"):Oo(E.call(_,{target:H,text:h.text}),F)},F)},createFromSelection:c=>{const h=Th();if(h)return h;const y=b()?.comments,_=y?.create;if(typeof _!="function")return Xn("comments.create is unavailable.");const E=hg.get(),F=E.target??E.selectionTarget;if(E.empty||!F)return Xn("A range selection is required to comment.","NO_SELECTION");const H=Xn("comments.create failed.");return Lt(()=>Oo(_.call(y,{target:F,text:c.text}),H),H)},reply:(c,h)=>{const y=Th();if(y)return y;const _=b()?.comments,E=_?.reply??_?.create;if(typeof E!="function")return Xn("comments.reply is unavailable.");const F=Xn("comments.reply failed.");return Lt(()=>Oo(E===_?.reply?E.call(_,{parentCommentId:c,text:h.text}):E.call(_,{parentCommentId:c,text:h.text}),F),F)},edit:(c,h)=>{const y=Th();if(y)return y;const _=b()?.comments,E=_?.patch;if(typeof E!="function")return Xn("comments.patch is unavailable.");const F=Xn("comments.patch failed.");return Lt(()=>Oo(E.call(_,{commentId:c,text:h.text}),F),F)},resolve:c=>tE(c,"resolved"),reopen:c=>tE(c,"active"),delete:c=>{const h=Th();if(h)return h;const y=b()?.comments,_=y?.delete??y?.remove;if(typeof _!="function")return Xn("comments.delete is unavailable.");const E=Xn("comments.delete failed.");return Lt(()=>Oo(_.call(y,{commentId:c}),E),E)},setActive:c=>{if(c==null)return lt=null,V(),!0;if(!S())return!1;const h=Td.get(),y=P.get("comments"),_=y?.token===xe()&&y.hasSettled&&Array.isArray(y.value)?y.value:null,E=_??h.items;if(!_&&h.listStatus!=="ready")return!1;const F=YU(E,c);return!F||!E.some(H=>$r(H)===F)?!1:(lt=F,V(),!0)},scrollTo:async c=>{if(!b())return{success:!1,ok:!1,reason:S()?at.documentApiUnavailable:at.notReady};const h=await mg("comments",c,Td.get().items);return h?Ed(h):{success:!1,ok:!1,reason:at.targetUnresolved}}},es=Mn(c=>c.trackChanges),g2=(c,h)=>{ms();const y=(Yn().value??es.get().items).map(Zu).filter(Ne=>Ne!=null&&$r(Ne)!==null);if(y.length===0)return null;const _=O.trackChanges.activeId,E=et?.id===_?et.story:void 0,F=y.filter(Ne=>dh(Ne)==null),H=E||F.length===0?y:F;let ie=_?H.findIndex(Ne=>Ei(Ne,_,E)):-1;ie===-1&&_&&E&&(ie=H.findIndex(Ne=>Ei(Ne,_)));const he=H[ie===-1?c>0?0:H.length-1:(ie+c+H.length)%H.length],Me=$r(he),ze=dh(he);return N(ze?{id:Me,story:ze}:{id:Me},h),V(),Me},nE=async c=>{const h=T(),y=h?.listTrackedChanges;if(typeof y=="function")try{await Promise.resolve(y.call(h,{mode:"visible-window",targetIds:[c],refreshReason:"ui-track-change-reveal-restamp",blocking:!0}))}catch{}};let rE=Promise.resolve();const x$=c=>{const h=ae;return rE.catch(()=>{}).then(()=>R$(c,h))},R$=async(c,h)=>{if(ae!==h)return{success:!1};const y=et,_=g2(c,{invalidateQueuedNavigation:!1});if(_==null)return{success:!1};const E=et,F=Et,H=()=>ae===h&&et===E&&Et===F,ie=()=>{H()&&(N(y,{invalidateQueuedNavigation:!1}),V())};E&&He.add(E);try{const he=await mg("trackChanges",_,es.get().items,E?.story?{story:E.story}:void 0);if(!H())return{success:!1};if(!he)return ie(),{success:!1};const Me=es.get().items.find(Ne=>Ei(Ne,_,E?.story))??es.get().items.find(Ne=>$r(Ne)===_),ze=JI(Me);Fi+=1;try{const Ne=await eE(_,he,E?.story,ze,{behavior:"auto",shouldContinue:H});if(!H())return{success:!1};if(!Ne.ok&&Ne.reason!==at.targetNotVisible)ie(),se(y);else{if(Ne.ok&&await nE(_),!H())return{success:!1};se(E)}return{success:Ne.ok}}finally{Fi=Math.max(0,Fi-1),Fi===0&&(H()?Go&&Ft(el(Go)):se(et))}}finally{E&&He.delete(E)}},oE=c=>{const h=x$(c);return rE=h.then(()=>{},()=>{}),h},vg=ta(es,Sn(c=>Zi(c.selection,c.trackChanges)),"trackChanges"),M$={get:vg.get,getSnapshot:vg.getSnapshot,subscribe:vg.subscribe,observe:vg.observe,list:()=>{ms();const c=Yn().value??es.get().items,h=dn(xe());return c.map(Zu).filter(y=>y!=null).filter(y=>{const _=$r(y);return!_||!h?.has(_)})},accept:c=>xh("accept",c),acceptAsync:c=>yg(()=>xh("accept",c)),reject:c=>xh("reject",c),rejectAsync:c=>yg(()=>xh("reject",c)),acceptAll:()=>Kc("accept",{kind:"all"},null),acceptAllAsync:()=>yg(()=>Kc("accept",{kind:"all"},null)),rejectAll:()=>Kc("reject",{kind:"all"},null),rejectAllAsync:()=>yg(()=>Kc("reject",{kind:"all"},null)),next:()=>g2(1),previous:()=>g2(-1),navigateNext:()=>oE(1),navigatePrevious:()=>oE(-1),getAt:c=>{if(!c||typeof c!="object"||typeof c.x!="number"||typeof c.y!="number")return null;const h=y2(c);if(h.length===0)return null;const y=es.get().items;let _;for(const E of h){if(E.type!=="trackedChange")continue;let F;if(E.story){if(_===void 0&&(_=Mi()),!_)continue;F=_}else F=y;const H=F.find(ie=>Ei(ie,E.id,E.story));if(H)return E.story?{id:H.id,item:H,story:E.story}:{id:H.id,item:H}}return null},setActive:c=>{if(c==null)return N(null),se(null),V(),!0;if(!S())return!1;const h=typeof c=="string"?{id:c}:{id:c.id,story:c.story};if(typeof h.id!="string"||h.id.length===0)return!1;const y=h.id;if(h.story){const _=Mi();if(!_)return!1;const E=Fl(_,h.story).toPublicId(h.id)??h.id;if(!_.some(F=>Ei(F,E,h.story)))return!1;h.id=E}else{const _=Mi()??es.get().items,E=Hs(_).toPublicId(h.id)??h.id,F=_.find(H=>$r(H)===E);if(!F)return!1;h.id=E,h.story=dh(F)}return y!==h.id&&(h.paintedEntityId=y),N(h),se(h),V(),!0},scrollTo:async c=>{if(!b())return{success:!1,ok:!1,reason:S()?at.documentApiUnavailable:at.notReady};const h=typeof c=="string"?c:c.id,y=typeof c=="string"||!c.story||typeof c.story!="object"?void 0:c.story,_=y?dh({address:{story:y}}):void 0;if(typeof h!="string"||h.length===0)return{success:!1,ok:!1,reason:at.targetUnresolved};ae+=1,Ie+=1;const E=Ie,F=y?Mi()??es.get().items:es.get().items,H=y?Fl(F,y).toPublicId(h)??h:Hs(F).toPublicId(h)??h,ie=y?F.find(qe=>Ei(qe,H,y)):F.find(qe=>$r(qe)===H),he=y?_:dh(ie),Me=JI(ie),ze=et,Ne={id:H,...he?{story:he}:{},...H!==h?{paintedEntityId:h}:{}};He.add(Ne);try{const qe=await mg("trackChanges",H,F,he||y?{story:he,matchStory:y}:void 0);if(Ie!==E)return{success:!1,ok:!1};if(!qe)return{success:!1,ok:!1,reason:at.targetUnresolved};N(Ne);const Xe=Ie,We=et,Ge=Et,it=()=>Ie===Xe&&et===We&&Et===Ge,ut=()=>{it()&&(N(ze,{invalidateQueuedNavigation:!1}),V())};V(),Fi+=1;try{const Ke=await eE(H,qe,he,Me,{behavior:"auto",shouldContinue:it});if(!it())return{success:!1,ok:!1};if(!Ke.ok&&Ke.reason!==at.targetNotVisible)ut(),se(ze);else{if(Ke.ok&&await nE(H),!it())return{success:!1,ok:!1};se(Ne)}return Ke}finally{Fi=Math.max(0,Fi-1),Fi===0&&(it()?Go&&Ft(el(Go)):se(et))}}finally{He.delete(Ne)}}},xh=(c,h)=>{const{id:y,story:_}=typeof h=="string"?{id:h,story:void 0}:h;if(typeof y!="string"||y.length===0)return!1;const E={kind:"id",id:y,..._?{story:_}:{}};return Kc(c,E,y,_)},yg=c=>(ri=null,Fn=Promise.resolve(!1),ee||c()===!1?Promise.resolve(!1):Fn),Kc=(c,h,y,_)=>{try{return Bn(v2(c,h,y,_))}catch{return!1}},v2=(c,h,y,_)=>{if(Nc())return!1;const E=b()?.trackChanges,F=h.kind==="all"||h.scope==="all",H=h.kind==="range",ie=h.kind==="ids",he=F?[]:ie&&Array.isArray(h.ids)?h.ids.filter(qe=>typeof qe=="string"&&qe.length>0):y?[y]:[];if(he.length>0&&Ql(c,he)||ei({kind:c,scope:F?"all":"id"},E))return!1;const Me=F?`${c}All`:c,ze=!H&&!ie&&!_&&E&&typeof E[Me]=="function"?E[Me]:null,Ne=E&&typeof E.decide=="function"?E.decide:null;return!ze&&!Ne?!1:ze?ze.call(E,y??{}):Ne.call(E,{decision:c,target:h})},bg=Mn(c=>c.contentControls),Rh=c=>bg.get().items.find(h=>h?.id===c)??null,wg=ta(bg,Sn(c=>(lo.contentControls>0&&Qo("contentControls"),c.contentControls)),"contentControls"),L$=(c=>{if(c===void 0)return wg.get();const h=Qm(c);return h?Rh(h):null}),D$=Do(bg),O$={get:(c=>(c!==void 0&&xi("api"),L$(c))),getSnapshot:wg.getSnapshot,subscribe:wg.subscribe,observe:wg.observe,observeActivePath:D$.observe,list:()=>(xi("api"),bg.get().items),getById:c=>(xi("api"),Rh(c)),getRect:c=>{const h=Qm(c);if(!h)return Nl("unresolved");xi("panel");const y=Rh(h);if(!y)return Nl("unresolved");const _=Qb(y);return _?Ag.getRect({target:_}):Nl("unavailable")},scrollIntoView:async c=>{const h=Qm(c);if(!h)return{success:!1};xi("panel");const y=Rh(h);if(!y)return{success:!1};const _=Qb(y);return _?{success:(await Ed(_,{block:c.block,behavior:c.behavior})).ok}:{success:!1}},focus:async c=>{const h=Qm(c);if(!h)return{success:!1,reason:"invalid-id"};if(!S())return{success:!1,reason:"not-ready"};xi("panel");const y=Rh(h);if(!y)return{success:!1,reason:"not-found"};const _=Qb(y);if(!_)return{success:!1,reason:"not-reachable"};if(!(await Ed(_,{block:c.block,behavior:c.behavior})).ok)return{success:!1,reason:"not-reachable"};const E=UU(_);if(!E)return{success:!1,reason:"not-reachable"};const F=QI.apply(E);return!F.ok&&F.reason!==at.hostCapabilityUnavailable?{success:!1,reason:"not-reachable"}:(_$(h),{success:!0})}},Cg=Do(Mn(c=>c.fonts)),P$={get:Cg.get,getSnapshot:Cg.getSnapshot,subscribe:Cg.subscribe,observe:Cg.observe,getFamilyOptions:()=>O.fonts.options,getSizeOptions:()=>O.fonts.sizeOptions},kg=Do(Mn(c=>c.zoom)),F$={get:kg.get,getSnapshot:kg.getSnapshot,subscribe:kg.subscribe,observe:kg.observe,set:c=>{if(typeof t?.setZoom=="function")try{t.setZoom(c),V()}catch{}},setMode:c=>{if(typeof t?.setZoomMode=="function")try{t.setZoomMode(c),V()}catch{}}},Sg=Do(Mn(c=>c.document)),N$={get:Sg.get,getSnapshot:Sg.getSnapshot,subscribe:Sg.subscribe,observe:Sg.observe,setMode:c=>{if(typeof t?.setDocumentMode=="function")try{t.setDocumentMode(c),V()}catch{}},export:c=>{if(typeof t?.export=="function")try{return Promise.resolve(t.export(c))}catch{return}},getText:()=>{const c=b(),h=Lt(c?.getText?()=>c.getText({}):void 0,null);return typeof h=="string"?h:h&&typeof h=="object"&&typeof h.text=="string"?h.text:null},replaceFile:c=>{const h=t?.replaceFile??t?.loadDocument??t?.reload;if(typeof h=="function")try{return Promise.resolve(h.call(t,c))}catch{return}}},iE=()=>{if(typeof HTMLElement>"u")return null;const c=S()?.mount?.container;if(c instanceof HTMLElement)return c;const h=t?.element;return h instanceof HTMLElement?h:null},B$=(c,h)=>{if(typeof c!="number"||typeof h!="number"||!Number.isFinite(c)||!Number.isFinite(h))return[];const y=globalThis.document;if(!y||typeof y.elementFromPoint!="function")return[];const _=iE();if(!_)return[];const E=y.elementFromPoint(c,h);if(!E||!_.contains(E))return[];const F=[E],H=Ke=>{Ke&&_.contains(Ke)&&!F.includes(Ke)&&F.push(Ke)},ie=y.elementsFromPoint;if(typeof ie=="function"){let Ke=[];try{Ke=ie.call(y,c,h)??[]}catch{Ke=[]}for(const _t of Ke)H(_t)}const he=[],Me=Ke=>{Ke&&_.contains(Ke)&&!he.includes(Ke)&&!F.includes(Ke)&&he.push(Ke)},ze=Ke=>{const _t=Ke.getBoundingClientRect;if(typeof _t!="function")return!1;let It;try{It=_t.call(Ke)}catch{return!1}return It!=null&&c>=It.left&&c<=It.right&&h>=It.top&&h<=It.bottom};for(const Ke of F){const _t=Ke.querySelectorAll;if(typeof _t!="function")continue;let It;try{It=_t.call(Ke,"[data-track-change-marker]")}catch{continue}for(let _n=0;_n<It.length;_n+=1)ze(It[_n])&&Me(It[_n])}he.reverse();const Ne=[...he,...F],qe=yI(Ne[0],_);for(let Ke=1;Ke<Ne.length;Ke+=1)for(const _t of yI(Ne[Ke],_))qe.push(_t);if(qe.length===0)return qe;const Xe=es.get().items,We=Hs(Xe);let Ge;const it=new Set,ut=[];for(const Ke of qe){if(Ke.type!=="trackedChange"){const An=`${Ke.type}:${Ke.id}`;if(it.has(An))continue;it.add(An),ut.push(Ke);continue}const _t=VU(Ke.storyKey)??jU(Ke.story);let It;if(_t){if(Ge===void 0&&(Ge=Mi()),!Ge||(It=Fl(Ge,_t).toPublicId(Ke.id),!It||!Ge.some(An=>Ei(An,It,_t))))continue}else if(It=We.toPublicId(Ke.id),!It)continue;const _n=`trackedChange:${It}`;it.has(_n)||(it.add(_n),ut.push(_t?{type:"trackedChange",id:It,story:_t}:{type:"trackedChange",id:It}))}return ut};function y2(c,h){return typeof c=="object"?B$(c?.x,c?.y):null}function sE(c){const h=!!c&&typeof c.x=="number"&&typeof c.y=="number",y=h?{x:c.x,y:c.y}:{x:0,y:0};return{point:y,entities:h?y2(y):[],selection:O.selection,position:null,insideSelection:!1}}const xd=new Set;let b2=!1;const aE=c=>{const h=j();if(typeof h?.observeGeometry!="function")return;let y=!1;const _=Lt(()=>{const E=h.observeGeometry(()=>c.schedule());return y=!0,E},null);c.detach=typeof _=="function"?_:null,c.boundHost=y?h:null},_g=c=>{if(c.detach){try{c.detach()}catch{}c.detach=null}c.boundHost=null},lE=()=>{if(b2=!1,!(ee||j()))for(const c of xd)_g(c)},z$=()=>{if(!b2){if(b2=!0,typeof queueMicrotask=="function"){queueMicrotask(lE);return}Promise.resolve().then(lE)}},j$=()=>{const c=j();if(!c){z$();return}for(const h of xd)h.boundHost&&h.boundHost===c||(_g(h),aE(h),h.schedule())};be.push(j$);const Ag={getRect:c=>{const h=j(),y=h?.getTargetRects;if(typeof y=="function"){const _=Lt(()=>y.call(h,{target:c.target}),null);return _&&typeof _=="object"?_.success===!0&&Array.isArray(_.rects)?fH(dH(_.rects.filter(E=>E!=null&&typeof E=="object")),c.relativeTo):Nl(typeof _.reason=="string"?_.reason:"unresolved"):Nl("unresolved")}return Nl("unavailable")},observe:c=>{const h=[];let y=0;const _=typeof requestAnimationFrame=="function",E=()=>{if(!_){c();return}y||(y=requestAnimationFrame(()=>{y=0,c()}))},F=Sn(ie=>({ready:ie.ready,selection:ie.selection,zoom:ie.zoom}));h.push(F.subscribe(()=>E()));const H={schedule:E,detach:null,boundHost:null};return aE(H),xd.add(H),()=>{xd.delete(H),_g(H),y&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(y);for(const ie of h.splice(0))try{ie()}catch{}}},getHost:()=>iE(),entityAt:y2,contextAt:sE,scrollIntoView:async c=>{const h=c?.target;if(!h)return{success:!1};let y=null;if(h.kind==="entity"){const _=h.entityType==="comment"?"comments":"trackChanges",E=_==="comments"?Td.get().items:es.get().items,F=h.entityType==="trackedChange"&&h.story?{story:h.story}:void 0;y=await mg(_,h.entityId,E,F)}else{const _=h,E=h,F=Array.isArray(_.segments)&&_.segments.length>0?_.segments:E.blockId&&E.range?[{blockId:E.blockId,range:E.range}]:null;if(F){const H=h.story;y={kind:"text",segments:F,...H?{story:H}:{}}}}return y?{success:(await Ed(y,{block:c.block??"center",behavior:c.behavior??"smooth"})).ok}:{success:!1}}},cE=c=>{const h=(c&&typeof c=="object"?c:null)?.target;return h&&typeof h=="object"?h:null},uE=c=>`metadata:resolve:${c}`,V$=c=>{const h=b()?.metadata;if(!h||typeof h.resolve!="function")return null;const{value:y}=to(uE(c),xe(),()=>h.resolve({id:c}),cE);return y},U$=async c=>{const h=b()?.metadata;if(!h||typeof h.resolve!="function")return null;try{const y=xe(),_=await Promise.resolve(h.resolve({id:c}));if(y!==xe())return null;const E=cE(_);return P.set(uE(c),{token:y,value:E,hasSettled:!0,inflightToken:null}),E}catch{return null}},H$={getRect:c=>{const h=b()?.metadata;if(!h||typeof h.resolve!="function")return Nl("unavailable");const y=V$(c.id);return y?Ag.getRect({target:y}):Nl("unresolved")},scrollIntoView:async c=>{const h=await U$(c.id);return h?{success:(await Ed(h,{block:c.block,behavior:c.behavior})).ok}:{success:!1}}},$$={inTable:!1,tableNodeId:null,rowIndex:null,columnIndex:null,cellNodeId:null,rows:null,columns:null},G$={getContext:()=>{const c=Fe();if(!c)return{...$$};const h=Ee()?.table;return{inTable:!0,tableNodeId:c.tableNodeId,rowIndex:c.rowIndex,columnIndex:c.columnIndex,cellNodeId:c.cellNodeId,rows:typeof h?.rows=="number"?h.rows:null,columns:typeof h?.columns=="number"?h.columns:null}},isInTable:()=>Fe()!=null},Ig={query:"",total:0,activeIndex:-1,open:!1,available:!1,caseSensitive:!1,includeTrackedDeletions:!1,includeDeletedText:!1,regex:!1,canReplace:!1,canReplaceAll:!1,reason:at.searchUnavailable};let In={...Ig};const Eg=new Set,nl=()=>{const c=j()?.search;return c&&typeof c=="object"?c:null},Ss=()=>{const c=Y()?.search;return c&&typeof c=="object"?c:null},Mh=()=>{const c=nl();if(c&&typeof c.setSession=="function")return!0;const h=Ss();return!!h&&typeof h.query=="function"&&typeof h.getState=="function"},ts=()=>{for(const c of[...Eg])try{c(In)}catch{}},bi=c=>{In={...In,...c};const h=c.includeTrackedDeletions??c.includeDeletedText;return h!==void 0&&(In.includeTrackedDeletions=h,In.includeDeletedText=h),ts(),In};let Xr=0,Rd=null,qc=null;const dE=()=>{const c=qc;qc=null,c&&Lt(()=>(c(),null),null)},W$=()=>{Xr+=1,Rd=null,rl=!1,dE();const c=Mh();In={...Ig,available:c,reason:c?void 0:at.searchUnavailable},ts()};Pe.push(W$),ft.push(()=>{if(Rd===Xr)return;const c=In,h=oa();(h.canReplace!==c.canReplace||h.canReplaceAll!==c.canReplaceAll||h.available!==c.available||h.reason!==c.reason)&&ts()});const K$=c=>{if(!c)return!1;const h=c.queryError;if(h&&typeof h=="object"&&h.code==="invalid-pattern")return!0;const y=c.rejection;return c.status==="rejected"&&!!y&&typeof y=="object"&&y.code==="invalid-pattern"},w2=(c,h=!1,y=h)=>{const _=c&&typeof c=="object"?c:null;if(!_)return null;const E=Array.isArray(_.matches)?_.matches:[],F=typeof _.total=="number"&&Number.isFinite(_.total)?_.total:E.length,H=typeof _.activeMatchIndex=="number"?_.activeMatchIndex:typeof _.activeIndex=="number"?_.activeIndex:-1,ie=_.canReplace===!0||h;return{...typeof _.query=="string"?{query:_.query}:{},total:F,activeIndex:H,canReplace:ie,canReplaceAll:ie&&F>0&&_.truncated!==!0&&(_.canReplace===!0||y),...typeof _.caseSensitive=="boolean"?{caseSensitive:_.caseSensitive}:{},...typeof _.includeDeletedText=="boolean"?{includeDeletedText:_.includeDeletedText}:{},..._.regex===!0?{regex:!0}:{},...K$(_)?{invalidPattern:!0}:{}}};let rl=!1;const fE=()=>{if(!rl)return;rl=!1;const c=Ss();c&&typeof c.query=="function"&&Lt(()=>c.query({query:""}),null)},Wo=()=>Ce("find.replace")?.enabled===!0,Ko=()=>Ce("find.replaceAll")?.enabled===!0,Po=(c,h=!1,y=h)=>{const _=w2(c,h,y);if(!_){bi({total:0,activeIndex:-1,canReplace:!1,canReplaceAll:!1,reason:void 0});return}bi({..._.query!==void 0?{query:_.query}:{},total:_.total,activeIndex:_.activeIndex,canReplace:_.canReplace,canReplaceAll:_.canReplaceAll,..._.includeDeletedText!==void 0?{includeDeletedText:_.includeDeletedText}:{},..._.regex!==void 0?{regex:_.regex}:{},reason:_.invalidPattern?at.searchInvalidPattern:void 0})},oa=()=>{const c=nl();if(c&&typeof c.getState!="function")return In={...In,available:Mh(),reason:Mh()?void 0:at.searchUnavailable},In;if(!c){const y=Ss();if(y&&typeof y.getState=="function"){const _=w2(Lt(()=>y.getState(),null),Wo(),Ko());if(Rd===Xr)return In;if(_)return In={...In,..._.query!==void 0?{query:_.query}:{},total:_.total,activeIndex:_.activeIndex,canReplace:_.canReplace,canReplaceAll:_.canReplaceAll,available:!0,reason:_.invalidPattern?at.searchInvalidPattern:void 0,open:In.open||!!_.query},In}return In={...Ig,query:In.query,caseSensitive:In.caseSensitive,includeTrackedDeletions:In.includeTrackedDeletions,includeDeletedText:In.includeDeletedText},In}const h=w2(Lt(()=>c.getState(),null));return h&&(In={...In,...h.query!==void 0?{query:h.query}:{},total:h.total,activeIndex:h.activeIndex,canReplace:h.canReplace,canReplaceAll:h.canReplaceAll,...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?at.searchInvalidPattern:void 0,open:In.open||!!h.query}),In},Md=c=>{const h=c&&typeof c=="object"?c:null;if(h?.status==="committed")return{ok:!0};if(h?.status==="rejected"&&h.reason==="read-only")return{ok:!1,reason:at.documentReadonly};const y=h?.rejection;return h?.status==="rejected"&&y&&typeof y=="object"&&y.code==="read-only-document"?{ok:!1,reason:at.documentReadonly}:{ok:!1,reason:at.operationUnavailable}},Tg=Do({get:()=>oa(),subscribe:c=>(Eg.add(c),()=>Eg.delete(c))}),hE={get:Tg.get,getSnapshot:Tg.getSnapshot,subscribe:Tg.subscribe,observe:Tg.observe,open:()=>Mh()?(bi({available:!0,open:!0,reason:void 0}),{ok:!0}):(bi({available:!1,open:!1,reason:at.searchUnavailable}),{ok:!1,reason:at.searchUnavailable}),close:()=>{if(Xr+=1,qc)dE();else{const c=nl();if(c&&typeof c.clear=="function")Lt(()=>c.clear(),null);else{const h=Ss();h&&typeof h.query=="function"&&Lt(()=>h.query({query:""}),null)}}In={...Ig,available:Mh(),reason:void 0},In.available||(In.reason=at.searchUnavailable),ts()},find:(c,h)=>{const y=nl(),_=!!h?.caseSensitive,E=(h?.includeTrackedDeletions??h?.includeDeletedText)===!0,F=h?.regex===!0,H=++Xr;if(fE(),!y||typeof y.setSession!="function"){const he=Ss();if(he&&typeof he.query=="function"&&typeof he.getState=="function"){Rd=H,bi({query:c,caseSensitive:_,includeDeletedText:E,regex:F,total:0,activeIndex:-1,canReplace:!1,canReplaceAll:!1,available:!0,open:!0,reason:void 0}),qc=()=>{he.query({query:""})};const Me=Lt(()=>he.query({query:c,caseSensitive:_,includeDeletedText:E,regex:F}),null);return Fr(Me)?(rl=!0,Promise.resolve(Me).then(ze=>{H===Xr&&(rl=!1,Rd=null,Po(ze,Wo(),Ko()))},()=>{H===Xr&&(rl=!1,bi({available:!1,reason:at.searchUnavailable}))}),In):(Rd=null,Po(Me,Wo(),Ko()),Po(Lt(()=>he.getState(),null),Wo(),Ko()),In)}return bi({query:c,total:0,activeIndex:-1,available:!1,caseSensitive:_,includeDeletedText:E,regex:F,reason:at.searchUnavailable})}bi({query:c,caseSensitive:_,includeDeletedText:E,regex:F,available:!0,open:!0,reason:void 0}),qc=()=>{typeof y.clear=="function"&&y.clear()};const ie=Lt(()=>y.setSession(c,{caseSensitive:_,includeDeletedText:E,...F?{regex:!0}:{},highlight:!0}),null);if(Po(ie),c.length>0&&In.total===0&&In.reason!==at.searchInvalidPattern){const he=Ss();if(he&&typeof he.query=="function"&&typeof he.getState=="function"){const Me=qc;qc=()=>{Me?.(),he.query({query:""})};const ze=Lt(()=>he.query({query:c,caseSensitive:_,includeDeletedText:E,regex:F}),null);Fr(ze)?(rl=!0,Promise.resolve(ze).then(Ne=>{H===Xr&&(rl=!1,Po(Ne,Wo(),Ko()))},()=>{H===Xr&&(rl=!1,bi({available:!1,reason:at.searchUnavailable}))})):Po(ze,Wo(),Ko()),Po(Lt(()=>he.getState(),null),Wo(),Ko())}}return In},search:(c,h)=>hE.find(c,h),next:()=>{const c=nl();if(!c||typeof c.next!="function"){const h=Ss();if(!h||typeof h.next!="function"||typeof h.getState!="function")return{ok:!1,reason:at.searchUnavailable};if(In.total===0)return{ok:!1,reason:at.operationUnavailable};const y=Lt(()=>h.next(),null);if(Fr(y)){const _=Xr;Promise.resolve(y).then(E=>{_===Xr&&Po(E,Wo(),Ko())}).catch(()=>{_===Xr&&bi({available:!1,reason:at.searchUnavailable})})}else Po(y,Wo(),Ko());return Po(Lt(()=>h.getState(),null),Wo(),Ko()),{ok:!0}}return In.total===0?{ok:!1,reason:at.operationUnavailable}:(Po(Lt(()=>c.next(),null)),{ok:!0})},previous:()=>{const c=nl();if(!c||typeof c.previous!="function"){const h=Ss();if(!h||typeof h.previous!="function"||typeof h.getState!="function")return{ok:!1,reason:at.searchUnavailable};if(In.total===0)return{ok:!1,reason:at.operationUnavailable};const y=Lt(()=>h.previous(),null);if(Fr(y)){const _=Xr;Promise.resolve(y).then(E=>{_===Xr&&Po(E,Wo(),Ko())}).catch(()=>{_===Xr&&bi({available:!1,reason:at.searchUnavailable})})}else Po(y,Wo(),Ko());return Po(Lt(()=>h.getState(),null),Wo(),Ko()),{ok:!0}}return In.total===0?{ok:!1,reason:at.operationUnavailable}:(Po(Lt(()=>c.previous(),null)),{ok:!0})},clear:()=>{Xr+=1,fE();const c=nl();if(c&&typeof c.clear=="function"&&Lt(()=>c.clear(),null),!c||typeof c.clear!="function"){const h=Ss();h&&typeof h.query=="function"&&Lt(()=>h.query({query:""}),null)}bi({query:"",total:0,activeIndex:-1,canReplace:!1,canReplaceAll:!1,reason:void 0})},replace:c=>{const h=nl();if(!h){const _=Ss();if(!_||typeof _.replace!="function"||typeof _.getState!="function")return{ok:!1,reason:at.searchUnavailable};if(!Wo())return{ok:!1,reason:at.operationUnavailable};const E=Lt(()=>_.replace({replacement:typeof c=="string"?c:""}),null);if(Fr(E)){const F=Xr;oa(),ts();const H=()=>F===Xr;return Promise.resolve(E).then(ie=>(H()&&(Po(ie,Wo(),Ko()),oa(),ts()),Md(ie)),()=>(H()&&bi({available:!1,reason:at.searchUnavailable}),{ok:!1,reason:at.searchUnavailable}))}return oa(),ts(),Md(E)}if(typeof h.replaceCurrent!="function")return{ok:!1,reason:at.operationUnavailable};const y=Lt(()=>h.replaceCurrent(typeof c=="string"?c:""),null);return oa(),ts(),Md(y)},replaceAll:c=>{const h=nl();if(!h){const _=Ss();if(!_||typeof _.replaceAll!="function"||typeof _.getState!="function")return{ok:!1,reason:at.searchUnavailable};if(!Ko())return{ok:!1,reason:at.operationUnavailable};const E=Lt(()=>_.replaceAll({replacement:typeof c=="string"?c:""}),null);if(Fr(E)){const F=Xr;oa(),ts();const H=()=>F===Xr;return Promise.resolve(E).then(ie=>(H()&&(Po(ie,Wo(),Ko()),oa(),ts()),Md(ie)),()=>(H()&&bi({available:!1,reason:at.searchUnavailable}),{ok:!1,reason:at.searchUnavailable}))}return oa(),ts(),Md(E)}if(typeof h.replaceAll!="function")return{ok:!1,reason:at.operationUnavailable};const y=Lt(()=>h.replaceAll(typeof c=="string"?c:""),null);return oa(),ts(),Md(y)}},pE=Mn(c=>c.styles),xg=Do(pE),q$={get:xg.get,getSnapshot:xg.getSnapshot,subscribe:xg.subscribe,observe:xg.observe,getCatalog:c=>(Qo($o(c)),st(c).value),getQuickGallery:()=>pE.get().quickGallery,getActiveParagraphStyle:()=>gi(O.selection,on().cache).style},mE={select:Sn,get state(){return O},selection:QI,commands:A$,toolbar:I$,comments:T$,trackChanges:M$,contentControls:O$,fonts:P$,zoom:F$,document:N$,viewport:Ag,metadata:H$,tables:G$,search:hE,contextMenu:k,styles:q$,formatPainter:{setPointerSelecting(c){ee||(p={...p,pointerSelecting:c})},notifyPointerUp(){ee||(p={...p,pointerSelecting:!1},qI())},setKeyboardSelecting(c){ee||(p={...p,keyboardSelecting:c})},notifyKeyUp(){ee||(p={...p,keyboardSelecting:!1},qI())},cancel(){ee||dg()},onModeChange(c){return ee?()=>{}:(m.add(c),()=>m.delete(c))}},createScope:()=>{const c=[];return{select:(h,y)=>{const _=Sn(h,y);return{get:_.get,subscribe:E=>{const F=_.subscribe(E);return c.push(F),F}}},dispose:()=>{for(const h of c.splice(0))h()}}},destroy:()=>{if(!ee){ee=!0,RU(Ir,Qe),ot&&(clearTimeout(ot),ot=null),De&&(clearTimeout(De),De=null,Ye=0),_e?.timer&&(clearTimeout(_e.timer),_e.timer=null),_e=null,xt&&(clearTimeout(xt),xt=null),mn&&(clearTimeout(mn),mn=null),Kr&&Kr(),Kr=null,wr=null;for(const c of Object.keys(lo))lo[c]=0;Xt.clear(),un.clear(),ir.clear(),Wr=null,B.clear();for(const c of Hn.splice(0))c();ro&&ro(),ro=null,Cs=null,Di&&Di(),Di=null,Li=null,So&&So(),So=null,Oi=null,_o&&_o(),_o=null,Go=null,yi&&yi(),yi=null,Ja=null,Pi&&Pi(),Pi=null,tc=null;for(const c of xd)_g(c);xd.clear(),q.clear(),Eg.clear(),g+=1,m.clear(),Xr+=1,Ze.clear()}}};return ye=mE,mE}var wH=[{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 CH(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 kH(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"?CH(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 SH(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 _H(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:wH;for(const s of i)o(s);return n}var AH=[{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 IH(e,t){return e.activeMark?t.activeMarks.includes(e.activeMark):!1}Dt();var EH=['[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(", "),TH=800,OI=typeof Blob=="function"?Object.getOwnPropertyDescriptor(Blob.prototype,"size")?.get:void 0,PI=e=>{if(!OI)return!1;try{return OI.call(e),!0}catch{return!1}};function xH(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 RH=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"]),MH=["original","markup","final"],LH=["review","original","final","off"];function FI(e){return MH.includes(e)}function DH(e){return e==="markup"?"review":e}function NI(e){return LH.includes(e)}function OH(e){const t=e.modules?.trackChanges?.mode;if(NI(t))return t;const n=e.layoutEngineOptions?.trackedChanges?.mode;return NI(n)?n:null}function ng(e,t){const n=e.viewing,r=FI(n?.trackedChanges)?n.trackedChanges:null,o=r?DH(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 PH(e,t){const n=new OT.default;return e.forEach((r,o)=>{n.file(t[o],r)}),n.generateAsync({type:"blob",compression:"DEFLATE"})}function s2(e){return!!(e&&(e.synced===!0||e.isSynced===!0))}function BI(e){try{e.synced=!0}catch{}try{e.isSynced=!0}catch{}}function FH(e,t){if(!e)return()=>{};if(s2(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=()=>{BI(e),s()},l=u=>{u!==!1&&(u===!0||s2(e))&&(BI(e),s())};return n("synced",a),n("sync",l),s2(e)&&s(),i}function NH(e,t){const n=e.composedPath();if(!n.includes(t))return null;const r=n.find(a=>a instanceof HTMLElement&&a.matches(EH));if(!r)return null;const o=n.some(a=>a instanceof HTMLElement&&a.classList.contains(Mp.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 BH(e){if(!e||typeof e!="object")return[];const t=e.items;return Array.isArray(t)?t:[]}function zI(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 jI(e){const t=e.selectionTarget??e.target;if(!t)return null;try{return JSON.stringify(t)}catch{return null}}function fi(e){return!!(e&&typeof e=="object"&&e.editorVersion===2)}function zH(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 VI(e){return typeof e=="string"&&e.length>0?e:null}function UI(e){return e?fi(e)?VI(e.documentId??e.options?.documentId??null):VI(typeof e.getDocumentId=="function"?e.getDocumentId():e.options?.documentId):null}function jH(e){if(!e||fi(e))return null;const t=e;return t.documentRenderer??t.presentationEditor??null}function ps(e){if(!e)return null;if(fi(e))return e.fonts??null;const t=jH(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 rg=class extends Mg.default{static{this.allowedTypes=[_r,Ca,vu]}#e;#n;#t;#o;#i;#s;#d;#u;#c;#h;#g;#r;#a;#p;#k;#b;#A;#S;#M;#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()+TH))},this.#M=n=>{this.listenerCount("content-control:active-change")>0&&!xH(n)&&(this.#r="keyboard",this.#a=null)},this.#D=n=>{this.#z(n)},this.#v=null,this.#w=G4({}),this.#T=W4({}),this.#x=q4({}),this.version="0.0.0",this.users=[],this.whiteboard=null,this.colors=[],this.readyEditors=0,this.pendingCollaborationSaves=0,this.#f=new Ez,this.#C=null,this.#m=!1,this.#R=null,this.config={selector:"#superdoc",documentMode:"editing",allowSelectionInViewMode:!1,role:"editor",documents:[],editorExtensions:[],colors:[],users:[],user:{...zb},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 nz({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.#M,!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=NH(e,t),r=this.activeEditor?.doc?.contentControls?.list;if(!(!n||typeof r!="function"))try{const o=await r();if(this.#e)return;const i=zI(BH(o).find(s=>s.id===n));i&&this.emit("content-control:click",{target:i,source:"pointer"})}catch{return}}async#Y(e,t){this.#R=OH(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),Bb(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.#Me(),this.config.user=fz(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=TS(this.config.modules.comments),this.#w=G4(this.config),this.#T=W4(this.config),this.#x=q4(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=UT(this.config.colors),this.userColorMap=new Map,this.colorIndex=0,this.version="2.12.0",this.#E("π¦ [superdoc] Using SuperDoc version:",this.version),this.superdocId=e.superdocId||ol(),this.colors=this.config.colors??[],this.#_(),await e7(),this.#e)return;if(await this.#V(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.#j()}#j(){if(this.#L(),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 TF({Renderer:JB,superdoc:this,enabled:t}),this.emit("whiteboard:init",{whiteboard:this.whiteboard})}get requiredNumberOfEditors(){return this.#y("requiredNumberOfEditors").documents.filter(e=>e.type===_r).length}get ui(){return this.#v||(this.#v=bH({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=jI(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),u=this.activeEditor;(l||this.#b?.editor!==u||this.#b.key!==a)&&(this.#b={editor:u,key:a,source:l??"keyboard"}),this.#r=null,this.#a=null}),r=this.#v.contentControls.observeActivePath(s=>{const a=this.activeEditor,l=s.activeIds.map(v=>zI(s.items.find(C=>C.id===v)));if(l.some(v=>v===null))return;const u=l,d=a===e,f=u.length===t.length&&u.every((v,C)=>v.id===t[C]?.id);if(d&&f)return;if(u.length===0&&t.length===0){e=a;return}const p=d?t[0]??null:null;e=a,t=u;const g=jI(this.#v.selection.getSnapshot()),m=this.#b;this.emit("content-control:active-change",{active:u[0]??null,previous:p,activePath:u,source:g&&m?.editor===a&&m.key===g?m.source:"keyboard"})});const i=()=>{n?.(),r?.()};this.#e||this.listenerCount("content-control:active-change")===0?i():this.#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:jy(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=Uy(e);this.config.documents=[{id:ol(),...o}]}else n&&(this.config.documents=[{id:ol(),type:_r,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=Uy(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()}}))}#L(){const{app:e,pinia:t,superdocStore:n,commentsStore:r,highContrastModeStore:o}=mF({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&&zR(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#V({collaboration:e}={}){return e?(this.isCollaborative=!1,this.config.documents.length===0&&(this.config.documents=[{id:ol(),type:_r,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=io(e),this.provider=io(t),this.#ve();const n=this.config;this._cleanupAwareness=OR(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(),fi(e)&&(this.#ee(e),this.#te(e))}#ee(e){const t=e.presence;if(!t||typeof t.subscribe!="function")return;const n=_F(()=>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
|
+
`;Dt();var Us=e=>{e.expand.value=!1},Wb=(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 Kb(e,t){const n={...e};return t?n.href=t:delete n.href,n}function fI(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 rU(e){return typeof e?.quotedText=="string"?e.quotedText:typeof e?.text=="string"?e.text:""}function hI(e){return e.ui?.selection?.get?.()??e.ui?.selection?.current?.()??null}function oU(e){return!!(e.config?.superdoc?.config?.modules?.ai||e.superdoc?.config?.modules?.ai)}function iU(e){return e.config?.superdoc?.config?.modules?.ai??e.superdoc?.config?.modules?.ai??{}}var sU=({superToolbar:e,toolbarIcons:t,toolbarTexts:n,toolbarFonts:r,hideButtons:o,availableWidth:i,role:s,isDev:a=!1,configuredItemNames:l,excludedItemNames:u,additionalItems:d=[]}={})=>{const f=xn({type:"button",name:"bold",command:"toggleBold",icon:t.bold,tooltip:n.bold,attributes:{ariaLabel:"Bold"}}),p=(r??Qj).map(iV),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:Qe}={},wt=!1)=>{if(wt){g.label.value="",g.selectedValue.value="";return}if(!Qe)return;Qe=Qe.split(",")[0];const Pt=tn=>tn.value??tn.label,cn=p.find(tn=>Pt(tn)===g.defaultLabel.value),pn=p.find(tn=>Pt(tn)===Qe);pn?(g.label.value=pn.label,g.selectedValue.value=pn.key):cn?(g.label.value=Qe,g.selectedValue.value=cn.key):(g.label.value=Qe,g.selectedValue.value="")},onDeactivate:()=>{const Qe=p.find(wt=>(wt.value??wt.label)===g.defaultLabel.value);g.label.value=Qe?.label??g.defaultLabel.value,g.selectedValue.value=Qe?.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(Qe){const wt=hI(e),Pt=wt?.selectionTarget??fI(wt?.target),cn=wt?.empty?"":rU(wt),pn=iU(e),tn=()=>Us(Qe),wn=()=>{const nn=e.pendingSelectionCapture;nn&&typeof e.ui?.selection?.restore=="function"&&e.ui.selection.restore(nn)};return Ur("div",{},[Ur(LV,{handleClose:tn,selectedText:cn,target:Pt,doc:e.superdoc?.activeEditor?.doc??null,apiKey:pn?.apiKey||e.config?.aiApiKey||"",endpoint:pn?.endpoint||e.config?.aiEndpoint||"",restoreSelection:wn})])}const C=eV,w=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:C,onActivate:({fontSize:Qe},wt=!1)=>{if(wt){w.label.value="",w.selectedValue.value="";return}const Pt=C.find(wn=>wn.label===String(w.defaultLabel.value));if(!Qe){w.label.value=w.defaultLabel.value,Pt?w.selectedValue.value=Pt.key:w.selectedValue.value="";return}let cn=Kz(Qe,12);cn<8&&(cn=8),cn>96&&(cn=96);let pn=String(cn);const tn=C.find(wn=>wn.label===pn||wn.key===pn);tn?w.selectedValue.value=tn.key:w.selectedValue.value="",w.label.value=pn},onDeactivate:()=>{w.label.value=w.defaultLabel.value;const Qe=C.find(wt=>wt.label===String(w.defaultLabel.value));Qe?w.selectedValue.value=Qe.key:w.selectedValue.value=""}}),S=()=>xn({type:"separator",name:"separator",isNarrow:!0}),k=xn({type:"button",name:"italic",command:"toggleItalic",icon:t.italic,active:!1,tooltip:n.italic,attributes:{ariaLabel:"Italic"}}),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:()=>Gb(e,L,[],!0)}],onActivate:({color:Qe})=>{L.iconColor.value=Qe||""},onDeactivate:()=>L.iconColor.value=""}),z=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:()=>Gb(e,z)}],onActivate:({color:Qe})=>{z.iconColor.value=Qe},onDeactivate:()=>z.iconColor.value="#000"}),G=xn({type:"button",name:"search",allowWithoutEditor:!0,active:!1,icon:t.search,tooltip:n.search,group:"right",attributes:{ariaLabel:"Search"}}),U=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:()=>j(U)}],onActivate:({href:Qe})=>{U.attributes.value=Kb(U.attributes.value,Qe)},onDeactivate:()=>{U.attributes.value=Kb(U.attributes.value,null),U.expand.value=!1}});function j(Qe){const wt=hI(e),Pt=wt?.selectionTarget??fI(wt?.target),cn=()=>{const pn=e.pendingSelectionCapture;pn&&typeof e.ui?.selection?.restore=="function"&&e.ui.selection.restore(pn)};return Ur("div",{},[Ur(__,{ui:e.ui,linkItem:Qe,textTarget:Pt,restoreSelection:cn,closePopover:()=>{Us(Qe),xc(e)},goToAnchor:()=>{Us(Qe);const pn=Qe.attributes.value?.href;if(!pn)return;const tn=pn.slice(1),wn=(e.ui?.viewport?.getHost?.()??null)?.querySelector?.(`a[name='${tn}']`);wn&&A_(wn)}})])}const Z=xn({type:"options",name:"linkInput",command:"toggleLink",active:!1});U.childItem=Z,Z.parentItem=U;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(Qe){return Ur("div",{},[Ur(qV,{onSelect:Pt=>{e.emitCommand({item:Qe,argument:Pt}),Us(Qe),xc(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($)}]}),J=[{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(Qe){return Ur(tU,{options:J,onSelect:wt=>{Us(Qe);const{command:Pt}=wt;e.emitCommand({item:Qe,argument:{command:Pt}}),xc(e)}})}const Y=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:()=>Ur("div",{},[Ur(lV,{onSelect:wt=>{Us(Y);const Pt={...Y,command:"setTextAlign"};Pt.command="setTextAlign",e.emitCommand({item:Pt,argument:wt}),Ce(Y,wt),xc(e)}})]),key:"alignment"}],onActivate:({textAlign:Qe})=>{Ce(Y,Qe)},onDeactivate:()=>{Ce(Y,"left")}}),Ce=(Qe,wt)=>{let Pt=wt==="both"?"justify":wt,cn={left:t.alignLeft,right:t.alignRight,center:t.alignCenter,justify:t.alignJustify},pn=cn[Pt]??cn.left;Qe.icon.value=pn},fe=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 Qe=wt=>{Us(fe);const Pt={...fe,command:"toggleBulletListStyle"};e.emitCommand({item:Pt,argument:wt})};return Ur(uI,{buttons:dV,iconSize:25,selectedStyle:fe.selectedValue.value,onSelect:Qe})}}]}),ve=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 Qe=wt=>{Us(ve);const Pt={...ve,command:"toggleOrderedListStyle"};e.emitCommand({item:Pt,argument:wt})};return Ur(uI,{buttons:fV,iconSize:30,selectedStyle:ve.selectedValue.value,onSelect:Qe})}}]}),me=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"}}),Fe=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:Qe})=>{Qe&&(Ze.label.value=Qe)}}),lt=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:Qe})=>{Qe&&(lt.label.value=Qe)}}),et=xn({type:"button",name:"undo",disabled:!0,tooltip:n.undo,command:"undo",icon:t.undo,group:"left",attributes:{ariaLabel:"Undo"}}),Et=xn({type:"button",disabled:!0,name:"redo",tooltip:n.redo,command:"redo",icon:t.redo,group:"left",attributes:{ariaLabel:"Redo"}}),ae=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"}}),He=xn({type:"button",name:"clearFormatting",command:"clearFormat",tooltip:n.clearFormatting,icon:t.clearFormatting,attributes:{ariaLabel:"Clear formatting"}}),re=xn({type:"button",name:"copyFormat",tooltip:n.copyFormat,icon:t.copyFormat,command:"copyFormat",active:!1,attributes:{ariaLabel:"Copy formatting"}}),I=(Qe,wt)=>Qe==="editor"?wt:Qe==="suggester"?wt.filter(Pt=>Pt.value==="suggesting"):wt.filter(Pt=>Pt.value==="viewing"),se=Qe=>Qe==="editor"?"Editing":Qe==="suggester"?"Suggesting":"Viewing",N=xn({type:"dropdown",name:"documentMode",command:"setDocumentMode",allowWithoutEditor:!0,icon:t.documentMode,defaultLabel:se(s),label:se(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(N)}]}),q=[{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(Qe){return Ur(wV,{options:I(s,q),onSelect:wt=>{const Pt=e.superdoc?.activeEditor??e.activeEditor;Us(Qe);const{label:cn,icon:pn,value:tn}=wt;N.label.value=cn,N.icon.value=pn,e.emitCommand({item:N,argument:tn}),xc(e,Pt)}})}const ee=new Map([["separator",20],["zoom",71],["measurementUnit",52],["fontFamily",118],["fontSize",57],["textAlign",40],["linkedStyles",142],["documentMode",47],["default",32]]),ye=["search","ruler","undo","overflow","documentMode"],P=xn({type:"button",name:"ruler",command:"toggleRuler",allowWithoutEditor:!0,icon:t.ruler,active:!1,tooltip:n.ruler,attributes:{ariaLabel:"Ruler"}}),B=xn({type:"button",name:"formattingMarks",command:"toggleFormattingMarks",allowWithoutEditor:!0,icon:t.formattingMarks,active:!1,tooltip:n.formattingMarks,attributes:{ariaLabel:"Formatting marks"}}),ce=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 Qe=Pt=>{Us(ce);const cn=typeof Pt=="string"?Pt:Pt?.id??null;if(!cn)return;const pn={...ce,command:"setLinkedStyle"};e.emitCommand({item:pn,argument:cn})},wt=e.getActiveLinkedStyleId?.()??null;return Ur("div",{},[Ur(_V,{styles:e.getLinkedStyleOptions?.()??[],onSelect:Qe,selectedOption:wt})])}}],onActivate:({styleId:Qe,styleName:wt})=>{const Pt=wt||Qe;ce.label.value=Qe&&Qe!=="Normal"?String(Pt):n.formatText,ce.disabled.value=!1},onDeactivate:()=>{ce.disabled.value=!0,ce.label.value=n.formatText}}),_e=(Qe,wt)=>{if(wt.value==Qe)return Ur("div",{innerHTML:nU,class:"dropdown-select-icon"})},Ae=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(Qe=>({label:Qe.toFixed(2),key:Qe,icon:()=>_e(Qe,Ae.selectedValue),props:{"data-item":"btn-lineHeight-option"}}))}),De=20,Ye=32,ot=["linkedStyles","clearFormatting","copyFormat","formattingMarks"],gt=["zoom","fontFamily","fontSize","redo"],xt=i<=ah.lg,Tt=e.config?.showFormattingMarksButton===!0,$t=e.config?.showTableOfContentsButton===!0;xt&&(N.attributes.value={...N.attributes.value,className:`${N.attributes.value.className} sd-toolbar-item--doc-mode-compact`}),xt&&(ce.attributes.value={...ce.attributes.value,className:`${ce.attributes.value.className} sd-toolbar-item--linked-styles-compact`});let je=[et,Et,ae,Ie,G,Ze,g,S(),w,S(),f,k,b,T,z,L,S(),U,R,...$t?[K]:[],x,$,S(),Y,fe,ve,me,Ee,Ae,S(),ce,S(),P,lt,...Tt?[B]:[],re,He,...oU(e)?[m]:[],Fe,N,...d];if(i<=ah.md&&o&&(je=je.filter(Qe=>Qe.type!=="separator")),e.config.mode!=="docx"){const Qe=je.findIndex(Pt=>Pt.name.value==="linkedStyles");je.splice(Qe-1,2);const wt=["ruler","zoom","undo","redo"];je=je.filter(Pt=>!wt.includes(Pt.name.value))}const rn=[];a||(s==="viewer"&&rn.push(ae,Ie),je=je.filter(Qe=>!rn.includes(Qe))),l&&(je=je.filter(Qe=>Qe.name.value==="overflow"||Qe.isCustomToolbarItem||l.has(Qe.name.value))),u?.size&&(je=je.filter(Qe=>!u.has(Qe.name.value)));const Un=Qe=>ye.includes(Qe.name.value),jt=je.find(Qe=>Qe.name.value==="overflow"),En=je.filter(Qe=>Qe!==jt),Gr=Qe=>{const wt=[],Pt=[],cn=En.filter(Un).reduce((tn,wn)=>tn+Wb(wn,ee),0);let pn=Ye+cn+(Qe&&jt?Wb(jt,ee):0);return En.forEach((tn,wn)=>{const nn=Wb(tn,ee);if(tn.type==="separator"&&En[wn-1]?.name.value==="linkedStyles"&&wt.includes(En[wn-1])){wt.push(tn);return}if(i<ah.xl+De&&ot.includes(tn.name.value)&&o){wt.push(tn);return}if(i<ah.sm&>.includes(tn.name.value)&&o){wt.push(tn);return}if(Un(tn)){Pt.push(tn);return}pn+nn<=i||!o?(Pt.push(tn),pn+=nn):wt.push(tn)}),{visibleItems:Pt,overflowItems:wt}};let{visibleItems:br,overflowItems:Ir}=Gr(!1);if(o&&jt&&Ir.some(Qe=>Qe.type!=="separator")){({visibleItems:br,overflowItems:Ir}=Gr(!0));const Qe=je.indexOf(jt),wt=br.findIndex(Pt=>je.indexOf(Pt)>Qe);wt===-1?br.push(jt):br.splice(wt,0,jt)}return{defaultItems:br,overflowItems:Ir.filter(Qe=>Qe.type!=="separator")}},pI={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"},aU=e=>e?typeof e!="string"?e instanceof HTMLElement?e:null:e.startsWith("#")||e.startsWith(".")?document.querySelector(e):document.getElementById(e):null;Dt();function mI(e){return zz(e)??$b[e]??null}function Wm(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 lU=new Set(["bold","italic","underline","strike","color","highlight","link","clearFormatting","textAlign","list","numberedlist","indentleft","indentright","lineHeight","linkedStyles"]),cU=new Set(["list","numberedlist"]);function uU(e,t){if(e==="fontFamily"||e==="fontSize"||cU.has(e)&&t?.disabled&&t?.supported!==!1&&t?.reason==null)return!0;if(!lU.has(e))return!1;const n=t?.reason;return n==="range-selection-required"||n==="selection-required"}function gI(e){return!!e?.closest?.("[data-editor-ui-surface], .toolbar-dropdown-menu, .sd-toolbar-dropdown-menu, .sd-tooltip-content")}function dU(e){return["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key)}var fU=new Set([...Bz,...Object.keys(Nm),"ai","overflow","tableOfContents"]),hU=class extends Mg.default{config={selector:null,toolbarGroups:["left","center","right"],role:"editor",icons:{...lr},texts:{...pI},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=Vr([]);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={...pI,...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=aU(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=gc(oV),this.app.directive("click-outside",Oy),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||Jj(this.superdoc?.fonts?.getFontFamilyOptions?.()??[])}#c(){const e=this.getAvailableWidth(),t=new Map(this.#a().filter(C=>C.isCustomToolbarItem&&C.type==="dropdown").map(C=>[C.name.value,C.selectedValue.value])),n=this.config.groups&&!Array.isArray(this.config.groups)&&Object.keys(this.config.groups).length>0,r=n?new Set(Object.values(this.config.groups).flatMap(C=>C)):null,o=new Set(this.config.excludeItems),i=this.config.customButtons||[],s=new Set(fU),a=i.map((C,w)=>{try{if(C?.name&&s.has(C.name))throw new Error(`Toolbar item name "${C.name}" is already taken by another item, so this entry is skipped.`);const S=this.#h(C);return t.has(S.name.value)&&(S.selectedValue.value=t.get(S.name.value)),s.add(S.name?.value),S}catch(S){const k=`${C?.name??`<unnamed@${w}>`}::${S?.message??String(S)}`;return this._reportedInvalidCustomItems.has(k)||(this._reportedInvalidCustomItems.add(k),this.#m(S,C?.name??null)),null}}).filter(Boolean),l=n?new Set(Object.keys(this.config.groups)):null,u=l?a.filter(C=>l.has(C.group?.value||"center")):a,{defaultItems:d,overflowItems:f}=sU({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:u});let p=[...d.map(C=>C.name.value),...f.map(C=>C.name.value)];if(n){const C=Object.values(this.config.groups).flatMap(S=>S),w=a.filter(S=>l.has(S.group?.value||"center")).map(S=>S.name.value);p=[...new Set([...C,...w])]}const g=f.filter(C=>p.includes(C.name.value)&&!o.has(C.name.value)),m=g.length?[...p,"overflow"]:p,v=d.filter(C=>m.includes(C.name.value)).filter(C=>!o.has(C.name.value));if(n)for(const[C,w]of Object.entries(this.config.groups))for(const S of v)w.includes(S.name.value)&&(S.group.value=C);this.toolbarItems=v,this.overflowItems=g}#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:()=>Gb(this,e,[],!0)};e.nestedOptions.value=[t]}#M(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=cI.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(Ub(t)?.disposition==="host-routed")return e.setDisabled(!this.#b(t)),this.#k(t)?e.activate():e.deactivate(),!0;const n=mI(t);if(!n)return!1;const r=this.snapshot?.commands?.[n];uU(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=Kb(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.#M(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=lI[t?.command];return i?Wm(this.ui,i,void 0,r):!1}if(Ub(n)?.disposition==="unsupported")return!0;const o=mI(n);return o?Wm(this.ui,o,t,r):!1}#I(){return this.snapshot?.commands?.image?.disabled||(this.#e||(this.#e=Wz({ownerDocument:this.toolbarContainer?.ownerDocument??document,onPick:async e=>{const t=await $z(e,this.superdoc?.config?.handleImageUpload);Wm(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=>{gI(i.target)||this.ui.formatPainter.setPointerSelecting(!0)},n=i=>{this.ui.formatPainter.setPointerSelecting(!1),!gI(i.target)&&this.ui.formatPainter.notifyPointerUp()},r=i=>{if(i.key==="Escape"){this.ui.formatPainter.cancel();return}dU(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(Ub(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(!Wm(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 pU(e){return new hU(e)}function mU(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 gU(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=Km(e.color);n!=null&&(t.color=n),e.highlight!=null&&(t.highlight=e.highlight);const r=yU(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=vU(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=bU(e.border);return i&&(t.border=i),t}function Km(e){if(e){if(typeof e=="string")return e;if(e.model==="rgb")return e.value;if(e.model==="auto")return"auto"}}function vU(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 yU(e){if(!e)return;const t={},n=Km(e.fill);n!=null&&(t.fill=n);const r=Km(e.color);return r!=null&&(t.color=r),e.pattern!=null&&(t.val=e.pattern),Object.keys(t).length>0?t:void 0}function bU(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=Km(e.color);return n!=null&&(t.color=n),Object.keys(t).length>0?t:void 0}function Rc(e){const t=e?.selectionTarget??e?.target;if(!e||!t)return"";try{return JSON.stringify(t)}catch{return String(t)}}var wU=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"]),CU=e=>e?.type!=="mutation:committed"||e.origin!=="command"?!1:wU.has(e.editableCommandKind);function vI(e){return e.split(",").map(t=>t.trim()).filter(Boolean)}function kU(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 vI(r))n(o);return n(e.getAttribute("data-track-change-id")),t}function yI(e,t){if(!e||typeof e.getAttribute!="function")return[];const n=[],r=new Set;let o=[],i=e;for(;i;){const s=i,a=kU(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 C={type:"trackedChange",id:m};l&&(C.storyKey=l),n.push(C),o.push(C)}}const u=s.getAttribute("data-layout-story");if(u&&o.length>0){for(const m of o)m.story=u;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 vI(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"),C=s.getAttribute("data-sdt-tag"),w={type:"contentControl",id:g};(v==="block"||v==="inline")&&(w.scope=v),C&&(w.tag=C),n.push(w)}}if(t&&i===t)break;i=i.parentElement}return n}var bo=()=>({oneOf:[{type:"boolean"},{type:"null"}]}),Ol=()=>({oneOf:[{type:"string",minLength:1},{type:"null"}]}),Wu=()=>({oneOf:[{type:"number"},{type:"null"}]}),Ku=e=>({oneOf:[{type:"object",properties:e,additionalProperties:!1,minProperties:1},{type:"null"}]}),SU={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},_U={type:"object",properties:{id:{type:"number"},val:{type:"boolean"}},required:["id"],additionalProperties:!1},AU=()=>({oneOf:[{type:"boolean"},{type:"null"},SU]}),IU=()=>({oneOf:[{type:"array",items:_U,minItems:1},{type:"null"}]});function qm(e,t){return{storage:"mark",markName:e,textStyleAttr:t}}function EU(e){return{storage:"runAttribute",nodeName:"run",runPropertyKey:e}}var qb=(e,t,n)=>({key:e,type:"boolean",ooxmlElement:t,storage:"mark",tracked:!0,carrier:qm(n),schema:bo()}),Mc=(e,t,n,r,o)=>({key:e,type:t,ooxmlElement:n,storage:"mark",tracked:!0,carrier:qm("textStyle",o??e),schema:r}),Gn=(e,t,n,r,o)=>({key:e,type:t,ooxmlElement:n,storage:"runAttribute",tracked:!1,carrier:EU(o??e),schema:r}),Ym=[qb("bold","w:b","bold"),qb("italic","w:i","italic"),qb("strike","w:strike","strike"),{key:"underline",type:"object",ooxmlElement:"w:u",storage:"mark",tracked:!0,carrier:qm("underline"),schema:AU()},{key:"highlight",type:"string",ooxmlElement:"w:highlight",storage:"mark",tracked:!0,carrier:qm("highlight"),schema:Ol()},Mc("color","string","w:color",Ol()),Mc("fontSize","number","w:sz",Wu()),Mc("fontFamily","string","w:rFonts",Ol()),Mc("letterSpacing","number","w:spacing",Wu()),Mc("vertAlign","string","w:vertAlign",{oneOf:[{enum:["superscript","subscript","baseline"]},{type:"null"}]}),Mc("position","number","w:position",Wu()),Gn("dstrike","boolean","w:dstrike",bo()),Gn("smallCaps","boolean","w:smallCaps",bo()),Mc("caps","boolean","w:caps",bo(),"textTransform"),Gn("shading","object","w:shd",Ku({fill:{oneOf:[{type:"string",minLength:1},{type:"null"}]},color:{oneOf:[{type:"string",minLength:1},{type:"null"}]},val:{oneOf:[{type:"string",minLength:1},{type:"null"}]}})),Gn("border","object","w:bdr",Ku({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"),Gn("outline","boolean","w:outline",bo()),Gn("shadow","boolean","w:shadow",bo()),Gn("emboss","boolean","w:emboss",bo()),Gn("imprint","boolean","w:imprint",bo()),Gn("charScale","number","w:w",Wu(),"w"),Gn("kerning","number","w:kern",Wu(),"kern"),Gn("vanish","boolean","w:vanish",bo()),Gn("webHidden","boolean","w:webHidden",bo()),Gn("specVanish","boolean","w:specVanish",bo()),Gn("rtl","boolean","w:rtl",bo()),Gn("cs","boolean","w:cs",bo()),Gn("bCs","boolean","w:bCs",bo(),"boldCs"),Gn("iCs","boolean","w:iCs",bo(),"italicCs"),Gn("eastAsianLayout","object","w:eastAsianLayout",Ku({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"}]}})),Gn("em","string","w:em",Ol()),Gn("fitText","object","w:fitText",Ku({val:{oneOf:[{type:"number"},{type:"null"}]},id:{oneOf:[{type:"string",minLength:1},{type:"null"}]}})),Gn("snapToGrid","boolean","w:snapToGrid",bo()),Gn("lang","object","w:lang",Ku({val:{oneOf:[{type:"string",minLength:1},{type:"null"}]},eastAsia:{oneOf:[{type:"string",minLength:1},{type:"null"}]},bidi:{oneOf:[{type:"string",minLength:1},{type:"null"}]}})),Gn("oMath","boolean","w:oMath",bo()),Gn("rStyle","string","w:rStyle",Ol(),"styleId"),Gn("rFonts","object","w:rFonts",Ku({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"),Gn("fontSizeCs","number","w:szCs",Wu()),Gn("ligatures","string","w14:ligatures",Ol()),Gn("numForm","string","w14:numForm",Ol()),Gn("numSpacing","string","w14:numSpacing",Ol()),Gn("stylisticSets","array","w14:stylisticSets",IU()),Gn("contextualAlternates","boolean","w14:cntxtAlts",bo())],EW=new Set(Ym.map(e=>e.key)),TU=Object.fromEntries(Ym.map(e=>[e.key,e])),TW={mark:Ym.filter(e=>e.storage==="mark").map(e=>e.key),runAttribute:Ym.filter(e=>e.storage==="runAttribute").map(e=>e.key)};function Fa(){return typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now()}function Xm(){const e=globalThis;return{sink:typeof e.__superdocV2BenchPipelineTiming=="function"?e.__superdocV2BenchPipelineTiming:null,workerContext:e.__superdocV2BenchWorkerMessageContext??null}}function Yb(e){const{sink:t}=Xm();if(t)try{t(e)}catch{}}var Xb=new WeakMap;function xU(e){let t=Xb.get(e);return t||(t={refCount:0,generation:0,abortController:new AbortController,inFlight:null,activeMutationTokens:new Set},Xb.set(e,t)),t.refCount+=1,t}function RU(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(),Xb.delete(e))}var MU=new Set(Object.values(at));function Zm(e,t){return typeof e=="string"&&MU.has(e)?e:t}function bI(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:at.notReady}:{ok:!1,reason:Zm(t,at.targetUnresolved)}}return{ok:!0}}var LU=["document-replaced","editorCreate","active-editor-change","document-mode-change","zoomChange","measurement-unit-change","viewport-change","fonts-changed"],DU={[Y4.bulletList]:"bullet",[Y4.numberedList]:"ordered"};function wI(e){return DU[e]??null}var OU={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 PU(e){const t=OU[e];return t?{preset:t,behavior:"toggleStyle"}:{}}var FU={status:"ready",empty:!0,target:null,selectionTarget:null,activeMarks:[],activeCommentIds:[],activeChangeIds:[],quotedText:""},NU=[{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"}],BU=new Set(["/word/comments.xml","/word/commentsExtended.xml","/word/commentsIds.xml"]);function zU(e){return NU.some(t=>t.match==="exact"?t.key===e:e.startsWith(t.key))}var CI={ready:0,stale:1,pending:2};function Pl(...e){let t="ready";for(const n of e)CI[n]>CI[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 Fr(e){return!!e&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"}function yr(e,t){if(!e)return null;const n=t.split(".");let r=e;for(const o of n){if(r==null)return null;r=r[o]}return typeof r=="function"?r:null}function Xn(e,t="CAPABILITY_UNAVAILABLE"){return{success:!1,failure:{code:t,message:e}}}function 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 Zb(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 kI(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||!Zb(n))return i}return n}function nr(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 Ei(e,t,n){return $r(e)!==t?!1:n?nr(uh(e))===nr(n):!0}function dh(e){const t=uh(e);if(!(!t||nr(t)===nr(null)))return t}function jU(e){if(typeof e!="string"||e.length===0)return;const t=WT(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 VU(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 Qb(e){if(!e||typeof e!="object")return null;const t=e.selectionTarget;return t&&typeof t=="object"?t:null}function Qm(e){if(!e||typeof e!="object")return null;const t=e.id;return typeof t=="string"&&t.length>0?t:null}function UU(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 $r(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 qu(e){return typeof e=="string"?e.trim():""}function HU(e,t){const n=t??{},r=qu(n.id).toLowerCase(),o=qu(e.authorId).toLowerCase();if(r&&o)return r===o;const i=qu(n.email).toLowerCase(),s=qu(e.authorEmail).toLowerCase();if(i&&s)return i===s;if(r||i||o||s)return!1;const a=qu(e.author).replace(/\s+/g," ").toLowerCase();if(!a)return!0;const l=qu(n.name).replace(/\s+/g," ").toLowerCase();return!!(l&&l===a)}function $U(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 SI=new WeakMap;function _I(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 u=s.replacement;if(u&&typeof u=="object")for(const f of[u.inserted,u.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 Hs(e){const t=SI.get(e);if(t)return t;const n=new Set,r=new Map;for(const i of e){const s=$r(i);if(s){n.add(s);for(const a of _I(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 SI.set(e,o),o}var AI=new WeakMap,II=new WeakMap;function Fl(e,t){const n=nr(t);let r=AI.get(e);r||(r=new Map,AI.set(e,r));const o=r.get(n);if(o)return o;const i=Hs(e.filter(s=>nr(uh(s))===n));return r.set(n,i),i}function GU(e){return!!e&&typeof e=="object"&&e.storyType==="textbox"}function WU(e,t){const n=t.filter(o=>e.some(i=>$r(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=>$r(s)===o);if(i)for(const s of _I(i)){if(r.has(s))return null;r.add(s)}}return n[0]}function KU(e){const t=II.get(e);if(t)return t;const n=e.filter(o=>uh(o)!=null),r=n.length===e.length?e:n;return II.set(e,r),r}function qU(e){const{selectionIds:t,publicIds:n,selection:r,bodyItems:o,allStoryItems:i}=e;if(t.length===0)return null;const s=u=>{for(const d of t){const f=u.toPublicId(d);if(f)return f}return null},a=fs(r),l=nr(a)===nr(null);if(i){const u=l?KU(i):i,d=s(Fl(u,a));if(d)return d;const f=n?.find(p=>u.some(g=>Ei(g,p,a)));return f||(l?s(Hs(o)):GU(a)?WU(i,t):null)}return l?s(Hs(o))??t[0]??null:null}function YU(e,t){const n=e.find(r=>$r(r)===t||r.importedId===t);return n?n.rootCommentId??n.parentCommentId??$r(n)??t:null}function XU(e){const t=e.selectionTarget;if(t){const s=t.start,a=t.end,l=typeof s?.blockId=="string"?s.blockId:void 0,u=typeof a?.blockId=="string"?a.blockId:l;if(l)return{startBlockId:l,endBlockId:u??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 Nr(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 ZU=64;function Lc(e){return e.length<=ZU}function fs(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 To(e,t){return{kind:"block",nodeType:"paragraph",nodeId:e,...t&&typeof t=="object"?{story:t}:{}}}function Na(e){return{kind:"block",nodeType:"paragraph",nodeId:e}}function EI(e,t){return{kind:"block",nodeType:"listItem",nodeId:e,...t&&typeof t=="object"?{story:t}:{}}}var TI=720;function $s(e){return Math.round(e*20)}function Yu(e){return typeof e=="number"&&Number.isFinite(e)}function QU(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=Yu(i.left)?$s(i.left):Yu(i.start)?$s(i.start):void 0,a=Yu(i.right)?$s(i.right):Yu(i.end)?$s(i.end):void 0,l=Yu(i.firstLine)?$s(i.firstLine):void 0,u=Yu(i.hanging)?$s(i.hanging):void 0;return s==null&&a==null&&l==null&&u==null?null:{...s!=null?{left:s}:{},...a!=null?{right:a}:{},...l!=null?{firstLine:l}:{},...u!=null?{hanging:u}:{}}}function Jb(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 JU(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 fh(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 Gs(e){return fh(e.target)??fh(e.selectionTarget)}var xI=["fontFamily","fontSize","color","highlight"],eH={undo:"history.undo",redo:"history.redo"},hh=["bold","italic","underline","strikethrough"];function e2(e){return xI.includes(e)}function Xu(e){const t=e.target,n=t&&Array.isArray(t.segments)?t.segments:[],r=[],o=(l,u,d)=>{typeof l!="string"||typeof u!="number"||typeof d!="number"||r.push({blockId:l,start:Math.min(u,d),end:Math.max(u,d)})};for(const l of n){const u=l?.range;o(l?.blockId,u?.start,u?.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 hs(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 tH(e){const t=hs(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 Ba(e){const t=Xu(e);return t.length===0?null:[tH(e),...t.map(n=>`${n.blockId}:${n.start}-${n.end}`)].join("|")}function RI(e){const t=e.selectionTarget;return!t||typeof t!="object"?null:Rc({selectionTarget:t})}function nH(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 rH(e,t){return Math.max(e.start,t.start)<Math.min(e.end,t.end)}function oH(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 iH(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 MI(e,t){const n=Xu(t);if(n.length===0)return null;const r=e&&Array.isArray(e.items)?e.items:[];if(r.length===0)return null;const o=r.find(i=>iH(n,oH(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 sH(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 t2(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 aH(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 lH(e,t){return e==="fontFamily"?t.toLowerCase():e==="color"||e==="highlight"?t.toUpperCase():t}function LI(e,t){if(!e)return{};const n=new Map;for(const i of Xu(t)){const s=n.get(i.blockId)??[];s.push({start:i.start,end:i.end}),n.set(i.blockId,s)}if(n.size===0)return{};const r=Array.isArray(e.blocks)?e.blocks:[],o={};for(const i of xI){const s=new Map;let a=!1,l=!1;for(const u of r){const d=typeof u?.blockId=="string"?u.blockId:null;if(!d)continue;const f=n.get(d);if(!f?.length)continue;const p=Array.isArray(u?.runs)?u.runs:[];for(const g of p){const m=g?.range,v=typeof m?.start=="number"?m.start:null,C=typeof m?.end=="number"?m.end:null;if(v==null||C==null||!f.some(k=>rH(k,{start:v,end:C})))continue;a=!0;const w=sH(g?.styles,i);if(w===void 0){l=!0;continue}const S=lH(i,w);if(s.has(S)||s.set(S,w),s.size>1)break}if(s.size>1)break}a&&!l&&s.size===1&&(o[i]=[...s.values()][0])}return o}function n2(e,t){const n=Nr(e)[0];return n?t==="nodeId"?{kind:"after",nodeId:n}:{kind:"after",target:To(n)}:{kind:"documentEnd"}}function en(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 Zu(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 Qu(e){const t=e,n=t.change;return n&&typeof n=="object"?n:t}function Ws(e){if(Fr(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 Jm(e){return!!e&&typeof e=="object"&&e.success===!0}function xo(e){return!(e===!1||e&&typeof e=="object"&&e.success===!1)}function ph(e){return!!(e&&typeof e=="object"&&!Array.isArray(e))}function r2(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 u of l.blocks)n(u);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 eg(e){return e.trackedChange?.kind==="delete"?0:typeof e.text=="string"?e.text.length:0}function Ti(e){let t=!1,n=null,r=null,o=null;for(const i of e)t=i,!xo(i)&&n===null&&(n=i),Jm(i)&&(o=i),i!==!1&&(r=i);return n??o??r??t}function cH(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 uH(e){return e.startsWith("#")?{kind:"anchor",anchor:e.slice(1)}:{kind:"external",url:e}}function tg(e){return Gu(e)?.trackDecision??null}function dH(e){return{found:e.length>0,success:e.length>0,rects:e,rect:e[0]}}function Nl(e){return{found:!1,success:!1,rects:[],reason:e}}function fH(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 hH(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 DI(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(hH))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 pH(e){return e.selectionTarget?e.selectionTarget:DI(e.target)}function Ju(e){if(e.empty)return null;if(e.selectionTarget)return e.selectionTarget;const t=DI(e.target);return t&&t.start.kind==="text"&&t.end.kind==="text"&&t.start.blockId!==t.end.blockId?null:t}function o2(e){return!e.inline||typeof e.docRoute!="string"?null:e.docRoute.startsWith("format.")?e.docRoute.slice(7):null}var i2={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},mH=Object.fromEntries(Object.entries(i2).filter(([e])=>TU[e]?.tracked===!0));function gH(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:{...i2}};default:return null}}function vH(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 yH(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 bH(e){const t=e.superdoc,n=new Map,r=new Map;let o=null,i=0;const s=[];let a=null,l=0,u=!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={},C="",w=null;const S=()=>{const c=t?.activeEditor;return c&&typeof c=="object"?c:null},k={open:()=>{if(ee)return{ok:!1,reason:at.notReady};const c=S();if(!c)return{ok:!1,reason:at.notReady};const h=c.contextMenu;if(!h||typeof h!="object"||typeof h.open!="function")return{ok:!1,reason:at.operationUnavailable};try{const y=h.open();return y&&typeof y=="object"&&y.ok===!1?{ok:!1,reason:Zm(y.reason,at.operationUnavailable)}:{ok:!0}}catch{return{ok:!1,reason:at.operationUnavailable}}},close:()=>{if(ee)return;const c=S()?.contextMenu;if(!(!c||typeof c!="object"||typeof c.close!="function"))try{c.close()}catch{}},contextAt:sE},b=()=>{const c=S()?.doc;return c&&typeof c=="object"?c:null},T=()=>{const c=S()?.v2TrackedChanges;return c&&typeof c=="object"?c:null},L=()=>{const c=S();if(c?.editorVersion!==2)return null;const h=c.reviewWindow;return h&&typeof h=="object"?h:null},z=()=>{const c=L();return!c||typeof c.getSnapshot!="function"?null:Lt(()=>c.getSnapshot(),null)},G=()=>typeof L()?.getSnapshot=="function",U=c=>{const h=c?.status;return h==="ready"||h==="stale"?h:"pending"},j=()=>{const c=S()?.host;return c&&typeof c=="object"?c:null},Z=c=>{if(c.storyType!=="headerFooterPart"||typeof c.refId!="string")return null;const h=S(),y=j(),_=h?.pageLayout??y?.pageLayout;if(!_||typeof _!="object")return null;const E=_.getActiveRulerContext,F=y?.resolveHeaderFooterEditTarget;if(typeof E!="function"||typeof F!="function")return null;const H=Lt(()=>E.call(_),null);if(!H||typeof H.pageIndex!="number")return null;for(const ie of["header","footer"]){const he=Lt(()=>F.call(y,{pageIndex:H.pageIndex,kind:ie}),null);if(!(he?.status!=="ready"||he.refId!==c.refId||typeof he.sectionId!="string"||!["default","first","even"].includes(String(he.slotVariant))))return{kind:"story",storyType:"headerFooterSlot",section:{kind:"section",sectionId:he.sectionId},headerFooterKind:ie,variant:he.slotVariant}}return null},R=()=>{const c=j(),h=c?.getPendingInlineFormat;if(typeof h!="function")return null;const y=Lt(()=>h.call(c),null);return y&&typeof y=="object"?y:null},K=c=>{const h=o2(c);if(!h)return null;const y=R();if(!y||!(h in y))return null;const _=y[h];return c.inline?.kind==="toggle"?_===!0:_!=null&&_!==""},x=c=>{const h=o2(c);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=(c,h)=>{const y=j(),_=y?.setPendingInlineFormat;typeof _=="function"&&Lt(()=>_.call(y,c,h),void 0)},$=c=>{const h=j(),y=h?.clearPendingInlineFormat;typeof y=="function"&&Lt(()=>y.call(h,c),void 0)},J=new Set(["bold","italic","underline","strikethrough"]),Q=c=>{const h=R();if(!h)return;const y=Array.isArray(c.activeMarks)?c.activeMarks:[];let _=null;for(const E of Object.keys(h)){const F=h[E];let H;if(J.has(E)){if(F===!1)continue;H=y.includes(E)===(F===!0)}else if(e2(E)){if(F==null)continue;_||(_=Mo(c)),H=_[E]===F}else H=!1;H&&$(E)}},Y=()=>{const c=S()?.editCommands;return c&&typeof c=="object"?c:null},Ce=c=>{const h=Y();if(!h||typeof h.getSnapshot!="function")return null;const y=Lt(()=>h.getSnapshot(),null)?.commands?.[c];return y&&typeof y=="object"?y:null},fe=()=>Ce("lists.apply"),ve=c=>{const h=c?.value?.seed;return h==="bullet"||h==="ordered"?h:null},me=c=>{const h=eH[c];return h?Ce(h):null},Ee=()=>{const c=j();if(!c||typeof c.getTableContext!="function")return null;const h=Lt(()=>c.getTableContext(),null);return h&&typeof h=="object"?h:null},Fe=()=>{const c=Ee();if(!c||c.inTable!==!0)return null;const h=c.table,y=typeof h?.nodeId=="string"&&h.nodeId.length>0?h.nodeId:null;if(!y)return null;const _=c.row,E=c.column,F=c.cell,H=typeof _?.index=="number"&&Number.isInteger(_.index)?_.index:null,ie=typeof E?.index=="number"&&Number.isInteger(E.index)?E.index:null;if(H==null||ie==null)return null;const he=typeof F?.nodeId=="string"&&F.nodeId.length>0?F.nodeId:null,Me=c.cellRange;return{tableNodeId:y,rowIndex:H,columnIndex:ie,cellNodeId:he,mergeRange:vH(Me)}},Ze=new Map;let lt=null,et=null,Et=0,ae=0,Ie=0;const He=new Set,re=(c,h)=>c===h?!0:!c||!h?!1:c.id===h.id&&c.paintedEntityId===h.paintedEntityId&&nr(c.story)===nr(h.story),I=c=>Array.from(He).some(h=>re(h,c)),se=c=>{const h=j();if(typeof h?.getHandles!="function")return;const y=Lt(()=>h.getHandles(),null),_=y?.review;if(_){if(c){if(typeof _.setActiveReviewTarget!="function")return;const E=y?.layout;Lt(()=>_.setActiveReviewTarget({entityType:"trackedChange",entityId:c.id,...c.paintedEntityId?{paintedEntityId:c.paintedEntityId}:{},origin:"panel",layoutEpoch:typeof E?.generation=="number"?E.generation:0,story:c.story??{kind:"story",storyType:"body"}}),null);return}typeof _.getActiveReviewTarget!="function"||typeof _.clearActiveReviewTarget!="function"||Lt(()=>_.getActiveReviewTarget(),null)?.entityType==="trackedChange"&&Lt(()=>_.clearActiveReviewTarget(),void 0)}},N=(c,h)=>{et=c,Et+=1,Ie+=1,h?.invalidateQueuedNavigation!==!1&&(ae+=1)},q=new Set;let O,ee=!1,ye=null;const P=new Map,B=new Set;let ce=null,_e=null,Ae=!1,De=null,Ye=0,ot=null,gt=null,xt=null;const Tt=[],$t=()=>{if(Ae||ee)return;Ae=!0;const c=()=>{Ae=!1,ee||V("async-read-settled")};typeof queueMicrotask=="function"?queueMicrotask(c):Promise.resolve().then(c)},je=250,rn=5e3,Un=c=>{ee||De&&Ye<=c||(De&&clearTimeout(De),Ye=c,De=setTimeout(()=>{De=null,Ye=0,ee||V()},Math.max(0,c-Date.now())))},jt=new WeakMap;let En=0;const Gr=c=>{if(!c)return"none";let h=jt.get(c);return h==null&&(h=En+=1,jt.set(c,h)),`e${h}`};let br=0;const Ir=e.superdoc,Qe=xU(Ir),wt=()=>{Qe.abortController.abort("review-mutation-started"),Qe.inFlight=null},Pt=()=>{Qe.generation+=1,Qe.abortController=new AbortController,Qe.inFlight=null},cn=c=>{const h=Qe.activeMutationTokens;if(typeof c!="string"||c.length===0||h.has(c))return;const y=h.size===0;h.add(c),y&&wt()},pn=c=>{const h=Qe.activeMutationTokens;typeof c!="string"||!h.delete(c)||h.size===0&&Pt()},tn=c=>{const h=T(),y=h?.listTrackedChanges;if(typeof y!="function")return S()?.editorVersion===2?Promise.reject(new Error("v2-tracked-changes-bridge-pending")):c();if(Qe.activeMutationTokens.size>0)return Promise.reject(new Error("ui-review-catalog-superseded"));const _=Qe.generation,E=Qe.inFlight;if(E?.generation===_)return E.promise;const F=Qe.abortController.signal,H=Me=>{if(F.aborted||_!==Qe.generation||Me?.reason==="review-hydration-superseded")throw new Error("ui-review-catalog-superseded");return Me},ie=y.call(h,{blocking:!1,signal:F});if(!Fr(ie))return H(ie);const he=Promise.resolve(ie).then(H);return Qe.inFlight={generation:_,promise:he},he.then(()=>{Qe.inFlight?.promise===he&&(Qe.inFlight=null)},()=>{Qe.inFlight?.promise===he&&(Qe.inFlight=null)}),he};let wn=null,nn=new Set,rr=null,wo=0,Ue=null;const xe=()=>`${Gr(S())}|m${br}`,tt=()=>{wn=null,nn=new Set},Ct=c=>{for(const h of["trackChanges","trackChanges:all"]){const y=P.get(h);if(!y?.hasSettled||!Array.isArray(y.value))continue;const _=y.value.filter(E=>{const F=$r(E);return!F||!c.has(F)});_.length!==y.value.length&&P.set(h,{...y,value:_})}},Mt=c=>{const h=()=>{if(!ee)for(const F of[...q])F(O)},y=ph(c)?c:null,_=S()?.documentMutationReadiness,E=()=>{const F=globalThis.requestAnimationFrame;return typeof F!="function"?Promise.resolve():new Promise(H=>{let ie=!1;const he=()=>{ie||(ie=!0,clearTimeout(Me),H())},Me=setTimeout(he,250);F(()=>F(()=>setTimeout(he,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()},Ot=(c,h)=>{const y=O.trackChanges,_=y.items.filter(H=>{const ie=$r(H);return!ie||!c.has(ie)});if(_.length===y.items.length)return;et&&c.has(et.id)&&N(null);const E=new Set;for(const H of _){const ie=Qu(H),he=H,Me=ie.author??ie.authorEmail??he.author??he.authorEmail;typeof Me=="string"&&E.add(Me)}const F=y.items.length-_.length;O={...O,trackChanges:{...y,items:_,total:Math.max(_.length,y.total-F),activeId:y.activeId&&c.has(y.activeId)?null:y.activeId,authors:[...E]}},Mt(h)},Tn=c=>{const h=O.trackChanges,y=h.items.length>0||h.total!==0||h.activeId!==null||h.authors.length>0;rr=xe(),et!==null&&N(null),O={...O,trackChanges:{...h,items:[],total:0,activeId:null,authors:[]}},y&&Mt(c)},Vt=(c,h)=>{if(c.size===0)return;const y=xe(),_=wn===y?nn:new Set,E=new Set([...c].filter(F=>!_.has(F)));E.size!==0&&(wn=y,nn=new Set([..._,...E]),Ct(nn),Ot(E,h))},dn=c=>wn===c&&nn.size>0?nn:null,ao=c=>{const h=xe(),y=dn(h),_=c.map(Zu).filter(E=>{if(E==null)return!1;const F=$r(E);return F!=null&&!y?.has(F)});for(const E of["trackChanges","trackChanges:all"])P.set(E,{token:h,value:[..._],hasSettled:!0,inflightToken:null})},Jr=()=>`${xe()}|m${qn()}|s${wo}`,Vo=c=>JSON.stringify({t:c.target??null,s:c.selectionTarget??null}),ln=["contentControls:inRange:","query:","effInline:"],or=120,Zn=180,Ro=()=>{const c=j(),h=c?.getDocumentLoadingSnapshot;if(typeof h!="function")return"unknown";const y=Lt(()=>h.call(c),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,un=new Map,ir=new Map;let Wr=null;const lo={comments:0,trackChanges:0,contentControls:0},Qo=c=>{const h=xe();Xt.get(c)!==h&&(Xt.set(c,h),$t())},za=()=>{const c=P.get("comments");return c?.hasSettled?Array.isArray(c.value)&&c.value.length>0:c?.inflightToken!=null},Bl=(c,h)=>Xt.get(c)===h,Gi=()=>{const c=xe();let h=!1;for(const[y,_]of un){if(_!==c){un.delete(y);continue}if(ir.get(y)===c)continue;const E=P.get(y);!E?.hasSettled||E.token!==c||E.inflightToken!=null||(P.set(y,{...E,token:null,inflightToken:null}),ir.set(y,c),h=!0)}h&&$t()},ja=c=>{lo[c]+=1,Qo(c);let h=!1;return()=>{h||(h=!0,lo[c]=Math.max(0,lo[c]-1),lo[c]===0&&Xt.get(c)===xe()&&Xt.delete(c),$t())}},xi=c=>{Qo("contentControls")},ms=()=>{const c=P.get("trackChanges");c?.hasSettled||c?.inflightToken!=null||Qo("trackChanges")},Wi=()=>{const c=P.get("comments");c?.hasSettled||c?.inflightToken!=null||Qo("comments")},Se=6500,Ve=250;let pt=0,dt=0,Cn=!1,mn=null;const Er=()=>{if(ee||mn)return;const c=()=>{if(mn=null,ee)return;const h=Date.now()-pt;if(Uo()||h<Se){mn=setTimeout(c,Ve);return}Cn=!1,V()};mn=setTimeout(c,0)};let wr=null,Kr=null;const Jo=()=>{const c=j();if(!c||wr===c)return;Kr&&(Kr(),Kr=null),wr=c;const h=c.subscribeDocumentLoading;if(typeof h!="function"){wr=null,Cr(Se);return}try{const y=F=>{const H=F?.sourceStage;(H==="source-complete"||H==="source-failed"||H==="source-cancelled")&&(Wr=xe(),Gi(),pt=Math.max(pt,Date.now()),Er())},_=h.call(c,y);typeof _=="function"&&(Kr=_);const E=c.getDocumentLoadingSnapshot;typeof E=="function"&&y(Lt(()=>E.call(c),null))}catch{wr=null,Cr(Se)}},Co=()=>{const c=S()?.host,h=c?.getForegroundMutationState;if(typeof h!="function")return null;const y=Lt(()=>h.call(c),null);return{active:typeof y?.active=="number"?y.active:0,pending:typeof y?.pending=="number"?y.pending:0}},Uo=()=>{const c=Co();return!!(c&&(c.active>0||c.pending>0))},Cr=(c=or)=>{ee||ot||(ot=setTimeout(()=>{if(ot=null,ee)return;if(gt&&Uo()){Cr(),V();return}const h=gt;gt=null,h===Jr()&&Ri("selection",h,Yi,qi),V()},c))},zl=(c,h)=>{if(!Co())return!1;const y=`${c}\0${h}`;return B.has(y)?!1:(B.add(y),Cr(Zn),!0)},jl=c=>{if(ce==null||c===ce)return _e?.timer&&clearTimeout(_e.timer),_e=null,ce=c,!1;if(_e?.key===c)return _e.ready?(_e=null,ce=c,!1):!0;_e?.timer&&clearTimeout(_e.timer);const h={key:c,ready:!1,timer:null};return h.timer=setTimeout(()=>{ee||_e!==h||(h.timer=null,h.ready=!0,V())},Zn),_e=h,!0},eo=c=>CU(c),gs=()=>{Wa(),V()};let Ki=null,hi=null,vs=!1,Va=0,ys=!1,Ks=0;const Ho=()=>{Ki=null,vs=!1,Va+=1},bs=()=>{hi=null,ys=!1,Ks+=1},Ua=()=>{const c=S(),h=c?.documentMutationReadiness;if(!c||typeof h?.whenPainted!="function"||(Ki={editor:c,readiness:h,afterEpoch:typeof h.getRenderEpoch=="function"?Lt(()=>h.getRenderEpoch.call(h),null):null},vs))return;vs=!0;const y=Va;(async()=>{for(;!ee&&y===Va;){const E=Ki;if(Ki=null,!E){vs=!1;return}let F=!1;try{await E.readiness.whenPainted.call(E.readiness,typeof E.afterEpoch=="number"?{afterEpoch:E.afterEpoch}:void 0),F=!0}catch{}if(ee||y!==Va)return;if(S()!==E.editor){Ho();return}F&&gs()}})()},Ha=()=>{const c=S(),h=c?.documentMutationReadiness;if(!c||typeof h?.whenPainted!="function")return!1;if(hi={editor:c,readiness:h,afterEpoch:typeof h.getRenderEpoch=="function"?Lt(()=>h.getRenderEpoch.call(h),null):null},ys)return!0;ys=!0;const y=Ks;return(async()=>{for(;!ee&&y===Ks;){const E=hi;if(hi=null,!E){ys=!1;return}let F=!1;try{await E.readiness.whenPainted.call(E.readiness,typeof E.afterEpoch=="number"?{afterEpoch:E.afterEpoch}:void 0),F=!0}catch{}if(ee||y!==Ks)return;if(S()!==E.editor){bs();return}hi||(wo+=1,nd(),V(F?"post-paint-selection":"post-paint-selection-failed"))}})(),!0},$a=()=>{xt&&clearTimeout(xt),xt=setTimeout(()=>{xt=null,ee||gs()},500)},Ri=(c,h,y,_)=>{let E;try{E=y()}catch{E=void 0}if(!Fr(E)){const ie={token:h,value:_(E),hasSettled:!0,inflightToken:null,failedToken:null,failureCount:0,retryAtMs:0};return P.set(c,ie),ie}const F=P.get(c),H=F?.failedToken===h;return P.set(c,{token:F?.token??null,value:F?.value??null,hasSettled:F?.hasSettled??!1,inflightToken:h,failedToken:H?h:null,failureCount:H?F.failureCount??0:0,retryAtMs:0}),Promise.resolve(E).then(ie=>{const he=P.get(c);if(!he||he.inflightToken!==h)return;P.set(c,{token:h,value:_(ie),hasSettled:!0,inflightToken:null,failedToken:null,failureCount:0,retryAtMs:0});const{sink:Me,workerContext:ze}=Xm();if(Me){const Ne=Fa();Tt.push({key:c,settledAtMs:Ne,commandId:ze?.commandId??null,commandKind:ze?.commandKind??null}),Yb({stage:"superdoc-ui-async-read-settled",atMs:Ne,key:c,settledAtMs:Ne,commandId:ze?.commandId??null,commandKind:ze?.commandKind??null})}$t()},()=>{const ie=P.get(c);if(!ie||ie.inflightToken!==h)return;const he=ie.failedToken===h?(ie.failureCount??0)+1:1,Me=Math.min(rn,je*2**Math.min(he-1,8)),ze=Date.now()+Me;P.set(c,{...ie,inflightToken:null,failedToken:h,failureCount:he,retryAtMs:ze}),Un(ze)}),null},to=(c,h,y,_)=>{const E=P.get(c);if(E&&E.token===h&&E.hasSettled)return{value:E.value,status:"ready"};if(zU(c)&&!Bl(c,h)){if(Ro()==="loading")return Cn=!0,Jo(),E?.hasSettled?{value:E.value,status:"stale"}:{value:null,status:"pending"};if(Cn)return Er(),E?.hasSettled?{value:E.value,status:"stale"}:{value:null,status:"pending"};if(Date.now()-dt<Se)return Cn=!0,Er(),E?.hasSettled?{value:E.value,status:"stale"}:{value:null,status:"pending"}}if(Uo())return Cr(),E?.hasSettled?{value:E.value,status:"stale"}:{value:null,status:"pending"};if(E?.failedToken===h&&E.inflightToken==null&&(E.retryAtMs??0)>Date.now())return Un(E.retryAtMs),E.hasSettled?{value:E.value,status:"stale"}:{value:null,status:"pending"};if(!E&&c.startsWith("effInline:")&&jl(c))return{value:null,status:"pending"};if(!E&&zl(c,h))return{value:null,status:"pending"};if(!E||E.inflightToken!==h){const H=Ri(c,h,y,_);if(H)return{value:H.value,status:"ready"}}const F=P.get(c);return F?.hasSettled?{value:F.value,status:"stale"}:{value:null,status:"pending"}},qs=c=>{for(const h of P.keys())c(h)&&P.delete(h)},Ga=c=>{const h=Vo(c),y=RI(c);return new Set([`contentControls:inRange:${h}`,`query:${h}`,...y?[`effInline:${y}`]:[]])},Oc=c=>{const h=Ga(c);qs(y=>ln.some(_=>y.startsWith(_))&&!h.has(y));for(const y of B){const _=y.split("\0",1)[0];ln.some(E=>_.startsWith(E))&&!h.has(_)&&B.delete(y)}},pi=()=>{const c=S();c!==Ue&&(Ho(),bs(),Ue=c,P.clear(),De&&clearTimeout(De),De=null,Ye=0,_e?.timer&&clearTimeout(_e.timer),_e=null,ce=null,w=null,o=null,gt=null,B.clear(),Xt.clear(),un.clear(),ir.clear(),Wr=null,Cn=!1,Kr&&Kr(),Kr=null,wr=null,tt(),rr=null)},Wa=()=>{br+=1,un.clear(),ir.clear(),Wr=null,tt()},Vl=()=>{const c=rr===xe();Wa(),c&&(ao([]),rr=xe()),V()},mh=c=>{if(typeof c!="string"||c.length===0)return Xn("insertText requires a non-empty string.","INVALID_INPUT");if(qn()==="viewing")return Xn("The document is read-only.","DOCUMENT_READONLY");const h=b(),y=h?.insert;if(!h||typeof y!="function")return Xn("insert is unavailable.");const _=h.selection?.current;if(typeof _!="function")return Xn("selection.current is unavailable.");const E=H=>{const ie=H&&typeof H=="object"?H:null,he=ie?.selectionTarget??ie?.target??null;return!he||typeof he!="object"?Xn("insertText requires a live selection target.","PRECONDITION_FAILED"):Lt(()=>Oo(y.call(h,{type:"text",value:c,target:he}),Xn("insert failed.")),Xn("insert failed."))};let F;try{F=_.call(h.selection)}catch{return Xn("insertText could not resolve the live selection.","PRECONDITION_FAILED")}return Fr(F)?Promise.resolve(F).then(E,()=>Xn("insertText could not resolve the live selection.","PRECONDITION_FAILED")):E(F)},mi=(c,h)=>({payload:c,state:O,editor:S(),superdoc:t,context:h,ui:ye,execute:(y,_)=>Wc(y,_),executeAsync:(y,_)=>fg(y,_),doc:b(),selection:O.selection,documentMode:qn(),insertText:mh}),Ul=c=>c==="editing"||c==="suggesting"||c==="viewing"?c:null,qn=()=>{const c=S(),h=t&&typeof t=="object"?t:null,y=Ul(h?.config?.documentMode),_=Lt(typeof h?.getActiveRuntime=="function"?()=>{const H=h.getActiveRuntime();return typeof H?.getSnapshot=="function"?H.getSnapshot():null}:void 0,null),E=Ul(_?.documentMode),F=Ul(c?.options?.documentMode);return y&&E&&y!==E?y:E??y??F},Hl=()=>{const c=t&&typeof t=="object"?t:null,h=c?.interactionConfig?.comments;if(h&&typeof h.readOnly=="boolean")return h.readOnly===!0;const y=c?.config?.modules?.comments;return!!y&&typeof y=="object"&&y.readOnly===!0},Pc=()=>{if(qn()==="viewing")return at.documentReadonly;const c=(t&&typeof t=="object"?t:null)?.interactionConfig?.trackedChanges;return c&&typeof c.allowDecisions=="boolean"?c.allowDecisions?void 0:at.trackedChangeDecisionsDisabled:Hl()?at.documentReadonly:void 0},ed=()=>{const c=t&&typeof t=="object"?t:null,h=c?.interactionConfig?.comments;if(h&&typeof h.allowResolve=="boolean")return h.allowResolve===!1;const y=c?.config?.modules?.comments;return!!y&&typeof y=="object"&&y.allowResolve===!1},Fc=()=>qn()==="viewing"||Hl(),Nc=()=>Pc()!=null,qi=c=>c&&typeof c=="object"?c:null,Ys=(c,h)=>{if(!c)return{...FU,status:h};const y=c.target??null,_=typeof c.text=="string"?c.text:"";return{status:h,empty:c.empty===!0,target:y,selectionTarget:c.selectionTarget??null,activeMarks:Array.isArray(c.activeMarks)?c.activeMarks:[],activeCommentIds:Array.isArray(c.activeCommentIds)?c.activeCommentIds:[],activeChangeIds:Array.isArray(c.activeChangeIds)?c.activeChangeIds:[],quotedText:_}},Ka=()=>{const c=b()?.selection;return to("selection",Jr(),()=>c?.current?c.current({includeText:!0}):void 0,qi)},td=()=>{const{value:c,status:h}=Ka();return Ys(c,h)},Yi=()=>{const c=b()?.selection;return c?.current?c.current({includeText:!0}):void 0},$l=c=>{if(c.empty!==!0)return!1;const h=c.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},nd=c=>{const h=j(),y=h?.readLiveSelectionSyncSnapshot;if(typeof y!="function")return;const _=qi(Lt(()=>y.call(h),null));if(!_||!$l(_))return;const E=Jr(),F=Co(),H=!!(F&&(F.active>0||F.pending>0));if(H)gt=E,Cr();else if(gt=null,Ri("selection",E,Yi,qi))return;const ie=P.get("selection"),he=Array.isArray(_.activeMarks)&&_.activeMarks.length>0?_.activeMarks:Array.isArray(O.selection.activeMarks)?O.selection.activeMarks:[],Me=Array.isArray(_.activeCommentIds)?_.activeCommentIds:[],ze=$U(c),Ne=Gs(O.selection),qe=fh(_.selectionTarget)??fh(_.target),Xe=Ne?.range,We=qe?.range,Ge=!!(F&&F.active>0&&Ne&&qe&&Ne.blockId===qe.blockId&&nr(Ne.story)===nr(qe.story)&&typeof Xe?.start=="number"&&typeof We?.start=="number"&&Math.abs(We.start-Xe.start)<=2),it=ze!=null||Ge?O.selection.activeChangeIds.filter(Ke=>ze==null||Hs(O.trackChanges.items).aliasesFor(Ke).includes(ze)):[],ut=Array.isArray(_.activeChangeIds)&&_.activeChangeIds.length>0?_.activeChangeIds:it;P.set("selection",{token:E,value:{..._,activeMarks:he,activeCommentIds:Me,activeChangeIds:ut},hasSettled:!0,inflightToken:H?null:ie?.inflightToken??null})},Gl=async(c=0)=>{const h=b()?.selection,y=h?.current,_=Jr();if(typeof y!="function")return P.set("selection",{token:_,value:null,hasSettled:!0,inflightToken:null}),V(),O.selection;let E;try{E=y.call(h,{includeText:!0}),Fr(E)&&(E=await Promise.resolve(E))}catch{E=null}return ee?Ys(null,"pending"):Jr()!==_?c<1?Gl(c+1):O.selection:(P.set("selection",{token:_,value:qi(E),hasSettled:!0,inflightToken:null}),V(),O.selection)},Xi=()=>{const c=b()?.comments;return to("comments",xe(),()=>c?.list?c.list():void 0,h=>h&&Array.isArray(h.items)?h.items:[])},Yn=(c="trackChanges")=>{const h=xe(),y=b()?.trackChanges,_=T(),E=typeof _?.listTrackedChanges=="function"?_.listTrackedChanges:null,F=to(c,h,()=>E?tn(()=>y?.list?.({in:"all"})):y?.list?y.list({in:"all"}):void 0,H=>{const ie=H&&typeof H=="object"?H:null;if(ie?.complete===!1||ie?.sourceCoverageComplete===!1){if(un.set(c,h),Jo(),Wr===h||Ro()==="complete"){const he=()=>{ee||Gi()};typeof queueMicrotask=="function"?queueMicrotask(he):Promise.resolve().then(he)}}else un.get(c)===h&&un.delete(c);return ie&&Array.isArray(ie.items)?ie.items:[]});return un.get(c)===h&&F.status==="ready"?{...F,status:"stale"}:F},rd=c=>{const h=z(),y=G(),_=y?null:Xi(),E=y&&Array.isArray(h?.commentItems)?h.commentItems:null,F=y?E:_.value,H=y?U(h):_.status,ie=F??[],he=c.activeCommentIds,Me=P.get("comments"),ze=Me?.token===xe()&&Me.hasSettled&&Array.isArray(Me.value)?Me.value:null,Ne=lo.comments>0?ze:ie;lt&&Ne&&!Ne.some(Xe=>$r(Xe)===lt)&&(lt=null);const qe=lt??he[0]??null;return{status:Pl(H,c.status),listStatus:H,items:ie,total:ie.length,activeIds:he,activeId:qe}},Wl=new WeakMap,ws=c=>{const h=Wl.get(c);if(h)return h;const y=c.map(Zu).filter(_=>_!=null);return Wl.set(c,y),y},Xs=new WeakMap,Bc=(c,h)=>{const y=Xs.get(c);if(y?.suppressedIds===h)return y.value;const _=h?c.filter(E=>{const F=$r(E);return!F||!h.has(F)}):c;return Xs.set(c,{suppressedIds:h,value:_}),_},od=new WeakMap,id=c=>{const h=od.get(c);if(h)return h;const y=new Set;for(const E of c){const F=Qu(E),H=E,ie=F.author??F.authorEmail??H.author??H.authorEmail;typeof ie=="string"&&y.add(ie)}const _=[...y];return od.set(c,_),_},Mi=()=>{const c=xe();if(G()){const _=P.get("trackChanges"),E=_?.token===c&&_.hasSettled&&Array.isArray(_.value)?_.value:z()?.trackedChangeItems;return Array.isArray(E)?ws(E):null}const{value:h,status:y}=Yn("trackChanges:all");return y==="ready"?ws(h??[]):null},sd=c=>{const h=xe(),y=dn(h),_=z(),E=G(),F=E?null:Yn(),H=E&&Array.isArray(_?.trackedChangeItems)?_.trackedChangeItems:null,ie=E?H:F.value,he=E?U(_):F.status,Me=Bc(ws(ie??[]),y),ze=Mi(),Ne=et;if(Ne&&!He.has(Ne)){const It=P.get("trackChanges"),_n=It?.token===h&&It.hasSettled&&Array.isArray(It.value)?Bc(ws(It.value),y):null,An=lo.trackChanges>0?_n:Ne.story?ze:Me;An&&!An.some(Sr=>Ei(Sr,Ne.id,Ne.story))&&N(null)}const qe=ze??Me,Xe=Fl(qe,fs(c)),We=rr===h?[]:y?c.activeChangeIds.filter(It=>!y.has(It)):c.activeChangeIds,Ge=We.map(It=>Xe.toPublicId(It)??It),it=et?.story?Fl(qe,et.story):Hs(qe),ut=et?it.toPublicId(et.id)??et.id:null,Ke=qU({selectionIds:We,publicIds:Ge,selection:c,bodyItems:Me,allStoryItems:ze}),_t=ut??Ke;return{status:Pl(he,c.status),items:Me,total:Me.length,activeId:_t,authors:id(Me)}},Kl=(c,h)=>{if(!G())return h;Qo("comments");const y=Xi(),_=y.value??h.items;return{status:Pl(y.status,c.status),listStatus:y.status,items:_,total:_.length,activeIds:c.activeCommentIds,activeId:lt??c.activeCommentIds[0]??null}},Zi=(c,h)=>{if(!G())return h;Qo("trackChanges");const y=Yn(),_=dn(xe()),E=Bc(ws(y.value??h.items),_),F=et?.story?Fl(E,et.story):Hs(E),H=et?F.toPublicId(et.id)??et.id:h.activeId;return{status:Pl(y.status,c.status),items:E,total:E.length,activeId:H,authors:id(E)}};let zc=null,ad=[];const jc=(c,h)=>{const y=xe();return h==="ready"?(zc=y,ad=c,{items:c,status:h}):h==="pending"&&zc===y?{items:ad,status:"stale"}:{items:c,status:h}},gh=c=>{const h=b()?.contentControls,{value:y,status:_}=to("contentControls",xe(),()=>h?.list?h.list():void 0,Ne=>Ne&&Array.isArray(Ne.items)?Ne.items:[]),E=y??[],{items:F,status:H}=ql(h,c),ie=new Map(F.map(Ne=>[Ne.id,Ne])),he=new Set(E.map(Ne=>Ne.id)),Me=[...E.map(Ne=>ie.get(Ne.id)??Ne),...F.filter(Ne=>!he.has(Ne.id))],ze=F.map(Ne=>Ne.id);return{status:Pl(_,H,c.status),items:Me,total:Me.length,activeId:ze[0]??null,activeIds:ze}},qa=(c,h)=>{if(!c||typeof c.listInRange!="function")return{lockModesById:new Map,rows:[],status:"ready"};const y=XU(h);if(!y)return{lockModesById:new Map,rows:[],status:"ready"};const{value:_,status:E}=to(`contentControls:inRange:${Vo(h)}`,xe(),()=>c.listInRange(y),ie=>ie&&Array.isArray(ie.items)?ie.items:[]),F=_??[],H=new Map;for(const ie of F)typeof ie?.id=="string"&&H.set(ie.id,typeof ie.lockMode=="string"?ie.lockMode:"unlocked");return{lockModesById:H,rows:F,status:E}},ql=(c,h)=>{const{rows:y,status:_}=qa(c,h),E=h.selectionTarget,F=h.target;let H=E?.start;if(E){if(E.kind!=="selection"||H?.kind!=="text"||typeof H.blockId!="string"||typeof H.offset!="number")return jc([],_)}else{const Ge=F?.kind==="text"&&Array.isArray(F.segments)?F.segments[0]:void 0,it=Ge?.range;if(typeof Ge?.blockId!="string"||typeof it?.start!="number")return jc([],_);H={kind:"text",blockId:Ge.blockId,offset:it.start,story:F?.story}}const ie=(F?.coordinateSpace!=="tracked"&&Array.isArray(F?.segments)?F.segments:[]).find(Ge=>Ge.blockId===H.blockId),he=ie?.range,Me=ie&&typeof ie.blockId=="string"&&typeof he?.start=="number"?{kind:"text",blockId:ie.blockId,offset:he.start,story:F?.story??H.story}:null,ze=(E?E.coordinateSpace:F?.coordinateSpace)==="tracked"?"tracked":"visible",Ne=ze==="tracked"?Me:H,qe=Nr(h),Xe=qe.indexOf((Ne??H).blockId),We=y.map((Ge,it)=>({item:Ge,index:it})).filter(({item:Ge})=>{const it=Ge.selectionTarget,ut=it?.coordinateSpace==="tracked"?"tracked":"visible";if(ut==="tracked"&&ze!=="tracked")return!1;const Ke=ut==="tracked"?H:Ne;if(!Ke)return!1;const _t=it?.start,It=it?.end;if(it?.kind!=="selection"||_t?.kind!=="text"||It?.kind!=="text"||typeof _t.blockId!="string"||typeof It.blockId!="string"||typeof _t.offset!="number"||typeof It.offset!="number"||nr(it.story??_t.story??It.story)!==nr(E?.story??Ke.story))return!1;if(_t.blockId===It.blockId){if(Ke.blockId!==_t.blockId)return!1;const Sr=Math.min(_t.offset,It.offset),Mr=Math.max(_t.offset,It.offset);return Sr===Mr?Ke.offset===Sr:Ke.offset>=Sr&&Ke.offset<Mr}if(Ke.blockId===_t.blockId)return Ke.offset>=_t.offset;if(Ke.blockId===It.blockId)return Ke.offset<It.offset;if(Xe===-1)return!1;const _n=qe.indexOf(_t.blockId),An=qe.indexOf(It.blockId);return _n!==-1&&An!==-1?Xe>Math.min(_n,An)&&Xe<Math.max(_n,An):_n!==-1?Xe>_n:An!==-1?Xe<An:!0}).sort((Ge,it)=>{const ut=Ge.item.selectionTarget,Ke=it.item.selectionTarget,_t=ut.start.kind==="text"&&ut.end.kind==="text"&&ut.start.blockId===ut.end.blockId,It=Ke.start.kind==="text"&&Ke.end.kind==="text"&&Ke.start.blockId===Ke.end.blockId;if(_t!==It)return _t?-1:1;if(Ge.item.kind!==it.item.kind)return Ge.item.kind==="inline"?-1:1;if(_t&&It&&ut.start.kind==="text"&&ut.end.kind==="text"&&Ke.start.kind==="text"&&Ke.end.kind==="text"){const _n=Math.abs(ut.end.offset-ut.start.offset),An=Math.abs(Ke.end.offset-Ke.start.offset);if(_n!==An)return _n-An}return it.index-Ge.index}).map(({item:Ge})=>Ge);return jc(We,_)},ld=()=>{const c=t?.fonts;return{options:_H(kH(Lt(c?.getDocumentFontOptions?()=>c.getDocumentFontOptions():void 0,[])),SH(Lt(c?.getFontFamilyOptions?()=>c.getFontFamilyOptions():void 0,[]))),sizeOptions:AH}},Vc=()=>{const c=Lt(t?.getZoomState?()=>t.getZoomState():void 0,null),h=typeof c?.value=="number"?c.value:100,y=c?.mode;return{mode:y==="manual"||y==="fit-width"?y:y==="fixed"?"manual":null,value:h,min:typeof c?.min=="number"?c.min:10,max:typeof c?.max=="number"?c.max:100}},cd=()=>Lt(t?.getMeasurementUnit?()=>t.getMeasurementUnit():void 0,"in")==="cm"?"cm":"in",ud=()=>{const c=S();return{ready:c!=null,mode:qn(),dirty:c?!!c.isDirty:!1}},Yl=c=>{const h=c.quotedText;if(typeof h!="string"||h.length===0)return null;const y=Xu(c);if(y.length===0||!Lc(y.map(F=>F.blockId)))return null;const _=c.target,E=y.length===1?To(y[0].blockId,_?.story):void 0;return{select:{type:"text",pattern:h,mode:"contains",caseSensitive:!0},...E?{within:E}:{},require:"any"}},vh=c=>{const h=b()?.query;if(typeof h?.match!="function")return null;const y=Yl(c);if(!y)return null;const{value:_}=to(`query:${Vo(c)}`,xe(),()=>h.match(y),E=>E&&typeof E=="object"?E:null);return MI(_,c)},Xl=c=>{const h=j(),y=new Set(Nr(c));if(y.size===0)return{};const _=h?.readMountedProjectionBlocksByIds,E=h?.readMountedProjectionBlocks;if(typeof _!="function"&&typeof E!="function")return{};const F=Lt(()=>{if(typeof _!="function")return E.call(h);const Ge=hs(c);return Ge?_.call(h,[...y],Ge):_.call(h,[...y])},null);if(!Array.isArray(F))return{};const H=r2(F),ie=Ge=>{const it={},ut=t2(Ge.fontFamily);ut&&(it.fontFamily=ut);const Ke=aH(Ge.fontSize);return Ke&&(it.fontSize=Ke),typeof Ge.color=="string"&&Ge.color.trim()!==""&&(it.color=Ge.color.trim().toUpperCase()),typeof Ge.highlight=="string"&&Ge.highlight.trim()!==""&&(it.highlight=Ge.highlight.trim().toUpperCase()),it},he=Gs(c),Me=he&&typeof he.range?.start=="number"?he.range.start:null;if(he&&Me!==null&&y.has(he.blockId)){const Ge=H.find(ut=>Dc(ut,he.blockId)),it=Ge&&Array.isArray(Ge.runs)?Ge.runs:null;if(it&&it.length>0&&it.every(ut=>ut?.kind==="text"||ut?.kind==="tab")){let ut=0,Ke=null;for(const _t of it){const It=eg(_t);if(Me>=ut&&Me<ut+It){Ke=_t;break}ut+=It}if(!Ke){for(let _t=it.length-1;_t>=0&&!Ke;_t-=1)it[_t]?.kind==="text"&&(Ke=it[_t]);Ke??=it[it.length-1]??null}return Ke?ie(Ke):{}}}const ze=Xu(c);if(ze.length>0){const Ge=new Set,it=new Set;let ut=!1,Ke=!0;for(const _t of ze){const It=H.find(Sr=>Dc(Sr,_t.blockId));if(!It)return{};const _n=Array.isArray(It.runs)?It.runs:[];if(_n.length===0)continue;if(!_n.every(Sr=>Sr?.kind==="text"||Sr?.kind==="tab")){Ke=!1;break}let An=0;for(const Sr of _n){const Mr=eg(Sr),Lr=An,Br=An+Mr;if(Lr<_t.end&&Br>_t.start){ut=!0;const ii=ie(Sr);ii.fontFamily&&Ge.add(ii.fontFamily),ii.fontSize&&it.add(ii.fontSize)}An=Br}}if(Ke&&ut){const _t={};return Ge.size===1&&(_t.fontFamily=[...Ge][0]),it.size===1&&(_t.fontSize=[...it][0]),_t}}const Ne=new Set,qe=new Set;let Xe=!1;for(const Ge of H){if(![...y].some(ut=>Dc(Ge,ut)))continue;const it=Array.isArray(Ge.runs)?Ge.runs:[];for(const ut of it){if(ut?.kind!=="text")continue;Xe=!0;const Ke=ie(ut);Ke.fontFamily&&Ne.add(Ke.fontFamily),Ke.fontSize&&qe.add(Ke.fontSize)}}if(!Xe)return{};const We={};return Ne.size===1&&(We.fontFamily=[...Ne][0]),qe.size===1&&(We.fontSize=[...qe][0]),We},dd=c=>{const h=j(),y=new Set(Nr(c));if(y.size===0)return{};const _=h?.readMountedProjectionBlocksByIds,E=h?.readMountedProjectionBlocks;if(typeof _!="function"&&typeof E!="function")return{};const F=Lt(()=>{if(typeof _!="function")return E.call(h);const We=hs(c);return We?_.call(h,[...y],We):_.call(h,[...y])},null);if(!Array.isArray(F))return{};const H=r2(F),ie=We=>({bold:We.bold===!0,italic:We.italic===!0,underline:We.underline!=null,strikethrough:We.strike===!0}),he=We=>{const Ge={};for(const it of hh){const ut=We[it];ut.size===1&&(Ge[it]=[...ut][0])}return Ge},Me=Gs(c),ze=Me&&typeof Me.range?.start=="number"?Me.range.start:null;if(Me&&ze!==null&&y.has(Me.blockId)){const We=H.find(it=>Dc(it,Me.blockId)),Ge=We&&Array.isArray(We.runs)?We.runs:null;if(Ge&&Ge.length>0&&Ge.every(it=>it?.kind==="text"||it?.kind==="tab")){let it=0,ut=null;for(const Ke of Ge){const _t=eg(Ke);if(ze>=it&&ze<it+_t){ut=Ke;break}it+=_t}if(!ut){for(let Ke=Ge.length-1;Ke>=0&&!ut;Ke-=1)Ge[Ke]?.kind==="text"&&(ut=Ge[Ke]);ut??=Ge[Ge.length-1]??null}return ut?ie(ut):{}}}const Ne=Xu(c);if(Ne.length>0){const We={bold:new Set,italic:new Set,underline:new Set,strikethrough:new Set};let Ge=!1,it=!0;for(const ut of Ne){const Ke=H.find(_n=>Dc(_n,ut.blockId));if(!Ke)return{};const _t=Array.isArray(Ke.runs)?Ke.runs:[];if(_t.length===0)continue;if(!_t.every(_n=>_n?.kind==="text"||_n?.kind==="tab")){it=!1;break}let It=0;for(const _n of _t){const An=eg(_n),Sr=It,Mr=It+An;if(Sr<ut.end&&Mr>ut.start){Ge=!0;const Lr=ie(_n);for(const Br of hh)We[Br].add(Lr[Br])}It=Mr}}if(it&&Ge)return he(We)}const qe={bold:new Set,italic:new Set,underline:new Set,strikethrough:new Set};let Xe=!1;for(const We of H){if(![...y].some(it=>Dc(We,it)))continue;const Ge=Array.isArray(We.runs)?We.runs:[];for(const it of Ge){if(it?.kind!=="text")continue;Xe=!0;const ut=ie(it);for(const Ke of hh)qe[Ke].add(ut[Ke])}}return Xe?he(qe):{}},fd=(c,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=Xl(c),_={...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(!c.empty&&(_.fontFamily===void 0||_.fontSize===void 0)){const E=yh(c);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"}},hd=["fontFamily","fontSize","bold","italic","underline","strikethrough"],Zl=c=>{const h=c.selectionTarget;if(!h)return{value:null,status:"ready"};const y=yr(b(),"format.readEffectiveInlineUniformity");if(!y)return{value:null,status:"ready"};const _=RI(c)??Vo(c);return to(`effInline:${_}`,xe(),()=>y({target:h,offsetSpace:"selection",keys:hd}),E=>E&&typeof E=="object"?E:null)},yh=c=>{const{value:h,status:y}=Zl(c);if(!h||h.success!==!0)return{values:null,status:y};const _=h.values,E=F=>{const H=_?.[F];if(!(!H||H.state!=="uniform"||typeof H.value!="string"))return F==="fontFamily"?t2(H.value):H.value};return{values:{fontFamily:E("fontFamily"),fontSize:E("fontSize")},status:y}},pd=c=>{const{value:h,status:y}=Zl(c);if(!h||h.success!==!0)return{values:null,status:y};const _=h.values,E={};for(const F of hh){const H=_?.[F];H?.state==="uniform"&&(H.value==="true"||H.value==="false")&&(E[F]=H.value==="true")}return{values:E,status:y}},Uc=(c,h)=>{const y=c.activeMark;if(!y||!hh.includes(y))return null;const _=y,E=dd(h)[_];if(E!==void 0)return E;const{values:F}=pd(h),H=F?.[_];return H!==void 0?H:null},bh=async c=>{const h=c.selectionTarget;if(!h)return null;const y=yr(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}},wh=(c,h,y)=>{const _=y.values;for(const E of["fontFamily","fontSize"]){if(h[E]!==void 0)continue;const F=_?.[E];F?.state==="uniform"&&typeof F.value=="string"?c[E]=E==="fontFamily"?t2(F.value):F.value:delete c[E]}},md=c=>fd(c,LI(vh(c),c)),Mo=c=>md(c).values,gd=async c=>{const h=b()?.query,y=Yl(c);if(typeof h?.match!="function"||!y)return Mo(c);try{const _=await Promise.resolve(h.match(y)),E=LI(MI(_&&typeof _=="object"?_:null,c),c),F=fd(c,E);if(F.effectiveUniformityStatus!=="ready"&&(E.fontFamily===void 0||E.fontSize===void 0)){const H=await bh(c);H&&wh(F.values,E,H)}return F.values}catch{return Mo(c)}},Zs=async c=>{const h=b();if(h)return typeof h.getNode=="function"?await Promise.resolve(h.getNode(c)):await Promise.resolve(h.getNodeById?.({nodeId:c.nodeId,nodeType:c.nodeType}))},vd=c=>{const h=b()?.query;if(typeof h?.match!="function")return"ready";const y=Yl(c);if(!y)return"ready";const{status:_}=to(`query:${Vo(c)}`,xe(),()=>h.match(y),E=>E&&typeof E=="object"?E:null);return _},yd=c=>{const h=md(c),y=h.values;if(c.empty)return h;const _=Ba(c);return _?c.status==="ready"&&vd(c)==="ready"&&h.effectiveUniformityStatus==="ready"?(w={key:_,values:y},h):w&&w.key===_?{...h,values:{...w.values,...y}}:h:h},Ya=c=>{const h=b(),y=yd(c),_=y.values;c.status==="ready"&&!c.empty&&vd(c)==="ready"&&y.effectiveUniformityStatus==="ready"&&(v=_,C=`${Rc(c)}:${xe()}`);const E=h?.contentControls,{lockModesById:F}=qa(E,c),H={};for(const ie of co())H[ie]=ko(ie,h,c,_,F);return H},Qi=c=>c?at.operationUnavailable:S()?at.documentApiUnavailable:at.notReady,Ch=c=>c==="contentLocked"||c==="sdtContentLocked",Qs=c=>{for(const h of c.values())if(Ch(h))return at.contentControlLocked},bd=(c,h,y,_,E)=>{if(!h)return c.scope==="all"?at.bulkDecisionsDisabled:Qi(E);if(y)return y;if(c.scope!=="all"&&_.activeChangeIds.length===0)return at.selectionRequired},Hc=c=>{const h=O?.trackChanges?.items?.find(H=>$r(H)===c);if(h)return Qu(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(H=>$r(H)===c);if(!E)return null;const F=Zu(E);return F?Qu(F):E},Ql=(c,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 F=Hc(E)??{id:E},H=HU(F,_),ie=c==="accept"?H?"RESOLVE_OWN":"RESOLVE_OTHER":H?"REJECT_OWN":"REJECT_OTHER";let he;try{he=y.call(t,{permission:ie,trackedChange:F,comment:null})}catch{return}if(he===!1)return at.permissionDenied}},Js=c=>{const h=j(),y=Lt(typeof h?.getCapabilities=="function"?()=>h.getCapabilities():void 0,null)?.editableSubset?.commands;if(Array.isArray(y))return y.find(_=>_?.command===c||_?.id===c)??null;if(y&&typeof y=="object"){const _=y[c];return _&&typeof _=="object"?_:null}return null},ei=(c,h)=>{if(c.scope!=="all"||typeof h?.[`${c.kind}All`]=="function")return;const y=Js(`trackedChanges.${c.kind}All`);if(!(y&&(y.status==="supported"||y.enabled===!0)))return at.bulkDecisionsDisabled},ko=(c,h,y,_,E=new Map)=>{if(Ze.has(c))return en({supported:!0,enabled:!0,...Lt(Ze.get(c).getState?()=>Ze.get(c).getState(mi(void 0)):void 0,{})},"custom");const F=qn()==="viewing",H=wI(c);if(H&&typeof Y()?.lists?.apply=="function"){const Xe=fe(),We=typeof Xe?.shippedStatus=="string"?Xe.shippedStatus:null,Ge=We!=="not-shipped"&&We!=="disabled",it=Ge&&(typeof Xe?.enabled=="boolean"?Xe.enabled:!0),ut=Ge?ve(Xe):null;return en(F?{enabled:!1,active:ut===H,supported:Ge,value:Xe?.value,reason:at.documentReadonly}:{enabled:it,active:ut===H,supported:Ge,value:Xe?.value},"builtin")}const ie=tg(c);if(ie){const Xe=h?.trackChanges,We=typeof Xe?.decide=="function"||typeof Xe?.[ie.kind]=="function",Ge=typeof Xe?.decide=="function"||typeof Xe?.[`${ie.kind}All`]=="function",it=ie.scope==="all"?Ge:We,ut=ei(ie,Xe)??bd(ie,it,Pc(),y,h)??(ie.scope==="all"?void 0:Ql(ie.kind,y.activeChangeIds));return en({enabled:ut==null,active:!1,supported:it,reason:ut},"builtin")}if(c==="copy-format")return qn()==="viewing"?en({supported:!0,enabled:!1,active:!1},"builtin"):S()?en({supported:!0,enabled:!0,active:p.mode!=="idle"},"builtin"):en({supported:!0,enabled:!1,active:!1,reason:at.notReady},"builtin");const he=Gu(c);if(!he)return en({enabled:!1,active:!1,supported:!1,reason:at.commandUnsupported},"unsupported");if(he.disposition!=="routed")return en({enabled:!1,active:!1,supported:!1,reason:he.reason??at.commandUnsupported},he.disposition==="unsupported"?"unsupported":"builtin");if(he.instanceRoute)return no(he);if(he.table)return Nn(he,h,F);if(he.inline?.kind==="clear"){if(he.mutates&&F)return en({enabled:!1,active:!1,supported:!0,reason:at.documentReadonly},"builtin");const Xe=Qs(E);if(Xe)return en({enabled:!1,active:!1,supported:!0,reason:Xe},"builtin");const We=Nr(y).length>0||Ju(y)!=null;return en({enabled:We,active:!1,supported:!0,reason:We?void 0:at.selectionRequired},"builtin")}const Me=he.docRoute;if(!Me)return en({enabled:!1,active:!1,supported:!1,reason:at.commandUnsupported},"unsupported");if(yr(h,Me)==null)return en({enabled:!1,active:!1,supported:!1,reason:Qi(h)},"builtin");const ze=me(c);if(ze){const Xe=ze.shippedStatus,We=Xe!=="not-shipped"&&Xe!=="disabled",Ge=typeof ze.enabled=="boolean"?ze.enabled:!0,it=c==="undo"||c==="redo",ut=it&&ze.historyResolved===!1,Ke=it&&We&&Ge===!1&&ze.reason===null&&!ut,_t=ze.reason===void 0?void 0:Ke?at.historyEmpty:ut?at.notReady:Zm(ze.reason,at.commandUnsupported);return he.mutates&&F?en({enabled:!1,active:!1,supported:We,reason:at.documentReadonly},"builtin"):en({enabled:We&&Ge,active:!1,supported:We,reason:_t},"builtin")}const Ne=ec(he,h,y),qe=Sh(he,h,y,_);if(he.list?.mode==="indent"||he.list?.mode==="outdent")return vt(he,h,F,y,Ne,qe);if(he.list?.mode==="toggle-seed")return Gt(he,h,F,y,Ne,qe);if(he.mutates&&F)return en({enabled:!1,active:Ne,supported:!0,value:qe,reason:at.documentReadonly},"builtin");if(he.inline&&!Ju(y)){const Xe=Qs(E);return en(Xe?{enabled:!1,active:Ne,supported:!0,value:qe,reason:Xe}:Nr(y).length>0&&typeof j()?.setPendingInlineFormat=="function"?{enabled:!0,active:Ne,supported:!0,value:qe}:{enabled:!1,active:Ne,supported:!0,value:qe,reason:at.rangeSelectionRequired},"builtin")}if((he.blockParagraph||he.list)&&Nr(y).length===0)return en({enabled:!1,active:Ne,supported:!0,value:qe,reason:at.selectionRequired},"builtin");if(he.link&&!Ne&&Jb(y).length===0&&!Gs(y))return en({enabled:!1,active:Ne,supported:!0,reason:at.rangeSelectionRequired},"builtin");if(he.inline){const Xe=Qs(E);if(Xe)return en({enabled:!1,active:Ne,supported:!0,value:qe,reason:Xe},"builtin")}return en({enabled:!0,active:Ne,supported:!0,value:qe},"builtin")};function kh(c,h){const y=c.address?.anchor,_=y?.start,E=y?.end,F=typeof _?.blockId=="string"?_.blockId:null,H=typeof E?.blockId=="string"?E.blockId:null;if(!F||!H)return!1;const ie=typeof _?.offset=="number"?_.offset:null,he=typeof E?.offset=="number"?E.offset:null;if(ie==null||he==null)return!1;const Me=h.target,ze=Me&&Array.isArray(Me.segments)?Me.segments:[];for(const Ne of ze){const qe=typeof Ne?.blockId=="string"?Ne.blockId:null;if(!qe)continue;const Xe=Ne.range,We=typeof Xe?.start=="number"?Xe.start:null,Ge=typeof Xe?.end=="number"?Xe.end:null;if(!(We==null||Ge==null)){if(F!==H){if(qe===F&&Ge>ie||qe===H&&We<he)return!0;continue}if(qe===F){if(We===Ge){if(We>=ie&&We<=he)return!0;continue}if(Math.max(We,ie)<Math.min(Ge,he))return!0}}}return!1}const Jl=(c,h)=>{const y=c?.hyperlinks;if(!y||typeof y.list!="function")return null;const _=Nr(h);if(!Lc(_))return null;for(const E of _){const F={kind:"block",nodeType:"paragraph",nodeId:E},{value:H}=to(`hyperlinks:${E}`,xe(),()=>y.list({within:F}),he=>he&&typeof he=="object"?he:null),ie=(H&&Array.isArray(H.items)?H.items:[]).find(he=>kh(he,h));if(ie)return ie}return null},ec=(c,h,y)=>{if(c.link)return Jl(h,y)!=null;if(c.list?.mode==="toggle-seed"&&c.list.seed)return X(h,y)===c.list.seed;const _=K(c);if(_!==null)return _;const E=r.get(c.id),F=Ba(y);if(F&&E?.selectionSignature===F)return E.active;const H=Uc(c,y);return H!==null?H:IH(c,y)},Sh=(c,h,y,_)=>{if(c.inline&&e2(c.inline.key)){const E=x(c);if(E!==void 0)return E;const F=_[c.inline.key];if(F!==void 0)return F;const H=Ba(y),ie=H?n.get(c.inline.key):void 0;if(H&&ie?.selectionSignature===H)return ie.value}if(c.id==="linked-style"){const{style:E}=gi(y,on().cache);return!E.styleId||E.mixed?void 0:{styleId:E.styleId,styleName:E.styleName}}if(c.id==="text-align")return Be(h,y);if(c.id==="link")return On(h,y)??void 0},Ji=(c,h,y)=>{const _=c?.lists;if(!_)return{value:null,status:"ready"};const E=y.storyType==="body",F=typeof _.getStateInStory=="function"?()=>_.getStateInStory({target:Na(h),story:y}):E&&typeof _.getState=="function"?()=>_.getState({target:Na(h)}):null;if(!F)return{value:null,status:"ready"};const{value:H,status:ie}=to(`lists:${nr(y)}:${h}`,xe(),F,he=>he&&typeof he=="object"?he:null);return{value:H?.success===!0?H:null,status:ie}},wd=(c,h,y)=>Ji(c,h,y).value,A=(c,h,y)=>{const _=wd(c,h,y);return!_||_.isListItem!==!0?null:_.seed==="bullet"||_.seed==="ordered"?_.seed:null},M=(c,h,y)=>{const _=Ji(c,h,y),E=_.value;return{value:E&&typeof E.isListItem=="boolean"?E.isListItem:null,status:_.status}},X=(c,h)=>{const y=Nr(h);if(y.length===0||!Lc(y))return null;const _=fs(h),E=A(c,y[0],_);if(E!=="bullet"&&E!=="ordered")return null;for(const F of y.slice(1))if(A(c,F,_)!==E)return null;return E},oe=(c,h,y)=>{if(!c)return{value:null,status:"ready",refreshing:!1};const _=nr(y),E=_==="story:body";if(E&&typeof c.getNodeById!="function")return{value:null,status:"ready",refreshing:!1};if(!E&&typeof c.getNode!="function")return{value:null,status:"ready",refreshing:!1};const F=`node:${_}:${h}`,H=xe(),ie=to(F,H,()=>E?c.getNodeById({nodeId:h,nodeType:"paragraph"}):c.getNode(To(h,y)),Me=>Me&&typeof Me=="object"?Me:null),he=P.get(F);return{...ie,refreshing:ie.status==="stale"&&he?.inflightToken===H&&he.failedToken!==H}},ne=c=>c==="left"||c==="center"||c==="right"||c==="justify"?c:void 0,ue=c=>c==="start"||c==="end"||c==="distributed"||c==="numTab"||c==="lowKashida"||c==="mediumKashida"||c==="highKashida"||c==="thaiDistribute",le=(c,h)=>{const y=j(),_=y?.readMountedProjectionBlocksByIds;if(typeof _!="function")return null;const E=hs(c),F=Lt(()=>E?_.call(y,[...h],E):_.call(y,[...h]),null);if(!Array.isArray(F))return new Map;const H=r2(F),ie=new Map;for(const he of h){const Me=H.find(Xe=>Dc(Xe,he));if(!Me)continue;const ze=Me.attrs,Ne=ne(ze?.alignment),qe=n9(ze);ie.set(he,Ne??(qe==="rtl"?"right":"left"))}return ie},de=(c,h,y,_)=>{const{value:E,status:F,refreshing:H}=oe(c,h,y),ie=_?.get(h);if(F==="pending")return ie?{status:"uniform",value:ie}:{status:"pending"};if(F==="stale"&&!H)return{status:"pending"};if(F==="stale"&&ie)return{status:"uniform",value:ie};if(F==="stale"&&_&&!ie)return{status:"unavailable"};if(!E)return{status:"unavailable"};const he=E.node;if(!he)return{status:"unavailable"};const Me=he.kind;if(Me!=="paragraph"&&Me!=="heading")return{status:"unavailable"};const ze=he[Me];if(!ze||typeof ze!="object")return{status:"unavailable"};const Ne=ze.props?.alignment;if(Ne==null)return ie?{status:"uniform",value:ie}:{status:"unavailable"};const qe=ne(Ne);return qe?{status:"uniform",value:qe}:ue(Ne)&&ie?{status:"uniform",value:ie}:{status:"unavailable"}},we=(c,h)=>{const y=Nr(h);if(y.length===0||!Lc(y))return{status:"unavailable"};const _=fs(h),E=le(h,y),F=de(c,y[0],_,E);if(F.status!=="uniform")return F;for(const H of y.slice(1)){const ie=de(c,H,_,E);if(ie.status!=="uniform")return ie;if(ie.value!==F.value)return{status:"mixed"}}return F},Te=c=>{const h=Nr(c);return h.length===0?null:`${nr(fs(c))}:${h.join(",")}`},Be=(c,h)=>{const y=we(c,h),_=y.status==="uniform"?y.value:void 0,E=o;if(!E)return _;const F=Te(h);return F&&F!==E.selectionSignature?(o=null,_):!F||!E.settled?E.value:y.status!=="pending"?(o=null,_):E.value},Re=(c,h)=>{const y=ne(h),_=Te(c),E=Nr(c);if(!y||!_||E.length===0)return null;const F=++i;return o={selectionSignature:_,value:y,generation:F,settled:!1,canReconcile:Lc(E)},V(),F},rt=(c,h)=>{if(c==null)return;const y=o;if(!(!y||y.generation!==c)){if(!xo(h)){o=null;return}if(!y.canReconcile){o=null;return}y.settled=!0}},ct=async(c,h,y)=>{const _=c?.lists;if(!_)return null;try{const E=y.storyType==="body",F=typeof _.getStateInStory=="function"?await _.getStateInStory({target:Na(h),story:y}):E&&typeof _.getState=="function"?await _.getState({target:Na(h)}):null,H=F&&typeof F=="object"?F:null;return!H||H.success!==!0||typeof H.isListItem!="boolean"?null:H.isListItem}catch{return null}},nt=(c,h,y)=>{const _={resolved:!1,seed:null},E=c?.lists;if(!E)return _;const F=y.storyType==="body",H=typeof E.getStateInStory=="function"?()=>E.getStateInStory({target:Na(h),story:y}):F&&typeof E.getState=="function"?()=>E.getState({target:Na(h)}):null;if(!H)return _;const ie=he=>{const Me=he&&typeof he=="object"?he:null;return!Me||Me.success!==!0||typeof Me.isListItem!="boolean"?_:{resolved:!0,seed:Me.isListItem===!0&&(Me.seed==="bullet"||Me.seed==="ordered")?Me.seed:null}};try{const he=H();return Fr(he)?Promise.resolve(he).then(ie,()=>_):ie(he)}catch{return _}},yt=async(c,h,y)=>{if(!c)return null;try{const _=!y||y.storyType==="body",E=y&&typeof c.getNode=="function"?await c.getNode(To(h,y)):_&&typeof c.getNodeById=="function"?await c.getNodeById({nodeId:h,nodeType:"paragraph"}):null;return QU(E&&typeof E=="object"?E:null)}catch{return null}},vt=(c,h,y,_,E,F)=>{if(c.mutates&&y)return en({enabled:!1,active:E,supported:!0,value:F,reason:at.documentReadonly},"builtin");const H=Nr(_);if(H.length===0)return en({enabled:!1,active:E,supported:!0,value:F,reason:at.selectionRequired},"builtin");const ie=c.docRoute?yr(h,c.docRoute):null,he=yr(h,"format.paragraph.setIndentation"),Me=yr(h,"format.paragraph.clearIndentation"),ze=c.list?.mode,Ne=ze==="indent"?he!=null:he!=null||Me!=null,qe=fs(_);let Xe=null;if(qe.storyType!=="body"){Xe=[];for(const We of H){const{value:Ge,status:it}=M(h,We,qe);if(Ge===null)return it!=="ready"&&(ie!=null||Ne)?en({enabled:!0,active:E,supported:!0,value:F},"builtin"):en({enabled:!1,active:E,supported:!1,value:F,reason:Qi(h)},"builtin");Xe.push(Ge)}}if(Xe?.some(We=>We===!0)){const We=ze==="indent"?"lists.indentRange":"lists.outdentRange",Ge=qn()!=="suggesting"&&Xe.every(ut=>ut===!0)&&yr(h,We)!=null,it=ze==="outdent"&&yr(h,"lists.outdentInStory")!=null;if(!Ge&&!it)return en({enabled:!1,active:E,supported:!1,value:F,reason:Qi(h)},"builtin")}for(const[We,Ge]of H.entries()){const it=Xe?{value:Xe[We]??null,status:"ready"}:M(h,Ge,qe),ut=it.value;if(ut===!0){if(ie!=null)return en({enabled:!0,active:E,supported:!0,value:F},"builtin");continue}if(ut===!1&&Ne){if(qe.storyType!=="body"&&typeof h?.getNode!="function")continue;return en({enabled:!0,active:E,supported:!0,value:F},"builtin")}if(ut===null)return it.status!=="ready"&&(ie!=null||Ne)?en({enabled:!0,active:E,supported:!0,value:F},"builtin"):en({enabled:!1,active:E,supported:!1,value:F,reason:Qi(h)},"builtin")}return en({enabled:!1,active:E,supported:!1,value:F,reason:Qi(h)},"builtin")},Gt=(c,h,y,_,E,F)=>{if(c.mutates&&y)return en({enabled:!1,active:E,supported:!0,value:F,reason:at.documentReadonly},"builtin");const H=Nr(_);if(H.length===0)return en({enabled:!1,active:E,supported:!0,value:F,reason:at.selectionRequired},"builtin");const ie=fs(_),he=h?.lists;if(!(typeof he?.getStateInStory=="function"||ie.storyType==="body"&&typeof he?.getState=="function"))return en({enabled:!1,active:E,supported:!1,value:F,reason:at.operationUnavailable},"builtin");if(!Lc(H))return en(ie.storyType==="body"&&yr(h,"lists.remove")!=null?{enabled:!0,active:E,supported:!0,value:F}:{enabled:!1,active:E,supported:!1,value:F,reason:at.operationUnavailable},"builtin");const Me=H.map(Xe=>Ji(h,Xe,ie));if(Me.some(({status:Xe})=>Xe!=="ready"))return en({enabled:!0,active:E,supported:!0,value:F},"builtin");if(Me.some(({value:Xe})=>Xe===null))return en({enabled:!1,active:E,supported:!1,value:F,reason:at.operationUnavailable},"builtin");const ze=c.list?.seed,Ne=Me.every(({value:Xe})=>Xe?.isListItem===!0&&Xe.seed===ze);if(ie.storyType==="body")return en(!Ne||yr(h,"lists.remove")!=null?{enabled:!0,active:E,supported:!0,value:F}:{enabled:!1,active:E,supported:!1,value:F,reason:at.operationUnavailable},"builtin");const qe=yr(h,"lists.removeInStory");return en(Ne&&qe?{enabled:!0,active:E,supported:!0,value:F}:{enabled:!1,active:E,supported:!1,value:F,reason:at.operationUnavailable},"builtin")},On=(c,h)=>{const y=Jl(c,h)?.properties?.href;return typeof y=="string"?y:null},no=c=>{if(!S())return en({enabled:!1,active:!1,supported:!1,reason:at.notReady},"builtin");const h=c.instanceRoute;return typeof t?.[h]!="function"?en({enabled:!1,active:!1,supported:!1,reason:at.operationUnavailable},"builtin"):en({enabled:!0,active:Zt(c),supported:!0,value:kn(c)},"builtin")},Zt=c=>{const h=t?.config??void 0;return c.valueFrom==="ruler"?!!h?.rulers:c.valueFrom==="formattingMarks"?!!h?.layoutEngineOptions?.showFormattingMarks:!1},Nn=(c,h,y)=>{if(y)return en({enabled:!1,active:!1,supported:!0,reason:at.documentReadonly},"builtin");const _=Fe();return _!=null&&(!c.table.requiresCell||_.cellNodeId!=null)?(c.docRoute?yr(h,c.docRoute):null)==null?en({enabled:!1,active:!1,supported:!1,reason:Qi(h)},"builtin"):en({enabled:!0,active:!1,supported:!0},"builtin"):en({enabled:!1,active:!1,supported:!0,reason:at.tableContextUnavailable},"builtin")},kn=c=>{if(c.valueFrom==="zoom")return Vc().value;if(c.valueFrom==="documentMode")return qn();if(c.valueFrom==="measurementUnit")return cd();if(c.valueFrom==="ruler"||c.valueFrom==="formattingMarks")return Zt(c)},kr=(c,h)=>c.id==="zoom"?typeof h=="number"&&Number.isFinite(h)&&h>0:c.id==="document-mode"?h==="editing"||h==="suggesting"||h==="viewing":c.id==="measurement-unit"?h==="in"||h==="cm":!0,co=()=>[...new Set([...Fz,...Ze.keys()])],pr="Normal",ti={ready:!1,status:"ready",catalogRevision:null,quickGallery:[],activeParagraphStyleId:null,activeParagraphStyleName:null,mixedSelection:!1,sourceStatus:null,diagnostics:[]},$o=c=>`styles:catalog:${JSON.stringify(c??{})}`,st=c=>{const h=b()?.styles;return!h||typeof h.getCatalog!="function"?{value:null,status:"ready"}:to($o(c),xe(),()=>h.getCatalog(c),y=>y&&typeof y=="object"?y:null)},on=()=>{const c=st({includePreview:!0});if(!c.value)return{cache:null,status:c.status};const h=st({view:"quickGallery",includePreview:!0}),y=h.value?h.value.items:c.value.styles.filter(E=>E.visibility.quickGallery),_=new Map;for(const E of c.value.styles)_.set(E.id,E);return{cache:{full:c.value,quickGallery:y,byId:_},status:Pl(c.status,h.status)}},uo=(c,h,y)=>{const{value:_,status:E}=oe(c,h,y);if(!_)return{ok:!1,styleRef:null,status:E};const F=_.node;if(!F||typeof F!="object")return{ok:!1,styleRef:null,status:E};const H=F.kind,ie=typeof H=="string"?F[H]:void 0,he=ie&&typeof ie=="object"?ie.styleRef:void 0;return{ok:!0,styleRef:typeof he=="string"&&he.length>0?he:null,status:E}},gi=(c,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=Nr(c);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(!Lc(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 F=h?.full.defaults.paragraphStyleId??(h?pr:null),H=new Set;let ie=0,he=0,Me=0,ze="ready";const Ne=fs(c);for(const We of E){const Ge=uo(_,We,Ne);if(ze=Pl(ze,Ge.status),!Ge.ok){he+=1;continue}if(!Ge.styleRef&&!F){Me+=1;continue}const it=Ge.styleRef??F;if(!it){Me+=1;continue}ie+=1,H.add(it)}if(ie===0){const We=Me>0&&he===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:ze}}const qe=he+Me;if(qe>0)return y.push({severity:"warning",code:"active-style-partial",message:`Active paragraph style resolved from ${ie} of ${ie+qe} selected blocks; ${qe} could not be read, so the active style is unavailable.`}),{style:{styleId:null,styleName:null,mixed:!1,diagnostics:y},status:ze};if(H.size>1)return{style:{styleId:null,styleName:null,mixed:!0,diagnostics:y},status:ze};const Xe=[...H][0];return{style:{styleId:Xe,styleName:h?.byId.get(Xe)?.name??null,mixed:!1,diagnostics:y},status:ze}},Cd=c=>{if(!S())return ti;const{cache:h,status:y}=on(),{style:_,status:E}=gi(c,h);let F;return h?F=_.diagnostics.length===0?h.full.diagnostics:[...h.full.diagnostics,..._.diagnostics]:F=[{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,c.status),catalogRevision:h?.full.revision??null,quickGallery:h?.quickGallery??[],activeParagraphStyleId:_.styleId,activeParagraphStyleName:_.styleName,mixedSelection:_.mixed,sourceStatus:h?.full.sourceStatus??null,diagnostics:F}},Lo=(c="direct")=>{const{sink:h}=Xm(),y=h?Fa():0,_={},E=(Me,ze)=>{if(!h)return ze();const Ne=Fa();try{return ze()}finally{_[Me]=Fa()-Ne}},F=E("documentMode",qn),H=E("selection",td);H.status==="ready"&&Oc(H),Q(H);const ie=Ba(H);for(const[Me,ze]of r)(!ie||ze.selectionSignature!==ie||ze.settled&&H.status==="ready")&&r.delete(Me);const he={ready:S()!=null,documentMode:F,document:E("document",ud),selection:H,toolbar:{context:F,commands:E("toolbarCommands",()=>Ya(H)),copyFormatActive:p.mode!=="idle"},comments:E("comments",()=>rd(H)),trackChanges:E("trackChanges",()=>sd(H)),contentControls:E("contentControls",()=>gh(H)),zoom:E("zoom",Vc),fonts:E("fonts",ld),styles:E("styles",()=>Cd(H))};if(h){const Me=Fa();Yb({stage:"superdoc-ui-compute-state",atMs:Me,reason:c,startedAtMs:y,completedAtMs:Me,durationMs:Me-y,phaseMs:_,asyncReadSettlements:Tt.splice(0)})}return he},ea=c=>{const h=Ba(c);h&&a&&h!==a&&(n.clear(),r.clear()),h&&(a=h)};let Cs=null,ro=null,Li=null,Di=null,Oi=null,So=null,vi=!1;const Xa=()=>{if(ee||vi)return;vi=!0;const c=()=>{vi&&(vi=!1,!ee&&V())};typeof queueMicrotask=="function"?queueMicrotask(c):Promise.resolve().then(c)},Za=()=>{const c=Y();if(c!==Li&&(Di&&(Di(),Di=null),Li=c,!(!c||typeof c.subscribe!="function")))try{const h=c.subscribe(()=>Xa());typeof h=="function"&&(Di=h)}catch{Li=null}},Qa=()=>{const c=L();if(c!==Oi&&(So&&(So(),So=null),Oi=c,!(!c||typeof c.subscribe!="function")))try{const h=c.subscribe(()=>V());typeof h=="function"&&(So=h)}catch{Oi=null}};let Go=null,_o=null,Ja=null,yi=null,tc=null,Pi=null;const $c=()=>{const c=S()?.host,h=Lt(c?.getHandles?()=>c.getHandles():void 0,null)?.editing?.selection;return h&&typeof h.subscribe=="function"?h:null},kd=()=>{const c=j(),h=c?.readLiveSelectionSyncSnapshot;if(typeof h!="function")return!1;const y=qi(Lt(()=>h.call(c),null));if(!y||!$l(y))return!1;const _=Ys(y,"ready"),E=Gs(O.selection),F=Gs(_);if(E&&F&&E.blockId===F.blockId&&nr(E.story)===nr(F.story))return!1;const H=Xl(_),ie=O.toolbar.commands["font-family"]?.value,he=O.toolbar.commands["font-size"]?.value,Me=typeof ie=="string"&&ie.length>0,ze=typeof he=="string"&&he.length>0||typeof he=="number"&&Number.isFinite(he);return Me&&H.fontFamily===void 0||ze&&H.fontSize===void 0},ks=()=>{const c=$c();if(c!==Cs&&(ro&&(ro(),ro=null),Cs=c,!!c))try{const h=c.subscribe(y=>{Uo()&&kd()&&Ha()||(wo+=1,nd(y),V("host-selection"))});typeof h=="function"&&(ro=h)}catch{Cs=null}},Sd=()=>{const c=S()?.host,h=Lt(c?.getHandles?()=>c.getHandles():void 0,null)?.review;return h&&typeof h.subscribe=="function"?h:null},el=c=>c?typeof c.getActiveReviewTarget=="function"?Lt(()=>c.getActiveReviewTarget(),null):typeof c.getSnapshot=="function"?Lt(()=>c.getSnapshot(),null)?.activeReviewTarget??null:null:null;let Fi=0;const Ft=(c,h)=>{const y=(h&&typeof h=="object"?h:null)?.lastInteractionRejection;if(c==null&&y&&typeof y=="object"&&y.code==="review-target-invalidated"&&y.detail==="not-painted"&&et)return!1;const _=c&&typeof c=="object"?c:null;let E=null;if(_?.entityType==="trackedChange"&&typeof _.entityId=="string"&&_.entityId.length>0){const F=_.story&&typeof _.story=="object"?_.story:void 0,H=F&&nr(F)!==nr(null)?F:void 0,ie=typeof _.paintedEntityId=="string"&&_.paintedEntityId.length>0?_.paintedEntityId:null,he=ie??_.entityId,Me=(()=>{if(H){const qe=Mi(),Xe=qe?Fl(qe,H):null;return Xe?.toPublicId(he)??Xe?.toPublicId(_.entityId)??_.entityId}const Ne=Hs(Array.isArray(O?.trackChanges.items)?O.trackChanges.items:[]);return Ne.toPublicId(he)??Ne.toPublicId(_.entityId)??_.entityId})(),ze=ie??(he!==Me?he:null);E={id:Me,...H?{story:H}:{},...ze&&ze!==Me?{paintedEntityId:ze}:{}}}return c==null&&E==null&&et!=null&&I(et)||re(et,E)?!1:(N(E),!0)},Wn=()=>{const c=Sd();if(c===Go)return;if(_o&&(_o(),_o=null),Go=c,!c){Ft(null);return}let h=!0;try{const y=c.subscribe(_=>{const E=_&&typeof _=="object"?_:null,F=E&&Object.prototype.hasOwnProperty.call(E,"activeReviewTarget")?E.activeReviewTarget:el(c);!Ft(F,_)||h||V()});typeof y=="function"&&(_o=y),Ft(el(c))}catch{Go=null}finally{h=!1}},qr=()=>{if(Cs||qn()!=="viewing")return null;const c=S()?.mount?.container,h=(c&&typeof c=="object"&&"ownerDocument"in c?c.ownerDocument??null:null)??globalThis.document??null;return h&&typeof h.addEventListener=="function"?h:null},Qn=()=>{const c=qr();if(c===tc||(Pi&&(Pi(),Pi=null),tc=c,!c))return;const h=()=>{wo+=1,V()};c.addEventListener("selectionchange",h),c.addEventListener("pointerup",h,!0),c.addEventListener("mouseup",h,!0),Pi=()=>{c.removeEventListener("selectionchange",h),c.removeEventListener("pointerup",h,!0),c.removeEventListener("mouseup",h,!0)}};pi(),Ft(el(Sd())),O=Lo("initial"),a=Ba(O.selection);const D=()=>{const c=S()?.host?.events,h=c&&typeof c.subscribe=="function"?c:null;if(h!==Ja&&(yi&&(yi(),yi=null),Ja=h,!!h))try{const y=h.subscribe(_=>{const E=_?.type;if(E==="review-mutation:started"){cn(_.reviewMutation?.token);return}if(E==="review-mutation:aborted"){pn(_.reviewMutation?.token),$t();return}if(E==="mutation:rejected"&&_.reviewMutation&&(pn(_.reviewMutation.token),$t()),E==="mutation:committed"&&_.reviewMutation&&pn(_.reviewMutation.token),E==="source:complete"||E==="source:signals-complete"){Wr=xe(),Gi();return}if((E==="mutation:committed"||E==="collaboration:remote-changed")&&(pt=Date.now()),E==="mutation:committed"||E==="save:completed"||E==="collaboration:remote-changed"){const F=E==="mutation:committed"?OS(_):null;if(F?.allResolved){ao([]),Tn(_.receipt);return}F?.removedIds.size&&Vt(new Set(F.removedIds),_.receipt);const H=E==="mutation:committed"&&eo(_)||E==="collaboration:remote-changed"&&Array.isArray(_.changedStoryIds)&&_.changedStoryIds.length>0;if(H&&(dt=Date.now()),E==="mutation:committed"&&H){$a();return}if(F?.removedIds.size&&F.upsertIds.size===0)return;(E==="collaboration:remote-changed"||E==="mutation:committed"&&!H)&&Ua();const ie=E==="collaboration:remote-changed"&&Array.isArray(_.changedPartUris)&&_.changedPartUris.some(Me=>typeof Me=="string"&&BU.has(Me)),he=E==="collaboration:remote-changed"&&Array.isArray(_.changedStoryIds)&&_.changedStoryIds.length>0&&za();ie&&!H&&(Cn=!0),Wa(),ie&&!H?Qo("comments"):he&&(Cn=!0,Er()),V()}});typeof y=="function"&&(yi=y)}catch{Ja=null}},V=(c="unspecified")=>{if(ee)return;const{sink:h}=Xm(),y=h?Fa():0;vi=!1,pi(),ks(),Za(),Qa(),Wn(),Qn(),D();const _=Lo(c);ea(_.selection),O=_;let E=0,F=0;for(const H of[...q]){if(!h){H(O);continue}const ie=Fa();H(O);const he=Fa()-ie;E+=he,F=Math.max(F,he)}if(h){const H=Fa();Yb({stage:"superdoc-ui-recompute",atMs:H,reason:c,startedAtMs:y,completedAtMs:H,durationMs:H-y,listenerCount:q.size,listenerTotalMs:E,listenerMaxMs:F})}},be=[],Pe=[],ft=[],Wt=c=>{for(const h of c)try{h()}catch{}},sn=()=>Wt(be),Rn=()=>Wt(Pe),Pn=()=>Wt(ft),Hn=[];((c,h)=>{if(!(!c||typeof c.on!="function"))for(const y of h){const _=y==="active-editor-change"?()=>{sn(),Rn(),V()}:y==="document-replaced"?E=>{const F=E&&typeof E=="object"?E:null,H=F?.editor,ie=F?.host,he=!!H&&H===S(),Me=!!ie&&ie===j();!he&&!Me||(Rn(),P.clear(),Wa(),V())}:y==="document-mode-change"?()=>{V(),Pn()}:()=>V();try{c.on(y,_),Hn.push(()=>{try{typeof c.off=="function"&&c.off(y,_)}catch{}})}catch{}}})(t,LU),ks(),Za(),Qa(),Wn(),Qn(),D();const Sn=(c,h=mU)=>({get:()=>c(O),subscribe:y=>{let _=c(O);const E=F=>{const H=c(F);h(_,H)||(_=H,y(H))};return q.add(E),()=>q.delete(E)}}),Mn=c=>Sn(c),Do=c=>{const h=y=>{const _=F=>{try{y(F)}catch{}},E=c.subscribe(_);return _(c.get()),E};return{get:()=>c.get(),getSnapshot:()=>c.get(),observe:h,subscribe:y=>h(_=>y({snapshot:_}))}},ta=(c,h,y)=>{const _=Do(c),E=Do(h),F=H=>{const ie=ja(y);V();const he=E.observe(H);return()=>{he(),ie()}};return{get:_.get,getSnapshot:_.getSnapshot,observe:F,subscribe:H=>F(ie=>H({snapshot:ie}))}};function ni(c){return c&&typeof c=="object"&&typeof c.id=="string"?String(c.id):null}function tl(c){const h=hs(c);return h&&nr(h)!==nr(null)?h:void 0}function na(c,h){return{kind:"id",id:c,...h?{story:h}:{}}}function a2(c){if(c.empty)return null;const h=c.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),F=Math.max(y.offset,_.offset),H=hs(c);return{kind:"range",coordinateSpace:h.coordinateSpace==="tracked"?"tracked":"visible",range:{kind:"text",...H?{story:H}:{},segments:[{blockId:y.blockId,range:{start:E,end:F}}]}}}function l2(c,h){if(nr(h)!==nr(null))return;const y=b()?.trackChanges,_=y?.list;if(typeof _!="function")return;const E=Lt(()=>_.call(y),null);if(Fr(E)||!E||typeof E!="object")return;const F=E.items;if(Array.isArray(F))return F.map(Zu).find(H=>H!=null&&Ei(H,c,h))}function ig(c,h){const y=_h(c.quotedText);if(!y)return!1;const _=Qu(h);return[_.insertedText,_.deletedText,_.excerpt].some(E=>_h(E)===y)}function _h(c){return typeof c=="string"?c.replace(/\s+/g," ").trim():""}function c2(){const c=O.selection.activeChangeIds[0];if(!c)return"unavailable";const h=hs(O.selection),y=(O.trackChanges.status==="ready"?O.trackChanges.items.find(H=>Ei(H,c,h)):void 0)??l2(c,h)??Mi()?.find(H=>Ei(H,c,h));if(!y)return"unavailable";const _=Qu(y),E=_.type,F=_.grouping;return ig(O.selection,y)?"id":E==="replacement"&&F==="replacement-pair"||(E==="insertion"||E==="deletion"||E==="insert"||E==="delete")&&F==="standalone"?"range":"id"}function sg(c,h,y,_){const E=()=>v2(c,na(y,_),y,_);try{const F=v2(c,h,y,_);if(Fr(F))return Bn(Promise.resolve(F).then(ie=>xo(Ws(ie))?ie:E()));const H=Ws(F);return Bn(xo(H)?F:E())}catch{return!1}}function ag(c){if(typeof c=="string"&&c.length>0)return{target:{kind:"id",id:c},changeId:c};if(c&&typeof c=="object"){const h=c;if(h.target&&typeof h.target=="object"){const _=h.target;return{target:_,changeId:ni(_),story:_.story}}const y=typeof h.changeId=="string"?h.changeId:h.id;if(typeof y=="string"&&y.length>0)return{target:na(y,h.story),changeId:y,story:h.story}}return null}function u2(c,h){if(c.scope==="all")return{target:{kind:"all"},changeId:null};const y=ag(h);if(y)return y;const _=O.selection.activeChangeIds[0],E=tl(O.selection);return _?{target:na(_,E),changeId:_,story:E}:null}function d2(c,h){if(c.scope==="id"&&h==null){if(O.selection.activeChangeIds.length>1)return Kc(c.kind,{kind:"ids",ids:O.selection.activeChangeIds},null);if(O.selection.activeChangeIds.length===1&&!O.selection.empty&&O.selection.selectionTarget){const _=c2();if(_==="unavailable")return!1;if(_==="range"){const E=a2(O.selection),F=tl(O.selection);return E?sg(c.kind,E,O.selection.activeChangeIds[0],F):!1}if(_==="id"){const E=O.selection.activeChangeIds[0],F=hs(O.selection),H=F&&nr(F)!==nr(null)?F:void 0;return xh(c.kind,H?{id:E,story:H}:E)}}}const y=u2(c,h);return y?Kc(c.kind,y.target,y.changeId,y.story):!1}function Ah(c,h){const y=Y()?.lists,_=y?.apply;if(typeof _!="function")return!1;const{behavior:E,preset:F,continuity:H}=typeof h=="string"?PU(h):h&&typeof h=="object"?h:{},ie={kind:c,behavior:E??"toggle"};F!==void 0&&(ie.preset=F),H!==void 0&&(ie.continuity=H);try{return Bn(_.call(y,ie))}catch{return!1}}let Fn=Promise.resolve(!1),ri=null,_d=Promise.resolve(!1);const Gc=async c=>{if(!Jm(c))return c;const h=S()?.documentMutationReadiness,y=h?.whenPainted;if(typeof y!="function")return c;const _=typeof c.txId=="string"?c.txId:void 0;try{await y.call(h,_?{txId:_}:void 0)}catch{}return c},oi=c=>{if(Fr(c)){const y=Promise.resolve(c);return{immediate:!0,committed:y.then(_=>Ws(_),()=>!1),settled:y.then(_=>Gc(Ws(_)),()=>!1)}}const h=Ws(c);return{immediate:h,committed:Promise.resolve(h),settled:Gc(h)}},lg=()=>{const c=s.shift();if(!c){u=!1,f?.(),f=null;return}try{c.resolve(ee?!1:c.mutate())}catch{c.resolve(!1)}},Ih=()=>{let c=!1;return()=>{c||(c=!0,lg())}},cg=(c,h)=>{if(!u){u=!0,d=new Promise(F=>{f=F});try{return{result:h(),release:Ih()}}catch(F){throw u=!1,f?.(),f=null,F}}const y=s.find(F=>F.key===c);if(y)return y.mutate=h,{result:y.result,release:()=>{}};let _;const E=new Promise(F=>{_=F});return s.push({key:c,mutate:h,result:E,resolve:_}),{result:E,release:Ih()}},f2=new Set(["create.tableOfContents"]),ug=c=>Xn(`Tracked authoring is not supported for ${c}.`),ra=c=>{if(qn()==="suggesting")return f2.has(c)?ug(c):{changeMode:"tracked"}},Ad=()=>qn()==="suggesting"?mH:i2,Yr=(c,h,y)=>{const _=ra(c);return _&&_.success===!1?_:_?h(y,_):h(y)},Rt=(c,h,y,_)=>{const E=c.inline;if(!E)return;const F=Ws(_);if(F===!1||typeof F=="object"&&F&&F.success===!1)return;if(E.kind==="clear"){n.clear();return}if(E.kind==="toggle"||!e2(E.key))return;const H=Ba(h);if(!H)return;const ie=nH(E.key,y.value);if(ie==null){n.delete(E.key);return}n.set(E.key,{selectionSignature:H,value:ie})},Ut=(c,h,y,_)=>!c.inline||c.inline.kind==="toggle"?_:Fr(_)?Promise.resolve(_).then(E=>(Rt(c,h,y,E),E)):_,yn=(c,h,y,_)=>{if(c.inline?.kind!=="toggle"||!xo(Ws(_))||typeof y.value!="boolean"&&y.value!==null)return null;const E=Ba(h);if(!E)return null;const F=++l;return r.set(c.id,{selectionSignature:E,active:y.value===!0,generation:F,settled:!1}),V(),F},xr=(c,h,y)=>{if(h==null)return;const _=r.get(c.id);if(!(!_||_.generation!==h)){if(!xo(y)){r.delete(c.id);return}_.settled=!0}},Rr=(c,h)=>c.then(y=>(h?.(y),Vl(),y),()=>(h?.(!1),Vl(),!1)),Bn=(c,h)=>{const y=ri;if(ri=null,y)return Fn=Rr(y,h),Ws(c);if(Fr(c))return Fn=Rr(oi(c).settled,h),!0;const _=Ws(c);return Jm(_)&&typeof S()?.documentMutationReadiness?.whenPainted=="function"?(Fn=Rr(Gc(_),h),_):(h?.(_),Fn=Promise.resolve(_),Vl(),_)},Ni=(c,h)=>!c||typeof c!="object"?h:c,Oo=(c,h=Xn("Document API operation failed."))=>{if(Fr(c))return Promise.resolve(c).then(_=>Oo(_,h),()=>h);const y=Ni(c,h);return Wa(),Jm(y)&&typeof S()?.documentMutationReadiness?.whenPainted=="function"?(Rr(Gc(y)),V(),y):(V(),y)},Id=(c,h,y,_)=>{const E=[],F=[];for(const H of y){const ie=_(H);if(ie)try{const he=oi(Yr(c,h,ie));E.push(he.immediate),F.push(he.settled)}catch{E.push(!1),F.push(Promise.resolve(!1))}}return ri=F.length?Promise.all(F).then(H=>Ti(H)):null,Ti(E)},n$=(c,h,y,_)=>{const E=[],F=[];for(const H of y){const ie=_(H);if(ie)try{const he=oi(Yr(c,h,ie));E.push(he.immediate),F.push(he.settled)}catch{E.push(!1),F.push(Promise.resolve(!1))}}return ri=F.length?Promise.all(F).then(H=>Ti(H)):null,Ti(E)},h2=(c,h,y,_=O.selection)=>{const E=ra(c);return E&&E.success===!1?E:_.selectionTarget?h(y,{...E,offsetSpace:"selection"}):E?h(y,E):h(y)},r$=(c,h,y,_)=>{const E=To(h,_);switch(c.kind){case"alignment":{const F=y;return F!=="left"&&F!=="center"&&F!=="right"&&F!=="justify"?null:{target:E,alignment:F}}case"spacing-line":{const F=typeof y=="number"?y:Number(y);return!Number.isFinite(F)||F<=0?null:{target:E,line:F,lineRule:"auto"}}case"style":if(y&&typeof y=="object"){const F=y.role;if(F&&typeof F=="object")return{target:E,role:F}}return typeof y!="string"||y.trim()===""?null:{target:E,styleId:y};case"direction":{const F=c.fixedValue;return F!=="ltr"&&F!=="rtl"?null:{target:E,direction:F}}default:return null}},o$=(c,h)=>{const y=c.inline,_=o2(c),E=j();if(!y||typeof E?.setPendingInlineFormat!="function")return!1;if(y.kind==="clear")return $(),!0;if(!_)return!1;let F;if(y.kind==="toggle")F=!ec(c,b(),O.selection);else{const H=h&&typeof h=="object"&&"value"in h?h.value:h;if(y.kind==="value-number"){const ie=typeof H=="number"?H:Number(H);F=Number.isFinite(ie)&&ie>0?ie:null}else F=typeof H=="string"&&H.trim()!==""?H:null;if(F===null)return W(_,null),!0}return W(_,F),!0},i$=()=>{const c=b(),{lockModesById:h}=qa(c?.contentControls,O.selection);if(Qs(h))return!1;const y=[],_=[],E=Xe=>{const We=oi(Xe);y.push(We.immediate),_.push(We.settled)},F=(Xe,We,Ge)=>{try{E(Ge?Xe(We,Ge):Xe(We))}catch{y.push(!1),_.push(Promise.resolve(!1))}},H=on().cache?.full.defaults.paragraphStyleId??pr,ie=Ju(O.selection);if(ie){const Xe=yr(c,"format.apply");if(Xe)try{E(h2("format.apply",Xe,{target:ie,inline:{...Ad()}}))}catch{y.push(!1),_.push(Promise.resolve(!1))}}const he=yr(c,"format.paragraph.resetDirectFormatting"),Me=yr(c,"styles.paragraph.setStyleRef"),ze=hs(O.selection),Ne=!ze||ze.storyType==="body",qe=yr(c,Ne?"lists.remove":"lists.removeInStory");for(const Xe of Nr(O.selection)){const We=To(Xe,ze);if(he&&F(he,{target:We}),qe)try{const Ge=Na(Xe),it=oi(qe(Ne?{target:Ge}:{target:Ge,story:ze}));_.push(it.settled.then(ut=>xo(ut)?ut:!0))}catch{}Me&&F(Me,{target:We,styleId:H})}if(!ie&&qn()!=="suggesting"){const Xe=yr(c,"format.paragraph.setMarkRunProps");if(Xe)for(const We of Nr(O.selection))F(Xe,{target:To(We,ze),markRunProps:{bold:!1,italic:!1,strikethrough:!1,doubleStrikethrough:!1,smallCaps:!1,caps:!1,verticalAlign:"baseline"}})}return ri=_.length?Promise.all(_).then(Xe=>Ti(Xe)):null,Ti(y.length?y:[!1])},s$=(c,h,y)=>{const _=Nr(O.selection);if(_.length===0)return!1;const E=hs(O.selection);return Id(c.docRoute,h,_,F=>r$(c.blockParagraph,F,y,E))},a$=(c,h,y)=>{const _=b(),E=yr(_,"format.paragraph.setIndentation"),F=yr(_,"format.paragraph.clearIndentation"),H=c.list?.mode,ie=fs(O.selection),he=hs(O.selection),Me=async ze=>{const Ne=await ct(_,ze,ie);if(Ne===!0)return{kind:"list",routeToCall:c.docRoute,opToCall:h,input:{target:EI(ze)}};if(Ne===null||he&&he.storyType!=="body"&&typeof _?.getNode!="function")return null;const qe=await yt(_,ze,he),Xe={};if(qe?.right!=null&&(Xe.right=qe.right),qe?.firstLine!=null&&(Xe.firstLine=qe.firstLine),qe?.hanging!=null&&(Xe.hanging=qe.hanging),H==="indent")return E?{kind:"paragraph",routeToCall:"format.paragraph.setIndentation",opToCall:E,input:{target:To(ze,he),left:Math.max(0,qe?.left??0)+TI,...Xe}}:null;const We=Math.max(0,(qe?.left??0)-TI);return We>0&&(Xe.left=We),Object.keys(Xe).length===0?F?{kind:"paragraph",routeToCall:"format.paragraph.clearIndentation",opToCall:F,input:{target:To(ze,he)}}:E?{kind:"paragraph",routeToCall:"format.paragraph.setIndentation",opToCall:E,input:{target:To(ze,he),left:0}}:null:E?{kind:"paragraph",routeToCall:"format.paragraph.setIndentation",opToCall:E,input:{target:To(ze,he),...Xe}}:null};return ri=(async()=>{const ze=await Promise.all(y.map(We=>Me(We).catch(()=>null)));if(ze.length===y.length&&ze.every(We=>We?.kind==="list")&&qn()!=="suggesting"){const We=H==="indent"?"lists.indentRange":"lists.outdentRange",Ge=yr(_,We);if(Ge)try{return await oi(Yr(We,Ge,{paraIds:y,story:ie})).settled}catch{return!1}}const Ne=ie.storyType!=="body"&&ze.some(We=>We?.kind==="list"),qe=Ne&&H==="outdent"?yr(_,"lists.outdentInStory"):null;if(Ne&&!qe)return!1;const Xe=ze.map(We=>{if(!We)return Promise.resolve(!1);try{return We.kind==="list"&&qe?oi(Yr("lists.outdentInStory",qe,{target:We.input.target,story:ie})).settled:oi(Yr(We.routeToCall,We.opToCall,We.input)).settled}catch{return Promise.resolve(!1)}});return Ti(await Promise.all(Xe))})(),!0},l$=(c,h)=>{const y=c.list,_=b(),E=Nr(O.selection);if(E.length===0)return!1;const F=fs(O.selection),H=F.storyType==="body";if(y.mode==="indent"||y.mode==="outdent")return a$(c,h,E);const ie=y.seed,he=Ne=>{if(Ne.some(ut=>!ut.resolved))return{immediate:!1,settled:null};const qe=Ne.every(ut=>ut.seed===ie);if(!qe&&!H)return{immediate:!1,settled:null};const Xe=qe?H?"lists.remove":"lists.removeInStory":c.docRoute,We=qe?yr(_,Xe):h;if(!We)return{immediate:!1,settled:null};const Ge=[],it=[];return E.forEach((ut,Ke)=>{if(!qe&&Ne[Ke]?.seed===ie)return;const _t=qe?{target:Na(ut),...H?{}:{story:F}}:{target:Na(ut),seed:ie};try{const It=oi(Yr(Xe,We,_t));Ge.push(It.immediate),it.push(It.settled)}catch{Ge.push(!1),it.push(Promise.resolve(!1))}}),{immediate:Ti(Ge),settled:it.length?Promise.all(it).then(ut=>Ti(ut)):null}},Me=E.map(Ne=>nt(_,Ne,F));if(Me.some(Fr))return ri=Promise.all(Me).then(async Ne=>{const qe=he(Ne);return qe.settled?await qe.settled:qe.immediate}),!0;const ze=he(Me);return ri=ze.settled,ze.immediate};function Eh(c){return c&&typeof c=="object"?c:{}}function c$(c){if(typeof c=="string")return c;const h=Eh(c);if(Object.prototype.hasOwnProperty.call(h,"href"))return h.href;if(Object.prototype.hasOwnProperty.call(h,"value"))return h.value}function u$(c,h){const y=Eh(c).text;return typeof y=="string"&&y.trim()!==""?y:h}function WI(c){const h=Eh(c),y=h.capture&&typeof h.capture=="object"?h.capture:null;return h.target??y?.target??y?.selectionTarget??h.selectionTarget??h.textTarget??null}const d$=c=>{const h=b(),y=h?.hyperlinks;if(!y)return!1;const _=Eh(c),E=c$(c),F=WI(c),H=typeof _.text=="string"?_.text:void 0,ie=typeof _.currentText=="string"?_.currentText:void 0,he=ph(_.hyperlinkTarget)?_.hyperlinkTarget:null,Me=ph(_.textTarget)?_.textTarget:null,ze=Jl(h,O.selection),Ne=typeof he?.storyId=="string"&&typeof he?.hyperlinkNodeId=="string";if(Ne&&E===null){const qe=y.remove;if(typeof qe!="function")return!1;try{return Yr("hyperlinks.remove",qe,{storyId:he.storyId,hyperlinkNodeId:he.hyperlinkNodeId,keepText:!0})}catch{return!1}}if(ze&&E===null){const qe=y.remove;if(typeof qe!="function")return!1;try{return Yr("hyperlinks.remove",qe,{target:ze.address,mode:"unwrap"})}catch{return!1}}if((ze||he)&&typeof E=="string"&&E.trim()!==""){const qe=y.patch,Xe=y.updateTarget;if(!(!Ne&&ze&&typeof qe=="function")&&!(Ne&&typeof Xe=="function"))return!1;const We=typeof H=="string"&&H!==(Ne?ie:ze?.text??ie),Ge=h?.text?.replace,it=We?Ne?Me:cH(ze?.address):null,ut=We&&!!it&&typeof Ge=="function";if(We&&!ut)return!1;const Ke=[],_t=[];let It=null,_n=null,An=null,Sr=!1;try{if(Ne){if(typeof Xe!="function")return!1;const Mr=Yr("hyperlinks.updateTarget",Xe,{storyId:he.storyId,hyperlinkNodeId:he.hyperlinkNodeId,newTarget:uH(E)});Sr=Fr(Mr);const Lr=oi(Mr);if(!xo(Lr.immediate))return!1;Ke.push(Lr.immediate),_t.push(Lr.settled),It=Lr.immediate,_n=Lr.committed,An=Lr.settled}else if(ze){if(typeof qe!="function")return!1;const Mr=Yr("hyperlinks.patch",qe,{target:ze.address,patch:{href:E}});Sr=Fr(Mr);const Lr=oi(Mr);if(!xo(Lr.immediate))return!1;Ke.push(Lr.immediate),_t.push(Lr.settled),It=Lr.immediate,_n=Lr.committed,An=Lr.settled}}catch{return!1}if(ut){const Mr=(Br,ii)=>xo(ii)?Ti([Br,ii]):xo(Br)?lh(Br,ii):ii,Lr=Br=>{if(!xo(Br))return Br;try{const ii=oi(Yr("text.replace",Ge,{target:it,text:H}));return xo(ii.immediate)?Promise.all([An??Promise.resolve(Br),ii.settled]).then(([C2,Y$])=>Mr(C2,Y$)):lh(Br,ii.immediate)}catch{return lh(Br,!1)}};if(Sr)return ri=(_n??Promise.resolve(It??!1)).then(Lr),Ti(Ke);try{const Br=oi(Yr("text.replace",Ge,{target:it,text:H}));if(!xo(Br.immediate))return It?lh(It,Br.immediate):Br.immediate;Ke.push(Br.immediate),_t.push(Br.settled),ri=Promise.all([An??Promise.resolve(It??!1),Br.settled]).then(([ii,C2])=>Mr(ii,C2))}catch{return It?lh(It,!1):!1}}return!ut&&_t.length>0&&(ri=Promise.all(_t).then(Mr=>Ti(Mr))),Ti(Ke)}if(typeof E=="string"&&E.trim()!==""){const qe=E.trim(),Xe=y.wrap,We=JU(F),Ge=We.length>0?We:Jb(O.selection);if(Ge.length>0){if(typeof Xe!="function")return!1;try{return n$("hyperlinks.wrap",Xe,Ge,_t=>({target:_t,link:{destination:{href:qe}}}))}catch{return!1}}const it=y.insert,ut=u$(c,qe);if(typeof it!="function"||ut.trim()==="")return!1;const Ke=fh(F)??Gs(O.selection);if(!Ke)return!1;try{return Yr("hyperlinks.insert",it,{target:Ke,text:ut,link:{destination:{href:qe}}})}catch{return!1}}return!1},f$=(c,h,y)=>{const _=c.create.kind,E=y&&typeof y=="object"?y:{};if(_==="table"){const H=Number(E.rows??E.rowCount),ie=Number(E.columns??E.cols??E.colCount);if(!Number.isInteger(H)||H<1||!Number.isInteger(ie)||ie<1)return!1;const he=Gs(O.selection),Me=he&&typeof he.blockId=="string"?{kind:"inParagraph",target:To(he.blockId),offset:he.range?.start??0}:n2(O.selection,"nodeId");try{return Yr(c.docRoute,h,{rows:H,columns:ie,at:Me})}catch{return!1}}if(_==="image"){const H=E.src??E.value;if(typeof H!="string"||H.trim()==="")return!1;const ie=Gs(O.selection),he=fs(O.selection),Me=he.storyType==="body"?null:he;let ze;ie&&typeof ie.blockId=="string"?ze={kind:"inParagraph",target:To(ie.blockId,Me),offset:ie.range?.start??0}:(ze=n2(O.selection,"target"),Me&&ze.kind==="after"&&(ze={...ze,target:{...ze.target,story:Me}}));const Ne={src:H,at:ze};Me&&(Ne.in=ze.kind==="inParagraph"?Z(Me)??Me:Me),typeof E.alt=="string"&&(Ne.alt=E.alt),typeof E.title=="string"&&(Ne.title=E.title),E.size&&typeof E.size=="object"&&(Ne.size=E.size);try{return Yr(c.docRoute,h,Ne)}catch{return!1}}const F={at:n2(O.selection,"target")};typeof E.instruction=="string"&&(F.instruction=E.instruction),E.config&&typeof E.config=="object"&&(F.config=E.config);try{return Yr(c.docRoute,h,F)}catch{return!1}},h$=(c,h)=>{const y=c.table,_=Fe();if(!_||y.requiresCell&&!_.cellNodeId)return!1;const E=yH(y.action,_);if(!E)return!1;try{if(y.action==="insert-row-before"||y.action==="insert-row-after"){const F=j(),H=(typeof F?.getHandles=="function"?F.getHandles():null)?.editing?.tables;if(typeof H?.insertRow!="function")return!1;const ie=ra(c.docRoute);return ie&&ie.success===!1?ie:ie?H.insertRow(E,ie):H.insertRow(E)}if(y.action==="insert-column-before"||y.action==="insert-column-after"){const F=j(),H=(typeof F?.getHandles=="function"?F.getHandles():null)?.editing?.tables;if(typeof H?.insertColumn!="function")return!1;const ie=ra(c.docRoute);return ie&&ie.success===!1?ie:ie?H.insertColumn(E,_.rowIndex,ie):H.insertColumn(E,_.rowIndex)}return Yr(c.docRoute,h,E)}catch{return!1}},p$=c=>!c||c.disposition!=="routed"?!1:!!(c.inline||c.blockParagraph||c.list||c.link||c.create),m$=c=>{const h=Eh(c);return!!(WI(c)||ph(h.hyperlinkTarget)||ph(h.textTarget))},g$=(c,h,y)=>O.selection.status!=="ready"?!1:tg(c)?.scope==="id"||!h||h.disposition!=="routed"?!0:h.inline?.kind==="clear"?Nr(O.selection).length>0||Ju(O.selection)!=null:h.inline?Ju(O.selection)!=null||Nr(O.selection).length>0:h.blockParagraph||h.list?Nr(O.selection).length>0:h.link?m$(y)||Jb(O.selection).length>0||Gs(O.selection)!=null||ec(h,b(),O.selection):!0,v$=(c,h)=>{const y=tg(c),_=Gu(c);return y?.scope==="id"&&ag(h)||y?.scope!=="id"&&!p$(_)?!1:!g$(c,_,h)},y$=(c,h)=>v$(c,h)?Gl().then(()=>{}):null,Wc=(c,h,y)=>{if(ri=null,Fn=Promise.resolve(!1),ee)return!1;const _=Ze.get(c);if(_)try{const Ne=_.execute(mi(h,y));return Bn(Ne)}catch{return!1}const E=wI(c);if(E){if(qn()==="viewing")return!1;if(typeof Y()?.lists?.apply=="function")return Ah(E,h)}const F=tg(c);if(F)return d2(F,h);if(c==="copy-format")return Bn(b$());const H=Gu(c);if(!H||H.disposition!=="routed")return!1;const ie=H.normalizePayload?H.normalizePayload(h):h;if(H.instanceRoute){if(!S()||!kr(H,ie))return!1;const Ne=t?.[H.instanceRoute];if(typeof Ne!="function")return!1;try{const qe=H.fixedArg!==void 0?H.fixedArg:ie,Xe=Ne.call(t,qe);return Bn(Xe)}catch{return!1}}if(H.inline?.kind==="clear")return H.mutates&&qn()==="viewing"?!1:Bn(i$());const he=H.docRoute;if(!he||H.mutates&&qn()==="viewing")return!1;const Me=b(),ze=yr(Me,he);if(!ze)return!1;if(H.inline){const{lockModesById:Ne}=qa(Me?.contentControls,O.selection);if(Qs(Ne))return!1;const qe=Ju(O.selection);if(!qe)return O.selection.empty===!1?Bn(!1):Bn(o$(H,ie));const Xe=ec(H,Me,O.selection),We=gH(H.inline,qe,ie,Xe);if(!We)return!1;let Ge=null;try{const it=S(),ut=qn(),Ke=()=>S()!==it||b()!==Me||qn()!==ut?!1:h2(he,ze,We),_t=Ba(O.selection)??Rc(O.selection),It=H.inline.kind==="toggle"?cg(`${H.id}:${_t}`,Ke):null;Ge=It?.release??null;const _n=It?It.result:Ke(),An=yn(H,O.selection,We,_n),Sr=Ut(H,O.selection,We,_n),Mr=Bn(Sr,Lr=>{xr(H,An,Lr),Ge?.(),Ge=null});return H.inline.kind==="toggle"&&(_d=Fn),Mr}catch{return Ge?.(),!1}}if(H.blockParagraph){const Ne=s$(H,ze,ie),qe=H.blockParagraph.kind==="alignment"&&xo(Ne)?Re(O.selection,ie):null;return Bn(Ne,Xe=>{rt(qe,Xe)})}if(H.list){const Ne=l$(H,ze);return Bn(Ne)}if(H.link){const Ne=d$(ie);return Bn(Ne)}if(H.create){const Ne=f$(H,ze,ie);return Bn(Ne)}if(H.table){const Ne=h$(H,ze);return Bn(Ne)}try{return Bn(H.mutates?Yr(he,ze,ie):ze(ie))}catch{return!1}},dg=()=>{g+=1,p={mode:"idle",snapshot:null,sourceSelectionKey:null,lastClickAt:p.lastClickAt,pointerSelecting:!1,keyboardSelecting:!1};for(const c of m)c("idle");V()},b$=async()=>{const c=["bold","italic","underline","strikethrough"].filter(ze=>O.toolbar.commands[ze]?.active===!0),h=await _d;await d;const y=xo(h)?c:[],_=500,E=Date.now();if(p.mode!=="idle"){if(p.mode==="armed"&&E-p.lastClickAt<_){p={...p,mode:"persistent",lastClickAt:E};for(const ze of m)ze("persistent");return V(),!0}return dg(),!1}const F=E-p.lastClickAt<_,H=++g;p={...p,lastClickAt:E};const ie=await Gl(),he=`${Rc(ie)}:${xe()}`,Me=await w$(null,ie,he&&he===C?v:void 0,y);if(H!==g)return!0;p={...p,mode:F?"persistent":"armed",snapshot:Me,sourceSelectionKey:Rc(ie),lastClickAt:E};for(const ze of m)ze(p.mode);return V(),!0},w$=async(c,h,y,_=[])=>{const E=h?.target??c?.target;if(!E||E.kind!=="text")return null;const F=Array.isArray(E.segments)?E.segments:[];if(F.length===0)return null;const H=b();if(!H)return null;const ie=E.story;let he=null;for(const We of F){const Ge=(await Zs(To(We.blockId,ie)))?.node??null;if(!Ge)continue;const it=p2(Ge),ut=Array.isArray(it?.inlines)?it.inlines:[],Ke=C$(ut,We.range);he?he=KI(he,Ke):he=Ke}const Me=he?gU(he):{},ze={bold:"bold",italic:"italic",underline:"underline",strikethrough:"strike"},Ne=new Set([...h?.activeMarks??(Array.isArray(c?.activeMarks)?c.activeMarks:[]),..._]);for(const[We,Ge]of Object.entries(ze))Ne.has(We)&&(Me[Ge]=!0);const qe=y??await gd(h??Ys(c,"ready"));if(qe.fontFamily&&(Me.fontFamily=qe.fontFamily),qe.color&&(Me.color=qe.color),qe.highlight&&(Me.highlight=qe.highlight),qe.fontSize){const We=Number.parseFloat(qe.fontSize);Number.isNaN(We)||(Me.fontSize=We)}let Xe=null;if(F.length===1){const We=F[0],Ge=(await Zs(To(We.blockId,ie)))?.node??null;Ge&&p2(Ge)&&(Xe=await k$(Ge,We.blockId,H,ie))}return{story:ie??null,inline:Me,paragraph:Xe}},p2=c=>c?c.kind==="paragraph"?c.paragraph??null:c.kind==="heading"?c.heading??null:null:null,C$=(c,h)=>{const y=H=>{const ie=H.run;return typeof ie?.text=="string"?ie.text:""},_=H=>H.run?.props;if(h.start===h.end){let H=0;for(const ie of c){const he=y(ie),Me=H,ze=H+he.length;if(H=ze,h.start>=Me&&h.start<=ze){const Ne=_(ie);return Ne?{...Ne}:{}}}return{}}let E=0;const F=[];for(const H of c){const ie=y(H),he=E,Me=E+ie.length;if(E=Me,Me<=h.start||he>=h.end)continue;const ze=_(H);ze&&F.push(ze)}return F.length===0?{}:F.length===1?{...F[0]}:KI(F[0],...F.slice(1))},KI=(c,...h)=>{const y={...c};for(const _ of h)for(const E of Object.keys(y)){if(!(E in _)){delete y[E];continue}const F=y[E],H=_[E];(typeof F!=typeof H||JSON.stringify(F)!==JSON.stringify(H))&&delete y[E]}return y},k$=async(c,h,y,_)=>{const E=p2(c),F=E.props??{},H=E.styleRef??null,ie=F.alignment??null,he=F.spacing??null,Me=F.indent??null,ze=Me?{...Me.left!=null?{left:Me.left}:{},...Me.right!=null?{right:Me.right}:{},...Me.firstLine!=null?{firstLine:Me.firstLine}:{},...Me.hanging!=null?{hanging:Me.hanging}:{}}:null,Ne=F.markRunProps??null,qe=F.numbering?.numId,Xe=typeof qe=="string"?parseInt(qe,10):typeof qe=="number"?qe:NaN,We=F.numbering?.level,Ge=isNaN(Xe)?null:{numId:Xe,...We!=null?{level:We}:{}};let it=null;if(Ge&&typeof y.lists?.getState=="function")try{const ut=await y.lists.getState({target:To(h,_)});ut&&typeof y.lists?.getStyle=="function"&&(it=await y.lists.getStyle(ut)??null)}catch{}return{styleId:H,alignment:ie,spacing:he,indentation:ze,markRunProps:Ne,numbering:Ge,listStyle:it}},qI=async()=>{if(p.mode==="idle"||p.pointerSelecting||p.keyboardSelecting)return;const c=b()?.selection,h=async()=>{const H=typeof c?.current=="function"?await Promise.resolve(c.current({includeText:!0})):Ka().value;return qi(H)},y=()=>new Promise(H=>setTimeout(H,16)),_=8;let E=null,F="";for(let H=0;H<_;H+=1){if(H>0&&await y(),p.mode==="idle"||p.pointerSelecting||p.keyboardSelecting)return;if(E=await h(),!(!E||E.empty)&&(F=Rc(E),F!==p.sourceSelectionKey))break}if(E&&!E.empty&&F!==p.sourceSelectionKey){await YI(E);return}if(p.snapshot?.paragraph){const H=await h();if(!H||Rc(H)===p.sourceSelectionKey)return;await YI(H)}},YI=async c=>{const h=p.snapshot;if(!h){p.mode==="armed"&&dg();return}const y=b();if(!y)return;const _=Ys(c,"ready"),{lockModesById:E}=qa(y.contentControls,_);if(Qs(E)){V();return}const F=c.target,H=c.selectionTarget;if(c.empty!==!0&&Object.keys(h.inline).length>0){const ie=yr(y,"format.apply");if(ie&&H)try{if(!xo(Ws(await Promise.resolve(h2("format.apply",ie,{target:H,inline:h.inline},c))))){V();return}}catch{V();return}}if(h.paragraph){const ie=Array.isArray(F?.segments)?F.segments:[],he=F?.story;for(const Me of ie){const ze=To(Me.blockId,he),Ne=await Zs(ze),qe=Ne?.node??null,Xe=Ne?.address??null;if(!qe)continue;const We={kind:"block",nodeType:Xe?.nodeType??qe.kind??"paragraph",nodeId:Me.blockId,...he&&typeof he=="object"?{story:he}:{}},{styleId:Ge,alignment:it,spacing:ut,indentation:Ke,markRunProps:_t,numbering:It,listStyle:_n}=h.paragraph;if(Ge&&await y.styles?.paragraph?.setStyle?.({target:We,styleId:Ge}),it&&await y.format?.paragraph?.setAlignment?.({target:We,alignment:it}),ut){const An=ut,Sr=An.lineRule??"auto",Mr=new Set(["auto","exact","atLeast"]).has(Sr)?Sr:"auto",Lr={...An.before!=null?{before:Math.round(An.before*20)}:{},...An.after!=null?{after:Math.round(An.after*20)}:{},...An.line!=null?{line:Math.round(Mr==="auto"?An.line*240:An.line*20),lineRule:Mr}:{}};await y.format?.paragraph?.setSpacing?.({target:We,...Lr})}if(Ke){const An={...Ke.left!=null?{left:$s(Ke.left)}:{},...Ke.right!=null?{right:$s(Ke.right)}:{},...Ke.firstLine!=null?{firstLine:$s(Ke.firstLine)}:{},...Ke.hanging!=null?{hanging:$s(Ke.hanging)}:{}};await y.format?.paragraph?.setIndentation?.({target:We,...An})}_t&&await y.format?.paragraph?.setMarkRunProps?.({target:We,markRunProps:_t}),It&&await y.format?.paragraph?.setNumbering?.({target:We,...It}),_n&&((await Zs(ze))?.address?.nodeType==="listItem"?await y.lists?.applyStyle?.({target:EI(Me.blockId,he),style:_n}):It&&await y.format?.paragraph?.setNumbering?.({target:We,...It}))}}p.mode==="armed"&&dg(),V()},fg=(c,h,y)=>{const _=y$(c,h),E=_?_.then(()=>(Wc(c,h,y),Fn)):(Wc(c,h,y),Fn);return Gu(c)?.inline?.kind==="toggle"&&(_d=E),E},XI=c=>({id:c,getState:()=>O.toolbar.commands[c]??ko(c,b(),O.selection,Mo(O.selection)),observe:h=>Sn(y=>y.toolbar.commands[c]??{enabled:!1,active:!1,supported:!1,source:"unsupported",reason:at.commandUnsupported}).subscribe(h),execute:h=>Wc(c,h),executeAsync:h=>fg(c,h)}),S$=c=>{Ze.set(c.id,c),V();const h=()=>{Ze.delete(c.id),V()};return Object.assign(h,{handle:XI(c.id),unregister:h})},hg=Mn(c=>c.selection),pg=Do(hg),ZI=()=>{const c=j();if(typeof c?.getHandles!="function")return{reason:at.hostCapabilityUnavailable};let h=null;try{h=c.getHandles()}catch(_){const E=_?.reason;return{reason:E==="host-not-ready"||E==="host-disposed"||E==="editing-mount-required"?at.notReady:at.hostCapabilityUnavailable}}const y=h?.editing?.selectionTargets;return typeof y?.apply!="function"?{reason:at.hostCapabilityUnavailable}:{helper:y}},_$=c=>{const h=j();if(typeof h?.getHandles=="function")try{const y=h.getHandles()?.editing?.contentControls;typeof y?.activate=="function"&&y.activate({id:c})}catch{}},QI={get:pg.get,getSnapshot:pg.getSnapshot,subscribe:pg.subscribe,observe:pg.observe,current:()=>Ka().value,capture:()=>{const c=hg.get();return c.empty||!c.target&&!c.selectionTarget?null:{...c,capturedAt:Date.now()}},restore:c=>{const h=E=>(V(),{...E,success:E.ok});if(!c||typeof c!="object")return h({ok:!1,reason:at.targetUnresolved});if(!S())return h({ok:!1,reason:at.notReady});const y=pH(c);if(!y)return h({ok:!1,reason:at.targetUnresolved});const _=ZI();if(!("helper"in _))return h({ok:!1,reason:_.reason});try{return h(bI(_.helper.apply(y)))}catch{return h({ok:!1,reason:at.hostCapabilityUnavailable})}},apply:c=>{if(!S())return{ok:!1,reason:at.notReady};const h=ZI();if(!("helper"in h))return{ok:!1,reason:h.reason};try{const y=h.helper.apply(c);return V(),bI(y)}catch{return{ok:!1,reason:at.hostCapabilityUnavailable}}},getAnchorRect:c=>{const h=j();if(typeof h?.getSelectionAnchorRect=="function"){const y=Lt(()=>h.getSelectionAnchorRect(c),null);return y&&typeof y=="object"&&(Number(y.width)>0||Number(y.height)>0)?y:null}return null},getRects:c=>{const h=hg.get(),y=h.selectionTarget??h.target;if(h.empty||!y)return[];const _=Ag.getRect({target:y,relativeTo:c?.relativeTo});return _.found?_.rects:[]}},A$={get ids(){return co()},has:c=>Gu(c)!=null||Ze.has(c),get:c=>XI(c),execute:Wc,executeAsync:fg,register:S$,getContextMenuItems:c=>{const h=[];for(const y of Ze.values()){const _=y.contextMenu;_&&Lt(_.when?()=>_.when(c):void 0,!0)&&h.push({id:y.id,label:_.label,group:_.group,order:_.order,invoke:()=>Wc(y.id,void 0,c)})}return h.sort((y,_)=>(y.order??0)-(_.order??0)||y.label.localeCompare(_.label))}},m2=Do(Mn(c=>c.toolbar)),I$={get:m2.get,getSnapshot:()=>O.toolbar,subscribe:m2.subscribe,observe:m2.observe,execute:Wc,executeAsync:fg},Ed=async(c,h)=>{if(!S())return{success:!1,ok:!1,reason:at.notReady};if(!c)return{success:!1,ok:!1,reason:at.targetUnresolved};const y=j(),_=y?.scrollTargetIntoView;if(typeof _!="function")return{success:!1,ok:!1,reason:at.hostCapabilityUnavailable};try{const E={target:c,block:h?.block??"center",behavior:h?.behavior??"smooth"},F=await Promise.resolve(h?.shouldContinue?_.call(y,E,h.shouldContinue):_.call(y,E));return F&&typeof F=="object"&&F.success===!1?{success:!1,ok:!1,reason:Zm(F.reason,at.targetUnresolved)}:{success:!0,ok:!0}}catch{return{success:!1,ok:!1,reason:at.hostCapabilityUnavailable}}},JI=c=>{if(!c||typeof c!="object")return null;const h=c,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,F=y?.insert??y?.delete??y?.format??_?.wordIdInsert??_?.wordIdDelete??E?.[0];return typeof F=="string"&&F.length>0?F:null},eE=async(c,h,y,_,E)=>{const F=await Ed(h,E);if(F.ok)return F;const H=T(),ie=H?.focusTrackedChange;if(typeof ie!="function")return F;const he=y||_?{commentId:c,...y?{trackedChangeStory:y}:{},..._?{importedId:_}:{}}:c;try{const Me=await Promise.resolve(ie.call(H,he));if(Me&&typeof Me=="object"&&Me.ok===!0)return{success:!0,ok:!0}}catch{}return F},mg=async(c,h,y,_)=>{const E=c==="trackChanges"?_?.story:void 0,F=c==="trackChanges"?_?.matchStory??E:void 0,H=Ke=>{if(!E||!Ke||typeof Ke!="object")return Ke;const _t=Ke,It=_t.address&&typeof _t.address=="object"?_t.address:null;return _t.story||It?.story?Ke:{..._t,story:E}},ie=c==="trackChanges"?kI:ch,he=y.find(Ke=>Ei(Ke,h,F)),Me=he&&typeof he=="object"?he:null,ze=c==="trackChanges"&&Me?.type==="move"&&(Me.subtype==="move-to"||Me.subtype==="move-from")?Me.subtype:null,Ne=ze&&typeof Me?.trackedChangeCanonicalId=="string"?Me.trackedChangeCanonicalId:h,qe=Ke=>{if(!ze)return c==="trackChanges"?kI(Ke,{preferStableBlock:!0}):ie(Ke);const _t=ch(Ke);if(_t?.kind!=="move")return null;const It=ze==="move-to"?_t.destination:_t.source;return Zb(It)?It:null},Xe=ie(he),We=c!=="trackChanges"||!ze&&Zb(ch(he));if(Xe&&We)return H(Xe);const Ge=b()?.[c],it=c==="comments"?{commentId:h}:{id:Ne,...E?{story:E}:{}},ut=Ge?.get;if(typeof ut!="function")return H(Xe);try{return H(qe(await Promise.resolve(ut.call(Ge,it)))??Xe)}catch{return H(Xe)}};function tE(c,h){if(Fc())return Xn("Comments are read-only.","DOCUMENT_READONLY");if(ed())return Xn("Resolving comments is disabled.","DOCUMENT_READONLY");const y=b()?.comments,_=y?.patch;if(typeof _!="function")return Xn("comments.patch is unavailable.");const E=Xn("comments.patch failed.");return Lt(()=>Oo(_.call(y,{commentId:c,status:h}),E),E)}const Th=()=>Fc()?Xn("Comments are read-only.","DOCUMENT_READONLY"):null,E$=(c,h)=>{const y=h&&typeof h=="object"?h:null;let _=Array.from(c);y?.includeResolved===!1&&(_=_.filter(he=>he.status!=="resolved"));const E=Number(y?.offset),F=Number.isInteger(E)&&E>0?E:0,H=Number(y?.limit),ie=Number.isInteger(H)&&H>=0?F+H:void 0;return _.slice(F,ie)},Td=Mn(c=>c.comments),gg=ta(Td,Sn(c=>Kl(c.selection,c.comments)),"comments"),T$={get:gg.get,getSnapshot:gg.getSnapshot,subscribe:gg.subscribe,observe:gg.observe,list:c=>{Wi();const h=Xi();return E$(h.value??Td.get().items,c)},getById:c=>{const h=Td.get().items.find(E=>$r(E)===c)??null;if(h)return h;const y=b()?.comments,_=Lt(y?.get?()=>y.get({commentId:c}):void 0,null);return Fr(_)?null:_},createFromCapture:(c,h)=>{const y=Th();if(y)return y;const _=b()?.comments,E=_?.create;if(typeof E!="function")return Xn("comments.create is unavailable.");const F=Xn("comments.create failed.");return Lt(()=>{const H=c&&typeof c=="object"?c.target??c.selectionTarget:null;return H==null?Xn("A range selection is required to comment.","NO_SELECTION"):Oo(E.call(_,{target:H,text:h.text}),F)},F)},createFromSelection:c=>{const h=Th();if(h)return h;const y=b()?.comments,_=y?.create;if(typeof _!="function")return Xn("comments.create is unavailable.");const E=hg.get(),F=E.target??E.selectionTarget;if(E.empty||!F)return Xn("A range selection is required to comment.","NO_SELECTION");const H=Xn("comments.create failed.");return Lt(()=>Oo(_.call(y,{target:F,text:c.text}),H),H)},reply:(c,h)=>{const y=Th();if(y)return y;const _=b()?.comments,E=_?.reply??_?.create;if(typeof E!="function")return Xn("comments.reply is unavailable.");const F=Xn("comments.reply failed.");return Lt(()=>Oo(E===_?.reply?E.call(_,{parentCommentId:c,text:h.text}):E.call(_,{parentCommentId:c,text:h.text}),F),F)},edit:(c,h)=>{const y=Th();if(y)return y;const _=b()?.comments,E=_?.patch;if(typeof E!="function")return Xn("comments.patch is unavailable.");const F=Xn("comments.patch failed.");return Lt(()=>Oo(E.call(_,{commentId:c,text:h.text}),F),F)},resolve:c=>tE(c,"resolved"),reopen:c=>tE(c,"active"),delete:c=>{const h=Th();if(h)return h;const y=b()?.comments,_=y?.delete??y?.remove;if(typeof _!="function")return Xn("comments.delete is unavailable.");const E=Xn("comments.delete failed.");return Lt(()=>Oo(_.call(y,{commentId:c}),E),E)},setActive:c=>{if(c==null)return lt=null,V(),!0;if(!S())return!1;const h=Td.get(),y=P.get("comments"),_=y?.token===xe()&&y.hasSettled&&Array.isArray(y.value)?y.value:null,E=_??h.items;if(!_&&h.listStatus!=="ready")return!1;const F=YU(E,c);return!F||!E.some(H=>$r(H)===F)?!1:(lt=F,V(),!0)},scrollTo:async c=>{if(!b())return{success:!1,ok:!1,reason:S()?at.documentApiUnavailable:at.notReady};const h=await mg("comments",c,Td.get().items);return h?Ed(h):{success:!1,ok:!1,reason:at.targetUnresolved}}},es=Mn(c=>c.trackChanges),g2=(c,h)=>{ms();const y=(Yn().value??es.get().items).map(Zu).filter(Ne=>Ne!=null&&$r(Ne)!==null);if(y.length===0)return null;const _=O.trackChanges.activeId,E=et?.id===_?et.story:void 0,F=y.filter(Ne=>dh(Ne)==null),H=E||F.length===0?y:F;let ie=_?H.findIndex(Ne=>Ei(Ne,_,E)):-1;ie===-1&&_&&E&&(ie=H.findIndex(Ne=>Ei(Ne,_)));const he=H[ie===-1?c>0?0:H.length-1:(ie+c+H.length)%H.length],Me=$r(he),ze=dh(he);return N(ze?{id:Me,story:ze}:{id:Me},h),V(),Me},nE=async c=>{const h=T(),y=h?.listTrackedChanges;if(typeof y=="function")try{await Promise.resolve(y.call(h,{mode:"visible-window",targetIds:[c],refreshReason:"ui-track-change-reveal-restamp",blocking:!0}))}catch{}};let rE=Promise.resolve();const x$=c=>{const h=ae;return rE.catch(()=>{}).then(()=>R$(c,h))},R$=async(c,h)=>{if(ae!==h)return{success:!1};const y=et,_=g2(c,{invalidateQueuedNavigation:!1});if(_==null)return{success:!1};const E=et,F=Et,H=()=>ae===h&&et===E&&Et===F,ie=()=>{H()&&(N(y,{invalidateQueuedNavigation:!1}),V())};E&&He.add(E);try{const he=await mg("trackChanges",_,es.get().items,E?.story?{story:E.story}:void 0);if(!H())return{success:!1};if(!he)return ie(),{success:!1};const Me=es.get().items.find(Ne=>Ei(Ne,_,E?.story))??es.get().items.find(Ne=>$r(Ne)===_),ze=JI(Me);Fi+=1;try{const Ne=await eE(_,he,E?.story,ze,{behavior:"auto",shouldContinue:H});if(!H())return{success:!1};if(!Ne.ok&&Ne.reason!==at.targetNotVisible)ie(),se(y);else{if(Ne.ok&&await nE(_),!H())return{success:!1};se(E)}return{success:Ne.ok}}finally{Fi=Math.max(0,Fi-1),Fi===0&&(H()?Go&&Ft(el(Go)):se(et))}}finally{E&&He.delete(E)}},oE=c=>{const h=x$(c);return rE=h.then(()=>{},()=>{}),h},vg=ta(es,Sn(c=>Zi(c.selection,c.trackChanges)),"trackChanges"),M$={get:vg.get,getSnapshot:vg.getSnapshot,subscribe:vg.subscribe,observe:vg.observe,list:()=>{ms();const c=Yn().value??es.get().items,h=dn(xe());return c.map(Zu).filter(y=>y!=null).filter(y=>{const _=$r(y);return!_||!h?.has(_)})},accept:c=>xh("accept",c),acceptAsync:c=>yg(()=>xh("accept",c)),reject:c=>xh("reject",c),rejectAsync:c=>yg(()=>xh("reject",c)),acceptAll:()=>Kc("accept",{kind:"all"},null),acceptAllAsync:()=>yg(()=>Kc("accept",{kind:"all"},null)),rejectAll:()=>Kc("reject",{kind:"all"},null),rejectAllAsync:()=>yg(()=>Kc("reject",{kind:"all"},null)),next:()=>g2(1),previous:()=>g2(-1),navigateNext:()=>oE(1),navigatePrevious:()=>oE(-1),getAt:c=>{if(!c||typeof c!="object"||typeof c.x!="number"||typeof c.y!="number")return null;const h=y2(c);if(h.length===0)return null;const y=es.get().items;let _;for(const E of h){if(E.type!=="trackedChange")continue;let F;if(E.story){if(_===void 0&&(_=Mi()),!_)continue;F=_}else F=y;const H=F.find(ie=>Ei(ie,E.id,E.story));if(H)return E.story?{id:H.id,item:H,story:E.story}:{id:H.id,item:H}}return null},setActive:c=>{if(c==null)return N(null),se(null),V(),!0;if(!S())return!1;const h=typeof c=="string"?{id:c}:{id:c.id,story:c.story};if(typeof h.id!="string"||h.id.length===0)return!1;const y=h.id;if(h.story){const _=Mi();if(!_)return!1;const E=Fl(_,h.story).toPublicId(h.id)??h.id;if(!_.some(F=>Ei(F,E,h.story)))return!1;h.id=E}else{const _=Mi()??es.get().items,E=Hs(_).toPublicId(h.id)??h.id,F=_.find(H=>$r(H)===E);if(!F)return!1;h.id=E,h.story=dh(F)}return y!==h.id&&(h.paintedEntityId=y),N(h),se(h),V(),!0},scrollTo:async c=>{if(!b())return{success:!1,ok:!1,reason:S()?at.documentApiUnavailable:at.notReady};const h=typeof c=="string"?c:c.id,y=typeof c=="string"||!c.story||typeof c.story!="object"?void 0:c.story,_=y?dh({address:{story:y}}):void 0;if(typeof h!="string"||h.length===0)return{success:!1,ok:!1,reason:at.targetUnresolved};ae+=1,Ie+=1;const E=Ie,F=y?Mi()??es.get().items:es.get().items,H=y?Fl(F,y).toPublicId(h)??h:Hs(F).toPublicId(h)??h,ie=y?F.find(qe=>Ei(qe,H,y)):F.find(qe=>$r(qe)===H),he=y?_:dh(ie),Me=JI(ie),ze=et,Ne={id:H,...he?{story:he}:{},...H!==h?{paintedEntityId:h}:{}};He.add(Ne);try{const qe=await mg("trackChanges",H,F,he||y?{story:he,matchStory:y}:void 0);if(Ie!==E)return{success:!1,ok:!1};if(!qe)return{success:!1,ok:!1,reason:at.targetUnresolved};N(Ne);const Xe=Ie,We=et,Ge=Et,it=()=>Ie===Xe&&et===We&&Et===Ge,ut=()=>{it()&&(N(ze,{invalidateQueuedNavigation:!1}),V())};V(),Fi+=1;try{const Ke=await eE(H,qe,he,Me,{behavior:"auto",shouldContinue:it});if(!it())return{success:!1,ok:!1};if(!Ke.ok&&Ke.reason!==at.targetNotVisible)ut(),se(ze);else{if(Ke.ok&&await nE(H),!it())return{success:!1,ok:!1};se(Ne)}return Ke}finally{Fi=Math.max(0,Fi-1),Fi===0&&(it()?Go&&Ft(el(Go)):se(et))}}finally{He.delete(Ne)}}},xh=(c,h)=>{const{id:y,story:_}=typeof h=="string"?{id:h,story:void 0}:h;if(typeof y!="string"||y.length===0)return!1;const E={kind:"id",id:y,..._?{story:_}:{}};return Kc(c,E,y,_)},yg=c=>(ri=null,Fn=Promise.resolve(!1),ee||c()===!1?Promise.resolve(!1):Fn),Kc=(c,h,y,_)=>{try{return Bn(v2(c,h,y,_))}catch{return!1}},v2=(c,h,y,_)=>{if(Nc())return!1;const E=b()?.trackChanges,F=h.kind==="all"||h.scope==="all",H=h.kind==="range",ie=h.kind==="ids",he=F?[]:ie&&Array.isArray(h.ids)?h.ids.filter(qe=>typeof qe=="string"&&qe.length>0):y?[y]:[];if(he.length>0&&Ql(c,he)||ei({kind:c,scope:F?"all":"id"},E))return!1;const Me=F?`${c}All`:c,ze=!H&&!ie&&!_&&E&&typeof E[Me]=="function"?E[Me]:null,Ne=E&&typeof E.decide=="function"?E.decide:null;return!ze&&!Ne?!1:ze?ze.call(E,y??{}):Ne.call(E,{decision:c,target:h})},bg=Mn(c=>c.contentControls),Rh=c=>bg.get().items.find(h=>h?.id===c)??null,wg=ta(bg,Sn(c=>(lo.contentControls>0&&Qo("contentControls"),c.contentControls)),"contentControls"),L$=(c=>{if(c===void 0)return wg.get();const h=Qm(c);return h?Rh(h):null}),D$=Do(bg),O$={get:(c=>(c!==void 0&&xi("api"),L$(c))),getSnapshot:wg.getSnapshot,subscribe:wg.subscribe,observe:wg.observe,observeActivePath:D$.observe,list:()=>(xi("api"),bg.get().items),getById:c=>(xi("api"),Rh(c)),getRect:c=>{const h=Qm(c);if(!h)return Nl("unresolved");xi("panel");const y=Rh(h);if(!y)return Nl("unresolved");const _=Qb(y);return _?Ag.getRect({target:_}):Nl("unavailable")},scrollIntoView:async c=>{const h=Qm(c);if(!h)return{success:!1};xi("panel");const y=Rh(h);if(!y)return{success:!1};const _=Qb(y);return _?{success:(await Ed(_,{block:c.block,behavior:c.behavior})).ok}:{success:!1}},focus:async c=>{const h=Qm(c);if(!h)return{success:!1,reason:"invalid-id"};if(!S())return{success:!1,reason:"not-ready"};xi("panel");const y=Rh(h);if(!y)return{success:!1,reason:"not-found"};const _=Qb(y);if(!_)return{success:!1,reason:"not-reachable"};if(!(await Ed(_,{block:c.block,behavior:c.behavior})).ok)return{success:!1,reason:"not-reachable"};const E=UU(_);if(!E)return{success:!1,reason:"not-reachable"};const F=QI.apply(E);return!F.ok&&F.reason!==at.hostCapabilityUnavailable?{success:!1,reason:"not-reachable"}:(_$(h),{success:!0})}},Cg=Do(Mn(c=>c.fonts)),P$={get:Cg.get,getSnapshot:Cg.getSnapshot,subscribe:Cg.subscribe,observe:Cg.observe,getFamilyOptions:()=>O.fonts.options,getSizeOptions:()=>O.fonts.sizeOptions},kg=Do(Mn(c=>c.zoom)),F$={get:kg.get,getSnapshot:kg.getSnapshot,subscribe:kg.subscribe,observe:kg.observe,set:c=>{if(typeof t?.setZoom=="function")try{t.setZoom(c),V()}catch{}},setMode:c=>{if(typeof t?.setZoomMode=="function")try{t.setZoomMode(c),V()}catch{}}},Sg=Do(Mn(c=>c.document)),N$={get:Sg.get,getSnapshot:Sg.getSnapshot,subscribe:Sg.subscribe,observe:Sg.observe,setMode:c=>{if(typeof t?.setDocumentMode=="function")try{t.setDocumentMode(c),V()}catch{}},export:c=>{if(typeof t?.export=="function")try{return Promise.resolve(t.export(c))}catch{return}},getText:()=>{const c=b(),h=Lt(c?.getText?()=>c.getText({}):void 0,null);return typeof h=="string"?h:h&&typeof h=="object"&&typeof h.text=="string"?h.text:null},replaceFile:c=>{const h=t?.replaceFile??t?.loadDocument??t?.reload;if(typeof h=="function")try{return Promise.resolve(h.call(t,c))}catch{return}}},iE=()=>{if(typeof HTMLElement>"u")return null;const c=S()?.mount?.container;if(c instanceof HTMLElement)return c;const h=t?.element;return h instanceof HTMLElement?h:null},B$=(c,h)=>{if(typeof c!="number"||typeof h!="number"||!Number.isFinite(c)||!Number.isFinite(h))return[];const y=globalThis.document;if(!y||typeof y.elementFromPoint!="function")return[];const _=iE();if(!_)return[];const E=y.elementFromPoint(c,h);if(!E||!_.contains(E))return[];const F=[E],H=Ke=>{Ke&&_.contains(Ke)&&!F.includes(Ke)&&F.push(Ke)},ie=y.elementsFromPoint;if(typeof ie=="function"){let Ke=[];try{Ke=ie.call(y,c,h)??[]}catch{Ke=[]}for(const _t of Ke)H(_t)}const he=[],Me=Ke=>{Ke&&_.contains(Ke)&&!he.includes(Ke)&&!F.includes(Ke)&&he.push(Ke)},ze=Ke=>{const _t=Ke.getBoundingClientRect;if(typeof _t!="function")return!1;let It;try{It=_t.call(Ke)}catch{return!1}return It!=null&&c>=It.left&&c<=It.right&&h>=It.top&&h<=It.bottom};for(const Ke of F){const _t=Ke.querySelectorAll;if(typeof _t!="function")continue;let It;try{It=_t.call(Ke,"[data-track-change-marker]")}catch{continue}for(let _n=0;_n<It.length;_n+=1)ze(It[_n])&&Me(It[_n])}he.reverse();const Ne=[...he,...F],qe=yI(Ne[0],_);for(let Ke=1;Ke<Ne.length;Ke+=1)for(const _t of yI(Ne[Ke],_))qe.push(_t);if(qe.length===0)return qe;const Xe=es.get().items,We=Hs(Xe);let Ge;const it=new Set,ut=[];for(const Ke of qe){if(Ke.type!=="trackedChange"){const An=`${Ke.type}:${Ke.id}`;if(it.has(An))continue;it.add(An),ut.push(Ke);continue}const _t=VU(Ke.storyKey)??jU(Ke.story);let It;if(_t){if(Ge===void 0&&(Ge=Mi()),!Ge||(It=Fl(Ge,_t).toPublicId(Ke.id),!It||!Ge.some(An=>Ei(An,It,_t))))continue}else if(It=We.toPublicId(Ke.id),!It)continue;const _n=`trackedChange:${It}`;it.has(_n)||(it.add(_n),ut.push(_t?{type:"trackedChange",id:It,story:_t}:{type:"trackedChange",id:It}))}return ut};function y2(c,h){return typeof c=="object"?B$(c?.x,c?.y):null}function sE(c){const h=!!c&&typeof c.x=="number"&&typeof c.y=="number",y=h?{x:c.x,y:c.y}:{x:0,y:0};return{point:y,entities:h?y2(y):[],selection:O.selection,position:null,insideSelection:!1}}const xd=new Set;let b2=!1;const aE=c=>{const h=j();if(typeof h?.observeGeometry!="function")return;let y=!1;const _=Lt(()=>{const E=h.observeGeometry(()=>c.schedule());return y=!0,E},null);c.detach=typeof _=="function"?_:null,c.boundHost=y?h:null},_g=c=>{if(c.detach){try{c.detach()}catch{}c.detach=null}c.boundHost=null},lE=()=>{if(b2=!1,!(ee||j()))for(const c of xd)_g(c)},z$=()=>{if(!b2){if(b2=!0,typeof queueMicrotask=="function"){queueMicrotask(lE);return}Promise.resolve().then(lE)}},j$=()=>{const c=j();if(!c){z$();return}for(const h of xd)h.boundHost&&h.boundHost===c||(_g(h),aE(h),h.schedule())};be.push(j$);const Ag={getRect:c=>{const h=j(),y=h?.getTargetRects;if(typeof y=="function"){const _=Lt(()=>y.call(h,{target:c.target}),null);return _&&typeof _=="object"?_.success===!0&&Array.isArray(_.rects)?fH(dH(_.rects.filter(E=>E!=null&&typeof E=="object")),c.relativeTo):Nl(typeof _.reason=="string"?_.reason:"unresolved"):Nl("unresolved")}return Nl("unavailable")},observe:c=>{const h=[];let y=0;const _=typeof requestAnimationFrame=="function",E=()=>{if(!_){c();return}y||(y=requestAnimationFrame(()=>{y=0,c()}))},F=Sn(ie=>({ready:ie.ready,selection:ie.selection,zoom:ie.zoom}));h.push(F.subscribe(()=>E()));const H={schedule:E,detach:null,boundHost:null};return aE(H),xd.add(H),()=>{xd.delete(H),_g(H),y&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(y);for(const ie of h.splice(0))try{ie()}catch{}}},getHost:()=>iE(),entityAt:y2,contextAt:sE,scrollIntoView:async c=>{const h=c?.target;if(!h)return{success:!1};let y=null;if(h.kind==="entity"){const _=h.entityType==="comment"?"comments":"trackChanges",E=_==="comments"?Td.get().items:es.get().items,F=h.entityType==="trackedChange"&&h.story?{story:h.story}:void 0;y=await mg(_,h.entityId,E,F)}else{const _=h,E=h,F=Array.isArray(_.segments)&&_.segments.length>0?_.segments:E.blockId&&E.range?[{blockId:E.blockId,range:E.range}]:null;if(F){const H=h.story;y={kind:"text",segments:F,...H?{story:H}:{}}}}return y?{success:(await Ed(y,{block:c.block??"center",behavior:c.behavior??"smooth"})).ok}:{success:!1}}},cE=c=>{const h=(c&&typeof c=="object"?c:null)?.target;return h&&typeof h=="object"?h:null},uE=c=>`metadata:resolve:${c}`,V$=c=>{const h=b()?.metadata;if(!h||typeof h.resolve!="function")return null;const{value:y}=to(uE(c),xe(),()=>h.resolve({id:c}),cE);return y},U$=async c=>{const h=b()?.metadata;if(!h||typeof h.resolve!="function")return null;try{const y=xe(),_=await Promise.resolve(h.resolve({id:c}));if(y!==xe())return null;const E=cE(_);return P.set(uE(c),{token:y,value:E,hasSettled:!0,inflightToken:null}),E}catch{return null}},H$={getRect:c=>{const h=b()?.metadata;if(!h||typeof h.resolve!="function")return Nl("unavailable");const y=V$(c.id);return y?Ag.getRect({target:y}):Nl("unresolved")},scrollIntoView:async c=>{const h=await U$(c.id);return h?{success:(await Ed(h,{block:c.block,behavior:c.behavior})).ok}:{success:!1}}},$$={inTable:!1,tableNodeId:null,rowIndex:null,columnIndex:null,cellNodeId:null,rows:null,columns:null},G$={getContext:()=>{const c=Fe();if(!c)return{...$$};const h=Ee()?.table;return{inTable:!0,tableNodeId:c.tableNodeId,rowIndex:c.rowIndex,columnIndex:c.columnIndex,cellNodeId:c.cellNodeId,rows:typeof h?.rows=="number"?h.rows:null,columns:typeof h?.columns=="number"?h.columns:null}},isInTable:()=>Fe()!=null},Ig={query:"",total:0,activeIndex:-1,open:!1,available:!1,caseSensitive:!1,includeTrackedDeletions:!1,includeDeletedText:!1,regex:!1,canReplace:!1,canReplaceAll:!1,reason:at.searchUnavailable};let In={...Ig};const Eg=new Set,nl=()=>{const c=j()?.search;return c&&typeof c=="object"?c:null},Ss=()=>{const c=Y()?.search;return c&&typeof c=="object"?c:null},Mh=()=>{const c=nl();if(c&&typeof c.setSession=="function")return!0;const h=Ss();return!!h&&typeof h.query=="function"&&typeof h.getState=="function"},ts=()=>{for(const c of[...Eg])try{c(In)}catch{}},bi=c=>{In={...In,...c};const h=c.includeTrackedDeletions??c.includeDeletedText;return h!==void 0&&(In.includeTrackedDeletions=h,In.includeDeletedText=h),ts(),In};let Xr=0,Rd=null,qc=null;const dE=()=>{const c=qc;qc=null,c&&Lt(()=>(c(),null),null)},W$=()=>{Xr+=1,Rd=null,rl=!1,dE();const c=Mh();In={...Ig,available:c,reason:c?void 0:at.searchUnavailable},ts()};Pe.push(W$),ft.push(()=>{if(Rd===Xr)return;const c=In,h=oa();(h.canReplace!==c.canReplace||h.canReplaceAll!==c.canReplaceAll||h.available!==c.available||h.reason!==c.reason)&&ts()});const K$=c=>{if(!c)return!1;const h=c.queryError;if(h&&typeof h=="object"&&h.code==="invalid-pattern")return!0;const y=c.rejection;return c.status==="rejected"&&!!y&&typeof y=="object"&&y.code==="invalid-pattern"},w2=(c,h=!1,y=h)=>{const _=c&&typeof c=="object"?c:null;if(!_)return null;const E=Array.isArray(_.matches)?_.matches:[],F=typeof _.total=="number"&&Number.isFinite(_.total)?_.total:E.length,H=typeof _.activeMatchIndex=="number"?_.activeMatchIndex:typeof _.activeIndex=="number"?_.activeIndex:-1,ie=_.canReplace===!0||h;return{...typeof _.query=="string"?{query:_.query}:{},total:F,activeIndex:H,canReplace:ie,canReplaceAll:ie&&F>0&&_.truncated!==!0&&(_.canReplace===!0||y),...typeof _.caseSensitive=="boolean"?{caseSensitive:_.caseSensitive}:{},...typeof _.includeDeletedText=="boolean"?{includeDeletedText:_.includeDeletedText}:{},..._.regex===!0?{regex:!0}:{},...K$(_)?{invalidPattern:!0}:{}}};let rl=!1;const fE=()=>{if(!rl)return;rl=!1;const c=Ss();c&&typeof c.query=="function"&&Lt(()=>c.query({query:""}),null)},Wo=()=>Ce("find.replace")?.enabled===!0,Ko=()=>Ce("find.replaceAll")?.enabled===!0,Po=(c,h=!1,y=h)=>{const _=w2(c,h,y);if(!_){bi({total:0,activeIndex:-1,canReplace:!1,canReplaceAll:!1,reason:void 0});return}bi({..._.query!==void 0?{query:_.query}:{},total:_.total,activeIndex:_.activeIndex,canReplace:_.canReplace,canReplaceAll:_.canReplaceAll,..._.includeDeletedText!==void 0?{includeDeletedText:_.includeDeletedText}:{},..._.regex!==void 0?{regex:_.regex}:{},reason:_.invalidPattern?at.searchInvalidPattern:void 0})},oa=()=>{const c=nl();if(c&&typeof c.getState!="function")return In={...In,available:Mh(),reason:Mh()?void 0:at.searchUnavailable},In;if(!c){const y=Ss();if(y&&typeof y.getState=="function"){const _=w2(Lt(()=>y.getState(),null),Wo(),Ko());if(Rd===Xr)return In;if(_)return In={...In,..._.query!==void 0?{query:_.query}:{},total:_.total,activeIndex:_.activeIndex,canReplace:_.canReplace,canReplaceAll:_.canReplaceAll,available:!0,reason:_.invalidPattern?at.searchInvalidPattern:void 0,open:In.open||!!_.query},In}return In={...Ig,query:In.query,caseSensitive:In.caseSensitive,includeTrackedDeletions:In.includeTrackedDeletions,includeDeletedText:In.includeDeletedText},In}const h=w2(Lt(()=>c.getState(),null));return h&&(In={...In,...h.query!==void 0?{query:h.query}:{},total:h.total,activeIndex:h.activeIndex,canReplace:h.canReplace,canReplaceAll:h.canReplaceAll,...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?at.searchInvalidPattern:void 0,open:In.open||!!h.query}),In},Md=c=>{const h=c&&typeof c=="object"?c:null;if(h?.status==="committed")return{ok:!0};if(h?.status==="rejected"&&h.reason==="read-only")return{ok:!1,reason:at.documentReadonly};const y=h?.rejection;return h?.status==="rejected"&&y&&typeof y=="object"&&y.code==="read-only-document"?{ok:!1,reason:at.documentReadonly}:{ok:!1,reason:at.operationUnavailable}},Tg=Do({get:()=>oa(),subscribe:c=>(Eg.add(c),()=>Eg.delete(c))}),hE={get:Tg.get,getSnapshot:Tg.getSnapshot,subscribe:Tg.subscribe,observe:Tg.observe,open:()=>Mh()?(bi({available:!0,open:!0,reason:void 0}),{ok:!0}):(bi({available:!1,open:!1,reason:at.searchUnavailable}),{ok:!1,reason:at.searchUnavailable}),close:()=>{if(Xr+=1,qc)dE();else{const c=nl();if(c&&typeof c.clear=="function")Lt(()=>c.clear(),null);else{const h=Ss();h&&typeof h.query=="function"&&Lt(()=>h.query({query:""}),null)}}In={...Ig,available:Mh(),reason:void 0},In.available||(In.reason=at.searchUnavailable),ts()},find:(c,h)=>{const y=nl(),_=!!h?.caseSensitive,E=(h?.includeTrackedDeletions??h?.includeDeletedText)===!0,F=h?.regex===!0,H=++Xr;if(fE(),!y||typeof y.setSession!="function"){const he=Ss();if(he&&typeof he.query=="function"&&typeof he.getState=="function"){Rd=H,bi({query:c,caseSensitive:_,includeDeletedText:E,regex:F,total:0,activeIndex:-1,canReplace:!1,canReplaceAll:!1,available:!0,open:!0,reason:void 0}),qc=()=>{he.query({query:""})};const Me=Lt(()=>he.query({query:c,caseSensitive:_,includeDeletedText:E,regex:F}),null);return Fr(Me)?(rl=!0,Promise.resolve(Me).then(ze=>{H===Xr&&(rl=!1,Rd=null,Po(ze,Wo(),Ko()))},()=>{H===Xr&&(rl=!1,bi({available:!1,reason:at.searchUnavailable}))}),In):(Rd=null,Po(Me,Wo(),Ko()),Po(Lt(()=>he.getState(),null),Wo(),Ko()),In)}return bi({query:c,total:0,activeIndex:-1,available:!1,caseSensitive:_,includeDeletedText:E,regex:F,reason:at.searchUnavailable})}bi({query:c,caseSensitive:_,includeDeletedText:E,regex:F,available:!0,open:!0,reason:void 0}),qc=()=>{typeof y.clear=="function"&&y.clear()};const ie=Lt(()=>y.setSession(c,{caseSensitive:_,includeDeletedText:E,...F?{regex:!0}:{},highlight:!0}),null);if(Po(ie),c.length>0&&In.total===0&&In.reason!==at.searchInvalidPattern){const he=Ss();if(he&&typeof he.query=="function"&&typeof he.getState=="function"){const Me=qc;qc=()=>{Me?.(),he.query({query:""})};const ze=Lt(()=>he.query({query:c,caseSensitive:_,includeDeletedText:E,regex:F}),null);Fr(ze)?(rl=!0,Promise.resolve(ze).then(Ne=>{H===Xr&&(rl=!1,Po(Ne,Wo(),Ko()))},()=>{H===Xr&&(rl=!1,bi({available:!1,reason:at.searchUnavailable}))})):Po(ze,Wo(),Ko()),Po(Lt(()=>he.getState(),null),Wo(),Ko())}}return In},search:(c,h)=>hE.find(c,h),next:()=>{const c=nl();if(!c||typeof c.next!="function"){const h=Ss();if(!h||typeof h.next!="function"||typeof h.getState!="function")return{ok:!1,reason:at.searchUnavailable};if(In.total===0)return{ok:!1,reason:at.operationUnavailable};const y=Lt(()=>h.next(),null);if(Fr(y)){const _=Xr;Promise.resolve(y).then(E=>{_===Xr&&Po(E,Wo(),Ko())}).catch(()=>{_===Xr&&bi({available:!1,reason:at.searchUnavailable})})}else Po(y,Wo(),Ko());return Po(Lt(()=>h.getState(),null),Wo(),Ko()),{ok:!0}}return In.total===0?{ok:!1,reason:at.operationUnavailable}:(Po(Lt(()=>c.next(),null)),{ok:!0})},previous:()=>{const c=nl();if(!c||typeof c.previous!="function"){const h=Ss();if(!h||typeof h.previous!="function"||typeof h.getState!="function")return{ok:!1,reason:at.searchUnavailable};if(In.total===0)return{ok:!1,reason:at.operationUnavailable};const y=Lt(()=>h.previous(),null);if(Fr(y)){const _=Xr;Promise.resolve(y).then(E=>{_===Xr&&Po(E,Wo(),Ko())}).catch(()=>{_===Xr&&bi({available:!1,reason:at.searchUnavailable})})}else Po(y,Wo(),Ko());return Po(Lt(()=>h.getState(),null),Wo(),Ko()),{ok:!0}}return In.total===0?{ok:!1,reason:at.operationUnavailable}:(Po(Lt(()=>c.previous(),null)),{ok:!0})},clear:()=>{Xr+=1,fE();const c=nl();if(c&&typeof c.clear=="function"&&Lt(()=>c.clear(),null),!c||typeof c.clear!="function"){const h=Ss();h&&typeof h.query=="function"&&Lt(()=>h.query({query:""}),null)}bi({query:"",total:0,activeIndex:-1,canReplace:!1,canReplaceAll:!1,reason:void 0})},replace:c=>{const h=nl();if(!h){const _=Ss();if(!_||typeof _.replace!="function"||typeof _.getState!="function")return{ok:!1,reason:at.searchUnavailable};if(!Wo())return{ok:!1,reason:at.operationUnavailable};const E=Lt(()=>_.replace({replacement:typeof c=="string"?c:""}),null);if(Fr(E)){const F=Xr;oa(),ts();const H=()=>F===Xr;return Promise.resolve(E).then(ie=>(H()&&(Po(ie,Wo(),Ko()),oa(),ts()),Md(ie)),()=>(H()&&bi({available:!1,reason:at.searchUnavailable}),{ok:!1,reason:at.searchUnavailable}))}return oa(),ts(),Md(E)}if(typeof h.replaceCurrent!="function")return{ok:!1,reason:at.operationUnavailable};const y=Lt(()=>h.replaceCurrent(typeof c=="string"?c:""),null);return oa(),ts(),Md(y)},replaceAll:c=>{const h=nl();if(!h){const _=Ss();if(!_||typeof _.replaceAll!="function"||typeof _.getState!="function")return{ok:!1,reason:at.searchUnavailable};if(!Ko())return{ok:!1,reason:at.operationUnavailable};const E=Lt(()=>_.replaceAll({replacement:typeof c=="string"?c:""}),null);if(Fr(E)){const F=Xr;oa(),ts();const H=()=>F===Xr;return Promise.resolve(E).then(ie=>(H()&&(Po(ie,Wo(),Ko()),oa(),ts()),Md(ie)),()=>(H()&&bi({available:!1,reason:at.searchUnavailable}),{ok:!1,reason:at.searchUnavailable}))}return oa(),ts(),Md(E)}if(typeof h.replaceAll!="function")return{ok:!1,reason:at.operationUnavailable};const y=Lt(()=>h.replaceAll(typeof c=="string"?c:""),null);return oa(),ts(),Md(y)}},pE=Mn(c=>c.styles),xg=Do(pE),q$={get:xg.get,getSnapshot:xg.getSnapshot,subscribe:xg.subscribe,observe:xg.observe,getCatalog:c=>(Qo($o(c)),st(c).value),getQuickGallery:()=>pE.get().quickGallery,getActiveParagraphStyle:()=>gi(O.selection,on().cache).style},mE={select:Sn,get state(){return O},selection:QI,commands:A$,toolbar:I$,comments:T$,trackChanges:M$,contentControls:O$,fonts:P$,zoom:F$,document:N$,viewport:Ag,metadata:H$,tables:G$,search:hE,contextMenu:k,styles:q$,formatPainter:{setPointerSelecting(c){ee||(p={...p,pointerSelecting:c})},notifyPointerUp(){ee||(p={...p,pointerSelecting:!1},qI())},setKeyboardSelecting(c){ee||(p={...p,keyboardSelecting:c})},notifyKeyUp(){ee||(p={...p,keyboardSelecting:!1},qI())},cancel(){ee||dg()},onModeChange(c){return ee?()=>{}:(m.add(c),()=>m.delete(c))}},createScope:()=>{const c=[];return{select:(h,y)=>{const _=Sn(h,y);return{get:_.get,subscribe:E=>{const F=_.subscribe(E);return c.push(F),F}}},dispose:()=>{for(const h of c.splice(0))h()}}},destroy:()=>{if(!ee){ee=!0,RU(Ir,Qe),ot&&(clearTimeout(ot),ot=null),De&&(clearTimeout(De),De=null,Ye=0),_e?.timer&&(clearTimeout(_e.timer),_e.timer=null),_e=null,xt&&(clearTimeout(xt),xt=null),mn&&(clearTimeout(mn),mn=null),Kr&&Kr(),Kr=null,wr=null;for(const c of Object.keys(lo))lo[c]=0;Xt.clear(),un.clear(),ir.clear(),Wr=null,B.clear();for(const c of Hn.splice(0))c();ro&&ro(),ro=null,Cs=null,Di&&Di(),Di=null,Li=null,So&&So(),So=null,Oi=null,_o&&_o(),_o=null,Go=null,yi&&yi(),yi=null,Ja=null,Pi&&Pi(),Pi=null,tc=null;for(const c of xd)_g(c);xd.clear(),q.clear(),Eg.clear(),g+=1,m.clear(),Xr+=1,Ze.clear()}}};return ye=mE,mE}var wH=[{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 CH(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 kH(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"?CH(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 SH(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 _H(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:wH;for(const s of i)o(s);return n}var AH=[{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 IH(e,t){return e.activeMark?t.activeMarks.includes(e.activeMark):!1}Dt();var EH=['[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(", "),TH=800,OI=typeof Blob=="function"?Object.getOwnPropertyDescriptor(Blob.prototype,"size")?.get:void 0,PI=e=>{if(!OI)return!1;try{return OI.call(e),!0}catch{return!1}};function xH(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 RH=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"]),MH=["original","markup","final"],LH=["review","original","final","off"];function FI(e){return MH.includes(e)}function DH(e){return e==="markup"?"review":e}function NI(e){return LH.includes(e)}function OH(e){const t=e.modules?.trackChanges?.mode;if(NI(t))return t;const n=e.layoutEngineOptions?.trackedChanges?.mode;return NI(n)?n:null}function ng(e,t){const n=e.viewing,r=FI(n?.trackedChanges)?n.trackedChanges:null,o=r?DH(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 PH(e,t){const n=new OT.default;return e.forEach((r,o)=>{n.file(t[o],r)}),n.generateAsync({type:"blob",compression:"DEFLATE"})}function s2(e){return!!(e&&(e.synced===!0||e.isSynced===!0))}function BI(e){try{e.synced=!0}catch{}try{e.isSynced=!0}catch{}}function FH(e,t){if(!e)return()=>{};if(s2(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=()=>{BI(e),s()},l=u=>{u!==!1&&(u===!0||s2(e))&&(BI(e),s())};return n("synced",a),n("sync",l),s2(e)&&s(),i}function NH(e,t){const n=e.composedPath();if(!n.includes(t))return null;const r=n.find(a=>a instanceof HTMLElement&&a.matches(EH));if(!r)return null;const o=n.some(a=>a instanceof HTMLElement&&a.classList.contains(Mp.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 BH(e){if(!e||typeof e!="object")return[];const t=e.items;return Array.isArray(t)?t:[]}function zI(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 jI(e){const t=e.selectionTarget??e.target;if(!t)return null;try{return JSON.stringify(t)}catch{return null}}function fi(e){return!!(e&&typeof e=="object"&&e.editorVersion===2)}function zH(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 VI(e){return typeof e=="string"&&e.length>0?e:null}function UI(e){return e?fi(e)?VI(e.documentId??e.options?.documentId??null):VI(typeof e.getDocumentId=="function"?e.getDocumentId():e.options?.documentId):null}function jH(e){if(!e||fi(e))return null;const t=e;return t.documentRenderer??t.presentationEditor??null}function ps(e){if(!e)return null;if(fi(e))return e.fonts??null;const t=jH(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 rg=class extends Mg.default{static{this.allowedTypes=[_r,Ca,vu]}#e;#n;#t;#o;#i;#s;#d;#u;#c;#h;#g;#r;#a;#p;#k;#b;#A;#S;#M;#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()+TH))},this.#M=n=>{this.listenerCount("content-control:active-change")>0&&!xH(n)&&(this.#r="keyboard",this.#a=null)},this.#D=n=>{this.#z(n)},this.#v=null,this.#w=G4({}),this.#T=W4({}),this.#x=q4({}),this.version="0.0.0",this.users=[],this.whiteboard=null,this.colors=[],this.readyEditors=0,this.pendingCollaborationSaves=0,this.#f=new Ez,this.#C=null,this.#m=!1,this.#R=null,this.config={selector:"#superdoc",documentMode:"editing",allowSelectionInViewMode:!1,role:"editor",documents:[],editorExtensions:[],colors:[],users:[],user:{...zb},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 nz({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.#M,!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=NH(e,t),r=this.activeEditor?.doc?.contentControls?.list;if(!(!n||typeof r!="function"))try{const o=await r();if(this.#e)return;const i=zI(BH(o).find(s=>s.id===n));i&&this.emit("content-control:click",{target:i,source:"pointer"})}catch{return}}async#Y(e,t){this.#R=OH(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),Bb(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.#Me(),this.config.user=fz(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=TS(this.config.modules.comments),this.#w=G4(this.config),this.#T=W4(this.config),this.#x=q4(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=UT(this.config.colors),this.userColorMap=new Map,this.colorIndex=0,this.version="2.12.1-next.2",this.#E("π¦ [superdoc] Using SuperDoc version:",this.version),this.superdocId=e.superdocId||ol(),this.colors=this.config.colors??[],this.#_(),await e7(),this.#e)return;if(await this.#V(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.#j()}#j(){if(this.#L(),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 TF({Renderer:JB,superdoc:this,enabled:t}),this.emit("whiteboard:init",{whiteboard:this.whiteboard})}get requiredNumberOfEditors(){return this.#y("requiredNumberOfEditors").documents.filter(e=>e.type===_r).length}get ui(){return this.#v||(this.#v=bH({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=jI(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),u=this.activeEditor;(l||this.#b?.editor!==u||this.#b.key!==a)&&(this.#b={editor:u,key:a,source:l??"keyboard"}),this.#r=null,this.#a=null}),r=this.#v.contentControls.observeActivePath(s=>{const a=this.activeEditor,l=s.activeIds.map(v=>zI(s.items.find(C=>C.id===v)));if(l.some(v=>v===null))return;const u=l,d=a===e,f=u.length===t.length&&u.every((v,C)=>v.id===t[C]?.id);if(d&&f)return;if(u.length===0&&t.length===0){e=a;return}const p=d?t[0]??null:null;e=a,t=u;const g=jI(this.#v.selection.getSnapshot()),m=this.#b;this.emit("content-control:active-change",{active:u[0]??null,previous:p,activePath:u,source:g&&m?.editor===a&&m.key===g?m.source:"keyboard"})});const i=()=>{n?.(),r?.()};this.#e||this.listenerCount("content-control:active-change")===0?i():this.#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:jy(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=Uy(e);this.config.documents=[{id:ol(),...o}]}else n&&(this.config.documents=[{id:ol(),type:_r,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=Uy(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()}}))}#L(){const{app:e,pinia:t,superdocStore:n,commentsStore:r,highContrastModeStore:o}=mF({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&&zR(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#V({collaboration:e}={}){return e?(this.isCollaborative=!1,this.config.documents.length===0&&(this.config.documents=[{id:ol(),type:_r,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=io(e),this.provider=io(t),this.#ve();const n=this.config;this._cleanupAwareness=OR(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(),fi(e)&&(this.#ee(e),this.#te(e))}#ee(e){const t=e.presence;if(!t||typeof t.subscribe!="function")return;const n=_F(()=>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:RH,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===_r),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===_r);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===_r),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(!fi(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(fi(e)&&typeof e.save=="function"){const r=await e.save();return this.#N(r)}const t=this.config.documents.find(r=>r.type===_r),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 jy(e,_r);throw new Error("SuperDoc: active v2 editor returned an unsupported DOCX save payload")}#ue(e,t){const n=UI(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}#je(){this.#Q(),this.#ke(null,null)}#Ve(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=FH(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===_r);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(!fi(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=W_({v2Collaboration:e.v2Collaboration??this.#Te(r.v2Collaboration)??i?.v2Collaboration??i?.v2??null,legacyCollaboration:s,documentType:_r,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===_r),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=yu({actor:e});t&&this.users.some(n=>yu({actor:n})===t)||this.users.push(e)}removeSharedUser(e){this.#H("removeSharedUser");const t=typeof e=="string"?Ly(e):"",n=typeof e=="string"?`email:${t}`:yu({actor:e});this.users=this.users.filter(r=>{const o=yu({actor:r});return n?o!==n:t?Ly(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=PI(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:M4(e)})}broadcastEditorCreate(e){this.readyEditors++,this.broadcastReady(),this.#Re(e),this.emit("editorCreate",{editor:M4(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)}#Me(){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:()=>ps(this.activeEditor)?.getReport()??[],getMissingFonts:()=>ps(this.activeEditor)?.getMissingFonts()??[],getDocumentFontOptions:()=>ps(this.activeEditor)?.getDocumentFontOptions()??[],getFontFamilyOptions:()=>ps(this.activeEditor)?.getFontFamilyOptions()??[],getDocumentFonts:()=>ps(this.activeEditor)?.getDocumentFonts()??[],onReport:e=>{const t=this.activeEditor,n=t?ps(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=ps(this.activeEditor);if(!t)throw new Error("superdoc.fonts.map requires an active editor");t.map(e)},unmap:e=>{const t=ps(this.activeEditor);if(!t)throw new Error("superdoc.fonts.unmap requires an active editor");t.unmap(e)},add:e=>{const t=ps(this.activeEditor);if(!t)throw new Error("superdoc.fonts.add requires an active editor");t.add(e)},preload:e=>{const t=ps(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}}#Le(e){this.#fe();const t=ps(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"&&fi(t)?this.#he(t):this.#K()}finally{this.#m=!1}}#he(e){if(fi(e)){!this.#m&&this.#f.getActive()&&this.#f.setActive(null,"set-active-v2-facade");const t=this.activeEditor;this.activeEditor=e,this.#Le(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 Ra(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=pU({...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 EL(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,Bb(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=ng(this.config,this.#R),n={...this.config.viewing},r=typeof e.comments=="boolean",o=FI(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&&Bb(this.config),this.#se(),this.config.documentMode==="viewing")){const i=ng(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=ng(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=ng(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=kS(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(fi(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=bA(n||this.config.title),u=await this.exportEditorsToDOCX({commentsType:t,isFinalDoc:i,fieldsHighlightColor:a}),d=[...r],f=[...o];if(e.includes("docx")&&u.forEach(g=>{d.push(g),f.push(`${l}.docx`)}),d.length===1)return s?yA(d[0],l,e[0]):d[0];const p=await PH(d,f);return s?yA(p,l,"zip"):p}async replaceFile(e){const t=this.activeEditor;if(fi(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&&!fi(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=u=>{"editor"in u&&u.error&&typeof u.error=="object"&&a.add(u.error)};this.on("exception",l);try{const u=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=()=>PI(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"||zH(m)))throw m}return p()});return(await Promise.all(u)).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=UI(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.#M,!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?fi(this.activeEditor)?this.activeEditor.focus?.(e):this.activeEditor.focus?.():this.#y("focus").documents.find(n=>{const r=n.getEditor?.();return r?(fi(r)?r.focus?.(e):r.focus?.(),!0):!1})}setHighContrastMode(e){this.activeEditor&&(this.activeEditor.setHighContrastMode?.(e),this.highContrastModeStore?.setHighContrastMode(e))}};Dt();var HI="__SUPERDOC_V2_BROWSER_RUNTIME__";function VH(e=globalThis){const t=e[HI];return t&&typeof t=="object"?t:null}function UH(e={},t=globalThis){const n=VH(t)??{},r={...n,...e,vue:e.vue??n.vue??MT};return t[HI]=r,r}UH();var HH={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"},$H=0;function $I(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-${++$H}`}`,l=[];if(i)for(const[u,d]of Object.entries(i)){if(d==null)continue;const f=HH[u];f&&l.push(` ${f}: ${d};`)}if(n!=null&&l.push(` --sd-ui-font-family: ${n};`),r!=null&&l.push(` --sd-ui-radius: ${r};`),o!=null&&l.push(` --sd-ui-shadow: ${o};`),s)for(const[u,d]of Object.entries(s))d!=null&&l.push(` ${u}: ${d};`);return{className:a,css:l.length>0?`.${a} {
|
|
106
106
|
${l.join(`
|
|
107
107
|
`)}
|
|
108
|
-
}`:""}}function GH(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 WH(e){const{className:t,css:n}=$I(e);return GH(t,n),t}function KH(e){return $I(e)}function qH(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 YH=Dd({BlankDOCX:()=>Q3,DOCX:()=>_r,HTML:()=>vu,PDF:()=>Ca,SuperDoc:()=>rg,buildTheme:()=>KH,compareVersions:()=>zT,createTheme:()=>WH,defineSuperDocExtension:()=>qH,getFileObject:()=>Dy}),XH="SUPERDOC_ENGINE_CDN_BASE_URL",GI=Symbol.for("superdoc.docx-engine.cdn-load-state"),og="superdocDocxEngineStatus";function ZH(e,t,n=null){const r=e?.[XH],o=typeof r=="string"&&r.trim()?r:n;if(typeof o=="string"&&o.trim())return QH(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 QH(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 JH({engineVersion:e,buildBaseUrl:t}){QR(()=>{const n=ZH(globalThis,e,t),r=globalThis[GI],o=r instanceof Map?r:new Map;if(globalThis[GI]=o,!o.has(n)){const i=Promise.all([import(`${n}/dist-cdn/docx-engine.es.js`),e$(`${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 e$(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[og]==="loaded")return Promise.resolve();const r=n?.dataset[og]==="loading";return n&&!r&&n.remove(),new Promise((o,i)=>{const s=r?n:document.createElement("link");let a=!1,l;const u=(g,m)=>{a||(a=!0,l?.disconnect(),s.dataset[og]=g,m())},d=()=>u("loaded",o),f=()=>u("error",()=>i(new Error(`SuperDoc: failed to load DOCX Engine styles from ${t}`))),p=()=>{s.isConnected||u("error",()=>i(new Error(`SuperDoc: DOCX Engine stylesheet was removed while loading from ${t}`)))};s.addEventListener("load",d,{once:!0}),s.addEventListener("error",f,{once:!0}),typeof globalThis.MutationObserver=="function"&&(l=new globalThis.MutationObserver(p),l.observe(document.head,{childList:!0})),r||(s.rel="stylesheet",s.href=t,s.dataset.superdocDocxEngine="true",s.dataset[og]="loading",document.head.appendChild(s))})}JH({engineVersion:"0.11.
|
|
108
|
+
}`:""}}function GH(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 WH(e){const{className:t,css:n}=$I(e);return GH(t,n),t}function KH(e){return $I(e)}function qH(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 YH=Dd({BlankDOCX:()=>Q3,DOCX:()=>_r,HTML:()=>vu,PDF:()=>Ca,SuperDoc:()=>rg,buildTheme:()=>KH,compareVersions:()=>zT,createTheme:()=>WH,defineSuperDocExtension:()=>qH,getFileObject:()=>Dy}),XH="SUPERDOC_ENGINE_CDN_BASE_URL",GI=Symbol.for("superdoc.docx-engine.cdn-load-state"),og="superdocDocxEngineStatus";function ZH(e,t,n=null){const r=e?.[XH],o=typeof r=="string"&&r.trim()?r:n;if(typeof o=="string"&&o.trim())return QH(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 QH(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 JH({engineVersion:e,buildBaseUrl:t}){QR(()=>{const n=ZH(globalThis,e,t),r=globalThis[GI],o=r instanceof Map?r:new Map;if(globalThis[GI]=o,!o.has(n)){const i=Promise.all([import(`${n}/dist-cdn/docx-engine.es.js`),e$(`${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 e$(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[og]==="loaded")return Promise.resolve();const r=n?.dataset[og]==="loading";return n&&!r&&n.remove(),new Promise((o,i)=>{const s=r?n:document.createElement("link");let a=!1,l;const u=(g,m)=>{a||(a=!0,l?.disconnect(),s.dataset[og]=g,m())},d=()=>u("loaded",o),f=()=>u("error",()=>i(new Error(`SuperDoc: failed to load DOCX Engine styles from ${t}`))),p=()=>{s.isConnected||u("error",()=>i(new Error(`SuperDoc: DOCX Engine stylesheet was removed while loading from ${t}`)))};s.addEventListener("load",d,{once:!0}),s.addEventListener("error",f,{once:!0}),typeof globalThis.MutationObserver=="function"&&(l=new globalThis.MutationObserver(p),l.observe(document.head,{childList:!0})),r||(s.rel="stylesheet",s.href=t,s.dataset.superdocDocxEngine="true",s.dataset[og]="loading",document.head.appendChild(s))})}JH({engineVersion:"0.11.1-next.2",buildBaseUrl:null});for(const[e,t]of Object.entries(YH))e==="SuperDoc"||e==="default"||Object.prototype.hasOwnProperty.call(rg,e)||(rg[e]=t);var t$=rg;return t$})();
|