@univerjs/core 0.15.0 → 0.15.1
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/lib/cjs/index.js +8 -8
- package/lib/es/index.js +4558 -4518
- package/lib/index.js +4558 -4518
- package/lib/types/common/url.d.ts +7 -0
- package/lib/types/index.d.ts +4 -1
- package/lib/types/observer/observable.d.ts +0 -4
- package/lib/types/services/image-io/url-image.service.d.ts +22 -0
- package/lib/types/services/resource-manager/type.d.ts +0 -4
- package/lib/types/shared/lifecycle.d.ts +1 -5
- package/lib/types/shared/object-matrix.d.ts +0 -4
- package/lib/types/sheets/worksheet.d.ts +9 -0
- package/lib/umd/index.js +8 -8
- package/package.json +6 -6
package/lib/cjs/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"use strict";var
|
|
2
|
-
`,Pl="isRowStylePrecedeColumnStyle",kl=Symbol("AUTO_HEIGHT_FOR_MERGED_CELLS");function Gd(e){return`${Jn}${e}`}function Fl(e){return e.startsWith(Jn)}function Kd(e){return e===xl}function Xd(e,t){t.forEach(n=>e.add(n))}function Hl(e,t){t.forEach(([n])=>{e.has(n)&&e.get(n)})}function Bl(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||!e||typeof t!="object"||!t)return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;const s=Object.prototype.hasOwnProperty.bind(t);for(let i=0;i<n.length;i++){const o=n[i];if(!s(o))return!1;const a=e[o],l=t[o];if(a!==l)return!1}return!0}class ws extends Error{constructor(t){super(t),this.name="CustomCommandExecutionError"}}class qd extends ws{constructor(){super("Canceled by facade"),this.name="CanceledError"}}function Jd(e,t=16){let n=0,r=null;return function(...i){const o=Date.now();o-n<t?(r&&clearTimeout(r),r=setTimeout(()=>{n=o,e.apply(this,i)},t)):(n=o,e.apply(this,i))}}var kn=(e=>(e[e.Style=1]="Style",e[e.Value=2]="Value",e))(kn||{});function Zd(e){return`sheet_interceptor_${e}`}const $l=e=>function(t,n){let r=-1,s=t;for(let i=0;i<=e.length;i++){if(i<=r)throw new Error("[SheetInterceptorService]: next() called multiple times!");if(r=i,i===e.length)return s;const o=e[i];let a=!1;if(s=o.handler(s,n,l=>(a=!0,l)),!a)break}return s};class Qd{constructor(t){p(this,"_interceptorsByName",new Map);p(this,"_interceptorPoints");this._interceptorPoints=t}fetchThroughInterceptors(t,n){const r=t;let s=this._interceptorsByName.get(r);return n&&(s=s.filter(n)),$l(s||[])}intercept(t,n){const r=t;this._interceptorsByName.has(r)||this._interceptorsByName.set(r,[]);const s=this._interceptorsByName.get(r);return s.push(n),this._interceptorsByName.set(r,s.sort((i,o)=>{var a,l;return((a=o.priority)!=null?a:0)-((l=i.priority)!=null?l:0)})),()=>kr(this._interceptorsByName.get(r),n)}getInterceptPoints(){return this._interceptorPoints}dispose(){this._interceptorsByName.clear()}}function ef(e){return`sheet_async_interceptor_${e}`}const tf=e=>async function(t,n){let r=-1,s=t;for(let i=0;i<=e.length;i++){if(i<=r)throw new Error("[SheetInterceptorService]: next() called multiple times!");if(r=i,i===e.length)return s;const o=e[i];let a=!1;if(s=await o.handler(s,n,async l=>(a=!0,l)),!a)break}return s};class nf{constructor(t){p(this,"_asyncInterceptorsByName",new Map);p(this,"_asyncInterceptorPoints");this._asyncInterceptorPoints=t}fetchThroughAsyncInterceptors(t,n){const r=t;let s=this._asyncInterceptorsByName.get(r);return n&&(s=s.filter(n)),tf(s||[])}async interceptAsync(t,n){const r=t;this._asyncInterceptorsByName.has(r)||this._asyncInterceptorsByName.set(r,[]);const s=this._asyncInterceptorsByName.get(r);return s.push(n),this._asyncInterceptorsByName.set(r,s.sort((i,o)=>{var a,l;return((a=o.priority)!=null?a:0)-((l=i.priority)!=null?l:0)})),()=>kr(this._asyncInterceptorsByName.get(r),n)}getInterceptPoints(){return this._asyncInterceptorPoints}dispose(){this._asyncInterceptorsByName.clear()}}function jl(e){return e.map(t=>t/255)}function Wl(e){return e.map(t=>Math.round(t*255))}function rf([e,t,n]){const r=Math.max(e,t,n),s=Math.min(e,t,n),i=(r+s)/2;let o=0,a=0;if(r!==s){const l=r-s;switch(a=i>.5?l/(2-r-s):l/(r+s),r){case e:o=(t-n)/l+(t<n?6:0);break;case t:o=(n-e)/l+2;break;case n:o=(e-t)/l+4;break}o/=6}return[o,a,i]}function vs(e,t,n){const r=[e,t,n].map(s=>s<=.03928?s/12.92:((s+.055)/1.055)**2.4);return .2126*r[0]+.7152*r[1]+.0722*r[2]}function Ra(e,t){return(Math.max(e,t)+.05)/(Math.min(e,t)+.05)}function sf(e,t,n){let r,s,i;if(t===0)r=s=i=n;else{const o=(c,u,h)=>{let d=h;return d<0&&(d+=1),d>1&&(d-=1),d<.16666666666666666?c+(u-c)*6*d:d<.5?u:d<.6666666666666666?c+(u-c)*(.6666666666666666-d)*6:c},a=n<.5?n*(1+t):n+t-n*t,l=2*n-a;r=o(l,a,e+1/3),s=o(l,a,e),i=o(l,a,e-1/3)}return[r,s,i]}const ai={r:1,g:1,b:1},li={r:0,g:0,b:0},of=vs(ai.r,ai.g,ai.b),af=vs(li.r,li.g,li.b);function lf(e){const t=vs(e[0],e[1],e[2]),n=Ra(of,t),r=rf(e);let s=1-r[2],i,o,a;do i=sf(r[0],r[1],s),o=vs(i[0],i[1],i[2]),a=Ra(o,af),s+=.01;while(s<=1&&s>=0&&Math.abs(a-n)<.01);return i}function cf(e){return Wl(lf(jl(e)))}const Et=[[.333,-.667,-.667,0,1],[-.667,.333,-.667,0,1],[-.667,-.667,.333,0,1],[0,0,0,1,0]];function uf(e){const t=e[0],n=e[1],r=e[2];let s=[Et[0][0]*t+Et[0][1]*n+Et[0][2]*r+Et[0][4],Et[1][0]*t+Et[1][1]*n+Et[1][2]*r+Et[1][4],Et[2][0]*t+Et[2][1]*n+Et[2][2]*r+Et[2][4]];return s=s.map(i=>i>1?1:i<0?0:i),s}function hf(e){return Wl(uf(jl(e)))}var Yl=typeof global=="object"&&global&&global.Object===Object&&global,df=typeof self=="object"&&self&&self.Object===Object&&self,wn=Yl||df||Function("return this")(),Gn=wn.Symbol,Vl=Object.prototype,ff=Vl.hasOwnProperty,mf=Vl.toString,rr=Gn?Gn.toStringTag:void 0;function gf(e){var t=ff.call(e,rr),n=e[rr];try{e[rr]=void 0;var r=!0}catch{}var s=mf.call(e);return r&&(t?e[rr]=n:delete e[rr]),s}var _f=Object.prototype,pf=_f.toString;function Ef(e){return pf.call(e)}var Cf="[object Null]",Rf="[object Undefined]",Ia=Gn?Gn.toStringTag:void 0;function Fr(e){return e==null?e===void 0?Rf:Cf:Ia&&Ia in Object(e)?gf(e):Ef(e)}function Zn(e){return e!=null&&typeof e=="object"}var If="[object Symbol]";function Bs(e){return typeof e=="symbol"||Zn(e)&&Fr(e)==If}function Sf(e,t){for(var n=-1,r=e==null?0:e.length,s=Array(r);++n<r;)s[n]=t(e[n],n,e);return s}var Kn=Array.isArray,Sa=Gn?Gn.prototype:void 0,Oa=Sa?Sa.toString:void 0;function zl(e){if(typeof e=="string")return e;if(Kn(e))return Sf(e,zl)+"";if(Bs(e))return Oa?Oa.call(e):"";var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}var Of=/\s/;function wf(e){for(var t=e.length;t--&&Of.test(e.charAt(t)););return t}var vf=/^\s+/;function bf(e){return e&&e.slice(0,wf(e)+1).replace(vf,"")}function Ot(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var wa=NaN,yf=/^[-+]0x[0-9a-f]+$/i,Af=/^0b[01]+$/i,Tf=/^0o[0-7]+$/i,Nf=parseInt;function va(e){if(typeof e=="number")return e;if(Bs(e))return wa;if(Ot(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Ot(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=bf(e);var n=Af.test(e);return n||Tf.test(e)?Nf(e.slice(2),n?2:8):yf.test(e)?wa:+e}function Gl(e){return e}var Mf="[object AsyncFunction]",Df="[object Function]",Lf="[object GeneratorFunction]",xf="[object Proxy]";function fo(e){if(!Ot(e))return!1;var t=Fr(e);return t==Df||t==Lf||t==Mf||t==xf}var ci=wn["__core-js_shared__"],ba=(function(){var e=/[^.]+$/.exec(ci&&ci.keys&&ci.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""})();function Uf(e){return!!ba&&ba in e}var Pf=Function.prototype,kf=Pf.toString;function Ff(e){if(e!=null){try{return kf.call(e)}catch{}try{return e+""}catch{}}return""}var Hf=/[\\^$.*+?()[\]{}|]/g,Bf=/^\[object .+?Constructor\]$/,$f=Function.prototype,jf=Object.prototype,Wf=$f.toString,Yf=jf.hasOwnProperty,Vf=RegExp("^"+Wf.call(Yf).replace(Hf,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function zf(e){if(!Ot(e)||Uf(e))return!1;var t=fo(e)?Vf:Bf;return t.test(Ff(e))}function Gf(e,t){return e==null?void 0:e[t]}function mo(e,t){var n=Gf(e,t);return zf(n)?n:void 0}var ya=Object.create,Kf=(function(){function e(){}return function(t){if(!Ot(t))return{};if(ya)return ya(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}})();function Xf(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function qf(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}var Jf=800,Zf=16,Qf=Date.now;function em(e){var t=0,n=0;return function(){var r=Qf(),s=Zf-(r-n);if(n=r,s>0){if(++t>=Jf)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function tm(e){return function(){return e}}var bs=(function(){try{var e=mo(Object,"defineProperty");return e({},"",{}),e}catch{}})(),nm=bs?function(e,t){return bs(e,"toString",{configurable:!0,enumerable:!1,value:tm(t),writable:!0})}:Gl,rm=em(nm),sm=9007199254740991,im=/^(?:0|[1-9]\d*)$/;function go(e,t){var n=typeof e;return t=t==null?sm:t,!!t&&(n=="number"||n!="symbol"&&im.test(e))&&e>-1&&e%1==0&&e<t}function _o(e,t,n){t=="__proto__"&&bs?bs(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function $s(e,t){return e===t||e!==e&&t!==t}var om=Object.prototype,am=om.hasOwnProperty;function Kl(e,t,n){var r=e[t];(!(am.call(e,t)&&$s(r,n))||n===void 0&&!(t in e))&&_o(e,t,n)}function lm(e,t,n,r){var s=!n;n||(n={});for(var i=-1,o=t.length;++i<o;){var a=t[i],l=void 0;l===void 0&&(l=e[a]),s?_o(n,a,l):Kl(n,a,l)}return n}var Aa=Math.max;function cm(e,t,n){return t=Aa(t===void 0?e.length-1:t,0),function(){for(var r=arguments,s=-1,i=Aa(r.length-t,0),o=Array(i);++s<i;)o[s]=r[t+s];s=-1;for(var a=Array(t+1);++s<t;)a[s]=r[s];return a[t]=n(o),Xf(e,this,a)}}function um(e,t){return rm(cm(e,t,Gl),e+"")}var hm=9007199254740991;function Xl(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=hm}function po(e){return e!=null&&Xl(e.length)&&!fo(e)}function dm(e,t,n){if(!Ot(n))return!1;var r=typeof t;return(r=="number"?po(n)&&go(t,n.length):r=="string"&&t in n)?$s(n[t],e):!1}function ql(e){return um(function(t,n){var r=-1,s=n.length,i=s>1?n[s-1]:void 0,o=s>2?n[2]:void 0;for(i=e.length>3&&typeof i=="function"?(s--,i):void 0,o&&dm(n[0],n[1],o)&&(i=s<3?void 0:i,s=1),t=Object(t);++r<s;){var a=n[r];a&&e(t,a,r,i)}return t})}var fm=Object.prototype;function Jl(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||fm;return e===n}function mm(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}var gm="[object Arguments]";function Ta(e){return Zn(e)&&Fr(e)==gm}var Zl=Object.prototype,_m=Zl.hasOwnProperty,pm=Zl.propertyIsEnumerable,Li=Ta((function(){return arguments})())?Ta:function(e){return Zn(e)&&_m.call(e,"callee")&&!pm.call(e,"callee")};function Em(){return!1}var Ql=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Na=Ql&&typeof module=="object"&&module&&!module.nodeType&&module,Cm=Na&&Na.exports===Ql,Ma=Cm?wn.Buffer:void 0,Rm=Ma?Ma.isBuffer:void 0,ec=Rm||Em,Im="[object Arguments]",Sm="[object Array]",Om="[object Boolean]",wm="[object Date]",vm="[object Error]",bm="[object Function]",ym="[object Map]",Am="[object Number]",Tm="[object Object]",Nm="[object RegExp]",Mm="[object Set]",Dm="[object String]",Lm="[object WeakMap]",xm="[object ArrayBuffer]",Um="[object DataView]",Pm="[object Float32Array]",km="[object Float64Array]",Fm="[object Int8Array]",Hm="[object Int16Array]",Bm="[object Int32Array]",$m="[object Uint8Array]",jm="[object Uint8ClampedArray]",Wm="[object Uint16Array]",Ym="[object Uint32Array]",He={};He[Pm]=He[km]=He[Fm]=He[Hm]=He[Bm]=He[$m]=He[jm]=He[Wm]=He[Ym]=!0;He[Im]=He[Sm]=He[xm]=He[Om]=He[Um]=He[wm]=He[vm]=He[bm]=He[ym]=He[Am]=He[Tm]=He[Nm]=He[Mm]=He[Dm]=He[Lm]=!1;function Vm(e){return Zn(e)&&Xl(e.length)&&!!He[Fr(e)]}function zm(e){return function(t){return e(t)}}var tc=typeof exports=="object"&&exports&&!exports.nodeType&&exports,vr=tc&&typeof module=="object"&&module&&!module.nodeType&&module,Gm=vr&&vr.exports===tc,ui=Gm&&Yl.process,Da=(function(){try{var e=vr&&vr.require&&vr.require("util").types;return e||ui&&ui.binding&&ui.binding("util")}catch{}})(),La=Da&&Da.isTypedArray,nc=La?zm(La):Vm;function Km(e,t){var n=Kn(e),r=!n&&Li(e),s=!n&&!r&&ec(e),i=!n&&!r&&!s&&nc(e),o=n||r||s||i,a=o?mm(e.length,String):[],l=a.length;for(var c in e)o&&(c=="length"||s&&(c=="offset"||c=="parent")||i&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||go(c,l))||a.push(c);return a}function Xm(e,t){return function(n){return e(t(n))}}function qm(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}var Jm=Object.prototype,Zm=Jm.hasOwnProperty;function Qm(e){if(!Ot(e))return qm(e);var t=Jl(e),n=[];for(var r in e)r=="constructor"&&(t||!Zm.call(e,r))||n.push(r);return n}function rc(e){return po(e)?Km(e):Qm(e)}var eg=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,tg=/^\w*$/;function ng(e,t){if(Kn(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||Bs(e)?!0:tg.test(e)||!eg.test(e)||t!=null&&e in Object(t)}var Tr=mo(Object,"create");function rg(){this.__data__=Tr?Tr(null):{},this.size=0}function sg(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var ig="__lodash_hash_undefined__",og=Object.prototype,ag=og.hasOwnProperty;function lg(e){var t=this.__data__;if(Tr){var n=t[e];return n===ig?void 0:n}return ag.call(t,e)?t[e]:void 0}var cg=Object.prototype,ug=cg.hasOwnProperty;function hg(e){var t=this.__data__;return Tr?t[e]!==void 0:ug.call(t,e)}var dg="__lodash_hash_undefined__";function fg(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Tr&&t===void 0?dg:t,this}function In(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}In.prototype.clear=rg;In.prototype.delete=sg;In.prototype.get=lg;In.prototype.has=hg;In.prototype.set=fg;function mg(){this.__data__=[],this.size=0}function js(e,t){for(var n=e.length;n--;)if($s(e[n][0],t))return n;return-1}var gg=Array.prototype,_g=gg.splice;function pg(e){var t=this.__data__,n=js(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():_g.call(t,n,1),--this.size,!0}function Eg(e){var t=this.__data__,n=js(t,e);return n<0?void 0:t[n][1]}function Cg(e){return js(this.__data__,e)>-1}function Rg(e,t){var n=this.__data__,r=js(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function Kt(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Kt.prototype.clear=mg;Kt.prototype.delete=pg;Kt.prototype.get=Eg;Kt.prototype.has=Cg;Kt.prototype.set=Rg;var sc=mo(wn,"Map");function Ig(){this.size=0,this.__data__={hash:new In,map:new(sc||Kt),string:new In}}function Sg(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function Ws(e,t){var n=e.__data__;return Sg(t)?n[typeof t=="string"?"string":"hash"]:n.map}function Og(e){var t=Ws(this,e).delete(e);return this.size-=t?1:0,t}function wg(e){return Ws(this,e).get(e)}function vg(e){return Ws(this,e).has(e)}function bg(e,t){var n=Ws(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}function ln(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}ln.prototype.clear=Ig;ln.prototype.delete=Og;ln.prototype.get=wg;ln.prototype.has=vg;ln.prototype.set=bg;var yg="Expected a function";function Eo(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(yg);var n=function(){var r=arguments,s=t?t.apply(this,r):r[0],i=n.cache;if(i.has(s))return i.get(s);var o=e.apply(this,r);return n.cache=i.set(s,o)||i,o};return n.cache=new(Eo.Cache||ln),n}Eo.Cache=ln;var Ag=500;function Tg(e){var t=Eo(e,function(r){return n.size===Ag&&n.clear(),r}),n=t.cache;return t}var Ng=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Mg=/\\(\\)?/g,Dg=Tg(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(Ng,function(n,r,s,i){t.push(s?i.replace(Mg,"$1"):r||n)}),t});function Lg(e){return e==null?"":zl(e)}function ic(e,t){return Kn(e)?e:ng(e,t)?[e]:Dg(Lg(e))}function oc(e){if(typeof e=="string"||Bs(e))return e;var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function xg(e,t){t=ic(t,e);for(var n=0,r=t.length;e!=null&&n<r;)e=e[oc(t[n++])];return n&&n==r?e:void 0}function ac(e,t,n){var r=e==null?void 0:xg(e,t);return r===void 0?n:r}var lc=Xm(Object.getPrototypeOf,Object),Ug="[object Object]",Pg=Function.prototype,kg=Object.prototype,cc=Pg.toString,Fg=kg.hasOwnProperty,Hg=cc.call(Object);function Bg(e){if(!Zn(e)||Fr(e)!=Ug)return!1;var t=lc(e);if(t===null)return!0;var n=Fg.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&cc.call(n)==Hg}function $g(){this.__data__=new Kt,this.size=0}function jg(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function Wg(e){return this.__data__.get(e)}function Yg(e){return this.__data__.has(e)}var Vg=200;function zg(e,t){var n=this.__data__;if(n instanceof Kt){var r=n.__data__;if(!sc||r.length<Vg-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new ln(r)}return n.set(e,t),this.size=n.size,this}function Qn(e){var t=this.__data__=new Kt(e);this.size=t.size}Qn.prototype.clear=$g;Qn.prototype.delete=jg;Qn.prototype.get=Wg;Qn.prototype.has=Yg;Qn.prototype.set=zg;var uc=typeof exports=="object"&&exports&&!exports.nodeType&&exports,xa=uc&&typeof module=="object"&&module&&!module.nodeType&&module,Gg=xa&&xa.exports===uc,Ua=Gg?wn.Buffer:void 0;Ua&&Ua.allocUnsafe;function Kg(e,t){return e.slice()}var Pa=wn.Uint8Array;function Xg(e){var t=new e.constructor(e.byteLength);return new Pa(t).set(new Pa(e)),t}function qg(e,t){var n=Xg(e.buffer);return new e.constructor(n,e.byteOffset,e.length)}function Jg(e){return typeof e.constructor=="function"&&!Jl(e)?Kf(lc(e)):{}}function Zg(e){return function(t,n,r){for(var s=-1,i=Object(t),o=r(t),a=o.length;a--;){var l=o[++s];if(n(i[l],l,i)===!1)break}return t}}var Qg=Zg(),hi=function(){return wn.Date.now()},e_="Expected a function",t_=Math.max,n_=Math.min;function r_(e,t,n){var r,s,i,o,a,l,c=0,u=!1,h=!1,d=!0;if(typeof e!="function")throw new TypeError(e_);t=va(t)||0,Ot(n)&&(u=!!n.leading,h="maxWait"in n,i=h?t_(va(n.maxWait)||0,t):i,d="trailing"in n?!!n.trailing:d);function f(C){var v=r,A=s;return r=s=void 0,c=C,o=e.apply(A,v),o}function g(C){return c=C,a=setTimeout(b,t),u?f(C):o}function _(C){var v=C-l,A=C-c,H=t-v;return h?n_(H,i-A):H}function R(C){var v=C-l,A=C-c;return l===void 0||v>=t||v<0||h&&A>=i}function b(){var C=hi();if(R(C))return F(C);a=setTimeout(b,_(C))}function F(C){return a=void 0,d&&r?f(C):(r=s=void 0,o)}function k(){a!==void 0&&clearTimeout(a),c=0,r=l=s=a=void 0}function W(){return a===void 0?o:F(hi())}function S(){var C=hi(),v=R(C);if(r=arguments,s=this,l=C,v){if(a===void 0)return g(l);if(h)return clearTimeout(a),a=setTimeout(b,t),f(l)}return a===void 0&&(a=setTimeout(b,t)),o}return S.cancel=k,S.flush=W,S}function xi(e,t,n){(n!==void 0&&!$s(e[t],n)||n===void 0&&!(t in e))&&_o(e,t,n)}function s_(e){return Zn(e)&&po(e)}function Ui(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}function i_(e){return lm(e,rc(e))}function o_(e,t,n,r,s,i,o){var a=Ui(e,n),l=Ui(t,n),c=o.get(l);if(c){xi(e,n,c);return}var u=i?i(a,l,n+"",e,t,o):void 0,h=u===void 0;if(h){var d=Kn(l),f=!d&&ec(l),g=!d&&!f&&nc(l);u=l,d||f||g?Kn(a)?u=a:s_(a)?u=qf(a):f?(h=!1,u=Kg(l)):g?(h=!1,u=qg(l)):u=[]:Bg(l)||Li(l)?(u=a,Li(a)?u=i_(a):(!Ot(a)||fo(a))&&(u=Jg(l))):h=!1}h&&(o.set(l,u),s(u,l,r,i,o),o.delete(l)),xi(e,n,u)}function Co(e,t,n,r,s){e!==t&&Qg(t,function(i,o){if(s||(s=new Qn),Ot(i))o_(e,t,o,n,Co,r,s);else{var a=r?r(Ui(e,o),i,o+"",e,t,s):void 0;a===void 0&&(a=i),xi(e,o,a)}},rc)}var a_=ql(function(e,t,n,r){Co(e,t,n,r)}),Ys=ql(function(e,t,n){Co(e,t,n)});function l_(e,t,n,r){if(!Ot(e))return e;t=ic(t,e);for(var s=-1,i=t.length,o=i-1,a=e;a!=null&&++s<i;){var l=oc(t[s]),c=n;if(l==="__proto__"||l==="constructor"||l==="prototype")return e;if(s!=o){var u=a[l];c=void 0,c===void 0&&(c=Ot(u)?u:go(t[s+1])?[]:{})}Kl(a,l,c),a=a[l]}return e}function c_(e,t,n){return e==null?e:l_(e,t,n)}class vn{constructor(){p(this,"cursor",0)}reset(){return this.cursor=0,this}moveCursor(t){this.cursor+=t}moveCursorTo(t){this.cursor=t}}function u_(e,t){for(const n in t)t.hasOwnProperty(n)&&(e[n]=t[n])}function hc(e){return/^-?\d+(\.\d+)?$/.test(e)}function h_(e){return hc(e)?Number(e)<=Number.MAX_SAFE_INTEGER:!1}function d_(e){return Number(e)>Number.MAX_SAFE_INTEGER||e.length>=18}class Ro{constructor(){p(this,"_data",[])}static create(){return new Ro}add(t){this._data.indexOf(t)>-1||this._data.push(t)}delete(t){const n=this._data.indexOf(t);this._data.splice(n,1)}getData(){return this._data}}class Io{constructor(){p(this,"_data",new Map)}static create(){return new Io}add(t,n){this._data.has(t)||this._data.set(t,n)}delete(t){this._data.delete(t)}getData(){return this._data}}function f_(e){const t=new MessageChannel;let n=!1;const r=()=>{n||e()};return t.port1.onmessage=r,t.port2.postMessage(null),()=>{n=!0,t.port1.onmessage=null,t.port1.close(),t.port2.close()}}async function dc(e){for(const[t,n]of e.entries())try{if(!await n())return{index:t,result:!1}}catch(r){return{index:t,result:!1,error:r}}return{result:!0,index:-1}}function fc(e){for(const[t,n]of e.entries())try{if(!n())return{index:t,result:!1}}catch(r){return{index:t,result:!1,error:r}}return{result:!0,index:-1}}function m_(e,t){return t.forEach(n=>e.add(n)),e}function g_(e){return e instanceof le.Subscription||e instanceof le.Subject||e&&"closed"in e&&typeof e.unsubscribe<"u"}function We(e){let t=!1;return e?g_(e)?{dispose:()=>e.unsubscribe()}:typeof e=="function"?{dispose:()=>{t||(t=!0,e())}}:e:We(()=>{})}function __(e){return We(()=>{e.unsubscribe()})}class Vs{constructor(){p(this,"_disposables",new Set)}add(t){const n=We(t);return this._disposables.add(n),{dispose:(r=!1)=>{r||n.dispose(),this._disposables.delete(n)}}}dispose(){this._disposables.forEach(t=>{t.dispose()}),this._disposables.clear()}}class Xe{constructor(){p(this,"_disposed",!1);p(this,"_collection",new Vs)}disposeWithMe(t){return this._collection.add(t)}ensureNotDisposed(){if(this._disposed)throw new Error("[Disposable]: object is disposed!")}dispose(){this._disposed||(this._disposed=!0,this._collection.dispose())}}class p_ extends Xe{constructor(){super(...arguments);p(this,"dispose$",new le.Subject)}dispose(){super.dispose(),this.dispose$.next(),this.dispose$.complete()}}class E_ extends Xe{constructor(n){super();p(this,"_ref",0);this._rootDisposable=n}inc(){if(this._disposed)throw new Error("[RCDisposable]: should not ref to a disposed.");this._ref+=1}dec(){this._ref-=1,this._ref===0&&(this._rootDisposable.dispose(),this.dispose())}}var we=(e=>(e[e.UNIVER_UNKNOWN=0]="UNIVER_UNKNOWN",e[e.UNIVER_DOC=1]="UNIVER_DOC",e[e.UNIVER_SHEET=2]="UNIVER_SHEET",e[e.UNIVER_SLIDE=3]="UNIVER_SLIDE",e[e.UNIVER_PROJECT=4]="UNIVER_PROJECT",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e))(we||{}),Ie=(e=>(e[e.Reader=0]="Reader",e[e.Editor=1]="Editor",e[e.Owner=2]="Owner",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e))(Ie||{}),Pi=(e=>(e[e.SomeCollaborator=0]="SomeCollaborator",e[e.AllCollaborator=1]="AllCollaborator",e[e.OneSelf=2]="OneSelf",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e))(Pi||{});class zs extends Xe{}const C_="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let R_=e=>crypto.getRandomValues(new Uint8Array(e)),I_=(e,t,n)=>{let r=(2<<Math.log2(e.length-1))-1,s=-~(1.6*r*t/e.length);return(i=t)=>{let o="";for(;;){let a=n(s),l=s|0;for(;l--;)if(o+=e[a[l]&r]||"",o.length>=i)return o}}},S_=(e,t=21)=>I_(e,t|0,R_),O_=(e=21)=>{let t="",n=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+=C_[n[e]&63];return t};const mc=new Set(["ac","ad","ae","aero","af","ag","ai","al","am","ao","aq","ar","arpa","as","asia","at","au","aw","ax","az","ba","bb","bd","be","bf","bg","bh","bi","biz","bj","bm","bn","bo","br","bs","bt","bv","bw","by","bz","ca","cat","cc","cd","cf","cg","ch","ci","ck","cl","cm","cn","co","com","coop","cr","cu","cv","cw","cx","cy","cz","de","dj","dk","dm","do","dz","ec","edu","ee","eg","er","es","et","eu","fi","fj","fk","fm","fo","fr","ga","gb","gd","ge","gf","gg","gh","gi","gl","gm","gn","gov","gp","gq","gr","gs","gt","gu","gw","gy","hk","hm","hn","hr","ht","hu","id","ie","il","im","in","info","int","io","iq","ir","is","it","je","jm","jo","jobs","jp","ke","kg","kh","ki","km","kn","kp","kr","kw","ky","kz","la","lb","lc","li","lk","lr","ls","lt","lu","lv","ly","ma","mc","md","me","mg","mh","mil","mk","ml","mm","mn","mo","mobi","mp","mq","mr","ms","mt","mu","museum","mv","mw","mx","my","mz","na","name","nc","ne","net","nf","ng","ni","nl","no","np","nr","nu","nz","om","onion","org","pa","pe","pf","pg","ph","pk","pl","pm","pn","post","pr","pro","ps","pt","pw","py","qa","re","ro","rs","ru","rw","sa","sb","sc","sd","se","sg","sh","si","sj","sk","sl","sm","sn","so","sr","ss","st","su","sv","sx","sy","sz","tc","td","tel","tf","tg","th","tj","tk","tl","tm","tn","to","tr","tt","tv","tw","tz","ua","ug","uk","us","uy","uz","va","vc","ve","vg","vi","vn","vu","wf","ws","yt","za","zm","zw"]),w_=new RegExp("^(?:(?:(?:https?|ftp):)?\\/\\/)?(?:\\S+(?::\\S*)?@)?(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z0-9\\u00a1-\\uffff][a-z0-9\\u00a1-\\uffff_-]{0,62})?[a-z0-9\\u00a1-\\uffff]\\.)+(?:[a-z\\u00a1-\\uffff]{2,}\\.?))(?::\\d{2,5})?(?:[/?#]\\S*)?$","i");function v_(e){if(!Number.isNaN(+e))return!1;if(e.startsWith("http://localhost:3002")||e.startsWith("localhost:3002"))return!0;if(w_.test(e)){if(gc(e))return!0;try{const r=new URL(_c(e)).hostname.split(".").pop();if(r&&mc.has(r))return!0}catch{return!1}}return!1}function gc(e){return/^[a-zA-Z]+:\/\//.test(e)}function b_(e){return/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/.test(e)}function _c(e){return gc(e)?e:b_(e)?`mailto://${e}`:`https://${e}`}const Zt=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"];function So(e,t){const n=Z.getValueType(e),r=Z.getValueType(t);return n!==r?!1:Z.isArray(e)?y_(e,t):Z.isObject(e)?A_(e,t):Z.isDate(e)?e.getTime()===t.getTime():Z.isRegExp(e)?e.toString()===t.toString():e===t}function y_(e,t){if(e.length!==t.length)return!1;for(let n=0,r=e.length;n<r;n++){const s=e[n],i=t[n];if(!So(s,i))return!1}return!0}function A_(e,t){const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const s of n){if(!r.includes(s))return!1;const i=e[s],o=t[s];if(!So(i,o))return!1}return!0}class Z{static deleteNull(t){for(const n in t)(t[n]===null||t[n]===void 0)&&delete t[n];return t}static stringAt(t){let n="",r=t;for(;r>=Zt.length;)r/=Zt.length,r-=1,n+=Zt[r%Zt.length];const s=t%Zt.length;return n+=Zt[s],n}static indexAt(t){let n=0;for(let r=0;r<t.length-1;r+=1){const s=t.charCodeAt(r)-65,i=t.length-1-r;n+=Zt.length**i+Zt.length*s}return n+=t.charCodeAt(t.length-1)-65,n}static deleteBlank(t){return Z.isString(t)?t.replace(/\s/g,""):t}static getSystemType(){const t=navigator.userAgent,n=navigator.platform==="Win32"||navigator.platform==="Windows",r=navigator.platform==="Mac68K"||navigator.platform==="MacPPC"||navigator.platform==="Macintosh"||navigator.platform==="MacIntel";if(r)return"Mac";if(navigator.platform==="X11"&&!n&&!r)return"Unix";if(String(navigator.platform).indexOf("Linux")>-1)return"Linux";if(n){if(t.indexOf("Windows NT 5.0")>-1||t.indexOf("Windows 2000")>-1)return"Windows 2000";if(t.indexOf("Windows NT 5.1")>-1||t.indexOf("Windows XP")>-1)return"Windows XP";if(t.indexOf("Windows NT 5.2")>-1||t.indexOf("Windows 2003")>-1)return"Windows 2003";if(t.indexOf("Windows NT 6.0")>-1||t.indexOf("Windows Vista")>-1)return"Windows Vista";if(t.indexOf("Windows NT 6.1")>-1||t.indexOf("Windows 7")>-1)return"Windows 7";if(t.indexOf("Windows NT 10")>-1||t.indexOf("Windows 10")>-1)return"Windows 10";if(t.indexOf("Windows NT 11")>-1||t.indexOf("Windows 11")>-1)return"Windows 11"}return"Unknown system"}static getBrowserType(){const t=navigator.userAgent,n=t.indexOf("Opera")>-1,r=t.indexOf("compatible")>-1&&t.indexOf("MSIE")>-1&&!n,s=t.indexOf("Trident")>-1&&t.indexOf("rv:11.0")>-1,i=t.indexOf("Edge")>-1,o=t.indexOf("Firefox")>-1,a=t.indexOf("Safari")>-1&&t.indexOf("Chrome")===-1,l=t.indexOf("Chrome")>-1&&t.indexOf("Safari")>-1;if(r){new RegExp("MSIE (\\d+\\.\\d+);").test(t);const u=Number.parseFloat(RegExp.$1);return u===7?"IE7":u===8?"IE8":u===9?"IE9":u===10?"IE10":"0"}return o?"FF":n?"Opera":a?"Safari":l?"Chrome":i?"Edge":s?"IE11":"Unknown browser"}static getClassName(t){return t.constructor.name}static deepMerge(t,...n){n.forEach(o=>o&&i(o));function r(o,a){o.forEach((l,c)=>{var u,h;if(Z.isArray(l)){const d=(u=a[c])!=null?u:[];a[c]=d,r(l,d);return}if(Z.isObject(l)){const d=(h=a[c])!=null?h:{};a[c]=d,s(l,d);return}a[c]=l})}function s(o,a){Object.keys(o).forEach(l=>{var u,h;const c=o[l];if(Z.isObject(c)){const d=(u=a[l])!=null?u:{};a[l]=d,s(c,d);return}if(Z.isArray(c)){const d=(h=a[l])!=null?h:[];a[l]=d,r(c,d);return}a[l]=c})}function i(o){Object.keys(o).forEach(a=>{var c,u;const l=o[a];if(Z.isArray(l)){const h=(c=t[a])!=null?c:[];t[a]=h,r(l,h);return}if(Z.isObject(l)){const h=(u=t[a])!=null?u:{};t[a]=h,s(l,h);return}t[a]=l})}return t}static numberFixed(t,n){return Number(Number(t).toFixed(n))}static diffValue(t,n){return So(t,n)}static deepClone(t){if(!this.isDefine(t))return t;if(this.isRegExp(t))return new RegExp(t);if(this.isDate(t))return new Date(t);if(this.isArray(t)){const n=[];return t.forEach((r,s)=>{n[s]=Z.deepClone(r)}),n}if(this.isObject(t)){const n={};return Object.keys(t).forEach(r=>{const s=t[r];n[r]=Z.deepClone(s)}),Object.setPrototypeOf(n,Object.getPrototypeOf(t)),n}return t}static getLanguage(){const t="en-US";return globalThis.navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||t}static getValueType(t){return Object.prototype.toString.apply(t)}static isDefine(t){return t!=null}static isBlank(t){return this.isDefine(t)?this.isString(t)?t.trim()==="":!1:!0}static isPlainObject(t){return this.isDefine(t)?Object.getPrototypeOf(t)===Object.getPrototypeOf({}):!1}static isDate(t){return this.getValueType(t)==="[object Date]"}static isRegExp(t){return this.getValueType(t)==="[object RegExp]"}static isArray(t){return this.getValueType(t)==="[object Array]"}static isString(t){return this.getValueType(t)==="[object String]"}static isNumber(t){return this.getValueType(t)==="[object Number]"}static isStringNumber(t){return!isNaN(Number.parseFloat(t))&&isFinite(t)}static isObject(t){return this.getValueType(t)==="[object Object]"}static isEmptyObject(t){for(const n in t)return!1;return!0}static isTablet(){return/ipad|android|android 3.0|xoom|sch-i800|playbook|tablet|kindle/i.test(navigator.userAgent.toLowerCase())}static isIPhone(){return/iPhone/i.test(navigator.userAgent)}static isLegalUrl(t){return v_(t)}static normalizeUrl(t){return _c(t)}static topLevelDomainCombiningString(){return[...mc].join("|")}static removeNull(t){return this.isObject(t)&&Object.keys(t).forEach(n=>{const r=t[n];r==null?delete t[n]:Z.removeNull(r)}),t}static fillTwoDimensionalArray(t,n,r){return new Array(t).fill(r).map(s=>new Array(n).fill(r))}static numToWord(t){let n="";for(;t>0;){let r=t%26;r=r===0?r=26:r,n=String.fromCharCode(96+r)+n,t=(t-r)/26}return n.toLocaleUpperCase()}static ABCatNum(t){if(t==null||t.length===0)return Number.NaN;const n=t.toLowerCase().split(""),r=n.length;let s=0,i=0;for(let o=0;o<r;o++)i=n[o].charCodeAt(0)-96,s+=i*26**(r-o-1);return s===0?Number.NaN:s-1}static chatAtABC(t){let i="";for(;t>=0;)i=String.fromCharCode(t%26+97)+i,t=Math.floor(t/26)-1;return i.toUpperCase()}static commonExtend(t,n){const r={};for(const s in t)r[s]=t[s];for(const s in n)n[s]!=null&&(r[s]=n[s]);return r}static hasIntersectionBetweenTwoRanges(t,n,r,s){return n>=r&&s>=t}static isStartValidPosition(t){return/^[A-Za-zА-Яа-яЁё_]/.test(t)}static isValidParameter(t){const n=/[~!@#$%^&*()+=\-{}\[\]\|:;"'<>,?\/ ]+/.test(t),r=t.length<=255;return!n&&r}static clamp(t,n,r){return Math.max(n,Math.min(r,t))}static now(){return performance&&performance.now?performance.now():Date.now()}}function nt(e=21,t){return t?S_(t,e)():O_(e)}function cr(...e){const t={},n=e.length;for(let r=n-1;r>=0;r--){const s=e[r];if(s){const i=Object.keys(s);for(const o of i)t[o]===void 0&&(t[o]=s[o])}}return t}const T_=()=>typeof process<"u"&&process.versions!=null&&process.versions.node!=null;function N_(e){const n=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/\\\*/g,".*").replace(/\\\?/g,".");return new RegExp(`^${n}$`,"i")}var pc=(e=>(e[e.DEFAULT_SERIES=0]="DEFAULT_SERIES",e[e.ALTERNATE_SERIES=1]="ALTERNATE_SERIES",e))(pc||{}),xe=(e=>(e[e.NONE=0]="NONE",e[e.THIN=1]="THIN",e[e.HAIR=2]="HAIR",e[e.DOTTED=3]="DOTTED",e[e.DASHED=4]="DASHED",e[e.DASH_DOT=5]="DASH_DOT",e[e.DASH_DOT_DOT=6]="DASH_DOT_DOT",e[e.DOUBLE=7]="DOUBLE",e[e.MEDIUM=8]="MEDIUM",e[e.MEDIUM_DASHED=9]="MEDIUM_DASHED",e[e.MEDIUM_DASH_DOT=10]="MEDIUM_DASH_DOT",e[e.MEDIUM_DASH_DOT_DOT=11]="MEDIUM_DASH_DOT_DOT",e[e.SLANT_DASH_DOT=12]="SLANT_DASH_DOT",e[e.THICK=13]="THICK",e))(xe||{}),Ec=(e=>(e.TOP="top",e.BOTTOM="bottom",e.LEFT="left",e.RIGHT="right",e.NONE="none",e.ALL="all",e.OUTSIDE="outside",e.INSIDE="inside",e.HORIZONTAL="horizontal",e.VERTICAL="vertical",e.TLBR="tlbr",e.TLBC_TLMR="tlbc_tlmr",e.TLBR_TLBC_TLMR="tlbr_tlbc_tlmr",e.BLTR="bl_tr",e.MLTR_BCTR="mltr_bctr",e))(Ec||{}),It=(e=>(e[e.UNSUPPORTED=0]="UNSUPPORTED",e[e.RGB=1]="RGB",e[e.HEX=2]="HEX",e[e.THEME=3]="THEME",e))(It||{}),Cc=(e=>(e[e.ON=0]="ON",e[e.OFF=1]="OFF",e))(Cc||{}),Rc=(e=>(e[e.PASTE_NORMAL=0]="PASTE_NORMAL",e[e.PASTE_NO_BORDERS=1]="PASTE_NO_BORDERS",e[e.PASTE_FORMAT=2]="PASTE_FORMAT",e[e.PASTE_FORMULA=3]="PASTE_FORMULA",e[e.PASTE_DATA_VALIDATION=4]="PASTE_DATA_VALIDATION",e[e.PASTE_VALUES=5]="PASTE_VALUES",e[e.PASTE_CONDITIONAL_FORMATTING=6]="PASTE_CONDITIONAL_FORMATTING",e[e.PASTE_COLUMN_WIDTHS=7]="PASTE_COLUMN_WIDTHS",e))(Rc||{}),Ic=(e=>(e[e.LEFT=0]="LEFT",e[e.RIGHT=1]="RIGHT",e))(Ic||{}),Sc=(e=>(e[e.DOCUMENT=0]="DOCUMENT",e[e.PROJECT=1]="PROJECT",e))(Sc||{}),Oc=(e=>(e[e.COLUMNS=0]="COLUMNS",e[e.ROWS=1]="ROWS",e))(Oc||{}),wc=(e=>(e[e.UP=0]="UP",e[e.RIGHT=1]="RIGHT",e[e.DOWN=2]="DOWN",e[e.LEFT=3]="LEFT",e))(wc||{});function M_(e){switch(e){case 3:return 1;case 1:return 3;case 0:return 2;case 2:return 0}}var vc=(e=>(e[e.INTERPOLATION_POINT_TYPE_UNSPECIFIED=0]="INTERPOLATION_POINT_TYPE_UNSPECIFIED",e[e.MIN=1]="MIN",e[e.MAX=2]="MAX",e[e.NUMBER=3]="NUMBER",e[e.PERCENT=4]="PERCENT",e[e.PERCENTILE=5]="PERCENTILE",e))(vc||{}),Hr=(e=>(e.EN_US="enUS",e.FR_FR="frFR",e.ZH_CN="zhCN",e.RU_RU="ruRU",e.ZH_TW="zhTW",e.VI_VN="viVN",e.FA_IR="faIR",e.JA_JP="jaJP",e.KO_KR="koKR",e.ES_ES="esES",e.CA_ES="caES",e))(Hr||{}),ys=(e=>(e[e.PERSON=0]="PERSON",e[e.FILE=1]="FILE",e[e.DATE=2]="DATE",e[e.LOCATION=3]="LOCATION",e[e.EVENT=4]="EVENT",e))(ys||{}),bc=(e=>(e[e.RANGE=0]="RANGE",e[e.SHEET=1]="SHEET",e))(bc||{}),yc=(e=>(e.Line="line",e.LineInv="lineInv",e.Triangle="triangle",e.RtTriangle="rtTriangle",e.Rect="rect",e.Diamond="diamond",e.Parallelogram="parallelogram",e.Trapezoid="trapezoid",e.NonIsocelesTrapezoid="nonIsocelesTrapezoid",e.Pentagon="pentagon",e.Hexagon="hexagon",e.Heptagon="heptagon",e.Octagon="octagon",e.Decagon="decagon",e.Dodecagon="dodecagon",e.Star4="star4",e.Star5="star5",e.Star6="star6",e.Star7="star7",e.Star8="star8",e.Star10="star10",e.Star12="star12",e.Star16="star16",e.Star24="star24",e.Star32="star32",e.RoundRect="roundRect",e.Round1Rect="round1Rect",e.Round2SameRect="round2SameRect",e.Round2DiagRect="round2DiagRect",e.Ellipse="ellipse",e))(yc||{}),Ac=(e=>(e.RightArrow="rightArrow",e.LeftArrow="leftArrow",e.UpArrow="upArrow",e.DownArrow="downArrow",e.LeftRightArrow="leftRightArrow",e.UpDownArrow="upDownArrow",e.QuadArrow="quadArrow",e.LeftRightUpArrow="leftRightUpArrow",e.BentArrow="bentArrow",e.UturnArrow="uturnArrow",e.CircularArrow="circularArrow",e.NotchedRightArrow="notchedRightArrow",e.HomePlate="homePlate",e.Chevron="chevron",e.LeftCircularArrow="leftCircularArrow",e.LeftRightCircularArrow="leftRightCircularArrow",e))(Ac||{}),Tc=(e=>(e.Plaque="plaque",e.Can="can",e.Cube="cube",e.Bevel="bevel",e.Donut="donut",e.NoSmoking="noSmoking",e.BlockArc="blockArc",e.FoldedCorner="foldedCorner",e))(Tc||{}),Nc=(e=>(e.SmileyFace="smileyFace",e.Heart="heart",e.LightningBolt="lightningBolt",e.Sun="sun",e.Moon="moon",e.Cloud="cloud",e.Arc="arc",e.Backpack="backpack",e.Frame="frame",e.HalfFrame="halfFrame",e.Corner="corner",e.Chord="chord",e.Pie="pie",e.Teardrop="teardrop",e.WedgeRectCallout="wedgeRectCallout",e.WedgeRRectCallout="wedgeRRectCallout",e.WedgeEllipseCallout="wedgeEllipseCallout",e.CloudCallout="cloudCallout",e.BorderCallout1="borderCallout1",e.BorderCallout2="borderCallout2",e.BorderCallout3="borderCallout3",e.AccentCallout1="accentCallout1",e.AccentCallout2="accentCallout2",e.AccentCallout3="accentCallout3",e.Callout1="callout1",e.Callout2="callout2",e.Callout3="callout3",e.ActionButtonBackPrevious="actionButtonBackPrevious",e.ActionButtonEnd="actionButtonEnd",e.ActionButtonForwardNext="actionButtonForwardNext",e.ActionButtonHelp="actionButtonHelp",e.ActionButtonHome="actionButtonHome",e.ActionButtonInformation="actionButtonInformation",e.ActionButtonMovie="actionButtonMovie",e.ActionButtonReturn="actionButtonReturn",e.ActionButtonSound="actionButtonSound",e))(Nc||{}),Mc=(e=>(e[e.RELATIVE_DATE_UNSPECIFIED=0]="RELATIVE_DATE_UNSPECIFIED",e[e.PAST_YEAR=1]="PAST_YEAR",e[e.PAST_MONTH=2]="PAST_MONTH",e[e.PAST_WEEK=3]="PAST_WEEK",e[e.YESTERDAY=4]="YESTERDAY",e[e.TODAY=5]="TODAY",e[e.TOMORROW=6]="TOMORROW",e))(Mc||{}),Dc=(e=>(e[e.GRID=0]="GRID",e[e.KANBAN=1]="KANBAN",e[e.GANTT=2]="GANTT",e))(Dc||{}),Nr=(e=>(e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.LEFT_TO_RIGHT=1]="LEFT_TO_RIGHT",e[e.RIGHT_TO_LEFT=2]="RIGHT_TO_LEFT",e))(Nr||{}),Lc=(e=>(e[e.DASH=0]="DASH",e[e.DASH_DOT_DOT_HEAVY=1]="DASH_DOT_DOT_HEAVY",e[e.DASH_DOT_HEAVY=2]="DASH_DOT_HEAVY",e[e.DASHED_HEAVY=3]="DASHED_HEAVY",e[e.DASH_LONG=4]="DASH_LONG",e[e.DASH_LONG_HEAVY=5]="DASH_LONG_HEAVY",e[e.DOT_DASH=6]="DOT_DASH",e[e.DOT_DOT_DASH=7]="DOT_DOT_DASH",e[e.DOTTED=8]="DOTTED",e[e.DOTTED_HEAVY=9]="DOTTED_HEAVY",e[e.DOUBLE=10]="DOUBLE",e[e.NONE=11]="NONE",e[e.SINGLE=12]="SINGLE",e[e.THICK=13]="THICK",e[e.WAVE=14]="WAVE",e[e.WAVY_DOUBLE=15]="WAVY_DOUBLE",e[e.WAVY_HEAVY=16]="WAVY_HEAVY",e[e.WORDS=17]="WORDS",e))(Lc||{}),Nt=(e=>(e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.LEFT=1]="LEFT",e[e.CENTER=2]="CENTER",e[e.RIGHT=3]="RIGHT",e[e.JUSTIFIED=4]="JUSTIFIED",e[e.BOTH=5]="BOTH",e[e.DISTRIBUTED=6]="DISTRIBUTED",e))(Nt||{}),pn=(e=>(e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.TOP=1]="TOP",e[e.MIDDLE=2]="MIDDLE",e[e.BOTTOM=3]="BOTTOM",e))(pn||{}),Sn=(e=>(e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.OVERFLOW=1]="OVERFLOW",e[e.CLIP=2]="CLIP",e[e.WRAP=3]="WRAP",e))(Sn||{}),As=(e=>(e[e.NORMAL=0]="NORMAL",e[e.ITALIC=1]="ITALIC",e))(As||{}),Ts=(e=>(e[e.NORMAL=0]="NORMAL",e[e.BOLD=1]="BOLD",e))(Ts||{}),Vt=(e=>(e[e.NORMAL=1]="NORMAL",e[e.SUBSCRIPT=2]="SUBSCRIPT",e[e.SUPERSCRIPT=3]="SUPERSCRIPT",e))(Vt||{}),ie=(e=>(e[e.FALSE=0]="FALSE",e[e.TRUE=1]="TRUE",e))(ie||{}),nn=(e=>(e[e.STRING=1]="STRING",e[e.NUMBER=2]="NUMBER",e[e.BOOLEAN=3]="BOOLEAN",e[e.FORCE_STRING=4]="FORCE_STRING",e))(nn||{}),ot=(e=>(e[e.DARK1=0]="DARK1",e[e.LIGHT1=1]="LIGHT1",e[e.DARK2=2]="DARK2",e[e.LIGHT2=3]="LIGHT2",e[e.ACCENT1=4]="ACCENT1",e[e.ACCENT2=5]="ACCENT2",e[e.ACCENT3=6]="ACCENT3",e[e.ACCENT4=7]="ACCENT4",e[e.ACCENT5=8]="ACCENT5",e[e.ACCENT6=9]="ACCENT6",e[e.HYPERLINK=10]="HYPERLINK",e[e.FOLLOWED_HYPERLINK=11]="FOLLOWED_HYPERLINK",e))(ot||{}),Gs=(e=>(e.OFFICE="Office",e.OFFICE_2007_2010="Office 2007-2010",e.GRAYSCALE="Grayscale",e.BLUE_WARM="Blue Warm",e.BLUE="Blue",e.BLUE_II="Blue II",e.BLUE_GREEN="Blue Green",e.GREEN="Green",e.GREEN_YELLOW="Green Yellow",e.YELLOW="Yellow",e.YELLOW_ORANGE="Yellow Orange",e.ORANGE="Orange",e.ORANGE_RED="Orange Red",e.RED_ORANGE="Red Orange",e.RED="Red",e.RED_VIOLET="Red Violet",e.VIOLET="Violet",e.VIOLET_II="Violet II",e.MEDIAN="Median",e.PAPER="Paper",e.MARQUEE="Marquee",e.SLIPSTREAM="Slipstream",e.Aspect="Aspect",e))(Gs||{}),xc=(e=>(e[e.character=0]="character",e[e.paragraph=1]="paragraph",e[e.table=2]="table",e[e.numbering=3]="numbering",e))(xc||{}),Uc=(e=>(e[e.TAB=0]="TAB",e[e.SPACE=1]="SPACE",e[e.NOTHING=2]="NOTHING",e))(Uc||{}),fe=(e=>(e[e.BULLET=0]="BULLET",e[e.NONE=1]="NONE",e[e.DECIMAL=2]="DECIMAL",e[e.DECIMAL_ZERO=3]="DECIMAL_ZERO",e[e.UPPER_LETTER=4]="UPPER_LETTER",e[e.LOWER_LETTER=5]="LOWER_LETTER",e[e.UPPER_ROMAN=6]="UPPER_ROMAN",e[e.LOWER_ROMAN=7]="LOWER_ROMAN",e[e.ORDINAL=8]="ORDINAL",e[e.CARDINAL_TEXT=9]="CARDINAL_TEXT",e[e.ORDINAL_TEXT=10]="ORDINAL_TEXT",e[e.HEX=11]="HEX",e[e.CHICAGO=12]="CHICAGO",e[e.IDEOGRAPH_DIGITAL=13]="IDEOGRAPH_DIGITAL",e[e.JAPANESE_COUNTING=14]="JAPANESE_COUNTING",e[e.AIUEO=15]="AIUEO",e[e.IROHA=16]="IROHA",e[e.DECIMAL_FULL_WIDTH=17]="DECIMAL_FULL_WIDTH",e[e.DECIMAL_HALF_WIDTH=18]="DECIMAL_HALF_WIDTH",e[e.JAPANESE_LEGAL=19]="JAPANESE_LEGAL",e[e.JAPANESE_DIGITAL_TEN_THOUSAND=20]="JAPANESE_DIGITAL_TEN_THOUSAND",e[e.DECIMAL_ENCLOSED_CIRCLE=21]="DECIMAL_ENCLOSED_CIRCLE",e[e.DECIMAL_FULL_WIDTH2=22]="DECIMAL_FULL_WIDTH2",e[e.AIUEO_FULL_WIDTH=23]="AIUEO_FULL_WIDTH",e[e.IROHA_FULL_WIDTH=24]="IROHA_FULL_WIDTH",e[e.GANADA=25]="GANADA",e[e.CHOSUNG=26]="CHOSUNG",e[e.DECIMAL_ENCLOSED_FULLSTOP=27]="DECIMAL_ENCLOSED_FULLSTOP",e[e.DECIMAL_ENCLOSED_PAREN=28]="DECIMAL_ENCLOSED_PAREN",e[e.DECIMAL_ENCLOSED_CIRCLE_CHINESE=29]="DECIMAL_ENCLOSED_CIRCLE_CHINESE",e[e.IDEOGRAPH_ENCLOSED_CIRCLE=30]="IDEOGRAPH_ENCLOSED_CIRCLE",e[e.IDEOGRAPH_TRADITIONAL=31]="IDEOGRAPH_TRADITIONAL",e[e.IDEOGRAPH_ZODIAC=32]="IDEOGRAPH_ZODIAC",e[e.IDEOGRAPH_ZODIAC_TRADITIONAL=33]="IDEOGRAPH_ZODIAC_TRADITIONAL",e[e.TAIWANESE_COUNTING=34]="TAIWANESE_COUNTING",e[e.IDEOGRAPH_LEGAL_TRADITIONAL=35]="IDEOGRAPH_LEGAL_TRADITIONAL",e[e.TAIWANESE_COUNTING_THOUSAND=36]="TAIWANESE_COUNTING_THOUSAND",e[e.TAIWANESE_DIGITAL=37]="TAIWANESE_DIGITAL",e[e.CHINESE_COUNTING=38]="CHINESE_COUNTING",e[e.CHINESE_LEGAL_SIMPLIFIED=39]="CHINESE_LEGAL_SIMPLIFIED",e[e.CHINESE_COUNTING_THOUSAND=40]="CHINESE_COUNTING_THOUSAND",e[e.KOREAN_DIGITAL=41]="KOREAN_DIGITAL",e[e.KOREAN_COUNTING=42]="KOREAN_COUNTING",e[e.KOREAN_LEGAL=43]="KOREAN_LEGAL",e[e.KOREAN_DIGITAL2=44]="KOREAN_DIGITAL2",e[e.VIETNAMESE_COUNTING=45]="VIETNAMESE_COUNTING",e[e.RUSSIAN_LOWER=46]="RUSSIAN_LOWER",e[e.RUSSIAN_UPPER=47]="RUSSIAN_UPPER",e[e.NUMBER_IN_DASH=48]="NUMBER_IN_DASH",e[e.HEBREW1=49]="HEBREW1",e[e.HEBREW2=50]="HEBREW2",e[e.ARABIC_ALPHA=51]="ARABIC_ALPHA",e[e.ARABIC_ABJAD=52]="ARABIC_ABJAD",e[e.HINDI_VOWELS=53]="HINDI_VOWELS",e[e.HINDI_CONSONANTS=54]="HINDI_CONSONANTS",e[e.HINDI_NUMBERS=55]="HINDI_NUMBERS",e[e.HINDI_COUNTING=56]="HINDI_COUNTING",e[e.THAI_LETTERS=57]="THAI_LETTERS",e[e.THAI_NUMBERS=58]="THAI_NUMBERS",e[e.THAI_COUNTING=59]="THAI_COUNTING",e[e.CUSTOM=60]="CUSTOM",e))(fe||{}),Br=(e=>(e[e.BULLET_ALIGNMENT_UNSPECIFIED=0]="BULLET_ALIGNMENT_UNSPECIFIED",e[e.START=1]="START",e[e.CENTER=2]="CENTER",e[e.END=3]="END",e[e.BOTH=4]="BOTH",e))(Br||{}),on=(e=>(e[e.HYPERLINK=0]="HYPERLINK",e[e.FIELD=1]="FIELD",e[e.SDT=2]="SDT",e[e.BOOKMARK=3]="BOOKMARK",e[e.COMMENT=4]="COMMENT",e[e.CUSTOM=5]="CUSTOM",e[e.MENTION=6]="MENTION",e[e.UNI_FORMULA=7]="UNI_FORMULA",e[e.DELTED=9999]="DELTED",e))(on||{}),En=(e=>(e[e.COMMENT=0]="COMMENT",e[e.DELETED=9999]="DELETED",e))(En||{}),Pc=(e=>(e[e.DRAWING=0]="DRAWING",e[e.CUSTOM=1]="CUSTOM",e))(Pc||{}),Oo=(e=>(e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.TRADITIONAL=1]="TRADITIONAL",e[e.MODERN=2]="MODERN",e))(Oo||{}),kc=(e=>(e[e.DEFAULT=0]="DEFAULT",e[e.LINES=1]="LINES",e[e.LINES_AND_CHARS=2]="LINES_AND_CHARS",e[e.SNAP_TO_CHARS=3]="SNAP_TO_CHARS",e))(kc||{}),Fc=(e=>(e[e.SECTION_TYPE_UNSPECIFIED=0]="SECTION_TYPE_UNSPECIFIED",e[e.CONTINUOUS=1]="CONTINUOUS",e[e.NEXT_PAGE=2]="NEXT_PAGE",e[e.EVEN_PAGE=3]="EVEN_PAGE",e[e.ODD_PAGE=4]="ODD_PAGE",e))(Fc||{}),Hc=(e=>(e[e.COLUMN_SEPARATOR_STYLE_UNSPECIFIED=0]="COLUMN_SEPARATOR_STYLE_UNSPECIFIED",e[e.NONE=1]="NONE",e[e.BETWEEN_EACH_COLUMN=2]="BETWEEN_EACH_COLUMN",e))(Hc||{}),Bc=(e=>(e[e.NORMAL=0]="NORMAL",e[e.TBRL=1]="TBRL",e[e.LRTBV=2]="LRTBV",e))(Bc||{}),$c=(e=>(e[e.TEXT_RUN=0]="TEXT_RUN",e[e.AUTO_TEXT=1]="AUTO_TEXT",e[e.PAGE_BREAK=2]="PAGE_BREAK",e[e.COLUMN_BREAK=3]="COLUMN_BREAK",e[e.FOOT_NOTE_REFERENCE=4]="FOOT_NOTE_REFERENCE",e[e.HORIZONTAL_RULE=5]="HORIZONTAL_RULE",e[e.EQUATION=6]="EQUATION",e[e.DRAWING=7]="DRAWING",e[e.PERSON=8]="PERSON",e[e.RICH_LINK=9]="RICH_LINK",e))($c||{}),jc=(e=>(e[e.BOTH_SIDES=0]="BOTH_SIDES",e[e.LEFT=1]="LEFT",e[e.RIGHT=2]="RIGHT",e[e.LARGEST=3]="LARGEST",e))(jc||{}),Wc=(e=>(e[e.INLINE=0]="INLINE",e[e.WRAP_NONE=1]="WRAP_NONE",e[e.WRAP_POLYGON=2]="WRAP_POLYGON",e[e.WRAP_SQUARE=3]="WRAP_SQUARE",e[e.WRAP_THROUGH=4]="WRAP_THROUGH",e[e.WRAP_TIGHT=5]="WRAP_TIGHT",e[e.WRAP_TOP_AND_BOTTOM=6]="WRAP_TOP_AND_BOTTOM",e))(Wc||{}),qe=(e=>(e[e.NAMED_STYLE_TYPE_UNSPECIFIED=0]="NAMED_STYLE_TYPE_UNSPECIFIED",e[e.NORMAL_TEXT=1]="NORMAL_TEXT",e[e.TITLE=2]="TITLE",e[e.SUBTITLE=3]="SUBTITLE",e[e.HEADING_1=4]="HEADING_1",e[e.HEADING_2=5]="HEADING_2",e[e.HEADING_3=6]="HEADING_3",e[e.HEADING_4=7]="HEADING_4",e[e.HEADING_5=8]="HEADING_5",e))(qe||{}),Yc=(e=>(e[e.AUTO=0]="AUTO",e[e.AT_LEAST=1]="AT_LEAST",e[e.EXACT=2]="EXACT",e))(Yc||{}),Vc=(e=>(e[e.DASH_STYLE_UNSPECIFIED=0]="DASH_STYLE_UNSPECIFIED",e[e.SOLID=1]="SOLID",e[e.DOT=2]="DOT",e[e.DASH=3]="DASH",e))(Vc||{}),zc=(e=>(e[e.TAB_STOP_ALIGNMENT_UNSPECIFIED=0]="TAB_STOP_ALIGNMENT_UNSPECIFIED",e[e.START=1]="START",e[e.CENTER=2]="CENTER",e[e.END=3]="END",e))(zc||{}),Gc=(e=>(e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.SPECIFIED=1]="SPECIFIED",e))(Gc||{}),Kc=(e=>(e[e.START=0]="START",e[e.CENTER=1]="CENTER",e[e.END=2]="END",e))(Kc||{}),Xc=(e=>(e[e.AUTO_FIT=0]="AUTO_FIT",e[e.FIXED=1]="FIXED",e))(Xc||{}),qc=(e=>(e[e.NONE=0]="NONE",e[e.WRAP=1]="WRAP",e))(qc||{}),Jc=(e=>(e[e.AUTO=0]="AUTO",e[e.AT_LEAST=1]="AT_LEAST",e[e.EXACT=2]="EXACT",e))(Jc||{}),Zc=(e=>(e[e.CONTENT_ALIGNMENT_UNSPECIFIED=0]="CONTENT_ALIGNMENT_UNSPECIFIED",e[e.BOTH=1]="BOTH",e[e.TOP=2]="TOP",e[e.CENTER=3]="CENTER",e[e.BOTTOM=4]="BOTTOM",e))(Zc||{}),Fn=(e=>(e.NORMAL="normal",e.BOLD="bold",e.ITALIC="italic",e))(Fn||{}),Qc=(e=>(e[e.PAGE=0]="PAGE",e[e.COLUMN=1]="COLUMN",e[e.CHARACTER=2]="CHARACTER",e[e.MARGIN=3]="MARGIN",e[e.INSIDE_MARGIN=4]="INSIDE_MARGIN",e[e.OUTSIDE_MARGIN=5]="OUTSIDE_MARGIN",e[e.LEFT_MARGIN=6]="LEFT_MARGIN",e[e.RIGHT_MARGIN=7]="RIGHT_MARGIN",e))(Qc||{}),eu=(e=>(e[e.PAGE=0]="PAGE",e[e.PARAGRAPH=1]="PARAGRAPH",e[e.LINE=2]="LINE",e[e.MARGIN=3]="MARGIN",e[e.TOP_MARGIN=4]="TOP_MARGIN",e[e.BOTTOM_MARGIN=5]="BOTTOM_MARGIN",e[e.INSIDE_MARGIN=6]="INSIDE_MARGIN",e[e.OUTSIDE_MARGIN=7]="OUTSIDE_MARGIN",e))(eu||{}),tu=(e=>(e[e.POINT=0]="POINT",e[e.LINE=1]="LINE",e[e.CHARACTER=2]="CHARACTER",e[e.PIXEL=3]="PIXEL",e[e.PERCENT=4]="PERCENT",e))(tu||{}),nu=(e=>(e[e.CENTER=0]="CENTER",e[e.INSIDE=1]="INSIDE",e[e.LEFT=2]="LEFT",e[e.OUTSIDE=3]="OUTSIDE",e[e.RIGHT=4]="RIGHT",e[e.BOTH=5]="BOTH",e[e.DISTRIBUTE=6]="DISTRIBUTE",e))(nu||{}),ru=(e=>(e[e.BOTTOM=0]="BOTTOM",e[e.CENTER=1]="CENTER",e[e.INSIDE=2]="INSIDE",e[e.OUTSIDE=3]="OUTSIDE",e[e.TOP=4]="TOP",e))(ru||{}),su=(e=>(e[e.compressPunctuation=0]="compressPunctuation",e[e.compressPunctuationAndJapaneseKana=1]="compressPunctuationAndJapaneseKana",e[e.doNotCompress=2]="doNotCompress",e))(su||{}),iu=(e=>(e[e.PORTRAIT=0]="PORTRAIT",e[e.LANDSCAPE=1]="LANDSCAPE",e))(iu||{}),ht=(e=>(e.Letter="Letter",e.Tabloid="Tabloid",e.Legal="Legal",e.Statement="Statement",e.Executive="Executive",e.Folio="Folio",e.A3="A3",e.A4="A4",e.A5="A5",e.B4="B4",e.B5="B5",e))(ht||{});const D_=["A3","A4","A5","B4","B5","Letter","Tabloid","Legal","Statement","Executive","Folio"];var ou=(e=>(e[e.forward=0]="forward",e[e.backward=1]="backward",e[e.front=2]="front",e[e.back=3]="back",e))(ou||{}),au=(e=>(e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e[e.DRAWING_IMAGE=0]="DRAWING_IMAGE",e[e.DRAWING_SHAPE=1]="DRAWING_SHAPE",e[e.DRAWING_CHART=2]="DRAWING_CHART",e[e.DRAWING_TABLE=3]="DRAWING_TABLE",e[e.DRAWING_SMART_ART=4]="DRAWING_SMART_ART",e[e.DRAWING_VIDEO=5]="DRAWING_VIDEO",e[e.DRAWING_GROUP=6]="DRAWING_GROUP",e[e.DRAWING_UNIT=7]="DRAWING_UNIT",e[e.DRAWING_DOM=8]="DRAWING_DOM",e))(au||{}),wo=(e=>(e[e.SLIDE=0]="SLIDE",e[e.MASTER=1]="MASTER",e[e.LAYOUT=2]="LAYOUT",e[e.HANDOUT_MASTER=3]="HANDOUT_MASTER",e[e.NOTES_MASTER=4]="NOTES_MASTER",e))(wo||{}),lu=(e=>(e[e.SHAPE=0]="SHAPE",e[e.IMAGE=1]="IMAGE",e[e.TEXT=2]="TEXT",e[e.SPREADSHEET=3]="SPREADSHEET",e[e.DOCUMENT=4]="DOCUMENT",e[e.SLIDE=5]="SLIDE",e))(lu||{}),cu=(e=>(e[e.RELATIVE_SLIDE_LINK_UNSPECIFIED=0]="RELATIVE_SLIDE_LINK_UNSPECIFIED",e[e.NEXT_SLIDE=1]="NEXT_SLIDE",e[e.PREVIOUS_SLIDE=2]="PREVIOUS_SLIDE",e[e.FIRST_SLIDE=3]="FIRST_SLIDE",e[e.LAST_SLIDE=4]="LAST_SLIDE",e))(cu||{});function L_(e=nt(6),t=Hr.EN_US,n=""){return{id:e,locale:t,title:n,tableSource:{},drawings:{},drawingsOrder:[],headers:{},footers:{},body:{dataStream:`\r
|
|
3
|
-
`,textRuns:[],customBlocks:[],tables:[],paragraphs:[{startIndex:0,paragraphStyle:{spaceAbove:{v:5},lineSpacing:1,spaceBelow:{v:0}}}],sectionBreaks:[{startIndex:1}]},documentStyle:{pageSize:{width:793.3333333333334,height:1122.6666666666667},documentFlavor:Oo.TRADITIONAL,marginTop:50,marginBottom:50,marginRight:50,marginLeft:50,renderConfig:{zeroWidthParagraphBreak:ie.FALSE,vertexAngle:0,centerAngle:0,background:{rgb:"#ccc"}},autoHyphenation:ie.TRUE,doNotHyphenateCaps:ie.FALSE,consecutiveHyphenLimit:2,defaultHeaderId:"",defaultFooterId:"",evenPageHeaderId:"",evenPageFooterId:"",firstPageHeaderId:"",firstPageFooterId:"",evenAndOddHeaders:ie.FALSE,useFirstPageHeaderFooter:ie.FALSE,marginHeader:30,marginFooter:30},settings:{}}}var fn={},sr={},Jr={},ka;function x_(){if(ka)return Jr;ka=1,Object.defineProperty(Jr,"__esModule",{value:!0});function e(r,s){if(Array.isArray(s))return!1;for(let i in r)if(!n(r[i],s[i]))return!1;for(let i in s)if(r[i]===void 0)return!1;return!0}function t(r,s){if(!Array.isArray(s)||r.length!==s.length)return!1;for(let i=0;i<r.length;i++)if(!n(r[i],s[i]))return!1;return!0}function n(r,s){return r===s?!0:r===null||s===null||typeof r!="object"||typeof s!="object"?!1:Array.isArray(r)?t(r,s):e(r,s)}return Jr.default=n,Jr}var Zr={},Fa;function U_(){if(Fa)return Zr;Fa=1,Object.defineProperty(Zr,"__esModule",{value:!0});function e(t){if(t===null)return null;if(Array.isArray(t))return t.map(e);if(typeof t=="object"){const n={};for(let r in t)n[r]=e(t[r]);return n}else return t}return Zr.default=e,Zr}var di={},Ha;function uu(){return Ha||(Ha=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.eachChildOf=e.advancer=e.readCursor=e.writeCursor=e.WriteCursor=e.ReadCursor=e.isValidPathItem=void 0;function t(u,h){if(!u)throw new Error(h)}const n=u=>u!=null&&typeof u=="object"&&!Array.isArray(u),r=(u,h)=>typeof u==typeof h?u>h:typeof u=="string"&&typeof h=="number";function s(u,h){for(let d in u){const f=d;h.write(f,u[f])}}e.isValidPathItem=u=>typeof u=="number"||typeof u=="string"&&u!=="__proto__";class i{constructor(h=null){this.parents=[],this.indexes=[],this.lcIdx=-1,this.idx=-1,this.container=h}ascend(){t(this.parents.length===this.indexes.length/2),this.idx===0?this.parents.length?(this.lcIdx=this.indexes.pop(),this.container=this.parents.pop(),this.idx=this.indexes.pop()):(this.lcIdx=0,this.idx=-1):(t(this.idx>0),this.idx--,n(this.container[this.idx])&&this.idx--)}getPath(){const h=[];let d=this.container,f=this.parents.length-1,g=this.idx;for(;g>=0;)h.unshift(d[g]),g===0?(g=this.indexes[f*2],d=this.parents[f--]):g-=n(d[g-1])?2:1;return h}}class o extends i{get(){return this.container?this.container.slice(this.idx+1):null}getKey(){return t(this.container!=null,"Invalid call to getKey before cursor descended"),this.container[this.idx]}getComponent(){let h;return this.container&&this.container.length>this.idx+1&&n(h=this.container[this.idx+1])?h:null}descendFirst(){let h=this.idx+1;if(!this.container||h>=this.container.length||n(this.container[h])&&h+1>=this.container.length)return!1;n(this.container[h])&&h++;const d=this.container[h];return Array.isArray(d)?(this.indexes.push(this.idx),this.parents.push(this.container),this.indexes.push(h),this.idx=0,this.container=d):this.idx=h,!0}nextSibling(){if(t(this.parents.length===this.indexes.length/2),this.idx>0||this.parents.length===0)return!1;const h=this.indexes[this.indexes.length-1]+1,d=this.parents[this.parents.length-1];return h>=d.length?!1:(t(!isNaN(h)),this.indexes[this.indexes.length-1]=h,this.container=d[h],!0)}_init(h,d,f,g){this.container=h,this.idx=d,this.parents=f.slice(),this.indexes=g.slice()}clone(){const h=new o;return h._init(this.container,this.idx,this.parents,this.indexes),h}*[Symbol.iterator](){if(this.descendFirst()){do yield this.getKey();while(this.nextSibling());this.ascend()}}traverse(h,d){const f=this.getComponent();f&&d(f,h);for(const g of this)h&&h.descend(g),this.traverse(h,d),h&&h.ascend()}eachPick(h,d){this.traverse(h,(f,g)=>{f.p!=null&&d(f.p,g)})}eachDrop(h,d){this.traverse(h,(f,g)=>{f.d!=null&&d(f.d,g)})}}e.ReadCursor=o;class a extends i{constructor(h=null){super(h),this.pendingDescent=[],this._op=h}flushDescent(){t(this.parents.length===this.indexes.length/2),this.container===null&&(this._op=this.container=[]);for(let h=0;h<this.pendingDescent.length;h++){const d=this.pendingDescent[h];let f=this.idx+1;if(f<this.container.length&&n(this.container[f])&&f++,t(f===this.container.length||!n(this.container[f])),f===this.container.length)this.container.push(d),this.idx=f;else if(this.container[f]===d)this.idx=f;else{if(!Array.isArray(this.container[f])){const g=this.container.splice(f,this.container.length-f);this.container.push(g),this.lcIdx>-1&&(this.lcIdx=f)}for(this.indexes.push(this.idx),this.parents.push(this.container),this.lcIdx!==-1&&(t(r(d,this.container[this.lcIdx][0])),f=this.lcIdx+1,this.lcIdx=-1);f<this.container.length&&r(d,this.container[f][0]);)f++;if(this.indexes.push(f),this.idx=0,f<this.container.length&&this.container[f][0]===d)this.container=this.container[f];else{const g=[d];this.container.splice(f,0,g),this.container=g}}}this.pendingDescent.length=0}reset(){this.lcIdx=-1}getComponent(){this.flushDescent();const h=this.idx+1;if(h<this.container.length&&n(this.container[h]))return this.container[h];{const d={};return this.container.splice(h,0,d),d}}write(h,d){const f=this.getComponent();t(f[h]==null||f[h]===d,"Internal consistency error: Overwritten component. File a bug"),f[h]=d}get(){return this._op}descend(h){if(!e.isValidPathItem(h))throw Error("Invalid JSON key");this.pendingDescent.push(h)}descendPath(h){return this.pendingDescent.push(...h),this}ascend(){this.pendingDescent.length?this.pendingDescent.pop():super.ascend()}mergeTree(h,d=s){if(h===null)return;if(t(Array.isArray(h)),h===this._op)throw Error("Cannot merge into my own tree");const f=this.lcIdx,g=this.parents.length;let _=0;for(let R=0;R<h.length;R++){const b=h[R];typeof b=="string"||typeof b=="number"?(_++,this.descend(b)):Array.isArray(b)?this.mergeTree(b,d):typeof b=="object"&&d(b,this)}for(;_--;)this.ascend();this.lcIdx=this.parents.length===g?f:-1}at(h,d){this.descendPath(h),d(this);for(let f=0;f<h.length;f++)this.ascend();return this}writeAtPath(h,d,f){return this.at(h,()=>this.write(d,f)),this.reset(),this}writeMove(h,d,f=0){return this.writeAtPath(h,"p",f).writeAtPath(d,"d",f)}getPath(){const h=super.getPath();return h.push(...this.pendingDescent),h}}e.WriteCursor=a,e.writeCursor=()=>new a,e.readCursor=u=>new o(u);function l(u,h,d){let f,g;g=f=u?u.descendFirst():!1;function _(R){let b;for(;g;){const F=b=u.getKey();if(R!=null){let k=!1;if(h&&typeof F=="number"&&(b=h(F,u.getComponent()),b<0&&(b=~b,k=!0)),r(b,R))return null;if(b===R&&!k)return u}d&&typeof b=="number"&&d(b,u.getComponent()),g=u.nextSibling()}return null}return _.end=()=>{f&&u.ascend()},_}e.advancer=l;function c(u,h,d){let f,g,_,R;for(f=g=u&&u.descendFirst(),_=R=h&&h.descendFirst();f||_;){let b=f?u.getKey():null,F=_?h.getKey():null;b!==null&&F!==null&&(r(F,b)?F=null:b!==F&&(b=null)),d(b==null?F:b,b!=null?u:null,F!=null?h:null),b!=null&&f&&(f=u.nextSibling()),F!=null&&_&&(_=h.nextSibling())}g&&u.ascend(),R&&h.ascend()}e.eachChildOf=c})(di)),di}var fi={},Ba;function hu(){return Ba||(Ba=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ConflictType=void 0,(function(t){t[t.RM_UNEXPECTED_CONTENT=1]="RM_UNEXPECTED_CONTENT",t[t.DROP_COLLISION=2]="DROP_COLLISION",t[t.BLACKHOLE=3]="BLACKHOLE"})(e.ConflictType||(e.ConflictType={}))})(fi)),fi}var Tt={},mn={},$a;function vo(){return $a||($a=1,Object.defineProperty(mn,"__esModule",{value:!0}),mn.uniToStrPos=mn.strPosToUni=void 0,mn.strPosToUni=(e,t=e.length)=>{let n=0,r=0;for(;r<t;r++){const s=e.charCodeAt(r);s>=55296&&s<=57343&&(n++,r++)}if(r!==t)throw Error("Invalid offset - splits unicode bytes");return r-n},mn.uniToStrPos=(e,t)=>{let n=0;for(;t>0;t--){const r=e.charCodeAt(n);n+=r>=55296&&r<=57343?2:1}return n}),mn}var mi={},ja;function ki(){return ja||(ja=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.uniSlice=e.dlen=e.eachOp=void 0;const t=vo(),n=S=>{if(!Array.isArray(S))throw Error("Op must be an array of components");let C=null;for(let v=0;v<S.length;v++){const A=S[v];switch(typeof A){case"object":if(typeof A.d!="number"&&typeof A.d!="string")throw Error("Delete must be number or string");if(e.dlen(A.d)<=0)throw Error("Deletes must not be empty");break;case"string":if(!(A.length>0))throw Error("Inserts cannot be empty");break;case"number":if(!(A>0))throw Error("Skip components must be >0");if(typeof C=="number")throw Error("Adjacent skip components should be combined");break}C=A}if(typeof C=="number")throw Error("Op has a trailing skip")};function r(S,C){let v=0,A=0;for(let H=0;H<S.length;H++){const B=S[H];switch(C(B,v,A),typeof B){case"object":v+=e.dlen(B.d);break;case"string":A+=t.strPosToUni(B);break;case"number":v+=B,A+=B;break}}}e.eachOp=r;function s(S,C){const v=[],A=a(v);return r(S,(H,B,m)=>{A(C(H,B,m))}),h(v)}const i=S=>S,o=S=>s(S,i);e.dlen=S=>typeof S=="number"?S:t.strPosToUni(S);const a=S=>C=>{if(!(!C||C.d===0||C.d===""))if(S.length===0)S.push(C);else if(typeof C==typeof S[S.length-1])if(typeof C=="object"){const v=S[S.length-1];v.d=typeof v.d=="string"&&typeof C.d=="string"?v.d+C.d:e.dlen(v.d)+e.dlen(C.d)}else S[S.length-1]+=C;else S.push(C)},l=S=>typeof S=="number"?S:typeof S=="string"?t.strPosToUni(S):typeof S.d=="number"?S.d:t.strPosToUni(S.d);e.uniSlice=(S,C,v)=>{const A=t.uniToStrPos(S,C),H=v==null?1/0:t.uniToStrPos(S,v);return S.slice(A,H)};const c=(S,C,v)=>typeof S=="number"?v==null?S-C:Math.min(S,v)-C:e.uniSlice(S,C,v),u=S=>{let C=0,v=0;return{take:(B,m)=>{if(C===S.length)return B===-1?null:B;const x=S[C];let O;if(typeof x=="number")return B===-1||x-v<=B?(O=x-v,++C,v=0,O):(v+=B,B);if(typeof x=="string"){if(B===-1||m==="i"||t.strPosToUni(x.slice(v))<=B)return O=x.slice(v),++C,v=0,O;{const N=v+t.uniToStrPos(x.slice(v),B);return O=x.slice(v,N),v=N,O}}else{if(B===-1||m==="d"||e.dlen(x.d)-v<=B)return O={d:c(x.d,v)},++C,v=0,O;{let N=c(x.d,v,v+B);return v+=B,{d:N}}}},peek:()=>S[C]}},h=S=>(S.length>0&&typeof S[S.length-1]=="number"&&S.pop(),S);function d(S,C,v){if(v!=="left"&&v!=="right")throw Error("side ("+v+") must be 'left' or 'right'");n(S),n(C);const A=[],H=a(A),{take:B,peek:m}=u(S);for(let O=0;O<C.length;O++){const N=C[O];let y,w;switch(typeof N){case"number":for(y=N;y>0;)w=B(y,"i"),H(w),typeof w!="string"&&(y-=l(w));break;case"string":v==="left"&&typeof m()=="string"&&H(B(-1)),H(t.strPosToUni(N));break;case"object":for(y=e.dlen(N.d);y>0;)switch(w=B(y,"i"),typeof w){case"number":y-=w;break;case"string":H(w);break;case"object":y-=e.dlen(w.d)}break}}let x;for(;x=B(-1);)H(x);return h(A)}function f(S,C){n(S),n(C);const v=[],A=a(v),{take:H}=u(S);for(let m=0;m<C.length;m++){const x=C[m];let O,N;switch(typeof x){case"number":for(O=x;O>0;)N=H(O,"d"),A(N),typeof N!="object"&&(O-=l(N));break;case"string":A(x);break;case"object":O=e.dlen(x.d);let y=0;for(;y<O;)switch(N=H(O-y,"d"),typeof N){case"number":A({d:c(x.d,y,y+N)}),y+=N;break;case"string":y+=t.strPosToUni(N);break;case"object":A(N)}break}}let B;for(;B=H(-1);)A(B);return h(v)}const g=(S,C)=>{let v=0;for(let A=0;A<C.length&&S>v;A++){const H=C[A];switch(typeof H){case"number":{v+=H;break}case"string":const B=t.strPosToUni(H);v+=B,S+=B;break;case"object":S-=Math.min(e.dlen(H.d),S-v);break}}return S},_=(S,C)=>typeof S=="number"?g(S,C):S.map(v=>g(v,C));function R(S,C,v){return s(S,(A,H)=>typeof A=="object"&&typeof A.d=="number"?{d:v.slice(C,H,H+A.d)}:A)}function b(S){return s(S,C=>{switch(typeof C){case"object":if(typeof C.d=="number")throw Error("Cannot invert text op: Deleted characters missing from operation. makeInvertible must be called first.");return C.d;case"string":return{d:C};case"number":return C}})}function F(S){return s(S,C=>typeof C=="object"&&typeof C.d=="string"?{d:t.strPosToUni(C.d)}:C)}function k(S){let C=!0;return r(S,v=>{typeof v=="object"&&typeof v.d=="number"&&(C=!1)}),C}function W(S){return{name:"text-unicode",uri:"http://sharejs.org/types/text-unicode",trim:h,normalize:o,checkOp:n,create(C=""){if(typeof C!="string")throw Error("Initial data must be a string");return S.create(C)},apply(C,v){n(v);const A=S.builder(C);for(let H=0;H<v.length;H++){const B=v[H];switch(typeof B){case"number":A.skip(B);break;case"string":A.append(B);break;case"object":A.del(e.dlen(B.d));break}}return A.build()},transform:d,compose:f,transformPosition:g,transformSelection:_,isInvertible:k,makeInvertible(C,v){return R(C,v,S)},stripInvertible:F,invert:b,invertWithDoc(C,v){return b(R(C,v,S))},isNoop:C=>C.length===0}}e.default=W})(mi)),mi}var Qr={},Wa;function P_(){if(Wa)return Qr;Wa=1,Object.defineProperty(Qr,"__esModule",{value:!0});const e=ki(),t=vo();function n(r,s){return{get:r,getLength(){return r().length},insert(i,o,a){const l=t.strPosToUni(r(),i);return s([l,o],a)},remove(i,o,a){const l=t.strPosToUni(r(),i);return s([l,{d:o}],a)},_onOp(i){e.eachOp(i,(o,a,l)=>{switch(typeof o){case"string":this.onInsert&&this.onInsert(l,o);break;case"object":const c=e.dlen(o.d);this.onRemove&&this.onRemove(l,c)}})},onInsert:null,onRemove:null}}return Qr.default=n,n.provides={text:!0},Qr}var Ya;function k_(){return Ya||(Ya=1,(function(e){var t=Tt&&Tt.__createBinding||(Object.create?(function(d,f,g,_){_===void 0&&(_=g),Object.defineProperty(d,_,{enumerable:!0,get:function(){return f[g]}})}):(function(d,f,g,_){_===void 0&&(_=g),d[_]=f[g]})),n=Tt&&Tt.__setModuleDefault||(Object.create?(function(d,f){Object.defineProperty(d,"default",{enumerable:!0,value:f})}):function(d,f){d.default=f}),r=Tt&&Tt.__importStar||function(d){if(d&&d.__esModule)return d;var f={};if(d!=null)for(var g in d)Object.hasOwnProperty.call(d,g)&&t(f,d,g);return n(f,d),f},s=Tt&&Tt.__importDefault||function(d){return d&&d.__esModule?d:{default:d}};Object.defineProperty(e,"__esModule",{value:!0}),e.type=e.remove=e.insert=void 0;const i=vo(),o=r(ki()),a=s(P_()),l={create(d){return d},toString(d){return d},builder(d){if(typeof d!="string")throw Error("Invalid document snapshot: "+d);const f=[];return{skip(g){let _=i.uniToStrPos(d,g);if(_>d.length)throw Error("The op is too long for this document");f.push(d.slice(0,_)),d=d.slice(_)},append(g){f.push(g)},del(g){d=d.slice(i.uniToStrPos(d,g))},build(){return f.join("")+d}}},slice:o.uniSlice},c=o.default(l),u=Object.assign(Object.assign({},c),{api:a.default});e.type=u,e.insert=(d,f)=>f.length===0?[]:d===0?[f]:[d,f],e.remove=(d,f)=>o.dlen(f)===0?[]:d===0?[{d:f}]:[d,{d:f}];var h=ki();Object.defineProperty(e,"makeType",{enumerable:!0,get:function(){return h.default}})})(Tt)),Tt}var Va;function F_(){return Va||(Va=1,(function(e){var t=sr&&sr.__importDefault||function(I){return I&&I.__esModule?I:{default:I}};Object.defineProperty(e,"__esModule",{value:!0}),e.editOp=e.replaceOp=e.insertOp=e.moveOp=e.removeOp=e.type=void 0;const n=t(x_()),r=t(U_()),s=uu(),i=hu();function o(I,L){if(!I)throw new Error(L)}e.type={name:"json1",uri:"http://sharejs.org/types/JSONv1",readCursor:s.readCursor,writeCursor:s.writeCursor,create:I=>I,isNoop:I=>I==null,setDebug(I){},registerSubtype:b,checkValidOp:H,normalize:B,apply:m,transformPosition:x,compose:O,tryTransform:D,transform:J,makeInvertible:w,invert:N,invertWithDoc:T,RM_UNEXPECTED_CONTENT:i.ConflictType.RM_UNEXPECTED_CONTENT,DROP_COLLISION:i.ConflictType.DROP_COLLISION,BLACKHOLE:i.ConflictType.BLACKHOLE,transformNoConflict:(I,L,Y)=>ce(()=>!0,I,L,Y),typeAllowingConflictsPred:I=>Object.assign(Object.assign({},e.type),{transform:(L,Y,V)=>ce(I,L,Y,V)})};const a=I=>I?I.getComponent():null;function l(I){return I&&typeof I=="object"&&!Array.isArray(I)}const c=I=>Array.isArray(I)?I.slice():I!==null&&typeof I=="object"?Object.assign({},I):I,u=I=>I&&(I.p!=null||I.r!==void 0),h=I=>I&&(I.d!=null||I.i!==void 0);function d(I,L){return o(I!=null),typeof L=="number"?(o(Array.isArray(I),"Invalid key - child is not an array"),(I=I.slice()).splice(L,1)):(o(l(I),"Invalid key - child is not an object"),delete(I=Object.assign({},I))[L]),I}function f(I,L,Y){return typeof L=="number"?(o(I!=null,"Container is missing for key"),o(Array.isArray(I),"Cannot use numerical key for object container"),o(I.length>=L,"Cannot insert into out of bounds index"),I.splice(L,0,Y)):(o(l(I),"Cannot insert into missing item"),o(I[L]===void 0,"Trying to overwrite value at key. Your op needs to remove it first"),I[L]=Y),Y}e.removeOp=(I,L=!0)=>s.writeCursor().writeAtPath(I,"r",L).get(),e.moveOp=(I,L)=>s.writeCursor().writeMove(I,L).get(),e.insertOp=(I,L)=>s.writeCursor().writeAtPath(I,"i",L).get(),e.replaceOp=(I,L,Y)=>s.writeCursor().at(I,V=>{V.write("r",L),V.write("i",Y)}).get(),e.editOp=(I,L,Y,V=!1)=>s.writeCursor().at(I,$=>C($,L,Y,V)).get();const g=(I,L)=>I!=null&&(typeof L=="number"?Array.isArray(I):typeof I=="object"),_=(I,L)=>g(I,L)?I[L]:void 0,R={};function b(I){let L=I.type?I.type:I;L.name&&(R[L.name]=L),L.uri&&(R[L.uri]=L)}const F=I=>{const L=R[I];if(L)return L;throw Error("Missing type: "+I)};b(k_());const k=(I,L)=>I+L;b({name:"number",apply:k,compose:k,invert:I=>-I,transform:I=>I});const W=I=>I==null?null:I.et?F(I.et):I.es?R["text-unicode"]:I.ena!=null?R.number:null,S=I=>I.es?I.es:I.ena!=null?I.ena:I.e,C=(I,L,Y,V=!1)=>{const[$,j]=typeof L=="string"?[F(L),L]:[L,L.name];!V&&$.isNoop&&$.isNoop(Y)||(j==="number"?I.write("ena",Y):j==="text-unicode"?I.write("es",Y):(I.write("et",j),I.write("e",Y)))};function v(I){o(typeof I=="number"),o(I>=0),o(I===(0|I))}function A(I){typeof I=="number"?v(I):o(typeof I=="string")}function H(I){if(I===null)return;const L=new Set,Y=new Set,V=j=>{let Q=!0,ee=!1;for(let U in j){const G=j[U];if(Q=!1,o(U==="p"||U==="r"||U==="d"||U==="i"||U==="e"||U==="es"||U==="ena"||U==="et","Invalid component item '"+U+"'"),U==="p")v(G),o(!L.has(G)),L.add(G),o(j.r===void 0);else if(U==="d")v(G),o(!Y.has(G)),Y.add(G),o(j.i===void 0);else if(U==="e"||U==="es"||U==="ena"){o(!ee),ee=!0;const X=W(j);o(X,"Missing type in edit"),X.checkValidOp&&X.checkValidOp(S(j))}}o(!Q)},$=(j,Q,ee)=>{if(!Array.isArray(j))throw Error("Op must be null or a list");if(j.length===0)throw Error("Empty descent");Q||A(j[0]);let U=1,G=0,X=0;for(let ne=0;ne<j.length;ne++){const me=j[ne];if(o(me!=null),Array.isArray(me)){const pe=$(me,!1);if(G){const K=typeof X,he=typeof pe;K===he?o(X<pe,"descent keys are not in order"):o(K==="number"&&he==="string")}X=pe,G++,U=3}else typeof me=="object"?(o(U===1,`Prev not scalar - instead ${U}`),V(me),U=2):(o(U!==3),A(me),o(s.isValidPathItem(me),"Invalid path key"),U=1)}return o(G!==1,"Operation makes multiple descents. Remove some []"),o(U===2||U===3),j[0]};$(I,!0),o(L.size===Y.size,"Mismatched picks and drops in op");for(let j=0;j<L.size;j++)o(L.has(j)),o(Y.has(j))}function B(I){let L=0,Y=[];const V=s.writeCursor();return V.mergeTree(I,($,j)=>{const Q=W($);if(Q){const U=S($);C(j,Q,Q.normalize?Q.normalize(U):U)}for(const U of["r","p","i","d"])if($[U]!==void 0){const G=U==="p"||U==="d"?(ee=$[U],Y[ee]==null&&(Y[ee]=L++),Y[ee]):$[U];j.write(U,G)}var ee}),V.get()}function m(I,L){if(H(L),L===null)return I;const Y=[];return(function V($,j){let Q=$,ee=0,U={root:$},G=0,X=U,ne="root";function me(){for(;G<ee;G++){let pe=j[G];typeof pe!="object"&&(o(g(X,ne)),X=X[ne]=c(X[ne]),ne=pe)}}for(;ee<j.length;ee++){const pe=j[ee];if(Array.isArray(pe)){const K=V(Q,pe);K!==Q&&K!==void 0&&(me(),Q=X[ne]=K)}else if(typeof pe=="object"){pe.d!=null?(me(),Q=f(X,ne,Y[pe.d])):pe.i!==void 0&&(me(),Q=f(X,ne,pe.i));const K=W(pe);if(K)me(),Q=X[ne]=K.apply(Q,S(pe));else if(pe.e!==void 0)throw Error("Subtype "+pe.et+" undefined")}else Q=_(Q,pe)}return U.root})(I=(function V($,j){const Q=[];let ee=0;for(;ee<j.length;ee++){const ne=j[ee];if(Array.isArray(ne))break;typeof ne!="object"&&(Q.push($),$=_($,ne))}for(let ne=j.length-1;ne>=ee;ne--)$=V($,j[ne]);for(--ee;ee>=0;ee--){const ne=j[ee];if(typeof ne!="object"){const me=Q.pop();$=$===_(me,ne)?me:$===void 0?d(me,ne):(G=ne,X=$,(U=c(U=me))[G]=X,U)}else u(ne)&&(o($!==void 0,"Cannot pick up or remove undefined"),ne.p!=null&&(Y[ne.p]=$),$=void 0)}var U,G,X;return $})(I,L),L)}function x(I,L){I=I.slice(),H(L);const Y=s.readCursor(L);let V,$,j=!1;const Q=[];for(let U=0;;U++){const G=I[U],X=Y.getComponent();if(X&&(X.r!==void 0?j=!0:X.p!=null&&(j=!1,V=X.p,$=U)),U>=I.length)break;let ne=0;const me=s.advancer(Y,void 0,(K,he)=>{u(he)&&ne++});Q.unshift(me);const pe=me(G);if(typeof G=="number"&&(I[U]-=ne),!pe)break}if(Q.forEach(U=>U.end()),j)return null;const ee=()=>{let U=0;if(V!=null){const G=Y.getPath();U=G.length,I=G.concat(I.slice($))}for(;U<I.length;U++){const G=I[U],X=a(Y),ne=W(X);if(ne){const K=S(X);ne.transformPosition&&(I[U]=ne.transformPosition(I[U],K));break}let me=0;const pe=s.advancer(Y,(K,he)=>h(he)?~(K-me):K-me,(K,he)=>{h(he)&&me++})(G);if(typeof G=="number"&&(I[U]+=me),!pe)break}};return V!=null?Y.eachDrop(null,U=>{U===V&&ee()}):ee(),I}function O(I,L){if(H(I),H(L),I==null)return L;if(L==null)return I;let Y=0;const V=s.readCursor(I),$=s.readCursor(L),j=s.writeCursor(),Q=[],ee=[],U=[],G=[],X=[],ne=[],me=new Set;V.traverse(null,K=>{K.p!=null&&(U[K.p]=V.clone())}),$.traverse(null,K=>{K.d!=null&&(G[K.d]=$.clone())});const pe=s.writeCursor();return(function K(he,Ue,Ne,Se,Be,Bt,rt,Je){o(Ue||Ne);const $e=a(Ue),_t=a(Ne),vt=!!_t&&_t.r!==void 0,un=!!$e&&$e.i!==void 0,pt=$e?$e.d:null,ut=_t?_t.p:null,$t=(Bt||vt)&&ut==null;if(ut!=null)Se=G[ut],rt=ee[ut]=new s.WriteCursor;else if(_t&&_t.r!==void 0)Se=null;else{const se=a(Se);se&&se.d!=null&&(Se=null)}const Ae=a(Se);if(pt!=null)if(he=U[pt],Je=Q[pt]=new s.WriteCursor,$t)Bt&&!vt&&Je.write("r",!0);else{const se=X[pt]=Y++;rt.write("d",se)}else if($e&&$e.i!==void 0)he=null;else{const se=a(he);se&&se.p!=null&&(he=null)}let ae;un?(o(Be===void 0),ae=$e.i):ae=Be;const Ce=(ut==null?!un||Bt||vt:ae===void 0)?null:rt.getComponent();if(ut!=null){if(!(Be!==void 0||un)){const se=pt!=null?X[pt]:Y++;ne[ut]=se,Je.write("p",se)}}else vt&&(un||Be!==void 0||(_t.r,Je.write("r",_t.r)));const ue=$t?null:W($e),re=W(Ae);if((ue||re)&&(ue&&ue.name,re&&re.name),ue&&re){o(ue===re);const se=S($e),Re=S(Ae),Ke=ue.compose(se,Re);C(rt,ue,Ke),me.add(Ae)}else ue?C(rt,ue,S($e)):re&&(C(rt,re,S(Ae)),me.add(Ae));const de=typeof ae=="object"&&ae!=null;let be=!1,ve=0,Te=0,Ge=0,Ve=0,je=0;const tt=s.advancer(Se,(se,Re)=>h(Re)?Ve-se-1:se-Ve,(se,Re)=>{h(Re)&&Ve++}),Oe=s.advancer(he,(se,Re)=>u(Re)?ve-se-1:se-ve,(se,Re)=>{u(Re)&&ve++});if(s.eachChildOf(Ue,Ne,(se,Re,Ke)=>{let st,jt,hn=se,bt=se,nr=se;if(typeof se=="number"){let Ze=se+Ge;jt=tt(Ze),bt=Ze+Ve;let Ye=se+Te;st=Oe(Ye),h(a(jt))&&(st=null),hn=Ye+ve,nr=se+je,o(hn>=0,"p1PickKey is negative"),o(bt>=0,"p2DropKey is negative");const yt=h(a(Re)),Wt=u(a(Ke));(yt||Wt&&!$t)&&je--,yt&&Te--,Wt&&Ge--}else st=Oe(se),jt=tt(se);Je.descend(hn),rt.descend(bt);const bn=de&&!h(a(Re))?ae[nr]:void 0,Lt=K(st,Re,Ke,jt,bn,$t,rt,Je);var xt,ge,Fe;de&&!$t?bn!==Lt&&(be||(ae=Array.isArray(ae)?ae.slice():Object.assign({},ae),be=!0),xt=ae,Fe=Lt,typeof(ge=nr)=="number"?(o(Array.isArray(xt)),o(ge<xt.length)):(o(!Array.isArray(xt)),o(xt[ge]!==void 0)),Fe===void 0?typeof ge=="number"?xt.splice(ge,1):delete xt[ge]:xt[ge]=Fe):o(Lt===void 0),rt.ascend(),Je.ascend()}),Oe.end(),tt.end(),Ce!=null)Ce.i=ae;else if(!Bt&&!vt&&ut==null)return ae})(V,V.clone(),$,$.clone(),void 0,!1,j,pe),j.reset(),j.mergeTree(pe.get()),j.reset(),j.get(),Q.map(K=>K.get()),ee.map(K=>K.get()),V.traverse(j,(K,he)=>{const Ue=K.p;if(Ue!=null){const Ne=X[Ue];Ne!=null&&he.write("p",Ne);const Se=Q[Ue];Se&&Se.get(),Se&&he.mergeTree(Se.get())}else K.r!==void 0&&he.write("r",K.r)}),j.reset(),j.get(),$.traverse(j,(K,he)=>{const Ue=K.d;if(Ue!=null){const Se=ne[Ue];Se!=null&&he.write("d",Se);const Be=ee[Ue];Be&&he.mergeTree(Be.get())}else K.i!==void 0&&he.write("i",K.i);const Ne=W(K);Ne&&!me.has(K)&&C(he,Ne,S(K))}),j.get()}function N(I){if(I==null)return null;const L=new s.ReadCursor(I),Y=new s.WriteCursor;let V;const $=[],j=[];return(function Q(ee,U,G){const X=ee.getComponent();let ne,me=!1;if(X){X.p!=null&&(U.write("d",X.p),$[X.p]=ee.clone()),X.r!==void 0&&U.write("i",X.r),X.d!=null&&(U.write("p",X.d),G=void 0),X.i!==void 0&&(G=ne=X.i);const K=W(X);K&&(G===void 0?(V||(V=new Set),V.add(X)):(S(X),G=K.apply(G,S(X)),me=!0))}let pe=0;for(const K of ee){U.descend(K);const he=typeof K=="number"?K-pe:K,Ue=_(G,he);h(ee.getComponent())&&pe++;const Ne=Q(ee,U,Ue);if(G!==void 0&&Ne!==void 0){if(me||(me=!0,G=c(G)),!g(G,he))throw Error("Cannot modify child - invalid operation");G[he]=Ne}U.ascend()}if(ne===void 0)return me?G:void 0;U.write("r",G)})(L,Y,void 0),V&&(Y.reset(),(function Q(ee,U,G){const X=U.getComponent();if(X){const K=X.d;if(K!=null&&(ee=$[K],G=j[K]=s.writeCursor()),V.has(X)){const he=W(X);if(!he.invert)throw Error(`Cannot invert subtype ${he.name}`);C(G,he,he.invert(S(X)))}}let ne=0,me=0;const pe=s.advancer(ee,(K,he)=>u(he)?ne-K-1:K-ne,(K,he)=>{u(he)&&ne++});for(const K of U)if(typeof K=="number"){const he=K-me,Ue=pe(he),Ne=he+ne;G.descend(Ne),Q(Ue,U,G),h(U.getComponent())&&me++,G.ascend()}else G.descend(K),Q(pe(K),U,G),G.ascend();pe.end()})(L.clone(),L,Y),j.length&&(Y.reset(),L.traverse(Y,(Q,ee)=>{const U=Q.p;if(U!=null){const G=j[U];G&&G.get(),G&&ee.mergeTree(G.get())}}))),Y.get()}const y=(I,L)=>I.some(Y=>typeof Y=="object"&&(Array.isArray(Y)?y(Y,L):L(Y)));function w(I,L){if(I==null||!y(I,U=>{var G;return U.r!==void 0||((G=W(U))===null||G===void 0?void 0:G.makeInvertible)!=null}))return I;const Y=new s.ReadCursor(I),V=new s.WriteCursor;let $=!1;const j=[],Q=[],ee=(U,G,X)=>{const ne=U.getComponent();let me=!1;if(ne){ne.d!=null&&G.write("d",ne.d),ne.i!==void 0&&G.write("i",ne.i);const K=ne.p;if(K!=null&&(j[K]=U.clone(),o(X!==void 0,"Operation picks up at an invalid key"),Q[K]=X,G.write("p",ne.p)),ne.r!==void 0&&X===void 0)throw Error("Invalid doc / op in makeInvertible: removed item missing from doc");const he=W(ne);he&&(he.makeInvertible?$=!0:C(G,he,S(ne),!0))}let pe=0;for(const K of U){G.descend(K);const he=typeof K=="number"?K-pe:K,Ue=_(X,he),Ne=ee(U,G,Ue);Ue!==Ne&&(me||(me=!0,X=c(X)),Ne===void 0?(X=d(X,he),typeof K=="number"&&pe++):X[he]=Ne),G.ascend()}return ne&&(ne.r!==void 0?(G.write("r",r.default(X)),X=void 0):ne.p!=null&&(X=void 0)),X};return ee(Y,V,L),V.get(),$&&(V.reset(),(function U(G,X,ne,me,pe){const K=X.getComponent();if(K){K.i!==void 0?(me=K.i,pe=!0):K.d!=null&&(me=Q[K.d],G=j[K.d],pe=!1,K.d);let Se=W(K);if(Se&&Se.makeInvertible){const Be=S(K);C(ne,Se,Se.makeInvertible(Be,me),!0)}}let he=0,Ue=0;const Ne=s.advancer(G,(Se,Be)=>u(Be)?he-Se-1:Se-he,(Se,Be)=>{u(Be)&&he++});for(const Se of X)if(typeof Se=="number"){const Be=Se-Ue,Bt=Ne(Be),rt=Be+he,Je=_(me,pe?Be:rt);ne.descend(Se),U(Bt,X,ne,Je,pe),h(X.getComponent())&&Ue++,ne.ascend()}else{const Be=_(me,Se);ne.descend(Se),U(Ne(Se),X,ne,Be,pe),ne.ascend()}Ne.end()})(Y.clone(),Y,V,L,!1)),V.get()}function T(I,L){return N(w(I,L))}const M=I=>{if(I==null)return null;const L=I.slice();for(let Y=0;Y<I.length;Y++){const V=L[Y];Array.isArray(V)&&(L[Y]=M(V))}return L};function D(I,L,Y){o(Y==="left"||Y==="right","Direction must be left or right");const V=Y==="left"?0:1;if(L==null)return{ok:!0,result:I};H(I),H(L);let $=null;const j=[],Q=[],ee=[],U=[],G=[],X=[],ne=[],me=[],pe=[],K=[],he=[],Ue=[],Ne=[],Se=[],Be=[];let Bt=0;const rt=s.readCursor(I),Je=s.readCursor(L),$e=s.writeCursor();if((function Ae(ae,Ce=null,ue){const re=a(Ce);re&&(re.r!==void 0?ue=Ce.clone():re.p!=null&&(ue=null,X[re.p]=ae.clone()));const de=ae.getComponent();let be;de&&(be=de.p)!=null&&(G[be]=Ce?Ce.clone():null,ee[be]=ae.clone(),ue&&(K[be]=!0,pe[be]=ue),re&&re.p!=null&&(Se[be]=re.p));const ve=s.advancer(Ce);for(const Te of ae)Ae(ae,ve(Te),ue);ve.end()})(Je,rt,null),(function Ae(ae,Ce,ue,re,de){const be=ue.getComponent();let ve,Te=!1;be&&((ve=be.d)!=null?(U[ve]=ue.clone(),re!=null&&(Be[re]==null&&(Be[re]=[]),Be[re].push(ve)),K[ve],ae=G[ve]||null,Ce=ee[ve]||null,K[ve]?(de&&(he[ve]=!0),de=pe[ve]||null):!de||V!==1&&Se[ve]!=null||$==null&&($={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:e.removeOp(de.getPath()),op2:e.moveOp(Ce.getPath(),ue.getPath())}),Te=!0):be.i!==void 0&&(ae=Ce=null,Te=!0,de&&$==null&&($={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:e.removeOp(de.getPath()),op2:e.insertOp(ue.getPath(),be.i)})));const Ge=a(ae);Ge&&(Ge.r!==void 0?de=ae.clone():Ge.p!=null&&(Ge.p,re=Ge.p,de=null));const Ve=W(be);Ve&&de&&$==null&&($={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:e.removeOp(de.getPath()),op2:e.editOp(ue.getPath(),Ve,S(be),!0)});let je=0,tt=0;const Oe=s.advancer(Ce,(Re,Ke)=>u(Ke)?je-Re-1:Re-je,(Re,Ke)=>{u(Ke)&&je++}),se=s.advancer(ae);for(const Re of ue)if(typeof Re=="number"){const Ke=Re-tt,st=Oe(Ke);tt+=+Ae(se(Ke+je),st,ue,re,de)}else{const Ke=Oe(Re);Ae(se(Re),Ke,ue,re,de)}return Oe.end(),se.end(),Te})(rt,Je,Je.clone(),null,null),U.map(Ae=>Ae&&Ae.get()),$)return{ok:!1,conflict:$};he.map(Ae=>!!Ae);const _t=[];let vt=null;(function Ae(ae,Ce,ue,re,de){let be=!1;const ve=a(Ce);if(u(ve)){const Oe=ve.p;Oe!=null?(ue=U[Oe],re=Ue[Oe]=s.writeCursor(),be=!0,de=null):(ue=null,de=Ce.clone())}else h(a(ue))&&(ue=null);const Te=ae.getComponent();if(Te){const Oe=Te.p;Oe!=null?(de&&(me[Oe]=de),_t[Oe]=de||V===1&&be?null:re.getComponent(),j[Oe]=ae.clone(),ue&&(ne[Oe]=ue.clone())):Te.r!==void 0&&(de||re.write("r",!0),(de||be)&&(vt==null&&(vt=new Set),vt.add(Te)))}let Ge=0,Ve=0;const je=s.advancer(Ce,void 0,(Oe,se)=>{u(se)&&Ge++}),tt=s.advancer(ue,(Oe,se)=>h(se)?~(Oe-Ve):Oe-Ve,(Oe,se)=>{h(se)&&Ve++});if(ae)for(const Oe of ae)if(typeof Oe=="string"){const se=je(Oe),Re=tt(Oe);re.descend(Oe),Ae(ae,se,Re,re,de),re.ascend()}else{const se=je(Oe),Re=Oe-Ge,Ke=u(a(se))?null:tt(Re),st=Re+Ve;o(st>=0),re.descend(st),Ae(ae,se,Ke,re,de),re.ascend()}je.end(),tt.end()})(rt,Je,Je.clone(),$e,null),$e.reset();let un=[];if((function Ae(ae,Ce,ue,re,de,be){o(Ce);const ve=Ce.getComponent();let Te=a(re),Ge=!1;const Ve=(ge,Fe,Ze)=>ge?e.moveOp(ge.getPath(),Fe.getPath()):e.insertOp(Fe.getPath(),Ze.i);if(h(ve)){const ge=ve.d;ge!=null&&(Q[ge]=Ce.clone());const Fe=ge!=null?_t[ge]:null;let Ze=!1;if(ve.i!==void 0||ge!=null&&Fe){let Ye;Te&&(Te.i!==void 0||(Ye=Te.d)!=null&&!K[Ye])&&(Ze=Ye!=null?ge!=null&&ge===Se[Ye]:n.default(Te.i,ve.i),Ze||Ye!=null&&V!==1&&Se[Ye]!=null||$==null&&($={type:i.ConflictType.DROP_COLLISION,op1:Ve(ge!=null?j[ge]:null,Ce,ve),op2:Ve(Ye!=null?ee[Ye]:null,re,Te)})),Ze||(be?$==null&&($={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:Ve(ge!=null?j[ge]:null,Ce,ve),op2:e.removeOp(be.getPath())}):(ge!=null?(un[Bt]=ge,de.write("d",Fe.p=Bt++)):de.write("i",r.default(ve.i)),Ge=!0))}else if(ge!=null&&!Fe){const Ye=me[ge];Ye&&(be=Ye.clone())}ge!=null?(ae=j[ge],ue=X[ge],re=ne[ge]):ve.i!==void 0&&(ae=ue=null,Ze||(re=null))}else u(a(ae))&&(ae=ue=re=null);const je=a(ae),tt=a(ue);if(u(tt)){const ge=tt.p;tt.r!==void 0&&(!je||je.r===void 0)||K[ge]?(re=null,be=ue.clone()):ge!=null&&(re=U[ge],V!==1&&Se[ge]!=null||((de=Ne[ge])||(de=Ne[ge]=s.writeCursor()),de.reset(),be=null))}else!h(ve)&&h(Te)&&(re=null);Te=re!=null?re.getComponent():null;const Oe=W(ve);if(Oe){const ge=S(ve);if(be)$==null&&($={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:e.editOp(Ce.getPath(),Oe,ge,!0),op2:e.removeOp(be.getPath())});else{const Fe=W(Te);let Ze;if(Fe){if(Oe!==Fe)throw Error("Transforming incompatible types");const Ye=S(Te);Ze=Oe.transform(ge,Ye,Y)}else Ze=r.default(ge);C(de,Oe,Ze)}}let se=0,Re=0,Ke=0,st=0,jt=0,hn=0,bt=ae!=null&&ae.descendFirst(),nr=bt;const bn=s.advancer(ue,void 0,(ge,Fe)=>{u(Fe)&&Ke++});let Lt=re!=null&&re.descendFirst(),xt=Lt;for(const ge of Ce)if(typeof ge=="number"){let Fe;const Ze=h(Ce.getComponent()),Ye=ge-Re;{let qt;for(;bt&&typeof(qt=ae.getKey())=="number";){qt+=se;const At=ae.getComponent(),yn=u(At);if(qt>Ye||qt===Ye&&(!yn||V===0&&Ze))break;if(yn){se--;const dn=At.p;Se.includes(dn),At.d,a(Ne[At.d]),u(a(Ne[At.d])),(At.r===void 0||vt&&vt.has(At))&&(dn==null||!_t[dn]||V!==1&&Se.includes(dn))||jt--}bt=ae.nextSibling()}Fe=bt&&qt===Ye?ae:null}const yt=Ye-se;let Wt=bn(yt);const si=yt-Ke;let Xr=null;{let qt,At;for(;Lt&&typeof(qt=re.getKey())=="number";){At=qt-st;const yn=re.getComponent(),dn=h(yn);if(At>si)break;if(At===si){if(!dn){Xr=re;break}{if(V===0&&Ze){Xr=re;break}const Jt=Wt&&u(Wt.getComponent());if(V===0&&Jt)break}}if(dn){const Jt=yn.d;K[Jt],Se[Jt],yn.i===void 0&&(K[Jt]||Se[Jt]!=null&&V!==1)?(K[Jt]||Se[Jt]!=null&&V===0)&&(st++,hn--):st++}Lt=re.nextSibling()}}const pa=si+st+jt+hn;o(pa>=0,"trying to descend to a negative index"),de.descend(pa),Ze&&(Fe=Wt=Xr=null,Re++),Ae(Fe,Ce,Wt,Xr,de,be)&&hn++,de.ascend()}else{let Fe;for(;bt&&(Fe=ae.getKey(),typeof Fe!="string"||!(Fe>ge||Fe===ge));)bt=ae.nextSibling();const Ze=bt&&Fe===ge?ae:null,Ye=bn(ge);let yt;for(;Lt&&(yt=re.getKey(),typeof yt!="string"||!(yt>ge||yt===ge));)Lt=re.nextSibling();const Wt=Lt&&yt===ge?re:null;de.descend(ge),Ae(Ze,Ce,Ye,Wt,de,be),de.ascend()}return bn.end(),nr&&ae.ascend(),xt&&re.ascend(),Ge})(rt,rt.clone(),Je,Je.clone(),$e,null),$)return{ok:!1,conflict:$};$e.reset();const pt=(Ae,ae,Ce)=>Ae.traverse(ae,(ue,re)=>{ue.d!=null&&Ce(ue.d,Ae,re)});(K.length||Ue.length)&&(pt(Je,$e,(Ae,ae,Ce)=>{K[Ae]&&!he[Ae]&&Ce.write("r",!0),Ue[Ae]&&Ce.mergeTree(Ue[Ae].get())}),$e.reset());const ut=[],$t=[];if((Ne.length||K.length)&&!$){const Ae=s.readCursor(M($e.get()));if(pt(Ae,null,(ae,Ce)=>{ut[ae]=Ce.clone()}),Ne.forEach(ae=>{ae&&pt(s.readCursor(ae.get()),null,(Ce,ue)=>{ut[Ce]=ue.clone()})}),(function ae(Ce,ue,re,de,be,ve){const Te=a(ue);if(Te&&u(Te))if(Te.p!=null){const se=Te.p;ut[se].getPath(),re=ut[se],de=$t[se]=s.writeCursor()}else Te.r!==void 0&&(re=null);else h(a(re))&&(re=null);const Ge=Ce.getComponent();if(Ge){let se;if((se=Ge.d)!=null){const Re=Ne[se];Re&&(Re.get(),de.mergeTree(Re.get()),re=s.readCursor(Re.get()))}}let Ve=0,je=0;const tt=s.advancer(ue,void 0,(se,Re)=>{u(Re)&&Ve--}),Oe=s.advancer(re,(se,Re)=>h(Re)?-(se-je)-1:se-je,(se,Re)=>{h(Re)&&je++});for(const se of Ce)if(typeof se=="number"){const Re=tt(se),Ke=se+Ve,st=Oe(Ke),jt=Ke+je;de.descend(jt),ae(Ce,Re,st,de),de.ascend()}else de.descend(se),ae(Ce,tt(se),Oe(se),de),de.ascend();tt.end(),Oe.end()})(Je,Ae,Ae.clone(),$e),$e.reset(),$)return{ok:!1,conflict:$};if($e.get(),$t.length){const ae=$t.map(ue=>ue?ue.get():null),Ce=s.readCursor(M($e.get()));if(pt(Ce,$e,(ue,re,de)=>{const be=ae[ue];be&&(de.mergeTree(be),ae[ue]=null)}),ae.find(ue=>ue)){const ue=s.writeCursor(),re=s.writeCursor();let de=0,be=0;ae.forEach(ve=>{ve!=null&&pt(s.readCursor(ve),null,Te=>{const Ge=un[Te];ue.writeMove(j[Ge].getPath(),Q[Ge].getPath(),de++);const Ve=Be[Ge];Ve&&Ve.forEach(je=>{K[je]||V!==1&&Se[je]!=null||re.writeMove(ee[je].getPath(),U[je].getPath(),be++)})})}),$={type:i.ConflictType.BLACKHOLE,op1:ue.get(),op2:re.get()}}}}return $?{ok:!1,conflict:$}:{ok:!0,result:$e.get()}}const P=I=>{const L=new Error("Transform detected write conflict");throw L.conflict=I,L.type=L.name="writeConflict",L};function J(I,L,Y){const V=D(I,L,Y);if(V.ok)return V.result;P(V.conflict)}const z=I=>{const L=s.writeCursor();return s.readCursor(I).traverse(L,(Y,V)=>{(h(Y)||W(Y))&&V.write("r",!0)}),L.get()},oe=(I,L)=>{const{type:Y,op1:V,op2:$}=I;switch(Y){case i.ConflictType.DROP_COLLISION:return L==="left"?[null,z($)]:[z(V),null];case i.ConflictType.RM_UNEXPECTED_CONTENT:let j=!1;return s.readCursor(V).traverse(null,Q=>{Q.r!==void 0&&(j=!0)}),j?[null,z($)]:[z(V),null];case i.ConflictType.BLACKHOLE:return[z(V),z($)];default:throw Error("Unrecognised conflict: "+Y)}};function ce(I,L,Y,V){let $=null;for(;;){const j=D(L,Y,V);if(j.ok)return O($,j.result);{const{conflict:Q}=j;I(Q)||P(Q);const[ee,U]=oe(Q,V);L=O(B(L),ee),Y=O(B(Y),U),$=O($,U)}}}})(sr)),sr}var za;function H_(){return za||(za=1,(function(e){var t=fn&&fn.__createBinding||(Object.create?(function(i,o,a,l){l===void 0&&(l=a),Object.defineProperty(i,l,{enumerable:!0,get:function(){return o[a]}})}):(function(i,o,a,l){l===void 0&&(l=a),i[l]=o[a]})),n=fn&&fn.__exportStar||function(i,o){for(var a in i)a!=="default"&&!o.hasOwnProperty(a)&&t(o,i,a)};Object.defineProperty(e,"__esModule",{value:!0}),n(F_(),e);var r=uu();Object.defineProperty(e,"ReadCursor",{enumerable:!0,get:function(){return r.ReadCursor}}),Object.defineProperty(e,"WriteCursor",{enumerable:!0,get:function(){return r.WriteCursor}});var s=hu();Object.defineProperty(e,"ConflictType",{enumerable:!0,get:function(){return s.ConflictType}})})(fn)),fn}var at=H_();const B_=wt(at),$_=Nd({__proto__:null,default:B_},[at]);var Ee=(e=>(e[e.COVER=0]="COVER",e[e.REPLACE=1]="REPLACE",e))(Ee||{}),q=(e=>(e.RETAIN="r",e.INSERT="i",e.DELETE="d",e))(q||{});const $r=ye.createIdentifier("univer.config-service");class du{constructor(){p(this,"_configChanged$",new le.Subject);p(this,"configChanged$",this._configChanged$.asObservable());p(this,"_config",new Map)}dispose(){this._config.clear(),this._configChanged$.complete()}getConfig(t){return this._config.get(t)}setConfig(t,n,r){var o;const{merge:s=!1}=r||{};let i=(o=this._config.get(t))!=null?o:{};s?i=Ys(i,n):i=n,this._config.set(t,i),this._configChanged$.next({[t]:i})}deleteConfig(t){return this._config.delete(t)}subscribeConfigValue$(t){return new le.Observable(n=>{Object.prototype.hasOwnProperty.call(this._config,t)&&n.next(this._config.get(t));const r=this.configChanged$.pipe(le.filter(s=>Object.prototype.hasOwnProperty.call(s,t))).subscribe(s=>n.next(s[t]));return()=>r.unsubscribe()})}}const er=ye.createIdentifier("univer.context-service");class fu extends Xe{constructor(){super(...arguments);p(this,"_contextChanged$",new le.Subject);p(this,"contextChanged$",this._contextChanged$.asObservable());p(this,"_contextMap",new Map)}dispose(){super.dispose(),this._contextChanged$.complete(),this._contextMap.clear()}getContextValue(n){var r;return(r=this._contextMap.get(n))!=null?r:!1}setContextValue(n,r){this._contextMap.set(n,r),this._contextChanged$.next({[n]:r})}subscribeContextValue$(n){return new le.Observable(r=>{const s=this._contextChanged$.pipe(le.filter(i=>typeof i[n]<"u")).subscribe(i=>r.next(i[n]));return this._contextMap.has(n)&&r.next(this._contextMap.get(n)),()=>s.unsubscribe()})}}var mu=(e=>(e[e.SILENT=0]="SILENT",e[e.ERROR=1]="ERROR",e[e.WARN=2]="WARN",e[e.INFO=3]="INFO",e[e.VERBOSE=4]="VERBOSE",e))(mu||{});const mt=ye.createIdentifier("univer.log");class gu extends Xe{constructor(){super(...arguments);p(this,"_logLevel",3);p(this,"_deduction",new Set)}dispose(){super.dispose(),this._logLevel=3,this._deduction.clear()}debug(...n){this._logLevel>=4&&this._log(console.debug,...n)}log(...n){this._logLevel>=3&&this._log(console.log,...n)}warn(...n){this._logLevel>=2&&this._log(console.warn,...n)}error(...n){this._logLevel>=1&&this._log(console.error,...n)}deprecate(...n){this._logLevel>=2&&this._logWithDeduplication(console.error,...n)}setLogLevel(n){this._logLevel=n}_log(n,...r){const s=r[0];/^\[(.*?)\]/g.test(s)?n(`\x1B[97;104m${s}\x1B[0m`,...r.slice(1)):n(...r)}_logWithDeduplication(n,...r){const s=j_(...r);this._deduction.has(s)||(this._deduction.add(s),this._log(n,...r))}}function j_(...e){return e.map(t=>JSON.stringify(t)).join("")}var W_=Object.getOwnPropertyDescriptor,Y_=(e,t,n,r)=>{for(var s=r>1?void 0:r?W_(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},gi=(e,t)=>(n,r)=>t(n,r,e);const Ns="command.logExecution";var jr=(e=>(e[e.COMMAND=0]="COMMAND",e[e.OPERATION=1]="OPERATION",e[e.MUTATION=2]="MUTATION",e))(jr||{});const Wr=ye.createIdentifier("univer.core.command-service");class V_{constructor(){p(this,"_commands",new Map);p(this,"_commandTypes",new Map)}registerCommand(t){if(this._commands.has(t.id))throw new Error(`[CommandRegistry]: command "${t.id}" has been registered before.`);return this._commands.set(t.id,t),this._commandTypes.set(t.id,t.type),We(()=>{this.unregisterCommand(t.id)})}unregisterCommand(t){this._commands.delete(t),this._commandTypes.delete(t)}hasCommand(t){return this._commands.has(t)}getCommand(t){return this._commands.has(t)?[this._commands.get(t)]:null}getCommandType(t){return this._commandTypes.get(t)}}const _u={id:"nil",type:0,handler:()=>!0};exports.CommandService=class extends Xe{constructor(n,r,s){super();p(this,"_commandRegistry");p(this,"_beforeCommandExecutionListeners",[]);p(this,"_commandExecutedListeners",[]);p(this,"_collabMutationListeners",[]);p(this,"_multiCommandDisposables",new Map);p(this,"_commandExecutingLevel",0);p(this,"_commandExecutionStack",[]);this._injector=n,this._logService=r,this._configService=s,this._commandRegistry=new V_,this.registerCommand(_u)}dispose(){super.dispose(),this._commandExecutedListeners.length=0,this._beforeCommandExecutionListeners.length=0,this._collabMutationListeners.length=0}hasCommand(n){return this._commandRegistry.hasCommand(n)}registerCommand(n){return this._commandRegistry.registerCommand(n)}unregisterCommand(n){var r;this._commandRegistry.unregisterCommand(n),(r=this._multiCommandDisposables.get(n))==null||r.dispose()}registerMultipleCommand(n){return this._registerMultiCommand(n)}beforeCommandExecuted(n){if(this._beforeCommandExecutionListeners.indexOf(n)===-1)return this._beforeCommandExecutionListeners.push(n),We(()=>{const r=this._beforeCommandExecutionListeners.indexOf(n);this._beforeCommandExecutionListeners.splice(r,1)});throw new Error("[CommandService]: could not add a listener twice.")}onCommandExecuted(n){if(this._commandExecutedListeners.indexOf(n)===-1)return this._commandExecutedListeners.push(n),We(()=>{const r=this._commandExecutedListeners.indexOf(n);this._commandExecutedListeners.splice(r,1)});throw new Error("[CommandService]: could not add a listener twice.")}onMutationExecutedForCollab(n){if(this._collabMutationListeners.indexOf(n)===-1)return this._collabMutationListeners.push(n),We(()=>{const r=this._collabMutationListeners.indexOf(n);this._collabMutationListeners.splice(r,1)});throw new Error("[CommandService]: could not add a collab mutation listener twice.")}async executeCommand(n,r,s){try{const i=this._commandRegistry.getCommand(n);if(i){const[o]=i,a={id:o.id,type:o.type,params:r},l=this._pushCommandExecutionStack(a),c=s!=null?s:{};this._beforeCommandExecutionListeners.forEach(h=>h(a,c));const u=await this._execute(o,r,c);return c.syncOnly?o.type===2&&this._collabMutationListeners.forEach(h=>h(a,c)):(this._commandExecutedListeners.forEach(h=>h(a,c)),o.type===2&&this._collabMutationListeners.forEach(h=>h(a,c))),l.dispose(),u}throw new Error(`[CommandService]: command "${n}" is not registered.`)}catch(i){if(i instanceof ws)return!1;throw i}}syncExecuteCommand(n,r,s){var i;try{const o=this._commandRegistry.getCommand(n);if(o){const[a]=o,l={id:a.id,type:a.type,params:r};if(a.type===2){const d=kd(this._commandExecutionStack,f=>f.type===0);d&&(l.params=(i=l.params)!=null?i:{},l.params.trigger=d.id)}const c=this._pushCommandExecutionStack(l),u=s!=null?s:{};this._beforeCommandExecutionListeners.forEach(d=>d(l,u));const h=this._syncExecute(a,r,u);return u.syncOnly?a.type===2&&this._collabMutationListeners.forEach(d=>d(l,u)):(this._commandExecutedListeners.forEach(d=>d(l,u)),a.type===2&&this._collabMutationListeners.forEach(d=>d(l,u))),c.dispose(),h}throw new Error(`[CommandService]: command "${n}" is not registered.`)}catch(o){if(o instanceof ws)return!1;throw o}}_pushCommandExecutionStack(n){return this._commandExecutionStack.push(n),We(()=>kr(this._commandExecutionStack,n))}_registerMultiCommand(n){const r=this._commandRegistry.getCommand(n.id);let s;if(r){if(r[0].multi!==!0)throw new Error("Command has registered as a single command.");s=r[0]}else{s=new z_(n.id);const o=new Vs;o.add(this._commandRegistry.registerCommand(s)),o.add(We(()=>{this._multiCommandDisposables.delete(n.id)})),this._multiCommandDisposables.set(n.id,o)}const i=s.registerImplementation(n);return We(()=>{var o;i.dispose(),s.hasImplementations()||(o=this._multiCommandDisposables.get(n.id))==null||o.dispose()})}async _execute(n,r,s){if(s!=null&&s.syncOnly)return!0;this._configService.getConfig(Ns)!==!1&&this._logService.debug("[CommandService]",`${"|-".repeat(Math.max(this._commandExecutingLevel,0))}executing command "${n.id}"`),this._commandExecutingLevel++;let i;try{i=await this._injector.invoke(n.handler,r,s),this._commandExecutingLevel--}catch(o){throw i=!1,this._commandExecutingLevel=0,o}return i}_syncExecute(n,r,s){if(s!=null&&s.syncOnly)return!0;this._configService.getConfig(Ns)!==!1&&this._logService.debug("[CommandService]",`${"|-".repeat(Math.max(0,this._commandExecutingLevel))}executing command "${n.id}".`),this._commandExecutingLevel++;let i;try{if(i=this._injector.invoke(n.handler,r,s),i instanceof Promise)throw new TypeError("[CommandService]: Command handler should not return a promise.");this._commandExecutingLevel--}catch(o){throw i=!1,this._commandExecutingLevel=0,o}return i}};exports.CommandService=Y_([gi(0,ye.Inject(ye.Injector)),gi(1,mt),gi(2,$r)],exports.CommandService);class z_{constructor(t){p(this,"name");p(this,"multi",!0);p(this,"type",0);p(this,"priority",0);p(this,"_implementations",[]);p(this,"handler",async(t,n)=>{if(!this._implementations.length)return!1;const r=t.get(mt),s=t.get(er),i=t.get(ye.Injector);for(const o of this._implementations){const a=o.command.preconditions;if((!a||a&&a(s))&&(r.debug("[MultiCommand]",`executing implementation "${o.command.name}".`),await i.invoke(o.command.handler,n)))return!0}return!1});this.id=t,this.name=t}registerImplementation(t){const n={command:t};return this._implementations.push(n),this._implementations.sort((r,s)=>s.command.priority-r.command.priority),We(()=>{const r=this._implementations.indexOf(n);this._implementations.splice(r,1)})}hasImplementations(){return this._implementations.length>0}}function Ks(e,t,n){const r=e.map(s=>()=>t.syncExecuteCommand(s.id,s.params,n));return fc(r)}function G_(e,t,n){const r=e.map(s=>()=>t.executeCommand(s.id,s.params,n));return dc(r)}function pu(e){return new le.Observable(t=>{const n=e((...r)=>t.next(r));return()=>n==null?void 0:n.dispose()})}function Fi(e){return function(n){return new le.Observable(r=>(n.subscribe({next:s=>{r.next(s),e(s)&&r.complete()},complete:()=>r.complete(),error:s=>r.error(s)}),()=>r.unsubscribe()))}}function K_(e=0){return t=>{let n=[];return t.pipe(le.tap(r=>n.push(r)),le.debounceTime(e),le.map(()=>n),le.tap(()=>n=[]))}}function X_(e){const t=new le.ReplaySubject(1);return setTimeout(()=>t.next(),e),t.pipe(le.take(1))}function q_(e,t){const n=new le.BehaviorSubject(t);return e.subscribe(n),n}const J_=e=>new Promise(t=>{le.merge(pu(e.onCommandExecuted.bind(e)).pipe(us.filter(([n])=>n.type===jr.MUTATION)),le.timer(300)).pipe(us.debounceTime(16),us.first()).subscribe(()=>{t()})});function Eu(e,t){let n=0,r=e.length-1;if(t<e[0])return 0;if(t>=e[e.length-1])return e.length-1;for(;n<=r;){if(e[n]===t){for(;n<e.length&&e[n]===t;)n++;return n}if(t>e[n]&&t<e[n+1])return n+1;if(e[r]===t){for(;r<e.length&&e[r]===t;)r++;return r}if(t>e[r-1]&&t<e[r])return r;n++,r--}return-1}function Z_(e,t){let n=0,r=e.length-1;for(;n<=r;){const s=Math.floor((r+n)/2);if(t<e[s]&&(s===0||t>=e[s-1]))return s;if(t>=e[s])n=s+1;else if(t<e[s])r=s-1;else return-1}return-1}function Cu(e,t){let n=0,r=e.length;for(;n<r;){const s=Math.floor((n+r)/2);e[s]<=t?n=s+1:r=s}return n<e.length?n:e.length-1}function ur(e,t,n=!1){let r=e.length-1;if(t<0||t<e[0])return 0;if(e.length<40||t<=e[20]||t>=e[r-20]?r=Eu(e,t):r=Cu(e,t),n){const s=e[r];return e.indexOf(s)}return r}function Q_(e){const t=new Blob([e],{type:"text/javascript"});return window.URL.createObjectURL(t)}const hr=2,Ru=1;function ep(e,t){if(t==null||e==null)return!0;const{left:n=0,top:r=0,height:s=0,width:i=0,angle:o=0}=t,{left:a=0,top:l=0,height:c=0,width:u=0,angle:h=0}=e,d=u,f=c,g=i,_=s;return Math.abs(a-n)>hr||Math.abs(l-r)>hr||Math.abs(d-g)>hr||Math.abs(f-_)>hr||Math.abs(h-o)>Ru}function hs(e,t,n){const{dataStream:r,textRuns:s=[]}=e;let i=t;const o=[];for(const a of s){const{st:l,ed:c}=a;Z.hasIntersectionBetweenTwoRanges(t,n,l,c)&&(l>i?(o.push(r.slice(i,l)),o.push(Hi(r,{...a,ed:Math.min(c,n)}))):o.push(Hi(r,{...a,st:i,ed:Math.min(c,n)}))),i=Math.max(t,Math.min(c,n))}return i!==n&&o.push(r.slice(i,n)),o.join("")}function tp(e,t=!0){var n;if(t&&((n=e.paragraphs)!=null&&n.length)){const{dataStream:r,paragraphs:s=[]}=e;let i="",o=-1;for(const a of s){const{startIndex:l,paragraphStyle:c={}}=a,{spaceAbove:u,spaceBelow:h,lineSpacing:d}=c,f=[];u!=null&&(typeof u=="number"?f.push(`margin-top: ${u}px`):f.push(`margin-top: ${u.v}px`)),h!=null&&(typeof h=="number"?f.push(`margin-bottom: ${h}px`):f.push(`margin-bottom: ${h.v}px`)),d!=null&&f.push(`line-height: ${d}`),l>o+1?i+=`<p class="UniverNormal" ${f.length?`style="${f.join("; ")};"`:""}>${hs(e,o+1,l)}</p>`:i+=`<p class="UniverNormal" ${f.length?`style="${f.join("; ")};"`:""}></p>`,o=l}return o!==r.length&&(i+=hs(e,o,r.length)),i}else return hs(e,0,e.dataStream.length)}function Hi(e,t){const{st:n,ed:r,ts:s={}}=t,{ff:i,fs:o,it:a,bl:l,ul:c,st:u,ol:h,bg:d,cl:f,va:g}=s;let _=e.slice(n,r);const R=[];return a===ie.TRUE&&(_=`<i>${_}</i>`),g===Vt.SUPERSCRIPT?_=`<sup>${_}</sup>`:g===Vt.SUBSCRIPT&&(_=`<sub>${_}</sub>`),(c==null?void 0:c.s)===ie.TRUE&&(_=`<u>${_}</u>`),(u==null?void 0:u.s)===ie.TRUE&&(_=`<s>${_}</s>`),l===ie.TRUE&&(_=`<strong>${_}</strong>`),i&&R.push(`font-family: ${i}`),f&&R.push(`color: ${f.rgb}`),o&&R.push(`font-size: ${o}pt`),h&&R.push("text-decoration: overline"),d&&R.push(`background: ${d.rgb}`),R.length?`<span style="${R.join("; ")};">${_}</span>`:_}const Iu={[Gs.OFFICE]:{[ot.ACCENT1]:"#4472C4",[ot.ACCENT2]:"#ED7D31",[ot.ACCENT3]:"#A5A5A5",[ot.ACCENT4]:"#70AD47",[ot.ACCENT5]:"#5B9BD5",[ot.ACCENT6]:"#70AD47",[ot.DARK1]:"#000000",[ot.DARK2]:"#44546A",[ot.LIGHT1]:"#FFFFFF",[ot.LIGHT2]:"#E7E6E6",[ot.HYPERLINK]:"#0563C1",[ot.FOLLOWED_HYPERLINK]:"#954F72"}};class Xs{constructor(){p(this,"_themeValue",ot.LIGHT1);p(this,"_themeColors");p(this,"_themeTint");p(this,"_rgbValue","");p(this,"_colorType");this._colorType=It.UNSUPPORTED,this._themeColors=Gs.OFFICE,this._themeTint=0}asRgbColor(){return new Ms(this._rgbValue,this)}asThemeColor(){return new Ds(this._themeValue,this._themeTint,this._themeColors,this)}build(){switch(this._colorType){case It.THEME:return this.asThemeColor();case It.RGB:return this.asRgbColor();case It.UNSUPPORTED:throw new Error("unsupported color type")}}setRgbColor(t){return this._colorType=It.RGB,this._rgbValue=t,this}setThemeColors(t){this._colorType=It.THEME,this._themeColors=t}setThemeTint(t){this._colorType=It.THEME,this._themeTint=t}setThemeColor(t){return this._colorType=It.THEME,this._themeValue=t,this}getColorType(){return this._colorType}}class On{constructor(t){p(this,"_builder");this._builder=t}static rgbColorToHexValue(t){return`#${((1<<24)+(t.getRed()<<16)+(t.getGreen()<<8)+t.getBlue()).toString(16).slice(1)}`}static hexValueToRgbColor(t){t?t.indexOf("#")>-1&&(t=t.substring(1)):t="#000000";const n=+`0x${t[0]}${t[1]}`,r=+`0x${t[2]}${t[3]}`,s=+`0x${t[4]}${t[5]}`;return new Xs().setRgbColor(`rgb(${n},${r},${s})`).asRgbColor()}static hexToRgbString(t){const n=/^#?([a-f\d])([a-f\d])([a-f\d])$/i;t=t.replace(n,(i,o,a,l)=>o+o+a+a+l+l);const r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);let s=null;if(r){const i=Number.parseInt(r[1],16),o=Number.parseInt(r[2],16),a=Number.parseInt(r[3],16);s=`rgba(${i},${o},${a})`}return s}asRgbColor(){return this._builder.asRgbColor()}asThemeColor(){return this._builder.asThemeColor()}getColorType(){return this._builder.getColorType()}clone(){return new On(this._builder)}equals(t){return!1}}class Su{constructor(t){p(this,"_saturation",0);p(this,"_hue",0);p(this,"_lightness",0);p(this,"_alpha",0);const n=t.getRed()/255,r=t.getGreen()/255,s=t.getBlue()/255,i=t.getAlpha()/255,o=Math.min(n,Math.min(r,s)),a=Math.max(n,Math.max(r,s)),l=a-o;if(a===o){this._hue=0,this._saturation=0,this._lightness=a;return}this._lightness=(o+a)/2,this._lightness<.5?this._saturation=l/(a+o):this._saturation=l/(2-a-o),n===a&&(this._hue=(r-s)/l),r===a&&(this._hue=2+(s-n)/l),s===a&&(this._hue=4+(n-r)/l),this._hue*=60,this._hue<0&&(this._hue+=360),this._alpha=i}asRgbColor(){const t=new Xs;if(this._saturation===0)return t.setRgbColor(`rgba(${this._lightness*255},${this._lightness*255},${this._lightness*255},${this._alpha*255})`),t.asRgbColor();let n;this._lightness<.5?n=this._lightness*(1+this._saturation):n=this._lightness+this._saturation-this._lightness*this._saturation;const r=2*this._lightness-n,s=this._hue/360,i=s+1/3,o=this.setColor(n,r,i),a=this.setColor(n,r,s),l=s-1/3,c=this.setColor(n,r,l);return t.setRgbColor(`rgba(${Math.round(o*255)},${Math.round(a*255)},${Math.round(c*255)},${this._alpha*255})`),t.asRgbColor()}getLightness(){return this._lightness}getHue(){return this._hue}getSaturation(){return this._saturation}getAlpha(){return this._alpha}setColor(t,n,r){r<0&&(r+=1),r>1&&(r-=1);let s;return 6*r<1?s=n+(t-n)*6*r:2*r<1?s=t:3*r<2?s=n+(t-n)*(2/3-r)*6:s=n,s}setLightness(t){this._lightness=t}}const Ct=class Ct extends On{constructor(n,r){super(r);p(this,"_cssString");p(this,"_red");p(this,"_green");p(this,"_blue");p(this,"_alpha");let s=n.match(Ct.RGBA_EXTRACT);if(s){const i=+s[1],o=+s[2],a=+s[3],l=+s[4];this._cssString=n,this._red=i,this._green=o,this._blue=a,this._alpha=l;return}if(s=n.match(Ct.RGB_EXTRACT),s){const i=+s[1],o=+s[2],a=+s[3];this._cssString=n,this._red=i,this._green=o,this._blue=a,this._alpha=1;return}throw new Error("Invalid rgba or rgb color")}asHexString(){return On.rgbColorToHexValue(this)}getRed(){let n=this._red+Ct.RGB_COLOR_AMT;return n>255?n=255:n<0&&(n=0),n}getGreen(){let n=this._green+Ct.RGB_COLOR_AMT;return n>255?n=255:n<0&&(n=0),n}getBlue(){let n=this._blue+Ct.RGB_COLOR_AMT;return n>255?n=255:n<0&&(n=0),n}getAlpha(){return this._alpha}getColorType(){return It.RGB}clone(){return new Ct(this._cssString,this._builder)}asThemeColor(){throw new Error("rgb color not support to themeColor")}equals(n){return n instanceof Ct?n._red===this._red&&n._blue===this._blue&&n._green===this._green&&n._alpha===this._alpha:!1}getCssString(){return this._cssString}};p(Ct,"RGB_COLOR_AMT",0),p(Ct,"RGBA_EXTRACT",new RegExp("\\s*rgba\\s*\\((\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d.\\d|\\d\\s*)\\)\\s*")),p(Ct,"RGB_EXTRACT",new RegExp("\\s*rgb\\s*\\((\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d+\\s*)\\)\\s*"));let Ms=Ct;const Qt=class Qt extends On{constructor(n,r,s,i){super(i);p(this,"_themeColorType");p(this,"_themeTint");p(this,"_themeColors");this._themeColorType=n,this._themeTint=r,this._themeColors=s}lumValue(n,r){if(n==null)return r;let s;return n<0?s=r*(1+n):s=r*(1-n)+(255-255*(1-n)),s}asRgbColor(){const n=Iu[this._themeColors];if(n==null)throw new Error("not find themeColors type");const r=n[this._themeColorType];if(r==null)throw new Error("not find themeColors value");let s;if(Qt._cacheThemeColor.has(this._themeColors)){if(s=Qt._cacheThemeColor.get(this._themeColors),s.has(this._themeColorType))return s.get(this._themeColorType)}else s=new Map,Qt._cacheThemeColor.set(this._themeColors,s);const i=new Su(On.hexValueToRgbColor(r));i.setLightness(this.lumValue(this._themeTint,i.getLightness()*255)/255);const o=i.asRgbColor();return s.set(this._themeColorType,o),o}clone(){return new Qt(this._themeColorType,this._themeTint,this._themeColors,this._builder)}equals(n){return n instanceof Qt?n._themeColorType===this._themeColorType:!1}getColorType(){return It.THEME}getThemeColorType(){return this._themeColorType}};p(Qt,"_cacheThemeColor",new Map);let Ds=Qt;const np="rgb(",rp="rgba(",Bi={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],blanchealmond:[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],darkyellow:[139,128,0],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],midbightblue:[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]};class Rt{constructor(t){p(this,"_color");p(this,"_rgbColor");p(this,"_isValid",!1);if(t==null){this._setNullColor();return}if(t instanceof Rt){this._color={...t._color},this._rgbColor={...t._rgbColor};return}const n=Ou(t);if(n==null){this._setNullColor();return}this._color=n;const r=lp(this._color);if(r==null){this._setNullColor();return}this._rgbColor=r,this._isValid=!0}static mix(t,n,r){var c,u;r=Math.min(1,Math.max(0,r));const s=new Rt(t).toRgb(),i=new Rt(n).toRgb(),o=(c=s.a)!=null?c:1,a=(u=i.a)!=null?u:1,l={r:(i.r-s.r)*r+s.r,g:(i.g-s.g)*r+s.g,b:(i.b-s.b)*r+s.b,a:(a-o)*r+o};return new Rt(l)}static getContrastRatio(t,n){const r=new Rt(t).getLuminance(),s=new Rt(n).getLuminance();return(Math.max(r,s)+.05)/(Math.min(r,s)+.05)}get isValid(){return this._isValid}toRgb(){return this._rgbColor}toRgbString(){const{r:t,g:n,b:r,a:s=1}=this.toRgb(),i=s<1;return`rgb${i?"a":""}(${t},${n},${r}${i?`,${s}`:""})`}toString(){return this.toRgbString()}toHexString(t){const{r:n,g:r,b:s,a:i=1}=this.toRgb(),o=i<1,a=[es(Math.round(n).toString(16)),es(Math.round(r).toString(16)),es(Math.round(s).toString(16)),es(Math.round(i*255).toString(16))];return t&&a[0][0]===a[0][1]&&a[1][0]===a[1][1]&&a[2][0]===a[2][1]&&a[3][0]===a[3][1]?o?`#${a[0][0]}${a[1][0]}${a[2][0]}${a[3][0]}`:`#${a[0][0]}${a[1][0]}${a[2][0]}`:o?`#${a[0]}${a[1]}${a[2]}${a[3]}`:`#${a[0]}${a[1]}${a[2]}`}toHsv(){return dp(this.toRgb())}toHsl(){return hp(this.toRgb())}lighten(t=10){const n=this.toHsl();return n.l+=t,n.l=Math.min(Math.max(n.l,0),100),new Rt(n)}darken(t=10){const n=this.toHsl();return n.l-=t,n.l=Math.min(Math.max(n.l,0),100),new Rt(n)}setAlpha(t){return new Rt({...this._rgbColor,a:t})}getLuminance(){let{r:t,g:n,b:r}=this.toRgb();return t=_i(t),n=_i(n),r=_i(r),Number((.2126*t+.7152*n+.0722*r).toFixed(3))}getBrightness(){const{r:t,g:n,b:r}=this.toRgb();return(t*299+n*587+r*114)/1e3}getAlpha(){var t;return(t=this._color.a)!=null?t:1}isDark(){return this.getBrightness()<128}isLight(){return!this.isDark()}_setNullColor(){this._isValid=!1,this._color={r:0,g:0,b:0,a:0},this._rgbColor={r:0,g:0,b:0,a:0}}}const es=e=>e.length===1?`0${e}`:e,_i=e=>(e/=255,e<=.03928?e/12.92:((e+.055)/1.055)**2.4),Ou=e=>{if(mp(e)){if("r"in e){const r={r:Math.round(e.r),g:Math.round(e.g),b:Math.round(e.b)};return e.a!==void 0&&(r.a=e.a),r}if("l"in e){const r={h:Math.round(e.h),s:e.s,l:e.l};return e.a!==void 0&&(r.a=e.a),r}const n={h:Math.round(e.h),s:e.s,v:e.v};return e.a!==void 0&&(n.a=e.a),n}const t=e.trim().toLowerCase();if(Bi[t]){const n=Bi[t],r={r:Math.round(n[0]),g:Math.round(n[1]),b:Math.round(n[2])};return r.a=n[3]||1,r}if(t.startsWith("#"))return sp(t);if(t.startsWith("rgb"))return ip(t);if(t.startsWith("hsl"))return op(t);if(t.startsWith("hsv"))return ap(t)},sp=e=>{const t=e.substring(1),n=new RegExp(`.{1,${t.length>=6?2:1}}`,"g");let r=t.match(n);if(!r||r.length<3)throw new Error(`The color '${e}' is illegal hex color`);r[0].length===1&&(r=r.map(i=>i+i));const s={r:Number.parseInt(r[0],16),g:Number.parseInt(r[1],16),b:Number.parseInt(r[2],16)};return r.length>3&&(s.a=Number.parseInt(r[3],16)/255),s},ip=e=>{const t=e.indexOf("(");if(t===-1)throw new Error(`The color '${e}' is illegal rgb color`);const n=e.substring(t+1,e.length-1).split(",");if(n.length<3)throw new Error(`The color '${e}' is illegal rgb color`);const r={r:Number.parseInt(n[0],10),g:Number.parseInt(n[1],10),b:Number.parseInt(n[2],10)};return n.length>3&&(r.a=Number.parseFloat(n[3])),r},op=e=>{const t=e.indexOf("(");if(t===-1)throw new Error(`The color '${e}' is illegal hsl color`);const n=e.substring(t+1,e.length-1).split(",");if(n.length<3)throw new Error(`The color '${e}' is illegal hsl color`);const r={h:Number.parseInt(n[0],10),s:Number.parseFloat(n[1]),l:Number.parseFloat(n[2])};return n.length>3&&(r.a=Number.parseFloat(n[3])),r},ap=e=>{const t=e.indexOf("(");if(t===-1)throw new Error(`The color '${e}' is illegal hsv color`);const n=e.substring(t+1,e.length-1).split(",");if(n.length<3)throw new Error(`The color '${e}' is illegal hsv color`);const r={h:Number.parseInt(n[0],10),s:Number.parseFloat(n[1]),v:Number.parseFloat(n[2])};return n.length>3&&(r.a=Number.parseFloat(n[3])),r},lp=e=>{const t=Ou(e);if(t!=null)return"r"in t?t:"l"in t?cp(t):up(t)},pi=(e,t,n)=>(n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e),cp=e=>{let{h:t,s:n,l:r}=e;t/=360,n/=100,r/=100;let s=0,i=0,o=0;if(n===0)s=i=o=r;else{const l=r<.5?r*(1+n):r+n-r*n,c=2*r-l;s=pi(c,l,t+1/3),i=pi(c,l,t),o=pi(c,l,t-1/3)}const a={r:Math.round(s*255),g:Math.round(i*255),b:Math.round(o*255)};return e.a!==void 0&&(a.a=e.a),a},up=e=>{let{h:t,s:n,v:r}=e;t=t/360*6,n/=100,r/=100;const s=Math.floor(t),i=t-s,o=r*(1-n),a=r*(1-i*n),l=r*(1-(1-i)*n),c=s%6,u=[r,a,o,o,l,r][c],h=[l,r,r,a,o,o][c],d=[o,o,l,r,r,a][c],f={r:u*255,g:h*255,b:d*255};return e.a!==void 0&&(f.a=e.a),f},hp=e=>{let{r:t,g:n,b:r}=e;t/=255,n/=255,r/=255;const s=Math.max(t,n,r),i=Math.min(t,n,r),o=(s+i)/2;let a,l;if(s===i)a=l=0;else{const u=s-i;switch(l=o>.5?u/(2-s-i):u/(s+i),s){case t:a=(n-r)/u+(n<r?6:0);break;case n:a=(r-t)/u+2;break;default:a=(t-n)/u+4;break}a/=6}const c={h:Math.round(a*360),s:Math.round(l*100),l:Math.round(o*100)};return e.a!==void 0&&(c.a=e.a),c},dp=e=>{let{r:t,g:n,b:r}=e;t/=255,n/=255,r/=255;const s=Math.max(t,n,r),i=Math.min(t,n,r);let o;const a=s,l=s-i,c=s===0?0:l/s;if(s===i)o=0;else{switch(s){case t:o=(n-r)/l+(n<r?6:0);break;case n:o=(r-t)/l+2;break;default:o=(t-n)/l+4;break}o/=6}const u={h:Math.round(o*360),s:Math.round(c*100),v:Math.round(a*100)};return e.a!==void 0&&(u.a=e.a),u},fp=e=>e==null,mp=e=>!fp(e)&&typeof e=="object";function gp(e){const t=/^#(?:[0]{3}|[0]{6})\b/,n=/^rgb\s*\(\s*0+\s*,\s*0+\s*,\s*0+\s*\)$/,r=/^rgba\s*\(\s*0+\s*,\s*0+\s*,\s*0+\s*,\s*(1|1\.0*|0?\.\d+)\)$/,s=/^hsl\s*\(\s*0*\s*,\s*0%*\s*,\s*0%*\s*\)$/,i=/^hsla\s*\(\s*0*\s*,\s*0%*\s*,\s*0%*\s*,\s*(1|1\.0*|0?\.\d+)\)$/;return!!(t.test(e)||n.test(e)||r.test(e)||s.test(e)||i.test(e))}function _p(e){const t=/^#(?:[Ff]{3}|[Ff]{6})\b/,n=/^rgb\s*\(\s*255\s*,\s*255\s*,\s*255\s*\)$/,r=/^rgba\s*\(\s*255\s*,\s*255\s*,\s*255\s*,\s*(1|1\.0*|0?\.\d+)\)$/,s=/^hsl\s*\(\s*0*\s*,\s*0%*\s*,\s*100%*\s*\)$/,i=/^hsla\s*\(\s*0*\s*,\s*0%*\s*,\s*100%*\s*,\s*(1|1\.0*|0?\.\d+)\)$/;return!!(t.test(e)||n.test(e)||r.test(e)||s.test(e)||i.test(e))}function wu(e){return e&&(e.s!==void 0||e.p!==void 0||e.v!==void 0||e.t!==void 0||e.f!==void 0||e.si!==void 0||e.custom!==void 0)}function pp(e){if(e.t!==void 0)return e.t;if(typeof e.v=="string")return nn.STRING;if(typeof e.v=="number")return nn.NUMBER;if(typeof e.v=="boolean")return nn.BOOLEAN}function Ep(e){if(e==null)return!0;const{v:t,f:n,si:r,p:s,custom:i}=e;return!(!(t==null||typeof t=="string"&&t.length===0)||n!=null&&n.length>0||r!=null&&r.length>0||s!=null||i!=null)}function vu(e){return e!=null&&(typeof e=="string"||typeof e=="number"||typeof e=="boolean")}var _e=(e=>(e[e.NORMAL=0]="NORMAL",e[e.ROW=1]="ROW",e[e.COLUMN=2]="COLUMN",e[e.ALL=3]="ALL",e))(_e||{}),Me=(e=>(e[e.NONE=0]="NONE",e[e.ROW=1]="ROW",e[e.COLUMN=2]="COLUMN",e[e.ALL=3]="ALL",e))(Me||{});function Cp(e){return[e.startRow,e.startColumn,e.endRow,e.endColumn]}var bu=(e=>(e.NONE="none",e.BACKWARD="backward",e.FORWARD="forward",e))(bu||{}),yu=(e=>(e.RECT="RECT",e.TEXT="TEXT",e))(yu||{});function Rp(e,t,n){let r=!1,s=!1,i=e,o=t,a=e,l=t;if(n==null)return{actualRow:e,actualColumn:t,isMergedMainCell:s,isMerged:r,endRow:i,endColumn:o,startRow:a,startColumn:l};for(let c=0;c<n.length;c++){const{startRow:u,endRow:h,startColumn:d,endColumn:f}=n[c];if(e===u&&t===d){i=h,o=f,a=u,l=d,s=!0;break}if(e>=u&&e<=h&&t>=d&&t<=f){i=h,o=f,a=u,l=d,r=!0;break}}return{actualRow:e,actualColumn:t,isMergedMainCell:s,isMerged:r,endRow:i,endColumn:o,startRow:a,startColumn:l}}var Hn=(e=>(e.Raw="raw",e.Intercepted="intercepted",e.Both="both",e))(Hn||{});function Ip(e,t){const n={};for(const r in e){const s=Number(r),i=e[s];for(const o in i){const a=Number(o),l=i[a],c=t(s,a,l);c!==void 0&&(n[s]?n[s][a]=c:n[s]={[a]:c})}}return n}function rn(e){let t=0;const n=Object.keys(e);for(const r of n){const s=Number(r);t=Math.max(t,s)}return t+1}function Sp(e,t,n){const r=rn(n),s=n;for(let i=r-1;i>=e;i--)s[i+1]=s[i];s[e]=t}function $i(e,t,n){const r=Object.keys(n).reduce((s,i)=>Math.max(s,Number.parseInt(i)),0)+1;for(let s=e;s<r;s++)s<e+t?delete n[s]:n[s]!==void 0&&(n[s-t]=n[s],delete n[s])}function Op(e,t){const n=e,r=Object.keys(n),s=r.length,i=t,o=Object.keys(i),a=o.length,l={};let c=0;for(let u=0;u<s;u++,c++){const h=r[u];l[c]=n[h]}for(let u=0;u<a;u++,c++){const h=o[u];l[c]=i[h]}return l}function wp(e,t,n){const r=n;if(rn(n)>0){const i={};let o=0;for(let a=e;a<=t;a++)r[a]&&(i[o]=r[a],o++);return i}return{}}function ji(e,t,n,r){const s=e>n;if(!s&&e+t>n)throw new Error("Invalid move operation");s?vp(e,t,n,r):bp(e,t,n,r)}function vp(e,t,n,r){const s=r,i=[];for(let o=e;o<e+t;o++)i.push(s[o]);for(let o=e-1;o>=n;o--){const a=s[o];s[o+t]=a,a===void 0&&delete s[o+t]}i.forEach((o,a)=>{s[n+a]=o,o===void 0&&delete s[n+a]})}function bp(e,t,n,r){const s=r,i=[];for(let o=e;o<e+t;o++)i.push(s[o]);for(let o=e+t;o<n;o++){const a=s[o];s[o-t]=a,a===void 0&&delete s[o-t]}i.forEach((o,a)=>{s[n+a-t]=o,o===void 0&&delete s[n+a-t]})}class ct{constructor(t={}){p(this,"_matrix");this._setOriginValue(t)}static MakeObjectMatrixSize(t){return new ct({[t-1]:{}})}getMatrix(){return this._matrix}forEach(t){const n=this._matrix,r=Object.keys(n);for(const s of r){const i=Number(s),o=n[i];if(t(i,o)===!1)return this}return this}forRow(t){const n=this._matrix,r=Object.keys(n);for(const s of r){const i=Number(s),o=n[i];if(t(i,Object.keys(o).map(l=>Number(l)))===!1)return this}return this}forValue(t){const n=this._matrix;for(const r in n){const s=Number(r),i=n[s];if(i)for(const o in i){const a=Number(o),l=i[a];if(t(s,a,l)===!1)return this}}return this}swapRow(t,n){const r=this._matrix[t],s=this._matrix[n];this._matrix[t]=s,this._matrix[n]=r}getRow(t){return this._matrix[t]}getRowOrCreate(t){let n=this.getRow(t);return n==null&&(n={},this._matrix[t]=n),n}reset(){this._setOriginValue({})}hasValue(){const t=this._matrix,n=Object.keys(t);if(n.length===0)return!1;for(const r of n){const s=Number(r),i=t[s];if(Object.keys(i).length>0)return!0}return!1}getValue(t,n){var r,s;return(s=(r=this._matrix)==null?void 0:r[t])==null?void 0:s[n]}setValue(t,n,r){const s=this.getRowOrCreate(t);s[n]=r}deleteValue(t,n){var r,s;(s=(r=this._matrix)==null?void 0:r[t])==null||delete s[n]}realDeleteValue(t,n){var r,s,i;if((s=(r=this._matrix)==null?void 0:r[t])==null||delete s[n],this.getRow(t)){const o=this.getRow(t);if(o==null)return;Object.keys(o).length===0&&((i=this._matrix)==null||delete i[t])}}setRow(t,n){this._matrix[t]=n}moveRows(t,n,r){ji(t,n,r,this._matrix)}moveColumns(t,n,r){this.forEach((s,i)=>{ji(t,n,r,i)})}insertRows(t,n){const r=Object.keys(this._matrix);for(let s=r.length-1;s>=0;s--){const i=Number(r[s]);if(i>=t){const o=this._matrix[i];delete this._matrix[i],this._matrix[i+n]=o}}}insertColumns(t,n){const r=Object.keys(this._matrix);for(let s=0;s<r.length;s++){const i=Number(r[s]),o=this._matrix[i],a=Object.keys(o);for(let l=a.length-1;l>=0;l--){const c=Number(a[l]);if(c>=t){const u=o[c];delete o[c],o[c+n]=u}}}}removeRows(t,n){$i(t,n,this._matrix)}removeColumns(t,n){this.forEach((r,s)=>{s&&$i(t,n,s)})}getFragment(t,n,r,s){const i=new ct;let o=0;for(let a=t;a<=n;a++){const l={};let c=0;for(let u=r;u<=s;u++){const h=this.getValue(a,u);l[c]=h,c++}i.setRow(o,l),o++}return i}getSlice(t,n,r,s){const i=new ct;for(let o=t;o<=n;o++)for(let a=r;a<=s;a++){const l=this.getValue(o,a);l&&i.setValue(o,a,Z.deepClone(l))}return i}getSliceDataAndCellCountByRows(t,n){const r=new ct;let s=0;for(let i=t;i<=n;i++){const o=this.getRow(i);o&&(r.setRow(i,o),s+=Object.keys(o).length)}return{sliceData:r,cellCount:s}}getSizeOf(){return Object.keys(this._matrix).length}getLength(){return rn(this._matrix)}getRange(){const r=this.getLength()-1;let s=0;const i=this.getLength();for(let o=0;o<i;o++){const a=this.getRow(o);if(a){const l=rn(a)-1;s=l>s?l:s}}return{startRow:0,startColumn:0,endRow:r,endColumn:s}}getRealRange(){const t=Object.keys(this._matrix),n=t.length,r=n>0?Number(t[0]):0,s=n>0?Number(t[n-1]):0;let i=-1/0,o=0;for(const a of t){const l=this.getRow(Number(a));if(l){const c=Object.keys(l);if(c.length>0){const u=Number(c[0]),h=Number(c[c.length-1]);(i===-1/0||u<i)&&(i=u),h>o&&(o=h)}}}return i===-1/0&&(i=0),{startRow:r,endRow:s,startColumn:i,endColumn:o}}getRealRowRange(){const t=Object.keys(this._matrix),n=t.length,r=n>0?Number(t[0]):0,s=n>0?Number(t[n-1]):0;return{startRow:r,endRow:s}}toNativeArray(){const t=new Array;return this.forValue((n,r,s)=>{t.push(s)}),t}toArray(){const t=[];return this.forRow((n,r)=>{t[n]==null&&(t[n]=[]),r.forEach(s=>{t[n][s]=this.getValue(n,s)})}),t}toFullArray(){const t=this.getRange(),{endColumn:n,endRow:r}=t,s=[];for(let i=0;i<=r;i++){const o=new Array(n+1).fill(void 0);s.push(o)}return this.forValue((i,o,a)=>{s[i][o]=a}),s}toJSON(){return this._matrix}clone(){const t=JSON.stringify(this._matrix);return JSON.parse(t)}getData(){const t=JSON.stringify(this._matrix);return JSON.parse(t)}getArrayData(){let t=0,n=0,r=!1,s=!1;const i=new ct;return this.forEach((o,a)=>{r||(r=!0,t=o),Object.keys(a).forEach(l=>{const c=Number(l);s?c<n&&(n=c):(s=!0,n=c);const u=this.getValue(o,c);i.setValue(o-t,c-n,u)})}),i.getData()}getStartEndScope(){let t=1/0,n=-1/0,r=1/0,s=-1/0;const i=Object.keys(this._matrix);i.length>0&&(t=+i[0],n=+i[i.length-1]);for(const o of i){const a=Object.keys(this._matrix[o]);a.length>0&&(r=Math.min(r,+a[0]),s=Math.max(s,+a[a.length-1]))}return{startRow:t,endRow:n,startColumn:r,endColumn:s}}getDataRange(){let t=0,n=0,r=0,s=-1,i=!1,o=!1;return this.forEach((a,l)=>{if(i||(i=!0,t=a),l==null)return;const c=rn(l)-1;c>r&&(r=c),Object.keys(l).forEach(u=>{const h=Number(u);o?h<n&&(n=h):(o=!0,n=h)}),a>s&&(s=a)}),{startRow:t,startColumn:n,endRow:s,endColumn:r}}getDiscreteRanges(){const t=[];return this.forEach((n,r)=>{Object.keys(r).forEach(s=>{const i=Number(s);let o=!1;for(const a of t)if(n>=a.startRow&&n<=a.endRow+1&&i>=a.startColumn&&i<=a.endColumn+1){a.endRow=Math.max(n,a.endRow),a.endColumn=Math.max(i,a.endColumn),o=!0;break}o||t.push({startRow:n,endRow:n,startColumn:i,endColumn:i})})}),t}merge(t){this.forValue((n,r)=>{const s=t.getValue(n,r);s!=null&&this.setValue(n,r,s)})}concatRows(t){const n=t.getMatrix();for(const r in n){const s=Number(r);this.setRow(s,n[s])}}_setOriginValue(t={}){this._matrix=t}}function Au(e){const{actualRow:t,actualColumn:n,isMerged:r,isMergedMainCell:s,mergeInfo:i}=e;let{startY:o,endY:a,startX:l,endX:c}=e,u=t,h=n,d=t,f=n;if(r&&i){const{startRow:g,startColumn:_,endRow:R,endColumn:b,startY:F,endY:k,startX:W,endX:S}=i;u=g,h=_,d=R,f=b,o=F,a=k,l=W,c=S}return s&&(o=i.startY,a=i.endY,l=i.startX,c=i.endX,d=i.endRow,f=i.endColumn),{startRow:u,startColumn:h,endRow:d,endColumn:f,startY:o,endY:a,startX:l,endX:c}}const yp=Au;function Ap(e){if(!e)return;const{actualRow:t,actualColumn:n,isMerged:r,isMergedMainCell:s,startRow:i,startColumn:o,endRow:a,endColumn:l}=e;let c=t,u=n,h=t,d=n;return(r||s)&&(c=i,u=o,h=a,d=l),{startRow:c,startColumn:u,endRow:h,endColumn:d}}function Tu(e){var n;return!e||(((n=e==null?void 0:e.v)==null?void 0:n.toString())||"").length===0&&!e.p}function Wi(e){return Tu(e)&&(e==null?void 0:e.coverable)!==!1}function Ut(e){if(e){if(e.rgb)return new Rt(e.rgb).toHexString();if(e.th)return new Xs().setThemeColor(e.th).asThemeColor().asRgbColor().getCssString()}return null}function Nu(e){return Z.isString(e)&&e.substring(0,1)==="="&&e.length>1}function Tp(e){return Z.isString(e)&&e.length>0}function Np(e,t=!1){var i;let n="";const r=new Map([["ff",()=>{e.ff&&(n+=`font-family: ${e.ff}; `)}],["fs",()=>{if(e.fs){let o=e.fs;e.va&&(o/=2),n+=`font-size: ${o}pt; `}}],["it",()=>{e.it&&(n+="font-style: italic; ")}],["bl",()=>{e.bl&&(n+="font-weight: bold; ")}],["ul",()=>{var o;(o=e.ul)!=null&&o.s&&(n.indexOf("text-decoration-line")>-1?n=n.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g,(a,l)=>`${l} underline`):n+="text-decoration: underline; ",e.ul.cl&&n.indexOf("text-decoration-color")===-1&&(n+=`text-decoration-color: ${Ut(e.ul.cl)}; `),e.ul.t&&n.indexOf("text-decoration-style")===-1&&(n+=`text-decoration-style: ${e.ul.t} `))}],["st",()=>{var o;(o=e.st)!=null&&o.s&&(n.indexOf("text-decoration-line")>-1?n=n.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g,(a,l)=>`${l} line-through`):n+="text-decoration-line: line-through; ",e.st.cl&&n.indexOf("text-decoration-color")===-1&&(n+=`text-decoration-color: ${Ut(e.st.cl)}; `),e.st.t&&n.indexOf("text-decoration-style")===-1&&(n+=`text-decoration-style: ${e.st.t} `))}],["ol",()=>{var o;(o=e.ol)!=null&&o.s&&(n.indexOf("text-decoration-line")>-1?n=n.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g,(a,l)=>`${l} overline`):n+="text-decoration-line: overline; ",e.ol.cl&&n.indexOf("text-decoration-color")===-1&&(n+=`text-decoration-color: ${Ut(e.ol.cl)}; `),e.ol.t&&n.indexOf("text-decoration-style")===-1&&(n+=`text-decoration-style: ${e.ol.t} `))}],["bg",()=>{e.bg&&(n+=`background: ${Ut(e.bg)}; `)}],["bd",()=>{var o,a,l,c,u,h,d,f,g,_,R,b;(o=e.bd)!=null&&o.b&&(n+=`border-bottom: ${ts((a=e.bd)==null?void 0:a.b.s)} ${(l=Ut(e.bd.b.cl))!=null?l:""}; `),(c=e.bd)!=null&&c.t&&(n+=`border-top: ${ts((u=e.bd)==null?void 0:u.t.s)} ${(h=Ut(e.bd.t.cl))!=null?h:""}; `),(d=e.bd)!=null&&d.r&&(n+=`border-right: ${ts((f=e.bd)==null?void 0:f.r.s)} ${(g=Ut(e.bd.r.cl))!=null?g:""}; `),(_=e.bd)!=null&&_.l&&(n+=`border-left: ${ts((R=e.bd)==null?void 0:R.l.s)} ${(b=Ut(e.bd.l.cl))!=null?b:""}; `)}],["cl",()=>{e.cl&&(n+=`color: ${Ut(e.cl)}; `)}],["va",()=>{e.va===Vt.SUBSCRIPT?n+="vertical-align: sub; ":e.va===Vt.SUPERSCRIPT&&(n+="vertical-align: super; ")}],["td",()=>{e.td===Nr.LEFT_TO_RIGHT?n+="direction: ltr; ":e.td===Nr.RIGHT_TO_LEFT&&(n+="direction: rtl; ")}],["tr",()=>{var o,a,l;e.tr&&(n+=`--data-rotate: (${(o=e.tr)==null?void 0:o.a}deg${(a=e.tr)!=null&&a.v?` ,${(l=e.tr)==null?void 0:l.v}`:""});`)}],["ht",()=>{e.ht===Nt.LEFT?n+="text-align: left; ":e.ht===Nt.RIGHT?n+="text-align: right; ":e.ht===Nt.CENTER?n+="text-align: center; ":e.ht===Nt.JUSTIFIED&&(n+="text-align: justify; ")}],["vt",()=>{e.vt===pn.BOTTOM?n+="vertical-align: bottom; ":e.vt===pn.TOP?n+="vertical-align: top; ":e.vt===pn.MIDDLE&&(n+="vertical-align: middle; ")}],["tb",()=>{e.tb===Sn.CLIP?n+="white-space: nowrap; overflow-x: hidden; ":e.tb===Sn.WRAP&&(n+="white-space: normal;")}],["pd",()=>{var u,h,d,f,g,_,R,b;const o=`${(u=e.pd)==null?void 0:u.b}pt`,a=`${(h=e.pd)==null?void 0:h.t}pt`,l=`${(d=e.pd)==null?void 0:d.l}pt`,c=`${(f=e.pd)==null?void 0:f.r}pt`;(g=e.pd)!=null&&g.b&&(n+=`padding-bottom: ${o}; `),(_=e.pd)!=null&&_.t&&(n+=`padding-top: ${a}; `),(R=e.pd)!=null&&R.l&&(n+=`padding-left: ${l}; `),(b=e.pd)!=null&&b.r&&(n+=`padding-right: ${c}; `)}]]),s=["bd","tr","tb"];for(const o in e)t&&s.includes(o)||(i=r.get(o))==null||i();return n}function ts(e){let t="";return e===xe.NONE?t="none":e===xe.THIN?t="0.5pt solid":e===xe.HAIR?t="0.5pt double":e===xe.DOTTED?t="0.5pt dotted":e===xe.DASHED||e===xe.DASH_DOT?t="0.5pt dashed":e===xe.DASH_DOT_DOT?t="0.5pt dotted":e===xe.DOUBLE?t="0.5pt double":e===xe.MEDIUM?t="1pt solid":e===xe.MEDIUM_DASHED||e===xe.MEDIUM_DASH_DOT?t="1pt dashed":e===xe.MEDIUM_DASH_DOT_DOT?t="1pt dotted":e===xe.SLANT_DASH_DOT?t="0.5pt dashed":e===xe.THICK&&(t="1.5pt solid"),t}function Mp(e){let t=0;if(e=e.trim(),e==="none")t=xe.NONE;else if(e==="0.5pt solid")t=xe.THIN;else if(e==="0.5pt double")t=xe.HAIR;else if(e==="0.5pt dotted")t=xe.DOTTED;else if(e==="0.5pt dashed")t=xe.DASHED;else if(e==="1pt solid")t=xe.MEDIUM;else if(e==="1pt dashed")t=xe.MEDIUM_DASHED;else if(e==="1pt dotted")t=xe.MEDIUM_DASH_DOT_DOT;else if(e==="1.5pt solid")t=xe.THICK;else if(!e.includes("none"))t=xe.THIN;else return xe.NONE;return t}function Dp(e,t){let n=e.body;if(t){const{headers:r,footers:s}=e;r!=null&&r[t]?n=r[t].body:s!=null&&s[t]&&(n=s[t].body)}return n}function Lp(e,t){const{startRow:n,endRow:r,startColumn:s,endColumn:i,rangeType:o}=e;if(n<0||s<0||r<0||i<0||!(Number.isNaN(n)&&Number.isNaN(r))&&o===_e.COLUMN||!(Number.isNaN(s)&&Number.isNaN(i))&&o===_e.ROW||o!==_e.ROW&&o!==_e.COLUMN&&(Number.isNaN(s)||Number.isNaN(n)||Number.isNaN(i)||Number.isNaN(r)))return!1;if(t){const a=t.getRowCount(),l=t.getColumnCount();if(r>=a||i>=l)return!1}return!0}function xp(e,t){return{startRow:e,endRow:e,startColumn:t,endColumn:t}}function Yi(e){return Nu(e)?{f:e,v:null,p:null}:vu(e)?{v:e,p:null,f:null}:(wu(e),e)}function Up(e,t){const n=new ct,{startRow:r,startColumn:s,endRow:i,endColumn:o}=t;if(Z.isArray(e))for(let a=0;a<=i-r;a++)for(let l=0;l<=o-s;l++)n.setValue(a+r,l+s,Yi(e[a][l]));else new ct(e).forValue((l,c,u)=>{n.setValue(l,c,Yi(u))});return n.getMatrix()}function bo(e,t){return Object.prototype.toString.call(e)===Object.prototype.toString.call(t)?Object.prototype.toString.call(e)==="[object Object]"||Object.prototype.toString.call(e)==="[object Array]"?Object.keys(e).length!==Object.keys(t).length?!1:Object.keys(e).every(n=>bo(e[n],t[n])):e===t:!1}function Mu(e,t){const n=e.ts||{},r=t.ts||{};return e.sId!==t.sId?!1:bo(n,r)}function Pp(e,t){return t.some(n=>e.indexOf(n)>-1)}var ds={exports:{}},kp=ds.exports,Ga;function Fp(){return Ga||(Ga=1,(function(e,t){(function(n,r){e.exports=r()})(kp,(function(){var n=1e3,r=6e4,s=36e5,i="millisecond",o="second",a="minute",l="hour",c="day",u="week",h="month",d="quarter",f="year",g="date",_="Invalid Date",R=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,b=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,F={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(N){var y=["th","st","nd","rd"],w=N%100;return"["+N+(y[(w-20)%10]||y[w]||y[0])+"]"}},k=function(N,y,w){var T=String(N);return!T||T.length>=y?N:""+Array(y+1-T.length).join(w)+N},W={s:k,z:function(N){var y=-N.utcOffset(),w=Math.abs(y),T=Math.floor(w/60),M=w%60;return(y<=0?"+":"-")+k(T,2,"0")+":"+k(M,2,"0")},m:function N(y,w){if(y.date()<w.date())return-N(w,y);var T=12*(w.year()-y.year())+(w.month()-y.month()),M=y.clone().add(T,h),D=w-M<0,P=y.clone().add(T+(D?-1:1),h);return+(-(T+(w-M)/(D?M-P:P-M))||0)},a:function(N){return N<0?Math.ceil(N)||0:Math.floor(N)},p:function(N){return{M:h,y:f,w:u,d:c,D:g,h:l,m:a,s:o,ms:i,Q:d}[N]||String(N||"").toLowerCase().replace(/s$/,"")},u:function(N){return N===void 0}},S="en",C={};C[S]=F;var v="$isDayjsObject",A=function(N){return N instanceof x||!(!N||!N[v])},H=function N(y,w,T){var M;if(!y)return S;if(typeof y=="string"){var D=y.toLowerCase();C[D]&&(M=D),w&&(C[D]=w,M=D);var P=y.split("-");if(!M&&P.length>1)return N(P[0])}else{var J=y.name;C[J]=y,M=J}return!T&&M&&(S=M),M||!T&&S},B=function(N,y){if(A(N))return N.clone();var w=typeof y=="object"?y:{};return w.date=N,w.args=arguments,new x(w)},m=W;m.l=H,m.i=A,m.w=function(N,y){return B(N,{locale:y.$L,utc:y.$u,x:y.$x,$offset:y.$offset})};var x=(function(){function N(w){this.$L=H(w.locale,null,!0),this.parse(w),this.$x=this.$x||w.x||{},this[v]=!0}var y=N.prototype;return y.parse=function(w){this.$d=(function(T){var M=T.date,D=T.utc;if(M===null)return new Date(NaN);if(m.u(M))return new Date;if(M instanceof Date)return new Date(M);if(typeof M=="string"&&!/Z$/i.test(M)){var P=M.match(R);if(P){var J=P[2]-1||0,z=(P[7]||"0").substring(0,3);return D?new Date(Date.UTC(P[1],J,P[3]||1,P[4]||0,P[5]||0,P[6]||0,z)):new Date(P[1],J,P[3]||1,P[4]||0,P[5]||0,P[6]||0,z)}}return new Date(M)})(w),this.init()},y.init=function(){var w=this.$d;this.$y=w.getFullYear(),this.$M=w.getMonth(),this.$D=w.getDate(),this.$W=w.getDay(),this.$H=w.getHours(),this.$m=w.getMinutes(),this.$s=w.getSeconds(),this.$ms=w.getMilliseconds()},y.$utils=function(){return m},y.isValid=function(){return this.$d.toString()!==_},y.isSame=function(w,T){var M=B(w);return this.startOf(T)<=M&&M<=this.endOf(T)},y.isAfter=function(w,T){return B(w)<this.startOf(T)},y.isBefore=function(w,T){return this.endOf(T)<B(w)},y.$g=function(w,T,M){return m.u(w)?this[T]:this.set(M,w)},y.unix=function(){return Math.floor(this.valueOf()/1e3)},y.valueOf=function(){return this.$d.getTime()},y.startOf=function(w,T){var M=this,D=!!m.u(T)||T,P=m.p(w),J=function($,j){var Q=m.w(M.$u?Date.UTC(M.$y,j,$):new Date(M.$y,j,$),M);return D?Q:Q.endOf(c)},z=function($,j){return m.w(M.toDate()[$].apply(M.toDate("s"),(D?[0,0,0,0]:[23,59,59,999]).slice(j)),M)},oe=this.$W,ce=this.$M,I=this.$D,L="set"+(this.$u?"UTC":"");switch(P){case f:return D?J(1,0):J(31,11);case h:return D?J(1,ce):J(0,ce+1);case u:var Y=this.$locale().weekStart||0,V=(oe<Y?oe+7:oe)-Y;return J(D?I-V:I+(6-V),ce);case c:case g:return z(L+"Hours",0);case l:return z(L+"Minutes",1);case a:return z(L+"Seconds",2);case o:return z(L+"Milliseconds",3);default:return this.clone()}},y.endOf=function(w){return this.startOf(w,!1)},y.$set=function(w,T){var M,D=m.p(w),P="set"+(this.$u?"UTC":""),J=(M={},M[c]=P+"Date",M[g]=P+"Date",M[h]=P+"Month",M[f]=P+"FullYear",M[l]=P+"Hours",M[a]=P+"Minutes",M[o]=P+"Seconds",M[i]=P+"Milliseconds",M)[D],z=D===c?this.$D+(T-this.$W):T;if(D===h||D===f){var oe=this.clone().set(g,1);oe.$d[J](z),oe.init(),this.$d=oe.set(g,Math.min(this.$D,oe.daysInMonth())).$d}else J&&this.$d[J](z);return this.init(),this},y.set=function(w,T){return this.clone().$set(w,T)},y.get=function(w){return this[m.p(w)]()},y.add=function(w,T){var M,D=this;w=Number(w);var P=m.p(T),J=function(ce){var I=B(D);return m.w(I.date(I.date()+Math.round(ce*w)),D)};if(P===h)return this.set(h,this.$M+w);if(P===f)return this.set(f,this.$y+w);if(P===c)return J(1);if(P===u)return J(7);var z=(M={},M[a]=r,M[l]=s,M[o]=n,M)[P]||1,oe=this.$d.getTime()+w*z;return m.w(oe,this)},y.subtract=function(w,T){return this.add(-1*w,T)},y.format=function(w){var T=this,M=this.$locale();if(!this.isValid())return M.invalidDate||_;var D=w||"YYYY-MM-DDTHH:mm:ssZ",P=m.z(this),J=this.$H,z=this.$m,oe=this.$M,ce=M.weekdays,I=M.months,L=M.meridiem,Y=function(j,Q,ee,U){return j&&(j[Q]||j(T,D))||ee[Q].slice(0,U)},V=function(j){return m.s(J%12||12,j,"0")},$=L||function(j,Q,ee){var U=j<12?"AM":"PM";return ee?U.toLowerCase():U};return D.replace(b,(function(j,Q){return Q||(function(ee){switch(ee){case"YY":return String(T.$y).slice(-2);case"YYYY":return m.s(T.$y,4,"0");case"M":return oe+1;case"MM":return m.s(oe+1,2,"0");case"MMM":return Y(M.monthsShort,oe,I,3);case"MMMM":return Y(I,oe);case"D":return T.$D;case"DD":return m.s(T.$D,2,"0");case"d":return String(T.$W);case"dd":return Y(M.weekdaysMin,T.$W,ce,2);case"ddd":return Y(M.weekdaysShort,T.$W,ce,3);case"dddd":return ce[T.$W];case"H":return String(J);case"HH":return m.s(J,2,"0");case"h":return V(1);case"hh":return V(2);case"a":return $(J,z,!0);case"A":return $(J,z,!1);case"m":return String(z);case"mm":return m.s(z,2,"0");case"s":return String(T.$s);case"ss":return m.s(T.$s,2,"0");case"SSS":return m.s(T.$ms,3,"0");case"Z":return P}return null})(j)||P.replace(":","")}))},y.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},y.diff=function(w,T,M){var D,P=this,J=m.p(T),z=B(w),oe=(z.utcOffset()-this.utcOffset())*r,ce=this-z,I=function(){return m.m(P,z)};switch(J){case f:D=I()/12;break;case h:D=I();break;case d:D=I()/3;break;case u:D=(ce-oe)/6048e5;break;case c:D=(ce-oe)/864e5;break;case l:D=ce/s;break;case a:D=ce/r;break;case o:D=ce/n;break;default:D=ce}return M?D:m.a(D)},y.daysInMonth=function(){return this.endOf(h).$D},y.$locale=function(){return C[this.$L]},y.locale=function(w,T){if(!w)return this.$L;var M=this.clone(),D=H(w,T,!0);return D&&(M.$L=D),M},y.clone=function(){return m.w(this.$d,this)},y.toDate=function(){return new Date(this.valueOf())},y.toJSON=function(){return this.isValid()?this.toISOString():null},y.toISOString=function(){return this.$d.toISOString()},y.toString=function(){return this.$d.toUTCString()},N})(),O=x.prototype;return B.prototype=O,[["$ms",i],["$s",o],["$m",a],["$H",l],["$W",c],["$M",h],["$y",f],["$D",g]].forEach((function(N){O[N[1]]=function(y){return this.$g(y,N[0],N[1])}})),B.extend=function(N,y){return N.$i||(N(y,x,B),N.$i=!0),B},B.locale=H,B.isDayjs=A,B.unix=function(N){return B(1e3*N)},B.en=C[S],B.Ls=C,B.p={},B}))})(ds)),ds.exports}var Hp=Fp();const Xt=wt(Hp);var fs={exports:{}},Bp=fs.exports,Ka;function $p(){return Ka||(Ka=1,(function(e,t){(function(n,r){e.exports=r()})(Bp,(function(){return function(n,r){var s=r.prototype,i=s.format;s.format=function(o){var a=this,l=this.$locale();if(!this.isValid())return i.bind(this)(o);var c=this.$utils(),u=(o||"YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,(function(h){switch(h){case"Q":return Math.ceil((a.$M+1)/3);case"Do":return l.ordinal(a.$D);case"gggg":return a.weekYear();case"GGGG":return a.isoWeekYear();case"wo":return l.ordinal(a.week(),"W");case"w":case"ww":return c.s(a.week(),h==="w"?1:2,"0");case"W":case"WW":return c.s(a.isoWeek(),h==="W"?1:2,"0");case"k":case"kk":return c.s(String(a.$H===0?24:a.$H),h==="k"?1:2,"0");case"X":return Math.floor(a.$d.getTime()/1e3);case"x":return a.$d.getTime();case"z":return"["+a.offsetName()+"]";case"zzz":return"["+a.offsetName("long")+"]";default:return h}}));return i.bind(this)(u)}}}))})(fs)),fs.exports}var jp=$p();const Wp=wt(jp);var ms={exports:{}},Yp=ms.exports,Xa;function Vp(){return Xa||(Xa=1,(function(e,t){(function(n,r){e.exports=r()})(Yp,(function(){var n={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},r=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,s=/\d/,i=/\d\d/,o=/\d\d?/,a=/\d*[^-_:/,()\s\d]+/,l={},c=function(R){return(R=+R)+(R>68?1900:2e3)},u=function(R){return function(b){this[R]=+b}},h=[/[+-]\d\d:?(\d\d)?|Z/,function(R){(this.zone||(this.zone={})).offset=(function(b){if(!b||b==="Z")return 0;var F=b.match(/([+-]|\d\d)/g),k=60*F[1]+(+F[2]||0);return k===0?0:F[0]==="+"?-k:k})(R)}],d=function(R){var b=l[R];return b&&(b.indexOf?b:b.s.concat(b.f))},f=function(R,b){var F,k=l.meridiem;if(k){for(var W=1;W<=24;W+=1)if(R.indexOf(k(W,0,b))>-1){F=W>12;break}}else F=R===(b?"pm":"PM");return F},g={A:[a,function(R){this.afternoon=f(R,!1)}],a:[a,function(R){this.afternoon=f(R,!0)}],Q:[s,function(R){this.month=3*(R-1)+1}],S:[s,function(R){this.milliseconds=100*+R}],SS:[i,function(R){this.milliseconds=10*+R}],SSS:[/\d{3}/,function(R){this.milliseconds=+R}],s:[o,u("seconds")],ss:[o,u("seconds")],m:[o,u("minutes")],mm:[o,u("minutes")],H:[o,u("hours")],h:[o,u("hours")],HH:[o,u("hours")],hh:[o,u("hours")],D:[o,u("day")],DD:[i,u("day")],Do:[a,function(R){var b=l.ordinal,F=R.match(/\d+/);if(this.day=F[0],b)for(var k=1;k<=31;k+=1)b(k).replace(/\[|\]/g,"")===R&&(this.day=k)}],w:[o,u("week")],ww:[i,u("week")],M:[o,u("month")],MM:[i,u("month")],MMM:[a,function(R){var b=d("months"),F=(d("monthsShort")||b.map((function(k){return k.slice(0,3)}))).indexOf(R)+1;if(F<1)throw new Error;this.month=F%12||F}],MMMM:[a,function(R){var b=d("months").indexOf(R)+1;if(b<1)throw new Error;this.month=b%12||b}],Y:[/[+-]?\d+/,u("year")],YY:[i,function(R){this.year=c(R)}],YYYY:[/\d{4}/,u("year")],Z:h,ZZ:h};function _(R){var b,F;b=R,F=l&&l.formats;for(var k=(R=b.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(B,m,x){var O=x&&x.toUpperCase();return m||F[x]||n[x]||F[O].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(N,y,w){return y||w.slice(1)}))}))).match(r),W=k.length,S=0;S<W;S+=1){var C=k[S],v=g[C],A=v&&v[0],H=v&&v[1];k[S]=H?{regex:A,parser:H}:C.replace(/^\[|\]$/g,"")}return function(B){for(var m={},x=0,O=0;x<W;x+=1){var N=k[x];if(typeof N=="string")O+=N.length;else{var y=N.regex,w=N.parser,T=B.slice(O),M=y.exec(T)[0];w.call(m,M),B=B.replace(M,"")}}return(function(D){var P=D.afternoon;if(P!==void 0){var J=D.hours;P?J<12&&(D.hours+=12):J===12&&(D.hours=0),delete D.afternoon}})(m),m}}return function(R,b,F){F.p.customParseFormat=!0,R&&R.parseTwoDigitYear&&(c=R.parseTwoDigitYear);var k=b.prototype,W=k.parse;k.parse=function(S){var C=S.date,v=S.utc,A=S.args;this.$u=v;var H=A[1];if(typeof H=="string"){var B=A[2]===!0,m=A[3]===!0,x=B||m,O=A[2];m&&(O=A[2]),l=this.$locale(),!B&&O&&(l=F.Ls[O]),this.$d=(function(T,M,D,P){try{if(["x","X"].indexOf(M)>-1)return new Date((M==="X"?1e3:1)*T);var J=_(M)(T),z=J.year,oe=J.month,ce=J.day,I=J.hours,L=J.minutes,Y=J.seconds,V=J.milliseconds,$=J.zone,j=J.week,Q=new Date,ee=ce||(z||oe?1:Q.getDate()),U=z||Q.getFullYear(),G=0;z&&!oe||(G=oe>0?oe-1:Q.getMonth());var X,ne=I||0,me=L||0,pe=Y||0,K=V||0;return $?new Date(Date.UTC(U,G,ee,ne,me,pe,K+60*$.offset*1e3)):D?new Date(Date.UTC(U,G,ee,ne,me,pe,K)):(X=new Date(U,G,ee,ne,me,pe,K),j&&(X=P(X).week(j).toDate()),X)}catch{return new Date("")}})(C,H,v,F),this.init(),O&&O!==!0&&(this.$L=this.locale(O).$L),x&&C!=this.format(H)&&(this.$d=new Date("")),l={}}else if(H instanceof Array)for(var N=H.length,y=1;y<=N;y+=1){A[1]=H[y-1];var w=F.apply(this,A);if(w.isValid()){this.$d=w.$d,this.$L=w.$L,this.init();break}y===N&&(this.$d=new Date(""))}else W.call(this,S)}}}))})(ms)),ms.exports}var zp=Vp();const Gp=wt(zp);var gs={exports:{}},Kp=gs.exports,qa;function Xp(){return qa||(qa=1,(function(e,t){(function(n,r){e.exports=r()})(Kp,(function(){return function(n,r,s){var i=r.prototype,o=function(h){return h&&(h.indexOf?h:h.s)},a=function(h,d,f,g,_){var R=h.name?h:h.$locale(),b=o(R[d]),F=o(R[f]),k=b||F.map((function(S){return S.slice(0,g)}));if(!_)return k;var W=R.weekStart;return k.map((function(S,C){return k[(C+(W||0))%7]}))},l=function(){return s.Ls[s.locale()]},c=function(h,d){return h.formats[d]||(function(f){return f.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(g,_,R){return _||R.slice(1)}))})(h.formats[d.toUpperCase()])},u=function(){var h=this;return{months:function(d){return d?d.format("MMMM"):a(h,"months")},monthsShort:function(d){return d?d.format("MMM"):a(h,"monthsShort","months",3)},firstDayOfWeek:function(){return h.$locale().weekStart||0},weekdays:function(d){return d?d.format("dddd"):a(h,"weekdays")},weekdaysMin:function(d){return d?d.format("dd"):a(h,"weekdaysMin","weekdays",2)},weekdaysShort:function(d){return d?d.format("ddd"):a(h,"weekdaysShort","weekdays",3)},longDateFormat:function(d){return c(h.$locale(),d)},meridiem:this.$locale().meridiem,ordinal:this.$locale().ordinal}};i.localeData=function(){return u.bind(this)()},s.localeData=function(){var h=l();return{firstDayOfWeek:function(){return h.weekStart||0},weekdays:function(){return s.weekdays()},weekdaysShort:function(){return s.weekdaysShort()},weekdaysMin:function(){return s.weekdaysMin()},months:function(){return s.months()},monthsShort:function(){return s.monthsShort()},longDateFormat:function(d){return c(h,d)},meridiem:h.meridiem,ordinal:h.ordinal}},s.months=function(){return a(l(),"months")},s.monthsShort=function(){return a(l(),"monthsShort","months",3)},s.weekdays=function(h){return a(l(),"weekdays",null,null,h)},s.weekdaysShort=function(h){return a(l(),"weekdaysShort","weekdays",3,h)},s.weekdaysMin=function(h){return a(l(),"weekdaysMin","weekdays",2,h)}}}))})(gs)),gs.exports}var qp=Xp();const Jp=wt(qp);var _s={exports:{}},Zp=_s.exports,Ja;function Qp(){return Ja||(Ja=1,(function(e,t){(function(n,r){e.exports=r()})(Zp,(function(){var n={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};return function(r,s,i){var o=s.prototype,a=o.format;i.en.formats=n,o.format=function(l){l===void 0&&(l="YYYY-MM-DDTHH:mm:ssZ");var c=this.$locale().formats,u=(function(h,d){return h.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(f,g,_){var R=_&&_.toUpperCase();return g||d[_]||n[_]||d[R].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(b,F,k){return F||k.slice(1)}))}))})(l,c===void 0?{}:c);return a.call(this,u)}}}))})(_s)),_s.exports}var eE=Qp();const tE=wt(eE);var ps={exports:{}},nE=ps.exports,Za;function rE(){return Za||(Za=1,(function(e,t){(function(n,r){e.exports=r()})(nE,(function(){var n="minute",r=/[+-]\d\d(?::?\d\d)?/g,s=/([+-]|\d\d)/g;return function(i,o,a){var l=o.prototype;a.utc=function(_){var R={date:_,utc:!0,args:arguments};return new o(R)},l.utc=function(_){var R=a(this.toDate(),{locale:this.$L,utc:!0});return _?R.add(this.utcOffset(),n):R},l.local=function(){return a(this.toDate(),{locale:this.$L,utc:!1})};var c=l.parse;l.parse=function(_){_.utc&&(this.$u=!0),this.$utils().u(_.$offset)||(this.$offset=_.$offset),c.call(this,_)};var u=l.init;l.init=function(){if(this.$u){var _=this.$d;this.$y=_.getUTCFullYear(),this.$M=_.getUTCMonth(),this.$D=_.getUTCDate(),this.$W=_.getUTCDay(),this.$H=_.getUTCHours(),this.$m=_.getUTCMinutes(),this.$s=_.getUTCSeconds(),this.$ms=_.getUTCMilliseconds()}else u.call(this)};var h=l.utcOffset;l.utcOffset=function(_,R){var b=this.$utils().u;if(b(_))return this.$u?0:b(this.$offset)?h.call(this):this.$offset;if(typeof _=="string"&&(_=(function(S){S===void 0&&(S="");var C=S.match(r);if(!C)return null;var v=(""+C[0]).match(s)||["-",0,0],A=v[0],H=60*+v[1]+ +v[2];return H===0?0:A==="+"?H:-H})(_),_===null))return this;var F=Math.abs(_)<=16?60*_:_;if(F===0)return this.utc(R);var k=this.clone();if(R)return k.$offset=F,k.$u=!1,k;var W=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(k=this.local().add(F+W,n)).$offset=F,k.$x.$localOffset=W,k};var d=l.format;l.format=function(_){var R=_||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return d.call(this,R)},l.valueOf=function(){var _=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*_},l.isUTC=function(){return!!this.$u},l.toISOString=function(){return this.toDate().toISOString()},l.toString=function(){return this.toDate().toUTCString()};var f=l.toDate;l.toDate=function(_){return _==="s"&&this.$offset?a(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():f.call(this)};var g=l.diff;l.diff=function(_,R,b){if(_&&this.$u===_.$u)return g.call(this,_,R,b);var F=this.local(),k=a(_).local();return g.call(F,k,R,b)}}}))})(ps)),ps.exports}var sE=rE();const iE=wt(sE);var Es={exports:{}},oE=Es.exports,Qa;function aE(){return Qa||(Qa=1,(function(e,t){(function(n,r){e.exports=r()})(oE,(function(){return function(n,r){r.prototype.weekday=function(s){var i=this.$locale().weekStart||0,o=this.$W,a=(o<i?o+7:o)-i;return this.$utils().u(s)?a:this.subtract(a,"day").add(s,"day")}}}))})(Es)),Es.exports}var lE=aE();const cE=wt(lE);var Cs={exports:{}},uE=Cs.exports,el;function hE(){return el||(el=1,(function(e,t){(function(n,r){e.exports=r()})(uE,(function(){var n="week",r="year";return function(s,i,o){var a=i.prototype;a.week=function(l){if(l===void 0&&(l=null),l!==null)return this.add(7*(l-this.week()),"day");var c=this.$locale().yearStart||1;if(this.month()===11&&this.date()>25){var u=o(this).startOf(r).add(1,r).date(c),h=o(this).endOf(n);if(u.isBefore(h))return 1}var d=o(this).startOf(r).date(c).startOf(n).subtract(1,"millisecond"),f=this.diff(d,n,!0);return f<0?o(this).startOf("week").week():Math.ceil(f)},a.weeks=function(l){return l===void 0&&(l=null),this.week(l)}}}))})(Cs)),Cs.exports}var dE=hE();const fE=wt(dE);var Rs={exports:{}},mE=Rs.exports,tl;function gE(){return tl||(tl=1,(function(e,t){(function(n,r){e.exports=r()})(mE,(function(){return function(n,r){r.prototype.weekYear=function(){var s=this.month(),i=this.week(),o=this.year();return i===1&&s===11?o+1:s===0&&i>=52?o-1:o}}}))})(Rs)),Rs.exports}var _E=gE();const pE=wt(_E);Xt.extend(Gp);Xt.extend(Wp);Xt.extend(cE);Xt.extend(Jp);Xt.extend(fE);Xt.extend(pE);Xt.extend(iE);Xt.extend(tE);function qs(e,t,n,r){if(e>t)throw new Error("a1 should be less than a2");if(n>r)throw new Error("b1 should be less than b2");if(t<n||r<e)return[e,t];if(n<=e&&r>=t)return[];const s=r-n+1;return e<n&&t>r?[e,t-s]:n<=e&&r<t?[r+1-s,t-s]:n>e&&r>=t?[e,n-1]:[e,t]}function EE(e){if(e==null)return!1;const t=e.bullet;return(t==null?void 0:t.listId)!=null}function CE(e){if(e==null)return!1;const t=e.paragraphStyle;return Du(t)}function Du(e){var t;return!(e==null||(e.indentStart==null||e.indentStart.v===0)&&e.hanging==null||((t=e.hanging)==null?void 0:t.v)===0)}function Lu(e,t,n){return e.slice(0,t)+n+e.slice(t)}function xu(e,t,n){return t>n?e:e.slice(0,t)+e.slice(n)}function RE(e){if(e==null||typeof e=="boolean")return!1;if(typeof e=="number")return!isNaN(e);if(typeof e=="string"){const t=e.trim();return t===""?!1:!isNaN(Number(t))}return!1}function IE(e){let t=0;for(let n=0;n<e.length;n++)t=e.charCodeAt(n)+(t<<6)+(t<<16)-t;return t>>>0}function SE(...e){let t;return e.length===1&&Array.isArray(e[0])?t=e[0]:t=e,Ys({},...t)}const Le=Symbol("newer"),Qe=Symbol("older");class OE{constructor(t){p(this,"entry");this.entry=t}[Symbol.iterator](){return this}next(){const t=this.entry;return t?(this.entry=t[Le],{done:!1,value:t.key}):{done:!0,value:void 0}}}class wE{constructor(t){p(this,"entry");this.entry=t}[Symbol.iterator](){return this}next(){const t=this.entry;return t?(this.entry=t[Le],{done:!1,value:t.value}):{done:!0,value:void 0}}}class vE{constructor(t){p(this,"entry");this.entry=t}[Symbol.iterator](){return this}next(){const t=this.entry;return t?(this.entry=t[Le],{done:!1,value:[t.key,t.value]}):{done:!0,value:void 0}}}var Ml,Dl;Dl=Le,Ml=Qe;class nl{constructor(t,n){p(this,"key");p(this,"value");p(this,Dl);p(this,Ml);this.key=t,this.value=n,this[Le]=void 0,this[Qe]=void 0}toJSON(){return{key:this.key,value:this.value}}}class Mr{constructor(...t){p(this,"_keymap");p(this,"size",0);p(this,"limit");p(this,"oldest");p(this,"newest");p(this,"_onShiftListeners",[]);if(dr.hasLength(t,1)){if(dr.isNumber(t[0])){const n=t[0];this._initialize(n,void 0);return}if(dr.isIterable(t[0])){const n=t[0];this._initialize(0,n);return}return}if(dr.hasLength(t,2)){const n=t[0],r=t[1];this._initialize(n,r)}}onShift(t){if(this._onShiftListeners.indexOf(t)===-1)return this._onShiftListeners.push(t),We(()=>kr(this._onShiftListeners,t));throw new Error("[LRUMap]: the listener has been registered!")}_initialize(t,n){this.oldest=void 0,this.newest=void 0,this.size=0,this.limit=t,this._keymap=new Map,n&&(this.assign(n),t<1&&(this.limit=this.size))}_markEntryAsUsed(t){t!==this.newest&&(t[Le]&&(t===this.oldest&&(this.oldest=t[Le]),t[Le][Qe]=t[Qe]),t[Qe]&&(t[Qe][Le]=t[Le]),t[Le]=void 0,t[Qe]=this.newest,this.newest&&(this.newest[Le]=t),this.newest=t)}assign(t){let n,r=this.limit||Number.MAX_VALUE;this._keymap.clear();const s=t[Symbol.iterator]();for(let i=s.next();!i.done;i=s.next()){const o=new nl(i.value[0],i.value[1]);if(this._keymap.set(o.key,o),n?(n[Le]=o,o[Qe]=n):this.oldest=o,n=o,r--===0)throw new Error("overflow")}this.newest=n,this.size=this._keymap.size}set(t,n){let r=this._keymap.get(t);return r?(r.value=n,this._markEntryAsUsed(r),this):(this._keymap.set(t,r=new nl(t,n)),this.newest?(this.newest[Le]=r,r[Qe]=this.newest):this.oldest=r,this.newest=r,++this.size,this.size>this.limit&&this.shift(),this)}shift(){const t=this.oldest;if(t)return this.oldest&&this.oldest[Le]?(this.oldest=this.oldest[Le],this.oldest[Qe]=void 0):(this.oldest=void 0,this.newest=void 0),t[Le]=t[Qe]=void 0,this._keymap.delete(t.key),--this.size,this._onShiftListeners.forEach(n=>n(t)),[t.key,t.value]}get(t){const n=this._keymap.get(t);if(n)return this._markEntryAsUsed(n),n.value}has(t){return this._keymap.has(t)}find(t){const n=this._keymap.get(t);return n?n.value:void 0}delete(t){const n=this._keymap.get(t);if(n)return this._keymap.delete(n.key),n[Le]&&n[Qe]?(n[Qe][Le]=n[Le],n[Le][Qe]=n[Qe]):n[Le]?(n[Le][Qe]=void 0,this.oldest=n[Le]):n[Qe]?(n[Qe][Le]=void 0,this.newest=n[Qe]):this.oldest=this.newest=void 0,this.size--,n.value}clear(){this.oldest=void 0,this.newest=void 0,this.size=0,this._keymap.clear()}keys(){return new OE(this.oldest)}values(){return new wE(this.oldest)}entries(){return this[Symbol.iterator]()}[Symbol.iterator](){return new vE(this.oldest)}forEach(t,n){typeof n!="object"&&(n=this);let r=this.oldest;for(;r;)t.call(n,r.value,r.key,this),r=r[Le]}toJSON(){const t=new Array(this.size);let n=0,r=this.oldest;for(;r;)t[n++]={key:r.key,value:r.value},r=r[Le];return t}toString(){let t="",n=this.oldest;for(;n;)t+=`${String(n.key)}:${n.value}`,n=n[Le],n&&(t+=" < ");return t}}class dr{static hasLength(t,n){return t.length===n}static getValueType(t){return Object.prototype.toString.apply(t)}static isObject(t){return this.getValueType(t)==="[object Object]"}static isIterable(t){return t[Symbol.iterator]!=null}static isNumber(t){return this.getValueType(t)==="[object Number]"}}const fr=2,mr=2**2,Is=2**3,gr=2**4,_r=2**5,pr=2**6,Vi=2**7,zi=2**8,Gi=2**9,bE=0,yE=2958466,AE=-694324,TE=35830291,NE=-1,rl=1,Vn=6,yo="general",Ao="hash",zn="zero",To="qmark",No="slash",Dr="group",Ls="scale",Mo="comma",Do="break",Js="text",Lo="plus",xo="minus",xs="point",Uo="space",Po="percent",Zs="digit",ko="calendar",Lr="error",Fo="datetime",Ho="duration",Bo="condition",$o="dbnum",jo="natnum",Wo="locale",Yo="color",Uu="modifier",Vo="ampm",zo="escaped",Go="string",Ko="skip",Xo="exp",qo="fill",Jo="paren",Qs="char",ME=["#000","#FFF","#F00","#0F0","#00F","#FF0","#F0F","#0FF","#000","#FFF","#F00","#0F0","#00F","#FF0","#F0F","#0FF","#800","#080","#008","#880","#808","#088","#CCC","#888","#99F","#936","#FFC","#CFF","#606","#F88","#06C","#CCF","#008","#F0F","#FF0","#0FF","#808","#800","#088","#00F","#0CF","#CFF","#CFC","#FF9","#9CF","#F9C","#C9F","#FC9","#36F","#3CC","#9C0","#FC0"],Ki=["¤","$","£","¥","֏","؋","৳","฿","៛","₡","₦","₩","₪","₫","€","₭","₮","₱","₲","₴","₸","₹","₺","₼","₽","₾","₿"],Xi=new RegExp("["+Ki.join("")+"]"),Ei=Object.freeze({1078:"af",1052:"sq",1118:"am",5121:"ar_DZ",15361:"ar_BH",3073:"ar_EG",2049:"ar_IQ",11265:"ar_JO",13313:"ar_KW",12289:"ar_LB",4097:"ar_LY",6145:"ar_MA",8193:"ar_OM",16385:"ar_QA",1025:"ar_SA",10241:"ar_SY",7169:"ar_TN",14337:"ar_AE",9217:"ar_YE",1067:"hy",1101:"as",2092:"az_AZ",1068:"az_AZ",1069:"eu",1059:"be",2117:"bn",1093:"bn_IN",5146:"bs",1026:"bg",1109:"my",1027:"ca",2052:"zh_CN",3076:"zh_HK",5124:"zh_MO",4100:"zh_SG",1028:"zh_TW",1050:"hr",1029:"cs",1030:"da",1125:"dv",2067:"nl_BE",1043:"nl_NL",1126:"bin",3081:"en_AU",10249:"en_BZ",4105:"en_CA",9225:"en_CB",2057:"en_GB",16393:"en_IN",6153:"en_IE",8201:"en_JM",5129:"en_NZ",13321:"en_PH",7177:"en_ZA",11273:"en_TT",1033:"en_US",12297:"en_ZW",1061:"et",1071:"mk",1080:"fo",1065:"fa",1124:"fil",1035:"fi",2060:"fr_BE",11276:"fr_CM",3084:"fr_CA",9228:"fr_CG",12300:"fr_CI",1036:"fr_FR",5132:"fr_LU",13324:"fr_ML",6156:"fr_MC",14348:"fr_MA",10252:"fr_SN",4108:"fr_CH",7180:"fr",1122:"fy_NL",2108:"gd_IE",1084:"gd",1110:"gl",1079:"ka",3079:"de_AT",1031:"de_DE",5127:"de_LI",4103:"de_LU",2055:"de_CH",1032:"el",1140:"gn",1095:"gu",1279:"en",1037:"he",1081:"hi",1038:"hu",1039:"is",1136:"ig_NG",1057:"id",1040:"it_IT",2064:"it_CH",1041:"ja",1099:"kn",1120:"ks",1087:"kk",1107:"km",1111:"kok",1042:"ko",1088:"ky",1108:"lo",1142:"la",1062:"lv",1063:"lt",2110:"ms_BN",1086:"ms_MY",1100:"ml",1082:"mt",1112:"mni",1153:"mi",1102:"mr",1104:"mn",2128:"mn",1121:"ne",1044:"no_NO",2068:"no_NO",1096:"or",1045:"pl",1046:"pt_BR",2070:"pt_PT",1094:"pa",1047:"rm",2072:"ro_MO",1048:"ro_RO",1049:"ru",2073:"ru_MO",1083:"se",1103:"sa",3098:"sr_SP",2074:"sr_SP",1072:"st",1074:"tn",1113:"sd",1115:"si",1051:"sk",1060:"sl",1143:"so",1070:"sb",11274:"es_AR",16394:"es_BO",13322:"es_CL",9226:"es_CO",5130:"es_CR",7178:"es_DO",12298:"es_EC",17418:"es_SV",4106:"es_GT",18442:"es_HN",2058:"es_MX",19466:"es_NI",6154:"es_PA",15370:"es_PY",10250:"es_PE",20490:"es_PR",1034:"es_ES",14346:"es_UY",8202:"es_VE",1089:"sw",2077:"sv_FI",1053:"sv_SE",1114:"syc",1064:"tg",1097:"ta",1092:"tt",1098:"te",1054:"th",1105:"bo",1073:"ts",1055:"tr",1090:"tk",1058:"uk",1056:"ur",2115:"uz_UZ",1091:"uz_UZ",1075:"ve",1066:"vi",1106:"cy",1076:"xh",1085:"yi",1077:"zu"}),Pu=/^([a-z\d]+)(?:[_-]([a-z\d]+))?(?:\.([a-z\d]+))?(?:@([a-z\d]+))?$/i,Bn={},E=(e,t="")=>e.replace(/~/g,t).split(";"),ke=(e,t=0,n=0)=>(e.mmm||(e.mmm=t<1?e.mmmm.concat():e.mmmm.map(r=>{const s=r.slice(0,t%10);return s+(t<10||r===s?"":".")})),e.ddd||(e.ddd=n<1?e.dddd.concat():e.dddd.map(r=>{const s=r.slice(0,n%10);return s+(n<10||r===s?"":".")})),!e.mmm6&&e.mmmm6&&(e.mmm6=e.mmmm6),e),DE={group:" ",decimal:".",positive:"+",negative:"-",percent:"%",exponent:"E",nan:"NaN",infinity:"∞",ampm:E("AM;PM"),mmmm6:E("Muharram;Safar;Rabiʻ I;Rabiʻ II;Jumada I;Jumada II;Rajab;Shaʻban;Ramadan;Shawwal;Dhuʻl-Qiʻdah;Dhuʻl-Hijjah"),mmm6:E("Muh.;Saf.;Rab. I;Rab. II;Jum. I;Jum. II;Raj.;Sha.;Ram.;Shaw.;Dhuʻl-Q.;Dhuʻl-H."),mmmm:E("January;February;March;April;May;June;July;August;September;October;November;December"),mmm:E("Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sep;Oct;Nov;Dec"),dddd:E("Sunday;Monday;Tuesday;Wednesday;Thursday;Friday;Saturday"),ddd:E("Sun;Mon;Tue;Wed;Thu;Fri;Sat"),bool:E("TRUE;FALSE"),preferMDY:!1};function Zo(e){const t=Pu.exec(e);if(!t)throw new SyntaxError(`Malformed locale: ${e}`);return{lang:t[1]+(t[2]?"_"+t[2]:""),language:t[1],territory:t[2]||""}}function Qo(e){if(typeof e=="number")return Ei[e&65535]||null;const t=parseInt(e,16);return isFinite(t)&&Ei[t&65535]?Ei[t&65535]||null:Pu.test(e)?e:null}function tr(e){const t=Qo(e);let n=null;if(t){const r=Zo(t);n=Bn[r.lang]||Bn[r.language]||null}return n}function qi(e){return Object.assign({},DE,e)}function te(e,t){const n=typeof t=="object"?t:Zo(t);return Bn[n.lang]=qi(e),n.language!==n.lang&&!Bn[n.language]&&(Bn[n.language]=qi(e)),Bn[n.lang]}const an=qi({group:",",preferMDY:!0});an.isDefault=!0;te({group:",",ampm:E("上午;下午"),mmmm:E("一月;二月;三月;四月;五月;六月;七月;八月;九月;十月;十一月;十二月"),mmm:E("1月;2月;3月;4月;5月;6月;7月;8月;9月;10月;11月;12月"),dddd:E("~日;~一;~二;~三;~四;~五;~六","星期"),ddd:E("周日;周一;周二;周三;周四;周五;周六")},"zh_CN");const ea={group:",",ampm:E("上午;下午"),mmmm:E("1月;2月;3月;4月;5月;6月;7月;8月;9月;10月;11月;12月"),mmm:E("1月;2月;3月;4月;5月;6月;7月;8月;9月;10月;11月;12月"),dddd:E("~日;~一;~二;~三;~四;~五;~六","星期"),ddd:E("周日;周一;周二;周三;周四;周五;周六")};te({...ea,nan:"非數值",dddd:E("~日;~一;~二;~三;~四;~五;~六","星期")},"zh_TW");te({...ea,dddd:E("~日;~一;~二;~三;~四;~五;~六","星期")},"zh_HK");te({...ea,ampm:E("午前;午後"),dddd:E("日~;月~;火~;水~;木~;金~;土~","曜日"),ddd:E("日;月;火;水;木;金;土")},"ja");te({group:",",ampm:E("오전;오후"),mmmm:E("1월;2월;3월;4월;5월;6월;7월;8월;9월;10월;11월;12월"),mmm:E("1월;2월;3월;4월;5월;6월;7월;8월;9월;10월;11월;12월"),dddd:E("일요일;월요일;화요일;수요일;목요일;금요일;토요일"),ddd:E("일;월;화;수;목;금;토")},"ko");te({group:",",ampm:E("ก่อนเที่ยง;หลังเที่ยง"),mmmm:E("มกร~;กุมภาพันธ์;มีน~;เมษายน;พฤษภ~;มิถุนายน;กรกฎ~;สิงห~;กันยายน;ตุล~;พฤศจิกายน;ธันว~","าคม"),mmm:E("ม.ค.;ก.พ.;มี.ค.;เม.ย.;พ.ค.;มิ.ย.;ก.ค.;ส.ค.;ก.ย.;ต.ค.;พ.ย.;ธ.ค."),dddd:E("วันอาทิตย์;วันจันทร์;วันอังคาร;วันพุธ;วันพฤหัสบดี;วันศุกร์;วันเสาร์"),ddd:E("อา.;จ.;อ.;พ.;พฤ.;ศ.;ส.")},"th");te(ke({decimal:",",ampm:E("dop.;odp."),mmmm:E("ledna;února;března;dubna;května;června;července;srpna;září;října;listopadu;prosince"),mmm:E("I;II;III;IV;V;VI;VII;VIII;IX;X;XI;XII"),dddd:E("neděle;pondělí;úterý;středa;čtvrtek;pátek;sobota"),bool:E("PRAVDA;NEPRAVDA")},-1,2),"cs");te(ke({group:".",decimal:",",mmmm:E("januar;februar;marts;april;maj;juni;juli;august;september;oktober;november;december"),dddd:E("søn~;man~;tirs~;ons~;tors~;fre~;lør~","dag"),bool:E("SAND;FALSK")},13,13),"da");te(ke({group:".",decimal:",",ampm:E("a.m.;p.m."),mmmm:E("januari;februari;maart;april;mei;juni;juli;augustus;september;oktober;november;december"),mmm:E("jan.;feb.;mrt.;apr.;mei;jun.;jul.;aug.;sep.;okt.;nov.;dec."),dddd:E("zondag;maandag;dinsdag;woensdag;donderdag;vrijdag;zaterdag"),bool:E("WAAR;ONWAAR")},-1,2),"nl");te({group:",",preferMDY:!0},"en");te({group:",",preferMDY:!0},"en_US");te({group:","},"en_AU");te({group:","},"en_CA");te({group:","},"en_GB");te({group:",",mmm:E("Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sept;Oct;Nov;Dec")},"en_IE");te(ke({decimal:",",nan:"epäluku",ampm:E("ap.;ip."),mmmm:E("tammi~;helmi~;maalis~;huhti~;touko~;kesä~;heinä~;elo~;syys~;loka~;marras~;joulu~","kuuta"),mmm:E("tammik.;helmik.;maalisk.;huhtik.;toukok.;kesäk.;heinäk.;elok.;syysk.;lokak.;marrask.;jouluk."),dddd:E("sunnun~;maanan~;tiis~;keskiviikkona;tors~;perjan~;lauan~","taina"),bool:E("TOSI;EPÄTOSI")},-1,2),"fi");const ta=ke({group:" ",decimal:",",mmmm:E("janvier;février;mars;avril;mai;juin;juillet;août;septembre;octobre;novembre;décembre"),mmm:E("janv.;févr.;mars;avr.;mai;juin;juil.;août;sept.;oct.;nov.;déc."),dddd:E("~manche;lun~;mar~;mercre~;jeu~;vendre~;same~","di"),bool:E("VRAI;FAUX")},-1,13);te({...ta},"fr");te({...ta,mmm:E("janv.;févr.;mars;avr.;mai;juin;juill.;août;sept.;oct.;nov.;déc.")},"fr_CA");te({group:"'",decimal:".",...ta},"fr_CH");const ku=ke({mmmm:E("Januar;Februar;März;April;Mai;Juni;Juli;August;September;Oktober;November;Dezember"),mmm:E("Jan.;Feb.;März;Apr.;Mai;Juni;Juli;Aug.;Sept.;Okt.;Nov.;Dez."),dddd:E("Sonn~;Mon~;Diens~;Mittwoch;Donners~;Frei~;Sams~","tag"),bool:E("WAHR;FALSCH")},-1,12);te({group:".",decimal:",",...ku},"de");te({group:"'",decimal:".",...ku},"de_CH");te(ke({group:".",decimal:",",ampm:E("π.μ.;μ.μ."),mmmm:E("Ιανουαρ~;Φεβρουαρ~;Μαρτ~;Απριλ~;Μαΐου;Ιουν~;Ιουλ~;Αυγούστου;Σεπτεμβρ~;Οκτωβρ~;Νοεμβρ~;Δεκεμβρ~","ίου"),mmm:E("Ιαν;Φεβ;Μαρ;Απρ;Μαΐ;Ιουν;Ιουλ;Αυγ;Σεπ;Οκτ;Νοε;Δεκ"),dddd:E("Κυριακή;Δευτέρα;Τρίτη;Τετάρτη;Πέμπτη;Παρασκευή;Σάββατο")},-1,3),"el");te({decimal:",",ampm:E("de.;du."),mmmm:E("január;február;március;április;május;június;július;augusztus;szeptember;október;november;december"),mmm:E("jan.;febr.;márc.;ápr.;máj.;jún.;júl.;aug.;szept.;okt.;nov.;dec."),dddd:E("vasárnap;hétfő;kedd;szerda;csütörtök;péntek;szombat"),ddd:E("V;H;K;Sze;Cs;P;Szo"),bool:E("IGAZ;HAMIS")},"hu");te(ke({group:".",decimal:",",ampm:E("f.h.;e.h."),mmmm:E("janúar;febrúar;mars;apríl;maí;júní;júlí;ágúst;september;október;nóvember;desember"),dddd:E("sunnu~;mánu~;þriðju~;miðviku~;fimmtu~;föstu~;laugar~","dagur")},13,13),"is");te(ke({group:".",decimal:",",mmmm:E("Januari;Februari;Maret;April;Mei;Juni;Juli;Agustus;September;Oktober;November;Desember"),dddd:E("Minggu;Senin;Selasa;Rabu;Kamis;Jumat;Sabtu")},3,3),"id");const Fu=ke({mmmm:E("gennaio;febbraio;marzo;aprile;maggio;giugno;luglio;agosto;settembre;ottobre;novembre;dicembre"),dddd:E("domenica;lunedì;martedì;mercoledì;giovedì;venerdì;sabato"),bool:E("VERO;FALSO")},3,3);te({group:".",decimal:",",...Fu},"it");te({group:"'",decimal:".",...Fu},"it_CH");const Hu={decimal:",",ampm:E("a.m.;p.m."),mmmm:E("januar;februar;mars;april;mai;juni;juli;august;september;oktober;november;desember"),mmm:E("jan.;feb.;mar.;apr.;mai;jun.;jul.;aug.;sep.;okt.;nov.;des."),dddd:E("søn~;man~;tirs~;ons~;tors~;fre~;lør~","dag"),bool:E("SANN;USANN")};te(ke({...Hu},-1,13),"nb");te(ke({...Hu},-1,13),"no");te(ke({decimal:",",mmmm:E("stycznia;lutego;marca;kwietnia;maja;czerwca;lipca;sierpnia;września;października;listopada;grudnia"),dddd:E("niedziela;poniedziałek;wtorek;środa;czwartek;piątek;sobota"),ddd:E("niedz.;pon.;wt.;śr.;czw.;pt.;sob."),bool:E("PRAWDA;FAŁSZ")},3,-1),"pl");const Bu={group:".",decimal:",",mmmm:E("janeiro;fevereiro;março;abril;maio;junho;julho;agosto;setembro;outubro;novembro;dezembro"),dddd:E("domingo;segunda-feira;terça-feira;quarta-feira;quinta-feira;sexta-feira;sábado"),bool:E("VERDADEIRO;FALSO")};te(ke(Bu,13,13),"pt");te(ke(Bu,13,13),"pt_BR");te({decimal:",",nan:"не число",mmmm:E("января;февраля;марта;апреля;мая;июня;июля;августа;сентября;октября;ноября;декабря"),mmm:E("янв.;февр.;мар.;апр.;мая;июн.;июл.;авг.;сент.;окт.;нояб.;дек."),dddd:E("воскресенье;понедельник;вторник;среда;четверг;пятница;суббота"),ddd:E("вс;пн;вт;ср;чт;пт;сб"),mmmm6:E("рамадан;шавваль;зуль-каада;зуль-хиджжа;мухаррам;раби-уль-авваль;раби-уль-ахир;джумад-уль-авваль;джумад-уль-ахир;раджаб;шаабан;рамадан"),mmm6:E("рам.;шав.;зуль-к.;зуль-х.;мух.;раб. I;раб. II;джум. I;джум. II;радж.;шааб.;рам."),bool:E("ИСТИНА;ЛОЖЬ")},"ru");te(ke({decimal:",",mmmm:E("januára;februára;marca;apríla;mája;júna;júla;augusta;septembra;októbra;novembra;decembra"),dddd:E("nedeľa;pondelok;utorok;streda;štvrtok;piatok;sobota")},3,2),"sk");const Ht={group:".",decimal:",",ampm:E("a. m.;p. m."),mmmm:E("enero;febrero;marzo;abril;mayo;junio;julio;agosto;septiem~;octu~;noviem~;diciem~","bre"),mmm:E("ene;feb;mar;abr;may;jun;jul;ago;sept;oct;nov;dic"),dddd:E("domingo;lunes;martes;miércoles;jueves;viernes;sábado"),ddd:E("dom;lun;mar;mié;jue;vie;sáb"),bool:E("VERDADERO;FALSO")},LE=E("ene;feb;mar;abr;may;jun;jul;ago;sep;oct;nov;dic"),na=E("ene.;feb.;mar.;abr.;may.;jun.;jul.;ago.;sept.;oct.;nov.;dic.");te({...Ht},"es");te({...Ht},"es_AR");te({...Ht},"es_BO");te({...Ht},"es_CL");te({...Ht},"es_CO");te({...Ht},"es_EC");te({...Ht,mmm:LE,ampm:E("a.m.;p.m.")},"es_MX");te({...Ht,mmm:na},"es_PY");te({...Ht,mmm:na},"es_UY");te({...Ht,mmm:na,mmmm:E("enero;febrero;marzo;abril;mayo;junio;julio;agosto;setiembre;octubre;noviembre;diciembre")},"es_VE");te({decimal:",",ampm:E("fm;em"),mmmm:E("januari;februari;mars;april;maj;juni;juli;augusti;september;oktober;november;december"),mmm:E("jan.;feb.;mars;apr.;maj;juni;juli;aug.;sep.;okt.;nov.;dec."),dddd:E("sön~;mån~;tis~;ons~;tors~;fre~;lör~","dag"),ddd:E("sön;mån;tis;ons;tors;fre;lör")},"sv");te(ke({group:".",decimal:",",ampm:E("ÖÖ;ÖS"),mmmm:E("Ocak;Şubat;Mart;Nisan;Mayıs;Haziran;Temmuz;Ağustos;Eylül;Ekim;Kasım;Aralık"),mmm:E("Oca;Şub;Mar;Nis;May;Haz;Tem;Ağu;Eyl;Eki;Kas;Ara"),dddd:E("Pazar;Pazartesi;Salı;Çarşamba;Perşembe;Cuma;Cumartesi"),ddd:E("Paz;Pzt;Sal;Çar;Per;Cum;Cmt"),bool:E("DOĞRU;YANLIŞ")},3,-1),"tr");te({group:",",ampm:E("yb;yh"),mmmm:E("Ionawr;Chwefror;Mawrth;Ebrill;Mai;Mehefin;Gorffennaf;Awst;Medi;Hydref;Tachwedd;Rhagfyr"),mmm:E("Ion;Chwef;Maw;Ebr;Mai;Meh;Gorff;Awst;Medi;Hyd;Tach;Rhag"),dddd:E("Dydd Sul;Dydd Llun;Dydd Mawrth;Dydd Mercher;Dydd Iau;Dydd Gwener;Dydd Sadwrn"),ddd:E("Sul;Llun;Maw;Mer;Iau;Gwen;Sad")},"cy");te({group:".",decimal:",",mmmm:E("yanvar;fevral;mart;aprel;may;iyun;iyul;avqust;sentyabr;oktyabr;noyabr;dekabr"),mmm:E("yan;fev;mar;apr;may;iyn;iyl;avq;sen;okt;noy;dek"),dddd:E("bazar;bazar ertəsi;çərşənbə axşamı;çərşənbə;cümə axşamı;cümə;şənbə"),ddd:E("B.;B.e.;Ç.a.;Ç.;C.a.;C.;Ş.")},"az");te(ke({decimal:",",mmmm:E("студзеня;лютага;сакавіка;красавіка;мая;чэрвеня;ліпеня;жніўня;верасня;кастрычніка;лістапада;снежня"),dddd:E("нядзеля;панядзелак;аўторак;серада;чацвер;пятніца;субота"),ddd:E("нд;пн;аў;ср;чц;пт;сб")},3,-1),"be");te({decimal:",",ampm:E("пр.об.;сл.об."),mmmm:E("януари;февруари;март;април;май;юни;юли;август;септември;октомври;ноември;декември"),mmm:E("яну;фев;март;апр;май;юни;юли;авг;сеп;окт;ное;дек"),dddd:E("неделя;понеделник;вторник;сряда;четвъртък;петък;събота"),ddd:E("нд;пн;вт;ср;чт;пт;сб"),bool:E("ИСТИНА;ЛОЖЬ")},"bg");te({group:".",decimal:",",mmmm:E("de gener;de febrer;de març;d’abril;de maig;de juny;de juliol;d’agost;de setembre;d’octubre;de novembre;de desembre"),mmm:E("de gen.;de febr.;de març;d’abr.;de maig;de juny;de jul.;d’ag.;de set.;d’oct.;de nov.;de des."),dddd:E("diumenge;dilluns;dimarts;dimecres;dijous;divendres;dissabte"),ddd:E("dg.;dl.;dt.;dc.;dj.;dv.;ds."),ampm:E("a. m.;p. m.")},"ca");te(ke({group:",",decimal:".",mmmm:E("Enero;Pebrero;Marso;Abril;Mayo;Hunyo;Hulyo;Agosto;Setyembre;Oktubre;Nobyembre;Disyembre"),dddd:E("Linggo;Lunes;Martes;Miyerkules;Huwebes;Biyernes;Sabado")},3,3),"fil");te({group:",",decimal:".",mmmm:E("જાન્યુઆરી;ફેબ્રુઆરી;માર્ચ;એપ્રિલ;મે;જૂન;જુલાઈ;ઑગસ્ટ;સપ્ટેમ્બર;ઑક્ટોબર;નવેમ્બર;ડિસેમ્બર"),mmm:E("જાન્યુ;ફેબ્રુ;માર્ચ;એપ્રિલ;મે;જૂન;જુલાઈ;ઑગસ્ટ;સપ્ટે;ઑક્ટો;નવે;ડિસે"),dddd:E("રવિ~;સોમ~;મંગળ~;બુધ~;ગુરુ~;શુક્ર~;શનિ~","વાર"),ddd:E("રવિ;સોમ;મંગળ;બુધ;ગુરુ;શુક્ર;શનિ")},"gu");te({group:",",decimal:".",ampm:E("לפנה״צ;אחה״צ"),dddd:E("~ראשון;~שני;~שלישי;~רביעי;~חמישי;~שישי;~שבת","יום "),ddd:E("~א׳;~ב׳;~ג׳;~ד׳;~ה׳;~ו׳;שבת","יום "),mmmm:E("ינואר;פברואר;מרץ;אפריל;מאי;יוני;יולי;אוגוסט;ספטמבר;אוקטובר;נובמבר;דצמבר"),mmm:E("ינו׳;פבר׳;מרץ;אפר׳;מאי;יוני;יולי;אוג׳;ספט׳;אוק׳;נוב׳;דצמ׳"),mmmm6:E("רמדאן;שוואל;ד׳ו אל־קעדה;ד׳ו אל־חיג׳ה;מוחרם;רביע אל־אוול;רביע א־ת׳אני;ג׳ומאדא אל־אולא;ג׳ומאדא א־ת׳אניה;רג׳ב;שעבאן;רמדאן"),mmm6:E("רמדאן;שוואל;ד׳ו אל־קעדה;ד׳ו אל־חיג׳ה;מוחרם;רביע א׳;רביע ב׳;ג׳ומאדא א׳;ג׳ומאדא ב׳;רג׳ב;שעבאן;רמדאן")},"he");te(ke({group:".",decimal:",",mmmm:E("siječnja;veljače;ožujka;travnja;svibnja;lipnja;srpnja;kolovoza;rujna;listopada;studenoga;prosinca"),mmm:E("sij;velj;ožu;tra;svi;lip;srp;kol;ruj;lis;stu;pro"),dddd:E("nedjelja;ponedjeljak;utorak;srijeda;četvrtak;petak;subota")},-1,3),"hr");te({decimal:",",mmmm:E("հունվարի;փետրվարի;մարտի;ապրիլի;մայիսի;հունիսի;հուլիսի;օգոստոսի;սեպտեմբերի;հոկտեմբերի;նոյեմբերի;դեկտեմբերի"),mmm:E("հնվ;փտվ;մրտ;ապր;մյս;հնս;հլս;օգս;սեպ;հոկ;նոյ;դեկ"),dddd:E("կիրակի;երկուշաբթի;երեքշաբթի;չորեքշաբթի;հինգշաբթի;ուրբաթ;շաբաթ"),ddd:E("կիր;երկ;երք;չրք;հնգ;ուր;շբթ")},"hy");te(ke({decimal:",",mmmm:E("იანვარი;თებერვალი;მარტი;აპრილი;მაისი;ივნისი;ივლისი;აგვისტო;სექტემბერი;ოქტომბერი;ნოემბერი;დეკემბერი"),dddd:E("კვირა;ორშაბათი;სამშაბათი;ოთხშაბათი;ხუთშაბათი;პარასკევი;შაბათი")},3,3),"ka");te(ke({decimal:",",mmmm:E("қаңтар;ақпан;наурыз;сәуір;мамыр;маусым;шілде;тамыз;қыркүйек;қазан;қараша;желтоқсан"),dddd:E("жексенбі;дүйсенбі;сейсенбі;сәрсенбі;бейсенбі;жұма;сенбі"),ddd:E("жс;дс;сс;ср;бс;жм;сб")},13,-1),"kk");te({group:",",mmmm:E("ಜನವರಿ;ಫೆಬ್ರವರಿ;ಮಾರ್ಚ್;ಏಪ್ರಿಲ್;ಮೇ;ಜೂನ್;ಜುಲೈ;ಆಗಸ್ಟ್;ಸೆಪ್ಟೆಂಬರ್;ಅಕ್ಟೋಬರ್;ನವೆಂಬರ್;ಡಿಸೆಂಬರ್"),mmm:E("ಜನವರಿ;ಫೆಬ್ರವರಿ;ಮಾರ್ಚ್;ಏಪ್ರಿ;ಮೇ;ಜೂನ್;ಜುಲೈ;ಆಗಸ್ಟ್;ಸೆಪ್ಟೆಂ;ಅಕ್ಟೋ;ನವೆಂ;ಡಿಸೆಂ"),dddd:E("ಭಾನು~;ಸೋಮ~;ಮಂಗಳ~;ಬುಧ~;ಗುರು~;ಶುಕ್ರ~;ಶನಿ~","ವಾರ"),ddd:E("ಭಾನು;ಸೋಮ;ಮಂಗಳ;ಬುಧ;ಗುರು;ಶುಕ್ರ;ಶನಿ"),ampm:E("ಪೂರ್ವಾಹ್ನ;ಅಪರಾಹ್ನ")},"kn");te({decimal:",",mmmm:E("sausio;vasario;kovo;balandžio;gegužės;birželio;liepos;rugpjūčio;rugsėjo;spalio;lapkričio;gruodžio"),mmm:E("saus.;vas.;kov.;bal.;geg.;birž.;liep.;rugp.;rugs.;spal.;lapkr.;gruod."),dddd:E("sekmadienis;pirmadienis;antradienis;trečiadienis;ketvirtadienis;penktadienis;šeštadienis"),ddd:E("sk;pr;an;tr;kt;pn;št"),ampm:E("priešpiet;popiet")},"lt");te({decimal:",",mmmm:E("janvāris;februāris;marts;aprīlis;maijs;jūnijs;jūlijs;augusts;septembris;oktobris;novembris;decembris"),mmm:E("janv.;febr.;marts;apr.;maijs;jūn.;jūl.;aug.;sept.;okt.;nov.;dec."),dddd:E("svētdiena;pirmdiena;otrdiena;trešdiena;ceturtdiena;piektdiena;sestdiena"),ddd:E("svētd.;pirmd.;otrd.;trešd.;ceturtd.;piektd.;sestd."),ampm:E("priekšpusdienā;pēcpusdienā")},"lv");te({group:",",decimal:".",mmmm:E("ജനുവരി;ഫെബ്രുവരി;മാർച്ച്;ഏപ്രിൽ;മേയ്;ജൂൺ;ജൂലൈ;ഓഗസ്റ്റ്;സെപ്റ്റംബർ;ഒക്ടോബർ;നവംബർ;ഡിസംബർ"),mmm:E("ജനു;ഫെബ്രു;മാർ;ഏപ്രി;മേയ്;ജൂൺ;ജൂലൈ;ഓഗ;സെപ്റ്റം;ഒക്ടോ;നവം;ഡിസം"),dddd:E("ഞായറാഴ്ച;തിങ്കളാഴ്ച;ചൊവ്വാഴ്ച;ബുധനാഴ്ച;വ്യാഴാഴ്ച;വെള്ളിയാഴ്ച;ശനിയാഴ്ച"),ddd:E("ഞായർ;തിങ്കൾ;ചൊവ്വ;ബുധൻ;വ്യാഴം;വെള്ളി;ശനി")},"ml");te({group:",",decimal:".",mmmm:E("нэгдүгээ~;хоёрдугаа~;гуравдугаа~;дөрөвдүгээ~;тавдугаа~;зургаадугаа~;долоодугаа~;наймдугаа~;есдүгээ~;аравдугаа~;арван нэгдүгээ~;арван хоёрдугаа~","р сар"),mmm:E("1~;2~;3~;4~;5~;6~;7~;8~;9~;10~;11~;12~","-р сар"),dddd:E("ням;даваа;мягмар;лхагва;пүрэв;баасан;бямба"),ddd:E("Ня;Да;Мя;Лх;Пү;Ба;Бя"),ampm:E("ү.ө.;ү.х.")},"mn");te({group:",",decimal:".",mmmm:E("जानेवारी;फेब्रुवारी;मार्च;एप्रिल;मे;जून;जुलै;ऑगस्ट;सप्टेंबर;ऑक्टोबर;नोव्हेंबर;डिसेंबर"),mmm:E("जाने;फेब्रु;मार्च;एप्रि;मे;जून;जुलै;ऑग;सप्टें;ऑक्टो;नोव्हें;डिसें"),dddd:E("रविवार;सोमवार;मंगळवार;बुधवार;गुरुवार;शुक्रवार;शनिवार"),ddd:E("रवि;सोम;मंगळ;बुध;गुरु;शुक्र;शनि")},"mr");te(ke({group:",",decimal:".",mmmm:E("ဇန်နဝါရီ;ဖေဖော်ဝါရီ;မတ်;ဧပြီ;မေ;ဇွန်;ဇူလိုင်;ဩဂုတ်;စက်တင်ဘာ;အောက်တိုဘာ;နိုဝင်ဘာ;ဒီဇင်ဘာ"),mmm:E("ဇန်;ဖေ;မတ်;ဧ;မေ;ဇွန်;ဇူ;ဩ;စက်;အောက်;နို;ဒီ"),dddd:E("တနင်္ဂနွေ;တနင်္လာ;အင်္ဂါ;ဗုဒ္ဓဟူး;ကြာသပတေး;သောကြာ;စနေ"),ampm:E("နံနက်;ညနေ")},-1,0),"my");te({group:",",decimal:".",mmmm:E("ਜਨਵਰੀ;ਫ਼ਰਵਰੀ;ਮਾਰਚ;ਅਪ੍ਰੈਲ;ਮਈ;ਜੂਨ;ਜੁਲਾਈ;ਅਗਸਤ;ਸਤੰਬਰ;ਅਕਤੂਬਰ;ਨਵੰਬਰ;ਦਸੰਬਰ"),mmm:E("ਜਨ;ਫ਼ਰ;ਮਾਰਚ;ਅਪ੍ਰੈ;ਮਈ;ਜੂਨ;ਜੁਲਾ;ਅਗ;ਸਤੰ;ਅਕਤੂ;ਨਵੰ;ਦਸੰ"),dddd:E("ਐਤਵਾਰ;ਸੋਮਵਾਰ;ਮੰਗਲਵਾਰ;ਬੁੱਧਵਾਰ;ਵੀਰਵਾਰ;ਸ਼ੁੱਕਰਵਾਰ;ਸ਼ਨਿੱਚਰਵਾਰ"),ddd:E("ਐਤ;ਸੋਮ;ਮੰਗਲ;ਬੁੱਧ;ਵੀਰ;ਸ਼ੁੱਕਰ;ਸ਼ਨਿੱਚਰ"),ampm:E("ਪੂ.ਦੁ.;ਬਾ.ਦੁ.")},"pa");te({group:".",decimal:",",mmmm:E("ianuarie;februarie;martie;aprilie;mai;iunie;iulie;august;septem~;octom~;noiem~;decem~","brie"),mmm:E("ian.;feb.;mar.;apr.;mai;iun.;iul.;aug.;sept.;oct.;nov.;dec."),dddd:E("duminică;luni;marți;miercuri;joi;vineri;sâmbătă"),ddd:E("dum.;lun.;mar.;mie.;joi;vin.;sâm."),ampm:E("a.m.;p.m.")},"ro");te(ke({group:".",decimal:",",mmmm:E("januar;februar;marec;april;maj;junij;julij;avgust;september;oktober;november;december"),mmm:E("jan.;feb.;mar.;apr.;maj;jun.;jul.;avg.;sep.;okt.;nov.;dec."),dddd:E("nedelja;ponedeljek;torek;sreda;četrtek;petek;sobota"),ampm:E("dop.;pop.")},-1,13),"sl");te(ke({group:".",decimal:",",mmmm:E("јануар;фебруар;март;април;мај;јун;јул;август;септембар;октобар;новембар;децембар"),dddd:E("недеља;понедељак;уторак;среда;четвртак;петак;субота")},3,3),"sr");te({group:",",decimal:".",mmmm:E("ஜனவரி;பிப்ரவரி;மார்ச்;ஏப்ரல்;மே;ஜூன்;ஜூலை;ஆகஸ்ட்;செப்டம்பர்;அக்டோபர்;நவம்பர்;டிசம்பர்"),mmm:E("ஜன.;பிப்.;மார்.;ஏப்.;மே;ஜூன்;ஜூலை;ஆக.;செப்.;அக்.;நவ.;டிச."),dddd:E("ஞாயிறு;திங்கள்;செவ்வாய்;புதன்;வியாழன்;வெள்ளி;சனி"),ddd:E("ஞாயி.;திங்.;செவ்.;புத.;வியா.;வெள்.;சனி")},"ta");te({group:",",decimal:".",mmmm:E("జనవరి;ఫిబ్రవరి;మార్చి;ఏప్రిల్;మే;జూన్;జులై;ఆగస్టు;సెప్టెంబర్;అక్టోబర్;నవంబర్;డిసెంబర్"),mmm:E("జన;ఫిబ్ర;మార్చి;ఏప్రి;మే;జూన్;జులై;ఆగ;సెప్టెం;అక్టో;నవం;డిసెం"),dddd:E("ఆదివారం;సోమవారం;మంగళవారం;బుధవారం;గురువారం;శుక్రవారం;శనివారం"),ddd:E("ఆది;సోమ;మంగళ;బుధ;గురు;శుక్ర;శని")},"te");te({decimal:",",mmmm:E("січня;лютого;березня;квітня;травня;червня;липня;серпня;вересня;жовтня;листопада;грудня"),mmm:E("січ.;лют.;бер.;квіт.;трав.;черв.;лип.;серп.;вер.;жовт.;лист.;груд."),dddd:E("неділю;понеділок;вівторок;середу;четвер;пʼятницю;суботу"),ddd:E("нд;пн;вт;ср;чт;пт;сб"),ampm:E("дп;пп")},"uk");te({group:".",decimal:",",mmmm:E("~1;~2;~3;~4;~5;~6;~7;~8;~9;~10;~11;~12","tháng "),mmm:E("~1;~2;~3;~4;~5;~6;~7;~8;~9;~10;~11;~12","thg "),dddd:E("Chủ Nhật;Thứ Hai;Thứ Ba;Thứ Tư;Thứ Năm;Thứ Sáu;Thứ Bảy"),ddd:E("CN;Th 2;Th 3;Th 4;Th 5;Th 6;Th 7"),ampm:E("SA;CH")},"vi");te(ke({group:"٬",decimal:"٫",ampm:E("ص;م"),mmmm:E("يناير;فبراير;مارس;أبريل;مايو;يونيو;يوليو;أغسطس;سبتمبر;أكتوبر;نوفمبر;ديسمبر"),dddd:E("الأحد;الاثنين;الثلاثاء;الأربعاء;الخميس;الجمعة;السبت"),mmmm6:E("رمضان;شوال;ذو القعدة;ذو الحجة;محرم;ربيع الأول;ربيع الآخرة;جمادى الأولى;جمادى الآخرة;رجب;شعبان;رمضان")},0,0),"ar");te({group:",",decimal:".",mmmm:E("জানুয়ারী;ফেব্রুয়ারী;মার্চ;এপ্রিল;মে;জুন;জুলাই;আগস্ট;সেপ্টেম্বর;অক্টোবর;নভেম্বর;ডিসেম্বর"),mmm:E("জানু;ফেব;মার্চ;এপ্রি;মে;জুন;জুল;আগ;সেপ্টেঃ;অক্টোঃ;নভেঃ;ডিসেঃ"),dddd:E("রবিবার;সোমবার;মঙ্গলবার;বুধবার;বৃহস্পতিবার;শুক্রবার;শনিবার"),ddd:E("রবি;সোম;মঙ্গল;বুধ;বৃহস্পতি;শুক্র;শনি")},"bn");te({group:",",decimal:".",mmmm:E("जनवरी;फ़रवरी;मार्च;अप्रैल;मई;जून;जुलाई;अगस्त;सितंबर;अक्तूबर;नवंबर;दिसंबर"),mmm:E("जन॰;फ़र॰;मार्च;अप्रैल;मई;जून;जुल॰;अग॰;सित॰;अक्तू॰;नव॰;दिस॰"),dddd:E("रविवार;सोमवार;मंगलवार;बुधवार;गुरुवार;शुक्रवार;शनिवार"),ddd:E("रवि;सोम;मंगल;बुध;गुरु;शुक्र;शनि"),ampm:E("am;pm")},"hi");const $u={overflow:"######",dateErrorThrows:!1,dateErrorNumber:!0,bigintErrorNumber:!1,dateSpanLarge:!0,leap1900:!0,nbsp:!1,throws:!0,invalid:"######",locale:"",ignoreTimezone:!1,grouping:[3,3],indexColors:!0,skipChar:"",repeatChar:""};function St(e,t=0){if(typeof e!="number")return e;if(e<0)return-St(-e,t);if(t){const n=10**t||1;return St(e*n,0)/n}return Math.round(e)}const xE=1e-13;function ju(e,t=2,n=2){const r=e<0?-1:1,s=10**(t||2),i=10**(n||2);let o=Math.abs(e),a=0,l=0,c=0,u=1,h,d;if(e=o,e%1===0)d=[e*r,1];else if(e<1e-19)d=[r,1e19];else if(e>1e19)d=[1e19*r,1];else{do if(o=1/(o-Math.floor(o)),h=u,u=u*Math.floor(o)+a,a=h,l=c,c=Math.floor(e*u+.5),c>=s||u>=i)return[r*l,a];while(Math.abs(e-c/u)>=xE&&o!==Math.floor(o));d=[r*c,u]}return d}const ft=Math.floor;function Wu(e,t=!0){if(t&&e>=0){if(e===0)return[1900,1,0];if(e===60)return[1900,2,29];if(e<60)return[1900,e<32?1:2,(e-1)%31+1]}let n=e+68569+2415019;const r=ft(4*n/146097);n=n-ft((146097*r+3)/4);const s=ft(4e3*(n+1)/1461001);n=n-ft(1461*s/4)+31;const i=ft(80*n/2447),o=n-ft(2447*i/80);n=ft(i/11);const a=i+2-12*n;return[100*(r-49)+s+n|0,a|0,o|0]}function UE(e){return Wu(e+1462)}function PE(e){if(e===60)throw new Error("#VALUE!");if(e<=1)return[1317,8,29];if(e<60)return[1317,e<32?9:10,1+(e-2)%30];const t=10631/30,n=8.01/60;let r=e+466935;const s=ft(r/10631);r=r-10631*s;const i=ft((r-n)/t);r=r-ft(i*t+n);const o=ft((r+28.5001)/29.5);return o===13?[30*s+i,12,30]:[30*s+i,o,r-ft(29.5001*o-29)]}function Yu(e,t=0,n=!0){const r=ft(e);return t===Vn?PE(r):t===NE?UE(r):Wu(r,n)}const ns=Math.floor,Ci=86400;function ra(e,t){let n=null;if(Array.isArray(e)){const[r,s,i,o,a,l]=e;n=Date.UTC(r,s==null?0:s-1,i!=null?i:1,o||0,a||0,l||0)}else if(e instanceof Date&&(n=e*1,!t||!t.ignoreTimezone)){const r=new Date;r.setUTCFullYear(e.getFullYear(),e.getMonth(),e.getDate()),r.setUTCHours(e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()),n=r*1}if(n!=null&&isFinite(n)){const r=n/864e5;return r-(r<=-25509?-25568:-25569)}return null}function kE(e,t){let n=e|0;const r=Ci*(e-n);let s=ns(r);r-s>.9999&&(s+=1,s===Ci&&(s=0,n+=1));const i=s<0?Ci+s:s,[o,a,l]=Yu(e,0,t&&t.leap1900),c=ns(i/60/60)%60,u=ns(i/60)%60,h=ns(i)%60;return[o,a,l,c,u,h]}const FE=["!d-m-y","!d-m-Y","!j-m-y","!j-m-Y","!d-n-y","!d-n-Y","!j-n-y","!j-n-Y","?m-d-y","?m-d-Y","?m-j-y","?m-j-Y","?n-d-y","?n-d-Y","?n-j-y","?n-j-Y","d-M-y","d-M-Y","j-M-y","j-M-Y","M-d-y","M-d-Y","M-j-y","M-j-Y","d-F-y","d-F-Y","F-d-y","F-d-Y","F-j-y","F-j-Y","j-F-y","j-F-Y","y-F-d","y-F-j","y-M-d","y-M-j","Y-F-d","Y-F-j","Y-M-d","Y-m-d","Y-M-j","Y-m-j","Y-n-d","Y-n-j","j-F","j-M","d-F","d-M","n-d","n-j","n-Y","m-d","m-j","m-Y","M-Y","M-y","F-y","F-Y","Y-M","Y-n","Y-m","Y-F","Y-M"],HE={j:"d",d:"d",D:"ddd",l:"dddd",n:"m",m:"m",M:"mmm",F:"mmmm",y:"yy",Y:"yyyy"},BE={j:"dd",d:"dd",D:"ddd",l:"dddd",n:"mm",m:"mm",M:"mmm",F:"mmmm",y:"yy",Y:"yyyy"},Vu={},zu={};function dt(e,t,n=1){if(e){const r=e[0],s=e.slice(1);r==="!"?dt(s,t,4):r==="?"?dt(s,t,2):(t[r]=t[r]||{},dt(s,t[r],n))}else t.$=n}function sl(e,t){dt(e,t),dt(e+" x",t),dt(e+" l",t),dt(e+" l x",t),dt("l "+e,t),dt("l "+e+" x",t),dt(e+" D",t),dt(e+" D x",t),dt("D "+e,t),dt("D "+e+" x",t)}FE.forEach(e=>{e[0]!=="?"&&sl(e,Vu),e[0]!=="!"&&sl(e,zu)});const $E=new Date().getUTCFullYear(),il=".",jE=",",Ri=" ",br=" ",yr=" ",Ss="'",Os="٬",WE={".":[jE,br,yr,Ss,Os],",":[il,br,yr,Ss,Os],"٫":[il,br,yr,Ss,Os]},Ii=e=>e&&e.length===1&&e>="0"&&e<="9";function sa(e,t={}){const n=tr(t.locale||"")||an,r=n.decimal,s=[...WE[r]||[Ss,Os]];!s.includes(n.group)&&n.group!==Ri&&n.group!==r&&s.push(n.group);let i="",o="",a=1,l="",c=!1,u=!1,h=!1,d=!1,f=!1,g=null,_=!1,R=0;const b=[Ri,br,yr,"+","%","(","-"].concat(Ki);for(;b.includes(e[R]);){const v=e[R];if(v==="-"){if(c||u)return null;c=!0,a=-1}else if(Xi.test(v)){if(f)return null;f=!0,g=v}else if(v==="("){if(u||c)return null;u=!0,a=-1}else if(v==="%"){if(d)return null;d=!0}R++}let F=!1,k;if(e[R]===r||Ii(e[R]))for(;R<e.length;){const v=e[R];if(!k&&s.includes(v))k=v;else if(!(k&&k===v))if(v===r){if(F)break;i+=".",F=!0}else if(Ii(v))i+=v;else break;R++}if(e[R]==="e"||e[R]==="E"){o+=e[R],R++,(e[R]==="+"||e[R]==="-")&&(o+=e[R],R++);const v=R;for(;Ii(e[R]);)o+=e[R],R++;if(v===R)return null}const W=[Ri,br,yr,"%","$",")"].concat(Ki);for(;W.includes(e[R]);){const v=e[R];if(Xi.test(v)){if(f)return null;f=!0,g=v,_=!0}else if(v===")"){if(h||!u)return null;h=!0}else if(v==="%"){if(d)return null;d=!0}R++}if(R!==e.length)return null;let S=parseFloat(i+o);if(!isFinite(S))return null;if(o){if(d||f)return null;l="0.00E+00"}else if(d){if(f)return null;l=i.includes(".")?"0.00%":"0%",S*=.01}else if(f){const v=i.includes(".")?"#,##0.00":"#,##0";_?l=v+g:l=g+v}else k&&(l=i.includes(".")?"#,##0.00":"#,##0");const C={v:S*a};return l&&(C.z=l),C}function YE(e,t,n){if(n<1||t<1||t>12)return!1;if(t===2){const s=e%4===0&&e%100!==0||e%400===0||e===1900?29:28;if(n>s)return!1}else if((t===4||t===6||t===9||t===11)&&n>30||(t===1||t===3||t===5||t===7||t===8||t===10||t===12)&&n>31)return!1;return!0}const ol=(e,t,n=!1)=>{for(const r of t)if(e.startsWith(r[0])){let s=r[0].length;return n&&(r[2]==="D"||r[2]==="M")&&e[s]==="."&&s++,[e.slice(0,s),r]}return["",null]},Pt=(e,t,n,r)=>{const s=n.path||"",i=Object.keys(t);for(let o=0;o<i.length;o++){let a;const l=i[o];if(t[l]){if(l==="$"||l==="€")e||(a=n);else if(l==="-"){const c=/^(\s*([./-]|,\s)\s*|\s+)/.exec(e);if(c){const u=c[1]==="-"||c[1]==="/"||c[1]==="."?c[1]:" ";if(!n.sep||n.sep===u){const h=c[0].replace(/\s+/g," ");a=Pt(e.slice(c[0].length),t[l],{...n,sep:u,path:s+h},r)}}}else if(l===" "){const c=/^[,.]?\s+/.exec(e);if(c){const u=c[0].replace(/\s+/g," ");a=Pt(e.slice(c[0].length),t[l],{...n,path:s+u},r)}}else if(l==="j"||l==="d"){const c=/^(0?[1-9]|1\d|2\d|3[01])\b/.exec(e);c&&(a=Pt(e.slice(c[0].length),t[l],{...n,day:c[0],path:s+l},r))}else if(l==="n"||l==="m"){const c=/^(0?[1-9]|1[012])\b/.exec(e);c&&(a=Pt(e.slice(c[0].length),t[l],{...n,month:+c[0],_mon:c[0],path:s+l},r))}else if(l==="F"||l==="M"){const[c,u]=ol(e,r.mon,r.mp);u&&u[2]===l&&(a=Pt(e.slice(c.length),t[l],{...n,month:u[1],_mon:c,path:s+l},r))}else if(l==="l"||l==="D"){const[c,u]=ol(e,r.day,r.dp);u&&u[2]===l&&(a=Pt(e.slice(c.length),t[l],{...n,path:s+l},r))}else if(l==="y"){const c=/^\d\d\b/.exec(e);if(c){const u=+c[0]>=30?+c[0]+1900:+c[0]+2e3;a=Pt(e.slice(c[0].length),t[l],{...n,year:u,path:s+l},r)}}else if(l==="Y"){const c=/^\d\d\d\d\b/.exec(e);c&&(a=Pt(e.slice(c[0].length),t[l],{...n,year:+c[0],path:s+l},r))}else if(l==="x"){const c=ei(e,{locale:r.locale});c&&(a=Pt("",t[l],{...n,time:c.v,tf:c.z,path:s+l},r))}else throw new Error(`Unknown date token "${l}"`);if(a&&YE(n.year||1916,n.month||1,n.day?+n.day:1))return a}}},Gu=e=>e.replace(/\s+/g," ").trim().replace(/’/,"'").replace(/\.$/,"").toLowerCase(),rs=(e,t)=>{const n=e.map((r,s)=>[Gu(r),s+1,t]);return n.sort((r,s)=>s[0].length-r[0].length),n};function ia(e,t={}){var i;const n=tr(t.locale||"")||an,r={mon:rs(n.mmmm,"F").concat(rs(n.mmm,"M")),mp:n.mmm[0].at(-1)===".",day:rs(n.dddd,"l").concat(rs(n.ddd,"D")),dp:n.ddd[0].at(-1)===".",locale:t.locale},s=Pt(Gu(e),n.preferMDY?zu:Vu,{path:""},r);if(s){if(s.sep==="."&&s.path.length===3)return null;const o=+((i=s.year)!=null?i:$E);s.day||(s.day=1);let a=-1/0;if(o<1900)return null;o<=1900&&s.month<=2?a=25568:o<1e4&&(a=25569);const l=Date.UTC(o,s.month-1,s.day)/864e5+a+(s.time||0);if(l>=0&&l<=2958465){const c=s._mon[0]==="0"||s.day[0]==="0"||s._mon.length===2&&s.day.length===2,u=s.path.replace(/[jdlDnmMFyYx]/g,h=>h==="x"?s.tf||"":(c?BE[h]:HE[h])||h);return{v:l,z:u}}}return null}const Si=e=>e.replace(/\s+/g,"").trim().replace(/\./g,"").toLowerCase();function ei(e,t={}){const n=tr(t.locale||"")||an,r=/^\s*([10]?\d|2[0-4])(?::([0-5]\d|\d))?(?::([0-5]\d|\d))?(\.\d{1,10})?(?=\s*[^\s\d]|$)/.exec(e);let s="";if(r){const i=Si(e.slice(r[0].length));if(i===Si(n.ampm[0])||i==="a"||i==="am")s="a";else if(i===Si(n.ampm[1])||i==="p"||i==="pm")s="p";else if(i)return null}if(r){const[,i,o,a,l]=r;if(l&&!a||!s&&!o&&!a)return null;let c=+(i||0)*1;if(s){if(c>=13)return null;s==="p"&&(c+=12)}const u=+(o||0)*1,h=+(a||0)*1,d=+(l||0)*1;return{v:(c*60*60+u*60+h+d)/(3600*24),z:(i.length===2?"hh":"h")+":mm"+(a?":ss":"")+(s?" AM/PM":"")}}return null}function Ku(e,t={}){const n=tr(t.locale||"")||an,r=e.trim().toLowerCase(),s=n.bool[0].toLowerCase();if(r==="true"||r===s)return{v:!0};const i=n.bool[1].toLowerCase();return r==="false"||r===i?{v:!1}:null}function VE(e,t){var n,r,s;return(s=(r=(n=sa(e,t))!=null?n:ia(e,t))!=null?r:ei(e,t))!=null?s:Ku(e,t)}function gn(e,t,n){return t[n+"_max"]=e.length,t[n+"_min"]=e.replace(/#/g,"").length,t}function ze(e,t){typeof e=="string"?t.push({type:"string",value:e}):t.push(e)}function al(e,t){const n=e&&e.type;return n===Ao||n===zn||n===To||n===Zs&&t==="den"}function Er(e){var k,W,S;const t=[],n={scale:1,percent:!1,text:!1,date:0,date_eval:!1,date_system:rl,sec_decimals:0,general:!1,clock:24,int_pattern:[],frac_pattern:[],man_pattern:[],den_pattern:[],num_pattern:[],tokens:t};let r="int",s=null;const i=[];let o,a=!1,l=-1,c=!1,u="",h=!1;for(;++l<e.length&&!c;){const C=e[l],v=C.type||Lr;if(u+=C.raw,v===yo)n.general=!0,ze(C,t);else if(al(C,r)){const A=n[r+"_pattern"];al(o,r)||(o==null?void 0:o.type)===Dr?(A.push((A.pop()||"")+C.value),s.num+=C.value):(A.push(C.value),s={type:r,num:C.value},ze(s,t))}else if(v===Jo)C.value==="("&&(n.parens=!0),ze(C.value,t);else if(v===Zs)ze(C.value,t);else if(v===No)if(h=!0,n[r+"_pattern"].length){if(!s)throw new SyntaxError("Format pattern is missing a numerator");n.fractions=!0,n.num_pattern.push(n[r+"_pattern"].pop()),s.type="num",r="den",ze({type:"div"},t)}else ze(C.value,t);else if(v===Mo)ze(",",t);else if(v===Ls)n.scale=.001**C.raw.length;else if(v===Dr){if(r==="int"&&(n.grouping=!0),r==="den")throw new SyntaxError("Cannot group denominator digits")}else if(v===Uo)ze(C,t);else if(v===Do){c=!0;break}else if(v===Js)n.text=!0,ze(C,t);else if(v===Lo||v===xo)ze(C,t);else if(v===Ho){const A=C.value.toLowerCase(),H=A[0],B={type:"",size:0,date:1,pad:A.length};H==="h"?(B.size=gr,B.type="hour-elap"):H==="m"?(B.size=_r,B.type="min-elap"):(B.size=pr,B.type="sec-elap"),n.date=n.date|B.size,i.push(B),ze(B,t)}else if(n.date&&v===xs&&((k=e[l+1])==null?void 0:k.type)===zn){let A=1;l++;let H="0";((W=e[l+1])==null?void 0:W.type)===zn&&(H+="0",A=2,l++),((S=e[l+1])==null?void 0:S.type)===zn&&(H+="0",A=3,l++),u+=H;const B=[pr,Vi,zi,Gi][A];n.date=n.date|B,n.date_eval=!0,n.sec_decimals=Math.max(n.sec_decimals,A),ze({type:"subsec",size:B,decimals:A,date:1},t)}else if(v===ko)a||(C.value==="B2"||C.value==="b2"?n.date_system=Vn:n.date_system=rl);else if(v===Fo){const A={type:"",size:0,date:1},H=C.value.toLowerCase(),B=H[0];if(H==="y"||H==="yy")A.size=fr,A.type="year-short";else if(B==="y"||B==="e")A.size=fr,A.type="year";else if(H==="b"||H==="bb")A.size=fr,A.type="b-year-short";else if(B==="b")A.size=fr,A.type="b-year";else if(H==="d"||H==="dd")A.size=Is,A.type="day",A.pad=/dd/.test(H);else if(H==="ddd"||H==="aaa")A.size=Is,A.type="weekday-short";else if(B==="d"||B==="a")A.size=Is,A.type="weekday";else if(B==="h")A.size=gr,A.type="hour",A.pad=/hh/i.test(H);else if(B==="m"){H.length===3?(A.size=mr,A.type="monthname-short"):H.length===5?(A.size=mr,A.type="monthname-single"):H.length>=4&&(A.size=mr,A.type="monthname");const m=i[i.length-1];!A.type&&m&&!m.used&&m.size&(gr|pr)&&(m.used=!0,A.size=_r,A.type="min",A.pad=/mm/.test(H)),A.type||(A.size=mr,A.type="month",A.pad=/mm/.test(H),A.indeterminate=!0)}else if(B==="s"){A.size=pr,A.type="sec",A.pad=/ss/.test(H);const m=i[i.length-1];m&&m.size&_r?A.used=!0:m&&m.indeterminate&&(delete m.indeterminate,m.size=_r,m.type="min",A.used=!0)}n.date=n.date|A.size,n.date_eval=!0,i.push(A),ze(A,t)}else if(v===Vo)n.clock=12,n.date=n.date|gr,n.date_eval=!0,C.short=C.value==="A/P",ze(C,t);else if(v===Go||v===zo||v===Qs)ze(C.value,t);else if(v===Bo)n.condition=[C.value[0],parseFloat(C.value[1])];else if(v===Wo){const A=C.value.split("-"),H=A.length<2?"":A.slice(1).join("-"),B=A[0];B&&ze(B,t);const m=Qo(H);m&&(n.locale=m);const x=parseInt(H,16);isFinite(x)&&x&16711680&&(x>>16&255)===6&&(n.date_system=Vn),a=!0}else if(v===Yo){let A,H=C.value.toLowerCase();(A=/^color\s*(\d+)$/i.exec(H))&&(H=parseInt(A[1],10)),n.color=H}else if(v===Po)n.scale=100,n.percent=!0,ze("%",t);else if(v===xs)ze(C,t),n.date||(n.dec_fractions=!0,r="frac");else if(v===Xo)n.exponential=!0,n.exp_plus=C.value.includes("+"),r="man",ze({type:"exp",plus:n.exp_plus},t);else if(v===Ko)ze(C,t);else if(v===qo)ze(C,t);else if(!(v===$o||v===jo))throw v===Lr?new SyntaxError(`Illegal character: ${u}`):new SyntaxError(`Unknown token ${v} in ${u}`);o=C}if(n.tokensUsed=l,n.pattern=u,/^((?:\[[^\]]+\])+)(;|$)/.test(n.pattern)&&!/^\[(?:h+|m+|s+)\]/.test(n.pattern)&&ze({type:"text"},t),n.fractions&&n.dec_fractions||n.grouping&&!n.int_pattern.length||n.fractions&&n.exponential||n.fractions&&n.den_pattern.length*n.num_pattern.length===0||h&&!n.fractions&&!n.date||n.exponential&&(n.int_pattern.length||n.frac_pattern.length)*n.man_pattern.length===0)throw new SyntaxError(`Invalid pattern: ${u}`);const d=n.int_pattern.join(""),f=n.man_pattern.join(""),g=n.frac_pattern.join("");gn(d,n,"int");let _=0;for(let C=0;C<d.length;C++){const v=d[d.length-1-C];/^[0-9?]/.test(v)&&(_=C+1)}n.int_min=_,gn(g,n,"frac"),gn(f,n,"man");let R=n.num_pattern.join(""),b=n.den_pattern[0]||"";if(b.includes("?")||R.includes("?")?(b=b.replace(/\d/g,"?"),b=b.replace(/#$/g,"?"),gn(R,n,"num"),gn(b,n,"den"),R=R.replace(/#$/g,"?")):(gn(R,n,"num"),gn(b,n,"den")),n.int_p=d,n.man_p=f,n.num_p=R,n.den_p=b,n.den_pattern.length&&(n.denominator=parseInt(n.den_pattern.join("").replace(/\D/g,""),10)),n.integer=!!d.length,!n.integer&&!n.exponential&&g.length){const C=n.tokens.findIndex(v=>v.type==="point");n.tokens.splice(C,0,{type:"int",value:"#"}),n.integer=!0,n.int_pattern=["#"],n.int_p="#"}if(n.fractions)for(let C=0;C<t.length-1;C++){const v=t[C];if(v.type!=="string"&&v.type!=="space")continue;const A=t[C+1].type;A==="num"?v.rule="num+int":A==="div"?v.rule="num":A==="den"&&(v.rule="den")}return n.grouping&&n.int_pattern.length>1&&(n.grouping=!1),n}function zE(e){if(e===0)return e;const t=Math.ceil(Math.log10(e<0?-e:e)),n=10**(16-Math.floor(t));return isFinite(n)?Math.round(e*n)/n:0}function Xu(e,t=0){const n=Math.floor(Math.log10(e));return t>1?Math.floor(n/t)*t:n}function qu(e,t=1){return t<-300?parseFloat(e.toExponential().split("e")[0]):e*10**-t}const GE={total:1,sign:0,period:0,int:1,frac:0};function KE(e,t=!0){const n=Math.abs(e);if(!n)return GE;const r=t&&e<0?1:0,s=Math.floor(n),i=Math.floor(Math.log10(n)+1);let o=0,a=0;if(s!==n){o=1;const l=String(St(n*10**-i,15));let c=l.length,u=!0,h=0;for(;h<=l.length;){if(l[h]==="."){c--;break}else l[h]==="0"&&u?c--:u=!1;h++}a=c-i,a<0&&(a=0,o=0)}return{total:r+Math.max(i,1)+o+a,digits:Math.max(i,0)+a,sign:r,period:o,int:Math.max(i,1),frac:a}}const Dn=(e,t)=>e.replace(/\./,t.decimal),ll=(e,t,n)=>{const r=Math.abs(t);let s;return e===1?s=e:s=St(e,5),[Dn(s+"",n),n.exponent,t<0?n.negative:n.positive,r<10?"0":"",r]};function cl(e,t,n,r){const s=n|0;if(typeof n=="string")e.push(n);else if(n===s)e.push(Math.abs(s));else{const i=Math.abs(n);let o=Xu(i),a=qu(i,o);a===10&&(a=1,o++);const l=KE(i);if(o>=-4&&o<=-1){const c=i.toPrecision(10+o).replace(/\.?0+$/,"");e.push(Dn(c,r))}else if(o===10){const c=i.toFixed(10).slice(0,12).replace(/\.$/,"");e.push(Dn(c,r))}else if(Math.abs(o)<=9)if(l.total<=11){const c=St(i,9).toFixed(l.frac);e.push(Dn(c,r))}else o===9?e.push(Math.floor(i)):o>=0&&o<9?e.push(Dn(String(St(i,9-o)),r)):e.push(...ll(a,o,r));else l.total>=12?e.push(...ll(a,o,r)):e.push(Dn(St(i,9).toFixed(l.frac),r))}return e}function _n(e,t=!1){return e==="0"?"0":e==="?"?t?" ":" ":""}const ir=86400,XE=(e,t,n)=>n?e<AE||t>=TE:e<bE||t>=yE;function ul(e,t,n,r){var y,w;let s="",i="",o="",a="",l="",c="",u=0,h=0;if(typeof e=="bigint"){if(e<=Number.MAX_SAFE_INTEGER&&e>=Number.MIN_SAFE_INTEGER)e=Number(e);else return n.bigintErrorNumber?String(e):n.overflow;h=e}else h=Math.trunc(e);let d=0,f=0,g=1,_=0,R=0,b=0,F=0,k=0,W=0;const S=r||an;if(!t.text&&isFinite(t.scale)&&t.scale!==1&&(e=zE(e*t.scale)),t.exponential){let T=Math.abs(e);T&&(u=Xu(T,t.int_max)),e&&!t.integer&&u++,T=qu(T,u),t.int_max===1&&St(T,t.frac_max)===10&&(T=1,u++),e=e<0?-T:T,s+=Math.abs(u)}if(t.integer){const T=Math.abs(St(e,t.fractions?1:t.frac_max));c+=T<1?"":Math.floor(T)}const C=(y=n.grouping[0])!=null?y:3,v=(w=n.grouping[1])!=null?w:C;t.dec_fractions&&(l=String(St(e,t.frac_max)).split(".")[1]||"");const A=!t.error&&(t.num_p.includes("0")||t.den_p.includes("0"));let H=A;if(t.fractions){H=A||!!(e%1);const T=Math.abs(t.integer?e%1:e);if(T)if(H=!0,t.denominator&&isFinite(t.denominator))a+=t.denominator,o+=St(T*t.denominator),o==="0"&&(o="",a="",H=A);else{const M=ju(T,1/0,t.den_max);o+=M[0],a+=M[1],t.integer&&o==="0"&&(o="",a="",H=A)}else!e&&!t.integer&&(H=!0,o="0",a="1");t.integer&&!H&&!Math.trunc(e)&&(c="0")}if(t.date){h=Math.trunc(e);const T=ir*(e-h);if(d=Math.floor(T),W=T-d,Math.abs(W)<1e-6?W=0:W>.9999&&(W=0,d+=1,d===ir&&(d=0,h+=1)),W){const M=t.date&Gi||t.date&zi||t.date&Vi;(M===Gi&&W>.9995||M===zi&&W>.995||M===Vi&&W>.95||!M&&W>=.5)&&(d++,W=0)}if(h||t.date_system){const M=Yu(e,t.date_system,n.leap1900);f=M[0],g=M[1],_=M[2]}if(d){const M=d<0?ir+d:d;k=Math.floor(M)%60,F=Math.floor(M/60)%60,b=Math.floor(M/60/60)%60}if(R=(6+h)%7,t.date_eval&&XE(e,h+d/ir,n.dateSpanLarge)){if(n.dateErrorThrows)throw new Error("Date out of bounds");if(n.dateErrorNumber){const M=e<0?[S.negative]:[];return cl(M,{},e,S).join("")}return n.overflow}}const B=_n("?",n.nbsp);u<0?i="-":t.exp_plus&&(i="+");const m=[],x=(T,M,D,P)=>{const J=!P&&T.length>M.length?D.length+T.length-M.length:D.length;T.length<M.length&&(P+=T.length-M.length);for(let z=0;z<J;z++)m.push(T[z+P]||_n(D[z],n.nbsp));return J};let O=!1;const N={int:0,frac:0,man:0,num:0,den:0};for(let T=0,M=t.tokens.length;T<M;T++){const D=t.tokens[T],P=D.type,J=D.num?D.num.length:0;if(P==="string")D.rule?D.rule==="num"?H?m.push(D.value.replace(/ /g,B)):(t.num_min>0||t.den_min>0)&&m.push(D.value.replace(/./g,B)):D.rule==="num+int"?H&&c?m.push(D.value.replace(/ /g,B)):t.den_min>0&&(c||t.num_min)&&m.push(D.value.replace(/./g,B)):D.rule==="den"&&(H?m.push(D.value.replace(/ /g,B)):(t.den_min>0||t.den_min>0)&&m.push(D.value.replace(/./g,B))):m.push(D.value.replace(/ /g,B));else if(P==="space")D.rule==="num+int"?(H||t.num_min||t.den_min)&&(c||t.num_min)&&m.push(B):m.push(B);else if(P==="error")m.push(n.invalid);else if(P==="point")m.push(t.date?D.value:S.decimal);else if(P==="general")cl(m,t,e,S);else if(P==="exp")m.push(S.exponent);else if(P==="minus")D.volatile&&t.date||D.volatile&&(e>=0||typeof e!="number")||(D.volatile&&!t.fractions&&(t.integer||t.dec_fractions)?(e<0&&c&&c!=="0"||l)&&m.push(S.negative):m.push(S.negative));else if(P==="plus")m.push(S.positive);else if(P==="text")m.push(e);else if(P==="fill")n.fillChar&&m.push(n.fillChar,D.value);else if(P==="skip")n.skipChar?m.push(n.skipChar,D.value):m.push(n.nbsp?" ":" ");else if(P==="div")H?m.push("/"):t.num_min>0||t.den_min>0?m.push(B):m.push(_n("#",n.nbsp));else if(P==="int")if(t.int_pattern.length===1){const z=t.int_p,oe=Math.max(t.int_min,c.length);let ce="";for(let I=oe;I>0;I--){const L=c.charAt(c.length-I),Y=L?"":z.charAt(z.length-I)||z[0];let V="";if(t.grouping){const $=I-1-C;$>=0&&!($%v)&&(V=L||Y==="0"?S.group:_n("?",n.nbsp))}ce+=(L||_n(Y,n.nbsp))+V}m.push(ce)}else N.int+=x(c,t.int_p,D.num,N.int);else if(P==="frac"){const z=N.frac;for(let oe=0;oe<J;oe++)m.push(l[oe+z]||_n(D.num[oe],n.nbsp));N.frac+=J}else if(P==="man")!N[P]&&!N.man&&m.push(i),N.man+=x(s,t.man_p,D.num,N.man);else if(P==="num")N.num+=x(o,t.num_p,D.num,N.num);else if(P==="den"){const z=N.den;for(let oe=0;oe<J;oe++){let ce=a[oe+z];if(!ce){const I=D.num[oe];"123456789".includes(I)||O&&I==="0"?(O=!0,ce=n.nbsp?" ":" "):!O&&oe===J-1&&I==="0"&&!a?ce="1":ce=_n(I,n.nbsp)}m.push(ce)}N.den+=J}else if(P==="year")f<0&&m.push(S.negative),m.push(String(Math.abs(f)).padStart(4,"0"));else if(P==="year-short"){const z=f%100;m.push(z<10?"0":"",z)}else if(P==="month")m.push(D.pad&&g<10?"0":"",g);else if(P==="monthname-single")t.date_system===Vn?m.push(S.mmmm6[g-1].charAt(0)):m.push(S.mmmm[g-1].charAt(0));else if(P==="monthname-short")t.date_system===Vn?m.push(S.mmm6[g-1]):m.push(S.mmm[g-1]);else if(P==="monthname")t.date_system===Vn?m.push(S.mmmm6[g-1]):m.push(S.mmmm[g-1]);else if(D.type==="weekday-short")m.push(S.ddd[R]);else if(P==="weekday")m.push(S.dddd[R]);else if(P==="day")m.push(D.pad&&_<10?"0":"",_);else if(P==="hour"){const z=b%t.clock||(t.clock<24?t.clock:0);m.push(D.pad&&z<10?"0":"",z)}else if(P==="min")m.push(D.pad&&F<10?"0":"",F);else if(P==="sec")m.push(D.pad&&k<10?"0":"",k);else if(P==="subsec"){m.push(S.decimal);const z=W.toFixed(t.sec_decimals);m.push(z.slice(2,2+D.decimals))}else if(P==="ampm"){const z=b<12?0:1;D.short&&!r?m.push("AP"[z]):m.push(S.ampm[z])}else if(P==="hour-elap"){e<0&&m.push(S.negative);const z=h*24+Math.floor(Math.abs(d)/3600);m.push(String(Math.abs(z)).padStart(D.pad,"0"))}else if(P==="min-elap"){e<0&&m.push(S.negative);const z=h*1440+Math.floor(Math.abs(d)/60);m.push(String(Math.abs(z)).padStart(D.pad,"0"))}else if(P==="sec-elap"){e<0&&m.push(S.negative);const z=h*ir+Math.abs(d);m.push(String(Math.abs(z)).padStart(D.pad,"0"))}else if(P==="b-year")m.push(f+543);else if(P==="b-year-short"){const z=(f+543)%100;m.push(z<10?"0":"",z)}}return m.join("")}const qE=Er([{type:Js,value:"@",raw:"@"}]);function Ju(e,t){for(let n=0;n<3;n++){const r=t[n];if(r){let s;if(r.condition){const i=r.condition[0],o=r.condition[1];i==="="?s=e===o:i===">"?s=e>o:i==="<"?s=e<o:i===">="?s=e>=o:i==="<="?s=e<=o:i==="<>"&&(s=e!==o)}else s=!0;if(s)return r}}}function JE(e,t,n){const r=t.partitions;let s=r[3],i=null;return(typeof e=="number"||typeof e=="bigint")&&isFinite(e)&&(s=Ju(e,r)),s&&s.color&&(i=s.color),i&&typeof i=="number"&&n.indexColors&&(i=ME[i-1]||"#000"),i}function ZE(e,t,n){const r=t.partitions,s=tr(t.locale||n.locale),i=r[3]?r[3]:qE;if(typeof e=="boolean"&&(e=(s||an).bool[e?0:1]),e==null)return"";const o=typeof e=="bigint";if(typeof e!="number"&&!o)return ul(e,i,n,s);if(!o&&!isFinite(e)){const l=s||an;return isNaN(e)?l.nan:(e<0?l.negative:"")+l.infinity}const a=Ju(e,r);return a?ul(e,a,n,s):n.overflow}function Zu(e){return!!(e[0]&&e[0].percent||e[1]&&e[1].percent||e[2]&&e[2].percent||e[3]&&e[3].percent)}function Qu(e){return!!(e[0]&&e[0].date||e[1]&&e[1].date||e[2]&&e[2].date||e[3]&&e[3].date)}function eh(e){const[t,n,r,s]=e;return!!((!t||t.generated)&&(!n||n.generated)&&(!r||r.generated)&&s&&s.text&&!s.generated)}const QE={text:15,datetime:10.8,date:10.8,time:10.8,percent:10.6,currency:10.4,grouped:10.2,scientific:6,number:4,fraction:2,general:0,error:0},e0=[["DMY",1],["DM",2],["MY",3],["MDY",4],["MD",5],["hmsa",6],["hma",7],["hms",8],["hm",9]];function t0(e,t=null){var h;const[n,r]=e,s=n.frac_max,i={type:"general",isDate:Qu(e),isText:eh(e),isPercent:Zu(e),maxDecimals:n.general?9:s,scale:(h=n.scale)!=null?h:1,color:0,parentheses:0,grouped:n.grouping?1:0},o=!i.isDate&&!i.isText&&!n.error&&n.tokens.some(d=>d.type==="string"&&(t?d.value===t:Xi.test(d.value)));let a="G",l=s>=0?Math.min(15,s):"",c="",u="";if(r&&r.color&&(u="-",i.color=1),n.parens&&(c="()",i.parentheses=1),o)a="C",i.type="currency";else if(n.error)i.type="error",i.maxDecimals=0;else if(i.isDate){let d=0,f=0,g="";n.tokens.forEach(R=>{const b=R.type;/^(b-)?year/.test(b)?(g+="Y",f++):b.startsWith("month")?(g+="M",f++):/^(week)?day/.test(b)?(g+="D",f++):(b==="hour"||b==="min"||b==="sec"||b==="ampm")&&(g+=b[0],d++)}),i.type="date",f&&d?i.type="datetime":!f&&d&&(i.type="time");const _=e0.find(R=>g.startsWith(R[0]));a=_?"D":"G",l=_?_[1]:""}else i.isText?(a="G",i.type="text",l="",i.maxDecimals=0):n.general?(a="G",i.type="general",l=""):n.fractions?(a="G",i.type="fraction",l=""):n.exponential?(a="S",i.type="scientific"):i.isPercent?(a="P",i.type="percent"):n.grouping?(a=",",i.type="grouped"):(n.int_max||s)&&(a="F",i.type="number");return i.code=a+l+u+c,i.level=QE[i.type],Object.freeze(i)}function n0(e){const[t]=e;return{year:!!(t.date&fr),month:!!(t.date&mr),day:!!(t.date&Is),hours:!!(t.date&gr),minutes:!!(t.date&_r),seconds:!!(t.date&pr),clockType:t.clock===12?12:24}}const r0=[[yo,/^General/i,0],[Ao,/^#/,0],[zn,/^0/,0],[To,/^\?/,0],[No,/^\//,0],[Do,/^;/,0],[Js,/^@/,0],[Lo,/^\+/,0],[xo,/^-/,0],[xs,/^\./,0],[Uo,/^ /,0],[Po,/^%/,0],[Zs,/^[1-9]/,0],[ko,/^(?:B[12])/i,0],[Lr,/^B$/,0],[Fo,/^(?:[hH]+|[mM]+|[sS]+|[yY]+|[bB]+|[dD]+|[gG]+|[aA]{3,}|e+)/,0],[Ho,/^(?:\[(h+|m+|s+)\])/i,1],[Bo,/^\[(<[=>]?|>=?|=)\s*(-?[.\d]+)\]/,[1,2]],[$o,/^\[(DBNum[0-4]?\d)\]/i,1],[jo,/^\[(NatNum[0-4]?\d)\]/i,1],[Wo,/^\[\$([^\]]+)\]/,1],[Yo,/^\[(black|blue|cyan|green|magenta|red|white|yellow|color\s*\d+)\]/i,1],[Uu,/^\[([^\]]+)\]/,1],[Vo,/^(?:AM\/PM|am\/pm|A\/P)/,0],[zo,/^\\(.)/,1],[Go,/^"([^"]*?)"/,1],[Ko,/^_(\\.|.)/,1],[Xo,/^[Ee]([+-])/,1],[qo,/^\*(\\.|.)/,1],[Jo,/^[()]/,0],[Lr,/^[EÈÉÊËèéêëĒēĔĕĖėĘęĚěȄȅȆȇȨȩNnÑñŃńŅņŇňǸǹ["*/\\_]/,0],[Qs,/^./,0]],s0=63,i0=35,o0=48,a0=57,Oi=e=>{const t=(e||"\0").charCodeAt(0);return t===s0||t===i0||t>=o0&&t<=a0};function $n(e){let t=0;const n=[],r=[];for(;t<e.length;){const s=e.slice(t);let i=0;const o=/^(,+)(.)?/.exec(s);if(o){const a=o[1];i=a.length;const l=e[t-1]||"";let c=!1,u=!1;Oi(l)?(c=!0,u=!0):l==="."&&(u=!0);const h=o[2]||"";if(c&&(!h||h===";")&&(c=!1),u&&Oi(h)&&(u=!1),c&&!u)n.push({type:Dr,value:",",raw:a});else if(!c&&u)n.push({type:Ls,value:",",raw:a});else if(c&&u){const d={type:Ls,value:",",raw:a};n.push(d),r.push(d)}else n.push({type:Mo,value:",",raw:a})}else{let a;for(const[l,c,u]of r0){const h=c.exec(s);if(h){const d=Array.isArray(u)?u.map(f=>h[f]):h[u||0];a={type:l,value:d,raw:h[0]},n.push(a),i=h[0].length;break}}r.length&&a.raw===";"&&(r.length=0),r.length&&Oi(a.raw)&&(r.forEach(l=>l.type=Dr),r.length=0)}if(!i){const a=s[0];i=1,n.push({type:Qs,value:a,raw:a})}t+=i}return n}const wi=e=>{const t=e.condition;t&&t[1]<0&&(t[0]==="<"||t[0]==="<="||t[0]==="=")||e.tokens.unshift({type:"minus",volatile:!0})},hl=(e,t=null)=>{const n={};for(const r in e)Array.isArray(e[r])?n[r]=[...e[r]]:n[r]=e[r];return t&&n.tokens.unshift(t),n.generated=!0,n};function l0(e){var h;const t=[];let n=!1,r,s=null,i=0,o=!1,a=0,l=0,c=$n(e);do{if(o=Er(c),(o.date||o.general)&&(o.int_pattern.length||o.frac_pattern.length||o.scale!==1||o.text))throw new Error("Illegal format");if(o.condition&&(l++,n=!0),o.text){if(s)throw new Error("Unexpected partition");s=o}o.locale&&(r=Qo(o.locale)),t.push(o),i=((h=c[o.tokensUsed])==null?void 0:h.type)==="break"?1:0,c=c.slice(o.tokensUsed+i),a++}while(i&&a<4&&l<3);if(i)throw new Error("Unexpected partition");if(l>2)throw new Error("Unexpected condition");const u=t[3];if(u&&(u.int_pattern.length||u.frac_pattern.length||u.date))throw new Error("Unexpected partition");if(n){const d=t.length;if(d===1&&(t[1]=Er($n("General")),t[1].generated=!0),d<3){const f=t[0],g=t[1];if(wi(f),g.condition)wi(g);else{const _=f.condition;(_[0]==="="||_[1]>=0&&(_[0]===">"||_[0]===">="))&&g.tokens.unshift({type:"minus",volatile:!0})}}else t.forEach(wi)}else{if(t.length<4&&s)for(let d=0,f=t.length;d<f;d++)t[d]===s&&t.splice(d,1);if(t.length<1&&s&&(t[0]=Er($n("General")),t[0].generated=!0),t.length<2){const d={type:"minus",volatile:!0};t.push(hl(t[0],d))}if(t.length<3&&t.push(hl(t[0])),t.length<4)if(s)t.push(s);else{const d=Er($n("@"));d.generated=!0,t.push(d)}t[0].condition=[">",0],t[1].condition=["<",0],t[2].condition=null}return{pattern:e,partitions:t,locale:r}}const dl=Object.create({});function cn(e,t=!1){e||(e="General");let n=dl[e];if(!n)try{n=l0(e),dl[e]=n}catch(r){if(t)throw r;const s={tokens:[{type:"error"}],error:r.message};n={pattern:e,partitions:[s,s,s,s],error:r.message,locale:null}}return n}function th(e,t,n={}){var o;const r=Object.assign({},$u,n),s=cn(e,r.throws),i=(o=ra(t,r))!=null?o:t;return ZE(i,s,r)}function c0(e,t,n){var o;const r=Object.assign({},$u,n),s=cn(e,r.throws),i=(o=ra(t,r))!=null?o:t;return JE(i,s,r)}function u0(e){const t=cn(e,!1);return Qu(t.partitions)}function h0(e){const t=cn(e,!1);return Zu(t.partitions)}function d0(e){const t=cn(e,!1);return eh(t.partitions)}function f0(e){try{return cn(e,!0),!0}catch{return!1}}function m0(e,t={}){const n=cn(e,!1);return n.info||(n.info=t0(n.partitions,t==null?void 0:t.currency)),n.info}function g0(e){const t=cn(e,!1);return t.dateInfo||(t.dateInfo=n0(t.partitions)),t.dateInfo}const Ln=Object.freeze({AMPM:Vo,BREAK:Do,CALENDAR:ko,CHAR:Qs,COLOR:Yo,COMMA:Mo,CONDITION:Bo,DATETIME:Fo,DBNUM:$o,DIGIT:Zs,DURATION:Ho,ERROR:Lr,ESCAPED:zo,EXP:Xo,FILL:qo,GENERAL:yo,GROUP:Dr,HASH:Ao,LOCALE:Wo,MINUS:xo,MODIFIER:Uu,NATNUM:jo,PAREN:Jo,PERCENT:Po,PLUS:Lo,POINT:xs,QMARK:To,SCALE:Ls,SKIP:Ko,SLASH:No,SPACE:Uo,STRING:Go,TEXT:Js,ZERO:zn}),_0=Object.freeze(Object.defineProperty({__proto__:null,addLocale:te,dateFromSerial:kE,dateToSerial:ra,dec2frac:ju,format:th,formatColor:c0,getFormatDateInfo:g0,getFormatInfo:m0,getLocale:tr,isDateFormat:u0,isPercentFormat:h0,isTextFormat:d0,isValidFormat:f0,parseBool:Ku,parseDate:ia,parseLocale:Zo,parseNumber:sa,parseTime:ei,parseValue:VE,round:St,tokenTypes:Ln,tokenize:$n},Symbol.toStringTag,{value:"Module"})),nh="@@@",rh="@",sh="General";function p0(e){return e===nh||e===rh}function E0(e){return e==null||e===sh}const C0=(e,t)=>{if(e&&!t||!e&&t)return!1;const n=i=>{const o=$n(i);let a="",l=!1,c=!1;for(const u of o){if(u.type===Ln.POINT){l=!0;continue}if(!(c&&u.type===Ln.MINUS)&&u.type!==Ln.SKIP){if(u.type===Ln.COLOR){c=!0;continue}else c=!1;l&&u.type===Ln.ZERO||(l=!1,l||(a+=u.value||""))}}return a},r=n(e),s=n(t);return r===s},R0=new Set(["m d"]),I0=new Set(["h:mm AM/PM","hh:mm AM/PM"]),S0=e=>{var s,i;const t=(i=(s=ia(e))!=null?s:ei(e))!=null?i:sa(e);if(!t)return null;const{v:n,z:r}=t;return r&&(R0.has(r)||I0.has(r)&&!/\s(A|AM|P|PM)$/i.test(e)||r.includes("#,##0")&&th(r,n)!==e)?null:t},O0={sheetId:"",range:{startRow:-1,endRow:-1,startColumn:-1,endColumn:-1}},w0={startRow:-1,startColumn:-1,endRow:-1,endColumn:-1},v0={startRow:0,startColumn:0,endRow:0,endColumn:0},b0={row:0,column:0},it={ff:"Arial",fs:11,it:ie.FALSE,bl:ie.FALSE,ul:{s:ie.FALSE},st:{s:ie.FALSE},ol:{s:ie.FALSE},tr:{a:0,v:ie.FALSE},td:Nr.UNSPECIFIED,cl:{rgb:"#000000"},bg:{rgb:"#fff"},ht:Nt.UNSPECIFIED,vt:pn.UNSPECIFIED,tb:Sn.UNSPECIFIED,pd:{t:0,r:0,b:0,l:0},n:null,bd:{b:null,l:null,r:null,t:null}},ih={id:"default_slide",title:"defaultSlide",pageSize:{width:300,height:300}},y0=[uo,Ll,ho],A0={[qe.HEADING_1]:{fs:20,bl:1},[qe.HEADING_2]:{fs:18,bl:1},[qe.HEADING_3]:{fs:16,bl:1},[qe.HEADING_4]:{fs:14,bl:1},[qe.HEADING_5]:{fs:12,bl:1},[qe.NORMAL_TEXT]:null,[qe.TITLE]:{fs:26,bl:1},[qe.SUBTITLE]:{fs:15,cl:{rgb:"#999999"}},[qe.NAMED_STYLE_TYPE_UNSPECIFIED]:null},An=4,T0={[qe.HEADING_1]:{spaceAbove:{v:20},spaceBelow:{v:6+An}},[qe.HEADING_2]:{spaceAbove:{v:18},spaceBelow:{v:6+An}},[qe.HEADING_3]:{spaceAbove:{v:16},spaceBelow:{v:6+An}},[qe.HEADING_4]:{spaceAbove:{v:14},spaceBelow:{v:4+An}},[qe.HEADING_5]:{spaceAbove:{v:12},spaceBelow:{v:4+An}},[qe.NORMAL_TEXT]:{spaceAbove:{v:0},spaceBelow:{v:0}},[qe.TITLE]:{spaceAbove:{v:0},spaceBelow:{v:3+An}},[qe.SUBTITLE]:{spaceAbove:{v:0},spaceBelow:{v:16}},[qe.NAMED_STYLE_TYPE_UNSPECIFIED]:null},N0="univer-sheets-chart-print-chart",M0="univer-docs-drawing-printing";var oh=(e=>(e.ARRAY_CONVERTOR="ARRAY_CONVERTOR",e.MATRIX_CONVERTOR="MATRIX_CONVERTOR",e))(oh||{});const D0={[ht.A3]:{width:1123,height:1587},[ht.A4]:{width:794,height:1124},[ht.A5]:{width:559,height:794},[ht.B4]:{width:944,height:1344},[ht.B5]:{width:665,height:944},[ht.Executive]:{width:696,height:1008},[ht.Folio]:{width:816,height:1248},[ht.Legal]:{width:816,height:1344},[ht.Letter]:{width:816,height:1056},[ht.Statement]:{width:528,height:816},[ht.Tabloid]:{width:1056,height:1632}};function ss(e,t){const{textRuns:n=[]}=t;let r=0;for(const i of n){const{ts:o={},st:a,ed:l}=i;if(o[e]==null)return ie.FALSE;switch(e){case"bl":case"it":{if(o[e]===ie.FALSE)return ie.FALSE;break}case"ul":case"st":{if(o[e].s===ie.FALSE)return ie.FALSE;break}default:throw new Error(`unknown style key: ${e} in IStyleBase`)}r+=l-a}return t.dataStream.indexOf(`\r
|
|
4
|
-
`)===r?ie.TRUE:ie.FALSE}const Ar=class Ar{constructor(t,n,r){p(this,"_range");p(this,"_worksheet");this._deps=r,this._range=n,this._worksheet=t}static foreach(t,n){const{startRow:r,startColumn:s,endRow:i,endColumn:o}=t;for(let a=r;a<=i;a++)for(let l=s;l<=o;l++)n(a,l)}getRangeData(){return this._range}getValue(){return this.getValues()[0][0]}getValues(){const{startRow:t,endRow:n,startColumn:r,endColumn:s}=this._range,i=[];for(let o=t;o<=n;o++){const a=[];for(let l=r;l<=s;l++)a.push(this.getMatrix().getValue(o,l)||null);i.push(a)}return i}getMatrix(){const{startRow:t,endRow:n,startColumn:r,endColumn:s}=this._range,i=this._worksheet.getCellMatrix(),o=new ct;for(let a=t;a<=n;a++)for(let l=r;l<=s;l++)o.setValue(a,l,i.getValue(a,l)||null);return o}getMatrixObject(){const{startRow:t,endRow:n,startColumn:r,endColumn:s}=this._range,i=this._worksheet.getCellMatrix(),o=new ct;for(let a=t;a<=n;a++)for(let l=r;l<=s;l++)o.setValue(a-t,l-r,i.getValue(a,l)||{});return o}getA1Notation(){const{startRow:t,endRow:n,startColumn:r,endColumn:s}=this._range;let i,o;return r<s?(i=Z.numToWord(r+1)+(t+1),o=Z.numToWord(s+1)+(n+1)):(i=Z.numToWord(s+1)+(n+1),o=Z.numToWord(r+1)+(t+1)),i===o?`${i}`:`${i}:${o}`}getBackground(){return this.getBackgrounds()[0][0]}getBackgrounds(){const t=this._deps.getStyles();return this.getValues().map(n=>n.map(r=>{var i;const s=t.getStyleByCell(r);return((i=s==null?void 0:s.bg)==null?void 0:i.rgb)||it.bg.rgb}))}getCell(t,n){const{startRow:r,startColumn:s}=this._range,i={startRow:r+t,endRow:r+t,startColumn:s+n,endColumn:s+n};return new Ar(this._worksheet,i,this._deps)}getColumn(){return this._range.startColumn}getObjectValue(t={}){return this.getObjectValues(t)[0][0]}getObjectValues(t={}){var a;const{startRow:n,endRow:r,startColumn:s,endColumn:i}=this._range,o=this._worksheet.getCellMatrix().getFragment(n,r,s,i).getData();if(t.isIncludeStyle){const l=this._deps.getStyles();for(let c=0;c<=r-n;c++)for(let u=0;u<=i-s;u++){if(o==null||((a=o==null?void 0:o[c])==null?void 0:a[u])==null)continue;const h=o[c][u].s;h&&(o[c][u].s=l.get(h))}}return o}getFontColor(){return this.getFontColors()[0][0]}getFontColors(){const t=this._deps.getStyles();return this.getValues().map(n=>n.map(r=>{var i;const s=t.getStyleByCell(r);return((i=s==null?void 0:s.cl)==null?void 0:i.rgb)||it.cl.rgb}))}getFontFamilies(){return this._getStyles("ff")}getFontFamily(){return this.getFontFamilies()[0][0]}getUnderlines(){return this._getStyles("ul")}getUnderline(){var n,r;const{p:t}=(n=this.getValue())!=null?n:{};return t&&Array.isArray((r=t.body)==null?void 0:r.textRuns)&&t.body.textRuns.length>0?ss("ul",t.body)===ie.TRUE?{s:ie.TRUE}:{s:ie.FALSE}:this.getUnderlines()[0][0]}getOverlines(){return this._getStyles("ol")}getOverline(){return this.getOverlines()[0][0]}getStrikeThrough(){var n,r;const{p:t}=(n=this.getValue())!=null?n:{};return t&&Array.isArray((r=t.body)==null?void 0:r.textRuns)&&t.body.textRuns.length>0?ss("st",t.body)===ie.TRUE?{s:ie.TRUE}:{s:ie.FALSE}:this.getStrikeThroughs()[0][0]}getStrikeThroughs(){return this._getStyles("st")}getFontSize(){var n,r;const t=((n=this.getValue())==null?void 0:n.p)||{};return t&&Array.isArray((r=t.body)==null?void 0:r.textRuns)&&t.body.textRuns.length>0?t.body.textRuns.some(s=>{var i;return((i=s==null?void 0:s.ts)==null?void 0:i.fs)!=null})?Math.max(...t.body.textRuns.map(s=>{var i;return((i=s==null?void 0:s.ts)==null?void 0:i.fs)||0})):this.getFontSizes()[0][0]:this.getFontSizes()[0][0]}getFontSizes(){return this._getStyles("fs")}getBorder(){return this.getBorders()[0][0]}getBorders(){return this._getStyles("bd")}getFontStyle(){var n,r;const{p:t}=(n=this.getValue())!=null?n:{};return t&&Array.isArray((r=t.body)==null?void 0:r.textRuns)&&t.body.textRuns.length>0?ss("it",t.body)===ie.TRUE?As.ITALIC:As.NORMAL:this._getFontStyles()[0][0]}_getFontStyles(){return this._getStyles("it")}getFontWeight(){var n,r;const{p:t}=(n=this.getValue())!=null?n:{};return t&&Array.isArray((r=t.body)==null?void 0:r.textRuns)&&t.body.textRuns.length>0?ss("bl",t.body)===ie.TRUE?Ts.BOLD:Ts.NORMAL:this._getFontWeights()[0][0]}_getFontWeights(){return this._getStyles("bl")}getGridId(){return this._worksheet.getSheetId()}getHeight(){const{_range:t,_worksheet:n}=this,{startRow:r,endRow:s}=t;let i=0;for(let o=0;o<=s-r;o++){const a=n.getRowHeight(o);i+=a}return i}getHorizontalAlignment(){return this.getHorizontalAlignments()[0][0]}getHorizontalAlignments(){return this._getStyles("ht")}getLastColumn(){return this._range.endColumn}getLastRow(){return this._range.endRow}getNumColumns(){const{startColumn:t,endColumn:n}=this._range;return n-t+1}getNumRows(){const{startRow:t,endRow:n}=this._range;return n-t+1}getRichTextValue(){return this.getRichTextValues()[0][0]}getRichTextValues(){return this.getValues().map(t=>t.map(n=>(n==null?void 0:n.p)||""))}getRowIndex(){return this._range.startRow}getSheet(){return this._worksheet}getTextDirection(){return this.getTextDirections()[0][0]}getTextDirections(){return this._getStyles("td")}getTextRotation(){return this.getTextRotations()[0][0]}getTextRotations(){return this._getStyles("tr")}getTextStyle(){return this.getTextStyles()[0][0]}getTextStyles(){const t=this._deps.getStyles();return this.getValues().map(n=>n.map(r=>t.getStyleByCell(r)))}getVerticalAlignment(){return this.getVerticalAlignments()[0][0]}getVerticalAlignments(){return this._getStyles("vt")}getWidth(){const{_range:t,_worksheet:n}=this,{startColumn:r,endColumn:s}=t;let i=0;for(let o=0;o<=s-r;o++)i+=n.getColumnWidth(o);return i}getWrap(){return this.getWrapStrategy()===Sn.WRAP?ie.TRUE:ie.FALSE}getWrapStrategies(){return this._getStyles("tb")}getWrapStrategy(){return this.getWrapStrategies()[0][0]}forEach(t){Ar.foreach(this._range,t)}_getStyles(t){const n=this._deps.getStyles();return this.getValues().map(r=>r.map(s=>{const i=n&&n.getStyleByCell(s);return i&&i[t]||it[t]}))}};p(Ar,"transformRange",(t,n)=>{const r=n.getMaxColumns()-1,s=n.getMaxRows()-1;return t.rangeType===_e.ALL?{startColumn:0,startRow:0,endColumn:r,endRow:s}:t.rangeType===_e.COLUMN?{startRow:0,endRow:s,startColumn:t.startColumn,endColumn:t.endColumn}:t.rangeType===_e.ROW?{startColumn:0,endColumn:r,startRow:t.startRow,endRow:t.endRow}:{startColumn:t.startColumn,endColumn:Math.min(t.endColumn,r),startRow:t.startRow,endRow:Math.min(t.endRow,s)}});let Xn=Ar;function ah(e,t,n=0,r=e.length-1,s=L0){for(;r>n;){if(r-n>600){const l=r-n+1,c=t-n+1,u=Math.log(l),h=.5*Math.exp(2*u/3),d=.5*Math.sqrt(u*h*(l-h)/l)*(c-l/2<0?-1:1),f=Math.max(n,Math.floor(t-c*h/l+d)),g=Math.min(r,Math.floor(t+(l-c)*h/l+d));ah(e,t,f,g,s)}const i=e[t];let o=n,a=r;for(or(e,n,t),s(e[r],i)>0&&or(e,n,r);o<a;){for(or(e,o,a),o++,a--;s(e[o],i)<0;)o++;for(;s(e[a],i)>0;)a--}s(e[n],i)===0?or(e,n,a):(a++,or(e,a,r)),a<=t&&(n=a+1),t<=a&&(r=a-1)}}function or(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function L0(e,t){return e<t?-1:e>t?1:0}class Us{constructor(t=9){this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(t){let n=this.data;const r=[];if(!os(t,n))return r;const s=this.toBBox,i=[];for(;n;){for(let o=0;o<n.children.length;o++){const a=n.children[o],l=n.leaf?s(a):a;os(t,l)&&(n.leaf?r.push(a):bi(t,l)?this._all(a,r):i.push(a))}n=i.pop()}return r}collides(t){let n=this.data;if(!os(t,n))return!1;const r=[];for(;n;){for(let s=0;s<n.children.length;s++){const i=n.children[s],o=n.leaf?this.toBBox(i):i;if(os(t,o)){if(n.leaf||bi(t,o))return!0;r.push(i)}}n=r.pop()}return!1}load(t){if(!(t&&t.length))return this;if(t.length<this._minEntries){for(let r=0;r<t.length;r++)this.insert(t[r]);return this}let n=this._build(t.slice(),0,t.length-1,0);if(!this.data.children.length)this.data=n;else if(this.data.height===n.height)this._splitRoot(this.data,n);else{if(this.data.height<n.height){const r=this.data;this.data=n,n=r}this._insert(n,this.data.height-n.height-1,!0)}return this}insert(t){return t&&this._insert(t,this.data.height-1),this}clear(){return this.data=xn([]),this}remove(t,n){if(!t)return this;let r=this.data;const s=this.toBBox(t),i=[],o=[];let a,l,c;for(;r||i.length;){if(r||(r=i.pop(),l=i[i.length-1],a=o.pop(),c=!0),r.leaf){const u=x0(t,r.children,n);if(u!==-1)return r.children.splice(u,1),i.push(r),this._condense(i),this}!c&&!r.leaf&&bi(r,s)?(i.push(r),o.push(a),a=0,l=r,r=r.children[0]):l?(a++,r=l.children[a],c=!1):r=null}return this}toBBox(t){return t}compareMinX(t,n){return t.minX-n.minX}compareMinY(t,n){return t.minY-n.minY}toJSON(){return this.data}fromJSON(t){return this.data=t,this}_all(t,n){const r=[];for(;t;)t.leaf?n.push(...t.children):r.push(...t.children),t=r.pop();return n}_build(t,n,r,s){const i=r-n+1;let o=this._maxEntries,a;if(i<=o)return a=xn(t.slice(n,r+1)),Tn(a,this.toBBox),a;s||(s=Math.ceil(Math.log(i)/Math.log(o)),o=Math.ceil(i/Math.pow(o,s-1))),a=xn([]),a.leaf=!1,a.height=s;const l=Math.ceil(i/o),c=l*Math.ceil(Math.sqrt(o));fl(t,n,r,c,this.compareMinX);for(let u=n;u<=r;u+=c){const h=Math.min(u+c-1,r);fl(t,u,h,l,this.compareMinY);for(let d=u;d<=h;d+=l){const f=Math.min(d+l-1,h);a.children.push(this._build(t,d,f,s-1))}}return Tn(a,this.toBBox),a}_chooseSubtree(t,n,r,s){for(;s.push(n),!(n.leaf||s.length-1===r);){let i=1/0,o=1/0,a;for(let l=0;l<n.children.length;l++){const c=n.children[l],u=vi(c),h=k0(t,c)-u;h<o?(o=h,i=u<i?u:i,a=c):h===o&&u<i&&(i=u,a=c)}n=a||n.children[0]}return n}_insert(t,n,r){const s=r?t:this.toBBox(t),i=[],o=this._chooseSubtree(s,this.data,n,i);for(o.children.push(t),Rr(o,s);n>=0&&i[n].children.length>this._maxEntries;)this._split(i,n),n--;this._adjustParentBBoxes(s,i,n)}_split(t,n){const r=t[n],s=r.children.length,i=this._minEntries;this._chooseSplitAxis(r,i,s);const o=this._chooseSplitIndex(r,i,s),a=xn(r.children.splice(o,r.children.length-o));a.height=r.height,a.leaf=r.leaf,Tn(r,this.toBBox),Tn(a,this.toBBox),n?t[n-1].children.push(a):this._splitRoot(r,a)}_splitRoot(t,n){this.data=xn([t,n]),this.data.height=t.height+1,this.data.leaf=!1,Tn(this.data,this.toBBox)}_chooseSplitIndex(t,n,r){let s,i=1/0,o=1/0;for(let a=n;a<=r-n;a++){const l=Cr(t,0,a,this.toBBox),c=Cr(t,a,r,this.toBBox),u=F0(l,c),h=vi(l)+vi(c);u<i?(i=u,s=a,o=h<o?h:o):u===i&&h<o&&(o=h,s=a)}return s||r-n}_chooseSplitAxis(t,n,r){const s=t.leaf?this.compareMinX:U0,i=t.leaf?this.compareMinY:P0,o=this._allDistMargin(t,n,r,s),a=this._allDistMargin(t,n,r,i);o<a&&t.children.sort(s)}_allDistMargin(t,n,r,s){t.children.sort(s);const i=this.toBBox,o=Cr(t,0,n,i),a=Cr(t,r-n,r,i);let l=is(o)+is(a);for(let c=n;c<r-n;c++){const u=t.children[c];Rr(o,t.leaf?i(u):u),l+=is(o)}for(let c=r-n-1;c>=n;c--){const u=t.children[c];Rr(a,t.leaf?i(u):u),l+=is(a)}return l}_adjustParentBBoxes(t,n,r){for(let s=r;s>=0;s--)Rr(n[s],t)}_condense(t){for(let n=t.length-1,r;n>=0;n--)t[n].children.length===0?n>0?(r=t[n-1].children,r.splice(r.indexOf(t[n]),1)):this.clear():Tn(t[n],this.toBBox)}}function x0(e,t,n){if(!n)return t.indexOf(e);for(let r=0;r<t.length;r++)if(n(e,t[r]))return r;return-1}function Tn(e,t){Cr(e,0,e.children.length,t,e)}function Cr(e,t,n,r,s){s||(s=xn(null)),s.minX=1/0,s.minY=1/0,s.maxX=-1/0,s.maxY=-1/0;for(let i=t;i<n;i++){const o=e.children[i];Rr(s,e.leaf?r(o):o)}return s}function Rr(e,t){return e.minX=Math.min(e.minX,t.minX),e.minY=Math.min(e.minY,t.minY),e.maxX=Math.max(e.maxX,t.maxX),e.maxY=Math.max(e.maxY,t.maxY),e}function U0(e,t){return e.minX-t.minX}function P0(e,t){return e.minY-t.minY}function vi(e){return(e.maxX-e.minX)*(e.maxY-e.minY)}function is(e){return e.maxX-e.minX+(e.maxY-e.minY)}function k0(e,t){return(Math.max(t.maxX,e.maxX)-Math.min(t.minX,e.minX))*(Math.max(t.maxY,e.maxY)-Math.min(t.minY,e.minY))}function F0(e,t){const n=Math.max(e.minX,t.minX),r=Math.max(e.minY,t.minY),s=Math.min(e.maxX,t.maxX),i=Math.min(e.maxY,t.maxY);return Math.max(0,s-n)*Math.max(0,i-r)}function bi(e,t){return e.minX<=t.minX&&e.minY<=t.minY&&t.maxX<=e.maxX&&t.maxY<=e.maxY}function os(e,t){return t.minX<=e.maxX&&t.minY<=e.maxY&&t.maxX>=e.minX&&t.maxY>=e.minY}function xn(e){return{children:e,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function fl(e,t,n,r,s){const i=[t,n];for(;i.length;){if(n=i.pop(),t=i.pop(),n-t<=r)continue;const o=t+Math.ceil((n-t)/r/2)*r;ah(e,o,t,n,s),i.push(t,o,o,n)}}function H0(e,t,n,r=!1){if(t===0&&n===0)return e;let s={...e};const i=s.startAbsoluteRefType||Me.NONE,o=s.endAbsoluteRefType||Me.NONE,a=s.rangeType||_e.NORMAL;if(!r&&i===Me.ALL&&o===Me.ALL)return s;const l=ml(s.startRow,n,s.startColumn,t,a),c=ml(s.endRow,n,s.endColumn,t,a);return r||i===Me.NONE&&o===Me.NONE?s={...s,startRow:l.row,startColumn:l.column,endRow:c.row,endColumn:c.column}:(i===Me.NONE?s={...s,startRow:l.row,startColumn:l.column}:i===Me.COLUMN?s={...s,startRow:l.row}:i===Me.ROW&&(s={...s,startColumn:l.column}),o===Me.NONE?s={...s,endRow:c.row,endColumn:c.column}:o===Me.COLUMN?s={...s,endRow:c.row}:o===Me.ROW&&(s={...s,endColumn:c.column}),s)}function ml(e,t,n,r,s){return s===_e.NORMAL?{row:e+t,column:n+r}:s===_e.ROW?{row:e+t,column:n}:s===_e.COLUMN?{row:e,column:n+r}:{row:e,column:n}}function oa(e){const t=new Set,n=new Set;for(const o of e)t.add(o.startColumn),t.add(o.endColumn+1),n.add(o.startRow),n.add(o.endRow+1);const r=Array.from(t).sort((o,a)=>o-a),s=Array.from(n).sort((o,a)=>o-a);e.sort((o,a)=>o.startRow-a.startRow||o.startColumn-a.startColumn);const i=[];for(let o=0;o<s.length-1;o++)for(let a=0;a<r.length-1;a++){const l=r[a],c=r[a+1]-1,u=s[o],h=s[o+1]-1;for(const d of e){if(d.startRow>h)break;if(d.startRow<=u&&d.endRow>=h&&d.startColumn<=l&&d.endColumn>=c){i.push({startColumn:l,endColumn:c,startRow:u,endRow:h});break}}}return i}function B0(e){e.sort((r,s)=>r.startRow-s.startRow||r.startColumn-s.startColumn);const t={};for(const r of e)t[r.startRow]||(t[r.startRow]=[]),t[r.startRow].push(r);const n=[];for(const r in t){const s=t[+r];s.sort((o,a)=>o.startColumn-a.startColumn);let i=s[0];for(let o=1;o<s.length;o++){const a=s[o];a.startColumn<=i.endColumn+1&&a.startRow===i.startRow&&a.endRow===i.endRow?i.endColumn=Math.max(i.endColumn,a.endColumn):(n.push(i),i=a)}n.push(i)}return n}function $0(e){e.sort((r,s)=>r.startColumn-s.startColumn||r.startRow-s.startRow);const t={};for(const r of e)t[r.startColumn]||(t[r.startColumn]=[]),t[r.startColumn].push(r);const n=[];for(const r in t){const s=t[+r];s.sort((o,a)=>o.startRow-a.startRow);let i=s[0];for(let o=1;o<s.length;o++){const a=s[o];a.startRow<=i.endRow+1&&a.startColumn===i.startColumn&&a.endColumn===i.endColumn?i.endRow=Math.max(i.endRow,a.endRow):(n.push(i),i=a)}n.push(i)}return n}function j0(e){const t=oa(e),n=B0(t);return $0(n)}function W0(e,t){const n=[];return e.forEach(r=>{n.push(...zt.subtract(r,t))}),zt.mergeRanges(n)}function lh(e,t){const n=gl(e.startRow,e.endRow,t.startRow,t.endRow),r=gl(e.startColumn,e.endColumn,t.startColumn,t.endColumn);if(!n||!r)return null;const[s,i]=n,[o,a]=r,l=Y0(e.rangeType,t.rangeType,s,i,o,a);return{startRow:s,endRow:i,startColumn:o,endColumn:a,rangeType:l}}function gl(e,t,n,r){const s=isNaN(e)?-1/0:e,i=isNaN(t)?1/0:t,o=isNaN(n)?-1/0:n,a=isNaN(r)?1/0:r,l=Math.max(s,o),c=Math.min(i,a);if(l<=c){const u=l===-1/0?Number.NaN:l,h=c===1/0?Number.NaN:c;return[u,h]}else return null}function Y0(e,t,n,r,s,i){const o=e!==void 0?e:_l(n,r,s,i),a=t!==void 0?t:_l(n,r,s,i);return o===_e.ALL||a===_e.ALL?o===a?o:o===_e.ALL?a:o:o===a?o:(o===_e.NORMAL||a===_e.NORMAL,_e.NORMAL)}function _l(e,t,n,r){const s=!isNaN(e)&&!isNaN(t),i=!isNaN(n)&&!isNaN(r);return s&&i?_e.NORMAL:s?_e.ROW:i?_e.COLUMN:_e.ALL}const Yt=class Yt{static clone(t){return t.rangeType!==void 0?{startRow:t.startRow,startColumn:t.startColumn,endRow:t.endRow,endColumn:t.endColumn,rangeType:t.rangeType}:{startRow:t.startRow,startColumn:t.startColumn,endRow:t.endRow,endColumn:t.endColumn}}static equals(t,n){return t==null||n==null?!1:t.endRow===n.endRow&&t.endColumn===n.endColumn&&t.startRow===n.startRow&&t.startColumn===n.startColumn&&(t.rangeType===n.rangeType||t.rangeType===void 0&&n.rangeType===_e.NORMAL||n.rangeType===void 0&&t.rangeType===_e.NORMAL)}static simpleRangesIntersect(t,n){const{startRow:r,endRow:s,startColumn:i,endColumn:o}=t,{startRow:a,endRow:l,startColumn:c,endColumn:u}=n,h=r<=l&&s>=a,d=i<=u&&o>=c;return h&&d}static intersects(t,n){if(t.rangeType===_e.ROW&&n.rangeType===_e.COLUMN||t.rangeType===_e.COLUMN&&n.rangeType===_e.ROW)return!0;if(t.rangeType===_e.ROW&&n.rangeType===_e.ROW)return t.startRow<=n.endRow&&t.endRow>=n.startRow;if(t.rangeType===_e.COLUMN&&n.rangeType===_e.COLUMN)return t.startColumn<=n.endColumn&&t.endColumn>=n.startColumn;const r=Math.floor(Number.MAX_SAFE_INTEGER/10),s=Number.isNaN(t.startRow)?0:t.startRow,i=Number.isNaN(t.endRow)?r:t.endRow,o=Number.isNaN(t.startColumn)?0:t.startColumn,a=Number.isNaN(t.endColumn)?r:t.endColumn,l=Number.isNaN(n.startRow)?0:n.startRow,c=Number.isNaN(n.endRow)?r:n.endRow,u=Number.isNaN(n.startColumn)?0:n.startColumn,h=Number.isNaN(n.endColumn)?r:n.endColumn,d=Math.abs(o+a-u-h),f=Math.abs(o-a)+Math.abs(u-h),g=Math.abs(s+i-l-c),_=Math.abs(s-i)+Math.abs(l-c);return d<=f&&g<=_}static doAnyRangesIntersect(t,n){const r=new Us;return r.load(t.map(s=>({minX:s.startColumn,minY:s.startRow,maxX:s.endColumn,maxY:s.endRow}))),n.some(s=>r.search({minX:s.startColumn,minY:s.startRow,maxX:s.endColumn,maxY:s.endRow}).length>0)}static getIntersects(t,n){const r=t.startRow,s=t.endRow,i=t.startColumn,o=t.endColumn,a=n.startRow,l=n.endRow,c=n.startColumn,u=n.endColumn;let h,d,f,g;if(a<=s)a>=r?d=a:d=r;else return null;if(l>=r)l>=s?g=s:g=l;else return null;if(c<=o)c>i?h=c:h=i;else return null;if(u>=i)u>=o?f=o:f=u;else return null;return{startRow:d,endRow:g,startColumn:h,endColumn:f,rangeType:_e.NORMAL}}static contains(t,n){return t.startRow<=n.startRow&&t.endRow>=n.endRow&&t.startColumn<=n.startColumn&&t.endColumn>=n.endColumn}static realContain(t,n){return Yt.contains(t,n)&&(t.startRow<n.startRow||t.endRow>n.endRow||t.startColumn<n.startColumn||t.endColumn>n.endColumn)}static union(...t){return t.reduce((n,r)=>({startRow:Math.min(n.startRow,r.startRow),startColumn:Math.min(n.startColumn,r.startColumn),endRow:Math.max(n.endRow,r.endRow),endColumn:Math.max(n.endColumn,r.endColumn),rangeType:_e.NORMAL}),t[0])}static realUnion(...t){const n=t.some(i=>i.rangeType===_e.COLUMN),r=t.some(i=>i.rangeType===_e.ROW),s=Yt.union(...t);return{startColumn:r?Number.NaN:s.startColumn,endColumn:r?Number.NaN:s.endColumn,startRow:n?Number.NaN:s.startRow,endRow:n?Number.NaN:s.endRow,rangeType:r?_e.ROW:n?_e.COLUMN:_e.NORMAL}}static subtract(t,n){if(n.startRow>t.endRow||n.endRow<t.startRow||n.startColumn>t.endColumn||n.endColumn<t.startColumn)return[t];const r=[];n.startRow>=t.startRow&&r.push({startRow:t.startRow,startColumn:t.startColumn,endRow:n.startRow-1,endColumn:t.endColumn}),n.endRow<=t.endRow&&r.push({startRow:n.endRow+1,startColumn:t.startColumn,endRow:t.endRow,endColumn:t.endColumn});const s=Math.max(t.startRow,n.startRow),i=Math.min(t.endRow,n.endRow);return n.startColumn>=t.startColumn&&r.push({startRow:s,startColumn:t.startColumn,endRow:i,endColumn:n.startColumn-1}),n.endColumn<=t.endColumn&&r.push({startRow:s,startColumn:n.endColumn+1,endRow:i,endColumn:t.endColumn}),r.filter(a=>a.startRow<=a.endRow&&a.startColumn<=a.endColumn)}static mergeRanges(t){return j0(t)}static splitIntoGrid(t){return oa(t)}static subtractMulti(t,n){if(!n.length)return t;let r=t;return n.forEach(s=>{r=W0(r,s)}),r}static hasIntersectionBetweenTwoRect(t,n){return!(t.left>n.right||t.right<n.left||t.top>n.bottom||t.bottom<n.top)}static getIntersectionBetweenTwoRect(t,n){const r=Math.max(t.left,n.left),s=Math.min(t.right,n.right),i=Math.max(t.top,n.top),o=Math.min(t.bottom,n.bottom);return s<=r||o<=i?null:{left:r,right:s,top:i,bottom:o,width:s-r,height:o-i}}static sort(t){return t.sort((n,r)=>n.startRow-r.startRow||n.startColumn-r.startColumn)}};p(Yt,"getRelativeRange",(t,n)=>({startRow:t.startRow-n.startRow,endRow:t.endRow-t.startRow,startColumn:t.startColumn-n.startColumn,endColumn:t.endColumn-t.startColumn})),p(Yt,"getPositionRange",(t,n,r)=>({...r||{},startRow:r&&[Me.ROW,Me.ALL].includes(r.startAbsoluteRefType||0)?r.startRow:t.startRow+n.startRow,endRow:r&&[Me.ROW,Me.ALL].includes(r.endAbsoluteRefType||0)?r.endRow:t.endRow+t.startRow+n.startRow,startColumn:r&&[Me.COLUMN,Me.ALL].includes(r.startAbsoluteRefType||0)?r.startColumn:t.startColumn+n.startColumn,endColumn:r&&[Me.COLUMN,Me.ALL].includes(r.endAbsoluteRefType||0)?r.endColumn:t.endColumn+t.startColumn+n.startColumn})),p(Yt,"moveHorizontal",(t,n=0,r=0)=>({...t,startColumn:t.startColumn+n,endColumn:t.endColumn+n+r})),p(Yt,"moveVertical",(t,n=0,r=0)=>({...t,startRow:t.startRow+n,endRow:t.endRow+n+r})),p(Yt,"moveOffset",(t,n,r)=>{const s={...t};switch(t.startAbsoluteRefType){case Me.ROW:s.startColumn+=n;break;case Me.COLUMN:s.startRow+=r;break;case Me.ALL:break;case Me.NONE:default:s.startRow+=r,s.startColumn+=n;break}switch(t.endAbsoluteRefType){case Me.ROW:s.endColumn+=n;break;case Me.COLUMN:s.endRow+=r;break;case Me.ALL:break;case Me.NONE:default:s.endRow+=r,s.endColumn+=n;break}return s});let zt=Yt;function V0(e,t){if(e.length===0||e[0].length===0)return null;const n=new Array(e[0].length).fill(0);let r=0,s=null;for(let i=0;i<e.length;i++){for(let a=0;a<e[0].length;a++)n[a]=t(e[i][a])?n[a]+1:0;const o=z0(n);o.area>r&&(r=o.area,s={startColumn:o.start,startRow:i-o.height+1,endColumn:o.end,endRow:i})}return s}function z0(e){const t=[];let n=0,r={area:0,height:0,start:0,end:0},s=0;for(;s<e.length;)if(t.length===0||e[s]>=e[t[t.length-1]])t.push(s++);else{const i=e[t.pop()],o=t.length===0?s:s-t[t.length-1]-1;i*o>n&&(n=i*o,r={area:n,height:i,start:t.length===0?0:t[t.length-1]+1,end:s-1})}for(;t.length>0;){const i=e[t.pop()],o=t.length===0?s:s-t[t.length-1]-1;i*o>n&&(n=i*o,r={area:n,height:i,start:t.length===0?0:t[t.length-1]+1,end:s-1})}return r}function G0(e,t){Xn.foreach(t,(n,r)=>{e[n][r]=void 0})}function K0(e,t){const n=e.toFullArray(),r=[];for(;;){const s=V0(n,t);if(!s)break;r.push(s),G0(n,s)}return r}class X0{constructor(t,n){p(this,"_values",[]);p(this,"_keys",[]);p(this,"_keyMaps",new Map);this._values=t,this._keys=n,t.forEach(r=>{this._initKeyMap(r)})}_initKeyMap(t){this._keys.forEach(n=>{const r=t[n],s=this._keyMaps.get(n)||new Map;s.set(r,t),this._keyMaps.set(n,s)})}getValue(t,n){const r=n||this._keys;for(let s=0;s<r.length;s++){const i=this._keyMaps.get(r[s]);if(i!=null&&i.has(t))return i.get(t)}return null}hasValue(t){for(let n=0;n<this._keys.length;n++){const r=this._keyMaps.get(this._keys[n]);if(r!=null&&r.has(t))return!0}return!1}addValue(t){this._values.push(t),this._initKeyMap(t)}setValue(t,n,r){const s=this.getValue(t);s&&Object.keys(s).includes(n)&&(s[n]=r)}deleteValue(t,n){const r=this.getValue(t,n);if(r){this._keys.forEach(i=>{const o=this._keyMaps.get(i),a=r[i];o==null||o.delete(a)});const s=this._values.findIndex(i=>i===r);this._values.splice(s,1)}}getValues(){return this._values}getKeyMap(t){var n;return[...((n=this._keyMaps.get(t))==null?void 0:n.keys())||[]]}clear(){this._values=[],this._keys=[],this._keyMaps.clear()}}function Ji(e,t,n,r){return{forEach(s){for(let i=e;i<=t;i++)for(let o=n;o<=r;o++)s(i,o)}}}function q0(e){if(e==null||e.length===0)return Number.NaN;const t=e.toLowerCase().split(""),n=t.length,r=o=>o.charCodeAt(0)-96;let s=0,i=0;for(let o=0;o<n;o++)i=r(t[o]),s+=i*26**(n-o-1);return s===0?Number.NaN:s-1}const Ps=65,ch=90,J0=97;function Z0(e){const t=ch-Ps+1;let n="";for(;e>=0;)n=String.fromCharCode(e%t+Ps)+n,e=Math.floor(e/t)-1;return n}function uh(e,t){let n="";for(;t>0;)n+=e,t--;return n}function Q0(e,t=!1){const n=ch-Ps+1;let r=J0;t&&(r=Ps);const s=String.fromCharCode(e%n+r),i=Math.floor(e/n)+1;return uh(s,i)}function eC(e,t){return e.zIndex>t.zIndex?1:e.zIndex===t.zIndex?0:-1}function tC(e,t){return e.zIndex>t.zIndex?-1:e.zIndex===t.zIndex?0:1}function Yr(e="index",t=1){return(n,r)=>n[e]>r[e]?t:n[e]===r[e]?0:-t}function Vr(e,t=!1){const n=[];for(const r of e){const{st:s,ed:i,ts:o}=r;if(r.sId===void 0&&delete r.sId,s===i||!t&&Z.isEmptyObject(o)&&r.sId==null)continue;if(n.length===0){n.push(r);continue}const a=n.pop();Mu(r,a)&&Z.hasIntersectionBetweenTwoRanges(a.st,a.ed,r.st,r.ed)?n.push({...r,st:a.st,ed:i}):n.push(a,r)}return n}function hh(e,t,n,r){var c;const{textRuns:s}=e;if(s==null)return;const i=[],o=s.length;let a=!1;const l=(c=t.textRuns)!=null?c:[];if(l.length)for(const u of l)u.st+=r,u.ed+=r;for(let u=0;u<o;u++){const h=s[u],{st:d,ed:f}=h;if(f<=r)i.push(h);else if(r>d&&r<f){a=!0;const g={...h,ed:r};i.push(g),l.length&&i.push(...l);const _={...h,st:r+n,ed:f+n};i.push(_)}else h.st+=n,h.ed+=n,a||(a=!0,i.push(...l)),i.push(h)}a||(a=!0,i.push(...l)),e.textRuns=Vr(i)}function dh(e,t,n,r){const{paragraphs:s}=e;if(s==null)return;const{paragraphs:i}=t,o=[];for(let l=0,c=s.length;l<c;l++){const u=s[l],{startIndex:h}=u;h>=r&&(u.startIndex+=n),o.push(u.startIndex)}let a=-1;if(i){for(let l=0,c=i.length;l<c;l++){const u=i[l];u.startIndex+=r;const h=u.startIndex;a=o.indexOf(h)}a!==-1&&s.splice(a,1),s.push(...i),s.sort(Yr("startIndex"))}}function fh(e,t,n,r){const{sectionBreaks:s}=e;if(s==null)return;for(let o=0,a=s.length;o<a;o++){const l=s[o],{startIndex:c}=l;c>=r&&(l.startIndex+=n)}const i=t.sectionBreaks;if(i){for(let o=0,a=i.length;o<a;o++){const l=i[o];l.startIndex+=r}s.push(...i),s.sort(Yr("startIndex"))}}function mh(e,t,n,r){const{customBlocks:s=[]}=e;for(let o=0,a=s.length;o<a;o++){const l=s[o],{startIndex:c}=l;c>=r&&(l.startIndex+=n)}const i=t.customBlocks;if(i){for(let o=0,a=i.length;o<a;o++){const l=i[o];l.startIndex+=r}s.push(...i),s.sort(Yr("startIndex"))}s.length&&!e.customBlocks&&(e.customBlocks=s)}function gh(e,t,n,r){const{tables:s}=e;if(s==null)return;for(let o=0,a=s.length;o<a;o++){const l=s[o],{startIndex:c,endIndex:u}=l;c>r?(l.startIndex+=n,l.endIndex+=n):u>r&&(l.endIndex+=n)}const i=t.tables;if(i){for(let o=0,a=i.length;o<a;o++){const l=i[o];l.startIndex+=r,l.endIndex+=r}s.push(...i),s.sort(Yr("startIndex"))}}const _h="$",pl=e=>e.split(_h)[0];function aa(e){if(e.length<=1)return e;e.sort((s,i)=>s.startIndex-i.startIndex);const t=[];let n={...e[0]};n.rangeId=pl(n.rangeId);for(let s=1;s<e.length;s++){const i=e[s];i.rangeId=pl(i.rangeId),i.rangeId===n.rangeId&&Bl(n.properties,i.properties)&&n.endIndex+1>=i.startIndex?n.endIndex=i.endIndex:(t.push(n),n={...i})}t.push(n);const r=Object.create(null);for(let s=0,i=t.length;s<i;s++){const o=t[s],a=o.rangeId;r[a]?(o.rangeId=`${a}${_h}${r[a]}`,r[a]=r[a]+1):r[a]=1}return t}function Zi(e,t){const n=e.findIndex(s=>s.startIndex<t&&s.endIndex>=t),r=e[n];r&&e.splice(n,1,{rangeId:r.rangeId,rangeType:r.rangeType,startIndex:r.startIndex,endIndex:t-1,properties:{...r.properties}},{rangeId:r.rangeId,rangeType:r.rangeType,startIndex:t,endIndex:r.endIndex,properties:{...r.properties}})}function ph(e){if(e.length<=1)return e;e.sort((r,s)=>r.startIndex-s.startIndex);const t=[];let n={...e[0]};for(let r=1;r<e.length;r++){const s=e[r];s.id===n.id&&n.endIndex+1>=s.startIndex?n.endIndex=s.endIndex:(t.push(n),n={...s})}return t.push(n),t}function Qi(e,t){e.filter(r=>r.startIndex<t&&r.endIndex>=t).forEach(r=>{const s=e.indexOf(r);e.splice(s,1,{id:r.id,type:r.type,startIndex:r.startIndex,endIndex:t-1},{id:r.id,type:r.type,startIndex:t,endIndex:r.endIndex})})}function nC(e,t,n,r){e.customRanges||(e.customRanges=[]);const{customRanges:s}=e;Zi(s,r);for(let o=0,a=s.length;o<a;o++){const l=s[o],{startIndex:c}=l;c>=r&&(l.startIndex+=n,l.endIndex+=n)}const i=[];if(t.customRanges){for(let o=0,a=t.customRanges.length;o<a;o++){const l=t.customRanges[o];l.startIndex+=r,l.endIndex+=r,i.push(l)}s.push(...i)}e.customRanges=aa(s)}function rC(e,t,n,r){e.customDecorations||(e.customDecorations=[]);const{customDecorations:s}=e;Qi(s,r);for(let o=0,a=s.length;o<a;o++){const l=s[o],{startIndex:c}=l;c>=r&&(l.startIndex+=n,l.endIndex+=n)}const i=[];if(t.customDecorations){for(let o=0,a=t.customDecorations.length;o<a;o++){const l=t.customDecorations[o];l.startIndex+=r,l.endIndex+=r,i.push(l)}s.push(...i)}e.customDecorations=ph(s)}function Eh(e,t,n){const{textRuns:r}=e,s=n,i=n+t,o=[];if(r){const a=[];for(let l=0,c=r.length;l<c;l++){const u=r[l],{st:h,ed:d}=u;if(s<=h&&i>=d){o.push({...u,st:h-s,ed:d-s});continue}else h<=s&&d>=i?(o.push({...u,st:s-s,ed:i-s}),u.ed-=t):s>=h&&s<d?(o.push({...u,st:s-s,ed:d-s}),u.ed=s):i>h&&i<=d?(o.push({...u,st:h-s,ed:i-s}),u.st=i-t,u.ed-=t):h>=i&&(u.st-=t,u.ed-=t);a.push(u)}e.textRuns=a}return o.length===0&&o.push({st:0,ed:t,ts:{}}),o}function Ch(e,t,n){const{paragraphs:r}=e,s=n,i=n+t,o=[];if(r){const a=[];for(let l=0,c=r.length;l<c;l++){const u=r[l],{startIndex:h}=u;if(h>=s&&h<i){o.push({...u,startIndex:h-n});continue}else h>=i&&(u.startIndex-=t);a.push(u)}e.paragraphs=a}return o}function Rh(e,t,n){const{sectionBreaks:r}=e,s=n,i=n+t-1,o=[];if(r){const a=[];for(let l=0,c=r.length;l<c;l++){const u=r[l],{startIndex:h}=u;if(h>=s&&h<=i){o.push({...u,startIndex:h-n});continue}else h>i&&(u.startIndex-=t);a.push(u)}e.sectionBreaks=a}return o}function Ih(e,t,n){const{customBlocks:r=[]}=e,s=n,i=n+t-1,o=[];if(r){const a=[];for(let l=0,c=r.length;l<c;l++){const u=r[l],{startIndex:h}=u;if(h>=s&&h<=i){o.push({...u,startIndex:h-n});continue}else h>i&&(u.startIndex-=t);a.push(u)}e.customBlocks=a}return r.length&&!e.customBlocks&&(e.customBlocks=r),o}function Sh(e,t,n){const{tables:r}=e,s=n,i=n+t-1,o=[];if(r){const a=[];for(let l=0,c=r.length;l<c;l++){const u=r[l],{startIndex:h,endIndex:d}=u;if(s<=h&&i>=d){o.push({...u,startIndex:h-n,endIndex:d-n});continue}else if(h<=s&&d>=i){const f=qs(h,d,s,i);if(f.length===0||(u.startIndex=f[0],u.endIndex=f[1],u.startIndex===u.endIndex))continue}else i<h&&(u.startIndex-=t,u.endIndex-=t);a.push(u)}e.tables=a}return o}function sC(e,t,n){const{customRanges:r}=e,s=n,i=n+t-1,o=[];if(r){const a=[];for(let l=0,c=r.length;l<c;l++){const u=r[l],{startIndex:h,endIndex:d}=u;if(h>=s&&d<=i){o.push(u);continue}else if(Math.max(s,h)<=Math.min(i,d)){const f=qs(h,d,s,i);if(f.length===0)continue;u.startIndex=f[0],u.endIndex=f[1]}else i<h&&(u.startIndex-=t,u.endIndex-=t);a.push(u)}e.customRanges=aa(a)}return o}function iC(e,t,n,r=!0){const{customDecorations:s}=e,i=n,o=n+t-1,a=[];if(s){const l=[];for(let c=0,u=s.length;c<u;c++){const h=s[c],{startIndex:d,endIndex:f}=h;if(d>=i&&f<=o){a.push(h);continue}else if(Math.max(i,d)<=Math.min(o,f)){const g=qs(d,f,i,o);if(g.length===0)continue;h.startIndex=g[0],h.endIndex=g[1]}else o<d&&r&&(h.startIndex-=t,h.endIndex-=t);l.push(h)}e.customDecorations=l}return a}var Oh=(e=>(e.ORDER_LIST_QUICK_1="1.",e.ORDER_LIST_QUICK_2="a)",e.ORDER_LIST_QUICK_3="a.",e.ORDER_LIST_QUICK_4="i.",e.ORDER_LIST_QUICK_5="A.",e.ORDER_LIST_QUICK_6="I.",e.ORDER_LIST_QUICK_7="01.",e.BULLET_LIST="*",e))(Oh||{}),Ft=(e=>(e.BULLET_LIST="BULLET_LIST",e.BULLET_LIST_1="BULLET_LIST_1",e.BULLET_LIST_2="BULLET_LIST_2",e.BULLET_LIST_3="BULLET_LIST_3",e.BULLET_LIST_4="BULLET_LIST_4",e.BULLET_LIST_5="BULLET_LIST_5",e.ORDER_LIST="ORDER_LIST",e.ORDER_LIST_1="ORDER_LIST_1",e.ORDER_LIST_2="ORDER_LIST_2",e.ORDER_LIST_3="ORDER_LIST_3",e.ORDER_LIST_4="ORDER_LIST_4",e.ORDER_LIST_5="ORDER_LIST_5",e.ORDER_LIST_QUICK_2="ORDER_LIST_QUICK_2",e.ORDER_LIST_QUICK_3="ORDER_LIST_QUICK_3",e.ORDER_LIST_QUICK_4="ORDER_LIST_QUICK_4",e.ORDER_LIST_QUICK_5="ORDER_LIST_QUICK_5",e.ORDER_LIST_QUICK_6="ORDER_LIST_QUICK_6",e.CHECK_LIST="CHECK_LIST",e.CHECK_LIST_CHECKED="CHECK_LIST_CHECKED",e))(Ft||{});const as={"a)":{glyphFormat:"%1)",glyphType:fe.DECIMAL},"1.":{glyphType:fe.DECIMAL},"a.":{glyphFormat:"%1.",glyphType:fe.LOWER_LETTER},"A.":{glyphType:fe.UPPER_LETTER},"i.":{glyphFormat:"%1.",glyphType:fe.LOWER_ROMAN},"I.":{glyphFormat:"%1.",glyphType:fe.UPPER_LETTER}},Nn=e=>[...e,...e,...e].map((t,n)=>({glyphFormat:` %${n+1}`,glyphSymbol:t,bulletAlignment:Br.START,textStyle:{fs:12},startNumber:0,paragraphProperties:{hanging:{v:21},indentStart:{v:21*n}}})),Mn=e=>e.map((t,n)=>({...t,bulletAlignment:Br.START,textStyle:{fs:12},startNumber:0,paragraphProperties:{hanging:{v:21},indentStart:{v:21*n}}})),El=(e,t)=>new Array(9).fill(0).map((n,r)=>({glyphFormat:` %${r+1}`,glyphSymbol:e,bulletAlignment:Br.START,textStyle:{fs:16},startNumber:0,paragraphProperties:{hanging:{v:21},indentStart:{v:21*r},textStyle:t}})),zr={BULLET_LIST:{listType:"BULLET_LIST",nestingLevel:Nn(["●","○","■"])},BULLET_LIST_1:{listType:"BULLET_LIST",nestingLevel:Nn(["❖","➢","■"])},BULLET_LIST_2:{listType:"BULLET_LIST",nestingLevel:Nn(["✔","●","◆"])},BULLET_LIST_3:{listType:"BULLET_LIST",nestingLevel:Nn(["■","◆","○"])},BULLET_LIST_4:{listType:"BULLET_LIST",nestingLevel:Nn(["✧","○","■"])},BULLET_LIST_5:{listType:"BULLET_LIST",nestingLevel:Nn(["➢","○","◆"])},ORDER_LIST:{listType:"ORDER_LIST",nestingLevel:Mn([{glyphFormat:"%1.",glyphType:fe.DECIMAL},{glyphFormat:"%2.",glyphType:fe.LOWER_LETTER},{glyphFormat:"%3.",glyphType:fe.LOWER_ROMAN},{glyphFormat:"%4.",glyphType:fe.DECIMAL},{glyphFormat:"%5.",glyphType:fe.LOWER_LETTER},{glyphFormat:"%6.",glyphType:fe.LOWER_ROMAN},{glyphFormat:"%7.",glyphType:fe.DECIMAL},{glyphFormat:"%8.",glyphType:fe.LOWER_LETTER},{glyphFormat:"%9.",glyphType:fe.LOWER_ROMAN}])},ORDER_LIST_1:{listType:"ORDER_LIST",nestingLevel:Mn([{glyphFormat:"%1)",glyphType:fe.DECIMAL},{glyphFormat:"%2)",glyphType:fe.LOWER_LETTER},{glyphFormat:"%3)",glyphType:fe.LOWER_ROMAN},{glyphFormat:"%4)",glyphType:fe.DECIMAL},{glyphFormat:"%5)",glyphType:fe.LOWER_LETTER},{glyphFormat:"%6)",glyphType:fe.LOWER_ROMAN},{glyphFormat:"%7)",glyphType:fe.DECIMAL},{glyphFormat:"%8)",glyphType:fe.LOWER_LETTER},{glyphFormat:"%9)",glyphType:fe.LOWER_ROMAN}])},ORDER_LIST_2:{listType:"ORDER_LIST",nestingLevel:Mn(["%1.","%1.%2.","%1.%2.%3.","%1.%2.%3.%4.","%1.%2.%3.%4.%5.","%1.%2.%3.%4.%5.%6.","%1.%2.%3.%4.%5.%6.%7."].map(e=>({glyphFormat:e,glyphType:fe.DECIMAL})))},ORDER_LIST_3:{listType:"ORDER_LIST",nestingLevel:Mn([{glyphFormat:"%1.",glyphType:fe.UPPER_LETTER},{glyphFormat:"%2.",glyphType:fe.LOWER_LETTER},{glyphFormat:"%3.",glyphType:fe.LOWER_ROMAN},{glyphFormat:"%4.",glyphType:fe.UPPER_LETTER},{glyphFormat:"%5.",glyphType:fe.LOWER_LETTER},{glyphFormat:"%6.",glyphType:fe.LOWER_ROMAN},{glyphFormat:"%7.",glyphType:fe.UPPER_LETTER},{glyphFormat:"%8.",glyphType:fe.LOWER_LETTER},{glyphFormat:"%9.",glyphType:fe.LOWER_ROMAN}])},ORDER_LIST_4:{listType:"ORDER_LIST",nestingLevel:Mn([{glyphFormat:"%1.",glyphType:fe.UPPER_LETTER},{glyphFormat:"%2.",glyphType:fe.DECIMAL},{glyphFormat:"%3.",glyphType:fe.LOWER_ROMAN},{glyphFormat:"%4.",glyphType:fe.UPPER_LETTER},{glyphFormat:"%5.",glyphType:fe.DECIMAL},{glyphFormat:"%6.",glyphType:fe.LOWER_ROMAN},{glyphFormat:"%7.",glyphType:fe.UPPER_LETTER},{glyphFormat:"%8.",glyphType:fe.DECIMAL},{glyphFormat:"%9.",glyphType:fe.LOWER_ROMAN}])},ORDER_LIST_5:{listType:"ORDER_LIST",nestingLevel:Mn([{glyphFormat:"%1.",glyphType:fe.DECIMAL_ZERO},{glyphFormat:"%2.",glyphType:fe.LOWER_LETTER},{glyphFormat:"%3.",glyphType:fe.LOWER_ROMAN},{glyphFormat:"%4.",glyphType:fe.DECIMAL_ZERO},{glyphFormat:"%5.",glyphType:fe.LOWER_LETTER},{glyphFormat:"%6.",glyphType:fe.LOWER_ROMAN},{glyphFormat:"%7.",glyphType:fe.DECIMAL_ZERO},{glyphFormat:"%8.",glyphType:fe.LOWER_LETTER},{glyphFormat:"%9.",glyphType:fe.LOWER_ROMAN}])},CHECK_LIST:{listType:"CHECK_LIST",nestingLevel:El("☐")},CHECK_LIST_CHECKED:{listType:"CHECK_LIST_CHECKED",nestingLevel:El("☑",{st:{s:ie.TRUE}})}},ls=e=>{const{glyphFormat:t,glyphType:n}=e,r=Z.deepClone(zr.ORDER_LIST);return r.nestingLevel[0].glyphFormat=t,r.nestingLevel[0].glyphType=n,r},oC={ORDER_LIST_QUICK_2:ls(as["a)"]),ORDER_LIST_QUICK_3:ls(as["a."]),ORDER_LIST_QUICK_4:ls(as["i."]),ORDER_LIST_QUICK_6:ls(as["I."])};Object.assign(zr,oC);const aC={"1.":"ORDER_LIST","a)":"ORDER_LIST_QUICK_2","a.":"ORDER_LIST_QUICK_3","i.":"ORDER_LIST_QUICK_4","A.":"ORDER_LIST_3","I.":"ORDER_LIST_QUICK_6","01.":"ORDER_LIST_5","*":"BULLET_LIST"};function lC(e,t,n,r,s){const i=cC(e,t,n,r,s),o=uC(e,t,n,r,s),a=hC(e,t,n,r,s),l=dC(e,t,n,r,s),c=fC(e,t,n,r,s),u=mC(e,t,n,r),h=gC(e,t,n,r,s);return{dataStream:"",textRuns:i,paragraphs:o,sectionBreaks:a,customBlocks:l,tables:c,customRanges:u,customDecorations:h}}function cC(e,t,n,r,s){const{textRuns:i}=e,{textRuns:o}=t;if(i==null||o==null)return;const a=Eh(e,n,r);if(s!==Ee.REPLACE){const l=wh(o,a,s);t.textRuns=l}return hh(e,t,n,r),a}function wh(e,t,n){if(t.length===0)return e;e=Z.deepClone(e),t=Z.deepClone(t);const r=[],s=e.length,i=t.length;let o=0,a=0,l=null;function c(){return l?(r.push(l),l=null,!0):!1}for(;o<s&&a<i;){const{st:f,ed:g,ts:_}=e[o],{st:R,ed:b,ts:F,sId:k}=t[a];let W;if(n===Ee.COVER?W={...F,..._}:W={..._},g<R)c()||r.push(e[o]),o++;else if(b<f)c()||r.push(t[a]),a++;else{const S={st:Math.min(f,R),ed:Math.max(f,R),ts:f<R?{..._}:{...F},sId:f<R?void 0:k};S.ed>S.st&&r.push(S),r.push({st:Math.max(f,R),ed:Math.min(g,b),ts:W,sId:k}),g<b?(o++,t[a].st=g,t[a].st===t[a].ed&&a++):(a++,e[o].st=b,e[o].st===e[o].ed&&o++);const C={st:Math.min(g,b),ed:Math.max(g,b),ts:g<b?{...F}:{..._},sId:g<b?k:void 0};l=C.ed>C.st?C:null}}c();const u=r[r.length-1],h=e[s-1],d=t[i-1];return u&&u.ed!==Math.max(h.ed,d.ed)&&(h.ed>d.ed?r.push(h):r.push(d)),Vr(r)}function uC(e,t,n,r,s){const{paragraphs:i}=e,{paragraphs:o}=t;if(i==null||o==null)return;const a=Ch(e,n,r);if(s!==Ee.REPLACE){const l=[];for(const c of o){const{startIndex:u,paragraphStyle:h,bullet:d}=c;let f=[];for(const g of a){const{startIndex:_,paragraphStyle:R,bullet:b}=g;let F,k;if(s===Ee.COVER?(F={...R,...h},k={listId:"",listType:Ft.BULLET_LIST,nestingLevel:0,textStyle:{},...b,...d}):(F={...h,...R},k={listId:"",listType:Ft.BULLET_LIST,nestingLevel:0,textStyle:{},...d,...b}),u===_){f.push({startIndex:u,paragraphStyle:F,bullet:k});break}}l.push(...f),f=[]}t.paragraphs=l}return dh(e,t,n,r),a}function hC(e,t,n,r,s){const{sectionBreaks:i}=e,{sectionBreaks:o}=t;if(i==null||o==null)return;const a=Rh(e,n,r);if(s!==Ee.REPLACE){const l=[];for(const c of o){const{startIndex:u}=c;let h=[];for(const d of a){const{startIndex:f}=d;if(u===f){s===Ee.COVER?h.push({...d,...c}):h.push({...c,...d});break}}l.push(...h),h=[]}t.sectionBreaks=l}return fh(e,t,n,r),a}function dC(e,t,n,r,s){const{customBlocks:i=[]}=e,{customBlocks:o}=t;if(i==null||o==null)return;const a=Ih(e,n,r);if(s!==Ee.REPLACE){const l=[];for(const c of o){const{startIndex:u}=c;let h=[];for(const d of a){const{startIndex:f}=d;if(u===f){s===Ee.COVER?h.push({...d,...c}):h.push({...c,...d});break}}l.push(...h),h=[]}t.customBlocks=l}return mh(e,t,n,r),i.length&&!e.customBlocks&&(e.customBlocks=i),a}function fC(e,t,n,r,s){const{tables:i}=e,{tables:o}=t;if(i==null||o==null)return;const a=Sh(e,n,r);if(s!==Ee.REPLACE){const l=[];for(const c of o){const{startIndex:u,endIndex:h}=c;let d=[];for(const f of a){const{startIndex:g,endIndex:_}=f;if(g>=u&&_<=h){s===Ee.COVER?d.push({...f,...c}):d.push({...c,...f});break}}l.push(...d),d=[]}t.tables=l}return gh(e,t,n,r),a}function mC(e,t,n,r,s){e.customRanges||(e.customRanges=[]),Zi(e.customRanges,r),Zi(e.customRanges,r+n);const i=r,o=r+n-1,{customRanges:a}=t,l=[],c=new Map;e.customRanges.forEach(h=>{const{startIndex:d,endIndex:f}=h;d>=i&&f<=o?c.set(h.rangeId,h):l.push(h)});const u=[];return a?(a.forEach(h=>{const{startIndex:d,endIndex:f}=h;l.push({...h,startIndex:d+r,endIndex:f+r})}),e.customRanges=aa(l),u):[]}function gC(e,t,n,r,s){e.customDecorations||(e.customDecorations=[]),Qi(e.customDecorations,r),Qi(e.customDecorations,r+n);const i=[],{customDecorations:o}=e,{customDecorations:a=[]}=t;if(s===Ee.REPLACE){for(let l=0;l<o.length;l++){const c=o[l],{startIndex:u,endIndex:h}=c;u>=r&&h<=r+n-1&&i.push(c)}a.forEach(l=>{const{startIndex:c,endIndex:u}=l;o.push({...l,startIndex:c+r,endIndex:u+r})})}else for(const l of a){const{id:c}=l;if(l.type===En.DELETED){const u=o.filter(h=>h.id===c);u.length&&i.push(...u)}else o.push({...l,startIndex:l.startIndex+r,endIndex:l.endIndex+r})}for(const l of i){const{id:c}=l,u=o.findIndex(h=>h.id===c);u!==-1&&o.splice(u,1)}return e.customDecorations=ph(o),i}var la=(e=>(e[e.copy=0]="copy",e[e.cut=1]="cut",e))(la||{});function ks(e,t,n,r=!0){const{textRuns:s}=e;if(s){const i=[];for(const o of s){const a=Z.deepClone(o),{st:l,ed:c}=a;Z.hasIntersectionBetweenTwoRanges(l,c,t,n)&&(t>=l&&t<=c?i.push({...a,st:t,ed:Math.min(n,c)}):n>=l&&n<=c?i.push({...a,st:Math.max(t,l),ed:n}):i.push(a))}return Vr(i.map(o=>{const{st:a,ed:l}=o;return{...o,st:a-t,ed:l-t}}))}else if(r)return[{st:0,ed:n-t,ts:{}}]}function vh(e,t,n){const{tables:r=[]}=e,s=[];for(const i of r){const o=Z.deepClone(i),{startIndex:a,endIndex:l}=o;a>=t&&l<=n&&s.push({...o,startIndex:a-t,endIndex:l-t})}return s}function bh(e,t,n){const{paragraphs:r=[]}=e,s=[];for(const i of r){const{startIndex:o}=i;if(o>=t&&o<n){const a=Z.deepClone(i);s.push(a)}}if(s.length)return s.map(i=>({...i,startIndex:i.startIndex-t}))}function _C(e,t,n){const{sectionBreaks:r=[]}=e,s=[];for(const i of r){const{startIndex:o}=i;o>=t&&o<=n&&s.push(Z.deepClone(i))}if(s.length)return s.map(i=>({...i,startIndex:i.startIndex-t}))}function yh(e,t,n){const{customBlocks:r=[]}=e,s=[];for(const i of r){const{startIndex:o}=i;o>=t&&o<n&&s.push(Z.deepClone(i))}if(s.length)return s.map(i=>({...i,startIndex:i.startIndex-t}))}function Mt(e,t,n,r=!0,s=1){const{dataStream:i}=e,o={dataStream:i.slice(t,n)};o.textRuns=ks(e,t,n,r);const a=vh(e,t,n);if(a.length&&(o.tables=a),o.paragraphs=bh(e,t,n),s===1){const c=Th(e,t,n);c?o.customDecorations=c:r&&(o.customDecorations=[])}const{customRanges:l}=Ah(e,t,n);return l?o.customRanges=l:r&&(o.customRanges=[]),o.customBlocks=yh(e,t,n),o}function pC(e){const{dataStream:t,textRuns:n,paragraphs:r,customRanges:s,customDecorations:i,tables:o}=e;let a=0,l=0;s==null||s.forEach(u=>{u.startIndex<0&&(a=Math.max(a,-u.startIndex)),u.endIndex>t.length-1&&(l=Math.max(l,u.endIndex-t.length+1))});const c=`${t}`;return n&&(n[0]&&(n[0].st=n[0].st-a),n[n.length-1]&&(n[n.length-1].ed=n[n.length-1].ed+l)),n==null||n.forEach(u=>{u.st+=a,u.ed+=a}),r==null||r.forEach(u=>{u.startIndex+=a}),s==null||s.forEach(u=>{u.startIndex+=a,u.endIndex+=a}),i==null||i.forEach(u=>{u.startIndex+=a,u.endIndex+=l}),o==null||o.forEach(u=>{u.startIndex+=a,u.endIndex+=l}),{...e,dataStream:c,textRuns:n,paragraphs:r,customRanges:s,customDecorations:i,tables:o}}function Ah(e,t,n){if(e.customRanges==null)return{};const{customRanges:r}=e;return{customRanges:r.filter(a=>Math.max(a.startIndex,t)<=Math.min(a.endIndex,n-1)).map(a=>({...a,startIndex:Math.max(a.startIndex,t),endIndex:Math.min(a.endIndex,n-1)})).map(a=>({...a,startIndex:a.startIndex-t,endIndex:a.endIndex-t})),leftOffset:0,rightOffset:0}}function Th(e,t,n){if(e.customDecorations==null)return;const{customDecorations:r=[]}=e,s=[];return r.forEach(i=>{if(Math.max(i.startIndex,t)<=Math.min(i.endIndex,n-1)){const o=Z.deepClone(i);s.push({...o,startIndex:Math.max(o.startIndex-t,0),endIndex:Math.min(o.endIndex,n-1)-t})}}),s}function EC(e,t,n){return e==null||t==null?e!=null?e:t:wh(e,t,n)}function CC(e,t,n){if(e==null||t==null)return e!=null?e:t;if(t.length===0||e.length===0)return e;if(t.length>1||e.length>1)throw new Error("Cannot cover multiple customRanges");return n===Ee.REPLACE?[{...e[0]}]:[{...t[0],...e[0]}]}function RC(e,t,n){return t.length===0||e.length===0||n===Ee.REPLACE?e:[...e,...t.filter(r=>!e.some(s=>r.id===s.id))]}function eo(e,t,n=Ee.COVER){if(t.dataStream!=="")throw new Error("Cannot compose other body with non-empty dataStream");const r={dataStream:e.dataStream},{textRuns:s,paragraphs:i=[],customRanges:o,customDecorations:a=[]}=e,{textRuns:l,paragraphs:c=[],customRanges:u,customDecorations:h=[]}=t;r.textRuns=EC(l,s,n),r.customRanges=CC(u,o,n);const d=RC(h,a,n);d.length&&(r.customDecorations=d);const f=[];let g=0,_=0;for(;g<i.length&&_<c.length;){const R=i[g],b=c[_],{startIndex:F}=R,{startIndex:k}=b;F===k?(f.push(Z.deepMerge(R,b)),g++,_++):F<k?(f.push(Z.deepClone(R)),g++):(f.push(Z.deepClone(b)),_++)}return g<i.length&&f.push(...i.slice(g)),_<c.length&&f.push(...c.slice(_)),f.length&&(r.paragraphs=f),r}function IC(e){const{body:t}=e;if(t==null)return!0;const{textRuns:n,paragraphs:r,customRanges:s,customBlocks:i,customDecorations:o,tables:a}=t;return n==null&&r==null&&s==null&&i==null&&o==null&&a==null}class Un{constructor(t){p(this,"_index",0);p(this,"_offset",0);this._actions=t}hasNext(){return this.peekLength()<Number.POSITIVE_INFINITY}next(t){t||(t=Number.POSITIVE_INFINITY);const n=this._actions[this._index];if(n){const r=this._offset,s=n.len;return t>=s-r?(t=s-r,this._index+=1,this._offset=0):this._offset+=t,n.t===q.DELETE||n.t===q.RETAIN&&n.body==null?Z.deepClone({...n,len:t}):Z.deepClone({...n,len:t,body:Mt(n.body,r,r+t,!1)})}else return{t:q.RETAIN,len:Number.POSITIVE_INFINITY}}peek(){return this._actions[this._index]}peekLength(){return this._actions[this._index]?this._actions[this._index].len-this._offset:Number.POSITIVE_INFINITY}peekType(){const t=this._actions[this._index];return t?t.t:q.RETAIN}rest(){if(this.hasNext()){if(this._offset===0)return this._actions.slice(this._index);{const t=this._offset,n=this._index,r=this.next(),s=this._actions.slice(this._index);return this._offset=t,this._index=n,[r].concat(s)}}else return[]}}function Nh(e,t,n){const{dataStream:r}=e,s=n,i=n+t,o=Eh(e,t,n),a=Ch(e,t,n),l=Rh(e,t,n),c=Ih(e,t,n),u=Sh(e,t,n),h=sC(e,t,n),d=iC(e,t,n);let f="";return r&&(e.dataStream=xu(r,s,i),f=r.slice(s,i)),{dataStream:f,textRuns:o,paragraphs:a,sectionBreaks:l,customBlocks:c,tables:u,customRanges:h,customDecorations:d}}function Mh(e,t,n,r){e.dataStream=Lu(e.dataStream,r,t.dataStream),hh(e,t,n,r),dh(e,t,n,r),fh(e,t,n,r),mh(e,t,n,r),gh(e,t,n,r),nC(e,t,n,r),rC(e,t,n,r)}function SC(e,t,n,r,s=Ee.COVER){return lC(e,t,n,r,s)}function OC(e,t,n){return t<=0?{dataStream:""}:Nh(e,t,n)}function wC(e,t,n,r){n!==0&&Mh(e,t,n,r)}function vC(e,t){const n=new vn;return n.reset(),t.forEach(r=>{const s=Z.deepClone(r);switch(s.t){case q.RETAIN:{const{coverType:i,body:o,len:a}=s;o!=null&&SC(e,o,a,n.cursor,i),n.moveCursor(a);break}case q.INSERT:{const{body:i,len:o}=s;wC(e,i,o,n.cursor),n.moveCursor(o);break}case q.DELETE:{const{len:i}=s;OC(e,i,n.cursor);break}default:throw new Error(`Unknown action type for action: ${s}.`)}}),e}function bC(e,t,n,r,s){if(e==null||t==null)return t;if(e.length===0||t.length===0)return[];t=Z.deepClone(t),e=Z.deepClone(e);const i=[],o=t.length,a=e.length;let l=0,c=0,u=null;function h(){return u?(i.push(u),u=null,!0):!1}for(;l<o&&c<a;){const{st:_,ed:R,ts:b}=t[l],{st:F,ed:k,ts:W,sId:S}=e[c];let C={};if(s===0)C={...b},n===Ee.COVER&&r===Ee.REPLACE&&W&&(C=Object.assign({},W,C));else if(C={...b},n===Ee.REPLACE){if(r===Ee.REPLACE)C={...W};else if(b&&W){const v=Object.keys(b);for(const A of v)W[A]&&delete C[A]}}else if(r===Ee.REPLACE){if(W){const v=Object.keys(W);for(const A of v)W[A]!==void 0&&(C[A]=W[A])}}else if(W){const v=Object.keys(W);for(const A of v)C[A]!==void 0&&delete C[A]}if(R<F)h()||i.push(t[l]),l++;else if(k<_)h()||i.push(e[c]),c++;else{const v={st:Math.min(_,F),ed:Math.max(_,F),ts:_<F?{...b}:{...W}};v.ed>v.st&&i.push(),i.push({st:Math.max(_,F),ed:Math.min(R,k),ts:C,sId:S}),R<k?(l++,e[c].st=R,e[c].st===e[c].ed&&c++):(c++,t[l].st=k,t[l].st===t[l].ed&&l++);const A={st:Math.min(R,k),ed:Math.max(R,k),ts:R<k?{...W}:{...b},sId:R<k?S:void 0};u=A.ed>A.st?A:null}}h();const d=i[i.length-1],f=t[o-1],g=e[a-1];return d.ed!==Math.max(f.ed,g.ed)&&(f.ed>g.ed?i.push(f):i.push(g)),Vr(i,!0)}function yC(e,t,n,r,s){if(e==null||t==null)return t;if(e.length===0||t.length===0)return[];if(e.length>1||t.length>1)throw new Error("CustomRanges is only supported transform for length one now.");const i=e[0],o=t[0];if(n===Ee.REPLACE)return s===1?[Z.deepClone(i)]:[Z.deepClone(o)];if(r===Ee.REPLACE){const a=Z.deepClone(o);return s===1&&Object.assign(a,Z.deepClone(i)),[a]}else{const a=Z.deepClone(o);return s===1&&Object.assign(a,Z.deepClone(i)),[a]}}function Cl(e,t,n,r,s){const i={startIndex:t.startIndex};if(t.paragraphStyle&&(i.paragraphStyle=Z.deepClone(t.paragraphStyle),e.paragraphStyle)){if(n===Ee.REPLACE)if(r===Ee.REPLACE)s===1&&(i.paragraphStyle={...e.paragraphStyle});else if(s===1){const o=Object.keys(e.paragraphStyle);for(const a of o)e.paragraphStyle[a]!==void 0&&(i.paragraphStyle[a]=e.paragraphStyle[a])}else{const o=Object.keys(e.paragraphStyle);for(const a of o)i.paragraphStyle[a]===void 0&&(i.paragraphStyle[a]=e.paragraphStyle[a])}else if(r===Ee.REPLACE)if(s===1){const o=Object.keys(e.paragraphStyle);for(const a of o)e.paragraphStyle[a]!==void 0&&(i.paragraphStyle[a]=e.paragraphStyle[a])}else{const o=Object.keys(e.paragraphStyle);for(const a of o)i.paragraphStyle[a]===void 0&&(i.paragraphStyle[a]=e.paragraphStyle[a])}else if(s===1){const o=Object.keys(e.paragraphStyle);for(const a of o)i.paragraphStyle[a]&&delete i.paragraphStyle[a]}}return n===Ee.REPLACE&&r===Ee.REPLACE?i.bullet=s===1?Z.deepClone(e.bullet):Z.deepClone(t.bullet):e.bullet===void 0?i.bullet=Z.deepClone(t.bullet):n===Ee.REPLACE||r===Ee.REPLACE?i.bullet=s===0&&t.bullet?Z.deepClone(t.bullet):Z.deepClone(e.bullet):s===0&&t.bullet!==void 0&&(i.bullet=Z.deepClone(t.bullet)),i}function AC(e,t){if(e==null||t==null)return t;if(e.length===0||t.length===0)return Z.deepClone(t);const n=[];for(const r of t){const{id:s,type:i}=r;let o=!1;for(const a of e)if(a.id===s){(a.type===En.DELETED||i===En.DELETED)&&(o=!0,n.push({...r,type:En.DELETED}));break}o||n.push(r)}return n}function TC(e,t,n=!1){const{body:r,coverType:s=Ee.COVER}=e,{body:i,coverType:o=Ee.COVER}=t;if(r==null||r.dataStream!==""||i==null||i.dataStream!=="")throw new Error("Data stream is not supported in retain transform.");const a={dataStream:""},l=o,{textRuns:c,paragraphs:u=[],customRanges:h,customDecorations:d}=r,{textRuns:f,paragraphs:g=[],customRanges:_,customDecorations:R}=i,b=bC(c,f,s,o,n?1:0);b&&(a.textRuns=b);const F=yC(h,_,s,o,n?1:0);F&&(a.customRanges=F);const k=AC(d,R);k&&(a.customDecorations=k);const W=[];let S=0,C=0;for(;S<u.length&&C<g.length;){const v=u[S],A=g[C],{startIndex:H}=v,{startIndex:B}=A;if(H===B){let m={startIndex:H};n?m=Cl(v,A,s,o,1):m=Cl(v,A,s,o,0),W.push(m),S++,C++}else H<B?S++:(W.push(Z.deepClone(A)),C++)}return C<g.length&&W.push(...g.slice(C)),W.length&&(a.paragraphs=W),{coverType:l,body:a}}function Rl(e){return Object.keys(e).length===1}const Wn=class Wn{constructor(){p(this,"_actions",[])}static apply(t,n){return vC(t,n)}static compose(t,n){const r=new Un(t),s=new Un(n),i=new Wn;for(;r.hasNext()||s.hasNext();)if(s.peekType()===q.INSERT)i.push(s.next());else if(r.peekType()===q.DELETE)i.push(r.next());else{const o=Math.min(r.peekLength(),s.peekLength()),a=r.next(o),l=s.next(o);if(a.t===q.INSERT&&l.t===q.RETAIN)l.body==null?i.push(a):i.push({...a,body:eo(a.body,l.body,l.coverType)});else if(a.t===q.RETAIN&&l.t===q.RETAIN)if(a.body==null&&l.body==null)i.push(a.len!==Number.POSITIVE_INFINITY?a:l);else if(a.body&&l.body){const c=a.coverType===Ee.REPLACE||l.coverType===Ee.REPLACE?Ee.REPLACE:Ee.COVER;i.push({...a,t:q.RETAIN,coverType:c,body:eo(a.body,l.body,l.coverType)})}else i.push(a.body?a:l);else a.t===q.RETAIN&&l.t===q.DELETE?i.push(l):a.t===q.INSERT&&(l.t,q.DELETE)}return i.trimEndUselessRetainAction(),i.serialize()}static transform(t,n,r="right"){return this._transform(n,t,r==="left"?"right":"left")}static _transform(t,n,r="right"){const s=new Un(t),i=new Un(n),o=new Wn;for(;s.hasNext()||i.hasNext();)if(s.peekType()===q.INSERT&&(r==="left"||i.peekType()!==q.INSERT)){const a=s.next();o.retain(a.len)}else if(i.peekType()===q.INSERT)o.push(i.next());else{const a=Math.min(s.peekLength(),i.peekLength()),l=s.next(a),c=i.next(a);if(l.t===q.DELETE)continue;if(c.t===q.DELETE){o.push(c);continue}if(l.body==null||c.body==null)o.push(c);else{const{coverType:u,body:h}=TC(l,c,r==="left");o.push({...c,t:q.RETAIN,coverType:u,body:h})}}return o.trimEndUselessRetainAction(),o.serialize()}static transformPosition(t,n,r=!1){const s=new Un(t);let i=0;for(;s.hasNext()&&i<=n;){const o=s.peekLength(),a=s.peekType();if(s.next(),a===q.DELETE){n-=Math.min(o,n-i);continue}else a===q.INSERT&&(i<n||!r)&&(n+=o);i+=o}return n}static isNoop(t){return t.length===0}static invert(t){const n=[];for(const r of t)if(r.t===q.INSERT)n.push({t:q.DELETE,len:r.len,body:r.body});else if(r.t===q.DELETE){if(r.body==null)throw new Error("Can not invert DELETE action without body property, makeInvertible must be called first.");n.push({t:q.INSERT,body:r.body,len:r.len})}else if(r.body!=null){if(r.oldBody==null)throw new Error("Can not invert RETAIN action without oldBody property, makeInvertible must be called first.");n.push({t:q.RETAIN,body:r.oldBody,oldBody:r.body,len:r.len,coverType:Ee.REPLACE})}else n.push(r);return n}static makeInvertible(t,n){const r=[];let s=0;for(const i of t){if(i.t===q.DELETE&&(i.body==null||i.body&&i.body.dataStream.length!==i.len)){const o=Mt(n,s,s+i.len,!1);i.len=o.dataStream.length,i.body=o}if(i.t===q.RETAIN&&i.body!=null){const o=Mt(n,s,s+i.len,!0);i.oldBody={...o,dataStream:""},i.len=o.dataStream.length}r.push(i),i.t!==q.INSERT&&(s+=i.len)}return r}insert(t,n){const r={t:q.INSERT,body:n,len:t};return this.push(r),this}retain(t,n,r){const s={t:q.RETAIN,len:t};return n!=null&&(s.body=n),r!=null&&(s.coverType=r),this.push(s),this}delete(t){const n={t:q.DELETE,len:t};return this.push(n),this}empty(){return this._actions=[],this}serialize(){return this._actions}push(...t){if(t.length>1){for(const i of t)this.push(i);return this}let n=this._actions.length,r=this._actions[n-1];const s=Z.deepClone(t[0]);if(s.t===q.RETAIN&&s.len===0&&s.body==null)return this;if(typeof r=="object"){if(r.t===q.DELETE&&s.t===q.DELETE)return r.len+=s.len,this;if(r.t===q.DELETE&&s.t===q.INSERT&&(n-=1,r=this._actions[n-1],r==null))return this._actions.unshift(s),this;if(r.t===q.RETAIN&&s.t===q.RETAIN&&r.body==null&&s.body==null)return r.len+=s.len,this;if(r.t===q.INSERT&&Rl(r.body)&&s.t===q.INSERT&&Rl(s.body))return r.len+=s.len,r.body.dataStream+=s.body.dataStream,this}return n===this._actions.length?this._actions.push(s):this._actions.splice(n,0,s),this}trimEndUselessRetainAction(){let t=this._actions[this._actions.length-1];for(;t&&t.t===q.RETAIN&&IC(t);)this._actions.pop(),t=this._actions[this._actions.length-1];return this}};p(Wn,"id","text-x"),p(Wn,"uri","https://github.com/dream-num/univer#text-x");let De=Wn;Object.defineProperty(De,"name",{value:"text-x"});const Yn=class Yn{static registerSubtype(t){var n;t==null||this._subTypes.has(t.name)&&((n=this._subTypes.get(t.name))==null?void 0:n.id)!==De.id||(this._subTypes.set(t.name,t),at.type.registerSubtype(t))}static apply(t,n){if(!at.type.isNoop(n))return at.type.apply(t,n)}static compose(t,n){return at.type.compose(t,n)}static transform(t,n,r){return at.type.transform(t,n,r)}static transformPosition(t,n,r="right"){return t&&t.length===2&&t[0]==="body"&&t[1].et===De.name?De.transformPosition(t[1].e,n,r==="left"):n}static invertWithDoc(t,n){return at.type.invertWithDoc(t,n)}static isNoop(t){return at.type.isNoop(t)}static getInstance(){return this._instance==null&&(this._instance=new Yn),this._instance}removeOp(t,n){return at.removeOp(t,n)}moveOp(t,n){return at.moveOp(t,n)}insertOp(t,n){return at.insertOp(t,n)}replaceOp(t,n,r){return at.replaceOp(t,n,r)}editOp(t,n=["body"]){return at.editOp(n,De.name,t)}};p(Yn,"uri","https://github.com/dream-num/univer#json-x"),p(Yn,"_subTypes",new Map),p(Yn,"_instance",null);let Gt=Yn;Gt.registerSubtype(De);var Dh=(e=>(e.PARAGRAPH="PARAGRAPH",e.SECTION_BREAK="SECTION_BREAK",e.TABLE="TABLE",e.TABLE_ROW="TABLE_ROW",e.TABLE_CELL="TABLE_CELL",e.CUSTOM_BLOCK="CUSTOM_BLOCK",e))(Dh||{}),lt=(e=>(e.PARAGRAPH="\r",e.SECTION_BREAK=`
|
|
5
|
-
`,e.TABLE_START="",e.TABLE_ROW_START="\x1B",e.TABLE_CELL_START="",e.TABLE_CELL_END="",e.TABLE_ROW_END="",e.TABLE_END="",e.CUSTOM_RANGE_START="",e.CUSTOM_RANGE_END="",e.COLUMN_BREAK="\v",e.PAGE_BREAK="\f",e.DOCS_END="\0",e.TAB=" ",e.CUSTOM_BLOCK="\b",e.LETTER="",e.SPACE=" ",e))(lt||{});function
|
|
6
|
-
`)?e.slice(0,-2):e;return MC.reduce((n,r)=>n.replaceAll(r,""),t)},DC=e=>e?ti(e).replaceAll("\r","")==="":!0,LC=e=>{const t=e.replace(/\n/g,"\r"),n=[],r=[];let s=0,i="";const o=(l,c=!0)=>{const u=t.slice(s,l);if(Z.isLegalUrl(u)){const h=nt(),d=`${u}`,f={startIndex:s,endIndex:s+d.length-1,rangeId:h,rangeType:on.HYPERLINK,properties:{url:e}};r.push(f),i+=d,s=l+1,c&&(i+="\r",n.push({startIndex:l}))}else i+=t.slice(s,l+1),s=l+1,c&&n.push({startIndex:l})};let a=0;for(let l=0;l<t.length;l++)t[l]==="\r"&&(o(l),a=l);return(a!==t.length-1||t.length===1)&&o(t.length,!1),{dataStream:i,paragraphs:n,customRanges:r}},ca={id:"default_doc",documentStyle:{}};class xC extends zs{constructor(n){var r;super();p(this,"type",we.UNIVER_DOC);p(this,"_name$",new le.BehaviorSubject(""));p(this,"name$",this._name$.asObservable());p(this,"snapshot");this.snapshot={...ca,...n},this._name$.next((r=this.snapshot.title)!=null?r:"No Title")}getUnitId(){throw new Error("Method not implemented.")}getRev(){var n;return(n=this.snapshot.rev)!=null?n:1}incrementRev(){this.snapshot.rev=this.getRev()+1}setRev(n){this.snapshot.rev=n}setName(n){this.snapshot.title=n,this._name$.next(n)}get drawings(){return this.snapshot.drawings}get documentStyle(){return this.snapshot.documentStyle}get lists(){return this.snapshot.lists}get zoomRatio(){var n;return((n=this.snapshot.settings)==null?void 0:n.zoomRatio)||1}resetDrawing(n,r){this.snapshot.drawings=n,this.snapshot.drawingsOrder=r}getBody(){return this.snapshot.body}getSnapshot(){return this.snapshot}getBulletPresetList(){var s;const n=(s=this.snapshot.lists)!=null?s:{};return{...zr,...n}}updateDocumentId(n){this.snapshot.id=n}updateDocumentRenderConfig(n){const{documentStyle:r}=this.snapshot;r.renderConfig==null?r.renderConfig=n:r.renderConfig={...r.renderConfig,...n}}getDocumentStyle(){return this.snapshot.documentStyle}updateDocumentStyle(n){this.snapshot.documentStyle==null?this.snapshot.documentStyle=n:this.snapshot.documentStyle={...this.snapshot.documentStyle,...n}}updateDocumentDataMargin(n){const{t:r,l:s,b:i,r:o}=n,{documentStyle:a}=this.snapshot;r!=null&&(a.marginTop=r),s!=null&&(a.marginLeft=s),i!=null&&(a.marginBottom=i),o!=null&&(a.marginRight=o)}updateDocumentDataPageSize(n,r){const{documentStyle:s}=this.snapshot;if(!s.pageSize){s.pageSize={width:n!=null?n:Number.POSITIVE_INFINITY,height:r!=null?r:Number.POSITIVE_INFINITY};return}n!==void 0&&(s.pageSize.width=n),r!==void 0&&(s.pageSize.height=r)}updateDrawing(n,r){const{drawings:s}=this,{width:i,height:o,left:a,top:l}=r,c=s==null?void 0:s[n];if(!c)return;const u=c.docTransform;u.size.width=i,u.size.height=o,u.positionH.posOffset=a,u.positionV.posOffset=l}setZoomRatio(n=1){this.snapshot.settings?this.snapshot.settings.zoomRatio=n:this.snapshot.settings={zoomRatio:n}}setDisabled(n){this.snapshot.disabled=n}getDisabled(){return this.snapshot.disabled}getTitle(){return this.snapshot.title}}class Dt extends xC{constructor(n){var s,i;super(Z.isEmptyObject(n)?L_():n);p(this,"_unitId");p(this,"headerModelMap",new Map);p(this,"footerModelMap",new Map);p(this,"change$",new le.BehaviorSubject(0));const r=6;this._unitId=(s=this.snapshot.id)!=null?s:nt(r),this._initializeHeaderFooterModel(),this._name$.next((i=this.snapshot.title)!=null?i:"")}dispose(){super.dispose(),this.headerModelMap.forEach(n=>{n.dispose()}),this.footerModelMap.forEach(n=>{n.dispose()}),this._name$.complete()}getDrawings(){return this.snapshot.drawings}getDrawingsOrder(){return this.snapshot.drawingsOrder}getCustomRanges(){var n;return(n=this.snapshot.body)==null?void 0:n.customRanges}getCustomDecorations(){var n;return(n=this.snapshot.body)==null?void 0:n.customDecorations}getSettings(){return this.snapshot.settings}reset(n){if(n.id&&n.id!==this._unitId)throw new Error("Cannot reset a document model with a different unit id!");this.snapshot={...ca,...n},this._initializeHeaderFooterModel(),this.change$.next(this.change$.value+1)}getSelfOrHeaderFooterModel(n){if(n!=null){if(this.headerModelMap.has(n))return this.headerModelMap.get(n);if(this.footerModelMap.has(n))return this.footerModelMap.get(n)}return this}getUnitId(){return this._unitId}apply(n){if(!Gt.isNoop(n))return this.snapshot=Gt.apply(this.snapshot,n),n!=null&&n.some(r=>Array.isArray(r)&&((r==null?void 0:r[0])==="headers"||(r==null?void 0:r[0])==="footers"))&&(this.headerModelMap.clear(),this.footerModelMap.clear(),this._initializeHeaderFooterModel()),this.change$.next(this.change$.value+1),this.snapshot}sliceBody(n,r,s=la.copy){const i=this.getBody();if(i!=null)return Mt(i,n,r,!1,s)}_initializeHeaderFooterModel(){const{headers:n,footers:r}=this.getSnapshot();if(n)for(const s in n){const i=n[s];this.headerModelMap.set(s,new Dt(i)),this.headerModelMap.get(s).updateDocumentId(this.getUnitId())}if(r)for(const s in r){const i=r[s];this.footerModelMap.set(s,new Dt(i)),this.footerModelMap.get(s).updateDocumentId(this.getUnitId())}}updateDocumentId(n){super.updateDocumentId(n),this._unitId=n}getPlainText(){var n,r;return ti((r=(n=this.getBody())==null?void 0:n.dataStream)!=null?r:"")}}function UC(e){const{ranges:t,id:n,type:r}=e,s=new De;let i=0;for(let o=0;o<t.length;o++){const a=t[o],{startOffset:l,endOffset:c}=a;l>0&&s.push({t:q.RETAIN,len:l-i}),s.push({t:q.RETAIN,body:{dataStream:"",customDecorations:[{id:n,type:r,startIndex:0,endIndex:c-l-1}]},len:c-l}),i=c}return s}function PC(e){var u,h,d;const{id:t,segmentId:n,documentDataModel:r}=e,s=r==null?void 0:r.getBody();if(!r||!s)return!1;const i=(d=(h=(u=r.getSelfOrHeaderFooterModel(n))==null?void 0:u.getBody())==null?void 0:h.customDecorations)==null?void 0:d.find(f=>f.id===t);if(!i)return!1;const o=new De,{startIndex:a,endIndex:l}=i,c=l-a+1;return o.push({t:q.RETAIN,len:a}),o.push({t:q.RETAIN,len:c,body:{dataStream:"",customDecorations:[{startIndex:0,endIndex:c-1,id:t,type:En.DELETED}]}}),o}function Lh(e,t,n,r){return e<=n&&t>=n||e>=n&&e<=r}function kC(e,t){const n=[];for(let r=0,s=t.length;r<s;r++){const i=t[r];e.collapsed?i.startIndex<e.startOffset&&e.startOffset<=i.endIndex&&n.push(i):Lh(e.startOffset,e.endOffset-1,i.startIndex,i.endIndex)&&n.push(i)}return n}function FC(e){return{...Z.deepClone(e),rangeId:nt()}}function HC(e,t){const n=[];let r=e[0];for(const s of t)s<e[0]||s>e[1]||(r<s&&n.push([r,s-1]),r=s+1);return r<=e[1]&&n.push([r,e[1]]),n}function xh(e,t,n,r){const s=[];for(let i=0,o=n.length;i<o;i++){const a=n[i];if((r===void 0||a.rangeType===r)&&Math.max(a.startIndex,e)<=Math.min(a.endIndex,t)&&s.push({...a}),a.startIndex>t)break}return s}function BC(e,t){var i,o,a,l,c;const n=xh(e.startOffset,e.collapsed?e.startOffset:e.endOffset-1,(i=t.customRanges)!=null?i:[]),r=Math.min(e.startOffset,(a=(o=n[0])==null?void 0:o.startIndex)!=null?a:1/0),s=Math.max(e.endOffset,((c=(l=n[n.length-1])==null?void 0:l.endIndex)!=null?c:-1/0)+1);return{startOffset:r,endOffset:s,collapsed:r===s}}var yi,Il;function $C(){if(Il)return yi;Il=1;var e=-1,t=1,n=0;function r(m,x,O,N,y){if(m===x)return m?[[n,m]]:[];if(O!=null){var w=H(m,x,O);if(w)return w}var T=a(m,x),M=m.substring(0,T);m=m.substring(T),x=x.substring(T),T=c(m,x);var D=m.substring(m.length-T);m=m.substring(0,m.length-T),x=x.substring(0,x.length-T);var P=s(m,x);return M&&P.unshift([n,M]),D&&P.push([n,D]),F(P,y),N&&h(P),P}function s(m,x){var O;if(!m)return[[t,x]];if(!x)return[[e,m]];var N=m.length>x.length?m:x,y=m.length>x.length?x:m,w=N.indexOf(y);if(w!==-1)return O=[[t,N.substring(0,w)],[n,y],[t,N.substring(w+y.length)]],m.length>x.length&&(O[0][0]=O[2][0]=e),O;if(y.length===1)return[[e,m],[t,x]];var T=u(m,x);if(T){var M=T[0],D=T[1],P=T[2],J=T[3],z=T[4],oe=r(M,P),ce=r(D,J);return oe.concat([[n,z]],ce)}return i(m,x)}function i(m,x){for(var O=m.length,N=x.length,y=Math.ceil((O+N)/2),w=y,T=2*y,M=new Array(T),D=new Array(T),P=0;P<T;P++)M[P]=-1,D[P]=-1;M[w+1]=0,D[w+1]=0;for(var J=O-N,z=J%2!==0,oe=0,ce=0,I=0,L=0,Y=0;Y<y;Y++){for(var V=-Y+oe;V<=Y-ce;V+=2){var $=w+V,j;V===-Y||V!==Y&&M[$-1]<M[$+1]?j=M[$+1]:j=M[$-1]+1;for(var Q=j-V;j<O&&Q<N&&m.charAt(j)===x.charAt(Q);)j++,Q++;if(M[$]=j,j>O)ce+=2;else if(Q>N)oe+=2;else if(z){var ee=w+J-V;if(ee>=0&&ee<T&&D[ee]!==-1){var U=O-D[ee];if(j>=U)return o(m,x,j,Q)}}}for(var G=-Y+I;G<=Y-L;G+=2){var ee=w+G,U;G===-Y||G!==Y&&D[ee-1]<D[ee+1]?U=D[ee+1]:U=D[ee-1]+1;for(var X=U-G;U<O&&X<N&&m.charAt(O-U-1)===x.charAt(N-X-1);)U++,X++;if(D[ee]=U,U>O)L+=2;else if(X>N)I+=2;else if(!z){var $=w+J-G;if($>=0&&$<T&&M[$]!==-1){var j=M[$],Q=w+j-$;if(U=O-U,j>=U)return o(m,x,j,Q)}}}}return[[e,m],[t,x]]}function o(m,x,O,N){var y=m.substring(0,O),w=x.substring(0,N),T=m.substring(O),M=x.substring(N),D=r(y,w),P=r(T,M);return D.concat(P)}function a(m,x){if(!m||!x||m.charAt(0)!==x.charAt(0))return 0;for(var O=0,N=Math.min(m.length,x.length),y=N,w=0;O<y;)m.substring(w,y)==x.substring(w,y)?(O=y,w=O):N=y,y=Math.floor((N-O)/2+O);return k(m.charCodeAt(y-1))&&y--,y}function l(m,x){var O=m.length,N=x.length;if(O==0||N==0)return 0;O>N?m=m.substring(O-N):O<N&&(x=x.substring(0,O));var y=Math.min(O,N);if(m==x)return y;for(var w=0,T=1;;){var M=m.substring(y-T),D=x.indexOf(M);if(D==-1)return w;T+=D,(D==0||m.substring(y-T)==x.substring(0,T))&&(w=T,T++)}}function c(m,x){if(!m||!x||m.slice(-1)!==x.slice(-1))return 0;for(var O=0,N=Math.min(m.length,x.length),y=N,w=0;O<y;)m.substring(m.length-y,m.length-w)==x.substring(x.length-y,x.length-w)?(O=y,w=O):N=y,y=Math.floor((N-O)/2+O);return W(m.charCodeAt(m.length-y))&&y--,y}function u(m,x){var O=m.length>x.length?m:x,N=m.length>x.length?x:m;if(O.length<4||N.length*2<O.length)return null;function y(ce,I,L){for(var Y=ce.substring(L,L+Math.floor(ce.length/4)),V=-1,$="",j,Q,ee,U;(V=I.indexOf(Y,V+1))!==-1;){var G=a(ce.substring(L),I.substring(V)),X=c(ce.substring(0,L),I.substring(0,V));$.length<X+G&&($=I.substring(V-X,V)+I.substring(V,V+G),j=ce.substring(0,L-X),Q=ce.substring(L+G),ee=I.substring(0,V-X),U=I.substring(V+G))}return $.length*2>=ce.length?[j,Q,ee,U,$]:null}var w=y(O,N,Math.ceil(O.length/4)),T=y(O,N,Math.ceil(O.length/2)),M;if(!w&&!T)return null;T?w?M=w[4].length>T[4].length?w:T:M=T:M=w;var D,P,J,z;m.length>x.length?(D=M[0],P=M[1],J=M[2],z=M[3]):(J=M[0],z=M[1],D=M[2],P=M[3]);var oe=M[4];return[D,P,J,z,oe]}function h(m){for(var x=!1,O=[],N=0,y=null,w=0,T=0,M=0,D=0,P=0;w<m.length;)m[w][0]==n?(O[N++]=w,T=D,M=P,D=0,P=0,y=m[w][1]):(m[w][0]==t?D+=m[w][1].length:P+=m[w][1].length,y&&y.length<=Math.max(T,M)&&y.length<=Math.max(D,P)&&(m.splice(O[N-1],0,[e,y]),m[O[N-1]+1][0]=t,N--,N--,w=N>0?O[N-1]:-1,T=0,M=0,D=0,P=0,y=null,x=!0)),w++;for(x&&F(m),b(m),w=1;w<m.length;){if(m[w-1][0]==e&&m[w][0]==t){var J=m[w-1][1],z=m[w][1],oe=l(J,z),ce=l(z,J);oe>=ce?(oe>=J.length/2||oe>=z.length/2)&&(m.splice(w,0,[n,z.substring(0,oe)]),m[w-1][1]=J.substring(0,J.length-oe),m[w+1][1]=z.substring(oe),w++):(ce>=J.length/2||ce>=z.length/2)&&(m.splice(w,0,[n,J.substring(0,ce)]),m[w-1][0]=t,m[w-1][1]=z.substring(0,z.length-ce),m[w+1][0]=e,m[w+1][1]=J.substring(ce),w++),w++}w++}}var d=/[^a-zA-Z0-9]/,f=/\s/,g=/[\r\n]/,_=/\n\r?\n$/,R=/^\r?\n\r?\n/;function b(m){function x(ce,I){if(!ce||!I)return 6;var L=ce.charAt(ce.length-1),Y=I.charAt(0),V=L.match(d),$=Y.match(d),j=V&&L.match(f),Q=$&&Y.match(f),ee=j&&L.match(g),U=Q&&Y.match(g),G=ee&&ce.match(_),X=U&&I.match(R);return G||X?5:ee||U?4:V&&!j&&Q?3:j||Q?2:V||$?1:0}for(var O=1;O<m.length-1;){if(m[O-1][0]==n&&m[O+1][0]==n){var N=m[O-1][1],y=m[O][1],w=m[O+1][1],T=c(N,y);if(T){var M=y.substring(y.length-T);N=N.substring(0,N.length-T),y=M+y.substring(0,y.length-T),w=M+w}for(var D=N,P=y,J=w,z=x(N,y)+x(y,w);y.charAt(0)===w.charAt(0);){N+=y.charAt(0),y=y.substring(1)+w.charAt(0),w=w.substring(1);var oe=x(N,y)+x(y,w);oe>=z&&(z=oe,D=N,P=y,J=w)}m[O-1][1]!=D&&(D?m[O-1][1]=D:(m.splice(O-1,1),O--),m[O][1]=P,J?m[O+1][1]=J:(m.splice(O+1,1),O--))}O++}}function F(m,x){m.push([n,""]);for(var O=0,N=0,y=0,w="",T="",M;O<m.length;){if(O<m.length-1&&!m[O][1]){m.splice(O,1);continue}switch(m[O][0]){case t:y++,T+=m[O][1],O++;break;case e:N++,w+=m[O][1],O++;break;case n:var D=O-y-N-1;if(x){if(D>=0&&C(m[D][1])){var P=m[D][1].slice(-1);if(m[D][1]=m[D][1].slice(0,-1),w=P+w,T=P+T,!m[D][1]){m.splice(D,1),O--;var J=D-1;m[J]&&m[J][0]===t&&(y++,T=m[J][1]+T,J--),m[J]&&m[J][0]===e&&(N++,w=m[J][1]+w,J--),D=J}}if(S(m[O][1])){var P=m[O][1].charAt(0);m[O][1]=m[O][1].slice(1),w+=P,T+=P}}if(O<m.length-1&&!m[O][1]){m.splice(O,1);break}if(w.length>0||T.length>0){w.length>0&&T.length>0&&(M=a(T,w),M!==0&&(D>=0?m[D][1]+=T.substring(0,M):(m.splice(0,0,[n,T.substring(0,M)]),O++),T=T.substring(M),w=w.substring(M)),M=c(T,w),M!==0&&(m[O][1]=T.substring(T.length-M)+m[O][1],T=T.substring(0,T.length-M),w=w.substring(0,w.length-M)));var z=y+N;w.length===0&&T.length===0?(m.splice(O-z,z),O=O-z):w.length===0?(m.splice(O-z,z,[t,T]),O=O-z+1):T.length===0?(m.splice(O-z,z,[e,w]),O=O-z+1):(m.splice(O-z,z,[e,w],[t,T]),O=O-z+2)}O!==0&&m[O-1][0]===n?(m[O-1][1]+=m[O][1],m.splice(O,1)):O++,y=0,N=0,w="",T="";break}}m[m.length-1][1]===""&&m.pop();var oe=!1;for(O=1;O<m.length-1;)m[O-1][0]===n&&m[O+1][0]===n&&(m[O][1].substring(m[O][1].length-m[O-1][1].length)===m[O-1][1]?(m[O][1]=m[O-1][1]+m[O][1].substring(0,m[O][1].length-m[O-1][1].length),m[O+1][1]=m[O-1][1]+m[O+1][1],m.splice(O-1,1),oe=!0):m[O][1].substring(0,m[O+1][1].length)==m[O+1][1]&&(m[O-1][1]+=m[O+1][1],m[O][1]=m[O][1].substring(m[O+1][1].length)+m[O+1][1],m.splice(O+1,1),oe=!0)),O++;oe&&F(m,x)}function k(m){return m>=55296&&m<=56319}function W(m){return m>=56320&&m<=57343}function S(m){return W(m.charCodeAt(0))}function C(m){return k(m.charCodeAt(m.length-1))}function v(m){for(var x=[],O=0;O<m.length;O++)m[O][1].length>0&&x.push(m[O]);return x}function A(m,x,O,N){return C(m)||S(N)?null:v([[n,m],[e,x],[t,O],[n,N]])}function H(m,x,O){var N=typeof O=="number"?{index:O,length:0}:O.oldRange,y=typeof O=="number"?null:O.newRange,w=m.length,T=x.length;if(N.length===0&&(y===null||y.length===0)){var M=N.index,D=m.slice(0,M),P=m.slice(M),J=y?y.index:null;e:{var z=M+T-w;if(J!==null&&J!==z||z<0||z>T)break e;var oe=x.slice(0,z),ce=x.slice(z);if(ce!==P)break e;var I=Math.min(M,z),L=D.slice(0,I),Y=oe.slice(0,I);if(L!==Y)break e;var V=D.slice(I),$=oe.slice(I);return A(L,V,$,P)}e:{if(J!==null&&J!==M)break e;var j=M,oe=x.slice(0,j),ce=x.slice(j);if(oe!==D)break e;var Q=Math.min(w-j,T-j),ee=P.slice(P.length-Q),U=ce.slice(ce.length-Q);if(ee!==U)break e;var V=P.slice(0,P.length-Q),$=ce.slice(0,ce.length-Q);return A(D,V,$,ee)}}if(N.length>0&&y&&y.length===0)e:{var L=m.slice(0,N.index),ee=m.slice(N.index+N.length),I=L.length,Q=ee.length;if(T<I+Q)break e;var Y=x.slice(0,I),U=x.slice(T-Q);if(L!==Y||ee!==U)break e;var V=m.slice(I,w-Q),$=x.slice(I,T-Q);return A(L,V,$,ee)}return null}function B(m,x,O,N){return r(m,x,O,N,!0)}return B.INSERT=t,B.DELETE=e,B.EQUAL=n,yi=B,yi}var jC=$C();const ua=wt(jC);function WC(e){var h,d,f;const{rangeId:t,segmentId:n,documentDataModel:r,insert:s}=e,i=(d=(h=r.getSelfOrHeaderFooterModel(n).getBody())==null?void 0:h.customRanges)==null?void 0:d.find(g=>g.rangeId===t);if(!i)return!1;const{startIndex:o,endIndex:a}=i,l=new De,c=a-o+1;l.push({t:q.RETAIN,len:o}),l.push({t:q.RETAIN,len:c,body:{dataStream:"",customRanges:[]}}),s&&l.push({t:q.INSERT,body:s,len:s.dataStream.length});const u=a+1+((f=s==null?void 0:s.dataStream.length)!=null?f:0);return l.selections=[{startOffset:u,endOffset:u,collapsed:!0}],l}function YC(e){const{ranges:t,rangeId:n,rangeType:r,wholeEntity:s,properties:i,body:o}=e;let a=0;const l=new De;let c=!1;return t.forEach(u=>{var k,W,S;const h=BC(u,o);if(!h||!o)return!1;const{startOffset:d,endOffset:f}=h,g=(k=o.customRanges)!=null?k:[],_=(C,v,A)=>{var O,N,y,w;const H=xh(C,v,g,r),B=Math.min((N=(O=H[0])==null?void 0:O.startIndex)!=null?N:1/0,C),m=Math.max((w=(y=H[H.length-1])==null?void 0:y.endIndex)!=null?w:-1/0,v),x={rangeId:A?`${n}$${A}`:n,rangeType:r,startIndex:0,endIndex:m-B,wholeEntity:s,properties:{...i}};l.push({t:q.RETAIN,len:B-a}),l.push({t:q.RETAIN,len:m-B+1,body:{dataStream:"",customRanges:[x]},coverType:Ee.COVER}),a=m+1},R=((W=o.paragraphs)!=null?W:[]).filter(C=>C.startIndex<f&&C.startIndex>d),b=((S=o.customBlocks)!=null?S:[]).filter(C=>C.startIndex<f&&C.startIndex>d);HC([d,f-1],[...R.map(C=>C.startIndex),...b.map(C=>C.startIndex)]).forEach(([C,v],A)=>_(C,v,A)),c=!0,l.selections=[{startOffset:h.endOffset,endOffset:h.endOffset,collapsed:!0}]}),c?l:!1}function Uh(e,t,n=0,r=null,s=!0){e.sort((c,u)=>c.startOffset-u.startOffset);const i=[],{paragraphs:o=[]}=t,a=o==null?void 0:o.find(c=>c.startIndex>=e[0].startOffset&&c.startIndex<e[0].endOffset);let l=n;if(e.forEach(c=>{const{startOffset:u,endOffset:h}=c;u>l&&(i.push({t:q.RETAIN,len:u-l}),l=u),l<h&&(i.push({t:q.DELETE,len:h-l}),l=h)}),r&&i.push({t:q.INSERT,body:r,len:r.dataStream.length}),a&&s){const c=o.find(u=>u.startIndex-n>=e[e.length-1].endOffset-1);c&&(c.startIndex>l&&(i.push({t:q.RETAIN,len:c.startIndex-l}),l=c.startIndex),i.push({t:q.RETAIN,len:1,body:{dataStream:"",paragraphs:[{...c,startIndex:0,bullet:a==null?void 0:a.bullet}]},coverType:Ee.REPLACE}))}return i}function VC(e,t,n=0){const r=[];let s=n;return e.forEach(i=>{const{startOffset:o,endOffset:a}=i;o>s&&(r.push({t:q.RETAIN,len:o-s}),s=o),a>s&&(r.push({t:q.RETAIN,len:a-s,body:{...Z.deepClone(t),dataStream:""}}),s=a)}),r}const zC=e=>{var h;const{selection:t,body:n,doc:r}=e,s=t.segmentId,i=(h=r.getSelfOrHeaderFooterModel(s))==null?void 0:h.getBody();if(!i)return!1;const o=t.collapsed?null:Mt(i,t.startOffset,t.endOffset),a=ua(o?o.dataStream:"",n.dataStream);let l=0;const c=a.map(([d,f])=>{switch(d){case 0:{const g={t:q.RETAIN,body:{...Mt(n,l,l+f.length,!1),dataStream:""},len:f.length};return l+=f.length,g}case 1:{const g={t:q.INSERT,body:Mt(n,l,l+f.length),len:f.length};return l+=f.length,g}default:return{t:q.DELETE,len:f.length}}}),u=new De;return u.push({t:q.RETAIN,len:t.startOffset}),u.push(...c),u};function GC(e,t){return!!((e==null?void 0:e.length)===(t==null?void 0:t.length)&&(e!=null&&e.every((n,r)=>JSON.stringify(n)===JSON.stringify(t==null?void 0:t[r]))))}const KC=e=>{var d;const{selection:t,body:n,doc:r,themeService:s}=e,i=t.segmentId,o=(d=r.getSelfOrHeaderFooterModel(i))==null?void 0:d.getBody();if(!o)return!1;const a=t.collapsed?null:Mt(o,t.startOffset,t.endOffset),l=ua(a?a.dataStream:"",n.dataStream);let c=0;const u=l.map(([f,g])=>{switch(f){case 0:{const _=ks(n,c,c+g.length,!1),R=ks(a,c,c+g.length,!1),b={t:q.RETAIN,body:GC(_,R)?void 0:{textRuns:_==null?void 0:_.map(F=>{var k,W,S,C,v,A,H;return{...F,ts:{...F.ts,cl:(S=(W=(k=F.ts)==null?void 0:k.cl)==null?void 0:W.rgb)!=null&&S.includes(".")?{rgb:s.getColorFromTheme((A=(v=(C=F.ts)==null?void 0:C.cl)==null?void 0:v.rgb)!=null?A:"")}:(H=F.ts)==null?void 0:H.cl}}}),dataStream:""},len:g.length};return c+=g.length,b}case 1:{const _={t:q.INSERT,body:Mt(n,c,c+g.length),len:g.length};return c+=g.length,_}default:return{t:q.DELETE,len:g.length}}});if(u.every(f=>f.t===q.RETAIN&&!f.body))return!1;const h=new De;return h.push({t:q.RETAIN,len:t.startOffset}),h.push(...u),h};function XC(e,t){const n=[],{customBlocks:r=[]}=e;for(const s of t){const{startOffset:i,endOffset:o}=s;if(!(i==null||o==null))for(const a of r){const{startIndex:l}=a;l>=i&&l<o&&n.push(a.blockId)}}return n}function qC(e,t=""){if(!t)return["body"];const{headers:n,footers:r}=e.getSnapshot();if(n==null&&r==null)throw new Error("Document data model must have headers or footers when update by segment id");if((n==null?void 0:n[t])!=null)return["headers",t,"body"];if((r==null?void 0:r[t])!=null)return["footers",t,"body"];throw new Error("Segment id not found in headers or footers")}const JC=e=>{var _,R,b,F;const{selection:t,documentDataModel:n,drawings:r}=e,{collapsed:s,startOffset:i,segmentId:o}=t,a=new De,l=Gt.getInstance(),c=[],u=n.getSelfOrHeaderFooterModel(o).getBody();if(!u)return!1;const h=(R=(_=n.getSnapshot().drawingsOrder)==null?void 0:_.length)!=null?R:0;let d=0;if(s)i>0&&a.push({t:q.RETAIN,len:i});else{const k=Uh([t],u,0,null,!1);a.push(...k);const W=XC(u,[t]),S=(b=n.getDrawings())!=null?b:{},C=(F=n.getDrawingsOrder())!=null?F:[],v=W.sort((A,H)=>C.indexOf(A)>C.indexOf(H)?-1:C.indexOf(A)<C.indexOf(H)?1:0);if(v.length>0)for(const A of v){const H=S[A],B=C.indexOf(A);if(H==null||B<0)continue;const m=l.removeOp(["drawings",A],H),x=l.removeOp(["drawingsOrder",B],A);c.push(m),c.push(x),d++}}a.push({t:q.INSERT,body:{dataStream:"\b".repeat(r.length),customBlocks:r.map((k,W)=>({startIndex:W,blockId:k.drawingId}))},len:r.length});const f=qC(n,o),g=l.editOp(a.serialize(),f);c.push(g);for(const k of r){const{drawingId:W}=k,S=l.insertOp(["drawings",W],k),C=l.insertOp(["drawingsOrder",h-d],W);c.push(S),c.push(C)}return c.reduce((k,W)=>Gt.compose(k,W),null)};function ZC(e,t){if(typeof t>"u")return{startOffset:e,endOffset:e,collapsed:!0};if(t<e)throw new Error(`Cannot make a doc selection when endOffset ${t} is less than startOffset ${e}.`);return{startOffset:e,endOffset:t,collapsed:e===t}}function QC(e){const{startOffset:t,endOffset:n,collapsed:r}=e,s=Math.min(t,n),i=Math.max(t,n);return{startOffset:s,endOffset:i,collapsed:r}}function eR(e,t,n,r){return Math.max(e,n)<=Math.min(t,r)}function to(e,t,n,r){const{startOffset:s,endOffset:i}=e,o=r!=null?r:ha(t,n),a=[];let l=-1;for(let c=0;c<o.length;c++){const u=o[c],{startIndex:h}=u;(s>l&&s<=h||i>l&&i<=h||h>=s&&h<=i)&&a.push(u),l=h}return a}function no(e,t,n){const r=[],s=ha(t,n);for(const i of e){const o=to(i,t,n,s);r.push(...o)}return r}const tR=[lt.PARAGRAPH,lt.TABLE_START,lt.TABLE_END,lt.TABLE_ROW_START,lt.TABLE_CELL_START,lt.TABLE_CELL_END];function ha(e,t){const n=[];for(let r=0;r<e.length;r++){const s=e[r],{startIndex:i}=s;let o=i-1;for(;!tR.includes(t[o])&&o>=0;)o--;n.push({...s,paragraphStart:o+1,paragraphEnd:s.startIndex})}return n}const nR=e=>{var h,d,f;const{paragraphs:t,segmentId:n,document:r}=e;let s=e.listType;const i=(d=(h=r.getSelfOrHeaderFooterModel(n).getBody())==null?void 0:h.paragraphs)!=null?d:[],o=t.every(g=>{var _;return((_=g.bullet)==null?void 0:_.listType.indexOf(s))===0});let l=nt(6);if(t.length===1){const g=i.indexOf(t[0]),_=i[g-1],R=i[g+1];_&&_.bullet&&_.bullet.listType.indexOf(s)===0?(l=_.bullet.listId,s!==Ft.CHECK_LIST&&(s=_.bullet.listType)):R&&R.bullet&&R.bullet.listType.indexOf(s)===0&&(l=R.bullet.listId,s!==Ft.CHECK_LIST&&(s=R.bullet.listType))}const c=new vn;c.reset();const u=new De;for(const g of t){const{startIndex:_,paragraphStyle:R={},bullet:b}=g;u.push({t:q.RETAIN,len:_-c.cursor}),u.push({t:q.RETAIN,len:1,body:{dataStream:"",paragraphs:[o?{paragraphStyle:R,startIndex:0}:{startIndex:0,paragraphStyle:{...R},bullet:{nestingLevel:(f=b==null?void 0:b.nestingLevel)!=null?f:0,textStyle:{fs:20},listType:s,listId:l}}]},coverType:Ee.REPLACE}),c.moveCursorTo(_+1)}return u},rR=e=>{var h;const{paragraphIndex:t,segmentId:n,document:r}=e,s=(h=r.getSelfOrHeaderFooterModel(n).getBody())==null?void 0:h.paragraphs;if(s==null)return!1;const i=s.find(d=>d.startIndex===t);if(!(i!=null&&i.bullet)||i.bullet.listType.indexOf(Ft.CHECK_LIST)===-1)return!1;const o=new vn;o.reset();const a=new De,{startIndex:l,paragraphStyle:c={}}=i,u=i.bullet.listType===Ft.CHECK_LIST?Ft.CHECK_LIST_CHECKED:Ft.CHECK_LIST;return a.push({t:q.RETAIN,len:l-o.cursor}),a.push({t:q.RETAIN,len:1,body:{dataStream:"",paragraphs:[{...i,paragraphStyle:c,startIndex:0,bullet:{...i.bullet,listType:u}}]},coverType:Ee.REPLACE}),o.moveCursorTo(l+1),a},sR=e=>{var u,h;const{paragraphs:t,listType:n,segmentId:r,document:s}=e;if(((u=s.getSelfOrHeaderFooterModel(r).getBody())==null?void 0:u.paragraphs)==null)return!1;const a=nt(6),l=new vn;l.reset();const c=new De;for(const d of t){const{startIndex:f,paragraphStyle:g={},bullet:_}=d;c.push({t:q.RETAIN,len:f-l.cursor}),c.push({t:q.RETAIN,len:1,body:{dataStream:"",paragraphs:[{startIndex:0,paragraphStyle:g,bullet:{nestingLevel:(h=_==null?void 0:_.nestingLevel)!=null?h:0,textStyle:(_==null?void 0:_.listType)===n?_.textStyle:{fs:20},listType:n,listId:a}}]},coverType:Ee.REPLACE}),l.moveCursorTo(f+1)}return c};function iR(e,t){return t.some(n=>e.startIndex>n.startIndex&&e.startIndex<n.endIndex)}const oR=e=>{var c,u,h;const{paragraphs:t,document:n,type:r}=e,s=new vn;s.reset();const i=new De,o=(c=n.getSnapshot().lists)!=null?c:{},a=(h=(u=n.getBody())==null?void 0:u.tables)!=null?h:[],l={...zr,...o};for(const d of t){const{startIndex:f,paragraphStyle:g={},bullet:_}=d,R=iR(d,a);if(i.push({t:q.RETAIN,len:f-s.cursor}),_){const b=_.listType;let F=l[b].nestingLevel.length-1;R&&(F=Math.min(F,2)),i.push({t:q.RETAIN,len:1,body:{dataStream:"",paragraphs:[{startIndex:0,paragraphStyle:{...g},bullet:{..._,nestingLevel:Math.max(Math.min(_.nestingLevel+r,F),0)}}]},coverType:Ee.REPLACE})}else i.push({t:q.RETAIN,len:1});s.moveCursorTo(f+1)}return i},aR=e=>{var R,b,F,k;const{textRanges:t,segmentId:n,document:r,style:s,paragraphTextRun:i,cursor:o,deleteLen:a,textX:l}=e,c=r.getSelfOrHeaderFooterModel(n),u=(b=(R=c.getBody())==null?void 0:R.paragraphs)!=null?b:[],h=(k=(F=c.getBody())==null?void 0:F.dataStream)!=null?k:"",d=no(t,u,h),f=new vn;o&&f.moveCursorTo(o);const g=l!=null?l:new De;d.sort((W,S)=>W.startIndex-S.startIndex);const _=Math.max(0,d[0].paragraphStart-1);_>f.cursor&&(g.push({t:q.RETAIN,len:_-f.cursor}),f.moveCursorTo(_)),a&&g.push({t:q.DELETE,len:a});for(const W of d){const{startIndex:S,paragraphStyle:C={}}=W,v=S-f.cursor;g.push({t:q.RETAIN,len:v,...i?{body:{dataStream:"",textRuns:[{ts:i,st:0,ed:v}]},coverType:Ee.REPLACE}:null}),g.push({t:q.RETAIN,len:1,body:{dataStream:"",paragraphs:[{startIndex:0,paragraphStyle:{...C,...s}}]},coverType:Ee.REPLACE}),f.moveCursorTo(S+1)}return g};class et{}p(et,"customRange",{add:YC,delete:WC,copyCustomRange:FC,getCustomRangesInterestsWithSelection:kC,isIntersecting:Lh}),p(et,"customDecoration",{add:UC,delete:PC}),p(et,"selection",{replace:zC,makeSelection:ZC,normalizeSelection:QC,delete:Uh,replaceTextRuns:KC,retain:VC}),p(et,"range",{isIntersects:eR,getParagraphsInRange:to,getParagraphsInRanges:no}),p(et,"transform",{getPlainText:ti,fromPlainText:LC,isEmptyDocument:DC}),p(et,"paragraph",{bullet:{set:sR,switch:nR,toggleChecklist:rR,changeNestLevel:oR},style:{set:aR},util:{transform:ha,getParagraphsInRange:to,getParagraphsInRanges:no}}),p(et,"drawing",{add:JC});function lR(e,t,n,r){var c;if(t==="")return e;const s={id:"mock-id",body:e,documentStyle:{}},i=new Dt(s),o=t.length;let a;for(;(a=(r?i.getBody().dataStream:i.getBody().dataStream.toLowerCase()).indexOf(t))>=0;){const u=new De,h=Gt.getInstance();if(a>0&&u.retain(a),n.length>0){const d=i.sliceBody(a,a+o),f={dataStream:n};if(Array.isArray(d==null?void 0:d.textRuns)&&d.textRuns.length&&(f.textRuns=[{...d.textRuns[0],st:0,ed:n.length}]),(c=d==null?void 0:d.customRanges)!=null&&c.length){const g=d.customRanges[0];f.customRanges=[{...g,startIndex:0,endIndex:n.length-1}]}u.insert(n.length,f)}u.delete(o),i.apply(h.editOp(u.serialize()))}const l=i.getBody();return i.dispose(),l}function cR(e){if(e.customRanges||(e.customRanges=[]),!e.paragraphs){e.paragraphs=[];for(let t=0;t<e.dataStream.length;t++)e.dataStream[t]==="\r"&&e.paragraphs.push({startIndex:t})}return e.customBlocks||(e.customBlocks=[]),e.textRuns||(e.textRuns=[]),e.customDecorations||(e.customDecorations=[]),e.sectionBreaks||(e.sectionBreaks=[]),e.tables||(e.tables=[]),e}function Ph(e){var t;return e.body=cR((t=e.body)!=null?t:{dataStream:""}),e.drawingsOrder||(e.drawingsOrder=[]),e.drawings||(e.drawings={}),e.documentStyle||(e.documentStyle={}),e}class Gr{constructor(t={}){p(this,"_style");this._style=t}static create(t={}){return new Gr(t)}get fontFamily(){return this._style.ff}get fontSize(){return this._style.fs}get italic(){return this._style.it===ie.TRUE}get bold(){return this._style.bl===ie.TRUE}get underline(){return this._style.ul&&en.create(this._style.ul)}get bottomBorderLine(){return this._style.bbl&&en.create(this._style.bbl)}get strikethrough(){return this._style.st&&en.create(this._style.st)}get overline(){return this._style.ol&&en.create(this._style.ol)}get background(){return this._style.bg}get border(){return this._style.bd}get color(){return this._style.cl}get verticalAlign(){return this._style.va}get numberFormat(){return this._style.n}copy(){return sn.create(Z.deepClone(this._style))}getValue(){return{...this._style}}}class sn extends Gr{static create(t={}){return new sn(t)}constructor(t={}){super(t)}setFontFamily(t){return this._style.ff=t,this}setFontSize(t){return this._style.fs=t,this}setItalic(t){return this._style.it=t?1:0,this}setBold(t){return this._style.bl=t?1:0,this}setUnderline(t){return this._style.ul=t.build(),this}setBottomBorderLine(t){return this._style.bbl=t.build(),this}setStrikethrough(t){return this._style.st=t.build(),this}setOverline(t){return this._style.ol=t.build(),this}setBackground(t){return this._style.bg=t,this}setBorder(t){return this._style.bd=t,this}setColor(t){return this._style.cl=t,this}setVerticalAlign(t){return this._style.va=t,this}copy(){return sn.create(Z.deepClone(this._style))}build(){return this.getValue()}}class en{constructor(t={s:1}){p(this,"_decoration");this._decoration=t}static create(t={s:1}){return new en(t)}get show(){return this._decoration.s===ie.TRUE}get followFontColor(){return this._decoration.c===ie.TRUE}get color(){return this._decoration.cl}get type(){return this._decoration.t}setShow(t){return this._decoration.s=t?1:0,this}setFollowFontColor(t){return this._decoration.c=t?1:0,this}setColor(t){return this._decoration.cl=t,this}setLineType(t){return this._decoration.t=t,this}copy(){return en.create(Z.deepClone(this._decoration))}build(){return{...this._decoration}}}class Kr{constructor(t={}){p(this,"_style");this._style=t}static create(t={}){return new Kr(t)}get indentFirstLine(){return this._style.indentFirstLine}get hanging(){return this._style.hanging}get indentStart(){return this._style.indentStart}get tabStops(){return this._style.tabStops}get indentEnd(){return this._style.indentEnd}get textStyle(){return this._style.textStyle}get headingId(){return this._style.headingId}get namedStyleType(){return this._style.namedStyleType}get horizontalAlign(){return this._style.horizontalAlign}get lineSpacing(){return this._style.lineSpacing}get direction(){return this._style.direction}get spacingRule(){return this._style.spacingRule}get snapToGrid(){return this._style.snapToGrid}get spaceAbove(){return this._style.spaceAbove}get spaceBelow(){return this._style.spaceBelow}get borderBetween(){return this._style.borderBetween}get borderTop(){return this._style.borderTop}get borderBottom(){return this._style.borderBottom}get borderLeft(){return this._style.borderLeft}get borderRight(){return this._style.borderRight}get keepLines(){return this._style.keepLines===ie.TRUE}get keepNext(){return this._style.keepNext===ie.TRUE}get wordWrap(){return this._style.wordWrap===ie.TRUE}get widowControl(){return this._style.widowControl===ie.TRUE}get shading(){return this._style.shading}get suppressHyphenation(){return this._style.suppressHyphenation===ie.TRUE}copy(){return xr.create(Z.deepClone(this._style))}getValue(){return this._style}}class xr extends Kr{static create(t={}){return new xr(t)}constructor(t={}){super(t)}setIndentFirstLine(t){return this._style.indentFirstLine=t,this}setHanging(t){return this._style.hanging=t,this}setIndentStart(t){return this._style.indentStart=t,this}setTabStops(t){return this._style.tabStops=t,this}setIndentEnd(t){return this._style.indentEnd=t,this}setTextStyle(t){return this._style.textStyle=t,this}setHeadingId(t){return this._style.headingId=t,this}setNamedStyleType(t){return this._style.namedStyleType=t,this}setHorizontalAlign(t){return this._style.horizontalAlign=t,this}setLineSpacing(t){return this._style.lineSpacing=t,this}setDirection(t){return this._style.direction=t,this}setSpacingRule(t){return this._style.spacingRule=t,this}setSnapToGrid(t){return this._style.snapToGrid=t?1:0,this}setSpaceAbove(t){return this._style.spaceAbove=t,this}setSpaceBelow(t){return this._style.spaceBelow=t,this}setBorderBetween(t){return this._style.borderBetween=t,this}setBorderTop(t){return this._style.borderTop=t,this}setBorderBottom(t){return this._style.borderBottom=t,this}setBorderLeft(t){return this._style.borderLeft=t,this}setBorderRight(t){return this._style.borderRight=t,this}setKeepLines(t){return this._style.keepLines=t?1:0,this}setKeepNext(t){return this._style.keepNext=t?1:0,this}setWordWrap(t){return this._style.wordWrap=t?1:0,this}setWidowControl(t){return this._style.widowControl=t?1:0,this}setShading(t){return this._style.shading=t,this}setSuppressHyphenation(t){return this._style.suppressHyphenation=t?1:0,this}copy(){return xr.create(Z.deepClone(this._style))}build(){return this.getValue()}}class tn{constructor(t){p(this,"_data");if(!t.body)throw new Error("Invalid document data, body is required");this._data=Ph(t)}static create(t){return new tn(t)}static createByBody(t){return new tn({body:t,id:"d",documentStyle:{}})}copy(){return Cn.create(Z.deepClone(this._data))}slice(t,n){const{body:r,...s}=this._data;return Cn.create({...Z.deepClone(s),body:Mt(r,t,n)})}toPlainText(){var t,n;return et.transform.getPlainText((n=(t=this._data.body)==null?void 0:t.dataStream)!=null?n:"").replaceAll("\r",`
|
|
7
|
-
`)}getParagraphStyle(){var t,n;return Kr.create((n=(t=this._data.body)==null?void 0:t.paragraphs)==null?void 0:n[0].paragraphStyle)}getParagraphBullet(){var t,n;return(n=(t=this._data.body)==null?void 0:t.paragraphs)==null?void 0:n[0].bullet}getParagraphs(){var r,s;const t=(s=(r=this._data.body)==null?void 0:r.paragraphs)!=null?s:[];let n=0;return t.map(i=>{const o=this.slice(n,i.startIndex);return n=i.startIndex,o})}getTextRuns(){var t,n;return((n=(t=this._data.body)==null?void 0:t.textRuns)!=null?n:[]).map(r=>({...r,ts:r.ts?Gr.create(r.ts):null}))}getLinks(){var t,n,r;return(r=(n=(t=this._data.body)==null?void 0:t.customRanges)==null?void 0:n.filter(s=>s.rangeType===on.HYPERLINK))!=null?r:[]}getData(){return this._data}}class Cn extends tn{constructor(n){super(n);p(this,"_doc");this._doc=new Dt(n)}static newEmptyData(){return
|
|
8
|
-
`,customBlocks:[],customRanges:[],paragraphs:[{startIndex:0}],textRuns:[],tables:[],sectionBreaks:[]}})}static create(n){return new Cn(n!=null?n:Cn.newEmptyData())}insertText(n,r,s){var u,h;let i=((h=(u=this._data.body)==null?void 0:u.dataStream.length)!=null?h:2)-2,o,a;if(typeof n=="string"?o=n:(i=Math.min(n,i),o=r),typeof r=="object"?a=r instanceof sn?r.build():r:a=s instanceof sn?s.build():s,!o)return this;const l={dataStream:o,textRuns:a?[{ts:a,st:i,ed:i+o.length}]:[]},c=et.selection.replace({doc:this._doc,selection:{startOffset:i,endOffset:i,collapsed:!0},body:l});if(!c)throw new Error("Insert text failed, please check.");return De.apply(this._doc.getBody(),c.serialize()),this}insertRichText(n,r){var a,l;let s=((l=(a=this._data.body)==null?void 0:a.dataStream.length)!=null?l:2)-2,i;typeof n=="object"?i=n instanceof tn?n.getData():n:(s=Math.min(n,s),i=r instanceof tn?r.getData():r);const o=et.selection.replace({doc:this._doc,selection:{startOffset:s,endOffset:s,collapsed:!0},body:i.body});if(!o)throw new Error("Insert text failed, please check.");return De.apply(this._doc.getBody(),o.serialize()),this}delete(n,r){if(r!==void 0){if(!r)return this;const s=et.selection.delete([{startOffset:n,endOffset:n+r,collapsed:!0}],this._data.body);De.apply(this._doc.getBody(),s)}return this}setStyle(n,r,s){const i={dataStream:"",textRuns:[{ts:s instanceof sn?s.build():s,st:0,ed:r-n}]},o=et.selection.retain([{startOffset:n,endOffset:r,collapsed:!0}],i);return De.apply(this._doc.getBody(),o),this}setLink(n,r,s){const i=et.customRange.add({rangeType:on.HYPERLINK,rangeId:nt(),properties:{url:s},ranges:[{startOffset:n,endOffset:r,collapsed:!1}],body:this._data.body});if(!i)throw new Error("Insert text failed, please check.");return De.apply(this._doc.getBody(),i.serialize()),this}cancelLink(n,r){if(typeof n=="string"){const s=et.customRange.delete({rangeId:n,documentDataModel:this._doc});if(!s)throw new Error("Insert text failed, please check.");De.apply(this._doc.getBody(),s.serialize())}else this.slice(n,r).getLinks().forEach(i=>{const o=et.customRange.delete({rangeId:i.rangeId,documentDataModel:this._doc});if(!o)throw new Error("Insert text failed, please check.");De.apply(this._doc.getBody(),o.serialize())});return this}updateLink(n,r){var i,o;const s=(o=(i=this._data.body)==null?void 0:i.customRanges)==null?void 0:o.find(a=>a.rangeId===n);if(!s)throw new Error("Link not found");return s.properties.url=r,this}insertParagraph(n,r){var o,a;let s,i;return typeof n=="object"?(s={dataStream:"\r",paragraphs:[{startIndex:0,paragraphStyle:n.build()}]},i=((a=(o=this._data.body)==null?void 0:o.dataStream.length)!=null?a:2)-2):(i=n,s={dataStream:"\r",paragraphs:[{startIndex:0,paragraphStyle:r==null?void 0:r.build()}]}),this.insertRichText(i,tn.create({body:s,id:"d",documentStyle:{}})),this}insertLink(n,r,s){let i="",o="";typeof n=="string"?(i=n,o=r):(i=r,o=s);const a=Cn.createByBody({dataStream:i,customRanges:[{rangeType:on.HYPERLINK,rangeId:nt(),properties:{url:o},startIndex:0,endIndex:i.length-1}]});return typeof n=="number"?this.insertRichText(n,a):this.insertRichText(a)}}const uR="__default_document_sub_component_id20231101__";class kh{constructor(){p(this,"skipNextObservers",!1);p(this,"lastReturnValue");p(this,"isStopPropagation",!1)}stopPropagation(){this.isStopPropagation=!0}}class hR extends le.Subject{constructor(){super(...arguments);p(this,"_sortedObservers",[])}subscribe(){throw new Error("[EventSubject]: please use `subscribeEvent` instead of `subscribe` method for `EventSubject`.")}next(){throw new Error("[EventSubject]: please use `emitEvent` instead of `next` method for `EventSubject`.")}unsubscribe(){super.unsubscribe(),this._sortedObservers.length=0}complete(){super.complete(),this._sortedObservers.length=0}subscribeEvent(n){let r;typeof n=="function"?r={next:([i,o])=>n(i,o)}:r=n;const s=super.subscribe(r);return this._sortedObservers.push(r),this._sortedObservers.sort((i,o)=>{var a,l;return((a=i.priority)!=null?a:0)-((l=o.priority)!=null?l:0)}),s.add(()=>this._sortedObservers=this._sortedObservers.filter(i=>i!==r)),s}clearObservers(){this._sortedObservers.forEach(n=>{var r;return(r=n.complete)==null?void 0:r.call(n)}),this._sortedObservers.length=0}emitEvent(n){var r;if(!this.closed){const s=new kh;s.lastReturnValue=n;for(const i of this._sortedObservers){const o=(r=i.next)==null?void 0:r.call(i,[n,s]);if(s.lastReturnValue=o,s.skipNextObservers)return{handled:!0,lastReturnValue:s.lastReturnValue,stopPropagation:s.isStopPropagation}}return{handled:this._sortedObservers.length>0,lastReturnValue:s.lastReturnValue,stopPropagation:s.isStopPropagation}}throw new Error("[EventSubject]: cannot emit event on a closed subject.")}}function dR(e){return new le.Observable(t=>{const n=e.subscribeEvent(r=>{t.next(r)});return()=>n.unsubscribe()})}const ni=ye.createIdentifier("core.resource-manager.service"),ro={[Ie.Editor]:"Editor",[Ie.Owner]:"Owner",[Ie.Reader]:"Reader",[Ie.UNRECOGNIZED]:"UNRECOGNIZED"},Fs=e=>e?{userID:`${ro[e]}_${nt(8)}`,name:ro[e],avatar:""}:{userID:"",name:"",avatar:"",anonymous:!0,canBindAnonymous:!1},fR=(e,t)=>e.startsWith(ro[t]);class Ur extends Xe{constructor(){super(...arguments);p(this,"_model",new Map);p(this,"_userChange$",new le.Subject);p(this,"userChange$",this._userChange$.asObservable());p(this,"_currentUser$",new le.BehaviorSubject(Fs()));p(this,"currentUser$",this._currentUser$.asObservable())}dispose(){super.dispose(),this._model.clear(),this._userChange$.complete(),this._currentUser$.complete()}getCurrentUser(){return this._currentUser$.getValue()}setCurrentUser(n){this.addUser(n),this._currentUser$.next(n)}addUser(n){this._model.set(n.userID,n),this._userChange$.next({type:"add",user:n})}getUser(n,r){const s=this._model.get(n);if(s)return s;r&&r()}delete(n){const r=this.getUser(n);this._model.delete(n),r&&this._userChange$.next({type:"delete",user:r})}clear(){this._model.clear(),this._userChange$.next({type:"clear"})}list(){return Array.from(this._model.values())}}var mR=Object.getOwnPropertyDescriptor,gR=(e,t,n,r)=>{for(var s=r>1?void 0:r?mR(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},Sl=(e,t)=>(n,r)=>t(n,r,e);exports.AuthzIoLocalService=class{constructor(t,n){p(this,"_permissionMap",new Map([]));p(this,"_permissionOverrides",new Map);this._resourceManagerService=t,this._userManagerService=n,this._initSnapshot(),this._initDefaultUser()}_initDefaultUser(){const t=this._userManagerService.getCurrentUser();t&&t.userID||this._userManagerService.setCurrentUser(Fs(Ie.Owner))}_getRole(t){const n=this._userManagerService.getCurrentUser();return n?fR(n.userID,t):!1}_initSnapshot(){this._resourceManagerService.registerPluginResource({toJson:t=>{const n=[...this._permissionMap.keys()].reduce((r,s)=>{const i=this._permissionMap.get(s);return r[s]=i,r},{});return JSON.stringify(n)},parseJson:t=>JSON.parse(t),pluginName:"SHEET_AuthzIoMockService_PLUGIN",businesses:[we.UNIVER_SHEET,we.UNIVER_DOC,we.UNIVER_SLIDE],onLoad:(t,n)=>{for(const r in n)this._permissionMap.set(r,n[r])},onUnLoad:()=>{this._permissionMap.clear()}})}async create(t){const n=nt(8),{objectType:r,selectRangeObject:s,worksheetObject:i}=t,o=s||i,a={objectType:r,unitID:(o==null?void 0:o.unitID)||"",name:(o==null?void 0:o.name)||"",strategies:[{action:6,role:Ie.Owner},{action:16,role:Ie.Owner},{action:17,role:Ie.Owner},{action:18,role:Ie.Owner},{action:19,role:Ie.Owner},{action:33,role:Ie.Owner},{action:34,role:Ie.Owner},{action:35,role:Ie.Owner},{action:36,role:Ie.Owner},{action:37,role:Ie.Owner},{action:38,role:Ie.Owner},{action:39,role:Ie.Owner},{action:40,role:Ie.Owner}],selectRangeObject:s};return this._permissionMap.set(n,a),n}async allowed(t){const{objectID:n,actions:r}=t,s=this._permissionMap.get(n);return s?r.map(o=>{const a=`${n}:${o}`;if(this._permissionOverrides.has(a))return{action:o,allowed:this._permissionOverrides.get(a)};const l=s.strategies.find(c=>c.action===o);return l?{action:o,allowed:this._getRole(l.role)}:{action:o,allowed:this._getRole(Ie.Owner)||this._getRole(Ie.Editor)}}):r.map(a=>({action:a,allowed:this._getRole(Ie.Owner)||this._getRole(Ie.Editor)}))}async batchAllowed(t){const n=await Promise.all(t.map(s=>this.allowed(s)));return t.map((s,i)=>({unitID:s.unitID,objectID:s.objectID,actions:n[i]}))}async list(t){const n=[],r=[{action:6,role:Ie.Owner},{action:16,role:Ie.Owner},{action:17,role:Ie.Owner},{action:18,role:Ie.Owner},{action:19,role:Ie.Owner},{action:33,role:Ie.Owner},{action:34,role:Ie.Owner},{action:35,role:Ie.Owner},{action:36,role:Ie.Owner},{action:37,role:Ie.Owner},{action:38,role:Ie.Owner},{action:39,role:Ie.Owner},{action:40,role:Ie.Owner}];return t.objectIDs.forEach(s=>{const i=this._permissionMap.get(s),o=(i==null?void 0:i.strategies)||r,a={objectID:s,unitID:t.unitID,objectType:(i==null?void 0:i.objectType)||3,name:(i==null?void 0:i.name)||"",shareOn:!1,shareRole:Ie.Owner,shareScope:-1,scope:{read:Pi.AllCollaborator,edit:Pi.AllCollaborator},creator:Fs(Ie.Owner),strategies:o.map(l=>({action:l.action,role:l.role})),actions:t.actions.map(l=>{const c=`${s}:${l}`;if(this._permissionOverrides.has(c))return{action:l,allowed:this._permissionOverrides.get(c)};const u=o.find(h=>h.action===l);if(!u){const h=this._getRole(Ie.Owner)||this._getRole(Ie.Editor);return{action:l,allowed:h}}return{action:l,allowed:this._getRole(u.role)}})};n.push(a)}),n}async listCollaborators(){return[]}async listRoles(){return{roles:[],actions:[]}}async deleteCollaborator(){}async update(t){const{objectID:n,strategies:r}=t,s=this._permissionMap.get(n);s&&r&&(s.strategies=r.map(i=>({action:i.action,role:i.role})),this._permissionMap.set(n,s),r.forEach(i=>{i.role===Ie.Reader?this.setPermissionOverride(n,i.action,!1):(i.role===Ie.Owner||i.role===Ie.Editor)&&this.clearPermissionOverride(n,i.action)}))}setPermissionOverride(t,n,r){const s=`${t}:${n}`;this._permissionOverrides.set(s,r)}clearPermissionOverride(t,n){const r=`${t}:${n}`;this._permissionOverrides.delete(r)}clearAllOverrides(t){const n=[];this._permissionOverrides.forEach((r,s)=>{s.startsWith(`${t}:`)&&n.push(s)}),n.forEach(r=>this._permissionOverrides.delete(r))}async updateCollaborator(){}async createCollaborator(){}async putCollaborators(t){}};exports.AuthzIoLocalService=gR([Sl(0,ni),Sl(1,ye.Inject(Ur))],exports.AuthzIoLocalService);const Fh=ye.createIdentifier("IAuthzIoIoService"),_R=ye.createIdentifier("univer.confirm-service");class pR{constructor(){p(this,"confirmOptions$",new le.Subject)}dispose(){this.confirmOptions$.complete()}open(t){throw new Error("This is not implemented in the test service!")}confirm(t){return Promise.resolve(!0)}close(t){throw new Error("This is not implemented in the test service!")}}const Ir="FOCUSING_UNIT",jn="FOCUSING_SHEET",Sr="FOCUSING_DOC",Or="FOCUSING_SLIDE",ER="FOCUSING_EDITOR_BUT_HIDDEN",Hh="EDITOR_ACTIVATED",CR="FOCUSING_EDITOR_INPUT_FORMULA",Bh="FOCUSING_FX_BAR_EDITOR",RR="FOCUSING_UNIVER_EDITOR",IR="FOCUSING_EDITOR_INPUT_FORMULA",SR="FOCUSING_COMMENT_EDITOR",OR="FOCUSING_PANEL_EDITOR",wR="FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE",vR="FOCUSING_COMMON_DRAWINGS",bR="FORMULA_EDITOR_ACTIVATED";class $h extends Xe{constructor(){super(...arguments);p(this,"_error$",new le.Subject);p(this,"error$",this._error$.asObservable())}dispose(){this._error$.complete()}emit(n){this._error$.next({errorKey:n})}}var da=(e=>(e.URL="URL",e.UUID="UUID",e.BASE64="BASE64",e))(da||{}),jh=(e=>(e.SUCCUSS="0",e.ERROR_EXCEED_SIZE="1",e.ERROR_IMAGE_TYPE="2",e.ERROR_UPLOAD_COUNT_LIMIT="3",e.ERROR_IMAGE="4",e))(jh||{});const so=ye.createIdentifier("core.image-io.service"),yR="0.15.0",AR={version:yR};function TR(e="",t=Hr.ZH_CN,n=""){return{id:e,sheetOrder:[],name:n,appVersion:AR.version,locale:t,styles:{},sheets:{},resources:[]}}class Wh{constructor(t={}){p(this,"_styles");p(this,"_cacheMap",new Mr(1e5));this._styles=t,this._generateCacheMap()}each(t){return Object.entries(this._styles).forEach(t),this}search(t,n){if(this._cacheMap.has(n))return this._cacheMap.get(n);const r=this._getExistingStyleId(t);return r||"-1"}get(t){return typeof t!="string"?t:(t=String(t),this._styles[t])}add(t,n){const r=nt(6);return this._styles[r]=t,this._cacheMap.set(n,r),r}setValue(t){if(t==null)return;const n=JSON.stringify(t),r=this.search(t,n);return r!=="-1"?r:this.add(t,n)}addCustomStyle(t,n){n!=null&&(this._styles[t]=n,this._cacheMap.set(JSON.stringify(n),t))}remove(t){const n=this._styles[t];n&&(delete this._styles[t],this._cacheMap.delete(JSON.stringify(n)))}toJSON(){return this._styles}getStyleByCell(t){let n;t&&Z.isObject(t.s)?n=t.s:n=(t==null?void 0:t.s)&&this.get(t.s);const r=t==null?void 0:t.interceptorStyle;return r?{...n,...r}:n}_generateCacheMap(){const{_styles:t,_cacheMap:n}=this;for(const r in t){const s=JSON.stringify(t[r]);n.set(s,r)}}_getExistingStyleId(t){const{_styles:n}=this;for(const r in n)if(Z.diffValue(n[r],t))return r;return null}}const NR=(e,t)=>t.length===e.length&&!e.some(n=>t.some(r=>!zt.equals(r,n))),MR=(e,t)=>t.length===e.length&&e.every((n,r)=>{const s=t[r];return s.unitId===n.unitId&&s.sheetId===n.sheetId&&zt.equals(n.range,s.range)}),io={t:0,b:2,l:2,r:2},DR=e=>({sbr:.6,sbo:e,spr:.6,spo:e}),Ol=90;function wr(e,t,n={}){const r=e.length,{textRotation:s,paddingData:i,horizontalAlign:o=Nt.UNSPECIFIED,verticalAlign:a=pn.UNSPECIFIED,wrapStrategy:l=Sn.UNSPECIFIED,cellValueType:c}=n,{t:u,r:h,b:d,l:f}=i||io,{vertexAngle:g,centerAngle:_}=zh(s),R={id:"d",body:{dataStream:`${e}${Ul}`,textRuns:[{ts:t,st:0,ed:r}],paragraphs:[{startIndex:r,paragraphStyle:{horizontalAlign:o}}],sectionBreaks:[{startIndex:r+1}]},documentStyle:{pageSize:{width:Number.POSITIVE_INFINITY,height:Number.POSITIVE_INFINITY},marginTop:u,marginBottom:d,marginRight:h,marginLeft:f,renderConfig:{horizontalAlign:o,verticalAlign:a,centerAngle:_,vertexAngle:g,wrapStrategy:l,cellValueType:c}},drawings:{},drawingsOrder:[]};return new Dt(R)}function LR(e){if(!e)return{};const{tr:t,td:n,ht:r,vt:s,tb:i,pd:o}=e;return{textRotation:t,textDirection:n,horizontalAlign:r,verticalAlign:s,wrapStrategy:i,paddingData:o}}function wl(e){if(!e)return{};const{ff:t,fs:n,it:r,bl:s,ul:i,st:o,ol:a,cl:l,bg:c}=e,u={};return t&&(u.ff=t),n&&(u.fs=n),r&&(u.it=r),s&&(u.bl=s),i&&(u.ul=i),o&&(u.st=o),a&&(u.ol=a),l&&(u.cl=l),c&&(u.bg=c),u}function Yh(e,t,n){var i;const r=e.getBody();if((i=r.customRanges)!=null&&i.some(o=>o.rangeType===on.HYPERLINK))return;const s=et.customRange.add({ranges:[{startOffset:0,endOffset:r.dataStream.length-1,collapsed:!1}],rangeId:n,rangeType:on.HYPERLINK,body:r,properties:{url:t,refId:n}});s&&De.apply(r,s.serialize())}function Vh(e){return e!=null}function xR(){return{p:null,s:null,v:null,t:null,f:null,si:null,ref:null,xf:null}}const UR='"Helvetica Neue", Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "Heiti SC", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif';function vl(e){const t=it.ff,n=it.fs;if(!e){const h=`${n}pt ${t}`;return{fontCache:h,fontString:h,fontSize:n,originFontSize:n,fontFamily:t}}let r=Fn.ITALIC;(e.it===0||e.it===void 0)&&(r=Fn.NORMAL);let s=Fn.BOLD;(e.bl===0||e.bl===void 0)&&(s=Fn.NORMAL);let i=n;e.fs&&(i=Math.ceil(e.fs));let o=t;if(e.ff){let h=e.ff;h=h.replace(/"/g,"").replace(/'/g,""),h.indexOf(" ")>-1&&(h=`"${h}"`),h==null&&(h=t),o=h}const{va:a}=e;let l=i;if(a===Vt.SUBSCRIPT||a===Vt.SUPERSCRIPT){const h=PR(o,l),{sbr:d,spr:f}=h;l*=a===Vt.SUBSCRIPT?d:f}const c=`${r} ${s} ${l}pt ${o}`,u=`${c}, ${UR} `;return{fontCache:c,fontString:u,fontSize:l,originFontSize:i,fontFamily:o}}function PR(e,t){return DR(t)}function zh(e){const{a:t=0,v:n=ie.FALSE}=e||{a:0,v:ie.FALSE};let r=0,s=t;return n===ie.TRUE&&(r=Ol,s=Ol),{centerAngle:r,vertexAngle:s}}class kR{constructor(t,n){p(this,"_columnData",{});this._config=t,this._columnData=n}getColumnData(){return this._columnData}getColVisible(t){const{_columnData:n}=this,r=n[t];return r?r.hd!==ie.TRUE:!0}getColumnStyle(t){var n;return(n=this._columnData[t])==null?void 0:n.s}setColumnStyle(t,n){const r=this.getColumnOrCreate(t);r.s=n}getHiddenCols(t=0,n=this.getSize()-1){const r=[];let s=!1,i=-1;for(let o=t;o<=n;o++){const a=this.getColVisible(o);s&&a?(s=!1,r.push({rangeType:_e.COLUMN,startColumn:i,endColumn:o-1,startRow:0,endRow:0})):!s&&!a&&(s=!0,i=o)}return s&&r.push({startRow:0,endRow:0,startColumn:i,endColumn:n,rangeType:_e.COLUMN}),r}getVisibleCols(t=0,n=this.getSize()-1){const r=[];let s=!1,i=-1;for(let o=t;o<=n;o++){const a=this.getColVisible(o);s&&!a?(s=!1,r.push({rangeType:_e.COLUMN,startColumn:i,endColumn:o-1,startRow:0,endRow:0})):!s&&a&&(s=!0,i=o)}return s&&r.push({startRow:0,endRow:0,startColumn:i,endColumn:n,rangeType:_e.COLUMN}),r}getColumnDatas(t,n){const r={};let s=0;for(let i=t;i<t+n;i++){const o=this.getColumn(i);r[s]=o!=null?o:{w:this._config.defaultColumnWidth,hd:ie.FALSE},s++}return r}getSize(){return rn(this._columnData)}getColumnWidth(t){var n,r;return(r=(n=this._columnData[t])==null?void 0:n.w)!=null?r:this._config.defaultColumnWidth}setColumnWidth(t,n){const r=this._columnData[t];n===this._config.defaultColumnWidth?r&&(delete r.w,Object.keys(r).length===0&&delete this._columnData[t]):this._columnData[t]=r?{...r,w:n}:{w:n}}getColumn(t){return this._columnData[t]}removeColumn(t){delete this._columnData[t]}getColumnOrCreate(t){const{_columnData:n}=this,r=n[t];if(r)return r;const s={};return this._columnData[t]=s,s}setCustomMetadata(t,n){const r=this.getColumn(t);r&&(r.custom=n)}getCustomMetadata(t){var n;return(n=this.getColumn(t))==null?void 0:n.custom}}const FR=2e3;class HR{constructor(t,n,r){p(this,"_rowData");this._config=t,this._viewModel=n,this._rowData=r}getRowData(){return this._rowData}getRowStyle(t){var n;return(n=this._rowData[t])==null?void 0:n.s}setRowStyle(t,n){const r=this.getRowOrCreate(t);r.s=n}getRowDatas(t,n){const r={};let s=0;for(let i=t;i<t+n;i++){const o=this.getRow(i);r[s]=o!=null?o:{h:this._config.defaultRowHeight,hd:ie.FALSE},s++}return r}getRowHeight(t,n=1){const{_rowData:r}=this,s=this._config;let i=0;for(let o=0;o<n;o++){const a=r[o+t]||{hd:ie.FALSE,h:s.defaultRowHeight},{ia:l,ah:c,h:u=s.defaultRowHeight}=a;i+=(l==null||l===ie.TRUE)&&typeof c=="number"?c:u}return i}setRowHeight(t,n){const r=this._rowData[t];if(n===this._config.defaultRowHeight)r&&(delete r.h,Object.keys(r).length===0&&delete this._rowData[t]);else{const s=Math.min(n,FR);this._rowData[t]=r?{...r,h:s}:{h:s}}}getRow(t){return this._rowData[t]}removeRow(t){delete this._rowData[t]}getRowOrCreate(t){const{_rowData:n}=this,r=n[t];if(r)return r;const s={};return n[t]=s,s}getHiddenRows(t=0,n=this.getSize()-1){const r=[];let s=!1,i=-1;for(let o=t;o<=n;o++){const a=this.getRowRawVisible(o);s&&a?(s=!1,r.push({startRow:i,endRow:o-1,startColumn:0,endColumn:0,rangeType:_e.ROW})):!s&&!a&&(s=!0,i=o)}return s&&r.push({startRow:i,endRow:n,startColumn:0,endColumn:0,rangeType:_e.ROW}),r}getVisibleRows(t=0,n=this.getSize()-1){const r=[];let s=!1,i=-1;for(let o=t;o<=n;o++){const a=this.getRowRawVisible(o);s&&!a?(s=!1,r.push({startRow:i,endRow:o-1,startColumn:0,endColumn:0,rangeType:_e.ROW})):!s&&a&&(s=!0,i=o)}return s&&r.push({startRow:i,endRow:n,startColumn:0,endColumn:0,rangeType:_e.ROW}),r}getRowRawVisible(t){const n=this.getRow(t);return n?n.hd!==ie.TRUE:!0}getSize(){return rn(this._rowData)}setCustomMetadata(t,n){const r=this.getRow(t);r&&(r.custom=n)}getCustomMetadata(t){var n;return(n=this.getRow(t))==null?void 0:n.custom}}const BR="DEFAULT_WORKSHEET_ROW_COUNT",Gh=1e3,$R="DEFAULT_WORKSHEET_COLUMN_COUNT",Kh=20,jR="DEFAULT_WORKSHEET_ROW_HEIGHT",Xh=24,WR="DEFAULT_WORKSHEET_COLUMN_WIDTH",qh=88,YR="DEFAULT_WORKSHEET_ROW_TITLE_WIDTH",Jh=46,VR="DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT",Zh=20;function Qh(e){const t={name:"Sheet1",id:"sheet-01",tabColor:"",hidden:ie.FALSE,rowCount:Gh,columnCount:Kh,zoomRatio:1,freeze:{xSplit:0,ySplit:0,startRow:-1,startColumn:-1},scrollTop:0,scrollLeft:0,defaultColumnWidth:qh,defaultRowHeight:Xh,mergeData:[],cellData:{},rowData:{},columnData:{},showGridlines:ie.TRUE,rowHeader:{width:Jh,hidden:ie.FALSE},columnHeader:{height:Zh,hidden:ie.FALSE},rightToLeft:ie.FALSE};return Object.keys(t).forEach(n=>{const r=n;typeof e[r]>"u"&&(e[r]=t[r])}),e}class zR extends Xe{constructor(n){super();p(this,"_cellCache",new Map);p(this,"_rowCache",new Map);p(this,"_columnCache",new Map);p(this,"_hasRow",!1);p(this,"_hasColumn",!1);p(this,"_hasAll",!1);p(this,"_allIndex",-1);p(this,"_mergeData");p(this,"_rangeMap",new Mr(5e4));p(this,"_skeletonCache",new Mr(5e4));this._init(n.concat())}_init(n){this._mergeData=n,this._createCache(n)}_clearCache(){this._cellCache.clear(),this._rowCache.clear(),this._columnCache.clear(),this._hasAll=!1,this._allIndex=-1,this._rangeMap.clear(),this._skeletonCache.clear(),this._hasColumn=!1,this._hasRow=!1}_createCache(n){let r=0;for(const s of n){const{rangeType:i}=s;i===_e.ROW?this._createRowCache(s,r):i===_e.COLUMN?this._createColumnCache(s,r):i===_e.ALL?this._createCellAllCache(r):this._createCellCache(s,r),r++}}rebuild(n){this._clearCache(),this._init(n.concat())}_createRowCache(n,r){const{startRow:s,endRow:i}=n;for(let o=s;o<=i;o++)this._rowCache.set(o,r),this._hasRow=!0}_createColumnCache(n,r){const{startColumn:s,endColumn:i}=n;for(let o=s;o<=i;o++)this._columnCache.set(o,r),this._hasColumn=!0}_createCellAllCache(n){this._hasAll=!0,this._allIndex=n}_createCellCache(n,r){for(let s=n.startRow;s<=n.endRow;s++){let i=this._cellCache.get(s);i==null&&(i=new Map,this._cellCache.set(s,i));for(let o=n.startColumn;o<=n.endColumn;o++)i.set(o,r)}}add(n){this._mergeData.push(n),this._clearCache(),this._createCache(this._mergeData)}remove(n,r){const s=this._getMergeDataIndex(n,r);s!==-1&&(this._mergeData.splice(s,1),this._clearCache(),this._createCache(this._mergeData))}getMergedCell(n,r){const s=this._getMergeDataIndex(n,r);return s!==-1?this._mergeData[s]:null}getMergeDataIndex(n,r){return this._getMergeDataIndex(n,r)}isRowContainsMergedCell(n){return this._hasAll||!Z.isEmptyObject(this._columnCache)?!0:this._mergeData.some(r=>r.startRow<=n&&n<=r.endRow)}isColumnContainsMergedCell(n){return this._hasAll||!Z.isEmptyObject(this._rowCache)?!0:this._mergeData.some(r=>r.startColumn<=n&&n<=r.endColumn)}getMergedCellRange(n,r,s,i){const o=[],a=`${n}-${r}-${s}-${i}`;if(this._rangeMap.has(a))return this._getRangeFromCache(a);let l=0;const c=[];for(const u of this._mergeData||[])zt.intersects(u,{startRow:n,endRow:s,startColumn:r,endColumn:i})&&(o.push({...u}),c.push(l)),l++;return this._rangeMap.set(a,c),o}getMergedCellRangeForSkeleton(n,r,s,i){const o=[],a=this._mergeData,l=`${n}-${r}-${s}-${i}`;if(this._skeletonCache.has(l))return this._getSkeletonRangeFromCache(l);const c=[];for(let u=0;u<a.length;u++){const{startRow:h,endRow:d,startColumn:f,endColumn:g}=a[u];for(let _=n;_<=s;_++){let R=!1;for(let b=r;b<=i;b++)if(_>=h&&_<=d&&b>=f&&b<=g){o.push({startRow:h,endRow:d,startColumn:f,endColumn:g}),c.push(u),R=!0;break}if(R)break}}return this._skeletonCache.set(l,c),o}_getRangeFromCache(n){const r=this._rangeMap.get(n)||[],s=[];for(const i of r)s.push({...this._mergeData[i]});return s}_getSkeletonRangeFromCache(n){const r=this._skeletonCache.get(n)||[],s=[];for(const i of r)s.push({...this._mergeData[i]});return s}_getMergeDataIndex(n,r){var i;if(this._hasAll)return this._allIndex;if(this._hasRow){const o=this._rowCache.get(n);if(o!==void 0)return o}if(this._hasColumn){const o=this._columnCache.get(r);if(o!==void 0)return o}const s=(i=this._cellCache.get(n))==null?void 0:i.get(r);return s!==void 0?s:-1}getMergeDataSnapshot(){return this._mergeData}dispose(){this._clearCache(),this._mergeData=[]}}class ed extends Xe{constructor(n){super();p(this,"_cellContentInterceptor",null);p(this,"_rowFilteredInterceptor",null);this.getRawCell=n}dispose(){super.dispose(),this._cellContentInterceptor=null,this._rowFilteredInterceptor=null}getCell(n,r,s,i){return this._cellContentInterceptor?this._cellContentInterceptor.getCell(n,r,kn.Value|kn.Style,s,i):this.getRawCell(n,r)}getCellValueOnly(n,r){return this._cellContentInterceptor?this._cellContentInterceptor.getCell(n,r,kn.Value):this.getRawCell(n,r)}getCellStyleOnly(n,r){return this._cellContentInterceptor?this._cellContentInterceptor.getCell(n,r,kn.Style):this.getRawCell(n,r)}getRowFiltered(n){var r,s;return(s=(r=this._rowFilteredInterceptor)==null?void 0:r.getRowFiltered(n))!=null?s:!1}registerCellContentInterceptor(n){if(this._cellContentInterceptor)throw new Error("[SheetViewModel]: Interceptor already registered.");return this._cellContentInterceptor=n,We(()=>this._cellContentInterceptor=null)}registerRowFilteredInterceptor(n){if(this._rowFilteredInterceptor)throw new Error("[SheetViewModel]: Interceptor already registered.");return this._rowFilteredInterceptor=n,We(()=>this._rowFilteredInterceptor=null)}}function gt(e){if(e==null||typeof e!=="object")return e;if(Array.isArray(e)){const s=e.length,i=new Array(s);for(let o=0;o<s;o++)i[o]=gt(e[o]);return i}const n={},r=Object.keys(e);for(let s=0,i=r.length;s<i;s++){const o=r[s];n[o]=gt(e[o])}return n}function td(e){if(e==null)return e;const t={};return e.p!==void 0&&(t.p=e.p===null?null:gt(e.p)),e.s!==void 0&&(e.s===null||typeof e.s=="string"?t.s=e.s:t.s=gt(e.s)),e.v!==void 0&&(t.v=e.v),e.t!==void 0&&(t.t=e.t),e.f!==void 0&&(t.f=e.f),e.ref!==void 0&&(t.ref=e.ref),e.xf!==void 0&&(t.xf=e.xf),e.si!==void 0&&(t.si=e.si),e.custom!==void 0&&(t.custom=e.custom===null?null:gt(e.custom)),t}function GR(e){if(e==null)return e;const t={};return e.p!==void 0&&(t.p=e.p===null?null:gt(e.p)),e.s!==void 0&&(e.s===null||typeof e.s=="string"?t.s=e.s:t.s=gt(e.s)),e.v!==void 0&&(t.v=e.v),e.t!==void 0&&(t.t=e.t),e.f!==void 0&&(t.f=e.f),e.ref!==void 0&&(t.ref=e.ref),e.xf!==void 0&&(t.xf=e.xf),e.si!==void 0&&(t.si=e.si),e.custom!==void 0&&(t.custom=e.custom===null?null:gt(e.custom)),e.rowSpan!==void 0&&(t.rowSpan=e.rowSpan),e.colSpan!==void 0&&(t.colSpan=e.colSpan),e.displayV!==void 0&&(t.displayV=e.displayV),t}function nd(e){const t={},n=Object.keys(e);for(let r=0,s=n.length;r<s;r++){const i=n[r],o=Number(i),a=e[o];if(a===void 0)continue;const l={},c=Object.keys(a);for(let u=0,h=c.length;u<h;u++){const d=c[u],f=Number(d),g=a[f];g!=null&&(l[f]=td(g))}t[o]=l}return t}function bl(e){const t={},n=Object.keys(e);for(let r=0,s=n.length;r<s;r++){const i=n[r],o=Number(i),a=e[o];if(a===void 0)continue;const l={};"h"in a&&a.h!==void 0&&(l.h=a.h),"ia"in a&&a.ia!==void 0&&(l.ia=a.ia),"ah"in a&&a.ah!==void 0&&(l.ah=a.ah),"hd"in a&&a.hd!==void 0&&(l.hd=a.hd),"w"in a&&a.w!==void 0&&(l.w=a.w),"s"in a&&a.s!==void 0&&(a.s===null||typeof a.s=="string"?l.s=a.s:l.s=gt(a.s)),"custom"in a&&a.custom!==void 0&&(l.custom=a.custom===null?null:gt(a.custom)),t[o]=l}return t}function KR(e){const t=e.length,n=new Array(t);for(let r=0;r<t;r++){const s=e[r];n[r]={startRow:s.startRow,startColumn:s.startColumn,endRow:s.endRow,endColumn:s.endColumn,rangeType:s.rangeType,startAbsoluteRefType:s.startAbsoluteRefType,endAbsoluteRefType:s.endAbsoluteRefType}}return n}function rd(e){const t={id:e.id,name:e.name,tabColor:e.tabColor,hidden:e.hidden,rowCount:e.rowCount,columnCount:e.columnCount,zoomRatio:e.zoomRatio,scrollTop:e.scrollTop,scrollLeft:e.scrollLeft,defaultColumnWidth:e.defaultColumnWidth,defaultRowHeight:e.defaultRowHeight,showGridlines:e.showGridlines,rightToLeft:e.rightToLeft,freeze:{xSplit:e.freeze.xSplit,ySplit:e.freeze.ySplit,startRow:e.freeze.startRow,startColumn:e.freeze.startColumn},rowHeader:{width:e.rowHeader.width,hidden:e.rowHeader.hidden},columnHeader:{height:e.columnHeader.height,hidden:e.columnHeader.hidden},mergeData:KR(e.mergeData),cellData:nd(e.cellData),rowData:bl(e.rowData),columnData:bl(e.columnData)};return e.gridlinesColor!==void 0&&(t.gridlinesColor=e.gridlinesColor),e.defaultStyle!==void 0&&(e.defaultStyle===null||typeof e.defaultStyle=="string"?t.defaultStyle=e.defaultStyle:t.defaultStyle=gt(e.defaultStyle)),e.custom!==void 0&&(t.custom=e.custom===null?null:gt(e.custom)),t}const yl={isDeepClone:!1,displayRawFormula:!1,ignoreTextRotation:!1};class Pr{constructor(t,n,r){p(this,"_sheetId");p(this,"_snapshot");p(this,"_cellData");p(this,"_rowManager");p(this,"_columnManager");p(this,"_viewModel");p(this,"_spanModel");p(this,"_isRowStylePrecedeColumnStyle",!0);p(this,"_getCellHeight");var a;this.unitId=t,this._styles=r,this._snapshot=Qh(n);const{columnData:s,rowData:i,cellData:o}=this._snapshot;this._sheetId=(a=this._snapshot.id)!=null?a:nt(6),this._cellData=new ct(o),this._viewModel=new ed((l,c)=>this.getCellRaw(l,c)),this._rowManager=new HR(this._snapshot,this._viewModel,i),this._columnManager=new kR(this._snapshot,s),this._spanModel=new zR(this._snapshot.mergeData)}__interceptViewModel(t){t(this._viewModel)}__registerGetCellHeight(t){return this._getCellHeight=t,We(()=>{this._getCellHeight=null})}getSnapshot(){return this._snapshot}getCellHeight(t,n){return this._getCellHeight?this._getCellHeight(t,n):this._snapshot.defaultRowHeight}setMergeData(t){this._snapshot.mergeData=t,this.getSpanModel().rebuild(t)}getSpanModel(){return this._spanModel}setIsRowStylePrecedeColumnStyle(t){this._isRowStylePrecedeColumnStyle=t}getStyleDataByHash(t){return{...this._styles.get(t)}}setStyleData(t){return this._styles.setValue(t)}getColumnStyle(t,n=!1){return n?this._columnManager.getColumnStyle(t):this._styles.get(this._columnManager.getColumnStyle(t))}setColumnStyle(t,n){this._columnManager.setColumnStyle(t,n)}getRowStyle(t,n=!1){return n?this._rowManager.getRowStyle(t):this._styles.get(this._rowManager.getRowStyle(t))}setRowStyle(t,n){this._rowManager.setRowStyle(t,n)}getDefaultCellStyle(){return this._snapshot.defaultStyle}getDefaultCellStyleInternal(){const t=this._snapshot.defaultStyle;return this._styles.get(t)}setDefaultCellStyle(t){this._snapshot.defaultStyle=t}getCellStyle(t,n){const r=this.getCell(t,n);if(r){const s=r.s;return typeof s=="string"?this._styles.get(s):s}return null}getComposedCellStyle(t,n,r){const s=this.getDefaultCellStyleInternal(),i=this.getRowStyle(t),o=this.getColumnStyle(n),a=this.getCell(t,n),l=this._styles.getStyleByCell(a);return(r!=null?r:this._isRowStylePrecedeColumnStyle)?cr(s,o,i,a==null?void 0:a.themeStyle,l):cr(s,i,o,a==null?void 0:a.themeStyle,l)}getComposedCellStyleByCellData(t,n,r,s){const i=this.getDefaultCellStyleInternal(),o=this.getRowStyle(t),a=this.getColumnStyle(n),l=this._styles.getStyleByCell(r);return(s!=null?s:this._isRowStylePrecedeColumnStyle)?cr(i,a,o,r==null?void 0:r.themeStyle,l):cr(i,o,a,r==null?void 0:r.themeStyle,l)}getCellMatrix(){return this._cellData}getCellMatrixPrintRange(){const t=this.getCellMatrix(),n=this.getMergeData();let r=-1,s=-1,i=-1,o=-1,a=!1,l=!1;return t.forEach((c,u)=>{Object.keys(u).forEach(h=>{const d=+h,f=t.getValue(c,d),g=f!=null&&f.s?this._styles.get(f.s):null,_=(g==null?void 0:g.bd)&&(g.bd.b||g.bd.l||g.bd.r||g.bd.t||g.bd.bc_tr||g.bd.bl_tr||g.bd.ml_tr||g.bd.tl_bc||g.bd.tl_br||g.bd.tl_mr);(f&&(f.v!==null&&f.v!==void 0&&f.v!==""||f.p)||g!=null&&g.bg||_)&&(a?r=Math.min(r,c):(r=c,a=!0),s=Math.max(s,c),l?i=Math.min(i,d):(l=!0,i=d),o=Math.max(o,d))})}),n.forEach(c=>{a?r=Math.min(r,c.startRow):(r=c.startRow,a=!0),s=Math.max(s,c.endRow),l?i=Math.min(i,c.startColumn):(i=c.startColumn,a=!0),o=Math.max(o,c.endColumn)}),!a||!l?null:{startColumn:i,startRow:r,endColumn:o,endRow:s}}getRowManager(){return this._rowManager}getUnitId(){return this.unitId}getSheetId(){return this._sheetId}getColumnManager(){return this._columnManager}getName(){return this._snapshot.name}clone(){const{_snapshot:t}=this,n=rd(t);return new Pr(this.unitId,n,this._styles)}getMergeData(){return this._spanModel.getMergeDataSnapshot()}getMergedCell(t,n){return this._spanModel.getMergedCell(t,n)}getMergedCellRange(t,n,r,s){return this._spanModel.getMergedCellRange(t,n,r,s)}isRowContainsMergedCell(t){return this._spanModel.isRowContainsMergedCell(t)}isColumnContainsMergedCell(t){return this._spanModel.isColumnContainsMergedCell(t)}getCellInfoInMergeData(t,n){const r=this.getMergedCell(t,n);let s=!1,i=!1,o=t,a=n,l=t,c=n;if(r){const{startRow:u,endRow:h,startColumn:d,endColumn:f}=r;t===u&&n===d?(o=h,a=f,l=u,c=d,i=!0):t>=u&&t<=h&&n>=d&&n<=f&&(o=h,a=f,l=u,c=d,s=!0)}return{actualRow:t,actualColumn:n,isMergedMainCell:i,isMerged:s,endRow:o,endColumn:a,startRow:l,startColumn:c}}getCell(t,n){return t<0||n<0?null:this._viewModel.getCell(t,n)}getCellValueOnly(t,n){return t<0||n<0?null:this._viewModel.getCellValueOnly(t,n)}getCellStyleOnly(t,n){return t<0||n<0?null:this._viewModel.getCellStyleOnly(t,n)}getCellRaw(t,n){return this.getCellMatrix().getValue(t,n)}getCellWithFilteredInterceptors(t,n,r,s){return this._viewModel.getCell(t,n,r,s)}getRowFiltered(t){return this._viewModel.getRowFiltered(t)}getRangeFilterRows(t){const n=[];for(let r=t.startRow;r<=t.endRow;r++)this.getRowFiltered(r)&&n.push(r);return n}getMatrixWithMergedCells(t,n,r,s,i=Hn.Raw){const o=this.getCellMatrix(),a=this._spanModel.getMergedCellRange(t,n,r,s),l=new ct;return Ji(t,r,n,s).forEach((c,u)=>{var d;let h;if(i===Hn.Raw)h=this.getCellRaw(c,u);else if(i===Hn.Intercepted)h=this.getCell(c,u);else if(i===Hn.Both){const f=this.getCellRaw(c,u);if(f){h={...f};const g=(d=this.getCell(c,u))==null?void 0:d.v;Vh(g)&&h&&(h.displayV=String(g))}}h&&l.setValue(c,u,h)}),a.forEach(c=>{const{startColumn:u,startRow:h,endColumn:d,endRow:f}=c;Ji(h,f,u,d).forEach((g,_)=>{g===h&&_===u&&l.setValue(g,_,{...o.getValue(g,_),rowSpan:f-h+1,colSpan:d-u+1}),(g!==h||_!==u)&&l.realDeleteValue(g,_)})}),l}getRange(t,n,r,s){return typeof t=="object"?new Xn(this,t,{getStyles:()=>this._styles}):new Xn(this,{startRow:t,startColumn:n,endColumn:s||n,endRow:r||t},{getStyles:()=>this._styles})}getScrollLeftTopFromSnapshot(){return{scrollLeft:this._snapshot.scrollLeft,scrollTop:this._snapshot.scrollTop}}getZoomRatio(){return this._snapshot.zoomRatio||1}getConfig(){return this._snapshot}getFreeze(){return this._snapshot.freeze}getMaxColumns(){const{_snapshot:t}=this,{columnCount:n}=t;return n}getMaxRows(){const{_snapshot:t}=this,{rowCount:n}=t;return n}getRowCount(){return this._snapshot.rowCount}setRowCount(t){this._snapshot.rowCount=t}getColumnCount(){return this._snapshot.columnCount}setColumnCount(t){this._snapshot.columnCount=t}isSheetHidden(){return this._snapshot.hidden}hasHiddenGridlines(){const{_snapshot:t}=this,{showGridlines:n}=t;return n===0}getGridlinesColor(){return this.getConfig().gridlinesColor}getTabColor(){const{_snapshot:t}=this,{tabColor:n}=t;return n}getColumnWidth(t){return this.getColumnManager().getColumnWidth(t)}getRowHeight(t){return this._viewModel.getRowFiltered(t)?0:this.getRowManager().getRowHeight(t)}isRowFiltered(t){return this._viewModel.getRowFiltered(t)}getRowVisible(t){return!this.isRowFiltered(t)&&this.getRowRawVisible(t)}getRowRawVisible(t){return this.getRowManager().getRowRawVisible(t)}getHiddenRows(t,n){const r=this.getMaxColumns()-1,s=this._rowManager.getHiddenRows(t,n);return s.forEach(i=>i.endColumn=r),s}getColVisible(t){return this._columnManager.getColVisible(t)}getHiddenCols(t,n){const r=this.getMaxRows()-1,s=this._columnManager.getHiddenCols(t,n);return s.forEach(i=>i.endRow=r),s}getVisibleRows(){const t=this.getRowCount();return this._rowManager.getVisibleRows(0,t-1)}getVisibleCols(){const t=this.getColumnCount();return this._columnManager.getVisibleCols(0,t-1)}isRightToLeft(){const{_snapshot:t}=this,{rightToLeft:n}=t;return n}getLastRowWithContent(){return this._cellData.getRealRowRange().endRow}getLastColumnWithContent(){return this.getDataRealRange().endColumn}getDataRealRange(){return this._cellData.getRealRange()}getDataRangeScope(){return this._cellData.getStartEndScope()}cellHasValue(t){return t&&(t.v!==void 0||t.f!==void 0||t.p!==void 0)}iterateByRow(t,n=!0){const{startRow:r,startColumn:s,endRow:i,endColumn:o}=t,a=this;return{[Symbol.iterator]:()=>{let l=r,c=s;return{next(){for(;;){if(c>o&&(l+=1,c=s),l>i)return{done:!0,value:void 0};const u=a.getCell(l,c),h=!u,d=a.getMergedCell(l,c);if(d){if(l!==d.startRow||c!==d.startColumn){c=d.endColumn+1;continue}if(h&&n){c=d.endColumn+1;continue}const g={row:l,col:c,value:u};return g.colSpan=d.endColumn-d.startColumn+1,g.rowSpan=d.endRow-d.startRow+1,c=d.endColumn+1,{done:!1,value:g}}if(h&&n)c+=1;else{const f={row:l,col:c,value:u};return c+=1,{done:!1,value:f}}}}}}}}iterateByColumn(t,n=!0,r=!0){const{startRow:s,startColumn:i,endRow:o,endColumn:a}=t,l=this;return{[Symbol.iterator]:()=>{let c=s,u=i;return{next(){for(;;){if(c>o&&(u+=1,c=s),u>a)return{done:!0,value:void 0};const h=l.getMergedCell(c,u);if(h){const g=c!==h.startRow,_=g||u!==h.startColumn;if(r&&_||!r&&g){c=h.endRow+1;continue}const R=l.getCell(h.startRow,h.startColumn);if(!R&&n){c=h.endRow+1;continue}const F={row:c,col:h.startColumn,value:R};return F.colSpan=h.endColumn-h.startColumn+1,F.rowSpan=h.endRow-h.startRow+1,c=h.endRow+1,{done:!1,value:F}}const d=l.getCell(c,u);if(!d&&n)c+=1;else{const g={row:c,col:u,value:d};return c+=1,{done:!1,value:g}}}}}}}}getCellDocumentModel(t,n,r=yl){var _;if(!t)return;const{isDeepClone:s,displayRawFormula:i,ignoreTextRotation:o}={...yl,...r};let a,l="document";const c=LR(n),u=o?it.tr:c.textRotation||it.tr;let h=c.horizontalAlign||it.ht;const d=c.verticalAlign||it.vt,f=c.wrapStrategy||it.tb,g=c.paddingData||io;if(t.f&&i)a=wr(t.f.toString(),{},{verticalAlign:d}),h=it.ht;else if(t.p){const{centerAngle:R,vertexAngle:b}=zh(u);a=this._updateConfigAndGetDocumentModel(s?Z.deepClone(t.p):t.p,h,g,{horizontalAlign:h,verticalAlign:d,centerAngle:R,vertexAngle:b,wrapStrategy:f,zeroWidthParagraphBreak:1})}else if(t.v!=null){const R=wl(n);l=vl(R).fontCache;let b=sd(t);t.t===nn.FORCE_STRING&&i&&(b=`'${b}`),a=wr(b,R,{...c,textRotation:u,cellValueType:t.t})}return a&&t.linkUrl&&t.linkId&&Yh(a,t.linkUrl,t.linkId),{documentModel:a,fontString:l,textRotation:u,wrapStrategy:f,verticalAlign:d,horizontalAlign:h,paddingData:g,fill:(_=n==null?void 0:n.bg)==null?void 0:_.rgb}}_updateConfigAndGetDocumentModel(t,n,r,s){var o,a,l,c,u;if(!s||!((o=t.body)!=null&&o.dataStream))return;t.documentStyle||(t.documentStyle={}),t.documentStyle.marginTop=(a=r.t)!=null?a:0,t.documentStyle.marginBottom=(l=r.b)!=null?l:2,t.documentStyle.marginLeft=(c=r.l)!=null?c:2,t.documentStyle.marginRight=(u=r.r)!=null?u:2,t.documentStyle.pageSize={width:Number.POSITIVE_INFINITY,height:Number.POSITIVE_INFINITY},t.documentStyle.renderConfig={...t.documentStyle.renderConfig,...s};const i=t.body.paragraphs||[];for(const h of i)h.paragraphStyle||(h.paragraphStyle={}),h.paragraphStyle.horizontalAlign=n;return new Dt(t)}getBlankCellDocumentModel(t,n,r){const s=this.getComposedCellStyleByCellData(n,r,t),i=wl(s),o=this.getCellDocumentModel(t,s,{ignoreTextRotation:!0});if(o!=null)return o.documentModel==null&&(o.documentModel=wr("",i)),o;const a="";let l="document";const c=it.tr,u=it.ht,h=it.vt,d=it.tb,f=io;return l=vl({}).fontCache,{documentModel:wr(a,i),fontString:l,textRotation:c,wrapStrategy:d,verticalAlign:h,horizontalAlign:u,paddingData:f}}getCellDocumentModelWithFormula(t,n,r){const s=this.getComposedCellStyleByCellData(n,r,t);return this.getCellDocumentModel(t,s,{isDeepClone:!0,displayRawFormula:!0,ignoreTextRotation:!0})}getCustomMetadata(){return this._snapshot.custom}setCustomMetadata(t){this._snapshot.custom=t}}function sd(e){var r,s;if(!e)return"";const t=(s=(r=e.p)==null?void 0:r.body)==null?void 0:s.dataStream;if(t)return et.transform.getPlainText(t);const n=e.v;return typeof n=="string"?e.t===nn.BOOLEAN?n.toUpperCase():n.replace(/[\r\n]/g,""):typeof n=="number"?e.t===nn.BOOLEAN?n?"TRUE":"FALSE":n.toString():typeof n=="boolean"?n?"TRUE":"FALSE":""}function XR(e){if(e===null)return"";if(e!=null&&e.p){const t=e==null?void 0:e.p.body;if(t==null)return"";const n=t.dataStream;return et.transform.getPlainText(n)}return e==null?void 0:e.v}var qR=Object.getOwnPropertyDescriptor,JR=(e,t,n,r)=>{for(var s=r>1?void 0:r?qR(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},ZR=(e,t)=>(n,r)=>t(n,r,e);function QR(e,t){return`${e.getUnitId()}|${t.getSheetId()}`}exports.Workbook=class extends zs{constructor(n={},r){super();p(this,"type",we.UNIVER_SHEET);p(this,"_sheetCreated$",new le.Subject);p(this,"sheetCreated$",this._sheetCreated$.asObservable());p(this,"_sheetDisposed$",new le.Subject);p(this,"sheetDisposed$",this._sheetDisposed$.asObservable());p(this,"_activeSheet$",new le.BehaviorSubject(null));p(this,"activeSheet$",this._activeSheet$.asObservable());p(this,"_worksheets");p(this,"_styles");p(this,"_snapshot");p(this,"_unitId");p(this,"_count");p(this,"_name$");p(this,"name$");this._logService=r;const s=TR();Z.isEmptyObject(n)?this._snapshot=s:this._snapshot=Z.commonExtend(s,n);const{styles:i}=this._snapshot;(this._snapshot.id==null||this._snapshot.id.length===0)&&(this._snapshot.id=nt(6)),this._unitId=this._snapshot.id,this._styles=new Wh(i),this._count=1,this._worksheets=new Map,this._name$=new le.BehaviorSubject(n.name||""),this.name$=this._name$.asObservable(),this._parseWorksheetSnapshots()}get _activeSheet(){return this._activeSheet$.getValue()}get name(){return this._name$.getValue()}static isIRangeType(n){return typeof n=="string"||"startRow"in n||"row"in n}dispose(){super.dispose(),this._sheetCreated$.complete(),this._sheetDisposed$.complete(),this._activeSheet$.complete(),this._name$.complete(),Array.from(this._worksheets.keys()).forEach(r=>{this._removeSheet(r)})}save(){return Z.deepClone(this._snapshot)}getSnapshot(){return this._snapshot}getName(){return this._snapshot.name}setName(n){this._name$.next(n),this._snapshot.name=n}getUnitId(){return this._unitId}getRev(){var n;return(n=this._snapshot.rev)!=null?n:1}incrementRev(){this._snapshot.rev=this.getRev()+1}setRev(n){this._snapshot.rev=n}addWorksheet(n,r,s){const{sheets:i,sheetOrder:o}=this._snapshot;if(i[n])return!1;i[n]=s,o.splice(r,0,n),this.ensureSheetOrderUnique();const a=new Pr(this._unitId,s,this._styles);return this._worksheets.set(n,a),this._sheetCreated$.next(a),!0}getSheetOrders(){return this._snapshot.sheetOrder}ensureSheetOrderUnique(){const n=new Set,r=[];for(const s of this._snapshot.sheetOrder)n.has(s)||(n.add(s),r.push(s));this._snapshot.sheetOrder=r,n.clear()}getWorksheets(){return this._worksheets}getActiveSpreadsheet(){return this}getStyles(){return this._styles}addStyles(n){Object.entries(n).forEach(([r,s])=>{this._styles.addCustomStyle(r,s)})}removeStyles(n){n.forEach(r=>{this._styles.remove(r)})}getConfig(){return this._snapshot}getIndexBySheetId(n){const{sheetOrder:r}=this._snapshot;return r.findIndex(s=>s===n)}getActiveSheet(n){if(!this._activeSheet&&typeof n>"u")throw new Error(`[Workbook]: no active Worksheet on Workbook ${this._unitId}!`);return this._activeSheet}ensureActiveSheet(){const n=this._activeSheet;if(n)return n;const r=this._snapshot.sheetOrder;for(let i=0,o=r.length;i<o;i++){const a=this._worksheets.get(r[i]);if(a&&a.isSheetHidden()!==ie.TRUE)return this.setActiveSheet(a),a}const s=this._worksheets.get(r[0]);return this.setActiveSheet(s),s}setActiveSheet(n){this._activeSheet$.next(n)}_removeSheet(n){const r=this._worksheets.get(n);return r?(this._worksheets.delete(n),this._snapshot.sheetOrder.splice(this._snapshot.sheetOrder.indexOf(n),1),this.ensureSheetOrderUnique(),this._sheetDisposed$.next(r),!0):!1}removeSheet(n){const r=this._removeSheet(n);return r&&delete this._snapshot.sheets[n],r}getActiveSheetIndex(){const{sheetOrder:n}=this._snapshot;return n.findIndex(r=>this._worksheets.get(r)===this._activeSheet)}getSheetSize(){return this._snapshot.sheetOrder.length}getSheets(){const{sheetOrder:n}=this._snapshot;return n.map(r=>this._worksheets.get(r))}getSheetsName(){const{sheetOrder:n}=this._snapshot,r=[];return n.forEach(s=>{const i=this._worksheets.get(s);i&&r.push(i.getName())}),r}getSheetIndex(n){const{sheetOrder:r}=this._snapshot;return r.findIndex(s=>n.getSheetId()===s)}getSheetBySheetName(n){const{sheetOrder:r}=this._snapshot,s=r.find(i=>this._worksheets.get(i).getName()===n);return this._worksheets.get(s)}getSheetBySheetId(n){return this._worksheets.get(n)}getSheetByIndex(n){const{sheetOrder:r}=this._snapshot;return this._worksheets.get(r[n])}getHiddenWorksheets(){return this.getSheets().filter(n=>n.getConfig().hidden===ie.TRUE).map(n=>n.getConfig().id)}getUnhiddenWorksheets(){return this.getSheets().filter(n=>n.getConfig().hidden!==ie.TRUE).map(n=>n.getConfig().id)}load(n){this._snapshot=n}checkSheetName(n){return this.getSheetsName().some(s=>s.toLowerCase()===n.toLowerCase())}uniqueSheetName(n="Sheet1"){let r=n;for(;this.checkSheetName(r);)r=n+this._count,this._count++;return r}generateNewSheetName(n){let r=n+this._count;for(;this.checkSheetName(r);)r=n+this._count,this._count++;return r}_parseWorksheetSnapshots(){const{_snapshot:n,_worksheets:r}=this,{sheets:s,sheetOrder:i}=n;if(Z.isEmptyObject(s)){const o=nt();s[o]={id:o}}for(const o in s){const a=s[o],{name:l}=a;a.name=this.uniqueSheetName(l),a.name!==l&&this._logService.debug("[Workbook]",`The worksheet name ${l} is duplicated, we changed it to ${a.name}. Please fix the problem in your snapshot.`);const c=new Pr(this._unitId,a,this._styles);r.set(o,c),i.includes(o)||i.push(o)}this.ensureSheetOrderUnique(),this.ensureActiveSheet()}getCustomMetadata(){return this._snapshot.custom}setCustomMetadata(n){this._snapshot.custom=n}};exports.Workbook=JR([ZR(1,mt)],exports.Workbook);class fa extends zs{constructor(n){var r;super();p(this,"type",we.UNIVER_SLIDE);p(this,"_activePage$",new le.BehaviorSubject(null));p(this,"activePage$",this._activePage$.asObservable());p(this,"_name$");p(this,"name$");p(this,"_snapshot");p(this,"_unitId");this._snapshot={...ih,...n},this._unitId=(r=this._snapshot.id)!=null?r:nt(6),this._name$=new le.BehaviorSubject(this._snapshot.title),this.name$=this._name$.asObservable()}get _activePage(){var r,s;const n=this._activePage$.getValue();if(!n){const i=(r=this.getPageOrder())==null?void 0:r[0];return i?(s=this.getPages())==null?void 0:s[i]:null}return n}setName(n){var r;this._snapshot.title=n,this._name$.next(n),this._unitId=(r=this._snapshot.id)!=null?r:nt(6)}getRev(){return 0}incrementRev(){}setRev(n){}getSnapshot(){return this._snapshot}getUnitId(){return this._unitId}getPages(){var n;return(n=this._snapshot.body)==null?void 0:n.pages}getPageOrder(){var n;return(n=this._snapshot.body)==null?void 0:n.pageOrder}getPage(n){const r=this.getPages();return r==null?void 0:r[n]}getElementsByPage(n){var r;return(r=this.getPage(n))==null?void 0:r.pageElements}getElement(n,r){var s;return(s=this.getElementsByPage(n))==null?void 0:s[r]}getPageSize(){return this._snapshot.pageSize}getBlankPage(){const n=nt(6);return{id:n,pageType:wo.SLIDE,zIndex:10,title:n,description:"",pageBackgroundFill:{rgb:"rgb(255,255,255)"},pageElements:{}}}setActivePage(n){this._activePage$.next(n)}getActivePage(){return this._activePage}updatePage(n,r){this._snapshot.body&&(this._snapshot.body.pages[n]=r)}appendPage(n){var i;if(!this._snapshot.body)return;this._snapshot.body.pages[n.id]=n;const r=this._activePage,s=this._snapshot.body.pageOrder.indexOf((i=r==null?void 0:r.id)!=null?i:"");this._snapshot.body.pageOrder.splice(s+1,0,n.id)}}var eI=Object.getOwnPropertyDescriptor,tI=(e,t,n,r)=>{for(var s=r>1?void 0:r?eI(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},Ai=(e,t)=>(n,r)=>t(n,r,e);const qn=ye.createIdentifier("univer.current");exports.UniverInstanceService=class extends Xe{constructor(n,r,s){super();p(this,"_unitsByType",new Map);p(this,"_createHandler");p(this,"_ctorByType",new Map);p(this,"_currentUnits",new Map);p(this,"_currentUnits$",new le.BehaviorSubject(this._currentUnits));p(this,"currentUnits$",this._currentUnits$.asObservable());p(this,"_unitAdded$",new le.Subject);p(this,"unitAdded$",this._unitAdded$.asObservable());p(this,"_unitDisposed$",new le.Subject);p(this,"unitDisposed$",this._unitDisposed$.asObservable());p(this,"_focused$",new le.BehaviorSubject(null));p(this,"focused$",this._focused$.asObservable());this._injector=n,this._contextService=r,this._logService=s}dispose(){super.dispose(),this._focused$.complete(),this._currentUnits$.complete(),this._unitAdded$.complete(),this._currentUnits.forEach(n=>n==null?void 0:n.dispose()),this._currentUnits.clear(),this._unitsByType.clear()}__setCreateHandler(n){this._createHandler=n}createUnit(n,r,s){return this._createHandler(n,r,this._ctorByType.get(n),s)}registerCtorForType(n,r){return this._ctorByType.set(n,r),{dispose:()=>{this._ctorByType.delete(n)}}}getCurrentTypeOfUnit$(n){return this.currentUnits$.pipe(le.map(r=>{var s;return(s=r.get(n))!=null?s:null}),le.distinctUntilChanged())}getCurrentUnitForType(n){return this._currentUnits.get(n)}getCurrentUnitOfType(n){return this.getCurrentUnitForType(n)}setCurrentUnitForType(n){const r=this._getUnitById(n);if(!r)throw new Error(`[UniverInstanceService]: no document with unitId ${n}!`);this._currentUnits.set(r[1],r[0]),this._currentUnits$.next(this._currentUnits)}getTypeOfUnitAdded$(n){return this._unitAdded$.pipe(le.filter(r=>r.type===n))}__addUnit(n,r){var a;this._logService.debug(`[UniverInstanceService]: Adding unit with id ${n.getUnitId()}`);const s=n.type;this._unitsByType.has(s)||this._unitsByType.set(s,[]);const i=this._unitsByType.get(s),o=n.getUnitId();if(i.findIndex(l=>l.getUnitId()===o)!==-1)throw new Error(`[UniverInstanceService]: cannot create a unit with the same unit id: ${o}.`);i.push(n),this._unitAdded$.next(n),((a=r==null?void 0:r.makeCurrent)==null||a)&&this.setCurrentUnitForType(n.getUnitId())}getTypeOfUnitDisposed$(n){return this.unitDisposed$.pipe(le.filter(r=>r.type===n))}getUnit(n,r){var i;const s=(i=this._getUnitById(n))==null?void 0:i[0];return r&&(s==null?void 0:s.type)!==r?null:s}getCurrentUniverDocInstance(){return this.getCurrentUnitForType(we.UNIVER_DOC)}getUniverDocInstance(n){return this.getUnit(n,we.UNIVER_DOC)}getUniverSheetInstance(n){return this.getUnit(n,we.UNIVER_SHEET)}getAllUnitsForType(n){var r;return(r=this._unitsByType.get(n))!=null?r:[]}changeDoc(n,r){const s=this.getAllUnitsForType(we.UNIVER_DOC),i=s.find(o=>o.getUnitId()===n);if(i!=null){const o=s.indexOf(i);s.splice(o,1)}this.__addUnit(r)}get focused(){var r;const n=this._focused$.getValue();return n?(r=this._getUnitById(n))==null?void 0:r[0]:null}focusUnit(n){this._focused$.next(n),this.focused instanceof exports.Workbook?(this._contextService.setContextValue(Ir,!0),this._contextService.setContextValue(Sr,!1),this._contextService.setContextValue(jn,!0),this._contextService.setContextValue(Or,!1),this.setCurrentUnitForType(n)):this.focused instanceof Dt?(this._contextService.setContextValue(Ir,!0),this._contextService.setContextValue(Sr,!0),this._contextService.setContextValue(jn,!1),this._contextService.setContextValue(Or,!1),this.setCurrentUnitForType(n)):this.focused instanceof fa?(this._contextService.setContextValue(Ir,!0),this._contextService.setContextValue(Sr,!1),this._contextService.setContextValue(jn,!1),this._contextService.setContextValue(Or,!0),this.setCurrentUnitForType(n)):(this._contextService.setContextValue(Ir,!1),this._contextService.setContextValue(Sr,!1),this._contextService.setContextValue(jn,!1),this._contextService.setContextValue(Or,!1))}getFocusedUnit(){return this.focused}getUnitType(n){const r=this._getUnitById(n);return r?r[1]:we.UNRECOGNIZED}disposeUnit(n){this._logService.debug(`[UniverInstanceService]: Disposing unit with id ${n}`);const r=this._getUnitById(n);if(!r)return this._logService.debug(`[UniverInstanceService]: No unit found with id ${n}`),!1;const[s,i]=r,o=this._unitsByType.get(i),a=o.indexOf(s);return o.splice(a,1),this._tryResetCurrentOnRemoval(n,i),this._tryResetFocusOnRemoval(n),this._unitDisposed$.next(s),s.dispose(),!0}_tryResetCurrentOnRemoval(n,r){const s=this.getCurrentUnitForType(r);(s==null?void 0:s.getUnitId())===n&&(this._currentUnits.set(r,null),this._currentUnits$.next(this._currentUnits))}_tryResetFocusOnRemoval(n){var r;((r=this.focused)==null?void 0:r.getUnitId())===n&&this._focused$.next(null)}_getUnitById(n){for(const[r,s]of this._unitsByType){const i=s.find(o=>o.getUnitId()===n);if(i)return[i,r]}}};exports.UniverInstanceService=tI([Ai(0,ye.Inject(ye.Injector)),Ai(1,er),Ai(2,ye.Inject(mt))],exports.UniverInstanceService);var Pe=(e=>(e[e.Starting=0]="Starting",e[e.Ready=1]="Ready",e[e.Rendered=2]="Rendered",e[e.Steady=3]="Steady",e))(Pe||{});const id={0:"Starting",1:"Ready",2:"Rendered",3:"Steady"};var nI=Object.getOwnPropertyDescriptor,rI=(e,t,n,r)=>{for(var s=r>1?void 0:r?nI(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},sI=(e,t)=>(n,r)=>t(n,r,e);class od extends Error{constructor(t){super(`[LifecycleService]: lifecycle stage "${id[t]}" will never be reached!`),this.name="LifecycleUnreachableError"}}exports.LifecycleService=class extends Xe{constructor(n){super();p(this,"_lifecycle$",new le.BehaviorSubject(Pe.Starting));p(this,"lifecycle$",this._lifecycle$.asObservable());p(this,"_lock",!1);this._logService=n,this._reportProgress(Pe.Starting)}get stage(){return this._lifecycle$.getValue()}set stage(n){if(this._lock)throw new Error("[LifecycleService]: cannot set new stage when related logic is all handled!");if(n<this.stage)throw new Error("[LifecycleService]: lifecycle stage cannot go backward!");n!==this.stage&&(this._lock=!0,this._reportProgress(n),this._lifecycle$.next(n),this._lock=!1)}dispose(){this._lifecycle$.complete(),super.dispose()}onStage(n){return le.firstValueFrom(this.lifecycle$.pipe(le.filter(r=>r>=n),Fi(r=>r===n),le.map(()=>{}))).catch(r=>r.name==="EmptyError"?Promise.reject(new od(n)):Promise.reject(r))}subscribeWithPrevious(){return le.merge(ad(this.stage),this._lifecycle$.pipe(le.skip(1))).pipe(Fi(n=>n===Pe.Steady))}_reportProgress(n){this._logService.debug("[LifecycleService]",`lifecycle progressed to "${id[n]}".`)}};exports.LifecycleService=rI([sI(0,mt)],exports.LifecycleService);function ad(e){switch(e){case Pe.Starting:return le.of(Pe.Starting);case Pe.Ready:return le.of(Pe.Starting,Pe.Ready);case Pe.Rendered:return le.of(Pe.Starting,Pe.Ready,Pe.Rendered);default:return le.of(Pe.Starting,Pe.Ready,Pe.Rendered,Pe.Steady)}}const iI=ye.createIdentifier("ILocalStorageService");class Rn extends Xe{constructor(){super();p(this,"_currentLocale$",new le.BehaviorSubject(Hr.ZH_CN));p(this,"currentLocale$",this._currentLocale$.asObservable());p(this,"_locales",null);p(this,"localeChanged$",new le.Subject);p(this,"t",(n,...r)=>{if(!this._locales)throw new Error("[LocaleService]: Locale not initialized");const s=n.split("."),i=this.resolveKeyPath(this._locales[this._currentLocale],s);if(typeof i=="string"){let o=i;return r.forEach((a,l)=>{o=o.replace(`{${l}}`,a)}),o}else return n});this.disposeWithMe(We(()=>{this._locales=null,this._currentLocale$.complete(),this.localeChanged$.complete()}))}get _currentLocale(){return this._currentLocale$.value}load(n){var r;this._locales=Ys((r=this._locales)!=null?r:{},n)}setLocale(n){this._currentLocale$.next(n),this.localeChanged$.next()}getLocales(){var n;return(n=this._locales)==null?void 0:n[this._currentLocale]}getCurrentLocale(){return this._currentLocale}resolveKeyPath(n,r){const s=r.shift();if(s&&n&&s in n){const i=n[s];return r.length>0&&(typeof i=="object"||Array.isArray(i))?this.resolveKeyPath(i,r):i}return null}}var oI=Object.getOwnPropertyDescriptor,aI=(e,t,n,r)=>{for(var s=r>1?void 0:r?oI(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},lI=(e,t)=>(n,r)=>t(n,r,e);exports.MentionIOLocalService=class{constructor(t){this._userManagerService=t}async list(t){return{list:[{type:ys.PERSON,mentions:[{objectType:ys.PERSON,objectId:this._userManagerService.getCurrentUser().userID,label:this._userManagerService.getCurrentUser().name,metadata:{icon:this._userManagerService.getCurrentUser().avatar}}],metadata:{},title:"PEOPLE"}],page:t.page,size:t.size,total:1}}};exports.MentionIOLocalService=aI([lI(0,ye.Inject(Ur))],exports.MentionIOLocalService);const ld=ye.createIdentifier("univer.service.mention-io");var ma=(e=>(e.INIT="init",e.FETCHING="fetching",e.DONE="done",e))(ma||{});const cd=ye.createIdentifier("univer.permission-service");class ud extends Xe{constructor(){super(...arguments);p(this,"_permissionPointMap",new Map);p(this,"_permissionPointUpdate$",new le.Subject);p(this,"permissionPointUpdate$",this._permissionPointUpdate$.asObservable());p(this,"_showComponents",!0)}setShowComponents(n){this._showComponents=n}getShowComponents(){return this._showComponents}deletePermissionPoint(n){const r=this._permissionPointMap.get(n);r&&(r.complete(),this._permissionPointMap.delete(n))}addPermissionPoint(n){const r=n instanceof le.BehaviorSubject,s=r?n.getValue():n;return s.id?this._permissionPointMap.get(s.id)?(console.warn(`${s.id} PermissionPoint already exists`),!1):(this._permissionPointMap.set(s.id,r?n:new le.BehaviorSubject(s)),this._permissionPointUpdate$.next(s),!0):!1}updatePermissionPoint(n,r){const s=this._permissionPointMap.get(n);if(!s)return;const i=s.getValue();i.value=r,i.status=ma.DONE,s.next(i),this._permissionPointUpdate$.next(i)}clearPermissionMap(){this._permissionPointMap.clear()}getPermissionPoint(n){const r=this._permissionPointMap.get(n);if(r)return r.getValue()}getPermissionPoint$(n){const r=this._permissionPointMap.get(n);if(r)return r}composePermission$(n){const r=n.map(s=>{var o;const i=(o=this._permissionPointMap)==null?void 0:o.get(s);if(!i)throw new Error(`[PermissionService]: ${s} permissionPoint does not exist!`);return i.asObservable()});return le.combineLatest(r).pipe(us.map(s=>s))}composePermission(n){return n.map(s=>{var o;const i=(o=this._permissionPointMap)==null?void 0:o.get(s);if(!i)throw new Error(`[PermissionService]: ${s} permissionPoint does not exist!`);return i.getValue()})}getAllPermissionPoint(){const n=new Map;return this._permissionPointMap.forEach((r,s)=>{n.set(s,r)}),n}}function hd(e,t){if(!t)return e;const n=[];for(const r of e){const s=t.find(([i])=>i===r[0]);if(s){if(s[1]===null)continue;n.push([r[0],s[1]])}else n.push(r)}return n}var cI=Object.getOwnPropertyDescriptor,uI=(e,t,n,r)=>{for(var s=r>1?void 0:r?cI(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},Ti=(e,t)=>(n,r)=>t(n,r,e);const hI=4,dd=Symbol("DependentOn");class oo extends Xe{onStarting(){}onReady(){}onRendered(){}onSteady(){}getUnitType(){return this.constructor.type}getPluginName(){return this.constructor.pluginName}}p(oo,"pluginName"),p(oo,"type",we.UNIVER_UNKNOWN);class dI{constructor(){p(this,"_plugins",[])}addPlugin(t){this._plugins.push(t)}removePlugins(){const t=this._plugins.slice();return this._plugins.length=0,t}forEachPlugin(t){this._plugins.forEach(t)}}function fI(...e){return function(t){t[dd]=e}}exports.PluginService=class{constructor(t,n,r){p(this,"_pluginRegistry",new Map);p(this,"_pluginStore",new dI);p(this,"_seenPlugins",new Set);p(this,"_loadedPlugins",new Set);p(this,"_loadedPluginTypes",new Set([we.UNIVER_UNKNOWN]));p(this,"_flushTimerByType",new Map);this._injector=t,this._lifecycleService=n,this._logService=r}dispose(){this._pluginStore.removePlugins().forEach(t=>t.dispose()),this._flushTimerByType.forEach(t=>clearTimeout(t))}registerPlugin(t,n){this._assertPluginValid(t);const r={plugin:t,options:n};this._pluginRegistry.set(t.pluginName,r),this._logService.debug("[PluginService]",`Plugin "${t.pluginName}" registered.`);const{type:s}=t;this._loadedPluginTypes.has(s)&&(s===we.UNIVER_UNKNOWN?this._loadFromPlugins([r]):this._flushType(s))}startPluginsForType(t){this._loadedPluginTypes.has(t)||this._loadPluginsForType(t)}_loadPluginsForType(t){const n=Array.from(this._pluginRegistry.keys()),r=[];n.forEach(s=>{const i=this._pluginRegistry.get(s);i.plugin.type===t&&r.push(i)}),this._loadFromPlugins(r),this._loadedPluginTypes.add(t)}_assertPluginValid(t){const{type:n,pluginName:r}=t;if(n===we.UNRECOGNIZED)throw new Error(`[PluginService]: invalid plugin type for ${t.name}. Please assign a "type" to your plugin.`);if(!r)throw new Error(`[PluginService]: no plugin name for ${t.name}. Please assign a "pluginName" to your plugin.`);if(this._seenPlugins.has(r))throw new Error(`[PluginService]: duplicated plugin name for "${r}". Maybe a plugin that dependents on "${r} has already registered it. In that case please register "${r}" before the that plugin.`);this._seenPlugins.add(t.pluginName)}_flushType(t){this._flushTimerByType.get(t)===void 0&&this._flushTimerByType.set(t,setTimeout(()=>{this._loadPluginsForType(t),this._flushTimerByType.delete(t)},hI))}_loadFromPlugins(t){const n=[],r=new Set,s=o=>{const{plugin:a}=o,{pluginName:l}=a;if(this._loadedPlugins.has(l)||r.has(l))return;r.add(l),this._pluginRegistry.delete(l);const c=a[dd];c&&c.forEach(u=>{const h=this._pluginRegistry.get(u.pluginName);if(h)s(h);else if(!this._seenPlugins.has(u.pluginName)&&!r.has(u.pluginName)){if(a.type===we.UNIVER_UNKNOWN&&u.type!==we.UNIVER_UNKNOWN)throw new Error(`[PluginService]: cannot register a plugin with Univer type that depends on a plugin with other type. The dependent is ${a.pluginName} and the dependency is ${u.pluginName}.`);a.type!==u.type&&u.type!==we.UNIVER_UNKNOWN&&this._logService.debug("[PluginService]",`Plugin "${l}" depends on "${u.pluginName}" which has different type.`),this._logService.debug("[PluginService]",`Plugin "${l}" depends on "${u.pluginName}" which is not registered. Univer will automatically register it with default configuration.`),this._assertPluginValid(u),s({plugin:u,options:void 0})}}),n.push(o)};t.forEach(o=>s(o));const i=n.map(o=>this._initPlugin(o.plugin,o.options));this._pluginsRunLifecycle(i)}_pluginsRunLifecycle(t){const n=this._lifecycleService.stage;if(ad(n).subscribe(r=>this._runStage(t,r)),n!==Pe.Steady){const r=this._lifecycleService.lifecycle$.pipe(le.skip(1)).subscribe(s=>{this._runStage(t,s),s===Pe.Steady&&r.unsubscribe()})}}_runStage(t,n){t.forEach(r=>{switch(n){case Pe.Starting:r.onStarting();break;case Pe.Ready:r.onReady();break;case Pe.Rendered:r.onRendered();break;case Pe.Steady:r.onSteady();break}})}_initPlugin(t,n){const r=this._injector.createInstance(t,n);return this._pluginStore.addPlugin(r),this._loadedPlugins.add(t.pluginName),this._logService.debug("[PluginService]",`Plugin "${r.getPluginName()}" loaded.`),r}};exports.PluginService=uI([Ti(0,ye.Inject(ye.Injector)),Ti(1,ye.Inject(exports.LifecycleService)),Ti(2,mt)],exports.PluginService);const ao=ye.createIdentifier("resource-loader-service");var mI=Object.getOwnPropertyDescriptor,gI=(e,t,n,r)=>{for(var s=r>1?void 0:r?mI(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},_I=(e,t)=>(n,r)=>t(n,r,e);exports.ResourceManagerService=class extends Xe{constructor(n){super();p(this,"_resourceMap",new Map);p(this,"_register$",new le.Subject);p(this,"register$",this._register$.asObservable());this._logService=n}getAllResourceHooks(){return[...this._resourceMap.values()]}getResources(n,r){return r?this.getResourcesByType(n,r):this.getAllResourceHooks().map(o=>{const a=o.toJson(n);return{name:o.pluginName,data:a}})}getResourcesByType(n,r){return this.getAllResourceHooks().filter(o=>o.businesses.includes(r)).map(o=>{const a=o.toJson(n);return{name:o.pluginName,data:a}})}registerPluginResource(n){const r=n.pluginName;if(this._resourceMap.has(r))throw new Error(`the pluginName is registered {${r}}`);return this._resourceMap.set(r,n),this._register$.next(n),We(()=>this._resourceMap.delete(r))}disposePluginResource(n){this._resourceMap.delete(n)}loadResources(n,r){this.getAllResourceHooks().forEach(s=>{var o;const i=(o=r==null?void 0:r.find(a=>a.name===s.pluginName))==null?void 0:o.data;if(i)try{const a=s.parseJson(i);s.onLoad(n,a)}catch(a){this._logService.error("[ResourceManagerService]","loadResources error",a)}})}unloadResources(n,r){this.getAllResourceHooks().filter(s=>s.businesses.includes(r)).forEach(s=>{s.onUnLoad(n)})}dispose(){this._register$.complete(),this._resourceMap.clear()}};exports.ResourceManagerService=gI([_I(0,mt)],exports.ResourceManagerService);class Hs extends Xe{constructor(){super();p(this,"_darkMode$",new le.BehaviorSubject(!1));p(this,"darkMode$",this._darkMode$.asObservable());p(this,"_validColorCache",new Map);p(this,"_currentTheme",qr.defaultTheme);p(this,"_currentTheme$",new le.BehaviorSubject(this._currentTheme));p(this,"currentTheme$",this._currentTheme$.asObservable());this.disposeWithMe(We(()=>{this._currentTheme=qr.defaultTheme,this._currentTheme$.complete(),this._darkMode$.complete()}))}get darkMode(){return this._darkMode$.getValue()}isValidThemeColor(n){if(this._validColorCache.has(n))return this._validColorCache.get(n);let r=!1;const s=n.split(".");if(s.length===1)r=n in qr.defaultTheme;else if(s.length===2){const[i,o]=s;r=i in qr.defaultTheme&&o in this._currentTheme[i]}return this._validColorCache.set(n,r),r}getCurrentTheme(){return this._currentTheme}setTheme(n){this._currentTheme=n,this._currentTheme$.next(n)}setDarkMode(n){this._darkMode$.next(n)}getColorFromTheme(n){return ac(this._currentTheme,n)}}var pI=Object.getOwnPropertyDescriptor,EI=(e,t,n,r)=>{for(var s=r>1?void 0:r?pI(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},Ni=(e,t)=>(n,r)=>t(n,r,e);const ri=ye.createIdentifier("univer.undo-redo.service"),CI=20;class fd{dispose(){}async dispatchToHandlers(){return!1}}const md="univer.command.redo",gd="univer.command.undo",_d=new class extends fd{constructor(){super(...arguments);p(this,"type",jr.COMMAND);p(this,"id",gd)}handler(t){const n=t.get(ri),r=n.pitchTopUndoElement();if(!r)return!1;const s=t.get(Wr);return Ks(r.undoMutations,s)?(n.popUndoToRedo(),!0):!1}},pd=new class extends fd{constructor(){super(...arguments);p(this,"type",jr.COMMAND);p(this,"id",md)}handler(t){const n=t.get(ri),r=n.pitchTopRedoElement();if(!r)return!1;const s=t.get(Wr);return Ks(r.redoMutations,s)?(n.popRedoToUndo(),!0):!1}};exports.LocalUndoRedoService=class extends Xe{constructor(n,r,s){super();p(this,"undoRedoStatus$");p(this,"_undoRedoStatus$",new le.BehaviorSubject({undos:0,redos:0}));p(this,"_undoStacks",new Map);p(this,"_redoStacks",new Map);p(this,"_batchingStatus",new Map);this._univerInstanceService=n,this._commandService=r,this._contextService=s,this.undoRedoStatus$=this._undoRedoStatus$.asObservable(),this.disposeWithMe(this._commandService.registerCommand(_d)),this.disposeWithMe(this._commandService.registerCommand(pd)),this.disposeWithMe(We(()=>this._undoRedoStatus$.complete())),this.disposeWithMe(We(this._univerInstanceService.focused$.subscribe(()=>this._updateStatus())))}pushUndoRedo(n){const{unitID:r}=n,s=this._getRedoStack(r,!0),i=this._getUndoStack(r,!0);if(s.length=0,this._batchingStatus.has(n.unitID)){const a=this._batchingStatus.get(n.unitID),l=this._pitchUndoElement(n.unitID);a===0||!l?(o(n),this._batchingStatus.set(n.unitID,1)):this._tryBatchingElements(l,n)}else o(n);function o(a){i.push(a),i.length>CI&&i.splice(0,1)}this._updateStatus()}clearUndoRedo(n){const r=this._getRedoStack(n);r&&(r.length=0);const s=this._getUndoStack(n);s&&(s.length=0),this._updateStatus()}pitchTopUndoElement(){const n=this._getFocusedUnitId();return this._pitchUndoElement(n)}pitchTopRedoElement(){const n=this._getFocusedUnitId();return this._pitchRedoElement(n)}_pitchUndoElement(n){const r=this._getUndoStack(n);return r!=null&&r.length?r[r.length-1]:null}_pitchRedoElement(n){const r=this._getRedoStack(n);return r!=null&&r.length?r[r.length-1]:null}popUndoToRedo(){const r=this._getUndoStackForFocused().pop();r&&(r.redoMutations.length>0&&this._getRedoStackForFocused().push(r),this._updateStatus())}popRedoToUndo(){const r=this._getRedoStackForFocused().pop();r&&(this._getUndoStackForFocused().push(r),this._updateStatus())}rollback(n,r){const s=r||this._getFocusedUnitId(),i=this._getUndoStack(s),o=i==null?void 0:i[(i==null?void 0:i.length)-1];o&&o.id===n&&(i.pop(),Ks(o.undoMutations,this._commandService))}__tempBatchingUndoRedo(n){if(this._batchingStatus.has(n))throw new Error("[LocalUndoRedoService]: cannot batching undo redo twice at the same time!");return this._batchingStatus.set(n,0),We(()=>this._batchingStatus.delete(n))}_updateStatus(){var i,o;const n=this._getFocusedUnitId(),r=n&&((i=this._undoStacks.get(n))==null?void 0:i.length)||0,s=n&&((o=this._redoStacks.get(n))==null?void 0:o.length)||0;this._undoRedoStatus$.next({undos:r,redos:s})}_getUndoStack(n,r=!1){let s=this._undoStacks.get(n);return!s&&r&&(s=[],this._undoStacks.set(n,s)),s||null}_getRedoStack(n,r=!1){let s=this._redoStacks.get(n);return!s&&r&&(s=[],this._redoStacks.set(n,s)),s||null}_getUndoStackForFocused(){const n=this._getFocusedUnitId();if(!n)throw new Error("No focused univer instance!");return this._getUndoStack(n,!0)}_getRedoStackForFocused(){const n=this._getFocusedUnitId();if(!n)throw new Error("No focused univer instance!");return this._getRedoStack(n,!0)}_tryBatchingElements(n,r){n.redoMutations.push(...r.redoMutations),n.undoMutations.push(...r.undoMutations)}_getFocusedUnitId(){var o,a,l,c;let n="";const r=this._contextService.getContextValue(jn),s=this._contextService.getContextValue(Bh),i=this._contextService.getContextValue(Hh);return r?s?n=ho:i?n=uo:n=(a=(o=this._univerInstanceService.getFocusedUnit())==null?void 0:o.getUnitId())!=null?a:"":n=(c=(l=this._univerInstanceService.getFocusedUnit())==null?void 0:l.getUnitId())!=null?c:"",n}};exports.LocalUndoRedoService=EI([Ni(0,qn),Ni(1,Wr),Ni(2,er)],exports.LocalUndoRedoService);class Ed{constructor(t,n=100){p(this,"_imageCacheMap");this._injector=t,this._imageCacheMap=new Mr(n)}_getImageCacheKey(t,n){return`${t}-${n}`}getImage(t,n,r,s){const i=this._getImageCacheKey(t,n),o=this._imageCacheMap.get(i);return o||((async()=>{const a=new Image,l=this._injector.has(so)?this._injector.get(so):null;if(t===da.UUID)try{a.src=await(l==null?void 0:l.getImage(n))||""}catch(c){console.error(c)}else a.src=n;a.onload=()=>{a.removeAttribute("data-error"),r==null||r()},a.onerror=()=>{a.setAttribute("data-error","true"),s==null||s()},this._imageCacheMap.set(i,a)})(),null)}}function RI(e){return!(e.length===0||e.length>31||e.startsWith("'")||e.endsWith("'")||/[:\\\/\?\*\[\]]/.test(e))}function II(e,t){return!(!e||e.length===0||e.length>255||t.has(e)||/[ :\\\/\?\*\[\]]/.test(e)||!/^[\p{L}_]/u.test(e)||/^\$?[A-Za-z]{1,3}\$?[0-9]+$/.test(e)||/^[rR]\d+[cC]\d+$/.test(e)||/^\d+$/.test(e))}const Al=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],Mi=1,ar=8;class ga{static from(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[n,r]=new Uint8Array(t,0,2);if(n!==219)throw new Error("Data does not appear to be in a KDBush format.");const s=r>>4;if(s!==Mi)throw new Error(`Got v${s} data when expected v${Mi}.`);const i=Al[r&15];if(!i)throw new Error("Unrecognized array type.");const[o]=new Uint16Array(t,2,1),[a]=new Uint32Array(t,4,1);return new ga(a,o,i,t)}constructor(t,n=64,r=Float64Array,s){if(isNaN(t)||t<0)throw new Error(`Unpexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+n,2),65535),this.ArrayType=r,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;const i=Al.indexOf(this.ArrayType),o=t*2*this.ArrayType.BYTES_PER_ELEMENT,a=t*this.IndexArrayType.BYTES_PER_ELEMENT,l=(8-a%8)%8;if(i<0)throw new Error(`Unexpected typed array class: ${r}.`);s&&s instanceof ArrayBuffer?(this.data=s,this.ids=new this.IndexArrayType(this.data,ar,t),this.coords=new this.ArrayType(this.data,ar+a+l,t*2),this._pos=t*2,this._finished=!0):(this.data=new ArrayBuffer(ar+o+a+l),this.ids=new this.IndexArrayType(this.data,ar,t),this.coords=new this.ArrayType(this.data,ar+a+l,t*2),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,(Mi<<4)+i]),new Uint16Array(this.data,2,1)[0]=n,new Uint32Array(this.data,4,1)[0]=t)}add(t,n){const r=this._pos>>1;return this.ids[r]=r,this.coords[this._pos++]=t,this.coords[this._pos++]=n,r}finish(){const t=this._pos>>1;if(t!==this.numItems)throw new Error(`Added ${t} items when expected ${this.numItems}.`);return lo(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,n,r,s){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:i,coords:o,nodeSize:a}=this,l=[0,i.length-1,0],c=[];for(;l.length;){const u=l.pop()||0,h=l.pop()||0,d=l.pop()||0;if(h-d<=a){for(let R=d;R<=h;R++){const b=o[2*R],F=o[2*R+1];b>=t&&b<=r&&F>=n&&F<=s&&c.push(i[R])}continue}const f=d+h>>1,g=o[2*f],_=o[2*f+1];g>=t&&g<=r&&_>=n&&_<=s&&c.push(i[f]),(u===0?t<=g:n<=_)&&(l.push(d),l.push(f-1),l.push(1-u)),(u===0?r>=g:s>=_)&&(l.push(f+1),l.push(h),l.push(1-u))}return c}within(t,n,r){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:s,coords:i,nodeSize:o}=this,a=[0,s.length-1,0],l=[],c=r*r;for(;a.length;){const u=a.pop()||0,h=a.pop()||0,d=a.pop()||0;if(h-d<=o){for(let R=d;R<=h;R++)Tl(i[2*R],i[2*R+1],t,n)<=c&&l.push(s[R]);continue}const f=d+h>>1,g=i[2*f],_=i[2*f+1];Tl(g,_,t,n)<=c&&l.push(s[f]),(u===0?t-r<=g:n-r<=_)&&(a.push(d),a.push(f-1),a.push(1-u)),(u===0?t+r>=g:n+r>=_)&&(a.push(f+1),a.push(h),a.push(1-u))}return l}}function lo(e,t,n,r,s,i){if(s-r<=n)return;const o=r+s>>1;Cd(e,t,o,r,s,i),lo(e,t,n,r,o-1,1-i),lo(e,t,n,o+1,s,1-i)}function Cd(e,t,n,r,s,i){for(;s>r;){if(s-r>600){const c=s-r+1,u=n-r+1,h=Math.log(c),d=.5*Math.exp(2*h/3),f=.5*Math.sqrt(h*d*(c-d)/c)*(u-c/2<0?-1:1),g=Math.max(r,Math.floor(n-u*d/c+f)),_=Math.min(s,Math.floor(n+(c-u)*d/c+f));Cd(e,t,n,g,_,i)}const o=t[2*n+i];let a=r,l=s;for(lr(e,t,r,n),t[2*s+i]>o&&lr(e,t,r,s);a<l;){for(lr(e,t,a,l),a++,l--;t[2*a+i]<o;)a++;for(;t[2*l+i]>o;)l--}t[2*r+i]===o?lr(e,t,r,l):(l++,lr(e,t,l,s)),l<=n&&(r=l+1),n<=l&&(s=l-1)}}function lr(e,t,n,r){Di(e,n,r),Di(t,2*n,2*r),Di(t,2*n+1,2*r+1)}function Di(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function Tl(e,t,n,r){const s=e-n,i=t-r;return s*s+i*i}class SI{constructor(t=!1){p(this,"_tree",new Map);p(this,"_oneCellCache",new Map);p(this,"_kdTree",new Map);this._enableOneCellCache=t}dispose(){this.clear()}getTree(t,n){return this._tree.has(t)||this._tree.set(t,new Map),this._tree.get(t).has(n)||this._tree.get(t).set(n,new Us),this._tree.get(t).get(n)}_getOneCellCache(t,n,r,s){return this._oneCellCache.has(t)||this._oneCellCache.set(t,new Map),this._oneCellCache.get(t).has(n)||this._oneCellCache.get(t).set(n,new Map),this._oneCellCache.get(t).get(n).has(r)||this._oneCellCache.get(t).get(n).set(r,new Map),this._oneCellCache.get(t).get(n).get(r).has(s)||this._oneCellCache.get(t).get(n).get(r).set(s,new Set),this._oneCellCache.get(t).get(n).get(r).get(s)}_removeOneCellCache(t,n,r,s,i){const o=this._oneCellCache.get(t);if(!o)return;const a=o.get(n);if(!a)return;const l=a.get(r);if(!l)return;const c=l.get(s);c&&c.delete(i)}_removeCellCacheByRange(t){const{unitId:n,sheetId:r,range:s,id:i}=t,o=this._oneCellCache.get(n);if(!o)return;const a=o.get(r);if(!a)return;const{startRow:l,startColumn:c,endRow:u,endColumn:h}=s;for(let d=l;d<=u;d++){const f=a.get(d);if(f)for(let g=c;g<=h;g++){const _=f.get(g);_&&_.delete(i)}}}_insertOneCellCache(t,n,r,s,i){this._getOneCellCache(t,n,r,s).add(i)}_getRdTreeItems(t){const n=[];for(const[r,s]of t)for(const[i,o]of s)n.push({x:i,y:r,ids:o});return n}_searchByOneCellCache(t){var g;const{unitId:n,sheetId:r,range:s}=t,{startRow:i,startColumn:o,endRow:a,endColumn:l}=s,c=(g=this._kdTree.get(n))==null?void 0:g.get(r);if(!c)return[];const{tree:u,items:h}=c,d=u.range(o,i,l,a),f=[];for(const _ of d){const R=h[_];f.push(...Array.from(R.ids))}return f}openKdTree(){var t;for(const[n,r]of this._oneCellCache){this._kdTree.has(n)||this._kdTree.set(n,new Map);for(const[s,i]of r){const o=this._getRdTreeItems(i),a=new ga(o.length);(t=this._kdTree.get(n))==null||t.set(s,{tree:a,items:o});for(const l of o)a.add(l.x,l.y);a.finish()}}}closeKdTree(){var t;for(const[n,r]of this._oneCellCache)for(const[s,i]of r)(t=this._kdTree.get(n))==null||t.set(s,void 0)}insert(t){const{unitId:n,sheetId:r,range:s,id:i}=t;if(!n||n.length===0)return;let{startRow:o,endRow:a,startColumn:l,endColumn:c}=s;if(this._enableOneCellCache&&o===a&&l===c){this._insertOneCellCache(n,r,o,l,i);return}const u=this.getTree(n,r);Number.isNaN(o)&&(o=0),Number.isNaN(l)&&(l=0),Number.isNaN(a)&&(a=Number.POSITIVE_INFINITY),Number.isNaN(c)&&(c=Number.POSITIVE_INFINITY),u.insert({minX:l,minY:o,maxX:c,maxY:a,id:i})}bulkInsert(t){for(const n of t)this.insert(n)}*searchGenerator(t){var a;const{unitId:n,sheetId:r,range:s}=t;if(this._enableOneCellCache){const l=this._searchByOneCellCache(t);for(const c of l)yield c}const i=(a=this._tree.get(n))==null?void 0:a.get(r);if(!i)return;const o=i.search({minX:s.startColumn,minY:s.startRow,maxX:s.endColumn,maxY:s.endRow});for(const l of o)yield l.id}bulkSearch(t,n){const r=new Set;for(const s of t)for(const i of this.searchGenerator(s))(n==null?void 0:n.has(i))!==!0&&r.add(i);return r}removeById(t,n){var r,s;n?((r=this._tree.get(t))==null||r.delete(n),(s=this._oneCellCache.get(t))==null||s.delete(n)):(this._tree.delete(t),this._oneCellCache.delete(t))}_removeRTreeItem(t){const{unitId:n,sheetId:r,range:s,id:i}=t,o=this.getTree(n,r),a=o.search({minX:s.startColumn,minY:s.startRow,maxX:s.endColumn,maxY:s.endRow});for(let l=0;l<a.length;l++)a[l].id===i&&o.remove(a[l])}remove(t){const{unitId:n,sheetId:r,range:s,id:i}=t,{startRow:o,startColumn:a,endRow:l,endColumn:c}=s;this._enableOneCellCache?o===l&&a===c?this._removeOneCellCache(n,r,s.startRow,s.startColumn,i):(this._removeCellCacheByRange(t),this._removeRTreeItem(t)):this._removeRTreeItem(t)}bulkRemove(t){for(const n of t)this.remove(n)}clear(){this._tree.clear(),this._oneCellCache.clear()}toJSON(){const t={};return this._tree.forEach((n,r)=>{t[r]={},n.forEach((s,i)=>{t[r][i]=s.toJSON()})}),t}fromJSON(t){this._tree.clear();for(const n in t){this._tree.set(n,new Map);for(const r in t[n]){const s=new Us;s.fromJSON(t[n][r]),this._tree.get(n).set(r,s)}}}}function OI(e){return new Promise(t=>setTimeout(t,e))}function wI(e=1){return new Promise(t=>{let n=0;const r=()=>{n++,n>=e?t():requestAnimationFrame(r)};requestAnimationFrame(r)})}var vI=Object.getOwnPropertyDescriptor,bI=(e,t,n,r)=>{for(var s=r>1?void 0:r?vI(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},yI=(e,t)=>(n,r)=>t(n,r,e);exports.Skeleton=class extends Xe{constructor(n){super();p(this,"_fontLocale");p(this,"_dirty",!0);this._localeService=n,this._localeInitial()}get dirty(){return this._dirty}getFontLocale(){return this._fontLocale}makeDirty(n){this._dirty=n}dispose(){super.dispose(),this._fontLocale=null}_localeInitial(){}};exports.Skeleton=bI([yI(0,ye.Inject(Rn))],exports.Skeleton);var AI=Object.getOwnPropertyDescriptor,TI=(e,t,n,r)=>{for(var s=r>1?void 0:r?AI(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},cs=(e,t)=>(n,r)=>t(n,r,e);exports.SheetSkeleton=class extends exports.Skeleton{constructor(n,r,s,i,o,a){super(s);p(this,"_worksheetData");p(this,"_renderRawFormula",!1);p(this,"_cellData");p(this,"_imageCacheMap");p(this,"_skipAutoHeightForMergedCells",!0);p(this,"_rowTotalHeight",0);p(this,"_columnTotalWidth",0);p(this,"_rowHeaderWidth",0);p(this,"_columnHeaderHeight",0);p(this,"_rowHeightAccumulation",[]);p(this,"_columnWidthAccumulation",[]);p(this,"_marginTop",0);p(this,"_marginLeft",0);p(this,"_scaleX");p(this,"_scaleY");p(this,"_scrollX");p(this,"_scrollY");this.worksheet=n,this._styles=r,this._contextService=i,this._configService=o,this._injector=a,this._worksheetData=this.worksheet.getConfig(),this._cellData=this.worksheet.getCellMatrix(),this._imageCacheMap=new Ed(this._injector),this.initConfig()}initConfig(){var n,r;this._skipAutoHeightForMergedCells=!((n=this._configService.getConfig(kl))!=null&&n),this.worksheet.setIsRowStylePrecedeColumnStyle((r=this._configService.getConfig(Pl))!=null?r:!1)}resetCache(){}getWorksheetConfig(){return this._worksheetData}getLocation(){return[this.worksheet.getUnitId(),this.worksheet.getSheetId()]}set columnHeaderHeight(n){this._columnHeaderHeight=n,this._worksheetData.columnHeader.height=n}set rowHeaderWidth(n){this._rowHeaderWidth=n,this._worksheetData.rowHeader.width=n}get rowHeightAccumulation(){return this._rowHeightAccumulation}get rowTotalHeight(){return this._rowTotalHeight}get columnWidthAccumulation(){return this._columnWidthAccumulation}get columnTotalWidth(){return this._columnTotalWidth}get rowHeaderWidth(){return this._rowHeaderWidth}get columnHeaderHeight(){return this._columnHeaderHeight}setMarginLeft(n){this._marginLeft=n}setMarginTop(n){this._marginTop=n}setScale(n,r){this._updateLayout(),this._scaleX=n,this._scaleY=r||n,this._updateLayout()}setScroll(n,r){Z.isDefine(n)&&(this._scrollX=n),Z.isDefine(r)&&(this._scrollY=r)}get scrollX(){return this._scrollX}get scrollY(){return this._scrollY}get scaleX(){return this._scaleX}get scaleY(){return this._scaleY}get rowHeaderWidthAndMarginLeft(){return this.rowHeaderWidth+this._marginLeft}get columnHeaderHeightAndMarginTop(){return this.columnHeaderHeight+this._marginTop}get imageCacheMap(){return this._imageCacheMap}_generateRowMatrixCache(n,r,s){let i=0;const o=[],a=r;for(let l=0;l<n;l++){let c=s;if(this.worksheet.getRowFiltered(l))c=0;else if(a[l]!=null){const u=a[l];if(!u)continue;const{h=s,ah:d,ia:f}=u;(f==null||f===ie.TRUE)&&typeof d=="number"?c=d:c=h,u.hd===ie.TRUE&&(c=0)}i+=c,o.push(i)}return{rowTotalHeight:i,rowHeightAccumulation:o}}_generateColumnMatrixCache(n,r,s){let i=0;const o=[],a=r;for(let l=0;l<n;l++){let c=s;if(a[l]!=null){const u=a[l];if(!u)continue;u.w!=null&&(c=u.w),u.hd===ie.TRUE&&(c=0)}i+=c,o.push(i)}return{columnTotalWidth:i,columnWidthAccumulation:o}}intersectMergeRange(n,r){return!!this.worksheet.getMergedCell(n,r)}_getOverflowBound(n,r,s,i,o=Nt.LEFT){let a=0;if(r>s){const l=this._columnWidthAccumulation.length-1;for(let c=r;c>=s;c--){const u=c,h=this.worksheet.getCell(n,u);if(!Wi(h)&&u!==r||this.intersectMergeRange(n,u))return u===r?u:u+1>l?l:u+1;const{startX:d,endX:f}=Pn(n,u,this.rowHeightAccumulation,this.columnWidthAccumulation);if(o===Nt.CENTER&&u===r?a+=(f-d)/2:a+=f-d,i<a)return u}return r}for(let l=r;l<=s;l++){const c=l,u=this.worksheet.getCell(n,c);if(!Wi(u)&&c!==r||this.intersectMergeRange(n,c))return c===r?c:c-1<0?0:c-1;const{startX:h,endX:d}=Pn(n,c,this.rowHeightAccumulation,this.columnWidthAccumulation);if(o===Nt.CENTER&&c===r?a+=(d-h)/2:a+=d-h,i<a)return c}return s}_updateLayout(){if(!this.dirty)return;const{rowData:n,columnData:r,defaultRowHeight:s,defaultColumnWidth:i,rowCount:o,columnCount:a,rowHeader:l,columnHeader:c}=this._worksheetData,{rowTotalHeight:u,rowHeightAccumulation:h}=this._generateRowMatrixCache(o,n,s),{columnTotalWidth:d,columnWidthAccumulation:f}=this._generateColumnMatrixCache(a,r,i);this._rowHeaderWidth=l.hidden!==ie.TRUE?this._dynamicallyUpdateRowHeaderWidth(l):0,this._columnHeaderHeight=c.hidden!==ie.TRUE?c.height:0,this._rowTotalHeight=u,this._rowHeightAccumulation=h,this._columnTotalWidth=d,this._columnWidthAccumulation=f,this.makeDirty(!1)}calculate(){return this.resetCache(),this._updateLayout(),this}resetRangeCache(n){}_dynamicallyUpdateRowHeaderWidth(n){const s=`${this.worksheet.getRowCount()}`.length*8;return Math.max(n.width,s)}_hasUnMergedCellInRow(n,r,s){if(!this.worksheet.getMergeData())return!1;for(let o=r;o<=s;o++){const{isMerged:a,isMergedMainCell:l}=this.worksheet.getCellInfoInMergeData(n,o);if(!a&&!l)return!0}return!1}expandRangeByMerge(n,r){let{startRow:s,startColumn:i,endRow:o,endColumn:a}=n;const l=this._worksheetData.mergeData;if(!l)return{startRow:s,startColumn:i,endRow:o,endColumn:a};let c=!0;const u=new ct;let h=0,d=null;for(;c;){c=!1;for(let f=0;f<l.length;f++){const{startRow:g,startColumn:_,endRow:R,endColumn:b}=l[f];if(u.getValue(g,_))continue;const F={startColumn:i,startRow:s,endColumn:a,endRow:o},k={startColumn:_,startRow:g,endColumn:b,endRow:R};lh(F,k)&&(s=Math.min(s,g),i=Math.min(i,_),o=Math.max(o,R),a=Math.max(a,b),u.setValue(g,_,!0),c=!0,h++,d=k)}}return r&&h===1&&zt.contains(d,n)?{startRow:d.startRow,startColumn:d.startColumn,endRow:d.startRow,endColumn:d.startColumn}:{startRow:s,startColumn:i,endRow:o,endColumn:a}}getColumnCount(){return this._columnWidthAccumulation.length}getRowCount(){return this._rowHeightAccumulation.length}_getCellMergeInfo(n,r){return this.worksheet.getCellInfoInMergeData(n,r)}getNoMergeCellPositionByIndex(n,r,s=!0){return this.getNoMergeCellWithCoordByIndex(n,r,s)}getNoMergeCellWithCoordByIndex(n,r,s=!0){const{rowHeightAccumulation:i,columnWidthAccumulation:o,rowHeaderWidthAndMarginLeft:a,columnHeaderHeightAndMarginTop:l}=this;let{startY:c,endY:u,startX:h,endX:d}=Pn(n,r,i,o);return s&&(c+=l,u+=l,h+=a,d+=a),{startY:c,endY:u,startX:h,endX:d}}getNoMergeCellPositionByIndexWithNoHeader(n,r){const{rowHeightAccumulation:s,columnWidthAccumulation:i}=this,{startY:o,endY:a,startX:l,endX:c}=Pn(n,r,s,i);return{startY:o,endY:a,startX:l,endX:c}}getRowIndexByOffsetY(n,r,s,i){var l;const{rowHeightAccumulation:o}=this;n=Id(n,r,s,this.columnHeaderHeightAndMarginTop);let a=ur(o,n,i==null?void 0:i.firstMatch);return i!=null&&i.closeFirst&&Math.abs(o[a]-n)<Math.abs(n-((l=o[a-1])!=null?l:0))&&(a=a+1),a}getColumnIndexByOffsetX(n,r,s,i){var c;const o=Rd(n,r,s,this.rowHeaderWidthAndMarginLeft),{columnWidthAccumulation:a}=this;let l=ur(a,o,i==null?void 0:i.firstMatch);return i!=null&&i.closeFirst&&Math.abs(a[l]-o)<Math.abs(o-((c=a[l-1])!=null?c:0))&&(l=l+1),l}getCellIndexByOffset(n,r,s,i,o,a){const l=this.getRowIndexByOffsetY(r,i,o,a),c=this.getColumnIndexByOffsetX(n,s,o,a);return{row:l,column:c}}getCellByOffset(n,r,s,i,o){const a=this==null?void 0:this.getCellIndexByOffset(n,r,s,i,o,{firstMatch:!0});return a?this.worksheet.getCellInfoInMergeData(a.row,a.column):null}getCellWithCoordByIndex(n,r,s=!0){const{rowHeightAccumulation:i,columnWidthAccumulation:o,rowHeaderWidthAndMarginLeft:a,columnHeaderHeightAndMarginTop:l}=this,c=Pn(n,r,i,o,this.worksheet.getCellInfoInMergeData(n,r)),{isMerged:u,isMergedMainCell:h}=c;let{startY:d,endY:f,startX:g,endX:_,mergeInfo:R}=c,b=a,F=l;return s===!1&&(b=0,F=0),d+=F,f+=F,g+=b,_+=b,R.startY+=F,R.endY+=F,R.startX+=b,R.endX+=b,{actualRow:n,actualColumn:r,startX:g,startY:d,endX:_,endY:f,isMerged:u,isMergedMainCell:h,mergeInfo:R}}getCellWithCoordByOffset(n,r,s,i,o,a){const{row:l,column:c}=this.getCellIndexByOffset(n,r,s,i,o,a);return this.getCellWithCoordByIndex(l,c)}getOffsetByColumn(n){const{columnWidthAccumulation:r,rowHeaderWidthAndMarginLeft:s}=this,i=r.length-1,o=r[n];return o!=null?o+s:n<0?s:r[i]+s}getOffsetByRow(n){const{rowHeightAccumulation:r,columnHeaderHeightAndMarginTop:s}=this,i=r.length-1,o=r[n];return o!=null?o+s:n<0?s:r[i]+s}getOffsetRelativeToRowCol(n,r){const s=ur(this.columnWidthAccumulation,n);let i=0;s===0?i=n:i=n-this._columnWidthAccumulation[s-1];const o=ur(this.rowHeightAccumulation,r);let a=0;return o===0?a=r:a=r-this._rowHeightAccumulation[o-1],{row:o,column:s,columnOffset:i,rowOffset:a}}_updateConfigAndGetDocumentModel(n,r,s,i){var a,l,c,u,h;if(!i||!((a=n.body)!=null&&a.dataStream))return;n.documentStyle||(n.documentStyle={}),n.documentStyle.marginTop=(l=s.t)!=null?l:0,n.documentStyle.marginBottom=(c=s.b)!=null?c:2,n.documentStyle.marginLeft=(u=s.l)!=null?u:2,n.documentStyle.marginRight=(h=s.r)!=null?h:2,n.documentStyle.pageSize={width:Number.POSITIVE_INFINITY,height:Number.POSITIVE_INFINITY},n.documentStyle.renderConfig={...n.documentStyle.renderConfig,...i};const o=n.body.paragraphs||[];for(const d of o)d.paragraphStyle||(d.paragraphStyle={}),d.paragraphStyle.horizontalAlign=r;return new Dt(n)}dispose(){super.dispose(),this._rowHeightAccumulation=[],this._columnWidthAccumulation=[],this._rowTotalHeight=0,this._columnTotalWidth=0,this._rowHeaderWidth=0,this._columnHeaderHeight=0,this._worksheetData=null,this._cellData=null,this._styles=null,this.worksheet=null}};exports.SheetSkeleton=TI([cs(2,ye.Inject(Rn)),cs(3,er),cs(4,$r),cs(5,ye.Inject(ye.Injector))],exports.SheetSkeleton);function _a(e,t,n,r){const s=e-1,i=t-1,o=n[s]||0;let a=n[e];a==null&&(a=n[n.length-1]);const l=r[i]||0;let c=r[t];return c==null&&(c=r[r.length-1]),{startY:o,endY:a,startX:l,endX:c}}function NI(e,t,n,r){return _a(e,t,n,r)}function Pn(e,t,n,r,s){e=Z.clamp(e,0,n.length-1),t=Z.clamp(t,0,r.length-1);let{startY:i,endY:o,startX:a,endX:l}=_a(e,t,n,r);if(!s)return{startY:i,endY:o,startX:a,endX:l,isMerged:!1,isMergedMainCell:!1,actualRow:e,actualColumn:t,mergeInfo:{startY:i,endY:o,startX:a,endX:l,startRow:e,startColumn:t,endRow:e,endColumn:t}};const{isMerged:c,isMergedMainCell:u,startRow:h,startColumn:d,endRow:f,endColumn:g}=s;let _={startRow:h,startColumn:d,endRow:f,endColumn:g,startY:i,endY:o,startX:a,endX:l};const R=n.length-1,b=r.length-1;if(c&&h!==-1&&d!==-1){const F=n[h-1]||0,k=n[f]||n[R],W=r[d-1]||0,S=r[g]||r[b];_={..._,startY:F,endY:k,startX:W,endX:S}}else if(!c&&f!==-1&&g!==-1){const F=n[f]||n[R],k=r[g]||r[b];_={..._,startY:i,endY:F,startX:a,endX:k}}return{isMerged:c,isMergedMainCell:u,actualRow:e,actualColumn:t,startY:i,endY:o,startX:a,endX:l,mergeInfo:_}}function Rd(e,t,n,r){const{x:s}=n;return e/t+s-r}function Id(e,t,n,r){const{y:s}=n;return e=e/t+s-r,e}const MI=["script","style","meta","comment","link"];var Sd=(e=>(e[e.INFO=0]="INFO",e[e.STOP=1]="STOP",e[e.WARNING=2]="WARNING",e))(Sd||{}),Od=(e=>(e[e.DISABLED=0]="DISABLED",e[e.FULL_ALPHA=1]="FULL_ALPHA",e[e.FULL_HANGUL=2]="FULL_HANGUL",e[e.FULL_KATAKANA=3]="FULL_KATAKANA",e[e.HALF_ALPHA=4]="HALF_ALPHA",e[e.HALF_HANGUL=5]="HALF_HANGUL",e[e.HALF_KATAKANA=6]="HALF_KATAKANA",e[e.HIRAGANA=7]="HIRAGANA",e[e.NO_CONTROL=8]="NO_CONTROL",e[e.OFF=9]="OFF",e[e.ON=10]="ON",e))(Od||{}),wd=(e=>(e.BETWEEN="between",e.EQUAL="equal",e.GREATER_THAN="greaterThan",e.GREATER_THAN_OR_EQUAL="greaterThanOrEqual",e.LESS_THAN="lessThan",e.LESS_THAN_OR_EQUAL="lessThanOrEqual",e.NOT_BETWEEN="notBetween",e.NOT_EQUAL="notEqual",e))(wd||{}),vd=(e=>(e[e.TEXT=0]="TEXT",e[e.ARROW=1]="ARROW",e[e.CUSTOM=2]="CUSTOM",e))(vd||{}),bd=(e=>(e.VALID="valid",e.INVALID="invalid",e.VALIDATING="validating",e))(bd||{}),yd=(e=>(e.CUSTOM="custom",e.LIST="list",e.LIST_MULTIPLE="listMultiple",e.NONE="none",e.TEXT_LENGTH="textLength",e.DATE="date",e.TIME="time",e.WHOLE="whole",e.DECIMAL="decimal",e.CHECKBOX="checkbox",e.ANY="any",e))(yd||{}),DI=Object.getOwnPropertyDescriptor,LI=(e,t,n,r)=>{for(var s=r>1?void 0:r?DI(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},Nl=(e,t)=>(n,r)=>t(n,r,e);let co=class extends Xe{constructor(e,t){super(),this._resourceManagerService=e,this._univerInstanceService=t,this._init()}_init(){const e=n=>{n.businesses.forEach(r=>{switch(r){case we.UNRECOGNIZED:case we.UNIVER_UNKNOWN:case we.UNIVER_SLIDE:case we.UNIVER_DOC:{this._univerInstanceService.getAllUnitsForType(we.UNIVER_DOC).forEach(s=>{const o=(s.getSnapshot().resources||[]).find(a=>a.name===n.pluginName);if(o)try{const a=n.parseJson(o.data);n.onLoad(s.getUnitId(),a)}catch{console.error(`Load Document{${s.getUnitId()}} Resources{${n.pluginName}} Data Error.`)}});break}case we.UNIVER_SHEET:this._univerInstanceService.getAllUnitsForType(we.UNIVER_SHEET).forEach(s=>{const o=(s.getSnapshot().resources||[]).find(a=>a.name===n.pluginName);if(o)try{const a=n.parseJson(o.data);n.onLoad(s.getUnitId(),a)}catch{console.error(`Load Workbook{${s.getUnitId()}} Resources{${n.pluginName}} Data Error.`)}})}})};this._resourceManagerService.getAllResourceHooks().forEach(n=>e(n)),this.disposeWithMe(this._resourceManagerService.register$.subscribe(n=>e(n))),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitAdded$(we.UNIVER_SHEET).subscribe(n=>{this._resourceManagerService.loadResources(n.getUnitId(),n.getSnapshot().resources)})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitAdded$(we.UNIVER_DOC).subscribe(n=>{const r=n.getUnitId();Fl(r)||this._resourceManagerService.loadResources(n.getUnitId(),n.getSnapshot().resources)})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitDisposed$(we.UNIVER_SHEET).subscribe(n=>{this._resourceManagerService.unloadResources(n.getUnitId(),we.UNIVER_SHEET)})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitDisposed$(we.UNIVER_DOC).subscribe(n=>{this._resourceManagerService.unloadResources(n.getUnitId(),we.UNIVER_DOC)}))}saveUnit(e){const t=this._univerInstanceService.getUnit(e);if(!t)return null;const n=this._resourceManagerService.getResources(e,t.type),r=Z.deepClone(t.getSnapshot());return r.resources=n,r}};co=LI([Nl(0,ye.Inject(ni)),Nl(1,ye.Inject(qn))],co);class xI{constructor(t={},n){p(this,"_startedTypes",new Set);p(this,"_injector");p(this,"_disposingCallbacks",new Vs);const r=this._injector=UI(n,t==null?void 0:t.override),{theme:s,darkMode:i,locale:o,locales:a,logLevel:l,logCommandExecution:c}=t;s&&this._injector.get(Hs).setTheme(s),i&&this._injector.get(Hs).setDarkMode(i),a&&this._injector.get(Rn).load(a),o&&this._injector.get(Rn).setLocale(o),l&&this._injector.get(mt).setLogLevel(l),c!==void 0&&this._injector.get($r).setConfig(Ns,c),this._init(r)}get _univerInstanceService(){return this._injector.get(qn)}get _pluginService(){return this._injector.get(exports.PluginService)}__getInjector(){return this._injector}onDispose(t){const n=this._disposingCallbacks.add(We(t));return We(()=>n.dispose(!0))}dispose(){this._disposingCallbacks.dispose(),this._injector.dispose()}setLocale(t){this._injector.get(Rn).setLocale(t)}createUnit(t,n){return this._univerInstanceService.createUnit(t,n)}createUniverSheet(t){return this._injector.get(mt).warn("[Univer]","Univer.createUniverSheet is deprecated, use createUnit instead"),this._univerInstanceService.createUnit(we.UNIVER_SHEET,t)}createUniverDoc(t){return this._injector.get(mt).warn("[Univer]","Univer.createUniverDoc is deprecated, use createUnit instead"),this._univerInstanceService.createUnit(we.UNIVER_DOC,t)}createUniverSlide(t){return this._injector.get(mt).warn("[Univer]","Univer.createUniverSlide is deprecated, use createUnit instead"),this._univerInstanceService.createUnit(we.UNIVER_SLIDE,t)}_init(t){this._univerInstanceService.registerCtorForType(we.UNIVER_SHEET,exports.Workbook),this._univerInstanceService.registerCtorForType(we.UNIVER_DOC,Dt),this._univerInstanceService.registerCtorForType(we.UNIVER_SLIDE,fa);const n=t.get(qn);n.__setCreateHandler((r,s,i,o)=>{if(!this._startedTypes.has(r)){this._pluginService.startPluginsForType(r),this._startedTypes.add(r);const l=t.createInstance(i,s);return n.__addUnit(l,o),this._tryProgressToReady(),l}const a=t.createInstance(i,s);return n.__addUnit(a,o),a})}_tryProgressToReady(){this._injector.get(exports.LifecycleService).stage<Pe.Ready&&(this._injector.get(exports.LifecycleService).stage=Pe.Ready)}registerPlugin(t,n){this._pluginService.registerPlugin(t,n)}registerPlugins(t){t.forEach(n=>{const[r,s]=n;this._pluginService.registerPlugin(r,s)})}}function UI(e,t){const n=hd([[$h],[Rn],[Hs],[exports.LifecycleService],[exports.PluginService],[Ur],[qn,{useClass:exports.UniverInstanceService}],[cd,{useClass:ud}],[mt,{useClass:gu,lazy:!0}],[Wr,{useClass:exports.CommandService}],[ri,{useClass:exports.LocalUndoRedoService,lazy:!0}],[$r,{useClass:du}],[er,{useClass:fu}],[ni,{useClass:exports.ResourceManagerService,lazy:!0}],[ao,{useClass:co,lazy:!0}],[Fh,{useClass:exports.AuthzIoLocalService}],[ld,{useClass:exports.MentionIOLocalService,lazy:!0}]],t),r=e?e.createChild(n):new ye.Injector(n);return Hl(r,[[Ur],[ao]]),r}xd();exports.ABCToNumber=q0;exports.AUTO_HEIGHT_FOR_MERGED_CELLS=kl;exports.AbsoluteRefType=Me;exports.ActionIterator=Un;exports.AlignTypeH=nu;exports.AlignTypeV=ru;exports.ArrangeTypeEnum=ou;exports.ArrowsAndMarkersShapes=Ac;exports.AsyncInterceptorManager=nf;exports.AsyncLock=Yd;exports.AutoFillSeries=pc;exports.BaselineOffset=Vt;exports.BasicShapes=yc;exports.BlockType=Pc;exports.BooleanNumber=ie;exports.BorderStyleTypes=xe;exports.BorderType=Ec;exports.BuildTextUtils=et;exports.BulletAlignment=Br;exports.COLORS=Bi;exports.COMMAND_LOG_EXECUTION_CONFIG_KEY=Ns;exports.CanceledError=qd;exports.CellModeEnum=Hn;exports.CellValueType=nn;exports.Color=On;exports.ColorBuilder=Xs;exports.ColorKit=Rt;exports.ColorType=It;exports.ColumnSeparatorType=Hc;exports.CommandType=jr;exports.CommonHideTypes=Cc;exports.ConfigService=du;exports.ContextService=fu;exports.CopyPasteType=Rc;exports.CustomCommandExecutionError=ws;exports.CustomDecorationType=En;exports.CustomRangeType=on;exports.DEFAULT_CELL=b0;exports.DEFAULT_DOC=ca;exports.DEFAULT_DOCUMENT_SUB_COMPONENT_ID=uR;exports.DEFAULT_EMPTY_DOCUMENT_VALUE=Ul;exports.DEFAULT_NUMBER_FORMAT=sh;exports.DEFAULT_RANGE=w0;exports.DEFAULT_RANGE_ARRAY=O0;exports.DEFAULT_SELECTION=v0;exports.DEFAULT_SLIDE=ih;exports.DEFAULT_STYLES=it;exports.DEFAULT_TEXT_FORMAT=nh;exports.DEFAULT_TEXT_FORMAT_EXCEL=rh;exports.DEFAULT_WORKSHEET_COLUMN_COUNT=Kh;exports.DEFAULT_WORKSHEET_COLUMN_COUNT_KEY=$R;exports.DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT=Zh;exports.DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT_KEY=VR;exports.DEFAULT_WORKSHEET_COLUMN_WIDTH=qh;exports.DEFAULT_WORKSHEET_COLUMN_WIDTH_KEY=WR;exports.DEFAULT_WORKSHEET_ROW_COUNT=Gh;exports.DEFAULT_WORKSHEET_ROW_COUNT_KEY=BR;exports.DEFAULT_WORKSHEET_ROW_HEIGHT=Xh;exports.DEFAULT_WORKSHEET_ROW_HEIGHT_KEY=jR;exports.DEFAULT_WORKSHEET_ROW_TITLE_WIDTH=Jh;exports.DEFAULT_WORKSHEET_ROW_TITLE_WIDTH_KEY=YR;exports.DOCS_COMMENT_EDITOR_UNIT_ID_KEY=xl;exports.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY=ho;exports.DOCS_NORMAL_EDITOR_UNIT_ID_KEY=uo;exports.DOCS_ZEN_EDITOR_UNIT_ID_KEY=Ll;exports.DOC_DRAWING_PRINTING_COMPONENT_KEY=M0;exports.DOC_RANGE_TYPE=yu;exports.DashStyleType=Vc;exports.DataStreamTreeNodeType=Dh;exports.DataStreamTreeTokenType=lt;exports.DataValidationErrorStyle=Sd;exports.DataValidationImeMode=Od;exports.DataValidationOperator=wd;exports.DataValidationRenderMode=vd;exports.DataValidationStatus=bd;exports.DataValidationType=yd;exports.DeleteDirection=Ic;exports.DependentOn=fI;exports.DesktopLogService=gu;exports.DeveloperMetadataVisibility=Sc;exports.Dimension=Oc;exports.Direction=wc;exports.Disposable=Xe;exports.DisposableCollection=Vs;exports.DocStyleType=xc;exports.DocumentDataModel=Dt;exports.DocumentFlavor=Oo;exports.DrawingTypeEnum=au;exports.EDITOR_ACTIVATED=Hh;exports.EXTENSION_NAMES=oh;exports.ErrorService=$h;exports.EventState=kh;exports.EventSubject=hR;exports.FOCUSING_COMMENT_EDITOR=SR;exports.FOCUSING_COMMON_DRAWINGS=vR;exports.FOCUSING_DOC=Sr;exports.FOCUSING_EDITOR_BUT_HIDDEN=ER;exports.FOCUSING_EDITOR_INPUT_FORMULA=CR;exports.FOCUSING_EDITOR_STANDALONE=IR;exports.FOCUSING_FX_BAR_EDITOR=Bh;exports.FOCUSING_PANEL_EDITOR=OR;exports.FOCUSING_SHEET=jn;exports.FOCUSING_SLIDE=Or;exports.FOCUSING_UNIT=Ir;exports.FOCUSING_UNIVER_EDITOR=RR;exports.FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE=wR;exports.FORMULA_EDITOR_ACTIVATED=bR;exports.FollowNumberWithType=Uc;exports.FontItalic=As;exports.FontStyleType=Fn;exports.FontWeight=Ts;exports.GridType=kc;exports.HLSColor=Su;exports.HorizontalAlign=Nt;exports.IAuthzIoService=Fh;exports.ICommandService=Wr;exports.IConfigService=$r;exports.IConfirmService=_R;exports.IContextService=er;exports.IImageIoService=so;exports.ILocalStorageService=iI;exports.ILogService=mt;exports.IMentionIOService=ld;exports.IPermissionService=cd;exports.IResourceLoaderService=ao;exports.IResourceManagerService=ni;exports.IS_ROW_STYLE_PRECEDE_COLUMN_STYLE=Pl;exports.IUndoRedoService=ri;exports.IUniverInstanceService=qn;exports.ImageCacheMap=Ed;exports.ImageSourceType=da;exports.ImageUploadStatusType=jh;exports.InterceptorEffectEnum=kn;exports.InterceptorManager=Qd;exports.InterpolationPointType=vc;exports.JSON1=$_;exports.JSONX=Gt;exports.LRUHelper=dr;exports.LRUMap=Mr;exports.LifecycleStages=Pe;exports.LifecycleUnreachableError=od;exports.ListGlyphType=fe;exports.LocaleService=Rn;exports.LocaleType=Hr;exports.LogLevel=mu;exports.MOVE_BUFFER_VALUE=hr;exports.MemoryCursor=vn;exports.MentionType=ys;exports.NAMED_STYLE_MAP=A0;exports.NAMED_STYLE_SPACE_MAP=T0;exports.NamedStyleType=qe;exports.NilCommand=_u;exports.NumberUnitType=tu;exports.ObjectMatrix=ct;exports.ObjectRelativeFromH=Qc;exports.ObjectRelativeFromV=eu;exports.OtherShapes=Tc;exports.PAGE_SIZE=D0;exports.PAPER_TYPES=D_;exports.PRESET_LIST_TYPE=zr;exports.PRINT_CHART_COMPONENT_KEY=N0;exports.PageElementType=lu;exports.PageOrientType=iu;exports.PageType=wo;exports.PaperType=ht;exports.ParagraphElementType=$c;exports.ParagraphStyleBuilder=xr;exports.ParagraphStyleValue=Kr;exports.PermissionService=ud;exports.PermissionStatus=ma;exports.Plugin=oo;exports.PositionedObjectLayoutType=Wc;exports.PresetListType=Ft;exports.ProtectionType=bc;exports.QuickListType=Oh;exports.QuickListTypeMap=aC;exports.RANGE_DIRECTION=bu;exports.RANGE_TYPE=_e;exports.RBush=Us;exports.RCDisposable=E_;exports.RGBA_PAREN=rp;exports.RGB_PAREN=np;exports.ROTATE_BUFFER_VALUE=Ru;exports.RTree=SI;exports.Range=Xn;exports.Rectangle=zt;exports.RedoCommand=pd;exports.RedoCommandId=md;exports.RefAlias=X0;exports.Registry=Ro;exports.RegistryAsMap=Io;exports.RelativeDate=Mc;exports.RelativeSlideLink=cu;exports.RgbColor=Ms;exports.RichTextBuilder=Cn;exports.RichTextValue=tn;exports.RxDisposable=p_;exports.SHEET_EDITOR_UNITS=y0;exports.SectionType=Fc;exports.SheetTypes=Dc;exports.SheetViewModel=ed;exports.SliceBodyType=la;exports.SlideDataModel=fa;exports.SpacingRule=Yc;exports.SpecialShapes=Nc;exports.Styles=Wh;exports.THEME_COLORS=Iu;exports.TabStopAlignment=zc;exports.TableAlignmentType=Kc;exports.TableLayoutType=Xc;exports.TableRowHeightRule=Jc;exports.TableSizeType=Gc;exports.TableTextWrapType=qc;exports.TestConfirmService=pR;exports.TextDecoration=Lc;exports.TextDecorationBuilder=en;exports.TextDirection=Nr;exports.TextDirectionType=Bc;exports.TextStyleBuilder=sn;exports.TextStyleValue=Gr;exports.TextX=De;exports.TextXActionType=q;exports.ThemeColor=Ds;exports.ThemeColorType=ot;exports.ThemeColors=Gs;exports.ThemeService=Hs;exports.Tools=Z;exports.UndoCommand=_d;exports.UndoCommandId=gd;exports.UnitModel=zs;exports.Univer=xI;exports.UniverInstanceType=we;exports.UpdateDocsAttributeType=Ee;exports.UserManagerService=Ur;exports.VerticalAlign=pn;exports.VerticalAlignmentType=Zc;exports.Worksheet=Pr;exports.WrapStrategy=Sn;exports.WrapTextType=jc;exports.addLinkToDocumentModel=Yh;exports.afterInitApply=J_;exports.afterTime=X_;exports.awaitTime=OI;exports.binSearchFirstGreaterThanTarget=Cu;exports.binarySearchArray=Z_;exports.bufferDebounceTime=K_;exports.cellToRange=xp;exports.characterSpacingControlType=su;exports.checkForSubstrings=Pp;exports.checkIfMove=ep;exports.checkParagraphHasBullet=EE;exports.checkParagraphHasIndent=CE;exports.checkParagraphHasIndentByStyle=Du;exports.cloneCellData=td;exports.cloneCellDataMatrix=nd;exports.cloneCellDataWithSpanAndDisplay=GR;exports.cloneValue=gt;exports.cloneWorksheetData=rd;exports.codeToBlob=Q_;exports.composeBody=eo;exports.composeInterceptors=$l;exports.composeStyles=cr;exports.concatMatrixArray=Op;exports.convertBodyToHtml=tp;exports.convertCellToRange=Au;exports.convertObservableToBehaviorSubject=q_;exports.covertCellValue=Yi;exports.covertCellValues=Up;exports.covertTextRunToHtml=Hi;exports.createAsyncInterceptorKey=ef;exports.createDefaultUser=Fs;exports.createDocumentModelWithStyle=wr;exports.createInterceptorKey=Zd;exports.createInternalEditorID=Gd;exports.createREGEXFromWildChar=N_;exports.createRowColIter=Ji;exports.customNameCharacterCheck=II;exports.dayjs=Xt;exports.debounce=r_;exports.dedupe=Ud;exports.dedupeBy=Pd;exports.deepCompare=bo;exports.delayAnimationFrame=wI;exports.deleteContent=xu;exports.extractPureTextFromCell=sd;exports.fromCallback=pu;exports.fromEventSubject=dR;exports.fromObservable=__;exports.generateRandomId=nt;exports.get=ac;exports.getArrayLength=rn;exports.getBodySlice=Mt;exports.getBodySliceHtml=hs;exports.getBorderStyleType=Mp;exports.getCellCoordByIndexSimple=_a;exports.getCellInfoInMergeData=Rp;exports.getCellPositionByIndexSimple=NI;exports.getCellValueType=pp;exports.getCellWithCoordByIndexCore=Pn;exports.getColorStyle=Ut;exports.getCustomBlockSlice=yh;exports.getCustomDecorationSlice=Th;exports.getCustomRangeSlice=Ah;exports.getDocsUpdateBody=Dp;exports.getEmptyCell=xR;exports.getIntersectRange=lh;exports.getNumfmtParseValueFilter=S0;exports.getOriginCellValue=XR;exports.getParagraphsSlice=bh;exports.getPlainText=ti;exports.getReverseDirection=M_;exports.getSectionBreakSlice=_C;exports.getTableSlice=vh;exports.getTextRunSlice=ks;exports.getTransformOffsetX=Rd;exports.getTransformOffsetY=Id;exports.getWorksheetUID=QR;exports.groupBy=Hd;exports.handleStyleToString=Np;exports.hashAlgorithm=IE;exports.horizontalLineSegmentsSubtraction=qs;exports.insertMatrixArray=Sp;exports.insertTextToContent=Lu;exports.invertColorByHSL=cf;exports.invertColorByMatrix=hf;exports.isBlackColor=gp;exports.isBooleanString=zd;exports.isCellCoverable=Wi;exports.isCellV=vu;exports.isCommentEditorID=Kd;exports.isDefaultFormat=E0;exports.isEmptyCell=Tu;exports.isFormulaId=Tp;exports.isFormulaString=Nu;exports.isICellData=wu;exports.isInternalEditorID=Fl;exports.isNodeEnv=T_;exports.isNotNullOrUndefined=Vh;exports.isNullCell=Ep;exports.isNumeric=hc;exports.isPatternEqualWithoutDecimal=C0;exports.isRangesEqual=NR;exports.isRealNum=RE;exports.isSafeNumeric=h_;exports.isSameStyleTextRun=Mu;exports.isTextFormat=p0;exports.isUnitRangesEqual=MR;exports.isValidRange=Lp;exports.isWhiteColor=_p;exports.makeArray=Bd;exports.makeCellRangeToRangeData=Ap;exports.makeCellToSelection=yp;exports.makeCustomRangeStream=NC;exports.mapObjectMatrix=Ip;exports.merge=Ys;exports.mergeLocales=SE;exports.mergeOverrideWithDependencies=hd;exports.mergeSets=m_;exports.mergeWith=a_;exports.mergeWorksheetSnapshotWithDefault=Qh;exports.mixinClass=u_;exports.moveMatrixArray=ji;exports.moveRangeByOffset=H0;exports.nameCharacterCheck=RI;exports.normalizeBody=pC;exports.normalizeTextRuns=Vr;exports.numberToABC=Z0;exports.numberToListABC=Q0;exports.numfmt=_0;exports.queryObjectMatrix=K0;exports.registerDependencies=Xd;exports.remove=kr;exports.repeatStringNumTimes=uh;exports.replaceInDocumentBody=lR;exports.requestImmediateMacroTask=f_;exports.rotate=Fd;exports.searchArray=ur;exports.searchInOrderedArray=Eu;exports.selectionToArray=Cp;exports.sequence=fc;exports.sequenceAsync=dc;exports.sequenceExecute=Ks;exports.sequenceExecuteAsync=G_;exports.set=c_;exports.shallowEqual=Bl;exports.skipParseTagNames=MI;exports.sliceMatrixArray=wp;exports.sortRules=eC;exports.sortRulesByDesc=tC;exports.sortRulesFactory=Yr;exports.spliceArray=$i;exports.splitIntoGrid=oa;exports.takeAfter=Fi;exports.textDiff=ua;exports.throttle=Jd;exports.toDisposable=We;exports.touchDependencies=Hl;exports.updateAttributeByDelete=Nh;exports.updateAttributeByInsert=Mh;exports.willLoseNumericPrecision=d_;Object.keys(ye).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:()=>ye[e]})});
|
|
1
|
+
"use strict";var Nd=Object.defineProperty;var Md=(e,t,n)=>t in e?Nd(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var p=(e,t,n)=>Md(e,typeof t!="symbol"?t+"":t,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ye=require("@wendellhu/redi"),le=require("rxjs"),us=require("rxjs/operators"),qr=require("@univerjs/themes");function Dd(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const s in r)if(s!=="default"&&!(s in e)){const i=Object.getOwnPropertyDescriptor(r,s);i&&Object.defineProperty(e,s,i.get?i:{enumerable:!0,get:()=>r[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}const kt=typeof global<"u"?global:typeof self<"u"?self:window;function Ld(){const t=new Map;let n=0;typeof kt.requestIdleCallback!="function"&&(kt.requestIdleCallback=function(s){const i=Date.now(),o=++n,a=setTimeout(function(){t.delete(o);const c=Math.max(0,50-(Date.now()-i));s({didTimeout:c===0,timeRemaining(){return c}})},1);return t.set(o,a),o}),typeof kt.cancelIdleCallback!="function"&&(kt.cancelIdleCallback=function(s){const i=t.get(s);i!==void 0&&(clearTimeout(i),t.delete(s))})}function xd(){typeof kt.Array.prototype.findLastIndex!="function"&&(kt.Array.prototype.findLastIndex=function(t,n){if(this==null)throw new TypeError("Array.prototype.findLastIndex called on null or undefined");if(typeof t!="function")throw new TypeError("callback must be a function");const r=this.length>>>0;for(let s=r-1;s>=0;s--)if(s in this&&t.call(n,this[s],s,this))return s;return-1}),typeof kt.Array.prototype.findLast!="function"&&(kt.Array.prototype.findLast=function(t,n){const r=this.findLastIndex(t,n);return r!==-1?this[r]:void 0})}function Ud(){typeof kt.String.prototype.at!="function"&&(kt.String.prototype.at=function(t){if(this==null)throw new TypeError("String.prototype.at called on null or undefined");const n=this.length;if(t<0&&(t=n+t),!(t<0||t>=n))return this.charAt(t)})}function Pd(){Ld(),xd(),Ud()}function kr(e,t){const n=e.indexOf(t);return n>-1?(e.splice(n,1),!0):!1}function kd(e){const t=new Set,n=[];for(const r of e)t.has(r)||(t.add(r),n.push(r));return n}function Fd(e,t){const n=new Set,r=[];for(const s of e){const i=t(s);n.has(i)||(n.add(i),r.push(s))}return r}function Hd(e,t){for(let n=e.length-1;n>-1;n--){const r=e[n];if(t(r,n))return r}return null}function Bd(e,t){if(e.length===0)return e;const n=t%e.length;return e.slice(n).concat(e.slice(0,n))}function $d(e,t){const n=new Map;return e.forEach(r=>{const s=t(r);let i=n.get(s);n.has(s)||(i=[],n.set(s,i)),i.push(r)}),n}function jd(e){return Array.isArray(e)?e:[e]}function wt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var oi,Ra;function Wd(){if(Ra)return oi;Ra=1;var e=function(t){if(t=t||{},this.Promise=t.Promise||Promise,this.queues=Object.create(null),this.domainReentrant=t.domainReentrant||!1,this.domainReentrant){if(typeof process>"u"||typeof process.domain>"u")throw new Error("Domain-reentrant locks require `process.domain` to exist. Please flip `opts.domainReentrant = false`, use a NodeJS version that still implements Domain, or install a browser polyfill.");this.domains=Object.create(null)}this.timeout=t.timeout||e.DEFAULT_TIMEOUT,this.maxOccupationTime=t.maxOccupationTime||e.DEFAULT_MAX_OCCUPATION_TIME,this.maxExecutionTime=t.maxExecutionTime||e.DEFAULT_MAX_EXECUTION_TIME,t.maxPending===1/0||Number.isInteger(t.maxPending)&&t.maxPending>=0?this.maxPending=t.maxPending:this.maxPending=e.DEFAULT_MAX_PENDING};return e.DEFAULT_TIMEOUT=0,e.DEFAULT_MAX_OCCUPATION_TIME=0,e.DEFAULT_MAX_EXECUTION_TIME=0,e.DEFAULT_MAX_PENDING=1e3,e.prototype.acquire=function(t,n,r,s){if(Array.isArray(t))return this._acquireBatch(t,n,r,s);if(typeof n!="function")throw new Error("You must pass a function to execute");var i=null,o=null,a=null;typeof r!="function"&&(s=r,r=null,a=new this.Promise(function(k,W){i=k,o=W})),s=s||{};var l=!1,c=null,u=null,h=null,d=this,f=function(k,W,S){u&&(clearTimeout(u),u=null),h&&(clearTimeout(h),h=null),k&&(d.queues[t]&&d.queues[t].length===0&&delete d.queues[t],d.domainReentrant&&delete d.domains[t]),l||(a?W?o(W):i(S):typeof r=="function"&&r(W,S),l=!0),k&&d.queues[t]&&d.queues[t].length>0&&d.queues[t].shift()()},g=function(k){if(l)return f(k);c&&(clearTimeout(c),c=null),d.domainReentrant&&k&&(d.domains[t]=process.domain);var W=s.maxExecutionTime||d.maxExecutionTime;if(W&&(h=setTimeout(function(){d.queues[t]&&f(k,new Error("Maximum execution time is exceeded "+t))},W)),n.length===1){var S=!1;try{n(function(C,v){S||(S=!0,f(k,C,v))})}catch(C){S||(S=!0,f(k,C))}}else d._promiseTry(function(){return n()}).then(function(C){f(k,void 0,C)},function(C){f(k,C)})};d.domainReentrant&&process.domain&&(g=process.domain.bind(g));var _=s.maxPending||d.maxPending;if(!d.queues[t])d.queues[t]=[],g(!0);else if(d.domainReentrant&&process.domain&&process.domain===d.domains[t])g(!1);else if(d.queues[t].length>=_)f(!1,new Error("Too many pending tasks in queue "+t));else{var R=function(){g(!0)};s.skipQueue?d.queues[t].unshift(R):d.queues[t].push(R);var b=s.timeout||d.timeout;b&&(c=setTimeout(function(){c=null,f(!1,new Error("async-lock timed out in queue "+t))},b))}var F=s.maxOccupationTime||d.maxOccupationTime;if(F&&(u=setTimeout(function(){d.queues[t]&&f(!1,new Error("Maximum occupation time is exceeded in queue "+t))},F)),a)return a},e.prototype._acquireBatch=function(t,n,r,s){typeof r!="function"&&(s=r,r=null);var i=this,o=function(l,c){return function(u){i.acquire(l,c,u,s)}},a=t.reduceRight(function(l,c){return o(c,l)},n);if(typeof r=="function")a(r);else return new this.Promise(function(l,c){a.length===1?a(function(u,h){u?c(u):l(h)}):l(a())})},e.prototype.isBusy=function(t){return t?!!this.queues[t]:Object.keys(this.queues).length>0},e.prototype._promiseTry=function(t){try{return this.Promise.resolve(t())}catch(n){return this.Promise.reject(n)}},oi=e,oi}var ai,Ia;function Yd(){return Ia||(Ia=1,ai=Wd()),ai}var Vd=Yd();const zd=wt(Vd),Gd=new Set(["true","false"]);function Kd(e){return Gd.has(e.toLowerCase())}const Jn="__INTERNAL_EDITOR__",fo=`${Jn}DOCS_NORMAL`,mo=`${Jn}DOCS_FORMULA_BAR`,Ul=`${Jn}ZEN_EDITOR`,Pl=`${Jn}COMMENT_EDITOR`,kl=`\r
|
|
2
|
+
`,Fl="isRowStylePrecedeColumnStyle",Hl=Symbol("AUTO_HEIGHT_FOR_MERGED_CELLS");function Xd(e){return`${Jn}${e}`}function Bl(e){return e.startsWith(Jn)}function qd(e){return e===Pl}function Jd(e,t){t.forEach(n=>e.add(n))}function $l(e,t){t.forEach(([n])=>{e.has(n)&&e.get(n)})}function jl(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||!e||typeof t!="object"||!t)return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;const s=Object.prototype.hasOwnProperty.bind(t);for(let i=0;i<n.length;i++){const o=n[i];if(!s(o))return!1;const a=e[o],l=t[o];if(a!==l)return!1}return!0}class ws extends Error{constructor(t){super(t),this.name="CustomCommandExecutionError"}}class Zd extends ws{constructor(){super("Canceled by facade"),this.name="CanceledError"}}function Qd(e,t=16){let n=0,r=null;return function(...i){const o=Date.now();o-n<t?(r&&clearTimeout(r),r=setTimeout(()=>{n=o,e.apply(this,i)},t)):(n=o,e.apply(this,i))}}var kn=(e=>(e[e.Style=1]="Style",e[e.Value=2]="Value",e))(kn||{});function ef(e){return`sheet_interceptor_${e}`}const Wl=e=>function(t,n){let r=-1,s=t;for(let i=0;i<=e.length;i++){if(i<=r)throw new Error("[SheetInterceptorService]: next() called multiple times!");if(r=i,i===e.length)return s;const o=e[i];let a=!1;if(s=o.handler(s,n,l=>(a=!0,l)),!a)break}return s};class tf{constructor(t){p(this,"_interceptorsByName",new Map);p(this,"_interceptorPoints");this._interceptorPoints=t}fetchThroughInterceptors(t,n){const r=t;let s=this._interceptorsByName.get(r);return n&&(s=s.filter(n)),Wl(s||[])}intercept(t,n){const r=t;this._interceptorsByName.has(r)||this._interceptorsByName.set(r,[]);const s=this._interceptorsByName.get(r);return s.push(n),this._interceptorsByName.set(r,s.sort((i,o)=>{var a,l;return((a=o.priority)!=null?a:0)-((l=i.priority)!=null?l:0)})),()=>kr(this._interceptorsByName.get(r),n)}getInterceptPoints(){return this._interceptorPoints}dispose(){this._interceptorsByName.clear()}}function nf(e){return`sheet_async_interceptor_${e}`}const rf=e=>async function(t,n){let r=-1,s=t;for(let i=0;i<=e.length;i++){if(i<=r)throw new Error("[SheetInterceptorService]: next() called multiple times!");if(r=i,i===e.length)return s;const o=e[i];let a=!1;if(s=await o.handler(s,n,async l=>(a=!0,l)),!a)break}return s};class sf{constructor(t){p(this,"_asyncInterceptorsByName",new Map);p(this,"_asyncInterceptorPoints");this._asyncInterceptorPoints=t}fetchThroughAsyncInterceptors(t,n){const r=t;let s=this._asyncInterceptorsByName.get(r);return n&&(s=s.filter(n)),rf(s||[])}async interceptAsync(t,n){const r=t;this._asyncInterceptorsByName.has(r)||this._asyncInterceptorsByName.set(r,[]);const s=this._asyncInterceptorsByName.get(r);return s.push(n),this._asyncInterceptorsByName.set(r,s.sort((i,o)=>{var a,l;return((a=o.priority)!=null?a:0)-((l=i.priority)!=null?l:0)})),()=>kr(this._asyncInterceptorsByName.get(r),n)}getInterceptPoints(){return this._asyncInterceptorPoints}dispose(){this._asyncInterceptorsByName.clear()}}function Yl(e){return e.map(t=>t/255)}function Vl(e){return e.map(t=>Math.round(t*255))}function of([e,t,n]){const r=Math.max(e,t,n),s=Math.min(e,t,n),i=(r+s)/2;let o=0,a=0;if(r!==s){const l=r-s;switch(a=i>.5?l/(2-r-s):l/(r+s),r){case e:o=(t-n)/l+(t<n?6:0);break;case t:o=(n-e)/l+2;break;case n:o=(e-t)/l+4;break}o/=6}return[o,a,i]}function vs(e,t,n){const r=[e,t,n].map(s=>s<=.03928?s/12.92:((s+.055)/1.055)**2.4);return .2126*r[0]+.7152*r[1]+.0722*r[2]}function Sa(e,t){return(Math.max(e,t)+.05)/(Math.min(e,t)+.05)}function af(e,t,n){let r,s,i;if(t===0)r=s=i=n;else{const o=(c,u,h)=>{let d=h;return d<0&&(d+=1),d>1&&(d-=1),d<.16666666666666666?c+(u-c)*6*d:d<.5?u:d<.6666666666666666?c+(u-c)*(.6666666666666666-d)*6:c},a=n<.5?n*(1+t):n+t-n*t,l=2*n-a;r=o(l,a,e+1/3),s=o(l,a,e),i=o(l,a,e-1/3)}return[r,s,i]}const li={r:1,g:1,b:1},ci={r:0,g:0,b:0},lf=vs(li.r,li.g,li.b),cf=vs(ci.r,ci.g,ci.b);function uf(e){const t=vs(e[0],e[1],e[2]),n=Sa(lf,t),r=of(e);let s=1-r[2],i,o,a;do i=af(r[0],r[1],s),o=vs(i[0],i[1],i[2]),a=Sa(o,cf),s+=.01;while(s<=1&&s>=0&&Math.abs(a-n)<.01);return i}function hf(e){return Vl(uf(Yl(e)))}const Et=[[.333,-.667,-.667,0,1],[-.667,.333,-.667,0,1],[-.667,-.667,.333,0,1],[0,0,0,1,0]];function df(e){const t=e[0],n=e[1],r=e[2];let s=[Et[0][0]*t+Et[0][1]*n+Et[0][2]*r+Et[0][4],Et[1][0]*t+Et[1][1]*n+Et[1][2]*r+Et[1][4],Et[2][0]*t+Et[2][1]*n+Et[2][2]*r+Et[2][4]];return s=s.map(i=>i>1?1:i<0?0:i),s}function ff(e){return Vl(df(Yl(e)))}var zl=typeof global=="object"&&global&&global.Object===Object&&global,mf=typeof self=="object"&&self&&self.Object===Object&&self,wn=zl||mf||Function("return this")(),Gn=wn.Symbol,Gl=Object.prototype,gf=Gl.hasOwnProperty,_f=Gl.toString,rr=Gn?Gn.toStringTag:void 0;function pf(e){var t=gf.call(e,rr),n=e[rr];try{e[rr]=void 0;var r=!0}catch{}var s=_f.call(e);return r&&(t?e[rr]=n:delete e[rr]),s}var Ef=Object.prototype,Cf=Ef.toString;function Rf(e){return Cf.call(e)}var If="[object Null]",Sf="[object Undefined]",Oa=Gn?Gn.toStringTag:void 0;function Fr(e){return e==null?e===void 0?Sf:If:Oa&&Oa in Object(e)?pf(e):Rf(e)}function Zn(e){return e!=null&&typeof e=="object"}var Of="[object Symbol]";function $s(e){return typeof e=="symbol"||Zn(e)&&Fr(e)==Of}function wf(e,t){for(var n=-1,r=e==null?0:e.length,s=Array(r);++n<r;)s[n]=t(e[n],n,e);return s}var Kn=Array.isArray,wa=Gn?Gn.prototype:void 0,va=wa?wa.toString:void 0;function Kl(e){if(typeof e=="string")return e;if(Kn(e))return wf(e,Kl)+"";if($s(e))return va?va.call(e):"";var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}var vf=/\s/;function bf(e){for(var t=e.length;t--&&vf.test(e.charAt(t)););return t}var yf=/^\s+/;function Af(e){return e&&e.slice(0,bf(e)+1).replace(yf,"")}function Ot(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var ba=NaN,Tf=/^[-+]0x[0-9a-f]+$/i,Nf=/^0b[01]+$/i,Mf=/^0o[0-7]+$/i,Df=parseInt;function ya(e){if(typeof e=="number")return e;if($s(e))return ba;if(Ot(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Ot(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=Af(e);var n=Nf.test(e);return n||Mf.test(e)?Df(e.slice(2),n?2:8):Tf.test(e)?ba:+e}function Xl(e){return e}var Lf="[object AsyncFunction]",xf="[object Function]",Uf="[object GeneratorFunction]",Pf="[object Proxy]";function go(e){if(!Ot(e))return!1;var t=Fr(e);return t==xf||t==Uf||t==Lf||t==Pf}var ui=wn["__core-js_shared__"],Aa=(function(){var e=/[^.]+$/.exec(ui&&ui.keys&&ui.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""})();function kf(e){return!!Aa&&Aa in e}var Ff=Function.prototype,Hf=Ff.toString;function Bf(e){if(e!=null){try{return Hf.call(e)}catch{}try{return e+""}catch{}}return""}var $f=/[\\^$.*+?()[\]{}|]/g,jf=/^\[object .+?Constructor\]$/,Wf=Function.prototype,Yf=Object.prototype,Vf=Wf.toString,zf=Yf.hasOwnProperty,Gf=RegExp("^"+Vf.call(zf).replace($f,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Kf(e){if(!Ot(e)||kf(e))return!1;var t=go(e)?Gf:jf;return t.test(Bf(e))}function Xf(e,t){return e==null?void 0:e[t]}function _o(e,t){var n=Xf(e,t);return Kf(n)?n:void 0}var Ta=Object.create,qf=(function(){function e(){}return function(t){if(!Ot(t))return{};if(Ta)return Ta(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}})();function Jf(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function Zf(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}var Qf=800,em=16,tm=Date.now;function nm(e){var t=0,n=0;return function(){var r=tm(),s=em-(r-n);if(n=r,s>0){if(++t>=Qf)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function rm(e){return function(){return e}}var bs=(function(){try{var e=_o(Object,"defineProperty");return e({},"",{}),e}catch{}})(),sm=bs?function(e,t){return bs(e,"toString",{configurable:!0,enumerable:!1,value:rm(t),writable:!0})}:Xl,im=nm(sm),om=9007199254740991,am=/^(?:0|[1-9]\d*)$/;function po(e,t){var n=typeof e;return t=t==null?om:t,!!t&&(n=="number"||n!="symbol"&&am.test(e))&&e>-1&&e%1==0&&e<t}function Eo(e,t,n){t=="__proto__"&&bs?bs(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function js(e,t){return e===t||e!==e&&t!==t}var lm=Object.prototype,cm=lm.hasOwnProperty;function ql(e,t,n){var r=e[t];(!(cm.call(e,t)&&js(r,n))||n===void 0&&!(t in e))&&Eo(e,t,n)}function um(e,t,n,r){var s=!n;n||(n={});for(var i=-1,o=t.length;++i<o;){var a=t[i],l=void 0;l===void 0&&(l=e[a]),s?Eo(n,a,l):ql(n,a,l)}return n}var Na=Math.max;function hm(e,t,n){return t=Na(t===void 0?e.length-1:t,0),function(){for(var r=arguments,s=-1,i=Na(r.length-t,0),o=Array(i);++s<i;)o[s]=r[t+s];s=-1;for(var a=Array(t+1);++s<t;)a[s]=r[s];return a[t]=n(o),Jf(e,this,a)}}function dm(e,t){return im(hm(e,t,Xl),e+"")}var fm=9007199254740991;function Jl(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=fm}function Co(e){return e!=null&&Jl(e.length)&&!go(e)}function mm(e,t,n){if(!Ot(n))return!1;var r=typeof t;return(r=="number"?Co(n)&&po(t,n.length):r=="string"&&t in n)?js(n[t],e):!1}function Zl(e){return dm(function(t,n){var r=-1,s=n.length,i=s>1?n[s-1]:void 0,o=s>2?n[2]:void 0;for(i=e.length>3&&typeof i=="function"?(s--,i):void 0,o&&mm(n[0],n[1],o)&&(i=s<3?void 0:i,s=1),t=Object(t);++r<s;){var a=n[r];a&&e(t,a,r,i)}return t})}var gm=Object.prototype;function Ql(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||gm;return e===n}function _m(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}var pm="[object Arguments]";function Ma(e){return Zn(e)&&Fr(e)==pm}var ec=Object.prototype,Em=ec.hasOwnProperty,Cm=ec.propertyIsEnumerable,xi=Ma((function(){return arguments})())?Ma:function(e){return Zn(e)&&Em.call(e,"callee")&&!Cm.call(e,"callee")};function Rm(){return!1}var tc=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Da=tc&&typeof module=="object"&&module&&!module.nodeType&&module,Im=Da&&Da.exports===tc,La=Im?wn.Buffer:void 0,Sm=La?La.isBuffer:void 0,nc=Sm||Rm,Om="[object Arguments]",wm="[object Array]",vm="[object Boolean]",bm="[object Date]",ym="[object Error]",Am="[object Function]",Tm="[object Map]",Nm="[object Number]",Mm="[object Object]",Dm="[object RegExp]",Lm="[object Set]",xm="[object String]",Um="[object WeakMap]",Pm="[object ArrayBuffer]",km="[object DataView]",Fm="[object Float32Array]",Hm="[object Float64Array]",Bm="[object Int8Array]",$m="[object Int16Array]",jm="[object Int32Array]",Wm="[object Uint8Array]",Ym="[object Uint8ClampedArray]",Vm="[object Uint16Array]",zm="[object Uint32Array]",He={};He[Fm]=He[Hm]=He[Bm]=He[$m]=He[jm]=He[Wm]=He[Ym]=He[Vm]=He[zm]=!0;He[Om]=He[wm]=He[Pm]=He[vm]=He[km]=He[bm]=He[ym]=He[Am]=He[Tm]=He[Nm]=He[Mm]=He[Dm]=He[Lm]=He[xm]=He[Um]=!1;function Gm(e){return Zn(e)&&Jl(e.length)&&!!He[Fr(e)]}function Km(e){return function(t){return e(t)}}var rc=typeof exports=="object"&&exports&&!exports.nodeType&&exports,vr=rc&&typeof module=="object"&&module&&!module.nodeType&&module,Xm=vr&&vr.exports===rc,hi=Xm&&zl.process,xa=(function(){try{var e=vr&&vr.require&&vr.require("util").types;return e||hi&&hi.binding&&hi.binding("util")}catch{}})(),Ua=xa&&xa.isTypedArray,sc=Ua?Km(Ua):Gm;function qm(e,t){var n=Kn(e),r=!n&&xi(e),s=!n&&!r&&nc(e),i=!n&&!r&&!s&&sc(e),o=n||r||s||i,a=o?_m(e.length,String):[],l=a.length;for(var c in e)o&&(c=="length"||s&&(c=="offset"||c=="parent")||i&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||po(c,l))||a.push(c);return a}function Jm(e,t){return function(n){return e(t(n))}}function Zm(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}var Qm=Object.prototype,eg=Qm.hasOwnProperty;function tg(e){if(!Ot(e))return Zm(e);var t=Ql(e),n=[];for(var r in e)r=="constructor"&&(t||!eg.call(e,r))||n.push(r);return n}function ic(e){return Co(e)?qm(e):tg(e)}var ng=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,rg=/^\w*$/;function sg(e,t){if(Kn(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||$s(e)?!0:rg.test(e)||!ng.test(e)||t!=null&&e in Object(t)}var Tr=_o(Object,"create");function ig(){this.__data__=Tr?Tr(null):{},this.size=0}function og(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var ag="__lodash_hash_undefined__",lg=Object.prototype,cg=lg.hasOwnProperty;function ug(e){var t=this.__data__;if(Tr){var n=t[e];return n===ag?void 0:n}return cg.call(t,e)?t[e]:void 0}var hg=Object.prototype,dg=hg.hasOwnProperty;function fg(e){var t=this.__data__;return Tr?t[e]!==void 0:dg.call(t,e)}var mg="__lodash_hash_undefined__";function gg(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Tr&&t===void 0?mg:t,this}function In(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}In.prototype.clear=ig;In.prototype.delete=og;In.prototype.get=ug;In.prototype.has=fg;In.prototype.set=gg;function _g(){this.__data__=[],this.size=0}function Ws(e,t){for(var n=e.length;n--;)if(js(e[n][0],t))return n;return-1}var pg=Array.prototype,Eg=pg.splice;function Cg(e){var t=this.__data__,n=Ws(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():Eg.call(t,n,1),--this.size,!0}function Rg(e){var t=this.__data__,n=Ws(t,e);return n<0?void 0:t[n][1]}function Ig(e){return Ws(this.__data__,e)>-1}function Sg(e,t){var n=this.__data__,r=Ws(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function Kt(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}Kt.prototype.clear=_g;Kt.prototype.delete=Cg;Kt.prototype.get=Rg;Kt.prototype.has=Ig;Kt.prototype.set=Sg;var oc=_o(wn,"Map");function Og(){this.size=0,this.__data__={hash:new In,map:new(oc||Kt),string:new In}}function wg(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function Ys(e,t){var n=e.__data__;return wg(t)?n[typeof t=="string"?"string":"hash"]:n.map}function vg(e){var t=Ys(this,e).delete(e);return this.size-=t?1:0,t}function bg(e){return Ys(this,e).get(e)}function yg(e){return Ys(this,e).has(e)}function Ag(e,t){var n=Ys(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}function ln(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}ln.prototype.clear=Og;ln.prototype.delete=vg;ln.prototype.get=bg;ln.prototype.has=yg;ln.prototype.set=Ag;var Tg="Expected a function";function Ro(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(Tg);var n=function(){var r=arguments,s=t?t.apply(this,r):r[0],i=n.cache;if(i.has(s))return i.get(s);var o=e.apply(this,r);return n.cache=i.set(s,o)||i,o};return n.cache=new(Ro.Cache||ln),n}Ro.Cache=ln;var Ng=500;function Mg(e){var t=Ro(e,function(r){return n.size===Ng&&n.clear(),r}),n=t.cache;return t}var Dg=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Lg=/\\(\\)?/g,xg=Mg(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(Dg,function(n,r,s,i){t.push(s?i.replace(Lg,"$1"):r||n)}),t});function Ug(e){return e==null?"":Kl(e)}function ac(e,t){return Kn(e)?e:sg(e,t)?[e]:xg(Ug(e))}function lc(e){if(typeof e=="string"||$s(e))return e;var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function Pg(e,t){t=ac(t,e);for(var n=0,r=t.length;e!=null&&n<r;)e=e[lc(t[n++])];return n&&n==r?e:void 0}function cc(e,t,n){var r=e==null?void 0:Pg(e,t);return r===void 0?n:r}var uc=Jm(Object.getPrototypeOf,Object),kg="[object Object]",Fg=Function.prototype,Hg=Object.prototype,hc=Fg.toString,Bg=Hg.hasOwnProperty,$g=hc.call(Object);function jg(e){if(!Zn(e)||Fr(e)!=kg)return!1;var t=uc(e);if(t===null)return!0;var n=Bg.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&hc.call(n)==$g}function Wg(){this.__data__=new Kt,this.size=0}function Yg(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function Vg(e){return this.__data__.get(e)}function zg(e){return this.__data__.has(e)}var Gg=200;function Kg(e,t){var n=this.__data__;if(n instanceof Kt){var r=n.__data__;if(!oc||r.length<Gg-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new ln(r)}return n.set(e,t),this.size=n.size,this}function Qn(e){var t=this.__data__=new Kt(e);this.size=t.size}Qn.prototype.clear=Wg;Qn.prototype.delete=Yg;Qn.prototype.get=Vg;Qn.prototype.has=zg;Qn.prototype.set=Kg;var dc=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Pa=dc&&typeof module=="object"&&module&&!module.nodeType&&module,Xg=Pa&&Pa.exports===dc,ka=Xg?wn.Buffer:void 0;ka&&ka.allocUnsafe;function qg(e,t){return e.slice()}var Fa=wn.Uint8Array;function Jg(e){var t=new e.constructor(e.byteLength);return new Fa(t).set(new Fa(e)),t}function Zg(e,t){var n=Jg(e.buffer);return new e.constructor(n,e.byteOffset,e.length)}function Qg(e){return typeof e.constructor=="function"&&!Ql(e)?qf(uc(e)):{}}function e_(e){return function(t,n,r){for(var s=-1,i=Object(t),o=r(t),a=o.length;a--;){var l=o[++s];if(n(i[l],l,i)===!1)break}return t}}var t_=e_(),di=function(){return wn.Date.now()},n_="Expected a function",r_=Math.max,s_=Math.min;function i_(e,t,n){var r,s,i,o,a,l,c=0,u=!1,h=!1,d=!0;if(typeof e!="function")throw new TypeError(n_);t=ya(t)||0,Ot(n)&&(u=!!n.leading,h="maxWait"in n,i=h?r_(ya(n.maxWait)||0,t):i,d="trailing"in n?!!n.trailing:d);function f(C){var v=r,A=s;return r=s=void 0,c=C,o=e.apply(A,v),o}function g(C){return c=C,a=setTimeout(b,t),u?f(C):o}function _(C){var v=C-l,A=C-c,H=t-v;return h?s_(H,i-A):H}function R(C){var v=C-l,A=C-c;return l===void 0||v>=t||v<0||h&&A>=i}function b(){var C=di();if(R(C))return F(C);a=setTimeout(b,_(C))}function F(C){return a=void 0,d&&r?f(C):(r=s=void 0,o)}function k(){a!==void 0&&clearTimeout(a),c=0,r=l=s=a=void 0}function W(){return a===void 0?o:F(di())}function S(){var C=di(),v=R(C);if(r=arguments,s=this,l=C,v){if(a===void 0)return g(l);if(h)return clearTimeout(a),a=setTimeout(b,t),f(l)}return a===void 0&&(a=setTimeout(b,t)),o}return S.cancel=k,S.flush=W,S}function Ui(e,t,n){(n!==void 0&&!js(e[t],n)||n===void 0&&!(t in e))&&Eo(e,t,n)}function o_(e){return Zn(e)&&Co(e)}function Pi(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}function a_(e){return um(e,ic(e))}function l_(e,t,n,r,s,i,o){var a=Pi(e,n),l=Pi(t,n),c=o.get(l);if(c){Ui(e,n,c);return}var u=i?i(a,l,n+"",e,t,o):void 0,h=u===void 0;if(h){var d=Kn(l),f=!d&&nc(l),g=!d&&!f&&sc(l);u=l,d||f||g?Kn(a)?u=a:o_(a)?u=Zf(a):f?(h=!1,u=qg(l)):g?(h=!1,u=Zg(l)):u=[]:jg(l)||xi(l)?(u=a,xi(a)?u=a_(a):(!Ot(a)||go(a))&&(u=Qg(l))):h=!1}h&&(o.set(l,u),s(u,l,r,i,o),o.delete(l)),Ui(e,n,u)}function Io(e,t,n,r,s){e!==t&&t_(t,function(i,o){if(s||(s=new Qn),Ot(i))l_(e,t,o,n,Io,r,s);else{var a=r?r(Pi(e,o),i,o+"",e,t,s):void 0;a===void 0&&(a=i),Ui(e,o,a)}},ic)}var c_=Zl(function(e,t,n,r){Io(e,t,n,r)}),Vs=Zl(function(e,t,n){Io(e,t,n)});function u_(e,t,n,r){if(!Ot(e))return e;t=ac(t,e);for(var s=-1,i=t.length,o=i-1,a=e;a!=null&&++s<i;){var l=lc(t[s]),c=n;if(l==="__proto__"||l==="constructor"||l==="prototype")return e;if(s!=o){var u=a[l];c=void 0,c===void 0&&(c=Ot(u)?u:po(t[s+1])?[]:{})}ql(a,l,c),a=a[l]}return e}function h_(e,t,n){return e==null?e:u_(e,t,n)}class vn{constructor(){p(this,"cursor",0)}reset(){return this.cursor=0,this}moveCursor(t){this.cursor+=t}moveCursorTo(t){this.cursor=t}}function d_(e,t){for(const n in t)t.hasOwnProperty(n)&&(e[n]=t[n])}function fc(e){return/^-?\d+(\.\d+)?$/.test(e)}function f_(e){return fc(e)?Number(e)<=Number.MAX_SAFE_INTEGER:!1}function m_(e){return Number(e)>Number.MAX_SAFE_INTEGER||e.length>=18}class So{constructor(){p(this,"_data",[])}static create(){return new So}add(t){this._data.indexOf(t)>-1||this._data.push(t)}delete(t){const n=this._data.indexOf(t);this._data.splice(n,1)}getData(){return this._data}}class Oo{constructor(){p(this,"_data",new Map)}static create(){return new Oo}add(t,n){this._data.has(t)||this._data.set(t,n)}delete(t){this._data.delete(t)}getData(){return this._data}}function g_(e){const t=new MessageChannel;let n=!1;const r=()=>{n||e()};return t.port1.onmessage=r,t.port2.postMessage(null),()=>{n=!0,t.port1.onmessage=null,t.port1.close(),t.port2.close()}}async function mc(e){for(const[t,n]of e.entries())try{if(!await n())return{index:t,result:!1}}catch(r){return{index:t,result:!1,error:r}}return{result:!0,index:-1}}function gc(e){for(const[t,n]of e.entries())try{if(!n())return{index:t,result:!1}}catch(r){return{index:t,result:!1,error:r}}return{result:!0,index:-1}}function __(e,t){return t.forEach(n=>e.add(n)),e}function p_(e){return e instanceof le.Subscription||e instanceof le.Subject||e&&"closed"in e&&typeof e.unsubscribe<"u"}function Ye(e){let t=!1;return e?p_(e)?{dispose:()=>e.unsubscribe()}:typeof e=="function"?{dispose:()=>{t||(t=!0,e())}}:e:Ye(()=>{})}class zs{constructor(){p(this,"_disposables",new Set)}add(t){const n=Ye(t);return this._disposables.add(n),{dispose:(r=!1)=>{r||n.dispose(),this._disposables.delete(n)}}}dispose(){this._disposables.forEach(t=>{t.dispose()}),this._disposables.clear()}}class Xe{constructor(){p(this,"_disposed",!1);p(this,"_collection",new zs)}disposeWithMe(t){return this._collection.add(t)}ensureNotDisposed(){if(this._disposed)throw new Error("[Disposable]: object is disposed!")}dispose(){this._disposed||(this._disposed=!0,this._collection.dispose())}}class E_ extends Xe{constructor(){super(...arguments);p(this,"dispose$",new le.Subject)}dispose(){super.dispose(),this.dispose$.next(),this.dispose$.complete()}}class C_ extends Xe{constructor(n){super();p(this,"_ref",0);this._rootDisposable=n}inc(){if(this._disposed)throw new Error("[RCDisposable]: should not ref to a disposed.");this._ref+=1}dec(){this._ref-=1,this._ref===0&&(this._rootDisposable.dispose(),this.dispose())}}var we=(e=>(e[e.UNIVER_UNKNOWN=0]="UNIVER_UNKNOWN",e[e.UNIVER_DOC=1]="UNIVER_DOC",e[e.UNIVER_SHEET=2]="UNIVER_SHEET",e[e.UNIVER_SLIDE=3]="UNIVER_SLIDE",e[e.UNIVER_PROJECT=4]="UNIVER_PROJECT",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e))(we||{}),Ie=(e=>(e[e.Reader=0]="Reader",e[e.Editor=1]="Editor",e[e.Owner=2]="Owner",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e))(Ie||{}),ki=(e=>(e[e.SomeCollaborator=0]="SomeCollaborator",e[e.AllCollaborator=1]="AllCollaborator",e[e.OneSelf=2]="OneSelf",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e))(ki||{});class Gs extends Xe{}const _c=new Set(["ac","ad","ae","aero","af","ag","ai","al","am","ao","aq","ar","arpa","as","asia","at","au","aw","ax","az","ba","bb","bd","be","bf","bg","bh","bi","biz","bj","bm","bn","bo","br","bs","bt","bv","bw","by","bz","ca","cat","cc","cd","cf","cg","ch","ci","ck","cl","cm","cn","co","com","coop","cr","cu","cv","cw","cx","cy","cz","de","dj","dk","dm","do","dz","ec","edu","ee","eg","er","es","et","eu","fi","fj","fk","fm","fo","fr","ga","gb","gd","ge","gf","gg","gh","gi","gl","gm","gn","gov","gp","gq","gr","gs","gt","gu","gw","gy","hk","hm","hn","hr","ht","hu","id","ie","il","im","in","info","int","io","iq","ir","is","it","je","jm","jo","jobs","jp","ke","kg","kh","ki","km","kn","kp","kr","kw","ky","kz","la","lb","lc","li","lk","lr","ls","lt","lu","lv","ly","ma","mc","md","me","mg","mh","mil","mk","ml","mm","mn","mo","mobi","mp","mq","mr","ms","mt","mu","museum","mv","mw","mx","my","mz","na","name","nc","ne","net","nf","ng","ni","nl","no","np","nr","nu","nz","om","onion","org","pa","pe","pf","pg","ph","pk","pl","pm","pn","post","pr","pro","ps","pt","pw","py","qa","re","ro","rs","ru","rw","sa","sb","sc","sd","se","sg","sh","si","sj","sk","sl","sm","sn","so","sr","ss","st","su","sv","sx","sy","sz","tc","td","tel","tf","tg","th","tj","tk","tl","tm","tn","to","tr","tt","tv","tw","tz","ua","ug","uk","us","uy","uz","va","vc","ve","vg","vi","vn","vu","wf","ws","yt","za","zm","zw"]),R_=new RegExp("^(?:(?:(?:https?|ftp):)?\\/\\/)?(?:\\S+(?::\\S*)?@)?(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z0-9\\u00a1-\\uffff][a-z0-9\\u00a1-\\uffff_-]{0,62})?[a-z0-9\\u00a1-\\uffff]\\.)+(?:[a-z\\u00a1-\\uffff]{2,}\\.?))(?::\\d{2,5})?(?:[/?#]\\S*)?$","i");function I_(e){if(!Number.isNaN(+e))return!1;if(e.startsWith("http://localhost:3002")||e.startsWith("localhost:3002"))return!0;if(R_.test(e)){if(pc(e))return!0;try{const r=new URL(Ec(e)).hostname.split(".").pop();if(r&&_c.has(r))return!0}catch{return!1}}return!1}function pc(e){return/^[a-zA-Z]+:\/\//.test(e)}function S_(e){return/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/.test(e)}function Ec(e){return pc(e)?e:S_(e)?`mailto://${e}`:`https://${e}`}function O_(e,t){try{const n=new URL(t),r=n.pathname.endsWith("/")?n.pathname:`${n.pathname}/`,s=e.startsWith("/")?e.substring(1):e;return new URL(s,n.origin+r).toString()}catch(n){return console.error("Error resolving URL with base URL:",n),e}}const w_="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let v_=e=>crypto.getRandomValues(new Uint8Array(e)),b_=(e,t,n)=>{let r=(2<<Math.log2(e.length-1))-1,s=-~(1.6*r*t/e.length);return(i=t)=>{let o="";for(;;){let a=n(s),l=s|0;for(;l--;)if(o+=e[a[l]&r]||"",o.length>=i)return o}}},y_=(e,t=21)=>b_(e,t|0,v_),A_=(e=21)=>{let t="",n=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+=w_[n[e]&63];return t};const Zt=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"];function wo(e,t){const n=Z.getValueType(e),r=Z.getValueType(t);return n!==r?!1:Z.isArray(e)?T_(e,t):Z.isObject(e)?N_(e,t):Z.isDate(e)?e.getTime()===t.getTime():Z.isRegExp(e)?e.toString()===t.toString():e===t}function T_(e,t){if(e.length!==t.length)return!1;for(let n=0,r=e.length;n<r;n++){const s=e[n],i=t[n];if(!wo(s,i))return!1}return!0}function N_(e,t){const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const s of n){if(!r.includes(s))return!1;const i=e[s],o=t[s];if(!wo(i,o))return!1}return!0}class Z{static deleteNull(t){for(const n in t)(t[n]===null||t[n]===void 0)&&delete t[n];return t}static stringAt(t){let n="",r=t;for(;r>=Zt.length;)r/=Zt.length,r-=1,n+=Zt[r%Zt.length];const s=t%Zt.length;return n+=Zt[s],n}static indexAt(t){let n=0;for(let r=0;r<t.length-1;r+=1){const s=t.charCodeAt(r)-65,i=t.length-1-r;n+=Zt.length**i+Zt.length*s}return n+=t.charCodeAt(t.length-1)-65,n}static deleteBlank(t){return Z.isString(t)?t.replace(/\s/g,""):t}static getSystemType(){const t=navigator.userAgent,n=navigator.platform==="Win32"||navigator.platform==="Windows",r=navigator.platform==="Mac68K"||navigator.platform==="MacPPC"||navigator.platform==="Macintosh"||navigator.platform==="MacIntel";if(r)return"Mac";if(navigator.platform==="X11"&&!n&&!r)return"Unix";if(String(navigator.platform).indexOf("Linux")>-1)return"Linux";if(n){if(t.indexOf("Windows NT 5.0")>-1||t.indexOf("Windows 2000")>-1)return"Windows 2000";if(t.indexOf("Windows NT 5.1")>-1||t.indexOf("Windows XP")>-1)return"Windows XP";if(t.indexOf("Windows NT 5.2")>-1||t.indexOf("Windows 2003")>-1)return"Windows 2003";if(t.indexOf("Windows NT 6.0")>-1||t.indexOf("Windows Vista")>-1)return"Windows Vista";if(t.indexOf("Windows NT 6.1")>-1||t.indexOf("Windows 7")>-1)return"Windows 7";if(t.indexOf("Windows NT 10")>-1||t.indexOf("Windows 10")>-1)return"Windows 10";if(t.indexOf("Windows NT 11")>-1||t.indexOf("Windows 11")>-1)return"Windows 11"}return"Unknown system"}static getBrowserType(){const t=navigator.userAgent,n=t.indexOf("Opera")>-1,r=t.indexOf("compatible")>-1&&t.indexOf("MSIE")>-1&&!n,s=t.indexOf("Trident")>-1&&t.indexOf("rv:11.0")>-1,i=t.indexOf("Edge")>-1,o=t.indexOf("Firefox")>-1,a=t.indexOf("Safari")>-1&&t.indexOf("Chrome")===-1,l=t.indexOf("Chrome")>-1&&t.indexOf("Safari")>-1;if(r){new RegExp("MSIE (\\d+\\.\\d+);").test(t);const u=Number.parseFloat(RegExp.$1);return u===7?"IE7":u===8?"IE8":u===9?"IE9":u===10?"IE10":"0"}return o?"FF":n?"Opera":a?"Safari":l?"Chrome":i?"Edge":s?"IE11":"Unknown browser"}static getClassName(t){return t.constructor.name}static deepMerge(t,...n){n.forEach(o=>o&&i(o));function r(o,a){o.forEach((l,c)=>{var u,h;if(Z.isArray(l)){const d=(u=a[c])!=null?u:[];a[c]=d,r(l,d);return}if(Z.isObject(l)){const d=(h=a[c])!=null?h:{};a[c]=d,s(l,d);return}a[c]=l})}function s(o,a){Object.keys(o).forEach(l=>{var u,h;const c=o[l];if(Z.isObject(c)){const d=(u=a[l])!=null?u:{};a[l]=d,s(c,d);return}if(Z.isArray(c)){const d=(h=a[l])!=null?h:[];a[l]=d,r(c,d);return}a[l]=c})}function i(o){Object.keys(o).forEach(a=>{var c,u;const l=o[a];if(Z.isArray(l)){const h=(c=t[a])!=null?c:[];t[a]=h,r(l,h);return}if(Z.isObject(l)){const h=(u=t[a])!=null?u:{};t[a]=h,s(l,h);return}t[a]=l})}return t}static numberFixed(t,n){return Number(Number(t).toFixed(n))}static diffValue(t,n){return wo(t,n)}static deepClone(t){if(!this.isDefine(t))return t;if(this.isRegExp(t))return new RegExp(t);if(this.isDate(t))return new Date(t);if(this.isArray(t)){const n=[];return t.forEach((r,s)=>{n[s]=Z.deepClone(r)}),n}if(this.isObject(t)){const n={};return Object.keys(t).forEach(r=>{const s=t[r];n[r]=Z.deepClone(s)}),Object.setPrototypeOf(n,Object.getPrototypeOf(t)),n}return t}static getLanguage(){const t="en-US";return globalThis.navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||t}static getValueType(t){return Object.prototype.toString.apply(t)}static isDefine(t){return t!=null}static isBlank(t){return this.isDefine(t)?this.isString(t)?t.trim()==="":!1:!0}static isPlainObject(t){return this.isDefine(t)?Object.getPrototypeOf(t)===Object.getPrototypeOf({}):!1}static isDate(t){return this.getValueType(t)==="[object Date]"}static isRegExp(t){return this.getValueType(t)==="[object RegExp]"}static isArray(t){return this.getValueType(t)==="[object Array]"}static isString(t){return this.getValueType(t)==="[object String]"}static isNumber(t){return this.getValueType(t)==="[object Number]"}static isStringNumber(t){return!isNaN(Number.parseFloat(t))&&isFinite(t)}static isObject(t){return this.getValueType(t)==="[object Object]"}static isEmptyObject(t){for(const n in t)return!1;return!0}static isTablet(){return/ipad|android|android 3.0|xoom|sch-i800|playbook|tablet|kindle/i.test(navigator.userAgent.toLowerCase())}static isIPhone(){return/iPhone/i.test(navigator.userAgent)}static isLegalUrl(t){return I_(t)}static normalizeUrl(t){return Ec(t)}static topLevelDomainCombiningString(){return[..._c].join("|")}static removeNull(t){return this.isObject(t)&&Object.keys(t).forEach(n=>{const r=t[n];r==null?delete t[n]:Z.removeNull(r)}),t}static fillTwoDimensionalArray(t,n,r){return new Array(t).fill(r).map(s=>new Array(n).fill(r))}static numToWord(t){let n="";for(;t>0;){let r=t%26;r=r===0?r=26:r,n=String.fromCharCode(96+r)+n,t=(t-r)/26}return n.toLocaleUpperCase()}static ABCatNum(t){if(t==null||t.length===0)return Number.NaN;const n=t.toLowerCase().split(""),r=n.length;let s=0,i=0;for(let o=0;o<r;o++)i=n[o].charCodeAt(0)-96,s+=i*26**(r-o-1);return s===0?Number.NaN:s-1}static chatAtABC(t){let i="";for(;t>=0;)i=String.fromCharCode(t%26+97)+i,t=Math.floor(t/26)-1;return i.toUpperCase()}static commonExtend(t,n){const r={};for(const s in t)r[s]=t[s];for(const s in n)n[s]!=null&&(r[s]=n[s]);return r}static hasIntersectionBetweenTwoRanges(t,n,r,s){return n>=r&&s>=t}static isStartValidPosition(t){return/^[A-Za-zА-Яа-яЁё_]/.test(t)}static isValidParameter(t){const n=/[~!@#$%^&*()+=\-{}\[\]\|:;"'<>,?\/ ]+/.test(t),r=t.length<=255;return!n&&r}static clamp(t,n,r){return Math.max(n,Math.min(r,t))}static now(){return performance&&performance.now?performance.now():Date.now()}}function nt(e=21,t){return t?y_(t,e)():A_(e)}function cr(...e){const t={},n=e.length;for(let r=n-1;r>=0;r--){const s=e[r];if(s){const i=Object.keys(s);for(const o of i)t[o]===void 0&&(t[o]=s[o])}}return t}const M_=()=>typeof process<"u"&&process.versions!=null&&process.versions.node!=null;function D_(e){const n=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/\\\*/g,".*").replace(/\\\?/g,".");return new RegExp(`^${n}$`,"i")}var Cc=(e=>(e[e.DEFAULT_SERIES=0]="DEFAULT_SERIES",e[e.ALTERNATE_SERIES=1]="ALTERNATE_SERIES",e))(Cc||{}),xe=(e=>(e[e.NONE=0]="NONE",e[e.THIN=1]="THIN",e[e.HAIR=2]="HAIR",e[e.DOTTED=3]="DOTTED",e[e.DASHED=4]="DASHED",e[e.DASH_DOT=5]="DASH_DOT",e[e.DASH_DOT_DOT=6]="DASH_DOT_DOT",e[e.DOUBLE=7]="DOUBLE",e[e.MEDIUM=8]="MEDIUM",e[e.MEDIUM_DASHED=9]="MEDIUM_DASHED",e[e.MEDIUM_DASH_DOT=10]="MEDIUM_DASH_DOT",e[e.MEDIUM_DASH_DOT_DOT=11]="MEDIUM_DASH_DOT_DOT",e[e.SLANT_DASH_DOT=12]="SLANT_DASH_DOT",e[e.THICK=13]="THICK",e))(xe||{}),Rc=(e=>(e.TOP="top",e.BOTTOM="bottom",e.LEFT="left",e.RIGHT="right",e.NONE="none",e.ALL="all",e.OUTSIDE="outside",e.INSIDE="inside",e.HORIZONTAL="horizontal",e.VERTICAL="vertical",e.TLBR="tlbr",e.TLBC_TLMR="tlbc_tlmr",e.TLBR_TLBC_TLMR="tlbr_tlbc_tlmr",e.BLTR="bl_tr",e.MLTR_BCTR="mltr_bctr",e))(Rc||{}),It=(e=>(e[e.UNSUPPORTED=0]="UNSUPPORTED",e[e.RGB=1]="RGB",e[e.HEX=2]="HEX",e[e.THEME=3]="THEME",e))(It||{}),Ic=(e=>(e[e.ON=0]="ON",e[e.OFF=1]="OFF",e))(Ic||{}),Sc=(e=>(e[e.PASTE_NORMAL=0]="PASTE_NORMAL",e[e.PASTE_NO_BORDERS=1]="PASTE_NO_BORDERS",e[e.PASTE_FORMAT=2]="PASTE_FORMAT",e[e.PASTE_FORMULA=3]="PASTE_FORMULA",e[e.PASTE_DATA_VALIDATION=4]="PASTE_DATA_VALIDATION",e[e.PASTE_VALUES=5]="PASTE_VALUES",e[e.PASTE_CONDITIONAL_FORMATTING=6]="PASTE_CONDITIONAL_FORMATTING",e[e.PASTE_COLUMN_WIDTHS=7]="PASTE_COLUMN_WIDTHS",e))(Sc||{}),Oc=(e=>(e[e.LEFT=0]="LEFT",e[e.RIGHT=1]="RIGHT",e))(Oc||{}),wc=(e=>(e[e.DOCUMENT=0]="DOCUMENT",e[e.PROJECT=1]="PROJECT",e))(wc||{}),vc=(e=>(e[e.COLUMNS=0]="COLUMNS",e[e.ROWS=1]="ROWS",e))(vc||{}),bc=(e=>(e[e.UP=0]="UP",e[e.RIGHT=1]="RIGHT",e[e.DOWN=2]="DOWN",e[e.LEFT=3]="LEFT",e))(bc||{});function L_(e){switch(e){case 3:return 1;case 1:return 3;case 0:return 2;case 2:return 0}}var yc=(e=>(e[e.INTERPOLATION_POINT_TYPE_UNSPECIFIED=0]="INTERPOLATION_POINT_TYPE_UNSPECIFIED",e[e.MIN=1]="MIN",e[e.MAX=2]="MAX",e[e.NUMBER=3]="NUMBER",e[e.PERCENT=4]="PERCENT",e[e.PERCENTILE=5]="PERCENTILE",e))(yc||{}),Hr=(e=>(e.EN_US="enUS",e.FR_FR="frFR",e.ZH_CN="zhCN",e.RU_RU="ruRU",e.ZH_TW="zhTW",e.VI_VN="viVN",e.FA_IR="faIR",e.JA_JP="jaJP",e.KO_KR="koKR",e.ES_ES="esES",e.CA_ES="caES",e))(Hr||{}),ys=(e=>(e[e.PERSON=0]="PERSON",e[e.FILE=1]="FILE",e[e.DATE=2]="DATE",e[e.LOCATION=3]="LOCATION",e[e.EVENT=4]="EVENT",e))(ys||{}),Ac=(e=>(e[e.RANGE=0]="RANGE",e[e.SHEET=1]="SHEET",e))(Ac||{}),Tc=(e=>(e.Line="line",e.LineInv="lineInv",e.Triangle="triangle",e.RtTriangle="rtTriangle",e.Rect="rect",e.Diamond="diamond",e.Parallelogram="parallelogram",e.Trapezoid="trapezoid",e.NonIsocelesTrapezoid="nonIsocelesTrapezoid",e.Pentagon="pentagon",e.Hexagon="hexagon",e.Heptagon="heptagon",e.Octagon="octagon",e.Decagon="decagon",e.Dodecagon="dodecagon",e.Star4="star4",e.Star5="star5",e.Star6="star6",e.Star7="star7",e.Star8="star8",e.Star10="star10",e.Star12="star12",e.Star16="star16",e.Star24="star24",e.Star32="star32",e.RoundRect="roundRect",e.Round1Rect="round1Rect",e.Round2SameRect="round2SameRect",e.Round2DiagRect="round2DiagRect",e.Ellipse="ellipse",e))(Tc||{}),Nc=(e=>(e.RightArrow="rightArrow",e.LeftArrow="leftArrow",e.UpArrow="upArrow",e.DownArrow="downArrow",e.LeftRightArrow="leftRightArrow",e.UpDownArrow="upDownArrow",e.QuadArrow="quadArrow",e.LeftRightUpArrow="leftRightUpArrow",e.BentArrow="bentArrow",e.UturnArrow="uturnArrow",e.CircularArrow="circularArrow",e.NotchedRightArrow="notchedRightArrow",e.HomePlate="homePlate",e.Chevron="chevron",e.LeftCircularArrow="leftCircularArrow",e.LeftRightCircularArrow="leftRightCircularArrow",e))(Nc||{}),Mc=(e=>(e.Plaque="plaque",e.Can="can",e.Cube="cube",e.Bevel="bevel",e.Donut="donut",e.NoSmoking="noSmoking",e.BlockArc="blockArc",e.FoldedCorner="foldedCorner",e))(Mc||{}),Dc=(e=>(e.SmileyFace="smileyFace",e.Heart="heart",e.LightningBolt="lightningBolt",e.Sun="sun",e.Moon="moon",e.Cloud="cloud",e.Arc="arc",e.Backpack="backpack",e.Frame="frame",e.HalfFrame="halfFrame",e.Corner="corner",e.Chord="chord",e.Pie="pie",e.Teardrop="teardrop",e.WedgeRectCallout="wedgeRectCallout",e.WedgeRRectCallout="wedgeRRectCallout",e.WedgeEllipseCallout="wedgeEllipseCallout",e.CloudCallout="cloudCallout",e.BorderCallout1="borderCallout1",e.BorderCallout2="borderCallout2",e.BorderCallout3="borderCallout3",e.AccentCallout1="accentCallout1",e.AccentCallout2="accentCallout2",e.AccentCallout3="accentCallout3",e.Callout1="callout1",e.Callout2="callout2",e.Callout3="callout3",e.ActionButtonBackPrevious="actionButtonBackPrevious",e.ActionButtonEnd="actionButtonEnd",e.ActionButtonForwardNext="actionButtonForwardNext",e.ActionButtonHelp="actionButtonHelp",e.ActionButtonHome="actionButtonHome",e.ActionButtonInformation="actionButtonInformation",e.ActionButtonMovie="actionButtonMovie",e.ActionButtonReturn="actionButtonReturn",e.ActionButtonSound="actionButtonSound",e))(Dc||{}),Lc=(e=>(e[e.RELATIVE_DATE_UNSPECIFIED=0]="RELATIVE_DATE_UNSPECIFIED",e[e.PAST_YEAR=1]="PAST_YEAR",e[e.PAST_MONTH=2]="PAST_MONTH",e[e.PAST_WEEK=3]="PAST_WEEK",e[e.YESTERDAY=4]="YESTERDAY",e[e.TODAY=5]="TODAY",e[e.TOMORROW=6]="TOMORROW",e))(Lc||{}),xc=(e=>(e[e.GRID=0]="GRID",e[e.KANBAN=1]="KANBAN",e[e.GANTT=2]="GANTT",e))(xc||{}),Nr=(e=>(e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.LEFT_TO_RIGHT=1]="LEFT_TO_RIGHT",e[e.RIGHT_TO_LEFT=2]="RIGHT_TO_LEFT",e))(Nr||{}),Uc=(e=>(e[e.DASH=0]="DASH",e[e.DASH_DOT_DOT_HEAVY=1]="DASH_DOT_DOT_HEAVY",e[e.DASH_DOT_HEAVY=2]="DASH_DOT_HEAVY",e[e.DASHED_HEAVY=3]="DASHED_HEAVY",e[e.DASH_LONG=4]="DASH_LONG",e[e.DASH_LONG_HEAVY=5]="DASH_LONG_HEAVY",e[e.DOT_DASH=6]="DOT_DASH",e[e.DOT_DOT_DASH=7]="DOT_DOT_DASH",e[e.DOTTED=8]="DOTTED",e[e.DOTTED_HEAVY=9]="DOTTED_HEAVY",e[e.DOUBLE=10]="DOUBLE",e[e.NONE=11]="NONE",e[e.SINGLE=12]="SINGLE",e[e.THICK=13]="THICK",e[e.WAVE=14]="WAVE",e[e.WAVY_DOUBLE=15]="WAVY_DOUBLE",e[e.WAVY_HEAVY=16]="WAVY_HEAVY",e[e.WORDS=17]="WORDS",e))(Uc||{}),Nt=(e=>(e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.LEFT=1]="LEFT",e[e.CENTER=2]="CENTER",e[e.RIGHT=3]="RIGHT",e[e.JUSTIFIED=4]="JUSTIFIED",e[e.BOTH=5]="BOTH",e[e.DISTRIBUTED=6]="DISTRIBUTED",e))(Nt||{}),pn=(e=>(e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.TOP=1]="TOP",e[e.MIDDLE=2]="MIDDLE",e[e.BOTTOM=3]="BOTTOM",e))(pn||{}),Sn=(e=>(e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.OVERFLOW=1]="OVERFLOW",e[e.CLIP=2]="CLIP",e[e.WRAP=3]="WRAP",e))(Sn||{}),As=(e=>(e[e.NORMAL=0]="NORMAL",e[e.ITALIC=1]="ITALIC",e))(As||{}),Ts=(e=>(e[e.NORMAL=0]="NORMAL",e[e.BOLD=1]="BOLD",e))(Ts||{}),Vt=(e=>(e[e.NORMAL=1]="NORMAL",e[e.SUBSCRIPT=2]="SUBSCRIPT",e[e.SUPERSCRIPT=3]="SUPERSCRIPT",e))(Vt||{}),ie=(e=>(e[e.FALSE=0]="FALSE",e[e.TRUE=1]="TRUE",e))(ie||{}),nn=(e=>(e[e.STRING=1]="STRING",e[e.NUMBER=2]="NUMBER",e[e.BOOLEAN=3]="BOOLEAN",e[e.FORCE_STRING=4]="FORCE_STRING",e))(nn||{}),ot=(e=>(e[e.DARK1=0]="DARK1",e[e.LIGHT1=1]="LIGHT1",e[e.DARK2=2]="DARK2",e[e.LIGHT2=3]="LIGHT2",e[e.ACCENT1=4]="ACCENT1",e[e.ACCENT2=5]="ACCENT2",e[e.ACCENT3=6]="ACCENT3",e[e.ACCENT4=7]="ACCENT4",e[e.ACCENT5=8]="ACCENT5",e[e.ACCENT6=9]="ACCENT6",e[e.HYPERLINK=10]="HYPERLINK",e[e.FOLLOWED_HYPERLINK=11]="FOLLOWED_HYPERLINK",e))(ot||{}),Ks=(e=>(e.OFFICE="Office",e.OFFICE_2007_2010="Office 2007-2010",e.GRAYSCALE="Grayscale",e.BLUE_WARM="Blue Warm",e.BLUE="Blue",e.BLUE_II="Blue II",e.BLUE_GREEN="Blue Green",e.GREEN="Green",e.GREEN_YELLOW="Green Yellow",e.YELLOW="Yellow",e.YELLOW_ORANGE="Yellow Orange",e.ORANGE="Orange",e.ORANGE_RED="Orange Red",e.RED_ORANGE="Red Orange",e.RED="Red",e.RED_VIOLET="Red Violet",e.VIOLET="Violet",e.VIOLET_II="Violet II",e.MEDIAN="Median",e.PAPER="Paper",e.MARQUEE="Marquee",e.SLIPSTREAM="Slipstream",e.Aspect="Aspect",e))(Ks||{}),Pc=(e=>(e[e.character=0]="character",e[e.paragraph=1]="paragraph",e[e.table=2]="table",e[e.numbering=3]="numbering",e))(Pc||{}),kc=(e=>(e[e.TAB=0]="TAB",e[e.SPACE=1]="SPACE",e[e.NOTHING=2]="NOTHING",e))(kc||{}),fe=(e=>(e[e.BULLET=0]="BULLET",e[e.NONE=1]="NONE",e[e.DECIMAL=2]="DECIMAL",e[e.DECIMAL_ZERO=3]="DECIMAL_ZERO",e[e.UPPER_LETTER=4]="UPPER_LETTER",e[e.LOWER_LETTER=5]="LOWER_LETTER",e[e.UPPER_ROMAN=6]="UPPER_ROMAN",e[e.LOWER_ROMAN=7]="LOWER_ROMAN",e[e.ORDINAL=8]="ORDINAL",e[e.CARDINAL_TEXT=9]="CARDINAL_TEXT",e[e.ORDINAL_TEXT=10]="ORDINAL_TEXT",e[e.HEX=11]="HEX",e[e.CHICAGO=12]="CHICAGO",e[e.IDEOGRAPH_DIGITAL=13]="IDEOGRAPH_DIGITAL",e[e.JAPANESE_COUNTING=14]="JAPANESE_COUNTING",e[e.AIUEO=15]="AIUEO",e[e.IROHA=16]="IROHA",e[e.DECIMAL_FULL_WIDTH=17]="DECIMAL_FULL_WIDTH",e[e.DECIMAL_HALF_WIDTH=18]="DECIMAL_HALF_WIDTH",e[e.JAPANESE_LEGAL=19]="JAPANESE_LEGAL",e[e.JAPANESE_DIGITAL_TEN_THOUSAND=20]="JAPANESE_DIGITAL_TEN_THOUSAND",e[e.DECIMAL_ENCLOSED_CIRCLE=21]="DECIMAL_ENCLOSED_CIRCLE",e[e.DECIMAL_FULL_WIDTH2=22]="DECIMAL_FULL_WIDTH2",e[e.AIUEO_FULL_WIDTH=23]="AIUEO_FULL_WIDTH",e[e.IROHA_FULL_WIDTH=24]="IROHA_FULL_WIDTH",e[e.GANADA=25]="GANADA",e[e.CHOSUNG=26]="CHOSUNG",e[e.DECIMAL_ENCLOSED_FULLSTOP=27]="DECIMAL_ENCLOSED_FULLSTOP",e[e.DECIMAL_ENCLOSED_PAREN=28]="DECIMAL_ENCLOSED_PAREN",e[e.DECIMAL_ENCLOSED_CIRCLE_CHINESE=29]="DECIMAL_ENCLOSED_CIRCLE_CHINESE",e[e.IDEOGRAPH_ENCLOSED_CIRCLE=30]="IDEOGRAPH_ENCLOSED_CIRCLE",e[e.IDEOGRAPH_TRADITIONAL=31]="IDEOGRAPH_TRADITIONAL",e[e.IDEOGRAPH_ZODIAC=32]="IDEOGRAPH_ZODIAC",e[e.IDEOGRAPH_ZODIAC_TRADITIONAL=33]="IDEOGRAPH_ZODIAC_TRADITIONAL",e[e.TAIWANESE_COUNTING=34]="TAIWANESE_COUNTING",e[e.IDEOGRAPH_LEGAL_TRADITIONAL=35]="IDEOGRAPH_LEGAL_TRADITIONAL",e[e.TAIWANESE_COUNTING_THOUSAND=36]="TAIWANESE_COUNTING_THOUSAND",e[e.TAIWANESE_DIGITAL=37]="TAIWANESE_DIGITAL",e[e.CHINESE_COUNTING=38]="CHINESE_COUNTING",e[e.CHINESE_LEGAL_SIMPLIFIED=39]="CHINESE_LEGAL_SIMPLIFIED",e[e.CHINESE_COUNTING_THOUSAND=40]="CHINESE_COUNTING_THOUSAND",e[e.KOREAN_DIGITAL=41]="KOREAN_DIGITAL",e[e.KOREAN_COUNTING=42]="KOREAN_COUNTING",e[e.KOREAN_LEGAL=43]="KOREAN_LEGAL",e[e.KOREAN_DIGITAL2=44]="KOREAN_DIGITAL2",e[e.VIETNAMESE_COUNTING=45]="VIETNAMESE_COUNTING",e[e.RUSSIAN_LOWER=46]="RUSSIAN_LOWER",e[e.RUSSIAN_UPPER=47]="RUSSIAN_UPPER",e[e.NUMBER_IN_DASH=48]="NUMBER_IN_DASH",e[e.HEBREW1=49]="HEBREW1",e[e.HEBREW2=50]="HEBREW2",e[e.ARABIC_ALPHA=51]="ARABIC_ALPHA",e[e.ARABIC_ABJAD=52]="ARABIC_ABJAD",e[e.HINDI_VOWELS=53]="HINDI_VOWELS",e[e.HINDI_CONSONANTS=54]="HINDI_CONSONANTS",e[e.HINDI_NUMBERS=55]="HINDI_NUMBERS",e[e.HINDI_COUNTING=56]="HINDI_COUNTING",e[e.THAI_LETTERS=57]="THAI_LETTERS",e[e.THAI_NUMBERS=58]="THAI_NUMBERS",e[e.THAI_COUNTING=59]="THAI_COUNTING",e[e.CUSTOM=60]="CUSTOM",e))(fe||{}),Br=(e=>(e[e.BULLET_ALIGNMENT_UNSPECIFIED=0]="BULLET_ALIGNMENT_UNSPECIFIED",e[e.START=1]="START",e[e.CENTER=2]="CENTER",e[e.END=3]="END",e[e.BOTH=4]="BOTH",e))(Br||{}),on=(e=>(e[e.HYPERLINK=0]="HYPERLINK",e[e.FIELD=1]="FIELD",e[e.SDT=2]="SDT",e[e.BOOKMARK=3]="BOOKMARK",e[e.COMMENT=4]="COMMENT",e[e.CUSTOM=5]="CUSTOM",e[e.MENTION=6]="MENTION",e[e.UNI_FORMULA=7]="UNI_FORMULA",e[e.DELTED=9999]="DELTED",e))(on||{}),En=(e=>(e[e.COMMENT=0]="COMMENT",e[e.DELETED=9999]="DELETED",e))(En||{}),Fc=(e=>(e[e.DRAWING=0]="DRAWING",e[e.CUSTOM=1]="CUSTOM",e))(Fc||{}),vo=(e=>(e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.TRADITIONAL=1]="TRADITIONAL",e[e.MODERN=2]="MODERN",e))(vo||{}),Hc=(e=>(e[e.DEFAULT=0]="DEFAULT",e[e.LINES=1]="LINES",e[e.LINES_AND_CHARS=2]="LINES_AND_CHARS",e[e.SNAP_TO_CHARS=3]="SNAP_TO_CHARS",e))(Hc||{}),Bc=(e=>(e[e.SECTION_TYPE_UNSPECIFIED=0]="SECTION_TYPE_UNSPECIFIED",e[e.CONTINUOUS=1]="CONTINUOUS",e[e.NEXT_PAGE=2]="NEXT_PAGE",e[e.EVEN_PAGE=3]="EVEN_PAGE",e[e.ODD_PAGE=4]="ODD_PAGE",e))(Bc||{}),$c=(e=>(e[e.COLUMN_SEPARATOR_STYLE_UNSPECIFIED=0]="COLUMN_SEPARATOR_STYLE_UNSPECIFIED",e[e.NONE=1]="NONE",e[e.BETWEEN_EACH_COLUMN=2]="BETWEEN_EACH_COLUMN",e))($c||{}),jc=(e=>(e[e.NORMAL=0]="NORMAL",e[e.TBRL=1]="TBRL",e[e.LRTBV=2]="LRTBV",e))(jc||{}),Wc=(e=>(e[e.TEXT_RUN=0]="TEXT_RUN",e[e.AUTO_TEXT=1]="AUTO_TEXT",e[e.PAGE_BREAK=2]="PAGE_BREAK",e[e.COLUMN_BREAK=3]="COLUMN_BREAK",e[e.FOOT_NOTE_REFERENCE=4]="FOOT_NOTE_REFERENCE",e[e.HORIZONTAL_RULE=5]="HORIZONTAL_RULE",e[e.EQUATION=6]="EQUATION",e[e.DRAWING=7]="DRAWING",e[e.PERSON=8]="PERSON",e[e.RICH_LINK=9]="RICH_LINK",e))(Wc||{}),Yc=(e=>(e[e.BOTH_SIDES=0]="BOTH_SIDES",e[e.LEFT=1]="LEFT",e[e.RIGHT=2]="RIGHT",e[e.LARGEST=3]="LARGEST",e))(Yc||{}),Vc=(e=>(e[e.INLINE=0]="INLINE",e[e.WRAP_NONE=1]="WRAP_NONE",e[e.WRAP_POLYGON=2]="WRAP_POLYGON",e[e.WRAP_SQUARE=3]="WRAP_SQUARE",e[e.WRAP_THROUGH=4]="WRAP_THROUGH",e[e.WRAP_TIGHT=5]="WRAP_TIGHT",e[e.WRAP_TOP_AND_BOTTOM=6]="WRAP_TOP_AND_BOTTOM",e))(Vc||{}),qe=(e=>(e[e.NAMED_STYLE_TYPE_UNSPECIFIED=0]="NAMED_STYLE_TYPE_UNSPECIFIED",e[e.NORMAL_TEXT=1]="NORMAL_TEXT",e[e.TITLE=2]="TITLE",e[e.SUBTITLE=3]="SUBTITLE",e[e.HEADING_1=4]="HEADING_1",e[e.HEADING_2=5]="HEADING_2",e[e.HEADING_3=6]="HEADING_3",e[e.HEADING_4=7]="HEADING_4",e[e.HEADING_5=8]="HEADING_5",e))(qe||{}),zc=(e=>(e[e.AUTO=0]="AUTO",e[e.AT_LEAST=1]="AT_LEAST",e[e.EXACT=2]="EXACT",e))(zc||{}),Gc=(e=>(e[e.DASH_STYLE_UNSPECIFIED=0]="DASH_STYLE_UNSPECIFIED",e[e.SOLID=1]="SOLID",e[e.DOT=2]="DOT",e[e.DASH=3]="DASH",e))(Gc||{}),Kc=(e=>(e[e.TAB_STOP_ALIGNMENT_UNSPECIFIED=0]="TAB_STOP_ALIGNMENT_UNSPECIFIED",e[e.START=1]="START",e[e.CENTER=2]="CENTER",e[e.END=3]="END",e))(Kc||{}),Xc=(e=>(e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.SPECIFIED=1]="SPECIFIED",e))(Xc||{}),qc=(e=>(e[e.START=0]="START",e[e.CENTER=1]="CENTER",e[e.END=2]="END",e))(qc||{}),Jc=(e=>(e[e.AUTO_FIT=0]="AUTO_FIT",e[e.FIXED=1]="FIXED",e))(Jc||{}),Zc=(e=>(e[e.NONE=0]="NONE",e[e.WRAP=1]="WRAP",e))(Zc||{}),Qc=(e=>(e[e.AUTO=0]="AUTO",e[e.AT_LEAST=1]="AT_LEAST",e[e.EXACT=2]="EXACT",e))(Qc||{}),eu=(e=>(e[e.CONTENT_ALIGNMENT_UNSPECIFIED=0]="CONTENT_ALIGNMENT_UNSPECIFIED",e[e.BOTH=1]="BOTH",e[e.TOP=2]="TOP",e[e.CENTER=3]="CENTER",e[e.BOTTOM=4]="BOTTOM",e))(eu||{}),Fn=(e=>(e.NORMAL="normal",e.BOLD="bold",e.ITALIC="italic",e))(Fn||{}),tu=(e=>(e[e.PAGE=0]="PAGE",e[e.COLUMN=1]="COLUMN",e[e.CHARACTER=2]="CHARACTER",e[e.MARGIN=3]="MARGIN",e[e.INSIDE_MARGIN=4]="INSIDE_MARGIN",e[e.OUTSIDE_MARGIN=5]="OUTSIDE_MARGIN",e[e.LEFT_MARGIN=6]="LEFT_MARGIN",e[e.RIGHT_MARGIN=7]="RIGHT_MARGIN",e))(tu||{}),nu=(e=>(e[e.PAGE=0]="PAGE",e[e.PARAGRAPH=1]="PARAGRAPH",e[e.LINE=2]="LINE",e[e.MARGIN=3]="MARGIN",e[e.TOP_MARGIN=4]="TOP_MARGIN",e[e.BOTTOM_MARGIN=5]="BOTTOM_MARGIN",e[e.INSIDE_MARGIN=6]="INSIDE_MARGIN",e[e.OUTSIDE_MARGIN=7]="OUTSIDE_MARGIN",e))(nu||{}),ru=(e=>(e[e.POINT=0]="POINT",e[e.LINE=1]="LINE",e[e.CHARACTER=2]="CHARACTER",e[e.PIXEL=3]="PIXEL",e[e.PERCENT=4]="PERCENT",e))(ru||{}),su=(e=>(e[e.CENTER=0]="CENTER",e[e.INSIDE=1]="INSIDE",e[e.LEFT=2]="LEFT",e[e.OUTSIDE=3]="OUTSIDE",e[e.RIGHT=4]="RIGHT",e[e.BOTH=5]="BOTH",e[e.DISTRIBUTE=6]="DISTRIBUTE",e))(su||{}),iu=(e=>(e[e.BOTTOM=0]="BOTTOM",e[e.CENTER=1]="CENTER",e[e.INSIDE=2]="INSIDE",e[e.OUTSIDE=3]="OUTSIDE",e[e.TOP=4]="TOP",e))(iu||{}),ou=(e=>(e[e.compressPunctuation=0]="compressPunctuation",e[e.compressPunctuationAndJapaneseKana=1]="compressPunctuationAndJapaneseKana",e[e.doNotCompress=2]="doNotCompress",e))(ou||{}),au=(e=>(e[e.PORTRAIT=0]="PORTRAIT",e[e.LANDSCAPE=1]="LANDSCAPE",e))(au||{}),ht=(e=>(e.Letter="Letter",e.Tabloid="Tabloid",e.Legal="Legal",e.Statement="Statement",e.Executive="Executive",e.Folio="Folio",e.A3="A3",e.A4="A4",e.A5="A5",e.B4="B4",e.B5="B5",e))(ht||{});const x_=["A3","A4","A5","B4","B5","Letter","Tabloid","Legal","Statement","Executive","Folio"];var lu=(e=>(e[e.forward=0]="forward",e[e.backward=1]="backward",e[e.front=2]="front",e[e.back=3]="back",e))(lu||{}),cu=(e=>(e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e[e.DRAWING_IMAGE=0]="DRAWING_IMAGE",e[e.DRAWING_SHAPE=1]="DRAWING_SHAPE",e[e.DRAWING_CHART=2]="DRAWING_CHART",e[e.DRAWING_TABLE=3]="DRAWING_TABLE",e[e.DRAWING_SMART_ART=4]="DRAWING_SMART_ART",e[e.DRAWING_VIDEO=5]="DRAWING_VIDEO",e[e.DRAWING_GROUP=6]="DRAWING_GROUP",e[e.DRAWING_UNIT=7]="DRAWING_UNIT",e[e.DRAWING_DOM=8]="DRAWING_DOM",e))(cu||{}),bo=(e=>(e[e.SLIDE=0]="SLIDE",e[e.MASTER=1]="MASTER",e[e.LAYOUT=2]="LAYOUT",e[e.HANDOUT_MASTER=3]="HANDOUT_MASTER",e[e.NOTES_MASTER=4]="NOTES_MASTER",e))(bo||{}),uu=(e=>(e[e.SHAPE=0]="SHAPE",e[e.IMAGE=1]="IMAGE",e[e.TEXT=2]="TEXT",e[e.SPREADSHEET=3]="SPREADSHEET",e[e.DOCUMENT=4]="DOCUMENT",e[e.SLIDE=5]="SLIDE",e))(uu||{}),hu=(e=>(e[e.RELATIVE_SLIDE_LINK_UNSPECIFIED=0]="RELATIVE_SLIDE_LINK_UNSPECIFIED",e[e.NEXT_SLIDE=1]="NEXT_SLIDE",e[e.PREVIOUS_SLIDE=2]="PREVIOUS_SLIDE",e[e.FIRST_SLIDE=3]="FIRST_SLIDE",e[e.LAST_SLIDE=4]="LAST_SLIDE",e))(hu||{});function U_(e=nt(6),t=Hr.EN_US,n=""){return{id:e,locale:t,title:n,tableSource:{},drawings:{},drawingsOrder:[],headers:{},footers:{},body:{dataStream:`\r
|
|
3
|
+
`,textRuns:[],customBlocks:[],tables:[],paragraphs:[{startIndex:0,paragraphStyle:{spaceAbove:{v:5},lineSpacing:1,spaceBelow:{v:0}}}],sectionBreaks:[{startIndex:1}]},documentStyle:{pageSize:{width:793.3333333333334,height:1122.6666666666667},documentFlavor:vo.TRADITIONAL,marginTop:50,marginBottom:50,marginRight:50,marginLeft:50,renderConfig:{zeroWidthParagraphBreak:ie.FALSE,vertexAngle:0,centerAngle:0,background:{rgb:"#ccc"}},autoHyphenation:ie.TRUE,doNotHyphenateCaps:ie.FALSE,consecutiveHyphenLimit:2,defaultHeaderId:"",defaultFooterId:"",evenPageHeaderId:"",evenPageFooterId:"",firstPageHeaderId:"",firstPageFooterId:"",evenAndOddHeaders:ie.FALSE,useFirstPageHeaderFooter:ie.FALSE,marginHeader:30,marginFooter:30},settings:{}}}var fn={},sr={},Jr={},Ha;function P_(){if(Ha)return Jr;Ha=1,Object.defineProperty(Jr,"__esModule",{value:!0});function e(r,s){if(Array.isArray(s))return!1;for(let i in r)if(!n(r[i],s[i]))return!1;for(let i in s)if(r[i]===void 0)return!1;return!0}function t(r,s){if(!Array.isArray(s)||r.length!==s.length)return!1;for(let i=0;i<r.length;i++)if(!n(r[i],s[i]))return!1;return!0}function n(r,s){return r===s?!0:r===null||s===null||typeof r!="object"||typeof s!="object"?!1:Array.isArray(r)?t(r,s):e(r,s)}return Jr.default=n,Jr}var Zr={},Ba;function k_(){if(Ba)return Zr;Ba=1,Object.defineProperty(Zr,"__esModule",{value:!0});function e(t){if(t===null)return null;if(Array.isArray(t))return t.map(e);if(typeof t=="object"){const n={};for(let r in t)n[r]=e(t[r]);return n}else return t}return Zr.default=e,Zr}var fi={},$a;function du(){return $a||($a=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.eachChildOf=e.advancer=e.readCursor=e.writeCursor=e.WriteCursor=e.ReadCursor=e.isValidPathItem=void 0;function t(u,h){if(!u)throw new Error(h)}const n=u=>u!=null&&typeof u=="object"&&!Array.isArray(u),r=(u,h)=>typeof u==typeof h?u>h:typeof u=="string"&&typeof h=="number";function s(u,h){for(let d in u){const f=d;h.write(f,u[f])}}e.isValidPathItem=u=>typeof u=="number"||typeof u=="string"&&u!=="__proto__";class i{constructor(h=null){this.parents=[],this.indexes=[],this.lcIdx=-1,this.idx=-1,this.container=h}ascend(){t(this.parents.length===this.indexes.length/2),this.idx===0?this.parents.length?(this.lcIdx=this.indexes.pop(),this.container=this.parents.pop(),this.idx=this.indexes.pop()):(this.lcIdx=0,this.idx=-1):(t(this.idx>0),this.idx--,n(this.container[this.idx])&&this.idx--)}getPath(){const h=[];let d=this.container,f=this.parents.length-1,g=this.idx;for(;g>=0;)h.unshift(d[g]),g===0?(g=this.indexes[f*2],d=this.parents[f--]):g-=n(d[g-1])?2:1;return h}}class o extends i{get(){return this.container?this.container.slice(this.idx+1):null}getKey(){return t(this.container!=null,"Invalid call to getKey before cursor descended"),this.container[this.idx]}getComponent(){let h;return this.container&&this.container.length>this.idx+1&&n(h=this.container[this.idx+1])?h:null}descendFirst(){let h=this.idx+1;if(!this.container||h>=this.container.length||n(this.container[h])&&h+1>=this.container.length)return!1;n(this.container[h])&&h++;const d=this.container[h];return Array.isArray(d)?(this.indexes.push(this.idx),this.parents.push(this.container),this.indexes.push(h),this.idx=0,this.container=d):this.idx=h,!0}nextSibling(){if(t(this.parents.length===this.indexes.length/2),this.idx>0||this.parents.length===0)return!1;const h=this.indexes[this.indexes.length-1]+1,d=this.parents[this.parents.length-1];return h>=d.length?!1:(t(!isNaN(h)),this.indexes[this.indexes.length-1]=h,this.container=d[h],!0)}_init(h,d,f,g){this.container=h,this.idx=d,this.parents=f.slice(),this.indexes=g.slice()}clone(){const h=new o;return h._init(this.container,this.idx,this.parents,this.indexes),h}*[Symbol.iterator](){if(this.descendFirst()){do yield this.getKey();while(this.nextSibling());this.ascend()}}traverse(h,d){const f=this.getComponent();f&&d(f,h);for(const g of this)h&&h.descend(g),this.traverse(h,d),h&&h.ascend()}eachPick(h,d){this.traverse(h,(f,g)=>{f.p!=null&&d(f.p,g)})}eachDrop(h,d){this.traverse(h,(f,g)=>{f.d!=null&&d(f.d,g)})}}e.ReadCursor=o;class a extends i{constructor(h=null){super(h),this.pendingDescent=[],this._op=h}flushDescent(){t(this.parents.length===this.indexes.length/2),this.container===null&&(this._op=this.container=[]);for(let h=0;h<this.pendingDescent.length;h++){const d=this.pendingDescent[h];let f=this.idx+1;if(f<this.container.length&&n(this.container[f])&&f++,t(f===this.container.length||!n(this.container[f])),f===this.container.length)this.container.push(d),this.idx=f;else if(this.container[f]===d)this.idx=f;else{if(!Array.isArray(this.container[f])){const g=this.container.splice(f,this.container.length-f);this.container.push(g),this.lcIdx>-1&&(this.lcIdx=f)}for(this.indexes.push(this.idx),this.parents.push(this.container),this.lcIdx!==-1&&(t(r(d,this.container[this.lcIdx][0])),f=this.lcIdx+1,this.lcIdx=-1);f<this.container.length&&r(d,this.container[f][0]);)f++;if(this.indexes.push(f),this.idx=0,f<this.container.length&&this.container[f][0]===d)this.container=this.container[f];else{const g=[d];this.container.splice(f,0,g),this.container=g}}}this.pendingDescent.length=0}reset(){this.lcIdx=-1}getComponent(){this.flushDescent();const h=this.idx+1;if(h<this.container.length&&n(this.container[h]))return this.container[h];{const d={};return this.container.splice(h,0,d),d}}write(h,d){const f=this.getComponent();t(f[h]==null||f[h]===d,"Internal consistency error: Overwritten component. File a bug"),f[h]=d}get(){return this._op}descend(h){if(!e.isValidPathItem(h))throw Error("Invalid JSON key");this.pendingDescent.push(h)}descendPath(h){return this.pendingDescent.push(...h),this}ascend(){this.pendingDescent.length?this.pendingDescent.pop():super.ascend()}mergeTree(h,d=s){if(h===null)return;if(t(Array.isArray(h)),h===this._op)throw Error("Cannot merge into my own tree");const f=this.lcIdx,g=this.parents.length;let _=0;for(let R=0;R<h.length;R++){const b=h[R];typeof b=="string"||typeof b=="number"?(_++,this.descend(b)):Array.isArray(b)?this.mergeTree(b,d):typeof b=="object"&&d(b,this)}for(;_--;)this.ascend();this.lcIdx=this.parents.length===g?f:-1}at(h,d){this.descendPath(h),d(this);for(let f=0;f<h.length;f++)this.ascend();return this}writeAtPath(h,d,f){return this.at(h,()=>this.write(d,f)),this.reset(),this}writeMove(h,d,f=0){return this.writeAtPath(h,"p",f).writeAtPath(d,"d",f)}getPath(){const h=super.getPath();return h.push(...this.pendingDescent),h}}e.WriteCursor=a,e.writeCursor=()=>new a,e.readCursor=u=>new o(u);function l(u,h,d){let f,g;g=f=u?u.descendFirst():!1;function _(R){let b;for(;g;){const F=b=u.getKey();if(R!=null){let k=!1;if(h&&typeof F=="number"&&(b=h(F,u.getComponent()),b<0&&(b=~b,k=!0)),r(b,R))return null;if(b===R&&!k)return u}d&&typeof b=="number"&&d(b,u.getComponent()),g=u.nextSibling()}return null}return _.end=()=>{f&&u.ascend()},_}e.advancer=l;function c(u,h,d){let f,g,_,R;for(f=g=u&&u.descendFirst(),_=R=h&&h.descendFirst();f||_;){let b=f?u.getKey():null,F=_?h.getKey():null;b!==null&&F!==null&&(r(F,b)?F=null:b!==F&&(b=null)),d(b==null?F:b,b!=null?u:null,F!=null?h:null),b!=null&&f&&(f=u.nextSibling()),F!=null&&_&&(_=h.nextSibling())}g&&u.ascend(),R&&h.ascend()}e.eachChildOf=c})(fi)),fi}var mi={},ja;function fu(){return ja||(ja=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ConflictType=void 0,(function(t){t[t.RM_UNEXPECTED_CONTENT=1]="RM_UNEXPECTED_CONTENT",t[t.DROP_COLLISION=2]="DROP_COLLISION",t[t.BLACKHOLE=3]="BLACKHOLE"})(e.ConflictType||(e.ConflictType={}))})(mi)),mi}var Tt={},mn={},Wa;function yo(){return Wa||(Wa=1,Object.defineProperty(mn,"__esModule",{value:!0}),mn.uniToStrPos=mn.strPosToUni=void 0,mn.strPosToUni=(e,t=e.length)=>{let n=0,r=0;for(;r<t;r++){const s=e.charCodeAt(r);s>=55296&&s<=57343&&(n++,r++)}if(r!==t)throw Error("Invalid offset - splits unicode bytes");return r-n},mn.uniToStrPos=(e,t)=>{let n=0;for(;t>0;t--){const r=e.charCodeAt(n);n+=r>=55296&&r<=57343?2:1}return n}),mn}var gi={},Ya;function Fi(){return Ya||(Ya=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.uniSlice=e.dlen=e.eachOp=void 0;const t=yo(),n=S=>{if(!Array.isArray(S))throw Error("Op must be an array of components");let C=null;for(let v=0;v<S.length;v++){const A=S[v];switch(typeof A){case"object":if(typeof A.d!="number"&&typeof A.d!="string")throw Error("Delete must be number or string");if(e.dlen(A.d)<=0)throw Error("Deletes must not be empty");break;case"string":if(!(A.length>0))throw Error("Inserts cannot be empty");break;case"number":if(!(A>0))throw Error("Skip components must be >0");if(typeof C=="number")throw Error("Adjacent skip components should be combined");break}C=A}if(typeof C=="number")throw Error("Op has a trailing skip")};function r(S,C){let v=0,A=0;for(let H=0;H<S.length;H++){const B=S[H];switch(C(B,v,A),typeof B){case"object":v+=e.dlen(B.d);break;case"string":A+=t.strPosToUni(B);break;case"number":v+=B,A+=B;break}}}e.eachOp=r;function s(S,C){const v=[],A=a(v);return r(S,(H,B,m)=>{A(C(H,B,m))}),h(v)}const i=S=>S,o=S=>s(S,i);e.dlen=S=>typeof S=="number"?S:t.strPosToUni(S);const a=S=>C=>{if(!(!C||C.d===0||C.d===""))if(S.length===0)S.push(C);else if(typeof C==typeof S[S.length-1])if(typeof C=="object"){const v=S[S.length-1];v.d=typeof v.d=="string"&&typeof C.d=="string"?v.d+C.d:e.dlen(v.d)+e.dlen(C.d)}else S[S.length-1]+=C;else S.push(C)},l=S=>typeof S=="number"?S:typeof S=="string"?t.strPosToUni(S):typeof S.d=="number"?S.d:t.strPosToUni(S.d);e.uniSlice=(S,C,v)=>{const A=t.uniToStrPos(S,C),H=v==null?1/0:t.uniToStrPos(S,v);return S.slice(A,H)};const c=(S,C,v)=>typeof S=="number"?v==null?S-C:Math.min(S,v)-C:e.uniSlice(S,C,v),u=S=>{let C=0,v=0;return{take:(B,m)=>{if(C===S.length)return B===-1?null:B;const x=S[C];let O;if(typeof x=="number")return B===-1||x-v<=B?(O=x-v,++C,v=0,O):(v+=B,B);if(typeof x=="string"){if(B===-1||m==="i"||t.strPosToUni(x.slice(v))<=B)return O=x.slice(v),++C,v=0,O;{const N=v+t.uniToStrPos(x.slice(v),B);return O=x.slice(v,N),v=N,O}}else{if(B===-1||m==="d"||e.dlen(x.d)-v<=B)return O={d:c(x.d,v)},++C,v=0,O;{let N=c(x.d,v,v+B);return v+=B,{d:N}}}},peek:()=>S[C]}},h=S=>(S.length>0&&typeof S[S.length-1]=="number"&&S.pop(),S);function d(S,C,v){if(v!=="left"&&v!=="right")throw Error("side ("+v+") must be 'left' or 'right'");n(S),n(C);const A=[],H=a(A),{take:B,peek:m}=u(S);for(let O=0;O<C.length;O++){const N=C[O];let y,w;switch(typeof N){case"number":for(y=N;y>0;)w=B(y,"i"),H(w),typeof w!="string"&&(y-=l(w));break;case"string":v==="left"&&typeof m()=="string"&&H(B(-1)),H(t.strPosToUni(N));break;case"object":for(y=e.dlen(N.d);y>0;)switch(w=B(y,"i"),typeof w){case"number":y-=w;break;case"string":H(w);break;case"object":y-=e.dlen(w.d)}break}}let x;for(;x=B(-1);)H(x);return h(A)}function f(S,C){n(S),n(C);const v=[],A=a(v),{take:H}=u(S);for(let m=0;m<C.length;m++){const x=C[m];let O,N;switch(typeof x){case"number":for(O=x;O>0;)N=H(O,"d"),A(N),typeof N!="object"&&(O-=l(N));break;case"string":A(x);break;case"object":O=e.dlen(x.d);let y=0;for(;y<O;)switch(N=H(O-y,"d"),typeof N){case"number":A({d:c(x.d,y,y+N)}),y+=N;break;case"string":y+=t.strPosToUni(N);break;case"object":A(N)}break}}let B;for(;B=H(-1);)A(B);return h(v)}const g=(S,C)=>{let v=0;for(let A=0;A<C.length&&S>v;A++){const H=C[A];switch(typeof H){case"number":{v+=H;break}case"string":const B=t.strPosToUni(H);v+=B,S+=B;break;case"object":S-=Math.min(e.dlen(H.d),S-v);break}}return S},_=(S,C)=>typeof S=="number"?g(S,C):S.map(v=>g(v,C));function R(S,C,v){return s(S,(A,H)=>typeof A=="object"&&typeof A.d=="number"?{d:v.slice(C,H,H+A.d)}:A)}function b(S){return s(S,C=>{switch(typeof C){case"object":if(typeof C.d=="number")throw Error("Cannot invert text op: Deleted characters missing from operation. makeInvertible must be called first.");return C.d;case"string":return{d:C};case"number":return C}})}function F(S){return s(S,C=>typeof C=="object"&&typeof C.d=="string"?{d:t.strPosToUni(C.d)}:C)}function k(S){let C=!0;return r(S,v=>{typeof v=="object"&&typeof v.d=="number"&&(C=!1)}),C}function W(S){return{name:"text-unicode",uri:"http://sharejs.org/types/text-unicode",trim:h,normalize:o,checkOp:n,create(C=""){if(typeof C!="string")throw Error("Initial data must be a string");return S.create(C)},apply(C,v){n(v);const A=S.builder(C);for(let H=0;H<v.length;H++){const B=v[H];switch(typeof B){case"number":A.skip(B);break;case"string":A.append(B);break;case"object":A.del(e.dlen(B.d));break}}return A.build()},transform:d,compose:f,transformPosition:g,transformSelection:_,isInvertible:k,makeInvertible(C,v){return R(C,v,S)},stripInvertible:F,invert:b,invertWithDoc(C,v){return b(R(C,v,S))},isNoop:C=>C.length===0}}e.default=W})(gi)),gi}var Qr={},Va;function F_(){if(Va)return Qr;Va=1,Object.defineProperty(Qr,"__esModule",{value:!0});const e=Fi(),t=yo();function n(r,s){return{get:r,getLength(){return r().length},insert(i,o,a){const l=t.strPosToUni(r(),i);return s([l,o],a)},remove(i,o,a){const l=t.strPosToUni(r(),i);return s([l,{d:o}],a)},_onOp(i){e.eachOp(i,(o,a,l)=>{switch(typeof o){case"string":this.onInsert&&this.onInsert(l,o);break;case"object":const c=e.dlen(o.d);this.onRemove&&this.onRemove(l,c)}})},onInsert:null,onRemove:null}}return Qr.default=n,n.provides={text:!0},Qr}var za;function H_(){return za||(za=1,(function(e){var t=Tt&&Tt.__createBinding||(Object.create?(function(d,f,g,_){_===void 0&&(_=g),Object.defineProperty(d,_,{enumerable:!0,get:function(){return f[g]}})}):(function(d,f,g,_){_===void 0&&(_=g),d[_]=f[g]})),n=Tt&&Tt.__setModuleDefault||(Object.create?(function(d,f){Object.defineProperty(d,"default",{enumerable:!0,value:f})}):function(d,f){d.default=f}),r=Tt&&Tt.__importStar||function(d){if(d&&d.__esModule)return d;var f={};if(d!=null)for(var g in d)Object.hasOwnProperty.call(d,g)&&t(f,d,g);return n(f,d),f},s=Tt&&Tt.__importDefault||function(d){return d&&d.__esModule?d:{default:d}};Object.defineProperty(e,"__esModule",{value:!0}),e.type=e.remove=e.insert=void 0;const i=yo(),o=r(Fi()),a=s(F_()),l={create(d){return d},toString(d){return d},builder(d){if(typeof d!="string")throw Error("Invalid document snapshot: "+d);const f=[];return{skip(g){let _=i.uniToStrPos(d,g);if(_>d.length)throw Error("The op is too long for this document");f.push(d.slice(0,_)),d=d.slice(_)},append(g){f.push(g)},del(g){d=d.slice(i.uniToStrPos(d,g))},build(){return f.join("")+d}}},slice:o.uniSlice},c=o.default(l),u=Object.assign(Object.assign({},c),{api:a.default});e.type=u,e.insert=(d,f)=>f.length===0?[]:d===0?[f]:[d,f],e.remove=(d,f)=>o.dlen(f)===0?[]:d===0?[{d:f}]:[d,{d:f}];var h=Fi();Object.defineProperty(e,"makeType",{enumerable:!0,get:function(){return h.default}})})(Tt)),Tt}var Ga;function B_(){return Ga||(Ga=1,(function(e){var t=sr&&sr.__importDefault||function(I){return I&&I.__esModule?I:{default:I}};Object.defineProperty(e,"__esModule",{value:!0}),e.editOp=e.replaceOp=e.insertOp=e.moveOp=e.removeOp=e.type=void 0;const n=t(P_()),r=t(k_()),s=du(),i=fu();function o(I,L){if(!I)throw new Error(L)}e.type={name:"json1",uri:"http://sharejs.org/types/JSONv1",readCursor:s.readCursor,writeCursor:s.writeCursor,create:I=>I,isNoop:I=>I==null,setDebug(I){},registerSubtype:b,checkValidOp:H,normalize:B,apply:m,transformPosition:x,compose:O,tryTransform:D,transform:J,makeInvertible:w,invert:N,invertWithDoc:T,RM_UNEXPECTED_CONTENT:i.ConflictType.RM_UNEXPECTED_CONTENT,DROP_COLLISION:i.ConflictType.DROP_COLLISION,BLACKHOLE:i.ConflictType.BLACKHOLE,transformNoConflict:(I,L,Y)=>ce(()=>!0,I,L,Y),typeAllowingConflictsPred:I=>Object.assign(Object.assign({},e.type),{transform:(L,Y,V)=>ce(I,L,Y,V)})};const a=I=>I?I.getComponent():null;function l(I){return I&&typeof I=="object"&&!Array.isArray(I)}const c=I=>Array.isArray(I)?I.slice():I!==null&&typeof I=="object"?Object.assign({},I):I,u=I=>I&&(I.p!=null||I.r!==void 0),h=I=>I&&(I.d!=null||I.i!==void 0);function d(I,L){return o(I!=null),typeof L=="number"?(o(Array.isArray(I),"Invalid key - child is not an array"),(I=I.slice()).splice(L,1)):(o(l(I),"Invalid key - child is not an object"),delete(I=Object.assign({},I))[L]),I}function f(I,L,Y){return typeof L=="number"?(o(I!=null,"Container is missing for key"),o(Array.isArray(I),"Cannot use numerical key for object container"),o(I.length>=L,"Cannot insert into out of bounds index"),I.splice(L,0,Y)):(o(l(I),"Cannot insert into missing item"),o(I[L]===void 0,"Trying to overwrite value at key. Your op needs to remove it first"),I[L]=Y),Y}e.removeOp=(I,L=!0)=>s.writeCursor().writeAtPath(I,"r",L).get(),e.moveOp=(I,L)=>s.writeCursor().writeMove(I,L).get(),e.insertOp=(I,L)=>s.writeCursor().writeAtPath(I,"i",L).get(),e.replaceOp=(I,L,Y)=>s.writeCursor().at(I,V=>{V.write("r",L),V.write("i",Y)}).get(),e.editOp=(I,L,Y,V=!1)=>s.writeCursor().at(I,$=>C($,L,Y,V)).get();const g=(I,L)=>I!=null&&(typeof L=="number"?Array.isArray(I):typeof I=="object"),_=(I,L)=>g(I,L)?I[L]:void 0,R={};function b(I){let L=I.type?I.type:I;L.name&&(R[L.name]=L),L.uri&&(R[L.uri]=L)}const F=I=>{const L=R[I];if(L)return L;throw Error("Missing type: "+I)};b(H_());const k=(I,L)=>I+L;b({name:"number",apply:k,compose:k,invert:I=>-I,transform:I=>I});const W=I=>I==null?null:I.et?F(I.et):I.es?R["text-unicode"]:I.ena!=null?R.number:null,S=I=>I.es?I.es:I.ena!=null?I.ena:I.e,C=(I,L,Y,V=!1)=>{const[$,j]=typeof L=="string"?[F(L),L]:[L,L.name];!V&&$.isNoop&&$.isNoop(Y)||(j==="number"?I.write("ena",Y):j==="text-unicode"?I.write("es",Y):(I.write("et",j),I.write("e",Y)))};function v(I){o(typeof I=="number"),o(I>=0),o(I===(0|I))}function A(I){typeof I=="number"?v(I):o(typeof I=="string")}function H(I){if(I===null)return;const L=new Set,Y=new Set,V=j=>{let Q=!0,ee=!1;for(let U in j){const G=j[U];if(Q=!1,o(U==="p"||U==="r"||U==="d"||U==="i"||U==="e"||U==="es"||U==="ena"||U==="et","Invalid component item '"+U+"'"),U==="p")v(G),o(!L.has(G)),L.add(G),o(j.r===void 0);else if(U==="d")v(G),o(!Y.has(G)),Y.add(G),o(j.i===void 0);else if(U==="e"||U==="es"||U==="ena"){o(!ee),ee=!0;const X=W(j);o(X,"Missing type in edit"),X.checkValidOp&&X.checkValidOp(S(j))}}o(!Q)},$=(j,Q,ee)=>{if(!Array.isArray(j))throw Error("Op must be null or a list");if(j.length===0)throw Error("Empty descent");Q||A(j[0]);let U=1,G=0,X=0;for(let ne=0;ne<j.length;ne++){const me=j[ne];if(o(me!=null),Array.isArray(me)){const pe=$(me,!1);if(G){const K=typeof X,he=typeof pe;K===he?o(X<pe,"descent keys are not in order"):o(K==="number"&&he==="string")}X=pe,G++,U=3}else typeof me=="object"?(o(U===1,`Prev not scalar - instead ${U}`),V(me),U=2):(o(U!==3),A(me),o(s.isValidPathItem(me),"Invalid path key"),U=1)}return o(G!==1,"Operation makes multiple descents. Remove some []"),o(U===2||U===3),j[0]};$(I,!0),o(L.size===Y.size,"Mismatched picks and drops in op");for(let j=0;j<L.size;j++)o(L.has(j)),o(Y.has(j))}function B(I){let L=0,Y=[];const V=s.writeCursor();return V.mergeTree(I,($,j)=>{const Q=W($);if(Q){const U=S($);C(j,Q,Q.normalize?Q.normalize(U):U)}for(const U of["r","p","i","d"])if($[U]!==void 0){const G=U==="p"||U==="d"?(ee=$[U],Y[ee]==null&&(Y[ee]=L++),Y[ee]):$[U];j.write(U,G)}var ee}),V.get()}function m(I,L){if(H(L),L===null)return I;const Y=[];return(function V($,j){let Q=$,ee=0,U={root:$},G=0,X=U,ne="root";function me(){for(;G<ee;G++){let pe=j[G];typeof pe!="object"&&(o(g(X,ne)),X=X[ne]=c(X[ne]),ne=pe)}}for(;ee<j.length;ee++){const pe=j[ee];if(Array.isArray(pe)){const K=V(Q,pe);K!==Q&&K!==void 0&&(me(),Q=X[ne]=K)}else if(typeof pe=="object"){pe.d!=null?(me(),Q=f(X,ne,Y[pe.d])):pe.i!==void 0&&(me(),Q=f(X,ne,pe.i));const K=W(pe);if(K)me(),Q=X[ne]=K.apply(Q,S(pe));else if(pe.e!==void 0)throw Error("Subtype "+pe.et+" undefined")}else Q=_(Q,pe)}return U.root})(I=(function V($,j){const Q=[];let ee=0;for(;ee<j.length;ee++){const ne=j[ee];if(Array.isArray(ne))break;typeof ne!="object"&&(Q.push($),$=_($,ne))}for(let ne=j.length-1;ne>=ee;ne--)$=V($,j[ne]);for(--ee;ee>=0;ee--){const ne=j[ee];if(typeof ne!="object"){const me=Q.pop();$=$===_(me,ne)?me:$===void 0?d(me,ne):(G=ne,X=$,(U=c(U=me))[G]=X,U)}else u(ne)&&(o($!==void 0,"Cannot pick up or remove undefined"),ne.p!=null&&(Y[ne.p]=$),$=void 0)}var U,G,X;return $})(I,L),L)}function x(I,L){I=I.slice(),H(L);const Y=s.readCursor(L);let V,$,j=!1;const Q=[];for(let U=0;;U++){const G=I[U],X=Y.getComponent();if(X&&(X.r!==void 0?j=!0:X.p!=null&&(j=!1,V=X.p,$=U)),U>=I.length)break;let ne=0;const me=s.advancer(Y,void 0,(K,he)=>{u(he)&&ne++});Q.unshift(me);const pe=me(G);if(typeof G=="number"&&(I[U]-=ne),!pe)break}if(Q.forEach(U=>U.end()),j)return null;const ee=()=>{let U=0;if(V!=null){const G=Y.getPath();U=G.length,I=G.concat(I.slice($))}for(;U<I.length;U++){const G=I[U],X=a(Y),ne=W(X);if(ne){const K=S(X);ne.transformPosition&&(I[U]=ne.transformPosition(I[U],K));break}let me=0;const pe=s.advancer(Y,(K,he)=>h(he)?~(K-me):K-me,(K,he)=>{h(he)&&me++})(G);if(typeof G=="number"&&(I[U]+=me),!pe)break}};return V!=null?Y.eachDrop(null,U=>{U===V&&ee()}):ee(),I}function O(I,L){if(H(I),H(L),I==null)return L;if(L==null)return I;let Y=0;const V=s.readCursor(I),$=s.readCursor(L),j=s.writeCursor(),Q=[],ee=[],U=[],G=[],X=[],ne=[],me=new Set;V.traverse(null,K=>{K.p!=null&&(U[K.p]=V.clone())}),$.traverse(null,K=>{K.d!=null&&(G[K.d]=$.clone())});const pe=s.writeCursor();return(function K(he,Ue,Ne,Se,Be,Bt,rt,Je){o(Ue||Ne);const $e=a(Ue),_t=a(Ne),vt=!!_t&&_t.r!==void 0,un=!!$e&&$e.i!==void 0,pt=$e?$e.d:null,ut=_t?_t.p:null,$t=(Bt||vt)&&ut==null;if(ut!=null)Se=G[ut],rt=ee[ut]=new s.WriteCursor;else if(_t&&_t.r!==void 0)Se=null;else{const se=a(Se);se&&se.d!=null&&(Se=null)}const Ae=a(Se);if(pt!=null)if(he=U[pt],Je=Q[pt]=new s.WriteCursor,$t)Bt&&!vt&&Je.write("r",!0);else{const se=X[pt]=Y++;rt.write("d",se)}else if($e&&$e.i!==void 0)he=null;else{const se=a(he);se&&se.p!=null&&(he=null)}let ae;un?(o(Be===void 0),ae=$e.i):ae=Be;const Ce=(ut==null?!un||Bt||vt:ae===void 0)?null:rt.getComponent();if(ut!=null){if(!(Be!==void 0||un)){const se=pt!=null?X[pt]:Y++;ne[ut]=se,Je.write("p",se)}}else vt&&(un||Be!==void 0||(_t.r,Je.write("r",_t.r)));const ue=$t?null:W($e),re=W(Ae);if((ue||re)&&(ue&&ue.name,re&&re.name),ue&&re){o(ue===re);const se=S($e),Re=S(Ae),Ke=ue.compose(se,Re);C(rt,ue,Ke),me.add(Ae)}else ue?C(rt,ue,S($e)):re&&(C(rt,re,S(Ae)),me.add(Ae));const de=typeof ae=="object"&&ae!=null;let be=!1,ve=0,Te=0,Ge=0,Ve=0,je=0;const tt=s.advancer(Se,(se,Re)=>h(Re)?Ve-se-1:se-Ve,(se,Re)=>{h(Re)&&Ve++}),Oe=s.advancer(he,(se,Re)=>u(Re)?ve-se-1:se-ve,(se,Re)=>{u(Re)&&ve++});if(s.eachChildOf(Ue,Ne,(se,Re,Ke)=>{let st,jt,hn=se,bt=se,nr=se;if(typeof se=="number"){let Ze=se+Ge;jt=tt(Ze),bt=Ze+Ve;let We=se+Te;st=Oe(We),h(a(jt))&&(st=null),hn=We+ve,nr=se+je,o(hn>=0,"p1PickKey is negative"),o(bt>=0,"p2DropKey is negative");const yt=h(a(Re)),Wt=u(a(Ke));(yt||Wt&&!$t)&&je--,yt&&Te--,Wt&&Ge--}else st=Oe(se),jt=tt(se);Je.descend(hn),rt.descend(bt);const bn=de&&!h(a(Re))?ae[nr]:void 0,Lt=K(st,Re,Ke,jt,bn,$t,rt,Je);var xt,ge,Fe;de&&!$t?bn!==Lt&&(be||(ae=Array.isArray(ae)?ae.slice():Object.assign({},ae),be=!0),xt=ae,Fe=Lt,typeof(ge=nr)=="number"?(o(Array.isArray(xt)),o(ge<xt.length)):(o(!Array.isArray(xt)),o(xt[ge]!==void 0)),Fe===void 0?typeof ge=="number"?xt.splice(ge,1):delete xt[ge]:xt[ge]=Fe):o(Lt===void 0),rt.ascend(),Je.ascend()}),Oe.end(),tt.end(),Ce!=null)Ce.i=ae;else if(!Bt&&!vt&&ut==null)return ae})(V,V.clone(),$,$.clone(),void 0,!1,j,pe),j.reset(),j.mergeTree(pe.get()),j.reset(),j.get(),Q.map(K=>K.get()),ee.map(K=>K.get()),V.traverse(j,(K,he)=>{const Ue=K.p;if(Ue!=null){const Ne=X[Ue];Ne!=null&&he.write("p",Ne);const Se=Q[Ue];Se&&Se.get(),Se&&he.mergeTree(Se.get())}else K.r!==void 0&&he.write("r",K.r)}),j.reset(),j.get(),$.traverse(j,(K,he)=>{const Ue=K.d;if(Ue!=null){const Se=ne[Ue];Se!=null&&he.write("d",Se);const Be=ee[Ue];Be&&he.mergeTree(Be.get())}else K.i!==void 0&&he.write("i",K.i);const Ne=W(K);Ne&&!me.has(K)&&C(he,Ne,S(K))}),j.get()}function N(I){if(I==null)return null;const L=new s.ReadCursor(I),Y=new s.WriteCursor;let V;const $=[],j=[];return(function Q(ee,U,G){const X=ee.getComponent();let ne,me=!1;if(X){X.p!=null&&(U.write("d",X.p),$[X.p]=ee.clone()),X.r!==void 0&&U.write("i",X.r),X.d!=null&&(U.write("p",X.d),G=void 0),X.i!==void 0&&(G=ne=X.i);const K=W(X);K&&(G===void 0?(V||(V=new Set),V.add(X)):(S(X),G=K.apply(G,S(X)),me=!0))}let pe=0;for(const K of ee){U.descend(K);const he=typeof K=="number"?K-pe:K,Ue=_(G,he);h(ee.getComponent())&&pe++;const Ne=Q(ee,U,Ue);if(G!==void 0&&Ne!==void 0){if(me||(me=!0,G=c(G)),!g(G,he))throw Error("Cannot modify child - invalid operation");G[he]=Ne}U.ascend()}if(ne===void 0)return me?G:void 0;U.write("r",G)})(L,Y,void 0),V&&(Y.reset(),(function Q(ee,U,G){const X=U.getComponent();if(X){const K=X.d;if(K!=null&&(ee=$[K],G=j[K]=s.writeCursor()),V.has(X)){const he=W(X);if(!he.invert)throw Error(`Cannot invert subtype ${he.name}`);C(G,he,he.invert(S(X)))}}let ne=0,me=0;const pe=s.advancer(ee,(K,he)=>u(he)?ne-K-1:K-ne,(K,he)=>{u(he)&&ne++});for(const K of U)if(typeof K=="number"){const he=K-me,Ue=pe(he),Ne=he+ne;G.descend(Ne),Q(Ue,U,G),h(U.getComponent())&&me++,G.ascend()}else G.descend(K),Q(pe(K),U,G),G.ascend();pe.end()})(L.clone(),L,Y),j.length&&(Y.reset(),L.traverse(Y,(Q,ee)=>{const U=Q.p;if(U!=null){const G=j[U];G&&G.get(),G&&ee.mergeTree(G.get())}}))),Y.get()}const y=(I,L)=>I.some(Y=>typeof Y=="object"&&(Array.isArray(Y)?y(Y,L):L(Y)));function w(I,L){if(I==null||!y(I,U=>{var G;return U.r!==void 0||((G=W(U))===null||G===void 0?void 0:G.makeInvertible)!=null}))return I;const Y=new s.ReadCursor(I),V=new s.WriteCursor;let $=!1;const j=[],Q=[],ee=(U,G,X)=>{const ne=U.getComponent();let me=!1;if(ne){ne.d!=null&&G.write("d",ne.d),ne.i!==void 0&&G.write("i",ne.i);const K=ne.p;if(K!=null&&(j[K]=U.clone(),o(X!==void 0,"Operation picks up at an invalid key"),Q[K]=X,G.write("p",ne.p)),ne.r!==void 0&&X===void 0)throw Error("Invalid doc / op in makeInvertible: removed item missing from doc");const he=W(ne);he&&(he.makeInvertible?$=!0:C(G,he,S(ne),!0))}let pe=0;for(const K of U){G.descend(K);const he=typeof K=="number"?K-pe:K,Ue=_(X,he),Ne=ee(U,G,Ue);Ue!==Ne&&(me||(me=!0,X=c(X)),Ne===void 0?(X=d(X,he),typeof K=="number"&&pe++):X[he]=Ne),G.ascend()}return ne&&(ne.r!==void 0?(G.write("r",r.default(X)),X=void 0):ne.p!=null&&(X=void 0)),X};return ee(Y,V,L),V.get(),$&&(V.reset(),(function U(G,X,ne,me,pe){const K=X.getComponent();if(K){K.i!==void 0?(me=K.i,pe=!0):K.d!=null&&(me=Q[K.d],G=j[K.d],pe=!1,K.d);let Se=W(K);if(Se&&Se.makeInvertible){const Be=S(K);C(ne,Se,Se.makeInvertible(Be,me),!0)}}let he=0,Ue=0;const Ne=s.advancer(G,(Se,Be)=>u(Be)?he-Se-1:Se-he,(Se,Be)=>{u(Be)&&he++});for(const Se of X)if(typeof Se=="number"){const Be=Se-Ue,Bt=Ne(Be),rt=Be+he,Je=_(me,pe?Be:rt);ne.descend(Se),U(Bt,X,ne,Je,pe),h(X.getComponent())&&Ue++,ne.ascend()}else{const Be=_(me,Se);ne.descend(Se),U(Ne(Se),X,ne,Be,pe),ne.ascend()}Ne.end()})(Y.clone(),Y,V,L,!1)),V.get()}function T(I,L){return N(w(I,L))}const M=I=>{if(I==null)return null;const L=I.slice();for(let Y=0;Y<I.length;Y++){const V=L[Y];Array.isArray(V)&&(L[Y]=M(V))}return L};function D(I,L,Y){o(Y==="left"||Y==="right","Direction must be left or right");const V=Y==="left"?0:1;if(L==null)return{ok:!0,result:I};H(I),H(L);let $=null;const j=[],Q=[],ee=[],U=[],G=[],X=[],ne=[],me=[],pe=[],K=[],he=[],Ue=[],Ne=[],Se=[],Be=[];let Bt=0;const rt=s.readCursor(I),Je=s.readCursor(L),$e=s.writeCursor();if((function Ae(ae,Ce=null,ue){const re=a(Ce);re&&(re.r!==void 0?ue=Ce.clone():re.p!=null&&(ue=null,X[re.p]=ae.clone()));const de=ae.getComponent();let be;de&&(be=de.p)!=null&&(G[be]=Ce?Ce.clone():null,ee[be]=ae.clone(),ue&&(K[be]=!0,pe[be]=ue),re&&re.p!=null&&(Se[be]=re.p));const ve=s.advancer(Ce);for(const Te of ae)Ae(ae,ve(Te),ue);ve.end()})(Je,rt,null),(function Ae(ae,Ce,ue,re,de){const be=ue.getComponent();let ve,Te=!1;be&&((ve=be.d)!=null?(U[ve]=ue.clone(),re!=null&&(Be[re]==null&&(Be[re]=[]),Be[re].push(ve)),K[ve],ae=G[ve]||null,Ce=ee[ve]||null,K[ve]?(de&&(he[ve]=!0),de=pe[ve]||null):!de||V!==1&&Se[ve]!=null||$==null&&($={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:e.removeOp(de.getPath()),op2:e.moveOp(Ce.getPath(),ue.getPath())}),Te=!0):be.i!==void 0&&(ae=Ce=null,Te=!0,de&&$==null&&($={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:e.removeOp(de.getPath()),op2:e.insertOp(ue.getPath(),be.i)})));const Ge=a(ae);Ge&&(Ge.r!==void 0?de=ae.clone():Ge.p!=null&&(Ge.p,re=Ge.p,de=null));const Ve=W(be);Ve&&de&&$==null&&($={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:e.removeOp(de.getPath()),op2:e.editOp(ue.getPath(),Ve,S(be),!0)});let je=0,tt=0;const Oe=s.advancer(Ce,(Re,Ke)=>u(Ke)?je-Re-1:Re-je,(Re,Ke)=>{u(Ke)&&je++}),se=s.advancer(ae);for(const Re of ue)if(typeof Re=="number"){const Ke=Re-tt,st=Oe(Ke);tt+=+Ae(se(Ke+je),st,ue,re,de)}else{const Ke=Oe(Re);Ae(se(Re),Ke,ue,re,de)}return Oe.end(),se.end(),Te})(rt,Je,Je.clone(),null,null),U.map(Ae=>Ae&&Ae.get()),$)return{ok:!1,conflict:$};he.map(Ae=>!!Ae);const _t=[];let vt=null;(function Ae(ae,Ce,ue,re,de){let be=!1;const ve=a(Ce);if(u(ve)){const Oe=ve.p;Oe!=null?(ue=U[Oe],re=Ue[Oe]=s.writeCursor(),be=!0,de=null):(ue=null,de=Ce.clone())}else h(a(ue))&&(ue=null);const Te=ae.getComponent();if(Te){const Oe=Te.p;Oe!=null?(de&&(me[Oe]=de),_t[Oe]=de||V===1&&be?null:re.getComponent(),j[Oe]=ae.clone(),ue&&(ne[Oe]=ue.clone())):Te.r!==void 0&&(de||re.write("r",!0),(de||be)&&(vt==null&&(vt=new Set),vt.add(Te)))}let Ge=0,Ve=0;const je=s.advancer(Ce,void 0,(Oe,se)=>{u(se)&&Ge++}),tt=s.advancer(ue,(Oe,se)=>h(se)?~(Oe-Ve):Oe-Ve,(Oe,se)=>{h(se)&&Ve++});if(ae)for(const Oe of ae)if(typeof Oe=="string"){const se=je(Oe),Re=tt(Oe);re.descend(Oe),Ae(ae,se,Re,re,de),re.ascend()}else{const se=je(Oe),Re=Oe-Ge,Ke=u(a(se))?null:tt(Re),st=Re+Ve;o(st>=0),re.descend(st),Ae(ae,se,Ke,re,de),re.ascend()}je.end(),tt.end()})(rt,Je,Je.clone(),$e,null),$e.reset();let un=[];if((function Ae(ae,Ce,ue,re,de,be){o(Ce);const ve=Ce.getComponent();let Te=a(re),Ge=!1;const Ve=(ge,Fe,Ze)=>ge?e.moveOp(ge.getPath(),Fe.getPath()):e.insertOp(Fe.getPath(),Ze.i);if(h(ve)){const ge=ve.d;ge!=null&&(Q[ge]=Ce.clone());const Fe=ge!=null?_t[ge]:null;let Ze=!1;if(ve.i!==void 0||ge!=null&&Fe){let We;Te&&(Te.i!==void 0||(We=Te.d)!=null&&!K[We])&&(Ze=We!=null?ge!=null&&ge===Se[We]:n.default(Te.i,ve.i),Ze||We!=null&&V!==1&&Se[We]!=null||$==null&&($={type:i.ConflictType.DROP_COLLISION,op1:Ve(ge!=null?j[ge]:null,Ce,ve),op2:Ve(We!=null?ee[We]:null,re,Te)})),Ze||(be?$==null&&($={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:Ve(ge!=null?j[ge]:null,Ce,ve),op2:e.removeOp(be.getPath())}):(ge!=null?(un[Bt]=ge,de.write("d",Fe.p=Bt++)):de.write("i",r.default(ve.i)),Ge=!0))}else if(ge!=null&&!Fe){const We=me[ge];We&&(be=We.clone())}ge!=null?(ae=j[ge],ue=X[ge],re=ne[ge]):ve.i!==void 0&&(ae=ue=null,Ze||(re=null))}else u(a(ae))&&(ae=ue=re=null);const je=a(ae),tt=a(ue);if(u(tt)){const ge=tt.p;tt.r!==void 0&&(!je||je.r===void 0)||K[ge]?(re=null,be=ue.clone()):ge!=null&&(re=U[ge],V!==1&&Se[ge]!=null||((de=Ne[ge])||(de=Ne[ge]=s.writeCursor()),de.reset(),be=null))}else!h(ve)&&h(Te)&&(re=null);Te=re!=null?re.getComponent():null;const Oe=W(ve);if(Oe){const ge=S(ve);if(be)$==null&&($={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:e.editOp(Ce.getPath(),Oe,ge,!0),op2:e.removeOp(be.getPath())});else{const Fe=W(Te);let Ze;if(Fe){if(Oe!==Fe)throw Error("Transforming incompatible types");const We=S(Te);Ze=Oe.transform(ge,We,Y)}else Ze=r.default(ge);C(de,Oe,Ze)}}let se=0,Re=0,Ke=0,st=0,jt=0,hn=0,bt=ae!=null&&ae.descendFirst(),nr=bt;const bn=s.advancer(ue,void 0,(ge,Fe)=>{u(Fe)&&Ke++});let Lt=re!=null&&re.descendFirst(),xt=Lt;for(const ge of Ce)if(typeof ge=="number"){let Fe;const Ze=h(Ce.getComponent()),We=ge-Re;{let qt;for(;bt&&typeof(qt=ae.getKey())=="number";){qt+=se;const At=ae.getComponent(),yn=u(At);if(qt>We||qt===We&&(!yn||V===0&&Ze))break;if(yn){se--;const dn=At.p;Se.includes(dn),At.d,a(Ne[At.d]),u(a(Ne[At.d])),(At.r===void 0||vt&&vt.has(At))&&(dn==null||!_t[dn]||V!==1&&Se.includes(dn))||jt--}bt=ae.nextSibling()}Fe=bt&&qt===We?ae:null}const yt=We-se;let Wt=bn(yt);const ii=yt-Ke;let Xr=null;{let qt,At;for(;Lt&&typeof(qt=re.getKey())=="number";){At=qt-st;const yn=re.getComponent(),dn=h(yn);if(At>ii)break;if(At===ii){if(!dn){Xr=re;break}{if(V===0&&Ze){Xr=re;break}const Jt=Wt&&u(Wt.getComponent());if(V===0&&Jt)break}}if(dn){const Jt=yn.d;K[Jt],Se[Jt],yn.i===void 0&&(K[Jt]||Se[Jt]!=null&&V!==1)?(K[Jt]||Se[Jt]!=null&&V===0)&&(st++,hn--):st++}Lt=re.nextSibling()}}const Ca=ii+st+jt+hn;o(Ca>=0,"trying to descend to a negative index"),de.descend(Ca),Ze&&(Fe=Wt=Xr=null,Re++),Ae(Fe,Ce,Wt,Xr,de,be)&&hn++,de.ascend()}else{let Fe;for(;bt&&(Fe=ae.getKey(),typeof Fe!="string"||!(Fe>ge||Fe===ge));)bt=ae.nextSibling();const Ze=bt&&Fe===ge?ae:null,We=bn(ge);let yt;for(;Lt&&(yt=re.getKey(),typeof yt!="string"||!(yt>ge||yt===ge));)Lt=re.nextSibling();const Wt=Lt&&yt===ge?re:null;de.descend(ge),Ae(Ze,Ce,We,Wt,de,be),de.ascend()}return bn.end(),nr&&ae.ascend(),xt&&re.ascend(),Ge})(rt,rt.clone(),Je,Je.clone(),$e,null),$)return{ok:!1,conflict:$};$e.reset();const pt=(Ae,ae,Ce)=>Ae.traverse(ae,(ue,re)=>{ue.d!=null&&Ce(ue.d,Ae,re)});(K.length||Ue.length)&&(pt(Je,$e,(Ae,ae,Ce)=>{K[Ae]&&!he[Ae]&&Ce.write("r",!0),Ue[Ae]&&Ce.mergeTree(Ue[Ae].get())}),$e.reset());const ut=[],$t=[];if((Ne.length||K.length)&&!$){const Ae=s.readCursor(M($e.get()));if(pt(Ae,null,(ae,Ce)=>{ut[ae]=Ce.clone()}),Ne.forEach(ae=>{ae&&pt(s.readCursor(ae.get()),null,(Ce,ue)=>{ut[Ce]=ue.clone()})}),(function ae(Ce,ue,re,de,be,ve){const Te=a(ue);if(Te&&u(Te))if(Te.p!=null){const se=Te.p;ut[se].getPath(),re=ut[se],de=$t[se]=s.writeCursor()}else Te.r!==void 0&&(re=null);else h(a(re))&&(re=null);const Ge=Ce.getComponent();if(Ge){let se;if((se=Ge.d)!=null){const Re=Ne[se];Re&&(Re.get(),de.mergeTree(Re.get()),re=s.readCursor(Re.get()))}}let Ve=0,je=0;const tt=s.advancer(ue,void 0,(se,Re)=>{u(Re)&&Ve--}),Oe=s.advancer(re,(se,Re)=>h(Re)?-(se-je)-1:se-je,(se,Re)=>{h(Re)&&je++});for(const se of Ce)if(typeof se=="number"){const Re=tt(se),Ke=se+Ve,st=Oe(Ke),jt=Ke+je;de.descend(jt),ae(Ce,Re,st,de),de.ascend()}else de.descend(se),ae(Ce,tt(se),Oe(se),de),de.ascend();tt.end(),Oe.end()})(Je,Ae,Ae.clone(),$e),$e.reset(),$)return{ok:!1,conflict:$};if($e.get(),$t.length){const ae=$t.map(ue=>ue?ue.get():null),Ce=s.readCursor(M($e.get()));if(pt(Ce,$e,(ue,re,de)=>{const be=ae[ue];be&&(de.mergeTree(be),ae[ue]=null)}),ae.find(ue=>ue)){const ue=s.writeCursor(),re=s.writeCursor();let de=0,be=0;ae.forEach(ve=>{ve!=null&&pt(s.readCursor(ve),null,Te=>{const Ge=un[Te];ue.writeMove(j[Ge].getPath(),Q[Ge].getPath(),de++);const Ve=Be[Ge];Ve&&Ve.forEach(je=>{K[je]||V!==1&&Se[je]!=null||re.writeMove(ee[je].getPath(),U[je].getPath(),be++)})})}),$={type:i.ConflictType.BLACKHOLE,op1:ue.get(),op2:re.get()}}}}return $?{ok:!1,conflict:$}:{ok:!0,result:$e.get()}}const P=I=>{const L=new Error("Transform detected write conflict");throw L.conflict=I,L.type=L.name="writeConflict",L};function J(I,L,Y){const V=D(I,L,Y);if(V.ok)return V.result;P(V.conflict)}const z=I=>{const L=s.writeCursor();return s.readCursor(I).traverse(L,(Y,V)=>{(h(Y)||W(Y))&&V.write("r",!0)}),L.get()},oe=(I,L)=>{const{type:Y,op1:V,op2:$}=I;switch(Y){case i.ConflictType.DROP_COLLISION:return L==="left"?[null,z($)]:[z(V),null];case i.ConflictType.RM_UNEXPECTED_CONTENT:let j=!1;return s.readCursor(V).traverse(null,Q=>{Q.r!==void 0&&(j=!0)}),j?[null,z($)]:[z(V),null];case i.ConflictType.BLACKHOLE:return[z(V),z($)];default:throw Error("Unrecognised conflict: "+Y)}};function ce(I,L,Y,V){let $=null;for(;;){const j=D(L,Y,V);if(j.ok)return O($,j.result);{const{conflict:Q}=j;I(Q)||P(Q);const[ee,U]=oe(Q,V);L=O(B(L),ee),Y=O(B(Y),U),$=O($,U)}}}})(sr)),sr}var Ka;function $_(){return Ka||(Ka=1,(function(e){var t=fn&&fn.__createBinding||(Object.create?(function(i,o,a,l){l===void 0&&(l=a),Object.defineProperty(i,l,{enumerable:!0,get:function(){return o[a]}})}):(function(i,o,a,l){l===void 0&&(l=a),i[l]=o[a]})),n=fn&&fn.__exportStar||function(i,o){for(var a in i)a!=="default"&&!o.hasOwnProperty(a)&&t(o,i,a)};Object.defineProperty(e,"__esModule",{value:!0}),n(B_(),e);var r=du();Object.defineProperty(e,"ReadCursor",{enumerable:!0,get:function(){return r.ReadCursor}}),Object.defineProperty(e,"WriteCursor",{enumerable:!0,get:function(){return r.WriteCursor}});var s=fu();Object.defineProperty(e,"ConflictType",{enumerable:!0,get:function(){return s.ConflictType}})})(fn)),fn}var at=$_();const j_=wt(at),W_=Dd({__proto__:null,default:j_},[at]);var Ee=(e=>(e[e.COVER=0]="COVER",e[e.REPLACE=1]="REPLACE",e))(Ee||{}),q=(e=>(e.RETAIN="r",e.INSERT="i",e.DELETE="d",e))(q||{});const $r=ye.createIdentifier("univer.config-service");class mu{constructor(){p(this,"_configChanged$",new le.Subject);p(this,"configChanged$",this._configChanged$.asObservable());p(this,"_config",new Map)}dispose(){this._config.clear(),this._configChanged$.complete()}getConfig(t){return this._config.get(t)}setConfig(t,n,r){var o;const{merge:s=!1}=r||{};let i=(o=this._config.get(t))!=null?o:{};s?i=Vs(i,n):i=n,this._config.set(t,i),this._configChanged$.next({[t]:i})}deleteConfig(t){return this._config.delete(t)}subscribeConfigValue$(t){return new le.Observable(n=>{Object.prototype.hasOwnProperty.call(this._config,t)&&n.next(this._config.get(t));const r=this.configChanged$.pipe(le.filter(s=>Object.prototype.hasOwnProperty.call(s,t))).subscribe(s=>n.next(s[t]));return()=>r.unsubscribe()})}}const er=ye.createIdentifier("univer.context-service");class gu extends Xe{constructor(){super(...arguments);p(this,"_contextChanged$",new le.Subject);p(this,"contextChanged$",this._contextChanged$.asObservable());p(this,"_contextMap",new Map)}dispose(){super.dispose(),this._contextChanged$.complete(),this._contextMap.clear()}getContextValue(n){var r;return(r=this._contextMap.get(n))!=null?r:!1}setContextValue(n,r){this._contextMap.set(n,r),this._contextChanged$.next({[n]:r})}subscribeContextValue$(n){return new le.Observable(r=>{const s=this._contextChanged$.pipe(le.filter(i=>typeof i[n]<"u")).subscribe(i=>r.next(i[n]));return this._contextMap.has(n)&&r.next(this._contextMap.get(n)),()=>s.unsubscribe()})}}var _u=(e=>(e[e.SILENT=0]="SILENT",e[e.ERROR=1]="ERROR",e[e.WARN=2]="WARN",e[e.INFO=3]="INFO",e[e.VERBOSE=4]="VERBOSE",e))(_u||{});const mt=ye.createIdentifier("univer.log");class pu extends Xe{constructor(){super(...arguments);p(this,"_logLevel",3);p(this,"_deduction",new Set)}dispose(){super.dispose(),this._logLevel=3,this._deduction.clear()}debug(...n){this._logLevel>=4&&this._log(console.debug,...n)}log(...n){this._logLevel>=3&&this._log(console.log,...n)}warn(...n){this._logLevel>=2&&this._log(console.warn,...n)}error(...n){this._logLevel>=1&&this._log(console.error,...n)}deprecate(...n){this._logLevel>=2&&this._logWithDeduplication(console.error,...n)}setLogLevel(n){this._logLevel=n}_log(n,...r){const s=r[0];/^\[(.*?)\]/g.test(s)?n(`\x1B[97;104m${s}\x1B[0m`,...r.slice(1)):n(...r)}_logWithDeduplication(n,...r){const s=Y_(...r);this._deduction.has(s)||(this._deduction.add(s),this._log(n,...r))}}function Y_(...e){return e.map(t=>JSON.stringify(t)).join("")}var V_=Object.getOwnPropertyDescriptor,z_=(e,t,n,r)=>{for(var s=r>1?void 0:r?V_(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},_i=(e,t)=>(n,r)=>t(n,r,e);const Ns="command.logExecution";var jr=(e=>(e[e.COMMAND=0]="COMMAND",e[e.OPERATION=1]="OPERATION",e[e.MUTATION=2]="MUTATION",e))(jr||{});const Wr=ye.createIdentifier("univer.core.command-service");class G_{constructor(){p(this,"_commands",new Map);p(this,"_commandTypes",new Map)}registerCommand(t){if(this._commands.has(t.id))throw new Error(`[CommandRegistry]: command "${t.id}" has been registered before.`);return this._commands.set(t.id,t),this._commandTypes.set(t.id,t.type),Ye(()=>{this.unregisterCommand(t.id)})}unregisterCommand(t){this._commands.delete(t),this._commandTypes.delete(t)}hasCommand(t){return this._commands.has(t)}getCommand(t){return this._commands.has(t)?[this._commands.get(t)]:null}getCommandType(t){return this._commandTypes.get(t)}}const Eu={id:"nil",type:0,handler:()=>!0};exports.CommandService=class extends Xe{constructor(n,r,s){super();p(this,"_commandRegistry");p(this,"_beforeCommandExecutionListeners",[]);p(this,"_commandExecutedListeners",[]);p(this,"_collabMutationListeners",[]);p(this,"_multiCommandDisposables",new Map);p(this,"_commandExecutingLevel",0);p(this,"_commandExecutionStack",[]);this._injector=n,this._logService=r,this._configService=s,this._commandRegistry=new G_,this.registerCommand(Eu)}dispose(){super.dispose(),this._commandExecutedListeners.length=0,this._beforeCommandExecutionListeners.length=0,this._collabMutationListeners.length=0}hasCommand(n){return this._commandRegistry.hasCommand(n)}registerCommand(n){return this._commandRegistry.registerCommand(n)}unregisterCommand(n){var r;this._commandRegistry.unregisterCommand(n),(r=this._multiCommandDisposables.get(n))==null||r.dispose()}registerMultipleCommand(n){return this._registerMultiCommand(n)}beforeCommandExecuted(n){if(this._beforeCommandExecutionListeners.indexOf(n)===-1)return this._beforeCommandExecutionListeners.push(n),Ye(()=>{const r=this._beforeCommandExecutionListeners.indexOf(n);this._beforeCommandExecutionListeners.splice(r,1)});throw new Error("[CommandService]: could not add a listener twice.")}onCommandExecuted(n){if(this._commandExecutedListeners.indexOf(n)===-1)return this._commandExecutedListeners.push(n),Ye(()=>{const r=this._commandExecutedListeners.indexOf(n);this._commandExecutedListeners.splice(r,1)});throw new Error("[CommandService]: could not add a listener twice.")}onMutationExecutedForCollab(n){if(this._collabMutationListeners.indexOf(n)===-1)return this._collabMutationListeners.push(n),Ye(()=>{const r=this._collabMutationListeners.indexOf(n);this._collabMutationListeners.splice(r,1)});throw new Error("[CommandService]: could not add a collab mutation listener twice.")}async executeCommand(n,r,s){try{const i=this._commandRegistry.getCommand(n);if(i){const[o]=i,a={id:o.id,type:o.type,params:r},l=this._pushCommandExecutionStack(a),c=s!=null?s:{};this._beforeCommandExecutionListeners.forEach(h=>h(a,c));const u=await this._execute(o,r,c);return c.syncOnly?o.type===2&&this._collabMutationListeners.forEach(h=>h(a,c)):(this._commandExecutedListeners.forEach(h=>h(a,c)),o.type===2&&this._collabMutationListeners.forEach(h=>h(a,c))),l.dispose(),u}throw new Error(`[CommandService]: command "${n}" is not registered.`)}catch(i){if(i instanceof ws)return!1;throw i}}syncExecuteCommand(n,r,s){var i;try{const o=this._commandRegistry.getCommand(n);if(o){const[a]=o,l={id:a.id,type:a.type,params:r};if(a.type===2){const d=Hd(this._commandExecutionStack,f=>f.type===0);d&&(l.params=(i=l.params)!=null?i:{},l.params.trigger=d.id)}const c=this._pushCommandExecutionStack(l),u=s!=null?s:{};this._beforeCommandExecutionListeners.forEach(d=>d(l,u));const h=this._syncExecute(a,r,u);return u.syncOnly?a.type===2&&this._collabMutationListeners.forEach(d=>d(l,u)):(this._commandExecutedListeners.forEach(d=>d(l,u)),a.type===2&&this._collabMutationListeners.forEach(d=>d(l,u))),c.dispose(),h}throw new Error(`[CommandService]: command "${n}" is not registered.`)}catch(o){if(o instanceof ws)return!1;throw o}}_pushCommandExecutionStack(n){return this._commandExecutionStack.push(n),Ye(()=>kr(this._commandExecutionStack,n))}_registerMultiCommand(n){const r=this._commandRegistry.getCommand(n.id);let s;if(r){if(r[0].multi!==!0)throw new Error("Command has registered as a single command.");s=r[0]}else{s=new K_(n.id);const o=new zs;o.add(this._commandRegistry.registerCommand(s)),o.add(Ye(()=>{this._multiCommandDisposables.delete(n.id)})),this._multiCommandDisposables.set(n.id,o)}const i=s.registerImplementation(n);return Ye(()=>{var o;i.dispose(),s.hasImplementations()||(o=this._multiCommandDisposables.get(n.id))==null||o.dispose()})}async _execute(n,r,s){if(s!=null&&s.syncOnly)return!0;this._configService.getConfig(Ns)!==!1&&this._logService.debug("[CommandService]",`${"|-".repeat(Math.max(this._commandExecutingLevel,0))}executing command "${n.id}"`),this._commandExecutingLevel++;let i;try{i=await this._injector.invoke(n.handler,r,s),this._commandExecutingLevel--}catch(o){throw i=!1,this._commandExecutingLevel=0,o}return i}_syncExecute(n,r,s){if(s!=null&&s.syncOnly)return!0;this._configService.getConfig(Ns)!==!1&&this._logService.debug("[CommandService]",`${"|-".repeat(Math.max(0,this._commandExecutingLevel))}executing command "${n.id}".`),this._commandExecutingLevel++;let i;try{if(i=this._injector.invoke(n.handler,r,s),i instanceof Promise)throw new TypeError("[CommandService]: Command handler should not return a promise.");this._commandExecutingLevel--}catch(o){throw i=!1,this._commandExecutingLevel=0,o}return i}};exports.CommandService=z_([_i(0,ye.Inject(ye.Injector)),_i(1,mt),_i(2,$r)],exports.CommandService);class K_{constructor(t){p(this,"name");p(this,"multi",!0);p(this,"type",0);p(this,"priority",0);p(this,"_implementations",[]);p(this,"handler",async(t,n)=>{if(!this._implementations.length)return!1;const r=t.get(mt),s=t.get(er),i=t.get(ye.Injector);for(const o of this._implementations){const a=o.command.preconditions;if((!a||a&&a(s))&&(r.debug("[MultiCommand]",`executing implementation "${o.command.name}".`),await i.invoke(o.command.handler,n)))return!0}return!1});this.id=t,this.name=t}registerImplementation(t){const n={command:t};return this._implementations.push(n),this._implementations.sort((r,s)=>s.command.priority-r.command.priority),Ye(()=>{const r=this._implementations.indexOf(n);this._implementations.splice(r,1)})}hasImplementations(){return this._implementations.length>0}}function Xs(e,t,n){const r=e.map(s=>()=>t.syncExecuteCommand(s.id,s.params,n));return gc(r)}function X_(e,t,n){const r=e.map(s=>()=>t.executeCommand(s.id,s.params,n));return mc(r)}function Cu(e){return new le.Observable(t=>{const n=e((...r)=>t.next(r));return()=>n==null?void 0:n.dispose()})}function Hi(e){return function(n){return new le.Observable(r=>(n.subscribe({next:s=>{r.next(s),e(s)&&r.complete()},complete:()=>r.complete(),error:s=>r.error(s)}),()=>r.unsubscribe()))}}function q_(e=0){return t=>{let n=[];return t.pipe(le.tap(r=>n.push(r)),le.debounceTime(e),le.map(()=>n),le.tap(()=>n=[]))}}function J_(e){const t=new le.ReplaySubject(1);return setTimeout(()=>t.next(),e),t.pipe(le.take(1))}function Z_(e,t){const n=new le.BehaviorSubject(t);return e.subscribe(n),n}const Q_=e=>new Promise(t=>{le.merge(Cu(e.onCommandExecuted.bind(e)).pipe(us.filter(([n])=>n.type===jr.MUTATION)),le.timer(300)).pipe(us.debounceTime(16),us.first()).subscribe(()=>{t()})});function Ru(e,t){let n=0,r=e.length-1;if(t<e[0])return 0;if(t>=e[e.length-1])return e.length-1;for(;n<=r;){if(e[n]===t){for(;n<e.length&&e[n]===t;)n++;return n}if(t>e[n]&&t<e[n+1])return n+1;if(e[r]===t){for(;r<e.length&&e[r]===t;)r++;return r}if(t>e[r-1]&&t<e[r])return r;n++,r--}return-1}function ep(e,t){let n=0,r=e.length-1;for(;n<=r;){const s=Math.floor((r+n)/2);if(t<e[s]&&(s===0||t>=e[s-1]))return s;if(t>=e[s])n=s+1;else if(t<e[s])r=s-1;else return-1}return-1}function Iu(e,t){let n=0,r=e.length;for(;n<r;){const s=Math.floor((n+r)/2);e[s]<=t?n=s+1:r=s}return n<e.length?n:e.length-1}function ur(e,t,n=!1){let r=e.length-1;if(t<0||t<e[0])return 0;if(e.length<40||t<=e[20]||t>=e[r-20]?r=Ru(e,t):r=Iu(e,t),n){const s=e[r];return e.indexOf(s)}return r}function tp(e){const t=new Blob([e],{type:"text/javascript"});return window.URL.createObjectURL(t)}const hr=2,Su=1;function np(e,t){if(t==null||e==null)return!0;const{left:n=0,top:r=0,height:s=0,width:i=0,angle:o=0}=t,{left:a=0,top:l=0,height:c=0,width:u=0,angle:h=0}=e,d=u,f=c,g=i,_=s;return Math.abs(a-n)>hr||Math.abs(l-r)>hr||Math.abs(d-g)>hr||Math.abs(f-_)>hr||Math.abs(h-o)>Su}function hs(e,t,n){const{dataStream:r,textRuns:s=[]}=e;let i=t;const o=[];for(const a of s){const{st:l,ed:c}=a;Z.hasIntersectionBetweenTwoRanges(t,n,l,c)&&(l>i?(o.push(r.slice(i,l)),o.push(Bi(r,{...a,ed:Math.min(c,n)}))):o.push(Bi(r,{...a,st:i,ed:Math.min(c,n)}))),i=Math.max(t,Math.min(c,n))}return i!==n&&o.push(r.slice(i,n)),o.join("")}function rp(e,t=!0){var n;if(t&&((n=e.paragraphs)!=null&&n.length)){const{dataStream:r,paragraphs:s=[]}=e;let i="",o=-1;for(const a of s){const{startIndex:l,paragraphStyle:c={}}=a,{spaceAbove:u,spaceBelow:h,lineSpacing:d}=c,f=[];u!=null&&(typeof u=="number"?f.push(`margin-top: ${u}px`):f.push(`margin-top: ${u.v}px`)),h!=null&&(typeof h=="number"?f.push(`margin-bottom: ${h}px`):f.push(`margin-bottom: ${h.v}px`)),d!=null&&f.push(`line-height: ${d}`),l>o+1?i+=`<p class="UniverNormal" ${f.length?`style="${f.join("; ")};"`:""}>${hs(e,o+1,l)}</p>`:i+=`<p class="UniverNormal" ${f.length?`style="${f.join("; ")};"`:""}></p>`,o=l}return o!==r.length&&(i+=hs(e,o,r.length)),i}else return hs(e,0,e.dataStream.length)}function Bi(e,t){const{st:n,ed:r,ts:s={}}=t,{ff:i,fs:o,it:a,bl:l,ul:c,st:u,ol:h,bg:d,cl:f,va:g}=s;let _=e.slice(n,r);const R=[];return a===ie.TRUE&&(_=`<i>${_}</i>`),g===Vt.SUPERSCRIPT?_=`<sup>${_}</sup>`:g===Vt.SUBSCRIPT&&(_=`<sub>${_}</sub>`),(c==null?void 0:c.s)===ie.TRUE&&(_=`<u>${_}</u>`),(u==null?void 0:u.s)===ie.TRUE&&(_=`<s>${_}</s>`),l===ie.TRUE&&(_=`<strong>${_}</strong>`),i&&R.push(`font-family: ${i}`),f&&R.push(`color: ${f.rgb}`),o&&R.push(`font-size: ${o}pt`),h&&R.push("text-decoration: overline"),d&&R.push(`background: ${d.rgb}`),R.length?`<span style="${R.join("; ")};">${_}</span>`:_}const Ou={[Ks.OFFICE]:{[ot.ACCENT1]:"#4472C4",[ot.ACCENT2]:"#ED7D31",[ot.ACCENT3]:"#A5A5A5",[ot.ACCENT4]:"#70AD47",[ot.ACCENT5]:"#5B9BD5",[ot.ACCENT6]:"#70AD47",[ot.DARK1]:"#000000",[ot.DARK2]:"#44546A",[ot.LIGHT1]:"#FFFFFF",[ot.LIGHT2]:"#E7E6E6",[ot.HYPERLINK]:"#0563C1",[ot.FOLLOWED_HYPERLINK]:"#954F72"}};class qs{constructor(){p(this,"_themeValue",ot.LIGHT1);p(this,"_themeColors");p(this,"_themeTint");p(this,"_rgbValue","");p(this,"_colorType");this._colorType=It.UNSUPPORTED,this._themeColors=Ks.OFFICE,this._themeTint=0}asRgbColor(){return new Ms(this._rgbValue,this)}asThemeColor(){return new Ds(this._themeValue,this._themeTint,this._themeColors,this)}build(){switch(this._colorType){case It.THEME:return this.asThemeColor();case It.RGB:return this.asRgbColor();case It.UNSUPPORTED:throw new Error("unsupported color type")}}setRgbColor(t){return this._colorType=It.RGB,this._rgbValue=t,this}setThemeColors(t){this._colorType=It.THEME,this._themeColors=t}setThemeTint(t){this._colorType=It.THEME,this._themeTint=t}setThemeColor(t){return this._colorType=It.THEME,this._themeValue=t,this}getColorType(){return this._colorType}}class On{constructor(t){p(this,"_builder");this._builder=t}static rgbColorToHexValue(t){return`#${((1<<24)+(t.getRed()<<16)+(t.getGreen()<<8)+t.getBlue()).toString(16).slice(1)}`}static hexValueToRgbColor(t){t?t.indexOf("#")>-1&&(t=t.substring(1)):t="#000000";const n=+`0x${t[0]}${t[1]}`,r=+`0x${t[2]}${t[3]}`,s=+`0x${t[4]}${t[5]}`;return new qs().setRgbColor(`rgb(${n},${r},${s})`).asRgbColor()}static hexToRgbString(t){const n=/^#?([a-f\d])([a-f\d])([a-f\d])$/i;t=t.replace(n,(i,o,a,l)=>o+o+a+a+l+l);const r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);let s=null;if(r){const i=Number.parseInt(r[1],16),o=Number.parseInt(r[2],16),a=Number.parseInt(r[3],16);s=`rgba(${i},${o},${a})`}return s}asRgbColor(){return this._builder.asRgbColor()}asThemeColor(){return this._builder.asThemeColor()}getColorType(){return this._builder.getColorType()}clone(){return new On(this._builder)}equals(t){return!1}}class wu{constructor(t){p(this,"_saturation",0);p(this,"_hue",0);p(this,"_lightness",0);p(this,"_alpha",0);const n=t.getRed()/255,r=t.getGreen()/255,s=t.getBlue()/255,i=t.getAlpha()/255,o=Math.min(n,Math.min(r,s)),a=Math.max(n,Math.max(r,s)),l=a-o;if(a===o){this._hue=0,this._saturation=0,this._lightness=a;return}this._lightness=(o+a)/2,this._lightness<.5?this._saturation=l/(a+o):this._saturation=l/(2-a-o),n===a&&(this._hue=(r-s)/l),r===a&&(this._hue=2+(s-n)/l),s===a&&(this._hue=4+(n-r)/l),this._hue*=60,this._hue<0&&(this._hue+=360),this._alpha=i}asRgbColor(){const t=new qs;if(this._saturation===0)return t.setRgbColor(`rgba(${this._lightness*255},${this._lightness*255},${this._lightness*255},${this._alpha*255})`),t.asRgbColor();let n;this._lightness<.5?n=this._lightness*(1+this._saturation):n=this._lightness+this._saturation-this._lightness*this._saturation;const r=2*this._lightness-n,s=this._hue/360,i=s+1/3,o=this.setColor(n,r,i),a=this.setColor(n,r,s),l=s-1/3,c=this.setColor(n,r,l);return t.setRgbColor(`rgba(${Math.round(o*255)},${Math.round(a*255)},${Math.round(c*255)},${this._alpha*255})`),t.asRgbColor()}getLightness(){return this._lightness}getHue(){return this._hue}getSaturation(){return this._saturation}getAlpha(){return this._alpha}setColor(t,n,r){r<0&&(r+=1),r>1&&(r-=1);let s;return 6*r<1?s=n+(t-n)*6*r:2*r<1?s=t:3*r<2?s=n+(t-n)*(2/3-r)*6:s=n,s}setLightness(t){this._lightness=t}}const Ct=class Ct extends On{constructor(n,r){super(r);p(this,"_cssString");p(this,"_red");p(this,"_green");p(this,"_blue");p(this,"_alpha");let s=n.match(Ct.RGBA_EXTRACT);if(s){const i=+s[1],o=+s[2],a=+s[3],l=+s[4];this._cssString=n,this._red=i,this._green=o,this._blue=a,this._alpha=l;return}if(s=n.match(Ct.RGB_EXTRACT),s){const i=+s[1],o=+s[2],a=+s[3];this._cssString=n,this._red=i,this._green=o,this._blue=a,this._alpha=1;return}throw new Error("Invalid rgba or rgb color")}asHexString(){return On.rgbColorToHexValue(this)}getRed(){let n=this._red+Ct.RGB_COLOR_AMT;return n>255?n=255:n<0&&(n=0),n}getGreen(){let n=this._green+Ct.RGB_COLOR_AMT;return n>255?n=255:n<0&&(n=0),n}getBlue(){let n=this._blue+Ct.RGB_COLOR_AMT;return n>255?n=255:n<0&&(n=0),n}getAlpha(){return this._alpha}getColorType(){return It.RGB}clone(){return new Ct(this._cssString,this._builder)}asThemeColor(){throw new Error("rgb color not support to themeColor")}equals(n){return n instanceof Ct?n._red===this._red&&n._blue===this._blue&&n._green===this._green&&n._alpha===this._alpha:!1}getCssString(){return this._cssString}};p(Ct,"RGB_COLOR_AMT",0),p(Ct,"RGBA_EXTRACT",new RegExp("\\s*rgba\\s*\\((\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d.\\d|\\d\\s*)\\)\\s*")),p(Ct,"RGB_EXTRACT",new RegExp("\\s*rgb\\s*\\((\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d+\\s*)\\)\\s*"));let Ms=Ct;const Qt=class Qt extends On{constructor(n,r,s,i){super(i);p(this,"_themeColorType");p(this,"_themeTint");p(this,"_themeColors");this._themeColorType=n,this._themeTint=r,this._themeColors=s}lumValue(n,r){if(n==null)return r;let s;return n<0?s=r*(1+n):s=r*(1-n)+(255-255*(1-n)),s}asRgbColor(){const n=Ou[this._themeColors];if(n==null)throw new Error("not find themeColors type");const r=n[this._themeColorType];if(r==null)throw new Error("not find themeColors value");let s;if(Qt._cacheThemeColor.has(this._themeColors)){if(s=Qt._cacheThemeColor.get(this._themeColors),s.has(this._themeColorType))return s.get(this._themeColorType)}else s=new Map,Qt._cacheThemeColor.set(this._themeColors,s);const i=new wu(On.hexValueToRgbColor(r));i.setLightness(this.lumValue(this._themeTint,i.getLightness()*255)/255);const o=i.asRgbColor();return s.set(this._themeColorType,o),o}clone(){return new Qt(this._themeColorType,this._themeTint,this._themeColors,this._builder)}equals(n){return n instanceof Qt?n._themeColorType===this._themeColorType:!1}getColorType(){return It.THEME}getThemeColorType(){return this._themeColorType}};p(Qt,"_cacheThemeColor",new Map);let Ds=Qt;const sp="rgb(",ip="rgba(",$i={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],blanchealmond:[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],darkyellow:[139,128,0],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],midbightblue:[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]};class Rt{constructor(t){p(this,"_color");p(this,"_rgbColor");p(this,"_isValid",!1);if(t==null){this._setNullColor();return}if(t instanceof Rt){this._color={...t._color},this._rgbColor={...t._rgbColor};return}const n=vu(t);if(n==null){this._setNullColor();return}this._color=n;const r=up(this._color);if(r==null){this._setNullColor();return}this._rgbColor=r,this._isValid=!0}static mix(t,n,r){var c,u;r=Math.min(1,Math.max(0,r));const s=new Rt(t).toRgb(),i=new Rt(n).toRgb(),o=(c=s.a)!=null?c:1,a=(u=i.a)!=null?u:1,l={r:(i.r-s.r)*r+s.r,g:(i.g-s.g)*r+s.g,b:(i.b-s.b)*r+s.b,a:(a-o)*r+o};return new Rt(l)}static getContrastRatio(t,n){const r=new Rt(t).getLuminance(),s=new Rt(n).getLuminance();return(Math.max(r,s)+.05)/(Math.min(r,s)+.05)}get isValid(){return this._isValid}toRgb(){return this._rgbColor}toRgbString(){const{r:t,g:n,b:r,a:s=1}=this.toRgb(),i=s<1;return`rgb${i?"a":""}(${t},${n},${r}${i?`,${s}`:""})`}toString(){return this.toRgbString()}toHexString(t){const{r:n,g:r,b:s,a:i=1}=this.toRgb(),o=i<1,a=[es(Math.round(n).toString(16)),es(Math.round(r).toString(16)),es(Math.round(s).toString(16)),es(Math.round(i*255).toString(16))];return t&&a[0][0]===a[0][1]&&a[1][0]===a[1][1]&&a[2][0]===a[2][1]&&a[3][0]===a[3][1]?o?`#${a[0][0]}${a[1][0]}${a[2][0]}${a[3][0]}`:`#${a[0][0]}${a[1][0]}${a[2][0]}`:o?`#${a[0]}${a[1]}${a[2]}${a[3]}`:`#${a[0]}${a[1]}${a[2]}`}toHsv(){return mp(this.toRgb())}toHsl(){return fp(this.toRgb())}lighten(t=10){const n=this.toHsl();return n.l+=t,n.l=Math.min(Math.max(n.l,0),100),new Rt(n)}darken(t=10){const n=this.toHsl();return n.l-=t,n.l=Math.min(Math.max(n.l,0),100),new Rt(n)}setAlpha(t){return new Rt({...this._rgbColor,a:t})}getLuminance(){let{r:t,g:n,b:r}=this.toRgb();return t=pi(t),n=pi(n),r=pi(r),Number((.2126*t+.7152*n+.0722*r).toFixed(3))}getBrightness(){const{r:t,g:n,b:r}=this.toRgb();return(t*299+n*587+r*114)/1e3}getAlpha(){var t;return(t=this._color.a)!=null?t:1}isDark(){return this.getBrightness()<128}isLight(){return!this.isDark()}_setNullColor(){this._isValid=!1,this._color={r:0,g:0,b:0,a:0},this._rgbColor={r:0,g:0,b:0,a:0}}}const es=e=>e.length===1?`0${e}`:e,pi=e=>(e/=255,e<=.03928?e/12.92:((e+.055)/1.055)**2.4),vu=e=>{if(_p(e)){if("r"in e){const r={r:Math.round(e.r),g:Math.round(e.g),b:Math.round(e.b)};return e.a!==void 0&&(r.a=e.a),r}if("l"in e){const r={h:Math.round(e.h),s:e.s,l:e.l};return e.a!==void 0&&(r.a=e.a),r}const n={h:Math.round(e.h),s:e.s,v:e.v};return e.a!==void 0&&(n.a=e.a),n}const t=e.trim().toLowerCase();if($i[t]){const n=$i[t],r={r:Math.round(n[0]),g:Math.round(n[1]),b:Math.round(n[2])};return r.a=n[3]||1,r}if(t.startsWith("#"))return op(t);if(t.startsWith("rgb"))return ap(t);if(t.startsWith("hsl"))return lp(t);if(t.startsWith("hsv"))return cp(t)},op=e=>{const t=e.substring(1),n=new RegExp(`.{1,${t.length>=6?2:1}}`,"g");let r=t.match(n);if(!r||r.length<3)throw new Error(`The color '${e}' is illegal hex color`);r[0].length===1&&(r=r.map(i=>i+i));const s={r:Number.parseInt(r[0],16),g:Number.parseInt(r[1],16),b:Number.parseInt(r[2],16)};return r.length>3&&(s.a=Number.parseInt(r[3],16)/255),s},ap=e=>{const t=e.indexOf("(");if(t===-1)throw new Error(`The color '${e}' is illegal rgb color`);const n=e.substring(t+1,e.length-1).split(",");if(n.length<3)throw new Error(`The color '${e}' is illegal rgb color`);const r={r:Number.parseInt(n[0],10),g:Number.parseInt(n[1],10),b:Number.parseInt(n[2],10)};return n.length>3&&(r.a=Number.parseFloat(n[3])),r},lp=e=>{const t=e.indexOf("(");if(t===-1)throw new Error(`The color '${e}' is illegal hsl color`);const n=e.substring(t+1,e.length-1).split(",");if(n.length<3)throw new Error(`The color '${e}' is illegal hsl color`);const r={h:Number.parseInt(n[0],10),s:Number.parseFloat(n[1]),l:Number.parseFloat(n[2])};return n.length>3&&(r.a=Number.parseFloat(n[3])),r},cp=e=>{const t=e.indexOf("(");if(t===-1)throw new Error(`The color '${e}' is illegal hsv color`);const n=e.substring(t+1,e.length-1).split(",");if(n.length<3)throw new Error(`The color '${e}' is illegal hsv color`);const r={h:Number.parseInt(n[0],10),s:Number.parseFloat(n[1]),v:Number.parseFloat(n[2])};return n.length>3&&(r.a=Number.parseFloat(n[3])),r},up=e=>{const t=vu(e);if(t!=null)return"r"in t?t:"l"in t?hp(t):dp(t)},Ei=(e,t,n)=>(n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e),hp=e=>{let{h:t,s:n,l:r}=e;t/=360,n/=100,r/=100;let s=0,i=0,o=0;if(n===0)s=i=o=r;else{const l=r<.5?r*(1+n):r+n-r*n,c=2*r-l;s=Ei(c,l,t+1/3),i=Ei(c,l,t),o=Ei(c,l,t-1/3)}const a={r:Math.round(s*255),g:Math.round(i*255),b:Math.round(o*255)};return e.a!==void 0&&(a.a=e.a),a},dp=e=>{let{h:t,s:n,v:r}=e;t=t/360*6,n/=100,r/=100;const s=Math.floor(t),i=t-s,o=r*(1-n),a=r*(1-i*n),l=r*(1-(1-i)*n),c=s%6,u=[r,a,o,o,l,r][c],h=[l,r,r,a,o,o][c],d=[o,o,l,r,r,a][c],f={r:u*255,g:h*255,b:d*255};return e.a!==void 0&&(f.a=e.a),f},fp=e=>{let{r:t,g:n,b:r}=e;t/=255,n/=255,r/=255;const s=Math.max(t,n,r),i=Math.min(t,n,r),o=(s+i)/2;let a,l;if(s===i)a=l=0;else{const u=s-i;switch(l=o>.5?u/(2-s-i):u/(s+i),s){case t:a=(n-r)/u+(n<r?6:0);break;case n:a=(r-t)/u+2;break;default:a=(t-n)/u+4;break}a/=6}const c={h:Math.round(a*360),s:Math.round(l*100),l:Math.round(o*100)};return e.a!==void 0&&(c.a=e.a),c},mp=e=>{let{r:t,g:n,b:r}=e;t/=255,n/=255,r/=255;const s=Math.max(t,n,r),i=Math.min(t,n,r);let o;const a=s,l=s-i,c=s===0?0:l/s;if(s===i)o=0;else{switch(s){case t:o=(n-r)/l+(n<r?6:0);break;case n:o=(r-t)/l+2;break;default:o=(t-n)/l+4;break}o/=6}const u={h:Math.round(o*360),s:Math.round(c*100),v:Math.round(a*100)};return e.a!==void 0&&(u.a=e.a),u},gp=e=>e==null,_p=e=>!gp(e)&&typeof e=="object";function pp(e){const t=/^#(?:[0]{3}|[0]{6})\b/,n=/^rgb\s*\(\s*0+\s*,\s*0+\s*,\s*0+\s*\)$/,r=/^rgba\s*\(\s*0+\s*,\s*0+\s*,\s*0+\s*,\s*(1|1\.0*|0?\.\d+)\)$/,s=/^hsl\s*\(\s*0*\s*,\s*0%*\s*,\s*0%*\s*\)$/,i=/^hsla\s*\(\s*0*\s*,\s*0%*\s*,\s*0%*\s*,\s*(1|1\.0*|0?\.\d+)\)$/;return!!(t.test(e)||n.test(e)||r.test(e)||s.test(e)||i.test(e))}function Ep(e){const t=/^#(?:[Ff]{3}|[Ff]{6})\b/,n=/^rgb\s*\(\s*255\s*,\s*255\s*,\s*255\s*\)$/,r=/^rgba\s*\(\s*255\s*,\s*255\s*,\s*255\s*,\s*(1|1\.0*|0?\.\d+)\)$/,s=/^hsl\s*\(\s*0*\s*,\s*0%*\s*,\s*100%*\s*\)$/,i=/^hsla\s*\(\s*0*\s*,\s*0%*\s*,\s*100%*\s*,\s*(1|1\.0*|0?\.\d+)\)$/;return!!(t.test(e)||n.test(e)||r.test(e)||s.test(e)||i.test(e))}function bu(e){return e&&(e.s!==void 0||e.p!==void 0||e.v!==void 0||e.t!==void 0||e.f!==void 0||e.si!==void 0||e.custom!==void 0)}function Cp(e){if(e.t!==void 0)return e.t;if(typeof e.v=="string")return nn.STRING;if(typeof e.v=="number")return nn.NUMBER;if(typeof e.v=="boolean")return nn.BOOLEAN}function Rp(e){if(e==null)return!0;const{v:t,f:n,si:r,p:s,custom:i}=e;return!(!(t==null||typeof t=="string"&&t.length===0)||n!=null&&n.length>0||r!=null&&r.length>0||s!=null||i!=null)}function yu(e){return e!=null&&(typeof e=="string"||typeof e=="number"||typeof e=="boolean")}var _e=(e=>(e[e.NORMAL=0]="NORMAL",e[e.ROW=1]="ROW",e[e.COLUMN=2]="COLUMN",e[e.ALL=3]="ALL",e))(_e||{}),Me=(e=>(e[e.NONE=0]="NONE",e[e.ROW=1]="ROW",e[e.COLUMN=2]="COLUMN",e[e.ALL=3]="ALL",e))(Me||{});function Ip(e){return[e.startRow,e.startColumn,e.endRow,e.endColumn]}var Au=(e=>(e.NONE="none",e.BACKWARD="backward",e.FORWARD="forward",e))(Au||{}),Tu=(e=>(e.RECT="RECT",e.TEXT="TEXT",e))(Tu||{});function Sp(e,t,n){let r=!1,s=!1,i=e,o=t,a=e,l=t;if(n==null)return{actualRow:e,actualColumn:t,isMergedMainCell:s,isMerged:r,endRow:i,endColumn:o,startRow:a,startColumn:l};for(let c=0;c<n.length;c++){const{startRow:u,endRow:h,startColumn:d,endColumn:f}=n[c];if(e===u&&t===d){i=h,o=f,a=u,l=d,s=!0;break}if(e>=u&&e<=h&&t>=d&&t<=f){i=h,o=f,a=u,l=d,r=!0;break}}return{actualRow:e,actualColumn:t,isMergedMainCell:s,isMerged:r,endRow:i,endColumn:o,startRow:a,startColumn:l}}var Hn=(e=>(e.Raw="raw",e.Intercepted="intercepted",e.Both="both",e))(Hn||{});const dr=2,fr=2**2,ds=2**3,mr=2**4,gr=2**5,_r=2**6,ji=2**7,Wi=2**8,Yi=2**9,Op=0,wp=2958466,vp=-694324,bp=35830291,yp=-1,Xa=1,Vn=6,Ao="general",To="hash",zn="zero",No="qmark",Mo="slash",Mr="group",Ls="scale",Do="comma",Lo="break",Js="text",xo="plus",Uo="minus",xs="point",Po="space",ko="percent",Zs="digit",Fo="calendar",Dr="error",Ho="datetime",Bo="duration",$o="condition",jo="dbnum",Wo="natnum",Yo="locale",Vo="color",Nu="modifier",zo="ampm",Go="escaped",Ko="string",Xo="skip",qo="exp",Jo="fill",Zo="paren",Qs="char",Ap=["#000","#FFF","#F00","#0F0","#00F","#FF0","#F0F","#0FF","#000","#FFF","#F00","#0F0","#00F","#FF0","#F0F","#0FF","#800","#080","#008","#880","#808","#088","#CCC","#888","#99F","#936","#FFC","#CFF","#606","#F88","#06C","#CCF","#008","#F0F","#FF0","#0FF","#808","#800","#088","#00F","#0CF","#CFF","#CFC","#FF9","#9CF","#F9C","#C9F","#FC9","#36F","#3CC","#9C0","#FC0"],Vi=["¤","$","£","¥","֏","؋","৳","฿","៛","₡","₦","₩","₪","₫","€","₭","₮","₱","₲","₴","₸","₹","₺","₼","₽","₾","₿"],zi=new RegExp("["+Vi.join("")+"]"),Ci=Object.freeze({1078:"af",1052:"sq",1118:"am",5121:"ar_DZ",15361:"ar_BH",3073:"ar_EG",2049:"ar_IQ",11265:"ar_JO",13313:"ar_KW",12289:"ar_LB",4097:"ar_LY",6145:"ar_MA",8193:"ar_OM",16385:"ar_QA",1025:"ar_SA",10241:"ar_SY",7169:"ar_TN",14337:"ar_AE",9217:"ar_YE",1067:"hy",1101:"as",2092:"az_AZ",1068:"az_AZ",1069:"eu",1059:"be",2117:"bn",1093:"bn_IN",5146:"bs",1026:"bg",1109:"my",1027:"ca",2052:"zh_CN",3076:"zh_HK",5124:"zh_MO",4100:"zh_SG",1028:"zh_TW",1050:"hr",1029:"cs",1030:"da",1125:"dv",2067:"nl_BE",1043:"nl_NL",1126:"bin",3081:"en_AU",10249:"en_BZ",4105:"en_CA",9225:"en_CB",2057:"en_GB",16393:"en_IN",6153:"en_IE",8201:"en_JM",5129:"en_NZ",13321:"en_PH",7177:"en_ZA",11273:"en_TT",1033:"en_US",12297:"en_ZW",1061:"et",1071:"mk",1080:"fo",1065:"fa",1124:"fil",1035:"fi",2060:"fr_BE",11276:"fr_CM",3084:"fr_CA",9228:"fr_CG",12300:"fr_CI",1036:"fr_FR",5132:"fr_LU",13324:"fr_ML",6156:"fr_MC",14348:"fr_MA",10252:"fr_SN",4108:"fr_CH",7180:"fr",1122:"fy_NL",2108:"gd_IE",1084:"gd",1110:"gl",1079:"ka",3079:"de_AT",1031:"de_DE",5127:"de_LI",4103:"de_LU",2055:"de_CH",1032:"el",1140:"gn",1095:"gu",1279:"en",1037:"he",1081:"hi",1038:"hu",1039:"is",1136:"ig_NG",1057:"id",1040:"it_IT",2064:"it_CH",1041:"ja",1099:"kn",1120:"ks",1087:"kk",1107:"km",1111:"kok",1042:"ko",1088:"ky",1108:"lo",1142:"la",1062:"lv",1063:"lt",2110:"ms_BN",1086:"ms_MY",1100:"ml",1082:"mt",1112:"mni",1153:"mi",1102:"mr",1104:"mn",2128:"mn",1121:"ne",1044:"no_NO",2068:"no_NO",1096:"or",1045:"pl",1046:"pt_BR",2070:"pt_PT",1094:"pa",1047:"rm",2072:"ro_MO",1048:"ro_RO",1049:"ru",2073:"ru_MO",1083:"se",1103:"sa",3098:"sr_SP",2074:"sr_SP",1072:"st",1074:"tn",1113:"sd",1115:"si",1051:"sk",1060:"sl",1143:"so",1070:"sb",11274:"es_AR",16394:"es_BO",13322:"es_CL",9226:"es_CO",5130:"es_CR",7178:"es_DO",12298:"es_EC",17418:"es_SV",4106:"es_GT",18442:"es_HN",2058:"es_MX",19466:"es_NI",6154:"es_PA",15370:"es_PY",10250:"es_PE",20490:"es_PR",1034:"es_ES",14346:"es_UY",8202:"es_VE",1089:"sw",2077:"sv_FI",1053:"sv_SE",1114:"syc",1064:"tg",1097:"ta",1092:"tt",1098:"te",1054:"th",1105:"bo",1073:"ts",1055:"tr",1090:"tk",1058:"uk",1056:"ur",2115:"uz_UZ",1091:"uz_UZ",1075:"ve",1066:"vi",1106:"cy",1076:"xh",1085:"yi",1077:"zu"}),Mu=/^([a-z\d]+)(?:[_-]([a-z\d]+))?(?:\.([a-z\d]+))?(?:@([a-z\d]+))?$/i,Bn={},E=(e,t="")=>e.replace(/~/g,t).split(";"),ke=(e,t=0,n=0)=>(e.mmm||(e.mmm=t<1?e.mmmm.concat():e.mmmm.map(r=>{const s=r.slice(0,t%10);return s+(t<10||r===s?"":".")})),e.ddd||(e.ddd=n<1?e.dddd.concat():e.dddd.map(r=>{const s=r.slice(0,n%10);return s+(n<10||r===s?"":".")})),!e.mmm6&&e.mmmm6&&(e.mmm6=e.mmmm6),e),Tp={group:" ",decimal:".",positive:"+",negative:"-",percent:"%",exponent:"E",nan:"NaN",infinity:"∞",ampm:E("AM;PM"),mmmm6:E("Muharram;Safar;Rabiʻ I;Rabiʻ II;Jumada I;Jumada II;Rajab;Shaʻban;Ramadan;Shawwal;Dhuʻl-Qiʻdah;Dhuʻl-Hijjah"),mmm6:E("Muh.;Saf.;Rab. I;Rab. II;Jum. I;Jum. II;Raj.;Sha.;Ram.;Shaw.;Dhuʻl-Q.;Dhuʻl-H."),mmmm:E("January;February;March;April;May;June;July;August;September;October;November;December"),mmm:E("Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sep;Oct;Nov;Dec"),dddd:E("Sunday;Monday;Tuesday;Wednesday;Thursday;Friday;Saturday"),ddd:E("Sun;Mon;Tue;Wed;Thu;Fri;Sat"),bool:E("TRUE;FALSE"),preferMDY:!1};function Qo(e){const t=Mu.exec(e);if(!t)throw new SyntaxError(`Malformed locale: ${e}`);return{lang:t[1]+(t[2]?"_"+t[2]:""),language:t[1],territory:t[2]||""}}function ea(e){if(typeof e=="number")return Ci[e&65535]||null;const t=parseInt(e,16);return isFinite(t)&&Ci[t&65535]?Ci[t&65535]||null:Mu.test(e)?e:null}function tr(e){const t=ea(e);let n=null;if(t){const r=Qo(t);n=Bn[r.lang]||Bn[r.language]||null}return n}function Gi(e){return Object.assign({},Tp,e)}function te(e,t){const n=typeof t=="object"?t:Qo(t);return Bn[n.lang]=Gi(e),n.language!==n.lang&&!Bn[n.language]&&(Bn[n.language]=Gi(e)),Bn[n.lang]}const an=Gi({group:",",preferMDY:!0});an.isDefault=!0;te({group:",",ampm:E("上午;下午"),mmmm:E("一月;二月;三月;四月;五月;六月;七月;八月;九月;十月;十一月;十二月"),mmm:E("1月;2月;3月;4月;5月;6月;7月;8月;9月;10月;11月;12月"),dddd:E("~日;~一;~二;~三;~四;~五;~六","星期"),ddd:E("周日;周一;周二;周三;周四;周五;周六")},"zh_CN");const ta={group:",",ampm:E("上午;下午"),mmmm:E("1月;2月;3月;4月;5月;6月;7月;8月;9月;10月;11月;12月"),mmm:E("1月;2月;3月;4月;5月;6月;7月;8月;9月;10月;11月;12月"),dddd:E("~日;~一;~二;~三;~四;~五;~六","星期"),ddd:E("周日;周一;周二;周三;周四;周五;周六")};te({...ta,nan:"非數值",dddd:E("~日;~一;~二;~三;~四;~五;~六","星期")},"zh_TW");te({...ta,dddd:E("~日;~一;~二;~三;~四;~五;~六","星期")},"zh_HK");te({...ta,ampm:E("午前;午後"),dddd:E("日~;月~;火~;水~;木~;金~;土~","曜日"),ddd:E("日;月;火;水;木;金;土")},"ja");te({group:",",ampm:E("오전;오후"),mmmm:E("1월;2월;3월;4월;5월;6월;7월;8월;9월;10월;11월;12월"),mmm:E("1월;2월;3월;4월;5월;6월;7월;8월;9월;10월;11월;12월"),dddd:E("일요일;월요일;화요일;수요일;목요일;금요일;토요일"),ddd:E("일;월;화;수;목;금;토")},"ko");te({group:",",ampm:E("ก่อนเที่ยง;หลังเที่ยง"),mmmm:E("มกร~;กุมภาพันธ์;มีน~;เมษายน;พฤษภ~;มิถุนายน;กรกฎ~;สิงห~;กันยายน;ตุล~;พฤศจิกายน;ธันว~","าคม"),mmm:E("ม.ค.;ก.พ.;มี.ค.;เม.ย.;พ.ค.;มิ.ย.;ก.ค.;ส.ค.;ก.ย.;ต.ค.;พ.ย.;ธ.ค."),dddd:E("วันอาทิตย์;วันจันทร์;วันอังคาร;วันพุธ;วันพฤหัสบดี;วันศุกร์;วันเสาร์"),ddd:E("อา.;จ.;อ.;พ.;พฤ.;ศ.;ส.")},"th");te(ke({decimal:",",ampm:E("dop.;odp."),mmmm:E("ledna;února;března;dubna;května;června;července;srpna;září;října;listopadu;prosince"),mmm:E("I;II;III;IV;V;VI;VII;VIII;IX;X;XI;XII"),dddd:E("neděle;pondělí;úterý;středa;čtvrtek;pátek;sobota"),bool:E("PRAVDA;NEPRAVDA")},-1,2),"cs");te(ke({group:".",decimal:",",mmmm:E("januar;februar;marts;april;maj;juni;juli;august;september;oktober;november;december"),dddd:E("søn~;man~;tirs~;ons~;tors~;fre~;lør~","dag"),bool:E("SAND;FALSK")},13,13),"da");te(ke({group:".",decimal:",",ampm:E("a.m.;p.m."),mmmm:E("januari;februari;maart;april;mei;juni;juli;augustus;september;oktober;november;december"),mmm:E("jan.;feb.;mrt.;apr.;mei;jun.;jul.;aug.;sep.;okt.;nov.;dec."),dddd:E("zondag;maandag;dinsdag;woensdag;donderdag;vrijdag;zaterdag"),bool:E("WAAR;ONWAAR")},-1,2),"nl");te({group:",",preferMDY:!0},"en");te({group:",",preferMDY:!0},"en_US");te({group:","},"en_AU");te({group:","},"en_CA");te({group:","},"en_GB");te({group:",",mmm:E("Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sept;Oct;Nov;Dec")},"en_IE");te(ke({decimal:",",nan:"epäluku",ampm:E("ap.;ip."),mmmm:E("tammi~;helmi~;maalis~;huhti~;touko~;kesä~;heinä~;elo~;syys~;loka~;marras~;joulu~","kuuta"),mmm:E("tammik.;helmik.;maalisk.;huhtik.;toukok.;kesäk.;heinäk.;elok.;syysk.;lokak.;marrask.;jouluk."),dddd:E("sunnun~;maanan~;tiis~;keskiviikkona;tors~;perjan~;lauan~","taina"),bool:E("TOSI;EPÄTOSI")},-1,2),"fi");const na=ke({group:" ",decimal:",",mmmm:E("janvier;février;mars;avril;mai;juin;juillet;août;septembre;octobre;novembre;décembre"),mmm:E("janv.;févr.;mars;avr.;mai;juin;juil.;août;sept.;oct.;nov.;déc."),dddd:E("~manche;lun~;mar~;mercre~;jeu~;vendre~;same~","di"),bool:E("VRAI;FAUX")},-1,13);te({...na},"fr");te({...na,mmm:E("janv.;févr.;mars;avr.;mai;juin;juill.;août;sept.;oct.;nov.;déc.")},"fr_CA");te({group:"'",decimal:".",...na},"fr_CH");const Du=ke({mmmm:E("Januar;Februar;März;April;Mai;Juni;Juli;August;September;Oktober;November;Dezember"),mmm:E("Jan.;Feb.;März;Apr.;Mai;Juni;Juli;Aug.;Sept.;Okt.;Nov.;Dez."),dddd:E("Sonn~;Mon~;Diens~;Mittwoch;Donners~;Frei~;Sams~","tag"),bool:E("WAHR;FALSCH")},-1,12);te({group:".",decimal:",",...Du},"de");te({group:"'",decimal:".",...Du},"de_CH");te(ke({group:".",decimal:",",ampm:E("π.μ.;μ.μ."),mmmm:E("Ιανουαρ~;Φεβρουαρ~;Μαρτ~;Απριλ~;Μαΐου;Ιουν~;Ιουλ~;Αυγούστου;Σεπτεμβρ~;Οκτωβρ~;Νοεμβρ~;Δεκεμβρ~","ίου"),mmm:E("Ιαν;Φεβ;Μαρ;Απρ;Μαΐ;Ιουν;Ιουλ;Αυγ;Σεπ;Οκτ;Νοε;Δεκ"),dddd:E("Κυριακή;Δευτέρα;Τρίτη;Τετάρτη;Πέμπτη;Παρασκευή;Σάββατο")},-1,3),"el");te({decimal:",",ampm:E("de.;du."),mmmm:E("január;február;március;április;május;június;július;augusztus;szeptember;október;november;december"),mmm:E("jan.;febr.;márc.;ápr.;máj.;jún.;júl.;aug.;szept.;okt.;nov.;dec."),dddd:E("vasárnap;hétfő;kedd;szerda;csütörtök;péntek;szombat"),ddd:E("V;H;K;Sze;Cs;P;Szo"),bool:E("IGAZ;HAMIS")},"hu");te(ke({group:".",decimal:",",ampm:E("f.h.;e.h."),mmmm:E("janúar;febrúar;mars;apríl;maí;júní;júlí;ágúst;september;október;nóvember;desember"),dddd:E("sunnu~;mánu~;þriðju~;miðviku~;fimmtu~;föstu~;laugar~","dagur")},13,13),"is");te(ke({group:".",decimal:",",mmmm:E("Januari;Februari;Maret;April;Mei;Juni;Juli;Agustus;September;Oktober;November;Desember"),dddd:E("Minggu;Senin;Selasa;Rabu;Kamis;Jumat;Sabtu")},3,3),"id");const Lu=ke({mmmm:E("gennaio;febbraio;marzo;aprile;maggio;giugno;luglio;agosto;settembre;ottobre;novembre;dicembre"),dddd:E("domenica;lunedì;martedì;mercoledì;giovedì;venerdì;sabato"),bool:E("VERO;FALSO")},3,3);te({group:".",decimal:",",...Lu},"it");te({group:"'",decimal:".",...Lu},"it_CH");const xu={decimal:",",ampm:E("a.m.;p.m."),mmmm:E("januar;februar;mars;april;mai;juni;juli;august;september;oktober;november;desember"),mmm:E("jan.;feb.;mar.;apr.;mai;jun.;jul.;aug.;sep.;okt.;nov.;des."),dddd:E("søn~;man~;tirs~;ons~;tors~;fre~;lør~","dag"),bool:E("SANN;USANN")};te(ke({...xu},-1,13),"nb");te(ke({...xu},-1,13),"no");te(ke({decimal:",",mmmm:E("stycznia;lutego;marca;kwietnia;maja;czerwca;lipca;sierpnia;września;października;listopada;grudnia"),dddd:E("niedziela;poniedziałek;wtorek;środa;czwartek;piątek;sobota"),ddd:E("niedz.;pon.;wt.;śr.;czw.;pt.;sob."),bool:E("PRAWDA;FAŁSZ")},3,-1),"pl");const Uu={group:".",decimal:",",mmmm:E("janeiro;fevereiro;março;abril;maio;junho;julho;agosto;setembro;outubro;novembro;dezembro"),dddd:E("domingo;segunda-feira;terça-feira;quarta-feira;quinta-feira;sexta-feira;sábado"),bool:E("VERDADEIRO;FALSO")};te(ke(Uu,13,13),"pt");te(ke(Uu,13,13),"pt_BR");te({decimal:",",nan:"не число",mmmm:E("января;февраля;марта;апреля;мая;июня;июля;августа;сентября;октября;ноября;декабря"),mmm:E("янв.;февр.;мар.;апр.;мая;июн.;июл.;авг.;сент.;окт.;нояб.;дек."),dddd:E("воскресенье;понедельник;вторник;среда;четверг;пятница;суббота"),ddd:E("вс;пн;вт;ср;чт;пт;сб"),mmmm6:E("рамадан;шавваль;зуль-каада;зуль-хиджжа;мухаррам;раби-уль-авваль;раби-уль-ахир;джумад-уль-авваль;джумад-уль-ахир;раджаб;шаабан;рамадан"),mmm6:E("рам.;шав.;зуль-к.;зуль-х.;мух.;раб. I;раб. II;джум. I;джум. II;радж.;шааб.;рам."),bool:E("ИСТИНА;ЛОЖЬ")},"ru");te(ke({decimal:",",mmmm:E("januára;februára;marca;apríla;mája;júna;júla;augusta;septembra;októbra;novembra;decembra"),dddd:E("nedeľa;pondelok;utorok;streda;štvrtok;piatok;sobota")},3,2),"sk");const Ht={group:".",decimal:",",ampm:E("a. m.;p. m."),mmmm:E("enero;febrero;marzo;abril;mayo;junio;julio;agosto;septiem~;octu~;noviem~;diciem~","bre"),mmm:E("ene;feb;mar;abr;may;jun;jul;ago;sept;oct;nov;dic"),dddd:E("domingo;lunes;martes;miércoles;jueves;viernes;sábado"),ddd:E("dom;lun;mar;mié;jue;vie;sáb"),bool:E("VERDADERO;FALSO")},Np=E("ene;feb;mar;abr;may;jun;jul;ago;sep;oct;nov;dic"),ra=E("ene.;feb.;mar.;abr.;may.;jun.;jul.;ago.;sept.;oct.;nov.;dic.");te({...Ht},"es");te({...Ht},"es_AR");te({...Ht},"es_BO");te({...Ht},"es_CL");te({...Ht},"es_CO");te({...Ht},"es_EC");te({...Ht,mmm:Np,ampm:E("a.m.;p.m.")},"es_MX");te({...Ht,mmm:ra},"es_PY");te({...Ht,mmm:ra},"es_UY");te({...Ht,mmm:ra,mmmm:E("enero;febrero;marzo;abril;mayo;junio;julio;agosto;setiembre;octubre;noviembre;diciembre")},"es_VE");te({decimal:",",ampm:E("fm;em"),mmmm:E("januari;februari;mars;april;maj;juni;juli;augusti;september;oktober;november;december"),mmm:E("jan.;feb.;mars;apr.;maj;juni;juli;aug.;sep.;okt.;nov.;dec."),dddd:E("sön~;mån~;tis~;ons~;tors~;fre~;lör~","dag"),ddd:E("sön;mån;tis;ons;tors;fre;lör")},"sv");te(ke({group:".",decimal:",",ampm:E("ÖÖ;ÖS"),mmmm:E("Ocak;Şubat;Mart;Nisan;Mayıs;Haziran;Temmuz;Ağustos;Eylül;Ekim;Kasım;Aralık"),mmm:E("Oca;Şub;Mar;Nis;May;Haz;Tem;Ağu;Eyl;Eki;Kas;Ara"),dddd:E("Pazar;Pazartesi;Salı;Çarşamba;Perşembe;Cuma;Cumartesi"),ddd:E("Paz;Pzt;Sal;Çar;Per;Cum;Cmt"),bool:E("DOĞRU;YANLIŞ")},3,-1),"tr");te({group:",",ampm:E("yb;yh"),mmmm:E("Ionawr;Chwefror;Mawrth;Ebrill;Mai;Mehefin;Gorffennaf;Awst;Medi;Hydref;Tachwedd;Rhagfyr"),mmm:E("Ion;Chwef;Maw;Ebr;Mai;Meh;Gorff;Awst;Medi;Hyd;Tach;Rhag"),dddd:E("Dydd Sul;Dydd Llun;Dydd Mawrth;Dydd Mercher;Dydd Iau;Dydd Gwener;Dydd Sadwrn"),ddd:E("Sul;Llun;Maw;Mer;Iau;Gwen;Sad")},"cy");te({group:".",decimal:",",mmmm:E("yanvar;fevral;mart;aprel;may;iyun;iyul;avqust;sentyabr;oktyabr;noyabr;dekabr"),mmm:E("yan;fev;mar;apr;may;iyn;iyl;avq;sen;okt;noy;dek"),dddd:E("bazar;bazar ertəsi;çərşənbə axşamı;çərşənbə;cümə axşamı;cümə;şənbə"),ddd:E("B.;B.e.;Ç.a.;Ç.;C.a.;C.;Ş.")},"az");te(ke({decimal:",",mmmm:E("студзеня;лютага;сакавіка;красавіка;мая;чэрвеня;ліпеня;жніўня;верасня;кастрычніка;лістапада;снежня"),dddd:E("нядзеля;панядзелак;аўторак;серада;чацвер;пятніца;субота"),ddd:E("нд;пн;аў;ср;чц;пт;сб")},3,-1),"be");te({decimal:",",ampm:E("пр.об.;сл.об."),mmmm:E("януари;февруари;март;април;май;юни;юли;август;септември;октомври;ноември;декември"),mmm:E("яну;фев;март;апр;май;юни;юли;авг;сеп;окт;ное;дек"),dddd:E("неделя;понеделник;вторник;сряда;четвъртък;петък;събота"),ddd:E("нд;пн;вт;ср;чт;пт;сб"),bool:E("ИСТИНА;ЛОЖЬ")},"bg");te({group:".",decimal:",",mmmm:E("de gener;de febrer;de març;d’abril;de maig;de juny;de juliol;d’agost;de setembre;d’octubre;de novembre;de desembre"),mmm:E("de gen.;de febr.;de març;d’abr.;de maig;de juny;de jul.;d’ag.;de set.;d’oct.;de nov.;de des."),dddd:E("diumenge;dilluns;dimarts;dimecres;dijous;divendres;dissabte"),ddd:E("dg.;dl.;dt.;dc.;dj.;dv.;ds."),ampm:E("a. m.;p. m.")},"ca");te(ke({group:",",decimal:".",mmmm:E("Enero;Pebrero;Marso;Abril;Mayo;Hunyo;Hulyo;Agosto;Setyembre;Oktubre;Nobyembre;Disyembre"),dddd:E("Linggo;Lunes;Martes;Miyerkules;Huwebes;Biyernes;Sabado")},3,3),"fil");te({group:",",decimal:".",mmmm:E("જાન્યુઆરી;ફેબ્રુઆરી;માર્ચ;એપ્રિલ;મે;જૂન;જુલાઈ;ઑગસ્ટ;સપ્ટેમ્બર;ઑક્ટોબર;નવેમ્બર;ડિસેમ્બર"),mmm:E("જાન્યુ;ફેબ્રુ;માર્ચ;એપ્રિલ;મે;જૂન;જુલાઈ;ઑગસ્ટ;સપ્ટે;ઑક્ટો;નવે;ડિસે"),dddd:E("રવિ~;સોમ~;મંગળ~;બુધ~;ગુરુ~;શુક્ર~;શનિ~","વાર"),ddd:E("રવિ;સોમ;મંગળ;બુધ;ગુરુ;શુક્ર;શનિ")},"gu");te({group:",",decimal:".",ampm:E("לפנה״צ;אחה״צ"),dddd:E("~ראשון;~שני;~שלישי;~רביעי;~חמישי;~שישי;~שבת","יום "),ddd:E("~א׳;~ב׳;~ג׳;~ד׳;~ה׳;~ו׳;שבת","יום "),mmmm:E("ינואר;פברואר;מרץ;אפריל;מאי;יוני;יולי;אוגוסט;ספטמבר;אוקטובר;נובמבר;דצמבר"),mmm:E("ינו׳;פבר׳;מרץ;אפר׳;מאי;יוני;יולי;אוג׳;ספט׳;אוק׳;נוב׳;דצמ׳"),mmmm6:E("רמדאן;שוואל;ד׳ו אל־קעדה;ד׳ו אל־חיג׳ה;מוחרם;רביע אל־אוול;רביע א־ת׳אני;ג׳ומאדא אל־אולא;ג׳ומאדא א־ת׳אניה;רג׳ב;שעבאן;רמדאן"),mmm6:E("רמדאן;שוואל;ד׳ו אל־קעדה;ד׳ו אל־חיג׳ה;מוחרם;רביע א׳;רביע ב׳;ג׳ומאדא א׳;ג׳ומאדא ב׳;רג׳ב;שעבאן;רמדאן")},"he");te(ke({group:".",decimal:",",mmmm:E("siječnja;veljače;ožujka;travnja;svibnja;lipnja;srpnja;kolovoza;rujna;listopada;studenoga;prosinca"),mmm:E("sij;velj;ožu;tra;svi;lip;srp;kol;ruj;lis;stu;pro"),dddd:E("nedjelja;ponedjeljak;utorak;srijeda;četvrtak;petak;subota")},-1,3),"hr");te({decimal:",",mmmm:E("հունվարի;փետրվարի;մարտի;ապրիլի;մայիսի;հունիսի;հուլիսի;օգոստոսի;սեպտեմբերի;հոկտեմբերի;նոյեմբերի;դեկտեմբերի"),mmm:E("հնվ;փտվ;մրտ;ապր;մյս;հնս;հլս;օգս;սեպ;հոկ;նոյ;դեկ"),dddd:E("կիրակի;երկուշաբթի;երեքշաբթի;չորեքշաբթի;հինգշաբթի;ուրբաթ;շաբաթ"),ddd:E("կիր;երկ;երք;չրք;հնգ;ուր;շբթ")},"hy");te(ke({decimal:",",mmmm:E("იანვარი;თებერვალი;მარტი;აპრილი;მაისი;ივნისი;ივლისი;აგვისტო;სექტემბერი;ოქტომბერი;ნოემბერი;დეკემბერი"),dddd:E("კვირა;ორშაბათი;სამშაბათი;ოთხშაბათი;ხუთშაბათი;პარასკევი;შაბათი")},3,3),"ka");te(ke({decimal:",",mmmm:E("қаңтар;ақпан;наурыз;сәуір;мамыр;маусым;шілде;тамыз;қыркүйек;қазан;қараша;желтоқсан"),dddd:E("жексенбі;дүйсенбі;сейсенбі;сәрсенбі;бейсенбі;жұма;сенбі"),ddd:E("жс;дс;сс;ср;бс;жм;сб")},13,-1),"kk");te({group:",",mmmm:E("ಜನವರಿ;ಫೆಬ್ರವರಿ;ಮಾರ್ಚ್;ಏಪ್ರಿಲ್;ಮೇ;ಜೂನ್;ಜುಲೈ;ಆಗಸ್ಟ್;ಸೆಪ್ಟೆಂಬರ್;ಅಕ್ಟೋಬರ್;ನವೆಂಬರ್;ಡಿಸೆಂಬರ್"),mmm:E("ಜನವರಿ;ಫೆಬ್ರವರಿ;ಮಾರ್ಚ್;ಏಪ್ರಿ;ಮೇ;ಜೂನ್;ಜುಲೈ;ಆಗಸ್ಟ್;ಸೆಪ್ಟೆಂ;ಅಕ್ಟೋ;ನವೆಂ;ಡಿಸೆಂ"),dddd:E("ಭಾನು~;ಸೋಮ~;ಮಂಗಳ~;ಬುಧ~;ಗುರು~;ಶುಕ್ರ~;ಶನಿ~","ವಾರ"),ddd:E("ಭಾನು;ಸೋಮ;ಮಂಗಳ;ಬುಧ;ಗುರು;ಶುಕ್ರ;ಶನಿ"),ampm:E("ಪೂರ್ವಾಹ್ನ;ಅಪರಾಹ್ನ")},"kn");te({decimal:",",mmmm:E("sausio;vasario;kovo;balandžio;gegužės;birželio;liepos;rugpjūčio;rugsėjo;spalio;lapkričio;gruodžio"),mmm:E("saus.;vas.;kov.;bal.;geg.;birž.;liep.;rugp.;rugs.;spal.;lapkr.;gruod."),dddd:E("sekmadienis;pirmadienis;antradienis;trečiadienis;ketvirtadienis;penktadienis;šeštadienis"),ddd:E("sk;pr;an;tr;kt;pn;št"),ampm:E("priešpiet;popiet")},"lt");te({decimal:",",mmmm:E("janvāris;februāris;marts;aprīlis;maijs;jūnijs;jūlijs;augusts;septembris;oktobris;novembris;decembris"),mmm:E("janv.;febr.;marts;apr.;maijs;jūn.;jūl.;aug.;sept.;okt.;nov.;dec."),dddd:E("svētdiena;pirmdiena;otrdiena;trešdiena;ceturtdiena;piektdiena;sestdiena"),ddd:E("svētd.;pirmd.;otrd.;trešd.;ceturtd.;piektd.;sestd."),ampm:E("priekšpusdienā;pēcpusdienā")},"lv");te({group:",",decimal:".",mmmm:E("ജനുവരി;ഫെബ്രുവരി;മാർച്ച്;ഏപ്രിൽ;മേയ്;ജൂൺ;ജൂലൈ;ഓഗസ്റ്റ്;സെപ്റ്റംബർ;ഒക്ടോബർ;നവംബർ;ഡിസംബർ"),mmm:E("ജനു;ഫെബ്രു;മാർ;ഏപ്രി;മേയ്;ജൂൺ;ജൂലൈ;ഓഗ;സെപ്റ്റം;ഒക്ടോ;നവം;ഡിസം"),dddd:E("ഞായറാഴ്ച;തിങ്കളാഴ്ച;ചൊവ്വാഴ്ച;ബുധനാഴ്ച;വ്യാഴാഴ്ച;വെള്ളിയാഴ്ച;ശനിയാഴ്ച"),ddd:E("ഞായർ;തിങ്കൾ;ചൊവ്വ;ബുധൻ;വ്യാഴം;വെള്ളി;ശനി")},"ml");te({group:",",decimal:".",mmmm:E("нэгдүгээ~;хоёрдугаа~;гуравдугаа~;дөрөвдүгээ~;тавдугаа~;зургаадугаа~;долоодугаа~;наймдугаа~;есдүгээ~;аравдугаа~;арван нэгдүгээ~;арван хоёрдугаа~","р сар"),mmm:E("1~;2~;3~;4~;5~;6~;7~;8~;9~;10~;11~;12~","-р сар"),dddd:E("ням;даваа;мягмар;лхагва;пүрэв;баасан;бямба"),ddd:E("Ня;Да;Мя;Лх;Пү;Ба;Бя"),ampm:E("ү.ө.;ү.х.")},"mn");te({group:",",decimal:".",mmmm:E("जानेवारी;फेब्रुवारी;मार्च;एप्रिल;मे;जून;जुलै;ऑगस्ट;सप्टेंबर;ऑक्टोबर;नोव्हेंबर;डिसेंबर"),mmm:E("जाने;फेब्रु;मार्च;एप्रि;मे;जून;जुलै;ऑग;सप्टें;ऑक्टो;नोव्हें;डिसें"),dddd:E("रविवार;सोमवार;मंगळवार;बुधवार;गुरुवार;शुक्रवार;शनिवार"),ddd:E("रवि;सोम;मंगळ;बुध;गुरु;शुक्र;शनि")},"mr");te(ke({group:",",decimal:".",mmmm:E("ဇန်နဝါရီ;ဖေဖော်ဝါရီ;မတ်;ဧပြီ;မေ;ဇွန်;ဇူလိုင်;ဩဂုတ်;စက်တင်ဘာ;အောက်တိုဘာ;နိုဝင်ဘာ;ဒီဇင်ဘာ"),mmm:E("ဇန်;ဖေ;မတ်;ဧ;မေ;ဇွန်;ဇူ;ဩ;စက်;အောက်;နို;ဒီ"),dddd:E("တနင်္ဂနွေ;တနင်္လာ;အင်္ဂါ;ဗုဒ္ဓဟူး;ကြာသပတေး;သောကြာ;စနေ"),ampm:E("နံနက်;ညနေ")},-1,0),"my");te({group:",",decimal:".",mmmm:E("ਜਨਵਰੀ;ਫ਼ਰਵਰੀ;ਮਾਰਚ;ਅਪ੍ਰੈਲ;ਮਈ;ਜੂਨ;ਜੁਲਾਈ;ਅਗਸਤ;ਸਤੰਬਰ;ਅਕਤੂਬਰ;ਨਵੰਬਰ;ਦਸੰਬਰ"),mmm:E("ਜਨ;ਫ਼ਰ;ਮਾਰਚ;ਅਪ੍ਰੈ;ਮਈ;ਜੂਨ;ਜੁਲਾ;ਅਗ;ਸਤੰ;ਅਕਤੂ;ਨਵੰ;ਦਸੰ"),dddd:E("ਐਤਵਾਰ;ਸੋਮਵਾਰ;ਮੰਗਲਵਾਰ;ਬੁੱਧਵਾਰ;ਵੀਰਵਾਰ;ਸ਼ੁੱਕਰਵਾਰ;ਸ਼ਨਿੱਚਰਵਾਰ"),ddd:E("ਐਤ;ਸੋਮ;ਮੰਗਲ;ਬੁੱਧ;ਵੀਰ;ਸ਼ੁੱਕਰ;ਸ਼ਨਿੱਚਰ"),ampm:E("ਪੂ.ਦੁ.;ਬਾ.ਦੁ.")},"pa");te({group:".",decimal:",",mmmm:E("ianuarie;februarie;martie;aprilie;mai;iunie;iulie;august;septem~;octom~;noiem~;decem~","brie"),mmm:E("ian.;feb.;mar.;apr.;mai;iun.;iul.;aug.;sept.;oct.;nov.;dec."),dddd:E("duminică;luni;marți;miercuri;joi;vineri;sâmbătă"),ddd:E("dum.;lun.;mar.;mie.;joi;vin.;sâm."),ampm:E("a.m.;p.m.")},"ro");te(ke({group:".",decimal:",",mmmm:E("januar;februar;marec;april;maj;junij;julij;avgust;september;oktober;november;december"),mmm:E("jan.;feb.;mar.;apr.;maj;jun.;jul.;avg.;sep.;okt.;nov.;dec."),dddd:E("nedelja;ponedeljek;torek;sreda;četrtek;petek;sobota"),ampm:E("dop.;pop.")},-1,13),"sl");te(ke({group:".",decimal:",",mmmm:E("јануар;фебруар;март;април;мај;јун;јул;август;септембар;октобар;новембар;децембар"),dddd:E("недеља;понедељак;уторак;среда;четвртак;петак;субота")},3,3),"sr");te({group:",",decimal:".",mmmm:E("ஜனவரி;பிப்ரவரி;மார்ச்;ஏப்ரல்;மே;ஜூன்;ஜூலை;ஆகஸ்ட்;செப்டம்பர்;அக்டோபர்;நவம்பர்;டிசம்பர்"),mmm:E("ஜன.;பிப்.;மார்.;ஏப்.;மே;ஜூன்;ஜூலை;ஆக.;செப்.;அக்.;நவ.;டிச."),dddd:E("ஞாயிறு;திங்கள்;செவ்வாய்;புதன்;வியாழன்;வெள்ளி;சனி"),ddd:E("ஞாயி.;திங்.;செவ்.;புத.;வியா.;வெள்.;சனி")},"ta");te({group:",",decimal:".",mmmm:E("జనవరి;ఫిబ్రవరి;మార్చి;ఏప్రిల్;మే;జూన్;జులై;ఆగస్టు;సెప్టెంబర్;అక్టోబర్;నవంబర్;డిసెంబర్"),mmm:E("జన;ఫిబ్ర;మార్చి;ఏప్రి;మే;జూన్;జులై;ఆగ;సెప్టెం;అక్టో;నవం;డిసెం"),dddd:E("ఆదివారం;సోమవారం;మంగళవారం;బుధవారం;గురువారం;శుక్రవారం;శనివారం"),ddd:E("ఆది;సోమ;మంగళ;బుధ;గురు;శుక్ర;శని")},"te");te({decimal:",",mmmm:E("січня;лютого;березня;квітня;травня;червня;липня;серпня;вересня;жовтня;листопада;грудня"),mmm:E("січ.;лют.;бер.;квіт.;трав.;черв.;лип.;серп.;вер.;жовт.;лист.;груд."),dddd:E("неділю;понеділок;вівторок;середу;четвер;пʼятницю;суботу"),ddd:E("нд;пн;вт;ср;чт;пт;сб"),ampm:E("дп;пп")},"uk");te({group:".",decimal:",",mmmm:E("~1;~2;~3;~4;~5;~6;~7;~8;~9;~10;~11;~12","tháng "),mmm:E("~1;~2;~3;~4;~5;~6;~7;~8;~9;~10;~11;~12","thg "),dddd:E("Chủ Nhật;Thứ Hai;Thứ Ba;Thứ Tư;Thứ Năm;Thứ Sáu;Thứ Bảy"),ddd:E("CN;Th 2;Th 3;Th 4;Th 5;Th 6;Th 7"),ampm:E("SA;CH")},"vi");te(ke({group:"٬",decimal:"٫",ampm:E("ص;م"),mmmm:E("يناير;فبراير;مارس;أبريل;مايو;يونيو;يوليو;أغسطس;سبتمبر;أكتوبر;نوفمبر;ديسمبر"),dddd:E("الأحد;الاثنين;الثلاثاء;الأربعاء;الخميس;الجمعة;السبت"),mmmm6:E("رمضان;شوال;ذو القعدة;ذو الحجة;محرم;ربيع الأول;ربيع الآخرة;جمادى الأولى;جمادى الآخرة;رجب;شعبان;رمضان")},0,0),"ar");te({group:",",decimal:".",mmmm:E("জানুয়ারী;ফেব্রুয়ারী;মার্চ;এপ্রিল;মে;জুন;জুলাই;আগস্ট;সেপ্টেম্বর;অক্টোবর;নভেম্বর;ডিসেম্বর"),mmm:E("জানু;ফেব;মার্চ;এপ্রি;মে;জুন;জুল;আগ;সেপ্টেঃ;অক্টোঃ;নভেঃ;ডিসেঃ"),dddd:E("রবিবার;সোমবার;মঙ্গলবার;বুধবার;বৃহস্পতিবার;শুক্রবার;শনিবার"),ddd:E("রবি;সোম;মঙ্গল;বুধ;বৃহস্পতি;শুক্র;শনি")},"bn");te({group:",",decimal:".",mmmm:E("जनवरी;फ़रवरी;मार्च;अप्रैल;मई;जून;जुलाई;अगस्त;सितंबर;अक्तूबर;नवंबर;दिसंबर"),mmm:E("जन॰;फ़र॰;मार्च;अप्रैल;मई;जून;जुल॰;अग॰;सित॰;अक्तू॰;नव॰;दिस॰"),dddd:E("रविवार;सोमवार;मंगलवार;बुधवार;गुरुवार;शुक्रवार;शनिवार"),ddd:E("रवि;सोम;मंगल;बुध;गुरु;शुक्र;शनि"),ampm:E("am;pm")},"hi");const Pu={overflow:"######",dateErrorThrows:!1,dateErrorNumber:!0,bigintErrorNumber:!1,dateSpanLarge:!0,leap1900:!0,nbsp:!1,throws:!0,invalid:"######",locale:"",ignoreTimezone:!1,grouping:[3,3],indexColors:!0,skipChar:"",repeatChar:""};function St(e,t=0){if(typeof e!="number")return e;if(e<0)return-St(-e,t);if(t){const n=10**t||1;return St(e*n,0)/n}return Math.round(e)}const Mp=1e-13;function ku(e,t=2,n=2){const r=e<0?-1:1,s=10**(t||2),i=10**(n||2);let o=Math.abs(e),a=0,l=0,c=0,u=1,h,d;if(e=o,e%1===0)d=[e*r,1];else if(e<1e-19)d=[r,1e19];else if(e>1e19)d=[1e19*r,1];else{do if(o=1/(o-Math.floor(o)),h=u,u=u*Math.floor(o)+a,a=h,l=c,c=Math.floor(e*u+.5),c>=s||u>=i)return[r*l,a];while(Math.abs(e-c/u)>=Mp&&o!==Math.floor(o));d=[r*c,u]}return d}const ft=Math.floor;function Fu(e,t=!0){if(t&&e>=0){if(e===0)return[1900,1,0];if(e===60)return[1900,2,29];if(e<60)return[1900,e<32?1:2,(e-1)%31+1]}let n=e+68569+2415019;const r=ft(4*n/146097);n=n-ft((146097*r+3)/4);const s=ft(4e3*(n+1)/1461001);n=n-ft(1461*s/4)+31;const i=ft(80*n/2447),o=n-ft(2447*i/80);n=ft(i/11);const a=i+2-12*n;return[100*(r-49)+s+n|0,a|0,o|0]}function Dp(e){return Fu(e+1462)}function Lp(e){if(e===60)throw new Error("#VALUE!");if(e<=1)return[1317,8,29];if(e<60)return[1317,e<32?9:10,1+(e-2)%30];const t=10631/30,n=8.01/60;let r=e+466935;const s=ft(r/10631);r=r-10631*s;const i=ft((r-n)/t);r=r-ft(i*t+n);const o=ft((r+28.5001)/29.5);return o===13?[30*s+i,12,30]:[30*s+i,o,r-ft(29.5001*o-29)]}function Hu(e,t=0,n=!0){const r=ft(e);return t===Vn?Lp(r):t===yp?Dp(r):Fu(r,n)}const ts=Math.floor,Ri=86400;function sa(e,t){let n=null;if(Array.isArray(e)){const[r,s,i,o,a,l]=e;n=Date.UTC(r,s==null?0:s-1,i!=null?i:1,o||0,a||0,l||0)}else if(e instanceof Date&&(n=e*1,!t||!t.ignoreTimezone)){const r=new Date;r.setUTCFullYear(e.getFullYear(),e.getMonth(),e.getDate()),r.setUTCHours(e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()),n=r*1}if(n!=null&&isFinite(n)){const r=n/864e5;return r-(r<=-25509?-25568:-25569)}return null}function xp(e,t){let n=e|0;const r=Ri*(e-n);let s=ts(r);r-s>.9999&&(s+=1,s===Ri&&(s=0,n+=1));const i=s<0?Ri+s:s,[o,a,l]=Hu(e,0,t&&t.leap1900),c=ts(i/60/60)%60,u=ts(i/60)%60,h=ts(i)%60;return[o,a,l,c,u,h]}const Up=["!d-m-y","!d-m-Y","!j-m-y","!j-m-Y","!d-n-y","!d-n-Y","!j-n-y","!j-n-Y","?m-d-y","?m-d-Y","?m-j-y","?m-j-Y","?n-d-y","?n-d-Y","?n-j-y","?n-j-Y","d-M-y","d-M-Y","j-M-y","j-M-Y","M-d-y","M-d-Y","M-j-y","M-j-Y","d-F-y","d-F-Y","F-d-y","F-d-Y","F-j-y","F-j-Y","j-F-y","j-F-Y","y-F-d","y-F-j","y-M-d","y-M-j","Y-F-d","Y-F-j","Y-M-d","Y-m-d","Y-M-j","Y-m-j","Y-n-d","Y-n-j","j-F","j-M","d-F","d-M","n-d","n-j","n-Y","m-d","m-j","m-Y","M-Y","M-y","F-y","F-Y","Y-M","Y-n","Y-m","Y-F","Y-M"],Pp={j:"d",d:"d",D:"ddd",l:"dddd",n:"m",m:"m",M:"mmm",F:"mmmm",y:"yy",Y:"yyyy"},kp={j:"dd",d:"dd",D:"ddd",l:"dddd",n:"mm",m:"mm",M:"mmm",F:"mmmm",y:"yy",Y:"yyyy"},Bu={},$u={};function dt(e,t,n=1){if(e){const r=e[0],s=e.slice(1);r==="!"?dt(s,t,4):r==="?"?dt(s,t,2):(t[r]=t[r]||{},dt(s,t[r],n))}else t.$=n}function qa(e,t){dt(e,t),dt(e+" x",t),dt(e+" l",t),dt(e+" l x",t),dt("l "+e,t),dt("l "+e+" x",t),dt(e+" D",t),dt(e+" D x",t),dt("D "+e,t),dt("D "+e+" x",t)}Up.forEach(e=>{e[0]!=="?"&&qa(e,Bu),e[0]!=="!"&&qa(e,$u)});const Fp=new Date().getUTCFullYear(),Ja=".",Hp=",",Ii=" ",br=" ",yr=" ",fs="'",ms="٬",Bp={".":[Hp,br,yr,fs,ms],",":[Ja,br,yr,fs,ms],"٫":[Ja,br,yr,fs,ms]},Si=e=>e&&e.length===1&&e>="0"&&e<="9";function ia(e,t={}){const n=tr(t.locale||"")||an,r=n.decimal,s=[...Bp[r]||[fs,ms]];!s.includes(n.group)&&n.group!==Ii&&n.group!==r&&s.push(n.group);let i="",o="",a=1,l="",c=!1,u=!1,h=!1,d=!1,f=!1,g=null,_=!1,R=0;const b=[Ii,br,yr,"+","%","(","-"].concat(Vi);for(;b.includes(e[R]);){const v=e[R];if(v==="-"){if(c||u)return null;c=!0,a=-1}else if(zi.test(v)){if(f)return null;f=!0,g=v}else if(v==="("){if(u||c)return null;u=!0,a=-1}else if(v==="%"){if(d)return null;d=!0}R++}let F=!1,k;if(e[R]===r||Si(e[R]))for(;R<e.length;){const v=e[R];if(!k&&s.includes(v))k=v;else if(!(k&&k===v))if(v===r){if(F)break;i+=".",F=!0}else if(Si(v))i+=v;else break;R++}if(e[R]==="e"||e[R]==="E"){o+=e[R],R++,(e[R]==="+"||e[R]==="-")&&(o+=e[R],R++);const v=R;for(;Si(e[R]);)o+=e[R],R++;if(v===R)return null}const W=[Ii,br,yr,"%","$",")"].concat(Vi);for(;W.includes(e[R]);){const v=e[R];if(zi.test(v)){if(f)return null;f=!0,g=v,_=!0}else if(v===")"){if(h||!u)return null;h=!0}else if(v==="%"){if(d)return null;d=!0}R++}if(R!==e.length)return null;let S=parseFloat(i+o);if(!isFinite(S))return null;if(o){if(d||f)return null;l="0.00E+00"}else if(d){if(f)return null;l=i.includes(".")?"0.00%":"0%",S*=.01}else if(f){const v=i.includes(".")?"#,##0.00":"#,##0";_?l=v+g:l=g+v}else k&&(l=i.includes(".")?"#,##0.00":"#,##0");const C={v:S*a};return l&&(C.z=l),C}function $p(e,t,n){if(n<1||t<1||t>12)return!1;if(t===2){const s=e%4===0&&e%100!==0||e%400===0||e===1900?29:28;if(n>s)return!1}else if((t===4||t===6||t===9||t===11)&&n>30||(t===1||t===3||t===5||t===7||t===8||t===10||t===12)&&n>31)return!1;return!0}const Za=(e,t,n=!1)=>{for(const r of t)if(e.startsWith(r[0])){let s=r[0].length;return n&&(r[2]==="D"||r[2]==="M")&&e[s]==="."&&s++,[e.slice(0,s),r]}return["",null]},Ut=(e,t,n,r)=>{const s=n.path||"",i=Object.keys(t);for(let o=0;o<i.length;o++){let a;const l=i[o];if(t[l]){if(l==="$"||l==="€")e||(a=n);else if(l==="-"){const c=/^(\s*([./-]|,\s)\s*|\s+)/.exec(e);if(c){const u=c[1]==="-"||c[1]==="/"||c[1]==="."?c[1]:" ";if(!n.sep||n.sep===u){const h=c[0].replace(/\s+/g," ");a=Ut(e.slice(c[0].length),t[l],{...n,sep:u,path:s+h},r)}}}else if(l===" "){const c=/^[,.]?\s+/.exec(e);if(c){const u=c[0].replace(/\s+/g," ");a=Ut(e.slice(c[0].length),t[l],{...n,path:s+u},r)}}else if(l==="j"||l==="d"){const c=/^(0?[1-9]|1\d|2\d|3[01])\b/.exec(e);c&&(a=Ut(e.slice(c[0].length),t[l],{...n,day:c[0],path:s+l},r))}else if(l==="n"||l==="m"){const c=/^(0?[1-9]|1[012])\b/.exec(e);c&&(a=Ut(e.slice(c[0].length),t[l],{...n,month:+c[0],_mon:c[0],path:s+l},r))}else if(l==="F"||l==="M"){const[c,u]=Za(e,r.mon,r.mp);u&&u[2]===l&&(a=Ut(e.slice(c.length),t[l],{...n,month:u[1],_mon:c,path:s+l},r))}else if(l==="l"||l==="D"){const[c,u]=Za(e,r.day,r.dp);u&&u[2]===l&&(a=Ut(e.slice(c.length),t[l],{...n,path:s+l},r))}else if(l==="y"){const c=/^\d\d\b/.exec(e);if(c){const u=+c[0]>=30?+c[0]+1900:+c[0]+2e3;a=Ut(e.slice(c[0].length),t[l],{...n,year:u,path:s+l},r)}}else if(l==="Y"){const c=/^\d\d\d\d\b/.exec(e);c&&(a=Ut(e.slice(c[0].length),t[l],{...n,year:+c[0],path:s+l},r))}else if(l==="x"){const c=ei(e,{locale:r.locale});c&&(a=Ut("",t[l],{...n,time:c.v,tf:c.z,path:s+l},r))}else throw new Error(`Unknown date token "${l}"`);if(a&&$p(n.year||1916,n.month||1,n.day?+n.day:1))return a}}},ju=e=>e.replace(/\s+/g," ").trim().replace(/’/,"'").replace(/\.$/,"").toLowerCase(),ns=(e,t)=>{const n=e.map((r,s)=>[ju(r),s+1,t]);return n.sort((r,s)=>s[0].length-r[0].length),n};function oa(e,t={}){var i;const n=tr(t.locale||"")||an,r={mon:ns(n.mmmm,"F").concat(ns(n.mmm,"M")),mp:n.mmm[0].at(-1)===".",day:ns(n.dddd,"l").concat(ns(n.ddd,"D")),dp:n.ddd[0].at(-1)===".",locale:t.locale},s=Ut(ju(e),n.preferMDY?$u:Bu,{path:""},r);if(s){if(s.sep==="."&&s.path.length===3)return null;const o=+((i=s.year)!=null?i:Fp);s.day||(s.day=1);let a=-1/0;if(o<1900)return null;o<=1900&&s.month<=2?a=25568:o<1e4&&(a=25569);const l=Date.UTC(o,s.month-1,s.day)/864e5+a+(s.time||0);if(l>=0&&l<=2958465){const c=s._mon[0]==="0"||s.day[0]==="0"||s._mon.length===2&&s.day.length===2,u=s.path.replace(/[jdlDnmMFyYx]/g,h=>h==="x"?s.tf||"":(c?kp[h]:Pp[h])||h);return{v:l,z:u}}}return null}const Oi=e=>e.replace(/\s+/g,"").trim().replace(/\./g,"").toLowerCase();function ei(e,t={}){const n=tr(t.locale||"")||an,r=/^\s*([10]?\d|2[0-4])(?::([0-5]\d|\d))?(?::([0-5]\d|\d))?(\.\d{1,10})?(?=\s*[^\s\d]|$)/.exec(e);let s="";if(r){const i=Oi(e.slice(r[0].length));if(i===Oi(n.ampm[0])||i==="a"||i==="am")s="a";else if(i===Oi(n.ampm[1])||i==="p"||i==="pm")s="p";else if(i)return null}if(r){const[,i,o,a,l]=r;if(l&&!a||!s&&!o&&!a)return null;let c=+(i||0)*1;if(s){if(c>=13)return null;s==="p"&&(c+=12)}const u=+(o||0)*1,h=+(a||0)*1,d=+(l||0)*1;return{v:(c*60*60+u*60+h+d)/(3600*24),z:(i.length===2?"hh":"h")+":mm"+(a?":ss":"")+(s?" AM/PM":"")}}return null}function Wu(e,t={}){const n=tr(t.locale||"")||an,r=e.trim().toLowerCase(),s=n.bool[0].toLowerCase();if(r==="true"||r===s)return{v:!0};const i=n.bool[1].toLowerCase();return r==="false"||r===i?{v:!1}:null}function jp(e,t){var n,r,s;return(s=(r=(n=ia(e,t))!=null?n:oa(e,t))!=null?r:ei(e,t))!=null?s:Wu(e,t)}function gn(e,t,n){return t[n+"_max"]=e.length,t[n+"_min"]=e.replace(/#/g,"").length,t}function ze(e,t){typeof e=="string"?t.push({type:"string",value:e}):t.push(e)}function Qa(e,t){const n=e&&e.type;return n===To||n===zn||n===No||n===Zs&&t==="den"}function pr(e){var k,W,S;const t=[],n={scale:1,percent:!1,text:!1,date:0,date_eval:!1,date_system:Xa,sec_decimals:0,general:!1,clock:24,int_pattern:[],frac_pattern:[],man_pattern:[],den_pattern:[],num_pattern:[],tokens:t};let r="int",s=null;const i=[];let o,a=!1,l=-1,c=!1,u="",h=!1;for(;++l<e.length&&!c;){const C=e[l],v=C.type||Dr;if(u+=C.raw,v===Ao)n.general=!0,ze(C,t);else if(Qa(C,r)){const A=n[r+"_pattern"];Qa(o,r)||(o==null?void 0:o.type)===Mr?(A.push((A.pop()||"")+C.value),s.num+=C.value):(A.push(C.value),s={type:r,num:C.value},ze(s,t))}else if(v===Zo)C.value==="("&&(n.parens=!0),ze(C.value,t);else if(v===Zs)ze(C.value,t);else if(v===Mo)if(h=!0,n[r+"_pattern"].length){if(!s)throw new SyntaxError("Format pattern is missing a numerator");n.fractions=!0,n.num_pattern.push(n[r+"_pattern"].pop()),s.type="num",r="den",ze({type:"div"},t)}else ze(C.value,t);else if(v===Do)ze(",",t);else if(v===Ls)n.scale=.001**C.raw.length;else if(v===Mr){if(r==="int"&&(n.grouping=!0),r==="den")throw new SyntaxError("Cannot group denominator digits")}else if(v===Po)ze(C,t);else if(v===Lo){c=!0;break}else if(v===Js)n.text=!0,ze(C,t);else if(v===xo||v===Uo)ze(C,t);else if(v===Bo){const A=C.value.toLowerCase(),H=A[0],B={type:"",size:0,date:1,pad:A.length};H==="h"?(B.size=mr,B.type="hour-elap"):H==="m"?(B.size=gr,B.type="min-elap"):(B.size=_r,B.type="sec-elap"),n.date=n.date|B.size,i.push(B),ze(B,t)}else if(n.date&&v===xs&&((k=e[l+1])==null?void 0:k.type)===zn){let A=1;l++;let H="0";((W=e[l+1])==null?void 0:W.type)===zn&&(H+="0",A=2,l++),((S=e[l+1])==null?void 0:S.type)===zn&&(H+="0",A=3,l++),u+=H;const B=[_r,ji,Wi,Yi][A];n.date=n.date|B,n.date_eval=!0,n.sec_decimals=Math.max(n.sec_decimals,A),ze({type:"subsec",size:B,decimals:A,date:1},t)}else if(v===Fo)a||(C.value==="B2"||C.value==="b2"?n.date_system=Vn:n.date_system=Xa);else if(v===Ho){const A={type:"",size:0,date:1},H=C.value.toLowerCase(),B=H[0];if(H==="y"||H==="yy")A.size=dr,A.type="year-short";else if(B==="y"||B==="e")A.size=dr,A.type="year";else if(H==="b"||H==="bb")A.size=dr,A.type="b-year-short";else if(B==="b")A.size=dr,A.type="b-year";else if(H==="d"||H==="dd")A.size=ds,A.type="day",A.pad=/dd/.test(H);else if(H==="ddd"||H==="aaa")A.size=ds,A.type="weekday-short";else if(B==="d"||B==="a")A.size=ds,A.type="weekday";else if(B==="h")A.size=mr,A.type="hour",A.pad=/hh/i.test(H);else if(B==="m"){H.length===3?(A.size=fr,A.type="monthname-short"):H.length===5?(A.size=fr,A.type="monthname-single"):H.length>=4&&(A.size=fr,A.type="monthname");const m=i[i.length-1];!A.type&&m&&!m.used&&m.size&(mr|_r)&&(m.used=!0,A.size=gr,A.type="min",A.pad=/mm/.test(H)),A.type||(A.size=fr,A.type="month",A.pad=/mm/.test(H),A.indeterminate=!0)}else if(B==="s"){A.size=_r,A.type="sec",A.pad=/ss/.test(H);const m=i[i.length-1];m&&m.size&gr?A.used=!0:m&&m.indeterminate&&(delete m.indeterminate,m.size=gr,m.type="min",A.used=!0)}n.date=n.date|A.size,n.date_eval=!0,i.push(A),ze(A,t)}else if(v===zo)n.clock=12,n.date=n.date|mr,n.date_eval=!0,C.short=C.value==="A/P",ze(C,t);else if(v===Ko||v===Go||v===Qs)ze(C.value,t);else if(v===$o)n.condition=[C.value[0],parseFloat(C.value[1])];else if(v===Yo){const A=C.value.split("-"),H=A.length<2?"":A.slice(1).join("-"),B=A[0];B&&ze(B,t);const m=ea(H);m&&(n.locale=m);const x=parseInt(H,16);isFinite(x)&&x&16711680&&(x>>16&255)===6&&(n.date_system=Vn),a=!0}else if(v===Vo){let A,H=C.value.toLowerCase();(A=/^color\s*(\d+)$/i.exec(H))&&(H=parseInt(A[1],10)),n.color=H}else if(v===ko)n.scale=100,n.percent=!0,ze("%",t);else if(v===xs)ze(C,t),n.date||(n.dec_fractions=!0,r="frac");else if(v===qo)n.exponential=!0,n.exp_plus=C.value.includes("+"),r="man",ze({type:"exp",plus:n.exp_plus},t);else if(v===Xo)ze(C,t);else if(v===Jo)ze(C,t);else if(!(v===jo||v===Wo))throw v===Dr?new SyntaxError(`Illegal character: ${u}`):new SyntaxError(`Unknown token ${v} in ${u}`);o=C}if(n.tokensUsed=l,n.pattern=u,/^((?:\[[^\]]+\])+)(;|$)/.test(n.pattern)&&!/^\[(?:h+|m+|s+)\]/.test(n.pattern)&&ze({type:"text"},t),n.fractions&&n.dec_fractions||n.grouping&&!n.int_pattern.length||n.fractions&&n.exponential||n.fractions&&n.den_pattern.length*n.num_pattern.length===0||h&&!n.fractions&&!n.date||n.exponential&&(n.int_pattern.length||n.frac_pattern.length)*n.man_pattern.length===0)throw new SyntaxError(`Invalid pattern: ${u}`);const d=n.int_pattern.join(""),f=n.man_pattern.join(""),g=n.frac_pattern.join("");gn(d,n,"int");let _=0;for(let C=0;C<d.length;C++){const v=d[d.length-1-C];/^[0-9?]/.test(v)&&(_=C+1)}n.int_min=_,gn(g,n,"frac"),gn(f,n,"man");let R=n.num_pattern.join(""),b=n.den_pattern[0]||"";if(b.includes("?")||R.includes("?")?(b=b.replace(/\d/g,"?"),b=b.replace(/#$/g,"?"),gn(R,n,"num"),gn(b,n,"den"),R=R.replace(/#$/g,"?")):(gn(R,n,"num"),gn(b,n,"den")),n.int_p=d,n.man_p=f,n.num_p=R,n.den_p=b,n.den_pattern.length&&(n.denominator=parseInt(n.den_pattern.join("").replace(/\D/g,""),10)),n.integer=!!d.length,!n.integer&&!n.exponential&&g.length){const C=n.tokens.findIndex(v=>v.type==="point");n.tokens.splice(C,0,{type:"int",value:"#"}),n.integer=!0,n.int_pattern=["#"],n.int_p="#"}if(n.fractions)for(let C=0;C<t.length-1;C++){const v=t[C];if(v.type!=="string"&&v.type!=="space")continue;const A=t[C+1].type;A==="num"?v.rule="num+int":A==="div"?v.rule="num":A==="den"&&(v.rule="den")}return n.grouping&&n.int_pattern.length>1&&(n.grouping=!1),n}function Wp(e){if(e===0)return e;const t=Math.ceil(Math.log10(e<0?-e:e)),n=10**(16-Math.floor(t));return isFinite(n)?Math.round(e*n)/n:0}function Yu(e,t=0){const n=Math.floor(Math.log10(e));return t>1?Math.floor(n/t)*t:n}function Vu(e,t=1){return t<-300?parseFloat(e.toExponential().split("e")[0]):e*10**-t}const Yp={total:1,sign:0,period:0,int:1,frac:0};function Vp(e,t=!0){const n=Math.abs(e);if(!n)return Yp;const r=t&&e<0?1:0,s=Math.floor(n),i=Math.floor(Math.log10(n)+1);let o=0,a=0;if(s!==n){o=1;const l=String(St(n*10**-i,15));let c=l.length,u=!0,h=0;for(;h<=l.length;){if(l[h]==="."){c--;break}else l[h]==="0"&&u?c--:u=!1;h++}a=c-i,a<0&&(a=0,o=0)}return{total:r+Math.max(i,1)+o+a,digits:Math.max(i,0)+a,sign:r,period:o,int:Math.max(i,1),frac:a}}const Dn=(e,t)=>e.replace(/\./,t.decimal),el=(e,t,n)=>{const r=Math.abs(t);let s;return e===1?s=e:s=St(e,5),[Dn(s+"",n),n.exponent,t<0?n.negative:n.positive,r<10?"0":"",r]};function tl(e,t,n,r){const s=n|0;if(typeof n=="string")e.push(n);else if(n===s)e.push(Math.abs(s));else{const i=Math.abs(n);let o=Yu(i),a=Vu(i,o);a===10&&(a=1,o++);const l=Vp(i);if(o>=-4&&o<=-1){const c=i.toPrecision(10+o).replace(/\.?0+$/,"");e.push(Dn(c,r))}else if(o===10){const c=i.toFixed(10).slice(0,12).replace(/\.$/,"");e.push(Dn(c,r))}else if(Math.abs(o)<=9)if(l.total<=11){const c=St(i,9).toFixed(l.frac);e.push(Dn(c,r))}else o===9?e.push(Math.floor(i)):o>=0&&o<9?e.push(Dn(String(St(i,9-o)),r)):e.push(...el(a,o,r));else l.total>=12?e.push(...el(a,o,r)):e.push(Dn(St(i,9).toFixed(l.frac),r))}return e}function _n(e,t=!1){return e==="0"?"0":e==="?"?t?" ":" ":""}const ir=86400,zp=(e,t,n)=>n?e<vp||t>=bp:e<Op||t>=wp;function nl(e,t,n,r){var y,w;let s="",i="",o="",a="",l="",c="",u=0,h=0;if(typeof e=="bigint"){if(e<=Number.MAX_SAFE_INTEGER&&e>=Number.MIN_SAFE_INTEGER)e=Number(e);else return n.bigintErrorNumber?String(e):n.overflow;h=e}else h=Math.trunc(e);let d=0,f=0,g=1,_=0,R=0,b=0,F=0,k=0,W=0;const S=r||an;if(!t.text&&isFinite(t.scale)&&t.scale!==1&&(e=Wp(e*t.scale)),t.exponential){let T=Math.abs(e);T&&(u=Yu(T,t.int_max)),e&&!t.integer&&u++,T=Vu(T,u),t.int_max===1&&St(T,t.frac_max)===10&&(T=1,u++),e=e<0?-T:T,s+=Math.abs(u)}if(t.integer){const T=Math.abs(St(e,t.fractions?1:t.frac_max));c+=T<1?"":Math.floor(T)}const C=(y=n.grouping[0])!=null?y:3,v=(w=n.grouping[1])!=null?w:C;t.dec_fractions&&(l=String(St(e,t.frac_max)).split(".")[1]||"");const A=!t.error&&(t.num_p.includes("0")||t.den_p.includes("0"));let H=A;if(t.fractions){H=A||!!(e%1);const T=Math.abs(t.integer?e%1:e);if(T)if(H=!0,t.denominator&&isFinite(t.denominator))a+=t.denominator,o+=St(T*t.denominator),o==="0"&&(o="",a="",H=A);else{const M=ku(T,1/0,t.den_max);o+=M[0],a+=M[1],t.integer&&o==="0"&&(o="",a="",H=A)}else!e&&!t.integer&&(H=!0,o="0",a="1");t.integer&&!H&&!Math.trunc(e)&&(c="0")}if(t.date){h=Math.trunc(e);const T=ir*(e-h);if(d=Math.floor(T),W=T-d,Math.abs(W)<1e-6?W=0:W>.9999&&(W=0,d+=1,d===ir&&(d=0,h+=1)),W){const M=t.date&Yi||t.date&Wi||t.date&ji;(M===Yi&&W>.9995||M===Wi&&W>.995||M===ji&&W>.95||!M&&W>=.5)&&(d++,W=0)}if(h||t.date_system){const M=Hu(e,t.date_system,n.leap1900);f=M[0],g=M[1],_=M[2]}if(d){const M=d<0?ir+d:d;k=Math.floor(M)%60,F=Math.floor(M/60)%60,b=Math.floor(M/60/60)%60}if(R=(6+h)%7,t.date_eval&&zp(e,h+d/ir,n.dateSpanLarge)){if(n.dateErrorThrows)throw new Error("Date out of bounds");if(n.dateErrorNumber){const M=e<0?[S.negative]:[];return tl(M,{},e,S).join("")}return n.overflow}}const B=_n("?",n.nbsp);u<0?i="-":t.exp_plus&&(i="+");const m=[],x=(T,M,D,P)=>{const J=!P&&T.length>M.length?D.length+T.length-M.length:D.length;T.length<M.length&&(P+=T.length-M.length);for(let z=0;z<J;z++)m.push(T[z+P]||_n(D[z],n.nbsp));return J};let O=!1;const N={int:0,frac:0,man:0,num:0,den:0};for(let T=0,M=t.tokens.length;T<M;T++){const D=t.tokens[T],P=D.type,J=D.num?D.num.length:0;if(P==="string")D.rule?D.rule==="num"?H?m.push(D.value.replace(/ /g,B)):(t.num_min>0||t.den_min>0)&&m.push(D.value.replace(/./g,B)):D.rule==="num+int"?H&&c?m.push(D.value.replace(/ /g,B)):t.den_min>0&&(c||t.num_min)&&m.push(D.value.replace(/./g,B)):D.rule==="den"&&(H?m.push(D.value.replace(/ /g,B)):(t.den_min>0||t.den_min>0)&&m.push(D.value.replace(/./g,B))):m.push(D.value.replace(/ /g,B));else if(P==="space")D.rule==="num+int"?(H||t.num_min||t.den_min)&&(c||t.num_min)&&m.push(B):m.push(B);else if(P==="error")m.push(n.invalid);else if(P==="point")m.push(t.date?D.value:S.decimal);else if(P==="general")tl(m,t,e,S);else if(P==="exp")m.push(S.exponent);else if(P==="minus")D.volatile&&t.date||D.volatile&&(e>=0||typeof e!="number")||(D.volatile&&!t.fractions&&(t.integer||t.dec_fractions)?(e<0&&c&&c!=="0"||l)&&m.push(S.negative):m.push(S.negative));else if(P==="plus")m.push(S.positive);else if(P==="text")m.push(e);else if(P==="fill")n.fillChar&&m.push(n.fillChar,D.value);else if(P==="skip")n.skipChar?m.push(n.skipChar,D.value):m.push(n.nbsp?" ":" ");else if(P==="div")H?m.push("/"):t.num_min>0||t.den_min>0?m.push(B):m.push(_n("#",n.nbsp));else if(P==="int")if(t.int_pattern.length===1){const z=t.int_p,oe=Math.max(t.int_min,c.length);let ce="";for(let I=oe;I>0;I--){const L=c.charAt(c.length-I),Y=L?"":z.charAt(z.length-I)||z[0];let V="";if(t.grouping){const $=I-1-C;$>=0&&!($%v)&&(V=L||Y==="0"?S.group:_n("?",n.nbsp))}ce+=(L||_n(Y,n.nbsp))+V}m.push(ce)}else N.int+=x(c,t.int_p,D.num,N.int);else if(P==="frac"){const z=N.frac;for(let oe=0;oe<J;oe++)m.push(l[oe+z]||_n(D.num[oe],n.nbsp));N.frac+=J}else if(P==="man")!N[P]&&!N.man&&m.push(i),N.man+=x(s,t.man_p,D.num,N.man);else if(P==="num")N.num+=x(o,t.num_p,D.num,N.num);else if(P==="den"){const z=N.den;for(let oe=0;oe<J;oe++){let ce=a[oe+z];if(!ce){const I=D.num[oe];"123456789".includes(I)||O&&I==="0"?(O=!0,ce=n.nbsp?" ":" "):!O&&oe===J-1&&I==="0"&&!a?ce="1":ce=_n(I,n.nbsp)}m.push(ce)}N.den+=J}else if(P==="year")f<0&&m.push(S.negative),m.push(String(Math.abs(f)).padStart(4,"0"));else if(P==="year-short"){const z=f%100;m.push(z<10?"0":"",z)}else if(P==="month")m.push(D.pad&&g<10?"0":"",g);else if(P==="monthname-single")t.date_system===Vn?m.push(S.mmmm6[g-1].charAt(0)):m.push(S.mmmm[g-1].charAt(0));else if(P==="monthname-short")t.date_system===Vn?m.push(S.mmm6[g-1]):m.push(S.mmm[g-1]);else if(P==="monthname")t.date_system===Vn?m.push(S.mmmm6[g-1]):m.push(S.mmmm[g-1]);else if(D.type==="weekday-short")m.push(S.ddd[R]);else if(P==="weekday")m.push(S.dddd[R]);else if(P==="day")m.push(D.pad&&_<10?"0":"",_);else if(P==="hour"){const z=b%t.clock||(t.clock<24?t.clock:0);m.push(D.pad&&z<10?"0":"",z)}else if(P==="min")m.push(D.pad&&F<10?"0":"",F);else if(P==="sec")m.push(D.pad&&k<10?"0":"",k);else if(P==="subsec"){m.push(S.decimal);const z=W.toFixed(t.sec_decimals);m.push(z.slice(2,2+D.decimals))}else if(P==="ampm"){const z=b<12?0:1;D.short&&!r?m.push("AP"[z]):m.push(S.ampm[z])}else if(P==="hour-elap"){e<0&&m.push(S.negative);const z=h*24+Math.floor(Math.abs(d)/3600);m.push(String(Math.abs(z)).padStart(D.pad,"0"))}else if(P==="min-elap"){e<0&&m.push(S.negative);const z=h*1440+Math.floor(Math.abs(d)/60);m.push(String(Math.abs(z)).padStart(D.pad,"0"))}else if(P==="sec-elap"){e<0&&m.push(S.negative);const z=h*ir+Math.abs(d);m.push(String(Math.abs(z)).padStart(D.pad,"0"))}else if(P==="b-year")m.push(f+543);else if(P==="b-year-short"){const z=(f+543)%100;m.push(z<10?"0":"",z)}}return m.join("")}const Gp=pr([{type:Js,value:"@",raw:"@"}]);function zu(e,t){for(let n=0;n<3;n++){const r=t[n];if(r){let s;if(r.condition){const i=r.condition[0],o=r.condition[1];i==="="?s=e===o:i===">"?s=e>o:i==="<"?s=e<o:i===">="?s=e>=o:i==="<="?s=e<=o:i==="<>"&&(s=e!==o)}else s=!0;if(s)return r}}}function Kp(e,t,n){const r=t.partitions;let s=r[3],i=null;return(typeof e=="number"||typeof e=="bigint")&&isFinite(e)&&(s=zu(e,r)),s&&s.color&&(i=s.color),i&&typeof i=="number"&&n.indexColors&&(i=Ap[i-1]||"#000"),i}function Xp(e,t,n){const r=t.partitions,s=tr(t.locale||n.locale),i=r[3]?r[3]:Gp;if(typeof e=="boolean"&&(e=(s||an).bool[e?0:1]),e==null)return"";const o=typeof e=="bigint";if(typeof e!="number"&&!o)return nl(e,i,n,s);if(!o&&!isFinite(e)){const l=s||an;return isNaN(e)?l.nan:(e<0?l.negative:"")+l.infinity}const a=zu(e,r);return a?nl(e,a,n,s):n.overflow}function Gu(e){return!!(e[0]&&e[0].percent||e[1]&&e[1].percent||e[2]&&e[2].percent||e[3]&&e[3].percent)}function Ku(e){return!!(e[0]&&e[0].date||e[1]&&e[1].date||e[2]&&e[2].date||e[3]&&e[3].date)}function Xu(e){const[t,n,r,s]=e;return!!((!t||t.generated)&&(!n||n.generated)&&(!r||r.generated)&&s&&s.text&&!s.generated)}const qp={text:15,datetime:10.8,date:10.8,time:10.8,percent:10.6,currency:10.4,grouped:10.2,scientific:6,number:4,fraction:2,general:0,error:0},Jp=[["DMY",1],["DM",2],["MY",3],["MDY",4],["MD",5],["hmsa",6],["hma",7],["hms",8],["hm",9]];function Zp(e,t=null){var h;const[n,r]=e,s=n.frac_max,i={type:"general",isDate:Ku(e),isText:Xu(e),isPercent:Gu(e),maxDecimals:n.general?9:s,scale:(h=n.scale)!=null?h:1,color:0,parentheses:0,grouped:n.grouping?1:0},o=!i.isDate&&!i.isText&&!n.error&&n.tokens.some(d=>d.type==="string"&&(t?d.value===t:zi.test(d.value)));let a="G",l=s>=0?Math.min(15,s):"",c="",u="";if(r&&r.color&&(u="-",i.color=1),n.parens&&(c="()",i.parentheses=1),o)a="C",i.type="currency";else if(n.error)i.type="error",i.maxDecimals=0;else if(i.isDate){let d=0,f=0,g="";n.tokens.forEach(R=>{const b=R.type;/^(b-)?year/.test(b)?(g+="Y",f++):b.startsWith("month")?(g+="M",f++):/^(week)?day/.test(b)?(g+="D",f++):(b==="hour"||b==="min"||b==="sec"||b==="ampm")&&(g+=b[0],d++)}),i.type="date",f&&d?i.type="datetime":!f&&d&&(i.type="time");const _=Jp.find(R=>g.startsWith(R[0]));a=_?"D":"G",l=_?_[1]:""}else i.isText?(a="G",i.type="text",l="",i.maxDecimals=0):n.general?(a="G",i.type="general",l=""):n.fractions?(a="G",i.type="fraction",l=""):n.exponential?(a="S",i.type="scientific"):i.isPercent?(a="P",i.type="percent"):n.grouping?(a=",",i.type="grouped"):(n.int_max||s)&&(a="F",i.type="number");return i.code=a+l+u+c,i.level=qp[i.type],Object.freeze(i)}function Qp(e){const[t]=e;return{year:!!(t.date&dr),month:!!(t.date&fr),day:!!(t.date&ds),hours:!!(t.date&mr),minutes:!!(t.date&gr),seconds:!!(t.date&_r),clockType:t.clock===12?12:24}}const eE=[[Ao,/^General/i,0],[To,/^#/,0],[zn,/^0/,0],[No,/^\?/,0],[Mo,/^\//,0],[Lo,/^;/,0],[Js,/^@/,0],[xo,/^\+/,0],[Uo,/^-/,0],[xs,/^\./,0],[Po,/^ /,0],[ko,/^%/,0],[Zs,/^[1-9]/,0],[Fo,/^(?:B[12])/i,0],[Dr,/^B$/,0],[Ho,/^(?:[hH]+|[mM]+|[sS]+|[yY]+|[bB]+|[dD]+|[gG]+|[aA]{3,}|e+)/,0],[Bo,/^(?:\[(h+|m+|s+)\])/i,1],[$o,/^\[(<[=>]?|>=?|=)\s*(-?[.\d]+)\]/,[1,2]],[jo,/^\[(DBNum[0-4]?\d)\]/i,1],[Wo,/^\[(NatNum[0-4]?\d)\]/i,1],[Yo,/^\[\$([^\]]+)\]/,1],[Vo,/^\[(black|blue|cyan|green|magenta|red|white|yellow|color\s*\d+)\]/i,1],[Nu,/^\[([^\]]+)\]/,1],[zo,/^(?:AM\/PM|am\/pm|A\/P)/,0],[Go,/^\\(.)/,1],[Ko,/^"([^"]*?)"/,1],[Xo,/^_(\\.|.)/,1],[qo,/^[Ee]([+-])/,1],[Jo,/^\*(\\.|.)/,1],[Zo,/^[()]/,0],[Dr,/^[EÈÉÊËèéêëĒēĔĕĖėĘęĚěȄȅȆȇȨȩNnÑñŃńŅņŇňǸǹ["*/\\_]/,0],[Qs,/^./,0]],tE=63,nE=35,rE=48,sE=57,wi=e=>{const t=(e||"\0").charCodeAt(0);return t===tE||t===nE||t>=rE&&t<=sE};function $n(e){let t=0;const n=[],r=[];for(;t<e.length;){const s=e.slice(t);let i=0;const o=/^(,+)(.)?/.exec(s);if(o){const a=o[1];i=a.length;const l=e[t-1]||"";let c=!1,u=!1;wi(l)?(c=!0,u=!0):l==="."&&(u=!0);const h=o[2]||"";if(c&&(!h||h===";")&&(c=!1),u&&wi(h)&&(u=!1),c&&!u)n.push({type:Mr,value:",",raw:a});else if(!c&&u)n.push({type:Ls,value:",",raw:a});else if(c&&u){const d={type:Ls,value:",",raw:a};n.push(d),r.push(d)}else n.push({type:Do,value:",",raw:a})}else{let a;for(const[l,c,u]of eE){const h=c.exec(s);if(h){const d=Array.isArray(u)?u.map(f=>h[f]):h[u||0];a={type:l,value:d,raw:h[0]},n.push(a),i=h[0].length;break}}r.length&&a.raw===";"&&(r.length=0),r.length&&wi(a.raw)&&(r.forEach(l=>l.type=Mr),r.length=0)}if(!i){const a=s[0];i=1,n.push({type:Qs,value:a,raw:a})}t+=i}return n}const vi=e=>{const t=e.condition;t&&t[1]<0&&(t[0]==="<"||t[0]==="<="||t[0]==="=")||e.tokens.unshift({type:"minus",volatile:!0})},rl=(e,t=null)=>{const n={};for(const r in e)Array.isArray(e[r])?n[r]=[...e[r]]:n[r]=e[r];return t&&n.tokens.unshift(t),n.generated=!0,n};function iE(e){var h;const t=[];let n=!1,r,s=null,i=0,o=!1,a=0,l=0,c=$n(e);do{if(o=pr(c),(o.date||o.general)&&(o.int_pattern.length||o.frac_pattern.length||o.scale!==1||o.text))throw new Error("Illegal format");if(o.condition&&(l++,n=!0),o.text){if(s)throw new Error("Unexpected partition");s=o}o.locale&&(r=ea(o.locale)),t.push(o),i=((h=c[o.tokensUsed])==null?void 0:h.type)==="break"?1:0,c=c.slice(o.tokensUsed+i),a++}while(i&&a<4&&l<3);if(i)throw new Error("Unexpected partition");if(l>2)throw new Error("Unexpected condition");const u=t[3];if(u&&(u.int_pattern.length||u.frac_pattern.length||u.date))throw new Error("Unexpected partition");if(n){const d=t.length;if(d===1&&(t[1]=pr($n("General")),t[1].generated=!0),d<3){const f=t[0],g=t[1];if(vi(f),g.condition)vi(g);else{const _=f.condition;(_[0]==="="||_[1]>=0&&(_[0]===">"||_[0]===">="))&&g.tokens.unshift({type:"minus",volatile:!0})}}else t.forEach(vi)}else{if(t.length<4&&s)for(let d=0,f=t.length;d<f;d++)t[d]===s&&t.splice(d,1);if(t.length<1&&s&&(t[0]=pr($n("General")),t[0].generated=!0),t.length<2){const d={type:"minus",volatile:!0};t.push(rl(t[0],d))}if(t.length<3&&t.push(rl(t[0])),t.length<4)if(s)t.push(s);else{const d=pr($n("@"));d.generated=!0,t.push(d)}t[0].condition=[">",0],t[1].condition=["<",0],t[2].condition=null}return{pattern:e,partitions:t,locale:r}}const sl=Object.create({});function cn(e,t=!1){e||(e="General");let n=sl[e];if(!n)try{n=iE(e),sl[e]=n}catch(r){if(t)throw r;const s={tokens:[{type:"error"}],error:r.message};n={pattern:e,partitions:[s,s,s,s],error:r.message,locale:null}}return n}function qu(e,t,n={}){var o;const r=Object.assign({},Pu,n),s=cn(e,r.throws),i=(o=sa(t,r))!=null?o:t;return Xp(i,s,r)}function oE(e,t,n){var o;const r=Object.assign({},Pu,n),s=cn(e,r.throws),i=(o=sa(t,r))!=null?o:t;return Kp(i,s,r)}function aE(e){const t=cn(e,!1);return Ku(t.partitions)}function lE(e){const t=cn(e,!1);return Gu(t.partitions)}function cE(e){const t=cn(e,!1);return Xu(t.partitions)}function uE(e){try{return cn(e,!0),!0}catch{return!1}}function hE(e,t={}){const n=cn(e,!1);return n.info||(n.info=Zp(n.partitions,t==null?void 0:t.currency)),n.info}function dE(e){const t=cn(e,!1);return t.dateInfo||(t.dateInfo=Qp(t.partitions)),t.dateInfo}const Ln=Object.freeze({AMPM:zo,BREAK:Lo,CALENDAR:Fo,CHAR:Qs,COLOR:Vo,COMMA:Do,CONDITION:$o,DATETIME:Ho,DBNUM:jo,DIGIT:Zs,DURATION:Bo,ERROR:Dr,ESCAPED:Go,EXP:qo,FILL:Jo,GENERAL:Ao,GROUP:Mr,HASH:To,LOCALE:Yo,MINUS:Uo,MODIFIER:Nu,NATNUM:Wo,PAREN:Zo,PERCENT:ko,PLUS:xo,POINT:xs,QMARK:No,SCALE:Ls,SKIP:Xo,SLASH:Mo,SPACE:Po,STRING:Ko,TEXT:Js,ZERO:zn}),fE=Object.freeze(Object.defineProperty({__proto__:null,addLocale:te,dateFromSerial:xp,dateToSerial:sa,dec2frac:ku,format:qu,formatColor:oE,getFormatDateInfo:dE,getFormatInfo:hE,getLocale:tr,isDateFormat:aE,isPercentFormat:lE,isTextFormat:cE,isValidFormat:uE,parseBool:Wu,parseDate:oa,parseLocale:Qo,parseNumber:ia,parseTime:ei,parseValue:jp,round:St,tokenTypes:Ln,tokenize:$n},Symbol.toStringTag,{value:"Module"})),Ju="@@@",Zu="@",aa="General";function mE(e){return e===Ju||e===Zu}function gE(e){return e==null||e===aa}const _E=(e,t)=>{if(e&&!t||!e&&t)return!1;const n=i=>{const o=$n(i);let a="",l=!1,c=!1;for(const u of o){if(u.type===Ln.POINT){l=!0;continue}if(!(c&&u.type===Ln.MINUS)&&u.type!==Ln.SKIP){if(u.type===Ln.COLOR){c=!0;continue}else c=!1;l&&u.type===Ln.ZERO||(l=!1,l||(a+=u.value||""))}}return a},r=n(e),s=n(t);return r===s},pE=new Set(["m d"]),EE=new Set(["h:mm AM/PM","hh:mm AM/PM"]),Qu=e=>{var s,i;const t=(i=(s=oa(e))!=null?s:ei(e))!=null?i:ia(e);if(!t)return null;const{v:n,z:r}=t;return r&&(pE.has(r)||EE.has(r)&&!/\s(A|AM|P|PM)$/i.test(e)||r.includes("#,##0")&&qu(r,n)!==e)?null:t};function CE(e,t){const n={};for(const r in e){const s=Number(r),i=e[s];for(const o in i){const a=Number(o),l=i[a],c=t(s,a,l);c!==void 0&&(n[s]?n[s][a]=c:n[s]={[a]:c})}}return n}function rn(e){let t=0;const n=Object.keys(e);for(const r of n){const s=Number(r);t=Math.max(t,s)}return t+1}function RE(e,t,n){const r=rn(n),s=n;for(let i=r-1;i>=e;i--)s[i]===void 0?delete s[i+1]:s[i+1]=s[i];s[e]=t}function Ki(e,t,n){const r=Object.keys(n).reduce((s,i)=>Math.max(s,Number.parseInt(i)),0)+1;for(let s=e;s<r;s++)s<e+t?delete n[s]:n[s]!==void 0&&(n[s-t]=n[s],delete n[s])}function IE(e,t){const n=e,r=Object.keys(n),s=r.length,i=t,o=Object.keys(i),a=o.length,l={};let c=0;for(let u=0;u<s;u++,c++){const h=r[u];l[c]=n[h]}for(let u=0;u<a;u++,c++){const h=o[u];l[c]=i[h]}return l}function SE(e,t,n){const r=n;if(rn(n)>0){const i={};let o=0;for(let a=e;a<=t;a++)r[a]&&(i[o]=r[a],o++);return i}return{}}function Xi(e,t,n,r){const s=e>n;if(!s&&e+t>n)throw new Error("Invalid move operation");s?OE(e,t,n,r):wE(e,t,n,r)}function OE(e,t,n,r){const s=r,i=[];for(let o=e;o<e+t;o++)i.push(s[o]);for(let o=e-1;o>=n;o--){const a=s[o];s[o+t]=a,a===void 0&&delete s[o+t]}i.forEach((o,a)=>{s[n+a]=o,o===void 0&&delete s[n+a]})}function wE(e,t,n,r){const s=r,i=[];for(let o=e;o<e+t;o++)i.push(s[o]);for(let o=e+t;o<n;o++){const a=s[o];s[o-t]=a,a===void 0&&delete s[o-t]}i.forEach((o,a)=>{s[n+a-t]=o,o===void 0&&delete s[n+a-t]})}class ct{constructor(t={}){p(this,"_matrix");this._setOriginValue(t)}static MakeObjectMatrixSize(t){return new ct({[t-1]:{}})}getMatrix(){return this._matrix}forEach(t){const n=this._matrix,r=Object.keys(n);for(const s of r){const i=Number(s),o=n[i];if(t(i,o)===!1)return this}return this}forRow(t){const n=this._matrix,r=Object.keys(n);for(const s of r){const i=Number(s),o=n[i];if(t(i,Object.keys(o).map(l=>Number(l)))===!1)return this}return this}forValue(t){const n=this._matrix;for(const r in n){const s=Number(r),i=n[s];if(i)for(const o in i){const a=Number(o),l=i[a];if(t(s,a,l)===!1)return this}}return this}swapRow(t,n){const r=this._matrix[t],s=this._matrix[n];this._matrix[t]=s,this._matrix[n]=r}getRow(t){return this._matrix[t]}getRowOrCreate(t){let n=this.getRow(t);return n==null&&(n={},this._matrix[t]=n),n}reset(){this._setOriginValue({})}hasValue(){const t=this._matrix,n=Object.keys(t);if(n.length===0)return!1;for(const r of n){const s=Number(r),i=t[s];if(Object.keys(i).length>0)return!0}return!1}getValue(t,n){var r,s;return(s=(r=this._matrix)==null?void 0:r[t])==null?void 0:s[n]}setValue(t,n,r){const s=this.getRowOrCreate(t);s[n]=r}deleteValue(t,n){var r,s;(s=(r=this._matrix)==null?void 0:r[t])==null||delete s[n]}realDeleteValue(t,n){var r,s,i;if((s=(r=this._matrix)==null?void 0:r[t])==null||delete s[n],this.getRow(t)){const o=this.getRow(t);if(o==null)return;Object.keys(o).length===0&&((i=this._matrix)==null||delete i[t])}}setRow(t,n){this._matrix[t]=n}moveRows(t,n,r){Xi(t,n,r,this._matrix)}moveColumns(t,n,r){this.forEach((s,i)=>{Xi(t,n,r,i)})}insertRows(t,n){const r=Object.keys(this._matrix);for(let s=r.length-1;s>=0;s--){const i=Number(r[s]);if(i>=t){const o=this._matrix[i];delete this._matrix[i],this._matrix[i+n]=o}}}insertColumns(t,n){const r=Object.keys(this._matrix);for(let s=0;s<r.length;s++){const i=Number(r[s]),o=this._matrix[i],a=Object.keys(o);for(let l=a.length-1;l>=0;l--){const c=Number(a[l]);if(c>=t){const u=o[c];delete o[c],o[c+n]=u}}}}removeRows(t,n){Ki(t,n,this._matrix)}removeColumns(t,n){this.forEach((r,s)=>{s&&Ki(t,n,s)})}getFragment(t,n,r,s){const i=new ct;let o=0;for(let a=t;a<=n;a++){const l={};let c=0;for(let u=r;u<=s;u++){const h=this.getValue(a,u);l[c]=h,c++}i.setRow(o,l),o++}return i}getSlice(t,n,r,s){const i=new ct;for(let o=t;o<=n;o++)for(let a=r;a<=s;a++){const l=this.getValue(o,a);l&&i.setValue(o,a,Z.deepClone(l))}return i}getSliceDataAndCellCountByRows(t,n){const r=new ct;let s=0;for(let i=t;i<=n;i++){const o=this.getRow(i);o&&(r.setRow(i,o),s+=Object.keys(o).length)}return{sliceData:r,cellCount:s}}getSizeOf(){return Object.keys(this._matrix).length}getLength(){return rn(this._matrix)}getRange(){const r=this.getLength()-1;let s=0;const i=this.getLength();for(let o=0;o<i;o++){const a=this.getRow(o);if(a){const l=rn(a)-1;s=l>s?l:s}}return{startRow:0,startColumn:0,endRow:r,endColumn:s}}getRealRange(){const t=Object.keys(this._matrix),n=t.length,r=n>0?Number(t[0]):0,s=n>0?Number(t[n-1]):0;let i=-1/0,o=0;for(const a of t){const l=this.getRow(Number(a));if(l){const c=Object.keys(l);if(c.length>0){const u=Number(c[0]),h=Number(c[c.length-1]);(i===-1/0||u<i)&&(i=u),h>o&&(o=h)}}}return i===-1/0&&(i=0),{startRow:r,endRow:s,startColumn:i,endColumn:o}}getRealRowRange(){const t=Object.keys(this._matrix),n=t.length,r=n>0?Number(t[0]):0,s=n>0?Number(t[n-1]):0;return{startRow:r,endRow:s}}toNativeArray(){const t=new Array;return this.forValue((n,r,s)=>{t.push(s)}),t}toArray(){const t=[];return this.forRow((n,r)=>{t[n]==null&&(t[n]=[]),r.forEach(s=>{t[n][s]=this.getValue(n,s)})}),t}toFullArray(){const t=this.getRange(),{endColumn:n,endRow:r}=t,s=[];for(let i=0;i<=r;i++){const o=new Array(n+1).fill(void 0);s.push(o)}return this.forValue((i,o,a)=>{s[i][o]=a}),s}toJSON(){return this._matrix}clone(){const t=JSON.stringify(this._matrix);return JSON.parse(t)}getData(){const t=JSON.stringify(this._matrix);return JSON.parse(t)}getArrayData(){let t=0,n=0,r=!1,s=!1;const i=new ct;return this.forEach((o,a)=>{r||(r=!0,t=o),Object.keys(a).forEach(l=>{const c=Number(l);s?c<n&&(n=c):(s=!0,n=c);const u=this.getValue(o,c);i.setValue(o-t,c-n,u)})}),i.getData()}getStartEndScope(){let t=1/0,n=-1/0,r=1/0,s=-1/0;const i=Object.keys(this._matrix);i.length>0&&(t=+i[0],n=+i[i.length-1]);for(const o of i){const a=Object.keys(this._matrix[o]);a.length>0&&(r=Math.min(r,+a[0]),s=Math.max(s,+a[a.length-1]))}return{startRow:t,endRow:n,startColumn:r,endColumn:s}}getDataRange(){let t=0,n=0,r=0,s=-1,i=!1,o=!1;return this.forEach((a,l)=>{if(i||(i=!0,t=a),l==null)return;const c=rn(l)-1;c>r&&(r=c),Object.keys(l).forEach(u=>{const h=Number(u);o?h<n&&(n=h):(o=!0,n=h)}),a>s&&(s=a)}),{startRow:t,startColumn:n,endRow:s,endColumn:r}}getDiscreteRanges(){const t=[];return this.forEach((n,r)=>{Object.keys(r).forEach(s=>{const i=Number(s);let o=!1;for(const a of t)if(n>=a.startRow&&n<=a.endRow+1&&i>=a.startColumn&&i<=a.endColumn+1){a.endRow=Math.max(n,a.endRow),a.endColumn=Math.max(i,a.endColumn),o=!0;break}o||t.push({startRow:n,endRow:n,startColumn:i,endColumn:i})})}),t}merge(t){this.forValue((n,r)=>{const s=t.getValue(n,r);s!=null&&this.setValue(n,r,s)})}concatRows(t){const n=t.getMatrix();for(const r in n){const s=Number(r);this.setRow(s,n[s])}}_setOriginValue(t={}){this._matrix=t}}function eh(e){const{actualRow:t,actualColumn:n,isMerged:r,isMergedMainCell:s,mergeInfo:i}=e;let{startY:o,endY:a,startX:l,endX:c}=e,u=t,h=n,d=t,f=n;if(r&&i){const{startRow:g,startColumn:_,endRow:R,endColumn:b,startY:F,endY:k,startX:W,endX:S}=i;u=g,h=_,d=R,f=b,o=F,a=k,l=W,c=S}return s&&(o=i.startY,a=i.endY,l=i.startX,c=i.endX,d=i.endRow,f=i.endColumn),{startRow:u,startColumn:h,endRow:d,endColumn:f,startY:o,endY:a,startX:l,endX:c}}const vE=eh;function bE(e){if(!e)return;const{actualRow:t,actualColumn:n,isMerged:r,isMergedMainCell:s,startRow:i,startColumn:o,endRow:a,endColumn:l}=e;let c=t,u=n,h=t,d=n;return(r||s)&&(c=i,u=o,h=a,d=l),{startRow:c,startColumn:u,endRow:h,endColumn:d}}function th(e){var n;return!e||(((n=e==null?void 0:e.v)==null?void 0:n.toString())||"").length===0&&!e.p}function qi(e){return th(e)&&(e==null?void 0:e.coverable)!==!1}function Pt(e){if(e){if(e.rgb)return new Rt(e.rgb).toHexString();if(e.th)return new qs().setThemeColor(e.th).asThemeColor().asRgbColor().getCssString()}return null}function nh(e){return Z.isString(e)&&e.substring(0,1)==="="&&e.length>1}function yE(e){return Z.isString(e)&&e.length>0}function AE(e,t=!1){var i;let n="";const r=new Map([["ff",()=>{e.ff&&(n+=`font-family: ${e.ff}; `)}],["fs",()=>{if(e.fs){let o=e.fs;e.va&&(o/=2),n+=`font-size: ${o}pt; `}}],["it",()=>{e.it&&(n+="font-style: italic; ")}],["bl",()=>{e.bl&&(n+="font-weight: bold; ")}],["ul",()=>{var o;(o=e.ul)!=null&&o.s&&(n.indexOf("text-decoration-line")>-1?n=n.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g,(a,l)=>`${l} underline`):n+="text-decoration: underline; ",e.ul.cl&&n.indexOf("text-decoration-color")===-1&&(n+=`text-decoration-color: ${Pt(e.ul.cl)}; `),e.ul.t&&n.indexOf("text-decoration-style")===-1&&(n+=`text-decoration-style: ${e.ul.t} `))}],["st",()=>{var o;(o=e.st)!=null&&o.s&&(n.indexOf("text-decoration-line")>-1?n=n.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g,(a,l)=>`${l} line-through`):n+="text-decoration-line: line-through; ",e.st.cl&&n.indexOf("text-decoration-color")===-1&&(n+=`text-decoration-color: ${Pt(e.st.cl)}; `),e.st.t&&n.indexOf("text-decoration-style")===-1&&(n+=`text-decoration-style: ${e.st.t} `))}],["ol",()=>{var o;(o=e.ol)!=null&&o.s&&(n.indexOf("text-decoration-line")>-1?n=n.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g,(a,l)=>`${l} overline`):n+="text-decoration-line: overline; ",e.ol.cl&&n.indexOf("text-decoration-color")===-1&&(n+=`text-decoration-color: ${Pt(e.ol.cl)}; `),e.ol.t&&n.indexOf("text-decoration-style")===-1&&(n+=`text-decoration-style: ${e.ol.t} `))}],["bg",()=>{e.bg&&(n+=`background: ${Pt(e.bg)}; `)}],["bd",()=>{var o,a,l,c,u,h,d,f,g,_,R,b;(o=e.bd)!=null&&o.b&&(n+=`border-bottom: ${rs((a=e.bd)==null?void 0:a.b.s)} ${(l=Pt(e.bd.b.cl))!=null?l:""}; `),(c=e.bd)!=null&&c.t&&(n+=`border-top: ${rs((u=e.bd)==null?void 0:u.t.s)} ${(h=Pt(e.bd.t.cl))!=null?h:""}; `),(d=e.bd)!=null&&d.r&&(n+=`border-right: ${rs((f=e.bd)==null?void 0:f.r.s)} ${(g=Pt(e.bd.r.cl))!=null?g:""}; `),(_=e.bd)!=null&&_.l&&(n+=`border-left: ${rs((R=e.bd)==null?void 0:R.l.s)} ${(b=Pt(e.bd.l.cl))!=null?b:""}; `)}],["cl",()=>{e.cl&&(n+=`color: ${Pt(e.cl)}; `)}],["va",()=>{e.va===Vt.SUBSCRIPT?n+="vertical-align: sub; ":e.va===Vt.SUPERSCRIPT&&(n+="vertical-align: super; ")}],["td",()=>{e.td===Nr.LEFT_TO_RIGHT?n+="direction: ltr; ":e.td===Nr.RIGHT_TO_LEFT&&(n+="direction: rtl; ")}],["tr",()=>{var o,a,l;e.tr&&(n+=`--data-rotate: (${(o=e.tr)==null?void 0:o.a}deg${(a=e.tr)!=null&&a.v?` ,${(l=e.tr)==null?void 0:l.v}`:""});`)}],["ht",()=>{e.ht===Nt.LEFT?n+="text-align: left; ":e.ht===Nt.RIGHT?n+="text-align: right; ":e.ht===Nt.CENTER?n+="text-align: center; ":e.ht===Nt.JUSTIFIED&&(n+="text-align: justify; ")}],["vt",()=>{e.vt===pn.BOTTOM?n+="vertical-align: bottom; ":e.vt===pn.TOP?n+="vertical-align: top; ":e.vt===pn.MIDDLE&&(n+="vertical-align: middle; ")}],["tb",()=>{e.tb===Sn.CLIP?n+="white-space: nowrap; overflow-x: hidden; ":e.tb===Sn.WRAP&&(n+="white-space: normal;")}],["pd",()=>{var u,h,d,f,g,_,R,b;const o=`${(u=e.pd)==null?void 0:u.b}pt`,a=`${(h=e.pd)==null?void 0:h.t}pt`,l=`${(d=e.pd)==null?void 0:d.l}pt`,c=`${(f=e.pd)==null?void 0:f.r}pt`;(g=e.pd)!=null&&g.b&&(n+=`padding-bottom: ${o}; `),(_=e.pd)!=null&&_.t&&(n+=`padding-top: ${a}; `),(R=e.pd)!=null&&R.l&&(n+=`padding-left: ${l}; `),(b=e.pd)!=null&&b.r&&(n+=`padding-right: ${c}; `)}]]),s=["bd","tr","tb"];for(const o in e)t&&s.includes(o)||(i=r.get(o))==null||i();return n}function rs(e){let t="";return e===xe.NONE?t="none":e===xe.THIN?t="0.5pt solid":e===xe.HAIR?t="0.5pt double":e===xe.DOTTED?t="0.5pt dotted":e===xe.DASHED||e===xe.DASH_DOT?t="0.5pt dashed":e===xe.DASH_DOT_DOT?t="0.5pt dotted":e===xe.DOUBLE?t="0.5pt double":e===xe.MEDIUM?t="1pt solid":e===xe.MEDIUM_DASHED||e===xe.MEDIUM_DASH_DOT?t="1pt dashed":e===xe.MEDIUM_DASH_DOT_DOT?t="1pt dotted":e===xe.SLANT_DASH_DOT?t="0.5pt dashed":e===xe.THICK&&(t="1.5pt solid"),t}function TE(e){let t=0;if(e=e.trim(),e==="none")t=xe.NONE;else if(e==="0.5pt solid")t=xe.THIN;else if(e==="0.5pt double")t=xe.HAIR;else if(e==="0.5pt dotted")t=xe.DOTTED;else if(e==="0.5pt dashed")t=xe.DASHED;else if(e==="1pt solid")t=xe.MEDIUM;else if(e==="1pt dashed")t=xe.MEDIUM_DASHED;else if(e==="1pt dotted")t=xe.MEDIUM_DASH_DOT_DOT;else if(e==="1.5pt solid")t=xe.THICK;else if(!e.includes("none"))t=xe.THIN;else return xe.NONE;return t}function NE(e,t){let n=e.body;if(t){const{headers:r,footers:s}=e;r!=null&&r[t]?n=r[t].body:s!=null&&s[t]&&(n=s[t].body)}return n}function ME(e,t){const{startRow:n,endRow:r,startColumn:s,endColumn:i,rangeType:o}=e;if(n<0||s<0||r<0||i<0||!(Number.isNaN(n)&&Number.isNaN(r))&&o===_e.COLUMN||!(Number.isNaN(s)&&Number.isNaN(i))&&o===_e.ROW||o!==_e.ROW&&o!==_e.COLUMN&&(Number.isNaN(s)||Number.isNaN(n)||Number.isNaN(i)||Number.isNaN(r)))return!1;if(t){const a=t.getRowCount(),l=t.getColumnCount();if(r>=a||i>=l)return!1}return!0}function DE(e,t){return{startRow:e,endRow:e,startColumn:t,endColumn:t}}function Ji(e){if(nh(e))return{f:e,v:null,p:null};if(yu(e)){if(typeof e=="string"){const t=Qu(e);if(t&&t.z)return{v:t.v,p:null,f:null,s:{n:{pattern:t.z||aa}}}}return{v:e,p:null,f:null}}return bu(e),e}function LE(e,t){const n=new ct,{startRow:r,startColumn:s,endRow:i,endColumn:o}=t;if(Z.isArray(e))for(let a=0;a<=i-r;a++)for(let l=0;l<=o-s;l++)n.setValue(a+r,l+s,Ji(e[a][l]));else new ct(e).forValue((l,c,u)=>{n.setValue(l,c,Ji(u))});return n.getMatrix()}function la(e,t){return Object.prototype.toString.call(e)===Object.prototype.toString.call(t)?Object.prototype.toString.call(e)==="[object Object]"||Object.prototype.toString.call(e)==="[object Array]"?Object.keys(e).length!==Object.keys(t).length?!1:Object.keys(e).every(n=>la(e[n],t[n])):e===t:!1}function rh(e,t){const n=e.ts||{},r=t.ts||{};return e.sId!==t.sId?!1:la(n,r)}function xE(e,t){return t.some(n=>e.indexOf(n)>-1)}var gs={exports:{}},UE=gs.exports,il;function PE(){return il||(il=1,(function(e,t){(function(n,r){e.exports=r()})(UE,(function(){var n=1e3,r=6e4,s=36e5,i="millisecond",o="second",a="minute",l="hour",c="day",u="week",h="month",d="quarter",f="year",g="date",_="Invalid Date",R=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,b=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,F={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(N){var y=["th","st","nd","rd"],w=N%100;return"["+N+(y[(w-20)%10]||y[w]||y[0])+"]"}},k=function(N,y,w){var T=String(N);return!T||T.length>=y?N:""+Array(y+1-T.length).join(w)+N},W={s:k,z:function(N){var y=-N.utcOffset(),w=Math.abs(y),T=Math.floor(w/60),M=w%60;return(y<=0?"+":"-")+k(T,2,"0")+":"+k(M,2,"0")},m:function N(y,w){if(y.date()<w.date())return-N(w,y);var T=12*(w.year()-y.year())+(w.month()-y.month()),M=y.clone().add(T,h),D=w-M<0,P=y.clone().add(T+(D?-1:1),h);return+(-(T+(w-M)/(D?M-P:P-M))||0)},a:function(N){return N<0?Math.ceil(N)||0:Math.floor(N)},p:function(N){return{M:h,y:f,w:u,d:c,D:g,h:l,m:a,s:o,ms:i,Q:d}[N]||String(N||"").toLowerCase().replace(/s$/,"")},u:function(N){return N===void 0}},S="en",C={};C[S]=F;var v="$isDayjsObject",A=function(N){return N instanceof x||!(!N||!N[v])},H=function N(y,w,T){var M;if(!y)return S;if(typeof y=="string"){var D=y.toLowerCase();C[D]&&(M=D),w&&(C[D]=w,M=D);var P=y.split("-");if(!M&&P.length>1)return N(P[0])}else{var J=y.name;C[J]=y,M=J}return!T&&M&&(S=M),M||!T&&S},B=function(N,y){if(A(N))return N.clone();var w=typeof y=="object"?y:{};return w.date=N,w.args=arguments,new x(w)},m=W;m.l=H,m.i=A,m.w=function(N,y){return B(N,{locale:y.$L,utc:y.$u,x:y.$x,$offset:y.$offset})};var x=(function(){function N(w){this.$L=H(w.locale,null,!0),this.parse(w),this.$x=this.$x||w.x||{},this[v]=!0}var y=N.prototype;return y.parse=function(w){this.$d=(function(T){var M=T.date,D=T.utc;if(M===null)return new Date(NaN);if(m.u(M))return new Date;if(M instanceof Date)return new Date(M);if(typeof M=="string"&&!/Z$/i.test(M)){var P=M.match(R);if(P){var J=P[2]-1||0,z=(P[7]||"0").substring(0,3);return D?new Date(Date.UTC(P[1],J,P[3]||1,P[4]||0,P[5]||0,P[6]||0,z)):new Date(P[1],J,P[3]||1,P[4]||0,P[5]||0,P[6]||0,z)}}return new Date(M)})(w),this.init()},y.init=function(){var w=this.$d;this.$y=w.getFullYear(),this.$M=w.getMonth(),this.$D=w.getDate(),this.$W=w.getDay(),this.$H=w.getHours(),this.$m=w.getMinutes(),this.$s=w.getSeconds(),this.$ms=w.getMilliseconds()},y.$utils=function(){return m},y.isValid=function(){return this.$d.toString()!==_},y.isSame=function(w,T){var M=B(w);return this.startOf(T)<=M&&M<=this.endOf(T)},y.isAfter=function(w,T){return B(w)<this.startOf(T)},y.isBefore=function(w,T){return this.endOf(T)<B(w)},y.$g=function(w,T,M){return m.u(w)?this[T]:this.set(M,w)},y.unix=function(){return Math.floor(this.valueOf()/1e3)},y.valueOf=function(){return this.$d.getTime()},y.startOf=function(w,T){var M=this,D=!!m.u(T)||T,P=m.p(w),J=function($,j){var Q=m.w(M.$u?Date.UTC(M.$y,j,$):new Date(M.$y,j,$),M);return D?Q:Q.endOf(c)},z=function($,j){return m.w(M.toDate()[$].apply(M.toDate("s"),(D?[0,0,0,0]:[23,59,59,999]).slice(j)),M)},oe=this.$W,ce=this.$M,I=this.$D,L="set"+(this.$u?"UTC":"");switch(P){case f:return D?J(1,0):J(31,11);case h:return D?J(1,ce):J(0,ce+1);case u:var Y=this.$locale().weekStart||0,V=(oe<Y?oe+7:oe)-Y;return J(D?I-V:I+(6-V),ce);case c:case g:return z(L+"Hours",0);case l:return z(L+"Minutes",1);case a:return z(L+"Seconds",2);case o:return z(L+"Milliseconds",3);default:return this.clone()}},y.endOf=function(w){return this.startOf(w,!1)},y.$set=function(w,T){var M,D=m.p(w),P="set"+(this.$u?"UTC":""),J=(M={},M[c]=P+"Date",M[g]=P+"Date",M[h]=P+"Month",M[f]=P+"FullYear",M[l]=P+"Hours",M[a]=P+"Minutes",M[o]=P+"Seconds",M[i]=P+"Milliseconds",M)[D],z=D===c?this.$D+(T-this.$W):T;if(D===h||D===f){var oe=this.clone().set(g,1);oe.$d[J](z),oe.init(),this.$d=oe.set(g,Math.min(this.$D,oe.daysInMonth())).$d}else J&&this.$d[J](z);return this.init(),this},y.set=function(w,T){return this.clone().$set(w,T)},y.get=function(w){return this[m.p(w)]()},y.add=function(w,T){var M,D=this;w=Number(w);var P=m.p(T),J=function(ce){var I=B(D);return m.w(I.date(I.date()+Math.round(ce*w)),D)};if(P===h)return this.set(h,this.$M+w);if(P===f)return this.set(f,this.$y+w);if(P===c)return J(1);if(P===u)return J(7);var z=(M={},M[a]=r,M[l]=s,M[o]=n,M)[P]||1,oe=this.$d.getTime()+w*z;return m.w(oe,this)},y.subtract=function(w,T){return this.add(-1*w,T)},y.format=function(w){var T=this,M=this.$locale();if(!this.isValid())return M.invalidDate||_;var D=w||"YYYY-MM-DDTHH:mm:ssZ",P=m.z(this),J=this.$H,z=this.$m,oe=this.$M,ce=M.weekdays,I=M.months,L=M.meridiem,Y=function(j,Q,ee,U){return j&&(j[Q]||j(T,D))||ee[Q].slice(0,U)},V=function(j){return m.s(J%12||12,j,"0")},$=L||function(j,Q,ee){var U=j<12?"AM":"PM";return ee?U.toLowerCase():U};return D.replace(b,(function(j,Q){return Q||(function(ee){switch(ee){case"YY":return String(T.$y).slice(-2);case"YYYY":return m.s(T.$y,4,"0");case"M":return oe+1;case"MM":return m.s(oe+1,2,"0");case"MMM":return Y(M.monthsShort,oe,I,3);case"MMMM":return Y(I,oe);case"D":return T.$D;case"DD":return m.s(T.$D,2,"0");case"d":return String(T.$W);case"dd":return Y(M.weekdaysMin,T.$W,ce,2);case"ddd":return Y(M.weekdaysShort,T.$W,ce,3);case"dddd":return ce[T.$W];case"H":return String(J);case"HH":return m.s(J,2,"0");case"h":return V(1);case"hh":return V(2);case"a":return $(J,z,!0);case"A":return $(J,z,!1);case"m":return String(z);case"mm":return m.s(z,2,"0");case"s":return String(T.$s);case"ss":return m.s(T.$s,2,"0");case"SSS":return m.s(T.$ms,3,"0");case"Z":return P}return null})(j)||P.replace(":","")}))},y.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},y.diff=function(w,T,M){var D,P=this,J=m.p(T),z=B(w),oe=(z.utcOffset()-this.utcOffset())*r,ce=this-z,I=function(){return m.m(P,z)};switch(J){case f:D=I()/12;break;case h:D=I();break;case d:D=I()/3;break;case u:D=(ce-oe)/6048e5;break;case c:D=(ce-oe)/864e5;break;case l:D=ce/s;break;case a:D=ce/r;break;case o:D=ce/n;break;default:D=ce}return M?D:m.a(D)},y.daysInMonth=function(){return this.endOf(h).$D},y.$locale=function(){return C[this.$L]},y.locale=function(w,T){if(!w)return this.$L;var M=this.clone(),D=H(w,T,!0);return D&&(M.$L=D),M},y.clone=function(){return m.w(this.$d,this)},y.toDate=function(){return new Date(this.valueOf())},y.toJSON=function(){return this.isValid()?this.toISOString():null},y.toISOString=function(){return this.$d.toISOString()},y.toString=function(){return this.$d.toUTCString()},N})(),O=x.prototype;return B.prototype=O,[["$ms",i],["$s",o],["$m",a],["$H",l],["$W",c],["$M",h],["$y",f],["$D",g]].forEach((function(N){O[N[1]]=function(y){return this.$g(y,N[0],N[1])}})),B.extend=function(N,y){return N.$i||(N(y,x,B),N.$i=!0),B},B.locale=H,B.isDayjs=A,B.unix=function(N){return B(1e3*N)},B.en=C[S],B.Ls=C,B.p={},B}))})(gs)),gs.exports}var kE=PE();const Xt=wt(kE);var _s={exports:{}},FE=_s.exports,ol;function HE(){return ol||(ol=1,(function(e,t){(function(n,r){e.exports=r()})(FE,(function(){return function(n,r){var s=r.prototype,i=s.format;s.format=function(o){var a=this,l=this.$locale();if(!this.isValid())return i.bind(this)(o);var c=this.$utils(),u=(o||"YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,(function(h){switch(h){case"Q":return Math.ceil((a.$M+1)/3);case"Do":return l.ordinal(a.$D);case"gggg":return a.weekYear();case"GGGG":return a.isoWeekYear();case"wo":return l.ordinal(a.week(),"W");case"w":case"ww":return c.s(a.week(),h==="w"?1:2,"0");case"W":case"WW":return c.s(a.isoWeek(),h==="W"?1:2,"0");case"k":case"kk":return c.s(String(a.$H===0?24:a.$H),h==="k"?1:2,"0");case"X":return Math.floor(a.$d.getTime()/1e3);case"x":return a.$d.getTime();case"z":return"["+a.offsetName()+"]";case"zzz":return"["+a.offsetName("long")+"]";default:return h}}));return i.bind(this)(u)}}}))})(_s)),_s.exports}var BE=HE();const $E=wt(BE);var ps={exports:{}},jE=ps.exports,al;function WE(){return al||(al=1,(function(e,t){(function(n,r){e.exports=r()})(jE,(function(){var n={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},r=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,s=/\d/,i=/\d\d/,o=/\d\d?/,a=/\d*[^-_:/,()\s\d]+/,l={},c=function(R){return(R=+R)+(R>68?1900:2e3)},u=function(R){return function(b){this[R]=+b}},h=[/[+-]\d\d:?(\d\d)?|Z/,function(R){(this.zone||(this.zone={})).offset=(function(b){if(!b||b==="Z")return 0;var F=b.match(/([+-]|\d\d)/g),k=60*F[1]+(+F[2]||0);return k===0?0:F[0]==="+"?-k:k})(R)}],d=function(R){var b=l[R];return b&&(b.indexOf?b:b.s.concat(b.f))},f=function(R,b){var F,k=l.meridiem;if(k){for(var W=1;W<=24;W+=1)if(R.indexOf(k(W,0,b))>-1){F=W>12;break}}else F=R===(b?"pm":"PM");return F},g={A:[a,function(R){this.afternoon=f(R,!1)}],a:[a,function(R){this.afternoon=f(R,!0)}],Q:[s,function(R){this.month=3*(R-1)+1}],S:[s,function(R){this.milliseconds=100*+R}],SS:[i,function(R){this.milliseconds=10*+R}],SSS:[/\d{3}/,function(R){this.milliseconds=+R}],s:[o,u("seconds")],ss:[o,u("seconds")],m:[o,u("minutes")],mm:[o,u("minutes")],H:[o,u("hours")],h:[o,u("hours")],HH:[o,u("hours")],hh:[o,u("hours")],D:[o,u("day")],DD:[i,u("day")],Do:[a,function(R){var b=l.ordinal,F=R.match(/\d+/);if(this.day=F[0],b)for(var k=1;k<=31;k+=1)b(k).replace(/\[|\]/g,"")===R&&(this.day=k)}],w:[o,u("week")],ww:[i,u("week")],M:[o,u("month")],MM:[i,u("month")],MMM:[a,function(R){var b=d("months"),F=(d("monthsShort")||b.map((function(k){return k.slice(0,3)}))).indexOf(R)+1;if(F<1)throw new Error;this.month=F%12||F}],MMMM:[a,function(R){var b=d("months").indexOf(R)+1;if(b<1)throw new Error;this.month=b%12||b}],Y:[/[+-]?\d+/,u("year")],YY:[i,function(R){this.year=c(R)}],YYYY:[/\d{4}/,u("year")],Z:h,ZZ:h};function _(R){var b,F;b=R,F=l&&l.formats;for(var k=(R=b.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(B,m,x){var O=x&&x.toUpperCase();return m||F[x]||n[x]||F[O].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(N,y,w){return y||w.slice(1)}))}))).match(r),W=k.length,S=0;S<W;S+=1){var C=k[S],v=g[C],A=v&&v[0],H=v&&v[1];k[S]=H?{regex:A,parser:H}:C.replace(/^\[|\]$/g,"")}return function(B){for(var m={},x=0,O=0;x<W;x+=1){var N=k[x];if(typeof N=="string")O+=N.length;else{var y=N.regex,w=N.parser,T=B.slice(O),M=y.exec(T)[0];w.call(m,M),B=B.replace(M,"")}}return(function(D){var P=D.afternoon;if(P!==void 0){var J=D.hours;P?J<12&&(D.hours+=12):J===12&&(D.hours=0),delete D.afternoon}})(m),m}}return function(R,b,F){F.p.customParseFormat=!0,R&&R.parseTwoDigitYear&&(c=R.parseTwoDigitYear);var k=b.prototype,W=k.parse;k.parse=function(S){var C=S.date,v=S.utc,A=S.args;this.$u=v;var H=A[1];if(typeof H=="string"){var B=A[2]===!0,m=A[3]===!0,x=B||m,O=A[2];m&&(O=A[2]),l=this.$locale(),!B&&O&&(l=F.Ls[O]),this.$d=(function(T,M,D,P){try{if(["x","X"].indexOf(M)>-1)return new Date((M==="X"?1e3:1)*T);var J=_(M)(T),z=J.year,oe=J.month,ce=J.day,I=J.hours,L=J.minutes,Y=J.seconds,V=J.milliseconds,$=J.zone,j=J.week,Q=new Date,ee=ce||(z||oe?1:Q.getDate()),U=z||Q.getFullYear(),G=0;z&&!oe||(G=oe>0?oe-1:Q.getMonth());var X,ne=I||0,me=L||0,pe=Y||0,K=V||0;return $?new Date(Date.UTC(U,G,ee,ne,me,pe,K+60*$.offset*1e3)):D?new Date(Date.UTC(U,G,ee,ne,me,pe,K)):(X=new Date(U,G,ee,ne,me,pe,K),j&&(X=P(X).week(j).toDate()),X)}catch{return new Date("")}})(C,H,v,F),this.init(),O&&O!==!0&&(this.$L=this.locale(O).$L),x&&C!=this.format(H)&&(this.$d=new Date("")),l={}}else if(H instanceof Array)for(var N=H.length,y=1;y<=N;y+=1){A[1]=H[y-1];var w=F.apply(this,A);if(w.isValid()){this.$d=w.$d,this.$L=w.$L,this.init();break}y===N&&(this.$d=new Date(""))}else W.call(this,S)}}}))})(ps)),ps.exports}var YE=WE();const VE=wt(YE);var Es={exports:{}},zE=Es.exports,ll;function GE(){return ll||(ll=1,(function(e,t){(function(n,r){e.exports=r()})(zE,(function(){return function(n,r,s){var i=r.prototype,o=function(h){return h&&(h.indexOf?h:h.s)},a=function(h,d,f,g,_){var R=h.name?h:h.$locale(),b=o(R[d]),F=o(R[f]),k=b||F.map((function(S){return S.slice(0,g)}));if(!_)return k;var W=R.weekStart;return k.map((function(S,C){return k[(C+(W||0))%7]}))},l=function(){return s.Ls[s.locale()]},c=function(h,d){return h.formats[d]||(function(f){return f.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(g,_,R){return _||R.slice(1)}))})(h.formats[d.toUpperCase()])},u=function(){var h=this;return{months:function(d){return d?d.format("MMMM"):a(h,"months")},monthsShort:function(d){return d?d.format("MMM"):a(h,"monthsShort","months",3)},firstDayOfWeek:function(){return h.$locale().weekStart||0},weekdays:function(d){return d?d.format("dddd"):a(h,"weekdays")},weekdaysMin:function(d){return d?d.format("dd"):a(h,"weekdaysMin","weekdays",2)},weekdaysShort:function(d){return d?d.format("ddd"):a(h,"weekdaysShort","weekdays",3)},longDateFormat:function(d){return c(h.$locale(),d)},meridiem:this.$locale().meridiem,ordinal:this.$locale().ordinal}};i.localeData=function(){return u.bind(this)()},s.localeData=function(){var h=l();return{firstDayOfWeek:function(){return h.weekStart||0},weekdays:function(){return s.weekdays()},weekdaysShort:function(){return s.weekdaysShort()},weekdaysMin:function(){return s.weekdaysMin()},months:function(){return s.months()},monthsShort:function(){return s.monthsShort()},longDateFormat:function(d){return c(h,d)},meridiem:h.meridiem,ordinal:h.ordinal}},s.months=function(){return a(l(),"months")},s.monthsShort=function(){return a(l(),"monthsShort","months",3)},s.weekdays=function(h){return a(l(),"weekdays",null,null,h)},s.weekdaysShort=function(h){return a(l(),"weekdaysShort","weekdays",3,h)},s.weekdaysMin=function(h){return a(l(),"weekdaysMin","weekdays",2,h)}}}))})(Es)),Es.exports}var KE=GE();const XE=wt(KE);var Cs={exports:{}},qE=Cs.exports,cl;function JE(){return cl||(cl=1,(function(e,t){(function(n,r){e.exports=r()})(qE,(function(){var n={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};return function(r,s,i){var o=s.prototype,a=o.format;i.en.formats=n,o.format=function(l){l===void 0&&(l="YYYY-MM-DDTHH:mm:ssZ");var c=this.$locale().formats,u=(function(h,d){return h.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(f,g,_){var R=_&&_.toUpperCase();return g||d[_]||n[_]||d[R].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(b,F,k){return F||k.slice(1)}))}))})(l,c===void 0?{}:c);return a.call(this,u)}}}))})(Cs)),Cs.exports}var ZE=JE();const QE=wt(ZE);var Rs={exports:{}},e0=Rs.exports,ul;function t0(){return ul||(ul=1,(function(e,t){(function(n,r){e.exports=r()})(e0,(function(){var n="minute",r=/[+-]\d\d(?::?\d\d)?/g,s=/([+-]|\d\d)/g;return function(i,o,a){var l=o.prototype;a.utc=function(_){var R={date:_,utc:!0,args:arguments};return new o(R)},l.utc=function(_){var R=a(this.toDate(),{locale:this.$L,utc:!0});return _?R.add(this.utcOffset(),n):R},l.local=function(){return a(this.toDate(),{locale:this.$L,utc:!1})};var c=l.parse;l.parse=function(_){_.utc&&(this.$u=!0),this.$utils().u(_.$offset)||(this.$offset=_.$offset),c.call(this,_)};var u=l.init;l.init=function(){if(this.$u){var _=this.$d;this.$y=_.getUTCFullYear(),this.$M=_.getUTCMonth(),this.$D=_.getUTCDate(),this.$W=_.getUTCDay(),this.$H=_.getUTCHours(),this.$m=_.getUTCMinutes(),this.$s=_.getUTCSeconds(),this.$ms=_.getUTCMilliseconds()}else u.call(this)};var h=l.utcOffset;l.utcOffset=function(_,R){var b=this.$utils().u;if(b(_))return this.$u?0:b(this.$offset)?h.call(this):this.$offset;if(typeof _=="string"&&(_=(function(S){S===void 0&&(S="");var C=S.match(r);if(!C)return null;var v=(""+C[0]).match(s)||["-",0,0],A=v[0],H=60*+v[1]+ +v[2];return H===0?0:A==="+"?H:-H})(_),_===null))return this;var F=Math.abs(_)<=16?60*_:_;if(F===0)return this.utc(R);var k=this.clone();if(R)return k.$offset=F,k.$u=!1,k;var W=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(k=this.local().add(F+W,n)).$offset=F,k.$x.$localOffset=W,k};var d=l.format;l.format=function(_){var R=_||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return d.call(this,R)},l.valueOf=function(){var _=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*_},l.isUTC=function(){return!!this.$u},l.toISOString=function(){return this.toDate().toISOString()},l.toString=function(){return this.toDate().toUTCString()};var f=l.toDate;l.toDate=function(_){return _==="s"&&this.$offset?a(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():f.call(this)};var g=l.diff;l.diff=function(_,R,b){if(_&&this.$u===_.$u)return g.call(this,_,R,b);var F=this.local(),k=a(_).local();return g.call(F,k,R,b)}}}))})(Rs)),Rs.exports}var n0=t0();const r0=wt(n0);var Is={exports:{}},s0=Is.exports,hl;function i0(){return hl||(hl=1,(function(e,t){(function(n,r){e.exports=r()})(s0,(function(){return function(n,r){r.prototype.weekday=function(s){var i=this.$locale().weekStart||0,o=this.$W,a=(o<i?o+7:o)-i;return this.$utils().u(s)?a:this.subtract(a,"day").add(s,"day")}}}))})(Is)),Is.exports}var o0=i0();const a0=wt(o0);var Ss={exports:{}},l0=Ss.exports,dl;function c0(){return dl||(dl=1,(function(e,t){(function(n,r){e.exports=r()})(l0,(function(){var n="week",r="year";return function(s,i,o){var a=i.prototype;a.week=function(l){if(l===void 0&&(l=null),l!==null)return this.add(7*(l-this.week()),"day");var c=this.$locale().yearStart||1;if(this.month()===11&&this.date()>25){var u=o(this).startOf(r).add(1,r).date(c),h=o(this).endOf(n);if(u.isBefore(h))return 1}var d=o(this).startOf(r).date(c).startOf(n).subtract(1,"millisecond"),f=this.diff(d,n,!0);return f<0?o(this).startOf("week").week():Math.ceil(f)},a.weeks=function(l){return l===void 0&&(l=null),this.week(l)}}}))})(Ss)),Ss.exports}var u0=c0();const h0=wt(u0);var Os={exports:{}},d0=Os.exports,fl;function f0(){return fl||(fl=1,(function(e,t){(function(n,r){e.exports=r()})(d0,(function(){return function(n,r){r.prototype.weekYear=function(){var s=this.month(),i=this.week(),o=this.year();return i===1&&s===11?o+1:s===0&&i>=52?o-1:o}}}))})(Os)),Os.exports}var m0=f0();const g0=wt(m0);Xt.extend(VE);Xt.extend($E);Xt.extend(a0);Xt.extend(XE);Xt.extend(h0);Xt.extend(g0);Xt.extend(r0);Xt.extend(QE);function ti(e,t,n,r){if(e>t)throw new Error("a1 should be less than a2");if(n>r)throw new Error("b1 should be less than b2");if(t<n||r<e)return[e,t];if(n<=e&&r>=t)return[];const s=r-n+1;return e<n&&t>r?[e,t-s]:n<=e&&r<t?[r+1-s,t-s]:n>e&&r>=t?[e,n-1]:[e,t]}function _0(e){if(e==null)return!1;const t=e.bullet;return(t==null?void 0:t.listId)!=null}function p0(e){if(e==null)return!1;const t=e.paragraphStyle;return sh(t)}function sh(e){var t;return!(e==null||(e.indentStart==null||e.indentStart.v===0)&&e.hanging==null||((t=e.hanging)==null?void 0:t.v)===0)}function ih(e,t,n){return e.slice(0,t)+n+e.slice(t)}function oh(e,t,n){return t>n?e:e.slice(0,t)+e.slice(n)}function E0(e){if(e==null||typeof e=="boolean")return!1;if(typeof e=="number")return!isNaN(e);if(typeof e=="string"){const t=e.trim();return t===""?!1:!isNaN(Number(t))}return!1}function C0(e){let t=0;for(let n=0;n<e.length;n++)t=e.charCodeAt(n)+(t<<6)+(t<<16)-t;return t>>>0}function R0(...e){let t;return e.length===1&&Array.isArray(e[0])?t=e[0]:t=e,Vs({},...t)}const Le=Symbol("newer"),Qe=Symbol("older");class I0{constructor(t){p(this,"entry");this.entry=t}[Symbol.iterator](){return this}next(){const t=this.entry;return t?(this.entry=t[Le],{done:!1,value:t.key}):{done:!0,value:void 0}}}class S0{constructor(t){p(this,"entry");this.entry=t}[Symbol.iterator](){return this}next(){const t=this.entry;return t?(this.entry=t[Le],{done:!1,value:t.value}):{done:!0,value:void 0}}}class O0{constructor(t){p(this,"entry");this.entry=t}[Symbol.iterator](){return this}next(){const t=this.entry;return t?(this.entry=t[Le],{done:!1,value:[t.key,t.value]}):{done:!0,value:void 0}}}var Ll,xl;xl=Le,Ll=Qe;class ml{constructor(t,n){p(this,"key");p(this,"value");p(this,xl);p(this,Ll);this.key=t,this.value=n,this[Le]=void 0,this[Qe]=void 0}toJSON(){return{key:this.key,value:this.value}}}class Lr{constructor(...t){p(this,"_keymap");p(this,"size",0);p(this,"limit");p(this,"oldest");p(this,"newest");p(this,"_onShiftListeners",[]);if(Er.hasLength(t,1)){if(Er.isNumber(t[0])){const n=t[0];this._initialize(n,void 0);return}if(Er.isIterable(t[0])){const n=t[0];this._initialize(0,n);return}return}if(Er.hasLength(t,2)){const n=t[0],r=t[1];this._initialize(n,r)}}onShift(t){if(this._onShiftListeners.indexOf(t)===-1)return this._onShiftListeners.push(t),Ye(()=>kr(this._onShiftListeners,t));throw new Error("[LRUMap]: the listener has been registered!")}_initialize(t,n){this.oldest=void 0,this.newest=void 0,this.size=0,this.limit=t,this._keymap=new Map,n&&(this.assign(n),t<1&&(this.limit=this.size))}_markEntryAsUsed(t){t!==this.newest&&(t[Le]&&(t===this.oldest&&(this.oldest=t[Le]),t[Le][Qe]=t[Qe]),t[Qe]&&(t[Qe][Le]=t[Le]),t[Le]=void 0,t[Qe]=this.newest,this.newest&&(this.newest[Le]=t),this.newest=t)}assign(t){let n,r=this.limit||Number.MAX_VALUE;this._keymap.clear();const s=t[Symbol.iterator]();for(let i=s.next();!i.done;i=s.next()){const o=new ml(i.value[0],i.value[1]);if(this._keymap.set(o.key,o),n?(n[Le]=o,o[Qe]=n):this.oldest=o,n=o,r--===0)throw new Error("overflow")}this.newest=n,this.size=this._keymap.size}set(t,n){let r=this._keymap.get(t);return r?(r.value=n,this._markEntryAsUsed(r),this):(this._keymap.set(t,r=new ml(t,n)),this.newest?(this.newest[Le]=r,r[Qe]=this.newest):this.oldest=r,this.newest=r,++this.size,this.size>this.limit&&this.shift(),this)}shift(){const t=this.oldest;if(t)return this.oldest&&this.oldest[Le]?(this.oldest=this.oldest[Le],this.oldest[Qe]=void 0):(this.oldest=void 0,this.newest=void 0),t[Le]=t[Qe]=void 0,this._keymap.delete(t.key),--this.size,this._onShiftListeners.forEach(n=>n(t)),[t.key,t.value]}get(t){const n=this._keymap.get(t);if(n)return this._markEntryAsUsed(n),n.value}has(t){return this._keymap.has(t)}find(t){const n=this._keymap.get(t);return n?n.value:void 0}delete(t){const n=this._keymap.get(t);if(n)return this._keymap.delete(n.key),n[Le]&&n[Qe]?(n[Qe][Le]=n[Le],n[Le][Qe]=n[Qe]):n[Le]?(n[Le][Qe]=void 0,this.oldest=n[Le]):n[Qe]?(n[Qe][Le]=void 0,this.newest=n[Qe]):this.oldest=this.newest=void 0,this.size--,n.value}clear(){this.oldest=void 0,this.newest=void 0,this.size=0,this._keymap.clear()}keys(){return new I0(this.oldest)}values(){return new S0(this.oldest)}entries(){return this[Symbol.iterator]()}[Symbol.iterator](){return new O0(this.oldest)}forEach(t,n){typeof n!="object"&&(n=this);let r=this.oldest;for(;r;)t.call(n,r.value,r.key,this),r=r[Le]}toJSON(){const t=new Array(this.size);let n=0,r=this.oldest;for(;r;)t[n++]={key:r.key,value:r.value},r=r[Le];return t}toString(){let t="",n=this.oldest;for(;n;)t+=`${String(n.key)}:${n.value}`,n=n[Le],n&&(t+=" < ");return t}}class Er{static hasLength(t,n){return t.length===n}static getValueType(t){return Object.prototype.toString.apply(t)}static isObject(t){return this.getValueType(t)==="[object Object]"}static isIterable(t){return t[Symbol.iterator]!=null}static isNumber(t){return this.getValueType(t)==="[object Number]"}}const w0={sheetId:"",range:{startRow:-1,endRow:-1,startColumn:-1,endColumn:-1}},v0={startRow:-1,startColumn:-1,endRow:-1,endColumn:-1},b0={startRow:0,startColumn:0,endRow:0,endColumn:0},y0={row:0,column:0},it={ff:"Arial",fs:11,it:ie.FALSE,bl:ie.FALSE,ul:{s:ie.FALSE},st:{s:ie.FALSE},ol:{s:ie.FALSE},tr:{a:0,v:ie.FALSE},td:Nr.UNSPECIFIED,cl:{rgb:"#000000"},bg:{rgb:"#fff"},ht:Nt.UNSPECIFIED,vt:pn.UNSPECIFIED,tb:Sn.UNSPECIFIED,pd:{t:0,r:0,b:0,l:0},n:null,bd:{b:null,l:null,r:null,t:null}},ah={id:"default_slide",title:"defaultSlide",pageSize:{width:300,height:300}},A0=[fo,Ul,mo],T0={[qe.HEADING_1]:{fs:20,bl:1},[qe.HEADING_2]:{fs:18,bl:1},[qe.HEADING_3]:{fs:16,bl:1},[qe.HEADING_4]:{fs:14,bl:1},[qe.HEADING_5]:{fs:12,bl:1},[qe.NORMAL_TEXT]:null,[qe.TITLE]:{fs:26,bl:1},[qe.SUBTITLE]:{fs:15,cl:{rgb:"#999999"}},[qe.NAMED_STYLE_TYPE_UNSPECIFIED]:null},An=4,N0={[qe.HEADING_1]:{spaceAbove:{v:20},spaceBelow:{v:6+An}},[qe.HEADING_2]:{spaceAbove:{v:18},spaceBelow:{v:6+An}},[qe.HEADING_3]:{spaceAbove:{v:16},spaceBelow:{v:6+An}},[qe.HEADING_4]:{spaceAbove:{v:14},spaceBelow:{v:4+An}},[qe.HEADING_5]:{spaceAbove:{v:12},spaceBelow:{v:4+An}},[qe.NORMAL_TEXT]:{spaceAbove:{v:0},spaceBelow:{v:0}},[qe.TITLE]:{spaceAbove:{v:0},spaceBelow:{v:3+An}},[qe.SUBTITLE]:{spaceAbove:{v:0},spaceBelow:{v:16}},[qe.NAMED_STYLE_TYPE_UNSPECIFIED]:null},M0="univer-sheets-chart-print-chart",D0="univer-docs-drawing-printing";var lh=(e=>(e.ARRAY_CONVERTOR="ARRAY_CONVERTOR",e.MATRIX_CONVERTOR="MATRIX_CONVERTOR",e))(lh||{});const L0={[ht.A3]:{width:1123,height:1587},[ht.A4]:{width:794,height:1124},[ht.A5]:{width:559,height:794},[ht.B4]:{width:944,height:1344},[ht.B5]:{width:665,height:944},[ht.Executive]:{width:696,height:1008},[ht.Folio]:{width:816,height:1248},[ht.Legal]:{width:816,height:1344},[ht.Letter]:{width:816,height:1056},[ht.Statement]:{width:528,height:816},[ht.Tabloid]:{width:1056,height:1632}};function ss(e,t){const{textRuns:n=[]}=t;let r=0;for(const i of n){const{ts:o={},st:a,ed:l}=i;if(o[e]==null)return ie.FALSE;switch(e){case"bl":case"it":{if(o[e]===ie.FALSE)return ie.FALSE;break}case"ul":case"st":{if(o[e].s===ie.FALSE)return ie.FALSE;break}default:throw new Error(`unknown style key: ${e} in IStyleBase`)}r+=l-a}return t.dataStream.indexOf(`\r
|
|
4
|
+
`)===r?ie.TRUE:ie.FALSE}const Ar=class Ar{constructor(t,n,r){p(this,"_range");p(this,"_worksheet");this._deps=r,this._range=n,this._worksheet=t}static foreach(t,n){const{startRow:r,startColumn:s,endRow:i,endColumn:o}=t;for(let a=r;a<=i;a++)for(let l=s;l<=o;l++)n(a,l)}getRangeData(){return this._range}getValue(){return this.getValues()[0][0]}getValues(){const{startRow:t,endRow:n,startColumn:r,endColumn:s}=this._range,i=[];for(let o=t;o<=n;o++){const a=[];for(let l=r;l<=s;l++)a.push(this.getMatrix().getValue(o,l)||null);i.push(a)}return i}getMatrix(){const{startRow:t,endRow:n,startColumn:r,endColumn:s}=this._range,i=this._worksheet.getCellMatrix(),o=new ct;for(let a=t;a<=n;a++)for(let l=r;l<=s;l++)o.setValue(a,l,i.getValue(a,l)||null);return o}getMatrixObject(){const{startRow:t,endRow:n,startColumn:r,endColumn:s}=this._range,i=this._worksheet.getCellMatrix(),o=new ct;for(let a=t;a<=n;a++)for(let l=r;l<=s;l++)o.setValue(a-t,l-r,i.getValue(a,l)||{});return o}getA1Notation(){const{startRow:t,endRow:n,startColumn:r,endColumn:s}=this._range;let i,o;return r<s?(i=Z.numToWord(r+1)+(t+1),o=Z.numToWord(s+1)+(n+1)):(i=Z.numToWord(s+1)+(n+1),o=Z.numToWord(r+1)+(t+1)),i===o?`${i}`:`${i}:${o}`}getBackground(){return this.getBackgrounds()[0][0]}getBackgrounds(){const t=this._deps.getStyles();return this.getValues().map(n=>n.map(r=>{var i;const s=t.getStyleByCell(r);return((i=s==null?void 0:s.bg)==null?void 0:i.rgb)||it.bg.rgb}))}getCell(t,n){const{startRow:r,startColumn:s}=this._range,i={startRow:r+t,endRow:r+t,startColumn:s+n,endColumn:s+n};return new Ar(this._worksheet,i,this._deps)}getColumn(){return this._range.startColumn}getObjectValue(t={}){return this.getObjectValues(t)[0][0]}getObjectValues(t={}){var a;const{startRow:n,endRow:r,startColumn:s,endColumn:i}=this._range,o=this._worksheet.getCellMatrix().getFragment(n,r,s,i).getData();if(t.isIncludeStyle){const l=this._deps.getStyles();for(let c=0;c<=r-n;c++)for(let u=0;u<=i-s;u++){if(o==null||((a=o==null?void 0:o[c])==null?void 0:a[u])==null)continue;const h=o[c][u].s;h&&(o[c][u].s=l.get(h))}}return o}getFontColor(){return this.getFontColors()[0][0]}getFontColors(){const t=this._deps.getStyles();return this.getValues().map(n=>n.map(r=>{var i;const s=t.getStyleByCell(r);return((i=s==null?void 0:s.cl)==null?void 0:i.rgb)||it.cl.rgb}))}getFontFamilies(){return this._getStyles("ff")}getFontFamily(){return this.getFontFamilies()[0][0]}getUnderlines(){return this._getStyles("ul")}getUnderline(){var n,r;const{p:t}=(n=this.getValue())!=null?n:{};return t&&Array.isArray((r=t.body)==null?void 0:r.textRuns)&&t.body.textRuns.length>0?ss("ul",t.body)===ie.TRUE?{s:ie.TRUE}:{s:ie.FALSE}:this.getUnderlines()[0][0]}getOverlines(){return this._getStyles("ol")}getOverline(){return this.getOverlines()[0][0]}getStrikeThrough(){var n,r;const{p:t}=(n=this.getValue())!=null?n:{};return t&&Array.isArray((r=t.body)==null?void 0:r.textRuns)&&t.body.textRuns.length>0?ss("st",t.body)===ie.TRUE?{s:ie.TRUE}:{s:ie.FALSE}:this.getStrikeThroughs()[0][0]}getStrikeThroughs(){return this._getStyles("st")}getFontSize(){var n,r;const t=((n=this.getValue())==null?void 0:n.p)||{};return t&&Array.isArray((r=t.body)==null?void 0:r.textRuns)&&t.body.textRuns.length>0?t.body.textRuns.some(s=>{var i;return((i=s==null?void 0:s.ts)==null?void 0:i.fs)!=null})?Math.max(...t.body.textRuns.map(s=>{var i;return((i=s==null?void 0:s.ts)==null?void 0:i.fs)||0})):this.getFontSizes()[0][0]:this.getFontSizes()[0][0]}getFontSizes(){return this._getStyles("fs")}getBorder(){return this.getBorders()[0][0]}getBorders(){return this._getStyles("bd")}getFontStyle(){var n,r;const{p:t}=(n=this.getValue())!=null?n:{};return t&&Array.isArray((r=t.body)==null?void 0:r.textRuns)&&t.body.textRuns.length>0?ss("it",t.body)===ie.TRUE?As.ITALIC:As.NORMAL:this._getFontStyles()[0][0]}_getFontStyles(){return this._getStyles("it")}getFontWeight(){var n,r;const{p:t}=(n=this.getValue())!=null?n:{};return t&&Array.isArray((r=t.body)==null?void 0:r.textRuns)&&t.body.textRuns.length>0?ss("bl",t.body)===ie.TRUE?Ts.BOLD:Ts.NORMAL:this._getFontWeights()[0][0]}_getFontWeights(){return this._getStyles("bl")}getGridId(){return this._worksheet.getSheetId()}getHeight(){const{_range:t,_worksheet:n}=this,{startRow:r,endRow:s}=t;let i=0;for(let o=0;o<=s-r;o++){const a=n.getRowHeight(o);i+=a}return i}getHorizontalAlignment(){return this.getHorizontalAlignments()[0][0]}getHorizontalAlignments(){return this._getStyles("ht")}getLastColumn(){return this._range.endColumn}getLastRow(){return this._range.endRow}getNumColumns(){const{startColumn:t,endColumn:n}=this._range;return n-t+1}getNumRows(){const{startRow:t,endRow:n}=this._range;return n-t+1}getRichTextValue(){return this.getRichTextValues()[0][0]}getRichTextValues(){return this.getValues().map(t=>t.map(n=>(n==null?void 0:n.p)||""))}getRowIndex(){return this._range.startRow}getSheet(){return this._worksheet}getTextDirection(){return this.getTextDirections()[0][0]}getTextDirections(){return this._getStyles("td")}getTextRotation(){return this.getTextRotations()[0][0]}getTextRotations(){return this._getStyles("tr")}getTextStyle(){return this.getTextStyles()[0][0]}getTextStyles(){const t=this._deps.getStyles();return this.getValues().map(n=>n.map(r=>t.getStyleByCell(r)))}getVerticalAlignment(){return this.getVerticalAlignments()[0][0]}getVerticalAlignments(){return this._getStyles("vt")}getWidth(){const{_range:t,_worksheet:n}=this,{startColumn:r,endColumn:s}=t;let i=0;for(let o=0;o<=s-r;o++)i+=n.getColumnWidth(o);return i}getWrap(){return this.getWrapStrategy()===Sn.WRAP?ie.TRUE:ie.FALSE}getWrapStrategies(){return this._getStyles("tb")}getWrapStrategy(){return this.getWrapStrategies()[0][0]}forEach(t){Ar.foreach(this._range,t)}_getStyles(t){const n=this._deps.getStyles();return this.getValues().map(r=>r.map(s=>{const i=n&&n.getStyleByCell(s);return i&&i[t]||it[t]}))}};p(Ar,"transformRange",(t,n)=>{const r=n.getMaxColumns()-1,s=n.getMaxRows()-1;return t.rangeType===_e.ALL?{startColumn:0,startRow:0,endColumn:r,endRow:s}:t.rangeType===_e.COLUMN?{startRow:0,endRow:s,startColumn:t.startColumn,endColumn:t.endColumn}:t.rangeType===_e.ROW?{startColumn:0,endColumn:r,startRow:t.startRow,endRow:t.endRow}:{startColumn:t.startColumn,endColumn:Math.min(t.endColumn,r),startRow:t.startRow,endRow:Math.min(t.endRow,s)}});let Xn=Ar;function ch(e,t,n=0,r=e.length-1,s=x0){for(;r>n;){if(r-n>600){const l=r-n+1,c=t-n+1,u=Math.log(l),h=.5*Math.exp(2*u/3),d=.5*Math.sqrt(u*h*(l-h)/l)*(c-l/2<0?-1:1),f=Math.max(n,Math.floor(t-c*h/l+d)),g=Math.min(r,Math.floor(t+(l-c)*h/l+d));ch(e,t,f,g,s)}const i=e[t];let o=n,a=r;for(or(e,n,t),s(e[r],i)>0&&or(e,n,r);o<a;){for(or(e,o,a),o++,a--;s(e[o],i)<0;)o++;for(;s(e[a],i)>0;)a--}s(e[n],i)===0?or(e,n,a):(a++,or(e,a,r)),a<=t&&(n=a+1),t<=a&&(r=a-1)}}function or(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function x0(e,t){return e<t?-1:e>t?1:0}class Us{constructor(t=9){this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(t){let n=this.data;const r=[];if(!os(t,n))return r;const s=this.toBBox,i=[];for(;n;){for(let o=0;o<n.children.length;o++){const a=n.children[o],l=n.leaf?s(a):a;os(t,l)&&(n.leaf?r.push(a):yi(t,l)?this._all(a,r):i.push(a))}n=i.pop()}return r}collides(t){let n=this.data;if(!os(t,n))return!1;const r=[];for(;n;){for(let s=0;s<n.children.length;s++){const i=n.children[s],o=n.leaf?this.toBBox(i):i;if(os(t,o)){if(n.leaf||yi(t,o))return!0;r.push(i)}}n=r.pop()}return!1}load(t){if(!(t&&t.length))return this;if(t.length<this._minEntries){for(let r=0;r<t.length;r++)this.insert(t[r]);return this}let n=this._build(t.slice(),0,t.length-1,0);if(!this.data.children.length)this.data=n;else if(this.data.height===n.height)this._splitRoot(this.data,n);else{if(this.data.height<n.height){const r=this.data;this.data=n,n=r}this._insert(n,this.data.height-n.height-1,!0)}return this}insert(t){return t&&this._insert(t,this.data.height-1),this}clear(){return this.data=xn([]),this}remove(t,n){if(!t)return this;let r=this.data;const s=this.toBBox(t),i=[],o=[];let a,l,c;for(;r||i.length;){if(r||(r=i.pop(),l=i[i.length-1],a=o.pop(),c=!0),r.leaf){const u=U0(t,r.children,n);if(u!==-1)return r.children.splice(u,1),i.push(r),this._condense(i),this}!c&&!r.leaf&&yi(r,s)?(i.push(r),o.push(a),a=0,l=r,r=r.children[0]):l?(a++,r=l.children[a],c=!1):r=null}return this}toBBox(t){return t}compareMinX(t,n){return t.minX-n.minX}compareMinY(t,n){return t.minY-n.minY}toJSON(){return this.data}fromJSON(t){return this.data=t,this}_all(t,n){const r=[];for(;t;)t.leaf?n.push(...t.children):r.push(...t.children),t=r.pop();return n}_build(t,n,r,s){const i=r-n+1;let o=this._maxEntries,a;if(i<=o)return a=xn(t.slice(n,r+1)),Tn(a,this.toBBox),a;s||(s=Math.ceil(Math.log(i)/Math.log(o)),o=Math.ceil(i/Math.pow(o,s-1))),a=xn([]),a.leaf=!1,a.height=s;const l=Math.ceil(i/o),c=l*Math.ceil(Math.sqrt(o));gl(t,n,r,c,this.compareMinX);for(let u=n;u<=r;u+=c){const h=Math.min(u+c-1,r);gl(t,u,h,l,this.compareMinY);for(let d=u;d<=h;d+=l){const f=Math.min(d+l-1,h);a.children.push(this._build(t,d,f,s-1))}}return Tn(a,this.toBBox),a}_chooseSubtree(t,n,r,s){for(;s.push(n),!(n.leaf||s.length-1===r);){let i=1/0,o=1/0,a;for(let l=0;l<n.children.length;l++){const c=n.children[l],u=bi(c),h=F0(t,c)-u;h<o?(o=h,i=u<i?u:i,a=c):h===o&&u<i&&(i=u,a=c)}n=a||n.children[0]}return n}_insert(t,n,r){const s=r?t:this.toBBox(t),i=[],o=this._chooseSubtree(s,this.data,n,i);for(o.children.push(t),Rr(o,s);n>=0&&i[n].children.length>this._maxEntries;)this._split(i,n),n--;this._adjustParentBBoxes(s,i,n)}_split(t,n){const r=t[n],s=r.children.length,i=this._minEntries;this._chooseSplitAxis(r,i,s);const o=this._chooseSplitIndex(r,i,s),a=xn(r.children.splice(o,r.children.length-o));a.height=r.height,a.leaf=r.leaf,Tn(r,this.toBBox),Tn(a,this.toBBox),n?t[n-1].children.push(a):this._splitRoot(r,a)}_splitRoot(t,n){this.data=xn([t,n]),this.data.height=t.height+1,this.data.leaf=!1,Tn(this.data,this.toBBox)}_chooseSplitIndex(t,n,r){let s,i=1/0,o=1/0;for(let a=n;a<=r-n;a++){const l=Cr(t,0,a,this.toBBox),c=Cr(t,a,r,this.toBBox),u=H0(l,c),h=bi(l)+bi(c);u<i?(i=u,s=a,o=h<o?h:o):u===i&&h<o&&(o=h,s=a)}return s||r-n}_chooseSplitAxis(t,n,r){const s=t.leaf?this.compareMinX:P0,i=t.leaf?this.compareMinY:k0,o=this._allDistMargin(t,n,r,s),a=this._allDistMargin(t,n,r,i);o<a&&t.children.sort(s)}_allDistMargin(t,n,r,s){t.children.sort(s);const i=this.toBBox,o=Cr(t,0,n,i),a=Cr(t,r-n,r,i);let l=is(o)+is(a);for(let c=n;c<r-n;c++){const u=t.children[c];Rr(o,t.leaf?i(u):u),l+=is(o)}for(let c=r-n-1;c>=n;c--){const u=t.children[c];Rr(a,t.leaf?i(u):u),l+=is(a)}return l}_adjustParentBBoxes(t,n,r){for(let s=r;s>=0;s--)Rr(n[s],t)}_condense(t){for(let n=t.length-1,r;n>=0;n--)t[n].children.length===0?n>0?(r=t[n-1].children,r.splice(r.indexOf(t[n]),1)):this.clear():Tn(t[n],this.toBBox)}}function U0(e,t,n){if(!n)return t.indexOf(e);for(let r=0;r<t.length;r++)if(n(e,t[r]))return r;return-1}function Tn(e,t){Cr(e,0,e.children.length,t,e)}function Cr(e,t,n,r,s){s||(s=xn(null)),s.minX=1/0,s.minY=1/0,s.maxX=-1/0,s.maxY=-1/0;for(let i=t;i<n;i++){const o=e.children[i];Rr(s,e.leaf?r(o):o)}return s}function Rr(e,t){return e.minX=Math.min(e.minX,t.minX),e.minY=Math.min(e.minY,t.minY),e.maxX=Math.max(e.maxX,t.maxX),e.maxY=Math.max(e.maxY,t.maxY),e}function P0(e,t){return e.minX-t.minX}function k0(e,t){return e.minY-t.minY}function bi(e){return(e.maxX-e.minX)*(e.maxY-e.minY)}function is(e){return e.maxX-e.minX+(e.maxY-e.minY)}function F0(e,t){return(Math.max(t.maxX,e.maxX)-Math.min(t.minX,e.minX))*(Math.max(t.maxY,e.maxY)-Math.min(t.minY,e.minY))}function H0(e,t){const n=Math.max(e.minX,t.minX),r=Math.max(e.minY,t.minY),s=Math.min(e.maxX,t.maxX),i=Math.min(e.maxY,t.maxY);return Math.max(0,s-n)*Math.max(0,i-r)}function yi(e,t){return e.minX<=t.minX&&e.minY<=t.minY&&t.maxX<=e.maxX&&t.maxY<=e.maxY}function os(e,t){return t.minX<=e.maxX&&t.minY<=e.maxY&&t.maxX>=e.minX&&t.maxY>=e.minY}function xn(e){return{children:e,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function gl(e,t,n,r,s){const i=[t,n];for(;i.length;){if(n=i.pop(),t=i.pop(),n-t<=r)continue;const o=t+Math.ceil((n-t)/r/2)*r;ch(e,o,t,n,s),i.push(t,o,o,n)}}function B0(e,t,n,r=!1){if(t===0&&n===0)return e;let s={...e};const i=s.startAbsoluteRefType||Me.NONE,o=s.endAbsoluteRefType||Me.NONE,a=s.rangeType||_e.NORMAL;if(!r&&i===Me.ALL&&o===Me.ALL)return s;const l=_l(s.startRow,n,s.startColumn,t,a),c=_l(s.endRow,n,s.endColumn,t,a);return r||i===Me.NONE&&o===Me.NONE?s={...s,startRow:l.row,startColumn:l.column,endRow:c.row,endColumn:c.column}:(i===Me.NONE?s={...s,startRow:l.row,startColumn:l.column}:i===Me.COLUMN?s={...s,startRow:l.row}:i===Me.ROW&&(s={...s,startColumn:l.column}),o===Me.NONE?s={...s,endRow:c.row,endColumn:c.column}:o===Me.COLUMN?s={...s,endRow:c.row}:o===Me.ROW&&(s={...s,endColumn:c.column}),s)}function _l(e,t,n,r,s){return s===_e.NORMAL?{row:e+t,column:n+r}:s===_e.ROW?{row:e+t,column:n}:s===_e.COLUMN?{row:e,column:n+r}:{row:e,column:n}}function ca(e){const t=new Set,n=new Set;for(const o of e)t.add(o.startColumn),t.add(o.endColumn+1),n.add(o.startRow),n.add(o.endRow+1);const r=Array.from(t).sort((o,a)=>o-a),s=Array.from(n).sort((o,a)=>o-a);e.sort((o,a)=>o.startRow-a.startRow||o.startColumn-a.startColumn);const i=[];for(let o=0;o<s.length-1;o++)for(let a=0;a<r.length-1;a++){const l=r[a],c=r[a+1]-1,u=s[o],h=s[o+1]-1;for(const d of e){if(d.startRow>h)break;if(d.startRow<=u&&d.endRow>=h&&d.startColumn<=l&&d.endColumn>=c){i.push({startColumn:l,endColumn:c,startRow:u,endRow:h});break}}}return i}function $0(e){e.sort((r,s)=>r.startRow-s.startRow||r.startColumn-s.startColumn);const t={};for(const r of e)t[r.startRow]||(t[r.startRow]=[]),t[r.startRow].push(r);const n=[];for(const r in t){const s=t[+r];s.sort((o,a)=>o.startColumn-a.startColumn);let i=s[0];for(let o=1;o<s.length;o++){const a=s[o];a.startColumn<=i.endColumn+1&&a.startRow===i.startRow&&a.endRow===i.endRow?i.endColumn=Math.max(i.endColumn,a.endColumn):(n.push(i),i=a)}n.push(i)}return n}function j0(e){e.sort((r,s)=>r.startColumn-s.startColumn||r.startRow-s.startRow);const t={};for(const r of e)t[r.startColumn]||(t[r.startColumn]=[]),t[r.startColumn].push(r);const n=[];for(const r in t){const s=t[+r];s.sort((o,a)=>o.startRow-a.startRow);let i=s[0];for(let o=1;o<s.length;o++){const a=s[o];a.startRow<=i.endRow+1&&a.startColumn===i.startColumn&&a.endColumn===i.endColumn?i.endRow=Math.max(i.endRow,a.endRow):(n.push(i),i=a)}n.push(i)}return n}function W0(e){const t=ca(e),n=$0(t);return j0(n)}function Y0(e,t){const n=[];return e.forEach(r=>{n.push(...zt.subtract(r,t))}),zt.mergeRanges(n)}function uh(e,t){const n=pl(e.startRow,e.endRow,t.startRow,t.endRow),r=pl(e.startColumn,e.endColumn,t.startColumn,t.endColumn);if(!n||!r)return null;const[s,i]=n,[o,a]=r,l=V0(e.rangeType,t.rangeType,s,i,o,a);return{startRow:s,endRow:i,startColumn:o,endColumn:a,rangeType:l}}function pl(e,t,n,r){const s=isNaN(e)?-1/0:e,i=isNaN(t)?1/0:t,o=isNaN(n)?-1/0:n,a=isNaN(r)?1/0:r,l=Math.max(s,o),c=Math.min(i,a);if(l<=c){const u=l===-1/0?Number.NaN:l,h=c===1/0?Number.NaN:c;return[u,h]}else return null}function V0(e,t,n,r,s,i){const o=e!==void 0?e:El(n,r,s,i),a=t!==void 0?t:El(n,r,s,i);return o===_e.ALL||a===_e.ALL?o===a?o:o===_e.ALL?a:o:o===a?o:(o===_e.NORMAL||a===_e.NORMAL,_e.NORMAL)}function El(e,t,n,r){const s=!isNaN(e)&&!isNaN(t),i=!isNaN(n)&&!isNaN(r);return s&&i?_e.NORMAL:s?_e.ROW:i?_e.COLUMN:_e.ALL}const Yt=class Yt{static clone(t){return t.rangeType!==void 0?{startRow:t.startRow,startColumn:t.startColumn,endRow:t.endRow,endColumn:t.endColumn,rangeType:t.rangeType}:{startRow:t.startRow,startColumn:t.startColumn,endRow:t.endRow,endColumn:t.endColumn}}static equals(t,n){return t==null||n==null?!1:t.endRow===n.endRow&&t.endColumn===n.endColumn&&t.startRow===n.startRow&&t.startColumn===n.startColumn&&(t.rangeType===n.rangeType||t.rangeType===void 0&&n.rangeType===_e.NORMAL||n.rangeType===void 0&&t.rangeType===_e.NORMAL)}static simpleRangesIntersect(t,n){const{startRow:r,endRow:s,startColumn:i,endColumn:o}=t,{startRow:a,endRow:l,startColumn:c,endColumn:u}=n,h=r<=l&&s>=a,d=i<=u&&o>=c;return h&&d}static intersects(t,n){if(t.rangeType===_e.ROW&&n.rangeType===_e.COLUMN||t.rangeType===_e.COLUMN&&n.rangeType===_e.ROW)return!0;if(t.rangeType===_e.ROW&&n.rangeType===_e.ROW)return t.startRow<=n.endRow&&t.endRow>=n.startRow;if(t.rangeType===_e.COLUMN&&n.rangeType===_e.COLUMN)return t.startColumn<=n.endColumn&&t.endColumn>=n.startColumn;const r=Math.floor(Number.MAX_SAFE_INTEGER/10),s=Number.isNaN(t.startRow)?0:t.startRow,i=Number.isNaN(t.endRow)?r:t.endRow,o=Number.isNaN(t.startColumn)?0:t.startColumn,a=Number.isNaN(t.endColumn)?r:t.endColumn,l=Number.isNaN(n.startRow)?0:n.startRow,c=Number.isNaN(n.endRow)?r:n.endRow,u=Number.isNaN(n.startColumn)?0:n.startColumn,h=Number.isNaN(n.endColumn)?r:n.endColumn,d=Math.abs(o+a-u-h),f=Math.abs(o-a)+Math.abs(u-h),g=Math.abs(s+i-l-c),_=Math.abs(s-i)+Math.abs(l-c);return d<=f&&g<=_}static doAnyRangesIntersect(t,n){const r=new Us;return r.load(t.map(s=>({minX:s.startColumn,minY:s.startRow,maxX:s.endColumn,maxY:s.endRow}))),n.some(s=>r.search({minX:s.startColumn,minY:s.startRow,maxX:s.endColumn,maxY:s.endRow}).length>0)}static getIntersects(t,n){const r=t.startRow,s=t.endRow,i=t.startColumn,o=t.endColumn,a=n.startRow,l=n.endRow,c=n.startColumn,u=n.endColumn;let h,d,f,g;if(a<=s)a>=r?d=a:d=r;else return null;if(l>=r)l>=s?g=s:g=l;else return null;if(c<=o)c>i?h=c:h=i;else return null;if(u>=i)u>=o?f=o:f=u;else return null;return{startRow:d,endRow:g,startColumn:h,endColumn:f,rangeType:_e.NORMAL}}static contains(t,n){return t.startRow<=n.startRow&&t.endRow>=n.endRow&&t.startColumn<=n.startColumn&&t.endColumn>=n.endColumn}static realContain(t,n){return Yt.contains(t,n)&&(t.startRow<n.startRow||t.endRow>n.endRow||t.startColumn<n.startColumn||t.endColumn>n.endColumn)}static union(...t){return t.reduce((n,r)=>({startRow:Math.min(n.startRow,r.startRow),startColumn:Math.min(n.startColumn,r.startColumn),endRow:Math.max(n.endRow,r.endRow),endColumn:Math.max(n.endColumn,r.endColumn),rangeType:_e.NORMAL}),t[0])}static realUnion(...t){const n=t.some(i=>i.rangeType===_e.COLUMN),r=t.some(i=>i.rangeType===_e.ROW),s=Yt.union(...t);return{startColumn:r?Number.NaN:s.startColumn,endColumn:r?Number.NaN:s.endColumn,startRow:n?Number.NaN:s.startRow,endRow:n?Number.NaN:s.endRow,rangeType:r?_e.ROW:n?_e.COLUMN:_e.NORMAL}}static subtract(t,n){if(n.startRow>t.endRow||n.endRow<t.startRow||n.startColumn>t.endColumn||n.endColumn<t.startColumn)return[t];const r=[];n.startRow>=t.startRow&&r.push({startRow:t.startRow,startColumn:t.startColumn,endRow:n.startRow-1,endColumn:t.endColumn}),n.endRow<=t.endRow&&r.push({startRow:n.endRow+1,startColumn:t.startColumn,endRow:t.endRow,endColumn:t.endColumn});const s=Math.max(t.startRow,n.startRow),i=Math.min(t.endRow,n.endRow);return n.startColumn>=t.startColumn&&r.push({startRow:s,startColumn:t.startColumn,endRow:i,endColumn:n.startColumn-1}),n.endColumn<=t.endColumn&&r.push({startRow:s,startColumn:n.endColumn+1,endRow:i,endColumn:t.endColumn}),r.filter(a=>a.startRow<=a.endRow&&a.startColumn<=a.endColumn)}static mergeRanges(t){return W0(t)}static splitIntoGrid(t){return ca(t)}static subtractMulti(t,n){if(!n.length)return t;let r=t;return n.forEach(s=>{r=Y0(r,s)}),r}static hasIntersectionBetweenTwoRect(t,n){return!(t.left>n.right||t.right<n.left||t.top>n.bottom||t.bottom<n.top)}static getIntersectionBetweenTwoRect(t,n){const r=Math.max(t.left,n.left),s=Math.min(t.right,n.right),i=Math.max(t.top,n.top),o=Math.min(t.bottom,n.bottom);return s<=r||o<=i?null:{left:r,right:s,top:i,bottom:o,width:s-r,height:o-i}}static sort(t){return t.sort((n,r)=>n.startRow-r.startRow||n.startColumn-r.startColumn)}};p(Yt,"getRelativeRange",(t,n)=>({startRow:t.startRow-n.startRow,endRow:t.endRow-t.startRow,startColumn:t.startColumn-n.startColumn,endColumn:t.endColumn-t.startColumn})),p(Yt,"getPositionRange",(t,n,r)=>({...r||{},startRow:r&&[Me.ROW,Me.ALL].includes(r.startAbsoluteRefType||0)?r.startRow:t.startRow+n.startRow,endRow:r&&[Me.ROW,Me.ALL].includes(r.endAbsoluteRefType||0)?r.endRow:t.endRow+t.startRow+n.startRow,startColumn:r&&[Me.COLUMN,Me.ALL].includes(r.startAbsoluteRefType||0)?r.startColumn:t.startColumn+n.startColumn,endColumn:r&&[Me.COLUMN,Me.ALL].includes(r.endAbsoluteRefType||0)?r.endColumn:t.endColumn+t.startColumn+n.startColumn})),p(Yt,"moveHorizontal",(t,n=0,r=0)=>({...t,startColumn:t.startColumn+n,endColumn:t.endColumn+n+r})),p(Yt,"moveVertical",(t,n=0,r=0)=>({...t,startRow:t.startRow+n,endRow:t.endRow+n+r})),p(Yt,"moveOffset",(t,n,r)=>{const s={...t};switch(t.startAbsoluteRefType){case Me.ROW:s.startColumn+=n;break;case Me.COLUMN:s.startRow+=r;break;case Me.ALL:break;case Me.NONE:default:s.startRow+=r,s.startColumn+=n;break}switch(t.endAbsoluteRefType){case Me.ROW:s.endColumn+=n;break;case Me.COLUMN:s.endRow+=r;break;case Me.ALL:break;case Me.NONE:default:s.endRow+=r,s.endColumn+=n;break}return s});let zt=Yt;function z0(e,t){if(e.length===0||e[0].length===0)return null;const n=new Array(e[0].length).fill(0);let r=0,s=null;for(let i=0;i<e.length;i++){for(let a=0;a<e[0].length;a++)n[a]=t(e[i][a])?n[a]+1:0;const o=G0(n);o.area>r&&(r=o.area,s={startColumn:o.start,startRow:i-o.height+1,endColumn:o.end,endRow:i})}return s}function G0(e){const t=[];let n=0,r={area:0,height:0,start:0,end:0},s=0;for(;s<e.length;)if(t.length===0||e[s]>=e[t[t.length-1]])t.push(s++);else{const i=e[t.pop()],o=t.length===0?s:s-t[t.length-1]-1;i*o>n&&(n=i*o,r={area:n,height:i,start:t.length===0?0:t[t.length-1]+1,end:s-1})}for(;t.length>0;){const i=e[t.pop()],o=t.length===0?s:s-t[t.length-1]-1;i*o>n&&(n=i*o,r={area:n,height:i,start:t.length===0?0:t[t.length-1]+1,end:s-1})}return r}function K0(e,t){Xn.foreach(t,(n,r)=>{e[n][r]=void 0})}function X0(e,t){const n=e.toFullArray(),r=[];for(;;){const s=z0(n,t);if(!s)break;r.push(s),K0(n,s)}return r}class q0{constructor(t,n){p(this,"_values",[]);p(this,"_keys",[]);p(this,"_keyMaps",new Map);this._values=t,this._keys=n,t.forEach(r=>{this._initKeyMap(r)})}_initKeyMap(t){this._keys.forEach(n=>{const r=t[n],s=this._keyMaps.get(n)||new Map;s.set(r,t),this._keyMaps.set(n,s)})}getValue(t,n){const r=n||this._keys;for(let s=0;s<r.length;s++){const i=this._keyMaps.get(r[s]);if(i!=null&&i.has(t))return i.get(t)}return null}hasValue(t){for(let n=0;n<this._keys.length;n++){const r=this._keyMaps.get(this._keys[n]);if(r!=null&&r.has(t))return!0}return!1}addValue(t){this._values.push(t),this._initKeyMap(t)}setValue(t,n,r){const s=this.getValue(t);s&&Object.keys(s).includes(n)&&(s[n]=r)}deleteValue(t,n){const r=this.getValue(t,n);if(r){this._keys.forEach(i=>{const o=this._keyMaps.get(i),a=r[i];o==null||o.delete(a)});const s=this._values.findIndex(i=>i===r);this._values.splice(s,1)}}getValues(){return this._values}getKeyMap(t){var n;return[...((n=this._keyMaps.get(t))==null?void 0:n.keys())||[]]}clear(){this._values=[],this._keys=[],this._keyMaps.clear()}}function Zi(e,t,n,r){return{forEach(s){for(let i=e;i<=t;i++)for(let o=n;o<=r;o++)s(i,o)}}}function J0(e){if(e==null||e.length===0)return Number.NaN;const t=e.toLowerCase().split(""),n=t.length,r=o=>o.charCodeAt(0)-96;let s=0,i=0;for(let o=0;o<n;o++)i=r(t[o]),s+=i*26**(n-o-1);return s===0?Number.NaN:s-1}const Ps=65,hh=90,Z0=97;function Q0(e){const t=hh-Ps+1;let n="";for(;e>=0;)n=String.fromCharCode(e%t+Ps)+n,e=Math.floor(e/t)-1;return n}function dh(e,t){let n="";for(;t>0;)n+=e,t--;return n}function eC(e,t=!1){const n=hh-Ps+1;let r=Z0;t&&(r=Ps);const s=String.fromCharCode(e%n+r),i=Math.floor(e/n)+1;return dh(s,i)}function tC(e,t){return e.zIndex>t.zIndex?1:e.zIndex===t.zIndex?0:-1}function nC(e,t){return e.zIndex>t.zIndex?-1:e.zIndex===t.zIndex?0:1}function Yr(e="index",t=1){return(n,r)=>n[e]>r[e]?t:n[e]===r[e]?0:-t}function Vr(e,t=!1){const n=[];for(const r of e){const{st:s,ed:i,ts:o}=r;if(r.sId===void 0&&delete r.sId,s===i||!t&&Z.isEmptyObject(o)&&r.sId==null)continue;if(n.length===0){n.push(r);continue}const a=n.pop();rh(r,a)&&Z.hasIntersectionBetweenTwoRanges(a.st,a.ed,r.st,r.ed)?n.push({...r,st:a.st,ed:i}):n.push(a,r)}return n}function fh(e,t,n,r){var c;const{textRuns:s}=e;if(s==null)return;const i=[],o=s.length;let a=!1;const l=(c=t.textRuns)!=null?c:[];if(l.length)for(const u of l)u.st+=r,u.ed+=r;for(let u=0;u<o;u++){const h=s[u],{st:d,ed:f}=h;if(f<=r)i.push(h);else if(r>d&&r<f){a=!0;const g={...h,ed:r};i.push(g),l.length&&i.push(...l);const _={...h,st:r+n,ed:f+n};i.push(_)}else h.st+=n,h.ed+=n,a||(a=!0,i.push(...l)),i.push(h)}a||(a=!0,i.push(...l)),e.textRuns=Vr(i)}function mh(e,t,n,r){const{paragraphs:s}=e;if(s==null)return;const{paragraphs:i}=t,o=[];for(let l=0,c=s.length;l<c;l++){const u=s[l],{startIndex:h}=u;h>=r&&(u.startIndex+=n),o.push(u.startIndex)}let a=-1;if(i){for(let l=0,c=i.length;l<c;l++){const u=i[l];u.startIndex+=r;const h=u.startIndex;a=o.indexOf(h)}a!==-1&&s.splice(a,1),s.push(...i),s.sort(Yr("startIndex"))}}function gh(e,t,n,r){const{sectionBreaks:s}=e;if(s==null)return;for(let o=0,a=s.length;o<a;o++){const l=s[o],{startIndex:c}=l;c>=r&&(l.startIndex+=n)}const i=t.sectionBreaks;if(i){for(let o=0,a=i.length;o<a;o++){const l=i[o];l.startIndex+=r}s.push(...i),s.sort(Yr("startIndex"))}}function _h(e,t,n,r){const{customBlocks:s=[]}=e;for(let o=0,a=s.length;o<a;o++){const l=s[o],{startIndex:c}=l;c>=r&&(l.startIndex+=n)}const i=t.customBlocks;if(i){for(let o=0,a=i.length;o<a;o++){const l=i[o];l.startIndex+=r}s.push(...i),s.sort(Yr("startIndex"))}s.length&&!e.customBlocks&&(e.customBlocks=s)}function ph(e,t,n,r){const{tables:s}=e;if(s==null)return;for(let o=0,a=s.length;o<a;o++){const l=s[o],{startIndex:c,endIndex:u}=l;c>r?(l.startIndex+=n,l.endIndex+=n):u>r&&(l.endIndex+=n)}const i=t.tables;if(i){for(let o=0,a=i.length;o<a;o++){const l=i[o];l.startIndex+=r,l.endIndex+=r}s.push(...i),s.sort(Yr("startIndex"))}}const Eh="$",Cl=e=>e.split(Eh)[0];function ua(e){if(e.length<=1)return e;e.sort((s,i)=>s.startIndex-i.startIndex);const t=[];let n={...e[0]};n.rangeId=Cl(n.rangeId);for(let s=1;s<e.length;s++){const i=e[s];i.rangeId=Cl(i.rangeId),i.rangeId===n.rangeId&&jl(n.properties,i.properties)&&n.endIndex+1>=i.startIndex?n.endIndex=i.endIndex:(t.push(n),n={...i})}t.push(n);const r=Object.create(null);for(let s=0,i=t.length;s<i;s++){const o=t[s],a=o.rangeId;r[a]?(o.rangeId=`${a}${Eh}${r[a]}`,r[a]=r[a]+1):r[a]=1}return t}function Qi(e,t){const n=e.findIndex(s=>s.startIndex<t&&s.endIndex>=t),r=e[n];r&&e.splice(n,1,{rangeId:r.rangeId,rangeType:r.rangeType,startIndex:r.startIndex,endIndex:t-1,properties:{...r.properties}},{rangeId:r.rangeId,rangeType:r.rangeType,startIndex:t,endIndex:r.endIndex,properties:{...r.properties}})}function Ch(e){if(e.length<=1)return e;e.sort((r,s)=>r.startIndex-s.startIndex);const t=[];let n={...e[0]};for(let r=1;r<e.length;r++){const s=e[r];s.id===n.id&&n.endIndex+1>=s.startIndex?n.endIndex=s.endIndex:(t.push(n),n={...s})}return t.push(n),t}function eo(e,t){e.filter(r=>r.startIndex<t&&r.endIndex>=t).forEach(r=>{const s=e.indexOf(r);e.splice(s,1,{id:r.id,type:r.type,startIndex:r.startIndex,endIndex:t-1},{id:r.id,type:r.type,startIndex:t,endIndex:r.endIndex})})}function rC(e,t,n,r){e.customRanges||(e.customRanges=[]);const{customRanges:s}=e;Qi(s,r);for(let o=0,a=s.length;o<a;o++){const l=s[o],{startIndex:c}=l;c>=r&&(l.startIndex+=n,l.endIndex+=n)}const i=[];if(t.customRanges){for(let o=0,a=t.customRanges.length;o<a;o++){const l=t.customRanges[o];l.startIndex+=r,l.endIndex+=r,i.push(l)}s.push(...i)}e.customRanges=ua(s)}function sC(e,t,n,r){e.customDecorations||(e.customDecorations=[]);const{customDecorations:s}=e;eo(s,r);for(let o=0,a=s.length;o<a;o++){const l=s[o],{startIndex:c}=l;c>=r&&(l.startIndex+=n,l.endIndex+=n)}const i=[];if(t.customDecorations){for(let o=0,a=t.customDecorations.length;o<a;o++){const l=t.customDecorations[o];l.startIndex+=r,l.endIndex+=r,i.push(l)}s.push(...i)}e.customDecorations=Ch(s)}function Rh(e,t,n){const{textRuns:r}=e,s=n,i=n+t,o=[];if(r){const a=[];for(let l=0,c=r.length;l<c;l++){const u=r[l],{st:h,ed:d}=u;if(s<=h&&i>=d){o.push({...u,st:h-s,ed:d-s});continue}else h<=s&&d>=i?(o.push({...u,st:s-s,ed:i-s}),u.ed-=t):s>=h&&s<d?(o.push({...u,st:s-s,ed:d-s}),u.ed=s):i>h&&i<=d?(o.push({...u,st:h-s,ed:i-s}),u.st=i-t,u.ed-=t):h>=i&&(u.st-=t,u.ed-=t);a.push(u)}e.textRuns=a}return o.length===0&&o.push({st:0,ed:t,ts:{}}),o}function Ih(e,t,n){const{paragraphs:r}=e,s=n,i=n+t,o=[];if(r){const a=[];for(let l=0,c=r.length;l<c;l++){const u=r[l],{startIndex:h}=u;if(h>=s&&h<i){o.push({...u,startIndex:h-n});continue}else h>=i&&(u.startIndex-=t);a.push(u)}e.paragraphs=a}return o}function Sh(e,t,n){const{sectionBreaks:r}=e,s=n,i=n+t-1,o=[];if(r){const a=[];for(let l=0,c=r.length;l<c;l++){const u=r[l],{startIndex:h}=u;if(h>=s&&h<=i){o.push({...u,startIndex:h-n});continue}else h>i&&(u.startIndex-=t);a.push(u)}e.sectionBreaks=a}return o}function Oh(e,t,n){const{customBlocks:r=[]}=e,s=n,i=n+t-1,o=[];if(r){const a=[];for(let l=0,c=r.length;l<c;l++){const u=r[l],{startIndex:h}=u;if(h>=s&&h<=i){o.push({...u,startIndex:h-n});continue}else h>i&&(u.startIndex-=t);a.push(u)}e.customBlocks=a}return r.length&&!e.customBlocks&&(e.customBlocks=r),o}function wh(e,t,n){const{tables:r}=e,s=n,i=n+t-1,o=[];if(r){const a=[];for(let l=0,c=r.length;l<c;l++){const u=r[l],{startIndex:h,endIndex:d}=u;if(s<=h&&i>=d){o.push({...u,startIndex:h-n,endIndex:d-n});continue}else if(h<=s&&d>=i){const f=ti(h,d,s,i);if(f.length===0||(u.startIndex=f[0],u.endIndex=f[1],u.startIndex===u.endIndex))continue}else i<h&&(u.startIndex-=t,u.endIndex-=t);a.push(u)}e.tables=a}return o}function iC(e,t,n){const{customRanges:r}=e,s=n,i=n+t-1,o=[];if(r){const a=[];for(let l=0,c=r.length;l<c;l++){const u=r[l],{startIndex:h,endIndex:d}=u;if(h>=s&&d<=i){o.push(u);continue}else if(Math.max(s,h)<=Math.min(i,d)){const f=ti(h,d,s,i);if(f.length===0)continue;u.startIndex=f[0],u.endIndex=f[1]}else i<h&&(u.startIndex-=t,u.endIndex-=t);a.push(u)}e.customRanges=ua(a)}return o}function oC(e,t,n,r=!0){const{customDecorations:s}=e,i=n,o=n+t-1,a=[];if(s){const l=[];for(let c=0,u=s.length;c<u;c++){const h=s[c],{startIndex:d,endIndex:f}=h;if(d>=i&&f<=o){a.push(h);continue}else if(Math.max(i,d)<=Math.min(o,f)){const g=ti(d,f,i,o);if(g.length===0)continue;h.startIndex=g[0],h.endIndex=g[1]}else o<d&&r&&(h.startIndex-=t,h.endIndex-=t);l.push(h)}e.customDecorations=l}return a}var vh=(e=>(e.ORDER_LIST_QUICK_1="1.",e.ORDER_LIST_QUICK_2="a)",e.ORDER_LIST_QUICK_3="a.",e.ORDER_LIST_QUICK_4="i.",e.ORDER_LIST_QUICK_5="A.",e.ORDER_LIST_QUICK_6="I.",e.ORDER_LIST_QUICK_7="01.",e.BULLET_LIST="*",e))(vh||{}),Ft=(e=>(e.BULLET_LIST="BULLET_LIST",e.BULLET_LIST_1="BULLET_LIST_1",e.BULLET_LIST_2="BULLET_LIST_2",e.BULLET_LIST_3="BULLET_LIST_3",e.BULLET_LIST_4="BULLET_LIST_4",e.BULLET_LIST_5="BULLET_LIST_5",e.ORDER_LIST="ORDER_LIST",e.ORDER_LIST_1="ORDER_LIST_1",e.ORDER_LIST_2="ORDER_LIST_2",e.ORDER_LIST_3="ORDER_LIST_3",e.ORDER_LIST_4="ORDER_LIST_4",e.ORDER_LIST_5="ORDER_LIST_5",e.ORDER_LIST_QUICK_2="ORDER_LIST_QUICK_2",e.ORDER_LIST_QUICK_3="ORDER_LIST_QUICK_3",e.ORDER_LIST_QUICK_4="ORDER_LIST_QUICK_4",e.ORDER_LIST_QUICK_5="ORDER_LIST_QUICK_5",e.ORDER_LIST_QUICK_6="ORDER_LIST_QUICK_6",e.CHECK_LIST="CHECK_LIST",e.CHECK_LIST_CHECKED="CHECK_LIST_CHECKED",e))(Ft||{});const as={"a)":{glyphFormat:"%1)",glyphType:fe.DECIMAL},"1.":{glyphType:fe.DECIMAL},"a.":{glyphFormat:"%1.",glyphType:fe.LOWER_LETTER},"A.":{glyphType:fe.UPPER_LETTER},"i.":{glyphFormat:"%1.",glyphType:fe.LOWER_ROMAN},"I.":{glyphFormat:"%1.",glyphType:fe.UPPER_LETTER}},Nn=e=>[...e,...e,...e].map((t,n)=>({glyphFormat:` %${n+1}`,glyphSymbol:t,bulletAlignment:Br.START,textStyle:{fs:12},startNumber:0,paragraphProperties:{hanging:{v:21},indentStart:{v:21*n}}})),Mn=e=>e.map((t,n)=>({...t,bulletAlignment:Br.START,textStyle:{fs:12},startNumber:0,paragraphProperties:{hanging:{v:21},indentStart:{v:21*n}}})),Rl=(e,t)=>new Array(9).fill(0).map((n,r)=>({glyphFormat:` %${r+1}`,glyphSymbol:e,bulletAlignment:Br.START,textStyle:{fs:16},startNumber:0,paragraphProperties:{hanging:{v:21},indentStart:{v:21*r},textStyle:t}})),zr={BULLET_LIST:{listType:"BULLET_LIST",nestingLevel:Nn(["●","○","■"])},BULLET_LIST_1:{listType:"BULLET_LIST",nestingLevel:Nn(["❖","➢","■"])},BULLET_LIST_2:{listType:"BULLET_LIST",nestingLevel:Nn(["✔","●","◆"])},BULLET_LIST_3:{listType:"BULLET_LIST",nestingLevel:Nn(["■","◆","○"])},BULLET_LIST_4:{listType:"BULLET_LIST",nestingLevel:Nn(["✧","○","■"])},BULLET_LIST_5:{listType:"BULLET_LIST",nestingLevel:Nn(["➢","○","◆"])},ORDER_LIST:{listType:"ORDER_LIST",nestingLevel:Mn([{glyphFormat:"%1.",glyphType:fe.DECIMAL},{glyphFormat:"%2.",glyphType:fe.LOWER_LETTER},{glyphFormat:"%3.",glyphType:fe.LOWER_ROMAN},{glyphFormat:"%4.",glyphType:fe.DECIMAL},{glyphFormat:"%5.",glyphType:fe.LOWER_LETTER},{glyphFormat:"%6.",glyphType:fe.LOWER_ROMAN},{glyphFormat:"%7.",glyphType:fe.DECIMAL},{glyphFormat:"%8.",glyphType:fe.LOWER_LETTER},{glyphFormat:"%9.",glyphType:fe.LOWER_ROMAN}])},ORDER_LIST_1:{listType:"ORDER_LIST",nestingLevel:Mn([{glyphFormat:"%1)",glyphType:fe.DECIMAL},{glyphFormat:"%2)",glyphType:fe.LOWER_LETTER},{glyphFormat:"%3)",glyphType:fe.LOWER_ROMAN},{glyphFormat:"%4)",glyphType:fe.DECIMAL},{glyphFormat:"%5)",glyphType:fe.LOWER_LETTER},{glyphFormat:"%6)",glyphType:fe.LOWER_ROMAN},{glyphFormat:"%7)",glyphType:fe.DECIMAL},{glyphFormat:"%8)",glyphType:fe.LOWER_LETTER},{glyphFormat:"%9)",glyphType:fe.LOWER_ROMAN}])},ORDER_LIST_2:{listType:"ORDER_LIST",nestingLevel:Mn(["%1.","%1.%2.","%1.%2.%3.","%1.%2.%3.%4.","%1.%2.%3.%4.%5.","%1.%2.%3.%4.%5.%6.","%1.%2.%3.%4.%5.%6.%7."].map(e=>({glyphFormat:e,glyphType:fe.DECIMAL})))},ORDER_LIST_3:{listType:"ORDER_LIST",nestingLevel:Mn([{glyphFormat:"%1.",glyphType:fe.UPPER_LETTER},{glyphFormat:"%2.",glyphType:fe.LOWER_LETTER},{glyphFormat:"%3.",glyphType:fe.LOWER_ROMAN},{glyphFormat:"%4.",glyphType:fe.UPPER_LETTER},{glyphFormat:"%5.",glyphType:fe.LOWER_LETTER},{glyphFormat:"%6.",glyphType:fe.LOWER_ROMAN},{glyphFormat:"%7.",glyphType:fe.UPPER_LETTER},{glyphFormat:"%8.",glyphType:fe.LOWER_LETTER},{glyphFormat:"%9.",glyphType:fe.LOWER_ROMAN}])},ORDER_LIST_4:{listType:"ORDER_LIST",nestingLevel:Mn([{glyphFormat:"%1.",glyphType:fe.UPPER_LETTER},{glyphFormat:"%2.",glyphType:fe.DECIMAL},{glyphFormat:"%3.",glyphType:fe.LOWER_ROMAN},{glyphFormat:"%4.",glyphType:fe.UPPER_LETTER},{glyphFormat:"%5.",glyphType:fe.DECIMAL},{glyphFormat:"%6.",glyphType:fe.LOWER_ROMAN},{glyphFormat:"%7.",glyphType:fe.UPPER_LETTER},{glyphFormat:"%8.",glyphType:fe.DECIMAL},{glyphFormat:"%9.",glyphType:fe.LOWER_ROMAN}])},ORDER_LIST_5:{listType:"ORDER_LIST",nestingLevel:Mn([{glyphFormat:"%1.",glyphType:fe.DECIMAL_ZERO},{glyphFormat:"%2.",glyphType:fe.LOWER_LETTER},{glyphFormat:"%3.",glyphType:fe.LOWER_ROMAN},{glyphFormat:"%4.",glyphType:fe.DECIMAL_ZERO},{glyphFormat:"%5.",glyphType:fe.LOWER_LETTER},{glyphFormat:"%6.",glyphType:fe.LOWER_ROMAN},{glyphFormat:"%7.",glyphType:fe.DECIMAL_ZERO},{glyphFormat:"%8.",glyphType:fe.LOWER_LETTER},{glyphFormat:"%9.",glyphType:fe.LOWER_ROMAN}])},CHECK_LIST:{listType:"CHECK_LIST",nestingLevel:Rl("☐")},CHECK_LIST_CHECKED:{listType:"CHECK_LIST_CHECKED",nestingLevel:Rl("☑",{st:{s:ie.TRUE}})}},ls=e=>{const{glyphFormat:t,glyphType:n}=e,r=Z.deepClone(zr.ORDER_LIST);return r.nestingLevel[0].glyphFormat=t,r.nestingLevel[0].glyphType=n,r},aC={ORDER_LIST_QUICK_2:ls(as["a)"]),ORDER_LIST_QUICK_3:ls(as["a."]),ORDER_LIST_QUICK_4:ls(as["i."]),ORDER_LIST_QUICK_6:ls(as["I."])};Object.assign(zr,aC);const lC={"1.":"ORDER_LIST","a)":"ORDER_LIST_QUICK_2","a.":"ORDER_LIST_QUICK_3","i.":"ORDER_LIST_QUICK_4","A.":"ORDER_LIST_3","I.":"ORDER_LIST_QUICK_6","01.":"ORDER_LIST_5","*":"BULLET_LIST"};function cC(e,t,n,r,s){const i=uC(e,t,n,r,s),o=hC(e,t,n,r,s),a=dC(e,t,n,r,s),l=fC(e,t,n,r,s),c=mC(e,t,n,r,s),u=gC(e,t,n,r),h=_C(e,t,n,r,s);return{dataStream:"",textRuns:i,paragraphs:o,sectionBreaks:a,customBlocks:l,tables:c,customRanges:u,customDecorations:h}}function uC(e,t,n,r,s){const{textRuns:i}=e,{textRuns:o}=t;if(i==null||o==null)return;const a=Rh(e,n,r);if(s!==Ee.REPLACE){const l=bh(o,a,s);t.textRuns=l}return fh(e,t,n,r),a}function bh(e,t,n){if(t.length===0)return e;e=Z.deepClone(e),t=Z.deepClone(t);const r=[],s=e.length,i=t.length;let o=0,a=0,l=null;function c(){return l?(r.push(l),l=null,!0):!1}for(;o<s&&a<i;){const{st:f,ed:g,ts:_}=e[o],{st:R,ed:b,ts:F,sId:k}=t[a];let W;if(n===Ee.COVER?W={...F,..._}:W={..._},g<R)c()||r.push(e[o]),o++;else if(b<f)c()||r.push(t[a]),a++;else{const S={st:Math.min(f,R),ed:Math.max(f,R),ts:f<R?{..._}:{...F},sId:f<R?void 0:k};S.ed>S.st&&r.push(S),r.push({st:Math.max(f,R),ed:Math.min(g,b),ts:W,sId:k}),g<b?(o++,t[a].st=g,t[a].st===t[a].ed&&a++):(a++,e[o].st=b,e[o].st===e[o].ed&&o++);const C={st:Math.min(g,b),ed:Math.max(g,b),ts:g<b?{...F}:{..._},sId:g<b?k:void 0};l=C.ed>C.st?C:null}}c();const u=r[r.length-1],h=e[s-1],d=t[i-1];return u&&u.ed!==Math.max(h.ed,d.ed)&&(h.ed>d.ed?r.push(h):r.push(d)),Vr(r)}function hC(e,t,n,r,s){const{paragraphs:i}=e,{paragraphs:o}=t;if(i==null||o==null)return;const a=Ih(e,n,r);if(s!==Ee.REPLACE){const l=[];for(const c of o){const{startIndex:u,paragraphStyle:h,bullet:d}=c;let f=[];for(const g of a){const{startIndex:_,paragraphStyle:R,bullet:b}=g;let F,k;if(s===Ee.COVER?(F={...R,...h},k={listId:"",listType:Ft.BULLET_LIST,nestingLevel:0,textStyle:{},...b,...d}):(F={...h,...R},k={listId:"",listType:Ft.BULLET_LIST,nestingLevel:0,textStyle:{},...d,...b}),u===_){f.push({startIndex:u,paragraphStyle:F,bullet:k});break}}l.push(...f),f=[]}t.paragraphs=l}return mh(e,t,n,r),a}function dC(e,t,n,r,s){const{sectionBreaks:i}=e,{sectionBreaks:o}=t;if(i==null||o==null)return;const a=Sh(e,n,r);if(s!==Ee.REPLACE){const l=[];for(const c of o){const{startIndex:u}=c;let h=[];for(const d of a){const{startIndex:f}=d;if(u===f){s===Ee.COVER?h.push({...d,...c}):h.push({...c,...d});break}}l.push(...h),h=[]}t.sectionBreaks=l}return gh(e,t,n,r),a}function fC(e,t,n,r,s){const{customBlocks:i=[]}=e,{customBlocks:o}=t;if(i==null||o==null)return;const a=Oh(e,n,r);if(s!==Ee.REPLACE){const l=[];for(const c of o){const{startIndex:u}=c;let h=[];for(const d of a){const{startIndex:f}=d;if(u===f){s===Ee.COVER?h.push({...d,...c}):h.push({...c,...d});break}}l.push(...h),h=[]}t.customBlocks=l}return _h(e,t,n,r),i.length&&!e.customBlocks&&(e.customBlocks=i),a}function mC(e,t,n,r,s){const{tables:i}=e,{tables:o}=t;if(i==null||o==null)return;const a=wh(e,n,r);if(s!==Ee.REPLACE){const l=[];for(const c of o){const{startIndex:u,endIndex:h}=c;let d=[];for(const f of a){const{startIndex:g,endIndex:_}=f;if(g>=u&&_<=h){s===Ee.COVER?d.push({...f,...c}):d.push({...c,...f});break}}l.push(...d),d=[]}t.tables=l}return ph(e,t,n,r),a}function gC(e,t,n,r,s){e.customRanges||(e.customRanges=[]),Qi(e.customRanges,r),Qi(e.customRanges,r+n);const i=r,o=r+n-1,{customRanges:a}=t,l=[],c=new Map;e.customRanges.forEach(h=>{const{startIndex:d,endIndex:f}=h;d>=i&&f<=o?c.set(h.rangeId,h):l.push(h)});const u=[];return a?(a.forEach(h=>{const{startIndex:d,endIndex:f}=h;l.push({...h,startIndex:d+r,endIndex:f+r})}),e.customRanges=ua(l),u):[]}function _C(e,t,n,r,s){e.customDecorations||(e.customDecorations=[]),eo(e.customDecorations,r),eo(e.customDecorations,r+n);const i=[],{customDecorations:o}=e,{customDecorations:a=[]}=t;if(s===Ee.REPLACE){for(let l=0;l<o.length;l++){const c=o[l],{startIndex:u,endIndex:h}=c;u>=r&&h<=r+n-1&&i.push(c)}a.forEach(l=>{const{startIndex:c,endIndex:u}=l;o.push({...l,startIndex:c+r,endIndex:u+r})})}else for(const l of a){const{id:c}=l;if(l.type===En.DELETED){const u=o.filter(h=>h.id===c);u.length&&i.push(...u)}else o.push({...l,startIndex:l.startIndex+r,endIndex:l.endIndex+r})}for(const l of i){const{id:c}=l,u=o.findIndex(h=>h.id===c);u!==-1&&o.splice(u,1)}return e.customDecorations=Ch(o),i}var ha=(e=>(e[e.copy=0]="copy",e[e.cut=1]="cut",e))(ha||{});function ks(e,t,n,r=!0){const{textRuns:s}=e;if(s){const i=[];for(const o of s){const a=Z.deepClone(o),{st:l,ed:c}=a;Z.hasIntersectionBetweenTwoRanges(l,c,t,n)&&(t>=l&&t<=c?i.push({...a,st:t,ed:Math.min(n,c)}):n>=l&&n<=c?i.push({...a,st:Math.max(t,l),ed:n}):i.push(a))}return Vr(i.map(o=>{const{st:a,ed:l}=o;return{...o,st:a-t,ed:l-t}}))}else if(r)return[{st:0,ed:n-t,ts:{}}]}function yh(e,t,n){const{tables:r=[]}=e,s=[];for(const i of r){const o=Z.deepClone(i),{startIndex:a,endIndex:l}=o;a>=t&&l<=n&&s.push({...o,startIndex:a-t,endIndex:l-t})}return s}function Ah(e,t,n){const{paragraphs:r=[]}=e,s=[];for(const i of r){const{startIndex:o}=i;if(o>=t&&o<n){const a=Z.deepClone(i);s.push(a)}}if(s.length)return s.map(i=>({...i,startIndex:i.startIndex-t}))}function pC(e,t,n){const{sectionBreaks:r=[]}=e,s=[];for(const i of r){const{startIndex:o}=i;o>=t&&o<=n&&s.push(Z.deepClone(i))}if(s.length)return s.map(i=>({...i,startIndex:i.startIndex-t}))}function Th(e,t,n){const{customBlocks:r=[]}=e,s=[];for(const i of r){const{startIndex:o}=i;o>=t&&o<n&&s.push(Z.deepClone(i))}if(s.length)return s.map(i=>({...i,startIndex:i.startIndex-t}))}function Mt(e,t,n,r=!0,s=1){const{dataStream:i}=e,o={dataStream:i.slice(t,n)};o.textRuns=ks(e,t,n,r);const a=yh(e,t,n);if(a.length&&(o.tables=a),o.paragraphs=Ah(e,t,n),s===1){const c=Mh(e,t,n);c?o.customDecorations=c:r&&(o.customDecorations=[])}const{customRanges:l}=Nh(e,t,n);return l?o.customRanges=l:r&&(o.customRanges=[]),o.customBlocks=Th(e,t,n),o}function EC(e){const{dataStream:t,textRuns:n,paragraphs:r,customRanges:s,customDecorations:i,tables:o}=e;let a=0,l=0;s==null||s.forEach(u=>{u.startIndex<0&&(a=Math.max(a,-u.startIndex)),u.endIndex>t.length-1&&(l=Math.max(l,u.endIndex-t.length+1))});const c=`${t}`;return n&&(n[0]&&(n[0].st=n[0].st-a),n[n.length-1]&&(n[n.length-1].ed=n[n.length-1].ed+l)),n==null||n.forEach(u=>{u.st+=a,u.ed+=a}),r==null||r.forEach(u=>{u.startIndex+=a}),s==null||s.forEach(u=>{u.startIndex+=a,u.endIndex+=a}),i==null||i.forEach(u=>{u.startIndex+=a,u.endIndex+=l}),o==null||o.forEach(u=>{u.startIndex+=a,u.endIndex+=l}),{...e,dataStream:c,textRuns:n,paragraphs:r,customRanges:s,customDecorations:i,tables:o}}function Nh(e,t,n){if(e.customRanges==null)return{};const{customRanges:r}=e;return{customRanges:r.filter(a=>Math.max(a.startIndex,t)<=Math.min(a.endIndex,n-1)).map(a=>({...a,startIndex:Math.max(a.startIndex,t),endIndex:Math.min(a.endIndex,n-1)})).map(a=>({...a,startIndex:a.startIndex-t,endIndex:a.endIndex-t})),leftOffset:0,rightOffset:0}}function Mh(e,t,n){if(e.customDecorations==null)return;const{customDecorations:r=[]}=e,s=[];return r.forEach(i=>{if(Math.max(i.startIndex,t)<=Math.min(i.endIndex,n-1)){const o=Z.deepClone(i);s.push({...o,startIndex:Math.max(o.startIndex-t,0),endIndex:Math.min(o.endIndex,n-1)-t})}}),s}function CC(e,t,n){return e==null||t==null?e!=null?e:t:bh(e,t,n)}function RC(e,t,n){if(e==null||t==null)return e!=null?e:t;if(t.length===0||e.length===0)return e;if(t.length>1||e.length>1)throw new Error("Cannot cover multiple customRanges");return n===Ee.REPLACE?[{...e[0]}]:[{...t[0],...e[0]}]}function IC(e,t,n){return t.length===0||e.length===0||n===Ee.REPLACE?e:[...e,...t.filter(r=>!e.some(s=>r.id===s.id))]}function to(e,t,n=Ee.COVER){if(t.dataStream!=="")throw new Error("Cannot compose other body with non-empty dataStream");const r={dataStream:e.dataStream},{textRuns:s,paragraphs:i=[],customRanges:o,customDecorations:a=[]}=e,{textRuns:l,paragraphs:c=[],customRanges:u,customDecorations:h=[]}=t;r.textRuns=CC(l,s,n),r.customRanges=RC(u,o,n);const d=IC(h,a,n);d.length&&(r.customDecorations=d);const f=[];let g=0,_=0;for(;g<i.length&&_<c.length;){const R=i[g],b=c[_],{startIndex:F}=R,{startIndex:k}=b;F===k?(f.push(Z.deepMerge(R,b)),g++,_++):F<k?(f.push(Z.deepClone(R)),g++):(f.push(Z.deepClone(b)),_++)}return g<i.length&&f.push(...i.slice(g)),_<c.length&&f.push(...c.slice(_)),f.length&&(r.paragraphs=f),r}function SC(e){const{body:t}=e;if(t==null)return!0;const{textRuns:n,paragraphs:r,customRanges:s,customBlocks:i,customDecorations:o,tables:a}=t;return n==null&&r==null&&s==null&&i==null&&o==null&&a==null}class Un{constructor(t){p(this,"_index",0);p(this,"_offset",0);this._actions=t}hasNext(){return this.peekLength()<Number.POSITIVE_INFINITY}next(t){t||(t=Number.POSITIVE_INFINITY);const n=this._actions[this._index];if(n){const r=this._offset,s=n.len;return t>=s-r?(t=s-r,this._index+=1,this._offset=0):this._offset+=t,n.t===q.DELETE||n.t===q.RETAIN&&n.body==null?Z.deepClone({...n,len:t}):Z.deepClone({...n,len:t,body:Mt(n.body,r,r+t,!1)})}else return{t:q.RETAIN,len:Number.POSITIVE_INFINITY}}peek(){return this._actions[this._index]}peekLength(){return this._actions[this._index]?this._actions[this._index].len-this._offset:Number.POSITIVE_INFINITY}peekType(){const t=this._actions[this._index];return t?t.t:q.RETAIN}rest(){if(this.hasNext()){if(this._offset===0)return this._actions.slice(this._index);{const t=this._offset,n=this._index,r=this.next(),s=this._actions.slice(this._index);return this._offset=t,this._index=n,[r].concat(s)}}else return[]}}function Dh(e,t,n){const{dataStream:r}=e,s=n,i=n+t,o=Rh(e,t,n),a=Ih(e,t,n),l=Sh(e,t,n),c=Oh(e,t,n),u=wh(e,t,n),h=iC(e,t,n),d=oC(e,t,n);let f="";return r&&(e.dataStream=oh(r,s,i),f=r.slice(s,i)),{dataStream:f,textRuns:o,paragraphs:a,sectionBreaks:l,customBlocks:c,tables:u,customRanges:h,customDecorations:d}}function Lh(e,t,n,r){e.dataStream=ih(e.dataStream,r,t.dataStream),fh(e,t,n,r),mh(e,t,n,r),gh(e,t,n,r),_h(e,t,n,r),ph(e,t,n,r),rC(e,t,n,r),sC(e,t,n,r)}function OC(e,t,n,r,s=Ee.COVER){return cC(e,t,n,r,s)}function wC(e,t,n){return t<=0?{dataStream:""}:Dh(e,t,n)}function vC(e,t,n,r){n!==0&&Lh(e,t,n,r)}function bC(e,t){const n=new vn;return n.reset(),t.forEach(r=>{const s=Z.deepClone(r);switch(s.t){case q.RETAIN:{const{coverType:i,body:o,len:a}=s;o!=null&&OC(e,o,a,n.cursor,i),n.moveCursor(a);break}case q.INSERT:{const{body:i,len:o}=s;vC(e,i,o,n.cursor),n.moveCursor(o);break}case q.DELETE:{const{len:i}=s;wC(e,i,n.cursor);break}default:throw new Error(`Unknown action type for action: ${s}.`)}}),e}function yC(e,t,n,r,s){if(e==null||t==null)return t;if(e.length===0||t.length===0)return[];t=Z.deepClone(t),e=Z.deepClone(e);const i=[],o=t.length,a=e.length;let l=0,c=0,u=null;function h(){return u?(i.push(u),u=null,!0):!1}for(;l<o&&c<a;){const{st:_,ed:R,ts:b}=t[l],{st:F,ed:k,ts:W,sId:S}=e[c];let C={};if(s===0)C={...b},n===Ee.COVER&&r===Ee.REPLACE&&W&&(C=Object.assign({},W,C));else if(C={...b},n===Ee.REPLACE){if(r===Ee.REPLACE)C={...W};else if(b&&W){const v=Object.keys(b);for(const A of v)W[A]&&delete C[A]}}else if(r===Ee.REPLACE){if(W){const v=Object.keys(W);for(const A of v)W[A]!==void 0&&(C[A]=W[A])}}else if(W){const v=Object.keys(W);for(const A of v)C[A]!==void 0&&delete C[A]}if(R<F)h()||i.push(t[l]),l++;else if(k<_)h()||i.push(e[c]),c++;else{const v={st:Math.min(_,F),ed:Math.max(_,F),ts:_<F?{...b}:{...W}};v.ed>v.st&&i.push(),i.push({st:Math.max(_,F),ed:Math.min(R,k),ts:C,sId:S}),R<k?(l++,e[c].st=R,e[c].st===e[c].ed&&c++):(c++,t[l].st=k,t[l].st===t[l].ed&&l++);const A={st:Math.min(R,k),ed:Math.max(R,k),ts:R<k?{...W}:{...b},sId:R<k?S:void 0};u=A.ed>A.st?A:null}}h();const d=i[i.length-1],f=t[o-1],g=e[a-1];return d.ed!==Math.max(f.ed,g.ed)&&(f.ed>g.ed?i.push(f):i.push(g)),Vr(i,!0)}function AC(e,t,n,r,s){if(e==null||t==null)return t;if(e.length===0||t.length===0)return[];if(e.length>1||t.length>1)throw new Error("CustomRanges is only supported transform for length one now.");const i=e[0],o=t[0];if(n===Ee.REPLACE)return s===1?[Z.deepClone(i)]:[Z.deepClone(o)];if(r===Ee.REPLACE){const a=Z.deepClone(o);return s===1&&Object.assign(a,Z.deepClone(i)),[a]}else{const a=Z.deepClone(o);return s===1&&Object.assign(a,Z.deepClone(i)),[a]}}function Il(e,t,n,r,s){const i={startIndex:t.startIndex};if(t.paragraphStyle&&(i.paragraphStyle=Z.deepClone(t.paragraphStyle),e.paragraphStyle)){if(n===Ee.REPLACE)if(r===Ee.REPLACE)s===1&&(i.paragraphStyle={...e.paragraphStyle});else if(s===1){const o=Object.keys(e.paragraphStyle);for(const a of o)e.paragraphStyle[a]!==void 0&&(i.paragraphStyle[a]=e.paragraphStyle[a])}else{const o=Object.keys(e.paragraphStyle);for(const a of o)i.paragraphStyle[a]===void 0&&(i.paragraphStyle[a]=e.paragraphStyle[a])}else if(r===Ee.REPLACE)if(s===1){const o=Object.keys(e.paragraphStyle);for(const a of o)e.paragraphStyle[a]!==void 0&&(i.paragraphStyle[a]=e.paragraphStyle[a])}else{const o=Object.keys(e.paragraphStyle);for(const a of o)i.paragraphStyle[a]===void 0&&(i.paragraphStyle[a]=e.paragraphStyle[a])}else if(s===1){const o=Object.keys(e.paragraphStyle);for(const a of o)i.paragraphStyle[a]&&delete i.paragraphStyle[a]}}return n===Ee.REPLACE&&r===Ee.REPLACE?i.bullet=s===1?Z.deepClone(e.bullet):Z.deepClone(t.bullet):e.bullet===void 0?i.bullet=Z.deepClone(t.bullet):n===Ee.REPLACE||r===Ee.REPLACE?i.bullet=s===0&&t.bullet?Z.deepClone(t.bullet):Z.deepClone(e.bullet):s===0&&t.bullet!==void 0&&(i.bullet=Z.deepClone(t.bullet)),i}function TC(e,t){if(e==null||t==null)return t;if(e.length===0||t.length===0)return Z.deepClone(t);const n=[];for(const r of t){const{id:s,type:i}=r;let o=!1;for(const a of e)if(a.id===s){(a.type===En.DELETED||i===En.DELETED)&&(o=!0,n.push({...r,type:En.DELETED}));break}o||n.push(r)}return n}function NC(e,t,n=!1){const{body:r,coverType:s=Ee.COVER}=e,{body:i,coverType:o=Ee.COVER}=t;if(r==null||r.dataStream!==""||i==null||i.dataStream!=="")throw new Error("Data stream is not supported in retain transform.");const a={dataStream:""},l=o,{textRuns:c,paragraphs:u=[],customRanges:h,customDecorations:d}=r,{textRuns:f,paragraphs:g=[],customRanges:_,customDecorations:R}=i,b=yC(c,f,s,o,n?1:0);b&&(a.textRuns=b);const F=AC(h,_,s,o,n?1:0);F&&(a.customRanges=F);const k=TC(d,R);k&&(a.customDecorations=k);const W=[];let S=0,C=0;for(;S<u.length&&C<g.length;){const v=u[S],A=g[C],{startIndex:H}=v,{startIndex:B}=A;if(H===B){let m={startIndex:H};n?m=Il(v,A,s,o,1):m=Il(v,A,s,o,0),W.push(m),S++,C++}else H<B?S++:(W.push(Z.deepClone(A)),C++)}return C<g.length&&W.push(...g.slice(C)),W.length&&(a.paragraphs=W),{coverType:l,body:a}}function Sl(e){return Object.keys(e).length===1}const Wn=class Wn{constructor(){p(this,"_actions",[])}static apply(t,n){return bC(t,n)}static compose(t,n){const r=new Un(t),s=new Un(n),i=new Wn;for(;r.hasNext()||s.hasNext();)if(s.peekType()===q.INSERT)i.push(s.next());else if(r.peekType()===q.DELETE)i.push(r.next());else{const o=Math.min(r.peekLength(),s.peekLength()),a=r.next(o),l=s.next(o);if(a.t===q.INSERT&&l.t===q.RETAIN)l.body==null?i.push(a):i.push({...a,body:to(a.body,l.body,l.coverType)});else if(a.t===q.RETAIN&&l.t===q.RETAIN)if(a.body==null&&l.body==null)i.push(a.len!==Number.POSITIVE_INFINITY?a:l);else if(a.body&&l.body){const c=a.coverType===Ee.REPLACE||l.coverType===Ee.REPLACE?Ee.REPLACE:Ee.COVER;i.push({...a,t:q.RETAIN,coverType:c,body:to(a.body,l.body,l.coverType)})}else i.push(a.body?a:l);else a.t===q.RETAIN&&l.t===q.DELETE?i.push(l):a.t===q.INSERT&&(l.t,q.DELETE)}return i.trimEndUselessRetainAction(),i.serialize()}static transform(t,n,r="right"){return this._transform(n,t,r==="left"?"right":"left")}static _transform(t,n,r="right"){const s=new Un(t),i=new Un(n),o=new Wn;for(;s.hasNext()||i.hasNext();)if(s.peekType()===q.INSERT&&(r==="left"||i.peekType()!==q.INSERT)){const a=s.next();o.retain(a.len)}else if(i.peekType()===q.INSERT)o.push(i.next());else{const a=Math.min(s.peekLength(),i.peekLength()),l=s.next(a),c=i.next(a);if(l.t===q.DELETE)continue;if(c.t===q.DELETE){o.push(c);continue}if(l.body==null||c.body==null)o.push(c);else{const{coverType:u,body:h}=NC(l,c,r==="left");o.push({...c,t:q.RETAIN,coverType:u,body:h})}}return o.trimEndUselessRetainAction(),o.serialize()}static transformPosition(t,n,r=!1){const s=new Un(t);let i=0;for(;s.hasNext()&&i<=n;){const o=s.peekLength(),a=s.peekType();if(s.next(),a===q.DELETE){n-=Math.min(o,n-i);continue}else a===q.INSERT&&(i<n||!r)&&(n+=o);i+=o}return n}static isNoop(t){return t.length===0}static invert(t){const n=[];for(const r of t)if(r.t===q.INSERT)n.push({t:q.DELETE,len:r.len,body:r.body});else if(r.t===q.DELETE){if(r.body==null)throw new Error("Can not invert DELETE action without body property, makeInvertible must be called first.");n.push({t:q.INSERT,body:r.body,len:r.len})}else if(r.body!=null){if(r.oldBody==null)throw new Error("Can not invert RETAIN action without oldBody property, makeInvertible must be called first.");n.push({t:q.RETAIN,body:r.oldBody,oldBody:r.body,len:r.len,coverType:Ee.REPLACE})}else n.push(r);return n}static makeInvertible(t,n){const r=[];let s=0;for(const i of t){if(i.t===q.DELETE&&(i.body==null||i.body&&i.body.dataStream.length!==i.len)){const o=Mt(n,s,s+i.len,!1);i.len=o.dataStream.length,i.body=o}if(i.t===q.RETAIN&&i.body!=null){const o=Mt(n,s,s+i.len,!0);i.oldBody={...o,dataStream:""},i.len=o.dataStream.length}r.push(i),i.t!==q.INSERT&&(s+=i.len)}return r}insert(t,n){const r={t:q.INSERT,body:n,len:t};return this.push(r),this}retain(t,n,r){const s={t:q.RETAIN,len:t};return n!=null&&(s.body=n),r!=null&&(s.coverType=r),this.push(s),this}delete(t){const n={t:q.DELETE,len:t};return this.push(n),this}empty(){return this._actions=[],this}serialize(){return this._actions}push(...t){if(t.length>1){for(const i of t)this.push(i);return this}let n=this._actions.length,r=this._actions[n-1];const s=Z.deepClone(t[0]);if(s.t===q.RETAIN&&s.len===0&&s.body==null)return this;if(typeof r=="object"){if(r.t===q.DELETE&&s.t===q.DELETE)return r.len+=s.len,this;if(r.t===q.DELETE&&s.t===q.INSERT&&(n-=1,r=this._actions[n-1],r==null))return this._actions.unshift(s),this;if(r.t===q.RETAIN&&s.t===q.RETAIN&&r.body==null&&s.body==null)return r.len+=s.len,this;if(r.t===q.INSERT&&Sl(r.body)&&s.t===q.INSERT&&Sl(s.body))return r.len+=s.len,r.body.dataStream+=s.body.dataStream,this}return n===this._actions.length?this._actions.push(s):this._actions.splice(n,0,s),this}trimEndUselessRetainAction(){let t=this._actions[this._actions.length-1];for(;t&&t.t===q.RETAIN&&SC(t);)this._actions.pop(),t=this._actions[this._actions.length-1];return this}};p(Wn,"id","text-x"),p(Wn,"uri","https://github.com/dream-num/univer#text-x");let De=Wn;Object.defineProperty(De,"name",{value:"text-x"});const Yn=class Yn{static registerSubtype(t){var n;t==null||this._subTypes.has(t.name)&&((n=this._subTypes.get(t.name))==null?void 0:n.id)!==De.id||(this._subTypes.set(t.name,t),at.type.registerSubtype(t))}static apply(t,n){if(!at.type.isNoop(n))return at.type.apply(t,n)}static compose(t,n){return at.type.compose(t,n)}static transform(t,n,r){return at.type.transform(t,n,r)}static transformPosition(t,n,r="right"){return t&&t.length===2&&t[0]==="body"&&t[1].et===De.name?De.transformPosition(t[1].e,n,r==="left"):n}static invertWithDoc(t,n){return at.type.invertWithDoc(t,n)}static isNoop(t){return at.type.isNoop(t)}static getInstance(){return this._instance==null&&(this._instance=new Yn),this._instance}removeOp(t,n){return at.removeOp(t,n)}moveOp(t,n){return at.moveOp(t,n)}insertOp(t,n){return at.insertOp(t,n)}replaceOp(t,n,r){return at.replaceOp(t,n,r)}editOp(t,n=["body"]){return at.editOp(n,De.name,t)}};p(Yn,"uri","https://github.com/dream-num/univer#json-x"),p(Yn,"_subTypes",new Map),p(Yn,"_instance",null);let Gt=Yn;Gt.registerSubtype(De);var xh=(e=>(e.PARAGRAPH="PARAGRAPH",e.SECTION_BREAK="SECTION_BREAK",e.TABLE="TABLE",e.TABLE_ROW="TABLE_ROW",e.TABLE_CELL="TABLE_CELL",e.CUSTOM_BLOCK="CUSTOM_BLOCK",e))(xh||{}),lt=(e=>(e.PARAGRAPH="\r",e.SECTION_BREAK=`
|
|
5
|
+
`,e.TABLE_START="",e.TABLE_ROW_START="\x1B",e.TABLE_CELL_START="",e.TABLE_CELL_END="",e.TABLE_ROW_END="",e.TABLE_END="",e.CUSTOM_RANGE_START="",e.CUSTOM_RANGE_END="",e.COLUMN_BREAK="\v",e.PAGE_BREAK="\f",e.DOCS_END="\0",e.TAB=" ",e.CUSTOM_BLOCK="\b",e.LETTER="",e.SPACE=" ",e))(lt||{});function MC(e){return`${e}`}const DC=[lt.TABLE_START,lt.TABLE_ROW_START,lt.TABLE_CELL_START,lt.TABLE_CELL_END,lt.TABLE_ROW_END,lt.TABLE_END],ni=e=>{const t=e.endsWith(`\r
|
|
6
|
+
`)?e.slice(0,-2):e;return DC.reduce((n,r)=>n.replaceAll(r,""),t)},LC=e=>e?ni(e).replaceAll("\r","")==="":!0,xC=e=>{const t=e.replace(/\n/g,"\r"),n=[],r=[];let s=0,i="";const o=(l,c=!0)=>{const u=t.slice(s,l);if(Z.isLegalUrl(u)){const h=nt(),d=`${u}`,f={startIndex:s,endIndex:s+d.length-1,rangeId:h,rangeType:on.HYPERLINK,properties:{url:e}};r.push(f),i+=d,s=l+1,c&&(i+="\r",n.push({startIndex:l}))}else i+=t.slice(s,l+1),s=l+1,c&&n.push({startIndex:l})};let a=0;for(let l=0;l<t.length;l++)t[l]==="\r"&&(o(l),a=l);return(a!==t.length-1||t.length===1)&&o(t.length,!1),{dataStream:i,paragraphs:n,customRanges:r}},da={id:"default_doc",documentStyle:{}};class UC extends Gs{constructor(n){var r;super();p(this,"type",we.UNIVER_DOC);p(this,"_name$",new le.BehaviorSubject(""));p(this,"name$",this._name$.asObservable());p(this,"snapshot");this.snapshot={...da,...n},this._name$.next((r=this.snapshot.title)!=null?r:"No Title")}getUnitId(){throw new Error("Method not implemented.")}getRev(){var n;return(n=this.snapshot.rev)!=null?n:1}incrementRev(){this.snapshot.rev=this.getRev()+1}setRev(n){this.snapshot.rev=n}setName(n){this.snapshot.title=n,this._name$.next(n)}get drawings(){return this.snapshot.drawings}get documentStyle(){return this.snapshot.documentStyle}get lists(){return this.snapshot.lists}get zoomRatio(){var n;return((n=this.snapshot.settings)==null?void 0:n.zoomRatio)||1}resetDrawing(n,r){this.snapshot.drawings=n,this.snapshot.drawingsOrder=r}getBody(){return this.snapshot.body}getSnapshot(){return this.snapshot}getBulletPresetList(){var s;const n=(s=this.snapshot.lists)!=null?s:{};return{...zr,...n}}updateDocumentId(n){this.snapshot.id=n}updateDocumentRenderConfig(n){const{documentStyle:r}=this.snapshot;r.renderConfig==null?r.renderConfig=n:r.renderConfig={...r.renderConfig,...n}}getDocumentStyle(){return this.snapshot.documentStyle}updateDocumentStyle(n){this.snapshot.documentStyle==null?this.snapshot.documentStyle=n:this.snapshot.documentStyle={...this.snapshot.documentStyle,...n}}updateDocumentDataMargin(n){const{t:r,l:s,b:i,r:o}=n,{documentStyle:a}=this.snapshot;r!=null&&(a.marginTop=r),s!=null&&(a.marginLeft=s),i!=null&&(a.marginBottom=i),o!=null&&(a.marginRight=o)}updateDocumentDataPageSize(n,r){const{documentStyle:s}=this.snapshot;if(!s.pageSize){s.pageSize={width:n!=null?n:Number.POSITIVE_INFINITY,height:r!=null?r:Number.POSITIVE_INFINITY};return}n!==void 0&&(s.pageSize.width=n),r!==void 0&&(s.pageSize.height=r)}updateDrawing(n,r){const{drawings:s}=this,{width:i,height:o,left:a,top:l}=r,c=s==null?void 0:s[n];if(!c)return;const u=c.docTransform;u.size.width=i,u.size.height=o,u.positionH.posOffset=a,u.positionV.posOffset=l}setZoomRatio(n=1){this.snapshot.settings?this.snapshot.settings.zoomRatio=n:this.snapshot.settings={zoomRatio:n}}setDisabled(n){this.snapshot.disabled=n}getDisabled(){return this.snapshot.disabled}getTitle(){return this.snapshot.title}}class Dt extends UC{constructor(n){var s,i;super(Z.isEmptyObject(n)?U_():n);p(this,"_unitId");p(this,"headerModelMap",new Map);p(this,"footerModelMap",new Map);p(this,"change$",new le.BehaviorSubject(0));const r=6;this._unitId=(s=this.snapshot.id)!=null?s:nt(r),this._initializeHeaderFooterModel(),this._name$.next((i=this.snapshot.title)!=null?i:"")}dispose(){super.dispose(),this.headerModelMap.forEach(n=>{n.dispose()}),this.footerModelMap.forEach(n=>{n.dispose()}),this._name$.complete()}getDrawings(){return this.snapshot.drawings}getDrawingsOrder(){return this.snapshot.drawingsOrder}getCustomRanges(){var n;return(n=this.snapshot.body)==null?void 0:n.customRanges}getCustomDecorations(){var n;return(n=this.snapshot.body)==null?void 0:n.customDecorations}getSettings(){return this.snapshot.settings}reset(n){if(n.id&&n.id!==this._unitId)throw new Error("Cannot reset a document model with a different unit id!");this.snapshot={...da,...n},this._initializeHeaderFooterModel(),this.change$.next(this.change$.value+1)}getSelfOrHeaderFooterModel(n){if(n!=null){if(this.headerModelMap.has(n))return this.headerModelMap.get(n);if(this.footerModelMap.has(n))return this.footerModelMap.get(n)}return this}getUnitId(){return this._unitId}apply(n){if(!Gt.isNoop(n))return this.snapshot=Gt.apply(this.snapshot,n),n!=null&&n.some(r=>Array.isArray(r)&&((r==null?void 0:r[0])==="headers"||(r==null?void 0:r[0])==="footers"))&&(this.headerModelMap.clear(),this.footerModelMap.clear(),this._initializeHeaderFooterModel()),this.change$.next(this.change$.value+1),this.snapshot}sliceBody(n,r,s=ha.copy){const i=this.getBody();if(i!=null)return Mt(i,n,r,!1,s)}_initializeHeaderFooterModel(){const{headers:n,footers:r}=this.getSnapshot();if(n)for(const s in n){const i=n[s];this.headerModelMap.set(s,new Dt(i)),this.headerModelMap.get(s).updateDocumentId(this.getUnitId())}if(r)for(const s in r){const i=r[s];this.footerModelMap.set(s,new Dt(i)),this.footerModelMap.get(s).updateDocumentId(this.getUnitId())}}updateDocumentId(n){super.updateDocumentId(n),this._unitId=n}getPlainText(){var n,r;return ni((r=(n=this.getBody())==null?void 0:n.dataStream)!=null?r:"")}}function PC(e){const{ranges:t,id:n,type:r}=e,s=new De;let i=0;for(let o=0;o<t.length;o++){const a=t[o],{startOffset:l,endOffset:c}=a;l>0&&s.push({t:q.RETAIN,len:l-i}),s.push({t:q.RETAIN,body:{dataStream:"",customDecorations:[{id:n,type:r,startIndex:0,endIndex:c-l-1}]},len:c-l}),i=c}return s}function kC(e){var u,h,d;const{id:t,segmentId:n,documentDataModel:r}=e,s=r==null?void 0:r.getBody();if(!r||!s)return!1;const i=(d=(h=(u=r.getSelfOrHeaderFooterModel(n))==null?void 0:u.getBody())==null?void 0:h.customDecorations)==null?void 0:d.find(f=>f.id===t);if(!i)return!1;const o=new De,{startIndex:a,endIndex:l}=i,c=l-a+1;return o.push({t:q.RETAIN,len:a}),o.push({t:q.RETAIN,len:c,body:{dataStream:"",customDecorations:[{startIndex:0,endIndex:c-1,id:t,type:En.DELETED}]}}),o}function Uh(e,t,n,r){return e<=n&&t>=n||e>=n&&e<=r}function FC(e,t){const n=[];for(let r=0,s=t.length;r<s;r++){const i=t[r];e.collapsed?i.startIndex<e.startOffset&&e.startOffset<=i.endIndex&&n.push(i):Uh(e.startOffset,e.endOffset-1,i.startIndex,i.endIndex)&&n.push(i)}return n}function HC(e){return{...Z.deepClone(e),rangeId:nt()}}function BC(e,t){const n=[];let r=e[0];for(const s of t)s<e[0]||s>e[1]||(r<s&&n.push([r,s-1]),r=s+1);return r<=e[1]&&n.push([r,e[1]]),n}function Ph(e,t,n,r){const s=[];for(let i=0,o=n.length;i<o;i++){const a=n[i];if((r===void 0||a.rangeType===r)&&Math.max(a.startIndex,e)<=Math.min(a.endIndex,t)&&s.push({...a}),a.startIndex>t)break}return s}function $C(e,t){var i,o,a,l,c;const n=Ph(e.startOffset,e.collapsed?e.startOffset:e.endOffset-1,(i=t.customRanges)!=null?i:[]),r=Math.min(e.startOffset,(a=(o=n[0])==null?void 0:o.startIndex)!=null?a:1/0),s=Math.max(e.endOffset,((c=(l=n[n.length-1])==null?void 0:l.endIndex)!=null?c:-1/0)+1);return{startOffset:r,endOffset:s,collapsed:r===s}}var Ai,Ol;function jC(){if(Ol)return Ai;Ol=1;var e=-1,t=1,n=0;function r(m,x,O,N,y){if(m===x)return m?[[n,m]]:[];if(O!=null){var w=H(m,x,O);if(w)return w}var T=a(m,x),M=m.substring(0,T);m=m.substring(T),x=x.substring(T),T=c(m,x);var D=m.substring(m.length-T);m=m.substring(0,m.length-T),x=x.substring(0,x.length-T);var P=s(m,x);return M&&P.unshift([n,M]),D&&P.push([n,D]),F(P,y),N&&h(P),P}function s(m,x){var O;if(!m)return[[t,x]];if(!x)return[[e,m]];var N=m.length>x.length?m:x,y=m.length>x.length?x:m,w=N.indexOf(y);if(w!==-1)return O=[[t,N.substring(0,w)],[n,y],[t,N.substring(w+y.length)]],m.length>x.length&&(O[0][0]=O[2][0]=e),O;if(y.length===1)return[[e,m],[t,x]];var T=u(m,x);if(T){var M=T[0],D=T[1],P=T[2],J=T[3],z=T[4],oe=r(M,P),ce=r(D,J);return oe.concat([[n,z]],ce)}return i(m,x)}function i(m,x){for(var O=m.length,N=x.length,y=Math.ceil((O+N)/2),w=y,T=2*y,M=new Array(T),D=new Array(T),P=0;P<T;P++)M[P]=-1,D[P]=-1;M[w+1]=0,D[w+1]=0;for(var J=O-N,z=J%2!==0,oe=0,ce=0,I=0,L=0,Y=0;Y<y;Y++){for(var V=-Y+oe;V<=Y-ce;V+=2){var $=w+V,j;V===-Y||V!==Y&&M[$-1]<M[$+1]?j=M[$+1]:j=M[$-1]+1;for(var Q=j-V;j<O&&Q<N&&m.charAt(j)===x.charAt(Q);)j++,Q++;if(M[$]=j,j>O)ce+=2;else if(Q>N)oe+=2;else if(z){var ee=w+J-V;if(ee>=0&&ee<T&&D[ee]!==-1){var U=O-D[ee];if(j>=U)return o(m,x,j,Q)}}}for(var G=-Y+I;G<=Y-L;G+=2){var ee=w+G,U;G===-Y||G!==Y&&D[ee-1]<D[ee+1]?U=D[ee+1]:U=D[ee-1]+1;for(var X=U-G;U<O&&X<N&&m.charAt(O-U-1)===x.charAt(N-X-1);)U++,X++;if(D[ee]=U,U>O)L+=2;else if(X>N)I+=2;else if(!z){var $=w+J-G;if($>=0&&$<T&&M[$]!==-1){var j=M[$],Q=w+j-$;if(U=O-U,j>=U)return o(m,x,j,Q)}}}}return[[e,m],[t,x]]}function o(m,x,O,N){var y=m.substring(0,O),w=x.substring(0,N),T=m.substring(O),M=x.substring(N),D=r(y,w),P=r(T,M);return D.concat(P)}function a(m,x){if(!m||!x||m.charAt(0)!==x.charAt(0))return 0;for(var O=0,N=Math.min(m.length,x.length),y=N,w=0;O<y;)m.substring(w,y)==x.substring(w,y)?(O=y,w=O):N=y,y=Math.floor((N-O)/2+O);return k(m.charCodeAt(y-1))&&y--,y}function l(m,x){var O=m.length,N=x.length;if(O==0||N==0)return 0;O>N?m=m.substring(O-N):O<N&&(x=x.substring(0,O));var y=Math.min(O,N);if(m==x)return y;for(var w=0,T=1;;){var M=m.substring(y-T),D=x.indexOf(M);if(D==-1)return w;T+=D,(D==0||m.substring(y-T)==x.substring(0,T))&&(w=T,T++)}}function c(m,x){if(!m||!x||m.slice(-1)!==x.slice(-1))return 0;for(var O=0,N=Math.min(m.length,x.length),y=N,w=0;O<y;)m.substring(m.length-y,m.length-w)==x.substring(x.length-y,x.length-w)?(O=y,w=O):N=y,y=Math.floor((N-O)/2+O);return W(m.charCodeAt(m.length-y))&&y--,y}function u(m,x){var O=m.length>x.length?m:x,N=m.length>x.length?x:m;if(O.length<4||N.length*2<O.length)return null;function y(ce,I,L){for(var Y=ce.substring(L,L+Math.floor(ce.length/4)),V=-1,$="",j,Q,ee,U;(V=I.indexOf(Y,V+1))!==-1;){var G=a(ce.substring(L),I.substring(V)),X=c(ce.substring(0,L),I.substring(0,V));$.length<X+G&&($=I.substring(V-X,V)+I.substring(V,V+G),j=ce.substring(0,L-X),Q=ce.substring(L+G),ee=I.substring(0,V-X),U=I.substring(V+G))}return $.length*2>=ce.length?[j,Q,ee,U,$]:null}var w=y(O,N,Math.ceil(O.length/4)),T=y(O,N,Math.ceil(O.length/2)),M;if(!w&&!T)return null;T?w?M=w[4].length>T[4].length?w:T:M=T:M=w;var D,P,J,z;m.length>x.length?(D=M[0],P=M[1],J=M[2],z=M[3]):(J=M[0],z=M[1],D=M[2],P=M[3]);var oe=M[4];return[D,P,J,z,oe]}function h(m){for(var x=!1,O=[],N=0,y=null,w=0,T=0,M=0,D=0,P=0;w<m.length;)m[w][0]==n?(O[N++]=w,T=D,M=P,D=0,P=0,y=m[w][1]):(m[w][0]==t?D+=m[w][1].length:P+=m[w][1].length,y&&y.length<=Math.max(T,M)&&y.length<=Math.max(D,P)&&(m.splice(O[N-1],0,[e,y]),m[O[N-1]+1][0]=t,N--,N--,w=N>0?O[N-1]:-1,T=0,M=0,D=0,P=0,y=null,x=!0)),w++;for(x&&F(m),b(m),w=1;w<m.length;){if(m[w-1][0]==e&&m[w][0]==t){var J=m[w-1][1],z=m[w][1],oe=l(J,z),ce=l(z,J);oe>=ce?(oe>=J.length/2||oe>=z.length/2)&&(m.splice(w,0,[n,z.substring(0,oe)]),m[w-1][1]=J.substring(0,J.length-oe),m[w+1][1]=z.substring(oe),w++):(ce>=J.length/2||ce>=z.length/2)&&(m.splice(w,0,[n,J.substring(0,ce)]),m[w-1][0]=t,m[w-1][1]=z.substring(0,z.length-ce),m[w+1][0]=e,m[w+1][1]=J.substring(ce),w++),w++}w++}}var d=/[^a-zA-Z0-9]/,f=/\s/,g=/[\r\n]/,_=/\n\r?\n$/,R=/^\r?\n\r?\n/;function b(m){function x(ce,I){if(!ce||!I)return 6;var L=ce.charAt(ce.length-1),Y=I.charAt(0),V=L.match(d),$=Y.match(d),j=V&&L.match(f),Q=$&&Y.match(f),ee=j&&L.match(g),U=Q&&Y.match(g),G=ee&&ce.match(_),X=U&&I.match(R);return G||X?5:ee||U?4:V&&!j&&Q?3:j||Q?2:V||$?1:0}for(var O=1;O<m.length-1;){if(m[O-1][0]==n&&m[O+1][0]==n){var N=m[O-1][1],y=m[O][1],w=m[O+1][1],T=c(N,y);if(T){var M=y.substring(y.length-T);N=N.substring(0,N.length-T),y=M+y.substring(0,y.length-T),w=M+w}for(var D=N,P=y,J=w,z=x(N,y)+x(y,w);y.charAt(0)===w.charAt(0);){N+=y.charAt(0),y=y.substring(1)+w.charAt(0),w=w.substring(1);var oe=x(N,y)+x(y,w);oe>=z&&(z=oe,D=N,P=y,J=w)}m[O-1][1]!=D&&(D?m[O-1][1]=D:(m.splice(O-1,1),O--),m[O][1]=P,J?m[O+1][1]=J:(m.splice(O+1,1),O--))}O++}}function F(m,x){m.push([n,""]);for(var O=0,N=0,y=0,w="",T="",M;O<m.length;){if(O<m.length-1&&!m[O][1]){m.splice(O,1);continue}switch(m[O][0]){case t:y++,T+=m[O][1],O++;break;case e:N++,w+=m[O][1],O++;break;case n:var D=O-y-N-1;if(x){if(D>=0&&C(m[D][1])){var P=m[D][1].slice(-1);if(m[D][1]=m[D][1].slice(0,-1),w=P+w,T=P+T,!m[D][1]){m.splice(D,1),O--;var J=D-1;m[J]&&m[J][0]===t&&(y++,T=m[J][1]+T,J--),m[J]&&m[J][0]===e&&(N++,w=m[J][1]+w,J--),D=J}}if(S(m[O][1])){var P=m[O][1].charAt(0);m[O][1]=m[O][1].slice(1),w+=P,T+=P}}if(O<m.length-1&&!m[O][1]){m.splice(O,1);break}if(w.length>0||T.length>0){w.length>0&&T.length>0&&(M=a(T,w),M!==0&&(D>=0?m[D][1]+=T.substring(0,M):(m.splice(0,0,[n,T.substring(0,M)]),O++),T=T.substring(M),w=w.substring(M)),M=c(T,w),M!==0&&(m[O][1]=T.substring(T.length-M)+m[O][1],T=T.substring(0,T.length-M),w=w.substring(0,w.length-M)));var z=y+N;w.length===0&&T.length===0?(m.splice(O-z,z),O=O-z):w.length===0?(m.splice(O-z,z,[t,T]),O=O-z+1):T.length===0?(m.splice(O-z,z,[e,w]),O=O-z+1):(m.splice(O-z,z,[e,w],[t,T]),O=O-z+2)}O!==0&&m[O-1][0]===n?(m[O-1][1]+=m[O][1],m.splice(O,1)):O++,y=0,N=0,w="",T="";break}}m[m.length-1][1]===""&&m.pop();var oe=!1;for(O=1;O<m.length-1;)m[O-1][0]===n&&m[O+1][0]===n&&(m[O][1].substring(m[O][1].length-m[O-1][1].length)===m[O-1][1]?(m[O][1]=m[O-1][1]+m[O][1].substring(0,m[O][1].length-m[O-1][1].length),m[O+1][1]=m[O-1][1]+m[O+1][1],m.splice(O-1,1),oe=!0):m[O][1].substring(0,m[O+1][1].length)==m[O+1][1]&&(m[O-1][1]+=m[O+1][1],m[O][1]=m[O][1].substring(m[O+1][1].length)+m[O+1][1],m.splice(O+1,1),oe=!0)),O++;oe&&F(m,x)}function k(m){return m>=55296&&m<=56319}function W(m){return m>=56320&&m<=57343}function S(m){return W(m.charCodeAt(0))}function C(m){return k(m.charCodeAt(m.length-1))}function v(m){for(var x=[],O=0;O<m.length;O++)m[O][1].length>0&&x.push(m[O]);return x}function A(m,x,O,N){return C(m)||S(N)?null:v([[n,m],[e,x],[t,O],[n,N]])}function H(m,x,O){var N=typeof O=="number"?{index:O,length:0}:O.oldRange,y=typeof O=="number"?null:O.newRange,w=m.length,T=x.length;if(N.length===0&&(y===null||y.length===0)){var M=N.index,D=m.slice(0,M),P=m.slice(M),J=y?y.index:null;e:{var z=M+T-w;if(J!==null&&J!==z||z<0||z>T)break e;var oe=x.slice(0,z),ce=x.slice(z);if(ce!==P)break e;var I=Math.min(M,z),L=D.slice(0,I),Y=oe.slice(0,I);if(L!==Y)break e;var V=D.slice(I),$=oe.slice(I);return A(L,V,$,P)}e:{if(J!==null&&J!==M)break e;var j=M,oe=x.slice(0,j),ce=x.slice(j);if(oe!==D)break e;var Q=Math.min(w-j,T-j),ee=P.slice(P.length-Q),U=ce.slice(ce.length-Q);if(ee!==U)break e;var V=P.slice(0,P.length-Q),$=ce.slice(0,ce.length-Q);return A(D,V,$,ee)}}if(N.length>0&&y&&y.length===0)e:{var L=m.slice(0,N.index),ee=m.slice(N.index+N.length),I=L.length,Q=ee.length;if(T<I+Q)break e;var Y=x.slice(0,I),U=x.slice(T-Q);if(L!==Y||ee!==U)break e;var V=m.slice(I,w-Q),$=x.slice(I,T-Q);return A(L,V,$,ee)}return null}function B(m,x,O,N){return r(m,x,O,N,!0)}return B.INSERT=t,B.DELETE=e,B.EQUAL=n,Ai=B,Ai}var WC=jC();const fa=wt(WC);function YC(e){var h,d,f;const{rangeId:t,segmentId:n,documentDataModel:r,insert:s}=e,i=(d=(h=r.getSelfOrHeaderFooterModel(n).getBody())==null?void 0:h.customRanges)==null?void 0:d.find(g=>g.rangeId===t);if(!i)return!1;const{startIndex:o,endIndex:a}=i,l=new De,c=a-o+1;l.push({t:q.RETAIN,len:o}),l.push({t:q.RETAIN,len:c,body:{dataStream:"",customRanges:[]}}),s&&l.push({t:q.INSERT,body:s,len:s.dataStream.length});const u=a+1+((f=s==null?void 0:s.dataStream.length)!=null?f:0);return l.selections=[{startOffset:u,endOffset:u,collapsed:!0}],l}function VC(e){const{ranges:t,rangeId:n,rangeType:r,wholeEntity:s,properties:i,body:o}=e;let a=0;const l=new De;let c=!1;return t.forEach(u=>{var k,W,S;const h=$C(u,o);if(!h||!o)return!1;const{startOffset:d,endOffset:f}=h,g=(k=o.customRanges)!=null?k:[],_=(C,v,A)=>{var O,N,y,w;const H=Ph(C,v,g,r),B=Math.min((N=(O=H[0])==null?void 0:O.startIndex)!=null?N:1/0,C),m=Math.max((w=(y=H[H.length-1])==null?void 0:y.endIndex)!=null?w:-1/0,v),x={rangeId:A?`${n}$${A}`:n,rangeType:r,startIndex:0,endIndex:m-B,wholeEntity:s,properties:{...i}};l.push({t:q.RETAIN,len:B-a}),l.push({t:q.RETAIN,len:m-B+1,body:{dataStream:"",customRanges:[x]},coverType:Ee.COVER}),a=m+1},R=((W=o.paragraphs)!=null?W:[]).filter(C=>C.startIndex<f&&C.startIndex>d),b=((S=o.customBlocks)!=null?S:[]).filter(C=>C.startIndex<f&&C.startIndex>d);BC([d,f-1],[...R.map(C=>C.startIndex),...b.map(C=>C.startIndex)]).forEach(([C,v],A)=>_(C,v,A)),c=!0,l.selections=[{startOffset:h.endOffset,endOffset:h.endOffset,collapsed:!0}]}),c?l:!1}function kh(e,t,n=0,r=null,s=!0){e.sort((c,u)=>c.startOffset-u.startOffset);const i=[],{paragraphs:o=[]}=t,a=o==null?void 0:o.find(c=>c.startIndex>=e[0].startOffset&&c.startIndex<e[0].endOffset);let l=n;if(e.forEach(c=>{const{startOffset:u,endOffset:h}=c;u>l&&(i.push({t:q.RETAIN,len:u-l}),l=u),l<h&&(i.push({t:q.DELETE,len:h-l}),l=h)}),r&&i.push({t:q.INSERT,body:r,len:r.dataStream.length}),a&&s){const c=o.find(u=>u.startIndex-n>=e[e.length-1].endOffset-1);c&&(c.startIndex>l&&(i.push({t:q.RETAIN,len:c.startIndex-l}),l=c.startIndex),i.push({t:q.RETAIN,len:1,body:{dataStream:"",paragraphs:[{...c,startIndex:0,bullet:a==null?void 0:a.bullet}]},coverType:Ee.REPLACE}))}return i}function zC(e,t,n=0){const r=[];let s=n;return e.forEach(i=>{const{startOffset:o,endOffset:a}=i;o>s&&(r.push({t:q.RETAIN,len:o-s}),s=o),a>s&&(r.push({t:q.RETAIN,len:a-s,body:{...Z.deepClone(t),dataStream:""}}),s=a)}),r}const GC=e=>{var h;const{selection:t,body:n,doc:r}=e,s=t.segmentId,i=(h=r.getSelfOrHeaderFooterModel(s))==null?void 0:h.getBody();if(!i)return!1;const o=t.collapsed?null:Mt(i,t.startOffset,t.endOffset),a=fa(o?o.dataStream:"",n.dataStream);let l=0;const c=a.map(([d,f])=>{switch(d){case 0:{const g={t:q.RETAIN,body:{...Mt(n,l,l+f.length,!1),dataStream:""},len:f.length};return l+=f.length,g}case 1:{const g={t:q.INSERT,body:Mt(n,l,l+f.length),len:f.length};return l+=f.length,g}default:return{t:q.DELETE,len:f.length}}}),u=new De;return u.push({t:q.RETAIN,len:t.startOffset}),u.push(...c),u};function KC(e,t){return!!((e==null?void 0:e.length)===(t==null?void 0:t.length)&&(e!=null&&e.every((n,r)=>JSON.stringify(n)===JSON.stringify(t==null?void 0:t[r]))))}const XC=e=>{var d;const{selection:t,body:n,doc:r,themeService:s}=e,i=t.segmentId,o=(d=r.getSelfOrHeaderFooterModel(i))==null?void 0:d.getBody();if(!o)return!1;const a=t.collapsed?null:Mt(o,t.startOffset,t.endOffset),l=fa(a?a.dataStream:"",n.dataStream);let c=0;const u=l.map(([f,g])=>{switch(f){case 0:{const _=ks(n,c,c+g.length,!1),R=ks(a,c,c+g.length,!1),b={t:q.RETAIN,body:KC(_,R)?void 0:{textRuns:_==null?void 0:_.map(F=>{var k,W,S,C,v,A,H;return{...F,ts:{...F.ts,cl:(S=(W=(k=F.ts)==null?void 0:k.cl)==null?void 0:W.rgb)!=null&&S.includes(".")?{rgb:s.getColorFromTheme((A=(v=(C=F.ts)==null?void 0:C.cl)==null?void 0:v.rgb)!=null?A:"")}:(H=F.ts)==null?void 0:H.cl}}}),dataStream:""},len:g.length};return c+=g.length,b}case 1:{const _={t:q.INSERT,body:Mt(n,c,c+g.length),len:g.length};return c+=g.length,_}default:return{t:q.DELETE,len:g.length}}});if(u.every(f=>f.t===q.RETAIN&&!f.body))return!1;const h=new De;return h.push({t:q.RETAIN,len:t.startOffset}),h.push(...u),h};function qC(e,t){const n=[],{customBlocks:r=[]}=e;for(const s of t){const{startOffset:i,endOffset:o}=s;if(!(i==null||o==null))for(const a of r){const{startIndex:l}=a;l>=i&&l<o&&n.push(a.blockId)}}return n}function JC(e,t=""){if(!t)return["body"];const{headers:n,footers:r}=e.getSnapshot();if(n==null&&r==null)throw new Error("Document data model must have headers or footers when update by segment id");if((n==null?void 0:n[t])!=null)return["headers",t,"body"];if((r==null?void 0:r[t])!=null)return["footers",t,"body"];throw new Error("Segment id not found in headers or footers")}const ZC=e=>{var _,R,b,F;const{selection:t,documentDataModel:n,drawings:r}=e,{collapsed:s,startOffset:i,segmentId:o}=t,a=new De,l=Gt.getInstance(),c=[],u=n.getSelfOrHeaderFooterModel(o).getBody();if(!u)return!1;const h=(R=(_=n.getSnapshot().drawingsOrder)==null?void 0:_.length)!=null?R:0;let d=0;if(s)i>0&&a.push({t:q.RETAIN,len:i});else{const k=kh([t],u,0,null,!1);a.push(...k);const W=qC(u,[t]),S=(b=n.getDrawings())!=null?b:{},C=(F=n.getDrawingsOrder())!=null?F:[],v=W.sort((A,H)=>C.indexOf(A)>C.indexOf(H)?-1:C.indexOf(A)<C.indexOf(H)?1:0);if(v.length>0)for(const A of v){const H=S[A],B=C.indexOf(A);if(H==null||B<0)continue;const m=l.removeOp(["drawings",A],H),x=l.removeOp(["drawingsOrder",B],A);c.push(m),c.push(x),d++}}a.push({t:q.INSERT,body:{dataStream:"\b".repeat(r.length),customBlocks:r.map((k,W)=>({startIndex:W,blockId:k.drawingId}))},len:r.length});const f=JC(n,o),g=l.editOp(a.serialize(),f);c.push(g);for(const k of r){const{drawingId:W}=k,S=l.insertOp(["drawings",W],k),C=l.insertOp(["drawingsOrder",h-d],W);c.push(S),c.push(C)}return c.reduce((k,W)=>Gt.compose(k,W),null)};function QC(e,t){if(typeof t>"u")return{startOffset:e,endOffset:e,collapsed:!0};if(t<e)throw new Error(`Cannot make a doc selection when endOffset ${t} is less than startOffset ${e}.`);return{startOffset:e,endOffset:t,collapsed:e===t}}function eR(e){const{startOffset:t,endOffset:n,collapsed:r}=e,s=Math.min(t,n),i=Math.max(t,n);return{startOffset:s,endOffset:i,collapsed:r}}function tR(e,t,n,r){return Math.max(e,n)<=Math.min(t,r)}function no(e,t,n,r){const{startOffset:s,endOffset:i}=e,o=r!=null?r:ma(t,n),a=[];let l=-1;for(let c=0;c<o.length;c++){const u=o[c],{startIndex:h}=u;(s>l&&s<=h||i>l&&i<=h||h>=s&&h<=i)&&a.push(u),l=h}return a}function ro(e,t,n){const r=[],s=ma(t,n);for(const i of e){const o=no(i,t,n,s);r.push(...o)}return r}const nR=[lt.PARAGRAPH,lt.TABLE_START,lt.TABLE_END,lt.TABLE_ROW_START,lt.TABLE_CELL_START,lt.TABLE_CELL_END];function ma(e,t){const n=[];for(let r=0;r<e.length;r++){const s=e[r],{startIndex:i}=s;let o=i-1;for(;!nR.includes(t[o])&&o>=0;)o--;n.push({...s,paragraphStart:o+1,paragraphEnd:s.startIndex})}return n}const rR=e=>{var h,d,f;const{paragraphs:t,segmentId:n,document:r}=e;let s=e.listType;const i=(d=(h=r.getSelfOrHeaderFooterModel(n).getBody())==null?void 0:h.paragraphs)!=null?d:[],o=t.every(g=>{var _;return((_=g.bullet)==null?void 0:_.listType.indexOf(s))===0});let l=nt(6);if(t.length===1){const g=i.indexOf(t[0]),_=i[g-1],R=i[g+1];_&&_.bullet&&_.bullet.listType.indexOf(s)===0?(l=_.bullet.listId,s!==Ft.CHECK_LIST&&(s=_.bullet.listType)):R&&R.bullet&&R.bullet.listType.indexOf(s)===0&&(l=R.bullet.listId,s!==Ft.CHECK_LIST&&(s=R.bullet.listType))}const c=new vn;c.reset();const u=new De;for(const g of t){const{startIndex:_,paragraphStyle:R={},bullet:b}=g;u.push({t:q.RETAIN,len:_-c.cursor}),u.push({t:q.RETAIN,len:1,body:{dataStream:"",paragraphs:[o?{paragraphStyle:R,startIndex:0}:{startIndex:0,paragraphStyle:{...R},bullet:{nestingLevel:(f=b==null?void 0:b.nestingLevel)!=null?f:0,textStyle:{fs:20},listType:s,listId:l}}]},coverType:Ee.REPLACE}),c.moveCursorTo(_+1)}return u},sR=e=>{var h;const{paragraphIndex:t,segmentId:n,document:r}=e,s=(h=r.getSelfOrHeaderFooterModel(n).getBody())==null?void 0:h.paragraphs;if(s==null)return!1;const i=s.find(d=>d.startIndex===t);if(!(i!=null&&i.bullet)||i.bullet.listType.indexOf(Ft.CHECK_LIST)===-1)return!1;const o=new vn;o.reset();const a=new De,{startIndex:l,paragraphStyle:c={}}=i,u=i.bullet.listType===Ft.CHECK_LIST?Ft.CHECK_LIST_CHECKED:Ft.CHECK_LIST;return a.push({t:q.RETAIN,len:l-o.cursor}),a.push({t:q.RETAIN,len:1,body:{dataStream:"",paragraphs:[{...i,paragraphStyle:c,startIndex:0,bullet:{...i.bullet,listType:u}}]},coverType:Ee.REPLACE}),o.moveCursorTo(l+1),a},iR=e=>{var u,h;const{paragraphs:t,listType:n,segmentId:r,document:s}=e;if(((u=s.getSelfOrHeaderFooterModel(r).getBody())==null?void 0:u.paragraphs)==null)return!1;const a=nt(6),l=new vn;l.reset();const c=new De;for(const d of t){const{startIndex:f,paragraphStyle:g={},bullet:_}=d;c.push({t:q.RETAIN,len:f-l.cursor}),c.push({t:q.RETAIN,len:1,body:{dataStream:"",paragraphs:[{startIndex:0,paragraphStyle:g,bullet:{nestingLevel:(h=_==null?void 0:_.nestingLevel)!=null?h:0,textStyle:(_==null?void 0:_.listType)===n?_.textStyle:{fs:20},listType:n,listId:a}}]},coverType:Ee.REPLACE}),l.moveCursorTo(f+1)}return c};function oR(e,t){return t.some(n=>e.startIndex>n.startIndex&&e.startIndex<n.endIndex)}const aR=e=>{var c,u,h;const{paragraphs:t,document:n,type:r}=e,s=new vn;s.reset();const i=new De,o=(c=n.getSnapshot().lists)!=null?c:{},a=(h=(u=n.getBody())==null?void 0:u.tables)!=null?h:[],l={...zr,...o};for(const d of t){const{startIndex:f,paragraphStyle:g={},bullet:_}=d,R=oR(d,a);if(i.push({t:q.RETAIN,len:f-s.cursor}),_){const b=_.listType;let F=l[b].nestingLevel.length-1;R&&(F=Math.min(F,2)),i.push({t:q.RETAIN,len:1,body:{dataStream:"",paragraphs:[{startIndex:0,paragraphStyle:{...g},bullet:{..._,nestingLevel:Math.max(Math.min(_.nestingLevel+r,F),0)}}]},coverType:Ee.REPLACE})}else i.push({t:q.RETAIN,len:1});s.moveCursorTo(f+1)}return i},lR=e=>{var R,b,F,k;const{textRanges:t,segmentId:n,document:r,style:s,paragraphTextRun:i,cursor:o,deleteLen:a,textX:l}=e,c=r.getSelfOrHeaderFooterModel(n),u=(b=(R=c.getBody())==null?void 0:R.paragraphs)!=null?b:[],h=(k=(F=c.getBody())==null?void 0:F.dataStream)!=null?k:"",d=ro(t,u,h),f=new vn;o&&f.moveCursorTo(o);const g=l!=null?l:new De;d.sort((W,S)=>W.startIndex-S.startIndex);const _=Math.max(0,d[0].paragraphStart-1);_>f.cursor&&(g.push({t:q.RETAIN,len:_-f.cursor}),f.moveCursorTo(_)),a&&g.push({t:q.DELETE,len:a});for(const W of d){const{startIndex:S,paragraphStyle:C={}}=W,v=S-f.cursor;g.push({t:q.RETAIN,len:v,...i?{body:{dataStream:"",textRuns:[{ts:i,st:0,ed:v}]},coverType:Ee.REPLACE}:null}),g.push({t:q.RETAIN,len:1,body:{dataStream:"",paragraphs:[{startIndex:0,paragraphStyle:{...C,...s}}]},coverType:Ee.REPLACE}),f.moveCursorTo(S+1)}return g};class et{}p(et,"customRange",{add:VC,delete:YC,copyCustomRange:HC,getCustomRangesInterestsWithSelection:FC,isIntersecting:Uh}),p(et,"customDecoration",{add:PC,delete:kC}),p(et,"selection",{replace:GC,makeSelection:QC,normalizeSelection:eR,delete:kh,replaceTextRuns:XC,retain:zC}),p(et,"range",{isIntersects:tR,getParagraphsInRange:no,getParagraphsInRanges:ro}),p(et,"transform",{getPlainText:ni,fromPlainText:xC,isEmptyDocument:LC}),p(et,"paragraph",{bullet:{set:iR,switch:rR,toggleChecklist:sR,changeNestLevel:aR},style:{set:lR},util:{transform:ma,getParagraphsInRange:no,getParagraphsInRanges:ro}}),p(et,"drawing",{add:ZC});function cR(e,t,n,r){var c;if(t==="")return e;const s={id:"mock-id",body:e,documentStyle:{}},i=new Dt(s),o=t.length;let a;for(;(a=(r?i.getBody().dataStream:i.getBody().dataStream.toLowerCase()).indexOf(t))>=0;){const u=new De,h=Gt.getInstance();if(a>0&&u.retain(a),n.length>0){const d=i.sliceBody(a,a+o),f={dataStream:n};if(Array.isArray(d==null?void 0:d.textRuns)&&d.textRuns.length&&(f.textRuns=[{...d.textRuns[0],st:0,ed:n.length}]),(c=d==null?void 0:d.customRanges)!=null&&c.length){const g=d.customRanges[0];f.customRanges=[{...g,startIndex:0,endIndex:n.length-1}]}u.insert(n.length,f)}u.delete(o),i.apply(h.editOp(u.serialize()))}const l=i.getBody();return i.dispose(),l}function uR(e){if(e.customRanges||(e.customRanges=[]),!e.paragraphs){e.paragraphs=[];for(let t=0;t<e.dataStream.length;t++)e.dataStream[t]==="\r"&&e.paragraphs.push({startIndex:t})}return e.customBlocks||(e.customBlocks=[]),e.textRuns||(e.textRuns=[]),e.customDecorations||(e.customDecorations=[]),e.sectionBreaks||(e.sectionBreaks=[]),e.tables||(e.tables=[]),e}function Fh(e){var t;return e.body=uR((t=e.body)!=null?t:{dataStream:""}),e.drawingsOrder||(e.drawingsOrder=[]),e.drawings||(e.drawings={}),e.documentStyle||(e.documentStyle={}),e}class Gr{constructor(t={}){p(this,"_style");this._style=t}static create(t={}){return new Gr(t)}get fontFamily(){return this._style.ff}get fontSize(){return this._style.fs}get italic(){return this._style.it===ie.TRUE}get bold(){return this._style.bl===ie.TRUE}get underline(){return this._style.ul&&en.create(this._style.ul)}get bottomBorderLine(){return this._style.bbl&&en.create(this._style.bbl)}get strikethrough(){return this._style.st&&en.create(this._style.st)}get overline(){return this._style.ol&&en.create(this._style.ol)}get background(){return this._style.bg}get border(){return this._style.bd}get color(){return this._style.cl}get verticalAlign(){return this._style.va}get numberFormat(){return this._style.n}copy(){return sn.create(Z.deepClone(this._style))}getValue(){return{...this._style}}}class sn extends Gr{static create(t={}){return new sn(t)}constructor(t={}){super(t)}setFontFamily(t){return this._style.ff=t,this}setFontSize(t){return this._style.fs=t,this}setItalic(t){return this._style.it=t?1:0,this}setBold(t){return this._style.bl=t?1:0,this}setUnderline(t){return this._style.ul=t.build(),this}setBottomBorderLine(t){return this._style.bbl=t.build(),this}setStrikethrough(t){return this._style.st=t.build(),this}setOverline(t){return this._style.ol=t.build(),this}setBackground(t){return this._style.bg=t,this}setBorder(t){return this._style.bd=t,this}setColor(t){return this._style.cl=t,this}setVerticalAlign(t){return this._style.va=t,this}copy(){return sn.create(Z.deepClone(this._style))}build(){return this.getValue()}}class en{constructor(t={s:1}){p(this,"_decoration");this._decoration=t}static create(t={s:1}){return new en(t)}get show(){return this._decoration.s===ie.TRUE}get followFontColor(){return this._decoration.c===ie.TRUE}get color(){return this._decoration.cl}get type(){return this._decoration.t}setShow(t){return this._decoration.s=t?1:0,this}setFollowFontColor(t){return this._decoration.c=t?1:0,this}setColor(t){return this._decoration.cl=t,this}setLineType(t){return this._decoration.t=t,this}copy(){return en.create(Z.deepClone(this._decoration))}build(){return{...this._decoration}}}class Kr{constructor(t={}){p(this,"_style");this._style=t}static create(t={}){return new Kr(t)}get indentFirstLine(){return this._style.indentFirstLine}get hanging(){return this._style.hanging}get indentStart(){return this._style.indentStart}get tabStops(){return this._style.tabStops}get indentEnd(){return this._style.indentEnd}get textStyle(){return this._style.textStyle}get headingId(){return this._style.headingId}get namedStyleType(){return this._style.namedStyleType}get horizontalAlign(){return this._style.horizontalAlign}get lineSpacing(){return this._style.lineSpacing}get direction(){return this._style.direction}get spacingRule(){return this._style.spacingRule}get snapToGrid(){return this._style.snapToGrid}get spaceAbove(){return this._style.spaceAbove}get spaceBelow(){return this._style.spaceBelow}get borderBetween(){return this._style.borderBetween}get borderTop(){return this._style.borderTop}get borderBottom(){return this._style.borderBottom}get borderLeft(){return this._style.borderLeft}get borderRight(){return this._style.borderRight}get keepLines(){return this._style.keepLines===ie.TRUE}get keepNext(){return this._style.keepNext===ie.TRUE}get wordWrap(){return this._style.wordWrap===ie.TRUE}get widowControl(){return this._style.widowControl===ie.TRUE}get shading(){return this._style.shading}get suppressHyphenation(){return this._style.suppressHyphenation===ie.TRUE}copy(){return xr.create(Z.deepClone(this._style))}getValue(){return this._style}}class xr extends Kr{static create(t={}){return new xr(t)}constructor(t={}){super(t)}setIndentFirstLine(t){return this._style.indentFirstLine=t,this}setHanging(t){return this._style.hanging=t,this}setIndentStart(t){return this._style.indentStart=t,this}setTabStops(t){return this._style.tabStops=t,this}setIndentEnd(t){return this._style.indentEnd=t,this}setTextStyle(t){return this._style.textStyle=t,this}setHeadingId(t){return this._style.headingId=t,this}setNamedStyleType(t){return this._style.namedStyleType=t,this}setHorizontalAlign(t){return this._style.horizontalAlign=t,this}setLineSpacing(t){return this._style.lineSpacing=t,this}setDirection(t){return this._style.direction=t,this}setSpacingRule(t){return this._style.spacingRule=t,this}setSnapToGrid(t){return this._style.snapToGrid=t?1:0,this}setSpaceAbove(t){return this._style.spaceAbove=t,this}setSpaceBelow(t){return this._style.spaceBelow=t,this}setBorderBetween(t){return this._style.borderBetween=t,this}setBorderTop(t){return this._style.borderTop=t,this}setBorderBottom(t){return this._style.borderBottom=t,this}setBorderLeft(t){return this._style.borderLeft=t,this}setBorderRight(t){return this._style.borderRight=t,this}setKeepLines(t){return this._style.keepLines=t?1:0,this}setKeepNext(t){return this._style.keepNext=t?1:0,this}setWordWrap(t){return this._style.wordWrap=t?1:0,this}setWidowControl(t){return this._style.widowControl=t?1:0,this}setShading(t){return this._style.shading=t,this}setSuppressHyphenation(t){return this._style.suppressHyphenation=t?1:0,this}copy(){return xr.create(Z.deepClone(this._style))}build(){return this.getValue()}}class tn{constructor(t){p(this,"_data");if(!t.body)throw new Error("Invalid document data, body is required");this._data=Fh(t)}static create(t){return new tn(t)}static createByBody(t){return new tn({body:t,id:"d",documentStyle:{}})}copy(){return Cn.create(Z.deepClone(this._data))}slice(t,n){const{body:r,...s}=this._data;return Cn.create({...Z.deepClone(s),body:Mt(r,t,n)})}toPlainText(){var t,n;return et.transform.getPlainText((n=(t=this._data.body)==null?void 0:t.dataStream)!=null?n:"").replaceAll("\r",`
|
|
7
|
+
`)}getParagraphStyle(){var t,n;return Kr.create((n=(t=this._data.body)==null?void 0:t.paragraphs)==null?void 0:n[0].paragraphStyle)}getParagraphBullet(){var t,n;return(n=(t=this._data.body)==null?void 0:t.paragraphs)==null?void 0:n[0].bullet}getParagraphs(){var r,s;const t=(s=(r=this._data.body)==null?void 0:r.paragraphs)!=null?s:[];let n=0;return t.map(i=>{const o=this.slice(n,i.startIndex);return n=i.startIndex,o})}getTextRuns(){var t,n;return((n=(t=this._data.body)==null?void 0:t.textRuns)!=null?n:[]).map(r=>({...r,ts:r.ts?Gr.create(r.ts):null}))}getLinks(){var t,n,r;return(r=(n=(t=this._data.body)==null?void 0:t.customRanges)==null?void 0:n.filter(s=>s.rangeType===on.HYPERLINK))!=null?r:[]}getData(){return this._data}}class Cn extends tn{constructor(n){super(n);p(this,"_doc");this._doc=new Dt(n)}static newEmptyData(){return Fh({id:"d",documentStyle:{},drawings:{},drawingsOrder:[],body:{dataStream:`\r
|
|
8
|
+
`,customBlocks:[],customRanges:[],paragraphs:[{startIndex:0}],textRuns:[],tables:[],sectionBreaks:[]}})}static create(n){return new Cn(n!=null?n:Cn.newEmptyData())}insertText(n,r,s){var u,h;let i=((h=(u=this._data.body)==null?void 0:u.dataStream.length)!=null?h:2)-2,o,a;if(typeof n=="string"?o=n:(i=Math.min(n,i),o=r),typeof r=="object"?a=r instanceof sn?r.build():r:a=s instanceof sn?s.build():s,!o)return this;const l={dataStream:o,textRuns:a?[{ts:a,st:i,ed:i+o.length}]:[]},c=et.selection.replace({doc:this._doc,selection:{startOffset:i,endOffset:i,collapsed:!0},body:l});if(!c)throw new Error("Insert text failed, please check.");return De.apply(this._doc.getBody(),c.serialize()),this}insertRichText(n,r){var a,l;let s=((l=(a=this._data.body)==null?void 0:a.dataStream.length)!=null?l:2)-2,i;typeof n=="object"?i=n instanceof tn?n.getData():n:(s=Math.min(n,s),i=r instanceof tn?r.getData():r);const o=et.selection.replace({doc:this._doc,selection:{startOffset:s,endOffset:s,collapsed:!0},body:i.body});if(!o)throw new Error("Insert text failed, please check.");return De.apply(this._doc.getBody(),o.serialize()),this}delete(n,r){if(r!==void 0){if(!r)return this;const s=et.selection.delete([{startOffset:n,endOffset:n+r,collapsed:!0}],this._data.body);De.apply(this._doc.getBody(),s)}return this}setStyle(n,r,s){const i={dataStream:"",textRuns:[{ts:s instanceof sn?s.build():s,st:0,ed:r-n}]},o=et.selection.retain([{startOffset:n,endOffset:r,collapsed:!0}],i);return De.apply(this._doc.getBody(),o),this}setLink(n,r,s){const i=et.customRange.add({rangeType:on.HYPERLINK,rangeId:nt(),properties:{url:s},ranges:[{startOffset:n,endOffset:r,collapsed:!1}],body:this._data.body});if(!i)throw new Error("Insert text failed, please check.");return De.apply(this._doc.getBody(),i.serialize()),this}cancelLink(n,r){if(typeof n=="string"){const s=et.customRange.delete({rangeId:n,documentDataModel:this._doc});if(!s)throw new Error("Insert text failed, please check.");De.apply(this._doc.getBody(),s.serialize())}else this.slice(n,r).getLinks().forEach(i=>{const o=et.customRange.delete({rangeId:i.rangeId,documentDataModel:this._doc});if(!o)throw new Error("Insert text failed, please check.");De.apply(this._doc.getBody(),o.serialize())});return this}updateLink(n,r){var i,o;const s=(o=(i=this._data.body)==null?void 0:i.customRanges)==null?void 0:o.find(a=>a.rangeId===n);if(!s)throw new Error("Link not found");return s.properties.url=r,this}insertParagraph(n,r){var o,a;let s,i;return typeof n=="object"?(s={dataStream:"\r",paragraphs:[{startIndex:0,paragraphStyle:n.build()}]},i=((a=(o=this._data.body)==null?void 0:o.dataStream.length)!=null?a:2)-2):(i=n,s={dataStream:"\r",paragraphs:[{startIndex:0,paragraphStyle:r==null?void 0:r.build()}]}),this.insertRichText(i,tn.create({body:s,id:"d",documentStyle:{}})),this}insertLink(n,r,s){let i="",o="";typeof n=="string"?(i=n,o=r):(i=r,o=s);const a=Cn.createByBody({dataStream:i,customRanges:[{rangeType:on.HYPERLINK,rangeId:nt(),properties:{url:o},startIndex:0,endIndex:i.length-1}]});return typeof n=="number"?this.insertRichText(n,a):this.insertRichText(a)}}const hR="__default_document_sub_component_id20231101__";class Hh{constructor(){p(this,"skipNextObservers",!1);p(this,"lastReturnValue");p(this,"isStopPropagation",!1)}stopPropagation(){this.isStopPropagation=!0}}class dR extends le.Subject{constructor(){super(...arguments);p(this,"_sortedObservers",[])}unsubscribe(){super.unsubscribe(),this._sortedObservers.length=0}complete(){super.complete(),this._sortedObservers.length=0}subscribeEvent(n){let r;typeof n=="function"?r={next:([i,o])=>n(i,o)}:r=n;const s=super.subscribe(r);return this._sortedObservers.push(r),this._sortedObservers.sort((i,o)=>{var a,l;return((a=i.priority)!=null?a:0)-((l=o.priority)!=null?l:0)}),s.add(()=>this._sortedObservers=this._sortedObservers.filter(i=>i!==r)),s}clearObservers(){this._sortedObservers.forEach(n=>{var r;return(r=n.complete)==null?void 0:r.call(n)}),this._sortedObservers.length=0}emitEvent(n){var r;if(!this.closed){const s=new Hh;s.lastReturnValue=n;for(const i of this._sortedObservers){const o=(r=i.next)==null?void 0:r.call(i,[n,s]);if(s.lastReturnValue=o,s.skipNextObservers)return{handled:!0,lastReturnValue:s.lastReturnValue,stopPropagation:s.isStopPropagation}}return{handled:this._sortedObservers.length>0,lastReturnValue:s.lastReturnValue,stopPropagation:s.isStopPropagation}}throw new Error("[EventSubject]: cannot emit event on a closed subject.")}}function fR(e){return new le.Observable(t=>{const n=e.subscribeEvent(r=>{t.next(r)});return()=>n.unsubscribe()})}const ri=ye.createIdentifier("core.resource-manager.service"),so={[Ie.Editor]:"Editor",[Ie.Owner]:"Owner",[Ie.Reader]:"Reader",[Ie.UNRECOGNIZED]:"UNRECOGNIZED"},Fs=e=>e?{userID:`${so[e]}_${nt(8)}`,name:so[e],avatar:""}:{userID:"",name:"",avatar:"",anonymous:!0,canBindAnonymous:!1},mR=(e,t)=>e.startsWith(so[t]);class Ur extends Xe{constructor(){super(...arguments);p(this,"_model",new Map);p(this,"_userChange$",new le.Subject);p(this,"userChange$",this._userChange$.asObservable());p(this,"_currentUser$",new le.BehaviorSubject(Fs()));p(this,"currentUser$",this._currentUser$.asObservable())}dispose(){super.dispose(),this._model.clear(),this._userChange$.complete(),this._currentUser$.complete()}getCurrentUser(){return this._currentUser$.getValue()}setCurrentUser(n){this.addUser(n),this._currentUser$.next(n)}addUser(n){this._model.set(n.userID,n),this._userChange$.next({type:"add",user:n})}getUser(n,r){const s=this._model.get(n);if(s)return s;r&&r()}delete(n){const r=this.getUser(n);this._model.delete(n),r&&this._userChange$.next({type:"delete",user:r})}clear(){this._model.clear(),this._userChange$.next({type:"clear"})}list(){return Array.from(this._model.values())}}var gR=Object.getOwnPropertyDescriptor,_R=(e,t,n,r)=>{for(var s=r>1?void 0:r?gR(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},wl=(e,t)=>(n,r)=>t(n,r,e);exports.AuthzIoLocalService=class{constructor(t,n){p(this,"_permissionMap",new Map([]));p(this,"_permissionOverrides",new Map);this._resourceManagerService=t,this._userManagerService=n,this._initSnapshot(),this._initDefaultUser()}_initDefaultUser(){const t=this._userManagerService.getCurrentUser();t&&t.userID||this._userManagerService.setCurrentUser(Fs(Ie.Owner))}_getRole(t){const n=this._userManagerService.getCurrentUser();return n?mR(n.userID,t):!1}_initSnapshot(){this._resourceManagerService.registerPluginResource({toJson:t=>{const n=[...this._permissionMap.keys()].reduce((r,s)=>{const i=this._permissionMap.get(s);return r[s]=i,r},{});return JSON.stringify(n)},parseJson:t=>JSON.parse(t),pluginName:"SHEET_AuthzIoMockService_PLUGIN",businesses:[we.UNIVER_SHEET,we.UNIVER_DOC,we.UNIVER_SLIDE],onLoad:(t,n)=>{for(const r in n)this._permissionMap.set(r,n[r])},onUnLoad:()=>{this._permissionMap.clear()}})}async create(t){const n=nt(8),{objectType:r,selectRangeObject:s,worksheetObject:i}=t,o=s||i,a={objectType:r,unitID:(o==null?void 0:o.unitID)||"",name:(o==null?void 0:o.name)||"",strategies:[{action:6,role:Ie.Owner},{action:16,role:Ie.Owner},{action:17,role:Ie.Owner},{action:18,role:Ie.Owner},{action:19,role:Ie.Owner},{action:33,role:Ie.Owner},{action:34,role:Ie.Owner},{action:35,role:Ie.Owner},{action:36,role:Ie.Owner},{action:37,role:Ie.Owner},{action:38,role:Ie.Owner},{action:39,role:Ie.Owner},{action:40,role:Ie.Owner}],selectRangeObject:s};return this._permissionMap.set(n,a),n}async allowed(t){const{objectID:n,actions:r}=t,s=this._permissionMap.get(n);return s?r.map(o=>{const a=`${n}:${o}`;if(this._permissionOverrides.has(a))return{action:o,allowed:this._permissionOverrides.get(a)};const l=s.strategies.find(c=>c.action===o);return l?{action:o,allowed:this._getRole(l.role)}:{action:o,allowed:this._getRole(Ie.Owner)||this._getRole(Ie.Editor)}}):r.map(a=>({action:a,allowed:this._getRole(Ie.Owner)||this._getRole(Ie.Editor)}))}async batchAllowed(t){const n=await Promise.all(t.map(s=>this.allowed(s)));return t.map((s,i)=>({unitID:s.unitID,objectID:s.objectID,actions:n[i]}))}async list(t){const n=[],r=[{action:6,role:Ie.Owner},{action:16,role:Ie.Owner},{action:17,role:Ie.Owner},{action:18,role:Ie.Owner},{action:19,role:Ie.Owner},{action:33,role:Ie.Owner},{action:34,role:Ie.Owner},{action:35,role:Ie.Owner},{action:36,role:Ie.Owner},{action:37,role:Ie.Owner},{action:38,role:Ie.Owner},{action:39,role:Ie.Owner},{action:40,role:Ie.Owner}];return t.objectIDs.forEach(s=>{const i=this._permissionMap.get(s),o=(i==null?void 0:i.strategies)||r,a={objectID:s,unitID:t.unitID,objectType:(i==null?void 0:i.objectType)||3,name:(i==null?void 0:i.name)||"",shareOn:!1,shareRole:Ie.Owner,shareScope:-1,scope:{read:ki.AllCollaborator,edit:ki.AllCollaborator},creator:Fs(Ie.Owner),strategies:o.map(l=>({action:l.action,role:l.role})),actions:t.actions.map(l=>{const c=`${s}:${l}`;if(this._permissionOverrides.has(c))return{action:l,allowed:this._permissionOverrides.get(c)};const u=o.find(h=>h.action===l);if(!u){const h=this._getRole(Ie.Owner)||this._getRole(Ie.Editor);return{action:l,allowed:h}}return{action:l,allowed:this._getRole(u.role)}})};n.push(a)}),n}async listCollaborators(){return[]}async listRoles(){return{roles:[],actions:[]}}async deleteCollaborator(){}async update(t){const{objectID:n,strategies:r}=t,s=this._permissionMap.get(n);s&&r&&(s.strategies=r.map(i=>({action:i.action,role:i.role})),this._permissionMap.set(n,s),r.forEach(i=>{i.role===Ie.Reader?this.setPermissionOverride(n,i.action,!1):(i.role===Ie.Owner||i.role===Ie.Editor)&&this.clearPermissionOverride(n,i.action)}))}setPermissionOverride(t,n,r){const s=`${t}:${n}`;this._permissionOverrides.set(s,r)}clearPermissionOverride(t,n){const r=`${t}:${n}`;this._permissionOverrides.delete(r)}clearAllOverrides(t){const n=[];this._permissionOverrides.forEach((r,s)=>{s.startsWith(`${t}:`)&&n.push(s)}),n.forEach(r=>this._permissionOverrides.delete(r))}async updateCollaborator(){}async createCollaborator(){}async putCollaborators(t){}};exports.AuthzIoLocalService=_R([wl(0,ri),wl(1,ye.Inject(Ur))],exports.AuthzIoLocalService);const Bh=ye.createIdentifier("IAuthzIoIoService"),pR=ye.createIdentifier("univer.confirm-service");class ER{constructor(){p(this,"confirmOptions$",new le.Subject)}dispose(){this.confirmOptions$.complete()}open(t){throw new Error("This is not implemented in the test service!")}confirm(t){return Promise.resolve(!0)}close(t){throw new Error("This is not implemented in the test service!")}}const Ir="FOCUSING_UNIT",jn="FOCUSING_SHEET",Sr="FOCUSING_DOC",Or="FOCUSING_SLIDE",CR="FOCUSING_EDITOR_BUT_HIDDEN",$h="EDITOR_ACTIVATED",RR="FOCUSING_EDITOR_INPUT_FORMULA",jh="FOCUSING_FX_BAR_EDITOR",IR="FOCUSING_UNIVER_EDITOR",SR="FOCUSING_EDITOR_INPUT_FORMULA",OR="FOCUSING_COMMENT_EDITOR",wR="FOCUSING_PANEL_EDITOR",vR="FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE",bR="FOCUSING_COMMON_DRAWINGS",yR="FORMULA_EDITOR_ACTIVATED";class Wh extends Xe{constructor(){super(...arguments);p(this,"_error$",new le.Subject);p(this,"error$",this._error$.asObservable())}dispose(){this._error$.complete()}emit(n){this._error$.next({errorKey:n})}}var Hs=(e=>(e.URL="URL",e.UUID="UUID",e.BASE64="BASE64",e))(Hs||{}),Yh=(e=>(e.SUCCUSS="0",e.ERROR_EXCEED_SIZE="1",e.ERROR_IMAGE_TYPE="2",e.ERROR_UPLOAD_COUNT_LIMIT="3",e.ERROR_IMAGE="4",e))(Yh||{});const io=ye.createIdentifier("core.image-io.service"),oo=ye.createIdentifier("core.url-image.service"),AR="0.15.1",TR={version:AR};function NR(e="",t=Hr.ZH_CN,n=""){return{id:e,sheetOrder:[],name:n,appVersion:TR.version,locale:t,styles:{},sheets:{},resources:[]}}class Vh{constructor(t={}){p(this,"_styles");p(this,"_cacheMap",new Lr(1e5));this._styles=t,this._generateCacheMap()}each(t){return Object.entries(this._styles).forEach(t),this}search(t,n){if(this._cacheMap.has(n))return this._cacheMap.get(n);const r=this._getExistingStyleId(t);return r||"-1"}get(t){return typeof t!="string"?t:(t=String(t),this._styles[t])}add(t,n){const r=nt(6);return this._styles[r]=t,this._cacheMap.set(n,r),r}setValue(t){if(t==null)return;const n=JSON.stringify(t),r=this.search(t,n);return r!=="-1"?r:this.add(t,n)}addCustomStyle(t,n){n!=null&&(this._styles[t]=n,this._cacheMap.set(JSON.stringify(n),t))}remove(t){const n=this._styles[t];n&&(delete this._styles[t],this._cacheMap.delete(JSON.stringify(n)))}toJSON(){return this._styles}getStyleByCell(t){let n;t&&Z.isObject(t.s)?n=t.s:n=(t==null?void 0:t.s)&&this.get(t.s);const r=t==null?void 0:t.interceptorStyle;return r?{...n,...r}:n}_generateCacheMap(){const{_styles:t,_cacheMap:n}=this;for(const r in t){const s=JSON.stringify(t[r]);n.set(s,r)}}_getExistingStyleId(t){const{_styles:n}=this;for(const r in n)if(Z.diffValue(n[r],t))return r;return null}}const MR=(e,t)=>t.length===e.length&&!e.some(n=>t.some(r=>!zt.equals(r,n))),DR=(e,t)=>t.length===e.length&&e.every((n,r)=>{const s=t[r];return s.unitId===n.unitId&&s.sheetId===n.sheetId&&zt.equals(n.range,s.range)}),ao={t:0,b:2,l:2,r:2},LR=e=>({sbr:.6,sbo:e,spr:.6,spo:e}),vl=90;function wr(e,t,n={}){const r=e.length,{textRotation:s,paddingData:i,horizontalAlign:o=Nt.UNSPECIFIED,verticalAlign:a=pn.UNSPECIFIED,wrapStrategy:l=Sn.UNSPECIFIED,cellValueType:c}=n,{t:u,r:h,b:d,l:f}=i||ao,{vertexAngle:g,centerAngle:_}=Kh(s),R={id:"d",body:{dataStream:`${e}${kl}`,textRuns:[{ts:t,st:0,ed:r}],paragraphs:[{startIndex:r,paragraphStyle:{horizontalAlign:o}}],sectionBreaks:[{startIndex:r+1}]},documentStyle:{pageSize:{width:Number.POSITIVE_INFINITY,height:Number.POSITIVE_INFINITY},marginTop:u,marginBottom:d,marginRight:h,marginLeft:f,renderConfig:{horizontalAlign:o,verticalAlign:a,centerAngle:_,vertexAngle:g,wrapStrategy:l,cellValueType:c}},drawings:{},drawingsOrder:[]};return new Dt(R)}function xR(e){if(!e)return{};const{tr:t,td:n,ht:r,vt:s,tb:i,pd:o}=e;return{textRotation:t,textDirection:n,horizontalAlign:r,verticalAlign:s,wrapStrategy:i,paddingData:o}}function bl(e){if(!e)return{};const{ff:t,fs:n,it:r,bl:s,ul:i,st:o,ol:a,cl:l,bg:c}=e,u={};return t&&(u.ff=t),n&&(u.fs=n),r&&(u.it=r),s&&(u.bl=s),i&&(u.ul=i),o&&(u.st=o),a&&(u.ol=a),l&&(u.cl=l),c&&(u.bg=c),u}function zh(e,t,n){var i;const r=e.getBody();if((i=r.customRanges)!=null&&i.some(o=>o.rangeType===on.HYPERLINK))return;const s=et.customRange.add({ranges:[{startOffset:0,endOffset:r.dataStream.length-1,collapsed:!1}],rangeId:n,rangeType:on.HYPERLINK,body:r,properties:{url:t,refId:n}});s&&De.apply(r,s.serialize())}function Gh(e){return e!=null}function UR(){return{p:null,s:null,v:null,t:null,f:null,si:null,ref:null,xf:null}}const PR='"Helvetica Neue", Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "Heiti SC", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif';function yl(e){const t=it.ff,n=it.fs;if(!e){const h=`${n}pt ${t}`;return{fontCache:h,fontString:h,fontSize:n,originFontSize:n,fontFamily:t}}let r=Fn.ITALIC;(e.it===0||e.it===void 0)&&(r=Fn.NORMAL);let s=Fn.BOLD;(e.bl===0||e.bl===void 0)&&(s=Fn.NORMAL);let i=n;e.fs&&(i=Math.ceil(e.fs));let o=t;if(e.ff){let h=e.ff;h=h.replace(/"/g,"").replace(/'/g,""),h.indexOf(" ")>-1&&(h=`"${h}"`),h==null&&(h=t),o=h}const{va:a}=e;let l=i;if(a===Vt.SUBSCRIPT||a===Vt.SUPERSCRIPT){const h=kR(o,l),{sbr:d,spr:f}=h;l*=a===Vt.SUBSCRIPT?d:f}const c=`${r} ${s} ${l}pt ${o}`,u=`${c}, ${PR} `;return{fontCache:c,fontString:u,fontSize:l,originFontSize:i,fontFamily:o}}function kR(e,t){return LR(t)}function Kh(e){const{a:t=0,v:n=ie.FALSE}=e||{a:0,v:ie.FALSE};let r=0,s=t;return n===ie.TRUE&&(r=vl,s=vl),{centerAngle:r,vertexAngle:s}}function gt(e){if(e==null||typeof e!=="object")return e;if(Array.isArray(e)){const s=e.length,i=new Array(s);for(let o=0;o<s;o++)i[o]=gt(e[o]);return i}const n={},r=Object.keys(e);for(let s=0,i=r.length;s<i;s++){const o=r[s];n[o]=gt(e[o])}return n}function Xh(e){if(e==null)return e;const t={};return e.p!==void 0&&(t.p=e.p===null?null:gt(e.p)),e.s!==void 0&&(e.s===null||typeof e.s=="string"?t.s=e.s:t.s=gt(e.s)),e.v!==void 0&&(t.v=e.v),e.t!==void 0&&(t.t=e.t),e.f!==void 0&&(t.f=e.f),e.ref!==void 0&&(t.ref=e.ref),e.xf!==void 0&&(t.xf=e.xf),e.si!==void 0&&(t.si=e.si),e.custom!==void 0&&(t.custom=e.custom===null?null:gt(e.custom)),t}function FR(e){if(e==null)return e;const t={};return e.p!==void 0&&(t.p=e.p===null?null:gt(e.p)),e.s!==void 0&&(e.s===null||typeof e.s=="string"?t.s=e.s:t.s=gt(e.s)),e.v!==void 0&&(t.v=e.v),e.t!==void 0&&(t.t=e.t),e.f!==void 0&&(t.f=e.f),e.ref!==void 0&&(t.ref=e.ref),e.xf!==void 0&&(t.xf=e.xf),e.si!==void 0&&(t.si=e.si),e.custom!==void 0&&(t.custom=e.custom===null?null:gt(e.custom)),e.rowSpan!==void 0&&(t.rowSpan=e.rowSpan),e.colSpan!==void 0&&(t.colSpan=e.colSpan),e.displayV!==void 0&&(t.displayV=e.displayV),t}function qh(e){const t={},n=Object.keys(e);for(let r=0,s=n.length;r<s;r++){const i=n[r],o=Number(i),a=e[o];if(a===void 0)continue;const l={},c=Object.keys(a);for(let u=0,h=c.length;u<h;u++){const d=c[u],f=Number(d),g=a[f];g!=null&&(l[f]=Xh(g))}t[o]=l}return t}function Al(e){const t={},n=Object.keys(e);for(let r=0,s=n.length;r<s;r++){const i=n[r],o=Number(i),a=e[o];if(a===void 0)continue;const l={};"h"in a&&a.h!==void 0&&(l.h=a.h),"ia"in a&&a.ia!==void 0&&(l.ia=a.ia),"ah"in a&&a.ah!==void 0&&(l.ah=a.ah),"hd"in a&&a.hd!==void 0&&(l.hd=a.hd),"w"in a&&a.w!==void 0&&(l.w=a.w),"s"in a&&a.s!==void 0&&(a.s===null||typeof a.s=="string"?l.s=a.s:l.s=gt(a.s)),"custom"in a&&a.custom!==void 0&&(l.custom=a.custom===null?null:gt(a.custom)),t[o]=l}return t}function HR(e){const t=e.length,n=new Array(t);for(let r=0;r<t;r++){const s=e[r];n[r]={startRow:s.startRow,startColumn:s.startColumn,endRow:s.endRow,endColumn:s.endColumn,rangeType:s.rangeType,startAbsoluteRefType:s.startAbsoluteRefType,endAbsoluteRefType:s.endAbsoluteRefType}}return n}function Jh(e){const t={id:e.id,name:e.name,tabColor:e.tabColor,hidden:e.hidden,rowCount:e.rowCount,columnCount:e.columnCount,zoomRatio:e.zoomRatio,scrollTop:e.scrollTop,scrollLeft:e.scrollLeft,defaultColumnWidth:e.defaultColumnWidth,defaultRowHeight:e.defaultRowHeight,showGridlines:e.showGridlines,rightToLeft:e.rightToLeft,freeze:{xSplit:e.freeze.xSplit,ySplit:e.freeze.ySplit,startRow:e.freeze.startRow,startColumn:e.freeze.startColumn},rowHeader:{width:e.rowHeader.width,hidden:e.rowHeader.hidden},columnHeader:{height:e.columnHeader.height,hidden:e.columnHeader.hidden},mergeData:HR(e.mergeData),cellData:qh(e.cellData),rowData:Al(e.rowData),columnData:Al(e.columnData)};return e.gridlinesColor!==void 0&&(t.gridlinesColor=e.gridlinesColor),e.defaultStyle!==void 0&&(e.defaultStyle===null||typeof e.defaultStyle=="string"?t.defaultStyle=e.defaultStyle:t.defaultStyle=gt(e.defaultStyle)),e.custom!==void 0&&(t.custom=e.custom===null?null:gt(e.custom)),t}class BR{constructor(t,n){p(this,"_columnData",{});this._config=t,this._columnData=n}getColumnData(){return this._columnData}getColVisible(t){const{_columnData:n}=this,r=n[t];return r?r.hd!==ie.TRUE:!0}getColumnStyle(t){var n;return(n=this._columnData[t])==null?void 0:n.s}setColumnStyle(t,n){const r=this.getColumnOrCreate(t);r.s=n}getHiddenCols(t=0,n=this.getSize()-1){const r=[];let s=!1,i=-1;for(let o=t;o<=n;o++){const a=this.getColVisible(o);s&&a?(s=!1,r.push({rangeType:_e.COLUMN,startColumn:i,endColumn:o-1,startRow:0,endRow:0})):!s&&!a&&(s=!0,i=o)}return s&&r.push({startRow:0,endRow:0,startColumn:i,endColumn:n,rangeType:_e.COLUMN}),r}getVisibleCols(t=0,n=this.getSize()-1){const r=[];let s=!1,i=-1;for(let o=t;o<=n;o++){const a=this.getColVisible(o);s&&!a?(s=!1,r.push({rangeType:_e.COLUMN,startColumn:i,endColumn:o-1,startRow:0,endRow:0})):!s&&a&&(s=!0,i=o)}return s&&r.push({startRow:0,endRow:0,startColumn:i,endColumn:n,rangeType:_e.COLUMN}),r}getColumnDatas(t,n){const r={};let s=0;for(let i=t;i<t+n;i++){const o=this.getColumn(i);r[s]=o!=null?o:{w:this._config.defaultColumnWidth,hd:ie.FALSE},s++}return r}getSize(){return rn(this._columnData)}getColumnWidth(t){var n,r;return(r=(n=this._columnData[t])==null?void 0:n.w)!=null?r:this._config.defaultColumnWidth}setColumnWidth(t,n){const r=this._columnData[t];n===this._config.defaultColumnWidth?r&&(delete r.w,Object.keys(r).length===0&&delete this._columnData[t]):this._columnData[t]=r?{...r,w:n}:{w:n}}getColumn(t){return this._columnData[t]}removeColumn(t){delete this._columnData[t]}getColumnOrCreate(t){const{_columnData:n}=this,r=n[t];if(r)return r;const s={};return this._columnData[t]=s,s}setCustomMetadata(t,n){const r=this.getColumn(t);r&&(r.custom=n)}getCustomMetadata(t){var n;return(n=this.getColumn(t))==null?void 0:n.custom}}const $R=2e3;class jR{constructor(t,n,r){p(this,"_rowData");this._config=t,this._viewModel=n,this._rowData=r}getRowData(){return this._rowData}getRowStyle(t){var n;return(n=this._rowData[t])==null?void 0:n.s}setRowStyle(t,n){const r=this.getRowOrCreate(t);r.s=n}getRowDatas(t,n){const r={};let s=0;for(let i=t;i<t+n;i++){const o=this.getRow(i);r[s]=o!=null?o:{h:this._config.defaultRowHeight,hd:ie.FALSE},s++}return r}getRowHeight(t,n=1){const{_rowData:r}=this,s=this._config;let i=0;for(let o=0;o<n;o++){const a=r[o+t]||{hd:ie.FALSE,h:s.defaultRowHeight},{ia:l,ah:c,h:u=s.defaultRowHeight}=a;i+=(l==null||l===ie.TRUE)&&typeof c=="number"?c:u}return i}setRowHeight(t,n){const r=this._rowData[t];if(n===this._config.defaultRowHeight)r&&(delete r.h,Object.keys(r).length===0&&delete this._rowData[t]);else{const s=Math.min(n,$R);this._rowData[t]=r?{...r,h:s}:{h:s}}}getRow(t){return this._rowData[t]}removeRow(t){delete this._rowData[t]}getRowOrCreate(t){const{_rowData:n}=this,r=n[t];if(r)return r;const s={};return n[t]=s,s}getHiddenRows(t=0,n=this.getSize()-1){const r=[];let s=!1,i=-1;for(let o=t;o<=n;o++){const a=this.getRowRawVisible(o);s&&a?(s=!1,r.push({startRow:i,endRow:o-1,startColumn:0,endColumn:0,rangeType:_e.ROW})):!s&&!a&&(s=!0,i=o)}return s&&r.push({startRow:i,endRow:n,startColumn:0,endColumn:0,rangeType:_e.ROW}),r}getVisibleRows(t=0,n=this.getSize()-1){const r=[];let s=!1,i=-1;for(let o=t;o<=n;o++){const a=this.getRowRawVisible(o);s&&!a?(s=!1,r.push({startRow:i,endRow:o-1,startColumn:0,endColumn:0,rangeType:_e.ROW})):!s&&a&&(s=!0,i=o)}return s&&r.push({startRow:i,endRow:n,startColumn:0,endColumn:0,rangeType:_e.ROW}),r}getRowRawVisible(t){const n=this.getRow(t);return n?n.hd!==ie.TRUE:!0}getSize(){return rn(this._rowData)}setCustomMetadata(t,n){const r=this.getRow(t);r&&(r.custom=n)}getCustomMetadata(t){var n;return(n=this.getRow(t))==null?void 0:n.custom}}const WR="DEFAULT_WORKSHEET_ROW_COUNT",Zh=1e3,YR="DEFAULT_WORKSHEET_COLUMN_COUNT",Qh=20,VR="DEFAULT_WORKSHEET_ROW_HEIGHT",ed=24,zR="DEFAULT_WORKSHEET_COLUMN_WIDTH",td=88,GR="DEFAULT_WORKSHEET_ROW_TITLE_WIDTH",nd=46,KR="DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT",rd=20;function sd(e){const t={name:"Sheet1",id:"sheet-01",tabColor:"",hidden:ie.FALSE,rowCount:Zh,columnCount:Qh,zoomRatio:1,freeze:{xSplit:0,ySplit:0,startRow:-1,startColumn:-1},scrollTop:0,scrollLeft:0,defaultColumnWidth:td,defaultRowHeight:ed,mergeData:[],cellData:{},rowData:{},columnData:{},showGridlines:ie.TRUE,rowHeader:{width:nd,hidden:ie.FALSE},columnHeader:{height:rd,hidden:ie.FALSE},rightToLeft:ie.FALSE};return Object.keys(t).forEach(n=>{const r=n;typeof e[r]>"u"&&(e[r]=t[r])}),e}class XR extends Xe{constructor(n){super();p(this,"_cellCache",new Map);p(this,"_rowCache",new Map);p(this,"_columnCache",new Map);p(this,"_hasRow",!1);p(this,"_hasColumn",!1);p(this,"_hasAll",!1);p(this,"_allIndex",-1);p(this,"_mergeData");p(this,"_rangeMap",new Lr(5e4));p(this,"_skeletonCache",new Lr(5e4));this._init(n.concat())}_init(n){this._mergeData=n,this._createCache(n)}_clearCache(){this._cellCache.clear(),this._rowCache.clear(),this._columnCache.clear(),this._hasAll=!1,this._allIndex=-1,this._rangeMap.clear(),this._skeletonCache.clear(),this._hasColumn=!1,this._hasRow=!1}_createCache(n){let r=0;for(const s of n){const{rangeType:i}=s;i===_e.ROW?this._createRowCache(s,r):i===_e.COLUMN?this._createColumnCache(s,r):i===_e.ALL?this._createCellAllCache(r):this._createCellCache(s,r),r++}}rebuild(n){this._clearCache(),this._init(n.concat())}_createRowCache(n,r){const{startRow:s,endRow:i}=n;for(let o=s;o<=i;o++)this._rowCache.set(o,r),this._hasRow=!0}_createColumnCache(n,r){const{startColumn:s,endColumn:i}=n;for(let o=s;o<=i;o++)this._columnCache.set(o,r),this._hasColumn=!0}_createCellAllCache(n){this._hasAll=!0,this._allIndex=n}_createCellCache(n,r){for(let s=n.startRow;s<=n.endRow;s++){let i=this._cellCache.get(s);i==null&&(i=new Map,this._cellCache.set(s,i));for(let o=n.startColumn;o<=n.endColumn;o++)i.set(o,r)}}add(n){this._mergeData.push(n),this._clearCache(),this._createCache(this._mergeData)}remove(n,r){const s=this._getMergeDataIndex(n,r);s!==-1&&(this._mergeData.splice(s,1),this._clearCache(),this._createCache(this._mergeData))}getMergedCell(n,r){const s=this._getMergeDataIndex(n,r);return s!==-1?this._mergeData[s]:null}getMergeDataIndex(n,r){return this._getMergeDataIndex(n,r)}isRowContainsMergedCell(n){return this._hasAll||!Z.isEmptyObject(this._columnCache)?!0:this._mergeData.some(r=>r.startRow<=n&&n<=r.endRow)}isColumnContainsMergedCell(n){return this._hasAll||!Z.isEmptyObject(this._rowCache)?!0:this._mergeData.some(r=>r.startColumn<=n&&n<=r.endColumn)}getMergedCellRange(n,r,s,i){const o=[],a=`${n}-${r}-${s}-${i}`;if(this._rangeMap.has(a))return this._getRangeFromCache(a);let l=0;const c=[];for(const u of this._mergeData||[])zt.intersects(u,{startRow:n,endRow:s,startColumn:r,endColumn:i})&&(o.push({...u}),c.push(l)),l++;return this._rangeMap.set(a,c),o}getMergedCellRangeForSkeleton(n,r,s,i){const o=[],a=this._mergeData,l=`${n}-${r}-${s}-${i}`;if(this._skeletonCache.has(l))return this._getSkeletonRangeFromCache(l);const c=[];for(let u=0;u<a.length;u++){const{startRow:h,endRow:d,startColumn:f,endColumn:g}=a[u];for(let _=n;_<=s;_++){let R=!1;for(let b=r;b<=i;b++)if(_>=h&&_<=d&&b>=f&&b<=g){o.push({startRow:h,endRow:d,startColumn:f,endColumn:g}),c.push(u),R=!0;break}if(R)break}}return this._skeletonCache.set(l,c),o}_getRangeFromCache(n){const r=this._rangeMap.get(n)||[],s=[];for(const i of r)s.push({...this._mergeData[i]});return s}_getSkeletonRangeFromCache(n){const r=this._skeletonCache.get(n)||[],s=[];for(const i of r)s.push({...this._mergeData[i]});return s}_getMergeDataIndex(n,r){var i;if(this._hasAll)return this._allIndex;if(this._hasRow){const o=this._rowCache.get(n);if(o!==void 0)return o}if(this._hasColumn){const o=this._columnCache.get(r);if(o!==void 0)return o}const s=(i=this._cellCache.get(n))==null?void 0:i.get(r);return s!==void 0?s:-1}getMergeDataSnapshot(){return this._mergeData}dispose(){this._clearCache(),this._mergeData=[]}}class id extends Xe{constructor(n){super();p(this,"_cellContentInterceptor",null);p(this,"_rowFilteredInterceptor",null);this.getRawCell=n}dispose(){super.dispose(),this._cellContentInterceptor=null,this._rowFilteredInterceptor=null}getCell(n,r,s,i){return this._cellContentInterceptor?this._cellContentInterceptor.getCell(n,r,kn.Value|kn.Style,s,i):this.getRawCell(n,r)}getCellValueOnly(n,r){return this._cellContentInterceptor?this._cellContentInterceptor.getCell(n,r,kn.Value):this.getRawCell(n,r)}getCellStyleOnly(n,r){return this._cellContentInterceptor?this._cellContentInterceptor.getCell(n,r,kn.Style):this.getRawCell(n,r)}getRowFiltered(n){var r,s;return(s=(r=this._rowFilteredInterceptor)==null?void 0:r.getRowFiltered(n))!=null?s:!1}registerCellContentInterceptor(n){if(this._cellContentInterceptor)throw new Error("[SheetViewModel]: Interceptor already registered.");return this._cellContentInterceptor=n,Ye(()=>this._cellContentInterceptor=null)}registerRowFilteredInterceptor(n){if(this._rowFilteredInterceptor)throw new Error("[SheetViewModel]: Interceptor already registered.");return this._rowFilteredInterceptor=n,Ye(()=>this._rowFilteredInterceptor=null)}}const Tl={isDeepClone:!1,displayRawFormula:!1,ignoreTextRotation:!1};class Pr{constructor(t,n,r){p(this,"_sheetId");p(this,"_snapshot");p(this,"_cellData");p(this,"_rowManager");p(this,"_columnManager");p(this,"_viewModel");p(this,"_spanModel");p(this,"_isRowStylePrecedeColumnStyle",!0);p(this,"_getCellHeight");var a;this.unitId=t,this._styles=r,this._snapshot=sd(n);const{columnData:s,rowData:i,cellData:o}=this._snapshot;this._sheetId=(a=this._snapshot.id)!=null?a:nt(6),this._cellData=new ct(o),this._viewModel=new id((l,c)=>this.getCellRaw(l,c)),this._rowManager=new jR(this._snapshot,this._viewModel,i),this._columnManager=new BR(this._snapshot,s),this._spanModel=new XR(this._snapshot.mergeData)}__interceptViewModel(t){t(this._viewModel)}__registerGetCellHeight(t){return this._getCellHeight=t,Ye(()=>{this._getCellHeight=null})}getSnapshot(){return this._snapshot}getCellHeight(t,n){return this._getCellHeight?this._getCellHeight(t,n):this._snapshot.defaultRowHeight}setMergeData(t){this._snapshot.mergeData=t,this.getSpanModel().rebuild(t)}getSpanModel(){return this._spanModel}setIsRowStylePrecedeColumnStyle(t){this._isRowStylePrecedeColumnStyle=t}getStyleDataByHash(t){return{...this._styles.get(t)}}setStyleData(t){return this._styles.setValue(t)}getColumnStyle(t,n=!1){return n?this._columnManager.getColumnStyle(t):this._styles.get(this._columnManager.getColumnStyle(t))}setColumnStyle(t,n){this._columnManager.setColumnStyle(t,n)}getRowStyle(t,n=!1){return n?this._rowManager.getRowStyle(t):this._styles.get(this._rowManager.getRowStyle(t))}setRowStyle(t,n){this._rowManager.setRowStyle(t,n)}getDefaultCellStyle(){return this._snapshot.defaultStyle}getDefaultCellStyleInternal(){const t=this._snapshot.defaultStyle;return this._styles.get(t)}setDefaultCellStyle(t){this._snapshot.defaultStyle=t}getCellStyle(t,n){const r=this.getCell(t,n);if(r){const s=r.s;return typeof s=="string"?this._styles.get(s):s}return null}getComposedCellStyle(t,n,r){const s=this.getDefaultCellStyleInternal(),i=this.getRowStyle(t),o=this.getColumnStyle(n),a=this.getCell(t,n),l=this._styles.getStyleByCell(a);return(r!=null?r:this._isRowStylePrecedeColumnStyle)?cr(s,o,i,a==null?void 0:a.themeStyle,l):cr(s,i,o,a==null?void 0:a.themeStyle,l)}getComposedCellStyleByCellData(t,n,r,s){const i=this.getDefaultCellStyleInternal(),o=this.getRowStyle(t),a=this.getColumnStyle(n),l=this._styles.getStyleByCell(r);return(s!=null?s:this._isRowStylePrecedeColumnStyle)?cr(i,a,o,r==null?void 0:r.themeStyle,l):cr(i,o,a,r==null?void 0:r.themeStyle,l)}getComposedCellStyleWithoutSelf(t,n,r,s){const i=r===void 0?this.getComposedCellStyle(t,n,s):this.getComposedCellStyleByCellData(t,n,r,s),o=this.getCellRaw(t,n);if(!o||!o.s)return i;const a=typeof o.s=="string"?this._styles.get(o.s):o.s;if(!a)return i;for(const l in a)l in i&&delete i[l];return i}getCellMatrix(){return this._cellData}getCellMatrixPrintRange(){const t=this.getCellMatrix(),n=this.getMergeData();let r=-1,s=-1,i=-1,o=-1,a=!1,l=!1;return t.forEach((c,u)=>{Object.keys(u).forEach(h=>{const d=+h,f=t.getValue(c,d),g=f!=null&&f.s?this._styles.get(f.s):null,_=(g==null?void 0:g.bd)&&(g.bd.b||g.bd.l||g.bd.r||g.bd.t||g.bd.bc_tr||g.bd.bl_tr||g.bd.ml_tr||g.bd.tl_bc||g.bd.tl_br||g.bd.tl_mr);(f&&(f.v!==null&&f.v!==void 0&&f.v!==""||f.p)||g!=null&&g.bg||_)&&(a?r=Math.min(r,c):(r=c,a=!0),s=Math.max(s,c),l?i=Math.min(i,d):(l=!0,i=d),o=Math.max(o,d))})}),n.forEach(c=>{a?r=Math.min(r,c.startRow):(r=c.startRow,a=!0),s=Math.max(s,c.endRow),l?i=Math.min(i,c.startColumn):(i=c.startColumn,a=!0),o=Math.max(o,c.endColumn)}),!a||!l?null:{startColumn:i,startRow:r,endColumn:o,endRow:s}}getRowManager(){return this._rowManager}getUnitId(){return this.unitId}getSheetId(){return this._sheetId}getColumnManager(){return this._columnManager}getName(){return this._snapshot.name}clone(){const{_snapshot:t}=this,n=Jh(t);return new Pr(this.unitId,n,this._styles)}getMergeData(){return this._spanModel.getMergeDataSnapshot()}getMergedCell(t,n){return this._spanModel.getMergedCell(t,n)}getMergedCellRange(t,n,r,s){return this._spanModel.getMergedCellRange(t,n,r,s)}isRowContainsMergedCell(t){return this._spanModel.isRowContainsMergedCell(t)}isColumnContainsMergedCell(t){return this._spanModel.isColumnContainsMergedCell(t)}getCellInfoInMergeData(t,n){const r=this.getMergedCell(t,n);let s=!1,i=!1,o=t,a=n,l=t,c=n;if(r){const{startRow:u,endRow:h,startColumn:d,endColumn:f}=r;t===u&&n===d?(o=h,a=f,l=u,c=d,i=!0):t>=u&&t<=h&&n>=d&&n<=f&&(o=h,a=f,l=u,c=d,s=!0)}return{actualRow:t,actualColumn:n,isMergedMainCell:i,isMerged:s,endRow:o,endColumn:a,startRow:l,startColumn:c}}getCell(t,n){return t<0||n<0?null:this._viewModel.getCell(t,n)}getCellValueOnly(t,n){return t<0||n<0?null:this._viewModel.getCellValueOnly(t,n)}getCellStyleOnly(t,n){return t<0||n<0?null:this._viewModel.getCellStyleOnly(t,n)}getCellRaw(t,n){return this.getCellMatrix().getValue(t,n)}getCellWithFilteredInterceptors(t,n,r,s){return this._viewModel.getCell(t,n,r,s)}getRowFiltered(t){return this._viewModel.getRowFiltered(t)}getRangeFilterRows(t){const n=[];for(let r=t.startRow;r<=t.endRow;r++)this.getRowFiltered(r)&&n.push(r);return n}getMatrixWithMergedCells(t,n,r,s,i=Hn.Raw){const o=this.getCellMatrix(),a=this._spanModel.getMergedCellRange(t,n,r,s),l=new ct;return Zi(t,r,n,s).forEach((c,u)=>{var d;let h;if(i===Hn.Raw)h=this.getCellRaw(c,u);else if(i===Hn.Intercepted)h=this.getCell(c,u);else if(i===Hn.Both){const f=this.getCellRaw(c,u);if(f){h={...f};const g=(d=this.getCell(c,u))==null?void 0:d.v;Gh(g)&&h&&(h.displayV=String(g))}}h&&l.setValue(c,u,h)}),a.forEach(c=>{const{startColumn:u,startRow:h,endColumn:d,endRow:f}=c;Zi(h,f,u,d).forEach((g,_)=>{g===h&&_===u&&l.setValue(g,_,{...o.getValue(g,_),rowSpan:f-h+1,colSpan:d-u+1}),(g!==h||_!==u)&&l.realDeleteValue(g,_)})}),l}getRange(t,n,r,s){return typeof t=="object"?new Xn(this,t,{getStyles:()=>this._styles}):new Xn(this,{startRow:t,startColumn:n,endColumn:s||n,endRow:r||t},{getStyles:()=>this._styles})}getScrollLeftTopFromSnapshot(){return{scrollLeft:this._snapshot.scrollLeft,scrollTop:this._snapshot.scrollTop}}getZoomRatio(){return this._snapshot.zoomRatio||1}getConfig(){return this._snapshot}getFreeze(){return this._snapshot.freeze}getMaxColumns(){const{_snapshot:t}=this,{columnCount:n}=t;return n}getMaxRows(){const{_snapshot:t}=this,{rowCount:n}=t;return n}getRowCount(){return this._snapshot.rowCount}setRowCount(t){this._snapshot.rowCount=t}getColumnCount(){return this._snapshot.columnCount}setColumnCount(t){this._snapshot.columnCount=t}isSheetHidden(){return this._snapshot.hidden}hasHiddenGridlines(){const{_snapshot:t}=this,{showGridlines:n}=t;return n===0}getGridlinesColor(){return this.getConfig().gridlinesColor}getTabColor(){const{_snapshot:t}=this,{tabColor:n}=t;return n}getColumnWidth(t){return this.getColumnManager().getColumnWidth(t)}getRowHeight(t){return this._viewModel.getRowFiltered(t)?0:this.getRowManager().getRowHeight(t)}isRowFiltered(t){return this._viewModel.getRowFiltered(t)}getRowVisible(t){return!this.isRowFiltered(t)&&this.getRowRawVisible(t)}getRowRawVisible(t){return this.getRowManager().getRowRawVisible(t)}getHiddenRows(t,n){const r=this.getMaxColumns()-1,s=this._rowManager.getHiddenRows(t,n);return s.forEach(i=>i.endColumn=r),s}getColVisible(t){return this._columnManager.getColVisible(t)}getHiddenCols(t,n){const r=this.getMaxRows()-1,s=this._columnManager.getHiddenCols(t,n);return s.forEach(i=>i.endRow=r),s}getVisibleRows(){const t=this.getRowCount();return this._rowManager.getVisibleRows(0,t-1)}getVisibleCols(){const t=this.getColumnCount();return this._columnManager.getVisibleCols(0,t-1)}isRightToLeft(){const{_snapshot:t}=this,{rightToLeft:n}=t;return n}getLastRowWithContent(){return this._cellData.getRealRowRange().endRow}getLastColumnWithContent(){return this.getDataRealRange().endColumn}getDataRealRange(){return this._cellData.getRealRange()}getDataRangeScope(){return this._cellData.getStartEndScope()}cellHasValue(t){return t&&(t.v!==void 0||t.f!==void 0||t.p!==void 0)}iterateByRow(t,n=!0){const{startRow:r,startColumn:s,endRow:i,endColumn:o}=t,a=this;return{[Symbol.iterator]:()=>{let l=r,c=s;return{next(){for(;;){if(c>o&&(l+=1,c=s),l>i)return{done:!0,value:void 0};const u=a.getCell(l,c),h=!u,d=a.getMergedCell(l,c);if(d){if(l!==d.startRow||c!==d.startColumn){c=d.endColumn+1;continue}if(h&&n){c=d.endColumn+1;continue}const g={row:l,col:c,value:u};return g.colSpan=d.endColumn-d.startColumn+1,g.rowSpan=d.endRow-d.startRow+1,c=d.endColumn+1,{done:!1,value:g}}if(h&&n)c+=1;else{const f={row:l,col:c,value:u};return c+=1,{done:!1,value:f}}}}}}}}iterateByColumn(t,n=!0,r=!0){const{startRow:s,startColumn:i,endRow:o,endColumn:a}=t,l=this;return{[Symbol.iterator]:()=>{let c=s,u=i;return{next(){for(;;){if(c>o&&(u+=1,c=s),u>a)return{done:!0,value:void 0};const h=l.getMergedCell(c,u);if(h){const g=c!==h.startRow,_=g||u!==h.startColumn;if(r&&_||!r&&g){c=h.endRow+1;continue}const R=l.getCell(h.startRow,h.startColumn);if(!R&&n){c=h.endRow+1;continue}const F={row:c,col:h.startColumn,value:R};return F.colSpan=h.endColumn-h.startColumn+1,F.rowSpan=h.endRow-h.startRow+1,c=h.endRow+1,{done:!1,value:F}}const d=l.getCell(c,u);if(!d&&n)c+=1;else{const g={row:c,col:u,value:d};return c+=1,{done:!1,value:g}}}}}}}}getCellDocumentModel(t,n,r=Tl){var _;if(!t)return;const{isDeepClone:s,displayRawFormula:i,ignoreTextRotation:o}={...Tl,...r};let a,l="document";const c=xR(n),u=o?it.tr:c.textRotation||it.tr;let h=c.horizontalAlign||it.ht;const d=c.verticalAlign||it.vt,f=c.wrapStrategy||it.tb,g=c.paddingData||ao;if(t.f&&i)a=wr(t.f.toString(),{},{verticalAlign:d}),h=it.ht;else if(t.p){const{centerAngle:R,vertexAngle:b}=Kh(u);a=this._updateConfigAndGetDocumentModel(s?Z.deepClone(t.p):t.p,h,g,{horizontalAlign:h,verticalAlign:d,centerAngle:R,vertexAngle:b,wrapStrategy:f,zeroWidthParagraphBreak:1})}else if(t.v!=null){const R=bl(n);l=yl(R).fontCache;let b=od(t);t.t===nn.FORCE_STRING&&i&&(b=`'${b}`),a=wr(b,R,{...c,textRotation:u,cellValueType:t.t})}return a&&t.linkUrl&&t.linkId&&zh(a,t.linkUrl,t.linkId),{documentModel:a,fontString:l,textRotation:u,wrapStrategy:f,verticalAlign:d,horizontalAlign:h,paddingData:g,fill:(_=n==null?void 0:n.bg)==null?void 0:_.rgb}}_updateConfigAndGetDocumentModel(t,n,r,s){var o,a,l,c,u;if(!s||!((o=t.body)!=null&&o.dataStream))return;t.documentStyle||(t.documentStyle={}),t.documentStyle.marginTop=(a=r.t)!=null?a:0,t.documentStyle.marginBottom=(l=r.b)!=null?l:2,t.documentStyle.marginLeft=(c=r.l)!=null?c:2,t.documentStyle.marginRight=(u=r.r)!=null?u:2,t.documentStyle.pageSize={width:Number.POSITIVE_INFINITY,height:Number.POSITIVE_INFINITY},t.documentStyle.renderConfig={...t.documentStyle.renderConfig,...s};const i=t.body.paragraphs||[];for(const h of i)h.paragraphStyle||(h.paragraphStyle={}),h.paragraphStyle.horizontalAlign=n;return new Dt(t)}getBlankCellDocumentModel(t,n,r){const s=this.getComposedCellStyleByCellData(n,r,t),i=bl(s),o=this.getCellDocumentModel(t,s,{ignoreTextRotation:!0});if(o!=null)return o.documentModel==null&&(o.documentModel=wr("",i)),o;const a="";let l="document";const c=it.tr,u=it.ht,h=it.vt,d=it.tb,f=ao;return l=yl({}).fontCache,{documentModel:wr(a,i),fontString:l,textRotation:c,wrapStrategy:d,verticalAlign:h,horizontalAlign:u,paddingData:f}}getCellDocumentModelWithFormula(t,n,r){const s=this.getComposedCellStyleByCellData(n,r,t);return this.getCellDocumentModel(t,s,{isDeepClone:!0,displayRawFormula:!0,ignoreTextRotation:!0})}getCustomMetadata(){return this._snapshot.custom}setCustomMetadata(t){this._snapshot.custom=t}}function od(e){var r,s;if(!e)return"";const t=(s=(r=e.p)==null?void 0:r.body)==null?void 0:s.dataStream;if(t)return et.transform.getPlainText(t);const n=e.v;return typeof n=="string"?e.t===nn.BOOLEAN?n.toUpperCase():n.replace(/[\r\n]/g,""):typeof n=="number"?e.t===nn.BOOLEAN?n?"TRUE":"FALSE":n.toString():typeof n=="boolean"?n?"TRUE":"FALSE":""}function qR(e){if(e===null)return"";if(e!=null&&e.p){const t=e==null?void 0:e.p.body;if(t==null)return"";const n=t.dataStream;return et.transform.getPlainText(n)}return e==null?void 0:e.v}var JR=Object.getOwnPropertyDescriptor,ZR=(e,t,n,r)=>{for(var s=r>1?void 0:r?JR(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},QR=(e,t)=>(n,r)=>t(n,r,e);function eI(e,t){return`${e.getUnitId()}|${t.getSheetId()}`}exports.Workbook=class extends Gs{constructor(n={},r){super();p(this,"type",we.UNIVER_SHEET);p(this,"_sheetCreated$",new le.Subject);p(this,"sheetCreated$",this._sheetCreated$.asObservable());p(this,"_sheetDisposed$",new le.Subject);p(this,"sheetDisposed$",this._sheetDisposed$.asObservable());p(this,"_activeSheet$",new le.BehaviorSubject(null));p(this,"activeSheet$",this._activeSheet$.asObservable());p(this,"_worksheets");p(this,"_styles");p(this,"_snapshot");p(this,"_unitId");p(this,"_count");p(this,"_name$");p(this,"name$");this._logService=r;const s=NR();Z.isEmptyObject(n)?this._snapshot=s:this._snapshot=Z.commonExtend(s,n);const{styles:i}=this._snapshot;(this._snapshot.id==null||this._snapshot.id.length===0)&&(this._snapshot.id=nt(6)),this._unitId=this._snapshot.id,this._styles=new Vh(i),this._count=1,this._worksheets=new Map,this._name$=new le.BehaviorSubject(n.name||""),this.name$=this._name$.asObservable(),this._parseWorksheetSnapshots()}get _activeSheet(){return this._activeSheet$.getValue()}get name(){return this._name$.getValue()}static isIRangeType(n){return typeof n=="string"||"startRow"in n||"row"in n}dispose(){super.dispose(),this._sheetCreated$.complete(),this._sheetDisposed$.complete(),this._activeSheet$.complete(),this._name$.complete(),Array.from(this._worksheets.keys()).forEach(r=>{this._removeSheet(r)})}save(){return Z.deepClone(this._snapshot)}getSnapshot(){return this._snapshot}getName(){return this._snapshot.name}setName(n){this._name$.next(n),this._snapshot.name=n}getUnitId(){return this._unitId}getRev(){var n;return(n=this._snapshot.rev)!=null?n:1}incrementRev(){this._snapshot.rev=this.getRev()+1}setRev(n){this._snapshot.rev=n}addWorksheet(n,r,s){const{sheets:i,sheetOrder:o}=this._snapshot;if(i[n])return!1;i[n]=s,o.splice(r,0,n),this.ensureSheetOrderUnique();const a=new Pr(this._unitId,s,this._styles);return this._worksheets.set(n,a),this._sheetCreated$.next(a),!0}getSheetOrders(){return this._snapshot.sheetOrder}ensureSheetOrderUnique(){const n=new Set,r=[];for(const s of this._snapshot.sheetOrder)n.has(s)||(n.add(s),r.push(s));this._snapshot.sheetOrder=r,n.clear()}getWorksheets(){return this._worksheets}getActiveSpreadsheet(){return this}getStyles(){return this._styles}addStyles(n){Object.entries(n).forEach(([r,s])=>{this._styles.addCustomStyle(r,s)})}removeStyles(n){n.forEach(r=>{this._styles.remove(r)})}getConfig(){return this._snapshot}getIndexBySheetId(n){const{sheetOrder:r}=this._snapshot;return r.findIndex(s=>s===n)}getActiveSheet(n){if(!this._activeSheet&&typeof n>"u")throw new Error(`[Workbook]: no active Worksheet on Workbook ${this._unitId}!`);return this._activeSheet}ensureActiveSheet(){const n=this._activeSheet;if(n)return n;const r=this._snapshot.sheetOrder;for(let i=0,o=r.length;i<o;i++){const a=this._worksheets.get(r[i]);if(a&&a.isSheetHidden()!==ie.TRUE)return this.setActiveSheet(a),a}const s=this._worksheets.get(r[0]);return this.setActiveSheet(s),s}setActiveSheet(n){this._activeSheet$.next(n)}_removeSheet(n){const r=this._worksheets.get(n);return r?(this._worksheets.delete(n),this._snapshot.sheetOrder.splice(this._snapshot.sheetOrder.indexOf(n),1),this.ensureSheetOrderUnique(),this._sheetDisposed$.next(r),!0):!1}removeSheet(n){const r=this._removeSheet(n);return r&&delete this._snapshot.sheets[n],r}getActiveSheetIndex(){const{sheetOrder:n}=this._snapshot;return n.findIndex(r=>this._worksheets.get(r)===this._activeSheet)}getSheetSize(){return this._snapshot.sheetOrder.length}getSheets(){const{sheetOrder:n}=this._snapshot;return n.map(r=>this._worksheets.get(r))}getSheetsName(){const{sheetOrder:n}=this._snapshot,r=[];return n.forEach(s=>{const i=this._worksheets.get(s);i&&r.push(i.getName())}),r}getSheetIndex(n){const{sheetOrder:r}=this._snapshot;return r.findIndex(s=>n.getSheetId()===s)}getSheetBySheetName(n){const{sheetOrder:r}=this._snapshot,s=r.find(i=>this._worksheets.get(i).getName()===n);return this._worksheets.get(s)}getSheetBySheetId(n){return this._worksheets.get(n)}getSheetByIndex(n){const{sheetOrder:r}=this._snapshot;return this._worksheets.get(r[n])}getHiddenWorksheets(){return this.getSheets().filter(n=>n.getConfig().hidden===ie.TRUE).map(n=>n.getConfig().id)}getUnhiddenWorksheets(){return this.getSheets().filter(n=>n.getConfig().hidden!==ie.TRUE).map(n=>n.getConfig().id)}load(n){this._snapshot=n}checkSheetName(n){return this.getSheetsName().some(s=>s.toLowerCase()===n.toLowerCase())}uniqueSheetName(n="Sheet1"){let r=n;for(;this.checkSheetName(r);)r=n+this._count,this._count++;return r}generateNewSheetName(n){let r=n+this._count;for(;this.checkSheetName(r);)r=n+this._count,this._count++;return r}_parseWorksheetSnapshots(){const{_snapshot:n,_worksheets:r}=this,{sheets:s,sheetOrder:i}=n;if(Z.isEmptyObject(s)){const o=nt();s[o]={id:o}}for(const o in s){const a=s[o],{name:l}=a;a.name=this.uniqueSheetName(l),a.name!==l&&this._logService.debug("[Workbook]",`The worksheet name ${l} is duplicated, we changed it to ${a.name}. Please fix the problem in your snapshot.`);const c=new Pr(this._unitId,a,this._styles);r.set(o,c),i.includes(o)||i.push(o)}this.ensureSheetOrderUnique(),this.ensureActiveSheet()}getCustomMetadata(){return this._snapshot.custom}setCustomMetadata(n){this._snapshot.custom=n}};exports.Workbook=ZR([QR(1,mt)],exports.Workbook);class ga extends Gs{constructor(n){var r;super();p(this,"type",we.UNIVER_SLIDE);p(this,"_activePage$",new le.BehaviorSubject(null));p(this,"activePage$",this._activePage$.asObservable());p(this,"_name$");p(this,"name$");p(this,"_snapshot");p(this,"_unitId");this._snapshot={...ah,...n},this._unitId=(r=this._snapshot.id)!=null?r:nt(6),this._name$=new le.BehaviorSubject(this._snapshot.title),this.name$=this._name$.asObservable()}get _activePage(){var r,s;const n=this._activePage$.getValue();if(!n){const i=(r=this.getPageOrder())==null?void 0:r[0];return i?(s=this.getPages())==null?void 0:s[i]:null}return n}setName(n){var r;this._snapshot.title=n,this._name$.next(n),this._unitId=(r=this._snapshot.id)!=null?r:nt(6)}getRev(){return 0}incrementRev(){}setRev(n){}getSnapshot(){return this._snapshot}getUnitId(){return this._unitId}getPages(){var n;return(n=this._snapshot.body)==null?void 0:n.pages}getPageOrder(){var n;return(n=this._snapshot.body)==null?void 0:n.pageOrder}getPage(n){const r=this.getPages();return r==null?void 0:r[n]}getElementsByPage(n){var r;return(r=this.getPage(n))==null?void 0:r.pageElements}getElement(n,r){var s;return(s=this.getElementsByPage(n))==null?void 0:s[r]}getPageSize(){return this._snapshot.pageSize}getBlankPage(){const n=nt(6);return{id:n,pageType:bo.SLIDE,zIndex:10,title:n,description:"",pageBackgroundFill:{rgb:"rgb(255,255,255)"},pageElements:{}}}setActivePage(n){this._activePage$.next(n)}getActivePage(){return this._activePage}updatePage(n,r){this._snapshot.body&&(this._snapshot.body.pages[n]=r)}appendPage(n){var i;if(!this._snapshot.body)return;this._snapshot.body.pages[n.id]=n;const r=this._activePage,s=this._snapshot.body.pageOrder.indexOf((i=r==null?void 0:r.id)!=null?i:"");this._snapshot.body.pageOrder.splice(s+1,0,n.id)}}var tI=Object.getOwnPropertyDescriptor,nI=(e,t,n,r)=>{for(var s=r>1?void 0:r?tI(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},Ti=(e,t)=>(n,r)=>t(n,r,e);const qn=ye.createIdentifier("univer.current");exports.UniverInstanceService=class extends Xe{constructor(n,r,s){super();p(this,"_unitsByType",new Map);p(this,"_createHandler");p(this,"_ctorByType",new Map);p(this,"_currentUnits",new Map);p(this,"_currentUnits$",new le.BehaviorSubject(this._currentUnits));p(this,"currentUnits$",this._currentUnits$.asObservable());p(this,"_unitAdded$",new le.Subject);p(this,"unitAdded$",this._unitAdded$.asObservable());p(this,"_unitDisposed$",new le.Subject);p(this,"unitDisposed$",this._unitDisposed$.asObservable());p(this,"_focused$",new le.BehaviorSubject(null));p(this,"focused$",this._focused$.asObservable());this._injector=n,this._contextService=r,this._logService=s}dispose(){super.dispose(),this._focused$.complete(),this._currentUnits$.complete(),this._unitAdded$.complete(),this._currentUnits.forEach(n=>n==null?void 0:n.dispose()),this._currentUnits.clear(),this._unitsByType.clear()}__setCreateHandler(n){this._createHandler=n}createUnit(n,r,s){return this._createHandler(n,r,this._ctorByType.get(n),s)}registerCtorForType(n,r){return this._ctorByType.set(n,r),{dispose:()=>{this._ctorByType.delete(n)}}}getCurrentTypeOfUnit$(n){return this.currentUnits$.pipe(le.map(r=>{var s;return(s=r.get(n))!=null?s:null}),le.distinctUntilChanged())}getCurrentUnitForType(n){return this._currentUnits.get(n)}getCurrentUnitOfType(n){return this.getCurrentUnitForType(n)}setCurrentUnitForType(n){const r=this._getUnitById(n);if(!r)throw new Error(`[UniverInstanceService]: no document with unitId ${n}!`);this._currentUnits.set(r[1],r[0]),this._currentUnits$.next(this._currentUnits)}getTypeOfUnitAdded$(n){return this._unitAdded$.pipe(le.filter(r=>r.type===n))}__addUnit(n,r){var a;this._logService.debug(`[UniverInstanceService]: Adding unit with id ${n.getUnitId()}`);const s=n.type;this._unitsByType.has(s)||this._unitsByType.set(s,[]);const i=this._unitsByType.get(s),o=n.getUnitId();if(i.findIndex(l=>l.getUnitId()===o)!==-1)throw new Error(`[UniverInstanceService]: cannot create a unit with the same unit id: ${o}.`);i.push(n),this._unitAdded$.next(n),((a=r==null?void 0:r.makeCurrent)==null||a)&&this.setCurrentUnitForType(n.getUnitId())}getTypeOfUnitDisposed$(n){return this.unitDisposed$.pipe(le.filter(r=>r.type===n))}getUnit(n,r){var i;const s=(i=this._getUnitById(n))==null?void 0:i[0];return r&&(s==null?void 0:s.type)!==r?null:s}getCurrentUniverDocInstance(){return this.getCurrentUnitForType(we.UNIVER_DOC)}getUniverDocInstance(n){return this.getUnit(n,we.UNIVER_DOC)}getUniverSheetInstance(n){return this.getUnit(n,we.UNIVER_SHEET)}getAllUnitsForType(n){var r;return(r=this._unitsByType.get(n))!=null?r:[]}changeDoc(n,r){const s=this.getAllUnitsForType(we.UNIVER_DOC),i=s.find(o=>o.getUnitId()===n);if(i!=null){const o=s.indexOf(i);s.splice(o,1)}this.__addUnit(r)}get focused(){var r;const n=this._focused$.getValue();return n?(r=this._getUnitById(n))==null?void 0:r[0]:null}focusUnit(n){this._focused$.next(n),this.focused instanceof exports.Workbook?(this._contextService.setContextValue(Ir,!0),this._contextService.setContextValue(Sr,!1),this._contextService.setContextValue(jn,!0),this._contextService.setContextValue(Or,!1),this.setCurrentUnitForType(n)):this.focused instanceof Dt?(this._contextService.setContextValue(Ir,!0),this._contextService.setContextValue(Sr,!0),this._contextService.setContextValue(jn,!1),this._contextService.setContextValue(Or,!1),this.setCurrentUnitForType(n)):this.focused instanceof ga?(this._contextService.setContextValue(Ir,!0),this._contextService.setContextValue(Sr,!1),this._contextService.setContextValue(jn,!1),this._contextService.setContextValue(Or,!0),this.setCurrentUnitForType(n)):(this._contextService.setContextValue(Ir,!1),this._contextService.setContextValue(Sr,!1),this._contextService.setContextValue(jn,!1),this._contextService.setContextValue(Or,!1))}getFocusedUnit(){return this.focused}getUnitType(n){const r=this._getUnitById(n);return r?r[1]:we.UNRECOGNIZED}disposeUnit(n){this._logService.debug(`[UniverInstanceService]: Disposing unit with id ${n}`);const r=this._getUnitById(n);if(!r)return this._logService.debug(`[UniverInstanceService]: No unit found with id ${n}`),!1;const[s,i]=r,o=this._unitsByType.get(i),a=o.indexOf(s);return o.splice(a,1),this._tryResetCurrentOnRemoval(n,i),this._tryResetFocusOnRemoval(n),this._unitDisposed$.next(s),s.dispose(),!0}_tryResetCurrentOnRemoval(n,r){const s=this.getCurrentUnitForType(r);(s==null?void 0:s.getUnitId())===n&&(this._currentUnits.set(r,null),this._currentUnits$.next(this._currentUnits))}_tryResetFocusOnRemoval(n){var r;((r=this.focused)==null?void 0:r.getUnitId())===n&&this._focused$.next(null)}_getUnitById(n){for(const[r,s]of this._unitsByType){const i=s.find(o=>o.getUnitId()===n);if(i)return[i,r]}}};exports.UniverInstanceService=nI([Ti(0,ye.Inject(ye.Injector)),Ti(1,er),Ti(2,ye.Inject(mt))],exports.UniverInstanceService);var Pe=(e=>(e[e.Starting=0]="Starting",e[e.Ready=1]="Ready",e[e.Rendered=2]="Rendered",e[e.Steady=3]="Steady",e))(Pe||{});const ad={0:"Starting",1:"Ready",2:"Rendered",3:"Steady"};var rI=Object.getOwnPropertyDescriptor,sI=(e,t,n,r)=>{for(var s=r>1?void 0:r?rI(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},iI=(e,t)=>(n,r)=>t(n,r,e);class ld extends Error{constructor(t){super(`[LifecycleService]: lifecycle stage "${ad[t]}" will never be reached!`),this.name="LifecycleUnreachableError"}}exports.LifecycleService=class extends Xe{constructor(n){super();p(this,"_lifecycle$",new le.BehaviorSubject(Pe.Starting));p(this,"lifecycle$",this._lifecycle$.asObservable());p(this,"_lock",!1);this._logService=n,this._reportProgress(Pe.Starting)}get stage(){return this._lifecycle$.getValue()}set stage(n){if(this._lock)throw new Error("[LifecycleService]: cannot set new stage when related logic is all handled!");if(n<this.stage)throw new Error("[LifecycleService]: lifecycle stage cannot go backward!");n!==this.stage&&(this._lock=!0,this._reportProgress(n),this._lifecycle$.next(n),this._lock=!1)}dispose(){this._lifecycle$.complete(),super.dispose()}onStage(n){return le.firstValueFrom(this.lifecycle$.pipe(le.filter(r=>r>=n),Hi(r=>r===n),le.map(()=>{}))).catch(r=>r.name==="EmptyError"?Promise.reject(new ld(n)):Promise.reject(r))}subscribeWithPrevious(){return le.merge(cd(this.stage),this._lifecycle$.pipe(le.skip(1))).pipe(Hi(n=>n===Pe.Steady))}_reportProgress(n){this._logService.debug("[LifecycleService]",`lifecycle progressed to "${ad[n]}".`)}};exports.LifecycleService=sI([iI(0,mt)],exports.LifecycleService);function cd(e){switch(e){case Pe.Starting:return le.of(Pe.Starting);case Pe.Ready:return le.of(Pe.Starting,Pe.Ready);case Pe.Rendered:return le.of(Pe.Starting,Pe.Ready,Pe.Rendered);default:return le.of(Pe.Starting,Pe.Ready,Pe.Rendered,Pe.Steady)}}const oI=ye.createIdentifier("ILocalStorageService");class Rn extends Xe{constructor(){super();p(this,"_currentLocale$",new le.BehaviorSubject(Hr.ZH_CN));p(this,"currentLocale$",this._currentLocale$.asObservable());p(this,"_locales",null);p(this,"localeChanged$",new le.Subject);p(this,"t",(n,...r)=>{if(!this._locales)throw new Error("[LocaleService]: Locale not initialized");const s=n.split("."),i=this.resolveKeyPath(this._locales[this._currentLocale],s);if(typeof i=="string"){let o=i;return r.forEach((a,l)=>{o=o.replace(`{${l}}`,a)}),o}else return n});this.disposeWithMe(Ye(()=>{this._locales=null,this._currentLocale$.complete(),this.localeChanged$.complete()}))}get _currentLocale(){return this._currentLocale$.value}load(n){var r;this._locales=Vs((r=this._locales)!=null?r:{},n)}setLocale(n){this._currentLocale$.next(n),this.localeChanged$.next()}getLocales(){var n;return(n=this._locales)==null?void 0:n[this._currentLocale]}getCurrentLocale(){return this._currentLocale}resolveKeyPath(n,r){const s=r.shift();if(s&&n&&s in n){const i=n[s];return r.length>0&&(typeof i=="object"||Array.isArray(i))?this.resolveKeyPath(i,r):i}return null}}var aI=Object.getOwnPropertyDescriptor,lI=(e,t,n,r)=>{for(var s=r>1?void 0:r?aI(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},cI=(e,t)=>(n,r)=>t(n,r,e);exports.MentionIOLocalService=class{constructor(t){this._userManagerService=t}async list(t){return{list:[{type:ys.PERSON,mentions:[{objectType:ys.PERSON,objectId:this._userManagerService.getCurrentUser().userID,label:this._userManagerService.getCurrentUser().name,metadata:{icon:this._userManagerService.getCurrentUser().avatar}}],metadata:{},title:"PEOPLE"}],page:t.page,size:t.size,total:1}}};exports.MentionIOLocalService=lI([cI(0,ye.Inject(Ur))],exports.MentionIOLocalService);const ud=ye.createIdentifier("univer.service.mention-io");var _a=(e=>(e.INIT="init",e.FETCHING="fetching",e.DONE="done",e))(_a||{});const hd=ye.createIdentifier("univer.permission-service");class dd extends Xe{constructor(){super(...arguments);p(this,"_permissionPointMap",new Map);p(this,"_permissionPointUpdate$",new le.Subject);p(this,"permissionPointUpdate$",this._permissionPointUpdate$.asObservable());p(this,"_showComponents",!0)}setShowComponents(n){this._showComponents=n}getShowComponents(){return this._showComponents}deletePermissionPoint(n){const r=this._permissionPointMap.get(n);r&&(r.complete(),this._permissionPointMap.delete(n))}addPermissionPoint(n){const r=n instanceof le.BehaviorSubject,s=r?n.getValue():n;return s.id?this._permissionPointMap.get(s.id)?(console.warn(`${s.id} PermissionPoint already exists`),!1):(this._permissionPointMap.set(s.id,r?n:new le.BehaviorSubject(s)),this._permissionPointUpdate$.next(s),!0):!1}updatePermissionPoint(n,r){const s=this._permissionPointMap.get(n);if(!s)return;const i=s.getValue();i.value=r,i.status=_a.DONE,s.next(i),this._permissionPointUpdate$.next(i)}clearPermissionMap(){this._permissionPointMap.clear()}getPermissionPoint(n){const r=this._permissionPointMap.get(n);if(r)return r.getValue()}getPermissionPoint$(n){const r=this._permissionPointMap.get(n);if(r)return r}composePermission$(n){const r=n.map(s=>{var o;const i=(o=this._permissionPointMap)==null?void 0:o.get(s);if(!i)throw new Error(`[PermissionService]: ${s} permissionPoint does not exist!`);return i.asObservable()});return le.combineLatest(r).pipe(us.map(s=>s))}composePermission(n){return n.map(s=>{var o;const i=(o=this._permissionPointMap)==null?void 0:o.get(s);if(!i)throw new Error(`[PermissionService]: ${s} permissionPoint does not exist!`);return i.getValue()})}getAllPermissionPoint(){const n=new Map;return this._permissionPointMap.forEach((r,s)=>{n.set(s,r)}),n}}function fd(e,t){if(!t)return e;const n=[];for(const r of e){const s=t.find(([i])=>i===r[0]);if(s){if(s[1]===null)continue;n.push([r[0],s[1]])}else n.push(r)}return n}var uI=Object.getOwnPropertyDescriptor,hI=(e,t,n,r)=>{for(var s=r>1?void 0:r?uI(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},Ni=(e,t)=>(n,r)=>t(n,r,e);const dI=4,md=Symbol("DependentOn");class lo extends Xe{onStarting(){}onReady(){}onRendered(){}onSteady(){}getUnitType(){return this.constructor.type}getPluginName(){return this.constructor.pluginName}}p(lo,"pluginName"),p(lo,"type",we.UNIVER_UNKNOWN);class fI{constructor(){p(this,"_plugins",[])}addPlugin(t){this._plugins.push(t)}removePlugins(){const t=this._plugins.slice();return this._plugins.length=0,t}forEachPlugin(t){this._plugins.forEach(t)}}function mI(...e){return function(t){t[md]=e}}exports.PluginService=class{constructor(t,n,r){p(this,"_pluginRegistry",new Map);p(this,"_pluginStore",new fI);p(this,"_seenPlugins",new Set);p(this,"_loadedPlugins",new Set);p(this,"_loadedPluginTypes",new Set([we.UNIVER_UNKNOWN]));p(this,"_flushTimerByType",new Map);this._injector=t,this._lifecycleService=n,this._logService=r}dispose(){this._pluginStore.removePlugins().forEach(t=>t.dispose()),this._flushTimerByType.forEach(t=>clearTimeout(t))}registerPlugin(t,n){this._assertPluginValid(t);const r={plugin:t,options:n};this._pluginRegistry.set(t.pluginName,r),this._logService.debug("[PluginService]",`Plugin "${t.pluginName}" registered.`);const{type:s}=t;this._loadedPluginTypes.has(s)&&(s===we.UNIVER_UNKNOWN?this._loadFromPlugins([r]):this._flushType(s))}startPluginsForType(t){this._loadedPluginTypes.has(t)||this._loadPluginsForType(t)}_loadPluginsForType(t){const n=Array.from(this._pluginRegistry.keys()),r=[];n.forEach(s=>{const i=this._pluginRegistry.get(s);i.plugin.type===t&&r.push(i)}),this._loadFromPlugins(r),this._loadedPluginTypes.add(t)}_assertPluginValid(t){const{type:n,pluginName:r}=t;if(n===we.UNRECOGNIZED)throw new Error(`[PluginService]: invalid plugin type for ${t.name}. Please assign a "type" to your plugin.`);if(!r)throw new Error(`[PluginService]: no plugin name for ${t.name}. Please assign a "pluginName" to your plugin.`);if(this._seenPlugins.has(r))throw new Error(`[PluginService]: duplicated plugin name for "${r}". Maybe a plugin that dependents on "${r} has already registered it. In that case please register "${r}" before the that plugin.`);this._seenPlugins.add(t.pluginName)}_flushType(t){this._flushTimerByType.get(t)===void 0&&this._flushTimerByType.set(t,setTimeout(()=>{this._loadPluginsForType(t),this._flushTimerByType.delete(t)},dI))}_loadFromPlugins(t){const n=[],r=new Set,s=o=>{const{plugin:a}=o,{pluginName:l}=a;if(this._loadedPlugins.has(l)||r.has(l))return;r.add(l),this._pluginRegistry.delete(l);const c=a[md];c&&c.forEach(u=>{const h=this._pluginRegistry.get(u.pluginName);if(h)s(h);else if(!this._seenPlugins.has(u.pluginName)&&!r.has(u.pluginName)){if(a.type===we.UNIVER_UNKNOWN&&u.type!==we.UNIVER_UNKNOWN)throw new Error(`[PluginService]: cannot register a plugin with Univer type that depends on a plugin with other type. The dependent is ${a.pluginName} and the dependency is ${u.pluginName}.`);a.type!==u.type&&u.type!==we.UNIVER_UNKNOWN&&this._logService.debug("[PluginService]",`Plugin "${l}" depends on "${u.pluginName}" which has different type.`),this._logService.debug("[PluginService]",`Plugin "${l}" depends on "${u.pluginName}" which is not registered. Univer will automatically register it with default configuration.`),this._assertPluginValid(u),s({plugin:u,options:void 0})}}),n.push(o)};t.forEach(o=>s(o));const i=n.map(o=>this._initPlugin(o.plugin,o.options));this._pluginsRunLifecycle(i)}_pluginsRunLifecycle(t){const n=this._lifecycleService.stage;if(cd(n).subscribe(r=>this._runStage(t,r)),n!==Pe.Steady){const r=this._lifecycleService.lifecycle$.pipe(le.skip(1)).subscribe(s=>{this._runStage(t,s),s===Pe.Steady&&r.unsubscribe()})}}_runStage(t,n){t.forEach(r=>{switch(n){case Pe.Starting:r.onStarting();break;case Pe.Ready:r.onReady();break;case Pe.Rendered:r.onRendered();break;case Pe.Steady:r.onSteady();break}})}_initPlugin(t,n){const r=this._injector.createInstance(t,n);return this._pluginStore.addPlugin(r),this._loadedPlugins.add(t.pluginName),this._logService.debug("[PluginService]",`Plugin "${r.getPluginName()}" loaded.`),r}};exports.PluginService=hI([Ni(0,ye.Inject(ye.Injector)),Ni(1,ye.Inject(exports.LifecycleService)),Ni(2,mt)],exports.PluginService);const co=ye.createIdentifier("resource-loader-service");var gI=Object.getOwnPropertyDescriptor,_I=(e,t,n,r)=>{for(var s=r>1?void 0:r?gI(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},pI=(e,t)=>(n,r)=>t(n,r,e);exports.ResourceManagerService=class extends Xe{constructor(n){super();p(this,"_resourceMap",new Map);p(this,"_register$",new le.Subject);p(this,"register$",this._register$.asObservable());this._logService=n}getAllResourceHooks(){return[...this._resourceMap.values()]}getResources(n,r){return r?this.getResourcesByType(n,r):this.getAllResourceHooks().map(o=>{const a=o.toJson(n);return{name:o.pluginName,data:a}})}getResourcesByType(n,r){return this.getAllResourceHooks().filter(o=>o.businesses.includes(r)).map(o=>{const a=o.toJson(n);return{name:o.pluginName,data:a}})}registerPluginResource(n){const r=n.pluginName;if(this._resourceMap.has(r))throw new Error(`the pluginName is registered {${r}}`);return this._resourceMap.set(r,n),this._register$.next(n),Ye(()=>this._resourceMap.delete(r))}disposePluginResource(n){this._resourceMap.delete(n)}loadResources(n,r){this.getAllResourceHooks().forEach(s=>{var o;const i=(o=r==null?void 0:r.find(a=>a.name===s.pluginName))==null?void 0:o.data;if(i)try{const a=s.parseJson(i);s.onLoad(n,a)}catch(a){this._logService.error("[ResourceManagerService]","loadResources error",a)}})}unloadResources(n,r){this.getAllResourceHooks().filter(s=>s.businesses.includes(r)).forEach(s=>{s.onUnLoad(n)})}dispose(){this._register$.complete(),this._resourceMap.clear()}};exports.ResourceManagerService=_I([pI(0,mt)],exports.ResourceManagerService);class Bs extends Xe{constructor(){super();p(this,"_darkMode$",new le.BehaviorSubject(!1));p(this,"darkMode$",this._darkMode$.asObservable());p(this,"_validColorCache",new Map);p(this,"_currentTheme",qr.defaultTheme);p(this,"_currentTheme$",new le.BehaviorSubject(this._currentTheme));p(this,"currentTheme$",this._currentTheme$.asObservable());this.disposeWithMe(Ye(()=>{this._currentTheme=qr.defaultTheme,this._currentTheme$.complete(),this._darkMode$.complete()}))}get darkMode(){return this._darkMode$.getValue()}isValidThemeColor(n){if(this._validColorCache.has(n))return this._validColorCache.get(n);let r=!1;const s=n.split(".");if(s.length===1)r=n in qr.defaultTheme;else if(s.length===2){const[i,o]=s;r=i in qr.defaultTheme&&o in this._currentTheme[i]}return this._validColorCache.set(n,r),r}getCurrentTheme(){return this._currentTheme}setTheme(n){this._currentTheme=n,this._currentTheme$.next(n)}setDarkMode(n){this._darkMode$.next(n)}getColorFromTheme(n){return cc(this._currentTheme,n)}}var EI=Object.getOwnPropertyDescriptor,CI=(e,t,n,r)=>{for(var s=r>1?void 0:r?EI(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},Mi=(e,t)=>(n,r)=>t(n,r,e);const si=ye.createIdentifier("univer.undo-redo.service"),RI=20;class gd{dispose(){}async dispatchToHandlers(){return!1}}const _d="univer.command.redo",pd="univer.command.undo",Ed=new class extends gd{constructor(){super(...arguments);p(this,"type",jr.COMMAND);p(this,"id",pd)}handler(t){const n=t.get(si),r=n.pitchTopUndoElement();if(!r)return!1;const s=t.get(Wr);return Xs(r.undoMutations,s)?(n.popUndoToRedo(),!0):!1}},Cd=new class extends gd{constructor(){super(...arguments);p(this,"type",jr.COMMAND);p(this,"id",_d)}handler(t){const n=t.get(si),r=n.pitchTopRedoElement();if(!r)return!1;const s=t.get(Wr);return Xs(r.redoMutations,s)?(n.popRedoToUndo(),!0):!1}};exports.LocalUndoRedoService=class extends Xe{constructor(n,r,s){super();p(this,"undoRedoStatus$");p(this,"_undoRedoStatus$",new le.BehaviorSubject({undos:0,redos:0}));p(this,"_undoStacks",new Map);p(this,"_redoStacks",new Map);p(this,"_batchingStatus",new Map);this._univerInstanceService=n,this._commandService=r,this._contextService=s,this.undoRedoStatus$=this._undoRedoStatus$.asObservable(),this.disposeWithMe(this._commandService.registerCommand(Ed)),this.disposeWithMe(this._commandService.registerCommand(Cd)),this.disposeWithMe(Ye(()=>this._undoRedoStatus$.complete())),this.disposeWithMe(Ye(this._univerInstanceService.focused$.subscribe(()=>this._updateStatus())))}pushUndoRedo(n){const{unitID:r}=n,s=this._getRedoStack(r,!0),i=this._getUndoStack(r,!0);if(s.length=0,this._batchingStatus.has(n.unitID)){const a=this._batchingStatus.get(n.unitID),l=this._pitchUndoElement(n.unitID);a===0||!l?(o(n),this._batchingStatus.set(n.unitID,1)):this._tryBatchingElements(l,n)}else o(n);function o(a){i.push(a),i.length>RI&&i.splice(0,1)}this._updateStatus()}clearUndoRedo(n){const r=this._getRedoStack(n);r&&(r.length=0);const s=this._getUndoStack(n);s&&(s.length=0),this._updateStatus()}pitchTopUndoElement(){const n=this._getFocusedUnitId();return this._pitchUndoElement(n)}pitchTopRedoElement(){const n=this._getFocusedUnitId();return this._pitchRedoElement(n)}_pitchUndoElement(n){const r=this._getUndoStack(n);return r!=null&&r.length?r[r.length-1]:null}_pitchRedoElement(n){const r=this._getRedoStack(n);return r!=null&&r.length?r[r.length-1]:null}popUndoToRedo(){const r=this._getUndoStackForFocused().pop();r&&(r.redoMutations.length>0&&this._getRedoStackForFocused().push(r),this._updateStatus())}popRedoToUndo(){const r=this._getRedoStackForFocused().pop();r&&(this._getUndoStackForFocused().push(r),this._updateStatus())}rollback(n,r){const s=r||this._getFocusedUnitId(),i=this._getUndoStack(s),o=i==null?void 0:i[(i==null?void 0:i.length)-1];o&&o.id===n&&(i.pop(),Xs(o.undoMutations,this._commandService))}__tempBatchingUndoRedo(n){if(this._batchingStatus.has(n))throw new Error("[LocalUndoRedoService]: cannot batching undo redo twice at the same time!");return this._batchingStatus.set(n,0),Ye(()=>this._batchingStatus.delete(n))}_updateStatus(){var i,o;const n=this._getFocusedUnitId(),r=n&&((i=this._undoStacks.get(n))==null?void 0:i.length)||0,s=n&&((o=this._redoStacks.get(n))==null?void 0:o.length)||0;this._undoRedoStatus$.next({undos:r,redos:s})}_getUndoStack(n,r=!1){let s=this._undoStacks.get(n);return!s&&r&&(s=[],this._undoStacks.set(n,s)),s||null}_getRedoStack(n,r=!1){let s=this._redoStacks.get(n);return!s&&r&&(s=[],this._redoStacks.set(n,s)),s||null}_getUndoStackForFocused(){const n=this._getFocusedUnitId();if(!n)throw new Error("No focused univer instance!");return this._getUndoStack(n,!0)}_getRedoStackForFocused(){const n=this._getFocusedUnitId();if(!n)throw new Error("No focused univer instance!");return this._getRedoStack(n,!0)}_tryBatchingElements(n,r){n.redoMutations.push(...r.redoMutations),n.undoMutations.push(...r.undoMutations)}_getFocusedUnitId(){var o,a,l,c;let n="";const r=this._contextService.getContextValue(jn),s=this._contextService.getContextValue(jh),i=this._contextService.getContextValue($h);return r?s?n=mo:i?n=fo:n=(a=(o=this._univerInstanceService.getFocusedUnit())==null?void 0:o.getUnitId())!=null?a:"":n=(c=(l=this._univerInstanceService.getFocusedUnit())==null?void 0:l.getUnitId())!=null?c:"",n}};exports.LocalUndoRedoService=CI([Mi(0,qn),Mi(1,Wr),Mi(2,er)],exports.LocalUndoRedoService);class Rd{constructor(t,n=1e3){p(this,"_imageCacheMap");this._injector=t,this._imageCacheMap=new Lr(n)}_getImageCacheKey(t,n){return`${t}-${n}`}getImage(t,n,r,s){const i=this._getImageCacheKey(t,n),o=this._imageCacheMap.get(i);return o||((async()=>{const a=new Image,l=this._injector.has(io)?this._injector.get(io):null,c=this._injector.has(oo)?this._injector.get(oo):null;if(t===Hs.UUID)try{a.src=await(l==null?void 0:l.getImage(n))||""}catch(u){console.error(u)}else if(t===Hs.URL)try{const u=await(c==null?void 0:c.getImage(n));a.src=u||n}catch{a.src=n}else a.src=n;a.onload=()=>{a.removeAttribute("data-error"),r==null||r()},a.onerror=()=>{a.setAttribute("data-error","true"),s==null||s()},this._imageCacheMap.set(i,a)})(),null)}}function II(e){return!(e.length===0||e.length>31||e.startsWith("'")||e.endsWith("'")||/[:\\\/\?\*\[\]]/.test(e))}function SI(e,t){return!(!e||e.length===0||e.length>255||t.has(e)||/[ :\\\/\?\*\[\]]/.test(e)||!/^[\p{L}_]/u.test(e)||/^\$?[A-Za-z]{1,3}\$?[0-9]+$/.test(e)||/^[rR]\d+[cC]\d+$/.test(e)||/^\d+$/.test(e))}const Nl=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],Di=1,ar=8;class pa{static from(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[n,r]=new Uint8Array(t,0,2);if(n!==219)throw new Error("Data does not appear to be in a KDBush format.");const s=r>>4;if(s!==Di)throw new Error(`Got v${s} data when expected v${Di}.`);const i=Nl[r&15];if(!i)throw new Error("Unrecognized array type.");const[o]=new Uint16Array(t,2,1),[a]=new Uint32Array(t,4,1);return new pa(a,o,i,t)}constructor(t,n=64,r=Float64Array,s){if(isNaN(t)||t<0)throw new Error(`Unpexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+n,2),65535),this.ArrayType=r,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;const i=Nl.indexOf(this.ArrayType),o=t*2*this.ArrayType.BYTES_PER_ELEMENT,a=t*this.IndexArrayType.BYTES_PER_ELEMENT,l=(8-a%8)%8;if(i<0)throw new Error(`Unexpected typed array class: ${r}.`);s&&s instanceof ArrayBuffer?(this.data=s,this.ids=new this.IndexArrayType(this.data,ar,t),this.coords=new this.ArrayType(this.data,ar+a+l,t*2),this._pos=t*2,this._finished=!0):(this.data=new ArrayBuffer(ar+o+a+l),this.ids=new this.IndexArrayType(this.data,ar,t),this.coords=new this.ArrayType(this.data,ar+a+l,t*2),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,(Di<<4)+i]),new Uint16Array(this.data,2,1)[0]=n,new Uint32Array(this.data,4,1)[0]=t)}add(t,n){const r=this._pos>>1;return this.ids[r]=r,this.coords[this._pos++]=t,this.coords[this._pos++]=n,r}finish(){const t=this._pos>>1;if(t!==this.numItems)throw new Error(`Added ${t} items when expected ${this.numItems}.`);return uo(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,n,r,s){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:i,coords:o,nodeSize:a}=this,l=[0,i.length-1,0],c=[];for(;l.length;){const u=l.pop()||0,h=l.pop()||0,d=l.pop()||0;if(h-d<=a){for(let R=d;R<=h;R++){const b=o[2*R],F=o[2*R+1];b>=t&&b<=r&&F>=n&&F<=s&&c.push(i[R])}continue}const f=d+h>>1,g=o[2*f],_=o[2*f+1];g>=t&&g<=r&&_>=n&&_<=s&&c.push(i[f]),(u===0?t<=g:n<=_)&&(l.push(d),l.push(f-1),l.push(1-u)),(u===0?r>=g:s>=_)&&(l.push(f+1),l.push(h),l.push(1-u))}return c}within(t,n,r){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:s,coords:i,nodeSize:o}=this,a=[0,s.length-1,0],l=[],c=r*r;for(;a.length;){const u=a.pop()||0,h=a.pop()||0,d=a.pop()||0;if(h-d<=o){for(let R=d;R<=h;R++)Ml(i[2*R],i[2*R+1],t,n)<=c&&l.push(s[R]);continue}const f=d+h>>1,g=i[2*f],_=i[2*f+1];Ml(g,_,t,n)<=c&&l.push(s[f]),(u===0?t-r<=g:n-r<=_)&&(a.push(d),a.push(f-1),a.push(1-u)),(u===0?t+r>=g:n+r>=_)&&(a.push(f+1),a.push(h),a.push(1-u))}return l}}function uo(e,t,n,r,s,i){if(s-r<=n)return;const o=r+s>>1;Id(e,t,o,r,s,i),uo(e,t,n,r,o-1,1-i),uo(e,t,n,o+1,s,1-i)}function Id(e,t,n,r,s,i){for(;s>r;){if(s-r>600){const c=s-r+1,u=n-r+1,h=Math.log(c),d=.5*Math.exp(2*h/3),f=.5*Math.sqrt(h*d*(c-d)/c)*(u-c/2<0?-1:1),g=Math.max(r,Math.floor(n-u*d/c+f)),_=Math.min(s,Math.floor(n+(c-u)*d/c+f));Id(e,t,n,g,_,i)}const o=t[2*n+i];let a=r,l=s;for(lr(e,t,r,n),t[2*s+i]>o&&lr(e,t,r,s);a<l;){for(lr(e,t,a,l),a++,l--;t[2*a+i]<o;)a++;for(;t[2*l+i]>o;)l--}t[2*r+i]===o?lr(e,t,r,l):(l++,lr(e,t,l,s)),l<=n&&(r=l+1),n<=l&&(s=l-1)}}function lr(e,t,n,r){Li(e,n,r),Li(t,2*n,2*r),Li(t,2*n+1,2*r+1)}function Li(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function Ml(e,t,n,r){const s=e-n,i=t-r;return s*s+i*i}class OI{constructor(t=!1){p(this,"_tree",new Map);p(this,"_oneCellCache",new Map);p(this,"_kdTree",new Map);this._enableOneCellCache=t}dispose(){this.clear()}getTree(t,n){return this._tree.has(t)||this._tree.set(t,new Map),this._tree.get(t).has(n)||this._tree.get(t).set(n,new Us),this._tree.get(t).get(n)}_getOneCellCache(t,n,r,s){return this._oneCellCache.has(t)||this._oneCellCache.set(t,new Map),this._oneCellCache.get(t).has(n)||this._oneCellCache.get(t).set(n,new Map),this._oneCellCache.get(t).get(n).has(r)||this._oneCellCache.get(t).get(n).set(r,new Map),this._oneCellCache.get(t).get(n).get(r).has(s)||this._oneCellCache.get(t).get(n).get(r).set(s,new Set),this._oneCellCache.get(t).get(n).get(r).get(s)}_removeOneCellCache(t,n,r,s,i){const o=this._oneCellCache.get(t);if(!o)return;const a=o.get(n);if(!a)return;const l=a.get(r);if(!l)return;const c=l.get(s);c&&c.delete(i)}_removeCellCacheByRange(t){const{unitId:n,sheetId:r,range:s,id:i}=t,o=this._oneCellCache.get(n);if(!o)return;const a=o.get(r);if(!a)return;const{startRow:l,startColumn:c,endRow:u,endColumn:h}=s;for(let d=l;d<=u;d++){const f=a.get(d);if(f)for(let g=c;g<=h;g++){const _=f.get(g);_&&_.delete(i)}}}_insertOneCellCache(t,n,r,s,i){this._getOneCellCache(t,n,r,s).add(i)}_getRdTreeItems(t){const n=[];for(const[r,s]of t)for(const[i,o]of s)n.push({x:i,y:r,ids:o});return n}_searchByOneCellCache(t){var g;const{unitId:n,sheetId:r,range:s}=t,{startRow:i,startColumn:o,endRow:a,endColumn:l}=s,c=(g=this._kdTree.get(n))==null?void 0:g.get(r);if(!c)return[];const{tree:u,items:h}=c,d=u.range(o,i,l,a),f=[];for(const _ of d){const R=h[_];f.push(...Array.from(R.ids))}return f}openKdTree(){var t;for(const[n,r]of this._oneCellCache){this._kdTree.has(n)||this._kdTree.set(n,new Map);for(const[s,i]of r){const o=this._getRdTreeItems(i),a=new pa(o.length);(t=this._kdTree.get(n))==null||t.set(s,{tree:a,items:o});for(const l of o)a.add(l.x,l.y);a.finish()}}}closeKdTree(){var t;for(const[n,r]of this._oneCellCache)for(const[s,i]of r)(t=this._kdTree.get(n))==null||t.set(s,void 0)}insert(t){const{unitId:n,sheetId:r,range:s,id:i}=t;if(!n||n.length===0)return;let{startRow:o,endRow:a,startColumn:l,endColumn:c}=s;if(this._enableOneCellCache&&o===a&&l===c){this._insertOneCellCache(n,r,o,l,i);return}const u=this.getTree(n,r);Number.isNaN(o)&&(o=0),Number.isNaN(l)&&(l=0),Number.isNaN(a)&&(a=Number.POSITIVE_INFINITY),Number.isNaN(c)&&(c=Number.POSITIVE_INFINITY),u.insert({minX:l,minY:o,maxX:c,maxY:a,id:i})}bulkInsert(t){for(const n of t)this.insert(n)}*searchGenerator(t){var a;const{unitId:n,sheetId:r,range:s}=t;if(this._enableOneCellCache){const l=this._searchByOneCellCache(t);for(const c of l)yield c}const i=(a=this._tree.get(n))==null?void 0:a.get(r);if(!i)return;const o=i.search({minX:s.startColumn,minY:s.startRow,maxX:s.endColumn,maxY:s.endRow});for(const l of o)yield l.id}bulkSearch(t,n){const r=new Set;for(const s of t)for(const i of this.searchGenerator(s))(n==null?void 0:n.has(i))!==!0&&r.add(i);return r}removeById(t,n){var r,s;n?((r=this._tree.get(t))==null||r.delete(n),(s=this._oneCellCache.get(t))==null||s.delete(n)):(this._tree.delete(t),this._oneCellCache.delete(t))}_removeRTreeItem(t){const{unitId:n,sheetId:r,range:s,id:i}=t,o=this.getTree(n,r),a=o.search({minX:s.startColumn,minY:s.startRow,maxX:s.endColumn,maxY:s.endRow});for(let l=0;l<a.length;l++)a[l].id===i&&o.remove(a[l])}remove(t){const{unitId:n,sheetId:r,range:s,id:i}=t,{startRow:o,startColumn:a,endRow:l,endColumn:c}=s;this._enableOneCellCache?o===l&&a===c?this._removeOneCellCache(n,r,s.startRow,s.startColumn,i):(this._removeCellCacheByRange(t),this._removeRTreeItem(t)):this._removeRTreeItem(t)}bulkRemove(t){for(const n of t)this.remove(n)}clear(){this._tree.clear(),this._oneCellCache.clear()}toJSON(){const t={};return this._tree.forEach((n,r)=>{t[r]={},n.forEach((s,i)=>{t[r][i]=s.toJSON()})}),t}fromJSON(t){this._tree.clear();for(const n in t){this._tree.set(n,new Map);for(const r in t[n]){const s=new Us;s.fromJSON(t[n][r]),this._tree.get(n).set(r,s)}}}}function wI(e){return new Promise(t=>setTimeout(t,e))}function vI(e=1){return new Promise(t=>{let n=0;const r=()=>{n++,n>=e?t():requestAnimationFrame(r)};requestAnimationFrame(r)})}var bI=Object.getOwnPropertyDescriptor,yI=(e,t,n,r)=>{for(var s=r>1?void 0:r?bI(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},AI=(e,t)=>(n,r)=>t(n,r,e);exports.Skeleton=class extends Xe{constructor(n){super();p(this,"_fontLocale");p(this,"_dirty",!0);this._localeService=n,this._localeInitial()}get dirty(){return this._dirty}getFontLocale(){return this._fontLocale}makeDirty(n){this._dirty=n}dispose(){super.dispose(),this._fontLocale=null}_localeInitial(){}};exports.Skeleton=yI([AI(0,ye.Inject(Rn))],exports.Skeleton);var TI=Object.getOwnPropertyDescriptor,NI=(e,t,n,r)=>{for(var s=r>1?void 0:r?TI(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},cs=(e,t)=>(n,r)=>t(n,r,e);exports.SheetSkeleton=class extends exports.Skeleton{constructor(n,r,s,i,o,a){super(s);p(this,"_worksheetData");p(this,"_renderRawFormula",!1);p(this,"_cellData");p(this,"_imageCacheMap");p(this,"_skipAutoHeightForMergedCells",!0);p(this,"_rowTotalHeight",0);p(this,"_columnTotalWidth",0);p(this,"_rowHeaderWidth",0);p(this,"_columnHeaderHeight",0);p(this,"_rowHeightAccumulation",[]);p(this,"_columnWidthAccumulation",[]);p(this,"_marginTop",0);p(this,"_marginLeft",0);p(this,"_scaleX");p(this,"_scaleY");p(this,"_scrollX");p(this,"_scrollY");this.worksheet=n,this._styles=r,this._contextService=i,this._configService=o,this._injector=a,this._worksheetData=this.worksheet.getConfig(),this._cellData=this.worksheet.getCellMatrix(),this._imageCacheMap=new Rd(this._injector),this.initConfig()}initConfig(){var n,r;this._skipAutoHeightForMergedCells=!((n=this._configService.getConfig(Hl))!=null&&n),this.worksheet.setIsRowStylePrecedeColumnStyle((r=this._configService.getConfig(Fl))!=null?r:!1)}resetCache(){}getWorksheetConfig(){return this._worksheetData}getLocation(){return[this.worksheet.getUnitId(),this.worksheet.getSheetId()]}set columnHeaderHeight(n){this._columnHeaderHeight=n,this._worksheetData.columnHeader.height=n}set rowHeaderWidth(n){this._rowHeaderWidth=n,this._worksheetData.rowHeader.width=n}get rowHeightAccumulation(){return this._rowHeightAccumulation}get rowTotalHeight(){return this._rowTotalHeight}get columnWidthAccumulation(){return this._columnWidthAccumulation}get columnTotalWidth(){return this._columnTotalWidth}get rowHeaderWidth(){return this._rowHeaderWidth}get columnHeaderHeight(){return this._columnHeaderHeight}setMarginLeft(n){this._marginLeft=n}setMarginTop(n){this._marginTop=n}setScale(n,r){this._updateLayout(),this._scaleX=n,this._scaleY=r||n,this._updateLayout()}setScroll(n,r){Z.isDefine(n)&&(this._scrollX=n),Z.isDefine(r)&&(this._scrollY=r)}get scrollX(){return this._scrollX}get scrollY(){return this._scrollY}get scaleX(){return this._scaleX}get scaleY(){return this._scaleY}get rowHeaderWidthAndMarginLeft(){return this.rowHeaderWidth+this._marginLeft}get columnHeaderHeightAndMarginTop(){return this.columnHeaderHeight+this._marginTop}get imageCacheMap(){return this._imageCacheMap}_generateRowMatrixCache(n,r,s){let i=0;const o=[],a=r;for(let l=0;l<n;l++){let c=s;if(this.worksheet.getRowFiltered(l))c=0;else if(a[l]!=null){const u=a[l];if(!u)continue;const{h=s,ah:d,ia:f}=u;(f==null||f===ie.TRUE)&&typeof d=="number"?c=d:c=h,u.hd===ie.TRUE&&(c=0)}i+=c,o.push(i)}return{rowTotalHeight:i,rowHeightAccumulation:o}}_generateColumnMatrixCache(n,r,s){let i=0;const o=[],a=r;for(let l=0;l<n;l++){let c=s;if(a[l]!=null){const u=a[l];if(!u)continue;u.w!=null&&(c=u.w),u.hd===ie.TRUE&&(c=0)}i+=c,o.push(i)}return{columnTotalWidth:i,columnWidthAccumulation:o}}intersectMergeRange(n,r){return!!this.worksheet.getMergedCell(n,r)}_getOverflowBound(n,r,s,i,o=Nt.LEFT){let a=0;if(r>s){const l=this._columnWidthAccumulation.length-1;for(let c=r;c>=s;c--){const u=c,h=this.worksheet.getCell(n,u);if(!qi(h)&&u!==r||this.intersectMergeRange(n,u))return u===r?u:u+1>l?l:u+1;const{startX:d,endX:f}=Pn(n,u,this.rowHeightAccumulation,this.columnWidthAccumulation);if(o===Nt.CENTER&&u===r?a+=(f-d)/2:a+=f-d,i<a)return u}return r}for(let l=r;l<=s;l++){const c=l,u=this.worksheet.getCell(n,c);if(!qi(u)&&c!==r||this.intersectMergeRange(n,c))return c===r?c:c-1<0?0:c-1;const{startX:h,endX:d}=Pn(n,c,this.rowHeightAccumulation,this.columnWidthAccumulation);if(o===Nt.CENTER&&c===r?a+=(d-h)/2:a+=d-h,i<a)return c}return s}_updateLayout(){if(!this.dirty)return;const{rowData:n,columnData:r,defaultRowHeight:s,defaultColumnWidth:i,rowCount:o,columnCount:a,rowHeader:l,columnHeader:c}=this._worksheetData,{rowTotalHeight:u,rowHeightAccumulation:h}=this._generateRowMatrixCache(o,n,s),{columnTotalWidth:d,columnWidthAccumulation:f}=this._generateColumnMatrixCache(a,r,i);this._rowHeaderWidth=l.hidden!==ie.TRUE?this._dynamicallyUpdateRowHeaderWidth(l):0,this._columnHeaderHeight=c.hidden!==ie.TRUE?c.height:0,this._rowTotalHeight=u,this._rowHeightAccumulation=h,this._columnTotalWidth=d,this._columnWidthAccumulation=f,this.makeDirty(!1)}calculate(){return this.resetCache(),this._updateLayout(),this}resetRangeCache(n){}_dynamicallyUpdateRowHeaderWidth(n){const s=`${this.worksheet.getRowCount()}`.length*8;return Math.max(n.width,s)}_hasUnMergedCellInRow(n,r,s){if(!this.worksheet.getMergeData())return!1;for(let o=r;o<=s;o++){const{isMerged:a,isMergedMainCell:l}=this.worksheet.getCellInfoInMergeData(n,o);if(!a&&!l)return!0}return!1}expandRangeByMerge(n,r){let{startRow:s,startColumn:i,endRow:o,endColumn:a}=n;const l=this._worksheetData.mergeData;if(!l)return{startRow:s,startColumn:i,endRow:o,endColumn:a};let c=!0;const u=new ct;let h=0,d=null;for(;c;){c=!1;for(let f=0;f<l.length;f++){const{startRow:g,startColumn:_,endRow:R,endColumn:b}=l[f];if(u.getValue(g,_))continue;const F={startColumn:i,startRow:s,endColumn:a,endRow:o},k={startColumn:_,startRow:g,endColumn:b,endRow:R};uh(F,k)&&(s=Math.min(s,g),i=Math.min(i,_),o=Math.max(o,R),a=Math.max(a,b),u.setValue(g,_,!0),c=!0,h++,d=k)}}return r&&h===1&&zt.contains(d,n)?{startRow:d.startRow,startColumn:d.startColumn,endRow:d.startRow,endColumn:d.startColumn}:{startRow:s,startColumn:i,endRow:o,endColumn:a}}getColumnCount(){return this._columnWidthAccumulation.length}getRowCount(){return this._rowHeightAccumulation.length}_getCellMergeInfo(n,r){return this.worksheet.getCellInfoInMergeData(n,r)}getNoMergeCellPositionByIndex(n,r,s=!0){return this.getNoMergeCellWithCoordByIndex(n,r,s)}getNoMergeCellWithCoordByIndex(n,r,s=!0){const{rowHeightAccumulation:i,columnWidthAccumulation:o,rowHeaderWidthAndMarginLeft:a,columnHeaderHeightAndMarginTop:l}=this;let{startY:c,endY:u,startX:h,endX:d}=Pn(n,r,i,o);return s&&(c+=l,u+=l,h+=a,d+=a),{startY:c,endY:u,startX:h,endX:d}}getNoMergeCellPositionByIndexWithNoHeader(n,r){const{rowHeightAccumulation:s,columnWidthAccumulation:i}=this,{startY:o,endY:a,startX:l,endX:c}=Pn(n,r,s,i);return{startY:o,endY:a,startX:l,endX:c}}getRowIndexByOffsetY(n,r,s,i){var l;const{rowHeightAccumulation:o}=this;n=Od(n,r,s,this.columnHeaderHeightAndMarginTop);let a=ur(o,n,i==null?void 0:i.firstMatch);return i!=null&&i.closeFirst&&Math.abs(o[a]-n)<Math.abs(n-((l=o[a-1])!=null?l:0))&&(a=a+1),a}getColumnIndexByOffsetX(n,r,s,i){var c;const o=Sd(n,r,s,this.rowHeaderWidthAndMarginLeft),{columnWidthAccumulation:a}=this;let l=ur(a,o,i==null?void 0:i.firstMatch);return i!=null&&i.closeFirst&&Math.abs(a[l]-o)<Math.abs(o-((c=a[l-1])!=null?c:0))&&(l=l+1),l}getCellIndexByOffset(n,r,s,i,o,a){const l=this.getRowIndexByOffsetY(r,i,o,a),c=this.getColumnIndexByOffsetX(n,s,o,a);return{row:l,column:c}}getCellByOffset(n,r,s,i,o){const a=this==null?void 0:this.getCellIndexByOffset(n,r,s,i,o,{firstMatch:!0});return a?this.worksheet.getCellInfoInMergeData(a.row,a.column):null}getCellWithCoordByIndex(n,r,s=!0){const{rowHeightAccumulation:i,columnWidthAccumulation:o,rowHeaderWidthAndMarginLeft:a,columnHeaderHeightAndMarginTop:l}=this,c=Pn(n,r,i,o,this.worksheet.getCellInfoInMergeData(n,r)),{isMerged:u,isMergedMainCell:h}=c;let{startY:d,endY:f,startX:g,endX:_,mergeInfo:R}=c,b=a,F=l;return s===!1&&(b=0,F=0),d+=F,f+=F,g+=b,_+=b,R.startY+=F,R.endY+=F,R.startX+=b,R.endX+=b,{actualRow:n,actualColumn:r,startX:g,startY:d,endX:_,endY:f,isMerged:u,isMergedMainCell:h,mergeInfo:R}}getCellWithCoordByOffset(n,r,s,i,o,a){const{row:l,column:c}=this.getCellIndexByOffset(n,r,s,i,o,a);return this.getCellWithCoordByIndex(l,c)}getOffsetByColumn(n){const{columnWidthAccumulation:r,rowHeaderWidthAndMarginLeft:s}=this,i=r.length-1,o=r[n];return o!=null?o+s:n<0?s:r[i]+s}getOffsetByRow(n){const{rowHeightAccumulation:r,columnHeaderHeightAndMarginTop:s}=this,i=r.length-1,o=r[n];return o!=null?o+s:n<0?s:r[i]+s}getOffsetRelativeToRowCol(n,r){const s=ur(this.columnWidthAccumulation,n);let i=0;s===0?i=n:i=n-this._columnWidthAccumulation[s-1];const o=ur(this.rowHeightAccumulation,r);let a=0;return o===0?a=r:a=r-this._rowHeightAccumulation[o-1],{row:o,column:s,columnOffset:i,rowOffset:a}}_updateConfigAndGetDocumentModel(n,r,s,i){var a,l,c,u,h;if(!i||!((a=n.body)!=null&&a.dataStream))return;n.documentStyle||(n.documentStyle={}),n.documentStyle.marginTop=(l=s.t)!=null?l:0,n.documentStyle.marginBottom=(c=s.b)!=null?c:2,n.documentStyle.marginLeft=(u=s.l)!=null?u:2,n.documentStyle.marginRight=(h=s.r)!=null?h:2,n.documentStyle.pageSize={width:Number.POSITIVE_INFINITY,height:Number.POSITIVE_INFINITY},n.documentStyle.renderConfig={...n.documentStyle.renderConfig,...i};const o=n.body.paragraphs||[];for(const d of o)d.paragraphStyle||(d.paragraphStyle={}),d.paragraphStyle.horizontalAlign=r;return new Dt(n)}dispose(){super.dispose(),this._rowHeightAccumulation=[],this._columnWidthAccumulation=[],this._rowTotalHeight=0,this._columnTotalWidth=0,this._rowHeaderWidth=0,this._columnHeaderHeight=0,this._worksheetData=null,this._cellData=null,this._styles=null,this.worksheet=null}};exports.SheetSkeleton=NI([cs(2,ye.Inject(Rn)),cs(3,er),cs(4,$r),cs(5,ye.Inject(ye.Injector))],exports.SheetSkeleton);function Ea(e,t,n,r){const s=e-1,i=t-1,o=n[s]||0;let a=n[e];a==null&&(a=n[n.length-1]);const l=r[i]||0;let c=r[t];return c==null&&(c=r[r.length-1]),{startY:o,endY:a,startX:l,endX:c}}function MI(e,t,n,r){return Ea(e,t,n,r)}function Pn(e,t,n,r,s){e=Z.clamp(e,0,n.length-1),t=Z.clamp(t,0,r.length-1);let{startY:i,endY:o,startX:a,endX:l}=Ea(e,t,n,r);if(!s)return{startY:i,endY:o,startX:a,endX:l,isMerged:!1,isMergedMainCell:!1,actualRow:e,actualColumn:t,mergeInfo:{startY:i,endY:o,startX:a,endX:l,startRow:e,startColumn:t,endRow:e,endColumn:t}};const{isMerged:c,isMergedMainCell:u,startRow:h,startColumn:d,endRow:f,endColumn:g}=s;let _={startRow:h,startColumn:d,endRow:f,endColumn:g,startY:i,endY:o,startX:a,endX:l};const R=n.length-1,b=r.length-1;if(c&&h!==-1&&d!==-1){const F=n[h-1]||0,k=n[f]||n[R],W=r[d-1]||0,S=r[g]||r[b];_={..._,startY:F,endY:k,startX:W,endX:S}}else if(!c&&f!==-1&&g!==-1){const F=n[f]||n[R],k=r[g]||r[b];_={..._,startY:i,endY:F,startX:a,endX:k}}return{isMerged:c,isMergedMainCell:u,actualRow:e,actualColumn:t,startY:i,endY:o,startX:a,endX:l,mergeInfo:_}}function Sd(e,t,n,r){const{x:s}=n;return e/t+s-r}function Od(e,t,n,r){const{y:s}=n;return e=e/t+s-r,e}const DI=["script","style","meta","comment","link"];var wd=(e=>(e[e.INFO=0]="INFO",e[e.STOP=1]="STOP",e[e.WARNING=2]="WARNING",e))(wd||{}),vd=(e=>(e[e.DISABLED=0]="DISABLED",e[e.FULL_ALPHA=1]="FULL_ALPHA",e[e.FULL_HANGUL=2]="FULL_HANGUL",e[e.FULL_KATAKANA=3]="FULL_KATAKANA",e[e.HALF_ALPHA=4]="HALF_ALPHA",e[e.HALF_HANGUL=5]="HALF_HANGUL",e[e.HALF_KATAKANA=6]="HALF_KATAKANA",e[e.HIRAGANA=7]="HIRAGANA",e[e.NO_CONTROL=8]="NO_CONTROL",e[e.OFF=9]="OFF",e[e.ON=10]="ON",e))(vd||{}),bd=(e=>(e.BETWEEN="between",e.EQUAL="equal",e.GREATER_THAN="greaterThan",e.GREATER_THAN_OR_EQUAL="greaterThanOrEqual",e.LESS_THAN="lessThan",e.LESS_THAN_OR_EQUAL="lessThanOrEqual",e.NOT_BETWEEN="notBetween",e.NOT_EQUAL="notEqual",e))(bd||{}),yd=(e=>(e[e.TEXT=0]="TEXT",e[e.ARROW=1]="ARROW",e[e.CUSTOM=2]="CUSTOM",e))(yd||{}),Ad=(e=>(e.VALID="valid",e.INVALID="invalid",e.VALIDATING="validating",e))(Ad||{}),Td=(e=>(e.CUSTOM="custom",e.LIST="list",e.LIST_MULTIPLE="listMultiple",e.NONE="none",e.TEXT_LENGTH="textLength",e.DATE="date",e.TIME="time",e.WHOLE="whole",e.DECIMAL="decimal",e.CHECKBOX="checkbox",e.ANY="any",e))(Td||{}),LI=Object.getOwnPropertyDescriptor,xI=(e,t,n,r)=>{for(var s=r>1?void 0:r?LI(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=o(s)||s);return s},Dl=(e,t)=>(n,r)=>t(n,r,e);let ho=class extends Xe{constructor(e,t){super(),this._resourceManagerService=e,this._univerInstanceService=t,this._init()}_init(){const e=n=>{n.businesses.forEach(r=>{switch(r){case we.UNRECOGNIZED:case we.UNIVER_UNKNOWN:case we.UNIVER_SLIDE:case we.UNIVER_DOC:{this._univerInstanceService.getAllUnitsForType(we.UNIVER_DOC).forEach(s=>{const o=(s.getSnapshot().resources||[]).find(a=>a.name===n.pluginName);if(o)try{const a=n.parseJson(o.data);n.onLoad(s.getUnitId(),a)}catch{console.error(`Load Document{${s.getUnitId()}} Resources{${n.pluginName}} Data Error.`)}});break}case we.UNIVER_SHEET:this._univerInstanceService.getAllUnitsForType(we.UNIVER_SHEET).forEach(s=>{const o=(s.getSnapshot().resources||[]).find(a=>a.name===n.pluginName);if(o)try{const a=n.parseJson(o.data);n.onLoad(s.getUnitId(),a)}catch{console.error(`Load Workbook{${s.getUnitId()}} Resources{${n.pluginName}} Data Error.`)}})}})};this._resourceManagerService.getAllResourceHooks().forEach(n=>e(n)),this.disposeWithMe(this._resourceManagerService.register$.subscribe(n=>e(n))),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitAdded$(we.UNIVER_SHEET).subscribe(n=>{this._resourceManagerService.loadResources(n.getUnitId(),n.getSnapshot().resources)})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitAdded$(we.UNIVER_DOC).subscribe(n=>{const r=n.getUnitId();Bl(r)||this._resourceManagerService.loadResources(n.getUnitId(),n.getSnapshot().resources)})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitDisposed$(we.UNIVER_SHEET).subscribe(n=>{this._resourceManagerService.unloadResources(n.getUnitId(),we.UNIVER_SHEET)})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitDisposed$(we.UNIVER_DOC).subscribe(n=>{this._resourceManagerService.unloadResources(n.getUnitId(),we.UNIVER_DOC)}))}saveUnit(e){const t=this._univerInstanceService.getUnit(e);if(!t)return null;const n=this._resourceManagerService.getResources(e,t.type),r=Z.deepClone(t.getSnapshot());return r.resources=n,r}};ho=xI([Dl(0,ye.Inject(ri)),Dl(1,ye.Inject(qn))],ho);class UI{constructor(t={},n){p(this,"_startedTypes",new Set);p(this,"_injector");p(this,"_disposingCallbacks",new zs);const r=this._injector=PI(n,t==null?void 0:t.override),{theme:s,darkMode:i,locale:o,locales:a,logLevel:l,logCommandExecution:c}=t;s&&this._injector.get(Bs).setTheme(s),i&&this._injector.get(Bs).setDarkMode(i),a&&this._injector.get(Rn).load(a),o&&this._injector.get(Rn).setLocale(o),l&&this._injector.get(mt).setLogLevel(l),c!==void 0&&this._injector.get($r).setConfig(Ns,c),this._init(r)}get _univerInstanceService(){return this._injector.get(qn)}get _pluginService(){return this._injector.get(exports.PluginService)}__getInjector(){return this._injector}onDispose(t){const n=this._disposingCallbacks.add(Ye(t));return Ye(()=>n.dispose(!0))}dispose(){this._disposingCallbacks.dispose(),this._injector.dispose()}setLocale(t){this._injector.get(Rn).setLocale(t)}createUnit(t,n){return this._univerInstanceService.createUnit(t,n)}createUniverSheet(t){return this._injector.get(mt).warn("[Univer]","Univer.createUniverSheet is deprecated, use createUnit instead"),this._univerInstanceService.createUnit(we.UNIVER_SHEET,t)}createUniverDoc(t){return this._injector.get(mt).warn("[Univer]","Univer.createUniverDoc is deprecated, use createUnit instead"),this._univerInstanceService.createUnit(we.UNIVER_DOC,t)}createUniverSlide(t){return this._injector.get(mt).warn("[Univer]","Univer.createUniverSlide is deprecated, use createUnit instead"),this._univerInstanceService.createUnit(we.UNIVER_SLIDE,t)}_init(t){this._univerInstanceService.registerCtorForType(we.UNIVER_SHEET,exports.Workbook),this._univerInstanceService.registerCtorForType(we.UNIVER_DOC,Dt),this._univerInstanceService.registerCtorForType(we.UNIVER_SLIDE,ga);const n=t.get(qn);n.__setCreateHandler((r,s,i,o)=>{if(!this._startedTypes.has(r)){this._pluginService.startPluginsForType(r),this._startedTypes.add(r);const l=t.createInstance(i,s);return n.__addUnit(l,o),this._tryProgressToReady(),l}const a=t.createInstance(i,s);return n.__addUnit(a,o),a})}_tryProgressToReady(){this._injector.get(exports.LifecycleService).stage<Pe.Ready&&(this._injector.get(exports.LifecycleService).stage=Pe.Ready)}registerPlugin(t,n){this._pluginService.registerPlugin(t,n)}registerPlugins(t){t.forEach(n=>{const[r,s]=n;this._pluginService.registerPlugin(r,s)})}}function PI(e,t){const n=fd([[Wh],[Rn],[Bs],[exports.LifecycleService],[exports.PluginService],[Ur],[qn,{useClass:exports.UniverInstanceService}],[hd,{useClass:dd}],[mt,{useClass:pu,lazy:!0}],[Wr,{useClass:exports.CommandService}],[si,{useClass:exports.LocalUndoRedoService,lazy:!0}],[$r,{useClass:mu}],[er,{useClass:gu}],[ri,{useClass:exports.ResourceManagerService,lazy:!0}],[co,{useClass:ho,lazy:!0}],[Bh,{useClass:exports.AuthzIoLocalService}],[ud,{useClass:exports.MentionIOLocalService,lazy:!0}]],t),r=e?e.createChild(n):new ye.Injector(n);return $l(r,[[Ur],[co]]),r}Pd();exports.ABCToNumber=J0;exports.AUTO_HEIGHT_FOR_MERGED_CELLS=Hl;exports.AbsoluteRefType=Me;exports.ActionIterator=Un;exports.AlignTypeH=su;exports.AlignTypeV=iu;exports.ArrangeTypeEnum=lu;exports.ArrowsAndMarkersShapes=Nc;exports.AsyncInterceptorManager=sf;exports.AsyncLock=zd;exports.AutoFillSeries=Cc;exports.BaselineOffset=Vt;exports.BasicShapes=Tc;exports.BlockType=Fc;exports.BooleanNumber=ie;exports.BorderStyleTypes=xe;exports.BorderType=Rc;exports.BuildTextUtils=et;exports.BulletAlignment=Br;exports.COLORS=$i;exports.COMMAND_LOG_EXECUTION_CONFIG_KEY=Ns;exports.CanceledError=Zd;exports.CellModeEnum=Hn;exports.CellValueType=nn;exports.Color=On;exports.ColorBuilder=qs;exports.ColorKit=Rt;exports.ColorType=It;exports.ColumnSeparatorType=$c;exports.CommandType=jr;exports.CommonHideTypes=Ic;exports.ConfigService=mu;exports.ContextService=gu;exports.CopyPasteType=Sc;exports.CustomCommandExecutionError=ws;exports.CustomDecorationType=En;exports.CustomRangeType=on;exports.DEFAULT_CELL=y0;exports.DEFAULT_DOC=da;exports.DEFAULT_DOCUMENT_SUB_COMPONENT_ID=hR;exports.DEFAULT_EMPTY_DOCUMENT_VALUE=kl;exports.DEFAULT_NUMBER_FORMAT=aa;exports.DEFAULT_RANGE=v0;exports.DEFAULT_RANGE_ARRAY=w0;exports.DEFAULT_SELECTION=b0;exports.DEFAULT_SLIDE=ah;exports.DEFAULT_STYLES=it;exports.DEFAULT_TEXT_FORMAT=Ju;exports.DEFAULT_TEXT_FORMAT_EXCEL=Zu;exports.DEFAULT_WORKSHEET_COLUMN_COUNT=Qh;exports.DEFAULT_WORKSHEET_COLUMN_COUNT_KEY=YR;exports.DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT=rd;exports.DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT_KEY=KR;exports.DEFAULT_WORKSHEET_COLUMN_WIDTH=td;exports.DEFAULT_WORKSHEET_COLUMN_WIDTH_KEY=zR;exports.DEFAULT_WORKSHEET_ROW_COUNT=Zh;exports.DEFAULT_WORKSHEET_ROW_COUNT_KEY=WR;exports.DEFAULT_WORKSHEET_ROW_HEIGHT=ed;exports.DEFAULT_WORKSHEET_ROW_HEIGHT_KEY=VR;exports.DEFAULT_WORKSHEET_ROW_TITLE_WIDTH=nd;exports.DEFAULT_WORKSHEET_ROW_TITLE_WIDTH_KEY=GR;exports.DOCS_COMMENT_EDITOR_UNIT_ID_KEY=Pl;exports.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY=mo;exports.DOCS_NORMAL_EDITOR_UNIT_ID_KEY=fo;exports.DOCS_ZEN_EDITOR_UNIT_ID_KEY=Ul;exports.DOC_DRAWING_PRINTING_COMPONENT_KEY=D0;exports.DOC_RANGE_TYPE=Tu;exports.DashStyleType=Gc;exports.DataStreamTreeNodeType=xh;exports.DataStreamTreeTokenType=lt;exports.DataValidationErrorStyle=wd;exports.DataValidationImeMode=vd;exports.DataValidationOperator=bd;exports.DataValidationRenderMode=yd;exports.DataValidationStatus=Ad;exports.DataValidationType=Td;exports.DeleteDirection=Oc;exports.DependentOn=mI;exports.DesktopLogService=pu;exports.DeveloperMetadataVisibility=wc;exports.Dimension=vc;exports.Direction=bc;exports.Disposable=Xe;exports.DisposableCollection=zs;exports.DocStyleType=Pc;exports.DocumentDataModel=Dt;exports.DocumentFlavor=vo;exports.DrawingTypeEnum=cu;exports.EDITOR_ACTIVATED=$h;exports.EXTENSION_NAMES=lh;exports.ErrorService=Wh;exports.EventState=Hh;exports.EventSubject=dR;exports.FOCUSING_COMMENT_EDITOR=OR;exports.FOCUSING_COMMON_DRAWINGS=bR;exports.FOCUSING_DOC=Sr;exports.FOCUSING_EDITOR_BUT_HIDDEN=CR;exports.FOCUSING_EDITOR_INPUT_FORMULA=RR;exports.FOCUSING_EDITOR_STANDALONE=SR;exports.FOCUSING_FX_BAR_EDITOR=jh;exports.FOCUSING_PANEL_EDITOR=wR;exports.FOCUSING_SHEET=jn;exports.FOCUSING_SLIDE=Or;exports.FOCUSING_UNIT=Ir;exports.FOCUSING_UNIVER_EDITOR=IR;exports.FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE=vR;exports.FORMULA_EDITOR_ACTIVATED=yR;exports.FollowNumberWithType=kc;exports.FontItalic=As;exports.FontStyleType=Fn;exports.FontWeight=Ts;exports.GridType=Hc;exports.HLSColor=wu;exports.HorizontalAlign=Nt;exports.IAuthzIoService=Bh;exports.ICommandService=Wr;exports.IConfigService=$r;exports.IConfirmService=pR;exports.IContextService=er;exports.IImageIoService=io;exports.ILocalStorageService=oI;exports.ILogService=mt;exports.IMentionIOService=ud;exports.IPermissionService=hd;exports.IResourceLoaderService=co;exports.IResourceManagerService=ri;exports.IS_ROW_STYLE_PRECEDE_COLUMN_STYLE=Fl;exports.IURLImageService=oo;exports.IUndoRedoService=si;exports.IUniverInstanceService=qn;exports.ImageCacheMap=Rd;exports.ImageSourceType=Hs;exports.ImageUploadStatusType=Yh;exports.InterceptorEffectEnum=kn;exports.InterceptorManager=tf;exports.InterpolationPointType=yc;exports.JSON1=W_;exports.JSONX=Gt;exports.LRUHelper=Er;exports.LRUMap=Lr;exports.LifecycleStages=Pe;exports.LifecycleUnreachableError=ld;exports.ListGlyphType=fe;exports.LocaleService=Rn;exports.LocaleType=Hr;exports.LogLevel=_u;exports.MOVE_BUFFER_VALUE=hr;exports.MemoryCursor=vn;exports.MentionType=ys;exports.NAMED_STYLE_MAP=T0;exports.NAMED_STYLE_SPACE_MAP=N0;exports.NamedStyleType=qe;exports.NilCommand=Eu;exports.NumberUnitType=ru;exports.ObjectMatrix=ct;exports.ObjectRelativeFromH=tu;exports.ObjectRelativeFromV=nu;exports.OtherShapes=Mc;exports.PAGE_SIZE=L0;exports.PAPER_TYPES=x_;exports.PRESET_LIST_TYPE=zr;exports.PRINT_CHART_COMPONENT_KEY=M0;exports.PageElementType=uu;exports.PageOrientType=au;exports.PageType=bo;exports.PaperType=ht;exports.ParagraphElementType=Wc;exports.ParagraphStyleBuilder=xr;exports.ParagraphStyleValue=Kr;exports.PermissionService=dd;exports.PermissionStatus=_a;exports.Plugin=lo;exports.PositionedObjectLayoutType=Vc;exports.PresetListType=Ft;exports.ProtectionType=Ac;exports.QuickListType=vh;exports.QuickListTypeMap=lC;exports.RANGE_DIRECTION=Au;exports.RANGE_TYPE=_e;exports.RBush=Us;exports.RCDisposable=C_;exports.RGBA_PAREN=ip;exports.RGB_PAREN=sp;exports.ROTATE_BUFFER_VALUE=Su;exports.RTree=OI;exports.Range=Xn;exports.Rectangle=zt;exports.RedoCommand=Cd;exports.RedoCommandId=_d;exports.RefAlias=q0;exports.Registry=So;exports.RegistryAsMap=Oo;exports.RelativeDate=Lc;exports.RelativeSlideLink=hu;exports.RgbColor=Ms;exports.RichTextBuilder=Cn;exports.RichTextValue=tn;exports.RxDisposable=E_;exports.SHEET_EDITOR_UNITS=A0;exports.SectionType=Bc;exports.SheetTypes=xc;exports.SheetViewModel=id;exports.SliceBodyType=ha;exports.SlideDataModel=ga;exports.SpacingRule=zc;exports.SpecialShapes=Dc;exports.Styles=Vh;exports.THEME_COLORS=Ou;exports.TabStopAlignment=Kc;exports.TableAlignmentType=qc;exports.TableLayoutType=Jc;exports.TableRowHeightRule=Qc;exports.TableSizeType=Xc;exports.TableTextWrapType=Zc;exports.TestConfirmService=ER;exports.TextDecoration=Uc;exports.TextDecorationBuilder=en;exports.TextDirection=Nr;exports.TextDirectionType=jc;exports.TextStyleBuilder=sn;exports.TextStyleValue=Gr;exports.TextX=De;exports.TextXActionType=q;exports.ThemeColor=Ds;exports.ThemeColorType=ot;exports.ThemeColors=Ks;exports.ThemeService=Bs;exports.Tools=Z;exports.UndoCommand=Ed;exports.UndoCommandId=pd;exports.UnitModel=Gs;exports.Univer=UI;exports.UniverInstanceType=we;exports.UpdateDocsAttributeType=Ee;exports.UserManagerService=Ur;exports.VerticalAlign=pn;exports.VerticalAlignmentType=eu;exports.Worksheet=Pr;exports.WrapStrategy=Sn;exports.WrapTextType=Yc;exports.addLinkToDocumentModel=zh;exports.afterInitApply=Q_;exports.afterTime=J_;exports.awaitTime=wI;exports.binSearchFirstGreaterThanTarget=Iu;exports.binarySearchArray=ep;exports.bufferDebounceTime=q_;exports.cellToRange=DE;exports.characterSpacingControlType=ou;exports.checkForSubstrings=xE;exports.checkIfMove=np;exports.checkParagraphHasBullet=_0;exports.checkParagraphHasIndent=p0;exports.checkParagraphHasIndentByStyle=sh;exports.cloneCellData=Xh;exports.cloneCellDataMatrix=qh;exports.cloneCellDataWithSpanAndDisplay=FR;exports.cloneValue=gt;exports.cloneWorksheetData=Jh;exports.codeToBlob=tp;exports.composeBody=to;exports.composeInterceptors=Wl;exports.composeStyles=cr;exports.concatMatrixArray=IE;exports.convertBodyToHtml=rp;exports.convertCellToRange=eh;exports.convertObservableToBehaviorSubject=Z_;exports.covertCellValue=Ji;exports.covertCellValues=LE;exports.covertTextRunToHtml=Bi;exports.createAsyncInterceptorKey=nf;exports.createDefaultUser=Fs;exports.createDocumentModelWithStyle=wr;exports.createInterceptorKey=ef;exports.createInternalEditorID=Xd;exports.createREGEXFromWildChar=D_;exports.createRowColIter=Zi;exports.customNameCharacterCheck=SI;exports.dayjs=Xt;exports.debounce=i_;exports.dedupe=kd;exports.dedupeBy=Fd;exports.deepCompare=la;exports.delayAnimationFrame=vI;exports.deleteContent=oh;exports.extractPureTextFromCell=od;exports.fromCallback=Cu;exports.fromEventSubject=fR;exports.generateRandomId=nt;exports.get=cc;exports.getArrayLength=rn;exports.getBodySlice=Mt;exports.getBodySliceHtml=hs;exports.getBorderStyleType=TE;exports.getCellCoordByIndexSimple=Ea;exports.getCellInfoInMergeData=Sp;exports.getCellPositionByIndexSimple=MI;exports.getCellValueType=Cp;exports.getCellWithCoordByIndexCore=Pn;exports.getColorStyle=Pt;exports.getCustomBlockSlice=Th;exports.getCustomDecorationSlice=Mh;exports.getCustomRangeSlice=Nh;exports.getDocsUpdateBody=NE;exports.getEmptyCell=UR;exports.getIntersectRange=uh;exports.getNumfmtParseValueFilter=Qu;exports.getOriginCellValue=qR;exports.getParagraphsSlice=Ah;exports.getPlainText=ni;exports.getReverseDirection=L_;exports.getSectionBreakSlice=pC;exports.getTableSlice=yh;exports.getTextRunSlice=ks;exports.getTransformOffsetX=Sd;exports.getTransformOffsetY=Od;exports.getWorksheetUID=eI;exports.groupBy=$d;exports.handleStyleToString=AE;exports.hashAlgorithm=C0;exports.horizontalLineSegmentsSubtraction=ti;exports.insertMatrixArray=RE;exports.insertTextToContent=ih;exports.invertColorByHSL=hf;exports.invertColorByMatrix=ff;exports.isBlackColor=pp;exports.isBooleanString=Kd;exports.isCellCoverable=qi;exports.isCellV=yu;exports.isCommentEditorID=qd;exports.isDefaultFormat=gE;exports.isEmptyCell=th;exports.isFormulaId=yE;exports.isFormulaString=nh;exports.isICellData=bu;exports.isInternalEditorID=Bl;exports.isNodeEnv=M_;exports.isNotNullOrUndefined=Gh;exports.isNullCell=Rp;exports.isNumeric=fc;exports.isPatternEqualWithoutDecimal=_E;exports.isRangesEqual=MR;exports.isRealNum=E0;exports.isSafeNumeric=f_;exports.isSameStyleTextRun=rh;exports.isTextFormat=mE;exports.isUnitRangesEqual=DR;exports.isValidRange=ME;exports.isWhiteColor=Ep;exports.makeArray=jd;exports.makeCellRangeToRangeData=bE;exports.makeCellToSelection=vE;exports.makeCustomRangeStream=MC;exports.mapObjectMatrix=CE;exports.merge=Vs;exports.mergeLocales=R0;exports.mergeOverrideWithDependencies=fd;exports.mergeSets=__;exports.mergeWith=c_;exports.mergeWorksheetSnapshotWithDefault=sd;exports.mixinClass=d_;exports.moveMatrixArray=Xi;exports.moveRangeByOffset=B0;exports.nameCharacterCheck=II;exports.normalizeBody=EC;exports.normalizeTextRuns=Vr;exports.numberToABC=Q0;exports.numberToListABC=eC;exports.numfmt=fE;exports.queryObjectMatrix=X0;exports.registerDependencies=Jd;exports.remove=kr;exports.repeatStringNumTimes=dh;exports.replaceInDocumentBody=cR;exports.requestImmediateMacroTask=g_;exports.resolveWithBasePath=O_;exports.rotate=Bd;exports.searchArray=ur;exports.searchInOrderedArray=Ru;exports.selectionToArray=Ip;exports.sequence=gc;exports.sequenceAsync=mc;exports.sequenceExecute=Xs;exports.sequenceExecuteAsync=X_;exports.set=h_;exports.shallowEqual=jl;exports.skipParseTagNames=DI;exports.sliceMatrixArray=SE;exports.sortRules=tC;exports.sortRulesByDesc=nC;exports.sortRulesFactory=Yr;exports.spliceArray=Ki;exports.splitIntoGrid=ca;exports.takeAfter=Hi;exports.textDiff=fa;exports.throttle=Qd;exports.toDisposable=Ye;exports.touchDependencies=$l;exports.updateAttributeByDelete=Dh;exports.updateAttributeByInsert=Lh;exports.willLoseNumericPrecision=m_;Object.keys(ye).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:()=>ye[e]})});
|