@univerjs/core 0.1.0-alpha.2 → 0.1.0-alpha.3

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.
Files changed (39) hide show
  1. package/README.md +1 -1
  2. package/lib/cjs/index.js +5 -5
  3. package/lib/es/index.js +2668 -2584
  4. package/lib/types/basics/plugin-holder.d.ts +30 -0
  5. package/lib/types/basics/univer-doc.d.ts +7 -11
  6. package/lib/types/basics/univer-sheet.d.ts +7 -21
  7. package/lib/types/basics/univer-slide.d.ts +6 -19
  8. package/lib/types/basics/univer.d.ts +18 -13
  9. package/lib/types/common/memory-cursor.d.ts +1 -0
  10. package/lib/types/common/shims.d.ts +16 -0
  11. package/lib/types/docs/data-model/index.d.ts +1 -0
  12. package/lib/types/docs/data-model/preset-list-type.d.ts +50 -0
  13. package/lib/types/index.d.ts +1 -0
  14. package/lib/types/plugin/plugin.d.ts +4 -3
  15. package/lib/types/services/command/command.service.d.ts +3 -3
  16. package/lib/types/services/log/log.service.d.ts +8 -6
  17. package/lib/types/shared/color/color-kit.d.ts +64 -0
  18. package/lib/types/shared/color/color.d.ts +17 -3
  19. package/lib/types/shared/common.d.ts +1 -3
  20. package/lib/types/shared/index.d.ts +1 -2
  21. package/lib/types/shared/locale.d.ts +1 -4
  22. package/lib/types/shared/object-matrix.d.ts +29 -28
  23. package/lib/types/shared/rectangle.d.ts +1 -0
  24. package/lib/types/shared/sort-rules.d.ts +2 -2
  25. package/lib/types/shared/tools.d.ts +0 -5
  26. package/lib/types/sheets/column-manager.d.ts +7 -8
  27. package/lib/types/sheets/range.d.ts +4 -4
  28. package/lib/types/sheets/row-manager.d.ts +7 -7
  29. package/lib/types/sheets/styles.d.ts +4 -6
  30. package/lib/types/sheets/workbook.d.ts +5 -3
  31. package/lib/types/sheets/worksheet.d.ts +1 -1
  32. package/lib/types/types/enum/text-style.d.ts +3 -3
  33. package/lib/types/types/interfaces/i-document-data.d.ts +3 -2
  34. package/lib/types/types/interfaces/i-range.d.ts +13 -11
  35. package/lib/types/types/interfaces/i-worksheet-data.d.ts +4 -5
  36. package/lib/umd/index.js +5 -5
  37. package/package.json +4 -4
  38. package/lib/types/shared/color/color-builder.d.ts +0 -35
  39. package/lib/types/shared/object-array.d.ts +0 -110
package/lib/cjs/index.js CHANGED
@@ -1,11 +1,11 @@
1
- "use strict";var sr=Object.defineProperty;var nr=(t,e,s)=>e in t?sr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s;var _=(t,e,s)=>(nr(t,typeof e!="symbol"?e+"":e,s),s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("@wendellhu/redi"),L=require("rxjs");class fe{constructor(){_(this,"_data",[])}static create(){return new fe}add(e){this._data.indexOf(e)>-1||this._data.push(e)}delete(e){const s=this._data.indexOf(e);this._data.splice(s,1)}getData(){return this._data}}class ge{constructor(){_(this,"_data",new Map)}static create(){return new ge}add(e,s){this._data.has(e)||this._data.set(e,s)}delete(e){this._data.delete(e)}getData(){return this._data}}var k=(t=>(t[t.Univer=0]="Univer",t[t.Doc=1]="Doc",t[t.Sheet=2]="Sheet",t[t.Slide=3]="Slide",t))(k||{});class Ze{constructor(e){_(this,"_name");this._name=e}onStarting(e){}onReady(){}onRendered(){}onSteady(){}onDestroy(){}getPluginName(){return this._name}}_(Ze,"type",0);class $t{constructor(){_(this,"plugins",[])}addPlugin(e){this.plugins.push(e)}removePlugins(){const e=this.plugins.slice();return this.plugins.length=0,e}forEachPlugin(e){this.plugins.forEach(e)}}class rr{constructor(){_(this,"pluginsRegisteredByBusiness",new Map)}registerPlugin(e,s){const n=e.type;this.pluginsRegisteredByBusiness.has(n)||this.pluginsRegisteredByBusiness.set(n,[]),this.pluginsRegisteredByBusiness.get(n).push({plugin:e,options:s})}getRegisterPlugins(e){return this.pluginsRegisteredByBusiness.get(e)||[]}}function y(t,e){const s=t.indexOf(e);return s>-1?(t.splice(s,1),!0):!1}function ir(t){const e=new Set,s=[];for(const n of t)e.has(n)||(e.add(n),s.push(n));return s}function or(t,e){for(let s=t.length-1;s>-1;s--){const n=t[s];if(e(n,s))return n}return null}async function qe(t){for(const[e,s]of t.entries())try{if(!await s())return{index:e,result:!1}}catch(n){return{index:e,result:!1,error:n}}return{result:!0,index:-1}}function ye(t){for(const[e,s]of t.entries())try{if(!s())return{index:e,result:!1}}catch(n){return{index:e,result:!1,error:n}}return{result:!0,index:-1}}var ne=function(t,e){return ne=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,n){s.__proto__=n}||function(s,n){for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(s[r]=n[r])},ne(t,e)};function Ee(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");ne(t,e);function s(){this.constructor=t}t.prototype=e===null?Object.create(e):(s.prototype=e.prototype,new s)}function Fe(t){var e=typeof Symbol=="function"&&Symbol.iterator,s=e&&t[e],n=0;if(s)return s.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Mt(t,e){var s=typeof Symbol=="function"&&t[Symbol.iterator];if(!s)return t;var n=s.call(t),r,i=[],o;try{for(;(e===void 0||e-- >0)&&!(r=n.next()).done;)i.push(r.value)}catch(c){o={error:c}}finally{try{r&&!r.done&&(s=n.return)&&s.call(n)}finally{if(o)throw o.error}}return i}function Tt(t,e,s){if(s||arguments.length===2)for(var n=0,r=e.length,i;n<r;n++)(i||!(n in e))&&(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))}function nt(t){return typeof t=="function"}function cr(t){var e=function(n){Error.call(n),n.stack=new Error().stack},s=t(e);return s.prototype=Object.create(Error.prototype),s.prototype.constructor=s,s}var qt=cr(function(t){return function(s){t(this),this.message=s?s.length+` errors occurred during unsubscription:
1
+ "use strict";var tr=Object.defineProperty;var er=(t,e,s)=>e in t?tr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s;var d=(t,e,s)=>(er(t,typeof e!="symbol"?e+"":e,s),s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("@wendellhu/redi"),N=require("rxjs"),sr=require("rxjs/operators");function nr(){rr()}const Lt=typeof global<"u"?global:typeof self<"u"?self:window;function rr(){typeof Lt.requestIdleCallback!="function"&&(Lt.requestIdleCallback=function(s){const n=Date.now();return setTimeout(function(){const i=Math.max(0,50-(Date.now()-n));s({didTimeout:i===0,timeRemaining(){return i}})},1)}),typeof Lt.cancelIdleCallback!="function"&&(Lt.cancelIdleCallback=function(s){clearTimeout(s)})}class me{constructor(){d(this,"_data",[])}static create(){return new me}add(e){this._data.indexOf(e)>-1||this._data.push(e)}delete(e){const s=this._data.indexOf(e);this._data.splice(s,1)}getData(){return this._data}}class Oe{constructor(){d(this,"_data",new Map)}static create(){return new Oe}add(e,s){this._data.has(e)||this._data.set(e,s)}delete(e){this._data.delete(e)}getData(){return this._data}}var D=(t=>(t[t.Univer=0]="Univer",t[t.Doc=1]="Doc",t[t.Sheet=2]="Sheet",t[t.Slide=3]="Slide",t))(D||{});class Qe{constructor(e){d(this,"_name");this._name=e}onStarting(e){}onReady(){}onRendered(){}onSteady(){}onDestroy(){}getPluginName(){return this._name}}d(Qe,"type",0);class ir{constructor(){d(this,"_plugins",[])}addPlugin(e){this._plugins.push(e)}removePlugins(){const e=this._plugins.slice();return this._plugins.length=0,e}forEachPlugin(e){this._plugins.forEach(e)}}class or{constructor(){d(this,"_pluginsRegisteredByBusiness",new Map)}registerPlugin(e,s){const n=e.type;this._pluginsRegisteredByBusiness.has(n)||this._pluginsRegisteredByBusiness.set(n,[]),this._pluginsRegisteredByBusiness.get(n).push({plugin:e,options:s})}getRegisterPlugins(e){return this._pluginsRegisteredByBusiness.get(e)||[]}clearPluginsOfType(e){this._pluginsRegisteredByBusiness.delete(e)}}function tt(t,e){const s=t.indexOf(e);return s>-1?(t.splice(s,1),!0):!1}function ar(t){const e=new Set,s=[];for(const n of t)e.has(n)||(e.add(n),s.push(n));return s}function lr(t,e){for(let s=t.length-1;s>-1;s--){const n=t[s];if(e(n,s))return n}return null}async function Ze(t){for(const[e,s]of t.entries())try{if(!await s())return{index:e,result:!1}}catch(n){return{index:e,result:!1,error:n}}return{result:!0,index:-1}}function qe(t){for(const[e,s]of t.entries())try{if(!s())return{index:e,result:!1}}catch(n){return{index:e,result:!1,error:n}}return{result:!0,index:-1}}function He(t){var e=typeof Symbol=="function"&&Symbol.iterator,s=e&&t[e],n=0;if(s)return s.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Be(t,e){var s=typeof Symbol=="function"&&t[Symbol.iterator];if(!s)return t;var n=s.call(t),r,i=[],o;try{for(;(e===void 0||e-- >0)&&!(r=n.next()).done;)i.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(s=n.return)&&s.call(n)}finally{if(o)throw o.error}}return i}function We(t,e,s){if(s||arguments.length===2)for(var n=0,r=e.length,i;n<r;n++)(i||!(n in e))&&(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return t.concat(i||Array.prototype.slice.call(e))}function Ot(t){return typeof t=="function"}function ur(t){var e=function(n){Error.call(n),n.stack=new Error().stack},s=t(e);return s.prototype=Object.create(Error.prototype),s.prototype.constructor=s,s}var yt=ur(function(t){return function(s){t(this),this.message=s?s.length+` errors occurred during unsubscription:
2
2
  `+s.map(function(n,r){return r+1+") "+n.toString()}).join(`
3
- `):"",this.name="UnsubscriptionError",this.errors=s}});function He(t,e){if(t){var s=t.indexOf(e);0<=s&&t.splice(s,1)}}var Re=function(){function t(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return t.prototype.unsubscribe=function(){var e,s,n,r,i;if(!this.closed){this.closed=!0;var o=this._parentage;if(o)if(this._parentage=null,Array.isArray(o))try{for(var c=Fe(o),u=c.next();!u.done;u=c.next()){var a=u.value;a.remove(this)}}catch(E){e={error:E}}finally{try{u&&!u.done&&(s=c.return)&&s.call(c)}finally{if(e)throw e.error}}else o.remove(this);var l=this.initialTeardown;if(nt(l))try{l()}catch(E){i=E instanceof qt?E.errors:[E]}var h=this._finalizers;if(h){this._finalizers=null;try{for(var d=Fe(h),f=d.next();!f.done;f=d.next()){var g=f.value;try{We(g)}catch(E){i=i??[],E instanceof qt?i=Tt(Tt([],Mt(i)),Mt(E.errors)):i.push(E)}}}catch(E){n={error:E}}finally{try{f&&!f.done&&(r=d.return)&&r.call(d)}finally{if(n)throw n.error}}}if(i)throw new qt(i)}},t.prototype.add=function(e){var s;if(e&&e!==this)if(this.closed)We(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(s=this._finalizers)!==null&&s!==void 0?s:[]).push(e)}},t.prototype._hasParent=function(e){var s=this._parentage;return s===e||Array.isArray(s)&&s.includes(e)},t.prototype._addParent=function(e){var s=this._parentage;this._parentage=Array.isArray(s)?(s.push(e),s):s?[s,e]:e},t.prototype._removeParent=function(e){var s=this._parentage;s===e?this._parentage=null:Array.isArray(s)&&He(s,e)},t.prototype.remove=function(e){var s=this._finalizers;s&&He(s,e),e instanceof t&&e._removeParent(this)},t.EMPTY=function(){var e=new t;return e.closed=!0,e}(),t}();Re.EMPTY;function ts(t){return t instanceof Re||t&&"closed"in t&&nt(t.remove)&&nt(t.add)&&nt(t.unsubscribe)}function We(t){nt(t)?t():t.unsubscribe()}class es{constructor(e=!1){_(this,"skipNextObservers");_(this,"lastReturnValue");_(this,"isStopPropagation",!1);this.initialize(e)}initialize(e=!1){return this.skipNextObservers=e,this}stopPropagation(){this.isStopPropagation=!0}}function ss(t){return t instanceof kt}class kt{constructor(e,s){_(this,"_willBeUnregistered",!1);_(this,"unregisterOnNextCall",!1);this.callback=e,this.observable=s}dispose(){this.observable.remove(this)}}class jt{constructor(e){_(this,"_observers",new Array);_(this,"_eventState");_(this,"_onObserverAdded");this._eventState=new es,e&&(this._onObserverAdded=e)}get observers(){return this._observers}add(e,s=!1,n=!1){if(!e)return null;const r=new kt(e,this);return r.unregisterOnNextCall=n,s?this._observers.unshift(r):this._observers.push(r),this._onObserverAdded&&this._onObserverAdded(r),r}addOnce(e){return this.add(e,void 0,!0)}remove(e){return e&&this._observers.indexOf(e)!==-1?(this._deferUnregister(e),!0):!1}removeCallback(e){for(let s=0;s<this._observers.length;s++){const n=this._observers[s];if(!n._willBeUnregistered&&n.callback===e)return this._deferUnregister(n),!0}return!1}makeObserverTopPriority(e){this._remove(e),this._observers.unshift(e)}makeObserverBottomPriority(e){this._remove(e),this._observers.push(e)}notifyObservers(e){if(!this._observers.length)return null;const s=this._eventState;s.skipNextObservers=!1,s.lastReturnValue=e,s.isStopPropagation=!1;let n=!1;for(let r=0;r<this._observers.length;r++){const i=this._observers[r];if(!i._willBeUnregistered&&(s.lastReturnValue=i.callback(e,s),i.unregisterOnNextCall&&this._deferUnregister(i),s.isStopPropagation&&(n=!0),s.skipNextObservers))return{lastReturnValue:s.lastReturnValue,stopPropagation:n}}return{lastReturnValue:s.lastReturnValue,stopPropagation:n}}notifyObserversWithPromise(e){let s=Promise.resolve(e);if(!this._observers.length)return s;const n=this._eventState;n.skipNextObservers=!1;for(let r=0;r<this._observers.length;r++){const i=this._observers[r];n.skipNextObservers||i._willBeUnregistered||(s=s.then(()=>i.callback(e,n)),i.unregisterOnNextCall&&this._deferUnregister(i))}return s.then(()=>e)}notifyObserver(e,s){if(e._willBeUnregistered)return;const n=this._eventState;return n.skipNextObservers=!1,e.callback(s,n),e.unregisterOnNextCall&&this._deferUnregister(e),{lastReturnValue:n.lastReturnValue,stopPropagation:n.isStopPropagation}}hasObservers(){return this._observers.length>0}clear(){this._observers=new Array,this._onObserverAdded=null}clone(){const e=new jt;return e._observers=this._observers.slice(0),e}_deferUnregister(e){e.unregisterOnNextCall=!1,e._willBeUnregistered=!0,setTimeout(()=>{this._remove(e)},0)}_remove(e){if(!e)return!1;const s=this._observers.indexOf(e);return s!==-1?(this._observers.splice(s,1),!0):!1}}function D(t){let e=!1;return ts(t)?{dispose:()=>{e||(e=!0,t.unsubscribe())}}:ss(t)?{dispose:()=>{e||(e=!0,t.dispose())}}:{dispose:()=>{e||(e=!0,t())}}}function ar(t){return D(()=>{t.unsubscribe()})}class ns{constructor(){_(this,"_disposables",new Set)}add(e){return this._disposables.add(e),{dispose:()=>{e.dispose(),this._disposables.delete(e)}}}dispose(){this._disposables.forEach(e=>{e.dispose(),this._disposables.delete(e)})}}class M{constructor(){_(this,"_disposed",!1);_(this,"_collection",new ns)}disposeWithMe(e){return this._collection.add(e)}dispose(){this._disposed||(this._disposed=!0,this._collection.dispose())}}class lr extends M{constructor(){super(...arguments);_(this,"dispose$",new L.Subject)}dispose(){super.dispose(),this.dispose$.next(),this.dispose$.complete()}}const ut=S.createIdentifier("univer.context-service");class rs extends M{constructor(){super(...arguments);_(this,"_contextChanged$",new L.Subject);_(this,"contextChanged$",this._contextChanged$.asObservable());_(this,"_contextMap",new Map)}dispose(){super.dispose(),this._contextChanged$.complete()}getContextValue(s){return this._contextMap.get(s)??!1}setContextValue(s,n){this._contextMap.set(s,n),this._contextChanged$.next()}}var is=(t=>(t[t.SILENT=0]="SILENT",t[t.ERROR=1]="ERROR",t[t.WARN=2]="WARN",t[t.VERBOSE=3]="VERBOSE",t))(is||{});const ht=S.createIdentifier("univer.log");class os extends M{constructor(){super(...arguments);_(this,"_logLevel",0)}log(...s){if(this._logLevel<3||!s.length)return;const n=s[0];/^\[(.*?)\]/g.test(n)?console.log(`\x1B[97;104m${n}\x1B[0m:`,...s.slice(1)):console.log(...s)}warn(...s){this._logLevel>=2&&console.warn(...s)}error(...s){this._logLevel>=1&&console.error(...s)}setLogLevel(s){this._logLevel=s}}var ur=Object.defineProperty,hr=Object.getOwnPropertyDescriptor,_r=(t,e,s,n)=>{for(var r=n>1?void 0:n?hr(e,s):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(e,s,r):o(r))||r);return n&&r&&ur(e,s,r),r},Be=(t,e)=>(s,n)=>e(s,n,t),Vt=(t=>(t[t.COMMAND=0]="COMMAND",t[t.OPERATION=1]="OPERATION",t[t.MUTATION=2]="MUTATION",t))(Vt||{});const St=S.createIdentifier("anywhere.command-service");class dr{constructor(){_(this,"_commands",new Map)}registerCommand(e){if(this._commands.has(e.id))throw new Error(`Command ${e.id} has registered before!`);return this._commands.set(e.id,e),D(()=>{var s;this._commands.delete(e.id),(s=e.onDispose)==null||s.call(e)})}getCommand(e){return this._commands.has(e)?[this._commands.get(e)]:null}}exports.CommandService=class{constructor(e,s){_(this,"_commandRegistry");_(this,"_beforeCommandExecutionListeners",[]);_(this,"_commandExecutedListeners",[]);_(this,"_multiCommandDisposables",new Map);_(this,"_commandExecutingLevel",0);_(this,"_commandExecutionStack",[]);this._injector=e,this._log=s,this._commandRegistry=new dr}registerCommand(e){return this._registerCommand(e)}registerAsMultipleCommand(e){return this._registerMultiCommand(e)}beforeCommandExecuted(e){if(this._beforeCommandExecutionListeners.indexOf(e)===-1)return this._beforeCommandExecutionListeners.push(e),D(()=>{const s=this._beforeCommandExecutionListeners.indexOf(e);this._beforeCommandExecutionListeners.splice(s,1)});throw new Error("Could not add a listener twice.")}onCommandExecuted(e){if(this._commandExecutedListeners.indexOf(e)===-1)return this._commandExecutedListeners.push(e),D(()=>{const s=this._commandExecutedListeners.indexOf(e);this._commandExecutedListeners.splice(s,1)});throw new Error("Could not add a listener twice.")}async executeCommand(e,s,n){const r=this._commandRegistry.getCommand(e);if(r){const[i]=r,o={id:i.id,type:i.type,params:s},c=this._pushCommandExecutionStack(o);this._beforeCommandExecutionListeners.forEach(a=>a(o,n));const u=await this._execute(i,s);return this._commandExecutedListeners.forEach(a=>a(o,n)),c.dispose(),u}throw new Error(`[CommandService]: Command "${e}" is not registered.`)}syncExecuteCommand(e,s,n){const r=this._commandRegistry.getCommand(e);if(r){const[i]=r,o={id:i.id,type:i.type,params:s};if(i.type===2){const a=or(this._commandExecutionStack,l=>l.type===0);a&&(o.params=o.params??{},o.params.trigger=a.id)}const c=this._pushCommandExecutionStack(o),u=this._syncExecute(i,s);return c.dispose(),this._commandExecutedListeners.forEach(a=>a(o,n)),u}throw new Error(`[CommandService]: Command "${e}" is not registered.`)}_pushCommandExecutionStack(e){return this._commandExecutionStack.push(e),D(()=>y(this._commandExecutionStack,e))}_registerCommand(e){return this._commandRegistry.registerCommand(e)}_registerMultiCommand(e){const s=this._commandRegistry.getCommand(e.id);let n;if(!s)n=new fr(e.id),this._multiCommandDisposables.set(e.id,this._commandRegistry.registerCommand(n));else{if(s[0].multi!==!0)throw new Error("Command has registered as a single command.");n=s[0]}const r=n.registerImplementation(e);return D(()=>{var i;r.dispose(),n.hasImplementations()||(i=this._multiCommandDisposables.get(e.id))==null||i.dispose()})}async _execute(e,s){this._log.log("[CommandService]",`${"|-".repeat(Math.max(this._commandExecutingLevel,0))}executing command "${e.id}"`),this._commandExecutingLevel++;let n;try{n=await this._injector.invoke(e.handler,s),this._commandExecutingLevel--}catch(r){throw n=!1,this._commandExecutingLevel=0,r}return n}_syncExecute(e,s){this._log.log("[CommandService]",`${"|-".repeat(Math.max(0,this._commandExecutingLevel))}executing command "${e.id}".`),this._commandExecutingLevel++;let n;try{if(n=this._injector.invoke(e.handler,s),n instanceof Promise)throw new Error("[CommandService]: Command handler should not return a promise.");this._commandExecutingLevel--}catch(r){throw n=!1,this._commandExecutingLevel=0,r}return n}};exports.CommandService=_r([Be(0,S.Inject(S.Injector)),Be(1,ht)],exports.CommandService);class fr{constructor(e){_(this,"name");_(this,"multi",!0);_(this,"type",0);_(this,"priority",0);_(this,"_implementations",[]);_(this,"handler",async(e,s)=>{if(!this._implementations.length)return!1;const n=e.get(ht),r=e.get(ut),i=e.get(S.Injector);for(const o of this._implementations){const c=o.command.preconditions;if(c!=null&&c(r)&&(n.log("[MultiCommand]",`executing implementation "${o.command.name}".`),await i.invoke(o.command.handler,s)))return!0}return!1});this.id=e,this.name=e}registerImplementation(e){const s={command:e};return this._implementations.push(s),this._implementations.sort((n,r)=>r.command.priority-n.command.priority),D(()=>{var r;const n=this._implementations.indexOf(s);this._implementations.splice(n,1),(r=e.onDispose)==null||r.call(e)})}hasImplementations(){return this._implementations.length>0}}function Oe(t,e,s){const n=t.map(r=>()=>e.syncExecuteCommand(r.id,r.params,s));return ye(n)}function gr(t,e,s){const n=t.map(r=>()=>e.executeCommand(r.id,r.params,s));return qe(n)}const cs=S.createIdentifier("univer.config-service");class Er{constructor(){_(this,"_config",new Map)}getConfig(e){return this._config.get(e)}setConfig(e,s){this._config.set(e,s)}deleteConfig(e){this._config.delete(e)}}class as extends M{constructor(){super(...arguments);_(this,"_error$",new L.Subject);_(this,"error$",this._error$.asObservable())}dispose(){this._error$.complete()}emit(s){this._error$.next({errorKey:s})}}const Rr="__default_document_sub_component_id20231101__";class ls{constructor(){_(this,"_managerInfo",new Map);_(this,"_remove$",new L.Subject);_(this,"remove$",this._remove$.asObservable());_(this,"_andOrUpdate$",new L.Subject);_(this,"andOrUpdate$",this._andOrUpdate$.asObservable());_(this,"_pluginUpdate$",new L.Subject);_(this,"pluginUpdate$",this._pluginUpdate$.asObservable())}getFloatObject(e){return this._getFloatingObject(e)}getFloatObjects(e){return this._getFloatingObjects(e)}dispose(){this._remove$.complete(),this._andOrUpdate$.complete(),this._pluginUpdate$.complete(),this._managerInfo.clear()}clear(e){const s=this._clearByParam(e);this._remove$.next(s)}addOrUpdate(e){const s=this._addByParam(e);this._andOrUpdate$.next(s)}BatchAddOrUpdate(e){const s=[];e.forEach(n=>{s.push(...this._addByParam(n))}),this._andOrUpdate$.next(s)}remove(e){const s=this._removeByParam(e);this._remove$.next(s)}pluginUpdateRefresh(e){this._pluginUpdate$.next(e)}_getFloatingObjects(e){var r;if(e==null)return;const{unitId:s,subComponentId:n}=e;return(r=this._managerInfo.get(s))==null?void 0:r.get(n)}_getFloatingObject(e){var i,o;if(e==null)return;const{unitId:s,subComponentId:n,floatingObjectId:r}=e;return(o=(i=this._managerInfo.get(s))==null?void 0:i.get(n))==null?void 0:o.get(r)}_addByParam(e){const{unitId:s,subComponentId:n,floatingObject:r,floatingObjectId:i}=e;this._managerInfo.has(s)||this._managerInfo.set(s,new Map);const o=this._managerInfo.get(s);return o.has(n)||o.set(n,new Map),o.get(n).set(i,r),[{unitId:s,subComponentId:n,floatingObjectId:i,floatingObject:r}]}_clearByParam(e){const s=this._getFloatingObjects(e),{unitId:n,subComponentId:r}=e,i=[];return s==null||s.forEach((o,c)=>{i.push({unitId:n,subComponentId:r,floatingObjectId:c,floatingObject:o})}),s==null||s.clear(),i}_removeByParam(e){const s=this._getFloatingObjects(e),n=s==null?void 0:s.get(e.floatingObjectId);return n==null?[]:(s==null||s.delete(e.floatingObjectId),[{...e,floatingObject:n}])}}const us=S.createIdentifier("univer.floating-object.service");class hs{constructor(){_(this,"cursor",0)}reset(){return this.cursor=0,this}moveCursor(e){this.cursor+=e}}function _s(t,e){let s=0,n=t.length-1;for(;s<=n;){const r=Math.floor((n+s)/2);if(e<t[r]&&(r===0||e>=t[r-1]))return r;if(e>=t[r])s=r+1;else if(e<t[r])n=r-1;else return-1}return-1}function ds(t,e){let s=0,n=0,r=0,i=-1,o=t.length-1;for(;s<t.length&&o>=0&&o>=s;){if(n=t[o],o===0?r=0:r=t[o-1],e>=r&&e<=n){i=o;break}if(n=t[s],s===0?r=0:r=t[s-1],e>=r&&e<n){i=s;break}s++,o--}return i}function Or(t,e){let s=t.length-1;return e<t[0]?-1:e>t[t.length-1]?1/0:(t.length<40||e<=t[20]||e>=t[s-20]?s=ds(t,e):s=_s(t,e),s)}function Ar(t){const e=new Blob([t],{type:"text/javascript"});return window.URL.createObjectURL(e)}var fs=(t=>(t[t.DEFAULT_SERIES=0]="DEFAULT_SERIES",t[t.ALTERNATE_SERIES=1]="ALTERNATE_SERIES",t))(fs||{}),w=(t=>(t[t.NONE=0]="NONE",t[t.THIN=1]="THIN",t[t.HAIR=2]="HAIR",t[t.DOTTED=3]="DOTTED",t[t.DASHED=4]="DASHED",t[t.DASH_DOT=5]="DASH_DOT",t[t.DASH_DOT_DOT=6]="DASH_DOT_DOT",t[t.DOUBLE=7]="DOUBLE",t[t.MEDIUM=8]="MEDIUM",t[t.MEDIUM_DASHED=9]="MEDIUM_DASHED",t[t.MEDIUM_DASH_DOT=10]="MEDIUM_DASH_DOT",t[t.MEDIUM_DASH_DOT_DOT=11]="MEDIUM_DASH_DOT_DOT",t[t.SLANT_DASH_DOT=12]="SLANT_DASH_DOT",t[t.THICK=13]="THICK",t))(w||{}),gs=(t=>(t.TOP="top",t.BOTTOM="bottom",t.LEFT="left",t.RIGHT="right",t.NONE="none",t.ALL="all",t.OUTSIDE="outside",t.INSIDE="inside",t.HORIZONTAL="horizontal",t.VERTICAL="vertical",t))(gs||{}),G=(t=>(t[t.UNSUPPORTED=0]="UNSUPPORTED",t[t.RGB=1]="RGB",t[t.HEX=2]="HEX",t[t.THEME=3]="THEME",t))(G||{}),Es=(t=>(t[t.ON=0]="ON",t[t.OFF=1]="OFF",t))(Es||{}),Rs=(t=>(t[t.CONDITION_TYPE_UNSPECIFIED=0]="CONDITION_TYPE_UNSPECIFIED",t[t.NUMNUMBER_BETWEENR_GREATER=1]="NUMNUMBER_BETWEENR_GREATER",t[t.NUMBER_GREATER_THAN_EQ=2]="NUMBER_GREATER_THAN_EQ",t[t.NUMBER_LESS=3]="NUMBER_LESS",t[t.NUMBER_LESS_THAN_EQ=4]="NUMBER_LESS_THAN_EQ",t[t.NUMBER_EQ=5]="NUMBER_EQ",t[t.NUMBER_NOT_EQ=6]="NUMBER_NOT_EQ",t[t.NUMBER_BETWEEN=7]="NUMBER_BETWEEN",t[t.NUMBER_NOT_BETWEEN=8]="NUMBER_NOT_BETWEEN",t[t.TEXT_CONTAINS=9]="TEXT_CONTAINS",t[t.TEXT_NOT_CONTAINS=10]="TEXT_NOT_CONTAINS",t[t.TEXT_STARTS_WITH=11]="TEXT_STARTS_WITH",t[t.TEXT_ENDS_WITH=12]="TEXT_ENDS_WITH",t[t.TEXT_EQ=13]="TEXT_EQ",t[t.TEXT_IS_EMAIL=14]="TEXT_IS_EMAIL",t[t.TEXT_IS_URL=15]="TEXT_IS_URL",t[t.DATE_EQ=16]="DATE_EQ",t[t.DATE_BEFORE=17]="DATE_BEFORE",t[t.DATE_AFTER=18]="DATE_AFTER",t[t.DATE_ON_OR_BEFORE=19]="DATE_ON_OR_BEFORE",t[t.DATE_ON_OR_AFTER=20]="DATE_ON_OR_AFTER",t[t.DATE_BETWEEN=21]="DATE_BETWEEN",t[t.DATE_NOT_BETWEEN=22]="DATE_NOT_BETWEEN",t[t.DATE_IS_VALID=23]="DATE_IS_VALID",t[t.ONE_OF_RANGE=24]="ONE_OF_RANGE",t[t.ONE_OF_LIST=25]="ONE_OF_LIST",t[t.BLANK=26]="BLANK",t[t.NOT_BLANK=27]="NOT_BLANK",t[t.CUSTOM_FORMULA=28]="CUSTOM_FORMULA",t[t.BOOLEAN=29]="BOOLEAN",t[t.TEXT_NOT_EQ=30]="TEXT_NOT_EQ",t[t.DATE_NOT_EQ=31]="DATE_NOT_EQ",t))(Rs||{}),Os=(t=>(t[t.PASTE_NORMAL=0]="PASTE_NORMAL",t[t.PASTE_NO_BORDERS=1]="PASTE_NO_BORDERS",t[t.PASTE_FORMAT=2]="PASTE_FORMAT",t[t.PASTE_FORMULA=3]="PASTE_FORMULA",t[t.PASTE_DATA_VALIDATION=4]="PASTE_DATA_VALIDATION",t[t.PASTE_VALUES=5]="PASTE_VALUES",t[t.PASTE_CONDITIONAL_FORMATTING=6]="PASTE_CONDITIONAL_FORMATTING",t[t.PASTE_COLUMN_WIDTHS=7]="PASTE_COLUMN_WIDTHS",t))(Os||{}),As=(t=>(t[t.DOCUMENT=0]="DOCUMENT",t[t.PROJECT=1]="PROJECT",t))(As||{}),ms=(t=>(t[t.COLUMNS=0]="COLUMNS",t[t.ROWS=1]="ROWS",t))(ms||{}),Is=(t=>(t[t.UP=0]="UP",t[t.RIGHT=1]="RIGHT",t[t.DOWN=2]="DOWN",t[t.LEFT=3]="LEFT",t))(Is||{});function mr(t){switch(t){case 3:return 1;case 1:return 3;case 0:return 2;case 2:return 0}}var Cs=(t=>(t[t.NUMBER_FORMAT_TYPE_UNSPECIFIED=0]="NUMBER_FORMAT_TYPE_UNSPECIFIED",t[t.TEXT=1]="TEXT",t[t.NUMBER=2]="NUMBER",t[t.PERCENT=3]="PERCENT",t[t.CURRENCY=4]="CURRENCY",t[t.DATE=5]="DATE",t[t.TIME=6]="TIME",t[t.DATE_TIME=7]="DATE_TIME",t[t.SCIENTIFIC=8]="SCIENTIFIC",t))(Cs||{}),Ss=(t=>(t[t.INTERPOLATION_POINT_TYPE_UNSPECIFIED=0]="INTERPOLATION_POINT_TYPE_UNSPECIFIED",t[t.MIN=1]="MIN",t[t.MAX=2]="MAX",t[t.NUMBER=3]="NUMBER",t[t.PERCENT=4]="PERCENT",t[t.PERCENTILE=5]="PERCENTILE",t))(Ss||{}),zt=(t=>(t.EN_US="enUS",t.ZH_CN="zhCN",t))(zt||{}),Ns=(t=>(t[t.RANGE=0]="RANGE",t[t.SHEET=1]="SHEET",t))(Ns||{}),bs=(t=>(t[t.RELATIVE_DATE_UNSPECIFIED=0]="RELATIVE_DATE_UNSPECIFIED",t[t.PAST_YEAR=1]="PAST_YEAR",t[t.PAST_MONTH=2]="PAST_MONTH",t[t.PAST_WEEK=3]="PAST_WEEK",t[t.YESTERDAY=4]="YESTERDAY",t[t.TODAY=5]="TODAY",t[t.TOMORROW=6]="TOMORROW",t))(bs||{}),ws=(t=>(t[t.TYPE_UNSPECIFIED=0]="TYPE_UNSPECIFIED",t[t.TEXT_BOX=1]="TEXT_BOX",t[t.RECTANGLE=2]="RECTANGLE",t[t.ROUND_RECTANGLE=3]="ROUND_RECTANGLE",t[t.ELLIPSE=4]="ELLIPSE",t[t.ARC=5]="ARC",t[t.BENT_ARROW=6]="BENT_ARROW",t[t.BENT_UP_ARROW=7]="BENT_UP_ARROW",t[t.BEVEL=8]="BEVEL",t[t.BLOCK_ARC=9]="BLOCK_ARC",t[t.BRACE_PAIR=10]="BRACE_PAIR",t[t.BRACKET_PAIR=11]="BRACKET_PAIR",t[t.CAN=12]="CAN",t[t.CHEVRON=13]="CHEVRON",t[t.CHORD=14]="CHORD",t[t.CLOUD=15]="CLOUD",t[t.CORNER=16]="CORNER",t[t.CUBE=17]="CUBE",t[t.CURVED_DOWN_ARROW=18]="CURVED_DOWN_ARROW",t[t.CURVED_LEFT_ARROW=19]="CURVED_LEFT_ARROW",t[t.CURVED_RIGHT_ARROW=20]="CURVED_RIGHT_ARROW",t[t.CURVED_UP_ARROW=21]="CURVED_UP_ARROW",t[t.DECAGON=22]="DECAGON",t[t.DIAGONAL_STRIPE=23]="DIAGONAL_STRIPE",t[t.DIAMOND=24]="DIAMOND",t[t.DODECAGON=25]="DODECAGON",t[t.DONUT=26]="DONUT",t[t.DOUBLE_WAVE=27]="DOUBLE_WAVE",t[t.DOWN_ARROW=28]="DOWN_ARROW",t[t.DOWN_ARROW_CALLOUT=29]="DOWN_ARROW_CALLOUT",t[t.FOLDED_CORNER=30]="FOLDED_CORNER",t[t.FRAME=31]="FRAME",t[t.HALF_FRAME=32]="HALF_FRAME",t[t.HEART=33]="HEART",t[t.HEPTAGON=34]="HEPTAGON",t[t.HEXAGON=35]="HEXAGON",t[t.HOME_PLATE=36]="HOME_PLATE",t[t.HORIZONTAL_SCROLL=37]="HORIZONTAL_SCROLL",t[t.IRREGULAR_SEAL_1=38]="IRREGULAR_SEAL_1",t[t.IRREGULAR_SEAL_2=39]="IRREGULAR_SEAL_2",t[t.LEFT_ARROW=40]="LEFT_ARROW",t[t.LEFT_ARROW_CALLOUT=41]="LEFT_ARROW_CALLOUT",t[t.LEFT_BRACE=42]="LEFT_BRACE",t[t.LEFT_BRACKET=43]="LEFT_BRACKET",t[t.LEFT_RIGHT_ARROW=44]="LEFT_RIGHT_ARROW",t[t.LEFT_RIGHT_ARROW_CALLOUT=45]="LEFT_RIGHT_ARROW_CALLOUT",t[t.LEFT_RIGHT_UP_ARROW=46]="LEFT_RIGHT_UP_ARROW",t[t.LEFT_UP_ARROW=47]="LEFT_UP_ARROW",t[t.LIGHTNING_BOLT=48]="LIGHTNING_BOLT",t[t.MATH_DIVIDE=49]="MATH_DIVIDE",t[t.MATH_EQUAL=50]="MATH_EQUAL",t[t.MATH_MINUS=51]="MATH_MINUS",t[t.MATH_MULTIPLY=52]="MATH_MULTIPLY",t[t.MATH_NOT_EQUAL=53]="MATH_NOT_EQUAL",t[t.MATH_PLUS=54]="MATH_PLUS",t[t.MOON=55]="MOON",t[t.NO_SMOKING=56]="NO_SMOKING",t[t.NOTCHED_RIGHT_ARROW=57]="NOTCHED_RIGHT_ARROW",t[t.OCTAGON=58]="OCTAGON",t[t.PARALLELOGRAM=59]="PARALLELOGRAM",t[t.PENTAGON=60]="PENTAGON",t[t.PIE=61]="PIE",t[t.PLAQUE=62]="PLAQUE",t[t.PLUS=63]="PLUS",t[t.QUAD_ARROW=64]="QUAD_ARROW",t[t.QUAD_ARROW_CALLOUT=65]="QUAD_ARROW_CALLOUT",t[t.RIBBON=66]="RIBBON",t[t.RIBBON_2=67]="RIBBON_2",t[t.RIGHT_ARROW=68]="RIGHT_ARROW",t[t.RIGHT_ARROW_CALLOUT=69]="RIGHT_ARROW_CALLOUT",t[t.RIGHT_BRACE=70]="RIGHT_BRACE",t[t.RIGHT_BRACKET=71]="RIGHT_BRACKET",t[t.ROUND_1_RECTANGLE=72]="ROUND_1_RECTANGLE",t[t.ROUND_2_DIAGONAL_RECTANGLE=73]="ROUND_2_DIAGONAL_RECTANGLE",t[t.ROUND_2_SAME_RECTANGLE=74]="ROUND_2_SAME_RECTANGLE",t[t.RIGHT_TRIANGLE=75]="RIGHT_TRIANGLE",t[t.SMILEY_FACE=76]="SMILEY_FACE",t[t.SNIP_1_RECTANGLE=77]="SNIP_1_RECTANGLE",t[t.SNIP_2_DIAGONAL_RECTANGLE=78]="SNIP_2_DIAGONAL_RECTANGLE",t[t.SNIP_2_SAME_RECTANGLE=79]="SNIP_2_SAME_RECTANGLE",t[t.SNIP_ROUND_RECTANGLE=80]="SNIP_ROUND_RECTANGLE",t[t.STAR_10=81]="STAR_10",t[t.STAR_12=82]="STAR_12",t[t.STAR_16=83]="STAR_16",t[t.STAR_24=84]="STAR_24",t[t.STAR_32=85]="STAR_32",t[t.STAR_4=86]="STAR_4",t[t.STAR_5=87]="STAR_5",t[t.STAR_6=88]="STAR_6",t[t.STAR_7=89]="STAR_7",t[t.STAR_8=90]="STAR_8",t[t.STRIPED_RIGHT_ARROW=91]="STRIPED_RIGHT_ARROW",t[t.SUN=92]="SUN",t[t.TRAPEZOID=93]="TRAPEZOID",t[t.TRIANGLE=94]="TRIANGLE",t[t.UP_ARROW=95]="UP_ARROW",t[t.UP_ARROW_CALLOUT=96]="UP_ARROW_CALLOUT",t[t.UP_DOWN_ARROW=97]="UP_DOWN_ARROW",t[t.UTURN_ARROW=98]="UTURN_ARROW",t[t.VERTICAL_SCROLL=99]="VERTICAL_SCROLL",t[t.WAVE=100]="WAVE",t[t.WEDGE_ELLIPSE_CALLOUT=101]="WEDGE_ELLIPSE_CALLOUT",t[t.WEDGE_RECTANGLE_CALLOUT=102]="WEDGE_RECTANGLE_CALLOUT",t[t.WEDGE_ROUND_RECTANGLE_CALLOUT=103]="WEDGE_ROUND_RECTANGLE_CALLOUT",t[t.FLOW_CHART_ALTERNATE_PROCESS=104]="FLOW_CHART_ALTERNATE_PROCESS",t[t.FLOW_CHART_COLLATE=105]="FLOW_CHART_COLLATE",t[t.FLOW_CHART_CONNECTOR=106]="FLOW_CHART_CONNECTOR",t[t.FLOW_CHART_DECISION=107]="FLOW_CHART_DECISION",t[t.FLOW_CHART_DELAY=108]="FLOW_CHART_DELAY",t[t.FLOW_CHART_DISPLAY=109]="FLOW_CHART_DISPLAY",t[t.FLOW_CHART_DOCUMENT=110]="FLOW_CHART_DOCUMENT",t[t.FLOW_CHART_EXTRACT=111]="FLOW_CHART_EXTRACT",t[t.FLOW_CHART_INPUT_OUTPUT=112]="FLOW_CHART_INPUT_OUTPUT",t[t.FLOW_CHART_INTERNAL_STORAGE=113]="FLOW_CHART_INTERNAL_STORAGE",t[t.FLOW_CHART_MAGNETIC_DISK=114]="FLOW_CHART_MAGNETIC_DISK",t[t.FLOW_CHART_MAGNETIC_DRUM=115]="FLOW_CHART_MAGNETIC_DRUM",t[t.FLOW_CHART_MAGNETIC_TAPE=116]="FLOW_CHART_MAGNETIC_TAPE",t[t.FLOW_CHART_MANUAL_INPUT=117]="FLOW_CHART_MANUAL_INPUT",t[t.FLOW_CHART_MANUAL_OPERATION=118]="FLOW_CHART_MANUAL_OPERATION",t[t.FLOW_CHART_MERGE=119]="FLOW_CHART_MERGE",t[t.FLOW_CHART_MULTIDOCUMENT=120]="FLOW_CHART_MULTIDOCUMENT",t[t.FLOW_CHART_OFFLINE_STORAGE=121]="FLOW_CHART_OFFLINE_STORAGE",t[t.FLOW_CHART_OFFPAGE_CONNECTOR=122]="FLOW_CHART_OFFPAGE_CONNECTOR",t[t.FLOW_CHART_ONLINE_STORAGE=123]="FLOW_CHART_ONLINE_STORAGE",t[t.FLOW_CHART_OR=124]="FLOW_CHART_OR",t[t.FLOW_CHART_PREDEFINED_PROCESS=125]="FLOW_CHART_PREDEFINED_PROCESS",t[t.FLOW_CHART_PREPARATION=126]="FLOW_CHART_PREPARATION",t[t.FLOW_CHART_PROCESS=127]="FLOW_CHART_PROCESS",t[t.FLOW_CHART_PUNCHED_CARD=128]="FLOW_CHART_PUNCHED_CARD",t[t.FLOW_CHART_PUNCHED_TAPE=129]="FLOW_CHART_PUNCHED_TAPE",t[t.FLOW_CHART_SORT=130]="FLOW_CHART_SORT",t[t.FLOW_CHART_SUMMING_JUNCTION=131]="FLOW_CHART_SUMMING_JUNCTION",t[t.FLOW_CHART_TERMINATOR=132]="FLOW_CHART_TERMINATOR",t[t.ARROW_EAST=133]="ARROW_EAST",t[t.ARROW_NORTH_EAST=134]="ARROW_NORTH_EAST",t[t.ARROW_NORTH=135]="ARROW_NORTH",t[t.SPEECH=136]="SPEECH",t[t.STARBURST=137]="STARBURST",t[t.TEARDROP=138]="TEARDROP",t[t.ELLIPSE_RIBBON=139]="ELLIPSE_RIBBON",t[t.ELLIPSE_RIBBON_2=140]="ELLIPSE_RIBBON_2",t[t.CLOUD_CALLOUT=141]="CLOUD_CALLOUT",t[t.CUSTOM=142]="CUSTOM",t))(ws||{}),Ae=(t=>(t[t.GRID=0]="GRID",t[t.KANBAN=1]="KANBAN",t[t.GANTT=2]="GANTT",t))(Ae||{}),It=(t=>(t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.LEFT_TO_RIGHT=1]="LEFT_TO_RIGHT",t[t.RIGHT_TO_LEFT=2]="RIGHT_TO_LEFT",t))(It||{}),Ls=(t=>(t[t.DASH=0]="DASH",t[t.DASH_DOT_DOT_HEAVY=1]="DASH_DOT_DOT_HEAVY",t[t.DASH_DOT_HEAVY=2]="DASH_DOT_HEAVY",t[t.DASHED_HEAVY=3]="DASHED_HEAVY",t[t.DASH_LONG=4]="DASH_LONG",t[t.DASH_LONG_HEAVY=5]="DASH_LONG_HEAVY",t[t.DOT_DASH=6]="DOT_DASH",t[t.DOT_DOT_DASH=7]="DOT_DOT_DASH",t[t.DOTTED=8]="DOTTED",t[t.DOTTED_HEAVY=9]="DOTTED_HEAVY",t[t.DOUBLE=10]="DOUBLE",t[t.NONE=11]="NONE",t[t.SINGLE=12]="SINGLE",t[t.THICK=13]="THICK",t[t.WAVE=14]="WAVE",t[t.WAVY_DOUBLE=15]="WAVY_DOUBLE",t[t.WAVY_HEAVY=16]="WAVY_HEAVY",t[t.WORDS=17]="WORDS",t))(Ls||{}),st=(t=>(t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.LEFT=1]="LEFT",t[t.CENTER=2]="CENTER",t[t.RIGHT=3]="RIGHT",t[t.JUSTIFIED=4]="JUSTIFIED",t))(st||{}),ct=(t=>(t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.TOP=1]="TOP",t[t.MIDDLE=2]="MIDDLE",t[t.BOTTOM=3]="BOTTOM",t))(ct||{}),at=(t=>(t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.OVERFLOW=1]="OVERFLOW",t[t.CLIP=2]="CLIP",t[t.WRAP=3]="WRAP",t))(at||{}),Pt=(t=>(t[t.NORMAL=0]="NORMAL",t[t.ITALIC=1]="ITALIC",t))(Pt||{}),pt=(t=>(t[t.NORMAL=0]="NORMAL",t[t.BOLD=1]="BOLD",t))(pt||{}),xt=(t=>(t[t.NORMAL=0]="NORMAL",t[t.SUBSCRIPT=1]="SUBSCRIPT",t[t.SUPERSCRIPT=2]="SUPERSCRIPT",t))(xt||{}),I=(t=>(t[t.FALSE=0]="FALSE",t[t.TRUE=1]="TRUE",t))(I||{}),At=(t=>(t[t.STRING=1]="STRING",t[t.NUMBER=2]="NUMBER",t[t.BOOLEAN=3]="BOOLEAN",t[t.FORCE_STRING=4]="FORCE_STRING",t))(At||{}),x=(t=>(t[t.DARK1=0]="DARK1",t[t.LIGHT1=1]="LIGHT1",t[t.DARK2=2]="DARK2",t[t.LIGHT2=3]="LIGHT2",t[t.ACCENT1=4]="ACCENT1",t[t.ACCENT2=5]="ACCENT2",t[t.ACCENT3=6]="ACCENT3",t[t.ACCENT4=7]="ACCENT4",t[t.ACCENT5=8]="ACCENT5",t[t.ACCENT6=9]="ACCENT6",t[t.HYPERLINK=10]="HYPERLINK",t[t.FOLLOWED_HYPERLINK=11]="FOLLOWED_HYPERLINK",t))(x||{}),Kt=(t=>(t.OFFICE="Office",t.OFFICE_2007_2010="Office 2007-2010",t.GRAYSCALE="Grayscale",t.BLUE_WARM="Blue Warm",t.BLUE="Blue",t.BLUE_II="Blue II",t.BLUE_GREEN="Blue Green",t.GREEN="Green",t.GREEN_YELLOW="Green Yellow",t.YELLOW="Yellow",t.YELLOW_ORANGE="Yellow Orange",t.ORANGE="Orange",t.ORANGE_RED="Orange Red",t.RED_ORANGE="Red Orange",t.RED="Red",t.RED_VIOLET="Red Violet",t.VIOLET="Violet",t.VIOLET_II="Violet II",t.MEDIAN="Median",t.PAPER="Paper",t.MARQUEE="Marquee",t.SLIPSTREAM="Slipstream",t.Aspect="Aspect",t))(Kt||{});const vs={[Kt.OFFICE]:{[x.ACCENT1]:"#4472C4",[x.ACCENT2]:"#ED7D31",[x.ACCENT3]:"#A5A5A5",[x.ACCENT4]:"#70AD47",[x.ACCENT5]:"#5B9BD5",[x.ACCENT6]:"#70AD47",[x.DARK1]:"#000000",[x.DARK2]:"#44546A",[x.LIGHT1]:"#FFFFFF",[x.LIGHT2]:"#E7E6E6",[x.HYPERLINK]:"#0563C1",[x.FOLLOWED_HYPERLINK]:"#954F72"}};class Yt{constructor(){_(this,"_themeValue",x.LIGHT1);_(this,"_themeColors");_(this,"_themeTint");_(this,"_rgbValue","");_(this,"_colorType");this._colorType=G.UNSUPPORTED,this._themeColors=Kt.OFFICE,this._themeTint=0}asRgbColor(){return new Ft(this._rgbValue,this)}asThemeColor(){return new Ht(this._themeValue,this._themeTint,this._themeColors,this)}build(){switch(this._colorType){case G.THEME:return this.asThemeColor();case G.RGB:return this.asRgbColor();case G.UNSUPPORTED:throw Error("unsupported color type")}}setRgbColor(e){return this._colorType=G.RGB,this._rgbValue=e,this}setThemeColors(e){this._colorType=G.THEME,this._themeColors=e}setThemeTint(e){this._colorType=G.THEME,this._themeTint=e}setThemeColor(e){return this._colorType=G.THEME,this._themeValue=e,this}getColorType(){return this._colorType}}class rt{constructor(e){_(this,"_builder");this._builder=e}static rgbColorToHexValue(e){return`#${((1<<24)+(e.getRed()<<16)+(e.getGreen()<<8)+e.getBlue()).toString(16).slice(1)}`}static hexValueToRgbColor(e){e?e.indexOf("#")>-1&&(e=e.substring(1)):e="#000000";const s=+`0x${e[0]}${e[1]}`,n=+`0x${e[2]}${e[3]}`,r=+`0x${e[4]}${e[5]}`;return new Yt().setRgbColor(`rgb(${s},${n},${r})`).asRgbColor()}static hexToRgbString(e){const s=/^#?([a-f\d])([a-f\d])([a-f\d])$/i;e=e.replace(s,(i,o,c,u)=>o+o+c+c+u+u);const n=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);let r=null;if(n){const i=parseInt(n[1],16),o=parseInt(n[2],16),c=parseInt(n[3],16);r=`rgba(${i},${o},${c})`}return r}asRgbColor(){return this._builder.asRgbColor()}asThemeColor(){return this._builder.asThemeColor()}getColorType(){return this._builder.getColorType()}clone(){return new rt(this._builder)}equals(e){return!1}}class Ds{constructor(e){_(this,"_saturation",0);_(this,"_hue",0);_(this,"_lightness",0);_(this,"_alpha",0);const s=e.getRed()/255,n=e.getGreen()/255,r=e.getBlue()/255,i=e.getAlpha()/255,o=Math.min(s,Math.min(n,r)),c=Math.max(s,Math.max(n,r)),u=c-o;if(c===o){this._hue=0,this._saturation=0,this._lightness=c;return}this._lightness=(o+c)/2,this._lightness<.5?this._saturation=u/(c+o):this._saturation=u/(2-c-o),s===c&&(this._hue=(n-r)/u),n===c&&(this._hue=2+(r-s)/u),r===c&&(this._hue=4+(s-n)/u),this._hue*=60,this._hue<0&&(this._hue+=360),this._alpha=i}asRgbColor(){const e=new Yt;if(this._saturation===0)return e.setRgbColor(`rgba(${this._lightness*255},${this._lightness*255},${this._lightness*255},${this._alpha*255})`),e.asRgbColor();let s;this._lightness<.5?s=this._lightness*(1+this._saturation):s=this._lightness+this._saturation-this._lightness*this._saturation;const n=2*this._lightness-s,r=this._hue/360,i=r+1/3,o=this.setColor(s,n,i),c=this.setColor(s,n,r),u=r-1/3,a=this.setColor(s,n,u);return e.setRgbColor(`rgba(${Math.round(o*255)},${Math.round(c*255)},${Math.round(a*255)},${this._alpha*255})`),e.asRgbColor()}getLightness(){return this._lightness}getHue(){return this._hue}getSaturation(){return this._saturation}getAlpha(){return this._alpha}setColor(e,s,n){n<0&&(n+=1),n>1&&(n-=1);let r;return 6*n<1?r=s+(e-s)*6*n:2*n<1?r=e:3*n<2?r=s+(e-s)*(2/3-n)*6:r=s,r}setLightness(e){this._lightness=e}}const B=class B extends rt{constructor(s,n){super(n);_(this,"_cssString");_(this,"_red");_(this,"_green");_(this,"_blue");_(this,"_alpha");let r=s.match(B.RGBA_EXTRACT);if(r){const i=+r[1],o=+r[2],c=+r[3],u=+r[4];this._cssString=s,this._red=i,this._green=o,this._blue=c,this._alpha=u;return}if(r=s.match(B.RGB_EXTRACT),r){const i=+r[1],o=+r[2],c=+r[3];this._cssString=s,this._red=i,this._green=o,this._blue=c,this._alpha=1;return}throw new Error("Invalid rgba or rgb color")}asHexString(){return rt.rgbColorToHexValue(this)}getRed(){let s=this._red+B.RGB_COLOR_AMT;return s>255?s=255:s<0&&(s=0),s}getGreen(){let s=this._green+B.RGB_COLOR_AMT;return s>255?s=255:s<0&&(s=0),s}getBlue(){let s=this._blue+B.RGB_COLOR_AMT;return s>255?s=255:s<0&&(s=0),s}getAlpha(){return this._alpha}getColorType(){return G.RGB}clone(){return new B(this._cssString,this._builder)}asThemeColor(){throw new Error("rgb color not support to themeColor")}equals(s){return s instanceof B?s._red===this._red&&s._blue===this._blue&&s._green===this._green&&s._alpha===this._alpha:!1}getCssString(){return this._cssString}};_(B,"RGB_COLOR_AMT",0),_(B,"RGBA_EXTRACT",new RegExp("\\s*rgba\\s*\\((\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d.\\d|\\d\\s*)\\)\\s*")),_(B,"RGB_EXTRACT",new RegExp("\\s*rgb\\s*\\((\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d+\\s*)\\)\\s*"));let Ft=B;const Z=class Z extends rt{constructor(s,n,r,i){super(i);_(this,"_themeColorType");_(this,"_themeTint");_(this,"_themeColors");this._themeColorType=s,this._themeTint=n,this._themeColors=r}lumValue(s,n){if(s==null)return n;let r;return s<0?r=n*(1+s):r=n*(1-s)+(255-255*(1-s)),r}asRgbColor(){const s=vs[this._themeColors];if(s==null)throw new Error("not find themeColors type");const n=s[this._themeColorType];if(n==null)throw new Error("not find themeColors value");let r;if(Z._cacheThemeColor.has(this._themeColors)){if(r=Z._cacheThemeColor.get(this._themeColors),r.has(this._themeColorType))return r.get(this._themeColorType)}else r=new Map,Z._cacheThemeColor.set(this._themeColors,r);const i=new Ds(rt.hexValueToRgbColor(n));i.setLightness(this.lumValue(this._themeTint,i.getLightness()*255)/255);const o=i.asRgbColor();return r.set(this._themeColorType,o),o}clone(){return new Z(this._themeColorType,this._themeTint,this._themeColors,this._builder)}equals(s){return s instanceof Z?s._themeColorType===this._themeColorType:!1}getColorType(){return G.THEME}getThemeColorType(){return this._themeColorType}};_(Z,"_cacheThemeColor",new Map);let Ht=Z;var P=(t=>(t[t.COVER=0]="COVER",t[t.REPLACE=1]="REPLACE",t[t.INTERSECTION=2]="INTERSECTION",t))(P||{});let Ir=(t=21)=>crypto.getRandomValues(new Uint8Array(t)).reduce((e,s)=>(s&=63,s<36?e+=s.toString(36):s<62?e+=(s-26).toString(36).toUpperCase():s>62?e+="-":e+="_",e),"");const j=t=>t!=null,Ge=t=>{const e=Object.keys(t),s=/^\d+$/;let n=0;for(let r=0;r<e.length;r++){const i=e[r];if(!s.test(i))return-1;const o=parseInt(i)+1;o>n&&(n=o)}return n};class b{constructor(...e){_(this,"_objectArray");_(this,"_length",0);switch(e.length){case 0:{this._objectArray={},this._length=0;return}case 1:{if(typeof e[0]=="number"){this._objectArray={},this._length=e[0];return}const s=Ge(e[0]);if(s>-1){this._objectArray=e[0],this._length=s;return}throw new Error(`create object array error ${e[0]}`)}case 2:{if(Ge(e[0])>-1){this._objectArray=e[0],this._length=e[1];return}throw new Error(`create object array error ${JSON.stringify(e[0])}`)}}}static objectKeys(e){if(e){const s=Object.keys(e),n=s.indexOf("length");return n>-1&&s.splice(n,1),s}return[]}static getMaxLength(e){if(e){if(e.length)return e.length;const s=b.objectKeys(e);if(s.length)return Math.max(...s)+1}return 0}obtain(e,s){return this._objectArray[e]??s}getKeys(){return b.objectKeys(this._objectArray)}get(e){return this._objectArray[e]}set(e,s){if(e<0)throw new Error(`[ObjectArray]: index ${e} is invalid!`);const n=this._length;this._objectArray[e]=s,e>=n&&(this._length=e+1)}pop(){const e=this._length,s=this._objectArray;if(e>0){const n=e-1,r=s[n];return n>0&&(delete s[n],this._length--),r}return null}push(e){if(j(e)){let s=this._length;const n=this._objectArray;n[s++]=e,this._length=s}}first(){return this._objectArray[0]}last(){const e=this._length-1;return this._objectArray[e]}shift(){const e=this._length;if(e>0){const s=this._objectArray[0],n=e-1;let r;for(let i=0;i<n;i++)r=this._objectArray[i+1],j(r)&&(this._objectArray[i]=r);return this._length--,delete this._objectArray[n],s}return null}unshift(e){if(j(e)){const s=this._length,n=this._objectArray,r=s+1;let i=n[0];for(let o=1;o<r;o++){const c=this._objectArray[o];j(i)&&(n[o]=i),i=c}n[0]=e,this._length=r}}clear(){this._objectArray={},this._length=0}getLength(){return this._length}getSizeOf(){const e=this._objectArray;return Object.keys(e).length}toJSON(){return this._objectArray}toArray(){const e=new Array,s=this._objectArray,n=Object.keys(s),r=n.length;for(let i=0;i<r;i++){const o=+n[i];e[o]=s[o]}return e}forEach(e){const s=this._objectArray,n=Object.keys(s),r=n.length;for(let i=0;i<r;i++){const o=+n[i];if(e(o,s[o])===!1)return this}return this}clone(e){const s=new b;return e?this.forEach((n,r)=>{s.set(n,e(r))}):this.forEach((n,r)=>{s.set(n,r)}),s}isEmpty(){const e=this._objectArray;return Object.keys(e).length===0}delete(e){this.splice(e,1)}realDelete(e){if(this._length>0){const n=e+1,r=this._objectArray;let i=0;const o={};for(let c=e;c<n;c++){const u=r[c];j(u)&&(delete r[c],o[i]=u,i++)}}}includes(e){const s=this._objectArray,n=Object.keys(s),r=n.length;for(let i=0;i<r;i++){const o=+n[i];if(s[o]===e)return!0}return!1}slice(e,s){const n=this._objectArray;if(this._length>0){const i={};let o=0;for(let c=e;c<s;c++){const u=n[c];j(u)&&(i[o]=n[c],o++)}return new b(i,o)}return new b}concat(e){const s=this._objectArray,n=Object.keys(s),r=n.length,i=e._objectArray,o=Object.keys(i),c=o.length,u=new b(r+c),a=u._objectArray;let l=0;for(let h=0;h<r;h++,l++){const d=n[h];a[l]=s[d]}for(let h=0;h<c;h++,l++){const d=o[h];a[l]=i[d]}return u}find(e){const s=this._objectArray,n=Object.keys(s),r=n.length;for(let i=0;i<r;i++){const o=+n[i],c=s[o];if(e(o,c)===!0)return c}return null}splice(e,s){const n=this._length;if(n>0){const r=e+s,i=this._objectArray;let o=0;const c={};for(let l=e;l<r;l++){const h=i[l];j(h)&&(delete i[l],c[o]=h,o++)}const u=r-e,a=n;if(this._length-=u,this._length<=0)this._objectArray={},this._length=0;else for(let l=r;l<a;l++){const h=i[l];j(h)&&(i[l-u]=i[l],delete i[l])}return new b(c,o)}return new b}findIndex(e){const s=this._objectArray,n=Object.keys(s),r=n.length;for(let i=0;i<r;i++){const o=+n[i];if(e(o,s[o])===!0)return i}return-1}map(e){const s=this._objectArray,n=Object.keys(s),r=n.length,i={};for(let o=0;o<r;o++){const c=+n[o],u=s[c];i[o]=e(u)}return new b(i)}filter(e){const s=this._objectArray,n=Object.keys(s),r=n.length,i={};let o=0;for(let c=0;c<r;c++){const u=+n[c],a=s[u];e(u,a)&&(i[o]=a,o++)}return new b(i,o)}insert(e,s){const n=this._length,r=this._objectArray;for(let i=n-1;i>=e;i--)r[i+1]=r[i];return r[e]=s,this._length=n+1,this}move(e,s,n){const r=e>n;if(!r&&e+s>n)throw new Error("Invalid move operation");return r?this._moveBackward(e,s,n):this._moveForward(e,s,n),this}_moveBackward(e,s,n){const r=this._objectArray,i=[];for(let o=e;o<e+s;o++)i.push(r[o]);for(let o=e-1;o>=n;o--){const c=r[o];r[o+s]=c,c==null&&delete r[o+s]}i.forEach((o,c)=>{r[n+c]=o})}_moveForward(e,s,n){const r=this._objectArray,i=[];for(let o=e;o<e+s;o++)i.push(r[o]);for(let o=e+s;o<n;o++){const c=r[o];r[o-s]=c,c==null&&delete r[o-s]}i.forEach((o,c)=>{r[n+c-s]=o})}inserts(e,s){const n=s._objectArray,r=s._length,i=this._objectArray,c=this._length-1;for(let u=c;u>=e;u--){const a=i[u];j(a)&&(delete i[u],i[u+r]=a)}for(let u=0;u<r;u++){const a=n[u];j(a)&&(i[u+e]=n[u])}return this._length+=r,this}[Symbol.iterator](){return new Xt(this)}}class Xt{constructor(e){_(this,"_array");_(this,"_keys");_(this,"_cursor");this._array=e,this._keys=e.getKeys(),this._cursor=0}next(){const e=this._array,s=this._keys,n=this._cursor;if(n<s.length){const r=s[n],i=e.get(+r);return this._cursor++,{value:i,done:!1}}return{value:null,done:!0}}[Symbol.iterator](){return new Xt(this._array)}}class F{constructor(e={}){_(this,"_option");_(this,"_matrix");this._setOriginValue(e)}static MakeObjectMatrixSize(e){return new F({[e-1]:{}})}getMatrix(){return this._matrix}forEach(e){const s=this._option.getKeys();for(let n=0;n<s.length;n++){const r=+s[n],i=this.getRow(r);if(e(r,i)===!1)return this}return this}forRow(e){const s=this._option.getKeys();for(let n=0;n<s.length;n++){const r=+s[n],i=this.getRow(r);if(e(r,i.getKeys().map(c=>+c))===!1)return}}forValue(e){const s=this._option.getKeys();for(let n=0;n<s.length;n++){const r=+s[n],i=this.getRow(r),o=i.getKeys(),c=o.length;for(let u=0;u<c;u++){const a=+o[u],l=i.get(a);if(e(r,a,l)===!1)return this}}return this}swapRow(e,s){const n=this._option.get(e),r=this._option.get(s);this._option.set(s,n),this._option.set(e,r)}getRow(e){const s=this._option.get(e);if(s)return new b(s)}getRowOrCreate(e){const s=this.getRow(e);if(s==null){const n={};return this._option.set(e,n),new b(n)}return s}reset(){this._setOriginValue({})}hasValue(){const e=this._option;for(const s of e)if(!new b(s).isEmpty())return!0;return!1}getValue(e,s){const n=this.getRow(e);return n?n.get(s):null}setValue(e,s,n){this.getRowOrCreate(e).set(s,n)}deleteValue(e,s){const n=this.getRow(e);n&&n.delete(s)}realDeleteValue(e,s){const n=this.getRow(e);n&&(n.realDelete(s),n.getSizeOf()||this._option.realDelete(e))}spliceRows(e,s){const n=this._option.splice(e,s);return new F(n.toJSON())}sliceRows(e,s){const n=this._option.slice(e,s);return new F(n.toJSON())}pushRow(e){this._option.push(e.toJSON())}moveRows(e,s,n){this._option.move(e,s,n)}moveColumns(e,s,n){this._option.forEach((r,i)=>{new b(i).move(e,s,n)})}insertRow(e,s){this._option.insert(e,s.toJSON())}insertRowCount(e,s){this._option.inserts(e,new b(s))}insertRows(e,s){this._option.inserts(e,s._option),console.dir(this._option)}spliceColumns(e,s){const n=new F;return this._option.forEach((r,i)=>{for(let c=e;c<e+s;c++)n.setValue(r,c-e,this.getValue(r,c));const o=this._option.get(r);o&&new b(o).splice(e,s)}),n}sliceColumns(e,s){const n=new F;return this._option.forEach((r,i)=>{for(let o=e;o<e+s;o++)n.setValue(r,o-e,this.getValue(r,o))}),n}insertColumns(e,s){let n=0;s.forEach(r=>{const i=s.getRow(r);if(i)return n=i.getLength(),!1}),this.forEach((r,i)=>{var o,c;for(let u=e;u<e+n;u++)(o=s.getRow(r))==null||o.get(u-e),i.insert(u,(c=s.getRow(r))==null?void 0:c.get(u-e))})}insertColumnCount(e,s){this.forEach((n,r)=>{r.inserts(e,new b(s))})}getFragment(e,s,n,r){const i=new F;for(let o=e;o<=s;o++){const c=new b;for(let u=n;u<=r;u++){const a=this.getValue(o,u);c.push(a)}i.pushRow(c)}return i}getSlice(e,s,n,r){const i=new F;for(let o=e;o<=s;o++)for(let c=n;c<=r;c++){const u=this.getValue(o,c);u&&i.setValue(o,c,O.deepClone(u))}return i}getSizeOf(){return this._option.getSizeOf()}getLength(){return this._option.getLength()}getRange(){const n=this.getLength()-1;let r=0;const i=this.getLength();for(let o=0;o<i;o++){const c=this.getRow(o);if(c){const u=c.getLength()-1;r=u>r?u:r}}return{startRow:0,startColumn:0,endRow:n,endColumn:r}}toNativeArray(){const e=new Array;return this.forValue((s,n,r)=>{e.push(r)}),e}toArray(){return this._option.toArray().map(e=>new b(e).toArray())}toJSON(){return this._matrix}getData(){const e=JSON.stringify(this);return JSON.parse(e)}getArrayData(){let e=0,s=0,n=!1,r=!1;const i=new F;return this.forEach((o,c)=>{n||(n=!0,e=o),c.forEach((u,a)=>{r?u<s&&(s=u):(r=!0,s=u);const l=this.getValue(o,u);i.setValue(o-e,u-s,l)})}),i.getData()}getDataRange(){let e=0,s=0,n=0,r=!1,i=!1;this.forEach((c,u)=>{r||(r=!0,e=c);const a=u.getLength()-1;a>n&&(n=a),u.forEach((l,h)=>{i?l<s&&(s=l):(i=!0,s=l)})});const o=e+this.getSizeOf()-1;return{startRow:e,startColumn:s,endRow:o,endColumn:n}}getDiscreteRanges(){const e=[];return this.forEach((s,n)=>{n.forEach((r,i)=>{let o=!1;for(const c of e)if(s>=c.startRow&&s<=c.endRow+1&&r>=c.startColumn&&r<=c.endColumn+1){c.endRow=Math.max(s,c.endRow),c.endColumn=Math.max(r,c.endColumn),o=!0;break}o||e.push({startRow:s,endRow:s,startColumn:r,endColumn:r})})}),e}merge(e){this.forValue((s,n)=>{const r=e.getValue(s,n);r!=null&&this.setValue(s,n,r)})}_setOriginValue(e={}){this._matrix=e,this._option=new b(e)}}const Cr=/^-ms-/,Sr=/-([a-z])/g,Q=["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"];class O{static stringAt(e){let s="",n=e;for(;n>=Q.length;)n/=Q.length,n-=1,s+=Q[n%Q.length];const r=e%Q.length;return s+=Q[r],s}static indexAt(e){let s=0;for(let n=0;n<e.length-1;n+=1){const r=e.charCodeAt(n)-65,i=e.length-1-n;s+=Q.length**i+Q.length*r}return s+=e.charCodeAt(e.length-1)-65,s}static deleteBlank(e){return O.isString(e)?e.replace(/\s/g,""):e}static getSystemType(){const e=navigator.userAgent,s=navigator.platform==="Win32"||navigator.platform==="Windows",n=navigator.platform==="Mac68K"||navigator.platform==="MacPPC"||navigator.platform==="Macintosh"||navigator.platform==="MacIntel";if(n)return"Mac";if(navigator.platform==="X11"&&!s&&!n)return"Unix";if(String(navigator.platform).indexOf("Linux")>-1)return"Linux";if(s){if(e.indexOf("Windows NT 5.0")>-1||e.indexOf("Windows 2000")>-1)return"Windows 2000";if(e.indexOf("Windows NT 5.1")>-1||e.indexOf("Windows XP")>-1)return"Windows XP";if(e.indexOf("Windows NT 5.2")>-1||e.indexOf("Windows 2003")>-1)return"Windows 2003";if(e.indexOf("Windows NT 6.0")>-1||e.indexOf("Windows Vista")>-1)return"Windows Vista";if(e.indexOf("Windows NT 6.1")>-1||e.indexOf("Windows 7")>-1)return"Windows 7";if(e.indexOf("Windows NT 10")>-1||e.indexOf("Windows 10")>-1)return"Windows 10";if(e.indexOf("Windows NT 11")>-1||e.indexOf("Windows 11")>-1)return"Windows 11"}return"Unknown system"}static getBrowserType(){const e=navigator.userAgent,s=e.indexOf("Opera")>-1,n=e.indexOf("compatible")>-1&&e.indexOf("MSIE")>-1&&!s,r=e.indexOf("Trident")>-1&&e.indexOf("rv:11.0")>-1,i=e.indexOf("Edge")>-1,o=e.indexOf("Firefox")>-1,c=e.indexOf("Safari")>-1&&e.indexOf("Chrome")===-1,u=e.indexOf("Chrome")>-1&&e.indexOf("Safari")>-1;if(n){new RegExp("MSIE (\\d+\\.\\d+);").test(e);const l=parseFloat(RegExp.$1);return l===7?"IE7":l===8?"IE8":l===9?"IE9":l===10?"IE10":"0"}return o?"FF":s?"Opera":c?"Safari":u?"Chrome":i?"Edge":r?"IE11":"Unknown browser"}static generateRandomId(e=21){return Ir(e)}static getClassName(e){return e.constructor.name}static deepMerge(e,...s){s.forEach(o=>o&&i(o));function n(o,c){o.forEach((u,a)=>{if(O.isArray(u)){const l=c[a]??[];c[a]=l,n(u,l);return}if(O.isObject(u)){const l=c[a]??{};c[a]=l,r(u,l);return}c[a]=u})}function r(o,c){Object.keys(o).forEach(u=>{const a=o[u];if(O.isObject(a)){const l=c[u]??{};c[u]=l,r(a,l);return}if(O.isArray(a)){const l=c[u]??[];c[u]=l,n(a,l);return}c[u]=a})}function i(o){Object.keys(o).forEach(c=>{const u=o[c];if(O.isArray(u)){const a=e[c]??[];e[c]=a,n(u,a);return}if(O.isObject(u)){const a=e[c]??{};e[c]=a,r(u,a);return}e[c]=u})}return e}static numberFixed(e,s){return Number(Number(e).toFixed(s))}static diffValue(e,s){function n(o,c){const u=O.getValueType(o),a=O.getValueType(c);return u!==a?!1:O.isArray(o)?r(o,c):O.isObject(o)?i(o,c):O.isDate(o)?o.getTime()===c.getTime():O.isRegExp(o)?o.toString()===c.toString():o===c}function r(o,c){if(e.length!==s.length)return!1;for(let u=0,a=o.length;u<a;u++){const l=o[u],h=c[u];if(!n(l,h))return!1}return!0}function i(o,c){const u=Object.keys(o),a=Object.keys(c);if(u.length!==a.length)return!1;for(const l of u){if(!a.includes(l))return!1;const h=o[l],d=c[l];if(!n(h,d))return!1}return!0}return n(e,s)}static deepClone(e){if(!this.isDefine(e))return e;if(this.isRegExp(e))return new RegExp(e);if(this.isDate(e))return new Date(e);if(this.isArray(e)){const s=[];return e.forEach((n,r)=>{s[r]=O.deepClone(n)}),s}if(this.isObject(e)){const s={};return Object.keys(e).forEach(n=>{const r=e[n];s[n]=O.deepClone(r)}),Object.setPrototypeOf(s,Object.getPrototypeOf(e)),s}return e}static getLanguage(){const e="en-US";return globalThis.navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||e}static getValueType(e){return Object.prototype.toString.apply(e)}static isDefine(e){return e!=null}static isBlank(e){return this.isDefine(e)?this.isString(e)?e.trim()==="":!1:!0}static isAssignableFrom(e,s){return e instanceof s}static isBoolean(e){return this.getValueType(e)==="[object Boolean]"}static isPlainObject(e){return this.isDefine(e)?Object.getPrototypeOf(e)===Object.getPrototypeOf({}):!1}static isFunction(e){return this.getValueType(e)==="[object Function]"}static isDate(e){return this.getValueType(e)==="[object Date]"}static isRegExp(e){return this.getValueType(e)==="[object RegExp]"}static isArray(e){return this.getValueType(e)==="[object Array]"}static isString(e){return this.getValueType(e)==="[object String]"}static isNumber(e){return this.getValueType(e)==="[object Number]"}static isStringNumber(e){return!isNaN(parseFloat(e))&&isFinite(e)}static isObject(e){return this.getValueType(e)==="[object Object]"}static isEmptyObject(e){for(const s in e)return!1;return!0}static isMobile(){let e=0,s=0;return document.body.clientWidth&&(e=document.body.clientWidth),document.body.clientHeight&&(s=document.body.clientHeight),this.isAndroid()||this.isIPhone()||this.isTablet()||e<350&&s<500}static isTablet(){return/ipad|android|android 3.0|xoom|sch-i800|playbook|tablet|kindle/i.test(navigator.userAgent.toLowerCase())}static isWeChat(){const e=navigator.userAgent.toLowerCase();return String(e.match(/MicroMessenger/i))==="micromessenger"}static isAndroid(){const e=navigator.userAgent;return e.indexOf("Android")>-1||e.indexOf("Linux")>-1}static isIPhone(){return/iPhone/i.test(navigator.userAgent)}static itCount(e){return s=>{for(let n=0;n<e;n++)s&&s()}}static hasLength(e,s){return O.isDefine(e)?O.isDefine(s)?e.length===s:e.length>0:!1}static capitalize(e){return e.charAt(0).toUpperCase()+e.slice(1)}static fCamelCase(e,s){return s.toUpperCase()}static camelCase(e){return e.replace(Cr,"ms-").replace(Sr,this.fCamelCase)}static removeNull(e){return this.isObject(e)&&Object.keys(e).forEach(s=>{const n=e[s];n==null?delete e[s]:O.removeNull(n)}),e}static fillTwoDimensionalArray(e,s,n){return new Array(e).fill(n).map(r=>new Array(s).fill(n))}static fillObjectMatrix(e,s,n){const r=new F;for(let i=0;i<e;i++)for(let o=0;o<s;o++)r.setValue(i,o,n);return r.getData()}static numToWord(e){let s="";for(;e>0;){let n=e%26;n=n===0?n=26:n,s=String.fromCharCode(96+n)+s,e=(e-n)/26}return s.toLocaleUpperCase()}static ABCatNum(e){if(e==null||e.length===0)return NaN;const s=e.toLowerCase().split(""),n=s.length;let r=0,i=0;for(let o=0;o<n;o++)i=s[o].charCodeAt(0)-96,r+=i*26**(n-o-1);return r===0?NaN:r-1}static chatAtABC(e){let i="";for(;e>=0;)i=String.fromCharCode(e%26+97)+i,e=Math.floor(e/26)-1;return i.toUpperCase()}static randSort(e){for(let s=0,n=e.length;s<n;s++){const r=parseInt((Math.random()*n).toString()),i=e[r];e[r]=e[s],e[s]=i}return e}static commonExtend(e,s){const n={};for(const r in e)n[r]=e[r];for(const r in s)s[r]!=null&&(n[r]=s[r]);return n}static commonExtend1(e,s){for(const n in e)s[n]==null&&(s[n]=e[n]);return s}static arrayToObject(e){const s={};return e.forEach((n,r)=>{s[r]={},n.forEach((i,o)=>{s[r][o]=i})}),s}static createObjectArray(e){return e instanceof b?new b(e.toJSON()):new b(e)}static hasIntersectionBetweenTwoRanges(e,s,n,r){return s>=n&&r>=e}}function Nr(t){if(!t)return;const{actualRow:e,actualColumn:s,isMerged:n,isMergedMainCell:r,mergeInfo:i}=t;let{startY:o,endY:c,startX:u,endX:a}=t,l=e,h=s,d=e,f=s;if(n&&i){const{startRow:g,startColumn:E,endRow:R,endColumn:A,startY:m,endY:v,startX:H,endX:p}=i;l=g,h=E,d=R,f=A,o=m,c=v,u=H,a=p}return r&&(o=i.startY,c=i.endY,u=i.startX,a=i.endX,d=i.endRow,f=i.endColumn),{startRow:l,startColumn:h,endRow:d,endColumn:f,startY:o,endY:c,startX:u,endX:a}}function br(t){if(!t)return;const{actualRow:e,actualColumn:s,isMerged:n,isMergedMainCell:r,startRow:i,startColumn:o,endRow:c,endColumn:u}=t;let a=e,l=s,h=e,d=s;return(n||r)&&(a=i,l=o,h=c,d=u),{startRow:a,startColumn:l,endRow:h,endColumn:d}}function wr(t){var s;return!t||(((s=t==null?void 0:t.v)==null?void 0:s.toString())||"").length===0&&!t.p}function V(t){if(t){if(t.rgb)return t.rgb;if(t.th)return new Yt().setThemeColor(t.th).asThemeColor().asRgbColor().getCssString()}return null}function Lr(t){return O.isString(t)&&t.substring(0,1)==="="&&t.length>1}function vr(t){return O.isString(t)&&t.indexOf("=")===-1&&t.length===6}function Dr(t){return""}function Ur(t,e=!1){var i;let s="";const n=new Map([["ff",()=>{t.ff&&(s+=`font-family: ${t.ff}; `)}],["fs",()=>{if(t.fs){let o=t.fs;t.va&&(o/=2),s+=`font-size: ${o}pt; `}}],["it",()=>{t.it&&(s+="font-style: italic; ")}],["bl",()=>{t.bl&&(s+="font-weight: bold; ")}],["ul",()=>{var o;(o=t.ul)!=null&&o.s&&(s.indexOf("text-decoration-line")>-1?s=s.replace(new RegExp("(?<=text-decoration-line:.*)\\b(?=;)","g")," underline"):s+="text-decoration-line: underline; ",t.ul.cl&&s.indexOf("text-decoration-color")===-1&&(s+=`text-decoration-color: ${V(t.ul.cl)}; `),t.ul.t&&s.indexOf("text-decoration-style")===-1&&(s+=`text-decoration-style: ${t.ul.t} `))}],["st",()=>{var o;(o=t.st)!=null&&o.s&&(s.indexOf("text-decoration-line")>-1?s=s.replace(new RegExp("(?<=text-decoration-line:.*)\\b(?=;)","g")," line-through"):s+="text-decoration-line: line-through; ",t.st.cl&&s.indexOf("text-decoration-color")===-1&&(s+=`text-decoration-color: ${V(t.st.cl)}; `),t.st.t&&s.indexOf("text-decoration-style")===-1&&(s+=`text-decoration-style: ${t.st.t} `))}],["ol",()=>{var o;(o=t.ol)!=null&&o.s&&(s.indexOf("text-decoration-line")>-1?s=s.replace(new RegExp("(?<=text-decoration-line:.*)\\b(?=;)","g")," overline"):s+="text-decoration-line: overline; ",t.ol.cl&&s.indexOf("text-decoration-color")===-1&&(s+=`text-decoration-color: ${V(t.ol.cl)}; `),t.ol.t&&s.indexOf("text-decoration-style")===-1&&(s+=`text-decoration-style: ${t.ol.t} `))}],["bg",()=>{t.bg&&(s+=`background: ${V(t.bg)}; `)}],["bd",()=>{var o,c,u,a,l,h,d,f;(o=t.bd)!=null&&o.b&&(s+=`border-bottom: ${Nt((c=t.bd)==null?void 0:c.b.s)} ${V(t.bd.b.cl)??""}; `),(u=t.bd)!=null&&u.t&&(s+=`border-top: ${Nt((a=t.bd)==null?void 0:a.t.s)} ${V(t.bd.t.cl)??""}; `),(l=t.bd)!=null&&l.r&&(s+=`border-right: ${Nt((h=t.bd)==null?void 0:h.r.s)} ${V(t.bd.r.cl)??""}; `),(d=t.bd)!=null&&d.l&&(s+=`border-left: ${Nt((f=t.bd)==null?void 0:f.l.s)} ${V(t.bd.l.cl)??""}; `)}],["cl",()=>{t.cl&&(s+=`color: ${V(t.cl)}; `)}],["va",()=>{t.va===xt.SUBSCRIPT?s+="vertical-align: sub; ":t.va===xt.SUPERSCRIPT&&(s+="vertical-align: super; ")}],["td",()=>{t.td===It.LEFT_TO_RIGHT?s+="direction: ltr; ":t.td===It.RIGHT_TO_LEFT&&(s+="direction: rtl; ")}],["tr",()=>{var o,c,u;t.tr&&(s+=`data-rotate: (${(o=t.tr)==null?void 0:o.a}deg${(c=t.tr)!=null&&c.v?` ,${(u=t.tr)==null?void 0:u.v}`:""});`)}],["ht",()=>{t.ht===st.LEFT?s+="text-align: left; ":t.ht===st.RIGHT?s+="text-align: right; ":t.ht===st.CENTER?s+="text-align: center; ":t.ht===st.JUSTIFIED&&(s+="text-align: justify; ")}],["vt",()=>{t.vt===ct.BOTTOM?s+="vertical-align: bottom; ":t.vt===ct.TOP?s+="vertical-align: top; ":t.vt===ct.MIDDLE&&(s+="vertical-align: middle; ")}],["tb",()=>{t.tb===at.CLIP?s+="text-overflow: clip; ":t.tb===at.OVERFLOW?s+="text-break: overflow; ":t.tb===at.WRAP&&(s+="word-wrap: break-word;")}],["pd",()=>{var l,h,d,f,g,E,R,A;const o=`${(l=t.pd)==null?void 0:l.b}pt`,c=`${(h=t.pd)==null?void 0:h.t}pt`,u=`${(d=t.pd)==null?void 0:d.l}pt`,a=`${(f=t.pd)==null?void 0:f.r}pt`;(g=t.pd)!=null&&g.b&&(s+=`padding-bottom: ${o}; `),(E=t.pd)!=null&&E.t&&(s+=`padding-top: ${c}; `),(R=t.pd)!=null&&R.l&&(s+=`padding-left: ${u}; `),(A=t.pd)!=null&&A.r&&(s+=`padding-right: ${a}; `)}]]),r=["bd","tr","tb"];for(const o in t)e&&r.includes(o)||(i=n.get(o))==null||i();return s}function Nt(t){let e="";return t===w.NONE?e="none":t===w.THIN?e="0.5pt solid":t===w.HAIR?e="0.5pt double":t===w.DOTTED?e="0.5pt dotted":t===w.DASHED||t===w.DASH_DOT?e="0.5pt dashed":t===w.DASH_DOT_DOT?e="0.5pt dotted":t===w.DOUBLE?e="0.5pt double":t===w.MEDIUM?e="1pt solid":t===w.MEDIUM_DASHED||t===w.MEDIUM_DASH_DOT?e="1pt dashed":t===w.MEDIUM_DASH_DOT_DOT?e="1pt dotted":t===w.SLANT_DASH_DOT?e="0.5pt dashed":t===w.THICK&&(e="1.5pt solid"),e}function Mr(t){let e=0;if(t=t.trim(),t==="none")e=w.NONE;else if(t==="0.5pt solid")e=w.THIN;else if(t==="0.5pt double")e=w.HAIR;else if(t==="0.5pt dotted")e=w.DOTTED;else if(t==="0.5pt dashed")e=w.DASHED;else if(t==="1pt solid")e=w.MEDIUM;else if(t==="1pt dashed")e=w.MEDIUM_DASHED;else if(t==="1pt dotted")e=w.MEDIUM_DASH_DOT_DOT;else if(t==="1.5pt solid")e=w.THICK;else return w.NONE;return e}function Lt(t,e){let s=t.body;if(e){const{headers:n,footers:r}=t;n!=null&&n[e]?s=n[e].body:r!=null&&r[e]&&(s=r[e].body)}return s}function me(t,e){return Object.prototype.toString.call(t)===Object.prototype.toString.call(e)?Object.prototype.toString.call(t)==="[object Object]"||Object.prototype.toString.call(t)==="[object Array]"?Object.keys(t).length!==Object.keys(e).length?!1:Object.keys(t).every(s=>me(t[s],e[s])):t===e:!1}function Us(t,e){const s=t.ts||{},n=e.ts||{};return t.sId!==e.sId?!1:me(s,n)}function Ie(t,e,s,n){if(t>e&&([t,e]=[e,t]),s>n&&([s,n]=[n,s]),e<s||n<t)return[t,e];s<t&&(s=t),n>e&&(n=e);const r=n-s+1;let i=[];return t===s?i=[n+1-r,e-r]:e===n?i=[t,s-1]:i=[t,e-r],i}function Tr(t){if(t==null)return!1;const e=t.bullet;return(e==null?void 0:e.listId)!=null}function Pr(t){if(t==null)return!1;const e=t.paragraphStyle;return Ms(e)}function Ms(t){return!(t==null||(t.indentStart==null||t.indentStart===0)&&t.hanging==null||t.hanging===0)}function Ts(t,e,s){return t.slice(0,e)+s+t.slice(e)}function Ps(t,e,s){return e>s?t:t.slice(0,e)+t.slice(s)}class Ce{constructor(){_(this,"_include");_(this,"_count");this._include=[],this._count=1}checked(e){return this._include.includes(e)}onlyName(e){let s=e,n=1;for(;this.checked(s);)s=e+n,n++;return this._include.push(s),s}sheetName(e="sheet1"){let s=e;for(;this.checked(s);)s=`sheet${this._count}`,this._count++;return this._include.push(s),s}}var pr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function xr(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var ps={exports:{}};/*! @preserve
3
+ `):"",this.name="UnsubscriptionError",this.errors=s}});function Ge(t,e){if(t){var s=t.indexOf(e);0<=s&&t.splice(s,1)}}var Je=function(){function t(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return t.prototype.unsubscribe=function(){var e,s,n,r,i;if(!this.closed){this.closed=!0;var o=this._parentage;if(o)if(this._parentage=null,Array.isArray(o))try{for(var a=He(o),c=a.next();!c.done;c=a.next()){var l=c.value;l.remove(this)}}catch(E){e={error:E}}finally{try{c&&!c.done&&(s=a.return)&&s.call(a)}finally{if(e)throw e.error}}else o.remove(this);var u=this.initialTeardown;if(Ot(u))try{u()}catch(E){i=E instanceof yt?E.errors:[E]}var h=this._finalizers;if(h){this._finalizers=null;try{for(var f=He(h),_=f.next();!_.done;_=f.next()){var g=_.value;try{$e(g)}catch(E){i=i??[],E instanceof yt?i=We(We([],Be(i)),Be(E.errors)):i.push(E)}}}catch(E){n={error:E}}finally{try{_&&!_.done&&(r=f.return)&&r.call(f)}finally{if(n)throw n.error}}}if(i)throw new yt(i)}},t.prototype.add=function(e){var s;if(e&&e!==this)if(this.closed)$e(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(s=this._finalizers)!==null&&s!==void 0?s:[]).push(e)}},t.prototype._hasParent=function(e){var s=this._parentage;return s===e||Array.isArray(s)&&s.includes(e)},t.prototype._addParent=function(e){var s=this._parentage;this._parentage=Array.isArray(s)?(s.push(e),s):s?[s,e]:e},t.prototype._removeParent=function(e){var s=this._parentage;s===e?this._parentage=null:Array.isArray(s)&&Ge(s,e)},t.prototype.remove=function(e){var s=this._finalizers;s&&Ge(s,e),e instanceof t&&e._removeParent(this)},t.EMPTY=function(){var e=new t;return e.closed=!0,e}(),t}();Je.EMPTY;function cr(t){return t instanceof Je||t&&"closed"in t&&Ot(t.remove)&&Ot(t.add)&&Ot(t.unsubscribe)}function $e(t){Ot(t)?t():t.unsubscribe()}class ye{constructor(e=!1){d(this,"skipNextObservers");d(this,"lastReturnValue");d(this,"isStopPropagation",!1);this.initialize(e)}initialize(e=!1){return this.skipNextObservers=e,this}stopPropagation(){this.isStopPropagation=!0}}function ts(t){return t instanceof Vt}class Vt{constructor(e,s){d(this,"_willBeUnregistered",!1);d(this,"unregisterOnNextCall",!1);this.callback=e,this.observable=s}dispose(){this.observable.remove(this)}}class jt{constructor(e){d(this,"_observers",new Array);d(this,"_eventState");d(this,"_onObserverAdded");this._eventState=new ye,e&&(this._onObserverAdded=e)}get observers(){return this._observers}add(e,s=!1,n=!1){if(!e)return null;const r=new Vt(e,this);return r.unregisterOnNextCall=n,s?this._observers.unshift(r):this._observers.push(r),this._onObserverAdded&&this._onObserverAdded(r),r}addOnce(e){return this.add(e,void 0,!0)}remove(e){return e&&this._observers.indexOf(e)!==-1?(this._deferUnregister(e),!0):!1}removeCallback(e){for(let s=0;s<this._observers.length;s++){const n=this._observers[s];if(!n._willBeUnregistered&&n.callback===e)return this._deferUnregister(n),!0}return!1}makeObserverTopPriority(e){this._remove(e),this._observers.unshift(e)}makeObserverBottomPriority(e){this._remove(e),this._observers.push(e)}notifyObservers(e){if(!this._observers.length)return null;const s=this._eventState;s.skipNextObservers=!1,s.lastReturnValue=e,s.isStopPropagation=!1;let n=!1;for(let r=0;r<this._observers.length;r++){const i=this._observers[r];if(!i._willBeUnregistered&&(s.lastReturnValue=i.callback(e,s),i.unregisterOnNextCall&&this._deferUnregister(i),s.isStopPropagation&&(n=!0),s.skipNextObservers))return{lastReturnValue:s.lastReturnValue,stopPropagation:n}}return{lastReturnValue:s.lastReturnValue,stopPropagation:n}}notifyObserversWithPromise(e){let s=Promise.resolve(e);if(!this._observers.length)return s;const n=this._eventState;n.skipNextObservers=!1;for(let r=0;r<this._observers.length;r++){const i=this._observers[r];n.skipNextObservers||i._willBeUnregistered||(s=s.then(()=>i.callback(e,n)),i.unregisterOnNextCall&&this._deferUnregister(i))}return s.then(()=>e)}notifyObserver(e,s){if(e._willBeUnregistered)return;const n=this._eventState;return n.skipNextObservers=!1,e.callback(s,n),e.unregisterOnNextCall&&this._deferUnregister(e),{lastReturnValue:n.lastReturnValue,stopPropagation:n.isStopPropagation}}hasObservers(){return this._observers.length>0}clear(){this._observers=new Array,this._onObserverAdded=null}clone(){const e=new jt;return e._observers=this._observers.slice(0),e}_deferUnregister(e){e.unregisterOnNextCall=!1,e._willBeUnregistered=!0,setTimeout(()=>{this._remove(e)},0)}_remove(e){if(!e)return!1;const s=this._observers.indexOf(e);return s!==-1?(this._observers.splice(s,1),!0):!1}}function v(t){let e=!1;return cr(t)?{dispose:()=>{e||(e=!0,t.unsubscribe())}}:ts(t)?{dispose:()=>{e||(e=!0,t.dispose())}}:{dispose:()=>{e||(e=!0,t())}}}function hr(t){return v(()=>{t.unsubscribe()})}class es{constructor(){d(this,"_disposables",new Set)}add(e){return this._disposables.add(e),{dispose:()=>{e.dispose(),this._disposables.delete(e)}}}dispose(){this._disposables.forEach(e=>{e.dispose(),this._disposables.delete(e)})}}class M{constructor(){d(this,"_disposed",!1);d(this,"_collection",new es)}disposeWithMe(e){return this._collection.add(e)}dispose(){this._disposed||(this._disposed=!0,this._collection.dispose())}}class dr extends M{constructor(){super(...arguments);d(this,"dispose$",new N.Subject)}dispose(){super.dispose(),this.dispose$.next(),this.dispose$.complete()}}const ct=C.createIdentifier("univer.context-service");class ss extends M{constructor(){super(...arguments);d(this,"_contextChanged$",new N.Subject);d(this,"contextChanged$",this._contextChanged$.asObservable());d(this,"_contextMap",new Map)}dispose(){super.dispose(),this._contextChanged$.complete()}getContextValue(s){return this._contextMap.get(s)??!1}setContextValue(s,n){this._contextMap.set(s,n),this._contextChanged$.next()}}var ns=(t=>(t[t.SILENT=0]="SILENT",t[t.ERROR=1]="ERROR",t[t.WARN=2]="WARN",t[t.VERBOSE=3]="VERBOSE",t))(ns||{});const ht=C.createIdentifier("univer.log");class rs extends M{constructor(){super(...arguments);d(this,"_logLevel",0)}log(...s){if(this._logLevel<3||!s.length)return;const n=s[0];/^\[(.*?)\]/g.test(n)?console.log(`\x1B[97;104m${n}\x1B[0m:`,...s.slice(1)):console.log(...s)}warn(...s){this._logLevel>=2&&console.warn(...s)}error(...s){this._logLevel>=1&&console.error(...s)}setLogLevel(s){this._logLevel=s}}var _r=Object.defineProperty,fr=Object.getOwnPropertyDescriptor,gr=(t,e,s,n)=>{for(var r=n>1?void 0:n?fr(e,s):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(e,s,r):o(r))||r);return n&&r&&_r(e,s,r),r},ke=(t,e)=>(s,n)=>e(s,n,t),zt=(t=>(t[t.COMMAND=0]="COMMAND",t[t.OPERATION=1]="OPERATION",t[t.MUTATION=2]="MUTATION",t))(zt||{});const bt=C.createIdentifier("anywhere.command-service");class Er{constructor(){d(this,"_commands",new Map)}registerCommand(e){if(this._commands.has(e.id))throw new Error(`Command ${e.id} has registered before!`);return this._commands.set(e.id,e),v(()=>{var s;this._commands.delete(e.id),(s=e.onDispose)==null||s.call(e)})}getCommand(e){return this._commands.has(e)?[this._commands.get(e)]:null}}exports.CommandService=class{constructor(e,s){d(this,"_commandRegistry");d(this,"_beforeCommandExecutionListeners",[]);d(this,"_commandExecutedListeners",[]);d(this,"_multiCommandDisposables",new Map);d(this,"_commandExecutingLevel",0);d(this,"_commandExecutionStack",[]);this._injector=e,this._log=s,this._commandRegistry=new Er}registerCommand(e){return this._registerCommand(e)}registerAsMultipleCommand(e){return this._registerMultiCommand(e)}beforeCommandExecuted(e){if(this._beforeCommandExecutionListeners.indexOf(e)===-1)return this._beforeCommandExecutionListeners.push(e),v(()=>{const s=this._beforeCommandExecutionListeners.indexOf(e);this._beforeCommandExecutionListeners.splice(s,1)});throw new Error("Could not add a listener twice.")}onCommandExecuted(e){if(this._commandExecutedListeners.indexOf(e)===-1)return this._commandExecutedListeners.push(e),v(()=>{const s=this._commandExecutedListeners.indexOf(e);this._commandExecutedListeners.splice(s,1)});throw new Error("Could not add a listener twice.")}async executeCommand(e,s,n){const r=this._commandRegistry.getCommand(e);if(r){const[i]=r,o={id:i.id,type:i.type,params:s},a=this._pushCommandExecutionStack(o);this._beforeCommandExecutionListeners.forEach(l=>l(o,n));const c=await this._execute(i,s);return this._commandExecutedListeners.forEach(l=>l(o,n)),a.dispose(),c}throw new Error(`[CommandService]: Command "${e}" is not registered.`)}syncExecuteCommand(e,s,n){const r=this._commandRegistry.getCommand(e);if(r){const[i]=r,o={id:i.id,type:i.type,params:s};if(i.type===2){const l=lr(this._commandExecutionStack,u=>u.type===0);l&&(o.params=o.params??{},o.params.trigger=l.id)}const a=this._pushCommandExecutionStack(o),c=this._syncExecute(i,s);return a.dispose(),this._commandExecutedListeners.forEach(l=>l(o,n)),c}throw new Error(`[CommandService]: Command "${e}" is not registered.`)}_pushCommandExecutionStack(e){return this._commandExecutionStack.push(e),v(()=>tt(this._commandExecutionStack,e))}_registerCommand(e){return this._commandRegistry.registerCommand(e)}_registerMultiCommand(e){const s=this._commandRegistry.getCommand(e.id);let n;if(!s)n=new Rr(e.id),this._multiCommandDisposables.set(e.id,this._commandRegistry.registerCommand(n));else{if(s[0].multi!==!0)throw new Error("Command has registered as a single command.");n=s[0]}const r=n.registerImplementation(e);return v(()=>{var i;r.dispose(),n.hasImplementations()||(i=this._multiCommandDisposables.get(e.id))==null||i.dispose()})}async _execute(e,s){this._log.log("[CommandService]",`${"|-".repeat(Math.max(this._commandExecutingLevel,0))}executing command "${e.id}"`),this._commandExecutingLevel++;let n;try{n=await this._injector.invoke(e.handler,s),this._commandExecutingLevel--}catch(r){throw n=!1,this._commandExecutingLevel=0,r}return n}_syncExecute(e,s){this._log.log("[CommandService]",`${"|-".repeat(Math.max(0,this._commandExecutingLevel))}executing command "${e.id}".`),this._commandExecutingLevel++;let n;try{if(n=this._injector.invoke(e.handler,s),n instanceof Promise)throw new Error("[CommandService]: Command handler should not return a promise.");this._commandExecutingLevel--}catch(r){throw n=!1,this._commandExecutingLevel=0,r}return n}};exports.CommandService=gr([ke(0,C.Inject(C.Injector)),ke(1,ht)],exports.CommandService);class Rr{constructor(e){d(this,"name");d(this,"multi",!0);d(this,"type",0);d(this,"priority",0);d(this,"_implementations",[]);d(this,"handler",async(e,s)=>{if(!this._implementations.length)return!1;const n=e.get(ht),r=e.get(ct),i=e.get(C.Injector);for(const o of this._implementations){const a=o.command.preconditions;if(a!=null&&a(r)&&(n.log("[MultiCommand]",`executing implementation "${o.command.name}".`),await i.invoke(o.command.handler,s)))return!0}return!1});this.id=e,this.name=e}registerImplementation(e){const s={command:e};return this._implementations.push(s),this._implementations.sort((n,r)=>r.command.priority-n.command.priority),v(()=>{var r;const n=this._implementations.indexOf(s);this._implementations.splice(n,1),(r=e.onDispose)==null||r.call(e)})}hasImplementations(){return this._implementations.length>0}}function Ae(t,e,s){const n=t.map(r=>()=>e.syncExecuteCommand(r.id,r.params,s));return qe(n)}function mr(t,e,s){const n=t.map(r=>()=>e.executeCommand(r.id,r.params,s));return Ze(n)}const is=C.createIdentifier("univer.config-service");class Or{constructor(){d(this,"_config",new Map)}getConfig(e){return this._config.get(e)}setConfig(e,s){this._config.set(e,s)}deleteConfig(e){this._config.delete(e)}}class os extends M{constructor(){super(...arguments);d(this,"_error$",new N.Subject);d(this,"error$",this._error$.asObservable())}dispose(){this._error$.complete()}emit(s){this._error$.next({errorKey:s})}}const Ar="__default_document_sub_component_id20231101__";class as{constructor(){d(this,"_managerInfo",new Map);d(this,"_remove$",new N.Subject);d(this,"remove$",this._remove$.asObservable());d(this,"_andOrUpdate$",new N.Subject);d(this,"andOrUpdate$",this._andOrUpdate$.asObservable());d(this,"_pluginUpdate$",new N.Subject);d(this,"pluginUpdate$",this._pluginUpdate$.asObservable())}getFloatObject(e){return this._getFloatingObject(e)}getFloatObjects(e){return this._getFloatingObjects(e)}dispose(){this._remove$.complete(),this._andOrUpdate$.complete(),this._pluginUpdate$.complete(),this._managerInfo.clear()}clear(e){const s=this._clearByParam(e);this._remove$.next(s)}addOrUpdate(e){const s=this._addByParam(e);this._andOrUpdate$.next(s)}BatchAddOrUpdate(e){const s=[];e.forEach(n=>{s.push(...this._addByParam(n))}),this._andOrUpdate$.next(s)}remove(e){const s=this._removeByParam(e);this._remove$.next(s)}pluginUpdateRefresh(e){this._pluginUpdate$.next(e)}_getFloatingObjects(e){var r;if(e==null)return;const{unitId:s,subComponentId:n}=e;return(r=this._managerInfo.get(s))==null?void 0:r.get(n)}_getFloatingObject(e){var i,o;if(e==null)return;const{unitId:s,subComponentId:n,floatingObjectId:r}=e;return(o=(i=this._managerInfo.get(s))==null?void 0:i.get(n))==null?void 0:o.get(r)}_addByParam(e){const{unitId:s,subComponentId:n,floatingObject:r,floatingObjectId:i}=e;this._managerInfo.has(s)||this._managerInfo.set(s,new Map);const o=this._managerInfo.get(s);return o.has(n)||o.set(n,new Map),o.get(n).set(i,r),[{unitId:s,subComponentId:n,floatingObjectId:i,floatingObject:r}]}_clearByParam(e){const s=this._getFloatingObjects(e),{unitId:n,subComponentId:r}=e,i=[];return s==null||s.forEach((o,a)=>{i.push({unitId:n,subComponentId:r,floatingObjectId:a,floatingObject:o})}),s==null||s.clear(),i}_removeByParam(e){const s=this._getFloatingObjects(e),n=s==null?void 0:s.get(e.floatingObjectId);return n==null?[]:(s==null||s.delete(e.floatingObjectId),[{...e,floatingObject:n}])}}const ls=C.createIdentifier("univer.floating-object.service");class us{constructor(){d(this,"cursor",0)}reset(){return this.cursor=0,this}moveCursor(e){this.cursor+=e}moveCursorTo(e){this.cursor=e}}function cs(t,e){let s=0,n=t.length-1;for(;s<=n;){const r=Math.floor((n+s)/2);if(e<t[r]&&(r===0||e>=t[r-1]))return r;if(e>=t[r])s=r+1;else if(e<t[r])n=r-1;else return-1}return-1}function hs(t,e){let s=0,n=0,r=0,i=-1,o=t.length-1;for(;s<t.length&&o>=0&&o>=s;){if(n=t[o],o===0?r=0:r=t[o-1],e>=r&&e<=n){i=o;break}if(n=t[s],s===0?r=0:r=t[s-1],e>=r&&e<n){i=s;break}s++,o--}return i}function Ir(t,e){let s=t.length-1;return e<t[0]?-1:e>t[t.length-1]?1/0:(t.length<40||e<=t[20]||e>=t[s-20]?s=hs(t,e):s=cs(t,e),s)}function Cr(t){const e=new Blob([t],{type:"text/javascript"});return window.URL.createObjectURL(e)}var ds=(t=>(t[t.DEFAULT_SERIES=0]="DEFAULT_SERIES",t[t.ALTERNATE_SERIES=1]="ALTERNATE_SERIES",t))(ds||{}),b=(t=>(t[t.NONE=0]="NONE",t[t.THIN=1]="THIN",t[t.HAIR=2]="HAIR",t[t.DOTTED=3]="DOTTED",t[t.DASHED=4]="DASHED",t[t.DASH_DOT=5]="DASH_DOT",t[t.DASH_DOT_DOT=6]="DASH_DOT_DOT",t[t.DOUBLE=7]="DOUBLE",t[t.MEDIUM=8]="MEDIUM",t[t.MEDIUM_DASHED=9]="MEDIUM_DASHED",t[t.MEDIUM_DASH_DOT=10]="MEDIUM_DASH_DOT",t[t.MEDIUM_DASH_DOT_DOT=11]="MEDIUM_DASH_DOT_DOT",t[t.SLANT_DASH_DOT=12]="SLANT_DASH_DOT",t[t.THICK=13]="THICK",t))(b||{}),_s=(t=>(t.TOP="top",t.BOTTOM="bottom",t.LEFT="left",t.RIGHT="right",t.NONE="none",t.ALL="all",t.OUTSIDE="outside",t.INSIDE="inside",t.HORIZONTAL="horizontal",t.VERTICAL="vertical",t))(_s||{}),W=(t=>(t[t.UNSUPPORTED=0]="UNSUPPORTED",t[t.RGB=1]="RGB",t[t.HEX=2]="HEX",t[t.THEME=3]="THEME",t))(W||{}),fs=(t=>(t[t.ON=0]="ON",t[t.OFF=1]="OFF",t))(fs||{}),gs=(t=>(t[t.CONDITION_TYPE_UNSPECIFIED=0]="CONDITION_TYPE_UNSPECIFIED",t[t.NUMNUMBER_BETWEENR_GREATER=1]="NUMNUMBER_BETWEENR_GREATER",t[t.NUMBER_GREATER_THAN_EQ=2]="NUMBER_GREATER_THAN_EQ",t[t.NUMBER_LESS=3]="NUMBER_LESS",t[t.NUMBER_LESS_THAN_EQ=4]="NUMBER_LESS_THAN_EQ",t[t.NUMBER_EQ=5]="NUMBER_EQ",t[t.NUMBER_NOT_EQ=6]="NUMBER_NOT_EQ",t[t.NUMBER_BETWEEN=7]="NUMBER_BETWEEN",t[t.NUMBER_NOT_BETWEEN=8]="NUMBER_NOT_BETWEEN",t[t.TEXT_CONTAINS=9]="TEXT_CONTAINS",t[t.TEXT_NOT_CONTAINS=10]="TEXT_NOT_CONTAINS",t[t.TEXT_STARTS_WITH=11]="TEXT_STARTS_WITH",t[t.TEXT_ENDS_WITH=12]="TEXT_ENDS_WITH",t[t.TEXT_EQ=13]="TEXT_EQ",t[t.TEXT_IS_EMAIL=14]="TEXT_IS_EMAIL",t[t.TEXT_IS_URL=15]="TEXT_IS_URL",t[t.DATE_EQ=16]="DATE_EQ",t[t.DATE_BEFORE=17]="DATE_BEFORE",t[t.DATE_AFTER=18]="DATE_AFTER",t[t.DATE_ON_OR_BEFORE=19]="DATE_ON_OR_BEFORE",t[t.DATE_ON_OR_AFTER=20]="DATE_ON_OR_AFTER",t[t.DATE_BETWEEN=21]="DATE_BETWEEN",t[t.DATE_NOT_BETWEEN=22]="DATE_NOT_BETWEEN",t[t.DATE_IS_VALID=23]="DATE_IS_VALID",t[t.ONE_OF_RANGE=24]="ONE_OF_RANGE",t[t.ONE_OF_LIST=25]="ONE_OF_LIST",t[t.BLANK=26]="BLANK",t[t.NOT_BLANK=27]="NOT_BLANK",t[t.CUSTOM_FORMULA=28]="CUSTOM_FORMULA",t[t.BOOLEAN=29]="BOOLEAN",t[t.TEXT_NOT_EQ=30]="TEXT_NOT_EQ",t[t.DATE_NOT_EQ=31]="DATE_NOT_EQ",t))(gs||{}),Es=(t=>(t[t.PASTE_NORMAL=0]="PASTE_NORMAL",t[t.PASTE_NO_BORDERS=1]="PASTE_NO_BORDERS",t[t.PASTE_FORMAT=2]="PASTE_FORMAT",t[t.PASTE_FORMULA=3]="PASTE_FORMULA",t[t.PASTE_DATA_VALIDATION=4]="PASTE_DATA_VALIDATION",t[t.PASTE_VALUES=5]="PASTE_VALUES",t[t.PASTE_CONDITIONAL_FORMATTING=6]="PASTE_CONDITIONAL_FORMATTING",t[t.PASTE_COLUMN_WIDTHS=7]="PASTE_COLUMN_WIDTHS",t))(Es||{}),Rs=(t=>(t[t.DOCUMENT=0]="DOCUMENT",t[t.PROJECT=1]="PROJECT",t))(Rs||{}),ms=(t=>(t[t.COLUMNS=0]="COLUMNS",t[t.ROWS=1]="ROWS",t))(ms||{}),Os=(t=>(t[t.UP=0]="UP",t[t.RIGHT=1]="RIGHT",t[t.DOWN=2]="DOWN",t[t.LEFT=3]="LEFT",t))(Os||{});function Sr(t){switch(t){case 3:return 1;case 1:return 3;case 0:return 2;case 2:return 0}}var As=(t=>(t[t.NUMBER_FORMAT_TYPE_UNSPECIFIED=0]="NUMBER_FORMAT_TYPE_UNSPECIFIED",t[t.TEXT=1]="TEXT",t[t.NUMBER=2]="NUMBER",t[t.PERCENT=3]="PERCENT",t[t.CURRENCY=4]="CURRENCY",t[t.DATE=5]="DATE",t[t.TIME=6]="TIME",t[t.DATE_TIME=7]="DATE_TIME",t[t.SCIENTIFIC=8]="SCIENTIFIC",t))(As||{}),Is=(t=>(t[t.INTERPOLATION_POINT_TYPE_UNSPECIFIED=0]="INTERPOLATION_POINT_TYPE_UNSPECIFIED",t[t.MIN=1]="MIN",t[t.MAX=2]="MAX",t[t.NUMBER=3]="NUMBER",t[t.PERCENT=4]="PERCENT",t[t.PERCENTILE=5]="PERCENTILE",t))(Is||{}),Yt=(t=>(t.EN_US="enUS",t.ZH_CN="zhCN",t))(Yt||{}),Cs=(t=>(t[t.RANGE=0]="RANGE",t[t.SHEET=1]="SHEET",t))(Cs||{}),Ss=(t=>(t[t.RELATIVE_DATE_UNSPECIFIED=0]="RELATIVE_DATE_UNSPECIFIED",t[t.PAST_YEAR=1]="PAST_YEAR",t[t.PAST_MONTH=2]="PAST_MONTH",t[t.PAST_WEEK=3]="PAST_WEEK",t[t.YESTERDAY=4]="YESTERDAY",t[t.TODAY=5]="TODAY",t[t.TOMORROW=6]="TOMORROW",t))(Ss||{}),Ns=(t=>(t[t.TYPE_UNSPECIFIED=0]="TYPE_UNSPECIFIED",t[t.TEXT_BOX=1]="TEXT_BOX",t[t.RECTANGLE=2]="RECTANGLE",t[t.ROUND_RECTANGLE=3]="ROUND_RECTANGLE",t[t.ELLIPSE=4]="ELLIPSE",t[t.ARC=5]="ARC",t[t.BENT_ARROW=6]="BENT_ARROW",t[t.BENT_UP_ARROW=7]="BENT_UP_ARROW",t[t.BEVEL=8]="BEVEL",t[t.BLOCK_ARC=9]="BLOCK_ARC",t[t.BRACE_PAIR=10]="BRACE_PAIR",t[t.BRACKET_PAIR=11]="BRACKET_PAIR",t[t.CAN=12]="CAN",t[t.CHEVRON=13]="CHEVRON",t[t.CHORD=14]="CHORD",t[t.CLOUD=15]="CLOUD",t[t.CORNER=16]="CORNER",t[t.CUBE=17]="CUBE",t[t.CURVED_DOWN_ARROW=18]="CURVED_DOWN_ARROW",t[t.CURVED_LEFT_ARROW=19]="CURVED_LEFT_ARROW",t[t.CURVED_RIGHT_ARROW=20]="CURVED_RIGHT_ARROW",t[t.CURVED_UP_ARROW=21]="CURVED_UP_ARROW",t[t.DECAGON=22]="DECAGON",t[t.DIAGONAL_STRIPE=23]="DIAGONAL_STRIPE",t[t.DIAMOND=24]="DIAMOND",t[t.DODECAGON=25]="DODECAGON",t[t.DONUT=26]="DONUT",t[t.DOUBLE_WAVE=27]="DOUBLE_WAVE",t[t.DOWN_ARROW=28]="DOWN_ARROW",t[t.DOWN_ARROW_CALLOUT=29]="DOWN_ARROW_CALLOUT",t[t.FOLDED_CORNER=30]="FOLDED_CORNER",t[t.FRAME=31]="FRAME",t[t.HALF_FRAME=32]="HALF_FRAME",t[t.HEART=33]="HEART",t[t.HEPTAGON=34]="HEPTAGON",t[t.HEXAGON=35]="HEXAGON",t[t.HOME_PLATE=36]="HOME_PLATE",t[t.HORIZONTAL_SCROLL=37]="HORIZONTAL_SCROLL",t[t.IRREGULAR_SEAL_1=38]="IRREGULAR_SEAL_1",t[t.IRREGULAR_SEAL_2=39]="IRREGULAR_SEAL_2",t[t.LEFT_ARROW=40]="LEFT_ARROW",t[t.LEFT_ARROW_CALLOUT=41]="LEFT_ARROW_CALLOUT",t[t.LEFT_BRACE=42]="LEFT_BRACE",t[t.LEFT_BRACKET=43]="LEFT_BRACKET",t[t.LEFT_RIGHT_ARROW=44]="LEFT_RIGHT_ARROW",t[t.LEFT_RIGHT_ARROW_CALLOUT=45]="LEFT_RIGHT_ARROW_CALLOUT",t[t.LEFT_RIGHT_UP_ARROW=46]="LEFT_RIGHT_UP_ARROW",t[t.LEFT_UP_ARROW=47]="LEFT_UP_ARROW",t[t.LIGHTNING_BOLT=48]="LIGHTNING_BOLT",t[t.MATH_DIVIDE=49]="MATH_DIVIDE",t[t.MATH_EQUAL=50]="MATH_EQUAL",t[t.MATH_MINUS=51]="MATH_MINUS",t[t.MATH_MULTIPLY=52]="MATH_MULTIPLY",t[t.MATH_NOT_EQUAL=53]="MATH_NOT_EQUAL",t[t.MATH_PLUS=54]="MATH_PLUS",t[t.MOON=55]="MOON",t[t.NO_SMOKING=56]="NO_SMOKING",t[t.NOTCHED_RIGHT_ARROW=57]="NOTCHED_RIGHT_ARROW",t[t.OCTAGON=58]="OCTAGON",t[t.PARALLELOGRAM=59]="PARALLELOGRAM",t[t.PENTAGON=60]="PENTAGON",t[t.PIE=61]="PIE",t[t.PLAQUE=62]="PLAQUE",t[t.PLUS=63]="PLUS",t[t.QUAD_ARROW=64]="QUAD_ARROW",t[t.QUAD_ARROW_CALLOUT=65]="QUAD_ARROW_CALLOUT",t[t.RIBBON=66]="RIBBON",t[t.RIBBON_2=67]="RIBBON_2",t[t.RIGHT_ARROW=68]="RIGHT_ARROW",t[t.RIGHT_ARROW_CALLOUT=69]="RIGHT_ARROW_CALLOUT",t[t.RIGHT_BRACE=70]="RIGHT_BRACE",t[t.RIGHT_BRACKET=71]="RIGHT_BRACKET",t[t.ROUND_1_RECTANGLE=72]="ROUND_1_RECTANGLE",t[t.ROUND_2_DIAGONAL_RECTANGLE=73]="ROUND_2_DIAGONAL_RECTANGLE",t[t.ROUND_2_SAME_RECTANGLE=74]="ROUND_2_SAME_RECTANGLE",t[t.RIGHT_TRIANGLE=75]="RIGHT_TRIANGLE",t[t.SMILEY_FACE=76]="SMILEY_FACE",t[t.SNIP_1_RECTANGLE=77]="SNIP_1_RECTANGLE",t[t.SNIP_2_DIAGONAL_RECTANGLE=78]="SNIP_2_DIAGONAL_RECTANGLE",t[t.SNIP_2_SAME_RECTANGLE=79]="SNIP_2_SAME_RECTANGLE",t[t.SNIP_ROUND_RECTANGLE=80]="SNIP_ROUND_RECTANGLE",t[t.STAR_10=81]="STAR_10",t[t.STAR_12=82]="STAR_12",t[t.STAR_16=83]="STAR_16",t[t.STAR_24=84]="STAR_24",t[t.STAR_32=85]="STAR_32",t[t.STAR_4=86]="STAR_4",t[t.STAR_5=87]="STAR_5",t[t.STAR_6=88]="STAR_6",t[t.STAR_7=89]="STAR_7",t[t.STAR_8=90]="STAR_8",t[t.STRIPED_RIGHT_ARROW=91]="STRIPED_RIGHT_ARROW",t[t.SUN=92]="SUN",t[t.TRAPEZOID=93]="TRAPEZOID",t[t.TRIANGLE=94]="TRIANGLE",t[t.UP_ARROW=95]="UP_ARROW",t[t.UP_ARROW_CALLOUT=96]="UP_ARROW_CALLOUT",t[t.UP_DOWN_ARROW=97]="UP_DOWN_ARROW",t[t.UTURN_ARROW=98]="UTURN_ARROW",t[t.VERTICAL_SCROLL=99]="VERTICAL_SCROLL",t[t.WAVE=100]="WAVE",t[t.WEDGE_ELLIPSE_CALLOUT=101]="WEDGE_ELLIPSE_CALLOUT",t[t.WEDGE_RECTANGLE_CALLOUT=102]="WEDGE_RECTANGLE_CALLOUT",t[t.WEDGE_ROUND_RECTANGLE_CALLOUT=103]="WEDGE_ROUND_RECTANGLE_CALLOUT",t[t.FLOW_CHART_ALTERNATE_PROCESS=104]="FLOW_CHART_ALTERNATE_PROCESS",t[t.FLOW_CHART_COLLATE=105]="FLOW_CHART_COLLATE",t[t.FLOW_CHART_CONNECTOR=106]="FLOW_CHART_CONNECTOR",t[t.FLOW_CHART_DECISION=107]="FLOW_CHART_DECISION",t[t.FLOW_CHART_DELAY=108]="FLOW_CHART_DELAY",t[t.FLOW_CHART_DISPLAY=109]="FLOW_CHART_DISPLAY",t[t.FLOW_CHART_DOCUMENT=110]="FLOW_CHART_DOCUMENT",t[t.FLOW_CHART_EXTRACT=111]="FLOW_CHART_EXTRACT",t[t.FLOW_CHART_INPUT_OUTPUT=112]="FLOW_CHART_INPUT_OUTPUT",t[t.FLOW_CHART_INTERNAL_STORAGE=113]="FLOW_CHART_INTERNAL_STORAGE",t[t.FLOW_CHART_MAGNETIC_DISK=114]="FLOW_CHART_MAGNETIC_DISK",t[t.FLOW_CHART_MAGNETIC_DRUM=115]="FLOW_CHART_MAGNETIC_DRUM",t[t.FLOW_CHART_MAGNETIC_TAPE=116]="FLOW_CHART_MAGNETIC_TAPE",t[t.FLOW_CHART_MANUAL_INPUT=117]="FLOW_CHART_MANUAL_INPUT",t[t.FLOW_CHART_MANUAL_OPERATION=118]="FLOW_CHART_MANUAL_OPERATION",t[t.FLOW_CHART_MERGE=119]="FLOW_CHART_MERGE",t[t.FLOW_CHART_MULTIDOCUMENT=120]="FLOW_CHART_MULTIDOCUMENT",t[t.FLOW_CHART_OFFLINE_STORAGE=121]="FLOW_CHART_OFFLINE_STORAGE",t[t.FLOW_CHART_OFFPAGE_CONNECTOR=122]="FLOW_CHART_OFFPAGE_CONNECTOR",t[t.FLOW_CHART_ONLINE_STORAGE=123]="FLOW_CHART_ONLINE_STORAGE",t[t.FLOW_CHART_OR=124]="FLOW_CHART_OR",t[t.FLOW_CHART_PREDEFINED_PROCESS=125]="FLOW_CHART_PREDEFINED_PROCESS",t[t.FLOW_CHART_PREPARATION=126]="FLOW_CHART_PREPARATION",t[t.FLOW_CHART_PROCESS=127]="FLOW_CHART_PROCESS",t[t.FLOW_CHART_PUNCHED_CARD=128]="FLOW_CHART_PUNCHED_CARD",t[t.FLOW_CHART_PUNCHED_TAPE=129]="FLOW_CHART_PUNCHED_TAPE",t[t.FLOW_CHART_SORT=130]="FLOW_CHART_SORT",t[t.FLOW_CHART_SUMMING_JUNCTION=131]="FLOW_CHART_SUMMING_JUNCTION",t[t.FLOW_CHART_TERMINATOR=132]="FLOW_CHART_TERMINATOR",t[t.ARROW_EAST=133]="ARROW_EAST",t[t.ARROW_NORTH_EAST=134]="ARROW_NORTH_EAST",t[t.ARROW_NORTH=135]="ARROW_NORTH",t[t.SPEECH=136]="SPEECH",t[t.STARBURST=137]="STARBURST",t[t.TEARDROP=138]="TEARDROP",t[t.ELLIPSE_RIBBON=139]="ELLIPSE_RIBBON",t[t.ELLIPSE_RIBBON_2=140]="ELLIPSE_RIBBON_2",t[t.CLOUD_CALLOUT=141]="CLOUD_CALLOUT",t[t.CUSTOM=142]="CUSTOM",t))(Ns||{}),Ie=(t=>(t[t.GRID=0]="GRID",t[t.KANBAN=1]="KANBAN",t[t.GANTT=2]="GANTT",t))(Ie||{}),St=(t=>(t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.LEFT_TO_RIGHT=1]="LEFT_TO_RIGHT",t[t.RIGHT_TO_LEFT=2]="RIGHT_TO_LEFT",t))(St||{}),bs=(t=>(t[t.DASH=0]="DASH",t[t.DASH_DOT_DOT_HEAVY=1]="DASH_DOT_DOT_HEAVY",t[t.DASH_DOT_HEAVY=2]="DASH_DOT_HEAVY",t[t.DASHED_HEAVY=3]="DASHED_HEAVY",t[t.DASH_LONG=4]="DASH_LONG",t[t.DASH_LONG_HEAVY=5]="DASH_LONG_HEAVY",t[t.DOT_DASH=6]="DOT_DASH",t[t.DOT_DOT_DASH=7]="DOT_DOT_DASH",t[t.DOTTED=8]="DOTTED",t[t.DOTTED_HEAVY=9]="DOTTED_HEAVY",t[t.DOUBLE=10]="DOUBLE",t[t.NONE=11]="NONE",t[t.SINGLE=12]="SINGLE",t[t.THICK=13]="THICK",t[t.WAVE=14]="WAVE",t[t.WAVY_DOUBLE=15]="WAVY_DOUBLE",t[t.WAVY_HEAVY=16]="WAVY_HEAVY",t[t.WORDS=17]="WORDS",t))(bs||{}),rt=(t=>(t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.LEFT=1]="LEFT",t[t.CENTER=2]="CENTER",t[t.RIGHT=3]="RIGHT",t[t.JUSTIFIED=4]="JUSTIFIED",t))(rt||{}),at=(t=>(t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.TOP=1]="TOP",t[t.MIDDLE=2]="MIDDLE",t[t.BOTTOM=3]="BOTTOM",t))(at||{}),lt=(t=>(t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.OVERFLOW=1]="OVERFLOW",t[t.CLIP=2]="CLIP",t[t.WRAP=3]="WRAP",t))(lt||{}),xt=(t=>(t[t.NORMAL=0]="NORMAL",t[t.ITALIC=1]="ITALIC",t))(xt||{}),pt=(t=>(t[t.NORMAL=0]="NORMAL",t[t.BOLD=1]="BOLD",t))(pt||{}),Ft=(t=>(t[t.NORMAL=1]="NORMAL",t[t.SUBSCRIPT=2]="SUBSCRIPT",t[t.SUPERSCRIPT=3]="SUPERSCRIPT",t))(Ft||{}),I=(t=>(t[t.FALSE=0]="FALSE",t[t.TRUE=1]="TRUE",t))(I||{}),At=(t=>(t[t.STRING=1]="STRING",t[t.NUMBER=2]="NUMBER",t[t.BOOLEAN=3]="BOOLEAN",t[t.FORCE_STRING=4]="FORCE_STRING",t))(At||{}),p=(t=>(t[t.DARK1=0]="DARK1",t[t.LIGHT1=1]="LIGHT1",t[t.DARK2=2]="DARK2",t[t.LIGHT2=3]="LIGHT2",t[t.ACCENT1=4]="ACCENT1",t[t.ACCENT2=5]="ACCENT2",t[t.ACCENT3=6]="ACCENT3",t[t.ACCENT4=7]="ACCENT4",t[t.ACCENT5=8]="ACCENT5",t[t.ACCENT6=9]="ACCENT6",t[t.HYPERLINK=10]="HYPERLINK",t[t.FOLLOWED_HYPERLINK=11]="FOLLOWED_HYPERLINK",t))(p||{}),Kt=(t=>(t.OFFICE="Office",t.OFFICE_2007_2010="Office 2007-2010",t.GRAYSCALE="Grayscale",t.BLUE_WARM="Blue Warm",t.BLUE="Blue",t.BLUE_II="Blue II",t.BLUE_GREEN="Blue Green",t.GREEN="Green",t.GREEN_YELLOW="Green Yellow",t.YELLOW="Yellow",t.YELLOW_ORANGE="Yellow Orange",t.ORANGE="Orange",t.ORANGE_RED="Orange Red",t.RED_ORANGE="Red Orange",t.RED="Red",t.RED_VIOLET="Red Violet",t.VIOLET="Violet",t.VIOLET_II="Violet II",t.MEDIAN="Median",t.PAPER="Paper",t.MARQUEE="Marquee",t.SLIPSTREAM="Slipstream",t.Aspect="Aspect",t))(Kt||{});const Ls={[Kt.OFFICE]:{[p.ACCENT1]:"#4472C4",[p.ACCENT2]:"#ED7D31",[p.ACCENT3]:"#A5A5A5",[p.ACCENT4]:"#70AD47",[p.ACCENT5]:"#5B9BD5",[p.ACCENT6]:"#70AD47",[p.DARK1]:"#000000",[p.DARK2]:"#44546A",[p.LIGHT1]:"#FFFFFF",[p.LIGHT2]:"#E7E6E6",[p.HYPERLINK]:"#0563C1",[p.FOLLOWED_HYPERLINK]:"#954F72"}};class Xt{constructor(){d(this,"_themeValue",p.LIGHT1);d(this,"_themeColors");d(this,"_themeTint");d(this,"_rgbValue","");d(this,"_colorType");this._colorType=W.UNSUPPORTED,this._themeColors=Kt.OFFICE,this._themeTint=0}asRgbColor(){return new Ht(this._rgbValue,this)}asThemeColor(){return new Bt(this._themeValue,this._themeTint,this._themeColors,this)}build(){switch(this._colorType){case W.THEME:return this.asThemeColor();case W.RGB:return this.asRgbColor();case W.UNSUPPORTED:throw Error("unsupported color type")}}setRgbColor(e){return this._colorType=W.RGB,this._rgbValue=e,this}setThemeColors(e){this._colorType=W.THEME,this._themeColors=e}setThemeTint(e){this._colorType=W.THEME,this._themeTint=e}setThemeColor(e){return this._colorType=W.THEME,this._themeValue=e,this}getColorType(){return this._colorType}}class it{constructor(e){d(this,"_builder");this._builder=e}static rgbColorToHexValue(e){return`#${((1<<24)+(e.getRed()<<16)+(e.getGreen()<<8)+e.getBlue()).toString(16).slice(1)}`}static hexValueToRgbColor(e){e?e.indexOf("#")>-1&&(e=e.substring(1)):e="#000000";const s=+`0x${e[0]}${e[1]}`,n=+`0x${e[2]}${e[3]}`,r=+`0x${e[4]}${e[5]}`;return new Xt().setRgbColor(`rgb(${s},${n},${r})`).asRgbColor()}static hexToRgbString(e){const s=/^#?([a-f\d])([a-f\d])([a-f\d])$/i;e=e.replace(s,(i,o,a,c)=>o+o+a+a+c+c);const n=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);let r=null;if(n){const i=parseInt(n[1],16),o=parseInt(n[2],16),a=parseInt(n[3],16);r=`rgba(${i},${o},${a})`}return r}asRgbColor(){return this._builder.asRgbColor()}asThemeColor(){return this._builder.asThemeColor()}getColorType(){return this._builder.getColorType()}clone(){return new it(this._builder)}equals(e){return!1}}class ws{constructor(e){d(this,"_saturation",0);d(this,"_hue",0);d(this,"_lightness",0);d(this,"_alpha",0);const s=e.getRed()/255,n=e.getGreen()/255,r=e.getBlue()/255,i=e.getAlpha()/255,o=Math.min(s,Math.min(n,r)),a=Math.max(s,Math.max(n,r)),c=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=c/(a+o):this._saturation=c/(2-a-o),s===a&&(this._hue=(n-r)/c),n===a&&(this._hue=2+(r-s)/c),r===a&&(this._hue=4+(s-n)/c),this._hue*=60,this._hue<0&&(this._hue+=360),this._alpha=i}asRgbColor(){const e=new Xt;if(this._saturation===0)return e.setRgbColor(`rgba(${this._lightness*255},${this._lightness*255},${this._lightness*255},${this._alpha*255})`),e.asRgbColor();let s;this._lightness<.5?s=this._lightness*(1+this._saturation):s=this._lightness+this._saturation-this._lightness*this._saturation;const n=2*this._lightness-s,r=this._hue/360,i=r+1/3,o=this.setColor(s,n,i),a=this.setColor(s,n,r),c=r-1/3,l=this.setColor(s,n,c);return e.setRgbColor(`rgba(${Math.round(o*255)},${Math.round(a*255)},${Math.round(l*255)},${this._alpha*255})`),e.asRgbColor()}getLightness(){return this._lightness}getHue(){return this._hue}getSaturation(){return this._saturation}getAlpha(){return this._alpha}setColor(e,s,n){n<0&&(n+=1),n>1&&(n-=1);let r;return 6*n<1?r=s+(e-s)*6*n:2*n<1?r=e:3*n<2?r=s+(e-s)*(2/3-n)*6:r=s,r}setLightness(e){this._lightness=e}}const B=class B extends it{constructor(s,n){super(n);d(this,"_cssString");d(this,"_red");d(this,"_green");d(this,"_blue");d(this,"_alpha");let r=s.match(B.RGBA_EXTRACT);if(r){const i=+r[1],o=+r[2],a=+r[3],c=+r[4];this._cssString=s,this._red=i,this._green=o,this._blue=a,this._alpha=c;return}if(r=s.match(B.RGB_EXTRACT),r){const i=+r[1],o=+r[2],a=+r[3];this._cssString=s,this._red=i,this._green=o,this._blue=a,this._alpha=1;return}throw new Error("Invalid rgba or rgb color")}asHexString(){return it.rgbColorToHexValue(this)}getRed(){let s=this._red+B.RGB_COLOR_AMT;return s>255?s=255:s<0&&(s=0),s}getGreen(){let s=this._green+B.RGB_COLOR_AMT;return s>255?s=255:s<0&&(s=0),s}getBlue(){let s=this._blue+B.RGB_COLOR_AMT;return s>255?s=255:s<0&&(s=0),s}getAlpha(){return this._alpha}getColorType(){return W.RGB}clone(){return new B(this._cssString,this._builder)}asThemeColor(){throw new Error("rgb color not support to themeColor")}equals(s){return s instanceof B?s._red===this._red&&s._blue===this._blue&&s._green===this._green&&s._alpha===this._alpha:!1}getCssString(){return this._cssString}};d(B,"RGB_COLOR_AMT",0),d(B,"RGBA_EXTRACT",new RegExp("\\s*rgba\\s*\\((\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d.\\d|\\d\\s*)\\)\\s*")),d(B,"RGB_EXTRACT",new RegExp("\\s*rgb\\s*\\((\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d+\\s*)\\)\\s*"));let Ht=B;const J=class J extends it{constructor(s,n,r,i){super(i);d(this,"_themeColorType");d(this,"_themeTint");d(this,"_themeColors");this._themeColorType=s,this._themeTint=n,this._themeColors=r}lumValue(s,n){if(s==null)return n;let r;return s<0?r=n*(1+s):r=n*(1-s)+(255-255*(1-s)),r}asRgbColor(){const s=Ls[this._themeColors];if(s==null)throw new Error("not find themeColors type");const n=s[this._themeColorType];if(n==null)throw new Error("not find themeColors value");let r;if(J._cacheThemeColor.has(this._themeColors)){if(r=J._cacheThemeColor.get(this._themeColors),r.has(this._themeColorType))return r.get(this._themeColorType)}else r=new Map,J._cacheThemeColor.set(this._themeColors,r);const i=new ws(it.hexValueToRgbColor(n));i.setLightness(this.lumValue(this._themeTint,i.getLightness()*255)/255);const o=i.asRgbColor();return r.set(this._themeColorType,o),o}clone(){return new J(this._themeColorType,this._themeTint,this._themeColors,this._builder)}equals(s){return s instanceof J?s._themeColorType===this._themeColorType:!1}getColorType(){return W.THEME}getThemeColorType(){return this._themeColorType}};d(J,"_cacheThemeColor",new Map);let Bt=J;const Nr="rgb(",br="rgba(",ae={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 ${constructor(e){d(this,"_color");d(this,"_rgbColor");d(this,"_isValid",!1);if(e==null){this._setNullColor();return}if(e instanceof $){this._color={...e._color},this._rgbColor={...e._rgbColor};return}const s=vs(e);if(s==null){this._setNullColor();return}this._color=s;const n=Tr(this._color);if(n==null){this._setNullColor();return}this._rgbColor=n,this._isValid=!0}static mix(e,s,n){n=Math.min(1,Math.max(0,n));const r=new $(e).toRgb(),i=new $(s).toRgb(),o=r.a??1,a=i.a??1,c={r:(i.r-r.r)*n+r.r,g:(i.g-r.g)*n+r.g,b:(i.b-r.b)*n+r.b,a:(a-o)*n+o};return new $(c)}static getContrastRatio(e,s){const n=new $(e).getLuminance(),r=new $(s).getLuminance();return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}get isValid(){return this._isValid}toRgb(){return this._rgbColor}toRgbString(){const{r:e,g:s,b:n,a:r=1}=this.toRgb(),i=r<1;return`rgb${i?"a":""}(${e},${s},${n}${i?`,${r}`:""})`}toString(){return this.toRgbString()}toHexString(e){const{r:s,g:n,b:r,a:i=1}=this.toRgb(),o=i<1,a=[wt(Math.round(s).toString(16)),wt(Math.round(n).toString(16)),wt(Math.round(r).toString(16)),wt(Math.round(i*255).toString(16))];return e&&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 xr(this.toRgb())}toHsl(){return Pr(this.toRgb())}lighten(e=10){const s=this.toHsl();return s.l+=e,s.l=Math.min(Math.max(s.l,0),100),new $(s)}darken(e=10){const s=this.toHsl();return s.l-=e,s.l=Math.min(Math.max(s.l,0),100),new $(s)}setAlpha(e){return new $({...this._rgbColor,a:e})}getLuminance(){let{r:e,g:s,b:n}=this.toRgb();return e=te(e),s=te(s),n=te(n),Number((.2126*e+.7152*s+.0722*n).toFixed(3))}getBrightness(){const{r:e,g:s,b:n}=this.toRgb();return(e*299+s*587+n*114)/1e3}getAlpha(){return this._color.a??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 wt=t=>t.length===1?`0${t}`:t,te=t=>(t/=255,t<=.03928?t/12.92:((t+.055)/1.055)**2.4),vs=t=>{if(Fr(t)){if("r"in t){const n={r:Math.round(t.r),g:Math.round(t.g),b:Math.round(t.b)};return t.a!==void 0&&(n.a=t.a),n}if("l"in t){const n={h:Math.round(t.h),s:t.s,l:t.l};return t.a!==void 0&&(n.a=t.a),n}const s={h:Math.round(t.h),s:t.s,v:t.v};return t.a!==void 0&&(s.a=t.a),s}const e=t.trim();if(ae[e]){const s=ae[e],n={r:Math.round(s[0]),g:Math.round(s[1]),b:Math.round(s[2])};return n.a=s[3]||1,n}if(e.startsWith("#"))return Lr(e);if(e.startsWith("rgb"))return wr(e);if(e.startsWith("hsl"))return vr(e);if(e.startsWith("hsv"))return Dr(e)},Lr=t=>{const e=t.substring(1),s=new RegExp(`.{1,${e.length>=6?2:1}}`,"g");let n=e.match(s);if(!n||n.length<3)throw new Error(`The color '${t}' is illegal hex color`);n[0].length===1&&(n=n.map(i=>i+i));const r={r:parseInt(n[0],16),g:parseInt(n[1],16),b:parseInt(n[2],16)};return n.length>3&&(r.a=parseInt(n[3],16)/255),r},wr=t=>{const e=t.indexOf("(");if(e===-1)throw new Error(`The color '${t}' is illegal rgb color`);const s=t.substring(e+1,t.length-1).split(",");if(s.length<3)throw new Error(`The color '${t}' is illegal rgb color`);const n={r:parseInt(s[0],10),g:parseInt(s[1],10),b:parseInt(s[2],10)};return s.length>3&&(n.a=parseFloat(s[3])),n},vr=t=>{const e=t.indexOf("(");if(e===-1)throw new Error(`The color '${t}' is illegal hsl color`);const s=t.substring(e+1,t.length-1).split(",");if(s.length<3)throw new Error(`The color '${t}' is illegal hsl color`);const n={h:parseInt(s[0],10),s:parseFloat(s[1]),l:parseFloat(s[2])};return s.length>3&&(n.a=parseFloat(s[3])),n},Dr=t=>{const e=t.indexOf("(");if(e===-1)throw new Error(`The color '${t}' is illegal hsv color`);const s=t.substring(e+1,t.length-1).split(",");if(s.length<3)throw new Error(`The color '${t}' is illegal hsv color`);const n={h:parseInt(s[0],10),s:parseFloat(s[1]),v:parseFloat(s[2])};return s.length>3&&(n.a=parseFloat(s[3])),n},Tr=t=>{const e=vs(t);if(e!=null)return"r"in e?e:"l"in e?Ur(e):Mr(e)},ee=(t,e,s)=>(s<0&&(s+=1),s>1&&(s-=1),s<1/6?t+(e-t)*6*s:s<1/2?e:s<2/3?t+(e-t)*(2/3-s)*6:t),Ur=t=>{let{h:e,s,l:n}=t;e/=360,s/=100,n/=100;let r=0,i=0,o=0;if(s===0)r=i=o=n;else{const c=n<.5?n*(1+s):n+s-n*s,l=2*n-c;r=ee(l,c,e+1/3),i=ee(l,c,e),o=ee(l,c,e-1/3)}const a={r:Math.round(r*255),g:Math.round(i*255),b:Math.round(o*255)};return t.a!==void 0&&(a.a=t.a),a},Mr=t=>{let{h:e,s,v:n}=t;e=e/360*6,s/=100,n/=100;const r=Math.floor(e),i=e-r,o=n*(1-s),a=n*(1-i*s),c=n*(1-(1-i)*s),l=r%6,u=[n,a,o,o,c,n][l],h=[c,n,n,a,o,o][l],f=[o,o,c,n,n,a][l],_={r:u*255,g:h*255,b:f*255};return t.a!==void 0&&(_.a=t.a),_},Pr=t=>{let{r:e,g:s,b:n}=t;e/=255,s/=255,n/=255;const r=Math.max(e,s,n),i=Math.min(e,s,n),o=(r+i)/2;let a,c;if(r===i)a=c=0;else{const u=r-i;switch(c=o>.5?u/(2-r-i):u/(r+i),r){case e:a=(s-n)/u+(s<n?6:0);break;case s:a=(n-e)/u+2;break;default:a=(e-s)/u+4;break}a/=6}const l={h:Math.round(a*360),s:Math.round(c*100),l:Math.round(o*100)};return t.a!==void 0&&(l.a=t.a),l},xr=t=>{let{r:e,g:s,b:n}=t;e/=255,s/=255,n/=255;const r=Math.max(e,s,n),i=Math.min(e,s,n);let o;const a=r,c=r-i,l=r===0?0:c/r;if(r===i)o=0;else{switch(r){case e:o=(s-n)/c+(s<n?6:0);break;case s:o=(n-e)/c+2;break;default:o=(e-s)/c+4;break}o/=6}const u={h:Math.round(o*360),s:Math.round(l*100),v:Math.round(a*100)};return t.a!==void 0&&(u.a=t.a),u},pr=t=>t==null,Fr=t=>!pr(t)&&typeof t=="object";var P=(t=>(t[t.COVER=0]="COVER",t[t.REPLACE=1]="REPLACE",t[t.INTERSECTION=2]="INTERSECTION",t))(P||{});let Hr=(t=21)=>crypto.getRandomValues(new Uint8Array(t)).reduce((e,s)=>(s&=63,s<36?e+=s.toString(36):s<62?e+=(s-26).toString(36).toUpperCase():s>62?e+="-":e+="_",e),"");const Br=/^-ms-/,Wr=/-([a-z])/g,Q=["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"];class m{static stringAt(e){let s="",n=e;for(;n>=Q.length;)n/=Q.length,n-=1,s+=Q[n%Q.length];const r=e%Q.length;return s+=Q[r],s}static indexAt(e){let s=0;for(let n=0;n<e.length-1;n+=1){const r=e.charCodeAt(n)-65,i=e.length-1-n;s+=Q.length**i+Q.length*r}return s+=e.charCodeAt(e.length-1)-65,s}static deleteBlank(e){return m.isString(e)?e.replace(/\s/g,""):e}static getSystemType(){const e=navigator.userAgent,s=navigator.platform==="Win32"||navigator.platform==="Windows",n=navigator.platform==="Mac68K"||navigator.platform==="MacPPC"||navigator.platform==="Macintosh"||navigator.platform==="MacIntel";if(n)return"Mac";if(navigator.platform==="X11"&&!s&&!n)return"Unix";if(String(navigator.platform).indexOf("Linux")>-1)return"Linux";if(s){if(e.indexOf("Windows NT 5.0")>-1||e.indexOf("Windows 2000")>-1)return"Windows 2000";if(e.indexOf("Windows NT 5.1")>-1||e.indexOf("Windows XP")>-1)return"Windows XP";if(e.indexOf("Windows NT 5.2")>-1||e.indexOf("Windows 2003")>-1)return"Windows 2003";if(e.indexOf("Windows NT 6.0")>-1||e.indexOf("Windows Vista")>-1)return"Windows Vista";if(e.indexOf("Windows NT 6.1")>-1||e.indexOf("Windows 7")>-1)return"Windows 7";if(e.indexOf("Windows NT 10")>-1||e.indexOf("Windows 10")>-1)return"Windows 10";if(e.indexOf("Windows NT 11")>-1||e.indexOf("Windows 11")>-1)return"Windows 11"}return"Unknown system"}static getBrowserType(){const e=navigator.userAgent,s=e.indexOf("Opera")>-1,n=e.indexOf("compatible")>-1&&e.indexOf("MSIE")>-1&&!s,r=e.indexOf("Trident")>-1&&e.indexOf("rv:11.0")>-1,i=e.indexOf("Edge")>-1,o=e.indexOf("Firefox")>-1,a=e.indexOf("Safari")>-1&&e.indexOf("Chrome")===-1,c=e.indexOf("Chrome")>-1&&e.indexOf("Safari")>-1;if(n){new RegExp("MSIE (\\d+\\.\\d+);").test(e);const u=parseFloat(RegExp.$1);return u===7?"IE7":u===8?"IE8":u===9?"IE9":u===10?"IE10":"0"}return o?"FF":s?"Opera":a?"Safari":c?"Chrome":i?"Edge":r?"IE11":"Unknown browser"}static generateRandomId(e=21){return Hr(e)}static getClassName(e){return e.constructor.name}static deepMerge(e,...s){s.forEach(o=>o&&i(o));function n(o,a){o.forEach((c,l)=>{if(m.isArray(c)){const u=a[l]??[];a[l]=u,n(c,u);return}if(m.isObject(c)){const u=a[l]??{};a[l]=u,r(c,u);return}a[l]=c})}function r(o,a){Object.keys(o).forEach(c=>{const l=o[c];if(m.isObject(l)){const u=a[c]??{};a[c]=u,r(l,u);return}if(m.isArray(l)){const u=a[c]??[];a[c]=u,n(l,u);return}a[c]=l})}function i(o){Object.keys(o).forEach(a=>{const c=o[a];if(m.isArray(c)){const l=e[a]??[];e[a]=l,n(c,l);return}if(m.isObject(c)){const l=e[a]??{};e[a]=l,r(c,l);return}e[a]=c})}return e}static numberFixed(e,s){return Number(Number(e).toFixed(s))}static diffValue(e,s){function n(o,a){const c=m.getValueType(o),l=m.getValueType(a);return c!==l?!1:m.isArray(o)?r(o,a):m.isObject(o)?i(o,a):m.isDate(o)?o.getTime()===a.getTime():m.isRegExp(o)?o.toString()===a.toString():o===a}function r(o,a){if(e.length!==s.length)return!1;for(let c=0,l=o.length;c<l;c++){const u=o[c],h=a[c];if(!n(u,h))return!1}return!0}function i(o,a){const c=Object.keys(o),l=Object.keys(a);if(c.length!==l.length)return!1;for(const u of c){if(!l.includes(u))return!1;const h=o[u],f=a[u];if(!n(h,f))return!1}return!0}return n(e,s)}static deepClone(e){if(!this.isDefine(e))return e;if(this.isRegExp(e))return new RegExp(e);if(this.isDate(e))return new Date(e);if(this.isArray(e)){const s=[];return e.forEach((n,r)=>{s[r]=m.deepClone(n)}),s}if(this.isObject(e)){const s={};return Object.keys(e).forEach(n=>{const r=e[n];s[n]=m.deepClone(r)}),Object.setPrototypeOf(s,Object.getPrototypeOf(e)),s}return e}static getLanguage(){const e="en-US";return globalThis.navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||e}static getValueType(e){return Object.prototype.toString.apply(e)}static isDefine(e){return e!=null}static isBlank(e){return this.isDefine(e)?this.isString(e)?e.trim()==="":!1:!0}static isAssignableFrom(e,s){return e instanceof s}static isBoolean(e){return this.getValueType(e)==="[object Boolean]"}static isPlainObject(e){return this.isDefine(e)?Object.getPrototypeOf(e)===Object.getPrototypeOf({}):!1}static isFunction(e){return this.getValueType(e)==="[object Function]"}static isDate(e){return this.getValueType(e)==="[object Date]"}static isRegExp(e){return this.getValueType(e)==="[object RegExp]"}static isArray(e){return this.getValueType(e)==="[object Array]"}static isString(e){return this.getValueType(e)==="[object String]"}static isNumber(e){return this.getValueType(e)==="[object Number]"}static isStringNumber(e){return!isNaN(parseFloat(e))&&isFinite(e)}static isObject(e){return this.getValueType(e)==="[object Object]"}static isEmptyObject(e){for(const s in e)return!1;return!0}static isMobile(){let e=0,s=0;return document.body.clientWidth&&(e=document.body.clientWidth),document.body.clientHeight&&(s=document.body.clientHeight),this.isAndroid()||this.isIPhone()||this.isTablet()||e<350&&s<500}static isTablet(){return/ipad|android|android 3.0|xoom|sch-i800|playbook|tablet|kindle/i.test(navigator.userAgent.toLowerCase())}static isWeChat(){const e=navigator.userAgent.toLowerCase();return String(e.match(/MicroMessenger/i))==="micromessenger"}static isAndroid(){const e=navigator.userAgent;return e.indexOf("Android")>-1||e.indexOf("Linux")>-1}static isIPhone(){return/iPhone/i.test(navigator.userAgent)}static itCount(e){return s=>{for(let n=0;n<e;n++)s&&s()}}static hasLength(e,s){return m.isDefine(e)?m.isDefine(s)?e.length===s:e.length>0:!1}static capitalize(e){return e.charAt(0).toUpperCase()+e.slice(1)}static fCamelCase(e,s){return s.toUpperCase()}static camelCase(e){return e.replace(Br,"ms-").replace(Wr,this.fCamelCase)}static removeNull(e){return this.isObject(e)&&Object.keys(e).forEach(s=>{const n=e[s];n==null?delete e[s]:m.removeNull(n)}),e}static fillTwoDimensionalArray(e,s,n){return new Array(e).fill(n).map(r=>new Array(s).fill(n))}static numToWord(e){let s="";for(;e>0;){let n=e%26;n=n===0?n=26:n,s=String.fromCharCode(96+n)+s,e=(e-n)/26}return s.toLocaleUpperCase()}static ABCatNum(e){if(e==null||e.length===0)return NaN;const s=e.toLowerCase().split(""),n=s.length;let r=0,i=0;for(let o=0;o<n;o++)i=s[o].charCodeAt(0)-96,r+=i*26**(n-o-1);return r===0?NaN:r-1}static chatAtABC(e){let i="";for(;e>=0;)i=String.fromCharCode(e%26+97)+i,e=Math.floor(e/26)-1;return i.toUpperCase()}static randSort(e){for(let s=0,n=e.length;s<n;s++){const r=parseInt((Math.random()*n).toString()),i=e[r];e[r]=e[s],e[s]=i}return e}static commonExtend(e,s){const n={};for(const r in e)n[r]=e[r];for(const r in s)s[r]!=null&&(n[r]=s[r]);return n}static commonExtend1(e,s){for(const n in e)s[n]==null&&(s[n]=e[n]);return s}static arrayToObject(e){const s={};return e.forEach((n,r)=>{s[r]={},n.forEach((i,o)=>{s[r][o]=i})}),s}static hasIntersectionBetweenTwoRanges(e,s,n,r){return s>=n&&r>=e}}function Gr(t){if(!t)return;const{actualRow:e,actualColumn:s,isMerged:n,isMergedMainCell:r,mergeInfo:i}=t;let{startY:o,endY:a,startX:c,endX:l}=t,u=e,h=s,f=e,_=s;if(n&&i){const{startRow:g,startColumn:E,endRow:R,endColumn:O,startY:A,endY:L,startX:F,endX:x}=i;u=g,h=E,f=R,_=O,o=A,a=L,c=F,l=x}return r&&(o=i.startY,a=i.endY,c=i.startX,l=i.endX,f=i.endRow,_=i.endColumn),{startRow:u,startColumn:h,endRow:f,endColumn:_,startY:o,endY:a,startX:c,endX:l}}function $r(t){if(!t)return;const{actualRow:e,actualColumn:s,isMerged:n,isMergedMainCell:r,startRow:i,startColumn:o,endRow:a,endColumn:c}=t;let l=e,u=s,h=e,f=s;return(n||r)&&(l=i,u=o,h=a,f=c),{startRow:l,startColumn:u,endRow:h,endColumn:f}}function kr(t){var s;return!t||(((s=t==null?void 0:t.v)==null?void 0:s.toString())||"").length===0&&!t.p}function k(t){if(t){if(t.rgb)return t.rgb;if(t.th)return new Xt().setThemeColor(t.th).asThemeColor().asRgbColor().getCssString()}return null}function Vr(t){return m.isString(t)&&t.substring(0,1)==="="&&t.length>1}function jr(t){return m.isString(t)&&t.indexOf("=")===-1&&t.length===6}function zr(t){return""}function Yr(t,e=!1){var i;let s="";const n=new Map([["ff",()=>{t.ff&&(s+=`font-family: ${t.ff}; `)}],["fs",()=>{if(t.fs){let o=t.fs;t.va&&(o/=2),s+=`font-size: ${o}pt; `}}],["it",()=>{t.it&&(s+="font-style: italic; ")}],["bl",()=>{t.bl&&(s+="font-weight: bold; ")}],["ul",()=>{var o;(o=t.ul)!=null&&o.s&&(s.indexOf("text-decoration-line")>-1?s=s.replace(new RegExp("(?<=text-decoration-line:.*)\\b(?=;)","g")," underline"):s+="text-decoration-line: underline; ",t.ul.cl&&s.indexOf("text-decoration-color")===-1&&(s+=`text-decoration-color: ${k(t.ul.cl)}; `),t.ul.t&&s.indexOf("text-decoration-style")===-1&&(s+=`text-decoration-style: ${t.ul.t} `))}],["st",()=>{var o;(o=t.st)!=null&&o.s&&(s.indexOf("text-decoration-line")>-1?s=s.replace(new RegExp("(?<=text-decoration-line:.*)\\b(?=;)","g")," line-through"):s+="text-decoration-line: line-through; ",t.st.cl&&s.indexOf("text-decoration-color")===-1&&(s+=`text-decoration-color: ${k(t.st.cl)}; `),t.st.t&&s.indexOf("text-decoration-style")===-1&&(s+=`text-decoration-style: ${t.st.t} `))}],["ol",()=>{var o;(o=t.ol)!=null&&o.s&&(s.indexOf("text-decoration-line")>-1?s=s.replace(new RegExp("(?<=text-decoration-line:.*)\\b(?=;)","g")," overline"):s+="text-decoration-line: overline; ",t.ol.cl&&s.indexOf("text-decoration-color")===-1&&(s+=`text-decoration-color: ${k(t.ol.cl)}; `),t.ol.t&&s.indexOf("text-decoration-style")===-1&&(s+=`text-decoration-style: ${t.ol.t} `))}],["bg",()=>{t.bg&&(s+=`background: ${k(t.bg)}; `)}],["bd",()=>{var o,a,c,l,u,h,f,_;(o=t.bd)!=null&&o.b&&(s+=`border-bottom: ${vt((a=t.bd)==null?void 0:a.b.s)} ${k(t.bd.b.cl)??""}; `),(c=t.bd)!=null&&c.t&&(s+=`border-top: ${vt((l=t.bd)==null?void 0:l.t.s)} ${k(t.bd.t.cl)??""}; `),(u=t.bd)!=null&&u.r&&(s+=`border-right: ${vt((h=t.bd)==null?void 0:h.r.s)} ${k(t.bd.r.cl)??""}; `),(f=t.bd)!=null&&f.l&&(s+=`border-left: ${vt((_=t.bd)==null?void 0:_.l.s)} ${k(t.bd.l.cl)??""}; `)}],["cl",()=>{t.cl&&(s+=`color: ${k(t.cl)}; `)}],["va",()=>{t.va===Ft.SUBSCRIPT?s+="vertical-align: sub; ":t.va===Ft.SUPERSCRIPT&&(s+="vertical-align: super; ")}],["td",()=>{t.td===St.LEFT_TO_RIGHT?s+="direction: ltr; ":t.td===St.RIGHT_TO_LEFT&&(s+="direction: rtl; ")}],["tr",()=>{var o,a,c;t.tr&&(s+=`data-rotate: (${(o=t.tr)==null?void 0:o.a}deg${(a=t.tr)!=null&&a.v?` ,${(c=t.tr)==null?void 0:c.v}`:""});`)}],["ht",()=>{t.ht===rt.LEFT?s+="text-align: left; ":t.ht===rt.RIGHT?s+="text-align: right; ":t.ht===rt.CENTER?s+="text-align: center; ":t.ht===rt.JUSTIFIED&&(s+="text-align: justify; ")}],["vt",()=>{t.vt===at.BOTTOM?s+="vertical-align: bottom; ":t.vt===at.TOP?s+="vertical-align: top; ":t.vt===at.MIDDLE&&(s+="vertical-align: middle; ")}],["tb",()=>{t.tb===lt.CLIP?s+="text-overflow: clip; ":t.tb===lt.OVERFLOW?s+="text-break: overflow; ":t.tb===lt.WRAP&&(s+="word-wrap: break-word;")}],["pd",()=>{var u,h,f,_,g,E,R,O;const o=`${(u=t.pd)==null?void 0:u.b}pt`,a=`${(h=t.pd)==null?void 0:h.t}pt`,c=`${(f=t.pd)==null?void 0:f.l}pt`,l=`${(_=t.pd)==null?void 0:_.r}pt`;(g=t.pd)!=null&&g.b&&(s+=`padding-bottom: ${o}; `),(E=t.pd)!=null&&E.t&&(s+=`padding-top: ${a}; `),(R=t.pd)!=null&&R.l&&(s+=`padding-left: ${c}; `),(O=t.pd)!=null&&O.r&&(s+=`padding-right: ${l}; `)}]]),r=["bd","tr","tb"];for(const o in t)e&&r.includes(o)||(i=n.get(o))==null||i();return s}function vt(t){let e="";return t===b.NONE?e="none":t===b.THIN?e="0.5pt solid":t===b.HAIR?e="0.5pt double":t===b.DOTTED?e="0.5pt dotted":t===b.DASHED||t===b.DASH_DOT?e="0.5pt dashed":t===b.DASH_DOT_DOT?e="0.5pt dotted":t===b.DOUBLE?e="0.5pt double":t===b.MEDIUM?e="1pt solid":t===b.MEDIUM_DASHED||t===b.MEDIUM_DASH_DOT?e="1pt dashed":t===b.MEDIUM_DASH_DOT_DOT?e="1pt dotted":t===b.SLANT_DASH_DOT?e="0.5pt dashed":t===b.THICK&&(e="1.5pt solid"),e}function Kr(t){let e=0;if(t=t.trim(),t==="none")e=b.NONE;else if(t==="0.5pt solid")e=b.THIN;else if(t==="0.5pt double")e=b.HAIR;else if(t==="0.5pt dotted")e=b.DOTTED;else if(t==="0.5pt dashed")e=b.DASHED;else if(t==="1pt solid")e=b.MEDIUM;else if(t==="1pt dashed")e=b.MEDIUM_DASHED;else if(t==="1pt dotted")e=b.MEDIUM_DASH_DOT_DOT;else if(t==="1.5pt solid")e=b.THICK;else return b.NONE;return e}function Tt(t,e){let s=t.body;if(e){const{headers:n,footers:r}=t;n!=null&&n[e]?s=n[e].body:r!=null&&r[e]&&(s=r[e].body)}return s}function Xr(t){const{startRow:e,endRow:s,startColumn:n,endColumn:r}=t;return!(e<0||n<0||s<0||r<0)}function Ce(t,e){return Object.prototype.toString.call(t)===Object.prototype.toString.call(e)?Object.prototype.toString.call(t)==="[object Object]"||Object.prototype.toString.call(t)==="[object Array]"?Object.keys(t).length!==Object.keys(e).length?!1:Object.keys(t).every(s=>Ce(t[s],e[s])):t===e:!1}function Ds(t,e){const s=t.ts||{},n=e.ts||{};return t.sId!==e.sId?!1:Ce(s,n)}function Se(t,e,s,n){if(t>e&&([t,e]=[e,t]),s>n&&([s,n]=[n,s]),e<s||n<t)return[t,e];s<t&&(s=t),n>e&&(n=e);const r=n-s+1;let i=[];return t===s?i=[n+1-r,e-r]:e===n?i=[t,s-1]:i=[t,e-r],i}function Qr(t){if(t==null)return!1;const e=t.bullet;return(e==null?void 0:e.listId)!=null}function Zr(t){if(t==null)return!1;const e=t.paragraphStyle;return Ts(e)}function Ts(t){return!(t==null||(t.indentStart==null||t.indentStart===0)&&t.hanging==null||t.hanging===0)}function Us(t,e,s){return t.slice(0,e)+s+t.slice(e)}function Ms(t,e,s){return e>s?t:t.slice(0,e)+t.slice(s)}class Ps{constructor(){d(this,"_include");d(this,"_count");this._include=[],this._count=1}checked(e){return this._include.includes(e)}onlyName(e){let s=e,n=1;for(;this.checked(s);)s=e+n,n++;return this._include.push(s),s}sheetName(e="sheet1"){let s=e;for(;this.checked(s);)s=`sheet${this._count}`,this._count++;return this._include.push(s),s}}var qr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Jr(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var xs={exports:{}};/*! @preserve
4
4
  * numeral.js
5
5
  * version : 2.0.6
6
6
  * author : Adam Draper
7
7
  * license : MIT
8
8
  * http://adamwdraper.github.com/Numeral-js/
9
- */(function(t){(function(e,s){t.exports?t.exports=s():e.numeral=s()})(pr,function(){var e,s,n="2.0.6",r={},i={},o={currentLocale:"en",zeroFormat:null,nullFormat:null,defaultFormat:"0,0",scalePercentBy100:!0},c={currentLocale:o.currentLocale,zeroFormat:o.zeroFormat,nullFormat:o.nullFormat,defaultFormat:o.defaultFormat,scalePercentBy100:o.scalePercentBy100};function u(a,l){this._input=a,this._value=l}return e=function(a){var l,h,d,f;if(e.isNumeral(a))l=a.value();else if(a===0||typeof a>"u")l=0;else if(a===null||s.isNaN(a))l=null;else if(typeof a=="string")if(c.zeroFormat&&a===c.zeroFormat)l=0;else if(c.nullFormat&&a===c.nullFormat||!a.replace(/[^0-9]+/g,"").length)l=null;else{for(h in r)if(f=typeof r[h].regexps.unformat=="function"?r[h].regexps.unformat():r[h].regexps.unformat,f&&a.match(f)){d=r[h].unformat;break}d=d||e._.stringToNumber,l=d(a)}else l=Number(a)||null;return new u(a,l)},e.version=n,e.isNumeral=function(a){return a instanceof u},e._=s={numberToFormat:function(a,l,h){var d=i[e.options.currentLocale],f=!1,g=!1,E=0,R="",A=1e12,m=1e9,v=1e6,H=1e3,p="",ot=!1,W,X,T,$,Zt,pe,Y;if(a=a||0,X=Math.abs(a),e._.includes(l,"(")?(f=!0,l=l.replace(/[\(|\)]/g,"")):(e._.includes(l,"+")||e._.includes(l,"-"))&&(Zt=e._.includes(l,"+")?l.indexOf("+"):a<0?l.indexOf("-"):-1,l=l.replace(/[\+|\-]/g,"")),e._.includes(l,"a")&&(W=l.match(/a(k|m|b|t)?/),W=W?W[1]:!1,e._.includes(l," a")&&(R=" "),l=l.replace(new RegExp(R+"a[kmbt]?"),""),X>=A&&!W||W==="t"?(R+=d.abbreviations.trillion,a=a/A):X<A&&X>=m&&!W||W==="b"?(R+=d.abbreviations.billion,a=a/m):X<m&&X>=v&&!W||W==="m"?(R+=d.abbreviations.million,a=a/v):(X<v&&X>=H&&!W||W==="k")&&(R+=d.abbreviations.thousand,a=a/H)),e._.includes(l,"[.]")&&(g=!0,l=l.replace("[.]",".")),T=a.toString().split(".")[0],$=l.split(".")[1],pe=l.indexOf(","),E=(l.split(".")[0].split(",")[0].match(/0/g)||[]).length,$?(e._.includes($,"[")?($=$.replace("]",""),$=$.split("["),p=e._.toFixed(a,$[0].length+$[1].length,h,$[1].length)):p=e._.toFixed(a,$.length,h),T=p.split(".")[0],e._.includes(p,".")?p=d.delimiters.decimal+p.split(".")[1]:p="",g&&Number(p.slice(1))===0&&(p="")):T=e._.toFixed(a,0,h),R&&!W&&Number(T)>=1e3&&R!==d.abbreviations.trillion)switch(T=String(Number(T)/1e3),R){case d.abbreviations.thousand:R=d.abbreviations.million;break;case d.abbreviations.million:R=d.abbreviations.billion;break;case d.abbreviations.billion:R=d.abbreviations.trillion;break}if(e._.includes(T,"-")&&(T=T.slice(1),ot=!0),T.length<E)for(var xe=E-T.length;xe>0;xe--)T="0"+T;return pe>-1&&(T=T.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1"+d.delimiters.thousands)),l.indexOf(".")===0&&(T=""),Y=T+p+(R||""),f?Y=(f&&ot?"(":"")+Y+(f&&ot?")":""):Zt>=0?Y=Zt===0?(ot?"-":"+")+Y:Y+(ot?"-":"+"):ot&&(Y="-"+Y),Y},stringToNumber:function(a){var l=i[c.currentLocale],h=a,d={thousand:3,million:6,billion:9,trillion:12},f,g,E;if(c.zeroFormat&&a===c.zeroFormat)g=0;else if(c.nullFormat&&a===c.nullFormat||!a.replace(/[^0-9]+/g,"").length)g=null;else{g=1,l.delimiters.decimal!=="."&&(a=a.replace(/\./g,"").replace(l.delimiters.decimal,"."));for(f in d)if(E=new RegExp("[^a-zA-Z]"+l.abbreviations[f]+"(?:\\)|(\\"+l.currency.symbol+")?(?:\\))?)?$"),h.match(E)){g*=Math.pow(10,d[f]);break}g*=(a.split("-").length+Math.min(a.split("(").length-1,a.split(")").length-1))%2?1:-1,a=a.replace(/[^0-9\.]+/g,""),g*=Number(a)}return g},isNaN:function(a){return typeof a=="number"&&isNaN(a)},includes:function(a,l){return a.indexOf(l)!==-1},insert:function(a,l,h){return a.slice(0,h)+l+a.slice(h)},reduce:function(a,l){if(this===null)throw new TypeError("Array.prototype.reduce called on null or undefined");if(typeof l!="function")throw new TypeError(l+" is not a function");var h=Object(a),d=h.length>>>0,f=0,g;if(arguments.length===3)g=arguments[2];else{for(;f<d&&!(f in h);)f++;if(f>=d)throw new TypeError("Reduce of empty array with no initial value");g=h[f++]}for(;f<d;f++)f in h&&(g=l(g,h[f],f,h));return g},multiplier:function(a){var l=a.toString().split(".");return l.length<2?1:Math.pow(10,l[1].length)},correctionFactor:function(){var a=Array.prototype.slice.call(arguments);return a.reduce(function(l,h){var d=s.multiplier(h);return l>d?l:d},1)},toFixed:function(a,l,h,d){var f=a.toString().split("."),g=l-(d||0),E,R,A,m;return f.length===2?E=Math.min(Math.max(f[1].length,g),l):E=g,A=Math.pow(10,E),m=(h(a+"e+"+E)/A).toFixed(E),d>l-E&&(R=new RegExp("\\.?0{1,"+(d-(l-E))+"}$"),m=m.replace(R,"")),m}},e.options=c,e.formats=r,e.locales=i,e.locale=function(a){return a&&(c.currentLocale=a.toLowerCase()),c.currentLocale},e.localeData=function(a){if(!a)return i[c.currentLocale];if(a=a.toLowerCase(),!i[a])throw new Error("Unknown locale : "+a);return i[a]},e.reset=function(){for(var a in o)c[a]=o[a]},e.zeroFormat=function(a){c.zeroFormat=typeof a=="string"?a:null},e.nullFormat=function(a){c.nullFormat=typeof a=="string"?a:null},e.defaultFormat=function(a){c.defaultFormat=typeof a=="string"?a:"0.0"},e.register=function(a,l,h){if(l=l.toLowerCase(),this[a+"s"][l])throw new TypeError(l+" "+a+" already registered.");return this[a+"s"][l]=h,h},e.validate=function(a,l){var h,d,f,g,E,R,A,m;if(typeof a!="string"&&(a+="",console.warn&&console.warn("Numeral.js: Value is not string. It has been co-erced to: ",a)),a=a.trim(),a.match(/^\d+$/))return!0;if(a==="")return!1;try{A=e.localeData(l)}catch{A=e.localeData(e.locale())}return f=A.currency.symbol,E=A.abbreviations,h=A.delimiters.decimal,A.delimiters.thousands==="."?d="\\.":d=A.delimiters.thousands,m=a.match(/^[^\d]+/),m!==null&&(a=a.substr(1),m[0]!==f)||(m=a.match(/[^\d]+$/),m!==null&&(a=a.slice(0,-1),m[0]!==E.thousand&&m[0]!==E.million&&m[0]!==E.billion&&m[0]!==E.trillion))?!1:(R=new RegExp(d+"{2}"),a.match(/[^\d.,]/g)?!1:(g=a.split(h),g.length>2?!1:g.length<2?!!g[0].match(/^\d+.*\d$/)&&!g[0].match(R):g[0].length===1?!!g[0].match(/^\d+$/)&&!g[0].match(R)&&!!g[1].match(/^\d+$/):!!g[0].match(/^\d+.*\d$/)&&!g[0].match(R)&&!!g[1].match(/^\d+$/)))},e.fn=u.prototype={clone:function(){return e(this)},format:function(a,l){var h=this._value,d=a||c.defaultFormat,f,g,E;if(l=l||Math.round,h===0&&c.zeroFormat!==null)g=c.zeroFormat;else if(h===null&&c.nullFormat!==null)g=c.nullFormat;else{for(f in r)if(d.match(r[f].regexps.format)){E=r[f].format;break}E=E||e._.numberToFormat,g=E(h,d,l)}return g},value:function(){return this._value},input:function(){return this._input},set:function(a){return this._value=Number(a),this},add:function(a){var l=s.correctionFactor.call(null,this._value,a);function h(d,f,g,E){return d+Math.round(l*f)}return this._value=s.reduce([this._value,a],h,0)/l,this},subtract:function(a){var l=s.correctionFactor.call(null,this._value,a);function h(d,f,g,E){return d-Math.round(l*f)}return this._value=s.reduce([a],h,Math.round(this._value*l))/l,this},multiply:function(a){function l(h,d,f,g){var E=s.correctionFactor(h,d);return Math.round(h*E)*Math.round(d*E)/Math.round(E*E)}return this._value=s.reduce([this._value,a],l,1),this},divide:function(a){function l(h,d,f,g){var E=s.correctionFactor(h,d);return Math.round(h*E)/Math.round(d*E)}return this._value=s.reduce([this._value,a],l),this},difference:function(a){return Math.abs(e(this._value).subtract(a).value())}},e.register("locale","en",{delimiters:{thousands:",",decimal:"."},abbreviations:{thousand:"k",million:"m",billion:"b",trillion:"t"},ordinal:function(a){var l=a%10;return~~(a%100/10)===1?"th":l===1?"st":l===2?"nd":l===3?"rd":"th"},currency:{symbol:"$"}}),function(){e.register("format","bps",{regexps:{format:/(BPS)/,unformat:/(BPS)/},format:function(a,l,h){var d=e._.includes(l," BPS")?" ":"",f;return a=a*1e4,l=l.replace(/\s?BPS/,""),f=e._.numberToFormat(a,l,h),e._.includes(f,")")?(f=f.split(""),f.splice(-1,0,d+"BPS"),f=f.join("")):f=f+d+"BPS",f},unformat:function(a){return+(e._.stringToNumber(a)*1e-4).toFixed(15)}})}(),function(){var a={base:1e3,suffixes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]},l={base:1024,suffixes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]},h=a.suffixes.concat(l.suffixes.filter(function(f){return a.suffixes.indexOf(f)<0})),d=h.join("|");d="("+d.replace("B","B(?!PS)")+")",e.register("format","bytes",{regexps:{format:/([0\s]i?b)/,unformat:new RegExp(d)},format:function(f,g,E){var R,A=e._.includes(g,"ib")?l:a,m=e._.includes(g," b")||e._.includes(g," ib")?" ":"",v,H,p;for(g=g.replace(/\s?i?b/,""),v=0;v<=A.suffixes.length;v++)if(H=Math.pow(A.base,v),p=Math.pow(A.base,v+1),f===null||f===0||f>=H&&f<p){m+=A.suffixes[v],H>0&&(f=f/H);break}return R=e._.numberToFormat(f,g,E),R+m},unformat:function(f){var g=e._.stringToNumber(f),E,R;if(g){for(E=a.suffixes.length-1;E>=0;E--){if(e._.includes(f,a.suffixes[E])){R=Math.pow(a.base,E);break}if(e._.includes(f,l.suffixes[E])){R=Math.pow(l.base,E);break}}g*=R||1}return g}})}(),function(){e.register("format","currency",{regexps:{format:/(\$)/},format:function(a,l,h){var d=e.locales[e.options.currentLocale],f={before:l.match(/^([\+|\-|\(|\s|\$]*)/)[0],after:l.match(/([\+|\-|\)|\s|\$]*)$/)[0]},g,E,R;for(l=l.replace(/\s?\$\s?/,""),g=e._.numberToFormat(a,l,h),a>=0?(f.before=f.before.replace(/[\-\(]/,""),f.after=f.after.replace(/[\-\)]/,"")):a<0&&!e._.includes(f.before,"-")&&!e._.includes(f.before,"(")&&(f.before="-"+f.before),R=0;R<f.before.length;R++)switch(E=f.before[R],E){case"$":g=e._.insert(g,d.currency.symbol,R);break;case" ":g=e._.insert(g," ",R+d.currency.symbol.length-1);break}for(R=f.after.length-1;R>=0;R--)switch(E=f.after[R],E){case"$":g=R===f.after.length-1?g+d.currency.symbol:e._.insert(g,d.currency.symbol,-(f.after.length-(1+R)));break;case" ":g=R===f.after.length-1?g+" ":e._.insert(g," ",-(f.after.length-(1+R)+d.currency.symbol.length-1));break}return g}})}(),function(){e.register("format","exponential",{regexps:{format:/(e\+|e-)/,unformat:/(e\+|e-)/},format:function(a,l,h){var d,f=typeof a=="number"&&!e._.isNaN(a)?a.toExponential():"0e+0",g=f.split("e");return l=l.replace(/e[\+|\-]{1}0/,""),d=e._.numberToFormat(Number(g[0]),l,h),d+"e"+g[1]},unformat:function(a){var l=e._.includes(a,"e+")?a.split("e+"):a.split("e-"),h=Number(l[0]),d=Number(l[1]);d=e._.includes(a,"e-")?d*=-1:d;function f(g,E,R,A){var m=e._.correctionFactor(g,E),v=g*m*(E*m)/(m*m);return v}return e._.reduce([h,Math.pow(10,d)],f,1)}})}(),function(){e.register("format","ordinal",{regexps:{format:/(o)/},format:function(a,l,h){var d=e.locales[e.options.currentLocale],f,g=e._.includes(l," o")?" ":"";return l=l.replace(/\s?o/,""),g+=d.ordinal(a),f=e._.numberToFormat(a,l,h),f+g}})}(),function(){e.register("format","percentage",{regexps:{format:/(%)/,unformat:/(%)/},format:function(a,l,h){var d=e._.includes(l," %")?" ":"",f;return e.options.scalePercentBy100&&(a=a*100),l=l.replace(/\s?\%/,""),f=e._.numberToFormat(a,l,h),e._.includes(f,")")?(f=f.split(""),f.splice(-1,0,d+"%"),f=f.join("")):f=f+d+"%",f},unformat:function(a){var l=e._.stringToNumber(a);return e.options.scalePercentBy100?l*.01:l}})}(),function(){e.register("format","time",{regexps:{format:/(:)/,unformat:/(:)/},format:function(a,l,h){var d=Math.floor(a/60/60),f=Math.floor((a-d*60*60)/60),g=Math.round(a-d*60*60-f*60);return d+":"+(f<10?"0"+f:f)+":"+(g<10?"0"+g:g)},unformat:function(a){var l=a.split(":"),h=0;return l.length===3?(h=h+Number(l[0])*60*60,h=h+Number(l[1])*60,h=h+Number(l[2])):l.length===2&&(h=h+Number(l[0])*60,h=h+Number(l[1])),Number(h)}})}(),e})})(ps);var Fr=ps.exports;const tt=xr(Fr),re={v:"#VALUE!",n:"#NAME?",na:"#N/A",r:"#REF!",d:"#DIV/0!",nm:"#NUM!",nl:"#NULL!",sp:"#SPILL!"};function Hr(t){let e=!1;for(const s in re)if(t===re[s]){e=!0;break}return e}function et(t){return t===null||t.toString().replace(/\s/g,"")===""||typeof t=="boolean"?!1:!isNaN(t)}function Wr(t){if(t===null||t.toString().length<5)return!1;if(e(t))return!0;return!1;function e(s){const n=/^(\d{4})-(\d{1,2})-(\d{1,2})(\s(\d{1,2}):(\d{1,2})(:(\d{1,2}))?)?$/,r=/^(\d{4})\/(\d{1,2})\/(\d{1,2})(\s(\d{1,2}):(\d{1,2})(:(\d{1,2}))?)?$/;if(!n.test(s)&&!r.test(s))return!1;const i=RegExp.$1,o=RegExp.$2,c=RegExp.$3;return!(i<1900||o>12||c>31||o===2&&(new Date(i,1,29).getDate()===29&&c>29||new Date(i,1,29).getDate()!==29&&c>28))}}let Wt=new Date("2017-02-19T19:06:09.000Z");Number.isNaN(Wt.getFullYear())&&(Wt=new Date("2/19/17"));const Br=Wt.getFullYear()===2017;function Gr(t,e){const s=new Date(t);if(Br)return e>0?s.setTime(s.getTime()+s.getTimezoneOffset()*60*1e3):e<0&&s.setTime(s.getTime()-s.getTimezoneOffset()*60*1e3),s;if(t instanceof Date)return t;if(Wt.getFullYear()===1917&&!Number.isNaN(s.getFullYear())){const i=s.getFullYear();return t.indexOf(`${i}`)>-1||s.setFullYear(s.getFullYear()+100),s}const n=t.match(/\d+/g)||["2017","2","19","0","0","0"];let r=new Date(+n[0],+n[1]-1,+n[2],+n[3]||0,+n[4]||0,+n[5]||0);return t.indexOf("Z")>-1&&(r=new Date(r.getTime()-r.getTimezoneOffset()*60*1e3)),r}const $r=new Date(1900,2,1,0,0,0);function xs(t,e){let s=Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds());const n=Date.UTC(1899,11,31,0,0,0);return e?s-=1461*24*60*60*1e3:t>=$r&&(s+=24*60*60*1e3),(s-n)/(24*60*60*1e3)}function kr(t){let e=null,s={},n=t;if(t===null)return null;if(/^-?[0-9]{1,}[,][0-9]{3}(.[0-9]{1,2})?$/.test(t)){e=t,n=Number(t.split(".")[0].replace(",",""));let r="#,##0";if(t.split(".")[1]){r="#,##0.";for(let i=0;i<t.split(".")[1].length;i++)r+=0}s={fa:r,t:"n"}}else if(t.toString().substr(0,1)==="'")e=t.toString().substr(1),s={fa:"@",t:"s"};else if(t.toString().toUpperCase()==="TRUE")e="TRUE",s={fa:"General",t:"b"},n=!0;else if(t.toString().toUpperCase()==="FALSE")e="FALSE",s={fa:"General",t:"b"},n=!1;else if(Hr(t))e=t.toString(),s={fa:"General",t:"e"};else if(/^\d{6}(18|19|20)?\d{2}(0[1-9]|1[12])(0[1-9]|[12]\d|3[01])\d{3}(\d|X)$/i.test(t))e=t.toString(),s={fa:"@",t:"s"};else if(et(t)&&Math.abs(parseFloat(t))>0&&(Math.abs(parseFloat(t))>=1e11||Math.abs(parseFloat(t))<1e-9)){n=tt(t).value();const r=n.toExponential();if(r.indexOf(".")>-1){let i=r.split(".")[1].split("e")[0].length;i>5&&(i=5),s={fa:`#0.${new Array(i+1).join("0")}E+00`,t:"n"}}else s={fa:"#0.E+00",t:"n"};e=J.format(s.fa,n)}else if(t.toString().indexOf("%")>-1){const r=t.toString().indexOf("%"),i=t.toString().substr(0,r),o=i.replace(/,/g,"");if(r===t.toString().length-1&&et(o))if(i.indexOf(".")>-1)if(i.indexOf(".")===i.lastIndexOf(".")){const c=i.split(".")[0];let a=i.split(".")[1].length;if(a>9&&(a=9),c.indexOf(",")>-1){let l=!0;const h=c.split(",");for(let d=1;d<h.length;d++)if(h[d].length<3){l=!1;break}l?(s={fa:`#,##0.${new Array(a+1).join("0")}%`,t:"n"},n=tt(t).value(),e=J.format(s.fa,n)):(e=t.toString(),s={fa:"@",t:"s"})}else s={fa:`0.${new Array(a+1).join("0")}%`,t:"n"},n=tt(t).value(),e=J.format(s.fa,n)}else e=t.toString(),s={fa:"@",t:"s"};else if(i.indexOf(",")>-1){let c=!0;const u=i.split(",");for(let a=1;a<u.length;a++)if(u[a].length<3){c=!1;break}c?(s={fa:"#,##0%",t:"n"},n=tt(t).value(),e=J.format(s.fa,n)):(e=t.toString(),s={fa:"@",t:"s"})}else s={fa:"0%",t:"n"},n=tt(t).value(),e=J.format(s.fa,n);else e=t.toString(),s={fa:"@",t:"s"}}else if(t.toString().indexOf(".")>-1)if(t.toString().indexOf(".")===t.toString().lastIndexOf(".")){const r=t.toString().split(".")[0],i=t.toString().split(".")[1];let o=i.length;if(o>9&&(o=9),r.indexOf(",")>-1){let c=!0;const u=r.split(",");for(let a=1;a<u.length;a++)if(!et(u[a])||u[a].length<3){c=!1;break}c?(s={fa:`#,##0.${new Array(o+1).join("0")}`,t:"n"},n=tt(t).value(),e=J.format(s.fa,n)):(e=t.toString(),s={fa:"@",t:"s"})}else et(r)&&et(i)?(s={fa:`0.${new Array(o+1).join("0")}`,t:"n"},n=tt(t).value(),e=J.format(s.fa,n)):(e=t.toString(),s={fa:"@",t:"s"})}else e=t.toString(),s={fa:"@",t:"s"};else et(t)?(e=t.toString(),s={fa:"General",t:"n"},n=parseFloat(t)):Wr(t)&&(t.toString().indexOf(".")>-1||t.toString().indexOf(":")>-1||t.toString().length<16)?(n=xs(Gr(t.toString().replace(/-/g,"/"))),n.toString().indexOf(".")>-1?t.toString().length>18?s.fa="yyyy-MM-dd hh:mm:ss":t.toString().length>11?s.fa="yyyy-MM-dd hh:mm":s.fa="yyyy-MM-dd":s.fa="yyyy-MM-dd",s.t="d",e=J.format(s.fa,n)):(e=t,s.fa="General",s.t="g");return[e,s,n]}const J={format(t,e){}},jr=(t,e)=>{};function Vr(t){let e=0;for(let s=0;s<t.length;s++)e=t.charCodeAt(s)+(e<<6)+(e<<16)-e;return e>>>0}class Et{static hasLength(e,s){return e.length===s}static getValueType(e){return Object.prototype.toString.apply(e)}static isObject(e){return this.getValueType(e)==="[object Object]"}static isIterable(e){return e[Symbol.iterator]!=null}static isNumber(e){return this.getValueType(e)==="[object Number]"}}const N=Symbol("newer"),U=Symbol("older");class Fs{constructor(e){_(this,"entry");this.entry=e}[Symbol.iterator](){return this}next(){const e=this.entry;return e?(this.entry=e[N],{done:!1,value:e.key}):{done:!0,value:void 0}}}class Hs{constructor(e){_(this,"entry");this.entry=e}[Symbol.iterator](){return this}next(){const e=this.entry;return e?(this.entry=e[N],{done:!1,value:e.value}):{done:!0,value:void 0}}}class Ws{constructor(e){_(this,"entry");this.entry=e}[Symbol.iterator](){return this}next(){const e=this.entry;return e?(this.entry=e[N],{done:!1,value:[e.key,e.value]}):{done:!0,value:void 0}}}var bo,wo;class ie{constructor(e,s){_(this,"key");_(this,"value");_(this,bo);_(this,wo);this.key=e,this.value=s,this[N]=void 0,this[U]=void 0}toJSON(){return{key:this.key,value:this.value}}}bo=N,wo=U;class zr{constructor(...e){_(this,"_keymap");_(this,"size",0);_(this,"limit");_(this,"oldest");_(this,"newest");_(this,"_onShiftListeners",[]);if(Et.hasLength(e,1)){if(Et.isNumber(e[0])){const s=e[0];this._initialize(s,void 0);return}if(Et.isIterable(e[0])){const s=e[0];this._initialize(0,s);return}return}if(Et.hasLength(e,2)){const s=e[0],n=e[1];this._initialize(s,n)}}onShift(e){if(this._onShiftListeners.indexOf(e)===-1)return this._onShiftListeners.push(e),D(()=>y(this._onShiftListeners,e));throw new Error("[LRUMap]: the listener has been registered!")}_initialize(e,s){this.oldest=void 0,this.newest=void 0,this.size=0,this.limit=e,this._keymap=new Map,s&&(this.assign(s),e<1&&(this.limit=this.size))}_markEntryAsUsed(e){e!==this.newest&&(e[N]&&(e===this.oldest&&(this.oldest=e[N]),e[N][U]=e[U]),e[U]&&(e[U][N]=e[N]),e[N]=void 0,e[U]=this.newest,this.newest&&(this.newest[N]=e),this.newest=e)}assign(e){let s,n=this.limit||Number.MAX_VALUE;this._keymap.clear();const r=e[Symbol.iterator]();for(let i=r.next();!i.done;i=r.next()){const o=new ie(i.value[0],i.value[1]);if(this._keymap.set(o.key,o),s?(s[N]=o,o[U]=s):this.oldest=o,s=o,n--===0)throw new Error("overflow")}this.newest=s,this.size=this._keymap.size}set(e,s){let n=this._keymap.get(e);return n?(n.value=s,this._markEntryAsUsed(n),this):(this._keymap.set(e,n=new ie(e,s)),this.newest?(this.newest[N]=n,n[U]=this.newest):this.oldest=n,this.newest=n,++this.size,this.size>this.limit&&this.shift(),this)}shift(){const e=this.oldest;if(e)return this.oldest&&this.oldest[N]?(this.oldest=this.oldest[N],this.oldest[U]=void 0):(this.oldest=void 0,this.newest=void 0),e[N]=e[U]=void 0,this._keymap.delete(e.key),--this.size,this._onShiftListeners.forEach(s=>s(e)),[e.key,e.value]}get(e){const s=this._keymap.get(e);if(s)return this._markEntryAsUsed(s),s.value}has(e){return this._keymap.has(e)}find(e){const s=this._keymap.get(e);return s?s.value:void 0}delete(e){const s=this._keymap.get(e);if(s)return this._keymap.delete(s.key),s[N]&&s[U]?(s[U][N]=s[N],s[N][U]=s[U]):s[N]?(s[N][U]=void 0,this.oldest=s[N]):s[U]?(s[U][N]=void 0,this.newest=s[U]):this.oldest=this.newest=void 0,this.size--,s.value}clear(){this.oldest=void 0,this.newest=void 0,this.size=0,this._keymap.clear()}keys(){return new Fs(this.oldest)}values(){return new Hs(this.oldest)}entries(){return this[Symbol.iterator]()}[Symbol.iterator](){return new Ws(this.oldest)}forEach(e,s){typeof s!="object"&&(s=this);let n=this.oldest;for(;n;)e.call(s,n.value,n.key,this),n=n[N]}toJSON(){const e=new Array(this.size);let s=0,n=this.oldest;for(;n;)e[s++]={key:n.key,value:n.value},n=n[N];return e}toString(){let e="",s=this.oldest;for(;s;)e+=`${String(s.key)}:${s.value}`,s=s[N],s&&(e+=" < ");return e}}var Se=(t=>(t.INIT="init",t.FETCHING="fetching",t.DONE="done",t))(Se||{});class Bs{constructor(){_(this,"status","init")}}const Kr=t=>t.some(e=>e.status==="init")?"init":t.some(e=>e.status==="fetching")?"fetching":"done";var z=(t=>(t[t.NORMAL=0]="NORMAL",t[t.ROW=1]="ROW",t[t.COLUMN=2]="COLUMN",t[t.ALL=3]="ALL",t))(z||{}),K=(t=>(t[t.NONE=0]="NONE",t[t.ROW=1]="ROW",t[t.COLUMN=2]="COLUMN",t[t.ALL=3]="ALL",t))(K||{});function Yr(t){return[t.startRow,t.startColumn,t.endRow,t.endColumn]}const q=class q{static clone(e){return{startRow:e.startRow,startColumn:e.startColumn,endRow:e.endRow,endColumn:e.endColumn,rangeType:e.rangeType}}static equals(e,s){return e.endRow===s.endRow&&e.endColumn===s.endColumn&&e.startRow===s.startRow&&e.startColumn===s.startColumn&&(e.rangeType===s.rangeType||e.rangeType===void 0&&s.rangeType===z.NORMAL||s.rangeType===void 0&&e.rangeType===z.NORMAL)}static intersects(e,s){const n=e.startRow,r=e.endRow,i=e.startColumn,o=e.endColumn,c=s.startRow,u=s.endRow,a=s.startColumn,l=s.endColumn,h=Math.abs(i+o-a-l),d=Math.abs(i-o)+Math.abs(a-l),f=Math.abs(n+r-c-u),g=Math.abs(n-r)+Math.abs(c-u);return h<=d&&f<=g}static getIntersects(e,s){const n=e.startRow,r=e.endRow,i=e.startColumn,o=e.endColumn,c=s.startRow,u=s.endRow,a=s.startColumn,l=s.endColumn;let h,d,f,g;if(c<=r)c>=n?d=c:d=n;else return null;if(u>=n)u>=r?g=r:g=u;else return null;if(a<=o)a>i?h=a:h=i;else return null;if(l>=i)l>=o?f=o:f=l;else return null;return{startRow:d,endRow:g,startColumn:h,endColumn:f,rangeType:z.NORMAL}}static contains(e,s){return e.startRow<=s.startRow&&e.endRow>=s.endRow&&e.startColumn<=s.startColumn&&e.endColumn>=s.endColumn}static realContain(e,s){return q.contains(e,s)&&(e.startRow<s.startRow||e.endRow>s.endRow||e.startColumn<s.startColumn||e.endColumn>s.endColumn)}static union(...e){return e.reduce((s,n)=>({startRow:Math.min(s.startRow,n.startRow),startColumn:Math.min(s.startColumn,n.startColumn),endRow:Math.max(s.endRow,n.endRow),endColumn:Math.max(s.endColumn,n.endColumn),rangeType:z.NORMAL}),e[0])}};_(q,"getRelativeRange",(e,s)=>({startRow:e.startRow-s.startRow,endRow:e.endRow-e.startRow,startColumn:e.startColumn-s.startColumn,endColumn:e.endColumn-e.startColumn})),_(q,"getPositionRange",(e,s)=>({startRow:e.startRow+s.startRow,endRow:e.endRow+e.startRow+s.startRow,startColumn:e.startColumn+s.startColumn,endColumn:e.endColumn+e.startColumn+s.startColumn})),_(q,"moveHorizontal",(e,s=0,n=0)=>({...e,startColumn:e.startColumn+s,endColumn:e.endColumn+s+n})),_(q,"moveVertical",(e,s=0,n=0)=>({...e,startRow:e.startRow+s,endRow:e.endRow+s+n})),_(q,"moveOffset",(e,s,n)=>({...e,startRow:e.startRow+n,endRow:e.endRow+n,startColumn:e.startColumn+s,endColumn:e.endColumn+s}));let lt=q;class Xr{constructor(e,s){_(this,"_values",[]);_(this,"_keys",[]);_(this,"_keyMaps",new Map);this._values=e,this._keys=s,e.forEach(n=>{this._initKeyMap(n)})}_initKeyMap(e){this._keys.forEach(s=>{const n=e[s],r=this._keyMaps.get(s)||new Map;r.set(n,e),this._keyMaps.set(s,r)})}getValue(e){for(let s=0;s<this._keys.length;s++){const n=this._keyMaps.get(this._keys[s]);if(n!=null&&n.has(e))return n.get(e)}return null}hasValue(e){for(let s=0;s<this._keys.length;s++){const n=this._keyMaps.get(this._keys[s]);if(n!=null&&n.has(e))return!0}return!1}addValue(e){this._values.push(e),this._initKeyMap(e)}setValue(e,s,n){const r=this.getValue(e);r&&Object.keys(r).includes(s)&&(r[s]=n)}deleteValue(e){const s=this.getValue(e);if(s){this._keys.forEach(r=>{const i=this._keyMaps.get(r),o=s[r];i==null||i.delete(o)});const n=this._values.findIndex(r=>r===s);this._values.splice(n,1)}}getValues(){return this._values}getKeyMap(e){var s;return[...((s=this._keyMaps.get(e))==null?void 0:s.keys())||[]]}clear(){this._values=[],this._keys=[],this._keyMaps.clear()}}function oe(t,e,s,n){return{forEach(r){for(let i=t;i<=e;i++)for(let o=s;o<=n;o++)r(i,o)}}}function Qr(t){if(t==null||t.length===0)return NaN;const e=t.toLowerCase().split(""),s=e.length,n=o=>o.charCodeAt(0)-96;let r=0,i=0;for(let o=0;o<s;o++)i=n(e[o]),r+=i*26**(s-o-1);return r===0?NaN:r-1}const Bt=65,Gs=90,Jr=97;function Zr(t){const e=Gs-Bt+1;let s="";for(;t>=0;)s=String.fromCharCode(t%e+Bt)+s,t=Math.floor(t/e)-1;return s}function $s(t,e){let s="";for(;e>0;)s+=t,e--;return s}function qr(t,e=!1){const s=Gs-Bt+1;let n=Jr;e&&(n=Bt);const r=String.fromCharCode(t%s+n),i=Math.floor(t/s)+1;return $s(r,i)}function yr(t,e){return t.zIndex>e.zIndex?1:t.zIndex===e.zIndex?0:-1}function ti(t,e){return t.zIndex>e.zIndex?-1:t.zIndex===e.zIndex?0:1}function gt(t="index",e=1){return(s,n)=>s[t]>n[t]?e:s[t]===n[t]?0:-e}var ks=(t=>(t[t.PARAGRAPH=0]="PARAGRAPH",t[t.SECTION_BREAK=1]="SECTION_BREAK",t[t.TABLE=2]="TABLE",t[t.TABLE_ROW=3]="TABLE_ROW",t[t.TABLE_CELL=4]="TABLE_CELL",t))(ks||{}),Ne=(t=>(t.PARAGRAPH="\r",t.SECTION_BREAK=`
10
- `,t.TABLE_START="",t.TABLE_ROW_START="\x1B",t.TABLE_CELL_START="",t.TABLE_CELL_END="",t.TABLE_ROW_END="",t.TABLE_END="",t.CUSTOM_RANGE_START="",t.CUSTOM_RANGE_END="",t.COLUMN_BREAK="\v",t.PAGE_BREAK="\f",t.DOCS_END="\0",t.TAB=" ",t.CUSTOM_BLOCK="\b",t.LETTER="",t.SPACE=" ",t))(Ne||{});function js(t){const e=[];for(const s of t){const{st:n,ed:r}=s;if(n===r)continue;if(e.length===0){e.push(s);continue}const i=e.pop();Us(s,i)&&O.hasIntersectionBetweenTwoRanges(i.st,i.ed,s.st,s.ed)?e.push({...s,st:i.st,ed:r}):e.push(i,s)}return e}function Vs(t,e,s,n){const{textRuns:r}=t;if(r==null)return;const i=[],o=r.length;let c=!1;const u=e.textRuns??[];if(u.length)for(let a=0,l=u.length;a<l;a++){const h=u[a];h.st+=n,h.ed+=n}for(let a=0;a<o;a++){const l=r[a],{st:h,ed:d}=l;if(d<n)i.push(l);else if(n>=h&&n<=d)if(c)l.st+=s,l.ed+=s,i.push(l);else{c=!0,l.ed+=s;const f=[];if(u.length){const g={...l,st:h,ed:u[0].st};f.push(g),f.push(...u);const E=u[u.length-1],R={...l,st:E.ed,ed:d+s};f.push(R)}else f.push(l);i.push(...f)}else l.st+=s,l.ed+=s,c||(c=!0,i.push(...u)),i.push(l)}c||(c=!0,i.push(...u)),t.textRuns=js(i)}function be(t,e,s,n){const{paragraphs:r}=t;if(r==null)return;const{paragraphs:i,dataStream:o}=e,c=[];let u=-1;for(let l=0,h=r.length;l<h;l++){const d=r[l],{startIndex:f}=d;f>=n&&(d.startIndex+=s),u===-1&&f>=n&&(u=l),c.push(d.startIndex)}let a=-1;if(i){for(let l=0,h=i.length;l<h;l++){const d=i[l];d.startIndex+=n;const f=d.startIndex;a=c.indexOf(f)}if(o===Ne.PARAGRAPH&&i.length===1){const l=r[u],h=i[0],d=l.paragraphStyle,f=l.bullet;l.paragraphStyle=h.paragraphStyle,l.bullet=h.bullet,h.paragraphStyle=d,h.bullet=f}a!==-1&&r.splice(a,1),r.push(...i),r.sort(gt("startIndex"))}}function ei(t,e,s,n){const{sectionBreaks:r}=t;if(r==null)return;for(let o=0,c=r.length;o<c;o++){const u=r[o],{startIndex:a}=u;a>=n&&(u.startIndex+=s)}const i=e.sectionBreaks;if(i){for(let o=0,c=i.length;o<c;o++){const u=i[o];u.startIndex+=n}r.push(...i),r.sort(gt("startIndex"))}}function zs(t,e,s,n){const{customBlocks:r}=t;if(r==null)return;for(let o=0,c=r.length;o<c;o++){const u=r[o],{startIndex:a}=u;a>=n&&(u.startIndex+=s)}const i=e.customBlocks;if(i){for(let o=0,c=i.length;o<c;o++){const u=i[o];u.startIndex+=n}r.push(...i),r.sort(gt("startIndex"))}}function we(t,e,s,n){const{tables:r}=t;if(r==null)return;for(let o=0,c=r.length;o<c;o++){const u=r[o],{startIndex:a,endIndex:l}=u;a>n?(u.startIndex+=s,u.endIndex+=s):l>=n-1&&(u.endIndex+=s)}const i=e.tables;if(i){for(let o=0,c=i.length;o<c;o++){const u=i[o];u.startIndex+=n,u.endIndex+=n}r.push(...i),r.sort(gt("startIndex"))}}function si(t,e,s,n){const{customRanges:r}=t;if(r==null)return;for(let o=0,c=r.length;o<c;o++){const u=r[o],{startIndex:a,endIndex:l}=u;a>n?(u.startIndex+=s,u.endIndex+=s):l>=n-1&&(u.endIndex+=s)}const i=e.customRanges;if(i){for(let o=0,c=i.length;o<c;o++){const u=i[o];u.startIndex+=n,u.endIndex+=n}r.push(...i),r.sort(gt("startIndex"))}}function Ks(t,e,s){const{textRuns:n}=t,r=s,i=s+e,o=[];if(n){const c=[];for(let u=0,a=n.length;u<a;u++){const l=n[u],{st:h,ed:d}=l;if(r<=h&&i>=d){o.push({...l,st:h-r,ed:d-r});continue}else h<=r&&d>=i?(o.push({...l,st:r-r,ed:i-r}),l.ed-=e):r>=h&&r<d?(o.push({...l,st:r-r,ed:d-r}),l.ed=r):i>h&&i<=d?(o.push({...l,st:h-r,ed:i-r}),l.st=i-e,l.ed-=e):h>=i&&(l.st-=e,l.ed-=e);c.push(l)}t.textRuns=c}return o}function Ys(t,e,s){const{paragraphs:n}=t,r=s,i=s+e,o=[];if(n){const c=[];for(let u=0,a=n.length;u<a;u++){const l=n[u],{startIndex:h}=l;if(h>=r&&h<i){o.push({...l,startIndex:h-s});continue}else h>=i&&(l.startIndex-=e);c.push(l)}t.paragraphs=c}return o}function Xs(t,e,s){const{sectionBreaks:n}=t,r=s,i=s+e-1,o=[];if(n){const c=[];for(let u=0,a=n.length;u<a;u++){const l=n[u],{startIndex:h}=l;if(h>=r&&h<=i){o.push({...l,startIndex:h-s});continue}else h>i&&(l.startIndex-=e);c.push(l)}t.sectionBreaks=c}return o}function Qs(t,e,s){const{customBlocks:n}=t,r=s,i=s+e-1,o=[];if(n){const c=[];for(let u=0,a=n.length;u<a;u++){const l=n[u],{startIndex:h}=l;if(h>=r&&h<=i){o.push({...l,startIndex:h-s});continue}else h>i&&(l.startIndex-=e);c.push(l)}t.customBlocks=c}return o}function Js(t,e,s){const{tables:n}=t,r=s,i=s+e-1,o=[];if(n){const c=[];for(let u=0,a=n.length;u<a;u++){const l=n[u],{startIndex:h,endIndex:d}=l;if(r<=h&&i>=d){o.push({...l,startIndex:h-s,endIndex:d-s});continue}else if(h<=r&&d>=i){const f=Ie(h,d,r,i);l.startIndex=f[0],l.endIndex=f[1]}else i<h&&(l.startIndex-=e,l.endIndex-=e);c.push(l)}t.tables=c}return o}function Zs(t,e,s){const{customRanges:n}=t,r=s,i=s+e-1,o=[];if(n){const c=[];for(let u=0,a=n.length;u<a;u++){const l=n[u],{startIndex:h,endIndex:d}=l;if(r<=h&&i>=d){o.push({...l,startIndex:h-s,endIndex:d-s});continue}else if(h<=r&&d>=i){const f=Ie(h,d,r,i);l.startIndex=f[0],l.endIndex=f[1]}else i<h&&(l.startIndex-=e,l.endIndex-=e);c.push(l)}t.customRanges=c}return o}function ni(t,e,s){const{dataStream:n}=t,r=s,i=s+e,o=Ks(t,e,s),c=Ys(t,e,s),u=Xs(t,e,s),a=Qs(t,e,s),l=Js(t,e,s),h=Zs(t,e,s);let d="";return n&&(t.dataStream=Ps(n,r,i),d=n.slice(r,i)),{dataStream:d,textRuns:o,paragraphs:c,sectionBreaks:u,customBlocks:a,tables:l,customRanges:h}}function ri(t,e,s,n){t.dataStream=Ts(t.dataStream,n,e.dataStream),Vs(t,e,s,n),be(t,e,s,n),ei(t,e,s,n),zs(t,e,s,n),we(t,e,s,n),si(t,e,s,n)}function ii(t,e,s,n,r){const i=oi(t,e,s,n,r),o=ai(t,e,s,n,r),c=li(t,e,s,n,r),u=ui(t,e,s,n,r),a=hi(t,e,s,n,r),l=_i(t,e,s,n,r);return{dataStream:"",textRuns:i,paragraphs:o,sectionBreaks:c,customBlocks:u,tables:a,customRanges:l}}function oi(t,e,s,n,r){const{textRuns:i}=t,{textRuns:o}=e;if(i==null||o==null)return;const c=Ks(t,s,n);if(r!==P.REPLACE){const u=ci(o,c,r);e.textRuns=u}return Vs(t,e,s,n),c}function ci(t,e,s){if(e.length===0)return t;t=O.deepClone(t),e=O.deepClone(e);const n=[],r=t.length,i=e.length;let o=0,c=0,u=null;function a(){return u?(n.push(u),u=null,!0):!1}for(;o<r&&c<i;){const{st:f,ed:g,ts:E}=t[o],{st:R,ed:A,ts:m,sId:v}=e[c];let H;s===P.COVER?H={...m,...E}:H={...E,...m},g<R?(a()||n.push(t[o]),o++):A<f?(a()||n.push(e[c]),c++):(n.push({st:Math.min(f,R),ed:Math.max(f,R),ts:f<R?{...E}:{...m},sId:f<R?void 0:v}),n.push({st:Math.max(f,R),ed:Math.min(g,A),ts:H,sId:v}),g<A?(o++,e[c].st=g):(c++,t[o].st=A),u={st:Math.min(g,A),ed:Math.max(g,A),ts:g<A?{...m}:{...E},sId:g<A?v:void 0})}a();const l=n[n.length-1],h=t[r-1],d=e[i-1];return l.ed!==Math.max(h.ed,d.ed)&&(h.ed>d.ed?n.push(h):n.push(d)),js(n)}function ai(t,e,s,n,r){const{paragraphs:i}=t,{paragraphs:o}=e;if(i==null||o==null)return;const c=Ys(t,s,n);if(r!==P.REPLACE){const u=[];for(const a of o){const{startIndex:l,paragraphStyle:h,bullet:d}=a;let f=[];for(const g of c){const{startIndex:E,paragraphStyle:R,bullet:A}=g;let m,v;if(r===P.COVER?(m={...R,...h},v={listId:"",nestingLevel:0,textStyle:{},...A,...d}):(m={...h,...R},v={listId:"",nestingLevel:0,textStyle:{},...d,...A}),l===E){f.push({startIndex:l,paragraphStyle:m,bullet:v});break}}u.push(...f),f=[]}e.paragraphs=u}return be(t,e,s,n),c}function li(t,e,s,n,r){const{sectionBreaks:i}=t,{sectionBreaks:o}=e;if(i==null||o==null)return;const c=Xs(t,s,n);if(r!==P.REPLACE){const u=[];for(const a of o){const{startIndex:l}=a;let h=[];for(const d of c){const{startIndex:f}=d;if(l===f){r===P.COVER?h.push({...d,...a}):h.push({...a,...d});break}}u.push(...h),h=[]}e.sectionBreaks=u}return be(t,e,s,n),c}function ui(t,e,s,n,r){const{customBlocks:i}=t,{customBlocks:o}=e;if(i==null||o==null)return;const c=Qs(t,s,n);if(r!==P.REPLACE){const u=[];for(const a of o){const{startIndex:l}=a;let h=[];for(const d of c){const{startIndex:f}=d;if(l===f){r===P.COVER?h.push({...d,...a}):h.push({...a,...d});break}}u.push(...h),h=[]}e.customBlocks=u}return zs(t,e,s,n),c}function hi(t,e,s,n,r){const{tables:i}=t,{tables:o}=e;if(i==null||o==null)return;const c=Js(t,s,n);if(r!==P.REPLACE){const u=[];for(const a of o){const{startIndex:l,endIndex:h}=a;let d=[];for(const f of c){const{startIndex:g,endIndex:E}=f;if(g>=l&&E<=h){r===P.COVER?d.push({...f,...a}):d.push({...a,...f});break}}u.push(...d),d=[]}e.tables=u}return we(t,e,s,n),c}function _i(t,e,s,n,r){const{customRanges:i}=t,{tables:o}=e;if(i==null||o==null)return;const c=Zs(t,s,n);if(r!==P.REPLACE){const u=[];for(const a of o){const{startIndex:l,endIndex:h}=a;let d=[];for(const f of c){const{startIndex:g,endIndex:E}=f;if(g>=l&&E<=h){r===P.COVER?d.push({...f,...a}):d.push({...a,...f});break}}u.push(...d),d=[]}e.customRanges=u}return we(t,e,s,n),c}const Le={id:"default_doc",documentStyle:{}};class di{constructor(e){_(this,"snapshot");this.snapshot={...Le,...e}}get drawings(){return this.snapshot.drawings}get documentStyle(){return this.snapshot.documentStyle}get lists(){return this.snapshot.lists}get body(){return this.snapshot.body}get zoomRatio(){var e;return((e=this.snapshot.settings)==null?void 0:e.zoomRatio)||1}getBody(){return this.snapshot.body}getShouldRenderLoopImmediately(){return this.snapshot.shouldStartRenderingImmediately!==!1}getContainer(){return this.snapshot.container}getParentRenderUnitId(){return this.snapshot.parentRenderUnitId}getSnapshot(){return this.snapshot}updateDocumentId(e){this.snapshot.id=e}updateDocumentRenderConfig(e){const{documentStyle:s}=this.snapshot;s.renderConfig==null?s.renderConfig=e:s.renderConfig={...s.renderConfig,...e}}updateDocumentDataMargin(e){const{t:s,l:n,b:r,r:i}=e,{documentStyle:o}=this.snapshot;s!=null&&(o.marginTop=s),n!=null&&(o.marginLeft=n),r!=null&&(o.marginBottom=r),i!=null&&(o.marginRight=i)}updateDocumentDataPageSize(e,s){const{documentStyle:n}=this.snapshot;if(!n.pageSize){e=e??1/0,s=s??1/0,n.pageSize={width:e,height:s};return}e!==void 0&&(n.pageSize.width=e),s!==void 0&&(n.pageSize.height=s)}updateDrawing(e,s){const{drawings:n}=this,{width:r,height:i,left:o,top:c}=s,u=n==null?void 0:n[e];if(!u)return;const a=u.objectTransform;a.size.width=r,a.size.height=i,a.positionH.posOffset=o,a.positionV.posOffset=c}setZoomRatio(e=1){this.snapshot.settings==null?this.snapshot.settings={zoomRatio:e}:this.snapshot.settings.zoomRatio=1}}class _t extends di{constructor(s){super(s);_(this,"_unitId");_(this,"headerModelMap",new Map);_(this,"footerModelMap",new Map);const n=6;this._unitId=this.snapshot.id??O.generateRandomId(n),this._initializeHeaderFooterModel()}dispose(){this.headerModelMap.forEach(s=>{s.dispose()}),this.footerModelMap.forEach(s=>{s.dispose()})}getRev(){return this.snapshot.rev??0}incrementRev(){this.snapshot.rev=this.getRev()+1}getSettings(){return this.snapshot.settings}reset(s){if(s.id&&s.id!==this._unitId)throw new Error("Cannot reset a document model with a different unit id!");this.snapshot={...Le,...s},this._initializeHeaderFooterModel()}getSelfOrHeaderFooterModel(s){if(s!=null){if(this.headerModelMap.has(s))return this.headerModelMap.get(s);if(this.footerModelMap.has(s))return this.footerModelMap.get(s)}return this}getUnitId(){return this._unitId}apply(s){const n=[],r=new hs;return r.reset(),s.forEach(i=>{if(i=O.deepClone(i),i.t==="r"){const{coverType:o,body:c,len:u,segmentId:a}=i;if(c!=null){const l=this._updateApply(c,u,r.cursor,o,a);n.push({...i,t:"r",coverType:P.REPLACE,body:l})}else n.push({...i,t:"r"});r.moveCursor(u)}else if(i.t==="i"){const{body:o,len:c,segmentId:u,line:a}=i;this._insertApply(o,c,r.cursor,u),r.moveCursor(c),n.push({t:"d",len:c,line:a,segmentId:u})}else if(i.t==="d"){const{len:o,segmentId:c}=i,u=this._deleteApply(o,r.cursor,c);n.push({...i,t:"i",body:u})}else throw new Error(`Unknown mutation type for mutation: ${i}.`)}),n}_updateApply(s,n,r,i=P.COVER,o){if(s==null)throw new Error("updateBody is none");const c=this.snapshot,u=Lt(c,o);if(u==null)throw new Error("no body has changed");return ii(u,s,n,r,i)}_deleteApply(s,n,r){const i=this.snapshot,o=Lt(i,r);if(o==null)throw new Error("no body has changed");return s<=0?{dataStream:""}:ni(o,s,n)}_insertApply(s,n,r,i){const o=this.snapshot,c=Lt(o,i);if(n!==0){if(c==null)throw new Error("no body has changed");ri(c,s,n,r)}}_initializeHeaderFooterModel(){const{headers:s,footers:n}=this.getSnapshot();if(s)for(const r in s){const i=s[r];this.headerModelMap.set(r,new _t(i))}if(n)for(const r in n){const i=n[r];this.footerModelMap.set(r,new _t(i))}}updateDocumentId(s){super.updateDocumentId(s),this._unitId=s}}var qs=(t=>(t.INSERT_ROW_DATA_ACTION="InsertRowDataAction",t.REMOVE_ROW_DATA_ACTION="RemoveRowDataAction",t.INSERT_ROW_ACTION="InsertRowAction",t.REMOVE_ROW_ACTION="RemoveRowAction",t.SET_RANGE_STYLE_ACTION="SetRangeStyleAction",t.SET_SELECTION_ACTION="SetSelectionActivateAction",t.SET_RANGE_DATA_ACTION="SetRangeDataAction",t.SET_RANGE_FORMATTED_VALUE_ACTION="SetRangeFormattedValueAction",t.SET_RANGE_NOTE_ACTION="SetRangeNoteAction",t.DELETE_RANGE_ACTION="DeleteRangeAction",t.INSERT_SHEET_ACTION="InsertSheetAction",t.REMOVE_SHEET_ACTION="RemoveSheetAction",t.CLEAR_RANGE_ACTION="ClearRangeAction",t.INSERT_RANGE_ACTION="InsertRangeAction",t.SET_TAB_COLOR_ACTION="SetTabColorAction",t.HIDE_SHEET_ACTION="SetWorkSheetHideAction",t.SET_WORKSHEET_ACTIVATE_ACTION="SetWorkSheetActivateAction",t.INSERT_COLUMN_ACTION="InsertColumnAction",t.INSERT_COLUMN_DATA_ACTION="InsertColumnDataAction",t.REMOVE_COLUMN_ACTION="RemoveColumnAction",t.REMOVE_COLUMN_DATA_ACTION="RemoveColumnDataAction",t.SET_HIDE_ROW_ACTION="SetRowHideAction",t.SET_HIDE_COLUMN_ACTION="SetColumnHideAction",t.SET_SHOW_ROW_ACTION="SetRowShowAction",t.SET_SHOW_COLUMN_ACTION="SetColumnShowAction",t.ADD_MERGE_ACTION="AddMergeAction",t.REMOVE_MERGE_ACTION="RemoveMergeAction",t.SET_WORKSHEET_NAME_ACTION="SetWorkSheetNameAction",t.SET_WORKSHEET_STATUS_ACTION="SetWorkSheetStatusAction",t.SET_BORDER_ACTION="SetBorderAction",t.SET_COLUMN_WIDTH_ACTION="SetColumnWidthAction",t.SET_ROW_HEIGHT_ACTION="SetRowHeightAction",t.SET_HIDDEN_GRIDLINES_ACTION="SetHiddenGridlinesAction",t.SET_RIGHT_TO_LEFT_ACTION="SetRightToLeftAction",t.DELETE_BANDING_ACTION="DeleteBandingAction",t.SET_BANDING_ACTION="SetBandingAction",t.ADD_BANDING_ACTION="AddBandingAction",t.DELETE_NAMED_RANGE_ACTION="DeleteNamedRangeAction",t.SET_NAMED_RANGE_ACTION="SetNamedRangeAction",t.ADD_NAMED_RANGE_ACTION="AddNamedRangeAction",t.SET_SHEET_ORDER_ACTION="SetSheetOrderAction",t.SET_ZOOM_RATIO_ACTION="SetZoomRatioAction",t.SET_FROZEN_COLUMNS_ACTION="SetFrozenColumnsAction",t.SET_FROZEN_ROWS_ACTION="SetFrozenRowsAction",t))(qs||{});const Rt={sheetId:"",range:{startRow:-1,endRow:-1,startColumn:-1,endColumn:-1}},fi={startRow:-1,startColumn:-1,endRow:-1,endColumn:-1},gi={startRow:0,startColumn:0,endRow:0,endColumn:0},Ei={row:0,column:0},ys={id:"",sheetOrder:[],name:"",appVersion:"",locale:zt.ZH_CN,styles:{},sheets:{},resources:[]},tn=1e3,en=20,sn=19,nn=73,rn=46,on=20,Gt={type:Ae.GRID,name:"Sheet1",id:"sheet-01",tabColor:"",hidden:I.FALSE,rowCount:tn,columnCount:en,zoomRatio:1,freeze:{xSplit:0,ySplit:0,startRow:-1,startColumn:-1},scrollTop:0,scrollLeft:0,defaultColumnWidth:nn,defaultRowHeight:sn,mergeData:[],hideRow:[],hideColumn:[],cellData:{},rowData:{},columnData:{},status:I.FALSE,showGridlines:I.TRUE,rowHeader:{width:rn,hidden:I.FALSE},columnHeader:{height:on,hidden:I.FALSE},selections:["A1"],rightToLeft:I.FALSE,pluginMeta:{}},vt={ff:"Times New Roman",fs:14,it:I.FALSE,bl:I.FALSE,ul:{s:I.FALSE},st:{s:I.FALSE},ol:{s:I.FALSE},tr:{a:0,v:I.FALSE},td:It.UNSPECIFIED,cl:{rgb:"#000"},bg:{rgb:"#fff"},ht:st.UNSPECIFIED,vt:ct.UNSPECIFIED,tb:at.UNSPECIFIED,pd:{t:0,r:0,b:0,l:0}},cn={id:"default_slide",title:"defaultSlide",pageSize:{width:300,height:300}};var an=(t=>(t.ARRAY_CONVERTOR="ARRAY_CONVERTOR",t.MATRIX_CONVERTOR="MATRIX_CONVERTOR",t))(an||{});class ln{constructor(e={},s=100){_(this,"_styles");_(this,"_cacheMap",new Map);_(this,"_maxCacheSize");this._styles=e,this._maxCacheSize=s,this._generateCacheMap()}each(e){return Object.entries(this._styles).forEach(e),this}search(e){const s=JSON.stringify(e);if(this._cacheMap.has(s)){const r=this._cacheMap.get(s);return this._cacheMap.delete(s),this._cacheMap.set(s,r),r}const n=this.getExistingStyleId(e);return n||"-1"}get(e){return typeof e!="string"?e:(e=String(e),this._styles[e])}add(e){const s=O.generateRandomId(6);this._styles[s]=e;const n=JSON.stringify(e);if(this._cacheMap.set(n,s),this._cacheMap.size>this._maxCacheSize){const r=this._cacheMap.entries().next().value;this._cacheMap.delete(r[0])}return s}setValue(e){if(e==null)return;const s=this.search(e);return s!=="-1"?s:this.add(e)}toJSON(){return this._styles}getStyleByCell(e){let s;e&&O.isObject(e.s)?s=e.s:s=(e==null?void 0:e.s)&&this.get(e.s);const n=e==null?void 0:e.interceptorStyle;return n?{...s,...n}:s}_generateCacheMap(){const{_styles:e,_cacheMap:s}=this;let n=0;for(const r in e){const i=JSON.stringify(e[r]);if(s.set(i,r),n++,n>=this._maxCacheSize)break}}getExistingStyleId(e){const{_styles:s}=this;for(const n in s)if(O.diffValue(s[n],e))return n;return null}}function Ri(t){return t&&(t.s!==void 0||t.p!==void 0||t.v!==void 0)||t.f!==void 0||t.si!==void 0}function Oi(t){if(t.t!==void 0)return t.t;if(typeof t.v=="string")return At.STRING;if(typeof t.v=="number")return At.NUMBER;if(typeof t.v=="boolean")return At.BOOLEAN}function Ai(t){if(t==null)return!0;const{v:e,f:s,si:n,p:r,s:i}=t;return!(!(e==null||typeof e=="string"&&e.length===0)||s!=null&&s.length>0||n!=null&&n.length>0||r!=null)}var un=(t=>(t[t.character=0]="character",t[t.paragraph=1]="paragraph",t[t.table=2]="table",t[t.numbering=3]="numbering",t))(un||{}),hn=(t=>(t[t.TAB=0]="TAB",t[t.SPACE=1]="SPACE",t[t.NOTHING=2]="NOTHING",t))(hn||{}),_n=(t=>(t[t.GLYPH_TYPE_UNSPECIFIED=0]="GLYPH_TYPE_UNSPECIFIED",t[t.NONE=1]="NONE",t[t.DECIMAL=2]="DECIMAL",t[t.ZERO_DECIMAL=3]="ZERO_DECIMAL",t[t.UPPER_ALPHA=4]="UPPER_ALPHA",t[t.ALPHA=5]="ALPHA",t[t.UPPER_ROMAN=6]="UPPER_ROMAN",t[t.ROMAN=7]="ROMAN",t))(_n||{}),dn=(t=>(t[t.BULLET_ALIGNMENT_UNSPECIFIED=0]="BULLET_ALIGNMENT_UNSPECIFIED",t[t.START=1]="START",t[t.CENTER=2]="CENTER",t[t.END=3]="END",t))(dn||{}),fn=(t=>(t[t.HYPERLINK=0]="HYPERLINK",t[t.FIELD=1]="FIELD",t[t.SDT=2]="SDT",t[t.BOOKMARK=3]="BOOKMARK",t[t.COMMENT=4]="COMMENT",t[t.CUSTOM=5]="CUSTOM",t))(fn||{}),gn=(t=>(t[t.DRAWING=0]="DRAWING",t[t.CUSTOM=1]="CUSTOM",t))(gn||{}),En=(t=>(t[t.DEFAULT=0]="DEFAULT",t[t.LINES=1]="LINES",t[t.LINES_AND_CHARS=2]="LINES_AND_CHARS",t[t.SNAP_TO_CHARS=3]="SNAP_TO_CHARS",t))(En||{}),Rn=(t=>(t[t.SECTION_TYPE_UNSPECIFIED=0]="SECTION_TYPE_UNSPECIFIED",t[t.CONTINUOUS=1]="CONTINUOUS",t[t.NEXT_PAGE=2]="NEXT_PAGE",t[t.EVEN_PAGE=3]="EVEN_PAGE",t[t.ODD_PAGE=4]="ODD_PAGE",t))(Rn||{}),On=(t=>(t[t.COLUMN_SEPARATOR_STYLE_UNSPECIFIED=0]="COLUMN_SEPARATOR_STYLE_UNSPECIFIED",t[t.NONE=1]="NONE",t[t.BETWEEN_EACH_COLUMN=2]="BETWEEN_EACH_COLUMN",t))(On||{}),An=(t=>(t[t.NORMAL=0]="NORMAL",t[t.TBRL=1]="TBRL",t[t.LRTBV=2]="LRTBV",t))(An||{}),mn=(t=>(t[t.TEXT_RUN=0]="TEXT_RUN",t[t.AUTO_TEXT=1]="AUTO_TEXT",t[t.PAGE_BREAK=2]="PAGE_BREAK",t[t.COLUMN_BREAK=3]="COLUMN_BREAK",t[t.FOOT_NOTE_REFERENCE=4]="FOOT_NOTE_REFERENCE",t[t.HORIZONTAL_RULE=5]="HORIZONTAL_RULE",t[t.EQUATION=6]="EQUATION",t[t.DRAWING=7]="DRAWING",t[t.PERSON=8]="PERSON",t[t.RICH_LINK=9]="RICH_LINK",t))(mn||{}),In=(t=>(t[t.BOTH_SIDES=0]="BOTH_SIDES",t[t.LEFT=1]="LEFT",t[t.RIGHT=2]="RIGHT",t[t.LARGEST=3]="LARGEST",t))(In||{}),Cn=(t=>(t[t.INLINE=0]="INLINE",t[t.WRAP_NONE=1]="WRAP_NONE",t[t.WRAP_POLYGON=2]="WRAP_POLYGON",t[t.WRAP_SQUARE=3]="WRAP_SQUARE",t[t.WRAP_THROUGH=4]="WRAP_THROUGH",t[t.WRAP_TIGHT=5]="WRAP_TIGHT",t[t.WRAP_TOP_AND_BOTTOM=6]="WRAP_TOP_AND_BOTTOM",t))(Cn||{}),Sn=(t=>(t[t.NAMED_STYLE_TYPE_UNSPECIFIED=0]="NAMED_STYLE_TYPE_UNSPECIFIED",t[t.NORMAL_TEXT=1]="NORMAL_TEXT",t[t.TITLE=2]="TITLE",t[t.SUBTITLE=3]="SUBTITLE",t[t.HEADING_1=4]="HEADING_1",t[t.HEADING_2=5]="HEADING_2",t[t.HEADING_3=6]="HEADING_3",t[t.HEADING_4=7]="HEADING_4",t[t.HEADING_5=8]="HEADING_5",t[t.HEADING_6=9]="HEADING_6",t))(Sn||{}),Nn=(t=>(t[t.AUTO=0]="AUTO",t[t.AT_LEAST=1]="AT_LEAST",t[t.EXACT=2]="EXACT",t))(Nn||{}),bn=(t=>(t[t.DASH_STYLE_UNSPECIFIED=0]="DASH_STYLE_UNSPECIFIED",t[t.SOLID=1]="SOLID",t[t.DOT=2]="DOT",t[t.DASH=3]="DASH",t))(bn||{}),wn=(t=>(t[t.TAB_STOP_ALIGNMENT_UNSPECIFIED=0]="TAB_STOP_ALIGNMENT_UNSPECIFIED",t[t.START=1]="START",t[t.CENTER=2]="CENTER",t[t.END=3]="END",t))(wn||{}),Ln=(t=>(t.EVENLY_DISTRIBUTED="0",t.FIXED_WIDTH="1",t))(Ln||{}),vn=(t=>(t[t.CONTENT_ALIGNMENT_UNSPECIFIED=0]="CONTENT_ALIGNMENT_UNSPECIFIED",t[t.CONTENT_ALIGNMENT_UNSUPPORTED=1]="CONTENT_ALIGNMENT_UNSUPPORTED",t[t.TOP=2]="TOP",t[t.MIDDLE=3]="MIDDLE",t[t.BOTTOM=4]="BOTTOM",t))(vn||{}),Dn=(t=>(t.NORMAL="normal",t.BOLD="bold",t.ITALIC="italic",t))(Dn||{}),Un=(t=>(t[t.CHARACTER=0]="CHARACTER",t[t.COLUMN=1]="COLUMN",t[t.INSIDE_MARGIN=2]="INSIDE_MARGIN",t[t.LEFT_MARGIN=3]="LEFT_MARGIN",t[t.MARGIN=4]="MARGIN",t[t.OUTSIDE_MARGIN=5]="OUTSIDE_MARGIN",t[t.PAGE=6]="PAGE",t[t.RIGHT_MARGIN=7]="RIGHT_MARGIN",t))(Un||{}),Mn=(t=>(t[t.BOTTOM_MARGIN=0]="BOTTOM_MARGIN",t[t.INSIDE_MARGIN=1]="INSIDE_MARGIN",t[t.LINE=2]="LINE",t[t.MARGIN=3]="MARGIN",t[t.OUTSIDE_MARGIN=4]="OUTSIDE_MARGIN",t[t.PAGE=5]="PAGE",t[t.PARAGRAPH=6]="PARAGRAPH",t[t.TOP_MARGIN=7]="TOP_MARGIN",t))(Mn||{}),Tn=(t=>(t[t.POINT=0]="POINT",t[t.LINE=1]="LINE",t[t.CHARACTER=2]="CHARACTER",t))(Tn||{}),Pn=(t=>(t[t.CENTER=0]="CENTER",t[t.INSIDE=1]="INSIDE",t[t.LEFT=2]="LEFT",t[t.OUTSIDE=3]="OUTSIDE",t[t.RIGHT=4]="RIGHT",t))(Pn||{}),pn=(t=>(t[t.BOTTOM=0]="BOTTOM",t[t.CENTER=1]="CENTER",t[t.INSIDE=2]="INSIDE",t[t.OUTSIDE=3]="OUTSIDE",t[t.TOP=4]="TOP",t))(pn||{}),xn=(t=>(t[t.compressPunctuation=0]="compressPunctuation",t[t.compressPunctuationAndJapaneseKana=1]="compressPunctuationAndJapaneseKana",t[t.doNotCompress=2]="doNotCompress",t))(xn||{}),Fn=(t=>(t[t.PORTRAIT=0]="PORTRAIT",t[t.LANDSCAPE=1]="LANDSCAPE",t))(Fn||{}),ve=(t=>(t[t.SLIDE=0]="SLIDE",t[t.MASTER=1]="MASTER",t[t.LAYOUT=2]="LAYOUT",t[t.HANDOUT_MASTER=3]="HANDOUT_MASTER",t[t.NOTES_MASTER=4]="NOTES_MASTER",t))(ve||{}),Hn=(t=>(t[t.SHAPE=0]="SHAPE",t[t.IMAGE=1]="IMAGE",t[t.TEXT=2]="TEXT",t[t.SPREADSHEET=3]="SPREADSHEET",t[t.DOCUMENT=4]="DOCUMENT",t[t.SLIDE=5]="SLIDE",t))(Hn||{}),Wn=(t=>(t[t.RELATIVE_SLIDE_LINK_UNSPECIFIED=0]="RELATIVE_SLIDE_LINK_UNSPECIFIED",t[t.NEXT_SLIDE=1]="NEXT_SLIDE",t[t.PREVIOUS_SLIDE=2]="PREVIOUS_SLIDE",t[t.FIRST_SLIDE=3]="FIRST_SLIDE",t[t.LAST_SLIDE=4]="LAST_SLIDE",t))(Wn||{});class mi{constructor(e,s){_(this,"_columnData");this._config=e,this._columnData=O.createObjectArray(s)}getColumnData(){return this._columnData}getColVisible(e){const{_columnData:s}=this,n=s.get(e);return n?n.hd!==I.TRUE:!0}getHiddenCols(e=0,s=this._columnData.getLength()-1){const n=[];let r=!1,i=-1;for(let o=e;o<=s;o++){const c=this.getColVisible(o);r&&c?(r=!1,n.push({rangeType:z.COLUMN,startColumn:i,endColumn:o-1,startRow:0,endRow:0})):!r&&!c&&(r=!0,i=o)}return r&&n.push({startRow:0,endRow:0,startColumn:i,endColumn:s,rangeType:z.COLUMN}),n}getColumnDatas(e,s){const n=new b;for(let r=e;r<e+s;r++){const i=this.getColumnOrCreate(r);n.push(i)}return n}getSize(){return this._columnData.getLength()}getColumnWidth(e){const{_columnData:s}=this,n=this._config;let r=0;return r=s.obtain(e,{hd:I.FALSE,w:n.defaultColumnWidth}).w||n.defaultColumnWidth,r}getColumn(e){const s=this._columnData.get(e);if(s)return s}getColumnOrCreate(e){const{_columnData:s}=this,n=this._config,r=s.get(e);if(r)return r;const i={w:n.defaultColumnWidth,hd:I.FALSE};return this._columnData.set(e,i),i}}function bt(t,e){for(const s of e){const{ts:n={}}=s;if(n[t]==null)return I.FALSE;switch(t){case"bl":case"it":{if(n[t]===I.FALSE)return I.FALSE;break}case"ul":case"st":{if(n[t].s===I.FALSE)return I.FALSE;break}default:throw new Error(`unknown style key: ${t} in IStyleBase`)}}return I.TRUE}class dt{constructor(e,s,n){_(this,"_range");_(this,"_worksheet");this._deps=n,this._range=s,this._worksheet=e}static foreach(e,s){const{startRow:n,startColumn:r,endRow:i,endColumn:o}=e;for(let c=n;c<=i;c++)for(let u=r;u<=o;u++)s(c,u)}getRangeData(){return this._range}getValue(){return this.getValues()[0][0]}getValues(){const{startRow:e,endRow:s,startColumn:n,endColumn:r}=this._range,i=[];for(let o=e;o<=s;o++){const c=[];for(let u=n;u<=r;u++)c.push(this.getMatrix().getValue(o,u)||null);i.push(c)}return i}getMatrix(){const{startRow:e,endRow:s,startColumn:n,endColumn:r}=this._range,i=this._worksheet.getCellMatrix(),o=new F;for(let c=e;c<=s;c++)for(let u=n;u<=r;u++)o.setValue(c,u,i.getValue(c,u)||null);return o}getMatrixObject(){const{startRow:e,endRow:s,startColumn:n,endColumn:r}=this._range,i=this._worksheet.getCellMatrix(),o=new F;for(let c=e;c<=s;c++)for(let u=n;u<=r;u++)o.setValue(c-e,u-n,i.getValue(c,u)||{});return o}getA1Notation(){const{startRow:e,endRow:s,startColumn:n,endColumn:r}=this._range;let i,o;return n<r?(i=O.numToWord(n+1)+(e+1),o=O.numToWord(r+1)+(s+1)):(i=O.numToWord(r+1)+(s+1),o=O.numToWord(n+1)+(e+1)),i===o?`${i}`:`${i}:${o}`}getBackground(){return this.getBackgrounds()[0][0]}getBackgrounds(){const e=this._deps.getStyles();return this.getValues().map(s=>s.map(n=>{var i;const r=e.getStyleByCell(n);return((i=r==null?void 0:r.bg)==null?void 0:i.rgb)||vt.bg.rgb}))}getCell(e,s){const{startRow:n,endRow:r,startColumn:i,endColumn:o}=this._range,c={startRow:n+e,endRow:n+e,startColumn:i+s,endColumn:i+s};return new dt(this._worksheet,c,this._deps)}getColumn(){return this._range.startColumn}getObjectValue(e={}){return this.getObjectValues(e)[0][0]}getObjectValues(e={}){const{startRow:s,endRow:n,startColumn:r,endColumn:i}=this._range,o=this._worksheet.getCellMatrix().getFragment(s,n,r,i).getData();if(e.isIncludeStyle){const c=this._deps.getStyles();for(let u=0;u<=n-s;u++)for(let a=0;a<=i-r;a++){if(!o[u][a])continue;const l=o[u][a].s;l&&(o[u][a].s=c.get(l))}}return o}getFontColor(){return this.getFontColors()[0][0]}getFontColors(){const e=this._deps.getStyles();return this.getValues().map(s=>s.map(n=>{var i;const r=e.getStyleByCell(n);return((i=r==null?void 0:r.cl)==null?void 0:i.rgb)||vt.cl.rgb}))}getFontFamilies(){return this._getStyles("ff")}getFontFamily(){return this.getFontFamilies()[0][0]}getUnderlines(){return this._getStyles("ul")}getUnderline(){var s,n;const{p:e}=this.getValue()??{};return e&&Array.isArray((s=e.body)==null?void 0:s.textRuns)?bt("ul",(n=e.body)==null?void 0:n.textRuns)===I.TRUE?{s:I.TRUE}:{s:I.FALSE}:this.getUnderlines()[0][0]}getOverlines(){return this._getStyles("ol")}getOverline(){return this.getOverlines()[0][0]}getStrikeThrough(){var s,n;const{p:e}=this.getValue()??{};return e&&Array.isArray((s=e.body)==null?void 0:s.textRuns)?bt("st",(n=e.body)==null?void 0:n.textRuns)===I.TRUE?{s:I.TRUE}:{s:I.FALSE}:this.getStrikeThroughs()[0][0]}getStrikeThroughs(){return this._getStyles("st")}getFontSize(){return this.getFontSizes()[0][0]}getFontSizes(){return this._getStyles("fs")}getBorder(){return this.getBorders()[0][0]}getBorders(){return this._getStyles("bd")}getFontStyle(){var s,n;const{p:e}=this.getValue()??{};return e&&Array.isArray((s=e.body)==null?void 0:s.textRuns)?bt("it",(n=e.body)==null?void 0:n.textRuns)===I.TRUE?Pt.ITALIC:Pt.NORMAL:this.getFontStyles()[0][0]}getFontStyles(){return this._getStyles("it")}getFontWeight(){var s,n;const{p:e}=this.getValue()??{};return e&&Array.isArray((s=e.body)==null?void 0:s.textRuns)?bt("bl",(n=e.body)==null?void 0:n.textRuns)===I.TRUE?pt.BOLD:pt.NORMAL:this.getFontWeights()[0][0]}getFontWeights(){return this._getStyles("bl")}getGridId(){return this._worksheet.getSheetId()}getHeight(){const{_range:e,_worksheet:s}=this,{startRow:n,endRow:r}=e;let i=0;for(let o=0;o<=r-n;o++){const c=s.getRowHeight(o);i+=c}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:e,endColumn:s}=this._range;return s-e+1}getNumRows(){const{startRow:e,endRow:s}=this._range;return s-e+1}getRichTextValue(){return this.getRichTextValues()[0][0]}getRichTextValues(){return this.getValues().map(e=>e.map(s=>(s==null?void 0:s.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 e=this._deps.getStyles();return this.getValues().map(s=>s.map(n=>e.getStyleByCell(n)))}getVerticalAlignment(){return this.getVerticalAlignments()[0][0]}getVerticalAlignments(){return this._getStyles("vt")}getWidth(){const{_range:e,_worksheet:s}=this,{startColumn:n,endColumn:r}=e;let i=0;for(let o=0;o<=r-n;o++)i+=s.getColumnWidth(o);return i}getWrap(){return this.getWraps()[0][0]}getWraps(){return this._getStyles("tb")}getWrapStrategies(){return this._getStyles("tb")}getWrapStrategy(){return this.getWrapStrategies()[0][0]}forEach(e){dt.foreach(this._range,e)}_getStyles(e){const s=this._deps.getStyles();return this.getValues().map(n=>n.map(r=>{const i=s&&s.getStyleByCell(r);return i&&i[e]||vt[e]}))}}class Ii{constructor(e,s){_(this,"_rowData");this._config=e,this._rowData=O.createObjectArray(s)}getRowData(){return this._rowData}getRowDatas(e,s){const n=new b;for(let r=e;r<e+s;r++){const i=this.getRowOrCreate(r);n.push(i)}return n}getRowHeight(e,s=1){const{_rowData:n}=this,r=this._config;let i=0;for(let o=0;o<s;o++){const c=n.obtain(o+e,{hd:I.FALSE,h:r.defaultRowHeight}),{isAutoHeight:u,ah:a,h:l=r.defaultRowHeight}=c;i+=(u==null||u)&&typeof a=="number"?a:l}return i}getRow(e){const{_rowData:s}=this;return s.get(e)}getRowOrCreate(e){const{_rowData:s}=this,n=s.get(e);if(n)return n;const r=this._config,i={hd:I.FALSE,h:r.defaultRowHeight};return s.set(e,i),i}getHiddenRows(e=0,s=this._rowData.getLength()-1){const n=[];let r=!1,i=-1;for(let o=e;o<=s;o++){const c=this.getRowVisible(o);r&&c?(r=!1,n.push({startRow:i,endRow:o-1,startColumn:0,endColumn:0,rangeType:z.ROW})):!r&&!c&&(r=!0,i=o)}return r&&n.push({startRow:i,endRow:s,startColumn:0,endColumn:0,rangeType:z.ROW}),n}getRowVisible(e){const s=this.getRow(e);return s?s.hd!==I.TRUE:!0}getSize(){return this._rowData.getLength()}}class Bn extends M{constructor(){super(...arguments);_(this,"_cellContentInterceptors",[]);_(this,"_rowFilteredInterceptors",[]);_(this,"_rowVisibleInterceptors",[]);_(this,"_colVisibleInterceptors",[])}dispose(){super.dispose(),this._cellContentInterceptors.length=0,this._rowFilteredInterceptors.length=0,this._rowVisibleInterceptors.length=0,this._colVisibleInterceptors.length=0}getCell(s,n){for(const r of this._cellContentInterceptors){const i=r.getCell(s,n);if(typeof i<"u")return i}return null}registerCellContentInterceptor(s){if(this._cellContentInterceptors.includes(s))throw new Error("[SheetViewModel]: Interceptor already registered.");return this._cellContentInterceptors.push(s),D(()=>y(this._cellContentInterceptors,s))}registerRowFilteredInterceptor(s){if(this._rowFilteredInterceptors.includes(s))throw new Error("[SheetViewModel]: Interceptor already registered.");return this._rowFilteredInterceptors.push(s),D(()=>y(this._rowFilteredInterceptors,s))}registerRowVisibleInterceptor(s){if(this._rowVisibleInterceptors.includes(s))throw new Error("[SheetViewModel]: Interceptor already registered.");return this._rowVisibleInterceptors.push(s),D(()=>y(this._rowVisibleInterceptors,s))}registerColVisibleInterceptor(s){if(this._colVisibleInterceptors.includes(s))throw new Error("[SheetViewModel]: Interceptor already registered.");return this._colVisibleInterceptors.push(s),D(()=>y(this._colVisibleInterceptors,s))}}class Ct{constructor(e,s){_(this,"_initialized");_(this,"_sheetId");_(this,"_snapshot");_(this,"_cellData");_(this,"_rowManager");_(this,"_columnManager");_(this,"_viewModel");this._styles=s;const n={...Gt,mergeData:[],hideRow:[],hideColumn:[],cellData:{},rowData:{},columnData:{},rowHeader:{width:46,hidden:I.FALSE},columnHeader:{height:20,hidden:I.FALSE},selections:["A1"],rightToLeft:I.FALSE,pluginMeta:{},...e};this._snapshot=n;const{columnData:r,rowData:i,cellData:o}=this._snapshot;this._sheetId=this._snapshot.id??O.generateRandomId(6),this._initialized=!1,this._cellData=new F(o),this._rowManager=new Ii(this._snapshot,i),this._columnManager=new mi(this._snapshot,r),this._viewModel=new Bn}__interceptViewModel(e){e(this._viewModel)}getSnapshot(){return this._snapshot}getCellMatrix(){return this._cellData}getRowManager(){return this._rowManager}getSheetId(){return this._sheetId}getColumnManager(){return this._columnManager}getName(){return this._snapshot.name}clone(){const{_snapshot:e}=this,s=O.deepClone(e);return new Ct(s,this._styles)}getMergeData(){return this._snapshot.mergeData}getMergedCells(e,s){const n=this._snapshot.mergeData,r=[];for(let i=0;i<n.length;i++){const o=n[i];lt.intersects({startRow:e,startColumn:s,endRow:e,endColumn:s},o)&&r.push(o)}return r.length?r:null}getMergedCell(e,s){const n=this._snapshot.mergeData;for(let r=0;r<n.length;r++){const i=n[r];if(lt.intersects({startRow:e,startColumn:s,endRow:e,endColumn:s},i))return i}return null}getCell(e,s){return e<0||s<0?null:this._viewModel.getCell(e,s)}getCellRaw(e,s){return this.getCellMatrix().getValue(e,s)}getMatrixWithMergedCells(e,s,n,r){const i=this.getCellMatrix(),o=this._snapshot.mergeData.filter(u=>lt.intersects({startRow:e,startColumn:s,endRow:n,endColumn:r},u)),c=new F;return oe(e,n,s,r).forEach((u,a)=>{const l=i.getValue(u,a);l&&c.setValue(u,a,l)}),o.forEach(u=>{const{startColumn:a,startRow:l,endColumn:h,endRow:d}=u;oe(l,d,a,h).forEach((f,g)=>{f===l&&g===a&&c.setValue(f,g,{...i.getValue(f,g),rowSpan:d-l+1,colSpan:h-a+1}),(f!==l||g!==a)&&c.realDeleteValue(f,g)})}),c}getRange(e,s,n,r){return typeof e=="object"?new dt(this,e,{getStyles:()=>this._styles}):new dt(this,{startRow:e,startColumn:s,endColumn:r||s,endRow:n||e},{getStyles:()=>this._styles})}getStatus(){const{_snapshot:e}=this;return e.status}getZoomRatio(){return this._snapshot.zoomRatio||1}getConfig(){return this._snapshot}getFreeze(){return this._snapshot.freeze}getMaxColumns(){const{_snapshot:e}=this,{columnCount:s}=e;return s}getMaxRows(){const{_snapshot:e}=this,{rowCount:s}=e;return s}getType(){const{_snapshot:e}=this,{type:s}=e;return s}getRowCount(){return this._snapshot.rowCount}setRowCount(e){this._snapshot.rowCount=e}getColumnCount(){return this._snapshot.columnCount}setColumnCount(e){this._snapshot.columnCount=e}isSheetHidden(){return this._snapshot.hidden}hasHiddenGridlines(){const{_snapshot:e}=this,{showGridlines:s}=e;return s===0}getTabColor(){const{_snapshot:e}=this,{tabColor:s}=e;return s}getColumnWidth(e){return this.getColumnManager().getColumnWidth(e)}getRowHeight(e){return this.getRowManager().getRowHeight(e)}getRowVisible(e){return this.getRowManager().getRowVisible(e)}getHiddenRows(e,s){const n=this.getMaxColumns()-1,r=this._rowManager.getHiddenRows(e,s);return r.forEach(i=>i.endColumn=n),r}getColVisible(e){return this._columnManager.getColVisible(e)}getHiddenCols(e,s){const n=this.getMaxRows()-1,r=this._columnManager.getHiddenCols(e,s);return r.forEach(i=>i.endRow=n),r}isRightToLeft(){const{_snapshot:e}=this,{rightToLeft:s}=e;return s}getPluginMeta(e){return this._snapshot.pluginMeta[e]}setPluginMeta(e,s){this._snapshot.pluginMeta[e]=s}getLastRowWithContent(){return this._cellData.getLength()-1}getLastColumnWithContent(){return this._cellData.getRange().endColumn}cellHasValue(e){return e&&(e.v!==void 0||e.f!==void 0||e.p!==void 0)}}var Ci=Object.defineProperty,Si=Object.getOwnPropertyDescriptor,Ni=(t,e,s,n)=>{for(var r=n>1?void 0:n?Si(e,s):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(e,s,r):o(r))||r);return n&&r&&Ci(e,s,r),r},$e=(t,e)=>(s,n)=>e(s,n,t);function bi(t,e){return`${t.getUnitId()}|${e.getSheetId()}`}exports.Workbook=class extends M{constructor(s={},n,r){super();_(this,"_sheetCreated$",new L.Subject);_(this,"sheetCreated$",this._sheetCreated$.asObservable());_(this,"_sheetDisposed$",new L.Subject);_(this,"sheetDisposed$",this._sheetDisposed$.asObservable());_(this,"_worksheets");_(this,"_styles");_(this,"_snapshot");_(this,"_unitId");this._genName=n,this._injector=r,this._snapshot=O.commonExtend(ys,s);const{styles:i}=this._snapshot;(this._snapshot.id==null||this._snapshot.id.length===0)&&(this._snapshot.id=O.generateRandomId(6)),this._unitId=this._snapshot.id,this._styles=new ln(i),this._worksheets=new Map,this._getDefaultWorkSheet()}dispose(){super.dispose(),this._sheetCreated$.complete(),this._sheetDisposed$.complete()}save(){return this._snapshot}static isIRangeType(s){return typeof s=="string"||"startRow"in s||"row"in s}getSnapshot(){return this._snapshot}getUnitId(){return this._unitId}getRev(){return this._snapshot.rev??1}incrementRev(){this._snapshot.rev=this.getRev()+1}getShouldRenderLoopImmediately(){return this._snapshot.shouldStartRenderingImmediately!==!1}getContainer(){return this._snapshot.container}addWorksheet(s,n,r){const{sheets:i,sheetOrder:o}=this._snapshot;if(i[s])return!1;i[s]=r,o.splice(n,0,s);const c=new Ct(r,this._styles);return this._worksheets.set(s,c),this._sheetCreated$.next(c),!0}getParentRenderUnitId(){return this._snapshot.parentRenderUnitId}getWorksheets(){return this._worksheets}getActiveSpreadsheet(){return this}getStyles(){return this._styles}getConfig(){return this._snapshot}getIndexBySheetId(s){const{sheetOrder:n}=this._snapshot;return n.findIndex(r=>r===s)}getRawActiveSheet(){const{sheetOrder:s}=this._snapshot;return s.find(r=>this._worksheets.get(r).getStatus()===I.TRUE)}getActiveSheet(){const{sheetOrder:s}=this._snapshot,n=this.getRawActiveSheet();return n?this._worksheets.get(n):this._worksheets.get(s[0])}getActiveSheetIndex(){const{sheetOrder:s}=this._snapshot;return s.findIndex(n=>this._worksheets.get(n).getStatus()===1)}getSheetSize(){return this._snapshot.sheetOrder.length}flush(){}getSheets(){const{sheetOrder:s}=this._snapshot;return s.map(n=>this._worksheets.get(n))}getSheetIndex(s){const{sheetOrder:n}=this._snapshot;return n.findIndex(r=>s.getSheetId()===r)}getSheetBySheetName(s){const{sheetOrder:n}=this._snapshot,r=n.find(i=>this._worksheets.get(i).getName()===s);return this._worksheets.get(r)}getSheetBySheetId(s){return this._worksheets.get(s)}getSheetByIndex(s){const{sheetOrder:n}=this._snapshot;return this._worksheets.get(n[s])}getHiddenWorksheets(){return this.getSheets().filter(s=>s.getConfig().hidden===I.TRUE).map(s=>s.getConfig().id)}transformRangeType(s){if(typeof s=="string")return this._getCellRange(s);if(typeof s!="string"&&"row"in s){const n=s;return{sheetId:"",range:{startRow:n.row[0],startColumn:n.column[0],endRow:n.row[1],endColumn:n.column[1]}}}return typeof s!="string"&&"startRow"in s?{sheetId:"",range:s}:Rt}load(s){this._snapshot=s}_getCellRange(s){var l,h,d,f,g;let n="",r="";if(s.indexOf("!")>-1){const E=s.split("!");n=E[0],r=E[1],n=n.replace(/\\'/g,"'").replace(/''/g,"'"),n.substring(0,1)==="'"&&n.substring(n.length-1,1)==="'"&&(n=n.substring(1,n.length-1))}else r=s;if(r.indexOf(":")===-1){const E=parseInt(r.replace(/[^0-9]/g,""),10)-1,R=O.ABCatNum(r.replace(/[^A-Za-z]/g,""));return!Number.isNaN(E)&&!Number.isNaN(R)?{sheetId:n,range:{startRow:E,endRow:E,startColumn:R,endColumn:R}}:Rt}r=r.split(":");const i=[0,0],o=[0,0],c=((l=this.getSheetBySheetName(n))==null?void 0:l.getMaxRows())||((h=this.getActiveSheet())==null?void 0:h.getMaxRows()),u=((d=this.getSheetBySheetName(n))==null?void 0:d.getMaxColumns())||((f=this.getActiveSheet())==null?void 0:f.getMaxColumns());return i[0]=parseInt(r[0].replace(/[^0-9]/g,""),10)-1,i[1]=parseInt(r[1].replace(/[^0-9]/g,""),10)-1,Number.isNaN(i[0])&&(i[0]=0),Number.isNaN(i[1])&&(i[1]=c),i[0]>i[1]||(o[0]=O.ABCatNum(r[0].replace(/[^A-Za-z]/g,"")),o[1]=O.ABCatNum(r[1].replace(/[^A-Za-z]/g,"")),Number.isNaN(o[0])&&(o[0]=0),Number.isNaN(o[1])&&(o[1]=u),o[0]>o[1])?Rt:{sheetId:((g=this.getSheetBySheetName(n))==null?void 0:g.getSheetId())||"",range:{startRow:i[0],endRow:i[1],startColumn:o[0],endColumn:o[1]}}}_getDefaultWorkSheet(){const{_snapshot:s,_worksheets:n}=this,{sheets:r,sheetOrder:i}=s;O.isEmptyObject(r)&&(r[Gt.id]=Object.assign(Gt,{status:I.TRUE}));for(const o in r){const c=r[o];c.name=this._genName.sheetName(c.name);const u=new Ct(c,this._styles);n.set(o,u),i.includes(o)||i.push(o)}}};exports.Workbook=Ni([$e(1,S.Inject(S.forwardRef(()=>Ce))),$e(2,S.Inject(S.Injector))],exports.Workbook);class De{constructor(e){_(this,"_snapshot");_(this,"_unitId");this._snapshot={...cn,...e},this._unitId=this._snapshot.id??O.generateRandomId(6)}getSnapshot(){return this._snapshot}getUnitId(){return this._unitId}getPages(){var e;return(e=this._snapshot.body)==null?void 0:e.pages}getPageOrder(){var e;return(e=this._snapshot.body)==null?void 0:e.pageOrder}getPage(e){const s=this.getPages();return s==null?void 0:s[e]}getElementsByPage(e){var s;return(s=this.getPage(e))==null?void 0:s.pageElements}getElement(e,s){var n;return(n=this.getElementsByPage(e))==null?void 0:n[s]}getPageSize(){return this._snapshot.pageSize}addPage(){return{id:"cover_1",pageType:ve.SLIDE,zIndex:1,title:"cover",description:"this is first page, cover",pageBackgroundFill:{rgb:"rgb(255,255,255)"},pageElements:{}}}}const ce="FOCUSING_SHEET",ae="FOCUSING_DOC",le="FOCUSING_SLIDE",wi="FOCUSING_EDITOR_BUT_HIDDEN",Gn="FOCUSING_EDITOR",Li="FOCUSING_EDITOR_INPUT_FORMULA",$n="FOCUSING_FORMULA_EDITOR";var vi=Object.defineProperty,Di=Object.getOwnPropertyDescriptor,Ui=(t,e,s,n)=>{for(var r=n>1?void 0:n?Di(e,s):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(e,s,r):o(r))||r);return n&&r&&vi(e,s,r),r},Mi=(t,e)=>(s,n)=>e(s,n,t),kn=(t=>(t[t.UNKNOWN=0]="UNKNOWN",t[t.DOC=1]="DOC",t[t.SHEET=2]="SHEET",t[t.SLIDE=3]="SLIDE",t))(kn||{});const ft=S.createIdentifier("univer.current");let ue=class extends M{constructor(e,s){super();_(this,"_focused$",new L.BehaviorSubject(null));_(this,"_focused",null);_(this,"focused$",this._focused$.asObservable());_(this,"_currentSheet$",new L.BehaviorSubject(null));_(this,"currentSheet$",this._currentSheet$.asObservable());_(this,"_currentDoc$",new L.BehaviorSubject(null));_(this,"currentDoc$",this._currentDoc$.asObservable());_(this,"_currentSlide$",new L.BehaviorSubject(null));_(this,"currentSlide$",this._currentSlide$.asObservable());_(this,"_sheetAdded$",new L.Subject);_(this,"sheetAdded$",this._sheetAdded$.asObservable());_(this,"_docAdded$",new L.Subject);_(this,"docAdded$",this._docAdded$.asObservable());_(this,"_slideAdded$",new L.Subject);_(this,"slideAdded$",this._slideAdded$.asObservable());_(this,"_sheetDisposed$",new L.Subject);_(this,"sheetDisposed$",this._sheetDisposed$.asObservable());_(this,"_docDisposed$",new L.Subject);_(this,"docDisposed$",this._docDisposed$.asObservable());_(this,"_slideDisposed$",new L.Subject);_(this,"slideDisposed$",this._slideDisposed$.asObservable());_(this,"_sheets",[]);_(this,"_docs",[]);_(this,"_slides",[]);this._handler=e,this._contextService=s}dispose(){super.dispose(),this._focused$.complete(),this._currentDoc$.complete(),this._currentSheet$.complete(),this._currentSlide$.complete(),this._sheetAdded$.complete(),this._docAdded$.complete(),this._slideAdded$.complete(),this._sheetDisposed$.complete(),this._docDisposed$.complete(),this._slideDisposed$.complete()}createDoc(e){return this._handler.createUniverDoc(e)}createSheet(e){return this._handler.createUniverSheet(e)}createSlide(e){return this._handler.createUniverSlide(e)}addSheet(e){this._sheets.push(e),this._sheetAdded$.next(e),this.setCurrentUniverSheetInstance(e.getUnitId())}changeDoc(e,s){const n=this._docs.find(r=>r.getUnitId()===e);if(n!=null){const r=this._docs.indexOf(n);this._docs.splice(r,1)}this.addDoc(s)}addDoc(e){this._docs.push(e),this._docAdded$.next(e),this.setCurrentUniverDocInstance(e.getUnitId())}addSlide(e){this._slides.push(e),this._slideAdded$.next(e),this.setCurrentUniverSlideInstance(e.getUnitId())}getUniverSheetInstance(e){return this._sheets.find(s=>s.getUnitId()===e)}getUniverDocInstance(e){return this._docs.find(s=>s.getUnitId()===e)}getUniverSlideInstance(e){return this._slides.find(s=>s.getUnitId()===e)}getAllUniverSheetsInstance(){return this._sheets}getAllUniverDocsInstance(){return this._docs}getAllUniverSlidesInstance(){return this._slides}setCurrentUniverSheetInstance(e){this._currentSheet$.next(this.getUniverSheetInstance(e)||null)}setCurrentUniverSlideInstance(e){this._currentSlide$.next(this.getUniverSlideInstance(e)||null)}setCurrentUniverDocInstance(e){this._currentDoc$.next(this.getUniverDocInstance(e)||null)}getCurrentUniverSheetInstance(){const e=this._currentSheet$.getValue();if(!e)throw new Error("No current sheet!");return e}getCurrentUniverDocInstance(){const e=this._currentDoc$.getValue();if(!e)throw new Error("No current doc!");return e}getCurrentUniverSlideInstance(){const e=this._currentSlide$.getValue();if(!e)throw new Error("No current slide!");return e}focusUniverInstance(e){e&&(this._focused=this.getUniverSheetInstance(e)||this.getUniverDocInstance(e)||this.getUniverSlideInstance(e)||null),this._focused$.next(e),[ae,ce,le].forEach(s=>this._contextService.setContextValue(s,!1)),this._focused instanceof exports.Workbook?this._contextService.setContextValue(ce,!0):this._focused instanceof _t?this._contextService.setContextValue(ae,!0):this._focused instanceof De&&this._contextService.setContextValue(le,!0)}getFocusedUniverInstance(){return this._focused}getDocumentType(e){if(this.getUniverDocInstance(e))return 1;if(this.getUniverSheetInstance(e))return 2;if(this.getUniverSlideInstance(e))return 3;throw new Error(`[UniverInstanceService]: No document with unitID ${e}`)}disposeDocument(e){const s=this.getUniverDocInstance(e);if(s){const i=this._docs.indexOf(s);return this._docs.splice(i,1),this._docDisposed$.next(s),this.focusUniverInstance(null),!0}const n=this.getUniverSheetInstance(e);if(n){const i=this._sheets.indexOf(n);return this._sheets.splice(i,1),this._sheetDisposed$.next(n),this.focusUniverInstance(null),!0}const r=this.getUniverSlideInstance(e);if(r){const i=this._slides.indexOf(r);return this._slides.splice(i,1),this._slideDisposed$.next(r),this.focusUniverInstance(null),!0}return!1}};ue=Ui([Mi(1,ut)],ue);var C=(t=>(t[t.Starting=0]="Starting",t[t.Ready=1]="Ready",t[t.Rendered=2]="Rendered",t[t.Steady=3]="Steady",t))(C||{});const ke={0:"Starting",1:"Ready",2:"Rendered",3:"Steady"},Dt=new Map;function Ue(t,e){return function(r){Me(t,e)}}function Me(t,e){Dt.has(t)||Dt.set(t,[]),Dt.get(t).push(e)}var Ti=Object.defineProperty,Pi=Object.getOwnPropertyDescriptor,jn=(t,e,s,n)=>{for(var r=n>1?void 0:n?Pi(e,s):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(e,s,r):o(r))||r);return n&&r&&Ti(e,s,r),r},he=(t,e)=>(s,n)=>e(s,n,t);exports.LifecycleService=class extends M{constructor(s){super();_(this,"_lifecycle$",new L.BehaviorSubject(C.Starting));_(this,"lifecycle$",this._lifecycle$.asObservable());this._logService=s,this._logService.log("[LifecycleService]",`lifecycle progressed to "${ke[C.Starting]}".`)}get stage(){return this._lifecycle$.getValue()}set stage(s){if(s<this.stage)throw new Error("[LifecycleService]: lifecycle stage cannot go backward!");s!==this.stage&&(this._logService.log("[LifecycleService]",`lifecycle progressed to "${ke[s]}".`),this._lifecycle$.next(s))}subscribeWithPrevious(){return new L.Observable(s=>(this.stage===C.Starting||(this.stage===C.Ready?s.next(C.Starting):this.stage===C.Rendered?(s.next(C.Starting),s.next(C.Ready)):(s.next(C.Starting),s.next(C.Ready),s.next(C.Rendered))),this._lifecycle$.subscribe(s)))}};exports.LifecycleService=jn([he(0,ht)],exports.LifecycleService);let it=class extends M{constructor(e,s){super();_(this,"_started",!1);this._lifecycleService=e,this._injector=s}start(){this._started||(this._started=!0,this.disposeWithMe(D(this._lifecycleService.subscribeWithPrevious().subscribe(e=>this.initModulesOnStage(e)))))}initModulesOnStage(e){const s=Dt.get(e);s==null||s.forEach(n=>{this._injector.has(n)&&this._injector.get(n)})}};it=jn([he(0,S.Inject(exports.LifecycleService)),he(1,S.Inject(S.Injector))],it);function pi(t,e){if(t)try{return t[e]?t[e]:e.split(".").reduce((s,n)=>s[n],t)}catch{return console.warn("Key %s not found",e),e}}class Ot extends M{constructor(){super();_(this,"currentLocale",zt.ZH_CN);_(this,"locales",null);_(this,"localeChanged$",new L.Subject);_(this,"t",s=>{if(!this.locales)throw new Error("Locale not initialized");return pi(this.locales[this.currentLocale],s)??s});this.disposeWithMe(D(()=>this.localeChanged$.complete()))}load(s){this.locales=O.deepMerge(this.locales??{},s)}setLocale(s){this.currentLocale=s,this.localeChanged$.next()}getLocales(){var s;return(s=this.locales)==null?void 0:s[this.currentLocale]}getCurrentLocale(){return this.currentLocale}}function xi(t){return nt(t==null?void 0:t.lift)}function Fi(t){return function(e){if(xi(e))return e.lift(function(s){try{return t(s,this)}catch(n){this.error(n)}});throw new TypeError("Unable to lift unknown Observable type")}}var Hi={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},_e={setTimeout:function(t,e){for(var s=[],n=2;n<arguments.length;n++)s[n-2]=arguments[n];var r=_e.delegate;return r!=null&&r.setTimeout?r.setTimeout.apply(r,Tt([t,e],Mt(s))):setTimeout.apply(void 0,Tt([t,e],Mt(s)))},clearTimeout:function(t){var e=_e.delegate;return((e==null?void 0:e.clearTimeout)||clearTimeout)(t)},delegate:void 0};function Wi(t){_e.setTimeout(function(){throw t})}function je(){}var Vn=function(t){Ee(e,t);function e(s){var n=t.call(this)||this;return n.isStopped=!1,s?(n.destination=s,ts(s)&&s.add(n)):n.destination=ji,n}return e.create=function(s,n,r){return new $i(s,n,r)},e.prototype.next=function(s){this.isStopped||this._next(s)},e.prototype.error=function(s){this.isStopped||(this.isStopped=!0,this._error(s))},e.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(s){this.destination.next(s)},e.prototype._error=function(s){try{this.destination.error(s)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e}(Re),Bi=Function.prototype.bind;function yt(t,e){return Bi.call(t,e)}var Gi=function(){function t(e){this.partialObserver=e}return t.prototype.next=function(e){var s=this.partialObserver;if(s.next)try{s.next(e)}catch(n){wt(n)}},t.prototype.error=function(e){var s=this.partialObserver;if(s.error)try{s.error(e)}catch(n){wt(n)}else wt(e)},t.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(s){wt(s)}},t}(),$i=function(t){Ee(e,t);function e(s,n,r){var i=t.call(this)||this,o;if(nt(s)||!s)o={next:s??void 0,error:n??void 0,complete:r??void 0};else{var c;i&&Hi.useDeprecatedNextContext?(c=Object.create(s),c.unsubscribe=function(){return i.unsubscribe()},o={next:s.next&&yt(s.next,c),error:s.error&&yt(s.error,c),complete:s.complete&&yt(s.complete,c)}):o=s}return i.destination=new Gi(o),i}return e}(Vn);function wt(t){Wi(t)}function ki(t){throw t}var ji={closed:!0,next:je,error:ki,complete:je};function Vi(t,e,s,n,r){return new zi(t,e,s,n,r)}var zi=function(t){Ee(e,t);function e(s,n,r,i,o,c){var u=t.call(this,s)||this;return u.onFinalize=o,u.shouldUnsubscribe=c,u._next=n?function(a){try{n(a)}catch(l){s.error(l)}}:t.prototype._next,u._error=i?function(a){try{i(a)}catch(l){s.error(l)}finally{this.unsubscribe()}}:t.prototype._error,u._complete=r?function(){try{r()}catch(a){s.error(a)}finally{this.unsubscribe()}}:t.prototype._complete,u}return e.prototype.unsubscribe=function(){var s;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;t.prototype.unsubscribe.call(this),!n&&((s=this.onFinalize)===null||s===void 0||s.call(this))}},e}(Vn);function Ki(t,e){return Fi(function(s,n){var r=0;s.subscribe(Vi(n,function(i){n.next(t.call(e,i,r++))}))})}const Te=S.createIdentifier("resource-manager-service"),zn=S.createIdentifier("ResourcePersistenceService");Me(C.Ready,zn);var Yi=Object.defineProperty,Xi=Object.getOwnPropertyDescriptor,Qi=(t,e,s,n)=>{for(var r=n>1?void 0:n?Xi(e,s):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(e,s,r):o(r))||r);return n&&r&&Yi(e,s,r),r},Ve=(t,e)=>(s,n)=>e(s,n,t);const Pe=S.createIdentifier("univer.permission-service"),ze="PERMISSION";exports.PermissionService=class extends M{constructor(s,n){super();_(this,"_permissionPointMap",new Map);_(this,"deletePermissionPoint",(s,n)=>{const r=this._permissionPointMap.get(s);if(r){const i=r.get(n);i&&(i.complete(),this._permissionPointMap.delete(n))}});_(this,"addPermissionPoint",(s,n)=>{const r=this._permissionPointMap.get(s)||new Map;return r.has(n.id)?!1:(r.set(n.id,new L.BehaviorSubject(n)),this._permissionPointMap.set(s,r),!0)});_(this,"updatePermissionPoint",(s,n,r)=>{const i=this._permissionPointMap.get(s);if(!i)return;const o=i.get(n);if(o){const c=o.getValue();c.value=r,c.status=Se.DONE,o.next(c)}});_(this,"getPermissionPoint",(s,n)=>{const r=this._permissionPointMap.get(s);if(!r)return;const i=r.get(n);if(i)return i.getValue()});this._resourceManagerService=s,this._univerInstanceService=n}_init(){this.disposeWithMe(D(this._univerInstanceService.sheetAdded$.subscribe(s=>{this._resourceManagerService.registerPluginResource(s.getUnitId(),ze,{onChange:(n,r)=>{r.forEach(i=>{this.getPermissionPoint(n,i.id)?this.updatePermissionPoint(n,i.id,i.value):this.addPermissionPoint(n,i)})},toJson:n=>this._toJson(n),parseJson:n=>this._parseJson(n)})}))),this.disposeWithMe(D(this._univerInstanceService.sheetDisposed$.subscribe(s=>{this._resourceManagerService.disposePluginResource(s.getUnitId(),ze)})))}_toJson(s){const n=this._permissionPointMap.get(s);let r=[];return n&&(r=[...n.keys()].reduce((i,o)=>{const c=n.get(o);return c&&i.push(c.getValue()),i},[])),JSON.stringify(r)}_parseJson(s){return JSON.parse(s)}composePermission$(s,n){const r=this._permissionPointMap.get(s),i=n.map(o=>{const c=r==null?void 0:r.get(o);if(!c)throw new Error(`${o} permissionPoint is not exist`);return c.asObservable()});return L.combineLatest(i).pipe(Ki(o=>(o.every(c=>this._permissionPointMap.get(c.id)),o)))}composePermission(s,n){const r=this._permissionPointMap.get(s);return n.map(o=>{const c=r==null?void 0:r.get(o);if(!c)throw new Error(`${o} permissionPoint is not exist`);return c.getValue()})}};exports.PermissionService=Qi([Ue(C.Starting,exports.PermissionService),Ve(0,S.Inject(Te)),Ve(1,S.Inject(ft))],exports.PermissionService);const Kn="univer.editable";class Ut extends Bs{constructor(s){super();_(this,"id",Kn);_(this,"value",!0);_(this,"unitID");this.unitID=s}}var Ji=Object.defineProperty,Zi=Object.getOwnPropertyDescriptor,qi=(t,e,s,n)=>{for(var r=n>1?void 0:n?Zi(e,s):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(e,s,r):o(r))||r);return n&&r&&Ji(e,s,r),r},Ke=(t,e)=>(s,n)=>e(s,n,t);exports.UniverPermissionService=class extends M{constructor(e,s){super(),this._permissionService=e,this._univerInstanceService=s,this._init()}_init(){this._univerInstanceService.sheetAdded$.subscribe(e=>{const s=new Ut(e.getUnitId());this._permissionService.addPermissionPoint(e.getUnitId(),s)})}getEditable(e){let s=e;s||(s=this._univerInstanceService.getCurrentUniverSheetInstance().getUnitId());const n=new Ut(s),r=this._permissionService.getPermissionPoint(s,n.id);return r==null?void 0:r.value}setEditable(e,s){const n=new Ut(e);this._permissionService.updatePermissionPoint(e,n.id,s)}};exports.UniverPermissionService=qi([Ue(C.Starting,exports.UniverPermissionService),Ke(0,S.Inject(Pe)),Ke(1,S.Inject(ft))],exports.UniverPermissionService);class Yn extends M{constructor(){super(...arguments);_(this,"_resourceMap",new Map);_(this,"_register$",new L.Subject);_(this,"register$",this._register$.asObservable())}getAllResource(s){const n=this._resourceMap.get(s);return n?[...n.keys()].reduce((r,i)=>{const o=n.get(i);return o&&r.push({unitID:s,resourceName:i,hook:o}),r},[]):[]}registerPluginResource(s,n,r){const i=this._resourceMap.get(s)||new Map;if(i.has(n))throw new Error("the pluginName is registered");return i.set(n,r),this._resourceMap.set(s,i),this._register$.next({unitID:s,resourceName:n,hook:r}),D(()=>i.delete(n))}disposePluginResource(s,n){const r=this._resourceMap.get(s);r==null||r.delete(n)}dispose(){this._register$.complete(),this._resourceMap.clear()}}class de extends M{constructor(){super();_(this,"_currentTheme");_(this,"_currentTheme$",new L.BehaviorSubject({}));_(this,"currentTheme$",this._currentTheme$.asObservable());this.disposeWithMe(D(()=>this._currentTheme$.complete()))}getCurrentTheme(){if(!this._currentTheme)throw new Error("[ThemeService]: current theme is not set!");return this._currentTheme}setTheme(s){this._currentTheme=s,this._currentTheme$.next(s)}}const Xn="__defaultDocumentNormalEditorSpecialUnitId_20231006__",Qn="__defaultDocumentFormulaBarEditorSpecialUnitId_20231012__",yi=`\r
11
- `;var to=Object.defineProperty,eo=Object.getOwnPropertyDescriptor,so=(t,e,s,n)=>{for(var r=n>1?void 0:n?eo(e,s):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(e,s,r):o(r))||r);return n&&r&&to(e,s,r),r},te=(t,e)=>(s,n)=>e(s,n,t);const Qt=S.createIdentifier("univer.undo-redo.service"),no=20;exports.LocalUndoRedoService=class extends M{constructor(s,n,r){super();_(this,"undoRedoStatus$");_(this,"_undoRedoStatus$",new L.BehaviorSubject({undos:0,redos:0}));_(this,"_undoStacks",new Map);_(this,"_redoStacks",new Map);this._univerInstanceService=s,this._commandService=n,this._contextService=r,this.undoRedoStatus$=this._undoRedoStatus$.asObservable(),this.disposeWithMe(this._commandService.registerCommand(Zn)),this.disposeWithMe(this._commandService.registerCommand(qn)),this.disposeWithMe(D(()=>this._undoRedoStatus$.complete())),this.disposeWithMe(D(this._univerInstanceService.focused$.subscribe(()=>this._updateStatus())))}pushUndoRedo(s){const{unitID:n}=s,r=this._getRedoStack(n,!0),i=this._getUndoStack(n,!0);r.length=0,i.push(s),i.length>no&&i.splice(0,1),this._updateStatus()}clearUndoRedo(s){const n=this._getRedoStack(s);n&&(n.length=0);const r=this._getUndoStack(s);r&&(r.length=0),this._updateStatus()}pitchTopUndoElement(){const s=this._getUndoStackForFocused();return s.length?s[s.length-1]:null}pitchTopRedoElement(){const s=this._getRedoStackForFocused();return s.length?s[s.length-1]:null}popUndoToRedo(){const n=this._getUndoStackForFocused().pop();n&&(this._getRedoStackForFocused().push(n),this._updateStatus())}popRedoToUndo(){const n=this._getRedoStackForFocused().pop();n&&(this._getUndoStackForFocused().push(n),this._updateStatus())}_updateStatus(){var i,o;const s=this._getFocusedUniverInstanceId(),n=s&&((i=this._undoStacks.get(s))==null?void 0:i.length)||0,r=s&&((o=this._redoStacks.get(s))==null?void 0:o.length)||0;this._undoRedoStatus$.next({undos:n,redos:r})}_getUndoStack(s,n=!1){let r=this._undoStacks.get(s);return!r&&n&&(r=[],this._undoStacks.set(s,r)),r||null}_getRedoStack(s,n=!1){let r=this._redoStacks.get(s);return!r&&n&&(r=[],this._redoStacks.set(s,r)),r||null}_getUndoStackForFocused(){const s=this._getFocusedUniverInstanceId();if(!s)throw new Error("No focused univer instance!");return this._getUndoStack(s,!0)}_getRedoStackForFocused(){const s=this._getFocusedUniverInstanceId();if(!s)throw new Error("No focused univer instance!");return this._getRedoStack(s,!0)}_getFocusedUniverInstanceId(){var n;let s="";return this._contextService.getContextValue($n)?s=Qn:this._contextService.getContextValue(Gn)?s=Xn:s=((n=this._univerInstanceService.getFocusedUniverInstance())==null?void 0:n.getUnitId())??"",s}};exports.LocalUndoRedoService=so([te(0,ft),te(1,St),te(2,ut)],exports.LocalUndoRedoService);class Jn{dispose(){}async dispatchToHandlers(){return!1}}const Zn=new class extends Jn{constructor(){super(...arguments);_(this,"type",Vt.COMMAND);_(this,"id","univer.command.undo")}async handler(e){const s=e.get(Qt),n=s.pitchTopUndoElement();if(!n)return!1;const r=e.get(St);return(n.undo?await n.undo(n.undoMutations):Oe(n.undoMutations,r))?(s.popUndoToRedo(),!0):!1}},qn=new class extends Jn{constructor(){super(...arguments);_(this,"type",Vt.COMMAND);_(this,"id","univer.command.redo")}async handler(e){const s=e.get(Qt),n=s.pitchTopRedoElement();if(!n)return!1;const r=e.get(St);return(n.redo?await n.redo(n.redoMutations):Oe(n.redoMutations,r))?(s.popRedoToUndo(),!0):!1}};var ro=Object.defineProperty,io=Object.getOwnPropertyDescriptor,oo=(t,e,s,n)=>{for(var r=n>1?void 0:n?io(e,s):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(e,s,r):o(r))||r);return n&&r&&ro(e,s,r),r},Ye=(t,e)=>(s,n)=>e(s,n,t);exports.UniverDoc=class extends M{constructor(s,n){super();_(this,"_pluginStore",new $t);this._injector=s,this._initService=n}start(){this._pluginStore.forEachPlugin(s=>s.onStarting(this._injector)),this._initService.initModulesOnStage(C.Starting)}ready(){this.disposeWithMe(D(this._injector.get(exports.LifecycleService).subscribeWithPrevious().subscribe(s=>{if(s===C.Ready){this._pluginStore.forEachPlugin(n=>n.onReady()),this._initService.initModulesOnStage(C.Ready);return}if(s===C.Rendered){this._pluginStore.forEachPlugin(n=>n.onRendered()),this._initService.initModulesOnStage(C.Rendered);return}s===C.Steady&&(this._pluginStore.forEachPlugin(n=>n.onSteady()),this._initService.initModulesOnStage(C.Steady))})))}createDoc(s){return this._injector.createInstance(_t,s)}addPlugin(s,n){const r=this._injector.createInstance(s,n);r.onStarting(this._injector),this._pluginStore.addPlugin(r)}};exports.UniverDoc=oo([Ye(0,S.Inject(S.Injector)),Ye(1,S.Inject(it))],exports.UniverDoc);var co=Object.defineProperty,ao=Object.getOwnPropertyDescriptor,lo=(t,e,s,n)=>{for(var r=n>1?void 0:n?ao(e,s):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(e,s,r):o(r))||r);return n&&r&&co(e,s,r),r},Xe=(t,e)=>(s,n)=>e(s,n,t);exports.UniverSheet=class extends M{constructor(s,n){super();_(this,"_pluginStore",new $t);this._injector=s,this._initService=n,this._initDependencies(s)}start(){this._pluginStore.forEachPlugin(s=>s.onStarting(this._injector)),this._initService.initModulesOnStage(C.Starting)}ready(){this.disposeWithMe(D(this._injector.get(exports.LifecycleService).subscribeWithPrevious().subscribe(s=>{if(s===C.Ready){this._pluginStore.forEachPlugin(n=>n.onReady()),this._initService.initModulesOnStage(C.Ready);return}if(s===C.Rendered){this._pluginStore.forEachPlugin(n=>n.onRendered()),this._initService.initModulesOnStage(C.Rendered);return}s===C.Steady&&(this._pluginStore.forEachPlugin(n=>n.onSteady()),this._initService.initModulesOnStage(C.Steady))})))}createSheet(s){return this._injector.createInstance(exports.Workbook,s)}dispose(){super.dispose(),this._pluginStore.removePlugins()}addPlugin(s,n){const r=this._injector.createInstance(s,n);this._pluginStore.addPlugin(r)}_initDependencies(s){[].forEach(r=>s.add(r))}};exports.UniverSheet=lo([Xe(0,S.Inject(S.Injector)),Xe(1,S.Inject(it))],exports.UniverSheet);var uo=Object.defineProperty,ho=Object.getOwnPropertyDescriptor,_o=(t,e,s,n)=>{for(var r=n>1?void 0:n?ho(e,s):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(e,s,r):o(r))||r);return n&&r&&uo(e,s,r),r},ee=(t,e)=>(s,n)=>e(s,n,t);exports.UniverSlide=class extends M{constructor(s,n,r){super();_(this,"_pluginStore",new $t);this._injector=s,this._lifecycleService=n,this._initializerService=r}start(){this._pluginStore.forEachPlugin(s=>s.onStarting(this._injector)),this._initializerService.initModulesOnStage(C.Starting)}ready(){this.disposeWithMe(D(this._lifecycleService.subscribeWithPrevious().subscribe(s=>{if(s===C.Ready){this._pluginStore.forEachPlugin(n=>n.onReady()),this._initializerService.initModulesOnStage(C.Ready);return}if(s===C.Rendered){this._pluginStore.forEachPlugin(n=>n.onRendered()),this._initializerService.initModulesOnStage(C.Rendered);return}s===C.Steady&&(this._pluginStore.forEachPlugin(n=>n.onSteady()),this._initializerService.initModulesOnStage(C.Steady))})))}createSlide(s){return this._injector.createInstance(De,s)}addPlugin(s,n){const r=this._injector.createInstance(s,n);this._pluginStore.addPlugin(r)}};exports.UniverSlide=_o([ee(0,S.Inject(S.Injector)),ee(1,S.Inject(exports.LifecycleService)),ee(2,S.Inject(it))],exports.UniverSlide);class fo{constructor(e={}){_(this,"_rootInjector");_(this,"_univerPluginStore",new $t);_(this,"_univerPluginRegistry",new rr);_(this,"_univerSheet",null);_(this,"_univerDoc",null);_(this,"_univerSlide",null);this._rootInjector=this._initDependencies();const{theme:s,locale:n,locales:r,logLevel:i}=e;s&&this._rootInjector.get(de).setTheme(s),r&&this._rootInjector.get(Ot).load(r),n&&this._rootInjector.get(Ot).setLocale(n),i&&this._rootInjector.get(ht).setLogLevel(i)}get _univerInstanceService(){return this._rootInjector.get(ft)}__getInjector(){return this._rootInjector}dispose(){this._rootInjector.dispose()}registerPlugin(e,s){if(e.type===k.Univer)this._registerUniverPlugin(e,s);else if(e.type===k.Sheet)this._registerUniverSheets(e,s);else if(e.type===k.Doc)this._registerUniverDocs(e,s);else if(e.type===k.Slide)this._registerUniverSlides(e,s);else throw new Error(`Unimplemented plugin system for business: "${e.type}".`)}setLocale(e){this._rootInjector.get(Ot).setLocale(e)}createUniverSheet(e){let s;const n=()=>{s=this._univerSheet.createSheet(e),this._univerInstanceService.addSheet(s)};return this._univerSheet?n():(this._univerSheet=this._rootInjector.createInstance(exports.UniverSheet),this._univerPluginRegistry.getRegisterPlugins(k.Sheet).forEach(r=>this._univerSheet.addPlugin(r.plugin,r.options)),this._tryStart(),this._univerSheet.start(),n(),this._tryProgressToReady(),this._univerSheet.ready()),s}createUniverDoc(e){let s;const n=()=>{s=this._univerDoc.createDoc(e),this._univerInstanceService.addDoc(s)};return this._univerDoc?n():(this._univerDoc=this._rootInjector.createInstance(exports.UniverDoc),this._univerPluginRegistry.getRegisterPlugins(k.Doc).forEach(r=>this._univerDoc.addPlugin(r.plugin,r.options)),this._tryStart(),this._univerDoc.start(),n(),this._tryProgressToReady(),this._univerDoc.ready()),s}createUniverSlide(e){let s;const n=()=>{s=this._univerSlide.createSlide(e),this._univerInstanceService.addSlide(s)};return this._univerSlide?n():(this._univerSlide=this._rootInjector.createInstance(exports.UniverSlide),this._univerPluginRegistry.getRegisterPlugins(k.Slide).forEach(r=>this._univerSlide.addPlugin(r.plugin,r.options)),this._tryStart(),this._univerSlide.ready(),n(),this._tryProgressToReady()),s}_initDependencies(){return new S.Injector([[ft,{useFactory:e=>new ue({createUniverDoc:s=>this.createUniverDoc(s),createUniverSheet:s=>this.createUniverSheet(s),createUniverSlide:s=>this.createUniverSlide(s)},e),deps:[ut]}],[as],[Ot],[de],[Ce],[exports.LifecycleService],[it],[Pe,{useClass:exports.PermissionService}],[exports.UniverPermissionService],[ht,{useClass:os,lazy:!0}],[St,{useClass:exports.CommandService,lazy:!0}],[Qt,{useClass:exports.LocalUndoRedoService,lazy:!0}],[cs,{useClass:Er}],[ut,{useClass:rs}],[us,{useClass:ls,lazy:!0}],[Te,{useClass:Yn,lazy:!0}]])}_tryStart(){this._rootInjector.get(it).start()}_tryProgressToReady(){this._rootInjector.get(exports.LifecycleService).stage<C.Ready&&(this._rootInjector.get(exports.LifecycleService).stage=C.Ready,this._univerPluginStore.forEachPlugin(s=>s.onReady()))}_registerUniverPlugin(e,s){const n=this._rootInjector.createInstance(e,s);n.onStarting(this._rootInjector),this._univerPluginStore.addPlugin(n)}_registerUniverSheets(e,s){this._univerPluginRegistry.registerPlugin(e,s)}_registerUniverDocs(e,s){this._univerPluginRegistry.registerPlugin(e,s)}_registerUniverSlides(e,s){this._univerPluginRegistry.registerPlugin(e,s)}_initializePluginsForDoc(e){this._univerPluginRegistry.getRegisterPlugins(k.Doc).forEach(n=>{e.addPlugin(n.plugin,n.options)})}_initializePluginsForSlide(e){this._univerPluginRegistry.getRegisterPlugins(k.Slide).forEach(n=>{e.addPlugin(n.plugin,n.options)})}}function go(t){const e=new MessageChannel;let s=!1;return e.port1.onmessage=()=>{s||t()},e.port2.postMessage(null),()=>{s=!0}}class Eo extends jt{add(e){if(!e)return null;const s=new kt(e,this);return this._observers=[s],this._onObserverAdded&&this._onObserverAdded(s),s}makeObserverTopPriority(){}makeObserverBottomPriority(){}}const Ro=S.createIdentifier("ILocalStorageService"),Oo=t=>`sheet_interceptor_${t}`,yn=t=>function(e,s){let n=-1;function r(i,o){if(i<=n)throw new Error("[SheetInterceptorService]: next() called multiple times!");return n=i,i===t.length?o:t[i].handler(o,s,r.bind(null,i+1))}return r(0,e)};class Ao{constructor(e){_(this,"_interceptorsByName",new Map);_(this,"_interceptorPoints");this._interceptorPoints=e}fetchThroughInterceptors(e){const s=e,n=this._interceptorsByName.get(s);return yn(n||[])}intercept(e,s){const n=e;this._interceptorsByName.has(n)||this._interceptorsByName.set(n,[]);const r=this._interceptorsByName.get(n);return r.push(s),this._interceptorsByName.set(n,r.sort((i,o)=>(o.priority??0)-(i.priority??0))),()=>y(this._interceptorsByName.get(n),s)}getInterceptPoints(){return this._interceptorPoints}}const Qe=`'?\\[((?![\\/?:"<>|*\\\\]).)*\\]`,mo=/[^0-9]/g,Io=/[^A-Za-z]/g;function mt(t){const e=t[0]==="$",n=t.substring(1).indexOf("$")>-1;return e&&n?K.ALL:e?K.COLUMN:n?K.ROW:K.NONE}function Co(t){const e=t.split("!");e.length>1&&(t=e[e.length-1]);const s=t.split(":");return s.length>1?{startAbsoluteRefType:mt(s[0]),endAbsoluteRefType:mt(s[1])}:{startAbsoluteRefType:mt(s[0])}}function Je(t=K.NONE){let e="",s="";return t===K.ROW?e="$":t===K.COLUMN?s="$":t===K.ALL&&(e="$",s="$"),{rowAbsoluteString:e,columnAbsoluteString:s}}function Jt(t){const{startColumn:e,startRow:s,endColumn:n,endRow:r,startAbsoluteRefType:i,endAbsoluteRefType:o}=t,c=Je(i),u=Je(o),a=`${c.columnAbsoluteString}${O.chatAtABC(e)}${c.rowAbsoluteString}${s+1}`,l=`${u.columnAbsoluteString}${O.chatAtABC(n)}${u.rowAbsoluteString}${r+1}`;return a===l?a:`${a}:${l}`}function tr(t,e){return`${t}!${Jt(e)}`}function er(t,e,s){return`[${t}]${e}!${Jt(s)}`}function So(t){const{unitId:e,sheetName:s,range:n}=t;return e!=null&&e.length>0&&s!=null&&s.length>0?er(e,s,n):s!=null&&s.length>0?tr(s,n):Jt(n)}function se(t){const e=parseInt(t.replace(mo,""))-1,s=O.ABCatNum(t.replace(Io,"")),n=mt(t);return{row:e,column:s,absoluteRefType:n}}function No(t){const e=new RegExp(Qe).exec(t);let s="";e!=null&&(s=e[0],t=t.replace(new RegExp(Qe,"g"),""));const n=t.indexOf("!");let r="",i="";n>-1?(r=t.substring(0,n),i=t.substring(n)):i=t;const o=i.indexOf(":");if(o===-1){const E=se(i),R=E.row,A=E.column,m=E.absoluteRefType;return{unitId:s,sheetName:r,range:{startRow:R,startColumn:A,endRow:R,endColumn:A,startAbsoluteRefType:m,endAbsoluteRefType:m}}}const c=i.substring(0,o),u=i.substring(o+1),a=se(c),l=se(u),h=a.row,d=a.column,f=l.row,g=l.column;return{unitId:s,sheetName:r,range:{startRow:h,startColumn:d,endRow:f,endColumn:g,startAbsoluteRefType:a.absoluteRefType,endAbsoluteRefType:l.absoluteRefType}}}exports.ABCToNumber=Qr;exports.ACTION_NAMES=qs;exports.AbsoluteRefType=K;exports.AlignTypeH=Pn;exports.AlignTypeV=pn;exports.AutoFillSeries=fs;exports.BaselineOffset=xt;exports.BlockType=gn;exports.BooleanNumber=I;exports.BorderStyleTypes=w;exports.BorderType=gs;exports.BulletAlignment=dn;exports.CellValueType=At;exports.Color=rt;exports.ColorBuilder=Yt;exports.ColorType=G;exports.ColumnSeparatorType=On;exports.CommandType=Vt;exports.CommonHideTypes=Es;exports.ConditionType=Rs;exports.ContentAlignment=vn;exports.ContextService=rs;exports.CopyPasteType=Os;exports.CustomRangeType=fn;exports.DEFAULT_CELL=Ei;exports.DEFAULT_DOC=Le;exports.DEFAULT_DOCUMENT_SUB_COMPONENT_ID=Rr;exports.DEFAULT_EMPTY_DOCUMENT_VALUE=yi;exports.DEFAULT_RANGE=fi;exports.DEFAULT_RANGE_ARRAY=Rt;exports.DEFAULT_SELECTION=gi;exports.DEFAULT_SLIDE=cn;exports.DEFAULT_STYLES=vt;exports.DEFAULT_WORKBOOK=ys;exports.DEFAULT_WORKSHEET=Gt;exports.DEFAULT_WORKSHEET_COLUMN_COUNT=en;exports.DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT=on;exports.DEFAULT_WORKSHEET_COLUMN_WIDTH=nn;exports.DEFAULT_WORKSHEET_ROW_COUNT=tn;exports.DEFAULT_WORKSHEET_ROW_HEIGHT=sn;exports.DEFAULT_WORKSHEET_ROW_TITLE_WIDTH=rn;exports.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY=Qn;exports.DOCS_NORMAL_EDITOR_UNIT_ID_KEY=Xn;exports.DashStyleType=bn;exports.DataStreamTreeNodeType=ks;exports.DataStreamTreeTokenType=Ne;exports.DesktopLogService=os;exports.DeveloperMetadataVisibility=As;exports.Dimension=ms;exports.Direction=Is;exports.Disposable=M;exports.DisposableCollection=ns;exports.DocStyleType=un;exports.DocumentDataModel=_t;exports.DocumentType=kn;exports.EXTENSION_NAMES=an;exports.Entry=ie;exports.EntryIterator=Ws;exports.ErrorService=as;exports.EventState=es;exports.FOCUSING_DOC=ae;exports.FOCUSING_EDITOR=Gn;exports.FOCUSING_EDITOR_BUT_HIDDEN=wi;exports.FOCUSING_EDITOR_INPUT_FORMULA=Li;exports.FOCUSING_FORMULA_EDITOR=$n;exports.FOCUSING_SHEET=ce;exports.FOCUSING_SLIDE=le;exports.FloatingObjectManagerService=ls;exports.FollowNumberWithType=hn;exports.FontItalic=Pt;exports.FontStyleType=Dn;exports.FontWeight=pt;exports.FormatType=Cs;exports.GenName=Ce;exports.GlyphType=_n;exports.GridType=En;exports.HLSColor=Ds;exports.HorizontalAlign=st;exports.ICommandService=St;exports.IConfigService=cs;exports.IContextService=ut;exports.IFloatingObjectManagerService=us;exports.ILocalStorageService=Ro;exports.ILogService=ht;exports.IPermissionService=Pe;exports.IResourceManagerService=Te;exports.ISnapshotPersistenceService=zn;exports.IUndoRedoService=Qt;exports.IUniverInstanceService=ft;exports.InterceptorManager=Ao;exports.InterpolationPointType=Ss;exports.KeyIterator=Fs;exports.LRUHelper=Et;exports.LRUMap=zr;exports.LifecycleStages=C;exports.LocaleService=Ot;exports.LocaleType=zt;exports.LogLevel=is;exports.MemoryCursor=hs;exports.NamedStyleType=Sn;exports.NumberUnitType=Tn;exports.ObjectArray=b;exports.ObjectArrayIterableIterator=Xt;exports.ObjectMatrix=F;exports.ObjectRelativeFromH=Un;exports.ObjectRelativeFromV=Mn;exports.Observable=jt;exports.ObservableHooks=Eo;exports.Observer=kt;exports.OnLifecycle=Ue;exports.PageElementType=Hn;exports.PageOrientType=Fn;exports.PageType=ve;exports.ParagraphElementType=mn;exports.PermissionPoint=Bs;exports.PermissionStatus=Se;exports.Plugin=Ze;exports.PluginType=k;exports.PositionedObjectLayoutType=Cn;exports.ProtectionType=Ns;exports.RANGE_TYPE=z;exports.Range=dt;exports.Rectangle=lt;exports.RedoCommand=qn;exports.RefAlias=Xr;exports.Registry=fe;exports.RegistryAsMap=ge;exports.RelativeDate=bs;exports.RelativeSlideLink=Wn;exports.ResourceManagerService=Yn;exports.RgbColor=Ft;exports.RxDisposable=lr;exports.SectionType=Rn;exports.ShapeType=ws;exports.SheetTypes=Ae;exports.SheetViewModel=Bn;exports.Slide=De;exports.SpacingRule=Nn;exports.Styles=ln;exports.THEME_COLORS=vs;exports.TabStopAlignment=wn;exports.TextDecoration=Ls;exports.TextDirection=It;exports.TextDirectionType=An;exports.ThemeColor=Ht;exports.ThemeColorType=x;exports.ThemeColors=Kt;exports.ThemeService=de;exports.Tools=O;exports.UndoCommand=Zn;exports.Univer=fo;exports.UniverEditablePermission=Ut;exports.UniverEditablePermissionPoint=Kn;exports.UpdateDocsAttributeType=P;exports.ValueIterator=Hs;exports.VerticalAlign=ct;exports.WidthType=Ln;exports.Worksheet=Ct;exports.WrapStrategy=at;exports.WrapTextType=In;exports.binarySearchArray=_s;exports.characterSpacingControlType=xn;exports.checkParagraphHasBullet=Tr;exports.checkParagraphHasIndent=Pr;exports.checkParagraphHasIndentByStyle=Ms;exports.codeToBlob=Ar;exports.composeInterceptors=yn;exports.createInterceptorKey=Oo;exports.createRowColIter=oe;exports.datenum_local=xs;exports.dedupe=ir;exports.deepCompare=me;exports.deleteContent=Ps;exports.deserializeRangeWithSheet=No;exports.error=re;exports.fromObservable=ar;exports.generate=kr;exports.getAbsoluteRefTypeWitString=Co;exports.getAbsoluteRefTypeWithSingleString=mt;exports.getBorderStyleType=Mr;exports.getCellValueType=Oi;exports.getColorStyle=V;exports.getDocsUpdateBody=Lt;exports.getReverseDirection=mr;exports.getTypeFromPermissionItemList=Kr;exports.getWorksheetUID=bi;exports.handleJsonToDom=Dr;exports.handleStyleToString=Ur;exports.hashAlgorithm=Vr;exports.horizontalLineSegmentsSubtraction=Ie;exports.insertTextToContent=Ts;exports.isEmptyCell=wr;exports.isFormulaId=vr;exports.isFormulaString=Lr;exports.isICellData=Ri;exports.isNullCell=Ai;exports.isObserver=ss;exports.isRealNum=et;exports.isSameStyleTextRun=Us;exports.makeCellRangeToRangeData=br;exports.makeCellToSelection=Nr;exports.numberToABC=Zr;exports.numberToListABC=qr;exports.orderSearchArray=ds;exports.remove=y;exports.repeatStringNumTimes=$s;exports.requestImmediateMacroTask=go;exports.runOnLifecycle=Me;exports.searchArray=Or;exports.selectionToArray=Yr;exports.sequence=ye;exports.sequenceAsync=qe;exports.sequenceExecute=Oe;exports.sequenceExecuteAsync=gr;exports.serializeRange=Jt;exports.serializeRangeToRefString=So;exports.serializeRangeWithSheet=tr;exports.serializeRangeWithSpreadsheet=er;exports.sortRules=yr;exports.sortRulesByDesc=ti;exports.sortRulesFactory=gt;exports.toDisposable=D;exports.update=jr;
9
+ */(function(t){(function(e,s){t.exports?t.exports=s():e.numeral=s()})(qr,function(){var e,s,n="2.0.6",r={},i={},o={currentLocale:"en",zeroFormat:null,nullFormat:null,defaultFormat:"0,0",scalePercentBy100:!0},a={currentLocale:o.currentLocale,zeroFormat:o.zeroFormat,nullFormat:o.nullFormat,defaultFormat:o.defaultFormat,scalePercentBy100:o.scalePercentBy100};function c(l,u){this._input=l,this._value=u}return e=function(l){var u,h,f,_;if(e.isNumeral(l))u=l.value();else if(l===0||typeof l>"u")u=0;else if(l===null||s.isNaN(l))u=null;else if(typeof l=="string")if(a.zeroFormat&&l===a.zeroFormat)u=0;else if(a.nullFormat&&l===a.nullFormat||!l.replace(/[^0-9]+/g,"").length)u=null;else{for(h in r)if(_=typeof r[h].regexps.unformat=="function"?r[h].regexps.unformat():r[h].regexps.unformat,_&&l.match(_)){f=r[h].unformat;break}f=f||e._.stringToNumber,u=f(l)}else u=Number(l)||null;return new c(l,u)},e.version=n,e.isNumeral=function(l){return l instanceof c},e._=s={numberToFormat:function(l,u,h){var f=i[e.options.currentLocale],_=!1,g=!1,E=0,R="",O=1e12,A=1e9,L=1e6,F=1e3,x="",ot=!1,H,X,U,G,Jt,pe,K;if(l=l||0,X=Math.abs(l),e._.includes(u,"(")?(_=!0,u=u.replace(/[\(|\)]/g,"")):(e._.includes(u,"+")||e._.includes(u,"-"))&&(Jt=e._.includes(u,"+")?u.indexOf("+"):l<0?u.indexOf("-"):-1,u=u.replace(/[\+|\-]/g,"")),e._.includes(u,"a")&&(H=u.match(/a(k|m|b|t)?/),H=H?H[1]:!1,e._.includes(u," a")&&(R=" "),u=u.replace(new RegExp(R+"a[kmbt]?"),""),X>=O&&!H||H==="t"?(R+=f.abbreviations.trillion,l=l/O):X<O&&X>=A&&!H||H==="b"?(R+=f.abbreviations.billion,l=l/A):X<A&&X>=L&&!H||H==="m"?(R+=f.abbreviations.million,l=l/L):(X<L&&X>=F&&!H||H==="k")&&(R+=f.abbreviations.thousand,l=l/F)),e._.includes(u,"[.]")&&(g=!0,u=u.replace("[.]",".")),U=l.toString().split(".")[0],G=u.split(".")[1],pe=u.indexOf(","),E=(u.split(".")[0].split(",")[0].match(/0/g)||[]).length,G?(e._.includes(G,"[")?(G=G.replace("]",""),G=G.split("["),x=e._.toFixed(l,G[0].length+G[1].length,h,G[1].length)):x=e._.toFixed(l,G.length,h),U=x.split(".")[0],e._.includes(x,".")?x=f.delimiters.decimal+x.split(".")[1]:x="",g&&Number(x.slice(1))===0&&(x="")):U=e._.toFixed(l,0,h),R&&!H&&Number(U)>=1e3&&R!==f.abbreviations.trillion)switch(U=String(Number(U)/1e3),R){case f.abbreviations.thousand:R=f.abbreviations.million;break;case f.abbreviations.million:R=f.abbreviations.billion;break;case f.abbreviations.billion:R=f.abbreviations.trillion;break}if(e._.includes(U,"-")&&(U=U.slice(1),ot=!0),U.length<E)for(var Fe=E-U.length;Fe>0;Fe--)U="0"+U;return pe>-1&&(U=U.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1"+f.delimiters.thousands)),u.indexOf(".")===0&&(U=""),K=U+x+(R||""),_?K=(_&&ot?"(":"")+K+(_&&ot?")":""):Jt>=0?K=Jt===0?(ot?"-":"+")+K:K+(ot?"-":"+"):ot&&(K="-"+K),K},stringToNumber:function(l){var u=i[a.currentLocale],h=l,f={thousand:3,million:6,billion:9,trillion:12},_,g,E;if(a.zeroFormat&&l===a.zeroFormat)g=0;else if(a.nullFormat&&l===a.nullFormat||!l.replace(/[^0-9]+/g,"").length)g=null;else{g=1,u.delimiters.decimal!=="."&&(l=l.replace(/\./g,"").replace(u.delimiters.decimal,"."));for(_ in f)if(E=new RegExp("[^a-zA-Z]"+u.abbreviations[_]+"(?:\\)|(\\"+u.currency.symbol+")?(?:\\))?)?$"),h.match(E)){g*=Math.pow(10,f[_]);break}g*=(l.split("-").length+Math.min(l.split("(").length-1,l.split(")").length-1))%2?1:-1,l=l.replace(/[^0-9\.]+/g,""),g*=Number(l)}return g},isNaN:function(l){return typeof l=="number"&&isNaN(l)},includes:function(l,u){return l.indexOf(u)!==-1},insert:function(l,u,h){return l.slice(0,h)+u+l.slice(h)},reduce:function(l,u){if(this===null)throw new TypeError("Array.prototype.reduce called on null or undefined");if(typeof u!="function")throw new TypeError(u+" is not a function");var h=Object(l),f=h.length>>>0,_=0,g;if(arguments.length===3)g=arguments[2];else{for(;_<f&&!(_ in h);)_++;if(_>=f)throw new TypeError("Reduce of empty array with no initial value");g=h[_++]}for(;_<f;_++)_ in h&&(g=u(g,h[_],_,h));return g},multiplier:function(l){var u=l.toString().split(".");return u.length<2?1:Math.pow(10,u[1].length)},correctionFactor:function(){var l=Array.prototype.slice.call(arguments);return l.reduce(function(u,h){var f=s.multiplier(h);return u>f?u:f},1)},toFixed:function(l,u,h,f){var _=l.toString().split("."),g=u-(f||0),E,R,O,A;return _.length===2?E=Math.min(Math.max(_[1].length,g),u):E=g,O=Math.pow(10,E),A=(h(l+"e+"+E)/O).toFixed(E),f>u-E&&(R=new RegExp("\\.?0{1,"+(f-(u-E))+"}$"),A=A.replace(R,"")),A}},e.options=a,e.formats=r,e.locales=i,e.locale=function(l){return l&&(a.currentLocale=l.toLowerCase()),a.currentLocale},e.localeData=function(l){if(!l)return i[a.currentLocale];if(l=l.toLowerCase(),!i[l])throw new Error("Unknown locale : "+l);return i[l]},e.reset=function(){for(var l in o)a[l]=o[l]},e.zeroFormat=function(l){a.zeroFormat=typeof l=="string"?l:null},e.nullFormat=function(l){a.nullFormat=typeof l=="string"?l:null},e.defaultFormat=function(l){a.defaultFormat=typeof l=="string"?l:"0.0"},e.register=function(l,u,h){if(u=u.toLowerCase(),this[l+"s"][u])throw new TypeError(u+" "+l+" already registered.");return this[l+"s"][u]=h,h},e.validate=function(l,u){var h,f,_,g,E,R,O,A;if(typeof l!="string"&&(l+="",console.warn&&console.warn("Numeral.js: Value is not string. It has been co-erced to: ",l)),l=l.trim(),l.match(/^\d+$/))return!0;if(l==="")return!1;try{O=e.localeData(u)}catch{O=e.localeData(e.locale())}return _=O.currency.symbol,E=O.abbreviations,h=O.delimiters.decimal,O.delimiters.thousands==="."?f="\\.":f=O.delimiters.thousands,A=l.match(/^[^\d]+/),A!==null&&(l=l.substr(1),A[0]!==_)||(A=l.match(/[^\d]+$/),A!==null&&(l=l.slice(0,-1),A[0]!==E.thousand&&A[0]!==E.million&&A[0]!==E.billion&&A[0]!==E.trillion))?!1:(R=new RegExp(f+"{2}"),l.match(/[^\d.,]/g)?!1:(g=l.split(h),g.length>2?!1:g.length<2?!!g[0].match(/^\d+.*\d$/)&&!g[0].match(R):g[0].length===1?!!g[0].match(/^\d+$/)&&!g[0].match(R)&&!!g[1].match(/^\d+$/):!!g[0].match(/^\d+.*\d$/)&&!g[0].match(R)&&!!g[1].match(/^\d+$/)))},e.fn=c.prototype={clone:function(){return e(this)},format:function(l,u){var h=this._value,f=l||a.defaultFormat,_,g,E;if(u=u||Math.round,h===0&&a.zeroFormat!==null)g=a.zeroFormat;else if(h===null&&a.nullFormat!==null)g=a.nullFormat;else{for(_ in r)if(f.match(r[_].regexps.format)){E=r[_].format;break}E=E||e._.numberToFormat,g=E(h,f,u)}return g},value:function(){return this._value},input:function(){return this._input},set:function(l){return this._value=Number(l),this},add:function(l){var u=s.correctionFactor.call(null,this._value,l);function h(f,_,g,E){return f+Math.round(u*_)}return this._value=s.reduce([this._value,l],h,0)/u,this},subtract:function(l){var u=s.correctionFactor.call(null,this._value,l);function h(f,_,g,E){return f-Math.round(u*_)}return this._value=s.reduce([l],h,Math.round(this._value*u))/u,this},multiply:function(l){function u(h,f,_,g){var E=s.correctionFactor(h,f);return Math.round(h*E)*Math.round(f*E)/Math.round(E*E)}return this._value=s.reduce([this._value,l],u,1),this},divide:function(l){function u(h,f,_,g){var E=s.correctionFactor(h,f);return Math.round(h*E)/Math.round(f*E)}return this._value=s.reduce([this._value,l],u),this},difference:function(l){return Math.abs(e(this._value).subtract(l).value())}},e.register("locale","en",{delimiters:{thousands:",",decimal:"."},abbreviations:{thousand:"k",million:"m",billion:"b",trillion:"t"},ordinal:function(l){var u=l%10;return~~(l%100/10)===1?"th":u===1?"st":u===2?"nd":u===3?"rd":"th"},currency:{symbol:"$"}}),function(){e.register("format","bps",{regexps:{format:/(BPS)/,unformat:/(BPS)/},format:function(l,u,h){var f=e._.includes(u," BPS")?" ":"",_;return l=l*1e4,u=u.replace(/\s?BPS/,""),_=e._.numberToFormat(l,u,h),e._.includes(_,")")?(_=_.split(""),_.splice(-1,0,f+"BPS"),_=_.join("")):_=_+f+"BPS",_},unformat:function(l){return+(e._.stringToNumber(l)*1e-4).toFixed(15)}})}(),function(){var l={base:1e3,suffixes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]},u={base:1024,suffixes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]},h=l.suffixes.concat(u.suffixes.filter(function(_){return l.suffixes.indexOf(_)<0})),f=h.join("|");f="("+f.replace("B","B(?!PS)")+")",e.register("format","bytes",{regexps:{format:/([0\s]i?b)/,unformat:new RegExp(f)},format:function(_,g,E){var R,O=e._.includes(g,"ib")?u:l,A=e._.includes(g," b")||e._.includes(g," ib")?" ":"",L,F,x;for(g=g.replace(/\s?i?b/,""),L=0;L<=O.suffixes.length;L++)if(F=Math.pow(O.base,L),x=Math.pow(O.base,L+1),_===null||_===0||_>=F&&_<x){A+=O.suffixes[L],F>0&&(_=_/F);break}return R=e._.numberToFormat(_,g,E),R+A},unformat:function(_){var g=e._.stringToNumber(_),E,R;if(g){for(E=l.suffixes.length-1;E>=0;E--){if(e._.includes(_,l.suffixes[E])){R=Math.pow(l.base,E);break}if(e._.includes(_,u.suffixes[E])){R=Math.pow(u.base,E);break}}g*=R||1}return g}})}(),function(){e.register("format","currency",{regexps:{format:/(\$)/},format:function(l,u,h){var f=e.locales[e.options.currentLocale],_={before:u.match(/^([\+|\-|\(|\s|\$]*)/)[0],after:u.match(/([\+|\-|\)|\s|\$]*)$/)[0]},g,E,R;for(u=u.replace(/\s?\$\s?/,""),g=e._.numberToFormat(l,u,h),l>=0?(_.before=_.before.replace(/[\-\(]/,""),_.after=_.after.replace(/[\-\)]/,"")):l<0&&!e._.includes(_.before,"-")&&!e._.includes(_.before,"(")&&(_.before="-"+_.before),R=0;R<_.before.length;R++)switch(E=_.before[R],E){case"$":g=e._.insert(g,f.currency.symbol,R);break;case" ":g=e._.insert(g," ",R+f.currency.symbol.length-1);break}for(R=_.after.length-1;R>=0;R--)switch(E=_.after[R],E){case"$":g=R===_.after.length-1?g+f.currency.symbol:e._.insert(g,f.currency.symbol,-(_.after.length-(1+R)));break;case" ":g=R===_.after.length-1?g+" ":e._.insert(g," ",-(_.after.length-(1+R)+f.currency.symbol.length-1));break}return g}})}(),function(){e.register("format","exponential",{regexps:{format:/(e\+|e-)/,unformat:/(e\+|e-)/},format:function(l,u,h){var f,_=typeof l=="number"&&!e._.isNaN(l)?l.toExponential():"0e+0",g=_.split("e");return u=u.replace(/e[\+|\-]{1}0/,""),f=e._.numberToFormat(Number(g[0]),u,h),f+"e"+g[1]},unformat:function(l){var u=e._.includes(l,"e+")?l.split("e+"):l.split("e-"),h=Number(u[0]),f=Number(u[1]);f=e._.includes(l,"e-")?f*=-1:f;function _(g,E,R,O){var A=e._.correctionFactor(g,E),L=g*A*(E*A)/(A*A);return L}return e._.reduce([h,Math.pow(10,f)],_,1)}})}(),function(){e.register("format","ordinal",{regexps:{format:/(o)/},format:function(l,u,h){var f=e.locales[e.options.currentLocale],_,g=e._.includes(u," o")?" ":"";return u=u.replace(/\s?o/,""),g+=f.ordinal(l),_=e._.numberToFormat(l,u,h),_+g}})}(),function(){e.register("format","percentage",{regexps:{format:/(%)/,unformat:/(%)/},format:function(l,u,h){var f=e._.includes(u," %")?" ":"",_;return e.options.scalePercentBy100&&(l=l*100),u=u.replace(/\s?\%/,""),_=e._.numberToFormat(l,u,h),e._.includes(_,")")?(_=_.split(""),_.splice(-1,0,f+"%"),_=_.join("")):_=_+f+"%",_},unformat:function(l){var u=e._.stringToNumber(l);return e.options.scalePercentBy100?u*.01:u}})}(),function(){e.register("format","time",{regexps:{format:/(:)/,unformat:/(:)/},format:function(l,u,h){var f=Math.floor(l/60/60),_=Math.floor((l-f*60*60)/60),g=Math.round(l-f*60*60-_*60);return f+":"+(_<10?"0"+_:_)+":"+(g<10?"0"+g:g)},unformat:function(l){var u=l.split(":"),h=0;return u.length===3?(h=h+Number(u[0])*60*60,h=h+Number(u[1])*60,h=h+Number(u[2])):u.length===2&&(h=h+Number(u[0])*60,h=h+Number(u[1])),Number(h)}})}(),e})})(xs);var yr=xs.exports;const st=Jr(yr),le={v:"#VALUE!",n:"#NAME?",na:"#N/A",r:"#REF!",d:"#DIV/0!",nm:"#NUM!",nl:"#NULL!",sp:"#SPILL!"};function ti(t){let e=!1;for(const s in le)if(t===le[s]){e=!0;break}return e}function nt(t){return t===null||t.toString().replace(/\s/g,"")===""||typeof t=="boolean"?!1:!isNaN(t)}function ei(t){if(t===null||t.toString().length<5)return!1;if(e(t))return!0;return!1;function e(s){const n=/^(\d{4})-(\d{1,2})-(\d{1,2})(\s(\d{1,2}):(\d{1,2})(:(\d{1,2}))?)?$/,r=/^(\d{4})\/(\d{1,2})\/(\d{1,2})(\s(\d{1,2}):(\d{1,2})(:(\d{1,2}))?)?$/;if(!n.test(s)&&!r.test(s))return!1;const i=RegExp.$1,o=RegExp.$2,a=RegExp.$3;return!(i<1900||o>12||a>31||o===2&&(new Date(i,1,29).getDate()===29&&a>29||new Date(i,1,29).getDate()!==29&&a>28))}}let Wt=new Date("2017-02-19T19:06:09.000Z");Number.isNaN(Wt.getFullYear())&&(Wt=new Date("2/19/17"));const si=Wt.getFullYear()===2017;function ni(t,e){const s=new Date(t);if(si)return e>0?s.setTime(s.getTime()+s.getTimezoneOffset()*60*1e3):e<0&&s.setTime(s.getTime()-s.getTimezoneOffset()*60*1e3),s;if(t instanceof Date)return t;if(Wt.getFullYear()===1917&&!Number.isNaN(s.getFullYear())){const i=s.getFullYear();return t.indexOf(`${i}`)>-1||s.setFullYear(s.getFullYear()+100),s}const n=t.match(/\d+/g)||["2017","2","19","0","0","0"];let r=new Date(+n[0],+n[1]-1,+n[2],+n[3]||0,+n[4]||0,+n[5]||0);return t.indexOf("Z")>-1&&(r=new Date(r.getTime()-r.getTimezoneOffset()*60*1e3)),r}const ri=new Date(1900,2,1,0,0,0);function ps(t,e){let s=Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds());const n=Date.UTC(1899,11,31,0,0,0);return e?s-=1461*24*60*60*1e3:t>=ri&&(s+=24*60*60*1e3),(s-n)/(24*60*60*1e3)}function ii(t){let e=null,s={},n=t;if(t===null)return null;if(/^-?[0-9]{1,}[,][0-9]{3}(.[0-9]{1,2})?$/.test(t)){e=t,n=Number(t.split(".")[0].replace(",",""));let r="#,##0";if(t.split(".")[1]){r="#,##0.";for(let i=0;i<t.split(".")[1].length;i++)r+=0}s={fa:r,t:"n"}}else if(t.toString().substr(0,1)==="'")e=t.toString().substr(1),s={fa:"@",t:"s"};else if(t.toString().toUpperCase()==="TRUE")e="TRUE",s={fa:"General",t:"b"},n=!0;else if(t.toString().toUpperCase()==="FALSE")e="FALSE",s={fa:"General",t:"b"},n=!1;else if(ti(t))e=t.toString(),s={fa:"General",t:"e"};else if(/^\d{6}(18|19|20)?\d{2}(0[1-9]|1[12])(0[1-9]|[12]\d|3[01])\d{3}(\d|X)$/i.test(t))e=t.toString(),s={fa:"@",t:"s"};else if(nt(t)&&Math.abs(parseFloat(t))>0&&(Math.abs(parseFloat(t))>=1e11||Math.abs(parseFloat(t))<1e-9)){n=st(t).value();const r=n.toExponential();if(r.indexOf(".")>-1){let i=r.split(".")[1].split("e")[0].length;i>5&&(i=5),s={fa:`#0.${new Array(i+1).join("0")}E+00`,t:"n"}}else s={fa:"#0.E+00",t:"n"};e=Z.format(s.fa,n)}else if(t.toString().indexOf("%")>-1){const r=t.toString().indexOf("%"),i=t.toString().substr(0,r),o=i.replace(/,/g,"");if(r===t.toString().length-1&&nt(o))if(i.indexOf(".")>-1)if(i.indexOf(".")===i.lastIndexOf(".")){const a=i.split(".")[0];let l=i.split(".")[1].length;if(l>9&&(l=9),a.indexOf(",")>-1){let u=!0;const h=a.split(",");for(let f=1;f<h.length;f++)if(h[f].length<3){u=!1;break}u?(s={fa:`#,##0.${new Array(l+1).join("0")}%`,t:"n"},n=st(t).value(),e=Z.format(s.fa,n)):(e=t.toString(),s={fa:"@",t:"s"})}else s={fa:`0.${new Array(l+1).join("0")}%`,t:"n"},n=st(t).value(),e=Z.format(s.fa,n)}else e=t.toString(),s={fa:"@",t:"s"};else if(i.indexOf(",")>-1){let a=!0;const c=i.split(",");for(let l=1;l<c.length;l++)if(c[l].length<3){a=!1;break}a?(s={fa:"#,##0%",t:"n"},n=st(t).value(),e=Z.format(s.fa,n)):(e=t.toString(),s={fa:"@",t:"s"})}else s={fa:"0%",t:"n"},n=st(t).value(),e=Z.format(s.fa,n);else e=t.toString(),s={fa:"@",t:"s"}}else if(t.toString().indexOf(".")>-1)if(t.toString().indexOf(".")===t.toString().lastIndexOf(".")){const r=t.toString().split(".")[0],i=t.toString().split(".")[1];let o=i.length;if(o>9&&(o=9),r.indexOf(",")>-1){let a=!0;const c=r.split(",");for(let l=1;l<c.length;l++)if(!nt(c[l])||c[l].length<3){a=!1;break}a?(s={fa:`#,##0.${new Array(o+1).join("0")}`,t:"n"},n=st(t).value(),e=Z.format(s.fa,n)):(e=t.toString(),s={fa:"@",t:"s"})}else nt(r)&&nt(i)?(s={fa:`0.${new Array(o+1).join("0")}`,t:"n"},n=st(t).value(),e=Z.format(s.fa,n)):(e=t.toString(),s={fa:"@",t:"s"})}else e=t.toString(),s={fa:"@",t:"s"};else nt(t)?(e=t.toString(),s={fa:"General",t:"n"},n=parseFloat(t)):ei(t)&&(t.toString().indexOf(".")>-1||t.toString().indexOf(":")>-1||t.toString().length<16)?(n=ps(ni(t.toString().replace(/-/g,"/"))),n.toString().indexOf(".")>-1?t.toString().length>18?s.fa="yyyy-MM-dd hh:mm:ss":t.toString().length>11?s.fa="yyyy-MM-dd hh:mm":s.fa="yyyy-MM-dd":s.fa="yyyy-MM-dd",s.t="d",e=Z.format(s.fa,n)):(e=t,s.fa="General",s.t="g");return[e,s,n]}const Z={format(t,e){}},oi=(t,e)=>{};function ai(t){let e=0;for(let s=0;s<t.length;s++)e=t.charCodeAt(s)+(e<<6)+(e<<16)-e;return e>>>0}class Et{static hasLength(e,s){return e.length===s}static getValueType(e){return Object.prototype.toString.apply(e)}static isObject(e){return this.getValueType(e)==="[object Object]"}static isIterable(e){return e[Symbol.iterator]!=null}static isNumber(e){return this.getValueType(e)==="[object Number]"}}const S=Symbol("newer"),T=Symbol("older");class Fs{constructor(e){d(this,"entry");this.entry=e}[Symbol.iterator](){return this}next(){const e=this.entry;return e?(this.entry=e[S],{done:!1,value:e.key}):{done:!0,value:void 0}}}class Hs{constructor(e){d(this,"entry");this.entry=e}[Symbol.iterator](){return this}next(){const e=this.entry;return e?(this.entry=e[S],{done:!1,value:e.value}):{done:!0,value:void 0}}}class Bs{constructor(e){d(this,"entry");this.entry=e}[Symbol.iterator](){return this}next(){const e=this.entry;return e?(this.entry=e[S],{done:!1,value:[e.key,e.value]}):{done:!0,value:void 0}}}var Ho,Bo;class ue{constructor(e,s){d(this,"key");d(this,"value");d(this,Ho);d(this,Bo);this.key=e,this.value=s,this[S]=void 0,this[T]=void 0}toJSON(){return{key:this.key,value:this.value}}}Ho=S,Bo=T;class Ws{constructor(...e){d(this,"_keymap");d(this,"size",0);d(this,"limit");d(this,"oldest");d(this,"newest");d(this,"_onShiftListeners",[]);if(Et.hasLength(e,1)){if(Et.isNumber(e[0])){const s=e[0];this._initialize(s,void 0);return}if(Et.isIterable(e[0])){const s=e[0];this._initialize(0,s);return}return}if(Et.hasLength(e,2)){const s=e[0],n=e[1];this._initialize(s,n)}}onShift(e){if(this._onShiftListeners.indexOf(e)===-1)return this._onShiftListeners.push(e),v(()=>tt(this._onShiftListeners,e));throw new Error("[LRUMap]: the listener has been registered!")}_initialize(e,s){this.oldest=void 0,this.newest=void 0,this.size=0,this.limit=e,this._keymap=new Map,s&&(this.assign(s),e<1&&(this.limit=this.size))}_markEntryAsUsed(e){e!==this.newest&&(e[S]&&(e===this.oldest&&(this.oldest=e[S]),e[S][T]=e[T]),e[T]&&(e[T][S]=e[S]),e[S]=void 0,e[T]=this.newest,this.newest&&(this.newest[S]=e),this.newest=e)}assign(e){let s,n=this.limit||Number.MAX_VALUE;this._keymap.clear();const r=e[Symbol.iterator]();for(let i=r.next();!i.done;i=r.next()){const o=new ue(i.value[0],i.value[1]);if(this._keymap.set(o.key,o),s?(s[S]=o,o[T]=s):this.oldest=o,s=o,n--===0)throw new Error("overflow")}this.newest=s,this.size=this._keymap.size}set(e,s){let n=this._keymap.get(e);return n?(n.value=s,this._markEntryAsUsed(n),this):(this._keymap.set(e,n=new ue(e,s)),this.newest?(this.newest[S]=n,n[T]=this.newest):this.oldest=n,this.newest=n,++this.size,this.size>this.limit&&this.shift(),this)}shift(){const e=this.oldest;if(e)return this.oldest&&this.oldest[S]?(this.oldest=this.oldest[S],this.oldest[T]=void 0):(this.oldest=void 0,this.newest=void 0),e[S]=e[T]=void 0,this._keymap.delete(e.key),--this.size,this._onShiftListeners.forEach(s=>s(e)),[e.key,e.value]}get(e){const s=this._keymap.get(e);if(s)return this._markEntryAsUsed(s),s.value}has(e){return this._keymap.has(e)}find(e){const s=this._keymap.get(e);return s?s.value:void 0}delete(e){const s=this._keymap.get(e);if(s)return this._keymap.delete(s.key),s[S]&&s[T]?(s[T][S]=s[S],s[S][T]=s[T]):s[S]?(s[S][T]=void 0,this.oldest=s[S]):s[T]?(s[T][S]=void 0,this.newest=s[T]):this.oldest=this.newest=void 0,this.size--,s.value}clear(){this.oldest=void 0,this.newest=void 0,this.size=0,this._keymap.clear()}keys(){return new Fs(this.oldest)}values(){return new Hs(this.oldest)}entries(){return this[Symbol.iterator]()}[Symbol.iterator](){return new Bs(this.oldest)}forEach(e,s){typeof s!="object"&&(s=this);let n=this.oldest;for(;n;)e.call(s,n.value,n.key,this),n=n[S]}toJSON(){const e=new Array(this.size);let s=0,n=this.oldest;for(;n;)e[s++]={key:n.key,value:n.value},n=n[S];return e}toString(){let e="",s=this.oldest;for(;s;)e+=`${String(s.key)}:${s.value}`,s=s[S],s&&(e+=" < ");return e}}function Y(t){let e=0;const s=Object.keys(t);for(const n of s){const r=Number(n);e=Math.max(e,r)}return e+1}function li(t,e,s){const n=Y(s),r=s;for(let i=n-1;i>=t;i--)r[i+1]=r[i];r[t]=e}function ui(t,e){const s=t,n=Object.keys(s),r=n.length,i=e,o=Object.keys(i),a=o.length,c={};let l=0;for(let u=0;u<r;u++,l++){const h=n[u];c[l]=s[h]}for(let u=0;u<a;u++,l++){const h=o[u];c[l]=i[h]}return c}function ci(t,e,s){const n=s;if(Y(s)>0){const i={};let o=0;for(let a=t;a<e;a++)n[a]&&(i[o]=n[a],o++);return i}return{}}function ce(t,e,s,n){const r=t>s;if(!r&&t+e>s)throw new Error("Invalid move operation");r?hi(t,e,s,n):di(t,e,s,n)}function hi(t,e,s,n){const r=n,i=[];for(let o=t;o<t+e;o++)i.push(r[o]);for(let o=t-1;o>=s;o--){const a=r[o];r[o+e]=a,a==null&&delete r[o+e]}i.forEach((o,a)=>{r[s+a]=o})}function di(t,e,s,n){const r=n,i=[];for(let o=t;o<t+e;o++)i.push(r[o]);for(let o=t+e;o<s;o++){const a=r[o];r[o-e]=a,a==null&&delete r[o-e]}i.forEach((o,a)=>{r[s+a-e]=o})}class V{constructor(e={}){d(this,"_matrix");this._setOriginValue(e)}static MakeObjectMatrixSize(e){return new V({[e-1]:{}})}getMatrix(){return this._matrix}forEach(e){const s=this._matrix,n=Object.keys(s);for(const r of n){const i=Number(r),o=s[i];if(e(i,o)===!1)return this}return this}forRow(e){const s=this._matrix,n=Object.keys(s);for(const r of n){const i=Number(r),o=s[i];if(e(i,Object.keys(o).map(c=>Number(c)))===!1)return this}return this}forValue(e){const s=this._matrix,n=Object.keys(s);for(const r of n){const i=Number(r),o=s[i],a=Object.keys(o);for(const c of a){const l=Number(c),u=o[Number(c)];if(e(i,l,u)===!1)return this}}return this}swapRow(e,s){const n=this._matrix[e],r=this._matrix[s];this._matrix[e]=r,this._matrix[s]=n}getRow(e){return this._matrix[e]}getRowOrCreate(e){let s=this.getRow(e);return s==null&&(s={},this._matrix[e]=s),s}reset(){this._setOriginValue({})}hasValue(){const e=this._matrix,s=Object.keys(e);if(s.length===0)return!1;for(const n of s){const r=Number(n),i=e[r];if(Object.keys(i).length>0)return!0}return!1}getValue(e,s){var n,r;return(r=(n=this._matrix)==null?void 0:n[e])==null?void 0:r[s]}setValue(e,s,n){const r=this.getRowOrCreate(e);r[s]=n}deleteValue(e,s){var n,r;(r=(n=this._matrix)==null?void 0:n[e])==null||delete r[s]}realDeleteValue(e,s){var n,r,i;if((r=(n=this._matrix)==null?void 0:n[e])==null||delete r[s],this.getRow(e)){const o=this.getRow(e);if(o==null)return;Object.keys(o).length===0&&((i=this._matrix)==null||delete i[e])}}setRow(e,s){this._matrix[e]=s}moveRows(e,s,n){ce(e,s,n,this._matrix)}moveColumns(e,s,n){this.forEach((r,i)=>{ce(e,s,n,i)})}getFragment(e,s,n,r){const i=new V;let o=0;for(let a=e;a<=s;a++){const c={};let l=0;for(let u=n;u<=r;u++){const h=this.getValue(a,u);c[l]=h,l++}i.setRow(o,c),o++}return i}getSlice(e,s,n,r){const i=new V;for(let o=e;o<=s;o++)for(let a=n;a<=r;a++){const c=this.getValue(o,a);c&&i.setValue(o,a,m.deepClone(c))}return i}getSizeOf(){return Object.keys(this._matrix).length}getLength(){return Y(this._matrix)}getRange(){const n=this.getLength()-1;let r=0;const i=this.getLength();for(let o=0;o<i;o++){const a=this.getRow(o);if(a){const c=Y(a)-1;r=c>r?c:r}}return{startRow:0,startColumn:0,endRow:n,endColumn:r}}toNativeArray(){const e=new Array;return this.forValue((s,n,r)=>{e.push(r)}),e}toArray(){const e=[];return this.forRow((s,n)=>{e[s]==null&&(e[s]=[]),n.forEach(r=>{e[s][r]=this.getValue(s,r)})}),e}toJSON(){return this._matrix}clone(){const e=JSON.stringify(this._matrix);return JSON.parse(e)}getData(){const e=JSON.stringify(this._matrix);return JSON.parse(e)}getArrayData(){let e=0,s=0,n=!1,r=!1;const i=new V;return this.forEach((o,a)=>{n||(n=!0,e=o),Object.keys(a).forEach(c=>{const l=Number(c);r?l<s&&(s=l):(r=!0,s=l);const u=this.getValue(o,l);i.setValue(o-e,l-s,u)})}),i.getData()}getDataRange(){let e=0,s=0,n=0,r=!1,i=!1;this.forEach((a,c)=>{r||(r=!0,e=a);const l=Y(c)-1;l>n&&(n=l),Object.keys(c).forEach(u=>{const h=Number(u);i?h<s&&(s=h):(i=!0,s=h)})});const o=e+this.getSizeOf()-1;return{startRow:e,startColumn:s,endRow:o,endColumn:n}}getDiscreteRanges(){const e=[];return this.forEach((s,n)=>{Object.keys(n).forEach(r=>{const i=Number(r);let o=!1;for(const a of e)if(s>=a.startRow&&s<=a.endRow+1&&i>=a.startColumn&&i<=a.endColumn+1){a.endRow=Math.max(s,a.endRow),a.endColumn=Math.max(i,a.endColumn),o=!0;break}o||e.push({startRow:s,endRow:s,startColumn:i,endColumn:i})})}),e}merge(e){this.forValue((s,n)=>{const r=e.getValue(s,n);r!=null&&this.setValue(s,n,r)})}_setOriginValue(e={}){this._matrix=e}}var Ne=(t=>(t.INIT="init",t.FETCHING="fetching",t.DONE="done",t))(Ne||{});class Gs{constructor(){d(this,"status","init")}}const _i=t=>t.some(e=>e.status==="init")?"init":t.some(e=>e.status==="fetching")?"fetching":"done";var j=(t=>(t[t.NORMAL=0]="NORMAL",t[t.ROW=1]="ROW",t[t.COLUMN=2]="COLUMN",t[t.ALL=3]="ALL",t))(j||{}),z=(t=>(t[t.NONE=0]="NONE",t[t.ROW=1]="ROW",t[t.COLUMN=2]="COLUMN",t[t.ALL=3]="ALL",t))(z||{});function fi(t){return[t.startRow,t.startColumn,t.endRow,t.endColumn]}const y=class y{static clone(e){return{startRow:e.startRow,startColumn:e.startColumn,endRow:e.endRow,endColumn:e.endColumn,rangeType:e.rangeType}}static equals(e,s){return e.endRow===s.endRow&&e.endColumn===s.endColumn&&e.startRow===s.startRow&&e.startColumn===s.startColumn&&(e.rangeType===s.rangeType||e.rangeType===void 0&&s.rangeType===j.NORMAL||s.rangeType===void 0&&e.rangeType===j.NORMAL)}static intersects(e,s){const n=e.startRow,r=e.endRow,i=e.startColumn,o=e.endColumn,a=s.startRow,c=s.endRow,l=s.startColumn,u=s.endColumn,h=Math.abs(i+o-l-u),f=Math.abs(i-o)+Math.abs(l-u),_=Math.abs(n+r-a-c),g=Math.abs(n-r)+Math.abs(a-c);return h<=f&&_<=g}static getIntersects(e,s){const n=e.startRow,r=e.endRow,i=e.startColumn,o=e.endColumn,a=s.startRow,c=s.endRow,l=s.startColumn,u=s.endColumn;let h,f,_,g;if(a<=r)a>=n?f=a:f=n;else return null;if(c>=n)c>=r?g=r:g=c;else return null;if(l<=o)l>i?h=l:h=i;else return null;if(u>=i)u>=o?_=o:_=u;else return null;return{startRow:f,endRow:g,startColumn:h,endColumn:_,rangeType:j.NORMAL}}static contains(e,s){return e.startRow<=s.startRow&&e.endRow>=s.endRow&&e.startColumn<=s.startColumn&&e.endColumn>=s.endColumn}static realContain(e,s){return y.contains(e,s)&&(e.startRow<s.startRow||e.endRow>s.endRow||e.startColumn<s.startColumn||e.endColumn>s.endColumn)}static union(...e){return e.reduce((s,n)=>({startRow:Math.min(s.startRow,n.startRow),startColumn:Math.min(s.startColumn,n.startColumn),endRow:Math.max(s.endRow,n.endRow),endColumn:Math.max(s.endColumn,n.endColumn),rangeType:j.NORMAL}),e[0])}static subtract(e,s){if(s.startRow>=e.endRow||s.endRow<=e.startRow||s.startColumn>=e.endColumn||s.endColumn<=e.startColumn)return[e];const n=[];s.startRow>e.startRow&&n.push({startRow:e.startRow,startColumn:e.startColumn,endRow:s.startRow,endColumn:e.endColumn}),s.endRow<e.endRow&&n.push({startRow:s.endRow,startColumn:e.startColumn,endRow:e.endRow,endColumn:e.endColumn});const r=Math.max(e.startRow,s.startRow),i=Math.min(e.endRow,s.endRow);return s.startColumn>e.startColumn&&n.push({startRow:r,startColumn:e.startColumn,endRow:i,endColumn:s.startColumn}),s.endColumn<e.endColumn&&n.push({startRow:r,startColumn:s.endColumn,endRow:i,endColumn:e.endColumn}),n}};d(y,"getRelativeRange",(e,s)=>({startRow:e.startRow-s.startRow,endRow:e.endRow-e.startRow,startColumn:e.startColumn-s.startColumn,endColumn:e.endColumn-e.startColumn})),d(y,"getPositionRange",(e,s)=>({startRow:e.startRow+s.startRow,endRow:e.endRow+e.startRow+s.startRow,startColumn:e.startColumn+s.startColumn,endColumn:e.endColumn+e.startColumn+s.startColumn})),d(y,"moveHorizontal",(e,s=0,n=0)=>({...e,startColumn:e.startColumn+s,endColumn:e.endColumn+s+n})),d(y,"moveVertical",(e,s=0,n=0)=>({...e,startRow:e.startRow+s,endRow:e.endRow+s+n})),d(y,"moveOffset",(e,s,n)=>({...e,startRow:e.startRow+n,endRow:e.endRow+n,startColumn:e.startColumn+s,endColumn:e.endColumn+s}));let ut=y;class gi{constructor(e,s){d(this,"_values",[]);d(this,"_keys",[]);d(this,"_keyMaps",new Map);this._values=e,this._keys=s,e.forEach(n=>{this._initKeyMap(n)})}_initKeyMap(e){this._keys.forEach(s=>{const n=e[s],r=this._keyMaps.get(s)||new Map;r.set(n,e),this._keyMaps.set(s,r)})}getValue(e){for(let s=0;s<this._keys.length;s++){const n=this._keyMaps.get(this._keys[s]);if(n!=null&&n.has(e))return n.get(e)}return null}hasValue(e){for(let s=0;s<this._keys.length;s++){const n=this._keyMaps.get(this._keys[s]);if(n!=null&&n.has(e))return!0}return!1}addValue(e){this._values.push(e),this._initKeyMap(e)}setValue(e,s,n){const r=this.getValue(e);r&&Object.keys(r).includes(s)&&(r[s]=n)}deleteValue(e){const s=this.getValue(e);if(s){this._keys.forEach(r=>{const i=this._keyMaps.get(r),o=s[r];i==null||i.delete(o)});const n=this._values.findIndex(r=>r===s);this._values.splice(n,1)}}getValues(){return this._values}getKeyMap(e){var s;return[...((s=this._keyMaps.get(e))==null?void 0:s.keys())||[]]}clear(){this._values=[],this._keys=[],this._keyMaps.clear()}}function he(t,e,s,n){return{forEach(r){for(let i=t;i<=e;i++)for(let o=s;o<=n;o++)r(i,o)}}}function Ei(t){if(t==null||t.length===0)return NaN;const e=t.toLowerCase().split(""),s=e.length,n=o=>o.charCodeAt(0)-96;let r=0,i=0;for(let o=0;o<s;o++)i=n(e[o]),r+=i*26**(s-o-1);return r===0?NaN:r-1}const Gt=65,$s=90,Ri=97;function mi(t){const e=$s-Gt+1;let s="";for(;t>=0;)s=String.fromCharCode(t%e+Gt)+s,t=Math.floor(t/e)-1;return s}function ks(t,e){let s="";for(;e>0;)s+=t,e--;return s}function Oi(t,e=!1){const s=$s-Gt+1;let n=Ri;e&&(n=Gt);const r=String.fromCharCode(t%s+n),i=Math.floor(t/s)+1;return ks(r,i)}function Ai(t,e){return t.zIndex>e.zIndex?1:t.zIndex===e.zIndex?0:-1}function Ii(t,e){return t.zIndex>e.zIndex?-1:t.zIndex===e.zIndex?0:1}function gt(t="index",e=1){return(s,n)=>s[t]>n[t]?e:s[t]===n[t]?0:-e}var Vs=(t=>(t[t.PARAGRAPH=0]="PARAGRAPH",t[t.SECTION_BREAK=1]="SECTION_BREAK",t[t.TABLE=2]="TABLE",t[t.TABLE_ROW=3]="TABLE_ROW",t[t.TABLE_CELL=4]="TABLE_CELL",t))(Vs||{}),be=(t=>(t.PARAGRAPH="\r",t.SECTION_BREAK=`
10
+ `,t.TABLE_START="",t.TABLE_ROW_START="\x1B",t.TABLE_CELL_START="",t.TABLE_CELL_END="",t.TABLE_ROW_END="",t.TABLE_END="",t.CUSTOM_RANGE_START="",t.CUSTOM_RANGE_END="",t.COLUMN_BREAK="\v",t.PAGE_BREAK="\f",t.DOCS_END="\0",t.TAB=" ",t.CUSTOM_BLOCK="\b",t.LETTER="",t.SPACE=" ",t))(be||{});function js(t){const e=[];for(const s of t){const{st:n,ed:r}=s;if(n===r)continue;if(e.length===0){e.push(s);continue}const i=e.pop();Ds(s,i)&&m.hasIntersectionBetweenTwoRanges(i.st,i.ed,s.st,s.ed)?e.push({...s,st:i.st,ed:r}):e.push(i,s)}return e}function zs(t,e,s,n){const{textRuns:r}=t;if(r==null)return;const i=[],o=r.length;let a=!1;const c=e.textRuns??[];if(c.length)for(let l=0,u=c.length;l<u;l++){const h=c[l];h.st+=n,h.ed+=n}for(let l=0;l<o;l++){const u=r[l],{st:h,ed:f}=u;if(f<n)i.push(u);else if(n>=h&&n<=f)if(a)u.st+=s,u.ed+=s,i.push(u);else{a=!0,u.ed+=s;const _=[];if(c.length){const g={...u,st:h,ed:c[0].st};_.push(g),_.push(...c);const E=c[c.length-1],R={...u,st:E.ed,ed:f+s};_.push(R)}else _.push(u);i.push(..._)}else u.st+=s,u.ed+=s,a||(a=!0,i.push(...c)),i.push(u)}a||(a=!0,i.push(...c)),t.textRuns=js(i)}function Le(t,e,s,n){const{paragraphs:r}=t;if(r==null)return;const{paragraphs:i,dataStream:o}=e,a=[];let c=-1;for(let u=0,h=r.length;u<h;u++){const f=r[u],{startIndex:_}=f;_>=n&&(f.startIndex+=s),c===-1&&_>=n&&(c=u),a.push(f.startIndex)}let l=-1;if(i){for(let u=0,h=i.length;u<h;u++){const f=i[u];f.startIndex+=n;const _=f.startIndex;l=a.indexOf(_)}if(o===be.PARAGRAPH&&i.length===1){const u=r[c],h=i[0],f=u.paragraphStyle,_=u.bullet;u.paragraphStyle=h.paragraphStyle,u.bullet=h.bullet,h.paragraphStyle=f,h.bullet=_}l!==-1&&r.splice(l,1),r.push(...i),r.sort(gt("startIndex"))}}function Ci(t,e,s,n){const{sectionBreaks:r}=t;if(r==null)return;for(let o=0,a=r.length;o<a;o++){const c=r[o],{startIndex:l}=c;l>=n&&(c.startIndex+=s)}const i=e.sectionBreaks;if(i){for(let o=0,a=i.length;o<a;o++){const c=i[o];c.startIndex+=n}r.push(...i),r.sort(gt("startIndex"))}}function Ys(t,e,s,n){const{customBlocks:r}=t;if(r==null)return;for(let o=0,a=r.length;o<a;o++){const c=r[o],{startIndex:l}=c;l>=n&&(c.startIndex+=s)}const i=e.customBlocks;if(i){for(let o=0,a=i.length;o<a;o++){const c=i[o];c.startIndex+=n}r.push(...i),r.sort(gt("startIndex"))}}function we(t,e,s,n){const{tables:r}=t;if(r==null)return;for(let o=0,a=r.length;o<a;o++){const c=r[o],{startIndex:l,endIndex:u}=c;l>n?(c.startIndex+=s,c.endIndex+=s):u>=n-1&&(c.endIndex+=s)}const i=e.tables;if(i){for(let o=0,a=i.length;o<a;o++){const c=i[o];c.startIndex+=n,c.endIndex+=n}r.push(...i),r.sort(gt("startIndex"))}}function Si(t,e,s,n){const{customRanges:r}=t;if(r==null)return;for(let o=0,a=r.length;o<a;o++){const c=r[o],{startIndex:l,endIndex:u}=c;l>n?(c.startIndex+=s,c.endIndex+=s):u>=n-1&&(c.endIndex+=s)}const i=e.customRanges;if(i){for(let o=0,a=i.length;o<a;o++){const c=i[o];c.startIndex+=n,c.endIndex+=n}r.push(...i),r.sort(gt("startIndex"))}}function Ks(t,e,s){const{textRuns:n}=t,r=s,i=s+e,o=[];if(n){const a=[];for(let c=0,l=n.length;c<l;c++){const u=n[c],{st:h,ed:f}=u;if(r<=h&&i>=f){o.push({...u,st:h-r,ed:f-r});continue}else h<=r&&f>=i?(o.push({...u,st:r-r,ed:i-r}),u.ed-=e):r>=h&&r<f?(o.push({...u,st:r-r,ed:f-r}),u.ed=r):i>h&&i<=f?(o.push({...u,st:h-r,ed:i-r}),u.st=i-e,u.ed-=e):h>=i&&(u.st-=e,u.ed-=e);a.push(u)}t.textRuns=a}return o}function Xs(t,e,s){const{paragraphs:n}=t,r=s,i=s+e,o=[];if(n){const a=[];for(let c=0,l=n.length;c<l;c++){const u=n[c],{startIndex:h}=u;if(h>=r&&h<i){o.push({...u,startIndex:h-s});continue}else h>=i&&(u.startIndex-=e);a.push(u)}t.paragraphs=a}return o}function Qs(t,e,s){const{sectionBreaks:n}=t,r=s,i=s+e-1,o=[];if(n){const a=[];for(let c=0,l=n.length;c<l;c++){const u=n[c],{startIndex:h}=u;if(h>=r&&h<=i){o.push({...u,startIndex:h-s});continue}else h>i&&(u.startIndex-=e);a.push(u)}t.sectionBreaks=a}return o}function Zs(t,e,s){const{customBlocks:n}=t,r=s,i=s+e-1,o=[];if(n){const a=[];for(let c=0,l=n.length;c<l;c++){const u=n[c],{startIndex:h}=u;if(h>=r&&h<=i){o.push({...u,startIndex:h-s});continue}else h>i&&(u.startIndex-=e);a.push(u)}t.customBlocks=a}return o}function qs(t,e,s){const{tables:n}=t,r=s,i=s+e-1,o=[];if(n){const a=[];for(let c=0,l=n.length;c<l;c++){const u=n[c],{startIndex:h,endIndex:f}=u;if(r<=h&&i>=f){o.push({...u,startIndex:h-s,endIndex:f-s});continue}else if(h<=r&&f>=i){const _=Se(h,f,r,i);u.startIndex=_[0],u.endIndex=_[1]}else i<h&&(u.startIndex-=e,u.endIndex-=e);a.push(u)}t.tables=a}return o}function Js(t,e,s){const{customRanges:n}=t,r=s,i=s+e-1,o=[];if(n){const a=[];for(let c=0,l=n.length;c<l;c++){const u=n[c],{startIndex:h,endIndex:f}=u;if(r<=h&&i>=f){o.push({...u,startIndex:h-s,endIndex:f-s});continue}else if(h<=r&&f>=i){const _=Se(h,f,r,i);u.startIndex=_[0],u.endIndex=_[1]}else i<h&&(u.startIndex-=e,u.endIndex-=e);a.push(u)}t.customRanges=a}return o}function Ni(t,e,s){const{dataStream:n}=t,r=s,i=s+e,o=Ks(t,e,s),a=Xs(t,e,s),c=Qs(t,e,s),l=Zs(t,e,s),u=qs(t,e,s),h=Js(t,e,s);let f="";return n&&(t.dataStream=Ms(n,r,i),f=n.slice(r,i)),{dataStream:f,textRuns:o,paragraphs:a,sectionBreaks:c,customBlocks:l,tables:u,customRanges:h}}function bi(t,e,s,n){t.dataStream=Us(t.dataStream,n,e.dataStream),zs(t,e,s,n),Le(t,e,s,n),Ci(t,e,s,n),Ys(t,e,s,n),we(t,e,s,n),Si(t,e,s,n)}var ys=(t=>(t[t.character=0]="character",t[t.paragraph=1]="paragraph",t[t.table=2]="table",t[t.numbering=3]="numbering",t))(ys||{}),tn=(t=>(t[t.TAB=0]="TAB",t[t.SPACE=1]="SPACE",t[t.NOTHING=2]="NOTHING",t))(tn||{}),It=(t=>(t[t.GLYPH_TYPE_UNSPECIFIED=0]="GLYPH_TYPE_UNSPECIFIED",t[t.NONE=1]="NONE",t[t.DECIMAL=2]="DECIMAL",t[t.ZERO_DECIMAL=3]="ZERO_DECIMAL",t[t.UPPER_ALPHA=4]="UPPER_ALPHA",t[t.ALPHA=5]="ALPHA",t[t.UPPER_ROMAN=6]="UPPER_ROMAN",t[t.ROMAN=7]="ROMAN",t))(It||{}),q=(t=>(t[t.BULLET_ALIGNMENT_UNSPECIFIED=0]="BULLET_ALIGNMENT_UNSPECIFIED",t[t.START=1]="START",t[t.CENTER=2]="CENTER",t[t.END=3]="END",t))(q||{}),en=(t=>(t[t.HYPERLINK=0]="HYPERLINK",t[t.FIELD=1]="FIELD",t[t.SDT=2]="SDT",t[t.BOOKMARK=3]="BOOKMARK",t[t.COMMENT=4]="COMMENT",t[t.CUSTOM=5]="CUSTOM",t))(en||{}),sn=(t=>(t[t.DRAWING=0]="DRAWING",t[t.CUSTOM=1]="CUSTOM",t))(sn||{}),nn=(t=>(t[t.DEFAULT=0]="DEFAULT",t[t.LINES=1]="LINES",t[t.LINES_AND_CHARS=2]="LINES_AND_CHARS",t[t.SNAP_TO_CHARS=3]="SNAP_TO_CHARS",t))(nn||{}),rn=(t=>(t[t.SECTION_TYPE_UNSPECIFIED=0]="SECTION_TYPE_UNSPECIFIED",t[t.CONTINUOUS=1]="CONTINUOUS",t[t.NEXT_PAGE=2]="NEXT_PAGE",t[t.EVEN_PAGE=3]="EVEN_PAGE",t[t.ODD_PAGE=4]="ODD_PAGE",t))(rn||{}),on=(t=>(t[t.COLUMN_SEPARATOR_STYLE_UNSPECIFIED=0]="COLUMN_SEPARATOR_STYLE_UNSPECIFIED",t[t.NONE=1]="NONE",t[t.BETWEEN_EACH_COLUMN=2]="BETWEEN_EACH_COLUMN",t))(on||{}),an=(t=>(t[t.NORMAL=0]="NORMAL",t[t.TBRL=1]="TBRL",t[t.LRTBV=2]="LRTBV",t))(an||{}),ln=(t=>(t[t.TEXT_RUN=0]="TEXT_RUN",t[t.AUTO_TEXT=1]="AUTO_TEXT",t[t.PAGE_BREAK=2]="PAGE_BREAK",t[t.COLUMN_BREAK=3]="COLUMN_BREAK",t[t.FOOT_NOTE_REFERENCE=4]="FOOT_NOTE_REFERENCE",t[t.HORIZONTAL_RULE=5]="HORIZONTAL_RULE",t[t.EQUATION=6]="EQUATION",t[t.DRAWING=7]="DRAWING",t[t.PERSON=8]="PERSON",t[t.RICH_LINK=9]="RICH_LINK",t))(ln||{}),un=(t=>(t[t.BOTH_SIDES=0]="BOTH_SIDES",t[t.LEFT=1]="LEFT",t[t.RIGHT=2]="RIGHT",t[t.LARGEST=3]="LARGEST",t))(un||{}),cn=(t=>(t[t.INLINE=0]="INLINE",t[t.WRAP_NONE=1]="WRAP_NONE",t[t.WRAP_POLYGON=2]="WRAP_POLYGON",t[t.WRAP_SQUARE=3]="WRAP_SQUARE",t[t.WRAP_THROUGH=4]="WRAP_THROUGH",t[t.WRAP_TIGHT=5]="WRAP_TIGHT",t[t.WRAP_TOP_AND_BOTTOM=6]="WRAP_TOP_AND_BOTTOM",t))(cn||{}),hn=(t=>(t[t.NAMED_STYLE_TYPE_UNSPECIFIED=0]="NAMED_STYLE_TYPE_UNSPECIFIED",t[t.NORMAL_TEXT=1]="NORMAL_TEXT",t[t.TITLE=2]="TITLE",t[t.SUBTITLE=3]="SUBTITLE",t[t.HEADING_1=4]="HEADING_1",t[t.HEADING_2=5]="HEADING_2",t[t.HEADING_3=6]="HEADING_3",t[t.HEADING_4=7]="HEADING_4",t[t.HEADING_5=8]="HEADING_5",t[t.HEADING_6=9]="HEADING_6",t))(hn||{}),dn=(t=>(t[t.AUTO=0]="AUTO",t[t.AT_LEAST=1]="AT_LEAST",t[t.EXACT=2]="EXACT",t))(dn||{}),_n=(t=>(t[t.DASH_STYLE_UNSPECIFIED=0]="DASH_STYLE_UNSPECIFIED",t[t.SOLID=1]="SOLID",t[t.DOT=2]="DOT",t[t.DASH=3]="DASH",t))(_n||{}),fn=(t=>(t[t.TAB_STOP_ALIGNMENT_UNSPECIFIED=0]="TAB_STOP_ALIGNMENT_UNSPECIFIED",t[t.START=1]="START",t[t.CENTER=2]="CENTER",t[t.END=3]="END",t))(fn||{}),gn=(t=>(t.EVENLY_DISTRIBUTED="0",t.FIXED_WIDTH="1",t))(gn||{}),En=(t=>(t[t.CONTENT_ALIGNMENT_UNSPECIFIED=0]="CONTENT_ALIGNMENT_UNSPECIFIED",t[t.CONTENT_ALIGNMENT_UNSUPPORTED=1]="CONTENT_ALIGNMENT_UNSUPPORTED",t[t.TOP=2]="TOP",t[t.MIDDLE=3]="MIDDLE",t[t.BOTTOM=4]="BOTTOM",t))(En||{}),Rn=(t=>(t.NORMAL="normal",t.BOLD="bold",t.ITALIC="italic",t))(Rn||{}),mn=(t=>(t[t.CHARACTER=0]="CHARACTER",t[t.COLUMN=1]="COLUMN",t[t.INSIDE_MARGIN=2]="INSIDE_MARGIN",t[t.LEFT_MARGIN=3]="LEFT_MARGIN",t[t.MARGIN=4]="MARGIN",t[t.OUTSIDE_MARGIN=5]="OUTSIDE_MARGIN",t[t.PAGE=6]="PAGE",t[t.RIGHT_MARGIN=7]="RIGHT_MARGIN",t))(mn||{}),On=(t=>(t[t.BOTTOM_MARGIN=0]="BOTTOM_MARGIN",t[t.INSIDE_MARGIN=1]="INSIDE_MARGIN",t[t.LINE=2]="LINE",t[t.MARGIN=3]="MARGIN",t[t.OUTSIDE_MARGIN=4]="OUTSIDE_MARGIN",t[t.PAGE=5]="PAGE",t[t.PARAGRAPH=6]="PARAGRAPH",t[t.TOP_MARGIN=7]="TOP_MARGIN",t))(On||{}),An=(t=>(t[t.POINT=0]="POINT",t[t.LINE=1]="LINE",t[t.CHARACTER=2]="CHARACTER",t))(An||{}),In=(t=>(t[t.CENTER=0]="CENTER",t[t.INSIDE=1]="INSIDE",t[t.LEFT=2]="LEFT",t[t.OUTSIDE=3]="OUTSIDE",t[t.RIGHT=4]="RIGHT",t))(In||{}),Cn=(t=>(t[t.BOTTOM=0]="BOTTOM",t[t.CENTER=1]="CENTER",t[t.INSIDE=2]="INSIDE",t[t.OUTSIDE=3]="OUTSIDE",t[t.TOP=4]="TOP",t))(Cn||{}),Sn=(t=>(t[t.compressPunctuation=0]="compressPunctuation",t[t.compressPunctuationAndJapaneseKana=1]="compressPunctuationAndJapaneseKana",t[t.doNotCompress=2]="doNotCompress",t))(Sn||{}),Nn=(t=>(t[t.PORTRAIT=0]="PORTRAIT",t[t.LANDSCAPE=1]="LANDSCAPE",t))(Nn||{}),$t=(t=>(t.BULLET_LIST="BULLET_LIST",t.ORDER_LIST="ORDER_LIST",t))($t||{});const Li={BULLET_LIST:{listType:"BULLET_LIST",nestingLevel:[{bulletAlignment:q.START,glyphFormat:" %0",textStyle:{fs:12},startNumber:0,glyphSymbol:"●",hanging:21,indentStart:21},{bulletAlignment:q.START,glyphFormat:" %1",textStyle:{fs:12},startNumber:0,glyphSymbol:"■",hanging:21,indentStart:42},{bulletAlignment:q.START,glyphFormat:" %1",textStyle:{fs:12},startNumber:0,glyphSymbol:"◆",hanging:21,indentStart:63}]},ORDER_LIST:{listType:"ORDER_LIST",nestingLevel:[{bulletAlignment:q.START,glyphFormat:" %1.",textStyle:{fs:12},startNumber:0,glyphType:It.DECIMAL,hanging:21,indentStart:21},{bulletAlignment:q.START,glyphFormat:" %1.%2)",textStyle:{fs:12},startNumber:0,glyphType:It.DECIMAL,hanging:21,indentStart:42},{bulletAlignment:q.START,glyphFormat:" %1.%2.%3.",textStyle:{fs:12},startNumber:0,glyphType:It.DECIMAL,hanging:21,indentStart:63}]}};function wi(t,e,s,n,r){const i=vi(t,e,s,n,r),o=Ti(t,e,s,n,r),a=Ui(t,e,s,n,r),c=Mi(t,e,s,n,r),l=Pi(t,e,s,n,r),u=xi(t,e,s,n,r);return{dataStream:"",textRuns:i,paragraphs:o,sectionBreaks:a,customBlocks:c,tables:l,customRanges:u}}function vi(t,e,s,n,r){const{textRuns:i}=t,{textRuns:o}=e;if(i==null||o==null)return;const a=Ks(t,s,n);if(r!==P.REPLACE){const c=Di(o,a,r);e.textRuns=c}return zs(t,e,s,n),a}function Di(t,e,s){if(e.length===0)return t;t=m.deepClone(t),e=m.deepClone(e);const n=[],r=t.length,i=e.length;let o=0,a=0,c=null;function l(){return c?(n.push(c),c=null,!0):!1}for(;o<r&&a<i;){const{st:_,ed:g,ts:E}=t[o],{st:R,ed:O,ts:A,sId:L}=e[a];let F;s===P.COVER?F={...A,...E}:F={...E,...A},g<R?(l()||n.push(t[o]),o++):O<_?(l()||n.push(e[a]),a++):(n.push({st:Math.min(_,R),ed:Math.max(_,R),ts:_<R?{...E}:{...A},sId:_<R?void 0:L}),n.push({st:Math.max(_,R),ed:Math.min(g,O),ts:F,sId:L}),g<O?(o++,e[a].st=g):(a++,t[o].st=O),c={st:Math.min(g,O),ed:Math.max(g,O),ts:g<O?{...A}:{...E},sId:g<O?L:void 0})}l();const u=n[n.length-1],h=t[r-1],f=e[i-1];return u.ed!==Math.max(h.ed,f.ed)&&(h.ed>f.ed?n.push(h):n.push(f)),js(n)}function Ti(t,e,s,n,r){const{paragraphs:i}=t,{paragraphs:o}=e;if(i==null||o==null)return;const a=Xs(t,s,n);if(r!==P.REPLACE){const c=[];for(const l of o){const{startIndex:u,paragraphStyle:h,bullet:f}=l;let _=[];for(const g of a){const{startIndex:E,paragraphStyle:R,bullet:O}=g;let A,L;if(r===P.COVER?(A={...R,...h},L={listId:"",listType:$t.BULLET_LIST,nestingLevel:0,textStyle:{},...O,...f}):(A={...h,...R},L={listId:"",listType:$t.BULLET_LIST,nestingLevel:0,textStyle:{},...f,...O}),u===E){_.push({startIndex:u,paragraphStyle:A,bullet:L});break}}c.push(..._),_=[]}e.paragraphs=c}return Le(t,e,s,n),a}function Ui(t,e,s,n,r){const{sectionBreaks:i}=t,{sectionBreaks:o}=e;if(i==null||o==null)return;const a=Qs(t,s,n);if(r!==P.REPLACE){const c=[];for(const l of o){const{startIndex:u}=l;let h=[];for(const f of a){const{startIndex:_}=f;if(u===_){r===P.COVER?h.push({...f,...l}):h.push({...l,...f});break}}c.push(...h),h=[]}e.sectionBreaks=c}return Le(t,e,s,n),a}function Mi(t,e,s,n,r){const{customBlocks:i}=t,{customBlocks:o}=e;if(i==null||o==null)return;const a=Zs(t,s,n);if(r!==P.REPLACE){const c=[];for(const l of o){const{startIndex:u}=l;let h=[];for(const f of a){const{startIndex:_}=f;if(u===_){r===P.COVER?h.push({...f,...l}):h.push({...l,...f});break}}c.push(...h),h=[]}e.customBlocks=c}return Ys(t,e,s,n),a}function Pi(t,e,s,n,r){const{tables:i}=t,{tables:o}=e;if(i==null||o==null)return;const a=qs(t,s,n);if(r!==P.REPLACE){const c=[];for(const l of o){const{startIndex:u,endIndex:h}=l;let f=[];for(const _ of a){const{startIndex:g,endIndex:E}=_;if(g>=u&&E<=h){r===P.COVER?f.push({..._,...l}):f.push({...l,..._});break}}c.push(...f),f=[]}e.tables=c}return we(t,e,s,n),a}function xi(t,e,s,n,r){const{customRanges:i}=t,{tables:o}=e;if(i==null||o==null)return;const a=Js(t,s,n);if(r!==P.REPLACE){const c=[];for(const l of o){const{startIndex:u,endIndex:h}=l;let f=[];for(const _ of a){const{startIndex:g,endIndex:E}=_;if(g>=u&&E<=h){r===P.COVER?f.push({..._,...l}):f.push({...l,..._});break}}c.push(...f),f=[]}e.customRanges=c}return we(t,e,s,n),a}const ve={id:"default_doc",documentStyle:{}};class pi{constructor(e){d(this,"snapshot");this.snapshot={...ve,...e}}get drawings(){return this.snapshot.drawings}get documentStyle(){return this.snapshot.documentStyle}get lists(){return this.snapshot.lists}get body(){return this.snapshot.body}get zoomRatio(){var e;return((e=this.snapshot.settings)==null?void 0:e.zoomRatio)||1}getBody(){return this.snapshot.body}getShouldRenderLoopImmediately(){return this.snapshot.shouldStartRenderingImmediately!==!1}getContainer(){return this.snapshot.container}getParentRenderUnitId(){return this.snapshot.parentRenderUnitId}getSnapshot(){return this.snapshot}updateDocumentId(e){this.snapshot.id=e}updateDocumentRenderConfig(e){const{documentStyle:s}=this.snapshot;s.renderConfig==null?s.renderConfig=e:s.renderConfig={...s.renderConfig,...e}}updateDocumentDataMargin(e){const{t:s,l:n,b:r,r:i}=e,{documentStyle:o}=this.snapshot;s!=null&&(o.marginTop=s),n!=null&&(o.marginLeft=n),r!=null&&(o.marginBottom=r),i!=null&&(o.marginRight=i)}updateDocumentDataPageSize(e,s){const{documentStyle:n}=this.snapshot;if(!n.pageSize){e=e??1/0,s=s??1/0,n.pageSize={width:e,height:s};return}e!==void 0&&(n.pageSize.width=e),s!==void 0&&(n.pageSize.height=s)}updateDrawing(e,s){const{drawings:n}=this,{width:r,height:i,left:o,top:a}=s,c=n==null?void 0:n[e];if(!c)return;const l=c.objectTransform;l.size.width=r,l.size.height=i,l.positionH.posOffset=o,l.positionV.posOffset=a}setZoomRatio(e=1){this.snapshot.settings==null?this.snapshot.settings={zoomRatio:e}:this.snapshot.settings.zoomRatio=1}}class dt extends pi{constructor(s){super(s);d(this,"_unitId");d(this,"headerModelMap",new Map);d(this,"footerModelMap",new Map);const n=6;this._unitId=this.snapshot.id??m.generateRandomId(n),this._initializeHeaderFooterModel()}dispose(){this.headerModelMap.forEach(s=>{s.dispose()}),this.footerModelMap.forEach(s=>{s.dispose()})}getRev(){return this.snapshot.rev??0}incrementRev(){this.snapshot.rev=this.getRev()+1}getSettings(){return this.snapshot.settings}reset(s){if(s.id&&s.id!==this._unitId)throw new Error("Cannot reset a document model with a different unit id!");this.snapshot={...ve,...s},this._initializeHeaderFooterModel()}getSelfOrHeaderFooterModel(s){if(s!=null){if(this.headerModelMap.has(s))return this.headerModelMap.get(s);if(this.footerModelMap.has(s))return this.footerModelMap.get(s)}return this}getUnitId(){return this._unitId}apply(s){const n=[],r=new us;return r.reset(),s.forEach(i=>{if(i=m.deepClone(i),i.t==="r"){const{coverType:o,body:a,len:c,segmentId:l}=i;if(a!=null){const u=this._updateApply(a,c,r.cursor,o,l);n.push({...i,t:"r",coverType:P.REPLACE,body:u})}else n.push({...i,t:"r"});r.moveCursor(c)}else if(i.t==="i"){const{body:o,len:a,segmentId:c,line:l}=i;this._insertApply(o,a,r.cursor,c),r.moveCursor(a),n.push({t:"d",len:a,line:l,segmentId:c})}else if(i.t==="d"){const{len:o,segmentId:a}=i,c=this._deleteApply(o,r.cursor,a);n.push({...i,t:"i",body:c})}else throw new Error(`Unknown mutation type for mutation: ${i}.`)}),n}_updateApply(s,n,r,i=P.COVER,o){if(s==null)throw new Error("updateBody is none");const a=this.snapshot,c=Tt(a,o);if(c==null)throw new Error("no body has changed");return wi(c,s,n,r,i)}_deleteApply(s,n,r){const i=this.snapshot,o=Tt(i,r);if(o==null)throw new Error("no body has changed");return s<=0?{dataStream:""}:Ni(o,s,n)}_insertApply(s,n,r,i){const o=this.snapshot,a=Tt(o,i);if(n!==0){if(a==null)throw new Error("no body has changed");bi(a,s,n,r)}}_initializeHeaderFooterModel(){const{headers:s,footers:n}=this.getSnapshot();if(s)for(const r in s){const i=s[r];this.headerModelMap.set(r,new dt(i))}if(n)for(const r in n){const i=n[r];this.footerModelMap.set(r,new dt(i))}}updateDocumentId(s){super.updateDocumentId(s),this._unitId=s}}var bn=(t=>(t.INSERT_ROW_DATA_ACTION="InsertRowDataAction",t.REMOVE_ROW_DATA_ACTION="RemoveRowDataAction",t.INSERT_ROW_ACTION="InsertRowAction",t.REMOVE_ROW_ACTION="RemoveRowAction",t.SET_RANGE_STYLE_ACTION="SetRangeStyleAction",t.SET_SELECTION_ACTION="SetSelectionActivateAction",t.SET_RANGE_DATA_ACTION="SetRangeDataAction",t.SET_RANGE_FORMATTED_VALUE_ACTION="SetRangeFormattedValueAction",t.SET_RANGE_NOTE_ACTION="SetRangeNoteAction",t.DELETE_RANGE_ACTION="DeleteRangeAction",t.INSERT_SHEET_ACTION="InsertSheetAction",t.REMOVE_SHEET_ACTION="RemoveSheetAction",t.CLEAR_RANGE_ACTION="ClearRangeAction",t.INSERT_RANGE_ACTION="InsertRangeAction",t.SET_TAB_COLOR_ACTION="SetTabColorAction",t.HIDE_SHEET_ACTION="SetWorkSheetHideAction",t.SET_WORKSHEET_ACTIVATE_ACTION="SetWorkSheetActivateAction",t.INSERT_COLUMN_ACTION="InsertColumnAction",t.INSERT_COLUMN_DATA_ACTION="InsertColumnDataAction",t.REMOVE_COLUMN_ACTION="RemoveColumnAction",t.REMOVE_COLUMN_DATA_ACTION="RemoveColumnDataAction",t.SET_HIDE_ROW_ACTION="SetRowHideAction",t.SET_HIDE_COLUMN_ACTION="SetColumnHideAction",t.SET_SHOW_ROW_ACTION="SetRowShowAction",t.SET_SHOW_COLUMN_ACTION="SetColumnShowAction",t.ADD_MERGE_ACTION="AddMergeAction",t.REMOVE_MERGE_ACTION="RemoveMergeAction",t.SET_WORKSHEET_NAME_ACTION="SetWorkSheetNameAction",t.SET_WORKSHEET_STATUS_ACTION="SetWorkSheetStatusAction",t.SET_BORDER_ACTION="SetBorderAction",t.SET_COLUMN_WIDTH_ACTION="SetColumnWidthAction",t.SET_ROW_HEIGHT_ACTION="SetRowHeightAction",t.SET_HIDDEN_GRIDLINES_ACTION="SetHiddenGridlinesAction",t.SET_RIGHT_TO_LEFT_ACTION="SetRightToLeftAction",t.DELETE_BANDING_ACTION="DeleteBandingAction",t.SET_BANDING_ACTION="SetBandingAction",t.ADD_BANDING_ACTION="AddBandingAction",t.DELETE_NAMED_RANGE_ACTION="DeleteNamedRangeAction",t.SET_NAMED_RANGE_ACTION="SetNamedRangeAction",t.ADD_NAMED_RANGE_ACTION="AddNamedRangeAction",t.SET_SHEET_ORDER_ACTION="SetSheetOrderAction",t.SET_ZOOM_RATIO_ACTION="SetZoomRatioAction",t.SET_FROZEN_COLUMNS_ACTION="SetFrozenColumnsAction",t.SET_FROZEN_ROWS_ACTION="SetFrozenRowsAction",t))(bn||{});const Rt={sheetId:"",range:{startRow:-1,endRow:-1,startColumn:-1,endColumn:-1}},Fi={startRow:-1,startColumn:-1,endRow:-1,endColumn:-1},Hi={startRow:0,startColumn:0,endRow:0,endColumn:0},Bi={row:0,column:0},Ln={id:"",sheetOrder:[],name:"",appVersion:"",locale:Yt.ZH_CN,styles:{},sheets:{},resources:[]},wn=1e3,vn=20,Dn=19,Tn=73,Un=46,Mn=20,kt={type:Ie.GRID,name:"Sheet1",id:"sheet-01",tabColor:"",hidden:I.FALSE,rowCount:wn,columnCount:vn,zoomRatio:1,freeze:{xSplit:0,ySplit:0,startRow:-1,startColumn:-1},scrollTop:0,scrollLeft:0,defaultColumnWidth:Tn,defaultRowHeight:Dn,mergeData:[],hideRow:[],hideColumn:[],cellData:{},rowData:{},columnData:{},status:I.FALSE,showGridlines:I.TRUE,rowHeader:{width:Un,hidden:I.FALSE},columnHeader:{height:Mn,hidden:I.FALSE},selections:["A1"],rightToLeft:I.FALSE,pluginMeta:{}},Ut={ff:"Times New Roman",fs:14,it:I.FALSE,bl:I.FALSE,ul:{s:I.FALSE},st:{s:I.FALSE},ol:{s:I.FALSE},tr:{a:0,v:I.FALSE},td:St.UNSPECIFIED,cl:{rgb:"#000"},bg:{rgb:"#fff"},ht:rt.UNSPECIFIED,vt:at.UNSPECIFIED,tb:lt.UNSPECIFIED,pd:{t:0,r:0,b:0,l:0}},Pn={id:"default_slide",title:"defaultSlide",pageSize:{width:300,height:300}};var xn=(t=>(t.ARRAY_CONVERTOR="ARRAY_CONVERTOR",t.MATRIX_CONVERTOR="MATRIX_CONVERTOR",t))(xn||{});class pn{constructor(e={}){d(this,"_styles");d(this,"_cacheMap",new Ws(1e5));this._styles=e,this._generateCacheMap()}each(e){return Object.entries(this._styles).forEach(e),this}search(e,s){if(this._cacheMap.has(s))return this._cacheMap.get(s);const n=this._getExistingStyleId(e);return n||"-1"}get(e){return typeof e!="string"?e:(e=String(e),this._styles[e])}add(e,s){const n=m.generateRandomId(6);return this._styles[n]=e,this._cacheMap.set(s,n),n}setValue(e){if(e==null)return;const s=JSON.stringify(e),n=this.search(e,s);return n!=="-1"?n:this.add(e,s)}toJSON(){return this._styles}getStyleByCell(e){let s;e&&m.isObject(e.s)?s=e.s:s=(e==null?void 0:e.s)&&this.get(e.s);const n=e==null?void 0:e.interceptorStyle;return n?{...s,...n}:s}_generateCacheMap(){const{_styles:e,_cacheMap:s}=this;for(const n in e){const r=JSON.stringify(e[n]);s.set(r,n)}}_getExistingStyleId(e){const{_styles:s}=this;for(const n in s)if(m.diffValue(s[n],e))return n;return null}}function Wi(t){return t&&(t.s!==void 0||t.p!==void 0||t.v!==void 0)||t.f!==void 0||t.si!==void 0}function Gi(t){if(t.t!==void 0)return t.t;if(typeof t.v=="string")return At.STRING;if(typeof t.v=="number")return At.NUMBER;if(typeof t.v=="boolean")return At.BOOLEAN}function $i(t){if(t==null)return!0;const{v:e,f:s,si:n,p:r,s:i}=t;return!(!(e==null||typeof e=="string"&&e.length===0)||s!=null&&s.length>0||n!=null&&n.length>0||r!=null)}var De=(t=>(t[t.SLIDE=0]="SLIDE",t[t.MASTER=1]="MASTER",t[t.LAYOUT=2]="LAYOUT",t[t.HANDOUT_MASTER=3]="HANDOUT_MASTER",t[t.NOTES_MASTER=4]="NOTES_MASTER",t))(De||{}),Fn=(t=>(t[t.SHAPE=0]="SHAPE",t[t.IMAGE=1]="IMAGE",t[t.TEXT=2]="TEXT",t[t.SPREADSHEET=3]="SPREADSHEET",t[t.DOCUMENT=4]="DOCUMENT",t[t.SLIDE=5]="SLIDE",t))(Fn||{}),Hn=(t=>(t[t.RELATIVE_SLIDE_LINK_UNSPECIFIED=0]="RELATIVE_SLIDE_LINK_UNSPECIFIED",t[t.NEXT_SLIDE=1]="NEXT_SLIDE",t[t.PREVIOUS_SLIDE=2]="PREVIOUS_SLIDE",t[t.FIRST_SLIDE=3]="FIRST_SLIDE",t[t.LAST_SLIDE=4]="LAST_SLIDE",t))(Hn||{});class ki{constructor(e,s){d(this,"_columnData",{});this._config=e,this._columnData=s}getColumnData(){return this._columnData}getColVisible(e){const{_columnData:s}=this,n=s[e];return n?n.hd!==I.TRUE:!0}getHiddenCols(e=0,s=Y(this._columnData)-1){const n=[];let r=!1,i=-1;for(let o=e;o<=s;o++){const a=this.getColVisible(o);r&&a?(r=!1,n.push({rangeType:j.COLUMN,startColumn:i,endColumn:o-1,startRow:0,endRow:0})):!r&&!a&&(r=!0,i=o)}return r&&n.push({startRow:0,endRow:0,startColumn:i,endColumn:s,rangeType:j.COLUMN}),n}getColumnDatas(e,s){const n={};let r=0;for(let i=e;i<e+s;i++){const o=this.getColumnOrCreate(i);n[r]=o,r++}return n}getSize(){return Y(this._columnData)}getColumnWidth(e){const{_columnData:s}=this,n=this._config;let r=0;return r=(s[e]||{hd:I.FALSE,w:n.defaultColumnWidth}).w||n.defaultColumnWidth,r}getColumn(e){const s=this._columnData[e];if(s)return s}getColumnOrCreate(e){const{_columnData:s}=this,n=this._config,r=s[e];if(r)return r;const i={w:n.defaultColumnWidth,hd:I.FALSE};return this._columnData[e]=i,i}}function Dt(t,e){for(const s of e){const{ts:n={}}=s;if(n[t]==null)return I.FALSE;switch(t){case"bl":case"it":{if(n[t]===I.FALSE)return I.FALSE;break}case"ul":case"st":{if(n[t].s===I.FALSE)return I.FALSE;break}default:throw new Error(`unknown style key: ${t} in IStyleBase`)}}return I.TRUE}class _t{constructor(e,s,n){d(this,"_range");d(this,"_worksheet");this._deps=n,this._range=s,this._worksheet=e}static foreach(e,s){const{startRow:n,startColumn:r,endRow:i,endColumn:o}=e;for(let a=n;a<=i;a++)for(let c=r;c<=o;c++)s(a,c)}getRangeData(){return this._range}getValue(){return this.getValues()[0][0]}getValues(){const{startRow:e,endRow:s,startColumn:n,endColumn:r}=this._range,i=[];for(let o=e;o<=s;o++){const a=[];for(let c=n;c<=r;c++)a.push(this.getMatrix().getValue(o,c)||null);i.push(a)}return i}getMatrix(){const{startRow:e,endRow:s,startColumn:n,endColumn:r}=this._range,i=this._worksheet.getCellMatrix(),o=new V;for(let a=e;a<=s;a++)for(let c=n;c<=r;c++)o.setValue(a,c,i.getValue(a,c)||null);return o}getMatrixObject(){const{startRow:e,endRow:s,startColumn:n,endColumn:r}=this._range,i=this._worksheet.getCellMatrix(),o=new V;for(let a=e;a<=s;a++)for(let c=n;c<=r;c++)o.setValue(a-e,c-n,i.getValue(a,c)||{});return o}getA1Notation(){const{startRow:e,endRow:s,startColumn:n,endColumn:r}=this._range;let i,o;return n<r?(i=m.numToWord(n+1)+(e+1),o=m.numToWord(r+1)+(s+1)):(i=m.numToWord(r+1)+(s+1),o=m.numToWord(n+1)+(e+1)),i===o?`${i}`:`${i}:${o}`}getBackground(){return this.getBackgrounds()[0][0]}getBackgrounds(){const e=this._deps.getStyles();return this.getValues().map(s=>s.map(n=>{var i;const r=e.getStyleByCell(n);return((i=r==null?void 0:r.bg)==null?void 0:i.rgb)||Ut.bg.rgb}))}getCell(e,s){const{startRow:n,endRow:r,startColumn:i,endColumn:o}=this._range,a={startRow:n+e,endRow:n+e,startColumn:i+s,endColumn:i+s};return new _t(this._worksheet,a,this._deps)}getColumn(){return this._range.startColumn}getObjectValue(e={}){return this.getObjectValues(e)[0][0]}getObjectValues(e={}){var a;const{startRow:s,endRow:n,startColumn:r,endColumn:i}=this._range,o=this._worksheet.getCellMatrix().getFragment(s,n,r,i).getData();if(e.isIncludeStyle){const c=this._deps.getStyles();for(let l=0;l<=n-s;l++)for(let u=0;u<=i-r;u++){if(o==null||((a=o==null?void 0:o[l])==null?void 0:a[u])==null)continue;const h=o[l][u].s;h&&(o[l][u].s=c.get(h))}}return o}getFontColor(){return this.getFontColors()[0][0]}getFontColors(){const e=this._deps.getStyles();return this.getValues().map(s=>s.map(n=>{var i;const r=e.getStyleByCell(n);return((i=r==null?void 0:r.cl)==null?void 0:i.rgb)||Ut.cl.rgb}))}getFontFamilies(){return this._getStyles("ff")}getFontFamily(){return this.getFontFamilies()[0][0]}getUnderlines(){return this._getStyles("ul")}getUnderline(){var s,n;const{p:e}=this.getValue()??{};return e&&Array.isArray((s=e.body)==null?void 0:s.textRuns)?Dt("ul",(n=e.body)==null?void 0:n.textRuns)===I.TRUE?{s:I.TRUE}:{s:I.FALSE}:this.getUnderlines()[0][0]}getOverlines(){return this._getStyles("ol")}getOverline(){return this.getOverlines()[0][0]}getStrikeThrough(){var s,n;const{p:e}=this.getValue()??{};return e&&Array.isArray((s=e.body)==null?void 0:s.textRuns)?Dt("st",(n=e.body)==null?void 0:n.textRuns)===I.TRUE?{s:I.TRUE}:{s:I.FALSE}:this.getStrikeThroughs()[0][0]}getStrikeThroughs(){return this._getStyles("st")}getFontSize(){return this.getFontSizes()[0][0]}getFontSizes(){return this._getStyles("fs")}getBorder(){return this.getBorders()[0][0]}getBorders(){return this._getStyles("bd")}getFontStyle(){var s,n;const{p:e}=this.getValue()??{};return e&&Array.isArray((s=e.body)==null?void 0:s.textRuns)?Dt("it",(n=e.body)==null?void 0:n.textRuns)===I.TRUE?xt.ITALIC:xt.NORMAL:this.getFontStyles()[0][0]}getFontStyles(){return this._getStyles("it")}getFontWeight(){var s,n;const{p:e}=this.getValue()??{};return e&&Array.isArray((s=e.body)==null?void 0:s.textRuns)?Dt("bl",(n=e.body)==null?void 0:n.textRuns)===I.TRUE?pt.BOLD:pt.NORMAL:this.getFontWeights()[0][0]}getFontWeights(){return this._getStyles("bl")}getGridId(){return this._worksheet.getSheetId()}getHeight(){const{_range:e,_worksheet:s}=this,{startRow:n,endRow:r}=e;let i=0;for(let o=0;o<=r-n;o++){const a=s.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:e,endColumn:s}=this._range;return s-e+1}getNumRows(){const{startRow:e,endRow:s}=this._range;return s-e+1}getRichTextValue(){return this.getRichTextValues()[0][0]}getRichTextValues(){return this.getValues().map(e=>e.map(s=>(s==null?void 0:s.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 e=this._deps.getStyles();return this.getValues().map(s=>s.map(n=>e.getStyleByCell(n)))}getVerticalAlignment(){return this.getVerticalAlignments()[0][0]}getVerticalAlignments(){return this._getStyles("vt")}getWidth(){const{_range:e,_worksheet:s}=this,{startColumn:n,endColumn:r}=e;let i=0;for(let o=0;o<=r-n;o++)i+=s.getColumnWidth(o);return i}getWrap(){return this.getWraps()[0][0]}getWraps(){return this._getStyles("tb")}getWrapStrategies(){return this._getStyles("tb")}getWrapStrategy(){return this.getWrapStrategies()[0][0]}forEach(e){_t.foreach(this._range,e)}_getStyles(e){const s=this._deps.getStyles();return this.getValues().map(n=>n.map(r=>{const i=s&&s.getStyleByCell(r);return i&&i[e]||Ut[e]}))}}class Vi{constructor(e,s){d(this,"_rowData");this._config=e,this._rowData=s}getRowData(){return this._rowData}getRowDatas(e,s){const n={};let r=0;for(let i=e;i<e+s;i++){const o=this.getRowOrCreate(i);n[r]=o,r++}return n}getRowHeight(e,s=1){const{_rowData:n}=this,r=this._config;let i=0;for(let o=0;o<s;o++){const a=n[o+e]||{hd:I.FALSE,h:r.defaultRowHeight},{isAutoHeight:c,ah:l,h:u=r.defaultRowHeight}=a;i+=(c==null||c)&&typeof l=="number"?l:u}return i}getRow(e){return this._rowData[e]}getRowOrCreate(e){const{_rowData:s}=this,n=s[e];if(n)return n;const r=this._config,i={hd:I.FALSE,h:r.defaultRowHeight};return s[e]=i,i}getHiddenRows(e=0,s=Y(this._rowData)-1){const n=[];let r=!1,i=-1;for(let o=e;o<=s;o++){const a=this.getRowVisible(o);r&&a?(r=!1,n.push({startRow:i,endRow:o-1,startColumn:0,endColumn:0,rangeType:j.ROW})):!r&&!a&&(r=!0,i=o)}return r&&n.push({startRow:i,endRow:s,startColumn:0,endColumn:0,rangeType:j.ROW}),n}getRowVisible(e){const s=this.getRow(e);return s?s.hd!==I.TRUE:!0}getSize(){return Y(this._rowData)}}class Bn extends M{constructor(){super(...arguments);d(this,"_cellContentInterceptors",[]);d(this,"_rowFilteredInterceptors",[]);d(this,"_rowVisibleInterceptors",[]);d(this,"_colVisibleInterceptors",[])}dispose(){super.dispose(),this._cellContentInterceptors.length=0,this._rowFilteredInterceptors.length=0,this._rowVisibleInterceptors.length=0,this._colVisibleInterceptors.length=0}getCell(s,n){for(const r of this._cellContentInterceptors){const i=r.getCell(s,n);if(typeof i<"u")return i}return null}registerCellContentInterceptor(s){if(this._cellContentInterceptors.includes(s))throw new Error("[SheetViewModel]: Interceptor already registered.");return this._cellContentInterceptors.push(s),v(()=>tt(this._cellContentInterceptors,s))}registerRowFilteredInterceptor(s){if(this._rowFilteredInterceptors.includes(s))throw new Error("[SheetViewModel]: Interceptor already registered.");return this._rowFilteredInterceptors.push(s),v(()=>tt(this._rowFilteredInterceptors,s))}registerRowVisibleInterceptor(s){if(this._rowVisibleInterceptors.includes(s))throw new Error("[SheetViewModel]: Interceptor already registered.");return this._rowVisibleInterceptors.push(s),v(()=>tt(this._rowVisibleInterceptors,s))}registerColVisibleInterceptor(s){if(this._colVisibleInterceptors.includes(s))throw new Error("[SheetViewModel]: Interceptor already registered.");return this._colVisibleInterceptors.push(s),v(()=>tt(this._colVisibleInterceptors,s))}}class Nt{constructor(e,s){d(this,"_initialized");d(this,"_sheetId");d(this,"_snapshot");d(this,"_cellData");d(this,"_rowManager");d(this,"_columnManager");d(this,"_viewModel");this._styles=s;const n={...kt,mergeData:[],hideRow:[],hideColumn:[],cellData:{},rowData:{},columnData:{},rowHeader:{width:46,hidden:I.FALSE},columnHeader:{height:20,hidden:I.FALSE},selections:["A1"],rightToLeft:I.FALSE,pluginMeta:{},...e};this._snapshot=n;const{columnData:r,rowData:i,cellData:o}=this._snapshot;this._sheetId=this._snapshot.id??m.generateRandomId(6),this._initialized=!1,this._cellData=new V(o),this._rowManager=new Vi(this._snapshot,i),this._columnManager=new ki(this._snapshot,r),this._viewModel=new Bn}__interceptViewModel(e){e(this._viewModel)}getSnapshot(){return this._snapshot}getCellMatrix(){return this._cellData}getRowManager(){return this._rowManager}getSheetId(){return this._sheetId}getColumnManager(){return this._columnManager}getName(){return this._snapshot.name}clone(){const{_snapshot:e}=this,s=m.deepClone(e);return new Nt(s,this._styles)}getMergeData(){return this._snapshot.mergeData}getMergedCells(e,s){const n=this._snapshot.mergeData,r=[];for(let i=0;i<n.length;i++){const o=n[i];ut.intersects({startRow:e,startColumn:s,endRow:e,endColumn:s},o)&&r.push(o)}return r.length?r:null}getMergedCell(e,s){const n=this._snapshot.mergeData;for(let r=0;r<n.length;r++){const i=n[r];if(ut.intersects({startRow:e,startColumn:s,endRow:e,endColumn:s},i))return i}return null}getCell(e,s){return e<0||s<0?null:this._viewModel.getCell(e,s)}getCellRaw(e,s){return this.getCellMatrix().getValue(e,s)}getMatrixWithMergedCells(e,s,n,r){const i=this.getCellMatrix(),o=this._snapshot.mergeData.filter(c=>ut.intersects({startRow:e,startColumn:s,endRow:n,endColumn:r},c)),a=new V;return he(e,n,s,r).forEach((c,l)=>{const u=i.getValue(c,l);u&&a.setValue(c,l,u)}),o.forEach(c=>{const{startColumn:l,startRow:u,endColumn:h,endRow:f}=c;he(u,f,l,h).forEach((_,g)=>{_===u&&g===l&&a.setValue(_,g,{...i.getValue(_,g),rowSpan:f-u+1,colSpan:h-l+1}),(_!==u||g!==l)&&a.realDeleteValue(_,g)})}),a}getRange(e,s,n,r){return typeof e=="object"?new _t(this,e,{getStyles:()=>this._styles}):new _t(this,{startRow:e,startColumn:s,endColumn:r||s,endRow:n||e},{getStyles:()=>this._styles})}getStatus(){const{_snapshot:e}=this;return e.status}getZoomRatio(){return this._snapshot.zoomRatio||1}getConfig(){return this._snapshot}getFreeze(){return this._snapshot.freeze}getMaxColumns(){const{_snapshot:e}=this,{columnCount:s}=e;return s}getMaxRows(){const{_snapshot:e}=this,{rowCount:s}=e;return s}getType(){const{_snapshot:e}=this,{type:s}=e;return s}getRowCount(){return this._snapshot.rowCount}setRowCount(e){this._snapshot.rowCount=e}getColumnCount(){return this._snapshot.columnCount}setColumnCount(e){this._snapshot.columnCount=e}isSheetHidden(){return this._snapshot.hidden}hasHiddenGridlines(){const{_snapshot:e}=this,{showGridlines:s}=e;return s===0}getTabColor(){const{_snapshot:e}=this,{tabColor:s}=e;return s}getColumnWidth(e){return this.getColumnManager().getColumnWidth(e)}getRowHeight(e){return this.getRowManager().getRowHeight(e)}getRowVisible(e){return this.getRowManager().getRowVisible(e)}getHiddenRows(e,s){const n=this.getMaxColumns()-1,r=this._rowManager.getHiddenRows(e,s);return r.forEach(i=>i.endColumn=n),r}getColVisible(e){return this._columnManager.getColVisible(e)}getHiddenCols(e,s){const n=this.getMaxRows()-1,r=this._columnManager.getHiddenCols(e,s);return r.forEach(i=>i.endRow=n),r}isRightToLeft(){const{_snapshot:e}=this,{rightToLeft:s}=e;return s}getPluginMeta(e){return this._snapshot.pluginMeta[e]}setPluginMeta(e,s){this._snapshot.pluginMeta[e]=s}getLastRowWithContent(){return this._cellData.getLength()-1}getLastColumnWithContent(){return this._cellData.getRange().endColumn}cellHasValue(e){return e&&(e.v!==void 0||e.f!==void 0||e.p!==void 0)}}var ji=Object.defineProperty,zi=Object.getOwnPropertyDescriptor,Yi=(t,e,s,n)=>{for(var r=n>1?void 0:n?zi(e,s):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(e,s,r):o(r))||r);return n&&r&&ji(e,s,r),r},Ki=(t,e)=>(s,n)=>e(s,n,t);function Xi(t,e){return`${t.getUnitId()}|${e.getSheetId()}`}exports.Workbook=class extends M{constructor(s={},n){super();d(this,"_sheetCreated$",new N.Subject);d(this,"sheetCreated$",this._sheetCreated$.asObservable());d(this,"_sheetDisposed$",new N.Subject);d(this,"sheetDisposed$",this._sheetDisposed$.asObservable());d(this,"_genName",new Ps);d(this,"_activeSheet$",new N.BehaviorSubject(null));d(this,"activeSheet$",this._activeSheet$.asObservable());d(this,"_worksheets");d(this,"_styles");d(this,"_snapshot");d(this,"_unitId");this._injector=n,this._snapshot=m.commonExtend(Ln,s);const{styles:r}=this._snapshot;(this._snapshot.id==null||this._snapshot.id.length===0)&&(this._snapshot.id=m.generateRandomId(6)),this._unitId=this._snapshot.id,this._styles=new pn(r),this._worksheets=new Map,this._getDefaultWorkSheet()}dispose(){super.dispose(),this._sheetCreated$.complete(),this._sheetDisposed$.complete(),this._activeSheet$.complete()}save(){return this._snapshot}static isIRangeType(s){return typeof s=="string"||"startRow"in s||"row"in s}getSnapshot(){return this._snapshot}getUnitId(){return this._unitId}getRev(){return this._snapshot.rev??1}incrementRev(){this._snapshot.rev=this.getRev()+1}getShouldRenderLoopImmediately(){return this._snapshot.shouldStartRenderingImmediately!==!1}getContainer(){return this._snapshot.container}addWorksheet(s,n,r){const{sheets:i,sheetOrder:o}=this._snapshot;if(i[s])return!1;i[s]=r,o.splice(n,0,s);const a=new Nt(r,this._styles);return this._worksheets.set(s,a),this._sheetCreated$.next(a),!0}getParentRenderUnitId(){return this._snapshot.parentRenderUnitId}getWorksheets(){return this._worksheets}getActiveSpreadsheet(){return this}getStyles(){return this._styles}getConfig(){return this._snapshot}getIndexBySheetId(s){const{sheetOrder:n}=this._snapshot;return n.findIndex(r=>r===s)}getRawActiveSheet(){const{sheetOrder:s}=this._snapshot;return s.find(r=>this._worksheets.get(r).getStatus()===I.TRUE)}getActiveSheet(){const{sheetOrder:s}=this._snapshot,n=this.getRawActiveSheet();return n?this._worksheets.get(n):this._worksheets.get(s[0])}__setActiveSheet(s){this._activeSheet$.next(s)}getActiveSheetIndex(){const{sheetOrder:s}=this._snapshot;return s.findIndex(n=>this._worksheets.get(n).getStatus()===1)}getSheetSize(){return this._snapshot.sheetOrder.length}flush(){}getSheets(){const{sheetOrder:s}=this._snapshot;return s.map(n=>this._worksheets.get(n))}getSheetIndex(s){const{sheetOrder:n}=this._snapshot;return n.findIndex(r=>s.getSheetId()===r)}getSheetBySheetName(s){const{sheetOrder:n}=this._snapshot,r=n.find(i=>this._worksheets.get(i).getName()===s);return this._worksheets.get(r)}getSheetBySheetId(s){return this._worksheets.get(s)}getSheetByIndex(s){const{sheetOrder:n}=this._snapshot;return this._worksheets.get(n[s])}getHiddenWorksheets(){return this.getSheets().filter(s=>s.getConfig().hidden===I.TRUE).map(s=>s.getConfig().id)}transformRangeType(s){if(typeof s=="string")return this._getCellRange(s);if(typeof s!="string"&&"row"in s){const n=s;return{sheetId:"",range:{startRow:n.row[0],startColumn:n.column[0],endRow:n.row[1],endColumn:n.column[1]}}}return typeof s!="string"&&"startRow"in s?{sheetId:"",range:s}:Rt}load(s){this._snapshot=s}_getCellRange(s){var u,h,f,_,g;let n="",r="";if(s.indexOf("!")>-1){const E=s.split("!");n=E[0],r=E[1],n=n.replace(/\\'/g,"'").replace(/''/g,"'"),n.substring(0,1)==="'"&&n.substring(n.length-1,1)==="'"&&(n=n.substring(1,n.length-1))}else r=s;if(r.indexOf(":")===-1){const E=parseInt(r.replace(/[^0-9]/g,""),10)-1,R=m.ABCatNum(r.replace(/[^A-Za-z]/g,""));return!Number.isNaN(E)&&!Number.isNaN(R)?{sheetId:n,range:{startRow:E,endRow:E,startColumn:R,endColumn:R}}:Rt}r=r.split(":");const i=[0,0],o=[0,0],a=((u=this.getSheetBySheetName(n))==null?void 0:u.getMaxRows())||((h=this.getActiveSheet())==null?void 0:h.getMaxRows()),c=((f=this.getSheetBySheetName(n))==null?void 0:f.getMaxColumns())||((_=this.getActiveSheet())==null?void 0:_.getMaxColumns());return i[0]=parseInt(r[0].replace(/[^0-9]/g,""),10)-1,i[1]=parseInt(r[1].replace(/[^0-9]/g,""),10)-1,Number.isNaN(i[0])&&(i[0]=0),Number.isNaN(i[1])&&(i[1]=a),i[0]>i[1]||(o[0]=m.ABCatNum(r[0].replace(/[^A-Za-z]/g,"")),o[1]=m.ABCatNum(r[1].replace(/[^A-Za-z]/g,"")),Number.isNaN(o[0])&&(o[0]=0),Number.isNaN(o[1])&&(o[1]=c),o[0]>o[1])?Rt:{sheetId:((g=this.getSheetBySheetName(n))==null?void 0:g.getSheetId())||"",range:{startRow:i[0],endRow:i[1],startColumn:o[0],endColumn:o[1]}}}_getDefaultWorkSheet(){const{_snapshot:s,_worksheets:n}=this,{sheets:r,sheetOrder:i}=s;m.isEmptyObject(r)&&(r[kt.id]=Object.assign(kt,{status:I.TRUE}));for(const o in r){const a=r[o];a.name=this._genName.sheetName(a.name);const c=new Nt(a,this._styles);n.set(o,c),i.includes(o)||i.push(o)}}};exports.Workbook=Yi([Ki(1,C.Inject(C.Injector))],exports.Workbook);class Te{constructor(e){d(this,"_snapshot");d(this,"_unitId");this._snapshot={...Pn,...e},this._unitId=this._snapshot.id??m.generateRandomId(6)}getSnapshot(){return this._snapshot}getUnitId(){return this._unitId}getPages(){var e;return(e=this._snapshot.body)==null?void 0:e.pages}getPageOrder(){var e;return(e=this._snapshot.body)==null?void 0:e.pageOrder}getPage(e){const s=this.getPages();return s==null?void 0:s[e]}getElementsByPage(e){var s;return(s=this.getPage(e))==null?void 0:s.pageElements}getElement(e,s){var n;return(n=this.getElementsByPage(e))==null?void 0:n[s]}getPageSize(){return this._snapshot.pageSize}addPage(){return{id:"cover_1",pageType:De.SLIDE,zIndex:1,title:"cover",description:"this is first page, cover",pageBackgroundFill:{rgb:"rgb(255,255,255)"},pageElements:{}}}}const de="FOCUSING_SHEET",_e="FOCUSING_DOC",fe="FOCUSING_SLIDE",Qi="FOCUSING_EDITOR_BUT_HIDDEN",Wn="FOCUSING_EDITOR",Zi="FOCUSING_EDITOR_INPUT_FORMULA",Gn="FOCUSING_FORMULA_EDITOR";var qi=Object.defineProperty,Ji=Object.getOwnPropertyDescriptor,yi=(t,e,s,n)=>{for(var r=n>1?void 0:n?Ji(e,s):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(e,s,r):o(r))||r);return n&&r&&qi(e,s,r),r},to=(t,e)=>(s,n)=>e(s,n,t),$n=(t=>(t[t.UNKNOWN=0]="UNKNOWN",t[t.DOC=1]="DOC",t[t.SHEET=2]="SHEET",t[t.SLIDE=3]="SLIDE",t))($n||{});const ft=C.createIdentifier("univer.current");let ge=class extends M{constructor(e,s){super();d(this,"_focused$",new N.BehaviorSubject(null));d(this,"_focused",null);d(this,"focused$",this._focused$.asObservable());d(this,"_currentSheet$",new N.BehaviorSubject(null));d(this,"currentSheet$",this._currentSheet$.asObservable());d(this,"_currentDoc$",new N.BehaviorSubject(null));d(this,"currentDoc$",this._currentDoc$.asObservable());d(this,"_currentSlide$",new N.BehaviorSubject(null));d(this,"currentSlide$",this._currentSlide$.asObservable());d(this,"_sheetAdded$",new N.Subject);d(this,"sheetAdded$",this._sheetAdded$.asObservable());d(this,"_docAdded$",new N.Subject);d(this,"docAdded$",this._docAdded$.asObservable());d(this,"_slideAdded$",new N.Subject);d(this,"slideAdded$",this._slideAdded$.asObservable());d(this,"_sheetDisposed$",new N.Subject);d(this,"sheetDisposed$",this._sheetDisposed$.asObservable());d(this,"_docDisposed$",new N.Subject);d(this,"docDisposed$",this._docDisposed$.asObservable());d(this,"_slideDisposed$",new N.Subject);d(this,"slideDisposed$",this._slideDisposed$.asObservable());d(this,"_sheets",[]);d(this,"_docs",[]);d(this,"_slides",[]);this._handler=e,this._contextService=s}dispose(){super.dispose(),this._focused$.complete(),this._currentDoc$.complete(),this._currentSheet$.complete(),this._currentSlide$.complete(),this._sheetAdded$.complete(),this._docAdded$.complete(),this._slideAdded$.complete(),this._sheetDisposed$.complete(),this._docDisposed$.complete(),this._slideDisposed$.complete()}createDoc(e){return this._handler.createUniverDoc(e)}createSheet(e){return this._handler.createUniverSheet(e)}createSlide(e){return this._handler.createUniverSlide(e)}addSheet(e){this._sheets.push(e),this._sheetAdded$.next(e),this.setCurrentUniverSheetInstance(e.getUnitId())}changeDoc(e,s){const n=this._docs.find(r=>r.getUnitId()===e);if(n!=null){const r=this._docs.indexOf(n);this._docs.splice(r,1)}this.addDoc(s)}addDoc(e){this._docs.push(e),this._docAdded$.next(e),this.setCurrentUniverDocInstance(e.getUnitId())}addSlide(e){this._slides.push(e),this._slideAdded$.next(e),this.setCurrentUniverSlideInstance(e.getUnitId())}getUniverSheetInstance(e){return this._sheets.find(s=>s.getUnitId()===e)}getUniverDocInstance(e){return this._docs.find(s=>s.getUnitId()===e)}getUniverSlideInstance(e){return this._slides.find(s=>s.getUnitId()===e)}getAllUniverSheetsInstance(){return this._sheets}getAllUniverDocsInstance(){return this._docs}getAllUniverSlidesInstance(){return this._slides}setCurrentUniverSheetInstance(e){this._currentSheet$.next(this.getUniverSheetInstance(e)||null)}setCurrentUniverSlideInstance(e){this._currentSlide$.next(this.getUniverSlideInstance(e)||null)}setCurrentUniverDocInstance(e){this._currentDoc$.next(this.getUniverDocInstance(e)||null)}getCurrentUniverSheetInstance(){const e=this._currentSheet$.getValue();if(!e)throw new Error("No current sheet!");return e}getCurrentUniverDocInstance(){const e=this._currentDoc$.getValue();if(!e)throw new Error("No current doc!");return e}getCurrentUniverSlideInstance(){const e=this._currentSlide$.getValue();if(!e)throw new Error("No current slide!");return e}focusUniverInstance(e){e&&(this._focused=this.getUniverSheetInstance(e)||this.getUniverDocInstance(e)||this.getUniverSlideInstance(e)||null),this._focused$.next(e),[_e,de,fe].forEach(s=>this._contextService.setContextValue(s,!1)),this._focused instanceof exports.Workbook?this._contextService.setContextValue(de,!0):this._focused instanceof dt?this._contextService.setContextValue(_e,!0):this._focused instanceof Te&&this._contextService.setContextValue(fe,!0)}getFocusedUniverInstance(){return this._focused}getDocumentType(e){if(this.getUniverDocInstance(e))return 1;if(this.getUniverSheetInstance(e))return 2;if(this.getUniverSlideInstance(e))return 3;throw new Error(`[UniverInstanceService]: No document with unitID ${e}`)}disposeDocument(e){const s=this.getUniverDocInstance(e);if(s){const i=this._docs.indexOf(s);return this._docs.splice(i,1),this._docDisposed$.next(s),this.focusUniverInstance(null),!0}const n=this.getUniverSheetInstance(e);if(n){const i=this._sheets.indexOf(n);return this._sheets.splice(i,1),this._sheetDisposed$.next(n),this.focusUniverInstance(null),!0}const r=this.getUniverSlideInstance(e);if(r){const i=this._slides.indexOf(r);return this._slides.splice(i,1),this._slideDisposed$.next(r),this.focusUniverInstance(null),!0}return!1}};ge=yi([to(1,ct)],ge);var w=(t=>(t[t.Starting=0]="Starting",t[t.Ready=1]="Ready",t[t.Rendered=2]="Rendered",t[t.Steady=3]="Steady",t))(w||{});const Ve={0:"Starting",1:"Ready",2:"Rendered",3:"Steady"},Mt=new Map;function Ue(t,e){return function(r){Me(t,e)}}function Me(t,e){Mt.has(t)||Mt.set(t,[]),Mt.get(t).push(e)}var eo=Object.defineProperty,so=Object.getOwnPropertyDescriptor,kn=(t,e,s,n)=>{for(var r=n>1?void 0:n?so(e,s):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(e,s,r):o(r))||r);return n&&r&&eo(e,s,r),r},Ee=(t,e)=>(s,n)=>e(s,n,t);exports.LifecycleService=class extends M{constructor(s){super();d(this,"_lifecycle$",new N.BehaviorSubject(w.Starting));d(this,"lifecycle$",this._lifecycle$.asObservable());this._logService=s,this._logService.log("[LifecycleService]",`lifecycle progressed to "${Ve[w.Starting]}".`)}get stage(){return this._lifecycle$.getValue()}set stage(s){if(s<this.stage)throw new Error("[LifecycleService]: lifecycle stage cannot go backward!");s!==this.stage&&(this._logService.log("[LifecycleService]",`lifecycle progressed to "${Ve[s]}".`),this._lifecycle$.next(s))}subscribeWithPrevious(){return new N.Observable(s=>(this.stage===w.Starting||(this.stage===w.Ready?s.next(w.Starting):this.stage===w.Rendered?(s.next(w.Starting),s.next(w.Ready)):(s.next(w.Starting),s.next(w.Ready),s.next(w.Rendered))),this._lifecycle$.subscribe(s)))}};exports.LifecycleService=kn([Ee(0,ht)],exports.LifecycleService);let et=class extends M{constructor(e,s){super();d(this,"_started",!1);this._lifecycleService=e,this._injector=s}start(){this._started||(this._started=!0,this.disposeWithMe(v(this._lifecycleService.subscribeWithPrevious().subscribe(e=>this.initModulesOnStage(e)))))}initModulesOnStage(e){const s=Mt.get(e);s==null||s.forEach(n=>{this._injector.has(n)&&this._injector.get(n)})}};et=kn([Ee(0,C.Inject(exports.LifecycleService)),Ee(1,C.Inject(C.Injector))],et);function no(t,e){if(t)try{return t[e]?t[e]:e.split(".").reduce((s,n)=>s[n],t)}catch{return console.warn("Key %s not found",e),e}}class mt extends M{constructor(){super();d(this,"currentLocale",Yt.ZH_CN);d(this,"locales",null);d(this,"localeChanged$",new N.Subject);d(this,"t",s=>{if(!this.locales)throw new Error("Locale not initialized");return no(this.locales[this.currentLocale],s)??s});this.disposeWithMe(v(()=>this.localeChanged$.complete()))}load(s){this.locales=m.deepMerge(this.locales??{},s)}setLocale(s){this.currentLocale=s,this.localeChanged$.next()}getLocales(){var s;return(s=this.locales)==null?void 0:s[this.currentLocale]}getCurrentLocale(){return this.currentLocale}}const Pe=C.createIdentifier("resource-manager-service"),Vn=C.createIdentifier("ResourcePersistenceService");Me(w.Ready,Vn);var ro=Object.defineProperty,io=Object.getOwnPropertyDescriptor,oo=(t,e,s,n)=>{for(var r=n>1?void 0:n?io(e,s):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(e,s,r):o(r))||r);return n&&r&&ro(e,s,r),r},je=(t,e)=>(s,n)=>e(s,n,t);const xe=C.createIdentifier("univer.permission-service"),ze="PERMISSION";exports.PermissionService=class extends M{constructor(s,n){super();d(this,"_permissionPointMap",new Map);d(this,"deletePermissionPoint",(s,n)=>{const r=this._permissionPointMap.get(s);if(r){const i=r.get(n);i&&(i.complete(),this._permissionPointMap.delete(n))}});d(this,"addPermissionPoint",(s,n)=>{const r=this._permissionPointMap.get(s)||new Map;return r.has(n.id)?!1:(r.set(n.id,new N.BehaviorSubject(n)),this._permissionPointMap.set(s,r),!0)});d(this,"updatePermissionPoint",(s,n,r)=>{const i=this._permissionPointMap.get(s);if(!i)return;const o=i.get(n);if(o){const a=o.getValue();a.value=r,a.status=Ne.DONE,o.next(a)}});d(this,"getPermissionPoint",(s,n)=>{const r=this._permissionPointMap.get(s);if(!r)return;const i=r.get(n);if(i)return i.getValue()});this._resourceManagerService=s,this._univerInstanceService=n}_init(){this.disposeWithMe(v(this._univerInstanceService.sheetAdded$.subscribe(s=>{this._resourceManagerService.registerPluginResource(s.getUnitId(),ze,{onChange:(n,r)=>{r.forEach(i=>{this.getPermissionPoint(n,i.id)?this.updatePermissionPoint(n,i.id,i.value):this.addPermissionPoint(n,i)})},toJson:n=>this._toJson(n),parseJson:n=>this._parseJson(n)})}))),this.disposeWithMe(v(this._univerInstanceService.sheetDisposed$.subscribe(s=>{this._resourceManagerService.disposePluginResource(s.getUnitId(),ze)})))}_toJson(s){const n=this._permissionPointMap.get(s);let r=[];return n&&(r=[...n.keys()].reduce((i,o)=>{const a=n.get(o);return a&&i.push(a.getValue()),i},[])),JSON.stringify(r)}_parseJson(s){return JSON.parse(s)}composePermission$(s,n){const r=this._permissionPointMap.get(s),i=n.map(o=>{const a=r==null?void 0:r.get(o);if(!a)throw new Error(`${o} permissionPoint is not exist`);return a.asObservable()});return N.combineLatest(i).pipe(sr.map(o=>(o.every(a=>this._permissionPointMap.get(a.id)),o)))}composePermission(s,n){const r=this._permissionPointMap.get(s);return n.map(o=>{const a=r==null?void 0:r.get(o);if(!a)throw new Error(`${o} permissionPoint is not exist`);return a.getValue()})}};exports.PermissionService=oo([Ue(w.Starting,exports.PermissionService),je(0,C.Inject(Pe)),je(1,C.Inject(ft))],exports.PermissionService);const jn="univer.editable";class Pt extends Gs{constructor(s){super();d(this,"id",jn);d(this,"value",!0);d(this,"unitID");this.unitID=s}}var ao=Object.defineProperty,lo=Object.getOwnPropertyDescriptor,uo=(t,e,s,n)=>{for(var r=n>1?void 0:n?lo(e,s):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(e,s,r):o(r))||r);return n&&r&&ao(e,s,r),r},Ye=(t,e)=>(s,n)=>e(s,n,t);exports.UniverPermissionService=class extends M{constructor(e,s){super(),this._permissionService=e,this._univerInstanceService=s,this._init()}_init(){this._univerInstanceService.sheetAdded$.subscribe(e=>{const s=new Pt(e.getUnitId());this._permissionService.addPermissionPoint(e.getUnitId(),s)})}getEditable(e){let s=e;s||(s=this._univerInstanceService.getCurrentUniverSheetInstance().getUnitId());const n=new Pt(s),r=this._permissionService.getPermissionPoint(s,n.id);return r==null?void 0:r.value}setEditable(e,s){const n=new Pt(e);this._permissionService.updatePermissionPoint(e,n.id,s)}};exports.UniverPermissionService=uo([Ue(w.Starting,exports.UniverPermissionService),Ye(0,C.Inject(xe)),Ye(1,C.Inject(ft))],exports.UniverPermissionService);class zn extends M{constructor(){super(...arguments);d(this,"_resourceMap",new Map);d(this,"_register$",new N.Subject);d(this,"register$",this._register$.asObservable())}getAllResource(s){const n=this._resourceMap.get(s);return n?[...n.keys()].reduce((r,i)=>{const o=n.get(i);return o&&r.push({unitID:s,resourceName:i,hook:o}),r},[]):[]}registerPluginResource(s,n,r){const i=this._resourceMap.get(s)||new Map;if(i.has(n))throw new Error("the pluginName is registered");return i.set(n,r),this._resourceMap.set(s,i),this._register$.next({unitID:s,resourceName:n,hook:r}),v(()=>i.delete(n))}disposePluginResource(s,n){const r=this._resourceMap.get(s);r==null||r.delete(n)}dispose(){this._register$.complete(),this._resourceMap.clear()}}class Re extends M{constructor(){super();d(this,"_currentTheme");d(this,"_currentTheme$",new N.BehaviorSubject({}));d(this,"currentTheme$",this._currentTheme$.asObservable());this.disposeWithMe(v(()=>this._currentTheme$.complete()))}getCurrentTheme(){if(!this._currentTheme)throw new Error("[ThemeService]: current theme is not set!");return this._currentTheme}setTheme(s){this._currentTheme=s,this._currentTheme$.next(s)}}const Yn="__defaultDocumentNormalEditorSpecialUnitId_20231006__",Kn="__defaultDocumentFormulaBarEditorSpecialUnitId_20231012__",co=`\r
11
+ `;var ho=Object.defineProperty,_o=Object.getOwnPropertyDescriptor,fo=(t,e,s,n)=>{for(var r=n>1?void 0:n?_o(e,s):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(e,s,r):o(r))||r);return n&&r&&ho(e,s,r),r},se=(t,e)=>(s,n)=>e(s,n,t);const Qt=C.createIdentifier("univer.undo-redo.service"),go=20;exports.LocalUndoRedoService=class extends M{constructor(s,n,r){super();d(this,"undoRedoStatus$");d(this,"_undoRedoStatus$",new N.BehaviorSubject({undos:0,redos:0}));d(this,"_undoStacks",new Map);d(this,"_redoStacks",new Map);this._univerInstanceService=s,this._commandService=n,this._contextService=r,this.undoRedoStatus$=this._undoRedoStatus$.asObservable(),this.disposeWithMe(this._commandService.registerCommand(Qn)),this.disposeWithMe(this._commandService.registerCommand(Zn)),this.disposeWithMe(v(()=>this._undoRedoStatus$.complete())),this.disposeWithMe(v(this._univerInstanceService.focused$.subscribe(()=>this._updateStatus())))}pushUndoRedo(s){const{unitID:n}=s,r=this._getRedoStack(n,!0),i=this._getUndoStack(n,!0);r.length=0,i.push(s),i.length>go&&i.splice(0,1),this._updateStatus()}clearUndoRedo(s){const n=this._getRedoStack(s);n&&(n.length=0);const r=this._getUndoStack(s);r&&(r.length=0),this._updateStatus()}pitchTopUndoElement(){const s=this._getUndoStackForFocused();return s.length?s[s.length-1]:null}pitchTopRedoElement(){const s=this._getRedoStackForFocused();return s.length?s[s.length-1]:null}popUndoToRedo(){const n=this._getUndoStackForFocused().pop();n&&(this._getRedoStackForFocused().push(n),this._updateStatus())}popRedoToUndo(){const n=this._getRedoStackForFocused().pop();n&&(this._getUndoStackForFocused().push(n),this._updateStatus())}_updateStatus(){var i,o;const s=this._getFocusedUniverInstanceId(),n=s&&((i=this._undoStacks.get(s))==null?void 0:i.length)||0,r=s&&((o=this._redoStacks.get(s))==null?void 0:o.length)||0;this._undoRedoStatus$.next({undos:n,redos:r})}_getUndoStack(s,n=!1){let r=this._undoStacks.get(s);return!r&&n&&(r=[],this._undoStacks.set(s,r)),r||null}_getRedoStack(s,n=!1){let r=this._redoStacks.get(s);return!r&&n&&(r=[],this._redoStacks.set(s,r)),r||null}_getUndoStackForFocused(){const s=this._getFocusedUniverInstanceId();if(!s)throw new Error("No focused univer instance!");return this._getUndoStack(s,!0)}_getRedoStackForFocused(){const s=this._getFocusedUniverInstanceId();if(!s)throw new Error("No focused univer instance!");return this._getRedoStack(s,!0)}_getFocusedUniverInstanceId(){var n;let s="";return this._contextService.getContextValue(Gn)?s=Kn:this._contextService.getContextValue(Wn)?s=Yn:s=((n=this._univerInstanceService.getFocusedUniverInstance())==null?void 0:n.getUnitId())??"",s}};exports.LocalUndoRedoService=fo([se(0,ft),se(1,bt),se(2,ct)],exports.LocalUndoRedoService);class Xn{dispose(){}async dispatchToHandlers(){return!1}}const Qn=new class extends Xn{constructor(){super(...arguments);d(this,"type",zt.COMMAND);d(this,"id","univer.command.undo")}async handler(e){const s=e.get(Qt),n=s.pitchTopUndoElement();if(!n)return!1;const r=e.get(bt);return(n.undo?await n.undo(n.undoMutations):Ae(n.undoMutations,r))?(s.popUndoToRedo(),!0):!1}},Zn=new class extends Xn{constructor(){super(...arguments);d(this,"type",zt.COMMAND);d(this,"id","univer.command.redo")}async handler(e){const s=e.get(Qt),n=s.pitchTopRedoElement();if(!n)return!1;const r=e.get(bt);return(n.redo?await n.redo(n.redoMutations):Ae(n.redoMutations,r))?(s.popRedoToUndo(),!0):!1}};class Zt extends M{constructor(){super(...arguments);d(this,"_started",!1)}addPlugins(s){if(this._started){const n=s.map(([r,i])=>this._initPlugin(r,i));this._pluginsRunLifecycle(n,w.Starting),setTimeout(()=>this._takePluginsThroughLifecycle(n))}else{const n=s.map(([r,i])=>this._initPlugin(r,i));this._takePluginsThroughLifecycle(n),this._started=!0}}_takePluginsThroughLifecycle(s,n=!1){this.disposeWithMe(v(this._lifecycleService.subscribeWithPrevious().subscribe(r=>{n&&r===w.Starting||this._pluginsRunLifecycle(s,r)})))}_pluginsRunLifecycle(s,n){s.forEach(r=>{switch(n){case w.Starting:r.onStarting(this._injector);break;case w.Ready:r.onReady();break;case w.Rendered:r.onRendered();break;case w.Steady:r.onSteady();break}}),this._lifecycleInitializerService.initModulesOnStage(n)}_initPlugin(s,n){return this._injector.createInstance(s,n)}}var Eo=Object.defineProperty,Ro=Object.getOwnPropertyDescriptor,mo=(t,e,s,n)=>{for(var r=n>1?void 0:n?Ro(e,s):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(e,s,r):o(r))||r);return n&&r&&Eo(e,s,r),r},ne=(t,e)=>(s,n)=>e(s,n,t);exports.UniverDoc=class extends Zt{constructor(e,s,n){super(),this._injector=e,this._lifecycleService=s,this._lifecycleInitializerService=n}createDoc(e){return this._injector.createInstance(dt,e)}};exports.UniverDoc=mo([ne(0,C.Inject(C.Injector)),ne(1,C.Inject(exports.LifecycleService)),ne(2,C.Inject(et))],exports.UniverDoc);var Oo=Object.defineProperty,Ao=Object.getOwnPropertyDescriptor,Io=(t,e,s,n)=>{for(var r=n>1?void 0:n?Ao(e,s):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(e,s,r):o(r))||r);return n&&r&&Oo(e,s,r),r},re=(t,e)=>(s,n)=>e(s,n,t);exports.UniverSheet=class extends Zt{constructor(e,s,n){super(),this._injector=e,this._lifecycleService=s,this._lifecycleInitializerService=n}createSheet(e){return this._injector.createInstance(exports.Workbook,e)}};exports.UniverSheet=Io([re(0,C.Inject(C.Injector)),re(1,C.Inject(exports.LifecycleService)),re(2,C.Inject(et))],exports.UniverSheet);var Co=Object.defineProperty,So=Object.getOwnPropertyDescriptor,No=(t,e,s,n)=>{for(var r=n>1?void 0:n?So(e,s):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(e,s,r):o(r))||r);return n&&r&&Co(e,s,r),r},ie=(t,e)=>(s,n)=>e(s,n,t);exports.UniverSlide=class extends Zt{constructor(e,s,n){super(),this._injector=e,this._lifecycleService=s,this._lifecycleInitializerService=n}createSlide(e){return this._injector.createInstance(Te,e)}};exports.UniverSlide=No([ie(0,C.Inject(C.Injector)),ie(1,C.Inject(exports.LifecycleService)),ie(2,C.Inject(et))],exports.UniverSlide);const bo=200;class Lo extends Zt{constructor(s={}){super();d(this,"_injector");d(this,"_univerPluginStore",new ir);d(this,"_univerPluginRegistry",new or);d(this,"_univerSheet",null);d(this,"_univerDoc",null);d(this,"_univerSlide",null);d(this,"_initLazyPluginsTimer");this._injector=this._initDependencies();const{theme:n,locale:r,locales:i,logLevel:o}=s;n&&this._injector.get(Re).setTheme(n),i&&this._injector.get(mt).load(i),r&&this._injector.get(mt).setLocale(r),o&&this._injector.get(ht).setLogLevel(o)}get _univerInstanceService(){return this._injector.get(ft)}get _lifecycleService(){return this._injector.get(exports.LifecycleService)}get _lifecycleInitializerService(){return this._injector.get(et)}__getInjector(){return this._injector}dispose(){this._injector.dispose()}setLocale(s){this._injector.get(mt).setLocale(s)}createUniverSheet(s){let n;const r=()=>{n=this._univerSheet.createSheet(s),this._univerInstanceService.addSheet(n)};if(this._univerSheet)r();else{this._tryProgressToStart();const i=this._univerSheet=this._injector.createInstance(exports.UniverSheet),o=this._univerPluginRegistry.getRegisterPlugins(D.Sheet).map(a=>[a.plugin,a.options]);this._univerPluginRegistry.clearPluginsOfType(D.Sheet),i.addPlugins(o),r(),this._tryProgressToReady()}return n}createUniverDoc(s){let n;const r=()=>{n=this._univerDoc.createDoc(s),this._univerInstanceService.addDoc(n)};if(this._univerDoc)r();else{this._tryProgressToStart();const i=this._univerDoc=this._injector.createInstance(exports.UniverDoc),o=this._univerPluginRegistry.getRegisterPlugins(D.Doc).map(a=>[a.plugin,a.options]);this._univerPluginRegistry.clearPluginsOfType(D.Doc),i.addPlugins(o),r(),this._tryProgressToReady()}return n}createUniverSlide(s){let n;const r=()=>{n=this._univerSlide.createSlide(s),this._univerInstanceService.addSlide(n)};if(this._univerSlide)r();else{this._tryProgressToStart();const i=this._univerSlide=this._injector.createInstance(exports.UniverSlide),o=this._univerPluginRegistry.getRegisterPlugins(D.Slide).map(a=>[a.plugin,a.options]);this._univerPluginRegistry.clearPluginsOfType(D.Slide),i.addPlugins(o),r(),this._tryProgressToReady()}return n}_initDependencies(){return new C.Injector([[ft,{useFactory:s=>new ge({createUniverDoc:n=>this.createUniverDoc(n),createUniverSheet:n=>this.createUniverSheet(n),createUniverSlide:n=>this.createUniverSlide(n)},s),deps:[ct]}],[os],[mt],[Re],[exports.LifecycleService],[et],[xe,{useClass:exports.PermissionService}],[exports.UniverPermissionService],[ht,{useClass:rs,lazy:!0}],[bt,{useClass:exports.CommandService,lazy:!0}],[Qt,{useClass:exports.LocalUndoRedoService,lazy:!0}],[is,{useClass:Or}],[ct,{useClass:ss}],[ls,{useClass:as,lazy:!0}],[Pe,{useClass:zn,lazy:!0}]])}_tryProgressToStart(){this._started||(this._injector.get(et).start(),this._started=!0)}_tryProgressToReady(){this._injector.get(exports.LifecycleService).stage<w.Ready&&(this._injector.get(exports.LifecycleService).stage=w.Ready,this._univerPluginStore.forEachPlugin(n=>n.onReady()))}registerPlugin(s,n){if(s.type===D.Univer)this._registerUniverPlugin(s,n);else if(s.type===D.Sheet)this._registerSheetsPlugin(s,n);else if(s.type===D.Doc)this._registerDocsPlugin(s,n);else if(s.type===D.Slide)this._registerSlidesPlugin(s,n);else throw new Error(`Unimplemented plugin system for business: "${s.type}".`);if(this._started)return this._scheduleInitPluginAfterStarted()}_scheduleInitPluginAfterStarted(){this._initLazyPluginsTimer===void 0&&(this._initLazyPluginsTimer=setTimeout(()=>this._flushLazyPlugins(),bo))}_flushLazyPlugins(){this._initLazyPluginsTimer=void 0;const s=this._univerPluginRegistry.getRegisterPlugins(D.Univer);if(s.length){this._univerPluginRegistry.clearPluginsOfType(D.Univer);const n=s.map(r=>this._injector.createInstance(r.plugin,r.options));this._takePluginsThroughLifecycle(n)}if(this._univerSheet){const n=this._univerPluginRegistry.getRegisterPlugins(D.Sheet).map(r=>[r.plugin,r.options]);n.length&&(this._univerSheet.addPlugins(n),this._univerPluginRegistry.clearPluginsOfType(D.Sheet))}if(this._univerDoc){const n=this._univerPluginRegistry.getRegisterPlugins(D.Doc).map(r=>[r.plugin,r.options]);n.length&&(this._univerDoc.addPlugins(n),this._univerPluginRegistry.clearPluginsOfType(D.Doc))}if(this._univerSlide){const n=this._univerPluginRegistry.getRegisterPlugins(D.Slide).map(r=>[r.plugin,r.options]);n.length&&(this._univerSlide.addPlugins(n),this._univerPluginRegistry.clearPluginsOfType(D.Slide))}}_registerUniverPlugin(s,n){if(this._started)this._univerPluginRegistry.registerPlugin(s,n);else{const r=this._injector.createInstance(s,n);r.onStarting(this._injector),this._univerPluginStore.addPlugin(r)}}_registerSheetsPlugin(s,n){this._univerPluginRegistry.registerPlugin(s,n)}_registerDocsPlugin(s,n){this._univerPluginRegistry.registerPlugin(s,n)}_registerSlidesPlugin(s,n){this._univerPluginRegistry.registerPlugin(s,n)}}function wo(t){const e=new MessageChannel;let s=!1;return e.port1.onmessage=()=>{s||t()},e.port2.postMessage(null),()=>{s=!0}}class vo extends jt{add(e){if(!e)return null;const s=new Vt(e,this);return this._observers=[s],this._onObserverAdded&&this._onObserverAdded(s),s}makeObserverTopPriority(){}makeObserverBottomPriority(){}}const Do=C.createIdentifier("ILocalStorageService"),To=t=>`sheet_interceptor_${t}`,qn=t=>function(e,s){let n=-1;function r(i,o){if(i<=n)throw new Error("[SheetInterceptorService]: next() called multiple times!");return n=i,i===t.length?o:t[i].handler(o,s,r.bind(null,i+1))}return r(0,e)};class Uo{constructor(e){d(this,"_interceptorsByName",new Map);d(this,"_interceptorPoints");this._interceptorPoints=e}fetchThroughInterceptors(e){const s=e,n=this._interceptorsByName.get(s);return qn(n||[])}intercept(e,s){const n=e;this._interceptorsByName.has(n)||this._interceptorsByName.set(n,[]);const r=this._interceptorsByName.get(n);return r.push(s),this._interceptorsByName.set(n,r.sort((i,o)=>(o.priority??0)-(i.priority??0))),()=>tt(this._interceptorsByName.get(n),s)}getInterceptPoints(){return this._interceptorPoints}}const Ke=`'?\\[((?![\\/?:"<>|*\\\\]).)*\\]`,Mo=/[^0-9]/g,Po=/[^A-Za-z]/g;function Ct(t){const e=t[0]==="$",n=t.substring(1).indexOf("$")>-1;return e&&n?z.ALL:e?z.COLUMN:n?z.ROW:z.NONE}function xo(t){const e=t.split("!");e.length>1&&(t=e[e.length-1]);const s=t.split(":");return s.length>1?{startAbsoluteRefType:Ct(s[0]),endAbsoluteRefType:Ct(s[1])}:{startAbsoluteRefType:Ct(s[0])}}function Xe(t=z.NONE){let e="",s="";return t===z.ROW?e="$":t===z.COLUMN?s="$":t===z.ALL&&(e="$",s="$"),{rowAbsoluteString:e,columnAbsoluteString:s}}function qt(t){const{startColumn:e,startRow:s,endColumn:n,endRow:r,startAbsoluteRefType:i,endAbsoluteRefType:o}=t,a=Xe(i),c=Xe(o),l=`${a.columnAbsoluteString}${m.chatAtABC(e)}${a.rowAbsoluteString}${s+1}`,u=`${c.columnAbsoluteString}${m.chatAtABC(n)}${c.rowAbsoluteString}${r+1}`;return l===u?l:`${l}:${u}`}function Jn(t,e){return`${t}!${qt(e)}`}function yn(t,e,s){return`[${t}]${e}!${qt(s)}`}function po(t){const{unitId:e,sheetName:s,range:n}=t;return e!=null&&e.length>0&&s!=null&&s.length>0?yn(e,s,n):s!=null&&s.length>0?Jn(s,n):qt(n)}function oe(t){const e=parseInt(t.replace(Mo,""))-1,s=m.ABCatNum(t.replace(Po,"")),n=Ct(t);return{row:e,column:s,absoluteRefType:n}}function Fo(t){const e=new RegExp(Ke).exec(t);let s="";e!=null&&(s=e[0],t=t.replace(new RegExp(Ke,"g"),""));const n=t.indexOf("!");let r="",i="";n>-1?(r=t.substring(0,n),i=t.substring(n)):i=t;const o=i.indexOf(":");if(o===-1){const E=oe(i),R=E.row,O=E.column,A=E.absoluteRefType;return{unitId:s,sheetName:r,range:{startRow:R,startColumn:O,endRow:R,endColumn:O,startAbsoluteRefType:A,endAbsoluteRefType:A}}}const a=i.substring(0,o),c=i.substring(o+1),l=oe(a),u=oe(c),h=l.row,f=l.column,_=u.row,g=u.column;return{unitId:s,sheetName:r,range:{startRow:h,startColumn:f,endRow:_,endColumn:g,startAbsoluteRefType:l.absoluteRefType,endAbsoluteRefType:u.absoluteRefType}}}nr();exports.ABCToNumber=Ei;exports.ACTION_NAMES=bn;exports.AbsoluteRefType=z;exports.AlignTypeH=In;exports.AlignTypeV=Cn;exports.AutoFillSeries=ds;exports.BaselineOffset=Ft;exports.BlockType=sn;exports.BooleanNumber=I;exports.BorderStyleTypes=b;exports.BorderType=_s;exports.BulletAlignment=q;exports.COLORS=ae;exports.CellValueType=At;exports.Color=it;exports.ColorBuilder=Xt;exports.ColorKit=$;exports.ColorType=W;exports.ColumnSeparatorType=on;exports.CommandType=zt;exports.CommonHideTypes=fs;exports.ConditionType=gs;exports.ContentAlignment=En;exports.ContextService=ss;exports.CopyPasteType=Es;exports.CustomRangeType=en;exports.DEFAULT_CELL=Bi;exports.DEFAULT_DOC=ve;exports.DEFAULT_DOCUMENT_SUB_COMPONENT_ID=Ar;exports.DEFAULT_EMPTY_DOCUMENT_VALUE=co;exports.DEFAULT_RANGE=Fi;exports.DEFAULT_RANGE_ARRAY=Rt;exports.DEFAULT_SELECTION=Hi;exports.DEFAULT_SLIDE=Pn;exports.DEFAULT_STYLES=Ut;exports.DEFAULT_WORKBOOK=Ln;exports.DEFAULT_WORKSHEET=kt;exports.DEFAULT_WORKSHEET_COLUMN_COUNT=vn;exports.DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT=Mn;exports.DEFAULT_WORKSHEET_COLUMN_WIDTH=Tn;exports.DEFAULT_WORKSHEET_ROW_COUNT=wn;exports.DEFAULT_WORKSHEET_ROW_HEIGHT=Dn;exports.DEFAULT_WORKSHEET_ROW_TITLE_WIDTH=Un;exports.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY=Kn;exports.DOCS_NORMAL_EDITOR_UNIT_ID_KEY=Yn;exports.DashStyleType=_n;exports.DataStreamTreeNodeType=Vs;exports.DataStreamTreeTokenType=be;exports.DesktopLogService=rs;exports.DeveloperMetadataVisibility=Rs;exports.Dimension=ms;exports.Direction=Os;exports.Disposable=M;exports.DisposableCollection=es;exports.DocStyleType=ys;exports.DocumentDataModel=dt;exports.DocumentType=$n;exports.EXTENSION_NAMES=xn;exports.Entry=ue;exports.EntryIterator=Bs;exports.ErrorService=os;exports.EventState=ye;exports.FOCUSING_DOC=_e;exports.FOCUSING_EDITOR=Wn;exports.FOCUSING_EDITOR_BUT_HIDDEN=Qi;exports.FOCUSING_EDITOR_INPUT_FORMULA=Zi;exports.FOCUSING_FORMULA_EDITOR=Gn;exports.FOCUSING_SHEET=de;exports.FOCUSING_SLIDE=fe;exports.FloatingObjectManagerService=as;exports.FollowNumberWithType=tn;exports.FontItalic=xt;exports.FontStyleType=Rn;exports.FontWeight=pt;exports.FormatType=As;exports.GenName=Ps;exports.GlyphType=It;exports.GridType=nn;exports.HLSColor=ws;exports.HorizontalAlign=rt;exports.ICommandService=bt;exports.IConfigService=is;exports.IContextService=ct;exports.IFloatingObjectManagerService=ls;exports.ILocalStorageService=Do;exports.ILogService=ht;exports.IPermissionService=xe;exports.IResourceManagerService=Pe;exports.ISnapshotPersistenceService=Vn;exports.IUndoRedoService=Qt;exports.IUniverInstanceService=ft;exports.InterceptorManager=Uo;exports.InterpolationPointType=Is;exports.KeyIterator=Fs;exports.LRUHelper=Et;exports.LRUMap=Ws;exports.LifecycleStages=w;exports.LocaleService=mt;exports.LocaleType=Yt;exports.LogLevel=ns;exports.MemoryCursor=us;exports.NamedStyleType=hn;exports.NumberUnitType=An;exports.ObjectMatrix=V;exports.ObjectRelativeFromH=mn;exports.ObjectRelativeFromV=On;exports.Observable=jt;exports.ObservableHooks=vo;exports.Observer=Vt;exports.OnLifecycle=Ue;exports.PRESET_LIST_TYPE=Li;exports.PageElementType=Fn;exports.PageOrientType=Nn;exports.PageType=De;exports.ParagraphElementType=ln;exports.PermissionPoint=Gs;exports.PermissionStatus=Ne;exports.Plugin=Qe;exports.PluginType=D;exports.PositionedObjectLayoutType=cn;exports.PresetListType=$t;exports.ProtectionType=Cs;exports.RANGE_TYPE=j;exports.RGBA_PAREN=br;exports.RGB_PAREN=Nr;exports.Range=_t;exports.Rectangle=ut;exports.RedoCommand=Zn;exports.RefAlias=gi;exports.Registry=me;exports.RegistryAsMap=Oe;exports.RelativeDate=Ss;exports.RelativeSlideLink=Hn;exports.ResourceManagerService=zn;exports.RgbColor=Ht;exports.RxDisposable=dr;exports.SectionType=rn;exports.ShapeType=Ns;exports.SheetTypes=Ie;exports.SheetViewModel=Bn;exports.Slide=Te;exports.SpacingRule=dn;exports.Styles=pn;exports.THEME_COLORS=Ls;exports.TabStopAlignment=fn;exports.TextDecoration=bs;exports.TextDirection=St;exports.TextDirectionType=an;exports.ThemeColor=Bt;exports.ThemeColorType=p;exports.ThemeColors=Kt;exports.ThemeService=Re;exports.Tools=m;exports.UndoCommand=Qn;exports.Univer=Lo;exports.UniverEditablePermission=Pt;exports.UniverEditablePermissionPoint=jn;exports.UpdateDocsAttributeType=P;exports.ValueIterator=Hs;exports.VerticalAlign=at;exports.WidthType=gn;exports.Worksheet=Nt;exports.WrapStrategy=lt;exports.WrapTextType=un;exports.binarySearchArray=cs;exports.characterSpacingControlType=Sn;exports.checkParagraphHasBullet=Qr;exports.checkParagraphHasIndent=Zr;exports.checkParagraphHasIndentByStyle=Ts;exports.codeToBlob=Cr;exports.composeInterceptors=qn;exports.concatMatrixArray=ui;exports.createInterceptorKey=To;exports.createRowColIter=he;exports.datenum_local=ps;exports.dedupe=ar;exports.deepCompare=Ce;exports.deleteContent=Ms;exports.deserializeRangeWithSheet=Fo;exports.error=le;exports.fromObservable=hr;exports.generate=ii;exports.getAbsoluteRefTypeWitString=xo;exports.getAbsoluteRefTypeWithSingleString=Ct;exports.getArrayLength=Y;exports.getBorderStyleType=Kr;exports.getCellValueType=Gi;exports.getColorStyle=k;exports.getDocsUpdateBody=Tt;exports.getReverseDirection=Sr;exports.getTypeFromPermissionItemList=_i;exports.getWorksheetUID=Xi;exports.handleJsonToDom=zr;exports.handleStyleToString=Yr;exports.hashAlgorithm=ai;exports.horizontalLineSegmentsSubtraction=Se;exports.insertMatrixArray=li;exports.insertTextToContent=Us;exports.isEmptyCell=kr;exports.isFormulaId=jr;exports.isFormulaString=Vr;exports.isICellData=Wi;exports.isNullCell=$i;exports.isObserver=ts;exports.isRealNum=nt;exports.isSameStyleTextRun=Ds;exports.isValidRange=Xr;exports.makeCellRangeToRangeData=$r;exports.makeCellToSelection=Gr;exports.moveMatrixArray=ce;exports.numberToABC=mi;exports.numberToListABC=Oi;exports.orderSearchArray=hs;exports.remove=tt;exports.repeatStringNumTimes=ks;exports.requestImmediateMacroTask=wo;exports.runOnLifecycle=Me;exports.searchArray=Ir;exports.selectionToArray=fi;exports.sequence=qe;exports.sequenceAsync=Ze;exports.sequenceExecute=Ae;exports.sequenceExecuteAsync=mr;exports.serializeRange=qt;exports.serializeRangeToRefString=po;exports.serializeRangeWithSheet=Jn;exports.serializeRangeWithSpreadsheet=yn;exports.sliceMatrixArray=ci;exports.sortRules=Ai;exports.sortRulesByDesc=Ii;exports.sortRulesFactory=gt;exports.toDisposable=v;exports.update=oi;