@univerjs/core 0.5.4 → 0.5.5-experimental.20250122-3362a4a

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 CHANGED
@@ -1,11 +1,12 @@
1
- "use strict";var rh=Object.defineProperty;var sh=(e,t,n)=>t in e?rh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var C=(e,t,n)=>sh(e,typeof t!="symbol"?t+"":t,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Oe=require("rxjs"),$r=require("rxjs/operators"),lt=require("react");function ih(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}function oh(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 wt=ih(lt);function ah(){lh()}const Or=typeof global<"u"?global:typeof self<"u"?self:window;function lh(){typeof Or.requestIdleCallback!="function"&&(Or.requestIdleCallback=function(n){const r=Date.now();return setTimeout(function(){const i=Math.max(0,50-(Date.now()-r));n({didTimeout:i===0,timeRemaining(){return i}})},1)}),typeof Or.cancelIdleCallback!="function"&&(Or.cancelIdleCallback=function(n){clearTimeout(n)})}var Pa=typeof global=="object"&&global&&global.Object===Object&&global,uh=typeof self=="object"&&self&&self.Object===Object&&self,Cn=Pa||uh||Function("return this")(),Ln=Cn.Symbol,Fa=Object.prototype,ch=Fa.hasOwnProperty,hh=Fa.toString,Gn=Ln?Ln.toStringTag:void 0;function dh(e){var t=ch.call(e,Gn),n=e[Gn];try{e[Gn]=void 0;var r=!0}catch{}var s=hh.call(e);return r&&(t?e[Gn]=n:delete e[Gn]),s}var fh=Object.prototype,gh=fh.toString;function ph(e){return gh.call(e)}var mh="[object Null]",_h="[object Undefined]",fo=Ln?Ln.toStringTag:void 0;function fr(e){return e==null?e===void 0?_h:mh:fo&&fo in Object(e)?dh(e):ph(e)}function Bn(e){return e!=null&&typeof e=="object"}var Eh="[object Symbol]";function ps(e){return typeof e=="symbol"||Bn(e)&&fr(e)==Eh}function Ch(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 Un=Array.isArray,go=Ln?Ln.prototype:void 0,po=go?go.toString:void 0;function ka(e){if(typeof e=="string")return e;if(Un(e))return Ch(e,ka)+"";if(ps(e))return po?po.call(e):"";var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}var Rh=/\s/;function Ih(e){for(var t=e.length;t--&&Rh.test(e.charAt(t)););return t}var vh=/^\s+/;function yh(e){return e&&e.slice(0,Ih(e)+1).replace(vh,"")}function yt(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var mo=NaN,Sh=/^[-+]0x[0-9a-f]+$/i,Oh=/^0b[01]+$/i,bh=/^0o[0-7]+$/i,wh=parseInt;function _o(e){if(typeof e=="number")return e;if(ps(e))return mo;if(yt(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=yt(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=yh(e);var n=Oh.test(e);return n||bh.test(e)?wh(e.slice(2),n?2:8):Sh.test(e)?mo:+e}function $a(e){return e}var Ah="[object AsyncFunction]",Th="[object Function]",Nh="[object GeneratorFunction]",Mh="[object Proxy]";function Oi(e){if(!yt(e))return!1;var t=fr(e);return t==Th||t==Nh||t==Ah||t==Mh}var ws=Cn["__core-js_shared__"],Eo=function(){var e=/[^.]+$/.exec(ws&&ws.keys&&ws.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function Dh(e){return!!Eo&&Eo in e}var xh=Function.prototype,Lh=xh.toString;function Uh(e){if(e!=null){try{return Lh.call(e)}catch{}try{return e+""}catch{}}return""}var Ph=/[\\^$.*+?()[\]{}|]/g,Fh=/^\[object .+?Constructor\]$/,kh=Function.prototype,$h=Object.prototype,Bh=kh.toString,jh=$h.hasOwnProperty,Hh=RegExp("^"+Bh.call(jh).replace(Ph,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Wh(e){if(!yt(e)||Dh(e))return!1;var t=Oi(e)?Hh:Fh;return t.test(Uh(e))}function zh(e,t){return e==null?void 0:e[t]}function bi(e,t){var n=zh(e,t);return Wh(n)?n:void 0}var Co=Object.create,Yh=function(){function e(){}return function(t){if(!yt(t))return{};if(Co)return Co(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function Vh(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 Gh(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}var Kh=800,Xh=16,Qh=Date.now;function qh(e){var t=0,n=0;return function(){var r=Qh(),s=Xh-(r-n);if(n=r,s>0){if(++t>=Kh)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function Jh(e){return function(){return e}}var es=function(){try{var e=bi(Object,"defineProperty");return e({},"",{}),e}catch{}}(),Zh=es?function(e,t){return es(e,"toString",{configurable:!0,enumerable:!1,value:Jh(t),writable:!0})}:$a,ed=qh(Zh),td=9007199254740991,nd=/^(?:0|[1-9]\d*)$/;function wi(e,t){var n=typeof e;return t=t==null?td:t,!!t&&(n=="number"||n!="symbol"&&nd.test(e))&&e>-1&&e%1==0&&e<t}function Ai(e,t,n){t=="__proto__"&&es?es(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function ms(e,t){return e===t||e!==e&&t!==t}var rd=Object.prototype,sd=rd.hasOwnProperty;function Ba(e,t,n){var r=e[t];(!(sd.call(e,t)&&ms(r,n))||n===void 0&&!(t in e))&&Ai(e,t,n)}function id(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?Ai(n,a,l):Ba(n,a,l)}return n}var Ro=Math.max;function od(e,t,n){return t=Ro(t===void 0?e.length-1:t,0),function(){for(var r=arguments,s=-1,i=Ro(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),Vh(e,this,a)}}function ad(e,t){return ed(od(e,t,$a),e+"")}var ld=9007199254740991;function ja(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=ld}function Ti(e){return e!=null&&ja(e.length)&&!Oi(e)}function ud(e,t,n){if(!yt(n))return!1;var r=typeof t;return(r=="number"?Ti(n)&&wi(t,n.length):r=="string"&&t in n)?ms(n[t],e):!1}function Ha(e){return ad(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&&ud(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 cd=Object.prototype;function Wa(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||cd;return e===n}function hd(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}var dd="[object Arguments]";function Io(e){return Bn(e)&&fr(e)==dd}var za=Object.prototype,fd=za.hasOwnProperty,gd=za.propertyIsEnumerable,zs=Io(function(){return arguments}())?Io:function(e){return Bn(e)&&fd.call(e,"callee")&&!gd.call(e,"callee")};function pd(){return!1}var Ya=typeof exports=="object"&&exports&&!exports.nodeType&&exports,vo=Ya&&typeof module=="object"&&module&&!module.nodeType&&module,md=vo&&vo.exports===Ya,yo=md?Cn.Buffer:void 0,_d=yo?yo.isBuffer:void 0,Va=_d||pd,Ed="[object Arguments]",Cd="[object Array]",Rd="[object Boolean]",Id="[object Date]",vd="[object Error]",yd="[object Function]",Sd="[object Map]",Od="[object Number]",bd="[object Object]",wd="[object RegExp]",Ad="[object Set]",Td="[object String]",Nd="[object WeakMap]",Md="[object ArrayBuffer]",Dd="[object DataView]",xd="[object Float32Array]",Ld="[object Float64Array]",Ud="[object Int8Array]",Pd="[object Int16Array]",Fd="[object Int32Array]",kd="[object Uint8Array]",$d="[object Uint8ClampedArray]",Bd="[object Uint16Array]",jd="[object Uint32Array]",Je={};Je[xd]=Je[Ld]=Je[Ud]=Je[Pd]=Je[Fd]=Je[kd]=Je[$d]=Je[Bd]=Je[jd]=!0;Je[Ed]=Je[Cd]=Je[Md]=Je[Rd]=Je[Dd]=Je[Id]=Je[vd]=Je[yd]=Je[Sd]=Je[Od]=Je[bd]=Je[wd]=Je[Ad]=Je[Td]=Je[Nd]=!1;function Hd(e){return Bn(e)&&ja(e.length)&&!!Je[fr(e)]}function Wd(e){return function(t){return e(t)}}var Ga=typeof exports=="object"&&exports&&!exports.nodeType&&exports,or=Ga&&typeof module=="object"&&module&&!module.nodeType&&module,zd=or&&or.exports===Ga,As=zd&&Pa.process,So=function(){try{var e=or&&or.require&&or.require("util").types;return e||As&&As.binding&&As.binding("util")}catch{}}(),Oo=So&&So.isTypedArray,Ka=Oo?Wd(Oo):Hd;function Yd(e,t){var n=Un(e),r=!n&&zs(e),s=!n&&!r&&Va(e),i=!n&&!r&&!s&&Ka(e),o=n||r||s||i,a=o?hd(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")||wi(c,l))||a.push(c);return a}function Vd(e,t){return function(n){return e(t(n))}}function Gd(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}var Kd=Object.prototype,Xd=Kd.hasOwnProperty;function Qd(e){if(!yt(e))return Gd(e);var t=Wa(e),n=[];for(var r in e)r=="constructor"&&(t||!Xd.call(e,r))||n.push(r);return n}function Xa(e){return Ti(e)?Yd(e):Qd(e)}var qd=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Jd=/^\w*$/;function Zd(e,t){if(Un(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||ps(e)?!0:Jd.test(e)||!qd.test(e)||t!=null&&e in Object(t)}var cr=bi(Object,"create");function ef(){this.__data__=cr?cr(null):{},this.size=0}function tf(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var nf="__lodash_hash_undefined__",rf=Object.prototype,sf=rf.hasOwnProperty;function of(e){var t=this.__data__;if(cr){var n=t[e];return n===nf?void 0:n}return sf.call(t,e)?t[e]:void 0}var af=Object.prototype,lf=af.hasOwnProperty;function uf(e){var t=this.__data__;return cr?t[e]!==void 0:lf.call(t,e)}var cf="__lodash_hash_undefined__";function hf(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=cr&&t===void 0?cf:t,this}function mn(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])}}mn.prototype.clear=ef;mn.prototype.delete=tf;mn.prototype.get=of;mn.prototype.has=uf;mn.prototype.set=hf;function df(){this.__data__=[],this.size=0}function _s(e,t){for(var n=e.length;n--;)if(ms(e[n][0],t))return n;return-1}var ff=Array.prototype,gf=ff.splice;function pf(e){var t=this.__data__,n=_s(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():gf.call(t,n,1),--this.size,!0}function mf(e){var t=this.__data__,n=_s(t,e);return n<0?void 0:t[n][1]}function _f(e){return _s(this.__data__,e)>-1}function Ef(e,t){var n=this.__data__,r=_s(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function Gt(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])}}Gt.prototype.clear=df;Gt.prototype.delete=pf;Gt.prototype.get=mf;Gt.prototype.has=_f;Gt.prototype.set=Ef;var Qa=bi(Cn,"Map");function Cf(){this.size=0,this.__data__={hash:new mn,map:new(Qa||Gt),string:new mn}}function Rf(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function Es(e,t){var n=e.__data__;return Rf(t)?n[typeof t=="string"?"string":"hash"]:n.map}function If(e){var t=Es(this,e).delete(e);return this.size-=t?1:0,t}function vf(e){return Es(this,e).get(e)}function yf(e){return Es(this,e).has(e)}function Sf(e,t){var n=Es(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=Cf;ln.prototype.delete=If;ln.prototype.get=vf;ln.prototype.has=yf;ln.prototype.set=Sf;var Of="Expected a function";function Ni(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new TypeError(Of);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(Ni.Cache||ln),n}Ni.Cache=ln;var bf=500;function wf(e){var t=Ni(e,function(r){return n.size===bf&&n.clear(),r}),n=t.cache;return t}var Af=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Tf=/\\(\\)?/g,Nf=wf(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(Af,function(n,r,s,i){t.push(s?i.replace(Tf,"$1"):r||n)}),t});function Mf(e){return e==null?"":ka(e)}function qa(e,t){return Un(e)?e:Zd(e,t)?[e]:Nf(Mf(e))}function Ja(e){if(typeof e=="string"||ps(e))return e;var t=e+"";return t=="0"&&1/e==-1/0?"-0":t}function Df(e,t){t=qa(t,e);for(var n=0,r=t.length;e!=null&&n<r;)e=e[Ja(t[n++])];return n&&n==r?e:void 0}function xf(e,t,n){var r=e==null?void 0:Df(e,t);return r===void 0?n:r}var Za=Vd(Object.getPrototypeOf,Object),Lf="[object Object]",Uf=Function.prototype,Pf=Object.prototype,el=Uf.toString,Ff=Pf.hasOwnProperty,kf=el.call(Object);function $f(e){if(!Bn(e)||fr(e)!=Lf)return!1;var t=Za(e);if(t===null)return!0;var n=Ff.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&el.call(n)==kf}function Bf(){this.__data__=new Gt,this.size=0}function jf(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function Hf(e){return this.__data__.get(e)}function Wf(e){return this.__data__.has(e)}var zf=200;function Yf(e,t){var n=this.__data__;if(n instanceof Gt){var r=n.__data__;if(!Qa||r.length<zf-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 jn(e){var t=this.__data__=new Gt(e);this.size=t.size}jn.prototype.clear=Bf;jn.prototype.delete=jf;jn.prototype.get=Hf;jn.prototype.has=Wf;jn.prototype.set=Yf;var tl=typeof exports=="object"&&exports&&!exports.nodeType&&exports,bo=tl&&typeof module=="object"&&module&&!module.nodeType&&module,Vf=bo&&bo.exports===tl,wo=Vf?Cn.Buffer:void 0;wo&&wo.allocUnsafe;function Gf(e,t){return e.slice()}var Ao=Cn.Uint8Array;function Kf(e){var t=new e.constructor(e.byteLength);return new Ao(t).set(new Ao(e)),t}function Xf(e,t){var n=Kf(e.buffer);return new e.constructor(n,e.byteOffset,e.length)}function Qf(e){return typeof e.constructor=="function"&&!Wa(e)?Yh(Za(e)):{}}function qf(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 Jf=qf(),Ts=function(){return Cn.Date.now()},Zf="Expected a function",eg=Math.max,tg=Math.min;function ng(e,t,n){var r,s,i,o,a,l,c=0,h=!1,u=!1,d=!0;if(typeof e!="function")throw new TypeError(Zf);t=_o(t)||0,yt(n)&&(h=!!n.leading,u="maxWait"in n,i=u?eg(_o(n.maxWait)||0,t):i,d="trailing"in n?!!n.trailing:d);function f(A){var H=r,J=s;return r=s=void 0,c=A,o=e.apply(J,H),o}function E(A){return c=A,a=setTimeout(T,t),h?f(A):o}function R(A){var H=A-l,J=A-c,de=t-H;return u?tg(de,i-J):de}function O(A){var H=A-l,J=A-c;return l===void 0||H>=t||H<0||u&&J>=i}function T(){var A=Ts();if(O(A))return V(A);a=setTimeout(T,R(A))}function V(A){return a=void 0,d&&r?f(A):(r=s=void 0,o)}function z(){a!==void 0&&clearTimeout(a),c=0,r=l=s=a=void 0}function oe(){return a===void 0?o:V(Ts())}function N(){var A=Ts(),H=O(A);if(r=arguments,s=this,l=A,H){if(a===void 0)return E(l);if(u)return clearTimeout(a),a=setTimeout(T,t),f(l)}return a===void 0&&(a=setTimeout(T,t)),o}return N.cancel=z,N.flush=oe,N}function Ys(e,t,n){(n!==void 0&&!ms(e[t],n)||n===void 0&&!(t in e))&&Ai(e,t,n)}function rg(e){return Bn(e)&&Ti(e)}function Vs(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}function sg(e){return id(e,Xa(e))}function ig(e,t,n,r,s,i,o){var a=Vs(e,n),l=Vs(t,n),c=o.get(l);if(c){Ys(e,n,c);return}var h=i?i(a,l,n+"",e,t,o):void 0,u=h===void 0;if(u){var d=Un(l),f=!d&&Va(l),E=!d&&!f&&Ka(l);h=l,d||f||E?Un(a)?h=a:rg(a)?h=Gh(a):f?(u=!1,h=Gf(l)):E?(u=!1,h=Xf(l)):h=[]:$f(l)||zs(l)?(h=a,zs(a)?h=sg(a):(!yt(a)||Oi(a))&&(h=Qf(l))):u=!1}u&&(o.set(l,h),s(h,l,r,i,o),o.delete(l)),Ys(e,n,h)}function Mi(e,t,n,r,s){e!==t&&Jf(t,function(i,o){if(s||(s=new jn),yt(i))ig(e,t,o,n,Mi,r,s);else{var a=r?r(Vs(e,o),i,o+"",e,t,s):void 0;a===void 0&&(a=i),Ys(e,o,a)}},Xa)}var og=Ha(function(e,t,n,r){Mi(e,t,n,r)}),Di=Ha(function(e,t,n){Mi(e,t,n)});function ag(e,t,n,r){if(!yt(e))return e;t=qa(t,e);for(var s=-1,i=t.length,o=i-1,a=e;a!=null&&++s<i;){var l=Ja(t[s]),c=n;if(l==="__proto__"||l==="constructor"||l==="prototype")return e;if(s!=o){var h=a[l];c=void 0,c===void 0&&(c=yt(h)?h:wi(t[s+1])?[]:{})}Ba(a,l,c),a=a[l]}return e}function lg(e,t,n){return e==null?e:ag(e,t,n)}function St(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ns,To;function ug(){if(To)return Ns;To=1;var e=-1,t=1,n=0;function r(m,j,y,D,b){if(m===j)return m?[[n,m]]:[];if(y!=null){var S=de(m,j,y);if(S)return S}var F=a(m,j),$=m.substring(0,F);m=m.substring(F),j=j.substring(F),F=c(m,j);var G=m.substring(m.length-F);m=m.substring(0,m.length-F),j=j.substring(0,j.length-F);var se=s(m,j);return $&&se.unshift([n,$]),G&&se.push([n,G]),V(se,b),D&&u(se),se}function s(m,j){var y;if(!m)return[[t,j]];if(!j)return[[e,m]];var D=m.length>j.length?m:j,b=m.length>j.length?j:m,S=D.indexOf(b);if(S!==-1)return y=[[t,D.substring(0,S)],[n,b],[t,D.substring(S+b.length)]],m.length>j.length&&(y[0][0]=y[2][0]=e),y;if(b.length===1)return[[e,m],[t,j]];var F=h(m,j);if(F){var $=F[0],G=F[1],se=F[2],he=F[3],ge=F[4],Te=r($,se),we=r(G,he);return Te.concat([[n,ge]],we)}return i(m,j)}function i(m,j){for(var y=m.length,D=j.length,b=Math.ceil((y+D)/2),S=b,F=2*b,$=new Array(F),G=new Array(F),se=0;se<F;se++)$[se]=-1,G[se]=-1;$[S+1]=0,G[S+1]=0;for(var he=y-D,ge=he%2!==0,Te=0,we=0,v=0,k=0,K=0;K<b;K++){for(var Q=-K+Te;Q<=K-we;Q+=2){var Y=S+Q,W;Q===-K||Q!==K&&$[Y-1]<$[Y+1]?W=$[Y+1]:W=$[Y-1]+1;for(var ue=W-Q;W<y&&ue<D&&m.charAt(W)===j.charAt(ue);)W++,ue++;if($[Y]=W,W>y)we+=2;else if(ue>D)Te+=2;else if(ge){var ae=S+he-Q;if(ae>=0&&ae<F&&G[ae]!==-1){var B=y-G[ae];if(W>=B)return o(m,j,W,ue)}}}for(var te=-K+v;te<=K-k;te+=2){var ae=S+te,B;te===-K||te!==K&&G[ae-1]<G[ae+1]?B=G[ae+1]:B=G[ae-1]+1;for(var ie=B-te;B<y&&ie<D&&m.charAt(y-B-1)===j.charAt(D-ie-1);)B++,ie++;if(G[ae]=B,B>y)k+=2;else if(ie>D)v+=2;else if(!ge){var Y=S+he-te;if(Y>=0&&Y<F&&$[Y]!==-1){var W=$[Y],ue=S+W-Y;if(B=y-B,W>=B)return o(m,j,W,ue)}}}}return[[e,m],[t,j]]}function o(m,j,y,D){var b=m.substring(0,y),S=j.substring(0,D),F=m.substring(y),$=j.substring(D),G=r(b,S),se=r(F,$);return G.concat(se)}function a(m,j){if(!m||!j||m.charAt(0)!==j.charAt(0))return 0;for(var y=0,D=Math.min(m.length,j.length),b=D,S=0;y<b;)m.substring(S,b)==j.substring(S,b)?(y=b,S=y):D=b,b=Math.floor((D-y)/2+y);return z(m.charCodeAt(b-1))&&b--,b}function l(m,j){var y=m.length,D=j.length;if(y==0||D==0)return 0;y>D?m=m.substring(y-D):y<D&&(j=j.substring(0,y));var b=Math.min(y,D);if(m==j)return b;for(var S=0,F=1;;){var $=m.substring(b-F),G=j.indexOf($);if(G==-1)return S;F+=G,(G==0||m.substring(b-F)==j.substring(0,F))&&(S=F,F++)}}function c(m,j){if(!m||!j||m.slice(-1)!==j.slice(-1))return 0;for(var y=0,D=Math.min(m.length,j.length),b=D,S=0;y<b;)m.substring(m.length-b,m.length-S)==j.substring(j.length-b,j.length-S)?(y=b,S=y):D=b,b=Math.floor((D-y)/2+y);return oe(m.charCodeAt(m.length-b))&&b--,b}function h(m,j){var y=m.length>j.length?m:j,D=m.length>j.length?j:m;if(y.length<4||D.length*2<y.length)return null;function b(we,v,k){for(var K=we.substring(k,k+Math.floor(we.length/4)),Q=-1,Y="",W,ue,ae,B;(Q=v.indexOf(K,Q+1))!==-1;){var te=a(we.substring(k),v.substring(Q)),ie=c(we.substring(0,k),v.substring(0,Q));Y.length<ie+te&&(Y=v.substring(Q-ie,Q)+v.substring(Q,Q+te),W=we.substring(0,k-ie),ue=we.substring(k+te),ae=v.substring(0,Q-ie),B=v.substring(Q+te))}return Y.length*2>=we.length?[W,ue,ae,B,Y]:null}var S=b(y,D,Math.ceil(y.length/4)),F=b(y,D,Math.ceil(y.length/2)),$;if(!S&&!F)return null;F?S?$=S[4].length>F[4].length?S:F:$=F:$=S;var G,se,he,ge;m.length>j.length?(G=$[0],se=$[1],he=$[2],ge=$[3]):(he=$[0],ge=$[1],G=$[2],se=$[3]);var Te=$[4];return[G,se,he,ge,Te]}function u(m){for(var j=!1,y=[],D=0,b=null,S=0,F=0,$=0,G=0,se=0;S<m.length;)m[S][0]==n?(y[D++]=S,F=G,$=se,G=0,se=0,b=m[S][1]):(m[S][0]==t?G+=m[S][1].length:se+=m[S][1].length,b&&b.length<=Math.max(F,$)&&b.length<=Math.max(G,se)&&(m.splice(y[D-1],0,[e,b]),m[y[D-1]+1][0]=t,D--,D--,S=D>0?y[D-1]:-1,F=0,$=0,G=0,se=0,b=null,j=!0)),S++;for(j&&V(m),T(m),S=1;S<m.length;){if(m[S-1][0]==e&&m[S][0]==t){var he=m[S-1][1],ge=m[S][1],Te=l(he,ge),we=l(ge,he);Te>=we?(Te>=he.length/2||Te>=ge.length/2)&&(m.splice(S,0,[n,ge.substring(0,Te)]),m[S-1][1]=he.substring(0,he.length-Te),m[S+1][1]=ge.substring(Te),S++):(we>=he.length/2||we>=ge.length/2)&&(m.splice(S,0,[n,he.substring(0,we)]),m[S-1][0]=t,m[S-1][1]=ge.substring(0,ge.length-we),m[S+1][0]=e,m[S+1][1]=he.substring(we),S++),S++}S++}}var d=/[^a-zA-Z0-9]/,f=/\s/,E=/[\r\n]/,R=/\n\r?\n$/,O=/^\r?\n\r?\n/;function T(m){function j(we,v){if(!we||!v)return 6;var k=we.charAt(we.length-1),K=v.charAt(0),Q=k.match(d),Y=K.match(d),W=Q&&k.match(f),ue=Y&&K.match(f),ae=W&&k.match(E),B=ue&&K.match(E),te=ae&&we.match(R),ie=B&&v.match(O);return te||ie?5:ae||B?4:Q&&!W&&ue?3:W||ue?2:Q||Y?1:0}for(var y=1;y<m.length-1;){if(m[y-1][0]==n&&m[y+1][0]==n){var D=m[y-1][1],b=m[y][1],S=m[y+1][1],F=c(D,b);if(F){var $=b.substring(b.length-F);D=D.substring(0,D.length-F),b=$+b.substring(0,b.length-F),S=$+S}for(var G=D,se=b,he=S,ge=j(D,b)+j(b,S);b.charAt(0)===S.charAt(0);){D+=b.charAt(0),b=b.substring(1)+S.charAt(0),S=S.substring(1);var Te=j(D,b)+j(b,S);Te>=ge&&(ge=Te,G=D,se=b,he=S)}m[y-1][1]!=G&&(G?m[y-1][1]=G:(m.splice(y-1,1),y--),m[y][1]=se,he?m[y+1][1]=he:(m.splice(y+1,1),y--))}y++}}function V(m,j){m.push([n,""]);for(var y=0,D=0,b=0,S="",F="",$;y<m.length;){if(y<m.length-1&&!m[y][1]){m.splice(y,1);continue}switch(m[y][0]){case t:b++,F+=m[y][1],y++;break;case e:D++,S+=m[y][1],y++;break;case n:var G=y-b-D-1;if(j){if(G>=0&&A(m[G][1])){var se=m[G][1].slice(-1);if(m[G][1]=m[G][1].slice(0,-1),S=se+S,F=se+F,!m[G][1]){m.splice(G,1),y--;var he=G-1;m[he]&&m[he][0]===t&&(b++,F=m[he][1]+F,he--),m[he]&&m[he][0]===e&&(D++,S=m[he][1]+S,he--),G=he}}if(N(m[y][1])){var se=m[y][1].charAt(0);m[y][1]=m[y][1].slice(1),S+=se,F+=se}}if(y<m.length-1&&!m[y][1]){m.splice(y,1);break}if(S.length>0||F.length>0){S.length>0&&F.length>0&&($=a(F,S),$!==0&&(G>=0?m[G][1]+=F.substring(0,$):(m.splice(0,0,[n,F.substring(0,$)]),y++),F=F.substring($),S=S.substring($)),$=c(F,S),$!==0&&(m[y][1]=F.substring(F.length-$)+m[y][1],F=F.substring(0,F.length-$),S=S.substring(0,S.length-$)));var ge=b+D;S.length===0&&F.length===0?(m.splice(y-ge,ge),y=y-ge):S.length===0?(m.splice(y-ge,ge,[t,F]),y=y-ge+1):F.length===0?(m.splice(y-ge,ge,[e,S]),y=y-ge+1):(m.splice(y-ge,ge,[e,S],[t,F]),y=y-ge+2)}y!==0&&m[y-1][0]===n?(m[y-1][1]+=m[y][1],m.splice(y,1)):y++,b=0,D=0,S="",F="";break}}m[m.length-1][1]===""&&m.pop();var Te=!1;for(y=1;y<m.length-1;)m[y-1][0]===n&&m[y+1][0]===n&&(m[y][1].substring(m[y][1].length-m[y-1][1].length)===m[y-1][1]?(m[y][1]=m[y-1][1]+m[y][1].substring(0,m[y][1].length-m[y-1][1].length),m[y+1][1]=m[y-1][1]+m[y+1][1],m.splice(y-1,1),Te=!0):m[y][1].substring(0,m[y+1][1].length)==m[y+1][1]&&(m[y-1][1]+=m[y+1][1],m[y][1]=m[y][1].substring(m[y+1][1].length)+m[y+1][1],m.splice(y+1,1),Te=!0)),y++;Te&&V(m,j)}function z(m){return m>=55296&&m<=56319}function oe(m){return m>=56320&&m<=57343}function N(m){return oe(m.charCodeAt(0))}function A(m){return z(m.charCodeAt(m.length-1))}function H(m){for(var j=[],y=0;y<m.length;y++)m[y][1].length>0&&j.push(m[y]);return j}function J(m,j,y,D){return A(m)||N(D)?null:H([[n,m],[e,j],[t,y],[n,D]])}function de(m,j,y){var D=typeof y=="number"?{index:y,length:0}:y.oldRange,b=typeof y=="number"?null:y.newRange,S=m.length,F=j.length;if(D.length===0&&(b===null||b.length===0)){var $=D.index,G=m.slice(0,$),se=m.slice($),he=b?b.index:null;e:{var ge=$+F-S;if(he!==null&&he!==ge||ge<0||ge>F)break e;var Te=j.slice(0,ge),we=j.slice(ge);if(we!==se)break e;var v=Math.min($,ge),k=G.slice(0,v),K=Te.slice(0,v);if(k!==K)break e;var Q=G.slice(v),Y=Te.slice(v);return J(k,Q,Y,se)}e:{if(he!==null&&he!==$)break e;var W=$,Te=j.slice(0,W),we=j.slice(W);if(Te!==G)break e;var ue=Math.min(S-W,F-W),ae=se.slice(se.length-ue),B=we.slice(we.length-ue);if(ae!==B)break e;var Q=se.slice(0,se.length-ue),Y=we.slice(0,we.length-ue);return J(G,Q,Y,ae)}}if(D.length>0&&b&&b.length===0)e:{var k=m.slice(0,D.index),ae=m.slice(D.index+D.length),v=k.length,ue=ae.length;if(F<v+ue)break e;var K=j.slice(0,v),B=j.slice(F-ue);if(k!==K||ae!==B)break e;var Q=m.slice(v,S-ue),Y=j.slice(v,F-ue);return J(k,Q,Y,ae)}return null}function le(m,j,y,D){return r(m,j,y,D,!0)}return le.INSERT=t,le.DELETE=e,le.EQUAL=n,Ns=le,Ns}var cg=ug();const nl=St(cg);function gr(e,t){const n=e.indexOf(t);return n>-1?(e.splice(n,1),!0):!1}function hg(e){const t=new Set,n=[];for(const r of e)t.has(r)||(t.add(r),n.push(r));return n}function dg(e,t){for(let n=e.length-1;n>-1;n--){const r=e[n];if(t(r,n))return r}return null}function fg(e,t){if(e.length===0)return e;const n=t%e.length;return e.slice(n).concat(e.slice(0,n))}function gg(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 pg(e){return Array.isArray(e)?e:[e]}function mg(e){return["true","false"].includes(e.toLowerCase())}const pr="__INTERNAL_EDITOR__",xi=`${pr}DOCS_NORMAL`,Li=`${pr}DOCS_FORMULA_BAR`,rl=`${pr}ZEN_EDITOR`,sl=`\r
2
- `,_g="isRowStylePrecedeColumnStyle";function Eg(e){return`${pr}${e}`}function il(e){return e.startsWith(pr)}var Ui=Symbol("$$IDENTIFIER_DECORATOR");function Cg(e){return e&&e[Ui]===!0}function Pi(e){return typeof e=="function"}function Gs(e){return!!(e&&typeof e.useClass<"u")}function Ks(e){return!!(e&&typeof e.useFactory<"u")}function Xs(e){return!!(e&&typeof e.useValue<"u")}function Rg(e){return!!(e&&typeof e.useExisting<"u")}function Qs(e){return!!(e&&typeof e.useAsync<"u")}var ol=Symbol("AsyncHook");function Br(e){return!!(e&&e.__symbol===ol)}function Et(e){return typeof e>"u"?"undefined":Pi(e)&&!e[Ui]?e.name:e.toString()}var Ig=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,s){r.__proto__=s}||function(r,s){for(var i in s)Object.prototype.hasOwnProperty.call(s,i)&&(r[i]=s[i])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),ot=function(e){Ig(t,e);function t(n){return e.call(this,"[redi]: ".concat(n))||this}return t}(Error);exports.Quantity=void 0;(function(e){e.MANY="many",e.OPTIONAL="optional",e.REQUIRED="required"})(exports.Quantity||(exports.Quantity={}));exports.LookUp=void 0;(function(e){e.SELF="self",e.SKIP_SELF="skipSelf"})(exports.LookUp||(exports.LookUp={}));var al=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,s){r.__proto__=s}||function(r,s){for(var i in s)Object.prototype.hasOwnProperty.call(s,i)&&(r[i]=s[i])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),No=Symbol("$$TARGET"),qs=Symbol("$$DEPENDENCIES"),vg=function(e){al(t,e);function t(n,r){var s="Could not find dependency registered on the ".concat(n,' (indexed) parameter of the constructor of "').concat(Et(r),'".');return e.call(this,s)||this}return t}(ot),ll=function(e){al(t,e);function t(n,r){var s='It seems that you register "undefined" as dependency on the '.concat(r+1,' parameter of "').concat(Et(n),'". Please make sure that there is not cyclic dependency among your TypeScript files, or consider using "forwardRef". For more info please visit our website https://redi.wendell.fun/docs/debug#could-not-find-dependency-registered-on');return e.call(this,s)||this}return t}(ot);function ul(e){var t=e;return t[qs]||[]}function Fi(e,t){var n=ul(e),r=n.find(function(s){return s.paramIndex===t});if(!r)throw new vg(t,e);return r}function ki(e,t,n,r,s){r===void 0&&(r=exports.Quantity.REQUIRED);var i={paramIndex:n,identifier:t,quantity:r,lookUp:s,withNew:!1};if(typeof t>"u")throw new ll(e,n);var o=e;o[No]===o?o[qs].push(i):(o[qs]=[i],o[No]=o)}var Mo=new Set;function _t(e){if(Mo.has(e))throw new ot('Identifier "'.concat(e,'" already exists.'));Mo.add(e);var t=function(n,r,s){ki(n,t,s)};return t.toString=function(){return e},t[Ui]=!0,t}function yg(e,t,n){var r=Fi(e,t);r.lookUp=n}function cl(e){return function t(){return this instanceof t?this:function(n,r,s){yg(n,s,e)}}}var hl=cl(exports.LookUp.SKIP_SELF),dl=cl(exports.LookUp.SELF),Sg=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,s){r.__proto__=s}||function(r,s){for(var i in s)Object.prototype.hasOwnProperty.call(s,i)&&(r[i]=s[i])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),Js=function(e){Sg(t,e);function t(n,r,s){var i=this,o='Expect "'.concat(r,'" dependency items for id "').concat(Et(n),'" but get ').concat(s,".");return s===0&&(o+=" Did you forget to register it?"),s>1&&(o+=" You register it more than once."),i=e.call(this,o)||this,i.quantity=r,i.actual=s,i}return t}(ot);function $i(e,t,n){if(t===exports.Quantity.OPTIONAL&&n>1||t===exports.Quantity.REQUIRED&&n!==1)throw new Js(e,t,n)}function Og(e,t){return e===exports.Quantity.MANY?t:t[0]}function bg(e,t,n){var r=Fi(e,t);r.quantity=n}function Bi(e){return function t(n){return this instanceof t?this:function(r,s,i){if(n)ki(r,n,i,e);else{if(e===exports.Quantity.REQUIRED)throw new ll(r,i);bg(r,i,e)}}}}var fl=Bi(exports.Quantity.MANY),gl=Bi(exports.Quantity.OPTIONAL),it=Bi(exports.Quantity.REQUIRED);function wg(e,t,n){var r=Fi(e,t);r.withNew=n}function Ag(e){return function t(){return this instanceof t?this:function(n,r,s){wg(n,s,e)}}}var pl=Ag(!0);function ml(e,t){return t===void 0&&(t=0),e?e.map(function(n,r){if(r+=t,!Array.isArray(n))return{paramIndex:r,identifier:n,quantity:exports.Quantity.REQUIRED,withNew:!1};var s=n.slice(0,n.length-1),i=n[n.length-1],o,a=exports.Quantity.REQUIRED,l=!1;return s.forEach(function(c){if(c instanceof dl)o=exports.LookUp.SELF;else if(c instanceof hl)o=exports.LookUp.SKIP_SELF;else if(c instanceof gl)a=exports.Quantity.OPTIONAL;else if(c instanceof fl)a=exports.Quantity.MANY;else if(c instanceof pl)l=!0;else throw new ot("unknown dep modifier ".concat(c,"."))}),{paramIndex:r,identifier:i,quantity:a,lookUp:o,withNew:l}}):[]}function Tg(e,t,n){n===void 0&&(n=0);var r=ml(t,n);r.forEach(function(s){ki(e,s.identifier,s.paramIndex,s.quantity,s.lookUp)})}function Ng(e){return{unwrap:e}}function Mg(e){return!!e&&typeof e.unwrap=="function"}function Dg(e){return Mg(e)?e.unwrap():e}function Zs(e){return!!e&&typeof e.dispose=="function"}var _l=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,s){r.__proto__=s}||function(r,s){for(var i in s)Object.prototype.hasOwnProperty.call(s,i)&&(r[i]=s[i])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();function xg(e){return e.length===1}var Cs=[];function Do(e){Cs.push(e)}function xo(){Cs.pop()}function Lg(){Cs.length=0}var Lo=function(e){_l(t,e);function t(n,r,s){var i='Cannot find "'.concat(Et(r),'" registered by any injector. It is the ').concat(s,'th param of "').concat(Cg(n)?Et(n):n.name,'".');return e.call(this,i)||this}return t}(ot),jr=function(e){_l(t,e);function t(n){var r=this,s='Cannot find "'.concat(Et(n),'" registered by any injector. The stack of dependencies is: "').concat(Cs.map(function(i){return Et(i)}).join(" -> "),'".');return r=e.call(this,s)||this,Lg(),r}return t}(ot),Ug=function(){function e(t){var n=this;this.dependencyMap=new Map,this.normalizeDependencies(t).map(function(r){return n.add(r[0],r[1])})}return e.prototype.add=function(t,n){typeof n>"u"&&(n={useClass:t,lazy:!1});var r=this.dependencyMap.get(t);typeof r>"u"&&(r=[],this.dependencyMap.set(t,r)),r.push(n)},e.prototype.delete=function(t){this.dependencyMap.delete(t)},e.prototype.get=function(t,n){n===void 0&&(n=exports.Quantity.REQUIRED);var r=this.dependencyMap.get(t);return $i(t,n,r.length),Og(n,r)},e.prototype.has=function(t){return this.dependencyMap.has(t)},e.prototype.append=function(t){var n=this;this.normalizeDependencies(t).forEach(function(r){return n.add(r[0],r[1])})},e.prototype.dispose=function(){this.dependencyMap.clear()},e.prototype.normalizeDependencies=function(t){return t.map(function(n){var r=n[0],s;return xg(n)?s={useClass:n[0],lazy:!1}:s=n[1],[r,s]})},e}(),Pg=function(){function e(){this.resolvedDependencies=new Map}return e.prototype.add=function(t,n){var r=this.resolvedDependencies.get(t);typeof r>"u"&&(r=[],this.resolvedDependencies.set(t,r)),r.push(n)},e.prototype.has=function(t){return this.resolvedDependencies.has(t)},e.prototype.delete=function(t){if(this.resolvedDependencies.has(t)){var n=this.resolvedDependencies.get(t);n.forEach(function(r){return Zs(r)?r.dispose():void 0}),this.resolvedDependencies.delete(t)}},e.prototype.get=function(t,n){n===void 0&&(n=exports.Quantity.REQUIRED);var r=this.resolvedDependencies.get(t);if(!r)throw new jr(t);return $i(t,n,r.length),n===exports.Quantity.MANY?r:r[0]},e.prototype.dispose=function(){Array.from(this.resolvedDependencies.values()).forEach(function(t){t.forEach(function(n){return Zs(n)?n.dispose():void 0})}),this.resolvedDependencies.clear()},e}(),ei;(function(){if(typeof requestIdleCallback<"u"&&typeof cancelIdleCallback<"u")ei=function(t,n){var r=requestIdleCallback(t,typeof n=="number"?{timeout:n}:void 0),s=!1;return function(){s||(s=!0,cancelIdleCallback(r))}};else{var e=Object.freeze({didTimeout:!0,timeRemaining:function(){return 15}});ei=function(t){var n=setTimeout(function(){return t(e)}),r=!1;return function(){r||(r=!0,clearTimeout(n))}}}})();var Fg=function(){function e(t){var n=this;this.didRun=!1,this.selfExecutor=function(){try{n.value=t()}catch(r){n.error=r}finally{n.didRun=!0}},this.disposeCallback=ei(function(){return n.selfExecutor()})}return e.prototype.hasRun=function(){return this.didRun},e.prototype.dispose=function(){this.disposeCallback()},e.prototype.getValue=function(){if(this.didRun||(this.dispose(),this.selfExecutor()),this.error)throw this.error;return this.value},e}(),Hn=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,s){r.__proto__=s}||function(r,s){for(var i in s)Object.prototype.hasOwnProperty.call(s,i)&&(r[i]=s[i])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),ts=function(){return ts=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s])}return e},ts.apply(this,arguments)},cn=function(e,t,n){if(n||arguments.length===2)for(var r=0,s=t.length,i;r<s;r++)(i||!(r in t))&&(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))},kg=300,br=Symbol("$$NOT_INSTANTIATED_SYMBOL"),$g=function(e){Hn(t,e);function t(n){return e.call(this,'Detecting cyclic dependency. The last identifier is "'.concat(Et(n),'".'))||this}return t}(ot),Bg=function(e){Hn(t,e);function t(){return e.call(this,"Injector cannot be accessed after it was disposed.")||this}return t}(ot),jg=function(e){Hn(t,e);function t(n){return e.call(this,'Async item "'.concat(Et(n),'" returns another async item.'))||this}return t}(ot),Hg=function(e){Hn(t,e);function t(n){return e.call(this,'Cannot get async item "'.concat(Et(n),'" from sync api.'))||this}return t}(ot),Uo=function(e){Hn(t,e);function t(n){return e.call(this,'Cannot add dependency "'.concat(Et(n),'" after it is already resolved.'))||this}return t}(ot),Wg=function(e){Hn(t,e);function t(n){return e.call(this,'Cannot dependency dependency "'.concat(Et(n),'" after it is already resolved.'))||this}return t}(ot),Ct=function(){function e(t,n){n===void 0&&(n=null),this.parent=n,this.children=[],this.resolutionOngoing=0,this.disposingCallbacks=new Set,this.disposed=!1,this.dependencyCollection=new Ug(t||[]),this.resolvedDependencyCollection=new Pg,n&&n.children.push(this)}return e.prototype.onDispose=function(t){var n=this;return this.disposingCallbacks.add(t),{dispose:function(){return n.disposingCallbacks.delete(t)}}},e.prototype.createChild=function(t){return this._ensureInjectorNotDisposed(),new e(t,this)},e.prototype.dispose=function(){this.children.forEach(function(t){return t.dispose()}),this.children.length=0,this.dependencyCollection.dispose(),this.resolvedDependencyCollection.dispose(),this.deleteSelfFromParent(),this.disposed=!0,this.disposingCallbacks.forEach(function(t){return t()}),this.disposingCallbacks.clear()},e.prototype.deleteSelfFromParent=function(){if(this.parent){var t=this.parent.children.indexOf(this);t>-1&&this.parent.children.splice(t,1)}},e.prototype.add=function(t){this._ensureInjectorNotDisposed();var n=t[0],r=t[1];if(this.resolvedDependencyCollection.has(n))throw new Uo(n);typeof r>"u"?this.dependencyCollection.add(n):Qs(r)||Gs(r)||Xs(r)||Ks(r)?this.dependencyCollection.add(n,r):this.resolvedDependencyCollection.add(n,r)},e.prototype.replace=function(t){this._ensureInjectorNotDisposed();var n=t[0];if(this.resolvedDependencyCollection.has(n))throw new Uo(n);this.dependencyCollection.delete(n),t.length===1?this.dependencyCollection.add(n):this.dependencyCollection.add(n,t[1])},e.prototype.delete=function(t){if(this._ensureInjectorNotDisposed(),this.resolvedDependencyCollection.has(t))throw new Wg(t);this.dependencyCollection.delete(t)},e.prototype.invoke=function(t){for(var n=this,r=[],s=1;s<arguments.length;s++)r[s-1]=arguments[s];this._ensureInjectorNotDisposed();var i={get:function(o,a,l){return n._get(o,a,l)},has:function(o){return n.has(o)}};return t.apply(void 0,cn([i],r,!1))},e.prototype.has=function(t){var n;return this.dependencyCollection.has(t)||((n=this.parent)===null||n===void 0?void 0:n.has(t))||!1},e.prototype.get=function(t,n,r){this._ensureInjectorNotDisposed();var s=this._get(t,n,r);if(Array.isArray(s)&&s.some(function(i){return Br(i)})||Br(s))throw new Hg(t);return s},e.prototype._get=function(t,n,r,s){var i=exports.Quantity.REQUIRED;if(n===exports.Quantity.REQUIRED||n===exports.Quantity.OPTIONAL||n===exports.Quantity.MANY?i=n:r=n,!s){var o=this.getValue(t,i,r);if(o!==br)return o}return this.createDependency(t,i,r,!s)},e.prototype.getAsync=function(t){this._ensureInjectorNotDisposed();var n=this.getValue(t,exports.Quantity.REQUIRED);if(n!==br)return Promise.resolve(n);var r=this.createDependency(t,exports.Quantity.REQUIRED);return Br(r)?r.whenReady():Promise.resolve(r)},e.prototype.createInstance=function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];return this._ensureInjectorNotDisposed(),this._resolveClassImpl.apply(this,cn([{useClass:t}],n,!1))},e.prototype._resolveDependency=function(t,n,r){r===void 0&&(r=!0);var s;Do(t);try{Xs(n)?s=this._resolveValueDependency(t,n):Ks(n)?s=this._resolveFactory(t,n,r):Gs(n)?s=this._resolveClass(t,n,r):Rg(n)?s=this._resolveExisting(t,n):s=this._resolveAsync(t,n),xo()}catch(i){throw xo(),i}return s},e.prototype._resolveExisting=function(t,n){var r=this.get(n.useExisting);return this.resolvedDependencyCollection.add(t,r),r},e.prototype._resolveValueDependency=function(t,n){var r=n.useValue;return this.resolvedDependencyCollection.add(t,r),r},e.prototype._resolveClass=function(t,n,r){var s=this;r===void 0&&(r=!0);var i;if(n.lazy){var o=new Fg(function(){return s._ensureInjectorNotDisposed(),s._resolveClassImpl(n)});i=new Proxy(Object.create(null),{get:function(a,l){if(l in a)return a[l];if(l!=="whenReady"){var c=o.getValue(),h=c[l];return typeof h!="function"||(h=h.bind(c),a[l]=h),h}},set:function(a,l,c){return o.getValue()[l]=c,!0}})}else i=this._resolveClassImpl(n);return t&&r&&this.resolvedDependencyCollection.add(t,i),i},e.prototype._resolveClassImpl=function(t){for(var n,r=[],s=1;s<arguments.length;s++)r[s-1]=arguments[s];var i=t.useClass;this.markNewResolution(i);for(var o=ul(i).sort(function(O,T){return O.paramIndex-T.paramIndex}).map(function(O){return ts(ts({},O),{identifier:Dg(O.identifier)})}),a=[],l=0,c=o;l<c.length;l++){var h=c[l];try{var u=this._get(h.identifier,h.quantity,h.lookUp,h.withNew);a.push(u)}catch(O){throw O instanceof jr||O instanceof Js&&O.actual===0?new Lo(i,h.identifier,h.paramIndex):O}}var d=cn([],r,!0),f=o.length>0?o[0].paramIndex:d.length;if(d.length!==f){console.warn("[redi]: Expect ".concat(f," custom parameter(s) of ").concat(Et(i)," but get ").concat(d.length,"."));var E=f-d.length;E>0?d=cn(cn([],d,!0),Array.from({length:E}).fill(void 0),!0):d=d.slice(0,f)}var R=new(i.bind.apply(i,cn(cn([void 0],d,!1),a,!1)));return(n=t==null?void 0:t.onInstantiation)===null||n===void 0||n.call(t,R),this.markResolutionCompleted(),R},e.prototype._resolveFactory=function(t,n,r){var s;this.markNewResolution(t);for(var i=ml(n.deps),o=[],a=0,l=i;a<l.length;a++){var c=l[a];try{var h=this._get(c.identifier,c.quantity,c.lookUp,c.withNew);o.push(h)}catch(d){throw d instanceof jr||d instanceof Js&&d.actual===0?new Lo(t,c.identifier,c.paramIndex):d}}var u=n.useFactory.apply(null,o);return r&&this.resolvedDependencyCollection.add(t,u),this.markResolutionCompleted(),(s=n==null?void 0:n.onInstantiation)===null||s===void 0||s.call(n,u),u},e.prototype._resolveAsync=function(t,n){var r=this,s={__symbol:ol,whenReady:function(){return r._resolveAsyncImpl(t,n)}};return s},e.prototype._resolveAsyncImpl=function(t,n){var r=this;return n.useAsync().then(function(s){var i=r.getValue(t);if(i!==br)return i;var o;if(Array.isArray(s)){var a=s[1];if(Qs(a))throw new jg(t);o=r._resolveDependency(t,a)}else Pi(s)?o=r._resolveClassImpl({useClass:s,onInstantiation:n.onInstantiation}):o=s;return r.resolvedDependencyCollection.add(t,o),o})},e.prototype.getValue=function(t,n,r){var s=this;n===void 0&&(n=exports.Quantity.REQUIRED);var i=function(){return s.dependencyCollection.has(t)&&!s.resolvedDependencyCollection.has(t)?br:s.resolvedDependencyCollection.get(t,n)},o=function(){return s.parent?s.parent.getValue(t,n):($i(t,n,0),n===exports.Quantity.MANY?[]:null)};return r===exports.LookUp.SKIP_SELF?o():t===e?this:r===exports.LookUp.SELF||this.resolvedDependencyCollection.has(t)||this.dependencyCollection.has(t)?i():o()},e.prototype.createDependency=function(t,n,r,s){var i=this;n===void 0&&(n=exports.Quantity.REQUIRED),s===void 0&&(s=!0);var o=function(){var l=i.dependencyCollection.get(t,n),c=null;return Array.isArray(l)?c=l.map(function(h){return i._resolveDependency(t,h,s)}):l&&(c=i._resolveDependency(t,l,s)),c},a=function(){if(i.parent)return i.parent.createDependency(t,n,void 0,s);if(n===exports.Quantity.OPTIONAL)return null;throw Do(t),new jr(t)};return r===exports.LookUp.SKIP_SELF?a():this.dependencyCollection.has(t)?o():a()},e.prototype.markNewResolution=function(t){if(this.resolutionOngoing+=1,this.resolutionOngoing>=kg)throw new $g(t)},e.prototype.markResolutionCompleted=function(){this.resolutionOngoing-=1},e.prototype._ensureInjectorNotDisposed=function(){if(this.disposed)throw new Bg},e}(),Po=typeof globalThis<"u"&&globalThis||typeof window<"u"&&window||typeof global<"u"&&global,Fo="REDI_GLOBAL_LOCK",zg=typeof process<"u"&&process.versions!=null&&process.versions.node!=null;Po[Fo]?zg||console.error(`[redi]: You are loading scripts of redi more than once! This may cause undesired behavior in your application.
1
+ "use strict";var __defProp=Object.defineProperty;var __defNormalProp=(obj,key,value)=>key in obj?__defProp(obj,key,{enumerable:!0,configurable:!0,writable:!0,value}):obj[key]=value;var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});var __publicField=(obj,key,value)=>__defNormalProp(obj,typeof key!="symbol"?key+"":key,value);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const rxjs=require("rxjs"),operators=require("rxjs/operators"),React=require("react");function _interopNamespaceDefault(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const k in e)if(k!=="default"){const d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:!0,get:__name(()=>e[k],"get")})}}return n.default=e,Object.freeze(n)}__name(_interopNamespaceDefault,"_interopNamespaceDefault");function _mergeNamespaces(n,m){for(var i=0;i<m.length;i++){const e=m[i];if(typeof e!="string"&&!Array.isArray(e)){for(const k in e)if(k!=="default"&&!(k in n)){const d=Object.getOwnPropertyDescriptor(e,k);d&&Object.defineProperty(n,k,d.get?d:{enumerable:!0,get:__name(()=>e[k],"get")})}}}return Object.freeze(Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}))}__name(_mergeNamespaces,"_mergeNamespaces");const React__namespace=_interopNamespaceDefault(React);function installShims(){installRequestIdleCallback()}__name(installShims,"installShims");const glob=typeof global<"u"?global:typeof self<"u"?self:window;function installRequestIdleCallback(){typeof glob.requestIdleCallback!="function"&&(glob.requestIdleCallback=__name(function(callback){const start=Date.now();return setTimeout(__name(function(){const remaining=Math.max(0,50-(Date.now()-start));callback({didTimeout:remaining===0,timeRemaining(){return remaining}})},"rICCallback"),1)},"shimRIC")),typeof glob.cancelIdleCallback!="function"&&(glob.cancelIdleCallback=__name(function(id){clearTimeout(id)},"shimCancelRIC"))}__name(installRequestIdleCallback,"installRequestIdleCallback");var freeGlobal=typeof global=="object"&&global&&global.Object===Object&&global,freeSelf=typeof self=="object"&&self&&self.Object===Object&&self,root=freeGlobal||freeSelf||Function("return this")(),Symbol$1=root.Symbol,objectProto$9=Object.prototype,hasOwnProperty$7=objectProto$9.hasOwnProperty,nativeObjectToString$1=objectProto$9.toString,symToStringTag$1=Symbol$1?Symbol$1.toStringTag:void 0;function getRawTag(value){var isOwn=hasOwnProperty$7.call(value,symToStringTag$1),tag=value[symToStringTag$1];try{value[symToStringTag$1]=void 0;var unmasked=!0}catch{}var result=nativeObjectToString$1.call(value);return unmasked&&(isOwn?value[symToStringTag$1]=tag:delete value[symToStringTag$1]),result}__name(getRawTag,"getRawTag");var objectProto$8=Object.prototype,nativeObjectToString=objectProto$8.toString;function objectToString(value){return nativeObjectToString.call(value)}__name(objectToString,"objectToString");var nullTag="[object Null]",undefinedTag="[object Undefined]",symToStringTag=Symbol$1?Symbol$1.toStringTag:void 0;function baseGetTag(value){return value==null?value===void 0?undefinedTag:nullTag:symToStringTag&&symToStringTag in Object(value)?getRawTag(value):objectToString(value)}__name(baseGetTag,"baseGetTag");function isObjectLike(value){return value!=null&&typeof value=="object"}__name(isObjectLike,"isObjectLike");var symbolTag="[object Symbol]";function isSymbol(value){return typeof value=="symbol"||isObjectLike(value)&&baseGetTag(value)==symbolTag}__name(isSymbol,"isSymbol");function arrayMap(array,iteratee){for(var index2=-1,length=array==null?0:array.length,result=Array(length);++index2<length;)result[index2]=iteratee(array[index2],index2,array);return result}__name(arrayMap,"arrayMap");var isArray=Array.isArray,symbolProto=Symbol$1?Symbol$1.prototype:void 0,symbolToString=symbolProto?symbolProto.toString:void 0;function baseToString(value){if(typeof value=="string")return value;if(isArray(value))return arrayMap(value,baseToString)+"";if(isSymbol(value))return symbolToString?symbolToString.call(value):"";var result=value+"";return result=="0"&&1/value==-1/0?"-0":result}__name(baseToString,"baseToString");var reWhitespace=/\s/;function trimmedEndIndex(string){for(var index2=string.length;index2--&&reWhitespace.test(string.charAt(index2)););return index2}__name(trimmedEndIndex,"trimmedEndIndex");var reTrimStart=/^\s+/;function baseTrim(string){return string&&string.slice(0,trimmedEndIndex(string)+1).replace(reTrimStart,"")}__name(baseTrim,"baseTrim");function isObject$1(value){var type2=typeof value;return value!=null&&(type2=="object"||type2=="function")}__name(isObject$1,"isObject$1");var NAN=NaN,reIsBadHex=/^[-+]0x[0-9a-f]+$/i,reIsBinary=/^0b[01]+$/i,reIsOctal=/^0o[0-7]+$/i,freeParseInt=parseInt;function toNumber(value){if(typeof value=="number")return value;if(isSymbol(value))return NAN;if(isObject$1(value)){var other=typeof value.valueOf=="function"?value.valueOf():value;value=isObject$1(other)?other+"":other}if(typeof value!="string")return value===0?value:+value;value=baseTrim(value);var isBinary=reIsBinary.test(value);return isBinary||reIsOctal.test(value)?freeParseInt(value.slice(2),isBinary?2:8):reIsBadHex.test(value)?NAN:+value}__name(toNumber,"toNumber");function identity(value){return value}__name(identity,"identity");var asyncTag="[object AsyncFunction]",funcTag$1="[object Function]",genTag="[object GeneratorFunction]",proxyTag="[object Proxy]";function isFunction$1(value){if(!isObject$1(value))return!1;var tag=baseGetTag(value);return tag==funcTag$1||tag==genTag||tag==asyncTag||tag==proxyTag}__name(isFunction$1,"isFunction$1");var coreJsData=root["__core-js_shared__"],maskSrcKey=function(){var uid=/[^.]+$/.exec(coreJsData&&coreJsData.keys&&coreJsData.keys.IE_PROTO||"");return uid?"Symbol(src)_1."+uid:""}();function isMasked(func){return!!maskSrcKey&&maskSrcKey in func}__name(isMasked,"isMasked");var funcProto$2=Function.prototype,funcToString$2=funcProto$2.toString;function toSource(func){if(func!=null){try{return funcToString$2.call(func)}catch{}try{return func+""}catch{}}return""}__name(toSource,"toSource");var reRegExpChar=/[\\^$.*+?()[\]{}|]/g,reIsHostCtor=/^\[object .+?Constructor\]$/,funcProto$1=Function.prototype,objectProto$7=Object.prototype,funcToString$1=funcProto$1.toString,hasOwnProperty$6=objectProto$7.hasOwnProperty,reIsNative=RegExp("^"+funcToString$1.call(hasOwnProperty$6).replace(reRegExpChar,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function baseIsNative(value){if(!isObject$1(value)||isMasked(value))return!1;var pattern=isFunction$1(value)?reIsNative:reIsHostCtor;return pattern.test(toSource(value))}__name(baseIsNative,"baseIsNative");function getValue(object,key){return object==null?void 0:object[key]}__name(getValue,"getValue");function getNative(object,key){var value=getValue(object,key);return baseIsNative(value)?value:void 0}__name(getNative,"getNative");var objectCreate=Object.create,baseCreate=function(){function object(){}return __name(object,"object"),function(proto){if(!isObject$1(proto))return{};if(objectCreate)return objectCreate(proto);object.prototype=proto;var result=new object;return object.prototype=void 0,result}}();function apply(func,thisArg,args){switch(args.length){case 0:return func.call(thisArg);case 1:return func.call(thisArg,args[0]);case 2:return func.call(thisArg,args[0],args[1]);case 3:return func.call(thisArg,args[0],args[1],args[2])}return func.apply(thisArg,args)}__name(apply,"apply");function copyArray(source,array){var index2=-1,length=source.length;for(array||(array=Array(length));++index2<length;)array[index2]=source[index2];return array}__name(copyArray,"copyArray");var HOT_COUNT=800,HOT_SPAN=16,nativeNow=Date.now;function shortOut(func){var count=0,lastCalled=0;return function(){var stamp=nativeNow(),remaining=HOT_SPAN-(stamp-lastCalled);if(lastCalled=stamp,remaining>0){if(++count>=HOT_COUNT)return arguments[0]}else count=0;return func.apply(void 0,arguments)}}__name(shortOut,"shortOut");function constant(value){return function(){return value}}__name(constant,"constant");var defineProperty=function(){try{var func=getNative(Object,"defineProperty");return func({},"",{}),func}catch{}}(),baseSetToString=defineProperty?function(func,string){return defineProperty(func,"toString",{configurable:!0,enumerable:!1,value:constant(string),writable:!0})}:identity,setToString=shortOut(baseSetToString),MAX_SAFE_INTEGER$1=9007199254740991,reIsUint=/^(?:0|[1-9]\d*)$/;function isIndex(value,length){var type2=typeof value;return length=length==null?MAX_SAFE_INTEGER$1:length,!!length&&(type2=="number"||type2!="symbol"&&reIsUint.test(value))&&value>-1&&value%1==0&&value<length}__name(isIndex,"isIndex");function baseAssignValue(object,key,value){key=="__proto__"&&defineProperty?defineProperty(object,key,{configurable:!0,enumerable:!0,value,writable:!0}):object[key]=value}__name(baseAssignValue,"baseAssignValue");function eq(value,other){return value===other||value!==value&&other!==other}__name(eq,"eq");var objectProto$6=Object.prototype,hasOwnProperty$5=objectProto$6.hasOwnProperty;function assignValue(object,key,value){var objValue=object[key];(!(hasOwnProperty$5.call(object,key)&&eq(objValue,value))||value===void 0&&!(key in object))&&baseAssignValue(object,key,value)}__name(assignValue,"assignValue");function copyObject(source,props,object,customizer){var isNew=!object;object||(object={});for(var index2=-1,length=props.length;++index2<length;){var key=props[index2],newValue=void 0;newValue===void 0&&(newValue=source[key]),isNew?baseAssignValue(object,key,newValue):assignValue(object,key,newValue)}return object}__name(copyObject,"copyObject");var nativeMax$1=Math.max;function overRest(func,start,transform){return start=nativeMax$1(start===void 0?func.length-1:start,0),function(){for(var args=arguments,index2=-1,length=nativeMax$1(args.length-start,0),array=Array(length);++index2<length;)array[index2]=args[start+index2];index2=-1;for(var otherArgs=Array(start+1);++index2<start;)otherArgs[index2]=args[index2];return otherArgs[start]=transform(array),apply(func,this,otherArgs)}}__name(overRest,"overRest");function baseRest(func,start){return setToString(overRest(func,start,identity),func+"")}__name(baseRest,"baseRest");var MAX_SAFE_INTEGER=9007199254740991;function isLength(value){return typeof value=="number"&&value>-1&&value%1==0&&value<=MAX_SAFE_INTEGER}__name(isLength,"isLength");function isArrayLike(value){return value!=null&&isLength(value.length)&&!isFunction$1(value)}__name(isArrayLike,"isArrayLike");function isIterateeCall(value,index2,object){if(!isObject$1(object))return!1;var type2=typeof index2;return(type2=="number"?isArrayLike(object)&&isIndex(index2,object.length):type2=="string"&&index2 in object)?eq(object[index2],value):!1}__name(isIterateeCall,"isIterateeCall");function createAssigner(assigner){return baseRest(function(object,sources){var index2=-1,length=sources.length,customizer=length>1?sources[length-1]:void 0,guard=length>2?sources[2]:void 0;for(customizer=assigner.length>3&&typeof customizer=="function"?(length--,customizer):void 0,guard&&isIterateeCall(sources[0],sources[1],guard)&&(customizer=length<3?void 0:customizer,length=1),object=Object(object);++index2<length;){var source=sources[index2];source&&assigner(object,source,index2,customizer)}return object})}__name(createAssigner,"createAssigner");var objectProto$5=Object.prototype;function isPrototype(value){var Ctor=value&&value.constructor,proto=typeof Ctor=="function"&&Ctor.prototype||objectProto$5;return value===proto}__name(isPrototype,"isPrototype");function baseTimes(n,iteratee){for(var index2=-1,result=Array(n);++index2<n;)result[index2]=iteratee(index2);return result}__name(baseTimes,"baseTimes");var argsTag$1="[object Arguments]";function baseIsArguments(value){return isObjectLike(value)&&baseGetTag(value)==argsTag$1}__name(baseIsArguments,"baseIsArguments");var objectProto$4=Object.prototype,hasOwnProperty$4=objectProto$4.hasOwnProperty,propertyIsEnumerable=objectProto$4.propertyIsEnumerable,isArguments=baseIsArguments(function(){return arguments}())?baseIsArguments:function(value){return isObjectLike(value)&&hasOwnProperty$4.call(value,"callee")&&!propertyIsEnumerable.call(value,"callee")};function stubFalse(){return!1}__name(stubFalse,"stubFalse");var freeExports$2=typeof exports=="object"&&exports&&!exports.nodeType&&exports,freeModule$2=freeExports$2&&typeof module=="object"&&module&&!module.nodeType&&module,moduleExports$2=freeModule$2&&freeModule$2.exports===freeExports$2,Buffer$1=moduleExports$2?root.Buffer:void 0,nativeIsBuffer=Buffer$1?Buffer$1.isBuffer:void 0,isBuffer=nativeIsBuffer||stubFalse,argsTag="[object Arguments]",arrayTag="[object Array]",boolTag="[object Boolean]",dateTag="[object Date]",errorTag="[object Error]",funcTag="[object Function]",mapTag="[object Map]",numberTag="[object Number]",objectTag$1="[object Object]",regexpTag="[object RegExp]",setTag="[object Set]",stringTag="[object String]",weakMapTag="[object WeakMap]",arrayBufferTag="[object ArrayBuffer]",dataViewTag="[object DataView]",float32Tag="[object Float32Array]",float64Tag="[object Float64Array]",int8Tag="[object Int8Array]",int16Tag="[object Int16Array]",int32Tag="[object Int32Array]",uint8Tag="[object Uint8Array]",uint8ClampedTag="[object Uint8ClampedArray]",uint16Tag="[object Uint16Array]",uint32Tag="[object Uint32Array]",typedArrayTags={};typedArrayTags[float32Tag]=typedArrayTags[float64Tag]=typedArrayTags[int8Tag]=typedArrayTags[int16Tag]=typedArrayTags[int32Tag]=typedArrayTags[uint8Tag]=typedArrayTags[uint8ClampedTag]=typedArrayTags[uint16Tag]=typedArrayTags[uint32Tag]=!0;typedArrayTags[argsTag]=typedArrayTags[arrayTag]=typedArrayTags[arrayBufferTag]=typedArrayTags[boolTag]=typedArrayTags[dataViewTag]=typedArrayTags[dateTag]=typedArrayTags[errorTag]=typedArrayTags[funcTag]=typedArrayTags[mapTag]=typedArrayTags[numberTag]=typedArrayTags[objectTag$1]=typedArrayTags[regexpTag]=typedArrayTags[setTag]=typedArrayTags[stringTag]=typedArrayTags[weakMapTag]=!1;function baseIsTypedArray(value){return isObjectLike(value)&&isLength(value.length)&&!!typedArrayTags[baseGetTag(value)]}__name(baseIsTypedArray,"baseIsTypedArray");function baseUnary(func){return function(value){return func(value)}}__name(baseUnary,"baseUnary");var freeExports$1=typeof exports=="object"&&exports&&!exports.nodeType&&exports,freeModule$1=freeExports$1&&typeof module=="object"&&module&&!module.nodeType&&module,moduleExports$1=freeModule$1&&freeModule$1.exports===freeExports$1,freeProcess=moduleExports$1&&freeGlobal.process,nodeUtil=function(){try{var types2=freeModule$1&&freeModule$1.require&&freeModule$1.require("util").types;return types2||freeProcess&&freeProcess.binding&&freeProcess.binding("util")}catch{}}(),nodeIsTypedArray=nodeUtil&&nodeUtil.isTypedArray,isTypedArray=nodeIsTypedArray?baseUnary(nodeIsTypedArray):baseIsTypedArray;function arrayLikeKeys(value,inherited){var isArr=isArray(value),isArg=!isArr&&isArguments(value),isBuff=!isArr&&!isArg&&isBuffer(value),isType=!isArr&&!isArg&&!isBuff&&isTypedArray(value),skipIndexes=isArr||isArg||isBuff||isType,result=skipIndexes?baseTimes(value.length,String):[],length=result.length;for(var key in value)skipIndexes&&(key=="length"||isBuff&&(key=="offset"||key=="parent")||isType&&(key=="buffer"||key=="byteLength"||key=="byteOffset")||isIndex(key,length))||result.push(key);return result}__name(arrayLikeKeys,"arrayLikeKeys");function overArg(func,transform){return function(arg){return func(transform(arg))}}__name(overArg,"overArg");function nativeKeysIn(object){var result=[];if(object!=null)for(var key in Object(object))result.push(key);return result}__name(nativeKeysIn,"nativeKeysIn");var objectProto$3=Object.prototype,hasOwnProperty$3=objectProto$3.hasOwnProperty;function baseKeysIn(object){if(!isObject$1(object))return nativeKeysIn(object);var isProto=isPrototype(object),result=[];for(var key in object)key=="constructor"&&(isProto||!hasOwnProperty$3.call(object,key))||result.push(key);return result}__name(baseKeysIn,"baseKeysIn");function keysIn(object){return isArrayLike(object)?arrayLikeKeys(object):baseKeysIn(object)}__name(keysIn,"keysIn");var reIsDeepProp=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,reIsPlainProp=/^\w*$/;function isKey(value,object){if(isArray(value))return!1;var type2=typeof value;return type2=="number"||type2=="symbol"||type2=="boolean"||value==null||isSymbol(value)?!0:reIsPlainProp.test(value)||!reIsDeepProp.test(value)||object!=null&&value in Object(object)}__name(isKey,"isKey");var nativeCreate=getNative(Object,"create");function hashClear(){this.__data__=nativeCreate?nativeCreate(null):{},this.size=0}__name(hashClear,"hashClear");function hashDelete(key){var result=this.has(key)&&delete this.__data__[key];return this.size-=result?1:0,result}__name(hashDelete,"hashDelete");var HASH_UNDEFINED$1="__lodash_hash_undefined__",objectProto$2=Object.prototype,hasOwnProperty$2=objectProto$2.hasOwnProperty;function hashGet(key){var data=this.__data__;if(nativeCreate){var result=data[key];return result===HASH_UNDEFINED$1?void 0:result}return hasOwnProperty$2.call(data,key)?data[key]:void 0}__name(hashGet,"hashGet");var objectProto$1=Object.prototype,hasOwnProperty$1=objectProto$1.hasOwnProperty;function hashHas(key){var data=this.__data__;return nativeCreate?data[key]!==void 0:hasOwnProperty$1.call(data,key)}__name(hashHas,"hashHas");var HASH_UNDEFINED="__lodash_hash_undefined__";function hashSet(key,value){var data=this.__data__;return this.size+=this.has(key)?0:1,data[key]=nativeCreate&&value===void 0?HASH_UNDEFINED:value,this}__name(hashSet,"hashSet");function Hash(entries){var index2=-1,length=entries==null?0:entries.length;for(this.clear();++index2<length;){var entry=entries[index2];this.set(entry[0],entry[1])}}__name(Hash,"Hash");Hash.prototype.clear=hashClear;Hash.prototype.delete=hashDelete;Hash.prototype.get=hashGet;Hash.prototype.has=hashHas;Hash.prototype.set=hashSet;function listCacheClear(){this.__data__=[],this.size=0}__name(listCacheClear,"listCacheClear");function assocIndexOf(array,key){for(var length=array.length;length--;)if(eq(array[length][0],key))return length;return-1}__name(assocIndexOf,"assocIndexOf");var arrayProto=Array.prototype,splice=arrayProto.splice;function listCacheDelete(key){var data=this.__data__,index2=assocIndexOf(data,key);if(index2<0)return!1;var lastIndex=data.length-1;return index2==lastIndex?data.pop():splice.call(data,index2,1),--this.size,!0}__name(listCacheDelete,"listCacheDelete");function listCacheGet(key){var data=this.__data__,index2=assocIndexOf(data,key);return index2<0?void 0:data[index2][1]}__name(listCacheGet,"listCacheGet");function listCacheHas(key){return assocIndexOf(this.__data__,key)>-1}__name(listCacheHas,"listCacheHas");function listCacheSet(key,value){var data=this.__data__,index2=assocIndexOf(data,key);return index2<0?(++this.size,data.push([key,value])):data[index2][1]=value,this}__name(listCacheSet,"listCacheSet");function ListCache(entries){var index2=-1,length=entries==null?0:entries.length;for(this.clear();++index2<length;){var entry=entries[index2];this.set(entry[0],entry[1])}}__name(ListCache,"ListCache");ListCache.prototype.clear=listCacheClear;ListCache.prototype.delete=listCacheDelete;ListCache.prototype.get=listCacheGet;ListCache.prototype.has=listCacheHas;ListCache.prototype.set=listCacheSet;var Map$1=getNative(root,"Map");function mapCacheClear(){this.size=0,this.__data__={hash:new Hash,map:new(Map$1||ListCache),string:new Hash}}__name(mapCacheClear,"mapCacheClear");function isKeyable(value){var type2=typeof value;return type2=="string"||type2=="number"||type2=="symbol"||type2=="boolean"?value!=="__proto__":value===null}__name(isKeyable,"isKeyable");function getMapData(map,key){var data=map.__data__;return isKeyable(key)?data[typeof key=="string"?"string":"hash"]:data.map}__name(getMapData,"getMapData");function mapCacheDelete(key){var result=getMapData(this,key).delete(key);return this.size-=result?1:0,result}__name(mapCacheDelete,"mapCacheDelete");function mapCacheGet(key){return getMapData(this,key).get(key)}__name(mapCacheGet,"mapCacheGet");function mapCacheHas(key){return getMapData(this,key).has(key)}__name(mapCacheHas,"mapCacheHas");function mapCacheSet(key,value){var data=getMapData(this,key),size=data.size;return data.set(key,value),this.size+=data.size==size?0:1,this}__name(mapCacheSet,"mapCacheSet");function MapCache(entries){var index2=-1,length=entries==null?0:entries.length;for(this.clear();++index2<length;){var entry=entries[index2];this.set(entry[0],entry[1])}}__name(MapCache,"MapCache");MapCache.prototype.clear=mapCacheClear;MapCache.prototype.delete=mapCacheDelete;MapCache.prototype.get=mapCacheGet;MapCache.prototype.has=mapCacheHas;MapCache.prototype.set=mapCacheSet;var FUNC_ERROR_TEXT$1="Expected a function";function memoize(func,resolver){if(typeof func!="function"||resolver!=null&&typeof resolver!="function")throw new TypeError(FUNC_ERROR_TEXT$1);var memoized=__name(function(){var args=arguments,key=resolver?resolver.apply(this,args):args[0],cache=memoized.cache;if(cache.has(key))return cache.get(key);var result=func.apply(this,args);return memoized.cache=cache.set(key,result)||cache,result},"memoized");return memoized.cache=new(memoize.Cache||MapCache),memoized}__name(memoize,"memoize");memoize.Cache=MapCache;var MAX_MEMOIZE_SIZE=500;function memoizeCapped(func){var result=memoize(func,function(key){return cache.size===MAX_MEMOIZE_SIZE&&cache.clear(),key}),cache=result.cache;return result}__name(memoizeCapped,"memoizeCapped");var rePropName=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,reEscapeChar=/\\(\\)?/g,stringToPath=memoizeCapped(function(string){var result=[];return string.charCodeAt(0)===46&&result.push(""),string.replace(rePropName,function(match,number,quote,subString){result.push(quote?subString.replace(reEscapeChar,"$1"):number||match)}),result});function toString(value){return value==null?"":baseToString(value)}__name(toString,"toString");function castPath(value,object){return isArray(value)?value:isKey(value,object)?[value]:stringToPath(toString(value))}__name(castPath,"castPath");function toKey(value){if(typeof value=="string"||isSymbol(value))return value;var result=value+"";return result=="0"&&1/value==-1/0?"-0":result}__name(toKey,"toKey");function baseGet(object,path){path=castPath(path,object);for(var index2=0,length=path.length;object!=null&&index2<length;)object=object[toKey(path[index2++])];return index2&&index2==length?object:void 0}__name(baseGet,"baseGet");function get(object,path,defaultValue){var result=object==null?void 0:baseGet(object,path);return result===void 0?defaultValue:result}__name(get,"get");var getPrototype=overArg(Object.getPrototypeOf,Object),objectTag="[object Object]",funcProto=Function.prototype,objectProto=Object.prototype,funcToString=funcProto.toString,hasOwnProperty=objectProto.hasOwnProperty,objectCtorString=funcToString.call(Object);function isPlainObject(value){if(!isObjectLike(value)||baseGetTag(value)!=objectTag)return!1;var proto=getPrototype(value);if(proto===null)return!0;var Ctor=hasOwnProperty.call(proto,"constructor")&&proto.constructor;return typeof Ctor=="function"&&Ctor instanceof Ctor&&funcToString.call(Ctor)==objectCtorString}__name(isPlainObject,"isPlainObject");function stackClear(){this.__data__=new ListCache,this.size=0}__name(stackClear,"stackClear");function stackDelete(key){var data=this.__data__,result=data.delete(key);return this.size=data.size,result}__name(stackDelete,"stackDelete");function stackGet(key){return this.__data__.get(key)}__name(stackGet,"stackGet");function stackHas(key){return this.__data__.has(key)}__name(stackHas,"stackHas");var LARGE_ARRAY_SIZE=200;function stackSet(key,value){var data=this.__data__;if(data instanceof ListCache){var pairs=data.__data__;if(!Map$1||pairs.length<LARGE_ARRAY_SIZE-1)return pairs.push([key,value]),this.size=++data.size,this;data=this.__data__=new MapCache(pairs)}return data.set(key,value),this.size=data.size,this}__name(stackSet,"stackSet");function Stack(entries){var data=this.__data__=new ListCache(entries);this.size=data.size}__name(Stack,"Stack");Stack.prototype.clear=stackClear;Stack.prototype.delete=stackDelete;Stack.prototype.get=stackGet;Stack.prototype.has=stackHas;Stack.prototype.set=stackSet;var freeExports=typeof exports=="object"&&exports&&!exports.nodeType&&exports,freeModule=freeExports&&typeof module=="object"&&module&&!module.nodeType&&module,moduleExports=freeModule&&freeModule.exports===freeExports,Buffer2=moduleExports?root.Buffer:void 0;Buffer2&&Buffer2.allocUnsafe;function cloneBuffer(buffer,isDeep){return buffer.slice()}__name(cloneBuffer,"cloneBuffer");var Uint8Array$1=root.Uint8Array;function cloneArrayBuffer(arrayBuffer){var result=new arrayBuffer.constructor(arrayBuffer.byteLength);return new Uint8Array$1(result).set(new Uint8Array$1(arrayBuffer)),result}__name(cloneArrayBuffer,"cloneArrayBuffer");function cloneTypedArray(typedArray,isDeep){var buffer=cloneArrayBuffer(typedArray.buffer);return new typedArray.constructor(buffer,typedArray.byteOffset,typedArray.length)}__name(cloneTypedArray,"cloneTypedArray");function initCloneObject(object){return typeof object.constructor=="function"&&!isPrototype(object)?baseCreate(getPrototype(object)):{}}__name(initCloneObject,"initCloneObject");function createBaseFor(fromRight){return function(object,iteratee,keysFunc){for(var index2=-1,iterable=Object(object),props=keysFunc(object),length=props.length;length--;){var key=props[++index2];if(iteratee(iterable[key],key,iterable)===!1)break}return object}}__name(createBaseFor,"createBaseFor");var baseFor=createBaseFor(),now=__name(function(){return root.Date.now()},"now"),FUNC_ERROR_TEXT="Expected a function",nativeMax=Math.max,nativeMin=Math.min;function debounce(func,wait,options){var lastArgs,lastThis,maxWait,result,timerId,lastCallTime,lastInvokeTime=0,leading=!1,maxing=!1,trailing=!0;if(typeof func!="function")throw new TypeError(FUNC_ERROR_TEXT);wait=toNumber(wait)||0,isObject$1(options)&&(leading=!!options.leading,maxing="maxWait"in options,maxWait=maxing?nativeMax(toNumber(options.maxWait)||0,wait):maxWait,trailing="trailing"in options?!!options.trailing:trailing);function invokeFunc(time){var args=lastArgs,thisArg=lastThis;return lastArgs=lastThis=void 0,lastInvokeTime=time,result=func.apply(thisArg,args),result}__name(invokeFunc,"invokeFunc");function leadingEdge(time){return lastInvokeTime=time,timerId=setTimeout(timerExpired,wait),leading?invokeFunc(time):result}__name(leadingEdge,"leadingEdge");function remainingWait(time){var timeSinceLastCall=time-lastCallTime,timeSinceLastInvoke=time-lastInvokeTime,timeWaiting=wait-timeSinceLastCall;return maxing?nativeMin(timeWaiting,maxWait-timeSinceLastInvoke):timeWaiting}__name(remainingWait,"remainingWait");function shouldInvoke(time){var timeSinceLastCall=time-lastCallTime,timeSinceLastInvoke=time-lastInvokeTime;return lastCallTime===void 0||timeSinceLastCall>=wait||timeSinceLastCall<0||maxing&&timeSinceLastInvoke>=maxWait}__name(shouldInvoke,"shouldInvoke");function timerExpired(){var time=now();if(shouldInvoke(time))return trailingEdge(time);timerId=setTimeout(timerExpired,remainingWait(time))}__name(timerExpired,"timerExpired");function trailingEdge(time){return timerId=void 0,trailing&&lastArgs?invokeFunc(time):(lastArgs=lastThis=void 0,result)}__name(trailingEdge,"trailingEdge");function cancel(){timerId!==void 0&&clearTimeout(timerId),lastInvokeTime=0,lastArgs=lastCallTime=lastThis=timerId=void 0}__name(cancel,"cancel");function flush(){return timerId===void 0?result:trailingEdge(now())}__name(flush,"flush");function debounced(){var time=now(),isInvoking=shouldInvoke(time);if(lastArgs=arguments,lastThis=this,lastCallTime=time,isInvoking){if(timerId===void 0)return leadingEdge(lastCallTime);if(maxing)return clearTimeout(timerId),timerId=setTimeout(timerExpired,wait),invokeFunc(lastCallTime)}return timerId===void 0&&(timerId=setTimeout(timerExpired,wait)),result}return __name(debounced,"debounced"),debounced.cancel=cancel,debounced.flush=flush,debounced}__name(debounce,"debounce");function assignMergeValue(object,key,value){(value!==void 0&&!eq(object[key],value)||value===void 0&&!(key in object))&&baseAssignValue(object,key,value)}__name(assignMergeValue,"assignMergeValue");function isArrayLikeObject(value){return isObjectLike(value)&&isArrayLike(value)}__name(isArrayLikeObject,"isArrayLikeObject");function safeGet(object,key){if(!(key==="constructor"&&typeof object[key]=="function")&&key!="__proto__")return object[key]}__name(safeGet,"safeGet");function toPlainObject(value){return copyObject(value,keysIn(value))}__name(toPlainObject,"toPlainObject");function baseMergeDeep(object,source,key,srcIndex,mergeFunc,customizer,stack){var objValue=safeGet(object,key),srcValue=safeGet(source,key),stacked=stack.get(srcValue);if(stacked){assignMergeValue(object,key,stacked);return}var newValue=customizer?customizer(objValue,srcValue,key+"",object,source,stack):void 0,isCommon=newValue===void 0;if(isCommon){var isArr=isArray(srcValue),isBuff=!isArr&&isBuffer(srcValue),isTyped=!isArr&&!isBuff&&isTypedArray(srcValue);newValue=srcValue,isArr||isBuff||isTyped?isArray(objValue)?newValue=objValue:isArrayLikeObject(objValue)?newValue=copyArray(objValue):isBuff?(isCommon=!1,newValue=cloneBuffer(srcValue)):isTyped?(isCommon=!1,newValue=cloneTypedArray(srcValue)):newValue=[]:isPlainObject(srcValue)||isArguments(srcValue)?(newValue=objValue,isArguments(objValue)?newValue=toPlainObject(objValue):(!isObject$1(objValue)||isFunction$1(objValue))&&(newValue=initCloneObject(srcValue))):isCommon=!1}isCommon&&(stack.set(srcValue,newValue),mergeFunc(newValue,srcValue,srcIndex,customizer,stack),stack.delete(srcValue)),assignMergeValue(object,key,newValue)}__name(baseMergeDeep,"baseMergeDeep");function baseMerge(object,source,srcIndex,customizer,stack){object!==source&&baseFor(source,function(srcValue,key){if(stack||(stack=new Stack),isObject$1(srcValue))baseMergeDeep(object,source,key,srcIndex,baseMerge,customizer,stack);else{var newValue=customizer?customizer(safeGet(object,key),srcValue,key+"",object,source,stack):void 0;newValue===void 0&&(newValue=srcValue),assignMergeValue(object,key,newValue)}},keysIn)}__name(baseMerge,"baseMerge");var mergeWith=createAssigner(function(object,source,srcIndex,customizer){baseMerge(object,source,srcIndex,customizer)}),merge=createAssigner(function(object,source,srcIndex){baseMerge(object,source,srcIndex)});function baseSet(object,path,value,customizer){if(!isObject$1(object))return object;path=castPath(path,object);for(var index2=-1,length=path.length,lastIndex=length-1,nested=object;nested!=null&&++index2<length;){var key=toKey(path[index2]),newValue=value;if(key==="__proto__"||key==="constructor"||key==="prototype")return object;if(index2!=lastIndex){var objValue=nested[key];newValue=void 0,newValue===void 0&&(newValue=isObject$1(objValue)?objValue:isIndex(path[index2+1])?[]:{})}assignValue(nested,key,newValue),nested=nested[key]}return object}__name(baseSet,"baseSet");function set(object,path,value){return object==null?object:baseSet(object,path,value)}__name(set,"set");function getDefaultExportFromCjs(x){return x&&x.__esModule&&Object.prototype.hasOwnProperty.call(x,"default")?x.default:x}__name(getDefaultExportFromCjs,"getDefaultExportFromCjs");var diff_1,hasRequiredDiff;function requireDiff(){if(hasRequiredDiff)return diff_1;hasRequiredDiff=1;var DIFF_DELETE=-1,DIFF_INSERT=1,DIFF_EQUAL=0;function diff_main(text1,text2,cursor_pos,cleanup,_fix_unicode){if(text1===text2)return text1?[[DIFF_EQUAL,text1]]:[];if(cursor_pos!=null){var editdiff=find_cursor_edit_diff(text1,text2,cursor_pos);if(editdiff)return editdiff}var commonlength=diff_commonPrefix(text1,text2),commonprefix=text1.substring(0,commonlength);text1=text1.substring(commonlength),text2=text2.substring(commonlength),commonlength=diff_commonSuffix(text1,text2);var commonsuffix=text1.substring(text1.length-commonlength);text1=text1.substring(0,text1.length-commonlength),text2=text2.substring(0,text2.length-commonlength);var diffs=diff_compute_(text1,text2);return commonprefix&&diffs.unshift([DIFF_EQUAL,commonprefix]),commonsuffix&&diffs.push([DIFF_EQUAL,commonsuffix]),diff_cleanupMerge(diffs,_fix_unicode),cleanup&&diff_cleanupSemantic(diffs),diffs}__name(diff_main,"diff_main");function diff_compute_(text1,text2){var diffs;if(!text1)return[[DIFF_INSERT,text2]];if(!text2)return[[DIFF_DELETE,text1]];var longtext=text1.length>text2.length?text1:text2,shorttext=text1.length>text2.length?text2:text1,i=longtext.indexOf(shorttext);if(i!==-1)return diffs=[[DIFF_INSERT,longtext.substring(0,i)],[DIFF_EQUAL,shorttext],[DIFF_INSERT,longtext.substring(i+shorttext.length)]],text1.length>text2.length&&(diffs[0][0]=diffs[2][0]=DIFF_DELETE),diffs;if(shorttext.length===1)return[[DIFF_DELETE,text1],[DIFF_INSERT,text2]];var hm=diff_halfMatch_(text1,text2);if(hm){var text1_a=hm[0],text1_b=hm[1],text2_a=hm[2],text2_b=hm[3],mid_common=hm[4],diffs_a=diff_main(text1_a,text2_a),diffs_b=diff_main(text1_b,text2_b);return diffs_a.concat([[DIFF_EQUAL,mid_common]],diffs_b)}return diff_bisect_(text1,text2)}__name(diff_compute_,"diff_compute_");function diff_bisect_(text1,text2){for(var text1_length=text1.length,text2_length=text2.length,max_d=Math.ceil((text1_length+text2_length)/2),v_offset=max_d,v_length=2*max_d,v1=new Array(v_length),v2=new Array(v_length),x=0;x<v_length;x++)v1[x]=-1,v2[x]=-1;v1[v_offset+1]=0,v2[v_offset+1]=0;for(var delta=text1_length-text2_length,front=delta%2!==0,k1start=0,k1end=0,k2start=0,k2end=0,d=0;d<max_d;d++){for(var k1=-d+k1start;k1<=d-k1end;k1+=2){var k1_offset=v_offset+k1,x1;k1===-d||k1!==d&&v1[k1_offset-1]<v1[k1_offset+1]?x1=v1[k1_offset+1]:x1=v1[k1_offset-1]+1;for(var y1=x1-k1;x1<text1_length&&y1<text2_length&&text1.charAt(x1)===text2.charAt(y1);)x1++,y1++;if(v1[k1_offset]=x1,x1>text1_length)k1end+=2;else if(y1>text2_length)k1start+=2;else if(front){var k2_offset=v_offset+delta-k1;if(k2_offset>=0&&k2_offset<v_length&&v2[k2_offset]!==-1){var x2=text1_length-v2[k2_offset];if(x1>=x2)return diff_bisectSplit_(text1,text2,x1,y1)}}}for(var k2=-d+k2start;k2<=d-k2end;k2+=2){var k2_offset=v_offset+k2,x2;k2===-d||k2!==d&&v2[k2_offset-1]<v2[k2_offset+1]?x2=v2[k2_offset+1]:x2=v2[k2_offset-1]+1;for(var y2=x2-k2;x2<text1_length&&y2<text2_length&&text1.charAt(text1_length-x2-1)===text2.charAt(text2_length-y2-1);)x2++,y2++;if(v2[k2_offset]=x2,x2>text1_length)k2end+=2;else if(y2>text2_length)k2start+=2;else if(!front){var k1_offset=v_offset+delta-k2;if(k1_offset>=0&&k1_offset<v_length&&v1[k1_offset]!==-1){var x1=v1[k1_offset],y1=v_offset+x1-k1_offset;if(x2=text1_length-x2,x1>=x2)return diff_bisectSplit_(text1,text2,x1,y1)}}}}return[[DIFF_DELETE,text1],[DIFF_INSERT,text2]]}__name(diff_bisect_,"diff_bisect_");function diff_bisectSplit_(text1,text2,x,y){var text1a=text1.substring(0,x),text2a=text2.substring(0,y),text1b=text1.substring(x),text2b=text2.substring(y),diffs=diff_main(text1a,text2a),diffsb=diff_main(text1b,text2b);return diffs.concat(diffsb)}__name(diff_bisectSplit_,"diff_bisectSplit_");function diff_commonPrefix(text1,text2){if(!text1||!text2||text1.charAt(0)!==text2.charAt(0))return 0;for(var pointermin=0,pointermax=Math.min(text1.length,text2.length),pointermid=pointermax,pointerstart=0;pointermin<pointermid;)text1.substring(pointerstart,pointermid)==text2.substring(pointerstart,pointermid)?(pointermin=pointermid,pointerstart=pointermin):pointermax=pointermid,pointermid=Math.floor((pointermax-pointermin)/2+pointermin);return is_surrogate_pair_start(text1.charCodeAt(pointermid-1))&&pointermid--,pointermid}__name(diff_commonPrefix,"diff_commonPrefix");function diff_commonOverlap_(text1,text2){var text1_length=text1.length,text2_length=text2.length;if(text1_length==0||text2_length==0)return 0;text1_length>text2_length?text1=text1.substring(text1_length-text2_length):text1_length<text2_length&&(text2=text2.substring(0,text1_length));var text_length=Math.min(text1_length,text2_length);if(text1==text2)return text_length;for(var best=0,length=1;;){var pattern=text1.substring(text_length-length),found=text2.indexOf(pattern);if(found==-1)return best;length+=found,(found==0||text1.substring(text_length-length)==text2.substring(0,length))&&(best=length,length++)}}__name(diff_commonOverlap_,"diff_commonOverlap_");function diff_commonSuffix(text1,text2){if(!text1||!text2||text1.slice(-1)!==text2.slice(-1))return 0;for(var pointermin=0,pointermax=Math.min(text1.length,text2.length),pointermid=pointermax,pointerend=0;pointermin<pointermid;)text1.substring(text1.length-pointermid,text1.length-pointerend)==text2.substring(text2.length-pointermid,text2.length-pointerend)?(pointermin=pointermid,pointerend=pointermin):pointermax=pointermid,pointermid=Math.floor((pointermax-pointermin)/2+pointermin);return is_surrogate_pair_end(text1.charCodeAt(text1.length-pointermid))&&pointermid--,pointermid}__name(diff_commonSuffix,"diff_commonSuffix");function diff_halfMatch_(text1,text2){var longtext=text1.length>text2.length?text1:text2,shorttext=text1.length>text2.length?text2:text1;if(longtext.length<4||shorttext.length*2<longtext.length)return null;function diff_halfMatchI_(longtext2,shorttext2,i){for(var seed=longtext2.substring(i,i+Math.floor(longtext2.length/4)),j=-1,best_common="",best_longtext_a,best_longtext_b,best_shorttext_a,best_shorttext_b;(j=shorttext2.indexOf(seed,j+1))!==-1;){var prefixLength=diff_commonPrefix(longtext2.substring(i),shorttext2.substring(j)),suffixLength=diff_commonSuffix(longtext2.substring(0,i),shorttext2.substring(0,j));best_common.length<suffixLength+prefixLength&&(best_common=shorttext2.substring(j-suffixLength,j)+shorttext2.substring(j,j+prefixLength),best_longtext_a=longtext2.substring(0,i-suffixLength),best_longtext_b=longtext2.substring(i+prefixLength),best_shorttext_a=shorttext2.substring(0,j-suffixLength),best_shorttext_b=shorttext2.substring(j+prefixLength))}return best_common.length*2>=longtext2.length?[best_longtext_a,best_longtext_b,best_shorttext_a,best_shorttext_b,best_common]:null}__name(diff_halfMatchI_,"diff_halfMatchI_");var hm1=diff_halfMatchI_(longtext,shorttext,Math.ceil(longtext.length/4)),hm2=diff_halfMatchI_(longtext,shorttext,Math.ceil(longtext.length/2)),hm;if(!hm1&&!hm2)return null;hm2?hm1?hm=hm1[4].length>hm2[4].length?hm1:hm2:hm=hm2:hm=hm1;var text1_a,text1_b,text2_a,text2_b;text1.length>text2.length?(text1_a=hm[0],text1_b=hm[1],text2_a=hm[2],text2_b=hm[3]):(text2_a=hm[0],text2_b=hm[1],text1_a=hm[2],text1_b=hm[3]);var mid_common=hm[4];return[text1_a,text1_b,text2_a,text2_b,mid_common]}__name(diff_halfMatch_,"diff_halfMatch_");function diff_cleanupSemantic(diffs){for(var changes=!1,equalities=[],equalitiesLength=0,lastequality=null,pointer=0,length_insertions1=0,length_deletions1=0,length_insertions2=0,length_deletions2=0;pointer<diffs.length;)diffs[pointer][0]==DIFF_EQUAL?(equalities[equalitiesLength++]=pointer,length_insertions1=length_insertions2,length_deletions1=length_deletions2,length_insertions2=0,length_deletions2=0,lastequality=diffs[pointer][1]):(diffs[pointer][0]==DIFF_INSERT?length_insertions2+=diffs[pointer][1].length:length_deletions2+=diffs[pointer][1].length,lastequality&&lastequality.length<=Math.max(length_insertions1,length_deletions1)&&lastequality.length<=Math.max(length_insertions2,length_deletions2)&&(diffs.splice(equalities[equalitiesLength-1],0,[DIFF_DELETE,lastequality]),diffs[equalities[equalitiesLength-1]+1][0]=DIFF_INSERT,equalitiesLength--,equalitiesLength--,pointer=equalitiesLength>0?equalities[equalitiesLength-1]:-1,length_insertions1=0,length_deletions1=0,length_insertions2=0,length_deletions2=0,lastequality=null,changes=!0)),pointer++;for(changes&&diff_cleanupMerge(diffs),diff_cleanupSemanticLossless(diffs),pointer=1;pointer<diffs.length;){if(diffs[pointer-1][0]==DIFF_DELETE&&diffs[pointer][0]==DIFF_INSERT){var deletion=diffs[pointer-1][1],insertion=diffs[pointer][1],overlap_length1=diff_commonOverlap_(deletion,insertion),overlap_length2=diff_commonOverlap_(insertion,deletion);overlap_length1>=overlap_length2?(overlap_length1>=deletion.length/2||overlap_length1>=insertion.length/2)&&(diffs.splice(pointer,0,[DIFF_EQUAL,insertion.substring(0,overlap_length1)]),diffs[pointer-1][1]=deletion.substring(0,deletion.length-overlap_length1),diffs[pointer+1][1]=insertion.substring(overlap_length1),pointer++):(overlap_length2>=deletion.length/2||overlap_length2>=insertion.length/2)&&(diffs.splice(pointer,0,[DIFF_EQUAL,deletion.substring(0,overlap_length2)]),diffs[pointer-1][0]=DIFF_INSERT,diffs[pointer-1][1]=insertion.substring(0,insertion.length-overlap_length2),diffs[pointer+1][0]=DIFF_DELETE,diffs[pointer+1][1]=deletion.substring(overlap_length2),pointer++),pointer++}pointer++}}__name(diff_cleanupSemantic,"diff_cleanupSemantic");var nonAlphaNumericRegex_=/[^a-zA-Z0-9]/,whitespaceRegex_=/\s/,linebreakRegex_=/[\r\n]/,blanklineEndRegex_=/\n\r?\n$/,blanklineStartRegex_=/^\r?\n\r?\n/;function diff_cleanupSemanticLossless(diffs){function diff_cleanupSemanticScore_(one,two){if(!one||!two)return 6;var char1=one.charAt(one.length-1),char2=two.charAt(0),nonAlphaNumeric1=char1.match(nonAlphaNumericRegex_),nonAlphaNumeric2=char2.match(nonAlphaNumericRegex_),whitespace1=nonAlphaNumeric1&&char1.match(whitespaceRegex_),whitespace2=nonAlphaNumeric2&&char2.match(whitespaceRegex_),lineBreak1=whitespace1&&char1.match(linebreakRegex_),lineBreak2=whitespace2&&char2.match(linebreakRegex_),blankLine1=lineBreak1&&one.match(blanklineEndRegex_),blankLine2=lineBreak2&&two.match(blanklineStartRegex_);return blankLine1||blankLine2?5:lineBreak1||lineBreak2?4:nonAlphaNumeric1&&!whitespace1&&whitespace2?3:whitespace1||whitespace2?2:nonAlphaNumeric1||nonAlphaNumeric2?1:0}__name(diff_cleanupSemanticScore_,"diff_cleanupSemanticScore_");for(var pointer=1;pointer<diffs.length-1;){if(diffs[pointer-1][0]==DIFF_EQUAL&&diffs[pointer+1][0]==DIFF_EQUAL){var equality1=diffs[pointer-1][1],edit=diffs[pointer][1],equality2=diffs[pointer+1][1],commonOffset=diff_commonSuffix(equality1,edit);if(commonOffset){var commonString=edit.substring(edit.length-commonOffset);equality1=equality1.substring(0,equality1.length-commonOffset),edit=commonString+edit.substring(0,edit.length-commonOffset),equality2=commonString+equality2}for(var bestEquality1=equality1,bestEdit=edit,bestEquality2=equality2,bestScore=diff_cleanupSemanticScore_(equality1,edit)+diff_cleanupSemanticScore_(edit,equality2);edit.charAt(0)===equality2.charAt(0);){equality1+=edit.charAt(0),edit=edit.substring(1)+equality2.charAt(0),equality2=equality2.substring(1);var score=diff_cleanupSemanticScore_(equality1,edit)+diff_cleanupSemanticScore_(edit,equality2);score>=bestScore&&(bestScore=score,bestEquality1=equality1,bestEdit=edit,bestEquality2=equality2)}diffs[pointer-1][1]!=bestEquality1&&(bestEquality1?diffs[pointer-1][1]=bestEquality1:(diffs.splice(pointer-1,1),pointer--),diffs[pointer][1]=bestEdit,bestEquality2?diffs[pointer+1][1]=bestEquality2:(diffs.splice(pointer+1,1),pointer--))}pointer++}}__name(diff_cleanupSemanticLossless,"diff_cleanupSemanticLossless");function diff_cleanupMerge(diffs,fix_unicode){diffs.push([DIFF_EQUAL,""]);for(var pointer=0,count_delete=0,count_insert=0,text_delete="",text_insert="",commonlength;pointer<diffs.length;){if(pointer<diffs.length-1&&!diffs[pointer][1]){diffs.splice(pointer,1);continue}switch(diffs[pointer][0]){case DIFF_INSERT:count_insert++,text_insert+=diffs[pointer][1],pointer++;break;case DIFF_DELETE:count_delete++,text_delete+=diffs[pointer][1],pointer++;break;case DIFF_EQUAL:var previous_equality=pointer-count_insert-count_delete-1;if(fix_unicode){if(previous_equality>=0&&ends_with_pair_start(diffs[previous_equality][1])){var stray=diffs[previous_equality][1].slice(-1);if(diffs[previous_equality][1]=diffs[previous_equality][1].slice(0,-1),text_delete=stray+text_delete,text_insert=stray+text_insert,!diffs[previous_equality][1]){diffs.splice(previous_equality,1),pointer--;var k=previous_equality-1;diffs[k]&&diffs[k][0]===DIFF_INSERT&&(count_insert++,text_insert=diffs[k][1]+text_insert,k--),diffs[k]&&diffs[k][0]===DIFF_DELETE&&(count_delete++,text_delete=diffs[k][1]+text_delete,k--),previous_equality=k}}if(starts_with_pair_end(diffs[pointer][1])){var stray=diffs[pointer][1].charAt(0);diffs[pointer][1]=diffs[pointer][1].slice(1),text_delete+=stray,text_insert+=stray}}if(pointer<diffs.length-1&&!diffs[pointer][1]){diffs.splice(pointer,1);break}if(text_delete.length>0||text_insert.length>0){text_delete.length>0&&text_insert.length>0&&(commonlength=diff_commonPrefix(text_insert,text_delete),commonlength!==0&&(previous_equality>=0?diffs[previous_equality][1]+=text_insert.substring(0,commonlength):(diffs.splice(0,0,[DIFF_EQUAL,text_insert.substring(0,commonlength)]),pointer++),text_insert=text_insert.substring(commonlength),text_delete=text_delete.substring(commonlength)),commonlength=diff_commonSuffix(text_insert,text_delete),commonlength!==0&&(diffs[pointer][1]=text_insert.substring(text_insert.length-commonlength)+diffs[pointer][1],text_insert=text_insert.substring(0,text_insert.length-commonlength),text_delete=text_delete.substring(0,text_delete.length-commonlength)));var n=count_insert+count_delete;text_delete.length===0&&text_insert.length===0?(diffs.splice(pointer-n,n),pointer=pointer-n):text_delete.length===0?(diffs.splice(pointer-n,n,[DIFF_INSERT,text_insert]),pointer=pointer-n+1):text_insert.length===0?(diffs.splice(pointer-n,n,[DIFF_DELETE,text_delete]),pointer=pointer-n+1):(diffs.splice(pointer-n,n,[DIFF_DELETE,text_delete],[DIFF_INSERT,text_insert]),pointer=pointer-n+2)}pointer!==0&&diffs[pointer-1][0]===DIFF_EQUAL?(diffs[pointer-1][1]+=diffs[pointer][1],diffs.splice(pointer,1)):pointer++,count_insert=0,count_delete=0,text_delete="",text_insert="";break}}diffs[diffs.length-1][1]===""&&diffs.pop();var changes=!1;for(pointer=1;pointer<diffs.length-1;)diffs[pointer-1][0]===DIFF_EQUAL&&diffs[pointer+1][0]===DIFF_EQUAL&&(diffs[pointer][1].substring(diffs[pointer][1].length-diffs[pointer-1][1].length)===diffs[pointer-1][1]?(diffs[pointer][1]=diffs[pointer-1][1]+diffs[pointer][1].substring(0,diffs[pointer][1].length-diffs[pointer-1][1].length),diffs[pointer+1][1]=diffs[pointer-1][1]+diffs[pointer+1][1],diffs.splice(pointer-1,1),changes=!0):diffs[pointer][1].substring(0,diffs[pointer+1][1].length)==diffs[pointer+1][1]&&(diffs[pointer-1][1]+=diffs[pointer+1][1],diffs[pointer][1]=diffs[pointer][1].substring(diffs[pointer+1][1].length)+diffs[pointer+1][1],diffs.splice(pointer+1,1),changes=!0)),pointer++;changes&&diff_cleanupMerge(diffs,fix_unicode)}__name(diff_cleanupMerge,"diff_cleanupMerge");function is_surrogate_pair_start(charCode){return charCode>=55296&&charCode<=56319}__name(is_surrogate_pair_start,"is_surrogate_pair_start");function is_surrogate_pair_end(charCode){return charCode>=56320&&charCode<=57343}__name(is_surrogate_pair_end,"is_surrogate_pair_end");function starts_with_pair_end(str){return is_surrogate_pair_end(str.charCodeAt(0))}__name(starts_with_pair_end,"starts_with_pair_end");function ends_with_pair_start(str){return is_surrogate_pair_start(str.charCodeAt(str.length-1))}__name(ends_with_pair_start,"ends_with_pair_start");function remove_empty_tuples(tuples){for(var ret=[],i=0;i<tuples.length;i++)tuples[i][1].length>0&&ret.push(tuples[i]);return ret}__name(remove_empty_tuples,"remove_empty_tuples");function make_edit_splice(before,oldMiddle,newMiddle,after){return ends_with_pair_start(before)||starts_with_pair_end(after)?null:remove_empty_tuples([[DIFF_EQUAL,before],[DIFF_DELETE,oldMiddle],[DIFF_INSERT,newMiddle],[DIFF_EQUAL,after]])}__name(make_edit_splice,"make_edit_splice");function find_cursor_edit_diff(oldText,newText,cursor_pos){var oldRange=typeof cursor_pos=="number"?{index:cursor_pos,length:0}:cursor_pos.oldRange,newRange=typeof cursor_pos=="number"?null:cursor_pos.newRange,oldLength=oldText.length,newLength=newText.length;if(oldRange.length===0&&(newRange===null||newRange.length===0)){var oldCursor=oldRange.index,oldBefore=oldText.slice(0,oldCursor),oldAfter=oldText.slice(oldCursor),maybeNewCursor=newRange?newRange.index:null;editBefore:{var newCursor=oldCursor+newLength-oldLength;if(maybeNewCursor!==null&&maybeNewCursor!==newCursor||newCursor<0||newCursor>newLength)break editBefore;var newBefore=newText.slice(0,newCursor),newAfter=newText.slice(newCursor);if(newAfter!==oldAfter)break editBefore;var prefixLength=Math.min(oldCursor,newCursor),oldPrefix=oldBefore.slice(0,prefixLength),newPrefix=newBefore.slice(0,prefixLength);if(oldPrefix!==newPrefix)break editBefore;var oldMiddle=oldBefore.slice(prefixLength),newMiddle=newBefore.slice(prefixLength);return make_edit_splice(oldPrefix,oldMiddle,newMiddle,oldAfter)}editAfter:{if(maybeNewCursor!==null&&maybeNewCursor!==oldCursor)break editAfter;var cursor2=oldCursor,newBefore=newText.slice(0,cursor2),newAfter=newText.slice(cursor2);if(newBefore!==oldBefore)break editAfter;var suffixLength=Math.min(oldLength-cursor2,newLength-cursor2),oldSuffix=oldAfter.slice(oldAfter.length-suffixLength),newSuffix=newAfter.slice(newAfter.length-suffixLength);if(oldSuffix!==newSuffix)break editAfter;var oldMiddle=oldAfter.slice(0,oldAfter.length-suffixLength),newMiddle=newAfter.slice(0,newAfter.length-suffixLength);return make_edit_splice(oldBefore,oldMiddle,newMiddle,oldSuffix)}}if(oldRange.length>0&&newRange&&newRange.length===0)replaceRange:{var oldPrefix=oldText.slice(0,oldRange.index),oldSuffix=oldText.slice(oldRange.index+oldRange.length),prefixLength=oldPrefix.length,suffixLength=oldSuffix.length;if(newLength<prefixLength+suffixLength)break replaceRange;var newPrefix=newText.slice(0,prefixLength),newSuffix=newText.slice(newLength-suffixLength);if(oldPrefix!==newPrefix||oldSuffix!==newSuffix)break replaceRange;var oldMiddle=oldText.slice(prefixLength,oldLength-suffixLength),newMiddle=newText.slice(prefixLength,newLength-suffixLength);return make_edit_splice(oldPrefix,oldMiddle,newMiddle,oldSuffix)}return null}__name(find_cursor_edit_diff,"find_cursor_edit_diff");function diff(text1,text2,cursor_pos,cleanup){return diff_main(text1,text2,cursor_pos,cleanup,!0)}return __name(diff,"diff"),diff.INSERT=DIFF_INSERT,diff.DELETE=DIFF_DELETE,diff.EQUAL=DIFF_EQUAL,diff_1=diff,diff_1}__name(requireDiff,"requireDiff");var diffExports=requireDiff();const textDiff=getDefaultExportFromCjs(diffExports);function remove(arr,item){const index2=arr.indexOf(item);return index2>-1?(arr.splice(index2,1),!0):!1}__name(remove,"remove");function dedupe(arr){const deduplicated=new Set,result=[];for(const element of arr)deduplicated.has(element)||(deduplicated.add(element),result.push(element));return result}__name(dedupe,"dedupe");function findLast(arr,callback){for(let i=arr.length-1;i>-1;i--){const item=arr[i];if(callback(item,i))return item}return null}__name(findLast,"findLast");function rotate(arr,steps){if(arr.length===0)return arr;const offset=steps%arr.length;return arr.slice(offset).concat(arr.slice(0,offset))}__name(rotate,"rotate");function groupBy(arr,keyFn){const groups=new Map;return arr.forEach(element=>{const key=keyFn(element);let group=groups.get(key);groups.has(key)||(group=[],groups.set(key,group)),group.push(element)}),groups}__name(groupBy,"groupBy");function makeArray(thing){return Array.isArray(thing)?thing:[thing]}__name(makeArray,"makeArray");function isBooleanString(str){return["true","false"].includes(str.toLowerCase())}__name(isBooleanString,"isBooleanString");const PREFIX="__INTERNAL_EDITOR__",DOCS_NORMAL_EDITOR_UNIT_ID_KEY=`${PREFIX}DOCS_NORMAL`,DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY=`${PREFIX}DOCS_FORMULA_BAR`,DOCS_ZEN_EDITOR_UNIT_ID_KEY=`${PREFIX}ZEN_EDITOR`,DEFAULT_EMPTY_DOCUMENT_VALUE=`\r
2
+ `,IS_ROW_STYLE_PRECEDE_COLUMN_STYLE="isRowStylePrecedeColumnStyle",AUTO_HEIGHT_FOR_MERGED_CELLS=Symbol("AUTO_HEIGHT_FOR_MERGED_CELLS");function createInternalEditorID(id){return`${PREFIX}${id}`}__name(createInternalEditorID,"createInternalEditorID");function isInternalEditorID(id){return id.startsWith(PREFIX)}__name(isInternalEditorID,"isInternalEditorID");var IdentifierDecoratorSymbol=Symbol("$$IDENTIFIER_DECORATOR");function isIdentifierDecorator(thing){return thing&&thing[IdentifierDecoratorSymbol]===!0}__name(isIdentifierDecorator,"isIdentifierDecorator");function isCtor(thing){return typeof thing=="function"}__name(isCtor,"isCtor");function isClassDependencyItem(thing){return!!(thing&&typeof thing.useClass<"u")}__name(isClassDependencyItem,"isClassDependencyItem");function isFactoryDependencyItem(thing){return!!(thing&&typeof thing.useFactory<"u")}__name(isFactoryDependencyItem,"isFactoryDependencyItem");function isValueDependencyItem(thing){return!!(thing&&typeof thing.useValue<"u")}__name(isValueDependencyItem,"isValueDependencyItem");function isExistingDependencyItem(thing){return!!(thing&&typeof thing.useExisting<"u")}__name(isExistingDependencyItem,"isExistingDependencyItem");function isAsyncDependencyItem(thing){return!!(thing&&typeof thing.useAsync<"u")}__name(isAsyncDependencyItem,"isAsyncDependencyItem");var AsyncHookSymbol=Symbol("AsyncHook");function isAsyncHook(thing){return!!(thing&&thing.__symbol===AsyncHookSymbol)}__name(isAsyncHook,"isAsyncHook");function prettyPrintIdentifier(id){return typeof id>"u"?"undefined":isCtor(id)&&!id[IdentifierDecoratorSymbol]?id.name:id.toString()}__name(prettyPrintIdentifier,"prettyPrintIdentifier");var __extends$4=function(){var extendStatics=__name(function(d,b){return extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d2,b2){d2.__proto__=b2}||function(d2,b2){for(var p in b2)Object.prototype.hasOwnProperty.call(b2,p)&&(d2[p]=b2[p])},extendStatics(d,b)},"extendStatics");return function(d,b){if(typeof b!="function"&&b!==null)throw new TypeError("Class extends value "+String(b)+" is not a constructor or null");extendStatics(d,b);function __(){this.constructor=d}__name(__,"__"),d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}}(),RediError=function(_super){__extends$4(RediError2,_super);function RediError2(message){return _super.call(this,"[redi]: ".concat(message))||this}return __name(RediError2,"RediError"),RediError2}(Error);exports.Quantity=void 0;(function(Quantity){Quantity.MANY="many",Quantity.OPTIONAL="optional",Quantity.REQUIRED="required"})(exports.Quantity||(exports.Quantity={}));exports.LookUp=void 0;(function(LookUp){LookUp.SELF="self",LookUp.SKIP_SELF="skipSelf"})(exports.LookUp||(exports.LookUp={}));var __extends$3=function(){var extendStatics=__name(function(d,b){return extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d2,b2){d2.__proto__=b2}||function(d2,b2){for(var p in b2)Object.prototype.hasOwnProperty.call(b2,p)&&(d2[p]=b2[p])},extendStatics(d,b)},"extendStatics");return function(d,b){if(typeof b!="function"&&b!==null)throw new TypeError("Class extends value "+String(b)+" is not a constructor or null");extendStatics(d,b);function __(){this.constructor=d}__name(__,"__"),d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}}(),TARGET=Symbol("$$TARGET"),DEPENDENCIES=Symbol("$$DEPENDENCIES"),DependencyDescriptorNotFoundError=function(_super){__extends$3(DependencyDescriptorNotFoundError2,_super);function DependencyDescriptorNotFoundError2(index2,target){var msg="Could not find dependency registered on the ".concat(index2,' (indexed) parameter of the constructor of "').concat(prettyPrintIdentifier(target),'".');return _super.call(this,msg)||this}return __name(DependencyDescriptorNotFoundError2,"DependencyDescriptorNotFoundError"),DependencyDescriptorNotFoundError2}(RediError),IdentifierUndefinedError=function(_super){__extends$3(IdentifierUndefinedError2,_super);function IdentifierUndefinedError2(target,index2){var msg='It seems that you register "undefined" as dependency on the '.concat(index2+1,' parameter of "').concat(prettyPrintIdentifier(target),'". Please make sure that there is not cyclic dependency among your TypeScript files, or consider using "forwardRef". For more info please visit our website https://redi.wendell.fun/docs/debug#could-not-find-dependency-registered-on');return _super.call(this,msg)||this}return __name(IdentifierUndefinedError2,"IdentifierUndefinedError"),IdentifierUndefinedError2}(RediError);function getDependencies(registerTarget){var target=registerTarget;return target[DEPENDENCIES]||[]}__name(getDependencies,"getDependencies");function getDependencyByIndex(registerTarget,index2){var allDependencies=getDependencies(registerTarget),dep=allDependencies.find(function(descriptor){return descriptor.paramIndex===index2});if(!dep)throw new DependencyDescriptorNotFoundError(index2,registerTarget);return dep}__name(getDependencyByIndex,"getDependencyByIndex");function setDependency(registerTarget,identifier,paramIndex,quantity,lookUp){quantity===void 0&&(quantity=exports.Quantity.REQUIRED);var descriptor={paramIndex,identifier,quantity,lookUp,withNew:!1};if(typeof identifier>"u")throw new IdentifierUndefinedError(registerTarget,paramIndex);var target=registerTarget;target[TARGET]===target?target[DEPENDENCIES].push(descriptor):(target[DEPENDENCIES]=[descriptor],target[TARGET]=target)}__name(setDependency,"setDependency");var knownIdentifiers=new Set;function createIdentifier(id){if(knownIdentifiers.has(id))throw new RediError('Identifier "'.concat(id,'" already exists.'));knownIdentifiers.add(id);var decorator=__name(function(registerTarget,_key,index2){setDependency(registerTarget,decorator,index2)},"decorator");return decorator.toString=function(){return id},decorator[IdentifierDecoratorSymbol]=!0,decorator}__name(createIdentifier,"createIdentifier");function changeLookup(target,index2,lookUp){var descriptor=getDependencyByIndex(target,index2);descriptor.lookUp=lookUp}__name(changeLookup,"changeLookup");function lookupDecoratorFactoryProducer(lookUp){return __name(function DecoratorFactory(){return this instanceof DecoratorFactory?this:function(target,_key,index2){changeLookup(target,index2,lookUp)}},"DecoratorFactory")}__name(lookupDecoratorFactoryProducer,"lookupDecoratorFactoryProducer");var SkipSelf=lookupDecoratorFactoryProducer(exports.LookUp.SKIP_SELF),Self=lookupDecoratorFactoryProducer(exports.LookUp.SELF),__extends$2=function(){var extendStatics=__name(function(d,b){return extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d2,b2){d2.__proto__=b2}||function(d2,b2){for(var p in b2)Object.prototype.hasOwnProperty.call(b2,p)&&(d2[p]=b2[p])},extendStatics(d,b)},"extendStatics");return function(d,b){if(typeof b!="function"&&b!==null)throw new TypeError("Class extends value "+String(b)+" is not a constructor or null");extendStatics(d,b);function __(){this.constructor=d}__name(__,"__"),d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}}(),QuantityCheckError=function(_super){__extends$2(QuantityCheckError2,_super);function QuantityCheckError2(id,quantity,actual){var _this=this,msg='Expect "'.concat(quantity,'" dependency items for id "').concat(prettyPrintIdentifier(id),'" but get ').concat(actual,".");return actual===0&&(msg+=" Did you forget to register it?"),actual>1&&(msg+=" You register it more than once."),_this=_super.call(this,msg)||this,_this.quantity=quantity,_this.actual=actual,_this}return __name(QuantityCheckError2,"QuantityCheckError"),QuantityCheckError2}(RediError);function checkQuantity(id,quantity,length){if(quantity===exports.Quantity.OPTIONAL&&length>1||quantity===exports.Quantity.REQUIRED&&length!==1)throw new QuantityCheckError(id,quantity,length)}__name(checkQuantity,"checkQuantity");function retrieveQuantity(quantity,arr){return quantity===exports.Quantity.MANY?arr:arr[0]}__name(retrieveQuantity,"retrieveQuantity");function changeQuantity(target,index2,quantity){var descriptor=getDependencyByIndex(target,index2);descriptor.quantity=quantity}__name(changeQuantity,"changeQuantity");function quantifyDecoratorFactoryProducer(quantity){return __name(function decoratorFactory(id){return this instanceof decoratorFactory?this:function(registerTarget,_key,index2){if(id)setDependency(registerTarget,id,index2,quantity);else{if(quantity===exports.Quantity.REQUIRED)throw new IdentifierUndefinedError(registerTarget,index2);changeQuantity(registerTarget,index2,quantity)}}},"decoratorFactory")}__name(quantifyDecoratorFactoryProducer,"quantifyDecoratorFactoryProducer");var Many=quantifyDecoratorFactoryProducer(exports.Quantity.MANY),Optional=quantifyDecoratorFactoryProducer(exports.Quantity.OPTIONAL),Inject=quantifyDecoratorFactoryProducer(exports.Quantity.REQUIRED);function changeToSelf(target,index2,withNew){var descriptor=getDependencyByIndex(target,index2);descriptor.withNew=withNew}__name(changeToSelf,"changeToSelf");function withNewDecoratorFactoryProducer(withNew){return __name(function DecoratorFactory(){return this instanceof DecoratorFactory?this:function(target,_key,index2){changeToSelf(target,index2,withNew)}},"DecoratorFactory")}__name(withNewDecoratorFactoryProducer,"withNewDecoratorFactoryProducer");var WithNew=withNewDecoratorFactoryProducer(!0);function normalizeFactoryDeps(deps,startIndex){return startIndex===void 0&&(startIndex=0),deps?deps.map(function(dep,index2){if(index2+=startIndex,!Array.isArray(dep))return{paramIndex:index2,identifier:dep,quantity:exports.Quantity.REQUIRED,withNew:!1};var modifiers=dep.slice(0,dep.length-1),identifier=dep[dep.length-1],lookUp,quantity=exports.Quantity.REQUIRED,withNew=!1;return modifiers.forEach(function(modifier){if(modifier instanceof Self)lookUp=exports.LookUp.SELF;else if(modifier instanceof SkipSelf)lookUp=exports.LookUp.SKIP_SELF;else if(modifier instanceof Optional)quantity=exports.Quantity.OPTIONAL;else if(modifier instanceof Many)quantity=exports.Quantity.MANY;else if(modifier instanceof WithNew)withNew=!0;else throw new RediError("unknown dep modifier ".concat(modifier,"."))}),{paramIndex:index2,identifier,quantity,lookUp,withNew}}):[]}__name(normalizeFactoryDeps,"normalizeFactoryDeps");function setDependencies(registerTarget,deps,startIndex){startIndex===void 0&&(startIndex=0);var normalizedDescriptors=normalizeFactoryDeps(deps,startIndex);normalizedDescriptors.forEach(function(descriptor){setDependency(registerTarget,descriptor.identifier,descriptor.paramIndex,descriptor.quantity,descriptor.lookUp)})}__name(setDependencies,"setDependencies");function forwardRef(wrapper){return{unwrap:wrapper}}__name(forwardRef,"forwardRef");function isForwardRef(thing){return!!thing&&typeof thing.unwrap=="function"}__name(isForwardRef,"isForwardRef");function normalizeForwardRef(id){return isForwardRef(id)?id.unwrap():id}__name(normalizeForwardRef,"normalizeForwardRef");function isDisposable(thing){return!!thing&&typeof thing.dispose=="function"}__name(isDisposable,"isDisposable");var __extends$1$1=function(){var extendStatics=__name(function(d,b){return extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d2,b2){d2.__proto__=b2}||function(d2,b2){for(var p in b2)Object.prototype.hasOwnProperty.call(b2,p)&&(d2[p]=b2[p])},extendStatics(d,b)},"extendStatics");return function(d,b){if(typeof b!="function"&&b!==null)throw new TypeError("Class extends value "+String(b)+" is not a constructor or null");extendStatics(d,b);function __(){this.constructor=d}__name(__,"__"),d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}}();function isBareClassDependency(thing){return thing.length===1}__name(isBareClassDependency,"isBareClassDependency");var ResolvingStack=[];function pushResolvingStack(id){ResolvingStack.push(id)}__name(pushResolvingStack,"pushResolvingStack");function popupResolvingStack(){ResolvingStack.pop()}__name(popupResolvingStack,"popupResolvingStack");function clearResolvingStack(){ResolvingStack.length=0}__name(clearResolvingStack,"clearResolvingStack");var DependencyNotFoundForModuleError=function(_super){__extends$1$1(DependencyNotFoundForModuleError2,_super);function DependencyNotFoundForModuleError2(toInstantiate,id,index2){var msg='Cannot find "'.concat(prettyPrintIdentifier(id),'" registered by any injector. It is the ').concat(index2,'th param of "').concat(isIdentifierDecorator(toInstantiate)?prettyPrintIdentifier(toInstantiate):toInstantiate.name,'".');return _super.call(this,msg)||this}return __name(DependencyNotFoundForModuleError2,"DependencyNotFoundForModuleError"),DependencyNotFoundForModuleError2}(RediError),DependencyNotFoundError=function(_super){__extends$1$1(DependencyNotFoundError2,_super);function DependencyNotFoundError2(id){var _this=this,msg='Cannot find "'.concat(prettyPrintIdentifier(id),'" registered by any injector. The stack of dependencies is: "').concat(ResolvingStack.map(function(id2){return prettyPrintIdentifier(id2)}).join(" -> "),'".');return _this=_super.call(this,msg)||this,clearResolvingStack(),_this}return __name(DependencyNotFoundError2,"DependencyNotFoundError"),DependencyNotFoundError2}(RediError),DependencyCollection=function(){function DependencyCollection2(dependencies){var _this=this;this.dependencyMap=new Map,this.normalizeDependencies(dependencies).map(function(pair){return _this.add(pair[0],pair[1])})}return __name(DependencyCollection2,"DependencyCollection"),DependencyCollection2.prototype.add=function(ctorOrId,val){typeof val>"u"&&(val={useClass:ctorOrId,lazy:!1});var arr=this.dependencyMap.get(ctorOrId);typeof arr>"u"&&(arr=[],this.dependencyMap.set(ctorOrId,arr)),arr.push(val)},DependencyCollection2.prototype.delete=function(id){this.dependencyMap.delete(id)},DependencyCollection2.prototype.get=function(id,quantity){quantity===void 0&&(quantity=exports.Quantity.REQUIRED);var ret=this.dependencyMap.get(id);return checkQuantity(id,quantity,ret.length),retrieveQuantity(quantity,ret)},DependencyCollection2.prototype.has=function(id){return this.dependencyMap.has(id)},DependencyCollection2.prototype.append=function(dependencies){var _this=this;this.normalizeDependencies(dependencies).forEach(function(pair){return _this.add(pair[0],pair[1])})},DependencyCollection2.prototype.dispose=function(){this.dependencyMap.clear()},DependencyCollection2.prototype.normalizeDependencies=function(dependencies){return dependencies.map(function(dependency){var id=dependency[0],val;return isBareClassDependency(dependency)?val={useClass:dependency[0],lazy:!1}:val=dependency[1],[id,val]})},DependencyCollection2}(),ResolvedDependencyCollection=function(){function ResolvedDependencyCollection2(){this.resolvedDependencies=new Map}return __name(ResolvedDependencyCollection2,"ResolvedDependencyCollection"),ResolvedDependencyCollection2.prototype.add=function(id,val){var arr=this.resolvedDependencies.get(id);typeof arr>"u"&&(arr=[],this.resolvedDependencies.set(id,arr)),arr.push(val)},ResolvedDependencyCollection2.prototype.has=function(id){return this.resolvedDependencies.has(id)},ResolvedDependencyCollection2.prototype.delete=function(id){if(this.resolvedDependencies.has(id)){var things=this.resolvedDependencies.get(id);things.forEach(function(t){return isDisposable(t)?t.dispose():void 0}),this.resolvedDependencies.delete(id)}},ResolvedDependencyCollection2.prototype.get=function(id,quantity){quantity===void 0&&(quantity=exports.Quantity.REQUIRED);var ret=this.resolvedDependencies.get(id);if(!ret)throw new DependencyNotFoundError(id);return checkQuantity(id,quantity,ret.length),quantity===exports.Quantity.MANY?ret:ret[0]},ResolvedDependencyCollection2.prototype.dispose=function(){Array.from(this.resolvedDependencies.values()).forEach(function(items){items.forEach(function(item){return isDisposable(item)?item.dispose():void 0})}),this.resolvedDependencies.clear()},ResolvedDependencyCollection2}(),runWhenIdle;(function(){if(typeof requestIdleCallback<"u"&&typeof cancelIdleCallback<"u")runWhenIdle=__name(function(runner,timeout){var handle=requestIdleCallback(runner,typeof timeout=="number"?{timeout}:void 0),disposed=!1;return function(){disposed||(disposed=!0,cancelIdleCallback(handle))}},"runWhenIdle");else{var dummyIdle_1=Object.freeze({didTimeout:!0,timeRemaining:__name(function(){return 15},"timeRemaining")});runWhenIdle=__name(function(runner){var handle=setTimeout(function(){return runner(dummyIdle_1)}),disposed=!1;return function(){disposed||(disposed=!0,clearTimeout(handle))}},"runWhenIdle")}})();var IdleValue=function(){function IdleValue2(executor){var _this=this;this.didRun=!1,this.selfExecutor=function(){try{_this.value=executor()}catch(err){_this.error=err}finally{_this.didRun=!0}},this.disposeCallback=runWhenIdle(function(){return _this.selfExecutor()})}return __name(IdleValue2,"IdleValue"),IdleValue2.prototype.hasRun=function(){return this.didRun},IdleValue2.prototype.dispose=function(){this.disposeCallback()},IdleValue2.prototype.getValue=function(){if(this.didRun||(this.dispose(),this.selfExecutor()),this.error)throw this.error;return this.value},IdleValue2}(),__extends$5=function(){var extendStatics=__name(function(d,b){return extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d2,b2){d2.__proto__=b2}||function(d2,b2){for(var p in b2)Object.prototype.hasOwnProperty.call(b2,p)&&(d2[p]=b2[p])},extendStatics(d,b)},"extendStatics");return function(d,b){if(typeof b!="function"&&b!==null)throw new TypeError("Class extends value "+String(b)+" is not a constructor or null");extendStatics(d,b);function __(){this.constructor=d}__name(__,"__"),d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}}(),__assign$1=__name(function(){return __assign$1=Object.assign||function(t){for(var s,i=1,n=arguments.length;i<n;i++){s=arguments[i];for(var p in s)Object.prototype.hasOwnProperty.call(s,p)&&(t[p]=s[p])}return t},__assign$1.apply(this,arguments)},"__assign$1"),__spreadArray$2=__name(function(to,from,pack){if(pack||arguments.length===2)for(var i=0,l=from.length,ar;i<l;i++)(ar||!(i in from))&&(ar||(ar=Array.prototype.slice.call(from,0,i)),ar[i]=from[i]);return to.concat(ar||Array.prototype.slice.call(from))},"__spreadArray$2"),MAX_RESOLUTIONS_QUEUED=300,NotInstantiatedSymbol=Symbol("$$NOT_INSTANTIATED_SYMBOL"),CircularDependencyError=function(_super){__extends$5(CircularDependencyError2,_super);function CircularDependencyError2(id){return _super.call(this,'Detecting cyclic dependency. The last identifier is "'.concat(prettyPrintIdentifier(id),'".'))||this}return __name(CircularDependencyError2,"CircularDependencyError"),CircularDependencyError2}(RediError),InjectorAlreadyDisposedError=function(_super){__extends$5(InjectorAlreadyDisposedError2,_super);function InjectorAlreadyDisposedError2(){return _super.call(this,"Injector cannot be accessed after it was disposed.")||this}return __name(InjectorAlreadyDisposedError2,"InjectorAlreadyDisposedError"),InjectorAlreadyDisposedError2}(RediError),AsyncItemReturnAsyncItemError=function(_super){__extends$5(AsyncItemReturnAsyncItemError2,_super);function AsyncItemReturnAsyncItemError2(id){return _super.call(this,'Async item "'.concat(prettyPrintIdentifier(id),'" returns another async item.'))||this}return __name(AsyncItemReturnAsyncItemError2,"AsyncItemReturnAsyncItemError"),AsyncItemReturnAsyncItemError2}(RediError),GetAsyncItemFromSyncApiError=function(_super){__extends$5(GetAsyncItemFromSyncApiError2,_super);function GetAsyncItemFromSyncApiError2(id){return _super.call(this,'Cannot get async item "'.concat(prettyPrintIdentifier(id),'" from sync api.'))||this}return __name(GetAsyncItemFromSyncApiError2,"GetAsyncItemFromSyncApiError"),GetAsyncItemFromSyncApiError2}(RediError),AddDependencyAfterResolutionError=function(_super){__extends$5(AddDependencyAfterResolutionError2,_super);function AddDependencyAfterResolutionError2(id){return _super.call(this,'Cannot add dependency "'.concat(prettyPrintIdentifier(id),'" after it is already resolved.'))||this}return __name(AddDependencyAfterResolutionError2,"AddDependencyAfterResolutionError"),AddDependencyAfterResolutionError2}(RediError),DeleteDependencyAfterResolutionError=function(_super){__extends$5(DeleteDependencyAfterResolutionError2,_super);function DeleteDependencyAfterResolutionError2(id){return _super.call(this,'Cannot dependency dependency "'.concat(prettyPrintIdentifier(id),'" after it is already resolved.'))||this}return __name(DeleteDependencyAfterResolutionError2,"DeleteDependencyAfterResolutionError"),DeleteDependencyAfterResolutionError2}(RediError),Injector=function(){function Injector2(dependencies,parent){parent===void 0&&(parent=null),this.parent=parent,this.children=[],this.resolutionOngoing=0,this.disposingCallbacks=new Set,this.disposed=!1,this.dependencyCollection=new DependencyCollection(dependencies||[]),this.resolvedDependencyCollection=new ResolvedDependencyCollection,parent&&parent.children.push(this)}return __name(Injector2,"Injector"),Injector2.prototype.onDispose=function(callback){var _this=this;return this.disposingCallbacks.add(callback),{dispose:__name(function(){return _this.disposingCallbacks.delete(callback)},"dispose")}},Injector2.prototype.createChild=function(dependencies){return this._ensureInjectorNotDisposed(),new Injector2(dependencies,this)},Injector2.prototype.dispose=function(){this.children.forEach(function(c){return c.dispose()}),this.children.length=0,this.dependencyCollection.dispose(),this.resolvedDependencyCollection.dispose(),this.deleteSelfFromParent(),this.disposed=!0,this.disposingCallbacks.forEach(function(callback){return callback()}),this.disposingCallbacks.clear()},Injector2.prototype.deleteSelfFromParent=function(){if(this.parent){var index2=this.parent.children.indexOf(this);index2>-1&&this.parent.children.splice(index2,1)}},Injector2.prototype.add=function(dependency){this._ensureInjectorNotDisposed();var identifierOrCtor=dependency[0],item=dependency[1];if(this.resolvedDependencyCollection.has(identifierOrCtor))throw new AddDependencyAfterResolutionError(identifierOrCtor);typeof item>"u"?this.dependencyCollection.add(identifierOrCtor):isAsyncDependencyItem(item)||isClassDependencyItem(item)||isValueDependencyItem(item)||isFactoryDependencyItem(item)?this.dependencyCollection.add(identifierOrCtor,item):this.resolvedDependencyCollection.add(identifierOrCtor,item)},Injector2.prototype.replace=function(dependency){this._ensureInjectorNotDisposed();var identifier=dependency[0];if(this.resolvedDependencyCollection.has(identifier))throw new AddDependencyAfterResolutionError(identifier);this.dependencyCollection.delete(identifier),dependency.length===1?this.dependencyCollection.add(identifier):this.dependencyCollection.add(identifier,dependency[1])},Injector2.prototype.delete=function(identifier){if(this._ensureInjectorNotDisposed(),this.resolvedDependencyCollection.has(identifier))throw new DeleteDependencyAfterResolutionError(identifier);this.dependencyCollection.delete(identifier)},Injector2.prototype.invoke=function(cb){for(var _this=this,args=[],_i=1;_i<arguments.length;_i++)args[_i-1]=arguments[_i];this._ensureInjectorNotDisposed();var accessor={get:__name(function(id,quantityOrLookup,lookUp){return _this._get(id,quantityOrLookup,lookUp)},"get"),has:__name(function(id){return _this.has(id)},"has")};return cb.apply(void 0,__spreadArray$2([accessor],args,!1))},Injector2.prototype.has=function(id){var _a17;return this.dependencyCollection.has(id)||((_a17=this.parent)===null||_a17===void 0?void 0:_a17.has(id))||!1},Injector2.prototype.get=function(id,quantityOrLookup,lookUp){this._ensureInjectorNotDisposed();var newResult=this._get(id,quantityOrLookup,lookUp);if(Array.isArray(newResult)&&newResult.some(function(r){return isAsyncHook(r)})||isAsyncHook(newResult))throw new GetAsyncItemFromSyncApiError(id);return newResult},Injector2.prototype._get=function(id,quantityOrLookup,lookUp,toSelf){var quantity=exports.Quantity.REQUIRED;if(quantityOrLookup===exports.Quantity.REQUIRED||quantityOrLookup===exports.Quantity.OPTIONAL||quantityOrLookup===exports.Quantity.MANY?quantity=quantityOrLookup:lookUp=quantityOrLookup,!toSelf){var cachedResult=this.getValue(id,quantity,lookUp);if(cachedResult!==NotInstantiatedSymbol)return cachedResult}return this.createDependency(id,quantity,lookUp,!toSelf)},Injector2.prototype.getAsync=function(id){this._ensureInjectorNotDisposed();var cachedResult=this.getValue(id,exports.Quantity.REQUIRED);if(cachedResult!==NotInstantiatedSymbol)return Promise.resolve(cachedResult);var newResult=this.createDependency(id,exports.Quantity.REQUIRED);return isAsyncHook(newResult)?newResult.whenReady():Promise.resolve(newResult)},Injector2.prototype.createInstance=function(ctor){for(var customArgs=[],_i=1;_i<arguments.length;_i++)customArgs[_i-1]=arguments[_i];return this._ensureInjectorNotDisposed(),this._resolveClassImpl.apply(this,__spreadArray$2([{useClass:ctor}],customArgs,!1))},Injector2.prototype._resolveDependency=function(id,item,shouldCache){shouldCache===void 0&&(shouldCache=!0);var result;pushResolvingStack(id);try{isValueDependencyItem(item)?result=this._resolveValueDependency(id,item):isFactoryDependencyItem(item)?result=this._resolveFactory(id,item,shouldCache):isClassDependencyItem(item)?result=this._resolveClass(id,item,shouldCache):isExistingDependencyItem(item)?result=this._resolveExisting(id,item):result=this._resolveAsync(id,item),popupResolvingStack()}catch(e){throw popupResolvingStack(),e}return result},Injector2.prototype._resolveExisting=function(id,item){var thing=this.get(item.useExisting);return this.resolvedDependencyCollection.add(id,thing),thing},Injector2.prototype._resolveValueDependency=function(id,item){var thing=item.useValue;return this.resolvedDependencyCollection.add(id,thing),thing},Injector2.prototype._resolveClass=function(id,item,shouldCache){var _this=this;shouldCache===void 0&&(shouldCache=!0);var thing;if(item.lazy){var idle_1=new IdleValue(function(){return _this._ensureInjectorNotDisposed(),_this._resolveClassImpl(item)});thing=new Proxy(Object.create(null),{get:__name(function(target,key){if(key in target)return target[key];if(key!=="whenReady"){var thing2=idle_1.getValue(),property=thing2[key];return typeof property!="function"||(property=property.bind(thing2),target[key]=property),property}},"get"),set:__name(function(_target,key,value){return idle_1.getValue()[key]=value,!0},"set")})}else thing=this._resolveClassImpl(item);return id&&shouldCache&&this.resolvedDependencyCollection.add(id,thing),thing},Injector2.prototype._resolveClassImpl=function(item){for(var _a17,extraParams=[],_i=1;_i<arguments.length;_i++)extraParams[_i-1]=arguments[_i];var Ctor=item.useClass;this.markNewResolution(Ctor);for(var declaredDependencies=getDependencies(Ctor).sort(function(a,b){return a.paramIndex-b.paramIndex}).map(function(descriptor){return __assign$1(__assign$1({},descriptor),{identifier:normalizeForwardRef(descriptor.identifier)})}),resolvedArgs=[],_b2=0,declaredDependencies_1=declaredDependencies;_b2<declaredDependencies_1.length;_b2++){var dep=declaredDependencies_1[_b2];try{var thing_1=this._get(dep.identifier,dep.quantity,dep.lookUp,dep.withNew);resolvedArgs.push(thing_1)}catch(error){throw error instanceof DependencyNotFoundError||error instanceof QuantityCheckError&&error.actual===0?new DependencyNotFoundForModuleError(Ctor,dep.identifier,dep.paramIndex):error}}var args=__spreadArray$2([],extraParams,!0),firstDependencyArgIndex=declaredDependencies.length>0?declaredDependencies[0].paramIndex:args.length;if(args.length!==firstDependencyArgIndex){console.warn("[redi]: Expect ".concat(firstDependencyArgIndex," custom parameter(s) of ").concat(prettyPrintIdentifier(Ctor)," but get ").concat(args.length,"."));var delta=firstDependencyArgIndex-args.length;delta>0?args=__spreadArray$2(__spreadArray$2([],args,!0),Array.from({length:delta}).fill(void 0),!0):args=args.slice(0,firstDependencyArgIndex)}var thing=new(Ctor.bind.apply(Ctor,__spreadArray$2(__spreadArray$2([void 0],args,!1),resolvedArgs,!1)));return(_a17=item==null?void 0:item.onInstantiation)===null||_a17===void 0||_a17.call(item,thing),this.markResolutionCompleted(),thing},Injector2.prototype._resolveFactory=function(id,item,shouldCache){var _a17;this.markNewResolution(id);for(var declaredDependencies=normalizeFactoryDeps(item.deps),resolvedArgs=[],_i=0,declaredDependencies_2=declaredDependencies;_i<declaredDependencies_2.length;_i++){var dep=declaredDependencies_2[_i];try{var thing_2=this._get(dep.identifier,dep.quantity,dep.lookUp,dep.withNew);resolvedArgs.push(thing_2)}catch(error){throw error instanceof DependencyNotFoundError||error instanceof QuantityCheckError&&error.actual===0?new DependencyNotFoundForModuleError(id,dep.identifier,dep.paramIndex):error}}var thing=item.useFactory.apply(null,resolvedArgs);return shouldCache&&this.resolvedDependencyCollection.add(id,thing),this.markResolutionCompleted(),(_a17=item==null?void 0:item.onInstantiation)===null||_a17===void 0||_a17.call(item,thing),thing},Injector2.prototype._resolveAsync=function(id,item){var _this=this,asyncLoader={__symbol:AsyncHookSymbol,whenReady:__name(function(){return _this._resolveAsyncImpl(id,item)},"whenReady")};return asyncLoader},Injector2.prototype._resolveAsyncImpl=function(id,item){var _this=this;return item.useAsync().then(function(thing){var resolvedCheck=_this.getValue(id);if(resolvedCheck!==NotInstantiatedSymbol)return resolvedCheck;var ret;if(Array.isArray(thing)){var item_1=thing[1];if(isAsyncDependencyItem(item_1))throw new AsyncItemReturnAsyncItemError(id);ret=_this._resolveDependency(id,item_1)}else isCtor(thing)?ret=_this._resolveClassImpl({useClass:thing,onInstantiation:item.onInstantiation}):ret=thing;return _this.resolvedDependencyCollection.add(id,ret),ret})},Injector2.prototype.getValue=function(id,quantity,lookUp){var _this=this;quantity===void 0&&(quantity=exports.Quantity.REQUIRED);var onSelf=__name(function(){return _this.dependencyCollection.has(id)&&!_this.resolvedDependencyCollection.has(id)?NotInstantiatedSymbol:_this.resolvedDependencyCollection.get(id,quantity)},"onSelf"),onParent=__name(function(){return _this.parent?_this.parent.getValue(id,quantity):(checkQuantity(id,quantity,0),quantity===exports.Quantity.MANY?[]:null)},"onParent");return lookUp===exports.LookUp.SKIP_SELF?onParent():id===Injector2?this:lookUp===exports.LookUp.SELF||this.resolvedDependencyCollection.has(id)||this.dependencyCollection.has(id)?onSelf():onParent()},Injector2.prototype.createDependency=function(id,quantity,lookUp,shouldCache){var _this=this;quantity===void 0&&(quantity=exports.Quantity.REQUIRED),shouldCache===void 0&&(shouldCache=!0);var onSelf=__name(function(){var registrations=_this.dependencyCollection.get(id,quantity),ret=null;return Array.isArray(registrations)?ret=registrations.map(function(dependencyItem){return _this._resolveDependency(id,dependencyItem,shouldCache)}):registrations&&(ret=_this._resolveDependency(id,registrations,shouldCache)),ret},"onSelf"),onParent=__name(function(){if(_this.parent)return _this.parent.createDependency(id,quantity,void 0,shouldCache);if(quantity===exports.Quantity.OPTIONAL)return null;throw pushResolvingStack(id),new DependencyNotFoundError(id)},"onParent");return lookUp===exports.LookUp.SKIP_SELF?onParent():this.dependencyCollection.has(id)?onSelf():onParent()},Injector2.prototype.markNewResolution=function(id){if(this.resolutionOngoing+=1,this.resolutionOngoing>=MAX_RESOLUTIONS_QUEUED)throw new CircularDependencyError(id)},Injector2.prototype.markResolutionCompleted=function(){this.resolutionOngoing-=1},Injector2.prototype._ensureInjectorNotDisposed=function(){if(this.disposed)throw new InjectorAlreadyDisposedError},Injector2}(),globalObject$1=typeof globalThis<"u"&&globalThis||typeof window<"u"&&window||typeof global<"u"&&global,__REDI_GLOBAL_LOCK__="REDI_GLOBAL_LOCK",isNode$1=typeof process<"u"&&process.versions!=null&&process.versions.node!=null;globalObject$1[__REDI_GLOBAL_LOCK__]?isNode$1||console.error(`[redi]: You are loading scripts of redi more than once! This may cause undesired behavior in your application.
3
3
  Maybe your dependencies added redi as its dependency and bundled redi to its dist files. Or you import different versions of redi.
4
- For more info please visit our website: https://redi.wendell.fun/en-US/docs/debug#import-scripts-of-redi-more-than-once`):Po[Fo]=!0;var ko="REDI_CONTEXT_LOCK",Yg=typeof process<"u"&&process.versions!=null&&process.versions.node!=null,$o=typeof globalThis<"u"&&globalThis||typeof window<"u"&&window||typeof global<"u"&&global;$o[ko]?Yg||console.error(`[redi]: "RediContext" is already created. You may import "RediContext" from different paths. Use "import { RediContext } from '@wendellhu/redi/react-bindings'; instead."`):$o[ko]=!0;var mr=wt.createContext({injector:null});mr.displayName="RediContext";var ji=mr.Provider,El=mr.Consumer,ns=function(){return ns=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s])}return e},ns.apply(this,arguments)};function Vg(e){var t=e.children,n=e.dependencies,r=wt.useRef(null);return wt.useEffect(function(){return function(){var s;return(s=r.current)===null||s===void 0?void 0:s.dispose()}},[]),wt.createElement(El,null,function(s){var i;return r.current?i=r.current:(i=s.injector?s.injector.createChild(n):new Ct(n),r.current=i),wt.createElement(ji,{value:{injector:i}},t)})}function Gg(e,t){return function(r){return wt.createElement(ji,{value:{injector:t}},wt.createElement(e,ns({},r)))}}function Kg(e,t){return function(r){return wt.createElement(Vg,{dependencies:t},wt.createElement(e,ns({},r)))}}var Xg=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,s){r.__proto__=s}||function(r,s){for(var i in s)Object.prototype.hasOwnProperty.call(s,i)&&(r[i]=s[i])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),Qg=function(e){Xg(t,e);function t(n){return e.call(this,'You should make "RediContext" as '.concat(n.constructor.name,"'s default context type. ")+"If you want to use multiple context, please check this on React doc site. https://reactjs.org/docs/context.html#classcontexttype")||this}return t}(ot);function qg(e,t,n){return function(){return{get:function(){var r=this,s=r.context;if(!s||!s.injector)throw new Qg(r);var i=s.injector,o=i.get(e,t||exports.Quantity.REQUIRED,n);return o}}}}var Jg=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,s){r.__proto__=s}||function(r,s){for(var i in s)Object.prototype.hasOwnProperty.call(s,i)&&(r[i]=s[i])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),Zg=function(e){Jg(t,e);function t(){return e.call(this,"Using dependency injection outside of a RediContext.")||this}return t}(ot);function Cl(){var e=wt.useContext(mr);if(!e.injector)throw new Zg;return e.injector}function ep(e,t,n){var r=Cl();return wt.useMemo(function(){return r.get(e,t,n)},[e,t,n])}var tp=function(e,t,n){if(n||arguments.length===2)for(var r=0,s=t.length,i;r<s;r++)(i||!(r in t))&&(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))};function Rl(e,t){var n=e instanceof Oe.BehaviorSubject&&typeof t>"u"?e.getValue():t,r=lt.useState(n),s=r[0],i=r[1];return lt.useEffect(function(){var o=e.subscribe(function(a){return i(a)});return function(){return o.unsubscribe()}},[e]),s}function Bo(e){return typeof e=="function"?e():e}function np(e,t,n,r){if(typeof e=="function"&&!r)throw new ot("Expected deps to be provided when observable is a function!");var s=lt.useRef(null),i=lt.useRef(!1),o=lt.useMemo(function(){return e},tp([],typeof r<"u"?r:[e],!0)),a=lt.useState(0);a[0];var l=a[1],c=lt.useRef(function(){var h;if(o){var u=Bo(o).subscribe(function(d){i.current=!0,h=d});u.unsubscribe()}return h!=null?h:t}());if(lt.useEffect(function(){var h=null;return o&&(s.current=Bo(o),h=s.current.subscribe(function(u){c.current=u,l(function(d){return d+1})})),function(){return h==null?void 0:h.unsubscribe()}},[o]),n&&!i.current)throw new Error("Expect `shouldHaveSyncValue` but not getting a sync value!");return c.current}function rp(e){var t=lt.useState(0),n=t[1];lt.useEffect(function(){var r=e.subscribe(function(){return n(function(s){return s+1})});return function(){return r.unsubscribe()}},[])}var ti=new WeakMap;function sp(e,t){var n=lt.useRef(void 0),r=Rl(e,t),s=lt.useMemo(function(){return lt.createContext(r)},[e]),i=lt.useCallback(function(o){return lt.createElement(s.Provider,{value:r},o.children)},[e,r]);return n.current!==e&&(n.current&&ti.delete(n.current),n.current=e,ti.set(e,s)),{Provider:i,value:r}}function ip(e){var t=ti.get(e);if(!t)throw new ot("try to read context value but no ancestor component subscribed it.");return lt.useContext(t)}function op(e,t){t.forEach(n=>e.add(n))}function Il(e,t){t.forEach(([n])=>{e.has(n)&&e.get(n)})}function vl(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 ni extends Error{constructor(t){super(t),this.name="CustomCommandExecutionError"}}class yl extends Error{constructor(){super("Canceled by facade"),this.name="CanceledError"}}async function Sl(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 Ol(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 jo(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Ho(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),s,i=[],o;try{for(;(t===void 0||t-- >0)&&!(s=r.next()).done;)i.push(s.value)}catch(a){o={error:a}}finally{try{s&&!s.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return i}function Wo(e,t,n){if(n||arguments.length===2)for(var r=0,s=t.length,i;r<s;r++)(i||!(r in t))&&(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}function ar(e){return typeof e=="function"}function ap(e){var t=function(r){Error.call(r),r.stack=new Error().stack},n=e(t);return n.prototype=Object.create(Error.prototype),n.prototype.constructor=n,n}var Ms=ap(function(e){return function(n){e(this),this.message=n?n.length+` errors occurred during unsubscription:
5
- `+n.map(function(r,s){return s+1+") "+r.toString()}).join(`
6
- `):"",this.name="UnsubscriptionError",this.errors=n}});function zo(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}var bl=function(){function e(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var t,n,r,s,i;if(!this.closed){this.closed=!0;var o=this._parentage;if(o)if(this._parentage=null,Array.isArray(o))try{for(var a=jo(o),l=a.next();!l.done;l=a.next()){var c=l.value;c.remove(this)}}catch(R){t={error:R}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}else o.remove(this);var h=this.initialTeardown;if(ar(h))try{h()}catch(R){i=R instanceof Ms?R.errors:[R]}var u=this._finalizers;if(u){this._finalizers=null;try{for(var d=jo(u),f=d.next();!f.done;f=d.next()){var E=f.value;try{Yo(E)}catch(R){i=i!=null?i:[],R instanceof Ms?i=Wo(Wo([],Ho(i)),Ho(R.errors)):i.push(R)}}}catch(R){r={error:R}}finally{try{f&&!f.done&&(s=d.return)&&s.call(d)}finally{if(r)throw r.error}}}if(i)throw new Ms(i)}},e.prototype.add=function(t){var n;if(t&&t!==this)if(this.closed)Yo(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(n=this._finalizers)!==null&&n!==void 0?n:[]).push(t)}},e.prototype._hasParent=function(t){var n=this._parentage;return n===t||Array.isArray(n)&&n.includes(t)},e.prototype._addParent=function(t){var n=this._parentage;this._parentage=Array.isArray(n)?(n.push(t),n):n?[n,t]:t},e.prototype._removeParent=function(t){var n=this._parentage;n===t?this._parentage=null:Array.isArray(n)&&zo(n,t)},e.prototype.remove=function(t){var n=this._finalizers;n&&zo(n,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}();bl.EMPTY;function lp(e){return e instanceof bl||e&&"closed"in e&&ar(e.remove)&&ar(e.add)&&ar(e.unsubscribe)}function Yo(e){ar(e)?e():e.unsubscribe()}function Qe(e){let t=!1;return e?lp(e)?{dispose:()=>e.unsubscribe()}:typeof e=="function"?{dispose:()=>{t||(t=!0,e())}}:e:Qe(()=>{})}function up(e){return Qe(()=>{e.unsubscribe()})}class Rs{constructor(){C(this,"_disposables",new Set)}add(t){const n=Qe(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 nt{constructor(){C(this,"_disposed",!1);C(this,"_collection",new Rs)}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 cp extends nt{constructor(){super(...arguments);C(this,"dispose$",new Oe.Subject)}dispose(){super.dispose(),this.dispose$.next(),this.dispose$.complete()}}class hp extends nt{constructor(n){super();C(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())}}const _r=_t("univer.context-service");class wl extends nt{constructor(){super(...arguments);C(this,"_contextChanged$",new Oe.Subject);C(this,"contextChanged$",this._contextChanged$.asObservable());C(this,"_contextMap",new Map)}dispose(){super.dispose(),this._contextChanged$.complete()}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 Oe.Observable(r=>{const s=this._contextChanged$.pipe(Oe.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 Al=(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))(Al||{});const At=_t("univer.log");class Tl extends nt{constructor(){super(...arguments);C(this,"_logLevel",3)}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)}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)}}var dp=Object.defineProperty,fp=Object.getOwnPropertyDescriptor,gp=(e,t,n,r)=>{for(var s=r>1?void 0:r?fp(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=(r?o(t,n,s):o(s))||s);return r&&s&&dp(t,n,s),s},Vo=(e,t)=>(n,r)=>t(n,r,e),Wn=(e=>(e[e.COMMAND=0]="COMMAND",e[e.OPERATION=1]="OPERATION",e[e.MUTATION=2]="MUTATION",e))(Wn||{});const Dt=_t("anywhere.command-service");class pp{constructor(){C(this,"_commands",new Map);C(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),Qe(()=>{this._commands.delete(t.id),this._commandTypes.delete(t.id)})}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 Nl={id:"nil",type:0,handler:()=>!0};exports.CommandService=class extends nt{constructor(n,r){super();C(this,"_commandRegistry");C(this,"_beforeCommandExecutionListeners",[]);C(this,"_commandExecutedListeners",[]);C(this,"_multiCommandDisposables",new Map);C(this,"_commandExecutingLevel",0);C(this,"_commandExecutionStack",[]);this._injector=n,this._logService=r,this._commandRegistry=new pp,this._registerCommand(Nl)}dispose(){super.dispose(),this._commandExecutedListeners.length=0,this._beforeCommandExecutionListeners.length=0}hasCommand(n){return this._commandRegistry.hasCommand(n)}registerCommand(n){return this._registerCommand(n)}registerMultipleCommand(n){return this._registerMultiCommand(n)}beforeCommandExecuted(n){if(this._beforeCommandExecutionListeners.indexOf(n)===-1)return this._beforeCommandExecutionListeners.push(n),Qe(()=>{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),Qe(()=>{const r=this._commandExecutedListeners.indexOf(n);this._commandExecutedListeners.splice(r,1)});throw new Error("[CommandService]: could not add a 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);this._beforeCommandExecutionListeners.forEach(h=>h(a,s));const c=await this._execute(o,r,s);return this._commandExecutedListeners.forEach(h=>h(a,s)),l.dispose(),c}throw new Error(`[CommandService]: command "${n}" is not registered.`)}catch(i){if(i instanceof ni)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 u=dg(this._commandExecutionStack,d=>d.type===0);u&&(l.params=(i=l.params)!=null?i:{},l.params.trigger=u.id)}const c=this._pushCommandExecutionStack(l);this._beforeCommandExecutionListeners.forEach(u=>u(l,s));const h=this._syncExecute(a,r,s);return this._commandExecutedListeners.forEach(u=>u(l,s)),c.dispose(),h}throw new Error(`[CommandService]: command "${n}" is not registered.`)}catch(o){if(o instanceof ni)return!1;throw o}}_pushCommandExecutionStack(n){return this._commandExecutionStack.push(n),Qe(()=>gr(this._commandExecutionStack,n))}_registerCommand(n){return this._commandRegistry.registerCommand(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{const o=new Rs;s=new mp(n.id),o.add(this._commandRegistry.registerCommand(s)),o.add(Qe(()=>{this._multiCommandDisposables.delete(n.id)})),this._multiCommandDisposables.set(n.id,o)}const i=s.registerImplementation(n);return Qe(()=>{var o;i.dispose(),s.hasImplementations()||(o=this._multiCommandDisposables.get(n.id))==null||o.dispose()})}async _execute(n,r,s){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){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=gp([Vo(0,it(Ct)),Vo(1,At)],exports.CommandService);class mp{constructor(t){C(this,"name");C(this,"multi",!0);C(this,"type",0);C(this,"priority",0);C(this,"_implementations",[]);C(this,"handler",async(t,n)=>{if(!this._implementations.length)return!1;const r=t.get(At),s=t.get(_r),i=t.get(Ct);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),Qe(()=>{const r=this._implementations.indexOf(n);this._implementations.splice(r,1)})}hasImplementations(){return this._implementations.length>0}}function Hi(e,t,n){const r=e.map(s=>()=>t.syncExecuteCommand(s.id,s.params,n));return Ol(r)}function _p(e,t,n){const r=e.map(s=>()=>t.executeCommand(s.id,s.params,n));return Sl(r)}function Ml(e){return new Oe.Observable(t=>{const n=e((...r)=>t.next(r));return()=>n==null?void 0:n.dispose()})}function Dl(e){return function(n){return new Oe.Observable(r=>(n.subscribe({next:s=>{r.next(s),e(s)&&r.complete()},complete:()=>r.complete(),error:s=>r.error(s)}),()=>r.unsubscribe()))}}function Ep(e=0){return t=>{let n=[];return t.pipe(Oe.tap(r=>n.push(r)),Oe.debounceTime(e),Oe.map(()=>n),Oe.tap(()=>n=[]))}}function Cp(e){const t=new Oe.ReplaySubject(1);return setTimeout(()=>t.next(),e),t.pipe(Oe.take(1))}const Rp=e=>new Promise(t=>{Oe.merge(Ml(e.onCommandExecuted.bind(e)).pipe($r.filter(([n])=>n.type===Wn.MUTATION)),Oe.timer(300)).pipe($r.debounceTime(16),$r.first()).subscribe(()=>{t()})});function xl(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 Ip(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 Ll(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 vp(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=xl(e,t):r=Ll(e,t),n){const s=e[r];return e.indexOf(s)}return r}function yp(e){const t=new Blob([e],{type:"text/javascript"});return window.URL.createObjectURL(t)}const Jn=2,Ul=1;function Sp(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:h=0,angle:u=0}=e,d=h,f=c,E=i,R=s;return Math.abs(a-n)>Jn||Math.abs(l-r)>Jn||Math.abs(d-E)>Jn||Math.abs(f-R)>Jn||Math.abs(u-o)>Ul}var Pl=(e=>(e[e.DEFAULT_SERIES=0]="DEFAULT_SERIES",e[e.ALTERNATE_SERIES=1]="ALTERNATE_SERIES",e))(Pl||{}),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||{}),Fl=(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))(Fl||{}),vt=(e=>(e[e.UNSUPPORTED=0]="UNSUPPORTED",e[e.RGB=1]="RGB",e[e.HEX=2]="HEX",e[e.THEME=3]="THEME",e))(vt||{}),kl=(e=>(e[e.ON=0]="ON",e[e.OFF=1]="OFF",e))(kl||{}),$l=(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))($l||{}),Bl=(e=>(e[e.LEFT=0]="LEFT",e[e.RIGHT=1]="RIGHT",e))(Bl||{}),jl=(e=>(e[e.DOCUMENT=0]="DOCUMENT",e[e.PROJECT=1]="PROJECT",e))(jl||{}),Hl=(e=>(e[e.COLUMNS=0]="COLUMNS",e[e.ROWS=1]="ROWS",e))(Hl||{}),Wl=(e=>(e[e.UP=0]="UP",e[e.RIGHT=1]="RIGHT",e[e.DOWN=2]="DOWN",e[e.LEFT=3]="LEFT",e))(Wl||{});function Op(e){switch(e){case 3:return 1;case 1:return 3;case 0:return 2;case 2:return 0}}var zl=(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))(zl||{}),Er=(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))(Er||{}),rs=(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))(rs||{}),Yl=(e=>(e[e.RANGE=0]="RANGE",e[e.SHEET=1]="SHEET",e))(Yl||{}),Vl=(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))(Vl||{}),Gl=(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))(Gl||{}),Kl=(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))(Kl||{}),Xl=(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))(Xl||{}),Ql=(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))(Ql||{}),ql=(e=>(e[e.GRID=0]="GRID",e[e.KANBAN=1]="KANBAN",e[e.GANTT=2]="GANTT",e))(ql||{}),Pn=(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))(Pn||{}),Wi=(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))(Wi||{}),$t=(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))($t||{}),tn=(e=>(e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.TOP=1]="TOP",e[e.MIDDLE=2]="MIDDLE",e[e.BOTTOM=3]="BOTTOM",e))(tn||{}),_n=(e=>(e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.OVERFLOW=1]="OVERFLOW",e[e.CLIP=2]="CLIP",e[e.WRAP=3]="WRAP",e))(_n||{}),ss=(e=>(e[e.NORMAL=0]="NORMAL",e[e.ITALIC=1]="ITALIC",e))(ss||{}),is=(e=>(e[e.NORMAL=0]="NORMAL",e[e.BOLD=1]="BOLD",e))(is||{}),Ut=(e=>(e[e.NORMAL=1]="NORMAL",e[e.SUBSCRIPT=2]="SUBSCRIPT",e[e.SUPERSCRIPT=3]="SUPERSCRIPT",e))(Ut||{}),Se=(e=>(e[e.FALSE=0]="FALSE",e[e.TRUE=1]="TRUE",e))(Se||{}),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||{}),gt=(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))(gt||{}),Is=(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))(Is||{});const bp="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let wp=e=>crypto.getRandomValues(new Uint8Array(e)),Ap=(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}}},Tp=(e,t=21)=>Ap(e,t|0,wp),Np=(e=21)=>{let t="",n=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+=bp[n[e]&63];return t};const Jl=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"]),Mp=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 Dp(e){if(!Number.isNaN(+e))return!1;if(e.startsWith("http://localhost:3002")||e.startsWith("localhost:3002"))return!0;if(Mp.test(e)){if(Zl(e))return!0;try{const r=new URL(eu(e)).hostname.split(".").pop();if(r&&Jl.has(r))return!0}catch{return!1}}return!1}function Zl(e){return/^[a-zA-Z]+:\/\//.test(e)}function xp(e){return/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/.test(e)}function eu(e){return Zl(e)?e:xp(e)?`mailto://${e}`:`https://${e}`}const Lp=/^-ms-/,Up=/-([a-z])/g,qt=["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 zi(e,t){const n=re.getValueType(e),r=re.getValueType(t);return n!==r?!1:re.isArray(e)?Pp(e,t):re.isObject(e)?Fp(e,t):re.isDate(e)?e.getTime()===t.getTime():re.isRegExp(e)?e.toString()===t.toString():e===t}function Pp(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(!zi(s,i))return!1}return!0}function Fp(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(!zi(i,o))return!1}return!0}class re{static stringAt(t){let n="",r=t;for(;r>=qt.length;)r/=qt.length,r-=1,n+=qt[r%qt.length];const s=t%qt.length;return n+=qt[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+=qt.length**i+qt.length*s}return n+=t.charCodeAt(t.length-1)-65,n}static deleteBlank(t){return re.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 h=Number.parseFloat(RegExp.$1);return h===7?"IE7":h===8?"IE8":h===9?"IE9":h===10?"IE10":"0"}return o?"FF":n?"Opera":a?"Safari":l?"Chrome":i?"Edge":s?"IE11":"Unknown browser"}static generateRandomId(t=21,n){return zt(t,n)}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 h,u;if(re.isArray(l)){const d=(h=a[c])!=null?h:[];a[c]=d,r(l,d);return}if(re.isObject(l)){const d=(u=a[c])!=null?u:{};a[c]=d,s(l,d);return}a[c]=l})}function s(o,a){Object.keys(o).forEach(l=>{var h,u;const c=o[l];if(re.isObject(c)){const d=(h=a[l])!=null?h:{};a[l]=d,s(c,d);return}if(re.isArray(c)){const d=(u=a[l])!=null?u:[];a[l]=d,r(c,d);return}a[l]=c})}function i(o){Object.keys(o).forEach(a=>{var c,h;const l=o[a];if(re.isArray(l)){const u=(c=t[a])!=null?c:[];t[a]=u,r(l,u);return}if(re.isObject(l)){const u=(h=t[a])!=null?h:{};t[a]=u,s(l,u);return}t[a]=l})}return t}static numberFixed(t,n){return Number(Number(t).toFixed(n))}static diffValue(t,n){return zi(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]=re.deepClone(r)}),n}if(this.isObject(t)){const n={};return Object.keys(t).forEach(r=>{const s=t[r];n[r]=re.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 isBoolean(t){return this.getValueType(t)==="[object Boolean]"}static isPlainObject(t){return this.isDefine(t)?Object.getPrototypeOf(t)===Object.getPrototypeOf({}):!1}static isFunction(t){return this.getValueType(t)==="[object Function]"}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 isMobile(){let t=0,n=0;return document.body.clientWidth&&(t=document.body.clientWidth),document.body.clientHeight&&(n=document.body.clientHeight),this.isAndroid()||this.isIPhone()||this.isTablet()||t<350&&n<500}static isTablet(){return/ipad|android|android 3.0|xoom|sch-i800|playbook|tablet|kindle/i.test(navigator.userAgent.toLowerCase())}static isWeChat(){const t=navigator.userAgent.toLowerCase();return String(t.match(/MicroMessenger/i))==="micromessenger"}static isAndroid(){const t=navigator.userAgent;return t.indexOf("Android")>-1||t.indexOf("Linux")>-1}static isIPhone(){return/iPhone/i.test(navigator.userAgent)}static isLegalUrl(t){return Dp(t)}static normalizeUrl(t){return eu(t)}static topLevelDomainCombiningString(){return[...Jl].join("|")}static itCount(t){return n=>{for(let r=0;r<t;r++)n&&n()}}static hasLength(t,n){return re.isDefine(t)?re.isDefine(n)?t.length===n:t.length>0:!1}static capitalize(t){return t.charAt(0).toUpperCase()+t.slice(1)}static fCamelCase(t,n){return n.toUpperCase()}static camelCase(t){return t.replace(Lp,"ms-").replace(Up,this.fCamelCase)}static removeNull(t){return this.isObject(t)&&Object.keys(t).forEach(n=>{const r=t[n];r==null?delete t[n]:re.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 randSort(t){for(let n=0,r=t.length;n<r;n++){const s=Number.parseInt((Math.random()*r).toString()),i=t[s];t[s]=t[n],t[n]=i}return t}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 commonExtend1(t,n){for(const r in t)n[r]==null&&(n[r]=t[r]);return n}static arrayToObject(t){const n={};return t.forEach((r,s)=>{n[s]={},r.forEach((i,o)=>{n[s][o]=i})}),n}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 zt(e=21,t){return t?Tp(t,e)():Np(e)}function ri(...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 kp=()=>typeof process<"u"&&process.versions!=null&&process.versions.node!=null;function Hr(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;re.hasIntersectionBetweenTwoRanges(t,n,l,c)&&(l>i?(o.push(r.slice(i,l)),o.push(si(r,{...a,ed:Math.min(c,n)}))):o.push(si(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 $p(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:h,spaceBelow:u,lineSpacing:d}=c,f=[];h!=null&&(typeof h=="number"?f.push(`margin-top: ${h}px`):f.push(`margin-top: ${h.v}px`)),u!=null&&(typeof u=="number"?f.push(`margin-bottom: ${u}px`):f.push(`margin-bottom: ${u.v}px`)),d!=null&&f.push(`line-height: ${d}`),l>o+1?i+=`<p class="UniverNormal" ${f.length?`style="${f.join("; ")};"`:""}>${Hr(e,o+1,l)}</p>`:i+=`<p class="UniverNormal" ${f.length?`style="${f.join("; ")};"`:""}></p>`,o=l}return o!==r.length&&(i+=Hr(e,o,r.length)),i}else return Hr(e,0,e.dataStream.length)}function si(e,t){const{st:n,ed:r,ts:s={}}=t,{ff:i,fs:o,it:a,bl:l,ul:c,st:h,ol:u,bg:d,cl:f,va:E}=s;let R=e.slice(n,r);const O=[];return a===Se.TRUE&&(R=`<i>${R}</i>`),E===Ut.SUPERSCRIPT?R=`<sup>${R}</sup>`:E===Ut.SUBSCRIPT&&(R=`<sub>${R}</sub>`),(c==null?void 0:c.s)===Se.TRUE&&(R=`<u>${R}</u>`),(h==null?void 0:h.s)===Se.TRUE&&(R=`<s>${R}</s>`),l===Se.TRUE&&(R=`<strong>${R}</strong>`),i&&O.push(`font-family: ${i}`),f&&O.push(`color: ${f.rgb}`),o&&O.push(`font-size: ${o}pt`),u&&O.push("text-decoration: overline"),d&&O.push(`background: ${d.rgb}`),O.length?`<span style="${O.join("; ")};">${R}</span>`:R}const tu={[Is.OFFICE]:{[gt.ACCENT1]:"#4472C4",[gt.ACCENT2]:"#ED7D31",[gt.ACCENT3]:"#A5A5A5",[gt.ACCENT4]:"#70AD47",[gt.ACCENT5]:"#5B9BD5",[gt.ACCENT6]:"#70AD47",[gt.DARK1]:"#000000",[gt.DARK2]:"#44546A",[gt.LIGHT1]:"#FFFFFF",[gt.LIGHT2]:"#E7E6E6",[gt.HYPERLINK]:"#0563C1",[gt.FOLLOWED_HYPERLINK]:"#954F72"}};class Cr{constructor(){C(this,"_themeValue",gt.LIGHT1);C(this,"_themeColors");C(this,"_themeTint");C(this,"_rgbValue","");C(this,"_colorType");this._colorType=vt.UNSUPPORTED,this._themeColors=Is.OFFICE,this._themeTint=0}asRgbColor(){return new os(this._rgbValue,this)}asThemeColor(){return new as(this._themeValue,this._themeTint,this._themeColors,this)}build(){switch(this._colorType){case vt.THEME:return this.asThemeColor();case vt.RGB:return this.asRgbColor();case vt.UNSUPPORTED:throw new Error("unsupported color type")}}setRgbColor(t){return this._colorType=vt.RGB,this._rgbValue=t,this}setThemeColors(t){this._colorType=vt.THEME,this._themeColors=t}setThemeTint(t){this._colorType=vt.THEME,this._themeTint=t}setThemeColor(t){return this._colorType=vt.THEME,this._themeValue=t,this}getColorType(){return this._colorType}}class En{constructor(t){C(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 Cr().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 En(this._builder)}equals(t){return!1}}class nu{constructor(t){C(this,"_saturation",0);C(this,"_hue",0);C(this,"_lightness",0);C(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 Cr;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 It=class It extends En{constructor(n,r){super(r);C(this,"_cssString");C(this,"_red");C(this,"_green");C(this,"_blue");C(this,"_alpha");let s=n.match(It.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(It.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 En.rgbColorToHexValue(this)}getRed(){let n=this._red+It.RGB_COLOR_AMT;return n>255?n=255:n<0&&(n=0),n}getGreen(){let n=this._green+It.RGB_COLOR_AMT;return n>255?n=255:n<0&&(n=0),n}getBlue(){let n=this._blue+It.RGB_COLOR_AMT;return n>255?n=255:n<0&&(n=0),n}getAlpha(){return this._alpha}getColorType(){return vt.RGB}clone(){return new It(this._cssString,this._builder)}asThemeColor(){throw new Error("rgb color not support to themeColor")}equals(n){return n instanceof It?n._red===this._red&&n._blue===this._blue&&n._green===this._green&&n._alpha===this._alpha:!1}getCssString(){return this._cssString}};C(It,"RGB_COLOR_AMT",0),C(It,"RGBA_EXTRACT",new RegExp("\\s*rgba\\s*\\((\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d.\\d|\\d\\s*)\\)\\s*")),C(It,"RGB_EXTRACT",new RegExp("\\s*rgb\\s*\\((\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d+\\s*)\\)\\s*"));let os=It;const Zt=class Zt extends En{constructor(n,r,s,i){super(i);C(this,"_themeColorType");C(this,"_themeTint");C(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=tu[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(Zt._cacheThemeColor.has(this._themeColors)){if(s=Zt._cacheThemeColor.get(this._themeColors),s.has(this._themeColorType))return s.get(this._themeColorType)}else s=new Map,Zt._cacheThemeColor.set(this._themeColors,s);const i=new nu(En.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 Zt(this._themeColorType,this._themeTint,this._themeColors,this._builder)}equals(n){return n instanceof Zt?n._themeColorType===this._themeColorType:!1}getColorType(){return vt.THEME}getThemeColorType(){return this._themeColorType}};C(Zt,"_cacheThemeColor",new Map);let as=Zt;const Bp="rgb(",jp="rgba(",ii={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],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 bt{constructor(t){C(this,"_color");C(this,"_rgbColor");C(this,"_isValid",!1);if(t==null){this._setNullColor();return}if(t instanceof bt){this._color={...t._color},this._rgbColor={...t._rgbColor};return}const n=ru(t);if(n==null){this._setNullColor();return}this._color=n;const r=Vp(this._color);if(r==null){this._setNullColor();return}this._rgbColor=r,this._isValid=!0}static mix(t,n,r){var c,h;r=Math.min(1,Math.max(0,r));const s=new bt(t).toRgb(),i=new bt(n).toRgb(),o=(c=s.a)!=null?c:1,a=(h=i.a)!=null?h: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 bt(l)}static getContrastRatio(t,n){const r=new bt(t).getLuminance(),s=new bt(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=[wr(Math.round(n).toString(16)),wr(Math.round(r).toString(16)),wr(Math.round(s).toString(16)),wr(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 Qp(this.toRgb())}toHsl(){return Xp(this.toRgb())}lighten(t=10){const n=this.toHsl();return n.l+=t,n.l=Math.min(Math.max(n.l,0),100),new bt(n)}darken(t=10){const n=this.toHsl();return n.l-=t,n.l=Math.min(Math.max(n.l,0),100),new bt(n)}setAlpha(t){return new bt({...this._rgbColor,a:t})}getLuminance(){let{r:t,g:n,b:r}=this.toRgb();return t=Ds(t),n=Ds(n),r=Ds(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 wr=e=>e.length===1?`0${e}`:e,Ds=e=>(e/=255,e<=.03928?e/12.92:((e+.055)/1.055)**2.4),ru=e=>{if(Jp(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();if(ii[t]){const n=ii[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 Hp(t);if(t.startsWith("rgb"))return Wp(t);if(t.startsWith("hsl"))return zp(t);if(t.startsWith("hsv"))return Yp(t)},Hp=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},Wp=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},zp=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},Yp=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},Vp=e=>{const t=ru(e);if(t!=null)return"r"in t?t:"l"in t?Gp(t):Kp(t)},xs=(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),Gp=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=xs(c,l,t+1/3),i=xs(c,l,t),o=xs(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},Kp=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,h=[r,a,o,o,l,r][c],u=[l,r,r,a,o,o][c],d=[o,o,l,r,r,a][c],f={r:h*255,g:u*255,b:d*255};return e.a!==void 0&&(f.a=e.a),f},Xp=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 h=s-i;switch(l=o>.5?h/(2-s-i):h/(s+i),s){case t:a=(n-r)/h+(n<r?6:0);break;case n:a=(r-t)/h+2;break;default:a=(t-n)/h+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},Qp=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 h={h:Math.round(o*360),s:Math.round(c*100),v:Math.round(a*100)};return e.a!==void 0&&(h.a=e.a),h},qp=e=>e==null,Jp=e=>!qp(e)&&typeof e=="object";function Zp(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 em(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))}var Pe=(e=>(e[e.COVER=0]="COVER",e[e.REPLACE=1]="REPLACE",e))(Pe||{});function tm(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 nm(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 rm(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 sm(e){return e!=null&&(typeof e=="string"||typeof e=="number"||typeof e=="boolean")}var xe=(e=>(e[e.NORMAL=0]="NORMAL",e[e.ROW=1]="ROW",e[e.COLUMN=2]="COLUMN",e[e.ALL=3]="ALL",e))(xe||{}),tt=(e=>(e[e.NONE=0]="NONE",e[e.ROW=1]="ROW",e[e.COLUMN=2]="COLUMN",e[e.ALL=3]="ALL",e))(tt||{});function im(e){return[e.startRow,e.startColumn,e.endRow,e.endColumn]}var su=(e=>(e.NONE="none",e.BACKWARD="backward",e.FORWARD="forward",e))(su||{}),iu=(e=>(e.RECT="RECT",e.TEXT="TEXT",e))(iu||{});function om(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:h,endRow:u,startColumn:d,endColumn:f}=n[c];if(e===h&&t===d){i=u,o=f,a=h,l=d,s=!0;break}if(e>=h&&e<=u&&t>=d&&t<=f){i=u,o=f,a=h,l=d,r=!0;break}}return{actualRow:e,actualColumn:t,isMergedMainCell:s,isMerged:r,endRow:i,endColumn:o,startRow:a,startColumn:l}}var bn=(e=>(e.Raw="raw",e.Intercepted="intercepted",e.Both="both",e))(bn||{});function ou(e){const{actualRow:t,actualColumn:n,isMerged:r,isMergedMainCell:s,mergeInfo:i}=e;let{startY:o,endY:a,startX:l,endX:c}=e,h=t,u=n,d=t,f=n;if(r&&i){const{startRow:E,startColumn:R,endRow:O,endColumn:T,startY:V,endY:z,startX:oe,endX:N}=i;h=E,u=R,d=O,f=T,o=V,a=z,l=oe,c=N}return s&&(o=i.startY,a=i.endY,l=i.startX,c=i.endX,d=i.endRow,f=i.endColumn),{startRow:h,startColumn:u,endRow:d,endColumn:f,startY:o,endY:a,startX:l,endX:c}}const am=ou;function lm(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,h=n,u=t,d=n;return(r||s)&&(c=i,h=o,u=a,d=l),{startRow:c,startColumn:h,endRow:u,endColumn:d}}function au(e){var n;return!e||(((n=e==null?void 0:e.v)==null?void 0:n.toString())||"").length===0&&!e.p}function um(e){return au(e)&&(e==null?void 0:e.coverable)!==!1}function Nt(e){if(e){if(e.rgb)return e.rgb;if(e.th)return new Cr().setThemeColor(e.th).asThemeColor().asRgbColor().getCssString()}return null}function cm(e){return re.isString(e)&&e.substring(0,1)==="="&&e.length>1}function hm(e){return re.isString(e)&&e.length>0}function dm(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: ${Nt(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: ${Nt(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: ${Nt(e.ol.cl)}; `),e.ol.t&&n.indexOf("text-decoration-style")===-1&&(n+=`text-decoration-style: ${e.ol.t} `))}],["bg",()=>{e.bg&&(n+=`background: ${Nt(e.bg)}; `)}],["bd",()=>{var o,a,l,c,h,u,d,f,E,R,O,T;(o=e.bd)!=null&&o.b&&(n+=`border-bottom: ${Ar((a=e.bd)==null?void 0:a.b.s)} ${(l=Nt(e.bd.b.cl))!=null?l:""}; `),(c=e.bd)!=null&&c.t&&(n+=`border-top: ${Ar((h=e.bd)==null?void 0:h.t.s)} ${(u=Nt(e.bd.t.cl))!=null?u:""}; `),(d=e.bd)!=null&&d.r&&(n+=`border-right: ${Ar((f=e.bd)==null?void 0:f.r.s)} ${(E=Nt(e.bd.r.cl))!=null?E:""}; `),(R=e.bd)!=null&&R.l&&(n+=`border-left: ${Ar((O=e.bd)==null?void 0:O.l.s)} ${(T=Nt(e.bd.l.cl))!=null?T:""}; `)}],["cl",()=>{e.cl&&(n+=`color: ${Nt(e.cl)}; `)}],["va",()=>{e.va===Ut.SUBSCRIPT?n+="vertical-align: sub; ":e.va===Ut.SUPERSCRIPT&&(n+="vertical-align: super; ")}],["td",()=>{e.td===Pn.LEFT_TO_RIGHT?n+="direction: ltr; ":e.td===Pn.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===$t.LEFT?n+="text-align: left; ":e.ht===$t.RIGHT?n+="text-align: right; ":e.ht===$t.CENTER?n+="text-align: center; ":e.ht===$t.JUSTIFIED&&(n+="text-align: justify; ")}],["vt",()=>{e.vt===tn.BOTTOM?n+="vertical-align: bottom; ":e.vt===tn.TOP?n+="vertical-align: top; ":e.vt===tn.MIDDLE&&(n+="vertical-align: middle; ")}],["tb",()=>{e.tb===_n.CLIP?n+="white-space: nowrap; overflow-x: hidden; ":e.tb===_n.WRAP&&(n+="white-space: normal;")}],["pd",()=>{var h,u,d,f,E,R,O,T;const o=`${(h=e.pd)==null?void 0:h.b}pt`,a=`${(u=e.pd)==null?void 0:u.t}pt`,l=`${(d=e.pd)==null?void 0:d.l}pt`,c=`${(f=e.pd)==null?void 0:f.r}pt`;(E=e.pd)!=null&&E.b&&(n+=`padding-bottom: ${o}; `),(R=e.pd)!=null&&R.t&&(n+=`padding-top: ${a}; `),(O=e.pd)!=null&&O.l&&(n+=`padding-left: ${l}; `),(T=e.pd)!=null&&T.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 Ar(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 fm(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 gm(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 pm(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===xe.COLUMN||!(Number.isNaN(s)&&Number.isNaN(i))&&o===xe.ROW||o!==xe.ROW&&o!==xe.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 mm(e,t){return{startRow:e,endRow:e,startColumn:t,endColumn:t}}function Yi(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=>Yi(e[n],t[n])):e===t:!1}function lu(e,t){const n=e.ts||{},r=t.ts||{};return e.sId!==t.sId?!1:Yi(n,r)}function _m(e,t){return t.some(n=>e.indexOf(n)>-1)}var Wr={exports:{}},Em=Wr.exports,Go;function Cm(){return Go||(Go=1,function(e,t){(function(n,r){e.exports=r()})(Em,function(){var n=1e3,r=6e4,s=36e5,i="millisecond",o="second",a="minute",l="hour",c="day",h="week",u="month",d="quarter",f="year",E="date",R="Invalid Date",O=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,T=/\[([^\]]+)]|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,V={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(D){var b=["th","st","nd","rd"],S=D%100;return"["+D+(b[(S-20)%10]||b[S]||b[0])+"]"}},z=function(D,b,S){var F=String(D);return!F||F.length>=b?D:""+Array(b+1-F.length).join(S)+D},oe={s:z,z:function(D){var b=-D.utcOffset(),S=Math.abs(b),F=Math.floor(S/60),$=S%60;return(b<=0?"+":"-")+z(F,2,"0")+":"+z($,2,"0")},m:function D(b,S){if(b.date()<S.date())return-D(S,b);var F=12*(S.year()-b.year())+(S.month()-b.month()),$=b.clone().add(F,u),G=S-$<0,se=b.clone().add(F+(G?-1:1),u);return+(-(F+(S-$)/(G?$-se:se-$))||0)},a:function(D){return D<0?Math.ceil(D)||0:Math.floor(D)},p:function(D){return{M:u,y:f,w:h,d:c,D:E,h:l,m:a,s:o,ms:i,Q:d}[D]||String(D||"").toLowerCase().replace(/s$/,"")},u:function(D){return D===void 0}},N="en",A={};A[N]=V;var H="$isDayjsObject",J=function(D){return D instanceof j||!(!D||!D[H])},de=function D(b,S,F){var $;if(!b)return N;if(typeof b=="string"){var G=b.toLowerCase();A[G]&&($=G),S&&(A[G]=S,$=G);var se=b.split("-");if(!$&&se.length>1)return D(se[0])}else{var he=b.name;A[he]=b,$=he}return!F&&$&&(N=$),$||!F&&N},le=function(D,b){if(J(D))return D.clone();var S=typeof b=="object"?b:{};return S.date=D,S.args=arguments,new j(S)},m=oe;m.l=de,m.i=J,m.w=function(D,b){return le(D,{locale:b.$L,utc:b.$u,x:b.$x,$offset:b.$offset})};var j=function(){function D(S){this.$L=de(S.locale,null,!0),this.parse(S),this.$x=this.$x||S.x||{},this[H]=!0}var b=D.prototype;return b.parse=function(S){this.$d=function(F){var $=F.date,G=F.utc;if($===null)return new Date(NaN);if(m.u($))return new Date;if($ instanceof Date)return new Date($);if(typeof $=="string"&&!/Z$/i.test($)){var se=$.match(O);if(se){var he=se[2]-1||0,ge=(se[7]||"0").substring(0,3);return G?new Date(Date.UTC(se[1],he,se[3]||1,se[4]||0,se[5]||0,se[6]||0,ge)):new Date(se[1],he,se[3]||1,se[4]||0,se[5]||0,se[6]||0,ge)}}return new Date($)}(S),this.init()},b.init=function(){var S=this.$d;this.$y=S.getFullYear(),this.$M=S.getMonth(),this.$D=S.getDate(),this.$W=S.getDay(),this.$H=S.getHours(),this.$m=S.getMinutes(),this.$s=S.getSeconds(),this.$ms=S.getMilliseconds()},b.$utils=function(){return m},b.isValid=function(){return this.$d.toString()!==R},b.isSame=function(S,F){var $=le(S);return this.startOf(F)<=$&&$<=this.endOf(F)},b.isAfter=function(S,F){return le(S)<this.startOf(F)},b.isBefore=function(S,F){return this.endOf(F)<le(S)},b.$g=function(S,F,$){return m.u(S)?this[F]:this.set($,S)},b.unix=function(){return Math.floor(this.valueOf()/1e3)},b.valueOf=function(){return this.$d.getTime()},b.startOf=function(S,F){var $=this,G=!!m.u(F)||F,se=m.p(S),he=function(Y,W){var ue=m.w($.$u?Date.UTC($.$y,W,Y):new Date($.$y,W,Y),$);return G?ue:ue.endOf(c)},ge=function(Y,W){return m.w($.toDate()[Y].apply($.toDate("s"),(G?[0,0,0,0]:[23,59,59,999]).slice(W)),$)},Te=this.$W,we=this.$M,v=this.$D,k="set"+(this.$u?"UTC":"");switch(se){case f:return G?he(1,0):he(31,11);case u:return G?he(1,we):he(0,we+1);case h:var K=this.$locale().weekStart||0,Q=(Te<K?Te+7:Te)-K;return he(G?v-Q:v+(6-Q),we);case c:case E:return ge(k+"Hours",0);case l:return ge(k+"Minutes",1);case a:return ge(k+"Seconds",2);case o:return ge(k+"Milliseconds",3);default:return this.clone()}},b.endOf=function(S){return this.startOf(S,!1)},b.$set=function(S,F){var $,G=m.p(S),se="set"+(this.$u?"UTC":""),he=($={},$[c]=se+"Date",$[E]=se+"Date",$[u]=se+"Month",$[f]=se+"FullYear",$[l]=se+"Hours",$[a]=se+"Minutes",$[o]=se+"Seconds",$[i]=se+"Milliseconds",$)[G],ge=G===c?this.$D+(F-this.$W):F;if(G===u||G===f){var Te=this.clone().set(E,1);Te.$d[he](ge),Te.init(),this.$d=Te.set(E,Math.min(this.$D,Te.daysInMonth())).$d}else he&&this.$d[he](ge);return this.init(),this},b.set=function(S,F){return this.clone().$set(S,F)},b.get=function(S){return this[m.p(S)]()},b.add=function(S,F){var $,G=this;S=Number(S);var se=m.p(F),he=function(we){var v=le(G);return m.w(v.date(v.date()+Math.round(we*S)),G)};if(se===u)return this.set(u,this.$M+S);if(se===f)return this.set(f,this.$y+S);if(se===c)return he(1);if(se===h)return he(7);var ge=($={},$[a]=r,$[l]=s,$[o]=n,$)[se]||1,Te=this.$d.getTime()+S*ge;return m.w(Te,this)},b.subtract=function(S,F){return this.add(-1*S,F)},b.format=function(S){var F=this,$=this.$locale();if(!this.isValid())return $.invalidDate||R;var G=S||"YYYY-MM-DDTHH:mm:ssZ",se=m.z(this),he=this.$H,ge=this.$m,Te=this.$M,we=$.weekdays,v=$.months,k=$.meridiem,K=function(W,ue,ae,B){return W&&(W[ue]||W(F,G))||ae[ue].slice(0,B)},Q=function(W){return m.s(he%12||12,W,"0")},Y=k||function(W,ue,ae){var B=W<12?"AM":"PM";return ae?B.toLowerCase():B};return G.replace(T,function(W,ue){return ue||function(ae){switch(ae){case"YY":return String(F.$y).slice(-2);case"YYYY":return m.s(F.$y,4,"0");case"M":return Te+1;case"MM":return m.s(Te+1,2,"0");case"MMM":return K($.monthsShort,Te,v,3);case"MMMM":return K(v,Te);case"D":return F.$D;case"DD":return m.s(F.$D,2,"0");case"d":return String(F.$W);case"dd":return K($.weekdaysMin,F.$W,we,2);case"ddd":return K($.weekdaysShort,F.$W,we,3);case"dddd":return we[F.$W];case"H":return String(he);case"HH":return m.s(he,2,"0");case"h":return Q(1);case"hh":return Q(2);case"a":return Y(he,ge,!0);case"A":return Y(he,ge,!1);case"m":return String(ge);case"mm":return m.s(ge,2,"0");case"s":return String(F.$s);case"ss":return m.s(F.$s,2,"0");case"SSS":return m.s(F.$ms,3,"0");case"Z":return se}return null}(W)||se.replace(":","")})},b.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},b.diff=function(S,F,$){var G,se=this,he=m.p(F),ge=le(S),Te=(ge.utcOffset()-this.utcOffset())*r,we=this-ge,v=function(){return m.m(se,ge)};switch(he){case f:G=v()/12;break;case u:G=v();break;case d:G=v()/3;break;case h:G=(we-Te)/6048e5;break;case c:G=(we-Te)/864e5;break;case l:G=we/s;break;case a:G=we/r;break;case o:G=we/n;break;default:G=we}return $?G:m.a(G)},b.daysInMonth=function(){return this.endOf(u).$D},b.$locale=function(){return A[this.$L]},b.locale=function(S,F){if(!S)return this.$L;var $=this.clone(),G=de(S,F,!0);return G&&($.$L=G),$},b.clone=function(){return m.w(this.$d,this)},b.toDate=function(){return new Date(this.valueOf())},b.toJSON=function(){return this.isValid()?this.toISOString():null},b.toISOString=function(){return this.$d.toISOString()},b.toString=function(){return this.$d.toUTCString()},D}(),y=j.prototype;return le.prototype=y,[["$ms",i],["$s",o],["$m",a],["$H",l],["$W",c],["$M",u],["$y",f],["$D",E]].forEach(function(D){y[D[1]]=function(b){return this.$g(b,D[0],D[1])}}),le.extend=function(D,b){return D.$i||(D(b,j,le),D.$i=!0),le},le.locale=de,le.isDayjs=J,le.unix=function(D){return le(1e3*D)},le.en=A[N],le.Ls=A,le.p={},le})}(Wr)),Wr.exports}var Rm=Cm();const Kt=St(Rm);var zr={exports:{}},Im=zr.exports,Ko;function vm(){return Ko||(Ko=1,function(e,t){(function(n,r){e.exports=r()})(Im,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(),h=(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(u){switch(u){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(),u==="w"?1:2,"0");case"W":case"WW":return c.s(a.isoWeek(),u==="W"?1:2,"0");case"k":case"kk":return c.s(String(a.$H===0?24:a.$H),u==="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 u}});return i.bind(this)(h)}}})}(zr)),zr.exports}var ym=vm();const Sm=St(ym);var Yr={exports:{}},Om=Yr.exports,Xo;function bm(){return Xo||(Xo=1,function(e,t){(function(n,r){e.exports=r()})(Om,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(O){return(O=+O)+(O>68?1900:2e3)},h=function(O){return function(T){this[O]=+T}},u=[/[+-]\d\d:?(\d\d)?|Z/,function(O){(this.zone||(this.zone={})).offset=function(T){if(!T||T==="Z")return 0;var V=T.match(/([+-]|\d\d)/g),z=60*V[1]+(+V[2]||0);return z===0?0:V[0]==="+"?-z:z}(O)}],d=function(O){var T=l[O];return T&&(T.indexOf?T:T.s.concat(T.f))},f=function(O,T){var V,z=l.meridiem;if(z){for(var oe=1;oe<=24;oe+=1)if(O.indexOf(z(oe,0,T))>-1){V=oe>12;break}}else V=O===(T?"pm":"PM");return V},E={A:[a,function(O){this.afternoon=f(O,!1)}],a:[a,function(O){this.afternoon=f(O,!0)}],Q:[s,function(O){this.month=3*(O-1)+1}],S:[s,function(O){this.milliseconds=100*+O}],SS:[i,function(O){this.milliseconds=10*+O}],SSS:[/\d{3}/,function(O){this.milliseconds=+O}],s:[o,h("seconds")],ss:[o,h("seconds")],m:[o,h("minutes")],mm:[o,h("minutes")],H:[o,h("hours")],h:[o,h("hours")],HH:[o,h("hours")],hh:[o,h("hours")],D:[o,h("day")],DD:[i,h("day")],Do:[a,function(O){var T=l.ordinal,V=O.match(/\d+/);if(this.day=V[0],T)for(var z=1;z<=31;z+=1)T(z).replace(/\[|\]/g,"")===O&&(this.day=z)}],w:[o,h("week")],ww:[i,h("week")],M:[o,h("month")],MM:[i,h("month")],MMM:[a,function(O){var T=d("months"),V=(d("monthsShort")||T.map(function(z){return z.slice(0,3)})).indexOf(O)+1;if(V<1)throw new Error;this.month=V%12||V}],MMMM:[a,function(O){var T=d("months").indexOf(O)+1;if(T<1)throw new Error;this.month=T%12||T}],Y:[/[+-]?\d+/,h("year")],YY:[i,function(O){this.year=c(O)}],YYYY:[/\d{4}/,h("year")],Z:u,ZZ:u};function R(O){var T,V;T=O,V=l&&l.formats;for(var z=(O=T.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(le,m,j){var y=j&&j.toUpperCase();return m||V[j]||n[j]||V[y].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(D,b,S){return b||S.slice(1)})})).match(r),oe=z.length,N=0;N<oe;N+=1){var A=z[N],H=E[A],J=H&&H[0],de=H&&H[1];z[N]=de?{regex:J,parser:de}:A.replace(/^\[|\]$/g,"")}return function(le){for(var m={},j=0,y=0;j<oe;j+=1){var D=z[j];if(typeof D=="string")y+=D.length;else{var b=D.regex,S=D.parser,F=le.slice(y),$=b.exec(F)[0];S.call(m,$),le=le.replace($,"")}}return function(G){var se=G.afternoon;if(se!==void 0){var he=G.hours;se?he<12&&(G.hours+=12):he===12&&(G.hours=0),delete G.afternoon}}(m),m}}return function(O,T,V){V.p.customParseFormat=!0,O&&O.parseTwoDigitYear&&(c=O.parseTwoDigitYear);var z=T.prototype,oe=z.parse;z.parse=function(N){var A=N.date,H=N.utc,J=N.args;this.$u=H;var de=J[1];if(typeof de=="string"){var le=J[2]===!0,m=J[3]===!0,j=le||m,y=J[2];m&&(y=J[2]),l=this.$locale(),!le&&y&&(l=V.Ls[y]),this.$d=function(F,$,G,se){try{if(["x","X"].indexOf($)>-1)return new Date(($==="X"?1e3:1)*F);var he=R($)(F),ge=he.year,Te=he.month,we=he.day,v=he.hours,k=he.minutes,K=he.seconds,Q=he.milliseconds,Y=he.zone,W=he.week,ue=new Date,ae=we||(ge||Te?1:ue.getDate()),B=ge||ue.getFullYear(),te=0;ge&&!Te||(te=Te>0?Te-1:ue.getMonth());var ie,pe=v||0,be=k||0,De=K||0,X=Q||0;return Y?new Date(Date.UTC(B,te,ae,pe,be,De,X+60*Y.offset*1e3)):G?new Date(Date.UTC(B,te,ae,pe,be,De,X)):(ie=new Date(B,te,ae,pe,be,De,X),W&&(ie=se(ie).week(W).toDate()),ie)}catch{return new Date("")}}(A,de,H,V),this.init(),y&&y!==!0&&(this.$L=this.locale(y).$L),j&&A!=this.format(de)&&(this.$d=new Date("")),l={}}else if(de instanceof Array)for(var D=de.length,b=1;b<=D;b+=1){J[1]=de[b-1];var S=V.apply(this,J);if(S.isValid()){this.$d=S.$d,this.$L=S.$L,this.init();break}b===D&&(this.$d=new Date(""))}else oe.call(this,N)}}})}(Yr)),Yr.exports}var wm=bm();const Am=St(wm);var Vr={exports:{}},Tm=Vr.exports,Qo;function Nm(){return Qo||(Qo=1,function(e,t){(function(n,r){e.exports=r()})(Tm,function(){return function(n,r,s){var i=r.prototype,o=function(u){return u&&(u.indexOf?u:u.s)},a=function(u,d,f,E,R){var O=u.name?u:u.$locale(),T=o(O[d]),V=o(O[f]),z=T||V.map(function(N){return N.slice(0,E)});if(!R)return z;var oe=O.weekStart;return z.map(function(N,A){return z[(A+(oe||0))%7]})},l=function(){return s.Ls[s.locale()]},c=function(u,d){return u.formats[d]||function(f){return f.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(E,R,O){return R||O.slice(1)})}(u.formats[d.toUpperCase()])},h=function(){var u=this;return{months:function(d){return d?d.format("MMMM"):a(u,"months")},monthsShort:function(d){return d?d.format("MMM"):a(u,"monthsShort","months",3)},firstDayOfWeek:function(){return u.$locale().weekStart||0},weekdays:function(d){return d?d.format("dddd"):a(u,"weekdays")},weekdaysMin:function(d){return d?d.format("dd"):a(u,"weekdaysMin","weekdays",2)},weekdaysShort:function(d){return d?d.format("ddd"):a(u,"weekdaysShort","weekdays",3)},longDateFormat:function(d){return c(u.$locale(),d)},meridiem:this.$locale().meridiem,ordinal:this.$locale().ordinal}};i.localeData=function(){return h.bind(this)()},s.localeData=function(){var u=l();return{firstDayOfWeek:function(){return u.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(u,d)},meridiem:u.meridiem,ordinal:u.ordinal}},s.months=function(){return a(l(),"months")},s.monthsShort=function(){return a(l(),"monthsShort","months",3)},s.weekdays=function(u){return a(l(),"weekdays",null,null,u)},s.weekdaysShort=function(u){return a(l(),"weekdaysShort","weekdays",3,u)},s.weekdaysMin=function(u){return a(l(),"weekdaysMin","weekdays",2,u)}}})}(Vr)),Vr.exports}var Mm=Nm();const Dm=St(Mm);var Gr={exports:{}},xm=Gr.exports,qo;function Lm(){return qo||(qo=1,function(e,t){(function(n,r){e.exports=r()})(xm,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,h=function(u,d){return u.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(f,E,R){var O=R&&R.toUpperCase();return E||d[R]||n[R]||d[O].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(T,V,z){return V||z.slice(1)})})}(l,c===void 0?{}:c);return a.call(this,h)}}})}(Gr)),Gr.exports}var Um=Lm();const Pm=St(Um);var Kr={exports:{}},Fm=Kr.exports,Jo;function km(){return Jo||(Jo=1,function(e,t){(function(n,r){e.exports=r()})(Fm,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(R){var O={date:R,utc:!0,args:arguments};return new o(O)},l.utc=function(R){var O=a(this.toDate(),{locale:this.$L,utc:!0});return R?O.add(this.utcOffset(),n):O},l.local=function(){return a(this.toDate(),{locale:this.$L,utc:!1})};var c=l.parse;l.parse=function(R){R.utc&&(this.$u=!0),this.$utils().u(R.$offset)||(this.$offset=R.$offset),c.call(this,R)};var h=l.init;l.init=function(){if(this.$u){var R=this.$d;this.$y=R.getUTCFullYear(),this.$M=R.getUTCMonth(),this.$D=R.getUTCDate(),this.$W=R.getUTCDay(),this.$H=R.getUTCHours(),this.$m=R.getUTCMinutes(),this.$s=R.getUTCSeconds(),this.$ms=R.getUTCMilliseconds()}else h.call(this)};var u=l.utcOffset;l.utcOffset=function(R,O){var T=this.$utils().u;if(T(R))return this.$u?0:T(this.$offset)?u.call(this):this.$offset;if(typeof R=="string"&&(R=function(N){N===void 0&&(N="");var A=N.match(r);if(!A)return null;var H=(""+A[0]).match(s)||["-",0,0],J=H[0],de=60*+H[1]+ +H[2];return de===0?0:J==="+"?de:-de}(R),R===null))return this;var V=Math.abs(R)<=16?60*R:R,z=this;if(O)return z.$offset=V,z.$u=R===0,z;if(R!==0){var oe=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();(z=this.local().add(V+oe,n)).$offset=V,z.$x.$localOffset=oe}else z=this.utc();return z};var d=l.format;l.format=function(R){var O=R||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return d.call(this,O)},l.valueOf=function(){var R=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*R},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(R){return R==="s"&&this.$offset?a(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():f.call(this)};var E=l.diff;l.diff=function(R,O,T){if(R&&this.$u===R.$u)return E.call(this,R,O,T);var V=this.local(),z=a(R).local();return E.call(V,z,O,T)}}})}(Kr)),Kr.exports}var $m=km();const Bm=St($m);var Xr={exports:{}},jm=Xr.exports,Zo;function Hm(){return Zo||(Zo=1,function(e,t){(function(n,r){e.exports=r()})(jm,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")}}})}(Xr)),Xr.exports}var Wm=Hm();const zm=St(Wm);var Qr={exports:{}},Ym=Qr.exports,ea;function Vm(){return ea||(ea=1,function(e,t){(function(n,r){e.exports=r()})(Ym,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 h=o(this).startOf(r).add(1,r).date(c),u=o(this).endOf(n);if(h.isBefore(u))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)}}})}(Qr)),Qr.exports}var Gm=Vm();const Km=St(Gm);var qr={exports:{}},Xm=qr.exports,ta;function Qm(){return ta||(ta=1,function(e,t){(function(n,r){e.exports=r()})(Xm,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}}})}(qr)),qr.exports}var qm=Qm();const Jm=St(qm);Kt.extend(Am);Kt.extend(Sm);Kt.extend(zm);Kt.extend(Dm);Kt.extend(Km);Kt.extend(Jm);Kt.extend(Bm);Kt.extend(Pm);function vs(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 Zm(e){if(e==null)return!1;const t=e.bullet;return(t==null?void 0:t.listId)!=null}function e_(e){if(e==null)return!1;const t=e.paragraphStyle;return uu(t)}function uu(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 cu(e,t,n){return e.slice(0,t)+n+e.slice(t)}function hu(e,t,n){return t>n?e:e.slice(0,t)+e.slice(n)}const t_=/\s/g;function n_(e){return e===null||e.toString().replace(t_,"")===""||typeof e=="boolean"?!1:!isNaN(e)}function r_(e){let t=0;for(let n=0;n<e.length;n++)t=e.charCodeAt(n)+(t<<6)+(t<<16)-t;return t>>>0}const Ge=Symbol("newer"),rt=Symbol("older");class s_{constructor(t){C(this,"entry");this.entry=t}[Symbol.iterator](){return this}next(){const t=this.entry;return t?(this.entry=t[Ge],{done:!1,value:t.key}):{done:!0,value:void 0}}}class i_{constructor(t){C(this,"entry");this.entry=t}[Symbol.iterator](){return this}next(){const t=this.entry;return t?(this.entry=t[Ge],{done:!1,value:t.value}):{done:!0,value:void 0}}}class o_{constructor(t){C(this,"entry");this.entry=t}[Symbol.iterator](){return this}next(){const t=this.entry;return t?(this.entry=t[Ge],{done:!1,value:[t.key,t.value]}):{done:!0,value:void 0}}}var La,Ua;Ua=Ge,La=rt;class na{constructor(t,n){C(this,"key");C(this,"value");C(this,Ua);C(this,La);this.key=t,this.value=n,this[Ge]=void 0,this[rt]=void 0}toJSON(){return{key:this.key,value:this.value}}}class hr{constructor(...t){C(this,"_keymap");C(this,"size",0);C(this,"limit");C(this,"oldest");C(this,"newest");C(this,"_onShiftListeners",[]);if(Zn.hasLength(t,1)){if(Zn.isNumber(t[0])){const n=t[0];this._initialize(n,void 0);return}if(Zn.isIterable(t[0])){const n=t[0];this._initialize(0,n);return}return}if(Zn.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),Qe(()=>gr(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[Ge]&&(t===this.oldest&&(this.oldest=t[Ge]),t[Ge][rt]=t[rt]),t[rt]&&(t[rt][Ge]=t[Ge]),t[Ge]=void 0,t[rt]=this.newest,this.newest&&(this.newest[Ge]=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 na(i.value[0],i.value[1]);if(this._keymap.set(o.key,o),n?(n[Ge]=o,o[rt]=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 na(t,n)),this.newest?(this.newest[Ge]=r,r[rt]=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[Ge]?(this.oldest=this.oldest[Ge],this.oldest[rt]=void 0):(this.oldest=void 0,this.newest=void 0),t[Ge]=t[rt]=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[Ge]&&n[rt]?(n[rt][Ge]=n[Ge],n[Ge][rt]=n[rt]):n[Ge]?(n[Ge][rt]=void 0,this.oldest=n[Ge]):n[rt]?(n[rt][Ge]=void 0,this.newest=n[rt]):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 s_(this.oldest)}values(){return new i_(this.oldest)}entries(){return this[Symbol.iterator]()}[Symbol.iterator](){return new o_(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[Ge]}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[Ge];return t}toString(){let t="",n=this.oldest;for(;n;)t+=`${String(n.key)}:${n.value}`,n=n[Ge],n&&(t+=" < ");return t}}class Zn{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]"}}var Jr={exports:{}},a_=Jr.exports,ra;function l_(){return ra||(ra=1,function(e,t){(function(n,r){e.exports=r()})(typeof self<"u"?self:a_,function(){return function(){var n={d:function(_,g){for(var p in g)n.o(g,p)&&!n.o(_,p)&&Object.defineProperty(_,p,{enumerable:!0,get:g[p]})},o:function(_,g){return Object.prototype.hasOwnProperty.call(_,g)}},r={};n.d(r,{default:function(){return dt}});var s={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"};const i=/^([a-z\d]+)(?:[_-]([a-z\d]+))?(?:\.([a-z\d]+))?(?:@([a-z\d]+))?$/i,o={},a={group:" ",decimal:".",positive:"+",negative:"-",percent:"%",exponent:"E",nan:"NaN",infinity:"∞",ampm:["AM","PM"],mmmm6:["Muharram","Safar","Rabiʻ I","Rabiʻ II","Jumada I","Jumada II","Rajab","Shaʻban","Ramadan","Shawwal","Dhuʻl-Qiʻdah","Dhuʻl-Hijjah"],mmm6:["Muh.","Saf.","Rab. I","Rab. II","Jum. I","Jum. II","Raj.","Sha.","Ram.","Shaw.","Dhuʻl-Q.","Dhuʻl-H."],mmmm:["January","February","March","April","May","June","July","August","September","October","November","December"],mmm:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dddd:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],ddd:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]};function l(_){const g=i.exec(_);if(!g)throw new SyntaxError("Malformed locale: ".concat(_));return{lang:g[1]+(g[2]?"_"+g[2]:""),language:g[1],territory:g[2]||"",codeset:g[3]||"",modifier:g[4]||""}}function c(_){if(typeof _=="number")return s[65535&_]||null;const g=parseInt(_,16);return isFinite(g)&&s[65535&g]?s[65535&g]||null:i.test(_)?_:null}function h(_){const g=c(_);let p=null;if(g){const w=l(g);p=o[w.lang]||o[w.language]||null}return p}function u(_){return Object.assign({},a,_)}function d(_,g){const p=typeof g=="object"?g:l(g);return o[p.lang]=u(_),p.language===p.lang||o[p.language]||(o[p.language]=u(_)),o[p.lang]}const f=u({group:","});function E(_,g){if(typeof _!="number")return _;if(_<0)return-E(-_,g);if(g){const p=10**(g||0)||1;return E(_*p,0)/p}return Math.round(_)}f.isDefault=!0,d({group:",",ampm:["上午","下午"],mmmm:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],mmm:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],dddd:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],ddd:["周日","周一","周二","周三","周四","周五","周六"]},"zh_CN"),d({group:",",nan:"非數值",ampm:["上午","下午"],mmmm:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],mmm:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],dddd:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],ddd:["週日","週一","週二","週三","週四","週五","週六"]},"zh_TW"),d({group:",",ampm:["午前","午後"],mmmm:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],mmm:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],dddd:["日曜日","月曜日","火曜日","水曜日","木曜日","金曜日","土曜日"],ddd:["日","月","火","水","木","金","土"]},"ja"),d({group:",",ampm:["오전","오후"],mmmm:["1월","2월","3월","4월","5월","6월","7월","8월","9월","10월","11월","12월"],mmm:["1월","2월","3월","4월","5월","6월","7월","8월","9월","10월","11월","12월"],dddd:["일요일","월요일","화요일","수요일","목요일","금요일","토요일"],ddd:["일","월","화","수","목","금","토"]},"ko"),d({group:",",ampm:["ก่อนเที่ยง","หลังเที่ยง"],mmmm:["มกราคม","กุมภาพันธ์","มีนาคม","เมษายน","พฤษภาคม","มิถุนายน","กรกฎาคม","สิงหาคม","กันยายน","ตุลาคม","พฤศจิกายน","ธันวาคม"],mmm:["ม.ค.","ก.พ.","มี.ค.","เม.ย.","พ.ค.","มิ.ย.","ก.ค.","ส.ค.","ก.ย.","ต.ค.","พ.ย.","ธ.ค."],dddd:["วันอาทิตย์","วันจันทร์","วันอังคาร","วันพุธ","วันพฤหัสบดี","วันศุกร์","วันเสาร์"],ddd:["อา.","จ.","อ.","พ.","พฤ.","ศ.","ส."]},"th"),d({decimal:",",ampm:["dop.","odp."],mmmm:["ledna","února","března","dubna","května","června","července","srpna","září","října","listopadu","prosince"],mmm:["led","úno","bře","dub","kvě","čvn","čvc","srp","zář","říj","lis","pro"],dddd:["neděle","pondělí","úterý","středa","čtvrtek","pátek","sobota"],ddd:["ne","po","út","st","čt","pá","so"]},"cs"),d({group:".",decimal:",",mmmm:["januar","februar","marts","april","maj","juni","juli","august","september","oktober","november","december"],mmm:["jan.","feb.","mar.","apr.","maj","jun.","jul.","aug.","sep.","okt.","nov.","dec."],dddd:["søndag","mandag","tirsdag","onsdag","torsdag","fredag","lørdag"],ddd:["søn.","man.","tir.","ons.","tor.","fre.","lør."]},"da"),d({group:".",decimal:",",ampm:["a.m.","p.m."],mmmm:["januari","februari","maart","april","mei","juni","juli","augustus","september","oktober","november","december"],mmm:["jan.","feb.","mrt.","apr.","mei","jun.","jul.","aug.","sep.","okt.","nov.","dec."],dddd:["zondag","maandag","dinsdag","woensdag","donderdag","vrijdag","zaterdag"],ddd:["zo","ma","di","wo","do","vr","za"]},"nl"),d({group:","},"en"),d({decimal:",",nan:"epäluku",ampm:["ap.","ip."],mmmm:["tammikuuta","helmikuuta","maaliskuuta","huhtikuuta","toukokuuta","kesäkuuta","heinäkuuta","elokuuta","syyskuuta","lokakuuta","marraskuuta","joulukuuta"],mmm:["tammik.","helmik.","maalisk.","huhtik.","toukok.","kesäk.","heinäk.","elok.","syysk.","lokak.","marrask.","jouluk."],dddd:["sunnuntaina","maanantaina","tiistaina","keskiviikkona","torstaina","perjantaina","lauantaina"],ddd:["su","ma","ti","ke","to","pe","la"]},"fi"),d({group:" ",decimal:",",mmmm:["janvier","février","mars","avril","mai","juin","juillet","août","septembre","octobre","novembre","décembre"],mmm:["janv.","févr.","mars","avr.","mai","juin","juil.","août","sept.","oct.","nov.","déc."],dddd:["dimanche","lundi","mardi","mercredi","jeudi","vendredi","samedi"],ddd:["dim.","lun.","mar.","mer.","jeu.","ven.","sam."]},"fr"),d({group:".",decimal:",",mmmm:["Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"],mmm:["Jan.","Feb.","März","Apr.","Mai","Juni","Juli","Aug.","Sept.","Okt.","Nov.","Dez."],dddd:["Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag"],ddd:["So.","Mo.","Di.","Mi.","Do.","Fr.","Sa."]},"de"),d({group:".",decimal:",",ampm:["π.μ.","μ.μ."],mmmm:["Ιανουαρίου","Φεβρουαρίου","Μαρτίου","Απριλίου","Μαΐου","Ιουνίου","Ιουλίου","Αυγούστου","Σεπτεμβρίου","Οκτωβρίου","Νοεμβρίου","Δεκεμβρίου"],mmm:["Ιαν","Φεβ","Μαρ","Απρ","Μαΐ","Ιουν","Ιουλ","Αυγ","Σεπ","Οκτ","Νοε","Δεκ"],dddd:["Κυριακή","Δευτέρα","Τρίτη","Τετάρτη","Πέμπτη","Παρασκευή","Σάββατο"],ddd:["Κυρ","Δευ","Τρί","Τετ","Πέμ","Παρ","Σάβ"]},"el"),d({decimal:",",ampm:["de.","du."],mmmm:["január","február","március","április","május","június","július","augusztus","szeptember","október","november","december"],mmm:["jan.","febr.","márc.","ápr.","máj.","jún.","júl.","aug.","szept.","okt.","nov.","dec."],dddd:["vasárnap","hétfő","kedd","szerda","csütörtök","péntek","szombat"],ddd:["V","H","K","Sze","Cs","P","Szo"]},"hu"),d({group:".",decimal:",",ampm:["f.h.","e.h."],mmmm:["janúar","febrúar","mars","apríl","maí","júní","júlí","ágúst","september","október","nóvember","desember"],mmm:["jan.","feb.","mar.","apr.","maí","jún.","júl.","ágú.","sep.","okt.","nóv.","des."],dddd:["sunnudagur","mánudagur","þriðjudagur","miðvikudagur","fimmtudagur","föstudagur","laugardagur"],ddd:["sun.","mán.","þri.","mið.","fim.","fös.","lau."]},"is"),d({group:".",decimal:",",mmmm:["Januari","Februari","Maret","April","Mei","Juni","Juli","Agustus","September","Oktober","November","Desember"],mmm:["Jan","Feb","Mar","Apr","Mei","Jun","Jul","Agu","Sep","Okt","Nov","Des"],dddd:["Minggu","Senin","Selasa","Rabu","Kamis","Jumat","Sabtu"],ddd:["Min","Sen","Sel","Rab","Kam","Jum","Sab"]},"id"),d({group:".",decimal:",",mmmm:["gennaio","febbraio","marzo","aprile","maggio","giugno","luglio","agosto","settembre","ottobre","novembre","dicembre"],mmm:["gen","feb","mar","apr","mag","giu","lug","ago","set","ott","nov","dic"],dddd:["domenica","lunedì","martedì","mercoledì","giovedì","venerdì","sabato"],ddd:["dom","lun","mar","mer","gio","ven","sab"]},"it"),d({decimal:",",ampm:["a.m.","p.m."],mmmm:["januar","februar","mars","april","mai","juni","juli","august","september","oktober","november","desember"],mmm:["jan.","feb.","mar.","apr.","mai","jun.","jul.","aug.","sep.","okt.","nov.","des."],dddd:["søndag","mandag","tirsdag","onsdag","torsdag","fredag","lørdag"],ddd:["søn.","man.","tir.","ons.","tor.","fre.","lør."]},"nb"),d({decimal:",",mmmm:["stycznia","lutego","marca","kwietnia","maja","czerwca","lipca","sierpnia","września","października","listopada","grudnia"],mmm:["sty","lut","mar","kwi","maj","cze","lip","sie","wrz","paź","lis","gru"],dddd:["niedziela","poniedziałek","wtorek","środa","czwartek","piątek","sobota"],ddd:["niedz.","pon.","wt.","śr.","czw.","pt.","sob."]},"pl"),d({group:".",decimal:",",mmmm:["janeiro","fevereiro","março","abril","maio","junho","julho","agosto","setembro","outubro","novembro","dezembro"],mmm:["jan.","fev.","mar.","abr.","mai.","jun.","jul.","ago.","set.","out.","nov.","dez."],dddd:["domingo","segunda-feira","terça-feira","quarta-feira","quinta-feira","sexta-feira","sábado"],ddd:["dom.","seg.","ter.","qua.","qui.","sex.","sáb."]},"pt"),d({decimal:",",nan:"не число",mmmm:["января","февраля","марта","апреля","мая","июня","июля","августа","сентября","октября","ноября","декабря"],mmm:["янв.","февр.","мар.","апр.","мая","июн.","июл.","авг.","сент.","окт.","нояб.","дек."],dddd:["воскресенье","понедельник","вторник","среда","четверг","пятница","суббота"],ddd:["вс","пн","вт","ср","чт","пт","сб"]},"ru"),d({decimal:",",mmmm:["januára","februára","marca","apríla","mája","júna","júla","augusta","septembra","októbra","novembra","decembra"],mmm:["jan","feb","mar","apr","máj","jún","júl","aug","sep","okt","nov","dec"],dddd:["nedeľa","pondelok","utorok","streda","štvrtok","piatok","sobota"],ddd:["ne","po","ut","st","št","pi","so"]},"sk"),d({group:".",decimal:",",ampm:["a. m.","p. m."],mmmm:["enero","febrero","marzo","abril","mayo","junio","julio","agosto","septiembre","octubre","noviembre","diciembre"],mmm:["ene.","feb.","mar.","abr.","may.","jun.","jul.","ago.","sept.","oct.","nov.","dic."],dddd:["domingo","lunes","martes","miércoles","jueves","viernes","sábado"],ddd:["dom.","lun.","mar.","mié.","jue.","vie.","sáb."]},"es"),d({decimal:",",ampm:["fm","em"],mmmm:["januari","februari","mars","april","maj","juni","juli","augusti","september","oktober","november","december"],mmm:["jan.","feb.","mars","apr.","maj","juni","juli","aug.","sep.","okt.","nov.","dec."],dddd:["söndag","måndag","tisdag","onsdag","torsdag","fredag","lördag"],ddd:["sön","mån","tis","ons","tors","fre","lör"]},"sv"),d({group:".",decimal:",",ampm:["ÖÖ","ÖS"],mmmm:["Ocak","Şubat","Mart","Nisan","Mayıs","Haziran","Temmuz","Ağustos","Eylül","Ekim","Kasım","Aralık"],mmm:["Oca","Şub","Mar","Nis","May","Haz","Tem","Ağu","Eyl","Eki","Kas","Ara"],dddd:["Pazar","Pazartesi","Salı","Çarşamba","Perşembe","Cuma","Cumartesi"],ddd:["Paz","Pzt","Sal","Çar","Per","Cum","Cmt"]},"tr");function R(_,g,p){const w=_<0?-1:1,M=10**(g||2),U=10**(p||2);let L,P,I=Math.abs(_),Z=0,_e=0,q=0,me=1;if((_=I)%1==0)P=[_*w,1];else if(_<1e-19)P=[w,1e19];else if(_>1e19)P=[1e19*w,1];else{do if(I=1/(I-Math.floor(I)),L=me,me=me*Math.floor(I)+Z,Z=L,_e=q,q=Math.floor(_*me+.5),q>=M||me>=U)return[w*_e,Z];while(Math.abs(_-q/me)>=1e-10&&I!==Math.floor(I));P=[w*q,me]}return P}const O={overflow:"######",dateErrorThrows:!1,dateErrorNumber:!0,dateSpanLarge:!0,leap1900:!0,nbsp:!0,throws:!0,invalid:"######",locale:"",ignoreTimezone:!1},T=Object.assign({},O);function V(_){if(_===null&&(_=O),_){for(const g in _)if(g in O){const p=_[g];T[g]=p==null?O[g]:p}}return{...T}}const z={"#":"",0:"0","?":" "},oe={"@":"text","-":"minus","+":"plus"},N=["#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"],A=["¤","$","£","¥","֏","؋","৳","฿","៛","₡","₦","₩","₪","₫","€","₭","₮","₱","₲","₴","₸","₹","₺","₼","₽","₾","₿"],H=new RegExp("["+A.join("")+"]");function J(_,g,p){return g[p+"_max"]=_.length,g[p+"_min"]=_.replace(/#/g,"").length,g}const de={};function le(_){if(!(_ in de)){const g=[],p=_.replace(/^[#,]+/,"").replace(/[1-9]\d*/g,w=>"?".repeat(w.length));for(let w=0;w<p.length;w++){const M=p.charAt(w);g[w]=M in z?z[M]:M}de[_]=g.join("")}return de[_]}function m(_,g){typeof _=="string"&&(_={type:"string",value:_=_.replace(/ /g,z["?"])}),g.push(_)}function j(_){const g=[],p={scale:1,percent:!1,text:!1,date:0,date_eval:!1,date_system:1,sec_decimals:0,general:!1,clock:24,int_pattern:[],frac_pattern:[],man_pattern:[],den_pattern:[],num_pattern:[],tokens:g};let w=_+"",M="int",U=!1,L=null;const P=[];let I,Z,_e=!1;for(;w&&!U;){if(I=/^General/i.exec(w))p.general=!0,m({type:"general"},g);else if(M==="int"&&(I=/^[#?0]+(?:,[#?0]+)*/.exec(w))||M==="den"&&(I=/^[#?\d]+/.exec(w))||(I=/^[#?0]+/.exec(w)))p[M+"_pattern"].push(I[0]),L={type:M,num:I[0]},m(L,g);else if((I=/^\//.exec(w))&&p[M+"_pattern"].length){if(!L)throw new SyntaxError("Missing a numerator in pattern ".concat(_));p.fractions=!0,p.num_pattern.push(p[M+"_pattern"].pop()),L.type="num",M="den",m({type:"div"},g)}else if(I=/^,+/.exec(w)){const x=w.charAt(1)in z;Z.slice(-1)in z&&(I[0].length>1||!x)?p.scale=.001**I[0].length:p.dec_fractions||m(I[0],g)}else{if(I=/^;/.exec(w)){U=!0;break}if(I=/^[@+-]/.exec(w))I[0]==="@"&&(p.text=!0),m({type:oe[I[0]]},g);else if(I=/^(?:\[(h+|m+|s+)\])/i.exec(w)){const x=I[1].toLowerCase(),ee=x[0],Ce={type:"",size:0,date:1,raw:I[0],pad:x.length};ee==="h"?(Ce.size=16,Ce.type="hour-elap"):ee==="m"?(Ce.size=32,Ce.type="min-elap"):(Ce.size=64,Ce.type="sec-elap"),p.date=p.date|Ce.size,P.push(Ce),m(Ce,g)}else if(I=/^(?:B2)/i.exec(w))_e||(p.date_system=6);else if(I=/^(?:B1)/i.exec(w))_e||(p.date_system=1);else if(I=/^(?:([hHmMsSyYbBdDegG])\1*)/.exec(w)){const x={type:"",size:0,date:1,raw:I[0]},ee=I[0].toLowerCase(),Ce=ee[0];if(ee==="y"||ee==="yy")x.size=2,x.type="year-short";else if(Ce==="y"||Ce==="e")x.size=2,x.type="year";else if(ee==="b"||ee==="bb")x.size=2,x.type="b-year-short";else if(Ce==="b")x.size=2,x.type="b-year";else if(ee==="d"||ee==="dd")x.size=8,x.type="day",x.pad=/dd/.test(ee);else if(ee==="ddd")x.size=8,x.type="weekday-short";else if(Ce==="d")x.size=8,x.type="weekday";else if(Ce==="h")x.size=16,x.type="hour",x.pad=/hh/i.test(ee);else if(Ce==="m"){ee.length===3?(x.size=4,x.type="monthname-short"):ee.length===5?(x.size=4,x.type="monthname-single"):ee.length>=4&&(x.size=4,x.type="monthname");const Ae=P[P.length-1];!x.type&&Ae&&!Ae.used&&80&Ae.size&&(Ae.used=!0,x.size=32,x.type="min",x.pad=/mm/.test(ee)),x.type||(x.size=4,x.type="month",x.pad=/mm/.test(ee),x.indeterminate=!0)}else if(Ce==="s"){x.size=64,x.type="sec",x.pad=/ss/.test(ee);const Ae=P[P.length-1];Ae&&32&Ae.size?x.used=!0:Ae&&Ae.indeterminate&&(delete Ae.indeterminate,Ae.size=32,Ae.type="min",x.used=!0)}p.date=p.date|x.size,p.date_eval=!0,P.push(x),m(x,g)}else if(I=/^(?:AM\/PM|am\/pm|A\/P)/.exec(w))p.clock=12,p.date=16|p.date,p.date_eval=!0,m({type:"am",short:I[0]==="A/P"},g);else if(p.date&&(I=/^\.0{1,3}/i.exec(w))){const x=I[0].length-1,ee=[64,128,256,512][x];p.date=p.date|ee,p.date_eval=!0,p.sec_decimals=Math.max(p.sec_decimals,x),m({type:"subsec",size:ee,decimals:x,date:1,raw:I[0]},g)}else if((I=/^\\(.)/.exec(w))||(I=/^"([^"]*?)"/.exec(w)))m(I[1],g);else if(I=/^\[(<[=>]?|>=?|=)\s*(-?[.\d]+)\]/.exec(w))p.condition=[I[1],parseFloat(I[2],10)];else if(I=/^\[\$([^\]]+)\]/.exec(w)){const x=I[1].split("-"),ee=x.length<2?"":x[x.length-1],Ce=x[0];Ce&&m(Ce,g);const Ae=c(ee);Ae&&(p.locale=Ae);const Ue=parseInt(ee,16);isFinite(Ue)&&16711680&Ue&&(Ue>>16&255)===6&&(p.date_system=6),_e=!0}else if(I=/^\[(black|blue|cyan|green|magenta|red|white|yellow|color\s*(\d+))\]/i.exec(w))p.color=I[2]?N[parseInt(I[2],10)]||"#000":I[1].toLowerCase();else if(!(I=/^\[(DBNum1|ENG|HIJ|JPN|TWN)\]/i.exec(w))){if(I=/^%/.exec(w))p.scale=100,p.percent=!0,m("%",g);else if(I=/^_(\\.|.)/.exec(w))m(" ",g);else if(I=/^\./.exec(w))m({type:"point",value:I[0]},g),p.dec_fractions=!0,M="frac";else if(I=/^[Ee]([+-]?|(?=[0#?]))/.exec(w))p.exponential=!0,p.exp_plus=I[1]==="+",M="man",m({type:"exp",plus:I[1]==="+"},g);else if(!(I=/^\*(\\.|.)/.exec(w))){if(I=/^[BENn[]/.exec(w))throw new SyntaxError("Unexpected char ".concat(w.charAt(0)," in pattern ").concat(_));w[0]==="("&&(p.parens=!0),I=[w[0]],m(I[0],g)}}}Z=I[0],w=w.slice(I?I[0].length:1)}if(p.pattern=_.slice(0,_.length-w.length),/^((?:\[[^\]]+\])+)(;|$)/.test(p.pattern)&&!/^\[(?:h+|m+|s+)\]/.test(p.pattern)&&m({type:"text"},g),p.fractions&&p.dec_fractions||p.fractions&&p.exponential)throw new SyntaxError("Invalid pattern: ".concat(p.pattern));const q=p.int_pattern.join("");if(p.grouping=q.indexOf(",")>=0,p.grouping){const x=q.split(","),ee=x.length;ee===2?(p.group_pri=x[1].length,p.group_sec=p.group_pri):ee>2&&(p.group_pri=x[ee-1].length,p.group_sec=x[ee-2].length)}else p.group_pri=0,p.group_sec=0;J(q.replace(/[,]/g,""),p,"int"),J(p.frac_pattern.join(""),p,"frac"),J(p.man_pattern.join(""),p,"man");let me=p.num_pattern.join(""),ye=p.den_pattern.join("");const ce=/\?/.test(ye)||/\?/.test(me);return ye=ye.replace(/\d/g,ce?"?":"#"),ce&&(ye=ye.replace(/#$/g,"?")),J(me,p,"num"),J(ye,p,"den"),ce&&(me=me.replace(/#$/g,"?")),p.int_padding=le(p.int_pattern.join("")),p.man_padding=le(p.man_pattern.join("")),p.num_padding=le(me),p.den_padding=le(ye),p.den_pattern.length&&(p.denominator=parseInt(p.den_pattern.join("").replace(/\D/g,""),10)),p.integer=!!p.int_pattern.join("").length,p.fractions&&g.forEach((x,ee)=>{const Ce=g[ee+1];x.type==="string"&&Ce&&(Ce.type==="num"?x.rule="num+int":Ce.type==="div"?x.rule="num":Ce.type==="den"&&(x.rule="den"))}),p}const y=_=>{const g=_.condition;g&&g[1]<0&&(g[0]==="<"||g[0]==="<="||g[0]==="=")||_.tokens.unshift({type:"minus",volatile:!0})};function D(_){const g=[];let p,w=!1,M=null,U=_,L=0,P=!1,I=0,Z=0;do{if(P=j(U),(P.date||P.general)&&(P.int_pattern.length||P.frac_pattern.length||P.scale!==1||P.text))throw new Error("Illegal format");if(P.condition&&(Z++,w=!0),P.text){if(M)throw new Error("Unexpected partition");M=P}P.locale&&(p=c(P.locale)),g.push(P),L=U.charAt(P.pattern.length)===";"?1:0,U=U.slice(P.pattern.length+L),I++}while(L&&I<4&&Z<3);if(L)throw new Error("Unexpected partition");if(Z>2)throw new Error("Unexpected condition");const _e=g[3];if(_e&&(_e.int_pattern.length||_e.frac_pattern.length||_e.date))throw new Error("Unexpected partition");if(w){const q=g.length;if(q===1&&(g[1]=j("General"),g[1].generated=!0),q<3){const me=g[0],ye=g[1];if(y(me),ye.condition)y(ye);else{const ce=me.condition;(ce[0]==="="||ce[1]>=0&&(ce[0]===">"||ce[0]===">="))&&ye.tokens.unshift({type:"minus",volatile:!0})}}else g.forEach(y)}else{if(g.length<4&&M)for(let q=0,me=g.length;q<me;q++)g[q]===M&&g.splice(q,1);if(g.length<1&&M&&(g[0]=j("General"),g[0].generated=!0),g.length<2){const q=j(g[0].pattern);q.tokens.unshift({type:"minus",volatile:!0}),q.generated=!0,g.push(q)}if(g.length<3){const q=j(g[0].pattern);q.generated=!0,g.push(q)}if(g.length<4)if(M)g.push(M);else{const q=j("@");q.generated=!0,g.push(q)}g[0].condition=[">",0],g[1].condition=["<",0],g[2].condition=null}return{pattern:_,partitions:g,locale:p}}const b=Math.floor;function S(_){if((!(arguments.length>1&&arguments[1]!==void 0)||arguments[1])&&_>=0){if(_===0)return[1900,1,0];if(_===60)return[1900,2,29];if(_<60)return[1900,_<32?1:2,(_-1)%31+1]}let p=_+68569+2415019;const w=b(4*p/146097);p-=b((146097*w+3)/4);const M=b(4e3*(p+1)/1461001);p=p-b(1461*M/4)+31;const U=b(80*p/2447),L=p-b(2447*U/80);p=b(U/11);const P=U+2-12*p;return[0|100*(w-49)+M+p,0|P,0|L]}function F(_){return S(_+1462)}function $(_){if(_===60)throw new Error("#VALUE!");if(_<=1)return[1317,8,29];if(_<60)return[1317,_<32?9:10,1+(_-2)%30];const g=10631/30,p=.1335;let w=_+466935;const M=b(w/10631);w-=10631*M;const U=b((w-p)/g);w-=b(U*g+p);const L=b((w+28.5001)/29.5);return L===13?[30*M+U,12,30]:[30*M+U,L,w-b(29.5001*L-29)]}function G(_){let g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,p=!(arguments.length>2&&arguments[2]!==void 0)||arguments[2];const w=b(_);return g===6?$(w):g===-1?F(w):S(w,p)}const se=Math.floor,he=86400;function ge(_,g){let p=null;if(Array.isArray(_)){const[w,M,U,L,P,I]=_;p=Date.UTC(w,M==null?0:M-1,U!=null?U:1,L||0,P||0,I||0)}else if(_ instanceof Date&&(p=1*_,!g||!g.ignoreTimezone)){const w=new Date;w.setUTCFullYear(_.getFullYear(),_.getMonth(),_.getDate()),w.setUTCHours(_.getHours(),_.getMinutes(),_.getSeconds(),_.getMilliseconds()),p=1*w}if(p!=null&&isFinite(p)){const w=p/864e5;return w-(w<=-25509?-25568:-25569)}return _}function Te(_,g){let p=0|_;const w=he*(_-p);let M=se(w);w-M>.9999&&(M+=1,M===he&&(M=0,p+=1));const U=M<0?he+M:M,[L,P,I]=G(_,0,g&&g.leap1900),Z=se(U/60/60)%60,_e=se(U/60)%60,q=se(U)%60;if(g&&g.nativeDate){const me=new Date(0);return me.setUTCFullYear(L,P-1,I),me.setUTCHours(Z,_e,q),me}return[L,P,I,Z,_e,q]}function we(_){return!!(_[0]&&_[0].percent||_[1]&&_[1].percent||_[2]&&_[2].percent||_[3]&&_[3].percent)}function v(_){return!!(_[0]&&_[0].date||_[1]&&_[1].date||_[2]&&_[2].date||_[3]&&_[3].date)}function k(_){const[g,p,w,M]=_;return!(g&&!g.generated||p&&!p.generated||w&&!w.generated||!M||!M.text||M.generated)}const K={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},Q=[["DMY",1],["DM",2],["MY",3],["MDY",4],["MD",5],["hmsa",6],["hma",7],["hms",8],["hm",9]],Y={total:1,sign:0,period:0,int:1,frac:0},W=(_,g)=>_.replace(/\./,g.decimal);function ue(_,g,p,w){const M=0|p;if(typeof p=="string")_.push(p);else if(p===M)_.push(Math.abs(M));else{const U=Math.abs(p);let L=U?Math.floor(Math.log10(U)):0,P=L<0?U*10**-L:U/10**L;P===10&&(P=1,L++);const I=function(_e){let q=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];const me=Math.abs(_e);if(!me)return Y;const ye=q&&_e<0?1:0,ce=Math.floor(me),x=Math.floor(Math.log10(me)+1);let ee=0,Ce=0;if(ce!==me){ee=1;const Ae=String(E(x<0?me*10**-x:me/10**x,15));let Ue=Ae.length,Fe=!0,He=0;for(;He<=Ae.length;){if(Ae[He]==="."){Ue--;break}Ae[He]==="0"&&Fe?Ue--:Fe=!1,He++}Ce=Ue-x,Ce<0&&(Ce=0,ee=0)}return{total:ye+Math.max(x,1)+ee+Ce,digits:Math.max(x,0)+Ce,sign:ye,period:ee,int:Math.max(x,1),frac:Ce}}(U),Z=()=>{const _e=Math.abs(L);let q;q=P===1?P:E(P,5),_.push(W(q+"",w),w.exponent,L<0?w.negative:w.positive,_e<10?"0":"",_e)};if(L>=-4&&L<=-1){const _e=U.toPrecision(10+L).replace(/\.?0+$/,"");_.push(W(_e,w))}else if(L===10){const _e=U.toFixed(10).slice(0,12).replace(/\.$/,"");_.push(W(_e,w))}else if(Math.abs(L)<=9)if(I.total<=11){const _e=E(U,9).toFixed(I.frac);_.push(W(_e,w))}else L===9?_.push(Math.floor(U)):L>=0&&L<9?_.push(E(U,9-L)):Z();else I.total>=12?Z():Math.floor(U)===U?_.push(Math.floor(U)):_.push(W(E(U,9).toFixed(I.frac),w))}return _}const ae=86400,B={int:"integer",frac:"fraction",man:"mantissa",num:"numerator",den:"denominator"},te=function(_){let g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;const p=Math.floor(Math.log10(_));return g>1?Math.floor(p/g)*g:p};function ie(_,g,p,w){let M="",U="",L="",P="",I="",Z=0,_e=0|_,q=0,me=0,ye=1,ce=0,x=0,ee=0,Ce=0,Ae=0,Ue=0;const Fe=w||f;if(!g.text&&isFinite(g.scale)&&g.scale!==1&&(_=function(Ie){if(Ie===0)return Ie;const Me=Math.ceil(Math.log10(Ie<0?-Ie:Ie)),ne=10**(16-Math.floor(Me));return Math.round(Ie*ne)/ne}(_*g.scale)),g.exponential){let Ie=Math.abs(_);if(Ie){const Me=10**-te(Ie,g.int_max),ne=E(Ie*Me,g.frac_max)/Me;Z=te(ne,g.int_max)}Ie/=10**Z,_=_<0?-Ie:Ie,M+=Math.abs(Z)}if(g.integer){const Ie=Math.abs(E(_,g.fractions?1:g.frac_max));I+=Ie<1?"":Math.floor(Ie)}if(g.grouping){let Ie="",Me=I.length;for(Me>g.group_pri&&(Me-=g.group_pri,Ie=Fe.group+I.slice(Me,Me+g.group_pri)+Ie);Me>g.group_sec;)Me-=g.group_sec,Ie=Fe.group+I.slice(Me,Me+g.group_sec)+Ie;I=Me?I.slice(0,Me)+Ie:Ie}g.dec_fractions&&(P=String(E(_,g.frac_max)).split(".")[1]||"");let He=!1;if(g.fractions){const Ie=Math.abs(g.integer?_%1:_);if(Ie)if(He=!0,isFinite(g.denominator))L+=g.denominator,U+=E(Ie*g.denominator),U==="0"&&(U="",L="",He=!1,I||(I="0"));else{const Me=R(Ie,g.integer?g.num_max:1/0,g.den_max);U+=Me[0],L+=Me[1],g.integer&&U==="0"&&(I||(I="0"),U="",L="",He=!1)}}if(g.date){_e=Math.trunc(_);const Ie=ae*(_-_e);if(q=Math.floor(Ie),Ue=Ie-q,Math.abs(Ue)<1e-6?Ue=0:Ue>.9999&&(Ue=0,q+=1,q===ae&&(q=0,_e+=1)),Ue){const Me=512&g.date||256&g.date||128&g.date;(Me===512&&Ue>.9995||Me===256&&Ue>.995||Me===128&&Ue>.95||!Me&&Ue>=.5)&&(q++,Ue=0)}if(_e||g.date_system){const Me=G(_,g.date_system,p.leap1900);me=Me[0],ye=Me[1],ce=Me[2]}if(q){const Me=q<0?ae+q:q;Ae=Math.floor(Me)%60,Ce=Math.floor(Me/60)%60,ee=Math.floor(Me/60/60)%60}if(x=(6+_e)%7,g.date_eval&&(ft=_,pt=_e+q/ae,p.dateSpanLarge?ft<-694324||pt>=35830291:ft<0||pt>=2958466)){if(p.dateErrorThrows)throw new Error("Date out of bounds");return p.dateErrorNumber?ue(_<0?[Fe.negative]:[],0,_,Fe).join(""):p.overflow}}var ft,pt;if(g.int_padding&&(I=g.int_padding.length===1?I||g.int_padding:g.int_padding.substring(0,g.int_padding.length-I.length)+I),g.num_padding&&(U=g.num_padding.length===1?U||g.num_padding:g.num_padding.substring(0,g.num_padding.length-U.length)+U),g.den_padding&&(L=g.den_padding.length===1?L||g.den_padding:L+g.den_padding.slice(L.length)),g.man_padding){const Ie=g.exp_plus?"+":"";M=g.man_padding.length===1?(Z<0?"-":Ie)+(M||g.man_padding):(Z<0?"-":Ie)+g.man_padding.slice(0,g.man_padding.length-M.length)+M}const Ee=[];let Ze=0;const ve={int:0,frac:0,man:0,num:0,den:0};for(let Ie=0,Me=g.tokens.length;Ie<Me;Ie++){const ne=g.tokens[Ie],ut=ne.num?ne.num.length:0;if(ne.type==="string")ne.rule?ne.rule==="num"?He?Ee.push(ne.value):(g.num_min>0||g.den_min>0)&&Ee.push(ne.value.replace(/./g,z["?"])):ne.rule==="num+int"?He&&I?Ee.push(ne.value):g.den_min>0&&(I||g.num_min)&&Ee.push(ne.value.replace(/./g,z["?"])):ne.rule==="den"&&(He?Ee.push(ne.value):(g.den_min>0||g.den_min>0)&&Ee.push(ne.value.replace(/./g,z["?"]))):Ee.push(ne.value);else if(ne.type==="error")Ee.push(p.invalid);else if(ne.type==="point")Ee.push(g.date?ne.value:Fe.decimal);else if(ne.type==="general")ue(Ee,0,_,Fe);else if(ne.type==="exp")Ee.push(Fe.exponent);else if(ne.type==="minus")ne.volatile&&g.date||ne.volatile&&(_>=0||typeof _!="number")||(ne.volatile&&!g.fractions&&(g.integer||g.dec_fractions)?(_<0&&I&&I!=="0"||P)&&Ee.push(Fe.negative):Ee.push(Fe.negative));else if(ne.type==="plus")Ee.push(Fe.positive);else if(ne.type==="text")Ee.push(_);else if(ne.type==="div")He?Ee.push("/"):g.num_min>0||g.den_min>0?Ee.push(z["?"]):Ee.push(z["#"]);else if(ne.type==="int")if(g.int_pattern.length===1)Ee.push(I);else{const Be=Ze?g.int_pattern.join("").length-ve.int:1/0,Tt=Ze===g.int_pattern.length-1?0:g.int_pattern.join("").length-(ve.int+ne.num.length);Ee.push(I.substring(I.length-Be,I.length-Tt)),Ze++,ve.int+=ne.num.length}else if(ne.type==="frac"){const Be=ve.frac;for(let Tt=0;Tt<ut;Tt++)Ee.push(P[Tt+Be]||z[ne.num[Tt]]);ve.frac+=ut}else if(ne.type in B)g[ne.type+"_pattern"].length===1?(ne.type==="int"&&Ee.push(I),ne.type==="frac"&&Ee.push(P),ne.type==="man"&&Ee.push(M),ne.type==="num"&&Ee.push(U),ne.type==="den"&&Ee.push(L)):(Ee.push(B[ne.type].slice(ve[ne.type],ve[ne.type]+ut)),ve[ne.type]+=ut);else if(ne.type==="year")me<0&&Ee.push(Fe.negative),Ee.push(String(Math.abs(me)).padStart(4,"0"));else if(ne.type==="year-short"){const Be=me%100;Ee.push(Be<10?"0":"",Be)}else if(ne.type==="month")Ee.push(ne.pad&&ye<10?"0":"",ye);else if(ne.type==="monthname-single")g.date_system===6?Ee.push(Fe.mmmm6[ye-1].charAt(0)):Ee.push(Fe.mmmm[ye-1].charAt(0));else if(ne.type==="monthname-short")g.date_system===6?Ee.push(Fe.mmm6[ye-1]):Ee.push(Fe.mmm[ye-1]);else if(ne.type==="monthname")g.date_system===6?Ee.push(Fe.mmmm6[ye-1]):Ee.push(Fe.mmmm[ye-1]);else if(ne.type==="weekday-short")Ee.push(Fe.ddd[x]);else if(ne.type==="weekday")Ee.push(Fe.dddd[x]);else if(ne.type==="day")Ee.push(ne.pad&&ce<10?"0":"",ce);else if(ne.type==="hour"){const Be=ee%g.clock||(g.clock<24?g.clock:0);Ee.push(ne.pad&&Be<10?"0":"",Be)}else if(ne.type==="min")Ee.push(ne.pad&&Ce<10?"0":"",Ce);else if(ne.type==="sec")Ee.push(ne.pad&&Ae<10?"0":"",Ae);else if(ne.type==="subsec"){Ee.push(Fe.decimal);const Be=Ue.toFixed(g.sec_decimals);Ee.push(Be.slice(2,2+ne.decimals))}else if(ne.type==="am"){const Be=ee<12?0:1;ne.short&&!w?Ee.push("AP"[Be]):Ee.push(Fe.ampm[Be])}else if(ne.type==="hour-elap"){_<0&&Ee.push(Fe.negative);const Be=24*_e+Math.floor(Math.abs(q)/3600);Ee.push(String(Math.abs(Be)).padStart(ne.pad,"0"))}else if(ne.type==="min-elap"){_<0&&Ee.push(Fe.negative);const Be=1440*_e+Math.floor(Math.abs(q)/60);Ee.push(String(Math.abs(Be)).padStart(ne.pad,"0"))}else if(ne.type==="sec-elap"){_<0&&Ee.push(Fe.negative);const Be=_e*ae+Math.abs(q);Ee.push(String(Math.abs(Be)).padStart(ne.pad,"0"))}else if(ne.type==="b-year")Ee.push(me+543);else if(ne.type==="b-year-short"){const Be=(me+543)%100;Ee.push(Be<10?"0":"",Be)}}return p.nbsp?Ee.join(""):Ee.join("").replace(/\u00a0/g," ")}function pe(_,g){for(let p=0;p<3;p++){const w=g[p];if(w){let M;if(w.condition){const U=w.condition[0],L=w.condition[1];U==="="?M=_===L:U===">"?M=_>L:U==="<"?M=_<L:U===">="?M=_>=L:U==="<="?M=_<=L:U==="<>"&&(M=_!==L)}else M=!0;if(M)return w}}}const be=j("@"),De="black",X={};function Re(_,g){if(_){const p=_[0];g[p]=g[p]||{},Re(_.slice(1),g[p])}else g.$=!0}["d-F-y","d-F-Y","d-M-y","d-M-Y","F-d-y","F-d-Y","F-j-y","F-j-Y","j-F-y","j-F-Y","j-M-y","j-M-Y","M-d-y","M-d-Y","M-j-y","M-j-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","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"].forEach(_=>{Re(_,X),Re(_+" x",X),Re(_+" l",X),Re(_+" l x",X),Re("l "+_,X),Re("l "+_+" x",X),Re(_+" D",X),Re(_+" D x",X),Re("D "+_,X),Re("D "+_+" x",X)});const ze={jan:1,feb:2,mar:3,apr:4,may:5,jun:6,jul:7,aug:8,sep:9,oct:10,nov:11,dec:12},je={january:1,february:2,march:3,april:4,june:6,july:7,august:8,september:9,october:10,november:11,december:12},Le={sunday:"l",monday:"l",tuesday:"l",wednesday:"l",thursday:"l",friday:"l",saturday:"l",sun:"D",mon:"D",tue:"D",wed:"D",thu:"D",fri:"D",sat:"D"},qe=new Date().getUTCFullYear();function Rt(_){const g=new RegExp("^([\\s+%"+A.join("")+"(-]*)(((?:(?:\\d[\\d,]*)(?:\\.\\d*)?|(?:\\.\\d+)))([eE][+-]?\\d+)?)([\\s%"+A.join("")+")]*)$").exec(_);if(g){const[,p,w,M,U,L]=g;let P=1,I="",Z=!1,_e=!1,q=!1,me=!1,ye=!1,ce=null,x=!1,ee=parseFloat(w.replace(/,/g,""));if(!isFinite(ee))return null;for(let Ae=0;Ae<p.length;Ae++){const Ue=p[Ae];if(Ue==="-"){if(Z||_e)return null;Z=!0,P=-1}else if(H.test(Ue)){if(ye)return null;ye=!0,ce=Ue}else if(Ue==="("){if(_e||Z)return null;_e=!0,P=-1}else if(Ue==="%"){if(me)return null;me=!0}}for(let Ae=0;Ae<L.length;Ae++){const Ue=L[Ae];if(H.test(Ue)){if(ye)return null;ye=!0,ce=Ue,x=!0}else if(Ue===")"){if(q||!_e)return null;q=!0}else if(Ue==="%"){if(me)return null;me=!0}}if(U){if(me||ye)return null;I="0.00E+00"}else if(me){if(ye)return null;I=M.includes(".")?"0.00%":"0%",ee*=.01}else if(ye){const Ae=M.includes(".")?"#,##0.00":"#,##0";I=x?Ae+ce:ce+Ae}else M.includes(",")&&(I=M.includes(".")?"#,##0.00":"#,##0");const Ce={v:ee*P};return I&&(Ce.z=I),Ce}}const Ye=(_,g,p)=>{const w=p.path||"",M=Object.keys(g);for(let U=0;U<M.length;U++){let L;const P=M[U];if(g[P]){if(P==="$"||P==="€")_||(L=p);else if(P==="-"){const I=/^(\s*([./-]|,\s)\s*|\s+)/.exec(_);if(I){const Z=I[1]==="-"||I[1]==="/"||I[1]==="."?I[1]:" ";if(!p.sep||p.sep===Z){const _e=I[0].replace(/\s+/g," ");L=Ye(_.slice(I[0].length),g[P],{...p,sep:Z,path:w+_e})}}}else if(P===" "){const I=/^[,.]?\s+/.exec(_);if(I){const Z=I[0].replace(/\s+/g," ");L=Ye(_.slice(I[0].length),g[P],{...p,path:w+Z})}}else if(P==="j"||P==="d"){const I=/^(0?[1-9]|1\d|2\d|3[01])\b/.exec(_);I&&(L=Ye(_.slice(I[0].length),g[P],{...p,day:I[0],path:w+P}))}else if(P==="n"||P==="m"){const I=/^(0?[1-9]|1[012])\b/.exec(_);I&&(L=Ye(_.slice(I[0].length),g[P],{...p,month:+I[0],_mon:I[0],path:w+P}))}else if(P==="F"||P==="M"){const I=/^([a-z]{3,9})\b/i.exec(_),Z=I&&(P==="F"?je:ze)[I[0].toLowerCase()];Z&&(L=Ye(_.slice(I[0].length),g[P],{...p,month:Z,_mon:I[0],path:w+P}))}else if(P==="l"||P==="D"){const I=/^([a-z]{3,9})\b/i.exec(_);(I&&Le[I[0].toLowerCase()])===P&&(L=Ye(_.slice(I[0].length),g[P],{...p,path:w+P}))}else if(P==="y"){const I=/^\d\d\b/.exec(_);if(I){const Z=+I[0]>=30?+I[0]+1900:+I[0]+2e3;L=Ye(_.slice(I[0].length),g[P],{...p,year:Z,path:w+P})}}else if(P==="Y"){const I=/^\d\d\d\d\b/.exec(_);I&&(L=Ye(_.slice(I[0].length),g[P],{...p,year:+I[0],path:w+P}))}else{if(P!=="x")throw new Error('Unknown date token "'.concat(P,'"'));{const I=Ve(_);I&&(L=Ye("",g[P],{...p,time:I.v,tf:I.z,path:w+P}))}}if(L)return L}}};function et(_,g){const p=Ye(_.trim(),X,{path:""});if(p){var w;if(p.sep==="."&&p.path.length===3)return null;const M=+((w=p.year)!==null&&w!==void 0?w:qe);if(p.day||(p.day=1),!function(P,I,Z){if(Z<1||I<1||I>12)return!1;if(I===2){if(Z>(P%4==0&&P%100!=0||P%400==0||P===1900?29:28))return!1}else if((I===4||I===6||I===9||I===11)&&Z>30||(I===1||I===3||I===5||I===7||I===8||I===10||I===12)&&Z>31)return!1;return!0}(M,p.month,p.day))return null;let U=-1/0;if(M<1900)return null;M<=1900&&p.month<=2?U=25568:M<1e4&&(U=25569);const L=Date.UTC(M,p.month-1,p.day)/864e5+U+(p.time||0);if(L>=0&&L<=2958465){const P=p._mon[0]==="0"||p.day[0]==="0"||p._mon.length===2&&p.day.length===2,I=p.path.replace(/[jdlDnmMFyYx-]/g,Z=>Z==="j"||Z==="d"?P?"dd":"d":Z==="D"?"ddd":Z==="l"?"dddd":Z==="n"||Z==="m"?P?"mm":"m":Z==="M"?"mmm":Z==="F"?"mmmm":Z==="y"?"yy":Z==="x"?p.tf||"":Z==="Y"?"yyyy":Z);return g&&g.nativeDate?{v:Te(L,g),z:I}:{v:L,z:I}}}return null}function Ve(_){const g=/^\s*([10]?\d|2[0-4])(?::([0-5]\d|\d))?(?::([0-5]\d|\d))?(\.\d{1,10})?(?:\s*([AP])M?)?\s*$/i.exec(_);if(g){const[,p,w,M,U,L]=g;if(U&&!M||!L&&!w&&!M)return null;let P=1*(p||0);if(L){if(P>=13)return null;L[0]!=="p"&&L[0]!=="P"||(P+=12)}return{v:(60*P*60+60*(1*(w||0))+1*(M||0)+1*(U||0))/86400,z:(p.length===2?"hh":"h")+":mm"+(M?":ss":"")+(L?" AM/PM":"")}}return null}function ht(_){return/^\s*true\s*$/i.test(_)?{v:!0}:/^\s*false\s*$/i.test(_)?{v:!1}:null}const at={};function Ft(_,g){const{pattern:p,partitions:w,locale:M}=_,U=I=>{const Z=Object.assign({},V(),g,I);return M&&(Z.locale=M),Z},L=(I,Z)=>{const _e=U(Z);return function(q,me,ye){const ce=h(ye.locale),x=me[3]?me[3]:be;if(typeof q=="boolean"&&(q=q?"TRUE":"FALSE"),q==null)return"";if(typeof q!="number")return ie(q,x,ye,ce);if(!isFinite(q)){const Ce=ce||f;return isNaN(q)?Ce.nan:(q<0?Ce.negative:"")+Ce.infinity}const ee=pe(q,me);return ee?ie(q,ee,ye,ce):ye.overflow}(ge(I,_e),w,_e)};L.color=(I,Z)=>function(_e,q){if(typeof _e!="number"||!isFinite(_e))return(q[3]?q[3].color:be.color)||De;const me=pe(_e,q);return me&&me.color||De}(ge(I,U(Z)),w);const P=function(I){var Z;let _e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;const[q,me]=I,ye=q.frac_max,ce={type:"general",isDate:v(I),isText:k(I),isPercent:we(I),maxDecimals:q.general?9:ye,scale:(Z=q.scale)!==null&&Z!==void 0?Z:1,color:0,parentheses:0,grouped:q.grouping?1:0,_partitions:I},x=!ce.isDate&&!ce.isText&&!q.error&&q.tokens.some(Fe=>Fe.type==="string"&&(_e?Fe.value===_e:H.test(Fe.value)));let ee="G",Ce=ye>=0?Math.min(15,ye):"",Ae="",Ue="";if(me&&me.color&&(Ue="-",ce.color=1),q.parens&&(Ae="()",ce.parentheses=1),x)ee="C",ce.type="currency";else if(q.error)ce.type="error",ce.maxDecimals=0;else if(ce.isDate){let Fe=0,He=0,ft="";q.tokens.forEach(Ee=>{const Ze=Ee.type;/^(b-)?year/.test(Ze)?(ft+="Y",He++):Ze.startsWith("month")?(ft+="M",He++):/^(week)?day/.test(Ze)?(ft+="D",He++):Ze!=="hour"&&Ze!=="min"&&Ze!=="sec"&&Ze!=="am"||(ft+=Ze[0],Fe++)}),ce.type="date",He&&Fe?ce.type="datetime":!He&&Fe&&(ce.type="time");const pt=Q.find(Ee=>ft.startsWith(Ee[0]));ee=pt?"D":"G",Ce=pt?pt[1]:""}else ce.isText?(ee="G",ce.type="text",Ce="",ce.maxDecimals=0):q.general?(ee="G",ce.type="general",Ce=""):q.fractions?(ee="G",ce.type="fraction",Ce=""):q.exponential?(ee="S",ce.type="scientific"):ce.isPercent?(ee="P",ce.type="percent"):q.grouping?(ee=",",ce.type="grouped"):(q.int_max||ye)&&(ee="F",ce.type="number");return ce.code=ee+Ce+Ue+Ae,ce.level=K[ce.type],Object.freeze(ce)}(w,(g||{}).currency)||new SyntaxError;return L.info=P,L.dateInfo=function(I){const[Z]=I;return{year:!!(2&Z.date),month:!!(4&Z.date),day:!!(8&Z.date),hours:!!(16&Z.date),minutes:!!(32&Z.date),seconds:!!(64&Z.date),clockType:Z.clock===12?12:24}}(w),L.isPercent=()=>!!P.isPercent,L.isDate=()=>!!P.isDate,L.isText=()=>!!P.isText,L.pattern=p,_.error&&(L.error=_.error),L.options=U,L.locale=M||g&&g.locale||"",Object.freeze(L)}function ke(_,g){_||(_="General");let p=null;return at[_]?p=at[_]:(p=Object.assign({},V(),g).throws?D(_):function(w){try{return D(w)}catch(M){const U={tokens:[{type:"error"}],error:M.message};return{pattern:w,partitions:[U,U,U,U],error:M.message,locale:null}}}(_),p.error||(at[_]=p)),Ft(p,g)}ke.isDate=_=>ke(_,{throws:!1}).isDate(),ke.isPercent=_=>ke(_,{throws:!1}).isPercent(),ke.isText=_=>ke(_,{throws:!1}).isText(),ke.getInfo=(_,g)=>ke(_,{...g,throws:!1}).info,ke.getDateInfo=(_,g)=>ke(_,{...g,throws:!1}).dateInfo,ke.dateToSerial=ge,ke.dateFromSerial=Te,ke.options=V,ke.dec2frac=R,ke.round=E,ke.codeToLocale=s,ke.parseLocale=l,ke.getLocale=h,ke.addLocale=(_,g)=>{const p=l(g);return delete at[p.lang],delete at[p.language],d(_,p)},ke.format=function(_,g,p){let w=arguments.length>3&&arguments[3]!==void 0&&arguments[3];const M=p&&typeof p=="object"?p:{locale:p,throws:!w};return ke(_,M)(ge(g,M),M)},ke.is_date=ke.isDate,ke.parseNumber=Rt,ke.parseDate=et,ke.parseTime=Ve,ke.parseBool=ht,ke.parseValue=function(_,g){var p,w,M;return(p=(w=(M=Rt(_))!==null&&M!==void 0?M:et(_,g))!==null&&w!==void 0?w:Ve(_))!==null&&p!==void 0?p:ht(_)};var dt=ke;return r=r.default}()})}(Jr)),Jr.exports}var Ls,sa;function u_(){return sa||(sa=1,Ls=l_()),Ls}var c_=u_();const h_=St(c_),du=h_;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 oi(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 ai(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 d_(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 h=0;h<s;h++,c++){const u=r[h];l[c]=n[u]}for(let h=0;h<a;h++,c++){const u=o[h];l[c]=i[u]}return l}function f_(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 li(e,t,n,r){const s=e>n;if(!s&&e+t>n)throw new Error("Invalid move operation");s?g_(e,t,n,r):p_(e,t,n,r)}function g_(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 p_(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 xt{constructor(t={}){C(this,"_matrix");this._setOriginValue(t)}static MakeObjectMatrixSize(t){return new xt({[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){li(t,n,r,this._matrix)}moveColumns(t,n,r){this.forEach((s,i)=>{li(t,n,r,i)})}insertRows(t,n){for(let r=t;r<t+n;r++)oi(r,{},this._matrix)}insertColumns(t,n){for(let r=t;r<t+n;r++)this.forEach((s,i)=>{i&&oi(r,void 0,i)})}removeRows(t,n){ai(t,n,this._matrix)}removeColumns(t,n){this.forEach((r,s)=>{s&&ai(t,n,s)})}getFragment(t,n,r,s){const i=new xt;let o=0;for(let a=t;a<=n;a++){const l={};let c=0;for(let h=r;h<=s;h++){const u=this.getValue(a,h);l[c]=u,c++}i.setRow(o,l),o++}return i}getSlice(t,n,r,s){const i=new xt;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,re.deepClone(l))}return i}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}}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 xt;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 h=this.getValue(o,c);i.setValue(o-t,c-n,h)})}),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(h=>{const u=Number(h);o?u<n&&(n=u):(o=!0,n=u)}),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)})}_setOriginValue(t={}){this._matrix=t}}const m_={sheetId:"",range:{startRow:-1,endRow:-1,startColumn:-1,endColumn:-1}},__={startRow:-1,startColumn:-1,endRow:-1,endColumn:-1},E_={startRow:0,startColumn:0,endRow:0,endColumn:0},C_={row:0,column:0},ct={ff:"Arial",fs:11,it:Se.FALSE,bl:Se.FALSE,ul:{s:Se.FALSE},st:{s:Se.FALSE},ol:{s:Se.FALSE},tr:{a:0,v:Se.FALSE},td:Pn.UNSPECIFIED,cl:{rgb:"#000"},bg:{rgb:"#fff"},ht:$t.UNSPECIFIED,vt:tn.UNSPECIFIED,tb:_n.UNSPECIFIED,pd:{t:0,r:0,b:0,l:0},n:null,bd:{b:null,l:null,r:null,t:null}},fu={id:"default_slide",title:"defaultSlide",pageSize:{width:300,height:300}},R_=[xi,rl,Li];var gu=(e=>(e.ARRAY_CONVERTOR="ARRAY_CONVERTOR",e.MATRIX_CONVERTOR="MATRIX_CONVERTOR",e))(gu||{});function Tr(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 Se.FALSE;switch(e){case"bl":case"it":{if(o[e]===Se.FALSE)return Se.FALSE;break}case"ul":case"st":{if(o[e].s===Se.FALSE)return Se.FALSE;break}default:throw new Error(`unknown style key: ${e} in IStyleBase`)}r+=l-a}return t.dataStream.indexOf(`\r
7
- `)===r?Se.TRUE:Se.FALSE}const ur=class ur{constructor(t,n,r){C(this,"_range");C(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 xt;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 xt;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=re.numToWord(r+1)+(t+1),o=re.numToWord(s+1)+(n+1)):(i=re.numToWord(s+1)+(n+1),o=re.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)||ct.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 ur(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 h=0;h<=i-s;h++){if(o==null||((a=o==null?void 0:o[c])==null?void 0:a[h])==null)continue;const u=o[c][h].s;u&&(o[c][h].s=l.get(u))}}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)||ct.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?Tr("ul",t.body)===Se.TRUE?{s:Se.TRUE}:{s:Se.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?Tr("st",t.body)===Se.TRUE?{s:Se.TRUE}:{s:Se.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 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?Tr("it",t.body)===Se.TRUE?ss.ITALIC:ss.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?Tr("bl",t.body)===Se.TRUE?is.BOLD:is.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()===_n.WRAP?Se.TRUE:Se.FALSE}getWrapStrategies(){return this._getStyles("tb")}getWrapStrategy(){return this.getWrapStrategies()[0][0]}forEach(t){ur.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]||ct[t]}))}};C(ur,"transformRange",(t,n)=>{const r=n.getMaxColumns()-1,s=n.getMaxRows()-1;return t.rangeType===xe.ALL?{startColumn:0,startRow:0,endColumn:r,endRow:s}:t.rangeType===xe.COLUMN?{startRow:0,endRow:s,startColumn:t.startColumn,endColumn:t.endColumn}:t.rangeType===xe.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 Fn=ur;function I_(e,t,n,r=!1){if(t===0&&n===0)return e;let s={...e};const i=s.startAbsoluteRefType||tt.NONE,o=s.endAbsoluteRefType||tt.NONE,a=s.rangeType||xe.NORMAL;if(!r&&i===tt.ALL&&o===tt.ALL)return s;const l=ia(s.startRow,n,s.startColumn,t,a),c=ia(s.endRow,n,s.endColumn,t,a);return r||i===tt.NONE&&o===tt.NONE?s={...s,startRow:l.row,startColumn:l.column,endRow:c.row,endColumn:c.column}:(i===tt.NONE?s={...s,startRow:l.row,startColumn:l.column}:i===tt.COLUMN?s={...s,startRow:l.row}:i===tt.ROW&&(s={...s,startColumn:l.column}),o===tt.NONE?s={...s,endRow:c.row,endColumn:c.column}:o===tt.COLUMN?s={...s,endRow:c.row}:o===tt.ROW&&(s={...s,endColumn:c.column}),s)}function ia(e,t,n,r,s){return s===xe.NORMAL?{row:e+t,column:n+r}:s===xe.ROW?{row:e+t,column:n}:s===xe.COLUMN?{row:e,column:n+r}:{row:e,column:n}}function Vi(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,h=s[o],u=s[o+1]-1;for(const d of e){if(d.startRow>u)break;if(d.startRow<=h&&d.endRow>=u&&d.startColumn<=l&&d.endColumn>=c){i.push({startColumn:l,endColumn:c,startRow:h,endRow:u});break}}}return i}function v_(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 y_(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 S_(e){const t=Vi(e),n=v_(t);return y_(n)}function O_(e,t){const n=[];return e.forEach(r=>{n.push(...Yt.subtract(r,t))}),Yt.mergeRanges(n)}function b_(e,t){const n=oa(e.startRow,e.endRow,t.startRow,t.endRow),r=oa(e.startColumn,e.endColumn,t.startColumn,t.endColumn);if(!n||!r)return null;const[s,i]=n,[o,a]=r,l=w_(e.rangeType,t.rangeType,s,i,o,a);return{startRow:s,endRow:i,startColumn:o,endColumn:a,rangeType:l}}function oa(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 h=l===-1/0?Number.NaN:l,u=c===1/0?Number.NaN:c;return[h,u]}else return null}function w_(e,t,n,r,s,i){const o=e!==void 0?e:aa(n,r,s,i),a=t!==void 0?t:aa(n,r,s,i);return o===xe.ALL||a===xe.ALL?o===a?o:o===xe.ALL?a:o:o===a?o:(o===xe.NORMAL||a===xe.NORMAL,xe.NORMAL)}function aa(e,t,n,r){const s=!isNaN(e)&&!isNaN(t),i=!isNaN(n)&&!isNaN(r);return s&&i?xe.NORMAL:s?xe.ROW:i?xe.COLUMN:xe.ALL}const kt=class kt{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===xe.NORMAL||n.rangeType===void 0&&t.rangeType===xe.NORMAL)}static simpleRangesIntersect(t,n){const{startRow:r,endRow:s,startColumn:i,endColumn:o}=t,{startRow:a,endRow:l,startColumn:c,endColumn:h}=n,u=r<=l&&s>=a,d=i<=h&&o>=c;return u&&d}static intersects(t,n){if(t.rangeType===xe.ROW&&n.rangeType===xe.COLUMN||t.rangeType===xe.COLUMN&&n.rangeType===xe.ROW)return!0;if(t.rangeType===xe.ROW&&n.rangeType===xe.ROW)return t.startRow<=n.endRow&&t.endRow>=n.startRow;if(t.rangeType===xe.COLUMN&&n.rangeType===xe.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,h=Number.isNaN(n.startColumn)?0:n.startColumn,u=Number.isNaN(n.endColumn)?r:n.endColumn,d=Math.abs(o+a-h-u),f=Math.abs(o-a)+Math.abs(h-u),E=Math.abs(s+i-l-c),R=Math.abs(s-i)+Math.abs(l-c);return d<=f&&E<=R}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,h=n.endColumn;let u,d,f,E;if(a<=s)a>=r?d=a:d=r;else return null;if(l>=r)l>=s?E=s:E=l;else return null;if(c<=o)c>i?u=c:u=i;else return null;if(h>=i)h>=o?f=o:f=h;else return null;return{startRow:d,endRow:E,startColumn:u,endColumn:f,rangeType:xe.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 kt.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:xe.NORMAL}),t[0])}static realUnion(...t){const n=t.some(i=>i.rangeType===xe.COLUMN),r=t.some(i=>i.rangeType===xe.ROW),s=kt.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?xe.ROW:n?xe.COLUMN:xe.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 S_(t)}static splitIntoGrid(t){return Vi(t)}static subtractMulti(t,n){if(!n.length)return t;let r=t;return n.forEach(s=>{r=O_(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)}};C(kt,"getRelativeRange",(t,n)=>({startRow:t.startRow-n.startRow,endRow:t.endRow-t.startRow,startColumn:t.startColumn-n.startColumn,endColumn:t.endColumn-t.startColumn})),C(kt,"getPositionRange",(t,n,r)=>({...r||{},startRow:r&&[tt.ROW,tt.ALL].includes(r.startAbsoluteRefType||0)?r.startRow:t.startRow+n.startRow,endRow:r&&[tt.ROW,tt.ALL].includes(r.endAbsoluteRefType||0)?r.endRow:t.endRow+t.startRow+n.startRow,startColumn:r&&[tt.COLUMN,tt.ALL].includes(r.startAbsoluteRefType||0)?r.startColumn:t.startColumn+n.startColumn,endColumn:r&&[tt.COLUMN,tt.ALL].includes(r.endAbsoluteRefType||0)?r.endColumn:t.endColumn+t.startColumn+n.startColumn})),C(kt,"moveHorizontal",(t,n=0,r=0)=>({...t,startColumn:t.startColumn+n,endColumn:t.endColumn+n+r})),C(kt,"moveVertical",(t,n=0,r=0)=>({...t,startRow:t.startRow+n,endRow:t.endRow+n+r})),C(kt,"moveOffset",(t,n,r)=>({...t,startRow:t.startRow+r,endRow:t.endRow+r,startColumn:t.startColumn+n,endColumn:t.endColumn+n}));let Yt=kt;function A_(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=T_(n);o.area>r&&(r=o.area,s={startColumn:o.start,startRow:i-o.height+1,endColumn:o.end,endRow:i})}return s}function T_(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 N_(e,t){Fn.foreach(t,(n,r)=>{e[n][r]=void 0})}function M_(e,t){const n=e.toFullArray(),r=[];for(;;){const s=A_(n,t);if(!s)break;r.push(s),N_(n,s)}return r}class D_{constructor(t,n){C(this,"_values",[]);C(this,"_keys",[]);C(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 ui(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 x_(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 ls=65,pu=90,L_=97;function U_(e){const t=pu-ls+1;let n="";for(;e>=0;)n=String.fromCharCode(e%t+ls)+n,e=Math.floor(e/t)-1;return n}function mu(e,t){let n="";for(;t>0;)n+=e,t--;return n}function P_(e,t=!1){const n=pu-ls+1;let r=L_;t&&(r=ls);const s=String.fromCharCode(e%n+r),i=Math.floor(e/n)+1;return mu(s,i)}function F_(e,t){return e.zIndex>t.zIndex?1:e.zIndex===t.zIndex?0:-1}function k_(e,t){return e.zIndex>t.zIndex?-1:e.zIndex===t.zIndex?0:1}function Rr(e="index",t=1){return(n,r)=>n[e]>r[e]?t:n[e]===r[e]?0:-t}var _u=(e=>(e[e.character=0]="character",e[e.paragraph=1]="paragraph",e[e.table=2]="table",e[e.numbering=3]="numbering",e))(_u||{}),Eu=(e=>(e[e.TAB=0]="TAB",e[e.SPACE=1]="SPACE",e[e.NOTHING=2]="NOTHING",e))(Eu||{}),Ne=(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))(Ne||{}),Ir=(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))(Ir||{}),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||{}),fn=(e=>(e[e.COMMENT=0]="COMMENT",e[e.DELETED=9999]="DELETED",e))(fn||{}),Cu=(e=>(e[e.DRAWING=0]="DRAWING",e[e.CUSTOM=1]="CUSTOM",e))(Cu||{}),Gi=(e=>(e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.TRADITIONAL=1]="TRADITIONAL",e[e.MODERN=2]="MODERN",e))(Gi||{}),Ru=(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))(Ru||{}),Iu=(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))(Iu||{}),vu=(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))(vu||{}),yu=(e=>(e[e.NORMAL=0]="NORMAL",e[e.TBRL=1]="TBRL",e[e.LRTBV=2]="LRTBV",e))(yu||{}),Su=(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))(Su||{}),Ou=(e=>(e[e.BOTH_SIDES=0]="BOTH_SIDES",e[e.LEFT=1]="LEFT",e[e.RIGHT=2]="RIGHT",e[e.LARGEST=3]="LARGEST",e))(Ou||{}),bu=(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))(bu||{}),wu=(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[e.HEADING_6=9]="HEADING_6",e))(wu||{}),Au=(e=>(e[e.AUTO=0]="AUTO",e[e.AT_LEAST=1]="AT_LEAST",e[e.EXACT=2]="EXACT",e))(Au||{}),Tu=(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))(Tu||{}),Nu=(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))(Nu||{}),Mu=(e=>(e[e.UNSPECIFIED=0]="UNSPECIFIED",e[e.SPECIFIED=1]="SPECIFIED",e))(Mu||{}),Du=(e=>(e[e.START=0]="START",e[e.CENTER=1]="CENTER",e[e.END=2]="END",e))(Du||{}),xu=(e=>(e[e.AUTO_FIT=0]="AUTO_FIT",e[e.FIXED=1]="FIXED",e))(xu||{}),Lu=(e=>(e[e.NONE=0]="NONE",e[e.WRAP=1]="WRAP",e))(Lu||{}),Uu=(e=>(e[e.AUTO=0]="AUTO",e[e.AT_LEAST=1]="AT_LEAST",e[e.EXACT=2]="EXACT",e))(Uu||{}),Pu=(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))(Pu||{}),wn=(e=>(e.NORMAL="normal",e.BOLD="bold",e.ITALIC="italic",e))(wn||{}),Fu=(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))(Fu||{}),ku=(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))(ku||{}),$u=(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))($u||{}),Bu=(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))(Bu||{}),ju=(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))(ju||{}),Hu=(e=>(e[e.compressPunctuation=0]="compressPunctuation",e[e.compressPunctuationAndJapaneseKana=1]="compressPunctuationAndJapaneseKana",e[e.doNotCompress=2]="doNotCompress",e))(Hu||{}),Wu=(e=>(e[e.PORTRAIT=0]="PORTRAIT",e[e.LANDSCAPE=1]="LANDSCAPE",e))(Wu||{}),zu=(e=>(e[e.forward=0]="forward",e[e.backward=1]="backward",e[e.front=2]="front",e[e.back=3]="back",e))(zu||{}),Yu=(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))(Yu||{}),Ki=(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))(Ki||{}),Vu=(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))(Vu||{}),Gu=(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))(Gu||{}),$e=(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))($e||{}),Mt=(e=>(e[e.Reader=0]="Reader",e[e.Editor=1]="Editor",e[e.Owner=2]="Owner",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e))(Mt||{}),ci=(e=>(e[e.SomeCollaborator=0]="SomeCollaborator",e[e.AllCollaborator=1]="AllCollaborator",e[e.OneSelf=2]="OneSelf",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED",e))(ci||{});class ys extends nt{}function $_(e=re.generateRandomId(6),t=Er.EN_US,n=""){return{id:e,locale:t,title:n,tableSource:{},drawings:{},drawingsOrder:[],headers:{},footers:{},body:{dataStream:`\r
8
- `,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:Gi.TRADITIONAL,marginTop:50,marginBottom:50,marginRight:50,marginLeft:50,renderConfig:{zeroWidthParagraphBreak:Se.FALSE,vertexAngle:0,centerAngle:0,background:{rgb:"#ccc"}},autoHyphenation:Se.TRUE,doNotHyphenateCaps:Se.FALSE,consecutiveHyphenLimit:2,defaultHeaderId:"",defaultFooterId:"",evenPageHeaderId:"",evenPageFooterId:"",firstPageHeaderId:"",firstPageFooterId:"",evenAndOddHeaders:Se.FALSE,useFirstPageHeaderFooter:Se.FALSE,marginHeader:30,marginFooter:30},settings:{}}}var Kn={},Nr={},Mr={},la;function B_(){if(la)return Mr;la=1,Object.defineProperty(Mr,"__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 Mr.default=n,Mr}var Dr={},ua;function j_(){if(ua)return Dr;ua=1,Object.defineProperty(Dr,"__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 Dr.default=e,Dr}var Us={},ca;function Ku(){return ca||(ca=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(h,u){if(!h)throw new Error(u)}const n=h=>h!=null&&typeof h=="object"&&!Array.isArray(h),r=(h,u)=>typeof h==typeof u?h>u:typeof h=="string"&&typeof u=="number";function s(h,u){for(let d in h){const f=d;u.write(f,h[f])}}e.isValidPathItem=h=>typeof h=="number"||typeof h=="string"&&h!=="__proto__";class i{constructor(u=null){this.parents=[],this.indexes=[],this.lcIdx=-1,this.idx=-1,this.container=u}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 u=[];let d=this.container,f=this.parents.length-1,E=this.idx;for(;E>=0;)u.unshift(d[E]),E===0?(E=this.indexes[f*2],d=this.parents[f--]):E-=n(d[E-1])?2:1;return u}}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 u;return this.container&&this.container.length>this.idx+1&&n(u=this.container[this.idx+1])?u:null}descendFirst(){let u=this.idx+1;if(!this.container||u>=this.container.length||n(this.container[u])&&u+1>=this.container.length)return!1;n(this.container[u])&&u++;const d=this.container[u];return Array.isArray(d)?(this.indexes.push(this.idx),this.parents.push(this.container),this.indexes.push(u),this.idx=0,this.container=d):this.idx=u,!0}nextSibling(){if(t(this.parents.length===this.indexes.length/2),this.idx>0||this.parents.length===0)return!1;const u=this.indexes[this.indexes.length-1]+1,d=this.parents[this.parents.length-1];return u>=d.length?!1:(t(!isNaN(u)),this.indexes[this.indexes.length-1]=u,this.container=d[u],!0)}_init(u,d,f,E){this.container=u,this.idx=d,this.parents=f.slice(),this.indexes=E.slice()}clone(){const u=new o;return u._init(this.container,this.idx,this.parents,this.indexes),u}*[Symbol.iterator](){if(this.descendFirst()){do yield this.getKey();while(this.nextSibling());this.ascend()}}traverse(u,d){const f=this.getComponent();f&&d(f,u);for(const E of this)u&&u.descend(E),this.traverse(u,d),u&&u.ascend()}eachPick(u,d){this.traverse(u,(f,E)=>{f.p!=null&&d(f.p,E)})}eachDrop(u,d){this.traverse(u,(f,E)=>{f.d!=null&&d(f.d,E)})}}e.ReadCursor=o;class a extends i{constructor(u=null){super(u),this.pendingDescent=[],this._op=u}flushDescent(){t(this.parents.length===this.indexes.length/2),this.container===null&&(this._op=this.container=[]);for(let u=0;u<this.pendingDescent.length;u++){const d=this.pendingDescent[u];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 E=this.container.splice(f,this.container.length-f);this.container.push(E),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 E=[d];this.container.splice(f,0,E),this.container=E}}}this.pendingDescent.length=0}reset(){this.lcIdx=-1}getComponent(){this.flushDescent();const u=this.idx+1;if(u<this.container.length&&n(this.container[u]))return this.container[u];{const d={};return this.container.splice(u,0,d),d}}write(u,d){const f=this.getComponent();t(f[u]==null||f[u]===d,"Internal consistency error: Overwritten component. File a bug"),f[u]=d}get(){return this._op}descend(u){if(!e.isValidPathItem(u))throw Error("Invalid JSON key");this.pendingDescent.push(u)}descendPath(u){return this.pendingDescent.push(...u),this}ascend(){this.pendingDescent.length?this.pendingDescent.pop():super.ascend()}mergeTree(u,d=s){if(u===null)return;if(t(Array.isArray(u)),u===this._op)throw Error("Cannot merge into my own tree");const f=this.lcIdx,E=this.parents.length;let R=0;for(let O=0;O<u.length;O++){const T=u[O];typeof T=="string"||typeof T=="number"?(R++,this.descend(T)):Array.isArray(T)?this.mergeTree(T,d):typeof T=="object"&&d(T,this)}for(;R--;)this.ascend();this.lcIdx=this.parents.length===E?f:-1}at(u,d){this.descendPath(u),d(this);for(let f=0;f<u.length;f++)this.ascend();return this}writeAtPath(u,d,f){return this.at(u,()=>this.write(d,f)),this.reset(),this}writeMove(u,d,f=0){return this.writeAtPath(u,"p",f).writeAtPath(d,"d",f)}getPath(){const u=super.getPath();return u.push(...this.pendingDescent),u}}e.WriteCursor=a,e.writeCursor=()=>new a,e.readCursor=h=>new o(h);function l(h,u,d){let f,E;E=f=h?h.descendFirst():!1;function R(O){let T;for(;E;){const V=T=h.getKey();if(O!=null){let z=!1;if(u&&typeof V=="number"&&(T=u(V,h.getComponent()),T<0&&(T=~T,z=!0)),r(T,O))return null;if(T===O&&!z)return h}d&&typeof T=="number"&&d(T,h.getComponent()),E=h.nextSibling()}return null}return R.end=()=>{f&&h.ascend()},R}e.advancer=l;function c(h,u,d){let f,E,R,O;for(f=E=h&&h.descendFirst(),R=O=u&&u.descendFirst();f||R;){let T=f?h.getKey():null,V=R?u.getKey():null;T!==null&&V!==null&&(r(V,T)?V=null:T!==V&&(T=null)),d(T==null?V:T,T!=null?h:null,V!=null?u:null),T!=null&&f&&(f=h.nextSibling()),V!=null&&R&&(R=u.nextSibling())}E&&h.ascend(),O&&u.ascend()}e.eachChildOf=c}(Us)),Us}var Ps={},ha;function Xu(){return ha||(ha=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={}))}(Ps)),Ps}var hn={},dn={},da;function Xi(){return da||(da=1,Object.defineProperty(dn,"__esModule",{value:!0}),dn.uniToStrPos=dn.strPosToUni=void 0,dn.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},dn.uniToStrPos=(e,t)=>{let n=0;for(;t>0;t--){const r=e.charCodeAt(n);n+=r>=55296&&r<=57343?2:1}return n}),dn}var Fs={},fa;function hi(){return fa||(fa=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.uniSlice=e.dlen=e.eachOp=void 0;const t=Xi(),n=N=>{if(!Array.isArray(N))throw Error("Op must be an array of components");let A=null;for(let H=0;H<N.length;H++){const J=N[H];switch(typeof J){case"object":if(typeof J.d!="number"&&typeof J.d!="string")throw Error("Delete must be number or string");if(e.dlen(J.d)<=0)throw Error("Deletes must not be empty");break;case"string":if(!(J.length>0))throw Error("Inserts cannot be empty");break;case"number":if(!(J>0))throw Error("Skip components must be >0");if(typeof A=="number")throw Error("Adjacent skip components should be combined");break}A=J}if(typeof A=="number")throw Error("Op has a trailing skip")};function r(N,A){let H=0,J=0;for(let de=0;de<N.length;de++){const le=N[de];switch(A(le,H,J),typeof le){case"object":H+=e.dlen(le.d);break;case"string":J+=t.strPosToUni(le);break;case"number":H+=le,J+=le;break}}}e.eachOp=r;function s(N,A){const H=[],J=a(H);return r(N,(de,le,m)=>{J(A(de,le,m))}),u(H)}const i=N=>N,o=N=>s(N,i);e.dlen=N=>typeof N=="number"?N:t.strPosToUni(N);const a=N=>A=>{if(!(!A||A.d===0||A.d===""))if(N.length===0)N.push(A);else if(typeof A==typeof N[N.length-1])if(typeof A=="object"){const H=N[N.length-1];H.d=typeof H.d=="string"&&typeof A.d=="string"?H.d+A.d:e.dlen(H.d)+e.dlen(A.d)}else N[N.length-1]+=A;else N.push(A)},l=N=>typeof N=="number"?N:typeof N=="string"?t.strPosToUni(N):typeof N.d=="number"?N.d:t.strPosToUni(N.d);e.uniSlice=(N,A,H)=>{const J=t.uniToStrPos(N,A),de=H==null?1/0:t.uniToStrPos(N,H);return N.slice(J,de)};const c=(N,A,H)=>typeof N=="number"?H==null?N-A:Math.min(N,H)-A:e.uniSlice(N,A,H),h=N=>{let A=0,H=0;return{take:(le,m)=>{if(A===N.length)return le===-1?null:le;const j=N[A];let y;if(typeof j=="number")return le===-1||j-H<=le?(y=j-H,++A,H=0,y):(H+=le,le);if(typeof j=="string"){if(le===-1||m==="i"||t.strPosToUni(j.slice(H))<=le)return y=j.slice(H),++A,H=0,y;{const D=H+t.uniToStrPos(j.slice(H),le);return y=j.slice(H,D),H=D,y}}else{if(le===-1||m==="d"||e.dlen(j.d)-H<=le)return y={d:c(j.d,H)},++A,H=0,y;{let D=c(j.d,H,H+le);return H+=le,{d:D}}}},peek:()=>N[A]}},u=N=>(N.length>0&&typeof N[N.length-1]=="number"&&N.pop(),N);function d(N,A,H){if(H!=="left"&&H!=="right")throw Error("side ("+H+") must be 'left' or 'right'");n(N),n(A);const J=[],de=a(J),{take:le,peek:m}=h(N);for(let y=0;y<A.length;y++){const D=A[y];let b,S;switch(typeof D){case"number":for(b=D;b>0;)S=le(b,"i"),de(S),typeof S!="string"&&(b-=l(S));break;case"string":H==="left"&&typeof m()=="string"&&de(le(-1)),de(t.strPosToUni(D));break;case"object":for(b=e.dlen(D.d);b>0;)switch(S=le(b,"i"),typeof S){case"number":b-=S;break;case"string":de(S);break;case"object":b-=e.dlen(S.d)}break}}let j;for(;j=le(-1);)de(j);return u(J)}function f(N,A){n(N),n(A);const H=[],J=a(H),{take:de}=h(N);for(let m=0;m<A.length;m++){const j=A[m];let y,D;switch(typeof j){case"number":for(y=j;y>0;)D=de(y,"d"),J(D),typeof D!="object"&&(y-=l(D));break;case"string":J(j);break;case"object":y=e.dlen(j.d);let b=0;for(;b<y;)switch(D=de(y-b,"d"),typeof D){case"number":J({d:c(j.d,b,b+D)}),b+=D;break;case"string":b+=t.strPosToUni(D);break;case"object":J(D)}break}}let le;for(;le=de(-1);)J(le);return u(H)}const E=(N,A)=>{let H=0;for(let J=0;J<A.length&&N>H;J++){const de=A[J];switch(typeof de){case"number":{H+=de;break}case"string":const le=t.strPosToUni(de);H+=le,N+=le;break;case"object":N-=Math.min(e.dlen(de.d),N-H);break}}return N},R=(N,A)=>typeof N=="number"?E(N,A):N.map(H=>E(H,A));function O(N,A,H){return s(N,(J,de)=>typeof J=="object"&&typeof J.d=="number"?{d:H.slice(A,de,de+J.d)}:J)}function T(N){return s(N,A=>{switch(typeof A){case"object":if(typeof A.d=="number")throw Error("Cannot invert text op: Deleted characters missing from operation. makeInvertible must be called first.");return A.d;case"string":return{d:A};case"number":return A}})}function V(N){return s(N,A=>typeof A=="object"&&typeof A.d=="string"?{d:t.strPosToUni(A.d)}:A)}function z(N){let A=!0;return r(N,H=>{typeof H=="object"&&typeof H.d=="number"&&(A=!1)}),A}function oe(N){return{name:"text-unicode",uri:"http://sharejs.org/types/text-unicode",trim:u,normalize:o,checkOp:n,create(A=""){if(typeof A!="string")throw Error("Initial data must be a string");return N.create(A)},apply(A,H){n(H);const J=N.builder(A);for(let de=0;de<H.length;de++){const le=H[de];switch(typeof le){case"number":J.skip(le);break;case"string":J.append(le);break;case"object":J.del(e.dlen(le.d));break}}return J.build()},transform:d,compose:f,transformPosition:E,transformSelection:R,isInvertible:z,makeInvertible(A,H){return O(A,H,N)},stripInvertible:V,invert:T,invertWithDoc(A,H){return T(O(A,H,N))},isNoop:A=>A.length===0}}e.default=oe}(Fs)),Fs}var xr={},ga;function H_(){if(ga)return xr;ga=1,Object.defineProperty(xr,"__esModule",{value:!0});const e=hi(),t=Xi();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 xr.default=n,n.provides={text:!0},xr}var pa;function W_(){return pa||(pa=1,function(e){var t=hn.__createBinding||(Object.create?function(d,f,E,R){R===void 0&&(R=E),Object.defineProperty(d,R,{enumerable:!0,get:function(){return f[E]}})}:function(d,f,E,R){R===void 0&&(R=E),d[R]=f[E]}),n=hn.__setModuleDefault||(Object.create?function(d,f){Object.defineProperty(d,"default",{enumerable:!0,value:f})}:function(d,f){d.default=f}),r=hn.__importStar||function(d){if(d&&d.__esModule)return d;var f={};if(d!=null)for(var E in d)Object.hasOwnProperty.call(d,E)&&t(f,d,E);return n(f,d),f},s=hn.__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=Xi(),o=r(hi()),a=s(H_()),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(E){let R=i.uniToStrPos(d,E);if(R>d.length)throw Error("The op is too long for this document");f.push(d.slice(0,R)),d=d.slice(R)},append(E){f.push(E)},del(E){d=d.slice(i.uniToStrPos(d,E))},build(){return f.join("")+d}}},slice:o.uniSlice},c=o.default(l),h=Object.assign(Object.assign({},c),{api:a.default});e.type=h,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 u=hi();Object.defineProperty(e,"makeType",{enumerable:!0,get:function(){return u.default}})}(hn)),hn}var ma;function z_(){return ma||(ma=1,function(e){var t=Nr.__importDefault||function(v){return v&&v.__esModule?v:{default:v}};Object.defineProperty(e,"__esModule",{value:!0}),e.editOp=e.replaceOp=e.insertOp=e.moveOp=e.removeOp=e.type=void 0;const n=t(B_()),r=t(j_()),s=Ku(),i=Xu();function o(v,k){if(!v)throw new Error(k)}e.type={name:"json1",uri:"http://sharejs.org/types/JSONv1",readCursor:s.readCursor,writeCursor:s.writeCursor,create:v=>v,isNoop:v=>v==null,setDebug(v){},registerSubtype:T,checkValidOp:de,normalize:le,apply:m,transformPosition:j,compose:y,tryTransform:G,transform:he,makeInvertible:S,invert:D,invertWithDoc:F,RM_UNEXPECTED_CONTENT:i.ConflictType.RM_UNEXPECTED_CONTENT,DROP_COLLISION:i.ConflictType.DROP_COLLISION,BLACKHOLE:i.ConflictType.BLACKHOLE,transformNoConflict:(v,k,K)=>we(()=>!0,v,k,K),typeAllowingConflictsPred:v=>Object.assign(Object.assign({},e.type),{transform:(k,K,Q)=>we(v,k,K,Q)})};const a=v=>v?v.getComponent():null;function l(v){return v&&typeof v=="object"&&!Array.isArray(v)}const c=v=>Array.isArray(v)?v.slice():v!==null&&typeof v=="object"?Object.assign({},v):v,h=v=>v&&(v.p!=null||v.r!==void 0),u=v=>v&&(v.d!=null||v.i!==void 0);function d(v,k){return o(v!=null),typeof k=="number"?(o(Array.isArray(v),"Invalid key - child is not an array"),(v=v.slice()).splice(k,1)):(o(l(v),"Invalid key - child is not an object"),delete(v=Object.assign({},v))[k]),v}function f(v,k,K){return typeof k=="number"?(o(v!=null,"Container is missing for key"),o(Array.isArray(v),"Cannot use numerical key for object container"),o(v.length>=k,"Cannot insert into out of bounds index"),v.splice(k,0,K)):(o(l(v),"Cannot insert into missing item"),o(v[k]===void 0,"Trying to overwrite value at key. Your op needs to remove it first"),v[k]=K),K}e.removeOp=(v,k=!0)=>s.writeCursor().writeAtPath(v,"r",k).get(),e.moveOp=(v,k)=>s.writeCursor().writeMove(v,k).get(),e.insertOp=(v,k)=>s.writeCursor().writeAtPath(v,"i",k).get(),e.replaceOp=(v,k,K)=>s.writeCursor().at(v,Q=>{Q.write("r",k),Q.write("i",K)}).get(),e.editOp=(v,k,K,Q=!1)=>s.writeCursor().at(v,Y=>A(Y,k,K,Q)).get();const E=(v,k)=>v!=null&&(typeof k=="number"?Array.isArray(v):typeof v=="object"),R=(v,k)=>E(v,k)?v[k]:void 0,O={};function T(v){let k=v.type?v.type:v;k.name&&(O[k.name]=k),k.uri&&(O[k.uri]=k)}const V=v=>{const k=O[v];if(k)return k;throw Error("Missing type: "+v)};T(W_());const z=(v,k)=>v+k;T({name:"number",apply:z,compose:z,invert:v=>-v,transform:v=>v});const oe=v=>v==null?null:v.et?V(v.et):v.es?O["text-unicode"]:v.ena!=null?O.number:null,N=v=>v.es?v.es:v.ena!=null?v.ena:v.e,A=(v,k,K,Q=!1)=>{const[Y,W]=typeof k=="string"?[V(k),k]:[k,k.name];!Q&&Y.isNoop&&Y.isNoop(K)||(W==="number"?v.write("ena",K):W==="text-unicode"?v.write("es",K):(v.write("et",W),v.write("e",K)))};function H(v){o(typeof v=="number"),o(v>=0),o(v===(0|v))}function J(v){typeof v=="number"?H(v):o(typeof v=="string")}function de(v){if(v===null)return;const k=new Set,K=new Set,Q=W=>{let ue=!0,ae=!1;for(let B in W){const te=W[B];if(ue=!1,o(B==="p"||B==="r"||B==="d"||B==="i"||B==="e"||B==="es"||B==="ena"||B==="et","Invalid component item '"+B+"'"),B==="p")H(te),o(!k.has(te)),k.add(te),o(W.r===void 0);else if(B==="d")H(te),o(!K.has(te)),K.add(te),o(W.i===void 0);else if(B==="e"||B==="es"||B==="ena"){o(!ae),ae=!0;const ie=oe(W);o(ie,"Missing type in edit"),ie.checkValidOp&&ie.checkValidOp(N(W))}}o(!ue)},Y=(W,ue,ae)=>{if(!Array.isArray(W))throw Error("Op must be null or a list");if(W.length===0)throw Error("Empty descent");ue||J(W[0]);let B=1,te=0,ie=0;for(let pe=0;pe<W.length;pe++){const be=W[pe];if(o(be!=null),Array.isArray(be)){const De=Y(be,!1);if(te){const X=typeof ie,Re=typeof De;X===Re?o(ie<De,"descent keys are not in order"):o(X==="number"&&Re==="string")}ie=De,te++,B=3}else typeof be=="object"?(o(B===1,`Prev not scalar - instead ${B}`),Q(be),B=2):(o(B!==3),J(be),o(s.isValidPathItem(be),"Invalid path key"),B=1)}return o(te!==1,"Operation makes multiple descents. Remove some []"),o(B===2||B===3),W[0]};Y(v,!0),o(k.size===K.size,"Mismatched picks and drops in op");for(let W=0;W<k.size;W++)o(k.has(W)),o(K.has(W))}function le(v){let k=0,K=[];const Q=s.writeCursor();return Q.mergeTree(v,(Y,W)=>{const ue=oe(Y);if(ue){const B=N(Y);A(W,ue,ue.normalize?ue.normalize(B):B)}for(const B of["r","p","i","d"])if(Y[B]!==void 0){const te=B==="p"||B==="d"?(ae=Y[B],K[ae]==null&&(K[ae]=k++),K[ae]):Y[B];W.write(B,te)}var ae}),Q.get()}function m(v,k){if(de(k),k===null)return v;const K=[];return function Q(Y,W){let ue=Y,ae=0,B={root:Y},te=0,ie=B,pe="root";function be(){for(;te<ae;te++){let De=W[te];typeof De!="object"&&(o(E(ie,pe)),ie=ie[pe]=c(ie[pe]),pe=De)}}for(;ae<W.length;ae++){const De=W[ae];if(Array.isArray(De)){const X=Q(ue,De);X!==ue&&X!==void 0&&(be(),ue=ie[pe]=X)}else if(typeof De=="object"){De.d!=null?(be(),ue=f(ie,pe,K[De.d])):De.i!==void 0&&(be(),ue=f(ie,pe,De.i));const X=oe(De);if(X)be(),ue=ie[pe]=X.apply(ue,N(De));else if(De.e!==void 0)throw Error("Subtype "+De.et+" undefined")}else ue=R(ue,De)}return B.root}(v=function Q(Y,W){const ue=[];let ae=0;for(;ae<W.length;ae++){const pe=W[ae];if(Array.isArray(pe))break;typeof pe!="object"&&(ue.push(Y),Y=R(Y,pe))}for(let pe=W.length-1;pe>=ae;pe--)Y=Q(Y,W[pe]);for(--ae;ae>=0;ae--){const pe=W[ae];if(typeof pe!="object"){const be=ue.pop();Y=Y===R(be,pe)?be:Y===void 0?d(be,pe):(te=pe,ie=Y,(B=c(B=be))[te]=ie,B)}else h(pe)&&(o(Y!==void 0,"Cannot pick up or remove undefined"),pe.p!=null&&(K[pe.p]=Y),Y=void 0)}var B,te,ie;return Y}(v,k),k)}function j(v,k){v=v.slice(),de(k);const K=s.readCursor(k);let Q,Y,W=!1;const ue=[];for(let B=0;;B++){const te=v[B],ie=K.getComponent();if(ie&&(ie.r!==void 0?W=!0:ie.p!=null&&(W=!1,Q=ie.p,Y=B)),B>=v.length)break;let pe=0;const be=s.advancer(K,void 0,(X,Re)=>{h(Re)&&pe++});ue.unshift(be);const De=be(te);if(typeof te=="number"&&(v[B]-=pe),!De)break}if(ue.forEach(B=>B.end()),W)return null;const ae=()=>{let B=0;if(Q!=null){const te=K.getPath();B=te.length,v=te.concat(v.slice(Y))}for(;B<v.length;B++){const te=v[B],ie=a(K),pe=oe(ie);if(pe){const X=N(ie);pe.transformPosition&&(v[B]=pe.transformPosition(v[B],X));break}let be=0;const De=s.advancer(K,(X,Re)=>u(Re)?~(X-be):X-be,(X,Re)=>{u(Re)&&be++})(te);if(typeof te=="number"&&(v[B]+=be),!De)break}};return Q!=null?K.eachDrop(null,B=>{B===Q&&ae()}):ae(),v}function y(v,k){if(de(v),de(k),v==null)return k;if(k==null)return v;let K=0;const Q=s.readCursor(v),Y=s.readCursor(k),W=s.writeCursor(),ue=[],ae=[],B=[],te=[],ie=[],pe=[],be=new Set;Q.traverse(null,X=>{X.p!=null&&(B[X.p]=Q.clone())}),Y.traverse(null,X=>{X.d!=null&&(te[X.d]=Y.clone())});const De=s.writeCursor();return function X(Re,ze,je,Le,qe,Rt,Ye,et){o(ze||je);const Ve=a(ze),ht=a(je),at=!!ht&&ht.r!==void 0,Ft=!!Ve&&Ve.i!==void 0,ke=Ve?Ve.d:null,dt=ht?ht.p:null,_=(Rt||at)&&dt==null;if(dt!=null)Le=te[dt],Ye=ae[dt]=new s.WriteCursor;else if(ht&&ht.r!==void 0)Le=null;else{const x=a(Le);x&&x.d!=null&&(Le=null)}const g=a(Le);if(ke!=null)if(Re=B[ke],et=ue[ke]=new s.WriteCursor,_)Rt&&!at&&et.write("r",!0);else{const x=ie[ke]=K++;Ye.write("d",x)}else if(Ve&&Ve.i!==void 0)Re=null;else{const x=a(Re);x&&x.p!=null&&(Re=null)}let p;Ft?(o(qe===void 0),p=Ve.i):p=qe;const w=(dt==null?!Ft||Rt||at:p===void 0)?null:Ye.getComponent();if(dt!=null){if(!(qe!==void 0||Ft)){const x=ke!=null?ie[ke]:K++;pe[dt]=x,et.write("p",x)}}else at&&(Ft||qe!==void 0||(ht.r,et.write("r",ht.r)));const M=_?null:oe(Ve),U=oe(g);if((M||U)&&(M&&M.name,U&&U.name),M&&U){o(M===U);const x=N(Ve),ee=N(g),Ce=M.compose(x,ee);A(Ye,M,Ce),be.add(g)}else M?A(Ye,M,N(Ve)):U&&(A(Ye,U,N(g)),be.add(g));const L=typeof p=="object"&&p!=null;let P=!1,I=0,Z=0,_e=0,q=0,me=0;const ye=s.advancer(Le,(x,ee)=>u(ee)?q-x-1:x-q,(x,ee)=>{u(ee)&&q++}),ce=s.advancer(Re,(x,ee)=>h(ee)?I-x-1:x-I,(x,ee)=>{h(ee)&&I++});if(s.eachChildOf(ze,je,(x,ee,Ce)=>{let Ae,Ue,Fe=x,He=x,ft=x;if(typeof x=="number"){let Me=x+_e;Ue=ye(Me),He=Me+q;let ne=x+Z;Ae=ce(ne),u(a(Ue))&&(Ae=null),Fe=ne+I,ft=x+me,o(Fe>=0,"p1PickKey is negative"),o(He>=0,"p2DropKey is negative");const ut=u(a(ee)),Be=h(a(Ce));(ut||Be&&!_)&&me--,ut&&Z--,Be&&_e--}else Ae=ce(x),Ue=ye(x);et.descend(Fe),Ye.descend(He);const pt=L&&!u(a(ee))?p[ft]:void 0,Ee=X(Ae,ee,Ce,Ue,pt,_,Ye,et);var Ze,ve,Ie;L&&!_?pt!==Ee&&(P||(p=Array.isArray(p)?p.slice():Object.assign({},p),P=!0),Ze=p,Ie=Ee,typeof(ve=ft)=="number"?(o(Array.isArray(Ze)),o(ve<Ze.length)):(o(!Array.isArray(Ze)),o(Ze[ve]!==void 0)),Ie===void 0?typeof ve=="number"?Ze.splice(ve,1):delete Ze[ve]:Ze[ve]=Ie):o(Ee===void 0),Ye.ascend(),et.ascend()}),ce.end(),ye.end(),w!=null)w.i=p;else if(!Rt&&!at&&dt==null)return p}(Q,Q.clone(),Y,Y.clone(),void 0,!1,W,De),W.reset(),W.mergeTree(De.get()),W.reset(),W.get(),ue.map(X=>X.get()),ae.map(X=>X.get()),Q.traverse(W,(X,Re)=>{const ze=X.p;if(ze!=null){const je=ie[ze];je!=null&&Re.write("p",je);const Le=ue[ze];Le&&Le.get(),Le&&Re.mergeTree(Le.get())}else X.r!==void 0&&Re.write("r",X.r)}),W.reset(),W.get(),Y.traverse(W,(X,Re)=>{const ze=X.d;if(ze!=null){const Le=pe[ze];Le!=null&&Re.write("d",Le);const qe=ae[ze];qe&&Re.mergeTree(qe.get())}else X.i!==void 0&&Re.write("i",X.i);const je=oe(X);je&&!be.has(X)&&A(Re,je,N(X))}),W.get()}function D(v){if(v==null)return null;const k=new s.ReadCursor(v),K=new s.WriteCursor;let Q;const Y=[],W=[];return function ue(ae,B,te){const ie=ae.getComponent();let pe,be=!1;if(ie){ie.p!=null&&(B.write("d",ie.p),Y[ie.p]=ae.clone()),ie.r!==void 0&&B.write("i",ie.r),ie.d!=null&&(B.write("p",ie.d),te=void 0),ie.i!==void 0&&(te=pe=ie.i);const X=oe(ie);X&&(te===void 0?(Q||(Q=new Set),Q.add(ie)):(N(ie),te=X.apply(te,N(ie)),be=!0))}let De=0;for(const X of ae){B.descend(X);const Re=typeof X=="number"?X-De:X,ze=R(te,Re);u(ae.getComponent())&&De++;const je=ue(ae,B,ze);if(te!==void 0&&je!==void 0){if(be||(be=!0,te=c(te)),!E(te,Re))throw Error("Cannot modify child - invalid operation");te[Re]=je}B.ascend()}if(pe===void 0)return be?te:void 0;B.write("r",te)}(k,K,void 0),Q&&(K.reset(),function ue(ae,B,te){const ie=B.getComponent();if(ie){const X=ie.d;if(X!=null&&(ae=Y[X],te=W[X]=s.writeCursor()),Q.has(ie)){const Re=oe(ie);if(!Re.invert)throw Error(`Cannot invert subtype ${Re.name}`);A(te,Re,Re.invert(N(ie)))}}let pe=0,be=0;const De=s.advancer(ae,(X,Re)=>h(Re)?pe-X-1:X-pe,(X,Re)=>{h(Re)&&pe++});for(const X of B)if(typeof X=="number"){const Re=X-be,ze=De(Re),je=Re+pe;te.descend(je),ue(ze,B,te),u(B.getComponent())&&be++,te.ascend()}else te.descend(X),ue(De(X),B,te),te.ascend();De.end()}(k.clone(),k,K),W.length&&(K.reset(),k.traverse(K,(ue,ae)=>{const B=ue.p;if(B!=null){const te=W[B];te&&te.get(),te&&ae.mergeTree(te.get())}}))),K.get()}const b=(v,k)=>v.some(K=>typeof K=="object"&&(Array.isArray(K)?b(K,k):k(K)));function S(v,k){if(v==null||!b(v,B=>{var te;return B.r!==void 0||((te=oe(B))===null||te===void 0?void 0:te.makeInvertible)!=null}))return v;const K=new s.ReadCursor(v),Q=new s.WriteCursor;let Y=!1;const W=[],ue=[],ae=(B,te,ie)=>{const pe=B.getComponent();let be=!1;if(pe){pe.d!=null&&te.write("d",pe.d),pe.i!==void 0&&te.write("i",pe.i);const X=pe.p;if(X!=null&&(W[X]=B.clone(),o(ie!==void 0,"Operation picks up at an invalid key"),ue[X]=ie,te.write("p",pe.p)),pe.r!==void 0&&ie===void 0)throw Error("Invalid doc / op in makeInvertible: removed item missing from doc");const Re=oe(pe);Re&&(Re.makeInvertible?Y=!0:A(te,Re,N(pe),!0))}let De=0;for(const X of B){te.descend(X);const Re=typeof X=="number"?X-De:X,ze=R(ie,Re),je=ae(B,te,ze);ze!==je&&(be||(be=!0,ie=c(ie)),je===void 0?(ie=d(ie,Re),typeof X=="number"&&De++):ie[Re]=je),te.ascend()}return pe&&(pe.r!==void 0?(te.write("r",r.default(ie)),ie=void 0):pe.p!=null&&(ie=void 0)),ie};return ae(K,Q,k),Q.get(),Y&&(Q.reset(),function B(te,ie,pe,be,De){const X=ie.getComponent();if(X){X.i!==void 0?(be=X.i,De=!0):X.d!=null&&(be=ue[X.d],te=W[X.d],De=!1,X.d);let Le=oe(X);if(Le&&Le.makeInvertible){const qe=N(X);A(pe,Le,Le.makeInvertible(qe,be),!0)}}let Re=0,ze=0;const je=s.advancer(te,(Le,qe)=>h(qe)?Re-Le-1:Le-Re,(Le,qe)=>{h(qe)&&Re++});for(const Le of ie)if(typeof Le=="number"){const qe=Le-ze,Rt=je(qe),Ye=qe+Re,et=R(be,De?qe:Ye);pe.descend(Le),B(Rt,ie,pe,et,De),u(ie.getComponent())&&ze++,pe.ascend()}else{const qe=R(be,Le);pe.descend(Le),B(je(Le),ie,pe,qe,De),pe.ascend()}je.end()}(K.clone(),K,Q,k,!1)),Q.get()}function F(v,k){return D(S(v,k))}const $=v=>{if(v==null)return null;const k=v.slice();for(let K=0;K<v.length;K++){const Q=k[K];Array.isArray(Q)&&(k[K]=$(Q))}return k};function G(v,k,K){o(K==="left"||K==="right","Direction must be left or right");const Q=K==="left"?0:1;if(k==null)return{ok:!0,result:v};de(v),de(k);let Y=null;const W=[],ue=[],ae=[],B=[],te=[],ie=[],pe=[],be=[],De=[],X=[],Re=[],ze=[],je=[],Le=[],qe=[];let Rt=0;const Ye=s.readCursor(v),et=s.readCursor(k),Ve=s.writeCursor();if(function g(p,w=null,M){const U=a(w);U&&(U.r!==void 0?M=w.clone():U.p!=null&&(M=null,ie[U.p]=p.clone()));const L=p.getComponent();let P;L&&(P=L.p)!=null&&(te[P]=w?w.clone():null,ae[P]=p.clone(),M&&(X[P]=!0,De[P]=M),U&&U.p!=null&&(Le[P]=U.p));const I=s.advancer(w);for(const Z of p)g(p,I(Z),M);I.end()}(et,Ye,null),function g(p,w,M,U,L){const P=M.getComponent();let I,Z=!1;P&&((I=P.d)!=null?(B[I]=M.clone(),U!=null&&(qe[U]==null&&(qe[U]=[]),qe[U].push(I)),X[I],p=te[I]||null,w=ae[I]||null,X[I]?(L&&(Re[I]=!0),L=De[I]||null):!L||Q!==1&&Le[I]!=null||Y==null&&(Y={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:e.removeOp(L.getPath()),op2:e.moveOp(w.getPath(),M.getPath())}),Z=!0):P.i!==void 0&&(p=w=null,Z=!0,L&&Y==null&&(Y={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:e.removeOp(L.getPath()),op2:e.insertOp(M.getPath(),P.i)})));const _e=a(p);_e&&(_e.r!==void 0?L=p.clone():_e.p!=null&&(_e.p,U=_e.p,L=null));const q=oe(P);q&&L&&Y==null&&(Y={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:e.removeOp(L.getPath()),op2:e.editOp(M.getPath(),q,N(P),!0)});let me=0,ye=0;const ce=s.advancer(w,(ee,Ce)=>h(Ce)?me-ee-1:ee-me,(ee,Ce)=>{h(Ce)&&me++}),x=s.advancer(p);for(const ee of M)if(typeof ee=="number"){const Ce=ee-ye,Ae=ce(Ce);ye+=+g(x(Ce+me),Ae,M,U,L)}else{const Ce=ce(ee);g(x(ee),Ce,M,U,L)}return ce.end(),x.end(),Z}(Ye,et,et.clone(),null,null),B.map(g=>g&&g.get()),Y)return{ok:!1,conflict:Y};Re.map(g=>!!g);const ht=[];let at=null;(function g(p,w,M,U,L){let P=!1;const I=a(w);if(h(I)){const ce=I.p;ce!=null?(M=B[ce],U=ze[ce]=s.writeCursor(),P=!0,L=null):(M=null,L=w.clone())}else u(a(M))&&(M=null);const Z=p.getComponent();if(Z){const ce=Z.p;ce!=null?(L&&(be[ce]=L),ht[ce]=L||Q===1&&P?null:U.getComponent(),W[ce]=p.clone(),M&&(pe[ce]=M.clone())):Z.r!==void 0&&(L||U.write("r",!0),(L||P)&&(at==null&&(at=new Set),at.add(Z)))}let _e=0,q=0;const me=s.advancer(w,void 0,(ce,x)=>{h(x)&&_e++}),ye=s.advancer(M,(ce,x)=>u(x)?~(ce-q):ce-q,(ce,x)=>{u(x)&&q++});if(p)for(const ce of p)if(typeof ce=="string"){const x=me(ce),ee=ye(ce);U.descend(ce),g(p,x,ee,U,L),U.ascend()}else{const x=me(ce),ee=ce-_e,Ce=h(a(x))?null:ye(ee),Ae=ee+q;o(Ae>=0),U.descend(Ae),g(p,x,Ce,U,L),U.ascend()}me.end(),ye.end()})(Ye,et,et.clone(),Ve,null),Ve.reset();let Ft=[];if(function g(p,w,M,U,L,P){o(w);const I=w.getComponent();let Z=a(U),_e=!1;const q=(ve,Ie,Me)=>ve?e.moveOp(ve.getPath(),Ie.getPath()):e.insertOp(Ie.getPath(),Me.i);if(u(I)){const ve=I.d;ve!=null&&(ue[ve]=w.clone());const Ie=ve!=null?ht[ve]:null;let Me=!1;if(I.i!==void 0||ve!=null&&Ie){let ne;Z&&(Z.i!==void 0||(ne=Z.d)!=null&&!X[ne])&&(Me=ne!=null?ve!=null&&ve===Le[ne]:n.default(Z.i,I.i),Me||ne!=null&&Q!==1&&Le[ne]!=null||Y==null&&(Y={type:i.ConflictType.DROP_COLLISION,op1:q(ve!=null?W[ve]:null,w,I),op2:q(ne!=null?ae[ne]:null,U,Z)})),Me||(P?Y==null&&(Y={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:q(ve!=null?W[ve]:null,w,I),op2:e.removeOp(P.getPath())}):(ve!=null?(Ft[Rt]=ve,L.write("d",Ie.p=Rt++)):L.write("i",r.default(I.i)),_e=!0))}else if(ve!=null&&!Ie){const ne=be[ve];ne&&(P=ne.clone())}ve!=null?(p=W[ve],M=ie[ve],U=pe[ve]):I.i!==void 0&&(p=M=null,Me||(U=null))}else h(a(p))&&(p=M=U=null);const me=a(p),ye=a(M);if(h(ye)){const ve=ye.p;ye.r!==void 0&&(!me||me.r===void 0)||X[ve]?(U=null,P=M.clone()):ve!=null&&(U=B[ve],Q!==1&&Le[ve]!=null||((L=je[ve])||(L=je[ve]=s.writeCursor()),L.reset(),P=null))}else!u(I)&&u(Z)&&(U=null);Z=U!=null?U.getComponent():null;const ce=oe(I);if(ce){const ve=N(I);if(P)Y==null&&(Y={type:i.ConflictType.RM_UNEXPECTED_CONTENT,op1:e.editOp(w.getPath(),ce,ve,!0),op2:e.removeOp(P.getPath())});else{const Ie=oe(Z);let Me;if(Ie){if(ce!==Ie)throw Error("Transforming incompatible types");const ne=N(Z);Me=ce.transform(ve,ne,K)}else Me=r.default(ve);A(L,ce,Me)}}let x=0,ee=0,Ce=0,Ae=0,Ue=0,Fe=0,He=p!=null&&p.descendFirst(),ft=He;const pt=s.advancer(M,void 0,(ve,Ie)=>{h(Ie)&&Ce++});let Ee=U!=null&&U.descendFirst(),Ze=Ee;for(const ve of w)if(typeof ve=="number"){let Ie;const Me=u(w.getComponent()),ne=ve-ee;{let Xt;for(;He&&typeof(Xt=p.getKey())=="number";){Xt+=x;const Ot=p.getComponent(),Rn=h(Ot);if(Xt>ne||Xt===ne&&(!Rn||Q===0&&Me))break;if(Rn){x--;const un=Ot.p;Le.includes(un),Ot.d,a(je[Ot.d]),h(a(je[Ot.d])),(Ot.r===void 0||at&&at.has(Ot))&&(un==null||!ht[un]||Q!==1&&Le.includes(un))||Ue--}He=p.nextSibling()}Ie=He&&Xt===ne?p:null}const ut=ne-x;let Be=pt(ut);const Tt=ut-Ce;let Sr=null;{let Xt,Ot;for(;Ee&&typeof(Xt=U.getKey())=="number";){Ot=Xt-Ae;const Rn=U.getComponent(),un=u(Rn);if(Ot>Tt)break;if(Ot===Tt){if(!un){Sr=U;break}{if(Q===0&&Me){Sr=U;break}const Qt=Be&&h(Be.getComponent());if(Q===0&&Qt)break}}if(un){const Qt=Rn.d;X[Qt],Le[Qt],Rn.i===void 0&&(X[Qt]||Le[Qt]!=null&&Q!==1)?(X[Qt]||Le[Qt]!=null&&Q===0)&&(Ae++,Fe--):Ae++}Ee=U.nextSibling()}}const ho=Tt+Ae+Ue+Fe;o(ho>=0,"trying to descend to a negative index"),L.descend(ho),Me&&(Ie=Be=Sr=null,ee++),g(Ie,w,Be,Sr,L,P)&&Fe++,L.ascend()}else{let Ie;for(;He&&(Ie=p.getKey(),typeof Ie!="string"||!(Ie>ve||Ie===ve));)He=p.nextSibling();const Me=He&&Ie===ve?p:null,ne=pt(ve);let ut;for(;Ee&&(ut=U.getKey(),typeof ut!="string"||!(ut>ve||ut===ve));)Ee=U.nextSibling();const Be=Ee&&ut===ve?U:null;L.descend(ve),g(Me,w,ne,Be,L,P),L.ascend()}return pt.end(),ft&&p.ascend(),Ze&&U.ascend(),_e}(Ye,Ye.clone(),et,et.clone(),Ve,null),Y)return{ok:!1,conflict:Y};Ve.reset();const ke=(g,p,w)=>g.traverse(p,(M,U)=>{M.d!=null&&w(M.d,g,U)});(X.length||ze.length)&&(ke(et,Ve,(g,p,w)=>{X[g]&&!Re[g]&&w.write("r",!0),ze[g]&&w.mergeTree(ze[g].get())}),Ve.reset());const dt=[],_=[];if((je.length||X.length)&&!Y){const g=s.readCursor($(Ve.get()));if(ke(g,null,(p,w)=>{dt[p]=w.clone()}),je.forEach(p=>{p&&ke(s.readCursor(p.get()),null,(w,M)=>{dt[w]=M.clone()})}),function p(w,M,U,L,P,I){const Z=a(M);if(Z&&h(Z))if(Z.p!=null){const x=Z.p;dt[x].getPath(),U=dt[x],L=_[x]=s.writeCursor()}else Z.r!==void 0&&(U=null);else u(a(U))&&(U=null);const _e=w.getComponent();if(_e){let x;if((x=_e.d)!=null){const ee=je[x];ee&&(ee.get(),L.mergeTree(ee.get()),U=s.readCursor(ee.get()))}}let q=0,me=0;const ye=s.advancer(M,void 0,(x,ee)=>{h(ee)&&q--}),ce=s.advancer(U,(x,ee)=>u(ee)?-(x-me)-1:x-me,(x,ee)=>{u(ee)&&me++});for(const x of w)if(typeof x=="number"){const ee=ye(x),Ce=x+q,Ae=ce(Ce),Ue=Ce+me;L.descend(Ue),p(w,ee,Ae,L),L.ascend()}else L.descend(x),p(w,ye(x),ce(x),L),L.ascend();ye.end(),ce.end()}(et,g,g.clone(),Ve),Ve.reset(),Y)return{ok:!1,conflict:Y};if(Ve.get(),_.length){const p=_.map(M=>M?M.get():null),w=s.readCursor($(Ve.get()));if(ke(w,Ve,(M,U,L)=>{const P=p[M];P&&(L.mergeTree(P),p[M]=null)}),p.find(M=>M)){const M=s.writeCursor(),U=s.writeCursor();let L=0,P=0;p.forEach(I=>{I!=null&&ke(s.readCursor(I),null,Z=>{const _e=Ft[Z];M.writeMove(W[_e].getPath(),ue[_e].getPath(),L++);const q=qe[_e];q&&q.forEach(me=>{X[me]||Q!==1&&Le[me]!=null||U.writeMove(ae[me].getPath(),B[me].getPath(),P++)})})}),Y={type:i.ConflictType.BLACKHOLE,op1:M.get(),op2:U.get()}}}}return Y?{ok:!1,conflict:Y}:{ok:!0,result:Ve.get()}}const se=v=>{const k=new Error("Transform detected write conflict");throw k.conflict=v,k.type=k.name="writeConflict",k};function he(v,k,K){const Q=G(v,k,K);if(Q.ok)return Q.result;se(Q.conflict)}const ge=v=>{const k=s.writeCursor();return s.readCursor(v).traverse(k,(K,Q)=>{(u(K)||oe(K))&&Q.write("r",!0)}),k.get()},Te=(v,k)=>{const{type:K,op1:Q,op2:Y}=v;switch(K){case i.ConflictType.DROP_COLLISION:return k==="left"?[null,ge(Y)]:[ge(Q),null];case i.ConflictType.RM_UNEXPECTED_CONTENT:let W=!1;return s.readCursor(Q).traverse(null,ue=>{ue.r!==void 0&&(W=!0)}),W?[null,ge(Y)]:[ge(Q),null];case i.ConflictType.BLACKHOLE:return[ge(Q),ge(Y)];default:throw Error("Unrecognised conflict: "+K)}};function we(v,k,K,Q){let Y=null;for(;;){const W=G(k,K,Q);if(W.ok)return y(Y,W.result);{const{conflict:ue}=W;v(ue)||se(ue);const[ae,B]=Te(ue,Q);k=y(le(k),ae),K=y(le(K),B),Y=y(Y,B)}}}}(Nr)),Nr}var _a;function Y_(){return _a||(_a=1,function(e){var t=Kn.__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=Kn.__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(z_(),e);var r=Ku();Object.defineProperty(e,"ReadCursor",{enumerable:!0,get:function(){return r.ReadCursor}}),Object.defineProperty(e,"WriteCursor",{enumerable:!0,get:function(){return r.WriteCursor}});var s=Xu();Object.defineProperty(e,"ConflictType",{enumerable:!0,get:function(){return s.ConflictType}})}(Kn)),Kn}var mt=Y_();const V_=St(mt),G_=oh({__proto__:null,default:V_},[mt]);var fe=(e=>(e.RETAIN="r",e.INSERT="i",e.DELETE="d",e))(fe||{});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&&re.isEmptyObject(o)&&r.sId==null)continue;if(n.length===0){n.push(r);continue}const a=n.pop();lu(r,a)&&re.hasIntersectionBetweenTwoRanges(a.st,a.ed,r.st,r.ed)?n.push({...r,st:a.st,ed:i}):n.push(a,r)}return n}function Qu(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 h of l)h.st+=r,h.ed+=r;for(let h=0;h<o;h++){const u=s[h],{st:d,ed:f}=u;if(f<=r)i.push(u);else if(r>d&&r<f){a=!0;const E={...u,ed:r};i.push(E),l.length&&i.push(...l);const R={...u,st:r+n,ed:f+n};i.push(R)}else u.st+=n,u.ed+=n,a||(a=!0,i.push(...l)),i.push(u)}a||(a=!0,i.push(...l)),e.textRuns=vr(i)}function qu(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 h=s[l],{startIndex:u}=h;u>=r&&(h.startIndex+=n),o.push(h.startIndex)}let a=-1;if(i){for(let l=0,c=i.length;l<c;l++){const h=i[l];h.startIndex+=r;const u=h.startIndex;a=o.indexOf(u)}a!==-1&&s.splice(a,1),s.push(...i),s.sort(Rr("startIndex"))}}function Ju(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(Rr("startIndex"))}}function Zu(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(Rr("startIndex"))}s.length&&!e.customBlocks&&(e.customBlocks=s)}function ec(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:h}=l;c>r?(l.startIndex+=n,l.endIndex+=n):h>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(Rr("startIndex"))}}const tc="$",Ea=e=>e.split(tc)[0];function Qi(e){if(e.length<=1)return e;e.sort((s,i)=>s.startIndex-i.startIndex);const t=[];let n={...e[0]};n.rangeId=Ea(n.rangeId);for(let s=1;s<e.length;s++){const i=e[s];i.rangeId=Ea(i.rangeId),i.rangeId===n.rangeId&&vl(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}${tc}${r[a]}`,r[a]=r[a]+1):r[a]=1}return t}function di(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 nc(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 fi(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 K_(e,t,n,r){e.customRanges||(e.customRanges=[]);const{customRanges:s}=e;di(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=Qi(s)}function X_(e,t,n,r){e.customDecorations||(e.customDecorations=[]);const{customDecorations:s}=e;fi(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=nc(s)}function rc(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 h=r[l],{st:u,ed:d}=h;if(s<=u&&i>=d){o.push({...h,st:u-s,ed:d-s});continue}else u<=s&&d>=i?(o.push({...h,st:s-s,ed:i-s}),h.ed-=t):s>=u&&s<d?(o.push({...h,st:s-s,ed:d-s}),h.ed=s):i>u&&i<=d?(o.push({...h,st:u-s,ed:i-s}),h.st=i-t,h.ed-=t):u>=i&&(h.st-=t,h.ed-=t);a.push(h)}e.textRuns=a}return o.length===0&&o.push({st:0,ed:t,ts:{}}),o}function sc(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 h=r[l],{startIndex:u}=h;if(u>=s&&u<i){o.push({...h,startIndex:u-n});continue}else u>=i&&(h.startIndex-=t);a.push(h)}e.paragraphs=a}return o}function ic(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 h=r[l],{startIndex:u}=h;if(u>=s&&u<=i){o.push({...h,startIndex:u-n});continue}else u>i&&(h.startIndex-=t);a.push(h)}e.sectionBreaks=a}return o}function oc(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 h=r[l],{startIndex:u}=h;if(u>=s&&u<=i){o.push({...h,startIndex:u-n});continue}else u>i&&(h.startIndex-=t);a.push(h)}e.customBlocks=a}return r.length&&!e.customBlocks&&(e.customBlocks=r),o}function ac(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 h=r[l],{startIndex:u,endIndex:d}=h;if(s<=u&&i>=d){o.push({...h,startIndex:u-n,endIndex:d-n});continue}else if(u<=s&&d>=i){const f=vs(u,d,s,i);if(f.length===0||(h.startIndex=f[0],h.endIndex=f[1],h.startIndex===h.endIndex))continue}else i<u&&(h.startIndex-=t,h.endIndex-=t);a.push(h)}e.tables=a}return o}function Q_(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 h=r[l],{startIndex:u,endIndex:d}=h;if(u>=s&&d<=i){o.push(h);continue}else if(Math.max(s,u)<=Math.min(i,d)){const f=vs(u,d,s,i);if(f.length===0)continue;h.startIndex=f[0],h.endIndex=f[1]}else i<u&&(h.startIndex-=t,h.endIndex-=t);a.push(h)}e.customRanges=Qi(a)}return o}function q_(e,t,n,r=!0){const{customDecorations:s}=e,i=n,o=n+t-1,a=[];if(s){const l=[];for(let c=0,h=s.length;c<h;c++){const u=s[c],{startIndex:d,endIndex:f}=u;if(d>=i&&f<=o){a.push(u);continue}else if(Math.max(i,d)<=Math.min(o,f)){const E=vs(d,f,i,o);if(E.length===0)continue;u.startIndex=E[0],u.endIndex=E[1]}else o<d&&r&&(u.startIndex-=t,u.endIndex-=t);l.push(u)}e.customDecorations=l}return a}var lc=(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))(lc||{}),Lt=(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))(Lt||{});const Lr={"a)":{glyphFormat:"%1)",glyphType:Ne.DECIMAL},"1.":{glyphFormat:"%1.",glyphType:Ne.DECIMAL},"a.":{glyphFormat:"%1.",glyphType:Ne.LOWER_LETTER},"A.":{glyphFormat:"%1.",glyphType:Ne.UPPER_LETTER},"i.":{glyphFormat:"%1.",glyphType:Ne.LOWER_ROMAN},"I.":{glyphFormat:"%1.",glyphType:Ne.UPPER_LETTER}},In=e=>[...e,...e,...e].map((t,n)=>({glyphFormat:` %${n+1}`,glyphSymbol:t,bulletAlignment:Ir.START,textStyle:{fs:12},startNumber:0,paragraphProperties:{hanging:{v:21},indentStart:{v:21*n}}})),vn=e=>e.map((t,n)=>({...t,bulletAlignment:Ir.START,textStyle:{fs:12},startNumber:0,paragraphProperties:{hanging:{v:21},indentStart:{v:21*n}}})),Ca=(e,t)=>new Array(9).fill(0).map((n,r)=>({glyphFormat:` %${r+1}`,glyphSymbol:e,bulletAlignment:Ir.START,textStyle:{fs:16},startNumber:0,paragraphProperties:{hanging:{v:21},indentStart:{v:21*r},textStyle:t}})),yr={BULLET_LIST:{listType:"BULLET_LIST",nestingLevel:In(["●","○","■"])},BULLET_LIST_1:{listType:"BULLET_LIST",nestingLevel:In(["❖","➢","■"])},BULLET_LIST_2:{listType:"BULLET_LIST",nestingLevel:In(["✔","●","◆"])},BULLET_LIST_3:{listType:"BULLET_LIST",nestingLevel:In(["■","◆","○"])},BULLET_LIST_4:{listType:"BULLET_LIST",nestingLevel:In(["✧","○","■"])},BULLET_LIST_5:{listType:"BULLET_LIST",nestingLevel:In(["➢","○","◆"])},ORDER_LIST:{listType:"ORDER_LIST",nestingLevel:vn([{glyphFormat:"%1.",glyphType:Ne.DECIMAL},{glyphFormat:"%2.",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%3.",glyphType:Ne.LOWER_ROMAN},{glyphFormat:"%4.",glyphType:Ne.DECIMAL},{glyphFormat:"%5.",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%6.",glyphType:Ne.LOWER_ROMAN},{glyphFormat:"%7.",glyphType:Ne.DECIMAL},{glyphFormat:"%8.",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%9.",glyphType:Ne.LOWER_ROMAN}])},ORDER_LIST_1:{listType:"ORDER_LIST",nestingLevel:vn([{glyphFormat:"%1)",glyphType:Ne.DECIMAL},{glyphFormat:"%2)",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%3)",glyphType:Ne.LOWER_ROMAN},{glyphFormat:"%4)",glyphType:Ne.DECIMAL},{glyphFormat:"%5)",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%6)",glyphType:Ne.LOWER_ROMAN},{glyphFormat:"%7)",glyphType:Ne.DECIMAL},{glyphFormat:"%8)",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%9)",glyphType:Ne.LOWER_ROMAN}])},ORDER_LIST_2:{listType:"ORDER_LIST",nestingLevel:vn(["%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:Ne.DECIMAL})))},ORDER_LIST_3:{listType:"ORDER_LIST",nestingLevel:vn([{glyphFormat:"%1.",glyphType:Ne.UPPER_LETTER},{glyphFormat:"%2.",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%3.",glyphType:Ne.LOWER_ROMAN},{glyphFormat:"%4.",glyphType:Ne.UPPER_LETTER},{glyphFormat:"%5.",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%6.",glyphType:Ne.LOWER_ROMAN},{glyphFormat:"%7.",glyphType:Ne.UPPER_LETTER},{glyphFormat:"%8.",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%9.",glyphType:Ne.LOWER_ROMAN}])},ORDER_LIST_4:{listType:"ORDER_LIST",nestingLevel:vn([{glyphFormat:"%1.",glyphType:Ne.UPPER_LETTER},{glyphFormat:"%2.",glyphType:Ne.DECIMAL},{glyphFormat:"%3.",glyphType:Ne.LOWER_ROMAN},{glyphFormat:"%4.",glyphType:Ne.UPPER_LETTER},{glyphFormat:"%5.",glyphType:Ne.DECIMAL},{glyphFormat:"%6.",glyphType:Ne.LOWER_ROMAN},{glyphFormat:"%7.",glyphType:Ne.UPPER_LETTER},{glyphFormat:"%8.",glyphType:Ne.DECIMAL},{glyphFormat:"%9.",glyphType:Ne.LOWER_ROMAN}])},ORDER_LIST_5:{listType:"ORDER_LIST",nestingLevel:vn([{glyphFormat:"%1.",glyphType:Ne.DECIMAL_ZERO},{glyphFormat:"%2.",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%3.",glyphType:Ne.LOWER_ROMAN},{glyphFormat:"%4.",glyphType:Ne.DECIMAL_ZERO},{glyphFormat:"%5.",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%6.",glyphType:Ne.LOWER_ROMAN},{glyphFormat:"%7.",glyphType:Ne.DECIMAL_ZERO},{glyphFormat:"%8.",glyphType:Ne.LOWER_LETTER},{glyphFormat:"%9.",glyphType:Ne.LOWER_ROMAN}])},CHECK_LIST:{listType:"CHECK_LIST",nestingLevel:Ca("☐")},CHECK_LIST_CHECKED:{listType:"CHECK_LIST_CHECKED",nestingLevel:Ca("☑",{st:{s:Se.TRUE}})}},Ur=e=>{const{glyphFormat:t,glyphType:n}=e,r=re.deepClone(yr.ORDER_LIST);return r.nestingLevel[0].glyphFormat=t,r.nestingLevel[0].glyphType=n,r},J_={ORDER_LIST_QUICK_2:Ur(Lr["a)"]),ORDER_LIST_QUICK_3:Ur(Lr["a."]),ORDER_LIST_QUICK_4:Ur(Lr["i."]),ORDER_LIST_QUICK_6:Ur(Lr["I."])};Object.assign(yr,J_);const Z_={"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"};function eE(e,t,n,r,s){const i=tE(e,t,n,r,s),o=nE(e,t,n,r,s),a=rE(e,t,n,r,s),l=sE(e,t,n,r,s),c=iE(e,t,n,r,s),h=oE(e,t,n,r),u=aE(e,t,n,r,s);return{dataStream:"",textRuns:i,paragraphs:o,sectionBreaks:a,customBlocks:l,tables:c,customRanges:h,customDecorations:u}}function tE(e,t,n,r,s){const{textRuns:i}=e,{textRuns:o}=t;if(i==null||o==null)return;const a=rc(e,n,r);if(s!==Pe.REPLACE){const l=uc(o,a,s);t.textRuns=l}return Qu(e,t,n,r),a}function uc(e,t,n){if(t.length===0)return e;e=re.deepClone(e),t=re.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:E,ts:R}=e[o],{st:O,ed:T,ts:V,sId:z}=t[a];let oe;if(n===Pe.COVER?oe={...V,...R}:oe={...R},E<O)c()||r.push(e[o]),o++;else if(T<f)c()||r.push(t[a]),a++;else{const N={st:Math.min(f,O),ed:Math.max(f,O),ts:f<O?{...R}:{...V},sId:f<O?void 0:z};N.ed>N.st&&r.push(N),r.push({st:Math.max(f,O),ed:Math.min(E,T),ts:oe,sId:z}),E<T?(o++,t[a].st=E,t[a].st===t[a].ed&&a++):(a++,e[o].st=T,e[o].st===e[o].ed&&o++);const A={st:Math.min(E,T),ed:Math.max(E,T),ts:E<T?{...V}:{...R},sId:E<T?z:void 0};l=A.ed>A.st?A:null}}c();const h=r[r.length-1],u=e[s-1],d=t[i-1];return h&&h.ed!==Math.max(u.ed,d.ed)&&(u.ed>d.ed?r.push(u):r.push(d)),vr(r)}function nE(e,t,n,r,s){const{paragraphs:i}=e,{paragraphs:o}=t;if(i==null||o==null)return;const a=sc(e,n,r);if(s!==Pe.REPLACE){const l=[];for(const c of o){const{startIndex:h,paragraphStyle:u,bullet:d}=c;let f=[];for(const E of a){const{startIndex:R,paragraphStyle:O,bullet:T}=E;let V,z;if(s===Pe.COVER?(V={...O,...u},z={listId:"",listType:Lt.BULLET_LIST,nestingLevel:0,textStyle:{},...T,...d}):(V={...u,...O},z={listId:"",listType:Lt.BULLET_LIST,nestingLevel:0,textStyle:{},...d,...T}),h===R){f.push({startIndex:h,paragraphStyle:V,bullet:z});break}}l.push(...f),f=[]}t.paragraphs=l}return qu(e,t,n,r),a}function rE(e,t,n,r,s){const{sectionBreaks:i}=e,{sectionBreaks:o}=t;if(i==null||o==null)return;const a=ic(e,n,r);if(s!==Pe.REPLACE){const l=[];for(const c of o){const{startIndex:h}=c;let u=[];for(const d of a){const{startIndex:f}=d;if(h===f){s===Pe.COVER?u.push({...d,...c}):u.push({...c,...d});break}}l.push(...u),u=[]}t.sectionBreaks=l}return Ju(e,t,n,r),a}function sE(e,t,n,r,s){const{customBlocks:i=[]}=e,{customBlocks:o}=t;if(i==null||o==null)return;const a=oc(e,n,r);if(s!==Pe.REPLACE){const l=[];for(const c of o){const{startIndex:h}=c;let u=[];for(const d of a){const{startIndex:f}=d;if(h===f){s===Pe.COVER?u.push({...d,...c}):u.push({...c,...d});break}}l.push(...u),u=[]}t.customBlocks=l}return Zu(e,t,n,r),i.length&&!e.customBlocks&&(e.customBlocks=i),a}function iE(e,t,n,r,s){const{tables:i}=e,{tables:o}=t;if(i==null||o==null)return;const a=ac(e,n,r);if(s!==Pe.REPLACE){const l=[];for(const c of o){const{startIndex:h,endIndex:u}=c;let d=[];for(const f of a){const{startIndex:E,endIndex:R}=f;if(E>=h&&R<=u){s===Pe.COVER?d.push({...f,...c}):d.push({...c,...f});break}}l.push(...d),d=[]}t.tables=l}return ec(e,t,n,r),a}function oE(e,t,n,r,s){e.customRanges||(e.customRanges=[]),di(e.customRanges,r),di(e.customRanges,r+n);const i=r,o=r+n-1,{customRanges:a}=t,l=[],c=new Map;e.customRanges.forEach(u=>{const{startIndex:d,endIndex:f}=u;d>=i&&f<=o?c.set(u.rangeId,u):l.push(u)});const h=[];return a?(a.forEach(u=>{const{startIndex:d,endIndex:f}=u;l.push({...u,startIndex:d+r,endIndex:f+r})}),e.customRanges=Qi(l),h):[]}function aE(e,t,n,r,s){e.customDecorations||(e.customDecorations=[]),fi(e.customDecorations,r),fi(e.customDecorations,r+n);const i=[],{customDecorations:o}=e,{customDecorations:a=[]}=t;if(s===Pe.REPLACE){for(let l=0;l<o.length;l++){const c=o[l],{startIndex:h,endIndex:u}=c;h>=r&&u<=r+n-1&&i.push(c)}a.forEach(l=>{const{startIndex:c,endIndex:h}=l;o.push({...l,startIndex:c+r,endIndex:h+r})})}else for(const l of a){const{id:c}=l;if(l.type===fn.DELETED){const h=o.filter(u=>u.id===c);h.length&&i.push(...h)}else o.push({...l,startIndex:l.startIndex+r,endIndex:l.endIndex+r})}for(const l of i){const{id:c}=l,h=o.findIndex(u=>u.id===c);h!==-1&&o.splice(h,1)}return e.customDecorations=nc(o),i}var qi=(e=>(e[e.copy=0]="copy",e[e.cut=1]="cut",e))(qi||{});function Ht(e,t,n,r=!0,s=1){const{dataStream:i,textRuns:o,paragraphs:a=[],customBlocks:l=[],tables:c=[],sectionBreaks:h=[]}=e,u={dataStream:i.slice(t,n)};if(o){const T=[];for(const V of o){const z=re.deepClone(V),{st:oe,ed:N}=z;re.hasIntersectionBetweenTwoRanges(oe,N,t,n)&&(t>=oe&&t<=N?T.push({...z,st:t,ed:Math.min(n,N)}):n>=oe&&n<=N?T.push({...z,st:Math.max(t,oe),ed:n}):T.push(z))}u.textRuns=vr(T.map(V=>{const{st:z,ed:oe}=V;return{...V,st:z-t,ed:oe-t}}))}else r&&(u.textRuns=[{st:0,ed:n-t,ts:{}}]);const d=[];for(const T of c){const V=re.deepClone(T),{startIndex:z,endIndex:oe}=V;z>=t&&oe<=n&&d.push({...V,startIndex:z-t,endIndex:oe-t})}d.length&&(u.tables=d);const f=[];for(const T of a){const{startIndex:V}=T;V>=t&&V<n&&f.push(re.deepClone(T))}f.length&&(u.paragraphs=f.map(T=>({...T,startIndex:T.startIndex-t})));const E=[];for(const T of h){const{startIndex:V}=T;V>=t&&V<=n&&E.push(re.deepClone(T))}if(E.length&&(u.sectionBreaks=E.map(T=>({...T,startIndex:T.startIndex-t}))),s===1){const T=hc(e,t,n);T?u.customDecorations=T:r&&(u.customDecorations=[])}const{customRanges:R}=cc(e,t,n);R?u.customRanges=R:r&&(u.customRanges=[]);const O=[];for(const T of l){const{startIndex:V}=T;V>=t&&V<=n&&O.push(re.deepClone(T))}return O.length&&(u.customBlocks=O.map(T=>({...T,startIndex:T.startIndex-t}))),u}function lE(e){const{dataStream:t,textRuns:n,paragraphs:r,customRanges:s,customDecorations:i,tables:o}=e;let a=0,l=0;s==null||s.forEach(h=>{h.startIndex<0&&(a=Math.max(a,-h.startIndex)),h.endIndex>t.length-1&&(l=Math.max(l,h.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(h=>{h.st+=a,h.ed+=a}),r==null||r.forEach(h=>{h.startIndex+=a}),s==null||s.forEach(h=>{h.startIndex+=a,h.endIndex+=a}),i==null||i.forEach(h=>{h.startIndex+=a,h.endIndex+=l}),o==null||o.forEach(h=>{h.startIndex+=a,h.endIndex+=l}),{...e,dataStream:c,textRuns:n,paragraphs:r,customRanges:s,customDecorations:i,tables:o}}function cc(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 hc(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=re.deepClone(i);s.push({...o,startIndex:Math.max(o.startIndex-t,0),endIndex:Math.min(o.endIndex,n-1)-t})}}),s}function uE(e,t,n){return e==null||t==null?e!=null?e:t:uc(e,t,n)}function cE(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===Pe.REPLACE?[{...e[0]}]:[{...t[0],...e[0]}]}function hE(e,t,n){return t.length===0||e.length===0||n===Pe.REPLACE?e:[...e,...t.filter(r=>!e.some(s=>r.id===s.id))]}function gi(e,t,n=Pe.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:h,customDecorations:u=[]}=t;r.textRuns=uE(l,s,n),r.customRanges=cE(h,o,n);const d=hE(u,a,n);d.length&&(r.customDecorations=d);const f=[];let E=0,R=0;for(;E<i.length&&R<c.length;){const O=i[E],T=c[R],{startIndex:V}=O,{startIndex:z}=T;V===z?(f.push(re.deepMerge(O,T)),E++,R++):V<z?(f.push(re.deepClone(O)),E++):(f.push(re.deepClone(T)),R++)}return E<i.length&&f.push(...i.slice(E)),R<c.length&&f.push(...c.slice(R)),f.length&&(r.paragraphs=f),r}function dE(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 Sn{constructor(t){C(this,"_index",0);C(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===fe.DELETE||n.t===fe.RETAIN&&n.body==null?re.deepClone({...n,len:t}):re.deepClone({...n,len:t,body:Ht(n.body,r,r+t,!1)})}else return{t:fe.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:fe.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[]}}class zn{constructor(){C(this,"cursor",0)}reset(){return this.cursor=0,this}moveCursor(t){this.cursor+=t}moveCursorTo(t){this.cursor=t}}function dc(e,t,n){const{dataStream:r}=e,s=n,i=n+t,o=rc(e,t,n),a=sc(e,t,n),l=ic(e,t,n),c=oc(e,t,n),h=ac(e,t,n),u=Q_(e,t,n),d=q_(e,t,n);let f="";return r&&(e.dataStream=hu(r,s,i),f=r.slice(s,i)),{dataStream:f,textRuns:o,paragraphs:a,sectionBreaks:l,customBlocks:c,tables:h,customRanges:u,customDecorations:d}}function fc(e,t,n,r){e.dataStream=cu(e.dataStream,r,t.dataStream),Qu(e,t,n,r),qu(e,t,n,r),Ju(e,t,n,r),Zu(e,t,n,r),ec(e,t,n,r),K_(e,t,n,r),X_(e,t,n,r)}function fE(e,t,n,r,s=Pe.COVER){return eE(e,t,n,r,s)}function gE(e,t,n){return t<=0?{dataStream:""}:dc(e,t,n)}function pE(e,t,n,r){n!==0&&fc(e,t,n,r)}function mE(e,t){const n=new zn;return n.reset(),t.forEach(r=>{const s=re.deepClone(r);switch(s.t){case fe.RETAIN:{const{coverType:i,body:o,len:a}=s;o!=null&&fE(e,o,a,n.cursor,i),n.moveCursor(a);break}case fe.INSERT:{const{body:i,len:o}=s;pE(e,i,o,n.cursor),n.moveCursor(o);break}case fe.DELETE:{const{len:i}=s;gE(e,i,n.cursor);break}default:throw new Error(`Unknown action type for action: ${s}.`)}}),e}function _E(e,t,n,r,s){if(e==null||t==null)return t;if(e.length===0||t.length===0)return[];t=re.deepClone(t),e=re.deepClone(e);const i=[],o=t.length,a=e.length;let l=0,c=0,h=null;function u(){return h?(i.push(h),h=null,!0):!1}for(;l<o&&c<a;){const{st:R,ed:O,ts:T}=t[l],{st:V,ed:z,ts:oe,sId:N}=e[c];let A={};if(s===0)A={...T},n===Pe.COVER&&r===Pe.REPLACE&&oe&&(A=Object.assign({},oe,A));else if(A={...T},n===Pe.REPLACE){if(r===Pe.REPLACE)A={...oe};else if(T&&oe){const H=Object.keys(T);for(const J of H)oe[J]&&delete A[J]}}else if(r===Pe.REPLACE){if(oe){const H=Object.keys(oe);for(const J of H)oe[J]!==void 0&&(A[J]=oe[J])}}else if(oe){const H=Object.keys(oe);for(const J of H)A[J]!==void 0&&delete A[J]}if(O<V)u()||i.push(t[l]),l++;else if(z<R)u()||i.push(e[c]),c++;else{const H={st:Math.min(R,V),ed:Math.max(R,V),ts:R<V?{...T}:{...oe},sId:R<V?void 0:N};H.ed>H.st&&i.push(),i.push({st:Math.max(R,V),ed:Math.min(O,z),ts:A,sId:N}),O<z?(l++,e[c].st=O,e[c].st===e[c].ed&&c++):(c++,t[l].st=z,t[l].st===t[l].ed&&l++);const J={st:Math.min(O,z),ed:Math.max(O,z),ts:O<z?{...oe}:{...T},sId:O<z?N:void 0};h=J.ed>J.st?J:null}}u();const d=i[i.length-1],f=t[o-1],E=e[a-1];return d.ed!==Math.max(f.ed,E.ed)&&(f.ed>E.ed?i.push(f):i.push(E)),vr(i,!0)}function EE(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===Pe.REPLACE)return s===1?[re.deepClone(i)]:[re.deepClone(o)];if(r===Pe.REPLACE){const a=re.deepClone(o);return s===1&&Object.assign(a,re.deepClone(i)),[a]}else{const a=re.deepClone(o);return s===1&&Object.assign(a,re.deepClone(i)),[a]}}function Ra(e,t,n,r,s){const i={startIndex:t.startIndex};if(t.paragraphStyle&&(i.paragraphStyle=re.deepClone(t.paragraphStyle),e.paragraphStyle)){if(n===Pe.REPLACE)if(r===Pe.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===Pe.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===Pe.REPLACE&&r===Pe.REPLACE?i.bullet=s===1?re.deepClone(e.bullet):re.deepClone(t.bullet):e.bullet===void 0?i.bullet=re.deepClone(t.bullet):n===Pe.REPLACE||r===Pe.REPLACE?i.bullet=s===0&&t.bullet?re.deepClone(t.bullet):re.deepClone(e.bullet):s===0&&t.bullet!==void 0&&(i.bullet=re.deepClone(t.bullet)),i}function CE(e,t){if(e==null||t==null)return t;if(e.length===0||t.length===0)return re.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===fn.DELETED||i===fn.DELETED)&&(o=!0,n.push({...r,type:fn.DELETED}));break}o||n.push(r)}return n}function RE(e,t,n=!1){const{body:r,coverType:s=Pe.COVER}=e,{body:i,coverType:o=Pe.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:h=[],customRanges:u,customDecorations:d}=r,{textRuns:f,paragraphs:E=[],customRanges:R,customDecorations:O}=i,T=_E(c,f,s,o,n?1:0);T&&(a.textRuns=T);const V=EE(u,R,s,o,n?1:0);V&&(a.customRanges=V);const z=CE(d,O);z&&(a.customDecorations=z);const oe=[];let N=0,A=0;for(;N<h.length&&A<E.length;){const H=h[N],J=E[A],{startIndex:de}=H,{startIndex:le}=J;if(de===le){let m={startIndex:de};n?m=Ra(H,J,s,o,1):m=Ra(H,J,s,o,0),oe.push(m),N++,A++}else de<le?N++:(oe.push(re.deepClone(J)),A++)}return A<E.length&&oe.push(...E.slice(A)),oe.length&&(a.paragraphs=oe),{coverType:l,body:a}}function Ia(e){return Object.keys(e).length===1}const Nn=class Nn{constructor(){C(this,"_actions",[])}static apply(t,n){return mE(t,n)}static compose(t,n){const r=new Sn(t),s=new Sn(n),i=new Nn;for(;r.hasNext()||s.hasNext();)if(s.peekType()===fe.INSERT)i.push(s.next());else if(r.peekType()===fe.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===fe.INSERT&&l.t===fe.RETAIN)l.body==null?i.push(a):i.push({...a,body:gi(a.body,l.body,l.coverType)});else if(a.t===fe.RETAIN&&l.t===fe.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===Pe.REPLACE||l.coverType===Pe.REPLACE?Pe.REPLACE:Pe.COVER;i.push({...a,t:fe.RETAIN,coverType:c,body:gi(a.body,l.body,l.coverType)})}else i.push(a.body?a:l);else a.t===fe.RETAIN&&l.t===fe.DELETE?i.push(l):a.t===fe.INSERT&&(l.t,fe.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 Sn(t),i=new Sn(n),o=new Nn;for(;s.hasNext()||i.hasNext();)if(s.peekType()===fe.INSERT&&(r==="left"||i.peekType()!==fe.INSERT)){const a=s.next();o.retain(a.len)}else if(i.peekType()===fe.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===fe.DELETE)continue;if(c.t===fe.DELETE){o.push(c);continue}if(l.body==null||c.body==null)o.push(c);else{const{coverType:h,body:u}=RE(l,c,r==="left");o.push({...c,t:fe.RETAIN,coverType:h,body:u})}}return o.trimEndUselessRetainAction(),o.serialize()}static transformPosition(t,n,r=!1){const s=new Sn(t);let i=0;for(;s.hasNext()&&i<=n;){const o=s.peekLength(),a=s.peekType();if(s.next(),a===fe.DELETE){n-=Math.min(o,n-i);continue}else a===fe.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===fe.INSERT)n.push({t:fe.DELETE,len:r.len,body:r.body});else if(r.t===fe.DELETE){if(r.body==null)throw new Error("Can not invert DELETE action without body property, makeInvertible must be called first.");n.push({t:fe.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:fe.RETAIN,body:r.oldBody,oldBody:r.body,len:r.len,coverType:Pe.REPLACE})}else n.push(r);return n}static makeInvertible(t,n){const r=[];let s=0;for(const i of t){if(i.t===fe.DELETE&&(i.body==null||i.body&&i.body.dataStream.length!==i.len)){const o=Ht(n,s,s+i.len,!1);i.len=o.dataStream.length,i.body=o}if(i.t===fe.RETAIN&&i.body!=null){const o=Ht(n,s,s+i.len,!0);i.oldBody={...o,dataStream:""},i.len=o.dataStream.length}r.push(i),i.t!==fe.INSERT&&(s+=i.len)}return r}insert(t,n){const r={t:fe.INSERT,body:n,len:t};return this.push(r),this}retain(t,n,r){const s={t:fe.RETAIN,len:t};return n!=null&&(s.body=n),r!=null&&(s.coverType=r),this.push(s),this}delete(t){const n={t:fe.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=re.deepClone(t[0]);if(s.t===fe.RETAIN&&s.len===0&&s.body==null)return this;if(typeof r=="object"){if(r.t===fe.DELETE&&s.t===fe.DELETE)return r.len+=s.len,this;if(r.t===fe.DELETE&&s.t===fe.INSERT&&(n-=1,r=this._actions[n-1],r==null))return this._actions.unshift(s),this;if(r.t===fe.RETAIN&&s.t===fe.RETAIN&&r.body==null&&s.body==null)return r.len+=s.len,this;if(r.t===fe.INSERT&&Ia(r.body)&&s.t===fe.INSERT&&Ia(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===fe.RETAIN&&dE(t);)this._actions.pop(),t=this._actions[this._actions.length-1];return this}};C(Nn,"id","text-x"),C(Nn,"uri","https://github.com/dream-num/univer#text-x");let Ke=Nn;Object.defineProperty(Ke,"name",{value:"text-x"});const Mn=class Mn{static registerSubtype(t){var n;t==null||this._subTypes.has(t.name)&&((n=this._subTypes.get(t.name))==null?void 0:n.id)!==Ke.id||(this._subTypes.set(t.name,t),mt.type.registerSubtype(t))}static apply(t,n){if(!mt.type.isNoop(n))return mt.type.apply(t,n)}static compose(t,n){return mt.type.compose(t,n)}static transform(t,n,r){return mt.type.transform(t,n,r)}static transformPosition(t,n,r="right"){return t&&t.length===2&&t[0]==="body"&&t[1].et===Ke.name?Ke.transformPosition(t[1].e,n,r==="left"):n}static invertWithDoc(t,n){return mt.type.invertWithDoc(t,n)}static isNoop(t){return mt.type.isNoop(t)}static getInstance(){return this._instance==null&&(this._instance=new Mn),this._instance}removeOp(t,n){return mt.removeOp(t,n)}moveOp(t,n){return mt.moveOp(t,n)}insertOp(t,n){return mt.insertOp(t,n)}replaceOp(t,n,r){return mt.replaceOp(t,n,r)}editOp(t,n=["body"]){return mt.editOp(n,Ke.name,t)}};C(Mn,"uri","https://github.com/dream-num/univer#json-x"),C(Mn,"_subTypes",new Map),C(Mn,"_instance",null);let Vt=Mn;Vt.registerSubtype(Ke);const Ji={id:"default_doc",documentStyle:{}};class IE extends ys{constructor(n){var r;super();C(this,"type",$e.UNIVER_DOC);C(this,"_name$",new Oe.BehaviorSubject(""));C(this,"name$",this._name$.asObservable());C(this,"snapshot");this.snapshot={...Ji,...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{...yr,...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}}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){n=n!=null?n:Number.POSITIVE_INFINITY,r=r!=null?r:Number.POSITIVE_INFINITY,s.pageSize={width:n,height:r};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 h=c.docTransform;h.size.width=i,h.size.height=o,h.positionH.posOffset=a,h.positionV.posOffset=l}setZoomRatio(n=1){this.snapshot.settings==null?this.snapshot.settings={zoomRatio:n}:this.snapshot.settings.zoomRatio=1}}class Pt extends IE{constructor(n){var s,i;super(re.isEmptyObject(n)?$_():n);C(this,"_unitId");C(this,"headerModelMap",new Map);C(this,"footerModelMap",new Map);const r=6;this._unitId=(s=this.snapshot.id)!=null?s:re.generateRandomId(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={...Ji,...n},this._initializeHeaderFooterModel()}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(!Vt.isNoop(n))return this.snapshot=Vt.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.snapshot}sliceBody(n,r,s=qi.copy){const i=this.getBody();if(i!=null)return Ht(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 Pt(i)),this.headerModelMap.get(s).updateDocumentId(this.getUnitId())}if(r)for(const s in r){const i=r[s];this.footerModelMap.set(s,new Pt(i)),this.footerModelMap.get(s).updateDocumentId(this.getUnitId())}}updateDocumentId(n){super.updateDocumentId(n),this._unitId=n}}function vE(e){const{ranges:t,id:n,type:r}=e,s=new Ke;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:fe.RETAIN,len:l-i}),s.push({t:fe.RETAIN,body:{dataStream:"",customDecorations:[{id:n,type:r,startIndex:0,endIndex:c-l-1}]},len:c-l}),i=c}return s}function yE(e){var h,u,d;const{id:t,segmentId:n,documentDataModel:r}=e,s=r==null?void 0:r.getBody();if(!r||!s)return!1;const i=(d=(u=(h=r.getSelfOrHeaderFooterModel(n))==null?void 0:h.getBody())==null?void 0:u.customDecorations)==null?void 0:d.find(f=>f.id===t);if(!i)return!1;const o=new Ke,{startIndex:a,endIndex:l}=i,c=l-a+1;return o.push({t:fe.RETAIN,len:a}),o.push({t:fe.RETAIN,len:c,body:{dataStream:"",customDecorations:[{startIndex:0,endIndex:c-1,id:t,type:fn.DELETED}]}}),o}function gc(e,t,n,r){return e<=n&&t>=n||e>=n&&e<=r}function SE(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):gc(e.startOffset,e.endOffset-1,i.startIndex,i.endIndex)&&n.push(i)}return n}function OE(e){return{...re.deepClone(e),rangeId:zt()}}function bE(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 pc(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 wE(e,t){var i,o,a,l,c;const n=pc(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}}function AE(e){var u,d,f;const{rangeId:t,segmentId:n,documentDataModel:r,insert:s}=e,i=(d=(u=r.getSelfOrHeaderFooterModel(n).getBody())==null?void 0:u.customRanges)==null?void 0:d.find(E=>E.rangeId===t);if(!i)return!1;const{startIndex:o,endIndex:a}=i,l=new Ke,c=a-o+1;l.push({t:fe.RETAIN,len:o}),l.push({t:fe.RETAIN,len:c,body:{dataStream:"",customRanges:[]}}),s&&l.push({t:fe.INSERT,body:s,len:s.dataStream.length});const h=a+1+((f=s==null?void 0:s.dataStream.length)!=null?f:0);return l.selections=[{startOffset:h,endOffset:h,collapsed:!0}],l}function TE(e){const{ranges:t,rangeId:n,rangeType:r,wholeEntity:s,properties:i,body:o}=e;let a=0;const l=new Ke;let c=!1;return t.forEach(h=>{var z,oe,N;const u=wE(h,o);if(!u||!o)return!1;const{startOffset:d,endOffset:f}=u,E=(z=o.customRanges)!=null?z:[],R=(A,H,J)=>{var y,D,b,S;const de=pc(A,H,E,r),le=Math.min((D=(y=de[0])==null?void 0:y.startIndex)!=null?D:1/0,A),m=Math.max((S=(b=de[de.length-1])==null?void 0:b.endIndex)!=null?S:-1/0,H),j={rangeId:J?`${n}$${J}`:n,rangeType:r,startIndex:0,endIndex:m-le,wholeEntity:s,properties:{...i}};l.push({t:fe.RETAIN,len:le-a}),l.push({t:fe.RETAIN,len:m-le+1,body:{dataStream:"",customRanges:[j]},coverType:Pe.COVER}),a=m+1},O=((oe=o.paragraphs)!=null?oe:[]).filter(A=>A.startIndex<f&&A.startIndex>d),T=((N=o.customBlocks)!=null?N:[]).filter(A=>A.startIndex<f&&A.startIndex>d);bE([d,f-1],[...O.map(A=>A.startIndex),...T.map(A=>A.startIndex)]).forEach(([A,H],J)=>R(A,H,J)),c=!0,l.selections=[{startOffset:u.endOffset,endOffset:u.endOffset,collapsed:!0}]}),c?l:!1}function mc(e,t,n=0,r=null,s=!0){e.sort((c,h)=>c.startOffset-h.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:h,endOffset:u}=c;h>l&&(i.push({t:fe.RETAIN,len:h-l}),l=h),l<u&&(i.push({t:fe.DELETE,len:u-l}),l=u)}),r&&i.push({t:fe.INSERT,body:r,len:r.dataStream.length}),a&&s){const c=o.find(h=>h.startIndex-n>=e[e.length-1].endOffset-1);c&&(c.startIndex>l&&(i.push({t:fe.RETAIN,len:c.startIndex-l}),l=c.startIndex),i.push({t:fe.RETAIN,len:1,body:{dataStream:"",paragraphs:[{...c,startIndex:0,bullet:a==null?void 0:a.bullet}]},coverType:Pe.REPLACE}))}return i}function NE(e,t,n=0){const r=[];let s=n;return e.forEach(i=>{const{startOffset:o,endOffset:a}=i;o>s&&(r.push({t:fe.RETAIN,len:o-s}),s=o),a>s&&(r.push({t:fe.RETAIN,len:a-s,body:{...re.deepClone(t),dataStream:""}}),s=a)}),r}const ME=e=>{var u;const{selection:t,body:n,doc:r}=e,s=t.segmentId,i=(u=r.getSelfOrHeaderFooterModel(s))==null?void 0:u.getBody();if(!i)return!1;const o=t.collapsed?null:Ht(i,t.startOffset,t.endOffset),a=nl(o?o.dataStream:"",n.dataStream);let l=0;const c=a.map(([d,f])=>{switch(d){case 0:{const E={t:fe.RETAIN,body:{...Ht(n,l,l+f.length,!1),dataStream:""},len:f.length};return l+=f.length,E}case 1:{const E={t:fe.INSERT,body:Ht(n,l,l+f.length),len:f.length};return l+=f.length,E}default:return{t:fe.DELETE,len:f.length}}}),h=new Ke;return h.push({t:fe.RETAIN,len:t.startOffset}),h.push(...c),h};function DE(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 xE(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 LE=e=>{var R,O,T,V;const{selection:t,documentDataModel:n,drawings:r}=e,{collapsed:s,startOffset:i,segmentId:o}=t,a=new Ke,l=Vt.getInstance(),c=[],h=n.getSelfOrHeaderFooterModel(o).getBody();if(!h)return!1;const u=(O=(R=n.getSnapshot().drawingsOrder)==null?void 0:R.length)!=null?O:0;let d=0;if(s)i>0&&a.push({t:fe.RETAIN,len:i});else{const z=mc([t],h,0,null,!1);a.push(...z);const oe=DE(h,[t]),N=(T=n.getDrawings())!=null?T:{},A=(V=n.getDrawingsOrder())!=null?V:[],H=oe.sort((J,de)=>A.indexOf(J)>A.indexOf(de)?-1:A.indexOf(J)<A.indexOf(de)?1:0);if(H.length>0)for(const J of H){const de=N[J],le=A.indexOf(J);if(de==null||le<0)continue;const m=l.removeOp(["drawings",J],de),j=l.removeOp(["drawingsOrder",le],J);c.push(m),c.push(j),d++}}a.push({t:fe.INSERT,body:{dataStream:"\b".repeat(r.length),customBlocks:r.map((z,oe)=>({startIndex:oe,blockId:z.drawingId}))},len:r.length});const f=xE(n,o),E=l.editOp(a.serialize(),f);c.push(E);for(const z of r){const{drawingId:oe}=z,N=l.insertOp(["drawings",oe],z),A=l.insertOp(["drawingsOrder",u-d],oe);c.push(N),c.push(A)}return c.reduce((z,oe)=>Vt.compose(z,oe),null)},UE=e=>{var u,d,f;const{paragraphs:t,segmentId:n,document:r}=e;let s=e.listType;const i=(d=(u=r.getSelfOrHeaderFooterModel(n).getBody())==null?void 0:u.paragraphs)!=null?d:[],o=t.every(E=>{var R;return((R=E.bullet)==null?void 0:R.listType.indexOf(s))===0});let l=re.generateRandomId(6);if(t.length===1){const E=i.indexOf(t[0]),R=i[E-1],O=i[E+1];R&&R.bullet&&R.bullet.listType.indexOf(s)===0?(l=R.bullet.listId,s!==Lt.CHECK_LIST&&(s=R.bullet.listType)):O&&O.bullet&&O.bullet.listType.indexOf(s)===0&&(l=O.bullet.listId,s!==Lt.CHECK_LIST&&(s=O.bullet.listType))}const c=new zn;c.reset();const h=new Ke;for(const E of t){const{startIndex:R,paragraphStyle:O={},bullet:T}=E;h.push({t:fe.RETAIN,len:R-c.cursor}),h.push({t:fe.RETAIN,len:1,body:{dataStream:"",paragraphs:[o?{paragraphStyle:O,startIndex:0}:{startIndex:0,paragraphStyle:{...O},bullet:{nestingLevel:(f=T==null?void 0:T.nestingLevel)!=null?f:0,textStyle:{fs:20},listType:s,listId:l}}]},coverType:Pe.REPLACE}),c.moveCursorTo(R+1)}return h},PE=e=>{var u;const{paragraphIndex:t,segmentId:n,document:r}=e,s=(u=r.getSelfOrHeaderFooterModel(n).getBody())==null?void 0:u.paragraphs;if(s==null)return!1;const i=s.find(d=>d.startIndex===t);if(!(i!=null&&i.bullet)||i.bullet.listType.indexOf(Lt.CHECK_LIST)===-1)return!1;const o=new zn;o.reset();const a=new Ke,{startIndex:l,paragraphStyle:c={}}=i,h=i.bullet.listType===Lt.CHECK_LIST?Lt.CHECK_LIST_CHECKED:Lt.CHECK_LIST;return a.push({t:fe.RETAIN,len:l-o.cursor}),a.push({t:fe.RETAIN,len:1,body:{dataStream:"",paragraphs:[{...i,paragraphStyle:c,startIndex:0,bullet:{...i.bullet,listType:h}}]},coverType:Pe.REPLACE}),o.moveCursorTo(l+1),a},FE=e=>{var h,u;const{paragraphs:t,listType:n,segmentId:r,document:s}=e;if(((h=s.getSelfOrHeaderFooterModel(r).getBody())==null?void 0:h.paragraphs)==null)return!1;const a=re.generateRandomId(6),l=new zn;l.reset();const c=new Ke;for(const d of t){const{startIndex:f,paragraphStyle:E={},bullet:R}=d;c.push({t:fe.RETAIN,len:f-l.cursor}),c.push({t:fe.RETAIN,len:1,body:{dataStream:"",paragraphs:[{startIndex:0,paragraphStyle:E,bullet:{nestingLevel:(u=R==null?void 0:R.nestingLevel)!=null?u:0,textStyle:(R==null?void 0:R.listType)===n?R.textStyle:{fs:20},listType:n,listId:a}}]},coverType:Pe.REPLACE}),l.moveCursorTo(f+1)}return c};function kE(e,t){return t.some(n=>e.startIndex>n.startIndex&&e.startIndex<n.endIndex)}const $E=e=>{var h,u,d;const{paragraphs:t,segmentId:n,document:r,type:s}=e,i=new zn;i.reset();const o=new Ke,a=(h=r.getSnapshot().lists)!=null?h:{},l=(d=(u=r.getBody())==null?void 0:u.tables)!=null?d:[],c={...yr,...a};for(const f of t){const{startIndex:E,paragraphStyle:R={},bullet:O}=f,T=kE(f,l);if(o.push({t:fe.RETAIN,len:E-i.cursor}),O){const V=O.listType;let z=c[V].nestingLevel.length-1;T&&(z=Math.min(z,2)),o.push({t:fe.RETAIN,len:1,body:{dataStream:"",paragraphs:[{startIndex:0,paragraphStyle:{...R},bullet:{...O,nestingLevel:Math.max(Math.min(O.nestingLevel+s,z),0)}}]},coverType:Pe.REPLACE})}else o.push({t:fe.RETAIN,len:1});i.moveCursorTo(E+1)}return o};var _c=(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))(_c||{}),Jt=(e=>(e.PARAGRAPH="\r",e.SECTION_BREAK=`
9
- `,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))(Jt||{});function BE(e){return`${e}`}const jE=[Jt.TABLE_START,Jt.TABLE_ROW_START,Jt.TABLE_CELL_START,Jt.TABLE_CELL_END,Jt.TABLE_ROW_END,Jt.TABLE_END],Ec=e=>{const t=e.endsWith(`\r
10
- `)?e.slice(0,-2):e;return jE.reduce((n,r)=>n.replaceAll(r,""),t)},HE=e=>e?Ec(e).replaceAll("\r","")==="":!0,WE=e=>{const t=e.replace(/\n/g,"\r"),n=[],r=[];let s=0,i="";const o=(l,c=!0)=>{const h=t.slice(s,l);if(re.isLegalUrl(h)){const u=zt(),d=`${h}`,f={startIndex:s,endIndex:s+d.length-1,rangeId:u,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}};function zE(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 YE(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 VE(e,t,n,r){return Math.max(e,n)<=Math.min(t,r)}class st{}C(st,"customRange",{add:TE,delete:AE,copyCustomRange:OE,getCustomRangesInterestsWithSelection:SE,isIntersecting:gc}),C(st,"customDecoration",{add:vE,delete:yE}),C(st,"selection",{replace:ME,makeSelection:zE,normalizeSelection:YE,delete:mc,retain:NE}),C(st,"range",{isIntersects:VE}),C(st,"transform",{getPlainText:Ec,fromPlainText:WE,isEmptyDocument:HE}),C(st,"paragraph",{bullet:{set:FE,switch:UE,toggleChecklist:PE,changeNestLevel:$E}}),C(st,"drawing",{add:LE});class Yn{constructor(t={}){C(this,"_style");this._style=t}static create(t={}){return new Yn(t)}get fontFamily(){return this._style.ff}get fontSize(){return this._style.fs}get italic(){return this._style.it===Se.TRUE}get bold(){return this._style.bl===Se.TRUE}get underline(){return this._style.ul&&Bt.create(this._style.ul)}get bottomBorderLine(){return this._style.bbl&&Bt.create(this._style.bbl)}get strikethrough(){return this._style.st&&Bt.create(this._style.st)}get overline(){return this._style.ol&&Bt.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 Wt.create(re.deepClone(this._style))}getValue(){return{...this._style}}}class Wt extends Yn{static create(t={}){return new Wt(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 Wt.create(re.deepClone(this._style))}build(){return this.getValue()}}class Bt{constructor(t={s:1}){C(this,"_decoration");this._decoration=t}static create(t={s:1}){return new Bt(t)}get show(){return this._decoration.s===Se.TRUE}get followFontColor(){return this._decoration.c===Se.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 Bt.create(re.deepClone(this._decoration))}build(){return{...this._decoration}}}class Vn{constructor(t={}){C(this,"_style");this._style=t}static create(t={}){return new Vn(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===Se.TRUE}get keepNext(){return this._style.keepNext===Se.TRUE}get wordWrap(){return this._style.wordWrap===Se.TRUE}get widowControl(){return this._style.widowControl===Se.TRUE}get shading(){return this._style.shading}get suppressHyphenation(){return this._style.suppressHyphenation===Se.TRUE}copy(){return kn.create(re.deepClone(this._style))}getValue(){return this._style}}class kn extends Vn{static create(t={}){return new kn(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 kn.create(re.deepClone(this._style))}build(){return this.getValue()}}class jt{constructor(t){C(this,"_data");if(!t.body)throw new Error("Invalid document data, body is required");this._data=t}static create(t){return new jt(t)}static createByBody(t){return new jt({body:t,id:"d",documentStyle:{}})}copy(){return sn.create(re.deepClone(this._data))}slice(t,n){const{body:r,...s}=this._data;return sn.create({...re.deepClone(s),body:Ht(r,t,n)})}toPlainText(){var t,n;return st.transform.getPlainText((n=(t=this._data.body)==null?void 0:t.dataStream)!=null?n:"")}getParagraphStyle(){var t,n;return Vn.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?Yn.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 sn extends jt{constructor(n){super(n);C(this,"_doc");this._doc=new Pt(n)}static newEmptyData(){return{id:"d",documentStyle:{},drawings:{},drawingsOrder:[],body:{dataStream:`\r
11
- `,customBlocks:[],customRanges:[],paragraphs:[{startIndex:0}],textRuns:[],tables:[],sectionBreaks:[]}}}static create(n){return new sn(n!=null?n:sn.newEmptyData())}insertText(n,r,s){var h,u;let i=((u=(h=this._data.body)==null?void 0:h.dataStream.length)!=null?u:2)-2,o,a;if(typeof n=="string"?o=n:(i=Math.min(n,i),o=r),typeof r=="object"?a=r instanceof Wt?r.build():r:a=s instanceof Wt?s.build():s,!o)return this;const l={dataStream:o,textRuns:a?[{ts:a,st:i,ed:i+o.length}]:[]},c=st.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 Ke.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 jt?n.getData():n:(s=Math.min(n,s),i=r instanceof jt?r.getData():r);const o=st.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 Ke.apply(this._doc.getBody(),o.serialize()),this}delete(n,r){if(r!==void 0){if(!r)return this;const s=st.selection.delete([{startOffset:n,endOffset:n+r,collapsed:!0}],this._data.body);Ke.apply(this._doc.getBody(),s)}return this}setStyle(n,r,s){const i={dataStream:"",textRuns:[{ts:s instanceof Wt?s.build():s,st:0,ed:r-n}]},o=st.selection.retain([{startOffset:n,endOffset:r,collapsed:!0}],i);return Ke.apply(this._doc.getBody(),o),this}setLink(n,r,s){const i=st.customRange.add({rangeType:on.HYPERLINK,rangeId:zt(),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 Ke.apply(this._doc.getBody(),i.serialize()),this}cancelLink(n,r){if(typeof n=="string"){const s=st.customRange.delete({rangeId:n,documentDataModel:this._doc});if(!s)throw new Error("Insert text failed, please check.");Ke.apply(this._doc.getBody(),s.serialize())}else this.slice(n,r).getLinks().forEach(i=>{const o=st.customRange.delete({rangeId:i.rangeId,documentDataModel:this._doc});if(!o)throw new Error("Insert text failed, please check.");Ke.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,jt.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=sn.createByBody({dataStream:i,customRanges:[{rangeType:on.HYPERLINK,rangeId:zt(),properties:{url:o},startIndex:0,endIndex:i.length-1}]});return typeof n=="number"?this.insertRichText(n,a):this.insertRichText(a)}}function GE(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 An=(e=>(e[e.Style=1]="Style",e[e.Value=2]="Value",e))(An||{});function KE(e){return`sheet_interceptor_${e}`}const Cc=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 XE{constructor(t){C(this,"_interceptorsByName",new Map);C(this,"_interceptorPoints");this._interceptorPoints=t}fetchThroughInterceptors(t,n){const r=t;let s=this._interceptorsByName.get(r);return n&&(s=s.filter(n)),Cc(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)})),()=>gr(this._interceptorsByName.get(r),n)}getInterceptPoints(){return this._interceptorPoints}dispose(){this._interceptorsByName.clear()}}function QE(e){return`sheet_async_interceptor_${e}`}const qE=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 JE{constructor(t){C(this,"_asyncInterceptorsByName",new Map);C(this,"_asyncInterceptorPoints");this._asyncInterceptorPoints=t}fetchThroughAsyncInterceptors(t,n){const r=t;let s=this._asyncInterceptorsByName.get(r);return n&&(s=s.filter(n)),qE(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)})),()=>gr(this._asyncInterceptorsByName.get(r),n)}getInterceptPoints(){return this._asyncInterceptorPoints}dispose(){this._asyncInterceptorsByName.clear()}}function ZE(e,t){for(const n in t)t.hasOwnProperty(n)&&(e[n]=t[n])}class Ss extends nt{static extend(t){Object.getOwnPropertyNames(t.prototype).forEach(n=>{n!=="constructor"&&(this.prototype[n]=t.prototype[n])}),Object.getOwnPropertyNames(t).forEach(n=>{n!=="prototype"&&n!=="name"&&n!=="length"&&(this[n]=t[n])})}}const ks=Symbol("initializers");class Zi extends nt{constructor(t){super(),this._injector=t;const n=this,r=Object.getPrototypeOf(this)[ks];r&&r.forEach(function(s){s.apply(n,[t])})}_initialize(t){}static extend(t){Object.getOwnPropertyNames(t.prototype).forEach(n=>{if(n==="_initialize"){let r=this.prototype[ks];r||(r=[],this.prototype[ks]=r),r.push(t.prototype._initialize)}else n!=="constructor"&&(this.prototype[n]=t.prototype[n])}),Object.getOwnPropertyNames(t).forEach(n=>{n!=="prototype"&&n!=="name"&&n!=="length"&&(this[n]=t[n])})}}class Os{constructor(){C(this,"_data",[])}static create(){return new Os}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 eo{constructor(){C(this,"_data",new Map)}static create(){return new eo}add(t,n){this._data.has(t)||this._data.set(t,n)}delete(t){this._data.delete(t)}getData(){return this._data}}const eC="0.5.4";function tC(e="",t=Er.ZH_CN,n=""){return{id:e,sheetOrder:[],name:n,appVersion:eC,locale:t,styles:{},sheets:{},resources:[]}}class Rc{constructor(t={}){C(this,"_styles");C(this,"_cacheMap",new hr(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=re.generateRandomId(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)}toJSON(){return this._styles}getStyleByCell(t){let n;t&&re.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(re.diffValue(n[r],t))return r;return null}}const nC=(e,t)=>t.length===e.length&&!e.some(n=>t.some(r=>!Yt.equals(r,n))),rC=(e,t)=>t.length===e.length&&e.every((n,r)=>{const s=t[r];return s.unitId===n.unitId&&s.sheetId===n.sheetId&&Yt.equals(n.range,s.range)}),pi={t:0,b:2,l:2,r:2},sC=e=>({sbr:.6,sbo:e,spr:.6,spo:e}),va=90;function er(e,t,n={}){const r=e.length,{textRotation:s,paddingData:i,horizontalAlign:o=$t.UNSPECIFIED,verticalAlign:a=tn.UNSPECIFIED,wrapStrategy:l=_n.UNSPECIFIED,cellValueType:c}=n,{t:h,r:u,b:d,l:f}=i||pi,{vertexAngle:E,centerAngle:R}=yc(s),O={id:"d",body:{dataStream:`${e}${sl}`,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:h,marginBottom:d,marginRight:u,marginLeft:f,renderConfig:{horizontalAlign:o,verticalAlign:a,centerAngle:R,vertexAngle:E,wrapStrategy:l,cellValueType:c,zeroWidthParagraphBreak:1}},drawings:{},drawingsOrder:[]};return new Pt(O)}function iC(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 ya(e){if(!e)return{};const{ff:t,fs:n,it:r,bl:s,ul:i,st:o,ol:a,cl:l}=e,c={};return t&&(c.ff=t),n&&(c.fs=n),r&&(c.it=r),s&&(c.bl=s),i&&(c.ul=i),o&&(c.st=o),a&&(c.ol=a),l&&(c.cl=l),c}function Ic(e,t,n){var i;const r=e.getBody();if((i=r.customRanges)!=null&&i.some(o=>o.rangeType===on.HYPERLINK))return;const s=st.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&&Ke.apply(r,s.serialize())}function vc(e){return e!=null}const oC='"Helvetica Neue", Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "Heiti SC", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif';function Sa(e){const t=ct.ff,n=ct.fs;if(!e){const u=`${n}pt ${t}`;return{fontCache:u,fontString:u,fontSize:n,originFontSize:n,fontFamily:t}}let r=wn.ITALIC;(e.it===0||e.it===void 0)&&(r=wn.NORMAL);let s=wn.BOLD;(e.bl===0||e.bl===void 0)&&(s=wn.NORMAL);let i=n;e.fs&&(i=Math.ceil(e.fs));let o=t;if(e.ff){let u=e.ff;u=u.replace(/"/g,"").replace(/'/g,""),u.indexOf(" ")>-1&&(u=`"${u}"`),u==null&&(u=t),o=u}const{va:a}=e;let l=i;if(a===Ut.SUBSCRIPT||a===Ut.SUPERSCRIPT){const u=aC(o,l),{sbr:d,spr:f}=u;l*=a===Ut.SUBSCRIPT?d:f}const c=`${r} ${s} ${l}pt ${o}`,h=`${c}, ${oC} `;return{fontCache:c,fontString:h,fontSize:l,originFontSize:i,fontFamily:o}}function aC(e,t){return sC(t)}function yc(e){const{a:t=0,v:n=Se.FALSE}=e||{a:0,v:Se.FALSE};let r=0,s=t;return n===Se.TRUE&&(r=va,s=va),{centerAngle:r,vertexAngle:s}}class lC{constructor(t,n){C(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!==Se.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:xe.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:xe.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:xe.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:xe.COLUMN}),r}getColumnDatas(t,n){const r={};let s=0;for(let i=t;i<t+n;i++){const o=this.getColumnOrCreate(i);r[s]=o,s++}return r}getSize(){return rn(this._columnData)}getColumnWidth(t){const{_columnData:n}=this,r=this._config;let s=0;return s=(n[t]||{hd:Se.FALSE,w:r.defaultColumnWidth}).w||r.defaultColumnWidth,s}getColumn(t){const n=this._columnData[t];if(n)return n}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}}class uC{constructor(t,n,r){C(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.getRowOrCreate(i);r[s]=o,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:Se.FALSE,h:s.defaultRowHeight},{ia:l,ah:c,h=s.defaultRowHeight}=a;i+=(l==null||l===Se.TRUE)&&typeof c=="number"?c:h}return i}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:xe.ROW})):!s&&!a&&(s=!0,i=o)}return s&&r.push({startRow:i,endRow:n,startColumn:0,endColumn:0,rangeType:xe.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:xe.ROW})):!s&&a&&(s=!0,i=o)}return s&&r.push({startRow:i,endRow:n,startColumn:0,endColumn:0,rangeType:xe.ROW}),r}getRowRawVisible(t){const n=this.getRow(t);return n?n.hd!==Se.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 cC="DEFAULT_WORKSHEET_ROW_COUNT",Sc=1e3,hC="DEFAULT_WORKSHEET_COLUMN_COUNT",Oc=20,dC="DEFAULT_WORKSHEET_ROW_HEIGHT",bc=24,fC="DEFAULT_WORKSHEET_COLUMN_WIDTH",wc=88,gC="DEFAULT_WORKSHEET_ROW_TITLE_WIDTH",Ac=46,pC="DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT",Tc=20;function Nc(e){const t={name:"Sheet1",id:"sheet-01",tabColor:"",hidden:Se.FALSE,rowCount:Sc,columnCount:Oc,zoomRatio:1,freeze:{xSplit:0,ySplit:0,startRow:-1,startColumn:-1},scrollTop:0,scrollLeft:0,defaultColumnWidth:wc,defaultRowHeight:bc,mergeData:[],cellData:{},rowData:{},columnData:{},showGridlines:Se.TRUE,rowHeader:{width:Ac,hidden:Se.FALSE},columnHeader:{height:Tc,hidden:Se.FALSE},rightToLeft:Se.FALSE};return Object.keys(t).forEach(n=>{const r=n;typeof e[r]>"u"&&(e[r]=t[r])}),e}class mC extends nt{constructor(n){super();C(this,"_cellCache",new Map);C(this,"_rowCache",new Map);C(this,"_columnCache",new Map);C(this,"_hasRow",!1);C(this,"_hasColumn",!1);C(this,"_hasAll",!1);C(this,"_allIndex",-1);C(this,"_mergeData");C(this,"_rangeMap",new hr(5e4));C(this,"_skeletonCache",new hr(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===xe.ROW?this._createRowCache(s,r):i===xe.COLUMN?this._createColumnCache(s,r):i===xe.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||!re.isEmptyObject(this._columnCache)?!0:this._mergeData.some(r=>r.startRow<=n&&n<=r.endRow)}isColumnContainsMergedCell(n){return this._hasAll||!re.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 h of this._mergeData||[])Yt.intersects(h,{startRow:n,endRow:s,startColumn:r,endColumn:i})&&(o.push({...h}),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 h=0;h<a.length;h++){const{startRow:u,endRow:d,startColumn:f,endColumn:E}=a[h];for(let R=n;R<=s;R++){let O=!1;for(let T=r;T<=i;T++)if(R>=u&&R<=d&&T>=f&&T<=E){o.push({startRow:u,endRow:d,startColumn:f,endColumn:E}),c.push(h),O=!0;break}if(O)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 Mc extends nt{constructor(n){super();C(this,"_cellContentInterceptor",null);C(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,An.Value|An.Style,s,i):this.getRawCell(n,r)}getCellValueOnly(n,r){return this._cellContentInterceptor?this._cellContentInterceptor.getCell(n,r,An.Value):this.getRawCell(n,r)}getCellStyleOnly(n,r){return this._cellContentInterceptor?this._cellContentInterceptor.getCell(n,r,An.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,Qe(()=>this._cellContentInterceptor=null)}registerRowFilteredInterceptor(n){if(this._rowFilteredInterceptor)throw new Error("[SheetViewModel]: Interceptor already registered.");return this._rowFilteredInterceptor=n,Qe(()=>this._rowFilteredInterceptor=null)}}const Oa={isDeepClone:!1,displayRawFormula:!1,ignoreTextRotation:!1};class dr{constructor(t,n,r){C(this,"_sheetId");C(this,"_snapshot");C(this,"_cellData");C(this,"_rowManager");C(this,"_columnManager");C(this,"_viewModel");C(this,"_spanModel");var a;this.unitId=t,this._styles=r,this._snapshot=Nc(n);const{columnData:s,rowData:i,cellData:o}=this._snapshot;this._sheetId=(a=this._snapshot.id)!=null?a:re.generateRandomId(6),this._cellData=new xt(o),this._viewModel=new Mc((l,c)=>this.getCellRaw(l,c)),this._rowManager=new uC(this._snapshot,this._viewModel,i),this._columnManager=new lC(this._snapshot,s),this._spanModel=new mC(this._snapshot.mergeData)}__interceptViewModel(t){t(this._viewModel)}getSnapshot(){return this._snapshot}setMergeData(t){this._snapshot.mergeData=t,this.getSpanModel().rebuild(t)}getSpanModel(){return this._spanModel}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)}mixinDefaultStyleToCellRaw(t,n,r,s){const i=this.getColumnStyle(n),o=this.getRowStyle(t),a=this.getDefaultCellStyleInternal();if(a||i||o){let l=r==null?void 0:r.s;typeof l=="string"&&(l=this._styles.get(l));const c=s?ri(a,i,o,l):ri(a,o,i,l);r||(r={}),r.s=c}}getDefaultCellStyle(){return this._snapshot.defaultStyle}getDefaultCellStyleInternal(){const t=this._snapshot.defaultStyle;return this._styles.get(t)}setDefaultCellStyle(t){this._snapshot.defaultStyle=t}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,h)=>{Object.keys(h).forEach(u=>{const d=+u,f=t.getValue(c,d),E=f!=null&&f.s?this._styles.get(f.s):null,R=(E==null?void 0:E.bd)&&(E.bd.b||E.bd.l||E.bd.r||E.bd.t||E.bd.bc_tr||E.bd.bl_tr||E.bd.ml_tr||E.bd.tl_bc||E.bd.tl_br||E.bd.tl_mr);(f&&(f.v||f.p)||E!=null&&E.bg||R)&&(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=re.deepClone(t);return new dr(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:h,endRow:u,startColumn:d,endColumn:f}=r;t===h&&n===d?(o=u,a=f,l=h,c=d,i=!0):t>=h&&t<=u&&n>=d&&n<=f&&(o=u,a=f,l=h,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)}getMatrixWithMergedCells(t,n,r,s,i=bn.Raw){const o=this.getCellMatrix(),a=this._spanModel.getMergedCellRange(t,n,r,s),l=new xt;return ui(t,r,n,s).forEach((c,h)=>{var d;let u;if(i===bn.Raw)u=this.getCellRaw(c,h);else if(i===bn.Intercepted)u=this.getCell(c,h);else if(i===bn.Both){const f=this.getCellRaw(c,h);if(f){u={...f};const E=(d=this.getCell(c,h))==null?void 0:d.v;vc(E)&&u&&(u.displayV=String(E))}}u&&l.setValue(c,h,u)}),a.forEach(c=>{const{startColumn:h,startRow:u,endColumn:d,endRow:f}=c;ui(u,f,h,d).forEach((E,R)=>{E===u&&R===h&&l.setValue(E,R,{...o.getValue(E,R),rowSpan:f-u+1,colSpan:d-h+1}),(E!==u||R!==h)&&l.realDeleteValue(E,R)})}),l}getRange(t,n,r,s){return typeof t=="object"?new Fn(this,t,{getStyles:()=>this._styles}):new Fn(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.getLength()-1}getLastColumnWithContent(){return this._cellData.getRange().endColumn}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 h=a.getCell(l,c),u=!h,d=a.getMergedCell(l,c);if(d){if(l!==d.startRow||c!==d.startColumn){c=d.endColumn+1;continue}if(u&&n){c=d.endColumn+1;continue}const E={row:l,col:c,value:h};return E.colSpan=d.endColumn-d.startColumn+1,E.rowSpan=d.endRow-d.startRow+1,c=d.endColumn+1,{done:!1,value:E}}if(u&&n)c+=1;else{const f={row:l,col:c,value:h};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,h=i;return{next(){for(;;){if(c>o&&(h+=1,c=s),h>a)return{done:!0,value:void 0};const u=l.getMergedCell(c,h);if(u){const E=c!==u.startRow,R=E||h!==u.startColumn;if(r&&R||!r&&E){c=u.endRow+1;continue}const O=l.getCell(u.startRow,u.startColumn);if(!O&&n){c=u.endRow+1;continue}const V={row:c,col:u.startColumn,value:O};return V.colSpan=u.endColumn-u.startColumn+1,V.rowSpan=u.endRow-u.startRow+1,c=u.endRow+1,{done:!1,value:V}}const d=l.getCell(c,h);if(!d&&n)c+=1;else{const E={row:c,col:h,value:d};return c+=1,{done:!1,value:E}}}}}}}}_getCellDocumentModel(t,n=Oa){var R;const{isDeepClone:r,displayRawFormula:s,ignoreTextRotation:i}={...Oa,...n},o=this._styles.getStyleByCell(t);if(!t)return;let a,l="document";const c=iC(o),h=i?ct.tr:c.textRotation||ct.tr;let u=c.horizontalAlign||ct.ht;const d=c.verticalAlign||ct.vt,f=c.wrapStrategy||ct.tb,E=c.paddingData||pi;if(t.f&&s)a=er(t.f.toString(),{},{verticalAlign:d}),u=ct.ht;else if(t.p){const{centerAngle:O,vertexAngle:T}=yc(h);a=this._updateConfigAndGetDocumentModel(r?re.deepClone(t.p):t.p,u,E,{horizontalAlign:u,verticalAlign:d,centerAngle:O,vertexAngle:T,wrapStrategy:f,zeroWidthParagraphBreak:1})}else if(t.v!=null){const O=ya(o);l=Sa(O).fontCache;let T=Dc(t);t.t===nn.FORCE_STRING&&s&&(T=`'${T}`),a=er(T,O,{...c,textRotation:h,cellValueType:t.t})}return a&&t.linkUrl&&t.linkId&&Ic(a,t.linkUrl,t.linkId),{documentModel:a,fontString:l,textRotation:h,wrapStrategy:f,verticalAlign:d,horizontalAlign:u,paddingData:E,fill:(R=o==null?void 0:o.bg)==null?void 0:R.rgb}}_updateConfigAndGetDocumentModel(t,n,r,s){var o,a,l,c,h;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=(h=r.r)!=null?h: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 u of i)u.paragraphStyle||(u.paragraphStyle={}),u.paragraphStyle.horizontalAlign=n;return new Pt(t)}getBlankCellDocumentModel(t){const n=this._getCellDocumentModel(t,{ignoreTextRotation:!0}),r=this._styles.getStyleByCell(t),s=ya(r);if(n!=null)return n.documentModel==null&&(n.documentModel=er("",s)),n;const i="";let o="document";const a=ct.tr,l=ct.ht,c=ct.vt,h=ct.tb,u=pi;return o=Sa({}).fontCache,{documentModel:er(i,s),fontString:o,textRotation:a,wrapStrategy:h,verticalAlign:c,horizontalAlign:l,paddingData:u}}getCellDocumentModelWithFormula(t){return this._getCellDocumentModel(t,{isDeepClone:!0,displayRawFormula:!0,ignoreTextRotation:!0})}getCustomMetadata(){return this._snapshot.custom}setCustomMetadata(t){this._snapshot.custom=t}}function Dc(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 st.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 _C(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 st.transform.getPlainText(n)}return e==null?void 0:e.v}var EC=Object.defineProperty,CC=Object.getOwnPropertyDescriptor,RC=(e,t,n,r)=>{for(var s=r>1?void 0:r?CC(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=(r?o(t,n,s):o(s))||s);return r&&s&&EC(t,n,s),s},IC=(e,t)=>(n,r)=>t(n,r,e);function vC(e,t){return`${e.getUnitId()}|${t.getSheetId()}`}exports.Workbook=class extends ys{constructor(n={},r){super();C(this,"type",$e.UNIVER_SHEET);C(this,"_sheetCreated$",new Oe.Subject);C(this,"sheetCreated$",this._sheetCreated$.asObservable());C(this,"_sheetDisposed$",new Oe.Subject);C(this,"sheetDisposed$",this._sheetDisposed$.asObservable());C(this,"_activeSheet$",new Oe.BehaviorSubject(null));C(this,"activeSheet$",this._activeSheet$.asObservable());C(this,"_worksheets");C(this,"_styles");C(this,"_snapshot");C(this,"_unitId");C(this,"_count");C(this,"_name$");C(this,"name$");this._logService=r;const s=tC();re.isEmptyObject(n)?this._snapshot=s:this._snapshot=re.commonExtend(s,n);const{styles:i}=this._snapshot;(this._snapshot.id==null||this._snapshot.id.length===0)&&(this._snapshot.id=re.generateRandomId(6)),this._unitId=this._snapshot.id,this._styles=new Rc(i),this._count=1,this._worksheets=new Map,this._name$=new Oe.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()}save(){return re.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);const a=new dr(this._unitId,s,this._styles);return this._worksheets.set(n,a),this._sheetCreated$.next(a),!0}getSheetOrders(){return this._snapshot.sheetOrder}getWorksheets(){return this._worksheets}getActiveSpreadsheet(){return this}getStyles(){return this._styles}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()!==Se.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),delete this._snapshot.sheets[n],this._sheetDisposed$.next(r),!0):!1}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===Se.TRUE).map(n=>n.getConfig().id)}getUnhiddenWorksheets(){return this.getSheets().filter(n=>n.getConfig().hidden!==Se.TRUE).map(n=>n.getConfig().id)}load(n){this._snapshot=n}checkSheetName(n){return this.getSheetsName().includes(n)}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(re.isEmptyObject(s)){const o=re.generateRandomId();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 dr(this._unitId,a,this._styles);r.set(o,c),i.includes(o)||i.push(o)}this.ensureActiveSheet()}getCustomMetadata(){return this._snapshot.custom}setCustomMetadata(n){this._snapshot.custom=n}};exports.Workbook=RC([IC(1,At)],exports.Workbook);class to extends ys{constructor(n){var r;super();C(this,"type",$e.UNIVER_SLIDE);C(this,"_activePage$",new Oe.BehaviorSubject(null));C(this,"activePage$",this._activePage$.asObservable());C(this,"_name$");C(this,"name$");C(this,"_snapshot");C(this,"_unitId");this._snapshot={...fu,...n},this._unitId=(r=this._snapshot.id)!=null?r:re.generateRandomId(6),this._name$=new Oe.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:zt(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=zt(6);return{id:n,pageType:Ki.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)}}const tr="FOCUSING_UNIT",Tn="FOCUSING_SHEET",nr="FOCUSING_DOC",rr="FOCUSING_SLIDE",yC="FOCUSING_EDITOR_BUT_HIDDEN",xc="EDITOR_ACTIVATED",SC="FOCUSING_EDITOR_INPUT_FORMULA",Lc="FOCUSING_FX_BAR_EDITOR",OC="FOCUSING_UNIVER_EDITOR",bC="FOCUSING_EDITOR_INPUT_FORMULA",wC="FOCUSING_PANEL_EDITOR",AC="FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE",TC="FOCUSING_COMMON_DRAWINGS",NC="FORMULA_EDITOR_ACTIVATED";var MC=Object.defineProperty,DC=Object.getOwnPropertyDescriptor,xC=(e,t,n,r)=>{for(var s=r>1?void 0:r?DC(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=(r?o(t,n,s):o(s))||s);return r&&s&&MC(t,n,s),s},ba=(e,t)=>(n,r)=>t(n,r,e);const an=_t("univer.current");exports.UniverInstanceService=class extends nt{constructor(n,r){super();C(this,"_unitsByType",new Map);C(this,"_createHandler");C(this,"_ctorByType",new Map);C(this,"_currentUnits",new Map);C(this,"_currentUnits$",new Oe.BehaviorSubject(this._currentUnits));C(this,"currentUnits$",this._currentUnits$.asObservable());C(this,"_unitAdded$",new Oe.Subject);C(this,"unitAdded$",this._unitAdded$.asObservable());C(this,"_unitDisposed$",new Oe.Subject);C(this,"unitDisposed$",this._unitDisposed$.asObservable());C(this,"_focused$",new Oe.BehaviorSubject(null));C(this,"focused$",this._focused$.asObservable());this._injector=n,this._contextService=r}dispose(){super.dispose(),this._focused$.complete()}__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(Oe.map(r=>{var s;return(s=r.get(n))!=null?s:null}),Oe.distinctUntilChanged())}getCurrentUnitForType(n){return this._currentUnits.get(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(Oe.filter(r=>r.type===n))}__addUnit(n,r){var a;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(Oe.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($e.UNIVER_DOC)}getUniverDocInstance(n){return this.getUnit(n,$e.UNIVER_DOC)}getUniverSheetInstance(n){return this.getUnit(n,$e.UNIVER_SHEET)}getAllUnitsForType(n){var r;return(r=this._unitsByType.get(n))!=null?r:[]}changeDoc(n,r){const s=this.getAllUnitsForType($e.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(tr,!0),this._contextService.setContextValue(nr,!1),this._contextService.setContextValue(Tn,!0),this._contextService.setContextValue(rr,!1),this.setCurrentUnitForType(n)):this.focused instanceof Pt?(this._contextService.setContextValue(tr,!0),this._contextService.setContextValue(nr,!0),this._contextService.setContextValue(Tn,!1),this._contextService.setContextValue(rr,!1),this.setCurrentUnitForType(n)):this.focused instanceof to?(this._contextService.setContextValue(tr,!0),this._contextService.setContextValue(nr,!1),this._contextService.setContextValue(Tn,!1),this._contextService.setContextValue(rr,!0),this.setCurrentUnitForType(n)):(this._contextService.setContextValue(tr,!1),this._contextService.setContextValue(nr,!1),this._contextService.setContextValue(Tn,!1),this._contextService.setContextValue(rr,!1))}getFocusedUnit(){return this.focused}getUnitType(n){const r=this._getUnitById(n);return r?r[1]:$e.UNRECOGNIZED}disposeUnit(n){const r=this._getUnitById(n);if(!r)return!1;const[s,i]=r,o=this._unitsByType.get(i),a=o.indexOf(s);return o.splice(a,1),this._tryRemoveCurrentUnitForType(n,i),this._tryBlurUnitOnRemoval(n),this._unitDisposed$.next(s),!0}_tryRemoveCurrentUnitForType(n,r){const s=this.getCurrentUnitForType(r);(s==null?void 0:s.getUnitId())===n&&(this._currentUnits.set(r,null),this._currentUnits$.next(this._currentUnits))}_tryBlurUnitOnRemoval(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=xC([ba(0,it(Ct)),ba(1,_r)],exports.UniverInstanceService);var We=(e=>(e[e.Starting=0]="Starting",e[e.Ready=1]="Ready",e[e.Rendered=2]="Rendered",e[e.Steady=3]="Steady",e))(We||{});const LC={0:"Starting",1:"Ready",2:"Rendered",3:"Steady"};var UC=Object.defineProperty,PC=Object.getOwnPropertyDescriptor,FC=(e,t,n,r)=>{for(var s=r>1?void 0:r?PC(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=(r?o(t,n,s):o(s))||s);return r&&s&&UC(t,n,s),s},kC=(e,t)=>(n,r)=>t(n,r,e);exports.LifecycleService=class extends nt{constructor(n){super();C(this,"_lifecycle$",new Oe.BehaviorSubject(We.Starting));C(this,"lifecycle$",this._lifecycle$.asObservable());C(this,"_lock",!1);this._logService=n,this._reportProgress(We.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()}subscribeWithPrevious(){return Oe.merge(Uc(this.stage),this._lifecycle$.pipe(Oe.skip(1))).pipe(Dl(n=>n===We.Steady))}_reportProgress(n){this._logService.debug("[LifecycleService]",`lifecycle progressed to "${LC[n]}".`)}};exports.LifecycleService=FC([kC(0,At)],exports.LifecycleService);function Uc(e){switch(e){case We.Starting:return Oe.of(We.Starting);case We.Ready:return Oe.of(We.Starting,We.Ready);case We.Rendered:return Oe.of(We.Starting,We.Ready,We.Rendered);default:return Oe.of(We.Starting,We.Ready,We.Rendered,We.Steady)}}var $C=Object.defineProperty,BC=Object.getOwnPropertyDescriptor,jC=(e,t,n,r)=>{for(var s=r>1?void 0:r?BC(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=(r?o(t,n,s):o(s))||s);return r&&s&&$C(t,n,s),s},$s=(e,t)=>(n,r)=>t(n,r,e);const en=_t("univer.undo-redo.service"),HC=20;class Pc{dispose(){}async dispatchToHandlers(){return!1}}const Fc="univer.command.redo",kc="univer.command.undo",gn=new class extends Pc{constructor(){super(...arguments);C(this,"type",Wn.COMMAND);C(this,"id",kc)}handler(t){const n=t.get(en),r=n.pitchTopUndoElement();if(!r)return!1;const s=t.get(Dt);return Hi(r.undoMutations,s)?(n.popUndoToRedo(),!0):!1}},pn=new class extends Pc{constructor(){super(...arguments);C(this,"type",Wn.COMMAND);C(this,"id",Fc)}handler(t){const n=t.get(en),r=n.pitchTopRedoElement();if(!r)return!1;const s=t.get(Dt);return Hi(r.redoMutations,s)?(n.popRedoToUndo(),!0):!1}};exports.LocalUndoRedoService=class extends nt{constructor(n,r,s){super();C(this,"undoRedoStatus$");C(this,"_undoRedoStatus$",new Oe.BehaviorSubject({undos:0,redos:0}));C(this,"_undoStacks",new Map);C(this,"_redoStacks",new Map);C(this,"_batchingStatus",new Map);this._univerInstanceService=n,this._commandService=r,this._contextService=s,this.undoRedoStatus$=this._undoRedoStatus$.asObservable(),this.disposeWithMe(this._commandService.registerCommand(gn)),this.disposeWithMe(this._commandService.registerCommand(pn)),this.disposeWithMe(Qe(()=>this._undoRedoStatus$.complete())),this.disposeWithMe(Qe(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>HC&&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&&(this._getRedoStackForFocused().push(r),this._updateStatus())}popRedoToUndo(){const r=this._getRedoStackForFocused().pop();r&&(this._getUndoStackForFocused().push(r),this._updateStatus())}__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),Qe(()=>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(Tn),s=this._contextService.getContextValue(Lc),i=this._contextService.getContextValue(xc);return r?s?n=Li:i?n=xi: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=jC([$s(0,an),$s(1,Dt),$s(2,_r)],exports.LocalUndoRedoService);const bs=_t("core.resource-manager.service"),mi={[Mt.Editor]:"Editor",[Mt.Owner]:"Owner",[Mt.Reader]:"Reader",[Mt.UNRECOGNIZED]:"UNRECOGNIZED"},us=e=>e?{userID:`${mi[e]}_${re.generateRandomId(8)}`,name:mi[e],avatar:""}:{userID:"",name:"",avatar:"",anonymous:!0,canBindAnonymous:!1},WC=(e,t)=>e.startsWith(mi[t]);class $n{constructor(){C(this,"_model",new Map);C(this,"_userChange$",new Oe.Subject);C(this,"userChange$",this._userChange$.asObservable());C(this,"_currentUser$",new Oe.BehaviorSubject(us()));C(this,"currentUser$",this._currentUser$.asObservable())}getCurrentUser(){return this._currentUser$.getValue()}setCurrentUser(t){this.addUser(t),this._currentUser$.next(t)}addUser(t){this._model.set(t.userID,t),this._userChange$.next({type:"add",user:t})}getUser(t,n){const r=this._model.get(t);if(r)return r;n&&n()}delete(t){const n=this.getUser(t);this._model.delete(t),n&&this._userChange$.next({type:"delete",user:n})}clear(){this._model.clear(),this._userChange$.next({type:"clear"})}list(){return Array.from(this._model.values())}}var zC=Object.defineProperty,YC=Object.getOwnPropertyDescriptor,VC=(e,t,n,r)=>{for(var s=r>1?void 0:r?YC(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=(r?o(t,n,s):o(s))||s);return r&&s&&zC(t,n,s),s},wa=(e,t)=>(n,r)=>t(n,r,e);exports.AuthzIoLocalService=class{constructor(t,n){C(this,"_permissionMap",new Map([]));this._resourceManagerService=t,this._userManagerService=n,this._initSnapshot(),this._initDefaultUser()}_initDefaultUser(){const t=this._userManagerService.getCurrentUser();t&&t.userID||this._userManagerService.setCurrentUser(us(Mt.Owner))}_getRole(t){const n=this._userManagerService.getCurrentUser();return n?WC(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:[$e.UNIVER_SHEET,$e.UNIVER_DOC,$e.UNIVER_SLIDE],onLoad:(t,n)=>{for(const r in n)this._permissionMap.set(r,n[r])},onUnLoad:()=>{this._permissionMap.clear()}})}async create(t){return zt(8)}async allowed(t){return Promise.resolve([])}async batchAllowed(t){return Promise.resolve([])}async list(t){const n=[];return t.objectIDs.forEach(r=>{const s=this._permissionMap.get(r);if(s){const i={objectID:r,unitID:t.unitID,objectType:s.objectType,name:s.name,shareOn:!1,shareRole:Mt.Owner,shareScope:-1,scope:{read:ci.AllCollaborator,edit:ci.AllCollaborator},creator:us(Mt.Owner),strategies:[{action:6,role:1},{action:16,role:1},{action:17,role:1},{action:18,role:1},{action:19,role:1},{action:33,role:1},{action:34,role:1},{action:35,role:1},{action:36,role:1},{action:37,role:1},{action:38,role:1},{action:39,role:1},{action:40,role:1}],actions:t.actions.map(o=>({action:o,allowed:this._getRole(Mt.Owner)||this._getRole(Mt.Editor)}))};n.push(i)}}),n}async listCollaborators(){return[]}async listRoles(){return{roles:[],actions:[]}}async deleteCollaborator(){}async update(t){}async updateCollaborator(){}async createCollaborator(){}async putCollaborators(t){}};exports.AuthzIoLocalService=VC([wa(0,bs),wa(1,it($n))],exports.AuthzIoLocalService);const $c=_t("IAuthzIoIoService"),Bc=_t("univer.config-service");class jc{constructor(){C(this,"_configChanged$",new Oe.Subject);C(this,"configChanged$",this._configChanged$.asObservable());C(this,"_config",new Map)}dispose(){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=Di(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 Oe.Observable(n=>{Object.prototype.hasOwnProperty.call(this._config,t)&&n.next(this._config.get(t));const r=this.configChanged$.pipe(Oe.filter(s=>Object.prototype.hasOwnProperty.call(s,t))).subscribe(s=>n.next(s[t]));return()=>r.unsubscribe()})}}class Hc extends nt{constructor(){super(...arguments);C(this,"_error$",new Oe.Subject);C(this,"error$",this._error$.asObservable())}dispose(){this._error$.complete()}emit(n){this._error$.next({errorKey:n})}}class lr extends nt{constructor(){super();C(this,"_currentLocale$",new Oe.BehaviorSubject(Er.ZH_CN));C(this,"currentLocale$",this._currentLocale$.asObservable());C(this,"_locales",null);C(this,"localeChanged$",new Oe.Subject);C(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(Qe(()=>this.localeChanged$.complete()))}get _currentLocale(){return this._currentLocale$.value}load(n){var r;this._locales=Di((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 GC=Object.defineProperty,KC=Object.getOwnPropertyDescriptor,XC=(e,t,n,r)=>{for(var s=r>1?void 0:r?KC(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=(r?o(t,n,s):o(s))||s);return r&&s&&GC(t,n,s),s},QC=(e,t)=>(n,r)=>t(n,r,e);exports.MentionIOLocalService=class{constructor(t){this._userManagerService=t}async list(t){return{list:[{type:rs.PERSON,mentions:[{objectType:rs.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=XC([QC(0,it($n))],exports.MentionIOLocalService);const Wc=_t("univer.service.mention-io");var no=(e=>(e.INIT="init",e.FETCHING="fetching",e.DONE="done",e))(no||{});const zc=_t("univer.permission-service");class Yc extends nt{constructor(){super(...arguments);C(this,"_permissionPointMap",new Map);C(this,"_permissionPointUpdate$",new Oe.Subject);C(this,"permissionPointUpdate$",this._permissionPointUpdate$.asObservable());C(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 Oe.BehaviorSubject,s=r?n.getValue():n;if(!s.id)return!1;if(this._permissionPointMap.get(s.id))throw new Error(`${s.id} PermissionPoint already exists`);return this._permissionPointMap.set(s.id,r?n:new Oe.BehaviorSubject(s)),this._permissionPointUpdate$.next(s),!0}updatePermissionPoint(n,r){const s=this._permissionPointMap.get(n);if(!s)return;const i=s.getValue();i.value=r,i.status=no.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 Oe.combineLatest(r).pipe($r.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 Vc(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}const Gc=Symbol("DependentOn");class _i extends nt{onStarting(){}onReady(){}onRendered(){}onSteady(){}getUniverInstanceType(){return this.constructor.type}getPluginName(){return this.constructor.pluginName}}C(_i,"pluginName"),C(_i,"type",$e.UNIVER_UNKNOWN);class qC{constructor(){C(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)}}class JC{constructor(){C(this,"_pluginsRegistered",[])}registerPlugin(t,n){this._pluginsRegistered.push({plugin:t,options:n})}getRegisterPlugins(){return this._pluginsRegistered.slice()}removePlugins(){this._pluginsRegistered=[]}}var ZC=Object.defineProperty,eR=Object.getOwnPropertyDescriptor,Kc=(e,t,n,r)=>{for(var s=r>1?void 0:r?eR(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=(r?o(t,n,s):o(s))||s);return r&&s&&ZC(t,n,s),s},Zr=(e,t)=>(n,r)=>t(n,r,e);const tR=4;function nR(...e){return function(t){t[Gc]=e}}exports.PluginService=class{constructor(t){C(this,"_pluginHolderForUniver");C(this,"_pluginHoldersForTypes",new Map);C(this,"_seenPlugins",new Set);C(this,"_flushTimer");this._injector=t,this._pluginHolderForUniver=this._injector.createInstance(cs,this._checkPluginSeen.bind(this),this._immediateInitPlugin.bind(this)),this._pluginHoldersForTypes.set($e.UNIVER_UNKNOWN,this._pluginHolderForUniver),this._pluginHolderForUniver.start()}dispose(){this._clearFlushTimer();for(const t of this._pluginHoldersForTypes.values())t.dispose();this._pluginHolderForUniver.dispose()}registerPlugin(t,n){this._assertPluginValid(t),this._scheduleInitPlugin();const{type:r}=t;r===$e.UNIVER_UNKNOWN?(this._pluginHolderForUniver.register(t,n),this._pluginHolderForUniver.flush()):this._ensurePluginHolderForType(r).register(t,n)}startPluginForType(t){this._ensurePluginHolderForType(t).start()}_ensurePluginHolderForType(t){if(!this._pluginHoldersForTypes.has(t)){const n=this._injector.createInstance(cs,this._checkPluginSeen.bind(this),this._immediateInitPlugin.bind(this));return this._pluginHoldersForTypes.set(t,n),n}return this._pluginHoldersForTypes.get(t)}_immediateInitPlugin(t){this._seenPlugins.add(t.pluginName),this._ensurePluginHolderForType(t.type).immediateInitPlugin(t)}_checkPluginSeen(t){return this._seenPlugins.has(t.pluginName)}_assertPluginValid(t){const{type:n,pluginName:r}=t;if(n===$e.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)}_scheduleInitPlugin(){this._flushTimer===void 0&&(this._flushTimer=setTimeout(()=>{this._pluginHolderForUniver.started||this._pluginHolderForUniver.start(),this._flushPlugins(),this._clearFlushTimer()},tR))}_clearFlushTimer(){this._flushTimer&&(clearTimeout(this._flushTimer),this._flushTimer=void 0)}_flushPlugins(){this._pluginHolderForUniver.flush();for(const[t,n]of this._pluginHoldersForTypes)n.started&&n.flush()}};exports.PluginService=Kc([Zr(0,it(Ct))],exports.PluginService);let cs=class extends nt{constructor(t,n,r,s,i){super();C(this,"_started",!1);C(this,"_warnedAboutOnStartingDeprecation",!1);C(this,"_pluginRegistry",new JC);C(this,"_pluginStore",new qC);C(this,"_pluginsInBatches",[]);this._checkPluginRegistered=t,this._registerPlugin=n,this._logService=r,this._injector=s,this._lifecycleService=i,this.disposeWithMe(this._lifecycleService.lifecycle$.pipe(Oe.skip(1)).subscribe(o=>{this._pluginsInBatches.forEach(a=>this._runStage(a,o))}))}get started(){return this._started}dispose(){super.dispose(),this._pluginStore.forEachPlugin(t=>t.dispose()),this._pluginStore.removePlugins(),this._pluginRegistry.removePlugins(),this._pluginsInBatches.length=0}register(t,n){this._pluginRegistry.registerPlugin(t,n)}immediateInitPlugin(t){const n=this._initPlugin(t,void 0);this._pluginsRunLifecycle([n])}start(){this._started||(this._started=!0,this.flush())}flush(){if(!this._started)return;const t=this._pluginRegistry.getRegisterPlugins().map(({plugin:n,options:r})=>this._initPlugin(n,r));t.length&&(this._pluginsRunLifecycle(t),this._pluginRegistry.removePlugins())}_initPlugin(t,n){const r=t[Gc];if(r){const i=()=>{const o=r.find(a=>!this._checkPluginRegistered(a));return o?(this._logService.debug("[PluginService]",`Plugin "${t.pluginName}" depends on "${o.pluginName}" which is not registered. Univer will automatically register it with default configuration.`),this._registerPlugin(o,void 0),!0):!1};for(;i(););}const s=this._injector.createInstance(t,n);return this._pluginStore.addPlugin(s),this._logService.debug("[PluginService]",`Plugin "${s.getPluginName()}" registered.`),s}_pluginsRunLifecycle(t){Uc(this._lifecycleService.stage).subscribe(n=>this._runStage(t,n)),this._pluginsInBatches.push(t)}_runStage(t,n){t.forEach(r=>{switch(n){case We.Starting:r.onStarting();break;case We.Ready:r.onReady();break;case We.Rendered:r.onRendered();break;case We.Steady:r.onSteady();break}})}};cs=Kc([Zr(2,At),Zr(3,it(Ct)),Zr(4,it(exports.LifecycleService))],cs);var rR=Object.defineProperty,sR=Object.getOwnPropertyDescriptor,iR=(e,t,n,r)=>{for(var s=r>1?void 0:r?sR(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=(r?o(t,n,s):o(s))||s);return r&&s&&rR(t,n,s),s},Aa=(e,t)=>(n,r)=>t(n,r,e);let Ei=class extends nt{constructor(e,t){super(),this._resourceManagerService=e,this._univerInstanceService=t,this._init()}_init(){const e=n=>{n.businesses.forEach(r=>{switch(r){case $e.UNRECOGNIZED:case $e.UNIVER_UNKNOWN:case $e.UNIVER_SLIDE:case $e.UNIVER_DOC:{this._univerInstanceService.getAllUnitsForType($e.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 $e.UNIVER_SHEET:this._univerInstanceService.getAllUnitsForType($e.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$($e.UNIVER_SHEET).subscribe(n=>{this._resourceManagerService.loadResources(n.getUnitId(),n.getSnapshot().resources)})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitAdded$($e.UNIVER_DOC).subscribe(n=>{const r=n.getUnitId();il(r)||this._resourceManagerService.loadResources(n.getUnitId(),n.getSnapshot().resources)})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitDisposed$($e.UNIVER_SHEET).subscribe(n=>{this._resourceManagerService.unloadResources(n.getUnitId())})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitDisposed$($e.UNIVER_DOC).subscribe(n=>{this._resourceManagerService.unloadResources(n.getUnitId())}))}saveUnit(e){const t=this._univerInstanceService.getUnit(e);if(!t)return null;const n=this._resourceManagerService.getResources(e,t.type),r=re.deepClone(t.getSnapshot());return r.resources=n,r}};Ei=iR([Aa(0,it(bs)),Aa(1,it(an))],Ei);const Ci=_t("resource-loader-service");class Xc extends nt{constructor(){super(...arguments);C(this,"_resourceMap",new Map);C(this,"_register$",new Oe.Subject);C(this,"register$",this._register$.asObservable())}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),Qe(()=>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{console.error("LoadResources Error!")}})}unloadResources(n){this.getAllResourceHooks().forEach(r=>{r.onUnLoad(n)})}dispose(){this._register$.complete(),this._resourceMap.clear()}}class ro extends nt{constructor(){super();C(this,"_currentTheme");C(this,"_currentTheme$",new Oe.BehaviorSubject({}));C(this,"currentTheme$",this._currentTheme$.asObservable());this.disposeWithMe(Qe(()=>this._currentTheme$.complete()))}getCurrentTheme(){if(!this._currentTheme)throw new Error("[ThemeService]: current theme is not set!");return this._currentTheme}setTheme(n){this._currentTheme=n,this._currentTheme$.next(n)}}class Qc{constructor(t={},n){C(this,"_startedTypes",new Set);C(this,"_injector");C(this,"_disposingCallbacks",new Rs);const r=this._injector=oR(n,t==null?void 0:t.override),{theme:s,locale:i,locales:o,logLevel:a}=t;s&&this._injector.get(ro).setTheme(s),o&&this._injector.get(lr).load(o),i&&this._injector.get(lr).setLocale(i),a&&this._injector.get(At).setLogLevel(a),this._init(r)}get _univerInstanceService(){return this._injector.get(an)}get _pluginService(){return this._injector.get(exports.PluginService)}__getInjector(){return this._injector}onDispose(t){const n=this._disposingCallbacks.add(Qe(t));return Qe(()=>n.dispose(!0))}dispose(){this._disposingCallbacks.dispose(),this._injector.dispose()}setLocale(t){this._injector.get(lr).setLocale(t)}createUnit(t,n){return this._univerInstanceService.createUnit(t,n)}createUniverSheet(t){return this._injector.get(At).warn("[Univer]: Univer.createUniverSheet is deprecated, use createUnit instead"),this._univerInstanceService.createUnit($e.UNIVER_SHEET,t)}createUniverDoc(t){return this._injector.get(At).warn("[Univer]: Univer.createUniverDoc is deprecated, use createUnit instead"),this._univerInstanceService.createUnit($e.UNIVER_DOC,t)}createUniverSlide(t){return this._injector.get(At).warn("[Univer]: Univer.createUniverSlide is deprecated, use createUnit instead"),this._univerInstanceService.createUnit($e.UNIVER_SLIDE,t)}_init(t){this._univerInstanceService.registerCtorForType($e.UNIVER_SHEET,exports.Workbook),this._univerInstanceService.registerCtorForType($e.UNIVER_DOC,Pt),this._univerInstanceService.registerCtorForType($e.UNIVER_SLIDE,to);const n=t.get(an);n.__setCreateHandler((r,s,i,o)=>{if(!this._startedTypes.has(r)){this._pluginService.startPluginForType(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<We.Ready&&(this._injector.get(exports.LifecycleService).stage=We.Ready)}registerPlugin(t,n){this._pluginService.registerPlugin(t,n)}}function oR(e,t){const n=Vc([[Hc],[lr],[ro],[exports.LifecycleService],[exports.PluginService],[$n],[an,{useClass:exports.UniverInstanceService}],[zc,{useClass:Yc}],[At,{useClass:Tl,lazy:!0}],[Dt,{useClass:exports.CommandService}],[en,{useClass:exports.LocalUndoRedoService,lazy:!0}],[Bc,{useClass:jc}],[_r,{useClass:wl}],[bs,{useClass:Xc,lazy:!0}],[Ci,{useClass:Ei,lazy:!0}],[$c,{useClass:exports.AuthzIoLocalService,lazy:!0}],[Wc,{useClass:exports.MentionIOLocalService,lazy:!0}]],t),r=e?e.createChild(n):new Ct(n);return Il(r,[[$n],[Ci]]),r}var aR=Object.defineProperty,lR=Object.getOwnPropertyDescriptor,uR=(e,t,n,r)=>{for(var s=r>1?void 0:r?lR(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=(r?o(t,n,s):o(s))||s);return r&&s&&aR(t,n,s),s},cR=(e,t)=>(n,r)=>t(n,r,e);exports.FBlob=class extends Ss{constructor(t,n){super(),this._blob=t,this._injector=n}copyBlob(){return this._injector.createInstance(exports.FBlob,this._blob)}getAs(t){const n=this.copyBlob();return n.setContentType(t),n}getDataAsString(t){return this._blob===null?Promise.resolve(""):t===void 0?this._blob.text():new Promise((n,r)=>{this._blob.arrayBuffer().then(s=>{const i=new TextDecoder(t).decode(s);n(i)}).catch(s=>{r(new Error(`Failed to read Blob as ArrayBuffer: ${s.message}`))})})}getBytes(){return this._blob?this._blob.arrayBuffer().then(t=>new Uint8Array(t)):Promise.reject(new Error("Blob is undefined or null."))}setBytes(t){return this._blob=new Blob([t]),this}setDataFromString(t,n){const r=n!=null?n:"text/plain",s=new Blob([t],{type:r});return this._blob=s,this}getContentType(){var t;return(t=this._blob)==null?void 0:t.type}setContentType(t){var n;return this._blob=(n=this._blob)==null?void 0:n.slice(0,this._blob.size,t),this}};exports.FBlob=uR([cR(1,it(Ct))],exports.FBlob);var hR=Object.defineProperty,dR=Object.getOwnPropertyDescriptor,fR=(e,t,n,r)=>{for(var s=r>1?void 0:r?dR(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=(r?o(t,n,s):o(s))||s);return r&&s&&hR(t,n,s),s},gR=(e,t)=>(n,r)=>t(n,r,e);let Ri=class extends Zi{constructor(e,t){super(t),this.doc=e}};Ri=fR([gR(1,it(Ct))],Ri);var so=(e=>(e[e.INFO=0]="INFO",e[e.STOP=1]="STOP",e[e.WARNING=2]="WARNING",e))(so||{}),io=(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))(io||{}),oo=(e=>(e[e.TEXT=0]="TEXT",e[e.ARROW=1]="ARROW",e[e.CUSTOM=2]="CUSTOM",e))(oo||{}),ao=(e=>(e.VALID="valid",e.INVALID="invalid",e.VALIDATING="validating",e))(ao||{}),lo=(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))(lo||{});const Dn=class Dn{static get(){if(this._instance)return this._instance;const t=new Dn;return this._instance=t,t}static extend(t){Object.getOwnPropertyNames(t.prototype).forEach(n=>{n!=="constructor"&&(this.prototype[n]=t.prototype[n])}),Object.getOwnPropertyNames(t).forEach(n=>{n!=="prototype"&&n!=="name"&&n!=="length"&&(this[n]=t[n])})}constructor(){for(const t in Dn.prototype)this[t]=Dn.prototype[t]}get UniverInstanceType(){return $e}get LifecycleStages(){return We}get DataValidationType(){return lo}get DataValidationErrorStyle(){return so}get DataValidationRenderMode(){return oo}get DataValidationOperator(){return io}get DataValidationStatus(){return ao}get CommandType(){return Wn}get BaselineOffset(){return Ut}get BooleanNumber(){return Se}get HorizontalAlign(){return $t}get TextDecoration(){return Wi}get TextDirection(){return Pn}get VerticalAlign(){return tn}};C(Dn,"_instance");let hs=Dn;const xn=class xn{static get(){if(this._instance)return this._instance;const t=new xn;return this._instance=t,t}static extend(t){Object.getOwnPropertyNames(t.prototype).forEach(n=>{n!=="constructor"&&(this.prototype[n]=t.prototype[n])}),Object.getOwnPropertyNames(t).forEach(n=>{n!=="prototype"&&n!=="name"&&n!=="length"&&(this[n]=t[n])})}constructor(){for(const t in xn.prototype)this[t]=xn.prototype[t]}get DocCreated(){return"DocCreated"}get DocDisposed(){return"DocDisposed"}get LifeCycleChanged(){return"LifeCycleChanged"}get Redo(){return"Redo"}get Undo(){return"Undo"}get BeforeRedo(){return"BeforeRedo"}get BeforeUndo(){return"BeforeUndo"}get CommandExecuted(){return"CommandExecuted"}get BeforeCommandExecute(){return"BeforeCommandExecute"}};C(xn,"_instance");let ds=xn;var pR=Object.defineProperty,mR=Object.getOwnPropertyDescriptor,_R=(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=(r?o(t,n,s):o(s))||s);return r&&s&&pR(t,n,s),s},Ta=(e,t)=>(n,r)=>t(n,r,e);exports.FHooks=class extends Ss{constructor(t,n){super(),this._injector=t,this._lifecycleService=n}onStarting(t){return Qe(this._lifecycleService.lifecycle$.pipe(Oe.filter(n=>n===We.Starting)).subscribe(t))}onReady(t){return Qe(this._lifecycleService.lifecycle$.pipe(Oe.filter(n=>n===We.Ready)).subscribe(t))}onRendered(t){return Qe(this._lifecycleService.lifecycle$.pipe(Oe.filter(n=>n===We.Rendered)).subscribe(t))}onSteady(t){return Qe(this._lifecycleService.lifecycle$.pipe(Oe.filter(n=>n===We.Steady)).subscribe(t))}onBeforeUndo(t){return this._injector.get(Dt).beforeCommandExecuted(r=>{if(r.id===gn.id){const i=this._injector.get(en).pitchTopUndoElement();i&&t(i)}})}onUndo(t){return this._injector.get(Dt).onCommandExecuted(r=>{if(r.id===gn.id){const i=this._injector.get(en).pitchTopUndoElement();i&&t(i)}})}onBeforeRedo(t){return this._injector.get(Dt).beforeCommandExecuted(r=>{if(r.id===pn.id){const i=this._injector.get(en).pitchTopRedoElement();i&&t(i)}})}onRedo(t){return this._injector.get(Dt).onCommandExecuted(r=>{if(r.id===pn.id){const i=this._injector.get(en).pitchTopRedoElement();i&&t(i)}})}};exports.FHooks=_R([Ta(0,it(Ct)),Ta(1,it(exports.LifecycleService))],exports.FHooks);var ER=Object.defineProperty,CR=Object.getOwnPropertyDescriptor,RR=(e,t,n,r)=>{for(var s=r>1?void 0:r?CR(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=(r?o(t,n,s):o(s))||s);return r&&s&&ER(t,n,s),s},Na=(e,t)=>(n,r)=>t(n,r,e);let Ii=class extends Ss{constructor(e,t){super(),this._injector=e,this._userManagerService=t}getCurrentUser(){return this._userManagerService.getCurrentUser()}};Ii=RR([Na(0,it(Ct)),Na(1,it($n))],Ii);const gs=class gs{static get(){if(this._instance)return this._instance;const t=new gs;return this._instance=t,t}static extend(t){Object.getOwnPropertyNames(t.prototype).forEach(n=>{n!=="constructor"&&(this.prototype[n]=t.prototype[n])}),Object.getOwnPropertyNames(t).forEach(n=>{n!=="prototype"&&n!=="name"&&n!=="length"&&(this[n]=t[n])})}get rectangle(){return Yt}get numfmt(){return du}get tools(){return re}};C(gs,"_instance");let fs=gs;var IR=Object.defineProperty,vR=Object.getOwnPropertyDescriptor,yR=(e,t,n,r)=>{for(var s=r>1?void 0:r?vR(t,n):t,i=e.length-1,o;i>=0;i--)(o=e[i])&&(s=(r?o(t,n,s):o(s))||s);return r&&s&&IR(t,n,s),s},Pr=(e,t)=>(n,r)=>t(n,r,e);exports.FUniver=class extends Zi{constructor(n,r,s,i){super(n);C(this,"_eventRegistry",new Map);this._injector=n,this._commandService=r,this._univerInstanceService=s,this._lifecycleService=i,this.disposeWithMe(this._lifecycleService.lifecycle$.subscribe(o=>{this.fireEvent(this.Event.LifeCycleChanged,{stage:o})})),this.disposeWithMe(this._commandService.beforeCommandExecuted(o=>{if(!this._eventRegistry.get(this.Event.BeforeRedo)&&!this._eventRegistry.get(this.Event.BeforeUndo)&&!this._eventRegistry.get(this.Event.BeforeCommandExecute))return;const{id:a,type:l,params:c}=o,u={id:a,type:l,params:c};switch(o.id){case pn.id:this.fireEvent(this.Event.BeforeRedo,u);break;case gn.id:this.fireEvent(this.Event.BeforeUndo,u);break;default:this.fireEvent(this.Event.BeforeCommandExecute,u);break}if(u.cancel)throw new yl})),this.disposeWithMe(this._commandService.onCommandExecuted(o=>{if(!this._eventRegistry.get(this.Event.Redo)&&!this._eventRegistry.get(this.Event.Undo)&&!this._eventRegistry.get(this.Event.CommandExecuted))return;const{id:a,type:l,params:c}=o,u={id:a,type:l,params:c};switch(o.id){case pn.id:this.fireEvent(this.Event.Redo,u);break;case gn.id:this.fireEvent(this.Event.Undo,u);break;default:this.fireEvent(this.Event.CommandExecuted,u);break}})),this._initUnitEvent(this._injector),this._injector.onDispose(()=>{this.dispose()})}static newAPI(n){return(n instanceof Qc?n.__getInjector():n).createInstance(exports.FUniver)}_ensureEventRegistry(n){return this._eventRegistry.has(n)||this._eventRegistry.set(n,new Os),this._eventRegistry.get(n)}_initUnitEvent(n){const r=n.get(an);this.disposeWithMe(r.unitDisposed$.subscribe(s=>{this._eventRegistry.get(this.Event.DocDisposed)&&s.type===$e.UNIVER_DOC&&this.fireEvent(this.Event.DocDisposed,{unitId:s.getUnitId(),unitType:s.type,snapshot:s.getSnapshot()})})),this.disposeWithMe(r.unitAdded$.subscribe(s=>{if(this._eventRegistry.get(this.Event.DocCreated)&&s.type===$e.UNIVER_DOC){const i=s,o=n.createInstance(Ri,i);this.fireEvent(this.Event.DocCreated,{unitId:s.getUnitId(),type:s.type,doc:o,unit:o})}}))}_eventListend(n){return this._eventRegistry.get(n)}disposeUnit(n){return this._univerInstanceService.disposeUnit(n)}getCurrentLifecycleStage(){return this._injector.get(exports.LifecycleService).stage}undo(){return this._commandService.executeCommand(gn.id)}redo(){return this._commandService.executeCommand(pn.id)}onBeforeCommandExecute(n){return this._commandService.beforeCommandExecuted((r,s)=>{n(r,s)})}onCommandExecuted(n){return this._commandService.onCommandExecuted((r,s)=>{n(r,s)})}executeCommand(n,r,s){return this._commandService.executeCommand(n,r,s)}syncExecuteCommand(n,r,s){return this._commandService.syncExecuteCommand(n,r,s)}getHooks(){return this._injector.createInstance(exports.FHooks)}get Enum(){return hs.get()}get Event(){return ds.get()}get Util(){return fs.get()}addEvent(n,r){return this._ensureEventRegistry(n).add(r),Qe(()=>this._ensureEventRegistry(n).delete(r))}fireEvent(n,r){var s;return(s=this._eventRegistry.get(n))==null||s.getData().forEach(i=>{i(r)}),r.cancel}hasEventCallback(n){var s,i;return((i=(s=this._eventRegistry.get(n))==null?void 0:s.getData().length)!=null?i:0)>0}getUserManager(){return this._injector.createInstance(Ii)}newBlob(){return this._injector.createInstance(exports.FBlob)}newColor(){return new Cr}newRichText(n){return sn.create(n)}newRichTextValue(n){return jt.create(n)}newParagraphStyle(n){return kn.create(n)}newParagraphStyleValue(n){return Vn.create(n)}newTextStyle(n){return Wt.create(n)}newTextStyleValue(n){return Yn.create(n)}newTextDecoration(n){return new Bt(n)}};exports.FUniver=yR([Pr(0,it(Ct)),Pr(1,Dt),Pr(2,an),Pr(3,it(exports.LifecycleService))],exports.FUniver);function qc(e){return/^-?\d+(\.\d+)?$/.test(e)}function SR(e){return qc(e)?Number(e)<=Number.MAX_SAFE_INTEGER:!1}function OR(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.close(),t.port2.close()}}function bR(e,t){return t.forEach(n=>e.add(n)),e}function wR(e,t,n,r){var c;if(t==="")return e;const s={id:"mock-id",body:e,documentStyle:{}},i=new Pt(s),o=t.length;let a;for(;(a=(r?i.getBody().dataStream:i.getBody().dataStream.toLowerCase()).indexOf(t))>=0;){const h=new Ke,u=Vt.getInstance();if(a>0&&h.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 E=d.customRanges[0];f.customRanges=[{...E,startIndex:0,endIndex:n.length-1}]}h.insert(n.length,f)}h.delete(o),i.apply(u.editOp(h.serialize()))}const l=i.getBody();return i.dispose(),l}const AR="__default_document_sub_component_id20231101__";class Jc{constructor(){C(this,"skipNextObservers",!1);C(this,"lastReturnValue");C(this,"isStopPropagation",!1)}stopPropagation(){this.isStopPropagation=!0}}class TR extends Oe.Subject{constructor(){super(...arguments);C(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 Jc;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 NR(e){return new Oe.Observable(t=>{const n=e.subscribeEvent(r=>{t.next(r)});return()=>n.unsubscribe()})}const MR=_t("ILocalStorageService");function DR(e){return!(e.length===0||e.length>31||e.startsWith("'")||e.endsWith("'")||/[:\\\/\?\*\[\]]/.test(e))}function xR(e){return new Promise(t=>setTimeout(t,e))}function LR(e=1){return new Promise(t=>{let n=0;const r=()=>{n++,n>=e?t():requestAnimationFrame(r)};requestAnimationFrame(r)})}var uo=(e=>(e.URL="URL",e.UUID="UUID",e.BASE64="BASE64",e))(uo||{}),Zc=(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))(Zc||{});const vi=_t("core.image-io.service");class UR{constructor(t,n=100){C(this,"_imageCacheMap");this._injector=t,this._imageCacheMap=new hr(n)}_getImageCacheKey(t,n){return`${t}-${n}`}getImage(t,n,r,s){const i=this._getImageCacheKey(t,n);let o=this._imageCacheMap.get(i);return o||((async()=>{o=new Image;const a=this._injector.has(vi)?this._injector.get(vi):null;if(t===uo.UUID)try{o.src=await(a==null?void 0:a.getImage(n))||""}catch(l){console.error(l)}else o.src=n;o.onload=()=>{r==null||r()},o.onerror=()=>{s==null||s()},this._imageCacheMap.set(i,o)})(),null)}}const PR=["script","style","meta","comment","link"];var eh=(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))(eh||{});const Ma=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],Bs=1,Xn=8;class co{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!==Bs)throw new Error(`Got v${s} data when expected v${Bs}.`);const i=Ma[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 co(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=Ma.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,Xn,t),this.coords=new this.ArrayType(this.data,Xn+a+l,t*2),this._pos=t*2,this._finished=!0):(this.data=new ArrayBuffer(Xn+o+a+l),this.ids=new this.IndexArrayType(this.data,Xn,t),this.coords=new this.ArrayType(this.data,Xn+a+l,t*2),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,(Bs<<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 yi(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 h=l.pop()||0,u=l.pop()||0,d=l.pop()||0;if(u-d<=a){for(let O=d;O<=u;O++){const T=o[2*O],V=o[2*O+1];T>=t&&T<=r&&V>=n&&V<=s&&c.push(i[O])}continue}const f=d+u>>1,E=o[2*f],R=o[2*f+1];E>=t&&E<=r&&R>=n&&R<=s&&c.push(i[f]),(h===0?t<=E:n<=R)&&(l.push(d),l.push(f-1),l.push(1-h)),(h===0?r>=E:s>=R)&&(l.push(f+1),l.push(u),l.push(1-h))}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 h=a.pop()||0,u=a.pop()||0,d=a.pop()||0;if(u-d<=o){for(let O=d;O<=u;O++)Da(i[2*O],i[2*O+1],t,n)<=c&&l.push(s[O]);continue}const f=d+u>>1,E=i[2*f],R=i[2*f+1];Da(E,R,t,n)<=c&&l.push(s[f]),(h===0?t-r<=E:n-r<=R)&&(a.push(d),a.push(f-1),a.push(1-h)),(h===0?t+r>=E:n+r>=R)&&(a.push(f+1),a.push(u),a.push(1-h))}return l}}function yi(e,t,n,r,s,i){if(s-r<=n)return;const o=r+s>>1;th(e,t,o,r,s,i),yi(e,t,n,r,o-1,1-i),yi(e,t,n,o+1,s,1-i)}function th(e,t,n,r,s,i){for(;s>r;){if(s-r>600){const c=s-r+1,h=n-r+1,u=Math.log(c),d=.5*Math.exp(2*u/3),f=.5*Math.sqrt(u*d*(c-d)/c)*(h-c/2<0?-1:1),E=Math.max(r,Math.floor(n-h*d/c+f)),R=Math.min(s,Math.floor(n+(c-h)*d/c+f));th(e,t,n,E,R,i)}const o=t[2*n+i];let a=r,l=s;for(Qn(e,t,r,n),t[2*s+i]>o&&Qn(e,t,r,s);a<l;){for(Qn(e,t,a,l),a++,l--;t[2*a+i]<o;)a++;for(;t[2*l+i]>o;)l--}t[2*r+i]===o?Qn(e,t,r,l):(l++,Qn(e,t,l,s)),l<=n&&(r=l+1),n<=l&&(s=l-1)}}function Qn(e,t,n,r){js(e,n,r),js(t,2*n,2*r),js(t,2*n+1,2*r+1)}function js(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function Da(e,t,n,r){const s=e-n,i=t-r;return s*s+i*i}function nh(e,t,n=0,r=e.length-1,s=FR){for(;r>n;){if(r-n>600){const l=r-n+1,c=t-n+1,h=Math.log(l),u=.5*Math.exp(2*h/3),d=.5*Math.sqrt(h*u*(l-u)/l)*(c-l/2<0?-1:1),f=Math.max(n,Math.floor(t-c*u/l+d)),E=Math.min(r,Math.floor(t+(l-c)*u/l+d));nh(e,t,f,E,s)}const i=e[t];let o=n,a=r;for(qn(e,n,t),s(e[r],i)>0&&qn(e,n,r);o<a;){for(qn(e,o,a),o++,a--;s(e[o],i)<0;)o++;for(;s(e[a],i)>0;)a--}s(e[n],i)===0?qn(e,n,a):(a++,qn(e,a,r)),a<=t&&(n=a+1),t<=a&&(r=a-1)}}function qn(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function FR(e,t){return e<t?-1:e>t?1:0}class Si{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(!kr(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;kr(t,l)&&(n.leaf?r.push(a):Ws(t,l)?this._all(a,r):i.push(a))}n=i.pop()}return r}collides(t){let n=this.data;if(!kr(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(kr(t,o)){if(n.leaf||Ws(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=On([]),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 h=kR(t,r.children,n);if(h!==-1)return r.children.splice(h,1),i.push(r),this._condense(i),this}!c&&!r.leaf&&Ws(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=On(t.slice(n,r+1)),yn(a,this.toBBox),a;s||(s=Math.ceil(Math.log(i)/Math.log(o)),o=Math.ceil(i/Math.pow(o,s-1))),a=On([]),a.leaf=!1,a.height=s;const l=Math.ceil(i/o),c=l*Math.ceil(Math.sqrt(o));xa(t,n,r,c,this.compareMinX);for(let h=n;h<=r;h+=c){const u=Math.min(h+c-1,r);xa(t,h,u,l,this.compareMinY);for(let d=h;d<=u;d+=l){const f=Math.min(d+l-1,u);a.children.push(this._build(t,d,f,s-1))}}return yn(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],h=Hs(c),u=jR(t,c)-h;u<o?(o=u,i=h<i?h:i,a=c):u===o&&h<i&&(i=h,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),ir(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=On(r.children.splice(o,r.children.length-o));a.height=r.height,a.leaf=r.leaf,yn(r,this.toBBox),yn(a,this.toBBox),n?t[n-1].children.push(a):this._splitRoot(r,a)}_splitRoot(t,n){this.data=On([t,n]),this.data.height=t.height+1,this.data.leaf=!1,yn(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=sr(t,0,a,this.toBBox),c=sr(t,a,r,this.toBBox),h=HR(l,c),u=Hs(l)+Hs(c);h<i?(i=h,s=a,o=u<o?u:o):h===i&&u<o&&(o=u,s=a)}return s||r-n}_chooseSplitAxis(t,n,r){const s=t.leaf?this.compareMinX:$R,i=t.leaf?this.compareMinY:BR,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=sr(t,0,n,i),a=sr(t,r-n,r,i);let l=Fr(o)+Fr(a);for(let c=n;c<r-n;c++){const h=t.children[c];ir(o,t.leaf?i(h):h),l+=Fr(o)}for(let c=r-n-1;c>=n;c--){const h=t.children[c];ir(a,t.leaf?i(h):h),l+=Fr(a)}return l}_adjustParentBBoxes(t,n,r){for(let s=r;s>=0;s--)ir(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():yn(t[n],this.toBBox)}}function kR(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 yn(e,t){sr(e,0,e.children.length,t,e)}function sr(e,t,n,r,s){s||(s=On(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];ir(s,e.leaf?r(o):o)}return s}function ir(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 $R(e,t){return e.minX-t.minX}function BR(e,t){return e.minY-t.minY}function Hs(e){return(e.maxX-e.minX)*(e.maxY-e.minY)}function Fr(e){return e.maxX-e.minX+(e.maxY-e.minY)}function jR(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 HR(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 Ws(e,t){return e.minX<=t.minX&&e.minY<=t.minY&&t.maxX<=e.maxX&&t.maxY<=e.maxY}function kr(e,t){return t.minX<=e.maxX&&t.minY<=e.maxY&&t.maxX>=e.minX&&t.maxY>=e.minY}function On(e){return{children:e,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function xa(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;nh(e,o,t,n,s),i.push(t,o,o,n)}}class WR{constructor(t=!1){C(this,"_tree",new Map);C(this,"_oneCellCache",new Map);C(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 Si),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:h,endColumn:u}=s;for(let d=l;d<=h;d++){const f=a.get(d);if(f)for(let E=c;E<=u;E++){const R=f.get(E);R&&R.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 E;const{unitId:n,sheetId:r,range:s}=t,{startRow:i,startColumn:o,endRow:a,endColumn:l}=s,c=(E=this._kdTree.get(n))==null?void 0:E.get(r);if(!c)return[];const{tree:h,items:u}=c,d=h.range(o,i,l,a),f=[];for(const R of d){const O=u[R];f.push(...Array.from(O.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 co(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 h=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),h.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 Si;s.fromJSON(t[n][r]),this._tree.get(n).set(r,s)}}}}ah();exports.ABCToNumber=x_;exports.AbsoluteRefType=tt;exports.ActionIterator=Sn;exports.AlignTypeH=Bu;exports.AlignTypeV=ju;exports.ArrangeTypeEnum=zu;exports.ArrowsAndMarkersShapes=Gl;exports.AsyncInterceptorManager=JE;exports.AutoFillSeries=Pl;exports.BaselineOffset=Ut;exports.BasicShapes=Vl;exports.BlockType=Cu;exports.BooleanNumber=Se;exports.BorderStyleTypes=Xe;exports.BorderType=Fl;exports.BuildTextUtils=st;exports.BulletAlignment=Ir;exports.COLORS=ii;exports.CanceledError=yl;exports.CellModeEnum=bn;exports.CellValueType=nn;exports.Color=En;exports.ColorBuilder=Cr;exports.ColorKit=bt;exports.ColorType=vt;exports.ColumnSeparatorType=vu;exports.CommandType=Wn;exports.CommonHideTypes=kl;exports.ConfigService=jc;exports.ContextService=wl;exports.CopyPasteType=$l;exports.CustomCommandExecutionError=ni;exports.CustomDecorationType=fn;exports.CustomRangeType=on;exports.DEFAULT_CELL=C_;exports.DEFAULT_DOC=Ji;exports.DEFAULT_DOCUMENT_SUB_COMPONENT_ID=AR;exports.DEFAULT_EMPTY_DOCUMENT_VALUE=sl;exports.DEFAULT_RANGE=__;exports.DEFAULT_RANGE_ARRAY=m_;exports.DEFAULT_SELECTION=E_;exports.DEFAULT_SLIDE=fu;exports.DEFAULT_STYLES=ct;exports.DEFAULT_WORKSHEET_COLUMN_COUNT=Oc;exports.DEFAULT_WORKSHEET_COLUMN_COUNT_KEY=hC;exports.DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT=Tc;exports.DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT_KEY=pC;exports.DEFAULT_WORKSHEET_COLUMN_WIDTH=wc;exports.DEFAULT_WORKSHEET_COLUMN_WIDTH_KEY=fC;exports.DEFAULT_WORKSHEET_ROW_COUNT=Sc;exports.DEFAULT_WORKSHEET_ROW_COUNT_KEY=cC;exports.DEFAULT_WORKSHEET_ROW_HEIGHT=bc;exports.DEFAULT_WORKSHEET_ROW_HEIGHT_KEY=dC;exports.DEFAULT_WORKSHEET_ROW_TITLE_WIDTH=Ac;exports.DEFAULT_WORKSHEET_ROW_TITLE_WIDTH_KEY=gC;exports.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY=Li;exports.DOCS_NORMAL_EDITOR_UNIT_ID_KEY=xi;exports.DOCS_ZEN_EDITOR_UNIT_ID_KEY=rl;exports.DOC_RANGE_TYPE=iu;exports.DashStyleType=Tu;exports.DataStreamTreeNodeType=_c;exports.DataStreamTreeTokenType=Jt;exports.DataValidationErrorStyle=so;exports.DataValidationImeMode=eh;exports.DataValidationOperator=io;exports.DataValidationRenderMode=oo;exports.DataValidationStatus=ao;exports.DataValidationType=lo;exports.DeleteDirection=Bl;exports.DependentOn=nR;exports.DesktopLogService=Tl;exports.DeveloperMetadataVisibility=jl;exports.Dimension=Hl;exports.Direction=Wl;exports.Disposable=nt;exports.DisposableCollection=Rs;exports.DocStyleType=_u;exports.DocumentDataModel=Pt;exports.DocumentFlavor=Gi;exports.DrawingTypeEnum=Yu;exports.EDITOR_ACTIVATED=xc;exports.EXTENSION_NAMES=gu;exports.ErrorService=Hc;exports.EventState=Jc;exports.EventSubject=TR;exports.FBase=Ss;exports.FBaseInitialable=Zi;exports.FEnum=hs;exports.FEventName=ds;exports.FOCUSING_COMMON_DRAWINGS=TC;exports.FOCUSING_DOC=nr;exports.FOCUSING_EDITOR_BUT_HIDDEN=yC;exports.FOCUSING_EDITOR_INPUT_FORMULA=SC;exports.FOCUSING_EDITOR_STANDALONE=bC;exports.FOCUSING_FX_BAR_EDITOR=Lc;exports.FOCUSING_PANEL_EDITOR=wC;exports.FOCUSING_SHEET=Tn;exports.FOCUSING_SLIDE=rr;exports.FOCUSING_UNIT=tr;exports.FOCUSING_UNIVER_EDITOR=OC;exports.FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE=AC;exports.FORMULA_EDITOR_ACTIVATED=NC;exports.FUtil=fs;exports.FollowNumberWithType=Eu;exports.FontItalic=ss;exports.FontStyleType=wn;exports.FontWeight=is;exports.GridType=Ru;exports.HLSColor=nu;exports.HorizontalAlign=$t;exports.IAuthzIoService=$c;exports.ICommandService=Dt;exports.IConfigService=Bc;exports.IContextService=_r;exports.IImageIoService=vi;exports.ILocalStorageService=MR;exports.ILogService=At;exports.IMentionIOService=Wc;exports.IPermissionService=zc;exports.IResourceLoaderService=Ci;exports.IResourceManagerService=bs;exports.IS_ROW_STYLE_PRECEDE_COLUMN_STYLE=_g;exports.IUndoRedoService=en;exports.IUniverInstanceService=an;exports.ImageCacheMap=UR;exports.ImageSourceType=uo;exports.ImageUploadStatusType=Zc;exports.Inject=it;exports.Injector=Ct;exports.InterceptorEffectEnum=An;exports.InterceptorManager=XE;exports.InterpolationPointType=zl;exports.JSON1=G_;exports.JSONX=Vt;exports.LRUHelper=Zn;exports.LRUMap=hr;exports.LifecycleStages=We;exports.ListGlyphType=Ne;exports.LocaleService=lr;exports.LocaleType=Er;exports.LogLevel=Al;exports.MOVE_BUFFER_VALUE=Jn;exports.Many=fl;exports.MemoryCursor=zn;exports.MentionType=rs;exports.NamedStyleType=wu;exports.NilCommand=Nl;exports.NumberUnitType=$u;exports.ObjectMatrix=xt;exports.ObjectRelativeFromH=Fu;exports.ObjectRelativeFromV=ku;exports.Optional=gl;exports.OtherShapes=Kl;exports.PRESET_LIST_TYPE=yr;exports.PageElementType=Vu;exports.PageOrientType=Wu;exports.PageType=Ki;exports.ParagraphElementType=Su;exports.ParagraphStyleBuilder=kn;exports.ParagraphStyleValue=Vn;exports.PermissionService=Yc;exports.PermissionStatus=no;exports.Plugin=_i;exports.PositionedObjectLayoutType=bu;exports.PresetListType=Lt;exports.ProtectionType=Yl;exports.QuickListType=lc;exports.QuickListTypeMap=Z_;exports.RANGE_DIRECTION=su;exports.RANGE_TYPE=xe;exports.RBush=Si;exports.RCDisposable=hp;exports.RGBA_PAREN=jp;exports.RGB_PAREN=Bp;exports.ROTATE_BUFFER_VALUE=Ul;exports.RTree=WR;exports.Range=Fn;exports.Rectangle=Yt;exports.RediConsumer=El;exports.RediContext=mr;exports.RediError=ot;exports.RediProvider=ji;exports.RedoCommand=pn;exports.RedoCommandId=Fc;exports.RefAlias=D_;exports.Registry=Os;exports.RegistryAsMap=eo;exports.RelativeDate=Ql;exports.RelativeSlideLink=Gu;exports.ResourceManagerService=Xc;exports.RgbColor=os;exports.RichTextBuilder=sn;exports.RichTextValue=jt;exports.RxDisposable=cp;exports.SHEET_EDITOR_UNITS=R_;exports.SectionType=Iu;exports.Self=dl;exports.SheetTypes=ql;exports.SheetViewModel=Mc;exports.SkipSelf=hl;exports.SliceBodyType=qi;exports.SlideDataModel=to;exports.SpacingRule=Au;exports.SpecialShapes=Xl;exports.Styles=Rc;exports.THEME_COLORS=tu;exports.TabStopAlignment=Nu;exports.TableAlignmentType=Du;exports.TableLayoutType=xu;exports.TableRowHeightRule=Uu;exports.TableSizeType=Mu;exports.TableTextWrapType=Lu;exports.TextDecoration=Wi;exports.TextDecorationBuilder=Bt;exports.TextDirection=Pn;exports.TextDirectionType=yu;exports.TextStyleBuilder=Wt;exports.TextStyleValue=Yn;exports.TextX=Ke;exports.TextXActionType=fe;exports.ThemeColor=as;exports.ThemeColorType=gt;exports.ThemeColors=Is;exports.ThemeService=ro;exports.Tools=re;exports.UndoCommand=gn;exports.UndoCommandId=kc;exports.UnitModel=ys;exports.Univer=Qc;exports.UniverInstanceType=$e;exports.UpdateDocsAttributeType=Pe;exports.UserManagerService=$n;exports.VerticalAlign=tn;exports.VerticalAlignmentType=Pu;exports.WithDependency=qg;exports.WithNew=pl;exports.Worksheet=dr;exports.WrapStrategy=_n;exports.WrapTextType=Ou;exports.addLinkToDocumentModel=Ic;exports.afterInitApply=Rp;exports.afterTime=Cp;exports.awaitTime=xR;exports.binSearchFirstGreaterThanTarget=Ll;exports.binarySearchArray=Ip;exports.bufferDebounceTime=Ep;exports.cellToRange=mm;exports.characterSpacingControlType=Hu;exports.checkForSubstrings=_m;exports.checkIfMove=Sp;exports.checkParagraphHasBullet=Zm;exports.checkParagraphHasIndent=e_;exports.checkParagraphHasIndentByStyle=uu;exports.codeToBlob=yp;exports.composeBody=gi;exports.composeInterceptors=Cc;exports.composeStyles=ri;exports.concatMatrixArray=d_;exports.connectDependencies=Kg;exports.connectInjector=Gg;exports.convertBodyToHtml=$p;exports.convertCellToRange=ou;exports.covertTextRunToHtml=si;exports.createAsyncInterceptorKey=QE;exports.createDefaultUser=us;exports.createDocumentModelWithStyle=er;exports.createIdentifier=_t;exports.createInterceptorKey=KE;exports.createInternalEditorID=Eg;exports.createRowColIter=ui;exports.dayjs=Kt;exports.debounce=ng;exports.dedupe=hg;exports.deepCompare=Yi;exports.delayAnimationFrame=LR;exports.deleteContent=hu;exports.extractPureTextFromCell=Dc;exports.forwardRef=Ng;exports.fromCallback=Ml;exports.fromEventSubject=NR;exports.fromObservable=up;exports.generateRandomId=zt;exports.get=xf;exports.getArrayLength=rn;exports.getBodySlice=Ht;exports.getBodySliceHtml=Hr;exports.getBorderStyleType=fm;exports.getCellInfoInMergeData=om;exports.getCellValueType=nm;exports.getColorStyle=Nt;exports.getCustomDecorationSlice=hc;exports.getCustomRangeSlice=cc;exports.getDocsUpdateBody=gm;exports.getIntersectRange=b_;exports.getOriginCellValue=_C;exports.getReverseDirection=Op;exports.getWorksheetUID=vC;exports.groupBy=gg;exports.handleStyleToString=dm;exports.hashAlgorithm=r_;exports.horizontalLineSegmentsSubtraction=vs;exports.insertMatrixArray=oi;exports.insertTextToContent=cu;exports.isAsyncDependencyItem=Qs;exports.isAsyncHook=Br;exports.isBlackColor=Zp;exports.isBooleanString=mg;exports.isCellCoverable=um;exports.isCellV=sm;exports.isClassDependencyItem=Gs;exports.isCtor=Pi;exports.isDisposable=Zs;exports.isEmptyCell=au;exports.isFactoryDependencyItem=Ks;exports.isFormulaId=hm;exports.isFormulaString=cm;exports.isICellData=tm;exports.isInternalEditorID=il;exports.isNodeEnv=kp;exports.isNotNullOrUndefined=vc;exports.isNullCell=rm;exports.isNumeric=qc;exports.isRangesEqual=nC;exports.isRealNum=n_;exports.isSafeNumeric=SR;exports.isSameStyleTextRun=lu;exports.isUnitRangesEqual=rC;exports.isValidRange=pm;exports.isValueDependencyItem=Xs;exports.isWhiteColor=em;exports.makeArray=pg;exports.makeCellRangeToRangeData=lm;exports.makeCellToSelection=am;exports.makeCustomRangeStream=BE;exports.merge=Di;exports.mergeOverrideWithDependencies=Vc;exports.mergeSets=bR;exports.mergeWith=og;exports.mergeWorksheetSnapshotWithDefault=Nc;exports.mixinClass=ZE;exports.moveMatrixArray=li;exports.moveRangeByOffset=I_;exports.nameCharacterCheck=DR;exports.normalizeBody=lE;exports.normalizeTextRuns=vr;exports.numberToABC=U_;exports.numberToListABC=P_;exports.numfmt=du;exports.queryObjectMatrix=M_;exports.registerDependencies=op;exports.remove=gr;exports.repeatStringNumTimes=mu;exports.replaceInDocumentBody=wR;exports.requestImmediateMacroTask=OR;exports.rotate=fg;exports.searchArray=vp;exports.searchInOrderedArray=xl;exports.selectionToArray=im;exports.sequence=Ol;exports.sequenceAsync=Sl;exports.sequenceExecute=Hi;exports.sequenceExecuteAsync=_p;exports.set=lg;exports.setDependencies=Tg;exports.shallowEqual=vl;exports.skipParseTagNames=PR;exports.sliceMatrixArray=f_;exports.sortRules=F_;exports.sortRulesByDesc=k_;exports.sortRulesFactory=Rr;exports.spliceArray=ai;exports.splitIntoGrid=Vi;exports.takeAfter=Dl;exports.textDiff=nl;exports.throttle=GE;exports.toDisposable=Qe;exports.touchDependencies=Il;exports.updateAttributeByDelete=dc;exports.updateAttributeByInsert=fc;exports.useDependency=ep;exports.useDependencyContext=sp;exports.useDependencyContextValue=ip;exports.useDependencyValue=Rl;exports.useInjector=Cl;exports.useObservable=np;exports.useUpdateBinder=rp;
4
+ For more info please visit our website: https://redi.wendell.fun/en-US/docs/debug#import-scripts-of-redi-more-than-once`):globalObject$1[__REDI_GLOBAL_LOCK__]=!0;var __REDI_CONTEXT_LOCK__="REDI_CONTEXT_LOCK",isNode=typeof process<"u"&&process.versions!=null&&process.versions.node!=null,globalObject=typeof globalThis<"u"&&globalThis||typeof window<"u"&&window||typeof global<"u"&&global;globalObject[__REDI_CONTEXT_LOCK__]?isNode||console.error(`[redi]: "RediContext" is already created. You may import "RediContext" from different paths. Use "import { RediContext } from '@wendellhu/redi/react-bindings'; instead."`):globalObject[__REDI_CONTEXT_LOCK__]=!0;var RediContext=React__namespace.createContext({injector:null});RediContext.displayName="RediContext";var RediProvider=RediContext.Provider,RediConsumer=RediContext.Consumer,__assign=__name(function(){return __assign=Object.assign||function(t){for(var s,i=1,n=arguments.length;i<n;i++){s=arguments[i];for(var p in s)Object.prototype.hasOwnProperty.call(s,p)&&(t[p]=s[p])}return t},__assign.apply(this,arguments)},"__assign");function RediInjector(props){var children=props.children,dependencies=props.dependencies,childInjectorRef=React__namespace.useRef(null);return React__namespace.useEffect(function(){return function(){var _a17;return(_a17=childInjectorRef.current)===null||_a17===void 0?void 0:_a17.dispose()}},[]),React__namespace.createElement(RediConsumer,null,function(context){var childInjector;return childInjectorRef.current?childInjector=childInjectorRef.current:(childInjector=context.injector?context.injector.createChild(dependencies):new Injector(dependencies),childInjectorRef.current=childInjector),React__namespace.createElement(RediProvider,{value:{injector:childInjector}},children)})}__name(RediInjector,"RediInjector");function connectInjector(Comp,injector){return __name(function(props){return React__namespace.createElement(RediProvider,{value:{injector}},React__namespace.createElement(Comp,__assign({},props)))},"ComponentWithInjector")}__name(connectInjector,"connectInjector");function connectDependencies(Comp,dependencies){return __name(function(props){return React__namespace.createElement(RediInjector,{dependencies},React__namespace.createElement(Comp,__assign({},props)))},"ComponentWithInjector")}__name(connectDependencies,"connectDependencies");var __extends$1=function(){var extendStatics=__name(function(d,b){return extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d2,b2){d2.__proto__=b2}||function(d2,b2){for(var p in b2)Object.prototype.hasOwnProperty.call(b2,p)&&(d2[p]=b2[p])},extendStatics(d,b)},"extendStatics");return function(d,b){if(typeof b!="function"&&b!==null)throw new TypeError("Class extends value "+String(b)+" is not a constructor or null");extendStatics(d,b);function __(){this.constructor=d}__name(__,"__"),d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}}(),ClassComponentNotInRediContextError=function(_super){__extends$1(ClassComponentNotInRediContextError2,_super);function ClassComponentNotInRediContextError2(component){return _super.call(this,'You should make "RediContext" as '.concat(component.constructor.name,"'s default context type. ")+"If you want to use multiple context, please check this on React doc site. https://reactjs.org/docs/context.html#classcontexttype")||this}return __name(ClassComponentNotInRediContextError2,"ClassComponentNotInRediContextError"),ClassComponentNotInRediContextError2}(RediError);function WithDependency(id,quantity,lookUp){return function(){return{get:__name(function(){var thisComponent=this,context=thisComponent.context;if(!context||!context.injector)throw new ClassComponentNotInRediContextError(thisComponent);var injector=context.injector,thing=injector.get(id,quantity||exports.Quantity.REQUIRED,lookUp);return thing},"get")}}}__name(WithDependency,"WithDependency");var __extends=function(){var extendStatics=__name(function(d,b){return extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d2,b2){d2.__proto__=b2}||function(d2,b2){for(var p in b2)Object.prototype.hasOwnProperty.call(b2,p)&&(d2[p]=b2[p])},extendStatics(d,b)},"extendStatics");return function(d,b){if(typeof b!="function"&&b!==null)throw new TypeError("Class extends value "+String(b)+" is not a constructor or null");extendStatics(d,b);function __(){this.constructor=d}__name(__,"__"),d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}}(),HooksNotInRediContextError=function(_super){__extends(HooksNotInRediContextError2,_super);function HooksNotInRediContextError2(){return _super.call(this,"Using dependency injection outside of a RediContext.")||this}return __name(HooksNotInRediContextError2,"HooksNotInRediContextError"),HooksNotInRediContextError2}(RediError);function useInjector(){var injectionContext=React__namespace.useContext(RediContext);if(!injectionContext.injector)throw new HooksNotInRediContextError;return injectionContext.injector}__name(useInjector,"useInjector");function useDependency(id,quantityOrLookUp,lookUp){var injector=useInjector();return React__namespace.useMemo(function(){return injector.get(id,quantityOrLookUp,lookUp)},[id,quantityOrLookUp,lookUp])}__name(useDependency,"useDependency");var __spreadArray$1=__name(function(to,from,pack){if(pack||arguments.length===2)for(var i=0,l=from.length,ar;i<l;i++)(ar||!(i in from))&&(ar||(ar=Array.prototype.slice.call(from,0,i)),ar[i]=from[i]);return to.concat(ar||Array.prototype.slice.call(from))},"__spreadArray$1");function useDependencyValue(depValue$,defaultValue){var firstValue=depValue$ instanceof rxjs.BehaviorSubject&&typeof defaultValue>"u"?depValue$.getValue():defaultValue,_a17=React.useState(firstValue),value=_a17[0],setValue=_a17[1];return React.useEffect(function(){var subscription=depValue$.subscribe(function(val){return setValue(val)});return function(){return subscription.unsubscribe()}},[depValue$]),value}__name(useDependencyValue,"useDependencyValue");function unwrap(o){return typeof o=="function"?o():o}__name(unwrap,"unwrap");function useObservable(observable,defaultValue,shouldHaveSyncValue,deps){if(typeof observable=="function"&&!deps)throw new RediError("Expected deps to be provided when observable is a function!");var observableRef=React.useRef(null),initializedRef=React.useRef(!1),destObservable=React.useMemo(function(){return observable},__spreadArray$1([],typeof deps<"u"?deps:[observable],!0)),_a17=React.useState(0);_a17[0];var setRenderCounter=_a17[1],valueRef=React.useRef(function(){var innerDefaultValue;if(destObservable){var sub=unwrap(destObservable).subscribe(function(value){initializedRef.current=!0,innerDefaultValue=value});sub.unsubscribe()}return innerDefaultValue!=null?innerDefaultValue:defaultValue}());if(React.useEffect(function(){var subscription=null;return destObservable&&(observableRef.current=unwrap(destObservable),subscription=observableRef.current.subscribe(function(value){valueRef.current=value,setRenderCounter(function(prev){return prev+1})})),function(){return subscription==null?void 0:subscription.unsubscribe()}},[destObservable]),shouldHaveSyncValue&&!initializedRef.current)throw new Error("Expect `shouldHaveSyncValue` but not getting a sync value!");return valueRef.current}__name(useObservable,"useObservable");function useUpdateBinder(update$){var _a17=React.useState(0),dumpSet=_a17[1];React.useEffect(function(){var subscription=update$.subscribe(function(){return dumpSet(function(prev){return prev+1})});return function(){return subscription.unsubscribe()}},[])}__name(useUpdateBinder,"useUpdateBinder");var DepValueMapProvider=new WeakMap;function useDependencyContext(depValue$,defaultValue){var depRef=React.useRef(void 0),value=useDependencyValue(depValue$,defaultValue),Context=React.useMemo(function(){return React.createContext(value)},[depValue$]),Provider=React.useCallback(function(props){return React.createElement(Context.Provider,{value},props.children)},[depValue$,value]);return depRef.current!==depValue$&&(depRef.current&&DepValueMapProvider.delete(depRef.current),depRef.current=depValue$,DepValueMapProvider.set(depValue$,Context)),{Provider,value}}__name(useDependencyContext,"useDependencyContext");function useDependencyContextValue(depValue$){var context=DepValueMapProvider.get(depValue$);if(!context)throw new RediError("try to read context value but no ancestor component subscribed it.");return React.useContext(context)}__name(useDependencyContextValue,"useDependencyContextValue");function registerDependencies(injector,dependencies){dependencies.forEach(d=>injector.add(d))}__name(registerDependencies,"registerDependencies");function touchDependencies(injector,dependencies){dependencies.forEach(([d])=>{injector.has(d)&&injector.get(d)})}__name(touchDependencies,"touchDependencies");function shallowEqual(objA,objB){if(Object.is(objA,objB))return!0;if(typeof objA!="object"||!objA||typeof objB!="object"||!objB)return!1;const keysA=Object.keys(objA),keysB=Object.keys(objB);if(keysA.length!==keysB.length)return!1;const bHasOwnProperty=Object.prototype.hasOwnProperty.bind(objB);for(let idx=0;idx<keysA.length;idx++){const key=keysA[idx];if(!bHasOwnProperty(key))return!1;const valueA=objA[key],valueB=objB[key];if(valueA!==valueB)return!1}return!0}__name(shallowEqual,"shallowEqual");const _CustomCommandExecutionError=class _CustomCommandExecutionError extends Error{constructor(message){super(message),this.name="CustomCommandExecutionError"}};__name(_CustomCommandExecutionError,"CustomCommandExecutionError");let CustomCommandExecutionError=_CustomCommandExecutionError;const _CanceledError=class _CanceledError extends Error{constructor(){super("Canceled by facade"),this.name="CanceledError"}};__name(_CanceledError,"CanceledError");let CanceledError=_CanceledError;async function sequenceAsync(tasks){for(const[index2,task]of tasks.entries())try{if(!await task())return{index:index2,result:!1}}catch(e){return{index:index2,result:!1,error:e}}return{result:!0,index:-1}}__name(sequenceAsync,"sequenceAsync");function sequence(tasks){for(const[index2,task]of tasks.entries())try{if(!task())return{index:index2,result:!1}}catch(e){return{index:index2,result:!1,error:e}}return{result:!0,index:-1}}__name(sequence,"sequence");function __values(o){var s=typeof Symbol=="function"&&Symbol.iterator,m=s&&o[s],i=0;if(m)return m.call(o);if(o&&typeof o.length=="number")return{next:__name(function(){return o&&i>=o.length&&(o=void 0),{value:o&&o[i++],done:!o}},"next")};throw new TypeError(s?"Object is not iterable.":"Symbol.iterator is not defined.")}__name(__values,"__values");function __read(o,n){var m=typeof Symbol=="function"&&o[Symbol.iterator];if(!m)return o;var i=m.call(o),r,ar=[],e;try{for(;(n===void 0||n-- >0)&&!(r=i.next()).done;)ar.push(r.value)}catch(error){e={error}}finally{try{r&&!r.done&&(m=i.return)&&m.call(i)}finally{if(e)throw e.error}}return ar}__name(__read,"__read");function __spreadArray(to,from,pack){if(pack||arguments.length===2)for(var i=0,l=from.length,ar;i<l;i++)(ar||!(i in from))&&(ar||(ar=Array.prototype.slice.call(from,0,i)),ar[i]=from[i]);return to.concat(ar||Array.prototype.slice.call(from))}__name(__spreadArray,"__spreadArray");function isFunction(value){return typeof value=="function"}__name(isFunction,"isFunction");function createErrorClass(createImpl){var _super=__name(function(instance){Error.call(instance),instance.stack=new Error().stack},"_super"),ctorFunc=createImpl(_super);return ctorFunc.prototype=Object.create(Error.prototype),ctorFunc.prototype.constructor=ctorFunc,ctorFunc}__name(createErrorClass,"createErrorClass");var UnsubscriptionError=createErrorClass(function(_super){return __name(function(errors){_super(this),this.message=errors?errors.length+` errors occurred during unsubscription:
5
+ `+errors.map(function(err,i){return i+1+") "+err.toString()}).join(`
6
+ `):"",this.name="UnsubscriptionError",this.errors=errors},"UnsubscriptionErrorImpl")});function arrRemove(arr,item){if(arr){var index2=arr.indexOf(item);0<=index2&&arr.splice(index2,1)}}__name(arrRemove,"arrRemove");var Subscription=function(){function Subscription2(initialTeardown){this.initialTeardown=initialTeardown,this.closed=!1,this._parentage=null,this._finalizers=null}return __name(Subscription2,"Subscription"),Subscription2.prototype.unsubscribe=function(){var e_1,_a17,e_2,_b2,errors;if(!this.closed){this.closed=!0;var _parentage=this._parentage;if(_parentage)if(this._parentage=null,Array.isArray(_parentage))try{for(var _parentage_1=__values(_parentage),_parentage_1_1=_parentage_1.next();!_parentage_1_1.done;_parentage_1_1=_parentage_1.next()){var parent_1=_parentage_1_1.value;parent_1.remove(this)}}catch(e_1_1){e_1={error:e_1_1}}finally{try{_parentage_1_1&&!_parentage_1_1.done&&(_a17=_parentage_1.return)&&_a17.call(_parentage_1)}finally{if(e_1)throw e_1.error}}else _parentage.remove(this);var initialFinalizer=this.initialTeardown;if(isFunction(initialFinalizer))try{initialFinalizer()}catch(e){errors=e instanceof UnsubscriptionError?e.errors:[e]}var _finalizers=this._finalizers;if(_finalizers){this._finalizers=null;try{for(var _finalizers_1=__values(_finalizers),_finalizers_1_1=_finalizers_1.next();!_finalizers_1_1.done;_finalizers_1_1=_finalizers_1.next()){var finalizer=_finalizers_1_1.value;try{execFinalizer(finalizer)}catch(err){errors=errors!=null?errors:[],err instanceof UnsubscriptionError?errors=__spreadArray(__spreadArray([],__read(errors)),__read(err.errors)):errors.push(err)}}}catch(e_2_1){e_2={error:e_2_1}}finally{try{_finalizers_1_1&&!_finalizers_1_1.done&&(_b2=_finalizers_1.return)&&_b2.call(_finalizers_1)}finally{if(e_2)throw e_2.error}}}if(errors)throw new UnsubscriptionError(errors)}},Subscription2.prototype.add=function(teardown){var _a17;if(teardown&&teardown!==this)if(this.closed)execFinalizer(teardown);else{if(teardown instanceof Subscription2){if(teardown.closed||teardown._hasParent(this))return;teardown._addParent(this)}(this._finalizers=(_a17=this._finalizers)!==null&&_a17!==void 0?_a17:[]).push(teardown)}},Subscription2.prototype._hasParent=function(parent){var _parentage=this._parentage;return _parentage===parent||Array.isArray(_parentage)&&_parentage.includes(parent)},Subscription2.prototype._addParent=function(parent){var _parentage=this._parentage;this._parentage=Array.isArray(_parentage)?(_parentage.push(parent),_parentage):_parentage?[_parentage,parent]:parent},Subscription2.prototype._removeParent=function(parent){var _parentage=this._parentage;_parentage===parent?this._parentage=null:Array.isArray(_parentage)&&arrRemove(_parentage,parent)},Subscription2.prototype.remove=function(teardown){var _finalizers=this._finalizers;_finalizers&&arrRemove(_finalizers,teardown),teardown instanceof Subscription2&&teardown._removeParent(this)},Subscription2.EMPTY=function(){var empty=new Subscription2;return empty.closed=!0,empty}(),Subscription2}();Subscription.EMPTY;function isSubscription(value){return value instanceof Subscription||value&&"closed"in value&&isFunction(value.remove)&&isFunction(value.add)&&isFunction(value.unsubscribe)}__name(isSubscription,"isSubscription");function execFinalizer(finalizer){isFunction(finalizer)?finalizer():finalizer.unsubscribe()}__name(execFinalizer,"execFinalizer");function toDisposable(v){let disposed=!1;return v?isSubscription(v)?{dispose:__name(()=>v.unsubscribe(),"dispose")}:typeof v=="function"?{dispose:__name(()=>{disposed||(disposed=!0,v())},"dispose")}:v:toDisposable(()=>{})}__name(toDisposable,"toDisposable");function fromObservable(subscription){return toDisposable(()=>{subscription.unsubscribe()})}__name(fromObservable,"fromObservable");const _DisposableCollection=class _DisposableCollection{constructor(){__publicField(this,"_disposables",new Set)}add(disposable){const d=toDisposable(disposable);return this._disposables.add(d),{dispose:__name((notDisposeSelf=!1)=>{notDisposeSelf||d.dispose(),this._disposables.delete(d)},"dispose")}}dispose(){this._disposables.forEach(item=>{item.dispose()}),this._disposables.clear()}};__name(_DisposableCollection,"DisposableCollection");let DisposableCollection=_DisposableCollection;const _Disposable=class _Disposable{constructor(){__publicField(this,"_disposed",!1);__publicField(this,"_collection",new DisposableCollection)}disposeWithMe(disposable){return this._collection.add(disposable)}ensureNotDisposed(){if(this._disposed)throw new Error("[Disposable]: object is disposed!")}dispose(){this._disposed||(this._disposed=!0,this._collection.dispose())}};__name(_Disposable,"Disposable");let Disposable=_Disposable;const _RxDisposable=class _RxDisposable extends Disposable{constructor(){super(...arguments);__publicField(this,"dispose$",new rxjs.Subject)}dispose(){super.dispose(),this.dispose$.next(),this.dispose$.complete()}};__name(_RxDisposable,"RxDisposable");let RxDisposable=_RxDisposable;const _RCDisposable=class _RCDisposable extends Disposable{constructor(_rootDisposable){super();__publicField(this,"_ref",0);this._rootDisposable=_rootDisposable}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())}};__name(_RCDisposable,"RCDisposable");let RCDisposable=_RCDisposable;const IContextService=createIdentifier("univer.context-service"),_ContextService=class _ContextService extends Disposable{constructor(){super(...arguments);__publicField(this,"_contextChanged$",new rxjs.Subject);__publicField(this,"contextChanged$",this._contextChanged$.asObservable());__publicField(this,"_contextMap",new Map)}dispose(){super.dispose(),this._contextChanged$.complete()}getContextValue(key){var _a17;return(_a17=this._contextMap.get(key))!=null?_a17:!1}setContextValue(key,value){this._contextMap.set(key,value),this._contextChanged$.next({[key]:value})}subscribeContextValue$(key){return new rxjs.Observable(observer=>{const contextChangeSubscription=this._contextChanged$.pipe(rxjs.filter(event=>typeof event[key]<"u")).subscribe(event=>observer.next(event[key]));return this._contextMap.has(key)&&observer.next(this._contextMap.get(key)),()=>contextChangeSubscription.unsubscribe()})}};__name(_ContextService,"ContextService");let ContextService=_ContextService;var LogLevel=(LogLevel2=>(LogLevel2[LogLevel2.SILENT=0]="SILENT",LogLevel2[LogLevel2.ERROR=1]="ERROR",LogLevel2[LogLevel2.WARN=2]="WARN",LogLevel2[LogLevel2.INFO=3]="INFO",LogLevel2[LogLevel2.VERBOSE=4]="VERBOSE",LogLevel2))(LogLevel||{});const ILogService=createIdentifier("univer.log"),_DesktopLogService=class _DesktopLogService extends Disposable{constructor(){super(...arguments);__publicField(this,"_logLevel",3)}debug(...args){this._logLevel>=4&&this._log(console.debug,...args)}log(...args){this._logLevel>=3&&this._log(console.log,...args)}warn(...args){this._logLevel>=2&&this._log(console.warn,...args)}error(...args){this._logLevel>=1&&this._log(console.error,...args)}setLogLevel(logLevel){this._logLevel=logLevel}_log(method,...args){const firstArg=args[0];/^\[(.*?)\]/g.test(firstArg)?method(`\x1B[97;104m${firstArg}\x1B[0m`,...args.slice(1)):method(...args)}};__name(_DesktopLogService,"DesktopLogService");let DesktopLogService=_DesktopLogService;var __defProp$d=Object.defineProperty,__getOwnPropDesc$d=Object.getOwnPropertyDescriptor,__decorateClass$d=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$d(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$d(target,key,result),result},"__decorateClass$d"),__decorateParam$d=__name((index2,decorator)=>(target,key)=>decorator(target,key,index2),"__decorateParam$d"),CommandType=(CommandType2=>(CommandType2[CommandType2.COMMAND=0]="COMMAND",CommandType2[CommandType2.OPERATION=1]="OPERATION",CommandType2[CommandType2.MUTATION=2]="MUTATION",CommandType2))(CommandType||{});const ICommandService=createIdentifier("anywhere.command-service"),_CommandRegistry=class _CommandRegistry{constructor(){__publicField(this,"_commands",new Map);__publicField(this,"_commandTypes",new Map)}registerCommand(command){if(this._commands.has(command.id))throw new Error(`[CommandRegistry]: command "${command.id}" has been registered before.`);return this._commands.set(command.id,command),this._commandTypes.set(command.id,command.type),toDisposable(()=>{this._commands.delete(command.id),this._commandTypes.delete(command.id)})}hasCommand(id){return this._commands.has(id)}getCommand(id){return this._commands.has(id)?[this._commands.get(id)]:null}getCommandType(id){return this._commandTypes.get(id)}};__name(_CommandRegistry,"CommandRegistry");let CommandRegistry=_CommandRegistry;const NilCommand={id:"nil",type:0,handler:__name(()=>!0,"handler")};var _a;exports.CommandService=(_a=class extends Disposable{constructor(_injector,_logService){super();__publicField(this,"_commandRegistry");__publicField(this,"_beforeCommandExecutionListeners",[]);__publicField(this,"_commandExecutedListeners",[]);__publicField(this,"_multiCommandDisposables",new Map);__publicField(this,"_commandExecutingLevel",0);__publicField(this,"_commandExecutionStack",[]);this._injector=_injector,this._logService=_logService,this._commandRegistry=new CommandRegistry,this._registerCommand(NilCommand)}dispose(){super.dispose(),this._commandExecutedListeners.length=0,this._beforeCommandExecutionListeners.length=0}hasCommand(commandId){return this._commandRegistry.hasCommand(commandId)}registerCommand(command){return this._registerCommand(command)}registerMultipleCommand(command){return this._registerMultiCommand(command)}beforeCommandExecuted(listener){if(this._beforeCommandExecutionListeners.indexOf(listener)===-1)return this._beforeCommandExecutionListeners.push(listener),toDisposable(()=>{const index2=this._beforeCommandExecutionListeners.indexOf(listener);this._beforeCommandExecutionListeners.splice(index2,1)});throw new Error("[CommandService]: could not add a listener twice.")}onCommandExecuted(listener){if(this._commandExecutedListeners.indexOf(listener)===-1)return this._commandExecutedListeners.push(listener),toDisposable(()=>{const index2=this._commandExecutedListeners.indexOf(listener);this._commandExecutedListeners.splice(index2,1)});throw new Error("[CommandService]: could not add a listener twice.")}async executeCommand(id,params,options){try{const item=this._commandRegistry.getCommand(id);if(item){const[command]=item,commandInfo={id:command.id,type:command.type,params},stackItemDisposable=this._pushCommandExecutionStack(commandInfo);this._beforeCommandExecutionListeners.forEach(listener=>listener(commandInfo,options));const result=await this._execute(command,params,options);return this._commandExecutedListeners.forEach(listener=>listener(commandInfo,options)),stackItemDisposable.dispose(),result}throw new Error(`[CommandService]: command "${id}" is not registered.`)}catch(error){if(error instanceof CustomCommandExecutionError)return!1;throw error}}syncExecuteCommand(id,params,options){var _a17;try{const item=this._commandRegistry.getCommand(id);if(item){const[command]=item,commandInfo={id:command.id,type:command.type,params};if(command.type===2){const triggerCommand=findLast(this._commandExecutionStack,item2=>item2.type===0);triggerCommand&&(commandInfo.params=(_a17=commandInfo.params)!=null?_a17:{},commandInfo.params.trigger=triggerCommand.id)}const stackItemDisposable=this._pushCommandExecutionStack(commandInfo);this._beforeCommandExecutionListeners.forEach(listener=>listener(commandInfo,options));const result=this._syncExecute(command,params,options);return this._commandExecutedListeners.forEach(listener=>listener(commandInfo,options)),stackItemDisposable.dispose(),result}throw new Error(`[CommandService]: command "${id}" is not registered.`)}catch(error){if(error instanceof CustomCommandExecutionError)return!1;throw error}}_pushCommandExecutionStack(stackItem){return this._commandExecutionStack.push(stackItem),toDisposable(()=>remove(this._commandExecutionStack,stackItem))}_registerCommand(command){return this._commandRegistry.registerCommand(command)}_registerMultiCommand(command){const registry=this._commandRegistry.getCommand(command.id);let multiCommand;if(registry){if(registry[0].multi!==!0)throw new Error("Command has registered as a single command.");multiCommand=registry[0]}else{const disposableCollection=new DisposableCollection;multiCommand=new MultiCommand(command.id),disposableCollection.add(this._commandRegistry.registerCommand(multiCommand)),disposableCollection.add(toDisposable(()=>{this._multiCommandDisposables.delete(command.id)})),this._multiCommandDisposables.set(command.id,disposableCollection)}const implementationDisposable=multiCommand.registerImplementation(command);return toDisposable(()=>{var _a17;implementationDisposable.dispose(),multiCommand.hasImplementations()||(_a17=this._multiCommandDisposables.get(command.id))==null||_a17.dispose()})}async _execute(command,params,options){this._logService.debug("[CommandService]",`${"|-".repeat(Math.max(this._commandExecutingLevel,0))}executing command "${command.id}"`),this._commandExecutingLevel++;let result;try{result=await this._injector.invoke(command.handler,params,options),this._commandExecutingLevel--}catch(e){throw result=!1,this._commandExecutingLevel=0,e}return result}_syncExecute(command,params,options){this._logService.debug("[CommandService]",`${"|-".repeat(Math.max(0,this._commandExecutingLevel))}executing command "${command.id}".`),this._commandExecutingLevel++;let result;try{if(result=this._injector.invoke(command.handler,params,options),result instanceof Promise)throw new TypeError("[CommandService]: Command handler should not return a promise.");this._commandExecutingLevel--}catch(e){throw result=!1,this._commandExecutingLevel=0,e}return result}},__name(_a,"CommandService"),_a);exports.CommandService=__decorateClass$d([__decorateParam$d(0,Inject(Injector)),__decorateParam$d(1,ILogService)],exports.CommandService);const _MultiCommand=class _MultiCommand{constructor(id){__publicField(this,"name");__publicField(this,"multi",!0);__publicField(this,"type",0);__publicField(this,"priority",0);__publicField(this,"_implementations",[]);__publicField(this,"handler",__name(async(accessor,params)=>{if(!this._implementations.length)return!1;const logService=accessor.get(ILogService),contextService=accessor.get(IContextService),injector=accessor.get(Injector);for(const item of this._implementations){const preconditions=item.command.preconditions;if((!preconditions||preconditions&&preconditions(contextService))&&(logService.debug("[MultiCommand]",`executing implementation "${item.command.name}".`),await injector.invoke(item.command.handler,params)))return!0}return!1},"handler"));this.id=id,this.name=id}registerImplementation(implementation){const registry={command:implementation};return this._implementations.push(registry),this._implementations.sort((a,b)=>b.command.priority-a.command.priority),toDisposable(()=>{const index2=this._implementations.indexOf(registry);this._implementations.splice(index2,1)})}hasImplementations(){return this._implementations.length>0}};__name(_MultiCommand,"MultiCommand");let MultiCommand=_MultiCommand;function sequenceExecute(tasks,commandService,options){const taskFns=tasks.map(task=>()=>commandService.syncExecuteCommand(task.id,task.params,options));return sequence(taskFns)}__name(sequenceExecute,"sequenceExecute");function sequenceExecuteAsync(tasks,commandService,options){const promises=tasks.map(task=>()=>commandService.executeCommand(task.id,task.params,options));return sequenceAsync(promises)}__name(sequenceExecuteAsync,"sequenceExecuteAsync");function fromCallback(callback){return new rxjs.Observable(subscriber=>{const disposable=callback((...args)=>subscriber.next(args));return()=>disposable==null?void 0:disposable.dispose()})}__name(fromCallback,"fromCallback");function takeAfter(callback){return __name(function(source){return new rxjs.Observable(subscriber=>(source.subscribe({next:__name(v=>{subscriber.next(v),callback(v)&&subscriber.complete()},"next"),complete:__name(()=>subscriber.complete(),"complete"),error:__name(error=>subscriber.error(error),"error")}),()=>subscriber.unsubscribe()))},"complateAfter")}__name(takeAfter,"takeAfter");function bufferDebounceTime(time=0){return source=>{let bufferedValues=[];return source.pipe(rxjs.tap(value=>bufferedValues.push(value)),rxjs.debounceTime(time),rxjs.map(()=>bufferedValues),rxjs.tap(()=>bufferedValues=[]))}}__name(bufferDebounceTime,"bufferDebounceTime");function afterTime(ms){const subject=new rxjs.ReplaySubject(1);return setTimeout(()=>subject.next(),ms),subject.pipe(rxjs.take(1))}__name(afterTime,"afterTime");const afterInitApply=__name(commandService=>new Promise(res=>{rxjs.merge(fromCallback(commandService.onCommandExecuted.bind(commandService)).pipe(operators.filter(([info])=>info.type===CommandType.MUTATION)),rxjs.timer(300)).pipe(operators.debounceTime(16),operators.first()).subscribe(()=>{res()})}),"afterInitApply");function searchInOrderedArray(arr,target){let left=0,right=arr.length-1;if(target<arr[0])return 0;if(target>=arr[arr.length-1])return arr.length-1;for(;left<=right;){if(arr[left]===target){for(;left<arr.length&&arr[left]===target;)left++;return left}if(target>arr[left]&&target<arr[left+1])return left+1;if(arr[right]===target){for(;right<arr.length&&arr[right]===target;)right++;return right}if(target>arr[right-1]&&target<arr[right])return right;left++,right--}return-1}__name(searchInOrderedArray,"searchInOrderedArray");function binarySearchArray(arr,pos){let low=0,high=arr.length-1;for(;low<=high;){const mid=Math.floor((high+low)/2);if(pos<arr[mid]&&(mid===0||pos>=arr[mid-1]))return mid;if(pos>=arr[mid])low=mid+1;else if(pos<arr[mid])high=mid-1;else return-1}return-1}__name(binarySearchArray,"binarySearchArray");function binSearchFirstGreaterThanTarget(arr,target){let left=0,right=arr.length;for(;left<right;){const mid=Math.floor((left+right)/2);arr[mid]<=target?left=mid+1:right=mid}return left<arr.length?left:arr.length-1}__name(binSearchFirstGreaterThanTarget,"binSearchFirstGreaterThanTarget");function searchArray(arr,target,firstMatch=!1){let index2=arr.length-1;if(target<0||target<arr[0])return 0;if(arr.length<40||target<=arr[20]||target>=arr[index2-20]?index2=searchInOrderedArray(arr,target):index2=binSearchFirstGreaterThanTarget(arr,target),firstMatch){const val=arr[index2];return arr.indexOf(val)}return index2}__name(searchArray,"searchArray");function codeToBlob(code){const blob=new Blob([code],{type:"text/javascript"});return window.URL.createObjectURL(blob)}__name(codeToBlob,"codeToBlob");const MOVE_BUFFER_VALUE=2,ROTATE_BUFFER_VALUE=1;function checkIfMove(transform,previousTransform){if(previousTransform==null||transform==null)return!0;const{left:leftPrev=0,top:topPrev=0,height:heightPrev=0,width:widthPrev=0,angle:anglePrev=0}=previousTransform,{left=0,top=0,height=0,width=0,angle=0}=transform,allWidth=width,allHeight=height,allWidthPrev=widthPrev,allHeightPrev=heightPrev;return Math.abs(left-leftPrev)>MOVE_BUFFER_VALUE||Math.abs(top-topPrev)>MOVE_BUFFER_VALUE||Math.abs(allWidth-allWidthPrev)>MOVE_BUFFER_VALUE||Math.abs(allHeight-allHeightPrev)>MOVE_BUFFER_VALUE||Math.abs(angle-anglePrev)>ROTATE_BUFFER_VALUE}__name(checkIfMove,"checkIfMove");var AutoFillSeries=(AutoFillSeries2=>(AutoFillSeries2[AutoFillSeries2.DEFAULT_SERIES=0]="DEFAULT_SERIES",AutoFillSeries2[AutoFillSeries2.ALTERNATE_SERIES=1]="ALTERNATE_SERIES",AutoFillSeries2))(AutoFillSeries||{}),BorderStyleTypes=(BorderStyleTypes2=>(BorderStyleTypes2[BorderStyleTypes2.NONE=0]="NONE",BorderStyleTypes2[BorderStyleTypes2.THIN=1]="THIN",BorderStyleTypes2[BorderStyleTypes2.HAIR=2]="HAIR",BorderStyleTypes2[BorderStyleTypes2.DOTTED=3]="DOTTED",BorderStyleTypes2[BorderStyleTypes2.DASHED=4]="DASHED",BorderStyleTypes2[BorderStyleTypes2.DASH_DOT=5]="DASH_DOT",BorderStyleTypes2[BorderStyleTypes2.DASH_DOT_DOT=6]="DASH_DOT_DOT",BorderStyleTypes2[BorderStyleTypes2.DOUBLE=7]="DOUBLE",BorderStyleTypes2[BorderStyleTypes2.MEDIUM=8]="MEDIUM",BorderStyleTypes2[BorderStyleTypes2.MEDIUM_DASHED=9]="MEDIUM_DASHED",BorderStyleTypes2[BorderStyleTypes2.MEDIUM_DASH_DOT=10]="MEDIUM_DASH_DOT",BorderStyleTypes2[BorderStyleTypes2.MEDIUM_DASH_DOT_DOT=11]="MEDIUM_DASH_DOT_DOT",BorderStyleTypes2[BorderStyleTypes2.SLANT_DASH_DOT=12]="SLANT_DASH_DOT",BorderStyleTypes2[BorderStyleTypes2.THICK=13]="THICK",BorderStyleTypes2))(BorderStyleTypes||{}),BorderType=(BorderType2=>(BorderType2.TOP="top",BorderType2.BOTTOM="bottom",BorderType2.LEFT="left",BorderType2.RIGHT="right",BorderType2.NONE="none",BorderType2.ALL="all",BorderType2.OUTSIDE="outside",BorderType2.INSIDE="inside",BorderType2.HORIZONTAL="horizontal",BorderType2.VERTICAL="vertical",BorderType2.TLBR="tlbr",BorderType2.TLBC_TLMR="tlbc_tlmr",BorderType2.TLBR_TLBC_TLMR="tlbr_tlbc_tlmr",BorderType2.BLTR="bl_tr",BorderType2.MLTR_BCTR="mltr_bctr",BorderType2))(BorderType||{}),ColorType=(ColorType2=>(ColorType2[ColorType2.UNSUPPORTED=0]="UNSUPPORTED",ColorType2[ColorType2.RGB=1]="RGB",ColorType2[ColorType2.HEX=2]="HEX",ColorType2[ColorType2.THEME=3]="THEME",ColorType2))(ColorType||{}),CommonHideTypes=(CommonHideTypes2=>(CommonHideTypes2[CommonHideTypes2.ON=0]="ON",CommonHideTypes2[CommonHideTypes2.OFF=1]="OFF",CommonHideTypes2))(CommonHideTypes||{}),CopyPasteType=(CopyPasteType2=>(CopyPasteType2[CopyPasteType2.PASTE_NORMAL=0]="PASTE_NORMAL",CopyPasteType2[CopyPasteType2.PASTE_NO_BORDERS=1]="PASTE_NO_BORDERS",CopyPasteType2[CopyPasteType2.PASTE_FORMAT=2]="PASTE_FORMAT",CopyPasteType2[CopyPasteType2.PASTE_FORMULA=3]="PASTE_FORMULA",CopyPasteType2[CopyPasteType2.PASTE_DATA_VALIDATION=4]="PASTE_DATA_VALIDATION",CopyPasteType2[CopyPasteType2.PASTE_VALUES=5]="PASTE_VALUES",CopyPasteType2[CopyPasteType2.PASTE_CONDITIONAL_FORMATTING=6]="PASTE_CONDITIONAL_FORMATTING",CopyPasteType2[CopyPasteType2.PASTE_COLUMN_WIDTHS=7]="PASTE_COLUMN_WIDTHS",CopyPasteType2))(CopyPasteType||{}),DeleteDirection=(DeleteDirection2=>(DeleteDirection2[DeleteDirection2.LEFT=0]="LEFT",DeleteDirection2[DeleteDirection2.RIGHT=1]="RIGHT",DeleteDirection2))(DeleteDirection||{}),DeveloperMetadataVisibility=(DeveloperMetadataVisibility2=>(DeveloperMetadataVisibility2[DeveloperMetadataVisibility2.DOCUMENT=0]="DOCUMENT",DeveloperMetadataVisibility2[DeveloperMetadataVisibility2.PROJECT=1]="PROJECT",DeveloperMetadataVisibility2))(DeveloperMetadataVisibility||{}),Dimension=(Dimension2=>(Dimension2[Dimension2.COLUMNS=0]="COLUMNS",Dimension2[Dimension2.ROWS=1]="ROWS",Dimension2))(Dimension||{}),Direction=(Direction2=>(Direction2[Direction2.UP=0]="UP",Direction2[Direction2.RIGHT=1]="RIGHT",Direction2[Direction2.DOWN=2]="DOWN",Direction2[Direction2.LEFT=3]="LEFT",Direction2))(Direction||{});function getReverseDirection(direction){switch(direction){case 3:return 1;case 1:return 3;case 0:return 2;case 2:return 0}}__name(getReverseDirection,"getReverseDirection");var InterpolationPointType=(InterpolationPointType2=>(InterpolationPointType2[InterpolationPointType2.INTERPOLATION_POINT_TYPE_UNSPECIFIED=0]="INTERPOLATION_POINT_TYPE_UNSPECIFIED",InterpolationPointType2[InterpolationPointType2.MIN=1]="MIN",InterpolationPointType2[InterpolationPointType2.MAX=2]="MAX",InterpolationPointType2[InterpolationPointType2.NUMBER=3]="NUMBER",InterpolationPointType2[InterpolationPointType2.PERCENT=4]="PERCENT",InterpolationPointType2[InterpolationPointType2.PERCENTILE=5]="PERCENTILE",InterpolationPointType2))(InterpolationPointType||{}),LocaleType=(LocaleType2=>(LocaleType2.EN_US="enUS",LocaleType2.FR_FR="frFR",LocaleType2.ZH_CN="zhCN",LocaleType2.RU_RU="ruRU",LocaleType2.ZH_TW="zhTW",LocaleType2.VI_VN="viVN",LocaleType2.FA_IR="faIR",LocaleType2))(LocaleType||{}),MentionType=(MentionType2=>(MentionType2[MentionType2.PERSON=0]="PERSON",MentionType2[MentionType2.FILE=1]="FILE",MentionType2[MentionType2.DATE=2]="DATE",MentionType2[MentionType2.LOCATION=3]="LOCATION",MentionType2[MentionType2.EVENT=4]="EVENT",MentionType2))(MentionType||{}),ProtectionType=(ProtectionType2=>(ProtectionType2[ProtectionType2.RANGE=0]="RANGE",ProtectionType2[ProtectionType2.SHEET=1]="SHEET",ProtectionType2))(ProtectionType||{}),BasicShapes=(BasicShapes2=>(BasicShapes2.Line="line",BasicShapes2.LineInv="lineInv",BasicShapes2.Triangle="triangle",BasicShapes2.RtTriangle="rtTriangle",BasicShapes2.Rect="rect",BasicShapes2.Diamond="diamond",BasicShapes2.Parallelogram="parallelogram",BasicShapes2.Trapezoid="trapezoid",BasicShapes2.NonIsocelesTrapezoid="nonIsocelesTrapezoid",BasicShapes2.Pentagon="pentagon",BasicShapes2.Hexagon="hexagon",BasicShapes2.Heptagon="heptagon",BasicShapes2.Octagon="octagon",BasicShapes2.Decagon="decagon",BasicShapes2.Dodecagon="dodecagon",BasicShapes2.Star4="star4",BasicShapes2.Star5="star5",BasicShapes2.Star6="star6",BasicShapes2.Star7="star7",BasicShapes2.Star8="star8",BasicShapes2.Star10="star10",BasicShapes2.Star12="star12",BasicShapes2.Star16="star16",BasicShapes2.Star24="star24",BasicShapes2.Star32="star32",BasicShapes2.RoundRect="roundRect",BasicShapes2.Round1Rect="round1Rect",BasicShapes2.Round2SameRect="round2SameRect",BasicShapes2.Round2DiagRect="round2DiagRect",BasicShapes2.Ellipse="ellipse",BasicShapes2))(BasicShapes||{}),ArrowsAndMarkersShapes=(ArrowsAndMarkersShapes2=>(ArrowsAndMarkersShapes2.RightArrow="rightArrow",ArrowsAndMarkersShapes2.LeftArrow="leftArrow",ArrowsAndMarkersShapes2.UpArrow="upArrow",ArrowsAndMarkersShapes2.DownArrow="downArrow",ArrowsAndMarkersShapes2.LeftRightArrow="leftRightArrow",ArrowsAndMarkersShapes2.UpDownArrow="upDownArrow",ArrowsAndMarkersShapes2.QuadArrow="quadArrow",ArrowsAndMarkersShapes2.LeftRightUpArrow="leftRightUpArrow",ArrowsAndMarkersShapes2.BentArrow="bentArrow",ArrowsAndMarkersShapes2.UturnArrow="uturnArrow",ArrowsAndMarkersShapes2.CircularArrow="circularArrow",ArrowsAndMarkersShapes2.NotchedRightArrow="notchedRightArrow",ArrowsAndMarkersShapes2.HomePlate="homePlate",ArrowsAndMarkersShapes2.Chevron="chevron",ArrowsAndMarkersShapes2.LeftCircularArrow="leftCircularArrow",ArrowsAndMarkersShapes2.LeftRightCircularArrow="leftRightCircularArrow",ArrowsAndMarkersShapes2))(ArrowsAndMarkersShapes||{}),OtherShapes=(OtherShapes2=>(OtherShapes2.Plaque="plaque",OtherShapes2.Can="can",OtherShapes2.Cube="cube",OtherShapes2.Bevel="bevel",OtherShapes2.Donut="donut",OtherShapes2.NoSmoking="noSmoking",OtherShapes2.BlockArc="blockArc",OtherShapes2.FoldedCorner="foldedCorner",OtherShapes2))(OtherShapes||{}),SpecialShapes=(SpecialShapes2=>(SpecialShapes2.SmileyFace="smileyFace",SpecialShapes2.Heart="heart",SpecialShapes2.LightningBolt="lightningBolt",SpecialShapes2.Sun="sun",SpecialShapes2.Moon="moon",SpecialShapes2.Cloud="cloud",SpecialShapes2.Arc="arc",SpecialShapes2.Backpack="backpack",SpecialShapes2.Frame="frame",SpecialShapes2.HalfFrame="halfFrame",SpecialShapes2.Corner="corner",SpecialShapes2.Chord="chord",SpecialShapes2.Pie="pie",SpecialShapes2.Teardrop="teardrop",SpecialShapes2.WedgeRectCallout="wedgeRectCallout",SpecialShapes2.WedgeRRectCallout="wedgeRRectCallout",SpecialShapes2.WedgeEllipseCallout="wedgeEllipseCallout",SpecialShapes2.CloudCallout="cloudCallout",SpecialShapes2.BorderCallout1="borderCallout1",SpecialShapes2.BorderCallout2="borderCallout2",SpecialShapes2.BorderCallout3="borderCallout3",SpecialShapes2.AccentCallout1="accentCallout1",SpecialShapes2.AccentCallout2="accentCallout2",SpecialShapes2.AccentCallout3="accentCallout3",SpecialShapes2.Callout1="callout1",SpecialShapes2.Callout2="callout2",SpecialShapes2.Callout3="callout3",SpecialShapes2.ActionButtonBackPrevious="actionButtonBackPrevious",SpecialShapes2.ActionButtonEnd="actionButtonEnd",SpecialShapes2.ActionButtonForwardNext="actionButtonForwardNext",SpecialShapes2.ActionButtonHelp="actionButtonHelp",SpecialShapes2.ActionButtonHome="actionButtonHome",SpecialShapes2.ActionButtonInformation="actionButtonInformation",SpecialShapes2.ActionButtonMovie="actionButtonMovie",SpecialShapes2.ActionButtonReturn="actionButtonReturn",SpecialShapes2.ActionButtonSound="actionButtonSound",SpecialShapes2))(SpecialShapes||{}),RelativeDate=(RelativeDate2=>(RelativeDate2[RelativeDate2.RELATIVE_DATE_UNSPECIFIED=0]="RELATIVE_DATE_UNSPECIFIED",RelativeDate2[RelativeDate2.PAST_YEAR=1]="PAST_YEAR",RelativeDate2[RelativeDate2.PAST_MONTH=2]="PAST_MONTH",RelativeDate2[RelativeDate2.PAST_WEEK=3]="PAST_WEEK",RelativeDate2[RelativeDate2.YESTERDAY=4]="YESTERDAY",RelativeDate2[RelativeDate2.TODAY=5]="TODAY",RelativeDate2[RelativeDate2.TOMORROW=6]="TOMORROW",RelativeDate2))(RelativeDate||{}),SheetTypes=(SheetTypes2=>(SheetTypes2[SheetTypes2.GRID=0]="GRID",SheetTypes2[SheetTypes2.KANBAN=1]="KANBAN",SheetTypes2[SheetTypes2.GANTT=2]="GANTT",SheetTypes2))(SheetTypes||{}),TextDirection=(TextDirection2=>(TextDirection2[TextDirection2.UNSPECIFIED=0]="UNSPECIFIED",TextDirection2[TextDirection2.LEFT_TO_RIGHT=1]="LEFT_TO_RIGHT",TextDirection2[TextDirection2.RIGHT_TO_LEFT=2]="RIGHT_TO_LEFT",TextDirection2))(TextDirection||{}),TextDecoration=(TextDecoration2=>(TextDecoration2[TextDecoration2.DASH=0]="DASH",TextDecoration2[TextDecoration2.DASH_DOT_DOT_HEAVY=1]="DASH_DOT_DOT_HEAVY",TextDecoration2[TextDecoration2.DASH_DOT_HEAVY=2]="DASH_DOT_HEAVY",TextDecoration2[TextDecoration2.DASHED_HEAVY=3]="DASHED_HEAVY",TextDecoration2[TextDecoration2.DASH_LONG=4]="DASH_LONG",TextDecoration2[TextDecoration2.DASH_LONG_HEAVY=5]="DASH_LONG_HEAVY",TextDecoration2[TextDecoration2.DOT_DASH=6]="DOT_DASH",TextDecoration2[TextDecoration2.DOT_DOT_DASH=7]="DOT_DOT_DASH",TextDecoration2[TextDecoration2.DOTTED=8]="DOTTED",TextDecoration2[TextDecoration2.DOTTED_HEAVY=9]="DOTTED_HEAVY",TextDecoration2[TextDecoration2.DOUBLE=10]="DOUBLE",TextDecoration2[TextDecoration2.NONE=11]="NONE",TextDecoration2[TextDecoration2.SINGLE=12]="SINGLE",TextDecoration2[TextDecoration2.THICK=13]="THICK",TextDecoration2[TextDecoration2.WAVE=14]="WAVE",TextDecoration2[TextDecoration2.WAVY_DOUBLE=15]="WAVY_DOUBLE",TextDecoration2[TextDecoration2.WAVY_HEAVY=16]="WAVY_HEAVY",TextDecoration2[TextDecoration2.WORDS=17]="WORDS",TextDecoration2))(TextDecoration||{}),HorizontalAlign=(HorizontalAlign2=>(HorizontalAlign2[HorizontalAlign2.UNSPECIFIED=0]="UNSPECIFIED",HorizontalAlign2[HorizontalAlign2.LEFT=1]="LEFT",HorizontalAlign2[HorizontalAlign2.CENTER=2]="CENTER",HorizontalAlign2[HorizontalAlign2.RIGHT=3]="RIGHT",HorizontalAlign2[HorizontalAlign2.JUSTIFIED=4]="JUSTIFIED",HorizontalAlign2[HorizontalAlign2.BOTH=5]="BOTH",HorizontalAlign2[HorizontalAlign2.DISTRIBUTED=6]="DISTRIBUTED",HorizontalAlign2))(HorizontalAlign||{}),VerticalAlign=(VerticalAlign2=>(VerticalAlign2[VerticalAlign2.UNSPECIFIED=0]="UNSPECIFIED",VerticalAlign2[VerticalAlign2.TOP=1]="TOP",VerticalAlign2[VerticalAlign2.MIDDLE=2]="MIDDLE",VerticalAlign2[VerticalAlign2.BOTTOM=3]="BOTTOM",VerticalAlign2))(VerticalAlign||{}),WrapStrategy=(WrapStrategy2=>(WrapStrategy2[WrapStrategy2.UNSPECIFIED=0]="UNSPECIFIED",WrapStrategy2[WrapStrategy2.OVERFLOW=1]="OVERFLOW",WrapStrategy2[WrapStrategy2.CLIP=2]="CLIP",WrapStrategy2[WrapStrategy2.WRAP=3]="WRAP",WrapStrategy2))(WrapStrategy||{}),FontItalic=(FontItalic2=>(FontItalic2[FontItalic2.NORMAL=0]="NORMAL",FontItalic2[FontItalic2.ITALIC=1]="ITALIC",FontItalic2))(FontItalic||{}),FontWeight=(FontWeight2=>(FontWeight2[FontWeight2.NORMAL=0]="NORMAL",FontWeight2[FontWeight2.BOLD=1]="BOLD",FontWeight2))(FontWeight||{}),BaselineOffset=(BaselineOffset2=>(BaselineOffset2[BaselineOffset2.NORMAL=1]="NORMAL",BaselineOffset2[BaselineOffset2.SUBSCRIPT=2]="SUBSCRIPT",BaselineOffset2[BaselineOffset2.SUPERSCRIPT=3]="SUPERSCRIPT",BaselineOffset2))(BaselineOffset||{}),BooleanNumber=(BooleanNumber2=>(BooleanNumber2[BooleanNumber2.FALSE=0]="FALSE",BooleanNumber2[BooleanNumber2.TRUE=1]="TRUE",BooleanNumber2))(BooleanNumber||{}),CellValueType=(CellValueType2=>(CellValueType2[CellValueType2.STRING=1]="STRING",CellValueType2[CellValueType2.NUMBER=2]="NUMBER",CellValueType2[CellValueType2.BOOLEAN=3]="BOOLEAN",CellValueType2[CellValueType2.FORCE_STRING=4]="FORCE_STRING",CellValueType2))(CellValueType||{}),ThemeColorType=(ThemeColorType2=>(ThemeColorType2[ThemeColorType2.DARK1=0]="DARK1",ThemeColorType2[ThemeColorType2.LIGHT1=1]="LIGHT1",ThemeColorType2[ThemeColorType2.DARK2=2]="DARK2",ThemeColorType2[ThemeColorType2.LIGHT2=3]="LIGHT2",ThemeColorType2[ThemeColorType2.ACCENT1=4]="ACCENT1",ThemeColorType2[ThemeColorType2.ACCENT2=5]="ACCENT2",ThemeColorType2[ThemeColorType2.ACCENT3=6]="ACCENT3",ThemeColorType2[ThemeColorType2.ACCENT4=7]="ACCENT4",ThemeColorType2[ThemeColorType2.ACCENT5=8]="ACCENT5",ThemeColorType2[ThemeColorType2.ACCENT6=9]="ACCENT6",ThemeColorType2[ThemeColorType2.HYPERLINK=10]="HYPERLINK",ThemeColorType2[ThemeColorType2.FOLLOWED_HYPERLINK=11]="FOLLOWED_HYPERLINK",ThemeColorType2))(ThemeColorType||{}),ThemeColors=(ThemeColors2=>(ThemeColors2.OFFICE="Office",ThemeColors2.OFFICE_2007_2010="Office 2007-2010",ThemeColors2.GRAYSCALE="Grayscale",ThemeColors2.BLUE_WARM="Blue Warm",ThemeColors2.BLUE="Blue",ThemeColors2.BLUE_II="Blue II",ThemeColors2.BLUE_GREEN="Blue Green",ThemeColors2.GREEN="Green",ThemeColors2.GREEN_YELLOW="Green Yellow",ThemeColors2.YELLOW="Yellow",ThemeColors2.YELLOW_ORANGE="Yellow Orange",ThemeColors2.ORANGE="Orange",ThemeColors2.ORANGE_RED="Orange Red",ThemeColors2.RED_ORANGE="Red Orange",ThemeColors2.RED="Red",ThemeColors2.RED_VIOLET="Red Violet",ThemeColors2.VIOLET="Violet",ThemeColors2.VIOLET_II="Violet II",ThemeColors2.MEDIAN="Median",ThemeColors2.PAPER="Paper",ThemeColors2.MARQUEE="Marquee",ThemeColors2.SLIPSTREAM="Slipstream",ThemeColors2.Aspect="Aspect",ThemeColors2))(ThemeColors||{});const urlAlphabet="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let random=__name(bytes=>crypto.getRandomValues(new Uint8Array(bytes)),"random"),customRandom=__name((alphabet,defaultSize,getRandom)=>{let mask=(2<<Math.log2(alphabet.length-1))-1,step=-~(1.6*mask*defaultSize/alphabet.length);return(size=defaultSize)=>{let id="";for(;;){let bytes=getRandom(step),j=step|0;for(;j--;)if(id+=alphabet[bytes[j]&mask]||"",id.length>=size)return id}}},"customRandom"),customAlphabet=__name((alphabet,size=21)=>customRandom(alphabet,size|0,random),"customAlphabet"),nanoid=__name((size=21)=>{let id="",bytes=crypto.getRandomValues(new Uint8Array(size|=0));for(;size--;)id+=urlAlphabet[bytes[size]&63];return id},"nanoid");const topLevelDomainSet=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"]),re_weburl=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 isLegalUrl(url){if(!Number.isNaN(+url))return!1;if(url.startsWith("http://localhost:3002")||url.startsWith("localhost:3002"))return!0;if(re_weburl.test(url)){if(hasProtocol(url))return!0;try{const topLevelDomain=new URL(normalizeUrl(url)).hostname.split(".").pop();if(topLevelDomain&&topLevelDomainSet.has(topLevelDomain))return!0}catch{return!1}}return!1}__name(isLegalUrl,"isLegalUrl");function hasProtocol(urlString){return/^[a-zA-Z]+:\/\//.test(urlString)}__name(hasProtocol,"hasProtocol");function isEmail(url){return/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/.test(url)}__name(isEmail,"isEmail");function normalizeUrl(urlStr){return hasProtocol(urlStr)?urlStr:isEmail(urlStr)?`mailto://${urlStr}`:`https://${urlStr}`}__name(normalizeUrl,"normalizeUrl");const rmsPrefix=/^-ms-/,rDashAlpha=/-([a-z])/g,alphabets=["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 isValueEqual(oneValue,twoValue){const oneType=Tools.getValueType(oneValue),twoType=Tools.getValueType(twoValue);return oneType!==twoType?!1:Tools.isArray(oneValue)?diffArrays(oneValue,twoValue):Tools.isObject(oneValue)?diffObject(oneValue,twoValue):Tools.isDate(oneValue)?oneValue.getTime()===twoValue.getTime():Tools.isRegExp(oneValue)?oneValue.toString()===twoValue.toString():oneValue===twoValue}__name(isValueEqual,"isValueEqual");function diffArrays(oneArray,twoArray){if(oneArray.length!==twoArray.length)return!1;for(let i=0,len=oneArray.length;i<len;i++){const oneValue=oneArray[i],twoValue=twoArray[i];if(!isValueEqual(oneValue,twoValue))return!1}return!0}__name(diffArrays,"diffArrays");function diffObject(oneObject,twoObject){const oneKeys=Object.keys(oneObject),twoKeys=Object.keys(twoObject);if(oneKeys.length!==twoKeys.length)return!1;for(const key of oneKeys){if(!twoKeys.includes(key))return!1;const oneValue=oneObject[key],twoValue=twoObject[key];if(!isValueEqual(oneValue,twoValue))return!1}return!0}__name(diffObject,"diffObject");const _Tools=class _Tools{static stringAt(index2){let str="",idx=index2;for(;idx>=alphabets.length;)idx/=alphabets.length,idx-=1,str+=alphabets[idx%alphabets.length];const last=index2%alphabets.length;return str+=alphabets[last],str}static indexAt(code){let ret=0;for(let i=0;i<code.length-1;i+=1){const idx=code.charCodeAt(i)-65,expoNet=code.length-1-i;ret+=alphabets.length**expoNet+alphabets.length*idx}return ret+=code.charCodeAt(code.length-1)-65,ret}static deleteBlank(value){return _Tools.isString(value)?value.replace(/\s/g,""):value}static getSystemType(){const sUserAgent=navigator.userAgent,isWin=navigator.platform==="Win32"||navigator.platform==="Windows",isMac=navigator.platform==="Mac68K"||navigator.platform==="MacPPC"||navigator.platform==="Macintosh"||navigator.platform==="MacIntel";if(isMac)return"Mac";if(navigator.platform==="X11"&&!isWin&&!isMac)return"Unix";if(String(navigator.platform).indexOf("Linux")>-1)return"Linux";if(isWin){if(sUserAgent.indexOf("Windows NT 5.0")>-1||sUserAgent.indexOf("Windows 2000")>-1)return"Windows 2000";if(sUserAgent.indexOf("Windows NT 5.1")>-1||sUserAgent.indexOf("Windows XP")>-1)return"Windows XP";if(sUserAgent.indexOf("Windows NT 5.2")>-1||sUserAgent.indexOf("Windows 2003")>-1)return"Windows 2003";if(sUserAgent.indexOf("Windows NT 6.0")>-1||sUserAgent.indexOf("Windows Vista")>-1)return"Windows Vista";if(sUserAgent.indexOf("Windows NT 6.1")>-1||sUserAgent.indexOf("Windows 7")>-1)return"Windows 7";if(sUserAgent.indexOf("Windows NT 10")>-1||sUserAgent.indexOf("Windows 10")>-1)return"Windows 10";if(sUserAgent.indexOf("Windows NT 11")>-1||sUserAgent.indexOf("Windows 11")>-1)return"Windows 11"}return"Unknown system"}static getBrowserType(){const userAgent=navigator.userAgent,isOpera=userAgent.indexOf("Opera")>-1,isIE=userAgent.indexOf("compatible")>-1&&userAgent.indexOf("MSIE")>-1&&!isOpera,isIE11=userAgent.indexOf("Trident")>-1&&userAgent.indexOf("rv:11.0")>-1,isEdge=userAgent.indexOf("Edge")>-1,isFF=userAgent.indexOf("Firefox")>-1,isSafari=userAgent.indexOf("Safari")>-1&&userAgent.indexOf("Chrome")===-1,isChrome=userAgent.indexOf("Chrome")>-1&&userAgent.indexOf("Safari")>-1;if(isIE){new RegExp("MSIE (\\d+\\.\\d+);").test(userAgent);const fIEVersion=Number.parseFloat(RegExp.$1);return fIEVersion===7?"IE7":fIEVersion===8?"IE8":fIEVersion===9?"IE9":fIEVersion===10?"IE10":"0"}return isFF?"FF":isOpera?"Opera":isSafari?"Safari":isChrome?"Chrome":isEdge?"Edge":isIE11?"IE11":"Unknown browser"}static generateRandomId(n=21,alphabet){return generateRandomId(n,alphabet)}static getClassName(instance){return instance.constructor.name}static deepMerge(target,...sources){sources.forEach(item=>item&&deepItem(item));function deepArray(array,to){array.forEach((value,key)=>{var _a17,_b2;if(_Tools.isArray(value)){const origin=(_a17=to[key])!=null?_a17:[];to[key]=origin,deepArray(value,origin);return}if(_Tools.isObject(value)){const origin=(_b2=to[key])!=null?_b2:{};to[key]=origin,deepObject(value,origin);return}to[key]=value})}__name(deepArray,"deepArray");function deepObject(object,to){Object.keys(object).forEach(key=>{var _a17,_b2;const value=object[key];if(_Tools.isObject(value)){const origin=(_a17=to[key])!=null?_a17:{};to[key]=origin,deepObject(value,origin);return}if(_Tools.isArray(value)){const origin=(_b2=to[key])!=null?_b2:[];to[key]=origin,deepArray(value,origin);return}to[key]=value})}__name(deepObject,"deepObject");function deepItem(item){Object.keys(item).forEach(key=>{var _a17,_b2;const value=item[key];if(_Tools.isArray(value)){const origin=(_a17=target[key])!=null?_a17:[];target[key]=origin,deepArray(value,origin);return}if(_Tools.isObject(value)){const origin=(_b2=target[key])!=null?_b2:{};target[key]=origin,deepObject(value,origin);return}target[key]=value})}return __name(deepItem,"deepItem"),target}static numberFixed(value,digit){return Number(Number(value).toFixed(digit))}static diffValue(one,two){return isValueEqual(one,two)}static deepClone(value){if(!this.isDefine(value))return value;if(this.isRegExp(value))return new RegExp(value);if(this.isDate(value))return new Date(value);if(this.isArray(value)){const clone=[];return value.forEach((item,index2)=>{clone[index2]=_Tools.deepClone(item)}),clone}if(this.isObject(value)){const clone={};return Object.keys(value).forEach(key=>{const item=value[key];clone[key]=_Tools.deepClone(item)}),Object.setPrototypeOf(clone,Object.getPrototypeOf(value)),clone}return value}static getLanguage(){const defaultValue="en-US";return globalThis.navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||defaultValue}static getValueType(value){return Object.prototype.toString.apply(value)}static isDefine(value){return value!=null}static isBlank(value){return this.isDefine(value)?this.isString(value)?value.trim()==="":!1:!0}static isBoolean(value){return this.getValueType(value)==="[object Boolean]"}static isPlainObject(value){return this.isDefine(value)?Object.getPrototypeOf(value)===Object.getPrototypeOf({}):!1}static isFunction(value){return this.getValueType(value)==="[object Function]"}static isDate(value){return this.getValueType(value)==="[object Date]"}static isRegExp(value){return this.getValueType(value)==="[object RegExp]"}static isArray(value){return this.getValueType(value)==="[object Array]"}static isString(value){return this.getValueType(value)==="[object String]"}static isNumber(value){return this.getValueType(value)==="[object Number]"}static isStringNumber(value){return!isNaN(Number.parseFloat(value))&&isFinite(value)}static isObject(value){return this.getValueType(value)==="[object Object]"}static isEmptyObject(value){for(const _key in value)return!1;return!0}static isMobile(){let clientWidth=0,clientHeight=0;return document.body.clientWidth&&(clientWidth=document.body.clientWidth),document.body.clientHeight&&(clientHeight=document.body.clientHeight),this.isAndroid()||this.isIPhone()||this.isTablet()||clientWidth<350&&clientHeight<500}static isTablet(){return/ipad|android|android 3.0|xoom|sch-i800|playbook|tablet|kindle/i.test(navigator.userAgent.toLowerCase())}static isWeChat(){const userAgent=navigator.userAgent.toLowerCase();return String(userAgent.match(/MicroMessenger/i))==="micromessenger"}static isAndroid(){const userAgent=navigator.userAgent;return userAgent.indexOf("Android")>-1||userAgent.indexOf("Linux")>-1}static isIPhone(){return/iPhone/i.test(navigator.userAgent)}static isLegalUrl(url){return isLegalUrl(url)}static normalizeUrl(url){return normalizeUrl(url)}static topLevelDomainCombiningString(){return[...topLevelDomainSet].join("|")}static itCount(count){return callback=>{for(let i=0;i<count;i++)callback&&callback()}}static hasLength(target,length){return _Tools.isDefine(target)?_Tools.isDefine(length)?target.length===length:target.length>0:!1}static capitalize(str){return str.charAt(0).toUpperCase()+str.slice(1)}static fCamelCase(_all,letter){return letter.toUpperCase()}static camelCase(str){return str.replace(rmsPrefix,"ms-").replace(rDashAlpha,this.fCamelCase)}static removeNull(value){return this.isObject(value)&&Object.keys(value).forEach(key=>{const item=value[key];item==null?delete value[key]:_Tools.removeNull(item)}),value}static fillTwoDimensionalArray(rows,columns,value){return new Array(rows).fill(value).map(item=>new Array(columns).fill(value))}static numToWord(x){let s="";for(;x>0;){let m=x%26;m=m===0?m=26:m,s=String.fromCharCode(96+m)+s,x=(x-m)/26}return s.toLocaleUpperCase()}static ABCatNum(a){if(a==null||a.length===0)return Number.NaN;const str=a.toLowerCase().split(""),al=str.length;let numOut=0,charnum=0;for(let i=0;i<al;i++)charnum=str[i].charCodeAt(0)-96,numOut+=charnum*26**(al-i-1);return numOut===0?Number.NaN:numOut-1}static chatAtABC(n){let s="";for(;n>=0;)s=String.fromCharCode(n%26+97)+s,n=Math.floor(n/26)-1;return s.toUpperCase()}static randSort(arr){for(let i=0,len=arr.length;i<len;i++){const rand=Number.parseInt((Math.random()*len).toString()),temp=arr[rand];arr[rand]=arr[i],arr[i]=temp}return arr}static commonExtend(originJson,extendJson){const resultJsonObject={};for(const attr in originJson)resultJsonObject[attr]=originJson[attr];for(const attr in extendJson)extendJson[attr]!=null&&(resultJsonObject[attr]=extendJson[attr]);return resultJsonObject}static commonExtend1(originJson,extendJson){for(const attr in originJson)extendJson[attr]==null&&(extendJson[attr]=originJson[attr]);return extendJson}static arrayToObject(array){const obj={};return array.forEach((row,i)=>{obj[i]={},row.forEach((column,j)=>{obj[i][j]=column})}),obj}static hasIntersectionBetweenTwoRanges(range1Start,range1End,range2Start,range2End){return range1End>=range2Start&&range2End>=range1Start}static isStartValidPosition(name){return/^[A-Za-z_]/.test(name)}static isValidParameter(name){const containsInvalidChars=/[~!@#$%^&*()+=\-{}\[\]\|:;"'<>,?\/ ]+/.test(name),isValidLength=name.length<=255;return!containsInvalidChars&&isValidLength}static clamp(value,min,max){return Math.max(min,Math.min(max,value))}static now(){return performance&&performance.now?performance.now():Date.now()}};__name(_Tools,"Tools");let Tools=_Tools;function generateRandomId(n=21,alphabet){return alphabet?customAlphabet(alphabet,n)():nanoid(n)}__name(generateRandomId,"generateRandomId");function composeStyles(...styles){const result={},length=styles.length;for(let i=length-1;i>=0;i--){const style=styles[i];if(style){const keys=Object.keys(style);for(const key of keys)result[key]===void 0&&(result[key]=style[key])}}return result}__name(composeStyles,"composeStyles");const isNodeEnv=__name(()=>typeof process<"u"&&process.versions!=null&&process.versions.node!=null,"isNodeEnv");function getBodySliceHtml(body,startIndex,endIndex){const{dataStream,textRuns=[]}=body;let cursorIndex=startIndex;const spanList=[];for(const textRun of textRuns){const{st,ed}=textRun;Tools.hasIntersectionBetweenTwoRanges(startIndex,endIndex,st,ed)&&(st>cursorIndex?(spanList.push(dataStream.slice(cursorIndex,st)),spanList.push(covertTextRunToHtml(dataStream,{...textRun,ed:Math.min(ed,endIndex)}))):spanList.push(covertTextRunToHtml(dataStream,{...textRun,st:cursorIndex,ed:Math.min(ed,endIndex)}))),cursorIndex=Math.max(startIndex,Math.min(ed,endIndex))}return cursorIndex!==endIndex&&spanList.push(dataStream.slice(cursorIndex,endIndex)),spanList.join("")}__name(getBodySliceHtml,"getBodySliceHtml");function convertBodyToHtml(body,withParagraphInfo=!0){var _a17;if(withParagraphInfo&&((_a17=body.paragraphs)!=null&&_a17.length)){const{dataStream,paragraphs=[]}=body;let result="",cursorIndex=-1;for(const paragraph of paragraphs){const{startIndex,paragraphStyle={}}=paragraph,{spaceAbove,spaceBelow,lineSpacing}=paragraphStyle,style=[];spaceAbove!=null&&(typeof spaceAbove=="number"?style.push(`margin-top: ${spaceAbove}px`):style.push(`margin-top: ${spaceAbove.v}px`)),spaceBelow!=null&&(typeof spaceBelow=="number"?style.push(`margin-bottom: ${spaceBelow}px`):style.push(`margin-bottom: ${spaceBelow.v}px`)),lineSpacing!=null&&style.push(`line-height: ${lineSpacing}`),startIndex>cursorIndex+1?result+=`<p class="UniverNormal" ${style.length?`style="${style.join("; ")};"`:""}>${getBodySliceHtml(body,cursorIndex+1,startIndex)}</p>`:result+=`<p class="UniverNormal" ${style.length?`style="${style.join("; ")};"`:""}></p>`,cursorIndex=startIndex}return cursorIndex!==dataStream.length&&(result+=getBodySliceHtml(body,cursorIndex,dataStream.length)),result}else return getBodySliceHtml(body,0,body.dataStream.length)}__name(convertBodyToHtml,"convertBodyToHtml");function covertTextRunToHtml(dataStream,textRun){const{st:start,ed,ts={}}=textRun,{ff,fs,it,bl,ul,st,ol,bg,cl,va}=ts;let html=dataStream.slice(start,ed);const style=[];return it===BooleanNumber.TRUE&&(html=`<i>${html}</i>`),va===BaselineOffset.SUPERSCRIPT?html=`<sup>${html}</sup>`:va===BaselineOffset.SUBSCRIPT&&(html=`<sub>${html}</sub>`),(ul==null?void 0:ul.s)===BooleanNumber.TRUE&&(html=`<u>${html}</u>`),(st==null?void 0:st.s)===BooleanNumber.TRUE&&(html=`<s>${html}</s>`),bl===BooleanNumber.TRUE&&(html=`<strong>${html}</strong>`),ff&&style.push(`font-family: ${ff}`),cl&&style.push(`color: ${cl.rgb}`),fs&&style.push(`font-size: ${fs}pt`),ol&&style.push("text-decoration: overline"),bg&&style.push(`background: ${bg.rgb}`),style.length?`<span style="${style.join("; ")};">${html}</span>`:html}__name(covertTextRunToHtml,"covertTextRunToHtml");const THEME_COLORS={[ThemeColors.OFFICE]:{[ThemeColorType.ACCENT1]:"#4472C4",[ThemeColorType.ACCENT2]:"#ED7D31",[ThemeColorType.ACCENT3]:"#A5A5A5",[ThemeColorType.ACCENT4]:"#70AD47",[ThemeColorType.ACCENT5]:"#5B9BD5",[ThemeColorType.ACCENT6]:"#70AD47",[ThemeColorType.DARK1]:"#000000",[ThemeColorType.DARK2]:"#44546A",[ThemeColorType.LIGHT1]:"#FFFFFF",[ThemeColorType.LIGHT2]:"#E7E6E6",[ThemeColorType.HYPERLINK]:"#0563C1",[ThemeColorType.FOLLOWED_HYPERLINK]:"#954F72"}},_ColorBuilder=class _ColorBuilder{constructor(){__publicField(this,"_themeValue",ThemeColorType.LIGHT1);__publicField(this,"_themeColors");__publicField(this,"_themeTint");__publicField(this,"_rgbValue","");__publicField(this,"_colorType");this._colorType=ColorType.UNSUPPORTED,this._themeColors=ThemeColors.OFFICE,this._themeTint=0}asRgbColor(){return new RgbColor(this._rgbValue,this)}asThemeColor(){return new ThemeColor(this._themeValue,this._themeTint,this._themeColors,this)}build(){switch(this._colorType){case ColorType.THEME:return this.asThemeColor();case ColorType.RGB:return this.asRgbColor();case ColorType.UNSUPPORTED:throw new Error("unsupported color type")}}setRgbColor(cssString){return this._colorType=ColorType.RGB,this._rgbValue=cssString,this}setThemeColors(value){this._colorType=ColorType.THEME,this._themeColors=value}setThemeTint(value){this._colorType=ColorType.THEME,this._themeTint=value}setThemeColor(theme){return this._colorType=ColorType.THEME,this._themeValue=theme,this}getColorType(){return this._colorType}};__name(_ColorBuilder,"ColorBuilder");let ColorBuilder=_ColorBuilder;const _Color=class _Color{constructor(builder){__publicField(this,"_builder");this._builder=builder}static rgbColorToHexValue(color){return`#${((1<<24)+(color.getRed()<<16)+(color.getGreen()<<8)+color.getBlue()).toString(16).slice(1)}`}static hexValueToRgbColor(hexValue){hexValue?hexValue.indexOf("#")>-1&&(hexValue=hexValue.substring(1)):hexValue="#000000";const r=+`0x${hexValue[0]}${hexValue[1]}`,g=+`0x${hexValue[2]}${hexValue[3]}`,b=+`0x${hexValue[4]}${hexValue[5]}`;return new ColorBuilder().setRgbColor(`rgb(${r},${g},${b})`).asRgbColor()}static hexToRgbString(hex){const shorthandRegex=/^#?([a-f\d])([a-f\d])([a-f\d])$/i;hex=hex.replace(shorthandRegex,(m,r,g,b)=>r+r+g+g+b+b);const result=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);let string=null;if(result){const r=Number.parseInt(result[1],16),g=Number.parseInt(result[2],16),b=Number.parseInt(result[3],16);string=`rgba(${r},${g},${b})`}return string}asRgbColor(){return this._builder.asRgbColor()}asThemeColor(){return this._builder.asThemeColor()}getColorType(){return this._builder.getColorType()}clone(){return new _Color(this._builder)}equals(color){return!1}};__name(_Color,"Color");let Color=_Color;const _HLSColor=class _HLSColor{constructor(rgbColor){__publicField(this,"_saturation",0);__publicField(this,"_hue",0);__publicField(this,"_lightness",0);__publicField(this,"_alpha",0);const red=rgbColor.getRed()/255,green=rgbColor.getGreen()/255,blue=rgbColor.getBlue()/255,alpha=rgbColor.getAlpha()/255,min=Math.min(red,Math.min(green,blue)),max=Math.max(red,Math.max(green,blue)),delta=max-min;if(max===min){this._hue=0,this._saturation=0,this._lightness=max;return}this._lightness=(min+max)/2,this._lightness<.5?this._saturation=delta/(max+min):this._saturation=delta/(2-max-min),red===max&&(this._hue=(green-blue)/delta),green===max&&(this._hue=2+(blue-red)/delta),blue===max&&(this._hue=4+(red-green)/delta),this._hue*=60,this._hue<0&&(this._hue+=360),this._alpha=alpha}asRgbColor(){const builder=new ColorBuilder;if(this._saturation===0)return builder.setRgbColor(`rgba(${this._lightness*255},${this._lightness*255},${this._lightness*255},${this._alpha*255})`),builder.asRgbColor();let t1;this._lightness<.5?t1=this._lightness*(1+this._saturation):t1=this._lightness+this._saturation-this._lightness*this._saturation;const t2=2*this._lightness-t1,hue=this._hue/360,tR=hue+1/3,red=this.setColor(t1,t2,tR),green=this.setColor(t1,t2,hue),tB=hue-1/3,blue=this.setColor(t1,t2,tB);return builder.setRgbColor(`rgba(${Math.round(red*255)},${Math.round(green*255)},${Math.round(blue*255)},${this._alpha*255})`),builder.asRgbColor()}getLightness(){return this._lightness}getHue(){return this._hue}getSaturation(){return this._saturation}getAlpha(){return this._alpha}setColor(t1,t2,t3){t3<0&&(t3+=1),t3>1&&(t3-=1);let color;return 6*t3<1?color=t2+(t1-t2)*6*t3:2*t3<1?color=t1:3*t3<2?color=t2+(t1-t2)*(2/3-t3)*6:color=t2,color}setLightness(lightness){this._lightness=lightness}};__name(_HLSColor,"HLSColor");let HLSColor=_HLSColor;const _RgbColor=class _RgbColor extends Color{constructor(cssString,builder){super(builder);__publicField(this,"_cssString");__publicField(this,"_red");__publicField(this,"_green");__publicField(this,"_blue");__publicField(this,"_alpha");let match=cssString.match(_RgbColor.RGBA_EXTRACT);if(match){const red=+match[1],green=+match[2],blue=+match[3],alpha=+match[4];this._cssString=cssString,this._red=red,this._green=green,this._blue=blue,this._alpha=alpha;return}if(match=cssString.match(_RgbColor.RGB_EXTRACT),match){const red=+match[1],green=+match[2],blue=+match[3];this._cssString=cssString,this._red=red,this._green=green,this._blue=blue,this._alpha=1;return}throw new Error("Invalid rgba or rgb color")}asHexString(){return Color.rgbColorToHexValue(this)}getRed(){let r=this._red+_RgbColor.RGB_COLOR_AMT;return r>255?r=255:r<0&&(r=0),r}getGreen(){let g=this._green+_RgbColor.RGB_COLOR_AMT;return g>255?g=255:g<0&&(g=0),g}getBlue(){let b=this._blue+_RgbColor.RGB_COLOR_AMT;return b>255?b=255:b<0&&(b=0),b}getAlpha(){return this._alpha}getColorType(){return ColorType.RGB}clone(){return new _RgbColor(this._cssString,this._builder)}asThemeColor(){throw new Error("rgb color not support to themeColor")}equals(color){return color instanceof _RgbColor?color._red===this._red&&color._blue===this._blue&&color._green===this._green&&color._alpha===this._alpha:!1}getCssString(){return this._cssString}};__name(_RgbColor,"RgbColor"),__publicField(_RgbColor,"RGB_COLOR_AMT",0),__publicField(_RgbColor,"RGBA_EXTRACT",new RegExp("\\s*rgba\\s*\\((\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d.\\d|\\d\\s*)\\)\\s*")),__publicField(_RgbColor,"RGB_EXTRACT",new RegExp("\\s*rgb\\s*\\((\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d+\\s*)\\)\\s*"));let RgbColor=_RgbColor;const _ThemeColor=class _ThemeColor extends Color{constructor(theme,themeTint,themeColors,builder){super(builder);__publicField(this,"_themeColorType");__publicField(this,"_themeTint");__publicField(this,"_themeColors");this._themeColorType=theme,this._themeTint=themeTint,this._themeColors=themeColors}lumValue(tint,lum){if(tint==null)return lum;let value;return tint<0?value=lum*(1+tint):value=lum*(1-tint)+(255-255*(1-tint)),value}asRgbColor(){const themeColors=THEME_COLORS[this._themeColors];if(themeColors==null)throw new Error("not find themeColors type");const hexValue=themeColors[this._themeColorType];if(hexValue==null)throw new Error("not find themeColors value");let themeCache;if(_ThemeColor._cacheThemeColor.has(this._themeColors)){if(themeCache=_ThemeColor._cacheThemeColor.get(this._themeColors),themeCache.has(this._themeColorType))return themeCache.get(this._themeColorType)}else themeCache=new Map,_ThemeColor._cacheThemeColor.set(this._themeColors,themeCache);const hlsColor=new HLSColor(Color.hexValueToRgbColor(hexValue));hlsColor.setLightness(this.lumValue(this._themeTint,hlsColor.getLightness()*255)/255);const rgbColor=hlsColor.asRgbColor();return themeCache.set(this._themeColorType,rgbColor),rgbColor}clone(){return new _ThemeColor(this._themeColorType,this._themeTint,this._themeColors,this._builder)}equals(color){return color instanceof _ThemeColor?color._themeColorType===this._themeColorType:!1}getColorType(){return ColorType.THEME}getThemeColorType(){return this._themeColorType}};__name(_ThemeColor,"ThemeColor"),__publicField(_ThemeColor,"_cacheThemeColor",new Map);let ThemeColor=_ThemeColor;const RGB_PAREN="rgb(",RGBA_PAREN="rgba(",COLORS={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],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]},_ColorKit=class _ColorKit{constructor(color){__publicField(this,"_color");__publicField(this,"_rgbColor");__publicField(this,"_isValid",!1);if(color==null){this._setNullColor();return}if(color instanceof _ColorKit){this._color={...color._color},this._rgbColor={...color._rgbColor};return}const colorObject=toColor(color);if(colorObject==null){this._setNullColor();return}this._color=colorObject;const rgbColorObject=toRgbColor(this._color);if(rgbColorObject==null){this._setNullColor();return}this._rgbColor=rgbColorObject,this._isValid=!0}static mix(color1,color2,amount){var _a17,_b2;amount=Math.min(1,Math.max(0,amount));const rgb1=new _ColorKit(color1).toRgb(),rgb2=new _ColorKit(color2).toRgb(),alpha1=(_a17=rgb1.a)!=null?_a17:1,alpha2=(_b2=rgb2.a)!=null?_b2:1,rgba={r:(rgb2.r-rgb1.r)*amount+rgb1.r,g:(rgb2.g-rgb1.g)*amount+rgb1.g,b:(rgb2.b-rgb1.b)*amount+rgb1.b,a:(alpha2-alpha1)*amount+alpha1};return new _ColorKit(rgba)}static getContrastRatio(foreground,background){const lumA=new _ColorKit(foreground).getLuminance(),lumB=new _ColorKit(background).getLuminance();return(Math.max(lumA,lumB)+.05)/(Math.min(lumA,lumB)+.05)}get isValid(){return this._isValid}toRgb(){return this._rgbColor}toRgbString(){const{r,g,b,a=1}=this.toRgb(),useAlpha=a<1;return`rgb${useAlpha?"a":""}(${r},${g},${b}${useAlpha?`,${a}`:""})`}toString(){return this.toRgbString()}toHexString(allowShort){const{r,g,b,a=1}=this.toRgb(),useAlpha=a<1,hex=[pad2(Math.round(r).toString(16)),pad2(Math.round(g).toString(16)),pad2(Math.round(b).toString(16)),pad2(Math.round(a*255).toString(16))];return allowShort&&hex[0][0]===hex[0][1]&&hex[1][0]===hex[1][1]&&hex[2][0]===hex[2][1]&&hex[3][0]===hex[3][1]?useAlpha?`#${hex[0][0]}${hex[1][0]}${hex[2][0]}${hex[3][0]}`:`#${hex[0][0]}${hex[1][0]}${hex[2][0]}`:useAlpha?`#${hex[0]}${hex[1]}${hex[2]}${hex[3]}`:`#${hex[0]}${hex[1]}${hex[2]}`}toHsv(){return rgb2Hsv(this.toRgb())}toHsl(){return rgb2Hsl(this.toRgb())}lighten(amount=10){const hsl=this.toHsl();return hsl.l+=amount,hsl.l=Math.min(Math.max(hsl.l,0),100),new _ColorKit(hsl)}darken(amount=10){const hsl=this.toHsl();return hsl.l-=amount,hsl.l=Math.min(Math.max(hsl.l,0),100),new _ColorKit(hsl)}setAlpha(value){return new _ColorKit({...this._rgbColor,a:value})}getLuminance(){let{r,g,b}=this.toRgb();return r=rgbNormalize(r),g=rgbNormalize(g),b=rgbNormalize(b),Number((.2126*r+.7152*g+.0722*b).toFixed(3))}getBrightness(){const{r,g,b}=this.toRgb();return(r*299+g*587+b*114)/1e3}getAlpha(){var _a17;return(_a17=this._color.a)!=null?_a17: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}}};__name(_ColorKit,"ColorKit");let ColorKit=_ColorKit;const pad2=__name(v=>v.length===1?`0${v}`:v,"pad2"),rgbNormalize=__name(val=>(val/=255,val<=.03928?val/12.92:((val+.055)/1.055)**2.4),"rgbNormalize"),toColor=__name(color=>{if(isObject(color)){if("r"in color){const rgb={r:Math.round(color.r),g:Math.round(color.g),b:Math.round(color.b)};return color.a!==void 0&&(rgb.a=color.a),rgb}if("l"in color){const hsl={h:Math.round(color.h),s:color.s,l:color.l};return color.a!==void 0&&(hsl.a=color.a),hsl}const hsv={h:Math.round(color.h),s:color.s,v:color.v};return color.a!==void 0&&(hsv.a=color.a),hsv}const parsedColor=color.trim();if(COLORS[parsedColor]){const colorArray=COLORS[parsedColor],rgb={r:Math.round(colorArray[0]),g:Math.round(colorArray[1]),b:Math.round(colorArray[2])};return rgb.a=colorArray[3]||1,rgb}if(parsedColor.startsWith("#"))return hexToColor(parsedColor);if(parsedColor.startsWith("rgb"))return rgbToColor(parsedColor);if(parsedColor.startsWith("hsl"))return hslToColor(parsedColor);if(parsedColor.startsWith("hsv"))return hsvToColor(parsedColor)},"toColor"),hexToColor=__name(color=>{const parsedColor=color.substring(1),re=new RegExp(`.{1,${parsedColor.length>=6?2:1}}`,"g");let colors=parsedColor.match(re);if(!colors||colors.length<3)throw new Error(`The color '${color}' is illegal hex color`);colors[0].length===1&&(colors=colors.map(n=>n+n));const rgbColor={r:Number.parseInt(colors[0],16),g:Number.parseInt(colors[1],16),b:Number.parseInt(colors[2],16)};return colors.length>3&&(rgbColor.a=Number.parseInt(colors[3],16)/255),rgbColor},"hexToColor"),rgbToColor=__name(color=>{const matcher=color.indexOf("(");if(matcher===-1)throw new Error(`The color '${color}' is illegal rgb color`);const values=color.substring(matcher+1,color.length-1).split(",");if(values.length<3)throw new Error(`The color '${color}' is illegal rgb color`);const rgbColor={r:Number.parseInt(values[0],10),g:Number.parseInt(values[1],10),b:Number.parseInt(values[2],10)};return values.length>3&&(rgbColor.a=Number.parseFloat(values[3])),rgbColor},"rgbToColor"),hslToColor=__name(color=>{const matcher=color.indexOf("(");if(matcher===-1)throw new Error(`The color '${color}' is illegal hsl color`);const values=color.substring(matcher+1,color.length-1).split(",");if(values.length<3)throw new Error(`The color '${color}' is illegal hsl color`);const hslColor={h:Number.parseInt(values[0],10),s:Number.parseFloat(values[1]),l:Number.parseFloat(values[2])};return values.length>3&&(hslColor.a=Number.parseFloat(values[3])),hslColor},"hslToColor"),hsvToColor=__name(color=>{const matcher=color.indexOf("(");if(matcher===-1)throw new Error(`The color '${color}' is illegal hsv color`);const values=color.substring(matcher+1,color.length-1).split(",");if(values.length<3)throw new Error(`The color '${color}' is illegal hsv color`);const hsvColor={h:Number.parseInt(values[0],10),s:Number.parseFloat(values[1]),v:Number.parseFloat(values[2])};return values.length>3&&(hsvColor.a=Number.parseFloat(values[3])),hsvColor},"hsvToColor"),toRgbColor=__name(color=>{const obj=toColor(color);if(obj!=null)return"r"in obj?obj:"l"in obj?hsl2Rgb(obj):hsv2Rgb(obj)},"toRgbColor"),hue2Rgb=__name((p,q,t)=>(t<0&&(t+=1),t>1&&(t-=1),t<1/6?p+(q-p)*6*t:t<1/2?q:t<2/3?p+(q-p)*(2/3-t)*6:p),"hue2Rgb"),hsl2Rgb=__name(color=>{let{h,s,l}=color;h/=360,s/=100,l/=100;let r=0,g=0,b=0;if(s===0)r=g=b=l;else{const q=l<.5?l*(1+s):l+s-l*s,p=2*l-q;r=hue2Rgb(p,q,h+1/3),g=hue2Rgb(p,q,h),b=hue2Rgb(p,q,h-1/3)}const IRgbColor={r:Math.round(r*255),g:Math.round(g*255),b:Math.round(b*255)};return color.a!==void 0&&(IRgbColor.a=color.a),IRgbColor},"hsl2Rgb"),hsv2Rgb=__name(color=>{let{h,s,v}=color;h=h/360*6,s/=100,v/=100;const i=Math.floor(h),f=h-i,p=v*(1-s),q=v*(1-f*s),t=v*(1-(1-f)*s),mod=i%6,r=[v,q,p,p,t,v][mod],g=[t,v,v,q,p,p][mod],b=[p,p,t,v,v,q][mod],IRgbColor={r:r*255,g:g*255,b:b*255};return color.a!==void 0&&(IRgbColor.a=color.a),IRgbColor},"hsv2Rgb"),rgb2Hsl=__name(color=>{let{r,g,b}=color;r/=255,g/=255,b/=255;const max=Math.max(r,g,b),min=Math.min(r,g,b),l=(max+min)/2;let h,s;if(max===min)h=s=0;else{const d=max-min;switch(s=l>.5?d/(2-max-min):d/(max+min),max){case r:h=(g-b)/d+(g<b?6:0);break;case g:h=(b-r)/d+2;break;default:h=(r-g)/d+4;break}h/=6}const hslColor={h:Math.round(h*360),s:Math.round(s*100),l:Math.round(l*100)};return color.a!==void 0&&(hslColor.a=color.a),hslColor},"rgb2Hsl"),rgb2Hsv=__name(color=>{let{r,g,b}=color;r/=255,g/=255,b/=255;const max=Math.max(r,g,b),min=Math.min(r,g,b);let h;const v=max,d=max-min,s=max===0?0:d/max;if(max===min)h=0;else{switch(max){case r:h=(g-b)/d+(g<b?6:0);break;case g:h=(b-r)/d+2;break;default:h=(r-g)/d+4;break}h/=6}const hsvColor={h:Math.round(h*360),s:Math.round(s*100),v:Math.round(v*100)};return color.a!==void 0&&(hsvColor.a=color.a),hsvColor},"rgb2Hsv"),isUndefinedOrNull=__name(value=>value==null,"isUndefinedOrNull"),isObject=__name(value=>!isUndefinedOrNull(value)&&typeof value=="object","isObject");function isBlackColor(color){const hexRegex=/^#(?:[0]{3}|[0]{6})\b/,rgbRegex=/^rgb\s*\(\s*0+\s*,\s*0+\s*,\s*0+\s*\)$/,rgbaRegex=/^rgba\s*\(\s*0+\s*,\s*0+\s*,\s*0+\s*,\s*(1|1\.0*|0?\.\d+)\)$/,hslRegex=/^hsl\s*\(\s*0*\s*,\s*0%*\s*,\s*0%*\s*\)$/,hslaRegex=/^hsla\s*\(\s*0*\s*,\s*0%*\s*,\s*0%*\s*,\s*(1|1\.0*|0?\.\d+)\)$/;return!!(hexRegex.test(color)||rgbRegex.test(color)||rgbaRegex.test(color)||hslRegex.test(color)||hslaRegex.test(color))}__name(isBlackColor,"isBlackColor");function isWhiteColor(color){const hexRegex=/^#(?:[Ff]{3}|[Ff]{6})\b/,rgbRegex=/^rgb\s*\(\s*255\s*,\s*255\s*,\s*255\s*\)$/,rgbaRegex=/^rgba\s*\(\s*255\s*,\s*255\s*,\s*255\s*,\s*(1|1\.0*|0?\.\d+)\)$/,hslRegex=/^hsl\s*\(\s*0*\s*,\s*0%*\s*,\s*100%*\s*\)$/,hslaRegex=/^hsla\s*\(\s*0*\s*,\s*0%*\s*,\s*100%*\s*,\s*(1|1\.0*|0?\.\d+)\)$/;return!!(hexRegex.test(color)||rgbRegex.test(color)||rgbaRegex.test(color)||hslRegex.test(color)||hslaRegex.test(color))}__name(isWhiteColor,"isWhiteColor");var UpdateDocsAttributeType=(UpdateDocsAttributeType2=>(UpdateDocsAttributeType2[UpdateDocsAttributeType2.COVER=0]="COVER",UpdateDocsAttributeType2[UpdateDocsAttributeType2.REPLACE=1]="REPLACE",UpdateDocsAttributeType2))(UpdateDocsAttributeType||{});function isICellData(value){return value&&(value.s!==void 0||value.p!==void 0||value.v!==void 0||value.t!==void 0||value.f!==void 0||value.si!==void 0||value.custom!==void 0)}__name(isICellData,"isICellData");function getCellValueType(cell){if(cell.t!==void 0)return cell.t;if(typeof cell.v=="string")return CellValueType.STRING;if(typeof cell.v=="number")return CellValueType.NUMBER;if(typeof cell.v=="boolean")return CellValueType.BOOLEAN}__name(getCellValueType,"getCellValueType");function isNullCell(cell){if(cell==null)return!0;const{v,f,si,p,custom}=cell;return!(!(v==null||typeof v=="string"&&v.length===0)||f!=null&&f.length>0||si!=null&&si.length>0||p!=null||custom!=null)}__name(isNullCell,"isNullCell");function isCellV(cell){return cell!=null&&(typeof cell=="string"||typeof cell=="number"||typeof cell=="boolean")}__name(isCellV,"isCellV");var RANGE_TYPE=(RANGE_TYPE2=>(RANGE_TYPE2[RANGE_TYPE2.NORMAL=0]="NORMAL",RANGE_TYPE2[RANGE_TYPE2.ROW=1]="ROW",RANGE_TYPE2[RANGE_TYPE2.COLUMN=2]="COLUMN",RANGE_TYPE2[RANGE_TYPE2.ALL=3]="ALL",RANGE_TYPE2))(RANGE_TYPE||{}),AbsoluteRefType=(AbsoluteRefType2=>(AbsoluteRefType2[AbsoluteRefType2.NONE=0]="NONE",AbsoluteRefType2[AbsoluteRefType2.ROW=1]="ROW",AbsoluteRefType2[AbsoluteRefType2.COLUMN=2]="COLUMN",AbsoluteRefType2[AbsoluteRefType2.ALL=3]="ALL",AbsoluteRefType2))(AbsoluteRefType||{});function selectionToArray(range){return[range.startRow,range.startColumn,range.endRow,range.endColumn]}__name(selectionToArray,"selectionToArray");var RANGE_DIRECTION=(RANGE_DIRECTION2=>(RANGE_DIRECTION2.NONE="none",RANGE_DIRECTION2.BACKWARD="backward",RANGE_DIRECTION2.FORWARD="forward",RANGE_DIRECTION2))(RANGE_DIRECTION||{}),DOC_RANGE_TYPE=(DOC_RANGE_TYPE2=>(DOC_RANGE_TYPE2.RECT="RECT",DOC_RANGE_TYPE2.TEXT="TEXT",DOC_RANGE_TYPE2))(DOC_RANGE_TYPE||{});function getCellInfoInMergeData(row,column,mergeData){let isMerged=!1,isMergedMainCell=!1,newEndRow=row,newEndColumn=column,mergeRow=row,mergeColumn=column;if(mergeData==null)return{actualRow:row,actualColumn:column,isMergedMainCell,isMerged,endRow:newEndRow,endColumn:newEndColumn,startRow:mergeRow,startColumn:mergeColumn};for(let i=0;i<mergeData.length;i++){const{startRow:startRowMarge,endRow:endRowMarge,startColumn:startColumnMarge,endColumn:endColumnMarge}=mergeData[i];if(row===startRowMarge&&column===startColumnMarge){newEndRow=endRowMarge,newEndColumn=endColumnMarge,mergeRow=startRowMarge,mergeColumn=startColumnMarge,isMergedMainCell=!0;break}if(row>=startRowMarge&&row<=endRowMarge&&column>=startColumnMarge&&column<=endColumnMarge){newEndRow=endRowMarge,newEndColumn=endColumnMarge,mergeRow=startRowMarge,mergeColumn=startColumnMarge,isMerged=!0;break}}return{actualRow:row,actualColumn:column,isMergedMainCell,isMerged,endRow:newEndRow,endColumn:newEndColumn,startRow:mergeRow,startColumn:mergeColumn}}__name(getCellInfoInMergeData,"getCellInfoInMergeData");var CellModeEnum=(CellModeEnum2=>(CellModeEnum2.Raw="raw",CellModeEnum2.Intercepted="intercepted",CellModeEnum2.Both="both",CellModeEnum2))(CellModeEnum||{});function convertCellToRange(cellInfo){const{actualRow,actualColumn,isMerged,isMergedMainCell,mergeInfo}=cellInfo;let{startY,endY,startX,endX}=cellInfo,startRow=actualRow,startColumn=actualColumn,endRow=actualRow,endColumn=actualColumn;if(isMerged&&mergeInfo){const{startRow:mergeStartRow,startColumn:mergeStartColumn,endRow:mergeEndRow,endColumn:mergeEndColumn,startY:mergeStartY,endY:mergeEndY,startX:mergeStartX,endX:mergeEndX}=mergeInfo;startRow=mergeStartRow,startColumn=mergeStartColumn,endRow=mergeEndRow,endColumn=mergeEndColumn,startY=mergeStartY,endY=mergeEndY,startX=mergeStartX,endX=mergeEndX}return isMergedMainCell&&(startY=mergeInfo.startY,endY=mergeInfo.endY,startX=mergeInfo.startX,endX=mergeInfo.endX,endRow=mergeInfo.endRow,endColumn=mergeInfo.endColumn),{startRow,startColumn,endRow,endColumn,startY,endY,startX,endX}}__name(convertCellToRange,"convertCellToRange");const makeCellToSelection=convertCellToRange;function makeCellRangeToRangeData(cellInfo){if(!cellInfo)return;const{actualRow,actualColumn,isMerged,isMergedMainCell,startRow:mergeStartRow,startColumn:mergeStartColumn,endRow:mergeEndRow,endColumn:mergeEndColumn}=cellInfo;let startRow=actualRow,startColumn=actualColumn,endRow=actualRow,endColumn=actualColumn;return(isMerged||isMergedMainCell)&&(startRow=mergeStartRow,startColumn=mergeStartColumn,endRow=mergeEndRow,endColumn=mergeEndColumn),{startRow,startColumn,endRow,endColumn}}__name(makeCellRangeToRangeData,"makeCellRangeToRangeData");function isEmptyCell(cell){var _a17;return!cell||(((_a17=cell==null?void 0:cell.v)==null?void 0:_a17.toString())||"").length===0&&!cell.p}__name(isEmptyCell,"isEmptyCell");function isCellCoverable(cell){return isEmptyCell(cell)&&(cell==null?void 0:cell.coverable)!==!1}__name(isCellCoverable,"isCellCoverable");function getColorStyle(color){if(color){if(color.rgb)return color.rgb;if(color.th)return new ColorBuilder().setThemeColor(color.th).asThemeColor().asRgbColor().getCssString()}return null}__name(getColorStyle,"getColorStyle");function isFormulaString(value){return Tools.isString(value)&&value.substring(0,1)==="="&&value.length>1}__name(isFormulaString,"isFormulaString");function isFormulaId(value){return Tools.isString(value)&&value.length>0}__name(isFormulaId,"isFormulaId");function handleStyleToString(style,isCell=!1){var _a17;let str="";const styleMap=new Map([["ff",()=>{style.ff&&(str+=`font-family: ${style.ff}; `)}],["fs",()=>{if(style.fs){let fs=style.fs;style.va&&(fs/=2),str+=`font-size: ${fs}pt; `}}],["it",()=>{style.it&&(str+="font-style: italic; ")}],["bl",()=>{style.bl&&(str+="font-weight: bold; ")}],["ul",()=>{var _a18;(_a18=style.ul)!=null&&_a18.s&&(str.indexOf("text-decoration-line")>-1?str=str.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g,(_2,p1)=>`${p1} underline`):str+="text-decoration: underline; ",style.ul.cl&&str.indexOf("text-decoration-color")===-1&&(str+=`text-decoration-color: ${getColorStyle(style.ul.cl)}; `),style.ul.t&&str.indexOf("text-decoration-style")===-1&&(str+=`text-decoration-style: ${style.ul.t} `))}],["st",()=>{var _a18;(_a18=style.st)!=null&&_a18.s&&(str.indexOf("text-decoration-line")>-1?str=str.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g,(_2,p1)=>`${p1} line-through`):str+="text-decoration-line: line-through; ",style.st.cl&&str.indexOf("text-decoration-color")===-1&&(str+=`text-decoration-color: ${getColorStyle(style.st.cl)}; `),style.st.t&&str.indexOf("text-decoration-style")===-1&&(str+=`text-decoration-style: ${style.st.t} `))}],["ol",()=>{var _a18;(_a18=style.ol)!=null&&_a18.s&&(str.indexOf("text-decoration-line")>-1?str=str.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g,(_2,p1)=>`${p1} overline`):str+="text-decoration-line: overline; ",style.ol.cl&&str.indexOf("text-decoration-color")===-1&&(str+=`text-decoration-color: ${getColorStyle(style.ol.cl)}; `),style.ol.t&&str.indexOf("text-decoration-style")===-1&&(str+=`text-decoration-style: ${style.ol.t} `))}],["bg",()=>{style.bg&&(str+=`background: ${getColorStyle(style.bg)}; `)}],["bd",()=>{var _a18,_b2,_c,_d,_e,_f,_g,_h,_i,_j,_k,_l;(_a18=style.bd)!=null&&_a18.b&&(str+=`border-bottom: ${getBorderStyle((_b2=style.bd)==null?void 0:_b2.b.s)} ${(_c=getColorStyle(style.bd.b.cl))!=null?_c:""}; `),(_d=style.bd)!=null&&_d.t&&(str+=`border-top: ${getBorderStyle((_e=style.bd)==null?void 0:_e.t.s)} ${(_f=getColorStyle(style.bd.t.cl))!=null?_f:""}; `),(_g=style.bd)!=null&&_g.r&&(str+=`border-right: ${getBorderStyle((_h=style.bd)==null?void 0:_h.r.s)} ${(_i=getColorStyle(style.bd.r.cl))!=null?_i:""}; `),(_j=style.bd)!=null&&_j.l&&(str+=`border-left: ${getBorderStyle((_k=style.bd)==null?void 0:_k.l.s)} ${(_l=getColorStyle(style.bd.l.cl))!=null?_l:""}; `)}],["cl",()=>{style.cl&&(str+=`color: ${getColorStyle(style.cl)}; `)}],["va",()=>{style.va===BaselineOffset.SUBSCRIPT?str+="vertical-align: sub; ":style.va===BaselineOffset.SUPERSCRIPT&&(str+="vertical-align: super; ")}],["td",()=>{style.td===TextDirection.LEFT_TO_RIGHT?str+="direction: ltr; ":style.td===TextDirection.RIGHT_TO_LEFT&&(str+="direction: rtl; ")}],["tr",()=>{var _a18,_b2,_c;style.tr&&(str+=`--data-rotate: (${(_a18=style.tr)==null?void 0:_a18.a}deg${(_b2=style.tr)!=null&&_b2.v?` ,${(_c=style.tr)==null?void 0:_c.v}`:""});`)}],["ht",()=>{style.ht===HorizontalAlign.LEFT?str+="text-align: left; ":style.ht===HorizontalAlign.RIGHT?str+="text-align: right; ":style.ht===HorizontalAlign.CENTER?str+="text-align: center; ":style.ht===HorizontalAlign.JUSTIFIED&&(str+="text-align: justify; ")}],["vt",()=>{style.vt===VerticalAlign.BOTTOM?str+="vertical-align: bottom; ":style.vt===VerticalAlign.TOP?str+="vertical-align: top; ":style.vt===VerticalAlign.MIDDLE&&(str+="vertical-align: middle; ")}],["tb",()=>{style.tb===WrapStrategy.CLIP?str+="white-space: nowrap; overflow-x: hidden; ":style.tb===WrapStrategy.WRAP&&(str+="white-space: normal;")}],["pd",()=>{var _a18,_b2,_c,_d,_e,_f,_g,_h;const b=`${(_a18=style.pd)==null?void 0:_a18.b}pt`,t=`${(_b2=style.pd)==null?void 0:_b2.t}pt`,l=`${(_c=style.pd)==null?void 0:_c.l}pt`,r=`${(_d=style.pd)==null?void 0:_d.r}pt`;(_e=style.pd)!=null&&_e.b&&(str+=`padding-bottom: ${b}; `),(_f=style.pd)!=null&&_f.t&&(str+=`padding-top: ${t}; `),(_g=style.pd)!=null&&_g.l&&(str+=`padding-left: ${l}; `),(_h=style.pd)!=null&&_h.r&&(str+=`padding-right: ${r}; `)}]]),cellSkip=["bd","tr","tb"];for(const k in style)isCell&&cellSkip.includes(k)||(_a17=styleMap.get(k))==null||_a17();return str}__name(handleStyleToString,"handleStyleToString");function getBorderStyle(type2){let str="";return type2===BorderStyleTypes.NONE?str="none":type2===BorderStyleTypes.THIN?str="0.5pt solid":type2===BorderStyleTypes.HAIR?str="0.5pt double":type2===BorderStyleTypes.DOTTED?str="0.5pt dotted":type2===BorderStyleTypes.DASHED||type2===BorderStyleTypes.DASH_DOT?str="0.5pt dashed":type2===BorderStyleTypes.DASH_DOT_DOT?str="0.5pt dotted":type2===BorderStyleTypes.DOUBLE?str="0.5pt double":type2===BorderStyleTypes.MEDIUM?str="1pt solid":type2===BorderStyleTypes.MEDIUM_DASHED||type2===BorderStyleTypes.MEDIUM_DASH_DOT?str="1pt dashed":type2===BorderStyleTypes.MEDIUM_DASH_DOT_DOT?str="1pt dotted":type2===BorderStyleTypes.SLANT_DASH_DOT?str="0.5pt dashed":type2===BorderStyleTypes.THICK&&(str="1.5pt solid"),str}__name(getBorderStyle,"getBorderStyle");function getBorderStyleType(type2){let str=0;if(type2=type2.trim(),type2==="none")str=BorderStyleTypes.NONE;else if(type2==="0.5pt solid")str=BorderStyleTypes.THIN;else if(type2==="0.5pt double")str=BorderStyleTypes.HAIR;else if(type2==="0.5pt dotted")str=BorderStyleTypes.DOTTED;else if(type2==="0.5pt dashed")str=BorderStyleTypes.DASHED;else if(type2==="1pt solid")str=BorderStyleTypes.MEDIUM;else if(type2==="1pt dashed")str=BorderStyleTypes.MEDIUM_DASHED;else if(type2==="1pt dotted")str=BorderStyleTypes.MEDIUM_DASH_DOT_DOT;else if(type2==="1.5pt solid")str=BorderStyleTypes.THICK;else if(!type2.includes("none"))str=BorderStyleTypes.THIN;else return BorderStyleTypes.NONE;return str}__name(getBorderStyleType,"getBorderStyleType");function getDocsUpdateBody(model,segmentId){let body=model.body;if(segmentId){const{headers,footers}=model;headers!=null&&headers[segmentId]?body=headers[segmentId].body:footers!=null&&footers[segmentId]&&(body=footers[segmentId].body)}return body}__name(getDocsUpdateBody,"getDocsUpdateBody");function isValidRange(range,worksheet){const{startRow,endRow,startColumn,endColumn,rangeType}=range;if(startRow<0||startColumn<0||endRow<0||endColumn<0||!(Number.isNaN(startRow)&&Number.isNaN(endRow))&&rangeType===RANGE_TYPE.COLUMN||!(Number.isNaN(startColumn)&&Number.isNaN(endColumn))&&rangeType===RANGE_TYPE.ROW||rangeType!==RANGE_TYPE.ROW&&rangeType!==RANGE_TYPE.COLUMN&&(Number.isNaN(startColumn)||Number.isNaN(startRow)||Number.isNaN(endColumn)||Number.isNaN(endRow)))return!1;if(worksheet){const rowCount=worksheet.getRowCount(),colCount=worksheet.getColumnCount();if(endRow>=rowCount||endColumn>=colCount)return!1}return!0}__name(isValidRange,"isValidRange");function cellToRange(row,col){return{startRow:row,endRow:row,startColumn:col,endColumn:col}}__name(cellToRange,"cellToRange");function deepCompare(arg1,arg2){return Object.prototype.toString.call(arg1)===Object.prototype.toString.call(arg2)?Object.prototype.toString.call(arg1)==="[object Object]"||Object.prototype.toString.call(arg1)==="[object Array]"?Object.keys(arg1).length!==Object.keys(arg2).length?!1:Object.keys(arg1).every(key=>deepCompare(arg1[key],arg2[key])):arg1===arg2:!1}__name(deepCompare,"deepCompare");function isSameStyleTextRun(tr1,tr2){const ts1=tr1.ts||{},ts2=tr2.ts||{};return tr1.sId!==tr2.sId?!1:deepCompare(ts1,ts2)}__name(isSameStyleTextRun,"isSameStyleTextRun");function checkForSubstrings(searchString,substrings){return substrings.some(substring=>searchString.indexOf(substring)>-1)}__name(checkForSubstrings,"checkForSubstrings");var dayjs_min$1={exports:{}},dayjs_min=dayjs_min$1.exports,hasRequiredDayjs_min;function requireDayjs_min(){return hasRequiredDayjs_min||(hasRequiredDayjs_min=1,function(module2,exports2){(function(t,e){module2.exports=e()})(dayjs_min,function(){var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",c="month",f="quarter",h="year",d="date",l="Invalid Date",$=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|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,M2={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:__name(function(t2){var e2=["th","st","nd","rd"],n2=t2%100;return"["+t2+(e2[(n2-20)%10]||e2[n2]||e2[0])+"]"},"ordinal")},m=__name(function(t2,e2,n2){var r2=String(t2);return!r2||r2.length>=e2?t2:""+Array(e2+1-r2.length).join(n2)+t2},"m"),v={s:m,z:__name(function(t2){var e2=-t2.utcOffset(),n2=Math.abs(e2),r2=Math.floor(n2/60),i2=n2%60;return(e2<=0?"+":"-")+m(r2,2,"0")+":"+m(i2,2,"0")},"z"),m:__name(function t2(e2,n2){if(e2.date()<n2.date())return-t2(n2,e2);var r2=12*(n2.year()-e2.year())+(n2.month()-e2.month()),i2=e2.clone().add(r2,c),s2=n2-i2<0,u2=e2.clone().add(r2+(s2?-1:1),c);return+(-(r2+(n2-i2)/(s2?i2-u2:u2-i2))||0)},"t"),a:__name(function(t2){return t2<0?Math.ceil(t2)||0:Math.floor(t2)},"a"),p:__name(function(t2){return{M:c,y:h,w:o,d:a,D:d,h:u,m:s,s:i,ms:r,Q:f}[t2]||String(t2||"").toLowerCase().replace(/s$/,"")},"p"),u:__name(function(t2){return t2===void 0},"u")},g="en",D={};D[g]=M2;var p="$isDayjsObject",S2=__name(function(t2){return t2 instanceof _2||!(!t2||!t2[p])},"S"),w=__name(function t2(e2,n2,r2){var i2;if(!e2)return g;if(typeof e2=="string"){var s2=e2.toLowerCase();D[s2]&&(i2=s2),n2&&(D[s2]=n2,i2=s2);var u2=e2.split("-");if(!i2&&u2.length>1)return t2(u2[0])}else{var a2=e2.name;D[a2]=e2,i2=a2}return!r2&&i2&&(g=i2),i2||!r2&&g},"t"),O=__name(function(t2,e2){if(S2(t2))return t2.clone();var n2=typeof e2=="object"?e2:{};return n2.date=t2,n2.args=arguments,new _2(n2)},"O"),b=v;b.l=w,b.i=S2,b.w=function(t2,e2){return O(t2,{locale:e2.$L,utc:e2.$u,x:e2.$x,$offset:e2.$offset})};var _2=function(){function M3(t2){this.$L=w(t2.locale,null,!0),this.parse(t2),this.$x=this.$x||t2.x||{},this[p]=!0}__name(M3,"M");var m2=M3.prototype;return m2.parse=function(t2){this.$d=function(t3){var e2=t3.date,n2=t3.utc;if(e2===null)return new Date(NaN);if(b.u(e2))return new Date;if(e2 instanceof Date)return new Date(e2);if(typeof e2=="string"&&!/Z$/i.test(e2)){var r2=e2.match($);if(r2){var i2=r2[2]-1||0,s2=(r2[7]||"0").substring(0,3);return n2?new Date(Date.UTC(r2[1],i2,r2[3]||1,r2[4]||0,r2[5]||0,r2[6]||0,s2)):new Date(r2[1],i2,r2[3]||1,r2[4]||0,r2[5]||0,r2[6]||0,s2)}}return new Date(e2)}(t2),this.init()},m2.init=function(){var t2=this.$d;this.$y=t2.getFullYear(),this.$M=t2.getMonth(),this.$D=t2.getDate(),this.$W=t2.getDay(),this.$H=t2.getHours(),this.$m=t2.getMinutes(),this.$s=t2.getSeconds(),this.$ms=t2.getMilliseconds()},m2.$utils=function(){return b},m2.isValid=function(){return this.$d.toString()!==l},m2.isSame=function(t2,e2){var n2=O(t2);return this.startOf(e2)<=n2&&n2<=this.endOf(e2)},m2.isAfter=function(t2,e2){return O(t2)<this.startOf(e2)},m2.isBefore=function(t2,e2){return this.endOf(e2)<O(t2)},m2.$g=function(t2,e2,n2){return b.u(t2)?this[e2]:this.set(n2,t2)},m2.unix=function(){return Math.floor(this.valueOf()/1e3)},m2.valueOf=function(){return this.$d.getTime()},m2.startOf=function(t2,e2){var n2=this,r2=!!b.u(e2)||e2,f2=b.p(t2),l2=__name(function(t3,e3){var i2=b.w(n2.$u?Date.UTC(n2.$y,e3,t3):new Date(n2.$y,e3,t3),n2);return r2?i2:i2.endOf(a)},"l"),$2=__name(function(t3,e3){return b.w(n2.toDate()[t3].apply(n2.toDate("s"),(r2?[0,0,0,0]:[23,59,59,999]).slice(e3)),n2)},"$"),y2=this.$W,M4=this.$M,m3=this.$D,v2="set"+(this.$u?"UTC":"");switch(f2){case h:return r2?l2(1,0):l2(31,11);case c:return r2?l2(1,M4):l2(0,M4+1);case o:var g2=this.$locale().weekStart||0,D2=(y2<g2?y2+7:y2)-g2;return l2(r2?m3-D2:m3+(6-D2),M4);case a:case d:return $2(v2+"Hours",0);case u:return $2(v2+"Minutes",1);case s:return $2(v2+"Seconds",2);case i:return $2(v2+"Milliseconds",3);default:return this.clone()}},m2.endOf=function(t2){return this.startOf(t2,!1)},m2.$set=function(t2,e2){var n2,o2=b.p(t2),f2="set"+(this.$u?"UTC":""),l2=(n2={},n2[a]=f2+"Date",n2[d]=f2+"Date",n2[c]=f2+"Month",n2[h]=f2+"FullYear",n2[u]=f2+"Hours",n2[s]=f2+"Minutes",n2[i]=f2+"Seconds",n2[r]=f2+"Milliseconds",n2)[o2],$2=o2===a?this.$D+(e2-this.$W):e2;if(o2===c||o2===h){var y2=this.clone().set(d,1);y2.$d[l2]($2),y2.init(),this.$d=y2.set(d,Math.min(this.$D,y2.daysInMonth())).$d}else l2&&this.$d[l2]($2);return this.init(),this},m2.set=function(t2,e2){return this.clone().$set(t2,e2)},m2.get=function(t2){return this[b.p(t2)]()},m2.add=function(r2,f2){var d2,l2=this;r2=Number(r2);var $2=b.p(f2),y2=__name(function(t2){var e2=O(l2);return b.w(e2.date(e2.date()+Math.round(t2*r2)),l2)},"y");if($2===c)return this.set(c,this.$M+r2);if($2===h)return this.set(h,this.$y+r2);if($2===a)return y2(1);if($2===o)return y2(7);var M4=(d2={},d2[s]=e,d2[u]=n,d2[i]=t,d2)[$2]||1,m3=this.$d.getTime()+r2*M4;return b.w(m3,this)},m2.subtract=function(t2,e2){return this.add(-1*t2,e2)},m2.format=function(t2){var e2=this,n2=this.$locale();if(!this.isValid())return n2.invalidDate||l;var r2=t2||"YYYY-MM-DDTHH:mm:ssZ",i2=b.z(this),s2=this.$H,u2=this.$m,a2=this.$M,o2=n2.weekdays,c2=n2.months,f2=n2.meridiem,h2=__name(function(t3,n3,i3,s3){return t3&&(t3[n3]||t3(e2,r2))||i3[n3].slice(0,s3)},"h"),d2=__name(function(t3){return b.s(s2%12||12,t3,"0")},"d"),$2=f2||function(t3,e3,n3){var r3=t3<12?"AM":"PM";return n3?r3.toLowerCase():r3};return r2.replace(y,function(t3,r3){return r3||function(t4){switch(t4){case"YY":return String(e2.$y).slice(-2);case"YYYY":return b.s(e2.$y,4,"0");case"M":return a2+1;case"MM":return b.s(a2+1,2,"0");case"MMM":return h2(n2.monthsShort,a2,c2,3);case"MMMM":return h2(c2,a2);case"D":return e2.$D;case"DD":return b.s(e2.$D,2,"0");case"d":return String(e2.$W);case"dd":return h2(n2.weekdaysMin,e2.$W,o2,2);case"ddd":return h2(n2.weekdaysShort,e2.$W,o2,3);case"dddd":return o2[e2.$W];case"H":return String(s2);case"HH":return b.s(s2,2,"0");case"h":return d2(1);case"hh":return d2(2);case"a":return $2(s2,u2,!0);case"A":return $2(s2,u2,!1);case"m":return String(u2);case"mm":return b.s(u2,2,"0");case"s":return String(e2.$s);case"ss":return b.s(e2.$s,2,"0");case"SSS":return b.s(e2.$ms,3,"0");case"Z":return i2}return null}(t3)||i2.replace(":","")})},m2.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},m2.diff=function(r2,d2,l2){var $2,y2=this,M4=b.p(d2),m3=O(r2),v2=(m3.utcOffset()-this.utcOffset())*e,g2=this-m3,D2=__name(function(){return b.m(y2,m3)},"D");switch(M4){case h:$2=D2()/12;break;case c:$2=D2();break;case f:$2=D2()/3;break;case o:$2=(g2-v2)/6048e5;break;case a:$2=(g2-v2)/864e5;break;case u:$2=g2/n;break;case s:$2=g2/e;break;case i:$2=g2/t;break;default:$2=g2}return l2?$2:b.a($2)},m2.daysInMonth=function(){return this.endOf(c).$D},m2.$locale=function(){return D[this.$L]},m2.locale=function(t2,e2){if(!t2)return this.$L;var n2=this.clone(),r2=w(t2,e2,!0);return r2&&(n2.$L=r2),n2},m2.clone=function(){return b.w(this.$d,this)},m2.toDate=function(){return new Date(this.valueOf())},m2.toJSON=function(){return this.isValid()?this.toISOString():null},m2.toISOString=function(){return this.$d.toISOString()},m2.toString=function(){return this.$d.toUTCString()},M3}(),k=_2.prototype;return O.prototype=k,[["$ms",r],["$s",i],["$m",s],["$H",u],["$W",a],["$M",c],["$y",h],["$D",d]].forEach(function(t2){k[t2[1]]=function(e2){return this.$g(e2,t2[0],t2[1])}}),O.extend=function(t2,e2){return t2.$i||(t2(e2,_2,O),t2.$i=!0),O},O.locale=w,O.isDayjs=S2,O.unix=function(t2){return O(1e3*t2)},O.en=D[g],O.Ls=D,O.p={},O})}(dayjs_min$1)),dayjs_min$1.exports}__name(requireDayjs_min,"requireDayjs_min");var dayjs_minExports=requireDayjs_min();const dayjs=getDefaultExportFromCjs(dayjs_minExports);var advancedFormat$2={exports:{}},advancedFormat$1=advancedFormat$2.exports,hasRequiredAdvancedFormat;function requireAdvancedFormat(){return hasRequiredAdvancedFormat||(hasRequiredAdvancedFormat=1,function(module2,exports2){(function(e,t){module2.exports=t()})(advancedFormat$1,function(){return function(e,t){var r=t.prototype,n=r.format;r.format=function(e2){var t2=this,r2=this.$locale();if(!this.isValid())return n.bind(this)(e2);var s=this.$utils(),a=(e2||"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(e3){switch(e3){case"Q":return Math.ceil((t2.$M+1)/3);case"Do":return r2.ordinal(t2.$D);case"gggg":return t2.weekYear();case"GGGG":return t2.isoWeekYear();case"wo":return r2.ordinal(t2.week(),"W");case"w":case"ww":return s.s(t2.week(),e3==="w"?1:2,"0");case"W":case"WW":return s.s(t2.isoWeek(),e3==="W"?1:2,"0");case"k":case"kk":return s.s(String(t2.$H===0?24:t2.$H),e3==="k"?1:2,"0");case"X":return Math.floor(t2.$d.getTime()/1e3);case"x":return t2.$d.getTime();case"z":return"["+t2.offsetName()+"]";case"zzz":return"["+t2.offsetName("long")+"]";default:return e3}});return n.bind(this)(a)}}})}(advancedFormat$2)),advancedFormat$2.exports}__name(requireAdvancedFormat,"requireAdvancedFormat");var advancedFormatExports=requireAdvancedFormat();const advancedFormat=getDefaultExportFromCjs(advancedFormatExports);var customParseFormat$2={exports:{}},customParseFormat$1=customParseFormat$2.exports,hasRequiredCustomParseFormat;function requireCustomParseFormat(){return hasRequiredCustomParseFormat||(hasRequiredCustomParseFormat=1,function(module2,exports2){(function(e,t){module2.exports=t()})(customParseFormat$1,function(){var e={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"},t=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,n=/\d/,r=/\d\d/,i=/\d\d?/,o=/\d*[^-_:/,()\s\d]+/,s={},a=__name(function(e2){return(e2=+e2)+(e2>68?1900:2e3)},"a"),f=__name(function(e2){return function(t2){this[e2]=+t2}},"f"),h=[/[+-]\d\d:?(\d\d)?|Z/,function(e2){(this.zone||(this.zone={})).offset=function(e3){if(!e3||e3==="Z")return 0;var t2=e3.match(/([+-]|\d\d)/g),n2=60*t2[1]+(+t2[2]||0);return n2===0?0:t2[0]==="+"?-n2:n2}(e2)}],u=__name(function(e2){var t2=s[e2];return t2&&(t2.indexOf?t2:t2.s.concat(t2.f))},"u"),d=__name(function(e2,t2){var n2,r2=s.meridiem;if(r2){for(var i2=1;i2<=24;i2+=1)if(e2.indexOf(r2(i2,0,t2))>-1){n2=i2>12;break}}else n2=e2===(t2?"pm":"PM");return n2},"d"),c={A:[o,function(e2){this.afternoon=d(e2,!1)}],a:[o,function(e2){this.afternoon=d(e2,!0)}],Q:[n,function(e2){this.month=3*(e2-1)+1}],S:[n,function(e2){this.milliseconds=100*+e2}],SS:[r,function(e2){this.milliseconds=10*+e2}],SSS:[/\d{3}/,function(e2){this.milliseconds=+e2}],s:[i,f("seconds")],ss:[i,f("seconds")],m:[i,f("minutes")],mm:[i,f("minutes")],H:[i,f("hours")],h:[i,f("hours")],HH:[i,f("hours")],hh:[i,f("hours")],D:[i,f("day")],DD:[r,f("day")],Do:[o,function(e2){var t2=s.ordinal,n2=e2.match(/\d+/);if(this.day=n2[0],t2)for(var r2=1;r2<=31;r2+=1)t2(r2).replace(/\[|\]/g,"")===e2&&(this.day=r2)}],w:[i,f("week")],ww:[r,f("week")],M:[i,f("month")],MM:[r,f("month")],MMM:[o,function(e2){var t2=u("months"),n2=(u("monthsShort")||t2.map(function(e3){return e3.slice(0,3)})).indexOf(e2)+1;if(n2<1)throw new Error;this.month=n2%12||n2}],MMMM:[o,function(e2){var t2=u("months").indexOf(e2)+1;if(t2<1)throw new Error;this.month=t2%12||t2}],Y:[/[+-]?\d+/,f("year")],YY:[r,function(e2){this.year=a(e2)}],YYYY:[/\d{4}/,f("year")],Z:h,ZZ:h};function l(n2){var r2,i2;r2=n2,i2=s&&s.formats;for(var o2=(n2=r2.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(t2,n3,r3){var o3=r3&&r3.toUpperCase();return n3||i2[r3]||e[r3]||i2[o3].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(e2,t3,n4){return t3||n4.slice(1)})})).match(t),a2=o2.length,f2=0;f2<a2;f2+=1){var h2=o2[f2],u2=c[h2],d2=u2&&u2[0],l2=u2&&u2[1];o2[f2]=l2?{regex:d2,parser:l2}:h2.replace(/^\[|\]$/g,"")}return function(e2){for(var t2={},n3=0,r3=0;n3<a2;n3+=1){var i3=o2[n3];if(typeof i3=="string")r3+=i3.length;else{var s2=i3.regex,f3=i3.parser,h3=e2.slice(r3),u3=s2.exec(h3)[0];f3.call(t2,u3),e2=e2.replace(u3,"")}}return function(e3){var t3=e3.afternoon;if(t3!==void 0){var n4=e3.hours;t3?n4<12&&(e3.hours+=12):n4===12&&(e3.hours=0),delete e3.afternoon}}(t2),t2}}return __name(l,"l"),function(e2,t2,n2){n2.p.customParseFormat=!0,e2&&e2.parseTwoDigitYear&&(a=e2.parseTwoDigitYear);var r2=t2.prototype,i2=r2.parse;r2.parse=function(e3){var t3=e3.date,r3=e3.utc,o2=e3.args;this.$u=r3;var a2=o2[1];if(typeof a2=="string"){var f2=o2[2]===!0,h2=o2[3]===!0,u2=f2||h2,d2=o2[2];h2&&(d2=o2[2]),s=this.$locale(),!f2&&d2&&(s=n2.Ls[d2]),this.$d=function(e4,t4,n3,r4){try{if(["x","X"].indexOf(t4)>-1)return new Date((t4==="X"?1e3:1)*e4);var i3=l(t4)(e4),o3=i3.year,s2=i3.month,a3=i3.day,f3=i3.hours,h3=i3.minutes,u3=i3.seconds,d3=i3.milliseconds,c3=i3.zone,m2=i3.week,M3=new Date,Y=a3||(o3||s2?1:M3.getDate()),p=o3||M3.getFullYear(),v=0;o3&&!s2||(v=s2>0?s2-1:M3.getMonth());var D,w=f3||0,g=h3||0,y=u3||0,L=d3||0;return c3?new Date(Date.UTC(p,v,Y,w,g,y,L+60*c3.offset*1e3)):n3?new Date(Date.UTC(p,v,Y,w,g,y,L)):(D=new Date(p,v,Y,w,g,y,L),m2&&(D=r4(D).week(m2).toDate()),D)}catch{return new Date("")}}(t3,a2,r3,n2),this.init(),d2&&d2!==!0&&(this.$L=this.locale(d2).$L),u2&&t3!=this.format(a2)&&(this.$d=new Date("")),s={}}else if(a2 instanceof Array)for(var c2=a2.length,m=1;m<=c2;m+=1){o2[1]=a2[m-1];var M2=n2.apply(this,o2);if(M2.isValid()){this.$d=M2.$d,this.$L=M2.$L,this.init();break}m===c2&&(this.$d=new Date(""))}else i2.call(this,e3)}}})}(customParseFormat$2)),customParseFormat$2.exports}__name(requireCustomParseFormat,"requireCustomParseFormat");var customParseFormatExports=requireCustomParseFormat();const customParseFormat=getDefaultExportFromCjs(customParseFormatExports);var localeData$2={exports:{}},localeData$1=localeData$2.exports,hasRequiredLocaleData;function requireLocaleData(){return hasRequiredLocaleData||(hasRequiredLocaleData=1,function(module2,exports2){(function(n,e){module2.exports=e()})(localeData$1,function(){return function(n,e,t){var r=e.prototype,o=__name(function(n2){return n2&&(n2.indexOf?n2:n2.s)},"o"),u=__name(function(n2,e2,t2,r2,u2){var i2=n2.name?n2:n2.$locale(),a2=o(i2[e2]),s2=o(i2[t2]),f=a2||s2.map(function(n3){return n3.slice(0,r2)});if(!u2)return f;var d=i2.weekStart;return f.map(function(n3,e3){return f[(e3+(d||0))%7]})},"u"),i=__name(function(){return t.Ls[t.locale()]},"i"),a=__name(function(n2,e2){return n2.formats[e2]||function(n3){return n3.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(n4,e3,t2){return e3||t2.slice(1)})}(n2.formats[e2.toUpperCase()])},"a"),s=__name(function(){var n2=this;return{months:__name(function(e2){return e2?e2.format("MMMM"):u(n2,"months")},"months"),monthsShort:__name(function(e2){return e2?e2.format("MMM"):u(n2,"monthsShort","months",3)},"monthsShort"),firstDayOfWeek:__name(function(){return n2.$locale().weekStart||0},"firstDayOfWeek"),weekdays:__name(function(e2){return e2?e2.format("dddd"):u(n2,"weekdays")},"weekdays"),weekdaysMin:__name(function(e2){return e2?e2.format("dd"):u(n2,"weekdaysMin","weekdays",2)},"weekdaysMin"),weekdaysShort:__name(function(e2){return e2?e2.format("ddd"):u(n2,"weekdaysShort","weekdays",3)},"weekdaysShort"),longDateFormat:__name(function(e2){return a(n2.$locale(),e2)},"longDateFormat"),meridiem:this.$locale().meridiem,ordinal:this.$locale().ordinal}},"s");r.localeData=function(){return s.bind(this)()},t.localeData=function(){var n2=i();return{firstDayOfWeek:__name(function(){return n2.weekStart||0},"firstDayOfWeek"),weekdays:__name(function(){return t.weekdays()},"weekdays"),weekdaysShort:__name(function(){return t.weekdaysShort()},"weekdaysShort"),weekdaysMin:__name(function(){return t.weekdaysMin()},"weekdaysMin"),months:__name(function(){return t.months()},"months"),monthsShort:__name(function(){return t.monthsShort()},"monthsShort"),longDateFormat:__name(function(e2){return a(n2,e2)},"longDateFormat"),meridiem:n2.meridiem,ordinal:n2.ordinal}},t.months=function(){return u(i(),"months")},t.monthsShort=function(){return u(i(),"monthsShort","months",3)},t.weekdays=function(n2){return u(i(),"weekdays",null,null,n2)},t.weekdaysShort=function(n2){return u(i(),"weekdaysShort","weekdays",3,n2)},t.weekdaysMin=function(n2){return u(i(),"weekdaysMin","weekdays",2,n2)}}})}(localeData$2)),localeData$2.exports}__name(requireLocaleData,"requireLocaleData");var localeDataExports=requireLocaleData();const localeData=getDefaultExportFromCjs(localeDataExports);var localizedFormat$2={exports:{}},localizedFormat$1=localizedFormat$2.exports,hasRequiredLocalizedFormat;function requireLocalizedFormat(){return hasRequiredLocalizedFormat||(hasRequiredLocalizedFormat=1,function(module2,exports2){(function(e,t){module2.exports=t()})(localizedFormat$1,function(){var e={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(t,o,n){var r=o.prototype,i=r.format;n.en.formats=e,r.format=function(t2){t2===void 0&&(t2="YYYY-MM-DDTHH:mm:ssZ");var o2=this.$locale().formats,n2=function(t3,o3){return t3.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(t4,n3,r2){var i2=r2&&r2.toUpperCase();return n3||o3[r2]||e[r2]||o3[i2].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(e2,t5,o4){return t5||o4.slice(1)})})}(t2,o2===void 0?{}:o2);return i.call(this,n2)}}})}(localizedFormat$2)),localizedFormat$2.exports}__name(requireLocalizedFormat,"requireLocalizedFormat");var localizedFormatExports=requireLocalizedFormat();const localizedFormat=getDefaultExportFromCjs(localizedFormatExports);var utc$2={exports:{}},utc$1=utc$2.exports,hasRequiredUtc;function requireUtc(){return hasRequiredUtc||(hasRequiredUtc=1,function(module2,exports2){(function(t,i){module2.exports=i()})(utc$1,function(){var t="minute",i=/[+-]\d\d(?::?\d\d)?/g,e=/([+-]|\d\d)/g;return function(s,f,n){var u=f.prototype;n.utc=function(t2){var i2={date:t2,utc:!0,args:arguments};return new f(i2)},u.utc=function(i2){var e2=n(this.toDate(),{locale:this.$L,utc:!0});return i2?e2.add(this.utcOffset(),t):e2},u.local=function(){return n(this.toDate(),{locale:this.$L,utc:!1})};var o=u.parse;u.parse=function(t2){t2.utc&&(this.$u=!0),this.$utils().u(t2.$offset)||(this.$offset=t2.$offset),o.call(this,t2)};var r=u.init;u.init=function(){if(this.$u){var t2=this.$d;this.$y=t2.getUTCFullYear(),this.$M=t2.getUTCMonth(),this.$D=t2.getUTCDate(),this.$W=t2.getUTCDay(),this.$H=t2.getUTCHours(),this.$m=t2.getUTCMinutes(),this.$s=t2.getUTCSeconds(),this.$ms=t2.getUTCMilliseconds()}else r.call(this)};var a=u.utcOffset;u.utcOffset=function(s2,f2){var n2=this.$utils().u;if(n2(s2))return this.$u?0:n2(this.$offset)?a.call(this):this.$offset;if(typeof s2=="string"&&(s2=function(t2){t2===void 0&&(t2="");var s3=t2.match(i);if(!s3)return null;var f3=(""+s3[0]).match(e)||["-",0,0],n3=f3[0],u3=60*+f3[1]+ +f3[2];return u3===0?0:n3==="+"?u3:-u3}(s2),s2===null))return this;var u2=Math.abs(s2)<=16?60*s2:s2,o2=this;if(f2)return o2.$offset=u2,o2.$u=s2===0,o2;if(s2!==0){var r2=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();(o2=this.local().add(u2+r2,t)).$offset=u2,o2.$x.$localOffset=r2}else o2=this.utc();return o2};var h=u.format;u.format=function(t2){var i2=t2||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return h.call(this,i2)},u.valueOf=function(){var t2=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*t2},u.isUTC=function(){return!!this.$u},u.toISOString=function(){return this.toDate().toISOString()},u.toString=function(){return this.toDate().toUTCString()};var l=u.toDate;u.toDate=function(t2){return t2==="s"&&this.$offset?n(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():l.call(this)};var c=u.diff;u.diff=function(t2,i2,e2){if(t2&&this.$u===t2.$u)return c.call(this,t2,i2,e2);var s2=this.local(),f2=n(t2).local();return c.call(s2,f2,i2,e2)}}})}(utc$2)),utc$2.exports}__name(requireUtc,"requireUtc");var utcExports=requireUtc();const utc=getDefaultExportFromCjs(utcExports);var weekday$2={exports:{}},weekday$1=weekday$2.exports,hasRequiredWeekday;function requireWeekday(){return hasRequiredWeekday||(hasRequiredWeekday=1,function(module2,exports2){(function(e,t){module2.exports=t()})(weekday$1,function(){return function(e,t){t.prototype.weekday=function(e2){var t2=this.$locale().weekStart||0,i=this.$W,n=(i<t2?i+7:i)-t2;return this.$utils().u(e2)?n:this.subtract(n,"day").add(e2,"day")}}})}(weekday$2)),weekday$2.exports}__name(requireWeekday,"requireWeekday");var weekdayExports=requireWeekday();const weekday=getDefaultExportFromCjs(weekdayExports);var weekOfYear$2={exports:{}},weekOfYear$1=weekOfYear$2.exports,hasRequiredWeekOfYear;function requireWeekOfYear(){return hasRequiredWeekOfYear||(hasRequiredWeekOfYear=1,function(module2,exports2){(function(e,t){module2.exports=t()})(weekOfYear$1,function(){var e="week",t="year";return function(i,n,r){var f=n.prototype;f.week=function(i2){if(i2===void 0&&(i2=null),i2!==null)return this.add(7*(i2-this.week()),"day");var n2=this.$locale().yearStart||1;if(this.month()===11&&this.date()>25){var f2=r(this).startOf(t).add(1,t).date(n2),s=r(this).endOf(e);if(f2.isBefore(s))return 1}var a=r(this).startOf(t).date(n2).startOf(e).subtract(1,"millisecond"),o=this.diff(a,e,!0);return o<0?r(this).startOf("week").week():Math.ceil(o)},f.weeks=function(e2){return e2===void 0&&(e2=null),this.week(e2)}}})}(weekOfYear$2)),weekOfYear$2.exports}__name(requireWeekOfYear,"requireWeekOfYear");var weekOfYearExports=requireWeekOfYear();const weekOfYear=getDefaultExportFromCjs(weekOfYearExports);var weekYear$2={exports:{}},weekYear$1=weekYear$2.exports,hasRequiredWeekYear;function requireWeekYear(){return hasRequiredWeekYear||(hasRequiredWeekYear=1,function(module2,exports2){(function(e,t){module2.exports=t()})(weekYear$1,function(){return function(e,t){t.prototype.weekYear=function(){var e2=this.month(),t2=this.week(),n=this.year();return t2===1&&e2===11?n+1:e2===0&&t2>=52?n-1:n}}})}(weekYear$2)),weekYear$2.exports}__name(requireWeekYear,"requireWeekYear");var weekYearExports=requireWeekYear();const weekYear=getDefaultExportFromCjs(weekYearExports);dayjs.extend(customParseFormat);dayjs.extend(advancedFormat);dayjs.extend(weekday);dayjs.extend(localeData);dayjs.extend(weekOfYear);dayjs.extend(weekYear);dayjs.extend(utc);dayjs.extend(localizedFormat);function horizontalLineSegmentsSubtraction(aStart,aEnd,bStart,bEnd){if(aStart>aEnd)throw new Error("a1 should be less than a2");if(bStart>bEnd)throw new Error("b1 should be less than b2");if(aEnd<bStart||bEnd<aStart)return[aStart,aEnd];if(bStart<=aStart&&bEnd>=aEnd)return[];const subLength=bEnd-bStart+1;return aStart<bStart&&aEnd>bEnd?[aStart,aEnd-subLength]:bStart<=aStart&&bEnd<aEnd?[bEnd+1-subLength,aEnd-subLength]:bStart>aStart&&bEnd>=aEnd?[aStart,bStart-1]:[aStart,aEnd]}__name(horizontalLineSegmentsSubtraction,"horizontalLineSegmentsSubtraction");function checkParagraphHasBullet(paragraph){if(paragraph==null)return!1;const bullet=paragraph.bullet;return(bullet==null?void 0:bullet.listId)!=null}__name(checkParagraphHasBullet,"checkParagraphHasBullet");function checkParagraphHasIndent(paragraph){if(paragraph==null)return!1;const paragraphStyle=paragraph.paragraphStyle;return checkParagraphHasIndentByStyle(paragraphStyle)}__name(checkParagraphHasIndent,"checkParagraphHasIndent");function checkParagraphHasIndentByStyle(paragraphStyle){var _a17;return!(paragraphStyle==null||(paragraphStyle.indentStart==null||paragraphStyle.indentStart.v===0)&&paragraphStyle.hanging==null||((_a17=paragraphStyle.hanging)==null?void 0:_a17.v)===0)}__name(checkParagraphHasIndentByStyle,"checkParagraphHasIndentByStyle");function insertTextToContent(content,start,text){return content.slice(0,start)+text+content.slice(start)}__name(insertTextToContent,"insertTextToContent");function deleteContent(content,start,end){return start>end?content:content.slice(0,start)+content.slice(end)}__name(deleteContent,"deleteContent");const $blank=/\s/g;function isRealNum(val){return val===null||val.toString().replace($blank,"")===""||typeof val=="boolean"?!1:!isNaN(val)}__name(isRealNum,"isRealNum");function hashAlgorithm(str){let hash=0;for(let i=0;i<str.length;i++)hash=str.charCodeAt(i)+(hash<<6)+(hash<<16)-hash;return hash>>>0}__name(hashAlgorithm,"hashAlgorithm");const NEWER=Symbol("newer"),OLDER=Symbol("older"),_KeyIterator=class _KeyIterator{constructor(oldestEntry){__publicField(this,"entry");this.entry=oldestEntry}[Symbol.iterator](){return this}next(){const ent=this.entry;return ent?(this.entry=ent[NEWER],{done:!1,value:ent.key}):{done:!0,value:void 0}}};__name(_KeyIterator,"KeyIterator");let KeyIterator=_KeyIterator;const _ValueIterator=class _ValueIterator{constructor(oldestEntry){__publicField(this,"entry");this.entry=oldestEntry}[Symbol.iterator](){return this}next(){const ent=this.entry;return ent?(this.entry=ent[NEWER],{done:!1,value:ent.value}):{done:!0,value:void 0}}};__name(_ValueIterator,"ValueIterator");let ValueIterator=_ValueIterator;const _EntryIterator=class _EntryIterator{constructor(oldestEntry){__publicField(this,"entry");this.entry=oldestEntry}[Symbol.iterator](){return this}next(){const ent=this.entry;return ent?(this.entry=ent[NEWER],{done:!1,value:[ent.key,ent.value]}):{done:!0,value:void 0}}};__name(_EntryIterator,"EntryIterator");let EntryIterator=_EntryIterator;var _a2,_b;_b=NEWER,_a2=OLDER;const _Entry=class _Entry{constructor(key,value){__publicField(this,"key");__publicField(this,"value");__publicField(this,_b);__publicField(this,_a2);this.key=key,this.value=value,this[NEWER]=void 0,this[OLDER]=void 0}toJSON(){return{key:this.key,value:this.value}}};__name(_Entry,"Entry");let Entry=_Entry;const _LRUMap=class _LRUMap{constructor(...parameter){__publicField(this,"_keymap");__publicField(this,"size",0);__publicField(this,"limit");__publicField(this,"oldest");__publicField(this,"newest");__publicField(this,"_onShiftListeners",[]);if(LRUHelper.hasLength(parameter,1)){if(LRUHelper.isNumber(parameter[0])){const limit=parameter[0];this._initialize(limit,void 0);return}if(LRUHelper.isIterable(parameter[0])){const entries=parameter[0];this._initialize(0,entries);return}return}if(LRUHelper.hasLength(parameter,2)){const limit=parameter[0],entries=parameter[1];this._initialize(limit,entries)}}onShift(callback){if(this._onShiftListeners.indexOf(callback)===-1)return this._onShiftListeners.push(callback),toDisposable(()=>remove(this._onShiftListeners,callback));throw new Error("[LRUMap]: the listener has been registered!")}_initialize(limit,entries){this.oldest=void 0,this.newest=void 0,this.size=0,this.limit=limit,this._keymap=new Map,entries&&(this.assign(entries),limit<1&&(this.limit=this.size))}_markEntryAsUsed(entry){entry!==this.newest&&(entry[NEWER]&&(entry===this.oldest&&(this.oldest=entry[NEWER]),entry[NEWER][OLDER]=entry[OLDER]),entry[OLDER]&&(entry[OLDER][NEWER]=entry[NEWER]),entry[NEWER]=void 0,entry[OLDER]=this.newest,this.newest&&(this.newest[NEWER]=entry),this.newest=entry)}assign(entries){let entry,limit=this.limit||Number.MAX_VALUE;this._keymap.clear();const it=entries[Symbol.iterator]();for(let itv=it.next();!itv.done;itv=it.next()){const e=new Entry(itv.value[0],itv.value[1]);if(this._keymap.set(e.key,e),entry?(entry[NEWER]=e,e[OLDER]=entry):this.oldest=e,entry=e,limit--===0)throw new Error("overflow")}this.newest=entry,this.size=this._keymap.size}set(key,value){let entry=this._keymap.get(key);return entry?(entry.value=value,this._markEntryAsUsed(entry),this):(this._keymap.set(key,entry=new Entry(key,value)),this.newest?(this.newest[NEWER]=entry,entry[OLDER]=this.newest):this.oldest=entry,this.newest=entry,++this.size,this.size>this.limit&&this.shift(),this)}shift(){const entry=this.oldest;if(entry)return this.oldest&&this.oldest[NEWER]?(this.oldest=this.oldest[NEWER],this.oldest[OLDER]=void 0):(this.oldest=void 0,this.newest=void 0),entry[NEWER]=entry[OLDER]=void 0,this._keymap.delete(entry.key),--this.size,this._onShiftListeners.forEach(callback=>callback(entry)),[entry.key,entry.value]}get(key){const entry=this._keymap.get(key);if(entry)return this._markEntryAsUsed(entry),entry.value}has(key){return this._keymap.has(key)}find(key){const e=this._keymap.get(key);return e?e.value:void 0}delete(key){const entry=this._keymap.get(key);if(entry)return this._keymap.delete(entry.key),entry[NEWER]&&entry[OLDER]?(entry[OLDER][NEWER]=entry[NEWER],entry[NEWER][OLDER]=entry[OLDER]):entry[NEWER]?(entry[NEWER][OLDER]=void 0,this.oldest=entry[NEWER]):entry[OLDER]?(entry[OLDER][NEWER]=void 0,this.newest=entry[OLDER]):this.oldest=this.newest=void 0,this.size--,entry.value}clear(){this.oldest=void 0,this.newest=void 0,this.size=0,this._keymap.clear()}keys(){return new KeyIterator(this.oldest)}values(){return new ValueIterator(this.oldest)}entries(){return this[Symbol.iterator]()}[Symbol.iterator](){return new EntryIterator(this.oldest)}forEach(fun,thisObj){typeof thisObj!="object"&&(thisObj=this);let entry=this.oldest;for(;entry;)fun.call(thisObj,entry.value,entry.key,this),entry=entry[NEWER]}toJSON(){const s=new Array(this.size);let i=0,entry=this.oldest;for(;entry;)s[i++]={key:entry.key,value:entry.value},entry=entry[NEWER];return s}toString(){let s="",entry=this.oldest;for(;entry;)s+=`${String(entry.key)}:${entry.value}`,entry=entry[NEWER],entry&&(s+=" < ");return s}};__name(_LRUMap,"LRUMap");let LRUMap=_LRUMap;const _LRUHelper=class _LRUHelper{static hasLength(array,size){return array.length===size}static getValueType(value){return Object.prototype.toString.apply(value)}static isObject(value){return this.getValueType(value)==="[object Object]"}static isIterable(value){return value[Symbol.iterator]!=null}static isNumber(value){return this.getValueType(value)==="[object Number]"}};__name(_LRUHelper,"LRUHelper");let LRUHelper=_LRUHelper;var numfmt$3={exports:{}},numfmt$2=numfmt$3.exports,hasRequiredNumfmt$1;function requireNumfmt$1(){return hasRequiredNumfmt$1||(hasRequiredNumfmt$1=1,function(module2,exports2){(function(e,t){module2.exports=t()})(typeof self<"u"?self:numfmt$2,function(){return function(){var e={d:__name(function(t2,n2){for(var a2 in n2)e.o(n2,a2)&&!e.o(t2,a2)&&Object.defineProperty(t2,a2,{enumerable:!0,get:n2[a2]})},"d"),o:__name(function(e2,t2){return Object.prototype.hasOwnProperty.call(e2,t2)},"o")},t={};e.d(t,{default:__name(function(){return pe},"default")});var n={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"};const a=/^([a-z\d]+)(?:[_-]([a-z\d]+))?(?:\.([a-z\d]+))?(?:@([a-z\d]+))?$/i,r={},i={group:" ",decimal:".",positive:"+",negative:"-",percent:"%",exponent:"E",nan:"NaN",infinity:"∞",ampm:["AM","PM"],mmmm6:["Muharram","Safar","Rabiʻ I","Rabiʻ II","Jumada I","Jumada II","Rajab","Shaʻban","Ramadan","Shawwal","Dhuʻl-Qiʻdah","Dhuʻl-Hijjah"],mmm6:["Muh.","Saf.","Rab. I","Rab. II","Jum. I","Jum. II","Raj.","Sha.","Ram.","Shaw.","Dhuʻl-Q.","Dhuʻl-H."],mmmm:["January","February","March","April","May","June","July","August","September","October","November","December"],mmm:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dddd:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],ddd:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]};function s(e2){const t2=a.exec(e2);if(!t2)throw new SyntaxError("Malformed locale: ".concat(e2));return{lang:t2[1]+(t2[2]?"_"+t2[2]:""),language:t2[1],territory:t2[2]||"",codeset:t2[3]||"",modifier:t2[4]||""}}__name(s,"s");function o(e2){if(typeof e2=="number")return n[65535&e2]||null;const t2=parseInt(e2,16);return isFinite(t2)&&n[65535&t2]?n[65535&t2]||null:a.test(e2)?e2:null}__name(o,"o");function l(e2){const t2=o(e2);let n2=null;if(t2){const e3=s(t2);n2=r[e3.lang]||r[e3.language]||null}return n2}__name(l,"l");function d(e2){return Object.assign({},i,e2)}__name(d,"d");function m(e2,t2){const n2=typeof t2=="object"?t2:s(t2);return r[n2.lang]=d(e2),n2.language===n2.lang||r[n2.language]||(r[n2.language]=d(e2)),r[n2.lang]}__name(m,"m");const u=d({group:","});function c(e2,t2){if(typeof e2!="number")return e2;if(e2<0)return-c(-e2,t2);if(t2){const n2=10**(t2||0)||1;return c(e2*n2,0)/n2}return Math.round(e2)}__name(c,"c"),u.isDefault=!0,m({group:",",ampm:["上午","下午"],mmmm:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],mmm:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],dddd:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],ddd:["周日","周一","周二","周三","周四","周五","周六"]},"zh_CN"),m({group:",",nan:"非數值",ampm:["上午","下午"],mmmm:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],mmm:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],dddd:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],ddd:["週日","週一","週二","週三","週四","週五","週六"]},"zh_TW"),m({group:",",ampm:["午前","午後"],mmmm:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],mmm:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],dddd:["日曜日","月曜日","火曜日","水曜日","木曜日","金曜日","土曜日"],ddd:["日","月","火","水","木","金","土"]},"ja"),m({group:",",ampm:["오전","오후"],mmmm:["1월","2월","3월","4월","5월","6월","7월","8월","9월","10월","11월","12월"],mmm:["1월","2월","3월","4월","5월","6월","7월","8월","9월","10월","11월","12월"],dddd:["일요일","월요일","화요일","수요일","목요일","금요일","토요일"],ddd:["일","월","화","수","목","금","토"]},"ko"),m({group:",",ampm:["ก่อนเที่ยง","หลังเที่ยง"],mmmm:["มกราคม","กุมภาพันธ์","มีนาคม","เมษายน","พฤษภาคม","มิถุนายน","กรกฎาคม","สิงหาคม","กันยายน","ตุลาคม","พฤศจิกายน","ธันวาคม"],mmm:["ม.ค.","ก.พ.","มี.ค.","เม.ย.","พ.ค.","มิ.ย.","ก.ค.","ส.ค.","ก.ย.","ต.ค.","พ.ย.","ธ.ค."],dddd:["วันอาทิตย์","วันจันทร์","วันอังคาร","วันพุธ","วันพฤหัสบดี","วันศุกร์","วันเสาร์"],ddd:["อา.","จ.","อ.","พ.","พฤ.","ศ.","ส."]},"th"),m({decimal:",",ampm:["dop.","odp."],mmmm:["ledna","února","března","dubna","května","června","července","srpna","září","října","listopadu","prosince"],mmm:["led","úno","bře","dub","kvě","čvn","čvc","srp","zář","říj","lis","pro"],dddd:["neděle","pondělí","úterý","středa","čtvrtek","pátek","sobota"],ddd:["ne","po","út","st","čt","pá","so"]},"cs"),m({group:".",decimal:",",mmmm:["januar","februar","marts","april","maj","juni","juli","august","september","oktober","november","december"],mmm:["jan.","feb.","mar.","apr.","maj","jun.","jul.","aug.","sep.","okt.","nov.","dec."],dddd:["søndag","mandag","tirsdag","onsdag","torsdag","fredag","lørdag"],ddd:["søn.","man.","tir.","ons.","tor.","fre.","lør."]},"da"),m({group:".",decimal:",",ampm:["a.m.","p.m."],mmmm:["januari","februari","maart","april","mei","juni","juli","augustus","september","oktober","november","december"],mmm:["jan.","feb.","mrt.","apr.","mei","jun.","jul.","aug.","sep.","okt.","nov.","dec."],dddd:["zondag","maandag","dinsdag","woensdag","donderdag","vrijdag","zaterdag"],ddd:["zo","ma","di","wo","do","vr","za"]},"nl"),m({group:","},"en"),m({decimal:",",nan:"epäluku",ampm:["ap.","ip."],mmmm:["tammikuuta","helmikuuta","maaliskuuta","huhtikuuta","toukokuuta","kesäkuuta","heinäkuuta","elokuuta","syyskuuta","lokakuuta","marraskuuta","joulukuuta"],mmm:["tammik.","helmik.","maalisk.","huhtik.","toukok.","kesäk.","heinäk.","elok.","syysk.","lokak.","marrask.","jouluk."],dddd:["sunnuntaina","maanantaina","tiistaina","keskiviikkona","torstaina","perjantaina","lauantaina"],ddd:["su","ma","ti","ke","to","pe","la"]},"fi"),m({group:" ",decimal:",",mmmm:["janvier","février","mars","avril","mai","juin","juillet","août","septembre","octobre","novembre","décembre"],mmm:["janv.","févr.","mars","avr.","mai","juin","juil.","août","sept.","oct.","nov.","déc."],dddd:["dimanche","lundi","mardi","mercredi","jeudi","vendredi","samedi"],ddd:["dim.","lun.","mar.","mer.","jeu.","ven.","sam."]},"fr"),m({group:".",decimal:",",mmmm:["Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"],mmm:["Jan.","Feb.","März","Apr.","Mai","Juni","Juli","Aug.","Sept.","Okt.","Nov.","Dez."],dddd:["Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag"],ddd:["So.","Mo.","Di.","Mi.","Do.","Fr.","Sa."]},"de"),m({group:".",decimal:",",ampm:["π.μ.","μ.μ."],mmmm:["Ιανουαρίου","Φεβρουαρίου","Μαρτίου","Απριλίου","Μαΐου","Ιουνίου","Ιουλίου","Αυγούστου","Σεπτεμβρίου","Οκτωβρίου","Νοεμβρίου","Δεκεμβρίου"],mmm:["Ιαν","Φεβ","Μαρ","Απρ","Μαΐ","Ιουν","Ιουλ","Αυγ","Σεπ","Οκτ","Νοε","Δεκ"],dddd:["Κυριακή","Δευτέρα","Τρίτη","Τετάρτη","Πέμπτη","Παρασκευή","Σάββατο"],ddd:["Κυρ","Δευ","Τρί","Τετ","Πέμ","Παρ","Σάβ"]},"el"),m({decimal:",",ampm:["de.","du."],mmmm:["január","február","március","április","május","június","július","augusztus","szeptember","október","november","december"],mmm:["jan.","febr.","márc.","ápr.","máj.","jún.","júl.","aug.","szept.","okt.","nov.","dec."],dddd:["vasárnap","hétfő","kedd","szerda","csütörtök","péntek","szombat"],ddd:["V","H","K","Sze","Cs","P","Szo"]},"hu"),m({group:".",decimal:",",ampm:["f.h.","e.h."],mmmm:["janúar","febrúar","mars","apríl","maí","júní","júlí","ágúst","september","október","nóvember","desember"],mmm:["jan.","feb.","mar.","apr.","maí","jún.","júl.","ágú.","sep.","okt.","nóv.","des."],dddd:["sunnudagur","mánudagur","þriðjudagur","miðvikudagur","fimmtudagur","föstudagur","laugardagur"],ddd:["sun.","mán.","þri.","mið.","fim.","fös.","lau."]},"is"),m({group:".",decimal:",",mmmm:["Januari","Februari","Maret","April","Mei","Juni","Juli","Agustus","September","Oktober","November","Desember"],mmm:["Jan","Feb","Mar","Apr","Mei","Jun","Jul","Agu","Sep","Okt","Nov","Des"],dddd:["Minggu","Senin","Selasa","Rabu","Kamis","Jumat","Sabtu"],ddd:["Min","Sen","Sel","Rab","Kam","Jum","Sab"]},"id"),m({group:".",decimal:",",mmmm:["gennaio","febbraio","marzo","aprile","maggio","giugno","luglio","agosto","settembre","ottobre","novembre","dicembre"],mmm:["gen","feb","mar","apr","mag","giu","lug","ago","set","ott","nov","dic"],dddd:["domenica","lunedì","martedì","mercoledì","giovedì","venerdì","sabato"],ddd:["dom","lun","mar","mer","gio","ven","sab"]},"it"),m({decimal:",",ampm:["a.m.","p.m."],mmmm:["januar","februar","mars","april","mai","juni","juli","august","september","oktober","november","desember"],mmm:["jan.","feb.","mar.","apr.","mai","jun.","jul.","aug.","sep.","okt.","nov.","des."],dddd:["søndag","mandag","tirsdag","onsdag","torsdag","fredag","lørdag"],ddd:["søn.","man.","tir.","ons.","tor.","fre.","lør."]},"nb"),m({decimal:",",mmmm:["stycznia","lutego","marca","kwietnia","maja","czerwca","lipca","sierpnia","września","października","listopada","grudnia"],mmm:["sty","lut","mar","kwi","maj","cze","lip","sie","wrz","paź","lis","gru"],dddd:["niedziela","poniedziałek","wtorek","środa","czwartek","piątek","sobota"],ddd:["niedz.","pon.","wt.","śr.","czw.","pt.","sob."]},"pl"),m({group:".",decimal:",",mmmm:["janeiro","fevereiro","março","abril","maio","junho","julho","agosto","setembro","outubro","novembro","dezembro"],mmm:["jan.","fev.","mar.","abr.","mai.","jun.","jul.","ago.","set.","out.","nov.","dez."],dddd:["domingo","segunda-feira","terça-feira","quarta-feira","quinta-feira","sexta-feira","sábado"],ddd:["dom.","seg.","ter.","qua.","qui.","sex.","sáb."]},"pt"),m({decimal:",",nan:"не число",mmmm:["января","февраля","марта","апреля","мая","июня","июля","августа","сентября","октября","ноября","декабря"],mmm:["янв.","февр.","мар.","апр.","мая","июн.","июл.","авг.","сент.","окт.","нояб.","дек."],dddd:["воскресенье","понедельник","вторник","среда","четверг","пятница","суббота"],ddd:["вс","пн","вт","ср","чт","пт","сб"]},"ru"),m({decimal:",",mmmm:["januára","februára","marca","apríla","mája","júna","júla","augusta","septembra","októbra","novembra","decembra"],mmm:["jan","feb","mar","apr","máj","jún","júl","aug","sep","okt","nov","dec"],dddd:["nedeľa","pondelok","utorok","streda","štvrtok","piatok","sobota"],ddd:["ne","po","ut","st","št","pi","so"]},"sk"),m({group:".",decimal:",",ampm:["a. m.","p. m."],mmmm:["enero","febrero","marzo","abril","mayo","junio","julio","agosto","septiembre","octubre","noviembre","diciembre"],mmm:["ene.","feb.","mar.","abr.","may.","jun.","jul.","ago.","sept.","oct.","nov.","dic."],dddd:["domingo","lunes","martes","miércoles","jueves","viernes","sábado"],ddd:["dom.","lun.","mar.","mié.","jue.","vie.","sáb."]},"es"),m({decimal:",",ampm:["fm","em"],mmmm:["januari","februari","mars","april","maj","juni","juli","augusti","september","oktober","november","december"],mmm:["jan.","feb.","mars","apr.","maj","juni","juli","aug.","sep.","okt.","nov.","dec."],dddd:["söndag","måndag","tisdag","onsdag","torsdag","fredag","lördag"],ddd:["sön","mån","tis","ons","tors","fre","lör"]},"sv"),m({group:".",decimal:",",ampm:["ÖÖ","ÖS"],mmmm:["Ocak","Şubat","Mart","Nisan","Mayıs","Haziran","Temmuz","Ağustos","Eylül","Ekim","Kasım","Aralık"],mmm:["Oca","Şub","Mar","Nis","May","Haz","Tem","Ağu","Eyl","Eki","Kas","Ara"],dddd:["Pazar","Pazartesi","Salı","Çarşamba","Perşembe","Cuma","Cumartesi"],ddd:["Paz","Pzt","Sal","Çar","Per","Cum","Cmt"]},"tr");function p(e2,t2,n2){const a2=e2<0?-1:1,r2=10**(t2||2),i2=10**(n2||2);let s2,o2,l2=Math.abs(e2),d2=0,m2=0,u2=0,c2=1;if((e2=l2)%1==0)o2=[e2*a2,1];else if(e2<1e-19)o2=[a2,1e19];else if(e2>1e19)o2=[1e19*a2,1];else{do if(l2=1/(l2-Math.floor(l2)),s2=c2,c2=c2*Math.floor(l2)+d2,d2=s2,m2=u2,u2=Math.floor(e2*c2+.5),u2>=r2||c2>=i2)return[a2*m2,d2];while(Math.abs(e2-u2/c2)>=1e-10&&l2!==Math.floor(l2));o2=[a2*u2,c2]}return o2}__name(p,"p");const f={overflow:"######",dateErrorThrows:!1,dateErrorNumber:!0,dateSpanLarge:!0,leap1900:!0,nbsp:!0,throws:!0,invalid:"######",locale:"",ignoreTimezone:!1},g=Object.assign({},f);function h(e2){if(e2===null&&(e2=f),e2){for(const t2 in e2)if(t2 in f){const n2=e2[t2];g[t2]=n2==null?f[t2]:n2}}return{...g}}__name(h,"h");const y={"#":"",0:"0","?":" "},_2={"@":"text","-":"minus","+":"plus"},b=["#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"],j=["¤","$","£","¥","֏","؋","৳","฿","៛","₡","₦","₩","₪","₫","€","₭","₮","₱","₲","₴","₸","₹","₺","₼","₽","₾","₿"],v=new RegExp("["+j.join("")+"]");function M2(e2,t2,n2){return t2[n2+"_max"]=e2.length,t2[n2+"_min"]=e2.replace(/#/g,"").length,t2}__name(M2,"M");const k={};function x(e2){if(!(e2 in k)){const t2=[],n2=e2.replace(/^[#,]+/,"").replace(/[1-9]\d*/g,e3=>"?".repeat(e3.length));for(let e3=0;e3<n2.length;e3++){const a2=n2.charAt(e3);t2[e3]=a2 in y?y[a2]:a2}k[e2]=t2.join("")}return k[e2]}__name(x,"x");function F(e2,t2){typeof e2=="string"&&(e2={type:"string",value:e2=e2.replace(/ /g,y["?"])}),t2.push(e2)}__name(F,"F");function z(e2){const t2=[],n2={scale:1,percent:!1,text:!1,date:0,date_eval:!1,date_system:1,sec_decimals:0,general:!1,clock:24,int_pattern:[],frac_pattern:[],man_pattern:[],den_pattern:[],num_pattern:[],tokens:t2};let a2=e2+"",r2="int",i2=!1,s2=null;const l2=[];let d2,m2,u2=!1;for(;a2&&!i2;){if(d2=/^General/i.exec(a2))n2.general=!0,F({type:"general"},t2);else if(r2==="int"&&(d2=/^[#?0]+(?:,[#?0]+)*/.exec(a2))||r2==="den"&&(d2=/^[#?\d]+/.exec(a2))||(d2=/^[#?0]+/.exec(a2)))n2[r2+"_pattern"].push(d2[0]),s2={type:r2,num:d2[0]},F(s2,t2);else if((d2=/^\//.exec(a2))&&n2[r2+"_pattern"].length){if(!s2)throw new SyntaxError("Missing a numerator in pattern ".concat(e2));n2.fractions=!0,n2.num_pattern.push(n2[r2+"_pattern"].pop()),s2.type="num",r2="den",F({type:"div"},t2)}else if(d2=/^,+/.exec(a2)){const e3=a2.charAt(1)in y;m2.slice(-1)in y&&(d2[0].length>1||!e3)?n2.scale=.001**d2[0].length:n2.dec_fractions||F(d2[0],t2)}else{if(d2=/^;/.exec(a2)){i2=!0;break}if(d2=/^[@+-]/.exec(a2))d2[0]==="@"&&(n2.text=!0),F({type:_2[d2[0]]},t2);else if(d2=/^(?:\[(h+|m+|s+)\])/i.exec(a2)){const e3=d2[1].toLowerCase(),a3=e3[0],r3={type:"",size:0,date:1,raw:d2[0],pad:e3.length};a3==="h"?(r3.size=16,r3.type="hour-elap"):a3==="m"?(r3.size=32,r3.type="min-elap"):(r3.size=64,r3.type="sec-elap"),n2.date=n2.date|r3.size,l2.push(r3),F(r3,t2)}else if(d2=/^(?:B2)/i.exec(a2))u2||(n2.date_system=6);else if(d2=/^(?:B1)/i.exec(a2))u2||(n2.date_system=1);else if(d2=/^(?:([hHmMsSyYbBdDegG])\1*)/.exec(a2)){const e3={type:"",size:0,date:1,raw:d2[0]},a3=d2[0].toLowerCase(),r3=a3[0];if(a3==="y"||a3==="yy")e3.size=2,e3.type="year-short";else if(r3==="y"||r3==="e")e3.size=2,e3.type="year";else if(a3==="b"||a3==="bb")e3.size=2,e3.type="b-year-short";else if(r3==="b")e3.size=2,e3.type="b-year";else if(a3==="d"||a3==="dd")e3.size=8,e3.type="day",e3.pad=/dd/.test(a3);else if(a3==="ddd")e3.size=8,e3.type="weekday-short";else if(r3==="d")e3.size=8,e3.type="weekday";else if(r3==="h")e3.size=16,e3.type="hour",e3.pad=/hh/i.test(a3);else if(r3==="m"){a3.length===3?(e3.size=4,e3.type="monthname-short"):a3.length===5?(e3.size=4,e3.type="monthname-single"):a3.length>=4&&(e3.size=4,e3.type="monthname");const t3=l2[l2.length-1];!e3.type&&t3&&!t3.used&&80&t3.size&&(t3.used=!0,e3.size=32,e3.type="min",e3.pad=/mm/.test(a3)),e3.type||(e3.size=4,e3.type="month",e3.pad=/mm/.test(a3),e3.indeterminate=!0)}else if(r3==="s"){e3.size=64,e3.type="sec",e3.pad=/ss/.test(a3);const t3=l2[l2.length-1];t3&&32&t3.size?e3.used=!0:t3&&t3.indeterminate&&(delete t3.indeterminate,t3.size=32,t3.type="min",e3.used=!0)}n2.date=n2.date|e3.size,n2.date_eval=!0,l2.push(e3),F(e3,t2)}else if(d2=/^(?:AM\/PM|am\/pm|A\/P)/.exec(a2))n2.clock=12,n2.date=16|n2.date,n2.date_eval=!0,F({type:"am",short:d2[0]==="A/P"},t2);else if(n2.date&&(d2=/^\.0{1,3}/i.exec(a2))){const e3=d2[0].length-1,a3=[64,128,256,512][e3];n2.date=n2.date|a3,n2.date_eval=!0,n2.sec_decimals=Math.max(n2.sec_decimals,e3),F({type:"subsec",size:a3,decimals:e3,date:1,raw:d2[0]},t2)}else if((d2=/^\\(.)/.exec(a2))||(d2=/^"([^"]*?)"/.exec(a2)))F(d2[1],t2);else if(d2=/^\[(<[=>]?|>=?|=)\s*(-?[.\d]+)\]/.exec(a2))n2.condition=[d2[1],parseFloat(d2[2],10)];else if(d2=/^\[\$([^\]]+)\]/.exec(a2)){const e3=d2[1].split("-"),a3=e3.length<2?"":e3[e3.length-1],r3=e3[0];r3&&F(r3,t2);const i3=o(a3);i3&&(n2.locale=i3);const s3=parseInt(a3,16);isFinite(s3)&&16711680&s3&&(s3>>16&255)===6&&(n2.date_system=6),u2=!0}else if(d2=/^\[(black|blue|cyan|green|magenta|red|white|yellow|color\s*(\d+))\]/i.exec(a2))n2.color=d2[2]?b[parseInt(d2[2],10)]||"#000":d2[1].toLowerCase();else if(!(d2=/^\[(DBNum1|ENG|HIJ|JPN|TWN)\]/i.exec(a2))){if(d2=/^%/.exec(a2))n2.scale=100,n2.percent=!0,F("%",t2);else if(d2=/^_(\\.|.)/.exec(a2))F(" ",t2);else if(d2=/^\./.exec(a2))F({type:"point",value:d2[0]},t2),n2.dec_fractions=!0,r2="frac";else if(d2=/^[Ee]([+-]?|(?=[0#?]))/.exec(a2))n2.exponential=!0,n2.exp_plus=d2[1]==="+",r2="man",F({type:"exp",plus:d2[1]==="+"},t2);else if(!(d2=/^\*(\\.|.)/.exec(a2))){if(d2=/^[BENn[]/.exec(a2))throw new SyntaxError("Unexpected char ".concat(a2.charAt(0)," in pattern ").concat(e2));a2[0]==="("&&(n2.parens=!0),d2=[a2[0]],F(d2[0],t2)}}}m2=d2[0],a2=a2.slice(d2?d2[0].length:1)}if(n2.pattern=e2.slice(0,e2.length-a2.length),/^((?:\[[^\]]+\])+)(;|$)/.test(n2.pattern)&&!/^\[(?:h+|m+|s+)\]/.test(n2.pattern)&&F({type:"text"},t2),n2.fractions&&n2.dec_fractions||n2.fractions&&n2.exponential)throw new SyntaxError("Invalid pattern: ".concat(n2.pattern));const c2=n2.int_pattern.join("");if(n2.grouping=c2.indexOf(",")>=0,n2.grouping){const e3=c2.split(","),t3=e3.length;t3===2?(n2.group_pri=e3[1].length,n2.group_sec=n2.group_pri):t3>2&&(n2.group_pri=e3[t3-1].length,n2.group_sec=e3[t3-2].length)}else n2.group_pri=0,n2.group_sec=0;M2(c2.replace(/[,]/g,""),n2,"int"),M2(n2.frac_pattern.join(""),n2,"frac"),M2(n2.man_pattern.join(""),n2,"man");let p2=n2.num_pattern.join(""),f2=n2.den_pattern.join("");const g2=/\?/.test(f2)||/\?/.test(p2);return f2=f2.replace(/\d/g,g2?"?":"#"),g2&&(f2=f2.replace(/#$/g,"?")),M2(p2,n2,"num"),M2(f2,n2,"den"),g2&&(p2=p2.replace(/#$/g,"?")),n2.int_padding=x(n2.int_pattern.join("")),n2.man_padding=x(n2.man_pattern.join("")),n2.num_padding=x(p2),n2.den_padding=x(f2),n2.den_pattern.length&&(n2.denominator=parseInt(n2.den_pattern.join("").replace(/\D/g,""),10)),n2.integer=!!n2.int_pattern.join("").length,n2.fractions&&t2.forEach((e3,n3)=>{const a3=t2[n3+1];e3.type==="string"&&a3&&(a3.type==="num"?e3.rule="num+int":a3.type==="div"?e3.rule="num":a3.type==="den"&&(e3.rule="den"))}),n2}__name(z,"z");const w=__name(e2=>{const t2=e2.condition;t2&&t2[1]<0&&(t2[0]==="<"||t2[0]==="<="||t2[0]==="=")||e2.tokens.unshift({type:"minus",volatile:!0})},"w");function D(e2){const t2=[];let n2,a2=!1,r2=null,i2=e2,s2=0,l2=!1,d2=0,m2=0;do{if(l2=z(i2),(l2.date||l2.general)&&(l2.int_pattern.length||l2.frac_pattern.length||l2.scale!==1||l2.text))throw new Error("Illegal format");if(l2.condition&&(m2++,a2=!0),l2.text){if(r2)throw new Error("Unexpected partition");r2=l2}l2.locale&&(n2=o(l2.locale)),t2.push(l2),s2=i2.charAt(l2.pattern.length)===";"?1:0,i2=i2.slice(l2.pattern.length+s2),d2++}while(s2&&d2<4&&m2<3);if(s2)throw new Error("Unexpected partition");if(m2>2)throw new Error("Unexpected condition");const u2=t2[3];if(u2&&(u2.int_pattern.length||u2.frac_pattern.length||u2.date))throw new Error("Unexpected partition");if(a2){const e3=t2.length;if(e3===1&&(t2[1]=z("General"),t2[1].generated=!0),e3<3){const e4=t2[0],n3=t2[1];if(w(e4),n3.condition)w(n3);else{const t3=e4.condition;(t3[0]==="="||t3[1]>=0&&(t3[0]===">"||t3[0]===">="))&&n3.tokens.unshift({type:"minus",volatile:!0})}}else t2.forEach(w)}else{if(t2.length<4&&r2)for(let e3=0,n3=t2.length;e3<n3;e3++)t2[e3]===r2&&t2.splice(e3,1);if(t2.length<1&&r2&&(t2[0]=z("General"),t2[0].generated=!0),t2.length<2){const e3=z(t2[0].pattern);e3.tokens.unshift({type:"minus",volatile:!0}),e3.generated=!0,t2.push(e3)}if(t2.length<3){const e3=z(t2[0].pattern);e3.generated=!0,t2.push(e3)}if(t2.length<4)if(r2)t2.push(r2);else{const e3=z("@");e3.generated=!0,t2.push(e3)}t2[0].condition=[">",0],t2[1].condition=["<",0],t2[2].condition=null}return{pattern:e2,partitions:t2,locale:n2}}__name(D,"D");const S2=Math.floor;function C(e2){if((!(arguments.length>1&&arguments[1]!==void 0)||arguments[1])&&e2>=0){if(e2===0)return[1900,1,0];if(e2===60)return[1900,2,29];if(e2<60)return[1900,e2<32?1:2,(e2-1)%31+1]}let n2=e2+68569+2415019;const a2=S2(4*n2/146097);n2-=S2((146097*a2+3)/4);const r2=S2(4e3*(n2+1)/1461001);n2=n2-S2(1461*r2/4)+31;const i2=S2(80*n2/2447),s2=n2-S2(2447*i2/80);n2=S2(i2/11);const o2=i2+2-12*n2;return[0|100*(a2-49)+r2+n2,0|o2,0|s2]}__name(C,"C");function E(e2){return C(e2+1462)}__name(E,"E");function A(e2){if(e2===60)throw new Error("#VALUE!");if(e2<=1)return[1317,8,29];if(e2<60)return[1317,e2<32?9:10,1+(e2-2)%30];const t2=10631/30,n2=.1335;let a2=e2+466935;const r2=S2(a2/10631);a2-=10631*r2;const i2=S2((a2-n2)/t2);a2-=S2(i2*t2+n2);const s2=S2((a2+28.5001)/29.5);return s2===13?[30*r2+i2,12,30]:[30*r2+i2,s2,a2-S2(29.5001*s2-29)]}__name(A,"A");function Y(e2){let t2=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n2=!(arguments.length>2&&arguments[2]!==void 0)||arguments[2];const a2=S2(e2);return t2===6?A(a2):t2===-1?E(a2):C(a2,n2)}__name(Y,"Y");const T=Math.floor,N=86400;function P(e2,t2){let n2=null;if(Array.isArray(e2)){const[t3,a2,r2,i2,s2,o2]=e2;n2=Date.UTC(t3,a2==null?0:a2-1,r2!=null?r2:1,i2||0,s2||0,o2||0)}else if(e2 instanceof Date&&(n2=1*e2,!t2||!t2.ignoreTimezone)){const t3=new Date;t3.setUTCFullYear(e2.getFullYear(),e2.getMonth(),e2.getDate()),t3.setUTCHours(e2.getHours(),e2.getMinutes(),e2.getSeconds(),e2.getMilliseconds()),n2=1*t3}if(n2!=null&&isFinite(n2)){const e3=n2/864e5;return e3-(e3<=-25509?-25568:-25569)}return e2}__name(P,"P");function I(e2,t2){let n2=0|e2;const a2=N*(e2-n2);let r2=T(a2);a2-r2>.9999&&(r2+=1,r2===N&&(r2=0,n2+=1));const i2=r2<0?N+r2:r2,[s2,o2,l2]=Y(e2,0,t2&&t2.leap1900),d2=T(i2/60/60)%60,m2=T(i2/60)%60,u2=T(i2)%60;if(t2&&t2.nativeDate){const e3=new Date(0);return e3.setUTCFullYear(s2,o2-1,l2),e3.setUTCHours(d2,m2,u2),e3}return[s2,o2,l2,d2,m2,u2]}__name(I,"I");function O(e2){return!!(e2[0]&&e2[0].percent||e2[1]&&e2[1].percent||e2[2]&&e2[2].percent||e2[3]&&e2[3].percent)}__name(O,"O");function J(e2){return!!(e2[0]&&e2[0].date||e2[1]&&e2[1].date||e2[2]&&e2[2].date||e2[3]&&e2[3].date)}__name(J,"J");function L(e2){const[t2,n2,a2,r2]=e2;return!(t2&&!t2.generated||n2&&!n2.generated||a2&&!a2.generated||!r2||!r2.text||r2.generated)}__name(L,"L");const U={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},R=[["DMY",1],["DM",2],["MY",3],["MDY",4],["MD",5],["hmsa",6],["hma",7],["hms",8],["hm",9]],G={total:1,sign:0,period:0,int:1,frac:0},H=__name((e2,t2)=>e2.replace(/\./,t2.decimal),"H");function B(e2,t2,n2,a2){const r2=0|n2;if(typeof n2=="string")e2.push(n2);else if(n2===r2)e2.push(Math.abs(r2));else{const t3=Math.abs(n2);let r3=t3?Math.floor(Math.log10(t3)):0,i2=r3<0?t3*10**-r3:t3/10**r3;i2===10&&(i2=1,r3++);const s2=function(e3){let t4=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];const n3=Math.abs(e3);if(!n3)return G;const a3=t4&&e3<0?1:0,r4=Math.floor(n3),i3=Math.floor(Math.log10(n3)+1);let s3=0,o3=0;if(r4!==n3){s3=1;const e4=String(c(i3<0?n3*10**-i3:n3/10**i3,15));let t5=e4.length,a4=!0,r5=0;for(;r5<=e4.length;){if(e4[r5]==="."){t5--;break}e4[r5]==="0"&&a4?t5--:a4=!1,r5++}o3=t5-i3,o3<0&&(o3=0,s3=0)}return{total:a3+Math.max(i3,1)+s3+o3,digits:Math.max(i3,0)+o3,sign:a3,period:s3,int:Math.max(i3,1),frac:o3}}(t3),o2=__name(()=>{const t4=Math.abs(r3);let n3;n3=i2===1?i2:c(i2,5),e2.push(H(n3+"",a2),a2.exponent,r3<0?a2.negative:a2.positive,t4<10?"0":"",t4)},"o");if(r3>=-4&&r3<=-1){const n3=t3.toPrecision(10+r3).replace(/\.?0+$/,"");e2.push(H(n3,a2))}else if(r3===10){const n3=t3.toFixed(10).slice(0,12).replace(/\.$/,"");e2.push(H(n3,a2))}else if(Math.abs(r3)<=9)if(s2.total<=11){const n3=c(t3,9).toFixed(s2.frac);e2.push(H(n3,a2))}else r3===9?e2.push(Math.floor(t3)):r3>=0&&r3<9?e2.push(c(t3,9-r3)):o2();else s2.total>=12?o2():Math.floor(t3)===t3?e2.push(Math.floor(t3)):e2.push(H(c(t3,9).toFixed(s2.frac),a2))}return e2}__name(B,"B");const $=86400,W={int:"integer",frac:"fraction",man:"mantissa",num:"numerator",den:"denominator"},Z=__name(function(e2){let t2=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;const n2=Math.floor(Math.log10(e2));return t2>1?Math.floor(n2/t2)*t2:n2},"Z");function K(e2,t2,n2,a2){let r2="",i2="",s2="",o2="",l2="",d2=0,m2=0|e2,f2=0,g2=0,h2=1,_3=0,b2=0,j2=0,v2=0,M3=0,k2=0;const x2=a2||u;if(!t2.text&&isFinite(t2.scale)&&t2.scale!==1&&(e2=function(e3){if(e3===0)return e3;const t3=Math.ceil(Math.log10(e3<0?-e3:e3)),n3=10**(16-Math.floor(t3));return Math.round(e3*n3)/n3}(e2*t2.scale)),t2.exponential){let n3=Math.abs(e2);if(n3){const e3=10**-Z(n3,t2.int_max),a3=c(n3*e3,t2.frac_max)/e3;d2=Z(a3,t2.int_max)}n3/=10**d2,e2=e2<0?-n3:n3,r2+=Math.abs(d2)}if(t2.integer){const n3=Math.abs(c(e2,t2.fractions?1:t2.frac_max));l2+=n3<1?"":Math.floor(n3)}if(t2.grouping){let e3="",n3=l2.length;for(n3>t2.group_pri&&(n3-=t2.group_pri,e3=x2.group+l2.slice(n3,n3+t2.group_pri)+e3);n3>t2.group_sec;)n3-=t2.group_sec,e3=x2.group+l2.slice(n3,n3+t2.group_sec)+e3;l2=n3?l2.slice(0,n3)+e3:e3}t2.dec_fractions&&(o2=String(c(e2,t2.frac_max)).split(".")[1]||"");let F2=!1;if(t2.fractions){const n3=Math.abs(t2.integer?e2%1:e2);if(n3)if(F2=!0,isFinite(t2.denominator))s2+=t2.denominator,i2+=c(n3*t2.denominator),i2==="0"&&(i2="",s2="",F2=!1,l2||(l2="0"));else{const e3=p(n3,t2.integer?t2.num_max:1/0,t2.den_max);i2+=e3[0],s2+=e3[1],t2.integer&&i2==="0"&&(l2||(l2="0"),i2="",s2="",F2=!1)}}if(t2.date){m2=Math.trunc(e2);const a3=$*(e2-m2);if(f2=Math.floor(a3),k2=a3-f2,Math.abs(k2)<1e-6?k2=0:k2>.9999&&(k2=0,f2+=1,f2===$&&(f2=0,m2+=1)),k2){const e3=512&t2.date||256&t2.date||128&t2.date;(e3===512&&k2>.9995||e3===256&&k2>.995||e3===128&&k2>.95||!e3&&k2>=.5)&&(f2++,k2=0)}if(m2||t2.date_system){const a4=Y(e2,t2.date_system,n2.leap1900);g2=a4[0],h2=a4[1],_3=a4[2]}if(f2){const e3=f2<0?$+f2:f2;M3=Math.floor(e3)%60,v2=Math.floor(e3/60)%60,j2=Math.floor(e3/60/60)%60}if(b2=(6+m2)%7,t2.date_eval&&(z2=e2,w2=m2+f2/$,n2.dateSpanLarge?z2<-694324||w2>=35830291:z2<0||w2>=2958466)){if(n2.dateErrorThrows)throw new Error("Date out of bounds");return n2.dateErrorNumber?B(e2<0?[x2.negative]:[],0,e2,x2).join(""):n2.overflow}}var z2,w2;if(t2.int_padding&&(l2=t2.int_padding.length===1?l2||t2.int_padding:t2.int_padding.substring(0,t2.int_padding.length-l2.length)+l2),t2.num_padding&&(i2=t2.num_padding.length===1?i2||t2.num_padding:t2.num_padding.substring(0,t2.num_padding.length-i2.length)+i2),t2.den_padding&&(s2=t2.den_padding.length===1?s2||t2.den_padding:s2+t2.den_padding.slice(s2.length)),t2.man_padding){const e3=t2.exp_plus?"+":"";r2=t2.man_padding.length===1?(d2<0?"-":e3)+(r2||t2.man_padding):(d2<0?"-":e3)+t2.man_padding.slice(0,t2.man_padding.length-r2.length)+r2}const D2=[];let S3=0;const C2={int:0,frac:0,man:0,num:0,den:0};for(let d3=0,u2=t2.tokens.length;d3<u2;d3++){const u3=t2.tokens[d3],c2=u3.num?u3.num.length:0;if(u3.type==="string")u3.rule?u3.rule==="num"?F2?D2.push(u3.value):(t2.num_min>0||t2.den_min>0)&&D2.push(u3.value.replace(/./g,y["?"])):u3.rule==="num+int"?F2&&l2?D2.push(u3.value):t2.den_min>0&&(l2||t2.num_min)&&D2.push(u3.value.replace(/./g,y["?"])):u3.rule==="den"&&(F2?D2.push(u3.value):(t2.den_min>0||t2.den_min>0)&&D2.push(u3.value.replace(/./g,y["?"]))):D2.push(u3.value);else if(u3.type==="error")D2.push(n2.invalid);else if(u3.type==="point")D2.push(t2.date?u3.value:x2.decimal);else if(u3.type==="general")B(D2,0,e2,x2);else if(u3.type==="exp")D2.push(x2.exponent);else if(u3.type==="minus")u3.volatile&&t2.date||u3.volatile&&(e2>=0||typeof e2!="number")||(u3.volatile&&!t2.fractions&&(t2.integer||t2.dec_fractions)?(e2<0&&l2&&l2!=="0"||o2)&&D2.push(x2.negative):D2.push(x2.negative));else if(u3.type==="plus")D2.push(x2.positive);else if(u3.type==="text")D2.push(e2);else if(u3.type==="div")F2?D2.push("/"):t2.num_min>0||t2.den_min>0?D2.push(y["?"]):D2.push(y["#"]);else if(u3.type==="int")if(t2.int_pattern.length===1)D2.push(l2);else{const e3=S3?t2.int_pattern.join("").length-C2.int:1/0,n3=S3===t2.int_pattern.length-1?0:t2.int_pattern.join("").length-(C2.int+u3.num.length);D2.push(l2.substring(l2.length-e3,l2.length-n3)),S3++,C2.int+=u3.num.length}else if(u3.type==="frac"){const e3=C2.frac;for(let t3=0;t3<c2;t3++)D2.push(o2[t3+e3]||y[u3.num[t3]]);C2.frac+=c2}else if(u3.type in W)t2[u3.type+"_pattern"].length===1?(u3.type==="int"&&D2.push(l2),u3.type==="frac"&&D2.push(o2),u3.type==="man"&&D2.push(r2),u3.type==="num"&&D2.push(i2),u3.type==="den"&&D2.push(s2)):(D2.push(W[u3.type].slice(C2[u3.type],C2[u3.type]+c2)),C2[u3.type]+=c2);else if(u3.type==="year")g2<0&&D2.push(x2.negative),D2.push(String(Math.abs(g2)).padStart(4,"0"));else if(u3.type==="year-short"){const e3=g2%100;D2.push(e3<10?"0":"",e3)}else if(u3.type==="month")D2.push(u3.pad&&h2<10?"0":"",h2);else if(u3.type==="monthname-single")t2.date_system===6?D2.push(x2.mmmm6[h2-1].charAt(0)):D2.push(x2.mmmm[h2-1].charAt(0));else if(u3.type==="monthname-short")t2.date_system===6?D2.push(x2.mmm6[h2-1]):D2.push(x2.mmm[h2-1]);else if(u3.type==="monthname")t2.date_system===6?D2.push(x2.mmmm6[h2-1]):D2.push(x2.mmmm[h2-1]);else if(u3.type==="weekday-short")D2.push(x2.ddd[b2]);else if(u3.type==="weekday")D2.push(x2.dddd[b2]);else if(u3.type==="day")D2.push(u3.pad&&_3<10?"0":"",_3);else if(u3.type==="hour"){const e3=j2%t2.clock||(t2.clock<24?t2.clock:0);D2.push(u3.pad&&e3<10?"0":"",e3)}else if(u3.type==="min")D2.push(u3.pad&&v2<10?"0":"",v2);else if(u3.type==="sec")D2.push(u3.pad&&M3<10?"0":"",M3);else if(u3.type==="subsec"){D2.push(x2.decimal);const e3=k2.toFixed(t2.sec_decimals);D2.push(e3.slice(2,2+u3.decimals))}else if(u3.type==="am"){const e3=j2<12?0:1;u3.short&&!a2?D2.push("AP"[e3]):D2.push(x2.ampm[e3])}else if(u3.type==="hour-elap"){e2<0&&D2.push(x2.negative);const t3=24*m2+Math.floor(Math.abs(f2)/3600);D2.push(String(Math.abs(t3)).padStart(u3.pad,"0"))}else if(u3.type==="min-elap"){e2<0&&D2.push(x2.negative);const t3=1440*m2+Math.floor(Math.abs(f2)/60);D2.push(String(Math.abs(t3)).padStart(u3.pad,"0"))}else if(u3.type==="sec-elap"){e2<0&&D2.push(x2.negative);const t3=m2*$+Math.abs(f2);D2.push(String(Math.abs(t3)).padStart(u3.pad,"0"))}else if(u3.type==="b-year")D2.push(g2+543);else if(u3.type==="b-year-short"){const e3=(g2+543)%100;D2.push(e3<10?"0":"",e3)}}return n2.nbsp?D2.join(""):D2.join("").replace(/\u00a0/g," ")}__name(K,"K");function q(e2,t2){for(let n2=0;n2<3;n2++){const a2=t2[n2];if(a2){let t3;if(a2.condition){const n3=a2.condition[0],r2=a2.condition[1];n3==="="?t3=e2===r2:n3===">"?t3=e2>r2:n3==="<"?t3=e2<r2:n3===">="?t3=e2>=r2:n3==="<="?t3=e2<=r2:n3==="<>"&&(t3=e2!==r2)}else t3=!0;if(t3)return a2}}}__name(q,"q");const V=z("@"),Q="black",X={};function ee(e2,t2){if(e2){const n2=e2[0];t2[n2]=t2[n2]||{},ee(e2.slice(1),t2[n2])}else t2.$=!0}__name(ee,"ee"),["d-F-y","d-F-Y","d-M-y","d-M-Y","F-d-y","F-d-Y","F-j-y","F-j-Y","j-F-y","j-F-Y","j-M-y","j-M-Y","M-d-y","M-d-Y","M-j-y","M-j-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","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"].forEach(e2=>{ee(e2,X),ee(e2+" x",X),ee(e2+" l",X),ee(e2+" l x",X),ee("l "+e2,X),ee("l "+e2+" x",X),ee(e2+" D",X),ee(e2+" D x",X),ee("D "+e2,X),ee("D "+e2+" x",X)});const te={jan:1,feb:2,mar:3,apr:4,may:5,jun:6,jul:7,aug:8,sep:9,oct:10,nov:11,dec:12},ne={january:1,february:2,march:3,april:4,june:6,july:7,august:8,september:9,october:10,november:11,december:12},ae={sunday:"l",monday:"l",tuesday:"l",wednesday:"l",thursday:"l",friday:"l",saturday:"l",sun:"D",mon:"D",tue:"D",wed:"D",thu:"D",fri:"D",sat:"D"},re=new Date().getUTCFullYear();function ie(e2){const t2=new RegExp("^([\\s+%"+j.join("")+"(-]*)(((?:(?:\\d[\\d,]*)(?:\\.\\d*)?|(?:\\.\\d+)))([eE][+-]?\\d+)?)([\\s%"+j.join("")+")]*)$").exec(e2);if(t2){const[,e3,n2,a2,r2,i2]=t2;let s2=1,o2="",l2=!1,d2=!1,m2=!1,u2=!1,c2=!1,p2=null,f2=!1,g2=parseFloat(n2.replace(/,/g,""));if(!isFinite(g2))return null;for(let t3=0;t3<e3.length;t3++){const n3=e3[t3];if(n3==="-"){if(l2||d2)return null;l2=!0,s2=-1}else if(v.test(n3)){if(c2)return null;c2=!0,p2=n3}else if(n3==="("){if(d2||l2)return null;d2=!0,s2=-1}else if(n3==="%"){if(u2)return null;u2=!0}}for(let e4=0;e4<i2.length;e4++){const t3=i2[e4];if(v.test(t3)){if(c2)return null;c2=!0,p2=t3,f2=!0}else if(t3===")"){if(m2||!d2)return null;m2=!0}else if(t3==="%"){if(u2)return null;u2=!0}}if(r2){if(u2||c2)return null;o2="0.00E+00"}else if(u2){if(c2)return null;o2=a2.includes(".")?"0.00%":"0%",g2*=.01}else if(c2){const e4=a2.includes(".")?"#,##0.00":"#,##0";o2=f2?e4+p2:p2+e4}else a2.includes(",")&&(o2=a2.includes(".")?"#,##0.00":"#,##0");const h2={v:g2*s2};return o2&&(h2.z=o2),h2}}__name(ie,"ie");const se=__name((e2,t2,n2)=>{const a2=n2.path||"",r2=Object.keys(t2);for(let i2=0;i2<r2.length;i2++){let s2;const o2=r2[i2];if(t2[o2]){if(o2==="$"||o2==="€")e2||(s2=n2);else if(o2==="-"){const r3=/^(\s*([./-]|,\s)\s*|\s+)/.exec(e2);if(r3){const i3=r3[1]==="-"||r3[1]==="/"||r3[1]==="."?r3[1]:" ";if(!n2.sep||n2.sep===i3){const l2=r3[0].replace(/\s+/g," ");s2=se(e2.slice(r3[0].length),t2[o2],{...n2,sep:i3,path:a2+l2})}}}else if(o2===" "){const r3=/^[,.]?\s+/.exec(e2);if(r3){const i3=r3[0].replace(/\s+/g," ");s2=se(e2.slice(r3[0].length),t2[o2],{...n2,path:a2+i3})}}else if(o2==="j"||o2==="d"){const r3=/^(0?[1-9]|1\d|2\d|3[01])\b/.exec(e2);r3&&(s2=se(e2.slice(r3[0].length),t2[o2],{...n2,day:r3[0],path:a2+o2}))}else if(o2==="n"||o2==="m"){const r3=/^(0?[1-9]|1[012])\b/.exec(e2);r3&&(s2=se(e2.slice(r3[0].length),t2[o2],{...n2,month:+r3[0],_mon:r3[0],path:a2+o2}))}else if(o2==="F"||o2==="M"){const r3=/^([a-z]{3,9})\b/i.exec(e2),i3=r3&&(o2==="F"?ne:te)[r3[0].toLowerCase()];i3&&(s2=se(e2.slice(r3[0].length),t2[o2],{...n2,month:i3,_mon:r3[0],path:a2+o2}))}else if(o2==="l"||o2==="D"){const r3=/^([a-z]{3,9})\b/i.exec(e2);(r3&&ae[r3[0].toLowerCase()])===o2&&(s2=se(e2.slice(r3[0].length),t2[o2],{...n2,path:a2+o2}))}else if(o2==="y"){const r3=/^\d\d\b/.exec(e2);if(r3){const i3=+r3[0]>=30?+r3[0]+1900:+r3[0]+2e3;s2=se(e2.slice(r3[0].length),t2[o2],{...n2,year:i3,path:a2+o2})}}else if(o2==="Y"){const r3=/^\d\d\d\d\b/.exec(e2);r3&&(s2=se(e2.slice(r3[0].length),t2[o2],{...n2,year:+r3[0],path:a2+o2}))}else{if(o2!=="x")throw new Error('Unknown date token "'.concat(o2,'"'));{const r3=le(e2);r3&&(s2=se("",t2[o2],{...n2,time:r3.v,tf:r3.z,path:a2+o2}))}}if(s2)return s2}}},"se");function oe(e2,t2){const n2=se(e2.trim(),X,{path:""});if(n2){var a2;if(n2.sep==="."&&n2.path.length===3)return null;const e3=+((a2=n2.year)!==null&&a2!==void 0?a2:re);if(n2.day||(n2.day=1),!function(e4,t3,n3){if(n3<1||t3<1||t3>12)return!1;if(t3===2){if(n3>(e4%4==0&&e4%100!=0||e4%400==0||e4===1900?29:28))return!1}else if((t3===4||t3===6||t3===9||t3===11)&&n3>30||(t3===1||t3===3||t3===5||t3===7||t3===8||t3===10||t3===12)&&n3>31)return!1;return!0}(e3,n2.month,n2.day))return null;let r2=-1/0;if(e3<1900)return null;e3<=1900&&n2.month<=2?r2=25568:e3<1e4&&(r2=25569);const i2=Date.UTC(e3,n2.month-1,n2.day)/864e5+r2+(n2.time||0);if(i2>=0&&i2<=2958465){const e4=n2._mon[0]==="0"||n2.day[0]==="0"||n2._mon.length===2&&n2.day.length===2,a3=n2.path.replace(/[jdlDnmMFyYx-]/g,t3=>t3==="j"||t3==="d"?e4?"dd":"d":t3==="D"?"ddd":t3==="l"?"dddd":t3==="n"||t3==="m"?e4?"mm":"m":t3==="M"?"mmm":t3==="F"?"mmmm":t3==="y"?"yy":t3==="x"?n2.tf||"":t3==="Y"?"yyyy":t3);return t2&&t2.nativeDate?{v:I(i2,t2),z:a3}:{v:i2,z:a3}}}return null}__name(oe,"oe");function le(e2){const t2=/^\s*([10]?\d|2[0-4])(?::([0-5]\d|\d))?(?::([0-5]\d|\d))?(\.\d{1,10})?(?:\s*([AP])M?)?\s*$/i.exec(e2);if(t2){const[,e3,n2,a2,r2,i2]=t2;if(r2&&!a2||!i2&&!n2&&!a2)return null;let s2=1*(e3||0);if(i2){if(s2>=13)return null;i2[0]!=="p"&&i2[0]!=="P"||(s2+=12)}return{v:(60*s2*60+60*(1*(n2||0))+1*(a2||0)+1*(r2||0))/86400,z:(e3.length===2?"hh":"h")+":mm"+(a2?":ss":"")+(i2?" AM/PM":"")}}return null}__name(le,"le");function de(e2){return/^\s*true\s*$/i.test(e2)?{v:!0}:/^\s*false\s*$/i.test(e2)?{v:!1}:null}__name(de,"de");const me={};function ue(e2,t2){const{pattern:n2,partitions:a2,locale:r2}=e2,i2=__name(e3=>{const n3=Object.assign({},h(),t2,e3);return r2&&(n3.locale=r2),n3},"i"),s2=__name((e3,t3)=>{const n3=i2(t3);return function(e4,t4,n4){const a3=l(n4.locale),r3=t4[3]?t4[3]:V;if(typeof e4=="boolean"&&(e4=e4?"TRUE":"FALSE"),e4==null)return"";if(typeof e4!="number")return K(e4,r3,n4,a3);if(!isFinite(e4)){const t5=a3||u;return isNaN(e4)?t5.nan:(e4<0?t5.negative:"")+t5.infinity}const i3=q(e4,t4);return i3?K(e4,i3,n4,a3):n4.overflow}(P(e3,n3),a2,n3)},"s");s2.color=(e3,t3)=>function(e4,t4){if(typeof e4!="number"||!isFinite(e4))return(t4[3]?t4[3].color:V.color)||Q;const n3=q(e4,t4);return n3&&n3.color||Q}(P(e3,i2(t3)),a2);const o2=function(e3){var t3;let n3=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;const[a3,r3]=e3,i3=a3.frac_max,s3={type:"general",isDate:J(e3),isText:L(e3),isPercent:O(e3),maxDecimals:a3.general?9:i3,scale:(t3=a3.scale)!==null&&t3!==void 0?t3:1,color:0,parentheses:0,grouped:a3.grouping?1:0,_partitions:e3},o3=!s3.isDate&&!s3.isText&&!a3.error&&a3.tokens.some(e4=>e4.type==="string"&&(n3?e4.value===n3:v.test(e4.value)));let l2="G",d2=i3>=0?Math.min(15,i3):"",m2="",u2="";if(r3&&r3.color&&(u2="-",s3.color=1),a3.parens&&(m2="()",s3.parentheses=1),o3)l2="C",s3.type="currency";else if(a3.error)s3.type="error",s3.maxDecimals=0;else if(s3.isDate){let e4=0,t4=0,n4="";a3.tokens.forEach(a4=>{const r5=a4.type;/^(b-)?year/.test(r5)?(n4+="Y",t4++):r5.startsWith("month")?(n4+="M",t4++):/^(week)?day/.test(r5)?(n4+="D",t4++):r5!=="hour"&&r5!=="min"&&r5!=="sec"&&r5!=="am"||(n4+=r5[0],e4++)}),s3.type="date",t4&&e4?s3.type="datetime":!t4&&e4&&(s3.type="time");const r4=R.find(e5=>n4.startsWith(e5[0]));l2=r4?"D":"G",d2=r4?r4[1]:""}else s3.isText?(l2="G",s3.type="text",d2="",s3.maxDecimals=0):a3.general?(l2="G",s3.type="general",d2=""):a3.fractions?(l2="G",s3.type="fraction",d2=""):a3.exponential?(l2="S",s3.type="scientific"):s3.isPercent?(l2="P",s3.type="percent"):a3.grouping?(l2=",",s3.type="grouped"):(a3.int_max||i3)&&(l2="F",s3.type="number");return s3.code=l2+d2+u2+m2,s3.level=U[s3.type],Object.freeze(s3)}(a2,(t2||{}).currency)||new SyntaxError;return s2.info=o2,s2.dateInfo=function(e3){const[t3]=e3;return{year:!!(2&t3.date),month:!!(4&t3.date),day:!!(8&t3.date),hours:!!(16&t3.date),minutes:!!(32&t3.date),seconds:!!(64&t3.date),clockType:t3.clock===12?12:24}}(a2),s2.isPercent=()=>!!o2.isPercent,s2.isDate=()=>!!o2.isDate,s2.isText=()=>!!o2.isText,s2.pattern=n2,e2.error&&(s2.error=e2.error),s2.options=i2,s2.locale=r2||t2&&t2.locale||"",Object.freeze(s2)}__name(ue,"ue");function ce(e2,t2){e2||(e2="General");let n2=null;return me[e2]?n2=me[e2]:(n2=Object.assign({},h(),t2).throws?D(e2):function(e3){try{return D(e3)}catch(t3){const n3={tokens:[{type:"error"}],error:t3.message};return{pattern:e3,partitions:[n3,n3,n3,n3],error:t3.message,locale:null}}}(e2),n2.error||(me[e2]=n2)),ue(n2,t2)}__name(ce,"ce"),ce.isDate=e2=>ce(e2,{throws:!1}).isDate(),ce.isPercent=e2=>ce(e2,{throws:!1}).isPercent(),ce.isText=e2=>ce(e2,{throws:!1}).isText(),ce.getInfo=(e2,t2)=>ce(e2,{...t2,throws:!1}).info,ce.getDateInfo=(e2,t2)=>ce(e2,{...t2,throws:!1}).dateInfo,ce.dateToSerial=P,ce.dateFromSerial=I,ce.options=h,ce.dec2frac=p,ce.round=c,ce.codeToLocale=n,ce.parseLocale=s,ce.getLocale=l,ce.addLocale=(e2,t2)=>{const n2=s(t2);return delete me[n2.lang],delete me[n2.language],m(e2,n2)},ce.format=function(e2,t2,n2){let a2=arguments.length>3&&arguments[3]!==void 0&&arguments[3];const r2=n2&&typeof n2=="object"?n2:{locale:n2,throws:!a2};return ce(e2,r2)(P(t2,r2),r2)},ce.is_date=ce.isDate,ce.parseNumber=ie,ce.parseDate=oe,ce.parseTime=le,ce.parseBool=de,ce.parseValue=function(e2,t2){var n2,a2,r2;return(n2=(a2=(r2=ie(e2))!==null&&r2!==void 0?r2:oe(e2,t2))!==null&&a2!==void 0?a2:le(e2))!==null&&n2!==void 0?n2:de(e2)};var pe=ce;return t=t.default}()})}(numfmt$3)),numfmt$3.exports}__name(requireNumfmt$1,"requireNumfmt$1");var numfmt$1,hasRequiredNumfmt;function requireNumfmt(){return hasRequiredNumfmt||(hasRequiredNumfmt=1,numfmt$1=requireNumfmt$1()),numfmt$1}__name(requireNumfmt,"requireNumfmt");var numfmtExports=requireNumfmt();const _numfmt=getDefaultExportFromCjs(numfmtExports),numfmt=_numfmt;function getArrayLength(o){let maxIndex=0;const keys=Object.keys(o);for(const key of keys){const rowIndex=Number(key);maxIndex=Math.max(maxIndex,rowIndex)}return maxIndex+1}__name(getArrayLength,"getArrayLength");function insertMatrixArray(index2,value,o){const length=getArrayLength(o),array=o;for(let i=length-1;i>=index2;i--)array[i+1]=array[i];array[index2]=value}__name(insertMatrixArray,"insertMatrixArray");function spliceArray(start,count,o){const length=Object.keys(o).reduce((max,key)=>Math.max(max,Number.parseInt(key)),0)+1;for(let i=start;i<length;i++)i<start+count?delete o[i]:o[i]!==void 0&&(o[i-count]=o[i],delete o[i])}__name(spliceArray,"spliceArray");function concatMatrixArray(source,target){const srcArray=source,srcKeys=Object.keys(srcArray),srcLength=srcKeys.length,targetArray=target,targetKeys=Object.keys(targetArray),targetLength=targetKeys.length,containerArray={};let master=0;for(let i=0;i<srcLength;i++,master++){const key=srcKeys[i];containerArray[master]=srcArray[key]}for(let i=0;i<targetLength;i++,master++){const key=targetKeys[i];containerArray[master]=targetArray[key]}return containerArray}__name(concatMatrixArray,"concatMatrixArray");function sliceMatrixArray(start,end,matrixArray){const array=matrixArray;if(getArrayLength(matrixArray)>0){const fragment={};let effective=0;for(let i=start;i<=end;i++)array[i]&&(fragment[effective]=array[i],effective++);return fragment}return{}}__name(sliceMatrixArray,"sliceMatrixArray");function moveMatrixArray(fromIndex,count,toIndex,o){const moveBackward=fromIndex>toIndex;if(!moveBackward&&fromIndex+count>toIndex)throw new Error("Invalid move operation");moveBackward?_moveBackward(fromIndex,count,toIndex,o):_moveForward(fromIndex,count,toIndex,o)}__name(moveMatrixArray,"moveMatrixArray");function _moveBackward(fromIndex,count,toIndex,o){const array=o,toMove=[];for(let i=fromIndex;i<fromIndex+count;i++)toMove.push(array[i]);for(let i=fromIndex-1;i>=toIndex;i--){const item=array[i];array[i+count]=item,item===void 0&&delete array[i+count]}toMove.forEach((item,index2)=>{array[toIndex+index2]=item,item===void 0&&delete array[toIndex+index2]})}__name(_moveBackward,"_moveBackward");function _moveForward(fromIndex,count,toIndex,o){const array=o,toMove=[];for(let i=fromIndex;i<fromIndex+count;i++)toMove.push(array[i]);for(let i=fromIndex+count;i<toIndex;i++){const item=array[i];array[i-count]=item,item===void 0&&delete array[i-count]}toMove.forEach((item,index2)=>{array[toIndex+index2-count]=item,item===void 0&&delete array[toIndex+index2-count]})}__name(_moveForward,"_moveForward");const _ObjectMatrix=class _ObjectMatrix{constructor(matrix={}){__publicField(this,"_matrix");this._setOriginValue(matrix)}static MakeObjectMatrixSize(size){return new _ObjectMatrix({[size-1]:{}})}getMatrix(){return this._matrix}forEach(callback){const matrix=this._matrix,matrixRow=Object.keys(matrix);for(const row of matrixRow){const rowNumber=Number(row),columns=matrix[rowNumber];if(callback(rowNumber,columns)===!1)return this}return this}forRow(callback){const matrix=this._matrix,matrixRow=Object.keys(matrix);for(const row of matrixRow){const rowNumber=Number(row),columns=matrix[rowNumber];if(callback(rowNumber,Object.keys(columns).map(col=>Number(col)))===!1)return this}return this}forValue(callback){const matrix=this._matrix;for(const row in matrix){const rowNumber=Number(row),columns=matrix[rowNumber];if(columns)for(const column in columns){const colNumber=Number(column),value=columns[colNumber];if(callback(rowNumber,colNumber,value)===!1)return this}}return this}swapRow(src,target){const srcRow=this._matrix[src],targetRow=this._matrix[target];this._matrix[src]=targetRow,this._matrix[target]=srcRow}getRow(rowIndex){return this._matrix[rowIndex]}getRowOrCreate(rowIndex){let row=this.getRow(rowIndex);return row==null&&(row={},this._matrix[rowIndex]=row),row}reset(){this._setOriginValue({})}hasValue(){const matrix=this._matrix,matrixRow=Object.keys(matrix);if(matrixRow.length===0)return!1;for(const row of matrixRow){const rowNumber=Number(row),columns=matrix[rowNumber];if(Object.keys(columns).length>0)return!0}return!1}getValue(row,column){var _a17,_b2;return(_b2=(_a17=this._matrix)==null?void 0:_a17[row])==null?void 0:_b2[column]}setValue(row,column,value){const objectArray=this.getRowOrCreate(row);objectArray[column]=value}deleteValue(row,column){var _a17,_b2;(_b2=(_a17=this._matrix)==null?void 0:_a17[row])==null||delete _b2[column]}realDeleteValue(row,column){var _a17,_b2,_c;if((_b2=(_a17=this._matrix)==null?void 0:_a17[row])==null||delete _b2[column],this.getRow(row)){const objectArray=this.getRow(row);if(objectArray==null)return;Object.keys(objectArray).length===0&&((_c=this._matrix)==null||delete _c[row])}}setRow(rowNumber,row){this._matrix[rowNumber]=row}moveRows(start,count,target){moveMatrixArray(start,count,target,this._matrix)}moveColumns(start,count,target){this.forEach((row,value)=>{moveMatrixArray(start,count,target,value)})}insertRows(start,count){for(let r=start;r<start+count;r++)insertMatrixArray(r,{},this._matrix)}insertColumns(start,count){for(let c=start;c<start+count;c++)this.forEach((row,data)=>{data&&insertMatrixArray(c,void 0,data)})}removeRows(start,count){spliceArray(start,count,this._matrix)}removeColumns(start,count){this.forEach((row,value)=>{value&&spliceArray(start,count,value)})}getFragment(startRow,endRow,startColumn,endColumn){const objectMatrix=new _ObjectMatrix;let insertRow=0;for(let r=startRow;r<=endRow;r++){const row={};let insertColumn=0;for(let c=startColumn;c<=endColumn;c++){const value=this.getValue(r,c);row[insertColumn]=value,insertColumn++}objectMatrix.setRow(insertRow,row),insertRow++}return objectMatrix}getSlice(startRow,endRow,startColumn,endColumn){const objectMatrix=new _ObjectMatrix;for(let r=startRow;r<=endRow;r++)for(let c=startColumn;c<=endColumn;c++){const value=this.getValue(r,c);value&&objectMatrix.setValue(r,c,Tools.deepClone(value))}return objectMatrix}getSizeOf(){return Object.keys(this._matrix).length}getLength(){return getArrayLength(this._matrix)}getRange(){const endRow=this.getLength()-1;let endColumn=0;const length=this.getLength();for(let i=0;i<length;i++){const row=this.getRow(i);if(row){const columnLength=getArrayLength(row)-1;endColumn=columnLength>endColumn?columnLength:endColumn}}return{startRow:0,startColumn:0,endRow,endColumn}}toNativeArray(){const native=new Array;return this.forValue((row,col,value)=>{native.push(value)}),native}toArray(){const array=[];return this.forRow((row,cols)=>{array[row]==null&&(array[row]=[]),cols.forEach(column=>{array[row][column]=this.getValue(row,column)})}),array}toFullArray(){const range=this.getRange(),{endColumn,endRow}=range,array=[];for(let i=0;i<=endRow;i++){const subArr=new Array(endColumn+1).fill(void 0);array.push(subArr)}return this.forValue((row,col,value)=>{array[row][col]=value}),array}toJSON(){return this._matrix}clone(){const json=JSON.stringify(this._matrix);return JSON.parse(json)}getData(){const json=JSON.stringify(this._matrix);return JSON.parse(json)}getArrayData(){let startRow=0,startColumn=0,initRow=!1,initColumn=!1;const objectMatrix=new _ObjectMatrix;return this.forEach((rowIndex,rowObject)=>{initRow||(initRow=!0,startRow=rowIndex),Object.keys(rowObject).forEach(column=>{const columnIndex=Number(column);initColumn?columnIndex<startColumn&&(startColumn=columnIndex):(initColumn=!0,startColumn=columnIndex);const value=this.getValue(rowIndex,columnIndex);objectMatrix.setValue(rowIndex-startRow,columnIndex-startColumn,value)})}),objectMatrix.getData()}getStartEndScope(){let startRow=1/0,endRow=-1/0,startColumn=1/0,endColumn=-1/0;const rows=Object.keys(this._matrix);rows.length>0&&(startRow=+rows[0],endRow=+rows[rows.length-1]);for(const row of rows){const columns=Object.keys(this._matrix[row]);columns.length>0&&(startColumn=Math.min(startColumn,+columns[0]),endColumn=Math.max(endColumn,+columns[columns.length-1]))}return{startRow,endRow,startColumn,endColumn}}getDataRange(){let startRow=0,startColumn=0,endColumn=0,endRow=-1,initRow=!1,initColumn=!1;return this.forEach((rowIndex,row)=>{if(initRow||(initRow=!0,startRow=rowIndex),row==null)return;const rowSize=getArrayLength(row)-1;rowSize>endColumn&&(endColumn=rowSize),Object.keys(row).forEach(column=>{const columnIndex=Number(column);initColumn?columnIndex<startColumn&&(startColumn=columnIndex):(initColumn=!0,startColumn=columnIndex)}),rowIndex>endRow&&(endRow=rowIndex)}),{startRow,startColumn,endRow,endColumn}}getDiscreteRanges(){const ranges=[];return this.forEach((r,row)=>{Object.keys(row).forEach(col=>{const c=Number(col);let merged=!1;for(const range of ranges)if(r>=range.startRow&&r<=range.endRow+1&&c>=range.startColumn&&c<=range.endColumn+1){range.endRow=Math.max(r,range.endRow),range.endColumn=Math.max(c,range.endColumn),merged=!0;break}merged||ranges.push({startRow:r,endRow:r,startColumn:c,endColumn:c})})}),ranges}merge(newObject){this.forValue((row,column)=>{const cellValue=newObject.getValue(row,column);cellValue!=null&&this.setValue(row,column,cellValue)})}_setOriginValue(matrix={}){this._matrix=matrix}};__name(_ObjectMatrix,"ObjectMatrix");let ObjectMatrix=_ObjectMatrix;const DEFAULT_RANGE_ARRAY={sheetId:"",range:{startRow:-1,endRow:-1,startColumn:-1,endColumn:-1}},DEFAULT_RANGE={startRow:-1,startColumn:-1,endRow:-1,endColumn:-1},DEFAULT_SELECTION={startRow:0,startColumn:0,endRow:0,endColumn:0},DEFAULT_CELL={row:0,column:0},DEFAULT_STYLES={ff:"Arial",fs:11,it:BooleanNumber.FALSE,bl:BooleanNumber.FALSE,ul:{s:BooleanNumber.FALSE},st:{s:BooleanNumber.FALSE},ol:{s:BooleanNumber.FALSE},tr:{a:0,v:BooleanNumber.FALSE},td:TextDirection.UNSPECIFIED,cl:{rgb:"#000"},bg:{rgb:"#fff"},ht:HorizontalAlign.UNSPECIFIED,vt:VerticalAlign.UNSPECIFIED,tb:WrapStrategy.UNSPECIFIED,pd:{t:0,r:0,b:0,l:0},n:null,bd:{b:null,l:null,r:null,t:null}},DEFAULT_SLIDE={id:"default_slide",title:"defaultSlide",pageSize:{width:300,height:300}},SHEET_EDITOR_UNITS=[DOCS_NORMAL_EDITOR_UNIT_ID_KEY,DOCS_ZEN_EDITOR_UNIT_ID_KEY,DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY];var EXTENSION_NAMES=(EXTENSION_NAMES2=>(EXTENSION_NAMES2.ARRAY_CONVERTOR="ARRAY_CONVERTOR",EXTENSION_NAMES2.MATRIX_CONVERTOR="MATRIX_CONVERTOR",EXTENSION_NAMES2))(EXTENSION_NAMES||{});function isAllFormatInTextRuns(key,body){const{textRuns=[]}=body;let len=0;for(const textRun of textRuns){const{ts={},st,ed}=textRun;if(ts[key]==null)return BooleanNumber.FALSE;switch(key){case"bl":case"it":{if(ts[key]===BooleanNumber.FALSE)return BooleanNumber.FALSE;break}case"ul":case"st":{if(ts[key].s===BooleanNumber.FALSE)return BooleanNumber.FALSE;break}default:throw new Error(`unknown style key: ${key} in IStyleBase`)}len+=ed-st}return body.dataStream.indexOf(`\r
7
+ `)===len?BooleanNumber.TRUE:BooleanNumber.FALSE}__name(isAllFormatInTextRuns,"isAllFormatInTextRuns");const _Range=class _Range{constructor(workSheet,range,_deps){__publicField(this,"_range");__publicField(this,"_worksheet");this._deps=_deps,this._range=range,this._worksheet=workSheet}static foreach(range,action){const{startRow,startColumn,endRow,endColumn}=range;for(let i=startRow;i<=endRow;i++)for(let j=startColumn;j<=endColumn;j++)action(i,j)}getRangeData(){return this._range}getValue(){return this.getValues()[0][0]}getValues(){const{startRow,endRow,startColumn,endColumn}=this._range,range=[];for(let r=startRow;r<=endRow;r++){const row=[];for(let c=startColumn;c<=endColumn;c++)row.push(this.getMatrix().getValue(r,c)||null);range.push(row)}return range}getMatrix(){const{startRow,endRow,startColumn,endColumn}=this._range,sheetMatrix=this._worksheet.getCellMatrix(),rangeMatrix=new ObjectMatrix;for(let r=startRow;r<=endRow;r++)for(let c=startColumn;c<=endColumn;c++)rangeMatrix.setValue(r,c,sheetMatrix.getValue(r,c)||null);return rangeMatrix}getMatrixObject(){const{startRow,endRow,startColumn,endColumn}=this._range,sheetMatrix=this._worksheet.getCellMatrix(),rangeMatrix=new ObjectMatrix;for(let r=startRow;r<=endRow;r++)for(let c=startColumn;c<=endColumn;c++)rangeMatrix.setValue(r-startRow,c-startColumn,sheetMatrix.getValue(r,c)||{});return rangeMatrix}getA1Notation(){const{startRow,endRow,startColumn,endColumn}=this._range;let start,end;return startColumn<endColumn?(start=Tools.numToWord(startColumn+1)+(startRow+1),end=Tools.numToWord(endColumn+1)+(endRow+1)):(start=Tools.numToWord(endColumn+1)+(endRow+1),end=Tools.numToWord(startColumn+1)+(startRow+1)),start===end?`${start}`:`${start}:${end}`}getBackground(){return this.getBackgrounds()[0][0]}getBackgrounds(){const styles=this._deps.getStyles();return this.getValues().map(row=>row.map(cell=>{var _a17;const rgbColor=styles.getStyleByCell(cell);return((_a17=rgbColor==null?void 0:rgbColor.bg)==null?void 0:_a17.rgb)||DEFAULT_STYLES.bg.rgb}))}getCell(row,column){const{startRow,startColumn}=this._range,cell={startRow:startRow+row,endRow:startRow+row,startColumn:startColumn+column,endColumn:startColumn+column};return new _Range(this._worksheet,cell,this._deps)}getColumn(){return this._range.startColumn}getObjectValue(options={}){return this.getObjectValues(options)[0][0]}getObjectValues(options={}){var _a17;const{startRow,endRow,startColumn,endColumn}=this._range,values=this._worksheet.getCellMatrix().getFragment(startRow,endRow,startColumn,endColumn).getData();if(options.isIncludeStyle){const style=this._deps.getStyles();for(let r=0;r<=endRow-startRow;r++)for(let c=0;c<=endColumn-startColumn;c++){if(values==null||((_a17=values==null?void 0:values[r])==null?void 0:_a17[c])==null)continue;const s=values[r][c].s;s&&(values[r][c].s=style.get(s))}}return values}getFontColor(){return this.getFontColors()[0][0]}getFontColors(){const styles=this._deps.getStyles();return this.getValues().map(row=>row.map(cell=>{var _a17;const cellStyle=styles.getStyleByCell(cell);return((_a17=cellStyle==null?void 0:cellStyle.cl)==null?void 0:_a17.rgb)||DEFAULT_STYLES.cl.rgb}))}getFontFamilies(){return this._getStyles("ff")}getFontFamily(){return this.getFontFamilies()[0][0]}getUnderlines(){return this._getStyles("ul")}getUnderline(){var _a17,_b2;const{p}=(_a17=this.getValue())!=null?_a17:{};return p&&Array.isArray((_b2=p.body)==null?void 0:_b2.textRuns)&&p.body.textRuns.length>0?isAllFormatInTextRuns("ul",p.body)===BooleanNumber.TRUE?{s:BooleanNumber.TRUE}:{s:BooleanNumber.FALSE}:this.getUnderlines()[0][0]}getOverlines(){return this._getStyles("ol")}getOverline(){return this.getOverlines()[0][0]}getStrikeThrough(){var _a17,_b2;const{p}=(_a17=this.getValue())!=null?_a17:{};return p&&Array.isArray((_b2=p.body)==null?void 0:_b2.textRuns)&&p.body.textRuns.length>0?isAllFormatInTextRuns("st",p.body)===BooleanNumber.TRUE?{s:BooleanNumber.TRUE}:{s:BooleanNumber.FALSE}:this.getStrikeThroughs()[0][0]}getStrikeThroughs(){return this._getStyles("st")}getFontSize(){var _a17,_b2;const p=((_a17=this.getValue())==null?void 0:_a17.p)||{};return Array.isArray((_b2=p.body)==null?void 0:_b2.textRuns)&&p.body.textRuns.length>0?p.body.textRuns.some(textRun=>{var _a18;return((_a18=textRun==null?void 0:textRun.ts)==null?void 0:_a18.fs)!=null})?Math.max(...p.body.textRuns.map(textRun=>{var _a18;return((_a18=textRun==null?void 0:textRun.ts)==null?void 0:_a18.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 _a17,_b2;const{p}=(_a17=this.getValue())!=null?_a17:{};return p&&Array.isArray((_b2=p.body)==null?void 0:_b2.textRuns)&&p.body.textRuns.length>0?isAllFormatInTextRuns("it",p.body)===BooleanNumber.TRUE?FontItalic.ITALIC:FontItalic.NORMAL:this._getFontStyles()[0][0]}_getFontStyles(){return this._getStyles("it")}getFontWeight(){var _a17,_b2;const{p}=(_a17=this.getValue())!=null?_a17:{};return p&&Array.isArray((_b2=p.body)==null?void 0:_b2.textRuns)&&p.body.textRuns.length>0?isAllFormatInTextRuns("bl",p.body)===BooleanNumber.TRUE?FontWeight.BOLD:FontWeight.NORMAL:this._getFontWeights()[0][0]}_getFontWeights(){return this._getStyles("bl")}getGridId(){return this._worksheet.getSheetId()}getHeight(){const{_range:_rangeData,_worksheet}=this,{startRow,endRow}=_rangeData;let h=0;for(let i=0;i<=endRow-startRow;i++){const hh=_worksheet.getRowHeight(i);h+=hh}return h}getHorizontalAlignment(){return this.getHorizontalAlignments()[0][0]}getHorizontalAlignments(){return this._getStyles("ht")}getLastColumn(){return this._range.endColumn}getLastRow(){return this._range.endRow}getNumColumns(){const{startColumn,endColumn}=this._range;return endColumn-startColumn+1}getNumRows(){const{startRow,endRow}=this._range;return endRow-startRow+1}getRichTextValue(){return this.getRichTextValues()[0][0]}getRichTextValues(){return this.getValues().map(row=>row.map(cell=>(cell==null?void 0:cell.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 styles=this._deps.getStyles();return this.getValues().map(row=>row.map(cell=>styles.getStyleByCell(cell)))}getVerticalAlignment(){return this.getVerticalAlignments()[0][0]}getVerticalAlignments(){return this._getStyles("vt")}getWidth(){const{_range:_rangeData,_worksheet}=this,{startColumn,endColumn}=_rangeData;let w=0;for(let i=0;i<=endColumn-startColumn;i++)w+=_worksheet.getColumnWidth(i);return w}getWrap(){return this.getWrapStrategy()===WrapStrategy.WRAP?BooleanNumber.TRUE:BooleanNumber.FALSE}getWrapStrategies(){return this._getStyles("tb")}getWrapStrategy(){return this.getWrapStrategies()[0][0]}forEach(action){_Range.foreach(this._range,action)}_getStyles(styleKey){const styles=this._deps.getStyles();return this.getValues().map(row=>row.map(cell=>{const style=styles&&styles.getStyleByCell(cell);return style&&style[styleKey]||DEFAULT_STYLES[styleKey]}))}};__name(_Range,"Range"),__publicField(_Range,"transformRange",__name((range,worksheet)=>{const maxColumns=worksheet.getMaxColumns()-1,maxRows=worksheet.getMaxRows()-1;return range.rangeType===RANGE_TYPE.ALL?{startColumn:0,startRow:0,endColumn:maxColumns,endRow:maxRows}:range.rangeType===RANGE_TYPE.COLUMN?{startRow:0,endRow:maxRows,startColumn:range.startColumn,endColumn:range.endColumn}:range.rangeType===RANGE_TYPE.ROW?{startColumn:0,endColumn:maxColumns,startRow:range.startRow,endRow:range.endRow}:{startColumn:range.startColumn,endColumn:Math.min(range.endColumn,maxColumns),startRow:range.startRow,endRow:Math.min(range.endRow,maxRows)}},"transformRange"));let Range=_Range;function moveRangeByOffset(range,refOffsetX,refOffsetY,ignoreAbsolute=!1){if(refOffsetX===0&&refOffsetY===0)return range;let newRange={...range};const startAbsoluteRefType=newRange.startAbsoluteRefType||AbsoluteRefType.NONE,endAbsoluteRefType=newRange.endAbsoluteRefType||AbsoluteRefType.NONE,rangeType=newRange.rangeType||RANGE_TYPE.NORMAL;if(!ignoreAbsolute&&startAbsoluteRefType===AbsoluteRefType.ALL&&endAbsoluteRefType===AbsoluteRefType.ALL)return newRange;const start=moveRangeByRangeType(newRange.startRow,refOffsetY,newRange.startColumn,refOffsetX,rangeType),end=moveRangeByRangeType(newRange.endRow,refOffsetY,newRange.endColumn,refOffsetX,rangeType);return ignoreAbsolute||startAbsoluteRefType===AbsoluteRefType.NONE&&endAbsoluteRefType===AbsoluteRefType.NONE?newRange={...newRange,startRow:start.row,startColumn:start.column,endRow:end.row,endColumn:end.column}:(startAbsoluteRefType===AbsoluteRefType.NONE?newRange={...newRange,startRow:start.row,startColumn:start.column}:startAbsoluteRefType===AbsoluteRefType.COLUMN?newRange={...newRange,startRow:start.row}:startAbsoluteRefType===AbsoluteRefType.ROW&&(newRange={...newRange,startColumn:start.column}),endAbsoluteRefType===AbsoluteRefType.NONE?newRange={...newRange,endRow:end.row,endColumn:end.column}:endAbsoluteRefType===AbsoluteRefType.COLUMN?newRange={...newRange,endRow:end.row}:endAbsoluteRefType===AbsoluteRefType.ROW&&(newRange={...newRange,endColumn:end.column}),newRange)}__name(moveRangeByOffset,"moveRangeByOffset");function moveRangeByRangeType(row,rowOffset,column,columnOffset,rangeType){return rangeType===RANGE_TYPE.NORMAL?{row:row+rowOffset,column:column+columnOffset}:rangeType===RANGE_TYPE.ROW?{row:row+rowOffset,column}:rangeType===RANGE_TYPE.COLUMN?{row,column:column+columnOffset}:{row,column}}__name(moveRangeByRangeType,"moveRangeByRangeType");function splitIntoGrid(ranges){const columns=new Set,rows=new Set;for(const range of ranges)columns.add(range.startColumn),columns.add(range.endColumn+1),rows.add(range.startRow),rows.add(range.endRow+1);const sortedColumns=Array.from(columns).sort((a,b)=>a-b),sortedRows=Array.from(rows).sort((a,b)=>a-b);ranges.sort((a,b)=>a.startRow-b.startRow||a.startColumn-b.startColumn);const result=[];for(let i=0;i<sortedRows.length-1;i++)for(let j=0;j<sortedColumns.length-1;j++){const startColumn=sortedColumns[j],endColumn=sortedColumns[j+1]-1,startRow=sortedRows[i],endRow=sortedRows[i+1]-1;for(const range of ranges){if(range.startRow>endRow)break;if(range.startRow<=startRow&&range.endRow>=endRow&&range.startColumn<=startColumn&&range.endColumn>=endColumn){result.push({startColumn,endColumn,startRow,endRow});break}}}return result}__name(splitIntoGrid,"splitIntoGrid");function mergeHorizontalRanges(ranges){ranges.sort((a,b)=>a.startRow-b.startRow||a.startColumn-b.startColumn);const rowGroups={};for(const range of ranges)rowGroups[range.startRow]||(rowGroups[range.startRow]=[]),rowGroups[range.startRow].push(range);const mergedRanges=[];for(const row in rowGroups){const rangesInRow=rowGroups[+row];rangesInRow.sort((a,b)=>a.startColumn-b.startColumn);let currentRange=rangesInRow[0];for(let i=1;i<rangesInRow.length;i++){const nextRange=rangesInRow[i];nextRange.startColumn<=currentRange.endColumn+1&&nextRange.startRow===currentRange.startRow&&nextRange.endRow===currentRange.endRow?currentRange.endColumn=Math.max(currentRange.endColumn,nextRange.endColumn):(mergedRanges.push(currentRange),currentRange=nextRange)}mergedRanges.push(currentRange)}return mergedRanges}__name(mergeHorizontalRanges,"mergeHorizontalRanges");function mergeVerticalRanges(ranges){ranges.sort((a,b)=>a.startColumn-b.startColumn||a.startRow-b.startRow);const columnGroups={};for(const range of ranges)columnGroups[range.startColumn]||(columnGroups[range.startColumn]=[]),columnGroups[range.startColumn].push(range);const mergedRanges=[];for(const col in columnGroups){const rangesInCol=columnGroups[+col];rangesInCol.sort((a,b)=>a.startRow-b.startRow);let currentRange=rangesInCol[0];for(let i=1;i<rangesInCol.length;i++){const nextRange=rangesInCol[i];nextRange.startRow<=currentRange.endRow+1&&nextRange.startColumn===currentRange.startColumn&&nextRange.endColumn===currentRange.endColumn?currentRange.endRow=Math.max(currentRange.endRow,nextRange.endRow):(mergedRanges.push(currentRange),currentRange=nextRange)}mergedRanges.push(currentRange)}return mergedRanges}__name(mergeVerticalRanges,"mergeVerticalRanges");function mergeRanges(ranges){const split=splitIntoGrid(ranges),horizontalMerged=mergeHorizontalRanges(split);return mergeVerticalRanges(horizontalMerged)}__name(mergeRanges,"mergeRanges");function multiSubtractSingleRange(ranges,toDelete){const res=[];return ranges.forEach(range=>{res.push(...Rectangle.subtract(range,toDelete))}),Rectangle.mergeRanges(res)}__name(multiSubtractSingleRange,"multiSubtractSingleRange");function getIntersectRange(src,target){const rowOverlap=getOverlap1D(src.startRow,src.endRow,target.startRow,target.endRow),colOverlap=getOverlap1D(src.startColumn,src.endColumn,target.startColumn,target.endColumn);if(!rowOverlap||!colOverlap)return null;const[startRow,endRow]=rowOverlap,[startColumn,endColumn]=colOverlap,rangeType=determineRangeType(src.rangeType,target.rangeType,startRow,endRow,startColumn,endColumn);return{startRow,endRow,startColumn,endColumn,rangeType}}__name(getIntersectRange,"getIntersectRange");function getOverlap1D(start1,end1,start2,end2){const s1=isNaN(start1)?-1/0:start1,e1=isNaN(end1)?1/0:end1,s2=isNaN(start2)?-1/0:start2,e2=isNaN(end2)?1/0:end2,start=Math.max(s1,s2),end=Math.min(e1,e2);if(start<=end){const resultStart=start===-1/0?Number.NaN:start,resultEnd=end===1/0?Number.NaN:end;return[resultStart,resultEnd]}else return null}__name(getOverlap1D,"getOverlap1D");function determineRangeType(srcType,targetType,startRow,endRow,startColumn,endColumn){const resolvedSrcType=srcType!==void 0?srcType:inferRangeType(startRow,endRow,startColumn,endColumn),resolvedTargetType=targetType!==void 0?targetType:inferRangeType(startRow,endRow,startColumn,endColumn);return resolvedSrcType===RANGE_TYPE.ALL||resolvedTargetType===RANGE_TYPE.ALL?resolvedSrcType===resolvedTargetType?resolvedSrcType:resolvedSrcType===RANGE_TYPE.ALL?resolvedTargetType:resolvedSrcType:resolvedSrcType===resolvedTargetType?resolvedSrcType:(resolvedSrcType===RANGE_TYPE.NORMAL||resolvedTargetType===RANGE_TYPE.NORMAL,RANGE_TYPE.NORMAL)}__name(determineRangeType,"determineRangeType");function inferRangeType(startRow,endRow,startColumn,endColumn){const hasRow=!isNaN(startRow)&&!isNaN(endRow),hasColumn=!isNaN(startColumn)&&!isNaN(endColumn);return hasRow&&hasColumn?RANGE_TYPE.NORMAL:hasRow?RANGE_TYPE.ROW:hasColumn?RANGE_TYPE.COLUMN:RANGE_TYPE.ALL}__name(inferRangeType,"inferRangeType");const _Rectangle=class _Rectangle{static clone(src){return src.rangeType!==void 0?{startRow:src.startRow,startColumn:src.startColumn,endRow:src.endRow,endColumn:src.endColumn,rangeType:src.rangeType}:{startRow:src.startRow,startColumn:src.startColumn,endRow:src.endRow,endColumn:src.endColumn}}static equals(src,target){return src==null||target==null?!1:src.endRow===target.endRow&&src.endColumn===target.endColumn&&src.startRow===target.startRow&&src.startColumn===target.startColumn&&(src.rangeType===target.rangeType||src.rangeType===void 0&&target.rangeType===RANGE_TYPE.NORMAL||target.rangeType===void 0&&src.rangeType===RANGE_TYPE.NORMAL)}static simpleRangesIntersect(rangeA,rangeB){const{startRow:startRowA,endRow:endRowA,startColumn:startColumnA,endColumn:endColumnA}=rangeA,{startRow:startRowB,endRow:endRowB,startColumn:startColumnB,endColumn:endColumnB}=rangeB,rowsOverlap=startRowA<=endRowB&&endRowA>=startRowB,columnsOverlap=startColumnA<=endColumnB&&endColumnA>=startColumnB;return rowsOverlap&&columnsOverlap}static intersects(src,target){if(src.rangeType===RANGE_TYPE.ROW&&target.rangeType===RANGE_TYPE.COLUMN||src.rangeType===RANGE_TYPE.COLUMN&&target.rangeType===RANGE_TYPE.ROW)return!0;if(src.rangeType===RANGE_TYPE.ROW&&target.rangeType===RANGE_TYPE.ROW)return src.startRow<=target.endRow&&src.endRow>=target.startRow;if(src.rangeType===RANGE_TYPE.COLUMN&&target.rangeType===RANGE_TYPE.COLUMN)return src.startColumn<=target.endColumn&&src.endColumn>=target.startColumn;const MAX=Math.floor(Number.MAX_SAFE_INTEGER/10),currentStartRow=Number.isNaN(src.startRow)?0:src.startRow,currentEndRow=Number.isNaN(src.endRow)?MAX:src.endRow,currentStartColumn=Number.isNaN(src.startColumn)?0:src.startColumn,currentEndColumn=Number.isNaN(src.endColumn)?MAX:src.endColumn,incomingStartRow=Number.isNaN(target.startRow)?0:target.startRow,incomingEndRow=Number.isNaN(target.endRow)?MAX:target.endRow,incomingStartColumn=Number.isNaN(target.startColumn)?0:target.startColumn,incomingEndColumn=Number.isNaN(target.endColumn)?MAX:target.endColumn,zx=Math.abs(currentStartColumn+currentEndColumn-incomingStartColumn-incomingEndColumn),x=Math.abs(currentStartColumn-currentEndColumn)+Math.abs(incomingStartColumn-incomingEndColumn),zy=Math.abs(currentStartRow+currentEndRow-incomingStartRow-incomingEndRow),y=Math.abs(currentStartRow-currentEndRow)+Math.abs(incomingStartRow-incomingEndRow);return zx<=x&&zy<=y}static getIntersects(src,target){const currentStartRow=src.startRow,currentEndRow=src.endRow,currentStartColumn=src.startColumn,currentEndColumn=src.endColumn,incomingStartRow=target.startRow,incomingEndRow=target.endRow,incomingStartColumn=target.startColumn,incomingEndColumn=target.endColumn;let startColumn,startRow,endColumn,endRow;if(incomingStartRow<=currentEndRow)incomingStartRow>=currentStartRow?startRow=incomingStartRow:startRow=currentStartRow;else return null;if(incomingEndRow>=currentStartRow)incomingEndRow>=currentEndRow?endRow=currentEndRow:endRow=incomingEndRow;else return null;if(incomingStartColumn<=currentEndColumn)incomingStartColumn>currentStartColumn?startColumn=incomingStartColumn:startColumn=currentStartColumn;else return null;if(incomingEndColumn>=currentStartColumn)incomingEndColumn>=currentEndColumn?endColumn=currentEndColumn:endColumn=incomingEndColumn;else return null;return{startRow,endRow,startColumn,endColumn,rangeType:RANGE_TYPE.NORMAL}}static contains(src,target){return src.startRow<=target.startRow&&src.endRow>=target.endRow&&src.startColumn<=target.startColumn&&src.endColumn>=target.endColumn}static realContain(src,target){return _Rectangle.contains(src,target)&&(src.startRow<target.startRow||src.endRow>target.endRow||src.startColumn<target.startColumn||src.endColumn>target.endColumn)}static union(...ranges){return ranges.reduce((acc,current)=>({startRow:Math.min(acc.startRow,current.startRow),startColumn:Math.min(acc.startColumn,current.startColumn),endRow:Math.max(acc.endRow,current.endRow),endColumn:Math.max(acc.endColumn,current.endColumn),rangeType:RANGE_TYPE.NORMAL}),ranges[0])}static realUnion(...ranges){const hasColRange=ranges.some(range=>range.rangeType===RANGE_TYPE.COLUMN),hasRowRange=ranges.some(range=>range.rangeType===RANGE_TYPE.ROW),res=_Rectangle.union(...ranges);return{startColumn:hasRowRange?Number.NaN:res.startColumn,endColumn:hasRowRange?Number.NaN:res.endColumn,startRow:hasColRange?Number.NaN:res.startRow,endRow:hasColRange?Number.NaN:res.endRow,rangeType:hasRowRange?RANGE_TYPE.ROW:hasColRange?RANGE_TYPE.COLUMN:RANGE_TYPE.NORMAL}}static subtract(range1,range2){if(range2.startRow>range1.endRow||range2.endRow<range1.startRow||range2.startColumn>range1.endColumn||range2.endColumn<range1.startColumn)return[range1];const ranges=[];range2.startRow>=range1.startRow&&ranges.push({startRow:range1.startRow,startColumn:range1.startColumn,endRow:range2.startRow-1,endColumn:range1.endColumn}),range2.endRow<=range1.endRow&&ranges.push({startRow:range2.endRow+1,startColumn:range1.startColumn,endRow:range1.endRow,endColumn:range1.endColumn});const topBoundary=Math.max(range1.startRow,range2.startRow),bottomBoundary=Math.min(range1.endRow,range2.endRow);return range2.startColumn>=range1.startColumn&&ranges.push({startRow:topBoundary,startColumn:range1.startColumn,endRow:bottomBoundary,endColumn:range2.startColumn-1}),range2.endColumn<=range1.endColumn&&ranges.push({startRow:topBoundary,startColumn:range2.endColumn+1,endRow:bottomBoundary,endColumn:range1.endColumn}),ranges.filter(range=>range.startRow<=range.endRow&&range.startColumn<=range.endColumn)}static mergeRanges(ranges){return mergeRanges(ranges)}static splitIntoGrid(ranges){return splitIntoGrid(ranges)}static subtractMulti(ranges1,ranges2){if(!ranges2.length)return ranges1;let res=ranges1;return ranges2.forEach(range=>{res=multiSubtractSingleRange(res,range)}),res}static hasIntersectionBetweenTwoRect(rect1,rect2){return!(rect1.left>rect2.right||rect1.right<rect2.left||rect1.top>rect2.bottom||rect1.bottom<rect2.top)}static getIntersectionBetweenTwoRect(rect1,rect2){const left=Math.max(rect1.left,rect2.left),right=Math.min(rect1.right,rect2.right),top=Math.max(rect1.top,rect2.top),bottom=Math.min(rect1.bottom,rect2.bottom);return right<=left||bottom<=top?null:{left,right,top,bottom,width:right-left,height:bottom-top}}static sort(ranges){return ranges.sort((a,b)=>a.startRow-b.startRow||a.startColumn-b.startColumn)}};__name(_Rectangle,"Rectangle"),__publicField(_Rectangle,"getRelativeRange",__name((range,originRange)=>({startRow:range.startRow-originRange.startRow,endRow:range.endRow-range.startRow,startColumn:range.startColumn-originRange.startColumn,endColumn:range.endColumn-range.startColumn}),"getRelativeRange")),__publicField(_Rectangle,"getPositionRange",__name((relativeRange,originRange,absoluteRange)=>({...absoluteRange||{},startRow:absoluteRange&&[AbsoluteRefType.ROW,AbsoluteRefType.ALL].includes(absoluteRange.startAbsoluteRefType||0)?absoluteRange.startRow:relativeRange.startRow+originRange.startRow,endRow:absoluteRange&&[AbsoluteRefType.ROW,AbsoluteRefType.ALL].includes(absoluteRange.endAbsoluteRefType||0)?absoluteRange.endRow:relativeRange.endRow+relativeRange.startRow+originRange.startRow,startColumn:absoluteRange&&[AbsoluteRefType.COLUMN,AbsoluteRefType.ALL].includes(absoluteRange.startAbsoluteRefType||0)?absoluteRange.startColumn:relativeRange.startColumn+originRange.startColumn,endColumn:absoluteRange&&[AbsoluteRefType.COLUMN,AbsoluteRefType.ALL].includes(absoluteRange.endAbsoluteRefType||0)?absoluteRange.endColumn:relativeRange.endColumn+relativeRange.startColumn+originRange.startColumn}),"getPositionRange")),__publicField(_Rectangle,"moveHorizontal",__name((range,step=0,length=0)=>({...range,startColumn:range.startColumn+step,endColumn:range.endColumn+step+length}),"moveHorizontal")),__publicField(_Rectangle,"moveVertical",__name((range,step=0,length=0)=>({...range,startRow:range.startRow+step,endRow:range.endRow+step+length}),"moveVertical")),__publicField(_Rectangle,"moveOffset",__name((range,offsetX,offsetY)=>({...range,startRow:range.startRow+offsetY,endRow:range.endRow+offsetY,startColumn:range.startColumn+offsetX,endColumn:range.endColumn+offsetX}),"moveOffset"));let Rectangle=_Rectangle;function maximalRectangle(matrix,match){if(matrix.length===0||matrix[0].length===0)return null;const heights=new Array(matrix[0].length).fill(0);let maxArea=0,maxRect=null;for(let row=0;row<matrix.length;row++){for(let col=0;col<matrix[0].length;col++)heights[col]=match(matrix[row][col])?heights[col]+1:0;const areaWithRect=largestRectangleArea(heights);areaWithRect.area>maxArea&&(maxArea=areaWithRect.area,maxRect={startColumn:areaWithRect.start,startRow:row-areaWithRect.height+1,endColumn:areaWithRect.end,endRow:row})}return maxRect}__name(maximalRectangle,"maximalRectangle");function largestRectangleArea(heights){const stack=[];let maxArea=0,maxRect={area:0,height:0,start:0,end:0},index2=0;for(;index2<heights.length;)if(stack.length===0||heights[index2]>=heights[stack[stack.length-1]])stack.push(index2++);else{const height=heights[stack.pop()],width=stack.length===0?index2:index2-stack[stack.length-1]-1;height*width>maxArea&&(maxArea=height*width,maxRect={area:maxArea,height,start:stack.length===0?0:stack[stack.length-1]+1,end:index2-1})}for(;stack.length>0;){const height=heights[stack.pop()],width=stack.length===0?index2:index2-stack[stack.length-1]-1;height*width>maxArea&&(maxArea=height*width,maxRect={area:maxArea,height,start:stack.length===0?0:stack[stack.length-1]+1,end:index2-1})}return maxRect}__name(largestRectangleArea,"largestRectangleArea");function resetMatrix(matrix,range){Range.foreach(range,(row,col)=>{matrix[row][col]=void 0})}__name(resetMatrix,"resetMatrix");function queryObjectMatrix(matrix,match){const arrayMatrix=matrix.toFullArray(),results=[];for(;;){const rectangle=maximalRectangle(arrayMatrix,match);if(!rectangle)break;results.push(rectangle),resetMatrix(arrayMatrix,rectangle)}return results}__name(queryObjectMatrix,"queryObjectMatrix");const _RefAlias=class _RefAlias{constructor(values,keys){__publicField(this,"_values",[]);__publicField(this,"_keys",[]);__publicField(this,"_keyMaps",new Map);this._values=values,this._keys=keys,values.forEach(item=>{this._initKeyMap(item)})}_initKeyMap(item){this._keys.forEach(key=>{const value=item[key],keyMap=this._keyMaps.get(key)||new Map;keyMap.set(value,item),this._keyMaps.set(key,keyMap)})}getValue(key,keyGroup){const keys=keyGroup||this._keys;for(let index2=0;index2<keys.length;index2++){const keyMap=this._keyMaps.get(keys[index2]);if(keyMap!=null&&keyMap.has(key))return keyMap.get(key)}return null}hasValue(key){for(let index2=0;index2<this._keys.length;index2++){const keyMap=this._keyMaps.get(this._keys[index2]);if(keyMap!=null&&keyMap.has(key))return!0}return!1}addValue(item){this._values.push(item),this._initKeyMap(item)}setValue(key,attr,value){const item=this.getValue(key);item&&Object.keys(item).includes(attr)&&(item[attr]=value)}deleteValue(key,keyGroup){const value=this.getValue(key,keyGroup);if(value){this._keys.forEach(keyItem=>{const keyMap=this._keyMaps.get(keyItem),_key=value[keyItem];keyMap==null||keyMap.delete(_key)});const index2=this._values.findIndex(item=>item===value);this._values.splice(index2,1)}}getValues(){return this._values}getKeyMap(key){var _a17;return[...((_a17=this._keyMaps.get(key))==null?void 0:_a17.keys())||[]]}clear(){this._values=[],this._keys=[],this._keyMaps.clear()}};__name(_RefAlias,"RefAlias");let RefAlias=_RefAlias;function createRowColIter(rowStart,rowEnd,colStart,colEnd){return{forEach(cb){for(let r=rowStart;r<=rowEnd;r++)for(let c=colStart;c<=colEnd;c++)cb(r,c)}}}__name(createRowColIter,"createRowColIter");function ABCToNumber(a){if(a==null||a.length===0)return Number.NaN;const str=a.toLowerCase().split(""),al=str.length,getCharNumber=__name(charX=>charX.charCodeAt(0)-96,"getCharNumber");let numOut=0,charnum=0;for(let i=0;i<al;i++)charnum=getCharNumber(str[i]),numOut+=charnum*26**(al-i-1);return numOut===0?Number.NaN:numOut-1}__name(ABCToNumber,"ABCToNumber");const orderA=65,orderZ=90,order_a=97;function numberToABC(n){const len=orderZ-orderA+1;let s="";for(;n>=0;)s=String.fromCharCode(n%len+orderA)+s,n=Math.floor(n/len)-1;return s}__name(numberToABC,"numberToABC");function repeatStringNumTimes(string,times){let repeatedString="";for(;times>0;)repeatedString+=string,times--;return repeatedString}__name(repeatStringNumTimes,"repeatStringNumTimes");function numberToListABC(n,uppercase=!1){const len=orderZ-orderA+1;let order=order_a;uppercase&&(order=orderA);const abc=String.fromCharCode(n%len+order),times=Math.floor(n/len)+1;return repeatStringNumTimes(abc,times)}__name(numberToListABC,"numberToListABC");function sortRules(oa,ob){return oa.zIndex>ob.zIndex?1:oa.zIndex===ob.zIndex?0:-1}__name(sortRules,"sortRules");function sortRulesByDesc(oa,ob){return oa.zIndex>ob.zIndex?-1:oa.zIndex===ob.zIndex?0:1}__name(sortRulesByDesc,"sortRulesByDesc");function sortRulesFactory(key="index",ruler=1){return(oa,ob)=>oa[key]>ob[key]?ruler:oa[key]===ob[key]?0:-ruler}__name(sortRulesFactory,"sortRulesFactory");var DocStyleType=(DocStyleType2=>(DocStyleType2[DocStyleType2.character=0]="character",DocStyleType2[DocStyleType2.paragraph=1]="paragraph",DocStyleType2[DocStyleType2.table=2]="table",DocStyleType2[DocStyleType2.numbering=3]="numbering",DocStyleType2))(DocStyleType||{}),FollowNumberWithType=(FollowNumberWithType2=>(FollowNumberWithType2[FollowNumberWithType2.TAB=0]="TAB",FollowNumberWithType2[FollowNumberWithType2.SPACE=1]="SPACE",FollowNumberWithType2[FollowNumberWithType2.NOTHING=2]="NOTHING",FollowNumberWithType2))(FollowNumberWithType||{}),ListGlyphType=(ListGlyphType2=>(ListGlyphType2[ListGlyphType2.BULLET=0]="BULLET",ListGlyphType2[ListGlyphType2.NONE=1]="NONE",ListGlyphType2[ListGlyphType2.DECIMAL=2]="DECIMAL",ListGlyphType2[ListGlyphType2.DECIMAL_ZERO=3]="DECIMAL_ZERO",ListGlyphType2[ListGlyphType2.UPPER_LETTER=4]="UPPER_LETTER",ListGlyphType2[ListGlyphType2.LOWER_LETTER=5]="LOWER_LETTER",ListGlyphType2[ListGlyphType2.UPPER_ROMAN=6]="UPPER_ROMAN",ListGlyphType2[ListGlyphType2.LOWER_ROMAN=7]="LOWER_ROMAN",ListGlyphType2[ListGlyphType2.ORDINAL=8]="ORDINAL",ListGlyphType2[ListGlyphType2.CARDINAL_TEXT=9]="CARDINAL_TEXT",ListGlyphType2[ListGlyphType2.ORDINAL_TEXT=10]="ORDINAL_TEXT",ListGlyphType2[ListGlyphType2.HEX=11]="HEX",ListGlyphType2[ListGlyphType2.CHICAGO=12]="CHICAGO",ListGlyphType2[ListGlyphType2.IDEOGRAPH_DIGITAL=13]="IDEOGRAPH_DIGITAL",ListGlyphType2[ListGlyphType2.JAPANESE_COUNTING=14]="JAPANESE_COUNTING",ListGlyphType2[ListGlyphType2.AIUEO=15]="AIUEO",ListGlyphType2[ListGlyphType2.IROHA=16]="IROHA",ListGlyphType2[ListGlyphType2.DECIMAL_FULL_WIDTH=17]="DECIMAL_FULL_WIDTH",ListGlyphType2[ListGlyphType2.DECIMAL_HALF_WIDTH=18]="DECIMAL_HALF_WIDTH",ListGlyphType2[ListGlyphType2.JAPANESE_LEGAL=19]="JAPANESE_LEGAL",ListGlyphType2[ListGlyphType2.JAPANESE_DIGITAL_TEN_THOUSAND=20]="JAPANESE_DIGITAL_TEN_THOUSAND",ListGlyphType2[ListGlyphType2.DECIMAL_ENCLOSED_CIRCLE=21]="DECIMAL_ENCLOSED_CIRCLE",ListGlyphType2[ListGlyphType2.DECIMAL_FULL_WIDTH2=22]="DECIMAL_FULL_WIDTH2",ListGlyphType2[ListGlyphType2.AIUEO_FULL_WIDTH=23]="AIUEO_FULL_WIDTH",ListGlyphType2[ListGlyphType2.IROHA_FULL_WIDTH=24]="IROHA_FULL_WIDTH",ListGlyphType2[ListGlyphType2.GANADA=25]="GANADA",ListGlyphType2[ListGlyphType2.CHOSUNG=26]="CHOSUNG",ListGlyphType2[ListGlyphType2.DECIMAL_ENCLOSED_FULLSTOP=27]="DECIMAL_ENCLOSED_FULLSTOP",ListGlyphType2[ListGlyphType2.DECIMAL_ENCLOSED_PAREN=28]="DECIMAL_ENCLOSED_PAREN",ListGlyphType2[ListGlyphType2.DECIMAL_ENCLOSED_CIRCLE_CHINESE=29]="DECIMAL_ENCLOSED_CIRCLE_CHINESE",ListGlyphType2[ListGlyphType2.IDEOGRAPH_ENCLOSED_CIRCLE=30]="IDEOGRAPH_ENCLOSED_CIRCLE",ListGlyphType2[ListGlyphType2.IDEOGRAPH_TRADITIONAL=31]="IDEOGRAPH_TRADITIONAL",ListGlyphType2[ListGlyphType2.IDEOGRAPH_ZODIAC=32]="IDEOGRAPH_ZODIAC",ListGlyphType2[ListGlyphType2.IDEOGRAPH_ZODIAC_TRADITIONAL=33]="IDEOGRAPH_ZODIAC_TRADITIONAL",ListGlyphType2[ListGlyphType2.TAIWANESE_COUNTING=34]="TAIWANESE_COUNTING",ListGlyphType2[ListGlyphType2.IDEOGRAPH_LEGAL_TRADITIONAL=35]="IDEOGRAPH_LEGAL_TRADITIONAL",ListGlyphType2[ListGlyphType2.TAIWANESE_COUNTING_THOUSAND=36]="TAIWANESE_COUNTING_THOUSAND",ListGlyphType2[ListGlyphType2.TAIWANESE_DIGITAL=37]="TAIWANESE_DIGITAL",ListGlyphType2[ListGlyphType2.CHINESE_COUNTING=38]="CHINESE_COUNTING",ListGlyphType2[ListGlyphType2.CHINESE_LEGAL_SIMPLIFIED=39]="CHINESE_LEGAL_SIMPLIFIED",ListGlyphType2[ListGlyphType2.CHINESE_COUNTING_THOUSAND=40]="CHINESE_COUNTING_THOUSAND",ListGlyphType2[ListGlyphType2.KOREAN_DIGITAL=41]="KOREAN_DIGITAL",ListGlyphType2[ListGlyphType2.KOREAN_COUNTING=42]="KOREAN_COUNTING",ListGlyphType2[ListGlyphType2.KOREAN_LEGAL=43]="KOREAN_LEGAL",ListGlyphType2[ListGlyphType2.KOREAN_DIGITAL2=44]="KOREAN_DIGITAL2",ListGlyphType2[ListGlyphType2.VIETNAMESE_COUNTING=45]="VIETNAMESE_COUNTING",ListGlyphType2[ListGlyphType2.RUSSIAN_LOWER=46]="RUSSIAN_LOWER",ListGlyphType2[ListGlyphType2.RUSSIAN_UPPER=47]="RUSSIAN_UPPER",ListGlyphType2[ListGlyphType2.NUMBER_IN_DASH=48]="NUMBER_IN_DASH",ListGlyphType2[ListGlyphType2.HEBREW1=49]="HEBREW1",ListGlyphType2[ListGlyphType2.HEBREW2=50]="HEBREW2",ListGlyphType2[ListGlyphType2.ARABIC_ALPHA=51]="ARABIC_ALPHA",ListGlyphType2[ListGlyphType2.ARABIC_ABJAD=52]="ARABIC_ABJAD",ListGlyphType2[ListGlyphType2.HINDI_VOWELS=53]="HINDI_VOWELS",ListGlyphType2[ListGlyphType2.HINDI_CONSONANTS=54]="HINDI_CONSONANTS",ListGlyphType2[ListGlyphType2.HINDI_NUMBERS=55]="HINDI_NUMBERS",ListGlyphType2[ListGlyphType2.HINDI_COUNTING=56]="HINDI_COUNTING",ListGlyphType2[ListGlyphType2.THAI_LETTERS=57]="THAI_LETTERS",ListGlyphType2[ListGlyphType2.THAI_NUMBERS=58]="THAI_NUMBERS",ListGlyphType2[ListGlyphType2.THAI_COUNTING=59]="THAI_COUNTING",ListGlyphType2[ListGlyphType2.CUSTOM=60]="CUSTOM",ListGlyphType2))(ListGlyphType||{}),BulletAlignment=(BulletAlignment2=>(BulletAlignment2[BulletAlignment2.BULLET_ALIGNMENT_UNSPECIFIED=0]="BULLET_ALIGNMENT_UNSPECIFIED",BulletAlignment2[BulletAlignment2.START=1]="START",BulletAlignment2[BulletAlignment2.CENTER=2]="CENTER",BulletAlignment2[BulletAlignment2.END=3]="END",BulletAlignment2[BulletAlignment2.BOTH=4]="BOTH",BulletAlignment2))(BulletAlignment||{}),CustomRangeType=(CustomRangeType2=>(CustomRangeType2[CustomRangeType2.HYPERLINK=0]="HYPERLINK",CustomRangeType2[CustomRangeType2.FIELD=1]="FIELD",CustomRangeType2[CustomRangeType2.SDT=2]="SDT",CustomRangeType2[CustomRangeType2.BOOKMARK=3]="BOOKMARK",CustomRangeType2[CustomRangeType2.COMMENT=4]="COMMENT",CustomRangeType2[CustomRangeType2.CUSTOM=5]="CUSTOM",CustomRangeType2[CustomRangeType2.MENTION=6]="MENTION",CustomRangeType2[CustomRangeType2.UNI_FORMULA=7]="UNI_FORMULA",CustomRangeType2[CustomRangeType2.DELTED=9999]="DELTED",CustomRangeType2))(CustomRangeType||{}),CustomDecorationType=(CustomDecorationType2=>(CustomDecorationType2[CustomDecorationType2.COMMENT=0]="COMMENT",CustomDecorationType2[CustomDecorationType2.DELETED=9999]="DELETED",CustomDecorationType2))(CustomDecorationType||{}),BlockType=(BlockType2=>(BlockType2[BlockType2.DRAWING=0]="DRAWING",BlockType2[BlockType2.CUSTOM=1]="CUSTOM",BlockType2))(BlockType||{}),DocumentFlavor=(DocumentFlavor2=>(DocumentFlavor2[DocumentFlavor2.UNSPECIFIED=0]="UNSPECIFIED",DocumentFlavor2[DocumentFlavor2.TRADITIONAL=1]="TRADITIONAL",DocumentFlavor2[DocumentFlavor2.MODERN=2]="MODERN",DocumentFlavor2))(DocumentFlavor||{}),GridType=(GridType2=>(GridType2[GridType2.DEFAULT=0]="DEFAULT",GridType2[GridType2.LINES=1]="LINES",GridType2[GridType2.LINES_AND_CHARS=2]="LINES_AND_CHARS",GridType2[GridType2.SNAP_TO_CHARS=3]="SNAP_TO_CHARS",GridType2))(GridType||{}),SectionType=(SectionType2=>(SectionType2[SectionType2.SECTION_TYPE_UNSPECIFIED=0]="SECTION_TYPE_UNSPECIFIED",SectionType2[SectionType2.CONTINUOUS=1]="CONTINUOUS",SectionType2[SectionType2.NEXT_PAGE=2]="NEXT_PAGE",SectionType2[SectionType2.EVEN_PAGE=3]="EVEN_PAGE",SectionType2[SectionType2.ODD_PAGE=4]="ODD_PAGE",SectionType2))(SectionType||{}),ColumnSeparatorType=(ColumnSeparatorType2=>(ColumnSeparatorType2[ColumnSeparatorType2.COLUMN_SEPARATOR_STYLE_UNSPECIFIED=0]="COLUMN_SEPARATOR_STYLE_UNSPECIFIED",ColumnSeparatorType2[ColumnSeparatorType2.NONE=1]="NONE",ColumnSeparatorType2[ColumnSeparatorType2.BETWEEN_EACH_COLUMN=2]="BETWEEN_EACH_COLUMN",ColumnSeparatorType2))(ColumnSeparatorType||{}),TextDirectionType=(TextDirectionType2=>(TextDirectionType2[TextDirectionType2.NORMAL=0]="NORMAL",TextDirectionType2[TextDirectionType2.TBRL=1]="TBRL",TextDirectionType2[TextDirectionType2.LRTBV=2]="LRTBV",TextDirectionType2))(TextDirectionType||{}),ParagraphElementType=(ParagraphElementType2=>(ParagraphElementType2[ParagraphElementType2.TEXT_RUN=0]="TEXT_RUN",ParagraphElementType2[ParagraphElementType2.AUTO_TEXT=1]="AUTO_TEXT",ParagraphElementType2[ParagraphElementType2.PAGE_BREAK=2]="PAGE_BREAK",ParagraphElementType2[ParagraphElementType2.COLUMN_BREAK=3]="COLUMN_BREAK",ParagraphElementType2[ParagraphElementType2.FOOT_NOTE_REFERENCE=4]="FOOT_NOTE_REFERENCE",ParagraphElementType2[ParagraphElementType2.HORIZONTAL_RULE=5]="HORIZONTAL_RULE",ParagraphElementType2[ParagraphElementType2.EQUATION=6]="EQUATION",ParagraphElementType2[ParagraphElementType2.DRAWING=7]="DRAWING",ParagraphElementType2[ParagraphElementType2.PERSON=8]="PERSON",ParagraphElementType2[ParagraphElementType2.RICH_LINK=9]="RICH_LINK",ParagraphElementType2))(ParagraphElementType||{}),WrapTextType=(WrapTextType2=>(WrapTextType2[WrapTextType2.BOTH_SIDES=0]="BOTH_SIDES",WrapTextType2[WrapTextType2.LEFT=1]="LEFT",WrapTextType2[WrapTextType2.RIGHT=2]="RIGHT",WrapTextType2[WrapTextType2.LARGEST=3]="LARGEST",WrapTextType2))(WrapTextType||{}),PositionedObjectLayoutType=(PositionedObjectLayoutType2=>(PositionedObjectLayoutType2[PositionedObjectLayoutType2.INLINE=0]="INLINE",PositionedObjectLayoutType2[PositionedObjectLayoutType2.WRAP_NONE=1]="WRAP_NONE",PositionedObjectLayoutType2[PositionedObjectLayoutType2.WRAP_POLYGON=2]="WRAP_POLYGON",PositionedObjectLayoutType2[PositionedObjectLayoutType2.WRAP_SQUARE=3]="WRAP_SQUARE",PositionedObjectLayoutType2[PositionedObjectLayoutType2.WRAP_THROUGH=4]="WRAP_THROUGH",PositionedObjectLayoutType2[PositionedObjectLayoutType2.WRAP_TIGHT=5]="WRAP_TIGHT",PositionedObjectLayoutType2[PositionedObjectLayoutType2.WRAP_TOP_AND_BOTTOM=6]="WRAP_TOP_AND_BOTTOM",PositionedObjectLayoutType2))(PositionedObjectLayoutType||{}),NamedStyleType=(NamedStyleType2=>(NamedStyleType2[NamedStyleType2.NAMED_STYLE_TYPE_UNSPECIFIED=0]="NAMED_STYLE_TYPE_UNSPECIFIED",NamedStyleType2[NamedStyleType2.NORMAL_TEXT=1]="NORMAL_TEXT",NamedStyleType2[NamedStyleType2.TITLE=2]="TITLE",NamedStyleType2[NamedStyleType2.SUBTITLE=3]="SUBTITLE",NamedStyleType2[NamedStyleType2.HEADING_1=4]="HEADING_1",NamedStyleType2[NamedStyleType2.HEADING_2=5]="HEADING_2",NamedStyleType2[NamedStyleType2.HEADING_3=6]="HEADING_3",NamedStyleType2[NamedStyleType2.HEADING_4=7]="HEADING_4",NamedStyleType2[NamedStyleType2.HEADING_5=8]="HEADING_5",NamedStyleType2[NamedStyleType2.HEADING_6=9]="HEADING_6",NamedStyleType2))(NamedStyleType||{}),SpacingRule=(SpacingRule2=>(SpacingRule2[SpacingRule2.AUTO=0]="AUTO",SpacingRule2[SpacingRule2.AT_LEAST=1]="AT_LEAST",SpacingRule2[SpacingRule2.EXACT=2]="EXACT",SpacingRule2))(SpacingRule||{}),DashStyleType=(DashStyleType2=>(DashStyleType2[DashStyleType2.DASH_STYLE_UNSPECIFIED=0]="DASH_STYLE_UNSPECIFIED",DashStyleType2[DashStyleType2.SOLID=1]="SOLID",DashStyleType2[DashStyleType2.DOT=2]="DOT",DashStyleType2[DashStyleType2.DASH=3]="DASH",DashStyleType2))(DashStyleType||{}),TabStopAlignment=(TabStopAlignment2=>(TabStopAlignment2[TabStopAlignment2.TAB_STOP_ALIGNMENT_UNSPECIFIED=0]="TAB_STOP_ALIGNMENT_UNSPECIFIED",TabStopAlignment2[TabStopAlignment2.START=1]="START",TabStopAlignment2[TabStopAlignment2.CENTER=2]="CENTER",TabStopAlignment2[TabStopAlignment2.END=3]="END",TabStopAlignment2))(TabStopAlignment||{}),TableSizeType=(TableSizeType2=>(TableSizeType2[TableSizeType2.UNSPECIFIED=0]="UNSPECIFIED",TableSizeType2[TableSizeType2.SPECIFIED=1]="SPECIFIED",TableSizeType2))(TableSizeType||{}),TableAlignmentType=(TableAlignmentType2=>(TableAlignmentType2[TableAlignmentType2.START=0]="START",TableAlignmentType2[TableAlignmentType2.CENTER=1]="CENTER",TableAlignmentType2[TableAlignmentType2.END=2]="END",TableAlignmentType2))(TableAlignmentType||{}),TableLayoutType=(TableLayoutType2=>(TableLayoutType2[TableLayoutType2.AUTO_FIT=0]="AUTO_FIT",TableLayoutType2[TableLayoutType2.FIXED=1]="FIXED",TableLayoutType2))(TableLayoutType||{}),TableTextWrapType=(TableTextWrapType2=>(TableTextWrapType2[TableTextWrapType2.NONE=0]="NONE",TableTextWrapType2[TableTextWrapType2.WRAP=1]="WRAP",TableTextWrapType2))(TableTextWrapType||{}),TableRowHeightRule=(TableRowHeightRule2=>(TableRowHeightRule2[TableRowHeightRule2.AUTO=0]="AUTO",TableRowHeightRule2[TableRowHeightRule2.AT_LEAST=1]="AT_LEAST",TableRowHeightRule2[TableRowHeightRule2.EXACT=2]="EXACT",TableRowHeightRule2))(TableRowHeightRule||{}),VerticalAlignmentType=(VerticalAlignmentType2=>(VerticalAlignmentType2[VerticalAlignmentType2.CONTENT_ALIGNMENT_UNSPECIFIED=0]="CONTENT_ALIGNMENT_UNSPECIFIED",VerticalAlignmentType2[VerticalAlignmentType2.BOTH=1]="BOTH",VerticalAlignmentType2[VerticalAlignmentType2.TOP=2]="TOP",VerticalAlignmentType2[VerticalAlignmentType2.CENTER=3]="CENTER",VerticalAlignmentType2[VerticalAlignmentType2.BOTTOM=4]="BOTTOM",VerticalAlignmentType2))(VerticalAlignmentType||{}),FontStyleType=(FontStyleType2=>(FontStyleType2.NORMAL="normal",FontStyleType2.BOLD="bold",FontStyleType2.ITALIC="italic",FontStyleType2))(FontStyleType||{}),ObjectRelativeFromH=(ObjectRelativeFromH2=>(ObjectRelativeFromH2[ObjectRelativeFromH2.PAGE=0]="PAGE",ObjectRelativeFromH2[ObjectRelativeFromH2.COLUMN=1]="COLUMN",ObjectRelativeFromH2[ObjectRelativeFromH2.CHARACTER=2]="CHARACTER",ObjectRelativeFromH2[ObjectRelativeFromH2.MARGIN=3]="MARGIN",ObjectRelativeFromH2[ObjectRelativeFromH2.INSIDE_MARGIN=4]="INSIDE_MARGIN",ObjectRelativeFromH2[ObjectRelativeFromH2.OUTSIDE_MARGIN=5]="OUTSIDE_MARGIN",ObjectRelativeFromH2[ObjectRelativeFromH2.LEFT_MARGIN=6]="LEFT_MARGIN",ObjectRelativeFromH2[ObjectRelativeFromH2.RIGHT_MARGIN=7]="RIGHT_MARGIN",ObjectRelativeFromH2))(ObjectRelativeFromH||{}),ObjectRelativeFromV=(ObjectRelativeFromV2=>(ObjectRelativeFromV2[ObjectRelativeFromV2.PAGE=0]="PAGE",ObjectRelativeFromV2[ObjectRelativeFromV2.PARAGRAPH=1]="PARAGRAPH",ObjectRelativeFromV2[ObjectRelativeFromV2.LINE=2]="LINE",ObjectRelativeFromV2[ObjectRelativeFromV2.MARGIN=3]="MARGIN",ObjectRelativeFromV2[ObjectRelativeFromV2.TOP_MARGIN=4]="TOP_MARGIN",ObjectRelativeFromV2[ObjectRelativeFromV2.BOTTOM_MARGIN=5]="BOTTOM_MARGIN",ObjectRelativeFromV2[ObjectRelativeFromV2.INSIDE_MARGIN=6]="INSIDE_MARGIN",ObjectRelativeFromV2[ObjectRelativeFromV2.OUTSIDE_MARGIN=7]="OUTSIDE_MARGIN",ObjectRelativeFromV2))(ObjectRelativeFromV||{}),NumberUnitType=(NumberUnitType2=>(NumberUnitType2[NumberUnitType2.POINT=0]="POINT",NumberUnitType2[NumberUnitType2.LINE=1]="LINE",NumberUnitType2[NumberUnitType2.CHARACTER=2]="CHARACTER",NumberUnitType2[NumberUnitType2.PIXEL=3]="PIXEL",NumberUnitType2[NumberUnitType2.PERCENT=4]="PERCENT",NumberUnitType2))(NumberUnitType||{}),AlignTypeH=(AlignTypeH2=>(AlignTypeH2[AlignTypeH2.CENTER=0]="CENTER",AlignTypeH2[AlignTypeH2.INSIDE=1]="INSIDE",AlignTypeH2[AlignTypeH2.LEFT=2]="LEFT",AlignTypeH2[AlignTypeH2.OUTSIDE=3]="OUTSIDE",AlignTypeH2[AlignTypeH2.RIGHT=4]="RIGHT",AlignTypeH2[AlignTypeH2.BOTH=5]="BOTH",AlignTypeH2[AlignTypeH2.DISTRIBUTE=6]="DISTRIBUTE",AlignTypeH2))(AlignTypeH||{}),AlignTypeV=(AlignTypeV2=>(AlignTypeV2[AlignTypeV2.BOTTOM=0]="BOTTOM",AlignTypeV2[AlignTypeV2.CENTER=1]="CENTER",AlignTypeV2[AlignTypeV2.INSIDE=2]="INSIDE",AlignTypeV2[AlignTypeV2.OUTSIDE=3]="OUTSIDE",AlignTypeV2[AlignTypeV2.TOP=4]="TOP",AlignTypeV2))(AlignTypeV||{}),characterSpacingControlType=(characterSpacingControlType2=>(characterSpacingControlType2[characterSpacingControlType2.compressPunctuation=0]="compressPunctuation",characterSpacingControlType2[characterSpacingControlType2.compressPunctuationAndJapaneseKana=1]="compressPunctuationAndJapaneseKana",characterSpacingControlType2[characterSpacingControlType2.doNotCompress=2]="doNotCompress",characterSpacingControlType2))(characterSpacingControlType||{}),PageOrientType=(PageOrientType2=>(PageOrientType2[PageOrientType2.PORTRAIT=0]="PORTRAIT",PageOrientType2[PageOrientType2.LANDSCAPE=1]="LANDSCAPE",PageOrientType2))(PageOrientType||{}),ArrangeTypeEnum=(ArrangeTypeEnum2=>(ArrangeTypeEnum2[ArrangeTypeEnum2.forward=0]="forward",ArrangeTypeEnum2[ArrangeTypeEnum2.backward=1]="backward",ArrangeTypeEnum2[ArrangeTypeEnum2.front=2]="front",ArrangeTypeEnum2[ArrangeTypeEnum2.back=3]="back",ArrangeTypeEnum2))(ArrangeTypeEnum||{}),DrawingTypeEnum=(DrawingTypeEnum2=>(DrawingTypeEnum2[DrawingTypeEnum2.UNRECOGNIZED=-1]="UNRECOGNIZED",DrawingTypeEnum2[DrawingTypeEnum2.DRAWING_IMAGE=0]="DRAWING_IMAGE",DrawingTypeEnum2[DrawingTypeEnum2.DRAWING_SHAPE=1]="DRAWING_SHAPE",DrawingTypeEnum2[DrawingTypeEnum2.DRAWING_CHART=2]="DRAWING_CHART",DrawingTypeEnum2[DrawingTypeEnum2.DRAWING_TABLE=3]="DRAWING_TABLE",DrawingTypeEnum2[DrawingTypeEnum2.DRAWING_SMART_ART=4]="DRAWING_SMART_ART",DrawingTypeEnum2[DrawingTypeEnum2.DRAWING_VIDEO=5]="DRAWING_VIDEO",DrawingTypeEnum2[DrawingTypeEnum2.DRAWING_GROUP=6]="DRAWING_GROUP",DrawingTypeEnum2[DrawingTypeEnum2.DRAWING_UNIT=7]="DRAWING_UNIT",DrawingTypeEnum2[DrawingTypeEnum2.DRAWING_DOM=8]="DRAWING_DOM",DrawingTypeEnum2))(DrawingTypeEnum||{}),PageType=(PageType2=>(PageType2[PageType2.SLIDE=0]="SLIDE",PageType2[PageType2.MASTER=1]="MASTER",PageType2[PageType2.LAYOUT=2]="LAYOUT",PageType2[PageType2.HANDOUT_MASTER=3]="HANDOUT_MASTER",PageType2[PageType2.NOTES_MASTER=4]="NOTES_MASTER",PageType2))(PageType||{}),PageElementType=(PageElementType2=>(PageElementType2[PageElementType2.SHAPE=0]="SHAPE",PageElementType2[PageElementType2.IMAGE=1]="IMAGE",PageElementType2[PageElementType2.TEXT=2]="TEXT",PageElementType2[PageElementType2.SPREADSHEET=3]="SPREADSHEET",PageElementType2[PageElementType2.DOCUMENT=4]="DOCUMENT",PageElementType2[PageElementType2.SLIDE=5]="SLIDE",PageElementType2))(PageElementType||{}),RelativeSlideLink=(RelativeSlideLink2=>(RelativeSlideLink2[RelativeSlideLink2.RELATIVE_SLIDE_LINK_UNSPECIFIED=0]="RELATIVE_SLIDE_LINK_UNSPECIFIED",RelativeSlideLink2[RelativeSlideLink2.NEXT_SLIDE=1]="NEXT_SLIDE",RelativeSlideLink2[RelativeSlideLink2.PREVIOUS_SLIDE=2]="PREVIOUS_SLIDE",RelativeSlideLink2[RelativeSlideLink2.FIRST_SLIDE=3]="FIRST_SLIDE",RelativeSlideLink2[RelativeSlideLink2.LAST_SLIDE=4]="LAST_SLIDE",RelativeSlideLink2))(RelativeSlideLink||{}),_=(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))(_||{}),S=(E=>(E[E.Reader=0]="Reader",E[E.Editor=1]="Editor",E[E.Owner=2]="Owner",E[E.UNRECOGNIZED=-1]="UNRECOGNIZED",E))(S||{}),M=(E=>(E[E.SomeCollaborator=0]="SomeCollaborator",E[E.AllCollaborator=1]="AllCollaborator",E[E.OneSelf=2]="OneSelf",E[E.UNRECOGNIZED=-1]="UNRECOGNIZED",E))(M||{});const _UnitModel=class _UnitModel extends Disposable{};__name(_UnitModel,"UnitModel");let UnitModel=_UnitModel;function getEmptySnapshot$1(unitID=Tools.generateRandomId(6),locale=LocaleType.EN_US,title=""){return{id:unitID,locale,title,tableSource:{},drawings:{},drawingsOrder:[],headers:{},footers:{},body:{dataStream:`\r
8
+ `,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:DocumentFlavor.TRADITIONAL,marginTop:50,marginBottom:50,marginRight:50,marginLeft:50,renderConfig:{zeroWidthParagraphBreak:BooleanNumber.FALSE,vertexAngle:0,centerAngle:0,background:{rgb:"#ccc"}},autoHyphenation:BooleanNumber.TRUE,doNotHyphenateCaps:BooleanNumber.FALSE,consecutiveHyphenLimit:2,defaultHeaderId:"",defaultFooterId:"",evenPageHeaderId:"",evenPageFooterId:"",firstPageHeaderId:"",firstPageFooterId:"",evenAndOddHeaders:BooleanNumber.FALSE,useFirstPageHeaderFooter:BooleanNumber.FALSE,marginHeader:30,marginFooter:30},settings:{}}}__name(getEmptySnapshot$1,"getEmptySnapshot$1");var dist$1={},json1_release={},deepEqual={},hasRequiredDeepEqual;function requireDeepEqual(){if(hasRequiredDeepEqual)return deepEqual;hasRequiredDeepEqual=1,Object.defineProperty(deepEqual,"__esModule",{value:!0});function eqObj(a,b){if(Array.isArray(b))return!1;for(let k in a)if(!deepEqual$1(a[k],b[k]))return!1;for(let k in b)if(a[k]===void 0)return!1;return!0}__name(eqObj,"eqObj");function eqArr(a,b){if(!Array.isArray(b)||a.length!==b.length)return!1;for(let i=0;i<a.length;i++)if(!deepEqual$1(a[i],b[i]))return!1;return!0}__name(eqArr,"eqArr");function deepEqual$1(a,b){return a===b?!0:a===null||b===null||typeof a!="object"||typeof b!="object"?!1:Array.isArray(a)?eqArr(a,b):eqObj(a,b)}return __name(deepEqual$1,"deepEqual$1"),deepEqual.default=deepEqual$1,deepEqual}__name(requireDeepEqual,"requireDeepEqual");var deepClone={},hasRequiredDeepClone;function requireDeepClone(){if(hasRequiredDeepClone)return deepClone;hasRequiredDeepClone=1,Object.defineProperty(deepClone,"__esModule",{value:!0});function deepClone$1(old){if(old===null)return null;if(Array.isArray(old))return old.map(deepClone$1);if(typeof old=="object"){const o={};for(let k in old)o[k]=deepClone$1(old[k]);return o}else return old}return __name(deepClone$1,"deepClone$1"),deepClone.default=deepClone$1,deepClone}__name(requireDeepClone,"requireDeepClone");var cursor={},hasRequiredCursor;function requireCursor(){return hasRequiredCursor||(hasRequiredCursor=1,function(exports2){Object.defineProperty(exports2,"__esModule",{value:!0}),exports2.eachChildOf=exports2.advancer=exports2.readCursor=exports2.writeCursor=exports2.WriteCursor=exports2.ReadCursor=exports2.isValidPathItem=void 0;function assert(pred,msg){if(!pred)throw new Error(msg)}__name(assert,"assert");const isObject2=__name(o=>o!=null&&typeof o=="object"&&!Array.isArray(o),"isObject"),isGreaterKey=__name((a,b)=>typeof a==typeof b?a>b:typeof a=="string"&&typeof b=="number","isGreaterKey");function copyAll(c,w){for(let _k in c){const k=_k;w.write(k,c[k])}}__name(copyAll,"copyAll"),exports2.isValidPathItem=k=>typeof k=="number"||typeof k=="string"&&k!=="__proto__";const _Cursor=class _Cursor{constructor(op=null){this.parents=[],this.indexes=[],this.lcIdx=-1,this.idx=-1,this.container=op}ascend(){assert(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):(assert(this.idx>0),this.idx--,isObject2(this.container[this.idx])&&this.idx--)}getPath(){const path=[];let c=this.container,p=this.parents.length-1,i=this.idx;for(;i>=0;)path.unshift(c[i]),i===0?(i=this.indexes[p*2],c=this.parents[p--]):i-=isObject2(c[i-1])?2:1;return path}};__name(_Cursor,"Cursor");let Cursor=_Cursor;const _ReadCursor=class _ReadCursor extends Cursor{get(){return this.container?this.container.slice(this.idx+1):null}getKey(){return assert(this.container!=null,"Invalid call to getKey before cursor descended"),this.container[this.idx]}getComponent(){let c;return this.container&&this.container.length>this.idx+1&&isObject2(c=this.container[this.idx+1])?c:null}descendFirst(){let i=this.idx+1;if(!this.container||i>=this.container.length||isObject2(this.container[i])&&i+1>=this.container.length)return!1;isObject2(this.container[i])&&i++;const firstChild=this.container[i];return Array.isArray(firstChild)?(this.indexes.push(this.idx),this.parents.push(this.container),this.indexes.push(i),this.idx=0,this.container=firstChild):this.idx=i,!0}nextSibling(){if(assert(this.parents.length===this.indexes.length/2),this.idx>0||this.parents.length===0)return!1;const i=this.indexes[this.indexes.length-1]+1,c=this.parents[this.parents.length-1];return i>=c.length?!1:(assert(!isNaN(i)),this.indexes[this.indexes.length-1]=i,this.container=c[i],!0)}_init(_container,_idx,_parents,_indexes){this.container=_container,this.idx=_idx,this.parents=_parents.slice(),this.indexes=_indexes.slice()}clone(){const c=new _ReadCursor;return c._init(this.container,this.idx,this.parents,this.indexes),c}*[Symbol.iterator](){if(this.descendFirst()){do yield this.getKey();while(this.nextSibling());this.ascend()}}traverse(w,fn){const c=this.getComponent();c&&fn(c,w);for(const key of this)w&&w.descend(key),this.traverse(w,fn),w&&w.ascend()}eachPick(w,fn){this.traverse(w,(c,w2)=>{c.p!=null&&fn(c.p,w2)})}eachDrop(w,fn){this.traverse(w,(c,w2)=>{c.d!=null&&fn(c.d,w2)})}};__name(_ReadCursor,"ReadCursor");let ReadCursor=_ReadCursor;exports2.ReadCursor=ReadCursor;const _WriteCursor=class _WriteCursor extends Cursor{constructor(op=null){super(op),this.pendingDescent=[],this._op=op}flushDescent(){assert(this.parents.length===this.indexes.length/2),this.container===null&&(this._op=this.container=[]);for(let j=0;j<this.pendingDescent.length;j++){const k=this.pendingDescent[j];let i=this.idx+1;if(i<this.container.length&&isObject2(this.container[i])&&i++,assert(i===this.container.length||!isObject2(this.container[i])),i===this.container.length)this.container.push(k),this.idx=i;else if(this.container[i]===k)this.idx=i;else{if(!Array.isArray(this.container[i])){const oldChild=this.container.splice(i,this.container.length-i);this.container.push(oldChild),this.lcIdx>-1&&(this.lcIdx=i)}for(this.indexes.push(this.idx),this.parents.push(this.container),this.lcIdx!==-1&&(assert(isGreaterKey(k,this.container[this.lcIdx][0])),i=this.lcIdx+1,this.lcIdx=-1);i<this.container.length&&isGreaterKey(k,this.container[i][0]);)i++;if(this.indexes.push(i),this.idx=0,i<this.container.length&&this.container[i][0]===k)this.container=this.container[i];else{const child=[k];this.container.splice(i,0,child),this.container=child}}}this.pendingDescent.length=0}reset(){this.lcIdx=-1}getComponent(){this.flushDescent();const i=this.idx+1;if(i<this.container.length&&isObject2(this.container[i]))return this.container[i];{const component={};return this.container.splice(i,0,component),component}}write(key,value){const component=this.getComponent();assert(component[key]==null||component[key]===value,"Internal consistency error: Overwritten component. File a bug"),component[key]=value}get(){return this._op}descend(key){if(!exports2.isValidPathItem(key))throw Error("Invalid JSON key");this.pendingDescent.push(key)}descendPath(path){return this.pendingDescent.push(...path),this}ascend(){this.pendingDescent.length?this.pendingDescent.pop():super.ascend()}mergeTree(data,mergeFn=copyAll){if(data===null)return;if(assert(Array.isArray(data)),data===this._op)throw Error("Cannot merge into my own tree");const _lcIdx=this.lcIdx,oldDepth=this.parents.length;let depth=0;for(let i=0;i<data.length;i++){const c=data[i];typeof c=="string"||typeof c=="number"?(depth++,this.descend(c)):Array.isArray(c)?this.mergeTree(c,mergeFn):typeof c=="object"&&mergeFn(c,this)}for(;depth--;)this.ascend();this.lcIdx=this.parents.length===oldDepth?_lcIdx:-1}at(path,fn){this.descendPath(path),fn(this);for(let i=0;i<path.length;i++)this.ascend();return this}writeAtPath(path,key,value){return this.at(path,()=>this.write(key,value)),this.reset(),this}writeMove(path1,path2,slot=0){return this.writeAtPath(path1,"p",slot).writeAtPath(path2,"d",slot)}getPath(){const path=super.getPath();return path.push(...this.pendingDescent),path}};__name(_WriteCursor,"WriteCursor");let WriteCursor=_WriteCursor;exports2.WriteCursor=WriteCursor,exports2.writeCursor=()=>new WriteCursor,exports2.readCursor=op=>new ReadCursor(op);function advancer(r,listMap,listAdv){let didDescend,valid;valid=didDescend=r?r.descendFirst():!1;function adv(ktarget){let k2_;for(;valid;){const k2=k2_=r.getKey();if(ktarget!=null){let skip=!1;if(listMap&&typeof k2=="number"&&(k2_=listMap(k2,r.getComponent()),k2_<0&&(k2_=~k2_,skip=!0)),isGreaterKey(k2_,ktarget))return null;if(k2_===ktarget&&!skip)return r}listAdv&&typeof k2_=="number"&&listAdv(k2_,r.getComponent()),valid=r.nextSibling()}return null}return __name(adv,"adv"),adv.end=()=>{didDescend&&r.ascend()},adv}__name(advancer,"advancer"),exports2.advancer=advancer;function eachChildOf(r1,r2,fn){let hasChild1,descended1,hasChild2,descended2;for(hasChild1=descended1=r1&&r1.descendFirst(),hasChild2=descended2=r2&&r2.descendFirst();hasChild1||hasChild2;){let k1=hasChild1?r1.getKey():null,k2=hasChild2?r2.getKey():null;k1!==null&&k2!==null&&(isGreaterKey(k2,k1)?k2=null:k1!==k2&&(k1=null)),fn(k1==null?k2:k1,k1!=null?r1:null,k2!=null?r2:null),k1!=null&&hasChild1&&(hasChild1=r1.nextSibling()),k2!=null&&hasChild2&&(hasChild2=r2.nextSibling())}descended1&&r1.ascend(),descended2&&r2.ascend()}__name(eachChildOf,"eachChildOf"),exports2.eachChildOf=eachChildOf}(cursor)),cursor}__name(requireCursor,"requireCursor");var types={},hasRequiredTypes;function requireTypes(){return hasRequiredTypes||(hasRequiredTypes=1,function(exports2){Object.defineProperty(exports2,"__esModule",{value:!0}),exports2.ConflictType=void 0,function(ConflictType){ConflictType[ConflictType.RM_UNEXPECTED_CONTENT=1]="RM_UNEXPECTED_CONTENT",ConflictType[ConflictType.DROP_COLLISION=2]="DROP_COLLISION",ConflictType[ConflictType.BLACKHOLE=3]="BLACKHOLE"}(exports2.ConflictType||(exports2.ConflictType={}))}(types)),types}__name(requireTypes,"requireTypes");var dist={},unicount={},hasRequiredUnicount;function requireUnicount(){return hasRequiredUnicount||(hasRequiredUnicount=1,Object.defineProperty(unicount,"__esModule",{value:!0}),unicount.uniToStrPos=unicount.strPosToUni=void 0,unicount.strPosToUni=(s,strOffset=s.length)=>{let pairs=0,i=0;for(;i<strOffset;i++){const code=s.charCodeAt(i);code>=55296&&code<=57343&&(pairs++,i++)}if(i!==strOffset)throw Error("Invalid offset - splits unicode bytes");return i-pairs},unicount.uniToStrPos=(s,uniOffset)=>{let pos=0;for(;uniOffset>0;uniOffset--){const code=s.charCodeAt(pos);pos+=code>=55296&&code<=57343?2:1}return pos}),unicount}__name(requireUnicount,"requireUnicount");var type={},hasRequiredType;function requireType(){return hasRequiredType||(hasRequiredType=1,function(exports2){Object.defineProperty(exports2,"__esModule",{value:!0}),exports2.uniSlice=exports2.dlen=exports2.eachOp=void 0;const unicount_1=requireUnicount(),checkOp=__name(op=>{if(!Array.isArray(op))throw Error("Op must be an array of components");let last=null;for(let i=0;i<op.length;i++){const c=op[i];switch(typeof c){case"object":if(typeof c.d!="number"&&typeof c.d!="string")throw Error("Delete must be number or string");if(exports2.dlen(c.d)<=0)throw Error("Deletes must not be empty");break;case"string":if(!(c.length>0))throw Error("Inserts cannot be empty");break;case"number":if(!(c>0))throw Error("Skip components must be >0");if(typeof last=="number")throw Error("Adjacent skip components should be combined");break}last=c}if(typeof last=="number")throw Error("Op has a trailing skip")},"checkOp");function eachOp(op,fn){let prePos=0,postPos=0;for(let i=0;i<op.length;i++){const c=op[i];switch(fn(c,prePos,postPos),typeof c){case"object":prePos+=exports2.dlen(c.d);break;case"string":postPos+=unicount_1.strPosToUni(c);break;case"number":prePos+=c,postPos+=c;break}}}__name(eachOp,"eachOp"),exports2.eachOp=eachOp;function mapOp(op,fn){const newOp=[],append=makeAppend(newOp);return eachOp(op,(c,prePos,postPos)=>{append(fn(c,prePos,postPos))}),trim(newOp)}__name(mapOp,"mapOp");const id=__name(x=>x,"id"),normalize=__name(op=>mapOp(op,id),"normalize");exports2.dlen=d=>typeof d=="number"?d:unicount_1.strPosToUni(d);const makeAppend=__name(op=>component=>{if(!(!component||component.d===0||component.d===""))if(op.length===0)op.push(component);else if(typeof component==typeof op[op.length-1])if(typeof component=="object"){const last=op[op.length-1];last.d=typeof last.d=="string"&&typeof component.d=="string"?last.d+component.d:exports2.dlen(last.d)+exports2.dlen(component.d)}else op[op.length-1]+=component;else op.push(component)},"makeAppend"),componentLength=__name(c=>typeof c=="number"?c:typeof c=="string"?unicount_1.strPosToUni(c):typeof c.d=="number"?c.d:unicount_1.strPosToUni(c.d),"componentLength");exports2.uniSlice=(s,startUni,endUni)=>{const start=unicount_1.uniToStrPos(s,startUni),end=endUni==null?1/0:unicount_1.uniToStrPos(s,endUni);return s.slice(start,end)};const dslice=__name((d,start,end)=>typeof d=="number"?end==null?d-start:Math.min(d,end)-start:exports2.uniSlice(d,start,end),"dslice"),makeTake=__name(op=>{let idx=0,offset=0;return{take:__name((n,indivisableField)=>{if(idx===op.length)return n===-1?null:n;const c=op[idx];let part;if(typeof c=="number")return n===-1||c-offset<=n?(part=c-offset,++idx,offset=0,part):(offset+=n,n);if(typeof c=="string"){if(n===-1||indivisableField==="i"||unicount_1.strPosToUni(c.slice(offset))<=n)return part=c.slice(offset),++idx,offset=0,part;{const offset2=offset+unicount_1.uniToStrPos(c.slice(offset),n);return part=c.slice(offset,offset2),offset=offset2,part}}else{if(n===-1||indivisableField==="d"||exports2.dlen(c.d)-offset<=n)return part={d:dslice(c.d,offset)},++idx,offset=0,part;{let result=dslice(c.d,offset,offset+n);return offset+=n,{d:result}}}},"take"),peek:__name(()=>op[idx],"peek")}},"makeTake"),trim=__name(op=>(op.length>0&&typeof op[op.length-1]=="number"&&op.pop(),op),"trim");function transform(op1,op2,side){if(side!=="left"&&side!=="right")throw Error("side ("+side+") must be 'left' or 'right'");checkOp(op1),checkOp(op2);const newOp=[],append=makeAppend(newOp),{take,peek}=makeTake(op1);for(let i=0;i<op2.length;i++){const c2=op2[i];let length,c1;switch(typeof c2){case"number":for(length=c2;length>0;)c1=take(length,"i"),append(c1),typeof c1!="string"&&(length-=componentLength(c1));break;case"string":side==="left"&&typeof peek()=="string"&&append(take(-1)),append(unicount_1.strPosToUni(c2));break;case"object":for(length=exports2.dlen(c2.d);length>0;)switch(c1=take(length,"i"),typeof c1){case"number":length-=c1;break;case"string":append(c1);break;case"object":length-=exports2.dlen(c1.d)}break}}let c;for(;c=take(-1);)append(c);return trim(newOp)}__name(transform,"transform");function compose(op1,op2){checkOp(op1),checkOp(op2);const result=[],append=makeAppend(result),{take}=makeTake(op1);for(let i=0;i<op2.length;i++){const component=op2[i];let length,chunk;switch(typeof component){case"number":for(length=component;length>0;)chunk=take(length,"d"),append(chunk),typeof chunk!="object"&&(length-=componentLength(chunk));break;case"string":append(component);break;case"object":length=exports2.dlen(component.d);let offset=0;for(;offset<length;)switch(chunk=take(length-offset,"d"),typeof chunk){case"number":append({d:dslice(component.d,offset,offset+chunk)}),offset+=chunk;break;case"string":offset+=unicount_1.strPosToUni(chunk);break;case"object":append(chunk)}break}}let c;for(;c=take(-1);)append(c);return trim(result)}__name(compose,"compose");const transformPosition=__name((cursor2,op)=>{let pos=0;for(let i=0;i<op.length&&cursor2>pos;i++){const c=op[i];switch(typeof c){case"number":{pos+=c;break}case"string":const offset=unicount_1.strPosToUni(c);pos+=offset,cursor2+=offset;break;case"object":cursor2-=Math.min(exports2.dlen(c.d),cursor2-pos);break}}return cursor2},"transformPosition"),transformSelection=__name((selection,op)=>typeof selection=="number"?transformPosition(selection,op):selection.map(s=>transformPosition(s,op)),"transformSelection");function makeInvertible(op,doc,ropeImpl){return mapOp(op,(c,prePos)=>typeof c=="object"&&typeof c.d=="number"?{d:ropeImpl.slice(doc,prePos,prePos+c.d)}:c)}__name(makeInvertible,"makeInvertible");function invert(op){return mapOp(op,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}})}__name(invert,"invert");function stripInvertible(op){return mapOp(op,c=>typeof c=="object"&&typeof c.d=="string"?{d:unicount_1.strPosToUni(c.d)}:c)}__name(stripInvertible,"stripInvertible");function isInvertible(op){let invertible=!0;return eachOp(op,c=>{typeof c=="object"&&typeof c.d=="number"&&(invertible=!1)}),invertible}__name(isInvertible,"isInvertible");function makeType(ropeImpl){return{name:"text-unicode",uri:"http://sharejs.org/types/text-unicode",trim,normalize,checkOp,create(initial=""){if(typeof initial!="string")throw Error("Initial data must be a string");return ropeImpl.create(initial)},apply(str,op){checkOp(op);const builder=ropeImpl.builder(str);for(let i=0;i<op.length;i++){const component=op[i];switch(typeof component){case"number":builder.skip(component);break;case"string":builder.append(component);break;case"object":builder.del(exports2.dlen(component.d));break}}return builder.build()},transform,compose,transformPosition,transformSelection,isInvertible,makeInvertible(op,doc){return makeInvertible(op,doc,ropeImpl)},stripInvertible,invert,invertWithDoc(op,doc){return invert(makeInvertible(op,doc,ropeImpl))},isNoop:__name(op=>op.length===0,"isNoop")}}__name(makeType,"makeType"),exports2.default=makeType}(type)),type}__name(requireType,"requireType");var api={},hasRequiredApi;function requireApi(){if(hasRequiredApi)return api;hasRequiredApi=1,Object.defineProperty(api,"__esModule",{value:!0});const type_1=requireType(),unicount_1=requireUnicount();function api$1(getSnapshot,submitOp){return{get:getSnapshot,getLength(){return getSnapshot().length},insert(pos,text,callback){const uniPos=unicount_1.strPosToUni(getSnapshot(),pos);return submitOp([uniPos,text],callback)},remove(pos,lengthOrContent,callback){const uniPos=unicount_1.strPosToUni(getSnapshot(),pos);return submitOp([uniPos,{d:lengthOrContent}],callback)},_onOp(op){type_1.eachOp(op,(component,prePos,postPos)=>{switch(typeof component){case"string":this.onInsert&&this.onInsert(postPos,component);break;case"object":const dl=type_1.dlen(component.d);this.onRemove&&this.onRemove(postPos,dl)}})},onInsert:null,onRemove:null}}return __name(api$1,"api$1"),api.default=api$1,api$1.provides={text:!0},api}__name(requireApi,"requireApi");var hasRequiredDist$1;function requireDist$1(){return hasRequiredDist$1||(hasRequiredDist$1=1,function(exports2){var __createBinding=dist.__createBinding||(Object.create?function(o,m,k,k2){k2===void 0&&(k2=k),Object.defineProperty(o,k2,{enumerable:!0,get:__name(function(){return m[k]},"get")})}:function(o,m,k,k2){k2===void 0&&(k2=k),o[k2]=m[k]}),__setModuleDefault=dist.__setModuleDefault||(Object.create?function(o,v){Object.defineProperty(o,"default",{enumerable:!0,value:v})}:function(o,v){o.default=v}),__importStar=dist.__importStar||function(mod){if(mod&&mod.__esModule)return mod;var result={};if(mod!=null)for(var k in mod)Object.hasOwnProperty.call(mod,k)&&__createBinding(result,mod,k);return __setModuleDefault(result,mod),result},__importDefault=dist.__importDefault||function(mod){return mod&&mod.__esModule?mod:{default:mod}};Object.defineProperty(exports2,"__esModule",{value:!0}),exports2.type=exports2.remove=exports2.insert=void 0;const unicount_1=requireUnicount(),type_1=__importStar(requireType()),api_1=__importDefault(requireApi()),ropeImplUnicodeString={create(s){return s},toString(s){return s},builder(oldDoc){if(typeof oldDoc!="string")throw Error("Invalid document snapshot: "+oldDoc);const newDoc=[];return{skip(n){let offset=unicount_1.uniToStrPos(oldDoc,n);if(offset>oldDoc.length)throw Error("The op is too long for this document");newDoc.push(oldDoc.slice(0,offset)),oldDoc=oldDoc.slice(offset)},append(s){newDoc.push(s)},del(n){oldDoc=oldDoc.slice(unicount_1.uniToStrPos(oldDoc,n))},build(){return newDoc.join("")+oldDoc}}},slice:type_1.uniSlice},textString=type_1.default(ropeImplUnicodeString),type2=Object.assign(Object.assign({},textString),{api:api_1.default});exports2.type=type2,exports2.insert=(pos,text)=>text.length===0?[]:pos===0?[text]:[pos,text],exports2.remove=(pos,textOrLen)=>type_1.dlen(textOrLen)===0?[]:pos===0?[{d:textOrLen}]:[pos,{d:textOrLen}];var type_2=requireType();Object.defineProperty(exports2,"makeType",{enumerable:!0,get:__name(function(){return type_2.default},"get")})}(dist)),dist}__name(requireDist$1,"requireDist$1");var hasRequiredJson1_release;function requireJson1_release(){return hasRequiredJson1_release||(hasRequiredJson1_release=1,function(exports2){var __importDefault=json1_release.__importDefault||function(mod){return mod&&mod.__esModule?mod:{default:mod}};Object.defineProperty(exports2,"__esModule",{value:!0}),exports2.editOp=exports2.replaceOp=exports2.insertOp=exports2.moveOp=exports2.removeOp=exports2.type=void 0;const deepEqual_js_1=__importDefault(requireDeepEqual()),deepClone_js_1=__importDefault(requireDeepClone()),cursor_js_1=requireCursor(),types_js_1=requireTypes();function assert(pred,msg){if(!pred)throw new Error(msg)}__name(assert,"assert"),exports2.type={name:"json1",uri:"http://sharejs.org/types/JSONv1",readCursor:cursor_js_1.readCursor,writeCursor:cursor_js_1.writeCursor,create:__name(data=>data,"create"),isNoop:__name(op=>op==null,"isNoop"),setDebug(val){},registerSubtype,checkValidOp,normalize,apply:apply2,transformPosition,compose,tryTransform,transform,makeInvertible,invert,invertWithDoc,RM_UNEXPECTED_CONTENT:types_js_1.ConflictType.RM_UNEXPECTED_CONTENT,DROP_COLLISION:types_js_1.ConflictType.DROP_COLLISION,BLACKHOLE:types_js_1.ConflictType.BLACKHOLE,transformNoConflict:__name((op1,op2,side)=>transformWithConflictsPred(()=>!0,op1,op2,side),"transformNoConflict"),typeAllowingConflictsPred:__name(allowConflict=>Object.assign(Object.assign({},exports2.type),{transform:__name((op1,op2,side)=>transformWithConflictsPred(allowConflict,op1,op2,side),"transform")}),"typeAllowingConflictsPred")};const getComponent=__name(r=>r?r.getComponent():null,"getComponent");function isObject2(o){return o&&typeof o=="object"&&!Array.isArray(o)}__name(isObject2,"isObject");const shallowClone=__name(obj=>Array.isArray(obj)?obj.slice():obj!==null&&typeof obj=="object"?Object.assign({},obj):obj,"shallowClone"),hasPick=__name(c=>c&&(c.p!=null||c.r!==void 0),"hasPick"),hasDrop=__name(c=>c&&(c.d!=null||c.i!==void 0),"hasDrop");function removeChild(container,key){return assert(container!=null),typeof key=="number"?(assert(Array.isArray(container),"Invalid key - child is not an array"),(container=container.slice()).splice(key,1)):(assert(isObject2(container),"Invalid key - child is not an object"),delete(container=Object.assign({},container))[key]),container}__name(removeChild,"removeChild");function insertChildMut(container,key,value){return typeof key=="number"?(assert(container!=null,"Container is missing for key"),assert(Array.isArray(container),"Cannot use numerical key for object container"),assert(container.length>=key,"Cannot insert into out of bounds index"),container.splice(key,0,value)):(assert(isObject2(container),"Cannot insert into missing item"),assert(container[key]===void 0,"Trying to overwrite value at key. Your op needs to remove it first"),container[key]=value),value}__name(insertChildMut,"insertChildMut"),exports2.removeOp=(path,value=!0)=>cursor_js_1.writeCursor().writeAtPath(path,"r",value).get(),exports2.moveOp=(from,to)=>cursor_js_1.writeCursor().writeMove(from,to).get(),exports2.insertOp=(path,value)=>cursor_js_1.writeCursor().writeAtPath(path,"i",value).get(),exports2.replaceOp=(path,oldVal,newVal)=>cursor_js_1.writeCursor().at(path,w=>{w.write("r",oldVal),w.write("i",newVal)}).get(),exports2.editOp=(path,type2,subOp,preserveNoop=!1)=>cursor_js_1.writeCursor().at(path,w=>writeEdit(w,type2,subOp,preserveNoop)).get();const isValidKey=__name((container,key)=>container!=null&&(typeof key=="number"?Array.isArray(container):typeof container=="object"),"isValidKey"),maybeGetChild=__name((container,key)=>isValidKey(container,key)?container[key]:void 0,"maybeGetChild"),subtypes={};function registerSubtype(subtype){let _subtype=subtype.type?subtype.type:subtype;_subtype.name&&(subtypes[_subtype.name]=_subtype),_subtype.uri&&(subtypes[_subtype.uri]=_subtype)}__name(registerSubtype,"registerSubtype");const typeOrThrow=__name(name=>{const type2=subtypes[name];if(type2)return type2;throw Error("Missing type: "+name)},"typeOrThrow");registerSubtype(requireDist$1());const add=__name((a,b)=>a+b,"add");registerSubtype({name:"number",apply:add,compose:add,invert:__name(n=>-n,"invert"),transform:__name(a=>a,"transform")});const getEditType=__name(c=>c==null?null:c.et?typeOrThrow(c.et):c.es?subtypes["text-unicode"]:c.ena!=null?subtypes.number:null,"getEditType"),getEdit=__name(c=>c.es?c.es:c.ena!=null?c.ena:c.e,"getEdit"),writeEdit=__name((w,typeOrName,edit,preserveNoop=!1)=>{const[type2,name]=typeof typeOrName=="string"?[typeOrThrow(typeOrName),typeOrName]:[typeOrName,typeOrName.name];!preserveNoop&&type2.isNoop&&type2.isNoop(edit)||(name==="number"?w.write("ena",edit):name==="text-unicode"?w.write("es",edit):(w.write("et",name),w.write("e",edit)))},"writeEdit");function checkNonNegInteger(n){assert(typeof n=="number"),assert(n>=0),assert(n===(0|n))}__name(checkNonNegInteger,"checkNonNegInteger");function checkScalar(s){typeof s=="number"?checkNonNegInteger(s):assert(typeof s=="string")}__name(checkScalar,"checkScalar");function checkValidOp(op){if(op===null)return;const pickedSlots=new Set,droppedSlots=new Set,checkComponent=__name(e=>{let empty=!0,hasEdit=!1;for(let k in e){const v=e[k];if(empty=!1,assert(k==="p"||k==="r"||k==="d"||k==="i"||k==="e"||k==="es"||k==="ena"||k==="et","Invalid component item '"+k+"'"),k==="p")checkNonNegInteger(v),assert(!pickedSlots.has(v)),pickedSlots.add(v),assert(e.r===void 0);else if(k==="d")checkNonNegInteger(v),assert(!droppedSlots.has(v)),droppedSlots.add(v),assert(e.i===void 0);else if(k==="e"||k==="es"||k==="ena"){assert(!hasEdit),hasEdit=!0;const t=getEditType(e);assert(t,"Missing type in edit"),t.checkValidOp&&t.checkValidOp(getEdit(e))}}assert(!empty)},"checkComponent"),checkDescent=__name((descent,isRoot,removed)=>{if(!Array.isArray(descent))throw Error("Op must be null or a list");if(descent.length===0)throw Error("Empty descent");isRoot||checkScalar(descent[0]);let last=1,numDescents=0,lastKey=0;for(let i=0;i<descent.length;i++){const d=descent[i];if(assert(d!=null),Array.isArray(d)){const key=checkDescent(d,!1);if(numDescents){const t1=typeof lastKey,t2=typeof key;t1===t2?assert(lastKey<key,"descent keys are not in order"):assert(t1==="number"&&t2==="string")}lastKey=key,numDescents++,last=3}else typeof d=="object"?(assert(last===1,`Prev not scalar - instead ${last}`),checkComponent(d),last=2):(assert(last!==3),checkScalar(d),assert(cursor_js_1.isValidPathItem(d),"Invalid path key"),last=1)}return assert(numDescents!==1,"Operation makes multiple descents. Remove some []"),assert(last===2||last===3),descent[0]},"checkDescent");checkDescent(op,!0),assert(pickedSlots.size===droppedSlots.size,"Mismatched picks and drops in op");for(let i=0;i<pickedSlots.size;i++)assert(pickedSlots.has(i)),assert(droppedSlots.has(i))}__name(checkValidOp,"checkValidOp");function normalize(op){let nextSlot=0,slotMap=[];const w=cursor_js_1.writeCursor();return w.mergeTree(op,(c,w2)=>{const t=getEditType(c);if(t){const op2=getEdit(c);writeEdit(w2,t,t.normalize?t.normalize(op2):op2)}for(const k of["r","p","i","d"])if(c[k]!==void 0){const r=k==="p"||k==="d"?(inSlot=c[k],slotMap[inSlot]==null&&(slotMap[inSlot]=nextSlot++),slotMap[inSlot]):c[k];w2.write(k,r)}var inSlot}),w.get()}__name(normalize,"normalize");function apply2(snapshot,op){if(checkValidOp(op),op===null)return snapshot;const held=[];return __name(function drop(root2,descent){let subDoc=root2,i=0,rootContainer={root:root2},m=0,container=rootContainer,key="root";function mut(){for(;m<i;m++){let d=descent[m];typeof d!="object"&&(assert(isValidKey(container,key)),container=container[key]=shallowClone(container[key]),key=d)}}for(__name(mut,"mut");i<descent.length;i++){const d=descent[i];if(Array.isArray(d)){const child=drop(subDoc,d);child!==subDoc&&child!==void 0&&(mut(),subDoc=container[key]=child)}else if(typeof d=="object"){d.d!=null?(mut(),subDoc=insertChildMut(container,key,held[d.d])):d.i!==void 0&&(mut(),subDoc=insertChildMut(container,key,d.i));const t=getEditType(d);if(t)mut(),subDoc=container[key]=t.apply(subDoc,getEdit(d));else if(d.e!==void 0)throw Error("Subtype "+d.et+" undefined")}else subDoc=maybeGetChild(subDoc,d)}return rootContainer.root},"drop")(snapshot=__name(function pick(subDoc,descent){const stack=[];let i=0;for(;i<descent.length;i++){const d=descent[i];if(Array.isArray(d))break;typeof d!="object"&&(stack.push(subDoc),subDoc=maybeGetChild(subDoc,d))}for(let j=descent.length-1;j>=i;j--)subDoc=pick(subDoc,descent[j]);for(--i;i>=0;i--){const d=descent[i];if(typeof d!="object"){const container=stack.pop();subDoc=subDoc===maybeGetChild(container,d)?container:subDoc===void 0?removeChild(container,d):(k=d,v=subDoc,(obj=shallowClone(obj=container))[k]=v,obj)}else hasPick(d)&&(assert(subDoc!==void 0,"Cannot pick up or remove undefined"),d.p!=null&&(held[d.p]=subDoc),subDoc=void 0)}var obj,k,v;return subDoc},"pick")(snapshot,op),op)}__name(apply2,"apply");function transformPosition(path,op){path=path.slice(),checkValidOp(op);const r=cursor_js_1.readCursor(op);let pickedAtSlot,pickIndex,removed=!1;const advStack=[];for(let i=0;;i++){const k=path[i],c=r.getComponent();if(c&&(c.r!==void 0?removed=!0:c.p!=null&&(removed=!1,pickedAtSlot=c.p,pickIndex=i)),i>=path.length)break;let pickOffset=0;const pickAdv=cursor_js_1.advancer(r,void 0,(k2,c2)=>{hasPick(c2)&&pickOffset++});advStack.unshift(pickAdv);const hasNext=pickAdv(k);if(typeof k=="number"&&(path[i]-=pickOffset),!hasNext)break}if(advStack.forEach(pickAdv=>pickAdv.end()),removed)return null;const handleDrop=__name(()=>{let i=0;if(pickedAtSlot!=null){const rPath=r.getPath();i=rPath.length,path=rPath.concat(path.slice(pickIndex))}for(;i<path.length;i++){const k=path[i],c=getComponent(r),et=getEditType(c);if(et){const e=getEdit(c);et.transformPosition&&(path[i]=et.transformPosition(path[i],e));break}let dropOffset=0;const hasNext=cursor_js_1.advancer(r,(k2,c2)=>hasDrop(c2)?~(k2-dropOffset):k2-dropOffset,(k2,c2)=>{hasDrop(c2)&&dropOffset++})(k);if(typeof k=="number"&&(path[i]+=dropOffset),!hasNext)break}},"handleDrop");return pickedAtSlot!=null?r.eachDrop(null,slot=>{slot===pickedAtSlot&&handleDrop()}):handleDrop(),path}__name(transformPosition,"transformPosition");function compose(op1,op2){if(checkValidOp(op1),checkValidOp(op2),op1==null)return op2;if(op2==null)return op1;let nextSlot=0;const r1=cursor_js_1.readCursor(op1),r2=cursor_js_1.readCursor(op2),w=cursor_js_1.writeCursor(),heldPickWrites=[],heldDropWrites=[],held1Pick=[],held2Drop=[],p1SlotMap=[],p2SlotMap=[],visitedOp2EditCs=new Set;r1.traverse(null,c=>{c.p!=null&&(held1Pick[c.p]=r1.clone())}),r2.traverse(null,c=>{c.d!=null&&(held2Drop[c.d]=r2.clone())});const w2=cursor_js_1.writeCursor();return __name(function xfBoundary(r1Pick,r1Drop,r2Pick,r2Drop,litIn,rmParent,wd,wp){assert(r1Drop||r2Pick);const c1d=getComponent(r1Drop),c2p=getComponent(r2Pick),rmHere=!!c2p&&c2p.r!==void 0,insHere=!!c1d&&c1d.i!==void 0,drop1Slot=c1d?c1d.d:null,pick2Slot=c2p?c2p.p:null,rmChildren=(rmParent||rmHere)&&pick2Slot==null;if(pick2Slot!=null)r2Drop=held2Drop[pick2Slot],wd=heldDropWrites[pick2Slot]=new cursor_js_1.WriteCursor;else if(c2p&&c2p.r!==void 0)r2Drop=null;else{const c2d2=getComponent(r2Drop);c2d2&&c2d2.d!=null&&(r2Drop=null)}const c2d=getComponent(r2Drop);if(drop1Slot!=null)if(r1Pick=held1Pick[drop1Slot],wp=heldPickWrites[drop1Slot]=new cursor_js_1.WriteCursor,rmChildren)rmParent&&!rmHere&&wp.write("r",!0);else{const slot=p1SlotMap[drop1Slot]=nextSlot++;wd.write("d",slot)}else if(c1d&&c1d.i!==void 0)r1Pick=null;else{const c1p=getComponent(r1Pick);c1p&&c1p.p!=null&&(r1Pick=null)}let litOut;insHere?(assert(litIn===void 0),litOut=c1d.i):litOut=litIn;const insComponent=(pick2Slot==null?!insHere||rmParent||rmHere:litOut===void 0)?null:wd.getComponent();if(pick2Slot!=null){if(!(litIn!==void 0||insHere)){const slot=drop1Slot!=null?p1SlotMap[drop1Slot]:nextSlot++;p2SlotMap[pick2Slot]=slot,wp.write("p",slot)}}else rmHere&&(insHere||litIn!==void 0||(c2p.r,wp.write("r",c2p.r)));const type1=rmChildren?null:getEditType(c1d),type2=getEditType(c2d);if((type1||type2)&&(type1&&type1.name,type2&&type2.name),type1&&type2){assert(type1===type2);const e1=getEdit(c1d),e2=getEdit(c2d),r=type1.compose(e1,e2);writeEdit(wd,type1,r),visitedOp2EditCs.add(c2d)}else type1?writeEdit(wd,type1,getEdit(c1d)):type2&&(writeEdit(wd,type2,getEdit(c2d)),visitedOp2EditCs.add(c2d));const hasContainerLiteral=typeof litOut=="object"&&litOut!=null;let isCloned=!1,p1PickOff=0,p1DropOff=0,p2PickOff=0,p2DropOff=0,litOff=0;const p2DropAdv=cursor_js_1.advancer(r2Drop,(k,c)=>hasDrop(c)?p2DropOff-k-1:k-p2DropOff,(k,c)=>{hasDrop(c)&&p2DropOff++}),p1PickAdv=cursor_js_1.advancer(r1Pick,(k,c)=>hasPick(c)?p1PickOff-k-1:k-p1PickOff,(k,c)=>{hasPick(c)&&p1PickOff++});if(cursor_js_1.eachChildOf(r1Drop,r2Pick,(inKey,_p1Drop,_p2Pick)=>{let _p1Pick,_p2Drop,p1PickKey=inKey,p2DropKey=inKey,litKey=inKey;if(typeof inKey=="number"){let p2Mid=inKey+p2PickOff;_p2Drop=p2DropAdv(p2Mid),p2DropKey=p2Mid+p2DropOff;let p1Mid=inKey+p1DropOff;_p1Pick=p1PickAdv(p1Mid),hasDrop(getComponent(_p2Drop))&&(_p1Pick=null),p1PickKey=p1Mid+p1PickOff,litKey=inKey+litOff,assert(p1PickKey>=0,"p1PickKey is negative"),assert(p2DropKey>=0,"p2DropKey is negative");const hd1=hasDrop(getComponent(_p1Drop)),hp2=hasPick(getComponent(_p2Pick));(hd1||hp2&&!rmChildren)&&litOff--,hd1&&p1DropOff--,hp2&&p2PickOff--}else _p1Pick=p1PickAdv(inKey),_p2Drop=p2DropAdv(inKey);wp.descend(p1PickKey),wd.descend(p2DropKey);const _lit=hasContainerLiteral&&!hasDrop(getComponent(_p1Drop))?litOut[litKey]:void 0,_litResult=xfBoundary(_p1Pick,_p1Drop,_p2Pick,_p2Drop,_lit,rmChildren,wd,wp);var container,key,child;hasContainerLiteral&&!rmChildren?_lit!==_litResult&&(isCloned||(litOut=Array.isArray(litOut)?litOut.slice():Object.assign({},litOut),isCloned=!0),container=litOut,child=_litResult,typeof(key=litKey)=="number"?(assert(Array.isArray(container)),assert(key<container.length)):(assert(!Array.isArray(container)),assert(container[key]!==void 0)),child===void 0?typeof key=="number"?container.splice(key,1):delete container[key]:container[key]=child):assert(_litResult===void 0),wd.ascend(),wp.ascend()}),p1PickAdv.end(),p2DropAdv.end(),insComponent!=null)insComponent.i=litOut;else if(!rmParent&&!rmHere&&pick2Slot==null)return litOut},"xfBoundary")(r1,r1.clone(),r2,r2.clone(),void 0,!1,w,w2),w.reset(),w.mergeTree(w2.get()),w.reset(),w.get(),heldPickWrites.map(w3=>w3.get()),heldDropWrites.map(w3=>w3.get()),r1.traverse(w,(c,w3)=>{const slot1=c.p;if(slot1!=null){const slot=p1SlotMap[slot1];slot!=null&&w3.write("p",slot);const _w=heldPickWrites[slot1];_w&&_w.get(),_w&&w3.mergeTree(_w.get())}else c.r!==void 0&&w3.write("r",c.r)}),w.reset(),w.get(),r2.traverse(w,(c,w3)=>{const slot2=c.d;if(slot2!=null){const slot=p2SlotMap[slot2];slot!=null&&w3.write("d",slot);const _w=heldDropWrites[slot2];_w&&w3.mergeTree(_w.get())}else c.i!==void 0&&w3.write("i",c.i);const t=getEditType(c);t&&!visitedOp2EditCs.has(c)&&writeEdit(w3,t,getEdit(c))}),w.get()}__name(compose,"compose");function invert(op){if(op==null)return null;const r=new cursor_js_1.ReadCursor(op),w=new cursor_js_1.WriteCursor;let editsToTransform;const heldPick=[],heldWrites=[];return __name(function invertSimple(r2,w2,subDoc){const c=r2.getComponent();let insertHere,subdocModified=!1;if(c){c.p!=null&&(w2.write("d",c.p),heldPick[c.p]=r2.clone()),c.r!==void 0&&w2.write("i",c.r),c.d!=null&&(w2.write("p",c.d),subDoc=void 0),c.i!==void 0&&(subDoc=insertHere=c.i);const t=getEditType(c);t&&(subDoc===void 0?(editsToTransform||(editsToTransform=new Set),editsToTransform.add(c)):(getEdit(c),subDoc=t.apply(subDoc,getEdit(c)),subdocModified=!0))}let dropOff=0;for(const key of r2){w2.descend(key);const raw=typeof key=="number"?key-dropOff:key,childIn=maybeGetChild(subDoc,raw);hasDrop(r2.getComponent())&&dropOff++;const childOut=invertSimple(r2,w2,childIn);if(subDoc!==void 0&&childOut!==void 0){if(subdocModified||(subdocModified=!0,subDoc=shallowClone(subDoc)),!isValidKey(subDoc,raw))throw Error("Cannot modify child - invalid operation");subDoc[raw]=childOut}w2.ascend()}if(insertHere===void 0)return subdocModified?subDoc:void 0;w2.write("r",subDoc)},"invertSimple")(r,w,void 0),editsToTransform&&(w.reset(),__name(function transformEdits(rPick,rDrop,w2){const cd=rDrop.getComponent();if(cd){const dropSlot=cd.d;if(dropSlot!=null&&(rPick=heldPick[dropSlot],w2=heldWrites[dropSlot]=cursor_js_1.writeCursor()),editsToTransform.has(cd)){const t=getEditType(cd);if(!t.invert)throw Error(`Cannot invert subtype ${t.name}`);writeEdit(w2,t,t.invert(getEdit(cd)))}}let pickOff=0,dropOff=0;const ap=cursor_js_1.advancer(rPick,(k,c)=>hasPick(c)?pickOff-k-1:k-pickOff,(k,c)=>{hasPick(c)&&pickOff++});for(const key of rDrop)if(typeof key=="number"){const mid=key-dropOff,_rPick=ap(mid),raw=mid+pickOff;w2.descend(raw),transformEdits(_rPick,rDrop,w2),hasDrop(rDrop.getComponent())&&dropOff++,w2.ascend()}else w2.descend(key),transformEdits(ap(key),rDrop,w2),w2.ascend();ap.end()},"transformEdits")(r.clone(),r,w),heldWrites.length&&(w.reset(),r.traverse(w,(c,w2)=>{const slot=c.p;if(slot!=null){const _w=heldWrites[slot];_w&&_w.get(),_w&&w2.mergeTree(_w.get())}}))),w.get()}__name(invert,"invert");const anyComponent=__name((op,fn)=>op.some(c=>typeof c=="object"&&(Array.isArray(c)?anyComponent(c,fn):fn(c))),"anyComponent");function makeInvertible(op,doc){if(op==null||!anyComponent(op,c=>{var _a17;return c.r!==void 0||((_a17=getEditType(c))===null||_a17===void 0?void 0:_a17.makeInvertible)!=null}))return op;const r=new cursor_js_1.ReadCursor(op),w=new cursor_js_1.WriteCursor;let hasEdits=!1;const heldPick=[],heldDoc=[],traversePick=__name((r2,w2,subDoc)=>{const c=r2.getComponent();let modified=!1;if(c){c.d!=null&&w2.write("d",c.d),c.i!==void 0&&w2.write("i",c.i);const pickSlot=c.p;if(pickSlot!=null&&(heldPick[pickSlot]=r2.clone(),assert(subDoc!==void 0,"Operation picks up at an invalid key"),heldDoc[pickSlot]=subDoc,w2.write("p",c.p)),c.r!==void 0&&subDoc===void 0)throw Error("Invalid doc / op in makeInvertible: removed item missing from doc");const t=getEditType(c);t&&(t.makeInvertible?hasEdits=!0:writeEdit(w2,t,getEdit(c),!0))}let listOff=0;for(const key of r2){w2.descend(key);const keyRaw=typeof key=="number"?key-listOff:key,childIn=maybeGetChild(subDoc,keyRaw),childOut=traversePick(r2,w2,childIn);childIn!==childOut&&(modified||(modified=!0,subDoc=shallowClone(subDoc)),childOut===void 0?(subDoc=removeChild(subDoc,keyRaw),typeof key=="number"&&listOff++):subDoc[keyRaw]=childOut),w2.ascend()}return c&&(c.r!==void 0?(w2.write("r",deepClone_js_1.default(subDoc)),subDoc=void 0):c.p!=null&&(subDoc=void 0)),subDoc},"traversePick");return traversePick(r,w,doc),w.get(),hasEdits&&(w.reset(),__name(function traverseDrop(rPick,rDrop,w2,subDoc,isLiteral){const c=rDrop.getComponent();if(c){c.i!==void 0?(subDoc=c.i,isLiteral=!0):c.d!=null&&(subDoc=heldDoc[c.d],rPick=heldPick[c.d],isLiteral=!1,c.d);let t=getEditType(c);if(t&&t.makeInvertible){const edit=getEdit(c);writeEdit(w2,t,t.makeInvertible(edit,subDoc),!0)}}let pickOff=0,dropOff=0;const ap=cursor_js_1.advancer(rPick,(k,c2)=>hasPick(c2)?pickOff-k-1:k-pickOff,(k,c2)=>{hasPick(c2)&&pickOff++});for(const key of rDrop)if(typeof key=="number"){const mid=key-dropOff,_rPick=ap(mid),raw=mid+pickOff,child=maybeGetChild(subDoc,isLiteral?mid:raw);w2.descend(key),traverseDrop(_rPick,rDrop,w2,child,isLiteral),hasDrop(rDrop.getComponent())&&dropOff++,w2.ascend()}else{const child=maybeGetChild(subDoc,key);w2.descend(key),traverseDrop(ap(key),rDrop,w2,child,isLiteral),w2.ascend()}ap.end()},"traverseDrop")(r.clone(),r,w,doc,!1)),w.get()}__name(makeInvertible,"makeInvertible");function invertWithDoc(op,doc){return invert(makeInvertible(op,doc))}__name(invertWithDoc,"invertWithDoc");const shallowCloneOp=__name(op=>{if(op==null)return null;const result=op.slice();for(let i=0;i<op.length;i++){const c=result[i];Array.isArray(c)&&(result[i]=shallowCloneOp(c))}return result},"shallowCloneOp");function tryTransform(op1,op2,direction){assert(direction==="left"||direction==="right","Direction must be left or right");const side=direction==="left"?0:1;if(op2==null)return{ok:!0,result:op1};checkValidOp(op1),checkValidOp(op2);let conflict=null;const heldOp1PickByOp1=[],heldOp1DropByOp1=[],heldOp2PickByOp2=[],heldOp2DropByOp2=[],heldOp1PickByOp2=[],heldOp2PickByOp1=[],heldOp2DropByOp1=[],heldOp2RmForOp1=[],heldOp1RmForOp2=[],cancelledOp2=[],discardedOp2Drop=[],heldPickWrites=[],heldDropWrites=[],op1PickAtOp2Pick=[],op1PicksOp2DropSlots=[];let nextSlot=0;const r1=cursor_js_1.readCursor(op1),r2=cursor_js_1.readCursor(op2),w=cursor_js_1.writeCursor();if(__name(function scanOp2Pick(r2Pick,r1Pick=null,removed1){const c1=getComponent(r1Pick);c1&&(c1.r!==void 0?removed1=r1Pick.clone():c1.p!=null&&(removed1=null,heldOp2PickByOp1[c1.p]=r2Pick.clone()));const c2=r2Pick.getComponent();let slot2;c2&&(slot2=c2.p)!=null&&(heldOp1PickByOp2[slot2]=r1Pick?r1Pick.clone():null,heldOp2PickByOp2[slot2]=r2Pick.clone(),removed1&&(cancelledOp2[slot2]=!0,heldOp1RmForOp2[slot2]=removed1),c1&&c1.p!=null&&(op1PickAtOp2Pick[slot2]=c1.p));const ap1=cursor_js_1.advancer(r1Pick);for(const key of r2Pick)scanOp2Pick(r2Pick,ap1(key),removed1);ap1.end()},"scanOp2Pick")(r2,r1,null),__name(function scanOp2Drop(r1Pick,r2Pick,r2Drop,pickSlot1,removed1){const c2d=r2Drop.getComponent();let slot2,droppedHere=!1;c2d&&((slot2=c2d.d)!=null?(heldOp2DropByOp2[slot2]=r2Drop.clone(),pickSlot1!=null&&(op1PicksOp2DropSlots[pickSlot1]==null&&(op1PicksOp2DropSlots[pickSlot1]=[]),op1PicksOp2DropSlots[pickSlot1].push(slot2)),cancelledOp2[slot2],r1Pick=heldOp1PickByOp2[slot2]||null,r2Pick=heldOp2PickByOp2[slot2]||null,cancelledOp2[slot2]?(removed1&&(discardedOp2Drop[slot2]=!0),removed1=heldOp1RmForOp2[slot2]||null):!removed1||side!==1&&op1PickAtOp2Pick[slot2]!=null||conflict==null&&(conflict={type:types_js_1.ConflictType.RM_UNEXPECTED_CONTENT,op1:exports2.removeOp(removed1.getPath()),op2:exports2.moveOp(r2Pick.getPath(),r2Drop.getPath())}),droppedHere=!0):c2d.i!==void 0&&(r1Pick=r2Pick=null,droppedHere=!0,removed1&&conflict==null&&(conflict={type:types_js_1.ConflictType.RM_UNEXPECTED_CONTENT,op1:exports2.removeOp(removed1.getPath()),op2:exports2.insertOp(r2Drop.getPath(),c2d.i)})));const c1p=getComponent(r1Pick);c1p&&(c1p.r!==void 0?removed1=r1Pick.clone():c1p.p!=null&&(c1p.p,pickSlot1=c1p.p,removed1=null));const t2=getEditType(c2d);t2&&removed1&&conflict==null&&(conflict={type:types_js_1.ConflictType.RM_UNEXPECTED_CONTENT,op1:exports2.removeOp(removed1.getPath()),op2:exports2.editOp(r2Drop.getPath(),t2,getEdit(c2d),!0)});let p2PickOff=0,p2DropOff=0;const ap2=cursor_js_1.advancer(r2Pick,(k,c)=>hasPick(c)?p2PickOff-k-1:k-p2PickOff,(k,c)=>{hasPick(c)&&p2PickOff++}),ap1=cursor_js_1.advancer(r1Pick);for(const key of r2Drop)if(typeof key=="number"){const p2Mid=key-p2DropOff,_p2Pick=ap2(p2Mid);p2DropOff+=+scanOp2Drop(ap1(p2Mid+p2PickOff),_p2Pick,r2Drop,pickSlot1,removed1)}else{const _p2Pick=ap2(key);scanOp2Drop(ap1(key),_p2Pick,r2Drop,pickSlot1,removed1)}return ap2.end(),ap1.end(),droppedHere},"scanOp2Drop")(r1,r2,r2.clone(),null,null),heldOp2DropByOp2.map(x=>x&&x.get()),conflict)return{ok:!1,conflict};discardedOp2Drop.map(x=>!!x);const pickComponents=[];let cancelledRemoves=null;__name(function writeOp1Pick(r1Pick,r2Pick,r2Drop,w2,removed2){let iAmMoved=!1;const c2p=getComponent(r2Pick);if(hasPick(c2p)){const slot2=c2p.p;slot2!=null?(r2Drop=heldOp2DropByOp2[slot2],w2=heldPickWrites[slot2]=cursor_js_1.writeCursor(),iAmMoved=!0,removed2=null):(r2Drop=null,removed2=r2Pick.clone())}else hasDrop(getComponent(r2Drop))&&(r2Drop=null);const c1=r1Pick.getComponent();if(c1){const slot1=c1.p;slot1!=null?(removed2&&(heldOp2RmForOp1[slot1]=removed2),pickComponents[slot1]=removed2||side===1&&iAmMoved?null:w2.getComponent(),heldOp1PickByOp1[slot1]=r1Pick.clone(),r2Drop&&(heldOp2DropByOp1[slot1]=r2Drop.clone())):c1.r!==void 0&&(removed2||w2.write("r",!0),(removed2||iAmMoved)&&(cancelledRemoves==null&&(cancelledRemoves=new Set),cancelledRemoves.add(c1)))}let p2PickOff=0,p2DropOff=0;const ap2Pick=cursor_js_1.advancer(r2Pick,void 0,(k,c)=>{hasPick(c)&&p2PickOff++}),ap2Drop=cursor_js_1.advancer(r2Drop,(k,c)=>hasDrop(c)?~(k-p2DropOff):k-p2DropOff,(k,c)=>{hasDrop(c)&&p2DropOff++});if(r1Pick)for(const key of r1Pick)if(typeof key=="string"){const p2Pick_=ap2Pick(key),p2Drop_=ap2Drop(key);w2.descend(key),writeOp1Pick(r1Pick,p2Pick_,p2Drop_,w2,removed2),w2.ascend()}else{const p2Pick_=ap2Pick(key),p2Mid=key-p2PickOff,p2Drop_=hasPick(getComponent(p2Pick_))?null:ap2Drop(p2Mid),finalKey=p2Mid+p2DropOff;assert(finalKey>=0),w2.descend(finalKey),writeOp1Pick(r1Pick,p2Pick_,p2Drop_,w2,removed2),w2.ascend()}ap2Pick.end(),ap2Drop.end()},"writeOp1Pick")(r1,r2,r2.clone(),w,null),w.reset();let outputSlotMap=[];if(__name(function writeOp1Drop(p1Pick,p1Drop,p2Pick,p2Drop,w2,removed2){assert(p1Drop);const c1d=p1Drop.getComponent();let c2d=getComponent(p2Drop),droppedHere=!1;const insOrMv=__name((r12,r22,c)=>r12?exports2.moveOp(r12.getPath(),r22.getPath()):exports2.insertOp(r22.getPath(),c.i),"insOrMv");if(hasDrop(c1d)){const slot1=c1d.d;slot1!=null&&(heldOp1DropByOp1[slot1]=p1Drop.clone());const pc=slot1!=null?pickComponents[slot1]:null;let identical=!1;if(c1d.i!==void 0||slot1!=null&&pc){let slot2;c2d&&(c2d.i!==void 0||(slot2=c2d.d)!=null&&!cancelledOp2[slot2])&&(identical=slot2!=null?slot1!=null&&slot1===op1PickAtOp2Pick[slot2]:deepEqual_js_1.default(c2d.i,c1d.i),identical||slot2!=null&&side!==1&&op1PickAtOp2Pick[slot2]!=null||conflict==null&&(conflict={type:types_js_1.ConflictType.DROP_COLLISION,op1:insOrMv(slot1!=null?heldOp1PickByOp1[slot1]:null,p1Drop,c1d),op2:insOrMv(slot2!=null?heldOp2PickByOp2[slot2]:null,p2Drop,c2d)})),identical||(removed2?conflict==null&&(conflict={type:types_js_1.ConflictType.RM_UNEXPECTED_CONTENT,op1:insOrMv(slot1!=null?heldOp1PickByOp1[slot1]:null,p1Drop,c1d),op2:exports2.removeOp(removed2.getPath())}):(slot1!=null?(outputSlotMap[nextSlot]=slot1,w2.write("d",pc.p=nextSlot++)):w2.write("i",deepClone_js_1.default(c1d.i)),droppedHere=!0))}else if(slot1!=null&&!pc){const h=heldOp2RmForOp1[slot1];h&&(removed2=h.clone())}slot1!=null?(p1Pick=heldOp1PickByOp1[slot1],p2Pick=heldOp2PickByOp1[slot1],p2Drop=heldOp2DropByOp1[slot1]):c1d.i!==void 0&&(p1Pick=p2Pick=null,identical||(p2Drop=null))}else hasPick(getComponent(p1Pick))&&(p1Pick=p2Pick=p2Drop=null);const c1p=getComponent(p1Pick),c2p=getComponent(p2Pick);if(hasPick(c2p)){const slot2=c2p.p;c2p.r!==void 0&&(!c1p||c1p.r===void 0)||cancelledOp2[slot2]?(p2Drop=null,removed2=p2Pick.clone()):slot2!=null&&(p2Drop=heldOp2DropByOp2[slot2],side!==1&&op1PickAtOp2Pick[slot2]!=null||((w2=heldDropWrites[slot2])||(w2=heldDropWrites[slot2]=cursor_js_1.writeCursor()),w2.reset(),removed2=null))}else!hasDrop(c1d)&&hasDrop(c2d)&&(p2Drop=null);c2d=p2Drop!=null?p2Drop.getComponent():null;const t1=getEditType(c1d);if(t1){const e1=getEdit(c1d);if(removed2)conflict==null&&(conflict={type:types_js_1.ConflictType.RM_UNEXPECTED_CONTENT,op1:exports2.editOp(p1Drop.getPath(),t1,e1,!0),op2:exports2.removeOp(removed2.getPath())});else{const t2=getEditType(c2d);let e;if(t2){if(t1!==t2)throw Error("Transforming incompatible types");const e2=getEdit(c2d);e=t1.transform(e1,e2,direction)}else e=deepClone_js_1.default(e1);writeEdit(w2,t1,e)}}let p1PickOff=0,p1DropOff=0,p2PickOff=0,p2DropOff=0,outPickOff=0,outDropOff=0,p1pValid=p1Pick!=null&&p1Pick.descendFirst(),p1pDidDescend=p1pValid;const ap2p=cursor_js_1.advancer(p2Pick,void 0,(k,c)=>{hasPick(c)&&p2PickOff++});let p2dValid=p2Drop!=null&&p2Drop.descendFirst(),p2dDidDescend=p2dValid;for(const key of p1Drop)if(typeof key=="number"){let _p1Pick;const hd1=hasDrop(p1Drop.getComponent()),k1Mid=key-p1DropOff;{let p1k;for(;p1pValid&&typeof(p1k=p1Pick.getKey())=="number";){p1k+=p1PickOff;const c=p1Pick.getComponent(),hp=hasPick(c);if(p1k>k1Mid||p1k===k1Mid&&(!hp||side===0&&hd1))break;if(hp){p1PickOff--;const slot1=c.p;op1PickAtOp2Pick.includes(slot1),c.d,getComponent(heldDropWrites[c.d]),hasPick(getComponent(heldDropWrites[c.d])),(c.r===void 0||cancelledRemoves&&cancelledRemoves.has(c))&&(slot1==null||!pickComponents[slot1]||side!==1&&op1PickAtOp2Pick.includes(slot1))||outPickOff--}p1pValid=p1Pick.nextSibling()}_p1Pick=p1pValid&&p1k===k1Mid?p1Pick:null}const raw=k1Mid-p1PickOff;let _p2Pick=ap2p(raw);const k2Mid=raw-p2PickOff;let _p2Drop=null;{let p2dk,op2Mid;for(;p2dValid&&typeof(p2dk=p2Drop.getKey())=="number";){op2Mid=p2dk-p2DropOff;const c=p2Drop.getComponent(),hd2=hasDrop(c);if(op2Mid>k2Mid)break;if(op2Mid===k2Mid){if(!hd2){_p2Drop=p2Drop;break}{if(side===0&&hd1){_p2Drop=p2Drop;break}const hp2=_p2Pick&&hasPick(_p2Pick.getComponent());if(side===0&&hp2)break}}if(hd2){const slot2=c.d;cancelledOp2[slot2],op1PickAtOp2Pick[slot2],c.i===void 0&&(cancelledOp2[slot2]||op1PickAtOp2Pick[slot2]!=null&&side!==1)?(cancelledOp2[slot2]||op1PickAtOp2Pick[slot2]!=null&&side===0)&&(p2DropOff++,outDropOff--):p2DropOff++}p2dValid=p2Drop.nextSibling()}}const descend=k2Mid+p2DropOff+outPickOff+outDropOff;assert(descend>=0,"trying to descend to a negative index"),w2.descend(descend),hd1&&(_p1Pick=_p2Pick=_p2Drop=null,p1DropOff++),writeOp1Drop(_p1Pick,p1Drop,_p2Pick,_p2Drop,w2,removed2)&&outDropOff++,w2.ascend()}else{let p1k;for(;p1pValid&&(p1k=p1Pick.getKey(),typeof p1k!="string"||!(p1k>key||p1k===key));)p1pValid=p1Pick.nextSibling();const _p1Pick=p1pValid&&p1k===key?p1Pick:null,_p2Pick=ap2p(key);let p2dk;for(;p2dValid&&(p2dk=p2Drop.getKey(),typeof p2dk!="string"||!(p2dk>key||p2dk===key));)p2dValid=p2Drop.nextSibling();const _p2Drop=p2dValid&&p2dk===key?p2Drop:null;w2.descend(key),writeOp1Drop(_p1Pick,p1Drop,_p2Pick,_p2Drop,w2,removed2),w2.ascend()}return ap2p.end(),p1pDidDescend&&p1Pick.ascend(),p2dDidDescend&&p2Drop.ascend(),droppedHere},"writeOp1Drop")(r1,r1.clone(),r2,r2.clone(),w,null),conflict)return{ok:!1,conflict};w.reset();const eachDrop=__name((r,w2,fn)=>r.traverse(w2,(c,w3)=>{c.d!=null&&fn(c.d,r,w3)}),"eachDrop");(cancelledOp2.length||heldPickWrites.length)&&(eachDrop(r2,w,(slot2,r,w2)=>{cancelledOp2[slot2]&&!discardedOp2Drop[slot2]&&w2.write("r",!0),heldPickWrites[slot2]&&w2.mergeTree(heldPickWrites[slot2].get())}),w.reset());const heldOutDropRead=[],heldOutDropWrites=[];if((heldDropWrites.length||cancelledOp2.length)&&!conflict){const rOut=cursor_js_1.readCursor(shallowCloneOp(w.get()));if(eachDrop(rOut,null,(slotOut,r)=>{heldOutDropRead[slotOut]=r.clone()}),heldDropWrites.forEach(hdw=>{hdw&&eachDrop(cursor_js_1.readCursor(hdw.get()),null,(slotOut,r)=>{heldOutDropRead[slotOut]=r.clone()})}),__name(function writeHeldOp2Drop(p2Drop,outPick,outDrop,w2,parentC,removedOut){const coutp=getComponent(outPick);if(coutp&&hasPick(coutp))if(coutp.p!=null){const slot=coutp.p;heldOutDropRead[slot].getPath(),outDrop=heldOutDropRead[slot],w2=heldOutDropWrites[slot]=cursor_js_1.writeCursor()}else coutp.r!==void 0&&(outDrop=null);else hasDrop(getComponent(outDrop))&&(outDrop=null);const c2=p2Drop.getComponent();if(c2){let slot2;if((slot2=c2.d)!=null){const _w=heldDropWrites[slot2];_w&&(_w.get(),w2.mergeTree(_w.get()),outDrop=cursor_js_1.readCursor(_w.get()))}}let outPickOff=0,outDropOff=0;const oPickAdv=cursor_js_1.advancer(outPick,void 0,(k,c)=>{hasPick(c)&&outPickOff--}),oDropAdv=cursor_js_1.advancer(outDrop,(k,c)=>hasDrop(c)?-(k-outDropOff)-1:k-outDropOff,(k,c)=>{hasDrop(c)&&outDropOff++});for(const o2dk of p2Drop)if(typeof o2dk=="number"){const _outPick=oPickAdv(o2dk),rmid=o2dk+outPickOff,_outDrop=oDropAdv(rmid),rfinal=rmid+outDropOff;w2.descend(rfinal),writeHeldOp2Drop(p2Drop,_outPick,_outDrop,w2),w2.ascend()}else w2.descend(o2dk),writeHeldOp2Drop(p2Drop,oPickAdv(o2dk),oDropAdv(o2dk),w2),w2.ascend();oPickAdv.end(),oDropAdv.end()},"writeHeldOp2Drop")(r2,rOut,rOut.clone(),w),w.reset(),conflict)return{ok:!1,conflict};if(w.get(),heldOutDropWrites.length){const heldOutDropContent=heldOutDropWrites.map(w2=>w2?w2.get():null),rOut2=cursor_js_1.readCursor(shallowCloneOp(w.get()));if(eachDrop(rOut2,w,(slotOut,r,w2)=>{const data=heldOutDropContent[slotOut];data&&(w2.mergeTree(data),heldOutDropContent[slotOut]=null)}),heldOutDropContent.find(x=>x)){const w1=cursor_js_1.writeCursor(),w2=cursor_js_1.writeCursor();let nextSlot1=0,nextSlot2=0;heldOutDropContent.forEach(data=>{data!=null&&eachDrop(cursor_js_1.readCursor(data),null,c=>{const slot1=outputSlotMap[c];w1.writeMove(heldOp1PickByOp1[slot1].getPath(),heldOp1DropByOp1[slot1].getPath(),nextSlot1++);const slot2s=op1PicksOp2DropSlots[slot1];slot2s&&slot2s.forEach(slot2=>{cancelledOp2[slot2]||side!==1&&op1PickAtOp2Pick[slot2]!=null||w2.writeMove(heldOp2PickByOp2[slot2].getPath(),heldOp2DropByOp2[slot2].getPath(),nextSlot2++)})})}),conflict={type:types_js_1.ConflictType.BLACKHOLE,op1:w1.get(),op2:w2.get()}}}}return conflict?{ok:!1,conflict}:{ok:!0,result:w.get()}}__name(tryTransform,"tryTransform");const throwConflictErr=__name(conflict=>{const err=new Error("Transform detected write conflict");throw err.conflict=conflict,err.type=err.name="writeConflict",err},"throwConflictErr");function transform(op1,op2,side){const res=tryTransform(op1,op2,side);if(res.ok)return res.result;throwConflictErr(res.conflict)}__name(transform,"transform");const opThatRemovesDE=__name(op=>{const w=cursor_js_1.writeCursor();return cursor_js_1.readCursor(op).traverse(w,(c,w2)=>{(hasDrop(c)||getEditType(c))&&w2.write("r",!0)}),w.get()},"opThatRemovesDE"),resolveConflict=__name((conflict,side)=>{const{type:type2,op1,op2}=conflict;switch(type2){case types_js_1.ConflictType.DROP_COLLISION:return side==="left"?[null,opThatRemovesDE(op2)]:[opThatRemovesDE(op1),null];case types_js_1.ConflictType.RM_UNEXPECTED_CONTENT:let op1HasRemove=!1;return cursor_js_1.readCursor(op1).traverse(null,c=>{c.r!==void 0&&(op1HasRemove=!0)}),op1HasRemove?[null,opThatRemovesDE(op2)]:[opThatRemovesDE(op1),null];case types_js_1.ConflictType.BLACKHOLE:return[opThatRemovesDE(op1),opThatRemovesDE(op2)];default:throw Error("Unrecognised conflict: "+type2)}},"resolveConflict");function transformWithConflictsPred(allowConflict,op1,op2,side){let r2Aggregate=null;for(;;){const res=tryTransform(op1,op2,side);if(res.ok)return compose(r2Aggregate,res.result);{const{conflict}=res;allowConflict(conflict)||throwConflictErr(conflict);const[r1,r2]=resolveConflict(conflict,side);op1=compose(normalize(op1),r1),op2=compose(normalize(op2),r2),r2Aggregate=compose(r2Aggregate,r2)}}}__name(transformWithConflictsPred,"transformWithConflictsPred")}(json1_release)),json1_release}__name(requireJson1_release,"requireJson1_release");var hasRequiredDist;function requireDist(){return hasRequiredDist||(hasRequiredDist=1,function(exports2){var __createBinding=dist$1.__createBinding||(Object.create?function(o,m,k,k2){k2===void 0&&(k2=k),Object.defineProperty(o,k2,{enumerable:!0,get:__name(function(){return m[k]},"get")})}:function(o,m,k,k2){k2===void 0&&(k2=k),o[k2]=m[k]}),__exportStar=dist$1.__exportStar||function(m,exports3){for(var p in m)p!=="default"&&!exports3.hasOwnProperty(p)&&__createBinding(exports3,m,p)};Object.defineProperty(exports2,"__esModule",{value:!0}),__exportStar(requireJson1_release(),exports2);var cursor_js_1=requireCursor();Object.defineProperty(exports2,"ReadCursor",{enumerable:!0,get:__name(function(){return cursor_js_1.ReadCursor},"get")}),Object.defineProperty(exports2,"WriteCursor",{enumerable:!0,get:__name(function(){return cursor_js_1.WriteCursor},"get")});var types_1=requireTypes();Object.defineProperty(exports2,"ConflictType",{enumerable:!0,get:__name(function(){return types_1.ConflictType},"get")})}(dist$1)),dist$1}__name(requireDist,"requireDist");var distExports=requireDist();const index=getDefaultExportFromCjs(distExports),index$1=_mergeNamespaces({__proto__:null,default:index},[distExports]);var TextXActionType=(TextXActionType2=>(TextXActionType2.RETAIN="r",TextXActionType2.INSERT="i",TextXActionType2.DELETE="d",TextXActionType2))(TextXActionType||{});function normalizeTextRuns(textRuns,reserveEmptyTextRun=!1){const results=[];for(const textRun of textRuns){const{st,ed,ts}=textRun;if(textRun.sId===void 0&&delete textRun.sId,st===ed||!reserveEmptyTextRun&&Tools.isEmptyObject(ts)&&textRun.sId==null)continue;if(results.length===0){results.push(textRun);continue}const peak=results.pop();isSameStyleTextRun(textRun,peak)&&Tools.hasIntersectionBetweenTwoRanges(peak.st,peak.ed,textRun.st,textRun.ed)?results.push({...textRun,st:peak.st,ed}):results.push(peak,textRun)}return results}__name(normalizeTextRuns,"normalizeTextRuns");function insertTextRuns(body,insertBody,textLength,currentIndex){var _a17;const{textRuns}=body;if(textRuns==null)return;const newTextRuns=[],len=textRuns.length;let hasInserted=!1;const insertTextRuns2=(_a17=insertBody.textRuns)!=null?_a17:[];if(insertTextRuns2.length)for(const insertTextRun of insertTextRuns2)insertTextRun.st+=currentIndex,insertTextRun.ed+=currentIndex;for(let i=0;i<len;i++){const textRun=textRuns[i],{st,ed}=textRun;if(ed<=currentIndex)newTextRuns.push(textRun);else if(currentIndex>st&&currentIndex<ed){hasInserted=!0;const firstSplitTextRun={...textRun,ed:currentIndex};newTextRuns.push(firstSplitTextRun),insertTextRuns2.length&&newTextRuns.push(...insertTextRuns2);const lastSplitTextRun={...textRun,st:currentIndex+textLength,ed:ed+textLength};newTextRuns.push(lastSplitTextRun)}else textRun.st+=textLength,textRun.ed+=textLength,hasInserted||(hasInserted=!0,newTextRuns.push(...insertTextRuns2)),newTextRuns.push(textRun)}hasInserted||(hasInserted=!0,newTextRuns.push(...insertTextRuns2)),body.textRuns=normalizeTextRuns(newTextRuns)}__name(insertTextRuns,"insertTextRuns");function insertParagraphs(body,insertBody,textLength,currentIndex){const{paragraphs}=body;if(paragraphs==null)return;const{paragraphs:insertParagraphs2}=insertBody,paragraphIndexList=[];for(let i=0,len=paragraphs.length;i<len;i++){const paragraph=paragraphs[i],{startIndex}=paragraph;startIndex>=currentIndex&&(paragraph.startIndex+=textLength),paragraphIndexList.push(paragraph.startIndex)}let deleteReptIndex=-1;if(insertParagraphs2){for(let i=0,len=insertParagraphs2.length;i<len;i++){const insertParagraph=insertParagraphs2[i];insertParagraph.startIndex+=currentIndex;const insertIndex=insertParagraph.startIndex;deleteReptIndex=paragraphIndexList.indexOf(insertIndex)}deleteReptIndex!==-1&&paragraphs.splice(deleteReptIndex,1),paragraphs.push(...insertParagraphs2),paragraphs.sort(sortRulesFactory("startIndex"))}}__name(insertParagraphs,"insertParagraphs");function insertSectionBreaks(body,insertBody,textLength,currentIndex){const{sectionBreaks}=body;if(sectionBreaks==null)return;for(let i=0,len=sectionBreaks.length;i<len;i++){const sectionBreak=sectionBreaks[i],{startIndex}=sectionBreak;startIndex>=currentIndex&&(sectionBreak.startIndex+=textLength)}const insertSectionBreaks2=insertBody.sectionBreaks;if(insertSectionBreaks2){for(let i=0,len=insertSectionBreaks2.length;i<len;i++){const sectionBreak=insertSectionBreaks2[i];sectionBreak.startIndex+=currentIndex}sectionBreaks.push(...insertSectionBreaks2),sectionBreaks.sort(sortRulesFactory("startIndex"))}}__name(insertSectionBreaks,"insertSectionBreaks");function insertCustomBlocks(body,insertBody,textLength,currentIndex){const{customBlocks=[]}=body;for(let i=0,len=customBlocks.length;i<len;i++){const customBlock=customBlocks[i],{startIndex}=customBlock;startIndex>=currentIndex&&(customBlock.startIndex+=textLength)}const insertCustomBlocks2=insertBody.customBlocks;if(insertCustomBlocks2){for(let i=0,len=insertCustomBlocks2.length;i<len;i++){const customBlock=insertCustomBlocks2[i];customBlock.startIndex+=currentIndex}customBlocks.push(...insertCustomBlocks2),customBlocks.sort(sortRulesFactory("startIndex"))}customBlocks.length&&!body.customBlocks&&(body.customBlocks=customBlocks)}__name(insertCustomBlocks,"insertCustomBlocks");function insertTables(body,insertBody,textLength,currentIndex){const{tables}=body;if(tables==null)return;for(let i=0,len=tables.length;i<len;i++){const table=tables[i],{startIndex,endIndex}=table;startIndex>currentIndex?(table.startIndex+=textLength,table.endIndex+=textLength):endIndex>currentIndex&&(table.endIndex+=textLength)}const insertTables2=insertBody.tables;if(insertTables2){for(let i=0,len=insertTables2.length;i<len;i++){const table=insertTables2[i];table.startIndex+=currentIndex,table.endIndex+=currentIndex}tables.push(...insertTables2),tables.sort(sortRulesFactory("startIndex"))}}__name(insertTables,"insertTables");const ID_SPLIT_SYMBOL="$",getRootId=__name(id=>id.split(ID_SPLIT_SYMBOL)[0],"getRootId");function mergeContinuousRanges(ranges){if(ranges.length<=1)return ranges;ranges.sort((a,b)=>a.startIndex-b.startIndex);const mergedRanges=[];let currentRange={...ranges[0]};currentRange.rangeId=getRootId(currentRange.rangeId);for(let i=1;i<ranges.length;i++){const nextRange=ranges[i];nextRange.rangeId=getRootId(nextRange.rangeId),nextRange.rangeId===currentRange.rangeId&&shallowEqual(currentRange.properties,nextRange.properties)&&currentRange.endIndex+1>=nextRange.startIndex?currentRange.endIndex=nextRange.endIndex:(mergedRanges.push(currentRange),currentRange={...nextRange})}mergedRanges.push(currentRange);const idMap=Object.create(null);for(let i=0,len=mergedRanges.length;i<len;i++){const range=mergedRanges[i],id=range.rangeId;idMap[id]?(range.rangeId=`${id}${ID_SPLIT_SYMBOL}${idMap[id]}`,idMap[id]=idMap[id]+1):idMap[id]=1}return mergedRanges}__name(mergeContinuousRanges,"mergeContinuousRanges");function splitCustomRangesByIndex(customRanges,currentIndex){const matchedCustomRangeIndex=customRanges.findIndex(c=>c.startIndex<currentIndex&&c.endIndex>=currentIndex),matchedCustomRange=customRanges[matchedCustomRangeIndex];matchedCustomRange&&customRanges.splice(matchedCustomRangeIndex,1,{rangeId:matchedCustomRange.rangeId,rangeType:matchedCustomRange.rangeType,startIndex:matchedCustomRange.startIndex,endIndex:currentIndex-1,properties:{...matchedCustomRange.properties}},{rangeId:matchedCustomRange.rangeId,rangeType:matchedCustomRange.rangeType,startIndex:currentIndex,endIndex:matchedCustomRange.endIndex,properties:{...matchedCustomRange.properties}})}__name(splitCustomRangesByIndex,"splitCustomRangesByIndex");function mergeContinuousDecorations(ranges){if(ranges.length<=1)return ranges;ranges.sort((a,b)=>a.startIndex-b.startIndex);const mergedRanges=[];let currentRange={...ranges[0]};for(let i=1;i<ranges.length;i++){const nextRange=ranges[i];nextRange.id===currentRange.id&&currentRange.endIndex+1>=nextRange.startIndex?currentRange.endIndex=nextRange.endIndex:(mergedRanges.push(currentRange),currentRange={...nextRange})}return mergedRanges.push(currentRange),mergedRanges}__name(mergeContinuousDecorations,"mergeContinuousDecorations");function splitCustomDecoratesByIndex(customDecorations,currentIndex){customDecorations.filter(c=>c.startIndex<currentIndex&&c.endIndex>=currentIndex).forEach(matched=>{const index2=customDecorations.indexOf(matched);customDecorations.splice(index2,1,{id:matched.id,type:matched.type,startIndex:matched.startIndex,endIndex:currentIndex-1},{id:matched.id,type:matched.type,startIndex:currentIndex,endIndex:matched.endIndex})})}__name(splitCustomDecoratesByIndex,"splitCustomDecoratesByIndex");function insertCustomRanges(body,insertBody,textLength,currentIndex){body.customRanges||(body.customRanges=[]);const{customRanges}=body;splitCustomRangesByIndex(customRanges,currentIndex);for(let i=0,len=customRanges.length;i<len;i++){const customRange=customRanges[i],{startIndex}=customRange;startIndex>=currentIndex&&(customRange.startIndex+=textLength,customRange.endIndex+=textLength)}const insertRanges=[];if(insertBody.customRanges){for(let i=0,len=insertBody.customRanges.length;i<len;i++){const customRange=insertBody.customRanges[i];customRange.startIndex+=currentIndex,customRange.endIndex+=currentIndex,insertRanges.push(customRange)}customRanges.push(...insertRanges)}body.customRanges=mergeContinuousRanges(customRanges)}__name(insertCustomRanges,"insertCustomRanges");function insertCustomDecorations(body,insertBody,textLength,currentIndex){body.customDecorations||(body.customDecorations=[]);const{customDecorations}=body;splitCustomDecoratesByIndex(customDecorations,currentIndex);for(let i=0,len=customDecorations.length;i<len;i++){const customDecoration=customDecorations[i],{startIndex}=customDecoration;startIndex>=currentIndex&&(customDecoration.startIndex+=textLength,customDecoration.endIndex+=textLength)}const insertRanges=[];if(insertBody.customDecorations){for(let i=0,len=insertBody.customDecorations.length;i<len;i++){const customDecoration=insertBody.customDecorations[i];customDecoration.startIndex+=currentIndex,customDecoration.endIndex+=currentIndex,insertRanges.push(customDecoration)}customDecorations.push(...insertRanges)}body.customDecorations=mergeContinuousDecorations(customDecorations)}__name(insertCustomDecorations,"insertCustomDecorations");function deleteTextRuns(body,textLength,currentIndex){const{textRuns}=body,startIndex=currentIndex,endIndex=currentIndex+textLength,removeTextRuns=[];if(textRuns){const newTextRuns=[];for(let i=0,len=textRuns.length;i<len;i++){const textRun=textRuns[i],{st,ed}=textRun;if(startIndex<=st&&endIndex>=ed){removeTextRuns.push({...textRun,st:st-startIndex,ed:ed-startIndex});continue}else st<=startIndex&&ed>=endIndex?(removeTextRuns.push({...textRun,st:startIndex-startIndex,ed:endIndex-startIndex}),textRun.ed-=textLength):startIndex>=st&&startIndex<ed?(removeTextRuns.push({...textRun,st:startIndex-startIndex,ed:ed-startIndex}),textRun.ed=startIndex):endIndex>st&&endIndex<=ed?(removeTextRuns.push({...textRun,st:st-startIndex,ed:endIndex-startIndex}),textRun.st=endIndex-textLength,textRun.ed-=textLength):st>=endIndex&&(textRun.st-=textLength,textRun.ed-=textLength);newTextRuns.push(textRun)}body.textRuns=newTextRuns}return removeTextRuns.length===0&&removeTextRuns.push({st:0,ed:textLength,ts:{}}),removeTextRuns}__name(deleteTextRuns,"deleteTextRuns");function deleteParagraphs(body,textLength,currentIndex){const{paragraphs}=body,startIndex=currentIndex,endIndex=currentIndex+textLength,removeParagraphs=[];if(paragraphs){const newParagraphs=[];for(let i=0,len=paragraphs.length;i<len;i++){const paragraph=paragraphs[i],{startIndex:index2}=paragraph;if(index2>=startIndex&&index2<endIndex){removeParagraphs.push({...paragraph,startIndex:index2-currentIndex});continue}else index2>=endIndex&&(paragraph.startIndex-=textLength);newParagraphs.push(paragraph)}body.paragraphs=newParagraphs}return removeParagraphs}__name(deleteParagraphs,"deleteParagraphs");function deleteSectionBreaks(body,textLength,currentIndex){const{sectionBreaks}=body,startIndex=currentIndex,endIndex=currentIndex+textLength-1,removeSectionBreaks=[];if(sectionBreaks){const newSectionBreaks=[];for(let i=0,len=sectionBreaks.length;i<len;i++){const sectionBreak=sectionBreaks[i],{startIndex:index2}=sectionBreak;if(index2>=startIndex&&index2<=endIndex){removeSectionBreaks.push({...sectionBreak,startIndex:index2-currentIndex});continue}else index2>endIndex&&(sectionBreak.startIndex-=textLength);newSectionBreaks.push(sectionBreak)}body.sectionBreaks=newSectionBreaks}return removeSectionBreaks}__name(deleteSectionBreaks,"deleteSectionBreaks");function deleteCustomBlocks(body,textLength,currentIndex){const{customBlocks=[]}=body,startIndex=currentIndex,endIndex=currentIndex+textLength-1,removeCustomBlocks=[];if(customBlocks){const newCustomBlocks=[];for(let i=0,len=customBlocks.length;i<len;i++){const customBlock=customBlocks[i],{startIndex:index2}=customBlock;if(index2>=startIndex&&index2<=endIndex){removeCustomBlocks.push({...customBlock,startIndex:index2-currentIndex});continue}else index2>endIndex&&(customBlock.startIndex-=textLength);newCustomBlocks.push(customBlock)}body.customBlocks=newCustomBlocks}return customBlocks.length&&!body.customBlocks&&(body.customBlocks=customBlocks),removeCustomBlocks}__name(deleteCustomBlocks,"deleteCustomBlocks");function deleteTables(body,textLength,currentIndex){const{tables}=body,startIndex=currentIndex,endIndex=currentIndex+textLength-1,removeTables=[];if(tables){const newTables=[];for(let i=0,len=tables.length;i<len;i++){const table=tables[i],{startIndex:st,endIndex:ed}=table;if(startIndex<=st&&endIndex>=ed){removeTables.push({...table,startIndex:st-currentIndex,endIndex:ed-currentIndex});continue}else if(st<=startIndex&&ed>=endIndex){const segments=horizontalLineSegmentsSubtraction(st,ed,startIndex,endIndex);if(segments.length===0||(table.startIndex=segments[0],table.endIndex=segments[1],table.startIndex===table.endIndex))continue}else endIndex<st&&(table.startIndex-=textLength,table.endIndex-=textLength);newTables.push(table)}body.tables=newTables}return removeTables}__name(deleteTables,"deleteTables");function deleteCustomRanges(body,textLength,currentIndex){const{customRanges}=body,startIndex=currentIndex,endIndex=currentIndex+textLength-1,removeCustomRanges=[];if(customRanges){const newCustomRanges=[];for(let i=0,len=customRanges.length;i<len;i++){const customRange=customRanges[i],{startIndex:st,endIndex:ed}=customRange;if(st>=startIndex&&ed<=endIndex){removeCustomRanges.push(customRange);continue}else if(Math.max(startIndex,st)<=Math.min(endIndex,ed)){const segments=horizontalLineSegmentsSubtraction(st,ed,startIndex,endIndex);if(segments.length===0)continue;customRange.startIndex=segments[0],customRange.endIndex=segments[1]}else endIndex<st&&(customRange.startIndex-=textLength,customRange.endIndex-=textLength);newCustomRanges.push(customRange)}body.customRanges=mergeContinuousRanges(newCustomRanges)}return removeCustomRanges}__name(deleteCustomRanges,"deleteCustomRanges");function deleteCustomDecorations(body,textLength,currentIndex,needOffset=!0){const{customDecorations}=body,startIndex=currentIndex,endIndex=currentIndex+textLength-1,removeCustomDecorations=[];if(customDecorations){const newCustomDecorations=[];for(let i=0,len=customDecorations.length;i<len;i++){const customDecoration=customDecorations[i],{startIndex:st,endIndex:ed}=customDecoration;if(st>=startIndex&&ed<=endIndex){removeCustomDecorations.push(customDecoration);continue}else if(Math.max(startIndex,st)<=Math.min(endIndex,ed)){const segments=horizontalLineSegmentsSubtraction(st,ed,startIndex,endIndex);if(segments.length===0)continue;customDecoration.startIndex=segments[0],customDecoration.endIndex=segments[1]}else endIndex<st&&needOffset&&(customDecoration.startIndex-=textLength,customDecoration.endIndex-=textLength);newCustomDecorations.push(customDecoration)}body.customDecorations=newCustomDecorations}return removeCustomDecorations}__name(deleteCustomDecorations,"deleteCustomDecorations");var QuickListType=(QuickListType2=>(QuickListType2.ORDER_LIST_QUICK_1="1.",QuickListType2.ORDER_LIST_QUICK_2="a)",QuickListType2.ORDER_LIST_QUICK_3="a.",QuickListType2.ORDER_LIST_QUICK_4="i.",QuickListType2.ORDER_LIST_QUICK_5="A.",QuickListType2.ORDER_LIST_QUICK_6="I.",QuickListType2.ORDER_LIST_QUICK_7="01.",QuickListType2))(QuickListType||{}),PresetListType=(PresetListType2=>(PresetListType2.BULLET_LIST="BULLET_LIST",PresetListType2.BULLET_LIST_1="BULLET_LIST_1",PresetListType2.BULLET_LIST_2="BULLET_LIST_2",PresetListType2.BULLET_LIST_3="BULLET_LIST_3",PresetListType2.BULLET_LIST_4="BULLET_LIST_4",PresetListType2.BULLET_LIST_5="BULLET_LIST_5",PresetListType2.ORDER_LIST="ORDER_LIST",PresetListType2.ORDER_LIST_1="ORDER_LIST_1",PresetListType2.ORDER_LIST_2="ORDER_LIST_2",PresetListType2.ORDER_LIST_3="ORDER_LIST_3",PresetListType2.ORDER_LIST_4="ORDER_LIST_4",PresetListType2.ORDER_LIST_5="ORDER_LIST_5",PresetListType2.ORDER_LIST_QUICK_2="ORDER_LIST_QUICK_2",PresetListType2.ORDER_LIST_QUICK_3="ORDER_LIST_QUICK_3",PresetListType2.ORDER_LIST_QUICK_4="ORDER_LIST_QUICK_4",PresetListType2.ORDER_LIST_QUICK_5="ORDER_LIST_QUICK_5",PresetListType2.ORDER_LIST_QUICK_6="ORDER_LIST_QUICK_6",PresetListType2.CHECK_LIST="CHECK_LIST",PresetListType2.CHECK_LIST_CHECKED="CHECK_LIST_CHECKED",PresetListType2))(PresetListType||{});const orderListSymbolMap={"a)":{glyphFormat:"%1)",glyphType:ListGlyphType.DECIMAL},"1.":{glyphFormat:"%1.",glyphType:ListGlyphType.DECIMAL},"a.":{glyphFormat:"%1.",glyphType:ListGlyphType.LOWER_LETTER},"A.":{glyphFormat:"%1.",glyphType:ListGlyphType.UPPER_LETTER},"i.":{glyphFormat:"%1.",glyphType:ListGlyphType.LOWER_ROMAN},"I.":{glyphFormat:"%1.",glyphType:ListGlyphType.UPPER_LETTER}},bulletListFactory=__name(symbols=>[...symbols,...symbols,...symbols].map((templateSymbol,i)=>({glyphFormat:` %${i+1}`,glyphSymbol:templateSymbol,bulletAlignment:BulletAlignment.START,textStyle:{fs:12},startNumber:0,paragraphProperties:{hanging:{v:21},indentStart:{v:21*i}}})),"bulletListFactory"),orderListFactory=__name(options=>options.map((format,i)=>({...format,bulletAlignment:BulletAlignment.START,textStyle:{fs:12},startNumber:0,paragraphProperties:{hanging:{v:21},indentStart:{v:21*i}}})),"orderListFactory"),checkListFactory=__name((symbol,textStyle)=>new Array(9).fill(0).map((_2,i)=>({glyphFormat:` %${i+1}`,glyphSymbol:symbol,bulletAlignment:BulletAlignment.START,textStyle:{fs:16},startNumber:0,paragraphProperties:{hanging:{v:21},indentStart:{v:21*i},textStyle}})),"checkListFactory"),PRESET_LIST_TYPE={BULLET_LIST:{listType:"BULLET_LIST",nestingLevel:bulletListFactory(["●","○","■"])},BULLET_LIST_1:{listType:"BULLET_LIST",nestingLevel:bulletListFactory(["❖","➢","■"])},BULLET_LIST_2:{listType:"BULLET_LIST",nestingLevel:bulletListFactory(["✔","●","◆"])},BULLET_LIST_3:{listType:"BULLET_LIST",nestingLevel:bulletListFactory(["■","◆","○"])},BULLET_LIST_4:{listType:"BULLET_LIST",nestingLevel:bulletListFactory(["✧","○","■"])},BULLET_LIST_5:{listType:"BULLET_LIST",nestingLevel:bulletListFactory(["➢","○","◆"])},ORDER_LIST:{listType:"ORDER_LIST",nestingLevel:orderListFactory([{glyphFormat:"%1.",glyphType:ListGlyphType.DECIMAL},{glyphFormat:"%2.",glyphType:ListGlyphType.LOWER_LETTER},{glyphFormat:"%3.",glyphType:ListGlyphType.LOWER_ROMAN},{glyphFormat:"%4.",glyphType:ListGlyphType.DECIMAL},{glyphFormat:"%5.",glyphType:ListGlyphType.LOWER_LETTER},{glyphFormat:"%6.",glyphType:ListGlyphType.LOWER_ROMAN},{glyphFormat:"%7.",glyphType:ListGlyphType.DECIMAL},{glyphFormat:"%8.",glyphType:ListGlyphType.LOWER_LETTER},{glyphFormat:"%9.",glyphType:ListGlyphType.LOWER_ROMAN}])},ORDER_LIST_1:{listType:"ORDER_LIST",nestingLevel:orderListFactory([{glyphFormat:"%1)",glyphType:ListGlyphType.DECIMAL},{glyphFormat:"%2)",glyphType:ListGlyphType.LOWER_LETTER},{glyphFormat:"%3)",glyphType:ListGlyphType.LOWER_ROMAN},{glyphFormat:"%4)",glyphType:ListGlyphType.DECIMAL},{glyphFormat:"%5)",glyphType:ListGlyphType.LOWER_LETTER},{glyphFormat:"%6)",glyphType:ListGlyphType.LOWER_ROMAN},{glyphFormat:"%7)",glyphType:ListGlyphType.DECIMAL},{glyphFormat:"%8)",glyphType:ListGlyphType.LOWER_LETTER},{glyphFormat:"%9)",glyphType:ListGlyphType.LOWER_ROMAN}])},ORDER_LIST_2:{listType:"ORDER_LIST",nestingLevel:orderListFactory(["%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(format=>({glyphFormat:format,glyphType:ListGlyphType.DECIMAL})))},ORDER_LIST_3:{listType:"ORDER_LIST",nestingLevel:orderListFactory([{glyphFormat:"%1.",glyphType:ListGlyphType.UPPER_LETTER},{glyphFormat:"%2.",glyphType:ListGlyphType.LOWER_LETTER},{glyphFormat:"%3.",glyphType:ListGlyphType.LOWER_ROMAN},{glyphFormat:"%4.",glyphType:ListGlyphType.UPPER_LETTER},{glyphFormat:"%5.",glyphType:ListGlyphType.LOWER_LETTER},{glyphFormat:"%6.",glyphType:ListGlyphType.LOWER_ROMAN},{glyphFormat:"%7.",glyphType:ListGlyphType.UPPER_LETTER},{glyphFormat:"%8.",glyphType:ListGlyphType.LOWER_LETTER},{glyphFormat:"%9.",glyphType:ListGlyphType.LOWER_ROMAN}])},ORDER_LIST_4:{listType:"ORDER_LIST",nestingLevel:orderListFactory([{glyphFormat:"%1.",glyphType:ListGlyphType.UPPER_LETTER},{glyphFormat:"%2.",glyphType:ListGlyphType.DECIMAL},{glyphFormat:"%3.",glyphType:ListGlyphType.LOWER_ROMAN},{glyphFormat:"%4.",glyphType:ListGlyphType.UPPER_LETTER},{glyphFormat:"%5.",glyphType:ListGlyphType.DECIMAL},{glyphFormat:"%6.",glyphType:ListGlyphType.LOWER_ROMAN},{glyphFormat:"%7.",glyphType:ListGlyphType.UPPER_LETTER},{glyphFormat:"%8.",glyphType:ListGlyphType.DECIMAL},{glyphFormat:"%9.",glyphType:ListGlyphType.LOWER_ROMAN}])},ORDER_LIST_5:{listType:"ORDER_LIST",nestingLevel:orderListFactory([{glyphFormat:"%1.",glyphType:ListGlyphType.DECIMAL_ZERO},{glyphFormat:"%2.",glyphType:ListGlyphType.LOWER_LETTER},{glyphFormat:"%3.",glyphType:ListGlyphType.LOWER_ROMAN},{glyphFormat:"%4.",glyphType:ListGlyphType.DECIMAL_ZERO},{glyphFormat:"%5.",glyphType:ListGlyphType.LOWER_LETTER},{glyphFormat:"%6.",glyphType:ListGlyphType.LOWER_ROMAN},{glyphFormat:"%7.",glyphType:ListGlyphType.DECIMAL_ZERO},{glyphFormat:"%8.",glyphType:ListGlyphType.LOWER_LETTER},{glyphFormat:"%9.",glyphType:ListGlyphType.LOWER_ROMAN}])},CHECK_LIST:{listType:"CHECK_LIST",nestingLevel:checkListFactory("☐")},CHECK_LIST_CHECKED:{listType:"CHECK_LIST_CHECKED",nestingLevel:checkListFactory("☑",{st:{s:BooleanNumber.TRUE}})}},generateOrderList=__name(opt=>{const{glyphFormat,glyphType}=opt,data=Tools.deepClone(PRESET_LIST_TYPE.ORDER_LIST);return data.nestingLevel[0].glyphFormat=glyphFormat,data.nestingLevel[0].glyphType=glyphType,data},"generateOrderList"),QUICK_LIST_TYPE={ORDER_LIST_QUICK_2:generateOrderList(orderListSymbolMap["a)"]),ORDER_LIST_QUICK_3:generateOrderList(orderListSymbolMap["a."]),ORDER_LIST_QUICK_4:generateOrderList(orderListSymbolMap["i."]),ORDER_LIST_QUICK_6:generateOrderList(orderListSymbolMap["I."])};Object.assign(PRESET_LIST_TYPE,QUICK_LIST_TYPE);const QuickListTypeMap={"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"};function updateAttribute(body,updateBody,textLength,currentIndex,coverType){const removeTextRuns=updateTextRuns(body,updateBody,textLength,currentIndex,coverType),removeParagraphs=updateParagraphs(body,updateBody,textLength,currentIndex,coverType),removeSectionBreaks=updateSectionBreaks(body,updateBody,textLength,currentIndex,coverType),removeCustomBlocks=updateCustomBlocks(body,updateBody,textLength,currentIndex,coverType),removeTables=updateTables(body,updateBody,textLength,currentIndex,coverType),removeCustomRanges=updateCustomRanges(body,updateBody,textLength,currentIndex),removeCustomDecorations=updateCustomDecorations(body,updateBody,textLength,currentIndex,coverType);return{dataStream:"",textRuns:removeTextRuns,paragraphs:removeParagraphs,sectionBreaks:removeSectionBreaks,customBlocks:removeCustomBlocks,tables:removeTables,customRanges:removeCustomRanges,customDecorations:removeCustomDecorations}}__name(updateAttribute,"updateAttribute");function updateTextRuns(body,updateBody,textLength,currentIndex,coverType){const{textRuns}=body,{textRuns:updateTextRuns2}=updateBody;if(textRuns==null||updateTextRuns2==null)return;const removeTextRuns=deleteTextRuns(body,textLength,currentIndex);if(coverType!==UpdateDocsAttributeType.REPLACE){const newUpdateTextRun=coverTextRuns(updateTextRuns2,removeTextRuns,coverType);updateBody.textRuns=newUpdateTextRun}return insertTextRuns(body,updateBody,textLength,currentIndex),removeTextRuns}__name(updateTextRuns,"updateTextRuns");function coverTextRuns(updateDataTextRuns,originTextRuns,coverType){if(originTextRuns.length===0)return updateDataTextRuns;updateDataTextRuns=Tools.deepClone(updateDataTextRuns),originTextRuns=Tools.deepClone(originTextRuns);const newUpdateTextRuns=[],updateLength=updateDataTextRuns.length,removeLength=originTextRuns.length;let updateIndex=0,removeIndex=0,pending=null;function pushPendingAndReturnStatus(){return pending?(newUpdateTextRuns.push(pending),pending=null,!0):!1}for(__name(pushPendingAndReturnStatus,"pushPendingAndReturnStatus");updateIndex<updateLength&&removeIndex<removeLength;){const{st:updateSt,ed:updateEd,ts:updateStyle}=updateDataTextRuns[updateIndex],{st:removeSt,ed:removeEd,ts:originStyle,sId}=originTextRuns[removeIndex];let newTs;if(coverType===UpdateDocsAttributeType.COVER?newTs={...originStyle,...updateStyle}:newTs={...updateStyle},updateEd<removeSt)pushPendingAndReturnStatus()||newUpdateTextRuns.push(updateDataTextRuns[updateIndex]),updateIndex++;else if(removeEd<updateSt)pushPendingAndReturnStatus()||newUpdateTextRuns.push(originTextRuns[removeIndex]),removeIndex++;else{const newTextRun={st:Math.min(updateSt,removeSt),ed:Math.max(updateSt,removeSt),ts:updateSt<removeSt?{...updateStyle}:{...originStyle},sId:updateSt<removeSt?void 0:sId};newTextRun.ed>newTextRun.st&&newUpdateTextRuns.push(newTextRun),newUpdateTextRuns.push({st:Math.max(updateSt,removeSt),ed:Math.min(updateEd,removeEd),ts:newTs,sId}),updateEd<removeEd?(updateIndex++,originTextRuns[removeIndex].st=updateEd,originTextRuns[removeIndex].st===originTextRuns[removeIndex].ed&&removeIndex++):(removeIndex++,updateDataTextRuns[updateIndex].st=removeEd,updateDataTextRuns[updateIndex].st===updateDataTextRuns[updateIndex].ed&&updateIndex++);const pendingTextRun={st:Math.min(updateEd,removeEd),ed:Math.max(updateEd,removeEd),ts:updateEd<removeEd?{...originStyle}:{...updateStyle},sId:updateEd<removeEd?sId:void 0};pending=pendingTextRun.ed>pendingTextRun.st?pendingTextRun:null}}pushPendingAndReturnStatus();const tempTopTextRun=newUpdateTextRuns[newUpdateTextRuns.length-1],updateLastTextRun=updateDataTextRuns[updateLength-1],removeLastTextRun=originTextRuns[removeLength-1];return tempTopTextRun&&tempTopTextRun.ed!==Math.max(updateLastTextRun.ed,removeLastTextRun.ed)&&(updateLastTextRun.ed>removeLastTextRun.ed?newUpdateTextRuns.push(updateLastTextRun):newUpdateTextRuns.push(removeLastTextRun)),normalizeTextRuns(newUpdateTextRuns)}__name(coverTextRuns,"coverTextRuns");function updateParagraphs(body,updateBody,textLength,currentIndex,coverType){const{paragraphs}=body,{paragraphs:updateDataParagraphs}=updateBody;if(paragraphs==null||updateDataParagraphs==null)return;const removeParagraphs=deleteParagraphs(body,textLength,currentIndex);if(coverType!==UpdateDocsAttributeType.REPLACE){const newUpdateParagraphs=[];for(const updateParagraph of updateDataParagraphs){const{startIndex:updateStartIndex,paragraphStyle:updateParagraphStyle,bullet:updateBullet}=updateParagraph;let splitUpdateParagraphs=[];for(const removeParagraph of removeParagraphs){const{startIndex:removeStartIndex,paragraphStyle:removeParagraphStyle,bullet:removeBullet}=removeParagraph;let newParagraphStyle,newBullet;if(coverType===UpdateDocsAttributeType.COVER?(newParagraphStyle={...removeParagraphStyle,...updateParagraphStyle},newBullet={listId:"",listType:PresetListType.BULLET_LIST,nestingLevel:0,textStyle:{},...removeBullet,...updateBullet}):(newParagraphStyle={...updateParagraphStyle,...removeParagraphStyle},newBullet={listId:"",listType:PresetListType.BULLET_LIST,nestingLevel:0,textStyle:{},...updateBullet,...removeBullet}),updateStartIndex===removeStartIndex){splitUpdateParagraphs.push({startIndex:updateStartIndex,paragraphStyle:newParagraphStyle,bullet:newBullet});break}}newUpdateParagraphs.push(...splitUpdateParagraphs),splitUpdateParagraphs=[]}updateBody.paragraphs=newUpdateParagraphs}return insertParagraphs(body,updateBody,textLength,currentIndex),removeParagraphs}__name(updateParagraphs,"updateParagraphs");function updateSectionBreaks(body,updateBody,textLength,currentIndex,coverType){const{sectionBreaks}=body,{sectionBreaks:updateDataSectionBreaks}=updateBody;if(sectionBreaks==null||updateDataSectionBreaks==null)return;const removeSectionBreaks=deleteSectionBreaks(body,textLength,currentIndex);if(coverType!==UpdateDocsAttributeType.REPLACE){const newUpdateSectionBreaks=[];for(const updateSectionBreak of updateDataSectionBreaks){const{startIndex:updateStartIndex}=updateSectionBreak;let splitUpdateSectionBreaks=[];for(const removeSectionBreak of removeSectionBreaks){const{startIndex:removeStartIndex}=removeSectionBreak;if(updateStartIndex===removeStartIndex){coverType===UpdateDocsAttributeType.COVER?splitUpdateSectionBreaks.push({...removeSectionBreak,...updateSectionBreak}):splitUpdateSectionBreaks.push({...updateSectionBreak,...removeSectionBreak});break}}newUpdateSectionBreaks.push(...splitUpdateSectionBreaks),splitUpdateSectionBreaks=[]}updateBody.sectionBreaks=newUpdateSectionBreaks}return insertSectionBreaks(body,updateBody,textLength,currentIndex),removeSectionBreaks}__name(updateSectionBreaks,"updateSectionBreaks");function updateCustomBlocks(body,updateBody,textLength,currentIndex,coverType){const{customBlocks=[]}=body,{customBlocks:updateDataCustomBlocks}=updateBody;if(customBlocks==null||updateDataCustomBlocks==null)return;const removeCustomBlocks=deleteCustomBlocks(body,textLength,currentIndex);if(coverType!==UpdateDocsAttributeType.REPLACE){const newUpdateCustomBlocks=[];for(const updateCustomBlock of updateDataCustomBlocks){const{startIndex:updateStartIndex}=updateCustomBlock;let splitUpdateCustomBlocks=[];for(const removeCustomBlock of removeCustomBlocks){const{startIndex:removeStartIndex}=removeCustomBlock;if(updateStartIndex===removeStartIndex){coverType===UpdateDocsAttributeType.COVER?splitUpdateCustomBlocks.push({...removeCustomBlock,...updateCustomBlock}):splitUpdateCustomBlocks.push({...updateCustomBlock,...removeCustomBlock});break}}newUpdateCustomBlocks.push(...splitUpdateCustomBlocks),splitUpdateCustomBlocks=[]}updateBody.customBlocks=newUpdateCustomBlocks}return insertCustomBlocks(body,updateBody,textLength,currentIndex),customBlocks.length&&!body.customBlocks&&(body.customBlocks=customBlocks),removeCustomBlocks}__name(updateCustomBlocks,"updateCustomBlocks");function updateTables(body,updateBody,textLength,currentIndex,coverType){const{tables}=body,{tables:updateDataTables}=updateBody;if(tables==null||updateDataTables==null)return;const removeTables=deleteTables(body,textLength,currentIndex);if(coverType!==UpdateDocsAttributeType.REPLACE){const newUpdateTables=[];for(const updateTable of updateDataTables){const{startIndex:updateStartIndex,endIndex:updateEndIndex}=updateTable;let splitUpdateTables=[];for(const removeTable of removeTables){const{startIndex:removeStartIndex,endIndex:removeEndIndex}=removeTable;if(removeStartIndex>=updateStartIndex&&removeEndIndex<=updateEndIndex){coverType===UpdateDocsAttributeType.COVER?splitUpdateTables.push({...removeTable,...updateTable}):splitUpdateTables.push({...updateTable,...removeTable});break}}newUpdateTables.push(...splitUpdateTables),splitUpdateTables=[]}updateBody.tables=newUpdateTables}return insertTables(body,updateBody,textLength,currentIndex),removeTables}__name(updateTables,"updateTables");function updateCustomRanges(body,updateBody,textLength,currentIndex,_coverType){body.customRanges||(body.customRanges=[]),splitCustomRangesByIndex(body.customRanges,currentIndex),splitCustomRangesByIndex(body.customRanges,currentIndex+textLength);const start=currentIndex,end=currentIndex+textLength-1,{customRanges:updateDataCustomRanges}=updateBody,newCustomRanges=[],relativeCustomRanges=new Map;body.customRanges.forEach(customRange=>{const{startIndex,endIndex}=customRange;startIndex>=start&&endIndex<=end?relativeCustomRanges.set(customRange.rangeId,customRange):newCustomRanges.push(customRange)});const removeCustomRanges=[];return updateDataCustomRanges?(updateDataCustomRanges.forEach(customRange=>{const{startIndex,endIndex}=customRange;newCustomRanges.push({...customRange,startIndex:startIndex+currentIndex,endIndex:endIndex+currentIndex})}),body.customRanges=mergeContinuousRanges(newCustomRanges),removeCustomRanges):[]}__name(updateCustomRanges,"updateCustomRanges");function updateCustomDecorations(body,updateBody,textLength,currentIndex,coverType){body.customDecorations||(body.customDecorations=[]),splitCustomDecoratesByIndex(body.customDecorations,currentIndex),splitCustomDecoratesByIndex(body.customDecorations,currentIndex+textLength);const removeCustomDecorations=[],{customDecorations}=body,{customDecorations:updateDataCustomDecorations=[]}=updateBody;if(coverType===UpdateDocsAttributeType.REPLACE){for(let index2=0;index2<customDecorations.length;index2++){const customDecoration=customDecorations[index2],{startIndex,endIndex}=customDecoration;startIndex>=currentIndex&&endIndex<=currentIndex+textLength-1&&removeCustomDecorations.push(customDecoration)}updateDataCustomDecorations.forEach(customDecoration=>{const{startIndex,endIndex}=customDecoration;customDecorations.push({...customDecoration,startIndex:startIndex+currentIndex,endIndex:endIndex+currentIndex})})}else for(const updateCustomDecoration of updateDataCustomDecorations){const{id}=updateCustomDecoration;if(updateCustomDecoration.type===CustomDecorationType.DELETED){const oldCustomDecorations=customDecorations.filter(d=>d.id===id);oldCustomDecorations.length&&removeCustomDecorations.push(...oldCustomDecorations)}else customDecorations.push({...updateCustomDecoration,startIndex:updateCustomDecoration.startIndex+currentIndex,endIndex:updateCustomDecoration.endIndex+currentIndex})}for(const removeCustomDecoration of removeCustomDecorations){const{id}=removeCustomDecoration,index2=customDecorations.findIndex(d=>d.id===id);index2!==-1&&customDecorations.splice(index2,1)}return body.customDecorations=mergeContinuousDecorations(customDecorations),removeCustomDecorations}__name(updateCustomDecorations,"updateCustomDecorations");var SliceBodyType=(SliceBodyType2=>(SliceBodyType2[SliceBodyType2.copy=0]="copy",SliceBodyType2[SliceBodyType2.cut=1]="cut",SliceBodyType2))(SliceBodyType||{});function getTextRunSlice(body,startOffset,endOffset,returnEmptyTextRuns=!0){const{textRuns}=body;if(textRuns){const newTextRuns=[];for(const textRun of textRuns){const clonedTextRun=Tools.deepClone(textRun),{st,ed}=clonedTextRun;Tools.hasIntersectionBetweenTwoRanges(st,ed,startOffset,endOffset)&&(startOffset>=st&&startOffset<=ed?newTextRuns.push({...clonedTextRun,st:startOffset,ed:Math.min(endOffset,ed)}):endOffset>=st&&endOffset<=ed?newTextRuns.push({...clonedTextRun,st:Math.max(startOffset,st),ed:endOffset}):newTextRuns.push(clonedTextRun))}return normalizeTextRuns(newTextRuns.map(tr=>{const{st,ed}=tr;return{...tr,st:st-startOffset,ed:ed-startOffset}}))}else if(returnEmptyTextRuns)return[{st:0,ed:endOffset-startOffset,ts:{}}]}__name(getTextRunSlice,"getTextRunSlice");function getTableSlice(body,startOffset,endOffset){const{tables=[]}=body,newTables=[];for(const table of tables){const clonedTable=Tools.deepClone(table),{startIndex,endIndex}=clonedTable;startIndex>=startOffset&&endIndex<=endOffset&&newTables.push({...clonedTable,startIndex:startIndex-startOffset,endIndex:endIndex-startOffset})}return newTables}__name(getTableSlice,"getTableSlice");function getParagraphsSlice(body,startOffset,endOffset){const{paragraphs=[]}=body,newParagraphs=[];for(const paragraph of paragraphs){const{startIndex}=paragraph;startIndex>=startOffset&&startIndex<endOffset&&newParagraphs.push(Tools.deepClone(paragraph))}if(newParagraphs.length)return newParagraphs.map(p=>({...p,startIndex:p.startIndex-startOffset}))}__name(getParagraphsSlice,"getParagraphsSlice");function getSectionBreakSlice(body,startOffset,endOffset){const{sectionBreaks=[]}=body,newSectionBreaks=[];for(const sectionBreak of sectionBreaks){const{startIndex}=sectionBreak;startIndex>=startOffset&&startIndex<=endOffset&&newSectionBreaks.push(Tools.deepClone(sectionBreak))}if(newSectionBreaks.length)return newSectionBreaks.map(sb=>({...sb,startIndex:sb.startIndex-startOffset}))}__name(getSectionBreakSlice,"getSectionBreakSlice");function getCustomBlockSlice(body,startOffset,endOffset){const{customBlocks=[]}=body,newCustomBlocks=[];for(const block of customBlocks){const{startIndex}=block;startIndex>=startOffset&&startIndex<=endOffset&&newCustomBlocks.push(Tools.deepClone(block))}if(newCustomBlocks.length)return newCustomBlocks.map(b=>({...b,startIndex:b.startIndex-startOffset}))}__name(getCustomBlockSlice,"getCustomBlockSlice");function getBodySlice(body,startOffset,endOffset,returnEmptyArray=!0,type2=1){const{dataStream}=body,docBody={dataStream:dataStream.slice(startOffset,endOffset)};docBody.textRuns=getTextRunSlice(body,startOffset,endOffset,returnEmptyArray);const newTables=getTableSlice(body,startOffset,endOffset);if(newTables.length&&(docBody.tables=newTables),docBody.paragraphs=getParagraphsSlice(body,startOffset,endOffset),type2===1){const customDecorations=getCustomDecorationSlice(body,startOffset,endOffset);customDecorations?docBody.customDecorations=customDecorations:returnEmptyArray&&(docBody.customDecorations=[])}const{customRanges}=getCustomRangeSlice(body,startOffset,endOffset);return customRanges?docBody.customRanges=customRanges:returnEmptyArray&&(docBody.customRanges=[]),docBody.customBlocks=getCustomBlockSlice(body,startOffset,endOffset),docBody}__name(getBodySlice,"getBodySlice");function normalizeBody$1(body){const{dataStream,textRuns,paragraphs,customRanges,customDecorations,tables}=body;let leftOffset=0,rightOffset=0;customRanges==null||customRanges.forEach(range=>{range.startIndex<0&&(leftOffset=Math.max(leftOffset,-range.startIndex)),range.endIndex>dataStream.length-1&&(rightOffset=Math.max(rightOffset,range.endIndex-dataStream.length+1))});const newData=`${dataStream}`;return textRuns&&(textRuns[0]&&(textRuns[0].st=textRuns[0].st-leftOffset),textRuns[textRuns.length-1]&&(textRuns[textRuns.length-1].ed=textRuns[textRuns.length-1].ed+rightOffset)),textRuns==null||textRuns.forEach(textRun=>{textRun.st+=leftOffset,textRun.ed+=leftOffset}),paragraphs==null||paragraphs.forEach(p=>{p.startIndex+=leftOffset}),customRanges==null||customRanges.forEach(range=>{range.startIndex+=leftOffset,range.endIndex+=leftOffset}),customDecorations==null||customDecorations.forEach(d=>{d.startIndex+=leftOffset,d.endIndex+=rightOffset}),tables==null||tables.forEach(table=>{table.startIndex+=leftOffset,table.endIndex+=rightOffset}),{...body,dataStream:newData,textRuns,paragraphs,customRanges,customDecorations,tables}}__name(normalizeBody$1,"normalizeBody$1");function getCustomRangeSlice(body,startOffset,endOffset){if(body.customRanges==null)return{};const{customRanges}=body;return{customRanges:customRanges.filter(customRange=>Math.max(customRange.startIndex,startOffset)<=Math.min(customRange.endIndex,endOffset-1)).map(range=>({...range,startIndex:Math.max(range.startIndex,startOffset),endIndex:Math.min(range.endIndex,endOffset-1)})).map(range=>({...range,startIndex:range.startIndex-startOffset,endIndex:range.endIndex-startOffset})),leftOffset:0,rightOffset:0}}__name(getCustomRangeSlice,"getCustomRangeSlice");function getCustomDecorationSlice(body,startOffset,endOffset){if(body.customDecorations==null)return;const{customDecorations=[]}=body,customDecorationSlice=[];return customDecorations.forEach(range=>{if(Math.max(range.startIndex,startOffset)<=Math.min(range.endIndex,endOffset-1)){const copy=Tools.deepClone(range);customDecorationSlice.push({...copy,startIndex:Math.max(copy.startIndex-startOffset,0),endIndex:Math.min(copy.endIndex,endOffset-1)-startOffset})}}),customDecorationSlice}__name(getCustomDecorationSlice,"getCustomDecorationSlice");function composeTextRuns(updateDataTextRuns,originTextRuns,coverType){return updateDataTextRuns==null||originTextRuns==null?updateDataTextRuns!=null?updateDataTextRuns:originTextRuns:coverTextRuns(updateDataTextRuns,originTextRuns,coverType)}__name(composeTextRuns,"composeTextRuns");function composeCustomRanges(updateDataCustomRanges,originCustomRanges,coverType){if(updateDataCustomRanges==null||originCustomRanges==null)return updateDataCustomRanges!=null?updateDataCustomRanges:originCustomRanges;if(originCustomRanges.length===0||updateDataCustomRanges.length===0)return updateDataCustomRanges;if(originCustomRanges.length>1||updateDataCustomRanges.length>1)throw new Error("Cannot cover multiple customRanges");return coverType===UpdateDocsAttributeType.REPLACE?[{...updateDataCustomRanges[0]}]:[{...originCustomRanges[0],...updateDataCustomRanges[0]}]}__name(composeCustomRanges,"composeCustomRanges");function composeCustomDecorations(updateDataCustomDecorations,originCustomDecorations,coverType){return originCustomDecorations.length===0||updateDataCustomDecorations.length===0||coverType===UpdateDocsAttributeType.REPLACE?updateDataCustomDecorations:[...updateDataCustomDecorations,...originCustomDecorations.filter(originCustomDecoration=>!updateDataCustomDecorations.some(updateDataCustomDecoration=>originCustomDecoration.id===updateDataCustomDecoration.id))]}__name(composeCustomDecorations,"composeCustomDecorations");function composeBody(thisBody,otherBody,coverType=UpdateDocsAttributeType.COVER){if(otherBody.dataStream!=="")throw new Error("Cannot compose other body with non-empty dataStream");const retBody={dataStream:thisBody.dataStream},{textRuns:thisTextRuns,paragraphs:thisParagraphs=[],customRanges:thisCustomRanges,customDecorations:thisCustomDecorations=[]}=thisBody,{textRuns:otherTextRuns,paragraphs:otherParagraphs=[],customRanges:otherCustomRanges,customDecorations:otherCustomDecorations=[]}=otherBody;retBody.textRuns=composeTextRuns(otherTextRuns,thisTextRuns,coverType),retBody.customRanges=composeCustomRanges(otherCustomRanges,thisCustomRanges,coverType);const customDecorations=composeCustomDecorations(otherCustomDecorations,thisCustomDecorations,coverType);customDecorations.length&&(retBody.customDecorations=customDecorations);const paragraphs=[];let thisIndex=0,otherIndex=0;for(;thisIndex<thisParagraphs.length&&otherIndex<otherParagraphs.length;){const thisParagraph=thisParagraphs[thisIndex],otherParagraph=otherParagraphs[otherIndex],{startIndex:thisStart}=thisParagraph,{startIndex:otherStart}=otherParagraph;thisStart===otherStart?(paragraphs.push(Tools.deepMerge(thisParagraph,otherParagraph)),thisIndex++,otherIndex++):thisStart<otherStart?(paragraphs.push(Tools.deepClone(thisParagraph)),thisIndex++):(paragraphs.push(Tools.deepClone(otherParagraph)),otherIndex++)}return thisIndex<thisParagraphs.length&&paragraphs.push(...thisParagraphs.slice(thisIndex)),otherIndex<otherParagraphs.length&&paragraphs.push(...otherParagraphs.slice(otherIndex)),paragraphs.length&&(retBody.paragraphs=paragraphs),retBody}__name(composeBody,"composeBody");function isUselessRetainAction(action){const{body}=action;if(body==null)return!0;const{textRuns,paragraphs,customRanges,customBlocks,customDecorations,tables}=body;return textRuns==null&&paragraphs==null&&customRanges==null&&customBlocks==null&&customDecorations==null&&tables==null}__name(isUselessRetainAction,"isUselessRetainAction");const _ActionIterator=class _ActionIterator{constructor(_actions){__publicField(this,"_index",0);__publicField(this,"_offset",0);this._actions=_actions}hasNext(){return this.peekLength()<Number.POSITIVE_INFINITY}next(length){length||(length=Number.POSITIVE_INFINITY);const nextAction=this._actions[this._index];if(nextAction){const offset=this._offset,actionLength=nextAction.len;return length>=actionLength-offset?(length=actionLength-offset,this._index+=1,this._offset=0):this._offset+=length,nextAction.t===TextXActionType.DELETE||nextAction.t===TextXActionType.RETAIN&&nextAction.body==null?Tools.deepClone({...nextAction,len:length}):Tools.deepClone({...nextAction,len:length,body:getBodySlice(nextAction.body,offset,offset+length,!1)})}else return{t:TextXActionType.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 action=this._actions[this._index];return action?action.t:TextXActionType.RETAIN}rest(){if(this.hasNext()){if(this._offset===0)return this._actions.slice(this._index);{const offset=this._offset,index2=this._index,next=this.next(),restActions=this._actions.slice(this._index);return this._offset=offset,this._index=index2,[next].concat(restActions)}}else return[]}};__name(_ActionIterator,"ActionIterator");let ActionIterator=_ActionIterator;const _MemoryCursor=class _MemoryCursor{constructor(){__publicField(this,"cursor",0)}reset(){return this.cursor=0,this}moveCursor(pos){this.cursor+=pos}moveCursorTo(pos){this.cursor=pos}};__name(_MemoryCursor,"MemoryCursor");let MemoryCursor=_MemoryCursor;function updateAttributeByDelete(body,textLength,currentIndex){const{dataStream}=body,startIndex=currentIndex,endIndex=currentIndex+textLength,removeTextRuns=deleteTextRuns(body,textLength,currentIndex),removeParagraphs=deleteParagraphs(body,textLength,currentIndex),removeSectionBreaks=deleteSectionBreaks(body,textLength,currentIndex),removeCustomBlocks=deleteCustomBlocks(body,textLength,currentIndex),removeTables=deleteTables(body,textLength,currentIndex),removeCustomRanges=deleteCustomRanges(body,textLength,currentIndex),removeCustomDecorations=deleteCustomDecorations(body,textLength,currentIndex);let removeDataStream="";return dataStream&&(body.dataStream=deleteContent(dataStream,startIndex,endIndex),removeDataStream=dataStream.slice(startIndex,endIndex)),{dataStream:removeDataStream,textRuns:removeTextRuns,paragraphs:removeParagraphs,sectionBreaks:removeSectionBreaks,customBlocks:removeCustomBlocks,tables:removeTables,customRanges:removeCustomRanges,customDecorations:removeCustomDecorations}}__name(updateAttributeByDelete,"updateAttributeByDelete");function updateAttributeByInsert(body,insertBody,textLength,currentIndex){body.dataStream=insertTextToContent(body.dataStream,currentIndex,insertBody.dataStream),insertTextRuns(body,insertBody,textLength,currentIndex),insertParagraphs(body,insertBody,textLength,currentIndex),insertSectionBreaks(body,insertBody,textLength,currentIndex),insertCustomBlocks(body,insertBody,textLength,currentIndex),insertTables(body,insertBody,textLength,currentIndex),insertCustomRanges(body,insertBody,textLength,currentIndex),insertCustomDecorations(body,insertBody,textLength,currentIndex)}__name(updateAttributeByInsert,"updateAttributeByInsert");function updateApply(doc,updateBody,textLength,currentIndex,coverType=UpdateDocsAttributeType.COVER){return updateAttribute(doc,updateBody,textLength,currentIndex,coverType)}__name(updateApply,"updateApply");function deleteApply(doc,textLength,currentIndex){return textLength<=0?{dataStream:""}:updateAttributeByDelete(doc,textLength,currentIndex)}__name(deleteApply,"deleteApply");function insertApply(doc,insertBody,textLength,currentIndex){textLength!==0&&updateAttributeByInsert(doc,insertBody,textLength,currentIndex)}__name(insertApply,"insertApply");function textXApply(doc,actions){const memoryCursor=new MemoryCursor;return memoryCursor.reset(),actions.forEach(action=>{const clonedAction=Tools.deepClone(action);switch(clonedAction.t){case TextXActionType.RETAIN:{const{coverType,body,len}=clonedAction;body!=null&&updateApply(doc,body,len,memoryCursor.cursor,coverType),memoryCursor.moveCursor(len);break}case TextXActionType.INSERT:{const{body,len}=clonedAction;insertApply(doc,body,len,memoryCursor.cursor),memoryCursor.moveCursor(len);break}case TextXActionType.DELETE:{const{len}=clonedAction;deleteApply(doc,len,memoryCursor.cursor);break}default:throw new Error(`Unknown action type for action: ${clonedAction}.`)}}),doc}__name(textXApply,"textXApply");function transformTextRuns(originTextRuns,targetTextRuns,originCoverType,targetCoverType,transformType){if(originTextRuns==null||targetTextRuns==null)return targetTextRuns;if(originTextRuns.length===0||targetTextRuns.length===0)return[];targetTextRuns=Tools.deepClone(targetTextRuns),originTextRuns=Tools.deepClone(originTextRuns);const newUpdateTextRuns=[],updateLength=targetTextRuns.length,removeLength=originTextRuns.length;let updateIndex=0,removeIndex=0,pending=null;function pushPendingAndReturnStatus(){return pending?(newUpdateTextRuns.push(pending),pending=null,!0):!1}for(__name(pushPendingAndReturnStatus,"pushPendingAndReturnStatus");updateIndex<updateLength&&removeIndex<removeLength;){const{st:updateSt,ed:updateEd,ts:targetStyle}=targetTextRuns[updateIndex],{st:removeSt,ed:removeEd,ts:originStyle,sId}=originTextRuns[removeIndex];let newTs={};if(transformType===0)newTs={...targetStyle},originCoverType===UpdateDocsAttributeType.COVER&&targetCoverType===UpdateDocsAttributeType.REPLACE&&originStyle&&(newTs=Object.assign({},originStyle,newTs));else if(newTs={...targetStyle},originCoverType===UpdateDocsAttributeType.REPLACE){if(targetCoverType===UpdateDocsAttributeType.REPLACE)newTs={...originStyle};else if(targetStyle&&originStyle){const keys=Object.keys(targetStyle);for(const key of keys)originStyle[key]&&delete newTs[key]}}else if(targetCoverType===UpdateDocsAttributeType.REPLACE){if(originStyle){const keys=Object.keys(originStyle);for(const key of keys)originStyle[key]!==void 0&&(newTs[key]=originStyle[key])}}else if(originStyle){const keys=Object.keys(originStyle);for(const key of keys)newTs[key]!==void 0&&delete newTs[key]}if(updateEd<removeSt)pushPendingAndReturnStatus()||newUpdateTextRuns.push(targetTextRuns[updateIndex]),updateIndex++;else if(removeEd<updateSt)pushPendingAndReturnStatus()||newUpdateTextRuns.push(originTextRuns[removeIndex]),removeIndex++;else{const newTextRun={st:Math.min(updateSt,removeSt),ed:Math.max(updateSt,removeSt),ts:updateSt<removeSt?{...targetStyle}:{...originStyle},sId:updateSt<removeSt?void 0:sId};newTextRun.ed>newTextRun.st&&newUpdateTextRuns.push(),newUpdateTextRuns.push({st:Math.max(updateSt,removeSt),ed:Math.min(updateEd,removeEd),ts:newTs,sId}),updateEd<removeEd?(updateIndex++,originTextRuns[removeIndex].st=updateEd,originTextRuns[removeIndex].st===originTextRuns[removeIndex].ed&&removeIndex++):(removeIndex++,targetTextRuns[updateIndex].st=removeEd,targetTextRuns[updateIndex].st===targetTextRuns[updateIndex].ed&&updateIndex++);const pendingTextRun={st:Math.min(updateEd,removeEd),ed:Math.max(updateEd,removeEd),ts:updateEd<removeEd?{...originStyle}:{...targetStyle},sId:updateEd<removeEd?sId:void 0};pending=pendingTextRun.ed>pendingTextRun.st?pendingTextRun:null}}pushPendingAndReturnStatus();const tempTopTextRun=newUpdateTextRuns[newUpdateTextRuns.length-1],updateLastTextRun=targetTextRuns[updateLength-1],removeLastTextRun=originTextRuns[removeLength-1];return tempTopTextRun.ed!==Math.max(updateLastTextRun.ed,removeLastTextRun.ed)&&(updateLastTextRun.ed>removeLastTextRun.ed?newUpdateTextRuns.push(updateLastTextRun):newUpdateTextRuns.push(removeLastTextRun)),normalizeTextRuns(newUpdateTextRuns,!0)}__name(transformTextRuns,"transformTextRuns");function transformCustomRanges(originCustomRanges,targetCustomRanges,originCoverType,targetCoverType,transformType){if(originCustomRanges==null||targetCustomRanges==null)return targetCustomRanges;if(originCustomRanges.length===0||targetCustomRanges.length===0)return[];if(originCustomRanges.length>1||targetCustomRanges.length>1)throw new Error("CustomRanges is only supported transform for length one now.");const originCustomRange=originCustomRanges[0],targetCustomRange=targetCustomRanges[0];if(originCoverType===UpdateDocsAttributeType.REPLACE)return transformType===1?[Tools.deepClone(originCustomRange)]:[Tools.deepClone(targetCustomRange)];if(targetCoverType===UpdateDocsAttributeType.REPLACE){const customRange=Tools.deepClone(targetCustomRange);return transformType===1&&Object.assign(customRange,Tools.deepClone(originCustomRange)),[customRange]}else{const customRange=Tools.deepClone(targetCustomRange);return transformType===1&&Object.assign(customRange,Tools.deepClone(originCustomRange)),[customRange]}}__name(transformCustomRanges,"transformCustomRanges");function transformParagraph(originParagraph,targetParagraph,originCoverType,targetCoverType,transformType){const paragraph={startIndex:targetParagraph.startIndex};if(targetParagraph.paragraphStyle&&(paragraph.paragraphStyle=Tools.deepClone(targetParagraph.paragraphStyle),originParagraph.paragraphStyle)){if(originCoverType===UpdateDocsAttributeType.REPLACE)if(targetCoverType===UpdateDocsAttributeType.REPLACE)transformType===1&&(paragraph.paragraphStyle={...originParagraph.paragraphStyle});else if(transformType===1){const keys=Object.keys(originParagraph.paragraphStyle);for(const key of keys)originParagraph.paragraphStyle[key]!==void 0&&(paragraph.paragraphStyle[key]=originParagraph.paragraphStyle[key])}else{const keys=Object.keys(originParagraph.paragraphStyle);for(const key of keys)paragraph.paragraphStyle[key]===void 0&&(paragraph.paragraphStyle[key]=originParagraph.paragraphStyle[key])}else if(targetCoverType===UpdateDocsAttributeType.REPLACE)if(transformType===1){const keys=Object.keys(originParagraph.paragraphStyle);for(const key of keys)originParagraph.paragraphStyle[key]!==void 0&&(paragraph.paragraphStyle[key]=originParagraph.paragraphStyle[key])}else{const keys=Object.keys(originParagraph.paragraphStyle);for(const key of keys)paragraph.paragraphStyle[key]===void 0&&(paragraph.paragraphStyle[key]=originParagraph.paragraphStyle[key])}else if(transformType===1){const keys=Object.keys(originParagraph.paragraphStyle);for(const key of keys)paragraph.paragraphStyle[key]&&delete paragraph.paragraphStyle[key]}}return originCoverType===UpdateDocsAttributeType.REPLACE&&targetCoverType===UpdateDocsAttributeType.REPLACE?paragraph.bullet=transformType===1?Tools.deepClone(originParagraph.bullet):Tools.deepClone(targetParagraph.bullet):originParagraph.bullet===void 0?paragraph.bullet=Tools.deepClone(targetParagraph.bullet):originCoverType===UpdateDocsAttributeType.REPLACE||targetCoverType===UpdateDocsAttributeType.REPLACE?paragraph.bullet=transformType===0&&targetParagraph.bullet?Tools.deepClone(targetParagraph.bullet):Tools.deepClone(originParagraph.bullet):transformType===0&&targetParagraph.bullet!==void 0&&(paragraph.bullet=Tools.deepClone(targetParagraph.bullet)),paragraph}__name(transformParagraph,"transformParagraph");function transformCustomDecorations(originCustomDecorations,targetCustomDecorations){if(originCustomDecorations==null||targetCustomDecorations==null)return targetCustomDecorations;if(originCustomDecorations.length===0||targetCustomDecorations.length===0)return Tools.deepClone(targetCustomDecorations);const customDecorations=[];for(const decoration of targetCustomDecorations){const{id,type:type2}=decoration;let pushed=!1;for(const originDecoration of originCustomDecorations)if(originDecoration.id===id){(originDecoration.type===CustomDecorationType.DELETED||type2===CustomDecorationType.DELETED)&&(pushed=!0,customDecorations.push({...decoration,type:CustomDecorationType.DELETED}));break}pushed||customDecorations.push(decoration)}return customDecorations}__name(transformCustomDecorations,"transformCustomDecorations");function transformBody(thisAction,otherAction,priority=!1){const{body:thisBody,coverType:thisCoverType=UpdateDocsAttributeType.COVER}=thisAction,{body:otherBody,coverType:otherCoverType=UpdateDocsAttributeType.COVER}=otherAction;if(thisBody==null||thisBody.dataStream!==""||otherBody==null||otherBody.dataStream!=="")throw new Error("Data stream is not supported in retain transform.");const retBody={dataStream:""},coverType=otherCoverType,{textRuns:thisTextRuns,paragraphs:thisParagraphs=[],customRanges:thisCustomRanges,customDecorations:thisCustomDecorations}=thisBody,{textRuns:otherTextRuns,paragraphs:otherParagraphs=[],customRanges:otherCustomRanges,customDecorations:otherCustomDecorations}=otherBody,textRuns=transformTextRuns(thisTextRuns,otherTextRuns,thisCoverType,otherCoverType,priority?1:0);textRuns&&(retBody.textRuns=textRuns);const customRanges=transformCustomRanges(thisCustomRanges,otherCustomRanges,thisCoverType,otherCoverType,priority?1:0);customRanges&&(retBody.customRanges=customRanges);const customDecorations=transformCustomDecorations(thisCustomDecorations,otherCustomDecorations);customDecorations&&(retBody.customDecorations=customDecorations);const paragraphs=[];let thisIndex=0,otherIndex=0;for(;thisIndex<thisParagraphs.length&&otherIndex<otherParagraphs.length;){const thisParagraph=thisParagraphs[thisIndex],otherParagraph=otherParagraphs[otherIndex],{startIndex:thisStart}=thisParagraph,{startIndex:otherStart}=otherParagraph;if(thisStart===otherStart){let paragraph={startIndex:thisStart};priority?paragraph=transformParagraph(thisParagraph,otherParagraph,thisCoverType,otherCoverType,1):paragraph=transformParagraph(thisParagraph,otherParagraph,thisCoverType,otherCoverType,0),paragraphs.push(paragraph),thisIndex++,otherIndex++}else thisStart<otherStart?thisIndex++:(paragraphs.push(Tools.deepClone(otherParagraph)),otherIndex++)}return otherIndex<otherParagraphs.length&&paragraphs.push(...otherParagraphs.slice(otherIndex)),paragraphs.length&&(retBody.paragraphs=paragraphs),{coverType,body:retBody}}__name(transformBody,"transformBody");function onlyHasDataStream(body){return Object.keys(body).length===1}__name(onlyHasDataStream,"onlyHasDataStream");const _TextX=class _TextX{constructor(){__publicField(this,"_actions",[])}static apply(doc,actions){return textXApply(doc,actions)}static compose(thisActions,otherActions){const thisIter=new ActionIterator(thisActions),otherIter=new ActionIterator(otherActions),textX=new _TextX;for(;thisIter.hasNext()||otherIter.hasNext();)if(otherIter.peekType()===TextXActionType.INSERT)textX.push(otherIter.next());else if(thisIter.peekType()===TextXActionType.DELETE)textX.push(thisIter.next());else{const length=Math.min(thisIter.peekLength(),otherIter.peekLength()),thisAction=thisIter.next(length),otherAction=otherIter.next(length);if(thisAction.t===TextXActionType.INSERT&&otherAction.t===TextXActionType.RETAIN)otherAction.body==null?textX.push(thisAction):textX.push({...thisAction,body:composeBody(thisAction.body,otherAction.body,otherAction.coverType)});else if(thisAction.t===TextXActionType.RETAIN&&otherAction.t===TextXActionType.RETAIN)if(thisAction.body==null&&otherAction.body==null)textX.push(thisAction.len!==Number.POSITIVE_INFINITY?thisAction:otherAction);else if(thisAction.body&&otherAction.body){const coverType=thisAction.coverType===UpdateDocsAttributeType.REPLACE||otherAction.coverType===UpdateDocsAttributeType.REPLACE?UpdateDocsAttributeType.REPLACE:UpdateDocsAttributeType.COVER;textX.push({...thisAction,t:TextXActionType.RETAIN,coverType,body:composeBody(thisAction.body,otherAction.body,otherAction.coverType)})}else textX.push(thisAction.body?thisAction:otherAction);else thisAction.t===TextXActionType.RETAIN&&otherAction.t===TextXActionType.DELETE?textX.push(otherAction):thisAction.t===TextXActionType.INSERT&&(otherAction.t,TextXActionType.DELETE)}return textX.trimEndUselessRetainAction(),textX.serialize()}static transform(thisActions,otherActions,priority="right"){return this._transform(otherActions,thisActions,priority==="left"?"right":"left")}static _transform(thisActions,otherActions,priority="right"){const thisIter=new ActionIterator(thisActions),otherIter=new ActionIterator(otherActions),textX=new _TextX;for(;thisIter.hasNext()||otherIter.hasNext();)if(thisIter.peekType()===TextXActionType.INSERT&&(priority==="left"||otherIter.peekType()!==TextXActionType.INSERT)){const thisAction=thisIter.next();textX.retain(thisAction.len)}else if(otherIter.peekType()===TextXActionType.INSERT)textX.push(otherIter.next());else{const length=Math.min(thisIter.peekLength(),otherIter.peekLength()),thisAction=thisIter.next(length),otherAction=otherIter.next(length);if(thisAction.t===TextXActionType.DELETE)continue;if(otherAction.t===TextXActionType.DELETE){textX.push(otherAction);continue}if(thisAction.body==null||otherAction.body==null)textX.push(otherAction);else{const{coverType,body}=transformBody(thisAction,otherAction,priority==="left");textX.push({...otherAction,t:TextXActionType.RETAIN,coverType,body})}}return textX.trimEndUselessRetainAction(),textX.serialize()}static transformPosition(thisActions,index2,priority=!1){const thisIter=new ActionIterator(thisActions);let offset=0;for(;thisIter.hasNext()&&offset<=index2;){const length=thisIter.peekLength(),nextType=thisIter.peekType();if(thisIter.next(),nextType===TextXActionType.DELETE){index2-=Math.min(length,index2-offset);continue}else nextType===TextXActionType.INSERT&&(offset<index2||!priority)&&(index2+=length);offset+=length}return index2}static isNoop(actions){return actions.length===0}static invert(actions){const invertedActions=[];for(const action of actions)if(action.t===TextXActionType.INSERT)invertedActions.push({t:TextXActionType.DELETE,len:action.len,body:action.body});else if(action.t===TextXActionType.DELETE){if(action.body==null)throw new Error("Can not invert DELETE action without body property, makeInvertible must be called first.");invertedActions.push({t:TextXActionType.INSERT,body:action.body,len:action.len})}else if(action.body!=null){if(action.oldBody==null)throw new Error("Can not invert RETAIN action without oldBody property, makeInvertible must be called first.");invertedActions.push({t:TextXActionType.RETAIN,body:action.oldBody,oldBody:action.body,len:action.len,coverType:UpdateDocsAttributeType.REPLACE})}else invertedActions.push(action);return invertedActions}static makeInvertible(actions,doc){const invertibleActions=[];let index2=0;for(const action of actions){if(action.t===TextXActionType.DELETE&&(action.body==null||action.body&&action.body.dataStream.length!==action.len)){const body=getBodySlice(doc,index2,index2+action.len,!1);action.len=body.dataStream.length,action.body=body}if(action.t===TextXActionType.RETAIN&&action.body!=null){const body=getBodySlice(doc,index2,index2+action.len,!0);action.oldBody={...body,dataStream:""},action.len=body.dataStream.length}invertibleActions.push(action),action.t!==TextXActionType.INSERT&&(index2+=action.len)}return invertibleActions}insert(len,body){const insertAction={t:TextXActionType.INSERT,body,len};return this.push(insertAction),this}retain(len,body,coverType){const retainAction={t:TextXActionType.RETAIN,len};return body!=null&&(retainAction.body=body),coverType!=null&&(retainAction.coverType=coverType),this.push(retainAction),this}delete(len){const deleteAction={t:TextXActionType.DELETE,len};return this.push(deleteAction),this}empty(){return this._actions=[],this}serialize(){return this._actions}push(...args){if(args.length>1){for(const ac of args)this.push(ac);return this}let index2=this._actions.length,lastAction=this._actions[index2-1];const newAction=Tools.deepClone(args[0]);if(newAction.t===TextXActionType.RETAIN&&newAction.len===0&&newAction.body==null)return this;if(typeof lastAction=="object"){if(lastAction.t===TextXActionType.DELETE&&newAction.t===TextXActionType.DELETE)return lastAction.len+=newAction.len,this;if(lastAction.t===TextXActionType.DELETE&&newAction.t===TextXActionType.INSERT&&(index2-=1,lastAction=this._actions[index2-1],lastAction==null))return this._actions.unshift(newAction),this;if(lastAction.t===TextXActionType.RETAIN&&newAction.t===TextXActionType.RETAIN&&lastAction.body==null&&newAction.body==null)return lastAction.len+=newAction.len,this;if(lastAction.t===TextXActionType.INSERT&&onlyHasDataStream(lastAction.body)&&newAction.t===TextXActionType.INSERT&&onlyHasDataStream(newAction.body))return lastAction.len+=newAction.len,lastAction.body.dataStream+=newAction.body.dataStream,this}return index2===this._actions.length?this._actions.push(newAction):this._actions.splice(index2,0,newAction),this}trimEndUselessRetainAction(){let lastAction=this._actions[this._actions.length-1];for(;lastAction&&lastAction.t===TextXActionType.RETAIN&&isUselessRetainAction(lastAction);)this._actions.pop(),lastAction=this._actions[this._actions.length-1];return this}};__name(_TextX,"TextX"),__publicField(_TextX,"id","text-x"),__publicField(_TextX,"uri","https://github.com/dream-num/univer#text-x");let TextX=_TextX;Object.defineProperty(TextX,"name",{value:"text-x"});const _JSONX=class _JSONX{static registerSubtype(subType){var _a17;subType==null||this._subTypes.has(subType.name)&&((_a17=this._subTypes.get(subType.name))==null?void 0:_a17.id)!==TextX.id||(this._subTypes.set(subType.name,subType),distExports.type.registerSubtype(subType))}static apply(doc,actions){if(!distExports.type.isNoop(actions))return distExports.type.apply(doc,actions)}static compose(thisActions,otherActions){return distExports.type.compose(thisActions,otherActions)}static transform(thisActions,otherActions,priority){return distExports.type.transform(thisActions,otherActions,priority)}static transformPosition(thisActions,index2,priority="right"){return thisActions&&thisActions.length===2&&thisActions[0]==="body"&&thisActions[1].et===TextX.name?TextX.transformPosition(thisActions[1].e,index2,priority==="left"):index2}static invertWithDoc(actions,doc){return distExports.type.invertWithDoc(actions,doc)}static isNoop(actions){return distExports.type.isNoop(actions)}static getInstance(){return this._instance==null&&(this._instance=new _JSONX),this._instance}removeOp(path,value){return distExports.removeOp(path,value)}moveOp(from,to){return distExports.moveOp(from,to)}insertOp(path,value){return distExports.insertOp(path,value)}replaceOp(path,oldVal,newVal){return distExports.replaceOp(path,oldVal,newVal)}editOp(subOp,path=["body"]){return distExports.editOp(path,TextX.name,subOp)}};__name(_JSONX,"JSONX"),__publicField(_JSONX,"uri","https://github.com/dream-num/univer#json-x"),__publicField(_JSONX,"_subTypes",new Map),__publicField(_JSONX,"_instance",null);let JSONX=_JSONX;JSONX.registerSubtype(TextX);const DEFAULT_DOC={id:"default_doc",documentStyle:{}},_DocumentDataModelSimple=class _DocumentDataModelSimple extends UnitModel{constructor(snapshot){var _a17;super();__publicField(this,"type",_.UNIVER_DOC);__publicField(this,"_name$",new rxjs.BehaviorSubject(""));__publicField(this,"name$",this._name$.asObservable());__publicField(this,"snapshot");this.snapshot={...DEFAULT_DOC,...snapshot},this._name$.next((_a17=this.snapshot.title)!=null?_a17:"No Title")}getUnitId(){throw new Error("Method not implemented.")}getRev(){var _a17;return(_a17=this.snapshot.rev)!=null?_a17:1}incrementRev(){this.snapshot.rev=this.getRev()+1}setRev(rev){this.snapshot.rev=rev}setName(name){this.snapshot.title=name,this._name$.next(name)}get drawings(){return this.snapshot.drawings}get documentStyle(){return this.snapshot.documentStyle}get lists(){return this.snapshot.lists}get zoomRatio(){var _a17;return((_a17=this.snapshot.settings)==null?void 0:_a17.zoomRatio)||1}resetDrawing(drawings,drawingsOrder){this.snapshot.drawings=drawings,this.snapshot.drawingsOrder=drawingsOrder}getBody(){return this.snapshot.body}getSnapshot(){return this.snapshot}getBulletPresetList(){var _a17;const customLists=(_a17=this.snapshot.lists)!=null?_a17:{};return{...PRESET_LIST_TYPE,...customLists}}updateDocumentId(unitId){this.snapshot.id=unitId}updateDocumentRenderConfig(config){const{documentStyle}=this.snapshot;documentStyle.renderConfig==null?documentStyle.renderConfig=config:documentStyle.renderConfig={...documentStyle.renderConfig,...config}}updateDocumentStyle(config){this.snapshot.documentStyle==null?this.snapshot.documentStyle=config:this.snapshot.documentStyle={...this.snapshot.documentStyle,...config}}updateDocumentDataMargin(data){const{t,l,b,r}=data,{documentStyle}=this.snapshot;t!=null&&(documentStyle.marginTop=t),l!=null&&(documentStyle.marginLeft=l),b!=null&&(documentStyle.marginBottom=b),r!=null&&(documentStyle.marginRight=r)}updateDocumentDataPageSize(width,height){const{documentStyle}=this.snapshot;if(!documentStyle.pageSize){width=width!=null?width:Number.POSITIVE_INFINITY,height=height!=null?height:Number.POSITIVE_INFINITY,documentStyle.pageSize={width,height};return}width!==void 0&&(documentStyle.pageSize.width=width),height!==void 0&&(documentStyle.pageSize.height=height)}updateDrawing(id,config){const{drawings}=this,{width,height,left,top}=config,drawing=drawings==null?void 0:drawings[id];if(!drawing)return;const objectTransform=drawing.docTransform;objectTransform.size.width=width,objectTransform.size.height=height,objectTransform.positionH.posOffset=left,objectTransform.positionV.posOffset=top}setZoomRatio(zoomRatio=1){this.snapshot.settings==null?this.snapshot.settings={zoomRatio}:this.snapshot.settings.zoomRatio=1}};__name(_DocumentDataModelSimple,"DocumentDataModelSimple");let DocumentDataModelSimple=_DocumentDataModelSimple;const _DocumentDataModel=class _DocumentDataModel extends DocumentDataModelSimple{constructor(snapshot){var _a17,_b2;super(Tools.isEmptyObject(snapshot)?getEmptySnapshot$1():snapshot);__publicField(this,"_unitId");__publicField(this,"headerModelMap",new Map);__publicField(this,"footerModelMap",new Map);__publicField(this,"change$",new rxjs.BehaviorSubject(0));const UNIT_ID_LENGTH=6;this._unitId=(_a17=this.snapshot.id)!=null?_a17:Tools.generateRandomId(UNIT_ID_LENGTH),this._initializeHeaderFooterModel(),this._name$.next((_b2=this.snapshot.title)!=null?_b2:"")}dispose(){super.dispose(),this.headerModelMap.forEach(header=>{header.dispose()}),this.footerModelMap.forEach(footer=>{footer.dispose()}),this._name$.complete()}getDrawings(){return this.snapshot.drawings}getDrawingsOrder(){return this.snapshot.drawingsOrder}getCustomRanges(){var _a17;return(_a17=this.snapshot.body)==null?void 0:_a17.customRanges}getCustomDecorations(){var _a17;return(_a17=this.snapshot.body)==null?void 0:_a17.customDecorations}getSettings(){return this.snapshot.settings}reset(snapshot){if(snapshot.id&&snapshot.id!==this._unitId)throw new Error("Cannot reset a document model with a different unit id!");this.snapshot={...DEFAULT_DOC,...snapshot},this._initializeHeaderFooterModel(),this.change$.next(this.change$.value+1)}getSelfOrHeaderFooterModel(segmentId){if(segmentId!=null){if(this.headerModelMap.has(segmentId))return this.headerModelMap.get(segmentId);if(this.footerModelMap.has(segmentId))return this.footerModelMap.get(segmentId)}return this}getUnitId(){return this._unitId}apply(actions){if(!JSONX.isNoop(actions))return this.snapshot=JSONX.apply(this.snapshot,actions),actions!=null&&actions.some(a=>Array.isArray(a)&&((a==null?void 0:a[0])==="headers"||(a==null?void 0:a[0])==="footers"))&&(this.headerModelMap.clear(),this.footerModelMap.clear(),this._initializeHeaderFooterModel()),this.change$.next(this.change$.value+1),this.snapshot}sliceBody(startOffset,endOffset,type2=SliceBodyType.copy){const body=this.getBody();if(body!=null)return getBodySlice(body,startOffset,endOffset,!1,type2)}_initializeHeaderFooterModel(){const{headers,footers}=this.getSnapshot();if(headers)for(const headerId in headers){const header=headers[headerId];this.headerModelMap.set(headerId,new _DocumentDataModel(header)),this.headerModelMap.get(headerId).updateDocumentId(this.getUnitId())}if(footers)for(const footerId in footers){const footer=footers[footerId];this.footerModelMap.set(footerId,new _DocumentDataModel(footer)),this.footerModelMap.get(footerId).updateDocumentId(this.getUnitId())}}updateDocumentId(unitId){super.updateDocumentId(unitId),this._unitId=unitId}};__name(_DocumentDataModel,"DocumentDataModel");let DocumentDataModel=_DocumentDataModel;function addCustomDecorationTextX(param){const{ranges,id,type:type2}=param,textX=new TextX;let cursor2=0;for(let i=0;i<ranges.length;i++){const range=ranges[i],{startOffset:start,endOffset:end}=range;start>0&&textX.push({t:TextXActionType.RETAIN,len:start-cursor2}),textX.push({t:TextXActionType.RETAIN,body:{dataStream:"",customDecorations:[{id,type:type2,startIndex:0,endIndex:end-start-1}]},len:end-start}),cursor2=end}return textX}__name(addCustomDecorationTextX,"addCustomDecorationTextX");function deleteCustomDecorationTextX(params){var _a17,_b2,_c;const{id,segmentId,documentDataModel}=params,body=documentDataModel==null?void 0:documentDataModel.getBody();if(!documentDataModel||!body)return!1;const decoration=(_c=(_b2=(_a17=documentDataModel.getSelfOrHeaderFooterModel(segmentId))==null?void 0:_a17.getBody())==null?void 0:_b2.customDecorations)==null?void 0:_c.find(d=>d.id===id);if(!decoration)return!1;const textX=new TextX,{startIndex,endIndex}=decoration,len=endIndex-startIndex+1;return textX.push({t:TextXActionType.RETAIN,len:startIndex}),textX.push({t:TextXActionType.RETAIN,len,body:{dataStream:"",customDecorations:[{startIndex:0,endIndex:len-1,id,type:CustomDecorationType.DELETED}]}}),textX}__name(deleteCustomDecorationTextX,"deleteCustomDecorationTextX");function isIntersecting(line1Start,line1End,line2Start,line2End){return line1Start<=line2Start&&line1End>=line2Start||line1Start>=line2Start&&line1Start<=line2End}__name(isIntersecting,"isIntersecting");function getCustomRangesInterestsWithSelection(range,customRanges){const result=[];for(let i=0,len=customRanges.length;i<len;i++){const customRange=customRanges[i];range.collapsed?customRange.startIndex<range.startOffset&&range.startOffset<=customRange.endIndex&&result.push(customRange):isIntersecting(range.startOffset,range.endOffset-1,customRange.startIndex,customRange.endIndex)&&result.push(customRange)}return result}__name(getCustomRangesInterestsWithSelection,"getCustomRangesInterestsWithSelection");function copyCustomRange(range){return{...Tools.deepClone(range),rangeId:generateRandomId()}}__name(copyCustomRange,"copyCustomRange");function excludePointsFromRange(range,points){const newRanges=[];let start=range[0];for(const point of points)point<range[0]||point>range[1]||(start<point&&newRanges.push([start,point-1]),start=point+1);return start<=range[1]&&newRanges.push([start,range[1]]),newRanges}__name(excludePointsFromRange,"excludePointsFromRange");function getIntersectingCustomRanges(startIndex,endIndex,customRanges,rangeType){const relativeCustomRanges=[];for(let i=0,len=customRanges.length;i<len;i++){const customRange=customRanges[i];if((rangeType===void 0||customRange.rangeType===rangeType)&&Math.max(customRange.startIndex,startIndex)<=Math.min(customRange.endIndex,endIndex)&&relativeCustomRanges.push({...customRange}),customRange.startIndex>endIndex)break}return relativeCustomRanges}__name(getIntersectingCustomRanges,"getIntersectingCustomRanges");function getSelectionForAddCustomRange(range,body){var _a17,_b2,_c,_d,_e;const ranges=getIntersectingCustomRanges(range.startOffset,range.collapsed?range.startOffset:range.endOffset-1,(_a17=body.customRanges)!=null?_a17:[]),startOffset=Math.min(range.startOffset,(_c=(_b2=ranges[0])==null?void 0:_b2.startIndex)!=null?_c:1/0),endOffset=Math.max(range.endOffset,((_e=(_d=ranges[ranges.length-1])==null?void 0:_d.endIndex)!=null?_e:-1/0)+1);return{startOffset,endOffset,collapsed:startOffset===endOffset}}__name(getSelectionForAddCustomRange,"getSelectionForAddCustomRange");function deleteCustomRangeTextX(params){var _a17,_b2,_c;const{rangeId,segmentId,documentDataModel,insert}=params,range=(_b2=(_a17=documentDataModel.getSelfOrHeaderFooterModel(segmentId).getBody())==null?void 0:_a17.customRanges)==null?void 0:_b2.find(r=>r.rangeId===rangeId);if(!range)return!1;const{startIndex,endIndex}=range,textX=new TextX,len=endIndex-startIndex+1;textX.push({t:TextXActionType.RETAIN,len:startIndex}),textX.push({t:TextXActionType.RETAIN,len,body:{dataStream:"",customRanges:[]}}),insert&&textX.push({t:TextXActionType.INSERT,body:insert,len:insert.dataStream.length});const end=endIndex+1+((_c=insert==null?void 0:insert.dataStream.length)!=null?_c:0);return textX.selections=[{startOffset:end,endOffset:end,collapsed:!0}],textX}__name(deleteCustomRangeTextX,"deleteCustomRangeTextX");function addCustomRangeTextX(param){const{ranges,rangeId,rangeType,wholeEntity,properties,body}=param;let cursor2=0;const textX=new TextX;let changed=!1;return ranges.forEach(range=>{var _a17,_b2,_c;const actualRange=getSelectionForAddCustomRange(range,body);if(!actualRange||!body)return!1;const{startOffset,endOffset}=actualRange,customRanges=(_a17=body.customRanges)!=null?_a17:[],addCustomRange=__name((startIndex,endIndex,index2)=>{var _a18,_b3,_c2,_d;const relativeCustomRanges=getIntersectingCustomRanges(startIndex,endIndex,customRanges,rangeType),rangeStartIndex=Math.min((_b3=(_a18=relativeCustomRanges[0])==null?void 0:_a18.startIndex)!=null?_b3:1/0,startIndex),rangeEndIndex=Math.max((_d=(_c2=relativeCustomRanges[relativeCustomRanges.length-1])==null?void 0:_c2.endIndex)!=null?_d:-1/0,endIndex),customRange={rangeId:index2?`${rangeId}$${index2}`:rangeId,rangeType,startIndex:0,endIndex:rangeEndIndex-rangeStartIndex,wholeEntity,properties:{...properties}};textX.push({t:TextXActionType.RETAIN,len:rangeStartIndex-cursor2}),textX.push({t:TextXActionType.RETAIN,len:rangeEndIndex-rangeStartIndex+1,body:{dataStream:"",customRanges:[customRange]},coverType:UpdateDocsAttributeType.COVER}),cursor2=rangeEndIndex+1},"addCustomRange"),relativeParagraphs=((_b2=body.paragraphs)!=null?_b2:[]).filter(p=>p.startIndex<endOffset&&p.startIndex>startOffset),customBlocks=((_c=body.customBlocks)!=null?_c:[]).filter(block=>block.startIndex<endOffset&&block.startIndex>startOffset);excludePointsFromRange([startOffset,endOffset-1],[...relativeParagraphs.map(p=>p.startIndex),...customBlocks.map(b=>b.startIndex)]).forEach(([start,end],i)=>addCustomRange(start,end,i)),changed=!0,textX.selections=[{startOffset:actualRange.endOffset,endOffset:actualRange.endOffset,collapsed:!0}]}),changed?textX:!1}__name(addCustomRangeTextX,"addCustomRangeTextX");function deleteSelectionTextX(selections,body,memoryCursor=0,insertBody=null,keepBullet=!0){selections.sort((a,b)=>a.startOffset-b.startOffset);const dos=[],{paragraphs=[]}=body,paragraphInRange=paragraphs==null?void 0:paragraphs.find(p=>p.startIndex>=selections[0].startOffset&&p.startIndex<selections[0].endOffset);let cursor2=memoryCursor;if(selections.forEach(selection=>{const{startOffset,endOffset}=selection;startOffset>cursor2&&(dos.push({t:TextXActionType.RETAIN,len:startOffset-cursor2}),cursor2=startOffset),cursor2<endOffset&&(dos.push({t:TextXActionType.DELETE,len:endOffset-cursor2}),cursor2=endOffset)}),insertBody&&dos.push({t:TextXActionType.INSERT,body:insertBody,len:insertBody.dataStream.length}),paragraphInRange&&keepBullet){const nextParagraph=paragraphs.find(p=>p.startIndex-memoryCursor>=selections[selections.length-1].endOffset-1);nextParagraph&&(nextParagraph.startIndex>cursor2&&(dos.push({t:TextXActionType.RETAIN,len:nextParagraph.startIndex-cursor2}),cursor2=nextParagraph.startIndex),dos.push({t:TextXActionType.RETAIN,len:1,body:{dataStream:"",paragraphs:[{...nextParagraph,startIndex:0,bullet:paragraphInRange==null?void 0:paragraphInRange.bullet}]},coverType:UpdateDocsAttributeType.REPLACE}))}return dos}__name(deleteSelectionTextX,"deleteSelectionTextX");function retainSelectionTextX(selections,body,memoryCursor=0){const dos=[];let cursor2=memoryCursor;return selections.forEach(selection=>{const{startOffset,endOffset}=selection;startOffset>cursor2&&(dos.push({t:TextXActionType.RETAIN,len:startOffset-cursor2}),cursor2=startOffset),endOffset>cursor2&&(dos.push({t:TextXActionType.RETAIN,len:endOffset-cursor2,body:{...Tools.deepClone(body),dataStream:""}}),cursor2=endOffset)}),dos}__name(retainSelectionTextX,"retainSelectionTextX");const replaceSelectionTextX=__name(params=>{var _a17;const{selection,body:insertBody,doc}=params,segmentId=selection.segmentId,body=(_a17=doc.getSelfOrHeaderFooterModel(segmentId))==null?void 0:_a17.getBody();if(!body)return!1;const oldBody=selection.collapsed?null:getBodySlice(body,selection.startOffset,selection.endOffset),diffs=textDiff(oldBody?oldBody.dataStream:"",insertBody.dataStream);let cursor2=0;const actions=diffs.map(([type2,text])=>{switch(type2){case 0:{const action={t:TextXActionType.RETAIN,body:{...getBodySlice(insertBody,cursor2,cursor2+text.length,!1),dataStream:""},len:text.length};return cursor2+=text.length,action}case 1:{const action={t:TextXActionType.INSERT,body:getBodySlice(insertBody,cursor2,cursor2+text.length),len:text.length};return cursor2+=text.length,action}default:return{t:TextXActionType.DELETE,len:text.length}}}),textX=new TextX;return textX.push({t:TextXActionType.RETAIN,len:selection.startOffset}),textX.push(...actions),textX},"replaceSelectionTextX");function isTextRunsEqual(textRuns,oldTextRuns){return!!((textRuns==null?void 0:textRuns.length)===(oldTextRuns==null?void 0:oldTextRuns.length)&&(textRuns!=null&&textRuns.every((textRun,index2)=>JSON.stringify(textRun)===JSON.stringify(oldTextRuns==null?void 0:oldTextRuns[index2]))))}__name(isTextRunsEqual,"isTextRunsEqual");const replaceSelectionTextRuns=__name(params=>{var _a17;const{selection,body:insertBody,doc}=params,segmentId=selection.segmentId,body=(_a17=doc.getSelfOrHeaderFooterModel(segmentId))==null?void 0:_a17.getBody();if(!body)return!1;const oldBody=selection.collapsed?null:getBodySlice(body,selection.startOffset,selection.endOffset),diffs=textDiff(oldBody?oldBody.dataStream:"",insertBody.dataStream);let cursor2=0;const actions=diffs.map(([type2,text])=>{switch(type2){case 0:{const textRunsSlice=getTextRunSlice(insertBody,cursor2,cursor2+text.length,!1),oldTextRunsSlice=getTextRunSlice(oldBody,cursor2,cursor2+text.length,!1),action={t:TextXActionType.RETAIN,body:isTextRunsEqual(textRunsSlice,oldTextRunsSlice)?void 0:{textRuns:textRunsSlice,dataStream:""},len:text.length};return cursor2+=text.length,action}case 1:{const action={t:TextXActionType.INSERT,body:getBodySlice(insertBody,cursor2,cursor2+text.length),len:text.length};return cursor2+=text.length,action}default:return{t:TextXActionType.DELETE,len:text.length}}});if(actions.every(action=>action.t===TextXActionType.RETAIN&&!action.body))return!1;const textX=new TextX;return textX.push({t:TextXActionType.RETAIN,len:selection.startOffset}),textX.push(...actions),textX},"replaceSelectionTextRuns");function getCustomBlockIdsInSelections(body,selections){const customBlockIds=[],{customBlocks=[]}=body;for(const selection of selections){const{startOffset,endOffset}=selection;if(!(startOffset==null||endOffset==null))for(const customBlock of customBlocks){const{startIndex}=customBlock;startIndex>=startOffset&&startIndex<endOffset&&customBlockIds.push(customBlock.blockId)}}return customBlockIds}__name(getCustomBlockIdsInSelections,"getCustomBlockIdsInSelections");function getRichTextEditPath(docDataModel,segmentId=""){if(!segmentId)return["body"];const{headers,footers}=docDataModel.getSnapshot();if(headers==null&&footers==null)throw new Error("Document data model must have headers or footers when update by segment id");if((headers==null?void 0:headers[segmentId])!=null)return["headers",segmentId,"body"];if((footers==null?void 0:footers[segmentId])!=null)return["footers",segmentId,"body"];throw new Error("Segment id not found in headers or footers")}__name(getRichTextEditPath,"getRichTextEditPath");const addDrawing=__name(param=>{var _a17,_b2,_c,_d;const{selection,documentDataModel,drawings}=param,{collapsed,startOffset,segmentId}=selection,textX=new TextX,jsonX=JSONX.getInstance(),rawActions=[],body=documentDataModel.getSelfOrHeaderFooterModel(segmentId).getBody();if(!body)return!1;const drawingOrderLength=(_b2=(_a17=documentDataModel.getSnapshot().drawingsOrder)==null?void 0:_a17.length)!=null?_b2:0;let removeDrawingLen=0;if(collapsed)startOffset>0&&textX.push({t:TextXActionType.RETAIN,len:startOffset});else{const dos=deleteSelectionTextX([selection],body,0,null,!1);textX.push(...dos);const removedCustomBlockIds=getCustomBlockIdsInSelections(body,[selection]),drawings2=(_c=documentDataModel.getDrawings())!=null?_c:{},drawingOrder=(_d=documentDataModel.getDrawingsOrder())!=null?_d:[],sortedRemovedCustomBlockIds=removedCustomBlockIds.sort((a,b)=>drawingOrder.indexOf(a)>drawingOrder.indexOf(b)?-1:drawingOrder.indexOf(a)<drawingOrder.indexOf(b)?1:0);if(sortedRemovedCustomBlockIds.length>0)for(const blockId of sortedRemovedCustomBlockIds){const drawing=drawings2[blockId],drawingIndex=drawingOrder.indexOf(blockId);if(drawing==null||drawingIndex<0)continue;const removeDrawingAction=jsonX.removeOp(["drawings",blockId],drawing),removeDrawingOrderAction=jsonX.removeOp(["drawingsOrder",drawingIndex],blockId);rawActions.push(removeDrawingAction),rawActions.push(removeDrawingOrderAction),removeDrawingLen++}}textX.push({t:TextXActionType.INSERT,body:{dataStream:"\b".repeat(drawings.length),customBlocks:drawings.map((drawing,i)=>({startIndex:i,blockId:drawing.drawingId}))},len:drawings.length});const path=getRichTextEditPath(documentDataModel,segmentId),placeHolderAction=jsonX.editOp(textX.serialize(),path);rawActions.push(placeHolderAction);for(const drawing of drawings){const{drawingId}=drawing,addDrawingAction=jsonX.insertOp(["drawings",drawingId],drawing),addDrawingOrderAction=jsonX.insertOp(["drawingsOrder",drawingOrderLength-removeDrawingLen],drawingId);rawActions.push(addDrawingAction),rawActions.push(addDrawingOrderAction)}return rawActions.reduce((acc,cur)=>JSONX.compose(acc,cur),null)},"addDrawing"),switchParagraphBullet=__name(params=>{var _a17,_b2,_c;const{paragraphs:currentParagraphs,segmentId,document:docDataModel}=params;let listType=params.listType;const paragraphs=(_b2=(_a17=docDataModel.getSelfOrHeaderFooterModel(segmentId).getBody())==null?void 0:_a17.paragraphs)!=null?_b2:[],isAlreadyList=currentParagraphs.every(paragraph=>{var _a18;return((_a18=paragraph.bullet)==null?void 0:_a18.listType.indexOf(listType))===0});let listId=Tools.generateRandomId(6);if(currentParagraphs.length===1){const curIndex=paragraphs.indexOf(currentParagraphs[0]),prevParagraph=paragraphs[curIndex-1],nextParagraph=paragraphs[curIndex+1];prevParagraph&&prevParagraph.bullet&&prevParagraph.bullet.listType.indexOf(listType)===0?(listId=prevParagraph.bullet.listId,listType!==PresetListType.CHECK_LIST&&(listType=prevParagraph.bullet.listType)):nextParagraph&&nextParagraph.bullet&&nextParagraph.bullet.listType.indexOf(listType)===0&&(listId=nextParagraph.bullet.listId,listType!==PresetListType.CHECK_LIST&&(listType=nextParagraph.bullet.listType))}const memoryCursor=new MemoryCursor;memoryCursor.reset();const textX=new TextX;for(const paragraph of currentParagraphs){const{startIndex,paragraphStyle={},bullet}=paragraph;textX.push({t:TextXActionType.RETAIN,len:startIndex-memoryCursor.cursor}),textX.push({t:TextXActionType.RETAIN,len:1,body:{dataStream:"",paragraphs:[isAlreadyList?{paragraphStyle,startIndex:0}:{startIndex:0,paragraphStyle:{...paragraphStyle},bullet:{nestingLevel:(_c=bullet==null?void 0:bullet.nestingLevel)!=null?_c:0,textStyle:{fs:20},listType,listId}}]},coverType:UpdateDocsAttributeType.REPLACE}),memoryCursor.moveCursorTo(startIndex+1)}return textX},"switchParagraphBullet"),toggleChecklistParagraph=__name(params=>{var _a17;const{paragraphIndex,segmentId,document:docDataModel}=params,paragraphs=(_a17=docDataModel.getSelfOrHeaderFooterModel(segmentId).getBody())==null?void 0:_a17.paragraphs;if(paragraphs==null)return!1;const currentParagraph=paragraphs.find(p=>p.startIndex===paragraphIndex);if(!(currentParagraph!=null&&currentParagraph.bullet)||currentParagraph.bullet.listType.indexOf(PresetListType.CHECK_LIST)===-1)return!1;const memoryCursor=new MemoryCursor;memoryCursor.reset();const textX=new TextX,{startIndex,paragraphStyle={}}=currentParagraph,listType=currentParagraph.bullet.listType===PresetListType.CHECK_LIST?PresetListType.CHECK_LIST_CHECKED:PresetListType.CHECK_LIST;return textX.push({t:TextXActionType.RETAIN,len:startIndex-memoryCursor.cursor}),textX.push({t:TextXActionType.RETAIN,len:1,body:{dataStream:"",paragraphs:[{...currentParagraph,paragraphStyle,startIndex:0,bullet:{...currentParagraph.bullet,listType}}]},coverType:UpdateDocsAttributeType.REPLACE}),memoryCursor.moveCursorTo(startIndex+1),textX},"toggleChecklistParagraph"),setParagraphBullet=__name(params=>{var _a17,_b2;const{paragraphs:currentParagraphs,listType,segmentId,document:docDataModel}=params;if(((_a17=docDataModel.getSelfOrHeaderFooterModel(segmentId).getBody())==null?void 0:_a17.paragraphs)==null)return!1;const listId=Tools.generateRandomId(6),memoryCursor=new MemoryCursor;memoryCursor.reset();const textX=new TextX;for(const paragraph of currentParagraphs){const{startIndex,paragraphStyle={},bullet}=paragraph;textX.push({t:TextXActionType.RETAIN,len:startIndex-memoryCursor.cursor}),textX.push({t:TextXActionType.RETAIN,len:1,body:{dataStream:"",paragraphs:[{startIndex:0,paragraphStyle,bullet:{nestingLevel:(_b2=bullet==null?void 0:bullet.nestingLevel)!=null?_b2:0,textStyle:(bullet==null?void 0:bullet.listType)===listType?bullet.textStyle:{fs:20},listType,listId}}]},coverType:UpdateDocsAttributeType.REPLACE}),memoryCursor.moveCursorTo(startIndex+1)}return textX},"setParagraphBullet");function hasParagraphInTable(paragraph,tables){return tables.some(table=>paragraph.startIndex>table.startIndex&&paragraph.startIndex<table.endIndex)}__name(hasParagraphInTable,"hasParagraphInTable");const changeParagraphBulletNestLevel=__name(params=>{var _a17,_b2,_c;const{paragraphs:currentParagraphs,segmentId,document:docDataModel,type:type2}=params,memoryCursor=new MemoryCursor;memoryCursor.reset();const textX=new TextX,customLists=(_a17=docDataModel.getSnapshot().lists)!=null?_a17:{},tables=(_c=(_b2=docDataModel.getBody())==null?void 0:_b2.tables)!=null?_c:[],lists={...PRESET_LIST_TYPE,...customLists};for(const paragraph of currentParagraphs){const{startIndex,paragraphStyle={},bullet}=paragraph,isInTable=hasParagraphInTable(paragraph,tables);if(textX.push({t:TextXActionType.RETAIN,len:startIndex-memoryCursor.cursor}),bullet){const listType=bullet.listType;let maxLevel=lists[listType].nestingLevel.length-1;isInTable&&(maxLevel=Math.min(maxLevel,2)),textX.push({t:TextXActionType.RETAIN,len:1,body:{dataStream:"",paragraphs:[{startIndex:0,paragraphStyle:{...paragraphStyle},bullet:{...bullet,nestingLevel:Math.max(Math.min(bullet.nestingLevel+type2,maxLevel),0)}}]},coverType:UpdateDocsAttributeType.REPLACE})}else textX.push({t:TextXActionType.RETAIN,len:1});memoryCursor.moveCursorTo(startIndex+1)}return textX},"changeParagraphBulletNestLevel");var DataStreamTreeNodeType=(DataStreamTreeNodeType2=>(DataStreamTreeNodeType2.PARAGRAPH="PARAGRAPH",DataStreamTreeNodeType2.SECTION_BREAK="SECTION_BREAK",DataStreamTreeNodeType2.TABLE="TABLE",DataStreamTreeNodeType2.TABLE_ROW="TABLE_ROW",DataStreamTreeNodeType2.TABLE_CELL="TABLE_CELL",DataStreamTreeNodeType2.CUSTOM_BLOCK="CUSTOM_BLOCK",DataStreamTreeNodeType2))(DataStreamTreeNodeType||{}),DataStreamTreeTokenType=(DataStreamTreeTokenType2=>(DataStreamTreeTokenType2.PARAGRAPH="\r",DataStreamTreeTokenType2.SECTION_BREAK=`
9
+ `,DataStreamTreeTokenType2.TABLE_START="",DataStreamTreeTokenType2.TABLE_ROW_START="\x1B",DataStreamTreeTokenType2.TABLE_CELL_START="",DataStreamTreeTokenType2.TABLE_CELL_END="",DataStreamTreeTokenType2.TABLE_ROW_END="",DataStreamTreeTokenType2.TABLE_END="",DataStreamTreeTokenType2.CUSTOM_RANGE_START="",DataStreamTreeTokenType2.CUSTOM_RANGE_END="",DataStreamTreeTokenType2.COLUMN_BREAK="\v",DataStreamTreeTokenType2.PAGE_BREAK="\f",DataStreamTreeTokenType2.DOCS_END="\0",DataStreamTreeTokenType2.TAB=" ",DataStreamTreeTokenType2.CUSTOM_BLOCK="\b",DataStreamTreeTokenType2.LETTER="",DataStreamTreeTokenType2.SPACE=" ",DataStreamTreeTokenType2))(DataStreamTreeTokenType||{});function makeCustomRangeStream(stream){return`${stream}`}__name(makeCustomRangeStream,"makeCustomRangeStream");const tags=[DataStreamTreeTokenType.TABLE_START,DataStreamTreeTokenType.TABLE_ROW_START,DataStreamTreeTokenType.TABLE_CELL_START,DataStreamTreeTokenType.TABLE_CELL_END,DataStreamTreeTokenType.TABLE_ROW_END,DataStreamTreeTokenType.TABLE_END],getPlainText=__name(dataStream=>{const text=dataStream.endsWith(`\r
10
+ `)?dataStream.slice(0,-2):dataStream;return tags.reduce((res,curr)=>res.replaceAll(curr,""),text)},"getPlainText"),isEmptyDocument=__name(dataStream=>dataStream?getPlainText(dataStream).replaceAll("\r","")==="":!0,"isEmptyDocument"),fromPlainText=__name(text=>{const dataStream=text.replace(/\n/g,"\r"),paragraphs=[],customRanges=[];let cursor2=0,newDataStream="";const loopParagraph=__name((i,insertP=!0)=>{const paragraphText=dataStream.slice(cursor2,i);if(Tools.isLegalUrl(paragraphText)){const id=generateRandomId(),urlText=`${paragraphText}`,range={startIndex:cursor2,endIndex:cursor2+urlText.length-1,rangeId:id,rangeType:CustomRangeType.HYPERLINK,properties:{url:text}};customRanges.push(range),newDataStream+=urlText,cursor2=i+1,insertP&&(newDataStream+="\r",paragraphs.push({startIndex:i}))}else newDataStream+=dataStream.slice(cursor2,i+1),cursor2=i+1,insertP&&paragraphs.push({startIndex:i})},"loopParagraph");let end=0;for(let i=0;i<dataStream.length;i++)dataStream[i]==="\r"&&(loopParagraph(i),end=i);return(end!==dataStream.length-1||dataStream.length===1)&&loopParagraph(dataStream.length,!1),{dataStream:newDataStream,paragraphs,customRanges}},"fromPlainText");function makeSelection(startOffset,endOffset){if(typeof endOffset>"u")return{startOffset,endOffset:startOffset,collapsed:!0};if(endOffset<startOffset)throw new Error(`Cannot make a doc selection when endOffset ${endOffset} is less than startOffset ${startOffset}.`);return{startOffset,endOffset,collapsed:startOffset===endOffset}}__name(makeSelection,"makeSelection");function normalizeSelection(selection){const{startOffset,endOffset,collapsed}=selection,start=Math.min(startOffset,endOffset),end=Math.max(startOffset,endOffset);return{startOffset:start,endOffset:end,collapsed}}__name(normalizeSelection,"normalizeSelection");function isSegmentIntersects(start,end,start2,end2){return Math.max(start,start2)<=Math.min(end,end2)}__name(isSegmentIntersects,"isSegmentIntersects");const _BuildTextUtils=class _BuildTextUtils{};__name(_BuildTextUtils,"BuildTextUtils"),__publicField(_BuildTextUtils,"customRange",{add:addCustomRangeTextX,delete:deleteCustomRangeTextX,copyCustomRange,getCustomRangesInterestsWithSelection,isIntersecting}),__publicField(_BuildTextUtils,"customDecoration",{add:addCustomDecorationTextX,delete:deleteCustomDecorationTextX}),__publicField(_BuildTextUtils,"selection",{replace:replaceSelectionTextX,makeSelection,normalizeSelection,delete:deleteSelectionTextX,replaceTextRuns:replaceSelectionTextRuns,retain:retainSelectionTextX}),__publicField(_BuildTextUtils,"range",{isIntersects:isSegmentIntersects}),__publicField(_BuildTextUtils,"transform",{getPlainText,fromPlainText,isEmptyDocument}),__publicField(_BuildTextUtils,"paragraph",{bullet:{set:setParagraphBullet,switch:switchParagraphBullet,toggleChecklist:toggleChecklistParagraph,changeNestLevel:changeParagraphBulletNestLevel}}),__publicField(_BuildTextUtils,"drawing",{add:addDrawing});let BuildTextUtils=_BuildTextUtils;function normalizeBody(body){if(body.customRanges||(body.customRanges=[]),!body.paragraphs){body.paragraphs=[];for(let i=0;i<body.dataStream.length;i++)body.dataStream[i]==="\r"&&body.paragraphs.push({startIndex:i})}return body.customBlocks||(body.customBlocks=[]),body.textRuns||(body.textRuns=[]),body.customDecorations||(body.customDecorations=[]),body.sectionBreaks||(body.sectionBreaks=[]),body.tables||(body.tables=[]),body}__name(normalizeBody,"normalizeBody");function normalizeData(data){var _a17;return data.body=normalizeBody((_a17=data.body)!=null?_a17:{dataStream:""}),data.drawingsOrder||(data.drawingsOrder=[]),data.drawings||(data.drawings={}),data.documentStyle||(data.documentStyle={}),data}__name(normalizeData,"normalizeData");const _TextStyleValue=class _TextStyleValue{constructor(style={}){__publicField(this,"_style");this._style=style}static create(style={}){return new _TextStyleValue(style)}get fontFamily(){return this._style.ff}get fontSize(){return this._style.fs}get italic(){return this._style.it===BooleanNumber.TRUE}get bold(){return this._style.bl===BooleanNumber.TRUE}get underline(){return this._style.ul&&TextDecorationBuilder.create(this._style.ul)}get bottomBorderLine(){return this._style.bbl&&TextDecorationBuilder.create(this._style.bbl)}get strikethrough(){return this._style.st&&TextDecorationBuilder.create(this._style.st)}get overline(){return this._style.ol&&TextDecorationBuilder.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 TextStyleBuilder.create(Tools.deepClone(this._style))}getValue(){return{...this._style}}};__name(_TextStyleValue,"TextStyleValue");let TextStyleValue=_TextStyleValue;const _TextStyleBuilder=class _TextStyleBuilder extends TextStyleValue{static create(style={}){return new _TextStyleBuilder(style)}constructor(style={}){super(style)}setFontFamily(family){return this._style.ff=family,this}setFontSize(size){return this._style.fs=size,this}setItalic(value){return this._style.it=value?1:0,this}setBold(value){return this._style.bl=value?1:0,this}setUnderline(decoration){return this._style.ul=decoration.build(),this}setBottomBorderLine(decoration){return this._style.bbl=decoration.build(),this}setStrikethrough(decoration){return this._style.st=decoration.build(),this}setOverline(decoration){return this._style.ol=decoration.build(),this}setBackground(color){return this._style.bg=color,this}setBorder(border){return this._style.bd=border,this}setColor(color){return this._style.cl=color,this}setVerticalAlign(offset){return this._style.va=offset,this}copy(){return _TextStyleBuilder.create(Tools.deepClone(this._style))}build(){return this.getValue()}};__name(_TextStyleBuilder,"TextStyleBuilder");let TextStyleBuilder=_TextStyleBuilder;const _TextDecorationBuilder=class _TextDecorationBuilder{constructor(decoration={s:1}){__publicField(this,"_decoration");this._decoration=decoration}static create(decoration={s:1}){return new _TextDecorationBuilder(decoration)}get show(){return this._decoration.s===BooleanNumber.TRUE}get followFontColor(){return this._decoration.c===BooleanNumber.TRUE}get color(){return this._decoration.cl}get type(){return this._decoration.t}setShow(value){return this._decoration.s=value?1:0,this}setFollowFontColor(value){return this._decoration.c=value?1:0,this}setColor(color){return this._decoration.cl=color,this}setLineType(type2){return this._decoration.t=type2,this}copy(){return _TextDecorationBuilder.create(Tools.deepClone(this._decoration))}build(){return{...this._decoration}}};__name(_TextDecorationBuilder,"TextDecorationBuilder");let TextDecorationBuilder=_TextDecorationBuilder;const _ParagraphStyleValue=class _ParagraphStyleValue{constructor(style={}){__publicField(this,"_style");this._style=style}static create(style={}){return new _ParagraphStyleValue(style)}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===BooleanNumber.TRUE}get keepNext(){return this._style.keepNext===BooleanNumber.TRUE}get wordWrap(){return this._style.wordWrap===BooleanNumber.TRUE}get widowControl(){return this._style.widowControl===BooleanNumber.TRUE}get shading(){return this._style.shading}get suppressHyphenation(){return this._style.suppressHyphenation===BooleanNumber.TRUE}copy(){return ParagraphStyleBuilder.create(Tools.deepClone(this._style))}getValue(){return this._style}};__name(_ParagraphStyleValue,"ParagraphStyleValue");let ParagraphStyleValue=_ParagraphStyleValue;const _ParagraphStyleBuilder=class _ParagraphStyleBuilder extends ParagraphStyleValue{static create(style={}){return new _ParagraphStyleBuilder(style)}constructor(style={}){super(style)}setIndentFirstLine(value){return this._style.indentFirstLine=value,this}setHanging(value){return this._style.hanging=value,this}setIndentStart(value){return this._style.indentStart=value,this}setTabStops(value){return this._style.tabStops=value,this}setIndentEnd(value){return this._style.indentEnd=value,this}setTextStyle(value){return this._style.textStyle=value,this}setHeadingId(value){return this._style.headingId=value,this}setNamedStyleType(value){return this._style.namedStyleType=value,this}setHorizontalAlign(value){return this._style.horizontalAlign=value,this}setLineSpacing(value){return this._style.lineSpacing=value,this}setDirection(value){return this._style.direction=value,this}setSpacingRule(value){return this._style.spacingRule=value,this}setSnapToGrid(value){return this._style.snapToGrid=value?1:0,this}setSpaceAbove(value){return this._style.spaceAbove=value,this}setSpaceBelow(value){return this._style.spaceBelow=value,this}setBorderBetween(value){return this._style.borderBetween=value,this}setBorderTop(value){return this._style.borderTop=value,this}setBorderBottom(value){return this._style.borderBottom=value,this}setBorderLeft(value){return this._style.borderLeft=value,this}setBorderRight(value){return this._style.borderRight=value,this}setKeepLines(value){return this._style.keepLines=value?1:0,this}setKeepNext(value){return this._style.keepNext=value?1:0,this}setWordWrap(value){return this._style.wordWrap=value?1:0,this}setWidowControl(value){return this._style.widowControl=value?1:0,this}setShading(value){return this._style.shading=value,this}setSuppressHyphenation(value){return this._style.suppressHyphenation=value?1:0,this}copy(){return _ParagraphStyleBuilder.create(Tools.deepClone(this._style))}build(){return this.getValue()}};__name(_ParagraphStyleBuilder,"ParagraphStyleBuilder");let ParagraphStyleBuilder=_ParagraphStyleBuilder;const _RichTextValue=class _RichTextValue{constructor(data){__publicField(this,"_data");if(!data.body)throw new Error("Invalid document data, body is required");this._data=normalizeData(data)}static create(data){return new _RichTextValue(data)}static createByBody(data){return new _RichTextValue({body:data,id:"d",documentStyle:{}})}copy(){return RichTextBuilder.create(Tools.deepClone(this._data))}slice(start,end){const{body,...ext}=this._data;return RichTextBuilder.create({...Tools.deepClone(ext),body:getBodySlice(body,start,end)})}toPlainText(){var _a17,_b2;return BuildTextUtils.transform.getPlainText((_b2=(_a17=this._data.body)==null?void 0:_a17.dataStream)!=null?_b2:"").replaceAll("\r",`
11
+ `)}getParagraphStyle(){var _a17,_b2;return ParagraphStyleValue.create((_b2=(_a17=this._data.body)==null?void 0:_a17.paragraphs)==null?void 0:_b2[0].paragraphStyle)}getParagraphBullet(){var _a17,_b2;return(_b2=(_a17=this._data.body)==null?void 0:_a17.paragraphs)==null?void 0:_b2[0].bullet}getParagraphs(){var _a17,_b2;const paragraphs=(_b2=(_a17=this._data.body)==null?void 0:_a17.paragraphs)!=null?_b2:[];let start=0;return paragraphs.map(paragraph=>{const sub=this.slice(start,paragraph.startIndex);return start=paragraph.startIndex,sub})}getTextRuns(){var _a17,_b2;return((_b2=(_a17=this._data.body)==null?void 0:_a17.textRuns)!=null?_b2:[]).map(t=>({...t,ts:t.ts?TextStyleValue.create(t.ts):null}))}getLinks(){var _a17,_b2,_c;return(_c=(_b2=(_a17=this._data.body)==null?void 0:_a17.customRanges)==null?void 0:_b2.filter(r=>r.rangeType===CustomRangeType.HYPERLINK))!=null?_c:[]}getData(){return this._data}};__name(_RichTextValue,"RichTextValue");let RichTextValue=_RichTextValue;const _RichTextBuilder=class _RichTextBuilder extends RichTextValue{constructor(data){super(data);__publicField(this,"_doc");this._doc=new DocumentDataModel(data)}static newEmptyData(){return normalizeData({id:"d",documentStyle:{},drawings:{},drawingsOrder:[],body:{dataStream:`\r
12
+ `,customBlocks:[],customRanges:[],paragraphs:[{startIndex:0}],textRuns:[],tables:[],sectionBreaks:[]}})}static create(data){return new _RichTextBuilder(data!=null?data:_RichTextBuilder.newEmptyData())}insertText(start,text,style){var _a17,_b2;let startIndex=((_b2=(_a17=this._data.body)==null?void 0:_a17.dataStream.length)!=null?_b2:2)-2,insertText,insertStyle;if(typeof start=="string"?insertText=start:(startIndex=Math.min(start,startIndex),insertText=text),typeof text=="object"?insertStyle=text instanceof TextStyleBuilder?text.build():text:insertStyle=style instanceof TextStyleBuilder?style.build():style,!insertText)return this;const newBody={dataStream:insertText,textRuns:insertStyle?[{ts:insertStyle,st:startIndex,ed:startIndex+insertText.length}]:[]},textX=BuildTextUtils.selection.replace({doc:this._doc,selection:{startOffset:startIndex,endOffset:startIndex,collapsed:!0},body:newBody});if(!textX)throw new Error("Insert text failed, please check.");return TextX.apply(this._doc.getBody(),textX.serialize()),this}insertRichText(start,richText){var _a17,_b2;let startIndex=((_b2=(_a17=this._data.body)==null?void 0:_a17.dataStream.length)!=null?_b2:2)-2,insertText;typeof start=="object"?insertText=start instanceof RichTextValue?start.getData():start:(startIndex=Math.min(start,startIndex),insertText=richText instanceof RichTextValue?richText.getData():richText);const textX=BuildTextUtils.selection.replace({doc:this._doc,selection:{startOffset:startIndex,endOffset:startIndex,collapsed:!0},body:insertText.body});if(!textX)throw new Error("Insert text failed, please check.");return TextX.apply(this._doc.getBody(),textX.serialize()),this}delete(start,count){if(count!==void 0){if(!count)return this;const actions=BuildTextUtils.selection.delete([{startOffset:start,endOffset:start+count,collapsed:!0}],this._data.body);TextX.apply(this._doc.getBody(),actions)}return this}setStyle(start,end,style){const newBody={dataStream:"",textRuns:[{ts:style instanceof TextStyleBuilder?style.build():style,st:0,ed:end-start}]},actions=BuildTextUtils.selection.retain([{startOffset:start,endOffset:end,collapsed:!0}],newBody);return TextX.apply(this._doc.getBody(),actions),this}setLink(start,end,link){const textX=BuildTextUtils.customRange.add({rangeType:CustomRangeType.HYPERLINK,rangeId:generateRandomId(),properties:{url:link},ranges:[{startOffset:start,endOffset:end,collapsed:!1}],body:this._data.body});if(!textX)throw new Error("Insert text failed, please check.");return TextX.apply(this._doc.getBody(),textX.serialize()),this}cancelLink(start,end){if(typeof start=="string"){const textX=BuildTextUtils.customRange.delete({rangeId:start,documentDataModel:this._doc});if(!textX)throw new Error("Insert text failed, please check.");TextX.apply(this._doc.getBody(),textX.serialize())}else this.slice(start,end).getLinks().forEach(l=>{const textX=BuildTextUtils.customRange.delete({rangeId:l.rangeId,documentDataModel:this._doc});if(!textX)throw new Error("Insert text failed, please check.");TextX.apply(this._doc.getBody(),textX.serialize())});return this}updateLink(id,url){var _a17,_b2;const current=(_b2=(_a17=this._data.body)==null?void 0:_a17.customRanges)==null?void 0:_b2.find(range=>range.rangeId===id);if(!current)throw new Error("Link not found");return current.properties.url=url,this}insertParagraph(start,paragraphStyle){var _a17,_b2;let newBody,startIndex;return typeof start=="object"?(newBody={dataStream:"\r",paragraphs:[{startIndex:0,paragraphStyle:start.build()}]},startIndex=((_b2=(_a17=this._data.body)==null?void 0:_a17.dataStream.length)!=null?_b2:2)-2):(startIndex=start,newBody={dataStream:"\r",paragraphs:[{startIndex:0,paragraphStyle:paragraphStyle==null?void 0:paragraphStyle.build()}]}),this.insertRichText(startIndex,RichTextValue.create({body:newBody,id:"d",documentStyle:{}})),this}insertLink(start,text,url){let textStr="",textUrl="";typeof start=="string"?(textStr=start,textUrl=text):(textStr=text,textUrl=url);const rich=_RichTextBuilder.createByBody({dataStream:textStr,customRanges:[{rangeType:CustomRangeType.HYPERLINK,rangeId:generateRandomId(),properties:{url:textUrl},startIndex:0,endIndex:textStr.length-1}]});return typeof start=="number"?this.insertRichText(start,rich):this.insertRichText(rich)}};__name(_RichTextBuilder,"RichTextBuilder");let RichTextBuilder=_RichTextBuilder;function throttle(fn,wait=16){let lastTime=0,timer=null;return __name(function(...args){const now2=Date.now();now2-lastTime<wait?(timer&&clearTimeout(timer),timer=setTimeout(()=>{lastTime=now2,fn.apply(this,args)},wait)):(lastTime=now2,fn.apply(this,args))},"throttled")}__name(throttle,"throttle");var InterceptorEffectEnum=(InterceptorEffectEnum2=>(InterceptorEffectEnum2[InterceptorEffectEnum2.Style=1]="Style",InterceptorEffectEnum2[InterceptorEffectEnum2.Value=2]="Value",InterceptorEffectEnum2))(InterceptorEffectEnum||{});function createInterceptorKey(key){return`sheet_interceptor_${key}`}__name(createInterceptorKey,"createInterceptorKey");const composeInterceptors=__name(interceptors=>function(initialValue,context){let index2=-1,value=initialValue;for(let i=0;i<=interceptors.length;i++){if(i<=index2)throw new Error("[SheetInterceptorService]: next() called multiple times!");if(index2=i,i===interceptors.length)return value;const interceptor=interceptors[i];let nextCalled=!1;if(value=interceptor.handler(value,context,nextValue=>(nextCalled=!0,nextValue)),!nextCalled)break}return value},"composeInterceptors"),_InterceptorManager=class _InterceptorManager{constructor(interceptorPoints){__publicField(this,"_interceptorsByName",new Map);__publicField(this,"_interceptorPoints");this._interceptorPoints=interceptorPoints}fetchThroughInterceptors(name,filter){const key=name;let interceptors=this._interceptorsByName.get(key);return filter&&(interceptors=interceptors.filter(filter)),composeInterceptors(interceptors||[])}intercept(name,interceptor){const key=name;this._interceptorsByName.has(key)||this._interceptorsByName.set(key,[]);const interceptors=this._interceptorsByName.get(key);return interceptors.push(interceptor),this._interceptorsByName.set(key,interceptors.sort((a,b)=>{var _a17,_b2;return((_a17=b.priority)!=null?_a17:0)-((_b2=a.priority)!=null?_b2:0)})),()=>remove(this._interceptorsByName.get(key),interceptor)}getInterceptPoints(){return this._interceptorPoints}dispose(){this._interceptorsByName.clear()}};__name(_InterceptorManager,"InterceptorManager");let InterceptorManager=_InterceptorManager;function createAsyncInterceptorKey(key){return`sheet_async_interceptor_${key}`}__name(createAsyncInterceptorKey,"createAsyncInterceptorKey");const composeAsyncInterceptors=__name(interceptors=>async function(initialValue,context){let index2=-1,value=initialValue;for(let i=0;i<=interceptors.length;i++){if(i<=index2)throw new Error("[SheetInterceptorService]: next() called multiple times!");if(index2=i,i===interceptors.length)return value;const interceptor=interceptors[i];let nextCalled=!1;if(value=await interceptor.handler(value,context,async nextValue=>(nextCalled=!0,nextValue)),!nextCalled)break}return value},"composeAsyncInterceptors"),_AsyncInterceptorManager=class _AsyncInterceptorManager{constructor(asyncInterceptorPoints){__publicField(this,"_asyncInterceptorsByName",new Map);__publicField(this,"_asyncInterceptorPoints");this._asyncInterceptorPoints=asyncInterceptorPoints}fetchThroughAsyncInterceptors(name,filter){const key=name;let interceptors=this._asyncInterceptorsByName.get(key);return filter&&(interceptors=interceptors.filter(filter)),composeAsyncInterceptors(interceptors||[])}async interceptAsync(name,interceptor){const key=name;this._asyncInterceptorsByName.has(key)||this._asyncInterceptorsByName.set(key,[]);const interceptors=this._asyncInterceptorsByName.get(key);return interceptors.push(interceptor),this._asyncInterceptorsByName.set(key,interceptors.sort((a,b)=>{var _a17,_b2;return((_a17=b.priority)!=null?_a17:0)-((_b2=a.priority)!=null?_b2:0)})),()=>remove(this._asyncInterceptorsByName.get(key),interceptor)}getInterceptPoints(){return this._asyncInterceptorPoints}dispose(){this._asyncInterceptorsByName.clear()}};__name(_AsyncInterceptorManager,"AsyncInterceptorManager");let AsyncInterceptorManager=_AsyncInterceptorManager;function mixinClass(targetClassPrototype,mixin){for(const key in mixin)mixin.hasOwnProperty(key)&&(targetClassPrototype[key]=mixin[key])}__name(mixinClass,"mixinClass");const _FBase=class _FBase extends Disposable{static extend(source){Object.getOwnPropertyNames(source.prototype).forEach(name=>{name!=="constructor"&&(this.prototype[name]=source.prototype[name])}),Object.getOwnPropertyNames(source).forEach(name=>{name!=="prototype"&&name!=="name"&&name!=="length"&&(this[name]=source[name])})}};__name(_FBase,"FBase");let FBase=_FBase;const InitializerSymbol=Symbol("initializers"),_FBaseInitialable=class _FBaseInitialable extends Disposable{constructor(_injector){super(),this._injector=_injector;const self2=this,initializers=Object.getPrototypeOf(this)[InitializerSymbol];initializers&&initializers.forEach(function(fn){fn.apply(self2,[_injector])})}_initialize(injector){}static extend(source){Object.getOwnPropertyNames(source.prototype).forEach(name=>{if(name==="_initialize"){let initializers=this.prototype[InitializerSymbol];initializers||(initializers=[],this.prototype[InitializerSymbol]=initializers),initializers.push(source.prototype._initialize)}else name!=="constructor"&&(this.prototype[name]=source.prototype[name])}),Object.getOwnPropertyNames(source).forEach(name=>{name!=="prototype"&&name!=="name"&&name!=="length"&&(this[name]=source[name])})}};__name(_FBaseInitialable,"FBaseInitialable");let FBaseInitialable=_FBaseInitialable;const _Registry=class _Registry{constructor(){__publicField(this,"_data",[])}static create(){return new _Registry}add(dataInstance){this._data.indexOf(dataInstance)>-1||this._data.push(dataInstance)}delete(dataInstance){const index2=this._data.indexOf(dataInstance);this._data.splice(index2,1)}getData(){return this._data}};__name(_Registry,"Registry");let Registry=_Registry;const _RegistryAsMap=class _RegistryAsMap{constructor(){__publicField(this,"_data",new Map)}static create(){return new _RegistryAsMap}add(id,dataInstance){this._data.has(id)||this._data.set(id,dataInstance)}delete(id){this._data.delete(id)}getData(){return this._data}};__name(_RegistryAsMap,"RegistryAsMap");let RegistryAsMap=_RegistryAsMap;const version="0.5.5-experimental.20250122-3362a4a";function getEmptySnapshot(unitID="",locale=LocaleType.ZH_CN,name=""){return{id:unitID,sheetOrder:[],name,appVersion:version,locale,styles:{},sheets:{},resources:[]}}__name(getEmptySnapshot,"getEmptySnapshot");const _Styles=class _Styles{constructor(styles={}){__publicField(this,"_styles");__publicField(this,"_cacheMap",new LRUMap(1e5));this._styles=styles,this._generateCacheMap()}each(callback){return Object.entries(this._styles).forEach(callback),this}search(data,styleObject){if(this._cacheMap.has(styleObject))return this._cacheMap.get(styleObject);const existingId=this._getExistingStyleId(data);return existingId||"-1"}get(id){return typeof id!="string"?id:(id=String(id),this._styles[id])}add(data,styleObject){const id=Tools.generateRandomId(6);return this._styles[id]=data,this._cacheMap.set(styleObject,id),id}setValue(data){if(data==null)return;const styleObject=JSON.stringify(data),result=this.search(data,styleObject);return result!=="-1"?result:this.add(data,styleObject)}toJSON(){return this._styles}getStyleByCell(cell){let style;cell&&Tools.isObject(cell.s)?style=cell.s:style=(cell==null?void 0:cell.s)&&this.get(cell.s);const interceptStyle=cell==null?void 0:cell.interceptorStyle;return interceptStyle?{...style,...interceptStyle}:style}_generateCacheMap(){const{_styles,_cacheMap}=this;for(const id in _styles){const styleObject=JSON.stringify(_styles[id]);_cacheMap.set(styleObject,id)}}_getExistingStyleId(data){const{_styles}=this;for(const id in _styles)if(Tools.diffValue(_styles[id],data))return id;return null}};__name(_Styles,"Styles");let Styles=_Styles;const isRangesEqual=__name((oldRanges,ranges)=>ranges.length===oldRanges.length&&!oldRanges.some(oldRange=>ranges.some(range=>!Rectangle.equals(range,oldRange))),"isRangesEqual"),isUnitRangesEqual=__name((oldRanges,ranges)=>ranges.length===oldRanges.length&&oldRanges.every((oldRange,i)=>{const current=ranges[i];return current.unitId===oldRange.unitId&&current.sheetId===oldRange.sheetId&&Rectangle.equals(oldRange.range,current.range)}),"isUnitRangesEqual"),DEFAULT_PADDING_DATA={t:0,b:2,l:2,r:2},getDefaultBaselineOffset=__name(fontSize=>({sbr:.6,sbo:fontSize,spr:.6,spo:fontSize}),"getDefaultBaselineOffset"),VERTICAL_ROTATE_ANGLE=90;function createDocumentModelWithStyle(content,textStyle,config={}){const contentLength=content.length,{textRotation,paddingData,horizontalAlign=HorizontalAlign.UNSPECIFIED,verticalAlign=VerticalAlign.UNSPECIFIED,wrapStrategy=WrapStrategy.UNSPECIFIED,cellValueType}=config,{t:marginTop,r:marginRight,b:marginBottom,l:marginLeft}=paddingData||DEFAULT_PADDING_DATA,{vertexAngle,centerAngle}=convertTextRotation(textRotation),documentData={id:"d",body:{dataStream:`${content}${DEFAULT_EMPTY_DOCUMENT_VALUE}`,textRuns:[{ts:textStyle,st:0,ed:contentLength}],paragraphs:[{startIndex:contentLength,paragraphStyle:{horizontalAlign}}],sectionBreaks:[{startIndex:contentLength+1}]},documentStyle:{pageSize:{width:Number.POSITIVE_INFINITY,height:Number.POSITIVE_INFINITY},marginTop,marginBottom,marginRight,marginLeft,renderConfig:{horizontalAlign,verticalAlign,centerAngle,vertexAngle,wrapStrategy,cellValueType,zeroWidthParagraphBreak:1}},drawings:{},drawingsOrder:[]};return new DocumentDataModel(documentData)}__name(createDocumentModelWithStyle,"createDocumentModelWithStyle");function extractOtherStyle(style){if(!style)return{};const{tr:textRotation,td:textDirection,ht:horizontalAlign,vt:verticalAlign,tb:wrapStrategy,pd:paddingData}=style;return{textRotation,textDirection,horizontalAlign,verticalAlign,wrapStrategy,paddingData}}__name(extractOtherStyle,"extractOtherStyle");function getFontFormat(format){if(!format)return{};const{ff,fs,it,bl,ul,st,ol,cl}=format,style={};return ff&&(style.ff=ff),fs&&(style.fs=fs),it&&(style.it=it),bl&&(style.bl=bl),ul&&(style.ul=ul),st&&(style.st=st),ol&&(style.ol=ol),cl&&(style.cl=cl),style}__name(getFontFormat,"getFontFormat");function addLinkToDocumentModel(documentModel,linkUrl,linkId){var _a17;const body=documentModel.getBody();if((_a17=body.customRanges)!=null&&_a17.some(range=>range.rangeType===CustomRangeType.HYPERLINK))return;const textX=BuildTextUtils.customRange.add({ranges:[{startOffset:0,endOffset:body.dataStream.length-1,collapsed:!1}],rangeId:linkId,rangeType:CustomRangeType.HYPERLINK,body,properties:{url:linkUrl,refId:linkId}});textX&&TextX.apply(body,textX.serialize())}__name(addLinkToDocumentModel,"addLinkToDocumentModel");function isNotNullOrUndefined(value){return value!=null}__name(isNotNullOrUndefined,"isNotNullOrUndefined");const DEFAULT_FONTFACE_PLANE='"Helvetica Neue", Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "Heiti SC", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif';function getFontStyleString(textStyle){const defaultFont=DEFAULT_STYLES.ff,defaultFontSize=DEFAULT_STYLES.fs;if(!textStyle){const fontString2=`${defaultFontSize}pt ${defaultFont}`;return{fontCache:fontString2,fontString:fontString2,fontSize:defaultFontSize,originFontSize:defaultFontSize,fontFamily:defaultFont}}let italic=FontStyleType.ITALIC;(textStyle.it===0||textStyle.it===void 0)&&(italic=FontStyleType.NORMAL);let bold=FontStyleType.BOLD;(textStyle.bl===0||textStyle.bl===void 0)&&(bold=FontStyleType.NORMAL);let originFontSize=defaultFontSize;textStyle.fs&&(originFontSize=Math.ceil(textStyle.fs));let fontFamilyResult=defaultFont;if(textStyle.ff){let fontFamily=textStyle.ff;fontFamily=fontFamily.replace(/"/g,"").replace(/'/g,""),fontFamily.indexOf(" ")>-1&&(fontFamily=`"${fontFamily}"`),fontFamily==null&&(fontFamily=defaultFont),fontFamilyResult=fontFamily}const{va:baselineOffset}=textStyle;let fontSize=originFontSize;if(baselineOffset===BaselineOffset.SUBSCRIPT||baselineOffset===BaselineOffset.SUPERSCRIPT){const baselineOffsetInfo=getBaselineOffsetInfo(fontFamilyResult,fontSize),{sbr,spr}=baselineOffsetInfo;fontSize*=baselineOffset===BaselineOffset.SUBSCRIPT?sbr:spr}const fontStringPure=`${italic} ${bold} ${fontSize}pt ${fontFamilyResult}`,fontString=`${fontStringPure}, ${DEFAULT_FONTFACE_PLANE} `;return{fontCache:fontStringPure,fontString,fontSize,originFontSize,fontFamily:fontFamilyResult}}__name(getFontStyleString,"getFontStyleString");function getBaselineOffsetInfo(_fontFamily,fontSize){return getDefaultBaselineOffset(fontSize)}__name(getBaselineOffsetInfo,"getBaselineOffsetInfo");function convertTextRotation(textRotation){const{a:angle=0,v:isVertical=BooleanNumber.FALSE}=textRotation||{a:0,v:BooleanNumber.FALSE};let centerAngle=0,vertexAngle=angle;return isVertical===BooleanNumber.TRUE&&(centerAngle=VERTICAL_ROTATE_ANGLE,vertexAngle=VERTICAL_ROTATE_ANGLE),{centerAngle,vertexAngle}}__name(convertTextRotation,"convertTextRotation");const _ColumnManager=class _ColumnManager{constructor(_config,data){__publicField(this,"_columnData",{});this._config=_config,this._columnData=data}getColumnData(){return this._columnData}getColVisible(colPos){const{_columnData}=this,col=_columnData[colPos];return col?col.hd!==BooleanNumber.TRUE:!0}getColumnStyle(col){var _a17;return(_a17=this._columnData[col])==null?void 0:_a17.s}setColumnStyle(col,style){const coldData=this.getColumnOrCreate(col);coldData.s=style}getHiddenCols(start=0,end=this.getSize()-1){const hiddenCols=[];let inHiddenRange=!1,startColumn=-1;for(let i=start;i<=end;i++){const visible=this.getColVisible(i);inHiddenRange&&visible?(inHiddenRange=!1,hiddenCols.push({rangeType:RANGE_TYPE.COLUMN,startColumn,endColumn:i-1,startRow:0,endRow:0})):!inHiddenRange&&!visible&&(inHiddenRange=!0,startColumn=i)}return inHiddenRange&&hiddenCols.push({startRow:0,endRow:0,startColumn,endColumn:end,rangeType:RANGE_TYPE.COLUMN}),hiddenCols}getVisibleCols(start=0,end=this.getSize()-1){const visibleCols=[];let inVisibleRange=!1,startColumn=-1;for(let i=start;i<=end;i++){const visible=this.getColVisible(i);inVisibleRange&&!visible?(inVisibleRange=!1,visibleCols.push({rangeType:RANGE_TYPE.COLUMN,startColumn,endColumn:i-1,startRow:0,endRow:0})):!inVisibleRange&&visible&&(inVisibleRange=!0,startColumn=i)}return inVisibleRange&&visibleCols.push({startRow:0,endRow:0,startColumn,endColumn:end,rangeType:RANGE_TYPE.COLUMN}),visibleCols}getColumnDatas(columnPos,numColumns){const columnData={};let index2=0;for(let i=columnPos;i<columnPos+numColumns;i++){const data=this.getColumnOrCreate(i);columnData[index2]=data,index2++}return columnData}getSize(){return getArrayLength(this._columnData)}getColumnWidth(columnPos){const{_columnData}=this,config=this._config;let width=0;return width=(_columnData[columnPos]||{hd:BooleanNumber.FALSE,w:config.defaultColumnWidth}).w||config.defaultColumnWidth,width}getColumn(columnPos){const column=this._columnData[columnPos];if(column)return column}removeColumn(columnPos){delete this._columnData[columnPos]}getColumnOrCreate(columnPos){const{_columnData}=this,column=_columnData[columnPos];if(column)return column;const create={};return this._columnData[columnPos]=create,create}setCustomMetadata(index2,custom){const row=this.getColumn(index2);row&&(row.custom=custom)}getCustomMetadata(index2){var _a17;return(_a17=this.getColumn(index2))==null?void 0:_a17.custom}};__name(_ColumnManager,"ColumnManager");let ColumnManager=_ColumnManager;const _RowManager=class _RowManager{constructor(_config,_viewModel,data){__publicField(this,"_rowData");this._config=_config,this._viewModel=_viewModel,this._rowData=data}getRowData(){return this._rowData}getRowStyle(row){var _a17;return(_a17=this._rowData[row])==null?void 0:_a17.s}setRowStyle(row,style){const rowData=this.getRowOrCreate(row);rowData.s=style}getRowDatas(rowPos,numRows){const rowData={};let index2=0;for(let i=rowPos;i<rowPos+numRows;i++){const data=this.getRowOrCreate(i);rowData[index2]=data,index2++}return rowData}getRowHeight(rowPos,count=1){const{_rowData}=this,config=this._config;let height=0;for(let i=0;i<count;i++){const row=_rowData[i+rowPos]||{hd:BooleanNumber.FALSE,h:config.defaultRowHeight},{ia,ah,h=config.defaultRowHeight}=row;height+=(ia==null||ia===BooleanNumber.TRUE)&&typeof ah=="number"?ah:h}return height}getRow(rowPos){return this._rowData[rowPos]}removeRow(rowPos){delete this._rowData[rowPos]}getRowOrCreate(rowPos){const{_rowData}=this,row=_rowData[rowPos];if(row)return row;const create={};return _rowData[rowPos]=create,create}getHiddenRows(start=0,end=this.getSize()-1){const hiddenRows=[];let inHiddenRange=!1,startRow=-1;for(let i=start;i<=end;i++){const visible=this.getRowRawVisible(i);inHiddenRange&&visible?(inHiddenRange=!1,hiddenRows.push({startRow,endRow:i-1,startColumn:0,endColumn:0,rangeType:RANGE_TYPE.ROW})):!inHiddenRange&&!visible&&(inHiddenRange=!0,startRow=i)}return inHiddenRange&&hiddenRows.push({startRow,endRow:end,startColumn:0,endColumn:0,rangeType:RANGE_TYPE.ROW}),hiddenRows}getVisibleRows(start=0,end=this.getSize()-1){const visibleRows=[];let inVisibleRange=!1,startRow=-1;for(let i=start;i<=end;i++){const visible=this.getRowRawVisible(i);inVisibleRange&&!visible?(inVisibleRange=!1,visibleRows.push({startRow,endRow:i-1,startColumn:0,endColumn:0,rangeType:RANGE_TYPE.ROW})):!inVisibleRange&&visible&&(inVisibleRange=!0,startRow=i)}return inVisibleRange&&visibleRows.push({startRow,endRow:end,startColumn:0,endColumn:0,rangeType:RANGE_TYPE.ROW}),visibleRows}getRowRawVisible(row){const rowData=this.getRow(row);return rowData?rowData.hd!==BooleanNumber.TRUE:!0}getSize(){return getArrayLength(this._rowData)}setCustomMetadata(index2,custom){const row=this.getRow(index2);row&&(row.custom=custom)}getCustomMetadata(index2){var _a17;return(_a17=this.getRow(index2))==null?void 0:_a17.custom}};__name(_RowManager,"RowManager");let RowManager=_RowManager;const DEFAULT_WORKSHEET_ROW_COUNT_KEY="DEFAULT_WORKSHEET_ROW_COUNT",DEFAULT_WORKSHEET_ROW_COUNT=1e3,DEFAULT_WORKSHEET_COLUMN_COUNT_KEY="DEFAULT_WORKSHEET_COLUMN_COUNT",DEFAULT_WORKSHEET_COLUMN_COUNT=20,DEFAULT_WORKSHEET_ROW_HEIGHT_KEY="DEFAULT_WORKSHEET_ROW_HEIGHT",DEFAULT_WORKSHEET_ROW_HEIGHT=24,DEFAULT_WORKSHEET_COLUMN_WIDTH_KEY="DEFAULT_WORKSHEET_COLUMN_WIDTH",DEFAULT_WORKSHEET_COLUMN_WIDTH=88,DEFAULT_WORKSHEET_ROW_TITLE_WIDTH_KEY="DEFAULT_WORKSHEET_ROW_TITLE_WIDTH",DEFAULT_WORKSHEET_ROW_TITLE_WIDTH=46,DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT_KEY="DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT",DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT=20;function mergeWorksheetSnapshotWithDefault(snapshot){const defaultSnapshot={name:"Sheet1",id:"sheet-01",tabColor:"",hidden:BooleanNumber.FALSE,rowCount:DEFAULT_WORKSHEET_ROW_COUNT,columnCount:DEFAULT_WORKSHEET_COLUMN_COUNT,zoomRatio:1,freeze:{xSplit:0,ySplit:0,startRow:-1,startColumn:-1},scrollTop:0,scrollLeft:0,defaultColumnWidth:DEFAULT_WORKSHEET_COLUMN_WIDTH,defaultRowHeight:DEFAULT_WORKSHEET_ROW_HEIGHT,mergeData:[],cellData:{},rowData:{},columnData:{},showGridlines:BooleanNumber.TRUE,rowHeader:{width:DEFAULT_WORKSHEET_ROW_TITLE_WIDTH,hidden:BooleanNumber.FALSE},columnHeader:{height:DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT,hidden:BooleanNumber.FALSE},rightToLeft:BooleanNumber.FALSE};return Object.keys(defaultSnapshot).forEach(_key=>{const key=_key;typeof snapshot[key]>"u"&&(snapshot[key]=defaultSnapshot[key])}),snapshot}__name(mergeWorksheetSnapshotWithDefault,"mergeWorksheetSnapshotWithDefault");const _SpanModel=class _SpanModel extends Disposable{constructor(mergeData){super();__publicField(this,"_cellCache",new Map);__publicField(this,"_rowCache",new Map);__publicField(this,"_columnCache",new Map);__publicField(this,"_hasRow",!1);__publicField(this,"_hasColumn",!1);__publicField(this,"_hasAll",!1);__publicField(this,"_allIndex",-1);__publicField(this,"_mergeData");__publicField(this,"_rangeMap",new LRUMap(5e4));__publicField(this,"_skeletonCache",new LRUMap(5e4));this._init(mergeData.concat())}_init(mergeData){this._mergeData=mergeData,this._createCache(mergeData)}_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(mergeData){let index2=0;for(const range of mergeData){const{rangeType}=range;rangeType===RANGE_TYPE.ROW?this._createRowCache(range,index2):rangeType===RANGE_TYPE.COLUMN?this._createColumnCache(range,index2):rangeType===RANGE_TYPE.ALL?this._createCellAllCache(index2):this._createCellCache(range,index2),index2++}}rebuild(mergeData){this._clearCache(),this._init(mergeData.concat())}_createRowCache(range,index2){const{startRow,endRow}=range;for(let i=startRow;i<=endRow;i++)this._rowCache.set(i,index2),this._hasRow=!0}_createColumnCache(range,index2){const{startColumn,endColumn}=range;for(let i=startColumn;i<=endColumn;i++)this._columnCache.set(i,index2),this._hasColumn=!0}_createCellAllCache(index2){this._hasAll=!0,this._allIndex=index2}_createCellCache(range,index2){for(let i=range.startRow;i<=range.endRow;i++){let columnCache=this._cellCache.get(i);columnCache==null&&(columnCache=new Map,this._cellCache.set(i,columnCache));for(let j=range.startColumn;j<=range.endColumn;j++)columnCache.set(j,index2)}}add(range){this._mergeData.push(range),this._clearCache(),this._createCache(this._mergeData)}remove(row,column){const index2=this._getMergeDataIndex(row,column);index2!==-1&&(this._mergeData.splice(index2,1),this._clearCache(),this._createCache(this._mergeData))}getMergedCell(row,column){const index2=this._getMergeDataIndex(row,column);return index2!==-1?this._mergeData[index2]:null}getMergeDataIndex(row,column){return this._getMergeDataIndex(row,column)}isRowContainsMergedCell(row){return this._hasAll||!Tools.isEmptyObject(this._columnCache)?!0:this._mergeData.some(mergedCell=>mergedCell.startRow<=row&&row<=mergedCell.endRow)}isColumnContainsMergedCell(column){return this._hasAll||!Tools.isEmptyObject(this._rowCache)?!0:this._mergeData.some(mergedCell=>mergedCell.startColumn<=column&&column<=mergedCell.endColumn)}getMergedCellRange(startRow,startColumn,endRow,endColumn){const ranges=[],key=`${startRow}-${startColumn}-${endRow}-${endColumn}`;if(this._rangeMap.has(key))return this._getRangeFromCache(key);let index2=0;const indexes=[];for(const range of this._mergeData||[])Rectangle.intersects(range,{startRow,endRow,startColumn,endColumn})&&(ranges.push({...range}),indexes.push(index2)),index2++;return this._rangeMap.set(key,indexes),ranges}getMergedCellRangeForSkeleton(startRow,startColumn,endRow,endColumn){const cacheDataMerge=[],mergeData=this._mergeData,key=`${startRow}-${startColumn}-${endRow}-${endColumn}`;if(this._skeletonCache.has(key))return this._getSkeletonRangeFromCache(key);const indexes=[];for(let i=0;i<mergeData.length;i++){const{startRow:mergeStartRow,endRow:mergeEndRow,startColumn:mergeStartColumn,endColumn:mergeEndColumn}=mergeData[i];for(let r=startRow;r<=endRow;r++){let isBreak=!1;for(let c=startColumn;c<=endColumn;c++)if(r>=mergeStartRow&&r<=mergeEndRow&&c>=mergeStartColumn&&c<=mergeEndColumn){cacheDataMerge.push({startRow:mergeStartRow,endRow:mergeEndRow,startColumn:mergeStartColumn,endColumn:mergeEndColumn}),indexes.push(i),isBreak=!0;break}if(isBreak)break}}return this._skeletonCache.set(key,indexes),cacheDataMerge}_getRangeFromCache(key){const indexes=this._rangeMap.get(key)||[],ranges=[];for(const index2 of indexes)ranges.push({...this._mergeData[index2]});return ranges}_getSkeletonRangeFromCache(key){const indexes=this._skeletonCache.get(key)||[],ranges=[];for(const index2 of indexes)ranges.push({...this._mergeData[index2]});return ranges}_getMergeDataIndex(row,column){var _a17;if(this._hasAll)return this._allIndex;if(this._hasRow){const rowValue=this._rowCache.get(row);if(rowValue!==void 0)return rowValue}if(this._hasColumn){const columnValue=this._columnCache.get(column);if(columnValue!==void 0)return columnValue}const cellValue=(_a17=this._cellCache.get(row))==null?void 0:_a17.get(column);return cellValue!==void 0?cellValue:-1}getMergeDataSnapshot(){return this._mergeData}dispose(){this._clearCache(),this._mergeData=[]}};__name(_SpanModel,"SpanModel");let SpanModel=_SpanModel;const _SheetViewModel=class _SheetViewModel extends Disposable{constructor(getRawCell){super();__publicField(this,"_cellContentInterceptor",null);__publicField(this,"_rowFilteredInterceptor",null);this.getRawCell=getRawCell}dispose(){super.dispose(),this._cellContentInterceptor=null,this._rowFilteredInterceptor=null}getCell(row,col,key,filter){return this._cellContentInterceptor?this._cellContentInterceptor.getCell(row,col,InterceptorEffectEnum.Value|InterceptorEffectEnum.Style,key,filter):this.getRawCell(row,col)}getCellValueOnly(row,col){return this._cellContentInterceptor?this._cellContentInterceptor.getCell(row,col,InterceptorEffectEnum.Value):this.getRawCell(row,col)}getCellStyleOnly(row,col){return this._cellContentInterceptor?this._cellContentInterceptor.getCell(row,col,InterceptorEffectEnum.Style):this.getRawCell(row,col)}getRowFiltered(row){var _a17,_b2;return(_b2=(_a17=this._rowFilteredInterceptor)==null?void 0:_a17.getRowFiltered(row))!=null?_b2:!1}registerCellContentInterceptor(interceptor){if(this._cellContentInterceptor)throw new Error("[SheetViewModel]: Interceptor already registered.");return this._cellContentInterceptor=interceptor,toDisposable(()=>this._cellContentInterceptor=null)}registerRowFilteredInterceptor(interceptor){if(this._rowFilteredInterceptor)throw new Error("[SheetViewModel]: Interceptor already registered.");return this._rowFilteredInterceptor=interceptor,toDisposable(()=>this._rowFilteredInterceptor=null)}};__name(_SheetViewModel,"SheetViewModel");let SheetViewModel=_SheetViewModel;const DEFAULT_CELL_DOCUMENT_MODEL_OPTION={isDeepClone:!1,displayRawFormula:!1,ignoreTextRotation:!1},_Worksheet=class _Worksheet{constructor(unitId,snapshot,_styles){__publicField(this,"_sheetId");__publicField(this,"_snapshot");__publicField(this,"_cellData");__publicField(this,"_rowManager");__publicField(this,"_columnManager");__publicField(this,"_viewModel");__publicField(this,"_spanModel");var _a17;this.unitId=unitId,this._styles=_styles,this._snapshot=mergeWorksheetSnapshotWithDefault(snapshot);const{columnData,rowData,cellData}=this._snapshot;this._sheetId=(_a17=this._snapshot.id)!=null?_a17:Tools.generateRandomId(6),this._cellData=new ObjectMatrix(cellData),this._viewModel=new SheetViewModel((row,col)=>this.getCellRaw(row,col)),this._rowManager=new RowManager(this._snapshot,this._viewModel,rowData),this._columnManager=new ColumnManager(this._snapshot,columnData),this._spanModel=new SpanModel(this._snapshot.mergeData)}__interceptViewModel(callback){callback(this._viewModel)}getSnapshot(){return this._snapshot}setMergeData(mergeData){this._snapshot.mergeData=mergeData,this.getSpanModel().rebuild(mergeData)}getSpanModel(){return this._spanModel}getStyleDataByHash(hash){return{...this._styles.get(hash)}}setStyleData(style){return this._styles.setValue(style)}getColumnStyle(column,keepRaw=!1){return keepRaw?this._columnManager.getColumnStyle(column):this._styles.get(this._columnManager.getColumnStyle(column))}setColumnStyle(column,style){this._columnManager.setColumnStyle(column,style)}getRowStyle(row,keepRaw=!1){return keepRaw?this._rowManager.getRowStyle(row):this._styles.get(this._rowManager.getRowStyle(row))}setRowStyle(row,style){this._rowManager.setRowStyle(row,style)}mixinDefaultStyleToCellRaw(row,col,cellRaw,isRowStylePrecedeColumnStyle){const columnStyle=this.getColumnStyle(col),rowStyle=this.getRowStyle(row),defaultStyle=this.getDefaultCellStyleInternal();if(defaultStyle||columnStyle||rowStyle){let cellStyle=cellRaw==null?void 0:cellRaw.s;typeof cellStyle=="string"&&(cellStyle=this._styles.get(cellStyle));const s=isRowStylePrecedeColumnStyle?composeStyles(defaultStyle,columnStyle,rowStyle,cellStyle):composeStyles(defaultStyle,rowStyle,columnStyle,cellStyle);cellRaw||(cellRaw={}),cellRaw.s=s}}getDefaultCellStyle(){return this._snapshot.defaultStyle}getDefaultCellStyleInternal(){const style=this._snapshot.defaultStyle;return this._styles.get(style)}setDefaultCellStyle(style){this._snapshot.defaultStyle=style}getCellMatrix(){return this._cellData}getCellMatrixPrintRange(){const matrix=this.getCellMatrix(),mergedCells=this.getMergeData();let startRow=-1,endRow=-1,startColumn=-1,endColumn=-1,rowInitd=!1,columnInitd=!1;return matrix.forEach((rowIndex,row)=>{Object.keys(row).forEach(colIndexStr=>{const colIndex=+colIndexStr,cellValue=matrix.getValue(rowIndex,colIndex),style=cellValue!=null&&cellValue.s?this._styles.get(cellValue.s):null,isLegalBorder=(style==null?void 0:style.bd)&&(style.bd.b||style.bd.l||style.bd.r||style.bd.t||style.bd.bc_tr||style.bd.bl_tr||style.bd.ml_tr||style.bd.tl_bc||style.bd.tl_br||style.bd.tl_mr);(cellValue&&(cellValue.v||cellValue.p)||style!=null&&style.bg||isLegalBorder)&&(rowInitd?startRow=Math.min(startRow,rowIndex):(startRow=rowIndex,rowInitd=!0),endRow=Math.max(endRow,rowIndex),columnInitd?startColumn=Math.min(startColumn,colIndex):(columnInitd=!0,startColumn=colIndex),endColumn=Math.max(endColumn,colIndex))})}),mergedCells.forEach(mergedCell=>{rowInitd?startRow=Math.min(startRow,mergedCell.startRow):(startRow=mergedCell.startRow,rowInitd=!0),endRow=Math.max(endRow,mergedCell.endRow),columnInitd?startColumn=Math.min(startColumn,mergedCell.startColumn):(startColumn=mergedCell.startColumn,rowInitd=!0),endColumn=Math.max(endColumn,mergedCell.endColumn)}),!rowInitd||!columnInitd?null:{startColumn,startRow,endColumn,endRow}}getRowManager(){return this._rowManager}getUnitId(){return this.unitId}getSheetId(){return this._sheetId}getColumnManager(){return this._columnManager}getName(){return this._snapshot.name}clone(){const{_snapshot:_config}=this,copy=Tools.deepClone(_config);return new _Worksheet(this.unitId,copy,this._styles)}getMergeData(){return this._spanModel.getMergeDataSnapshot()}getMergedCell(row,col){return this._spanModel.getMergedCell(row,col)}getMergedCellRange(startRow,startColumn,endRow,endColumn){return this._spanModel.getMergedCellRange(startRow,startColumn,endRow,endColumn)}isRowContainsMergedCell(row){return this._spanModel.isRowContainsMergedCell(row)}isColumnContainsMergedCell(column){return this._spanModel.isColumnContainsMergedCell(column)}getCellInfoInMergeData(row,column){const mergeRange=this.getMergedCell(row,column);let isMerged=!1,isMergedMainCell=!1,mergeEndRow=row,mergeEndColumn=column,mergeStartRow=row,mergeStartColumn=column;if(mergeRange){const{startRow:startRowMerge,endRow:endRowMerge,startColumn:startColumnMerge,endColumn:endColumnMerge}=mergeRange;row===startRowMerge&&column===startColumnMerge?(mergeEndRow=endRowMerge,mergeEndColumn=endColumnMerge,mergeStartRow=startRowMerge,mergeStartColumn=startColumnMerge,isMergedMainCell=!0):row>=startRowMerge&&row<=endRowMerge&&column>=startColumnMerge&&column<=endColumnMerge&&(mergeEndRow=endRowMerge,mergeEndColumn=endColumnMerge,mergeStartRow=startRowMerge,mergeStartColumn=startColumnMerge,isMerged=!0)}return{actualRow:row,actualColumn:column,isMergedMainCell,isMerged,endRow:mergeEndRow,endColumn:mergeEndColumn,startRow:mergeStartRow,startColumn:mergeStartColumn}}getCell(row,col){return row<0||col<0?null:this._viewModel.getCell(row,col)}getCellValueOnly(row,col){return row<0||col<0?null:this._viewModel.getCellValueOnly(row,col)}getCellStyleOnly(row,col){return row<0||col<0?null:this._viewModel.getCellStyleOnly(row,col)}getCellRaw(row,col){return this.getCellMatrix().getValue(row,col)}getCellWithFilteredInterceptors(row,col,key,filter){return this._viewModel.getCell(row,col,key,filter)}getRowFiltered(row){return this._viewModel.getRowFiltered(row)}getMatrixWithMergedCells(row,col,endRow,endCol,dataMode=CellModeEnum.Raw){const matrix=this.getCellMatrix(),mergedCellsInRange=this._spanModel.getMergedCellRange(row,col,endRow,endCol),returnCellMatrix=new ObjectMatrix;return createRowColIter(row,endRow,col,endCol).forEach((row2,col2)=>{var _a17;let cellData;if(dataMode===CellModeEnum.Raw)cellData=this.getCellRaw(row2,col2);else if(dataMode===CellModeEnum.Intercepted)cellData=this.getCell(row2,col2);else if(dataMode===CellModeEnum.Both){const cellDataRaw=this.getCellRaw(row2,col2);if(cellDataRaw){cellData={...cellDataRaw};const displayV=(_a17=this.getCell(row2,col2))==null?void 0:_a17.v;isNotNullOrUndefined(displayV)&&cellData&&(cellData.displayV=String(displayV))}}cellData&&returnCellMatrix.setValue(row2,col2,cellData)}),mergedCellsInRange.forEach(mergedCell=>{const{startColumn,startRow,endColumn,endRow:endRow2}=mergedCell;createRowColIter(startRow,endRow2,startColumn,endColumn).forEach((row2,col2)=>{row2===startRow&&col2===startColumn&&returnCellMatrix.setValue(row2,col2,{...matrix.getValue(row2,col2),rowSpan:endRow2-startRow+1,colSpan:endColumn-startColumn+1}),(row2!==startRow||col2!==startColumn)&&returnCellMatrix.realDeleteValue(row2,col2)})}),returnCellMatrix}getRange(startRowOrRange,startColumn,endRow,endColumn){return typeof startRowOrRange=="object"?new Range(this,startRowOrRange,{getStyles:__name(()=>this._styles,"getStyles")}):new Range(this,{startRow:startRowOrRange,startColumn,endColumn:endColumn||startColumn,endRow:endRow||startRowOrRange},{getStyles:__name(()=>this._styles,"getStyles")})}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:_config}=this,{columnCount}=_config;return columnCount}getMaxRows(){const{_snapshot:_config}=this,{rowCount}=_config;return rowCount}getRowCount(){return this._snapshot.rowCount}setRowCount(count){this._snapshot.rowCount=count}getColumnCount(){return this._snapshot.columnCount}setColumnCount(count){this._snapshot.columnCount=count}isSheetHidden(){return this._snapshot.hidden}hasHiddenGridlines(){const{_snapshot:_config}=this,{showGridlines}=_config;return showGridlines===0}getGridlinesColor(){return this.getConfig().gridlinesColor}getTabColor(){const{_snapshot:_config}=this,{tabColor}=_config;return tabColor}getColumnWidth(columnPosition){return this.getColumnManager().getColumnWidth(columnPosition)}getRowHeight(row){return this._viewModel.getRowFiltered(row)?0:this.getRowManager().getRowHeight(row)}isRowFiltered(row){return this._viewModel.getRowFiltered(row)}getRowVisible(row){return!this.isRowFiltered(row)&&this.getRowRawVisible(row)}getRowRawVisible(row){return this.getRowManager().getRowRawVisible(row)}getHiddenRows(start,end){const lastColumn=this.getMaxColumns()-1,ranges=this._rowManager.getHiddenRows(start,end);return ranges.forEach(range=>range.endColumn=lastColumn),ranges}getColVisible(col){return this._columnManager.getColVisible(col)}getHiddenCols(start,end){const lastRow=this.getMaxRows()-1,ranges=this._columnManager.getHiddenCols(start,end);return ranges.forEach(range=>range.endRow=lastRow),ranges}getVisibleRows(){const rowCount=this.getRowCount();return this._rowManager.getVisibleRows(0,rowCount-1)}getVisibleCols(){const columnCount=this.getColumnCount();return this._columnManager.getVisibleCols(0,columnCount-1)}isRightToLeft(){const{_snapshot:_config}=this,{rightToLeft}=_config;return rightToLeft}getLastRowWithContent(){return this._cellData.getLength()-1}getLastColumnWithContent(){return this._cellData.getRange().endColumn}getDataRangeScope(){return this._cellData.getStartEndScope()}cellHasValue(value){return value&&(value.v!==void 0||value.f!==void 0||value.p!==void 0)}iterateByRow(range,skipEmpty=!0){const{startRow,startColumn,endRow,endColumn}=range,worksheet=this;return{[Symbol.iterator]:()=>{let rowIndex=startRow,columnIndex=startColumn;return{next(){for(;;){if(columnIndex>endColumn&&(rowIndex+=1,columnIndex=startColumn),rowIndex>endRow)return{done:!0,value:void 0};const cellValue=worksheet.getCell(rowIndex,columnIndex),isEmptyCell2=!cellValue,mergedCell=worksheet.getMergedCell(rowIndex,columnIndex);if(mergedCell){if(rowIndex!==mergedCell.startRow||columnIndex!==mergedCell.startColumn){columnIndex=mergedCell.endColumn+1;continue}if(isEmptyCell2&&skipEmpty){columnIndex=mergedCell.endColumn+1;continue}const value={row:rowIndex,col:columnIndex,value:cellValue};return value.colSpan=mergedCell.endColumn-mergedCell.startColumn+1,value.rowSpan=mergedCell.endRow-mergedCell.startRow+1,columnIndex=mergedCell.endColumn+1,{done:!1,value}}if(isEmptyCell2&&skipEmpty)columnIndex+=1;else{const value={row:rowIndex,col:columnIndex,value:cellValue};return columnIndex+=1,{done:!1,value}}}}}}}}iterateByColumn(range,skipEmpty=!0,skipNonTopLeft=!0){const{startRow,startColumn,endRow,endColumn}=range,worksheet=this;return{[Symbol.iterator]:()=>{let rowIndex=startRow,columnIndex=startColumn;return{next(){for(;;){if(rowIndex>endRow&&(columnIndex+=1,rowIndex=startRow),columnIndex>endColumn)return{done:!0,value:void 0};const mergedCell=worksheet.getMergedCell(rowIndex,columnIndex);if(mergedCell){const isNotTop=rowIndex!==mergedCell.startRow,isNotTopLeft=isNotTop||columnIndex!==mergedCell.startColumn;if(skipNonTopLeft&&isNotTopLeft||!skipNonTopLeft&&isNotTop){rowIndex=mergedCell.endRow+1;continue}const cellValue2=worksheet.getCell(mergedCell.startRow,mergedCell.startColumn);if(!cellValue2&&skipEmpty){rowIndex=mergedCell.endRow+1;continue}const value={row:rowIndex,col:mergedCell.startColumn,value:cellValue2};return value.colSpan=mergedCell.endColumn-mergedCell.startColumn+1,value.rowSpan=mergedCell.endRow-mergedCell.startRow+1,rowIndex=mergedCell.endRow+1,{done:!1,value}}const cellValue=worksheet.getCell(rowIndex,columnIndex);if(!cellValue&&skipEmpty)rowIndex+=1;else{const value={row:rowIndex,col:columnIndex,value:cellValue};return rowIndex+=1,{done:!1,value}}}}}}}}_getCellDocumentModel(cell,options=DEFAULT_CELL_DOCUMENT_MODEL_OPTION){var _a17;const{isDeepClone,displayRawFormula,ignoreTextRotation}={...DEFAULT_CELL_DOCUMENT_MODEL_OPTION,...options},style=this._styles.getStyleByCell(cell);if(!cell)return;let documentModel,fontString="document";const cellOtherConfig=extractOtherStyle(style),textRotation=ignoreTextRotation?DEFAULT_STYLES.tr:cellOtherConfig.textRotation||DEFAULT_STYLES.tr;let horizontalAlign=cellOtherConfig.horizontalAlign||DEFAULT_STYLES.ht;const verticalAlign=cellOtherConfig.verticalAlign||DEFAULT_STYLES.vt,wrapStrategy=cellOtherConfig.wrapStrategy||DEFAULT_STYLES.tb,paddingData=cellOtherConfig.paddingData||DEFAULT_PADDING_DATA;if(cell.f&&displayRawFormula)documentModel=createDocumentModelWithStyle(cell.f.toString(),{},{verticalAlign}),horizontalAlign=DEFAULT_STYLES.ht;else if(cell.p){const{centerAngle,vertexAngle}=convertTextRotation(textRotation);documentModel=this._updateConfigAndGetDocumentModel(isDeepClone?Tools.deepClone(cell.p):cell.p,horizontalAlign,paddingData,{horizontalAlign,verticalAlign,centerAngle,vertexAngle,wrapStrategy,zeroWidthParagraphBreak:1})}else if(cell.v!=null){const textStyle=getFontFormat(style);fontString=getFontStyleString(textStyle).fontCache;let cellText=extractPureTextFromCell(cell);cell.t===CellValueType.FORCE_STRING&&displayRawFormula&&(cellText=`'${cellText}`),documentModel=createDocumentModelWithStyle(cellText,textStyle,{...cellOtherConfig,textRotation,cellValueType:cell.t})}return documentModel&&cell.linkUrl&&cell.linkId&&addLinkToDocumentModel(documentModel,cell.linkUrl,cell.linkId),{documentModel,fontString,textRotation,wrapStrategy,verticalAlign,horizontalAlign,paddingData,fill:(_a17=style==null?void 0:style.bg)==null?void 0:_a17.rgb}}_updateConfigAndGetDocumentModel(documentData,horizontalAlign,paddingData,renderConfig){var _a17,_b2,_c,_d,_e;if(!renderConfig||!((_a17=documentData.body)!=null&&_a17.dataStream))return;documentData.documentStyle||(documentData.documentStyle={}),documentData.documentStyle.marginTop=(_b2=paddingData.t)!=null?_b2:0,documentData.documentStyle.marginBottom=(_c=paddingData.b)!=null?_c:2,documentData.documentStyle.marginLeft=(_d=paddingData.l)!=null?_d:2,documentData.documentStyle.marginRight=(_e=paddingData.r)!=null?_e:2,documentData.documentStyle.pageSize={width:Number.POSITIVE_INFINITY,height:Number.POSITIVE_INFINITY},documentData.documentStyle.renderConfig={...documentData.documentStyle.renderConfig,...renderConfig};const paragraphs=documentData.body.paragraphs||[];for(const paragraph of paragraphs)paragraph.paragraphStyle||(paragraph.paragraphStyle={}),paragraph.paragraphStyle.horizontalAlign=horizontalAlign;return new DocumentDataModel(documentData)}getBlankCellDocumentModel(cell){const documentModelObject=this._getCellDocumentModel(cell,{ignoreTextRotation:!0}),style=this._styles.getStyleByCell(cell),textStyle=getFontFormat(style);if(documentModelObject!=null)return documentModelObject.documentModel==null&&(documentModelObject.documentModel=createDocumentModelWithStyle("",textStyle)),documentModelObject;const content="";let fontString="document";const textRotation=DEFAULT_STYLES.tr,horizontalAlign=DEFAULT_STYLES.ht,verticalAlign=DEFAULT_STYLES.vt,wrapStrategy=DEFAULT_STYLES.tb,paddingData=DEFAULT_PADDING_DATA;return fontString=getFontStyleString({}).fontCache,{documentModel:createDocumentModelWithStyle(content,textStyle),fontString,textRotation,wrapStrategy,verticalAlign,horizontalAlign,paddingData}}getCellDocumentModelWithFormula(cell){return this._getCellDocumentModel(cell,{isDeepClone:!0,displayRawFormula:!0,ignoreTextRotation:!0})}getCustomMetadata(){return this._snapshot.custom}setCustomMetadata(custom){this._snapshot.custom=custom}};__name(_Worksheet,"Worksheet");let Worksheet=_Worksheet;function extractPureTextFromCell(cell){var _a17,_b2;if(!cell)return"";const richTextValue=(_b2=(_a17=cell.p)==null?void 0:_a17.body)==null?void 0:_b2.dataStream;if(richTextValue)return BuildTextUtils.transform.getPlainText(richTextValue);const rawValue=cell.v;return typeof rawValue=="string"?cell.t===CellValueType.BOOLEAN?rawValue.toUpperCase():rawValue.replace(/[\r\n]/g,""):typeof rawValue=="number"?cell.t===CellValueType.BOOLEAN?rawValue?"TRUE":"FALSE":rawValue.toString():typeof rawValue=="boolean"?rawValue?"TRUE":"FALSE":""}__name(extractPureTextFromCell,"extractPureTextFromCell");function getOriginCellValue(cell){if(cell===null)return"";if(cell!=null&&cell.p){const body=cell==null?void 0:cell.p.body;if(body==null)return"";const data=body.dataStream;return BuildTextUtils.transform.getPlainText(data)}return cell==null?void 0:cell.v}__name(getOriginCellValue,"getOriginCellValue");var __defProp$c=Object.defineProperty,__getOwnPropDesc$c=Object.getOwnPropertyDescriptor,__decorateClass$c=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$c(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$c(target,key,result),result},"__decorateClass$c"),__decorateParam$c=__name((index2,decorator)=>(target,key)=>decorator(target,key,index2),"__decorateParam$c");function getWorksheetUID(workbook,worksheet){return`${workbook.getUnitId()}|${worksheet.getSheetId()}`}__name(getWorksheetUID,"getWorksheetUID");var _a3;exports.Workbook=(_a3=class extends UnitModel{constructor(workbookData={},_logService){super();__publicField(this,"type",_.UNIVER_SHEET);__publicField(this,"_sheetCreated$",new rxjs.Subject);__publicField(this,"sheetCreated$",this._sheetCreated$.asObservable());__publicField(this,"_sheetDisposed$",new rxjs.Subject);__publicField(this,"sheetDisposed$",this._sheetDisposed$.asObservable());__publicField(this,"_activeSheet$",new rxjs.BehaviorSubject(null));__publicField(this,"activeSheet$",this._activeSheet$.asObservable());__publicField(this,"_worksheets");__publicField(this,"_styles");__publicField(this,"_snapshot");__publicField(this,"_unitId");__publicField(this,"_count");__publicField(this,"_name$");__publicField(this,"name$");this._logService=_logService;const DEFAULT_WORKBOOK=getEmptySnapshot();Tools.isEmptyObject(workbookData)?this._snapshot=DEFAULT_WORKBOOK:this._snapshot=Tools.commonExtend(DEFAULT_WORKBOOK,workbookData);const{styles}=this._snapshot;(this._snapshot.id==null||this._snapshot.id.length===0)&&(this._snapshot.id=Tools.generateRandomId(6)),this._unitId=this._snapshot.id,this._styles=new Styles(styles),this._count=1,this._worksheets=new Map,this._name$=new rxjs.BehaviorSubject(workbookData.name||""),this.name$=this._name$.asObservable(),this._parseWorksheetSnapshots()}get _activeSheet(){return this._activeSheet$.getValue()}get name(){return this._name$.getValue()}static isIRangeType(range){return typeof range=="string"||"startRow"in range||"row"in range}dispose(){super.dispose(),this._sheetCreated$.complete(),this._sheetDisposed$.complete(),this._activeSheet$.complete(),this._name$.complete()}save(){return Tools.deepClone(this._snapshot)}getSnapshot(){return this._snapshot}getName(){return this._snapshot.name}setName(name){this._name$.next(name),this._snapshot.name=name}getUnitId(){return this._unitId}getRev(){var _a17;return(_a17=this._snapshot.rev)!=null?_a17:1}incrementRev(){this._snapshot.rev=this.getRev()+1}setRev(rev){this._snapshot.rev=rev}addWorksheet(id,index2,worksheetSnapshot){const{sheets,sheetOrder}=this._snapshot;if(sheets[id])return!1;sheets[id]=worksheetSnapshot,sheetOrder.splice(index2,0,id);const worksheet=new Worksheet(this._unitId,worksheetSnapshot,this._styles);return this._worksheets.set(id,worksheet),this._sheetCreated$.next(worksheet),!0}getSheetOrders(){return this._snapshot.sheetOrder}getWorksheets(){return this._worksheets}getActiveSpreadsheet(){return this}getStyles(){return this._styles}getConfig(){return this._snapshot}getIndexBySheetId(sheetId){const{sheetOrder}=this._snapshot;return sheetOrder.findIndex(id=>id===sheetId)}getActiveSheet(allowNull){if(!this._activeSheet&&typeof allowNull>"u")throw new Error(`[Workbook]: no active Worksheet on Workbook ${this._unitId}!`);return this._activeSheet}ensureActiveSheet(){const currentActive=this._activeSheet;if(currentActive)return currentActive;const sheetOrder=this._snapshot.sheetOrder;for(let i=0,len=sheetOrder.length;i<len;i++){const worksheet2=this._worksheets.get(sheetOrder[i]);if(worksheet2&&worksheet2.isSheetHidden()!==BooleanNumber.TRUE)return this.setActiveSheet(worksheet2),worksheet2}const worksheet=this._worksheets.get(sheetOrder[0]);return this.setActiveSheet(worksheet),worksheet}setActiveSheet(worksheet){this._activeSheet$.next(worksheet)}removeSheet(sheetId){const sheetToRemove=this._worksheets.get(sheetId);return sheetToRemove?(this._worksheets.delete(sheetId),this._snapshot.sheetOrder.splice(this._snapshot.sheetOrder.indexOf(sheetId),1),delete this._snapshot.sheets[sheetId],this._sheetDisposed$.next(sheetToRemove),!0):!1}getActiveSheetIndex(){const{sheetOrder}=this._snapshot;return sheetOrder.findIndex(sheetId=>this._worksheets.get(sheetId)===this._activeSheet)}getSheetSize(){return this._snapshot.sheetOrder.length}getSheets(){const{sheetOrder}=this._snapshot;return sheetOrder.map(sheetId=>this._worksheets.get(sheetId))}getSheetsName(){const{sheetOrder}=this._snapshot,names=[];return sheetOrder.forEach(sheetId=>{const worksheet=this._worksheets.get(sheetId);worksheet&&names.push(worksheet.getName())}),names}getSheetIndex(sheet){const{sheetOrder}=this._snapshot;return sheetOrder.findIndex(sheetId=>sheet.getSheetId()===sheetId)}getSheetBySheetName(name){const{sheetOrder}=this._snapshot,sheetId=sheetOrder.find(sheetId2=>this._worksheets.get(sheetId2).getName()===name);return this._worksheets.get(sheetId)}getSheetBySheetId(sheetId){return this._worksheets.get(sheetId)}getSheetByIndex(index2){const{sheetOrder}=this._snapshot;return this._worksheets.get(sheetOrder[index2])}getHiddenWorksheets(){return this.getSheets().filter(s=>s.getConfig().hidden===BooleanNumber.TRUE).map(s=>s.getConfig().id)}getUnhiddenWorksheets(){return this.getSheets().filter(s=>s.getConfig().hidden!==BooleanNumber.TRUE).map(s=>s.getConfig().id)}load(config){this._snapshot=config}checkSheetName(name){return this.getSheetsName().includes(name)}uniqueSheetName(name="Sheet1"){let output=name;for(;this.checkSheetName(output);)output=name+this._count,this._count++;return output}generateNewSheetName(name){let output=name+this._count;for(;this.checkSheetName(output);)output=name+this._count,this._count++;return output}_parseWorksheetSnapshots(){const{_snapshot,_worksheets}=this,{sheets,sheetOrder}=_snapshot;if(Tools.isEmptyObject(sheets)){const firstSheetId=Tools.generateRandomId();sheets[firstSheetId]={id:firstSheetId}}for(const sheetId in sheets){const worksheetSnapshot=sheets[sheetId],{name}=worksheetSnapshot;worksheetSnapshot.name=this.uniqueSheetName(name),worksheetSnapshot.name!==name&&this._logService.debug("[Workbook]",`The worksheet name ${name} is duplicated, we changed it to ${worksheetSnapshot.name}. Please fix the problem in your snapshot.`);const worksheet=new Worksheet(this._unitId,worksheetSnapshot,this._styles);_worksheets.set(sheetId,worksheet),sheetOrder.includes(sheetId)||sheetOrder.push(sheetId)}this.ensureActiveSheet()}getCustomMetadata(){return this._snapshot.custom}setCustomMetadata(custom){this._snapshot.custom=custom}},__name(_a3,"Workbook"),_a3);exports.Workbook=__decorateClass$c([__decorateParam$c(1,ILogService)],exports.Workbook);const _SlideDataModel=class _SlideDataModel extends UnitModel{constructor(snapshot){var _a17;super();__publicField(this,"type",_.UNIVER_SLIDE);__publicField(this,"_activePage$",new rxjs.BehaviorSubject(null));__publicField(this,"activePage$",this._activePage$.asObservable());__publicField(this,"_name$");__publicField(this,"name$");__publicField(this,"_snapshot");__publicField(this,"_unitId");this._snapshot={...DEFAULT_SLIDE,...snapshot},this._unitId=(_a17=this._snapshot.id)!=null?_a17:Tools.generateRandomId(6),this._name$=new rxjs.BehaviorSubject(this._snapshot.title),this.name$=this._name$.asObservable()}get _activePage(){var _a17,_b2;const activePage=this._activePage$.getValue();if(!activePage){const activePageId=(_a17=this.getPageOrder())==null?void 0:_a17[0];return activePageId?(_b2=this.getPages())==null?void 0:_b2[activePageId]:null}return activePage}setName(name){var _a17;this._snapshot.title=name,this._name$.next(name),this._unitId=(_a17=this._snapshot.id)!=null?_a17:generateRandomId(6)}getRev(){return 0}incrementRev(){}setRev(_rev){}getSnapshot(){return this._snapshot}getUnitId(){return this._unitId}getPages(){var _a17;return(_a17=this._snapshot.body)==null?void 0:_a17.pages}getPageOrder(){var _a17;return(_a17=this._snapshot.body)==null?void 0:_a17.pageOrder}getPage(pageId){const pages=this.getPages();return pages==null?void 0:pages[pageId]}getElementsByPage(pageId){var _a17;return(_a17=this.getPage(pageId))==null?void 0:_a17.pageElements}getElement(pageId,elementId){var _a17;return(_a17=this.getElementsByPage(pageId))==null?void 0:_a17[elementId]}getPageSize(){return this._snapshot.pageSize}getBlankPage(){const id=generateRandomId(6);return{id,pageType:PageType.SLIDE,zIndex:10,title:id,description:"",pageBackgroundFill:{rgb:"rgb(255,255,255)"},pageElements:{}}}setActivePage(page){this._activePage$.next(page)}getActivePage(){return this._activePage}updatePage(pageId,page){this._snapshot.body&&(this._snapshot.body.pages[pageId]=page)}appendPage(page){var _a17;if(!this._snapshot.body)return;this._snapshot.body.pages[page.id]=page;const activePage=this._activePage,index2=this._snapshot.body.pageOrder.indexOf((_a17=activePage==null?void 0:activePage.id)!=null?_a17:"");this._snapshot.body.pageOrder.splice(index2+1,0,page.id)}};__name(_SlideDataModel,"SlideDataModel");let SlideDataModel=_SlideDataModel;const FOCUSING_UNIT="FOCUSING_UNIT",FOCUSING_SHEET="FOCUSING_SHEET",FOCUSING_DOC="FOCUSING_DOC",FOCUSING_SLIDE="FOCUSING_SLIDE",FOCUSING_EDITOR_BUT_HIDDEN="FOCUSING_EDITOR_BUT_HIDDEN",EDITOR_ACTIVATED="EDITOR_ACTIVATED",FOCUSING_EDITOR_INPUT_FORMULA="FOCUSING_EDITOR_INPUT_FORMULA",FOCUSING_FX_BAR_EDITOR="FOCUSING_FX_BAR_EDITOR",FOCUSING_UNIVER_EDITOR="FOCUSING_UNIVER_EDITOR",FOCUSING_EDITOR_STANDALONE="FOCUSING_EDITOR_INPUT_FORMULA",FOCUSING_PANEL_EDITOR="FOCUSING_PANEL_EDITOR",FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE="FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE",FOCUSING_COMMON_DRAWINGS="FOCUSING_COMMON_DRAWINGS",FORMULA_EDITOR_ACTIVATED="FORMULA_EDITOR_ACTIVATED";var __defProp$b=Object.defineProperty,__getOwnPropDesc$b=Object.getOwnPropertyDescriptor,__decorateClass$b=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$b(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$b(target,key,result),result},"__decorateClass$b"),__decorateParam$b=__name((index2,decorator)=>(target,key)=>decorator(target,key,index2),"__decorateParam$b");const IUniverInstanceService=createIdentifier("univer.current");var _a4;exports.UniverInstanceService=(_a4=class extends Disposable{constructor(_injector,_contextService){super();__publicField(this,"_unitsByType",new Map);__publicField(this,"_createHandler");__publicField(this,"_ctorByType",new Map);__publicField(this,"_currentUnits",new Map);__publicField(this,"_currentUnits$",new rxjs.BehaviorSubject(this._currentUnits));__publicField(this,"currentUnits$",this._currentUnits$.asObservable());__publicField(this,"_unitAdded$",new rxjs.Subject);__publicField(this,"unitAdded$",this._unitAdded$.asObservable());__publicField(this,"_unitDisposed$",new rxjs.Subject);__publicField(this,"unitDisposed$",this._unitDisposed$.asObservable());__publicField(this,"_focused$",new rxjs.BehaviorSubject(null));__publicField(this,"focused$",this._focused$.asObservable());this._injector=_injector,this._contextService=_contextService}dispose(){super.dispose(),this._focused$.complete()}__setCreateHandler(handler){this._createHandler=handler}createUnit(type2,data,options){return this._createHandler(type2,data,this._ctorByType.get(type2),options)}registerCtorForType(type2,ctor){return this._ctorByType.set(type2,ctor),{dispose:__name(()=>{this._ctorByType.delete(type2)},"dispose")}}getCurrentTypeOfUnit$(type2){return this.currentUnits$.pipe(rxjs.map(units=>{var _a17;return(_a17=units.get(type2))!=null?_a17:null}),rxjs.distinctUntilChanged())}getCurrentUnitForType(type2){return this._currentUnits.get(type2)}setCurrentUnitForType(unitId){const result=this._getUnitById(unitId);if(!result)throw new Error(`[UniverInstanceService]: no document with unitId ${unitId}!`);this._currentUnits.set(result[1],result[0]),this._currentUnits$.next(this._currentUnits)}getTypeOfUnitAdded$(type2){return this._unitAdded$.pipe(rxjs.filter(unit=>unit.type===type2))}__addUnit(unit,options){var _a17;const type2=unit.type;this._unitsByType.has(type2)||this._unitsByType.set(type2,[]);const units=this._unitsByType.get(type2),newUnitId=unit.getUnitId();if(units.findIndex(u=>u.getUnitId()===newUnitId)!==-1)throw new Error(`[UniverInstanceService]: cannot create a unit with the same unit id: ${newUnitId}.`);units.push(unit),this._unitAdded$.next(unit),((_a17=options==null?void 0:options.makeCurrent)==null||_a17)&&this.setCurrentUnitForType(unit.getUnitId())}getTypeOfUnitDisposed$(type2){return this.unitDisposed$.pipe(rxjs.filter(unit=>unit.type===type2))}getUnit(id,type2){var _a17;const unit=(_a17=this._getUnitById(id))==null?void 0:_a17[0];return type2&&(unit==null?void 0:unit.type)!==type2?null:unit}getCurrentUniverDocInstance(){return this.getCurrentUnitForType(_.UNIVER_DOC)}getUniverDocInstance(unitId){return this.getUnit(unitId,_.UNIVER_DOC)}getUniverSheetInstance(unitId){return this.getUnit(unitId,_.UNIVER_SHEET)}getAllUnitsForType(type2){var _a17;return(_a17=this._unitsByType.get(type2))!=null?_a17:[]}changeDoc(unitId,doc){const allDocs=this.getAllUnitsForType(_.UNIVER_DOC),oldDoc=allDocs.find(doc2=>doc2.getUnitId()===unitId);if(oldDoc!=null){const index2=allDocs.indexOf(oldDoc);allDocs.splice(index2,1)}this.__addUnit(doc)}get focused(){var _a17;const id=this._focused$.getValue();return id?(_a17=this._getUnitById(id))==null?void 0:_a17[0]:null}focusUnit(id){this._focused$.next(id),this.focused instanceof exports.Workbook?(this._contextService.setContextValue(FOCUSING_UNIT,!0),this._contextService.setContextValue(FOCUSING_DOC,!1),this._contextService.setContextValue(FOCUSING_SHEET,!0),this._contextService.setContextValue(FOCUSING_SLIDE,!1),this.setCurrentUnitForType(id)):this.focused instanceof DocumentDataModel?(this._contextService.setContextValue(FOCUSING_UNIT,!0),this._contextService.setContextValue(FOCUSING_DOC,!0),this._contextService.setContextValue(FOCUSING_SHEET,!1),this._contextService.setContextValue(FOCUSING_SLIDE,!1),this.setCurrentUnitForType(id)):this.focused instanceof SlideDataModel?(this._contextService.setContextValue(FOCUSING_UNIT,!0),this._contextService.setContextValue(FOCUSING_DOC,!1),this._contextService.setContextValue(FOCUSING_SHEET,!1),this._contextService.setContextValue(FOCUSING_SLIDE,!0),this.setCurrentUnitForType(id)):(this._contextService.setContextValue(FOCUSING_UNIT,!1),this._contextService.setContextValue(FOCUSING_DOC,!1),this._contextService.setContextValue(FOCUSING_SHEET,!1),this._contextService.setContextValue(FOCUSING_SLIDE,!1))}getFocusedUnit(){return this.focused}getUnitType(unitId){const result=this._getUnitById(unitId);return result?result[1]:_.UNRECOGNIZED}disposeUnit(unitId){const result=this._getUnitById(unitId);if(!result)return!1;const[unit,type2]=result,units=this._unitsByType.get(type2),index2=units.indexOf(unit);return units.splice(index2,1),this._tryRemoveCurrentUnitForType(unitId,type2),this._tryBlurUnitOnRemoval(unitId),this._unitDisposed$.next(unit),!0}_tryRemoveCurrentUnitForType(unitId,type2){const current=this.getCurrentUnitForType(type2);(current==null?void 0:current.getUnitId())===unitId&&(this._currentUnits.set(type2,null),this._currentUnits$.next(this._currentUnits))}_tryBlurUnitOnRemoval(unitId){var _a17;((_a17=this.focused)==null?void 0:_a17.getUnitId())===unitId&&this._focused$.next(null)}_getUnitById(unitId){for(const[type2,units]of this._unitsByType){const unit=units.find(unit2=>unit2.getUnitId()===unitId);if(unit)return[unit,type2]}}},__name(_a4,"UniverInstanceService"),_a4);exports.UniverInstanceService=__decorateClass$b([__decorateParam$b(0,Inject(Injector)),__decorateParam$b(1,IContextService)],exports.UniverInstanceService);var LifecycleStages=(LifecycleStages2=>(LifecycleStages2[LifecycleStages2.Starting=0]="Starting",LifecycleStages2[LifecycleStages2.Ready=1]="Ready",LifecycleStages2[LifecycleStages2.Rendered=2]="Rendered",LifecycleStages2[LifecycleStages2.Steady=3]="Steady",LifecycleStages2))(LifecycleStages||{});const LifecycleNameMap={0:"Starting",1:"Ready",2:"Rendered",3:"Steady"};var __defProp$a=Object.defineProperty,__getOwnPropDesc$a=Object.getOwnPropertyDescriptor,__decorateClass$a=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$a(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$a(target,key,result),result},"__decorateClass$a"),__decorateParam$a=__name((index2,decorator)=>(target,key)=>decorator(target,key,index2),"__decorateParam$a"),_a5;exports.LifecycleService=(_a5=class extends Disposable{constructor(_logService){super();__publicField(this,"_lifecycle$",new rxjs.BehaviorSubject(LifecycleStages.Starting));__publicField(this,"lifecycle$",this._lifecycle$.asObservable());__publicField(this,"_lock",!1);this._logService=_logService,this._reportProgress(LifecycleStages.Starting)}get stage(){return this._lifecycle$.getValue()}set stage(stage){if(this._lock)throw new Error("[LifecycleService]: cannot set new stage when related logic is all handled!");if(stage<this.stage)throw new Error("[LifecycleService]: lifecycle stage cannot go backward!");stage!==this.stage&&(this._lock=!0,this._reportProgress(stage),this._lifecycle$.next(stage),this._lock=!1)}dispose(){this._lifecycle$.complete(),super.dispose()}subscribeWithPrevious(){return rxjs.merge(getLifecycleStagesAndBefore(this.stage),this._lifecycle$.pipe(rxjs.skip(1))).pipe(takeAfter(s=>s===LifecycleStages.Steady))}_reportProgress(stage){this._logService.debug("[LifecycleService]",`lifecycle progressed to "${LifecycleNameMap[stage]}".`)}},__name(_a5,"LifecycleService"),_a5);exports.LifecycleService=__decorateClass$a([__decorateParam$a(0,ILogService)],exports.LifecycleService);function getLifecycleStagesAndBefore(lifecycleStage){switch(lifecycleStage){case LifecycleStages.Starting:return rxjs.of(LifecycleStages.Starting);case LifecycleStages.Ready:return rxjs.of(LifecycleStages.Starting,LifecycleStages.Ready);case LifecycleStages.Rendered:return rxjs.of(LifecycleStages.Starting,LifecycleStages.Ready,LifecycleStages.Rendered);default:return rxjs.of(LifecycleStages.Starting,LifecycleStages.Ready,LifecycleStages.Rendered,LifecycleStages.Steady)}}__name(getLifecycleStagesAndBefore,"getLifecycleStagesAndBefore");var __defProp$9=Object.defineProperty,__getOwnPropDesc$9=Object.getOwnPropertyDescriptor,__decorateClass$9=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$9(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$9(target,key,result),result},"__decorateClass$9"),__decorateParam$9=__name((index2,decorator)=>(target,key)=>decorator(target,key,index2),"__decorateParam$9");const IUndoRedoService=createIdentifier("univer.undo-redo.service"),STACK_CAPACITY=20,_MultiImplementationCommand=class _MultiImplementationCommand{dispose(){}async dispatchToHandlers(){return!1}};__name(_MultiImplementationCommand,"MultiImplementationCommand");let MultiImplementationCommand=_MultiImplementationCommand;const RedoCommandId="univer.command.redo",UndoCommandId="univer.command.undo",UndoCommand=new class extends MultiImplementationCommand{constructor(){super(...arguments);__publicField(this,"type",CommandType.COMMAND);__publicField(this,"id",UndoCommandId)}handler(accessor){const undoRedoService=accessor.get(IUndoRedoService),element=undoRedoService.pitchTopUndoElement();if(!element)return!1;const commandService=accessor.get(ICommandService);return sequenceExecute(element.undoMutations,commandService)?(undoRedoService.popUndoToRedo(),!0):!1}},RedoCommand=new class extends MultiImplementationCommand{constructor(){super(...arguments);__publicField(this,"type",CommandType.COMMAND);__publicField(this,"id",RedoCommandId)}handler(accessor){const undoRedoService=accessor.get(IUndoRedoService),element=undoRedoService.pitchTopRedoElement();if(!element)return!1;const commandService=accessor.get(ICommandService);return sequenceExecute(element.redoMutations,commandService)?(undoRedoService.popRedoToUndo(),!0):!1}};var _a6;exports.LocalUndoRedoService=(_a6=class extends Disposable{constructor(_univerInstanceService,_commandService,_contextService){super();__publicField(this,"undoRedoStatus$");__publicField(this,"_undoRedoStatus$",new rxjs.BehaviorSubject({undos:0,redos:0}));__publicField(this,"_undoStacks",new Map);__publicField(this,"_redoStacks",new Map);__publicField(this,"_batchingStatus",new Map);this._univerInstanceService=_univerInstanceService,this._commandService=_commandService,this._contextService=_contextService,this.undoRedoStatus$=this._undoRedoStatus$.asObservable(),this.disposeWithMe(this._commandService.registerCommand(UndoCommand)),this.disposeWithMe(this._commandService.registerCommand(RedoCommand)),this.disposeWithMe(toDisposable(()=>this._undoRedoStatus$.complete())),this.disposeWithMe(toDisposable(this._univerInstanceService.focused$.subscribe(()=>this._updateStatus())))}pushUndoRedo(item){const{unitID}=item,redoStack=this._getRedoStack(unitID,!0),undoStack=this._getUndoStack(unitID,!0);if(redoStack.length=0,this._batchingStatus.has(item.unitID)){const batchingStatus=this._batchingStatus.get(item.unitID),lastItem=this._pitchUndoElement(item.unitID);batchingStatus===0||!lastItem?(appendNewItem(item),this._batchingStatus.set(item.unitID,1)):this._tryBatchingElements(lastItem,item)}else appendNewItem(item);function appendNewItem(item2){undoStack.push(item2),undoStack.length>STACK_CAPACITY&&undoStack.splice(0,1)}__name(appendNewItem,"appendNewItem"),this._updateStatus()}clearUndoRedo(unitID){const redoStack=this._getRedoStack(unitID);redoStack&&(redoStack.length=0);const undoStack=this._getUndoStack(unitID);undoStack&&(undoStack.length=0),this._updateStatus()}pitchTopUndoElement(){const unitID=this._getFocusedUnitId();return this._pitchUndoElement(unitID)}pitchTopRedoElement(){const unitID=this._getFocusedUnitId();return this._pitchRedoElement(unitID)}_pitchUndoElement(unitId){const stack=this._getUndoStack(unitId);return stack!=null&&stack.length?stack[stack.length-1]:null}_pitchRedoElement(unitId){const stack=this._getRedoStack(unitId);return stack!=null&&stack.length?stack[stack.length-1]:null}popUndoToRedo(){const element=this._getUndoStackForFocused().pop();element&&(this._getRedoStackForFocused().push(element),this._updateStatus())}popRedoToUndo(){const element=this._getRedoStackForFocused().pop();element&&(this._getUndoStackForFocused().push(element),this._updateStatus())}__tempBatchingUndoRedo(unitId){if(this._batchingStatus.has(unitId))throw new Error("[LocalUndoRedoService]: cannot batching undo redo twice at the same time!");return this._batchingStatus.set(unitId,0),toDisposable(()=>this._batchingStatus.delete(unitId))}_updateStatus(){var _a17,_b2;const unitID=this._getFocusedUnitId(),undos=unitID&&((_a17=this._undoStacks.get(unitID))==null?void 0:_a17.length)||0,redos=unitID&&((_b2=this._redoStacks.get(unitID))==null?void 0:_b2.length)||0;this._undoRedoStatus$.next({undos,redos})}_getUndoStack(unitId,createAsNeeded=!1){let stack=this._undoStacks.get(unitId);return!stack&&createAsNeeded&&(stack=[],this._undoStacks.set(unitId,stack)),stack||null}_getRedoStack(unitId,createAsNeeded=!1){let stack=this._redoStacks.get(unitId);return!stack&&createAsNeeded&&(stack=[],this._redoStacks.set(unitId,stack)),stack||null}_getUndoStackForFocused(){const unitID=this._getFocusedUnitId();if(!unitID)throw new Error("No focused univer instance!");return this._getUndoStack(unitID,!0)}_getRedoStackForFocused(){const unitID=this._getFocusedUnitId();if(!unitID)throw new Error("No focused univer instance!");return this._getRedoStack(unitID,!0)}_tryBatchingElements(item,newItem){item.redoMutations.push(...newItem.redoMutations),item.undoMutations.push(...newItem.undoMutations)}_getFocusedUnitId(){var _a17,_b2,_c,_d;let unitID="";const isFocusSheet=this._contextService.getContextValue(FOCUSING_SHEET),isFocusFormulaEditor=this._contextService.getContextValue(FOCUSING_FX_BAR_EDITOR),isFocusEditor=this._contextService.getContextValue(EDITOR_ACTIVATED);return isFocusSheet?isFocusFormulaEditor?unitID=DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY:isFocusEditor?unitID=DOCS_NORMAL_EDITOR_UNIT_ID_KEY:unitID=(_b2=(_a17=this._univerInstanceService.getFocusedUnit())==null?void 0:_a17.getUnitId())!=null?_b2:"":unitID=(_d=(_c=this._univerInstanceService.getFocusedUnit())==null?void 0:_c.getUnitId())!=null?_d:"",unitID}},__name(_a6,"LocalUndoRedoService"),_a6);exports.LocalUndoRedoService=__decorateClass$9([__decorateParam$9(0,IUniverInstanceService),__decorateParam$9(1,ICommandService),__decorateParam$9(2,IContextService)],exports.LocalUndoRedoService);const IResourceManagerService=createIdentifier("core.resource-manager.service"),nameMap={[S.Editor]:"Editor",[S.Owner]:"Owner",[S.Reader]:"Reader",[S.UNRECOGNIZED]:"UNRECOGNIZED"},createDefaultUser=__name(type2=>type2?{userID:`${nameMap[type2]}_${Tools.generateRandomId(8)}`,name:nameMap[type2],avatar:""}:{userID:"",name:"",avatar:"",anonymous:!0,canBindAnonymous:!1},"createDefaultUser"),isDevRole=__name((userId,type2)=>userId.startsWith(nameMap[type2]),"isDevRole"),_UserManagerService=class _UserManagerService{constructor(){__publicField(this,"_model",new Map);__publicField(this,"_userChange$",new rxjs.Subject);__publicField(this,"userChange$",this._userChange$.asObservable());__publicField(this,"_currentUser$",new rxjs.BehaviorSubject(createDefaultUser()));__publicField(this,"currentUser$",this._currentUser$.asObservable())}getCurrentUser(){return this._currentUser$.getValue()}setCurrentUser(user){this.addUser(user),this._currentUser$.next(user)}addUser(user){this._model.set(user.userID,user),this._userChange$.next({type:"add",user})}getUser(userId,callBack){const user=this._model.get(userId);if(user)return user;callBack&&callBack()}delete(userId){const user=this.getUser(userId);this._model.delete(userId),user&&this._userChange$.next({type:"delete",user})}clear(){this._model.clear(),this._userChange$.next({type:"clear"})}list(){return Array.from(this._model.values())}};__name(_UserManagerService,"UserManagerService");let UserManagerService=_UserManagerService;var __defProp$8=Object.defineProperty,__getOwnPropDesc$8=Object.getOwnPropertyDescriptor,__decorateClass$8=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$8(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$8(target,key,result),result},"__decorateClass$8"),__decorateParam$8=__name((index2,decorator)=>(target,key)=>decorator(target,key,index2),"__decorateParam$8"),_a7;exports.AuthzIoLocalService=(_a7=class{constructor(_resourceManagerService,_userManagerService){__publicField(this,"_permissionMap",new Map([]));this._resourceManagerService=_resourceManagerService,this._userManagerService=_userManagerService,this._initSnapshot(),this._initDefaultUser()}_initDefaultUser(){const currentUser=this._userManagerService.getCurrentUser();currentUser&&currentUser.userID||this._userManagerService.setCurrentUser(createDefaultUser(S.Owner))}_getRole(type2){const user=this._userManagerService.getCurrentUser();return user?isDevRole(user.userID,type2):!1}_initSnapshot(){this._resourceManagerService.registerPluginResource({toJson:__name(_unitId=>{const obj=[...this._permissionMap.keys()].reduce((r,k)=>{const v=this._permissionMap.get(k);return r[k]=v,r},{});return JSON.stringify(obj)},"toJson"),parseJson:__name(json=>JSON.parse(json),"parseJson"),pluginName:"SHEET_AuthzIoMockService_PLUGIN",businesses:[_.UNIVER_SHEET,_.UNIVER_DOC,_.UNIVER_SLIDE],onLoad:__name((_unitId,resource)=>{for(const key in resource)this._permissionMap.set(key,resource[key])},"onLoad"),onUnLoad:__name(()=>{this._permissionMap.clear()},"onUnLoad")})}async create(config){return generateRandomId(8)}async allowed(_config){return Promise.resolve([])}async batchAllowed(_config){return Promise.resolve([])}async list(config){const result=[];return config.objectIDs.forEach(objectID=>{const rule=this._permissionMap.get(objectID);if(rule){const item={objectID,unitID:config.unitID,objectType:rule.objectType,name:rule.name,shareOn:!1,shareRole:S.Owner,shareScope:-1,scope:{read:M.AllCollaborator,edit:M.AllCollaborator},creator:createDefaultUser(S.Owner),strategies:[{action:6,role:1},{action:16,role:1},{action:17,role:1},{action:18,role:1},{action:19,role:1},{action:33,role:1},{action:34,role:1},{action:35,role:1},{action:36,role:1},{action:37,role:1},{action:38,role:1},{action:39,role:1},{action:40,role:1}],actions:config.actions.map(a=>({action:a,allowed:this._getRole(S.Owner)||this._getRole(S.Editor)}))};result.push(item)}}),result}async listCollaborators(){return[]}async listRoles(){return{roles:[],actions:[]}}async deleteCollaborator(){}async update(config){}async updateCollaborator(){}async createCollaborator(){}async putCollaborators(config){}},__name(_a7,"AuthzIoLocalService"),_a7);exports.AuthzIoLocalService=__decorateClass$8([__decorateParam$8(0,IResourceManagerService),__decorateParam$8(1,Inject(UserManagerService))],exports.AuthzIoLocalService);const IAuthzIoService=createIdentifier("IAuthzIoIoService"),IConfigService=createIdentifier("univer.config-service"),_ConfigService=class _ConfigService{constructor(){__publicField(this,"_configChanged$",new rxjs.Subject);__publicField(this,"configChanged$",this._configChanged$.asObservable());__publicField(this,"_config",new Map)}dispose(){this._configChanged$.complete()}getConfig(id){return this._config.get(id)}setConfig(id,value,options){var _a17;const{merge:isMerge=!1}=options||{};let nextValue=(_a17=this._config.get(id))!=null?_a17:{};isMerge?nextValue=merge(nextValue,value):nextValue=value,this._config.set(id,nextValue),this._configChanged$.next({[id]:nextValue})}deleteConfig(id){return this._config.delete(id)}subscribeConfigValue$(key){return new rxjs.Observable(observer=>{Object.prototype.hasOwnProperty.call(this._config,key)&&observer.next(this._config.get(key));const sub=this.configChanged$.pipe(rxjs.filter(c=>Object.prototype.hasOwnProperty.call(c,key))).subscribe(c=>observer.next(c[key]));return()=>sub.unsubscribe()})}};__name(_ConfigService,"ConfigService");let ConfigService=_ConfigService;const _ErrorService=class _ErrorService extends Disposable{constructor(){super(...arguments);__publicField(this,"_error$",new rxjs.Subject);__publicField(this,"error$",this._error$.asObservable())}dispose(){this._error$.complete()}emit(key){this._error$.next({errorKey:key})}};__name(_ErrorService,"ErrorService");let ErrorService=_ErrorService;const _LocaleService=class _LocaleService extends Disposable{constructor(){super();__publicField(this,"_currentLocale$",new rxjs.BehaviorSubject(LocaleType.ZH_CN));__publicField(this,"currentLocale$",this._currentLocale$.asObservable());__publicField(this,"_locales",null);__publicField(this,"localeChanged$",new rxjs.Subject);__publicField(this,"t",__name((key,...args)=>{if(!this._locales)throw new Error("[LocaleService]: Locale not initialized");const keys=key.split("."),resolvedValue=this.resolveKeyPath(this._locales[this._currentLocale],keys);if(typeof resolvedValue=="string"){let result=resolvedValue;return args.forEach((arg,index2)=>{result=result.replace(`{${index2}}`,arg)}),result}else return key},"t"));this.disposeWithMe(toDisposable(()=>this.localeChanged$.complete()))}get _currentLocale(){return this._currentLocale$.value}load(locales){var _a17;this._locales=merge((_a17=this._locales)!=null?_a17:{},locales)}setLocale(locale){this._currentLocale$.next(locale),this.localeChanged$.next()}getLocales(){var _a17;return(_a17=this._locales)==null?void 0:_a17[this._currentLocale]}getCurrentLocale(){return this._currentLocale}resolveKeyPath(obj,keys){const currentKey=keys.shift();if(currentKey&&obj&&currentKey in obj){const nextObj=obj[currentKey];return keys.length>0&&(typeof nextObj=="object"||Array.isArray(nextObj))?this.resolveKeyPath(nextObj,keys):nextObj}return null}};__name(_LocaleService,"LocaleService");let LocaleService=_LocaleService;var __defProp$7=Object.defineProperty,__getOwnPropDesc$7=Object.getOwnPropertyDescriptor,__decorateClass$7=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$7(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$7(target,key,result),result},"__decorateClass$7"),__decorateParam$7=__name((index2,decorator)=>(target,key)=>decorator(target,key,index2),"__decorateParam$7"),_a8;exports.MentionIOLocalService=(_a8=class{constructor(_userManagerService){this._userManagerService=_userManagerService}async list(params){return{list:[{type:MentionType.PERSON,mentions:[{objectType:MentionType.PERSON,objectId:this._userManagerService.getCurrentUser().userID,label:this._userManagerService.getCurrentUser().name,metadata:{icon:this._userManagerService.getCurrentUser().avatar}}],metadata:{},title:"PEOPLE"}],page:params.page,size:params.size,total:1}}},__name(_a8,"MentionIOLocalService"),_a8);exports.MentionIOLocalService=__decorateClass$7([__decorateParam$7(0,Inject(UserManagerService))],exports.MentionIOLocalService);const IMentionIOService=createIdentifier("univer.service.mention-io");var PermissionStatus=(PermissionStatus2=>(PermissionStatus2.INIT="init",PermissionStatus2.FETCHING="fetching",PermissionStatus2.DONE="done",PermissionStatus2))(PermissionStatus||{});const IPermissionService=createIdentifier("univer.permission-service"),_PermissionService=class _PermissionService extends Disposable{constructor(){super(...arguments);__publicField(this,"_permissionPointMap",new Map);__publicField(this,"_permissionPointUpdate$",new rxjs.Subject);__publicField(this,"permissionPointUpdate$",this._permissionPointUpdate$.asObservable());__publicField(this,"_showComponents",!0)}setShowComponents(showComponents){this._showComponents=showComponents}getShowComponents(){return this._showComponents}deletePermissionPoint(permissionId){const permissionPoint=this._permissionPointMap.get(permissionId);permissionPoint&&(permissionPoint.complete(),this._permissionPointMap.delete(permissionId))}addPermissionPoint(_item){const isSubject=_item instanceof rxjs.BehaviorSubject,item=isSubject?_item.getValue():_item;if(!item.id)return!1;if(this._permissionPointMap.get(item.id))throw new Error(`${item.id} PermissionPoint already exists`);return this._permissionPointMap.set(item.id,isSubject?_item:new rxjs.BehaviorSubject(item)),this._permissionPointUpdate$.next(item),!0}updatePermissionPoint(permissionId,value){const permissionPoint=this._permissionPointMap.get(permissionId);if(!permissionPoint)return;const subject=permissionPoint.getValue();subject.value=value,subject.status=PermissionStatus.DONE,permissionPoint.next(subject),this._permissionPointUpdate$.next(subject)}clearPermissionMap(){this._permissionPointMap.clear()}getPermissionPoint(permissionId){const permissionPoint=this._permissionPointMap.get(permissionId);if(permissionPoint)return permissionPoint.getValue()}getPermissionPoint$(permissionId){const permissionPoint=this._permissionPointMap.get(permissionId);if(permissionPoint)return permissionPoint}composePermission$(permissionIdList){const subjectList=permissionIdList.map(id=>{var _a17;const subject=(_a17=this._permissionPointMap)==null?void 0:_a17.get(id);if(!subject)throw new Error(`[PermissionService]: ${id} permissionPoint does not exist!`);return subject.asObservable()});return rxjs.combineLatest(subjectList).pipe(operators.map(list=>list))}composePermission(permissionIdList){return permissionIdList.map(id=>{var _a17;const subject=(_a17=this._permissionPointMap)==null?void 0:_a17.get(id);if(!subject)throw new Error(`[PermissionService]: ${id} permissionPoint does not exist!`);return subject.getValue()})}getAllPermissionPoint(){const cacheMap=new Map;return this._permissionPointMap.forEach((v,key)=>{cacheMap.set(key,v)}),cacheMap}};__name(_PermissionService,"PermissionService");let PermissionService=_PermissionService;function mergeOverrideWithDependencies(dependencies,override){if(!override)return dependencies;const result=[];for(const dependency of dependencies){const overrideItem=override.find(([identifier])=>identifier===dependency[0]);if(overrideItem){if(overrideItem[1]===null)continue;result.push([dependency[0],overrideItem[1]])}else result.push(dependency)}return result}__name(mergeOverrideWithDependencies,"mergeOverrideWithDependencies");const DependentOnSymbol=Symbol("DependentOn"),_Plugin=class _Plugin extends Disposable{onStarting(){}onReady(){}onRendered(){}onSteady(){}getUniverInstanceType(){return this.constructor.type}getPluginName(){return this.constructor.pluginName}};__name(_Plugin,"Plugin"),__publicField(_Plugin,"pluginName"),__publicField(_Plugin,"type",_.UNIVER_UNKNOWN);let Plugin=_Plugin;const _PluginStore=class _PluginStore{constructor(){__publicField(this,"_plugins",[])}addPlugin(plugin){this._plugins.push(plugin)}removePlugins(){const plugins=this._plugins.slice();return this._plugins.length=0,plugins}forEachPlugin(callback){this._plugins.forEach(callback)}};__name(_PluginStore,"PluginStore");let PluginStore=_PluginStore;const _PluginRegistry=class _PluginRegistry{constructor(){__publicField(this,"_pluginsRegistered",[])}registerPlugin(pluginCtor,options){this._pluginsRegistered.push({plugin:pluginCtor,options})}getRegisterPlugins(){return this._pluginsRegistered.slice()}removePlugins(){this._pluginsRegistered=[]}};__name(_PluginRegistry,"PluginRegistry");let PluginRegistry=_PluginRegistry;var __defProp$6=Object.defineProperty,__getOwnPropDesc$6=Object.getOwnPropertyDescriptor,__decorateClass$6=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$6(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$6(target,key,result),result},"__decorateClass$6"),__decorateParam$6=__name((index2,decorator)=>(target,key)=>decorator(target,key,index2),"__decorateParam$6");const INIT_LAZY_PLUGINS_TIMEOUT=4;function DependentOn(...plugins){return function(target){target[DependentOnSymbol]=plugins}}__name(DependentOn,"DependentOn");var _a9;exports.PluginService=(_a9=class{constructor(_injector){__publicField(this,"_pluginHolderForUniver");__publicField(this,"_pluginHoldersForTypes",new Map);__publicField(this,"_seenPlugins",new Set);__publicField(this,"_flushTimer");this._injector=_injector,this._pluginHolderForUniver=this._injector.createInstance(PluginHolder,this._checkPluginSeen.bind(this),this._immediateInitPlugin.bind(this)),this._pluginHoldersForTypes.set(_.UNIVER_UNKNOWN,this._pluginHolderForUniver),this._pluginHolderForUniver.start()}dispose(){this._clearFlushTimer();for(const holder of this._pluginHoldersForTypes.values())holder.dispose();this._pluginHolderForUniver.dispose()}registerPlugin(ctor,config){this._assertPluginValid(ctor),this._scheduleInitPlugin();const{type:type2}=ctor;type2===_.UNIVER_UNKNOWN?(this._pluginHolderForUniver.register(ctor,config),this._pluginHolderForUniver.flush()):this._ensurePluginHolderForType(type2).register(ctor,config)}startPluginForType(type2){this._ensurePluginHolderForType(type2).start()}_ensurePluginHolderForType(type2){if(!this._pluginHoldersForTypes.has(type2)){const pluginHolder=this._injector.createInstance(PluginHolder,this._checkPluginSeen.bind(this),this._immediateInitPlugin.bind(this));return this._pluginHoldersForTypes.set(type2,pluginHolder),pluginHolder}return this._pluginHoldersForTypes.get(type2)}_immediateInitPlugin(ctor){this._seenPlugins.add(ctor.pluginName),this._ensurePluginHolderForType(ctor.type).immediateInitPlugin(ctor)}_checkPluginSeen(ctor){return this._seenPlugins.has(ctor.pluginName)}_assertPluginValid(ctor){const{type:type2,pluginName}=ctor;if(type2===_.UNRECOGNIZED)throw new Error(`[PluginService]: invalid plugin type for ${ctor.name}. Please assign a "type" to your plugin.`);if(!pluginName)throw new Error(`[PluginService]: no plugin name for ${ctor.name}. Please assign a "pluginName" to your plugin.`);if(this._seenPlugins.has(pluginName))throw new Error(`[PluginService]: duplicated plugin name for "${pluginName}". Maybe a plugin that dependents on "${pluginName} has already registered it. In that case please register "${pluginName}" before the that plugin.`);this._seenPlugins.add(ctor.pluginName)}_scheduleInitPlugin(){this._flushTimer===void 0&&(this._flushTimer=setTimeout(()=>{this._pluginHolderForUniver.started||this._pluginHolderForUniver.start(),this._flushPlugins(),this._clearFlushTimer()},INIT_LAZY_PLUGINS_TIMEOUT))}_clearFlushTimer(){this._flushTimer&&(clearTimeout(this._flushTimer),this._flushTimer=void 0)}_flushPlugins(){this._pluginHolderForUniver.flush();for(const[_2,holder]of this._pluginHoldersForTypes)holder.started&&holder.flush()}},__name(_a9,"PluginService"),_a9);exports.PluginService=__decorateClass$6([__decorateParam$6(0,Inject(Injector))],exports.PluginService);var _a10;let PluginHolder=(_a10=class extends Disposable{constructor(_checkPluginRegistered,_registerPlugin,_logService,_injector,_lifecycleService){super();__publicField(this,"_started",!1);__publicField(this,"_warnedAboutOnStartingDeprecation",!1);__publicField(this,"_pluginRegistry",new PluginRegistry);__publicField(this,"_pluginStore",new PluginStore);__publicField(this,"_pluginsInBatches",[]);this._checkPluginRegistered=_checkPluginRegistered,this._registerPlugin=_registerPlugin,this._logService=_logService,this._injector=_injector,this._lifecycleService=_lifecycleService,this.disposeWithMe(this._lifecycleService.lifecycle$.pipe(rxjs.skip(1)).subscribe(stage=>{this._pluginsInBatches.forEach(plugins=>this._runStage(plugins,stage))}))}get started(){return this._started}dispose(){super.dispose(),this._pluginStore.forEachPlugin(plugin=>plugin.dispose()),this._pluginStore.removePlugins(),this._pluginRegistry.removePlugins(),this._pluginsInBatches.length=0}register(pluginCtor,config){this._pluginRegistry.registerPlugin(pluginCtor,config)}immediateInitPlugin(plugin){const p=this._initPlugin(plugin,void 0);this._pluginsRunLifecycle([p])}start(){this._started||(this._started=!0,this.flush())}flush(){if(!this._started)return;const plugins=this._pluginRegistry.getRegisterPlugins().map(({plugin,options})=>this._initPlugin(plugin,options));plugins.length&&(this._pluginsRunLifecycle(plugins),this._pluginRegistry.removePlugins())}_initPlugin(plugin,options){const dependents=plugin[DependentOnSymbol];if(dependents){const exhaustUnregisteredDependents=__name(()=>{const NotRegistered=dependents.find(d=>!this._checkPluginRegistered(d));return NotRegistered?(this._logService.debug("[PluginService]",`Plugin "${plugin.pluginName}" depends on "${NotRegistered.pluginName}" which is not registered. Univer will automatically register it with default configuration.`),this._registerPlugin(NotRegistered,void 0),!0):!1},"exhaustUnregisteredDependents");for(;exhaustUnregisteredDependents(););}const pluginInstance=this._injector.createInstance(plugin,options);return this._pluginStore.addPlugin(pluginInstance),this._logService.debug("[PluginService]",`Plugin "${pluginInstance.getPluginName()}" registered.`),pluginInstance}_pluginsRunLifecycle(plugins){getLifecycleStagesAndBefore(this._lifecycleService.stage).subscribe(stage=>this._runStage(plugins,stage)),this._pluginsInBatches.push(plugins)}_runStage(plugins,stage){plugins.forEach(p=>{switch(stage){case LifecycleStages.Starting:p.onStarting();break;case LifecycleStages.Ready:p.onReady();break;case LifecycleStages.Rendered:p.onRendered();break;case LifecycleStages.Steady:p.onSteady();break}})}},__name(_a10,"PluginHolder"),_a10);PluginHolder=__decorateClass$6([__decorateParam$6(2,ILogService),__decorateParam$6(3,Inject(Injector)),__decorateParam$6(4,Inject(exports.LifecycleService))],PluginHolder);var __defProp$5=Object.defineProperty,__getOwnPropDesc$5=Object.getOwnPropertyDescriptor,__decorateClass$5=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$5(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$5(target,key,result),result},"__decorateClass$5"),__decorateParam$5=__name((index2,decorator)=>(target,key)=>decorator(target,key,index2),"__decorateParam$5"),_a11;let ResourceLoaderService=(_a11=class extends Disposable{constructor(_resourceManagerService,_univerInstanceService){super(),this._resourceManagerService=_resourceManagerService,this._univerInstanceService=_univerInstanceService,this._init()}_init(){const handleHookAdd=__name(hook=>{hook.businesses.forEach(business=>{switch(business){case _.UNRECOGNIZED:case _.UNIVER_UNKNOWN:case _.UNIVER_SLIDE:case _.UNIVER_DOC:{this._univerInstanceService.getAllUnitsForType(_.UNIVER_DOC).forEach(doc=>{const plugin=(doc.getSnapshot().resources||[]).find(r=>r.name===hook.pluginName);if(plugin)try{const data=hook.parseJson(plugin.data);hook.onLoad(doc.getUnitId(),data)}catch{console.error(`Load Document{${doc.getUnitId()}} Resources{${hook.pluginName}} Data Error.`)}});break}case _.UNIVER_SHEET:this._univerInstanceService.getAllUnitsForType(_.UNIVER_SHEET).forEach(workbook=>{const plugin=(workbook.getSnapshot().resources||[]).find(r=>r.name===hook.pluginName);if(plugin)try{const data=hook.parseJson(plugin.data);hook.onLoad(workbook.getUnitId(),data)}catch{console.error(`Load Workbook{${workbook.getUnitId()}} Resources{${hook.pluginName}} Data Error.`)}})}})},"handleHookAdd");this._resourceManagerService.getAllResourceHooks().forEach(hook=>handleHookAdd(hook)),this.disposeWithMe(this._resourceManagerService.register$.subscribe(hook=>handleHookAdd(hook))),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitAdded$(_.UNIVER_SHEET).subscribe(workbook=>{this._resourceManagerService.loadResources(workbook.getUnitId(),workbook.getSnapshot().resources)})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitAdded$(_.UNIVER_DOC).subscribe(doc=>{const unitId=doc.getUnitId();isInternalEditorID(unitId)||this._resourceManagerService.loadResources(doc.getUnitId(),doc.getSnapshot().resources)})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitDisposed$(_.UNIVER_SHEET).subscribe(workbook=>{this._resourceManagerService.unloadResources(workbook.getUnitId())})),this.disposeWithMe(this._univerInstanceService.getTypeOfUnitDisposed$(_.UNIVER_DOC).subscribe(doc=>{this._resourceManagerService.unloadResources(doc.getUnitId())}))}saveUnit(unitId){const unit=this._univerInstanceService.getUnit(unitId);if(!unit)return null;const resources=this._resourceManagerService.getResources(unitId,unit.type),snapshot=Tools.deepClone(unit.getSnapshot());return snapshot.resources=resources,snapshot}},__name(_a11,"ResourceLoaderService"),_a11);ResourceLoaderService=__decorateClass$5([__decorateParam$5(0,Inject(IResourceManagerService)),__decorateParam$5(1,Inject(IUniverInstanceService))],ResourceLoaderService);const IResourceLoaderService=createIdentifier("resource-loader-service"),_ResourceManagerService=class _ResourceManagerService extends Disposable{constructor(){super(...arguments);__publicField(this,"_resourceMap",new Map);__publicField(this,"_register$",new rxjs.Subject);__publicField(this,"register$",this._register$.asObservable())}getAllResourceHooks(){return[...this._resourceMap.values()]}getResources(unitId,type2){return type2?this.getResourcesByType(unitId,type2):this.getAllResourceHooks().map(resourceHook=>{const data=resourceHook.toJson(unitId);return{name:resourceHook.pluginName,data}})}getResourcesByType(unitId,type2){return this.getAllResourceHooks().filter(hook=>hook.businesses.includes(type2)).map(resourceHook=>{const data=resourceHook.toJson(unitId);return{name:resourceHook.pluginName,data}})}registerPluginResource(hook){const resourceName=hook.pluginName;if(this._resourceMap.has(resourceName))throw new Error(`the pluginName is registered {${resourceName}}`);return this._resourceMap.set(resourceName,hook),this._register$.next(hook),toDisposable(()=>this._resourceMap.delete(resourceName))}disposePluginResource(pluginName){this._resourceMap.delete(pluginName)}loadResources(unitId,resources){this.getAllResourceHooks().forEach(hook=>{var _a17;const data=(_a17=resources==null?void 0:resources.find(resource=>resource.name===hook.pluginName))==null?void 0:_a17.data;if(data)try{const model=hook.parseJson(data);hook.onLoad(unitId,model)}catch{console.error("LoadResources Error!")}})}unloadResources(unitId){this.getAllResourceHooks().forEach(hook=>{hook.onUnLoad(unitId)})}dispose(){this._register$.complete(),this._resourceMap.clear()}};__name(_ResourceManagerService,"ResourceManagerService");let ResourceManagerService=_ResourceManagerService;const _ThemeService=class _ThemeService extends Disposable{constructor(){super();__publicField(this,"_currentTheme");__publicField(this,"_currentTheme$",new rxjs.BehaviorSubject({}));__publicField(this,"currentTheme$",this._currentTheme$.asObservable());this.disposeWithMe(toDisposable(()=>this._currentTheme$.complete()))}getCurrentTheme(){if(!this._currentTheme)throw new Error("[ThemeService]: current theme is not set!");return this._currentTheme}setTheme(theme){this._currentTheme=theme,this._currentTheme$.next(theme)}};__name(_ThemeService,"ThemeService");let ThemeService=_ThemeService;const _Univer=class _Univer{constructor(config={},parentInjector){__publicField(this,"_startedTypes",new Set);__publicField(this,"_injector");__publicField(this,"_disposingCallbacks",new DisposableCollection);const injector=this._injector=createUniverInjector(parentInjector,config==null?void 0:config.override),{theme,locale,locales,logLevel}=config;theme&&this._injector.get(ThemeService).setTheme(theme),locales&&this._injector.get(LocaleService).load(locales),locale&&this._injector.get(LocaleService).setLocale(locale),logLevel&&this._injector.get(ILogService).setLogLevel(logLevel),this._init(injector)}get _univerInstanceService(){return this._injector.get(IUniverInstanceService)}get _pluginService(){return this._injector.get(exports.PluginService)}__getInjector(){return this._injector}onDispose(callback){const d=this._disposingCallbacks.add(toDisposable(callback));return toDisposable(()=>d.dispose(!0))}dispose(){this._disposingCallbacks.dispose(),this._injector.dispose()}setLocale(locale){this._injector.get(LocaleService).setLocale(locale)}createUnit(type2,data){return this._univerInstanceService.createUnit(type2,data)}createUniverSheet(data){return this._injector.get(ILogService).warn("[Univer]: Univer.createUniverSheet is deprecated, use createUnit instead"),this._univerInstanceService.createUnit(_.UNIVER_SHEET,data)}createUniverDoc(data){return this._injector.get(ILogService).warn("[Univer]: Univer.createUniverDoc is deprecated, use createUnit instead"),this._univerInstanceService.createUnit(_.UNIVER_DOC,data)}createUniverSlide(data){return this._injector.get(ILogService).warn("[Univer]: Univer.createUniverSlide is deprecated, use createUnit instead"),this._univerInstanceService.createUnit(_.UNIVER_SLIDE,data)}_init(injector){this._univerInstanceService.registerCtorForType(_.UNIVER_SHEET,exports.Workbook),this._univerInstanceService.registerCtorForType(_.UNIVER_DOC,DocumentDataModel),this._univerInstanceService.registerCtorForType(_.UNIVER_SLIDE,SlideDataModel);const univerInstanceService=injector.get(IUniverInstanceService);univerInstanceService.__setCreateHandler((type2,data,ctor,options)=>{if(!this._startedTypes.has(type2)){this._pluginService.startPluginForType(type2),this._startedTypes.add(type2);const model2=injector.createInstance(ctor,data);return univerInstanceService.__addUnit(model2,options),this._tryProgressToReady(),model2}const model=injector.createInstance(ctor,data);return univerInstanceService.__addUnit(model,options),model})}_tryProgressToReady(){this._injector.get(exports.LifecycleService).stage<LifecycleStages.Ready&&(this._injector.get(exports.LifecycleService).stage=LifecycleStages.Ready)}registerPlugin(plugin,config){this._pluginService.registerPlugin(plugin,config)}};__name(_Univer,"Univer");let Univer=_Univer;function createUniverInjector(parentInjector,override){const dependencies=mergeOverrideWithDependencies([[ErrorService],[LocaleService],[ThemeService],[exports.LifecycleService],[exports.PluginService],[UserManagerService],[IUniverInstanceService,{useClass:exports.UniverInstanceService}],[IPermissionService,{useClass:PermissionService}],[ILogService,{useClass:DesktopLogService,lazy:!0}],[ICommandService,{useClass:exports.CommandService}],[IUndoRedoService,{useClass:exports.LocalUndoRedoService,lazy:!0}],[IConfigService,{useClass:ConfigService}],[IContextService,{useClass:ContextService}],[IResourceManagerService,{useClass:ResourceManagerService,lazy:!0}],[IResourceLoaderService,{useClass:ResourceLoaderService,lazy:!0}],[IAuthzIoService,{useClass:exports.AuthzIoLocalService,lazy:!0}],[IMentionIOService,{useClass:exports.MentionIOLocalService,lazy:!0}]],override),injector=parentInjector?parentInjector.createChild(dependencies):new Injector(dependencies);return touchDependencies(injector,[[UserManagerService],[IResourceLoaderService]]),injector}__name(createUniverInjector,"createUniverInjector");var __defProp$4=Object.defineProperty,__getOwnPropDesc$4=Object.getOwnPropertyDescriptor,__decorateClass$4=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$4(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$4(target,key,result),result},"__decorateClass$4"),__decorateParam$4=__name((index2,decorator)=>(target,key)=>decorator(target,key,index2),"__decorateParam$4"),_a12;exports.FBlob=(_a12=class extends FBase{constructor(_blob,_injector){super(),this._blob=_blob,this._injector=_injector}copyBlob(){return this._injector.createInstance(exports.FBlob,this._blob)}getAs(contentType){const newBlob=this.copyBlob();return newBlob.setContentType(contentType),newBlob}getDataAsString(charset){return this._blob===null?Promise.resolve(""):charset===void 0?this._blob.text():new Promise((resolve,reject)=>{this._blob.arrayBuffer().then(arrayBuffer=>{const text=new TextDecoder(charset).decode(arrayBuffer);resolve(text)}).catch(error=>{reject(new Error(`Failed to read Blob as ArrayBuffer: ${error.message}`))})})}getBytes(){return this._blob?this._blob.arrayBuffer().then(buffer=>new Uint8Array(buffer)):Promise.reject(new Error("Blob is undefined or null."))}setBytes(bytes){return this._blob=new Blob([bytes]),this}setDataFromString(data,contentType){const contentTypeVal=contentType!=null?contentType:"text/plain",blob=new Blob([data],{type:contentTypeVal});return this._blob=blob,this}getContentType(){var _a17;return(_a17=this._blob)==null?void 0:_a17.type}setContentType(contentType){var _a17;return this._blob=(_a17=this._blob)==null?void 0:_a17.slice(0,this._blob.size,contentType),this}},__name(_a12,"FBlob"),_a12);exports.FBlob=__decorateClass$4([__decorateParam$4(1,Inject(Injector))],exports.FBlob);var __defProp$3=Object.defineProperty,__getOwnPropDesc$3=Object.getOwnPropertyDescriptor,__decorateClass$3=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$3(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$3(target,key,result),result},"__decorateClass$3"),__decorateParam$3=__name((index2,decorator)=>(target,key)=>decorator(target,key,index2),"__decorateParam$3"),_a13;let FDoc=(_a13=class extends FBaseInitialable{constructor(doc,_injector){super(_injector),this.doc=doc}},__name(_a13,"FDoc"),_a13);FDoc=__decorateClass$3([__decorateParam$3(1,Inject(Injector))],FDoc);var DataValidationErrorStyle=(DataValidationErrorStyle2=>(DataValidationErrorStyle2[DataValidationErrorStyle2.INFO=0]="INFO",DataValidationErrorStyle2[DataValidationErrorStyle2.STOP=1]="STOP",DataValidationErrorStyle2[DataValidationErrorStyle2.WARNING=2]="WARNING",DataValidationErrorStyle2))(DataValidationErrorStyle||{}),DataValidationOperator=(DataValidationOperator2=>(DataValidationOperator2.BETWEEN="between",DataValidationOperator2.EQUAL="equal",DataValidationOperator2.GREATER_THAN="greaterThan",DataValidationOperator2.GREATER_THAN_OR_EQUAL="greaterThanOrEqual",DataValidationOperator2.LESS_THAN="lessThan",DataValidationOperator2.LESS_THAN_OR_EQUAL="lessThanOrEqual",DataValidationOperator2.NOT_BETWEEN="notBetween",DataValidationOperator2.NOT_EQUAL="notEqual",DataValidationOperator2))(DataValidationOperator||{}),DataValidationRenderMode=(DataValidationRenderMode2=>(DataValidationRenderMode2[DataValidationRenderMode2.TEXT=0]="TEXT",DataValidationRenderMode2[DataValidationRenderMode2.ARROW=1]="ARROW",DataValidationRenderMode2[DataValidationRenderMode2.CUSTOM=2]="CUSTOM",DataValidationRenderMode2))(DataValidationRenderMode||{}),DataValidationStatus=(DataValidationStatus2=>(DataValidationStatus2.VALID="valid",DataValidationStatus2.INVALID="invalid",DataValidationStatus2.VALIDATING="validating",DataValidationStatus2))(DataValidationStatus||{}),DataValidationType=(DataValidationType2=>(DataValidationType2.CUSTOM="custom",DataValidationType2.LIST="list",DataValidationType2.LIST_MULTIPLE="listMultiple",DataValidationType2.NONE="none",DataValidationType2.TEXT_LENGTH="textLength",DataValidationType2.DATE="date",DataValidationType2.TIME="time",DataValidationType2.WHOLE="whole",DataValidationType2.DECIMAL="decimal",DataValidationType2.CHECKBOX="checkbox",DataValidationType2.ANY="any",DataValidationType2))(DataValidationType||{});const _FEnum=class _FEnum{static get(){if(this._instance)return this._instance;const instance=new _FEnum;return this._instance=instance,instance}static extend(source){Object.getOwnPropertyNames(source.prototype).forEach(name=>{name!=="constructor"&&(this.prototype[name]=source.prototype[name])}),Object.getOwnPropertyNames(source).forEach(name=>{name!=="prototype"&&name!=="name"&&name!=="length"&&(this[name]=source[name])})}constructor(){for(const key in _FEnum.prototype)this[key]=_FEnum.prototype[key]}get UniverInstanceType(){return _}get LifecycleStages(){return LifecycleStages}get DataValidationType(){return DataValidationType}get DataValidationErrorStyle(){return DataValidationErrorStyle}get DataValidationRenderMode(){return DataValidationRenderMode}get DataValidationOperator(){return DataValidationOperator}get DataValidationStatus(){return DataValidationStatus}get CommandType(){return CommandType}get BaselineOffset(){return BaselineOffset}get BooleanNumber(){return BooleanNumber}get HorizontalAlign(){return HorizontalAlign}get TextDecoration(){return TextDecoration}get TextDirection(){return TextDirection}get VerticalAlign(){return VerticalAlign}get BorderType(){return BorderType}get BorderStyleTypes(){return BorderStyleTypes}get AutoFillSeries(){return AutoFillSeries}get ColorType(){return ColorType}get CommonHideTypes(){return CommonHideTypes}get CopyPasteType(){return CopyPasteType}get DeleteDirection(){return DeleteDirection}get DeveloperMetadataVisibility(){return DeveloperMetadataVisibility}get Dimension(){return Dimension}get Direction(){return Direction}get InterpolationPointType(){return InterpolationPointType}get LocaleType(){return LocaleType}get MentionType(){return MentionType}get ProtectionType(){return ProtectionType}get RelativeDate(){return RelativeDate}get SheetTypes(){return SheetTypes}get ThemeColorType(){return ThemeColorType}};__name(_FEnum,"FEnum"),__publicField(_FEnum,"_instance");let FEnum=_FEnum;const _FEventName=class _FEventName{static get(){if(this._instance)return this._instance;const instance=new _FEventName;return this._instance=instance,instance}static extend(source){Object.getOwnPropertyNames(source.prototype).forEach(name=>{name!=="constructor"&&(this.prototype[name]=source.prototype[name])}),Object.getOwnPropertyNames(source).forEach(name=>{name!=="prototype"&&name!=="name"&&name!=="length"&&(this[name]=source[name])})}constructor(){for(const key in _FEventName.prototype)this[key]=_FEventName.prototype[key]}get DocCreated(){return"DocCreated"}get DocDisposed(){return"DocDisposed"}get LifeCycleChanged(){return"LifeCycleChanged"}get Redo(){return"Redo"}get Undo(){return"Undo"}get BeforeRedo(){return"BeforeRedo"}get BeforeUndo(){return"BeforeUndo"}get CommandExecuted(){return"CommandExecuted"}get BeforeCommandExecute(){return"BeforeCommandExecute"}};__name(_FEventName,"FEventName"),__publicField(_FEventName,"_instance");let FEventName=_FEventName;var __defProp$2=Object.defineProperty,__getOwnPropDesc$2=Object.getOwnPropertyDescriptor,__decorateClass$2=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$2(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$2(target,key,result),result},"__decorateClass$2"),__decorateParam$2=__name((index2,decorator)=>(target,key)=>decorator(target,key,index2),"__decorateParam$2"),_a14;exports.FHooks=(_a14=class extends FBase{constructor(_injector,_lifecycleService){super(),this._injector=_injector,this._lifecycleService=_lifecycleService}onStarting(callback){return toDisposable(this._lifecycleService.lifecycle$.pipe(rxjs.filter(lifecycle=>lifecycle===LifecycleStages.Starting)).subscribe(callback))}onReady(callback){return toDisposable(this._lifecycleService.lifecycle$.pipe(rxjs.filter(lifecycle=>lifecycle===LifecycleStages.Ready)).subscribe(callback))}onRendered(callback){return toDisposable(this._lifecycleService.lifecycle$.pipe(rxjs.filter(lifecycle=>lifecycle===LifecycleStages.Rendered)).subscribe(callback))}onSteady(callback){return toDisposable(this._lifecycleService.lifecycle$.pipe(rxjs.filter(lifecycle=>lifecycle===LifecycleStages.Steady)).subscribe(callback))}onBeforeUndo(callback){return this._injector.get(ICommandService).beforeCommandExecuted(command=>{if(command.id===UndoCommand.id){const action=this._injector.get(IUndoRedoService).pitchTopUndoElement();action&&callback(action)}})}onUndo(callback){return this._injector.get(ICommandService).onCommandExecuted(command=>{if(command.id===UndoCommand.id){const action=this._injector.get(IUndoRedoService).pitchTopUndoElement();action&&callback(action)}})}onBeforeRedo(callback){return this._injector.get(ICommandService).beforeCommandExecuted(command=>{if(command.id===RedoCommand.id){const action=this._injector.get(IUndoRedoService).pitchTopRedoElement();action&&callback(action)}})}onRedo(callback){return this._injector.get(ICommandService).onCommandExecuted(command=>{if(command.id===RedoCommand.id){const action=this._injector.get(IUndoRedoService).pitchTopRedoElement();action&&callback(action)}})}},__name(_a14,"FHooks"),_a14);exports.FHooks=__decorateClass$2([__decorateParam$2(0,Inject(Injector)),__decorateParam$2(1,Inject(exports.LifecycleService))],exports.FHooks);var __defProp$1=Object.defineProperty,__getOwnPropDesc$1=Object.getOwnPropertyDescriptor,__decorateClass$1=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc$1(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp$1(target,key,result),result},"__decorateClass$1"),__decorateParam$1=__name((index2,decorator)=>(target,key)=>decorator(target,key,index2),"__decorateParam$1"),_a15;let FUserManager=(_a15=class extends FBase{constructor(_injector,_userManagerService){super(),this._injector=_injector,this._userManagerService=_userManagerService}getCurrentUser(){return this._userManagerService.getCurrentUser()}},__name(_a15,"FUserManager"),_a15);FUserManager=__decorateClass$1([__decorateParam$1(0,Inject(Injector)),__decorateParam$1(1,Inject(UserManagerService))],FUserManager);const _FUtil=class _FUtil{static get(){if(this._instance)return this._instance;const instance=new _FUtil;return this._instance=instance,instance}static extend(source){Object.getOwnPropertyNames(source.prototype).forEach(name=>{name!=="constructor"&&(this.prototype[name]=source.prototype[name])}),Object.getOwnPropertyNames(source).forEach(name=>{name!=="prototype"&&name!=="name"&&name!=="length"&&(this[name]=source[name])})}get rectangle(){return Rectangle}get numfmt(){return numfmt}get tools(){return Tools}};__name(_FUtil,"FUtil"),__publicField(_FUtil,"_instance");let FUtil=_FUtil;var __defProp2=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__decorateClass=__name((decorators,target,key,kind)=>{for(var result=kind>1?void 0:kind?__getOwnPropDesc(target,key):target,i=decorators.length-1,decorator;i>=0;i--)(decorator=decorators[i])&&(result=(kind?decorator(target,key,result):decorator(result))||result);return kind&&result&&__defProp2(target,key,result),result},"__decorateClass"),__decorateParam=__name((index2,decorator)=>(target,key)=>decorator(target,key,index2),"__decorateParam"),_a16;exports.FUniver=(_a16=class extends FBaseInitialable{constructor(_injector,_commandService,_univerInstanceService,_lifecycleService){super(_injector);__publicField(this,"_eventRegistry",new Map);this._injector=_injector,this._commandService=_commandService,this._univerInstanceService=_univerInstanceService,this._lifecycleService=_lifecycleService,this.disposeWithMe(this._lifecycleService.lifecycle$.subscribe(stage=>{this.fireEvent(this.Event.LifeCycleChanged,{stage})})),this.disposeWithMe(this._commandService.beforeCommandExecuted(commandInfo=>{if(!this._eventRegistry.get(this.Event.BeforeRedo)&&!this._eventRegistry.get(this.Event.BeforeUndo)&&!this._eventRegistry.get(this.Event.BeforeCommandExecute))return;const{id,type:propType,params}=commandInfo,eventParams={id,type:propType,params};switch(commandInfo.id){case RedoCommand.id:this.fireEvent(this.Event.BeforeRedo,eventParams);break;case UndoCommand.id:this.fireEvent(this.Event.BeforeUndo,eventParams);break;default:this.fireEvent(this.Event.BeforeCommandExecute,eventParams);break}if(eventParams.cancel)throw new CanceledError})),this.disposeWithMe(this._commandService.onCommandExecuted(commandInfo=>{if(!this._eventRegistry.get(this.Event.Redo)&&!this._eventRegistry.get(this.Event.Undo)&&!this._eventRegistry.get(this.Event.CommandExecuted))return;const{id,type:propType,params}=commandInfo,eventParams={id,type:propType,params};switch(commandInfo.id){case RedoCommand.id:this.fireEvent(this.Event.Redo,eventParams);break;case UndoCommand.id:this.fireEvent(this.Event.Undo,eventParams);break;default:this.fireEvent(this.Event.CommandExecuted,eventParams);break}})),this._initUnitEvent(this._injector),this._injector.onDispose(()=>{this.dispose()})}static newAPI(wrapped){return(wrapped instanceof Univer?wrapped.__getInjector():wrapped).createInstance(exports.FUniver)}_ensureEventRegistry(event){return this._eventRegistry.has(event)||this._eventRegistry.set(event,new Registry),this._eventRegistry.get(event)}_initUnitEvent(injector){const univerInstanceService=injector.get(IUniverInstanceService);this.disposeWithMe(univerInstanceService.unitDisposed$.subscribe(unit=>{this._eventRegistry.get(this.Event.DocDisposed)&&unit.type===_.UNIVER_DOC&&this.fireEvent(this.Event.DocDisposed,{unitId:unit.getUnitId(),unitType:unit.type,snapshot:unit.getSnapshot()})})),this.disposeWithMe(univerInstanceService.unitAdded$.subscribe(unit=>{if(this._eventRegistry.get(this.Event.DocCreated)&&unit.type===_.UNIVER_DOC){const doc=unit,docUnit=injector.createInstance(FDoc,doc);this.fireEvent(this.Event.DocCreated,{unitId:unit.getUnitId(),type:unit.type,doc:docUnit,unit:docUnit})}}))}_eventListend(key){return this._eventRegistry.get(key)}disposeUnit(unitId){return this._univerInstanceService.disposeUnit(unitId)}getCurrentLifecycleStage(){return this._injector.get(exports.LifecycleService).stage}undo(){return this._commandService.executeCommand(UndoCommand.id)}redo(){return this._commandService.executeCommand(RedoCommand.id)}onBeforeCommandExecute(callback){return this._commandService.beforeCommandExecuted((command,options)=>{callback(command,options)})}onCommandExecuted(callback){return this._commandService.onCommandExecuted((command,options)=>{callback(command,options)})}executeCommand(id,params,options){return this._commandService.executeCommand(id,params,options)}syncExecuteCommand(id,params,options){return this._commandService.syncExecuteCommand(id,params,options)}getHooks(){return this._injector.createInstance(exports.FHooks)}get Enum(){return FEnum.get()}get Event(){return FEventName.get()}get Util(){return FUtil.get()}addEvent(event,callback){return this._ensureEventRegistry(event).add(callback),toDisposable(()=>this._ensureEventRegistry(event).delete(callback))}fireEvent(event,params){var _a17;return(_a17=this._eventRegistry.get(event))==null||_a17.getData().forEach(callback=>{callback(params)}),params.cancel}hasEventCallback(event){var _a17,_b2;return((_b2=(_a17=this._eventRegistry.get(event))==null?void 0:_a17.getData().length)!=null?_b2:0)>0}getUserManager(){return this._injector.createInstance(FUserManager)}newBlob(){return this._injector.createInstance(exports.FBlob)}newColor(){return new ColorBuilder}newRichText(data){return RichTextBuilder.create(data)}newRichTextValue(data){return RichTextValue.create(data)}newParagraphStyle(style){return ParagraphStyleBuilder.create(style)}newParagraphStyleValue(style){return ParagraphStyleValue.create(style)}newTextStyle(style){return TextStyleBuilder.create(style)}newTextStyleValue(style){return TextStyleValue.create(style)}newTextDecoration(decoration){return new TextDecorationBuilder(decoration)}},__name(_a16,"FUniver"),_a16);exports.FUniver=__decorateClass([__decorateParam(0,Inject(Injector)),__decorateParam(1,ICommandService),__decorateParam(2,IUniverInstanceService),__decorateParam(3,Inject(exports.LifecycleService))],exports.FUniver);function isNumeric(str){return/^-?\d+(\.\d+)?$/.test(str)}__name(isNumeric,"isNumeric");function isSafeNumeric(str){return isNumeric(str)?Number(str)<=Number.MAX_SAFE_INTEGER:!1}__name(isSafeNumeric,"isSafeNumeric");function requestImmediateMacroTask(callback){const channel=new MessageChannel;let cancelled=!1;const hanlder=__name(()=>{cancelled||callback()},"hanlder");return channel.port1.onmessage=hanlder,channel.port2.postMessage(null),()=>{cancelled=!0,channel.port1.close(),channel.port2.close()}}__name(requestImmediateMacroTask,"requestImmediateMacroTask");function mergeSets(s1,s2){return s2.forEach(s=>s1.add(s)),s1}__name(mergeSets,"mergeSets");function replaceInDocumentBody(body,query,target,caseSensitive){var _a17;if(query==="")return body;const mockDocumentData={id:"mock-id",body,documentStyle:{}},documentDataModel=new DocumentDataModel(mockDocumentData),queryLen=query.length;let index2;for(;(index2=(caseSensitive?documentDataModel.getBody().dataStream:documentDataModel.getBody().dataStream.toLowerCase()).indexOf(query))>=0;){const textX=new TextX,jsonX=JSONX.getInstance();if(index2>0&&textX.retain(index2),target.length>0){const sliceBody=documentDataModel.sliceBody(index2,index2+queryLen),replaceBody={dataStream:target};if(Array.isArray(sliceBody==null?void 0:sliceBody.textRuns)&&sliceBody.textRuns.length&&(replaceBody.textRuns=[{...sliceBody.textRuns[0],st:0,ed:target.length}]),(_a17=sliceBody==null?void 0:sliceBody.customRanges)!=null&&_a17.length){const customRange=sliceBody.customRanges[0];replaceBody.customRanges=[{...customRange,startIndex:0,endIndex:target.length-1}]}textX.insert(target.length,replaceBody)}textX.delete(queryLen),documentDataModel.apply(jsonX.editOp(textX.serialize()))}const newBody=documentDataModel.getBody();return documentDataModel.dispose(),newBody}__name(replaceInDocumentBody,"replaceInDocumentBody");const DEFAULT_DOCUMENT_SUB_COMPONENT_ID="__default_document_sub_component_id20231101__",_EventState=class _EventState{constructor(){__publicField(this,"skipNextObservers",!1);__publicField(this,"lastReturnValue");__publicField(this,"isStopPropagation",!1)}stopPropagation(){this.isStopPropagation=!0}};__name(_EventState,"EventState");let EventState=_EventState;const _EventSubject=class _EventSubject extends rxjs.Subject{constructor(){super(...arguments);__publicField(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(observer){let ob;typeof observer=="function"?ob={next:__name(([evt,state])=>observer(evt,state),"next")}:ob=observer;const subscription=super.subscribe(ob);return this._sortedObservers.push(ob),this._sortedObservers.sort((a,b)=>{var _a17,_b2;return((_a17=a.priority)!=null?_a17:0)-((_b2=b.priority)!=null?_b2:0)}),subscription.add(()=>this._sortedObservers=this._sortedObservers.filter(o=>o!==ob)),subscription}clearObservers(){this._sortedObservers.forEach(observer=>{var _a17;return(_a17=observer.complete)==null?void 0:_a17.call(observer)}),this._sortedObservers.length=0}emitEvent(event){var _a17;if(!this.closed){const state=new EventState;state.lastReturnValue=event;for(const observer of this._sortedObservers){const value=(_a17=observer.next)==null?void 0:_a17.call(observer,[event,state]);if(state.lastReturnValue=value,state.skipNextObservers)return{handled:!0,lastReturnValue:state.lastReturnValue,stopPropagation:state.isStopPropagation}}return{handled:this._sortedObservers.length>0,lastReturnValue:state.lastReturnValue,stopPropagation:state.isStopPropagation}}throw new Error("[EventSubject]: cannot emit event on a closed subject.")}};__name(_EventSubject,"EventSubject");let EventSubject=_EventSubject;function fromEventSubject(subject$){return new rxjs.Observable(subscriber=>{const ob=subject$.subscribeEvent(evt=>{subscriber.next(evt)});return()=>ob.unsubscribe()})}__name(fromEventSubject,"fromEventSubject");const ILocalStorageService=createIdentifier("ILocalStorageService");function nameCharacterCheck(name){return!(name.length===0||name.length>31||name.startsWith("'")||name.endsWith("'")||/[:\\\/\?\*\[\]]/.test(name))}__name(nameCharacterCheck,"nameCharacterCheck");function awaitTime(ms){return new Promise(resolve=>setTimeout(resolve,ms))}__name(awaitTime,"awaitTime");function delayAnimationFrame(frames=1){return new Promise(resolve=>{let count=0;const callback=__name(()=>{count++,count>=frames?resolve():requestAnimationFrame(callback)},"callback");requestAnimationFrame(callback)})}__name(delayAnimationFrame,"delayAnimationFrame");var ImageSourceType=(ImageSourceType2=>(ImageSourceType2.URL="URL",ImageSourceType2.UUID="UUID",ImageSourceType2.BASE64="BASE64",ImageSourceType2))(ImageSourceType||{}),ImageUploadStatusType=(ImageUploadStatusType2=>(ImageUploadStatusType2.SUCCUSS="0",ImageUploadStatusType2.ERROR_EXCEED_SIZE="1",ImageUploadStatusType2.ERROR_IMAGE_TYPE="2",ImageUploadStatusType2.ERROR_UPLOAD_COUNT_LIMIT="3",ImageUploadStatusType2.ERROR_IMAGE="4",ImageUploadStatusType2))(ImageUploadStatusType||{});const IImageIoService=createIdentifier("core.image-io.service"),_ImageCacheMap=class _ImageCacheMap{constructor(_injector,maxSize=100){__publicField(this,"_imageCacheMap");this._injector=_injector,this._imageCacheMap=new LRUMap(maxSize)}_getImageCacheKey(imageSourceType,source){return`${imageSourceType}-${source}`}getImage(imageSourceType,source,onLoad,onError){const imageCacheKey=this._getImageCacheKey(imageSourceType,source);let imageElement=this._imageCacheMap.get(imageCacheKey);return imageElement||((async()=>{imageElement=new Image;const imageIoService=this._injector.has(IImageIoService)?this._injector.get(IImageIoService):null;if(imageSourceType===ImageSourceType.UUID)try{imageElement.src=await(imageIoService==null?void 0:imageIoService.getImage(source))||""}catch(error){console.error(error)}else imageElement.src=source;imageElement.onload=()=>{onLoad==null||onLoad()},imageElement.onerror=()=>{onError==null||onError()},this._imageCacheMap.set(imageCacheKey,imageElement)})(),null)}};__name(_ImageCacheMap,"ImageCacheMap");let ImageCacheMap=_ImageCacheMap;const skipParseTagNames=["script","style","meta","comment","link"];var DataValidationImeMode=(DataValidationImeMode2=>(DataValidationImeMode2[DataValidationImeMode2.DISABLED=0]="DISABLED",DataValidationImeMode2[DataValidationImeMode2.FULL_ALPHA=1]="FULL_ALPHA",DataValidationImeMode2[DataValidationImeMode2.FULL_HANGUL=2]="FULL_HANGUL",DataValidationImeMode2[DataValidationImeMode2.FULL_KATAKANA=3]="FULL_KATAKANA",DataValidationImeMode2[DataValidationImeMode2.HALF_ALPHA=4]="HALF_ALPHA",DataValidationImeMode2[DataValidationImeMode2.HALF_HANGUL=5]="HALF_HANGUL",DataValidationImeMode2[DataValidationImeMode2.HALF_KATAKANA=6]="HALF_KATAKANA",DataValidationImeMode2[DataValidationImeMode2.HIRAGANA=7]="HIRAGANA",DataValidationImeMode2[DataValidationImeMode2.NO_CONTROL=8]="NO_CONTROL",DataValidationImeMode2[DataValidationImeMode2.OFF=9]="OFF",DataValidationImeMode2[DataValidationImeMode2.ON=10]="ON",DataValidationImeMode2))(DataValidationImeMode||{});const ARRAY_TYPES=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],VERSION=1,HEADER_SIZE=8,_KDBush=class _KDBush{static from(data){if(!(data instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[magic,versionAndType]=new Uint8Array(data,0,2);if(magic!==219)throw new Error("Data does not appear to be in a KDBush format.");const version2=versionAndType>>4;if(version2!==VERSION)throw new Error(`Got v${version2} data when expected v${VERSION}.`);const ArrayType=ARRAY_TYPES[versionAndType&15];if(!ArrayType)throw new Error("Unrecognized array type.");const[nodeSize]=new Uint16Array(data,2,1),[numItems]=new Uint32Array(data,4,1);return new _KDBush(numItems,nodeSize,ArrayType,data)}constructor(numItems,nodeSize=64,ArrayType=Float64Array,data){if(isNaN(numItems)||numItems<0)throw new Error(`Unpexpected numItems value: ${numItems}.`);this.numItems=+numItems,this.nodeSize=Math.min(Math.max(+nodeSize,2),65535),this.ArrayType=ArrayType,this.IndexArrayType=numItems<65536?Uint16Array:Uint32Array;const arrayTypeIndex=ARRAY_TYPES.indexOf(this.ArrayType),coordsByteSize=numItems*2*this.ArrayType.BYTES_PER_ELEMENT,idsByteSize=numItems*this.IndexArrayType.BYTES_PER_ELEMENT,padCoords=(8-idsByteSize%8)%8;if(arrayTypeIndex<0)throw new Error(`Unexpected typed array class: ${ArrayType}.`);data&&data instanceof ArrayBuffer?(this.data=data,this.ids=new this.IndexArrayType(this.data,HEADER_SIZE,numItems),this.coords=new this.ArrayType(this.data,HEADER_SIZE+idsByteSize+padCoords,numItems*2),this._pos=numItems*2,this._finished=!0):(this.data=new ArrayBuffer(HEADER_SIZE+coordsByteSize+idsByteSize+padCoords),this.ids=new this.IndexArrayType(this.data,HEADER_SIZE,numItems),this.coords=new this.ArrayType(this.data,HEADER_SIZE+idsByteSize+padCoords,numItems*2),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,(VERSION<<4)+arrayTypeIndex]),new Uint16Array(this.data,2,1)[0]=nodeSize,new Uint32Array(this.data,4,1)[0]=numItems)}add(x,y){const index2=this._pos>>1;return this.ids[index2]=index2,this.coords[this._pos++]=x,this.coords[this._pos++]=y,index2}finish(){const numAdded=this._pos>>1;if(numAdded!==this.numItems)throw new Error(`Added ${numAdded} items when expected ${this.numItems}.`);return sort(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(minX,minY,maxX,maxY){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids,coords,nodeSize}=this,stack=[0,ids.length-1,0],result=[];for(;stack.length;){const axis=stack.pop()||0,right=stack.pop()||0,left=stack.pop()||0;if(right-left<=nodeSize){for(let i=left;i<=right;i++){const x2=coords[2*i],y2=coords[2*i+1];x2>=minX&&x2<=maxX&&y2>=minY&&y2<=maxY&&result.push(ids[i])}continue}const m=left+right>>1,x=coords[2*m],y=coords[2*m+1];x>=minX&&x<=maxX&&y>=minY&&y<=maxY&&result.push(ids[m]),(axis===0?minX<=x:minY<=y)&&(stack.push(left),stack.push(m-1),stack.push(1-axis)),(axis===0?maxX>=x:maxY>=y)&&(stack.push(m+1),stack.push(right),stack.push(1-axis))}return result}within(qx,qy,r){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids,coords,nodeSize}=this,stack=[0,ids.length-1,0],result=[],r2=r*r;for(;stack.length;){const axis=stack.pop()||0,right=stack.pop()||0,left=stack.pop()||0;if(right-left<=nodeSize){for(let i=left;i<=right;i++)sqDist(coords[2*i],coords[2*i+1],qx,qy)<=r2&&result.push(ids[i]);continue}const m=left+right>>1,x=coords[2*m],y=coords[2*m+1];sqDist(x,y,qx,qy)<=r2&&result.push(ids[m]),(axis===0?qx-r<=x:qy-r<=y)&&(stack.push(left),stack.push(m-1),stack.push(1-axis)),(axis===0?qx+r>=x:qy+r>=y)&&(stack.push(m+1),stack.push(right),stack.push(1-axis))}return result}};__name(_KDBush,"KDBush");let KDBush=_KDBush;function sort(ids,coords,nodeSize,left,right,axis){if(right-left<=nodeSize)return;const m=left+right>>1;select(ids,coords,m,left,right,axis),sort(ids,coords,nodeSize,left,m-1,1-axis),sort(ids,coords,nodeSize,m+1,right,1-axis)}__name(sort,"sort");function select(ids,coords,k,left,right,axis){for(;right>left;){if(right-left>600){const n=right-left+1,m=k-left+1,z=Math.log(n),s=.5*Math.exp(2*z/3),sd=.5*Math.sqrt(z*s*(n-s)/n)*(m-n/2<0?-1:1),newLeft=Math.max(left,Math.floor(k-m*s/n+sd)),newRight=Math.min(right,Math.floor(k+(n-m)*s/n+sd));select(ids,coords,k,newLeft,newRight,axis)}const t=coords[2*k+axis];let i=left,j=right;for(swapItem(ids,coords,left,k),coords[2*right+axis]>t&&swapItem(ids,coords,left,right);i<j;){for(swapItem(ids,coords,i,j),i++,j--;coords[2*i+axis]<t;)i++;for(;coords[2*j+axis]>t;)j--}coords[2*left+axis]===t?swapItem(ids,coords,left,j):(j++,swapItem(ids,coords,j,right)),j<=k&&(left=j+1),k<=j&&(right=j-1)}}__name(select,"select");function swapItem(ids,coords,i,j){swap$1(ids,i,j),swap$1(coords,2*i,2*j),swap$1(coords,2*i+1,2*j+1)}__name(swapItem,"swapItem");function swap$1(arr,i,j){const tmp=arr[i];arr[i]=arr[j],arr[j]=tmp}__name(swap$1,"swap$1");function sqDist(ax,ay,bx,by){const dx=ax-bx,dy=ay-by;return dx*dx+dy*dy}__name(sqDist,"sqDist");function quickselect(arr,k,left=0,right=arr.length-1,compare=defaultCompare){for(;right>left;){if(right-left>600){const n=right-left+1,m=k-left+1,z=Math.log(n),s=.5*Math.exp(2*z/3),sd=.5*Math.sqrt(z*s*(n-s)/n)*(m-n/2<0?-1:1),newLeft=Math.max(left,Math.floor(k-m*s/n+sd)),newRight=Math.min(right,Math.floor(k+(n-m)*s/n+sd));quickselect(arr,k,newLeft,newRight,compare)}const t=arr[k];let i=left,j=right;for(swap(arr,left,k),compare(arr[right],t)>0&&swap(arr,left,right);i<j;){for(swap(arr,i,j),i++,j--;compare(arr[i],t)<0;)i++;for(;compare(arr[j],t)>0;)j--}compare(arr[left],t)===0?swap(arr,left,j):(j++,swap(arr,j,right)),j<=k&&(left=j+1),k<=j&&(right=j-1)}}__name(quickselect,"quickselect");function swap(arr,i,j){const tmp=arr[i];arr[i]=arr[j],arr[j]=tmp}__name(swap,"swap");function defaultCompare(a,b){return a<b?-1:a>b?1:0}__name(defaultCompare,"defaultCompare");const _RBush=class _RBush{constructor(maxEntries=9){this._maxEntries=Math.max(4,maxEntries),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(bbox){let node=this.data;const result=[];if(!intersects(bbox,node))return result;const toBBox=this.toBBox,nodesToSearch=[];for(;node;){for(let i=0;i<node.children.length;i++){const child=node.children[i],childBBox=node.leaf?toBBox(child):child;intersects(bbox,childBBox)&&(node.leaf?result.push(child):contains(bbox,childBBox)?this._all(child,result):nodesToSearch.push(child))}node=nodesToSearch.pop()}return result}collides(bbox){let node=this.data;if(!intersects(bbox,node))return!1;const nodesToSearch=[];for(;node;){for(let i=0;i<node.children.length;i++){const child=node.children[i],childBBox=node.leaf?this.toBBox(child):child;if(intersects(bbox,childBBox)){if(node.leaf||contains(bbox,childBBox))return!0;nodesToSearch.push(child)}}node=nodesToSearch.pop()}return!1}load(data){if(!(data&&data.length))return this;if(data.length<this._minEntries){for(let i=0;i<data.length;i++)this.insert(data[i]);return this}let node=this._build(data.slice(),0,data.length-1,0);if(!this.data.children.length)this.data=node;else if(this.data.height===node.height)this._splitRoot(this.data,node);else{if(this.data.height<node.height){const tmpNode=this.data;this.data=node,node=tmpNode}this._insert(node,this.data.height-node.height-1,!0)}return this}insert(item){return item&&this._insert(item,this.data.height-1),this}clear(){return this.data=createNode([]),this}remove(item,equalsFn){if(!item)return this;let node=this.data;const bbox=this.toBBox(item),path=[],indexes=[];let i,parent,goingUp;for(;node||path.length;){if(node||(node=path.pop(),parent=path[path.length-1],i=indexes.pop(),goingUp=!0),node.leaf){const index2=findItem(item,node.children,equalsFn);if(index2!==-1)return node.children.splice(index2,1),path.push(node),this._condense(path),this}!goingUp&&!node.leaf&&contains(node,bbox)?(path.push(node),indexes.push(i),i=0,parent=node,node=node.children[0]):parent?(i++,node=parent.children[i],goingUp=!1):node=null}return this}toBBox(item){return item}compareMinX(a,b){return a.minX-b.minX}compareMinY(a,b){return a.minY-b.minY}toJSON(){return this.data}fromJSON(data){return this.data=data,this}_all(node,result){const nodesToSearch=[];for(;node;)node.leaf?result.push(...node.children):nodesToSearch.push(...node.children),node=nodesToSearch.pop();return result}_build(items,left,right,height){const N=right-left+1;let M2=this._maxEntries,node;if(N<=M2)return node=createNode(items.slice(left,right+1)),calcBBox(node,this.toBBox),node;height||(height=Math.ceil(Math.log(N)/Math.log(M2)),M2=Math.ceil(N/Math.pow(M2,height-1))),node=createNode([]),node.leaf=!1,node.height=height;const N2=Math.ceil(N/M2),N1=N2*Math.ceil(Math.sqrt(M2));multiSelect(items,left,right,N1,this.compareMinX);for(let i=left;i<=right;i+=N1){const right2=Math.min(i+N1-1,right);multiSelect(items,i,right2,N2,this.compareMinY);for(let j=i;j<=right2;j+=N2){const right3=Math.min(j+N2-1,right2);node.children.push(this._build(items,j,right3,height-1))}}return calcBBox(node,this.toBBox),node}_chooseSubtree(bbox,node,level,path){for(;path.push(node),!(node.leaf||path.length-1===level);){let minArea=1/0,minEnlargement=1/0,targetNode;for(let i=0;i<node.children.length;i++){const child=node.children[i],area=bboxArea(child),enlargement=enlargedArea(bbox,child)-area;enlargement<minEnlargement?(minEnlargement=enlargement,minArea=area<minArea?area:minArea,targetNode=child):enlargement===minEnlargement&&area<minArea&&(minArea=area,targetNode=child)}node=targetNode||node.children[0]}return node}_insert(item,level,isNode2){const bbox=isNode2?item:this.toBBox(item),insertPath=[],node=this._chooseSubtree(bbox,this.data,level,insertPath);for(node.children.push(item),extend(node,bbox);level>=0&&insertPath[level].children.length>this._maxEntries;)this._split(insertPath,level),level--;this._adjustParentBBoxes(bbox,insertPath,level)}_split(insertPath,level){const node=insertPath[level],M2=node.children.length,m=this._minEntries;this._chooseSplitAxis(node,m,M2);const splitIndex=this._chooseSplitIndex(node,m,M2),newNode=createNode(node.children.splice(splitIndex,node.children.length-splitIndex));newNode.height=node.height,newNode.leaf=node.leaf,calcBBox(node,this.toBBox),calcBBox(newNode,this.toBBox),level?insertPath[level-1].children.push(newNode):this._splitRoot(node,newNode)}_splitRoot(node,newNode){this.data=createNode([node,newNode]),this.data.height=node.height+1,this.data.leaf=!1,calcBBox(this.data,this.toBBox)}_chooseSplitIndex(node,m,M2){let index2,minOverlap=1/0,minArea=1/0;for(let i=m;i<=M2-m;i++){const bbox1=distBBox(node,0,i,this.toBBox),bbox2=distBBox(node,i,M2,this.toBBox),overlap=intersectionArea(bbox1,bbox2),area=bboxArea(bbox1)+bboxArea(bbox2);overlap<minOverlap?(minOverlap=overlap,index2=i,minArea=area<minArea?area:minArea):overlap===minOverlap&&area<minArea&&(minArea=area,index2=i)}return index2||M2-m}_chooseSplitAxis(node,m,M2){const compareMinX=node.leaf?this.compareMinX:compareNodeMinX,compareMinY=node.leaf?this.compareMinY:compareNodeMinY,xMargin=this._allDistMargin(node,m,M2,compareMinX),yMargin=this._allDistMargin(node,m,M2,compareMinY);xMargin<yMargin&&node.children.sort(compareMinX)}_allDistMargin(node,m,M2,compare){node.children.sort(compare);const toBBox=this.toBBox,leftBBox=distBBox(node,0,m,toBBox),rightBBox=distBBox(node,M2-m,M2,toBBox);let margin=bboxMargin(leftBBox)+bboxMargin(rightBBox);for(let i=m;i<M2-m;i++){const child=node.children[i];extend(leftBBox,node.leaf?toBBox(child):child),margin+=bboxMargin(leftBBox)}for(let i=M2-m-1;i>=m;i--){const child=node.children[i];extend(rightBBox,node.leaf?toBBox(child):child),margin+=bboxMargin(rightBBox)}return margin}_adjustParentBBoxes(bbox,path,level){for(let i=level;i>=0;i--)extend(path[i],bbox)}_condense(path){for(let i=path.length-1,siblings;i>=0;i--)path[i].children.length===0?i>0?(siblings=path[i-1].children,siblings.splice(siblings.indexOf(path[i]),1)):this.clear():calcBBox(path[i],this.toBBox)}};__name(_RBush,"RBush");let RBush=_RBush;function findItem(item,items,equalsFn){if(!equalsFn)return items.indexOf(item);for(let i=0;i<items.length;i++)if(equalsFn(item,items[i]))return i;return-1}__name(findItem,"findItem");function calcBBox(node,toBBox){distBBox(node,0,node.children.length,toBBox,node)}__name(calcBBox,"calcBBox");function distBBox(node,k,p,toBBox,destNode){destNode||(destNode=createNode(null)),destNode.minX=1/0,destNode.minY=1/0,destNode.maxX=-1/0,destNode.maxY=-1/0;for(let i=k;i<p;i++){const child=node.children[i];extend(destNode,node.leaf?toBBox(child):child)}return destNode}__name(distBBox,"distBBox");function extend(a,b){return a.minX=Math.min(a.minX,b.minX),a.minY=Math.min(a.minY,b.minY),a.maxX=Math.max(a.maxX,b.maxX),a.maxY=Math.max(a.maxY,b.maxY),a}__name(extend,"extend");function compareNodeMinX(a,b){return a.minX-b.minX}__name(compareNodeMinX,"compareNodeMinX");function compareNodeMinY(a,b){return a.minY-b.minY}__name(compareNodeMinY,"compareNodeMinY");function bboxArea(a){return(a.maxX-a.minX)*(a.maxY-a.minY)}__name(bboxArea,"bboxArea");function bboxMargin(a){return a.maxX-a.minX+(a.maxY-a.minY)}__name(bboxMargin,"bboxMargin");function enlargedArea(a,b){return(Math.max(b.maxX,a.maxX)-Math.min(b.minX,a.minX))*(Math.max(b.maxY,a.maxY)-Math.min(b.minY,a.minY))}__name(enlargedArea,"enlargedArea");function intersectionArea(a,b){const minX=Math.max(a.minX,b.minX),minY=Math.max(a.minY,b.minY),maxX=Math.min(a.maxX,b.maxX),maxY=Math.min(a.maxY,b.maxY);return Math.max(0,maxX-minX)*Math.max(0,maxY-minY)}__name(intersectionArea,"intersectionArea");function contains(a,b){return a.minX<=b.minX&&a.minY<=b.minY&&b.maxX<=a.maxX&&b.maxY<=a.maxY}__name(contains,"contains");function intersects(a,b){return b.minX<=a.maxX&&b.minY<=a.maxY&&b.maxX>=a.minX&&b.maxY>=a.minY}__name(intersects,"intersects");function createNode(children){return{children,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}__name(createNode,"createNode");function multiSelect(arr,left,right,n,compare){const stack=[left,right];for(;stack.length;){if(right=stack.pop(),left=stack.pop(),right-left<=n)continue;const mid=left+Math.ceil((right-left)/n/2)*n;quickselect(arr,mid,left,right,compare),stack.push(left,mid,mid,right)}}__name(multiSelect,"multiSelect");const _RTree=class _RTree{constructor(_enableOneCellCache=!1){__publicField(this,"_tree",new Map);__publicField(this,"_oneCellCache",new Map);__publicField(this,"_kdTree",new Map);this._enableOneCellCache=_enableOneCellCache}dispose(){this.clear()}getTree(unitId,subUnitId){return this._tree.has(unitId)||this._tree.set(unitId,new Map),this._tree.get(unitId).has(subUnitId)||this._tree.get(unitId).set(subUnitId,new RBush),this._tree.get(unitId).get(subUnitId)}_getOneCellCache(unitId,subUnitId,row,column){return this._oneCellCache.has(unitId)||this._oneCellCache.set(unitId,new Map),this._oneCellCache.get(unitId).has(subUnitId)||this._oneCellCache.get(unitId).set(subUnitId,new Map),this._oneCellCache.get(unitId).get(subUnitId).has(row)||this._oneCellCache.get(unitId).get(subUnitId).set(row,new Map),this._oneCellCache.get(unitId).get(subUnitId).get(row).has(column)||this._oneCellCache.get(unitId).get(subUnitId).get(row).set(column,new Set),this._oneCellCache.get(unitId).get(subUnitId).get(row).get(column)}_removeOneCellCache(unitId,subUnitId,row,column,id){const unitCache=this._oneCellCache.get(unitId);if(!unitCache)return;const subUnitCache=unitCache.get(subUnitId);if(!subUnitCache)return;const rowCache=subUnitCache.get(row);if(!rowCache)return;const cellCache=rowCache.get(column);cellCache&&cellCache.delete(id)}_removeCellCacheByRange(search){const{unitId,sheetId:subUnitId,range,id}=search,unitCache=this._oneCellCache.get(unitId);if(!unitCache)return;const subUnitCache=unitCache.get(subUnitId);if(!subUnitCache)return;const{startRow,startColumn,endRow,endColumn}=range;for(let row=startRow;row<=endRow;row++){const rowCache=subUnitCache.get(row);if(rowCache)for(let column=startColumn;column<=endColumn;column++){const cellCache=rowCache.get(column);cellCache&&cellCache.delete(id)}}}_insertOneCellCache(unitId,subUnitId,row,column,id){this._getOneCellCache(unitId,subUnitId,row,column).add(id)}_getRdTreeItems(map){const items=[];for(const[y,innerMap]of map)for(const[x,ids]of innerMap)items.push({x,y,ids});return items}_searchByOneCellCache(search){var _a17;const{unitId,sheetId:subUnitId,range}=search,{startRow,startColumn,endRow,endColumn}=range,searchObject=(_a17=this._kdTree.get(unitId))==null?void 0:_a17.get(subUnitId);if(!searchObject)return[];const{tree,items}=searchObject,indexes=tree.range(startColumn,startRow,endColumn,endRow),result=[];for(const index2 of indexes){const item=items[index2];result.push(...Array.from(item.ids))}return result}openKdTree(){var _a17;for(const[unitId,map1]of this._oneCellCache){this._kdTree.has(unitId)||this._kdTree.set(unitId,new Map);for(const[subUnitId,map2]of map1){const items=this._getRdTreeItems(map2),tree=new KDBush(items.length);(_a17=this._kdTree.get(unitId))==null||_a17.set(subUnitId,{tree,items});for(const item of items)tree.add(item.x,item.y);tree.finish()}}}closeKdTree(){var _a17;for(const[unitId,map1]of this._oneCellCache)for(const[subUnitId,map2]of map1)(_a17=this._kdTree.get(unitId))==null||_a17.set(subUnitId,void 0)}insert(item){const{unitId,sheetId:subUnitId,range,id}=item;if(!unitId||unitId.length===0)return;let{startRow:rangeStartRow,endRow:rangeEndRow,startColumn:rangeStartColumn,endColumn:rangeEndColumn}=range;if(this._enableOneCellCache&&rangeStartRow===rangeEndRow&&rangeStartColumn===rangeEndColumn){this._insertOneCellCache(unitId,subUnitId,rangeStartRow,rangeStartColumn,id);return}const tree=this.getTree(unitId,subUnitId);Number.isNaN(rangeStartRow)&&(rangeStartRow=0),Number.isNaN(rangeStartColumn)&&(rangeStartColumn=0),Number.isNaN(rangeEndRow)&&(rangeEndRow=Number.POSITIVE_INFINITY),Number.isNaN(rangeEndColumn)&&(rangeEndColumn=Number.POSITIVE_INFINITY),tree.insert({minX:rangeStartColumn,minY:rangeStartRow,maxX:rangeEndColumn,maxY:rangeEndRow,id})}bulkInsert(items){for(const item of items)this.insert(item)}*searchGenerator(search){var _a17;const{unitId,sheetId:subUnitId,range}=search;if(this._enableOneCellCache){const oneCellResults=this._searchByOneCellCache(search);for(const result of oneCellResults)yield result}const tree=(_a17=this._tree.get(unitId))==null?void 0:_a17.get(subUnitId);if(!tree)return;const searchData=tree.search({minX:range.startColumn,minY:range.startRow,maxX:range.endColumn,maxY:range.endRow});for(const item of searchData)yield item.id}bulkSearch(searchList,exceptTreeIds){const result=new Set;for(const search of searchList)for(const item of this.searchGenerator(search))(exceptTreeIds==null?void 0:exceptTreeIds.has(item))!==!0&&result.add(item);return result}removeById(unitId,subUnitId){var _a17,_b2;subUnitId?((_a17=this._tree.get(unitId))==null||_a17.delete(subUnitId),(_b2=this._oneCellCache.get(unitId))==null||_b2.delete(subUnitId)):(this._tree.delete(unitId),this._oneCellCache.delete(unitId))}_removeRTreeItem(search){const{unitId,sheetId:subUnitId,range,id}=search,tree=this.getTree(unitId,subUnitId),items=tree.search({minX:range.startColumn,minY:range.startRow,maxX:range.endColumn,maxY:range.endRow});for(let i=0;i<items.length;i++)items[i].id===id&&tree.remove(items[i])}remove(search){const{unitId,sheetId:subUnitId,range,id}=search,{startRow,startColumn,endRow,endColumn}=range;this._enableOneCellCache?startRow===endRow&&startColumn===endColumn?this._removeOneCellCache(unitId,subUnitId,range.startRow,range.startColumn,id):(this._removeCellCacheByRange(search),this._removeRTreeItem(search)):this._removeRTreeItem(search)}bulkRemove(searchList){for(const search of searchList)this.remove(search)}clear(){this._tree.clear(),this._oneCellCache.clear()}toJSON(){const result={};return this._tree.forEach((subTree,unitId)=>{result[unitId]={},subTree.forEach((tree,subUnitId)=>{result[unitId][subUnitId]=tree.toJSON()})}),result}fromJSON(data){this._tree.clear();for(const unitId in data){this._tree.set(unitId,new Map);for(const subUnitId in data[unitId]){const tree=new RBush;tree.fromJSON(data[unitId][subUnitId]),this._tree.get(unitId).set(subUnitId,tree)}}}};__name(_RTree,"RTree");let RTree=_RTree;installShims();exports.ABCToNumber=ABCToNumber;exports.AUTO_HEIGHT_FOR_MERGED_CELLS=AUTO_HEIGHT_FOR_MERGED_CELLS;exports.AbsoluteRefType=AbsoluteRefType;exports.ActionIterator=ActionIterator;exports.AlignTypeH=AlignTypeH;exports.AlignTypeV=AlignTypeV;exports.ArrangeTypeEnum=ArrangeTypeEnum;exports.ArrowsAndMarkersShapes=ArrowsAndMarkersShapes;exports.AsyncInterceptorManager=AsyncInterceptorManager;exports.AutoFillSeries=AutoFillSeries;exports.BaselineOffset=BaselineOffset;exports.BasicShapes=BasicShapes;exports.BlockType=BlockType;exports.BooleanNumber=BooleanNumber;exports.BorderStyleTypes=BorderStyleTypes;exports.BorderType=BorderType;exports.BuildTextUtils=BuildTextUtils;exports.BulletAlignment=BulletAlignment;exports.COLORS=COLORS;exports.CanceledError=CanceledError;exports.CellModeEnum=CellModeEnum;exports.CellValueType=CellValueType;exports.Color=Color;exports.ColorBuilder=ColorBuilder;exports.ColorKit=ColorKit;exports.ColorType=ColorType;exports.ColumnSeparatorType=ColumnSeparatorType;exports.CommandType=CommandType;exports.CommonHideTypes=CommonHideTypes;exports.ConfigService=ConfigService;exports.ContextService=ContextService;exports.CopyPasteType=CopyPasteType;exports.CustomCommandExecutionError=CustomCommandExecutionError;exports.CustomDecorationType=CustomDecorationType;exports.CustomRangeType=CustomRangeType;exports.DEFAULT_CELL=DEFAULT_CELL;exports.DEFAULT_DOC=DEFAULT_DOC;exports.DEFAULT_DOCUMENT_SUB_COMPONENT_ID=DEFAULT_DOCUMENT_SUB_COMPONENT_ID;exports.DEFAULT_EMPTY_DOCUMENT_VALUE=DEFAULT_EMPTY_DOCUMENT_VALUE;exports.DEFAULT_RANGE=DEFAULT_RANGE;exports.DEFAULT_RANGE_ARRAY=DEFAULT_RANGE_ARRAY;exports.DEFAULT_SELECTION=DEFAULT_SELECTION;exports.DEFAULT_SLIDE=DEFAULT_SLIDE;exports.DEFAULT_STYLES=DEFAULT_STYLES;exports.DEFAULT_WORKSHEET_COLUMN_COUNT=DEFAULT_WORKSHEET_COLUMN_COUNT;exports.DEFAULT_WORKSHEET_COLUMN_COUNT_KEY=DEFAULT_WORKSHEET_COLUMN_COUNT_KEY;exports.DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT=DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT;exports.DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT_KEY=DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT_KEY;exports.DEFAULT_WORKSHEET_COLUMN_WIDTH=DEFAULT_WORKSHEET_COLUMN_WIDTH;exports.DEFAULT_WORKSHEET_COLUMN_WIDTH_KEY=DEFAULT_WORKSHEET_COLUMN_WIDTH_KEY;exports.DEFAULT_WORKSHEET_ROW_COUNT=DEFAULT_WORKSHEET_ROW_COUNT;exports.DEFAULT_WORKSHEET_ROW_COUNT_KEY=DEFAULT_WORKSHEET_ROW_COUNT_KEY;exports.DEFAULT_WORKSHEET_ROW_HEIGHT=DEFAULT_WORKSHEET_ROW_HEIGHT;exports.DEFAULT_WORKSHEET_ROW_HEIGHT_KEY=DEFAULT_WORKSHEET_ROW_HEIGHT_KEY;exports.DEFAULT_WORKSHEET_ROW_TITLE_WIDTH=DEFAULT_WORKSHEET_ROW_TITLE_WIDTH;exports.DEFAULT_WORKSHEET_ROW_TITLE_WIDTH_KEY=DEFAULT_WORKSHEET_ROW_TITLE_WIDTH_KEY;exports.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY=DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY;exports.DOCS_NORMAL_EDITOR_UNIT_ID_KEY=DOCS_NORMAL_EDITOR_UNIT_ID_KEY;exports.DOCS_ZEN_EDITOR_UNIT_ID_KEY=DOCS_ZEN_EDITOR_UNIT_ID_KEY;exports.DOC_RANGE_TYPE=DOC_RANGE_TYPE;exports.DashStyleType=DashStyleType;exports.DataStreamTreeNodeType=DataStreamTreeNodeType;exports.DataStreamTreeTokenType=DataStreamTreeTokenType;exports.DataValidationErrorStyle=DataValidationErrorStyle;exports.DataValidationImeMode=DataValidationImeMode;exports.DataValidationOperator=DataValidationOperator;exports.DataValidationRenderMode=DataValidationRenderMode;exports.DataValidationStatus=DataValidationStatus;exports.DataValidationType=DataValidationType;exports.DeleteDirection=DeleteDirection;exports.DependentOn=DependentOn;exports.DesktopLogService=DesktopLogService;exports.DeveloperMetadataVisibility=DeveloperMetadataVisibility;exports.Dimension=Dimension;exports.Direction=Direction;exports.Disposable=Disposable;exports.DisposableCollection=DisposableCollection;exports.DocStyleType=DocStyleType;exports.DocumentDataModel=DocumentDataModel;exports.DocumentFlavor=DocumentFlavor;exports.DrawingTypeEnum=DrawingTypeEnum;exports.EDITOR_ACTIVATED=EDITOR_ACTIVATED;exports.EXTENSION_NAMES=EXTENSION_NAMES;exports.ErrorService=ErrorService;exports.EventState=EventState;exports.EventSubject=EventSubject;exports.FBase=FBase;exports.FBaseInitialable=FBaseInitialable;exports.FEnum=FEnum;exports.FEventName=FEventName;exports.FOCUSING_COMMON_DRAWINGS=FOCUSING_COMMON_DRAWINGS;exports.FOCUSING_DOC=FOCUSING_DOC;exports.FOCUSING_EDITOR_BUT_HIDDEN=FOCUSING_EDITOR_BUT_HIDDEN;exports.FOCUSING_EDITOR_INPUT_FORMULA=FOCUSING_EDITOR_INPUT_FORMULA;exports.FOCUSING_EDITOR_STANDALONE=FOCUSING_EDITOR_STANDALONE;exports.FOCUSING_FX_BAR_EDITOR=FOCUSING_FX_BAR_EDITOR;exports.FOCUSING_PANEL_EDITOR=FOCUSING_PANEL_EDITOR;exports.FOCUSING_SHEET=FOCUSING_SHEET;exports.FOCUSING_SLIDE=FOCUSING_SLIDE;exports.FOCUSING_UNIT=FOCUSING_UNIT;exports.FOCUSING_UNIVER_EDITOR=FOCUSING_UNIVER_EDITOR;exports.FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE=FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE;exports.FORMULA_EDITOR_ACTIVATED=FORMULA_EDITOR_ACTIVATED;exports.FUtil=FUtil;exports.FollowNumberWithType=FollowNumberWithType;exports.FontItalic=FontItalic;exports.FontStyleType=FontStyleType;exports.FontWeight=FontWeight;exports.GridType=GridType;exports.HLSColor=HLSColor;exports.HorizontalAlign=HorizontalAlign;exports.IAuthzIoService=IAuthzIoService;exports.ICommandService=ICommandService;exports.IConfigService=IConfigService;exports.IContextService=IContextService;exports.IImageIoService=IImageIoService;exports.ILocalStorageService=ILocalStorageService;exports.ILogService=ILogService;exports.IMentionIOService=IMentionIOService;exports.IPermissionService=IPermissionService;exports.IResourceLoaderService=IResourceLoaderService;exports.IResourceManagerService=IResourceManagerService;exports.IS_ROW_STYLE_PRECEDE_COLUMN_STYLE=IS_ROW_STYLE_PRECEDE_COLUMN_STYLE;exports.IUndoRedoService=IUndoRedoService;exports.IUniverInstanceService=IUniverInstanceService;exports.ImageCacheMap=ImageCacheMap;exports.ImageSourceType=ImageSourceType;exports.ImageUploadStatusType=ImageUploadStatusType;exports.Inject=Inject;exports.Injector=Injector;exports.InterceptorEffectEnum=InterceptorEffectEnum;exports.InterceptorManager=InterceptorManager;exports.InterpolationPointType=InterpolationPointType;exports.JSON1=index$1;exports.JSONX=JSONX;exports.LRUHelper=LRUHelper;exports.LRUMap=LRUMap;exports.LifecycleStages=LifecycleStages;exports.ListGlyphType=ListGlyphType;exports.LocaleService=LocaleService;exports.LocaleType=LocaleType;exports.LogLevel=LogLevel;exports.MOVE_BUFFER_VALUE=MOVE_BUFFER_VALUE;exports.Many=Many;exports.MemoryCursor=MemoryCursor;exports.MentionType=MentionType;exports.NamedStyleType=NamedStyleType;exports.NilCommand=NilCommand;exports.NumberUnitType=NumberUnitType;exports.ObjectMatrix=ObjectMatrix;exports.ObjectRelativeFromH=ObjectRelativeFromH;exports.ObjectRelativeFromV=ObjectRelativeFromV;exports.Optional=Optional;exports.OtherShapes=OtherShapes;exports.PRESET_LIST_TYPE=PRESET_LIST_TYPE;exports.PageElementType=PageElementType;exports.PageOrientType=PageOrientType;exports.PageType=PageType;exports.ParagraphElementType=ParagraphElementType;exports.ParagraphStyleBuilder=ParagraphStyleBuilder;exports.ParagraphStyleValue=ParagraphStyleValue;exports.PermissionService=PermissionService;exports.PermissionStatus=PermissionStatus;exports.Plugin=Plugin;exports.PositionedObjectLayoutType=PositionedObjectLayoutType;exports.PresetListType=PresetListType;exports.ProtectionType=ProtectionType;exports.QuickListType=QuickListType;exports.QuickListTypeMap=QuickListTypeMap;exports.RANGE_DIRECTION=RANGE_DIRECTION;exports.RANGE_TYPE=RANGE_TYPE;exports.RBush=RBush;exports.RCDisposable=RCDisposable;exports.RGBA_PAREN=RGBA_PAREN;exports.RGB_PAREN=RGB_PAREN;exports.ROTATE_BUFFER_VALUE=ROTATE_BUFFER_VALUE;exports.RTree=RTree;exports.Range=Range;exports.Rectangle=Rectangle;exports.RediConsumer=RediConsumer;exports.RediContext=RediContext;exports.RediError=RediError;exports.RediProvider=RediProvider;exports.RedoCommand=RedoCommand;exports.RedoCommandId=RedoCommandId;exports.RefAlias=RefAlias;exports.Registry=Registry;exports.RegistryAsMap=RegistryAsMap;exports.RelativeDate=RelativeDate;exports.RelativeSlideLink=RelativeSlideLink;exports.ResourceManagerService=ResourceManagerService;exports.RgbColor=RgbColor;exports.RichTextBuilder=RichTextBuilder;exports.RichTextValue=RichTextValue;exports.RxDisposable=RxDisposable;exports.SHEET_EDITOR_UNITS=SHEET_EDITOR_UNITS;exports.SectionType=SectionType;exports.Self=Self;exports.SheetTypes=SheetTypes;exports.SheetViewModel=SheetViewModel;exports.SkipSelf=SkipSelf;exports.SliceBodyType=SliceBodyType;exports.SlideDataModel=SlideDataModel;exports.SpacingRule=SpacingRule;exports.SpecialShapes=SpecialShapes;exports.Styles=Styles;exports.THEME_COLORS=THEME_COLORS;exports.TabStopAlignment=TabStopAlignment;exports.TableAlignmentType=TableAlignmentType;exports.TableLayoutType=TableLayoutType;exports.TableRowHeightRule=TableRowHeightRule;exports.TableSizeType=TableSizeType;exports.TableTextWrapType=TableTextWrapType;exports.TextDecoration=TextDecoration;exports.TextDecorationBuilder=TextDecorationBuilder;exports.TextDirection=TextDirection;exports.TextDirectionType=TextDirectionType;exports.TextStyleBuilder=TextStyleBuilder;exports.TextStyleValue=TextStyleValue;exports.TextX=TextX;exports.TextXActionType=TextXActionType;exports.ThemeColor=ThemeColor;exports.ThemeColorType=ThemeColorType;exports.ThemeColors=ThemeColors;exports.ThemeService=ThemeService;exports.Tools=Tools;exports.UndoCommand=UndoCommand;exports.UndoCommandId=UndoCommandId;exports.UnitModel=UnitModel;exports.Univer=Univer;exports.UniverInstanceType=_;exports.UpdateDocsAttributeType=UpdateDocsAttributeType;exports.UserManagerService=UserManagerService;exports.VerticalAlign=VerticalAlign;exports.VerticalAlignmentType=VerticalAlignmentType;exports.WithDependency=WithDependency;exports.WithNew=WithNew;exports.Worksheet=Worksheet;exports.WrapStrategy=WrapStrategy;exports.WrapTextType=WrapTextType;exports.addLinkToDocumentModel=addLinkToDocumentModel;exports.afterInitApply=afterInitApply;exports.afterTime=afterTime;exports.awaitTime=awaitTime;exports.binSearchFirstGreaterThanTarget=binSearchFirstGreaterThanTarget;exports.binarySearchArray=binarySearchArray;exports.bufferDebounceTime=bufferDebounceTime;exports.cellToRange=cellToRange;exports.characterSpacingControlType=characterSpacingControlType;exports.checkForSubstrings=checkForSubstrings;exports.checkIfMove=checkIfMove;exports.checkParagraphHasBullet=checkParagraphHasBullet;exports.checkParagraphHasIndent=checkParagraphHasIndent;exports.checkParagraphHasIndentByStyle=checkParagraphHasIndentByStyle;exports.codeToBlob=codeToBlob;exports.composeBody=composeBody;exports.composeInterceptors=composeInterceptors;exports.composeStyles=composeStyles;exports.concatMatrixArray=concatMatrixArray;exports.connectDependencies=connectDependencies;exports.connectInjector=connectInjector;exports.convertBodyToHtml=convertBodyToHtml;exports.convertCellToRange=convertCellToRange;exports.covertTextRunToHtml=covertTextRunToHtml;exports.createAsyncInterceptorKey=createAsyncInterceptorKey;exports.createDefaultUser=createDefaultUser;exports.createDocumentModelWithStyle=createDocumentModelWithStyle;exports.createIdentifier=createIdentifier;exports.createInterceptorKey=createInterceptorKey;exports.createInternalEditorID=createInternalEditorID;exports.createRowColIter=createRowColIter;exports.dayjs=dayjs;exports.debounce=debounce;exports.dedupe=dedupe;exports.deepCompare=deepCompare;exports.delayAnimationFrame=delayAnimationFrame;exports.deleteContent=deleteContent;exports.extractPureTextFromCell=extractPureTextFromCell;exports.forwardRef=forwardRef;exports.fromCallback=fromCallback;exports.fromEventSubject=fromEventSubject;exports.fromObservable=fromObservable;exports.generateRandomId=generateRandomId;exports.get=get;exports.getArrayLength=getArrayLength;exports.getBodySlice=getBodySlice;exports.getBodySliceHtml=getBodySliceHtml;exports.getBorderStyleType=getBorderStyleType;exports.getCellInfoInMergeData=getCellInfoInMergeData;exports.getCellValueType=getCellValueType;exports.getColorStyle=getColorStyle;exports.getCustomBlockSlice=getCustomBlockSlice;exports.getCustomDecorationSlice=getCustomDecorationSlice;exports.getCustomRangeSlice=getCustomRangeSlice;exports.getDocsUpdateBody=getDocsUpdateBody;exports.getIntersectRange=getIntersectRange;exports.getOriginCellValue=getOriginCellValue;exports.getParagraphsSlice=getParagraphsSlice;exports.getReverseDirection=getReverseDirection;exports.getSectionBreakSlice=getSectionBreakSlice;exports.getTableSlice=getTableSlice;exports.getTextRunSlice=getTextRunSlice;exports.getWorksheetUID=getWorksheetUID;exports.groupBy=groupBy;exports.handleStyleToString=handleStyleToString;exports.hashAlgorithm=hashAlgorithm;exports.horizontalLineSegmentsSubtraction=horizontalLineSegmentsSubtraction;exports.insertMatrixArray=insertMatrixArray;exports.insertTextToContent=insertTextToContent;exports.isAsyncDependencyItem=isAsyncDependencyItem;exports.isAsyncHook=isAsyncHook;exports.isBlackColor=isBlackColor;exports.isBooleanString=isBooleanString;exports.isCellCoverable=isCellCoverable;exports.isCellV=isCellV;exports.isClassDependencyItem=isClassDependencyItem;exports.isCtor=isCtor;exports.isDisposable=isDisposable;exports.isEmptyCell=isEmptyCell;exports.isFactoryDependencyItem=isFactoryDependencyItem;exports.isFormulaId=isFormulaId;exports.isFormulaString=isFormulaString;exports.isICellData=isICellData;exports.isInternalEditorID=isInternalEditorID;exports.isNodeEnv=isNodeEnv;exports.isNotNullOrUndefined=isNotNullOrUndefined;exports.isNullCell=isNullCell;exports.isNumeric=isNumeric;exports.isRangesEqual=isRangesEqual;exports.isRealNum=isRealNum;exports.isSafeNumeric=isSafeNumeric;exports.isSameStyleTextRun=isSameStyleTextRun;exports.isUnitRangesEqual=isUnitRangesEqual;exports.isValidRange=isValidRange;exports.isValueDependencyItem=isValueDependencyItem;exports.isWhiteColor=isWhiteColor;exports.makeArray=makeArray;exports.makeCellRangeToRangeData=makeCellRangeToRangeData;exports.makeCellToSelection=makeCellToSelection;exports.makeCustomRangeStream=makeCustomRangeStream;exports.merge=merge;exports.mergeOverrideWithDependencies=mergeOverrideWithDependencies;exports.mergeSets=mergeSets;exports.mergeWith=mergeWith;exports.mergeWorksheetSnapshotWithDefault=mergeWorksheetSnapshotWithDefault;exports.mixinClass=mixinClass;exports.moveMatrixArray=moveMatrixArray;exports.moveRangeByOffset=moveRangeByOffset;exports.nameCharacterCheck=nameCharacterCheck;exports.normalizeBody=normalizeBody$1;exports.normalizeTextRuns=normalizeTextRuns;exports.numberToABC=numberToABC;exports.numberToListABC=numberToListABC;exports.numfmt=numfmt;exports.queryObjectMatrix=queryObjectMatrix;exports.registerDependencies=registerDependencies;exports.remove=remove;exports.repeatStringNumTimes=repeatStringNumTimes;exports.replaceInDocumentBody=replaceInDocumentBody;exports.requestImmediateMacroTask=requestImmediateMacroTask;exports.rotate=rotate;exports.searchArray=searchArray;exports.searchInOrderedArray=searchInOrderedArray;exports.selectionToArray=selectionToArray;exports.sequence=sequence;exports.sequenceAsync=sequenceAsync;exports.sequenceExecute=sequenceExecute;exports.sequenceExecuteAsync=sequenceExecuteAsync;exports.set=set;exports.setDependencies=setDependencies;exports.shallowEqual=shallowEqual;exports.skipParseTagNames=skipParseTagNames;exports.sliceMatrixArray=sliceMatrixArray;exports.sortRules=sortRules;exports.sortRulesByDesc=sortRulesByDesc;exports.sortRulesFactory=sortRulesFactory;exports.spliceArray=spliceArray;exports.splitIntoGrid=splitIntoGrid;exports.takeAfter=takeAfter;exports.textDiff=textDiff;exports.throttle=throttle;exports.toDisposable=toDisposable;exports.touchDependencies=touchDependencies;exports.updateAttributeByDelete=updateAttributeByDelete;exports.updateAttributeByInsert=updateAttributeByInsert;exports.useDependency=useDependency;exports.useDependencyContext=useDependencyContext;exports.useDependencyContextValue=useDependencyContextValue;exports.useDependencyValue=useDependencyValue;exports.useInjector=useInjector;exports.useObservable=useObservable;exports.useUpdateBinder=useUpdateBinder;