@univerjs/core 0.1.7 → 0.1.9

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 (59) hide show
  1. package/lib/cjs/index.js +8 -8
  2. package/lib/es/index.js +4650 -4507
  3. package/lib/types/common/boolean.d.ts +16 -0
  4. package/lib/types/common/interceptor.d.ts +2 -2
  5. package/lib/types/common/number.d.ts +17 -0
  6. package/lib/types/{basics/index.d.ts → common/set.d.ts} +7 -5
  7. package/lib/types/common/type-util.d.ts +16 -0
  8. package/lib/types/common/unit.d.ts +9 -0
  9. package/lib/types/docs/data-model/document-data-model.d.ts +4 -1
  10. package/lib/types/index.d.ts +21 -9
  11. package/lib/types/services/command/command.service.d.ts +1 -0
  12. package/lib/types/services/floating-object/floating-object-manager.service.d.ts +1 -1
  13. package/lib/types/services/instance/instance.service.d.ts +71 -94
  14. package/lib/types/services/lifecycle/lifecycle.service.d.ts +2 -2
  15. package/lib/types/services/permission/permission.service.d.ts +0 -1
  16. package/lib/types/services/permission/univer.permission.service.d.ts +2 -2
  17. package/lib/types/services/plugin/plugin-holder.d.ts +25 -0
  18. package/lib/types/services/plugin/plugin-override.d.ts +8 -0
  19. package/lib/types/{plugin → services/plugin}/plugin.d.ts +11 -16
  20. package/lib/types/services/plugin/plugin.service.d.ts +24 -0
  21. package/lib/types/services/resource-loader/resource-loader.service.d.ts +14 -0
  22. package/lib/types/services/resource-loader/type.d.ts +7 -0
  23. package/lib/types/services/resource-manager/resource-manager.service.d.ts +11 -17
  24. package/lib/types/services/resource-manager/type.d.ts +15 -18
  25. package/lib/types/services/undoredo/undoredo.service.d.ts +2 -2
  26. package/lib/types/shared/__tests__/ref-alias.spec.d.ts +16 -0
  27. package/lib/types/shared/clipboard.d.ts +5 -0
  28. package/lib/types/shared/color/color.d.ts +1 -1
  29. package/lib/types/shared/index.d.ts +2 -0
  30. package/lib/types/shared/lifecycle.d.ts +8 -3
  31. package/lib/types/shared/range.d.ts +3 -0
  32. package/lib/types/sheets/__tests__/create-core-test-bed.d.ts +2 -2
  33. package/lib/types/sheets/column-manager.d.ts +1 -1
  34. package/lib/types/sheets/row-manager.d.ts +4 -2
  35. package/lib/types/sheets/view-model.d.ts +18 -10
  36. package/lib/types/sheets/workbook.d.ts +3 -2
  37. package/lib/types/sheets/worksheet.d.ts +33 -8
  38. package/lib/types/slides/{domain/slide-model.d.ts → slide-model.d.ts} +7 -5
  39. package/lib/types/types/enum/index.d.ts +0 -1
  40. package/lib/types/types/interfaces/i-cell-custom-render.d.ts +2 -0
  41. package/lib/types/types/interfaces/i-cell-data.d.ts +4 -0
  42. package/lib/types/types/interfaces/i-range.d.ts +3 -0
  43. package/lib/types/types/interfaces/i-style-data.d.ts +6 -0
  44. package/lib/types/types/interfaces/i-univer-data.d.ts +2 -13
  45. package/lib/types/univer.d.ts +43 -0
  46. package/lib/umd/index.js +9 -9
  47. package/package.json +8 -8
  48. package/lib/types/basics/plugin-holder.d.ts +0 -16
  49. package/lib/types/basics/univer-doc.d.ts +0 -16
  50. package/lib/types/basics/univer-sheet.d.ts +0 -16
  51. package/lib/types/basics/univer-slide.d.ts +0 -16
  52. package/lib/types/basics/univer.d.ts +0 -46
  53. package/lib/types/slides/domain/index.d.ts +0 -16
  54. package/lib/types/types/enum/condition-type.d.ts +0 -49
  55. /package/lib/types/{basics → common}/registry.d.ts +0 -0
  56. /package/lib/types/shared/{__test__ → __tests__}/common.spec.d.ts +0 -0
  57. /package/lib/types/shared/{__test__ → __tests__}/object-matrix.spec.d.ts +0 -0
  58. /package/lib/types/shared/{__test__/rectangle.spec.d.ts → __tests__/range.spec.d.ts} +0 -0
  59. /package/lib/types/shared/{__test__/ref-alias.spec.d.ts → __tests__/rectangle.spec.d.ts} +0 -0
package/lib/umd/index.js CHANGED
@@ -1,9 +1,9 @@
1
- (function(l,O){typeof exports=="object"&&typeof module<"u"?O(exports,require("@wendellhu/redi"),require("rxjs"),require("rxjs/operators")):typeof define=="function"&&define.amd?define(["exports","@wendellhu/redi","rxjs","rxjs/operators"],O):(l=typeof globalThis<"u"?globalThis:l||self,O(l.UniverCore={},l["@wendellhu/redi"],l.rxjs,l.rxjs.operators))})(this,function(l,O,A,nr){"use strict";var Ic=Object.defineProperty;var Ac=(l,O,A)=>O in l?Ic(l,O,{enumerable:!0,configurable:!0,writable:!0,value:A}):l[O]=A;var _=(l,O,A)=>(Ac(l,typeof O!="symbol"?O+"":O,A),A);var Rc,mc;function rr(){ir()}const It=typeof global<"u"?global:typeof self<"u"?self:window;function ir(){typeof It.requestIdleCallback!="function"&&(It.requestIdleCallback=function(e){const n=Date.now();return setTimeout(function(){const i=Math.max(0,50-(Date.now()-n));e({didTimeout:i===0,timeRemaining(){return i}})},1)}),typeof It.cancelIdleCallback!="function"&&(It.cancelIdleCallback=function(e){clearTimeout(e)})}var W=(t=>(t[t.NORMAL=0]="NORMAL",t[t.ROW=1]="ROW",t[t.COLUMN=2]="COLUMN",t[t.ALL=3]="ALL",t))(W||{}),p=(t=>(t[t.NONE=0]="NONE",t[t.ROW=1]="ROW",t[t.COLUMN=2]="COLUMN",t[t.ALL=3]="ALL",t))(p||{});function or(t){return[t.startRow,t.startColumn,t.endRow,t.endColumn]}const q=class q{static clone(s){return s.rangeType!==void 0?{startRow:s.startRow,startColumn:s.startColumn,endRow:s.endRow,endColumn:s.endColumn,rangeType:s.rangeType}:{startRow:s.startRow,startColumn:s.startColumn,endRow:s.endRow,endColumn:s.endColumn}}static equals(s,e){return s==null||e==null?!1:s.endRow===e.endRow&&s.endColumn===e.endColumn&&s.startRow===e.startRow&&s.startColumn===e.startColumn&&(s.rangeType===e.rangeType||s.rangeType===void 0&&e.rangeType===W.NORMAL||e.rangeType===void 0&&s.rangeType===W.NORMAL)}static intersects(s,e){const n=s.startRow,r=s.endRow,i=s.startColumn,o=s.endColumn,c=e.startRow,a=e.endRow,h=e.startColumn,u=e.endColumn,d=Math.abs(i+o-h-u),E=Math.abs(i-o)+Math.abs(h-u),f=Math.abs(n+r-c-a),g=Math.abs(n-r)+Math.abs(c-a);return d<=E&&f<=g}static getIntersects(s,e){const n=s.startRow,r=s.endRow,i=s.startColumn,o=s.endColumn,c=e.startRow,a=e.endRow,h=e.startColumn,u=e.endColumn;let d,E,f,g;if(c<=r)c>=n?E=c:E=n;else return null;if(a>=n)a>=r?g=r:g=a;else return null;if(h<=o)h>i?d=h:d=i;else return null;if(u>=i)u>=o?f=o:f=u;else return null;return{startRow:E,endRow:g,startColumn:d,endColumn:f,rangeType:W.NORMAL}}static contains(s,e){return s.startRow<=e.startRow&&s.endRow>=e.endRow&&s.startColumn<=e.startColumn&&s.endColumn>=e.endColumn}static realContain(s,e){return q.contains(s,e)&&(s.startRow<e.startRow||s.endRow>e.endRow||s.startColumn<e.startColumn||s.endColumn>e.endColumn)}static union(...s){return s.reduce((e,n)=>({startRow:Math.min(e.startRow,n.startRow),startColumn:Math.min(e.startColumn,n.startColumn),endRow:Math.max(e.endRow,n.endRow),endColumn:Math.max(e.endColumn,n.endColumn),rangeType:W.NORMAL}),s[0])}static subtract(s,e){if(e.startRow>s.endRow||e.endRow<s.startRow||e.startColumn>s.endColumn||e.endColumn<s.startColumn)return[s];const n=[];e.startRow>=s.startRow&&n.push({startRow:s.startRow,startColumn:s.startColumn,endRow:e.startRow-1,endColumn:s.endColumn}),e.endRow<=s.endRow&&n.push({startRow:e.endRow+1,startColumn:s.startColumn,endRow:s.endRow,endColumn:s.endColumn});const r=Math.max(s.startRow,e.startRow),i=Math.min(s.endRow,e.endRow);return e.startColumn>=s.startColumn&&n.push({startRow:r,startColumn:s.startColumn,endRow:i,endColumn:e.startColumn-1}),e.endColumn<=s.endColumn&&n.push({startRow:r,startColumn:e.endColumn+1,endRow:i,endColumn:s.endColumn}),n.filter(c=>c.startRow<=c.endRow&&c.startColumn<=c.endColumn)}};_(q,"getRelativeRange",(s,e)=>({startRow:s.startRow-e.startRow,endRow:s.endRow-s.startRow,startColumn:s.startColumn-e.startColumn,endColumn:s.endColumn-s.startColumn})),_(q,"getPositionRange",(s,e,n)=>({...n||{},startRow:n&&[p.ROW,p.ALL].includes(n.startAbsoluteRefType||0)?n.startRow:s.startRow+e.startRow,endRow:n&&[p.ROW,p.ALL].includes(n.endAbsoluteRefType||0)?n.endRow:s.endRow+s.startRow+e.startRow,startColumn:n&&[p.COLUMN,p.ALL].includes(n.startAbsoluteRefType||0)?n.startColumn:s.startColumn+e.startColumn,endColumn:n&&[p.COLUMN,p.ALL].includes(n.endAbsoluteRefType||0)?n.endColumn:s.endColumn+s.startColumn+e.startColumn})),_(q,"moveHorizontal",(s,e=0,n=0)=>({...s,startColumn:s.startColumn+e,endColumn:s.endColumn+e+n})),_(q,"moveVertical",(s,e=0,n=0)=>({...s,startRow:s.startRow+e,endRow:s.endRow+e+n})),_(q,"moveOffset",(s,e,n)=>({...s,startRow:s.startRow+n,endRow:s.endRow+n,startColumn:s.startColumn+e,endColumn:s.endColumn+e}));let Z=q;const cr=(t,s)=>s.length===t.length&&!t.some(e=>s.some(n=>!Z.equals(n,e))),ar=(t,s)=>s.length===t.length&&t.every((e,n)=>{const r=s[n];return r.unitId===e.unitId&&r.sheetId===e.sheetId&&Z.equals(e.range,r.range)});function lr(t,s){if(Object.is(t,s))return!0;if(typeof t!="object"||!t||typeof s!="object"||!s)return!1;const e=Object.keys(t),n=Object.keys(s);if(e.length!==n.length)return!1;const r=Object.prototype.hasOwnProperty.bind(s);for(let i=0;i<e.length;i++){const o=e[i];if(!r(o))return!1;const c=t[o],a=s[o];if(c!==a)return!1}return!0}class Yt{constructor(){_(this,"_data",[])}static create(){return new Yt}add(s){this._data.indexOf(s)>-1||this._data.push(s)}delete(s){const e=this._data.indexOf(s);this._data.splice(e,1)}getData(){return this._data}}class zt{constructor(){_(this,"_data",new Map)}static create(){return new zt}add(s,e){this._data.has(s)||this._data.set(s,e)}delete(s){this._data.delete(s)}getData(){return this._data}}var w=(t=>(t[t.Univer=0]="Univer",t[t.Doc=1]="Doc",t[t.Sheet=2]="Sheet",t[t.Slide=3]="Slide",t))(w||{});class Pe{constructor(s){_(this,"_name");this._name=s}onStarting(s){}onReady(){}onRendered(){}onSteady(){}onDestroy(){}getPluginName(){return this._name}}_(Pe,"type",0);class ur{constructor(){_(this,"_plugins",[])}addPlugin(s){this._plugins.push(s)}removePlugins(){const s=this._plugins.slice();return this._plugins.length=0,s}forEachPlugin(s){this._plugins.forEach(s)}}class hr{constructor(){_(this,"_pluginsRegisteredByBusiness",new Map)}registerPlugin(s,e){const n=s.type;this._pluginsRegisteredByBusiness.has(n)||this._pluginsRegisteredByBusiness.set(n,[]),this._pluginsRegisteredByBusiness.get(n).push({plugin:s,options:e})}getRegisterPlugins(s){return this._pluginsRegisteredByBusiness.get(s)||[]}clearPluginsOfType(s){this._pluginsRegisteredByBusiness.delete(s)}}function K(t,s){const e=t.indexOf(s);return e>-1?(t.splice(e,1),!0):!1}function _r(t){const s=new Set,e=[];for(const n of t)s.has(n)||(s.add(n),e.push(n));return e}function dr(t,s){for(let e=t.length-1;e>-1;e--){const n=t[e];if(s(n,e))return n}return null}function Er(t,s){if(t.length===0)return t;const e=s%t.length;return t.slice(e).concat(t.slice(0,e))}function fr(t,s){const e=new Map;return t.forEach(n=>{const r=s(n);let i=e.get(r);e.has(r)||(i=[],e.set(r,i)),i.push(n)}),e}async function He(t){for(const[s,e]of t.entries())try{if(!await e())return{index:s,result:!1}}catch(n){return{index:s,result:!1,error:n}}return{result:!0,index:-1}}function Fe(t){for(const[s,e]of t.entries())try{if(!e())return{index:s,result:!1}}catch(n){return{index:s,result:!1,error:n}}return{result:!0,index:-1}}function We(t){var s=typeof Symbol=="function"&&Symbol.iterator,e=s&&t[s],n=0;if(e)return e.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(s?"Object is not iterable.":"Symbol.iterator is not defined.")}function Be(t,s){var e=typeof Symbol=="function"&&t[Symbol.iterator];if(!e)return t;var n=e.call(t),r,i=[],o;try{for(;(s===void 0||s-- >0)&&!(r=n.next()).done;)i.push(r.value)}catch(c){o={error:c}}finally{try{r&&!r.done&&(e=n.return)&&e.call(n)}finally{if(o)throw o.error}}return i}function ke(t,s,e){if(e||arguments.length===2)for(var n=0,r=s.length,i;n<r;n++)(i||!(n in s))&&(i||(i=Array.prototype.slice.call(s,0,n)),i[n]=s[n]);return t.concat(i||Array.prototype.slice.call(s))}typeof SuppressedError=="function"&&SuppressedError;function ut(t){return typeof t=="function"}function gr(t){var s=function(n){Error.call(n),n.stack=new Error().stack},e=t(s);return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e}var Xt=gr(function(t){return function(e){t(this),this.message=e?e.length+` errors occurred during unsubscription:
2
- `+e.map(function(n,r){return r+1+") "+n.toString()}).join(`
3
- `):"",this.name="UnsubscriptionError",this.errors=e}});function Ge(t,s){if(t){var e=t.indexOf(s);0<=e&&t.splice(e,1)}}var $e=function(){function t(s){this.initialTeardown=s,this.closed=!1,this._parentage=null,this._finalizers=null}return t.prototype.unsubscribe=function(){var s,e,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=We(o),a=c.next();!a.done;a=c.next()){var h=a.value;h.remove(this)}}catch(m){s={error:m}}finally{try{a&&!a.done&&(e=c.return)&&e.call(c)}finally{if(s)throw s.error}}else o.remove(this);var u=this.initialTeardown;if(ut(u))try{u()}catch(m){i=m instanceof Xt?m.errors:[m]}var d=this._finalizers;if(d){this._finalizers=null;try{for(var E=We(d),f=E.next();!f.done;f=E.next()){var g=f.value;try{pe(g)}catch(m){i=i!=null?i:[],m instanceof Xt?i=ke(ke([],Be(i)),Be(m.errors)):i.push(m)}}}catch(m){n={error:m}}finally{try{f&&!f.done&&(r=E.return)&&r.call(E)}finally{if(n)throw n.error}}}if(i)throw new Xt(i)}},t.prototype.add=function(s){var e;if(s&&s!==this)if(this.closed)pe(s);else{if(s instanceof t){if(s.closed||s._hasParent(this))return;s._addParent(this)}(this._finalizers=(e=this._finalizers)!==null&&e!==void 0?e:[]).push(s)}},t.prototype._hasParent=function(s){var e=this._parentage;return e===s||Array.isArray(e)&&e.includes(s)},t.prototype._addParent=function(s){var e=this._parentage;this._parentage=Array.isArray(e)?(e.push(s),e):e?[e,s]:s},t.prototype._removeParent=function(s){var e=this._parentage;e===s?this._parentage=null:Array.isArray(e)&&Ge(e,s)},t.prototype.remove=function(s){var e=this._finalizers;e&&Ge(e,s),s instanceof t&&s._removeParent(this)},t.EMPTY=function(){var s=new t;return s.closed=!0,s}(),t}();$e.EMPTY;function Ve(t){return t instanceof $e||t&&"closed"in t&&ut(t.remove)&&ut(t.add)&&ut(t.unsubscribe)}function pe(t){ut(t)?t():t.unsubscribe()}class xe{constructor(s=!1){_(this,"skipNextObservers");_(this,"lastReturnValue");_(this,"isStopPropagation",!1);this.initialize(s)}initialize(s=!1){return this.skipNextObservers=s,this}stopPropagation(){this.isStopPropagation=!0}}function je(t){return t instanceof At}class At{constructor(s,e){_(this,"_willBeUnregistered",!1);_(this,"unregisterOnNextCall",!1);this.callback=s,this.observable=e}dispose(){this.observable.remove(this)}}class Ct{constructor(s){_(this,"_observers",new Array);_(this,"_eventState");_(this,"_onObserverAdded");this._eventState=new xe,s&&(this._onObserverAdded=s)}get observers(){return this._observers}add(s,e=!1,n=!1){if(!s)return null;const r=new At(s,this);return r.unregisterOnNextCall=n,e?this._observers.unshift(r):this._observers.push(r),this._onObserverAdded&&this._onObserverAdded(r),r}addOnce(s){return this.add(s,void 0,!0)}remove(s){return s&&this._observers.indexOf(s)!==-1?(this._deferUnregister(s),!0):!1}removeCallback(s){for(let e=0;e<this._observers.length;e++){const n=this._observers[e];if(!n._willBeUnregistered&&n.callback===s)return this._deferUnregister(n),!0}return!1}makeObserverTopPriority(s){this._remove(s),this._observers.unshift(s)}makeObserverBottomPriority(s){this._remove(s),this._observers.push(s)}notifyObservers(s){if(!this._observers.length)return null;const e=this._eventState;e.skipNextObservers=!1,e.lastReturnValue=s,e.isStopPropagation=!1;let n=!1;for(let r=0;r<this._observers.length;r++){const i=this._observers[r];if(!i._willBeUnregistered&&(e.lastReturnValue=i.callback(s,e),i.unregisterOnNextCall&&this._deferUnregister(i),e.isStopPropagation&&(n=!0),e.skipNextObservers))return{lastReturnValue:e.lastReturnValue,stopPropagation:n}}return{lastReturnValue:e.lastReturnValue,stopPropagation:n}}notifyObserversWithPromise(s){let e=Promise.resolve(s);if(!this._observers.length)return e;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||(e=e.then(()=>i.callback(s,n)),i.unregisterOnNextCall&&this._deferUnregister(i))}return e.then(()=>s)}notifyObserver(s,e){if(s._willBeUnregistered)return;const n=this._eventState;return n.skipNextObservers=!1,s.callback(e,n),s.unregisterOnNextCall&&this._deferUnregister(s),{lastReturnValue:n.lastReturnValue,stopPropagation:n.isStopPropagation}}hasObservers(){return this._observers.length>0}clear(){this._observers=new Array,this._onObserverAdded=null}clone(){const s=new Ct;return s._observers=this._observers.slice(0),s}_deferUnregister(s){s.unregisterOnNextCall=!1,s._willBeUnregistered=!0,setTimeout(()=>{this._remove(s)},0)}_remove(s){if(!s)return!1;const e=this._observers.indexOf(s);return e!==-1?(this._observers.splice(e,1),!0):!1}}function b(t){let s=!1;return Ve(t)?{dispose:()=>{s||(s=!0,t.unsubscribe())}}:je(t)?{dispose:()=>{s||(s=!0,t.dispose())}}:{dispose:()=>{s||(s=!0,t())}}}function Rr(t){return b(()=>{t.unsubscribe()})}class qt{constructor(){_(this,"_disposables",new Set)}add(s){return this._disposables.add(s),{dispose:()=>{s.dispose(),this._disposables.delete(s)}}}dispose(){this._disposables.forEach(s=>{s.dispose()}),this._disposables.clear()}}class U{constructor(){_(this,"_disposed",!1);_(this,"_collection",new qt)}disposeWithMe(s){const e=Ve(s)?b(s):s;return this._collection.add(e)}dispose(){this._disposed||(this._disposed=!0,this._collection.dispose())}}class mr extends U{constructor(){super(...arguments);_(this,"dispose$",new A.Subject)}dispose(){super.dispose(),this.dispose$.next(),this.dispose$.complete()}}const it=O.createIdentifier("univer.context-service");class Ke extends U{constructor(){super(...arguments);_(this,"_contextChanged$",new A.Subject);_(this,"contextChanged$",this._contextChanged$.asObservable());_(this,"_contextMap",new Map)}dispose(){super.dispose(),this._contextChanged$.complete()}getContextValue(e){var n;return(n=this._contextMap.get(e))!=null?n:!1}setContextValue(e,n){this._contextMap.set(e,n),this._contextChanged$.next({[e]:n})}subscribeContextValue$(e){return new A.Observable(n=>{const r=this._contextChanged$.pipe(A.filter(i=>typeof i[e]<"u")).subscribe(i=>n.next(i[e]));return this._contextMap.has(e)&&n.next(this._contextMap.get(e)),()=>r.unsubscribe()})}}var Ye=(t=>(t[t.SILENT=0]="SILENT",t[t.ERROR=1]="ERROR",t[t.WARN=2]="WARN",t[t.INFO=3]="INFO",t[t.VERBOSE=4]="VERBOSE",t))(Ye||{});const y=O.createIdentifier("univer.log");class ze extends U{constructor(){super(...arguments);_(this,"_logLevel",3)}debug(...e){this._logLevel>=4&&this._log(console.debug,...e)}log(...e){this._logLevel>=3&&this._log(console.log,...e)}warn(...e){this._logLevel>=2&&this._log(console.warn,...e)}error(...e){this._logLevel>=1&&this._log(console.error,...e)}setLogLevel(e){this._logLevel=e}_log(e,...n){const r=n[0];/^\[(.*?)\]/g.test(r)?e(`\x1B[97;104m${r}\x1B[0m`,...n.slice(1)):e(...n)}}var Or=Object.defineProperty,Ir=Object.getOwnPropertyDescriptor,Ar=(t,s,e,n)=>{for(var r=n>1?void 0:n?Ir(s,e):s,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(s,e,r):o(r))||r);return n&&r&&Or(s,e,r),r},Xe=(t,s)=>(e,n)=>s(e,n,t),Nt=(t=>(t[t.COMMAND=0]="COMMAND",t[t.OPERATION=1]="OPERATION",t[t.MUTATION=2]="MUTATION",t))(Nt||{});const ht=O.createIdentifier("anywhere.command-service");class Cr{constructor(){_(this,"_commands",new Map)}registerCommand(s){if(this._commands.has(s.id))throw new Error(`[CommandRegistry]: command "${s.id}" has been registered before.`);return this._commands.set(s.id,s),b(()=>{var e;this._commands.delete(s.id),(e=s.onDispose)==null||e.call(s)})}hasCommand(s){return this._commands.has(s)}getCommand(s){return this._commands.has(s)?[this._commands.get(s)]:null}}const qe={id:"nil",type:0,handler:()=>!0};l.CommandService=class{constructor(s,e){_(this,"_commandRegistry");_(this,"_beforeCommandExecutionListeners",[]);_(this,"_commandExecutedListeners",[]);_(this,"_multiCommandDisposables",new Map);_(this,"_commandExecutingLevel",0);_(this,"_commandExecutionStack",[]);this._injector=s,this._logService=e,this._commandRegistry=new Cr,this._registerCommand(qe)}hasCommand(s){return this._commandRegistry.hasCommand(s)}registerCommand(s){return this._registerCommand(s)}registerMultipleCommand(s){return this._registerMultiCommand(s)}beforeCommandExecuted(s){if(this._beforeCommandExecutionListeners.indexOf(s)===-1)return this._beforeCommandExecutionListeners.push(s),b(()=>{const e=this._beforeCommandExecutionListeners.indexOf(s);this._beforeCommandExecutionListeners.splice(e,1)});throw new Error("[CommandService]: could not add a listener twice.")}onCommandExecuted(s){if(this._commandExecutedListeners.indexOf(s)===-1)return this._commandExecutedListeners.push(s),b(()=>{const e=this._commandExecutedListeners.indexOf(s);this._commandExecutedListeners.splice(e,1)});throw new Error("[CommandService]: could not add a listener twice.")}async executeCommand(s,e,n){const r=this._commandRegistry.getCommand(s);if(r){const[i]=r,o={id:i.id,type:i.type,params:e},c=this._pushCommandExecutionStack(o);this._beforeCommandExecutionListeners.forEach(h=>h(o,n));const a=await this._execute(i,e,n);return this._commandExecutedListeners.forEach(h=>h(o,n)),c.dispose(),a}throw new Error(`[CommandService]: command "${s}" is not registered.`)}syncExecuteCommand(s,e,n){var i;const r=this._commandRegistry.getCommand(s);if(r){const[o]=r,c={id:o.id,type:o.type,params:e};if(o.type===2){const u=dr(this._commandExecutionStack,d=>d.type===0);u&&(c.params=(i=c.params)!=null?i:{},c.params.trigger=u.id)}const a=this._pushCommandExecutionStack(c);this._beforeCommandExecutionListeners.forEach(u=>u(c,n));const h=this._syncExecute(o,e,n);return this._commandExecutedListeners.forEach(u=>u(c,n)),a.dispose(),h}throw new Error(`[CommandService]: command "${s}" is not registered.`)}_pushCommandExecutionStack(s){return this._commandExecutionStack.push(s),b(()=>K(this._commandExecutionStack,s))}_registerCommand(s){return this._commandRegistry.registerCommand(s)}_registerMultiCommand(s){const e=this._commandRegistry.getCommand(s.id);let n;if(e){if(e[0].multi!==!0)throw new Error("Command has registered as a single command.");n=e[0]}else{const i=new qt;n=new Nr(s.id),i.add(this._commandRegistry.registerCommand(n)),i.add(b(()=>{this._multiCommandDisposables.delete(s.id)})),this._multiCommandDisposables.set(s.id,i)}const r=n.registerImplementation(s);return b(()=>{var i;r.dispose(),n.hasImplementations()||(i=this._multiCommandDisposables.get(s.id))==null||i.dispose()})}async _execute(s,e,n){this._logService.debug("[CommandService]",`${"|-".repeat(Math.max(this._commandExecutingLevel,0))}executing command "${s.id}"`),this._commandExecutingLevel++;let r;try{r=await this._injector.invoke(s.handler,e,n),this._commandExecutingLevel--}catch(i){throw r=!1,this._commandExecutingLevel=0,i}return r}_syncExecute(s,e,n){this._logService.debug("[CommandService]",`${"|-".repeat(Math.max(0,this._commandExecutingLevel))}executing command "${s.id}".`),this._commandExecutingLevel++;let r;try{if(r=this._injector.invoke(s.handler,e,n),r instanceof Promise)throw new TypeError("[CommandService]: Command handler should not return a promise.");this._commandExecutingLevel--}catch(i){throw r=!1,this._commandExecutingLevel=0,i}return r}},l.CommandService=Ar([Xe(0,O.Inject(O.Injector)),Xe(1,y)],l.CommandService);class Nr{constructor(s){_(this,"name");_(this,"multi",!0);_(this,"type",0);_(this,"priority",0);_(this,"_implementations",[]);_(this,"handler",async(s,e)=>{if(!this._implementations.length)return!1;const n=s.get(y),r=s.get(it),i=s.get(O.Injector);for(const o of this._implementations){const c=o.command.preconditions;if((!c||c&&c(r))&&(n.debug("[MultiCommand]",`executing implementation "${o.command.name}".`),await i.invoke(o.command.handler,e)))return!0}return!1});this.id=s,this.name=s}registerImplementation(s){const e={command:s};return this._implementations.push(e),this._implementations.sort((n,r)=>r.command.priority-n.command.priority),b(()=>{var r;const n=this._implementations.indexOf(e);this._implementations.splice(n,1),(r=s.onDispose)==null||r.call(s)})}hasImplementations(){return this._implementations.length>0}}function Qt(t,s,e){const n=t.map(r=>()=>s.syncExecuteCommand(r.id,r.params,e));return Fe(n)}function Sr(t,s,e){const n=t.map(r=>()=>s.executeCommand(r.id,r.params,e));return He(n)}const Qe=O.createIdentifier("univer.config-service");class Je{constructor(){_(this,"_config",new Map)}getConfig(s){return this._config.get(s)}setConfig(s,e){this._config.set(s,e)}deleteConfig(s){this._config.delete(s)}}class Ze extends U{constructor(){super(...arguments);_(this,"_error$",new A.Subject);_(this,"error$",this._error$.asObservable())}dispose(){this._error$.complete()}emit(e){this._error$.next({errorKey:e})}}const Lr="__default_document_sub_component_id20231101__";class ye{constructor(){_(this,"_managerInfo",new Map);_(this,"_remove$",new A.Subject);_(this,"remove$",this._remove$.asObservable());_(this,"_andOrUpdate$",new A.Subject);_(this,"andOrUpdate$",this._andOrUpdate$.asObservable());_(this,"_pluginUpdate$",new A.Subject);_(this,"pluginUpdate$",this._pluginUpdate$.asObservable())}getFloatObject(s){return this._getFloatingObject(s)}getFloatObjects(s){return this._getFloatingObjects(s)}dispose(){this._remove$.complete(),this._andOrUpdate$.complete(),this._pluginUpdate$.complete(),this._managerInfo.clear()}clear(s){const e=this._clearByParam(s);this._remove$.next(e)}addOrUpdate(s){const e=this._addByParam(s);this._andOrUpdate$.next(e)}BatchAddOrUpdate(s){const e=[];s.forEach(n=>{e.push(...this._addByParam(n))}),this._andOrUpdate$.next(e)}remove(s){const e=this._removeByParam(s);this._remove$.next(e)}pluginUpdateRefresh(s){this._pluginUpdate$.next(s)}_getFloatingObjects(s){var r;if(s==null)return;const{unitId:e,subUnitId:n}=s;return(r=this._managerInfo.get(e))==null?void 0:r.get(n)}_getFloatingObject(s){var i,o;if(s==null)return;const{unitId:e,subUnitId:n,floatingObjectId:r}=s;return(o=(i=this._managerInfo.get(e))==null?void 0:i.get(n))==null?void 0:o.get(r)}_addByParam(s){const{unitId:e,subUnitId:n,floatingObject:r,floatingObjectId:i}=s;this._managerInfo.has(e)||this._managerInfo.set(e,new Map);const o=this._managerInfo.get(e);return o.has(n)||o.set(n,new Map),o.get(n).set(i,r),[{unitId:e,subUnitId:n,floatingObjectId:i,floatingObject:r}]}_clearByParam(s){const e=this._getFloatingObjects(s),{unitId:n,subUnitId:r}=s,i=[];return e==null||e.forEach((o,c)=>{i.push({unitId:n,subUnitId:r,floatingObjectId:c,floatingObject:o})}),e==null||e.clear(),i}_removeByParam(s){const e=this._getFloatingObjects(s),n=e==null?void 0:e.get(s.floatingObjectId);return n==null?[]:(e==null||e.delete(s.floatingObjectId),[{...s,floatingObject:n}])}}const ts=O.createIdentifier("univer.floating-object.service");class es{constructor(){_(this,"cursor",0)}reset(){return this.cursor=0,this}moveCursor(s){this.cursor+=s}moveCursorTo(s){this.cursor=s}}function ss(t,s){let e=0,n=t.length-1;for(;e<=n;){const r=Math.floor((n+e)/2);if(s<t[r]&&(r===0||s>=t[r-1]))return r;if(s>=t[r])e=r+1;else if(s<t[r])n=r-1;else return-1}return-1}function ns(t,s){let e=0,n=0,r=0,i=-1,o=t.length-1;for(;e<t.length&&o>=0&&o>=e;){if(n=t[o],o===0?r=0:r=t[o-1],s>=r&&s<=n){i=o;break}if(n=t[e],e===0?r=0:r=t[e-1],s>=r&&s<n){i=e;break}e++,o--}return i}function vr(t,s){let e=t.length-1;return s<0?-1:s<t[0]?0:s>t[t.length-1]?Number.POSITIVE_INFINITY:(t.length<40||s<=t[20]||s>=t[e-20]?e=ns(t,s):e=ss(t,s),e)}function br(t){const s=new Blob([t],{type:"text/javascript"});return window.URL.createObjectURL(s)}var rs=(t=>(t[t.DEFAULT_SERIES=0]="DEFAULT_SERIES",t[t.ALTERNATE_SERIES=1]="ALTERNATE_SERIES",t))(rs||{}),v=(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))(v||{}),is=(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.TLBR="tlbr",t.TLBC_TLMR="tlbc_tlmr",t.TLBR_TLBC_TLMR="tlbr_tlbc_tlmr",t.BLTR="bl_tr",t.MLTR_BCTR="mltr_bctr",t))(is||{}),B=(t=>(t[t.UNSUPPORTED=0]="UNSUPPORTED",t[t.RGB=1]="RGB",t[t.HEX=2]="HEX",t[t.THEME=3]="THEME",t))(B||{}),os=(t=>(t[t.ON=0]="ON",t[t.OFF=1]="OFF",t))(os||{}),cs=(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))(cs||{}),as=(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))(as||{}),ls=(t=>(t[t.DOCUMENT=0]="DOCUMENT",t[t.PROJECT=1]="PROJECT",t))(ls||{}),us=(t=>(t[t.COLUMNS=0]="COLUMNS",t[t.ROWS=1]="ROWS",t))(us||{}),hs=(t=>(t[t.UP=0]="UP",t[t.RIGHT=1]="RIGHT",t[t.DOWN=2]="DOWN",t[t.LEFT=3]="LEFT",t))(hs||{});function Tr(t){switch(t){case 3:return 1;case 1:return 3;case 0:return 2;case 2:return 0}}var _s=(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))(_s||{}),ds=(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))(ds||{}),tt=(t=>(t.EN_US="enUS",t.ZH_CN="zhCN",t))(tt||{}),Es=(t=>(t[t.RANGE=0]="RANGE",t[t.SHEET=1]="SHEET",t))(Es||{}),fs=(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))(fs||{}),gs=(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))(gs||{}),St=(t=>(t[t.GRID=0]="GRID",t[t.KANBAN=1]="KANBAN",t[t.GANTT=2]="GANTT",t))(St||{}),_t=(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))(_t||{}),Rs=(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))(Rs||{}),et=(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))(et||{}),ot=(t=>(t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.TOP=1]="TOP",t[t.MIDDLE=2]="MIDDLE",t[t.BOTTOM=3]="BOTTOM",t))(ot||{}),ct=(t=>(t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.OVERFLOW=1]="OVERFLOW",t[t.CLIP=2]="CLIP",t[t.WRAP=3]="WRAP",t))(ct||{}),Lt=(t=>(t[t.NORMAL=0]="NORMAL",t[t.ITALIC=1]="ITALIC",t))(Lt||{}),vt=(t=>(t[t.NORMAL=0]="NORMAL",t[t.BOLD=1]="BOLD",t))(vt||{}),bt=(t=>(t[t.NORMAL=1]="NORMAL",t[t.SUBSCRIPT=2]="SUBSCRIPT",t[t.SUPERSCRIPT=3]="SUPERSCRIPT",t))(bt||{}),I=(t=>(t[t.FALSE=0]="FALSE",t[t.TRUE=1]="TRUE",t))(I||{}),dt=(t=>(t[t.STRING=1]="STRING",t[t.NUMBER=2]="NUMBER",t[t.BOOLEAN=3]="BOOLEAN",t[t.FORCE_STRING=4]="FORCE_STRING",t))(dt||{}),H=(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))(H||{}),Tt=(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))(Tt||{});const ms={[Tt.OFFICE]:{[H.ACCENT1]:"#4472C4",[H.ACCENT2]:"#ED7D31",[H.ACCENT3]:"#A5A5A5",[H.ACCENT4]:"#70AD47",[H.ACCENT5]:"#5B9BD5",[H.ACCENT6]:"#70AD47",[H.DARK1]:"#000000",[H.DARK2]:"#44546A",[H.LIGHT1]:"#FFFFFF",[H.LIGHT2]:"#E7E6E6",[H.HYPERLINK]:"#0563C1",[H.FOLLOWED_HYPERLINK]:"#954F72"}};class wt{constructor(){_(this,"_themeValue",H.LIGHT1);_(this,"_themeColors");_(this,"_themeTint");_(this,"_rgbValue","");_(this,"_colorType");this._colorType=B.UNSUPPORTED,this._themeColors=Tt.OFFICE,this._themeTint=0}asRgbColor(){return new Dt(this._rgbValue,this)}asThemeColor(){return new Ut(this._themeValue,this._themeTint,this._themeColors,this)}build(){switch(this._colorType){case B.THEME:return this.asThemeColor();case B.RGB:return this.asRgbColor();case B.UNSUPPORTED:throw new Error("unsupported color type")}}setRgbColor(s){return this._colorType=B.RGB,this._rgbValue=s,this}setThemeColors(s){this._colorType=B.THEME,this._themeColors=s}setThemeTint(s){this._colorType=B.THEME,this._themeTint=s}setThemeColor(s){return this._colorType=B.THEME,this._themeValue=s,this}getColorType(){return this._colorType}}class st{constructor(s){_(this,"_builder");this._builder=s}static rgbColorToHexValue(s){return`#${((1<<24)+(s.getRed()<<16)+(s.getGreen()<<8)+s.getBlue()).toString(16).slice(1)}`}static hexValueToRgbColor(s){s?s.indexOf("#")>-1&&(s=s.substring(1)):s="#000000";const e=+`0x${s[0]}${s[1]}`,n=+`0x${s[2]}${s[3]}`,r=+`0x${s[4]}${s[5]}`;return new wt().setRgbColor(`rgb(${e},${n},${r})`).asRgbColor()}static hexToRgbString(s){const e=/^#?([a-f\d])([a-f\d])([a-f\d])$/i;s=s.replace(e,(i,o,c,a)=>o+o+c+c+a+a);const n=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(s);let r=null;if(n){const i=Number.parseInt(n[1],16),o=Number.parseInt(n[2],16),c=Number.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 st(this._builder)}equals(s){return!1}}class Os{constructor(s){_(this,"_saturation",0);_(this,"_hue",0);_(this,"_lightness",0);_(this,"_alpha",0);const e=s.getRed()/255,n=s.getGreen()/255,r=s.getBlue()/255,i=s.getAlpha()/255,o=Math.min(e,Math.min(n,r)),c=Math.max(e,Math.max(n,r)),a=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=a/(c+o):this._saturation=a/(2-c-o),e===c&&(this._hue=(n-r)/a),n===c&&(this._hue=2+(r-e)/a),r===c&&(this._hue=4+(e-n)/a),this._hue*=60,this._hue<0&&(this._hue+=360),this._alpha=i}asRgbColor(){const s=new wt;if(this._saturation===0)return s.setRgbColor(`rgba(${this._lightness*255},${this._lightness*255},${this._lightness*255},${this._alpha*255})`),s.asRgbColor();let e;this._lightness<.5?e=this._lightness*(1+this._saturation):e=this._lightness+this._saturation-this._lightness*this._saturation;const n=2*this._lightness-e,r=this._hue/360,i=r+1/3,o=this.setColor(e,n,i),c=this.setColor(e,n,r),a=r-1/3,h=this.setColor(e,n,a);return s.setRgbColor(`rgba(${Math.round(o*255)},${Math.round(c*255)},${Math.round(h*255)},${this._alpha*255})`),s.asRgbColor()}getLightness(){return this._lightness}getHue(){return this._hue}getSaturation(){return this._saturation}getAlpha(){return this._alpha}setColor(s,e,n){n<0&&(n+=1),n>1&&(n-=1);let r;return 6*n<1?r=e+(s-e)*6*n:2*n<1?r=s:3*n<2?r=e+(s-e)*(2/3-n)*6:r=e,r}setLightness(s){this._lightness=s}}const G=class G extends st{constructor(e,n){super(n);_(this,"_cssString");_(this,"_red");_(this,"_green");_(this,"_blue");_(this,"_alpha");let r=e.match(G.RGBA_EXTRACT);if(r){const i=+r[1],o=+r[2],c=+r[3],a=+r[4];this._cssString=e,this._red=i,this._green=o,this._blue=c,this._alpha=a;return}if(r=e.match(G.RGB_EXTRACT),r){const i=+r[1],o=+r[2],c=+r[3];this._cssString=e,this._red=i,this._green=o,this._blue=c,this._alpha=1;return}throw new Error("Invalid rgba or rgb color")}asHexString(){return st.rgbColorToHexValue(this)}getRed(){let e=this._red+G.RGB_COLOR_AMT;return e>255?e=255:e<0&&(e=0),e}getGreen(){let e=this._green+G.RGB_COLOR_AMT;return e>255?e=255:e<0&&(e=0),e}getBlue(){let e=this._blue+G.RGB_COLOR_AMT;return e>255?e=255:e<0&&(e=0),e}getAlpha(){return this._alpha}getColorType(){return B.RGB}clone(){return new G(this._cssString,this._builder)}asThemeColor(){throw new Error("rgb color not support to themeColor")}equals(e){return e instanceof G?e._red===this._red&&e._blue===this._blue&&e._green===this._green&&e._alpha===this._alpha:!1}getCssString(){return this._cssString}};_(G,"RGB_COLOR_AMT",0),_(G,"RGBA_EXTRACT",new RegExp("\\s*rgba\\s*\\((\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d.\\d|\\d\\s*)\\)\\s*")),_(G,"RGB_EXTRACT",new RegExp("\\s*rgb\\s*\\((\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d+\\s*)\\)\\s*"));let Dt=G;const Q=class Q extends st{constructor(e,n,r,i){super(i);_(this,"_themeColorType");_(this,"_themeTint");_(this,"_themeColors");this._themeColorType=e,this._themeTint=n,this._themeColors=r}lumValue(e,n){if(e==null)return n;let r;return e<0?r=n*(1+e):r=n*(1-e)+(255-255*(1-e)),r}asRgbColor(){const e=ms[this._themeColors];if(e==null)throw new Error("not find themeColors type");const n=e[this._themeColorType];if(n==null)throw new Error("not find themeColors value");let r;if(Q._cacheThemeColor.has(this._themeColors)){if(r=Q._cacheThemeColor.get(this._themeColors),r.has(this._themeColorType))return r.get(this._themeColorType)}else r=new Map,Q._cacheThemeColor.set(this._themeColors,r);const i=new Os(st.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 Q(this._themeColorType,this._themeTint,this._themeColors,this._builder)}equals(e){return e instanceof Q?e._themeColorType===this._themeColorType:!1}getColorType(){return B.THEME}getThemeColorType(){return this._themeColorType}};_(Q,"_cacheThemeColor",new Map);let Ut=Q;const wr="rgb(",Dr="rgba(",Jt={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(s){_(this,"_color");_(this,"_rgbColor");_(this,"_isValid",!1);if(s==null){this._setNullColor();return}if(s instanceof $){this._color={...s._color},this._rgbColor={...s._rgbColor};return}const e=Is(s);if(e==null){this._setNullColor();return}this._color=e;const n=Fr(this._color);if(n==null){this._setNullColor();return}this._rgbColor=n,this._isValid=!0}static mix(s,e,n){var h,u;n=Math.min(1,Math.max(0,n));const r=new $(s).toRgb(),i=new $(e).toRgb(),o=(h=r.a)!=null?h:1,c=(u=i.a)!=null?u:1,a={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:(c-o)*n+o};return new $(a)}static getContrastRatio(s,e){const n=new $(s).getLuminance(),r=new $(e).getLuminance();return(Math.max(n,r)+.05)/(Math.min(n,r)+.05)}get isValid(){return this._isValid}toRgb(){return this._rgbColor}toRgbString(){const{r:s,g:e,b:n,a:r=1}=this.toRgb(),i=r<1;return`rgb${i?"a":""}(${s},${e},${n}${i?`,${r}`:""})`}toString(){return this.toRgbString()}toHexString(s){const{r:e,g:n,b:r,a:i=1}=this.toRgb(),o=i<1,c=[Mt(Math.round(e).toString(16)),Mt(Math.round(n).toString(16)),Mt(Math.round(r).toString(16)),Mt(Math.round(i*255).toString(16))];return s&&c[0][0]===c[0][1]&&c[1][0]===c[1][1]&&c[2][0]===c[2][1]&&c[3][0]===c[3][1]?o?`#${c[0][0]}${c[1][0]}${c[2][0]}${c[3][0]}`:`#${c[0][0]}${c[1][0]}${c[2][0]}`:o?`#${c[0]}${c[1]}${c[2]}${c[3]}`:`#${c[0]}${c[1]}${c[2]}`}toHsv(){return Gr(this.toRgb())}toHsl(){return kr(this.toRgb())}lighten(s=10){const e=this.toHsl();return e.l+=s,e.l=Math.min(Math.max(e.l,0),100),new $(e)}darken(s=10){const e=this.toHsl();return e.l-=s,e.l=Math.min(Math.max(e.l,0),100),new $(e)}setAlpha(s){return new $({...this._rgbColor,a:s})}getLuminance(){let{r:s,g:e,b:n}=this.toRgb();return s=Zt(s),e=Zt(e),n=Zt(n),Number((.2126*s+.7152*e+.0722*n).toFixed(3))}getBrightness(){const{r:s,g:e,b:n}=this.toRgb();return(s*299+e*587+n*114)/1e3}getAlpha(){var s;return(s=this._color.a)!=null?s: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 Mt=t=>t.length===1?`0${t}`:t,Zt=t=>(t/=255,t<=.03928?t/12.92:((t+.055)/1.055)**2.4),Is=t=>{if(Vr(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 e={h:Math.round(t.h),s:t.s,v:t.v};return t.a!==void 0&&(e.a=t.a),e}const s=t.trim();if(Jt[s]){const e=Jt[s],n={r:Math.round(e[0]),g:Math.round(e[1]),b:Math.round(e[2])};return n.a=e[3]||1,n}if(s.startsWith("#"))return Ur(s);if(s.startsWith("rgb"))return Mr(s);if(s.startsWith("hsl"))return Pr(s);if(s.startsWith("hsv"))return Hr(s)},Ur=t=>{const s=t.substring(1),e=new RegExp(`.{1,${s.length>=6?2:1}}`,"g");let n=s.match(e);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:Number.parseInt(n[0],16),g:Number.parseInt(n[1],16),b:Number.parseInt(n[2],16)};return n.length>3&&(r.a=Number.parseInt(n[3],16)/255),r},Mr=t=>{const s=t.indexOf("(");if(s===-1)throw new Error(`The color '${t}' is illegal rgb color`);const e=t.substring(s+1,t.length-1).split(",");if(e.length<3)throw new Error(`The color '${t}' is illegal rgb color`);const n={r:Number.parseInt(e[0],10),g:Number.parseInt(e[1],10),b:Number.parseInt(e[2],10)};return e.length>3&&(n.a=Number.parseFloat(e[3])),n},Pr=t=>{const s=t.indexOf("(");if(s===-1)throw new Error(`The color '${t}' is illegal hsl color`);const e=t.substring(s+1,t.length-1).split(",");if(e.length<3)throw new Error(`The color '${t}' is illegal hsl color`);const n={h:Number.parseInt(e[0],10),s:Number.parseFloat(e[1]),l:Number.parseFloat(e[2])};return e.length>3&&(n.a=Number.parseFloat(e[3])),n},Hr=t=>{const s=t.indexOf("(");if(s===-1)throw new Error(`The color '${t}' is illegal hsv color`);const e=t.substring(s+1,t.length-1).split(",");if(e.length<3)throw new Error(`The color '${t}' is illegal hsv color`);const n={h:Number.parseInt(e[0],10),s:Number.parseFloat(e[1]),v:Number.parseFloat(e[2])};return e.length>3&&(n.a=Number.parseFloat(e[3])),n},Fr=t=>{const s=Is(t);if(s!=null)return"r"in s?s:"l"in s?Wr(s):Br(s)},yt=(t,s,e)=>(e<0&&(e+=1),e>1&&(e-=1),e<1/6?t+(s-t)*6*e:e<1/2?s:e<2/3?t+(s-t)*(2/3-e)*6:t),Wr=t=>{let{h:s,s:e,l:n}=t;s/=360,e/=100,n/=100;let r=0,i=0,o=0;if(e===0)r=i=o=n;else{const a=n<.5?n*(1+e):n+e-n*e,h=2*n-a;r=yt(h,a,s+1/3),i=yt(h,a,s),o=yt(h,a,s-1/3)}const c={r:Math.round(r*255),g:Math.round(i*255),b:Math.round(o*255)};return t.a!==void 0&&(c.a=t.a),c},Br=t=>{let{h:s,s:e,v:n}=t;s=s/360*6,e/=100,n/=100;const r=Math.floor(s),i=s-r,o=n*(1-e),c=n*(1-i*e),a=n*(1-(1-i)*e),h=r%6,u=[n,c,o,o,a,n][h],d=[a,n,n,c,o,o][h],E=[o,o,a,n,n,c][h],f={r:u*255,g:d*255,b:E*255};return t.a!==void 0&&(f.a=t.a),f},kr=t=>{let{r:s,g:e,b:n}=t;s/=255,e/=255,n/=255;const r=Math.max(s,e,n),i=Math.min(s,e,n),o=(r+i)/2;let c,a;if(r===i)c=a=0;else{const u=r-i;switch(a=o>.5?u/(2-r-i):u/(r+i),r){case s:c=(e-n)/u+(e<n?6:0);break;case e:c=(n-s)/u+2;break;default:c=(s-e)/u+4;break}c/=6}const h={h:Math.round(c*360),s:Math.round(a*100),l:Math.round(o*100)};return t.a!==void 0&&(h.a=t.a),h},Gr=t=>{let{r:s,g:e,b:n}=t;s/=255,e/=255,n/=255;const r=Math.max(s,e,n),i=Math.min(s,e,n);let o;const c=r,a=r-i,h=r===0?0:a/r;if(r===i)o=0;else{switch(r){case s:o=(e-n)/a+(e<n?6:0);break;case e:o=(n-s)/a+2;break;default:o=(s-e)/a+4;break}o/=6}const u={h:Math.round(o*360),s:Math.round(h*100),v:Math.round(c*100)};return t.a!==void 0&&(u.a=t.a),u},$r=t=>t==null,Vr=t=>!$r(t)&&typeof t=="object";function pr(t){const s=/^#(?:[0]{3}|[0]{6})\b/,e=/^rgb\s*\(\s*0+\s*,\s*0+\s*,\s*0+\s*\)$/,n=/^rgba\s*\(\s*0+\s*,\s*0+\s*,\s*0+\s*,\s*(1|1\.0*|0?\.\d+)\)$/,r=/^hsl\s*\(\s*0*\s*,\s*0%*\s*,\s*0%*\s*\)$/,i=/^hsla\s*\(\s*0*\s*,\s*0%*\s*,\s*0%*\s*,\s*(1|1\.0*|0?\.\d+)\)$/;return!!(s.test(t)||e.test(t)||n.test(t)||r.test(t)||i.test(t))}function xr(t){const s=/^#(?:[Ff]{3}|[Ff]{6})\b/,e=/^rgb\s*\(\s*255\s*,\s*255\s*,\s*255\s*\)$/,n=/^rgba\s*\(\s*255\s*,\s*255\s*,\s*255\s*,\s*(1|1\.0*|0?\.\d+)\)$/,r=/^hsl\s*\(\s*0*\s*,\s*0%*\s*,\s*100%*\s*\)$/,i=/^hsla\s*\(\s*0*\s*,\s*0%*\s*,\s*100%*\s*,\s*(1|1\.0*|0?\.\d+)\)$/;return!!(s.test(t)||e.test(t)||n.test(t)||r.test(t)||i.test(t))}var M=(t=>(t[t.COVER=0]="COVER",t[t.REPLACE=1]="REPLACE",t[t.INTERSECTION=2]="INTERSECTION",t))(M||{});const jr="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let Kr=t=>crypto.getRandomValues(new Uint8Array(t)),Yr=(t,s,e)=>{let n=(2<<Math.log(t.length-1)/Math.LN2)-1,r=-~(1.6*n*s/t.length);return(i=s)=>{let o="";for(;;){let c=e(r),a=r;for(;a--;)if(o+=t[c[a]&n]||"",o.length===i)return o}}},zr=(t,s=21)=>Yr(t,s,Kr),Xr=(t=21)=>{let s="",e=crypto.getRandomValues(new Uint8Array(t));for(;t--;)s+=jr[e[t]&63];return s};const qr=/^-ms-/,Qr=/-([a-z])/g,Y=["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 R{static stringAt(s){let e="",n=s;for(;n>=Y.length;)n/=Y.length,n-=1,e+=Y[n%Y.length];const r=s%Y.length;return e+=Y[r],e}static indexAt(s){let e=0;for(let n=0;n<s.length-1;n+=1){const r=s.charCodeAt(n)-65,i=s.length-1-n;e+=Y.length**i+Y.length*r}return e+=s.charCodeAt(s.length-1)-65,e}static deleteBlank(s){return R.isString(s)?s.replace(/\s/g,""):s}static getSystemType(){const s=navigator.userAgent,e=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"&&!e&&!n)return"Unix";if(String(navigator.platform).indexOf("Linux")>-1)return"Linux";if(e){if(s.indexOf("Windows NT 5.0")>-1||s.indexOf("Windows 2000")>-1)return"Windows 2000";if(s.indexOf("Windows NT 5.1")>-1||s.indexOf("Windows XP")>-1)return"Windows XP";if(s.indexOf("Windows NT 5.2")>-1||s.indexOf("Windows 2003")>-1)return"Windows 2003";if(s.indexOf("Windows NT 6.0")>-1||s.indexOf("Windows Vista")>-1)return"Windows Vista";if(s.indexOf("Windows NT 6.1")>-1||s.indexOf("Windows 7")>-1)return"Windows 7";if(s.indexOf("Windows NT 10")>-1||s.indexOf("Windows 10")>-1)return"Windows 10";if(s.indexOf("Windows NT 11")>-1||s.indexOf("Windows 11")>-1)return"Windows 11"}return"Unknown system"}static getBrowserType(){const s=navigator.userAgent,e=s.indexOf("Opera")>-1,n=s.indexOf("compatible")>-1&&s.indexOf("MSIE")>-1&&!e,r=s.indexOf("Trident")>-1&&s.indexOf("rv:11.0")>-1,i=s.indexOf("Edge")>-1,o=s.indexOf("Firefox")>-1,c=s.indexOf("Safari")>-1&&s.indexOf("Chrome")===-1,a=s.indexOf("Chrome")>-1&&s.indexOf("Safari")>-1;if(n){new RegExp("MSIE (\\d+\\.\\d+);").test(s);const u=Number.parseFloat(RegExp.$1);return u===7?"IE7":u===8?"IE8":u===9?"IE9":u===10?"IE10":"0"}return o?"FF":e?"Opera":c?"Safari":a?"Chrome":i?"Edge":r?"IE11":"Unknown browser"}static generateRandomId(s=21,e){return e?zr(e,s)():Xr(s)}static getClassName(s){return s.constructor.name}static deepMerge(s,...e){e.forEach(o=>o&&i(o));function n(o,c){o.forEach((a,h)=>{var u,d;if(R.isArray(a)){const E=(u=c[h])!=null?u:[];c[h]=E,n(a,E);return}if(R.isObject(a)){const E=(d=c[h])!=null?d:{};c[h]=E,r(a,E);return}c[h]=a})}function r(o,c){Object.keys(o).forEach(a=>{var u,d;const h=o[a];if(R.isObject(h)){const E=(u=c[a])!=null?u:{};c[a]=E,r(h,E);return}if(R.isArray(h)){const E=(d=c[a])!=null?d:[];c[a]=E,n(h,E);return}c[a]=h})}function i(o){Object.keys(o).forEach(c=>{var h,u;const a=o[c];if(R.isArray(a)){const d=(h=s[c])!=null?h:[];s[c]=d,n(a,d);return}if(R.isObject(a)){const d=(u=s[c])!=null?u:{};s[c]=d,r(a,d);return}s[c]=a})}return s}static numberFixed(s,e){return Number(Number(s).toFixed(e))}static diffValue(s,e){function n(o,c){const a=R.getValueType(o),h=R.getValueType(c);return a!==h?!1:R.isArray(o)?r(o,c):R.isObject(o)?i(o,c):R.isDate(o)?o.getTime()===c.getTime():R.isRegExp(o)?o.toString()===c.toString():o===c}function r(o,c){if(s.length!==e.length)return!1;for(let a=0,h=o.length;a<h;a++){const u=o[a],d=c[a];if(!n(u,d))return!1}return!0}function i(o,c){const a=Object.keys(o),h=Object.keys(c);if(a.length!==h.length)return!1;for(const u of a){if(!h.includes(u))return!1;const d=o[u],E=c[u];if(!n(d,E))return!1}return!0}return n(s,e)}static deepClone(s){if(!this.isDefine(s))return s;if(this.isRegExp(s))return new RegExp(s);if(this.isDate(s))return new Date(s);if(this.isArray(s)){const e=[];return s.forEach((n,r)=>{e[r]=R.deepClone(n)}),e}if(this.isObject(s)){const e={};return Object.keys(s).forEach(n=>{const r=s[n];e[n]=R.deepClone(r)}),Object.setPrototypeOf(e,Object.getPrototypeOf(s)),e}return s}static getLanguage(){const s="en-US";return globalThis.navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||s}static getValueType(s){return Object.prototype.toString.apply(s)}static isDefine(s){return s!=null}static isBlank(s){return this.isDefine(s)?this.isString(s)?s.trim()==="":!1:!0}static isAssignableFrom(s,e){return s instanceof e}static isBoolean(s){return this.getValueType(s)==="[object Boolean]"}static isPlainObject(s){return this.isDefine(s)?Object.getPrototypeOf(s)===Object.getPrototypeOf({}):!1}static isFunction(s){return this.getValueType(s)==="[object Function]"}static isDate(s){return this.getValueType(s)==="[object Date]"}static isRegExp(s){return this.getValueType(s)==="[object RegExp]"}static isArray(s){return this.getValueType(s)==="[object Array]"}static isString(s){return this.getValueType(s)==="[object String]"}static isNumber(s){return this.getValueType(s)==="[object Number]"}static isStringNumber(s){return!isNaN(Number.parseFloat(s))&&isFinite(s)}static isObject(s){return this.getValueType(s)==="[object Object]"}static isEmptyObject(s){for(const e in s)return!1;return!0}static isMobile(){let s=0,e=0;return document.body.clientWidth&&(s=document.body.clientWidth),document.body.clientHeight&&(e=document.body.clientHeight),this.isAndroid()||this.isIPhone()||this.isTablet()||s<350&&e<500}static isTablet(){return/ipad|android|android 3.0|xoom|sch-i800|playbook|tablet|kindle/i.test(navigator.userAgent.toLowerCase())}static isWeChat(){const s=navigator.userAgent.toLowerCase();return String(s.match(/MicroMessenger/i))==="micromessenger"}static isAndroid(){const s=navigator.userAgent;return s.indexOf("Android")>-1||s.indexOf("Linux")>-1}static isIPhone(){return/iPhone/i.test(navigator.userAgent)}static itCount(s){return e=>{for(let n=0;n<s;n++)e&&e()}}static hasLength(s,e){return R.isDefine(s)?R.isDefine(e)?s.length===e:s.length>0:!1}static capitalize(s){return s.charAt(0).toUpperCase()+s.slice(1)}static fCamelCase(s,e){return e.toUpperCase()}static camelCase(s){return s.replace(qr,"ms-").replace(Qr,this.fCamelCase)}static removeNull(s){return this.isObject(s)&&Object.keys(s).forEach(e=>{const n=s[e];n==null?delete s[e]:R.removeNull(n)}),s}static fillTwoDimensionalArray(s,e,n){return new Array(s).fill(n).map(r=>new Array(e).fill(n))}static numToWord(s){let e="";for(;s>0;){let n=s%26;n=n===0?n=26:n,e=String.fromCharCode(96+n)+e,s=(s-n)/26}return e.toLocaleUpperCase()}static ABCatNum(s){if(s==null||s.length===0)return Number.NaN;const e=s.toLowerCase().split(""),n=e.length;let r=0,i=0;for(let o=0;o<n;o++)i=e[o].charCodeAt(0)-96,r+=i*26**(n-o-1);return r===0?Number.NaN:r-1}static chatAtABC(s){let i="";for(;s>=0;)i=String.fromCharCode(s%26+97)+i,s=Math.floor(s/26)-1;return i.toUpperCase()}static randSort(s){for(let e=0,n=s.length;e<n;e++){const r=Number.parseInt((Math.random()*n).toString()),i=s[r];s[r]=s[e],s[e]=i}return s}static commonExtend(s,e){const n={};for(const r in s)n[r]=s[r];for(const r in e)e[r]!=null&&(n[r]=e[r]);return n}static commonExtend1(s,e){for(const n in s)e[n]==null&&(e[n]=s[n]);return e}static arrayToObject(s){const e={};return s.forEach((n,r)=>{e[r]={},n.forEach((i,o)=>{e[r][o]=i})}),e}static hasIntersectionBetweenTwoRanges(s,e,n,r){return e>=n&&r>=s}static isStartValidPosition(s){return/^[A-Za-z_]/.test(s)}static isValidParameter(s){const e=/[~!@#$%^&*()+=\-{}\[\]\|:;"'<>,?\/ ]+/.test(s),n=s.length<=255;return!e&&n}}function Jr(t){if(!t)return;const{actualRow:s,actualColumn:e,isMerged:n,isMergedMainCell:r,mergeInfo:i}=t;let{startY:o,endY:c,startX:a,endX:h}=t,u=s,d=e,E=s,f=e;if(n&&i){const{startRow:g,startColumn:m,endRow:N,endColumn:S,startY:F,endY:P,startX:J,endX:Oc}=i;u=g,d=m,E=N,f=S,o=F,c=P,a=J,h=Oc}return r&&(o=i.startY,c=i.endY,a=i.startX,h=i.endX,E=i.endRow,f=i.endColumn),{startRow:u,startColumn:d,endRow:E,endColumn:f,startY:o,endY:c,startX:a,endX:h}}function Zr(t){if(!t)return;const{actualRow:s,actualColumn:e,isMerged:n,isMergedMainCell:r,startRow:i,startColumn:o,endRow:c,endColumn:a}=t;let h=s,u=e,d=s,E=e;return(n||r)&&(h=i,u=o,d=c,E=a),{startRow:h,startColumn:u,endRow:d,endColumn:E}}function yr(t){var e;return!t||(((e=t==null?void 0:t.v)==null?void 0:e.toString())||"").length===0&&!t.p}function x(t){if(t){if(t.rgb)return t.rgb;if(t.th)return new wt().setThemeColor(t.th).asThemeColor().asRgbColor().getCssString()}return null}function ti(t){return R.isString(t)&&t.substring(0,1)==="="&&t.length>1}function ei(t){return R.isString(t)&&t.length>0}function si(t){return""}function ni(t,s=!1){var i;let e="";const n=new Map([["ff",()=>{t.ff&&(e+=`font-family: ${t.ff}; `)}],["fs",()=>{if(t.fs){let o=t.fs;t.va&&(o/=2),e+=`font-size: ${o}pt; `}}],["it",()=>{t.it&&(e+="font-style: italic; ")}],["bl",()=>{t.bl&&(e+="font-weight: bold; ")}],["ul",()=>{var o;(o=t.ul)!=null&&o.s&&(e.indexOf("text-decoration-line")>-1?e=e.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g,(c,a)=>`${a} underline`):e+="text-decoration-line: underline; ",t.ul.cl&&e.indexOf("text-decoration-color")===-1&&(e+=`text-decoration-color: ${x(t.ul.cl)}; `),t.ul.t&&e.indexOf("text-decoration-style")===-1&&(e+=`text-decoration-style: ${t.ul.t} `))}],["st",()=>{var o;(o=t.st)!=null&&o.s&&(e.indexOf("text-decoration-line")>-1?e=e.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g,(c,a)=>`${a} line-through`):e+="text-decoration-line: line-through; ",t.st.cl&&e.indexOf("text-decoration-color")===-1&&(e+=`text-decoration-color: ${x(t.st.cl)}; `),t.st.t&&e.indexOf("text-decoration-style")===-1&&(e+=`text-decoration-style: ${t.st.t} `))}],["ol",()=>{var o;(o=t.ol)!=null&&o.s&&(e.indexOf("text-decoration-line")>-1?e=e.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g,(c,a)=>`${a} overline`):e+="text-decoration-line: overline; ",t.ol.cl&&e.indexOf("text-decoration-color")===-1&&(e+=`text-decoration-color: ${x(t.ol.cl)}; `),t.ol.t&&e.indexOf("text-decoration-style")===-1&&(e+=`text-decoration-style: ${t.ol.t} `))}],["bg",()=>{t.bg&&(e+=`background: ${x(t.bg)}; `)}],["bd",()=>{var o,c,a,h,u,d,E,f,g,m,N,S;(o=t.bd)!=null&&o.b&&(e+=`border-bottom: ${Pt((c=t.bd)==null?void 0:c.b.s)} ${(a=x(t.bd.b.cl))!=null?a:""}; `),(h=t.bd)!=null&&h.t&&(e+=`border-top: ${Pt((u=t.bd)==null?void 0:u.t.s)} ${(d=x(t.bd.t.cl))!=null?d:""}; `),(E=t.bd)!=null&&E.r&&(e+=`border-right: ${Pt((f=t.bd)==null?void 0:f.r.s)} ${(g=x(t.bd.r.cl))!=null?g:""}; `),(m=t.bd)!=null&&m.l&&(e+=`border-left: ${Pt((N=t.bd)==null?void 0:N.l.s)} ${(S=x(t.bd.l.cl))!=null?S:""}; `)}],["cl",()=>{t.cl&&(e+=`color: ${x(t.cl)}; `)}],["va",()=>{t.va===bt.SUBSCRIPT?e+="vertical-align: sub; ":t.va===bt.SUPERSCRIPT&&(e+="vertical-align: super; ")}],["td",()=>{t.td===_t.LEFT_TO_RIGHT?e+="direction: ltr; ":t.td===_t.RIGHT_TO_LEFT&&(e+="direction: rtl; ")}],["tr",()=>{var o,c,a;t.tr&&(e+=`data-rotate: (${(o=t.tr)==null?void 0:o.a}deg${(c=t.tr)!=null&&c.v?` ,${(a=t.tr)==null?void 0:a.v}`:""});`)}],["ht",()=>{t.ht===et.LEFT?e+="text-align: left; ":t.ht===et.RIGHT?e+="text-align: right; ":t.ht===et.CENTER?e+="text-align: center; ":t.ht===et.JUSTIFIED&&(e+="text-align: justify; ")}],["vt",()=>{t.vt===ot.BOTTOM?e+="vertical-align: bottom; ":t.vt===ot.TOP?e+="vertical-align: top; ":t.vt===ot.MIDDLE&&(e+="vertical-align: middle; ")}],["tb",()=>{t.tb===ct.CLIP?e+="text-overflow: clip; ":t.tb===ct.OVERFLOW?e+="text-break: overflow; ":t.tb===ct.WRAP&&(e+="word-wrap: break-word;")}],["pd",()=>{var u,d,E,f,g,m,N,S;const o=`${(u=t.pd)==null?void 0:u.b}pt`,c=`${(d=t.pd)==null?void 0:d.t}pt`,a=`${(E=t.pd)==null?void 0:E.l}pt`,h=`${(f=t.pd)==null?void 0:f.r}pt`;(g=t.pd)!=null&&g.b&&(e+=`padding-bottom: ${o}; `),(m=t.pd)!=null&&m.t&&(e+=`padding-top: ${c}; `),(N=t.pd)!=null&&N.l&&(e+=`padding-left: ${a}; `),(S=t.pd)!=null&&S.r&&(e+=`padding-right: ${h}; `)}]]),r=["bd","tr","tb"];for(const o in t)s&&r.includes(o)||(i=n.get(o))==null||i();return e}function Pt(t){let s="";return t===v.NONE?s="none":t===v.THIN?s="0.5pt solid":t===v.HAIR?s="0.5pt double":t===v.DOTTED?s="0.5pt dotted":t===v.DASHED||t===v.DASH_DOT?s="0.5pt dashed":t===v.DASH_DOT_DOT?s="0.5pt dotted":t===v.DOUBLE?s="0.5pt double":t===v.MEDIUM?s="1pt solid":t===v.MEDIUM_DASHED||t===v.MEDIUM_DASH_DOT?s="1pt dashed":t===v.MEDIUM_DASH_DOT_DOT?s="1pt dotted":t===v.SLANT_DASH_DOT?s="0.5pt dashed":t===v.THICK&&(s="1.5pt solid"),s}function ri(t){let s=0;if(t=t.trim(),t==="none")s=v.NONE;else if(t==="0.5pt solid")s=v.THIN;else if(t==="0.5pt double")s=v.HAIR;else if(t==="0.5pt dotted")s=v.DOTTED;else if(t==="0.5pt dashed")s=v.DASHED;else if(t==="1pt solid")s=v.MEDIUM;else if(t==="1pt dashed")s=v.MEDIUM_DASHED;else if(t==="1pt dotted")s=v.MEDIUM_DASH_DOT_DOT;else if(t==="1.5pt solid")s=v.THICK;else return v.NONE;return s}function Ht(t,s){let e=t.body;if(s){const{headers:n,footers:r}=t;n!=null&&n[s]?e=n[s].body:r!=null&&r[s]&&(e=r[s].body)}return e}function ii(t){const{startRow:s,endRow:e,startColumn:n,endColumn:r}=t;return!(s<0||n<0||e<0||r<0||Number.isNaN(s)||Number.isNaN(e)||Number.isNaN(n)||Number.isNaN(r))}function oi(t,s){return{startRow:t,endRow:t,startColumn:s,endColumn:s}}function te(t,s){return Object.prototype.toString.call(t)===Object.prototype.toString.call(s)?Object.prototype.toString.call(t)==="[object Object]"||Object.prototype.toString.call(t)==="[object Array]"?Object.keys(t).length!==Object.keys(s).length?!1:Object.keys(t).every(e=>te(t[e],s[e])):t===s:!1}function As(t,s){const e=t.ts||{},n=s.ts||{};return t.sId!==s.sId?!1:te(e,n)}function ci(t,s){return s.some(e=>t.indexOf(e)>-1)}function ee(t,s,e,n){if(t>s&&([t,s]=[s,t]),e>n&&([e,n]=[n,e]),s<e||n<t)return[t,s];e<t&&(e=t),n>s&&(n=s);const r=n-e+1;let i=[];return t===e?i=[n+1-r,s-r]:s===n?i=[t,e-1]:i=[t,s-r],i}function ai(t){if(t==null)return!1;const s=t.bullet;return(s==null?void 0:s.listId)!=null}function li(t){if(t==null)return!1;const s=t.paragraphStyle;return Cs(s)}function Cs(t){return!(t==null||(t.indentStart==null||t.indentStart===0)&&t.hanging==null||t.hanging===0)}function Ns(t,s,e){return t.slice(0,s)+e+t.slice(s)}function Ss(t,s,e){return s>e?t:t.slice(0,s)+t.slice(e)}function ui(t){return t===null||t.toString().replace(/\s/g,"")===""||typeof t=="boolean"?!1:!isNaN(t)}function hi(t){let s=0;for(let e=0;e<t.length;e++)s=t.charCodeAt(e)+(s<<6)+(s<<16)-s;return s>>>0}class Et{static hasLength(s,e){return s.length===e}static getValueType(s){return Object.prototype.toString.apply(s)}static isObject(s){return this.getValueType(s)==="[object Object]"}static isIterable(s){return s[Symbol.iterator]!=null}static isNumber(s){return this.getValueType(s)==="[object Number]"}}const L=Symbol("newer"),D=Symbol("older");class Ls{constructor(s){_(this,"entry");this.entry=s}[Symbol.iterator](){return this}next(){const s=this.entry;return s?(this.entry=s[L],{done:!1,value:s.key}):{done:!0,value:void 0}}}class vs{constructor(s){_(this,"entry");this.entry=s}[Symbol.iterator](){return this}next(){const s=this.entry;return s?(this.entry=s[L],{done:!1,value:s.value}):{done:!0,value:void 0}}}class bs{constructor(s){_(this,"entry");this.entry=s}[Symbol.iterator](){return this}next(){const s=this.entry;return s?(this.entry=s[L],{done:!1,value:[s.key,s.value]}):{done:!0,value:void 0}}}class se{constructor(s,e){_(this,"key");_(this,"value");_(this,Rc);_(this,mc);this.key=s,this.value=e,this[L]=void 0,this[D]=void 0}toJSON(){return{key:this.key,value:this.value}}}Rc=L,mc=D;class Ts{constructor(...s){_(this,"_keymap");_(this,"size",0);_(this,"limit");_(this,"oldest");_(this,"newest");_(this,"_onShiftListeners",[]);if(Et.hasLength(s,1)){if(Et.isNumber(s[0])){const e=s[0];this._initialize(e,void 0);return}if(Et.isIterable(s[0])){const e=s[0];this._initialize(0,e);return}return}if(Et.hasLength(s,2)){const e=s[0],n=s[1];this._initialize(e,n)}}onShift(s){if(this._onShiftListeners.indexOf(s)===-1)return this._onShiftListeners.push(s),b(()=>K(this._onShiftListeners,s));throw new Error("[LRUMap]: the listener has been registered!")}_initialize(s,e){this.oldest=void 0,this.newest=void 0,this.size=0,this.limit=s,this._keymap=new Map,e&&(this.assign(e),s<1&&(this.limit=this.size))}_markEntryAsUsed(s){s!==this.newest&&(s[L]&&(s===this.oldest&&(this.oldest=s[L]),s[L][D]=s[D]),s[D]&&(s[D][L]=s[L]),s[L]=void 0,s[D]=this.newest,this.newest&&(this.newest[L]=s),this.newest=s)}assign(s){let e,n=this.limit||Number.MAX_VALUE;this._keymap.clear();const r=s[Symbol.iterator]();for(let i=r.next();!i.done;i=r.next()){const o=new se(i.value[0],i.value[1]);if(this._keymap.set(o.key,o),e?(e[L]=o,o[D]=e):this.oldest=o,e=o,n--===0)throw new Error("overflow")}this.newest=e,this.size=this._keymap.size}set(s,e){let n=this._keymap.get(s);return n?(n.value=e,this._markEntryAsUsed(n),this):(this._keymap.set(s,n=new se(s,e)),this.newest?(this.newest[L]=n,n[D]=this.newest):this.oldest=n,this.newest=n,++this.size,this.size>this.limit&&this.shift(),this)}shift(){const s=this.oldest;if(s)return this.oldest&&this.oldest[L]?(this.oldest=this.oldest[L],this.oldest[D]=void 0):(this.oldest=void 0,this.newest=void 0),s[L]=s[D]=void 0,this._keymap.delete(s.key),--this.size,this._onShiftListeners.forEach(e=>e(s)),[s.key,s.value]}get(s){const e=this._keymap.get(s);if(e)return this._markEntryAsUsed(e),e.value}has(s){return this._keymap.has(s)}find(s){const e=this._keymap.get(s);return e?e.value:void 0}delete(s){const e=this._keymap.get(s);if(e)return this._keymap.delete(e.key),e[L]&&e[D]?(e[D][L]=e[L],e[L][D]=e[D]):e[L]?(e[L][D]=void 0,this.oldest=e[L]):e[D]?(e[D][L]=void 0,this.newest=e[D]):this.oldest=this.newest=void 0,this.size--,e.value}clear(){this.oldest=void 0,this.newest=void 0,this.size=0,this._keymap.clear()}keys(){return new Ls(this.oldest)}values(){return new vs(this.oldest)}entries(){return this[Symbol.iterator]()}[Symbol.iterator](){return new bs(this.oldest)}forEach(s,e){typeof e!="object"&&(e=this);let n=this.oldest;for(;n;)s.call(e,n.value,n.key,this),n=n[L]}toJSON(){const s=new Array(this.size);let e=0,n=this.oldest;for(;n;)s[e++]={key:n.key,value:n.value},n=n[L];return s}toString(){let s="",e=this.oldest;for(;e;)s+=`${String(e.key)}:${e.value}`,e=e[L],e&&(s+=" < ");return s}}function z(t){let s=0;const e=Object.keys(t);for(const n of e){const r=Number(n);s=Math.max(s,r)}return s+1}function ne(t,s,e){const n=z(e),r=e;for(let i=n-1;i>=t;i--)r[i+1]=r[i];r[t]=s}function re(t,s,e){const n=Object.keys(e).reduce((r,i)=>Math.max(r,Number.parseInt(i)),0)+1;for(let r=t;r<n;r++)r<t+s?delete e[r]:e[r]!==void 0&&(e[r-s]=e[r],delete e[r])}function _i(t,s){const e=t,n=Object.keys(e),r=n.length,i=s,o=Object.keys(i),c=o.length,a={};let h=0;for(let u=0;u<r;u++,h++){const d=n[u];a[h]=e[d]}for(let u=0;u<c;u++,h++){const d=o[u];a[h]=i[d]}return a}function di(t,s,e){const n=e;if(z(e)>0){const i={};let o=0;for(let c=t;c<=s;c++)n[c]&&(i[o]=n[c],o++);return i}return{}}function ie(t,s,e,n){const r=t>e;if(!r&&t+s>e)throw new Error("Invalid move operation");r?Ei(t,s,e,n):fi(t,s,e,n)}function Ei(t,s,e,n){const r=n,i=[];for(let o=t;o<t+s;o++)i.push(r[o]);for(let o=t-1;o>=e;o--){const c=r[o];r[o+s]=c,c===void 0&&delete r[o+s]}i.forEach((o,c)=>{r[e+c]=o,o===void 0&&delete r[e+c]})}function fi(t,s,e,n){const r=n,i=[];for(let o=t;o<t+s;o++)i.push(r[o]);for(let o=t+s;o<e;o++){const c=r[o];r[o-s]=c,c===void 0&&delete r[o-s]}i.forEach((o,c)=>{r[e+c-s]=o,o===void 0&&delete r[e+c-s]})}class V{constructor(s={}){_(this,"_matrix");this._setOriginValue(s)}static MakeObjectMatrixSize(s){return new V({[s-1]:{}})}getMatrix(){return this._matrix}forEach(s){const e=this._matrix,n=Object.keys(e);for(const r of n){const i=Number(r),o=e[i];if(s(i,o)===!1)return this}return this}forRow(s){const e=this._matrix,n=Object.keys(e);for(const r of n){const i=Number(r),o=e[i];if(s(i,Object.keys(o).map(a=>Number(a)))===!1)return this}return this}forValue(s){const e=this._matrix,n=Object.keys(e);for(const r of n){const i=Number(r),o=e[i];if(!o)continue;const c=Object.keys(o);for(const a of c){const h=Number(a),u=o[Number(a)];if(s(i,h,u)===!1)return this}}return this}swapRow(s,e){const n=this._matrix[s],r=this._matrix[e];this._matrix[s]=r,this._matrix[e]=n}getRow(s){return this._matrix[s]}getRowOrCreate(s){let e=this.getRow(s);return e==null&&(e={},this._matrix[s]=e),e}reset(){this._setOriginValue({})}hasValue(){const s=this._matrix,e=Object.keys(s);if(e.length===0)return!1;for(const n of e){const r=Number(n),i=s[r];if(Object.keys(i).length>0)return!0}return!1}getValue(s,e){var n,r;return(r=(n=this._matrix)==null?void 0:n[s])==null?void 0:r[e]}setValue(s,e,n){const r=this.getRowOrCreate(s);r[e]=n}deleteValue(s,e){var n,r;(r=(n=this._matrix)==null?void 0:n[s])==null||delete r[e]}realDeleteValue(s,e){var n,r,i;if((r=(n=this._matrix)==null?void 0:n[s])==null||delete r[e],this.getRow(s)){const o=this.getRow(s);if(o==null)return;Object.keys(o).length===0&&((i=this._matrix)==null||delete i[s])}}setRow(s,e){this._matrix[s]=e}moveRows(s,e,n){ie(s,e,n,this._matrix)}moveColumns(s,e,n){this.forEach((r,i)=>{ie(s,e,n,i)})}insertRows(s,e){for(let n=s;n<s+e;n++)ne(n,{},this._matrix)}insertColumns(s,e){for(let n=s;n<s+e;n++)this.forEach((r,i)=>{ne(n,void 0,i)})}removeRows(s,e){re(s,e,this._matrix)}removeColumns(s,e){this.forEach((n,r)=>{re(s,e,r)})}getFragment(s,e,n,r){const i=new V;let o=0;for(let c=s;c<=e;c++){const a={};let h=0;for(let u=n;u<=r;u++){const d=this.getValue(c,u);a[h]=d,h++}i.setRow(o,a),o++}return i}getSlice(s,e,n,r){const i=new V;for(let o=s;o<=e;o++)for(let c=n;c<=r;c++){const a=this.getValue(o,c);a&&i.setValue(o,c,R.deepClone(a))}return i}getSizeOf(){return Object.keys(this._matrix).length}getLength(){return z(this._matrix)}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 a=z(c)-1;r=a>r?a:r}}return{startRow:0,startColumn:0,endRow:n,endColumn:r}}toNativeArray(){const s=new Array;return this.forValue((e,n,r)=>{s.push(r)}),s}toArray(){const s=[];return this.forRow((e,n)=>{s[e]==null&&(s[e]=[]),n.forEach(r=>{s[e][r]=this.getValue(e,r)})}),s}toFullArray(){const s=this.getRange(),{endColumn:e,endRow:n}=s,r=[];for(let i=0;i<=n;i++){const o=Array(e+1).fill(void 0);r.push(o)}return this.forValue((i,o,c)=>{r[i][o]=c}),r}toJSON(){return this._matrix}clone(){const s=JSON.stringify(this._matrix);return JSON.parse(s)}getData(){const s=JSON.stringify(this._matrix);return JSON.parse(s)}getArrayData(){let s=0,e=0,n=!1,r=!1;const i=new V;return this.forEach((o,c)=>{n||(n=!0,s=o),Object.keys(c).forEach(a=>{const h=Number(a);r?h<e&&(e=h):(r=!0,e=h);const u=this.getValue(o,h);i.setValue(o-s,h-e,u)})}),i.getData()}getDataRange(){let s=0,e=0,n=0,r=-1,i=!1,o=!1;return this.forEach((c,a)=>{i||(i=!0,s=c);const h=z(a)-1;h>n&&(n=h),Object.keys(a).forEach(u=>{const d=Number(u);o?d<e&&(e=d):(o=!0,e=d)}),c>r&&(r=c)}),{startRow:s,startColumn:e,endRow:r,endColumn:n}}getDiscreteRanges(){const s=[];return this.forEach((e,n)=>{Object.keys(n).forEach(r=>{const i=Number(r);let o=!1;for(const c of s)if(e>=c.startRow&&e<=c.endRow+1&&i>=c.startColumn&&i<=c.endColumn+1){c.endRow=Math.max(e,c.endRow),c.endColumn=Math.max(i,c.endColumn),o=!0;break}o||s.push({startRow:e,endRow:e,startColumn:i,endColumn:i})})}),s}merge(s){this.forValue((e,n)=>{const r=s.getValue(e,n);r!=null&&this.setValue(e,n,r)})}_setOriginValue(s={}){this._matrix=s}}var oe=(t=>(t.INIT="init",t.FETCHING="fetching",t.DONE="done",t))(oe||{});class ws{constructor(){_(this,"status","init")}}const gi=t=>t.some(s=>s.status==="init")?"init":t.some(s=>s.status==="fetching")?"fetching":"done";class Ri{constructor(s,e){_(this,"_values",[]);_(this,"_keys",[]);_(this,"_keyMaps",new Map);this._values=s,this._keys=e,s.forEach(n=>{this._initKeyMap(n)})}_initKeyMap(s){this._keys.forEach(e=>{const n=s[e],r=this._keyMaps.get(e)||new Map;r.set(n,s),this._keyMaps.set(e,r)})}getValue(s,e){const n=e||this._keys;for(let r=0;r<n.length;r++){const i=this._keyMaps.get(n[r]);if(i!=null&&i.has(s))return i.get(s)}return null}hasValue(s){for(let e=0;e<this._keys.length;e++){const n=this._keyMaps.get(this._keys[e]);if(n!=null&&n.has(s))return!0}return!1}addValue(s){this._values.push(s),this._initKeyMap(s)}setValue(s,e,n){const r=this.getValue(s);r&&Object.keys(r).includes(e)&&(r[e]=n)}deleteValue(s){const e=this.getValue(s);if(e){this._keys.forEach(r=>{const i=this._keyMaps.get(r),o=e[r];i==null||i.delete(o)});const n=this._values.findIndex(r=>r===e);this._values.splice(n,1)}}getValues(){return this._values}getKeyMap(s){var e;return[...((e=this._keyMaps.get(s))==null?void 0:e.keys())||[]]}clear(){this._values=[],this._keys=[],this._keyMaps.clear()}}function ce(t,s,e,n){return{forEach(r){for(let i=t;i<=s;i++)for(let o=e;o<=n;o++)r(i,o)}}}function mi(t){if(t==null||t.length===0)return Number.NaN;const s=t.toLowerCase().split(""),e=s.length,n=o=>o.charCodeAt(0)-96;let r=0,i=0;for(let o=0;o<e;o++)i=n(s[o]),r+=i*26**(e-o-1);return r===0?Number.NaN:r-1}const Ft=65,Ds=90,Oi=97;function Ii(t){const s=Ds-Ft+1;let e="";for(;t>=0;)e=String.fromCharCode(t%s+Ft)+e,t=Math.floor(t/s)-1;return e}function Us(t,s){let e="";for(;s>0;)e+=t,s--;return e}function Ai(t,s=!1){const e=Ds-Ft+1;let n=Oi;s&&(n=Ft);const r=String.fromCharCode(t%e+n),i=Math.floor(t/e)+1;return Us(r,i)}function Ci(t,s){return t.zIndex>s.zIndex?1:t.zIndex===s.zIndex?0:-1}function Ni(t,s){return t.zIndex>s.zIndex?-1:t.zIndex===s.zIndex?0:1}function at(t="index",s=1){return(e,n)=>e[t]>n[t]?s:e[t]===n[t]?0:-s}function Si(t,s){let e;return function(...n){const r=this,i=function(){e=null,t.apply(r,n)};clearTimeout(e),e=setTimeout(i,s)}}const ft={sheetId:"",range:{startRow:-1,endRow:-1,startColumn:-1,endColumn:-1}},Li={startRow:-1,startColumn:-1,endRow:-1,endColumn:-1},vi={startRow:0,startColumn:0,endRow:0,endColumn:0},bi={row:0,column:0},Wt={ff:"Arial",fs:11,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:_t.UNSPECIFIED,cl:{rgb:"#000"},bg:{rgb:"#fff"},ht:et.UNSPECIFIED,vt:ot.UNSPECIFIED,tb:ct.UNSPECIFIED,pd:{t:0,r:0,b:0,l:0}},Ms={id:"default_slide",title:"defaultSlide",pageSize:{width:300,height:300}};var Ps=(t=>(t.ARRAY_CONVERTOR="ARRAY_CONVERTOR",t.MATRIX_CONVERTOR="MATRIX_CONVERTOR",t))(Ps||{});function Bt(t,s){const{textRuns:e=[]}=s;let n=0;for(const i of e){const{ts:o={},st:c,ed:a}=i;if(o[t]==null)return I.FALSE;switch(t){case"bl":case"it":{if(o[t]===I.FALSE)return I.FALSE;break}case"ul":case"st":{if(o[t].s===I.FALSE)return I.FALSE;break}default:throw new Error(`unknown style key: ${t} in IStyleBase`)}n+=a-c}return s.dataStream.indexOf(`\r
4
- `)===n?I.TRUE:I.FALSE}class nt{constructor(s,e,n){_(this,"_range");_(this,"_worksheet");this._deps=n,this._range=e,this._worksheet=s}static foreach(s,e){const{startRow:n,startColumn:r,endRow:i,endColumn:o}=s;for(let c=n;c<=i;c++)for(let a=r;a<=o;a++)e(c,a)}getRangeData(){return this._range}getValue(){return this.getValues()[0][0]}getValues(){const{startRow:s,endRow:e,startColumn:n,endColumn:r}=this._range,i=[];for(let o=s;o<=e;o++){const c=[];for(let a=n;a<=r;a++)c.push(this.getMatrix().getValue(o,a)||null);i.push(c)}return i}getMatrix(){const{startRow:s,endRow:e,startColumn:n,endColumn:r}=this._range,i=this._worksheet.getCellMatrix(),o=new V;for(let c=s;c<=e;c++)for(let a=n;a<=r;a++)o.setValue(c,a,i.getValue(c,a)||null);return o}getMatrixObject(){const{startRow:s,endRow:e,startColumn:n,endColumn:r}=this._range,i=this._worksheet.getCellMatrix(),o=new V;for(let c=s;c<=e;c++)for(let a=n;a<=r;a++)o.setValue(c-s,a-n,i.getValue(c,a)||{});return o}getA1Notation(){const{startRow:s,endRow:e,startColumn:n,endColumn:r}=this._range;let i,o;return n<r?(i=R.numToWord(n+1)+(s+1),o=R.numToWord(r+1)+(e+1)):(i=R.numToWord(r+1)+(e+1),o=R.numToWord(n+1)+(s+1)),i===o?`${i}`:`${i}:${o}`}getBackground(){return this.getBackgrounds()[0][0]}getBackgrounds(){const s=this._deps.getStyles();return this.getValues().map(e=>e.map(n=>{var i;const r=s.getStyleByCell(n);return((i=r==null?void 0:r.bg)==null?void 0:i.rgb)||Wt.bg.rgb}))}getCell(s,e){const{startRow:n,endRow:r,startColumn:i,endColumn:o}=this._range,c={startRow:n+s,endRow:n+s,startColumn:i+e,endColumn:i+e};return new nt(this._worksheet,c,this._deps)}getColumn(){return this._range.startColumn}getObjectValue(s={}){return this.getObjectValues(s)[0][0]}getObjectValues(s={}){var c;const{startRow:e,endRow:n,startColumn:r,endColumn:i}=this._range,o=this._worksheet.getCellMatrix().getFragment(e,n,r,i).getData();if(s.isIncludeStyle){const a=this._deps.getStyles();for(let h=0;h<=n-e;h++)for(let u=0;u<=i-r;u++){if(o==null||((c=o==null?void 0:o[h])==null?void 0:c[u])==null)continue;const d=o[h][u].s;d&&(o[h][u].s=a.get(d))}}return o}getFontColor(){return this.getFontColors()[0][0]}getFontColors(){const s=this._deps.getStyles();return this.getValues().map(e=>e.map(n=>{var i;const r=s.getStyleByCell(n);return((i=r==null?void 0:r.cl)==null?void 0:i.rgb)||Wt.cl.rgb}))}getFontFamilies(){return this._getStyles("ff")}getFontFamily(){return this.getFontFamilies()[0][0]}getUnderlines(){return this._getStyles("ul")}getUnderline(){var e,n;const{p:s}=(e=this.getValue())!=null?e:{};return s&&Array.isArray((n=s.body)==null?void 0:n.textRuns)&&s.body.textRuns.length>0?Bt("ul",s.body)===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 e,n;const{p:s}=(e=this.getValue())!=null?e:{};return s&&Array.isArray((n=s.body)==null?void 0:n.textRuns)&&s.body.textRuns.length>0?Bt("st",s.body)===I.TRUE?{s:I.TRUE}:{s:I.FALSE}:this.getStrikeThroughs()[0][0]}getStrikeThroughs(){return this._getStyles("st")}getFontSize(){var e,n;const{p:s}=(e=this.getValue())!=null?e:{};return s&&Array.isArray((n=s.body)==null?void 0:n.textRuns)&&s.body.textRuns.length>0?s.body.textRuns.some(r=>{var i;return((i=r==null?void 0:r.ts)==null?void 0:i.fs)!=null})?Math.max(...s.body.textRuns.map(r=>{var i;return((i=r==null?void 0:r.ts)==null?void 0:i.fs)||0})):this.getFontSizes()[0][0]:this.getFontSizes()[0][0]}getFontSizes(){return this._getStyles("fs")}getBorder(){return this.getBorders()[0][0]}getBorders(){return this._getStyles("bd")}getFontStyle(){var e,n;const{p:s}=(e=this.getValue())!=null?e:{};return s&&Array.isArray((n=s.body)==null?void 0:n.textRuns)&&s.body.textRuns.length>0?Bt("it",s.body)===I.TRUE?Lt.ITALIC:Lt.NORMAL:this._getFontStyles()[0][0]}_getFontStyles(){return this._getStyles("it")}getFontWeight(){var e,n;const{p:s}=(e=this.getValue())!=null?e:{};return s&&Array.isArray((n=s.body)==null?void 0:n.textRuns)&&s.body.textRuns.length>0?Bt("bl",s.body)===I.TRUE?vt.BOLD:vt.NORMAL:this._getFontWeights()[0][0]}_getFontWeights(){return this._getStyles("bl")}getGridId(){return this._worksheet.getSheetId()}getHeight(){const{_range:s,_worksheet:e}=this,{startRow:n,endRow:r}=s;let i=0;for(let o=0;o<=r-n;o++){const c=e.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:s,endColumn:e}=this._range;return e-s+1}getNumRows(){const{startRow:s,endRow:e}=this._range;return e-s+1}getRichTextValue(){return this.getRichTextValues()[0][0]}getRichTextValues(){return this.getValues().map(s=>s.map(e=>(e==null?void 0:e.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 s=this._deps.getStyles();return this.getValues().map(e=>e.map(n=>s.getStyleByCell(n)))}getVerticalAlignment(){return this.getVerticalAlignments()[0][0]}getVerticalAlignments(){return this._getStyles("vt")}getWidth(){const{_range:s,_worksheet:e}=this,{startColumn:n,endColumn:r}=s;let i=0;for(let o=0;o<=r-n;o++)i+=e.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(s){nt.foreach(this._range,s)}_getStyles(s){const e=this._deps.getStyles();return this.getValues().map(n=>n.map(r=>{const i=e&&e.getStyleByCell(r);return i&&i[s]||Wt[s]}))}}function Ti(t,s){if(t.length===0||t[0].length===0)return null;const e=new Array(t[0].length).fill(0);let n=0,r=null;for(let i=0;i<t.length;i++){for(let c=0;c<t[0].length;c++)e[c]=s(t[i][c])?e[c]+1:0;const o=wi(e);o.area>n&&(n=o.area,r={startColumn:o.start,startRow:i-o.height+1,endColumn:o.end,endRow:i})}return r}function wi(t){const s=[];let e=0,n={area:0,height:0,start:0,end:0},r=0;for(;r<t.length;)if(s.length===0||t[r]>=t[s[s.length-1]])s.push(r++);else{const i=t[s.pop()],o=s.length===0?r:r-s[s.length-1]-1;i*o>e&&(e=i*o,n={area:e,height:i,start:s.length===0?0:s[s.length-1]+1,end:r-1})}for(;s.length>0;){const i=t[s.pop()],o=s.length===0?r:r-s[s.length-1]-1;i*o>e&&(e=i*o,n={area:e,height:i,start:s.length===0?0:s[s.length-1]+1,end:r-1})}return n}function Di(t,s){nt.foreach(s,(e,n)=>{t[e][n]=void 0})}function Ui(t,s){const e=t.toFullArray(),n=[];for(;;){const r=Ti(e,s);if(!r)break;n.push(r),Di(e,r)}return n}var Hs=(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))(Hs||{}),ae=(t=>(t.PARAGRAPH="\r",t.SECTION_BREAK=`
5
- `,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))(ae||{});function le(t){const s=[];for(const e of t){const{st:n,ed:r,ts:i}=e;if(e.sId===void 0&&delete e.sId,n===r||R.isEmptyObject(i)&&e.sId==null)continue;if(s.length===0){s.push(e);continue}const o=s.pop();As(e,o)&&R.hasIntersectionBetweenTwoRanges(o.st,o.ed,e.st,e.ed)?s.push({...e,st:o.st,ed:r}):s.push(o,e)}return s}function Fs(t,s,e,n){var h;const{textRuns:r}=t;if(r==null)return;const i=[],o=r.length;let c=!1;const a=(h=s.textRuns)!=null?h:[];if(a.length)for(let u=0,d=a.length;u<d;u++){const E=a[u];E.st+=n,E.ed+=n}for(let u=0;u<o;u++){const d=r[u],{st:E,ed:f}=d;if(f<n)i.push(d);else if(n>=E&&n<=f)if(c)d.st+=e,d.ed+=e,i.push(d);else{c=!0,d.ed+=e;const g=[];if(a.length){const m={...d,st:E,ed:a[0].st};g.push(m),g.push(...a);const N=a[a.length-1],S={...d,st:N.ed,ed:f+e};g.push(S)}else g.push(d);i.push(...g)}else d.st+=e,d.ed+=e,c||(c=!0,i.push(...a)),i.push(d)}c||(c=!0,i.push(...a)),t.textRuns=le(i)}function ue(t,s,e,n){const{paragraphs:r}=t;if(r==null)return;const{paragraphs:i,dataStream:o}=s,c=[];let a=-1;for(let u=0,d=r.length;u<d;u++){const E=r[u],{startIndex:f}=E;f>=n&&(E.startIndex+=e),a===-1&&f>=n&&(a=u),c.push(E.startIndex)}let h=-1;if(i){for(let u=0,d=i.length;u<d;u++){const E=i[u];E.startIndex+=n;const f=E.startIndex;h=c.indexOf(f)}if(o===ae.PARAGRAPH&&i.length===1){const u=r[a],d=i[0],E=u.paragraphStyle,f=u.bullet;u.paragraphStyle=d.paragraphStyle,u.bullet=d.bullet,d.paragraphStyle=E,d.bullet=f}h!==-1&&r.splice(h,1),r.push(...i),r.sort(at("startIndex"))}}function Mi(t,s,e,n){const{sectionBreaks:r}=t;if(r==null)return;for(let o=0,c=r.length;o<c;o++){const a=r[o],{startIndex:h}=a;h>=n&&(a.startIndex+=e)}const i=s.sectionBreaks;if(i){for(let o=0,c=i.length;o<c;o++){const a=i[o];a.startIndex+=n}r.push(...i),r.sort(at("startIndex"))}}function Ws(t,s,e,n){const{customBlocks:r}=t;if(r==null)return;for(let o=0,c=r.length;o<c;o++){const a=r[o],{startIndex:h}=a;h>=n&&(a.startIndex+=e)}const i=s.customBlocks;if(i){for(let o=0,c=i.length;o<c;o++){const a=i[o];a.startIndex+=n}r.push(...i),r.sort(at("startIndex"))}}function he(t,s,e,n){const{tables:r}=t;if(r==null)return;for(let o=0,c=r.length;o<c;o++){const a=r[o],{startIndex:h,endIndex:u}=a;h>n?(a.startIndex+=e,a.endIndex+=e):u>=n-1&&(a.endIndex+=e)}const i=s.tables;if(i){for(let o=0,c=i.length;o<c;o++){const a=i[o];a.startIndex+=n,a.endIndex+=n}r.push(...i),r.sort(at("startIndex"))}}function Pi(t,s,e,n){const{customRanges:r}=t;if(r==null)return;for(let o=0,c=r.length;o<c;o++){const a=r[o],{startIndex:h,endIndex:u}=a;h>n?(a.startIndex+=e,a.endIndex+=e):u>=n-1&&(a.endIndex+=e)}const i=s.customRanges;if(i){for(let o=0,c=i.length;o<c;o++){const a=i[o];a.startIndex+=n,a.endIndex+=n}r.push(...i),r.sort(at("startIndex"))}}function Bs(t,s,e){const{textRuns:n}=t,r=e,i=e+s,o=[];if(n){const c=[];for(let a=0,h=n.length;a<h;a++){const u=n[a],{st:d,ed:E}=u;if(r<=d&&i>=E){o.push({...u,st:d-r,ed:E-r});continue}else d<=r&&E>=i?(o.push({...u,st:r-r,ed:i-r}),u.ed-=s):r>=d&&r<E?(o.push({...u,st:r-r,ed:E-r}),u.ed=r):i>d&&i<=E?(o.push({...u,st:d-r,ed:i-r}),u.st=i-s,u.ed-=s):d>=i&&(u.st-=s,u.ed-=s);c.push(u)}t.textRuns=c}return o}function ks(t,s,e){const{paragraphs:n}=t,r=e,i=e+s,o=[];if(n){const c=[];for(let a=0,h=n.length;a<h;a++){const u=n[a],{startIndex:d}=u;if(d>=r&&d<i){o.push({...u,startIndex:d-e});continue}else d>=i&&(u.startIndex-=s);c.push(u)}t.paragraphs=c}return o}function Gs(t,s,e){const{sectionBreaks:n}=t,r=e,i=e+s-1,o=[];if(n){const c=[];for(let a=0,h=n.length;a<h;a++){const u=n[a],{startIndex:d}=u;if(d>=r&&d<=i){o.push({...u,startIndex:d-e});continue}else d>i&&(u.startIndex-=s);c.push(u)}t.sectionBreaks=c}return o}function $s(t,s,e){const{customBlocks:n}=t,r=e,i=e+s-1,o=[];if(n){const c=[];for(let a=0,h=n.length;a<h;a++){const u=n[a],{startIndex:d}=u;if(d>=r&&d<=i){o.push({...u,startIndex:d-e});continue}else d>i&&(u.startIndex-=s);c.push(u)}t.customBlocks=c}return o}function Vs(t,s,e){const{tables:n}=t,r=e,i=e+s-1,o=[];if(n){const c=[];for(let a=0,h=n.length;a<h;a++){const u=n[a],{startIndex:d,endIndex:E}=u;if(r<=d&&i>=E){o.push({...u,startIndex:d-e,endIndex:E-e});continue}else if(d<=r&&E>=i){const f=ee(d,E,r,i);u.startIndex=f[0],u.endIndex=f[1]}else i<d&&(u.startIndex-=s,u.endIndex-=s);c.push(u)}t.tables=c}return o}function ps(t,s,e){const{customRanges:n}=t,r=e,i=e+s-1,o=[];if(n){const c=[];for(let a=0,h=n.length;a<h;a++){const u=n[a],{startIndex:d,endIndex:E}=u;if(r<=d&&i>=E){o.push({...u,startIndex:d-e,endIndex:E-e});continue}else if(d<=r&&E>=i){const f=ee(d,E,r,i);u.startIndex=f[0],u.endIndex=f[1]}else i<d&&(u.startIndex-=s,u.endIndex-=s);c.push(u)}t.customRanges=c}return o}function Hi(t,s,e){const{dataStream:n}=t,r=e,i=e+s,o=Bs(t,s,e),c=ks(t,s,e),a=Gs(t,s,e),h=$s(t,s,e),u=Vs(t,s,e),d=ps(t,s,e);let E="";return n&&(t.dataStream=Ss(n,r,i),E=n.slice(r,i)),{dataStream:E,textRuns:o,paragraphs:c,sectionBreaks:a,customBlocks:h,tables:u,customRanges:d}}function Fi(t,s,e,n){t.dataStream=Ns(t.dataStream,n,s.dataStream),Fs(t,s,e,n),ue(t,s,e,n),Mi(t,s,e,n),Ws(t,s,e,n),he(t,s,e,n),Pi(t,s,e,n)}var xs=(t=>(t[t.character=0]="character",t[t.paragraph=1]="paragraph",t[t.table=2]="table",t[t.numbering=3]="numbering",t))(xs||{}),js=(t=>(t[t.TAB=0]="TAB",t[t.SPACE=1]="SPACE",t[t.NOTHING=2]="NOTHING",t))(js||{}),gt=(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))(gt||{}),X=(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))(X||{}),Ks=(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))(Ks||{}),Ys=(t=>(t[t.DRAWING=0]="DRAWING",t[t.CUSTOM=1]="CUSTOM",t))(Ys||{}),zs=(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))(zs||{}),Xs=(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))(Xs||{}),qs=(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))(qs||{}),Qs=(t=>(t[t.NORMAL=0]="NORMAL",t[t.TBRL=1]="TBRL",t[t.LRTBV=2]="LRTBV",t))(Qs||{}),Js=(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))(Js||{}),Zs=(t=>(t[t.BOTH_SIDES=0]="BOTH_SIDES",t[t.LEFT=1]="LEFT",t[t.RIGHT=2]="RIGHT",t[t.LARGEST=3]="LARGEST",t))(Zs||{}),ys=(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))(ys||{}),tn=(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))(tn||{}),en=(t=>(t[t.AUTO=0]="AUTO",t[t.AT_LEAST=1]="AT_LEAST",t[t.EXACT=2]="EXACT",t))(en||{}),sn=(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))(sn||{}),nn=(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))(nn||{}),rn=(t=>(t.EVENLY_DISTRIBUTED="0",t.FIXED_WIDTH="1",t))(rn||{}),on=(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))(on||{}),cn=(t=>(t.NORMAL="normal",t.BOLD="bold",t.ITALIC="italic",t))(cn||{}),an=(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))(an||{}),ln=(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))(ln||{}),un=(t=>(t[t.POINT=0]="POINT",t[t.LINE=1]="LINE",t[t.CHARACTER=2]="CHARACTER",t))(un||{}),hn=(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))(hn||{}),_n=(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))(_n||{}),dn=(t=>(t[t.compressPunctuation=0]="compressPunctuation",t[t.compressPunctuationAndJapaneseKana=1]="compressPunctuationAndJapaneseKana",t[t.doNotCompress=2]="doNotCompress",t))(dn||{}),En=(t=>(t[t.PORTRAIT=0]="PORTRAIT",t[t.LANDSCAPE=1]="LANDSCAPE",t))(En||{}),kt=(t=>(t.BULLET_LIST="BULLET_LIST",t.ORDER_LIST="ORDER_LIST",t))(kt||{});const Wi={BULLET_LIST:{listType:"BULLET_LIST",nestingLevel:[{bulletAlignment:X.START,glyphFormat:" %0",textStyle:{fs:12},startNumber:0,glyphSymbol:"●",hanging:21,indentStart:21},{bulletAlignment:X.START,glyphFormat:" %1",textStyle:{fs:12},startNumber:0,glyphSymbol:"■",hanging:21,indentStart:42},{bulletAlignment:X.START,glyphFormat:" %1",textStyle:{fs:12},startNumber:0,glyphSymbol:"◆",hanging:21,indentStart:63}]},ORDER_LIST:{listType:"ORDER_LIST",nestingLevel:[{bulletAlignment:X.START,glyphFormat:" %1.",textStyle:{fs:12},startNumber:0,glyphType:gt.DECIMAL,hanging:21,indentStart:21},{bulletAlignment:X.START,glyphFormat:" %1.%2)",textStyle:{fs:12},startNumber:0,glyphType:gt.DECIMAL,hanging:21,indentStart:42},{bulletAlignment:X.START,glyphFormat:" %1.%2.%3.",textStyle:{fs:12},startNumber:0,glyphType:gt.DECIMAL,hanging:21,indentStart:63}]}};function Bi(t,s,e,n,r){const i=ki(t,s,e,n,r),o=Gi(t,s,e,n,r),c=$i(t,s,e,n,r),a=Vi(t,s,e,n,r),h=pi(t,s,e,n,r),u=xi(t,s,e,n,r);return{dataStream:"",textRuns:i,paragraphs:o,sectionBreaks:c,customBlocks:a,tables:h,customRanges:u}}function ki(t,s,e,n,r){const{textRuns:i}=t,{textRuns:o}=s;if(i==null||o==null)return;const c=Bs(t,e,n);if(r!==M.REPLACE){const a=fn(o,c,r);s.textRuns=a}return Fs(t,s,e,n),c}function fn(t,s,e){if(s.length===0)return t;t=R.deepClone(t),s=R.deepClone(s);const n=[],r=t.length,i=s.length;let o=0,c=0,a=null;function h(){return a?(n.push(a),a=null,!0):!1}for(;o<r&&c<i;){const{st:f,ed:g,ts:m}=t[o],{st:N,ed:S,ts:F,sId:P}=s[c];let J;e===M.COVER?J={...F,...m}:J={...m,...F},g<N?(h()||n.push(t[o]),o++):S<f?(h()||n.push(s[c]),c++):(n.push({st:Math.min(f,N),ed:Math.max(f,N),ts:f<N?{...m}:{...F},sId:f<N?void 0:P}),n.push({st:Math.max(f,N),ed:Math.min(g,S),ts:J,sId:P}),g<S?(o++,s[c].st=g):(c++,t[o].st=S),a={st:Math.min(g,S),ed:Math.max(g,S),ts:g<S?{...F}:{...m},sId:g<S?P:void 0})}h();const u=n[n.length-1],d=t[r-1],E=s[i-1];return u.ed!==Math.max(d.ed,E.ed)&&(d.ed>E.ed?n.push(d):n.push(E)),le(n)}function Gi(t,s,e,n,r){const{paragraphs:i}=t,{paragraphs:o}=s;if(i==null||o==null)return;const c=ks(t,e,n);if(r!==M.REPLACE){const a=[];for(const h of o){const{startIndex:u,paragraphStyle:d,bullet:E}=h;let f=[];for(const g of c){const{startIndex:m,paragraphStyle:N,bullet:S}=g;let F,P;if(r===M.COVER?(F={...N,...d},P={listId:"",listType:kt.BULLET_LIST,nestingLevel:0,textStyle:{},...S,...E}):(F={...d,...N},P={listId:"",listType:kt.BULLET_LIST,nestingLevel:0,textStyle:{},...E,...S}),u===m){f.push({startIndex:u,paragraphStyle:F,bullet:P});break}}a.push(...f),f=[]}s.paragraphs=a}return ue(t,s,e,n),c}function $i(t,s,e,n,r){const{sectionBreaks:i}=t,{sectionBreaks:o}=s;if(i==null||o==null)return;const c=Gs(t,e,n);if(r!==M.REPLACE){const a=[];for(const h of o){const{startIndex:u}=h;let d=[];for(const E of c){const{startIndex:f}=E;if(u===f){r===M.COVER?d.push({...E,...h}):d.push({...h,...E});break}}a.push(...d),d=[]}s.sectionBreaks=a}return ue(t,s,e,n),c}function Vi(t,s,e,n,r){const{customBlocks:i}=t,{customBlocks:o}=s;if(i==null||o==null)return;const c=$s(t,e,n);if(r!==M.REPLACE){const a=[];for(const h of o){const{startIndex:u}=h;let d=[];for(const E of c){const{startIndex:f}=E;if(u===f){r===M.COVER?d.push({...E,...h}):d.push({...h,...E});break}}a.push(...d),d=[]}s.customBlocks=a}return Ws(t,s,e,n),c}function pi(t,s,e,n,r){const{tables:i}=t,{tables:o}=s;if(i==null||o==null)return;const c=Vs(t,e,n);if(r!==M.REPLACE){const a=[];for(const h of o){const{startIndex:u,endIndex:d}=h;let E=[];for(const f of c){const{startIndex:g,endIndex:m}=f;if(g>=u&&m<=d){r===M.COVER?E.push({...f,...h}):E.push({...h,...f});break}}a.push(...E),E=[]}s.tables=a}return he(t,s,e,n),c}function xi(t,s,e,n,r){const{customRanges:i}=t,{tables:o}=s;if(i==null||o==null)return;const c=ps(t,e,n);if(r!==M.REPLACE){const a=[];for(const h of o){const{startIndex:u,endIndex:d}=h;let E=[];for(const f of c){const{startIndex:g,endIndex:m}=f;if(g>=u&&m<=d){r===M.COVER?E.push({...f,...h}):E.push({...h,...f});break}}a.push(...E),E=[]}s.customRanges=a}return he(t,s,e,n),c}var C=(t=>(t.RETAIN="r",t.INSERT="i",t.DELETE="d",t))(C||{});function _e(t,s,e){const{dataStream:n,textRuns:r=[],paragraphs:i=[]}=t,o={dataStream:n.slice(s,e)},c=[];for(const h of r){const u=R.deepClone(h),{st:d,ed:E}=u;R.hasIntersectionBetweenTwoRanges(d,E,s,e)&&(s>=d&&s<=E?c.push({...u,st:s,ed:Math.min(e,E)}):e>=d&&e<=E?c.push({...u,st:Math.max(s,d),ed:e}):c.push(u))}c.length&&(o.textRuns=c.map(h=>{const{st:u,ed:d}=h;return{...h,st:u-s,ed:d-s}}));const a=[];for(const h of i){const{startIndex:u}=h;u>=s&&u<=e&&a.push(R.deepClone(h))}return a.length&&(o.paragraphs=a.map(h=>({...h,startIndex:h.startIndex-s}))),o}function de(t,s,e=M.COVER){if(s.dataStream!=="")throw new Error("Cannot compose other body with non-empty dataStream");const n={dataStream:t.dataStream},{textRuns:r=[],paragraphs:i=[]}=t,{textRuns:o=[],paragraphs:c=[]}=s,a=fn(o,r,e);a.length&&(n.textRuns=a);const h=[];let u=0,d=0;for(;u<i.length&&d<c.length;){const E=i[u],f=c[d],{startIndex:g}=E,{startIndex:m}=f;g===m?(h.push(R.deepMerge(E,f)),u++,d++):g<m?(h.push(R.deepClone(E)),u++):(h.push(R.deepClone(f)),d++)}return u<i.length&&h.push(...i.slice(u)),d<c.length&&h.push(...c.slice(d)),h.length&&(n.paragraphs=h),n}function ji(t){const{body:s}=t;if(s==null)return!0;const{textRuns:e=[],paragraphs:n=[]}=s;return e.length===0&&n.length===0}function Ki(t=R.generateRandomId(6),s=tt.EN_US,e=""){return{id:t,locale:s,title:e,body:{dataStream:`\r
6
- `,textRuns:[],paragraphs:[{startIndex:0,paragraphStyle:{spaceAbove:5,lineSpacing:1,spaceBelow:0}}],sectionBreaks:[{startIndex:1}]},documentStyle:{pageSize:{width:793.3333333333334,height:1122.6666666666667},marginTop:50,marginBottom:50,marginRight:40,marginLeft:40,renderConfig:{vertexAngle:0,centerAngle:0}},settings:{}}}const Ee={id:"default_doc",documentStyle:{}};class Yi{constructor(s){_(this,"snapshot");this.snapshot={...Ee,...s}}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 s;return((s=this.snapshot.settings)==null?void 0:s.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(s){this.snapshot.id=s}updateDocumentRenderConfig(s){const{documentStyle:e}=this.snapshot;e.renderConfig==null?e.renderConfig=s:e.renderConfig={...e.renderConfig,...s}}updateDocumentStyle(s){this.snapshot.documentStyle==null?this.snapshot.documentStyle=s:this.snapshot.documentStyle={...this.snapshot.documentStyle,...s}}updateDocumentDataMargin(s){const{t:e,l:n,b:r,r:i}=s,{documentStyle:o}=this.snapshot;e!=null&&(o.marginTop=e),n!=null&&(o.marginLeft=n),r!=null&&(o.marginBottom=r),i!=null&&(o.marginRight=i)}updateDocumentDataPageSize(s,e){const{documentStyle:n}=this.snapshot;if(!n.pageSize){s=s!=null?s:Number.POSITIVE_INFINITY,e=e!=null?e:Number.POSITIVE_INFINITY,n.pageSize={width:s,height:e};return}s!==void 0&&(n.pageSize.width=s),e!==void 0&&(n.pageSize.height=e)}updateDrawing(s,e){const{drawings:n}=this,{width:r,height:i,left:o,top:c}=e,a=n==null?void 0:n[s];if(!a)return;const h=a.objectTransform;h.size.width=r,h.size.height=i,h.positionH.posOffset=o,h.positionV.posOffset=c}setZoomRatio(s=1){this.snapshot.settings==null?this.snapshot.settings={zoomRatio:s}:this.snapshot.settings.zoomRatio=1}}class rt extends Yi{constructor(e){var r;super(R.isEmptyObject(e)?Ki():e);_(this,"_unitId");_(this,"headerModelMap",new Map);_(this,"footerModelMap",new Map);const n=6;this._unitId=(r=this.snapshot.id)!=null?r:R.generateRandomId(n),this._initializeHeaderFooterModel()}dispose(){this.headerModelMap.forEach(e=>{e.dispose()}),this.footerModelMap.forEach(e=>{e.dispose()})}getRev(){var e;return(e=this.snapshot.rev)!=null?e:1}incrementRev(){this.snapshot.rev=this.getRev()+1}getSettings(){return this.snapshot.settings}reset(e){if(e.id&&e.id!==this._unitId)throw new Error("Cannot reset a document model with a different unit id!");this.snapshot={...Ee,...e},this._initializeHeaderFooterModel()}getSelfOrHeaderFooterModel(e){if(e!=null){if(this.headerModelMap.has(e))return this.headerModelMap.get(e);if(this.footerModelMap.has(e))return this.footerModelMap.get(e)}return this}getUnitId(){return this._unitId}apply(e){const n=[],r=new es;return r.reset(),e.forEach(i=>{if(i=R.deepClone(i),i.t===C.RETAIN){const{coverType:o,body:c,len:a,segmentId:h}=i;if(c!=null){const u=this._updateApply(c,a,r.cursor,o,h);n.push({...i,t:C.RETAIN,coverType:M.REPLACE,body:u})}else n.push({...i,t:C.RETAIN});r.moveCursor(a)}else if(i.t===C.INSERT){const{body:o,len:c,segmentId:a,line:h}=i;this._insertApply(o,c,r.cursor,a),r.moveCursor(c),n.push({t:C.DELETE,len:c,line:h,segmentId:a})}else if(i.t===C.DELETE){const{len:o,segmentId:c}=i,a=this._deleteApply(o,r.cursor,c);n.push({...i,t:C.INSERT,body:a})}else throw new Error(`Unknown action type for action: ${i}.`)}),n}sliceBody(e,n){const r=this.getBody();if(r!=null)return _e(r,e,n)}_updateApply(e,n,r,i=M.COVER,o){if(e==null)throw new Error("updateBody is none");const c=this.snapshot,a=Ht(c,o);if(a==null)throw new Error("no body has changed");return Bi(a,e,n,r,i)}_deleteApply(e,n,r){const i=this.snapshot,o=Ht(i,r);if(o==null)throw new Error("no body has changed");return e<=0?{dataStream:""}:Hi(o,e,n)}_insertApply(e,n,r,i){const o=this.snapshot,c=Ht(o,i);if(n!==0){if(c==null)throw new Error("no body has changed");Fi(c,e,n,r)}}_initializeHeaderFooterModel(){const{headers:e,footers:n}=this.getSnapshot();if(e)for(const r in e){const i=e[r];this.headerModelMap.set(r,new rt(i))}if(n)for(const r in n){const i=n[r];this.footerModelMap.set(r,new rt(i))}}updateDocumentId(e){super.updateDocumentId(e),this._unitId=e}}class gn{constructor(s={}){_(this,"_styles");_(this,"_cacheMap",new Ts(1e5));this._styles=s,this._generateCacheMap()}each(s){return Object.entries(this._styles).forEach(s),this}search(s,e){if(this._cacheMap.has(e))return this._cacheMap.get(e);const n=this._getExistingStyleId(s);return n||"-1"}get(s){return typeof s!="string"?s:(s=String(s),this._styles[s])}add(s,e){const n=R.generateRandomId(6);return this._styles[n]=s,this._cacheMap.set(e,n),n}setValue(s){if(s==null)return;const e=JSON.stringify(s),n=this.search(s,e);return n!=="-1"?n:this.add(s,e)}toJSON(){return this._styles}getStyleByCell(s){let e;s&&R.isObject(s.s)?e=s.s:e=(s==null?void 0:s.s)&&this.get(s.s);const n=s==null?void 0:s.interceptorStyle;return n?{...e,...n}:e}_generateCacheMap(){const{_styles:s,_cacheMap:e}=this;for(const n in s){const r=JSON.stringify(s[n]);e.set(r,n)}}_getExistingStyleId(s){const{_styles:e}=this;for(const n in e)if(R.diffValue(e[n],s))return n;return null}}var k=(t=>(t[t.UNDEFINED=0]="UNDEFINED",t[t.OK=1]="OK",t[t.INTERNAL_ERROR=2]="INTERNAL_ERROR",t[t.PERMISSION_DENIED=3]="PERMISSION_DENIED",t[t.NOT_FOUND=4]="NOT_FOUND",t[t.UNAUTHENTICATED=5]="UNAUTHENTICATED",t[t.ALREADY_EXISTS=6]="ALREADY_EXISTS",t[t.INVALID_ARGUMENT=7]="INVALID_ARGUMENT",t[t.TOO_MANY_REQUESTS=8]="TOO_MANY_REQUESTS",t[t.CHANGESET_REVISION_CONFILICT=5001]="CHANGESET_REVISION_CONFILICT",t[t.SNAPSHOT_INVALID_SNAPSHOT=6001]="SNAPSHOT_INVALID_SNAPSHOT",t[t.APPLY_REJECT=7001]="APPLY_REJECT",t[t.APPLY_NON_SEQUENTIAL_REVISION=7002]="APPLY_NON_SEQUENTIAL_REVISION",t[t.APPLY_REVISION_CONFILICT=7003]="APPLY_REVISION_CONFILICT",t[t.CONNECTOR_DATA_TOO_LARGE=8001]="CONNECTOR_DATA_TOO_LARGE",t[t.LICENSE_MAX_UNITS_EXCEEDED=9001]="LICENSE_MAX_UNITS_EXCEEDED",t[t.LICENSE_MAX_MEMBERS_PER_UNIT_EXCEEDED=9002]="LICENSE_MAX_MEMBERS_PER_UNIT_EXCEEDED",t[t.LICENSE_IMPORT_SIZE_EXCEEDED=9003]="LICENSE_IMPORT_SIZE_EXCEEDED",t[t.LICENSE_EXPORT_SIZE_EXCEEDED=9004]="LICENSE_EXPORT_SIZE_EXCEEDED",t[t.LICENSE_DISTRO_REJECTED=9005]="LICENSE_DISTRO_REJECTED",t[t.UNRECOGNIZED=-1]="UNRECOGNIZED",t))(k||{});function Rn(t){return!!(t&&t.code&&t.code!==k.OK&&t.code!=="OK")}var j=(t=>(t[t.UNIVER_UNKNOWN=0]="UNIVER_UNKNOWN",t[t.UNIVER_DOC=1]="UNIVER_DOC",t[t.UNIVER_SHEET=2]="UNIVER_SHEET",t[t.UNIVER_SLIDE=3]="UNIVER_SLIDE",t[t.UNRECOGNIZED=-1]="UNRECOGNIZED",t))(j||{}),fe=(t=>(t[t.UNKNOWN=0]="UNKNOWN",t[t.STRING=1]="STRING",t[t.NUMBER=2]="NUMBER",t[t.BOOLEAN=3]="BOOLEAN",t[t.FORCE_STRING=4]="FORCE_STRING",t[t.UNRECOGNIZED=-1]="UNRECOGNIZED",t))(fe||{});function zi(t){return t&&(t.s!==void 0||t.p!==void 0||t.v!==void 0||t.t!==void 0||t.f!==void 0||t.si!==void 0)}function Xi(t){if(t.t!==void 0)return t.t;if(typeof t.v=="string")return dt.STRING;if(typeof t.v=="number")return dt.NUMBER;if(typeof t.v=="boolean")return dt.BOOLEAN}function qi(t){if(t==null)return!0;const{v:s,f:e,si:n,p:r,s:i}=t;return!(!(s==null||typeof s=="string"&&s.length===0)||e!=null&&e.length>0||n!=null&&n.length>0||r!=null)}function Qi(t){return t!=null&&(typeof t=="string"||typeof t=="number"||typeof t=="boolean")}var ge=(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))(ge||{}),mn=(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))(mn||{}),On=(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))(On||{});class Ji{constructor(s,e){_(this,"_columnData",{});this._config=s,this._columnData=e}getColumnData(){return this._columnData}getColVisible(s){const{_columnData:e}=this,n=e[s];return n?n.hd!==I.TRUE:!0}getHiddenCols(s=0,e=this.getSize()-1){const n=[];let r=!1,i=-1;for(let o=s;o<=e;o++){const c=this.getColVisible(o);r&&c?(r=!1,n.push({rangeType:W.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:e,rangeType:W.COLUMN}),n}getVisibleCols(s=0,e=this.getSize()-1){const n=[];let r=!1,i=-1;for(let o=s;o<=e;o++){const c=this.getColVisible(o);r&&!c?(r=!1,n.push({rangeType:W.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:e,rangeType:W.COLUMN}),n}getColumnDatas(s,e){const n={};let r=0;for(let i=s;i<s+e;i++){const o=this.getColumnOrCreate(i);n[r]=o,r++}return n}getSize(){return z(this._columnData)}getColumnWidth(s){const{_columnData:e}=this,n=this._config;let r=0;return r=(e[s]||{hd:I.FALSE,w:n.defaultColumnWidth}).w||n.defaultColumnWidth,r}getColumn(s){const e=this._columnData[s];if(e)return e}getColumnOrCreate(s){const{_columnData:e}=this,n=this._config,r=e[s];if(r)return r;const i={w:n.defaultColumnWidth,hd:I.FALSE};return this._columnData[s]=i,i}}class Zi{constructor(s,e){_(this,"_rowData");this._config=s,this._rowData=e}getRowData(){return this._rowData}getRowDatas(s,e){const n={};let r=0;for(let i=s;i<s+e;i++){const o=this.getRowOrCreate(i);n[r]=o,r++}return n}getRowHeight(s,e=1){const{_rowData:n}=this,r=this._config;let i=0;for(let o=0;o<e;o++){const c=n[o+s]||{hd:I.FALSE,h:r.defaultRowHeight},{ia:a,ah:h,h:u=r.defaultRowHeight}=c;i+=(a==null||a===I.TRUE)&&typeof h=="number"?h:u}return i}getRow(s){return this._rowData[s]}getRowOrCreate(s){const{_rowData:e}=this,n=e[s];if(n)return n;const r=this._config,i={hd:I.FALSE,h:r.defaultRowHeight};return e[s]=i,i}getHiddenRows(s=0,e=this.getSize()-1){const n=[];let r=!1,i=-1;for(let o=s;o<=e;o++){const c=this.getRowVisible(o);r&&c?(r=!1,n.push({startRow:i,endRow:o-1,startColumn:0,endColumn:0,rangeType:W.ROW})):!r&&!c&&(r=!0,i=o)}return r&&n.push({startRow:i,endRow:e,startColumn:0,endColumn:0,rangeType:W.ROW}),n}getVisibleRows(s=0,e=this.getSize()-1){const n=[];let r=!1,i=-1;for(let o=s;o<=e;o++){const c=this.getRowVisible(o);r&&!c?(r=!1,n.push({startRow:i,endRow:o-1,startColumn:0,endColumn:0,rangeType:W.ROW})):!r&&c&&(r=!0,i=o)}return r&&n.push({startRow:i,endRow:e,startColumn:0,endColumn:0,rangeType:W.ROW}),n}getRowVisible(s){const e=this.getRow(s);return e?e.hd!==I.TRUE:!0}getSize(){return z(this._rowData)}}const yi="DEFAULT_WORKSHEET_ROW_COUNT",In=1e3,to="DEFAULT_WORKSHEET_COLUMN_COUNT",An=20,eo="DEFAULT_WORKSHEET_ROW_HEIGHT",Cn=19,so="DEFAULT_WORKSHEET_COLUMN_WIDTH",Nn=73,no="DEFAULT_WORKSHEET_ROW_TITLE_WIDTH",Sn=46,ro="DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT",Ln=20;function vn(t){const s={name:"Sheet1",id:"sheet-01",tabColor:"",hidden:I.FALSE,rowCount:In,columnCount:An,zoomRatio:1,freeze:{xSplit:0,ySplit:0,startRow:-1,startColumn:-1},scrollTop:0,scrollLeft:0,defaultColumnWidth:Nn,defaultRowHeight:Cn,mergeData:[],cellData:{},rowData:{},columnData:{},showGridlines:I.TRUE,rowHeader:{width:Sn,hidden:I.FALSE},columnHeader:{height:Ln,hidden:I.FALSE},selections:["A1"],rightToLeft:I.FALSE};return Object.keys(s).forEach(e=>{const n=e;typeof t[n]>"u"&&(t[n]=s[n])}),t}class bn extends U{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(e,n){for(const r of this._cellContentInterceptors){const i=r.getCell(e,n);if(typeof i<"u")return i}return null}registerCellContentInterceptor(e){if(this._cellContentInterceptors.includes(e))throw new Error("[SheetViewModel]: Interceptor already registered.");return this._cellContentInterceptors.push(e),b(()=>K(this._cellContentInterceptors,e))}registerRowFilteredInterceptor(e){if(this._rowFilteredInterceptors.includes(e))throw new Error("[SheetViewModel]: Interceptor already registered.");return this._rowFilteredInterceptors.push(e),b(()=>K(this._rowFilteredInterceptors,e))}registerRowVisibleInterceptor(e){if(this._rowVisibleInterceptors.includes(e))throw new Error("[SheetViewModel]: Interceptor already registered.");return this._rowVisibleInterceptors.push(e),b(()=>K(this._rowVisibleInterceptors,e))}registerColVisibleInterceptor(e){if(this._colVisibleInterceptors.includes(e))throw new Error("[SheetViewModel]: Interceptor already registered.");return this._colVisibleInterceptors.push(e),b(()=>K(this._colVisibleInterceptors,e))}}class Rt{constructor(s,e){_(this,"_sheetId");_(this,"_snapshot");_(this,"_cellData");_(this,"_rowManager");_(this,"_columnManager");_(this,"_viewModel");var o;this._styles=e,this._snapshot=vn(s);const{columnData:n,rowData:r,cellData:i}=this._snapshot;this._sheetId=(o=this._snapshot.id)!=null?o:R.generateRandomId(6),this._cellData=new V(i),this._rowManager=new Zi(this._snapshot,r),this._columnManager=new Ji(this._snapshot,n),this._viewModel=new bn}__interceptViewModel(s){s(this._viewModel)}getSnapshot(){return this._snapshot}getCellMatrix(){return this._cellData}getCellMatrixPrintRange(){const s=this.getCellMatrix(),e=this.getMergeData();let n=-1,r=-1,i=-1,o=-1,c=!1,a=!1;return s.forEach((h,u)=>{Object.keys(u).forEach(d=>{const E=+d,f=s.getValue(h,E),g=f!=null&&f.s?this._styles.get(f.s):null,m=(g==null?void 0:g.bd)&&(g.bd.b||g.bd.l||g.bd.r||g.bd.t||g.bd.bc_tr||g.bd.bl_tr||g.bd.ml_tr||g.bd.tl_bc||g.bd.tl_br||g.bd.tl_mr);(f&&(f.v||f.p)||g!=null&&g.bg||m)&&(c?n=Math.min(n,h):(n=h,c=!0),r=Math.max(r,h),a?i=Math.min(i,E):(a=!0,i=E),o=Math.max(o,E))})}),e.forEach(h=>{c?n=Math.min(n,h.startRow):(n=h.startRow,c=!0),r=Math.max(r,h.endRow),a?i=Math.min(i,h.startColumn):(i=h.startColumn,c=!0),o=Math.max(o,h.endColumn)}),!c||!a?null:{startColumn:i,startRow:n,endColumn:o,endRow:r}}getRowManager(){return this._rowManager}getSheetId(){return this._sheetId}getColumnManager(){return this._columnManager}getName(){return this._snapshot.name}clone(){const{_snapshot:s}=this,e=R.deepClone(s);return new Rt(e,this._styles)}getMergeData(){return this._snapshot.mergeData}getMergedCell(s,e){const n=this._snapshot.mergeData;for(let r=0;r<n.length;r++){const i=n[r];if(Z.intersects({startRow:s,startColumn:e,endRow:s,endColumn:e},i))return i}return null}getCell(s,e){return s<0||e<0?null:this._viewModel.getCell(s,e)}getCellRaw(s,e){return this.getCellMatrix().getValue(s,e)}getMatrixWithMergedCells(s,e,n,r){const i=this.getCellMatrix(),o=this._snapshot.mergeData.filter(a=>Z.intersects({startRow:s,startColumn:e,endRow:n,endColumn:r},a)),c=new V;return ce(s,n,e,r).forEach((a,h)=>{const u=i.getValue(a,h);u&&c.setValue(a,h,u)}),o.forEach(a=>{const{startColumn:h,startRow:u,endColumn:d,endRow:E}=a;ce(u,E,h,d).forEach((f,g)=>{f===u&&g===h&&c.setValue(f,g,{...i.getValue(f,g),rowSpan:E-u+1,colSpan:d-h+1}),(f!==u||g!==h)&&c.realDeleteValue(f,g)})}),c}getRange(s,e,n,r){return typeof s=="object"?new nt(this,s,{getStyles:()=>this._styles}):new nt(this,{startRow:s,startColumn:e,endColumn:r||e,endRow:n||s},{getStyles:()=>this._styles})}getZoomRatio(){return this._snapshot.zoomRatio||1}getConfig(){return this._snapshot}getFreeze(){return this._snapshot.freeze}getMaxColumns(){const{_snapshot:s}=this,{columnCount:e}=s;return e}getMaxRows(){const{_snapshot:s}=this,{rowCount:e}=s;return e}getRowCount(){return this._snapshot.rowCount}setRowCount(s){this._snapshot.rowCount=s}getColumnCount(){return this._snapshot.columnCount}setColumnCount(s){this._snapshot.columnCount=s}isSheetHidden(){return this._snapshot.hidden}hasHiddenGridlines(){const{_snapshot:s}=this,{showGridlines:e}=s;return e===0}getTabColor(){const{_snapshot:s}=this,{tabColor:e}=s;return e}getColumnWidth(s){return this.getColumnManager().getColumnWidth(s)}getRowHeight(s){return this.getRowManager().getRowHeight(s)}getRowVisible(s){return this.getRowManager().getRowVisible(s)}getHiddenRows(s,e){const n=this.getMaxColumns()-1,r=this._rowManager.getHiddenRows(s,e);return r.forEach(i=>i.endColumn=n),r}getColVisible(s){return this._columnManager.getColVisible(s)}getHiddenCols(s,e){const n=this.getMaxRows()-1,r=this._columnManager.getHiddenCols(s,e);return r.forEach(i=>i.endRow=n),r}getVisibleRows(){const s=this.getRowCount();return this._rowManager.getVisibleRows(0,s-1)}getVisibleCols(){const s=this.getColumnCount();return this._columnManager.getVisibleCols(0,s-1)}isRightToLeft(){const{_snapshot:s}=this,{rightToLeft:e}=s;return e}getLastRowWithContent(){return this._cellData.getLength()-1}getLastColumnWithContent(){return this._cellData.getRange().endColumn}cellHasValue(s){return s&&(s.v!==void 0||s.f!==void 0||s.p!==void 0)}iterateByRow(s){const{startRow:e,startColumn:n,endRow:r,endColumn:i}=s,o=this;let c=e,a=n;return{next(){for(;;){if(a>i&&(c+=1,a=n),c>r)return{done:!0,value:void 0};const h=o.getCell(c,a),u=o.getMergedCell(c,a);if(u&&(!h||c!==u.startRow||a!==u.startColumn))a=u.endColumn+1;else if(!h)a+=1;else{const d={row:c,col:a,value:h};return u&&(d.colSpan=u.endColumn-u.startColumn+1,d.rowSpan=u.endRow-u.startRow+1),a+=1,{done:!1,value:d}}}}}}iterateByColumn(s){const{startRow:e,startColumn:n,endRow:r,endColumn:i}=s,o=this;let c=e,a=n;return{next(){for(;;){if(c>r&&(a+=1,c=e),a>i)return{done:!0,value:void 0};const h=o.getCell(c,a),u=o.getMergedCell(c,a);if(u&&(!h||c!==u.startRow||a!==u.startColumn))c=u.endRow+1;else if(!h)c+=1;else{const d={row:c,col:a,value:h};return u&&(d.colSpan=u.endColumn-u.startColumn+1,d.rowSpan=u.endRow-u.startRow+1),c+=1,{done:!1,value:d}}}}}}}function io(t){var n,r;const s=(r=(n=t.p)==null?void 0:n.body)==null?void 0:r.dataStream;if(s)return s;const e=t.v;return typeof e=="string"?t.t===fe.BOOLEAN?e.toUpperCase():e:typeof e=="number"?t.t===fe.BOOLEAN?e?"TRUE":"FALSE":e.toString():typeof e=="boolean"?e?"TRUE":"FALSE":""}const oo="0.1.7";function co(t="",s=tt.ZH_CN,e=""){return{id:t,sheetOrder:[],name:e,appVersion:oo,locale:s,styles:{},sheets:{},resources:[]}}var ao=Object.defineProperty,lo=Object.getOwnPropertyDescriptor,uo=(t,s,e,n)=>{for(var r=n>1?void 0:n?lo(s,e):s,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(s,e,r):o(r))||r);return n&&r&&ao(s,e,r),r},ho=(t,s)=>(e,n)=>s(e,n,t);function _o(t,s){return`${t.getUnitId()}|${s.getSheetId()}`}l.Workbook=class extends U{constructor(e={},n){super();_(this,"_sheetCreated$",new A.Subject);_(this,"sheetCreated$",this._sheetCreated$.asObservable());_(this,"_sheetDisposed$",new A.Subject);_(this,"sheetDisposed$",this._sheetDisposed$.asObservable());_(this,"_activeSheet$",new A.BehaviorSubject(null));_(this,"activeSheet$",this._activeSheet$.asObservable());_(this,"_worksheets");_(this,"_styles");_(this,"_snapshot");_(this,"_unitId");_(this,"_count");this._logService=n;const r=co();R.isEmptyObject(e)?this._snapshot=r:this._snapshot=R.commonExtend(r,e);const{styles:i}=this._snapshot;(this._snapshot.id==null||this._snapshot.id.length===0)&&(this._snapshot.id=R.generateRandomId(6)),this._unitId=this._snapshot.id,this._styles=new gn(i),this._count=1,this._worksheets=new Map,this._passWorksheetSnapshots()}get _activeSheet(){return this._activeSheet$.getValue()}get name(){return this._snapshot.name}dispose(){super.dispose(),this._sheetCreated$.complete(),this._sheetDisposed$.complete(),this._activeSheet$.complete()}save(){return R.deepClone(this._snapshot)}static isIRangeType(e){return typeof e=="string"||"startRow"in e||"row"in e}getSnapshot(){return this._snapshot}getName(){return this._snapshot.name}getUnitId(){return this._unitId}getRev(){var e;return(e=this._snapshot.rev)!=null?e:1}incrementRev(){this._snapshot.rev=this.getRev()+1}getShouldRenderLoopImmediately(){return this._snapshot.shouldStartRenderingImmediately!==!1}getContainer(){return this._snapshot.container}addWorksheet(e,n,r){const{sheets:i,sheetOrder:o}=this._snapshot;if(i[e])return!1;i[e]=r,o.splice(n,0,e);const c=new Rt(r,this._styles);return this._worksheets.set(e,c),this._sheetCreated$.next(c),!0}getParentRenderUnitId(){return this._snapshot.parentRenderUnitId}getSheetOrders(){return this._snapshot.sheetOrder}getWorksheets(){return this._worksheets}getActiveSpreadsheet(){return this}getStyles(){return this._styles}getConfig(){return this._snapshot}getIndexBySheetId(e){const{sheetOrder:n}=this._snapshot;return n.findIndex(r=>r===e)}getRawActiveSheet(){return this._activeSheet}getActiveSheet(){const e=this.getRawActiveSheet();if(e)return e;const n=this._snapshot.sheetOrder;for(let i=0,o=n.length;i<o;i++){const c=this._worksheets.get(n[i]);if(c&&c.isSheetHidden()!==I.TRUE)return this.setActiveSheet(c),c}const r=this._worksheets.get(n[0]);return this.setActiveSheet(r),r}setActiveSheet(e){this._activeSheet$.next(e)}removeSheet(e){var r;return this._worksheets.get(e)?(((r=this._activeSheet)==null?void 0:r.getSheetId())===e&&this.setActiveSheet(null),this._worksheets.delete(e),this._snapshot.sheetOrder.splice(this._snapshot.sheetOrder.indexOf(e),1),delete this._snapshot.sheets[e],!0):!1}getActiveSheetIndex(){const{sheetOrder:e}=this._snapshot;return e.findIndex(n=>this._worksheets.get(n)===this._activeSheet)}getSheetSize(){return this._snapshot.sheetOrder.length}getSheets(){const{sheetOrder:e}=this._snapshot;return e.map(n=>this._worksheets.get(n))}getSheetsName(){const{sheetOrder:e}=this._snapshot,n=[];return e.forEach(r=>{const i=this._worksheets.get(r);i&&n.push(i.getName())}),n}getSheetIndex(e){const{sheetOrder:n}=this._snapshot;return n.findIndex(r=>e.getSheetId()===r)}getSheetBySheetName(e){const{sheetOrder:n}=this._snapshot,r=n.find(i=>this._worksheets.get(i).getName()===e);return this._worksheets.get(r)}getSheetBySheetId(e){return this._worksheets.get(e)}getSheetByIndex(e){const{sheetOrder:n}=this._snapshot;return this._worksheets.get(n[e])}getHiddenWorksheets(){return this.getSheets().filter(e=>e.getConfig().hidden===I.TRUE).map(e=>e.getConfig().id)}transformRangeType(e){if(typeof e=="string")return this._getCellRange(e);if(typeof e!="string"&&"row"in e){const n=e;return{sheetId:"",range:{startRow:n.row[0],startColumn:n.column[0],endRow:n.row[1],endColumn:n.column[1]}}}return typeof e!="string"&&"startRow"in e?{sheetId:"",range:e}:ft}load(e){this._snapshot=e}checkSheetName(e){return this.getSheetsName().includes(e)}uniqueSheetName(e="Sheet1"){let n=e;for(;this.checkSheetName(n);)n=e+this._count,this._count++;return n}generateNewSheetName(e){let n=e+this._count;for(;this.checkSheetName(n);)n=e+this._count,this._count++;return n}_getCellRange(e){var u,d,E,f,g;let n="",r="";if(e.indexOf("!")>-1){const m=e.split("!");n=m[0],r=m[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=e;if(r.indexOf(":")===-1){const m=Number.parseInt(r.replace(/[^0-9]/g,""),10)-1,N=R.ABCatNum(r.replace(/[^A-Za-z]/g,""));return!Number.isNaN(m)&&!Number.isNaN(N)?{sheetId:n,range:{startRow:m,endRow:m,startColumn:N,endColumn:N}}:ft}r=r.split(":");const i=[0,0],o=[0,0],c=((u=this.getSheetBySheetName(n))==null?void 0:u.getMaxRows())||((d=this.getActiveSheet())==null?void 0:d.getMaxRows()),a=((E=this.getSheetBySheetName(n))==null?void 0:E.getMaxColumns())||((f=this.getActiveSheet())==null?void 0:f.getMaxColumns());return i[0]=Number.parseInt(r[0].replace(/[^0-9]/g,""),10)-1,i[1]=Number.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]=R.ABCatNum(r[0].replace(/[^A-Za-z]/g,"")),o[1]=R.ABCatNum(r[1].replace(/[^A-Za-z]/g,"")),Number.isNaN(o[0])&&(o[0]=0),Number.isNaN(o[1])&&(o[1]=a),o[0]>o[1])?ft:{sheetId:((g=this.getSheetBySheetName(n))==null?void 0:g.getSheetId())||"",range:{startRow:i[0],endRow:i[1],startColumn:o[0],endColumn:o[1]}}}_passWorksheetSnapshots(){const{_snapshot:e,_worksheets:n}=this,{sheets:r,sheetOrder:i}=e;if(R.isEmptyObject(r)){const o=R.generateRandomId();r[o]={id:o}}for(const o in r){const c=r[o],{name:a}=c;c.name=this.uniqueSheetName(a),c.name!==a&&this._logService.debug("[Workbook]",`The worksheet name ${a} is duplicated, we changed it to ${c.name}. Please fix the problem in your snapshot.`);const h=new Rt(c,this._styles);n.set(o,h),i.includes(o)||i.push(o)}}},l.Workbook=uo([ho(1,y)],l.Workbook);class Re{constructor(s){_(this,"_snapshot");_(this,"_unitId");var e;this._snapshot={...Ms,...s},this._unitId=(e=this._snapshot.id)!=null?e:R.generateRandomId(6)}getContainer(){return this._snapshot.container}getParentRenderUnitId(){return this._snapshot.parentRenderUnitId}getSnapshot(){return this._snapshot}getUnitId(){return this._unitId}getPages(){var s;return(s=this._snapshot.body)==null?void 0:s.pages}getPageOrder(){var s;return(s=this._snapshot.body)==null?void 0:s.pageOrder}getPage(s){const e=this.getPages();return e==null?void 0:e[s]}getElementsByPage(s){var e;return(e=this.getPage(s))==null?void 0:e.pageElements}getElement(s,e){var n;return(n=this.getElementsByPage(s))==null?void 0:n[e]}getPageSize(){return this._snapshot.pageSize}addPage(){return{id:"cover_1",pageType:ge.SLIDE,zIndex:1,title:"cover",description:"this is first page, cover",pageBackgroundFill:{rgb:"rgb(255,255,255)"},pageElements:{}}}}const Gt="FOCUSING_SHEET",me="FOCUSING_DOC",Oe="FOCUSING_SLIDE",Eo="FOCUSING_EDITOR_BUT_HIDDEN",Tn="EDITOR_ACTIVATED",fo="FOCUSING_EDITOR_INPUT_FORMULA",wn="FOCUSING_FORMULA_EDITOR",go="FOCUSING_UNIVER_EDITOR",Ro="FOCUSING_EDITOR_INPUT_FORMULA",mo="FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE";var Oo=Object.defineProperty,Io=Object.getOwnPropertyDescriptor,Ao=(t,s,e,n)=>{for(var r=n>1?void 0:n?Io(s,e):s,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(s,e,r):o(r))||r);return n&&r&&Oo(s,e,r),r},Co=(t,s)=>(e,n)=>s(e,n,t),Dn=(t=>(t[t.UNKNOWN=0]="UNKNOWN",t[t.DOC=1]="DOC",t[t.SHEET=2]="SHEET",t[t.SLIDE=3]="SLIDE",t))(Dn||{});const lt=O.createIdentifier("univer.current");l.UniverInstanceService=class extends U{constructor(e,n){super();_(this,"_focused",null);_(this,"_focused$",new A.BehaviorSubject(null));_(this,"focused$",this._focused$.asObservable());_(this,"_currentSheet$",new A.BehaviorSubject(null));_(this,"currentSheet$",this._currentSheet$.asObservable());_(this,"_currentDoc$",new A.BehaviorSubject(null));_(this,"currentDoc$",this._currentDoc$.asObservable());_(this,"_currentSlide$",new A.BehaviorSubject(null));_(this,"currentSlide$",this._currentSlide$.asObservable());_(this,"_sheetAdded$",new A.Subject);_(this,"sheetAdded$",this._sheetAdded$.asObservable());_(this,"_docAdded$",new A.Subject);_(this,"docAdded$",this._docAdded$.asObservable());_(this,"_slideAdded$",new A.Subject);_(this,"slideAdded$",this._slideAdded$.asObservable());_(this,"_sheetDisposed$",new A.Subject);_(this,"sheetDisposed$",this._sheetDisposed$.asObservable());_(this,"_docDisposed$",new A.Subject);_(this,"docDisposed$",this._docDisposed$.asObservable());_(this,"_slideDisposed$",new A.Subject);_(this,"slideDisposed$",this._slideDisposed$.asObservable());_(this,"_sheets",[]);_(this,"_docs",[]);_(this,"_slides",[]);this._handler=e,this._contextService=n}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,n){const r=this._docs.find(i=>i.getUnitId()===e);if(r!=null){const i=this._docs.indexOf(r);this._docs.splice(i,1)}this.addDoc(n)}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(n=>n.getUnitId()===e)}getUniverDocInstance(e){return this._docs.find(n=>n.getUnitId()===e)}getUniverSlideInstance(e){return this._slides.find(n=>n.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),[me,Gt,Oe].forEach(n=>this._contextService.setContextValue(n,!1)),this._focused instanceof l.Workbook?this._contextService.setContextValue(Gt,!0):this._focused instanceof rt?this._contextService.setContextValue(me,!0):this._focused instanceof Re&&this._contextService.setContextValue(Oe,!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 n=this.getUniverDocInstance(e);if(n){const o=this._docs.indexOf(n);return this._docs.splice(o,1),this._docDisposed$.next(n),!0}const r=this.getUniverSheetInstance(e);if(r){const o=this._sheets.indexOf(r);return this._sheets.splice(o,1),this._sheetDisposed$.next(r),!0}const i=this.getUniverSlideInstance(e);if(i){const o=this._slides.indexOf(i);return this._slides.splice(o,1),this._slideDisposed$.next(i),!0}return!1}},l.UniverInstanceService=Ao([Co(1,it)],l.UniverInstanceService);var T=(t=>(t[t.Starting=0]="Starting",t[t.Ready=1]="Ready",t[t.Rendered=2]="Rendered",t[t.Steady=3]="Steady",t))(T||{});const No={0:"Starting",1:"Ready",2:"Rendered",3:"Steady"},$t=new Map;function Ie(t,s){return function(r){Ae(t,s)}}function Ae(t,s){$t.has(t)||$t.set(t,[]),$t.get(t).push(s)}var So=Object.defineProperty,Lo=Object.getOwnPropertyDescriptor,Un=(t,s,e,n)=>{for(var r=n>1?void 0:n?Lo(s,e):s,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(s,e,r):o(r))||r);return n&&r&&So(s,e,r),r},Ce=(t,s)=>(e,n)=>s(e,n,t);l.LifecycleService=class extends U{constructor(e){super();_(this,"_lifecycle$",new A.BehaviorSubject(T.Starting));_(this,"lifecycle$",this._lifecycle$.asObservable());this._logService=e,this._reportProgress(T.Starting)}get stage(){return this._lifecycle$.getValue()}set stage(e){if(e<this.stage)throw new Error("[LifecycleService]: lifecycle stage cannot go backward!");e!==this.stage&&(this._reportProgress(e),this._lifecycle$.next(e))}dispose(){this._lifecycle$.complete(),super.dispose()}subscribeWithPrevious(){return new A.Observable(e=>(this.stage===T.Starting||(this.stage===T.Ready?e.next(T.Starting):this.stage===T.Rendered?(e.next(T.Starting),e.next(T.Ready)):(e.next(T.Starting),e.next(T.Ready),e.next(T.Rendered))),this._lifecycle$.subscribe(e)))}_reportProgress(e){this._logService.debug("[LifecycleService]",`lifecycle progressed to "${No[e]}".`)}},l.LifecycleService=Un([Ce(0,y)],l.LifecycleService),l.LifecycleInitializerService=class extends U{constructor(e,n){super();_(this,"_started",!1);this._lifecycleService=e,this._injector=n}start(){this._started||(this._started=!0,this.disposeWithMe(b(this._lifecycleService.subscribeWithPrevious().subscribe(e=>this.initModulesOnStage(e)))))}initModulesOnStage(e){const n=$t.get(e);n==null||n.forEach(r=>{this._injector.has(r)&&this._injector.get(r)})}},l.LifecycleInitializerService=Un([Ce(0,O.Inject(l.LifecycleService)),Ce(1,O.Inject(O.Injector))],l.LifecycleInitializerService);class mt extends U{constructor(){super();_(this,"_currentLocale",tt.ZH_CN);_(this,"_locales",null);_(this,"localeChanged$",new A.Subject);_(this,"t",(e,...n)=>{if(!this._locales)throw new Error("Locale not initialized");const r=e.split("."),i=this.resolveKeyPath(this._locales[this._currentLocale],r);if(typeof i=="string"){let o=i;return n.forEach((c,a)=>{o=o.replace(`{${a}}`,c)}),o}else return e});this.disposeWithMe(b(()=>this.localeChanged$.complete()))}load(e){var n;this._locales=R.deepMerge((n=this._locales)!=null?n:{},e)}setLocale(e){this._currentLocale=e,this.localeChanged$.next()}getLocales(){var e;return(e=this._locales)==null?void 0:e[this._currentLocale]}getCurrentLocale(){return this._currentLocale}resolveKeyPath(e,n){const r=n.shift();if(r&&e&&r in e){const i=e[r];return n.length>0&&(typeof i=="object"||Array.isArray(i))?this.resolveKeyPath(i,n):i}return null}}const Ne=O.createIdentifier("resource-manager-service"),Mn=O.createIdentifier("ResourcePersistenceService");Ae(T.Ready,Mn);var vo=Object.defineProperty,bo=Object.getOwnPropertyDescriptor,To=(t,s,e,n)=>{for(var r=n>1?void 0:n?bo(s,e):s,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(s,e,r):o(r))||r);return n&&r&&vo(s,e,r),r},Pn=(t,s)=>(e,n)=>s(e,n,t);const Se=O.createIdentifier("univer.permission-service"),Hn="PERMISSION";l.PermissionService=class extends U{constructor(e,n){super();_(this,"_permissionPointMap",new Map);_(this,"deletePermissionPoint",(e,n)=>{const r=this._permissionPointMap.get(e);if(r){const i=r.get(n);i&&(i.complete(),this._permissionPointMap.delete(n))}});_(this,"addPermissionPoint",(e,n)=>{const r=this._permissionPointMap.get(e)||new Map;return r.has(n.id)?!1:(r.set(n.id,new A.BehaviorSubject(n)),this._permissionPointMap.set(e,r),!0)});_(this,"updatePermissionPoint",(e,n,r)=>{const i=this._permissionPointMap.get(e);if(!i)return;const o=i.get(n);if(o){const c=o.getValue();c.value=r,c.status=oe.DONE,o.next(c)}});_(this,"getPermissionPoint",(e,n)=>{const r=this._permissionPointMap.get(e);if(!r)return;const i=r.get(n);if(i)return i.getValue()});this._resourceManagerService=e,this._univerInstanceService=n}_init(){this.disposeWithMe(b(this._univerInstanceService.sheetAdded$.subscribe(e=>{this._resourceManagerService.registerPluginResource(e.getUnitId(),Hn,{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(b(this._univerInstanceService.sheetDisposed$.subscribe(e=>{this._resourceManagerService.disposePluginResource(e.getUnitId(),Hn)})))}_toJson(e){const n=this._permissionPointMap.get(e);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(e){return JSON.parse(e)}composePermission$(e,n){const r=this._permissionPointMap.get(e),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 A.combineLatest(i).pipe(nr.map(o=>(o.every(c=>this._permissionPointMap.get(c.id)),o)))}composePermission(e,n){const r=this._permissionPointMap.get(e);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()})}},l.PermissionService=To([Ie(T.Starting,l.PermissionService),Pn(0,O.Inject(Ne)),Pn(1,O.Inject(lt))],l.PermissionService);const Fn="univer.editable";class Vt extends ws{constructor(e){super();_(this,"id",Fn);_(this,"value",!0);_(this,"unitID");this.unitID=e}}var wo=Object.defineProperty,Do=Object.getOwnPropertyDescriptor,Uo=(t,s,e,n)=>{for(var r=n>1?void 0:n?Do(s,e):s,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(s,e,r):o(r))||r);return n&&r&&wo(s,e,r),r},Wn=(t,s)=>(e,n)=>s(e,n,t);l.UniverPermissionService=class extends U{constructor(s,e){super(),this._permissionService=s,this._univerInstanceService=e,this._init()}_init(){this._univerInstanceService.sheetAdded$.subscribe(s=>{const e=new Vt(s.getUnitId());this._permissionService.addPermissionPoint(s.getUnitId(),e)})}getEditable(s){let e=s;e||(e=this._univerInstanceService.getCurrentUniverSheetInstance().getUnitId());const n=new Vt(e),r=this._permissionService.getPermissionPoint(e,n.id);return r==null?void 0:r.value}setEditable(s,e){const n=new Vt(s);this._permissionService.updatePermissionPoint(s,n.id,e)}},l.UniverPermissionService=Uo([Ie(T.Starting,l.UniverPermissionService),Wn(0,O.Inject(Se)),Wn(1,O.Inject(lt))],l.UniverPermissionService);class Bn extends U{constructor(){super(...arguments);_(this,"_resourceMap",new Map);_(this,"_register$",new A.Subject);_(this,"register$",this._register$.asObservable())}getAllResource(e){const n=this._resourceMap.get(e);return n?[...n.keys()].reduce((r,i)=>{const o=n.get(i);return o&&r.push({unitID:e,resourceName:i,hook:o}),r},[]):[]}registerPluginResource(e,n,r){const i=this._resourceMap.get(e)||new Map;if(i.has(n))throw new Error(`the pluginName is registered {${n}}`);return i.set(n,r),this._resourceMap.set(e,i),this._register$.next({unitID:e,resourceName:n,hook:r}),b(()=>i.delete(n))}disposePluginResource(e,n){const r=this._resourceMap.get(e);r==null||r.delete(n)}dispose(){this._register$.complete(),this._resourceMap.clear()}}class Le extends U{constructor(){super();_(this,"_currentTheme");_(this,"_currentTheme$",new A.BehaviorSubject({}));_(this,"currentTheme$",this._currentTheme$.asObservable());this.disposeWithMe(b(()=>this._currentTheme$.complete()))}getCurrentTheme(){if(!this._currentTheme)throw new Error("[ThemeService]: current theme is not set!");return this._currentTheme}setTheme(e){this._currentTheme=e,this._currentTheme$.next(e)}}const kn="__defaultDocumentNormalEditorSpecialUnitId_20231006__",Gn="__defaultDocumentFormulaBarEditorSpecialUnitId_20231012__",Mo=`\r
7
- `;function Po(t){return`__internalEditorId__${t}`}function Ho(t){return t.startsWith("__")}var Fo=Object.defineProperty,Wo=Object.getOwnPropertyDescriptor,Bo=(t,s,e,n)=>{for(var r=n>1?void 0:n?Wo(s,e):s,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(s,e,r):o(r))||r);return n&&r&&Fo(s,e,r),r},ve=(t,s)=>(e,n)=>s(e,n,t);const pt=O.createIdentifier("univer.undo-redo.service"),ko=20;class $n{dispose(){}async dispatchToHandlers(){return!1}}const Vn="univer.command.redo",pn="univer.command.undo",xn=new class extends $n{constructor(){super(...arguments);_(this,"type",Nt.COMMAND);_(this,"id",pn)}async handler(s){const e=s.get(pt),n=e.pitchTopUndoElement();if(!n)return!1;const r=s.get(ht);return Qt(n.undoMutations,r)?(e.popUndoToRedo(),!0):!1}},jn=new class extends $n{constructor(){super(...arguments);_(this,"type",Nt.COMMAND);_(this,"id",Vn)}async handler(s){const e=s.get(pt),n=e.pitchTopRedoElement();if(!n)return!1;const r=s.get(ht);return Qt(n.redoMutations,r)?(e.popRedoToUndo(),!0):!1}};l.LocalUndoRedoService=class extends U{constructor(e,n,r){super();_(this,"undoRedoStatus$");_(this,"_undoRedoStatus$",new A.BehaviorSubject({undos:0,redos:0}));_(this,"_undoStacks",new Map);_(this,"_redoStacks",new Map);_(this,"_batchingStatus",new Map);this._univerInstanceService=e,this._commandService=n,this._contextService=r,this.undoRedoStatus$=this._undoRedoStatus$.asObservable(),this.disposeWithMe(this._commandService.registerCommand(xn)),this.disposeWithMe(this._commandService.registerCommand(jn)),this.disposeWithMe(b(()=>this._undoRedoStatus$.complete())),this.disposeWithMe(b(this._univerInstanceService.focused$.subscribe(()=>this._updateStatus())))}pushUndoRedo(e){const{unitID:n}=e,r=this._getRedoStack(n,!0),i=this._getUndoStack(n,!0);if(r.length=0,this._batchingStatus.has(e.unitID)){const c=this._batchingStatus.get(e.unitID),a=this._pitchUndoElement(e.unitID);c===0||!a?(o(e),this._batchingStatus.set(e.unitID,1)):this._tryBatchingElements(a,e)}else o(e);function o(c){i.push(c),i.length>ko&&i.splice(0,1)}this._updateStatus()}clearUndoRedo(e){const n=this._getRedoStack(e);n&&(n.length=0);const r=this._getUndoStack(e);r&&(r.length=0),this._updateStatus()}pitchTopUndoElement(){const e=this._getFocusedUniverInstanceId();return this._pitchUndoElement(e)}pitchTopRedoElement(){const e=this._getFocusedUniverInstanceId();return this._pitchRedoElement(e)}_pitchUndoElement(e){const n=this._getUndoStack(e);return n!=null&&n.length?n[n.length-1]:null}_pitchRedoElement(e){const n=this._getRedoStack(e);return n!=null&&n.length?n[n.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())}__tempBatchingUndoRedo(e){if(this._batchingStatus.has(e))throw new Error("[LocalUndoRedoService]: cannot batching undo redo twice at the same time!");return this._batchingStatus.set(e,0),b(()=>this._batchingStatus.delete(e))}_updateStatus(){var i,o;const e=this._getFocusedUniverInstanceId(),n=e&&((i=this._undoStacks.get(e))==null?void 0:i.length)||0,r=e&&((o=this._redoStacks.get(e))==null?void 0:o.length)||0;this._undoRedoStatus$.next({undos:n,redos:r})}_getUndoStack(e,n=!1){let r=this._undoStacks.get(e);return!r&&n&&(r=[],this._undoStacks.set(e,r)),r||null}_getRedoStack(e,n=!1){let r=this._redoStacks.get(e);return!r&&n&&(r=[],this._redoStacks.set(e,r)),r||null}_getUndoStackForFocused(){const e=this._getFocusedUniverInstanceId();if(!e)throw new Error("No focused univer instance!");return this._getUndoStack(e,!0)}_getRedoStackForFocused(){const e=this._getFocusedUniverInstanceId();if(!e)throw new Error("No focused univer instance!");return this._getRedoStack(e,!0)}_tryBatchingElements(e,n){e.redoMutations.push(...n.redoMutations),e.undoMutations.push(...n.undoMutations)}_getFocusedUniverInstanceId(){var o,c,a,h;let e="";const n=this._contextService.getContextValue(Gt),r=this._contextService.getContextValue(wn),i=this._contextService.getContextValue(Tn);return n?r?e=Gn:i?e=kn:e=(c=(o=this._univerInstanceService.getFocusedUniverInstance())==null?void 0:o.getUnitId())!=null?c:"":e=(h=(a=this._univerInstanceService.getFocusedUniverInstance())==null?void 0:a.getUnitId())!=null?h:"",e}},l.LocalUndoRedoService=Bo([ve(0,lt),ve(1,ht),ve(2,it)],l.LocalUndoRedoService);class xt extends U{constructor(){super(...arguments);_(this,"_started",!1)}addPlugins(e){if(this._started){const n=e.map(([r,i])=>this._initPlugin(r,i));this._pluginsRunLifecycle(n,T.Starting),setTimeout(()=>this._takePluginsThroughLifecycle(n,!0))}else{const n=e.map(([r,i])=>this._initPlugin(r,i));this._takePluginsThroughLifecycle(n),this._started=!0}}_takePluginsThroughLifecycle(e,n=!1){this.disposeWithMe(b(this._lifecycleService.subscribeWithPrevious().subscribe(r=>{n&&r===T.Starting||this._pluginsRunLifecycle(e,r)})))}_pluginsRunLifecycle(e,n){e.forEach(r=>{switch(n){case T.Starting:r.onStarting(this._injector);break;case T.Ready:r.onReady();break;case T.Rendered:r.onRendered();break;case T.Steady:r.onSteady();break}}),this._lifecycleInitializerService.initModulesOnStage(n)}_initPlugin(e,n){return this._injector.createInstance(e,n)}}var Go=Object.defineProperty,$o=Object.getOwnPropertyDescriptor,Vo=(t,s,e,n)=>{for(var r=n>1?void 0:n?$o(s,e):s,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(s,e,r):o(r))||r);return n&&r&&Go(s,e,r),r},be=(t,s)=>(e,n)=>s(e,n,t);l.UniverDoc=class extends xt{constructor(s,e,n){super(),this._injector=s,this._lifecycleService=e,this._lifecycleInitializerService=n}createDoc(s){return this._injector.createInstance(rt,s)}},l.UniverDoc=Vo([be(0,O.Inject(O.Injector)),be(1,O.Inject(l.LifecycleService)),be(2,O.Inject(l.LifecycleInitializerService))],l.UniverDoc);var po=Object.defineProperty,xo=Object.getOwnPropertyDescriptor,jo=(t,s,e,n)=>{for(var r=n>1?void 0:n?xo(s,e):s,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(s,e,r):o(r))||r);return n&&r&&po(s,e,r),r},Te=(t,s)=>(e,n)=>s(e,n,t);l.UniverSheet=class extends xt{constructor(s,e,n){super(),this._injector=s,this._lifecycleService=e,this._lifecycleInitializerService=n}createSheet(s){return this._injector.createInstance(l.Workbook,s)}},l.UniverSheet=jo([Te(0,O.Inject(O.Injector)),Te(1,O.Inject(l.LifecycleService)),Te(2,O.Inject(l.LifecycleInitializerService))],l.UniverSheet);var Ko=Object.defineProperty,Yo=Object.getOwnPropertyDescriptor,zo=(t,s,e,n)=>{for(var r=n>1?void 0:n?Yo(s,e):s,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(n?o(s,e,r):o(r))||r);return n&&r&&Ko(s,e,r),r},we=(t,s)=>(e,n)=>s(e,n,t);l.UniverSlide=class extends xt{constructor(s,e,n){super(),this._injector=s,this._lifecycleService=e,this._lifecycleInitializerService=n}createSlide(s){return this._injector.createInstance(Re,s)}},l.UniverSlide=zo([we(0,O.Inject(O.Injector)),we(1,O.Inject(l.LifecycleService)),we(2,O.Inject(l.LifecycleInitializerService))],l.UniverSlide);const Xo=200;class qo extends xt{constructor(e={}){super();_(this,"_injector");_(this,"_univerPluginStore",new ur);_(this,"_univerPluginRegistry",new hr);_(this,"_univerSheet",null);_(this,"_univerDoc",null);_(this,"_univerSlide",null);_(this,"_initLazyPluginsTimer");this._injector=this._initDependencies();const{theme:n,locale:r,locales:i,logLevel:o}=e;n&&this._injector.get(Le).setTheme(n),i&&this._injector.get(mt).load(i),r&&this._injector.get(mt).setLocale(r),o&&this._injector.get(y).setLogLevel(o)}get _univerInstanceService(){return this._injector.get(lt)}get _lifecycleService(){return this._injector.get(l.LifecycleService)}get _lifecycleInitializerService(){return this._injector.get(l.LifecycleInitializerService)}__getInjector(){return this._injector}dispose(){this._injector.dispose(),super.dispose()}setLocale(e){this._injector.get(mt).setLocale(e)}createUniverSheet(e){let n;const r=()=>{n=this._univerSheet.createSheet(e),this._univerInstanceService.addSheet(n)};if(this._univerSheet)r();else{this._tryProgressToStart();const i=this._univerSheet=this._injector.createInstance(l.UniverSheet),o=this._univerPluginRegistry.getRegisterPlugins(w.Sheet).map(c=>[c.plugin,c.options]);this._univerPluginRegistry.clearPluginsOfType(w.Sheet),i.addPlugins(o),r(),this._tryProgressToReady()}return n}createUniverDoc(e){let n;const r=()=>{n=this._univerDoc.createDoc(e),this._univerInstanceService.addDoc(n)};if(this._univerDoc)r();else{this._tryProgressToStart();const i=this._univerDoc=this._injector.createInstance(l.UniverDoc),o=this._univerPluginRegistry.getRegisterPlugins(w.Doc).map(c=>[c.plugin,c.options]);this._univerPluginRegistry.clearPluginsOfType(w.Doc),i.addPlugins(o),r(),this._tryProgressToReady()}return n}createUniverSlide(e){let n;const r=()=>{n=this._univerSlide.createSlide(e),this._univerInstanceService.addSlide(n)};if(this._univerSlide)r();else{this._tryProgressToStart();const i=this._univerSlide=this._injector.createInstance(l.UniverSlide),o=this._univerPluginRegistry.getRegisterPlugins(w.Slide).map(c=>[c.plugin,c.options]);this._univerPluginRegistry.clearPluginsOfType(w.Slide),i.addPlugins(o),r(),this._tryProgressToReady()}return n}_initDependencies(){return new O.Injector([[lt,{useFactory:e=>new l.UniverInstanceService({createUniverDoc:n=>this.createUniverDoc(n),createUniverSheet:n=>this.createUniverSheet(n),createUniverSlide:n=>this.createUniverSlide(n)},e),deps:[it]}],[Ze],[mt],[Le],[l.LifecycleService],[l.LifecycleInitializerService],[Se,{useClass:l.PermissionService}],[l.UniverPermissionService],[y,{useClass:ze,lazy:!0}],[ht,{useClass:l.CommandService,lazy:!0}],[pt,{useClass:l.LocalUndoRedoService,lazy:!0}],[Qe,{useClass:Je}],[it,{useClass:Ke}],[ts,{useClass:ye,lazy:!0}],[Ne,{useClass:Bn,lazy:!0}]])}_tryProgressToStart(){this._started||(this._injector.get(l.LifecycleInitializerService).start(),this._started=!0)}_tryProgressToReady(){this._injector.get(l.LifecycleService).stage<T.Ready&&(this._injector.get(l.LifecycleService).stage=T.Ready,this._univerPluginStore.forEachPlugin(n=>n.onReady()))}registerPlugin(e,n){if(e.type===w.Univer)this._registerUniverPlugin(e,n);else if(e.type===w.Sheet)this._registerSheetsPlugin(e,n);else if(e.type===w.Doc)this._registerDocsPlugin(e,n);else if(e.type===w.Slide)this._registerSlidesPlugin(e,n);else throw new Error(`Unimplemented plugin system for business: "${e.type}".`);if(this._started)return this._scheduleInitPluginAfterStarted()}_scheduleInitPluginAfterStarted(){this._initLazyPluginsTimer===void 0&&(this._initLazyPluginsTimer=setTimeout(()=>this._flushLazyPlugins(),Xo))}_flushLazyPlugins(){this._initLazyPluginsTimer=void 0;const e=this._univerPluginRegistry.getRegisterPlugins(w.Univer);if(e.length){this._univerPluginRegistry.clearPluginsOfType(w.Univer);const n=e.map(r=>this._injector.createInstance(r.plugin,r.options));this._takePluginsThroughLifecycle(n)}if(this._univerSheet){const n=this._univerPluginRegistry.getRegisterPlugins(w.Sheet).map(r=>[r.plugin,r.options]);n.length&&(this._univerSheet.addPlugins(n),this._univerPluginRegistry.clearPluginsOfType(w.Sheet))}if(this._univerDoc){const n=this._univerPluginRegistry.getRegisterPlugins(w.Doc).map(r=>[r.plugin,r.options]);n.length&&(this._univerDoc.addPlugins(n),this._univerPluginRegistry.clearPluginsOfType(w.Doc))}if(this._univerSlide){const n=this._univerPluginRegistry.getRegisterPlugins(w.Slide).map(r=>[r.plugin,r.options]);n.length&&(this._univerSlide.addPlugins(n),this._univerPluginRegistry.clearPluginsOfType(w.Slide))}}_registerUniverPlugin(e,n){if(this._started)this._univerPluginRegistry.registerPlugin(e,n);else{const r=this._injector.createInstance(e,n);r.onStarting(this._injector),this._univerPluginStore.addPlugin(r)}}_registerSheetsPlugin(e,n){this._univerPluginRegistry.registerPlugin(e,n)}_registerDocsPlugin(e,n){this._univerPluginRegistry.registerPlugin(e,n)}_registerSlidesPlugin(e,n){this._univerPluginRegistry.registerPlugin(e,n)}}function Qo(t,s=16){let e=0,n=null;return function(...i){const o=Date.now();o-e<s?(n&&clearTimeout(n),n=setTimeout(()=>{e=o,t.apply(this,i)},s)):(e=o,t.apply(this,i))}}function Jo(t){const s=new MessageChannel;let e=!1;return s.port1.onmessage=()=>{e||t()},s.port2.postMessage(null),()=>{e=!0}}var Kn=(t=>(t[t.TEXT=0]="TEXT",t[t.ARROW=1]="ARROW",t[t.CUSTOM=2]="CUSTOM",t))(Kn||{});class De{constructor(s){_(this,"_index",0);_(this,"_offset",0);this._actions=s}hasNext(){return this.peekLength()<Number.POSITIVE_INFINITY}next(s){s||(s=Number.POSITIVE_INFINITY);const e=this._actions[this._index];if(e){const n=this._offset,r=e.len;return s>=r-n?(s=r-n,this._index+=1,this._offset=0):this._offset+=s,e.t===C.DELETE||e.t===C.RETAIN&&e.body==null?R.deepClone({...e,len:s}):R.deepClone({...e,len:s,body:_e(e.body,n,n+s)})}else return{t:C.RETAIN,len:Number.POSITIVE_INFINITY}}peek(){return this._actions[this._index]}peekLength(){return this._actions[this._index]?this._actions[this._index].len-this._offset:Number.POSITIVE_INFINITY}peekType(){const s=this._actions[this._index];return s?s.t:C.RETAIN}rest(){if(this.hasNext()){if(this._offset===0)return this._actions.slice(this._index);{const s=this._offset,e=this._index,n=this.next(),r=this._actions.slice(this._index);return this._offset=s,this._index=e,[n].concat(r)}}else return[]}}function Yn(t){return Object.keys(t).length===1}class jt{constructor(){_(this,"_actions",[])}static compose(s,e){const n=new De(s),r=new De(e),i=new jt;for(;n.hasNext()||r.hasNext();)if(r.peekType()===C.INSERT)i.push(r.next());else if(n.peekType()===C.DELETE)i.push(n.next());else{const o=Math.min(n.peekLength(),r.peekLength()),c=n.next(o),a=r.next(o);c.t===C.INSERT&&a.t===C.RETAIN?a.body==null?i.push(c):i.push({...c,body:de(c.body,a.body,a.coverType)}):c.t===C.RETAIN&&a.t===C.RETAIN?c.body==null&&a.body==null?i.push(c.len!==Number.POSITIVE_INFINITY?c:a):c.body&&a.body?i.push({...c,body:de(c.body,a.body,a.coverType)}):i.push(c.body?c:a):c.t===C.RETAIN&&a.t===C.DELETE?i.push(a):c.t===C.INSERT&&(a.t,C.DELETE)}return i.trimEndUselessRetainAction(),i.serialize()}insert(s,e,n=""){const r={t:C.INSERT,body:e,len:s,line:0,segmentId:n};return this.push(r),this}retain(s,e="",n,r){const i={t:C.RETAIN,len:s,segmentId:e};return n!=null&&(i.body=n),r!=null&&(i.coverType=r),this.push(i),this}delete(s,e=""){const n={t:C.DELETE,len:s,line:0,segmentId:e};return this.push(n),this}serialize(){return this._actions}push(...s){if(s.length>1){for(const i of s)this.push(i);return this}let e=this._actions.length,n=this._actions[e-1];const r=R.deepClone(s[0]);if(r.t===C.RETAIN&&r.len===0&&r.body==null)return this;if(typeof n=="object"){if(n.t===C.DELETE&&r.t===C.DELETE)return n.len+=r.len,this;if(n.t===C.DELETE&&r.t===C.INSERT&&(e-=1,n=this._actions[e-1],n==null))return this._actions.unshift(r),this;if(n.t===C.RETAIN&&r.t===C.RETAIN&&n.body==null&&r.body==null)return n.len+=r.len,this;if(n.t===C.INSERT&&Yn(n.body)&&r.t===C.INSERT&&Yn(r.body))return n.len+=r.len,n.body.dataStream+=r.body.dataStream,this}return e===this._actions.length?this._actions.push(r):this._actions.splice(e,0,r),this}trimEndUselessRetainAction(){let s=this._actions[this._actions.length-1];for(;s&&s.t===C.RETAIN&&ji(s);)this._actions.pop(),s=this._actions[this._actions.length-1];return this}}function Zo(t,s,e){if(s==="")return t;const n={id:"mock-id",body:t,documentStyle:{}},r=new rt(n),i=s.length;let o;for(;(o=r.getBody().dataStream.indexOf(s))>=0;){const a=new jt;if(o>0&&a.retain(o),e.length>0){const u=r.sliceBody(o,o+i),d={dataStream:e};Array.isArray(u==null?void 0:u.textRuns)&&u.textRuns.length&&(d.textRuns=[{...u.textRuns[0],st:0,ed:e.length}]),a.insert(e.length,d)}a.delete(i);const h=a.serialize();r.apply(h)}const c=r.getBody();return r.dispose(),c}class yo extends Ct{add(s){if(!s)return null;const e=new At(s,this);return this._observers=[e],this._onObserverAdded&&this._onObserverAdded(e),e}makeObserverTopPriority(){}makeObserverBottomPriority(){}}const tc=O.createIdentifier("ILocalStorageService");function ec(t){return new A.Observable(s=>{const e=t((...n)=>s.next(n));return()=>e==null?void 0:e.dispose()})}const sc=t=>`sheet_interceptor_${t}`,zn=t=>function(s,e){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,e,r.bind(null,i+1))}return r(0,s)};class nc{constructor(s){_(this,"_interceptorsByName",new Map);_(this,"_interceptorPoints");this._interceptorPoints=s}fetchThroughInterceptors(s){const e=s,n=this._interceptorsByName.get(e);return zn(n||[])}intercept(s,e){const n=s;this._interceptorsByName.has(n)||this._interceptorsByName.set(n,[]);const r=this._interceptorsByName.get(n);return r.push(e),this._interceptorsByName.set(n,r.sort((i,o)=>{var c,a;return((c=o.priority)!=null?c:0)-((a=i.priority)!=null?a:0)})),()=>K(this._interceptorsByName.get(n),e)}getInterceptPoints(){return this._interceptorPoints}}const rc=O.createIdentifier("univer.snapshot-server-service");class ic{constructor(){_(this,"_sheetBlockCache",new Map)}getUnitOnRev(s,e){return Promise.resolve({snapshot:{unitID:"",type:j.UNIVER_SHEET,rev:0,workbook:void 0,doc:void 0},changesets:[],error:{code:k.OK,message:""}})}getSheetBlock(s,e){const n=this._sheetBlockCache.get(e.blockID);return Promise.resolve({block:n,error:{code:k.OK,message:""}})}fetchMissingChangesets(s,e){return Promise.resolve({changesets:[],error:{code:k.OK,message:""}})}getResourcesRequest(s,e){return Promise.resolve({resources:{},error:{code:k.OK,message:""}})}saveSnapshot(s,e){return Promise.resolve({error:{code:k.OK,message:""}})}saveSheetBlock(s,e){const{block:n}=e;return n?(this._sheetBlockCache.set(n.id,n),Promise.resolve({error:{code:k.OK,message:""},blockID:n.id})):Promise.resolve({error:{code:k.UNDEFINED,message:"block is required"},blockID:""})}saveChangeset(s,e){return Promise.resolve({error:{code:k.OK,message:""},concurrent:[]})}}function oc(t){return btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,(s,e)=>String.fromCharCode(Number.parseInt(e,16))))}function Ue(t){return decodeURIComponent(Array.prototype.map.call(atob(t),s=>`%${`00${s.charCodeAt(0).toString(16)}`.slice(-2)}`).join(""))}const Ot=new TextEncoder,Kt=new TextDecoder;function Xn(t){const s=R.deepClone(t);return delete s.id,delete s.name,delete s.rowCount,delete s.columnCount,delete s.cellData,Ot.encode(JSON.stringify(s))}function qn(t){const s=R.deepClone(t);return delete s.id,delete s.rev,delete s.name,delete s.sheetOrder,delete s.sheets,Ot.encode(JSON.stringify(s))}function cc(t){const s=R.deepClone(t);return delete s.id,delete s.rev,delete s.title,delete s.resources,Ot.encode(JSON.stringify(s))}function Qn(t){return JSON.parse(Kt.decode(t))}function ac(t){return JSON.parse(typeof t=="string"?Ue(t):Kt.decode(t))}function lc(t){return JSON.parse(typeof t=="string"?Ue(t):Kt.decode(t))}const Me=256;function Jn(t,s){const e=new V(t),n=e.getLength(),r=[];let i=0;for(;i<n;){const o=Math.min(i+Me,n-1),c=e.getSlice(i,Math.min(i+Me,n-1),0,s),a=uc(c);r.push({id:R.generateRandomId(19,"0123456789"),startRow:i,endRow:o,data:a}),i+=Me}return r}function uc(t){const s=t.getData();return Ot.encode(JSON.stringify(s))}async function hc(t,s,e,n,r){const i={},o={};if(!await Promise.all(Object.entries(s.sheets).map(async([d,E])=>{const f={id:E.id,type:St.GRID,name:E.name,rowCount:E.rowCount,columnCount:E.columnCount,originalMeta:Xn(E)};if(o[d]=f,E.cellData){const g=Jn(E.cellData,E.rowCount),m=await Promise.all(g.map(N=>r.saveSheetBlock(t,{unitID:e,type:j.UNIVER_SHEET,block:N})));if(m.some(N=>{var S;return((S=N.error)==null?void 0:S.code)!==k.OK}))return!1;i[d]={sheetID:d,blocks:m.map(N=>N.blockID)}}return!0})))throw new Error("[transformWorkbookDataToSnapshot()]: Failed to save sheet blocks.");const a=qn(s),h={unitID:s.id,rev:n,creator:"",name:s.name,sheetOrder:s.sheetOrder,sheets:o,blockMeta:i,resources:s.resources||[],originalMeta:a};return{snapshotRes:{unitID:e,rev:h.rev,type:j.UNIVER_SHEET,workbook:h,doc:void 0}}}async function _c(t,s,e,n,r){var E,f;const i={},o={};if(!await Promise.all(Object.entries(s.sheets).map(async([g,m])=>{const N={id:m.id,type:St.GRID,name:m.name,rowCount:m.rowCount,columnCount:m.columnCount,originalMeta:Xn(m)};if(o[g]=N,m.cellData){const S=Jn(m.cellData,m.rowCount),F=await Promise.all(S.map(P=>r.saveSheetBlock(t,{unitID:e,type:j.UNIVER_SHEET,block:P})));if(F.some(P=>{var J;return((J=P.error)==null?void 0:J.code)!==k.OK}))return!1;i[g]={sheetID:g,blocks:F.map(P=>P.blockID)}}return!0})))throw new Error("[transformWorkbookDataToSnapshot()]: Failed to save sheet blocks.");const a=qn(s),h={unitID:s.id,rev:n,creator:"",name:s.name,sheetOrder:s.sheetOrder,sheets:o,blockMeta:i,resources:s.resources||[],originalMeta:a},u={unitID:e,rev:h.rev,type:j.UNIVER_SHEET,workbook:h,doc:void 0},d=await r.saveSnapshot(t,{unitID:e,type:j.UNIVER_SHEET,snapshot:u});if(Rn(d.error))throw new Error(`transformWorkbookDataToSnapshot(): Failed to save snapshot.
8
- ErrorCode: ${(E=d.error)==null?void 0:E.code}:${(f=d.error)==null?void 0:f.message}`);return{snapshot:u}}function dc(t,s,e){const n=t.workbook;if(!n)throw new Error("");const r={};Object.entries(n.sheets).forEach(([a,h])=>{const u=Qn(h.originalMeta);r[a]={id:h.id,name:h.name,rowCount:h.rowCount,columnCount:h.columnCount,...u}});const i=new Map;s.forEach(a=>{i.set(a.id,a)}),n.blockMeta&&Object.entries(n.blockMeta).forEach(([a,h])=>{var E;const u=r[a];u.cellData={};const d=[];(E=h.blocks)==null||E.forEach(f=>{const g=i.get(f);if(g)d.push(g);else throw new Error("")}),d.forEach(f=>{const g=ac(f.data);Object.entries(g).forEach(([m,N])=>{const S=u.cellData[+m]={};Object.entries(N).forEach(([F,P])=>{S[+F]=P})})})});const o=Qn(n.originalMeta);return{id:t.unitID,rev:n.rev,name:n.name,sheetOrder:n.sheetOrder,appVersion:"",locale:tt.EN_US,sheets:r,styles:{},resources:n.resources||[],...o}}function Ec(t){const s=t.doc;if(s==null)throw new Error("transformSnapshotToDocumentData(): snapshot.doc is undefined.");const{unitID:e,rev:n,name:r,originalMeta:i}=s,{body:o,documentStyle:c={},settings:a={}}=lc(i);return{id:e,rev:n,locale:tt.EN_US,title:r,body:o,documentStyle:c,settings:a}}async function fc(t,s,e,n,r){var a,h,u;const i={unitID:s.id,rev:n,creator:"",name:(a=s.title)!=null?a:"",resources:s.resources||[],originalMeta:cc(s)},o={unitID:e,rev:i.rev,type:j.UNIVER_DOC,workbook:void 0,doc:i},c=await r.saveSnapshot(t,{unitID:e,type:j.UNIVER_DOC,snapshot:o});if(Rn(c.error))throw new Error(`transformDocumentDataToSnapshot(): Failed to save snapshot.
9
- ErrorCode: ${(h=c.error)==null?void 0:h.code}:${(u=c.error)==null?void 0:u.message}`);return{snapshot:o}}async function gc(t,s){const e=t.workbook;if(!e)throw new Error("Workbook metadata is not available");const n=[],r=[];return Object.entries(e.blockMeta).forEach(([i,o])=>{const c=o.blocks.map(async a=>{const h={unitID:e.unitID,type:j.UNIVER_SHEET,blockID:a},{block:u}=await s.getSheetBlock({},h);if(u)n.push(u);else throw new Error("Block not found")});r.push(...c)}),await Promise.all(r),n}var Zn=(t=>(t[t.INFO=0]="INFO",t[t.STOP=1]="STOP",t[t.WARNING=2]="WARNING",t))(Zn||{}),yn=(t=>(t[t.DISABLED=0]="DISABLED",t[t.FULL_ALPHA=1]="FULL_ALPHA",t[t.FULL_HANGUL=2]="FULL_HANGUL",t[t.FULL_KATAKANA=3]="FULL_KATAKANA",t[t.HALF_ALPHA=4]="HALF_ALPHA",t[t.HALF_HANGUL=5]="HALF_HANGUL",t[t.HALF_KATAKANA=6]="HALF_KATAKANA",t[t.HIRAGANA=7]="HIRAGANA",t[t.NO_CONTROL=8]="NO_CONTROL",t[t.OFF=9]="OFF",t[t.ON=10]="ON",t))(yn||{}),tr=(t=>(t.BETWEEN="between",t.EQUAL="equal",t.GREATER_THAN="greaterThan",t.GREATER_THAN_OR_EQUAL="greaterThanOrEqual",t.LESS_THAN="lessThan",t.LESS_THAN_OR_EQUAL="lessThanOrEqual",t.NOT_BETWEEN="notBetween",t.NOT_EQUAL="notEqual",t))(tr||{}),er=(t=>(t.CUSTOM="custom",t.LIST="list",t.LIST_MULTIPLE="listMultiple",t.NONE="none",t.TEXT_LENGTH="textLength",t.DATE="date",t.TIME="time",t.WHOLE="whole",t.DECIMAL="decimal",t.CHECKBOX="checkbox",t))(er||{}),sr=(t=>(t.VALID="valid",t.INVALID="invalid",t.VALIDATING="validating",t))(sr||{});rr(),l.ABCToNumber=mi,l.AbsoluteRefType=p,l.ActionIterator=De,l.AlignTypeH=hn,l.AlignTypeV=_n,l.AutoFillSeries=rs,l.BaselineOffset=bt,l.BlockType=Ys,l.BooleanNumber=I,l.BorderStyleTypes=v,l.BorderType=is,l.BulletAlignment=X,l.COLORS=Jt,l.CellValueType=dt,l.ClientSnapshotServerService=ic,l.Color=st,l.ColorBuilder=wt,l.ColorKit=$,l.ColorType=B,l.ColumnSeparatorType=qs,l.CommandType=Nt,l.CommonHideTypes=os,l.ConditionType=cs,l.ConfigService=Je,l.ContentAlignment=on,l.ContextService=Ke,l.CopyPasteType=as,l.CustomRangeType=Ks,l.DEFAULT_CELL=bi,l.DEFAULT_DOC=Ee,l.DEFAULT_DOCUMENT_SUB_COMPONENT_ID=Lr,l.DEFAULT_EMPTY_DOCUMENT_VALUE=Mo,l.DEFAULT_RANGE=Li,l.DEFAULT_RANGE_ARRAY=ft,l.DEFAULT_SELECTION=vi,l.DEFAULT_SLIDE=Ms,l.DEFAULT_STYLES=Wt,l.DEFAULT_WORKSHEET_COLUMN_COUNT=An,l.DEFAULT_WORKSHEET_COLUMN_COUNT_KEY=to,l.DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT=Ln,l.DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT_KEY=ro,l.DEFAULT_WORKSHEET_COLUMN_WIDTH=Nn,l.DEFAULT_WORKSHEET_COLUMN_WIDTH_KEY=so,l.DEFAULT_WORKSHEET_ROW_COUNT=In,l.DEFAULT_WORKSHEET_ROW_COUNT_KEY=yi,l.DEFAULT_WORKSHEET_ROW_HEIGHT=Cn,l.DEFAULT_WORKSHEET_ROW_HEIGHT_KEY=eo,l.DEFAULT_WORKSHEET_ROW_TITLE_WIDTH=Sn,l.DEFAULT_WORKSHEET_ROW_TITLE_WIDTH_KEY=no,l.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY=Gn,l.DOCS_NORMAL_EDITOR_UNIT_ID_KEY=kn,l.DashStyleType=sn,l.DataStreamTreeNodeType=Hs,l.DataStreamTreeTokenType=ae,l.DataValidationErrorStyle=Zn,l.DataValidationImeMode=yn,l.DataValidationOperator=tr,l.DataValidationRenderMode=Kn,l.DataValidationStatus=sr,l.DataValidationType=er,l.DesktopLogService=ze,l.DeveloperMetadataVisibility=ls,l.Dimension=us,l.Direction=hs,l.Disposable=U,l.DisposableCollection=qt,l.DocStyleType=xs,l.DocumentDataModel=rt,l.EDITOR_ACTIVATED=Tn,l.EXTENSION_NAMES=Ps,l.Entry=se,l.EntryIterator=bs,l.ErrorService=Ze,l.EventState=xe,l.FOCUSING_DOC=me,l.FOCUSING_EDITOR_BUT_HIDDEN=Eo,l.FOCUSING_EDITOR_INPUT_FORMULA=fo,l.FOCUSING_EDITOR_STANDALONE=Ro,l.FOCUSING_FORMULA_EDITOR=wn,l.FOCUSING_SHEET=Gt,l.FOCUSING_SLIDE=Oe,l.FOCUSING_UNIVER_EDITOR=go,l.FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE=mo,l.FloatingObjectManagerService=ye,l.FollowNumberWithType=js,l.FontItalic=Lt,l.FontStyleType=cn,l.FontWeight=vt,l.FormatType=_s,l.GlyphType=gt,l.GridType=zs,l.HLSColor=Os,l.HorizontalAlign=et,l.ICommandService=ht,l.IConfigService=Qe,l.IContextService=it,l.IFloatingObjectManagerService=ts,l.ILocalStorageService=tc,l.ILogService=y,l.IPermissionService=Se,l.IResourceManagerService=Ne,l.ISnapshotPersistenceService=Mn,l.ISnapshotServerService=rc,l.IUndoRedoService=pt,l.IUniverInstanceService=lt,l.InterceptorManager=nc,l.InterpolationPointType=ds,l.KeyIterator=Ls,l.LRUHelper=Et,l.LRUMap=Ts,l.LifecycleStages=T,l.LocaleService=mt,l.LocaleType=tt,l.LogLevel=Ye,l.MemoryCursor=es,l.NamedStyleType=tn,l.NilCommand=qe,l.NumberUnitType=un,l.ObjectMatrix=V,l.ObjectRelativeFromH=an,l.ObjectRelativeFromV=ln,l.Observable=Ct,l.ObservableHooks=yo,l.Observer=At,l.OnLifecycle=Ie,l.PRESET_LIST_TYPE=Wi,l.PageElementType=mn,l.PageOrientType=En,l.PageType=ge,l.ParagraphElementType=Js,l.PermissionPoint=ws,l.PermissionStatus=oe,l.Plugin=Pe,l.PluginType=w,l.PositionedObjectLayoutType=ys,l.PresetListType=kt,l.ProtectionType=Es,l.RANGE_TYPE=W,l.RGBA_PAREN=Dr,l.RGB_PAREN=wr,l.Range=nt,l.Rectangle=Z,l.RedoCommand=jn,l.RedoCommandId=Vn,l.RefAlias=Ri,l.Registry=Yt,l.RegistryAsMap=zt,l.RelativeDate=fs,l.RelativeSlideLink=On,l.ResourceManagerService=Bn,l.RgbColor=Dt,l.RxDisposable=mr,l.SectionType=Xs,l.ShapeType=gs,l.SheetTypes=St,l.SheetViewModel=bn,l.SlideDataModel=Re,l.SpacingRule=en,l.Styles=gn,l.THEME_COLORS=ms,l.TabStopAlignment=nn,l.TextDecoration=Rs,l.TextDirection=_t,l.TextDirectionType=Qs,l.TextX=jt,l.TextXActionType=C,l.ThemeColor=Ut,l.ThemeColorType=H,l.ThemeColors=Tt,l.ThemeService=Le,l.Tools=R,l.UndoCommand=xn,l.UndoCommandId=pn,l.Univer=qo,l.UniverEditablePermission=Vt,l.UniverEditablePermissionPoint=Fn,l.UniverInstanceType=Dn,l.UpdateDocsAttributeType=M,l.ValueIterator=vs,l.VerticalAlign=ot,l.WidthType=rn,l.Worksheet=Rt,l.WrapStrategy=ct,l.WrapTextType=Zs,l.b64DecodeUnicode=Ue,l.b64EncodeUnicode=oc,l.binarySearchArray=ss,l.cellToRange=oi,l.characterSpacingControlType=dn,l.checkForSubstrings=ci,l.checkParagraphHasBullet=ai,l.checkParagraphHasIndent=li,l.checkParagraphHasIndentByStyle=Cs,l.codeToBlob=br,l.composeBody=de,l.composeInterceptors=zn,l.concatMatrixArray=_i,l.createInterceptorKey=sc,l.createInternalEditorID=Po,l.createRowColIter=ce,l.debounce=Si,l.dedupe=_r,l.deepCompare=te,l.deleteContent=Ss,l.extractPureTextFromCell=io,l.fromCallback=ec,l.fromObservable=Rr,l.generateTemporarySnap=hc,l.getArrayLength=z,l.getBodySlice=_e,l.getBorderStyleType=ri,l.getCellValueType=Xi,l.getColorStyle=x,l.getDocsUpdateBody=Ht,l.getReverseDirection=Tr,l.getSheetBlocksFromSnapshot=gc,l.getTypeFromPermissionItemList=gi,l.getWorksheetUID=_o,l.groupBy=fr,l.handleJsonToDom=si,l.handleStyleToString=ni,l.hashAlgorithm=hi,l.horizontalLineSegmentsSubtraction=ee,l.insertMatrixArray=ne,l.insertTextToContent=Ns,l.isBlackColor=pr,l.isCellV=Qi,l.isEmptyCell=yr,l.isFormulaId=ei,l.isFormulaString=ti,l.isICellData=zi,l.isInternalEditorID=Ho,l.isNullCell=qi,l.isObserver=je,l.isRangesEqual=cr,l.isRealNum=ui,l.isSameStyleTextRun=As,l.isUnitRangesEqual=ar,l.isValidRange=ii,l.isWhiteColor=xr,l.makeCellRangeToRangeData=Zr,l.makeCellToSelection=Jr,l.mergeWorksheetSnapshotWithDefault=vn,l.moveMatrixArray=ie,l.normalizeTextRuns=le,l.numberToABC=Ii,l.numberToListABC=Ai,l.orderSearchArray=ns,l.queryObjectMatrix=Ui,l.remove=K,l.repeatStringNumTimes=Us,l.replaceInDocumentBody=Zo,l.requestImmediateMacroTask=Jo,l.rotate=Er,l.runOnLifecycle=Ae,l.searchArray=vr,l.selectionToArray=or,l.sequence=Fe,l.sequenceAsync=He,l.sequenceExecute=Qt,l.sequenceExecuteAsync=Sr,l.shallowEqual=lr,l.sliceMatrixArray=di,l.sortRules=Ci,l.sortRulesByDesc=Ni,l.sortRulesFactory=at,l.spliceArray=re,l.textDecoder=Kt,l.textEncoder=Ot,l.throttle=Qo,l.toDisposable=b,l.transformDocumentDataToSnapshot=fc,l.transformSnapshotToDocumentData=Ec,l.transformSnapshotToWorkbookData=dc,l.transformWorkbookDataToSnapshot=_c,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})});
1
+ (function(u,I){typeof exports=="object"&&typeof module<"u"?I(exports,require("rxjs"),require("@wendellhu/redi"),require("rxjs/operators")):typeof define=="function"&&define.amd?define(["exports","rxjs","@wendellhu/redi","rxjs/operators"],I):(u=typeof globalThis<"u"?globalThis:u||self,I(u.UniverCore={},u.rxjs,u["@wendellhu/redi"],u.rxjs.operators))})(this,function(u,I,A,nr){"use strict";var Ta=Object.defineProperty;var wa=(u,I,A)=>I in u?Ta(u,I,{enumerable:!0,configurable:!0,writable:!0,value:A}):u[I]=A;var _=(u,I,A)=>(wa(u,typeof I!="symbol"?I+"":I,A),A);var Na,Sa;function sr(){rr()}const Ot=typeof global<"u"?global:typeof self<"u"?self:window;function rr(){typeof Ot.requestIdleCallback!="function"&&(Ot.requestIdleCallback=function(e){const s=Date.now();return setTimeout(function(){const i=Math.max(0,50-(Date.now()-s));e({didTimeout:i===0,timeRemaining(){return i}})},1)}),typeof Ot.cancelIdleCallback!="function"&&(Ot.cancelIdleCallback=function(e){clearTimeout(e)})}function He(t,n){let e=0,s=t.length-1;for(;e<=s;){const r=Math.floor((s+e)/2);if(n<t[r]&&(r===0||n>=t[r-1]))return r;if(n>=t[r])e=r+1;else if(n<t[r])s=r-1;else return-1}return-1}function Fe(t,n){let e=0,s=0,r=0,i=-1,o=t.length-1;for(;e<t.length&&o>=0&&o>=e;){if(s=t[o],o===0?r=0:r=t[o-1],n>=r&&n<=s){i=o;break}if(s=t[e],e===0?r=0:r=t[e-1],n>=r&&n<s){i=e;break}e++,o--}return i}function ir(t,n){let e=t.length-1;return n<0?-1:n<t[0]?0:n>t[t.length-1]?Number.POSITIVE_INFINITY:(t.length<40||n<=t[20]||n>=t[e-20]?e=Fe(t,n):e=He(t,n),e)}function or(t){const n=new Blob([t],{type:"text/javascript"});return window.URL.createObjectURL(n)}var pe=(t=>(t[t.DEFAULT_SERIES=0]="DEFAULT_SERIES",t[t.ALTERNATE_SERIES=1]="ALTERNATE_SERIES",t))(pe||{}),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||{}),We=(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.TLBR="tlbr",t.TLBC_TLMR="tlbc_tlmr",t.TLBR_TLBC_TLMR="tlbr_tlbc_tlmr",t.BLTR="bl_tr",t.MLTR_BCTR="mltr_bctr",t))(We||{}),B=(t=>(t[t.UNSUPPORTED=0]="UNSUPPORTED",t[t.RGB=1]="RGB",t[t.HEX=2]="HEX",t[t.THEME=3]="THEME",t))(B||{}),Be=(t=>(t[t.ON=0]="ON",t[t.OFF=1]="OFF",t))(Be||{}),ke=(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))(ke||{}),Ge=(t=>(t[t.DOCUMENT=0]="DOCUMENT",t[t.PROJECT=1]="PROJECT",t))(Ge||{}),$e=(t=>(t[t.COLUMNS=0]="COLUMNS",t[t.ROWS=1]="ROWS",t))($e||{}),Ve=(t=>(t[t.UP=0]="UP",t[t.RIGHT=1]="RIGHT",t[t.DOWN=2]="DOWN",t[t.LEFT=3]="LEFT",t))(Ve||{});function ar(t){switch(t){case 3:return 1;case 1:return 3;case 0:return 2;case 2:return 0}}var xe=(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))(xe||{}),je=(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))(je||{}),Q=(t=>(t.EN_US="enUS",t.ZH_CN="zhCN",t))(Q||{}),Ke=(t=>(t[t.RANGE=0]="RANGE",t[t.SHEET=1]="SHEET",t))(Ke||{}),Ye=(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))(Ye||{}),ze=(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))(ze||{}),It=(t=>(t[t.GRID=0]="GRID",t[t.KANBAN=1]="KANBAN",t[t.GANTT=2]="GANTT",t))(It||{}),lt=(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))(lt||{}),ye=(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))(ye||{}),tt=(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))(tt||{}),it=(t=>(t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.TOP=1]="TOP",t[t.MIDDLE=2]="MIDDLE",t[t.BOTTOM=3]="BOTTOM",t))(it||{}),ut=(t=>(t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.OVERFLOW=1]="OVERFLOW",t[t.CLIP=2]="CLIP",t[t.WRAP=3]="WRAP",t))(ut||{}),At=(t=>(t[t.NORMAL=0]="NORMAL",t[t.ITALIC=1]="ITALIC",t))(At||{}),Nt=(t=>(t[t.NORMAL=0]="NORMAL",t[t.BOLD=1]="BOLD",t))(Nt||{}),ot=(t=>(t[t.NORMAL=1]="NORMAL",t[t.SUBSCRIPT=2]="SUBSCRIPT",t[t.SUPERSCRIPT=3]="SUPERSCRIPT",t))(ot||{}),O=(t=>(t[t.FALSE=0]="FALSE",t[t.TRUE=1]="TRUE",t))(O||{}),et=(t=>(t[t.STRING=1]="STRING",t[t.NUMBER=2]="NUMBER",t[t.BOOLEAN=3]="BOOLEAN",t[t.FORCE_STRING=4]="FORCE_STRING",t))(et||{}),W=(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))(W||{}),St=(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))(St||{});const Xe={[St.OFFICE]:{[W.ACCENT1]:"#4472C4",[W.ACCENT2]:"#ED7D31",[W.ACCENT3]:"#A5A5A5",[W.ACCENT4]:"#70AD47",[W.ACCENT5]:"#5B9BD5",[W.ACCENT6]:"#70AD47",[W.DARK1]:"#000000",[W.DARK2]:"#44546A",[W.LIGHT1]:"#FFFFFF",[W.LIGHT2]:"#E7E6E6",[W.HYPERLINK]:"#0563C1",[W.FOLLOWED_HYPERLINK]:"#954F72"}};class Lt{constructor(){_(this,"_themeValue",W.LIGHT1);_(this,"_themeColors");_(this,"_themeTint");_(this,"_rgbValue","");_(this,"_colorType");this._colorType=B.UNSUPPORTED,this._themeColors=St.OFFICE,this._themeTint=0}asRgbColor(){return new Tt(this._rgbValue,this)}asThemeColor(){return new wt(this._themeValue,this._themeTint,this._themeColors,this)}build(){switch(this._colorType){case B.THEME:return this.asThemeColor();case B.RGB:return this.asRgbColor();case B.UNSUPPORTED:throw new Error("unsupported color type")}}setRgbColor(n){return this._colorType=B.RGB,this._rgbValue=n,this}setThemeColors(n){this._colorType=B.THEME,this._themeColors=n}setThemeTint(n){this._colorType=B.THEME,this._themeTint=n}setThemeColor(n){return this._colorType=B.THEME,this._themeValue=n,this}getColorType(){return this._colorType}}class nt{constructor(n){_(this,"_builder");this._builder=n}static rgbColorToHexValue(n){return`#${((1<<24)+(n.getRed()<<16)+(n.getGreen()<<8)+n.getBlue()).toString(16).slice(1)}`}static hexValueToRgbColor(n){n?n.indexOf("#")>-1&&(n=n.substring(1)):n="#000000";const e=+`0x${n[0]}${n[1]}`,s=+`0x${n[2]}${n[3]}`,r=+`0x${n[4]}${n[5]}`;return new Lt().setRgbColor(`rgb(${e},${s},${r})`).asRgbColor()}static hexToRgbString(n){const e=/^#?([a-f\d])([a-f\d])([a-f\d])$/i;n=n.replace(e,(i,o,a,l)=>o+o+a+a+l+l);const s=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(n);let r=null;if(s){const i=Number.parseInt(s[1],16),o=Number.parseInt(s[2],16),a=Number.parseInt(s[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 nt(this._builder)}equals(n){return!1}}class qe{constructor(n){_(this,"_saturation",0);_(this,"_hue",0);_(this,"_lightness",0);_(this,"_alpha",0);const e=n.getRed()/255,s=n.getGreen()/255,r=n.getBlue()/255,i=n.getAlpha()/255,o=Math.min(e,Math.min(s,r)),a=Math.max(e,Math.max(s,r)),l=a-o;if(a===o){this._hue=0,this._saturation=0,this._lightness=a;return}this._lightness=(o+a)/2,this._lightness<.5?this._saturation=l/(a+o):this._saturation=l/(2-a-o),e===a&&(this._hue=(s-r)/l),s===a&&(this._hue=2+(r-e)/l),r===a&&(this._hue=4+(e-s)/l),this._hue*=60,this._hue<0&&(this._hue+=360),this._alpha=i}asRgbColor(){const n=new Lt;if(this._saturation===0)return n.setRgbColor(`rgba(${this._lightness*255},${this._lightness*255},${this._lightness*255},${this._alpha*255})`),n.asRgbColor();let e;this._lightness<.5?e=this._lightness*(1+this._saturation):e=this._lightness+this._saturation-this._lightness*this._saturation;const s=2*this._lightness-e,r=this._hue/360,i=r+1/3,o=this.setColor(e,s,i),a=this.setColor(e,s,r),l=r-1/3,c=this.setColor(e,s,l);return n.setRgbColor(`rgba(${Math.round(o*255)},${Math.round(a*255)},${Math.round(c*255)},${this._alpha*255})`),n.asRgbColor()}getLightness(){return this._lightness}getHue(){return this._hue}getSaturation(){return this._saturation}getAlpha(){return this._alpha}setColor(n,e,s){s<0&&(s+=1),s>1&&(s-=1);let r;return 6*s<1?r=e+(n-e)*6*s:2*s<1?r=n:3*s<2?r=e+(n-e)*(2/3-s)*6:r=e,r}setLightness(n){this._lightness=n}}const G=class G extends nt{constructor(e,s){super(s);_(this,"_cssString");_(this,"_red");_(this,"_green");_(this,"_blue");_(this,"_alpha");let r=e.match(G.RGBA_EXTRACT);if(r){const i=+r[1],o=+r[2],a=+r[3],l=+r[4];this._cssString=e,this._red=i,this._green=o,this._blue=a,this._alpha=l;return}if(r=e.match(G.RGB_EXTRACT),r){const i=+r[1],o=+r[2],a=+r[3];this._cssString=e,this._red=i,this._green=o,this._blue=a,this._alpha=1;return}throw new Error("Invalid rgba or rgb color")}asHexString(){return nt.rgbColorToHexValue(this)}getRed(){let e=this._red+G.RGB_COLOR_AMT;return e>255?e=255:e<0&&(e=0),e}getGreen(){let e=this._green+G.RGB_COLOR_AMT;return e>255?e=255:e<0&&(e=0),e}getBlue(){let e=this._blue+G.RGB_COLOR_AMT;return e>255?e=255:e<0&&(e=0),e}getAlpha(){return this._alpha}getColorType(){return B.RGB}clone(){return new G(this._cssString,this._builder)}asThemeColor(){throw new Error("rgb color not support to themeColor")}equals(e){return e instanceof G?e._red===this._red&&e._blue===this._blue&&e._green===this._green&&e._alpha===this._alpha:!1}getCssString(){return this._cssString}};_(G,"RGB_COLOR_AMT",0),_(G,"RGBA_EXTRACT",new RegExp("\\s*rgba\\s*\\((\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d.\\d|\\d\\s*)\\)\\s*")),_(G,"RGB_EXTRACT",new RegExp("\\s*rgb\\s*\\((\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d+\\s*)\\)\\s*"));let Tt=G;const q=class q extends nt{constructor(e,s,r,i){super(i);_(this,"_themeColorType");_(this,"_themeTint");_(this,"_themeColors");this._themeColorType=e,this._themeTint=s,this._themeColors=r}lumValue(e,s){if(e==null)return s;let r;return e<0?r=s*(1+e):r=s*(1-e)+(255-255*(1-e)),r}asRgbColor(){const e=Xe[this._themeColors];if(e==null)throw new Error("not find themeColors type");const s=e[this._themeColorType];if(s==null)throw new Error("not find themeColors value");let r;if(q._cacheThemeColor.has(this._themeColors)){if(r=q._cacheThemeColor.get(this._themeColors),r.has(this._themeColorType))return r.get(this._themeColorType)}else r=new Map,q._cacheThemeColor.set(this._themeColors,r);const i=new qe(nt.hexValueToRgbColor(s));i.setLightness(this.lumValue(this._themeTint,i.getLightness()*255)/255);const o=i.asRgbColor();return r.set(this._themeColorType,o),o}clone(){return new q(this._themeColorType,this._themeTint,this._themeColors,this._builder)}equals(e){return e instanceof q?e._themeColorType===this._themeColorType:!1}getColorType(){return B.THEME}getThemeColorType(){return this._themeColorType}};_(q,"_cacheThemeColor",new Map);let wt=q;const lr="rgb(",ur="rgba(",qt={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(n){_(this,"_color");_(this,"_rgbColor");_(this,"_isValid",!1);if(n==null){this._setNullColor();return}if(n instanceof $){this._color={...n._color},this._rgbColor={...n._rgbColor};return}const e=Je(n);if(e==null){this._setNullColor();return}this._color=e;const s=fr(this._color);if(s==null){this._setNullColor();return}this._rgbColor=s,this._isValid=!0}static mix(n,e,s){var c,h;s=Math.min(1,Math.max(0,s));const r=new $(n).toRgb(),i=new $(e).toRgb(),o=(c=r.a)!=null?c:1,a=(h=i.a)!=null?h:1,l={r:(i.r-r.r)*s+r.r,g:(i.g-r.g)*s+r.g,b:(i.b-r.b)*s+r.b,a:(a-o)*s+o};return new $(l)}static getContrastRatio(n,e){const s=new $(n).getLuminance(),r=new $(e).getLuminance();return(Math.max(s,r)+.05)/(Math.min(s,r)+.05)}get isValid(){return this._isValid}toRgb(){return this._rgbColor}toRgbString(){const{r:n,g:e,b:s,a:r=1}=this.toRgb(),i=r<1;return`rgb${i?"a":""}(${n},${e},${s}${i?`,${r}`:""})`}toString(){return this.toRgbString()}toHexString(n){const{r:e,g:s,b:r,a:i=1}=this.toRgb(),o=i<1,a=[bt(Math.round(e).toString(16)),bt(Math.round(s).toString(16)),bt(Math.round(r).toString(16)),bt(Math.round(i*255).toString(16))];return n&&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 mr(this.toRgb())}toHsl(){return Rr(this.toRgb())}lighten(n=10){const e=this.toHsl();return e.l+=n,e.l=Math.min(Math.max(e.l,0),100),new $(e)}darken(n=10){const e=this.toHsl();return e.l-=n,e.l=Math.min(Math.max(e.l,0),100),new $(e)}setAlpha(n){return new $({...this._rgbColor,a:n})}getLuminance(){let{r:n,g:e,b:s}=this.toRgb();return n=Jt(n),e=Jt(e),s=Jt(s),Number((.2126*n+.7152*e+.0722*s).toFixed(3))}getBrightness(){const{r:n,g:e,b:s}=this.toRgb();return(n*299+e*587+s*114)/1e3}getAlpha(){var n;return(n=this._color.a)!=null?n: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 bt=t=>t.length===1?`0${t}`:t,Jt=t=>(t/=255,t<=.03928?t/12.92:((t+.055)/1.055)**2.4),Je=t=>{if(Or(t)){if("r"in t){const s={r:Math.round(t.r),g:Math.round(t.g),b:Math.round(t.b)};return t.a!==void 0&&(s.a=t.a),s}if("l"in t){const s={h:Math.round(t.h),s:t.s,l:t.l};return t.a!==void 0&&(s.a=t.a),s}const e={h:Math.round(t.h),s:t.s,v:t.v};return t.a!==void 0&&(e.a=t.a),e}const n=t.trim();if(qt[n]){const e=qt[n],s={r:Math.round(e[0]),g:Math.round(e[1]),b:Math.round(e[2])};return s.a=e[3]||1,s}if(n.startsWith("#"))return cr(n);if(n.startsWith("rgb"))return hr(n);if(n.startsWith("hsl"))return dr(n);if(n.startsWith("hsv"))return _r(n)},cr=t=>{const n=t.substring(1),e=new RegExp(`.{1,${n.length>=6?2:1}}`,"g");let s=n.match(e);if(!s||s.length<3)throw new Error(`The color '${t}' is illegal hex color`);s[0].length===1&&(s=s.map(i=>i+i));const r={r:Number.parseInt(s[0],16),g:Number.parseInt(s[1],16),b:Number.parseInt(s[2],16)};return s.length>3&&(r.a=Number.parseInt(s[3],16)/255),r},hr=t=>{const n=t.indexOf("(");if(n===-1)throw new Error(`The color '${t}' is illegal rgb color`);const e=t.substring(n+1,t.length-1).split(",");if(e.length<3)throw new Error(`The color '${t}' is illegal rgb color`);const s={r:Number.parseInt(e[0],10),g:Number.parseInt(e[1],10),b:Number.parseInt(e[2],10)};return e.length>3&&(s.a=Number.parseFloat(e[3])),s},dr=t=>{const n=t.indexOf("(");if(n===-1)throw new Error(`The color '${t}' is illegal hsl color`);const e=t.substring(n+1,t.length-1).split(",");if(e.length<3)throw new Error(`The color '${t}' is illegal hsl color`);const s={h:Number.parseInt(e[0],10),s:Number.parseFloat(e[1]),l:Number.parseFloat(e[2])};return e.length>3&&(s.a=Number.parseFloat(e[3])),s},_r=t=>{const n=t.indexOf("(");if(n===-1)throw new Error(`The color '${t}' is illegal hsv color`);const e=t.substring(n+1,t.length-1).split(",");if(e.length<3)throw new Error(`The color '${t}' is illegal hsv color`);const s={h:Number.parseInt(e[0],10),s:Number.parseFloat(e[1]),v:Number.parseFloat(e[2])};return e.length>3&&(s.a=Number.parseFloat(e[3])),s},fr=t=>{const n=Je(t);if(n!=null)return"r"in n?n:"l"in n?Er(n):gr(n)},Zt=(t,n,e)=>(e<0&&(e+=1),e>1&&(e-=1),e<1/6?t+(n-t)*6*e:e<1/2?n:e<2/3?t+(n-t)*(2/3-e)*6:t),Er=t=>{let{h:n,s:e,l:s}=t;n/=360,e/=100,s/=100;let r=0,i=0,o=0;if(e===0)r=i=o=s;else{const l=s<.5?s*(1+e):s+e-s*e,c=2*s-l;r=Zt(c,l,n+1/3),i=Zt(c,l,n),o=Zt(c,l,n-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},gr=t=>{let{h:n,s:e,v:s}=t;n=n/360*6,e/=100,s/=100;const r=Math.floor(n),i=n-r,o=s*(1-e),a=s*(1-i*e),l=s*(1-(1-i)*e),c=r%6,h=[s,a,o,o,l,s][c],d=[l,s,s,a,o,o][c],f=[o,o,l,s,s,a][c],E={r:h*255,g:d*255,b:f*255};return t.a!==void 0&&(E.a=t.a),E},Rr=t=>{let{r:n,g:e,b:s}=t;n/=255,e/=255,s/=255;const r=Math.max(n,e,s),i=Math.min(n,e,s),o=(r+i)/2;let a,l;if(r===i)a=l=0;else{const h=r-i;switch(l=o>.5?h/(2-r-i):h/(r+i),r){case n:a=(e-s)/h+(e<s?6:0);break;case e:a=(s-n)/h+2;break;default:a=(n-e)/h+4;break}a/=6}const c={h:Math.round(a*360),s:Math.round(l*100),l:Math.round(o*100)};return t.a!==void 0&&(c.a=t.a),c},mr=t=>{let{r:n,g:e,b:s}=t;n/=255,e/=255,s/=255;const r=Math.max(n,e,s),i=Math.min(n,e,s);let o;const a=r,l=r-i,c=r===0?0:l/r;if(r===i)o=0;else{switch(r){case n:o=(e-s)/l+(e<s?6:0);break;case e:o=(s-n)/l+2;break;default:o=(n-e)/l+4;break}o/=6}const h={h:Math.round(o*360),s:Math.round(c*100),v:Math.round(a*100)};return t.a!==void 0&&(h.a=t.a),h},Cr=t=>t==null,Or=t=>!Cr(t)&&typeof t=="object";function Ir(t){const n=/^#(?:[0]{3}|[0]{6})\b/,e=/^rgb\s*\(\s*0+\s*,\s*0+\s*,\s*0+\s*\)$/,s=/^rgba\s*\(\s*0+\s*,\s*0+\s*,\s*0+\s*,\s*(1|1\.0*|0?\.\d+)\)$/,r=/^hsl\s*\(\s*0*\s*,\s*0%*\s*,\s*0%*\s*\)$/,i=/^hsla\s*\(\s*0*\s*,\s*0%*\s*,\s*0%*\s*,\s*(1|1\.0*|0?\.\d+)\)$/;return!!(n.test(t)||e.test(t)||s.test(t)||r.test(t)||i.test(t))}function Ar(t){const n=/^#(?:[Ff]{3}|[Ff]{6})\b/,e=/^rgb\s*\(\s*255\s*,\s*255\s*,\s*255\s*\)$/,s=/^rgba\s*\(\s*255\s*,\s*255\s*,\s*255\s*,\s*(1|1\.0*|0?\.\d+)\)$/,r=/^hsl\s*\(\s*0*\s*,\s*0%*\s*,\s*100%*\s*\)$/,i=/^hsla\s*\(\s*0*\s*,\s*0%*\s*,\s*100%*\s*,\s*(1|1\.0*|0?\.\d+)\)$/;return!!(n.test(t)||e.test(t)||s.test(t)||r.test(t)||i.test(t))}var H=(t=>(t[t.COVER=0]="COVER",t[t.REPLACE=1]="REPLACE",t[t.INTERSECTION=2]="INTERSECTION",t))(H||{});function Nr(t){return t&&(t.s!==void 0||t.p!==void 0||t.v!==void 0||t.t!==void 0||t.f!==void 0||t.si!==void 0)}function Sr(t){if(t.t!==void 0)return t.t;if(typeof t.v=="string")return et.STRING;if(typeof t.v=="number")return et.NUMBER;if(typeof t.v=="boolean")return et.BOOLEAN}function Lr(t){if(t==null)return!0;const{v:n,f:e,si:s,p:r,s:i}=t;return!(!(n==null||typeof n=="string"&&n.length===0)||e!=null&&e.length>0||s!=null&&s.length>0||r!=null)}function Tr(t){return t!=null&&(typeof t=="string"||typeof t=="number"||typeof t=="boolean")}var Ze=(t=>(t[t.character=0]="character",t[t.paragraph=1]="paragraph",t[t.table=2]="table",t[t.numbering=3]="numbering",t))(Ze||{}),Qe=(t=>(t[t.TAB=0]="TAB",t[t.SPACE=1]="SPACE",t[t.NOTHING=2]="NOTHING",t))(Qe||{}),ct=(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))(ct||{}),j=(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))(j||{}),tn=(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))(tn||{}),en=(t=>(t[t.DRAWING=0]="DRAWING",t[t.CUSTOM=1]="CUSTOM",t))(en||{}),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||{}),sn=(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))(sn||{}),rn=(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))(rn||{}),on=(t=>(t[t.NORMAL=0]="NORMAL",t[t.TBRL=1]="TBRL",t[t.LRTBV=2]="LRTBV",t))(on||{}),an=(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))(an||{}),ln=(t=>(t[t.BOTH_SIDES=0]="BOTH_SIDES",t[t.LEFT=1]="LEFT",t[t.RIGHT=2]="RIGHT",t[t.LARGEST=3]="LARGEST",t))(ln||{}),un=(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))(un||{}),cn=(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))(cn||{}),hn=(t=>(t[t.AUTO=0]="AUTO",t[t.AT_LEAST=1]="AT_LEAST",t[t.EXACT=2]="EXACT",t))(hn||{}),dn=(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))(dn||{}),_n=(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))(_n||{}),fn=(t=>(t.EVENLY_DISTRIBUTED="0",t.FIXED_WIDTH="1",t))(fn||{}),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||{}),gn=(t=>(t.NORMAL="normal",t.BOLD="bold",t.ITALIC="italic",t))(gn||{}),Rn=(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))(Rn||{}),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||{}),Cn=(t=>(t[t.POINT=0]="POINT",t[t.LINE=1]="LINE",t[t.CHARACTER=2]="CHARACTER",t))(Cn||{}),On=(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))(On||{}),In=(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))(In||{}),An=(t=>(t[t.compressPunctuation=0]="compressPunctuation",t[t.compressPunctuationAndJapaneseKana=1]="compressPunctuationAndJapaneseKana",t[t.doNotCompress=2]="doNotCompress",t))(An||{}),Nn=(t=>(t[t.PORTRAIT=0]="PORTRAIT",t[t.LANDSCAPE=1]="LANDSCAPE",t))(Nn||{}),p=(t=>(t[t.NORMAL=0]="NORMAL",t[t.ROW=1]="ROW",t[t.COLUMN=2]="COLUMN",t[t.ALL=3]="ALL",t))(p||{}),v=(t=>(t[t.NONE=0]="NONE",t[t.ROW=1]="ROW",t[t.COLUMN=2]="COLUMN",t[t.ALL=3]="ALL",t))(v||{});function wr(t){return[t.startRow,t.startColumn,t.endRow,t.endColumn]}var Qt=(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))(Qt||{}),Sn=(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))(Sn||{}),Ln=(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))(Ln||{});const br="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let vr=t=>crypto.getRandomValues(new Uint8Array(t)),Ur=(t,n,e)=>{let s=(2<<Math.log(t.length-1)/Math.LN2)-1,r=-~(1.6*s*n/t.length);return(i=n)=>{let o="";for(;;){let a=e(r),l=r;for(;l--;)if(o+=t[a[l]&s]||"",o.length===i)return o}}},Dr=(t,n=21)=>Ur(t,n,vr),Mr=(t=21)=>{let n="",e=crypto.getRandomValues(new Uint8Array(t));for(;t--;)n+=br[e[t]&63];return n};const Pr=/^-ms-/,Hr=/-([a-z])/g,K=["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(n){let e="",s=n;for(;s>=K.length;)s/=K.length,s-=1,e+=K[s%K.length];const r=n%K.length;return e+=K[r],e}static indexAt(n){let e=0;for(let s=0;s<n.length-1;s+=1){const r=n.charCodeAt(s)-65,i=n.length-1-s;e+=K.length**i+K.length*r}return e+=n.charCodeAt(n.length-1)-65,e}static deleteBlank(n){return m.isString(n)?n.replace(/\s/g,""):n}static getSystemType(){const n=navigator.userAgent,e=navigator.platform==="Win32"||navigator.platform==="Windows",s=navigator.platform==="Mac68K"||navigator.platform==="MacPPC"||navigator.platform==="Macintosh"||navigator.platform==="MacIntel";if(s)return"Mac";if(navigator.platform==="X11"&&!e&&!s)return"Unix";if(String(navigator.platform).indexOf("Linux")>-1)return"Linux";if(e){if(n.indexOf("Windows NT 5.0")>-1||n.indexOf("Windows 2000")>-1)return"Windows 2000";if(n.indexOf("Windows NT 5.1")>-1||n.indexOf("Windows XP")>-1)return"Windows XP";if(n.indexOf("Windows NT 5.2")>-1||n.indexOf("Windows 2003")>-1)return"Windows 2003";if(n.indexOf("Windows NT 6.0")>-1||n.indexOf("Windows Vista")>-1)return"Windows Vista";if(n.indexOf("Windows NT 6.1")>-1||n.indexOf("Windows 7")>-1)return"Windows 7";if(n.indexOf("Windows NT 10")>-1||n.indexOf("Windows 10")>-1)return"Windows 10";if(n.indexOf("Windows NT 11")>-1||n.indexOf("Windows 11")>-1)return"Windows 11"}return"Unknown system"}static getBrowserType(){const n=navigator.userAgent,e=n.indexOf("Opera")>-1,s=n.indexOf("compatible")>-1&&n.indexOf("MSIE")>-1&&!e,r=n.indexOf("Trident")>-1&&n.indexOf("rv:11.0")>-1,i=n.indexOf("Edge")>-1,o=n.indexOf("Firefox")>-1,a=n.indexOf("Safari")>-1&&n.indexOf("Chrome")===-1,l=n.indexOf("Chrome")>-1&&n.indexOf("Safari")>-1;if(s){new RegExp("MSIE (\\d+\\.\\d+);").test(n);const h=Number.parseFloat(RegExp.$1);return h===7?"IE7":h===8?"IE8":h===9?"IE9":h===10?"IE10":"0"}return o?"FF":e?"Opera":a?"Safari":l?"Chrome":i?"Edge":r?"IE11":"Unknown browser"}static generateRandomId(n=21,e){return e?Dr(e,n)():Mr(n)}static getClassName(n){return n.constructor.name}static deepMerge(n,...e){e.forEach(o=>o&&i(o));function s(o,a){o.forEach((l,c)=>{var h,d;if(m.isArray(l)){const f=(h=a[c])!=null?h:[];a[c]=f,s(l,f);return}if(m.isObject(l)){const f=(d=a[c])!=null?d:{};a[c]=f,r(l,f);return}a[c]=l})}function r(o,a){Object.keys(o).forEach(l=>{var h,d;const c=o[l];if(m.isObject(c)){const f=(h=a[l])!=null?h:{};a[l]=f,r(c,f);return}if(m.isArray(c)){const f=(d=a[l])!=null?d:[];a[l]=f,s(c,f);return}a[l]=c})}function i(o){Object.keys(o).forEach(a=>{var c,h;const l=o[a];if(m.isArray(l)){const d=(c=n[a])!=null?c:[];n[a]=d,s(l,d);return}if(m.isObject(l)){const d=(h=n[a])!=null?h:{};n[a]=d,r(l,d);return}n[a]=l})}return n}static numberFixed(n,e){return Number(Number(n).toFixed(e))}static diffValue(n,e){function s(o,a){const l=m.getValueType(o),c=m.getValueType(a);return l!==c?!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(n.length!==e.length)return!1;for(let l=0,c=o.length;l<c;l++){const h=o[l],d=a[l];if(!s(h,d))return!1}return!0}function i(o,a){const l=Object.keys(o),c=Object.keys(a);if(l.length!==c.length)return!1;for(const h of l){if(!c.includes(h))return!1;const d=o[h],f=a[h];if(!s(d,f))return!1}return!0}return s(n,e)}static deepClone(n){if(!this.isDefine(n))return n;if(this.isRegExp(n))return new RegExp(n);if(this.isDate(n))return new Date(n);if(this.isArray(n)){const e=[];return n.forEach((s,r)=>{e[r]=m.deepClone(s)}),e}if(this.isObject(n)){const e={};return Object.keys(n).forEach(s=>{const r=n[s];e[s]=m.deepClone(r)}),Object.setPrototypeOf(e,Object.getPrototypeOf(n)),e}return n}static getLanguage(){const n="en-US";return globalThis.navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||n}static getValueType(n){return Object.prototype.toString.apply(n)}static isDefine(n){return n!=null}static isBlank(n){return this.isDefine(n)?this.isString(n)?n.trim()==="":!1:!0}static isAssignableFrom(n,e){return n instanceof e}static isBoolean(n){return this.getValueType(n)==="[object Boolean]"}static isPlainObject(n){return this.isDefine(n)?Object.getPrototypeOf(n)===Object.getPrototypeOf({}):!1}static isFunction(n){return this.getValueType(n)==="[object Function]"}static isDate(n){return this.getValueType(n)==="[object Date]"}static isRegExp(n){return this.getValueType(n)==="[object RegExp]"}static isArray(n){return this.getValueType(n)==="[object Array]"}static isString(n){return this.getValueType(n)==="[object String]"}static isNumber(n){return this.getValueType(n)==="[object Number]"}static isStringNumber(n){return!isNaN(Number.parseFloat(n))&&isFinite(n)}static isObject(n){return this.getValueType(n)==="[object Object]"}static isEmptyObject(n){for(const e in n)return!1;return!0}static isMobile(){let n=0,e=0;return document.body.clientWidth&&(n=document.body.clientWidth),document.body.clientHeight&&(e=document.body.clientHeight),this.isAndroid()||this.isIPhone()||this.isTablet()||n<350&&e<500}static isTablet(){return/ipad|android|android 3.0|xoom|sch-i800|playbook|tablet|kindle/i.test(navigator.userAgent.toLowerCase())}static isWeChat(){const n=navigator.userAgent.toLowerCase();return String(n.match(/MicroMessenger/i))==="micromessenger"}static isAndroid(){const n=navigator.userAgent;return n.indexOf("Android")>-1||n.indexOf("Linux")>-1}static isIPhone(){return/iPhone/i.test(navigator.userAgent)}static itCount(n){return e=>{for(let s=0;s<n;s++)e&&e()}}static hasLength(n,e){return m.isDefine(n)?m.isDefine(e)?n.length===e:n.length>0:!1}static capitalize(n){return n.charAt(0).toUpperCase()+n.slice(1)}static fCamelCase(n,e){return e.toUpperCase()}static camelCase(n){return n.replace(Pr,"ms-").replace(Hr,this.fCamelCase)}static removeNull(n){return this.isObject(n)&&Object.keys(n).forEach(e=>{const s=n[e];s==null?delete n[e]:m.removeNull(s)}),n}static fillTwoDimensionalArray(n,e,s){return new Array(n).fill(s).map(r=>new Array(e).fill(s))}static numToWord(n){let e="";for(;n>0;){let s=n%26;s=s===0?s=26:s,e=String.fromCharCode(96+s)+e,n=(n-s)/26}return e.toLocaleUpperCase()}static ABCatNum(n){if(n==null||n.length===0)return Number.NaN;const e=n.toLowerCase().split(""),s=e.length;let r=0,i=0;for(let o=0;o<s;o++)i=e[o].charCodeAt(0)-96,r+=i*26**(s-o-1);return r===0?Number.NaN:r-1}static chatAtABC(n){let i="";for(;n>=0;)i=String.fromCharCode(n%26+97)+i,n=Math.floor(n/26)-1;return i.toUpperCase()}static randSort(n){for(let e=0,s=n.length;e<s;e++){const r=Number.parseInt((Math.random()*s).toString()),i=n[r];n[r]=n[e],n[e]=i}return n}static commonExtend(n,e){const s={};for(const r in n)s[r]=n[r];for(const r in e)e[r]!=null&&(s[r]=e[r]);return s}static commonExtend1(n,e){for(const s in n)e[s]==null&&(e[s]=n[s]);return e}static arrayToObject(n){const e={};return n.forEach((s,r)=>{e[r]={},s.forEach((i,o)=>{e[r][o]=i})}),e}static hasIntersectionBetweenTwoRanges(n,e,s,r){return e>=s&&r>=n}static isStartValidPosition(n){return/^[A-Za-z_]/.test(n)}static isValidParameter(n){const e=/[~!@#$%^&*()+=\-{}\[\]\|:;"'<>,?\/ ]+/.test(n),s=n.length<=255;return!e&&s}}function Fr(t){if(!t)return;const{actualRow:n,actualColumn:e,isMerged:s,isMergedMainCell:r,mergeInfo:i}=t;let{startY:o,endY:a,startX:l,endX:c}=t,h=n,d=e,f=n,E=e;if(s&&i){const{startRow:g,startColumn:R,endRow:C,endColumn:L,startY:P,endY:F,startX:Z,endX:La}=i;h=g,d=R,f=C,E=L,o=P,a=F,l=Z,c=La}return r&&(o=i.startY,a=i.endY,l=i.startX,c=i.endX,f=i.endRow,E=i.endColumn),{startRow:h,startColumn:d,endRow:f,endColumn:E,startY:o,endY:a,startX:l,endX:c}}function pr(t){if(!t)return;const{actualRow:n,actualColumn:e,isMerged:s,isMergedMainCell:r,startRow:i,startColumn:o,endRow:a,endColumn:l}=t;let c=n,h=e,d=n,f=e;return(s||r)&&(c=i,h=o,d=a,f=l),{startRow:c,startColumn:h,endRow:d,endColumn:f}}function Wr(t){var e;return!t||(((e=t==null?void 0:t.v)==null?void 0:e.toString())||"").length===0&&!t.p}function x(t){if(t){if(t.rgb)return t.rgb;if(t.th)return new Lt().setThemeColor(t.th).asThemeColor().asRgbColor().getCssString()}return null}function Br(t){return m.isString(t)&&t.substring(0,1)==="="&&t.length>1}function kr(t){return m.isString(t)&&t.length>0}function Gr(t){return""}function $r(t,n=!1){var i;let e="";const s=new Map([["ff",()=>{t.ff&&(e+=`font-family: ${t.ff}; `)}],["fs",()=>{if(t.fs){let o=t.fs;t.va&&(o/=2),e+=`font-size: ${o}pt; `}}],["it",()=>{t.it&&(e+="font-style: italic; ")}],["bl",()=>{t.bl&&(e+="font-weight: bold; ")}],["ul",()=>{var o;(o=t.ul)!=null&&o.s&&(e.indexOf("text-decoration-line")>-1?e=e.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g,(a,l)=>`${l} underline`):e+="text-decoration-line: underline; ",t.ul.cl&&e.indexOf("text-decoration-color")===-1&&(e+=`text-decoration-color: ${x(t.ul.cl)}; `),t.ul.t&&e.indexOf("text-decoration-style")===-1&&(e+=`text-decoration-style: ${t.ul.t} `))}],["st",()=>{var o;(o=t.st)!=null&&o.s&&(e.indexOf("text-decoration-line")>-1?e=e.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g,(a,l)=>`${l} line-through`):e+="text-decoration-line: line-through; ",t.st.cl&&e.indexOf("text-decoration-color")===-1&&(e+=`text-decoration-color: ${x(t.st.cl)}; `),t.st.t&&e.indexOf("text-decoration-style")===-1&&(e+=`text-decoration-style: ${t.st.t} `))}],["ol",()=>{var o;(o=t.ol)!=null&&o.s&&(e.indexOf("text-decoration-line")>-1?e=e.replace(/(text-decoration-line:\s*[^;]+)(?=;)/g,(a,l)=>`${l} overline`):e+="text-decoration-line: overline; ",t.ol.cl&&e.indexOf("text-decoration-color")===-1&&(e+=`text-decoration-color: ${x(t.ol.cl)}; `),t.ol.t&&e.indexOf("text-decoration-style")===-1&&(e+=`text-decoration-style: ${t.ol.t} `))}],["bg",()=>{t.bg&&(e+=`background: ${x(t.bg)}; `)}],["bd",()=>{var o,a,l,c,h,d,f,E,g,R,C,L;(o=t.bd)!=null&&o.b&&(e+=`border-bottom: ${vt((a=t.bd)==null?void 0:a.b.s)} ${(l=x(t.bd.b.cl))!=null?l:""}; `),(c=t.bd)!=null&&c.t&&(e+=`border-top: ${vt((h=t.bd)==null?void 0:h.t.s)} ${(d=x(t.bd.t.cl))!=null?d:""}; `),(f=t.bd)!=null&&f.r&&(e+=`border-right: ${vt((E=t.bd)==null?void 0:E.r.s)} ${(g=x(t.bd.r.cl))!=null?g:""}; `),(R=t.bd)!=null&&R.l&&(e+=`border-left: ${vt((C=t.bd)==null?void 0:C.l.s)} ${(L=x(t.bd.l.cl))!=null?L:""}; `)}],["cl",()=>{t.cl&&(e+=`color: ${x(t.cl)}; `)}],["va",()=>{t.va===ot.SUBSCRIPT?e+="vertical-align: sub; ":t.va===ot.SUPERSCRIPT&&(e+="vertical-align: super; ")}],["td",()=>{t.td===lt.LEFT_TO_RIGHT?e+="direction: ltr; ":t.td===lt.RIGHT_TO_LEFT&&(e+="direction: rtl; ")}],["tr",()=>{var o,a,l;t.tr&&(e+=`data-rotate: (${(o=t.tr)==null?void 0:o.a}deg${(a=t.tr)!=null&&a.v?` ,${(l=t.tr)==null?void 0:l.v}`:""});`)}],["ht",()=>{t.ht===tt.LEFT?e+="text-align: left; ":t.ht===tt.RIGHT?e+="text-align: right; ":t.ht===tt.CENTER?e+="text-align: center; ":t.ht===tt.JUSTIFIED&&(e+="text-align: justify; ")}],["vt",()=>{t.vt===it.BOTTOM?e+="vertical-align: bottom; ":t.vt===it.TOP?e+="vertical-align: top; ":t.vt===it.MIDDLE&&(e+="vertical-align: middle; ")}],["tb",()=>{t.tb===ut.CLIP?e+="white-space: clip; ":t.tb===ut.WRAP&&(e+="white-space: normal;")}],["pd",()=>{var h,d,f,E,g,R,C,L;const o=`${(h=t.pd)==null?void 0:h.b}pt`,a=`${(d=t.pd)==null?void 0:d.t}pt`,l=`${(f=t.pd)==null?void 0:f.l}pt`,c=`${(E=t.pd)==null?void 0:E.r}pt`;(g=t.pd)!=null&&g.b&&(e+=`padding-bottom: ${o}; `),(R=t.pd)!=null&&R.t&&(e+=`padding-top: ${a}; `),(C=t.pd)!=null&&C.l&&(e+=`padding-left: ${l}; `),(L=t.pd)!=null&&L.r&&(e+=`padding-right: ${c}; `)}]]),r=["bd","tr","tb"];for(const o in t)n&&r.includes(o)||(i=s.get(o))==null||i();return e}function vt(t){let n="";return t===w.NONE?n="none":t===w.THIN?n="0.5pt solid":t===w.HAIR?n="0.5pt double":t===w.DOTTED?n="0.5pt dotted":t===w.DASHED||t===w.DASH_DOT?n="0.5pt dashed":t===w.DASH_DOT_DOT?n="0.5pt dotted":t===w.DOUBLE?n="0.5pt double":t===w.MEDIUM?n="1pt solid":t===w.MEDIUM_DASHED||t===w.MEDIUM_DASH_DOT?n="1pt dashed":t===w.MEDIUM_DASH_DOT_DOT?n="1pt dotted":t===w.SLANT_DASH_DOT?n="0.5pt dashed":t===w.THICK&&(n="1.5pt solid"),n}function Vr(t){let n=0;if(t=t.trim(),t==="none")n=w.NONE;else if(t==="0.5pt solid")n=w.THIN;else if(t==="0.5pt double")n=w.HAIR;else if(t==="0.5pt dotted")n=w.DOTTED;else if(t==="0.5pt dashed")n=w.DASHED;else if(t==="1pt solid")n=w.MEDIUM;else if(t==="1pt dashed")n=w.MEDIUM_DASHED;else if(t==="1pt dotted")n=w.MEDIUM_DASH_DOT_DOT;else if(t==="1.5pt solid")n=w.THICK;else if(!t.includes("none"))n=w.THIN;else return w.NONE;return n}function Ut(t,n){let e=t.body;if(n){const{headers:s,footers:r}=t;s!=null&&s[n]?e=s[n].body:r!=null&&r[n]&&(e=r[n].body)}return e}function xr(t){const{startRow:n,endRow:e,startColumn:s,endColumn:r,rangeType:i}=t;return!(n<0||s<0||e<0||r<0||!(Number.isNaN(n)&&Number.isNaN(e))&&i===p.COLUMN||!(Number.isNaN(s)&&Number.isNaN(r))&&i===p.ROW)}function jr(t,n){return{startRow:t,endRow:t,startColumn:n,endColumn:n}}function te(t,n){return Object.prototype.toString.call(t)===Object.prototype.toString.call(n)?Object.prototype.toString.call(t)==="[object Object]"||Object.prototype.toString.call(t)==="[object Array]"?Object.keys(t).length!==Object.keys(n).length?!1:Object.keys(t).every(e=>te(t[e],n[e])):t===n:!1}function Tn(t,n){const e=t.ts||{},s=n.ts||{};return t.sId!==n.sId?!1:te(e,s)}function Kr(t,n){return n.some(e=>t.indexOf(e)>-1)}function ee(t,n,e,s){if(t>n&&([t,n]=[n,t]),e>s&&([e,s]=[s,e]),n<e||s<t)return[t,n];e<t&&(e=t),s>n&&(s=n);const r=s-e+1;let i=[];return t===e?i=[s+1-r,n-r]:n===s?i=[t,e-1]:i=[t,n-r],i}function Yr(t){if(t==null)return!1;const n=t.bullet;return(n==null?void 0:n.listId)!=null}function zr(t){if(t==null)return!1;const n=t.paragraphStyle;return wn(n)}function wn(t){return!(t==null||(t.indentStart==null||t.indentStart===0)&&t.hanging==null||t.hanging===0)}function bn(t,n,e){return t.slice(0,n)+e+t.slice(n)}function vn(t,n,e){return n>e?t:t.slice(0,n)+t.slice(e)}function yr(t){return t===null||t.toString().replace(/\s/g,"")===""||typeof t=="boolean"?!1:!isNaN(t)}function Xr(t){let n=0;for(let e=0;e<t.length;e++)n=t.charCodeAt(e)+(n<<6)+(n<<16)-n;return n>>>0}function Un(t){var n=typeof Symbol=="function"&&Symbol.iterator,e=n&&t[n],s=0;if(e)return e.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&s>=t.length&&(t=void 0),{value:t&&t[s++],done:!t}}};throw new TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")}function Dn(t,n){var e=typeof Symbol=="function"&&t[Symbol.iterator];if(!e)return t;var s=e.call(t),r,i=[],o;try{for(;(n===void 0||n-- >0)&&!(r=s.next()).done;)i.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(e=s.return)&&e.call(s)}finally{if(o)throw o.error}}return i}function Mn(t,n,e){if(e||arguments.length===2)for(var s=0,r=n.length,i;s<r;s++)(i||!(s in n))&&(i||(i=Array.prototype.slice.call(n,0,s)),i[s]=n[s]);return t.concat(i||Array.prototype.slice.call(n))}typeof SuppressedError=="function"&&SuppressedError;function ht(t){return typeof t=="function"}function qr(t){var n=function(s){Error.call(s),s.stack=new Error().stack},e=t(n);return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e}var ne=qr(function(t){return function(e){t(this),this.message=e?e.length+` errors occurred during unsubscription:
2
+ `+e.map(function(s,r){return r+1+") "+s.toString()}).join(`
3
+ `):"",this.name="UnsubscriptionError",this.errors=e}});function Pn(t,n){if(t){var e=t.indexOf(n);0<=e&&t.splice(e,1)}}var Hn=function(){function t(n){this.initialTeardown=n,this.closed=!1,this._parentage=null,this._finalizers=null}return t.prototype.unsubscribe=function(){var n,e,s,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=Un(o),l=a.next();!l.done;l=a.next()){var c=l.value;c.remove(this)}}catch(R){n={error:R}}finally{try{l&&!l.done&&(e=a.return)&&e.call(a)}finally{if(n)throw n.error}}else o.remove(this);var h=this.initialTeardown;if(ht(h))try{h()}catch(R){i=R instanceof ne?R.errors:[R]}var d=this._finalizers;if(d){this._finalizers=null;try{for(var f=Un(d),E=f.next();!E.done;E=f.next()){var g=E.value;try{Fn(g)}catch(R){i=i!=null?i:[],R instanceof ne?i=Mn(Mn([],Dn(i)),Dn(R.errors)):i.push(R)}}}catch(R){s={error:R}}finally{try{E&&!E.done&&(r=f.return)&&r.call(f)}finally{if(s)throw s.error}}}if(i)throw new ne(i)}},t.prototype.add=function(n){var e;if(n&&n!==this)if(this.closed)Fn(n);else{if(n instanceof t){if(n.closed||n._hasParent(this))return;n._addParent(this)}(this._finalizers=(e=this._finalizers)!==null&&e!==void 0?e:[]).push(n)}},t.prototype._hasParent=function(n){var e=this._parentage;return e===n||Array.isArray(e)&&e.includes(n)},t.prototype._addParent=function(n){var e=this._parentage;this._parentage=Array.isArray(e)?(e.push(n),e):e?[e,n]:n},t.prototype._removeParent=function(n){var e=this._parentage;e===n?this._parentage=null:Array.isArray(e)&&Pn(e,n)},t.prototype.remove=function(n){var e=this._finalizers;e&&Pn(e,n),n instanceof t&&n._removeParent(this)},t.EMPTY=function(){var n=new t;return n.closed=!0,n}(),t}();Hn.EMPTY;function Jr(t){return t instanceof Hn||t&&"closed"in t&&ht(t.remove)&&ht(t.add)&&ht(t.unsubscribe)}function Fn(t){ht(t)?t():t.unsubscribe()}class pn{constructor(n=!1){_(this,"skipNextObservers");_(this,"lastReturnValue");_(this,"isStopPropagation",!1);this.initialize(n)}initialize(n=!1){return this.skipNextObservers=n,this}stopPropagation(){this.isStopPropagation=!0}}function Wn(t){return t instanceof Dt}class Dt{constructor(n,e){_(this,"_willBeUnregistered",!1);_(this,"unregisterOnNextCall",!1);this.callback=n,this.observable=e}dispose(){this.observable.remove(this)}}class Mt{constructor(n){_(this,"_observers",new Array);_(this,"_eventState");_(this,"_onObserverAdded");this._eventState=new pn,n&&(this._onObserverAdded=n)}get observers(){return this._observers}add(n,e=!1,s=!1){if(!n)return null;const r=new Dt(n,this);return r.unregisterOnNextCall=s,e?this._observers.unshift(r):this._observers.push(r),this._onObserverAdded&&this._onObserverAdded(r),r}addOnce(n){return this.add(n,void 0,!0)}remove(n){return n&&this._observers.indexOf(n)!==-1?(this._deferUnregister(n),!0):!1}removeCallback(n){for(let e=0;e<this._observers.length;e++){const s=this._observers[e];if(!s._willBeUnregistered&&s.callback===n)return this._deferUnregister(s),!0}return!1}makeObserverTopPriority(n){this._remove(n),this._observers.unshift(n)}makeObserverBottomPriority(n){this._remove(n),this._observers.push(n)}notifyObservers(n){if(!this._observers.length)return null;const e=this._eventState;e.skipNextObservers=!1,e.lastReturnValue=n,e.isStopPropagation=!1;let s=!1;for(let r=0;r<this._observers.length;r++){const i=this._observers[r];if(!i._willBeUnregistered&&(e.lastReturnValue=i.callback(n,e),i.unregisterOnNextCall&&this._deferUnregister(i),e.isStopPropagation&&(s=!0),e.skipNextObservers))return{lastReturnValue:e.lastReturnValue,stopPropagation:s}}return{lastReturnValue:e.lastReturnValue,stopPropagation:s}}notifyObserversWithPromise(n){let e=Promise.resolve(n);if(!this._observers.length)return e;const s=this._eventState;s.skipNextObservers=!1;for(let r=0;r<this._observers.length;r++){const i=this._observers[r];s.skipNextObservers||i._willBeUnregistered||(e=e.then(()=>i.callback(n,s)),i.unregisterOnNextCall&&this._deferUnregister(i))}return e.then(()=>n)}notifyObserver(n,e){if(n._willBeUnregistered)return;const s=this._eventState;return s.skipNextObservers=!1,n.callback(e,s),n.unregisterOnNextCall&&this._deferUnregister(n),{lastReturnValue:s.lastReturnValue,stopPropagation:s.isStopPropagation}}hasObservers(){return this._observers.length>0}clear(){this._observers=new Array,this._onObserverAdded=null}clone(){const n=new Mt;return n._observers=this._observers.slice(0),n}_deferUnregister(n){n.unregisterOnNextCall=!1,n._willBeUnregistered=!0,setTimeout(()=>{this._remove(n)},0)}_remove(n){if(!n)return!1;const e=this._observers.indexOf(n);return e!==-1?(this._observers.splice(e,1),!0):!1}}function U(t){let n=!1;return t?Jr(t)?{dispose:()=>t.unsubscribe()}:Wn(t)?{dispose:()=>{n||(n=!0,t.dispose())}}:typeof t=="function"?{dispose:()=>{n||(n=!0,t())}}:t:U(()=>{})}function Zr(t){return U(()=>{t.unsubscribe()})}class se{constructor(){_(this,"_disposables",new Set)}add(n){const e=U(n);return this._disposables.add(e),{dispose:()=>{e.dispose(),this._disposables.delete(e)}}}dispose(){this._disposables.forEach(n=>{n.dispose()}),this._disposables.clear()}}class D{constructor(){_(this,"_disposed",!1);_(this,"_collection",new se)}disposeWithMe(n){return this._collection.add(n)}ensureNotDisposed(){if(this._disposed)throw new Error("[Disposable]: object is disposed!")}dispose(){this._disposed||(this._disposed=!0,this._collection.dispose())}}class Qr extends D{constructor(){super(...arguments);_(this,"dispose$",new I.Subject)}dispose(){super.dispose(),this.dispose$.next(),this.dispose$.complete()}}class dt{static hasLength(n,e){return n.length===e}static getValueType(n){return Object.prototype.toString.apply(n)}static isObject(n){return this.getValueType(n)==="[object Object]"}static isIterable(n){return n[Symbol.iterator]!=null}static isNumber(n){return this.getValueType(n)==="[object Number]"}}function Pt(t,n){const e=t.indexOf(n);return e>-1?(t.splice(e,1),!0):!1}function ti(t){const n=new Set,e=[];for(const s of t)n.has(s)||(n.add(s),e.push(s));return e}function ei(t,n){for(let e=t.length-1;e>-1;e--){const s=t[e];if(n(s,e))return s}return null}function ni(t,n){if(t.length===0)return t;const e=n%t.length;return t.slice(e).concat(t.slice(0,e))}function si(t,n){const e=new Map;return t.forEach(s=>{const r=n(s);let i=e.get(r);e.has(r)||(i=[],e.set(r,i)),i.push(s)}),e}const T=Symbol("newer"),M=Symbol("older");class Bn{constructor(n){_(this,"entry");this.entry=n}[Symbol.iterator](){return this}next(){const n=this.entry;return n?(this.entry=n[T],{done:!1,value:n.key}):{done:!0,value:void 0}}}class kn{constructor(n){_(this,"entry");this.entry=n}[Symbol.iterator](){return this}next(){const n=this.entry;return n?(this.entry=n[T],{done:!1,value:n.value}):{done:!0,value:void 0}}}class Gn{constructor(n){_(this,"entry");this.entry=n}[Symbol.iterator](){return this}next(){const n=this.entry;return n?(this.entry=n[T],{done:!1,value:[n.key,n.value]}):{done:!0,value:void 0}}}class re{constructor(n,e){_(this,"key");_(this,"value");_(this,Na);_(this,Sa);this.key=n,this.value=e,this[T]=void 0,this[M]=void 0}toJSON(){return{key:this.key,value:this.value}}}Na=T,Sa=M;class $n{constructor(...n){_(this,"_keymap");_(this,"size",0);_(this,"limit");_(this,"oldest");_(this,"newest");_(this,"_onShiftListeners",[]);if(dt.hasLength(n,1)){if(dt.isNumber(n[0])){const e=n[0];this._initialize(e,void 0);return}if(dt.isIterable(n[0])){const e=n[0];this._initialize(0,e);return}return}if(dt.hasLength(n,2)){const e=n[0],s=n[1];this._initialize(e,s)}}onShift(n){if(this._onShiftListeners.indexOf(n)===-1)return this._onShiftListeners.push(n),U(()=>Pt(this._onShiftListeners,n));throw new Error("[LRUMap]: the listener has been registered!")}_initialize(n,e){this.oldest=void 0,this.newest=void 0,this.size=0,this.limit=n,this._keymap=new Map,e&&(this.assign(e),n<1&&(this.limit=this.size))}_markEntryAsUsed(n){n!==this.newest&&(n[T]&&(n===this.oldest&&(this.oldest=n[T]),n[T][M]=n[M]),n[M]&&(n[M][T]=n[T]),n[T]=void 0,n[M]=this.newest,this.newest&&(this.newest[T]=n),this.newest=n)}assign(n){let e,s=this.limit||Number.MAX_VALUE;this._keymap.clear();const r=n[Symbol.iterator]();for(let i=r.next();!i.done;i=r.next()){const o=new re(i.value[0],i.value[1]);if(this._keymap.set(o.key,o),e?(e[T]=o,o[M]=e):this.oldest=o,e=o,s--===0)throw new Error("overflow")}this.newest=e,this.size=this._keymap.size}set(n,e){let s=this._keymap.get(n);return s?(s.value=e,this._markEntryAsUsed(s),this):(this._keymap.set(n,s=new re(n,e)),this.newest?(this.newest[T]=s,s[M]=this.newest):this.oldest=s,this.newest=s,++this.size,this.size>this.limit&&this.shift(),this)}shift(){const n=this.oldest;if(n)return this.oldest&&this.oldest[T]?(this.oldest=this.oldest[T],this.oldest[M]=void 0):(this.oldest=void 0,this.newest=void 0),n[T]=n[M]=void 0,this._keymap.delete(n.key),--this.size,this._onShiftListeners.forEach(e=>e(n)),[n.key,n.value]}get(n){const e=this._keymap.get(n);if(e)return this._markEntryAsUsed(e),e.value}has(n){return this._keymap.has(n)}find(n){const e=this._keymap.get(n);return e?e.value:void 0}delete(n){const e=this._keymap.get(n);if(e)return this._keymap.delete(e.key),e[T]&&e[M]?(e[M][T]=e[T],e[T][M]=e[M]):e[T]?(e[T][M]=void 0,this.oldest=e[T]):e[M]?(e[M][T]=void 0,this.newest=e[M]):this.oldest=this.newest=void 0,this.size--,e.value}clear(){this.oldest=void 0,this.newest=void 0,this.size=0,this._keymap.clear()}keys(){return new Bn(this.oldest)}values(){return new kn(this.oldest)}entries(){return this[Symbol.iterator]()}[Symbol.iterator](){return new Gn(this.oldest)}forEach(n,e){typeof e!="object"&&(e=this);let s=this.oldest;for(;s;)n.call(e,s.value,s.key,this),s=s[T]}toJSON(){const n=new Array(this.size);let e=0,s=this.oldest;for(;s;)n[e++]={key:s.key,value:s.value},s=s[T];return n}toString(){let n="",e=this.oldest;for(;e;)n+=`${String(e.key)}:${e.value}`,e=e[T],e&&(n+=" < ");return n}}function Y(t){let n=0;const e=Object.keys(t);for(const s of e){const r=Number(s);n=Math.max(n,r)}return n+1}function ie(t,n,e){const s=Y(e),r=e;for(let i=s-1;i>=t;i--)r[i+1]=r[i];r[t]=n}function oe(t,n,e){const s=Object.keys(e).reduce((r,i)=>Math.max(r,Number.parseInt(i)),0)+1;for(let r=t;r<s;r++)r<t+n?delete e[r]:e[r]!==void 0&&(e[r-n]=e[r],delete e[r])}function ri(t,n){const e=t,s=Object.keys(e),r=s.length,i=n,o=Object.keys(i),a=o.length,l={};let c=0;for(let h=0;h<r;h++,c++){const d=s[h];l[c]=e[d]}for(let h=0;h<a;h++,c++){const d=o[h];l[c]=i[d]}return l}function ii(t,n,e){const s=e;if(Y(e)>0){const i={};let o=0;for(let a=t;a<=n;a++)s[a]&&(i[o]=s[a],o++);return i}return{}}function ae(t,n,e,s){const r=t>e;if(!r&&t+n>e)throw new Error("Invalid move operation");r?oi(t,n,e,s):ai(t,n,e,s)}function oi(t,n,e,s){const r=s,i=[];for(let o=t;o<t+n;o++)i.push(r[o]);for(let o=t-1;o>=e;o--){const a=r[o];r[o+n]=a,a===void 0&&delete r[o+n]}i.forEach((o,a)=>{r[e+a]=o,o===void 0&&delete r[e+a]})}function ai(t,n,e,s){const r=s,i=[];for(let o=t;o<t+n;o++)i.push(r[o]);for(let o=t+n;o<e;o++){const a=r[o];r[o-n]=a,a===void 0&&delete r[o-n]}i.forEach((o,a)=>{r[e+a-n]=o,o===void 0&&delete r[e+a-n]})}class V{constructor(n={}){_(this,"_matrix");this._setOriginValue(n)}static MakeObjectMatrixSize(n){return new V({[n-1]:{}})}getMatrix(){return this._matrix}forEach(n){const e=this._matrix,s=Object.keys(e);for(const r of s){const i=Number(r),o=e[i];if(n(i,o)===!1)return this}return this}forRow(n){const e=this._matrix,s=Object.keys(e);for(const r of s){const i=Number(r),o=e[i];if(n(i,Object.keys(o).map(l=>Number(l)))===!1)return this}return this}forValue(n){const e=this._matrix,s=Object.keys(e);for(const r of s){const i=Number(r),o=e[i];if(!o)continue;const a=Object.keys(o);for(const l of a){const c=Number(l),h=o[Number(l)];if(n(i,c,h)===!1)return this}}return this}swapRow(n,e){const s=this._matrix[n],r=this._matrix[e];this._matrix[n]=r,this._matrix[e]=s}getRow(n){return this._matrix[n]}getRowOrCreate(n){let e=this.getRow(n);return e==null&&(e={},this._matrix[n]=e),e}reset(){this._setOriginValue({})}hasValue(){const n=this._matrix,e=Object.keys(n);if(e.length===0)return!1;for(const s of e){const r=Number(s),i=n[r];if(Object.keys(i).length>0)return!0}return!1}getValue(n,e){var s,r;return(r=(s=this._matrix)==null?void 0:s[n])==null?void 0:r[e]}setValue(n,e,s){const r=this.getRowOrCreate(n);r[e]=s}deleteValue(n,e){var s,r;(r=(s=this._matrix)==null?void 0:s[n])==null||delete r[e]}realDeleteValue(n,e){var s,r,i;if((r=(s=this._matrix)==null?void 0:s[n])==null||delete r[e],this.getRow(n)){const o=this.getRow(n);if(o==null)return;Object.keys(o).length===0&&((i=this._matrix)==null||delete i[n])}}setRow(n,e){this._matrix[n]=e}moveRows(n,e,s){ae(n,e,s,this._matrix)}moveColumns(n,e,s){this.forEach((r,i)=>{ae(n,e,s,i)})}insertRows(n,e){for(let s=n;s<n+e;s++)ie(s,{},this._matrix)}insertColumns(n,e){for(let s=n;s<n+e;s++)this.forEach((r,i)=>{ie(s,void 0,i)})}removeRows(n,e){oe(n,e,this._matrix)}removeColumns(n,e){this.forEach((s,r)=>{oe(n,e,r)})}getFragment(n,e,s,r){const i=new V;let o=0;for(let a=n;a<=e;a++){const l={};let c=0;for(let h=s;h<=r;h++){const d=this.getValue(a,h);l[c]=d,c++}i.setRow(o,l),o++}return i}getSlice(n,e,s,r){const i=new V;for(let o=n;o<=e;o++)for(let a=s;a<=r;a++){const l=this.getValue(o,a);l&&i.setValue(o,a,m.deepClone(l))}return i}getSizeOf(){return Object.keys(this._matrix).length}getLength(){return Y(this._matrix)}getRange(){const s=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 l=Y(a)-1;r=l>r?l:r}}return{startRow:0,startColumn:0,endRow:s,endColumn:r}}toNativeArray(){const n=new Array;return this.forValue((e,s,r)=>{n.push(r)}),n}toArray(){const n=[];return this.forRow((e,s)=>{n[e]==null&&(n[e]=[]),s.forEach(r=>{n[e][r]=this.getValue(e,r)})}),n}toFullArray(){const n=this.getRange(),{endColumn:e,endRow:s}=n,r=[];for(let i=0;i<=s;i++){const o=Array(e+1).fill(void 0);r.push(o)}return this.forValue((i,o,a)=>{r[i][o]=a}),r}toJSON(){return this._matrix}clone(){const n=JSON.stringify(this._matrix);return JSON.parse(n)}getData(){const n=JSON.stringify(this._matrix);return JSON.parse(n)}getArrayData(){let n=0,e=0,s=!1,r=!1;const i=new V;return this.forEach((o,a)=>{s||(s=!0,n=o),Object.keys(a).forEach(l=>{const c=Number(l);r?c<e&&(e=c):(r=!0,e=c);const h=this.getValue(o,c);i.setValue(o-n,c-e,h)})}),i.getData()}getDataRange(){let n=0,e=0,s=0,r=-1,i=!1,o=!1;return this.forEach((a,l)=>{if(i||(i=!0,n=a),l==null)return;const c=Y(l)-1;c>s&&(s=c),Object.keys(l).forEach(h=>{const d=Number(h);o?d<e&&(e=d):(o=!0,e=d)}),a>r&&(r=a)}),{startRow:n,startColumn:e,endRow:r,endColumn:s}}getDiscreteRanges(){const n=[];return this.forEach((e,s)=>{Object.keys(s).forEach(r=>{const i=Number(r);let o=!1;for(const a of n)if(e>=a.startRow&&e<=a.endRow+1&&i>=a.startColumn&&i<=a.endColumn+1){a.endRow=Math.max(e,a.endRow),a.endColumn=Math.max(i,a.endColumn),o=!0;break}o||n.push({startRow:e,endRow:e,startColumn:i,endColumn:i})})}),n}merge(n){this.forValue((e,s)=>{const r=n.getValue(e,s);r!=null&&this.setValue(e,s,r)})}_setOriginValue(n={}){this._matrix=n}}var le=(t=>(t.INIT="init",t.FETCHING="fetching",t.DONE="done",t))(le||{});class Vn{constructor(){_(this,"status","init")}}const li=t=>t.some(n=>n.status==="init")?"init":t.some(n=>n.status==="fetching")?"fetching":"done",J=class J{static clone(n){return n.rangeType!==void 0?{startRow:n.startRow,startColumn:n.startColumn,endRow:n.endRow,endColumn:n.endColumn,rangeType:n.rangeType}:{startRow:n.startRow,startColumn:n.startColumn,endRow:n.endRow,endColumn:n.endColumn}}static equals(n,e){return n==null||e==null?!1:n.endRow===e.endRow&&n.endColumn===e.endColumn&&n.startRow===e.startRow&&n.startColumn===e.startColumn&&(n.rangeType===e.rangeType||n.rangeType===void 0&&e.rangeType===p.NORMAL||e.rangeType===void 0&&n.rangeType===p.NORMAL)}static intersects(n,e){const s=n.startRow,r=n.endRow,i=n.startColumn,o=n.endColumn,a=e.startRow,l=e.endRow,c=e.startColumn,h=e.endColumn,d=Math.abs(i+o-c-h),f=Math.abs(i-o)+Math.abs(c-h),E=Math.abs(s+r-a-l),g=Math.abs(s-r)+Math.abs(a-l);return d<=f&&E<=g}static getIntersects(n,e){const s=n.startRow,r=n.endRow,i=n.startColumn,o=n.endColumn,a=e.startRow,l=e.endRow,c=e.startColumn,h=e.endColumn;let d,f,E,g;if(a<=r)a>=s?f=a:f=s;else return null;if(l>=s)l>=r?g=r:g=l;else return null;if(c<=o)c>i?d=c:d=i;else return null;if(h>=i)h>=o?E=o:E=h;else return null;return{startRow:f,endRow:g,startColumn:d,endColumn:E,rangeType:p.NORMAL}}static contains(n,e){return n.startRow<=e.startRow&&n.endRow>=e.endRow&&n.startColumn<=e.startColumn&&n.endColumn>=e.endColumn}static realContain(n,e){return J.contains(n,e)&&(n.startRow<e.startRow||n.endRow>e.endRow||n.startColumn<e.startColumn||n.endColumn>e.endColumn)}static union(...n){return n.reduce((e,s)=>({startRow:Math.min(e.startRow,s.startRow),startColumn:Math.min(e.startColumn,s.startColumn),endRow:Math.max(e.endRow,s.endRow),endColumn:Math.max(e.endColumn,s.endColumn),rangeType:p.NORMAL}),n[0])}static subtract(n,e){if(e.startRow>n.endRow||e.endRow<n.startRow||e.startColumn>n.endColumn||e.endColumn<n.startColumn)return[n];const s=[];e.startRow>=n.startRow&&s.push({startRow:n.startRow,startColumn:n.startColumn,endRow:e.startRow-1,endColumn:n.endColumn}),e.endRow<=n.endRow&&s.push({startRow:e.endRow+1,startColumn:n.startColumn,endRow:n.endRow,endColumn:n.endColumn});const r=Math.max(n.startRow,e.startRow),i=Math.min(n.endRow,e.endRow);return e.startColumn>=n.startColumn&&s.push({startRow:r,startColumn:n.startColumn,endRow:i,endColumn:e.startColumn-1}),e.endColumn<=n.endColumn&&s.push({startRow:r,startColumn:e.endColumn+1,endRow:i,endColumn:n.endColumn}),s.filter(a=>a.startRow<=a.endRow&&a.startColumn<=a.endColumn)}};_(J,"getRelativeRange",(n,e)=>({startRow:n.startRow-e.startRow,endRow:n.endRow-n.startRow,startColumn:n.startColumn-e.startColumn,endColumn:n.endColumn-n.startColumn})),_(J,"getPositionRange",(n,e,s)=>({...s||{},startRow:s&&[v.ROW,v.ALL].includes(s.startAbsoluteRefType||0)?s.startRow:n.startRow+e.startRow,endRow:s&&[v.ROW,v.ALL].includes(s.endAbsoluteRefType||0)?s.endRow:n.endRow+n.startRow+e.startRow,startColumn:s&&[v.COLUMN,v.ALL].includes(s.startAbsoluteRefType||0)?s.startColumn:n.startColumn+e.startColumn,endColumn:s&&[v.COLUMN,v.ALL].includes(s.endAbsoluteRefType||0)?s.endColumn:n.endColumn+n.startColumn+e.startColumn})),_(J,"moveHorizontal",(n,e=0,s=0)=>({...n,startColumn:n.startColumn+e,endColumn:n.endColumn+e+s})),_(J,"moveVertical",(n,e=0,s=0)=>({...n,startRow:n.startRow+e,endRow:n.endRow+e+s})),_(J,"moveOffset",(n,e,s)=>({...n,startRow:n.startRow+s,endRow:n.endRow+s,startColumn:n.startColumn+e,endColumn:n.endColumn+e}));let z=J;class ui{constructor(n,e){_(this,"_values",[]);_(this,"_keys",[]);_(this,"_keyMaps",new Map);this._values=n,this._keys=e,n.forEach(s=>{this._initKeyMap(s)})}_initKeyMap(n){this._keys.forEach(e=>{const s=n[e],r=this._keyMaps.get(e)||new Map;r.set(s,n),this._keyMaps.set(e,r)})}getValue(n,e){const s=e||this._keys;for(let r=0;r<s.length;r++){const i=this._keyMaps.get(s[r]);if(i!=null&&i.has(n))return i.get(n)}return null}hasValue(n){for(let e=0;e<this._keys.length;e++){const s=this._keyMaps.get(this._keys[e]);if(s!=null&&s.has(n))return!0}return!1}addValue(n){this._values.push(n),this._initKeyMap(n)}setValue(n,e,s){const r=this.getValue(n);r&&Object.keys(r).includes(e)&&(r[e]=s)}deleteValue(n){const e=this.getValue(n);if(e){this._keys.forEach(r=>{const i=this._keyMaps.get(r),o=e[r];i==null||i.delete(o)});const s=this._values.findIndex(r=>r===e);this._values.splice(s,1)}}getValues(){return this._values}getKeyMap(n){var e;return[...((e=this._keyMaps.get(n))==null?void 0:e.keys())||[]]}clear(){this._values=[],this._keys=[],this._keyMaps.clear()}}function ue(t,n,e,s){return{forEach(r){for(let i=t;i<=n;i++)for(let o=e;o<=s;o++)r(i,o)}}}function ci(t){if(t==null||t.length===0)return Number.NaN;const n=t.toLowerCase().split(""),e=n.length,s=o=>o.charCodeAt(0)-96;let r=0,i=0;for(let o=0;o<e;o++)i=s(n[o]),r+=i*26**(e-o-1);return r===0?Number.NaN:r-1}const Ht=65,xn=90,hi=97;function di(t){const n=xn-Ht+1;let e="";for(;t>=0;)e=String.fromCharCode(t%n+Ht)+e,t=Math.floor(t/n)-1;return e}function jn(t,n){let e="";for(;n>0;)e+=t,n--;return e}function _i(t,n=!1){const e=xn-Ht+1;let s=hi;n&&(s=Ht);const r=String.fromCharCode(t%e+s),i=Math.floor(t/e)+1;return jn(r,i)}function fi(t,n){return t.zIndex>n.zIndex?1:t.zIndex===n.zIndex?0:-1}function Ei(t,n){return t.zIndex>n.zIndex?-1:t.zIndex===n.zIndex?0:1}function at(t="index",n=1){return(e,s)=>e[t]>s[t]?n:e[t]===s[t]?0:-n}function gi(t,n){let e;return function(...s){const r=this,i=function(){e=null,t.apply(r,s)};clearTimeout(e),e=setTimeout(i,n)}}function Ft(t,n,e){const{dataStream:s,textRuns:r=[]}=t;let i=n;const o=[];for(const a of r){const{st:l,ed:c}=a;m.hasIntersectionBetweenTwoRanges(n,e,l,c)&&(l>i?(o.push(s.slice(i,l)),o.push(ce(s,{...a,ed:Math.min(c,e)}))):o.push(ce(s,{...a,st:i,ed:Math.min(c,e)}))),i=Math.max(n,Math.min(c,e))}return i!==e&&o.push(s.slice(i,e)),o.join("")}function Ri(t,n=!0){var e;if(n&&((e=t.paragraphs)!=null&&e.length)){const{dataStream:s,paragraphs:r=[]}=t;let i="",o=-1;for(const a of r){const{startIndex:l,paragraphStyle:c={}}=a,{spaceAbove:h,spaceBelow:d,lineSpacing:f}=c,E=[];h!=null&&(typeof h=="number"?E.push(`margin-top: ${h}px`):E.push(`margin-top: ${h.v}px`)),d!=null&&(typeof d=="number"?E.push(`margin-bottom: ${d}px`):E.push(`margin-bottom: ${d.v}px`)),f!=null&&E.push(`line-height: ${f}`),l>o+1?i+=`<p class="UniverNormal" ${E.length?`style="${E.join("; ")};"`:""}>${Ft(t,o+1,l)}</p>`:i+=`<p class="UniverNormal" ${E.length?`style="${E.join("; ")};"`:""}></p>`,o=l}return o!==s.length&&(i+=Ft(t,o,s.length)),i}else return Ft(t,0,t.dataStream.length)}function ce(t,n){const{st:e,ed:s,ts:r={}}=n,{ff:i,fs:o,it:a,bl:l,ul:c,st:h,ol:d,bg:f,cl:E,va:g}=r;let R=t.slice(e,s);const C=[];return a===O.TRUE&&(R=`<i>${R}</i>`),g===ot.SUPERSCRIPT?R=`<sup>${R}</sup>`:g===ot.SUBSCRIPT&&(R=`<sub>${R}</sub>`),(c==null?void 0:c.s)===O.TRUE&&(R=`<u>${R}</u>`),(h==null?void 0:h.s)===O.TRUE&&(R=`<s>${R}</s>`),l===O.TRUE&&(R=`<strong>${R}</strong>`),i&&C.push(`font-family: ${i}`),E&&C.push(`color: ${E.rgb}`),o&&C.push(`font-size: ${o}pt`),d&&C.push("text-decoration: overline"),f&&C.push(`background: ${f.rgb}`),C.length?`<span style="${C.join("; ")};">${R}</span>`:R}const _t={sheetId:"",range:{startRow:-1,endRow:-1,startColumn:-1,endColumn:-1}},mi={startRow:-1,startColumn:-1,endRow:-1,endColumn:-1},Ci={startRow:0,startColumn:0,endRow:0,endColumn:0},Oi={row:0,column:0},pt={ff:"Arial",fs:11,it:O.FALSE,bl:O.FALSE,ul:{s:O.FALSE},st:{s:O.FALSE},ol:{s:O.FALSE},tr:{a:0,v:O.FALSE},td:lt.UNSPECIFIED,cl:{rgb:"#000"},bg:{rgb:"#fff"},ht:tt.UNSPECIFIED,vt:it.UNSPECIFIED,tb:ut.UNSPECIFIED,pd:{t:0,r:0,b:0,l:0}},Kn={id:"default_slide",title:"defaultSlide",pageSize:{width:300,height:300}};var Yn=(t=>(t.ARRAY_CONVERTOR="ARRAY_CONVERTOR",t.MATRIX_CONVERTOR="MATRIX_CONVERTOR",t))(Yn||{});function Wt(t,n){const{textRuns:e=[]}=n;let s=0;for(const i of e){const{ts:o={},st:a,ed:l}=i;if(o[t]==null)return O.FALSE;switch(t){case"bl":case"it":{if(o[t]===O.FALSE)return O.FALSE;break}case"ul":case"st":{if(o[t].s===O.FALSE)return O.FALSE;break}default:throw new Error(`unknown style key: ${t} in IStyleBase`)}s+=l-a}return n.dataStream.indexOf(`\r
4
+ `)===s?O.TRUE:O.FALSE}class st{constructor(n,e,s){_(this,"_range");_(this,"_worksheet");this._deps=s,this._range=e,this._worksheet=n}static foreach(n,e){const{startRow:s,startColumn:r,endRow:i,endColumn:o}=n;for(let a=s;a<=i;a++)for(let l=r;l<=o;l++)e(a,l)}getRangeData(){return this._range}getValue(){return this.getValues()[0][0]}getValues(){const{startRow:n,endRow:e,startColumn:s,endColumn:r}=this._range,i=[];for(let o=n;o<=e;o++){const a=[];for(let l=s;l<=r;l++)a.push(this.getMatrix().getValue(o,l)||null);i.push(a)}return i}getMatrix(){const{startRow:n,endRow:e,startColumn:s,endColumn:r}=this._range,i=this._worksheet.getCellMatrix(),o=new V;for(let a=n;a<=e;a++)for(let l=s;l<=r;l++)o.setValue(a,l,i.getValue(a,l)||null);return o}getMatrixObject(){const{startRow:n,endRow:e,startColumn:s,endColumn:r}=this._range,i=this._worksheet.getCellMatrix(),o=new V;for(let a=n;a<=e;a++)for(let l=s;l<=r;l++)o.setValue(a-n,l-s,i.getValue(a,l)||{});return o}getA1Notation(){const{startRow:n,endRow:e,startColumn:s,endColumn:r}=this._range;let i,o;return s<r?(i=m.numToWord(s+1)+(n+1),o=m.numToWord(r+1)+(e+1)):(i=m.numToWord(r+1)+(e+1),o=m.numToWord(s+1)+(n+1)),i===o?`${i}`:`${i}:${o}`}getBackground(){return this.getBackgrounds()[0][0]}getBackgrounds(){const n=this._deps.getStyles();return this.getValues().map(e=>e.map(s=>{var i;const r=n.getStyleByCell(s);return((i=r==null?void 0:r.bg)==null?void 0:i.rgb)||pt.bg.rgb}))}getCell(n,e){const{startRow:s,endRow:r,startColumn:i,endColumn:o}=this._range,a={startRow:s+n,endRow:s+n,startColumn:i+e,endColumn:i+e};return new st(this._worksheet,a,this._deps)}getColumn(){return this._range.startColumn}getObjectValue(n={}){return this.getObjectValues(n)[0][0]}getObjectValues(n={}){var a;const{startRow:e,endRow:s,startColumn:r,endColumn:i}=this._range,o=this._worksheet.getCellMatrix().getFragment(e,s,r,i).getData();if(n.isIncludeStyle){const l=this._deps.getStyles();for(let c=0;c<=s-e;c++)for(let h=0;h<=i-r;h++){if(o==null||((a=o==null?void 0:o[c])==null?void 0:a[h])==null)continue;const d=o[c][h].s;d&&(o[c][h].s=l.get(d))}}return o}getFontColor(){return this.getFontColors()[0][0]}getFontColors(){const n=this._deps.getStyles();return this.getValues().map(e=>e.map(s=>{var i;const r=n.getStyleByCell(s);return((i=r==null?void 0:r.cl)==null?void 0:i.rgb)||pt.cl.rgb}))}getFontFamilies(){return this._getStyles("ff")}getFontFamily(){return this.getFontFamilies()[0][0]}getUnderlines(){return this._getStyles("ul")}getUnderline(){var e,s;const{p:n}=(e=this.getValue())!=null?e:{};return n&&Array.isArray((s=n.body)==null?void 0:s.textRuns)&&n.body.textRuns.length>0?Wt("ul",n.body)===O.TRUE?{s:O.TRUE}:{s:O.FALSE}:this.getUnderlines()[0][0]}getOverlines(){return this._getStyles("ol")}getOverline(){return this.getOverlines()[0][0]}getStrikeThrough(){var e,s;const{p:n}=(e=this.getValue())!=null?e:{};return n&&Array.isArray((s=n.body)==null?void 0:s.textRuns)&&n.body.textRuns.length>0?Wt("st",n.body)===O.TRUE?{s:O.TRUE}:{s:O.FALSE}:this.getStrikeThroughs()[0][0]}getStrikeThroughs(){return this._getStyles("st")}getFontSize(){var e,s;const{p:n}=(e=this.getValue())!=null?e:{};return n&&Array.isArray((s=n.body)==null?void 0:s.textRuns)&&n.body.textRuns.length>0?n.body.textRuns.some(r=>{var i;return((i=r==null?void 0:r.ts)==null?void 0:i.fs)!=null})?Math.max(...n.body.textRuns.map(r=>{var i;return((i=r==null?void 0:r.ts)==null?void 0:i.fs)||0})):this.getFontSizes()[0][0]:this.getFontSizes()[0][0]}getFontSizes(){return this._getStyles("fs")}getBorder(){return this.getBorders()[0][0]}getBorders(){return this._getStyles("bd")}getFontStyle(){var e,s;const{p:n}=(e=this.getValue())!=null?e:{};return n&&Array.isArray((s=n.body)==null?void 0:s.textRuns)&&n.body.textRuns.length>0?Wt("it",n.body)===O.TRUE?At.ITALIC:At.NORMAL:this._getFontStyles()[0][0]}_getFontStyles(){return this._getStyles("it")}getFontWeight(){var e,s;const{p:n}=(e=this.getValue())!=null?e:{};return n&&Array.isArray((s=n.body)==null?void 0:s.textRuns)&&n.body.textRuns.length>0?Wt("bl",n.body)===O.TRUE?Nt.BOLD:Nt.NORMAL:this._getFontWeights()[0][0]}_getFontWeights(){return this._getStyles("bl")}getGridId(){return this._worksheet.getSheetId()}getHeight(){const{_range:n,_worksheet:e}=this,{startRow:s,endRow:r}=n;let i=0;for(let o=0;o<=r-s;o++){const a=e.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:n,endColumn:e}=this._range;return e-n+1}getNumRows(){const{startRow:n,endRow:e}=this._range;return e-n+1}getRichTextValue(){return this.getRichTextValues()[0][0]}getRichTextValues(){return this.getValues().map(n=>n.map(e=>(e==null?void 0:e.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 n=this._deps.getStyles();return this.getValues().map(e=>e.map(s=>n.getStyleByCell(s)))}getVerticalAlignment(){return this.getVerticalAlignments()[0][0]}getVerticalAlignments(){return this._getStyles("vt")}getWidth(){const{_range:n,_worksheet:e}=this,{startColumn:s,endColumn:r}=n;let i=0;for(let o=0;o<=r-s;o++)i+=e.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(n){st.foreach(this._range,n)}_getStyles(n){const e=this._deps.getStyles();return this.getValues().map(s=>s.map(r=>{const i=e&&e.getStyleByCell(r);return i&&i[n]||pt[n]}))}}function Ii(t,n){if(t.length===0||t[0].length===0)return null;const e=new Array(t[0].length).fill(0);let s=0,r=null;for(let i=0;i<t.length;i++){for(let a=0;a<t[0].length;a++)e[a]=n(t[i][a])?e[a]+1:0;const o=Ai(e);o.area>s&&(s=o.area,r={startColumn:o.start,startRow:i-o.height+1,endColumn:o.end,endRow:i})}return r}function Ai(t){const n=[];let e=0,s={area:0,height:0,start:0,end:0},r=0;for(;r<t.length;)if(n.length===0||t[r]>=t[n[n.length-1]])n.push(r++);else{const i=t[n.pop()],o=n.length===0?r:r-n[n.length-1]-1;i*o>e&&(e=i*o,s={area:e,height:i,start:n.length===0?0:n[n.length-1]+1,end:r-1})}for(;n.length>0;){const i=t[n.pop()],o=n.length===0?r:r-n[n.length-1]-1;i*o>e&&(e=i*o,s={area:e,height:i,start:n.length===0?0:n[n.length-1]+1,end:r-1})}return s}function Ni(t,n){st.foreach(n,(e,s)=>{t[e][s]=void 0})}function Si(t,n){const e=t.toFullArray(),s=[];for(;;){const r=Ii(e,n);if(!r)break;s.push(r),Ni(e,r)}return s}function Li(t,n,e,s=!1){let r={...t};const i=r.startAbsoluteRefType||v.NONE,o=r.endAbsoluteRefType||v.NONE;return!s&&i===v.ALL&&o===v.ALL?r:s||i===v.NONE&&o===v.NONE?z.moveOffset(r,n,e):(i===v.NONE?r={...r,startRow:r.startRow+e,startColumn:r.startColumn+n}:i===v.COLUMN?r={...r,startRow:r.startRow+e}:i===v.ROW&&(r={...r,startColumn:r.startColumn+n}),o===v.NONE?r={...r,endRow:r.endRow+e,endColumn:r.endColumn+n}:o===v.COLUMN?r={...r,endRow:r.endRow+e}:o===v.ROW&&(r={...r,endColumn:r.endColumn+n}),r)}var k=(t=>(t[t.UNDEFINED=0]="UNDEFINED",t[t.OK=1]="OK",t[t.INTERNAL_ERROR=2]="INTERNAL_ERROR",t[t.PERMISSION_DENIED=3]="PERMISSION_DENIED",t[t.NOT_FOUND=4]="NOT_FOUND",t[t.UNAUTHENTICATED=5]="UNAUTHENTICATED",t[t.ALREADY_EXISTS=6]="ALREADY_EXISTS",t[t.INVALID_ARGUMENT=7]="INVALID_ARGUMENT",t[t.TOO_MANY_REQUESTS=8]="TOO_MANY_REQUESTS",t[t.CHANGESET_REVISION_CONFILICT=5001]="CHANGESET_REVISION_CONFILICT",t[t.SNAPSHOT_INVALID_SNAPSHOT=6001]="SNAPSHOT_INVALID_SNAPSHOT",t[t.APPLY_REJECT=7001]="APPLY_REJECT",t[t.APPLY_NON_SEQUENTIAL_REVISION=7002]="APPLY_NON_SEQUENTIAL_REVISION",t[t.APPLY_REVISION_CONFILICT=7003]="APPLY_REVISION_CONFILICT",t[t.CONNECTOR_DATA_TOO_LARGE=8001]="CONNECTOR_DATA_TOO_LARGE",t[t.LICENSE_MAX_UNITS_EXCEEDED=9001]="LICENSE_MAX_UNITS_EXCEEDED",t[t.LICENSE_MAX_MEMBERS_PER_UNIT_EXCEEDED=9002]="LICENSE_MAX_MEMBERS_PER_UNIT_EXCEEDED",t[t.LICENSE_IMPORT_SIZE_EXCEEDED=9003]="LICENSE_IMPORT_SIZE_EXCEEDED",t[t.LICENSE_EXPORT_SIZE_EXCEEDED=9004]="LICENSE_EXPORT_SIZE_EXCEEDED",t[t.LICENSE_DISTRO_REJECTED=9005]="LICENSE_DISTRO_REJECTED",t[t.UNRECOGNIZED=-1]="UNRECOGNIZED",t))(k||{});function zn(t){return!!(t&&t.code&&t.code!==k.OK&&t.code!=="OK")}var N=(t=>(t[t.UNIVER_UNKNOWN=0]="UNIVER_UNKNOWN",t[t.UNIVER_DOC=1]="UNIVER_DOC",t[t.UNIVER_SHEET=2]="UNIVER_SHEET",t[t.UNIVER_SLIDE=3]="UNIVER_SLIDE",t[t.UNRECOGNIZED=-1]="UNRECOGNIZED",t))(N||{});class Bt extends D{}class he{constructor(){_(this,"_data",[])}static create(){return new he}add(n){this._data.indexOf(n)>-1||this._data.push(n)}delete(n){const e=this._data.indexOf(n);this._data.splice(e,1)}getData(){return this._data}}class de{constructor(){_(this,"_data",new Map)}static create(){return new de}add(n,e){this._data.has(n)||this._data.set(n,e)}delete(n){this._data.delete(n)}getData(){return this._data}}class yn{constructor(){_(this,"cursor",0)}reset(){return this.cursor=0,this}moveCursor(n){this.cursor+=n}moveCursorTo(n){this.cursor=n}}var Xn=(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))(Xn||{}),_e=(t=>(t.PARAGRAPH="\r",t.SECTION_BREAK=`
5
+ `,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))(_e||{});function fe(t){const n=[];for(const e of t){const{st:s,ed:r,ts:i}=e;if(e.sId===void 0&&delete e.sId,s===r||m.isEmptyObject(i)&&e.sId==null)continue;if(n.length===0){n.push(e);continue}const o=n.pop();Tn(e,o)&&m.hasIntersectionBetweenTwoRanges(o.st,o.ed,e.st,e.ed)?n.push({...e,st:o.st,ed:r}):n.push(o,e)}return n}function qn(t,n,e,s){var c;const{textRuns:r}=t;if(r==null)return;const i=[],o=r.length;let a=!1;const l=(c=n.textRuns)!=null?c:[];if(l.length)for(let h=0,d=l.length;h<d;h++){const f=l[h];f.st+=s,f.ed+=s}for(let h=0;h<o;h++){const d=r[h],{st:f,ed:E}=d;if(E<s)i.push(d);else if(s>=f&&s<=E)if(a)d.st+=e,d.ed+=e,i.push(d);else{a=!0,d.ed+=e;const g=[];if(l.length){const R={...d,st:f,ed:l[0].st};g.push(R),g.push(...l);const C=l[l.length-1],L={...d,st:C.ed,ed:E+e};g.push(L)}else g.push(d);i.push(...g)}else d.st+=e,d.ed+=e,a||(a=!0,i.push(...l)),i.push(d)}a||(a=!0,i.push(...l)),t.textRuns=fe(i)}function Ee(t,n,e,s){const{paragraphs:r}=t;if(r==null)return;const{paragraphs:i,dataStream:o}=n,a=[];let l=-1;for(let h=0,d=r.length;h<d;h++){const f=r[h],{startIndex:E}=f;E>=s&&(f.startIndex+=e),l===-1&&E>=s&&(l=h),a.push(f.startIndex)}let c=-1;if(i){for(let h=0,d=i.length;h<d;h++){const f=i[h];f.startIndex+=s;const E=f.startIndex;c=a.indexOf(E)}if(o===_e.PARAGRAPH&&i.length===1){const h=r[l],d=i[0],f=h.paragraphStyle,E=h.bullet;h.paragraphStyle=d.paragraphStyle,h.bullet=d.bullet,d.paragraphStyle=f,d.bullet=E}c!==-1&&r.splice(c,1),r.push(...i),r.sort(at("startIndex"))}}function Ti(t,n,e,s){const{sectionBreaks:r}=t;if(r==null)return;for(let o=0,a=r.length;o<a;o++){const l=r[o],{startIndex:c}=l;c>=s&&(l.startIndex+=e)}const i=n.sectionBreaks;if(i){for(let o=0,a=i.length;o<a;o++){const l=i[o];l.startIndex+=s}r.push(...i),r.sort(at("startIndex"))}}function Jn(t,n,e,s){const{customBlocks:r}=t;if(r==null)return;for(let o=0,a=r.length;o<a;o++){const l=r[o],{startIndex:c}=l;c>=s&&(l.startIndex+=e)}const i=n.customBlocks;if(i){for(let o=0,a=i.length;o<a;o++){const l=i[o];l.startIndex+=s}r.push(...i),r.sort(at("startIndex"))}}function ge(t,n,e,s){const{tables:r}=t;if(r==null)return;for(let o=0,a=r.length;o<a;o++){const l=r[o],{startIndex:c,endIndex:h}=l;c>s?(l.startIndex+=e,l.endIndex+=e):h>=s-1&&(l.endIndex+=e)}const i=n.tables;if(i){for(let o=0,a=i.length;o<a;o++){const l=i[o];l.startIndex+=s,l.endIndex+=s}r.push(...i),r.sort(at("startIndex"))}}function wi(t,n,e,s){const{customRanges:r}=t;if(r==null)return;for(let o=0,a=r.length;o<a;o++){const l=r[o],{startIndex:c,endIndex:h}=l;c>s?(l.startIndex+=e,l.endIndex+=e):h>=s-1&&(l.endIndex+=e)}const i=n.customRanges;if(i){for(let o=0,a=i.length;o<a;o++){const l=i[o];l.startIndex+=s,l.endIndex+=s}r.push(...i),r.sort(at("startIndex"))}}function Zn(t,n,e){const{textRuns:s}=t,r=e,i=e+n,o=[];if(s){const a=[];for(let l=0,c=s.length;l<c;l++){const h=s[l],{st:d,ed:f}=h;if(r<=d&&i>=f){o.push({...h,st:d-r,ed:f-r});continue}else d<=r&&f>=i?(o.push({...h,st:r-r,ed:i-r}),h.ed-=n):r>=d&&r<f?(o.push({...h,st:r-r,ed:f-r}),h.ed=r):i>d&&i<=f?(o.push({...h,st:d-r,ed:i-r}),h.st=i-n,h.ed-=n):d>=i&&(h.st-=n,h.ed-=n);a.push(h)}t.textRuns=a}return o}function Qn(t,n,e){const{paragraphs:s}=t,r=e,i=e+n,o=[];if(s){const a=[];for(let l=0,c=s.length;l<c;l++){const h=s[l],{startIndex:d}=h;if(d>=r&&d<i){o.push({...h,startIndex:d-e});continue}else d>=i&&(h.startIndex-=n);a.push(h)}t.paragraphs=a}return o}function ts(t,n,e){const{sectionBreaks:s}=t,r=e,i=e+n-1,o=[];if(s){const a=[];for(let l=0,c=s.length;l<c;l++){const h=s[l],{startIndex:d}=h;if(d>=r&&d<=i){o.push({...h,startIndex:d-e});continue}else d>i&&(h.startIndex-=n);a.push(h)}t.sectionBreaks=a}return o}function es(t,n,e){const{customBlocks:s}=t,r=e,i=e+n-1,o=[];if(s){const a=[];for(let l=0,c=s.length;l<c;l++){const h=s[l],{startIndex:d}=h;if(d>=r&&d<=i){o.push({...h,startIndex:d-e});continue}else d>i&&(h.startIndex-=n);a.push(h)}t.customBlocks=a}return o}function ns(t,n,e){const{tables:s}=t,r=e,i=e+n-1,o=[];if(s){const a=[];for(let l=0,c=s.length;l<c;l++){const h=s[l],{startIndex:d,endIndex:f}=h;if(r<=d&&i>=f){o.push({...h,startIndex:d-e,endIndex:f-e});continue}else if(d<=r&&f>=i){const E=ee(d,f,r,i);h.startIndex=E[0],h.endIndex=E[1]}else i<d&&(h.startIndex-=n,h.endIndex-=n);a.push(h)}t.tables=a}return o}function ss(t,n,e){const{customRanges:s}=t,r=e,i=e+n-1,o=[];if(s){const a=[];for(let l=0,c=s.length;l<c;l++){const h=s[l],{startIndex:d,endIndex:f}=h;if(r<=d&&i>=f){o.push({...h,startIndex:d-e,endIndex:f-e});continue}else if(d<=r&&f>=i){const E=ee(d,f,r,i);h.startIndex=E[0],h.endIndex=E[1]}else i<d&&(h.startIndex-=n,h.endIndex-=n);a.push(h)}t.customRanges=a}return o}function bi(t,n,e){const{dataStream:s}=t,r=e,i=e+n,o=Zn(t,n,e),a=Qn(t,n,e),l=ts(t,n,e),c=es(t,n,e),h=ns(t,n,e),d=ss(t,n,e);let f="";return s&&(t.dataStream=vn(s,r,i),f=s.slice(r,i)),{dataStream:f,textRuns:o,paragraphs:a,sectionBreaks:l,customBlocks:c,tables:h,customRanges:d}}function vi(t,n,e,s){t.dataStream=bn(t.dataStream,s,n.dataStream),qn(t,n,e,s),Ee(t,n,e,s),Ti(t,n,e,s),Jn(t,n,e,s),ge(t,n,e,s),wi(t,n,e,s)}var kt=(t=>(t.BULLET_LIST="BULLET_LIST",t.ORDER_LIST="ORDER_LIST",t))(kt||{});const Ui={BULLET_LIST:{listType:"BULLET_LIST",nestingLevel:[{bulletAlignment:j.START,glyphFormat:" %0",textStyle:{fs:12},startNumber:0,glyphSymbol:"●",hanging:21,indentStart:21},{bulletAlignment:j.START,glyphFormat:" %1",textStyle:{fs:12},startNumber:0,glyphSymbol:"■",hanging:21,indentStart:42},{bulletAlignment:j.START,glyphFormat:" %1",textStyle:{fs:12},startNumber:0,glyphSymbol:"◆",hanging:21,indentStart:63}]},ORDER_LIST:{listType:"ORDER_LIST",nestingLevel:[{bulletAlignment:j.START,glyphFormat:" %1.",textStyle:{fs:12},startNumber:0,glyphType:ct.DECIMAL,hanging:21,indentStart:21},{bulletAlignment:j.START,glyphFormat:" %1.%2)",textStyle:{fs:12},startNumber:0,glyphType:ct.DECIMAL,hanging:21,indentStart:42},{bulletAlignment:j.START,glyphFormat:" %1.%2.%3.",textStyle:{fs:12},startNumber:0,glyphType:ct.DECIMAL,hanging:21,indentStart:63}]}};function Di(t,n,e,s,r){const i=Mi(t,n,e,s,r),o=Pi(t,n,e,s,r),a=Hi(t,n,e,s,r),l=Fi(t,n,e,s,r),c=pi(t,n,e,s,r),h=Wi(t,n,e,s,r);return{dataStream:"",textRuns:i,paragraphs:o,sectionBreaks:a,customBlocks:l,tables:c,customRanges:h}}function Mi(t,n,e,s,r){const{textRuns:i}=t,{textRuns:o}=n;if(i==null||o==null)return;const a=Zn(t,e,s);if(r!==H.REPLACE){const l=rs(o,a,r);n.textRuns=l}return qn(t,n,e,s),a}function rs(t,n,e){if(n.length===0)return t;t=m.deepClone(t),n=m.deepClone(n);const s=[],r=t.length,i=n.length;let o=0,a=0,l=null;function c(){return l?(s.push(l),l=null,!0):!1}for(;o<r&&a<i;){const{st:E,ed:g,ts:R}=t[o],{st:C,ed:L,ts:P,sId:F}=n[a];let Z;e===H.COVER?Z={...P,...R}:Z={...R,...P},g<C?(c()||s.push(t[o]),o++):L<E?(c()||s.push(n[a]),a++):(s.push({st:Math.min(E,C),ed:Math.max(E,C),ts:E<C?{...R}:{...P},sId:E<C?void 0:F}),s.push({st:Math.max(E,C),ed:Math.min(g,L),ts:Z,sId:F}),g<L?(o++,n[a].st=g):(a++,t[o].st=L),l={st:Math.min(g,L),ed:Math.max(g,L),ts:g<L?{...P}:{...R},sId:g<L?F:void 0})}c();const h=s[s.length-1],d=t[r-1],f=n[i-1];return h.ed!==Math.max(d.ed,f.ed)&&(d.ed>f.ed?s.push(d):s.push(f)),fe(s)}function Pi(t,n,e,s,r){const{paragraphs:i}=t,{paragraphs:o}=n;if(i==null||o==null)return;const a=Qn(t,e,s);if(r!==H.REPLACE){const l=[];for(const c of o){const{startIndex:h,paragraphStyle:d,bullet:f}=c;let E=[];for(const g of a){const{startIndex:R,paragraphStyle:C,bullet:L}=g;let P,F;if(r===H.COVER?(P={...C,...d},F={listId:"",listType:kt.BULLET_LIST,nestingLevel:0,textStyle:{},...L,...f}):(P={...d,...C},F={listId:"",listType:kt.BULLET_LIST,nestingLevel:0,textStyle:{},...f,...L}),h===R){E.push({startIndex:h,paragraphStyle:P,bullet:F});break}}l.push(...E),E=[]}n.paragraphs=l}return Ee(t,n,e,s),a}function Hi(t,n,e,s,r){const{sectionBreaks:i}=t,{sectionBreaks:o}=n;if(i==null||o==null)return;const a=ts(t,e,s);if(r!==H.REPLACE){const l=[];for(const c of o){const{startIndex:h}=c;let d=[];for(const f of a){const{startIndex:E}=f;if(h===E){r===H.COVER?d.push({...f,...c}):d.push({...c,...f});break}}l.push(...d),d=[]}n.sectionBreaks=l}return Ee(t,n,e,s),a}function Fi(t,n,e,s,r){const{customBlocks:i}=t,{customBlocks:o}=n;if(i==null||o==null)return;const a=es(t,e,s);if(r!==H.REPLACE){const l=[];for(const c of o){const{startIndex:h}=c;let d=[];for(const f of a){const{startIndex:E}=f;if(h===E){r===H.COVER?d.push({...f,...c}):d.push({...c,...f});break}}l.push(...d),d=[]}n.customBlocks=l}return Jn(t,n,e,s),a}function pi(t,n,e,s,r){const{tables:i}=t,{tables:o}=n;if(i==null||o==null)return;const a=ns(t,e,s);if(r!==H.REPLACE){const l=[];for(const c of o){const{startIndex:h,endIndex:d}=c;let f=[];for(const E of a){const{startIndex:g,endIndex:R}=E;if(g>=h&&R<=d){r===H.COVER?f.push({...E,...c}):f.push({...c,...E});break}}l.push(...f),f=[]}n.tables=l}return ge(t,n,e,s),a}function Wi(t,n,e,s,r){const{customRanges:i}=t,{tables:o}=n;if(i==null||o==null)return;const a=ss(t,e,s);if(r!==H.REPLACE){const l=[];for(const c of o){const{startIndex:h,endIndex:d}=c;let f=[];for(const E of a){const{startIndex:g,endIndex:R}=E;if(g>=h&&R<=d){r===H.COVER?f.push({...E,...c}):f.push({...c,...E});break}}l.push(...f),f=[]}n.customRanges=l}return ge(t,n,e,s),a}var S=(t=>(t.RETAIN="r",t.INSERT="i",t.DELETE="d",t))(S||{});function Re(t,n,e){const{dataStream:s,textRuns:r=[],paragraphs:i=[]}=t,o={dataStream:s.slice(n,e)},a=[];for(const c of r){const h=m.deepClone(c),{st:d,ed:f}=h;m.hasIntersectionBetweenTwoRanges(d,f,n,e)&&(n>=d&&n<=f?a.push({...h,st:n,ed:Math.min(e,f)}):e>=d&&e<=f?a.push({...h,st:Math.max(n,d),ed:e}):a.push(h))}a.length&&(o.textRuns=a.map(c=>{const{st:h,ed:d}=c;return{...c,st:h-n,ed:d-n}}));const l=[];for(const c of i){const{startIndex:h}=c;h>=n&&h<=e&&l.push(m.deepClone(c))}return l.length&&(o.paragraphs=l.map(c=>({...c,startIndex:c.startIndex-n}))),o}function me(t,n,e=H.COVER){if(n.dataStream!=="")throw new Error("Cannot compose other body with non-empty dataStream");const s={dataStream:t.dataStream},{textRuns:r=[],paragraphs:i=[]}=t,{textRuns:o=[],paragraphs:a=[]}=n,l=rs(o,r,e);l.length&&(s.textRuns=l);const c=[];let h=0,d=0;for(;h<i.length&&d<a.length;){const f=i[h],E=a[d],{startIndex:g}=f,{startIndex:R}=E;g===R?(c.push(m.deepMerge(f,E)),h++,d++):g<R?(c.push(m.deepClone(f)),h++):(c.push(m.deepClone(E)),d++)}return h<i.length&&c.push(...i.slice(h)),d<a.length&&c.push(...a.slice(d)),c.length&&(s.paragraphs=c),s}function Bi(t){const{body:n}=t;if(n==null)return!0;const{textRuns:e=[],paragraphs:s=[]}=n;return e.length===0&&s.length===0}function ki(t=m.generateRandomId(6),n=Q.EN_US,e=""){return{id:t,locale:n,title:e,body:{dataStream:`\r
6
+ `,textRuns:[],paragraphs:[{startIndex:0,paragraphStyle:{spaceAbove:5,lineSpacing:1,spaceBelow:0}}],sectionBreaks:[{startIndex:1}]},documentStyle:{pageSize:{width:793.3333333333334,height:1122.6666666666667},marginTop:50,marginBottom:50,marginRight:40,marginLeft:40,renderConfig:{vertexAngle:0,centerAngle:0}},settings:{}}}const Ce={id:"default_doc",documentStyle:{}};class Gi extends Bt{constructor(e){super();_(this,"type",N.UNIVER_DOC);_(this,"snapshot");this.snapshot={...Ce,...e}}getUnitId(){throw new Error("Method not implemented.")}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}}updateDocumentStyle(e){this.snapshot.documentStyle==null?this.snapshot.documentStyle=e:this.snapshot.documentStyle={...this.snapshot.documentStyle,...e}}updateDocumentDataMargin(e){const{t:s,l:r,b:i,r:o}=e,{documentStyle:a}=this.snapshot;s!=null&&(a.marginTop=s),r!=null&&(a.marginLeft=r),i!=null&&(a.marginBottom=i),o!=null&&(a.marginRight=o)}updateDocumentDataPageSize(e,s){const{documentStyle:r}=this.snapshot;if(!r.pageSize){e=e!=null?e:Number.POSITIVE_INFINITY,s=s!=null?s:Number.POSITIVE_INFINITY,r.pageSize={width:e,height:s};return}e!==void 0&&(r.pageSize.width=e),s!==void 0&&(r.pageSize.height=s)}updateDrawing(e,s){const{drawings:r}=this,{width:i,height:o,left:a,top:l}=s,c=r==null?void 0:r[e];if(!c)return;const h=c.objectTransform;h.size.width=i,h.size.height=o,h.positionH.posOffset=a,h.positionV.posOffset=l}setZoomRatio(e=1){this.snapshot.settings==null?this.snapshot.settings={zoomRatio:e}:this.snapshot.settings.zoomRatio=1}}class rt extends Gi{constructor(e){var r;super(m.isEmptyObject(e)?ki():e);_(this,"_unitId");_(this,"headerModelMap",new Map);_(this,"footerModelMap",new Map);const s=6;this._unitId=(r=this.snapshot.id)!=null?r:m.generateRandomId(s),this._initializeHeaderFooterModel()}dispose(){this.headerModelMap.forEach(e=>{e.dispose()}),this.footerModelMap.forEach(e=>{e.dispose()})}getRev(){var e;return(e=this.snapshot.rev)!=null?e:1}incrementRev(){this.snapshot.rev=this.getRev()+1}getSettings(){return this.snapshot.settings}reset(e){if(e.id&&e.id!==this._unitId)throw new Error("Cannot reset a document model with a different unit id!");this.snapshot={...Ce,...e},this._initializeHeaderFooterModel()}getSelfOrHeaderFooterModel(e){if(e!=null){if(this.headerModelMap.has(e))return this.headerModelMap.get(e);if(this.footerModelMap.has(e))return this.footerModelMap.get(e)}return this}getUnitId(){return this._unitId}apply(e){const s=[],r=new yn;return r.reset(),e.forEach(i=>{if(i=m.deepClone(i),i.t===S.RETAIN){const{coverType:o,body:a,len:l,segmentId:c}=i;if(a!=null){const h=this._updateApply(a,l,r.cursor,o,c);s.push({...i,t:S.RETAIN,coverType:H.REPLACE,body:h})}else s.push({...i,t:S.RETAIN});r.moveCursor(l)}else if(i.t===S.INSERT){const{body:o,len:a,segmentId:l,line:c}=i;this._insertApply(o,a,r.cursor,l),r.moveCursor(a),s.push({t:S.DELETE,len:a,line:c,segmentId:l})}else if(i.t===S.DELETE){const{len:o,segmentId:a}=i,l=this._deleteApply(o,r.cursor,a);s.push({...i,t:S.INSERT,body:l})}else throw new Error(`Unknown action type for action: ${i}.`)}),s}sliceBody(e,s){const r=this.getBody();if(r!=null)return Re(r,e,s)}_updateApply(e,s,r,i=H.COVER,o){if(e==null)throw new Error("updateBody is none");const a=this.snapshot,l=Ut(a,o);if(l==null)throw new Error("no body has changed");return Di(l,e,s,r,i)}_deleteApply(e,s,r){const i=this.snapshot,o=Ut(i,r);if(o==null)throw new Error("no body has changed");return e<=0?{dataStream:""}:bi(o,e,s)}_insertApply(e,s,r,i){const o=this.snapshot,a=Ut(o,i);if(s!==0){if(a==null)throw new Error("no body has changed");vi(a,e,s,r)}}_initializeHeaderFooterModel(){const{headers:e,footers:s}=this.getSnapshot();if(e)for(const r in e){const i=e[r];this.headerModelMap.set(r,new rt(i))}if(s)for(const r in s){const i=s[r];this.footerModelMap.set(r,new rt(i))}}updateDocumentId(e){super.updateDocumentId(e),this._unitId=e}}async function is(t){for(const[n,e]of t.entries())try{if(!await e())return{index:n,result:!1}}catch(s){return{index:n,result:!1,error:s}}return{result:!0,index:-1}}function os(t){for(const[n,e]of t.entries())try{if(!e())return{index:n,result:!1}}catch(s){return{index:n,result:!1,error:s}}return{result:!0,index:-1}}const ft=A.createIdentifier("univer.context-service");class as extends D{constructor(){super(...arguments);_(this,"_contextChanged$",new I.Subject);_(this,"contextChanged$",this._contextChanged$.asObservable());_(this,"_contextMap",new Map)}dispose(){super.dispose(),this._contextChanged$.complete()}getContextValue(e){var s;return(s=this._contextMap.get(e))!=null?s:!1}setContextValue(e,s){this._contextMap.set(e,s),this._contextChanged$.next({[e]:s})}subscribeContextValue$(e){return new I.Observable(s=>{const r=this._contextChanged$.pipe(I.filter(i=>typeof i[e]<"u")).subscribe(i=>s.next(i[e]));return this._contextMap.has(e)&&s.next(this._contextMap.get(e)),()=>r.unsubscribe()})}}var ls=(t=>(t[t.SILENT=0]="SILENT",t[t.ERROR=1]="ERROR",t[t.WARN=2]="WARN",t[t.INFO=3]="INFO",t[t.VERBOSE=4]="VERBOSE",t))(ls||{});const y=A.createIdentifier("univer.log");class us extends D{constructor(){super(...arguments);_(this,"_logLevel",3)}debug(...e){this._logLevel>=4&&this._log(console.debug,...e)}log(...e){this._logLevel>=3&&this._log(console.log,...e)}warn(...e){this._logLevel>=2&&this._log(console.warn,...e)}error(...e){this._logLevel>=1&&this._log(console.error,...e)}setLogLevel(e){this._logLevel=e}_log(e,...s){const r=s[0];/^\[(.*?)\]/g.test(r)?e(`\x1B[97;104m${r}\x1B[0m`,...s.slice(1)):e(...s)}}var $i=Object.defineProperty,Vi=Object.getOwnPropertyDescriptor,xi=(t,n,e,s)=>{for(var r=s>1?void 0:s?Vi(n,e):n,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(s?o(n,e,r):o(r))||r);return s&&r&&$i(n,e,r),r},cs=(t,n)=>(e,s)=>n(e,s,t),Gt=(t=>(t[t.COMMAND=0]="COMMAND",t[t.OPERATION=1]="OPERATION",t[t.MUTATION=2]="MUTATION",t))(Gt||{});const Et=A.createIdentifier("anywhere.command-service");class ji{constructor(){_(this,"_commands",new Map)}registerCommand(n){if(this._commands.has(n.id))throw new Error(`[CommandRegistry]: command "${n.id}" has been registered before.`);return this._commands.set(n.id,n),U(()=>{var e;this._commands.delete(n.id),(e=n.onDispose)==null||e.call(n)})}hasCommand(n){return this._commands.has(n)}getCommand(n){return this._commands.has(n)?[this._commands.get(n)]:null}}const hs={id:"nil",type:0,handler:()=>!0};u.CommandService=class{constructor(n,e){_(this,"_commandRegistry");_(this,"_beforeCommandExecutionListeners",[]);_(this,"_commandExecutedListeners",[]);_(this,"_multiCommandDisposables",new Map);_(this,"_commandExecutingLevel",0);_(this,"_commandExecutionStack",[]);this._injector=n,this._logService=e,this._commandRegistry=new ji,this._registerCommand(hs)}hasCommand(n){return this._commandRegistry.hasCommand(n)}registerCommand(n){return this._registerCommand(n)}registerMultipleCommand(n){return this._registerMultiCommand(n)}beforeCommandExecuted(n){if(this._beforeCommandExecutionListeners.indexOf(n)===-1)return this._beforeCommandExecutionListeners.push(n),U(()=>{const e=this._beforeCommandExecutionListeners.indexOf(n);this._beforeCommandExecutionListeners.splice(e,1)});throw new Error("[CommandService]: could not add a listener twice.")}onCommandExecuted(n){if(this._commandExecutedListeners.indexOf(n)===-1)return this._commandExecutedListeners.push(n),U(()=>{const e=this._commandExecutedListeners.indexOf(n);this._commandExecutedListeners.splice(e,1)});throw new Error("[CommandService]: could not add a listener twice.")}async executeCommand(n,e,s){const r=this._commandRegistry.getCommand(n);if(r){const[i]=r,o={id:i.id,type:i.type,params:e},a=this._pushCommandExecutionStack(o);this._beforeCommandExecutionListeners.forEach(c=>c(o,s));const l=await this._execute(i,e,s);return this._commandExecutedListeners.forEach(c=>c(o,s)),a.dispose(),l}throw new Error(`[CommandService]: command "${n}" is not registered.`)}syncExecuteCommand(n,e,s){var i;const r=this._commandRegistry.getCommand(n);if(r){const[o]=r,a={id:o.id,type:o.type,params:e};if(o.type===2){const h=ei(this._commandExecutionStack,d=>d.type===0);h&&(a.params=(i=a.params)!=null?i:{},a.params.trigger=h.id)}const l=this._pushCommandExecutionStack(a);this._beforeCommandExecutionListeners.forEach(h=>h(a,s));const c=this._syncExecute(o,e,s);return this._commandExecutedListeners.forEach(h=>h(a,s)),l.dispose(),c}throw new Error(`[CommandService]: command "${n}" is not registered.`)}_pushCommandExecutionStack(n){return this._commandExecutionStack.push(n),U(()=>Pt(this._commandExecutionStack,n))}_registerCommand(n){return this._commandRegistry.registerCommand(n)}_registerMultiCommand(n){const e=this._commandRegistry.getCommand(n.id);let s;if(e){if(e[0].multi!==!0)throw new Error("Command has registered as a single command.");s=e[0]}else{const i=new se;s=new Ki(n.id),i.add(this._commandRegistry.registerCommand(s)),i.add(U(()=>{this._multiCommandDisposables.delete(n.id)})),this._multiCommandDisposables.set(n.id,i)}const r=s.registerImplementation(n);return U(()=>{var i;r.dispose(),s.hasImplementations()||(i=this._multiCommandDisposables.get(n.id))==null||i.dispose()})}async _execute(n,e,s){this._logService.debug("[CommandService]",`${"|-".repeat(Math.max(this._commandExecutingLevel,0))}executing command "${n.id}"`),this._commandExecutingLevel++;let r;try{r=await this._injector.invoke(n.handler,e,s),this._commandExecutingLevel--}catch(i){throw r=!1,this._commandExecutingLevel=0,i}return r}_syncExecute(n,e,s){this._logService.debug("[CommandService]",`${"|-".repeat(Math.max(0,this._commandExecutingLevel))}executing command "${n.id}".`),this._commandExecutingLevel++;let r;try{if(r=this._injector.invoke(n.handler,e,s),r instanceof Promise)throw new TypeError("[CommandService]: Command handler should not return a promise.");this._commandExecutingLevel--}catch(i){throw r=!1,this._commandExecutingLevel=0,i}return r}},u.CommandService=xi([cs(0,A.Inject(A.Injector)),cs(1,y)],u.CommandService);class Ki{constructor(n){_(this,"name");_(this,"multi",!0);_(this,"type",0);_(this,"priority",0);_(this,"_implementations",[]);_(this,"handler",async(n,e)=>{if(!this._implementations.length)return!1;const s=n.get(y),r=n.get(ft),i=n.get(A.Injector);for(const o of this._implementations){const a=o.command.preconditions;if((!a||a&&a(r))&&(s.debug("[MultiCommand]",`executing implementation "${o.command.name}".`),await i.invoke(o.command.handler,e)))return!0}return!1});this.id=n,this.name=n}registerImplementation(n){const e={command:n};return this._implementations.push(e),this._implementations.sort((s,r)=>r.command.priority-s.command.priority),U(()=>{var r;const s=this._implementations.indexOf(e);this._implementations.splice(s,1),(r=n.onDispose)==null||r.call(n)})}hasImplementations(){return this._implementations.length>0}}function Oe(t,n,e){const s=t.map(r=>()=>n.syncExecuteCommand(r.id,r.params,e));return os(s)}function Yi(t,n,e){const s=t.map(r=>()=>n.executeCommand(r.id,r.params,e));return is(s)}const ds=A.createIdentifier("univer.config-service");class _s{constructor(){_(this,"_config",new Map)}getConfig(n){return this._config.get(n)}setConfig(n,e){this._config.set(n,e)}deleteConfig(n){this._config.delete(n)}}class fs extends D{constructor(){super(...arguments);_(this,"_error$",new I.Subject);_(this,"error$",this._error$.asObservable())}dispose(){this._error$.complete()}emit(e){this._error$.next({errorKey:e})}}const zi="__default_document_sub_component_id20231101__";class Es{constructor(){_(this,"_managerInfo",new Map);_(this,"_remove$",new I.Subject);_(this,"remove$",this._remove$.asObservable());_(this,"_andOrUpdate$",new I.Subject);_(this,"andOrUpdate$",this._andOrUpdate$.asObservable());_(this,"_pluginUpdate$",new I.Subject);_(this,"pluginUpdate$",this._pluginUpdate$.asObservable())}getFloatObject(n){return this._getFloatingObject(n)}getFloatObjects(n){return this._getFloatingObjects(n)}dispose(){this._remove$.complete(),this._andOrUpdate$.complete(),this._pluginUpdate$.complete(),this._managerInfo.clear()}clear(n){const e=this._clearByParam(n);this._remove$.next(e)}addOrUpdate(n){const e=this._addByParam(n);this._andOrUpdate$.next(e)}BatchAddOrUpdate(n){const e=[];n.forEach(s=>{e.push(...this._addByParam(s))}),this._andOrUpdate$.next(e)}remove(n){const e=this._removeByParam(n);this._remove$.next(e)}pluginUpdateRefresh(n){this._pluginUpdate$.next(n)}_getFloatingObjects(n){var r;if(n==null)return;const{unitId:e,subUnitId:s}=n;return(r=this._managerInfo.get(e))==null?void 0:r.get(s)}_getFloatingObject(n){var i,o;if(n==null)return;const{unitId:e,subUnitId:s,floatingObjectId:r}=n;return(o=(i=this._managerInfo.get(e))==null?void 0:i.get(s))==null?void 0:o.get(r)}_addByParam(n){const{unitId:e,subUnitId:s,floatingObject:r,floatingObjectId:i}=n;this._managerInfo.has(e)||this._managerInfo.set(e,new Map);const o=this._managerInfo.get(e);return o.has(s)||o.set(s,new Map),o.get(s).set(i,r),[{unitId:e,subUnitId:s,floatingObjectId:i,floatingObject:r}]}_clearByParam(n){const e=this._getFloatingObjects(n),{unitId:s,subUnitId:r}=n,i=[];return e==null||e.forEach((o,a)=>{i.push({unitId:s,subUnitId:r,floatingObjectId:a,floatingObject:o})}),e==null||e.clear(),i}_removeByParam(n){const e=this._getFloatingObjects(n),s=e==null?void 0:e.get(n.floatingObjectId);return s==null?[]:(e==null||e.delete(n.floatingObjectId),[{...n,floatingObject:s}])}}const gs=A.createIdentifier("univer.floating-object.service");class Rs{constructor(n={}){_(this,"_styles");_(this,"_cacheMap",new $n(1e5));this._styles=n,this._generateCacheMap()}each(n){return Object.entries(this._styles).forEach(n),this}search(n,e){if(this._cacheMap.has(e))return this._cacheMap.get(e);const s=this._getExistingStyleId(n);return s||"-1"}get(n){return typeof n!="string"?n:(n=String(n),this._styles[n])}add(n,e){const s=m.generateRandomId(6);return this._styles[s]=n,this._cacheMap.set(e,s),s}setValue(n){if(n==null)return;const e=JSON.stringify(n),s=this.search(n,e);return s!=="-1"?s:this.add(n,e)}toJSON(){return this._styles}getStyleByCell(n){let e;n&&m.isObject(n.s)?e=n.s:e=(n==null?void 0:n.s)&&this.get(n.s);const s=n==null?void 0:n.interceptorStyle;return s?{...e,...s}:e}_generateCacheMap(){const{_styles:n,_cacheMap:e}=this;for(const s in n){const r=JSON.stringify(n[s]);e.set(r,s)}}_getExistingStyleId(n){const{_styles:e}=this;for(const s in e)if(m.diffValue(e[s],n))return s;return null}}class yi{constructor(n,e){_(this,"_columnData",{});this._config=n,this._columnData=e}getColumnData(){return this._columnData}getColVisible(n){const{_columnData:e}=this,s=e[n];return s?s.hd!==O.TRUE:!0}getHiddenCols(n=0,e=this.getSize()-1){const s=[];let r=!1,i=-1;for(let o=n;o<=e;o++){const a=this.getColVisible(o);r&&a?(r=!1,s.push({rangeType:p.COLUMN,startColumn:i,endColumn:o-1,startRow:0,endRow:0})):!r&&!a&&(r=!0,i=o)}return r&&s.push({startRow:0,endRow:0,startColumn:i,endColumn:e,rangeType:p.COLUMN}),s}getVisibleCols(n=0,e=this.getSize()-1){const s=[];let r=!1,i=-1;for(let o=n;o<=e;o++){const a=this.getColVisible(o);r&&!a?(r=!1,s.push({rangeType:p.COLUMN,startColumn:i,endColumn:o-1,startRow:0,endRow:0})):!r&&a&&(r=!0,i=o)}return r&&s.push({startRow:0,endRow:0,startColumn:i,endColumn:e,rangeType:p.COLUMN}),s}getColumnDatas(n,e){const s={};let r=0;for(let i=n;i<n+e;i++){const o=this.getColumnOrCreate(i);s[r]=o,r++}return s}getSize(){return Y(this._columnData)}getColumnWidth(n){const{_columnData:e}=this,s=this._config;let r=0;return r=(e[n]||{hd:O.FALSE,w:s.defaultColumnWidth}).w||s.defaultColumnWidth,r}getColumn(n){const e=this._columnData[n];if(e)return e}getColumnOrCreate(n){const{_columnData:e}=this,s=this._config,r=e[n];if(r)return r;const i={w:s.defaultColumnWidth,hd:O.FALSE};return this._columnData[n]=i,i}}class Xi{constructor(n,e,s){_(this,"_rowData");this._config=n,this._viewModel=e,this._rowData=s}getRowData(){return this._rowData}getRowDatas(n,e){const s={};let r=0;for(let i=n;i<n+e;i++){const o=this.getRowOrCreate(i);s[r]=o,r++}return s}getRowHeight(n,e=1){const{_rowData:s}=this,r=this._config;let i=0;for(let o=0;o<e;o++){const a=s[o+n]||{hd:O.FALSE,h:r.defaultRowHeight},{ia:l,ah:c,h=r.defaultRowHeight}=a;i+=(l==null||l===O.TRUE)&&typeof c=="number"?c:h}return i}getRow(n){return this._rowData[n]}getRowOrCreate(n){const{_rowData:e}=this,s=e[n];if(s)return s;const r=this._config,i={hd:O.FALSE,h:r.defaultRowHeight};return e[n]=i,i}getHiddenRows(n=0,e=this.getSize()-1){const s=[];let r=!1,i=-1;for(let o=n;o<=e;o++){const a=this.getRowRawVisible(o);r&&a?(r=!1,s.push({startRow:i,endRow:o-1,startColumn:0,endColumn:0,rangeType:p.ROW})):!r&&!a&&(r=!0,i=o)}return r&&s.push({startRow:i,endRow:e,startColumn:0,endColumn:0,rangeType:p.ROW}),s}getVisibleRows(n=0,e=this.getSize()-1){const s=[];let r=!1,i=-1;for(let o=n;o<=e;o++){const a=this.getRowRawVisible(o);r&&!a?(r=!1,s.push({startRow:i,endRow:o-1,startColumn:0,endColumn:0,rangeType:p.ROW})):!r&&a&&(r=!0,i=o)}return r&&s.push({startRow:i,endRow:e,startColumn:0,endColumn:0,rangeType:p.ROW}),s}getRowRawVisible(n){const e=this.getRow(n);return e?e.hd!==O.TRUE:!0}getSize(){return Y(this._rowData)}}const qi="DEFAULT_WORKSHEET_ROW_COUNT",ms=1e3,Ji="DEFAULT_WORKSHEET_COLUMN_COUNT",Cs=20,Zi="DEFAULT_WORKSHEET_ROW_HEIGHT",Os=19,Qi="DEFAULT_WORKSHEET_COLUMN_WIDTH",Is=73,to="DEFAULT_WORKSHEET_ROW_TITLE_WIDTH",As=46,eo="DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT",Ns=20;function Ss(t){const n={name:"Sheet1",id:"sheet-01",tabColor:"",hidden:O.FALSE,rowCount:ms,columnCount:Cs,zoomRatio:1,freeze:{xSplit:0,ySplit:0,startRow:-1,startColumn:-1},scrollTop:0,scrollLeft:0,defaultColumnWidth:Is,defaultRowHeight:Os,mergeData:[],cellData:{},rowData:{},columnData:{},showGridlines:O.TRUE,rowHeader:{width:As,hidden:O.FALSE},columnHeader:{height:Ns,hidden:O.FALSE},selections:["A1"],rightToLeft:O.FALSE};return Object.keys(n).forEach(e=>{const s=e;typeof t[s]>"u"&&(t[s]=n[s])}),t}class Ls extends D{constructor(e){super();_(this,"_cellContentInterceptor",null);_(this,"_rowFilteredInterceptor",null);this.getRawCell=e}dispose(){super.dispose(),this._cellContentInterceptor=null,this._rowFilteredInterceptor=null}getCell(e,s){return this._cellContentInterceptor?this._cellContentInterceptor.getCell(e,s):this.getRawCell(e,s)}getRowFiltered(e){var s,r;return(r=(s=this._rowFilteredInterceptor)==null?void 0:s.getRowFiltered(e))!=null?r:!1}registerCellContentInterceptor(e){if(this._cellContentInterceptor)throw new Error("[SheetViewModel]: Interceptor already registered.");return this._cellContentInterceptor=e,U(()=>this._cellContentInterceptor=null)}registerRowFilteredInterceptor(e){if(this._rowFilteredInterceptor)throw new Error("[SheetViewModel]: Interceptor already registered.");return this._rowFilteredInterceptor=e,U(()=>this._rowFilteredInterceptor=null)}}class gt{constructor(n,e,s){_(this,"_sheetId");_(this,"_snapshot");_(this,"_cellData");_(this,"_rowManager");_(this,"_columnManager");_(this,"_viewModel");var a;this.unitId=n,this._styles=s,this._snapshot=Ss(e);const{columnData:r,rowData:i,cellData:o}=this._snapshot;this._sheetId=(a=this._snapshot.id)!=null?a:m.generateRandomId(6),this._cellData=new V(o),this._viewModel=new Ls((l,c)=>this.getCellRaw(l,c)),this._rowManager=new Xi(this._snapshot,this._viewModel,i),this._columnManager=new yi(this._snapshot,r)}__interceptViewModel(n){n(this._viewModel)}getSnapshot(){return this._snapshot}getCellMatrix(){return this._cellData}getCellMatrixPrintRange(){const n=this.getCellMatrix(),e=this.getMergeData();let s=-1,r=-1,i=-1,o=-1,a=!1,l=!1;return n.forEach((c,h)=>{Object.keys(h).forEach(d=>{const f=+d,E=n.getValue(c,f),g=E!=null&&E.s?this._styles.get(E.s):null,R=(g==null?void 0:g.bd)&&(g.bd.b||g.bd.l||g.bd.r||g.bd.t||g.bd.bc_tr||g.bd.bl_tr||g.bd.ml_tr||g.bd.tl_bc||g.bd.tl_br||g.bd.tl_mr);(E&&(E.v||E.p)||g!=null&&g.bg||R)&&(a?s=Math.min(s,c):(s=c,a=!0),r=Math.max(r,c),l?i=Math.min(i,f):(l=!0,i=f),o=Math.max(o,f))})}),e.forEach(c=>{a?s=Math.min(s,c.startRow):(s=c.startRow,a=!0),r=Math.max(r,c.endRow),l?i=Math.min(i,c.startColumn):(i=c.startColumn,a=!0),o=Math.max(o,c.endColumn)}),!a||!l?null:{startColumn:i,startRow:s,endColumn:o,endRow:r}}getRowManager(){return this._rowManager}getUnitId(){return this.unitId}getSheetId(){return this._sheetId}getColumnManager(){return this._columnManager}getName(){return this._snapshot.name}clone(){const{_snapshot:n}=this,e=m.deepClone(n);return new gt(this.unitId,e,this._styles)}getMergeData(){return this._snapshot.mergeData}getMergedCell(n,e){const s=this._snapshot.mergeData;for(let r=0;r<s.length;r++){const i=s[r];if(z.intersects({startRow:n,startColumn:e,endRow:n,endColumn:e},i))return i}return null}getCell(n,e){return n<0||e<0?null:this._viewModel.getCell(n,e)}getCellRaw(n,e){return this.getCellMatrix().getValue(n,e)}getRowFiltered(n){return this._viewModel.getRowFiltered(n)}getMatrixWithMergedCells(n,e,s,r,i=!1){const o=this.getCellMatrix(),a=this._snapshot.mergeData.filter(c=>z.intersects({startRow:n,startColumn:e,endRow:s,endColumn:r},c)),l=new V;return ue(n,s,e,r).forEach((c,h)=>{const d=i?this.getCellRaw(c,h):this.getCell(c,h);d&&l.setValue(c,h,d)}),a.forEach(c=>{const{startColumn:h,startRow:d,endColumn:f,endRow:E}=c;ue(d,E,h,f).forEach((g,R)=>{g===d&&R===h&&l.setValue(g,R,{...o.getValue(g,R),rowSpan:E-d+1,colSpan:f-h+1}),(g!==d||R!==h)&&l.realDeleteValue(g,R)})}),l}getRange(n,e,s,r){return typeof n=="object"?new st(this,n,{getStyles:()=>this._styles}):new st(this,{startRow:n,startColumn:e,endColumn:r||e,endRow:s||n},{getStyles:()=>this._styles})}getZoomRatio(){return this._snapshot.zoomRatio||1}getConfig(){return this._snapshot}getFreeze(){return this._snapshot.freeze}getMaxColumns(){const{_snapshot:n}=this,{columnCount:e}=n;return e}getMaxRows(){const{_snapshot:n}=this,{rowCount:e}=n;return e}getRowCount(){return this._snapshot.rowCount}setRowCount(n){this._snapshot.rowCount=n}getColumnCount(){return this._snapshot.columnCount}setColumnCount(n){this._snapshot.columnCount=n}isSheetHidden(){return this._snapshot.hidden}hasHiddenGridlines(){const{_snapshot:n}=this,{showGridlines:e}=n;return e===0}getTabColor(){const{_snapshot:n}=this,{tabColor:e}=n;return e}getColumnWidth(n){return this.getColumnManager().getColumnWidth(n)}getRowHeight(n){return this._viewModel.getRowFiltered(n)?0:this.getRowManager().getRowHeight(n)}getRowVisible(n){return this._viewModel.getRowFiltered(n)?!1:this.getRowRawVisible(n)}getRowRawVisible(n){return this.getRowManager().getRowRawVisible(n)}getHiddenRows(n,e){const s=this.getMaxColumns()-1,r=this._rowManager.getHiddenRows(n,e);return r.forEach(i=>i.endColumn=s),r}getColVisible(n){return this._columnManager.getColVisible(n)}getHiddenCols(n,e){const s=this.getMaxRows()-1,r=this._columnManager.getHiddenCols(n,e);return r.forEach(i=>i.endRow=s),r}getVisibleRows(){const n=this.getRowCount();return this._rowManager.getVisibleRows(0,n-1)}getVisibleCols(){const n=this.getColumnCount();return this._columnManager.getVisibleCols(0,n-1)}isRightToLeft(){const{_snapshot:n}=this,{rightToLeft:e}=n;return e}getLastRowWithContent(){return this._cellData.getLength()-1}getLastColumnWithContent(){return this._cellData.getRange().endColumn}cellHasValue(n){return n&&(n.v!==void 0||n.f!==void 0||n.p!==void 0)}iterateByRow(n,e=!0){const{startRow:s,startColumn:r,endRow:i,endColumn:o}=n,a=this;return{[Symbol.iterator]:()=>{let l=s,c=r;return{next(){for(;;){if(c>o&&(l+=1,c=r),l>i)return{done:!0,value:void 0};const h=a.getCell(l,c),d=!h,f=a.getMergedCell(l,c);if(f){if(l!==f.startRow||c!==f.startColumn){c=f.endColumn+1;continue}if(d&&e){c=f.endColumn+1;continue}const g={row:l,col:c,value:h};return g.colSpan=f.endColumn-f.startColumn+1,g.rowSpan=f.endRow-f.startRow+1,c=f.endColumn+1,{done:!1,value:g}}if(d&&e)c+=1;else{const E={row:l,col:c,value:h};return c+=1,{done:!1,value:E}}}}}}}}iterateByColumn(n,e=!0,s=!0){const{startRow:r,startColumn:i,endRow:o,endColumn:a}=n,l=this;return{[Symbol.iterator]:()=>{let c=r,h=i;return{next(){for(;;){if(c>o&&(h+=1,c=r),h>a)return{done:!0,value:void 0};const d=l.getMergedCell(c,h);if(d){const g=c!==d.startRow,R=g||h!==d.startColumn;if(s&&R||!s&&g){c=d.endRow+1;continue}const C=l.getCell(d.startRow,d.startColumn);if(!C&&e){c=d.endRow+1;continue}const P={row:c,col:d.startColumn,value:C};return P.colSpan=d.endColumn-d.startColumn+1,P.rowSpan=d.endRow-d.startRow+1,c=d.endRow+1,{done:!1,value:P}}const f=l.getCell(c,h);if(!f&&e)c+=1;else{const g={row:c,col:h,value:f};return c+=1,{done:!1,value:g}}}}}}}}}function no(t){var s,r;if(!t)return"";const n=(r=(s=t.p)==null?void 0:s.body)==null?void 0:r.dataStream;if(n)return n;const e=t.v;return typeof e=="string"?t.t===et.BOOLEAN?e.toUpperCase():e:typeof e=="number"?t.t===et.BOOLEAN?e?"TRUE":"FALSE":e.toString():typeof e=="boolean"?e?"TRUE":"FALSE":""}const so="0.1.9";function ro(t="",n=Q.ZH_CN,e=""){return{id:t,sheetOrder:[],name:e,appVersion:so,locale:n,styles:{},sheets:{},resources:[]}}var io=Object.defineProperty,oo=Object.getOwnPropertyDescriptor,ao=(t,n,e,s)=>{for(var r=s>1?void 0:s?oo(n,e):n,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(s?o(n,e,r):o(r))||r);return s&&r&&io(n,e,r),r},lo=(t,n)=>(e,s)=>n(e,s,t);function uo(t,n){return`${t.getUnitId()}|${n.getSheetId()}`}u.Workbook=class extends Bt{constructor(e={},s){super();_(this,"type",N.UNIVER_SHEET);_(this,"_sheetCreated$",new I.Subject);_(this,"sheetCreated$",this._sheetCreated$.asObservable());_(this,"_sheetDisposed$",new I.Subject);_(this,"sheetDisposed$",this._sheetDisposed$.asObservable());_(this,"_activeSheet$",new I.BehaviorSubject(null));_(this,"activeSheet$",this._activeSheet$.asObservable());_(this,"_worksheets");_(this,"_styles");_(this,"_snapshot");_(this,"_unitId");_(this,"_count");this._logService=s;const r=ro();m.isEmptyObject(e)?this._snapshot=r:this._snapshot=m.commonExtend(r,e);const{styles:i}=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 Rs(i),this._count=1,this._worksheets=new Map,this._passWorksheetSnapshots()}get _activeSheet(){return this._activeSheet$.getValue()}get name(){return this._snapshot.name}dispose(){super.dispose(),this._sheetCreated$.complete(),this._sheetDisposed$.complete(),this._activeSheet$.complete()}save(){return m.deepClone(this._snapshot)}static isIRangeType(e){return typeof e=="string"||"startRow"in e||"row"in e}getSnapshot(){return this._snapshot}getName(){return this._snapshot.name}getUnitId(){return this._unitId}getRev(){var e;return(e=this._snapshot.rev)!=null?e:1}incrementRev(){this._snapshot.rev=this.getRev()+1}getShouldRenderLoopImmediately(){return this._snapshot.shouldStartRenderingImmediately!==!1}getContainer(){return this._snapshot.container}addWorksheet(e,s,r){const{sheets:i,sheetOrder:o}=this._snapshot;if(i[e])return!1;i[e]=r,o.splice(s,0,e);const a=new gt(this._unitId,r,this._styles);return this._worksheets.set(e,a),this._sheetCreated$.next(a),!0}getParentRenderUnitId(){return this._snapshot.parentRenderUnitId}getSheetOrders(){return this._snapshot.sheetOrder}getWorksheets(){return this._worksheets}getActiveSpreadsheet(){return this}getStyles(){return this._styles}getConfig(){return this._snapshot}getIndexBySheetId(e){const{sheetOrder:s}=this._snapshot;return s.findIndex(r=>r===e)}getRawActiveSheet(){return this._activeSheet}getActiveSheet(){const e=this.getRawActiveSheet();if(e)return e;const s=this._snapshot.sheetOrder;for(let i=0,o=s.length;i<o;i++){const a=this._worksheets.get(s[i]);if(a&&a.isSheetHidden()!==O.TRUE)return this.setActiveSheet(a),a}const r=this._worksheets.get(s[0]);return this.setActiveSheet(r),r}setActiveSheet(e){this._activeSheet$.next(e)}removeSheet(e){var r;return this._worksheets.get(e)?(((r=this._activeSheet)==null?void 0:r.getSheetId())===e&&this.setActiveSheet(null),this._worksheets.delete(e),this._snapshot.sheetOrder.splice(this._snapshot.sheetOrder.indexOf(e),1),delete this._snapshot.sheets[e],!0):!1}getActiveSheetIndex(){const{sheetOrder:e}=this._snapshot;return e.findIndex(s=>this._worksheets.get(s)===this._activeSheet)}getSheetSize(){return this._snapshot.sheetOrder.length}getSheets(){const{sheetOrder:e}=this._snapshot;return e.map(s=>this._worksheets.get(s))}getSheetsName(){const{sheetOrder:e}=this._snapshot,s=[];return e.forEach(r=>{const i=this._worksheets.get(r);i&&s.push(i.getName())}),s}getSheetIndex(e){const{sheetOrder:s}=this._snapshot;return s.findIndex(r=>e.getSheetId()===r)}getSheetBySheetName(e){const{sheetOrder:s}=this._snapshot,r=s.find(i=>this._worksheets.get(i).getName()===e);return this._worksheets.get(r)}getSheetBySheetId(e){return this._worksheets.get(e)}getSheetByIndex(e){const{sheetOrder:s}=this._snapshot;return this._worksheets.get(s[e])}getHiddenWorksheets(){return this.getSheets().filter(e=>e.getConfig().hidden===O.TRUE).map(e=>e.getConfig().id)}transformRangeType(e){if(typeof e=="string")return this._getCellRange(e);if(typeof e!="string"&&"row"in e){const s=e;return{sheetId:"",range:{startRow:s.row[0],startColumn:s.column[0],endRow:s.row[1],endColumn:s.column[1]}}}return typeof e!="string"&&"startRow"in e?{sheetId:"",range:e}:_t}load(e){this._snapshot=e}checkSheetName(e){return this.getSheetsName().includes(e)}uniqueSheetName(e="Sheet1"){let s=e;for(;this.checkSheetName(s);)s=e+this._count,this._count++;return s}generateNewSheetName(e){let s=e+this._count;for(;this.checkSheetName(s);)s=e+this._count,this._count++;return s}_getCellRange(e){var h,d,f,E,g;let s="",r="";if(e.indexOf("!")>-1){const R=e.split("!");s=R[0],r=R[1],s=s.replace(/\\'/g,"'").replace(/''/g,"'"),s.substring(0,1)==="'"&&s.substring(s.length-1,1)==="'"&&(s=s.substring(1,s.length-1))}else r=e;if(r.indexOf(":")===-1){const R=Number.parseInt(r.replace(/[^0-9]/g,""),10)-1,C=m.ABCatNum(r.replace(/[^A-Za-z]/g,""));return!Number.isNaN(R)&&!Number.isNaN(C)?{sheetId:s,range:{startRow:R,endRow:R,startColumn:C,endColumn:C}}:_t}r=r.split(":");const i=[0,0],o=[0,0],a=((h=this.getSheetBySheetName(s))==null?void 0:h.getMaxRows())||((d=this.getActiveSheet())==null?void 0:d.getMaxRows()),l=((f=this.getSheetBySheetName(s))==null?void 0:f.getMaxColumns())||((E=this.getActiveSheet())==null?void 0:E.getMaxColumns());return i[0]=Number.parseInt(r[0].replace(/[^0-9]/g,""),10)-1,i[1]=Number.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]=l),o[0]>o[1])?_t:{sheetId:((g=this.getSheetBySheetName(s))==null?void 0:g.getSheetId())||"",range:{startRow:i[0],endRow:i[1],startColumn:o[0],endColumn:o[1]}}}_passWorksheetSnapshots(){const{_snapshot:e,_worksheets:s}=this,{sheets:r,sheetOrder:i}=e;if(m.isEmptyObject(r)){const o=m.generateRandomId();r[o]={id:o}}for(const o in r){const a=r[o],{name:l}=a;a.name=this.uniqueSheetName(l),a.name!==l&&this._logService.debug("[Workbook]",`The worksheet name ${l} is duplicated, we changed it to ${a.name}. Please fix the problem in your snapshot.`);const c=new gt(this._unitId,a,this._styles);s.set(o,c),i.includes(o)||i.push(o)}}},u.Workbook=ao([lo(1,y)],u.Workbook);class Ie extends Bt{constructor(e){var s;super();_(this,"type",N.UNIVER_SLIDE);_(this,"_snapshot");_(this,"_unitId");this._snapshot={...Kn,...e},this._unitId=(s=this._snapshot.id)!=null?s:m.generateRandomId(6)}getContainer(){return this._snapshot.container}getParentRenderUnitId(){return this._snapshot.parentRenderUnitId}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 r;return(r=this.getElementsByPage(e))==null?void 0:r[s]}getPageSize(){return this._snapshot.pageSize}addPage(){return{id:"cover_1",pageType:Qt.SLIDE,zIndex:1,title:"cover",description:"this is first page, cover",pageBackgroundFill:{rgb:"rgb(255,255,255)"},pageElements:{}}}}const Rt="FOCUSING_SHEET",$t="FOCUSING_DOC",Vt="FOCUSING_SLIDE",co="FOCUSING_EDITOR_BUT_HIDDEN",Ts="EDITOR_ACTIVATED",ho="FOCUSING_EDITOR_INPUT_FORMULA",ws="FOCUSING_FORMULA_EDITOR",_o="FOCUSING_UNIVER_EDITOR",fo="FOCUSING_EDITOR_INPUT_FORMULA",Eo="FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE";var go=Object.defineProperty,Ro=Object.getOwnPropertyDescriptor,mo=(t,n,e,s)=>{for(var r=s>1?void 0:s?Ro(n,e):n,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(s?o(n,e,r):o(r))||r);return s&&r&&go(n,e,r),r},bs=(t,n)=>(e,s)=>n(e,s,t);const X=A.createIdentifier("univer.current");u.UniverInstanceService=class extends D{constructor(e,s){super();_(this,"_unitsByType",new Map);_(this,"_createHandler");_(this,"_ctorByType",new Map);_(this,"_currentUnits$",new I.BehaviorSubject({}));_(this,"currentUnits$",this._currentUnits$.asObservable());_(this,"_unitAdded$",new I.Subject);_(this,"unitAdded$",this._unitAdded$.asObservable());_(this,"_unitDisposed$",new I.Subject);_(this,"unitDisposed$",this._unitDisposed$.asObservable());_(this,"_focused$",new I.BehaviorSubject(null));_(this,"focused$",this._focused$.asObservable());this._injector=e,this._contextService=s}dispose(){super.dispose(),this._focused$.complete()}__setCreateHandler(e){this._createHandler=e}createUnit(e,s){return this._createHandler(e,s,this._ctorByType.get(e))}registerCtorForType(e,s){return this._ctorByType.set(e,s),{dispose:()=>{this._ctorByType.delete(e)}}}getCurrentTypeOfUnit$(e){return this.currentUnits$.pipe(I.map(s=>{var r;return(r=s[e])!=null?r:null}),I.distinctUntilChanged())}getCurrentUnitForType(e){return this._currentUnits$.getValue()[e]}setCurrentUnitForType(e){const s=this._getUnitById(e);if(!s)throw new Error(`[UniverInstanceService]: no document with unitId ${e}!`);this._currentUnits$.next({...this._currentUnits$.getValue(),[s[1]]:s[0]})}getTypeOfUnitAdded$(e){return this._unitAdded$.pipe(I.filter(s=>s.type===e))}__addUnit(e){const s=e.type;this._unitsByType.has(s)||this._unitsByType.set(s,[]),this._unitsByType.get(s).push(e),this._unitAdded$.next(e),this._currentUnits$.next({...this._currentUnits$.getValue(),[s]:e})}getTypeOfUnitDisposed$(e){return this.unitDisposed$.pipe(I.filter(s=>s.type===e))}getUnit(e,s){var i;const r=(i=this._getUnitById(e))==null?void 0:i[0];return s&&(r==null?void 0:r.type)!==s?null:r}getCurrentUniverDocInstance(){return this.getCurrentUnitForType(N.UNIVER_DOC)}getUniverDocInstance(e){return this.getUnit(e,N.UNIVER_DOC)}getUniverSheetInstance(e){return this.getUnit(e,N.UNIVER_SHEET)}getAllUnitsForType(e){var s;return(s=this._unitsByType.get(e))!=null?s:[]}changeDoc(e,s){const r=this.getAllUnitsForType(N.UNIVER_DOC),i=r.find(o=>o.getUnitId()===e);if(i!=null){const o=r.indexOf(i);r.splice(o,1)}this.__addUnit(s)}get focused(){var s;const e=this._focused$.getValue();return e?(s=this._getUnitById(e))==null?void 0:s[0]:null}focusUnit(e){this._focused$.next(e),this.focused instanceof u.Workbook?(this._contextService.setContextValue($t,!1),this._contextService.setContextValue(Rt,!0),this._contextService.setContextValue(Vt,!1)):this.focused instanceof rt?(this._contextService.setContextValue($t,!0),this._contextService.setContextValue(Rt,!1),this._contextService.setContextValue(Vt,!1)):this.focused instanceof Ie&&(this._contextService.setContextValue($t,!1),this._contextService.setContextValue(Rt,!1),this._contextService.setContextValue(Vt,!0))}getFocusedUnit(){return this.focused}getUnitType(e){const s=this._getUnitById(e);if(!s)throw new Error(`[UniverInstanceService]: No document with unitId ${e}`);return s[1]}disposeUnit(e){const s=this._getUnitById(e);if(!s)return!1;const[r,i]=s,o=this._unitsByType.get(i),a=o.indexOf(r);return o.splice(a,1),this._unitDisposed$.next(r),this._currentUnits$.next({...this._currentUnits$.getValue(),[i]:null}),this._focused$.next(null),!0}_getUnitById(e){for(const[s,r]of this._unitsByType){const i=r.find(o=>o.getUnitId()===e);if(i)return[i,s]}}},u.UniverInstanceService=mo([bs(0,A.Inject(A.Injector)),bs(1,ft)],u.UniverInstanceService);var b=(t=>(t[t.Starting=0]="Starting",t[t.Ready=1]="Ready",t[t.Rendered=2]="Rendered",t[t.Steady=3]="Steady",t))(b||{});const Co={0:"Starting",1:"Ready",2:"Rendered",3:"Steady"},xt=new Map;function Ae(t,n){return function(r){Ne(t,n)}}function Ne(t,n){xt.has(t)||xt.set(t,[]),xt.get(t).push(n)}var Oo=Object.defineProperty,Io=Object.getOwnPropertyDescriptor,vs=(t,n,e,s)=>{for(var r=s>1?void 0:s?Io(n,e):n,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(s?o(n,e,r):o(r))||r);return s&&r&&Oo(n,e,r),r},Se=(t,n)=>(e,s)=>n(e,s,t);u.LifecycleService=class extends D{constructor(e){super();_(this,"_lifecycle$",new I.BehaviorSubject(b.Starting));_(this,"lifecycle$",this._lifecycle$.asObservable());_(this,"_lock",!1);this._logService=e,this._reportProgress(b.Starting)}get stage(){return this._lifecycle$.getValue()}set stage(e){if(e<this.stage)throw new Error("[LifecycleService]: lifecycle stage cannot go backward!");if(e!==this.stage){if(this._lock)throw new Error("[LifecycleService]: cannot set new stage when related logic is all handled!");this._lock=!0,this._reportProgress(e),this._lifecycle$.next(e),this._lock=!1}}dispose(){this._lifecycle$.complete(),super.dispose()}subscribeWithPrevious(){return new I.Observable(e=>(this.stage===b.Starting||(this.stage===b.Ready?e.next(b.Starting):this.stage===b.Rendered?(e.next(b.Starting),e.next(b.Ready)):(e.next(b.Starting),e.next(b.Ready),e.next(b.Rendered))),this._lifecycle$.subscribe(e)))}_reportProgress(e){this._logService.debug("[LifecycleService]",`lifecycle progressed to "${Co[e]}".`)}},u.LifecycleService=vs([Se(0,y)],u.LifecycleService),u.LifecycleInitializerService=class extends D{constructor(e,s){super();_(this,"_seenTokens",new Set);this._lifecycleService=e,this._injector=s}initModulesOnStage(e){var s;(s=xt.get(e))==null||s.forEach(r=>{this._injector.has(r)&&!this._seenTokens.has(r)&&(this._injector.get(r),this._seenTokens.add(r))})}},u.LifecycleInitializerService=vs([Se(0,A.Inject(u.LifecycleService)),Se(1,A.Inject(A.Injector))],u.LifecycleInitializerService);class mt extends D{constructor(){super();_(this,"_currentLocale",Q.ZH_CN);_(this,"_locales",null);_(this,"localeChanged$",new I.Subject);_(this,"t",(e,...s)=>{if(!this._locales)throw new Error("Locale not initialized");const r=e.split("."),i=this.resolveKeyPath(this._locales[this._currentLocale],r);if(typeof i=="string"){let o=i;return s.forEach((a,l)=>{o=o.replace(`{${l}}`,a)}),o}else return e});this.disposeWithMe(U(()=>this.localeChanged$.complete()))}load(e){var s;this._locales=m.deepMerge((s=this._locales)!=null?s:{},e)}setLocale(e){this._currentLocale=e,this.localeChanged$.next()}getLocales(){var e;return(e=this._locales)==null?void 0:e[this._currentLocale]}getCurrentLocale(){return this._currentLocale}resolveKeyPath(e,s){const r=s.shift();if(r&&e&&r in e){const i=e[r];return s.length>0&&(typeof i=="object"||Array.isArray(i))?this.resolveKeyPath(i,s):i}return null}}const jt=A.createIdentifier("resource-manager-service");var Ao=Object.defineProperty,No=Object.getOwnPropertyDescriptor,So=(t,n,e,s)=>{for(var r=s>1?void 0:s?No(n,e):n,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(s?o(n,e,r):o(r))||r);return s&&r&&Ao(n,e,r),r},Us=(t,n)=>(e,s)=>n(e,s,t);const Le=A.createIdentifier("univer.permission-service");u.PermissionService=class extends D{constructor(e,s){super();_(this,"_permissionPointMap",new Map);_(this,"deletePermissionPoint",(e,s)=>{const r=this._permissionPointMap.get(e);if(r){const i=r.get(s);i&&(i.complete(),this._permissionPointMap.delete(s))}});_(this,"addPermissionPoint",(e,s)=>{const r=this._permissionPointMap.get(e)||new Map;return r.has(s.id)?!1:(r.set(s.id,new I.BehaviorSubject(s)),this._permissionPointMap.set(e,r),!0)});_(this,"updatePermissionPoint",(e,s,r)=>{const i=this._permissionPointMap.get(e);if(!i)return;const o=i.get(s);if(o){const a=o.getValue();a.value=r,a.status=le.DONE,o.next(a)}});_(this,"getPermissionPoint",(e,s)=>{const r=this._permissionPointMap.get(e);if(!r)return;const i=r.get(s);if(i)return i.getValue()});this._resourceManagerService=e,this._univerInstanceService=s}_toJson(e){const s=this._permissionPointMap.get(e);let r=[];return s&&(r=[...s.keys()].reduce((i,o)=>{const a=s.get(o);return a&&i.push(a.getValue()),i},[])),JSON.stringify(r)}_parseJson(e){return JSON.parse(e)}composePermission$(e,s){const r=this._permissionPointMap.get(e),i=s.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 I.combineLatest(i).pipe(nr.map(o=>(o.every(a=>this._permissionPointMap.get(a.id)),o)))}composePermission(e,s){const r=this._permissionPointMap.get(e);return s.map(o=>{const a=r==null?void 0:r.get(o);if(!a)throw new Error(`${o} permissionPoint is not exist`);return a.getValue()})}},u.PermissionService=So([Ae(b.Starting,u.PermissionService),Us(0,A.Inject(jt)),Us(1,A.Inject(X))],u.PermissionService);const Ds="univer.editable";class Kt extends Vn{constructor(e){super();_(this,"id",Ds);_(this,"value",!0);_(this,"unitID");this.unitID=e}}var Lo=Object.defineProperty,To=Object.getOwnPropertyDescriptor,wo=(t,n,e,s)=>{for(var r=s>1?void 0:s?To(n,e):n,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(s?o(n,e,r):o(r))||r);return s&&r&&Lo(n,e,r),r},Ms=(t,n)=>(e,s)=>n(e,s,t);u.UniverPermissionService=class extends D{constructor(n,e){super(),this._permissionService=n,this._univerInstanceService=e,this._init()}_init(){this._univerInstanceService.getTypeOfUnitAdded$(N.UNIVER_SHEET).subscribe(n=>{const e=new Kt(n.getUnitId());this._permissionService.addPermissionPoint(n.getUnitId(),e)})}getEditable(n=(e=>(e=this._univerInstanceService.getCurrentUnitForType(N.UNIVER_SHEET))==null?void 0:e.getUnitId())()){if(!n)return;const s=new Kt(n),r=this._permissionService.getPermissionPoint(n,s.id);return r==null?void 0:r.value}setEditable(n,e){const s=new Kt(n);this._permissionService.updatePermissionPoint(n,s.id,e)}},u.UniverPermissionService=wo([Ae(b.Starting,u.UniverPermissionService),Ms(0,A.Inject(Le)),Ms(1,A.Inject(X))],u.UniverPermissionService);class Ps extends D{constructor(){super(...arguments);_(this,"_resourceMap",new Map);_(this,"_register$",new I.Subject);_(this,"register$",this._register$.asObservable())}getAllResourceHooks(){return[...this._resourceMap.values()]}getResources(e){return this.getAllResourceHooks().map(i=>{const o=i.toJson(e);return{name:i.pluginName,data:o}})}registerPluginResource(e){const s=e.pluginName;if(this._resourceMap.has(s))throw new Error(`the pluginName is registered {${s}}`);return this._resourceMap.set(s,e),this._register$.next(e),U(()=>this._resourceMap.delete(s))}disposePluginResource(e){this._resourceMap.delete(e)}loadResources(e,s){this.getAllResourceHooks().forEach(r=>{var o;const i=(o=s==null?void 0:s.find(a=>a.name===r.pluginName))==null?void 0:o.data;if(i)try{const a=r.parseJson(i);r.onLoad(e,a)}catch{console.error("LoadResources Error!")}})}unloadResources(e){this.getAllResourceHooks().forEach(s=>{s.onUnLoad(e)})}dispose(){this._register$.complete(),this._resourceMap.clear()}}var bo=Object.defineProperty,vo=Object.getOwnPropertyDescriptor,Uo=(t,n,e,s)=>{for(var r=s>1?void 0:s?vo(n,e):n,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(s?o(n,e,r):o(r))||r);return s&&r&&bo(n,e,r),r},Hs=(t,n)=>(e,s)=>n(e,s,t);let Te=class extends D{constructor(n,e){super();_(this,"saveWorkbook",n=>{const e=n.getUnitId(),s=this._resourceManagerService.getResources(e)||[],r=n.getSnapshot();return r.resources=s,r});this._resourceManagerService=n,this._univerInstanceService=e,this._init()}_init(){const n=s=>{s.businesses.forEach(r=>{switch(r){case N.UNRECOGNIZED:case N.UNIVER_UNKNOWN:case N.UNIVER_SLIDE:case N.UNIVER_DOC:break;case N.UNIVER_SHEET:this._univerInstanceService.getAllUnitsForType(N.UNIVER_SHEET).forEach(i=>{const a=(i.getSnapshot().resources||[]).find(l=>l.name===s.pluginName);if(a)try{const l=s.parseJson(a.data);s.onLoad(i.getUnitId(),l)}catch{console.error(`Load Workbook{${i.getUnitId()}} Resources{${s.pluginName}} Data Error.`)}})}})};this._resourceManagerService.getAllResourceHooks().forEach(s=>{n(s)}),this.disposeWithMe(this._resourceManagerService.register$.subscribe(s=>{n(s)})),this.disposeWithMe(U(this._univerInstanceService.getTypeOfUnitAdded$(N.UNIVER_SHEET).subscribe(s=>{this._resourceManagerService.loadResources(s.getUnitId(),s.getSnapshot().resources)}))),this.disposeWithMe(U(this._univerInstanceService.getTypeOfUnitDisposed$(N.UNIVER_SHEET).subscribe(s=>{this._resourceManagerService.unloadResources(s.getUnitId())})))}};Te=Uo([Hs(0,A.Inject(jt)),Hs(1,A.Inject(X))],Te);const we=A.createIdentifier("resource-loader-service");Ne(b.Ready,we);class be extends D{constructor(){super();_(this,"_currentTheme");_(this,"_currentTheme$",new I.BehaviorSubject({}));_(this,"currentTheme$",this._currentTheme$.asObservable());this.disposeWithMe(U(()=>this._currentTheme$.complete()))}getCurrentTheme(){if(!this._currentTheme)throw new Error("[ThemeService]: current theme is not set!");return this._currentTheme}setTheme(e){this._currentTheme=e,this._currentTheme$.next(e)}}const Fs="__defaultDocumentNormalEditorSpecialUnitId_20231006__",ps="__defaultDocumentFormulaBarEditorSpecialUnitId_20231012__",Do=`\r
7
+ `;function Mo(t){return`__internalEditorId__${t}`}function Po(t){return t.startsWith("__")}var Ho=Object.defineProperty,Fo=Object.getOwnPropertyDescriptor,po=(t,n,e,s)=>{for(var r=s>1?void 0:s?Fo(n,e):n,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(s?o(n,e,r):o(r))||r);return s&&r&&Ho(n,e,r),r},ve=(t,n)=>(e,s)=>n(e,s,t);const Yt=A.createIdentifier("univer.undo-redo.service"),Wo=20;class Ws{dispose(){}async dispatchToHandlers(){return!1}}const Bs="univer.command.redo",ks="univer.command.undo",Gs=new class extends Ws{constructor(){super(...arguments);_(this,"type",Gt.COMMAND);_(this,"id",ks)}async handler(n){const e=n.get(Yt),s=e.pitchTopUndoElement();if(!s)return!1;const r=n.get(Et);return Oe(s.undoMutations,r)?(e.popUndoToRedo(),!0):!1}},$s=new class extends Ws{constructor(){super(...arguments);_(this,"type",Gt.COMMAND);_(this,"id",Bs)}async handler(n){const e=n.get(Yt),s=e.pitchTopRedoElement();if(!s)return!1;const r=n.get(Et);return Oe(s.redoMutations,r)?(e.popRedoToUndo(),!0):!1}};u.LocalUndoRedoService=class extends D{constructor(e,s,r){super();_(this,"undoRedoStatus$");_(this,"_undoRedoStatus$",new I.BehaviorSubject({undos:0,redos:0}));_(this,"_undoStacks",new Map);_(this,"_redoStacks",new Map);_(this,"_batchingStatus",new Map);this._univerInstanceService=e,this._commandService=s,this._contextService=r,this.undoRedoStatus$=this._undoRedoStatus$.asObservable(),this.disposeWithMe(this._commandService.registerCommand(Gs)),this.disposeWithMe(this._commandService.registerCommand($s)),this.disposeWithMe(U(()=>this._undoRedoStatus$.complete())),this.disposeWithMe(U(this._univerInstanceService.focused$.subscribe(()=>this._updateStatus())))}pushUndoRedo(e){const{unitID:s}=e,r=this._getRedoStack(s,!0),i=this._getUndoStack(s,!0);if(r.length=0,this._batchingStatus.has(e.unitID)){const a=this._batchingStatus.get(e.unitID),l=this._pitchUndoElement(e.unitID);a===0||!l?(o(e),this._batchingStatus.set(e.unitID,1)):this._tryBatchingElements(l,e)}else o(e);function o(a){i.push(a),i.length>Wo&&i.splice(0,1)}this._updateStatus()}clearUndoRedo(e){const s=this._getRedoStack(e);s&&(s.length=0);const r=this._getUndoStack(e);r&&(r.length=0),this._updateStatus()}pitchTopUndoElement(){const e=this._getFocusedUnitId();return this._pitchUndoElement(e)}pitchTopRedoElement(){const e=this._getFocusedUnitId();return this._pitchRedoElement(e)}_pitchUndoElement(e){const s=this._getUndoStack(e);return s!=null&&s.length?s[s.length-1]:null}_pitchRedoElement(e){const s=this._getRedoStack(e);return s!=null&&s.length?s[s.length-1]:null}popUndoToRedo(){const s=this._getUndoStackForFocused().pop();s&&(this._getRedoStackForFocused().push(s),this._updateStatus())}popRedoToUndo(){const s=this._getRedoStackForFocused().pop();s&&(this._getUndoStackForFocused().push(s),this._updateStatus())}__tempBatchingUndoRedo(e){if(this._batchingStatus.has(e))throw new Error("[LocalUndoRedoService]: cannot batching undo redo twice at the same time!");return this._batchingStatus.set(e,0),U(()=>this._batchingStatus.delete(e))}_updateStatus(){var i,o;const e=this._getFocusedUnitId(),s=e&&((i=this._undoStacks.get(e))==null?void 0:i.length)||0,r=e&&((o=this._redoStacks.get(e))==null?void 0:o.length)||0;this._undoRedoStatus$.next({undos:s,redos:r})}_getUndoStack(e,s=!1){let r=this._undoStacks.get(e);return!r&&s&&(r=[],this._undoStacks.set(e,r)),r||null}_getRedoStack(e,s=!1){let r=this._redoStacks.get(e);return!r&&s&&(r=[],this._redoStacks.set(e,r)),r||null}_getUndoStackForFocused(){const e=this._getFocusedUnitId();if(!e)throw new Error("No focused univer instance!");return this._getUndoStack(e,!0)}_getRedoStackForFocused(){const e=this._getFocusedUnitId();if(!e)throw new Error("No focused univer instance!");return this._getRedoStack(e,!0)}_tryBatchingElements(e,s){e.redoMutations.push(...s.redoMutations),e.undoMutations.push(...s.undoMutations)}_getFocusedUnitId(){var o,a,l,c;let e="";const s=this._contextService.getContextValue(Rt),r=this._contextService.getContextValue(ws),i=this._contextService.getContextValue(Ts);return s?r?e=ps:i?e=Fs:e=(a=(o=this._univerInstanceService.getFocusedUnit())==null?void 0:o.getUnitId())!=null?a:"":e=(c=(l=this._univerInstanceService.getFocusedUnit())==null?void 0:l.getUnitId())!=null?c:"",e}},u.LocalUndoRedoService=po([ve(0,X),ve(1,Et),ve(2,ft)],u.LocalUndoRedoService);class Ue extends D{onStarting(n){}onReady(){}onRendered(){}onSteady(){}getUniverInstanceType(){return this.constructor.type}getPluginName(){return this.constructor.pluginName}}_(Ue,"pluginName"),_(Ue,"type",N.UNIVER_UNKNOWN);class Bo{constructor(){_(this,"_plugins",[])}addPlugin(n){this._plugins.push(n)}removePlugins(){const n=this._plugins.slice();return this._plugins.length=0,n}forEachPlugin(n){this._plugins.forEach(n)}}class ko{constructor(){_(this,"_pluginsRegistered",[])}registerPlugin(n,e){this._pluginsRegistered.push({plugin:n,options:e})}getRegisterPlugins(){return this._pluginsRegistered.slice()}removePlugins(){this._pluginsRegistered=[]}}var Go=Object.defineProperty,$o=Object.getOwnPropertyDescriptor,Vo=(t,n,e,s)=>{for(var r=s>1?void 0:s?$o(n,e):n,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(s?o(n,e,r):o(r))||r);return s&&r&&Go(n,e,r),r},zt=(t,n)=>(e,s)=>n(e,s,t);u.PluginHolder=class extends D{constructor(e,s,r,i){super();_(this,"_started",!1);_(this,"_pluginRegistered",new Set);_(this,"_pluginStore",new Bo);_(this,"_pluginRegistry",new ko);this._logService=e,this._injector=s,this._lifecycleService=r,this._lifecycleInitializerService=i}get started(){return this._started}dispose(){super.dispose(),this._pluginStore.forEachPlugin(e=>e.dispose()),this._pluginStore.removePlugins(),this._pluginRegistry.removePlugins(),this._pluginRegistered.clear()}registerPlugin(e,s){const{pluginName:r}=e;if(this._pluginRegistered.has(r)){this._logService.warn("[PluginService]",`plugin ${r} has already been registered. This registration will be ignored.`);return}this._pluginRegistered.add(r),this._pluginRegistry.registerPlugin(e,s)}start(){this._started||(this._started=!0,this.flush())}flush(){if(!this._started)return;const e=this._pluginRegistry.getRegisterPlugins().map(({plugin:r,options:i})=>this._initPlugin(r,i));this._pluginRegistry.removePlugins();const s=this.disposeWithMe(this._lifecycleService.subscribeWithPrevious().subscribe(r=>{this._pluginsRunLifecycle(e,r),r===b.Steady&&s.dispose()}))}_pluginsRunLifecycle(e,s){e.forEach(r=>{switch(s){case b.Starting:r.onStarting(this._injector);break;case b.Ready:r.onReady();break;case b.Rendered:r.onRendered();break;case b.Steady:r.onSteady();break}}),this._lifecycleInitializerService.initModulesOnStage(s)}_initPlugin(e,s){return this._injector.createInstance(e,s)}},u.PluginHolder=Vo([zt(0,y),zt(1,A.Inject(A.Injector)),zt(2,A.Inject(u.LifecycleService)),zt(3,A.Inject(u.LifecycleInitializerService))],u.PluginHolder);var xo=Object.defineProperty,jo=Object.getOwnPropertyDescriptor,Ko=(t,n,e,s)=>{for(var r=s>1?void 0:s?jo(n,e):n,i=t.length-1,o;i>=0;i--)(o=t[i])&&(r=(s?o(n,e,r):o(r))||r);return s&&r&&xo(n,e,r),r},Yo=(t,n)=>(e,s)=>n(e,s,t);const zo=4;u.PluginService=class{constructor(n){_(this,"_pluginHolderForUniver");_(this,"_pluginHoldersForTypes",new Map);_(this,"_flushTimer");this._injector=n,this._pluginHolderForUniver=this._injector.createInstance(u.PluginHolder),this._pluginHolderForUniver.start()}dispose(){this._clearFlushTimer();for(const n of this._pluginHoldersForTypes.values())n.dispose();this._pluginHolderForUniver.dispose()}registerPlugin(n,e){this._assertPluginValid(n),this._scheduleInitPlugin();const{type:s}=n;s===N.UNIVER_UNKNOWN?(this._pluginHolderForUniver.registerPlugin(n,e),this._pluginHolderForUniver.flush()):this._ensurePluginHolderForType(s).registerPlugin(n,e)}startPluginForType(n){this._ensurePluginHolderForType(n).start()}_ensurePluginHolderForType(n){if(!this._pluginHoldersForTypes.has(n)){const e=this._injector.createInstance(u.PluginHolder);return this._pluginHoldersForTypes.set(n,e),e}return this._pluginHoldersForTypes.get(n)}_assertPluginValid(n){const{type:e,pluginName:s}=n;if(e===N.UNRECOGNIZED)throw new Error(`[PluginService]: invalid plugin type for ${n}. Please assign a "type" to your plugin.`);if(s==="")throw new Error(`[PluginService]: no plugin name for ${n}. Please assign a "pluginName" to your plugin.`)}_scheduleInitPlugin(){this._flushTimer===void 0&&(this._flushTimer=setTimeout(()=>{this._pluginHolderForUniver.started||this._pluginHolderForUniver.start(),this._flushPlugins(),this._clearFlushTimer()},zo))}_clearFlushTimer(){this._flushTimer&&(clearTimeout(this._flushTimer),this._flushTimer=void 0)}_flushPlugins(){this._pluginHolderForUniver.flush();for(const[n,e]of this._pluginHoldersForTypes)e.started&&e.flush()}},u.PluginService=Ko([Yo(0,A.Inject(A.Injector))],u.PluginService);function Vs(t,n){if(!n)return t;const e=[];for(const s of t){if(s.length===1){e.push(s);continue}const r=n.find(([i])=>i===s[0]);if(r){if(r[1]===null)continue;e.push([s[0],r[1]])}else e.push(s)}return e}class yo{constructor(n={},e){_(this,"_startedTypes",new Set);_(this,"_injector");const s=this._injector=Xo(e,n==null?void 0:n.override),{theme:r,locale:i,locales:o,logLevel:a}=n;r&&this._injector.get(be).setTheme(r),o&&this._injector.get(mt).load(o),i&&this._injector.get(mt).setLocale(i),a&&this._injector.get(y).setLogLevel(a),this._init(s),this._pluginService}get _univerInstanceService(){return this._injector.get(X)}get _pluginService(){return this._injector.get(u.PluginService)}__getInjector(){return this._injector}dispose(){this._injector.dispose()}setLocale(n){this._injector.get(mt).setLocale(n)}createUnit(n,e){return this._univerInstanceService.createUnit(n,e)}createUniverSheet(n){return this._univerInstanceService.createUnit(N.UNIVER_SHEET,n)}createUniverDoc(n){return this._univerInstanceService.createUnit(N.UNIVER_DOC,n)}createUniverSlide(n){return this._univerInstanceService.createUnit(N.UNIVER_SLIDE,n)}_init(n){this._univerInstanceService.registerCtorForType(N.UNIVER_SHEET,u.Workbook),this._univerInstanceService.registerCtorForType(N.UNIVER_DOC,rt),this._univerInstanceService.registerCtorForType(N.UNIVER_SLIDE,Ie);const e=n.get(X);e.__setCreateHandler((s,r,i)=>{if(!this._startedTypes.has(s)){this._pluginService.startPluginForType(s),this._startedTypes.add(s);const a=n.createInstance(i,r);return e.__addUnit(a),this._tryProgressToReady(),a}const o=n.createInstance(i,r);return e.__addUnit(o),o})}_tryProgressToReady(){this._injector.get(u.LifecycleService).stage<b.Ready&&(this._injector.get(u.LifecycleService).stage=b.Ready)}registerPlugin(n,e){this._pluginService.registerPlugin(n,e)}}function Xo(t,n){const e=Vs([[fs],[mt],[be],[u.LifecycleService],[u.LifecycleInitializerService],[u.UniverPermissionService],[u.PluginService],[X,{useClass:u.UniverInstanceService}],[Le,{useClass:u.PermissionService}],[y,{useClass:us,lazy:!0}],[Et,{useClass:u.CommandService,lazy:!0}],[Yt,{useClass:u.LocalUndoRedoService,lazy:!0}],[ds,{useClass:_s}],[ft,{useClass:as}],[gs,{useClass:Es,lazy:!0}],[jt,{useClass:Ps,lazy:!0}],[we,{useClass:Te,lazy:!0}]],n);return t?t.createChild(e):new A.Injector(e)}const qo=(t,n)=>n.length===t.length&&!t.some(e=>n.some(s=>!z.equals(s,e))),Jo=(t,n)=>n.length===t.length&&t.every((e,s)=>{const r=n[s];return r.unitId===e.unitId&&r.sheetId===e.sheetId&&z.equals(e.range,r.range)});function Zo(t,n){if(Object.is(t,n))return!0;if(typeof t!="object"||!t||typeof n!="object"||!n)return!1;const e=Object.keys(t),s=Object.keys(n);if(e.length!==s.length)return!1;const r=Object.prototype.hasOwnProperty.bind(n);for(let i=0;i<e.length;i++){const o=e[i];if(!r(o))return!1;const a=t[o],l=n[o];if(a!==l)return!1}return!0}function xs(t){return/^-?\d+(\.\d+)?$/.test(t)}function Qo(t){return xs(t)?Number(t)<=Number.MAX_SAFE_INTEGER:!1}function ta(t){return["true","false"].includes(t.toLowerCase())}function ea(t,n){return n.forEach(e=>t.add(e)),t}function na(t,n=16){let e=0,s=null;return function(...i){const o=Date.now();o-e<n?(s&&clearTimeout(s),s=setTimeout(()=>{e=o,t.apply(this,i)},n)):(e=o,t.apply(this,i))}}function sa(t){const n=new MessageChannel;let e=!1;return n.port1.onmessage=()=>{e||t()},n.port2.postMessage(null),()=>{e=!0}}var js=(t=>(t[t.TEXT=0]="TEXT",t[t.ARROW=1]="ARROW",t[t.CUSTOM=2]="CUSTOM",t))(js||{});class De{constructor(n){_(this,"_index",0);_(this,"_offset",0);this._actions=n}hasNext(){return this.peekLength()<Number.POSITIVE_INFINITY}next(n){n||(n=Number.POSITIVE_INFINITY);const e=this._actions[this._index];if(e){const s=this._offset,r=e.len;return n>=r-s?(n=r-s,this._index+=1,this._offset=0):this._offset+=n,e.t===S.DELETE||e.t===S.RETAIN&&e.body==null?m.deepClone({...e,len:n}):m.deepClone({...e,len:n,body:Re(e.body,s,s+n)})}else return{t:S.RETAIN,len:Number.POSITIVE_INFINITY}}peek(){return this._actions[this._index]}peekLength(){return this._actions[this._index]?this._actions[this._index].len-this._offset:Number.POSITIVE_INFINITY}peekType(){const n=this._actions[this._index];return n?n.t:S.RETAIN}rest(){if(this.hasNext()){if(this._offset===0)return this._actions.slice(this._index);{const n=this._offset,e=this._index,s=this.next(),r=this._actions.slice(this._index);return this._offset=n,this._index=e,[s].concat(r)}}else return[]}}function Ks(t){return Object.keys(t).length===1}class yt{constructor(){_(this,"_actions",[])}static compose(n,e){const s=new De(n),r=new De(e),i=new yt;for(;s.hasNext()||r.hasNext();)if(r.peekType()===S.INSERT)i.push(r.next());else if(s.peekType()===S.DELETE)i.push(s.next());else{const o=Math.min(s.peekLength(),r.peekLength()),a=s.next(o),l=r.next(o);a.t===S.INSERT&&l.t===S.RETAIN?l.body==null?i.push(a):i.push({...a,body:me(a.body,l.body,l.coverType)}):a.t===S.RETAIN&&l.t===S.RETAIN?a.body==null&&l.body==null?i.push(a.len!==Number.POSITIVE_INFINITY?a:l):a.body&&l.body?i.push({...a,body:me(a.body,l.body,l.coverType)}):i.push(a.body?a:l):a.t===S.RETAIN&&l.t===S.DELETE?i.push(l):a.t===S.INSERT&&(l.t,S.DELETE)}return i.trimEndUselessRetainAction(),i.serialize()}insert(n,e,s=""){const r={t:S.INSERT,body:e,len:n,line:0,segmentId:s};return this.push(r),this}retain(n,e="",s,r){const i={t:S.RETAIN,len:n,segmentId:e};return s!=null&&(i.body=s),r!=null&&(i.coverType=r),this.push(i),this}delete(n,e=""){const s={t:S.DELETE,len:n,line:0,segmentId:e};return this.push(s),this}serialize(){return this._actions}push(...n){if(n.length>1){for(const i of n)this.push(i);return this}let e=this._actions.length,s=this._actions[e-1];const r=m.deepClone(n[0]);if(r.t===S.RETAIN&&r.len===0&&r.body==null)return this;if(typeof s=="object"){if(s.t===S.DELETE&&r.t===S.DELETE)return s.len+=r.len,this;if(s.t===S.DELETE&&r.t===S.INSERT&&(e-=1,s=this._actions[e-1],s==null))return this._actions.unshift(r),this;if(s.t===S.RETAIN&&r.t===S.RETAIN&&s.body==null&&r.body==null)return s.len+=r.len,this;if(s.t===S.INSERT&&Ks(s.body)&&r.t===S.INSERT&&Ks(r.body))return s.len+=r.len,s.body.dataStream+=r.body.dataStream,this}return e===this._actions.length?this._actions.push(r):this._actions.splice(e,0,r),this}trimEndUselessRetainAction(){let n=this._actions[this._actions.length-1];for(;n&&n.t===S.RETAIN&&Bi(n);)this._actions.pop(),n=this._actions[this._actions.length-1];return this}}function ra(t,n,e){if(n==="")return t;const s={id:"mock-id",body:t,documentStyle:{}},r=new rt(s),i=n.length;let o;for(;(o=r.getBody().dataStream.indexOf(n))>=0;){const l=new yt;if(o>0&&l.retain(o),e.length>0){const h=r.sliceBody(o,o+i),d={dataStream:e};Array.isArray(h==null?void 0:h.textRuns)&&h.textRuns.length&&(d.textRuns=[{...h.textRuns[0],st:0,ed:e.length}]),l.insert(e.length,d)}l.delete(i);const c=l.serialize();r.apply(c)}const a=r.getBody();return r.dispose(),a}class ia extends Mt{add(n){if(!n)return null;const e=new Dt(n,this);return this._observers=[e],this._onObserverAdded&&this._onObserverAdded(e),e}makeObserverTopPriority(){}makeObserverBottomPriority(){}}const oa=A.createIdentifier("ILocalStorageService");function aa(t){return new I.Observable(n=>{const e=t((...s)=>n.next(s));return()=>e==null?void 0:e.dispose()})}function la(t){return`sheet_interceptor_${t}`}const Ys=t=>function(n,e){let s=-1;function r(i,o){if(i<=s)throw new Error("[SheetInterceptorService]: next() called multiple times!");return s=i,i===t.length?o:t[i].handler(o,e,r.bind(null,i+1))}return r(0,n)};class ua{constructor(n){_(this,"_interceptorsByName",new Map);_(this,"_interceptorPoints");this._interceptorPoints=n}fetchThroughInterceptors(n){const e=n,s=this._interceptorsByName.get(e);return Ys(s||[])}intercept(n,e){const s=n;this._interceptorsByName.has(s)||this._interceptorsByName.set(s,[]);const r=this._interceptorsByName.get(s);return r.push(e),this._interceptorsByName.set(s,r.sort((i,o)=>{var a,l;return((a=o.priority)!=null?a:0)-((l=i.priority)!=null?l:0)})),()=>Pt(this._interceptorsByName.get(s),e)}getInterceptPoints(){return this._interceptorPoints}}const ca=A.createIdentifier("univer.snapshot-server-service");class ha{constructor(){_(this,"_sheetBlockCache",new Map)}getUnitOnRev(n,e){return Promise.resolve({snapshot:{unitID:"",type:N.UNIVER_SHEET,rev:0,workbook:void 0,doc:void 0},changesets:[],error:{code:k.OK,message:""}})}getSheetBlock(n,e){const s=this._sheetBlockCache.get(e.blockID);return Promise.resolve({block:s,error:{code:k.OK,message:""}})}fetchMissingChangesets(n,e){return Promise.resolve({changesets:[],error:{code:k.OK,message:""}})}getResourcesRequest(n,e){return Promise.resolve({resources:{},error:{code:k.OK,message:""}})}saveSnapshot(n,e){return Promise.resolve({error:{code:k.OK,message:""}})}saveSheetBlock(n,e){const{block:s}=e;return s?(this._sheetBlockCache.set(s.id,s),Promise.resolve({error:{code:k.OK,message:""},blockID:s.id})):Promise.resolve({error:{code:k.UNDEFINED,message:"block is required"},blockID:""})}saveChangeset(n,e){return Promise.resolve({error:{code:k.OK,message:""},concurrent:[]})}}function da(t){return btoa(encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,(n,e)=>String.fromCharCode(Number.parseInt(e,16))))}function Me(t){return decodeURIComponent(Array.prototype.map.call(atob(t),n=>`%${`00${n.charCodeAt(0).toString(16)}`.slice(-2)}`).join(""))}const Ct=new TextEncoder,Xt=new TextDecoder;function zs(t){const n=m.deepClone(t);return delete n.id,delete n.name,delete n.rowCount,delete n.columnCount,delete n.cellData,Ct.encode(JSON.stringify(n))}function ys(t){const n=m.deepClone(t);return delete n.id,delete n.rev,delete n.name,delete n.sheetOrder,delete n.sheets,Ct.encode(JSON.stringify(n))}function _a(t){const n=m.deepClone(t);return delete n.id,delete n.rev,delete n.title,delete n.resources,Ct.encode(JSON.stringify(n))}function Xs(t){return JSON.parse(Xt.decode(t))}function fa(t){return JSON.parse(typeof t=="string"?Me(t):Xt.decode(t))}function Ea(t){return JSON.parse(typeof t=="string"?Me(t):Xt.decode(t))}const Pe=256;function qs(t,n){const e=new V(t),s=e.getLength(),r=[];let i=0;for(;i<s;){const o=Math.min(i+Pe,s-1),a=e.getSlice(i,Math.min(i+Pe,s-1),0,n),l=ga(a);r.push({id:m.generateRandomId(19,"0123456789"),startRow:i,endRow:o,data:l}),i+=Pe}return r}function ga(t){const n=t.getData();return Ct.encode(JSON.stringify(n))}async function Ra(t,n,e,s,r){const i={},o={};if(!await Promise.all(Object.entries(n.sheets).map(async([d,f])=>{const E={id:f.id,type:It.GRID,name:f.name,rowCount:f.rowCount,columnCount:f.columnCount,originalMeta:zs(f)};if(o[d]=E,f.cellData){const g=qs(f.cellData,f.rowCount),R=await Promise.all(g.map(C=>r.saveSheetBlock(t,{unitID:e,type:N.UNIVER_SHEET,block:C})));if(R.some(C=>{var L;return((L=C.error)==null?void 0:L.code)!==k.OK}))return!1;i[d]={sheetID:d,blocks:R.map(C=>C.blockID)}}return!0})))throw new Error("[transformWorkbookDataToSnapshot()]: Failed to save sheet blocks.");const l=ys(n),c={unitID:n.id,rev:s,creator:"",name:n.name,sheetOrder:n.sheetOrder,sheets:o,blockMeta:i,resources:n.resources||[],originalMeta:l};return{snapshotRes:{unitID:e,rev:c.rev,type:N.UNIVER_SHEET,workbook:c,doc:void 0}}}async function ma(t,n,e,s,r){var f,E;const i={},o={};if(!await Promise.all(Object.entries(n.sheets).map(async([g,R])=>{const C={id:R.id,type:It.GRID,name:R.name,rowCount:R.rowCount,columnCount:R.columnCount,originalMeta:zs(R)};if(o[g]=C,R.cellData){const L=qs(R.cellData,R.rowCount),P=await Promise.all(L.map(F=>r.saveSheetBlock(t,{unitID:e,type:N.UNIVER_SHEET,block:F})));if(P.some(F=>{var Z;return((Z=F.error)==null?void 0:Z.code)!==k.OK}))return!1;i[g]={sheetID:g,blocks:P.map(F=>F.blockID)}}return!0})))throw new Error("[transformWorkbookDataToSnapshot()]: Failed to save sheet blocks.");const l=ys(n),c={unitID:n.id,rev:s,creator:"",name:n.name,sheetOrder:n.sheetOrder,sheets:o,blockMeta:i,resources:n.resources||[],originalMeta:l},h={unitID:e,rev:c.rev,type:N.UNIVER_SHEET,workbook:c,doc:void 0},d=await r.saveSnapshot(t,{unitID:e,type:N.UNIVER_SHEET,snapshot:h});if(zn(d.error))throw new Error(`transformWorkbookDataToSnapshot(): Failed to save snapshot.
8
+ ErrorCode: ${(f=d.error)==null?void 0:f.code}:${(E=d.error)==null?void 0:E.message}`);return{snapshot:h}}function Ca(t,n,e){const s=t.workbook;if(!s)throw new Error("");const r={};Object.entries(s.sheets).forEach(([l,c])=>{const h=Xs(c.originalMeta);r[l]={id:c.id,name:c.name,rowCount:c.rowCount,columnCount:c.columnCount,...h}});const i=new Map;n.forEach(l=>{i.set(l.id,l)}),s.blockMeta&&Object.entries(s.blockMeta).forEach(([l,c])=>{var f;const h=r[l];h.cellData={};const d=[];(f=c.blocks)==null||f.forEach(E=>{const g=i.get(E);if(g)d.push(g);else throw new Error("")}),d.forEach(E=>{const g=fa(E.data);Object.entries(g).forEach(([R,C])=>{const L=h.cellData[+R]={};Object.entries(C).forEach(([P,F])=>{L[+P]=F})})})});const o=Xs(s.originalMeta);return{id:t.unitID,rev:s.rev,name:s.name,sheetOrder:s.sheetOrder,appVersion:"",locale:Q.EN_US,sheets:r,styles:{},resources:s.resources||[],...o}}function Oa(t){const n=t.doc;if(n==null)throw new Error("transformSnapshotToDocumentData(): snapshot.doc is undefined.");const{unitID:e,rev:s,name:r,originalMeta:i}=n,{body:o,documentStyle:a={},settings:l={}}=Ea(i);return{id:e,rev:s,locale:Q.EN_US,title:r,body:o,documentStyle:a,settings:l}}async function Ia(t,n,e,s,r){var l,c,h;const i={unitID:n.id,rev:s,creator:"",name:(l=n.title)!=null?l:"",resources:n.resources||[],originalMeta:_a(n)},o={unitID:e,rev:i.rev,type:N.UNIVER_DOC,workbook:void 0,doc:i},a=await r.saveSnapshot(t,{unitID:e,type:N.UNIVER_DOC,snapshot:o});if(zn(a.error))throw new Error(`transformDocumentDataToSnapshot(): Failed to save snapshot.
9
+ ErrorCode: ${(c=a.error)==null?void 0:c.code}:${(h=a.error)==null?void 0:h.message}`);return{snapshot:o}}async function Aa(t,n){const e=t.workbook;if(!e)throw new Error("Workbook metadata is not available");const s=[],r=[];return Object.entries(e.blockMeta).forEach(([i,o])=>{const a=o.blocks.map(async l=>{const c={unitID:e.unitID,type:N.UNIVER_SHEET,blockID:l},{block:h}=await n.getSheetBlock({},c);if(h)s.push(h);else throw new Error("Block not found")});r.push(...a)}),await Promise.all(r),s}var Js=(t=>(t[t.INFO=0]="INFO",t[t.STOP=1]="STOP",t[t.WARNING=2]="WARNING",t))(Js||{}),Zs=(t=>(t[t.DISABLED=0]="DISABLED",t[t.FULL_ALPHA=1]="FULL_ALPHA",t[t.FULL_HANGUL=2]="FULL_HANGUL",t[t.FULL_KATAKANA=3]="FULL_KATAKANA",t[t.HALF_ALPHA=4]="HALF_ALPHA",t[t.HALF_HANGUL=5]="HALF_HANGUL",t[t.HALF_KATAKANA=6]="HALF_KATAKANA",t[t.HIRAGANA=7]="HIRAGANA",t[t.NO_CONTROL=8]="NO_CONTROL",t[t.OFF=9]="OFF",t[t.ON=10]="ON",t))(Zs||{}),Qs=(t=>(t.BETWEEN="between",t.EQUAL="equal",t.GREATER_THAN="greaterThan",t.GREATER_THAN_OR_EQUAL="greaterThanOrEqual",t.LESS_THAN="lessThan",t.LESS_THAN_OR_EQUAL="lessThanOrEqual",t.NOT_BETWEEN="notBetween",t.NOT_EQUAL="notEqual",t))(Qs||{}),tr=(t=>(t.CUSTOM="custom",t.LIST="list",t.LIST_MULTIPLE="listMultiple",t.NONE="none",t.TEXT_LENGTH="textLength",t.DATE="date",t.TIME="time",t.WHOLE="whole",t.DECIMAL="decimal",t.CHECKBOX="checkbox",t))(tr||{}),er=(t=>(t.VALID="valid",t.INVALID="invalid",t.VALIDATING="validating",t))(er||{});sr(),u.ABCToNumber=ci,u.AbsoluteRefType=v,u.ActionIterator=De,u.AlignTypeH=On,u.AlignTypeV=In,u.AutoFillSeries=pe,u.BaselineOffset=ot,u.BlockType=en,u.BooleanNumber=O,u.BorderStyleTypes=w,u.BorderType=We,u.BulletAlignment=j,u.COLORS=qt,u.CellValueType=et,u.ClientSnapshotServerService=ha,u.Color=nt,u.ColorBuilder=Lt,u.ColorKit=$,u.ColorType=B,u.ColumnSeparatorType=rn,u.CommandType=Gt,u.CommonHideTypes=Be,u.ConfigService=_s,u.ContentAlignment=En,u.ContextService=as,u.CopyPasteType=ke,u.CustomRangeType=tn,u.DEFAULT_CELL=Oi,u.DEFAULT_DOC=Ce,u.DEFAULT_DOCUMENT_SUB_COMPONENT_ID=zi,u.DEFAULT_EMPTY_DOCUMENT_VALUE=Do,u.DEFAULT_RANGE=mi,u.DEFAULT_RANGE_ARRAY=_t,u.DEFAULT_SELECTION=Ci,u.DEFAULT_SLIDE=Kn,u.DEFAULT_STYLES=pt,u.DEFAULT_WORKSHEET_COLUMN_COUNT=Cs,u.DEFAULT_WORKSHEET_COLUMN_COUNT_KEY=Ji,u.DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT=Ns,u.DEFAULT_WORKSHEET_COLUMN_TITLE_HEIGHT_KEY=eo,u.DEFAULT_WORKSHEET_COLUMN_WIDTH=Is,u.DEFAULT_WORKSHEET_COLUMN_WIDTH_KEY=Qi,u.DEFAULT_WORKSHEET_ROW_COUNT=ms,u.DEFAULT_WORKSHEET_ROW_COUNT_KEY=qi,u.DEFAULT_WORKSHEET_ROW_HEIGHT=Os,u.DEFAULT_WORKSHEET_ROW_HEIGHT_KEY=Zi,u.DEFAULT_WORKSHEET_ROW_TITLE_WIDTH=As,u.DEFAULT_WORKSHEET_ROW_TITLE_WIDTH_KEY=to,u.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY=ps,u.DOCS_NORMAL_EDITOR_UNIT_ID_KEY=Fs,u.DashStyleType=dn,u.DataStreamTreeNodeType=Xn,u.DataStreamTreeTokenType=_e,u.DataValidationErrorStyle=Js,u.DataValidationImeMode=Zs,u.DataValidationOperator=Qs,u.DataValidationRenderMode=js,u.DataValidationStatus=er,u.DataValidationType=tr,u.DesktopLogService=us,u.DeveloperMetadataVisibility=Ge,u.Dimension=$e,u.Direction=Ve,u.Disposable=D,u.DisposableCollection=se,u.DocStyleType=Ze,u.DocumentDataModel=rt,u.EDITOR_ACTIVATED=Ts,u.EXTENSION_NAMES=Yn,u.Entry=re,u.EntryIterator=Gn,u.ErrorService=fs,u.EventState=pn,u.FOCUSING_DOC=$t,u.FOCUSING_EDITOR_BUT_HIDDEN=co,u.FOCUSING_EDITOR_INPUT_FORMULA=ho,u.FOCUSING_EDITOR_STANDALONE=fo,u.FOCUSING_FORMULA_EDITOR=ws,u.FOCUSING_SHEET=Rt,u.FOCUSING_SLIDE=Vt,u.FOCUSING_UNIVER_EDITOR=_o,u.FOCUSING_UNIVER_EDITOR_STANDALONE_SINGLE_MODE=Eo,u.FloatingObjectManagerService=Es,u.FollowNumberWithType=Qe,u.FontItalic=At,u.FontStyleType=gn,u.FontWeight=Nt,u.FormatType=xe,u.GlyphType=ct,u.GridType=nn,u.HLSColor=qe,u.HorizontalAlign=tt,u.ICommandService=Et,u.IConfigService=ds,u.IContextService=ft,u.IFloatingObjectManagerService=gs,u.ILocalStorageService=oa,u.ILogService=y,u.IPermissionService=Le,u.IResourceLoaderService=we,u.IResourceManagerService=jt,u.ISnapshotServerService=ca,u.IUndoRedoService=Yt,u.IUniverInstanceService=X,u.InterceptorManager=ua,u.InterpolationPointType=je,u.KeyIterator=Bn,u.LRUHelper=dt,u.LRUMap=$n,u.LifecycleStages=b,u.LocaleService=mt,u.LocaleType=Q,u.LogLevel=ls,u.MemoryCursor=yn,u.NamedStyleType=cn,u.NilCommand=hs,u.NumberUnitType=Cn,u.ObjectMatrix=V,u.ObjectRelativeFromH=Rn,u.ObjectRelativeFromV=mn,u.Observable=Mt,u.ObservableHooks=ia,u.Observer=Dt,u.OnLifecycle=Ae,u.PRESET_LIST_TYPE=Ui,u.PageElementType=Sn,u.PageOrientType=Nn,u.PageType=Qt,u.ParagraphElementType=an,u.PermissionPoint=Vn,u.PermissionStatus=le,u.Plugin=Ue,u.PositionedObjectLayoutType=un,u.PresetListType=kt,u.ProtectionType=Ke,u.RANGE_TYPE=p,u.RGBA_PAREN=ur,u.RGB_PAREN=lr,u.Range=st,u.Rectangle=z,u.RedoCommand=$s,u.RedoCommandId=Bs,u.RefAlias=ui,u.Registry=he,u.RegistryAsMap=de,u.RelativeDate=Ye,u.RelativeSlideLink=Ln,u.ResourceManagerService=Ps,u.RgbColor=Tt,u.RxDisposable=Qr,u.SectionType=sn,u.ShapeType=ze,u.SheetTypes=It,u.SheetViewModel=Ls,u.SlideDataModel=Ie,u.SpacingRule=hn,u.Styles=Rs,u.THEME_COLORS=Xe,u.TabStopAlignment=_n,u.TextDecoration=ye,u.TextDirection=lt,u.TextDirectionType=on,u.TextX=yt,u.TextXActionType=S,u.ThemeColor=wt,u.ThemeColorType=W,u.ThemeColors=St,u.ThemeService=be,u.Tools=m,u.UndoCommand=Gs,u.UndoCommandId=ks,u.UnitModel=Bt,u.Univer=yo,u.UniverEditablePermission=Kt,u.UniverEditablePermissionPoint=Ds,u.UniverInstanceType=N,u.UpdateDocsAttributeType=H,u.ValueIterator=kn,u.VerticalAlign=it,u.WidthType=fn,u.Worksheet=gt,u.WrapStrategy=ut,u.WrapTextType=ln,u.b64DecodeUnicode=Me,u.b64EncodeUnicode=da,u.binarySearchArray=He,u.cellToRange=jr,u.characterSpacingControlType=An,u.checkForSubstrings=Kr,u.checkParagraphHasBullet=Yr,u.checkParagraphHasIndent=zr,u.checkParagraphHasIndentByStyle=wn,u.codeToBlob=or,u.composeBody=me,u.composeInterceptors=Ys,u.concatMatrixArray=ri,u.convertBodyToHtml=Ri,u.covertTextRunToHtml=ce,u.createInterceptorKey=la,u.createInternalEditorID=Mo,u.createRowColIter=ue,u.debounce=gi,u.dedupe=ti,u.deepCompare=te,u.deleteContent=vn,u.extractPureTextFromCell=no,u.fromCallback=aa,u.fromObservable=Zr,u.generateTemporarySnap=Ra,u.getArrayLength=Y,u.getBodySlice=Re,u.getBodySliceHtml=Ft,u.getBorderStyleType=Vr,u.getCellValueType=Sr,u.getColorStyle=x,u.getDocsUpdateBody=Ut,u.getReverseDirection=ar,u.getSheetBlocksFromSnapshot=Aa,u.getTypeFromPermissionItemList=li,u.getWorksheetUID=uo,u.groupBy=si,u.handleJsonToDom=Gr,u.handleStyleToString=$r,u.hashAlgorithm=Xr,u.horizontalLineSegmentsSubtraction=ee,u.insertMatrixArray=ie,u.insertTextToContent=bn,u.isBlackColor=Ir,u.isBooleanString=ta,u.isCellV=Tr,u.isEmptyCell=Wr,u.isFormulaId=kr,u.isFormulaString=Br,u.isICellData=Nr,u.isInternalEditorID=Po,u.isNullCell=Lr,u.isNumeric=xs,u.isObserver=Wn,u.isRangesEqual=qo,u.isRealNum=yr,u.isSafeNumeric=Qo,u.isSameStyleTextRun=Tn,u.isUnitRangesEqual=Jo,u.isValidRange=xr,u.isWhiteColor=Ar,u.makeCellRangeToRangeData=pr,u.makeCellToSelection=Fr,u.mergeOverrideWithDependencies=Vs,u.mergeSets=ea,u.mergeWorksheetSnapshotWithDefault=Ss,u.moveMatrixArray=ae,u.moveRangeByOffset=Li,u.normalizeTextRuns=fe,u.numberToABC=di,u.numberToListABC=_i,u.orderSearchArray=Fe,u.queryObjectMatrix=Si,u.remove=Pt,u.repeatStringNumTimes=jn,u.replaceInDocumentBody=ra,u.requestImmediateMacroTask=sa,u.rotate=ni,u.runOnLifecycle=Ne,u.searchArray=ir,u.selectionToArray=wr,u.sequence=os,u.sequenceAsync=is,u.sequenceExecute=Oe,u.sequenceExecuteAsync=Yi,u.shallowEqual=Zo,u.sliceMatrixArray=ii,u.sortRules=fi,u.sortRulesByDesc=Ei,u.sortRulesFactory=at,u.spliceArray=oe,u.textDecoder=Xt,u.textEncoder=Ct,u.throttle=na,u.toDisposable=U,u.transformDocumentDataToSnapshot=Ia,u.transformSnapshotToDocumentData=Oa,u.transformSnapshotToWorkbookData=Ca,u.transformWorkbookDataToSnapshot=ma,Object.defineProperty(u,Symbol.toStringTag,{value:"Module"})});