From eb11e6f0df09028e04f4b30f2f69536046032912 Mon Sep 17 00:00:00 2001 From: Dushusir <1414556676@qq.com> Date: Mon, 24 Apr 2023 14:17:30 +0800 Subject: [PATCH] colla --- index.html | 4 ++-- web/public/univer-preact-ts.iife.js | 18 +++++++++--------- web/src/utils/index.js | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/index.html b/index.html index 27fe0eb27..929325516 100644 --- a/index.html +++ b/index.html @@ -1,3 +1,3 @@ -一个简单的web思维导图实现
\ No newline at end of file + }
\ No newline at end of file diff --git a/web/public/univer-preact-ts.iife.js b/web/public/univer-preact-ts.iife.js index 0d6107cfe..b094f2d1f 100644 --- a/web/public/univer-preact-ts.iife.js +++ b/web/public/univer-preact-ts.iife.js @@ -1,4 +1,4 @@ -var __defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(t,e,r)=>e in t?__defProp(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,__spreadValues=(t,e)=>{for(var r in e||(e={}))__hasOwnProp.call(e,r)&&__defNormalProp(t,r,e[r]);if(__getOwnPropSymbols)for(var r of __getOwnPropSymbols(e))__propIsEnum.call(e,r)&&__defNormalProp(t,r,e[r]);return t},__spreadProps=(t,e)=>__defProps(t,__getOwnPropDescs(e)),UniverPreactTs=function(t){"use strict";var e,r;(r=e||(e={}))[r.OBSERVER_ACTION=1]="OBSERVER_ACTION",r[r.SERVER_ACTION=2]="SERVER_ACTION",r[r.UNDO_ACTION=3]="UNDO_ACTION",r[r.EXTENSION_ACTION=4]="EXTENSION_ACTION",r[r.DEFAULT_ACTION=7]="DEFAULT_ACTION";class s{constructor(t,e){this._doActionData=t,this._observers=e,this._operation=1}getDoActionData(){return this._doActionData}getOldActionData(){return this._oldActionData}hasOperation(t){return(this._operation&t)===t}addOperation(t){this._operation|=t}removeOperation(t){this._operation&=~t}}class l{constructor(t=!1){this.isStopPropagation=!1,this.initialize(t)}initialize(t=!1){return this.skipNextObservers=t,this}stopPropagation(){this.isStopPropagation=!0}}class n{constructor(t){this.callback=t,this._willBeUnregistered=!1,this.unregisterOnNextCall=!1}}class o{constructor(t){this._observers=new Array,this._eventState=new l,t&&(this._onObserverAdded=t)}get observers(){return this._observers}add(t,e=!1,r=!1){if(!t)return null;const s=new n(t);return s.unregisterOnNextCall=r,e?this._observers.unshift(s):this._observers.push(s),this._onObserverAdded&&this._onObserverAdded(s),s}addOnce(t){return this.add(t,void 0,!0)}remove(t){if(!t)return!1;return-1!==this._observers.indexOf(t)&&(this._deferUnregister(t),!0)}removeCallback(t){for(let e=0;el.callback(t,r))),l.unregisterOnNextCall&&this._deferUnregister(l)))}return e.then((()=>t))}notifyObserver(t,e){if(t._willBeUnregistered)return;const r=this._eventState;return r.skipNextObservers=!1,t.callback(e,r),t.unregisterOnNextCall&&this._deferUnregister(t),{lastReturnValue:r.lastReturnValue,stopPropagation:r.isStopPropagation}}hasObservers(){return this._observers.length>0}clear(){this._observers=new Array,this._onObserverAdded=null}clone(){const t=new o;return t._observers=this._observers.slice(0),t}_deferUnregister(t){t.unregisterOnNextCall=!1,t._willBeUnregistered=!0,setTimeout((()=>{this._remove(t)}),0)}_remove(t){if(!t)return!1;const e=this._observers.indexOf(t);return-1!==e&&(this._observers.splice(e,1),!0)}}class i{constructor(t,e){this.name=t,this.observableHooks=e}}class a{constructor(){this._observableHooksArray=new Array}addHooks(t,e){this._observableHooksArray.push(new i(t,e))}getHooks(t){const e=this._observableHooksArray.find((e=>e.name===t));return e?e.observableHooks:null}}function g(t,e){let r=0,s=t.length-1;for(;r<=s;){let l=Math.floor((s+r)/2);if(e=t[l-1]))return l;if(e>=t[l])r=l+1;else{if(!(e=0&&o>=r;){if(s=t[o],l=0===o?0:t[o-1],e>=l&&e=l&&e=t[r-20]?c(t,e):g(t,e),r}const h=t=>null!=t,d=t=>{let e=Object.keys(t),r=/^\d+$/,s=0;for(let l=0;ls&&(s=n)}return s};class u{constructor(...t){switch(t.length){case 0:return this._array={},void(this._length=0);case 1:{if("number"==typeof t[0])return this._array={},void(this._length=t[0]);const e=d(t[0]);if(e>-1)return this._array=t[0],void(this._length=e);throw new Error(`create object array error ${JSON.stringify(t[0])}`)}case 2:if(d(t[0])>-1)return this._array=t[0],void(this._length=t[1]);throw new Error(`create object array error ${JSON.stringify(t[0])}`)}}static objectKeys(t){if(t){const e=Object.keys(t),r=e.indexOf("length");return r>-1&&e.splice(r,1),e}return[]}static getMaxLength(t){if(t){if(t.length)return t.length;const e=u.objectKeys(t);if(e.length)return Math.max(...e)+1}return 0}obtain(t,e){var r;return null!=(r=this._array[t])?r:e}getKeys(){return u.objectKeys(this._array)}get(t){return this._array[t]}set(t,e){if(h(e)){const r=this._length;this._array[t]=e,t>=r&&(this._length=t+1)}}pop(){const t=this._length,e=this._array;if(t>0){const r=t-1,s=e[r];return r>0&&(delete e[r],this._length--),s}return null}push(t){if(h(t)){let e=this._length;this._array[e++]=t,this._length=e}}first(){return this._array[0]}last(){const t=this._length-1;return this._array[t]}shift(){const t=this._length;if(t>0){const e=this._array[0],r=t-1;let s;for(let t=0;t{e.set(r,t(s))})):this.forEach(((t,r)=>{e.set(t,r)})),e}isEmpty(){const t=this._array;return 0===Object.keys(t).length}delete(t){this.splice(t,1)}includes(t){const e=this._array,r=Object.keys(e),s=r.length;for(let l=0;l0){const s={};let l=0;for(let n=t;n0){const s=t+e,l=this._array;let n=0;const o={};for(let e=t;e=t;l--)s[l+1]=s[l];return s[t]=e,this._length=r+1,this}inserts(t,e){const r=e._array,s=e._length,l=this._array;for(let n=this._length-1;n>=t;n--){const t=l[n];h(t)&&(delete l[n],l[n+s]=t)}for(let n=0;n{for(let o=t;o{const s=e.getRow(t);if(s)return r=s.getLength(),!1})),this.forEach(((s,l)=>{var n,o;for(let i=t;ie&&(e=r-1)}}return{startRow:0,startColumn:0,endRow:t,endColumn:e}}toArray(){return this._option.toArray().map((t=>new u(t).toArray()))}toJSON(){return this._matrix}getData(){const t=JSON.stringify(this);return JSON.parse(t)}getArrayData(){let t=0,e=0,r=!1,s=!1;const l=new v;return this.forEach(((n,o)=>{r||(r=!0,t=n),o.forEach(((r,o)=>{s?r{s||(s=!0,t=n);const i=o.getLength()-1;i>r&&(r=i),o.forEach(((t,r)=>{l?t=_.length;)r/=_.length,r-=1,e+=_[r%_.length];return e+=_[t%_.length],e}static getEnvironment(){const{appVersion:t}=navigator,e=this.getSystemType();return{app_version:t,os:e,os_version:e,device_id:"",platform:"web"}}static indexAt(t){let e=0;for(let r=0;r-1)return"Linux";if(e){if(t.indexOf("Windows NT 5.0")>-1||t.indexOf("Windows 2000")>-1)return"Windows 2000";if(t.indexOf("Windows NT 5.1")>-1||t.indexOf("Windows XP")>-1)return"Windows XP";if(t.indexOf("Windows NT 5.2")>-1||t.indexOf("Windows 2003")>-1)return"Windows 2003";if(t.indexOf("Windows NT 6.0")>-1||t.indexOf("Windows Vista")>-1)return"Windows Vista";if(t.indexOf("Windows NT 6.1")>-1||t.indexOf("Windows 7")>-1)return"Windows 7";if(t.indexOf("Windows NT 10")>-1||t.indexOf("Windows 10")>-1)return"Windows 10";if(t.indexOf("Windows NT 11")>-1||t.indexOf("Windows 11")>-1)return"Windows 11"}return"Unknown system"}static getBrowserType(){const t=navigator.userAgent,e=t.indexOf("Opera")>-1,r=t.indexOf("compatible")>-1&&t.indexOf("MSIE")>-1&&!e,s=t.indexOf("Trident")>-1&&t.indexOf("rv:11.0")>-1,l=t.indexOf("Edge")>-1,n=t.indexOf("Firefox")>-1,o=t.indexOf("Safari")>-1&&-1===t.indexOf("Chrome"),i=t.indexOf("Chrome")>-1&&t.indexOf("Safari")>-1;if(r){new RegExp("MSIE (\\d+\\.\\d+);").test(t);const e=parseFloat(RegExp.$1);return 7===e?"IE7":8===e?"IE8":9===e?"IE9":10===e?"IE10":"0"}return n?"FF":e?"Opera":o?"Safari":i?"Chrome":l?"Edge":s?"IE11":"Unknown browser"}static generateRandomId(t=21){return((t=21)=>crypto.getRandomValues(new Uint8Array(t)).reduce(((t,e)=>t+((e&=63)<36?e.toString(36):e<62?(e-26).toString(36).toUpperCase():e>62?"-":"_")),""))(t)}static getClassName(t){return t.constructor.name}static deepMerge(t,...e){function r(t,e){t.forEach(((t,l)=>{var n,o;if(B.isArray(t)){const s=null!=(n=e[l])?n:[];return e[l]=s,void r(t,s)}if(B.isObject(t)){const r=null!=(o=e[l])?o:{};return e[l]=r,void s(t,r)}e[l]=t}))}function s(t,e){Object.keys(t).forEach((l=>{var n,o;const i=t[l];if(B.isObject(i)){const t=null!=(n=e[l])?n:{};return e[l]=t,void s(i,t)}if(B.isArray(i)){const t=null!=(o=e[l])?o:[];return e[l]=t,void r(i,t)}e[l]=i}))}return e.forEach((e=>e&&function(e){Object.keys(e).forEach((l=>{var n,o;const i=e[l];if(B.isArray(i)){const e=null!=(n=t[l])?n:[];return t[l]=e,void r(i,e)}if(B.isObject(i)){const e=null!=(o=t[l])?o:{};return t[l]=e,void s(i,e)}t[l]=i}))}(e))),t}static numberFixed(t,e){return Number(Number(t).toFixed(e))}static diffValue(t,e){function r(s,l){return B.getValueType(s)===B.getValueType(l)&&(B.isArray(s)?function(s,l){if(t.length!==e.length)return!1;for(let t=0,e=s.length;t{e[r]=B.deepClone(t)})),e}if(this.isObject(t)){const e={};return Object.keys(t).forEach((r=>{const s=t[r];e[r]=B.deepClone(s)})),Object.setPrototypeOf(e,Object.getPrototypeOf(t)),e}return t}static getLanguage(){const t="en-US";return globalThis.navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||t}static getValueType(t){return Object.prototype.toString.apply(t)}static isDefine(t){return null!=t}static isBlank(t){return!this.isDefine(t)||!!this.isString(t)&&""===t.trim()}static isAssignableFrom(t,e){return t instanceof e}static isBoolean(t){return"[object Boolean]"===this.getValueType(t)}static isPlainObject(t){return!!this.isDefine(t)&&Object.getPrototypeOf(t)===Object.getPrototypeOf({})}static isFunction(t){return"[object Function]"===this.getValueType(t)}static isDate(t){return"[object Date]"===this.getValueType(t)}static isRegExp(t){return"[object RegExp]"===this.getValueType(t)}static isArray(t){return"[object Array]"===this.getValueType(t)}static isString(t){return"[object String]"===this.getValueType(t)}static isNumber(t){return"[object Number]"===this.getValueType(t)}static isStringNumber(t){return!isNaN(parseFloat(t))&&isFinite(t)}static isObject(t){return"[object Object]"===this.getValueType(t)}static isEmptyObject(t){for(const e in t)return!1;return!0}static isMobile(){let t=0,e=0;return document.body.clientWidth&&(t=document.body.clientWidth),document.body.clientHeight&&(e=document.body.clientHeight),this.isAndroid()||this.isIPhone()||this.isTablet()||t<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 t=navigator.userAgent.toLowerCase();return"micromessenger"===String(t.match(/MicroMessenger/i))}static isAndroid(){const t=navigator.userAgent;return t.indexOf("Android")>-1||t.indexOf("Linux")>-1}static isIPhone(){return/iPhone/i.test(navigator.userAgent)}static isIEBrowser(){return this.getBrowserType().startsWith("IE")}static itCount(t){return e=>{for(let r=0;r0)}static capitalize(t){return t.charAt(0).toUpperCase()+t.slice(1)}static fCamelCase(t,e){return e.toUpperCase()}static camelCase(t){return t.replace(m,"ms-").replace(p,this.fCamelCase)}static removeNull(t){if(this.isObject(t)){const e={};return Object.keys(t).forEach((e=>{const r=t[e];null==r?delete t[e]:B.removeNull(r)})),e}return t}static fillTwoDimensionalArray(t,e,r){return new Array(t).fill(r).map((t=>new Array(e).fill(r)))}static fillObjectMatrix(t,e,r){const s=new v;for(let l=0;l0;){let r=t%26;r=0===r?r=26:r,e=String.fromCharCode(96+r)+e,t=(t-r)/26}return e.toLocaleUpperCase()}static ABCatNum(t){if(null==t||0===t.length)return NaN;const e=t.toLowerCase().split(""),r=e.length;let s=0,l=0;for(let n=0;n=0;)s=String.fromCharCode(t%r+e)+s,t=Math.floor(t/r)-1;return s.toUpperCase()}static randSort(t){for(let e=0,r=t.length;e{e[r]={},t.forEach(((t,s)=>{e[r][s]=t}))})),e}}var C,w,T,y,S,j,E,Y,R,I,A,x,O,N,k,M,D,L,P,H,F,U,z,W,V,G,X,Q,K,Z,$,q,J,tt,et,rt,st,lt,nt,ot,it,at,gt,ct,bt,ht,dt,ut,ft,vt,mt,pt,_t,Bt,Ct,wt,Tt,yt,St,jt,Et,Yt,Rt,It,At,xt,Ot,Nt,kt,Mt,Dt,Lt,Pt,Ht,Ft,Ut,zt,Wt,Vt,Gt,Xt,Qt,Kt,Zt,$t,qt,Jt,te,ee,re,se,le,ne,oe,ie,ae,ge,ce,be,he,de,ue,fe,ve,me,pe,_e,Be,Ce,we,Te,ye,Se,je,Ee,Ye;(w=C||(C={}))[w.TAB=0]="TAB",w[w.SPACE=1]="SPACE",w[w.NOTHING=2]="NOTHING",(y=T||(T={}))[y.GLYPH_TYPE_UNSPECIFIED=0]="GLYPH_TYPE_UNSPECIFIED",y[y.NONE=1]="NONE",y[y.DECIMAL=2]="DECIMAL",y[y.ZERO_DECIMAL=3]="ZERO_DECIMAL",y[y.UPPER_ALPHA=4]="UPPER_ALPHA",y[y.ALPHA=5]="ALPHA",y[y.UPPER_ROMAN=6]="UPPER_ROMAN",y[y.ROMAN=7]="ROMAN",(j=S||(S={}))[j.BULLET_ALIGNMENT_UNSPECIFIED=0]="BULLET_ALIGNMENT_UNSPECIFIED",j[j.START=1]="START",j[j.CENTER=2]="CENTER",j[j.END=3]="END",(Y=E||(E={}))[Y.PARAGRAPH=0]="PARAGRAPH",Y[Y.TABLE=1]="TABLE",Y[Y.SECTION_BREAK=2]="SECTION_BREAK",Y[Y.CUSTOM=3]="CUSTOM",(I=R||(R={}))[I.DEFAULT=0]="DEFAULT",I[I.LINES=1]="LINES",I[I.LINES_AND_CHARS=2]="LINES_AND_CHARS",I[I.SNAP_TO_CHARS=3]="SNAP_TO_CHARS",(x=A||(A={}))[x.SECTION_TYPE_UNSPECIFIED=0]="SECTION_TYPE_UNSPECIFIED",x[x.CONTINUOUS=1]="CONTINUOUS",x[x.NEXT_PAGE=2]="NEXT_PAGE",x[x.EVEN_PAGE=3]="EVEN_PAGE",x[x.ODD_PAGE=4]="ODD_PAGE",(N=O||(O={}))[N.COLUMN_SEPARATOR_STYLE_UNSPECIFIED=0]="COLUMN_SEPARATOR_STYLE_UNSPECIFIED",N[N.NONE=1]="NONE",N[N.BETWEEN_EACH_COLUMN=2]="BETWEEN_EACH_COLUMN",(M=k||(k={}))[M.NORMAL=0]="NORMAL",M[M.TBRL=1]="TBRL",M[M.LRTBV=2]="LRTBV",(L=D||(D={}))[L.TEXT_RUN=0]="TEXT_RUN",L[L.AUTO_TEXT=1]="AUTO_TEXT",L[L.PAGE_BREAK=2]="PAGE_BREAK",L[L.COLUMN_BREAK=3]="COLUMN_BREAK",L[L.FOOT_NOTE_REFERENCE=4]="FOOT_NOTE_REFERENCE",L[L.HORIZONTAL_RULE=5]="HORIZONTAL_RULE",L[L.EQUATION=6]="EQUATION",L[L.DRAWING=7]="DRAWING",L[L.PERSON=8]="PERSON",L[L.RICH_LINK=9]="RICH_LINK",(H=P||(P={}))[H.BOTH_SIDES=0]="BOTH_SIDES",H[H.LEFT=1]="LEFT",H[H.RIGHT=2]="RIGHT",H[H.LARGEST=3]="LARGEST",(U=F||(F={}))[U.INLINE=0]="INLINE",U[U.WRAP_NONE=1]="WRAP_NONE",U[U.WRAP_POLYGON=2]="WRAP_POLYGON",U[U.WRAP_SQUARE=3]="WRAP_SQUARE",U[U.WRAP_THROUGH=4]="WRAP_THROUGH",U[U.WRAP_TIGHT=5]="WRAP_TIGHT",U[U.WRAP_TOP_AND_BOTTOM=6]="WRAP_TOP_AND_BOTTOM",(W=z||(z={}))[W.NAMED_STYLE_TYPE_UNSPECIFIED=0]="NAMED_STYLE_TYPE_UNSPECIFIED",W[W.NORMAL_TEXT=1]="NORMAL_TEXT",W[W.TITLE=2]="TITLE",W[W.SUBTITLE=3]="SUBTITLE",W[W.HEADING_1=4]="HEADING_1",W[W.HEADING_2=5]="HEADING_2",W[W.HEADING_3=6]="HEADING_3",W[W.HEADING_4=7]="HEADING_4",W[W.HEADING_5=8]="HEADING_5",W[W.HEADING_6=9]="HEADING_6",(G=V||(V={}))[G.AUTO=0]="AUTO",G[G.AT_LEAST=1]="AT_LEAST",G[G.EXACT=2]="EXACT",(Q=X||(X={}))[Q.DASH_STYLE_UNSPECIFIED=0]="DASH_STYLE_UNSPECIFIED",Q[Q.SOLID=1]="SOLID",Q[Q.DOT=2]="DOT",Q[Q.DASH=3]="DASH",(Z=K||(K={}))[Z.TAB_STOP_ALIGNMENT_UNSPECIFIED=0]="TAB_STOP_ALIGNMENT_UNSPECIFIED",Z[Z.START=1]="START",Z[Z.CENTER=2]="CENTER",Z[Z.END=3]="END",(q=$||($={})).EVENLY_DISTRIBUTED="0",q.FIXED_WIDTH="1",(tt=J||(J={}))[tt.CONTENT_ALIGNMENT_UNSPECIFIED=0]="CONTENT_ALIGNMENT_UNSPECIFIED",tt[tt.CONTENT_ALIGNMENT_UNSUPPORTED=1]="CONTENT_ALIGNMENT_UNSUPPORTED",tt[tt.TOP=2]="TOP",tt[tt.MIDDLE=3]="MIDDLE",tt[tt.BOTTOM=4]="BOTTOM",(rt=et||(et={})).NORMAL="normal",rt.BOLD="bold",rt.ITALIC="italic",(lt=st||(st={}))[lt.CHARACTER=0]="CHARACTER",lt[lt.COLUMN=1]="COLUMN",lt[lt.INSIDE_MARGIN=2]="INSIDE_MARGIN",lt[lt.LEFT_MARGIN=3]="LEFT_MARGIN",lt[lt.MARGIN=4]="MARGIN",lt[lt.OUTSIDE_MARGIN=5]="OUTSIDE_MARGIN",lt[lt.PAGE=6]="PAGE",lt[lt.RIGHT_MARGIN=7]="RIGHT_MARGIN",(ot=nt||(nt={}))[ot.BOTTOM_MARGIN=0]="BOTTOM_MARGIN",ot[ot.INSIDE_MARGIN=1]="INSIDE_MARGIN",ot[ot.LINE=2]="LINE",ot[ot.MARGIN=3]="MARGIN",ot[ot.OUTSIDE_MARGIN=4]="OUTSIDE_MARGIN",ot[ot.PAGE=5]="PAGE",ot[ot.PARAGRAPH=6]="PARAGRAPH",ot[ot.TOP_MARGIN=7]="TOP_MARGIN",(at=it||(it={}))[at.POINT=0]="POINT",at[at.LINE=1]="LINE",at[at.CHARACTER=2]="CHARACTER",(ct=gt||(gt={}))[ct.CENTER=0]="CENTER",ct[ct.INSIDE=1]="INSIDE",ct[ct.LEFT=2]="LEFT",ct[ct.OUTSIDE=3]="OUTSIDE",ct[ct.RIGHT=4]="RIGHT",(ht=bt||(bt={}))[ht.BOTTOM=0]="BOTTOM",ht[ht.CENTER=1]="CENTER",ht[ht.INSIDE=2]="INSIDE",ht[ht.OUTSIDE=3]="OUTSIDE",ht[ht.TOP=4]="TOP",(ut=dt||(dt={}))[ut.compressPunctuation=0]="compressPunctuation",ut[ut.compressPunctuationAndJapaneseKana=1]="compressPunctuationAndJapaneseKana",ut[ut.doNotCompress=2]="doNotCompress",(vt=ft||(ft={}))[vt.PORTRAIT=0]="PORTRAIT",vt[vt.LANDSCAPE=1]="LANDSCAPE",(pt=mt||(mt={})).INSERT_ROW_DATA_ACTION="InsertRowDataAction",pt.REMOVE_ROW_DATA_ACTION="RemoveRowDataAction",pt.INSERT_ROW_ACTION="InsertRowAction",pt.REMOVE_ROW_ACTION="RemoveRowAction",pt.SET_RANGE_STYLE_ACTION="SetRangeStyleAction",pt.SET_SELECTION_ACTION="SetSelectionActivateAction",pt.SET_RANGE_DATA_ACTION="SetRangeDataAction",pt.SET_RANGE_FORMATTED_VALUE_ACTION="SetRangeFormattedValueAction",pt.SET_RANGE_NOTE_ACTION="SetRangeNoteAction",pt.DELETE_RANGE_ACTION="DeleteRangeAction",pt.INSERT_SHEET_ACTION="InsertSheetAction",pt.REMOVE_SHEET_ACTION="RemoveSheetAction",pt.CLEAR_RANGE_ACTION="ClearRangeAction",pt.INSERT_RANGE_ACTION="InsertRangeAction",pt.SET_TAB_COLOR_ACTION="SetTabColorAction",pt.HIDE_SHEET_ACTION="SetWorkSheetHideAction",pt.SET_WORKSHEET_ACTIVATE_ACTION="SetWorkSheetActivateAction",pt.INSERT_COLUMN_ACTION="InsertColumnAction",pt.INSERT_COLUMN_DATA_ACTION="InsertColumnDataAction",pt.REMOVE_COLUMN_ACTION="RemoveColumnAction",pt.REMOVE_COLUMN_DATA_ACTION="RemoveColumnDataAction",pt.SET_HIDE_ROW_ACTION="SetRowHideAction",pt.SET_HIDE_COLUMN_ACTION="SetColumnHideAction",pt.SET_SHOW_ROW_ACTION="SetRowShowAction",pt.SET_SHOW_COLUMN_ACTION="SetColumnShowAction",pt.ADD_MERGE_ACTION="AddMergeAction",pt.REMOVE_MERGE_ACTION="RemoveMergeAction",pt.SET_WORKSHEET_NAME_ACTION="SetWorkSheetNameAction",pt.SET_WORKSHEET_STATUS_ACTION="SetWorkSheetStatusAction",pt.SET_BORDER_ACTION="SetBorderAction",pt.SET_COLUMN_WIDTH_ACTION="SetColumnWidthAction",pt.SET_ROW_HEIGHT_ACTION="SetRowHeightAction",pt.SET_HIDDEN_GRIDLINES_ACTION="SetHiddenGridlinesAction",pt.SET_RIGHT_TO_LEFT_ACTION="SetRightToLeftAction",pt.DELETE_BANDING_ACTION="DeleteBandingAction",pt.SET_BANDING_ACTION="SetBandingAction",pt.ADD_BANDING_ACTION="AddBandingAction",pt.DELETE_NAMED_RANGE_ACTION="DeleteNamedRangeAction",pt.SET_NAMED_RANGE_ACTION="SetNamedRangeAction",pt.ADD_NAMED_RANGE_ACTION="AddNamedRangeAction",pt.SET_SHEET_ORDER_ACTION="SetSheetOrderAction",pt.SET_ZOOM_RATIO_ACTION="SetZoomRatioAction",pt.SET_FROZEN_COLUMNS_ACTION="SetFrozenColumnsAction",pt.SET_FROZEN_ROWS_ACTION="SetFrozenRowsAction",(Bt=_t||(_t={}))[Bt.DEFAULT_SERIES=0]="DEFAULT_SERIES",Bt[Bt.ALTERNATE_SERIES=1]="ALTERNATE_SERIES",(wt=Ct||(Ct={})).CELL_EMPTY="CELL_EMPTY",wt.CELL_NOT_EMPTY="CELL_NOT_EMPTY",wt.DATE_AFTER="DATE_AFTER",wt.DATE_BEFORE="DATE_BEFORE",wt.DATE_EQUAL_TO="DATE_EQUAL_TO",wt.DATE_NOT_EQUAL_TO="DATE_NOT_EQUAL_TO",wt.DATE_AFTER_RELATIVE="DATE_AFTER_RELATIVE",wt.DATE_BEFORE_RELATIVE="DATE_BEFORE_RELATIVE",wt.DATE_EQUAL_TO_RELATIVE="DATE_EQUAL_TO_RELATIVE",wt.NUMBER_BETWEEN="NUMBER_BETWEEN",wt.NUMBER_EQUAL_TO="NUMBER_EQUAL_TO",wt.NUMBER_GREATER_THAN="NUMBER_GREATER_THAN",wt.NUMBER_GREATER_THAN_OR_EQUAL_TO="NUMBER_GREATER_THAN_OR_EQUAL_TO",wt.NUMBER_LESS_THAN="NUMBER_LESS_THAN",wt.NUMBER_LESS_THAN_OR_EQUAL_TO="NUMBER_LESS_THAN_OR_EQUAL_TO",wt.NUMBER_NOT_BETWEEN="NUMBER_NOT_BETWEEN",wt.NUMBER_NOT_EQUAL_TO="NUMBER_NOT_EQUAL_TO",wt.TEXT_CONTAINS="TEXT_CONTAINS",wt.TEXT_DOES_NOT_CONTAIN="TEXT_DOES_NOT_CONTAIN",wt.TEXT_EQUAL_TO="TEXT_EQUAL_TO",wt.TEXT_NOT_EQUAL_TO="TEXT_NOT_EQUAL_TO",wt.TEXT_STARTS_WITH="TEXT_STARTS_WITH",wt.TEXT_ENDS_WITH="TEXT_ENDS_WITH",wt.CUSTOM_FORMULA="CUSTOM_FORMULA",(yt=Tt||(Tt={}))[yt.NONE=0]="NONE",yt[yt.THIN=1]="THIN",yt[yt.HAIR=2]="HAIR",yt[yt.DOTTED=3]="DOTTED",yt[yt.DASHED=4]="DASHED",yt[yt.DASH_DOT=5]="DASH_DOT",yt[yt.DASH_DOT_DOT=6]="DASH_DOT_DOT",yt[yt.DOUBLE=7]="DOUBLE",yt[yt.MEDIUM=8]="MEDIUM",yt[yt.MEDIUM_DASHED=9]="MEDIUM_DASHED",yt[yt.MEDIUM_DASH_DOT=10]="MEDIUM_DASH_DOT",yt[yt.MEDIUM_DASH_DOT_DOT=11]="MEDIUM_DASH_DOT_DOT",yt[yt.SLANT_DASH_DOT=12]="SLANT_DASH_DOT",yt[yt.THICK=13]="THICK",(jt=St||(St={})).TOP="top",jt.BOTTOM="bottom",jt.LEFT="left",jt.RIGHT="right",jt.NONE="none",jt.ALL="all",jt.OUTSIDE="outside",jt.INSIDE="inside",jt.HORIZONTAL="horizontal",jt.VERTICAL="vertical",(Yt=Et||(Et={}))[Yt.UNSUPPORTED=0]="UNSUPPORTED",Yt[Yt.RGB=1]="RGB",Yt[Yt.HEX=2]="HEX",Yt[Yt.THEME=3]="THEME",(It=Rt||(Rt={}))[It.ON=0]="ON",It[It.OFF=1]="OFF",(xt=At||(At={}))[xt.CONDITION_TYPE_UNSPECIFIED=0]="CONDITION_TYPE_UNSPECIFIED",xt[xt.NUMNUMBER_BETWEENR_GREATER=1]="NUMNUMBER_BETWEENR_GREATER",xt[xt.NUMBER_GREATER_THAN_EQ=2]="NUMBER_GREATER_THAN_EQ",xt[xt.NUMBER_LESS=3]="NUMBER_LESS",xt[xt.NUMBER_LESS_THAN_EQ=4]="NUMBER_LESS_THAN_EQ",xt[xt.NUMBER_EQ=5]="NUMBER_EQ",xt[xt.NUMBER_NOT_EQ=6]="NUMBER_NOT_EQ",xt[xt.NUMBER_BETWEEN=7]="NUMBER_BETWEEN",xt[xt.NUMBER_NOT_BETWEEN=8]="NUMBER_NOT_BETWEEN",xt[xt.TEXT_CONTAINS=9]="TEXT_CONTAINS",xt[xt.TEXT_NOT_CONTAINS=10]="TEXT_NOT_CONTAINS",xt[xt.TEXT_STARTS_WITH=11]="TEXT_STARTS_WITH",xt[xt.TEXT_ENDS_WITH=12]="TEXT_ENDS_WITH",xt[xt.TEXT_EQ=13]="TEXT_EQ",xt[xt.TEXT_IS_EMAIL=14]="TEXT_IS_EMAIL",xt[xt.TEXT_IS_URL=15]="TEXT_IS_URL",xt[xt.DATE_EQ=16]="DATE_EQ",xt[xt.DATE_BEFORE=17]="DATE_BEFORE",xt[xt.DATE_AFTER=18]="DATE_AFTER",xt[xt.DATE_ON_OR_BEFORE=19]="DATE_ON_OR_BEFORE",xt[xt.DATE_ON_OR_AFTER=20]="DATE_ON_OR_AFTER",xt[xt.DATE_BETWEEN=21]="DATE_BETWEEN",xt[xt.DATE_NOT_BETWEEN=22]="DATE_NOT_BETWEEN",xt[xt.DATE_IS_VALID=23]="DATE_IS_VALID",xt[xt.ONE_OF_RANGE=24]="ONE_OF_RANGE",xt[xt.ONE_OF_LIST=25]="ONE_OF_LIST",xt[xt.BLANK=26]="BLANK",xt[xt.NOT_BLANK=27]="NOT_BLANK",xt[xt.CUSTOM_FORMULA=28]="CUSTOM_FORMULA",xt[xt.BOOLEAN=29]="BOOLEAN",xt[xt.TEXT_NOT_EQ=30]="TEXT_NOT_EQ",xt[xt.DATE_NOT_EQ=31]="DATE_NOT_EQ",(Nt=Ot||(Ot={}))[Nt.PASTE_NORMAL=0]="PASTE_NORMAL",Nt[Nt.PASTE_NO_BORDERS=1]="PASTE_NO_BORDERS",Nt[Nt.PASTE_FORMAT=2]="PASTE_FORMAT",Nt[Nt.PASTE_FORMULA=3]="PASTE_FORMULA",Nt[Nt.PASTE_DATA_VALIDATION=4]="PASTE_DATA_VALIDATION",Nt[Nt.PASTE_VALUES=5]="PASTE_VALUES",Nt[Nt.PASTE_CONDITIONAL_FORMATTING=6]="PASTE_CONDITIONAL_FORMATTING",Nt[Nt.PASTE_COLUMN_WIDTHS=7]="PASTE_COLUMN_WIDTHS",(Mt=kt||(kt={}))[Mt.DOCUMENT=0]="DOCUMENT",Mt[Mt.PROJECT=1]="PROJECT",(Lt=Dt||(Dt={}))[Lt.COLUMNS=0]="COLUMNS",Lt[Lt.ROWS=1]="ROWS",(Ht=Pt||(Pt={}))[Ht.LEFT=0]="LEFT",Ht[Ht.RIGHT=1]="RIGHT",Ht[Ht.TOP=2]="TOP",Ht[Ht.BOTTOM=3]="BOTTOM",(Ut=Ft||(Ft={}))[Ut.NUMBER_FORMAT_TYPE_UNSPECIFIED=0]="NUMBER_FORMAT_TYPE_UNSPECIFIED",Ut[Ut.TEXT=1]="TEXT",Ut[Ut.NUMBER=2]="NUMBER",Ut[Ut.PERCENT=3]="PERCENT",Ut[Ut.CURRENCY=4]="CURRENCY",Ut[Ut.DATE=5]="DATE",Ut[Ut.TIME=6]="TIME",Ut[Ut.DATE_TIME=7]="DATE_TIME",Ut[Ut.SCIENTIFIC=8]="SCIENTIFIC",(Wt=zt||(zt={}))[Wt.INTERPOLATION_POINT_TYPE_UNSPECIFIED=0]="INTERPOLATION_POINT_TYPE_UNSPECIFIED",Wt[Wt.MIN=1]="MIN",Wt[Wt.MAX=2]="MAX",Wt[Wt.NUMBER=3]="NUMBER",Wt[Wt.PERCENT=4]="PERCENT",Wt[Wt.PERCENTILE=5]="PERCENTILE",(Gt=Vt||(Vt={}))[Gt.BACKSPACE=8]="BACKSPACE",Gt[Gt.TAB=9]="TAB",Gt[Gt.ENTER=13]="ENTER",Gt[Gt.SHIFT=16]="SHIFT",Gt[Gt.CTRL=17]="CTRL",Gt[Gt.PAUSE=19]="PAUSE",Gt[Gt.CAPS_LOCK=20]="CAPS_LOCK",Gt[Gt.ESC=27]="ESC",Gt[Gt.SPACE=33]="SPACE",Gt[Gt.PAGE_UP=33]="PAGE_UP",Gt[Gt.PAGE_DOWN=34]="PAGE_DOWN",Gt[Gt.END=35]="END",Gt[Gt.HOME=36]="HOME",Gt[Gt.LEFT=37]="LEFT",Gt[Gt.UP=38]="UP",Gt[Gt.RIGHT=39]="RIGHT",Gt[Gt.DOWN=40]="DOWN",Gt[Gt.INSERT=45]="INSERT",Gt[Gt.DELETE=46]="DELETE",Gt[Gt.WIN=91]="WIN",Gt[Gt.WIN_R=92]="WIN_R",Gt[Gt.MENU=93]="MENU",Gt[Gt.F1=112]="F1",Gt[Gt.F2=113]="F2",Gt[Gt.F3=114]="F3",Gt[Gt.F4=115]="F4",Gt[Gt.F5=116]="F5",Gt[Gt.F6=117]="F6",Gt[Gt.F7=118]="F7",Gt[Gt.F8=119]="F8",Gt[Gt.F9=120]="F9",Gt[Gt.F10=121]="F10",Gt[Gt.F11=122]="F11",Gt[Gt.F12=123]="F12",Gt[Gt.NUM_LOCK=144]="NUM_LOCK",Gt[Gt.SCROLL_LOCK=145]="SCROLL_LOCK",(Qt=Xt||(Xt={})).backspace="Backspace",Qt.delete="Delete",(Zt=Kt||(Kt={})).EN="en",Zt.ZH="zh",(qt=$t||($t={}))[qt.RANGE=0]="RANGE",qt[qt.SHEET=1]="SHEET",(te=Jt||(Jt={}))[te.RELATIVE_DATE_UNSPECIFIED=0]="RELATIVE_DATE_UNSPECIFIED",te[te.PAST_YEAR=1]="PAST_YEAR",te[te.PAST_MONTH=2]="PAST_MONTH",te[te.PAST_WEEK=3]="PAST_WEEK",te[te.YESTERDAY=4]="YESTERDAY",te[te.TODAY=5]="TODAY",te[te.TOMORROW=6]="TOMORROW",(re=ee||(ee={}))[re.GRID=0]="GRID",re[re.KANBAN=1]="KANBAN",re[re.GANTT=2]="GANTT",(le=se||(se={}))[le.UNSPECIFIED=0]="UNSPECIFIED",le[le.LEFT_TO_RIGHT=1]="LEFT_TO_RIGHT",le[le.RIGHT_TO_LEFT=2]="RIGHT_TO_LEFT",(oe=ne||(ne={}))[oe.DASH=0]="DASH",oe[oe.DASH_DOT_DOT_HEAVY=1]="DASH_DOT_DOT_HEAVY",oe[oe.DASH_DOT_HEAVY=2]="DASH_DOT_HEAVY",oe[oe.DASHED_HEAVY=3]="DASHED_HEAVY",oe[oe.DASH_LONG=4]="DASH_LONG",oe[oe.DASH_LONG_HEAVY=5]="DASH_LONG_HEAVY",oe[oe.DOT_DASH=6]="DOT_DASH",oe[oe.DOT_DOT_DASH=7]="DOT_DOT_DASH",oe[oe.DOTTED=8]="DOTTED",oe[oe.DOTTED_HEAVY=9]="DOTTED_HEAVY",oe[oe.DOUBLE=10]="DOUBLE",oe[oe.NONE=11]="NONE",oe[oe.SINGLE=12]="SINGLE",oe[oe.THICK=13]="THICK",oe[oe.WAVE=14]="WAVE",oe[oe.WAVY_DOUBLE=15]="WAVY_DOUBLE",oe[oe.WAVY_HEAVY=16]="WAVY_HEAVY",oe[oe.WORDS=17]="WORDS",(ae=ie||(ie={}))[ae.UNSPECIFIED=0]="UNSPECIFIED",ae[ae.LEFT=1]="LEFT",ae[ae.CENTER=2]="CENTER",ae[ae.RIGHT=3]="RIGHT",ae[ae.JUSTIFIED=4]="JUSTIFIED",(ce=ge||(ge={}))[ce.UNSPECIFIED=0]="UNSPECIFIED",ce[ce.TOP=1]="TOP",ce[ce.MIDDLE=2]="MIDDLE",ce[ce.BOTTOM=3]="BOTTOM",(he=be||(be={}))[he.UNSPECIFIED=0]="UNSPECIFIED",he[he.OVERFLOW=1]="OVERFLOW",he[he.CLIP=2]="CLIP",he[he.WRAP=3]="WRAP",(ue=de||(de={}))[ue.NORMAL=0]="NORMAL",ue[ue.ITALIC=1]="ITALIC",(ve=fe||(fe={}))[ve.NORMAL=0]="NORMAL",ve[ve.BOLD=1]="BOLD",(pe=me||(me={}))[pe.NORMAL=0]="NORMAL",pe[pe.SUBSCRIPT=1]="SUBSCRIPT",pe[pe.SUPERSCRIPT=2]="SUPERSCRIPT",(Be=_e||(_e={}))[Be.FALSE=0]="FALSE",Be[Be.TRUE=1]="TRUE",(we=Ce||(Ce={}))[we.STRING=0]="STRING",we[we.NUMBER=1]="NUMBER",we[we.BOOLEAN=2]="BOOLEAN",we[we.FORCE_STRING=3]="FORCE_STRING",(ye=Te||(Te={}))[ye.DARK1=0]="DARK1",ye[ye.LIGHT1=1]="LIGHT1",ye[ye.DARK2=2]="DARK2",ye[ye.LIGHT2=3]="LIGHT2",ye[ye.ACCENT1=4]="ACCENT1",ye[ye.ACCENT2=5]="ACCENT2",ye[ye.ACCENT3=6]="ACCENT3",ye[ye.ACCENT4=7]="ACCENT4",ye[ye.ACCENT5=8]="ACCENT5",ye[ye.ACCENT6=9]="ACCENT6",ye[ye.HYPERLINK=10]="HYPERLINK",ye[ye.FOLLOWED_HYPERLINK=11]="FOLLOWED_HYPERLINK",(je=Se||(Se={})).OFFICE="Office",je.OFFICE_2007_2010="Office 2007-2010",je.GRAYSCALE="Grayscale",je.BLUE_WARM="Blue Warm",je.BLUE="Blue",je.BLUE_II="Blue II",je.BLUE_GREEN="Blue Green",je.GREEN="Green",je.GREEN_YELLOW="Green Yellow",je.YELLOW="Yellow",je.YELLOW_ORANGE="Yellow Orange",je.ORANGE="Orange",je.ORANGE_RED="Orange Red",je.RED_ORANGE="Red Orange",je.RED="Red",je.RED_VIOLET="Red Violet",je.VIOLET="Violet",je.VIOLET_II="Violet II",je.MEDIAN="Median",je.PAPER="Paper",je.MARQUEE="Marquee",je.SLIPSTREAM="Slipstream",je.Aspect="Aspect",(Ye=Ee||(Ee={}))[Ye.TYPE_UNSPECIFIED=0]="TYPE_UNSPECIFIED",Ye[Ye.TEXT_BOX=1]="TEXT_BOX",Ye[Ye.RECTANGLE=2]="RECTANGLE",Ye[Ye.ROUND_RECTANGLE=3]="ROUND_RECTANGLE",Ye[Ye.ELLIPSE=4]="ELLIPSE",Ye[Ye.ARC=5]="ARC",Ye[Ye.BENT_ARROW=6]="BENT_ARROW",Ye[Ye.BENT_UP_ARROW=7]="BENT_UP_ARROW",Ye[Ye.BEVEL=8]="BEVEL",Ye[Ye.BLOCK_ARC=9]="BLOCK_ARC",Ye[Ye.BRACE_PAIR=10]="BRACE_PAIR",Ye[Ye.BRACKET_PAIR=11]="BRACKET_PAIR",Ye[Ye.CAN=12]="CAN",Ye[Ye.CHEVRON=13]="CHEVRON",Ye[Ye.CHORD=14]="CHORD",Ye[Ye.CLOUD=15]="CLOUD",Ye[Ye.CORNER=16]="CORNER",Ye[Ye.CUBE=17]="CUBE",Ye[Ye.CURVED_DOWN_ARROW=18]="CURVED_DOWN_ARROW",Ye[Ye.CURVED_LEFT_ARROW=19]="CURVED_LEFT_ARROW",Ye[Ye.CURVED_RIGHT_ARROW=20]="CURVED_RIGHT_ARROW",Ye[Ye.CURVED_UP_ARROW=21]="CURVED_UP_ARROW",Ye[Ye.DECAGON=22]="DECAGON",Ye[Ye.DIAGONAL_STRIPE=23]="DIAGONAL_STRIPE",Ye[Ye.DIAMOND=24]="DIAMOND",Ye[Ye.DODECAGON=25]="DODECAGON",Ye[Ye.DONUT=26]="DONUT",Ye[Ye.DOUBLE_WAVE=27]="DOUBLE_WAVE",Ye[Ye.DOWN_ARROW=28]="DOWN_ARROW",Ye[Ye.DOWN_ARROW_CALLOUT=29]="DOWN_ARROW_CALLOUT",Ye[Ye.FOLDED_CORNER=30]="FOLDED_CORNER",Ye[Ye.FRAME=31]="FRAME",Ye[Ye.HALF_FRAME=32]="HALF_FRAME",Ye[Ye.HEART=33]="HEART",Ye[Ye.HEPTAGON=34]="HEPTAGON",Ye[Ye.HEXAGON=35]="HEXAGON",Ye[Ye.HOME_PLATE=36]="HOME_PLATE",Ye[Ye.HORIZONTAL_SCROLL=37]="HORIZONTAL_SCROLL",Ye[Ye.IRREGULAR_SEAL_1=38]="IRREGULAR_SEAL_1",Ye[Ye.IRREGULAR_SEAL_2=39]="IRREGULAR_SEAL_2",Ye[Ye.LEFT_ARROW=40]="LEFT_ARROW",Ye[Ye.LEFT_ARROW_CALLOUT=41]="LEFT_ARROW_CALLOUT",Ye[Ye.LEFT_BRACE=42]="LEFT_BRACE",Ye[Ye.LEFT_BRACKET=43]="LEFT_BRACKET",Ye[Ye.LEFT_RIGHT_ARROW=44]="LEFT_RIGHT_ARROW",Ye[Ye.LEFT_RIGHT_ARROW_CALLOUT=45]="LEFT_RIGHT_ARROW_CALLOUT",Ye[Ye.LEFT_RIGHT_UP_ARROW=46]="LEFT_RIGHT_UP_ARROW",Ye[Ye.LEFT_UP_ARROW=47]="LEFT_UP_ARROW",Ye[Ye.LIGHTNING_BOLT=48]="LIGHTNING_BOLT",Ye[Ye.MATH_DIVIDE=49]="MATH_DIVIDE",Ye[Ye.MATH_EQUAL=50]="MATH_EQUAL",Ye[Ye.MATH_MINUS=51]="MATH_MINUS",Ye[Ye.MATH_MULTIPLY=52]="MATH_MULTIPLY",Ye[Ye.MATH_NOT_EQUAL=53]="MATH_NOT_EQUAL",Ye[Ye.MATH_PLUS=54]="MATH_PLUS",Ye[Ye.MOON=55]="MOON",Ye[Ye.NO_SMOKING=56]="NO_SMOKING",Ye[Ye.NOTCHED_RIGHT_ARROW=57]="NOTCHED_RIGHT_ARROW",Ye[Ye.OCTAGON=58]="OCTAGON",Ye[Ye.PARALLELOGRAM=59]="PARALLELOGRAM",Ye[Ye.PENTAGON=60]="PENTAGON",Ye[Ye.PIE=61]="PIE",Ye[Ye.PLAQUE=62]="PLAQUE",Ye[Ye.PLUS=63]="PLUS",Ye[Ye.QUAD_ARROW=64]="QUAD_ARROW",Ye[Ye.QUAD_ARROW_CALLOUT=65]="QUAD_ARROW_CALLOUT",Ye[Ye.RIBBON=66]="RIBBON",Ye[Ye.RIBBON_2=67]="RIBBON_2",Ye[Ye.RIGHT_ARROW=68]="RIGHT_ARROW",Ye[Ye.RIGHT_ARROW_CALLOUT=69]="RIGHT_ARROW_CALLOUT",Ye[Ye.RIGHT_BRACE=70]="RIGHT_BRACE",Ye[Ye.RIGHT_BRACKET=71]="RIGHT_BRACKET",Ye[Ye.ROUND_1_RECTANGLE=72]="ROUND_1_RECTANGLE",Ye[Ye.ROUND_2_DIAGONAL_RECTANGLE=73]="ROUND_2_DIAGONAL_RECTANGLE",Ye[Ye.ROUND_2_SAME_RECTANGLE=74]="ROUND_2_SAME_RECTANGLE",Ye[Ye.RIGHT_TRIANGLE=75]="RIGHT_TRIANGLE",Ye[Ye.SMILEY_FACE=76]="SMILEY_FACE",Ye[Ye.SNIP_1_RECTANGLE=77]="SNIP_1_RECTANGLE",Ye[Ye.SNIP_2_DIAGONAL_RECTANGLE=78]="SNIP_2_DIAGONAL_RECTANGLE",Ye[Ye.SNIP_2_SAME_RECTANGLE=79]="SNIP_2_SAME_RECTANGLE",Ye[Ye.SNIP_ROUND_RECTANGLE=80]="SNIP_ROUND_RECTANGLE",Ye[Ye.STAR_10=81]="STAR_10",Ye[Ye.STAR_12=82]="STAR_12",Ye[Ye.STAR_16=83]="STAR_16",Ye[Ye.STAR_24=84]="STAR_24",Ye[Ye.STAR_32=85]="STAR_32",Ye[Ye.STAR_4=86]="STAR_4",Ye[Ye.STAR_5=87]="STAR_5",Ye[Ye.STAR_6=88]="STAR_6",Ye[Ye.STAR_7=89]="STAR_7",Ye[Ye.STAR_8=90]="STAR_8",Ye[Ye.STRIPED_RIGHT_ARROW=91]="STRIPED_RIGHT_ARROW",Ye[Ye.SUN=92]="SUN",Ye[Ye.TRAPEZOID=93]="TRAPEZOID",Ye[Ye.TRIANGLE=94]="TRIANGLE",Ye[Ye.UP_ARROW=95]="UP_ARROW",Ye[Ye.UP_ARROW_CALLOUT=96]="UP_ARROW_CALLOUT",Ye[Ye.UP_DOWN_ARROW=97]="UP_DOWN_ARROW",Ye[Ye.UTURN_ARROW=98]="UTURN_ARROW",Ye[Ye.VERTICAL_SCROLL=99]="VERTICAL_SCROLL",Ye[Ye.WAVE=100]="WAVE",Ye[Ye.WEDGE_ELLIPSE_CALLOUT=101]="WEDGE_ELLIPSE_CALLOUT",Ye[Ye.WEDGE_RECTANGLE_CALLOUT=102]="WEDGE_RECTANGLE_CALLOUT",Ye[Ye.WEDGE_ROUND_RECTANGLE_CALLOUT=103]="WEDGE_ROUND_RECTANGLE_CALLOUT",Ye[Ye.FLOW_CHART_ALTERNATE_PROCESS=104]="FLOW_CHART_ALTERNATE_PROCESS",Ye[Ye.FLOW_CHART_COLLATE=105]="FLOW_CHART_COLLATE",Ye[Ye.FLOW_CHART_CONNECTOR=106]="FLOW_CHART_CONNECTOR",Ye[Ye.FLOW_CHART_DECISION=107]="FLOW_CHART_DECISION",Ye[Ye.FLOW_CHART_DELAY=108]="FLOW_CHART_DELAY",Ye[Ye.FLOW_CHART_DISPLAY=109]="FLOW_CHART_DISPLAY",Ye[Ye.FLOW_CHART_DOCUMENT=110]="FLOW_CHART_DOCUMENT",Ye[Ye.FLOW_CHART_EXTRACT=111]="FLOW_CHART_EXTRACT",Ye[Ye.FLOW_CHART_INPUT_OUTPUT=112]="FLOW_CHART_INPUT_OUTPUT",Ye[Ye.FLOW_CHART_INTERNAL_STORAGE=113]="FLOW_CHART_INTERNAL_STORAGE",Ye[Ye.FLOW_CHART_MAGNETIC_DISK=114]="FLOW_CHART_MAGNETIC_DISK",Ye[Ye.FLOW_CHART_MAGNETIC_DRUM=115]="FLOW_CHART_MAGNETIC_DRUM",Ye[Ye.FLOW_CHART_MAGNETIC_TAPE=116]="FLOW_CHART_MAGNETIC_TAPE",Ye[Ye.FLOW_CHART_MANUAL_INPUT=117]="FLOW_CHART_MANUAL_INPUT",Ye[Ye.FLOW_CHART_MANUAL_OPERATION=118]="FLOW_CHART_MANUAL_OPERATION",Ye[Ye.FLOW_CHART_MERGE=119]="FLOW_CHART_MERGE",Ye[Ye.FLOW_CHART_MULTIDOCUMENT=120]="FLOW_CHART_MULTIDOCUMENT",Ye[Ye.FLOW_CHART_OFFLINE_STORAGE=121]="FLOW_CHART_OFFLINE_STORAGE",Ye[Ye.FLOW_CHART_OFFPAGE_CONNECTOR=122]="FLOW_CHART_OFFPAGE_CONNECTOR",Ye[Ye.FLOW_CHART_ONLINE_STORAGE=123]="FLOW_CHART_ONLINE_STORAGE",Ye[Ye.FLOW_CHART_OR=124]="FLOW_CHART_OR",Ye[Ye.FLOW_CHART_PREDEFINED_PROCESS=125]="FLOW_CHART_PREDEFINED_PROCESS",Ye[Ye.FLOW_CHART_PREPARATION=126]="FLOW_CHART_PREPARATION",Ye[Ye.FLOW_CHART_PROCESS=127]="FLOW_CHART_PROCESS",Ye[Ye.FLOW_CHART_PUNCHED_CARD=128]="FLOW_CHART_PUNCHED_CARD",Ye[Ye.FLOW_CHART_PUNCHED_TAPE=129]="FLOW_CHART_PUNCHED_TAPE",Ye[Ye.FLOW_CHART_SORT=130]="FLOW_CHART_SORT",Ye[Ye.FLOW_CHART_SUMMING_JUNCTION=131]="FLOW_CHART_SUMMING_JUNCTION",Ye[Ye.FLOW_CHART_TERMINATOR=132]="FLOW_CHART_TERMINATOR",Ye[Ye.ARROW_EAST=133]="ARROW_EAST",Ye[Ye.ARROW_NORTH_EAST=134]="ARROW_NORTH_EAST",Ye[Ye.ARROW_NORTH=135]="ARROW_NORTH",Ye[Ye.SPEECH=136]="SPEECH",Ye[Ye.STARBURST=137]="STARBURST",Ye[Ye.TEARDROP=138]="TEARDROP",Ye[Ye.ELLIPSE_RIBBON=139]="ELLIPSE_RIBBON",Ye[Ye.ELLIPSE_RIBBON_2=140]="ELLIPSE_RIBBON_2",Ye[Ye.CLOUD_CALLOUT=141]="CLOUD_CALLOUT",Ye[Ye.CUSTOM=142]="CUSTOM";const Re={sheetId:"",rangeData:{startRow:-1,endRow:-1,startColumn:-1,endColumn:-1}},Ie={startRow:-1,startColumn:-1,endRow:-1,endColumn:-1},Ae={startRow:0,startColumn:0,endRow:0,endColumn:0},xe={row:0,column:0},Oe={extensions:[],id:"",sheetOrder:[],socketEnable:_e.FALSE,socketUrl:"",name:"",timeZone:"",appVersion:"",theme:"",skin:"",locale:Kt.EN,creator:"",styles:{},sheets:{},lastModifiedBy:"",createdTime:"",modifiedTime:"",pluginMeta:{},namedRanges:[]},Ne={type:ee.GRID,name:"Sheet1",id:"sheet-01",tabColor:"",hidden:_e.FALSE,freezeColumn:-1,rowCount:1e3,columnCount:100,freezeRow:-1,zoomRatio:1,scrollTop:0,scrollLeft:0,defaultColumnWidth:73,defaultRowHeight:19,mergeData:[],hideRow:[],hideColumn:[],cellData:{},rowData:{},columnData:{},status:_e.FALSE,showGridlines:_e.TRUE,rowTitle:{width:46,hidden:_e.FALSE},columnTitle:{height:20,hidden:_e.FALSE},selections:["A1"],rightToLeft:_e.FALSE,pluginMeta:{}},ke={ff:"Times New Roman",fs:14,it:_e.FALSE,bl:_e.FALSE,ul:{s:_e.FALSE},st:{s:_e.FALSE},ol:{s:_e.FALSE},tr:{a:0,v:_e.FALSE},td:se.UNSPECIFIED,cl:{rgb:"#000"},bg:{rgb:"#fff"},ht:ie.UNSPECIFIED,vt:ge.UNSPECIFIED,tb:be.UNSPECIFIED,pd:{t:0,r:0,b:0,l:0}},Me={id:"default_doc",documentStyle:{}},De={id:"default_slide",title:"defaultSlide",pageSize:{width:300,height:300}};var Le,Pe;(Pe=Le||(Le={})).ARRAY_CONVERTOR="ARRAY_CONVERTOR",Pe.MATRIX_CONVERTOR="MATRIX_CONVERTOR";const He={modifier:["Alt","AltGraph","CapsLock","Control","Fn","FnLock","Meta","NumLock","ScrollLock","Shift","Symbol","SymbolLock"],legacyModifier:["Hyper","Super"],whiteSpace:["Enter","Tab"],navigation:["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","End","Home","PageDown","PageUp"],editing:["Backspace","Clear","Copy","CrSel","Cut","Delete","EraseEof","ExSel","Insert","Paste","Redo","Undo"],ui:["Accept","Again","Attn","Cancel","ContextMenu","Escape","Execute","Find","Help","Pause","Play","Props","Select","ZoomIn","ZoomOut"],device:["BrightnessDown","BrightnessUp","Eject","LogOff","Power","PowerOff","PrintScreen","Hibernate","Standby","WakeUp"],imeCompositionKeys:["AllCandidates","Alphanumeric","CodeInput","Compose","Convert","Dead","FinalMode","GroupFirst","GroupLast","GroupNext","GroupPrevious","ModeChange","NextCandidate","NonConvert","PreviousCandidate","Process","SingleCandidate"],koreanSpecific:["HangulMode","HanjaMode","JunjaMode"],japaneseSpecific:["Eisu","Hankaku","Hiragana","HiraganaKatakana","KanaMode","KanjiMode","Katakana","Romaji","Zenkaku","ZenkakuHankaku"],commonFunction:["F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12","Soft1","Soft2","Soft3","Soft4"],multimedia:["ChannelDown","ChannelUp","Close","MailForward","MailReply","MailSend","MediaClose","MediaFastForward","MediaPause","MediaPlay","MediaPlayPause","MediaRecord","MediaRewind","MediaStop","MediaTrackNext","MediaTrackPrevious","New","Open","Print","Save","SpellCheck"],multimediaNumpad:["Key11","Key12"],audio:["AudioBalanceLeft","AudioBalanceRight","AudioBassBoostDown","AudioBassBoostToggle","AudioBassBoostUp","AudioFaderFront","AudioFaderRear","AudioSurroundModeNext","AudioTrebleDown","AudioTrebleUp","AudioVolumeDown","AudioVolumeUp","AudioVolumeMute","MicrophoneToggle","MicrophoneVolumeDown","MicrophoneVolumeUp","MicrophoneVolumeMute"],speech:["SpeechCorrectionList","SpeechInputToggle"],application:["LaunchApplication1","LaunchApplication2","LaunchCalendar","LaunchContacts","LaunchMail","LaunchMediaPlayer","LaunchMusicPlayer","LaunchPhone","LaunchScreenSaver","LaunchSpreadsheet","LaunchWebBrowser","LaunchWebCam","LaunchWordProcessor"],browser:["BrowserBack","BrowserFavorites","BrowserForward","BrowserHome","BrowserRefresh","BrowserSearch","BrowserStop"],mobilePhone:["AppSwitch","Call","Camera","CameraFocus","EndCall","GoBack","GoHome","HeadsetHook","LastNumberRedial","Notification","MannerMode","VoiceDial"],tv:["TV","TV3DMode","TVAntennaCable","TVAudioDescription","TVAudioDescriptionMixDown","TVAudioDescriptionMixUp","TVContentsMenu","TVDataService","TVInput","TVInputComponent1","TVInputComponent2","TVInputComposite1","TVInputComposite2","TVInputHDMI1","TVInputHDMI2","TVInputHDMI3","TVInputHDMI4","TVInputVGA1","TVMediaContext","TVNetwork","TVNumberEntry","TVPower","TVRadioService","TVSatellite","TVSatelliteBS","TVSatelliteCS","TVSatelliteToggle","TVTerrestrialAnalog","TVTerrestrialDigital","TVTimer"],mediaControls:["AVRInput","AVRPower","ColorF0Red","ColorF1Green","ColorF2Yellow","ColorF3Blue","ColorF4Grey","ColorF5Brown","ClosedCaptionToggle","Dimmer","DisplaySwap","DVR","Exit","FavoriteClear0","FavoriteClear1","FavoriteClear2","FavoriteClear3","FavoriteRecall0","FavoriteRecall1","FavoriteRecall2","FavoriteRecall3","FavoriteStore0","FavoriteStore1","FavoriteStore2","FavoriteStore3","Guide","GuideNextDay","GuidePreviousDay","Info","InstantReplay","Link","ListProgram","LiveContent","Lock","MediaApps","MediaAudioTrack","MediaLast","MediaSkipBackward","MediaSkipForward","MediaStepBackward","MediaStepForward","MediaTopMenu","NavigateIn","NavigateNext","NavigateOut","NavigatePrevious","NextFavoriteChannel","NextUserProfile","OnDemand","Pairing","PinPDown","PinPMove","PinPToggle","PinPUp","PlaySpeedDown","PlaySpeedReset","PlaySpeedUp","RandomToggle","RcLowBattery","RecordSpeedNext","RfBypass","ScanChannelsToggle","ScreenModeNext","Settings","SplitScreenToggle","STBInput","STBPower","Subtitle","Teletext","VideoModeNext","Wink","ZoomToggle"]};var Fe,Ue;(Ue=Fe||(Fe={})).BASE_COMPONENT="baseComponent",Ue.BASE_RENDER="renderEngine",Ue.BASE_UI="baseUI",Ue.SPREADSHEET="spreadsheet",Ue.DOCUMENT="document",Ue.SLIDE="slide";const ze={[Se.OFFICE]:{[Te.ACCENT1]:"#4472C4",[Te.ACCENT2]:"#ED7D31",[Te.ACCENT3]:"#A5A5A5",[Te.ACCENT4]:"#70AD47",[Te.ACCENT5]:"#5B9BD5",[Te.ACCENT6]:"#70AD47",[Te.DARK1]:"#000000",[Te.DARK2]:"#44546A",[Te.LIGHT1]:"#FFFFFF",[Te.LIGHT2]:"#E7E6E6",[Te.HYPERLINK]:"#0563C1",[Te.FOLLOWED_HYPERLINK]:"#954F72"}},We={namedRangeId:"named-range-01",name:"namedRange01",range:{sheetId:"sheet-01",rangeData:Ae}};var Ve,Ge,Xe,Qe,Ke,Ze;(Ge=Ve||(Ve={}))[Ge.SLIDE=0]="SLIDE",Ge[Ge.MASTER=1]="MASTER",Ge[Ge.LAYOUT=2]="LAYOUT",Ge[Ge.HANDOUT_MASTER=3]="HANDOUT_MASTER",Ge[Ge.NOTES_MASTER=4]="NOTES_MASTER",(Qe=Xe||(Xe={}))[Qe.SHAPE=0]="SHAPE",Qe[Qe.IMAGE=1]="IMAGE",Qe[Qe.TEXT=2]="TEXT",Qe[Qe.SPREADSHEET=3]="SPREADSHEET",Qe[Qe.DOCUMENT=4]="DOCUMENT",Qe[Qe.SLIDE=5]="SLIDE",(Ze=Ke||(Ke={}))[Ze.RELATIVE_SLIDE_LINK_UNSPECIFIED=0]="RELATIVE_SLIDE_LINK_UNSPECIFIED",Ze[Ze.NEXT_SLIDE=1]="NEXT_SLIDE",Ze[Ze.PREVIOUS_SLIDE=2]="PREVIOUS_SLIDE",Ze[Ze.FIRST_SLIDE=3]="FIRST_SLIDE",Ze[Ze.LAST_SLIDE=4]="LAST_SLIDE";class $e{constructor(){this._colorType=Et.UNSUPPORTED,this._themeColors=Se.OFFICE,this._themeTint=0}asRgbColor(){return new er(this._rgbValue,this)}asThemeColor(){return new sr(this._themeValue,this._themeTint,this._themeColors,this)}build(){switch(this._colorType){case Et.THEME:return this.asThemeColor();case Et.RGB:return this.asRgbColor();case Et.UNSUPPORTED:throw Error("unsupported color type")}}setRgbColor(t){return this._colorType=Et.RGB,this._rgbValue=t,this}setThemeColors(t){this._colorType=Et.THEME,this._themeColors=t}setThemeTint(t){this._colorType=Et.THEME,this._themeTint=t}setThemeColor(t){return this._colorType=Et.THEME,this._themeValue=t,this}getColorType(){return this._colorType}}class qe{constructor(t){this._builder=t}static rgbColorToHexValue(t){return`#${((1<<24)+(t.getRed()<<16)+(t.getGreen()<<8)+t.getBlue()).toString(16).slice(1)}`}static hexValueToRgbColor(t){t?t.indexOf("#")>-1&&(t=t.substring(1)):t="#000000";let e=+`0x${t[0]}${t[1]}`,r=+`0x${t[2]}${t[3]}`,s=+`0x${t[4]}${t[5]}`;return(new $e).setRgbColor(`rgb(${e},${r},${s})`).asRgbColor()}static hexToRgbString(t){t=t.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,((t,e,r,s)=>e+e+r+r+s+s));const e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);let r=null;if(e){r=`rgba(${parseInt(e[1],16)},${parseInt(e[2],16)},${parseInt(e[3],16)})`}return r}asRgbColor(){return this._builder.asRgbColor()}asThemeColor(){return this._builder.asThemeColor()}getColorType(){return this._builder.getColorType()}clone(){return new qe(this._builder)}equals(t){return!1}}class Je{constructor(t){const e=t.getRed()/255,r=t.getGreen()/255,s=t.getBlue()/255,l=t.getAlpha()/255,n=Math.min(e,Math.min(r,s)),o=Math.max(e,Math.max(r,s)),i=o-n;if(o===n)return this._hue=0,this._saturation=0,void(this._lightness=o);this._lightness=(n+o)/2,this._lightness<.5?this._saturation=i/(o+n):this._saturation=i/(2-o-n),e===o&&(this._hue=(r-s)/i),r===o&&(this._hue=2+(s-e)/i),s===o&&(this._hue=4+(e-r)/i),this._hue*=60,this._hue<0&&(this._hue+=360),this._alpha=l}asRgbColor(){const t=new $e;if(0===this._saturation)return t.setRgbColor(`rgba(${255*this._lightness},${255*this._lightness},${255*this._lightness},${255*this._alpha})`),t.asRgbColor();let e;e=this._lightness<.5?this._lightness*(1+this._saturation):this._lightness+this._saturation-this._lightness*this._saturation;const r=2*this._lightness-e,s=this._hue/360,l=s+1/3,n=this.setColor(e,r,l),o=this.setColor(e,r,s),i=s-1/3,a=this.setColor(e,r,i);return t.setRgbColor(`rgba(${Math.round(255*n)},${Math.round(255*o)},${Math.round(255*a)},${255*this._alpha})`),t.asRgbColor()}getLightness(){return this._lightness}getHue(){return this._hue}getSaturation(){return this._saturation}getAlpha(){return this._alpha}setColor(t,e,r){let s;return r<0&&(r+=1),r>1&&(r-=1),s=6*r<1?e+6*(t-e)*r:2*r<1?t:3*r<2?e+(t-e)*(2/3-r)*6:e,s}setLightness(t){this._lightness=t}}const tr=class extends qe{constructor(t,e){super(e);let r=t.match(tr.RGBA_EXTRACT);if(r){const e=+r[1],s=+r[2],l=+r[3],n=+r[4];return this._cssString=t,this._red=e,this._green=s,this._blue=l,void(this._alpha=n)}if(r=t.match(tr.RGB_EXTRACT),r){const e=+r[1],s=+r[2],l=+r[3];return this._cssString=t,this._red=e,this._green=s,this._blue=l,void(this._alpha=1)}throw new Error("Invalid rgba or rgb color")}asHexString(){return qe.rgbColorToHexValue(this)}getRed(){let t=this._red+tr.RGB_COLOR_AMT;return t>255?t=255:t<0&&(t=0),t}getGreen(){let t=this._green+tr.RGB_COLOR_AMT;return t>255?t=255:t<0&&(t=0),t}getBlue(){let t=this._blue+tr.RGB_COLOR_AMT;return t>255?t=255:t<0&&(t=0),t}getAlpha(){return this._alpha}getColorType(){return Et.RGB}clone(){return new tr(this._cssString,this._builder)}asThemeColor(){throw new Error("rgb color not support to themeColor")}equals(t){return t instanceof tr&&(t._red===this._red&&t._blue===this._blue&&t._green===this._green&&t._alpha===this._alpha)}getCssString(){return this._cssString}};let er=tr;er.RGB_COLOR_AMT=0,er.RGBA_EXTRACT=new RegExp("\\s*rgba\\s*\\((\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d.\\d|\\d\\s*)\\)\\s*"),er.RGB_EXTRACT=new RegExp("\\s*rgb\\s*\\((\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d+\\s*)\\)\\s*");const rr=class extends qe{constructor(t,e,r,s){super(s),this._themeColorType=t,this._themeTint=e,this._themeColors=r}lumValue(t,e){if(null==t)return e;let r;return r=t<0?e*(1+t):e*(1-t)+(255-255*(1-t)),r}asRgbColor(){const t=ze[this._themeColors];if(null==t)throw new Error("not find themeColors type");const e=t.get(this._themeColorType);if(null==e)throw new Error("not find themeColors value");let r;if(rr._cacheThemeColor.has(this._themeColors)){if(r=rr._cacheThemeColor.get(this._themeColors),r.has(this._themeColorType))return r.get(this._themeColorType)}else r=new Map,rr._cacheThemeColor.set(this._themeColors,r);const s=new Je(qe.hexValueToRgbColor(e));s.setLightness(this.lumValue(this._themeTint,255*s.getLightness())/255);const l=s.asRgbColor();return r.set(this._themeColorType,l),l}clone(){return new rr(this._themeColorType,this._themeTint,this._themeColors,this._builder)}equals(t){return t instanceof rr&&t._themeColorType===this._themeColorType}getColorType(){return Et.THEME}getThemeColorType(){return this._themeColorType}};let sr=rr;sr._cacheThemeColor=new Map;class lr{constructor(t,e){this._workSheet=t,this._columnData=new u(e)}getColumnData(){return this._columnData}getColumnDatas(t,e){const r=new u;for(let s=t;s{if(!e||0===e.length)return;const r=e[0];try{r.getWorkBook()}catch(a){return}if(t.getContext().getWorkBook().getUnitId()!==r.getWorkBook().getUnitId())return;let s=e.find((t=>t instanceof tn)),l=e.find((t=>t instanceof ql)),n=e.find((t=>t instanceof on)),o=e.find((t=>t instanceof sn)),i=e.find((t=>t instanceof $l));if(s){const t=s.getDoActionData();if(t.sheetId===this._worksheet.getSheetId()){const e=B.deepClone(this._rectangleList);for(let r=0;rs.endRow||(t.rowIndex>=s.startRow&&t.rowIndex<=s.endRow||(s.startRow+=l),s.endRow+=l)}this.modifyMerge(this._rectangleList,e)}}if(l){const t=l.getDoActionData();if(t.sheetId===this._worksheet.getSheetId()){const e=B.deepClone(this._rectangleList);for(let r=0;rs.endColumn||(t.columnIndex>=s.startColumn&&t.columnIndex<=s.endColumn||(s.startColumn+=l),s.endColumn+=l)}this.modifyMerge(this._rectangleList,e)}}if(n){const t=n.getDoActionData();if(t.sheetId===this._worksheet.getSheetId()){const e=B.deepClone(this._rectangleList);for(let r=0;rs.endRow||(t.rowIndex>=s.startRow&&t.rowIndex<=s.endRow||(s.startRow-=l),s.endRow-=l)}this.modifyMerge(this._rectangleList,e)}}if(o){const t=o.getDoActionData();if(t.sheetId===this._worksheet.getSheetId()){const e=B.deepClone(this._rectangleList);for(let r=0;rs.endColumn||(t.columnIndex>=s.startColumn&&t.columnIndex<=s.endColumn||(s.startColumn-=l),s.endColumn-=l)}this.modifyMerge(this._rectangleList,e)}}if(i){const t=i.getDoActionData();if(t.sheetId===this._worksheet.getSheetId()){const e=B.deepClone(this._rectangleList),r=this.getByRowColumn(t.rangeData.startRow,t.rangeData.endRow,t.rangeData.startColumn,t.rangeData.endColumn);if(r&&r.forEach((t=>{const r=new vs(t);for(let s=0;s=t.rangeData.startRow){if(r.endColumnt.rangeData.endColumn)continue;if(!(r.startColumn>=t.rangeData.startColumn&&r.endColumn<=t.rangeData.endColumn))return;{const e=t.rangeData.endRow-t.rangeData.startRow;r.startRow-=e,r.endRow-=e}}}else for(let s=0;st.rangeData.endColumn){if(r.endRowt.rangeData.endRow)continue;if(!(r.startRow>=t.rangeData.startRow&&r.endRow<=t.rangeData.endRow))return;{const e=t.rangeData.endColumn-t.rangeData.startColumn;r.startColumn-=e,r.endColumn-=e}}}this.modifyMerge(this._rectangleList,e)}}}))}getMergeData(){return this._rectangleList}getByRowColumn(...t){const{_rectangleList:e}=this;let r;Is.checkup(t,Is.NUMBER_TYPE,Is.NUMBER_TYPE,Is.NUMBER_TYPE,Is.NUMBER_TYPE)?r=new vs(t[0],t[2],t[1],t[3]):Is.checkup(t,Is.NUMBER_TYPE,Is.NUMBER_TYPE)&&(r=new vs(t[0],t[1],t[0],t[1]));const s=[];for(let l=0;l=e?t:""+Array(e+1-s.length).join(r)+t},p={s:m,z:function(t){var e=-t.utcOffset(),r=Math.abs(e),s=Math.floor(r/60),l=r%60;return(e<=0?"+":"-")+m(s,2,"0")+":"+m(l,2,"0")},m:function t(e,r){if(e.date()1)return t(o[0])}else{var i=e.name;B[i]=e,l=i}return!s&&l&&(_=l),l||!s&&_},T=function(t,e){if(C(t))return t.clone();var r="object"==typeof e?e:{};return r.date=t,r.args=arguments,new S(r)},y=p;y.l=w,y.i=C,y.w=function(t,e){return T(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var S=function(){function v(t){this.$L=w(t.locale,null,!0),this.parse(t)}var m=v.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,r=t.utc;if(null===e)return new Date(NaN);if(y.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var s=e.match(u);if(s){var l=s[2]-1||0,n=(s[7]||"0").substring(0,3);return r?new Date(Date.UTC(s[1],l,s[3]||1,s[4]||0,s[5]||0,s[6]||0,n)):new Date(s[1],l,s[3]||1,s[4]||0,s[5]||0,s[6]||0,n)}}return new Date(e)}(t),this.$x=t.x||{},this.init()},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},m.$utils=function(){return y},m.isValid=function(){return!(this.$d.toString()===d)},m.isSame=function(t,e){var r=T(t);return this.startOf(e)<=r&&r<=this.endOf(e)},m.isAfter=function(t,e){return T(t)e in t?__defProp(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,__spreadValues=(t,e)=>{for(var r in e||(e={}))__hasOwnProp.call(e,r)&&__defNormalProp(t,r,e[r]);if(__getOwnPropSymbols)for(var r of __getOwnPropSymbols(e))__propIsEnum.call(e,r)&&__defNormalProp(t,r,e[r]);return t},__spreadProps=(t,e)=>__defProps(t,__getOwnPropDescs(e)),UniverPreactTs=function(t){"use strict";var e,r;(r=e||(e={}))[r.OBSERVER_ACTION=1]="OBSERVER_ACTION",r[r.SERVER_ACTION=2]="SERVER_ACTION",r[r.UNDO_ACTION=4]="UNDO_ACTION",r[r.EXTENSION_ACTION=8]="EXTENSION_ACTION",r[r.DEFAULT_ACTION=15]="DEFAULT_ACTION";class s{constructor(t,e){this._doActionData=t,this._observers=e,this._operation=1}getDoActionData(){return this._doActionData}getOldActionData(){return this._oldActionData}hasOperation(t){return(this._operation&t)===t}addOperation(t){this._operation|=t}removeOperation(t){this._operation&=~t}}class l{constructor(t=!1){this.isStopPropagation=!1,this.initialize(t)}initialize(t=!1){return this.skipNextObservers=t,this}stopPropagation(){this.isStopPropagation=!0}}class n{constructor(t){this.callback=t,this._willBeUnregistered=!1,this.unregisterOnNextCall=!1}}class o{constructor(t){this._observers=new Array,this._eventState=new l,t&&(this._onObserverAdded=t)}get observers(){return this._observers}add(t,e=!1,r=!1){if(!t)return null;const s=new n(t);return s.unregisterOnNextCall=r,e?this._observers.unshift(s):this._observers.push(s),this._onObserverAdded&&this._onObserverAdded(s),s}addOnce(t){return this.add(t,void 0,!0)}remove(t){if(!t)return!1;return-1!==this._observers.indexOf(t)&&(this._deferUnregister(t),!0)}removeCallback(t){for(let e=0;el.callback(t,r))),l.unregisterOnNextCall&&this._deferUnregister(l)))}return e.then((()=>t))}notifyObserver(t,e){if(t._willBeUnregistered)return;const r=this._eventState;return r.skipNextObservers=!1,t.callback(e,r),t.unregisterOnNextCall&&this._deferUnregister(t),{lastReturnValue:r.lastReturnValue,stopPropagation:r.isStopPropagation}}hasObservers(){return this._observers.length>0}clear(){this._observers=new Array,this._onObserverAdded=null}clone(){const t=new o;return t._observers=this._observers.slice(0),t}_deferUnregister(t){t.unregisterOnNextCall=!1,t._willBeUnregistered=!0,setTimeout((()=>{this._remove(t)}),0)}_remove(t){if(!t)return!1;const e=this._observers.indexOf(t);return-1!==e&&(this._observers.splice(e,1),!0)}}class i{constructor(t,e){this.name=t,this.observableHooks=e}}class a{constructor(){this._observableHooksArray=new Array}addHooks(t,e){this._observableHooksArray.push(new i(t,e))}getHooks(t){const e=this._observableHooksArray.find((e=>e.name===t));return e?e.observableHooks:null}}function g(t,e){let r=0,s=t.length-1;for(;r<=s;){let l=Math.floor((s+r)/2);if(e=t[l-1]))return l;if(e>=t[l])r=l+1;else{if(!(e=0&&o>=r;){if(s=t[o],l=0===o?0:t[o-1],e>=l&&e=l&&e=t[r-20]?c(t,e):g(t,e),r}const h=t=>null!=t,d=t=>{let e=Object.keys(t),r=/^\d+$/,s=0;for(let l=0;ls&&(s=n)}return s};class u{constructor(...t){switch(t.length){case 0:return this._array={},void(this._length=0);case 1:{if("number"==typeof t[0])return this._array={},void(this._length=t[0]);const e=d(t[0]);if(e>-1)return this._array=t[0],void(this._length=e);throw new Error(`create object array error ${JSON.stringify(t[0])}`)}case 2:if(d(t[0])>-1)return this._array=t[0],void(this._length=t[1]);throw new Error(`create object array error ${JSON.stringify(t[0])}`)}}static objectKeys(t){if(t){const e=Object.keys(t),r=e.indexOf("length");return r>-1&&e.splice(r,1),e}return[]}static getMaxLength(t){if(t){if(t.length)return t.length;const e=u.objectKeys(t);if(e.length)return Math.max(...e)+1}return 0}obtain(t,e){var r;return null!=(r=this._array[t])?r:e}getKeys(){return u.objectKeys(this._array)}get(t){return this._array[t]}set(t,e){if(h(e)){const r=this._length;this._array[t]=e,t>=r&&(this._length=t+1)}}pop(){const t=this._length,e=this._array;if(t>0){const r=t-1,s=e[r];return r>0&&(delete e[r],this._length--),s}return null}push(t){if(h(t)){let e=this._length;this._array[e++]=t,this._length=e}}first(){return this._array[0]}last(){const t=this._length-1;return this._array[t]}shift(){const t=this._length;if(t>0){const e=this._array[0],r=t-1;let s;for(let t=0;t{e.set(r,t(s))})):this.forEach(((t,r)=>{e.set(t,r)})),e}isEmpty(){const t=this._array;return 0===Object.keys(t).length}delete(t){this.splice(t,1)}includes(t){const e=this._array,r=Object.keys(e),s=r.length;for(let l=0;l0){const s={};let l=0;for(let n=t;n0){const s=t+e,l=this._array;let n=0;const o={};for(let e=t;e=t;l--)s[l+1]=s[l];return s[t]=e,this._length=r+1,this}inserts(t,e){const r=e._array,s=e._length,l=this._array;for(let n=this._length-1;n>=t;n--){const t=l[n];h(t)&&(delete l[n],l[n+s]=t)}for(let n=0;n{for(let o=t;o{const s=e.getRow(t);if(s)return r=s.getLength(),!1})),this.forEach(((s,l)=>{var n,o;for(let i=t;ie&&(e=r-1)}}return{startRow:0,startColumn:0,endRow:t,endColumn:e}}toArray(){return this._option.toArray().map((t=>new u(t).toArray()))}toJSON(){return this._matrix}getData(){const t=JSON.stringify(this);return JSON.parse(t)}getArrayData(){let t=0,e=0,r=!1,s=!1;const l=new v;return this.forEach(((n,o)=>{r||(r=!0,t=n),o.forEach(((r,o)=>{s?r{s||(s=!0,t=n);const i=o.getLength()-1;i>r&&(r=i),o.forEach(((t,r)=>{l?t=_.length;)r/=_.length,r-=1,e+=_[r%_.length];return e+=_[t%_.length],e}static getEnvironment(){const{appVersion:t}=navigator,e=this.getSystemType();return{app_version:t,os:e,os_version:e,device_id:"",platform:"web"}}static indexAt(t){let e=0;for(let r=0;r-1)return"Linux";if(e){if(t.indexOf("Windows NT 5.0")>-1||t.indexOf("Windows 2000")>-1)return"Windows 2000";if(t.indexOf("Windows NT 5.1")>-1||t.indexOf("Windows XP")>-1)return"Windows XP";if(t.indexOf("Windows NT 5.2")>-1||t.indexOf("Windows 2003")>-1)return"Windows 2003";if(t.indexOf("Windows NT 6.0")>-1||t.indexOf("Windows Vista")>-1)return"Windows Vista";if(t.indexOf("Windows NT 6.1")>-1||t.indexOf("Windows 7")>-1)return"Windows 7";if(t.indexOf("Windows NT 10")>-1||t.indexOf("Windows 10")>-1)return"Windows 10";if(t.indexOf("Windows NT 11")>-1||t.indexOf("Windows 11")>-1)return"Windows 11"}return"Unknown system"}static getBrowserType(){const t=navigator.userAgent,e=t.indexOf("Opera")>-1,r=t.indexOf("compatible")>-1&&t.indexOf("MSIE")>-1&&!e,s=t.indexOf("Trident")>-1&&t.indexOf("rv:11.0")>-1,l=t.indexOf("Edge")>-1,n=t.indexOf("Firefox")>-1,o=t.indexOf("Safari")>-1&&-1===t.indexOf("Chrome"),i=t.indexOf("Chrome")>-1&&t.indexOf("Safari")>-1;if(r){new RegExp("MSIE (\\d+\\.\\d+);").test(t);const e=parseFloat(RegExp.$1);return 7===e?"IE7":8===e?"IE8":9===e?"IE9":10===e?"IE10":"0"}return n?"FF":e?"Opera":o?"Safari":i?"Chrome":l?"Edge":s?"IE11":"Unknown browser"}static generateRandomId(t=21){return((t=21)=>crypto.getRandomValues(new Uint8Array(t)).reduce(((t,e)=>t+((e&=63)<36?e.toString(36):e<62?(e-26).toString(36).toUpperCase():e>62?"-":"_")),""))(t)}static getClassName(t){return t.constructor.name}static deepMerge(t,...e){function r(t,e){t.forEach(((t,l)=>{var n,o;if(B.isArray(t)){const s=null!=(n=e[l])?n:[];return e[l]=s,void r(t,s)}if(B.isObject(t)){const r=null!=(o=e[l])?o:{};return e[l]=r,void s(t,r)}e[l]=t}))}function s(t,e){Object.keys(t).forEach((l=>{var n,o;const i=t[l];if(B.isObject(i)){const t=null!=(n=e[l])?n:{};return e[l]=t,void s(i,t)}if(B.isArray(i)){const t=null!=(o=e[l])?o:[];return e[l]=t,void r(i,t)}e[l]=i}))}return e.forEach((e=>e&&function(e){Object.keys(e).forEach((l=>{var n,o;const i=e[l];if(B.isArray(i)){const e=null!=(n=t[l])?n:[];return t[l]=e,void r(i,e)}if(B.isObject(i)){const e=null!=(o=t[l])?o:{};return t[l]=e,void s(i,e)}t[l]=i}))}(e))),t}static numberFixed(t,e){return Number(Number(t).toFixed(e))}static diffValue(t,e){function r(s,l){return B.getValueType(s)===B.getValueType(l)&&(B.isArray(s)?function(s,l){if(t.length!==e.length)return!1;for(let t=0,e=s.length;t{e[r]=B.deepClone(t)})),e}if(this.isObject(t)){const e={};return Object.keys(t).forEach((r=>{const s=t[r];e[r]=B.deepClone(s)})),Object.setPrototypeOf(e,Object.getPrototypeOf(t)),e}return t}static getLanguage(){const t="en-US";return globalThis.navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||t}static getValueType(t){return Object.prototype.toString.apply(t)}static isDefine(t){return null!=t}static isBlank(t){return!this.isDefine(t)||!!this.isString(t)&&""===t.trim()}static isAssignableFrom(t,e){return t instanceof e}static isBoolean(t){return"[object Boolean]"===this.getValueType(t)}static isPlainObject(t){return!!this.isDefine(t)&&Object.getPrototypeOf(t)===Object.getPrototypeOf({})}static isFunction(t){return"[object Function]"===this.getValueType(t)}static isDate(t){return"[object Date]"===this.getValueType(t)}static isRegExp(t){return"[object RegExp]"===this.getValueType(t)}static isArray(t){return"[object Array]"===this.getValueType(t)}static isString(t){return"[object String]"===this.getValueType(t)}static isNumber(t){return"[object Number]"===this.getValueType(t)}static isStringNumber(t){return!isNaN(parseFloat(t))&&isFinite(t)}static isObject(t){return"[object Object]"===this.getValueType(t)}static isEmptyObject(t){for(const e in t)return!1;return!0}static isMobile(){let t=0,e=0;return document.body.clientWidth&&(t=document.body.clientWidth),document.body.clientHeight&&(e=document.body.clientHeight),this.isAndroid()||this.isIPhone()||this.isTablet()||t<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 t=navigator.userAgent.toLowerCase();return"micromessenger"===String(t.match(/MicroMessenger/i))}static isAndroid(){const t=navigator.userAgent;return t.indexOf("Android")>-1||t.indexOf("Linux")>-1}static isIPhone(){return/iPhone/i.test(navigator.userAgent)}static isIEBrowser(){return this.getBrowserType().startsWith("IE")}static itCount(t){return e=>{for(let r=0;r0)}static capitalize(t){return t.charAt(0).toUpperCase()+t.slice(1)}static fCamelCase(t,e){return e.toUpperCase()}static camelCase(t){return t.replace(m,"ms-").replace(p,this.fCamelCase)}static removeNull(t){if(this.isObject(t)){const e={};return Object.keys(t).forEach((e=>{const r=t[e];null==r?delete t[e]:B.removeNull(r)})),e}return t}static fillTwoDimensionalArray(t,e,r){return new Array(t).fill(r).map((t=>new Array(e).fill(r)))}static fillObjectMatrix(t,e,r){const s=new v;for(let l=0;l0;){let r=t%26;r=0===r?r=26:r,e=String.fromCharCode(96+r)+e,t=(t-r)/26}return e.toLocaleUpperCase()}static ABCatNum(t){if(null==t||0===t.length)return NaN;const e=t.toLowerCase().split(""),r=e.length;let s=0,l=0;for(let n=0;n=0;)s=String.fromCharCode(t%r+e)+s,t=Math.floor(t/r)-1;return s.toUpperCase()}static randSort(t){for(let e=0,r=t.length;e{e[r]={},t.forEach(((t,s)=>{e[r][s]=t}))})),e}}var C,w,T,y,S,j,E,Y,R,I,A,x,O,N,k,M,D,L,P,H,F,U,z,W,V,G,X,Q,K,Z,$,q,J,tt,et,rt,st,lt,nt,ot,it,at,gt,ct,bt,ht,dt,ut,ft,vt,mt,pt,_t,Bt,Ct,wt,Tt,yt,St,jt,Et,Yt,Rt,It,At,xt,Ot,Nt,kt,Mt,Dt,Lt,Pt,Ht,Ft,Ut,zt,Wt,Vt,Gt,Xt,Qt,Kt,Zt,$t,qt,Jt,te,ee,re,se,le,ne,oe,ie,ae,ge,ce,be,he,de,ue,fe,ve,me,pe,_e,Be,Ce,we,Te,ye,Se,je,Ee,Ye;(w=C||(C={}))[w.TAB=0]="TAB",w[w.SPACE=1]="SPACE",w[w.NOTHING=2]="NOTHING",(y=T||(T={}))[y.GLYPH_TYPE_UNSPECIFIED=0]="GLYPH_TYPE_UNSPECIFIED",y[y.NONE=1]="NONE",y[y.DECIMAL=2]="DECIMAL",y[y.ZERO_DECIMAL=3]="ZERO_DECIMAL",y[y.UPPER_ALPHA=4]="UPPER_ALPHA",y[y.ALPHA=5]="ALPHA",y[y.UPPER_ROMAN=6]="UPPER_ROMAN",y[y.ROMAN=7]="ROMAN",(j=S||(S={}))[j.BULLET_ALIGNMENT_UNSPECIFIED=0]="BULLET_ALIGNMENT_UNSPECIFIED",j[j.START=1]="START",j[j.CENTER=2]="CENTER",j[j.END=3]="END",(Y=E||(E={}))[Y.PARAGRAPH=0]="PARAGRAPH",Y[Y.TABLE=1]="TABLE",Y[Y.SECTION_BREAK=2]="SECTION_BREAK",Y[Y.CUSTOM=3]="CUSTOM",(I=R||(R={}))[I.DEFAULT=0]="DEFAULT",I[I.LINES=1]="LINES",I[I.LINES_AND_CHARS=2]="LINES_AND_CHARS",I[I.SNAP_TO_CHARS=3]="SNAP_TO_CHARS",(x=A||(A={}))[x.SECTION_TYPE_UNSPECIFIED=0]="SECTION_TYPE_UNSPECIFIED",x[x.CONTINUOUS=1]="CONTINUOUS",x[x.NEXT_PAGE=2]="NEXT_PAGE",x[x.EVEN_PAGE=3]="EVEN_PAGE",x[x.ODD_PAGE=4]="ODD_PAGE",(N=O||(O={}))[N.COLUMN_SEPARATOR_STYLE_UNSPECIFIED=0]="COLUMN_SEPARATOR_STYLE_UNSPECIFIED",N[N.NONE=1]="NONE",N[N.BETWEEN_EACH_COLUMN=2]="BETWEEN_EACH_COLUMN",(M=k||(k={}))[M.NORMAL=0]="NORMAL",M[M.TBRL=1]="TBRL",M[M.LRTBV=2]="LRTBV",(L=D||(D={}))[L.TEXT_RUN=0]="TEXT_RUN",L[L.AUTO_TEXT=1]="AUTO_TEXT",L[L.PAGE_BREAK=2]="PAGE_BREAK",L[L.COLUMN_BREAK=3]="COLUMN_BREAK",L[L.FOOT_NOTE_REFERENCE=4]="FOOT_NOTE_REFERENCE",L[L.HORIZONTAL_RULE=5]="HORIZONTAL_RULE",L[L.EQUATION=6]="EQUATION",L[L.DRAWING=7]="DRAWING",L[L.PERSON=8]="PERSON",L[L.RICH_LINK=9]="RICH_LINK",(H=P||(P={}))[H.BOTH_SIDES=0]="BOTH_SIDES",H[H.LEFT=1]="LEFT",H[H.RIGHT=2]="RIGHT",H[H.LARGEST=3]="LARGEST",(U=F||(F={}))[U.INLINE=0]="INLINE",U[U.WRAP_NONE=1]="WRAP_NONE",U[U.WRAP_POLYGON=2]="WRAP_POLYGON",U[U.WRAP_SQUARE=3]="WRAP_SQUARE",U[U.WRAP_THROUGH=4]="WRAP_THROUGH",U[U.WRAP_TIGHT=5]="WRAP_TIGHT",U[U.WRAP_TOP_AND_BOTTOM=6]="WRAP_TOP_AND_BOTTOM",(W=z||(z={}))[W.NAMED_STYLE_TYPE_UNSPECIFIED=0]="NAMED_STYLE_TYPE_UNSPECIFIED",W[W.NORMAL_TEXT=1]="NORMAL_TEXT",W[W.TITLE=2]="TITLE",W[W.SUBTITLE=3]="SUBTITLE",W[W.HEADING_1=4]="HEADING_1",W[W.HEADING_2=5]="HEADING_2",W[W.HEADING_3=6]="HEADING_3",W[W.HEADING_4=7]="HEADING_4",W[W.HEADING_5=8]="HEADING_5",W[W.HEADING_6=9]="HEADING_6",(G=V||(V={}))[G.AUTO=0]="AUTO",G[G.AT_LEAST=1]="AT_LEAST",G[G.EXACT=2]="EXACT",(Q=X||(X={}))[Q.DASH_STYLE_UNSPECIFIED=0]="DASH_STYLE_UNSPECIFIED",Q[Q.SOLID=1]="SOLID",Q[Q.DOT=2]="DOT",Q[Q.DASH=3]="DASH",(Z=K||(K={}))[Z.TAB_STOP_ALIGNMENT_UNSPECIFIED=0]="TAB_STOP_ALIGNMENT_UNSPECIFIED",Z[Z.START=1]="START",Z[Z.CENTER=2]="CENTER",Z[Z.END=3]="END",(q=$||($={})).EVENLY_DISTRIBUTED="0",q.FIXED_WIDTH="1",(tt=J||(J={}))[tt.CONTENT_ALIGNMENT_UNSPECIFIED=0]="CONTENT_ALIGNMENT_UNSPECIFIED",tt[tt.CONTENT_ALIGNMENT_UNSUPPORTED=1]="CONTENT_ALIGNMENT_UNSUPPORTED",tt[tt.TOP=2]="TOP",tt[tt.MIDDLE=3]="MIDDLE",tt[tt.BOTTOM=4]="BOTTOM",(rt=et||(et={})).NORMAL="normal",rt.BOLD="bold",rt.ITALIC="italic",(lt=st||(st={}))[lt.CHARACTER=0]="CHARACTER",lt[lt.COLUMN=1]="COLUMN",lt[lt.INSIDE_MARGIN=2]="INSIDE_MARGIN",lt[lt.LEFT_MARGIN=3]="LEFT_MARGIN",lt[lt.MARGIN=4]="MARGIN",lt[lt.OUTSIDE_MARGIN=5]="OUTSIDE_MARGIN",lt[lt.PAGE=6]="PAGE",lt[lt.RIGHT_MARGIN=7]="RIGHT_MARGIN",(ot=nt||(nt={}))[ot.BOTTOM_MARGIN=0]="BOTTOM_MARGIN",ot[ot.INSIDE_MARGIN=1]="INSIDE_MARGIN",ot[ot.LINE=2]="LINE",ot[ot.MARGIN=3]="MARGIN",ot[ot.OUTSIDE_MARGIN=4]="OUTSIDE_MARGIN",ot[ot.PAGE=5]="PAGE",ot[ot.PARAGRAPH=6]="PARAGRAPH",ot[ot.TOP_MARGIN=7]="TOP_MARGIN",(at=it||(it={}))[at.POINT=0]="POINT",at[at.LINE=1]="LINE",at[at.CHARACTER=2]="CHARACTER",(ct=gt||(gt={}))[ct.CENTER=0]="CENTER",ct[ct.INSIDE=1]="INSIDE",ct[ct.LEFT=2]="LEFT",ct[ct.OUTSIDE=3]="OUTSIDE",ct[ct.RIGHT=4]="RIGHT",(ht=bt||(bt={}))[ht.BOTTOM=0]="BOTTOM",ht[ht.CENTER=1]="CENTER",ht[ht.INSIDE=2]="INSIDE",ht[ht.OUTSIDE=3]="OUTSIDE",ht[ht.TOP=4]="TOP",(ut=dt||(dt={}))[ut.compressPunctuation=0]="compressPunctuation",ut[ut.compressPunctuationAndJapaneseKana=1]="compressPunctuationAndJapaneseKana",ut[ut.doNotCompress=2]="doNotCompress",(vt=ft||(ft={}))[vt.PORTRAIT=0]="PORTRAIT",vt[vt.LANDSCAPE=1]="LANDSCAPE",(pt=mt||(mt={})).INSERT_ROW_DATA_ACTION="InsertRowDataAction",pt.REMOVE_ROW_DATA_ACTION="RemoveRowDataAction",pt.INSERT_ROW_ACTION="InsertRowAction",pt.REMOVE_ROW_ACTION="RemoveRowAction",pt.SET_RANGE_STYLE_ACTION="SetRangeStyleAction",pt.SET_SELECTION_ACTION="SetSelectionActivateAction",pt.SET_RANGE_DATA_ACTION="SetRangeDataAction",pt.SET_RANGE_FORMATTED_VALUE_ACTION="SetRangeFormattedValueAction",pt.SET_RANGE_NOTE_ACTION="SetRangeNoteAction",pt.DELETE_RANGE_ACTION="DeleteRangeAction",pt.INSERT_SHEET_ACTION="InsertSheetAction",pt.REMOVE_SHEET_ACTION="RemoveSheetAction",pt.CLEAR_RANGE_ACTION="ClearRangeAction",pt.INSERT_RANGE_ACTION="InsertRangeAction",pt.SET_TAB_COLOR_ACTION="SetTabColorAction",pt.HIDE_SHEET_ACTION="SetWorkSheetHideAction",pt.SET_WORKSHEET_ACTIVATE_ACTION="SetWorkSheetActivateAction",pt.INSERT_COLUMN_ACTION="InsertColumnAction",pt.INSERT_COLUMN_DATA_ACTION="InsertColumnDataAction",pt.REMOVE_COLUMN_ACTION="RemoveColumnAction",pt.REMOVE_COLUMN_DATA_ACTION="RemoveColumnDataAction",pt.SET_HIDE_ROW_ACTION="SetRowHideAction",pt.SET_HIDE_COLUMN_ACTION="SetColumnHideAction",pt.SET_SHOW_ROW_ACTION="SetRowShowAction",pt.SET_SHOW_COLUMN_ACTION="SetColumnShowAction",pt.ADD_MERGE_ACTION="AddMergeAction",pt.REMOVE_MERGE_ACTION="RemoveMergeAction",pt.SET_WORKSHEET_NAME_ACTION="SetWorkSheetNameAction",pt.SET_WORKSHEET_STATUS_ACTION="SetWorkSheetStatusAction",pt.SET_BORDER_ACTION="SetBorderAction",pt.SET_COLUMN_WIDTH_ACTION="SetColumnWidthAction",pt.SET_ROW_HEIGHT_ACTION="SetRowHeightAction",pt.SET_HIDDEN_GRIDLINES_ACTION="SetHiddenGridlinesAction",pt.SET_RIGHT_TO_LEFT_ACTION="SetRightToLeftAction",pt.DELETE_BANDING_ACTION="DeleteBandingAction",pt.SET_BANDING_ACTION="SetBandingAction",pt.ADD_BANDING_ACTION="AddBandingAction",pt.DELETE_NAMED_RANGE_ACTION="DeleteNamedRangeAction",pt.SET_NAMED_RANGE_ACTION="SetNamedRangeAction",pt.ADD_NAMED_RANGE_ACTION="AddNamedRangeAction",pt.SET_SHEET_ORDER_ACTION="SetSheetOrderAction",pt.SET_ZOOM_RATIO_ACTION="SetZoomRatioAction",pt.SET_FROZEN_COLUMNS_ACTION="SetFrozenColumnsAction",pt.SET_FROZEN_ROWS_ACTION="SetFrozenRowsAction",(Bt=_t||(_t={}))[Bt.DEFAULT_SERIES=0]="DEFAULT_SERIES",Bt[Bt.ALTERNATE_SERIES=1]="ALTERNATE_SERIES",(wt=Ct||(Ct={})).CELL_EMPTY="CELL_EMPTY",wt.CELL_NOT_EMPTY="CELL_NOT_EMPTY",wt.DATE_AFTER="DATE_AFTER",wt.DATE_BEFORE="DATE_BEFORE",wt.DATE_EQUAL_TO="DATE_EQUAL_TO",wt.DATE_NOT_EQUAL_TO="DATE_NOT_EQUAL_TO",wt.DATE_AFTER_RELATIVE="DATE_AFTER_RELATIVE",wt.DATE_BEFORE_RELATIVE="DATE_BEFORE_RELATIVE",wt.DATE_EQUAL_TO_RELATIVE="DATE_EQUAL_TO_RELATIVE",wt.NUMBER_BETWEEN="NUMBER_BETWEEN",wt.NUMBER_EQUAL_TO="NUMBER_EQUAL_TO",wt.NUMBER_GREATER_THAN="NUMBER_GREATER_THAN",wt.NUMBER_GREATER_THAN_OR_EQUAL_TO="NUMBER_GREATER_THAN_OR_EQUAL_TO",wt.NUMBER_LESS_THAN="NUMBER_LESS_THAN",wt.NUMBER_LESS_THAN_OR_EQUAL_TO="NUMBER_LESS_THAN_OR_EQUAL_TO",wt.NUMBER_NOT_BETWEEN="NUMBER_NOT_BETWEEN",wt.NUMBER_NOT_EQUAL_TO="NUMBER_NOT_EQUAL_TO",wt.TEXT_CONTAINS="TEXT_CONTAINS",wt.TEXT_DOES_NOT_CONTAIN="TEXT_DOES_NOT_CONTAIN",wt.TEXT_EQUAL_TO="TEXT_EQUAL_TO",wt.TEXT_NOT_EQUAL_TO="TEXT_NOT_EQUAL_TO",wt.TEXT_STARTS_WITH="TEXT_STARTS_WITH",wt.TEXT_ENDS_WITH="TEXT_ENDS_WITH",wt.CUSTOM_FORMULA="CUSTOM_FORMULA",(yt=Tt||(Tt={}))[yt.NONE=0]="NONE",yt[yt.THIN=1]="THIN",yt[yt.HAIR=2]="HAIR",yt[yt.DOTTED=3]="DOTTED",yt[yt.DASHED=4]="DASHED",yt[yt.DASH_DOT=5]="DASH_DOT",yt[yt.DASH_DOT_DOT=6]="DASH_DOT_DOT",yt[yt.DOUBLE=7]="DOUBLE",yt[yt.MEDIUM=8]="MEDIUM",yt[yt.MEDIUM_DASHED=9]="MEDIUM_DASHED",yt[yt.MEDIUM_DASH_DOT=10]="MEDIUM_DASH_DOT",yt[yt.MEDIUM_DASH_DOT_DOT=11]="MEDIUM_DASH_DOT_DOT",yt[yt.SLANT_DASH_DOT=12]="SLANT_DASH_DOT",yt[yt.THICK=13]="THICK",(jt=St||(St={})).TOP="top",jt.BOTTOM="bottom",jt.LEFT="left",jt.RIGHT="right",jt.NONE="none",jt.ALL="all",jt.OUTSIDE="outside",jt.INSIDE="inside",jt.HORIZONTAL="horizontal",jt.VERTICAL="vertical",(Yt=Et||(Et={}))[Yt.UNSUPPORTED=0]="UNSUPPORTED",Yt[Yt.RGB=1]="RGB",Yt[Yt.HEX=2]="HEX",Yt[Yt.THEME=3]="THEME",(It=Rt||(Rt={}))[It.ON=0]="ON",It[It.OFF=1]="OFF",(xt=At||(At={}))[xt.CONDITION_TYPE_UNSPECIFIED=0]="CONDITION_TYPE_UNSPECIFIED",xt[xt.NUMNUMBER_BETWEENR_GREATER=1]="NUMNUMBER_BETWEENR_GREATER",xt[xt.NUMBER_GREATER_THAN_EQ=2]="NUMBER_GREATER_THAN_EQ",xt[xt.NUMBER_LESS=3]="NUMBER_LESS",xt[xt.NUMBER_LESS_THAN_EQ=4]="NUMBER_LESS_THAN_EQ",xt[xt.NUMBER_EQ=5]="NUMBER_EQ",xt[xt.NUMBER_NOT_EQ=6]="NUMBER_NOT_EQ",xt[xt.NUMBER_BETWEEN=7]="NUMBER_BETWEEN",xt[xt.NUMBER_NOT_BETWEEN=8]="NUMBER_NOT_BETWEEN",xt[xt.TEXT_CONTAINS=9]="TEXT_CONTAINS",xt[xt.TEXT_NOT_CONTAINS=10]="TEXT_NOT_CONTAINS",xt[xt.TEXT_STARTS_WITH=11]="TEXT_STARTS_WITH",xt[xt.TEXT_ENDS_WITH=12]="TEXT_ENDS_WITH",xt[xt.TEXT_EQ=13]="TEXT_EQ",xt[xt.TEXT_IS_EMAIL=14]="TEXT_IS_EMAIL",xt[xt.TEXT_IS_URL=15]="TEXT_IS_URL",xt[xt.DATE_EQ=16]="DATE_EQ",xt[xt.DATE_BEFORE=17]="DATE_BEFORE",xt[xt.DATE_AFTER=18]="DATE_AFTER",xt[xt.DATE_ON_OR_BEFORE=19]="DATE_ON_OR_BEFORE",xt[xt.DATE_ON_OR_AFTER=20]="DATE_ON_OR_AFTER",xt[xt.DATE_BETWEEN=21]="DATE_BETWEEN",xt[xt.DATE_NOT_BETWEEN=22]="DATE_NOT_BETWEEN",xt[xt.DATE_IS_VALID=23]="DATE_IS_VALID",xt[xt.ONE_OF_RANGE=24]="ONE_OF_RANGE",xt[xt.ONE_OF_LIST=25]="ONE_OF_LIST",xt[xt.BLANK=26]="BLANK",xt[xt.NOT_BLANK=27]="NOT_BLANK",xt[xt.CUSTOM_FORMULA=28]="CUSTOM_FORMULA",xt[xt.BOOLEAN=29]="BOOLEAN",xt[xt.TEXT_NOT_EQ=30]="TEXT_NOT_EQ",xt[xt.DATE_NOT_EQ=31]="DATE_NOT_EQ",(Nt=Ot||(Ot={}))[Nt.PASTE_NORMAL=0]="PASTE_NORMAL",Nt[Nt.PASTE_NO_BORDERS=1]="PASTE_NO_BORDERS",Nt[Nt.PASTE_FORMAT=2]="PASTE_FORMAT",Nt[Nt.PASTE_FORMULA=3]="PASTE_FORMULA",Nt[Nt.PASTE_DATA_VALIDATION=4]="PASTE_DATA_VALIDATION",Nt[Nt.PASTE_VALUES=5]="PASTE_VALUES",Nt[Nt.PASTE_CONDITIONAL_FORMATTING=6]="PASTE_CONDITIONAL_FORMATTING",Nt[Nt.PASTE_COLUMN_WIDTHS=7]="PASTE_COLUMN_WIDTHS",(Mt=kt||(kt={}))[Mt.DOCUMENT=0]="DOCUMENT",Mt[Mt.PROJECT=1]="PROJECT",(Lt=Dt||(Dt={}))[Lt.COLUMNS=0]="COLUMNS",Lt[Lt.ROWS=1]="ROWS",(Ht=Pt||(Pt={}))[Ht.LEFT=0]="LEFT",Ht[Ht.RIGHT=1]="RIGHT",Ht[Ht.TOP=2]="TOP",Ht[Ht.BOTTOM=3]="BOTTOM",(Ut=Ft||(Ft={}))[Ut.NUMBER_FORMAT_TYPE_UNSPECIFIED=0]="NUMBER_FORMAT_TYPE_UNSPECIFIED",Ut[Ut.TEXT=1]="TEXT",Ut[Ut.NUMBER=2]="NUMBER",Ut[Ut.PERCENT=3]="PERCENT",Ut[Ut.CURRENCY=4]="CURRENCY",Ut[Ut.DATE=5]="DATE",Ut[Ut.TIME=6]="TIME",Ut[Ut.DATE_TIME=7]="DATE_TIME",Ut[Ut.SCIENTIFIC=8]="SCIENTIFIC",(Wt=zt||(zt={}))[Wt.INTERPOLATION_POINT_TYPE_UNSPECIFIED=0]="INTERPOLATION_POINT_TYPE_UNSPECIFIED",Wt[Wt.MIN=1]="MIN",Wt[Wt.MAX=2]="MAX",Wt[Wt.NUMBER=3]="NUMBER",Wt[Wt.PERCENT=4]="PERCENT",Wt[Wt.PERCENTILE=5]="PERCENTILE",(Gt=Vt||(Vt={}))[Gt.BACKSPACE=8]="BACKSPACE",Gt[Gt.TAB=9]="TAB",Gt[Gt.ENTER=13]="ENTER",Gt[Gt.SHIFT=16]="SHIFT",Gt[Gt.CTRL=17]="CTRL",Gt[Gt.PAUSE=19]="PAUSE",Gt[Gt.CAPS_LOCK=20]="CAPS_LOCK",Gt[Gt.ESC=27]="ESC",Gt[Gt.SPACE=33]="SPACE",Gt[Gt.PAGE_UP=33]="PAGE_UP",Gt[Gt.PAGE_DOWN=34]="PAGE_DOWN",Gt[Gt.END=35]="END",Gt[Gt.HOME=36]="HOME",Gt[Gt.LEFT=37]="LEFT",Gt[Gt.UP=38]="UP",Gt[Gt.RIGHT=39]="RIGHT",Gt[Gt.DOWN=40]="DOWN",Gt[Gt.INSERT=45]="INSERT",Gt[Gt.DELETE=46]="DELETE",Gt[Gt.WIN=91]="WIN",Gt[Gt.WIN_R=92]="WIN_R",Gt[Gt.MENU=93]="MENU",Gt[Gt.F1=112]="F1",Gt[Gt.F2=113]="F2",Gt[Gt.F3=114]="F3",Gt[Gt.F4=115]="F4",Gt[Gt.F5=116]="F5",Gt[Gt.F6=117]="F6",Gt[Gt.F7=118]="F7",Gt[Gt.F8=119]="F8",Gt[Gt.F9=120]="F9",Gt[Gt.F10=121]="F10",Gt[Gt.F11=122]="F11",Gt[Gt.F12=123]="F12",Gt[Gt.NUM_LOCK=144]="NUM_LOCK",Gt[Gt.SCROLL_LOCK=145]="SCROLL_LOCK",(Qt=Xt||(Xt={})).backspace="Backspace",Qt.delete="Delete",(Zt=Kt||(Kt={})).EN="en",Zt.ZH="zh",(qt=$t||($t={}))[qt.RANGE=0]="RANGE",qt[qt.SHEET=1]="SHEET",(te=Jt||(Jt={}))[te.RELATIVE_DATE_UNSPECIFIED=0]="RELATIVE_DATE_UNSPECIFIED",te[te.PAST_YEAR=1]="PAST_YEAR",te[te.PAST_MONTH=2]="PAST_MONTH",te[te.PAST_WEEK=3]="PAST_WEEK",te[te.YESTERDAY=4]="YESTERDAY",te[te.TODAY=5]="TODAY",te[te.TOMORROW=6]="TOMORROW",(re=ee||(ee={}))[re.GRID=0]="GRID",re[re.KANBAN=1]="KANBAN",re[re.GANTT=2]="GANTT",(le=se||(se={}))[le.UNSPECIFIED=0]="UNSPECIFIED",le[le.LEFT_TO_RIGHT=1]="LEFT_TO_RIGHT",le[le.RIGHT_TO_LEFT=2]="RIGHT_TO_LEFT",(oe=ne||(ne={}))[oe.DASH=0]="DASH",oe[oe.DASH_DOT_DOT_HEAVY=1]="DASH_DOT_DOT_HEAVY",oe[oe.DASH_DOT_HEAVY=2]="DASH_DOT_HEAVY",oe[oe.DASHED_HEAVY=3]="DASHED_HEAVY",oe[oe.DASH_LONG=4]="DASH_LONG",oe[oe.DASH_LONG_HEAVY=5]="DASH_LONG_HEAVY",oe[oe.DOT_DASH=6]="DOT_DASH",oe[oe.DOT_DOT_DASH=7]="DOT_DOT_DASH",oe[oe.DOTTED=8]="DOTTED",oe[oe.DOTTED_HEAVY=9]="DOTTED_HEAVY",oe[oe.DOUBLE=10]="DOUBLE",oe[oe.NONE=11]="NONE",oe[oe.SINGLE=12]="SINGLE",oe[oe.THICK=13]="THICK",oe[oe.WAVE=14]="WAVE",oe[oe.WAVY_DOUBLE=15]="WAVY_DOUBLE",oe[oe.WAVY_HEAVY=16]="WAVY_HEAVY",oe[oe.WORDS=17]="WORDS",(ae=ie||(ie={}))[ae.UNSPECIFIED=0]="UNSPECIFIED",ae[ae.LEFT=1]="LEFT",ae[ae.CENTER=2]="CENTER",ae[ae.RIGHT=3]="RIGHT",ae[ae.JUSTIFIED=4]="JUSTIFIED",(ce=ge||(ge={}))[ce.UNSPECIFIED=0]="UNSPECIFIED",ce[ce.TOP=1]="TOP",ce[ce.MIDDLE=2]="MIDDLE",ce[ce.BOTTOM=3]="BOTTOM",(he=be||(be={}))[he.UNSPECIFIED=0]="UNSPECIFIED",he[he.OVERFLOW=1]="OVERFLOW",he[he.CLIP=2]="CLIP",he[he.WRAP=3]="WRAP",(ue=de||(de={}))[ue.NORMAL=0]="NORMAL",ue[ue.ITALIC=1]="ITALIC",(ve=fe||(fe={}))[ve.NORMAL=0]="NORMAL",ve[ve.BOLD=1]="BOLD",(pe=me||(me={}))[pe.NORMAL=0]="NORMAL",pe[pe.SUBSCRIPT=1]="SUBSCRIPT",pe[pe.SUPERSCRIPT=2]="SUPERSCRIPT",(Be=_e||(_e={}))[Be.FALSE=0]="FALSE",Be[Be.TRUE=1]="TRUE",(we=Ce||(Ce={}))[we.STRING=0]="STRING",we[we.NUMBER=1]="NUMBER",we[we.BOOLEAN=2]="BOOLEAN",we[we.FORCE_STRING=3]="FORCE_STRING",(ye=Te||(Te={}))[ye.DARK1=0]="DARK1",ye[ye.LIGHT1=1]="LIGHT1",ye[ye.DARK2=2]="DARK2",ye[ye.LIGHT2=3]="LIGHT2",ye[ye.ACCENT1=4]="ACCENT1",ye[ye.ACCENT2=5]="ACCENT2",ye[ye.ACCENT3=6]="ACCENT3",ye[ye.ACCENT4=7]="ACCENT4",ye[ye.ACCENT5=8]="ACCENT5",ye[ye.ACCENT6=9]="ACCENT6",ye[ye.HYPERLINK=10]="HYPERLINK",ye[ye.FOLLOWED_HYPERLINK=11]="FOLLOWED_HYPERLINK",(je=Se||(Se={})).OFFICE="Office",je.OFFICE_2007_2010="Office 2007-2010",je.GRAYSCALE="Grayscale",je.BLUE_WARM="Blue Warm",je.BLUE="Blue",je.BLUE_II="Blue II",je.BLUE_GREEN="Blue Green",je.GREEN="Green",je.GREEN_YELLOW="Green Yellow",je.YELLOW="Yellow",je.YELLOW_ORANGE="Yellow Orange",je.ORANGE="Orange",je.ORANGE_RED="Orange Red",je.RED_ORANGE="Red Orange",je.RED="Red",je.RED_VIOLET="Red Violet",je.VIOLET="Violet",je.VIOLET_II="Violet II",je.MEDIAN="Median",je.PAPER="Paper",je.MARQUEE="Marquee",je.SLIPSTREAM="Slipstream",je.Aspect="Aspect",(Ye=Ee||(Ee={}))[Ye.TYPE_UNSPECIFIED=0]="TYPE_UNSPECIFIED",Ye[Ye.TEXT_BOX=1]="TEXT_BOX",Ye[Ye.RECTANGLE=2]="RECTANGLE",Ye[Ye.ROUND_RECTANGLE=3]="ROUND_RECTANGLE",Ye[Ye.ELLIPSE=4]="ELLIPSE",Ye[Ye.ARC=5]="ARC",Ye[Ye.BENT_ARROW=6]="BENT_ARROW",Ye[Ye.BENT_UP_ARROW=7]="BENT_UP_ARROW",Ye[Ye.BEVEL=8]="BEVEL",Ye[Ye.BLOCK_ARC=9]="BLOCK_ARC",Ye[Ye.BRACE_PAIR=10]="BRACE_PAIR",Ye[Ye.BRACKET_PAIR=11]="BRACKET_PAIR",Ye[Ye.CAN=12]="CAN",Ye[Ye.CHEVRON=13]="CHEVRON",Ye[Ye.CHORD=14]="CHORD",Ye[Ye.CLOUD=15]="CLOUD",Ye[Ye.CORNER=16]="CORNER",Ye[Ye.CUBE=17]="CUBE",Ye[Ye.CURVED_DOWN_ARROW=18]="CURVED_DOWN_ARROW",Ye[Ye.CURVED_LEFT_ARROW=19]="CURVED_LEFT_ARROW",Ye[Ye.CURVED_RIGHT_ARROW=20]="CURVED_RIGHT_ARROW",Ye[Ye.CURVED_UP_ARROW=21]="CURVED_UP_ARROW",Ye[Ye.DECAGON=22]="DECAGON",Ye[Ye.DIAGONAL_STRIPE=23]="DIAGONAL_STRIPE",Ye[Ye.DIAMOND=24]="DIAMOND",Ye[Ye.DODECAGON=25]="DODECAGON",Ye[Ye.DONUT=26]="DONUT",Ye[Ye.DOUBLE_WAVE=27]="DOUBLE_WAVE",Ye[Ye.DOWN_ARROW=28]="DOWN_ARROW",Ye[Ye.DOWN_ARROW_CALLOUT=29]="DOWN_ARROW_CALLOUT",Ye[Ye.FOLDED_CORNER=30]="FOLDED_CORNER",Ye[Ye.FRAME=31]="FRAME",Ye[Ye.HALF_FRAME=32]="HALF_FRAME",Ye[Ye.HEART=33]="HEART",Ye[Ye.HEPTAGON=34]="HEPTAGON",Ye[Ye.HEXAGON=35]="HEXAGON",Ye[Ye.HOME_PLATE=36]="HOME_PLATE",Ye[Ye.HORIZONTAL_SCROLL=37]="HORIZONTAL_SCROLL",Ye[Ye.IRREGULAR_SEAL_1=38]="IRREGULAR_SEAL_1",Ye[Ye.IRREGULAR_SEAL_2=39]="IRREGULAR_SEAL_2",Ye[Ye.LEFT_ARROW=40]="LEFT_ARROW",Ye[Ye.LEFT_ARROW_CALLOUT=41]="LEFT_ARROW_CALLOUT",Ye[Ye.LEFT_BRACE=42]="LEFT_BRACE",Ye[Ye.LEFT_BRACKET=43]="LEFT_BRACKET",Ye[Ye.LEFT_RIGHT_ARROW=44]="LEFT_RIGHT_ARROW",Ye[Ye.LEFT_RIGHT_ARROW_CALLOUT=45]="LEFT_RIGHT_ARROW_CALLOUT",Ye[Ye.LEFT_RIGHT_UP_ARROW=46]="LEFT_RIGHT_UP_ARROW",Ye[Ye.LEFT_UP_ARROW=47]="LEFT_UP_ARROW",Ye[Ye.LIGHTNING_BOLT=48]="LIGHTNING_BOLT",Ye[Ye.MATH_DIVIDE=49]="MATH_DIVIDE",Ye[Ye.MATH_EQUAL=50]="MATH_EQUAL",Ye[Ye.MATH_MINUS=51]="MATH_MINUS",Ye[Ye.MATH_MULTIPLY=52]="MATH_MULTIPLY",Ye[Ye.MATH_NOT_EQUAL=53]="MATH_NOT_EQUAL",Ye[Ye.MATH_PLUS=54]="MATH_PLUS",Ye[Ye.MOON=55]="MOON",Ye[Ye.NO_SMOKING=56]="NO_SMOKING",Ye[Ye.NOTCHED_RIGHT_ARROW=57]="NOTCHED_RIGHT_ARROW",Ye[Ye.OCTAGON=58]="OCTAGON",Ye[Ye.PARALLELOGRAM=59]="PARALLELOGRAM",Ye[Ye.PENTAGON=60]="PENTAGON",Ye[Ye.PIE=61]="PIE",Ye[Ye.PLAQUE=62]="PLAQUE",Ye[Ye.PLUS=63]="PLUS",Ye[Ye.QUAD_ARROW=64]="QUAD_ARROW",Ye[Ye.QUAD_ARROW_CALLOUT=65]="QUAD_ARROW_CALLOUT",Ye[Ye.RIBBON=66]="RIBBON",Ye[Ye.RIBBON_2=67]="RIBBON_2",Ye[Ye.RIGHT_ARROW=68]="RIGHT_ARROW",Ye[Ye.RIGHT_ARROW_CALLOUT=69]="RIGHT_ARROW_CALLOUT",Ye[Ye.RIGHT_BRACE=70]="RIGHT_BRACE",Ye[Ye.RIGHT_BRACKET=71]="RIGHT_BRACKET",Ye[Ye.ROUND_1_RECTANGLE=72]="ROUND_1_RECTANGLE",Ye[Ye.ROUND_2_DIAGONAL_RECTANGLE=73]="ROUND_2_DIAGONAL_RECTANGLE",Ye[Ye.ROUND_2_SAME_RECTANGLE=74]="ROUND_2_SAME_RECTANGLE",Ye[Ye.RIGHT_TRIANGLE=75]="RIGHT_TRIANGLE",Ye[Ye.SMILEY_FACE=76]="SMILEY_FACE",Ye[Ye.SNIP_1_RECTANGLE=77]="SNIP_1_RECTANGLE",Ye[Ye.SNIP_2_DIAGONAL_RECTANGLE=78]="SNIP_2_DIAGONAL_RECTANGLE",Ye[Ye.SNIP_2_SAME_RECTANGLE=79]="SNIP_2_SAME_RECTANGLE",Ye[Ye.SNIP_ROUND_RECTANGLE=80]="SNIP_ROUND_RECTANGLE",Ye[Ye.STAR_10=81]="STAR_10",Ye[Ye.STAR_12=82]="STAR_12",Ye[Ye.STAR_16=83]="STAR_16",Ye[Ye.STAR_24=84]="STAR_24",Ye[Ye.STAR_32=85]="STAR_32",Ye[Ye.STAR_4=86]="STAR_4",Ye[Ye.STAR_5=87]="STAR_5",Ye[Ye.STAR_6=88]="STAR_6",Ye[Ye.STAR_7=89]="STAR_7",Ye[Ye.STAR_8=90]="STAR_8",Ye[Ye.STRIPED_RIGHT_ARROW=91]="STRIPED_RIGHT_ARROW",Ye[Ye.SUN=92]="SUN",Ye[Ye.TRAPEZOID=93]="TRAPEZOID",Ye[Ye.TRIANGLE=94]="TRIANGLE",Ye[Ye.UP_ARROW=95]="UP_ARROW",Ye[Ye.UP_ARROW_CALLOUT=96]="UP_ARROW_CALLOUT",Ye[Ye.UP_DOWN_ARROW=97]="UP_DOWN_ARROW",Ye[Ye.UTURN_ARROW=98]="UTURN_ARROW",Ye[Ye.VERTICAL_SCROLL=99]="VERTICAL_SCROLL",Ye[Ye.WAVE=100]="WAVE",Ye[Ye.WEDGE_ELLIPSE_CALLOUT=101]="WEDGE_ELLIPSE_CALLOUT",Ye[Ye.WEDGE_RECTANGLE_CALLOUT=102]="WEDGE_RECTANGLE_CALLOUT",Ye[Ye.WEDGE_ROUND_RECTANGLE_CALLOUT=103]="WEDGE_ROUND_RECTANGLE_CALLOUT",Ye[Ye.FLOW_CHART_ALTERNATE_PROCESS=104]="FLOW_CHART_ALTERNATE_PROCESS",Ye[Ye.FLOW_CHART_COLLATE=105]="FLOW_CHART_COLLATE",Ye[Ye.FLOW_CHART_CONNECTOR=106]="FLOW_CHART_CONNECTOR",Ye[Ye.FLOW_CHART_DECISION=107]="FLOW_CHART_DECISION",Ye[Ye.FLOW_CHART_DELAY=108]="FLOW_CHART_DELAY",Ye[Ye.FLOW_CHART_DISPLAY=109]="FLOW_CHART_DISPLAY",Ye[Ye.FLOW_CHART_DOCUMENT=110]="FLOW_CHART_DOCUMENT",Ye[Ye.FLOW_CHART_EXTRACT=111]="FLOW_CHART_EXTRACT",Ye[Ye.FLOW_CHART_INPUT_OUTPUT=112]="FLOW_CHART_INPUT_OUTPUT",Ye[Ye.FLOW_CHART_INTERNAL_STORAGE=113]="FLOW_CHART_INTERNAL_STORAGE",Ye[Ye.FLOW_CHART_MAGNETIC_DISK=114]="FLOW_CHART_MAGNETIC_DISK",Ye[Ye.FLOW_CHART_MAGNETIC_DRUM=115]="FLOW_CHART_MAGNETIC_DRUM",Ye[Ye.FLOW_CHART_MAGNETIC_TAPE=116]="FLOW_CHART_MAGNETIC_TAPE",Ye[Ye.FLOW_CHART_MANUAL_INPUT=117]="FLOW_CHART_MANUAL_INPUT",Ye[Ye.FLOW_CHART_MANUAL_OPERATION=118]="FLOW_CHART_MANUAL_OPERATION",Ye[Ye.FLOW_CHART_MERGE=119]="FLOW_CHART_MERGE",Ye[Ye.FLOW_CHART_MULTIDOCUMENT=120]="FLOW_CHART_MULTIDOCUMENT",Ye[Ye.FLOW_CHART_OFFLINE_STORAGE=121]="FLOW_CHART_OFFLINE_STORAGE",Ye[Ye.FLOW_CHART_OFFPAGE_CONNECTOR=122]="FLOW_CHART_OFFPAGE_CONNECTOR",Ye[Ye.FLOW_CHART_ONLINE_STORAGE=123]="FLOW_CHART_ONLINE_STORAGE",Ye[Ye.FLOW_CHART_OR=124]="FLOW_CHART_OR",Ye[Ye.FLOW_CHART_PREDEFINED_PROCESS=125]="FLOW_CHART_PREDEFINED_PROCESS",Ye[Ye.FLOW_CHART_PREPARATION=126]="FLOW_CHART_PREPARATION",Ye[Ye.FLOW_CHART_PROCESS=127]="FLOW_CHART_PROCESS",Ye[Ye.FLOW_CHART_PUNCHED_CARD=128]="FLOW_CHART_PUNCHED_CARD",Ye[Ye.FLOW_CHART_PUNCHED_TAPE=129]="FLOW_CHART_PUNCHED_TAPE",Ye[Ye.FLOW_CHART_SORT=130]="FLOW_CHART_SORT",Ye[Ye.FLOW_CHART_SUMMING_JUNCTION=131]="FLOW_CHART_SUMMING_JUNCTION",Ye[Ye.FLOW_CHART_TERMINATOR=132]="FLOW_CHART_TERMINATOR",Ye[Ye.ARROW_EAST=133]="ARROW_EAST",Ye[Ye.ARROW_NORTH_EAST=134]="ARROW_NORTH_EAST",Ye[Ye.ARROW_NORTH=135]="ARROW_NORTH",Ye[Ye.SPEECH=136]="SPEECH",Ye[Ye.STARBURST=137]="STARBURST",Ye[Ye.TEARDROP=138]="TEARDROP",Ye[Ye.ELLIPSE_RIBBON=139]="ELLIPSE_RIBBON",Ye[Ye.ELLIPSE_RIBBON_2=140]="ELLIPSE_RIBBON_2",Ye[Ye.CLOUD_CALLOUT=141]="CLOUD_CALLOUT",Ye[Ye.CUSTOM=142]="CUSTOM";const Re={sheetId:"",rangeData:{startRow:-1,endRow:-1,startColumn:-1,endColumn:-1}},Ie={startRow:-1,startColumn:-1,endRow:-1,endColumn:-1},Ae={startRow:0,startColumn:0,endRow:0,endColumn:0},xe={row:0,column:0},Oe={extensions:[],id:"",sheetOrder:[],socketEnable:_e.FALSE,socketUrl:"",name:"",timeZone:"",appVersion:"",theme:"",skin:"",locale:Kt.EN,creator:"",styles:{},sheets:{},lastModifiedBy:"",createdTime:"",modifiedTime:"",pluginMeta:{},namedRanges:[]},Ne={type:ee.GRID,name:"Sheet1",id:"sheet-01",tabColor:"",hidden:_e.FALSE,freezeColumn:-1,rowCount:1e3,columnCount:100,freezeRow:-1,zoomRatio:1,scrollTop:0,scrollLeft:0,defaultColumnWidth:73,defaultRowHeight:19,mergeData:[],hideRow:[],hideColumn:[],cellData:{},rowData:{},columnData:{},status:_e.FALSE,showGridlines:_e.TRUE,rowTitle:{width:46,hidden:_e.FALSE},columnTitle:{height:20,hidden:_e.FALSE},selections:["A1"],rightToLeft:_e.FALSE,pluginMeta:{}},ke={ff:"Times New Roman",fs:14,it:_e.FALSE,bl:_e.FALSE,ul:{s:_e.FALSE},st:{s:_e.FALSE},ol:{s:_e.FALSE},tr:{a:0,v:_e.FALSE},td:se.UNSPECIFIED,cl:{rgb:"#000"},bg:{rgb:"#fff"},ht:ie.UNSPECIFIED,vt:ge.UNSPECIFIED,tb:be.UNSPECIFIED,pd:{t:0,r:0,b:0,l:0}},Me={id:"default_doc",documentStyle:{}},De={id:"default_slide",title:"defaultSlide",pageSize:{width:300,height:300}};var Le,Pe;(Pe=Le||(Le={})).ARRAY_CONVERTOR="ARRAY_CONVERTOR",Pe.MATRIX_CONVERTOR="MATRIX_CONVERTOR";const He={modifier:["Alt","AltGraph","CapsLock","Control","Fn","FnLock","Meta","NumLock","ScrollLock","Shift","Symbol","SymbolLock"],legacyModifier:["Hyper","Super"],whiteSpace:["Enter","Tab"],navigation:["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","End","Home","PageDown","PageUp"],editing:["Backspace","Clear","Copy","CrSel","Cut","Delete","EraseEof","ExSel","Insert","Paste","Redo","Undo"],ui:["Accept","Again","Attn","Cancel","ContextMenu","Escape","Execute","Find","Help","Pause","Play","Props","Select","ZoomIn","ZoomOut"],device:["BrightnessDown","BrightnessUp","Eject","LogOff","Power","PowerOff","PrintScreen","Hibernate","Standby","WakeUp"],imeCompositionKeys:["AllCandidates","Alphanumeric","CodeInput","Compose","Convert","Dead","FinalMode","GroupFirst","GroupLast","GroupNext","GroupPrevious","ModeChange","NextCandidate","NonConvert","PreviousCandidate","Process","SingleCandidate"],koreanSpecific:["HangulMode","HanjaMode","JunjaMode"],japaneseSpecific:["Eisu","Hankaku","Hiragana","HiraganaKatakana","KanaMode","KanjiMode","Katakana","Romaji","Zenkaku","ZenkakuHankaku"],commonFunction:["F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12","Soft1","Soft2","Soft3","Soft4"],multimedia:["ChannelDown","ChannelUp","Close","MailForward","MailReply","MailSend","MediaClose","MediaFastForward","MediaPause","MediaPlay","MediaPlayPause","MediaRecord","MediaRewind","MediaStop","MediaTrackNext","MediaTrackPrevious","New","Open","Print","Save","SpellCheck"],multimediaNumpad:["Key11","Key12"],audio:["AudioBalanceLeft","AudioBalanceRight","AudioBassBoostDown","AudioBassBoostToggle","AudioBassBoostUp","AudioFaderFront","AudioFaderRear","AudioSurroundModeNext","AudioTrebleDown","AudioTrebleUp","AudioVolumeDown","AudioVolumeUp","AudioVolumeMute","MicrophoneToggle","MicrophoneVolumeDown","MicrophoneVolumeUp","MicrophoneVolumeMute"],speech:["SpeechCorrectionList","SpeechInputToggle"],application:["LaunchApplication1","LaunchApplication2","LaunchCalendar","LaunchContacts","LaunchMail","LaunchMediaPlayer","LaunchMusicPlayer","LaunchPhone","LaunchScreenSaver","LaunchSpreadsheet","LaunchWebBrowser","LaunchWebCam","LaunchWordProcessor"],browser:["BrowserBack","BrowserFavorites","BrowserForward","BrowserHome","BrowserRefresh","BrowserSearch","BrowserStop"],mobilePhone:["AppSwitch","Call","Camera","CameraFocus","EndCall","GoBack","GoHome","HeadsetHook","LastNumberRedial","Notification","MannerMode","VoiceDial"],tv:["TV","TV3DMode","TVAntennaCable","TVAudioDescription","TVAudioDescriptionMixDown","TVAudioDescriptionMixUp","TVContentsMenu","TVDataService","TVInput","TVInputComponent1","TVInputComponent2","TVInputComposite1","TVInputComposite2","TVInputHDMI1","TVInputHDMI2","TVInputHDMI3","TVInputHDMI4","TVInputVGA1","TVMediaContext","TVNetwork","TVNumberEntry","TVPower","TVRadioService","TVSatellite","TVSatelliteBS","TVSatelliteCS","TVSatelliteToggle","TVTerrestrialAnalog","TVTerrestrialDigital","TVTimer"],mediaControls:["AVRInput","AVRPower","ColorF0Red","ColorF1Green","ColorF2Yellow","ColorF3Blue","ColorF4Grey","ColorF5Brown","ClosedCaptionToggle","Dimmer","DisplaySwap","DVR","Exit","FavoriteClear0","FavoriteClear1","FavoriteClear2","FavoriteClear3","FavoriteRecall0","FavoriteRecall1","FavoriteRecall2","FavoriteRecall3","FavoriteStore0","FavoriteStore1","FavoriteStore2","FavoriteStore3","Guide","GuideNextDay","GuidePreviousDay","Info","InstantReplay","Link","ListProgram","LiveContent","Lock","MediaApps","MediaAudioTrack","MediaLast","MediaSkipBackward","MediaSkipForward","MediaStepBackward","MediaStepForward","MediaTopMenu","NavigateIn","NavigateNext","NavigateOut","NavigatePrevious","NextFavoriteChannel","NextUserProfile","OnDemand","Pairing","PinPDown","PinPMove","PinPToggle","PinPUp","PlaySpeedDown","PlaySpeedReset","PlaySpeedUp","RandomToggle","RcLowBattery","RecordSpeedNext","RfBypass","ScanChannelsToggle","ScreenModeNext","Settings","SplitScreenToggle","STBInput","STBPower","Subtitle","Teletext","VideoModeNext","Wink","ZoomToggle"]};var Fe,Ue;(Ue=Fe||(Fe={})).BASE_COMPONENT="baseComponent",Ue.BASE_RENDER="renderEngine",Ue.BASE_UI="baseUI",Ue.SPREADSHEET="spreadsheet",Ue.DOCUMENT="document",Ue.SLIDE="slide";const ze={[Se.OFFICE]:{[Te.ACCENT1]:"#4472C4",[Te.ACCENT2]:"#ED7D31",[Te.ACCENT3]:"#A5A5A5",[Te.ACCENT4]:"#70AD47",[Te.ACCENT5]:"#5B9BD5",[Te.ACCENT6]:"#70AD47",[Te.DARK1]:"#000000",[Te.DARK2]:"#44546A",[Te.LIGHT1]:"#FFFFFF",[Te.LIGHT2]:"#E7E6E6",[Te.HYPERLINK]:"#0563C1",[Te.FOLLOWED_HYPERLINK]:"#954F72"}},We={namedRangeId:"named-range-01",name:"namedRange01",range:{sheetId:"sheet-01",rangeData:Ae}};var Ve,Ge,Xe,Qe,Ke,Ze;(Ge=Ve||(Ve={}))[Ge.SLIDE=0]="SLIDE",Ge[Ge.MASTER=1]="MASTER",Ge[Ge.LAYOUT=2]="LAYOUT",Ge[Ge.HANDOUT_MASTER=3]="HANDOUT_MASTER",Ge[Ge.NOTES_MASTER=4]="NOTES_MASTER",(Qe=Xe||(Xe={}))[Qe.SHAPE=0]="SHAPE",Qe[Qe.IMAGE=1]="IMAGE",Qe[Qe.TEXT=2]="TEXT",Qe[Qe.SPREADSHEET=3]="SPREADSHEET",Qe[Qe.DOCUMENT=4]="DOCUMENT",Qe[Qe.SLIDE=5]="SLIDE",(Ze=Ke||(Ke={}))[Ze.RELATIVE_SLIDE_LINK_UNSPECIFIED=0]="RELATIVE_SLIDE_LINK_UNSPECIFIED",Ze[Ze.NEXT_SLIDE=1]="NEXT_SLIDE",Ze[Ze.PREVIOUS_SLIDE=2]="PREVIOUS_SLIDE",Ze[Ze.FIRST_SLIDE=3]="FIRST_SLIDE",Ze[Ze.LAST_SLIDE=4]="LAST_SLIDE";class $e{constructor(){this._colorType=Et.UNSUPPORTED,this._themeColors=Se.OFFICE,this._themeTint=0}asRgbColor(){return new er(this._rgbValue,this)}asThemeColor(){return new sr(this._themeValue,this._themeTint,this._themeColors,this)}build(){switch(this._colorType){case Et.THEME:return this.asThemeColor();case Et.RGB:return this.asRgbColor();case Et.UNSUPPORTED:throw Error("unsupported color type")}}setRgbColor(t){return this._colorType=Et.RGB,this._rgbValue=t,this}setThemeColors(t){this._colorType=Et.THEME,this._themeColors=t}setThemeTint(t){this._colorType=Et.THEME,this._themeTint=t}setThemeColor(t){return this._colorType=Et.THEME,this._themeValue=t,this}getColorType(){return this._colorType}}class qe{constructor(t){this._builder=t}static rgbColorToHexValue(t){return`#${((1<<24)+(t.getRed()<<16)+(t.getGreen()<<8)+t.getBlue()).toString(16).slice(1)}`}static hexValueToRgbColor(t){t?t.indexOf("#")>-1&&(t=t.substring(1)):t="#000000";let e=+`0x${t[0]}${t[1]}`,r=+`0x${t[2]}${t[3]}`,s=+`0x${t[4]}${t[5]}`;return(new $e).setRgbColor(`rgb(${e},${r},${s})`).asRgbColor()}static hexToRgbString(t){t=t.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,((t,e,r,s)=>e+e+r+r+s+s));const e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);let r=null;if(e){r=`rgba(${parseInt(e[1],16)},${parseInt(e[2],16)},${parseInt(e[3],16)})`}return r}asRgbColor(){return this._builder.asRgbColor()}asThemeColor(){return this._builder.asThemeColor()}getColorType(){return this._builder.getColorType()}clone(){return new qe(this._builder)}equals(t){return!1}}class Je{constructor(t){const e=t.getRed()/255,r=t.getGreen()/255,s=t.getBlue()/255,l=t.getAlpha()/255,n=Math.min(e,Math.min(r,s)),o=Math.max(e,Math.max(r,s)),i=o-n;if(o===n)return this._hue=0,this._saturation=0,void(this._lightness=o);this._lightness=(n+o)/2,this._lightness<.5?this._saturation=i/(o+n):this._saturation=i/(2-o-n),e===o&&(this._hue=(r-s)/i),r===o&&(this._hue=2+(s-e)/i),s===o&&(this._hue=4+(e-r)/i),this._hue*=60,this._hue<0&&(this._hue+=360),this._alpha=l}asRgbColor(){const t=new $e;if(0===this._saturation)return t.setRgbColor(`rgba(${255*this._lightness},${255*this._lightness},${255*this._lightness},${255*this._alpha})`),t.asRgbColor();let e;e=this._lightness<.5?this._lightness*(1+this._saturation):this._lightness+this._saturation-this._lightness*this._saturation;const r=2*this._lightness-e,s=this._hue/360,l=s+1/3,n=this.setColor(e,r,l),o=this.setColor(e,r,s),i=s-1/3,a=this.setColor(e,r,i);return t.setRgbColor(`rgba(${Math.round(255*n)},${Math.round(255*o)},${Math.round(255*a)},${255*this._alpha})`),t.asRgbColor()}getLightness(){return this._lightness}getHue(){return this._hue}getSaturation(){return this._saturation}getAlpha(){return this._alpha}setColor(t,e,r){let s;return r<0&&(r+=1),r>1&&(r-=1),s=6*r<1?e+6*(t-e)*r:2*r<1?t:3*r<2?e+(t-e)*(2/3-r)*6:e,s}setLightness(t){this._lightness=t}}const tr=class extends qe{constructor(t,e){super(e);let r=t.match(tr.RGBA_EXTRACT);if(r){const e=+r[1],s=+r[2],l=+r[3],n=+r[4];return this._cssString=t,this._red=e,this._green=s,this._blue=l,void(this._alpha=n)}if(r=t.match(tr.RGB_EXTRACT),r){const e=+r[1],s=+r[2],l=+r[3];return this._cssString=t,this._red=e,this._green=s,this._blue=l,void(this._alpha=1)}throw new Error("Invalid rgba or rgb color")}asHexString(){return qe.rgbColorToHexValue(this)}getRed(){let t=this._red+tr.RGB_COLOR_AMT;return t>255?t=255:t<0&&(t=0),t}getGreen(){let t=this._green+tr.RGB_COLOR_AMT;return t>255?t=255:t<0&&(t=0),t}getBlue(){let t=this._blue+tr.RGB_COLOR_AMT;return t>255?t=255:t<0&&(t=0),t}getAlpha(){return this._alpha}getColorType(){return Et.RGB}clone(){return new tr(this._cssString,this._builder)}asThemeColor(){throw new Error("rgb color not support to themeColor")}equals(t){return t instanceof tr&&(t._red===this._red&&t._blue===this._blue&&t._green===this._green&&t._alpha===this._alpha)}getCssString(){return this._cssString}};let er=tr;er.RGB_COLOR_AMT=0,er.RGBA_EXTRACT=new RegExp("\\s*rgba\\s*\\((\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d.\\d|\\d\\s*)\\)\\s*"),er.RGB_EXTRACT=new RegExp("\\s*rgb\\s*\\((\\s*\\d+\\s*),(\\s*\\d+\\s*),(\\s*\\d+\\s*)\\)\\s*");const rr=class extends qe{constructor(t,e,r,s){super(s),this._themeColorType=t,this._themeTint=e,this._themeColors=r}lumValue(t,e){if(null==t)return e;let r;return r=t<0?e*(1+t):e*(1-t)+(255-255*(1-t)),r}asRgbColor(){const t=ze[this._themeColors];if(null==t)throw new Error("not find themeColors type");const e=t.get(this._themeColorType);if(null==e)throw new Error("not find themeColors value");let r;if(rr._cacheThemeColor.has(this._themeColors)){if(r=rr._cacheThemeColor.get(this._themeColors),r.has(this._themeColorType))return r.get(this._themeColorType)}else r=new Map,rr._cacheThemeColor.set(this._themeColors,r);const s=new Je(qe.hexValueToRgbColor(e));s.setLightness(this.lumValue(this._themeTint,255*s.getLightness())/255);const l=s.asRgbColor();return r.set(this._themeColorType,l),l}clone(){return new rr(this._themeColorType,this._themeTint,this._themeColors,this._builder)}equals(t){return t instanceof rr&&t._themeColorType===this._themeColorType}getColorType(){return Et.THEME}getThemeColorType(){return this._themeColorType}};let sr=rr;sr._cacheThemeColor=new Map;class lr{constructor(t,e){this._workSheet=t,this._columnData=new u(e)}getColumnData(){return this._columnData}getColumnDatas(t,e){const r=new u;for(let s=t;s{if(!e||0===e.length)return;const r=e[0];try{r.getWorkBook()}catch(a){return}if(t.getContext().getWorkBook().getUnitId()!==r.getWorkBook().getUnitId())return;let s=e.find((t=>t instanceof en)),l=e.find((t=>t instanceof Jl)),n=e.find((t=>t instanceof an)),o=e.find((t=>t instanceof ln)),i=e.find((t=>t instanceof ql));if(s){const t=s.getDoActionData();if(t.sheetId===this._worksheet.getSheetId()){const e=B.deepClone(this._rectangleList);for(let r=0;rs.endRow||(t.rowIndex>=s.startRow&&t.rowIndex<=s.endRow||(s.startRow+=l),s.endRow+=l)}this.modifyMerge(this._rectangleList,e)}}if(l){const t=l.getDoActionData();if(t.sheetId===this._worksheet.getSheetId()){const e=B.deepClone(this._rectangleList);for(let r=0;rs.endColumn||(t.columnIndex>=s.startColumn&&t.columnIndex<=s.endColumn||(s.startColumn+=l),s.endColumn+=l)}this.modifyMerge(this._rectangleList,e)}}if(n){const t=n.getDoActionData();if(t.sheetId===this._worksheet.getSheetId()){const e=B.deepClone(this._rectangleList);for(let r=0;rs.endRow||(t.rowIndex>=s.startRow&&t.rowIndex<=s.endRow||(s.startRow-=l),s.endRow-=l)}this.modifyMerge(this._rectangleList,e)}}if(o){const t=o.getDoActionData();if(t.sheetId===this._worksheet.getSheetId()){const e=B.deepClone(this._rectangleList);for(let r=0;rs.endColumn||(t.columnIndex>=s.startColumn&&t.columnIndex<=s.endColumn||(s.startColumn-=l),s.endColumn-=l)}this.modifyMerge(this._rectangleList,e)}}if(i){const t=i.getDoActionData();if(t.sheetId===this._worksheet.getSheetId()){const e=B.deepClone(this._rectangleList),r=this.getByRowColumn(t.rangeData.startRow,t.rangeData.endRow,t.rangeData.startColumn,t.rangeData.endColumn);if(r&&r.forEach((t=>{const r=new ms(t);for(let s=0;s=t.rangeData.startRow){if(r.endColumnt.rangeData.endColumn)continue;if(!(r.startColumn>=t.rangeData.startColumn&&r.endColumn<=t.rangeData.endColumn))return;{const e=t.rangeData.endRow-t.rangeData.startRow;r.startRow-=e,r.endRow-=e}}}else for(let s=0;st.rangeData.endColumn){if(r.endRowt.rangeData.endRow)continue;if(!(r.startRow>=t.rangeData.startRow&&r.endRow<=t.rangeData.endRow))return;{const e=t.rangeData.endColumn-t.rangeData.startColumn;r.startColumn-=e,r.endColumn-=e}}}this.modifyMerge(this._rectangleList,e)}}}))}getMergeData(){return this._rectangleList}getByRowColumn(...t){const{_rectangleList:e}=this;let r;As.checkup(t,As.NUMBER_TYPE,As.NUMBER_TYPE,As.NUMBER_TYPE,As.NUMBER_TYPE)?r=new ms(t[0],t[2],t[1],t[3]):As.checkup(t,As.NUMBER_TYPE,As.NUMBER_TYPE)&&(r=new ms(t[0],t[1],t[0],t[1]));const s=[];for(let l=0;l=e?t:""+Array(e+1-s.length).join(r)+t},p={s:m,z:function(t){var e=-t.utcOffset(),r=Math.abs(e),s=Math.floor(r/60),l=r%60;return(e<=0?"+":"-")+m(s,2,"0")+":"+m(l,2,"0")},m:function t(e,r){if(e.date()1)return t(o[0])}else{var i=e.name;B[i]=e,l=i}return!s&&l&&(_=l),l||!s&&_},T=function(t,e){if(C(t))return t.clone();var r="object"==typeof e?e:{};return r.date=t,r.args=arguments,new S(r)},y=p;y.l=w,y.i=C,y.w=function(t,e){return T(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var S=function(){function v(t){this.$L=w(t.locale,null,!0),this.parse(t)}var m=v.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,r=t.utc;if(null===e)return new Date(NaN);if(y.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var s=e.match(u);if(s){var l=s[2]-1||0,n=(s[7]||"0").substring(0,3);return r?new Date(Date.UTC(s[1],l,s[3]||1,s[4]||0,s[5]||0,s[6]||0,n)):new Date(s[1],l,s[3]||1,s[4]||0,s[5]||0,s[6]||0,n)}}return new Date(e)}(t),this.$x=t.x||{},this.init()},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},m.$utils=function(){return y},m.isValid=function(){return!(this.$d.toString()===d)},m.isSame=function(t,e){var r=T(t);return this.startOf(e)<=r&&r<=this.endOf(e)},m.isAfter=function(t,e){return T(t)=m&&!n||"t"===n?(v+=d.abbreviations.trillion,e/=m):i=p&&!n||"b"===n?(v+=d.abbreviations.billion,e/=p):i=_&&!n||"m"===n?(v+=d.abbreviations.million,e/=_):(i<_&&i>=1e3&&!n||"k"===n)&&(v+=d.abbreviations.thousand,e/=1e3)),t._.includes(r,"[.]")&&(f=!0,r=r.replace("[.]",".")),a=e.toString().split(".")[0],g=r.split(".")[1],b=r.indexOf(","),l=(r.split(".")[0].split(",")[0].match(/0/g)||[]).length,g?(t._.includes(g,"[")?(g=(g=g.replace("]","")).split("["),B=t._.toFixed(e,g[0].length+g[1].length,s,g[1].length)):B=t._.toFixed(e,g.length,s),a=B.split(".")[0],B=t._.includes(B,".")?d.delimiters.decimal+B.split(".")[1]:"",f&&0===Number(B.slice(1))&&(B="")):a=t._.toFixed(e,0,s),v&&!n&&Number(a)>=1e3&&v!==d.abbreviations.trillion)switch(a=String(Number(a)/1e3),v){case d.abbreviations.thousand:v=d.abbreviations.million;break;case d.abbreviations.million:v=d.abbreviations.billion;break;case d.abbreviations.billion:v=d.abbreviations.trillion}if(t._.includes(a,"-")&&(a=a.slice(1),C=!0),a.length0;w--)a="0"+a;return b>-1&&(a=a.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1"+d.delimiters.thousands)),0===r.indexOf(".")&&(a=""),h=a+B+(v||""),u?h=(u&&C?"(":"")+h+(u&&C?")":""):c>=0?h=0===c?(C?"-":"+")+h:h+(C?"-":"+"):C&&(h="-"+h),h},stringToNumber:function(t){var e,r,s,l=o[a.currentLocale],n=t,i={thousand:3,million:6,billion:9,trillion:12};if(a.zeroFormat&&t===a.zeroFormat)r=0;else if(a.nullFormat&&t===a.nullFormat||!t.replace(/[^0-9]+/g,"").length)r=null;else{for(e in r=1,"."!==l.delimiters.decimal&&(t=t.replace(/\./g,"").replace(l.delimiters.decimal,".")),i)if(s=new RegExp("[^a-zA-Z]"+l.abbreviations[e]+"(?:\\)|(\\"+l.currency.symbol+")?(?:\\))?)?$"),n.match(s)){r*=Math.pow(10,i[e]);break}r*=(t.split("-").length+Math.min(t.split("(").length-1,t.split(")").length-1))%2?1:-1,t=t.replace(/[^0-9\.]+/g,""),r*=Number(t)}return r},isNaN:function(t){return"number"==typeof t&&isNaN(t)},includes:function(t,e){return-1!==t.indexOf(e)},insert:function(t,e,r){return t.slice(0,r)+e+t.slice(r)},reduce:function(t,e){if(null===this)throw new TypeError("Array.prototype.reduce called on null or undefined");if("function"!=typeof e)throw new TypeError(e+" is not a function");var r,s=Object(t),l=s.length>>>0,n=0;if(3===arguments.length)r=arguments[2];else{for(;n=l)throw new TypeError("Reduce of empty array with no initial value");r=s[n++]}for(;ns?t:s}),1)},toFixed:function(t,e,r,s){var l,n,o,i,a=t.toString().split("."),g=e-(s||0);return l=2===a.length?Math.min(Math.max(a[1].length,g),e):g,o=Math.pow(10,l),i=(r(t+"e+"+l)/o).toFixed(l),s>e-l&&(n=new RegExp("\\.?0{1,"+(s-(e-l))+"}$"),i=i.replace(n,"")),i}},t.options=a,t.formats=n,t.locales=o,t.locale=function(t){return t&&(a.currentLocale=t.toLowerCase()),a.currentLocale},t.localeData=function(t){if(!t)return o[a.currentLocale];if(t=t.toLowerCase(),!o[t])throw new Error("Unknown locale : "+t);return o[t]},t.reset=function(){for(var t in i)a[t]=i[t]},t.zeroFormat=function(t){a.zeroFormat="string"==typeof t?t:null},t.nullFormat=function(t){a.nullFormat="string"==typeof t?t:null},t.defaultFormat=function(t){a.defaultFormat="string"==typeof t?t:"0.0"},t.register=function(t,e,r){if(e=e.toLowerCase(),this[t+"s"][e])throw new TypeError(e+" "+t+" already registered.");return this[t+"s"][e]=r,r},t.validate=function(e,r){var s,l,n,o,i,a,g,c;if("string"!=typeof e&&(e+="",console.warn&&console.warn("Numeral.js: Value is not string. It has been co-erced to: ",e)),(e=e.trim()).match(/^\d+$/))return!0;if(""===e)return!1;try{g=t.localeData(r)}catch(b){g=t.localeData(t.locale())}return n=g.currency.symbol,i=g.abbreviations,s=g.delimiters.decimal,l="."===g.delimiters.thousands?"\\.":g.delimiters.thousands,!(null!==(c=e.match(/^[^\d]+/))&&(e=e.substr(1),c[0]!==n)||null!==(c=e.match(/[^\d]+$/))&&(e=e.slice(0,-1),c[0]!==i.thousand&&c[0]!==i.million&&c[0]!==i.billion&&c[0]!==i.trillion)||(a=new RegExp(l+"{2}"),e.match(/[^\d.,]/g)||(o=e.split(s)).length>2||(o.length<2?!o[0].match(/^\d+.*\d$/)||o[0].match(a):1===o[0].length?!o[0].match(/^\d+$/)||o[0].match(a)||!o[1].match(/^\d+$/):!o[0].match(/^\d+.*\d$/)||o[0].match(a)||!o[1].match(/^\d+$/))))},t.fn=g.prototype={clone:function(){return t(this)},format:function(e,r){var s,l,o,i=this._value,g=e||a.defaultFormat;if(r=r||Math.round,0===i&&null!==a.zeroFormat)l=a.zeroFormat;else if(null===i&&null!==a.nullFormat)l=a.nullFormat;else{for(s in n)if(g.match(n[s].regexps.format)){o=n[s].format;break}l=(o=o||t._.numberToFormat)(i,g,r)}return l},value:function(){return this._value},input:function(){return this._input},set:function(t){return this._value=Number(t),this},add:function(t){var r=e.correctionFactor.call(null,this._value,t);return this._value=e.reduce([this._value,t],(function(t,e,s,l){return t+Math.round(r*e)}),0)/r,this},subtract:function(t){var r=e.correctionFactor.call(null,this._value,t);return this._value=e.reduce([t],(function(t,e,s,l){return t-Math.round(r*e)}),Math.round(this._value*r))/r,this},multiply:function(t){return this._value=e.reduce([this._value,t],(function(t,r,s,l){var n=e.correctionFactor(t,r);return Math.round(t*n)*Math.round(r*n)/Math.round(n*n)}),1),this},divide:function(t){return this._value=e.reduce([this._value,t],(function(t,r,s,l){var n=e.correctionFactor(t,r);return Math.round(t*n)/Math.round(r*n)})),this},difference:function(e){return Math.abs(t(this._value).subtract(e).value())}},t.register("locale","en",{delimiters:{thousands:",",decimal:"."},abbreviations:{thousand:"k",million:"m",billion:"b",trillion:"t"},ordinal:function(t){var e=t%10;return 1==~~(t%100/10)?"th":1===e?"st":2===e?"nd":3===e?"rd":"th"},currency:{symbol:"$"}}),t.register("format","bps",{regexps:{format:/(BPS)/,unformat:/(BPS)/},format:function(e,r,s){var l,n=t._.includes(r," BPS")?" ":"";return e*=1e4,r=r.replace(/\s?BPS/,""),l=t._.numberToFormat(e,r,s),t._.includes(l,")")?((l=l.split("")).splice(-1,0,n+"BPS"),l=l.join("")):l=l+n+"BPS",l},unformat:function(e){return+(1e-4*t._.stringToNumber(e)).toFixed(15)}}),s={base:1024,suffixes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]},l="("+(l=(r={base:1e3,suffixes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]}).suffixes.concat(s.suffixes.filter((function(t){return r.suffixes.indexOf(t)<0}))).join("|")).replace("B","B(?!PS)")+")",t.register("format","bytes",{regexps:{format:/([0\s]i?b)/,unformat:new RegExp(l)},format:function(e,l,n){var o,i,a,g=t._.includes(l,"ib")?s:r,c=t._.includes(l," b")||t._.includes(l," ib")?" ":"";for(l=l.replace(/\s?i?b/,""),o=0;o<=g.suffixes.length;o++)if(i=Math.pow(g.base,o),a=Math.pow(g.base,o+1),null===e||0===e||e>=i&&e0&&(e/=i);break}return t._.numberToFormat(e,l,n)+c},unformat:function(e){var l,n,o=t._.stringToNumber(e);if(o){for(l=r.suffixes.length-1;l>=0;l--){if(t._.includes(e,r.suffixes[l])){n=Math.pow(r.base,l);break}if(t._.includes(e,s.suffixes[l])){n=Math.pow(s.base,l);break}}o*=n||1}return o}}),t.register("format","currency",{regexps:{format:/(\$)/},format:function(e,r,s){var l,n,o=t.locales[t.options.currentLocale],i={before:r.match(/^([\+|\-|\(|\s|\$]*)/)[0],after:r.match(/([\+|\-|\)|\s|\$]*)$/)[0]};for(r=r.replace(/\s?\$\s?/,""),l=t._.numberToFormat(e,r,s),e>=0?(i.before=i.before.replace(/[\-\(]/,""),i.after=i.after.replace(/[\-\)]/,"")):e<0&&!t._.includes(i.before,"-")&&!t._.includes(i.before,"(")&&(i.before="-"+i.before),n=0;n=0;n--)switch(i.after[n]){case"$":l=n===i.after.length-1?l+o.currency.symbol:t._.insert(l,o.currency.symbol,-(i.after.length-(1+n)));break;case" ":l=n===i.after.length-1?l+" ":t._.insert(l," ",-(i.after.length-(1+n)+o.currency.symbol.length-1))}return l}}),t.register("format","exponential",{regexps:{format:/(e\+|e-)/,unformat:/(e\+|e-)/},format:function(e,r,s){var l=("number"!=typeof e||t._.isNaN(e)?"0e+0":e.toExponential()).split("e");return r=r.replace(/e[\+|\-]{1}0/,""),t._.numberToFormat(Number(l[0]),r,s)+"e"+l[1]},unformat:function(e){var r=t._.includes(e,"e+")?e.split("e+"):e.split("e-"),s=Number(r[0]),l=Number(r[1]);return l=t._.includes(e,"e-")?l*=-1:l,t._.reduce([s,Math.pow(10,l)],(function(e,r,s,l){var n=t._.correctionFactor(e,r);return e*n*(r*n)/(n*n)}),1)}}),t.register("format","ordinal",{regexps:{format:/(o)/},format:function(e,r,s){var l=t.locales[t.options.currentLocale],n=t._.includes(r," o")?" ":"";return r=r.replace(/\s?o/,""),n+=l.ordinal(e),t._.numberToFormat(e,r,s)+n}}),t.register("format","percentage",{regexps:{format:/(%)/,unformat:/(%)/},format:function(e,r,s){var l,n=t._.includes(r," %")?" ":"";return t.options.scalePercentBy100&&(e*=100),r=r.replace(/\s?\%/,""),l=t._.numberToFormat(e,r,s),t._.includes(l,")")?((l=l.split("")).splice(-1,0,n+"%"),l=l.join("")):l=l+n+"%",l},unformat:function(e){var r=t._.stringToNumber(e);return t.options.scalePercentBy100?.01*r:r}}),t.register("format","time",{regexps:{format:/(:)/,unformat:/(:)/},format:function(t,e,r){var s=Math.floor(t/60/60),l=Math.floor((t-60*s*60)/60),n=Math.round(t-60*s*60-60*l);return s+":"+(l<10?"0"+l:l)+":"+(n<10?"0"+n:n)},unformat:function(t){var e=t.split(":"),r=0;return 3===e.length?(r+=60*Number(e[0])*60,r+=60*Number(e[1]),r+=Number(e[2])):2===e.length&&(r+=60*Number(e[0]),r+=Number(e[1])),Number(r)}}),t},t.exports?t.exports=r():e.numeral=r()}(cr);var br=cr.exports;const hr={v:"#VALUE!",n:"#NAME?",na:"#N/A",r:"#REF!",d:"#DIV/0!",nm:"#NUM!",nl:"#NULL!",sp:"#SPILL!"};function dr(t){return null!==t&&""!==t.toString().replace(/\s/g,"")&&("boolean"!=typeof t&&!Number.isNaN(t))}let ur=new Date("2017-02-19T19:06:09.000Z");Number.isNaN(ur.getFullYear())&&(ur=new Date("2/19/17"));const fr=2017===ur.getFullYear();const vr=new Date(1900,2,1,0,0,0);function mr(t,e){let r=Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds());const s=Date.UTC(1899,11,31,0,0,0);return e?r-=1262304e5:t>=vr&&(r+=864e5),(r-s)/864e5}function pr(t){let e=null,r={},s=t;if(null===t)return null;if(/^-?[0-9]{1,}[,][0-9]{3}(.[0-9]{1,2})?$/.test(t)){e=t,s=Number(t.split(".")[0].replace(",",""));let l="#,##0";if(t.split(".")[1]){l="#,##0.";for(let e=0;e0&&(Math.abs(parseFloat(t))>=1e11||Math.abs(parseFloat(t))<1e-9)){s=br(t).value();const l=s.toExponential();if(l.indexOf(".")>-1){let t=l.split(".")[1].split("e")[0].length;t>5&&(t=5),r={fa:`#0.${new Array(t+1).join("0")}E+00`,t:"n"}}else r={fa:"#0.E+00",t:"n"};e=_r.format(r.fa,s)}else if(t.toString().indexOf("%")>-1){const l=t.toString().indexOf("%");let n=t.toString().substr(0,l);const o=n.replace(/,/g,"");if(l===t.toString().length-1&&dr(o))if(n.indexOf(".")>-1)if(n.indexOf(".")===n.lastIndexOf(".")){const l=n.split(".")[0];let o=n.split(".")[1].length;if(o>9&&(o=9),l.indexOf(",")>-1){let n=!0,i=l.split(",");for(let t=1;t-1){let l=!0,o=n.split(",");for(let t=1;t-1)if(t.toString().indexOf(".")===t.toString().lastIndexOf(".")){const l=t.toString().split(".")[0];let n=t.toString().split(".")[1],o=n.length;if(o>9&&(o=9),l.indexOf(",")>-1){let n=!0,i=l.split(",");for(let t=1;t12)return!1;if(s>31)return!1;if(2===r){if(29===new Date(e,1,29).getDate()&&s>29)return!1;if(29!==new Date(e,1,29).getDate()&&s>28)return!1}return!0}(l)||!(t.toString().indexOf(".")>-1||t.toString().indexOf(":")>-1||t.toString().length<16)?(e=t,r.fa="General",r.t="g"):(s=mr(function(t,e){const r=new Date(t);if(fr)return e>0?r.setTime(r.getTime()+60*r.getTimezoneOffset()*1e3):e<0&&r.setTime(r.getTime()-60*r.getTimezoneOffset()*1e3),r;if(t instanceof Date)return t;if(1917===ur.getFullYear()&&!Number.isNaN(r.getFullYear())){const e=r.getFullYear();return t.indexOf(`${e}`)>-1||r.setFullYear(r.getFullYear()+100),r}const s=t.match(/\d+/g)||["2017","2","19","0","0","0"];let l=new Date(+s[0],+s[1]-1,+s[2],+s[3]||0,+s[4]||0,+s[5]||0);return t.indexOf("Z")>-1&&(l=new Date(l.getTime()-60*l.getTimezoneOffset()*1e3)),l}(t.toString().replace(/-/g,"/"))),s.toString().indexOf(".")>-1?t.toString().length>18?r.fa="yyyy-MM-dd hh:mm:ss":t.toString().length>11?r.fa="yyyy-MM-dd hh:mm":r.fa="yyyy-MM-dd":r.fa="yyyy-MM-dd",r.t="d",e=_r.format(r.fa,s));var l;return[e,r,s]}const _r={format(t,e){}},Br=(t,e)=>{};class Cr{static getApplyData(t,e,r,s,l){const n=this,o=[];n.applyType=s,n.direction=l;const i=Math.floor(r/e),a=r%e,g=t.number,c=[];if(g)for(let T=0;T0)for(let t=0;t0)for(let t=0;t0)for(let t=0;t0)for(let t=0;t0)for(let t=0;t0)for(let t=0;t0)for(let t=0;t0;){const o=t%1e4;n&&(l=e.chnNumChar2[0]+l),s=e.SectionToChinese(o),s+=0!==o?e.chnUnitSection[r]:e.chnUnitSection[0],l=s+l,n=o<1e3&&o>0,t=Math.floor(t/1e4),r++}return l}static SectionToChinese(t){const e=this;let r="",s="",l=0,n=!0;for(;t>0;){const o=t%10;0===o?n||(n=!0,s=e.chnNumChar2[o]+s):(n=!1,r=e.chnNumChar2[o],r+=e.chnUnitChar[l],s=r+s),l++,t=Math.floor(t/10)}return s}static getLenS(t,e){let r=0;for(let s=0;s0&&n.ChineseToNumber(t[e].m)<7?l.push(n.ChineseToNumber(t[e].m)+7*i):l.push(n.ChineseToNumber(t[e].m));if(r!==Pt.TOP&&r!==Pt.LEFT||(t.reverse(),l.reverse()),n.isEqualDiff(l))if(s||l[l.length-1]<6&&l[0]>0||l[0]<6&&l[l.length-1]>0){const r=l[1]-l[0];o=n.FillChnWeek(t,e,r)}else{const r=l[1]-l[0];o=n.FillChnNumber(t,e,r)}else o=n.FillCopy(t,e)}else if("chnWeek2"===l)if(1===t.length){let s=0;r===Pt.BOTTOM||r===Pt.RIGHT?s=1:r!==Pt.TOP&&r!==Pt.LEFT||(s=-1),o=n.FillChnWeek2(t,e,s)}else{const s=[];let l=0;for(let e=0;e7){let s=0;r===Pt.BOTTOM||r===Pt.RIGHT?s=1:r!==Pt.TOP&&r!==Pt.LEFT||(s=-1,t.reverse());let l=0;for(let r=1;r<=e;r++){const e=(r-1)%t.length,n=__spreadValues({},t[e]),i=Math.ceil(r/t.length);0===e&&(l=gr(n.m).add(s*i,"months").diff(gr(n.m),"days"));const a=gr(n.m).add(l,"days").day();let g;g=0===a?gr(n.m).add(l,"days").subtract(2,"days").format("YYYY-MM-DD"):6===a?gr(n.m).add(l,"days").subtract(1,"days").format("YYYY-MM-DD"):gr(n.m).add(l,"days").format("YYYY-MM-DD"),n.m=g,n.v=pr(g)[2],o.push(n)}}else{let s=0;r===Pt.BOTTOM||r===Pt.RIGHT?s=7:r!==Pt.TOP&&r!==Pt.LEFT||(s=-7,t.reverse());let l=0;for(let r=1;r<=e;r++){const e=(r-1)%t.length,n=__spreadValues({},t[e]),i=Math.ceil(r/t.length);0===e&&(l=gr(n.m).add(s*i,"days").diff(gr(n.m),"days"));const a=gr(n.m).add(l,"days").day();let g;g=0===a?gr(n.m).add(l,"days").subtract(2,"days").format("YYYY-MM-DD"):6===a?gr(n.m).add(l,"days").subtract(1,"days").format("YYYY-MM-DD"):gr(n.m).add(l,"days").format("YYYY-MM-DD"),n.m=g,n.v=pr(g)[2],o.push(n)}}else{const s=n.judgeDate(t);if(s[0]&&s[3]){r!==Pt.TOP&&r!==Pt.LEFT||t.reverse();const s=gr(t[1].m).diff(gr(t[0].m),"months");for(let r=1;r<=e;r++){const e=(r-1)%t.length,l=__spreadValues({},t[e]),n=gr(t[t.length-1].m).add(s*r,"months").day();let i;i=0===n?gr(t[t.length-1].m).add(s*r,"months").subtract(2,"days").format("YYYY-MM-DD"):6===n?gr(t[t.length-1].m).add(s*r,"months").subtract(1,"days").format("YYYY-MM-DD"):gr(t[t.length-1].m).add(s*r,"months").format("YYYY-MM-DD"),l.m=i,l.v=pr(i)[2],o.push(l)}}else if(!s[0]&&s[2])if(Math.abs(gr(t[1].m).diff(gr(t[0].m)))>7){let s=0;r===Pt.BOTTOM||r===Pt.RIGHT?s=1:r!==Pt.TOP&&r!==Pt.LEFT||(s=-1,t.reverse());let l=0;for(let r=1;r<=e;r++){const e=(r-1)%t.length,n=__spreadValues({},t[e]),i=Math.ceil(r/t.length);0===e&&(l=gr(n.m).add(s*i,"months").diff(gr(n.m),"days"));const a=gr(n.m).add(l,"days").day();let g;g=0===a?gr(n.m).add(l,"days").subtract(2,"days").format("YYYY-MM-DD"):6===a?gr(n.m).add(l,"days").subtract(1,"days").format("YYYY-MM-DD"):gr(n.m).add(l,"days").format("YYYY-MM-DD"),n.m=g,n.v=pr(g)[2],o.push(n)}}else{let s=0;r===Pt.BOTTOM||r===Pt.RIGHT?s=7:r!==Pt.TOP&&r!==Pt.LEFT||(s=-7,t.reverse());let l=0;for(let r=1;r<=e;r++){const e=(r-1)%t.length,n=__spreadValues({},t[e]),i=Math.ceil(r/t.length);0===e&&(l=gr(n.m).add(s*i,"days").diff(gr(n.m),"days"));const a=gr(n.m).add(l,"days").day();let g;g=0===a?gr(n.m).add(l,"days").subtract(2,"days").format("YYYY-MM-DD"):6===a?gr(n.m).add(l,"days").subtract(1,"days").format("YYYY-MM-DD"):gr(n.m).add(l,"days").format("YYYY-MM-DD"),n.m=g,n.v=pr(g)[2],o.push(n)}}else r!==Pt.TOP&&r!==Pt.LEFT||t.reverse(),o=n.FillCopy(t,e)}else if("6"===s)if(1===t.length){let s=0;r===Pt.BOTTOM||r===Pt.RIGHT?s=1:r!==Pt.TOP&&r!==Pt.LEFT||(s=-1),o=n.FillMonths(t,e,s)}else if(2===t.length)if(gr(t[1].m).date()===gr(t[0].m).date()&&0!==gr(t[1].m).diff(gr(t[0].m),"months")){r!==Pt.TOP&&r!==Pt.LEFT||t.reverse();const s=gr(t[1].m).diff(gr(t[0].m),"months");o=n.FillMonths(t,e,s)}else{let s=0;r===Pt.BOTTOM||r===Pt.RIGHT?s=1:r!==Pt.TOP&&r!==Pt.LEFT||(s=-1,t.reverse());let l=0;for(let r=1;r<=e;r++){const e=(r-1)%t.length,n=__spreadValues({},t[e]),i=Math.ceil(r/t.length);0===e&&(l=gr(n.m).add(s*i,"months").diff(gr(n.m),"days"));const a=gr(n.m).add(l,"days").format("YYYY-MM-DD");n.m=a,n.v=pr(a)[2],o.push(n)}}else{const s=n.judgeDate(t);if(s[0]&&s[3]){r!==Pt.TOP&&r!==Pt.LEFT||t.reverse();const s=gr(t[1].m).diff(gr(t[0].m),"months");o=n.FillMonths(t,e,s)}else if(!s[0]&&s[2]){let s=0;r===Pt.BOTTOM||r===Pt.RIGHT?s=1:r!==Pt.TOP&&r!==Pt.LEFT||(s=-1,t.reverse());let l=0;for(let r=1;r<=e;r++){const e=(r-1)%t.length,n=__spreadValues({},t[e]),i=Math.ceil(r/t.length);0===e&&(l=gr(n.m).add(s*i,"months").diff(gr(n.m),"days"));const a=gr(n.m).add(l,"days").format("YYYY-MM-DD");n.m=a,n.v=pr(a)[2],o.push(n)}}else r!==Pt.TOP&&r!==Pt.LEFT||t.reverse(),o=n.FillCopy(t,e)}else if("7"===s)if(1===t.length){let s=0;r===Pt.BOTTOM||r===Pt.RIGHT?s=1:r!==Pt.TOP&&r!==Pt.LEFT||(s=-1),o=n.FillYears(t,e,s)}else if(2===t.length)if(gr(t[1].m).date()===gr(t[0].m).date()&&gr(t[1].m).month()===gr(t[0].m).month()&&0!==gr(t[1].m).diff(gr(t[0].m),"years")){r!==Pt.TOP&&r!==Pt.LEFT||t.reverse();const s=gr(t[1].m).diff(gr(t[0].m),"years");o=n.FillYears(t,e,s)}else{let s=0;r===Pt.BOTTOM||r===Pt.RIGHT?s=1:r!==Pt.TOP&&r!==Pt.LEFT||(s=-1,t.reverse());let l=0;for(let r=1;r<=e;r++){const e=(r-1)%t.length,n=__spreadValues({},t[e]),i=Math.ceil(r/t.length);0===e&&(l=gr(n.m).add(s*i,"years").diff(gr(n.m),"days"));const a=gr(n.m).add(l,"days").format("YYYY-MM-DD");n.m=a,n.v=pr(a)[2],o.push(n)}}else{const s=n.judgeDate(t);if(s[0]&&s[1]&&s[4]){r!==Pt.TOP&&r!==Pt.LEFT||t.reverse();const s=gr(t[1].m).diff(gr(t[0].m),"years");o=n.FillYears(t,e,s)}else if(s[0]&&s[3]||s[2]){let s=0;r===Pt.BOTTOM||r===Pt.RIGHT?s=1:r!==Pt.TOP&&r!==Pt.LEFT||(s=-1,t.reverse());let l=0;for(let r=1;r<=e;r++){const e=(r-1)%t.length,n=__spreadValues({},t[e]),i=Math.ceil(r/t.length);0===e&&(l=gr(n.m).add(s*i,"years").diff(gr(n.m),"days"));const a=gr(n.m).add(l,"days").format("YYYY-MM-DD");n.m=a,n.v=pr(a)[2],o.push(n)}}else r!==Pt.TOP&&r!==Pt.LEFT||t.reverse(),o=n.FillCopy(t,e)}else if("8"===s)if(1===t.length){let s=0;r===Pt.BOTTOM||r===Pt.RIGHT?s=1:r!==Pt.TOP&&r!==Pt.LEFT||(s=-1),o=n.FillChnNumber(t,e,s)}else{const s=[];for(let e=0;e0){for(let e=1;e<=l;e++)for(let l=0;l2&&s.isEqualRatio(n))for(let o=1;o<=e;o++){const e=(o-1)%t.length,s=__spreadValues({},t[e]);let n;r===Pt.BOTTOM||r===Pt.RIGHT?n=Number(t[t.length-1].v)*(Number(t[1].v)/Number(t[0].v))**o:r!==Pt.TOP&&r!==Pt.LEFT||(n=Number(t[0].v)/(Number(t[1].v)/Number(t[0].v))**o),s.v=n,s.m=n,l.push(s)}else{const o=s.getXArr(t.length);for(let i=1;i<=e;i++){const e=(i-1)%t.length,a=__spreadValues({},t[e]);let g;r===Pt.BOTTOM||r===Pt.RIGHT?g=s.forecast(t.length+i,n,o):r!==Pt.TOP&&r!==Pt.LEFT||(g=s.forecast(1-i,n,o)),a.v=g,a.m=g,l.push(a)}}return l}static FillExtendNumber(t,e,r){const s=[],l=/0|([1-9]+[0-9]*)/g;for(let n=1;n<=e;n++){const e=(n-1)%t.length,o=__spreadValues({},t[e]),i=t[t.length-1].m,a=i.match(l),g=a[a.length-1],c=Math.abs(Number(g)+r*n),b=i.lastIndexOf(g),h=i.substr(0,b)+c.toString()+i.substr(b+g.length);o.v=h,o.m=h,s.push(o)}return s}static FillOnlyFormat(t,e){const r=[];for(let s=1;s<=e;s++){const e=(s-1)%t.length,l=__spreadValues({},t[e]);delete l.f,delete l.m,delete l.v,r.push(l)}return r}static FillWithoutFormat(t){const e=[];for(let r=0;r{this._rangeList.push(this._context.getWorkBook().transformRangeType(t).rangeData)})),-1===this._rangeList[0].startRow&&console.error("Invalid range,default set startRow -1")}getRangeList(){return this._rangeList}activate(){return-1===this._rangeList[0].startRow?(console.error("Invalid range,default set startRow -1"),this):(this._worksheet.getSelection().setSelection({selection:this._rangeList}),this)}setValue(t){let{_rangeList:e,_context:r,_commandManager:s,_worksheet:l}=this;const n=e.map((e=>{let{startRow:r,startColumn:s,endRow:n,endColumn:o}=e,i=new v;for(let l=r;l<=n;l++)for(let e=s;e<=o;e++)i.setValue(r,s,{m:`${t}`,v:t});return{sheetId:l.getSheetId(),actionName:Ql.NAME,cellValue:i.getData()}}));let o=new Us({WorkBookUnit:r.getWorkBook()},...n);return s.invoke(o),this}clear(...t){const{_context:e,_worksheet:r,_commandManager:s,_rangeList:l}=this;let n={formatOnly:!0,contentsOnly:!0};Is.checkup(t,Is.OBJECT_TYPE)&&(n=t[0]);const o=l.map((t=>({sheetId:r.getSheetId(),actionName:Kl.NAME,options:n,rangeData:t})));let i=new Us({WorkBookUnit:e.getWorkBook()},...o);return s.invoke(i),this}clearFormat(){return this.clear({formatOnly:!0})}clearContent(){return this.clear({contentsOnly:!0})}clearNote(){return this.clear({commentsOnly:!0})}setBackground(t){let{_rangeList:e,_context:r,_commandManager:s,_worksheet:l}=this;const n=e.map((e=>{let{startRow:r,startColumn:s,endRow:n,endColumn:o}=e;const i={bg:{rgb:t}},a=B.fillObjectMatrix(n-r+1,o-s+1,i);return{sheetId:l.getSheetId(),actionName:mt.SET_RANGE_STYLE_ACTION,value:a,rangeData:e}}));let o=new Us({WorkBookUnit:r.getWorkBook()},...n);return s.invoke(o),this}setBackgroundRGB(t,e,r){const s=`RGB(${t},${e},${r})`;let{_rangeList:l,_context:n,_commandManager:o,_worksheet:i}=this;const a=l.map((t=>{let{startRow:e,startColumn:r,endRow:l,endColumn:n}=t;const o={bg:{rgb:s}},a=B.fillObjectMatrix(l-e+1,n-r+1,o);return{sheetId:i.getSheetId(),actionName:mt.SET_RANGE_STYLE_ACTION,value:a,rangeData:t}}));let g=new Us({WorkBookUnit:n.getWorkBook()},...a);return o.invoke(g),this}setFontColor(t){let{_rangeList:e,_context:r,_commandManager:s,_worksheet:l}=this;const n=e.map((e=>{let{startRow:r,startColumn:s,endRow:n,endColumn:o}=e;const i={cl:{rgb:t}},a=B.fillObjectMatrix(n-r+1,o-s+1,i);return{sheetId:l.getSheetId(),actionName:mt.SET_RANGE_STYLE_ACTION,value:a,rangeData:e}}));let o=new Us({WorkBookUnit:r.getWorkBook()},...n);return s.invoke(o),this}setFontFamily(t){return this._setStyle(t,"ff")}setUnderline(t){const e={s:t?_e.TRUE:_e.FALSE};return this._setStyle(e,"ul")}setOverline(t){const e={s:t?_e.TRUE:_e.FALSE};return this._setStyle(e,"ol")}setStrikeThrough(t){const e={s:t?_e.TRUE:_e.FALSE};return this._setStyle(e,"st")}setFontSize(t){return this._setStyle(t,"fs")}setFontStyle(t){const e=t?_e.TRUE:_e.FALSE;return this._setStyle(e,"it")}setFontWeight(t){const e=t?_e.TRUE:_e.FALSE;return this._setStyle(e,"bl")}setHorizontalAlignment(t){return this._setStyle(t,"ht")}setTextDirection(t){return this._setStyle(t,"td")}setTextRotation(t){let{_rangeList:e,_context:r,_commandManager:s,_worksheet:l}=this;const n=e.map((e=>{let{startRow:r,startColumn:s,endRow:n,endColumn:o}=e;const i={tr:{v:0,a:Number(t)}},a=B.fillObjectMatrix(n-r+1,o-s+1,i);return{sheetId:l.getSheetId(),actionName:mt.SET_RANGE_STYLE_ACTION,value:a,rangeData:e}}));let o=new Us({WorkBookUnit:r.getWorkBook()},...n);return s.invoke(o),this}setVerticalAlignment(t){return this._setStyle(t,"vt"),this}setVerticalText(t){let{_rangeList:e,_context:r,_commandManager:s,_worksheet:l}=this;const n=e.map((e=>{let{startRow:r,startColumn:s,endRow:n,endColumn:o}=e;const i={tr:{v:t,a:0}},a=B.fillObjectMatrix(n-r+1,o-s+1,i);return{sheetId:l.getSheetId(),actionName:mt.SET_RANGE_STYLE_ACTION,value:a,rangeData:e}}));let o=new Us({WorkBookUnit:r.getWorkBook()},...n);return s.invoke(o),this}setWrap(t){return this._setStyle(t,"tb")}setWrapStrategy(t){return this._setStyle(t,"tb")}trimWhitespace(){let{_rangeList:t,_context:e,_commandManager:r,_worksheet:s}=this;const l=t.map((t=>{let{startRow:e,startColumn:r,endRow:l,endColumn:n}=t;const o=this._worksheet.getCellMatrix(),i=/\s+/g;let a=new v;for(let s=e;s{let{startRow:s,startColumn:l,endRow:o,endColumn:i}=r;const a={[e]:t},g=B.fillObjectMatrix(o-s+1,i-l+1,a);return{sheetId:n.getSheetId(),value:g,rangeData:r,actionName:Bn.NAME}}));let i=new Us({WorkBookUnit:s.getWorkBook()},...o);return l.invoke(i),this}}class Tr{constructor(t,e){this._workSheet=t,this._rowData=new u(e)}getRowData(){return this._rowData}getRowDatas(t,e){const r=new u;for(let s=t;s{for(let s=e;s{for(let s=e;s{for(let s=e;s{const r=o.getValue(t,e);if(r){const s=a.getStyleByCell(r);if(s){const r=B.deepClone(s);r.bd&&delete r.bd.b,u.setValue(t,e,r)}}})),b.forEach(((t,e)=>{const r=o.getValue(t,e);if(r){const s=a.getStyleByCell(r);if(s){const r=B.deepClone(s);r.bd&&delete r.bd.t,m.setValue(t,e,r)}}})),c.forEach(((t,e)=>{const r=o.getValue(t,e);if(r){const s=a.getStyleByCell(r);if(s){const r=B.deepClone(s);r.bd&&delete r.bd.r,f.setValue(t,e,r)}}})),h.forEach(((t,e)=>{const r=o.getValue(t,e);if(r){const s=a.getStyleByCell(r);if(s){const r=B.deepClone(s);r.bd&&delete r.bd.l,p.setValue(t,e,r)}}})),d.forEach(((t,r)=>{_.setValue(t,r,e)}));const C=[];if(r.includes(Pt.TOP)){const t={sheetId:s,actionName:cn.NAME,styles:m.toJSON()};C.push(t)}if(r.includes(Pt.BOTTOM)){const t={sheetId:s,actionName:cn.NAME,styles:u.toJSON()};C.push(t)}if(r.includes(Pt.LEFT)){const t={sheetId:s,actionName:cn.NAME,styles:p.toJSON()};C.push(t)}if(r.includes(Pt.RIGHT)){const t={sheetId:s,actionName:cn.NAME,styles:f.toJSON()};C.push(t)}const w={sheetId:s,actionName:cn.NAME,styles:_.toJSON()};C.push(w);const T=new Us({WorkBookUnit:i},...C);return l.invoke(T),this}setCurrentCell(t){return t.activateAsCurrentCell()}getActiveCell(){return this.getSelection().getCurrentCell()}getActiveRange(){return this.getSelection().getActiveRange()}getActiveRangeList(){return this.getSelection().getActiveRangeList()}getIndex(){const t=this._context.getWorkBook().getSheets().findIndex((t=>t&&t.getSheetId()===this._sheetId));return t>-1?t+1:null}getParent(){return this._context.getWorkBook()}isSheetHidden(){return this._config.hidden}setActiveRange(t){return this.getSelection().setSelection(t)}setActiveRangeList(t){const e=this.getSelection();return e.setSelection(t),e.getActiveRangeList()}hideRow(t){const e=t.getRangeData(),r=e.startRow,s=e.endRow-e.startRow+1,{_context:l,_sheetId:n}=this,o=this.getCommandManager(),i={actionName:yn.NAME,sheetId:n,rowCount:s,rowIndex:r},a=new Us({WorkBookUnit:l.getWorkBook()},i);return o.invoke(a),this}hideRows(...t){const e=--t[0];let r=1;t[1]&&(r=t[1]);const{_context:s,_sheetId:l}=this,n=this.getCommandManager(),o={actionName:yn.NAME,sheetId:l,rowCount:r,rowIndex:e},i=new Us({WorkBookUnit:s.getWorkBook()},o);return n.invoke(i),this}hideColumn(t){const e=t.getRangeData(),r=e.startColumn,s=e.endColumn-e.startColumn+1,{_context:l,_sheetId:n}=this,o=this.getCommandManager(),i={actionName:bn.NAME,sheetId:n,columnCount:s,columnIndex:r},a=new Us({WorkBookUnit:l.getWorkBook()},i);return o.invoke(a),this}hideColumns(...t){const e=t[0];let r=1;t[1]&&(r=t[1]);const{_context:s,_sheetId:l}=this,n=this.getCommandManager(),o={actionName:bn.NAME,sheetId:l,columnCount:r,columnIndex:e},i=new Us({WorkBookUnit:s.getWorkBook()},o);return n.invoke(i),this}unhideRow(t){const e=t.getRangeData(),r=e.startRow,s=e.endRow-e.startRow+1,{_context:l,_sheetId:n}=this,o=this.getCommandManager(),i={actionName:Sn.NAME,rowCount:s,rowIndex:r,sheetId:n},a=new Us({WorkBookUnit:l.getWorkBook()},i);return o.invoke(a),this}unhideColumn(t){const e=t.getRangeData(),r=e.startColumn,s=e.endColumn-e.startColumn+1,{_context:l,_sheetId:n}=this,o=this.getCommandManager(),i={actionName:hn.NAME,sheetId:n,columnCount:s,columnIndex:r},a=new Us({WorkBookUnit:l.getWorkBook()},i);return o.invoke(a),this}showColumns(...t){const e=t[0];let r=1;t[1]&&(r=t[1]);const{_context:s,_sheetId:l}=this,n=this.getCommandManager(),o={actionName:hn.NAME,sheetId:l,columnCount:r,columnIndex:e},i=new Us({WorkBookUnit:s.getWorkBook()},o);return n.invoke(i),this}showRows(...t){const e=--t[0];let r=1;t[1]&&(r=t[1]);const{_context:s,_sheetId:l}=this,n=this.getCommandManager(),o={actionName:Sn.NAME,sheetId:l,rowCount:r,rowIndex:e},i=new Us({WorkBookUnit:s.getWorkBook()},o);return n.invoke(i),this}hasHiddenGridlines(){const{_config:t}=this,{showGridlines:e}=t;return 0===e}getTabColor(){const{_config:t}=this,{tabColor:e}=t;return e}getColumnWidth(t){return this.getColumnManager().getColumnWidth(t)}getRowHeight(t){return this.getRowManager().getRowHeight(t)}setColumnWidth(...t){let e,r=[];if(B.hasLength(t,2)&&(e=t[0],r=[t[1]]),B.hasLength(t,3)){e=t[0];for(let e=0;et.map((t=>t&&t.p?t.p:t&&t.m?t.m:""))))}getA1Notation(){const{startRow:t,endRow:e,startColumn:r,endColumn:s}=this._rangeData;let l,n;return rt.map((t=>{var e,r,s;const l=this._context.getWorkBook().getStyles();let n=null==(e=ke.bg)?void 0:e.rgb;return n=null==(s=null==(r=l.getStyleByCell(t))?void 0:r.bg)?void 0:s.rgb,n}))))}getCell(t,e){const{startRow:r,endRow:s,startColumn:l,endColumn:n}=this._rangeData,o={startRow:r+t,endRow:r+t,startColumn:l+e,endColumn:l+e};return new Sr(this._worksheet,o)}getColumn(){return this._rangeData.startColumn}getObjectValue(t={}){return this.getObjectValues(t)[0][0]}getObjectValues(t={}){const{startRow:e,endRow:r,startColumn:s,endColumn:l}=this._rangeData,n=this._worksheet.getCellMatrix().getFragments(e,r,s,l).getData();if(t.isIncludeStyle){const t=this._context.getWorkBook().getStyles();for(let o=0;o<=r-e;o++)for(let e=0;e<=l-s;e++){if(!n[o][e])continue;const r=n[o][e].s;r&&(n[o][e].s=t.get(r))}}return n}getFontColor(){return this.getFontColors()[0][0]}getFontColors(){return this.getValues().map((t=>t.map((t=>{var e,r;const s=this._context.getWorkBook().getStyles().getStyleByCell(t);return(null==(e=null==s?void 0:s.cl)?void 0:e.rgb)||(null==(r=ke.cl)?void 0:r.rgb)}))))}getFontFamilies(){return this._getStyles("ff")}getFontFamily(){return this.getFontFamilies()[0][0]}getUnderlines(){return this._getStyles("ul")}getUnderline(){return this.getUnderlines()[0][0]}getOverlines(){return this._getStyles("ol")}getOverline(){return this.getOverlines()[0][0]}getStrikeThroughs(){return this._getStyles("st")}getStrikeThrough(){return this.getStrikeThroughs()[0][0]}getFontSize(){return this.getFontSizes()[0][0]}getFontSizes(){return this._getStyles("fs")}getBorder(){return this.getBorders()[0][0]}getBorders(){return this._getStyles("bd")}getFontStyle(){return this.getFontStyles()[0][0]}getFontStyles(){return this._getStyles("it")}getFontWeight(){return this.getFontWeights()[0][0]}getFontWeights(){return this._getStyles("bl")}getGridId(){return this._worksheet.getSheetId()}getHeight(){const{_rangeData:t,_worksheet:e}=this,{startRow:r,endRow:s}=t;let l=0;for(let n=0;n<=s-r;n++){l+=e.getRowHeight(n)}return l}getHorizontalAlignment(){return this.getHorizontalAlignments()[0][0]}getHorizontalAlignments(){return this._getStyles("ht")}getLastColumn(){return this._rangeData.endColumn}getLastRow(){return this._rangeData.endRow}getMergedRanges(){const{startRow:t,endRow:e,startColumn:r,endColumn:s}=this._rangeData;return this._worksheet.getMerges().getMergedRanges({startRow:t,endRow:e,startColumn:r,endColumn:s}).map((t=>new Sr(this._worksheet,t)))}getNextDataCell(t){const{_worksheet:e}=this,{startRow:r,endRow:s,startColumn:l,endColumn:n}=this._rangeData,o=e.getMaxRows(),i=e.getMaxColumns();if(t===Pt.BOTTOM){for(let t=0;tt.map((t=>(null==t?void 0:t.p)||""))))}getRowIndex(){return this._rangeData.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(){return this.getValues().map((t=>t.map((t=>this._context.getWorkBook().getStyles().getStyleByCell(t)))))}getVerticalAlignment(){return this.getVerticalAlignments()[0][0]}getVerticalAlignments(){return this._getStyles("vt")}getWidth(){const{_rangeData:t,_worksheet:e}=this,{startColumn:r,endColumn:s}=t;let l=0;for(let n=0;n<=s-r;n++)l+=e.getColumnWidth(n);return l}getWrap(){return this.getWraps()[0][0]}getWraps(){return this._getStyles("tb")}getWrapStrategies(){return this._getStyles("tb")}getWrapStrategy(){return this.getWrapStrategies()[0][0]}isBlank(){return this.getValues().some((t=>t.some((t=>""===(null==t?void 0:t.m)))))}isPartOfMerge(){const{startRow:t,endRow:e,startColumn:r,endColumn:s}=this._rangeData;return!!this._worksheet.getMerges().getByRowColumn(t,e,r,s)}setBackground(t){const{_context:e,_worksheet:r,_commandManager:s}=this,{startRow:l,endRow:n,startColumn:o,endColumn:i}=this._rangeData,a={bg:{rgb:t}},g=B.fillObjectMatrix(n-l+1,i-o+1,a),c={sheetId:r.getSheetId(),actionName:mt.SET_RANGE_STYLE_ACTION,value:g,rangeData:this._rangeData},b=new Us({WorkBookUnit:e.getWorkBook()},c);return s.invoke(b),this}setBackgrounds(t){const{_context:e,_worksheet:r,_commandManager:s}=this,{startRow:l,endRow:n,startColumn:o,endColumn:i}=this._rangeData,a=new v;for(let b=0;bp?Pt.BOTTOM:Pt.TOP:y>B?Pt.RIGHT:Pt.LEFT,d===Pt.BOTTOM||d===Pt.TOP){u=p-m+1,f=w-C+1;for(let t=0;t<=a-i;t++){const r=this.getColumnMatrix(t).toArray();Cr.getCopyData(r,m,p,_,B,d).forEach((r=>{Cr.getApplyData(r,u,f,e,d).forEach(((e,r)=>{S.setValue(r,t,e)}))}))}}else if(d===Pt.RIGHT||d===Pt.LEFT){f=y-T,u=B-_;for(let t=0;t<=o-n;t++){const r=this.getRowMatrix(t).toArray();Cr.getCopyData(r,m,p,_,B,d).forEach((t=>{Cr.getApplyData(t,u,f,e,d)}))}}const j={sheetId:r.getSheetId(),actionName:mt.SET_RANGE_DATA_ACTION,cellValue:S.getData()},E=new Us({WorkBookUnit:s.getWorkBook()},j);return l.invoke(E),this}getDataRegion(...t){const{startRow:e,endRow:r,startColumn:s,endColumn:l}=this._rangeData;let n,o;const i=this._worksheet.getCellMatrix();if(!B.isNumber(t[0])){let t=e,r=e;const l=this._worksheet.getRowCount();for(let n=1;ne.forEach(((e,s)=>{e=e,t.setValue(r+i,s+a,e||{})}))));const l={sheetId:r.getSheetId(),actionName:mt.SET_RANGE_DATA_ACTION,cellValue:t.getData()},o=new Us({WorkBookUnit:e.getWorkBook()},l);s.invoke(o)}else if(l===Ot.PASTE_FORMAT){const t=e.getWorkBook().getStyles(),l=new v;n.map(((e,r)=>e.forEach(((e,s)=>{e=e,l.setValue(r,s,t.getStyleByCell(e)||{})}))));const i={sheetId:r.getSheetId(),actionName:mt.SET_RANGE_STYLE_ACTION,value:l.getData(),rangeData:o},a=new Us({WorkBookUnit:e.getWorkBook()},i);s.invoke(a)}else if(l===Ot.PASTE_VALUES){const t=new v;n.forEach(((e,r)=>e.forEach(((e,s)=>{e=e,t.setValue(r+i,s+a,(null==e?void 0:e.v)||"")}))));const l={sheetId:r.getSheetId(),actionName:mt.SET_RANGE_FORMATTED_VALUE_ACTION,cellValue:t.getData(),rangeData:o},g=new Us({WorkBookUnit:e.getWorkBook()},l);s.invoke(g)}else if(l===Ot.PASTE_COLUMN_WIDTHS){const t=this._rangeData.startColumn;for(let e=0;et.forEach(((t,r)=>{t=t,o.setValue(e+i,r+a,t||{})}))));const g={sheetId:r.getSheetId(),actionName:mt.SET_RANGE_DATA_ACTION,cellValue:o.getData(),options:l},c=new Us({WorkBookUnit:e.getWorkBook()},g);s.invoke(c)}else if(Is.checkup(t,Sr)){const t=new v;n.forEach(((e,r)=>e.forEach(((e,s)=>{e=e,t.setValue(r+i,s+a,e||{})}))));const l={sheetId:r.getSheetId(),actionName:mt.SET_RANGE_DATA_ACTION,cellValue:t.getData()},o=new Us({WorkBookUnit:e.getWorkBook()},l);s.invoke(o)}}copyFormatToRange(...t){const{_context:e,_commandManager:r}=this,s=t[1],l=t[2],n=t[3],o=t[4],i=B.isAssignableFrom(t[0],yr)?t[0].getSheetId():t[0],[a,g]=this._handleCopyRange(this,{startRow:s,endRow:l,startColumn:n,endColumn:o}),c=e.getWorkBook().getStyles(),b=new v;a.map(((t,e)=>t.map(((t,r)=>(t=t,b.setValue(e,r,c.getStyleByCell(t)||{}),c.getStyleByCell(t)||{})))));const h={sheetId:i,actionName:mt.SET_RANGE_STYLE_ACTION,value:b.getData(),rangeData:g},d=new Us({WorkBookUnit:e.getWorkBook()},h);r.invoke(d)}copyValuesToRange(...t){const{_context:e,_commandManager:r}=this,s=t[1],l=t[2],n=t[3],o=t[4],i=B.isAssignableFrom(t[0],yr)?t[0].getSheetId():t[0],[a,g]=this._handleCopyRange(this,{startRow:s,endRow:l,startColumn:n,endColumn:o}),c=new v;a.forEach(((t,e)=>t.forEach(((t,r)=>{t=t,c.setValue(e+g.startRow,r+g.startColumn,(null==t?void 0:t.v)||"")}))));const b={sheetId:i,actionName:mt.SET_RANGE_FORMATTED_VALUE_ACTION,cellValue:c.getData(),rangeData:g},h=new Us({WorkBookUnit:e.getWorkBook()},b);r.invoke(h)}moveTo(t){const{_context:e,_worksheet:r,_commandManager:s,_rangeData:l}=this,n={sheetId:r.getSheetId(),actionName:mt.CLEAR_RANGE_ACTION,options:{formatOnly:!0,contentsOnly:!0,commentsOnly:!0,validationsOnly:!0,skipFilteredRows:!0},rangeData:l},o=this.getMatrix(),{startRow:i,endRow:a,startColumn:g,endColumn:c}=this._rangeData,{startRow:b,startColumn:h}=t.getRangeData(),d=new v;for(let v=i;v<=a;v++)for(let t=g;t<=c;t++)d.setValue(b+(v-i),h+(t-g),o.getValue(v,t)||{});const u={sheetId:r.getSheetId(),actionName:mt.SET_RANGE_DATA_ACTION,cellValue:d.getData()},f=new Us({WorkBookUnit:e.getWorkBook()},n,u);s.invoke(f)}offset(...t){const{startRow:e,endRow:r,startColumn:s,endColumn:l}=this._rangeData,n=t[0],o=t[1],i=t[2],a=t[3],g={startRow:e+n,endRow:r+n,startColumn:s+o,endColumn:l+o};return B.isNumber(i)&&(g.endRow=g.startRow+i-1),B.isNumber(a)&&(g.endColumn=g.endColumn+a-1),new Sr(this._worksheet,g)}setBorder(...t){const e=t[0],r=t[1],s=t[2],l=t[3],n=t[4],o=t[5],i=t[6]?t[6]:"black",a=t[7]?t[7]:Tt.DASH_DOT,{_context:g,_worksheet:c,_commandManager:b}=this,h=g.getWorkBook(),d=this._rangeData,u=c.getSheetId(),f={startRow:d.startRow-1,startColumn:d.startColumn,endRow:d.startRow-1,endColumn:d.endColumn},m={startRow:d.startRow,startColumn:d.startColumn-1,endRow:d.endRow,endColumn:d.startColumn-1},p={startRow:d.endRow+1,startColumn:d.startColumn,endRow:d.endRow+1,endColumn:d.endColumn},_={startRow:d.startRow,startColumn:d.endColumn+1,endRow:d.endRow,endColumn:d.endColumn+1},C={startRow:d.startRow,startColumn:d.startColumn,endRow:d.startRow,endColumn:d.endColumn},w={startRow:d.startRow,startColumn:d.startColumn,endRow:d.endRow,endColumn:d.startColumn},T={startRow:d.endRow,startColumn:d.startColumn,endRow:d.endRow,endColumn:d.endColumn},y={startRow:d.startRow,startColumn:d.endColumn,endRow:d.endRow,endColumn:d.endColumn},S=new Sr(c,f),j=new Sr(c,m),E=new Sr(c,p),Y=new Sr(c,_),R=new Sr(c,C),I=new Sr(c,w),A=new Sr(c,T),x=new Sr(c,y),O=new v,N=new v,k=new v,M=new v,D=new v,L=[],P={s:a,cl:{rgb:i}};if(!0===e||!1===e){if(S.isValid()){S.forEach(((t,e)=>{O.setValue(t,e,{bd:{b:null}})}));const t={sheetId:u,actionName:mt.SET_RANGE_STYLE_ACTION,value:O.getArrayData(),rangeData:f};L.push(t)}R.forEach(((t,r)=>{if(!0===e){const e=B.deepMerge(D.getValue(t,r)||{},{bd:{t:B.deepClone(P)}});D.setValue(t,r,e)}else if(!1===e){const e=B.deepMerge(D.getValue(t,r)||{},{bd:{t:null}});D.setValue(t,r,e)}}))}if(!0===s||!1===s){if(E.isValid()){E.forEach(((t,e)=>{k.setValue(t,e,{bd:{t:null}})}));const t={sheetId:u,actionName:mt.SET_RANGE_STYLE_ACTION,value:k.getArrayData(),rangeData:p};L.push(t)}A.forEach(((t,e)=>{if(!0===s){const r=B.deepMerge(D.getValue(t,e)||{},{bd:{b:B.deepClone(P)}});D.setValue(t,e,r)}else if(!1===s){const r=B.deepMerge(D.getValue(t,e)||{},{bd:{b:null}});D.setValue(t,e,r)}}))}if(!0===r||!1===r){if(j.isValid()){j.forEach(((t,e)=>{N.setValue(t,e,{bd:{r:null}})}));const t={sheetId:u,actionName:mt.SET_RANGE_STYLE_ACTION,value:N.getArrayData(),rangeData:m};L.push(t)}I.forEach(((t,e)=>{if(!0===r){const r=B.deepMerge(D.getValue(t,e)||{},{bd:{l:B.deepClone(P)}});D.setValue(t,e,r)}else if(!1===r){const r=B.deepMerge(D.getValue(t,e)||{},{bd:{l:null}});D.setValue(t,e,r)}}))}if(!0===l||!1===l){if(Y.isValid()){Y.forEach(((t,e)=>{M.setValue(t,e,{bd:{l:null}})}));const t={sheetId:u,actionName:mt.SET_RANGE_STYLE_ACTION,value:M.getArrayData(),rangeData:_};L.push(t)}x.forEach(((t,e)=>{if(!0===l){const r=B.deepMerge(D.getValue(t,e)||{},{bd:{r:B.deepClone(P)}});D.setValue(t,e,r)}else if(!1===l){const r=B.deepMerge(D.getValue(t,e)||{},{bd:{r:null}});D.setValue(t,e,r)}}))}!0!==n&&!1!==n||this.forEach(((t,e)=>{if(e!==d.endColumn)if(!0===n){const r=B.deepMerge(D.getValue(t,e)||{},{bd:{r:B.deepClone(P)}});D.setValue(t,e,r)}else if(!1===n){const r=B.deepMerge(D.getValue(t,e)||{},{bd:{r:null}});D.setValue(t,e,r)}if(e!==d.startColumn){const r=B.deepMerge(D.getValue(t,e)||{},{bd:{l:null}});D.setValue(t,e,r)}})),!0!==o&&!1!==o||this.forEach(((t,e)=>{if(t!==d.endRow)if(!0===o){const r=B.deepMerge(D.getValue(t,e)||{},{bd:{b:B.deepClone(P)}});D.setValue(t,e,r)}else if(!1===o){const r=B.deepMerge(D.getValue(t,e)||{},{bd:{b:null}});D.setValue(t,e,r)}if(t!==d.startRow){const r=B.deepMerge(D.getValue(t,e)||{},{bd:{t:null}});D.setValue(t,e,r)}}));const H={sheetId:u,actionName:mt.SET_RANGE_STYLE_ACTION,value:D.getArrayData(),rangeData:D.getDataRange()};L.push(H);const F=new Us({WorkBookUnit:h},...L);return b.invoke(F),this}setBorderByType(t,e,r){let s=null,l=null,n=null,o=null,i=null,a=null;switch(t){case St.TOP:s=!0;break;case St.BOTTOM:n=!0;break;case St.LEFT:l=!0;break;case St.RIGHT:o=!0;break;case St.NONE:s=!1,l=!1,n=!1,o=!1,i=!1,a=!1;break;case St.ALL:s=!0,l=!0,n=!0,o=!0,i=!0,a=!0;break;case St.OUTSIDE:s=!0,l=!0,n=!0,o=!0;break;case St.INSIDE:i=!0,a=!0;break;case St.HORIZONTAL:a=!0;break;case St.VERTICAL:i=!0}this.setBorder(s,l,n,o,i,a,e,r)}setFontFamily(t){const{_context:e,_worksheet:r,_commandManager:s}=this,{startRow:l,endRow:n,startColumn:o,endColumn:i}=this._rangeData,a={ff:t},g=B.fillObjectMatrix(n-l+1,i-o+1,a),c={sheetId:r.getSheetId(),actionName:mt.SET_RANGE_STYLE_ACTION,value:g,rangeData:this._rangeData},b=new Us({WorkBookUnit:e.getWorkBook()},c);return s.invoke(b),this}setFontSize(t){const{_context:e,_worksheet:r,_commandManager:s}=this,{startRow:l,endRow:n,startColumn:o,endColumn:i}=this._rangeData,a={fs:t},g=B.fillObjectMatrix(n-l+1,i-o+1,a),c={sheetId:r.getSheetId(),actionName:mt.SET_RANGE_STYLE_ACTION,value:g,rangeData:this._rangeData},b=new Us({WorkBookUnit:e.getWorkBook()},c);return s.invoke(b),this}setHorizontalAlignment(t){const{_context:e,_worksheet:r,_commandManager:s}=this,{startRow:l,endRow:n,startColumn:o,endColumn:i}=this._rangeData,a={ht:t},g=B.fillObjectMatrix(n-l+1,i-o+1,a),c={sheetId:r.getSheetId(),actionName:mt.SET_RANGE_STYLE_ACTION,value:g,rangeData:this._rangeData},b=new Us({WorkBookUnit:e.getWorkBook()},c);return s.invoke(b),this}setVerticalAlignment(t){const{_context:e,_worksheet:r,_commandManager:s}=this,{startRow:l,endRow:n,startColumn:o,endColumn:i}=this._rangeData,a={vt:t},g=B.fillObjectMatrix(n-l+1,i-o+1,a),c={sheetId:r.getSheetId(),actionName:mt.SET_RANGE_STYLE_ACTION,value:g,rangeData:this._rangeData},b=new Us({WorkBookUnit:e.getWorkBook()},c);return s.invoke(b),this}setTextDirection(t){const{_context:e,_worksheet:r,_commandManager:s}=this,{startRow:l,endRow:n,startColumn:o,endColumn:i}=this._rangeData,a={td:t},g=B.fillObjectMatrix(n-l+1,i-o+1,a),c={sheetId:r.getSheetId(),actionName:mt.SET_RANGE_STYLE_ACTION,value:g,rangeData:this._rangeData},b=new Us({WorkBookUnit:e.getWorkBook()},c);return s.invoke(b),this}setWrapStrategy(t){const{_context:e,_worksheet:r,_commandManager:s}=this,{startRow:l,endRow:n,startColumn:o,endColumn:i}=this._rangeData,a={tb:t},g=B.fillObjectMatrix(n-l+1,i-o+1,a),c={sheetId:r.getSheetId(),actionName:mt.SET_RANGE_STYLE_ACTION,value:g,rangeData:this._rangeData},b=new Us({WorkBookUnit:e.getWorkBook()},c);return s.invoke(b),this}setValue(t){const{_rangeData:e,_context:r,_commandManager:s,_worksheet:l}=this,{startRow:n,startColumn:o,endRow:i,endColumn:a}=e,g=new v;for(let h=n;h<=i;h++)for(let e=o;e<=a;e++)g.setValue(h,e,t);const c={sheetId:l.getSheetId(),actionName:mt.SET_RANGE_FORMATTED_VALUE_ACTION,cellValue:g.getData(),rangeData:this._rangeData},b=new Us({WorkBookUnit:r.getWorkBook()},c);return s.invoke(b),this}setValues(...t){const{_rangeData:e,_context:r,_commandManager:s,_worksheet:l}=this,n=t[0];if(Is.checkup(t,Array)){const{startRow:t,startColumn:o,endRow:i,endColumn:a}=e,g=new v;for(let e=0;e<=i-t;e++)for(let r=0;r<=a-o;r++)g.setValue(e+t,r+o,n[e][r]);const c={sheetId:l.getSheetId(),actionName:mt.SET_RANGE_FORMATTED_VALUE_ACTION,cellValue:g.getData(),rangeData:this._rangeData},b=new Us({WorkBookUnit:r.getWorkBook()},c);s.invoke(b)}else if(Is.checkup(t,v)){const t={sheetId:l.getSheetId(),actionName:mt.SET_RANGE_FORMATTED_VALUE_ACTION,cellValue:n,rangeData:this._rangeData},e=new Us({WorkBookUnit:r.getWorkBook()},t);s.invoke(e)}return this}setRangeData(t){const{_rangeData:e,_context:r,_commandManager:s,_worksheet:l}=this,{startRow:n,startColumn:o}=e,i={sheetId:l.getSheetId(),actionName:mt.SET_RANGE_DATA_ACTION,cellValue:{[n]:{[o]:t}}},a=new Us({WorkBookUnit:r.getWorkBook()},i);return s.invoke(a),this}setRangeDatas(...t){const{_rangeData:e,_context:r,_commandManager:s,_worksheet:l}=this,n=t[0];if(Is.checkup(t,Array)){const{startRow:t,startColumn:o,endRow:i,endColumn:a}=e,g=new v;for(let e=0;e<=i-t;e++)for(let r=0;r<=a-o;r++)g.setValue(e+t,r+o,n[e][r]);const c={sheetId:l.getSheetId(),actionName:mt.SET_RANGE_DATA_ACTION,cellValue:g.getData()},b=new Us({WorkBookUnit:r.getWorkBook()},c);s.invoke(b)}else if(Is.checkup(t,Is.OBJECT_TYPE)){const t={sheetId:l.getSheetId(),actionName:mt.SET_RANGE_DATA_ACTION,cellValue:n},e=new Us({WorkBookUnit:r.getWorkBook()},t);s.invoke(e)}return this}clear(...t){const{_context:e,_worksheet:r,_commandManager:s,_rangeData:l}=this;let n={formatOnly:!0,contentsOnly:!0};Is.checkup(t,Is.OBJECT_TYPE)&&(n=t[0]);const o={sheetId:r.getSheetId(),actionName:mt.CLEAR_RANGE_ACTION,options:n,rangeData:l},i=new Us({WorkBookUnit:e.getWorkBook()},o);return s.invoke(i),this}clearFormat(){return this.clear({formatOnly:!0})}clearContent(){return this.clear({contentsOnly:!0})}deleteCells(t){const{_rangeData:e,_context:r,_commandManager:s,_worksheet:l}=this,n={sheetId:l.getSheetId(),actionName:mt.DELETE_RANGE_ACTION,shiftDimension:t,rangeData:e},o=new Us({WorkBookUnit:r.getWorkBook()},n);s.invoke(o)}insertCells(...t){const e=t[0],r=t[1],{_rangeData:s,_context:l,_commandManager:n,_worksheet:o}=this,{startRow:i,endRow:a,startColumn:g,endColumn:c}=this._rangeData;let b=this._rangeData,h=new v;if(r){h=r.getMatrixObject();const t=r.getRangeData();b={startRow:i,endRow:i+t.endRow-t.startRow,startColumn:g,endColumn:i+t.endColumn-t.startColumn}}else for(let f=i;f<=a;f++)for(let t=g;t<=c;t++)h.setValue(f,t,{m:"",v:""});const d={sheetId:o.getSheetId(),actionName:mt.INSERT_RANGE_ACTION,shiftDimension:e,rangeData:b,cellValue:h.getData()},u=new Us({WorkBookUnit:l.getWorkBook()},d);return n.invoke(u),this}merge(){const{_worksheet:t}=this;return t.getMerges().add(this._rangeData),this}mergeAcross(){const{_worksheet:t}=this,e=t.getCommandManager(),r=t.getContext(),s=t.getSheetId(),{startRow:l,endRow:n,startColumn:o,endColumn:i}=this._rangeData,a=[];for(let b=l;b<=n;b++){const t={startRow:b,endRow:b,startColumn:o,endColumn:i};a.push(t)}const g={actionName:mt.ADD_MERGE_ACTION,sheetId:s,rectangles:a},c=new Us({WorkBookUnit:r.getWorkBook()},g);return e.invoke(c),this}mergeVertically(){const{_worksheet:t}=this,e=t.getCommandManager(),r=t.getContext(),s=t.getSheetId(),{startRow:l,endRow:n,startColumn:o,endColumn:i}=this._rangeData,a=[];for(let b=o;b<=i;b++){const t={startRow:l,endRow:n,startColumn:b,endColumn:b};a.push(t)}const g={actionName:mt.ADD_MERGE_ACTION,sheetId:s,rectangles:a},c=new Us({WorkBookUnit:r.getWorkBook()},g);return e.invoke(c),this}breakApart(){const{_worksheet:t}=this,e=t.getCommandManager(),r=t.getContext(),s=t.getSheetId(),l=this._worksheet.getMerges().getMergedRanges(this._rangeData),n={actionName:mt.REMOVE_MERGE_ACTION,sheetId:s,rectangles:l},o=new Us({WorkBookUnit:r.getWorkBook()},n);return e.invoke(o),this}removeDuplicates(...t){const{_rangeData:e,_context:r,_commandManager:s,_worksheet:l}=this;Array.isArray(t[0])&&t[0];const n=this.getMatrix().getData(),o=[];for(let b=0;b<=e.endColumn-e.startColumn;b++){const t=[],e={},r=this.getColumnMatrix(b).getData();for(const s in r){const l=r[s][b].m;e.hasOwnProperty(l)||(e[l]=1,t.push(b))}o.push(t)}const i=Array.from(new Set(o.flat())),a={};i.forEach(((t,e)=>{a[e]=n[t]}));const g=[{sheetId:l.getSheetId(),actionName:mt.SET_RANGE_DATA_ACTION,cellValue:a}],c=new Us({WorkBookUnit:r.getWorkBook()},...g);return s.invoke(c),this}getRowMatrix(t){const{startColumn:e,endColumn:r}=this._rangeData,s=this._worksheet.getCellMatrix(),l=new v;for(let n=t;n<=t;n++)for(let t=e;t<=r;t++)l.setValue(n,t,s.getValue(n,t)||{});return l}getColumnMatrix(t){const{startRow:e,endRow:r}=this._rangeData,s=this._worksheet.getCellMatrix(),l=new v;for(let n=e;n<=r;n++)for(let e=t;e<=t;e++)l.setValue(n,e,s.getValue(n,e)||{});return l}forEach(t){Sr.foreach(this._rangeData,t)}randomize(){const{_context:t,_worksheet:e,_commandManager:r,_rangeData:s}=this,{startRow:l,startColumn:n}=s,o=new v;B.randSort(this.getMatrix().toArray()).forEach(((t,e)=>t.forEach(((t,r)=>{t=t,o.setValue(e+l,r+n,t||{})}))));const i={sheetId:e.getSheetId(),actionName:mt.SET_RANGE_DATA_ACTION,cellValue:o.getData()},a=new Us({WorkBookUnit:t.getWorkBook()},i);r.invoke(a)}isValid(){return!Object.values(this._rangeData).includes(-1)}_handleCopyRange(...t){const e=t[0];let r=t[1];r=Is.checkup(t,Sr,Sr)?r.getRangeData():r;const s=e._worksheet.getCellMatrix(),{startRow:l,endRow:n,startColumn:o,endColumn:i}=e.getRangeData();let{startRow:a,endRow:g,startColumn:c,endColumn:b}=r;const h=n-l+1,d=i-o+1,u=g-a+1,f=b-c+1;let v,m=[];if(u%h==0&&f%d==0){for(let t=0;te.map((e=>{const r=this._context.getWorkBook().getStyles(),s=r&&r.getStyleByCell(e);return s&&s[t]||ke[t]}))))}_setStyle(t,e){const{_context:r,_worksheet:s,_commandManager:l}=this,{startRow:n,endRow:o,startColumn:i,endColumn:a}=this._rangeData,g={[e]:t},c=B.fillObjectMatrix(o-n+1,a-i+1,g),b={sheetId:s.getSheetId(),actionName:Bn.NAME,value:c,rangeData:this._rangeData},h=new Us({WorkBookUnit:r.getWorkBook()},b);return l.invoke(h),this}_setStyles(t,e){const{_context:r,_worksheet:s,_commandManager:l}=this,{startRow:n,endRow:o,startColumn:i,endColumn:a}=this._rangeData,g=new v;for(let h=0;h=0){const{sheetOrder:e}=this._config;for(let s=t;s=0;s--){const t=this._worksheets.get(e[s]);if(t&&!t.isSheetHidden())return t.activate(),t}const r=this._worksheets.get(e[e.length-1]);return r&&r.activate(),r}}setContext(t){this._context=t}insertSheet(...t){const{_context:e}=this,r=e.getGenName(),s=this.getCommandManager(),l=e.getContextObserver("onBeforeInsertSheetObservable"),n=e.getContextObserver("onAfterInsertSheetObservable");if(B.hasLength(t,0)){const t={name:r.sheetName(),status:0,id:B.generateRandomId(6)},o=this.getSheetSize();return l.notifyObservers({index:o,sheetId:t.id}),s.invoke(new Us({WorkBookUnit:e.getWorkBook()},{actionName:rn.NAME,sheetId:t.id,index:o,sheet:t})),n.notifyObservers({index:o,sheetId:t.id}),t.id}if(B.hasLength(t,1)){if(B.isAssignableFrom(t[0],yr)){const r=t[0],o=this.getSheetSize(),i=r.getConfig();return i.id=B.generateRandomId(6),l.notifyObservers({index:o,sheetId:i.id}),s.invoke(new Us({WorkBookUnit:e.getWorkBook()},{actionName:rn.NAME,sheetId:i.id,index:o,sheet:i})),n.notifyObservers({index:o,sheetId:i.id}),i.id}if(B.isNumber(t[0])){const o=t[0],i={name:r.sheetName(),status:0,id:B.generateRandomId(6)};return l.notifyObservers({index:o,sheetId:i.id}),s.invoke(new Us({WorkBookUnit:e.getWorkBook()},{actionName:rn.NAME,sheetId:i.id,index:o,sheet:i})),n.notifyObservers({index:o,sheetId:i.id}),i.id}if(B.isString(t[0])){const r=t[0],o=this.getSheetSize(),i={status:0,name:r,id:B.generateRandomId(6)};return l.notifyObservers({index:o,sheetId:i.id}),s.invoke(new Us({WorkBookUnit:e.getWorkBook()},{actionName:rn.NAME,sheetId:i.id,index:o,sheet:i})),n.notifyObservers({index:o,sheetId:i.id}),i.id}if(B.isPlainObject(t[0])){const r=t[0],o=this.getSheetSize();return l.notifyObservers({index:o,sheetId:r.id}),s.invoke(new Us({WorkBookUnit:e.getWorkBook()},{actionName:rn.NAME,sheetId:r.id,index:o,sheet:r})),n.notifyObservers({index:o,sheetId:r.id}),r.id}}if(B.hasLength(t,2)){if(B.isString(t[0])){const r=t[0],o=t[1],i={status:0,name:r,id:B.generateRandomId(6)};return l.notifyObservers({index:o,sheetId:i.id}),s.invoke(new Us({WorkBookUnit:e.getWorkBook()},{actionName:rn.NAME,sheetId:i.id,index:o,sheet:i})),n.notifyObservers({index:o,sheetId:i.id}),i.id}if(B.isNumber(t[0])){if(B.isAssignableFrom(t[1],yr)){const r=t[0],o=t[1].getConfig();return o.id=B.generateRandomId(6),l.notifyObservers({index:r,sheetId:o.id}),s.invoke(new Us({WorkBookUnit:e.getWorkBook()},{actionName:rn.NAME,sheetId:o.id,index:r,sheet:o})),n.notifyObservers({index:r,sheetId:o.id}),o.id}if(B.isPlainObject(t[1])){const r=t[0],o=t[1];return l.notifyObservers({index:r,sheetId:o.id}),s.invoke(new Us({WorkBookUnit:e.getWorkBook()},{actionName:rn.NAME,sheetId:o.id,index:r,sheet:o})),n.notifyObservers({index:r,sheetId:o.id}),o.id}}}}getActiveSpreadsheet(){return this}getStyles(){return this._styles}getContext(){return this._context}getConfig(){return this._config}create(...t){if(B.hasLength(t,1)){const{_context:e}=this,r=t[0],s=__spreadProps(__spreadValues({},Ne),{name:r}),l=new yr(e,s);return this.insertSheet(l),l}if(B.hasLength(t,3)){const{_context:e}=this,r=t[0],s=t[1],l=t[2],n=__spreadProps(__spreadValues({},Ne),{name:r,rowCount:s,columnCount:l}),o=new yr(e,n);return this.insertSheet(o),o}}setDefaultActiveSheet(){this._setDefaultActiveSheet()}getIndexBySheetId(t){const{sheetOrder:e}=this._config;return e.findIndex((e=>e===t))}getActiveSheet(){const{sheetOrder:t}=this._config,e=t.find((t=>this._worksheets.get(t).getStatus()===_e.TRUE));return e?this._worksheets.get(e):(console.warn("No active sheet, get first sheet"),this._worksheets[0])}getActiveSheetIndex(){const{sheetOrder:t}=this._config;return t.findIndex((t=>1===this._worksheets.get(t).getStatus()))}getActiveRange(){const t=this.getActiveSheet();if(t){return t.getSelection().getActiveRange()}return null}setActiveRange(t){const e=this.getActiveSheet();return e?e.setActiveSelection(t):null}setActiveRangeList(t){const e=this.getActiveSheet();if(e){const r=e.getRangeList(t);return r.activate(),r.getRangeList()}return null}getActiveRangeList(){const t=this.getActiveSheet();if(t){return t.getSelection().getActiveRangeList()}return null}getSelection(){const t=this.getActiveSheet();if(t)return t.getSelection()}getCurrentCell(){const t=this.getSelection();if(t)return t.getCurrentCell()}getSheetSize(){return this._config.sheetOrder.length}setCurrentCell(t){return t.activateAsCurrentCell()}flush(){}setSheetOrder(t,e){const{_context:r}=this,s=this.getCommandManager(),l=r.getContextObserver("onSheetOrderObservable"),n={actionName:Yn.NAME,sheetId:t,order:e},o=new Us({WorkBookUnit:r.getWorkBook()},n);s.invoke(o),l.notifyObservers()}getSheets(){const{sheetOrder:t}=this._config;return t.map((t=>this._worksheets.get(t)))}getSheetIndex(t){const{sheetOrder:e}=this._config;return e.findIndex((e=>t.getSheetId()===e))}removeSheetBySheetId(t){const{_config:e}=this,{sheetOrder:r}=e,s=this.getCommandManager(),l=this.getSheetBySheetId(t);if(r.length>1&&null!=l){const e=this.getSheetIndex(l),r=this.getContext().getContextObserver("onBeforeRemoveSheetObservable"),n=this.getContext().getContextObserver("onAfterRemoveSheetObservable");r.notifyObservers({index:e}),s.invoke(new Us({WorkBookUnit:this},{actionName:gn.NAME,sheetId:t})),n.notifyObservers({index:e,sheetId:t}),this.activateSheetByIndex(e)}}getSheetBySheetName(t){const{sheetOrder:e}=this._config,r=e.find((e=>this._worksheets.get(e).getName()===t));return this._worksheets.get(r)}getSheetBySheetId(t){return this._worksheets.get(t)}setActiveSheet(...t){let e=!1;const r=t[0];return Is.checkup(t,yr,Is.BOOLEAN_TYPE)&&(e=t[1]),r.activate(),e&&r.setActiveSelection(),r}getCommandManager(){return this._context.getCommandManager()}getPluginMeta(t){return this._config.pluginMeta[t]}setPluginMeta(t,e){return this._config.pluginMeta||(this._config.pluginMeta={}),this._config.pluginMeta[t]=e}transformRangeType(t){if("string"==typeof t){return this._getCellRange(t)}return"string"!=typeof t&&"row"in t?{sheetId:"",rangeData:{startRow:t.row[0],startColumn:t.column[0],endRow:t.row[1],endColumn:t.column[1]}}:"string"!=typeof t&&"startRow"in t?{sheetId:"",rangeData:t}:Re}load(t){this._config=t}save(){return this._config}_getDefaultWorkSheet(){const{_context:t,_config:e,_worksheets:r}=this,{sheets:s,sheetOrder:l}=e,n=t.getGenName();B.isEmptyObject(s)&&(s[Ne.id]=Object.assign(Ne,{status:_e.TRUE}));let o=null;for(let i in s){let e=s[i];e.name=n.sheetName(e.name);const a=new yr(t,e);r.set(i,a),l.includes(i)||l.push(i),null==o&&(o=a)}o&&o.activate()}_setDefaultActiveSheet(){this._worksheets.size>0&&(this._worksheets.forEach((t=>{t.setStatus(_e.FALSE)})),this._worksheets[0].setStatus(_e.TRUE))}_getCellRange(t){var e,r,s,l,n;let o="",i="";if(t.indexOf("!")>-1){const e=t.split("!");o=e[0],i=e[1],o=o.replace(/\\'/g,"'").replace(/''/g,"'"),"'"===o.substring(0,1)&&"'"===o.substring(o.length-1,1)&&(o=o.substring(1,o.length-1))}else i=t;if(-1===i.indexOf(":")){const t=parseInt(i.replace(/[^0-9]/g,""),10)-1,e=B.ABCatNum(i.replace(/[^A-Za-z]/g,""));if(!Number.isNaN(t)&&!Number.isNaN(e)){return{sheetId:o,rangeData:{startRow:t,endRow:t,startColumn:e,endColumn:e}}}return Re}i=i.split(":");const a=[0,0],g=[0,0],c=(null==(e=this.getSheetBySheetName(o))?void 0:e.getMaxRows())||(null==(r=this.getActiveSheet())?void 0:r.getMaxRows()),b=(null==(s=this.getSheetBySheetName(o))?void 0:s.getMaxColumns())||(null==(l=this.getActiveSheet())?void 0:l.getMaxColumns());if(a[0]=parseInt(i[0].replace(/[^0-9]/g,""),10)-1,a[1]=parseInt(i[1].replace(/[^0-9]/g,""),10)-1,Number.isNaN(a[0])&&(a[0]=0),Number.isNaN(a[1])&&(a[1]=c),a[0]>a[1])return Re;if(g[0]=B.ABCatNum(i[0].replace(/[^A-Za-z]/g,"")),g[1]=B.ABCatNum(i[1].replace(/[^A-Za-z]/g,"")),Number.isNaN(g[0])&&(g[0]=0),Number.isNaN(g[1])&&(g[1]=b),g[0]>g[1])return Re;return{sheetId:(null==(n=this.getSheetBySheetName(o))?void 0:n.getSheetId())||"",rangeData:{startRow:a[0],endRow:a[1],startColumn:g[0],endColumn:g[1]}}}}class Rr{constructor(t){this._workSheet=t,this._context=t.getContext(),this._commandManager=this._context.getCommandManager(),this._workbook=t.getContext().getWorkBook(),this._activeRangeList=this._workSheet.getRangeList([Ae]),this._activeRange=this._workSheet.getRange(Ae),this._currentCell=this._workSheet.getRange(Ae)}static cellInRange(t,e){for(const r of t)if(r.startRow<=e.startRow&&e.endRow<=r.endRow&&r.startColumn<=e.startColumn&&e.endColumn<=r.endColumn)return r;return null}setWorkSheet(t){this._workSheet=t}setSelection({selection:t,cell:e}={}){var r;let s,l,n;if(t instanceof Sr?(l=t.getRangeData(),-1===l.startRow&&console.error("Invalid selection, default set startRow -1"),s=[l],n={startRow:l.startRow,endRow:l.startRow,startColumn:l.startColumn,endColumn:l.startColumn}):t&&Yr.isIRangeType(t)?(l=this._workbook.transformRangeType(t).rangeData,-1===l.startRow&&console.error("Invalid selection, default set startRow -1"),s=[l],n={startRow:l.startRow,endRow:l.startRow,startColumn:l.startColumn,endColumn:l.startColumn}):t instanceof Array?(s=t.map((t=>{const e=this._workbook.transformRangeType(t).rangeData;return-1===e.startRow&&console.error("Invalid selection, default set startRow -1"),e})),l=s[s.length-1],n={startRow:l.startRow,endRow:l.startRow,startColumn:l.startColumn,endColumn:l.startColumn}):(s=this._activeRangeList.getRangeList(),l=this._activeRange.getRangeData(),n=this._currentCell.getRangeData()),e){n=this._workbook.transformRangeType(e).rangeData;Rr.cellInRange(s,n)||(l=n,s=[l])}const{_context:o,_workSheet:i,_commandManager:a}=this,g={sheetId:i.getSheetId(),actionName:En.NAME,activeRangeList:s,activeRange:l,currentCell:n},c=new Us({WorkBookUnit:o.getWorkBook()},g);a.invoke(c);const b=`${B.chatAtABC(l.startColumn)+(l.startRow+1)}:${B.chatAtABC(l.endColumn)}${l.endRow+1}`;return null==(r=this._context.getObserverManager().getObserver("onAfterSetSelectionObservable"))||r.notifyObservers(b),this._activeRange}getSelection(){return B.deepClone(this._activeRange.getRangeData())}getActiveRange(){return this._activeRange}getActiveRangeList(){return this._activeRangeList}getActiveSheet(){return this._workbook.getActiveSheet()}getCurrentCell(){return this._currentCell}setCurrentCell(t){if(B.isAssignableFrom(t,Sr)&&(t=t.getRangeData()),-1===(null==t?void 0:t.startRow))return console.error("Invalid range,default set startRow -1"),this;if(t.startRow!==t.endRow||t.startColumn!==t.endColumn)return console.error("Exception: Range must have a single cell."),this;const e=this._activeRangeList.getRangeList(),{_context:r,_workSheet:s,_commandManager:l}=this,n={sheetId:s.getSheetId(),actionName:En.NAME,activeRangeList:e,activeRange:t,currentCell:t},o=new Us({WorkBookUnit:r.getWorkBook()},n);return l.invoke(o),this}setRanges(t,e,r){this._activeRangeList=this._workSheet.getRangeList(t),this._activeRange=this._workSheet.getRange(e),this._currentCell=this._workSheet.getRange(r)}getNextDataRange(t){const e=this._expandRange(t);return this.setSelection({selection:e}),this.getActiveRange()}_expandRange(t){const e=this._workSheet.getColumnCount(),r=this._workSheet.getRowCount(),s=this._activeRange.getRangeData();let l=Ae;const n=this.getCurrentCell().getRangeData();if(t===Pt.RIGHT)if(n.startColumn===s.startColumn){const t=this._workSheet.getCellMatrix().getValue(n.startRow,s.endColumn);let r;if(t&&void 0===t.v)for(let l=s.endColumn+1;l<=e;l++){if(l===e){r=e;break}const t=this._workSheet.getCellMatrix().getValue(n.startRow,l);if(t&&void 0!==t.v){r=l;break}}else for(let l=s.endColumn+1;l<=e;l++){if(l===e){r=e;break}const t=this._workSheet.getCellMatrix().getValue(n.startRow,l);if(t&&void 0===t.v){const t=this._workSheet.getCellMatrix().getValue(n.startRow,l-1);if(t&&void 0!==t.v){r=l-1;break}}}l={startRow:s.startRow,endRow:s.endRow,startColumn:s.startColumn,endColumn:void 0!==r?r:s.endColumn}}else{const t=this._workSheet.getCellMatrix().getValue(n.startRow,s.startColumn);let e;if(t&&void 0===t.v)for(let r=s.startColumn+1;r<=n.startColumn;r++){if(r===n.startColumn){e=n.startColumn;break}const t=this._workSheet.getCellMatrix().getValue(n.startRow,r);if(t&&void 0!==t.v){e=r;break}}else for(let r=s.startColumn+1;r<=n.startColumn;r++){if(r===n.startColumn){e=n.startColumn;break}const t=this._workSheet.getCellMatrix().getValue(n.startRow,r);if(t&&void 0===t.v){const t=this._workSheet.getCellMatrix().getValue(n.startRow,r-1);if(t&&void 0!==t.v){e=r-1;break}}}l={startRow:s.startRow,endRow:s.endRow,startColumn:e||n.startColumn,endColumn:s.endColumn}}if(t===Pt.LEFT){let t,e;if(n.endColumn===s.endColumn){const e=this._workSheet.getCellMatrix().getValue(n.startRow,s.startColumn);if(e&&void 0===e.v)for(let r=s.startColumn-1;r>=0;r--){if(0===r){t=0;break}const e=this._workSheet.getCellMatrix().getValue(n.startRow,r);if(e&&void 0!==e.v){t=r;break}}else for(let r=s.startColumn-1;r>=0;r--){if(0===r){t=0;break}const e=this._workSheet.getCellMatrix().getValue(n.startRow,r);if(e&&void 0===e.v){const e=this._workSheet.getCellMatrix().getValue(n.startRow,r-1);if(e&&void 0!==e.v){t=r-1;break}}}}else{const t=this._workSheet.getCellMatrix().getValue(n.startRow,s.endColumn);if(t&&void 0===t.v)for(let r=s.endColumn-1;r>=n.startColumn;r--){if(r===n.startColumn){e=r;break}const t=this._workSheet.getCellMatrix().getValue(n.startRow,r);if(t&&void 0!==t.v){e=r;break}}else for(let r=s.endColumn-1;r>=n.startColumn;r--){if(r===n.startColumn){e=r;break}const t=this._workSheet.getCellMatrix().getValue(n.startRow,r);if(t&&void 0===t.v){const t=this._workSheet.getCellMatrix().getValue(n.startRow,r-1);if(t&&void 0!==t.v){e=r-1;break}}}}l={startRow:s.startRow,endRow:s.endRow,startColumn:void 0!==t?t:s.startColumn,endColumn:void 0!==e?e:s.endColumn}}if(t===Pt.TOP){let t,e;if(n.endRow===s.endRow){const e=this._workSheet.getCellMatrix().getValue(s.startRow,n.startColumn);if(e&&void 0===e.v)for(let r=s.endRow-1;r>=0;r--){const e=this._workSheet.getCellMatrix().getValue(r,n.startColumn);if(e&&void 0!==e.v||0===r){t=r;break}}else for(let r=s.startRow-1;r>=0;r--){if(0===r){t=0;break}const e=this._workSheet.getCellMatrix().getValue(r,n.startColumn);if(e&&void 0===e.v){const e=this._workSheet.getCellMatrix().getValue(r-1,n.startColumn);if(e&&void 0!==e.v){t=r-1;break}}}}else{const t=this._workSheet.getCellMatrix().getValue(s.endRow,n.startColumn);if(t&&void 0===t.v)for(let r=s.endRow-1;r>=n.startRow;r--){if(r===n.startRow){e=n.startRow;break}const t=this._workSheet.getCellMatrix().getValue(r,n.startColumn);if(t&&void 0!==t.v){e=r;break}}else for(let r=s.endRow-1;r>=n.startRow;r--){const t=this._workSheet.getCellMatrix().getValue(r,n.startColumn);if(r===n.startRow){e=n.startRow;break}if(t&&void 0===t.v&&r!==s.endRow-1){const t=this._workSheet.getCellMatrix().getValue(r+1,n.startColumn);if(t&&void 0!==t.v){e=r+1;break}}}}l={startRow:void 0!==t?t:s.startRow,endRow:void 0!==e?e:s.endRow,startColumn:s.startColumn,endColumn:s.endColumn}}if(t===Pt.BOTTOM){let t,e;if(n.startRow===s.startRow){const t=this._workSheet.getCellMatrix().getValue(s.endRow,n.startColumn);if(t&&void 0===t.v)for(let l=s.endRow+1;l<=r;l++){if(l===r){e=r;break}const t=this._workSheet.getCellMatrix().getValue(l,n.startColumn);if(t&&void 0!==t.v){e=l;break}}else for(let l=s.endRow+1;l<=r;l++){if(l===r){e=r;break}const t=this._workSheet.getCellMatrix().getValue(l,n.startColumn);if(t&&void 0===t.v){const t=this._workSheet.getCellMatrix().getValue(l+1,n.startColumn);if(t&&void 0!==t.v){e=l+1;break}}}}else{const e=this._workSheet.getCellMatrix().getValue(s.startRow+1,n.startColumn);if(e&&void 0===e.v)for(let r=s.startRow+1;r<=n.startRow;r++){if(r===n.startRow){t=n.startRow;break}const e=this._workSheet.getCellMatrix().getValue(r,n.startColumn);if(e&&void 0!==e.v){t=r;break}}else for(let r=s.startRow+1;r<=n.startRow;r++){if(r===n.startRow){t=n.startRow;break}const e=this._workSheet.getCellMatrix().getValue(r,n.startColumn);if(e&&void 0===e.v&&r!==s.startRow+1){const e=this._workSheet.getCellMatrix().getValue(r-1,n.startColumn);if(e&&void 0!==e.v){t=r-1;break}}}}l={startRow:void 0!==t?t:s.startRow,endRow:void 0!==e?e:s.endRow,startColumn:s.startColumn,endColumn:s.endColumn}}return l}}function Ir(t){if(!t)return;let{row:e,column:r,startY:s,endY:l,startX:n,endX:o,isMerged:i,mergeInfo:a}=t,g=e,c=r,b=e,h=r;if(i&&a){const{startRow:t,startColumn:e,endRow:r,endColumn:i,startY:d,endY:u,startX:f,endX:v}=a;g=t,c=e,b=r,h=i,s=d,l=u,n=f,o=v}return{startRow:g,startColumn:c,endRow:b,endColumn:h,startY:s,endY:l,startX:n,endX:o}}function Ar(t){if(!t)return!0;return 0===((null==t?void 0:t.m)||"").length&&!t.p}function xr(t){if(t){if(t.rgb)return t.rgb;if(t.th)return(new $e).setThemeColor(t.th).asThemeColor().asRgbColor().getCssString()}return null}function Or(t){var e;let r="";if(null==(e=t.body)?void 0:e.blockElements)for(let s in t.body.blockElements){const e=t.body.blockElements[s];if((e.blockType===E.PARAGRAPH||e.blockType===E.SECTION_BREAK)&&e.blockType===E.PARAGRAPH)for(let t in e.paragraph){const s=e.paragraph[t];for(let t in s){const e=s[t];if(e.et===D.TEXT_RUN){let t=`display:inline-block;${Nr(e.tr.ts)}`;r+=`${e.tr.ct}`}}}}return r}function Nr(t,e=!1){var r;let s="";const l=new Map([["ff",()=>{t.ff&&(s+=`font-family: ${t.ff}; `)}],["fs",()=>{if(t.fs){let e=t.fs;t.va&&(e/=2),s+=`font-size: ${e}pt; `}}],["it",()=>{t.it?s+="font-style: italic; ":s+="font-style: normal; "}],["bl",()=>{t.bl?s+="font-weight: bold; ":s+="font-weight: normal; "}],["ul",()=>{var e;(null==(e=t.ul)?void 0:e.s)&&(s.indexOf("text-decoration-line")>-1?s=s.replace(/(?<=text-decoration-line:.*)\b(?=;)/g," underline"):s+="text-decoration-line: underline; ",t.ul.cl&&-1===s.indexOf("text-decoration-color")&&(s+=`text-decoration-color: ${xr(t.ul.cl)}; `),t.ul.t&&-1===s.indexOf("text-decoration-style")&&(s+=`text-decoration-style: ${t.ul.t} `))}],["st",()=>{var e;(null==(e=t.st)?void 0:e.s)&&(s.indexOf("text-decoration-line")>-1?s=s.replace(/(?<=text-decoration-line:.*)\b(?=;)/g," line-through"):s+="text-decoration-line: line-through; ",t.st.cl&&-1===s.indexOf("text-decoration-color")&&(s+=`text-decoration-color: ${xr(t.st.cl)}; `),t.st.t&&-1===s.indexOf("text-decoration-style")&&(s+=`text-decoration-style: ${t.st.t} `))}],["ol",()=>{var e;(null==(e=t.ol)?void 0:e.s)&&(s.indexOf("text-decoration-line")>-1?s=s.replace(/(?<=text-decoration-line:.*)\b(?=;)/g," overline"):s+="text-decoration-line: overline; ",t.ol.cl&&-1===s.indexOf("text-decoration-color")&&(s+=`text-decoration-color: ${xr(t.ol.cl)}; `),t.ol.t&&-1===s.indexOf("text-decoration-style")&&(s+=`text-decoration-style: ${t.ol.t} `))}],["bg",()=>{s+=`background: ${xr(t.bg)}; `}],["bd",()=>{var e,r,l,n,o,i,a,g,c,b,h,d;(null==(e=t.bd)?void 0:e.b)&&(s+=`border-bottom: ${kr(null==(r=t.bd)?void 0:r.b.s)} ${null!=(l=xr(t.bd.b.cl))?l:""}; `),(null==(n=t.bd)?void 0:n.t)&&(s+=`border-top: ${kr(null==(o=t.bd)?void 0:o.t.s)} ${null!=(i=xr(t.bd.t.cl))?i:""}; `),(null==(a=t.bd)?void 0:a.r)&&(s+=`border-right: ${kr(null==(g=t.bd)?void 0:g.r.s)} ${null!=(c=xr(t.bd.r.cl))?c:""}; `),(null==(b=t.bd)?void 0:b.l)&&(s+=`border-left: ${kr(null==(h=t.bd)?void 0:h.l.s)} ${null!=(d=xr(t.bd.l.cl))?d:""}; `)}],["cl",()=>{s+=`color: ${xr(t.cl)}; `}],["va",()=>{t.va===me.NORMAL?s+="vertical-align: baseline; ":t.va===me.SUBSCRIPT?s+="vertical-align: sub; ":s+="vertical-align: super; "}],["td",()=>{t.td===se.UNSPECIFIED?s+="direction: inherit; ":t.td===se.LEFT_TO_RIGHT?s+="direction: ltr; ":s+="direction: rtl; "}],["tr",()=>{var e,r,l;s+=`data-rotate: (${null==(e=t.tr)?void 0:e.a}deg${(null==(r=t.tr)?void 0:r.v)?` ,${null==(l=t.tr)?void 0:l.v}`:""});`}],["ht",()=>{t.ht===ie.UNSPECIFIED?s+="text-align: inherit; ":t.ht===ie.LEFT?s+="text-align: left; ":t.ht===ie.RIGHT?s+="text-align: right; ":t.ht===ie.CENTER?s+="text-align: center; ":s+="text-align: justify; "}],["vt",()=>{t.vt===ge.UNSPECIFIED?s+="vertical-align: inherit; ":t.vt===ge.BOTTOM?s+="vertical-align: bottom; ":t.vt===ge.TOP?s+="vertical-align: top; ":s+="vertical-align: middle; "}],["tb",()=>{t.tb===be.CLIP?s+="text-overflow: clip; ":t.tb===be.OVERFLOW?s+="text-break: overflow; ":t.tb===be.WRAP&&(s+="word-wrap: break-word; word-break: normal; ")}],["pd",()=>{var e,r,l,n,o,i,a,g;let c=`${null==(e=t.pd)?void 0:e.b}pt`,b=`${null==(r=t.pd)?void 0:r.t}pt`,h=`${null==(l=t.pd)?void 0:l.l}pt`,d=`${null==(n=t.pd)?void 0:n.r}pt`;(null==(o=t.pd)?void 0:o.b)&&(s+=`padding-bottom: ${c}; `),(null==(i=t.pd)?void 0:i.t)&&(s+=`padding-top: ${b}; `),(null==(a=t.pd)?void 0:a.l)&&(s+=`padding-left: ${h}; `),(null==(g=t.pd)?void 0:g.r)&&(s+=`padding-right: ${d}; `)}]]),n=["bd","tr","tb"];for(let o in t)e&&n.includes(o)||null==(r=l.get(o))||r();return s}function kr(t){let e="";return t===Tt.NONE?e="none":t===Tt.THIN?e="0.5pt solid":t===Tt.HAIR?e="0.5pt double":t===Tt.DOTTED?e="0.5pt dotted":t===Tt.DASHED||t===Tt.DASH_DOT?e="0.5pt dashed":t===Tt.DASH_DOT_DOT?e="0.5pt dotted":t===Tt.DOUBLE?e="0.5pt double":t===Tt.MEDIUM?e="1pt solid":t===Tt.MEDIUM_DASHED||t===Tt.MEDIUM_DASH_DOT?e="1pt dashed":t===Tt.MEDIUM_DASH_DOT_DOT?e="1pt dotted":t===Tt.SLANT_DASH_DOT?e="0.5pt dashed":t===Tt.THICK&&(e="1.5pt solid"),e}function Mr(t){let e=0;if("none"===(t=t.trim()))e=Tt.NONE;else if("0.5pt solid"===t)e=Tt.THIN;else if("0.5pt double"===t)e=Tt.HAIR;else if("0.5pt dotted"===t)e=Tt.DOTTED;else if("0.5pt dashed"===t)e=Tt.DASHED;else if("1pt solid"===t)e=Tt.MEDIUM;else if("1pt dashed"===t)e=Tt.MEDIUM_DASHED;else if("1pt dotted"===t)e=Tt.MEDIUM_DASH_DOT_DOT;else{if("1.5pt solid"!==t)return Tt.NONE;e=Tt.THICK}return e}function Dr(t){return t instanceof FormData}const Lr=()=>{},Pr=t=>t;var Hr,Fr,Ur,zr,Wr,Vr;(Fr=Hr||(Hr={})).POST="POST",Fr.GET="GET",Fr.PUT="PUT",Fr.DELETE="DELETE",(zr=Ur||(Ur={}))[zr.UNSENT=0]="UNSENT",zr[zr.OPENED=1]="OPENED",zr[zr.HEADERS_RECEIVED=2]="HEADERS_RECEIVED",zr[zr.LOADING=3]="LOADING",zr[zr.DONE=4]="DONE",(Vr=Wr||(Wr={})).ARRAY_BUFFER="arraybuffer",Vr.BLOB="blob",Vr.TEXT="text",Vr.DOCUMENT="document",Vr.JSON="json",Vr.STREAM="stream";const Gr={type:Hr.POST,url:"",async:!0,header:{},dataType:Wr.JSON,contentType:"application/x-www-form-urlencoded; charset=UTF-8",data:{},username:"",password:"",timeout:500,error:Lr,beforeSend:Pr,dataFilter:Pr,success:Lr,complete:Lr};function Xr(t){return new Promise(((e,r)=>{const s=function(t,...e){for(const r of e)if(r)for(const e in r)r.hasOwnProperty(e)&&null!=r[e]&&(t[e]=r[e]);return t}({},Gr,t),l=new XMLHttpRequest;switch(s.beforeSend(s),l.responseType=s.dataType,l.timeout=s.timeout,l.addEventListener("readystatechange",(t=>{if(4===l.readyState)if(200===l.status){const t=s.dataFilter(l.response);s.success(t),s.complete(),e(t)}else s.error(t),r(t)})),l.addEventListener("timeout",(t=>{s.error(t)})),l.open(s.type,s.url,s.async,s.username,s.password),Object.keys(s.header).forEach((t=>{const e=s.header[t];l.setRequestHeader(t,e)})),Dr(s.data)?l.setRequestHeader("Content-Type","multipart/form-data"):s.contentType&&l.setRequestHeader("Content-Type",s.contentType),s.type){case Hr.DELETE:case Hr.GET:l.send();break;case Hr.POST:case Hr.PUT:if((n=s.data)&&Object.getPrototypeOf(n)===Object.getPrototypeOf({}))return void l.send(JSON.stringify(s.data));if(function(t){return"[object String]"===Object.prototype.toString.apply(t)}(s.data))return void l.send(s.data);if(function(t){return"[object Array]"===Object.prototype.toString.apply(t)}(s.data))return void l.send(JSON.stringify(s.data));Dr(s.data)&&l.send(s.data)}var n}))}var Qr,Kr;(Kr=Qr||(Qr={})).MESSAGE="message",Kr.OPEN="open",Kr.CLOSE="close",Kr.ERROR="error",Kr.RETRY="retry",Kr.DESTROY="destroy";const Zr={url:"",heartbeatTime:3e4},$r="heart_beat_message";class qr{constructor(t){const e=Object.assign(Zr,t);if(function(t){return null==t}(r=e.url)||""===r.toString())throw new Error("url must be input");var r;this._listens=new Map,this._timer=-1,this._config=e}link(){this._create(),this._bind()}send(t){this._socket.send(t)}destroy(){const t=this._listens.get(Qr.DESTROY);t&&t(),this._clear(),this._listens.clear()}on(t,e){this._listens.set(t,e)}close(){this._socket&&this._socket.close()}_create(){const{_config:t}=this;this._socket=new WebSocket(t.url)}_bind(){this._socket.addEventListener(Qr.MESSAGE,this._message.bind(this)),this._socket.addEventListener(Qr.OPEN,this._open.bind(this)),this._socket.addEventListener(Qr.CLOSE,this._close.bind(this)),this._socket.addEventListener(Qr.ERROR,this._error.bind(this))}_message(t){const e=this._listens.get(Qr.MESSAGE);e&&e(t)}_open(t){const e=this._listens.get(Qr.OPEN);e&&(e(t),this._heartbeat())}_error(t){const e=this._listens.get(Qr.ERROR);e&&(e(t),this._retry())}_close(t){const e=this._listens.get(Qr.CLOSE);e&&(e(t),this.destroy())}_clear(){this._timer>-1&&clearInterval(this._timer),this._timer=-1,this._socket.removeEventListener(Qr.MESSAGE,this._message.bind(this)),this._socket.removeEventListener(Qr.OPEN,this._open.bind(this)),this._socket.removeEventListener(Qr.CLOSE,this._close.bind(this)),this._socket.removeEventListener(Qr.ERROR,this._error.bind(this))}_heartbeat(){const{_socket:t,_config:e}=this,{heartbeatTime:r}=e;this._timer=setInterval((function(){t.send($r)}),r)}_retry(){const t=this._listens.get(Qr.RETRY);t&&t(),this._clear(),this._create(),this._bind()}}const Jr=Object.keys(He).reduce(((t,e)=>[...t,...He[e]]),[]);function ts(t){return-1===Jr.indexOf(t)}const es={},rs={};class ss{static getValue(t,e){try{return t[e]?t[e]:e.split(".").reduce(((t,e)=>t[e]),t)}catch(r){console.error("Key %s not found",e)}}initialize(t){this.options={currentLocale:t||["zh","zh-CN"].includes(B.getLanguage())?Kt.ZH:Kt.EN,locales:{zh:es,en:rs}}}get(t){if(t){const{locales:e,currentLocale:r}=this.options;return ss.getValue(e[r],t)||t}return String()}getObject(t){const{locales:e,currentLocale:r}=this.options;return ss.getValue(e[r],t)}load(t){B.deepMerge(this.options.locales,t)}change(t){this.options.currentLocale=t}getCurrentLocale(){return this.options.currentLocale}}class ls{static log(...t){console&&console.log(...t)}static info(...t){console&&console.info(...t)}static error(...t){console&&console.error(...t)}static warn(...t){console&&console.warn(...t)}static br(){ls.info("\n")}static capsule(t,e,r="",s=""){console&&console.log(`%c${r}%c${t}%c${e}%c${s}`,"","padding:3px;color:white;background:#023047","padding:3px;color:white;background:#219EBC","")}}class ns{constructor(){this._include=[],this._count=1}checked(t){return this._include.includes(t)}onlyName(t){let e=t,r=1;for(;this.checked(e);)e=t+r,r++;return this._include.push(e),e}sheetName(t="sheet1"){let e=t;for(;this.checked(e);)e=`sheet${this._count}`,this._count++;return this._include.push(e),e}}class os{static hasLength(t,e){return t.length===e}static getValueType(t){return Object.prototype.toString.apply(t)}static isObject(t){return"[object Object]"===this.getValueType(t)}static isIterable(t){return null!=t[Symbol.iterator]}static isNumber(t){return"[object Number]"===this.getValueType(t)}}const is=Symbol("newer"),as=Symbol("older");class gs{constructor(t){this.entry=t}[Symbol.iterator](){return this}next(){let t=this.entry;return t?(this.entry=t[is],{done:!1,value:t.key}):{done:!0,value:void 0}}}class cs{constructor(t){this.entry=t}[Symbol.iterator](){return this}next(){let t=this.entry;return t?(this.entry=t[is],{done:!1,value:t.value}):{done:!0,value:void 0}}}class bs{constructor(t){this.entry=t}[Symbol.iterator](){return this}next(){let t=this.entry;return t?(this.entry=t[is],{done:!1,value:[t.key,t.value]}):{done:!0,value:void 0}}}class hs{constructor(t,e){this.key=t,this.value=e,this[is]=void 0,this[as]=void 0}toJSON(){return{key:this.key,value:this.value}}}class ds{constructor(...t){if(os.hasLength(t,1)){if(os.isNumber(t[0])){const e=t[0];return void this._initialize(e,void 0)}if(os.isIterable(t[0])){const e=t[0];return void this._initialize(0,e)}}else if(os.hasLength(t,2)){const e=t[0],r=t[1];this._initialize(e,r)}}_initialize(t,e){this.oldest=void 0,this.newest=void 0,this.size=0,this.limit=t,this._keymap=new Map,e&&(this.assign(e),t<1&&(this.limit=this.size))}_markEntryAsUsed(t){t!==this.newest&&(t[is]&&(t===this.oldest&&(this.oldest=t[is]),t[is][as]=t[as]),t[as]&&(t[as][is]=t[is]),t[is]=void 0,t[as]=this.newest,this.newest&&(this.newest[is]=t),this.newest=t)}assign(t){let e,r=this.limit||Number.MAX_VALUE;this._keymap.clear();let s=t[Symbol.iterator]();for(let l=s.next();!l.done;l=s.next()){let t=new hs(l.value[0],l.value[1]);if(this._keymap.set(t.key,t),e?(e[is]=t,t[as]=e):this.oldest=t,e=t,0==r--)throw new Error("overflow")}this.newest=e,this.size=this._keymap.size}set(t,e){let r=this._keymap.get(t);return r?(r.value=e,this._markEntryAsUsed(r),this):(this._keymap.set(t,r=new hs(t,e)),this.newest?(this.newest[is]=r,r[as]=this.newest):this.oldest=r,this.newest=r,++this.size,this.size>this.limit&&this.shift(),this)}shift(){let t=this.oldest;if(t)return this.oldest&&this.oldest[is]?(this.oldest=this.oldest[is],this.oldest[as]=void 0):(this.oldest=void 0,this.newest=void 0),t[is]=t[as]=void 0,this._keymap.delete(t.key),--this.size,[t.key,t.value]}get(t){const e=this._keymap.get(t);if(e)return this._markEntryAsUsed(e),e.value}has(t){return this._keymap.has(t)}find(t){let e=this._keymap.get(t);return e?e.value:void 0}delete(t){let e=this._keymap.get(t);if(e)return this._keymap.delete(e.key),e[is]&&e[as]?(e[as][is]=e[is],e[is][as]=e[as]):e[is]?(e[is][as]=void 0,this.oldest=e[is]):e[as]?(e[as][is]=void 0,this.newest=e[as]):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 gs(this.oldest)}values(){return new cs(this.oldest)}entries(){return this[Symbol.iterator]()}[Symbol.iterator](){return new bs(this.oldest)}forEach(t,e){"object"!=typeof e&&(e=this);let r=this.oldest;for(;r;)t.call(e,r.value,r.key,this),r=r[is]}toJSON(){let t=new Array(this.size),e=0,r=this.oldest;for(;r;)t[e++]={key:r.key,value:r.value},r=r[is];return t}toString(){let t=String(),e=this.oldest;for(;e;)t+=`${String(e.key)}:${e.value}`,e=e[is],e&&(t+=" < ");return t}}function us(t,e){var r,s,l,n,o,i,a,g,c,b,h,d,u,f,v,m,p,_,B,C,w,T,y,S,j,E,Y,R,I,A,x,O,N,k,M,D,L,P,H,F,U,z,W,V,G,X,Q,K,Z,$,q,J,tt,et,rt,st,lt,nt,ot,it,at,gt,ct,bt,ht,dt;t.cellData={};for(let ut of e.config.borderInfo)if("cell"===ut.rangeType){const e=ut.value.row_index,u=ut.value.col_index;t.cellData[String(e)]||(t.cellData[String(e)]={}),t.cellData[String(e)][String(u)]||(t.cellData[String(e)][String(u)]={}),t.cellData[String(e)][String(u)].s||(t.cellData[String(e)][String(u)].s={});const f={};ut.value.l&&(f.l={s:ut.value.l.style,cl:{rgb:ut.value.l.color}},t.cellData[String(e)]&&(null==(l=null==(s=null==(r=t.cellData[String(e)][String(u-1)])?void 0:r.s)?void 0:s.bd)?void 0:l.r)&&delete t.cellData[String(e)][String(u-1)].s.bd.r),ut.value.r&&(f.r={s:ut.value.r.style,cl:{rgb:ut.value.r.color}},t.cellData[String(e)]&&(null==(i=null==(o=null==(n=t.cellData[String(e)][String(Number(u)+1)])?void 0:n.s)?void 0:o.bd)?void 0:i.l)&&delete t.cellData[String(e)][String(u-1)].s.bd.l),ut.value.t&&(f.t={s:ut.value.t.style,cl:{rgb:ut.value.t.color}},t.cellData[String(e-1)]&&(null==(c=null==(g=null==(a=t.cellData[String(e)][String(u)])?void 0:a.s)?void 0:g.bd)?void 0:c.b)&&delete t.cellData[String(e)][String(u-1)].s.bd.b),ut.value.b&&(f.b={s:ut.value.b.style,cl:{rgb:ut.value.b.color}},t.cellData[String(Number(e)+1)]&&(null==(d=null==(h=null==(b=t.cellData[String(e)][String(u)])?void 0:b.s)?void 0:h.bd)?void 0:d.t)&&delete t.cellData[String(e)][String(u-1)].s.bd.t),t.cellData[String(e)][String(u)].s.bd=Object.assign(t.cellData[String(e)][String(u)].s.bd||{},f)}else if("range"===ut.rangeType)for(const e of ut.range){const r=e.row[0],s=e.row[1],l=e.column[0],n=e.column[1];switch(ut.borderType){case"border-left":for(let e=r;e<=s;e++)for(let r=l;r{var r;null==(r=t.selections)||r.push({startRow:e.row[0],endRow:e.row[1],startColumn:e.column[0],endColumn:e.column[1]})}))),s.hasOwnProperty("scrollLeft")&&(t.scrollLeft=s.scrollLeft),s.hasOwnProperty("scrollTop")&&(t.scrollTop=s.scrollTop),s.hasOwnProperty("config")){if(s.config.merge){t.mergeData=[];for(const e of Object.keys(s.config.merge)){const r=s.config.merge[e],l={startRow:r.r,endRow:r.r+r.rs-1,startColumn:r.c,endColumn:r.c+r.cs-1};t.mergeData.push(l)}}if(s.config.borderInfo&&us(t,s),s.config.rowlen){t.rowData={};for(const[e,r]of Object.entries(s.config.rowlen))t.rowData[String(e)]={h:r,hd:0}}if(s.config.columnlen){t.columnData={};for(const[e,r]of Object.entries(s.config.columnlen))t.columnData[String(e)]={w:r,hd:0}}if(s.config.rowhidden){t.rowData||(t.rowData={});for(const[e,r]of Object.entries(s.config.rowhidden))t.rowData[String(e)]||(t.rowData[String(e)]={}),t.rowData[String(e)].hd=r}if(s.config.colhidden){t.columnData||(t.columnData={});for(const[e,r]of Object.entries(s.config.colhidden))t.columnData[String(e)]||(t.columnData[String(e)]={}),t.columnData[String(e)].hd=r}}if(s.hasOwnProperty("celldata")){t.cellData||(t.cellData={});for(const r of s.celldata){t.cellData[r.r]||(t.cellData[r.r]={}),t.cellData[r.r][r.c]||(t.cellData[r.r][r.c]={});const s=r.v,l=t.cellData[r.r][r.c];if("inlineStr"===(null==(e=null==s?void 0:s.ct)?void 0:e.t)){const t=[];s.ct.s.forEach((e=>{const r={};e.hasOwnProperty("bg")&&(r.bg={rgb:e.fc}),e.hasOwnProperty("ff")&&(r.ff=e.ff),e.hasOwnProperty("fc")&&(r.cl={rgb:e.fc}),e.hasOwnProperty("fs")&&(r.fs=e.fs),e.hasOwnProperty("bl")&&(r.bl=e.bl),e.hasOwnProperty("it")&&(r.it=e.it),e.hasOwnProperty("cl")&&(r.st={s:1}),e.hasOwnProperty("un")&&(r.ul={s:e.un});const s=B.generateRandomId(6);t.push({eId:s,st:0,ed:e.v.length-1,et:0,tr:{ct:e.v,ts:r}})})),l.p={id:B.generateRandomId(6),body:{blockElements:[{blockId:"p1",st:0,ed:s.ct.s.length-1,blockType:0,paragraph:{elements:t}}]},documentStyle:{}}}else{s.hasOwnProperty("v")&&(l.v=s.v),s.hasOwnProperty("m")?l.m=s.m:l.m=String(s.v||"");const t={};s.hasOwnProperty("bg")&&(t.bg={rgb:s.bg}),s.hasOwnProperty("ff")&&(t.ff=s.ff),s.hasOwnProperty("fc")&&(t.cl={rgb:s.fc}),s.hasOwnProperty("fs")&&(t.fs=s.fs),s.hasOwnProperty("bl")&&(t.bl=s.bl),s.hasOwnProperty("it")&&(t.it=s.it),s.hasOwnProperty("cl")&&(t.st={s:s.cl}),s.hasOwnProperty("un")&&(t.ul={s:s.un});const e={0:2,1:1,2:3};if(s.hasOwnProperty("vt")&&(t.vt=e[String(s.vt)]),s.hasOwnProperty("ht")&&(t.ht=e[String(s.ht)]),s.hasOwnProperty("tr"))switch(s.tr){case"0":t.tr={a:0,v:0};break;case"1":t.tr={a:45,v:0};break;case"2":t.tr={a:-45,v:0};break;case"3":t.tr={a:0,v:1};break;case"4":t.tr={a:90,v:0};break;case"5":t.tr={a:-90,v:0}}s.hasOwnProperty("rt")&&(t.tr={a:s.tr,v:0}),s.hasOwnProperty("tb")&&(t.tb=e[String(s.tb)]),l.s=Object.assign(l.s||{},t)}}}r.sheets[t.id]=t}}return r}class vs{constructor(...t){if(B.hasLength(t,0))return this.startRow=0,this.startColumn=0,this.endRow=0,void(this.endColumn=0);if(B.hasLength(t,1)){const e=t[0];return this.startRow=e.startRow,this.startColumn=e.startColumn,this.endRow=e.endRow,void(this.endColumn=e.endColumn)}if(B.hasLength(t,4)){const e=t[0],r=t[1],s=t[2],l=t[3];this.startRow=e,this.startColumn=r,this.endRow=s,this.endColumn=l}}static equals(t,e){return t.endRow===e.endRow&&t.endColumn===e.endColumn&&t.startRow===e.startRow&&t.startColumn===e.startColumn}static intersects(t,e){const r=t.startRow,s=t.endRow,l=t.startColumn,n=t.endColumn,o=e.startRow,i=e.endRow,a=e.startColumn,g=e.endColumn,c=Math.abs(l+n-a-g),b=Math.abs(l-n)+Math.abs(a-g),h=Math.abs(r+s-o-i),d=Math.abs(r-s)+Math.abs(o-i);return c<=b&&h<=d}intersects(t){return vs.intersects(this,t)}union(t){const{startRow:e,startColumn:r,endRow:s,endColumn:l}=this;return new vs(t.startRows?t.endRow:s,t.endColumn>l?t.endColumn:l)}getData(){return{startRow:this.startRow,startColumn:this.startColumn,endRow:this.endRow,endColumn:this.endColumn}}equals(t){return vs.equals(this,t)}}const ms=/[^0-9]/g,ps=/[^A-Za-z]/g;function _s(t){return{row:parseInt(t.replace(ms,""))-1,column:B.ABCatNum(t.replace(ps,""))}}const Bs="A".charCodeAt(0),Cs="Z".charCodeAt(0),ws="a".charCodeAt(0);function Ts(t){const e=Cs-Bs+1;let r="";for(;t>=0;)r=String.fromCharCode(t%e+Bs)+r,t=Math.floor(t/e)-1;return r}function ys(t,e){let r="";for(;e>0;)r+=t,e--;return r}function Ss(t,e=!1){const r=Cs-Bs+1;let s=ws;e&&(s=Bs);return ys(String.fromCharCode(t%r+s),Math.floor(t/r)+1)}class js{static fromSequence(t){if(B.isObject(t)&&js.requiredNewInstance(this)){return this.newInstance(t)}if(B.isArray(t)&&js.requiredNewInstance(this)){const e=this;return t.map((t=>e.newInstance(t)))}return[]}toSequence(){return{className:B.getClassName(this)}}}function Es(t,e){return t.zIndex>e.zIndex?1:t.zIndex===e.zIndex?0:-1}function Ys(t,e){return t.zIndex>e.zIndex?-1:t.zIndex===e.zIndex?0:1}(js||(js={})).requiredNewInstance=function(t){if(B.isDefine(t.newInstance))return!0;throw new Error("sequence newInstance need subclass implement!")};const Rs=class{static checkup(t,...e){if(t.length!==e.length)return!1;const r=t.length;for(let s=0;sxs(t[r],e[r]))):t===e)}As.RegisteredTypes={};class Os{constructor(t,e,r){this.path=t,this.namespace=e,this.observable=r}}class Ns{constructor(){this._observableArray=[]}hasObserver(t,e){return null!=this.getObserver(t,e)}getObserver(...t){if(1===t.length){const e=t[0],r=this._observableArray.find((t=>t.path===e));return r?r.observable:null}if(2===t.length){const e=t[0],r=t[1],s=this._observableArray.find((t=>t.path===e&&t.namespace===r));return s?s.observable:null}}requiredObserver(...t){if(B.hasLength(t,1)){const e=t[0],r=this.getObserver(e);if(null==r)throw new Error(`not found observable ${e}`);return r}if(B.hasLength(t,2)){const e=t[0],r=t[1],s=this.getObserver(e,r);if(null==s)throw new Error(`not found observable ${e}`);return s}throw new Error("requiredObserver arguments error")}removeObserver(...t){if(B.hasLength(t,1)){const e=t[0],r=this._observableArray.findIndex((t=>t.path===e));r>-1&&this._observableArray.splice(r,1)}else if(B.hasLength(t,2)){const e=t[0],r=t[1],s=this._observableArray.findIndex((t=>t.path===e&&t.namespace===r));s>-1&&this._observableArray.splice(s,1)}}addObserver(...t){if(1===t.length){const e=t[0],r=t[1];return this.hasObserver(e,e)&&this.removeObserver(e),void this._observableArray.push(new Os(e,e,r))}if(3===t.length){const e=t[0],r=t[1],s=t[2];this.hasObserver(e,e)&&this.removeObserver(e,r),this._observableArray.push(new Os(e,r,s))}}}var ks,Ms;(Ms=ks||(ks={}))[Ms.REDO=0]="REDO",Ms[Ms.UNDO=1]="UNDO";class Ds extends o{}class Ls extends o{}class Ps extends o{}class Hs{constructor(t){this._undoManager=t.getUndoManager(),this._actionExtensionManager=new Ws}static staticInitialize(){this._actionClass=new Map,this._actionObservers=new Ds,this._commandObservers=new Ps,this._commandInjectorObservers=new Ls}static getAction(t){return this._actionClass[t]}static getActionObservers(){return this._actionObservers}static getCommandObservers(){return this._commandObservers}static register(t,e){this._actionClass[t]=e}static getCommandInjectorObservers(){return this._commandInjectorObservers}getActionExtensionManager(){return this._actionExtensionManager}undo(){const{_undoManager:t}=this,e=t.undo();e&&e.undo()}redo(){const{_undoManager:t}=this,e=t.redo();e&&e.redo()}invoke(t){const{_undoManager:e}=this,{_actionDataList:r,_unit:s,_actionList:l}=t;this._actionExtensionManager.handle(r),r.forEach((t=>{const e=Hs.getAction(t.actionName),r=Hs.getActionObservers(),n=new e(t,s,r);l.push(n)})),t.invoke(),e.push(t)}}Hs.staticInitialize();class Fs extends s{constructor(t,e,r){if(super(t,r),null==e.WorkBookUnit)throw new Error("action workbook domain can not be null!");this._commandUnit=e,this._workbook=e.WorkBookUnit}getWorkSheet(){const{_workbook:t,_doActionData:e}=this,{sheetId:r}=e;return t.getSheetBySheetId(r)}getWorkBook(){return this._workbook}}class Us{constructor(t,...e){this._unit=t,this._actionDataList=e,this._actionList=[]}getDoData(){return this._actionList.map((t=>t.getDoActionData()))}getOldData(){return this._actionList.map((t=>t.getOldActionData()))}getInjector(){const t=this;return new class{injectAction(e){t._actionList.push(e)}getActions(){return t._actionList.concat([])}include(e){for(let r=0;r{Zs.hasUndo(t.getDoActionData())&&t.redo()})),Hs.getCommandObservers().notifyObservers({type:ks.REDO,actions:this._actionList})}undo(){this._actionList.reverse().forEach((t=>{Zs.hasUndo(t.getOldActionData())&&t.undo()})),Hs.getCommandObservers().notifyObservers({type:ks.UNDO,actions:this._actionList})}invoke(){Hs.getCommandInjectorObservers().notifyObservers(this.getInjector()),Hs.getCommandObservers().notifyObservers({type:ks.REDO,actions:this._actionList})}}class zs{constructor(){this._undoStack=[],this._redoStack=[]}push(t){this._redoStack.push(t)}undo(){const t=this._redoStack.pop();if(t)return this._undoStack.push(t),t}redo(){const t=this._undoStack.pop();if(t)return this._redoStack.push(t),t}}class Ws{constructor(){this._register=new Ks,this._register.initialize()}getRegister(){return this._register}handle(t){var e;const r=null==(e=this._register)?void 0:e.actionExtensionFactoryList;r&&(this._actionExtensionFactoryList=r,0!==t.length&&this._checkExtension(t))}_checkExtension(t){if(!this._actionExtensionFactoryList)return!1;this._actionExtensionFactoryList.forEach((e=>{const r=e.check(t);!1!==r&&r.execute()}))}}class Vs{constructor(t,e){this.actionDataList=t,this._plugin=e}getActionDataList(){return this.actionDataList}push(t){this.actionDataList.push(t)}setValue(){}execute(){}}class Gs{constructor(t){this._plugin=t}get zIndex(){return 0}create(t){return new Vs(t,this._plugin)}check(t){return this.create(t)}}class Xs{constructor(){this._data=[]}static create(){return new Xs}add(t){this._data.push(t)}delete(t){const e=this._data.indexOf(t);this._data.splice(e,1)}getData(){return this._data}}const Qs=Xs.create();class Ks{constructor(){this._actionExtensionFactoryList=[]}get actionExtensionFactoryList(){return this._actionExtensionFactoryList}initialize(){this._initExtensions()}add(...t){this._actionExtensionFactoryList.push(...t),this._actionExtensionFactoryList.sort(Es)}delete(t){const e=this._actionExtensionFactoryList.indexOf(t);this._actionExtensionFactoryList.splice(e,1)}_initExtensions(){this._actionExtensionFactoryList.push(...Qs.getData().sort(Es))}}class Zs{constructor(t){this._action=t}static hasObserver(t){return!t.operation||(t.operation&e.OBSERVER_ACTION)===e.OBSERVER_ACTION}static hasUndo(t){return!t.operation||(t.operation&e.UNDO_ACTION)===e.UNDO_ACTION}static hasCollaboration(t){return!t.operation||(t.operation&e.SERVER_ACTION)===e.SERVER_ACTION}static hasExtension(t){return!t.operation||(t.operation&e.EXTENSION_ACTION)===e.EXTENSION_ACTION}static make(t){return t.operation=e.DEFAULT_ACTION,new Zs(t)}removeObserver(){return this._action.operation&&(this._action.operation&=~e.OBSERVER_ACTION),this}removeUndo(){return this._action.operation&&(this._action.operation&=~e.UNDO_ACTION),this}removeCollaboration(){return this._action.operation&&(this._action.operation&=~e.SERVER_ACTION),this}removeExtension(){return this._action.operation&&(this._action.operation&=~e.EXTENSION_ACTION),this}getAction(){return this._action}}function $s(t,e){var r;let s=null==(r=null==t?void 0:t.WorkBookUnit)?void 0:r.getSheetBySheetId(e.sheetId);if(s){let t=s.getConfig().mergeData,r=e.rectangles;for(let e=0;et.namedRangeId===e.namedRangeId?(s.splice(r,1),t):null))}function el(t,e){var r,s,l;const n=null==(r=t.WorkBookUnit)?void 0:r.getSheetBySheetId(e.sheetId),o=null==n?void 0:n.getCellMatrix(),i={rowCount:null==n?void 0:n.getConfig().rowCount,columnCount:null==n?void 0:n.getConfig().columnCount},{startRow:a,endRow:g,startColumn:c,endColumn:b}=e.rangeData,h=g-a+1,d=b-c+1,u=null!=(s=i.rowCount)?s:0,f=null!=(l=i.columnCount)?l:0,m=new v;if(e.shiftDimension===Dt.ROWS)for(let v=a;v<=u;v++)for(let t=c;t<=b;t++){if(v<=g){const e=null==o?void 0:o.getValue(v,t);m.setValue(v,t,e)}const e=null==o?void 0:o.getValue(v+h,t);if(e)null==o||o.setValue(v,t,B.deepClone(e));else{(null==o?void 0:o.getValue(v,t))&&(null==o||o.deleteValue(v,t),t--)}}else if(e.shiftDimension===Dt.COLUMNS)for(let v=a;v<=g;v++)for(let t=c;t<=f;t++){if(t<=b){const e=null==o?void 0:o.getValue(v,t);m.setValue(v,t,e)}else for(let r=0;r<=b;r++){const e=null==o?void 0:o.getValue(v,t);m.setValue(v,t+r,e)}const e=null==o?void 0:o.getValue(v,t+d);if(e)null==o||o.setValue(v,t,B.deepClone(e));else{if(null==o?void 0:o.getValue(v,t)){for(let e=0;e<=b;e++)null==o||o.deleteValue(v,t);break}}}return m.getData()}function rl(t,e){const r=t.getConfig(),s=r.hidden;return r.hidden=e,s}function sl(t,e){const r=t.WorkBookUnit.getSheetBySheetId(e.sheetId).getColumnManager().getColumnData().toJSON();new u(r).inserts(e.columnIndex,new u(e.columnCount))}function ll(t,e){const r=t.WorkBookUnit.getSheetBySheetId(e.sheetId).getCellMatrix().toJSON();new v(r).insertColumns(e.columnIndex,new v(e.columnData))}function nl(t,e){const r=t.WorkBookUnit.getSheetBySheetId(e.sheetId).getCellMatrix().toJSON();new v(r).insertRows(e.rowIndex,new v(e.rowData))}function ol(t,e){const r=t.WorkBookUnit.getSheetBySheetId(e.sheetId),s=r.getLastRow(),l=r.getLastColumn(),n=r.getCellMatrix(),{startRow:o,endRow:i,startColumn:a,endColumn:g}=e.rangeData,c=i-o+1,b=g-a+1,h=s,d=l;if(e.shiftDimension===Dt.ROWS){for(let t=h;t>=o;t--)for(let e=a;e<=g;e++){const r=n.getValue(t,e);n.setValue(t+c,e,r)}for(let t=i;t>=o;t--)for(let r=a;r<=g;r++)n.setValue(t,r,e.cellValue[t-o][r-a])}else if(e.shiftDimension===Dt.COLUMNS){for(let t=o;t<=i;t++)for(let e=d;e>=a;e--){const r=n.getValue(t,e);n.setValue(t,e+b,r)}for(let t=o;t<=i;t++)for(let r=g;r>=a;r--)n.setValue(t,r,e.cellValue[t-o][r-a])}}function il(t,e){const r=t.WorkBookUnit.getSheetBySheetId(e.sheetId).getRowManager().getRowData().toJSON();new u(r).inserts(e.rowIndex,new u(e.rowCount))}function al(t,e){t.WorkBookUnit.getSheetBySheetId(e.sheetId);const r=e.index,s=e.sheet,l=t.WorkBookUnit.getWorksheets(),n=t.WorkBookUnit.getConfig(),{sheets:o,sheetOrder:i}=n;if(o[s.id])throw new Error(`Insert Sheet fail ${s.id} is already exist`);return o[s.id]=s,i.splice(r,0,s.id),l.set(s.id,new yr(t.WorkBookUnit.getContext(),s)),s.id}function gl(t,e){const r=t.WorkBookUnit.getSheetBySheetId(e.sheetId).getColumnManager().getColumnData().toJSON(),s=new u(r),l=new u,n=e.columnIndex,o=e.columnIndex+e.columnCount;for(let i=n;i=0;r--){let n=s[r],o=l[e];vs.intersects(n,o)&&t.push(s.splice(r,1)[0])}return t}return[]}function hl(t,e){const r=t.WorkBookUnit.getSheetBySheetId(e.sheetId).getRowManager().getRowData().toJSON(),s=new u(r),l=new u,n=e.rowIndex,o=e.rowIndex+e.rowCount;for(let i=n;it===s));return delete o[s],n.sheetOrder.splice(a,1),l.delete(s),{index:a,sheet:i}}function fl(t,e){const r=t.WorkBookUnit,s=r.getSheetBySheetId(e.sheetId),l=r.getStyles(),n=s.getCellMatrix(),o=new v(e.styles),i=new v;return o.forValue(((t,e,r)=>{const s=n.getValue(t,e);if(s){const n=l.get(s.s);n&&i.setValue(t,e,n),s.s=l.setValue(r)}})),i.toJSON()}function vl(t,e){const r=t.WorkBookUnit.getSheetBySheetId(e.sheetId),s=e.columnIndex,l=e.columnCount,n=r.getColumnManager();for(let o=s;ot.namedRangeId===s.namedRangeId?(l[e]=s,t):null))}function wl(t,e,r,s){const{startRow:l,endRow:n,startColumn:o,endColumn:i}=r,a=new v;for(let g=l;g<=n;g++)for(let r=o;r<=i;r++){const n=t.getValue(g,r)||{},i=s.getStyleByCell(n);null==i&&delete n.s;const c=jl(i,e[g-l][r-o]);c&&B.removeNull(c),B.isEmptyObject(c)?delete n.s:n.s=s.setValue(c),n.p&&El(n.p,e[g-l][r-o]),t.setValue(g,r,n),a.setValue(g-l,r-o,Tl(i,e[g-l][r-o]))}return a.getData()}function Tl(t,e){return yl(t,e)}function yl(t,e){if(!e||!Object.keys(e).length)return t;const r=B.deepClone(t)||{};for(const s in e)"bd"===s?r[s]=Sl(r[s]||{},e[s]):s in r||(r[s]=null);return r}function Sl(t,e){if(!e||!Object.keys(e).length)return t;for(const r in e)r in t||(t[r]=null);return t}function jl(t,e,r=!1){if(null===e)return e;if(void 0===e)return t;const s=B.deepClone(t)||{};for(const l in e)r&&["bd","tr","td","ht","vt","tb","pd"].includes(l)||(l in s&&"bd"===l?s[l]=Object.assign(s[l],e[l]):(s[l]=e[l],"cl"in s&&["ul","ol","st"].includes(l)&&(s[l].cl=s.cl)));return s}function El(t,e){var r;null==(r=t.body)||r.blockElements.forEach((t=>{if(0===t.blockType){const r=t.paragraph;null==r||r.elements.forEach((t=>{t.tr||(t.tr={});const r=t.tr;r.ts||(r.ts={});const s=jl(r.ts,e,!0);s&&B.removeNull(s),B.isEmptyObject(s)?delete r.ts:r.ts=s}))}}))}function Yl(t,e){const r=t.WorkBookUnit,s=r.getSheetBySheetId(e.sheetId).getCellMatrix(),l=e.options,n=e.cellValue,o=r.getStyles(),i=new v(n),a=new v;return l?(i.forValue(((t,e,r)=>{const n=s.getValue(t,e),o={};l.contentsOnly&&(o.m=null==n?void 0:n.m,o.v=null==n?void 0:n.v),l.formatOnly&&(o.v=null==n?void 0:n.v,o.m=null==n?void 0:n.m),a.setValue(t,e,o||{}),s.setValue(t,e,r||{})})),a.getData()):(i.forValue(((t,e,r)=>{const l=s.getValue(t,e)||{};if(r){const n=o.getStyleByCell(l),i=Tl(n,null==r?void 0:r.s),g=B.deepClone(l);g.s=i,a.setValue(t,e,g),null==n&&delete l.s;const c=jl(n,null==r?void 0:r.s);c&&B.removeNull(c),B.isEmptyObject(c)?delete l.s:l.s=o.setValue(c),null!=r.v&&(l.v=r.v),null!=r.m?l.m=r.m:l.m=String(l.v),null!=r.t&&(l.t=r.t),s.setValue(t,e,l)}else s.setValue(t,e,r),a.setValue(t,e,l)})),a.getData())}function Rl(t,e,r){const s=new v(e),l=new v;for(let n=r.startRow;n<=r.endRow;n++)for(let e=r.startColumn;e<=r.endColumn;e++){const r=s.getValue(n,e),l=t.getValue(n,e),o=B.deepClone(l||{});o.n=r,t.setValue(n,e,o||{})}return l.getData()}function Il(t,e,r){const s=new v(e),l=new v;for(let n=r.startRow;n<=r.endRow;n++)for(let e=r.startColumn;e<=r.endColumn;e++){const r=s.getValue(n,e),o=t.getValue(n,e);l.setValue(n,e,o&&o.v||"");const i=B.deepClone(o||{});i.v=r,i.m=`${r}`,t.setValue(n,e,i||{})}return l.getData()}function Al(t,e){const r=t.getConfig(),s=r.rightToLeft;return r.rightToLeft=e,s}function xl(t=0,e,r){const s=[];for(let l=t;lt===e)),n=s.sheetOrder.filter((t=>t!==e));return n.splice(r,0,e),s.sheetOrder=n,l}function kl(t=0,e,r){for(let s=t;s{const e=t.getSheetId();t.getConfig().status=e===o?_e.TRUE:_e.FALSE})),{oldSheetId:s,status:l}}function Ll(t,e){const r=t.getConfig(),s=r.name;return r.name=e,s}function Pl(t,e){const r=t.getConfig(),s=r.status;return r.status=e,s}function Hl(t,e,r){const s=t.getSheetBySheetId(e);if(s){const t=s.getConfig().zoomRatio;return s.getConfig().zoomRatio=r,t}return 1}class Fl extends Fs{constructor(t,e,r){super(t,e,r),this._doActionData=__spreadValues({},t),this._oldActionData=__spreadProps(__spreadValues({},t),{rectangles:this.do()}),this.validate()}do(){return $s(this._commandUnit,this._doActionData)}redo(){this.do()}undo(){bl(this._commandUnit,this._oldActionData)}validate(){return!1}}Fl.NAME="AddMergeAction",Hs.register(Fl.NAME,Fl);class Ul extends Fs{constructor(t,e,r){super(t,e,r),this._doActionData=__spreadValues({},t),this._oldActionData={actionName:Wl.NAME,sheetId:t.sheetId,namedRange:this.do()},this.validate()}do(){const t=tl(this._commandUnit,this._doActionData);return this._observers.notifyObservers({type:ks.REDO,data:this._doActionData,action:this}),t}redo(){const{sheetId:t}=this._doActionData;this._oldActionData={sheetId:t,actionName:Wl.NAME,namedRange:this.do()}}undo(){qs(this._commandUnit,this._oldActionData),this._observers.notifyObservers({type:ks.UNDO,data:this._oldActionData,action:this})}validate(){return!1}}Ul.NAME="DeleteNamedRangeAction",Hs.register(Ul.NAME,Ul);const zl=class extends Fs{constructor(t,e,r){super(t,e,r),this._doActionData=__spreadValues({},t),this.do(),this._oldActionData={actionName:Ul.NAME,sheetId:t.sheetId,namedRangeId:t.namedRange.namedRangeId},this.validate()}do(){qs(this._commandUnit,this._doActionData),this._observers.notifyObservers({type:ks.REDO,data:this._doActionData,action:this})}redo(){this.do()}undo(){const{sheetId:t}=this._oldActionData;this._doActionData={actionName:zl.NAME,sheetId:t,namedRange:tl(this._commandUnit,this._oldActionData)},this._observers.notifyObservers({type:ks.UNDO,data:this._oldActionData,action:this})}validate(){return!1}};let Wl=zl;var Vl,Gl;Wl.NAME="AddNamedRangeAction",Hs.register(Wl.NAME,Wl),(Gl=Vl||(Vl={})).DEFAULT="default",Gl.PASTE="paste";const Xl=class extends Fs{constructor(t,e,r){super(t,e,r),this._doActionData=__spreadValues({},t),this._oldActionData=__spreadProps(__spreadValues({},t),{cellValue:this.do()}),this.validate()}do(){const t=Yl(this._commandUnit,this._doActionData);return this._observers.notifyObservers({type:ks.REDO,data:this._doActionData,action:this}),t}redo(){const{sheetId:t,options:e}=this._doActionData;this._oldActionData={actionName:Xl.NAME,sheetId:t,cellValue:this.do(),options:e}}undo(){const{sheetId:t,cellValue:e,options:r}=this._oldActionData,s=this.getWorkSheet();this._workbook.getStyles(),s&&(this._doActionData={actionName:Xl.NAME,sheetId:t,cellValue:Yl(this._commandUnit,this._oldActionData),options:r},this._observers.notifyObservers({type:ks.UNDO,data:this._oldActionData,action:this}))}validate(){return!1}};let Ql=Xl;Ql.NAME="SetRangeDataAction",Hs.register(Ql.NAME,Ql);class Kl extends Fs{constructor(t,e,r){super(t,e,r),this._doActionData=__spreadValues({},t),this._oldActionData=__spreadProps(__spreadValues({},t),{cellValue:this.do()}),this.validate()}do(){const t=Js(this._commandUnit,this._doActionData);return this._observers.notifyObservers({type:ks.REDO,data:this._doActionData,action:this}),t}redo(){const{sheetId:t}=this._doActionData;this._oldActionData={actionName:Ql.NAME,sheetId:t,cellValue:this.do()}}undo(){this.getWorkSheet()&&(Yl(this._commandUnit,this._oldActionData),this._observers.notifyObservers({type:ks.UNDO,data:this._oldActionData,action:this}))}validate(){return!1}}Kl.NAME="ClearRangeAction",Hs.register(Kl.NAME,Kl);class Zl extends Fs{constructor(t,e,r){super(t,e,r),this._doActionData=__spreadValues({},t),this.do(),this._oldActionData=__spreadValues({},t),this.validate()}do(){this.getWorkSheet()&&(ol(this._commandUnit,this._doActionData),this._observers.notifyObservers({type:ks.REDO,data:this._doActionData,action:this}))}redo(){this.do()}undo(){const{rangeData:t,sheetId:e,shiftDimension:r}=this._oldActionData;this.getWorkSheet()&&(this._doActionData={actionName:Ql.NAME,sheetId:e,cellValue:el(this._commandUnit,this._oldActionData),rangeData:t,shiftDimension:r},this._observers.notifyObservers({type:ks.UNDO,data:this._oldActionData,action:this}))}validate(){return!1}}Zl.NAME="InsertRangeAction",Hs.register(Zl.NAME,Zl);class $l extends Fs{constructor(t,e,r){super(t,e,r),this._doActionData=__spreadValues({},t),this._oldActionData=__spreadProps(__spreadValues({},t),{cellValue:this.do()}),this.validate()}do(){const t=el(this._commandUnit,this._doActionData);return this._observers.notifyObservers({type:ks.REDO,data:this._doActionData,action:this}),t}redo(){const{sheetId:t,rangeData:e,shiftDimension:r}=this._doActionData;this._oldActionData={sheetId:t,actionName:Zl.NAME,shiftDimension:r,rangeData:e,cellValue:this.do()}}undo(){this.getWorkSheet()&&(ol(this._commandUnit,this._oldActionData),this._observers.notifyObservers({type:ks.UNDO,data:this._oldActionData,action:this}))}validate(){return!1}}$l.NAME="DeleteRangeAction",Hs.register($l.NAME,$l);class ql extends Fs{constructor(t,e,r){super(t,e,r),this._doActionData=__spreadValues({},t),this.do(),this._oldActionData=__spreadValues({},t),this.validate()}do(){sl(this._commandUnit,this._doActionData),this._observers.notifyObservers({type:ks.REDO,data:this._doActionData,action:this})}redo(){this.do()}undo(){gl(this._commandUnit,this._oldActionData),this._observers.notifyObservers({type:ks.UNDO,data:this._oldActionData,action:this})}validate(){return!1}}ql.NAME="InsertColumnAction",Hs.register(ql.NAME,ql);class Jl extends Fs{constructor(t,e,r){super(t,e,r),this._doActionData=__spreadValues({},t),this.do(),this._oldActionData=__spreadProps(__spreadValues({},t),{columnCount:u.getMaxLength(t.columnData[0])}),this.validate()}do(){ll(this._commandUnit,this._doActionData),this._observers.notifyObservers({type:ks.REDO,data:this._doActionData,action:this})}redo(){this.do()}undo(){cl(this._commandUnit,this._oldActionData),this._observers.notifyObservers({type:ks.UNDO,data:this._oldActionData,action:this})}validate(){return!1}}Jl.NAME="InsertColumnDataAction",Hs.register(Jl.NAME,Jl);class tn extends Fs{constructor(t,e,r){super(t,e,r),this._doActionData=__spreadValues({},t),this.do(),this._oldActionData=__spreadValues({},t),this.validate()}do(){il(this._commandUnit,this._doActionData),this._observers.notifyObservers({type:ks.REDO,data:this._doActionData,action:this})}redo(){this.do()}undo(){hl(this._commandUnit,this._oldActionData),this._observers.notifyObservers({type:ks.UNDO,data:this._oldActionData,action:this})}validate(){return!1}}tn.NAME="InsertRowAction",Hs.register(tn.NAME,tn);class en extends Fs{constructor(t,e,r){super(t,e,r),this._doActionData=__spreadValues({},t),this.do(),this._oldActionData=__spreadProps(__spreadValues({},t),{rowCount:u.getMaxLength(t.rowData[0])}),this.validate()}do(){nl(this._commandUnit,this._doActionData),this._observers.notifyObservers({type:ks.REDO,data:this._doActionData,action:this})}redo(){this.do()}undo(){dl(this._commandUnit,this._oldActionData),this._observers.notifyObservers({type:ks.UNDO,data:this._oldActionData,action:this})}validate(){return!1}}en.NAME="InsertRowDataAction",Hs.register(en.NAME,en);class rn extends Fs{constructor(t,e,r){super(t,e,r),this._doActionData=__spreadValues({},t),this._oldActionData=__spreadProps(__spreadValues({},t),{sheetId:this.do()})}do(){const t=al(this._commandUnit,this._doActionData);return this._observers.notifyObservers({type:ks.REDO,data:this._doActionData,action:this}),t}redo(){this.redo()}undo(){ul(this._commandUnit,this._oldActionData),this._observers.notifyObservers({type:ks.UNDO,data:this._oldActionData,action:this})}validate(){throw new Error("Method not implemented.")}}rn.NAME="InsertSheetAction",Hs.register(rn.NAME,rn);class sn extends Fs{constructor(t,e,r){super(t,e,r),this._doActionData=__spreadValues({},t),this._oldActionData=__spreadProps(__spreadValues({},t),{columnCount:this.do()}),this.validate()}do(){const t=gl(this._commandUnit,this._doActionData);return this._observers.notifyObservers({type:ks.REDO,data:this._doActionData,action:this}),t}redo(){this.do()}undo(){sl(this._commandUnit,this._oldActionData),this._observers.notifyObservers({type:ks.UNDO,data:this._oldActionData,action:this})}validate(){return!1}}sn.NAME="RemoveColumnAction",Hs.register(sn.NAME,sn);class ln extends Fs{constructor(t,e,r){super(t,e,r),this._doActionData=__spreadValues({},t),this._oldActionData=__spreadProps(__spreadValues({},t),{columnData:this.do()}),this.validate()}do(){const t=cl(this._commandUnit,this._doActionData);return this._observers.notifyObservers({type:ks.REDO,data:this._doActionData,action:this}),t}redo(){this.do()}undo(){ll(this._commandUnit,this._oldActionData),this._observers.notifyObservers({type:ks.UNDO,data:this._oldActionData,action:this})}validate(){return!1}}ln.NAME="RemoveColumnDataAction",Hs.register(ln.NAME,ln);class nn extends Fs{constructor(t,e,r){super(t,e,r),this._doActionData=__spreadValues({},t),this._oldActionData=__spreadProps(__spreadValues({},t),{rectangles:this.do()}),this.validate()}do(){const t=bl(this._commandUnit,this._doActionData);return this._observers.notifyObservers({type:ks.REDO,data:this._doActionData,action:this}),t}redo(){this.do()}undo(){$s(this._commandUnit,this._oldActionData),this._observers.notifyObservers({type:ks.UNDO,data:this._oldActionData,action:this})}validate(){return!1}}nn.NAME="RemoveMergeAction",Hs.register(nn.NAME,nn);class on extends Fs{constructor(t,e,r){super(t,e,r),this._doActionData=__spreadValues({},t),this._oldActionData=__spreadProps(__spreadValues({},t),{rowCount:this.do()}),this.validate()}do(){const t=hl(this._commandUnit,this._doActionData);return this._observers.notifyObservers({type:ks.REDO,data:this._doActionData,action:this}),t}redo(){this.do()}undo(){il(this._commandUnit,this._oldActionData),this._observers.notifyObservers({type:ks.UNDO,data:this._oldActionData,action:this})}validate(){return!1}}on.NAME="RemoveRowAction",Hs.register(on.NAME,on);class an extends Fs{constructor(t,e,r){super(t,e,r),this._doActionData=__spreadValues({},t),this._oldActionData=__spreadProps(__spreadValues({},t),{rowData:this.do()}),this.validate()}do(){const t=dl(this._commandUnit,this._doActionData);return this._observers.notifyObservers({type:ks.REDO,data:this._doActionData,action:this}),t}redo(){this.do()}undo(){nl(this._commandUnit,this._oldActionData),this._observers.notifyObservers({type:ks.UNDO,data:this._oldActionData,action:this})}validate(){return!1}}an.NAME="RemoveRowDataAction",Hs.register(an.NAME,an);class gn extends Fs{constructor(t,e,r){super(t,e,r),this._doActionData=__spreadValues({},t),this._oldActionData=__spreadValues(__spreadValues({},t),this.do())}do(){return this.redo()}redo(){const t=ul(this._commandUnit,this._doActionData);return this._observers.notifyObservers({type:ks.REDO,data:this._doActionData,action:this}),t}undo(){this.getWorkBook(),al(this._commandUnit,this._oldActionData),this._observers.notifyObservers({type:ks.UNDO,data:this._oldActionData,action:this})}validate(){throw new Error("Method not implemented.")}}gn.NAME="RemoveSheetAction",Hs.register(gn.NAME,gn);class cn extends Fs{constructor(t,e,r){super(t,e,r),this._doActionData=__spreadValues({},t),this._oldActionData=__spreadProps(__spreadValues({},t),{styles:this.do()}),this.validate()}do(){const t=fl(this._commandUnit,this._doActionData);return this._observers.notifyObservers({type:ks.REDO,data:this._doActionData,action:this}),t}redo(){this.do()}undo(){fl(this._commandUnit,this._oldActionData),this._observers.notifyObservers({type:ks.UNDO,data:this._oldActionData,action:this})}validate(){return!1}}cn.NAME="SetBorderAction",Hs.register(cn.NAME,cn);class bn extends Fs{constructor(t,e,r){super(t,e,r),this._doActionData=__spreadValues({},t),this.do(),this._oldActionData=__spreadValues({},t),this.validate()}do(){vl(this._commandUnit,this._doActionData),this._observers.notifyObservers({type:ks.REDO,data:this._doActionData,action:this})}redo(){this.do()}undo(){ml(this._commandUnit,this._oldActionData),this._observers.notifyObservers({type:ks.UNDO,data:this._oldActionData,action:this})}validate(){return!1}}bn.NAME="SetColumnHideAction",Hs.register(bn.NAME,bn);class hn extends Fs{constructor(t,e,r){super(t,e,r),this._doActionData=__spreadValues({},t),this.do(),this._oldActionData=__spreadValues({},t),this.validate()}do(){ml(this._commandUnit,this._doActionData),this._observers.notifyObservers({type:ks.REDO,data:this._doActionData,action:this})}redo(){this.do()}undo(){vl(this._commandUnit,this._oldActionData),this._observers.notifyObservers({type:ks.UNDO,data:this._oldActionData,action:this})}validate(){return!1}}hn.NAME="SetColumnShowAction",Hs.register(hn.NAME,hn);class dn extends Fs{constructor(t,e,r){super(t,e,r),this._doActionData=__spreadValues({},t),this._oldActionData=__spreadProps(__spreadValues({},t),{columnWidth:this.do()}),this.validate()}do(){const t=pl(this._commandUnit,this._doActionData);return this._observers.notifyObservers({type:ks.REDO,data:this._doActionData,action:this}),t}redo(){this.do()}undo(){const t=pl(this._commandUnit,this._doActionData);return this._observers.notifyObservers({type:ks.UNDO,data:this._oldActionData,action:this}),t}validate(){return!1}}dn.NAME="SetColumnWidthAction",Hs.register(dn.NAME,dn);class un extends Fs{constructor(t,e,r){super(t,e,r),this._doActionData=__spreadValues({},t),this._oldActionData=__spreadProps(__spreadValues({},t),{hideGridlines:this.do()}),this.validate()}do(){const t=_l(this._commandUnit,this._doActionData);return this._observers.notifyObservers({type:ks.REDO,data:this._doActionData,action:this}),t}redo(){this.do()}undo(){_l(this._commandUnit,this._oldActionData),this._observers.notifyObservers({type:ks.UNDO,data:this._oldActionData,action:this})}validate(){return!1}}un.NAME="SetHiddenGridlinesAction",Hs.register(un.NAME,un);const fn=class extends Fs{constructor(t,e,r){super(t,e,r),this._doActionData=__spreadValues({},t),this._oldActionData={actionName:fn.NAME,namedRange:this.do(),sheetId:t.sheetId},this.validate()}do(){const t=Cl(this._commandUnit,this._doActionData);return this._observers.notifyObservers({type:ks.REDO,data:this._doActionData,action:this}),t}redo(){const{sheetId:t}=this._doActionData;this._oldActionData={actionName:fn.NAME,sheetId:t,namedRange:this.do()}}undo(){const{sheetId:t}=this._oldActionData;this._observers.notifyObservers({type:ks.UNDO,data:this._oldActionData,action:this}),this._doActionData={actionName:fn.NAME,sheetId:t,namedRange:Cl(this._commandUnit,this._oldActionData)}}validate(){return!1}};let vn=fn;vn.NAME="SetNamedRangeAction",Hs.register(vn.NAME,vn);const mn=class extends Fs{constructor(t,e,r){super(t,e,r),this._doActionData=__spreadValues({},t),this._oldActionData=__spreadProps(__spreadValues({},t),{cellNote:this.do()}),this.validate()}do(){const t=Rl(this.getWorkSheet().getCellMatrix(),this._doActionData.cellNote,this._doActionData.rangeData);return this._observers.notifyObservers({type:ks.REDO,data:this._doActionData,action:this}),t}redo(){const{sheetId:t,rangeData:e}=this._doActionData;this._oldActionData={actionName:mn.NAME,sheetId:t,cellNote:this.do(),rangeData:e}}undo(){const{rangeData:t,sheetId:e,cellNote:r}=this._oldActionData,s=this.getWorkSheet();s&&(this._doActionData={actionName:mn.NAME,sheetId:e,cellNote:Rl(s.getCellMatrix(),r,t),rangeData:t},this._observers.notifyObservers({type:ks.UNDO,data:this._oldActionData,action:this}))}validate(){return!1}};let pn=mn;pn.NAME="SetRangeNoteAction",Hs.register(pn.NAME,pn);const _n=class extends Fs{constructor(t,e,r){super(t,e,r),this._oldActionData=__spreadProps(__spreadValues({},t),{value:this.do()}),this.validate()}do(){const{value:t,rangeData:e}=this._doActionData,r=this._workbook.getStyles(),s=wl(this.getWorkSheet().getCellMatrix(),t,e,r);return this._observers.notifyObservers({type:ks.REDO,data:this._doActionData,action:this}),s}redo(){const{sheetId:t,rangeData:e}=this._doActionData;this._oldActionData={actionName:_n.NAME,sheetId:t,value:this.do(),rangeData:e}}undo(){const{value:t,rangeData:e,sheetId:r}=this._oldActionData,s=this._workbook.getStyles(),l=this.getWorkSheet().getCellMatrix();this._doActionData={actionName:_n.NAME,sheetId:r,value:wl(l,t,e,s),rangeData:e},this._observers.notifyObservers({type:ks.UNDO,data:this._oldActionData,action:this})}validate(){return!1}};let Bn=_n;Bn.NAME="SetRangeStyleAction",Hs.register(Bn.NAME,Bn);class Cn extends Fs{constructor(t,e,r){super(t,e,r),this._doActionData=__spreadValues({},t),this._oldActionData=__spreadProps(__spreadValues({},t),{cellValue:this.do()}),this.validate()}do(){const t=Il(this.getWorkSheet().getCellMatrix(),this._doActionData.cellValue,this._doActionData.rangeData);return this._observers.notifyObservers({type:ks.REDO,data:this._doActionData,action:this}),t}redo(){const{sheetId:t,rangeData:e}=this._doActionData;this._oldActionData={actionName:Ql.NAME,sheetId:t,cellValue:this.do(),rangeData:e}}undo(){const{rangeData:t,sheetId:e,cellValue:r}=this._oldActionData,s=this.getWorkSheet();s&&(this._doActionData={actionName:Ql.NAME,sheetId:e,cellValue:Il(s.getCellMatrix(),r,t),rangeData:t},this._observers.notifyObservers({type:ks.UNDO,data:this._oldActionData,action:this}))}validate(){return!1}}Cn.NAME="SetRangeFormattedValueAction",Hs.register(Cn.NAME,Cn);class wn extends Fs{constructor(t,e,r){super(t,e,r),this._doActionData=__spreadValues({},t),this._oldActionData=__spreadProps(__spreadValues({},t),{rightToLeft:this.do()}),this.validate()}do(){const t=Al(this.getWorkSheet(),this._doActionData.rightToLeft);return this._observers.notifyObservers({type:ks.REDO,data:this._doActionData,action:this}),t}redo(){this.do()}undo(){this._oldActionData;Al(this.getWorkSheet(),this._oldActionData.rightToLeft),this._observers.notifyObservers({type:ks.UNDO,data:this._oldActionData,action:this})}validate(){return!1}}wn.NAME="SetRightToLeftAction",Hs.register(wn.NAME,wn);class Tn extends Fs{constructor(t,e,r){super(t,e,r),this._doActionData=__spreadValues({},t),this._oldActionData=__spreadProps(__spreadValues({},t),{rowHeight:this.do()}),this.validate()}do(){const t=this.getWorkSheet(),e=xl(this._doActionData.rowIndex,this._doActionData.rowHeight,t.getRowManager());return this._observers.notifyObservers({type:ks.REDO,data:this._doActionData,action:this}),e}redo(){this.do()}undo(){const t=this.getWorkSheet(),e=xl(this._oldActionData.rowIndex,this._oldActionData.rowHeight,t.getRowManager());return this._observers.notifyObservers({type:ks.UNDO,data:this._oldActionData,action:this}),e}validate(){return!1}}Tn.NAME="SetRowHeightAction",Hs.register(Tn.NAME,Tn);class yn extends Fs{constructor(t,e,r){super(t,e,r),this._doActionData=__spreadValues({},t),this.do(),this._oldActionData=__spreadValues({},t),this.validate()}do(){const t=this.getWorkSheet();Bl(this._doActionData.rowIndex,this._doActionData.rowCount,t.getRowManager()),this._observers.notifyObservers({type:ks.REDO,data:this._doActionData,action:this})}redo(){this.do()}undo(){const t=this.getWorkSheet();kl(this._oldActionData.rowIndex,this._doActionData.rowCount,t.getRowManager()),this._observers.notifyObservers({type:ks.UNDO,data:this._oldActionData,action:this})}validate(){return!1}}yn.NAME="SetRowHideAction",Hs.register(yn.NAME,yn);class Sn extends Fs{constructor(t,e,r){super(t,e,r),this._doActionData=__spreadValues({},t),this.do(),this._oldActionData=__spreadValues({},t),this.validate()}do(){const t=this.getWorkSheet();kl(this._doActionData.rowIndex,this._doActionData.rowCount,t.getRowManager()),this._observers.notifyObservers({type:ks.REDO,data:this._doActionData,action:this})}redo(){this.do()}undo(){const t=this.getWorkSheet();Bl(this._oldActionData.rowIndex,this._oldActionData.rowCount,t.getRowManager()),this._observers.notifyObservers({type:ks.UNDO,data:this._oldActionData,action:this})}validate(){return!1}}Sn.NAME="SetRowShowAction",Hs.register(Sn.NAME,Sn);const jn=class extends Fs{constructor(t,e,r){super(t,e,r),this._doActionData=__spreadValues({},t);const{activeRangeList:s,activeRange:l,currentCell:n}=this.do();this._oldActionData=__spreadProps(__spreadValues({},t),{activeRangeList:s,activeRange:l,currentCell:n}),this.validate()}do(){const{activeRangeList:t,activeRange:e,currentCell:r}=this._doActionData,s=Ol(this.getWorkSheet(),t,e,r);return this._observers.notifyObservers({type:ks.REDO,data:this._doActionData,action:this}),s}redo(){const{sheetId:t}=this._doActionData,{activeRangeList:e,activeRange:r,currentCell:s}=this.do();this._oldActionData={actionName:jn.NAME,sheetId:t,activeRangeList:e,activeRange:r,currentCell:s}}undo(){const{activeRangeList:t,activeRange:e,currentCell:r,sheetId:s}=this._oldActionData,l=Ol(this.getWorkSheet(),t,e,r);this._doActionData={actionName:jn.NAME,sheetId:s,activeRangeList:l.activeRangeList,activeRange:l.activeRange,currentCell:l.currentCell},this._observers.notifyObservers({type:ks.UNDO,data:this._oldActionData,action:this})}validate(){return!1}};let En=jn;En.NAME="SetSelectionActivateAction",Hs.register(En.NAME,En);class Yn extends Fs{constructor(t,e,r){super(t,e,r),this._doActionData=__spreadValues({},t),this._oldActionData=__spreadProps(__spreadValues({},t),{order:this.do()}),this.validate()}do(){const t=Nl(this.getWorkSheet().getContext().getWorkBook(),this._doActionData.sheetId,this._doActionData.order);return this._observers.notifyObservers({type:ks.REDO,data:this._doActionData,action:this}),t}redo(){this.do()}undo(){Nl(this.getWorkSheet().getContext().getWorkBook(),this._oldActionData.sheetId,this._oldActionData.order),this._observers.notifyObservers({type:ks.UNDO,data:this._oldActionData,action:this})}validate(){return!1}}Yn.NAME="SetSheetOrderAction",Hs.register(Yn.NAME,Yn);const Rn=class extends Fs{constructor(t,e,r){super(t,e,r),this._doActionData=__spreadValues({},t),this._oldActionData=__spreadProps(__spreadValues({},t),{color:this.do()}),this.validate()}do(){const t=Ml(this.getWorkSheet(),this._doActionData.color);return this._observers.notifyObservers({type:ks.REDO,data:this._doActionData,action:this}),t}redo(){const{sheetId:t}=this._doActionData;this._oldActionData={sheetId:t,actionName:Rn.NAME,color:this.do()}}undo(){const{color:t,sheetId:e}=this._oldActionData,r=this.getWorkSheet();this._doActionData={actionName:Rn.NAME,sheetId:e,color:Ml(r,t)},this._observers.notifyObservers({type:ks.UNDO,data:this._oldActionData,action:this})}validate(){return!1}};let In=Rn;In.NAME="SetTabColorAction",Hs.register(In.NAME,In);const An=class extends Fs{constructor(t,r,s){super(t,r,s),this._doActionData=__spreadValues({},t);const{oldSheetId:l,status:n}=this.do();this._oldActionData=__spreadProps(__spreadValues({},t),{sheetId:l,status:n}),this.validate(),this.removeOperation(e.SERVER_ACTION)}do(){const{sheetId:t,status:e}=this._doActionData,r=Dl(this._workbook.getSheetBySheetId(t));return this._observers.notifyObservers({type:ks.REDO,data:this._doActionData,action:this}),r}redo(){const{oldSheetId:t,status:e}=this.do();this._oldActionData={actionName:An.NAME,sheetId:t,status:e}}undo(){const{sheetId:t}=this._oldActionData;this._oldActionData.status;const e=this._workbook.getSheetBySheetId(t);if(e){const{oldSheetId:t,status:r}=Dl(e);this._doActionData={actionName:An.NAME,sheetId:t,status:r},this._observers.notifyObservers({type:ks.UNDO,data:this._oldActionData,action:this})}}validate(){return!1}};let xn=An;xn.NAME="SetWorkSheetActivateAction",Hs.register(xn.NAME,xn);const On=class extends Fs{constructor(t,e,r){super(t,e,r),this._doActionData=__spreadValues({},t),this._oldActionData=__spreadProps(__spreadValues({},t),{hidden:this.do()}),this.validate()}do(){const t=rl(this.getWorkSheet(),this._doActionData.hidden);return this._observers.notifyObservers({type:ks.REDO,data:this._doActionData,action:this}),t}redo(){const{sheetId:t}=this._doActionData;this._oldActionData={sheetId:t,actionName:On.NAME,hidden:this.do()}}undo(){const{hidden:t,sheetId:e}=this._oldActionData,r=this.getWorkSheet();this._doActionData={actionName:On.NAME,sheetId:e,hidden:rl(r,t)},this._observers.notifyObservers({type:ks.UNDO,data:this._oldActionData,action:this})}validate(){return!1}};let Nn=On;Nn.NAME="SetWorkSheetHideAction",Hs.register(Nn.NAME,Nn);const kn=class extends Fs{constructor(t,e,r){super(t,e,r),this._doActionData=__spreadValues({},t),this._oldActionData=__spreadProps(__spreadValues({},t),{sheetName:this.do()}),this.validate()}do(){const t=Ll(this.getWorkSheet(),this._doActionData.sheetName);return this._observers.notifyObservers({type:ks.REDO,data:this._doActionData,action:this}),t}redo(){const{sheetId:t}=this._doActionData;this._oldActionData={sheetId:t,actionName:kn.NAME,sheetName:this.do()}}undo(){const{sheetName:t,sheetId:e}=this._oldActionData,r=this.getWorkSheet();this._doActionData={actionName:kn.NAME,sheetId:e,sheetName:Ll(r,t)},this._observers.notifyObservers({type:ks.UNDO,data:this._oldActionData,action:this})}validate(){return!1}};let Mn=kn;Mn.NAME="SetWorkSheetNameAction",Hs.register(Mn.NAME,Mn);class Dn extends Fs{constructor(t,e,r){super(t,e,r),this._doActionData=__spreadValues({},t),this._oldActionData=__spreadProps(__spreadValues({},t),{sheetStatus:this.do()}),this.validate()}do(){const t=Pl(this.getWorkSheet(),this._doActionData.sheetStatus);return this._observers.notifyObservers({type:ks.REDO,data:this._doActionData,action:this}),t}redo(){const{sheetId:t}=this._doActionData;this._oldActionData={sheetId:t,actionName:mt.SET_WORKSHEET_STATUS_ACTION,sheetStatus:this.do()}}undo(){const{sheetStatus:t,sheetId:e}=this._oldActionData,r=this.getWorkSheet();this._doActionData={actionName:mt.SET_WORKSHEET_STATUS_ACTION,sheetId:e,sheetStatus:Pl(r,t)},this._observers.notifyObservers({type:ks.UNDO,data:this._oldActionData,action:this})}validate(){return!1}}Dn.NAME="SetWorkSheetStatusAction",Hs.register(Dn.NAME,Dn);class Ln extends Fs{constructor(t,e,r){super(t,e,r),this._doActionData=__spreadValues({},t),this._oldActionData=__spreadProps(__spreadValues({},t),{zoom:this.do()}),this.validate()}redo(){const t=Hl(this.getWorkBook(),this._doActionData.sheetId,this._doActionData.zoom);return this._observers.notifyObservers({type:ks.REDO,data:this._doActionData,action:this}),t}do(){return this.redo()}undo(){Hl(this.getWorkBook(),this._oldActionData.sheetId,this._oldActionData.zoom),this._observers.notifyObservers({type:ks.REDO,data:this._oldActionData,action:this})}validate(){return!1}}Ln.NAME="SetZoomRatioAction",Hs.register(Ln.NAME,Ln);class Pn extends s{constructor(t,e,r){if(super(t,r),null==e.DocumentUnit)throw new Error("action document domain can not be null!");this._document=e.DocumentUnit}getDocument(){return this._document}}function Hn(t,e=!1){return e?t-1:t}function Fn(t,e,r){return t.slice(0,e)+r+t.slice(e)}function Un(t,e){let r=t.body;if(e){const{headers:s,footers:l}=t;(null==s?void 0:s[e])?r=s[e].body:(null==l?void 0:l[e])&&(r=l[e].body)}return r}function zn(t,e){var r,s;if(s=e,!(!(r=t).ts||!s.ts)&&xs(r.ts,s.ts))return t.ct+=e.ct||"",t}function Wn(t,e,r){const s=t.getSnapshot(),{segmentId:l}=r,n=Un(s,l);if(0===e.length)return;if(null==n)throw new Error("no body has changed");const{blockElements:o}=n;for(let i of o){if(null==i)continue;const{blockType:t}=i;switch(t){case E.PARAGRAPH:i.paragraph&&Vn(e,i,i.paragraph,r)}}}function Vn(t,e,r,s){const{st:l,ed:n}=e,{cursorStart:o,isStartBack:i,segmentId:a}=s,g=Hn(o,i);if(g>n||null==r)return;const{elements:c}=r;for(let b of c){const{et:e}=b;if(e===D.DRAWING)continue;const{st:r,ed:s,tr:l}=b;if(null!=l&&l.tab!==_e.TRUE&&(!(gs)&&(console.log("paragraphApply",g,r,s,b,gs),e===D.TEXT_RUN))){let e=g-r+1;e<=0&&(e=0);const s=Fn(l.ct||"",e,t);l.ct=s}}}function Gn(t,e){const r=t.getSnapshot(),{segmentId:s}=e,l=Un(r,s);if(null==l)throw new Error("no body has changed");const{blockElements:n}=l;for(let o of n){if(null==o)continue;const{blockType:t}=o;switch(t){case E.PARAGRAPH:o.paragraph&&Xn(o,o.paragraph,e)}}}function Xn(t,e,r){var s,l;const{cursorStart:n,cursorEnd:o,isStartBack:i,isEndBack:a,isCollapse:g}=r,c=Hn(n,i),b=Hn(o,a),{st:h,ed:d}=t;if(n>d||or)f++;else{if(t===D.TEXT_RUN){let t=c-e+1,s=b-e+1;t<=0&&(t=0),s>=r-e-1&&(t=r-e-1);const l=(v=n.ct||"",(m=t)>(p=s)?v:(m===p&&(m-=1),v.slice(0,m)+v.slice(p)));n.ct=l}if(0===(null==(s=n.ct)?void 0:s.length))u.splice(f,1);else{const t=null==(l=u[f-1])?void 0:l.tr;if(!t){f++;continue}zn(n,t)?u.splice(f,1):f++}}else f++}var v,m,p}var Qn,Kn;(Kn=Qn||(Qn={})).INSERT_TEXT_ACTION_NAME="InsertTextAction",Kn.DELETE_TEXT_ACTION_NAME="DeleteTextAction",Kn.CLEAR_TEXT_STYLE_ACTION_NAME="ClearTextStyleAction",Kn.DELETE_PARAGRAPH_ACTION_NAME="DeleteParagraphAction",Kn.INSERT_PARAGRAPH_ACTION_NAME="InsertParagraphAction",Kn.MERGE_PARAGRAPH_ACTION_NAME="MergeParagraphAction",Kn.MOVE_PARAGRAPH_ACTION_NAME="MoveParagraphAction",Kn.SET_TEXT_STYLE_ACTION_NAME="SetTextStyleAction",Kn.SPLIT_PARAGRAPH_ACTION_NAME="SplitParagraphAction",Kn.UPDATE_DOCUMENT_STYLE_ACTION_NAME="UpdateDocumentAction",Kn.UPDATE_PARAGRAPH_STYLE_ACTION_NAME="UpdateParagraphAction",Kn.UPDATE_SECTION_ACTION_NAME="UpdateSectionAction",Kn.DELETE_BULLET_ACTION_NAME="DeleteBulletAction",Kn.DELETE_PARAGRAPH_BULLET_ACTION_NAME="DeleteParagraphBulletAction",Kn.DELETE_SECTION_ACTION_NAME="DeleteSectionAction",Kn.INSERT_BULLET_ACTION_NAME="InsertBulletAction",Kn.INSERT_PARAGRAPH_BULLET_ACTION_NAME="InsertParagraphBulletAction",Kn.INSERT_SECTION_ACTION_NAME="InsertSectionAction",Kn.UPDATE_BULLET_ACTION_NAME="UpdateBulletAction",Kn.UPDATE_PARAGRAPH_BULLET_ACTION_NAME="UpdateParagraphBulletAction",Kn.TEXT_INDEX_ADJUST_ACTION_NAME="TextIndexAdjustAction";class Zn extends Pn{constructor(t,e,r){super(t,e,r),this._doActionData=__spreadValues({},t),this.do();const{cursorStart:s,isStartBack:l,text:n}=t;this._oldActionData=__spreadProps(__spreadValues({},t),{actionName:Qn.DELETE_TEXT_ACTION_NAME,cursorEnd:s+n.length,isEndBack:l,isCollapse:!0})}redo(){this.do()}do(){const t=this.getDoActionData(),e=this.getDocument(),{text:r,cursorStart:s,isStartBack:l,segmentId:n}=t;Wn(e,r,{cursorStart:s,isStartBack:l,segmentId:n}),this._observers.notifyObservers({type:ks.REDO,data:this._doActionData,action:this})}undo(){const t=this.getOldActionData();Gn(this.getDocument(),__spreadValues({},t)),this._observers.notifyObservers({type:ks.UNDO,data:this._oldActionData,action:this})}validate(){return!1}}Zn.NAME="InsertTextAction",Hs.register(Zn.NAME,Zn);class $n extends Pn{constructor(t,e,r){super(t,e,r),this._doActionData=__spreadValues({},t),this.do();const{text:s,cursorStart:l,isStartBack:n,segmentId:o}=t;this._oldActionData={actionName:Qn.INSERT_TEXT_ACTION_NAME,text:s,cursorStart:l,isStartBack:n,segmentId:o}}redo(){this.do()}do(){const t=this.getDoActionData(),e=this.getDocument(),{cursorStart:r,cursorEnd:s,isStartBack:l,isEndBack:n,isCollapse:o,segmentId:i}=t;Gn(e,{cursorStart:r,cursorEnd:s,isStartBack:l,isEndBack:n,isCollapse:o,segmentId:i})}undo(){const t=this.getOldActionData(),e=this.getDocument(),{text:r,cursorStart:s,isStartBack:l,segmentId:n}=t;Wn(e,r,{cursorStart:s,isStartBack:l,segmentId:n})}validate(){return!1}}function qn(t,e){const{segmentId:r}=e;let s=Un(t.getSnapshot(),r);if(null==s)throw new Error("no body has changed");const{blockElements:l}=s;let n=null;for(let o of l){if(null==o)continue;const{blockType:t}=o;switch(t){case E.PARAGRAPH:o.paragraph&&Jn(o,o.paragraph,e,n),n=o}}}function Jn(t,e,r,s){const{cursorStart:l,cursorEnd:n,isCollapse:o,isEndBack:i,isStartBack:a}=r,{st:g,ed:c}=t;if(l>c)return;const{elements:b}=e,h=s?s.ed:-1;if(n{!function(t,e=0){null!=t&&(t.st+=e,t.ed+=e)}(t,e)}))}else{let e=h+1,r=e;to(b,(t=>{const{tr:e}=t,s=(null==e?void 0:e.ct)||"";t.st=r,t.ed=r+s.length-1,r=t.ed+1})),t.st=e,t.ed=r-1}}function to(t,e){for(let r of t){const{et:t}=r;t!==D.DRAWING&&e(r)}}$n.Name="DeleteTextAction",Hs.register($n.Name,$n);class eo extends Pn{constructor(t,e,r){super(t,e,r),this._doActionData=__spreadValues({},t),this.do(),this._oldActionData=__spreadValues({},t)}redo(){this.do()}do(){const t=this.getDoActionData();qn(this.getDocument(),t),this._observers.notifyObservers({type:ks.REDO,data:this._doActionData,action:this})}undo(){const t=this.getOldActionData();qn(this.getDocument(),t),this._observers.notifyObservers({type:ks.UNDO,data:this._oldActionData,action:this})}validate(){return!1}}eo.Name="TextIndexAdjustAction",Hs.register(eo.Name,eo);class ro{constructor(t){this._name=t,this._observeNames=[]}onCreate(t){this.context=t}load(t){}save(){return Object()}onMounted(t){}onDestroy(){this.deleteObserve(...this._observeNames)}getPluginName(){return this._name}getContext(){return this.context}getGlobalContext(){return this.context.getUniver().getGlobalContext()}getLocale(){return this.getGlobalContext().getLocale()}getUniver(){return this.context.getUniver()}getObserver(t){return this.context.getObserverManager().getObserver(t,this._name)}getPluginByName(t){return this.context.getPluginManager().getPluginByName(t)}pushToObserve(...t){const e=this.context.getObserverManager();t.forEach((t=>{this._observeNames.includes(t)||this._observeNames.push(t),e.addObserver(t,this._name,new o)}))}deleteObserve(...t){const e=this.context.getObserverManager();t.forEach((t=>{e.removeObserver(t,this._name)}))}}class so{constructor(t,e=[]){this._context=t,this._plugins=[],this._initialized=!0,this._plugins=this._plugins.concat(e),this._initialize()}install(t){const{_plugins:e}=this;e.push(t),t.onCreate(this._context),t.onMounted(this._context)}uninstall(t){const{_plugins:e}=this,r=e.findIndex((e=>e.getPluginName()===t));if(r>-1){const t=e.splice(r,1)[0];t&&t.onDestroy()}}setContext(t){this._context=t}getRequirePluginByName(t){for(let e=0;e{t.onCreate(this._context),t.onMounted(this._context)})))}}class lo{constructor(){this.os="",this.app_version="",this.platform="",this.device_id="",this.os_version=""}}class no{constructor(){this._hooksManager=new a,this._pluginManager=new so(this),this._environment=new lo,this._observerManager=new Ns,this._initialize()}onUniver(t){const e=t.getGlobalContext();this._univer=t,this._undoManager=e.getUndoManager(),this._commandManager=e.getCommandManager()}getHook(t){return this._hooksManager.getHooks(t)}getHooksManager(){return this._hooksManager}getObserverManager(){return this._observerManager}getPluginManager(){return this._pluginManager}getUndoManager(){return this._undoManager}getCommandManager(){return this._commandManager}getUniver(){return this._univer}_initialize(){this._undoManager=new zs,this._commandManager=new Hs(this)}}class oo extends no{constructor(t={}){super(),this._locale=new ss,this._locale.initialize(),null==t.id||0===t.id.length?this._univerId=B.generateRandomId(10):this._univerId=t.id}getLocale(){return this._locale}getUniverId(){return this._univerId}_setObserver(){}}class io{constructor(t,e){var r;this._context=e,this._snapshot=__spreadValues(__spreadValues({},Me),t),this._unitId=null!=(r=this._snapshot.id)?r:B.generateRandomId(6)}getSnapshot(){return this._snapshot}getUnitId(){return this._unitId}insertText(t,e,r){const{_context:s}=this,l=s.getCommandManager(),n=__spreadProps(__spreadValues({actionName:Qn.INSERT_TEXT_ACTION_NAME},e),{text:t,segmentId:r}),o=new Us({DocumentUnit:this},n,this._addTextIndexAdustAction(e,r));return l.invoke(o),this}deleteText(t,e){const{_context:r}=this,s=r.getCommandManager(),l=this._getDeleteTextAction(t,e),n=new Us({DocumentUnit:this},...l,this._addTextIndexAdustAction(t,e));return s.invoke(n),this}updateText(t,e,r,s){const{_context:l}=this,n=l.getCommandManager(),o=[];e.length>0&&o.push(...this._getDeleteTextAction({cursorStart:r,isStartBack:!1,isCollapse:!1,cursorEnd:r+e.length,isEndBack:!1},s));const i={actionName:Qn.INSERT_TEXT_ACTION_NAME,cursorStart:r,isStartBack:!1,text:t,segmentId:s},a=new Us({DocumentUnit:this},...o,i,this._addTextIndexAdustAction({cursorStart:r,cursorEnd:r+Math.max(e.length,t.length),isCollapse:!1,isEndBack:!1,isStartBack:!1},s));return n.invoke(a),this}_addTextIndexAdustAction(t,e){const{cursorStart:r,cursorEnd:s,isCollapse:l,isEndBack:n,isStartBack:o}=t;return{actionName:Qn.TEXT_INDEX_ADJUST_ACTION_NAME,cursorStart:r,cursorEnd:s,isCollapse:l,isEndBack:n,isStartBack:o,segmentId:e}}_getDeleteTextAction(t,e){const{cursorStart:r,cursorEnd:s,isCollapse:l,isEndBack:n,isStartBack:o}=t;let i=[];return i=l?this._getDeleteTextActionCollapse(t,e):this._getDeleteTextActionRange(t,e),0===i.length?[]:i}_getDeleteTextActionCollapse(t,e){var r;const s=Un(this._snapshot,e);if(null==s)return[];const{blockElements:l}=s,{cursorStart:n,isCollapse:o,isStartBack:i}=t,a=[];let g=null,c=null,b=null;for(let h of l){if(null==h)continue;const{blockType:t,st:s,ed:l,blockId:o}=h;if(t===E.PARAGRAPH){if(n>l||ns||n=l?(c=d,t=l):f=!0,r<=n&&s>=n?(b=d,u=n):v=!1,(ls||n===s&&!i)&&!o?g.push({actionName:Qn.DELETE_PARAGRAPH_ACTION_NAME,cursorStart:r,cursorEnd:s,isCollapse:!1,isEndBack:!1,isStartBack:!0,blockId:d,blockElement:h,segmentId:e}):g.push({actionName:Qn.DELETE_TEXT_ACTION_NAME,cursorStart:t,cursorEnd:u,isCollapse:o,isEndBack:v,isStartBack:f,segmentId:e})}}return null!=c&&null!=b&&c!==b&&g.push({actionName:Qn.MERGE_PARAGRAPH_ACTION_NAME,startBlockId:c,endBlockId:b,segmentId:e,cursorStart:l,isStartBack:a}),g}}class ao extends no{constructor(t={}){super(),this._document=new io(t,this)}getDocument(){return this._document}_setObserver(){}}class go{constructor(){this._data=[]}static create(){return new go}add(t){this._data.indexOf(t)>-1||this._data.push(t)}delete(t){const e=this._data.indexOf(t);this._data.splice(e,1)}getData(){return this._data}}class co{constructor(){this._data=new Map}static create(){return new co}add(t,e){this._data.has(t)||this._data.set(t,e)}delete(t){this._data.delete(t)}getData(){return this._data}}class bo{install(t){t.addObserver("onAfterSetSelectionObservable","core",new o),t.addObserver("onBeforeChangeNameObservable","core",new o),t.addObserver("onAfterChangeNameObservable","core",new o),t.addObserver("onBeforeChangeActiveSheetObservable","core",new o),t.addObserver("onAfterChangeActiveSheetObservable","core",new o),t.addObserver("onBeforeChangeSheetNameObservable","core",new o),t.addObserver("onAfterChangeSheetNameObservable","core",new o),t.addObserver("onBeforeInsertSheetObservable","core",new o),t.addObserver("onAfterInsertSheetObservable","core",new o),t.addObserver("onBeforeRemoveSheetObservable","core",new o),t.addObserver("onAfterRemoveSheetObservable","core",new o),t.addObserver("onBeforeChangeSheetColorObservable","core",new o),t.addObserver("onAfterChangeSheetColorObservable","core",new o),t.addObserver("onBeforeChangeSheetDataObservable","core",new o),t.addObserver("onAfterChangeSheetDataObservable","core",new o),t.addObserver("onSheetBarDidMountObservable","core",new o),t.addObserver("onInfoBarDidMountObservable","core",new o),t.addObserver("onRightMenuDidMountObservable","core",new o),t.addObserver("onAfterChangeSheetScrollObservable","core",new o),t.addObserver("onSheetRenderDidMountObservable","core",new o),t.addObserver("onHideSheetObservable","core",new o),t.addObserver("onShowSheetObservable","core",new o),t.addObserver("onSheetTabColorChangeObservable","core",new o),t.addObserver("onSheetOrderObservable","core",new o),t.addObserver("onZoomRatioSheetObservable","core",new o)}}class ho extends no{constructor(t={}){super(),this._setObserver(),this._genname=new ns,this._workbook=new Yr(t,this)}getWorkBook(){return this._workbook}getGenName(){return this._genname}onUniver(t){super.onUniver(t),this._workbook.onUniver(t)}getContextObserver(t){return this.getObserverManager().requiredObserver(t,"core")}refreshWorkbook(t={}){this._workbook=new Yr(t,this)}_setObserver(){const t=this.getObserverManager();(new bo).install(t)}_initialize(){}}class uo{constructor(t,e){var r;this._context=e,this._snapshot=__spreadValues(__spreadValues({},De),t),this._unitId=null!=(r=this._snapshot.id)?r:B.generateRandomId(6)}getSnapshot(){return this._snapshot}getUnitId(){return this._unitId}getPages(){var t;return null==(t=this._snapshot.body)?void 0:t.pages}getPageOrder(){var t;return null==(t=this._snapshot.body)?void 0:t.pageOrder}getPage(t){const e=this.getPages();return null==e?void 0:e[t]}getElementsByPage(t){var e;return null==(e=this.getPage(t))?void 0:e.pageElements}getElement(t,e){var r;return null==(r=this.getElementsByPage(t))?void 0:r[e]}getPageSize(){return this._snapshot.pageSize}addPage(){return{id:"cover_1",pageType:Ve.SLIDE,zIndex:1,title:"cover",description:"this is first page, cover",pageBackgroundFill:{rgb:"rgb(255,255,255)"},pageElements:{}}}}class fo extends no{constructor(t={}){super(),this._slide=new uo(t,this)}getSlide(){return this._slide}_setObserver(){}}const vo="dev",mo="0.0.1";class po{constructor(t={}){this.univerDocConfig=t,this._context=new ao(t)}get context(){return this._context}static newInstance(t={}){return ls.capsule(vo,mo,"powered by :: UniverDoc :: "),new po(t)}static get(t){return Xr(__spreadProps(__spreadValues({},t),{type:"GET"}))}static post(t){return Xr(__spreadProps(__spreadValues({},t),{type:"POST"}))}getUnitId(){return this._context.getDocument().getUnitId()}installPlugin(t){this._context.getPluginManager().install(t)}uninstallPlugin(t){this._context.getPluginManager().uninstall(t)}}class _o{constructor(t={}){this.univerSheetConfig=t,this._context=new ho(t)}get context(){return this._context}static newInstance(t={}){return ls.capsule(vo,mo,"powered by :: universheet :: "),new _o(t)}static get(t){return Xr(__spreadProps(__spreadValues({},t),{type:"GET"}))}static post(t){return Xr(__spreadProps(__spreadValues({},t),{type:"POST"}))}static load(t,e){t.getWorkBook().load(e.workbookConfig),t.context.getPluginManager().getPlugins().forEach((t=>{t.load(e[`${t.getPluginName()}Config`])}))}static newColor(){return new $e}static toJson(t){const e=t.getWorkBook().save(),r={};return t.context.getPluginManager().getPlugins().forEach((t=>{r[`${t.getPluginName()}Config`]=t.save()})),__spreadValues({workbookConfig:e},r)}getUnitId(){return this.getWorkBook().getUnitId()}installPlugin(t){this._context.getPluginManager().install(t)}uninstallPlugin(t){this._context.getPluginManager().uninstall(t)}getWorkBook(){return this._context.getWorkBook()}refreshWorkbook(t={}){this._context.refreshWorkbook(t)}}class Bo{constructor(t={}){this.UniverSlideConfig=t,this._context=new fo(t)}get context(){return this._context}static newInstance(t={}){return ls.capsule(vo,mo,"powered by :: UniverSlide :: "),new Bo(t)}static get(t){return Xr(__spreadProps(__spreadValues({},t),{type:"GET"}))}static post(t){return Xr(__spreadProps(__spreadValues({},t),{type:"POST"}))}static newColor(){return new $e}installPlugin(t){this._context.getPluginManager().install(t)}uninstallPlugin(t){this._context.getPluginManager().uninstall(t)}}class Co{constructor(t={}){this._univerSheets=[],this._univerDocs=[],this._univerSlides=[],this._context=new oo(t),this._context.onUniver(this)}addUniverSheet(t){t.context.onUniver(this),this._univerSheets.push(t)}addUniverDoc(t){t.context.onUniver(this),this._univerDocs.push(t)}addUniverSlide(t){t.context.onUniver(this),this._univerSlides.push(t)}getUniverSheetInstance(t){return this._univerSheets.find((e=>e.getUnitId()===t))}getUniverDocInstance(t){return this._univerDocs.find((e=>e.getUnitId()===t))}getUniverSlideInstance(t){return null}getAllUniverSheetsInstance(){return this._univerSheets}getAllUniverDocsInstance(){return this._univerDocs}getAllUniverSlidesInstance(){return this._univerSlides}getCurrentUniverSheetInstance(){return this._univerSheets[0]}getCurrentUniverDocInstance(){return this._univerDocs[0]}getCurrentUniverSlideInstance(){return this._univerSlides[0]}getGlobalContext(){return this._context}install(t){this._context.getPluginManager().install(t)}uninstall(t){this._context.getPluginManager().uninstall(t)}} +!function(t){var e,r;e=or,r=function(){var t,e,r,s,l,n={},o={},i={currentLocale:"en",zeroFormat:null,nullFormat:null,defaultFormat:"0,0",scalePercentBy100:!0},a={currentLocale:i.currentLocale,zeroFormat:i.zeroFormat,nullFormat:i.nullFormat,defaultFormat:i.defaultFormat,scalePercentBy100:i.scalePercentBy100};function g(t,e){this._input=t,this._value=e}return(t=function(r){var s,l,o,i;if(t.isNumeral(r))s=r.value();else if(0===r||void 0===r)s=0;else if(null===r||e.isNaN(r))s=null;else if("string"==typeof r)if(a.zeroFormat&&r===a.zeroFormat)s=0;else if(a.nullFormat&&r===a.nullFormat||!r.replace(/[^0-9]+/g,"").length)s=null;else{for(l in n)if((i="function"==typeof n[l].regexps.unformat?n[l].regexps.unformat():n[l].regexps.unformat)&&r.match(i)){o=n[l].unformat;break}s=(o=o||t._.stringToNumber)(r)}else s=Number(r)||null;return new g(r,s)}).version="2.0.6",t.isNumeral=function(t){return t instanceof g},t._=e={numberToFormat:function(e,r,s){var l,n,i,a,g,c,b,h,d=o[t.options.currentLocale],u=!1,f=!1,v="",m=1e12,p=1e9,_=1e6,B="",C=!1;if(e=e||0,i=Math.abs(e),t._.includes(r,"(")?(u=!0,r=r.replace(/[\(|\)]/g,"")):(t._.includes(r,"+")||t._.includes(r,"-"))&&(c=t._.includes(r,"+")?r.indexOf("+"):e<0?r.indexOf("-"):-1,r=r.replace(/[\+|\-]/g,"")),t._.includes(r,"a")&&(n=!!(n=r.match(/a(k|m|b|t)?/))&&n[1],t._.includes(r," a")&&(v=" "),r=r.replace(new RegExp(v+"a[kmbt]?"),""),i>=m&&!n||"t"===n?(v+=d.abbreviations.trillion,e/=m):i=p&&!n||"b"===n?(v+=d.abbreviations.billion,e/=p):i=_&&!n||"m"===n?(v+=d.abbreviations.million,e/=_):(i<_&&i>=1e3&&!n||"k"===n)&&(v+=d.abbreviations.thousand,e/=1e3)),t._.includes(r,"[.]")&&(f=!0,r=r.replace("[.]",".")),a=e.toString().split(".")[0],g=r.split(".")[1],b=r.indexOf(","),l=(r.split(".")[0].split(",")[0].match(/0/g)||[]).length,g?(t._.includes(g,"[")?(g=(g=g.replace("]","")).split("["),B=t._.toFixed(e,g[0].length+g[1].length,s,g[1].length)):B=t._.toFixed(e,g.length,s),a=B.split(".")[0],B=t._.includes(B,".")?d.delimiters.decimal+B.split(".")[1]:"",f&&0===Number(B.slice(1))&&(B="")):a=t._.toFixed(e,0,s),v&&!n&&Number(a)>=1e3&&v!==d.abbreviations.trillion)switch(a=String(Number(a)/1e3),v){case d.abbreviations.thousand:v=d.abbreviations.million;break;case d.abbreviations.million:v=d.abbreviations.billion;break;case d.abbreviations.billion:v=d.abbreviations.trillion}if(t._.includes(a,"-")&&(a=a.slice(1),C=!0),a.length0;w--)a="0"+a;return b>-1&&(a=a.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1"+d.delimiters.thousands)),0===r.indexOf(".")&&(a=""),h=a+B+(v||""),u?h=(u&&C?"(":"")+h+(u&&C?")":""):c>=0?h=0===c?(C?"-":"+")+h:h+(C?"-":"+"):C&&(h="-"+h),h},stringToNumber:function(t){var e,r,s,l=o[a.currentLocale],n=t,i={thousand:3,million:6,billion:9,trillion:12};if(a.zeroFormat&&t===a.zeroFormat)r=0;else if(a.nullFormat&&t===a.nullFormat||!t.replace(/[^0-9]+/g,"").length)r=null;else{for(e in r=1,"."!==l.delimiters.decimal&&(t=t.replace(/\./g,"").replace(l.delimiters.decimal,".")),i)if(s=new RegExp("[^a-zA-Z]"+l.abbreviations[e]+"(?:\\)|(\\"+l.currency.symbol+")?(?:\\))?)?$"),n.match(s)){r*=Math.pow(10,i[e]);break}r*=(t.split("-").length+Math.min(t.split("(").length-1,t.split(")").length-1))%2?1:-1,t=t.replace(/[^0-9\.]+/g,""),r*=Number(t)}return r},isNaN:function(t){return"number"==typeof t&&isNaN(t)},includes:function(t,e){return-1!==t.indexOf(e)},insert:function(t,e,r){return t.slice(0,r)+e+t.slice(r)},reduce:function(t,e){if(null===this)throw new TypeError("Array.prototype.reduce called on null or undefined");if("function"!=typeof e)throw new TypeError(e+" is not a function");var r,s=Object(t),l=s.length>>>0,n=0;if(3===arguments.length)r=arguments[2];else{for(;n=l)throw new TypeError("Reduce of empty array with no initial value");r=s[n++]}for(;ns?t:s}),1)},toFixed:function(t,e,r,s){var l,n,o,i,a=t.toString().split("."),g=e-(s||0);return l=2===a.length?Math.min(Math.max(a[1].length,g),e):g,o=Math.pow(10,l),i=(r(t+"e+"+l)/o).toFixed(l),s>e-l&&(n=new RegExp("\\.?0{1,"+(s-(e-l))+"}$"),i=i.replace(n,"")),i}},t.options=a,t.formats=n,t.locales=o,t.locale=function(t){return t&&(a.currentLocale=t.toLowerCase()),a.currentLocale},t.localeData=function(t){if(!t)return o[a.currentLocale];if(t=t.toLowerCase(),!o[t])throw new Error("Unknown locale : "+t);return o[t]},t.reset=function(){for(var t in i)a[t]=i[t]},t.zeroFormat=function(t){a.zeroFormat="string"==typeof t?t:null},t.nullFormat=function(t){a.nullFormat="string"==typeof t?t:null},t.defaultFormat=function(t){a.defaultFormat="string"==typeof t?t:"0.0"},t.register=function(t,e,r){if(e=e.toLowerCase(),this[t+"s"][e])throw new TypeError(e+" "+t+" already registered.");return this[t+"s"][e]=r,r},t.validate=function(e,r){var s,l,n,o,i,a,g,c;if("string"!=typeof e&&(e+="",console.warn&&console.warn("Numeral.js: Value is not string. It has been co-erced to: ",e)),(e=e.trim()).match(/^\d+$/))return!0;if(""===e)return!1;try{g=t.localeData(r)}catch(b){g=t.localeData(t.locale())}return n=g.currency.symbol,i=g.abbreviations,s=g.delimiters.decimal,l="."===g.delimiters.thousands?"\\.":g.delimiters.thousands,!(null!==(c=e.match(/^[^\d]+/))&&(e=e.substr(1),c[0]!==n)||null!==(c=e.match(/[^\d]+$/))&&(e=e.slice(0,-1),c[0]!==i.thousand&&c[0]!==i.million&&c[0]!==i.billion&&c[0]!==i.trillion)||(a=new RegExp(l+"{2}"),e.match(/[^\d.,]/g)||(o=e.split(s)).length>2||(o.length<2?!o[0].match(/^\d+.*\d$/)||o[0].match(a):1===o[0].length?!o[0].match(/^\d+$/)||o[0].match(a)||!o[1].match(/^\d+$/):!o[0].match(/^\d+.*\d$/)||o[0].match(a)||!o[1].match(/^\d+$/))))},t.fn=g.prototype={clone:function(){return t(this)},format:function(e,r){var s,l,o,i=this._value,g=e||a.defaultFormat;if(r=r||Math.round,0===i&&null!==a.zeroFormat)l=a.zeroFormat;else if(null===i&&null!==a.nullFormat)l=a.nullFormat;else{for(s in n)if(g.match(n[s].regexps.format)){o=n[s].format;break}l=(o=o||t._.numberToFormat)(i,g,r)}return l},value:function(){return this._value},input:function(){return this._input},set:function(t){return this._value=Number(t),this},add:function(t){var r=e.correctionFactor.call(null,this._value,t);return this._value=e.reduce([this._value,t],(function(t,e,s,l){return t+Math.round(r*e)}),0)/r,this},subtract:function(t){var r=e.correctionFactor.call(null,this._value,t);return this._value=e.reduce([t],(function(t,e,s,l){return t-Math.round(r*e)}),Math.round(this._value*r))/r,this},multiply:function(t){return this._value=e.reduce([this._value,t],(function(t,r,s,l){var n=e.correctionFactor(t,r);return Math.round(t*n)*Math.round(r*n)/Math.round(n*n)}),1),this},divide:function(t){return this._value=e.reduce([this._value,t],(function(t,r,s,l){var n=e.correctionFactor(t,r);return Math.round(t*n)/Math.round(r*n)})),this},difference:function(e){return Math.abs(t(this._value).subtract(e).value())}},t.register("locale","en",{delimiters:{thousands:",",decimal:"."},abbreviations:{thousand:"k",million:"m",billion:"b",trillion:"t"},ordinal:function(t){var e=t%10;return 1==~~(t%100/10)?"th":1===e?"st":2===e?"nd":3===e?"rd":"th"},currency:{symbol:"$"}}),t.register("format","bps",{regexps:{format:/(BPS)/,unformat:/(BPS)/},format:function(e,r,s){var l,n=t._.includes(r," BPS")?" ":"";return e*=1e4,r=r.replace(/\s?BPS/,""),l=t._.numberToFormat(e,r,s),t._.includes(l,")")?((l=l.split("")).splice(-1,0,n+"BPS"),l=l.join("")):l=l+n+"BPS",l},unformat:function(e){return+(1e-4*t._.stringToNumber(e)).toFixed(15)}}),s={base:1024,suffixes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]},l="("+(l=(r={base:1e3,suffixes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]}).suffixes.concat(s.suffixes.filter((function(t){return r.suffixes.indexOf(t)<0}))).join("|")).replace("B","B(?!PS)")+")",t.register("format","bytes",{regexps:{format:/([0\s]i?b)/,unformat:new RegExp(l)},format:function(e,l,n){var o,i,a,g=t._.includes(l,"ib")?s:r,c=t._.includes(l," b")||t._.includes(l," ib")?" ":"";for(l=l.replace(/\s?i?b/,""),o=0;o<=g.suffixes.length;o++)if(i=Math.pow(g.base,o),a=Math.pow(g.base,o+1),null===e||0===e||e>=i&&e0&&(e/=i);break}return t._.numberToFormat(e,l,n)+c},unformat:function(e){var l,n,o=t._.stringToNumber(e);if(o){for(l=r.suffixes.length-1;l>=0;l--){if(t._.includes(e,r.suffixes[l])){n=Math.pow(r.base,l);break}if(t._.includes(e,s.suffixes[l])){n=Math.pow(s.base,l);break}}o*=n||1}return o}}),t.register("format","currency",{regexps:{format:/(\$)/},format:function(e,r,s){var l,n,o=t.locales[t.options.currentLocale],i={before:r.match(/^([\+|\-|\(|\s|\$]*)/)[0],after:r.match(/([\+|\-|\)|\s|\$]*)$/)[0]};for(r=r.replace(/\s?\$\s?/,""),l=t._.numberToFormat(e,r,s),e>=0?(i.before=i.before.replace(/[\-\(]/,""),i.after=i.after.replace(/[\-\)]/,"")):e<0&&!t._.includes(i.before,"-")&&!t._.includes(i.before,"(")&&(i.before="-"+i.before),n=0;n=0;n--)switch(i.after[n]){case"$":l=n===i.after.length-1?l+o.currency.symbol:t._.insert(l,o.currency.symbol,-(i.after.length-(1+n)));break;case" ":l=n===i.after.length-1?l+" ":t._.insert(l," ",-(i.after.length-(1+n)+o.currency.symbol.length-1))}return l}}),t.register("format","exponential",{regexps:{format:/(e\+|e-)/,unformat:/(e\+|e-)/},format:function(e,r,s){var l=("number"!=typeof e||t._.isNaN(e)?"0e+0":e.toExponential()).split("e");return r=r.replace(/e[\+|\-]{1}0/,""),t._.numberToFormat(Number(l[0]),r,s)+"e"+l[1]},unformat:function(e){var r=t._.includes(e,"e+")?e.split("e+"):e.split("e-"),s=Number(r[0]),l=Number(r[1]);return l=t._.includes(e,"e-")?l*=-1:l,t._.reduce([s,Math.pow(10,l)],(function(e,r,s,l){var n=t._.correctionFactor(e,r);return e*n*(r*n)/(n*n)}),1)}}),t.register("format","ordinal",{regexps:{format:/(o)/},format:function(e,r,s){var l=t.locales[t.options.currentLocale],n=t._.includes(r," o")?" ":"";return r=r.replace(/\s?o/,""),n+=l.ordinal(e),t._.numberToFormat(e,r,s)+n}}),t.register("format","percentage",{regexps:{format:/(%)/,unformat:/(%)/},format:function(e,r,s){var l,n=t._.includes(r," %")?" ":"";return t.options.scalePercentBy100&&(e*=100),r=r.replace(/\s?\%/,""),l=t._.numberToFormat(e,r,s),t._.includes(l,")")?((l=l.split("")).splice(-1,0,n+"%"),l=l.join("")):l=l+n+"%",l},unformat:function(e){var r=t._.stringToNumber(e);return t.options.scalePercentBy100?.01*r:r}}),t.register("format","time",{regexps:{format:/(:)/,unformat:/(:)/},format:function(t,e,r){var s=Math.floor(t/60/60),l=Math.floor((t-60*s*60)/60),n=Math.round(t-60*s*60-60*l);return s+":"+(l<10?"0"+l:l)+":"+(n<10?"0"+n:n)},unformat:function(t){var e=t.split(":"),r=0;return 3===e.length?(r+=60*Number(e[0])*60,r+=60*Number(e[1]),r+=Number(e[2])):2===e.length&&(r+=60*Number(e[0]),r+=Number(e[1])),Number(r)}}),t},t.exports?t.exports=r():e.numeral=r()}(cr);var br=cr.exports;const hr={v:"#VALUE!",n:"#NAME?",na:"#N/A",r:"#REF!",d:"#DIV/0!",nm:"#NUM!",nl:"#NULL!",sp:"#SPILL!"};function dr(t){return null!==t&&""!==t.toString().replace(/\s/g,"")&&("boolean"!=typeof t&&!Number.isNaN(t))}let ur=new Date("2017-02-19T19:06:09.000Z");Number.isNaN(ur.getFullYear())&&(ur=new Date("2/19/17"));const fr=2017===ur.getFullYear();const vr=new Date(1900,2,1,0,0,0);function mr(t,e){let r=Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds());const s=Date.UTC(1899,11,31,0,0,0);return e?r-=1262304e5:t>=vr&&(r+=864e5),(r-s)/864e5}function pr(t){let e=null,r={},s=t;if(null===t)return null;if(/^-?[0-9]{1,}[,][0-9]{3}(.[0-9]{1,2})?$/.test(t)){e=t,s=Number(t.split(".")[0].replace(",",""));let l="#,##0";if(t.split(".")[1]){l="#,##0.";for(let e=0;e0&&(Math.abs(parseFloat(t))>=1e11||Math.abs(parseFloat(t))<1e-9)){s=br(t).value();const l=s.toExponential();if(l.indexOf(".")>-1){let t=l.split(".")[1].split("e")[0].length;t>5&&(t=5),r={fa:`#0.${new Array(t+1).join("0")}E+00`,t:"n"}}else r={fa:"#0.E+00",t:"n"};e=_r.format(r.fa,s)}else if(t.toString().indexOf("%")>-1){const l=t.toString().indexOf("%");let n=t.toString().substr(0,l);const o=n.replace(/,/g,"");if(l===t.toString().length-1&&dr(o))if(n.indexOf(".")>-1)if(n.indexOf(".")===n.lastIndexOf(".")){const l=n.split(".")[0];let o=n.split(".")[1].length;if(o>9&&(o=9),l.indexOf(",")>-1){let n=!0,i=l.split(",");for(let t=1;t-1){let l=!0,o=n.split(",");for(let t=1;t-1)if(t.toString().indexOf(".")===t.toString().lastIndexOf(".")){const l=t.toString().split(".")[0];let n=t.toString().split(".")[1],o=n.length;if(o>9&&(o=9),l.indexOf(",")>-1){let n=!0,i=l.split(",");for(let t=1;t12)return!1;if(s>31)return!1;if(2===r){if(29===new Date(e,1,29).getDate()&&s>29)return!1;if(29!==new Date(e,1,29).getDate()&&s>28)return!1}return!0}(l)||!(t.toString().indexOf(".")>-1||t.toString().indexOf(":")>-1||t.toString().length<16)?(e=t,r.fa="General",r.t="g"):(s=mr(function(t,e){const r=new Date(t);if(fr)return e>0?r.setTime(r.getTime()+60*r.getTimezoneOffset()*1e3):e<0&&r.setTime(r.getTime()-60*r.getTimezoneOffset()*1e3),r;if(t instanceof Date)return t;if(1917===ur.getFullYear()&&!Number.isNaN(r.getFullYear())){const e=r.getFullYear();return t.indexOf(`${e}`)>-1||r.setFullYear(r.getFullYear()+100),r}const s=t.match(/\d+/g)||["2017","2","19","0","0","0"];let l=new Date(+s[0],+s[1]-1,+s[2],+s[3]||0,+s[4]||0,+s[5]||0);return t.indexOf("Z")>-1&&(l=new Date(l.getTime()-60*l.getTimezoneOffset()*1e3)),l}(t.toString().replace(/-/g,"/"))),s.toString().indexOf(".")>-1?t.toString().length>18?r.fa="yyyy-MM-dd hh:mm:ss":t.toString().length>11?r.fa="yyyy-MM-dd hh:mm":r.fa="yyyy-MM-dd":r.fa="yyyy-MM-dd",r.t="d",e=_r.format(r.fa,s));var l;return[e,r,s]}const _r={format(t,e){}},Br=(t,e)=>{};class Cr{static getApplyData(t,e,r,s,l){const n=this,o=[];n.applyType=s,n.direction=l;const i=Math.floor(r/e),a=r%e,g=t.number,c=[];if(g)for(let T=0;T0)for(let t=0;t0)for(let t=0;t0)for(let t=0;t0)for(let t=0;t0)for(let t=0;t0)for(let t=0;t0)for(let t=0;t0;){const o=t%1e4;n&&(l=e.chnNumChar2[0]+l),s=e.SectionToChinese(o),s+=0!==o?e.chnUnitSection[r]:e.chnUnitSection[0],l=s+l,n=o<1e3&&o>0,t=Math.floor(t/1e4),r++}return l}static SectionToChinese(t){const e=this;let r="",s="",l=0,n=!0;for(;t>0;){const o=t%10;0===o?n||(n=!0,s=e.chnNumChar2[o]+s):(n=!1,r=e.chnNumChar2[o],r+=e.chnUnitChar[l],s=r+s),l++,t=Math.floor(t/10)}return s}static getLenS(t,e){let r=0;for(let s=0;s0&&n.ChineseToNumber(t[e].m)<7?l.push(n.ChineseToNumber(t[e].m)+7*i):l.push(n.ChineseToNumber(t[e].m));if(r!==Pt.TOP&&r!==Pt.LEFT||(t.reverse(),l.reverse()),n.isEqualDiff(l))if(s||l[l.length-1]<6&&l[0]>0||l[0]<6&&l[l.length-1]>0){const r=l[1]-l[0];o=n.FillChnWeek(t,e,r)}else{const r=l[1]-l[0];o=n.FillChnNumber(t,e,r)}else o=n.FillCopy(t,e)}else if("chnWeek2"===l)if(1===t.length){let s=0;r===Pt.BOTTOM||r===Pt.RIGHT?s=1:r!==Pt.TOP&&r!==Pt.LEFT||(s=-1),o=n.FillChnWeek2(t,e,s)}else{const s=[];let l=0;for(let e=0;e7){let s=0;r===Pt.BOTTOM||r===Pt.RIGHT?s=1:r!==Pt.TOP&&r!==Pt.LEFT||(s=-1,t.reverse());let l=0;for(let r=1;r<=e;r++){const e=(r-1)%t.length,n=__spreadValues({},t[e]),i=Math.ceil(r/t.length);0===e&&(l=gr(n.m).add(s*i,"months").diff(gr(n.m),"days"));const a=gr(n.m).add(l,"days").day();let g;g=0===a?gr(n.m).add(l,"days").subtract(2,"days").format("YYYY-MM-DD"):6===a?gr(n.m).add(l,"days").subtract(1,"days").format("YYYY-MM-DD"):gr(n.m).add(l,"days").format("YYYY-MM-DD"),n.m=g,n.v=pr(g)[2],o.push(n)}}else{let s=0;r===Pt.BOTTOM||r===Pt.RIGHT?s=7:r!==Pt.TOP&&r!==Pt.LEFT||(s=-7,t.reverse());let l=0;for(let r=1;r<=e;r++){const e=(r-1)%t.length,n=__spreadValues({},t[e]),i=Math.ceil(r/t.length);0===e&&(l=gr(n.m).add(s*i,"days").diff(gr(n.m),"days"));const a=gr(n.m).add(l,"days").day();let g;g=0===a?gr(n.m).add(l,"days").subtract(2,"days").format("YYYY-MM-DD"):6===a?gr(n.m).add(l,"days").subtract(1,"days").format("YYYY-MM-DD"):gr(n.m).add(l,"days").format("YYYY-MM-DD"),n.m=g,n.v=pr(g)[2],o.push(n)}}else{const s=n.judgeDate(t);if(s[0]&&s[3]){r!==Pt.TOP&&r!==Pt.LEFT||t.reverse();const s=gr(t[1].m).diff(gr(t[0].m),"months");for(let r=1;r<=e;r++){const e=(r-1)%t.length,l=__spreadValues({},t[e]),n=gr(t[t.length-1].m).add(s*r,"months").day();let i;i=0===n?gr(t[t.length-1].m).add(s*r,"months").subtract(2,"days").format("YYYY-MM-DD"):6===n?gr(t[t.length-1].m).add(s*r,"months").subtract(1,"days").format("YYYY-MM-DD"):gr(t[t.length-1].m).add(s*r,"months").format("YYYY-MM-DD"),l.m=i,l.v=pr(i)[2],o.push(l)}}else if(!s[0]&&s[2])if(Math.abs(gr(t[1].m).diff(gr(t[0].m)))>7){let s=0;r===Pt.BOTTOM||r===Pt.RIGHT?s=1:r!==Pt.TOP&&r!==Pt.LEFT||(s=-1,t.reverse());let l=0;for(let r=1;r<=e;r++){const e=(r-1)%t.length,n=__spreadValues({},t[e]),i=Math.ceil(r/t.length);0===e&&(l=gr(n.m).add(s*i,"months").diff(gr(n.m),"days"));const a=gr(n.m).add(l,"days").day();let g;g=0===a?gr(n.m).add(l,"days").subtract(2,"days").format("YYYY-MM-DD"):6===a?gr(n.m).add(l,"days").subtract(1,"days").format("YYYY-MM-DD"):gr(n.m).add(l,"days").format("YYYY-MM-DD"),n.m=g,n.v=pr(g)[2],o.push(n)}}else{let s=0;r===Pt.BOTTOM||r===Pt.RIGHT?s=7:r!==Pt.TOP&&r!==Pt.LEFT||(s=-7,t.reverse());let l=0;for(let r=1;r<=e;r++){const e=(r-1)%t.length,n=__spreadValues({},t[e]),i=Math.ceil(r/t.length);0===e&&(l=gr(n.m).add(s*i,"days").diff(gr(n.m),"days"));const a=gr(n.m).add(l,"days").day();let g;g=0===a?gr(n.m).add(l,"days").subtract(2,"days").format("YYYY-MM-DD"):6===a?gr(n.m).add(l,"days").subtract(1,"days").format("YYYY-MM-DD"):gr(n.m).add(l,"days").format("YYYY-MM-DD"),n.m=g,n.v=pr(g)[2],o.push(n)}}else r!==Pt.TOP&&r!==Pt.LEFT||t.reverse(),o=n.FillCopy(t,e)}else if("6"===s)if(1===t.length){let s=0;r===Pt.BOTTOM||r===Pt.RIGHT?s=1:r!==Pt.TOP&&r!==Pt.LEFT||(s=-1),o=n.FillMonths(t,e,s)}else if(2===t.length)if(gr(t[1].m).date()===gr(t[0].m).date()&&0!==gr(t[1].m).diff(gr(t[0].m),"months")){r!==Pt.TOP&&r!==Pt.LEFT||t.reverse();const s=gr(t[1].m).diff(gr(t[0].m),"months");o=n.FillMonths(t,e,s)}else{let s=0;r===Pt.BOTTOM||r===Pt.RIGHT?s=1:r!==Pt.TOP&&r!==Pt.LEFT||(s=-1,t.reverse());let l=0;for(let r=1;r<=e;r++){const e=(r-1)%t.length,n=__spreadValues({},t[e]),i=Math.ceil(r/t.length);0===e&&(l=gr(n.m).add(s*i,"months").diff(gr(n.m),"days"));const a=gr(n.m).add(l,"days").format("YYYY-MM-DD");n.m=a,n.v=pr(a)[2],o.push(n)}}else{const s=n.judgeDate(t);if(s[0]&&s[3]){r!==Pt.TOP&&r!==Pt.LEFT||t.reverse();const s=gr(t[1].m).diff(gr(t[0].m),"months");o=n.FillMonths(t,e,s)}else if(!s[0]&&s[2]){let s=0;r===Pt.BOTTOM||r===Pt.RIGHT?s=1:r!==Pt.TOP&&r!==Pt.LEFT||(s=-1,t.reverse());let l=0;for(let r=1;r<=e;r++){const e=(r-1)%t.length,n=__spreadValues({},t[e]),i=Math.ceil(r/t.length);0===e&&(l=gr(n.m).add(s*i,"months").diff(gr(n.m),"days"));const a=gr(n.m).add(l,"days").format("YYYY-MM-DD");n.m=a,n.v=pr(a)[2],o.push(n)}}else r!==Pt.TOP&&r!==Pt.LEFT||t.reverse(),o=n.FillCopy(t,e)}else if("7"===s)if(1===t.length){let s=0;r===Pt.BOTTOM||r===Pt.RIGHT?s=1:r!==Pt.TOP&&r!==Pt.LEFT||(s=-1),o=n.FillYears(t,e,s)}else if(2===t.length)if(gr(t[1].m).date()===gr(t[0].m).date()&&gr(t[1].m).month()===gr(t[0].m).month()&&0!==gr(t[1].m).diff(gr(t[0].m),"years")){r!==Pt.TOP&&r!==Pt.LEFT||t.reverse();const s=gr(t[1].m).diff(gr(t[0].m),"years");o=n.FillYears(t,e,s)}else{let s=0;r===Pt.BOTTOM||r===Pt.RIGHT?s=1:r!==Pt.TOP&&r!==Pt.LEFT||(s=-1,t.reverse());let l=0;for(let r=1;r<=e;r++){const e=(r-1)%t.length,n=__spreadValues({},t[e]),i=Math.ceil(r/t.length);0===e&&(l=gr(n.m).add(s*i,"years").diff(gr(n.m),"days"));const a=gr(n.m).add(l,"days").format("YYYY-MM-DD");n.m=a,n.v=pr(a)[2],o.push(n)}}else{const s=n.judgeDate(t);if(s[0]&&s[1]&&s[4]){r!==Pt.TOP&&r!==Pt.LEFT||t.reverse();const s=gr(t[1].m).diff(gr(t[0].m),"years");o=n.FillYears(t,e,s)}else if(s[0]&&s[3]||s[2]){let s=0;r===Pt.BOTTOM||r===Pt.RIGHT?s=1:r!==Pt.TOP&&r!==Pt.LEFT||(s=-1,t.reverse());let l=0;for(let r=1;r<=e;r++){const e=(r-1)%t.length,n=__spreadValues({},t[e]),i=Math.ceil(r/t.length);0===e&&(l=gr(n.m).add(s*i,"years").diff(gr(n.m),"days"));const a=gr(n.m).add(l,"days").format("YYYY-MM-DD");n.m=a,n.v=pr(a)[2],o.push(n)}}else r!==Pt.TOP&&r!==Pt.LEFT||t.reverse(),o=n.FillCopy(t,e)}else if("8"===s)if(1===t.length){let s=0;r===Pt.BOTTOM||r===Pt.RIGHT?s=1:r!==Pt.TOP&&r!==Pt.LEFT||(s=-1),o=n.FillChnNumber(t,e,s)}else{const s=[];for(let e=0;e0){for(let e=1;e<=l;e++)for(let l=0;l2&&s.isEqualRatio(n))for(let o=1;o<=e;o++){const e=(o-1)%t.length,s=__spreadValues({},t[e]);let n;r===Pt.BOTTOM||r===Pt.RIGHT?n=Number(t[t.length-1].v)*(Number(t[1].v)/Number(t[0].v))**o:r!==Pt.TOP&&r!==Pt.LEFT||(n=Number(t[0].v)/(Number(t[1].v)/Number(t[0].v))**o),s.v=n,s.m=n,l.push(s)}else{const o=s.getXArr(t.length);for(let i=1;i<=e;i++){const e=(i-1)%t.length,a=__spreadValues({},t[e]);let g;r===Pt.BOTTOM||r===Pt.RIGHT?g=s.forecast(t.length+i,n,o):r!==Pt.TOP&&r!==Pt.LEFT||(g=s.forecast(1-i,n,o)),a.v=g,a.m=g,l.push(a)}}return l}static FillExtendNumber(t,e,r){const s=[],l=/0|([1-9]+[0-9]*)/g;for(let n=1;n<=e;n++){const e=(n-1)%t.length,o=__spreadValues({},t[e]),i=t[t.length-1].m,a=i.match(l),g=a[a.length-1],c=Math.abs(Number(g)+r*n),b=i.lastIndexOf(g),h=i.substr(0,b)+c.toString()+i.substr(b+g.length);o.v=h,o.m=h,s.push(o)}return s}static FillOnlyFormat(t,e){const r=[];for(let s=1;s<=e;s++){const e=(s-1)%t.length,l=__spreadValues({},t[e]);delete l.f,delete l.m,delete l.v,r.push(l)}return r}static FillWithoutFormat(t){const e=[];for(let r=0;r{this._rangeList.push(this._context.getWorkBook().transformRangeType(t).rangeData)})),-1===this._rangeList[0].startRow&&console.error("Invalid range,default set startRow -1")}getRangeList(){return this._rangeList}activate(){return-1===this._rangeList[0].startRow?(console.error("Invalid range,default set startRow -1"),this):(this._worksheet.getSelection().setSelection({selection:this._rangeList}),this)}setValue(t){let{_rangeList:e,_context:r,_commandManager:s,_worksheet:l}=this;const n=e.map((e=>{let{startRow:r,startColumn:s,endRow:n,endColumn:o}=e,i=new v;for(let l=r;l<=n;l++)for(let e=s;e<=o;e++)i.setValue(r,s,{m:`${t}`,v:t});return{sheetId:l.getSheetId(),actionName:Kl.NAME,cellValue:i.getData()}}));let o=new zs({WorkBookUnit:r.getWorkBook()},...n);return s.invoke(o),this}clear(...t){const{_context:e,_worksheet:r,_commandManager:s,_rangeList:l}=this;let n={formatOnly:!0,contentsOnly:!0};As.checkup(t,As.OBJECT_TYPE)&&(n=t[0]);const o=l.map((t=>({sheetId:r.getSheetId(),actionName:Zl.NAME,options:n,rangeData:t})));let i=new zs({WorkBookUnit:e.getWorkBook()},...o);return s.invoke(i),this}clearFormat(){return this.clear({formatOnly:!0})}clearContent(){return this.clear({contentsOnly:!0})}clearNote(){return this.clear({commentsOnly:!0})}setBackground(t){let{_rangeList:e,_context:r,_commandManager:s,_worksheet:l}=this;const n=e.map((e=>{let{startRow:r,startColumn:s,endRow:n,endColumn:o}=e;const i={bg:{rgb:t}},a=B.fillObjectMatrix(n-r+1,o-s+1,i);return{sheetId:l.getSheetId(),actionName:mt.SET_RANGE_STYLE_ACTION,value:a,rangeData:e}}));let o=new zs({WorkBookUnit:r.getWorkBook()},...n);return s.invoke(o),this}setBackgroundRGB(t,e,r){const s=`RGB(${t},${e},${r})`;let{_rangeList:l,_context:n,_commandManager:o,_worksheet:i}=this;const a=l.map((t=>{let{startRow:e,startColumn:r,endRow:l,endColumn:n}=t;const o={bg:{rgb:s}},a=B.fillObjectMatrix(l-e+1,n-r+1,o);return{sheetId:i.getSheetId(),actionName:mt.SET_RANGE_STYLE_ACTION,value:a,rangeData:t}}));let g=new zs({WorkBookUnit:n.getWorkBook()},...a);return o.invoke(g),this}setFontColor(t){let{_rangeList:e,_context:r,_commandManager:s,_worksheet:l}=this;const n=e.map((e=>{let{startRow:r,startColumn:s,endRow:n,endColumn:o}=e;const i={cl:{rgb:t}},a=B.fillObjectMatrix(n-r+1,o-s+1,i);return{sheetId:l.getSheetId(),actionName:mt.SET_RANGE_STYLE_ACTION,value:a,rangeData:e}}));let o=new zs({WorkBookUnit:r.getWorkBook()},...n);return s.invoke(o),this}setFontFamily(t){return this._setStyle(t,"ff")}setUnderline(t){const e={s:t?_e.TRUE:_e.FALSE};return this._setStyle(e,"ul")}setOverline(t){const e={s:t?_e.TRUE:_e.FALSE};return this._setStyle(e,"ol")}setStrikeThrough(t){const e={s:t?_e.TRUE:_e.FALSE};return this._setStyle(e,"st")}setFontSize(t){return this._setStyle(t,"fs")}setFontStyle(t){const e=t?_e.TRUE:_e.FALSE;return this._setStyle(e,"it")}setFontWeight(t){const e=t?_e.TRUE:_e.FALSE;return this._setStyle(e,"bl")}setHorizontalAlignment(t){return this._setStyle(t,"ht")}setTextDirection(t){return this._setStyle(t,"td")}setTextRotation(t){let{_rangeList:e,_context:r,_commandManager:s,_worksheet:l}=this;const n=e.map((e=>{let{startRow:r,startColumn:s,endRow:n,endColumn:o}=e;const i={tr:{v:0,a:Number(t)}},a=B.fillObjectMatrix(n-r+1,o-s+1,i);return{sheetId:l.getSheetId(),actionName:mt.SET_RANGE_STYLE_ACTION,value:a,rangeData:e}}));let o=new zs({WorkBookUnit:r.getWorkBook()},...n);return s.invoke(o),this}setVerticalAlignment(t){return this._setStyle(t,"vt"),this}setVerticalText(t){let{_rangeList:e,_context:r,_commandManager:s,_worksheet:l}=this;const n=e.map((e=>{let{startRow:r,startColumn:s,endRow:n,endColumn:o}=e;const i={tr:{v:t,a:0}},a=B.fillObjectMatrix(n-r+1,o-s+1,i);return{sheetId:l.getSheetId(),actionName:mt.SET_RANGE_STYLE_ACTION,value:a,rangeData:e}}));let o=new zs({WorkBookUnit:r.getWorkBook()},...n);return s.invoke(o),this}setWrap(t){return this._setStyle(t,"tb")}setWrapStrategy(t){return this._setStyle(t,"tb")}trimWhitespace(){let{_rangeList:t,_context:e,_commandManager:r,_worksheet:s}=this;const l=t.map((t=>{let{startRow:e,startColumn:r,endRow:l,endColumn:n}=t;const o=this._worksheet.getCellMatrix(),i=/\s+/g;let a=new v;for(let s=e;s{let{startRow:s,startColumn:l,endRow:o,endColumn:i}=r;const a={[e]:t},g=B.fillObjectMatrix(o-s+1,i-l+1,a);return{sheetId:n.getSheetId(),value:g,rangeData:r,actionName:Cn.NAME}}));let i=new zs({WorkBookUnit:s.getWorkBook()},...o);return l.invoke(i),this}}class Tr{constructor(t,e){this._workSheet=t,this._rowData=new u(e)}getRowData(){return this._rowData}getRowDatas(t,e){const r=new u;for(let s=t;s{for(let s=e;s{for(let s=e;s{for(let s=e;s{const r=o.getValue(t,e);if(r){const s=a.getStyleByCell(r);if(s){const r=B.deepClone(s);r.bd&&delete r.bd.b,u.setValue(t,e,r)}}})),b.forEach(((t,e)=>{const r=o.getValue(t,e);if(r){const s=a.getStyleByCell(r);if(s){const r=B.deepClone(s);r.bd&&delete r.bd.t,m.setValue(t,e,r)}}})),c.forEach(((t,e)=>{const r=o.getValue(t,e);if(r){const s=a.getStyleByCell(r);if(s){const r=B.deepClone(s);r.bd&&delete r.bd.r,f.setValue(t,e,r)}}})),h.forEach(((t,e)=>{const r=o.getValue(t,e);if(r){const s=a.getStyleByCell(r);if(s){const r=B.deepClone(s);r.bd&&delete r.bd.l,p.setValue(t,e,r)}}})),d.forEach(((t,r)=>{_.setValue(t,r,e)}));const C=[];if(r.includes(Pt.TOP)){const t={sheetId:s,actionName:bn.NAME,styles:m.toJSON()};C.push(t)}if(r.includes(Pt.BOTTOM)){const t={sheetId:s,actionName:bn.NAME,styles:u.toJSON()};C.push(t)}if(r.includes(Pt.LEFT)){const t={sheetId:s,actionName:bn.NAME,styles:p.toJSON()};C.push(t)}if(r.includes(Pt.RIGHT)){const t={sheetId:s,actionName:bn.NAME,styles:f.toJSON()};C.push(t)}const w={sheetId:s,actionName:bn.NAME,styles:_.toJSON()};C.push(w);const T=new zs({WorkBookUnit:i},...C);return l.invoke(T),this}setCurrentCell(t){return t.activateAsCurrentCell()}getActiveCell(){return this.getSelection().getCurrentCell()}getActiveRange(){return this.getSelection().getActiveRange()}getActiveRangeList(){return this.getSelection().getActiveRangeList()}getIndex(){const t=this._context.getWorkBook().getSheets().findIndex((t=>t&&t.getSheetId()===this._sheetId));return t>-1?t+1:null}getParent(){return this._context.getWorkBook()}isSheetHidden(){return this._config.hidden}setActiveRange(t){return this.getSelection().setSelection(t)}setActiveRangeList(t){const e=this.getSelection();return e.setSelection(t),e.getActiveRangeList()}hideRow(t){const e=t.getRangeData(),r=e.startRow,s=e.endRow-e.startRow+1,{_context:l,_sheetId:n}=this,o=this.getCommandManager(),i={actionName:Sn.NAME,sheetId:n,rowCount:s,rowIndex:r},a=new zs({WorkBookUnit:l.getWorkBook()},i);return o.invoke(a),this}hideRows(...t){const e=--t[0];let r=1;t[1]&&(r=t[1]);const{_context:s,_sheetId:l}=this,n=this.getCommandManager(),o={actionName:Sn.NAME,sheetId:l,rowCount:r,rowIndex:e},i=new zs({WorkBookUnit:s.getWorkBook()},o);return n.invoke(i),this}hideColumn(t){const e=t.getRangeData(),r=e.startColumn,s=e.endColumn-e.startColumn+1,{_context:l,_sheetId:n}=this,o=this.getCommandManager(),i={actionName:hn.NAME,sheetId:n,columnCount:s,columnIndex:r},a=new zs({WorkBookUnit:l.getWorkBook()},i);return o.invoke(a),this}hideColumns(...t){const e=t[0];let r=1;t[1]&&(r=t[1]);const{_context:s,_sheetId:l}=this,n=this.getCommandManager(),o={actionName:hn.NAME,sheetId:l,columnCount:r,columnIndex:e},i=new zs({WorkBookUnit:s.getWorkBook()},o);return n.invoke(i),this}unhideRow(t){const e=t.getRangeData(),r=e.startRow,s=e.endRow-e.startRow+1,{_context:l,_sheetId:n}=this,o=this.getCommandManager(),i={actionName:jn.NAME,rowCount:s,rowIndex:r,sheetId:n},a=new zs({WorkBookUnit:l.getWorkBook()},i);return o.invoke(a),this}unhideColumn(t){const e=t.getRangeData(),r=e.startColumn,s=e.endColumn-e.startColumn+1,{_context:l,_sheetId:n}=this,o=this.getCommandManager(),i={actionName:dn.NAME,sheetId:n,columnCount:s,columnIndex:r},a=new zs({WorkBookUnit:l.getWorkBook()},i);return o.invoke(a),this}showColumns(...t){const e=t[0];let r=1;t[1]&&(r=t[1]);const{_context:s,_sheetId:l}=this,n=this.getCommandManager(),o={actionName:dn.NAME,sheetId:l,columnCount:r,columnIndex:e},i=new zs({WorkBookUnit:s.getWorkBook()},o);return n.invoke(i),this}showRows(...t){const e=--t[0];let r=1;t[1]&&(r=t[1]);const{_context:s,_sheetId:l}=this,n=this.getCommandManager(),o={actionName:jn.NAME,sheetId:l,rowCount:r,rowIndex:e},i=new zs({WorkBookUnit:s.getWorkBook()},o);return n.invoke(i),this}hasHiddenGridlines(){const{_config:t}=this,{showGridlines:e}=t;return 0===e}getTabColor(){const{_config:t}=this,{tabColor:e}=t;return e}getColumnWidth(t){return this.getColumnManager().getColumnWidth(t)}getRowHeight(t){return this.getRowManager().getRowHeight(t)}setColumnWidth(...t){let e,r=[];if(B.hasLength(t,2)&&(e=t[0],r=[t[1]]),B.hasLength(t,3)){e=t[0];for(let e=0;et.map((t=>t&&t.p?t.p:t&&t.m?t.m:""))))}getA1Notation(){const{startRow:t,endRow:e,startColumn:r,endColumn:s}=this._rangeData;let l,n;return rt.map((t=>{var e,r,s;const l=this._context.getWorkBook().getStyles();let n=null==(e=ke.bg)?void 0:e.rgb;return n=null==(s=null==(r=l.getStyleByCell(t))?void 0:r.bg)?void 0:s.rgb,n}))))}getCell(t,e){const{startRow:r,endRow:s,startColumn:l,endColumn:n}=this._rangeData,o={startRow:r+t,endRow:r+t,startColumn:l+e,endColumn:l+e};return new Sr(this._worksheet,o)}getColumn(){return this._rangeData.startColumn}getObjectValue(t={}){return this.getObjectValues(t)[0][0]}getObjectValues(t={}){const{startRow:e,endRow:r,startColumn:s,endColumn:l}=this._rangeData,n=this._worksheet.getCellMatrix().getFragments(e,r,s,l).getData();if(t.isIncludeStyle){const t=this._context.getWorkBook().getStyles();for(let o=0;o<=r-e;o++)for(let e=0;e<=l-s;e++){if(!n[o][e])continue;const r=n[o][e].s;r&&(n[o][e].s=t.get(r))}}return n}getFontColor(){return this.getFontColors()[0][0]}getFontColors(){return this.getValues().map((t=>t.map((t=>{var e,r;const s=this._context.getWorkBook().getStyles().getStyleByCell(t);return(null==(e=null==s?void 0:s.cl)?void 0:e.rgb)||(null==(r=ke.cl)?void 0:r.rgb)}))))}getFontFamilies(){return this._getStyles("ff")}getFontFamily(){return this.getFontFamilies()[0][0]}getUnderlines(){return this._getStyles("ul")}getUnderline(){return this.getUnderlines()[0][0]}getOverlines(){return this._getStyles("ol")}getOverline(){return this.getOverlines()[0][0]}getStrikeThroughs(){return this._getStyles("st")}getStrikeThrough(){return this.getStrikeThroughs()[0][0]}getFontSize(){return this.getFontSizes()[0][0]}getFontSizes(){return this._getStyles("fs")}getBorder(){return this.getBorders()[0][0]}getBorders(){return this._getStyles("bd")}getFontStyle(){return this.getFontStyles()[0][0]}getFontStyles(){return this._getStyles("it")}getFontWeight(){return this.getFontWeights()[0][0]}getFontWeights(){return this._getStyles("bl")}getGridId(){return this._worksheet.getSheetId()}getHeight(){const{_rangeData:t,_worksheet:e}=this,{startRow:r,endRow:s}=t;let l=0;for(let n=0;n<=s-r;n++){l+=e.getRowHeight(n)}return l}getHorizontalAlignment(){return this.getHorizontalAlignments()[0][0]}getHorizontalAlignments(){return this._getStyles("ht")}getLastColumn(){return this._rangeData.endColumn}getLastRow(){return this._rangeData.endRow}getMergedRanges(){const{startRow:t,endRow:e,startColumn:r,endColumn:s}=this._rangeData;return this._worksheet.getMerges().getMergedRanges({startRow:t,endRow:e,startColumn:r,endColumn:s}).map((t=>new Sr(this._worksheet,t)))}getNextDataCell(t){const{_worksheet:e}=this,{startRow:r,endRow:s,startColumn:l,endColumn:n}=this._rangeData,o=e.getMaxRows(),i=e.getMaxColumns();if(t===Pt.BOTTOM){for(let t=0;tt.map((t=>(null==t?void 0:t.p)||""))))}getRowIndex(){return this._rangeData.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(){return this.getValues().map((t=>t.map((t=>this._context.getWorkBook().getStyles().getStyleByCell(t)))))}getVerticalAlignment(){return this.getVerticalAlignments()[0][0]}getVerticalAlignments(){return this._getStyles("vt")}getWidth(){const{_rangeData:t,_worksheet:e}=this,{startColumn:r,endColumn:s}=t;let l=0;for(let n=0;n<=s-r;n++)l+=e.getColumnWidth(n);return l}getWrap(){return this.getWraps()[0][0]}getWraps(){return this._getStyles("tb")}getWrapStrategies(){return this._getStyles("tb")}getWrapStrategy(){return this.getWrapStrategies()[0][0]}isBlank(){return this.getValues().some((t=>t.some((t=>""===(null==t?void 0:t.m)))))}isPartOfMerge(){const{startRow:t,endRow:e,startColumn:r,endColumn:s}=this._rangeData;return!!this._worksheet.getMerges().getByRowColumn(t,e,r,s)}setBackground(t){const{_context:e,_worksheet:r,_commandManager:s}=this,{startRow:l,endRow:n,startColumn:o,endColumn:i}=this._rangeData,a={bg:{rgb:t}},g=B.fillObjectMatrix(n-l+1,i-o+1,a),c={sheetId:r.getSheetId(),actionName:mt.SET_RANGE_STYLE_ACTION,value:g,rangeData:this._rangeData},b=new zs({WorkBookUnit:e.getWorkBook()},c);return s.invoke(b),this}setBackgrounds(t){const{_context:e,_worksheet:r,_commandManager:s}=this,{startRow:l,endRow:n,startColumn:o,endColumn:i}=this._rangeData,a=new v;for(let b=0;bp?Pt.BOTTOM:Pt.TOP:y>B?Pt.RIGHT:Pt.LEFT,d===Pt.BOTTOM||d===Pt.TOP){u=p-m+1,f=w-C+1;for(let t=0;t<=a-i;t++){const r=this.getColumnMatrix(t).toArray();Cr.getCopyData(r,m,p,_,B,d).forEach((r=>{Cr.getApplyData(r,u,f,e,d).forEach(((e,r)=>{S.setValue(r,t,e)}))}))}}else if(d===Pt.RIGHT||d===Pt.LEFT){f=y-T,u=B-_;for(let t=0;t<=o-n;t++){const r=this.getRowMatrix(t).toArray();Cr.getCopyData(r,m,p,_,B,d).forEach((t=>{Cr.getApplyData(t,u,f,e,d)}))}}const j={sheetId:r.getSheetId(),actionName:mt.SET_RANGE_DATA_ACTION,cellValue:S.getData()},E=new zs({WorkBookUnit:s.getWorkBook()},j);return l.invoke(E),this}getDataRegion(...t){const{startRow:e,endRow:r,startColumn:s,endColumn:l}=this._rangeData;let n,o;const i=this._worksheet.getCellMatrix();if(!B.isNumber(t[0])){let t=e,r=e;const l=this._worksheet.getRowCount();for(let n=1;ne.forEach(((e,s)=>{e=e,t.setValue(r+i,s+a,e||{})}))));const l={sheetId:r.getSheetId(),actionName:mt.SET_RANGE_DATA_ACTION,cellValue:t.getData()},o=new zs({WorkBookUnit:e.getWorkBook()},l);s.invoke(o)}else if(l===Ot.PASTE_FORMAT){const t=e.getWorkBook().getStyles(),l=new v;n.map(((e,r)=>e.forEach(((e,s)=>{e=e,l.setValue(r,s,t.getStyleByCell(e)||{})}))));const i={sheetId:r.getSheetId(),actionName:mt.SET_RANGE_STYLE_ACTION,value:l.getData(),rangeData:o},a=new zs({WorkBookUnit:e.getWorkBook()},i);s.invoke(a)}else if(l===Ot.PASTE_VALUES){const t=new v;n.forEach(((e,r)=>e.forEach(((e,s)=>{e=e,t.setValue(r+i,s+a,(null==e?void 0:e.v)||"")}))));const l={sheetId:r.getSheetId(),actionName:mt.SET_RANGE_FORMATTED_VALUE_ACTION,cellValue:t.getData(),rangeData:o},g=new zs({WorkBookUnit:e.getWorkBook()},l);s.invoke(g)}else if(l===Ot.PASTE_COLUMN_WIDTHS){const t=this._rangeData.startColumn;for(let e=0;et.forEach(((t,r)=>{t=t,o.setValue(e+i,r+a,t||{})}))));const g={sheetId:r.getSheetId(),actionName:mt.SET_RANGE_DATA_ACTION,cellValue:o.getData(),options:l},c=new zs({WorkBookUnit:e.getWorkBook()},g);s.invoke(c)}else if(As.checkup(t,Sr)){const t=new v;n.forEach(((e,r)=>e.forEach(((e,s)=>{e=e,t.setValue(r+i,s+a,e||{})}))));const l={sheetId:r.getSheetId(),actionName:mt.SET_RANGE_DATA_ACTION,cellValue:t.getData()},o=new zs({WorkBookUnit:e.getWorkBook()},l);s.invoke(o)}}copyFormatToRange(...t){const{_context:e,_commandManager:r}=this,s=t[1],l=t[2],n=t[3],o=t[4],i=B.isAssignableFrom(t[0],yr)?t[0].getSheetId():t[0],[a,g]=this._handleCopyRange(this,{startRow:s,endRow:l,startColumn:n,endColumn:o}),c=e.getWorkBook().getStyles(),b=new v;a.map(((t,e)=>t.map(((t,r)=>(t=t,b.setValue(e,r,c.getStyleByCell(t)||{}),c.getStyleByCell(t)||{})))));const h={sheetId:i,actionName:mt.SET_RANGE_STYLE_ACTION,value:b.getData(),rangeData:g},d=new zs({WorkBookUnit:e.getWorkBook()},h);r.invoke(d)}copyValuesToRange(...t){const{_context:e,_commandManager:r}=this,s=t[1],l=t[2],n=t[3],o=t[4],i=B.isAssignableFrom(t[0],yr)?t[0].getSheetId():t[0],[a,g]=this._handleCopyRange(this,{startRow:s,endRow:l,startColumn:n,endColumn:o}),c=new v;a.forEach(((t,e)=>t.forEach(((t,r)=>{t=t,c.setValue(e+g.startRow,r+g.startColumn,(null==t?void 0:t.v)||"")}))));const b={sheetId:i,actionName:mt.SET_RANGE_FORMATTED_VALUE_ACTION,cellValue:c.getData(),rangeData:g},h=new zs({WorkBookUnit:e.getWorkBook()},b);r.invoke(h)}moveTo(t){const{_context:e,_worksheet:r,_commandManager:s,_rangeData:l}=this,n={sheetId:r.getSheetId(),actionName:mt.CLEAR_RANGE_ACTION,options:{formatOnly:!0,contentsOnly:!0,commentsOnly:!0,validationsOnly:!0,skipFilteredRows:!0},rangeData:l},o=this.getMatrix(),{startRow:i,endRow:a,startColumn:g,endColumn:c}=this._rangeData,{startRow:b,startColumn:h}=t.getRangeData(),d=new v;for(let v=i;v<=a;v++)for(let t=g;t<=c;t++)d.setValue(b+(v-i),h+(t-g),o.getValue(v,t)||{});const u={sheetId:r.getSheetId(),actionName:mt.SET_RANGE_DATA_ACTION,cellValue:d.getData()},f=new zs({WorkBookUnit:e.getWorkBook()},n,u);s.invoke(f)}offset(...t){const{startRow:e,endRow:r,startColumn:s,endColumn:l}=this._rangeData,n=t[0],o=t[1],i=t[2],a=t[3],g={startRow:e+n,endRow:r+n,startColumn:s+o,endColumn:l+o};return B.isNumber(i)&&(g.endRow=g.startRow+i-1),B.isNumber(a)&&(g.endColumn=g.endColumn+a-1),new Sr(this._worksheet,g)}setBorder(...t){const e=t[0],r=t[1],s=t[2],l=t[3],n=t[4],o=t[5],i=t[6]?t[6]:"black",a=t[7]?t[7]:Tt.DASH_DOT,{_context:g,_worksheet:c,_commandManager:b}=this,h=g.getWorkBook(),d=this._rangeData,u=c.getSheetId(),f={startRow:d.startRow-1,startColumn:d.startColumn,endRow:d.startRow-1,endColumn:d.endColumn},m={startRow:d.startRow,startColumn:d.startColumn-1,endRow:d.endRow,endColumn:d.startColumn-1},p={startRow:d.endRow+1,startColumn:d.startColumn,endRow:d.endRow+1,endColumn:d.endColumn},_={startRow:d.startRow,startColumn:d.endColumn+1,endRow:d.endRow,endColumn:d.endColumn+1},C={startRow:d.startRow,startColumn:d.startColumn,endRow:d.startRow,endColumn:d.endColumn},w={startRow:d.startRow,startColumn:d.startColumn,endRow:d.endRow,endColumn:d.startColumn},T={startRow:d.endRow,startColumn:d.startColumn,endRow:d.endRow,endColumn:d.endColumn},y={startRow:d.startRow,startColumn:d.endColumn,endRow:d.endRow,endColumn:d.endColumn},S=new Sr(c,f),j=new Sr(c,m),E=new Sr(c,p),Y=new Sr(c,_),R=new Sr(c,C),I=new Sr(c,w),A=new Sr(c,T),x=new Sr(c,y),O=new v,N=new v,k=new v,M=new v,D=new v,L=[],P={s:a,cl:{rgb:i}};if(!0===e||!1===e){if(S.isValid()){S.forEach(((t,e)=>{O.setValue(t,e,{bd:{b:null}})}));const t={sheetId:u,actionName:mt.SET_RANGE_STYLE_ACTION,value:O.getArrayData(),rangeData:f};L.push(t)}R.forEach(((t,r)=>{if(!0===e){const e=B.deepMerge(D.getValue(t,r)||{},{bd:{t:B.deepClone(P)}});D.setValue(t,r,e)}else if(!1===e){const e=B.deepMerge(D.getValue(t,r)||{},{bd:{t:null}});D.setValue(t,r,e)}}))}if(!0===s||!1===s){if(E.isValid()){E.forEach(((t,e)=>{k.setValue(t,e,{bd:{t:null}})}));const t={sheetId:u,actionName:mt.SET_RANGE_STYLE_ACTION,value:k.getArrayData(),rangeData:p};L.push(t)}A.forEach(((t,e)=>{if(!0===s){const r=B.deepMerge(D.getValue(t,e)||{},{bd:{b:B.deepClone(P)}});D.setValue(t,e,r)}else if(!1===s){const r=B.deepMerge(D.getValue(t,e)||{},{bd:{b:null}});D.setValue(t,e,r)}}))}if(!0===r||!1===r){if(j.isValid()){j.forEach(((t,e)=>{N.setValue(t,e,{bd:{r:null}})}));const t={sheetId:u,actionName:mt.SET_RANGE_STYLE_ACTION,value:N.getArrayData(),rangeData:m};L.push(t)}I.forEach(((t,e)=>{if(!0===r){const r=B.deepMerge(D.getValue(t,e)||{},{bd:{l:B.deepClone(P)}});D.setValue(t,e,r)}else if(!1===r){const r=B.deepMerge(D.getValue(t,e)||{},{bd:{l:null}});D.setValue(t,e,r)}}))}if(!0===l||!1===l){if(Y.isValid()){Y.forEach(((t,e)=>{M.setValue(t,e,{bd:{l:null}})}));const t={sheetId:u,actionName:mt.SET_RANGE_STYLE_ACTION,value:M.getArrayData(),rangeData:_};L.push(t)}x.forEach(((t,e)=>{if(!0===l){const r=B.deepMerge(D.getValue(t,e)||{},{bd:{r:B.deepClone(P)}});D.setValue(t,e,r)}else if(!1===l){const r=B.deepMerge(D.getValue(t,e)||{},{bd:{r:null}});D.setValue(t,e,r)}}))}!0!==n&&!1!==n||this.forEach(((t,e)=>{if(e!==d.endColumn)if(!0===n){const r=B.deepMerge(D.getValue(t,e)||{},{bd:{r:B.deepClone(P)}});D.setValue(t,e,r)}else if(!1===n){const r=B.deepMerge(D.getValue(t,e)||{},{bd:{r:null}});D.setValue(t,e,r)}if(e!==d.startColumn){const r=B.deepMerge(D.getValue(t,e)||{},{bd:{l:null}});D.setValue(t,e,r)}})),!0!==o&&!1!==o||this.forEach(((t,e)=>{if(t!==d.endRow)if(!0===o){const r=B.deepMerge(D.getValue(t,e)||{},{bd:{b:B.deepClone(P)}});D.setValue(t,e,r)}else if(!1===o){const r=B.deepMerge(D.getValue(t,e)||{},{bd:{b:null}});D.setValue(t,e,r)}if(t!==d.startRow){const r=B.deepMerge(D.getValue(t,e)||{},{bd:{t:null}});D.setValue(t,e,r)}}));const H={sheetId:u,actionName:mt.SET_RANGE_STYLE_ACTION,value:D.getArrayData(),rangeData:D.getDataRange()};L.push(H);const F=new zs({WorkBookUnit:h},...L);return b.invoke(F),this}setBorderByType(t,e,r){let s=null,l=null,n=null,o=null,i=null,a=null;switch(t){case St.TOP:s=!0;break;case St.BOTTOM:n=!0;break;case St.LEFT:l=!0;break;case St.RIGHT:o=!0;break;case St.NONE:s=!1,l=!1,n=!1,o=!1,i=!1,a=!1;break;case St.ALL:s=!0,l=!0,n=!0,o=!0,i=!0,a=!0;break;case St.OUTSIDE:s=!0,l=!0,n=!0,o=!0;break;case St.INSIDE:i=!0,a=!0;break;case St.HORIZONTAL:a=!0;break;case St.VERTICAL:i=!0}this.setBorder(s,l,n,o,i,a,e,r)}setFontFamily(t){const{_context:e,_worksheet:r,_commandManager:s}=this,{startRow:l,endRow:n,startColumn:o,endColumn:i}=this._rangeData,a={ff:t},g=B.fillObjectMatrix(n-l+1,i-o+1,a),c={sheetId:r.getSheetId(),actionName:mt.SET_RANGE_STYLE_ACTION,value:g,rangeData:this._rangeData},b=new zs({WorkBookUnit:e.getWorkBook()},c);return s.invoke(b),this}setFontSize(t){const{_context:e,_worksheet:r,_commandManager:s}=this,{startRow:l,endRow:n,startColumn:o,endColumn:i}=this._rangeData,a={fs:t},g=B.fillObjectMatrix(n-l+1,i-o+1,a),c={sheetId:r.getSheetId(),actionName:mt.SET_RANGE_STYLE_ACTION,value:g,rangeData:this._rangeData},b=new zs({WorkBookUnit:e.getWorkBook()},c);return s.invoke(b),this}setHorizontalAlignment(t){const{_context:e,_worksheet:r,_commandManager:s}=this,{startRow:l,endRow:n,startColumn:o,endColumn:i}=this._rangeData,a={ht:t},g=B.fillObjectMatrix(n-l+1,i-o+1,a),c={sheetId:r.getSheetId(),actionName:mt.SET_RANGE_STYLE_ACTION,value:g,rangeData:this._rangeData},b=new zs({WorkBookUnit:e.getWorkBook()},c);return s.invoke(b),this}setVerticalAlignment(t){const{_context:e,_worksheet:r,_commandManager:s}=this,{startRow:l,endRow:n,startColumn:o,endColumn:i}=this._rangeData,a={vt:t},g=B.fillObjectMatrix(n-l+1,i-o+1,a),c={sheetId:r.getSheetId(),actionName:mt.SET_RANGE_STYLE_ACTION,value:g,rangeData:this._rangeData},b=new zs({WorkBookUnit:e.getWorkBook()},c);return s.invoke(b),this}setTextDirection(t){const{_context:e,_worksheet:r,_commandManager:s}=this,{startRow:l,endRow:n,startColumn:o,endColumn:i}=this._rangeData,a={td:t},g=B.fillObjectMatrix(n-l+1,i-o+1,a),c={sheetId:r.getSheetId(),actionName:mt.SET_RANGE_STYLE_ACTION,value:g,rangeData:this._rangeData},b=new zs({WorkBookUnit:e.getWorkBook()},c);return s.invoke(b),this}setWrapStrategy(t){const{_context:e,_worksheet:r,_commandManager:s}=this,{startRow:l,endRow:n,startColumn:o,endColumn:i}=this._rangeData,a={tb:t},g=B.fillObjectMatrix(n-l+1,i-o+1,a),c={sheetId:r.getSheetId(),actionName:mt.SET_RANGE_STYLE_ACTION,value:g,rangeData:this._rangeData},b=new zs({WorkBookUnit:e.getWorkBook()},c);return s.invoke(b),this}setValue(t){const{_rangeData:e,_context:r,_commandManager:s,_worksheet:l}=this,{startRow:n,startColumn:o,endRow:i,endColumn:a}=e,g=new v;for(let h=n;h<=i;h++)for(let e=o;e<=a;e++)g.setValue(h,e,t);const c={sheetId:l.getSheetId(),actionName:mt.SET_RANGE_FORMATTED_VALUE_ACTION,cellValue:g.getData(),rangeData:this._rangeData},b=new zs({WorkBookUnit:r.getWorkBook()},c);return s.invoke(b),this}setValues(...t){const{_rangeData:e,_context:r,_commandManager:s,_worksheet:l}=this,n=t[0];if(As.checkup(t,Array)){const{startRow:t,startColumn:o,endRow:i,endColumn:a}=e,g=new v;for(let e=0;e<=i-t;e++)for(let r=0;r<=a-o;r++)g.setValue(e+t,r+o,n[e][r]);const c={sheetId:l.getSheetId(),actionName:mt.SET_RANGE_FORMATTED_VALUE_ACTION,cellValue:g.getData(),rangeData:this._rangeData},b=new zs({WorkBookUnit:r.getWorkBook()},c);s.invoke(b)}else if(As.checkup(t,v)){const t={sheetId:l.getSheetId(),actionName:mt.SET_RANGE_FORMATTED_VALUE_ACTION,cellValue:n,rangeData:this._rangeData},e=new zs({WorkBookUnit:r.getWorkBook()},t);s.invoke(e)}return this}setRangeData(t){const{_rangeData:e,_context:r,_commandManager:s,_worksheet:l}=this,{startRow:n,startColumn:o}=e,i={sheetId:l.getSheetId(),actionName:mt.SET_RANGE_DATA_ACTION,cellValue:{[n]:{[o]:t}}},a=new zs({WorkBookUnit:r.getWorkBook()},i);return s.invoke(a),this}setRangeDatas(...t){const{_rangeData:e,_context:r,_commandManager:s,_worksheet:l}=this,n=t[0];if(As.checkup(t,Array)){const{startRow:t,startColumn:o,endRow:i,endColumn:a}=e,g=new v;for(let e=0;e<=i-t;e++)for(let r=0;r<=a-o;r++)g.setValue(e+t,r+o,n[e][r]);const c={sheetId:l.getSheetId(),actionName:mt.SET_RANGE_DATA_ACTION,cellValue:g.getData()},b=new zs({WorkBookUnit:r.getWorkBook()},c);s.invoke(b)}else if(As.checkup(t,As.OBJECT_TYPE)){const t={sheetId:l.getSheetId(),actionName:mt.SET_RANGE_DATA_ACTION,cellValue:n},e=new zs({WorkBookUnit:r.getWorkBook()},t);s.invoke(e)}return this}clear(...t){const{_context:e,_worksheet:r,_commandManager:s,_rangeData:l}=this;let n={formatOnly:!0,contentsOnly:!0};As.checkup(t,As.OBJECT_TYPE)&&(n=t[0]);const o={sheetId:r.getSheetId(),actionName:mt.CLEAR_RANGE_ACTION,options:n,rangeData:l},i=new zs({WorkBookUnit:e.getWorkBook()},o);return s.invoke(i),this}clearFormat(){return this.clear({formatOnly:!0})}clearContent(){return this.clear({contentsOnly:!0})}deleteCells(t){const{_rangeData:e,_context:r,_commandManager:s,_worksheet:l}=this,n={sheetId:l.getSheetId(),actionName:mt.DELETE_RANGE_ACTION,shiftDimension:t,rangeData:e},o=new zs({WorkBookUnit:r.getWorkBook()},n);s.invoke(o)}insertCells(...t){const e=t[0],r=t[1],{_rangeData:s,_context:l,_commandManager:n,_worksheet:o}=this,{startRow:i,endRow:a,startColumn:g,endColumn:c}=this._rangeData;let b=this._rangeData,h=new v;if(r){h=r.getMatrixObject();const t=r.getRangeData();b={startRow:i,endRow:i+t.endRow-t.startRow,startColumn:g,endColumn:i+t.endColumn-t.startColumn}}else for(let f=i;f<=a;f++)for(let t=g;t<=c;t++)h.setValue(f,t,{m:"",v:""});const d={sheetId:o.getSheetId(),actionName:mt.INSERT_RANGE_ACTION,shiftDimension:e,rangeData:b,cellValue:h.getData()},u=new zs({WorkBookUnit:l.getWorkBook()},d);return n.invoke(u),this}merge(){const{_worksheet:t}=this;return t.getMerges().add(this._rangeData),this}mergeAcross(){const{_worksheet:t}=this,e=t.getCommandManager(),r=t.getContext(),s=t.getSheetId(),{startRow:l,endRow:n,startColumn:o,endColumn:i}=this._rangeData,a=[];for(let b=l;b<=n;b++){const t={startRow:b,endRow:b,startColumn:o,endColumn:i};a.push(t)}const g={actionName:mt.ADD_MERGE_ACTION,sheetId:s,rectangles:a},c=new zs({WorkBookUnit:r.getWorkBook()},g);return e.invoke(c),this}mergeVertically(){const{_worksheet:t}=this,e=t.getCommandManager(),r=t.getContext(),s=t.getSheetId(),{startRow:l,endRow:n,startColumn:o,endColumn:i}=this._rangeData,a=[];for(let b=o;b<=i;b++){const t={startRow:l,endRow:n,startColumn:b,endColumn:b};a.push(t)}const g={actionName:mt.ADD_MERGE_ACTION,sheetId:s,rectangles:a},c=new zs({WorkBookUnit:r.getWorkBook()},g);return e.invoke(c),this}breakApart(){const{_worksheet:t}=this,e=t.getCommandManager(),r=t.getContext(),s=t.getSheetId(),l=this._worksheet.getMerges().getMergedRanges(this._rangeData),n={actionName:mt.REMOVE_MERGE_ACTION,sheetId:s,rectangles:l},o=new zs({WorkBookUnit:r.getWorkBook()},n);return e.invoke(o),this}removeDuplicates(...t){const{_rangeData:e,_context:r,_commandManager:s,_worksheet:l}=this;Array.isArray(t[0])&&t[0];const n=this.getMatrix().getData(),o=[];for(let b=0;b<=e.endColumn-e.startColumn;b++){const t=[],e={},r=this.getColumnMatrix(b).getData();for(const s in r){const l=r[s][b].m;e.hasOwnProperty(l)||(e[l]=1,t.push(b))}o.push(t)}const i=Array.from(new Set(o.flat())),a={};i.forEach(((t,e)=>{a[e]=n[t]}));const g=[{sheetId:l.getSheetId(),actionName:mt.SET_RANGE_DATA_ACTION,cellValue:a}],c=new zs({WorkBookUnit:r.getWorkBook()},...g);return s.invoke(c),this}getRowMatrix(t){const{startColumn:e,endColumn:r}=this._rangeData,s=this._worksheet.getCellMatrix(),l=new v;for(let n=t;n<=t;n++)for(let t=e;t<=r;t++)l.setValue(n,t,s.getValue(n,t)||{});return l}getColumnMatrix(t){const{startRow:e,endRow:r}=this._rangeData,s=this._worksheet.getCellMatrix(),l=new v;for(let n=e;n<=r;n++)for(let e=t;e<=t;e++)l.setValue(n,e,s.getValue(n,e)||{});return l}forEach(t){Sr.foreach(this._rangeData,t)}randomize(){const{_context:t,_worksheet:e,_commandManager:r,_rangeData:s}=this,{startRow:l,startColumn:n}=s,o=new v;B.randSort(this.getMatrix().toArray()).forEach(((t,e)=>t.forEach(((t,r)=>{t=t,o.setValue(e+l,r+n,t||{})}))));const i={sheetId:e.getSheetId(),actionName:mt.SET_RANGE_DATA_ACTION,cellValue:o.getData()},a=new zs({WorkBookUnit:t.getWorkBook()},i);r.invoke(a)}isValid(){return!Object.values(this._rangeData).includes(-1)}_handleCopyRange(...t){const e=t[0];let r=t[1];r=As.checkup(t,Sr,Sr)?r.getRangeData():r;const s=e._worksheet.getCellMatrix(),{startRow:l,endRow:n,startColumn:o,endColumn:i}=e.getRangeData();let{startRow:a,endRow:g,startColumn:c,endColumn:b}=r;const h=n-l+1,d=i-o+1,u=g-a+1,f=b-c+1;let v,m=[];if(u%h==0&&f%d==0){for(let t=0;te.map((e=>{const r=this._context.getWorkBook().getStyles(),s=r&&r.getStyleByCell(e);return s&&s[t]||ke[t]}))))}_setStyle(t,e){const{_context:r,_worksheet:s,_commandManager:l}=this,{startRow:n,endRow:o,startColumn:i,endColumn:a}=this._rangeData,g={[e]:t},c=B.fillObjectMatrix(o-n+1,a-i+1,g),b={sheetId:s.getSheetId(),actionName:Cn.NAME,value:c,rangeData:this._rangeData},h=new zs({WorkBookUnit:r.getWorkBook()},b);return l.invoke(h),this}_setStyles(t,e){const{_context:r,_worksheet:s,_commandManager:l}=this,{startRow:n,endRow:o,startColumn:i,endColumn:a}=this._rangeData,g=new v;for(let h=0;h=0){const{sheetOrder:e}=this._config;for(let s=t;s=0;s--){const t=this._worksheets.get(e[s]);if(t&&!t.isSheetHidden())return t.activate(),t}const r=this._worksheets.get(e[e.length-1]);return r&&r.activate(),r}}setContext(t){this._context=t}insertSheet(...t){const{_context:e}=this,r=e.getGenName(),s=this.getCommandManager(),l=e.getContextObserver("onBeforeInsertSheetObservable"),n=e.getContextObserver("onAfterInsertSheetObservable");if(B.hasLength(t,0)){const t={name:r.sheetName(),status:0,id:B.generateRandomId(6)},o=this.getSheetSize();return l.notifyObservers({index:o,sheetId:t.id}),s.invoke(new zs({WorkBookUnit:e.getWorkBook()},{actionName:sn.NAME,sheetId:t.id,index:o,sheet:t})),n.notifyObservers({index:o,sheetId:t.id}),t.id}if(B.hasLength(t,1)){if(B.isAssignableFrom(t[0],yr)){const r=t[0],o=this.getSheetSize(),i=r.getConfig();return i.id=B.generateRandomId(6),l.notifyObservers({index:o,sheetId:i.id}),s.invoke(new zs({WorkBookUnit:e.getWorkBook()},{actionName:sn.NAME,sheetId:i.id,index:o,sheet:i})),n.notifyObservers({index:o,sheetId:i.id}),i.id}if(B.isNumber(t[0])){const o=t[0],i={name:r.sheetName(),status:0,id:B.generateRandomId(6)};return l.notifyObservers({index:o,sheetId:i.id}),s.invoke(new zs({WorkBookUnit:e.getWorkBook()},{actionName:sn.NAME,sheetId:i.id,index:o,sheet:i})),n.notifyObservers({index:o,sheetId:i.id}),i.id}if(B.isString(t[0])){const r=t[0],o=this.getSheetSize(),i={status:0,name:r,id:B.generateRandomId(6)};return l.notifyObservers({index:o,sheetId:i.id}),s.invoke(new zs({WorkBookUnit:e.getWorkBook()},{actionName:sn.NAME,sheetId:i.id,index:o,sheet:i})),n.notifyObservers({index:o,sheetId:i.id}),i.id}if(B.isPlainObject(t[0])){const r=t[0],o=this.getSheetSize();return l.notifyObservers({index:o,sheetId:r.id}),s.invoke(new zs({WorkBookUnit:e.getWorkBook()},{actionName:sn.NAME,sheetId:r.id,index:o,sheet:r})),n.notifyObservers({index:o,sheetId:r.id}),r.id}}if(B.hasLength(t,2)){if(B.isString(t[0])){const r=t[0],o=t[1],i={status:0,name:r,id:B.generateRandomId(6)};return l.notifyObservers({index:o,sheetId:i.id}),s.invoke(new zs({WorkBookUnit:e.getWorkBook()},{actionName:sn.NAME,sheetId:i.id,index:o,sheet:i})),n.notifyObservers({index:o,sheetId:i.id}),i.id}if(B.isNumber(t[0])){if(B.isAssignableFrom(t[1],yr)){const r=t[0],o=t[1].getConfig();return o.id=B.generateRandomId(6),l.notifyObservers({index:r,sheetId:o.id}),s.invoke(new zs({WorkBookUnit:e.getWorkBook()},{actionName:sn.NAME,sheetId:o.id,index:r,sheet:o})),n.notifyObservers({index:r,sheetId:o.id}),o.id}if(B.isPlainObject(t[1])){const r=t[0],o=t[1];return l.notifyObservers({index:r,sheetId:o.id}),s.invoke(new zs({WorkBookUnit:e.getWorkBook()},{actionName:sn.NAME,sheetId:o.id,index:r,sheet:o})),n.notifyObservers({index:r,sheetId:o.id}),o.id}}}}getActiveSpreadsheet(){return this}getStyles(){return this._styles}getContext(){return this._context}getConfig(){return this._config}create(...t){if(B.hasLength(t,1)){const{_context:e}=this,r=t[0],s=__spreadProps(__spreadValues({},Ne),{name:r}),l=new yr(e,s);return this.insertSheet(l),l}if(B.hasLength(t,3)){const{_context:e}=this,r=t[0],s=t[1],l=t[2],n=__spreadProps(__spreadValues({},Ne),{name:r,rowCount:s,columnCount:l}),o=new yr(e,n);return this.insertSheet(o),o}}setDefaultActiveSheet(){this._setDefaultActiveSheet()}getIndexBySheetId(t){const{sheetOrder:e}=this._config;return e.findIndex((e=>e===t))}getActiveSheet(){const{sheetOrder:t}=this._config,e=t.find((t=>this._worksheets.get(t).getStatus()===_e.TRUE));return e?this._worksheets.get(e):(console.warn("No active sheet, get first sheet"),this._worksheets[0])}getActiveSheetIndex(){const{sheetOrder:t}=this._config;return t.findIndex((t=>1===this._worksheets.get(t).getStatus()))}getActiveRange(){const t=this.getActiveSheet();if(t){return t.getSelection().getActiveRange()}return null}setActiveRange(t){const e=this.getActiveSheet();return e?e.setActiveSelection(t):null}setActiveRangeList(t){const e=this.getActiveSheet();if(e){const r=e.getRangeList(t);return r.activate(),r.getRangeList()}return null}getActiveRangeList(){const t=this.getActiveSheet();if(t){return t.getSelection().getActiveRangeList()}return null}getSelection(){const t=this.getActiveSheet();if(t)return t.getSelection()}getCurrentCell(){const t=this.getSelection();if(t)return t.getCurrentCell()}getSheetSize(){return this._config.sheetOrder.length}setCurrentCell(t){return t.activateAsCurrentCell()}flush(){}setSheetOrder(t,e){const{_context:r}=this,s=this.getCommandManager(),l=r.getContextObserver("onSheetOrderObservable"),n={actionName:Rn.NAME,sheetId:t,order:e},o=new zs({WorkBookUnit:r.getWorkBook()},n);s.invoke(o),l.notifyObservers()}getSheets(){const{sheetOrder:t}=this._config;return t.map((t=>this._worksheets.get(t)))}getSheetIndex(t){const{sheetOrder:e}=this._config;return e.findIndex((e=>t.getSheetId()===e))}removeSheetBySheetId(t){const{_config:e}=this,{sheetOrder:r}=e,s=this.getCommandManager(),l=this.getSheetBySheetId(t);if(r.length>1&&null!=l){const e=this.getSheetIndex(l),r=this.getContext().getContextObserver("onBeforeRemoveSheetObservable"),n=this.getContext().getContextObserver("onAfterRemoveSheetObservable");r.notifyObservers({index:e}),s.invoke(new zs({WorkBookUnit:this},{actionName:cn.NAME,sheetId:t})),n.notifyObservers({index:e,sheetId:t}),this.activateSheetByIndex(e)}}getSheetBySheetName(t){const{sheetOrder:e}=this._config,r=e.find((e=>this._worksheets.get(e).getName()===t));return this._worksheets.get(r)}getSheetBySheetId(t){return this._worksheets.get(t)}setActiveSheet(...t){let e=!1;const r=t[0];return As.checkup(t,yr,As.BOOLEAN_TYPE)&&(e=t[1]),r.activate(),e&&r.setActiveSelection(),r}getCommandManager(){return this._context.getCommandManager()}getPluginMeta(t){return this._config.pluginMeta[t]}setPluginMeta(t,e){return this._config.pluginMeta||(this._config.pluginMeta={}),this._config.pluginMeta[t]=e}transformRangeType(t){if("string"==typeof t){return this._getCellRange(t)}return"string"!=typeof t&&"row"in t?{sheetId:"",rangeData:{startRow:t.row[0],startColumn:t.column[0],endRow:t.row[1],endColumn:t.column[1]}}:"string"!=typeof t&&"startRow"in t?{sheetId:"",rangeData:t}:Re}load(t){this._config=t}save(){return this._config}_getDefaultWorkSheet(){const{_context:t,_config:e,_worksheets:r}=this,{sheets:s,sheetOrder:l}=e,n=t.getGenName();B.isEmptyObject(s)&&(s[Ne.id]=Object.assign(Ne,{status:_e.TRUE}));let o=null;for(let i in s){let e=s[i];e.name=n.sheetName(e.name);const a=new yr(t,e);r.set(i,a),l.includes(i)||l.push(i),null==o&&(o=a)}o&&o.activate()}_setDefaultActiveSheet(){this._worksheets.size>0&&(this._worksheets.forEach((t=>{t.setStatus(_e.FALSE)})),this._worksheets[0].setStatus(_e.TRUE))}_getCellRange(t){var e,r,s,l,n;let o="",i="";if(t.indexOf("!")>-1){const e=t.split("!");o=e[0],i=e[1],o=o.replace(/\\'/g,"'").replace(/''/g,"'"),"'"===o.substring(0,1)&&"'"===o.substring(o.length-1,1)&&(o=o.substring(1,o.length-1))}else i=t;if(-1===i.indexOf(":")){const t=parseInt(i.replace(/[^0-9]/g,""),10)-1,e=B.ABCatNum(i.replace(/[^A-Za-z]/g,""));if(!Number.isNaN(t)&&!Number.isNaN(e)){return{sheetId:o,rangeData:{startRow:t,endRow:t,startColumn:e,endColumn:e}}}return Re}i=i.split(":");const a=[0,0],g=[0,0],c=(null==(e=this.getSheetBySheetName(o))?void 0:e.getMaxRows())||(null==(r=this.getActiveSheet())?void 0:r.getMaxRows()),b=(null==(s=this.getSheetBySheetName(o))?void 0:s.getMaxColumns())||(null==(l=this.getActiveSheet())?void 0:l.getMaxColumns());if(a[0]=parseInt(i[0].replace(/[^0-9]/g,""),10)-1,a[1]=parseInt(i[1].replace(/[^0-9]/g,""),10)-1,Number.isNaN(a[0])&&(a[0]=0),Number.isNaN(a[1])&&(a[1]=c),a[0]>a[1])return Re;if(g[0]=B.ABCatNum(i[0].replace(/[^A-Za-z]/g,"")),g[1]=B.ABCatNum(i[1].replace(/[^A-Za-z]/g,"")),Number.isNaN(g[0])&&(g[0]=0),Number.isNaN(g[1])&&(g[1]=b),g[0]>g[1])return Re;return{sheetId:(null==(n=this.getSheetBySheetName(o))?void 0:n.getSheetId())||"",rangeData:{startRow:a[0],endRow:a[1],startColumn:g[0],endColumn:g[1]}}}}class Rr{constructor(t){this._workSheet=t,this._context=t.getContext(),this._commandManager=this._context.getCommandManager(),this._workbook=t.getContext().getWorkBook(),this._activeRangeList=this._workSheet.getRangeList([Ae]),this._activeRange=this._workSheet.getRange(Ae),this._currentCell=this._workSheet.getRange(Ae)}static cellInRange(t,e){for(const r of t)if(r.startRow<=e.startRow&&e.endRow<=r.endRow&&r.startColumn<=e.startColumn&&e.endColumn<=r.endColumn)return r;return null}setWorkSheet(t){this._workSheet=t}setSelection({selection:t,cell:e}={}){var r;let s,l,n;if(t instanceof Sr?(l=t.getRangeData(),-1===l.startRow&&console.error("Invalid selection, default set startRow -1"),s=[l],n={startRow:l.startRow,endRow:l.startRow,startColumn:l.startColumn,endColumn:l.startColumn}):t&&Yr.isIRangeType(t)?(l=this._workbook.transformRangeType(t).rangeData,-1===l.startRow&&console.error("Invalid selection, default set startRow -1"),s=[l],n={startRow:l.startRow,endRow:l.startRow,startColumn:l.startColumn,endColumn:l.startColumn}):t instanceof Array?(s=t.map((t=>{const e=this._workbook.transformRangeType(t).rangeData;return-1===e.startRow&&console.error("Invalid selection, default set startRow -1"),e})),l=s[s.length-1],n={startRow:l.startRow,endRow:l.startRow,startColumn:l.startColumn,endColumn:l.startColumn}):(s=this._activeRangeList.getRangeList(),l=this._activeRange.getRangeData(),n=this._currentCell.getRangeData()),e){n=this._workbook.transformRangeType(e).rangeData;Rr.cellInRange(s,n)||(l=n,s=[l])}const{_context:o,_workSheet:i,_commandManager:a}=this,g={sheetId:i.getSheetId(),actionName:Yn.NAME,activeRangeList:s,activeRange:l,currentCell:n},c=new zs({WorkBookUnit:o.getWorkBook()},g);a.invoke(c);const b=`${B.chatAtABC(l.startColumn)+(l.startRow+1)}:${B.chatAtABC(l.endColumn)}${l.endRow+1}`;return null==(r=this._context.getObserverManager().getObserver("onAfterSetSelectionObservable"))||r.notifyObservers(b),this._activeRange}getSelection(){return B.deepClone(this._activeRange.getRangeData())}getActiveRange(){return this._activeRange}getActiveRangeList(){return this._activeRangeList}getActiveSheet(){return this._workbook.getActiveSheet()}getCurrentCell(){return this._currentCell}setCurrentCell(t){if(B.isAssignableFrom(t,Sr)&&(t=t.getRangeData()),-1===(null==t?void 0:t.startRow))return console.error("Invalid range,default set startRow -1"),this;if(t.startRow!==t.endRow||t.startColumn!==t.endColumn)return console.error("Exception: Range must have a single cell."),this;const e=this._activeRangeList.getRangeList(),{_context:r,_workSheet:s,_commandManager:l}=this,n={sheetId:s.getSheetId(),actionName:Yn.NAME,activeRangeList:e,activeRange:t,currentCell:t},o=new zs({WorkBookUnit:r.getWorkBook()},n);return l.invoke(o),this}setRanges(t,e,r){this._activeRangeList=this._workSheet.getRangeList(t),this._activeRange=this._workSheet.getRange(e),this._currentCell=this._workSheet.getRange(r)}getNextDataRange(t){const e=this._expandRange(t);return this.setSelection({selection:e}),this.getActiveRange()}_expandRange(t){const e=this._workSheet.getColumnCount(),r=this._workSheet.getRowCount(),s=this._activeRange.getRangeData();let l=Ae;const n=this.getCurrentCell().getRangeData();if(t===Pt.RIGHT)if(n.startColumn===s.startColumn){const t=this._workSheet.getCellMatrix().getValue(n.startRow,s.endColumn);let r;if(t&&void 0===t.v)for(let l=s.endColumn+1;l<=e;l++){if(l===e){r=e;break}const t=this._workSheet.getCellMatrix().getValue(n.startRow,l);if(t&&void 0!==t.v){r=l;break}}else for(let l=s.endColumn+1;l<=e;l++){if(l===e){r=e;break}const t=this._workSheet.getCellMatrix().getValue(n.startRow,l);if(t&&void 0===t.v){const t=this._workSheet.getCellMatrix().getValue(n.startRow,l-1);if(t&&void 0!==t.v){r=l-1;break}}}l={startRow:s.startRow,endRow:s.endRow,startColumn:s.startColumn,endColumn:void 0!==r?r:s.endColumn}}else{const t=this._workSheet.getCellMatrix().getValue(n.startRow,s.startColumn);let e;if(t&&void 0===t.v)for(let r=s.startColumn+1;r<=n.startColumn;r++){if(r===n.startColumn){e=n.startColumn;break}const t=this._workSheet.getCellMatrix().getValue(n.startRow,r);if(t&&void 0!==t.v){e=r;break}}else for(let r=s.startColumn+1;r<=n.startColumn;r++){if(r===n.startColumn){e=n.startColumn;break}const t=this._workSheet.getCellMatrix().getValue(n.startRow,r);if(t&&void 0===t.v){const t=this._workSheet.getCellMatrix().getValue(n.startRow,r-1);if(t&&void 0!==t.v){e=r-1;break}}}l={startRow:s.startRow,endRow:s.endRow,startColumn:e||n.startColumn,endColumn:s.endColumn}}if(t===Pt.LEFT){let t,e;if(n.endColumn===s.endColumn){const e=this._workSheet.getCellMatrix().getValue(n.startRow,s.startColumn);if(e&&void 0===e.v)for(let r=s.startColumn-1;r>=0;r--){if(0===r){t=0;break}const e=this._workSheet.getCellMatrix().getValue(n.startRow,r);if(e&&void 0!==e.v){t=r;break}}else for(let r=s.startColumn-1;r>=0;r--){if(0===r){t=0;break}const e=this._workSheet.getCellMatrix().getValue(n.startRow,r);if(e&&void 0===e.v){const e=this._workSheet.getCellMatrix().getValue(n.startRow,r-1);if(e&&void 0!==e.v){t=r-1;break}}}}else{const t=this._workSheet.getCellMatrix().getValue(n.startRow,s.endColumn);if(t&&void 0===t.v)for(let r=s.endColumn-1;r>=n.startColumn;r--){if(r===n.startColumn){e=r;break}const t=this._workSheet.getCellMatrix().getValue(n.startRow,r);if(t&&void 0!==t.v){e=r;break}}else for(let r=s.endColumn-1;r>=n.startColumn;r--){if(r===n.startColumn){e=r;break}const t=this._workSheet.getCellMatrix().getValue(n.startRow,r);if(t&&void 0===t.v){const t=this._workSheet.getCellMatrix().getValue(n.startRow,r-1);if(t&&void 0!==t.v){e=r-1;break}}}}l={startRow:s.startRow,endRow:s.endRow,startColumn:void 0!==t?t:s.startColumn,endColumn:void 0!==e?e:s.endColumn}}if(t===Pt.TOP){let t,e;if(n.endRow===s.endRow){const e=this._workSheet.getCellMatrix().getValue(s.startRow,n.startColumn);if(e&&void 0===e.v)for(let r=s.endRow-1;r>=0;r--){const e=this._workSheet.getCellMatrix().getValue(r,n.startColumn);if(e&&void 0!==e.v||0===r){t=r;break}}else for(let r=s.startRow-1;r>=0;r--){if(0===r){t=0;break}const e=this._workSheet.getCellMatrix().getValue(r,n.startColumn);if(e&&void 0===e.v){const e=this._workSheet.getCellMatrix().getValue(r-1,n.startColumn);if(e&&void 0!==e.v){t=r-1;break}}}}else{const t=this._workSheet.getCellMatrix().getValue(s.endRow,n.startColumn);if(t&&void 0===t.v)for(let r=s.endRow-1;r>=n.startRow;r--){if(r===n.startRow){e=n.startRow;break}const t=this._workSheet.getCellMatrix().getValue(r,n.startColumn);if(t&&void 0!==t.v){e=r;break}}else for(let r=s.endRow-1;r>=n.startRow;r--){const t=this._workSheet.getCellMatrix().getValue(r,n.startColumn);if(r===n.startRow){e=n.startRow;break}if(t&&void 0===t.v&&r!==s.endRow-1){const t=this._workSheet.getCellMatrix().getValue(r+1,n.startColumn);if(t&&void 0!==t.v){e=r+1;break}}}}l={startRow:void 0!==t?t:s.startRow,endRow:void 0!==e?e:s.endRow,startColumn:s.startColumn,endColumn:s.endColumn}}if(t===Pt.BOTTOM){let t,e;if(n.startRow===s.startRow){const t=this._workSheet.getCellMatrix().getValue(s.endRow,n.startColumn);if(t&&void 0===t.v)for(let l=s.endRow+1;l<=r;l++){if(l===r){e=r;break}const t=this._workSheet.getCellMatrix().getValue(l,n.startColumn);if(t&&void 0!==t.v){e=l;break}}else for(let l=s.endRow+1;l<=r;l++){if(l===r){e=r;break}const t=this._workSheet.getCellMatrix().getValue(l,n.startColumn);if(t&&void 0===t.v){const t=this._workSheet.getCellMatrix().getValue(l+1,n.startColumn);if(t&&void 0!==t.v){e=l+1;break}}}}else{const e=this._workSheet.getCellMatrix().getValue(s.startRow+1,n.startColumn);if(e&&void 0===e.v)for(let r=s.startRow+1;r<=n.startRow;r++){if(r===n.startRow){t=n.startRow;break}const e=this._workSheet.getCellMatrix().getValue(r,n.startColumn);if(e&&void 0!==e.v){t=r;break}}else for(let r=s.startRow+1;r<=n.startRow;r++){if(r===n.startRow){t=n.startRow;break}const e=this._workSheet.getCellMatrix().getValue(r,n.startColumn);if(e&&void 0===e.v&&r!==s.startRow+1){const e=this._workSheet.getCellMatrix().getValue(r-1,n.startColumn);if(e&&void 0!==e.v){t=r-1;break}}}}l={startRow:void 0!==t?t:s.startRow,endRow:void 0!==e?e:s.endRow,startColumn:s.startColumn,endColumn:s.endColumn}}return l}}function Ir(t){if(!t)return;let{row:e,column:r,startY:s,endY:l,startX:n,endX:o,isMerged:i,mergeInfo:a}=t,g=e,c=r,b=e,h=r;if(i&&a){const{startRow:t,startColumn:e,endRow:r,endColumn:i,startY:d,endY:u,startX:f,endX:v}=a;g=t,c=e,b=r,h=i,s=d,l=u,n=f,o=v}return{startRow:g,startColumn:c,endRow:b,endColumn:h,startY:s,endY:l,startX:n,endX:o}}function Ar(t){if(!t)return!0;return 0===((null==t?void 0:t.m)||"").length&&!t.p}function xr(t){if(t){if(t.rgb)return t.rgb;if(t.th)return(new $e).setThemeColor(t.th).asThemeColor().asRgbColor().getCssString()}return null}function Or(t){var e;let r="";if(null==(e=t.body)?void 0:e.blockElements)for(let s in t.body.blockElements){const e=t.body.blockElements[s];if((e.blockType===E.PARAGRAPH||e.blockType===E.SECTION_BREAK)&&e.blockType===E.PARAGRAPH)for(let t in e.paragraph){const s=e.paragraph[t];for(let t in s){const e=s[t];if(e.et===D.TEXT_RUN){let t=`display:inline-block;${Nr(e.tr.ts)}`;r+=`${e.tr.ct}`}}}}return r}function Nr(t,e=!1){var r;let s="";const l=new Map([["ff",()=>{t.ff&&(s+=`font-family: ${t.ff}; `)}],["fs",()=>{if(t.fs){let e=t.fs;t.va&&(e/=2),s+=`font-size: ${e}pt; `}}],["it",()=>{t.it?s+="font-style: italic; ":s+="font-style: normal; "}],["bl",()=>{t.bl?s+="font-weight: bold; ":s+="font-weight: normal; "}],["ul",()=>{var e;(null==(e=t.ul)?void 0:e.s)&&(s.indexOf("text-decoration-line")>-1?s=s.replace(/(?<=text-decoration-line:.*)\b(?=;)/g," underline"):s+="text-decoration-line: underline; ",t.ul.cl&&-1===s.indexOf("text-decoration-color")&&(s+=`text-decoration-color: ${xr(t.ul.cl)}; `),t.ul.t&&-1===s.indexOf("text-decoration-style")&&(s+=`text-decoration-style: ${t.ul.t} `))}],["st",()=>{var e;(null==(e=t.st)?void 0:e.s)&&(s.indexOf("text-decoration-line")>-1?s=s.replace(/(?<=text-decoration-line:.*)\b(?=;)/g," line-through"):s+="text-decoration-line: line-through; ",t.st.cl&&-1===s.indexOf("text-decoration-color")&&(s+=`text-decoration-color: ${xr(t.st.cl)}; `),t.st.t&&-1===s.indexOf("text-decoration-style")&&(s+=`text-decoration-style: ${t.st.t} `))}],["ol",()=>{var e;(null==(e=t.ol)?void 0:e.s)&&(s.indexOf("text-decoration-line")>-1?s=s.replace(/(?<=text-decoration-line:.*)\b(?=;)/g," overline"):s+="text-decoration-line: overline; ",t.ol.cl&&-1===s.indexOf("text-decoration-color")&&(s+=`text-decoration-color: ${xr(t.ol.cl)}; `),t.ol.t&&-1===s.indexOf("text-decoration-style")&&(s+=`text-decoration-style: ${t.ol.t} `))}],["bg",()=>{s+=`background: ${xr(t.bg)}; `}],["bd",()=>{var e,r,l,n,o,i,a,g,c,b,h,d;(null==(e=t.bd)?void 0:e.b)&&(s+=`border-bottom: ${kr(null==(r=t.bd)?void 0:r.b.s)} ${null!=(l=xr(t.bd.b.cl))?l:""}; `),(null==(n=t.bd)?void 0:n.t)&&(s+=`border-top: ${kr(null==(o=t.bd)?void 0:o.t.s)} ${null!=(i=xr(t.bd.t.cl))?i:""}; `),(null==(a=t.bd)?void 0:a.r)&&(s+=`border-right: ${kr(null==(g=t.bd)?void 0:g.r.s)} ${null!=(c=xr(t.bd.r.cl))?c:""}; `),(null==(b=t.bd)?void 0:b.l)&&(s+=`border-left: ${kr(null==(h=t.bd)?void 0:h.l.s)} ${null!=(d=xr(t.bd.l.cl))?d:""}; `)}],["cl",()=>{s+=`color: ${xr(t.cl)}; `}],["va",()=>{t.va===me.NORMAL?s+="vertical-align: baseline; ":t.va===me.SUBSCRIPT?s+="vertical-align: sub; ":s+="vertical-align: super; "}],["td",()=>{t.td===se.UNSPECIFIED?s+="direction: inherit; ":t.td===se.LEFT_TO_RIGHT?s+="direction: ltr; ":s+="direction: rtl; "}],["tr",()=>{var e,r,l;s+=`data-rotate: (${null==(e=t.tr)?void 0:e.a}deg${(null==(r=t.tr)?void 0:r.v)?` ,${null==(l=t.tr)?void 0:l.v}`:""});`}],["ht",()=>{t.ht===ie.UNSPECIFIED?s+="text-align: inherit; ":t.ht===ie.LEFT?s+="text-align: left; ":t.ht===ie.RIGHT?s+="text-align: right; ":t.ht===ie.CENTER?s+="text-align: center; ":s+="text-align: justify; "}],["vt",()=>{t.vt===ge.UNSPECIFIED?s+="vertical-align: inherit; ":t.vt===ge.BOTTOM?s+="vertical-align: bottom; ":t.vt===ge.TOP?s+="vertical-align: top; ":s+="vertical-align: middle; "}],["tb",()=>{t.tb===be.CLIP?s+="text-overflow: clip; ":t.tb===be.OVERFLOW?s+="text-break: overflow; ":t.tb===be.WRAP&&(s+="word-wrap: break-word; word-break: normal; ")}],["pd",()=>{var e,r,l,n,o,i,a,g;let c=`${null==(e=t.pd)?void 0:e.b}pt`,b=`${null==(r=t.pd)?void 0:r.t}pt`,h=`${null==(l=t.pd)?void 0:l.l}pt`,d=`${null==(n=t.pd)?void 0:n.r}pt`;(null==(o=t.pd)?void 0:o.b)&&(s+=`padding-bottom: ${c}; `),(null==(i=t.pd)?void 0:i.t)&&(s+=`padding-top: ${b}; `),(null==(a=t.pd)?void 0:a.l)&&(s+=`padding-left: ${h}; `),(null==(g=t.pd)?void 0:g.r)&&(s+=`padding-right: ${d}; `)}]]),n=["bd","tr","tb"];for(let o in t)e&&n.includes(o)||null==(r=l.get(o))||r();return s}function kr(t){let e="";return t===Tt.NONE?e="none":t===Tt.THIN?e="0.5pt solid":t===Tt.HAIR?e="0.5pt double":t===Tt.DOTTED?e="0.5pt dotted":t===Tt.DASHED||t===Tt.DASH_DOT?e="0.5pt dashed":t===Tt.DASH_DOT_DOT?e="0.5pt dotted":t===Tt.DOUBLE?e="0.5pt double":t===Tt.MEDIUM?e="1pt solid":t===Tt.MEDIUM_DASHED||t===Tt.MEDIUM_DASH_DOT?e="1pt dashed":t===Tt.MEDIUM_DASH_DOT_DOT?e="1pt dotted":t===Tt.SLANT_DASH_DOT?e="0.5pt dashed":t===Tt.THICK&&(e="1.5pt solid"),e}function Mr(t){let e=0;if("none"===(t=t.trim()))e=Tt.NONE;else if("0.5pt solid"===t)e=Tt.THIN;else if("0.5pt double"===t)e=Tt.HAIR;else if("0.5pt dotted"===t)e=Tt.DOTTED;else if("0.5pt dashed"===t)e=Tt.DASHED;else if("1pt solid"===t)e=Tt.MEDIUM;else if("1pt dashed"===t)e=Tt.MEDIUM_DASHED;else if("1pt dotted"===t)e=Tt.MEDIUM_DASH_DOT_DOT;else{if("1.5pt solid"!==t)return Tt.NONE;e=Tt.THICK}return e}function Dr(t){return t instanceof FormData}const Lr=()=>{},Pr=t=>t;var Hr,Fr,Ur,zr,Wr,Vr;(Fr=Hr||(Hr={})).POST="POST",Fr.GET="GET",Fr.PUT="PUT",Fr.DELETE="DELETE",(zr=Ur||(Ur={}))[zr.UNSENT=0]="UNSENT",zr[zr.OPENED=1]="OPENED",zr[zr.HEADERS_RECEIVED=2]="HEADERS_RECEIVED",zr[zr.LOADING=3]="LOADING",zr[zr.DONE=4]="DONE",(Vr=Wr||(Wr={})).ARRAY_BUFFER="arraybuffer",Vr.BLOB="blob",Vr.TEXT="text",Vr.DOCUMENT="document",Vr.JSON="json",Vr.STREAM="stream";const Gr={type:Hr.POST,url:"",async:!0,header:{},dataType:Wr.JSON,contentType:"application/x-www-form-urlencoded; charset=UTF-8",data:{},username:"",password:"",timeout:500,error:Lr,beforeSend:Pr,dataFilter:Pr,success:Lr,complete:Lr};function Xr(t){return new Promise(((e,r)=>{const s=function(t,...e){for(const r of e)if(r)for(const e in r)r.hasOwnProperty(e)&&null!=r[e]&&(t[e]=r[e]);return t}({},Gr,t),l=new XMLHttpRequest;switch(s.beforeSend(s),l.responseType=s.dataType,l.timeout=s.timeout,l.addEventListener("readystatechange",(t=>{if(4===l.readyState)if(200===l.status){const t=s.dataFilter(l.response);s.success(t),s.complete(),e(t)}else s.error(t),r(t)})),l.addEventListener("timeout",(t=>{s.error(t)})),l.open(s.type,s.url,s.async,s.username,s.password),Object.keys(s.header).forEach((t=>{const e=s.header[t];l.setRequestHeader(t,e)})),Dr(s.data)?l.setRequestHeader("Content-Type","multipart/form-data"):s.contentType&&l.setRequestHeader("Content-Type",s.contentType),s.type){case Hr.DELETE:case Hr.GET:l.send();break;case Hr.POST:case Hr.PUT:if((n=s.data)&&Object.getPrototypeOf(n)===Object.getPrototypeOf({}))return void l.send(JSON.stringify(s.data));if(function(t){return"[object String]"===Object.prototype.toString.apply(t)}(s.data))return void l.send(s.data);if(function(t){return"[object Array]"===Object.prototype.toString.apply(t)}(s.data))return void l.send(JSON.stringify(s.data));Dr(s.data)&&l.send(s.data)}var n}))}var Qr,Kr;(Kr=Qr||(Qr={})).MESSAGE="message",Kr.OPEN="open",Kr.CLOSE="close",Kr.ERROR="error",Kr.RETRY="retry",Kr.DESTROY="destroy";const Zr={url:"",heartbeatTime:3e4},$r="heart_beat_message";class qr{constructor(t){const e=Object.assign(Zr,t);if(function(t){return null==t}(r=e.url)||""===r.toString())throw new Error("url must be input");var r;this._listens=new Map,this._timer=-1,this._config=e}link(){this._create(),this._bind()}send(t){this._socket.send(t)}destroy(){const t=this._listens.get(Qr.DESTROY);t&&t(),this._clear(),this._listens.clear()}on(t,e){this._listens.set(t,e)}close(){this._socket&&this._socket.close()}_create(){const{_config:t}=this;this._socket=new WebSocket(t.url)}_bind(){this._socket.addEventListener(Qr.MESSAGE,this._message.bind(this)),this._socket.addEventListener(Qr.OPEN,this._open.bind(this)),this._socket.addEventListener(Qr.CLOSE,this._close.bind(this)),this._socket.addEventListener(Qr.ERROR,this._error.bind(this))}_message(t){const e=this._listens.get(Qr.MESSAGE);e&&e(t)}_open(t){const e=this._listens.get(Qr.OPEN);e&&(e(t),this._heartbeat())}_error(t){const e=this._listens.get(Qr.ERROR);e&&(e(t),this._retry())}_close(t){const e=this._listens.get(Qr.CLOSE);e&&(e(t),this.destroy())}_clear(){this._timer>-1&&clearInterval(this._timer),this._timer=-1,this._socket.removeEventListener(Qr.MESSAGE,this._message.bind(this)),this._socket.removeEventListener(Qr.OPEN,this._open.bind(this)),this._socket.removeEventListener(Qr.CLOSE,this._close.bind(this)),this._socket.removeEventListener(Qr.ERROR,this._error.bind(this))}_heartbeat(){const{_socket:t,_config:e}=this,{heartbeatTime:r}=e;this._timer=setInterval((function(){t.send($r)}),r)}_retry(){const t=this._listens.get(Qr.RETRY);t&&t(),this._clear(),this._create(),this._bind()}}const Jr=Object.keys(He).reduce(((t,e)=>[...t,...He[e]]),[]);function ts(t){return-1===Jr.indexOf(t)}const es={},rs={};class ss{static getValue(t,e){try{return t[e]?t[e]:e.split(".").reduce(((t,e)=>t[e]),t)}catch(r){console.error("Key %s not found",e)}}initialize(t){this.options={currentLocale:t||["zh","zh-CN"].includes(B.getLanguage())?Kt.ZH:Kt.EN,locales:{zh:es,en:rs}}}get(t){if(t){const{locales:e,currentLocale:r}=this.options;return ss.getValue(e[r],t)||t}return String()}getObject(t){const{locales:e,currentLocale:r}=this.options;return ss.getValue(e[r],t)}load(t){B.deepMerge(this.options.locales,t)}change(t){this.options.currentLocale=t}getCurrentLocale(){return this.options.currentLocale}}class ls{static log(...t){console&&console.log(...t)}static info(...t){console&&console.info(...t)}static error(...t){console&&console.error(...t)}static warn(...t){console&&console.warn(...t)}static br(){ls.info("\n")}static capsule(t,e,r="",s=""){console&&console.log(`%c${r}%c${t}%c${e}%c${s}`,"","padding:3px;color:white;background:#023047","padding:3px;color:white;background:#219EBC","")}}class ns{constructor(t,e){this._max=t,this._min=e}next(){return Math.trunc(Math.random()*(this._max-this._min)+this._min)}}class os{constructor(){this._include=[],this._count=1}checked(t){return this._include.includes(t)}onlyName(t){let e=t,r=1;for(;this.checked(e);)e=t+r,r++;return this._include.push(e),e}sheetName(t="sheet1"){let e=t;for(;this.checked(e);)e=`sheet${this._count}`,this._count++;return this._include.push(e),e}}class is{static hasLength(t,e){return t.length===e}static getValueType(t){return Object.prototype.toString.apply(t)}static isObject(t){return"[object Object]"===this.getValueType(t)}static isIterable(t){return null!=t[Symbol.iterator]}static isNumber(t){return"[object Number]"===this.getValueType(t)}}const as=Symbol("newer"),gs=Symbol("older");class cs{constructor(t){this.entry=t}[Symbol.iterator](){return this}next(){let t=this.entry;return t?(this.entry=t[as],{done:!1,value:t.key}):{done:!0,value:void 0}}}class bs{constructor(t){this.entry=t}[Symbol.iterator](){return this}next(){let t=this.entry;return t?(this.entry=t[as],{done:!1,value:t.value}):{done:!0,value:void 0}}}class hs{constructor(t){this.entry=t}[Symbol.iterator](){return this}next(){let t=this.entry;return t?(this.entry=t[as],{done:!1,value:[t.key,t.value]}):{done:!0,value:void 0}}}class ds{constructor(t,e){this.key=t,this.value=e,this[as]=void 0,this[gs]=void 0}toJSON(){return{key:this.key,value:this.value}}}class us{constructor(...t){if(is.hasLength(t,1)){if(is.isNumber(t[0])){const e=t[0];return void this._initialize(e,void 0)}if(is.isIterable(t[0])){const e=t[0];return void this._initialize(0,e)}}else if(is.hasLength(t,2)){const e=t[0],r=t[1];this._initialize(e,r)}}_initialize(t,e){this.oldest=void 0,this.newest=void 0,this.size=0,this.limit=t,this._keymap=new Map,e&&(this.assign(e),t<1&&(this.limit=this.size))}_markEntryAsUsed(t){t!==this.newest&&(t[as]&&(t===this.oldest&&(this.oldest=t[as]),t[as][gs]=t[gs]),t[gs]&&(t[gs][as]=t[as]),t[as]=void 0,t[gs]=this.newest,this.newest&&(this.newest[as]=t),this.newest=t)}assign(t){let e,r=this.limit||Number.MAX_VALUE;this._keymap.clear();let s=t[Symbol.iterator]();for(let l=s.next();!l.done;l=s.next()){let t=new ds(l.value[0],l.value[1]);if(this._keymap.set(t.key,t),e?(e[as]=t,t[gs]=e):this.oldest=t,e=t,0==r--)throw new Error("overflow")}this.newest=e,this.size=this._keymap.size}set(t,e){let r=this._keymap.get(t);return r?(r.value=e,this._markEntryAsUsed(r),this):(this._keymap.set(t,r=new ds(t,e)),this.newest?(this.newest[as]=r,r[gs]=this.newest):this.oldest=r,this.newest=r,++this.size,this.size>this.limit&&this.shift(),this)}shift(){let t=this.oldest;if(t)return this.oldest&&this.oldest[as]?(this.oldest=this.oldest[as],this.oldest[gs]=void 0):(this.oldest=void 0,this.newest=void 0),t[as]=t[gs]=void 0,this._keymap.delete(t.key),--this.size,[t.key,t.value]}get(t){const e=this._keymap.get(t);if(e)return this._markEntryAsUsed(e),e.value}has(t){return this._keymap.has(t)}find(t){let e=this._keymap.get(t);return e?e.value:void 0}delete(t){let e=this._keymap.get(t);if(e)return this._keymap.delete(e.key),e[as]&&e[gs]?(e[gs][as]=e[as],e[as][gs]=e[gs]):e[as]?(e[as][gs]=void 0,this.oldest=e[as]):e[gs]?(e[gs][as]=void 0,this.newest=e[gs]):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 cs(this.oldest)}values(){return new bs(this.oldest)}entries(){return this[Symbol.iterator]()}[Symbol.iterator](){return new hs(this.oldest)}forEach(t,e){"object"!=typeof e&&(e=this);let r=this.oldest;for(;r;)t.call(e,r.value,r.key,this),r=r[as]}toJSON(){let t=new Array(this.size),e=0,r=this.oldest;for(;r;)t[e++]={key:r.key,value:r.value},r=r[as];return t}toString(){let t=String(),e=this.oldest;for(;e;)t+=`${String(e.key)}:${e.value}`,e=e[as],e&&(t+=" < ");return t}}function fs(t,e){var r,s,l,n,o,i,a,g,c,b,h,d,u,f,v,m,p,_,B,C,w,T,y,S,j,E,Y,R,I,A,x,O,N,k,M,D,L,P,H,F,U,z,W,V,G,X,Q,K,Z,$,q,J,tt,et,rt,st,lt,nt,ot,it,at,gt,ct,bt,ht,dt;t.cellData={};for(let ut of e.config.borderInfo)if("cell"===ut.rangeType){const e=ut.value.row_index,u=ut.value.col_index;t.cellData[String(e)]||(t.cellData[String(e)]={}),t.cellData[String(e)][String(u)]||(t.cellData[String(e)][String(u)]={}),t.cellData[String(e)][String(u)].s||(t.cellData[String(e)][String(u)].s={});const f={};ut.value.l&&(f.l={s:ut.value.l.style,cl:{rgb:ut.value.l.color}},t.cellData[String(e)]&&(null==(l=null==(s=null==(r=t.cellData[String(e)][String(u-1)])?void 0:r.s)?void 0:s.bd)?void 0:l.r)&&delete t.cellData[String(e)][String(u-1)].s.bd.r),ut.value.r&&(f.r={s:ut.value.r.style,cl:{rgb:ut.value.r.color}},t.cellData[String(e)]&&(null==(i=null==(o=null==(n=t.cellData[String(e)][String(Number(u)+1)])?void 0:n.s)?void 0:o.bd)?void 0:i.l)&&delete t.cellData[String(e)][String(u-1)].s.bd.l),ut.value.t&&(f.t={s:ut.value.t.style,cl:{rgb:ut.value.t.color}},t.cellData[String(e-1)]&&(null==(c=null==(g=null==(a=t.cellData[String(e)][String(u)])?void 0:a.s)?void 0:g.bd)?void 0:c.b)&&delete t.cellData[String(e)][String(u-1)].s.bd.b),ut.value.b&&(f.b={s:ut.value.b.style,cl:{rgb:ut.value.b.color}},t.cellData[String(Number(e)+1)]&&(null==(d=null==(h=null==(b=t.cellData[String(e)][String(u)])?void 0:b.s)?void 0:h.bd)?void 0:d.t)&&delete t.cellData[String(e)][String(u-1)].s.bd.t),t.cellData[String(e)][String(u)].s.bd=Object.assign(t.cellData[String(e)][String(u)].s.bd||{},f)}else if("range"===ut.rangeType)for(const e of ut.range){const r=e.row[0],s=e.row[1],l=e.column[0],n=e.column[1];switch(ut.borderType){case"border-left":for(let e=r;e<=s;e++)for(let r=l;r{var r;null==(r=t.selections)||r.push({startRow:e.row[0],endRow:e.row[1],startColumn:e.column[0],endColumn:e.column[1]})}))),s.hasOwnProperty("scrollLeft")&&(t.scrollLeft=s.scrollLeft),s.hasOwnProperty("scrollTop")&&(t.scrollTop=s.scrollTop),s.hasOwnProperty("config")){if(s.config.merge){t.mergeData=[];for(const e of Object.keys(s.config.merge)){const r=s.config.merge[e],l={startRow:r.r,endRow:r.r+r.rs-1,startColumn:r.c,endColumn:r.c+r.cs-1};t.mergeData.push(l)}}if(s.config.borderInfo&&fs(t,s),s.config.rowlen){t.rowData={};for(const[e,r]of Object.entries(s.config.rowlen))t.rowData[String(e)]={h:r,hd:0}}if(s.config.columnlen){t.columnData={};for(const[e,r]of Object.entries(s.config.columnlen))t.columnData[String(e)]={w:r,hd:0}}if(s.config.rowhidden){t.rowData||(t.rowData={});for(const[e,r]of Object.entries(s.config.rowhidden))t.rowData[String(e)]||(t.rowData[String(e)]={}),t.rowData[String(e)].hd=r}if(s.config.colhidden){t.columnData||(t.columnData={});for(const[e,r]of Object.entries(s.config.colhidden))t.columnData[String(e)]||(t.columnData[String(e)]={}),t.columnData[String(e)].hd=r}}if(s.hasOwnProperty("celldata")){t.cellData||(t.cellData={});for(const r of s.celldata){t.cellData[r.r]||(t.cellData[r.r]={}),t.cellData[r.r][r.c]||(t.cellData[r.r][r.c]={});const s=r.v,l=t.cellData[r.r][r.c];if("inlineStr"===(null==(e=null==s?void 0:s.ct)?void 0:e.t)){const t=[];s.ct.s.forEach((e=>{const r={};e.hasOwnProperty("bg")&&(r.bg={rgb:e.fc}),e.hasOwnProperty("ff")&&(r.ff=e.ff),e.hasOwnProperty("fc")&&(r.cl={rgb:e.fc}),e.hasOwnProperty("fs")&&(r.fs=e.fs),e.hasOwnProperty("bl")&&(r.bl=e.bl),e.hasOwnProperty("it")&&(r.it=e.it),e.hasOwnProperty("cl")&&(r.st={s:1}),e.hasOwnProperty("un")&&(r.ul={s:e.un});const s=B.generateRandomId(6);t.push({eId:s,st:0,ed:e.v.length-1,et:0,tr:{ct:e.v,ts:r}})})),l.p={id:B.generateRandomId(6),body:{blockElements:[{blockId:"p1",st:0,ed:s.ct.s.length-1,blockType:0,paragraph:{elements:t}}]},documentStyle:{}}}else{s.hasOwnProperty("v")&&(l.v=s.v),s.hasOwnProperty("m")?l.m=s.m:l.m=String(s.v||"");const t={};s.hasOwnProperty("bg")&&(t.bg={rgb:s.bg}),s.hasOwnProperty("ff")&&(t.ff=s.ff),s.hasOwnProperty("fc")&&(t.cl={rgb:s.fc}),s.hasOwnProperty("fs")&&(t.fs=s.fs),s.hasOwnProperty("bl")&&(t.bl=s.bl),s.hasOwnProperty("it")&&(t.it=s.it),s.hasOwnProperty("cl")&&(t.st={s:s.cl}),s.hasOwnProperty("un")&&(t.ul={s:s.un});const e={0:2,1:1,2:3};if(s.hasOwnProperty("vt")&&(t.vt=e[String(s.vt)]),s.hasOwnProperty("ht")&&(t.ht=e[String(s.ht)]),s.hasOwnProperty("tr"))switch(s.tr){case"0":t.tr={a:0,v:0};break;case"1":t.tr={a:45,v:0};break;case"2":t.tr={a:-45,v:0};break;case"3":t.tr={a:0,v:1};break;case"4":t.tr={a:90,v:0};break;case"5":t.tr={a:-90,v:0}}s.hasOwnProperty("rt")&&(t.tr={a:s.tr,v:0}),s.hasOwnProperty("tb")&&(t.tb=e[String(s.tb)]),l.s=Object.assign(l.s||{},t)}}}r.sheets[t.id]=t}}return r}class ms{constructor(...t){if(B.hasLength(t,0))return this.startRow=0,this.startColumn=0,this.endRow=0,void(this.endColumn=0);if(B.hasLength(t,1)){const e=t[0];return this.startRow=e.startRow,this.startColumn=e.startColumn,this.endRow=e.endRow,void(this.endColumn=e.endColumn)}if(B.hasLength(t,4)){const e=t[0],r=t[1],s=t[2],l=t[3];this.startRow=e,this.startColumn=r,this.endRow=s,this.endColumn=l}}static equals(t,e){return t.endRow===e.endRow&&t.endColumn===e.endColumn&&t.startRow===e.startRow&&t.startColumn===e.startColumn}static intersects(t,e){const r=t.startRow,s=t.endRow,l=t.startColumn,n=t.endColumn,o=e.startRow,i=e.endRow,a=e.startColumn,g=e.endColumn,c=Math.abs(l+n-a-g),b=Math.abs(l-n)+Math.abs(a-g),h=Math.abs(r+s-o-i),d=Math.abs(r-s)+Math.abs(o-i);return c<=b&&h<=d}intersects(t){return ms.intersects(this,t)}union(t){const{startRow:e,startColumn:r,endRow:s,endColumn:l}=this;return new ms(t.startRows?t.endRow:s,t.endColumn>l?t.endColumn:l)}getData(){return{startRow:this.startRow,startColumn:this.startColumn,endRow:this.endRow,endColumn:this.endColumn}}equals(t){return ms.equals(this,t)}}const ps=/[^0-9]/g,_s=/[^A-Za-z]/g;function Bs(t){return{row:parseInt(t.replace(ps,""))-1,column:B.ABCatNum(t.replace(_s,""))}}const Cs="A".charCodeAt(0),ws="Z".charCodeAt(0),Ts="a".charCodeAt(0);function ys(t){const e=ws-Cs+1;let r="";for(;t>=0;)r=String.fromCharCode(t%e+Cs)+r,t=Math.floor(t/e)-1;return r}function Ss(t,e){let r="";for(;e>0;)r+=t,e--;return r}function js(t,e=!1){const r=ws-Cs+1;let s=Ts;e&&(s=Cs);return Ss(String.fromCharCode(t%r+s),Math.floor(t/r)+1)}class Es{static fromSequence(t){if(B.isObject(t)&&Es.requiredNewInstance(this)){return this.newInstance(t)}if(B.isArray(t)&&Es.requiredNewInstance(this)){const e=this;return t.map((t=>e.newInstance(t)))}return[]}toSequence(){return{className:B.getClassName(this)}}}function Ys(t,e){return t.zIndex>e.zIndex?1:t.zIndex===e.zIndex?0:-1}function Rs(t,e){return t.zIndex>e.zIndex?-1:t.zIndex===e.zIndex?0:1}(Es||(Es={})).requiredNewInstance=function(t){if(B.isDefine(t.newInstance))return!0;throw new Error("sequence newInstance need subclass implement!")};const Is=class{static checkup(t,...e){if(t.length!==e.length)return!1;const r=t.length;for(let s=0;sOs(t[r],e[r]))):t===e)}xs.RegisteredTypes={};class Ns{constructor(t,e,r){this.path=t,this.namespace=e,this.observable=r}}class ks{constructor(){this._observableArray=[]}hasObserver(t,e){return null!=this.getObserver(t,e)}getObserver(...t){if(1===t.length){const e=t[0],r=this._observableArray.find((t=>t.path===e));return r?r.observable:null}if(2===t.length){const e=t[0],r=t[1],s=this._observableArray.find((t=>t.path===e&&t.namespace===r));return s?s.observable:null}}requiredObserver(...t){if(B.hasLength(t,1)){const e=t[0],r=this.getObserver(e);if(null==r)throw new Error(`not found observable ${e}`);return r}if(B.hasLength(t,2)){const e=t[0],r=t[1],s=this.getObserver(e,r);if(null==s)throw new Error(`not found observable ${e}`);return s}throw new Error("requiredObserver arguments error")}removeObserver(...t){if(B.hasLength(t,1)){const e=t[0],r=this._observableArray.findIndex((t=>t.path===e));r>-1&&this._observableArray.splice(r,1)}else if(B.hasLength(t,2)){const e=t[0],r=t[1],s=this._observableArray.findIndex((t=>t.path===e&&t.namespace===r));s>-1&&this._observableArray.splice(s,1)}}addObserver(...t){if(1===t.length){const e=t[0],r=t[1];return this.hasObserver(e,e)&&this.removeObserver(e),void this._observableArray.push(new Ns(e,e,r))}if(3===t.length){const e=t[0],r=t[1],s=t[2];this.hasObserver(e,e)&&this.removeObserver(e,r),this._observableArray.push(new Ns(e,r,s))}}}var Ms,Ds;(Ds=Ms||(Ms={}))[Ds.REDO=0]="REDO",Ds[Ds.UNDO=1]="UNDO";class Ls extends o{}class Ps extends o{}class Hs extends o{}class Fs{constructor(t){this._undoManager=t.getUndoManager(),this._actionExtensionManager=new Vs}static staticInitialize(){this._actionClass=new Map,this._actionObservers=new Ls,this._commandObservers=new Hs,this._commandInjectorObservers=new Ps}static getAction(t){return this._actionClass[t]}static getActionObservers(){return this._actionObservers}static getCommandObservers(){return this._commandObservers}static register(t,e){this._actionClass[t]=e}static getCommandInjectorObservers(){return this._commandInjectorObservers}getActionExtensionManager(){return this._actionExtensionManager}undo(){const{_undoManager:t}=this,e=t.undo();e&&e.undo()}redo(){const{_undoManager:t}=this,e=t.redo();e&&e.redo()}invoke(t){const{_undoManager:e}=this,{_actionDataList:r,_unit:s,_actionList:l}=t;this._actionExtensionManager.handle(r),r.forEach((t=>{const e=Fs.getAction(t.actionName),r=Fs.getActionObservers(),n=new e(t,s,r);l.push(n)})),t.invoke(),e.push(t)}}Fs.staticInitialize();class Us extends s{constructor(t,e,r){if(super(t,r),null==e.WorkBookUnit)throw new Error("action workbook domain can not be null!");this._commandUnit=e,this._workbook=e.WorkBookUnit}getWorkSheet(){const{_workbook:t,_doActionData:e}=this,{sheetId:r}=e;return t.getSheetBySheetId(r)}getWorkBook(){return this._workbook}}class zs{constructor(t,...e){this._unit=t,this._actionDataList=e,this._actionList=[]}getDoData(){return this._actionList.map((t=>t.getDoActionData()))}getOldData(){return this._actionList.map((t=>t.getOldActionData()))}getInjector(){const t=this;return new class{injectAction(e){t._actionList.push(e)}getActions(){return t._actionList.concat([])}include(e){for(let r=0;r{$s.hasUndo(t.getDoActionData())&&t.redo()})),Fs.getCommandObservers().notifyObservers({type:Ms.REDO,actions:this._actionList})}undo(){this._actionList.reverse().forEach((t=>{$s.hasUndo(t.getOldActionData())&&t.undo()})),Fs.getCommandObservers().notifyObservers({type:Ms.UNDO,actions:this._actionList})}invoke(){Fs.getCommandInjectorObservers().notifyObservers(this.getInjector()),Fs.getCommandObservers().notifyObservers({type:Ms.REDO,actions:this._actionList})}}class Ws{constructor(){this._undoStack=[],this._redoStack=[]}push(t){this._redoStack.push(t)}undo(){const t=this._redoStack.pop();if(t)return this._undoStack.push(t),t}redo(){const t=this._undoStack.pop();if(t)return this._redoStack.push(t),t}}class Vs{constructor(){this._register=new Zs,this._register.initialize()}getRegister(){return this._register}handle(t){var e;const r=null==(e=this._register)?void 0:e.actionExtensionFactoryList;r&&(this._actionExtensionFactoryList=r,0!==t.length&&this._checkExtension(t))}_checkExtension(t){if(!this._actionExtensionFactoryList)return!1;this._actionExtensionFactoryList.forEach((e=>{const r=e.check(t);!1!==r&&r.execute()}))}}class Gs{constructor(t,e){this.actionDataList=t,this._plugin=e}getActionDataList(){return this.actionDataList}push(t){this.actionDataList.push(t)}setValue(){}execute(){}}class Xs{constructor(t){this._plugin=t}get zIndex(){return 0}create(t){return new Gs(t,this._plugin)}check(t){return this.create(t)}}class Qs{constructor(){this._data=[]}static create(){return new Qs}add(t){this._data.push(t)}delete(t){const e=this._data.indexOf(t);this._data.splice(e,1)}getData(){return this._data}}const Ks=Qs.create();class Zs{constructor(){this._actionExtensionFactoryList=[]}get actionExtensionFactoryList(){return this._actionExtensionFactoryList}initialize(){this._initExtensions()}add(...t){this._actionExtensionFactoryList.push(...t),this._actionExtensionFactoryList.sort(Ys)}delete(t){const e=this._actionExtensionFactoryList.indexOf(t);this._actionExtensionFactoryList.splice(e,1)}_initExtensions(){this._actionExtensionFactoryList.push(...Ks.getData().sort(Ys))}}class $s{constructor(t){this._action=t}static hasObserver(t){return!t.operation||(t.operation&e.OBSERVER_ACTION)===e.OBSERVER_ACTION}static hasUndo(t){return!t.operation||(t.operation&e.UNDO_ACTION)===e.UNDO_ACTION}static hasCollaboration(t){return!t.operation||(t.operation&e.SERVER_ACTION)===e.SERVER_ACTION}static hasExtension(t){return!t.operation||(t.operation&e.EXTENSION_ACTION)===e.EXTENSION_ACTION}static make(t){return t.operation=e.DEFAULT_ACTION,new $s(t)}removeObserver(){return this._action.operation&&(this._action.operation&=~e.OBSERVER_ACTION),this}removeUndo(){return this._action.operation&&(this._action.operation&=~e.UNDO_ACTION),this}removeCollaboration(){return this._action.operation&&(this._action.operation&=~e.SERVER_ACTION),this}removeExtension(){return this._action.operation&&(this._action.operation&=~e.EXTENSION_ACTION),this}getAction(){return this._action}}function qs(t,e){var r;let s=null==(r=null==t?void 0:t.WorkBookUnit)?void 0:r.getSheetBySheetId(e.sheetId);if(s){let t=s.getConfig().mergeData,r=e.rectangles;for(let e=0;et.namedRangeId===e.namedRangeId?(s.splice(r,1),t):null))}function rl(t,e){var r,s,l;const n=null==(r=t.WorkBookUnit)?void 0:r.getSheetBySheetId(e.sheetId),o=null==n?void 0:n.getCellMatrix(),i={rowCount:null==n?void 0:n.getConfig().rowCount,columnCount:null==n?void 0:n.getConfig().columnCount},{startRow:a,endRow:g,startColumn:c,endColumn:b}=e.rangeData,h=g-a+1,d=b-c+1,u=null!=(s=i.rowCount)?s:0,f=null!=(l=i.columnCount)?l:0,m=new v;if(e.shiftDimension===Dt.ROWS)for(let v=a;v<=u;v++)for(let t=c;t<=b;t++){if(v<=g){const e=null==o?void 0:o.getValue(v,t);m.setValue(v,t,e)}const e=null==o?void 0:o.getValue(v+h,t);if(e)null==o||o.setValue(v,t,B.deepClone(e));else{(null==o?void 0:o.getValue(v,t))&&(null==o||o.deleteValue(v,t),t--)}}else if(e.shiftDimension===Dt.COLUMNS)for(let v=a;v<=g;v++)for(let t=c;t<=f;t++){if(t<=b){const e=null==o?void 0:o.getValue(v,t);m.setValue(v,t,e)}else for(let r=0;r<=b;r++){const e=null==o?void 0:o.getValue(v,t);m.setValue(v,t+r,e)}const e=null==o?void 0:o.getValue(v,t+d);if(e)null==o||o.setValue(v,t,B.deepClone(e));else{if(null==o?void 0:o.getValue(v,t)){for(let e=0;e<=b;e++)null==o||o.deleteValue(v,t);break}}}return m.getData()}function sl(t,e){const r=t.getConfig(),s=r.hidden;return r.hidden=e,s}function ll(t,e){const r=t.WorkBookUnit.getSheetBySheetId(e.sheetId).getColumnManager().getColumnData().toJSON();new u(r).inserts(e.columnIndex,new u(e.columnCount))}function nl(t,e){const r=t.WorkBookUnit.getSheetBySheetId(e.sheetId).getCellMatrix().toJSON();new v(r).insertColumns(e.columnIndex,new v(e.columnData))}function ol(t,e){const r=t.WorkBookUnit.getSheetBySheetId(e.sheetId).getCellMatrix().toJSON();new v(r).insertRows(e.rowIndex,new v(e.rowData))}function il(t,e){const r=t.WorkBookUnit.getSheetBySheetId(e.sheetId),s=r.getLastRow(),l=r.getLastColumn(),n=r.getCellMatrix(),{startRow:o,endRow:i,startColumn:a,endColumn:g}=e.rangeData,c=i-o+1,b=g-a+1,h=s,d=l;if(e.shiftDimension===Dt.ROWS){for(let t=h;t>=o;t--)for(let e=a;e<=g;e++){const r=n.getValue(t,e);n.setValue(t+c,e,r)}for(let t=i;t>=o;t--)for(let r=a;r<=g;r++)n.setValue(t,r,e.cellValue[t-o][r-a])}else if(e.shiftDimension===Dt.COLUMNS){for(let t=o;t<=i;t++)for(let e=d;e>=a;e--){const r=n.getValue(t,e);n.setValue(t,e+b,r)}for(let t=o;t<=i;t++)for(let r=g;r>=a;r--)n.setValue(t,r,e.cellValue[t-o][r-a])}}function al(t,e){const r=t.WorkBookUnit.getSheetBySheetId(e.sheetId).getRowManager().getRowData().toJSON();new u(r).inserts(e.rowIndex,new u(e.rowCount))}function gl(t,e){t.WorkBookUnit.getSheetBySheetId(e.sheetId);const r=e.index,s=e.sheet,l=t.WorkBookUnit.getWorksheets(),n=t.WorkBookUnit.getConfig(),{sheets:o,sheetOrder:i}=n;if(o[s.id])throw new Error(`Insert Sheet fail ${s.id} is already exist`);return o[s.id]=s,i.splice(r,0,s.id),l.set(s.id,new yr(t.WorkBookUnit.getContext(),s)),s.id}function cl(t,e){const r=t.WorkBookUnit.getSheetBySheetId(e.sheetId).getColumnManager().getColumnData().toJSON(),s=new u(r),l=new u,n=e.columnIndex,o=e.columnIndex+e.columnCount;for(let i=n;i=0;r--){let n=s[r],o=l[e];ms.intersects(n,o)&&t.push(s.splice(r,1)[0])}return t}return[]}function dl(t,e){const r=t.WorkBookUnit.getSheetBySheetId(e.sheetId).getRowManager().getRowData().toJSON(),s=new u(r),l=new u,n=e.rowIndex,o=e.rowIndex+e.rowCount;for(let i=n;it===s));return delete o[s],n.sheetOrder.splice(a,1),l.delete(s),{index:a,sheet:i}}function vl(t,e){const r=t.WorkBookUnit,s=r.getSheetBySheetId(e.sheetId),l=r.getStyles(),n=s.getCellMatrix(),o=new v(e.styles),i=new v;return o.forValue(((t,e,r)=>{const s=n.getValue(t,e);if(s){const n=l.get(s.s);n&&i.setValue(t,e,n),s.s=l.setValue(r)}})),i.toJSON()}function ml(t,e){const r=t.WorkBookUnit.getSheetBySheetId(e.sheetId),s=e.columnIndex,l=e.columnCount,n=r.getColumnManager();for(let o=s;ot.namedRangeId===s.namedRangeId?(l[e]=s,t):null))}function Tl(t,e,r,s){const{startRow:l,endRow:n,startColumn:o,endColumn:i}=r,a=new v;for(let g=l;g<=n;g++)for(let r=o;r<=i;r++){const n=t.getValue(g,r)||{},i=s.getStyleByCell(n);null==i&&delete n.s;const c=El(i,e[g-l][r-o]);c&&B.removeNull(c),B.isEmptyObject(c)?delete n.s:n.s=s.setValue(c),n.p&&Yl(n.p,e[g-l][r-o]),t.setValue(g,r,n),a.setValue(g-l,r-o,yl(i,e[g-l][r-o]))}return a.getData()}function yl(t,e){return Sl(t,e)}function Sl(t,e){if(!e||!Object.keys(e).length)return t;const r=B.deepClone(t)||{};for(const s in e)"bd"===s?r[s]=jl(r[s]||{},e[s]):s in r||(r[s]=null);return r}function jl(t,e){if(!e||!Object.keys(e).length)return t;for(const r in e)r in t||(t[r]=null);return t}function El(t,e,r=!1){if(null===e)return e;if(void 0===e)return t;const s=B.deepClone(t)||{};for(const l in e)r&&["bd","tr","td","ht","vt","tb","pd"].includes(l)||(l in s&&"bd"===l?s[l]=Object.assign(s[l],e[l]):(s[l]=e[l],"cl"in s&&["ul","ol","st"].includes(l)&&(s[l].cl=s.cl)));return s}function Yl(t,e){var r;null==(r=t.body)||r.blockElements.forEach((t=>{if(0===t.blockType){const r=t.paragraph;null==r||r.elements.forEach((t=>{t.tr||(t.tr={});const r=t.tr;r.ts||(r.ts={});const s=El(r.ts,e,!0);s&&B.removeNull(s),B.isEmptyObject(s)?delete r.ts:r.ts=s}))}}))}function Rl(t,e){const r=t.WorkBookUnit,s=r.getSheetBySheetId(e.sheetId).getCellMatrix(),l=e.options,n=e.cellValue,o=r.getStyles(),i=new v(n),a=new v;return l?(i.forValue(((t,e,r)=>{const n=s.getValue(t,e),o={};l.contentsOnly&&(o.m=null==n?void 0:n.m,o.v=null==n?void 0:n.v),l.formatOnly&&(o.v=null==n?void 0:n.v,o.m=null==n?void 0:n.m),a.setValue(t,e,o||{}),s.setValue(t,e,r||{})})),a.getData()):(i.forValue(((t,e,r)=>{const l=s.getValue(t,e)||{};if(r){const n=o.getStyleByCell(l),i=yl(n,null==r?void 0:r.s),g=B.deepClone(l);g.s=i,a.setValue(t,e,g),null==n&&delete l.s;const c=El(n,null==r?void 0:r.s);c&&B.removeNull(c),B.isEmptyObject(c)?delete l.s:l.s=o.setValue(c),null!=r.v&&(l.v=r.v),null!=r.m?l.m=r.m:l.m=String(l.v),null!=r.t&&(l.t=r.t),s.setValue(t,e,l)}else s.setValue(t,e,r),a.setValue(t,e,l)})),a.getData())}function Il(t,e,r){const s=new v(e),l=new v;for(let n=r.startRow;n<=r.endRow;n++)for(let e=r.startColumn;e<=r.endColumn;e++){const r=s.getValue(n,e),l=t.getValue(n,e),o=B.deepClone(l||{});o.n=r,t.setValue(n,e,o||{})}return l.getData()}function Al(t,e,r){const s=new v(e),l=new v;for(let n=r.startRow;n<=r.endRow;n++)for(let e=r.startColumn;e<=r.endColumn;e++){const r=s.getValue(n,e),o=t.getValue(n,e);l.setValue(n,e,o&&o.v||"");const i=B.deepClone(o||{});i.v=r,i.m=`${r}`,t.setValue(n,e,i||{})}return l.getData()}function xl(t,e){const r=t.getConfig(),s=r.rightToLeft;return r.rightToLeft=e,s}function Ol(t=0,e,r){const s=[];for(let l=t;lt===e)),n=s.sheetOrder.filter((t=>t!==e));return n.splice(r,0,e),s.sheetOrder=n,l}function Ml(t=0,e,r){for(let s=t;s{const e=t.getSheetId();t.getConfig().status=e===o?_e.TRUE:_e.FALSE})),{oldSheetId:s,status:l}}function Pl(t,e){const r=t.getConfig(),s=r.name;return r.name=e,s}function Hl(t,e){const r=t.getConfig(),s=r.status;return r.status=e,s}function Fl(t,e,r){const s=t.getSheetBySheetId(e);if(s){const t=s.getConfig().zoomRatio;return s.getConfig().zoomRatio=r,t}return 1}class Ul extends Us{constructor(t,e,r){super(t,e,r),this._doActionData=__spreadValues({},t),this._oldActionData=__spreadProps(__spreadValues({},t),{rectangles:this.do()}),this.validate()}do(){return qs(this._commandUnit,this._doActionData)}redo(){this.do()}undo(){hl(this._commandUnit,this._oldActionData)}validate(){return!1}}Ul.NAME="AddMergeAction",Fs.register(Ul.NAME,Ul);class zl extends Us{constructor(t,e,r){super(t,e,r),this._doActionData=__spreadValues({},t),this._oldActionData={actionName:Vl.NAME,sheetId:t.sheetId,namedRange:this.do()},this.validate()}do(){const t=el(this._commandUnit,this._doActionData);return this._observers.notifyObservers({type:Ms.REDO,data:this._doActionData,action:this}),t}redo(){const{sheetId:t}=this._doActionData;this._oldActionData={sheetId:t,actionName:Vl.NAME,namedRange:this.do()}}undo(){Js(this._commandUnit,this._oldActionData),this._observers.notifyObservers({type:Ms.UNDO,data:this._oldActionData,action:this})}validate(){return!1}}zl.NAME="DeleteNamedRangeAction",Fs.register(zl.NAME,zl);const Wl=class extends Us{constructor(t,e,r){super(t,e,r),this._doActionData=__spreadValues({},t),this.do(),this._oldActionData={actionName:zl.NAME,sheetId:t.sheetId,namedRangeId:t.namedRange.namedRangeId},this.validate()}do(){Js(this._commandUnit,this._doActionData),this._observers.notifyObservers({type:Ms.REDO,data:this._doActionData,action:this})}redo(){this.do()}undo(){const{sheetId:t}=this._oldActionData;this._doActionData={actionName:Wl.NAME,sheetId:t,namedRange:el(this._commandUnit,this._oldActionData)},this._observers.notifyObservers({type:Ms.UNDO,data:this._oldActionData,action:this})}validate(){return!1}};let Vl=Wl;var Gl,Xl;Vl.NAME="AddNamedRangeAction",Fs.register(Vl.NAME,Vl),(Xl=Gl||(Gl={})).DEFAULT="default",Xl.PASTE="paste";const Ql=class extends Us{constructor(t,e,r){super(t,e,r),this._doActionData=__spreadValues({},t),this._oldActionData=__spreadProps(__spreadValues({},t),{cellValue:this.do()}),this.validate()}do(){const t=Rl(this._commandUnit,this._doActionData);return this._observers.notifyObservers({type:Ms.REDO,data:this._doActionData,action:this}),t}redo(){const{sheetId:t,options:e}=this._doActionData;this._oldActionData={actionName:Ql.NAME,sheetId:t,cellValue:this.do(),options:e}}undo(){const{sheetId:t,cellValue:e,options:r}=this._oldActionData,s=this.getWorkSheet();this._workbook.getStyles(),s&&(this._doActionData={actionName:Ql.NAME,sheetId:t,cellValue:Rl(this._commandUnit,this._oldActionData),options:r},this._observers.notifyObservers({type:Ms.UNDO,data:this._oldActionData,action:this}))}validate(){return!1}};let Kl=Ql;Kl.NAME="SetRangeDataAction",Fs.register(Kl.NAME,Kl);class Zl extends Us{constructor(t,e,r){super(t,e,r),this._doActionData=__spreadValues({},t),this._oldActionData=__spreadProps(__spreadValues({},t),{cellValue:this.do()}),this.validate()}do(){const t=tl(this._commandUnit,this._doActionData);return this._observers.notifyObservers({type:Ms.REDO,data:this._doActionData,action:this}),t}redo(){const{sheetId:t}=this._doActionData;this._oldActionData={actionName:Kl.NAME,sheetId:t,cellValue:this.do()}}undo(){this.getWorkSheet()&&(Rl(this._commandUnit,this._oldActionData),this._observers.notifyObservers({type:Ms.UNDO,data:this._oldActionData,action:this}))}validate(){return!1}}Zl.NAME="ClearRangeAction",Fs.register(Zl.NAME,Zl);class $l extends Us{constructor(t,e,r){super(t,e,r),this._doActionData=__spreadValues({},t),this.do(),this._oldActionData=__spreadValues({},t),this.validate()}do(){this.getWorkSheet()&&(il(this._commandUnit,this._doActionData),this._observers.notifyObservers({type:Ms.REDO,data:this._doActionData,action:this}))}redo(){this.do()}undo(){const{rangeData:t,sheetId:e,shiftDimension:r}=this._oldActionData;this.getWorkSheet()&&(this._doActionData={actionName:Kl.NAME,sheetId:e,cellValue:rl(this._commandUnit,this._oldActionData),rangeData:t,shiftDimension:r},this._observers.notifyObservers({type:Ms.UNDO,data:this._oldActionData,action:this}))}validate(){return!1}}$l.NAME="InsertRangeAction",Fs.register($l.NAME,$l);class ql extends Us{constructor(t,e,r){super(t,e,r),this._doActionData=__spreadValues({},t),this._oldActionData=__spreadProps(__spreadValues({},t),{cellValue:this.do()}),this.validate()}do(){const t=rl(this._commandUnit,this._doActionData);return this._observers.notifyObservers({type:Ms.REDO,data:this._doActionData,action:this}),t}redo(){const{sheetId:t,rangeData:e,shiftDimension:r}=this._doActionData;this._oldActionData={sheetId:t,actionName:$l.NAME,shiftDimension:r,rangeData:e,cellValue:this.do()}}undo(){this.getWorkSheet()&&(il(this._commandUnit,this._oldActionData),this._observers.notifyObservers({type:Ms.UNDO,data:this._oldActionData,action:this}))}validate(){return!1}}ql.NAME="DeleteRangeAction",Fs.register(ql.NAME,ql);class Jl extends Us{constructor(t,e,r){super(t,e,r),this._doActionData=__spreadValues({},t),this.do(),this._oldActionData=__spreadValues({},t),this.validate()}do(){ll(this._commandUnit,this._doActionData),this._observers.notifyObservers({type:Ms.REDO,data:this._doActionData,action:this})}redo(){this.do()}undo(){cl(this._commandUnit,this._oldActionData),this._observers.notifyObservers({type:Ms.UNDO,data:this._oldActionData,action:this})}validate(){return!1}}Jl.NAME="InsertColumnAction",Fs.register(Jl.NAME,Jl);class tn extends Us{constructor(t,e,r){super(t,e,r),this._doActionData=__spreadValues({},t),this.do(),this._oldActionData=__spreadProps(__spreadValues({},t),{columnCount:u.getMaxLength(t.columnData[0])}),this.validate()}do(){nl(this._commandUnit,this._doActionData),this._observers.notifyObservers({type:Ms.REDO,data:this._doActionData,action:this})}redo(){this.do()}undo(){bl(this._commandUnit,this._oldActionData),this._observers.notifyObservers({type:Ms.UNDO,data:this._oldActionData,action:this})}validate(){return!1}}tn.NAME="InsertColumnDataAction",Fs.register(tn.NAME,tn);class en extends Us{constructor(t,e,r){super(t,e,r),this._doActionData=__spreadValues({},t),this.do(),this._oldActionData=__spreadValues({},t),this.validate()}do(){al(this._commandUnit,this._doActionData),this._observers.notifyObservers({type:Ms.REDO,data:this._doActionData,action:this})}redo(){this.do()}undo(){dl(this._commandUnit,this._oldActionData),this._observers.notifyObservers({type:Ms.UNDO,data:this._oldActionData,action:this})}validate(){return!1}}en.NAME="InsertRowAction",Fs.register(en.NAME,en);class rn extends Us{constructor(t,e,r){super(t,e,r),this._doActionData=__spreadValues({},t),this.do(),this._oldActionData=__spreadProps(__spreadValues({},t),{rowCount:u.getMaxLength(t.rowData[0])}),this.validate()}do(){ol(this._commandUnit,this._doActionData),this._observers.notifyObservers({type:Ms.REDO,data:this._doActionData,action:this})}redo(){this.do()}undo(){ul(this._commandUnit,this._oldActionData),this._observers.notifyObservers({type:Ms.UNDO,data:this._oldActionData,action:this})}validate(){return!1}}rn.NAME="InsertRowDataAction",Fs.register(rn.NAME,rn);class sn extends Us{constructor(t,e,r){super(t,e,r),this._doActionData=__spreadValues({},t),this._oldActionData=__spreadProps(__spreadValues({},t),{sheetId:this.do()})}do(){const t=gl(this._commandUnit,this._doActionData);return this._observers.notifyObservers({type:Ms.REDO,data:this._doActionData,action:this}),t}redo(){this.redo()}undo(){fl(this._commandUnit,this._oldActionData),this._observers.notifyObservers({type:Ms.UNDO,data:this._oldActionData,action:this})}validate(){throw new Error("Method not implemented.")}}sn.NAME="InsertSheetAction",Fs.register(sn.NAME,sn);class ln extends Us{constructor(t,e,r){super(t,e,r),this._doActionData=__spreadValues({},t),this._oldActionData=__spreadProps(__spreadValues({},t),{columnCount:this.do()}),this.validate()}do(){const t=cl(this._commandUnit,this._doActionData);return this._observers.notifyObservers({type:Ms.REDO,data:this._doActionData,action:this}),t}redo(){this.do()}undo(){ll(this._commandUnit,this._oldActionData),this._observers.notifyObservers({type:Ms.UNDO,data:this._oldActionData,action:this})}validate(){return!1}}ln.NAME="RemoveColumnAction",Fs.register(ln.NAME,ln);class nn extends Us{constructor(t,e,r){super(t,e,r),this._doActionData=__spreadValues({},t),this._oldActionData=__spreadProps(__spreadValues({},t),{columnData:this.do()}),this.validate()}do(){const t=bl(this._commandUnit,this._doActionData);return this._observers.notifyObservers({type:Ms.REDO,data:this._doActionData,action:this}),t}redo(){this.do()}undo(){nl(this._commandUnit,this._oldActionData),this._observers.notifyObservers({type:Ms.UNDO,data:this._oldActionData,action:this})}validate(){return!1}}nn.NAME="RemoveColumnDataAction",Fs.register(nn.NAME,nn);class on extends Us{constructor(t,e,r){super(t,e,r),this._doActionData=__spreadValues({},t),this._oldActionData=__spreadProps(__spreadValues({},t),{rectangles:this.do()}),this.validate()}do(){const t=hl(this._commandUnit,this._doActionData);return this._observers.notifyObservers({type:Ms.REDO,data:this._doActionData,action:this}),t}redo(){this.do()}undo(){qs(this._commandUnit,this._oldActionData),this._observers.notifyObservers({type:Ms.UNDO,data:this._oldActionData,action:this})}validate(){return!1}}on.NAME="RemoveMergeAction",Fs.register(on.NAME,on);class an extends Us{constructor(t,e,r){super(t,e,r),this._doActionData=__spreadValues({},t),this._oldActionData=__spreadProps(__spreadValues({},t),{rowCount:this.do()}),this.validate()}do(){const t=dl(this._commandUnit,this._doActionData);return this._observers.notifyObservers({type:Ms.REDO,data:this._doActionData,action:this}),t}redo(){this.do()}undo(){al(this._commandUnit,this._oldActionData),this._observers.notifyObservers({type:Ms.UNDO,data:this._oldActionData,action:this})}validate(){return!1}}an.NAME="RemoveRowAction",Fs.register(an.NAME,an);class gn extends Us{constructor(t,e,r){super(t,e,r),this._doActionData=__spreadValues({},t),this._oldActionData=__spreadProps(__spreadValues({},t),{rowData:this.do()}),this.validate()}do(){const t=ul(this._commandUnit,this._doActionData);return this._observers.notifyObservers({type:Ms.REDO,data:this._doActionData,action:this}),t}redo(){this.do()}undo(){ol(this._commandUnit,this._oldActionData),this._observers.notifyObservers({type:Ms.UNDO,data:this._oldActionData,action:this})}validate(){return!1}}gn.NAME="RemoveRowDataAction",Fs.register(gn.NAME,gn);class cn extends Us{constructor(t,e,r){super(t,e,r),this._doActionData=__spreadValues({},t),this._oldActionData=__spreadValues(__spreadValues({},t),this.do())}do(){return this.redo()}redo(){const t=fl(this._commandUnit,this._doActionData);return this._observers.notifyObservers({type:Ms.REDO,data:this._doActionData,action:this}),t}undo(){this.getWorkBook(),gl(this._commandUnit,this._oldActionData),this._observers.notifyObservers({type:Ms.UNDO,data:this._oldActionData,action:this})}validate(){throw new Error("Method not implemented.")}}cn.NAME="RemoveSheetAction",Fs.register(cn.NAME,cn);class bn extends Us{constructor(t,e,r){super(t,e,r),this._doActionData=__spreadValues({},t),this._oldActionData=__spreadProps(__spreadValues({},t),{styles:this.do()}),this.validate()}do(){const t=vl(this._commandUnit,this._doActionData);return this._observers.notifyObservers({type:Ms.REDO,data:this._doActionData,action:this}),t}redo(){this.do()}undo(){vl(this._commandUnit,this._oldActionData),this._observers.notifyObservers({type:Ms.UNDO,data:this._oldActionData,action:this})}validate(){return!1}}bn.NAME="SetBorderAction",Fs.register(bn.NAME,bn);class hn extends Us{constructor(t,e,r){super(t,e,r),this._doActionData=__spreadValues({},t),this.do(),this._oldActionData=__spreadValues({},t),this.validate()}do(){ml(this._commandUnit,this._doActionData),this._observers.notifyObservers({type:Ms.REDO,data:this._doActionData,action:this})}redo(){this.do()}undo(){pl(this._commandUnit,this._oldActionData),this._observers.notifyObservers({type:Ms.UNDO,data:this._oldActionData,action:this})}validate(){return!1}}hn.NAME="SetColumnHideAction",Fs.register(hn.NAME,hn);class dn extends Us{constructor(t,e,r){super(t,e,r),this._doActionData=__spreadValues({},t),this.do(),this._oldActionData=__spreadValues({},t),this.validate()}do(){pl(this._commandUnit,this._doActionData),this._observers.notifyObservers({type:Ms.REDO,data:this._doActionData,action:this})}redo(){this.do()}undo(){ml(this._commandUnit,this._oldActionData),this._observers.notifyObservers({type:Ms.UNDO,data:this._oldActionData,action:this})}validate(){return!1}}dn.NAME="SetColumnShowAction",Fs.register(dn.NAME,dn);class un extends Us{constructor(t,e,r){super(t,e,r),this._doActionData=__spreadValues({},t),this._oldActionData=__spreadProps(__spreadValues({},t),{columnWidth:this.do()}),this.validate()}do(){const t=_l(this._commandUnit,this._doActionData);return this._observers.notifyObservers({type:Ms.REDO,data:this._doActionData,action:this}),t}redo(){this.do()}undo(){const t=_l(this._commandUnit,this._doActionData);return this._observers.notifyObservers({type:Ms.UNDO,data:this._oldActionData,action:this}),t}validate(){return!1}}un.NAME="SetColumnWidthAction",Fs.register(un.NAME,un);class fn extends Us{constructor(t,e,r){super(t,e,r),this._doActionData=__spreadValues({},t),this._oldActionData=__spreadProps(__spreadValues({},t),{hideGridlines:this.do()}),this.validate()}do(){const t=Bl(this._commandUnit,this._doActionData);return this._observers.notifyObservers({type:Ms.REDO,data:this._doActionData,action:this}),t}redo(){this.do()}undo(){Bl(this._commandUnit,this._oldActionData),this._observers.notifyObservers({type:Ms.UNDO,data:this._oldActionData,action:this})}validate(){return!1}}fn.NAME="SetHiddenGridlinesAction",Fs.register(fn.NAME,fn);const vn=class extends Us{constructor(t,e,r){super(t,e,r),this._doActionData=__spreadValues({},t),this._oldActionData={actionName:vn.NAME,namedRange:this.do(),sheetId:t.sheetId},this.validate()}do(){const t=wl(this._commandUnit,this._doActionData);return this._observers.notifyObservers({type:Ms.REDO,data:this._doActionData,action:this}),t}redo(){const{sheetId:t}=this._doActionData;this._oldActionData={actionName:vn.NAME,sheetId:t,namedRange:this.do()}}undo(){const{sheetId:t}=this._oldActionData;this._observers.notifyObservers({type:Ms.UNDO,data:this._oldActionData,action:this}),this._doActionData={actionName:vn.NAME,sheetId:t,namedRange:wl(this._commandUnit,this._oldActionData)}}validate(){return!1}};let mn=vn;mn.NAME="SetNamedRangeAction",Fs.register(mn.NAME,mn);const pn=class extends Us{constructor(t,e,r){super(t,e,r),this._doActionData=__spreadValues({},t),this._oldActionData=__spreadProps(__spreadValues({},t),{cellNote:this.do()}),this.validate()}do(){const t=Il(this.getWorkSheet().getCellMatrix(),this._doActionData.cellNote,this._doActionData.rangeData);return this._observers.notifyObservers({type:Ms.REDO,data:this._doActionData,action:this}),t}redo(){const{sheetId:t,rangeData:e}=this._doActionData;this._oldActionData={actionName:pn.NAME,sheetId:t,cellNote:this.do(),rangeData:e}}undo(){const{rangeData:t,sheetId:e,cellNote:r}=this._oldActionData,s=this.getWorkSheet();s&&(this._doActionData={actionName:pn.NAME,sheetId:e,cellNote:Il(s.getCellMatrix(),r,t),rangeData:t},this._observers.notifyObservers({type:Ms.UNDO,data:this._oldActionData,action:this}))}validate(){return!1}};let _n=pn;_n.NAME="SetRangeNoteAction",Fs.register(_n.NAME,_n);const Bn=class extends Us{constructor(t,e,r){super(t,e,r),this._oldActionData=__spreadProps(__spreadValues({},t),{value:this.do()}),this.validate()}do(){const{value:t,rangeData:e}=this._doActionData,r=this._workbook.getStyles(),s=Tl(this.getWorkSheet().getCellMatrix(),t,e,r);return this._observers.notifyObservers({type:Ms.REDO,data:this._doActionData,action:this}),s}redo(){const{sheetId:t,rangeData:e}=this._doActionData;this._oldActionData={actionName:Bn.NAME,sheetId:t,value:this.do(),rangeData:e}}undo(){const{value:t,rangeData:e,sheetId:r}=this._oldActionData,s=this._workbook.getStyles(),l=this.getWorkSheet().getCellMatrix();this._doActionData={actionName:Bn.NAME,sheetId:r,value:Tl(l,t,e,s),rangeData:e},this._observers.notifyObservers({type:Ms.UNDO,data:this._oldActionData,action:this})}validate(){return!1}};let Cn=Bn;Cn.NAME="SetRangeStyleAction",Fs.register(Cn.NAME,Cn);class wn extends Us{constructor(t,e,r){super(t,e,r),this._doActionData=__spreadValues({},t),this._oldActionData=__spreadProps(__spreadValues({},t),{cellValue:this.do()}),this.validate()}do(){const t=Al(this.getWorkSheet().getCellMatrix(),this._doActionData.cellValue,this._doActionData.rangeData);return this._observers.notifyObservers({type:Ms.REDO,data:this._doActionData,action:this}),t}redo(){const{sheetId:t,rangeData:e}=this._doActionData;this._oldActionData={actionName:Kl.NAME,sheetId:t,cellValue:this.do(),rangeData:e}}undo(){const{rangeData:t,sheetId:e,cellValue:r}=this._oldActionData,s=this.getWorkSheet();s&&(this._doActionData={actionName:Kl.NAME,sheetId:e,cellValue:Al(s.getCellMatrix(),r,t),rangeData:t},this._observers.notifyObservers({type:Ms.UNDO,data:this._oldActionData,action:this}))}validate(){return!1}}wn.NAME="SetRangeFormattedValueAction",Fs.register(wn.NAME,wn);class Tn extends Us{constructor(t,e,r){super(t,e,r),this._doActionData=__spreadValues({},t),this._oldActionData=__spreadProps(__spreadValues({},t),{rightToLeft:this.do()}),this.validate()}do(){const t=xl(this.getWorkSheet(),this._doActionData.rightToLeft);return this._observers.notifyObservers({type:Ms.REDO,data:this._doActionData,action:this}),t}redo(){this.do()}undo(){this._oldActionData;xl(this.getWorkSheet(),this._oldActionData.rightToLeft),this._observers.notifyObservers({type:Ms.UNDO,data:this._oldActionData,action:this})}validate(){return!1}}Tn.NAME="SetRightToLeftAction",Fs.register(Tn.NAME,Tn);class yn extends Us{constructor(t,e,r){super(t,e,r),this._doActionData=__spreadValues({},t),this._oldActionData=__spreadProps(__spreadValues({},t),{rowHeight:this.do()}),this.validate()}do(){const t=this.getWorkSheet(),e=Ol(this._doActionData.rowIndex,this._doActionData.rowHeight,t.getRowManager());return this._observers.notifyObservers({type:Ms.REDO,data:this._doActionData,action:this}),e}redo(){this.do()}undo(){const t=this.getWorkSheet(),e=Ol(this._oldActionData.rowIndex,this._oldActionData.rowHeight,t.getRowManager());return this._observers.notifyObservers({type:Ms.UNDO,data:this._oldActionData,action:this}),e}validate(){return!1}}yn.NAME="SetRowHeightAction",Fs.register(yn.NAME,yn);class Sn extends Us{constructor(t,e,r){super(t,e,r),this._doActionData=__spreadValues({},t),this.do(),this._oldActionData=__spreadValues({},t),this.validate()}do(){const t=this.getWorkSheet();Cl(this._doActionData.rowIndex,this._doActionData.rowCount,t.getRowManager()),this._observers.notifyObservers({type:Ms.REDO,data:this._doActionData,action:this})}redo(){this.do()}undo(){const t=this.getWorkSheet();Ml(this._oldActionData.rowIndex,this._doActionData.rowCount,t.getRowManager()),this._observers.notifyObservers({type:Ms.UNDO,data:this._oldActionData,action:this})}validate(){return!1}}Sn.NAME="SetRowHideAction",Fs.register(Sn.NAME,Sn);class jn extends Us{constructor(t,e,r){super(t,e,r),this._doActionData=__spreadValues({},t),this.do(),this._oldActionData=__spreadValues({},t),this.validate()}do(){const t=this.getWorkSheet();Ml(this._doActionData.rowIndex,this._doActionData.rowCount,t.getRowManager()),this._observers.notifyObservers({type:Ms.REDO,data:this._doActionData,action:this})}redo(){this.do()}undo(){const t=this.getWorkSheet();Cl(this._oldActionData.rowIndex,this._oldActionData.rowCount,t.getRowManager()),this._observers.notifyObservers({type:Ms.UNDO,data:this._oldActionData,action:this})}validate(){return!1}}jn.NAME="SetRowShowAction",Fs.register(jn.NAME,jn);const En=class extends Us{constructor(t,e,r){super(t,e,r),this._doActionData=__spreadValues({},t);const{activeRangeList:s,activeRange:l,currentCell:n}=this.do();this._oldActionData=__spreadProps(__spreadValues({},t),{activeRangeList:s,activeRange:l,currentCell:n}),this.validate()}do(){const{activeRangeList:t,activeRange:e,currentCell:r}=this._doActionData,s=Nl(this.getWorkSheet(),t,e,r);return this._observers.notifyObservers({type:Ms.REDO,data:this._doActionData,action:this}),s}redo(){const{sheetId:t}=this._doActionData,{activeRangeList:e,activeRange:r,currentCell:s}=this.do();this._oldActionData={actionName:En.NAME,sheetId:t,activeRangeList:e,activeRange:r,currentCell:s}}undo(){const{activeRangeList:t,activeRange:e,currentCell:r,sheetId:s}=this._oldActionData,l=Nl(this.getWorkSheet(),t,e,r);this._doActionData={actionName:En.NAME,sheetId:s,activeRangeList:l.activeRangeList,activeRange:l.activeRange,currentCell:l.currentCell},this._observers.notifyObservers({type:Ms.UNDO,data:this._oldActionData,action:this})}validate(){return!1}};let Yn=En;Yn.NAME="SetSelectionActivateAction",Fs.register(Yn.NAME,Yn);class Rn extends Us{constructor(t,e,r){super(t,e,r),this._doActionData=__spreadValues({},t),this._oldActionData=__spreadProps(__spreadValues({},t),{order:this.do()}),this.validate()}do(){const t=kl(this.getWorkSheet().getContext().getWorkBook(),this._doActionData.sheetId,this._doActionData.order);return this._observers.notifyObservers({type:Ms.REDO,data:this._doActionData,action:this}),t}redo(){this.do()}undo(){kl(this.getWorkSheet().getContext().getWorkBook(),this._oldActionData.sheetId,this._oldActionData.order),this._observers.notifyObservers({type:Ms.UNDO,data:this._oldActionData,action:this})}validate(){return!1}}Rn.NAME="SetSheetOrderAction",Fs.register(Rn.NAME,Rn);const In=class extends Us{constructor(t,e,r){super(t,e,r),this._doActionData=__spreadValues({},t),this._oldActionData=__spreadProps(__spreadValues({},t),{color:this.do()}),this.validate()}do(){const t=Dl(this.getWorkSheet(),this._doActionData.color);return this._observers.notifyObservers({type:Ms.REDO,data:this._doActionData,action:this}),t}redo(){const{sheetId:t}=this._doActionData;this._oldActionData={sheetId:t,actionName:In.NAME,color:this.do()}}undo(){const{color:t,sheetId:e}=this._oldActionData,r=this.getWorkSheet();this._doActionData={actionName:In.NAME,sheetId:e,color:Dl(r,t)},this._observers.notifyObservers({type:Ms.UNDO,data:this._oldActionData,action:this})}validate(){return!1}};let An=In;An.NAME="SetTabColorAction",Fs.register(An.NAME,An);const xn=class extends Us{constructor(t,r,s){super(t,r,s),this._doActionData=__spreadValues({},t);const{oldSheetId:l,status:n}=this.do();this._oldActionData=__spreadProps(__spreadValues({},t),{sheetId:l,status:n}),this.validate(),this.removeOperation(e.SERVER_ACTION)}do(){const{sheetId:t,status:e}=this._doActionData,r=Ll(this._workbook.getSheetBySheetId(t));return this._observers.notifyObservers({type:Ms.REDO,data:this._doActionData,action:this}),r}redo(){const{oldSheetId:t,status:e}=this.do();this._oldActionData={actionName:xn.NAME,sheetId:t,status:e}}undo(){const{sheetId:t}=this._oldActionData;this._oldActionData.status;const e=this._workbook.getSheetBySheetId(t);if(e){const{oldSheetId:t,status:r}=Ll(e);this._doActionData={actionName:xn.NAME,sheetId:t,status:r},this._observers.notifyObservers({type:Ms.UNDO,data:this._oldActionData,action:this})}}validate(){return!1}};let On=xn;On.NAME="SetWorkSheetActivateAction",Fs.register(On.NAME,On);const Nn=class extends Us{constructor(t,e,r){super(t,e,r),this._doActionData=__spreadValues({},t),this._oldActionData=__spreadProps(__spreadValues({},t),{hidden:this.do()}),this.validate()}do(){const t=sl(this.getWorkSheet(),this._doActionData.hidden);return this._observers.notifyObservers({type:Ms.REDO,data:this._doActionData,action:this}),t}redo(){const{sheetId:t}=this._doActionData;this._oldActionData={sheetId:t,actionName:Nn.NAME,hidden:this.do()}}undo(){const{hidden:t,sheetId:e}=this._oldActionData,r=this.getWorkSheet();this._doActionData={actionName:Nn.NAME,sheetId:e,hidden:sl(r,t)},this._observers.notifyObservers({type:Ms.UNDO,data:this._oldActionData,action:this})}validate(){return!1}};let kn=Nn;kn.NAME="SetWorkSheetHideAction",Fs.register(kn.NAME,kn);const Mn=class extends Us{constructor(t,e,r){super(t,e,r),this._doActionData=__spreadValues({},t),this._oldActionData=__spreadProps(__spreadValues({},t),{sheetName:this.do()}),this.validate()}do(){const t=Pl(this.getWorkSheet(),this._doActionData.sheetName);return this._observers.notifyObservers({type:Ms.REDO,data:this._doActionData,action:this}),t}redo(){const{sheetId:t}=this._doActionData;this._oldActionData={sheetId:t,actionName:Mn.NAME,sheetName:this.do()}}undo(){const{sheetName:t,sheetId:e}=this._oldActionData,r=this.getWorkSheet();this._doActionData={actionName:Mn.NAME,sheetId:e,sheetName:Pl(r,t)},this._observers.notifyObservers({type:Ms.UNDO,data:this._oldActionData,action:this})}validate(){return!1}};let Dn=Mn;Dn.NAME="SetWorkSheetNameAction",Fs.register(Dn.NAME,Dn);class Ln extends Us{constructor(t,e,r){super(t,e,r),this._doActionData=__spreadValues({},t),this._oldActionData=__spreadProps(__spreadValues({},t),{sheetStatus:this.do()}),this.validate()}do(){const t=Hl(this.getWorkSheet(),this._doActionData.sheetStatus);return this._observers.notifyObservers({type:Ms.REDO,data:this._doActionData,action:this}),t}redo(){const{sheetId:t}=this._doActionData;this._oldActionData={sheetId:t,actionName:mt.SET_WORKSHEET_STATUS_ACTION,sheetStatus:this.do()}}undo(){const{sheetStatus:t,sheetId:e}=this._oldActionData,r=this.getWorkSheet();this._doActionData={actionName:mt.SET_WORKSHEET_STATUS_ACTION,sheetId:e,sheetStatus:Hl(r,t)},this._observers.notifyObservers({type:Ms.UNDO,data:this._oldActionData,action:this})}validate(){return!1}}Ln.NAME="SetWorkSheetStatusAction",Fs.register(Ln.NAME,Ln);class Pn extends Us{constructor(t,e,r){super(t,e,r),this._doActionData=__spreadValues({},t),this._oldActionData=__spreadProps(__spreadValues({},t),{zoom:this.do()}),this.validate()}redo(){const t=Fl(this.getWorkBook(),this._doActionData.sheetId,this._doActionData.zoom);return this._observers.notifyObservers({type:Ms.REDO,data:this._doActionData,action:this}),t}do(){return this.redo()}undo(){Fl(this.getWorkBook(),this._oldActionData.sheetId,this._oldActionData.zoom),this._observers.notifyObservers({type:Ms.REDO,data:this._oldActionData,action:this})}validate(){return!1}}Pn.NAME="SetZoomRatioAction",Fs.register(Pn.NAME,Pn);class Hn extends s{constructor(t,e,r){if(super(t,r),null==e.DocumentUnit)throw new Error("action document domain can not be null!");this._document=e.DocumentUnit}getDocument(){return this._document}}function Fn(t,e=!1){return e?t-1:t}function Un(t,e,r){return t.slice(0,e)+r+t.slice(e)}function zn(t,e){let r=t.body;if(e){const{headers:s,footers:l}=t;(null==s?void 0:s[e])?r=s[e].body:(null==l?void 0:l[e])&&(r=l[e].body)}return r}function Wn(t,e){var r,s;if(s=e,!(!(r=t).ts||!s.ts)&&Os(r.ts,s.ts))return t.ct+=e.ct||"",t}function Vn(t,e,r,s){const l=t.getSnapshot(),{segmentId:n}=s,o=zn(l,n);if(0===r)return;if(null==o)throw new Error("no body has changed");const{blockElements:i}=o;for(let a of i){if(null==a)continue;const{blockType:t}=a;switch(t){case E.PARAGRAPH:a.paragraph&&Gn(e,r,a,a.paragraph,s)}}}function Gn(t,e,r,s,l){const{st:n,ed:o}=r,{cursorStart:i,isStartBack:a,segmentId:g}=l,c=Fn(i,a);if(c>o||null==s)return;const{elements:b}=s;let h=0;for(let d of b){const{et:r}=d;if(r===D.DRAWING){h++;continue}const{st:s,ed:l,tr:n}=d;if(null!=n&&n.tab!==_e.TRUE){if(cl)h++;else if(console.log("paragraphApply",c,s,l,d,cl),r===D.TEXT_RUN){let r=c-s+1;if(r<=0&&(r=0),t instanceof Object)b[h+1],Xn(t,e,r,d);else{const e=Un(n.ct||"",r,t);n.ct=e,h++}}}else h++}}function Xn(t,e,r,s,l){const n=t.length;t[0],t[n-1];const{st:o,ed:i,tr:a}=s,g=(null==a?void 0:a.ct)||"";(1===n||n>1)&&(g.slice(0,r),g.slice(r))}function Qn(t,e){const r=t.getSnapshot(),{segmentId:s}=e,l=zn(r,s);if(null==l)throw new Error("no body has changed");const{blockElements:n}=l;for(let o of n){if(null==o)continue;const{blockType:t}=o;switch(t){case E.PARAGRAPH:o.paragraph&&Kn(o,o.paragraph,e)}}}function Kn(t,e,r){var s,l;const{cursorStart:n,cursorEnd:o,isStartBack:i,isEndBack:a,isCollapse:g}=r,c=Fn(n,i),b=Fn(o,a),{st:h,ed:d}=t;if(n>d||or)f++;else{if(t===D.TEXT_RUN){let t=c-e+1,s=b-e+1;t<=0&&(t=0),s>=r-e-1&&(t=r-e-1);const l=(v=n.ct||"",(m=t)>(p=s)?v:(m===p&&(m-=1),v.slice(0,m)+v.slice(p)));n.ct=l}if(0===(null==(s=n.ct)?void 0:s.length))u.splice(f,1);else{const t=null==(l=u[f-1])?void 0:l.tr;if(!t){f++;continue}Wn(n,t)?u.splice(f,1):f++}}else f++}var v,m,p}var Zn,$n;($n=Zn||(Zn={})).INSERT_TEXT_ACTION_NAME="InsertTextAction",$n.DELETE_TEXT_ACTION_NAME="DeleteTextAction",$n.CLEAR_TEXT_STYLE_ACTION_NAME="ClearTextStyleAction",$n.DELETE_PARAGRAPH_ACTION_NAME="DeleteParagraphAction",$n.INSERT_PARAGRAPH_ACTION_NAME="InsertParagraphAction",$n.MERGE_PARAGRAPH_ACTION_NAME="MergeParagraphAction",$n.MOVE_PARAGRAPH_ACTION_NAME="MoveParagraphAction",$n.SET_TEXT_STYLE_ACTION_NAME="SetTextStyleAction",$n.SPLIT_PARAGRAPH_ACTION_NAME="SplitParagraphAction",$n.UPDATE_DOCUMENT_STYLE_ACTION_NAME="UpdateDocumentAction",$n.UPDATE_PARAGRAPH_STYLE_ACTION_NAME="UpdateParagraphAction",$n.UPDATE_SECTION_ACTION_NAME="UpdateSectionAction",$n.DELETE_BULLET_ACTION_NAME="DeleteBulletAction",$n.DELETE_PARAGRAPH_BULLET_ACTION_NAME="DeleteParagraphBulletAction",$n.DELETE_SECTION_ACTION_NAME="DeleteSectionAction",$n.INSERT_BULLET_ACTION_NAME="InsertBulletAction",$n.INSERT_PARAGRAPH_BULLET_ACTION_NAME="InsertParagraphBulletAction",$n.INSERT_SECTION_ACTION_NAME="InsertSectionAction",$n.UPDATE_BULLET_ACTION_NAME="UpdateBulletAction",$n.UPDATE_PARAGRAPH_BULLET_ACTION_NAME="UpdateParagraphBulletAction",$n.TEXT_INDEX_ADJUST_ACTION_NAME="TextIndexAdjustAction";class qn extends Hn{constructor(t,e,r){super(t,e,r),this._doActionData=__spreadValues({},t),this.do();const{cursorStart:s,isStartBack:l,text:n,textLength:o}=t;this._oldActionData=__spreadProps(__spreadValues({},t),{actionName:Zn.DELETE_TEXT_ACTION_NAME,cursorEnd:s+o,isEndBack:l,isCollapse:!0})}redo(){this.do()}do(){const t=this.getDoActionData(),e=this.getDocument(),{text:r,cursorStart:s,isStartBack:l,textLength:n,segmentId:o}=t;Vn(e,r,n,{cursorStart:s,isStartBack:l,segmentId:o}),this._observers.notifyObservers({type:Ms.REDO,data:this._doActionData,action:this})}undo(){const t=this.getOldActionData();Qn(this.getDocument(),__spreadValues({},t)),this._observers.notifyObservers({type:Ms.UNDO,data:this._oldActionData,action:this})}validate(){return!1}}qn.NAME="InsertTextAction",Fs.register(qn.NAME,qn);class Jn extends Hn{constructor(t,e,r){super(t,e,r),this._doActionData=__spreadValues({},t),this.do();const{text:s,cursorStart:l,isStartBack:n,textLength:o,segmentId:i}=t;this._oldActionData={actionName:Zn.INSERT_TEXT_ACTION_NAME,text:s,textLength:o,cursorStart:l,isStartBack:n,segmentId:i}}redo(){this.do()}do(){const t=this.getDoActionData(),e=this.getDocument(),{cursorStart:r,cursorEnd:s,isStartBack:l,isEndBack:n,isCollapse:o,segmentId:i}=t;Qn(e,{cursorStart:r,cursorEnd:s,isStartBack:l,isEndBack:n,isCollapse:o,segmentId:i})}undo(){const t=this.getOldActionData(),e=this.getDocument(),{text:r,textLength:s,cursorStart:l,isStartBack:n,segmentId:o}=t;Vn(e,r,s,{cursorStart:l,isStartBack:n,segmentId:o})}validate(){return!1}}function to(t,e){const{segmentId:r}=e;let s=zn(t.getSnapshot(),r);if(null==s)throw new Error("no body has changed");const{blockElements:l}=s;let n=null;for(let o of l){if(null==o)continue;const{blockType:t}=o;switch(t){case E.PARAGRAPH:o.paragraph&&eo(o,o.paragraph,e,n),n=o}}}function eo(t,e,r,s){const{cursorStart:l,cursorEnd:n,isCollapse:o,isEndBack:i,isStartBack:a}=r,{st:g,ed:c}=t;if(l>c)return;const{elements:b}=e,h=s?s.ed:-1;if(n{!function(t,e=0){null!=t&&(t.st+=e,t.ed+=e)}(t,e)}))}else{let e=h+1,r=e;ro(b,(t=>{const{tr:e}=t,s=(null==e?void 0:e.ct)||"";t.st=r,t.ed=r+s.length-1,r=t.ed+1})),t.st=e,t.ed=r-1}}function ro(t,e){for(let r of t){const{et:t}=r;t!==D.DRAWING&&e(r)}}Jn.Name="DeleteTextAction",Fs.register(Jn.Name,Jn);class so extends Hn{constructor(t,e,r){super(t,e,r),this._doActionData=__spreadValues({},t),this.do(),this._oldActionData=__spreadValues({},t)}redo(){this.do()}do(){const t=this.getDoActionData();to(this.getDocument(),t),this._observers.notifyObservers({type:Ms.REDO,data:this._doActionData,action:this})}undo(){const t=this.getOldActionData();to(this.getDocument(),t),this._observers.notifyObservers({type:Ms.UNDO,data:this._oldActionData,action:this})}validate(){return!1}}so.Name="TextIndexAdjustAction",Fs.register(so.Name,so);class lo{constructor(t){this._name=t,this._observeNames=[]}onCreate(t){this.context=t}load(t){}save(){return Object()}onMounted(t){}onDestroy(){this.deleteObserve(...this._observeNames)}getPluginName(){return this._name}getContext(){return this.context}getGlobalContext(){return this.context.getUniver().getGlobalContext()}getLocale(){return this.getGlobalContext().getLocale()}getUniver(){return this.context.getUniver()}getObserver(t){return this.context.getObserverManager().getObserver(t,this._name)}getPluginByName(t){return this.context.getPluginManager().getPluginByName(t)}pushToObserve(...t){const e=this.context.getObserverManager();t.forEach((t=>{this._observeNames.includes(t)||this._observeNames.push(t),e.addObserver(t,this._name,new o)}))}deleteObserve(...t){const e=this.context.getObserverManager();t.forEach((t=>{e.removeObserver(t,this._name)}))}}class no{constructor(t,e=[]){this._context=t,this._plugins=[],this._initialized=!0,this._plugins=this._plugins.concat(e),this._initialize()}install(t){const{_plugins:e}=this;e.push(t),t.onCreate(this._context),t.onMounted(this._context)}uninstall(t){const{_plugins:e}=this,r=e.findIndex((e=>e.getPluginName()===t));if(r>-1){const t=e.splice(r,1)[0];t&&t.onDestroy()}}setContext(t){this._context=t}getRequirePluginByName(t){for(let e=0;e{t.onCreate(this._context),t.onMounted(this._context)})))}}class oo{constructor(){this.os="",this.app_version="",this.platform="",this.device_id="",this.os_version=""}}class io{constructor(){this._hooksManager=new a,this._pluginManager=new no(this),this._environment=new oo,this._observerManager=new ks,this._initialize()}onUniver(t){const e=t.getGlobalContext();this._univer=t,this._undoManager=e.getUndoManager(),this._commandManager=e.getCommandManager()}getHook(t){return this._hooksManager.getHooks(t)}getHooksManager(){return this._hooksManager}getObserverManager(){return this._observerManager}getPluginManager(){return this._pluginManager}getUndoManager(){return this._undoManager}getCommandManager(){return this._commandManager}getUniver(){return this._univer}_initialize(){this._undoManager=new Ws,this._commandManager=new Fs(this)}}class ao extends io{constructor(t={}){super(),this._locale=new ss,this._locale.initialize(),null==t.id||0===t.id.length?this._univerId=B.generateRandomId(10):this._univerId=t.id}getLocale(){return this._locale}getUniverId(){return this._univerId}_setObserver(){}}class go{constructor(t,e){var r;this._context=e,this._snapshot=__spreadValues(__spreadValues({},Me),t),this._unitId=null!=(r=this._snapshot.id)?r:B.generateRandomId(6)}getSnapshot(){return this._snapshot}getUnitId(){return this._unitId}insertText(t,e,r){const{_context:s}=this,l=s.getCommandManager(),n=__spreadProps(__spreadValues({actionName:Zn.INSERT_TEXT_ACTION_NAME},e),{text:t,segmentId:r}),o=new zs({DocumentUnit:this},n,this._addTextIndexAdustAction(e,r));return l.invoke(o),this}deleteText(t,e){const{_context:r}=this,s=r.getCommandManager(),l=this._getDeleteTextAction(t,e),n=new zs({DocumentUnit:this},...l,this._addTextIndexAdustAction(t,e));return s.invoke(n),this}updateText(t,e,r,s){const{_context:l}=this,n=l.getCommandManager(),o=[];e.length>0&&o.push(...this._getDeleteTextAction({cursorStart:r,isStartBack:!1,isCollapse:!1,cursorEnd:r+e.length,isEndBack:!1},s));const i={actionName:Zn.INSERT_TEXT_ACTION_NAME,cursorStart:r,isStartBack:!1,text:t,segmentId:s},a=new zs({DocumentUnit:this},...o,i,this._addTextIndexAdustAction({cursorStart:r,cursorEnd:r+Math.max(e.length,t.length),isCollapse:!1,isEndBack:!1,isStartBack:!1},s));return n.invoke(a),this}_addTextIndexAdustAction(t,e){const{cursorStart:r,cursorEnd:s,isCollapse:l,isEndBack:n,isStartBack:o}=t;return{actionName:Zn.TEXT_INDEX_ADJUST_ACTION_NAME,cursorStart:r,cursorEnd:s,isCollapse:l,isEndBack:n,isStartBack:o,segmentId:e}}_getDeleteTextAction(t,e){const{cursorStart:r,cursorEnd:s,isCollapse:l,isEndBack:n,isStartBack:o}=t;let i=[];return i=l?this._getDeleteTextActionCollapse(t,e):this._getDeleteTextActionRange(t,e),0===i.length?[]:i}_getDeleteTextActionCollapse(t,e){var r;const s=zn(this._snapshot,e);if(null==s)return[];const{blockElements:l}=s,{cursorStart:n,isCollapse:o,isStartBack:i}=t,a=[];let g=null,c=null,b=null;for(let h of l){if(null==h)continue;const{blockType:t,st:s,ed:l,blockId:o}=h;if(t===E.PARAGRAPH){if(n>l||ns||n=l?(c=d,t=l):f=!0,r<=n&&s>=n?(b=d,u=n):v=!1,(ls||n===s&&!i)&&!o?g.push({actionName:Zn.DELETE_PARAGRAPH_ACTION_NAME,cursorStart:r,cursorEnd:s,isCollapse:!1,isEndBack:!1,isStartBack:!0,blockId:d,blockElement:h,segmentId:e}):g.push({actionName:Zn.DELETE_TEXT_ACTION_NAME,cursorStart:t,cursorEnd:u,isCollapse:o,isEndBack:v,isStartBack:f,segmentId:e})}}return null!=c&&null!=b&&c!==b&&g.push({actionName:Zn.MERGE_PARAGRAPH_ACTION_NAME,startBlockId:c,endBlockId:b,segmentId:e,cursorStart:l,isStartBack:a}),g}}class co extends io{constructor(t={}){super(),this._document=new go(t,this)}getDocument(){return this._document}_setObserver(){}}class bo{constructor(){this._data=[]}static create(){return new bo}add(t){this._data.indexOf(t)>-1||this._data.push(t)}delete(t){const e=this._data.indexOf(t);this._data.splice(e,1)}getData(){return this._data}}class ho{constructor(){this._data=new Map}static create(){return new ho}add(t,e){this._data.has(t)||this._data.set(t,e)}delete(t){this._data.delete(t)}getData(){return this._data}}class uo{install(t){t.addObserver("onAfterSetSelectionObservable","core",new o),t.addObserver("onBeforeChangeNameObservable","core",new o),t.addObserver("onAfterChangeNameObservable","core",new o),t.addObserver("onBeforeChangeActiveSheetObservable","core",new o),t.addObserver("onAfterChangeActiveSheetObservable","core",new o),t.addObserver("onBeforeChangeSheetNameObservable","core",new o),t.addObserver("onAfterChangeSheetNameObservable","core",new o),t.addObserver("onBeforeInsertSheetObservable","core",new o),t.addObserver("onAfterInsertSheetObservable","core",new o),t.addObserver("onBeforeRemoveSheetObservable","core",new o),t.addObserver("onAfterRemoveSheetObservable","core",new o),t.addObserver("onBeforeChangeSheetColorObservable","core",new o),t.addObserver("onAfterChangeSheetColorObservable","core",new o),t.addObserver("onBeforeChangeSheetDataObservable","core",new o),t.addObserver("onAfterChangeSheetDataObservable","core",new o),t.addObserver("onSheetBarDidMountObservable","core",new o),t.addObserver("onInfoBarDidMountObservable","core",new o),t.addObserver("onRightMenuDidMountObservable","core",new o),t.addObserver("onAfterChangeSheetScrollObservable","core",new o),t.addObserver("onSheetRenderDidMountObservable","core",new o),t.addObserver("onHideSheetObservable","core",new o),t.addObserver("onShowSheetObservable","core",new o),t.addObserver("onSheetTabColorChangeObservable","core",new o),t.addObserver("onSheetOrderObservable","core",new o),t.addObserver("onZoomRatioSheetObservable","core",new o)}}class fo extends io{constructor(t={}){super(),this._setObserver(),this._genname=new os,this._workbook=new Yr(t,this)}getWorkBook(){return this._workbook}getGenName(){return this._genname}onUniver(t){super.onUniver(t),this._workbook.onUniver(t)}getContextObserver(t){return this.getObserverManager().requiredObserver(t,"core")}refreshWorkbook(t={}){this._workbook=new Yr(t,this)}_setObserver(){const t=this.getObserverManager();(new uo).install(t)}_initialize(){}}class vo{constructor(t,e){var r;this._context=e,this._snapshot=__spreadValues(__spreadValues({},De),t),this._unitId=null!=(r=this._snapshot.id)?r:B.generateRandomId(6)}getSnapshot(){return this._snapshot}getUnitId(){return this._unitId}getPages(){var t;return null==(t=this._snapshot.body)?void 0:t.pages}getPageOrder(){var t;return null==(t=this._snapshot.body)?void 0:t.pageOrder}getPage(t){const e=this.getPages();return null==e?void 0:e[t]}getElementsByPage(t){var e;return null==(e=this.getPage(t))?void 0:e.pageElements}getElement(t,e){var r;return null==(r=this.getElementsByPage(t))?void 0:r[e]}getPageSize(){return this._snapshot.pageSize}addPage(){return{id:"cover_1",pageType:Ve.SLIDE,zIndex:1,title:"cover",description:"this is first page, cover",pageBackgroundFill:{rgb:"rgb(255,255,255)"},pageElements:{}}}}class mo extends io{constructor(t={}){super(),this._slide=new vo(t,this)}getSlide(){return this._slide}_setObserver(){}}const po="dev",_o="0.0.1";class Bo{constructor(t={}){this.univerDocConfig=t,this._context=new co(t)}get context(){return this._context}static newInstance(t={}){return ls.capsule(po,_o,"powered by :: UniverDoc :: "),new Bo(t)}static get(t){return Xr(__spreadProps(__spreadValues({},t),{type:"GET"}))}static post(t){return Xr(__spreadProps(__spreadValues({},t),{type:"POST"}))}getUnitId(){return this._context.getDocument().getUnitId()}installPlugin(t){this._context.getPluginManager().install(t)}uninstallPlugin(t){this._context.getPluginManager().uninstall(t)}}class Co{constructor(t={}){this.univerSheetConfig=t,this._context=new fo(t)}get context(){return this._context}static newInstance(t={}){return ls.capsule(po,_o,"powered by :: universheet :: "),new Co(t)}static get(t){return Xr(__spreadProps(__spreadValues({},t),{type:"GET"}))}static post(t){return Xr(__spreadProps(__spreadValues({},t),{type:"POST"}))}static load(t,e){t.getWorkBook().load(e.workbookConfig),t.context.getPluginManager().getPlugins().forEach((t=>{t.load(e[`${t.getPluginName()}Config`])}))}static newColor(){return new $e}static toJson(t){const e=t.getWorkBook().save(),r={};return t.context.getPluginManager().getPlugins().forEach((t=>{r[`${t.getPluginName()}Config`]=t.save()})),__spreadValues({workbookConfig:e},r)}getUnitId(){return this.getWorkBook().getUnitId()}installPlugin(t){this._context.getPluginManager().install(t)}uninstallPlugin(t){this._context.getPluginManager().uninstall(t)}getWorkBook(){return this._context.getWorkBook()}refreshWorkbook(t={}){this._context.refreshWorkbook(t)}}class wo{constructor(t={}){this.UniverSlideConfig=t,this._context=new mo(t)}get context(){return this._context}static newInstance(t={}){return ls.capsule(po,_o,"powered by :: UniverSlide :: "),new wo(t)}static get(t){return Xr(__spreadProps(__spreadValues({},t),{type:"GET"}))}static post(t){return Xr(__spreadProps(__spreadValues({},t),{type:"POST"}))}static newColor(){return new $e}installPlugin(t){this._context.getPluginManager().install(t)}uninstallPlugin(t){this._context.getPluginManager().uninstall(t)}}class To{constructor(t={}){this._univerSheets=[],this._univerDocs=[],this._univerSlides=[],this._context=new ao(t),this._context.onUniver(this)}addUniverSheet(t){t.context.onUniver(this),this._univerSheets.push(t)}addUniverDoc(t){t.context.onUniver(this),this._univerDocs.push(t)}addUniverSlide(t){t.context.onUniver(this),this._univerSlides.push(t)}getUniverSheetInstance(t){return this._univerSheets.find((e=>e.getUnitId()===t))}getUniverDocInstance(t){return this._univerDocs.find((e=>e.getUnitId()===t))}getUniverSlideInstance(t){return null}getAllUniverSheetsInstance(){return this._univerSheets}getAllUniverDocsInstance(){return this._univerDocs}getAllUniverSlidesInstance(){return this._univerSlides}getCurrentUniverSheetInstance(){return this._univerSheets[0]}getCurrentUniverDocInstance(){return this._univerDocs[0]}getCurrentUniverSlideInstance(){return this._univerSlides[0]}getGlobalContext(){return this._context}install(t){this._context.getPluginManager().install(t)}uninstall(t){this._context.getPluginManager().uninstall(t)}} /*! ***************************************************************************** Copyright (C) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use @@ -20,21 +20,21 @@ var __defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnP See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. - ***************************************************************************** */var wo,To;function yo(t){return"function"==typeof t}function So(t){return null!=t}function jo(t){return null==t}To=wo||(wo={}),function(t){var e="object"==typeof or?or:"object"==typeof self?self:"object"==typeof this?this:Function("return this;")(),r=s(To);function s(t,e){return function(r,s){"function"!=typeof t[r]&&Object.defineProperty(t,r,{configurable:!0,writable:!0,value:s}),e&&e(r,s)}}void 0===e.Reflect?e.Reflect=To:r=s(e.Reflect,r),function(t){var e=Object.prototype.hasOwnProperty,r="function"==typeof Symbol,s=r&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",l=r&&void 0!==Symbol.iterator?Symbol.iterator:"@@iterator",n="function"==typeof Object.create,o={__proto__:[]}instanceof Array,i=!n&&!o,a={create:n?function(){return st(Object.create(null))}:o?function(){return st({__proto__:null})}:function(){return st({})},has:i?function(t,r){return e.call(t,r)}:function(t,e){return e in t},get:i?function(t,r){return e.call(t,r)?t[r]:void 0}:function(t,e){return t[e]}},g=Object.getPrototypeOf(Function),c="object"==typeof process&&process.env&&"true"===process.env.REFLECT_METADATA_USE_MAP_POLYFILL,b=c||"function"!=typeof Map||"function"!=typeof Map.prototype.entries?tt():Map,h=c||"function"!=typeof Set||"function"!=typeof Set.prototype.entries?et():Set,d=new(c||"function"!=typeof WeakMap?rt():WeakMap);function u(t,e,r,s){if(k(r)){if(!W(t))throw new TypeError;if(!G(e))throw new TypeError;return y(t,e)}if(!W(t))throw new TypeError;if(!L(e))throw new TypeError;if(!L(s)&&!k(s)&&!M(s))throw new TypeError;return M(s)&&(s=void 0),S(t,e,r=z(r),s)}function f(t,e){function r(r,s){if(!L(r))throw new TypeError;if(!k(s)&&!X(s))throw new TypeError;A(t,e,r,s)}return r}function v(t,e,r,s){if(!L(r))throw new TypeError;return k(s)||(s=z(s)),A(t,e,r,s)}function m(t,e,r){if(!L(e))throw new TypeError;return k(r)||(r=z(r)),E(t,e,r)}function p(t,e,r){if(!L(e))throw new TypeError;return k(r)||(r=z(r)),Y(t,e,r)}function _(t,e,r){if(!L(e))throw new TypeError;return k(r)||(r=z(r)),R(t,e,r)}function B(t,e,r){if(!L(e))throw new TypeError;return k(r)||(r=z(r)),I(t,e,r)}function C(t,e){if(!L(t))throw new TypeError;return k(e)||(e=z(e)),x(t,e)}function w(t,e){if(!L(t))throw new TypeError;return k(e)||(e=z(e)),O(t,e)}function T(t,e,r){if(!L(e))throw new TypeError;k(r)||(r=z(r));var s=j(e,r,!1);if(k(s))return!1;if(!s.delete(t))return!1;if(s.size>0)return!0;var l=d.get(e);return l.delete(r),l.size>0||d.delete(e),!0}function y(t,e){for(var r=t.length-1;r>=0;--r){var s=(0,t[r])(e);if(!k(s)&&!M(s)){if(!G(s))throw new TypeError;e=s}}return e}function S(t,e,r,s){for(var l=t.length-1;l>=0;--l){var n=(0,t[l])(e,r,s);if(!k(n)&&!M(n)){if(!L(n))throw new TypeError;s=n}}return s}function j(t,e,r){var s=d.get(t);if(k(s)){if(!r)return;s=new b,d.set(t,s)}var l=s.get(e);if(k(l)){if(!r)return;l=new b,s.set(e,l)}return l}function E(t,e,r){if(Y(t,e,r))return!0;var s=J(e);return!M(s)&&E(t,s,r)}function Y(t,e,r){var s=j(e,r,!1);return!k(s)&&F(s.has(t))}function R(t,e,r){if(Y(t,e,r))return I(t,e,r);var s=J(e);return M(s)?void 0:R(t,s,r)}function I(t,e,r){var s=j(e,r,!1);if(!k(s))return s.get(t)}function A(t,e,r,s){j(r,s,!0).set(t,e)}function x(t,e){var r=O(t,e),s=J(t);if(null===s)return r;var l=x(s,e);if(l.length<=0)return r;if(r.length<=0)return l;for(var n=new h,o=[],i=0,a=r;i=0&&t=this._keys.length?(this._index=-1,this._keys=e,this._values=e):this._index++,{value:r,done:!1}}return{value:void 0,done:!0}},t.prototype.throw=function(t){throw this._index>=0&&(this._index=-1,this._keys=e,this._values=e),t},t.prototype.return=function(t){return this._index>=0&&(this._index=-1,this._keys=e,this._values=e),{value:t,done:!0}},t}();return function(){function e(){this._keys=[],this._values=[],this._cacheKey=t,this._cacheIndex=-2}return Object.defineProperty(e.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),e.prototype.has=function(t){return this._find(t,!1)>=0},e.prototype.get=function(t){var e=this._find(t,!1);return e>=0?this._values[e]:void 0},e.prototype.set=function(t,e){var r=this._find(t,!0);return this._values[r]=e,this},e.prototype.delete=function(e){var r=this._find(e,!1);if(r>=0){for(var s=this._keys.length,l=r+1;l{const e=Object.keys(t);for(const s of e){const e=t[s];this.getBaseClassByInstance(e)&&(r(e),Io.postDestroy(t))}Io.postDestroy(t)};So(e)&&r(e),this._instance.delete(t)}addMapping(t,e,r){this._mappings.set(t,e),So(r)&&this._configure.set(t,r)}addSingletonMapping(t,e){return this.addMapping(t,e,{scope:Ao.singleton})}addClass(t,e){this.addMapping(t.name,t,e)}removeClass(t){this.removeMapping(t.name)}addSingletonClass(t){this.addSingletonMapping(t.name,t)}_inject(t,e){const r=Object.getPrototypeOf(t),s=Yo.getTable(r);for(const l of s){const s=Reflect.getMetadata("Container",r,l),n=Reflect.getMetadata("Inject",r,l),o=Reflect.getMetadata("Attribute",r,l),i=Reflect.getMetadata("AttributeValue",r,l);switch(typeof n){case"string":t[l]=this._getInstance(n,e,Ao.nothing,[]);break;case"object":{const r=n,{mapping:s}=r,{scope:o}=r,{argument:i}=r;t[l]=this._getInstance(s,e,o,i)}}if(s){t[l]=this}if(o){t[l]=this._attribute}if(i){t[l]=this._attribute.getValue()}}}_getInstance(t,e,r,s){const l=this._mappings.get(t);if(l){if(r===Ao.nothing){const e=this._configure.get(t);r=e?e.scope:Ao.prototype}switch(r){case Ao.singleton:{const n=this._instance.get(t);if(So(n))return n;const o=So(s)?new l(...s):new l;return this._instance.set(t,o),this._addCirculate(t,r),this._inject(o,e),this._popCirculate(),e.push([o,s]),o}case Ao.prototype:{const n=So(s)?new l(...s):new l;return this._addCirculate(t,r),this._inject(n,e),this._popCirculate(),e.push([n,s]),n}}}}_printCirculate(){let t="The dependencies of some of the instance in the application context form a cycle:";return t+="\n",this._circulate.reverse().forEach((e=>{const{baseClass:r}=e,s=this._mappings.get(r),{name:l}=s;t+="\n",t+=`Class: ${l} Field: ${r}`})),t}_clearCirculate(){this._circulate=[]}_addCirculate(t,e){this._circulate.forEach((r=>{if(r.baseClass===t&&r.scope===e&&e===Ao.prototype)throw this._circulate.push({baseClass:t,scope:e}),new Error(this._printCirculate())})),this._circulate.push({baseClass:t,scope:e})}_popCirculate(){this._circulate.pop()}}var Ao,xo;function Oo(){return(t,e,r)=>{Yo.register(t,e),Reflect.defineMetadata("PostConstruct",r,t,e)}}function No(){return(t,e)=>{Yo.register(t,e),Reflect.defineMetadata("AttributeValue",{},t,e)}}(xo=Ao||(Ao={}))[xo.singleton=0]="singleton",xo[xo.prototype=1]="prototype",xo[xo.nothing=2]="nothing";const ko="MessageQueue";class Mo{constructor(){this.load()}first(){return this._messages[0]}last(){return this._messages[this._messages.length-1]}size(){return this._messages.length}pop(){this._messages.shift(),this.save()}push(t){this._messages.push(t),this.save()}hasMessage(){return this._messages.length>0}isEmpty(){return!this.hasMessage()}save(){const t=JSON.stringify(this._messages);localStorage.setItem(ko,t)}load(){const t=localStorage.getItem(ko);t&&(this._messages=JSON.parse(t))}}var Do;(Do||(Do={})).MESSAGE_RESPONSE="message_response";class Lo{static isMessageResponseReceive(t){return t.type===Do.MESSAGE_RESPONSE}packMessage(t){return{changed:t,version:B.generateRandomId(6)}}}var Po,Ho,Fo=Object.defineProperty,Uo=Object.getOwnPropertyDescriptor,zo=(t,e,r,s)=>{for(var l,n=s>1?void 0:s?Uo(e,r):e,o=t.length-1;o>=0;o--)(l=t[o])&&(n=(s?l(e,r,n):l(n))||n);return s&&n&&Fo(e,r,n),n};(Ho=Po||(Po={})).WAIT="wait",Ho.WORK="work";const Wo=class extends Lo{initialize(){this.messageQueue=new Mo,this.status=Po.WAIT,this.globalSendResolve=()=>{},this.config.socketEnable&&(this.socket=new qr({url:this.config.socketUrl}),this.socket.on(Qr.MESSAGE,(t=>{this.checkupReceiveMessage(t.data)})),this.socket.on(Qr.ERROR,(()=>{})),this.socket.on(Qr.OPEN,(()=>{})),this.socket.on(Qr.CLOSE,(()=>{})),this.socket.on(Qr.RETRY,(()=>{})),this.socket.on(Qr.DESTROY,(()=>{})),this.socket.link())}pushMessageQueue(t){this.config.socketEnable&&(this.messageQueue.push(this.packMessage(t)),this.sendMessageQueue())}getTopMessage(){return this.messageQueue.first()}popTopMessage(){this.messageQueue.pop()}serializeTopMessage(){var t;const e=this.getTopMessage();return null!=(t=JSON.stringify(e))?t:""}checkupReceiveMessage(t){Wo.isMessageResponseReceive(t)&&this.getTopMessage().version===t.message.version&&(this.popTopMessage(),this.globalSendResolve())}async sendTopMessage(){const t=this.serializeTopMessage();return this.socket.send(t),new Promise((t=>this.globalSendResolve=t))}async sendMessageQueue(){const{messageQueue:t,status:e}=this;if(e===Po.WAIT){for(this.status=Po.WORK;t.hasMessage();)await this.sendTopMessage();this.status=Po.WAIT}return this.status}};let Vo=Wo;zo([No()],Vo.prototype,"config",2),zo([Oo()],Vo.prototype,"initialize",1);var Go=Object.freeze(Object.defineProperty({__proto__:null,get ActionOperationType(){return e},ActionBase:s,get ActionType(){return ks},ActionObservers:Ds,CommandInjectorObservers:Ls,CommandObservers:Ps,CommandManager:Hs,SheetActionBase:Fs,CommandUnit:class{},Command:Us,UndoManager:zs,ActionExtensionManager:Ws,BaseActionExtension:Vs,BaseActionExtensionFactory:Gs,REGISTRY_ACTION_FACTORY:Qs,ActionExtensionRegister:Ks,ActionOperation:Zs,ContextBase:no,Context:oo,DocContext:ao,Environment:lo,Registry:go,RegistryAsMap:co,SheetContext:ho,SlideContext:fo,UniverDoc:po,UniverSheet:_o,UniverSlide:Bo,Univer:Co,VersionEnv:vo,VersionCode:mo,WorkBookObserverImpl:bo,get ACTION_NAMES(){return mt},DEFAULT_RANGE_ARRAY:Re,DEFAULT_RANGE:Ie,DEFAULT_SELECTION:Ae,DEFAULT_CELL:xe,DEFAULT_WORKBOOK:Oe,DEFAULT_WORKSHEET:Ne,DEFAULT_STYLES:ke,DEFAULT_DOC:Me,DEFAULT_SLIDE:De,get EXTENSION_NAMES(){return Le},KEYBOARD_KEYS:He,get PLUGIN_NAMES(){return Fe},THEME_COLORS:ze,AddMergeAction:Fl,AddNamedRangeAction:Wl,ClearRangeAction:Kl,DeleteNamedRangeAction:Ul,DeleteRangeAction:$l,InsertColumnAction:ql,InsertColumnDataAction:Jl,InsertRangeAction:Zl,InsertRowAction:tn,InsertRowDataAction:en,InsertSheetAction:rn,RemoveColumnAction:sn,RemoveColumnDataAction:ln,RemoveMergeAction:nn,RemoveRowAction:on,RemoveRowDataAction:an,RemoveSheetAction:gn,SetBorderAction:cn,SetColumnHideAction:bn,SetColumnShowAction:hn,SetColumnWidthAction:dn,SetHiddenGridlinesAction:un,SetNamedRangeAction:vn,SetRangeDataAction:Ql,SetRangeNoteAction:pn,SetRangeStyleAction:Bn,SetRangeFormattedValueAction:Cn,SetRightToLeftAction:wn,SetRowHeightAction:Tn,SetRowHideAction:yn,SetRowShowAction:Sn,SetSelectionActivateAction:En,SetSheetOrderAction:Yn,SetTabColorAction:In,SetWorkSheetActivateAction:xn,SetWorkSheetHideAction:Nn,SetWorkSheetNameAction:Mn,SetWorkSheetStatusAction:Dn,SetZoomRatioAction:Ln,Color:qe,HLSColor:Je,RgbColor:er,ThemeColor:sr,ColorBuilder:$e,ColumnManager:lr,Merges:nr,Range:Sr,RangeList:wr,RowManager:Tr,Selection:Rr,Styles:jr,Workbook:Yr,Worksheet:yr,addMerge:function(t,e){for(let r=0;rr.namedRangeId===e?(t.splice(s,1),r):null))},DeleteNamedRangeApply:tl,DeleteRange:function(t,e,r,s){const{startRow:l,endRow:n,startColumn:o,endColumn:i}=s,a=n-l+1,g=i-o+1,c=t.rowCount,b=t.columnCount,h=new v;if(r===Dt.ROWS)for(let d=l;d<=c;d++)for(let t=o;t<=i;t++){if(d<=n){const r=e.getValue(d,t);h.setValue(d,t,r)}const r=e.getValue(d+a,t);if(r)e.setValue(d,t,B.deepClone(r));else{e.getValue(d,t)&&(e.deleteValue(d,t),t--)}}else if(r===Dt.COLUMNS)for(let d=l;d<=n;d++)for(let t=o;t<=b;t++){if(t<=i){const r=e.getValue(d,t);h.setValue(d,t,r)}else for(let s=0;s<=i;s++){const r=e.getValue(d,t);h.setValue(d,t+s,r)}const r=e.getValue(d,t+g);if(r)e.setValue(d,t,B.deepClone(r));else{if(e.getValue(d,t)){for(let r=0;r<=i;r++)e.deleteValue(d,t);break}}}return h.getData()},DeleteRangeApply:el,SetWorkSheetHideService:rl,SetWorkSheetHideServiceApply:function(t,e){const r=t.WorkBookUnit.getSheetBySheetId(e.sheetId).getConfig(),s=r.hidden;return r.hidden=e.hidden,s},InsertColumn:function(t=0,e=1,r){new u(r).inserts(t,new u(e))},InsertColumnApply:sl,InsertDataColumn:function(t,e,r){new v(r).insertColumns(t,new v(e))},InsertDataColumnApply:ll,InsertDataRow:function(t,e,r){new v(r).insertRows(t,new v(e))},InsertDataRowApply:nl,InsertRange:function(t,e,r,s,l){const{startRow:n,endRow:o,startColumn:i,endColumn:a}=s,g=o-n+1,c=a-i+1,b=t.rowCount,h=t.columnCount;if(r===Dt.ROWS){for(let t=b;t>=n;t--)for(let r=i;r<=a;r++){const s=e.getValue(t,r);e.setValue(t+g,r,s)}for(let t=o;t>=n;t--)for(let r=i;r<=a;r++)e.setValue(t,r,l[t-n][r-i])}else if(r===Dt.COLUMNS){for(let t=n;t<=o;t++)for(let r=h;r>=i;r--){const s=e.getValue(t,r);e.setValue(t,r+c,s)}for(let t=n;t<=o;t++)for(let r=a;r>=i;r--)e.setValue(t,r,l[t-n][r-i])}},InsertRangeApply:ol,InsertRow:function(t=0,e=1,r){new u(r).inserts(t,new u(e))},InsertRowApply:il,InsertSheet:function(t,e,r){const s=t.getWorksheets(),l=t.getConfig(),{sheets:n,sheetOrder:o}=l;if(n[r.id])throw new Error(`Insert Sheet fail ${r.id} is already exist`);return n[r.id]=r,o.splice(e,0,r.id),s.set(r.id,new yr(t.getContext(),r)),r.id},InsertSheetApply:al,RemoveColumn:function(t,e,r){const s=new u(r),l=new u,n=t+e;for(let o=t;ot===e));return delete l[e],s.sheetOrder.splice(o,1),r.delete(e),{index:o,sheet:n}},RemoveSheetApply:ul,SetBorder:function(t,e,r){const s=new v(r),l=new v;return s.forValue(((r,s,n)=>{const o=t.getValue(r,s);if(o){const t=e.get(o.s);t&&l.setValue(r,s,t),o.s=e.setValue(n)}})),l.toJSON()},SetBorderApply:fl,SetColumnHide:function(t=0,e,r){for(let s=t;sr.namedRangeId===e.namedRangeId?(t[s]=e,r):null))},SetNamedRangeApply:Cl,SetRangeDataApply:Yl,SetRangeNote:Rl,SetRangeNoteApply:function(t,e){const r=t.WorkBookUnit.getSheetBySheetId(e.sheetId).getCellMatrix(),s=e.cellNote,l=e.rangeData,n=new v(s),o=new v;for(let i=l.startRow;i<=l.endRow;i++)for(let t=l.startColumn;t<=l.endColumn;t++){const e=n.getValue(i,t),s=r.getValue(i,t),l=B.deepClone(s||{});l.n=e,r.setValue(i,t,l||{})}return o.getData()},SetRangeStyle:wl,transformStyle:Tl,transformNormalKey:yl,transformBorders:Sl,mergeStyle:jl,mergeRichTextStyle:El,SetRangeFormattedValue:Il,SetRangeFormattedValueApply:function(t,e){const r=t.WorkBookUnit.getSheetBySheetId(e.sheetId).getCellMatrix(),s=e.cellValue,l=e.rangeData,n=new v(s),o=new v;for(let i=l.startRow;i<=l.endRow;i++)for(let t=l.startColumn;t<=l.endColumn;t++){const e=n.getValue(i,t),s=r.getValue(i,t);o.setValue(i,t,s&&s.v||"");const l=B.deepClone(s||{});l.v=e,l.m=`${e}`,r.setValue(i,t,l||{})}return o.getData()},SetRightToLeft:Al,SetRightToLeftApply:function(t,e){const r=t.WorkBookUnit.getSheetBySheetId(e.sheetId),s=e.rightToLeft,l=r.getConfig(),n=l.rightToLeft;return l.rightToLeft=s,n},SetRowHeight:xl,SetRowHeightApply:function(t,e){const r=t.WorkBookUnit.getSheetBySheetId(e.sheetId),s=e.rowIndex,l=e.rowHeight,n=r.getRowManager(),o=[];for(let i=s;i{Yo.register(t,e),Reflect.defineMetadata("PreDestroy",r,t,e)}},Inject:function(t){return(e,r)=>{(Yo.register(e,r),"string"!=typeof t)?So(t)&&(jo(t.argument)&&(t.argument=[]),jo(t.scope)&&(t.scope=1),Reflect.defineMetadata("Inject",t,e,r)):Reflect.defineMetadata("Inject",t,e,r)}},Attribute:function(){return(t,e)=>{Yo.register(t,e),Reflect.defineMetadata("Attribute",{},t,e)}},Container:function(){return(t,e)=>{Yo.register(t,e),Reflect.defineMetadata("Container",{},t,e)}},AttributeValue:No,EventState:l,Observer:n,Observable:o,ObservableHooks:class extends o{add(t){if(!t)return null;const e=new n(t);return this._observers=[e],this._onObserverAdded&&this._onObserverAdded(e),e}makeObserverTopPriority(){}makeObserverBottomPriority(){}},PathObservableHooks:i,HooksManager:a,PathObservable:Os,ObserverManager:Ns,Plugin:ro,PluginManager:so,MessageQueue:Mo,get ServerReceiveType(){return Do},ServerBase:Lo,ServerHttp:class extends Lo{pushMessageQueue(t){throw new Error("Method not implemented.")}},get MessageQueueStatus(){return Po},ServerSocket:Vo,binarySearchArray:g,orderSearchArray:c,searchArray:b,makeCellToSelection:Ir,isEmptyCell:Ar,getColorStyle:xr,isFormulaString:function(t){return B.isString(t)&&0===t.indexOf("=")&&t.length>1},handleJsonToDom:Or,handleStyleToString:Nr,getBorderStyleType:Mr,DateTime:class{},DropCell:Cr,ExcelDateTime:class{},error:hr,datenum_local:mr,generate:pr,update:Br,get IOHttpRequestType(){return Hr},get IOHttpReadyState(){return Ur},get IOHttpResponseType(){return Wr},IOHttp:Xr,Post:function(t,e={},r=Lr){return Xr({url:t,type:Hr.POST,data:e,success:r})},Get:function(t,e={},r=Lr){return Xr({url:t+=function(t){if(null==t)return"";let e="";for(const r in t)t.hasOwnProperty(r)&&void 0!==t[r]&&null!==t[r]&&(e+=`${r}=${t[r]}&`);return e=e.substring(0,e.length-1),e?`?${encodeURI(e)}`:""}(e),type:Hr.GET,success:r})},get IOSocketListenType(){return Qr},HEART_BEAT_MESSAGE:$r,IOSocket:qr,isKeyPrintable:ts,Locale:ss,Logger:ls,GenName:ns,LRUHelper:os,KeyIterator:gs,ValueIterator:cs,EntryIterator:bs,Entry:hs,LRUMap:ds,migrate:fs,ObjectArray:u,ObjectArrayIterableIterator:f,ObjectMatrix:v,Rectangle:vs,referenceToGrid:function(t){const e=t.indexOf("!");let r="",s="";e>-1?(r=t.substring(0,e),s=t.substring(e)):s=t;let l=s.indexOf(":");if(-1===l){const t=_s(s),e=t.row,l=t.column;return{sheetName:r,rangeData:{startRow:e,startColumn:l,endRow:e,endColumn:l}}}const n=s.substring(0,l),o=s.substring(l+1),i=_s(n),a=_s(o);return{sheetName:r,rangeData:{startRow:i.row,startColumn:i.column,endRow:a.row,endColumn:a.column}}},ABCToNumber:function(t){if(null==t||0===t.length)return NaN;let e=t.toLowerCase().split(""),r=e.length,s=0,l=0;for(let n=0;n>>0},deepCompare:xs},Symbol.toStringTag,{value:"Module"})),Xo={renderFont:{defaultFont:"Times New Roman",fontList:["Times New Roman","Arial","Tahoma","Verdana","微软雅黑","宋体","黑体","楷体","仿宋","新宋体","华文新魏","华文行楷","华文隶书"],defaultFontSize:14,unit:"pt"}},Qo={renderFont:{defaultFont:"Times New Roman",fontList:["Times New Roman","Arial","Tahoma","Verdana"],defaultFontSize:9,unit:"pt"}};const Ko={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]};var Zo,$o,qo,Jo,ti;(Zo||(Zo={})).rect="rect",(qo=$o||($o={})).PointerMove="PointerMove",qo.PointerDown="PointerDown",qo.PointerUp="PointerUp",qo.PointerOut="PointerOut",qo.PointerLeave="PointerLeave",qo.PointerOver="PointerOver",qo.PointerEnter="PointerEnter",qo.wheel="MouseWheel",qo.KeyDown="KeyDown",qo.KeyUp="KeyUp",(ti=Jo||(Jo={}))[ti.XY=0]="XY",ti[ti.X=1]="X",ti[ti.Y=2]="Y";const ei='"Helvetica Neue", Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "Heiti SC", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif',ri={lines:[],drawings:new Map,height:0,st:0,ed:0,marginLeft:0},si=__spreadProps(__spreadValues({},ri),{marginTop:20}),li=__spreadProps(__spreadValues({},ri),{marginBottom:20}),ni=14;var oi,ii,ai,gi;(ii=oi||(oi={})).DEFAULT="default",ii.AUTO="auto",ii.CROSSHAIR="crosshair",ii.POINTER="pointer",ii.MOVE="move",ii.EAST_RESIZE="e-resize",ii.NORTH_EAST_RESIZE="ne-resize",ii.NORTH_WEST_RESIZE="nw-resize",ii.NORTH_RESIZE="n-resize",ii.SOUTH_EAST_RESIZE="se-resize",ii.SOUTH_WEST_RESIZE="sw-resize",ii.SOUTH_RESIZE="s-resize",ii.WEST_RESIZE="w-resize",ii.TEXT="text",ii.WAIT="wait",ii.HELP="help",ii.CELL="cell",ii.NONE="none",ii.VERTICAL_TEXT="vertical-text",ii.NO_DROP="no-drop",ii.GRAB="grab",ii.GRABBING="grabbing",ii.ALL_SCROLL="all-scroll",ii.COLUMN_RESIZE="col-resize",ii.ROW_RESIZE="row-resize",ii.PROGRESS="progress",ii.NOT_ALLOWED="not-allowed",ii.ZOOM_IN="zoom-in",ii.ZOOM_OUT="zoom-out",(gi=ai||(ai={}))[gi.noClip=0]="noClip",gi[gi.DOC_SIZE=1]="DOC_SIZE",gi[gi.CONTENT_SIZE_LEFT=2]="CONTENT_SIZE_LEFT",gi[gi.CONTENT_SIZE_CENTER=3]="CONTENT_SIZE_CENTER",gi[gi.CONTENT_SIZE_Right=4]="CONTENT_SIZE_Right";const ci="rgb(0,0,0)";var bi,hi,di,ui,fi,vi;(hi=bi||(bi={})).TOP="t",hi.BOTTOM="b",hi.LEFT="l",hi.RIGHT="r",(ui=di||(di={}))[ui.UP=0]="UP",ui[ui.DOWN=1]="DOWN",(vi=fi||(fi={})).ENGINE="Engine",vi.SCENE="Scene",vi.BASE_OBJECT="BaseObject",vi.SCENE_VIEWER="SceneViewer",vi.CANVAS="Canvas",vi.VIEWPORT="Viewport",vi.LAYER="Layer",vi.GROUP="Group";const mi=t=>({sbr:.5,sbo:t,spr:.5,spo:t});class pi{static get globalFontMeasureCache(){return this._globalFontMeasureCache}static setFontMeasureCache(t,e,r){this._globalFontMeasureCache.has(t)||(this._globalFontMeasureCache[t]=new Map),this._globalFontMeasureCache[t][e]=r}static clearFontMeasureCache(t){var e;const r=t.split("/");if(1===r.length){const t=r[0];this._globalFontMeasureCache.delete(t)}else{if(2!==r.length)return!1;{const t=r[0],s=r[1];null==(e=this._globalFontMeasureCache.get(t))||e.delete(s)}}return!0}static getFontMeasureCache(t,e){var r;return null==(r=this._globalFontMeasureCache[t])?void 0:r[e]}static autoCleanFontMeasureCache(t=1e6){let e=0,r=!1;for(let s of this._globalFontMeasureCache){const[,l]=s;if(e+=l.size,e>t){r=!0;break}}if(r){let e=0;for(let r of this._globalFontMeasureCache){const[s,l]=r;if(e+=l.size,e>t/2){const r=e-t/2;this._clearMeasureCache(r,l);break}this._globalFontMeasureCache.delete(s)}return!0}return!1}static getBaselineOffsetInfo(t,e){if(0===this._fontDataMap.size)return mi(e);const r=t.split(",");for(let s of r){s=s.replace(/'/g,"");const t=this._fontDataMap.get(s);if(!t)continue;const{subscriptSizeRatio:r,subscriptOffset:l,superscriptSizeRatio:n,superscriptOffset:o}=t;return{sbr:r,sbo:l*e,spr:n,spo:o*e}}return mi(e)}static getTextSizeByDom(t,e){if(e in this._getTextHeightCache)return this._getTextHeightCache[e];let r=document.getElementById("universheetTextSizeTest");r||(r=document.createElement("span"),r.id="universheetTextSizeTest",document.getElementsByTagName("body")[0].appendChild(r)),r.style.cssText+=`float:left;white-space:nowrap;visibility:hidden;margin:0;padding:0;;${e}`,r.innerText=t;const s=r.getBoundingClientRect(),l={width:s.width,height:s.height};return this._getTextHeightCache[e]=l,l}static getTextSize(t,e){const{fontString:r,fontSize:s,fontFamily:l}=e;let n=this._getBoundingBoxByFont(l,s);if(!n){const e=this.getMeasureText(t,r);n=this._calculateBoundingBoxByMeasureText(e,s)}return n}static getMeasureText(t,e){if(!this._context){const t=document.createElement("canvas");this._context=t.getContext("2d")}const r=this._context,s=this.getFontMeasureCache(e,t);if(null!=s)return s;r.font=e;const l=r.measureText(t),{width:n,fontBoundingBoxAscent:o,fontBoundingBoxDescent:i,actualBoundingBoxAscent:a,actualBoundingBoxDescent:g}=l,c={width:n,fontBoundingBoxAscent:o,fontBoundingBoxDescent:i,actualBoundingBoxAscent:a,actualBoundingBoxDescent:g};if(null==o||null==i||Number.isNaN(o)||Number.isNaN(i)){let t=this.getTextSizeByDom("0",e)[1];"top"===r.textBaseline?(c.fontBoundingBoxAscent=c.actualBoundingBoxAscent=t,c.fontBoundingBoxDescent=c.actualBoundingBoxDescent=0):"middle"===r.textBaseline?(c.fontBoundingBoxDescent=c.actualBoundingBoxDescent=t/2,c.fontBoundingBoxAscent=c.actualBoundingBoxAscent=t/2):(c.fontBoundingBoxDescent=c.actualBoundingBoxDescent=0,c.fontBoundingBoxAscent=c.actualBoundingBoxAscent=t)}return this.setFontMeasureCache(e,t,c),c}static _clearMeasureCache(t,e){let r=0;for(let s of e){const[l]=s;if(r>t)break;e.delete(l),r++}return!0}static _getBoundingBoxByFont(t,e=28,r=""){const s=this._fontDataMap.get(t);if(!s)return;const{notDefWidth:l,ascender:n,descender:o,typoAscender:i,typoDescender:a,strikeoutPosition:g,subscriptSizeRatio:c,subscriptOffset:b,superscriptSizeRatio:h,superscriptOffset:d,hdmxData:u,glyphHorizonMap:f}=s,v=null==u?void 0:u.indexOf(Math.floor(e)),m=f.get(r.charCodeAt(0));let p=l;if(m){const{width:t,pixelsPerEm:e=[]}=m;p=v?e[v]:t}return{width:p*e,ba:n*e,bd:o*e,aba:i*e,abd:a*e,sp:g*e,sbr:c,sbo:b*e,spr:h,spo:d*e}}static _calculateBoundingBoxByMeasureText(t,e){const{width:r,fontBoundingBoxAscent:s,fontBoundingBoxDescent:l,actualBoundingBoxAscent:n,actualBoundingBoxDescent:o}=t;return{width:r,ba:s,bd:l,aba:n,abd:o,sp:(s+l)/2,sbr:.5,sbo:e,spr:.5,spo:e}}}var _i,Bi,Ci,wi,Ti,yi,Si,ji,Ei,Yi,Ri,Ii,Ai,xi,Oi,Ni,ki,Mi;pi._getTextHeightCache={},pi._fontDataMap=new Map,pi._globalFontMeasureCache=new Map,(Bi=_i||(_i={}))[Bi.SPAN=0]="SPAN",Bi[Bi.DIVIDE=1]="DIVIDE",Bi[Bi.LINE=2]="LINE",Bi[Bi.COLUMN=3]="COLUMN",Bi[Bi.SECTION=4]="SECTION",Bi[Bi.PAGE=5]="PAGE",Bi[Bi.DRAWING=6]="DRAWING",Bi[Bi.BULLET=7]="BULLET",Bi[Bi.HEADER=8]="HEADER",Bi[Bi.FOOTER=9]="FOOTER",Bi[Bi.ALL=10]="ALL",(wi=Ci||(Ci={}))[wi.SECTION=0]="SECTION",wi[wi.PAGE=1]="PAGE",wi[wi.COLUMN=2]="COLUMN",(yi=Ti||(Ti={}))[yi.PARAGRAPH=0]="PARAGRAPH",yi[yi.BLOCK=1]="BLOCK",(ji=Si||(Si={}))[ji.LETTER=0]="LETTER",ji[ji.WORD=1]="WORD",ji[ji.LIST=2]="LIST",ji[ji.TAB=3]="TAB",ji[ji.IMAGE=4]="IMAGE",ji[ji.AT=5]="AT",ji[ji.MATH=6]="MATH",ji[ji.MULTI_LINE=7]="MULTI_LINE",ji[ji.CUSTOM=8]="CUSTOM",(Yi=Ei||(Ei={}))[Yi.VERTICAL=0]="VERTICAL",Yi[Yi.HORIZONTAL=1]="HORIZONTAL",Yi[Yi.AUTO=2]="AUTO",(Ii=Ri||(Ri={}))[Ii.PointerMove=0]="PointerMove",Ii[Ii.PointerDown=1]="PointerDown",Ii[Ii.PointerUp=2]="PointerUp";class Di{}Di.DOM_DELTA_PIXEL=0,Di.DOM_DELTA_LINE=1,Di.DOM_DELTA_PAGE=2,(xi=Ai||(Ai={}))[xi.Generic=0]="Generic",xi[xi.Keyboard=1]="Keyboard",xi[xi.Mouse=2]="Mouse",xi[xi.Touch=3]="Touch",(Ni=Oi||(Oi={}))[Ni.Horizontal=0]="Horizontal",Ni[Ni.Vertical=1]="Vertical",Ni[Ni.LeftClick=2]="LeftClick",Ni[Ni.MiddleClick=3]="MiddleClick",Ni[Ni.RightClick=4]="RightClick",Ni[Ni.BrowserBack=5]="BrowserBack",Ni[Ni.BrowserForward=6]="BrowserForward",Ni[Ni.MouseWheelX=7]="MouseWheelX",Ni[Ni.MouseWheelY=8]="MouseWheelY",Ni[Ni.MouseWheelZ=9]="MouseWheelZ",Ni[Ni.DeltaHorizontal=10]="DeltaHorizontal",Ni[Ni.DeltaVertical=11]="DeltaVertical",Ni[Ni.FakeMove=12]="FakeMove",(Mi=ki||(ki={}))[Mi.translate=0]="translate",Mi[Mi.resize=1]="resize",Mi[Mi.scale=2]="scale",Mi[Mi.skew=3]="skew",Mi[Mi.flip=4]="flip",Mi[Mi.all=5]="all";class Li{constructor(t=30){this._enabled=!0,this._rollingFrameTime=new Pi(t)}get averageFrameTime(){return this._rollingFrameTime.average}get averageFrameTimeVariance(){return this._rollingFrameTime.variance}get instantaneousFrameTime(){return this._rollingFrameTime.history(0)}get averageFPS(){return 1e3/this._rollingFrameTime.average}get instantaneousFPS(){let t=this._rollingFrameTime.history(0);return 0===t?0:1e3/t}get isSaturated(){return this._rollingFrameTime.isSaturated()}get isEnabled(){return this._enabled}sampleFrame(t=this.Now()){if(this._enabled){if(null!=this._lastFrameTimeMs){let e=t-this._lastFrameTimeMs;this._rollingFrameTime.add(e)}this._lastFrameTimeMs=t}}Now(){return window.performance&&window.performance.now?window.performance.now():Date.now()}enable(){this._enabled=!0}disable(){this._enabled=!1,this._lastFrameTimeMs=null}reset(){this._lastFrameTimeMs=null,this._rollingFrameTime.reset()}}class Pi{constructor(t){this._samples=new Array(t),this.reset()}add(t){let e;if(this.isSaturated()){let t=this._samples[this._pos];e=t-this.average,this.average-=e/(this._sampleCount-1),this._m2-=e*(t-this.average)}else this._sampleCount++;e=t-this.average,this.average+=e/this._sampleCount,this._m2+=e*(t-this.average),this.variance=this._m2/(this._sampleCount-1),this._samples[this._pos]=t,this._pos++,this._pos%=this._samples.length}history(t){if(t>=this._sampleCount||t>=this._samples.length)return 0;let e=this._wrapPosition(this._pos-1);return this._samples[this._wrapPosition(e-t)]}isSaturated(){return this._sampleCount>=this._samples.length}reset(){this.average=0,this.variance=0,this._sampleCount=0,this._pos=0,this._m2=0}_wrapPosition(t){let e=this._samples.length;return(t%e+e)%e}}const Hi=Math.PI/180,Fi=180/Math.PI,Ui="rgb(",zi=(t,e)=>t?null!=e?`${"rgba("+t.join(",")},${e})`:`${Ui+t.join(",")})`:"rgb(0,0,0)",Wi=(t,e)=>{if(B.isNumber(t))return t;if(e&&t&&B.isString(t)&&"%"===t.substr(t.length-1,1)){return e*(parseFloat(t)/100)}return 0},Vi=(t,e)=>(e||(e=window),e.requestPostAnimationFrame?e.requestPostAnimationFrame(t):e.requestAnimationFrame?e.requestAnimationFrame(t):e.msRequestAnimationFrame?e.msRequestAnimationFrame(t):e.webkitRequestAnimationFrame?e.webkitRequestAnimationFrame(t):e.mozRequestAnimationFrame?e.mozRequestAnimationFrame(t):e.oRequestAnimationFrame?e.oRequestAnimationFrame(t):window.setTimeout(t,16)),Gi=(t,e)=>(e||(e=window),e.requestPostAnimationFrame?e.cancelPostAnimationFrame(t):e.requestAnimationFrame?e.cancelAnimationFrame(t):e.msRequestAnimationFrame?e.msCancelAnimationFrame(t):e.webkitRequestAnimationFrame?e.webkitCancelAnimationFrame(t):e.mozRequestAnimationFrame?e.mozCancelAnimationFrame(t):e.oRequestAnimationFrame?e.oCancelAnimationFrame(t):window.clearTimeout(t)),Xi=()=>{let t=document.createElement("canvas");try{t.style=t.style||{}}catch(e){console.error(e)}return t},Qi=t=>t*Fi,Ki=t=>t*Hi,Zi=()=>{let t="pointer";return"undefined"==typeof window||window.PointerEvent||"undefined"==typeof navigator||navigator.pointerEnabled||(t="mouse"),!B.isTablet()||B.isIPhone()||document&&"ontouchend"in document||(t="mouse"),t},$i=()=>"safari"===B.getBrowserType(),qi=(t="obj",e=4)=>{let r=window.navigator.userAgent.replace(/[^a-zA-Z0-9]/g,"").split(""),s="";for(let l=0;l-1&&(e=`"${e}"`),null==e&&(e=r[0]),i=e}const{va:a}=t;if(a===me.SUBSCRIPT||a===me.SUPERSCRIPT){const t=pi.getBaselineOffsetInfo(i,o),{sbr:e,spr:r}=t;o*=a===me.SUBSCRIPT?e:r}return{fontString:`${l} ${n} ${o}px ${i}, ${ei} `,fontSize:o,fontFamily:i}}function na(t){return!!/[\u4E00-\u9FA5]|[\uFE30-\uFFA0]/gi.exec(t)}function oa(t){return!!/[一-龠]+|[ぁ-ゔ]+|[ァ-ヴー]+|[a-zA-Z0-9]+|[a-zA-Z0-9]+|[々〆〤]+/giu.exec(t)}function ia(t){return!!/[\u2E80-\uA4CF]|[\uF900-\uFAFF]|[\uFE30-\uFE4F]|[\uFF00-\uFFEF]/gi.exec(t)}function aa(t){return!!/[\u0600-\u06FF]|[\u0750-\u0750]|[\u0870-\u08FF]|[\uFB50-\uFDFF]|[\uFE70-\uFEFF]/gi.exec(t)}function ga(t){return!!/[\u0180-\u024F]/gi.exec(t)}function ca(t){return!!/\s+|\t+/g.exec(t)}let ba;function ha(){if(ba)return ba;let t=56;for(;t<2e3;t++)if(!0===matchMedia(`(max-resolution: ${t}dpi)`).matches)return t;return ba=t,setTimeout((()=>{ba=null}),1e3),t}function da(t){return t/(72/ha())}function ua(t){return t*(72/ha())}function fa(t){const{scaleX:e=1,scaleY:r=1}=t;return Math.max(e,r)}function va(t,e,r,s){const l=e-1;return{startY:r[t-1]||0,endY:r[t],startX:s[l]||0,endX:s[e]}}function ma(t,e,r,s,l){let{startY:n,endY:o,startX:i,endX:a}=va(t,e,r,s);const{isMerged:g,isMergedMainCell:c,newEndRow:b,newEndColumn:h,mergeRow:d,mergeColumn:u}=pa(t,e,l);let f={startRow:d,startColumn:u,endRow:b,endColumn:h,startY:0,endY:0,startX:0,endX:0};if(g&&-1!==d&&-1!==u){let t=r[d-1]||0,e=r[b],l=s[u-1]||0,n=s[h];f=__spreadProps(__spreadValues({},f),{startY:t,endY:e,startX:l,endX:n})}else g||-1===b||-1===h||(o=r[b]||0,a=s[h]||0);return{isMerged:g,isMergedMainCell:c,row:t,column:e,startY:n,endY:o,startX:i,endX:a,mergeInfo:f}}function pa(t,e,r){let s=!1,l=!1,n=-1,o=-1,i=-1,a=-1;return null==r||r.forEach(((r,g)=>{let c=!1;if(null==g||g.forEach(((r,g)=>{const{startRow:b,endRow:h,startColumn:d,endColumn:u}=g;return t===b&&e===d?(n=h,o=u,i=b,a=d,c=!0,l=!0,!1):t>=b&&t<=h&&e>=d&&e<=u?(n=h,o=u,i=b,a=d,c=!0,s=!0,!1):void 0})),c)return!1})),{isMergedMainCell:l,isMerged:s,newEndRow:n,newEndColumn:o,mergeRow:i,mergeColumn:a}}function _a(t,e,r,s,l){const{startY:n,endY:o,startX:i,endX:a}=t;return t.startY=sa(n+r,l),t.endY=sa(o+r,l),t.startX=sa(i+e,s),t.endX=sa(a+e,s),__spreadValues({},t)}function Ba(t,e){return!(t.left>e.right||t.top>e.bottom||e.left>t.right||e.top>t.bottom)}function Ca(t){const e=document.createElement("style");document.head.appendChild(e);const r=e.sheet;for(let s of t)null==r||r.insertRule(s,r.cssRules.length)}function wa(t){for(let e=0,r=document.head.childNodes.length;e-1)return!0}return!1}function Ta(t){return Number(t.replace(/px/gi,""))}function ya(t){const e=getComputedStyle(t),{borderTopWidth:r,borderLeftWidth:s,borderRightWidth:l,borderBottomWidth:n,width:o,height:i}=e;return{top:Ta(r),left:Ta(s),right:Ta(l),bottom:Ta(n),width:Ta(o),height:Ta(i)}}class Sa{constructor(t=0,e=0){this.x=t,this.y=e}static Zero(){return new Sa(0,0)}static One(){return new Sa(1,1)}static FromArray(t,e=0){return new Sa(t[e],t[e+1])}static FromArrayToRef(t,e,r){r.x=t[e],r.y=t[e+1]}static CatmullRom(t,e,r,s,l){let n=l*l,o=l*n,i=.5*(2*e.x+(-t.x+r.x)*l+(2*t.x-5*e.x+4*r.x-s.x)*n+(-t.x+3*e.x-3*r.x+s.x)*o),a=.5*(2*e.y+(-t.y+r.y)*l+(2*t.y-5*e.y+4*r.y-s.y)*n+(-t.y+3*e.y-3*r.y+s.y)*o);return new Sa(i,a)}static Clamp(t,e,r){let s=t.x;s=s>r.x?r.x:s,s=sr.y?r.y:l,l=le.x?t.x:e.x,s=t.y>e.y?t.y:e.y;return new Sa(r,s)}static Transform(t,e,r=!1){const s=e,l=t;return r?new Sa(s[0]*l.x+s[2]*l.y,s[1]*l.x+s[3]*l.y):new Sa(s[0]*l.x+s[2]*l.y+s[4],s[1]*l.x+s[3]*l.y+s[5])}static PointInTriangle(t,e,r,s){let l=.5*(-r.y*s.x+e.y*(-r.x+s.x)+e.x*(r.y-s.y)+r.x*s.y),n=l<0?-1:1,o=(e.y*s.x-e.x*s.y+(s.y-e.y)*t.x+(e.x-s.x)*t.y)*n,i=(e.x*r.y-e.y*r.x+(e.y-r.y)*t.x+(r.x-e.x)*t.y)*n;return o>0&&i>0&&o+i<2*l*n}static Distance(t,e){return Math.sqrt(Sa.DistanceSquared(t,e))}static DistanceSquared(t,e){let r=t.x-e.x,s=t.y-e.y;return r*r+s*s}static Center(t,e){return Sa.CenterToRef(t,e,Sa.Zero())}static CenterToRef(t,e,r){return r.copyFromFloats((t.x+e.x)/2,(t.y+e.y)/2)}static DistanceOfPointFromSegment(t,e,r){let s=Sa.DistanceSquared(e,r);if(0===s)return Sa.Distance(t,e);let l=r.subtract(e),n=Math.max(0,Math.min(1,Sa.Dot(t.subtract(e),l)/s)),o=e.add(l.multiplyByFloats(n,n));return Sa.Distance(t,o)}static create(t,e){return new Sa(t,e)}toString(){return`{X: ${this.x} Y: ${this.y}}`}getClassName(){return"Vector2"}getHashCode(){let t=0|this.x;return t=397*t^(0|this.y),t}toArray(t,e=0){return t[e]=this.x,t[e+1]=this.y,this}fromArray(t,e=0){return Sa.FromArrayToRef(t,e,this),this}asArray(){let t=new Array;return this.toArray(t,0),t}copyFrom(t){return this.x=t.x,this.y=t.y,this}copyFromFloats(t,e){return this.x=t,this.y=e,this}set(t,e){return this.copyFromFloats(t,e)}add(t){return new Sa(this.x+t.x,this.y+t.y)}addToRef(t,e){return e.x=this.x+t.x,e.y=this.y+t.y,this}addByPoint(t,e){return new Sa(this.x+t,this.y+e)}addInPlace(t){return this.x+=t.x,this.y+=t.y,this}subtract(t){return new Sa(this.x-t.x,this.y-t.y)}subtractByPoint(t,e){return new Sa(this.x-t,this.y-e)}subtractToRef(t,e){return e.x=this.x-t.x,e.y=this.y-t.y,this}subtractInPlace(t){return this.x-=t.x,this.y-=t.y,this}multiplyInPlace(t){return this.x*=t.x,this.y*=t.y,this}multiply(t){return new Sa(this.x*t.x,this.y*t.y)}multiplyToRef(t,e){return e.x=this.x*t.x,e.y=this.y*t.y,this}multiplyByFloats(t,e){return new Sa(this.x*t,this.y*e)}divide(t){return new Sa(this.x/t.x,this.y/t.y)}divideToRef(t,e){return e.x=this.x/t.x,e.y=this.y/t.y,this}divideInPlace(t){return this.divideToRef(t,this)}negate(){return new Sa(-this.x,-this.y)}negateInPlace(){return this.x*=-1,this.y*=-1,this}negateToRef(t){return t.copyFromFloats(-1*this.x,-1*this.y)}scaleInPlace(t){return this.x*=t,this.y*=t,this}scale(t){let e=new Sa(0,0);return this.scaleToRef(t,e),e}scaleToRef(t,e){return e.x=this.x*t,e.y=this.y*t,this}scaleAndAddToRef(t,e){return e.x+=this.x*t,e.y+=this.y*t,this}equals(t){return t&&this.x===t.x&&this.y===t.y}floor(){return new Sa(Math.floor(this.x),Math.floor(this.y))}fract(){return new Sa(this.x-Math.floor(this.x),this.y-Math.floor(this.y))}rotate(t){const e=Math.cos(t),r=Math.sin(t),s=e*this.x-r*this.y,l=r*this.x+e*this.y;return this.x=s,this.y=l,this}rotateToRef(t,e){const r=Math.cos(t),s=Math.sin(t);return e.x=r*this.x-s*this.y,e.y=s*this.x+r*this.y,this}rotateByPoint(t,e=Sa.create(0,0)){const r=Math.cos(t),s=Math.sin(t),l=e.x+(this.x-e.x)*r-(this.y-e.y)*s,n=e.y+(this.x-e.x)*s+(this.y-e.y)*r;return this.x=l,this.y=n,this}transformCoordinateOnRotate(t){const e=Math.sqrt(this.x**2+this.y**2),r=-t+Math.atan2(this.y,this.x);return this.x=e*Math.cos(r),this.y=e*Math.sin(r),this}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}lengthSquared(){return this.x*this.x+this.y*this.y}normalize(){return Sa.NormalizeToRef(this,this),this}clone(){return new Sa(this.x,this.y)}}const ja=[1,0,0,1,0,0];class Ea{constructor(t=ja){this.dirty=!1,this._m=t&&t.slice()||ja}static create(t=ja){return new this(t)}reset(){this._m[0]=1,this._m[1]=0,this._m[2]=0,this._m[3]=1,this._m[4]=0,this._m[5]=0}copy(){return new Ea(this._m)}copyInto(t){t._m[0]=this._m[0],t._m[1]=this._m[1],t._m[2]=this._m[2],t._m[3]=this._m[3],t._m[4]=this._m[4],t._m[5]=this._m[5]}applyPoint(t,e=!1){const r=this._m;let s=r[0]*t.x+r[2]*t.y,l=r[1]*t.x+r[3]*t.y;return e?new Sa(s,l):new Sa(s+r[4],l+r[5])}translate(t,e){return this._m[4]+=this._m[0]*t+this._m[2]*e,this._m[5]+=this._m[1]*t+this._m[3]*e,this}scale(t,e){return this._m[0]*=t,this._m[1]*=t,this._m[2]*=e,this._m[3]*=e,this}rotate(t){const e=Ki(t);let r=Math.cos(e),s=Math.sin(e),l=this._m[0]*r+this._m[2]*s,n=this._m[1]*r+this._m[3]*s,o=this._m[0]*-s+this._m[2]*r,i=this._m[1]*-s+this._m[3]*r;return this._m[0]=l,this._m[1]=n,this._m[2]=o,this._m[3]=i,this}getTranslation(){return{x:this._m[4],y:this._m[5]}}skew(t,e){let r=this._m[0]+this._m[2]*e,s=this._m[1]+this._m[3]*e,l=this._m[2]+this._m[0]*t,n=this._m[3]+this._m[1]*t;return this._m[0]=r,this._m[1]=s,this._m[2]=l,this._m[3]=n,this}multiply(t){let e=this._m[0]*t._m[0]+this._m[2]*t._m[1],r=this._m[1]*t._m[0]+this._m[3]*t._m[1],s=this._m[0]*t._m[2]+this._m[2]*t._m[3],l=this._m[1]*t._m[2]+this._m[3]*t._m[3],n=this._m[0]*t._m[4]+this._m[2]*t._m[5]+this._m[4],o=this._m[1]*t._m[4]+this._m[3]*t._m[5]+this._m[5];return this._m[0]=e,this._m[1]=r,this._m[2]=s,this._m[3]=l,this._m[4]=n,this._m[5]=o,this}invert(){let t=1/(this._m[0]*this._m[3]-this._m[1]*this._m[2]),e=this._m[3]*t,r=-this._m[1]*t,s=-this._m[2]*t,l=this._m[0]*t,n=t*(this._m[2]*this._m[5]-this._m[3]*this._m[4]),o=t*(this._m[1]*this._m[4]-this._m[0]*this._m[5]);return this._m[0]=e,this._m[1]=r,this._m[2]=s,this._m[3]=l,this._m[4]=n,this._m[5]=o,this}getMatrix(){return this._m}getMatrixByAccurate(t=3){return this._m.map((e=>ra(e,t)))}setAbsolutePosition(t){let e=this._m[0],r=this._m[1],s=this._m[2],l=this._m[3],n=this._m[4],o=this._m[5],i=(e*(t.y-o)-r*(t.x-n))/(e*l-r*s),a=(t.x-n-s*i)/e;return this.translate(a,i)}decompose(){let t=this._m[0],e=this._m[1],r=this._m[2],s=this._m[3],l=t*s-e*r,n={x:this._m[4],y:this._m[5],angle:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!==t||0!==e){let o=Math.sqrt(t*t+e*e);n.angle=e>0?Math.acos(t/o):-Math.acos(t/o),n.scaleX=o,n.scaleY=l/o,n.skewX=(t*r+e*s)/l,n.skewY=0}else if(0!==r||0!==s){let o=Math.sqrt(r*r+s*s);n.angle=Math.PI/2-(s>0?Math.acos(-r/o):-Math.acos(r/o)),n.scaleX=l/o,n.scaleY=o,n.skewX=0,n.skewY=(t*r+e*s)/l}return n.angle=Qi(n.angle),n}makeBoundingBoxFromPoints(t){if(this)for(let o=0;o0?di.DOWN:di.UP}function Oa(t,e,r){const s=[];let l=0,n=0,o=0,i=0,a=0;const g=xa(r),c=t.length;r=Math.abs(r);const b=Math.tan(r),h=Math.sin(r),d=Math.cos(r);if(g===di.UP){let r=0;for(let l=0;ln&&(n=c),0===l&&(o+=g*h,a+=g*d)}o+=r/h+e*d,a-=n}else{let r=0,a=-1;const g=[];for(let s=c-1;s>=0;s--){const l=t[s],{lineHeight:i=0}=l,u=i/b,f=(e+u)*h;g.unshift(i/b),f>n&&(n=f,r=u,a=s),o+=0===s?i*h:s===c-1?e*d+i/h:i/h}let u=t[a].lineHeight||0,f=0;for(let e=a+1;e<=c-1;e++){const r=t[e],{lineHeight:l=0}=r;u+=l,f+=g[e]||0,s[e]=-f}f=0;for(let e=a-1;e>=0;e--){const r=t[e],{lineHeight:n=0}=r;f+=g[e+1]||0,s[e]=f,l+=n}s[a]=0,1===c&&(o+=e*d),i=u/h-r*d}return{rotateTranslateXList:s,rotatedHeight:n,rotatedWidth:o,fixOffsetX:i,fixOffsetY:a,rotateTranslateY:l}}const Na=[new Sa(0,0),new Sa(1,1)];class ka{constructor(t=Na){this._lines=t}intersection(t){if(this._lines.length<1||t.length<1)return;const e=[];for(let r=1;r=0)return!1;let a=(l.x-r.x)*(n.y-r.y)-(l.y-r.y)*(n.x-r.x);if(a*(a+o-i)>=0)return!1;let g=a/(i-o),c=g*(s.x-r.x),b=g*(s.y-r.y);return new Sa(r.x+c,r.y+b)}}function Ma(t,e,r,s,l,n){if(!n)return[];const o=n.getPluginManager().getPluginByName("documentCustomBlock");return o?o.dealWidthCustomBlock(t,e,r,s,l):[]}function Da(t,e,r,s){if(!s)return"";const l=s.getPluginManager().getPluginByName("documentCustomBullet");return l?l.dealWidthCustomBulletOrderedSymbol(t,e,r):""}const La=["top","left","width","height","angle","scaleX","scaleY","skewX","skewY","flipX","flipY","strokeWidth"];class Pa{constructor(t){this.isInGroup=!1,this.onTransformChangeObservable=new o,this.onPointerDownObserver=new o,this.onPointerMoveObserver=new o,this.onPointerUpObserver=new o,this.onDblclickObserver=new o,this.onMouseWheelObserver=new o,this.onPointerOutObserver=new o,this.onPointerLeaveObserver=new o,this.onPointerOverObserver=new o,this.onPointerEnterObserver=new o,this.onIsAddedToParentObserver=new o,this.onDisposeObserver=new o,this._dirty=!0,this._top=0,this._topOrigin=0,this._left=0,this._leftOrigin=0,this._width=0,this._widthOrigin=0,this._height=0,this._heightOrigin=0,this._angle=0,this._scaleX=1,this._scaleY=1,this._skewX=0,this._skewY=0,this._flipX=!1,this._flipY=!1,this._strokeWidth=0,this._zIndex=0,this._evented=!0,this._visible=!0,this._debounceParentDirty=!0,this._transform=new Ea,this._cursor=oi.DEFAULT,this._isTransformer=!1,this._forceRender=!1,this._oKey=t||qi()}get transform(){return this._transform}get topOrigin(){return this._topOrigin}get leftOrigin(){return this._leftOrigin}get widthOrigin(){return this._widthOrigin}get heightOrigin(){return this._heightOrigin}get classType(){return fi.BASE_OBJECT}get top(){return this._top}get left(){return this._left}get width(){return this._width}get height(){return this._height}get strokeWidth(){return this._strokeWidth}get angle(){return this._angle}get scaleX(){return this._scaleX}get scaleY(){return this._scaleY}get ancestorScaleX(){var t;let e=(null==(t=this.getParent())?void 0:t.ancestorScaleX)||1;return this.scaleX*e}get ancestorScaleY(){var t;let e=(null==(t=this.getParent())?void 0:t.ancestorScaleY)||1;return this.scaleY*e}get skewX(){return this._skewX}get skewY(){return this._skewY}get flipX(){return this._flipX}get flipY(){return this._flipY}get parent(){return this._parent}get oKey(){return this._oKey}get zIndex(){return this._zIndex}get evented(){return this._evented}get visible(){return this._visible}get debounceParentDirty(){return this._debounceParentDirty}get isTransformer(){return this._isTransformer}get cursor(){return this._cursor}set transform(t){this._transform=t}set zIndex(t){this._zIndex=t}set parent(t){this._parent=t}set evented(t){this._evented=t}set debounceParentDirty(t){this._debounceParentDirty=t}set isTransformer(t){this._isTransformer=t}set cursor(t){this.setCursor(t)}set top(t){var e;this._topOrigin=t,this._top=Wi(t,null==(e=this._parent)?void 0:e.height)}set left(t){var e;this._leftOrigin=t,this._left=Wi(t,null==(e=this._parent)?void 0:e.width)}set width(t){var e;this._widthOrigin=t,this._width=Wi(t,null==(e=this._parent)?void 0:e.width)}set height(t){var e;this._heightOrigin=t,this._height=Wi(t,null==(e=this._parent)?void 0:e.height)}set strokeWidth(t){this._strokeWidth=t}set angle(t){this._angle=t}set scaleX(t){this._scaleX=t}set scaleY(t){this._scaleY=t}set skewX(t){this._skewX=t}set flipY(t){this._flipY=t}set flipX(t){this._flipX=t}set skewY(t){this._skewY=t}makeDirty(t=!0){return this._dirty=t,t&&(window.clearTimeout(this.__debounceParentTimeout),this.__debounceParentTimeout=window.setTimeout((()=>{var e;null==(e=this.parent)||e.makeDirty(t)}),0)),this}makeDirtyNoDebounce(t=!0){var e;return this._dirty=t,t&&(null==(e=this.parent)||e.makeDirty(t)),this}isDirty(){return this._dirty}translate(t,e){const r=this.top;void 0!==e&&(this.top=e);const s=this.left;return void 0!==t&&(this.left=t),this._setTransForm(),this.onTransformChangeObservable.notifyObservers({type:ki.translate,value:{top:this._top,left:this._left},preValue:{top:r,left:s}}),this}resize(t,e){const r=this.width;void 0!==t&&(this.width=t);const s=this.height;return void 0!==e&&(this.height=e),this._setTransForm(),this.onTransformChangeObservable.notifyObservers({type:ki.resize,value:{width:this._width,height:this._height},preValue:{width:r,height:s}}),this}scale(t,e){const r=this.scaleX;void 0!==t&&(this.scaleX=t);const s=this.scaleY;return void 0!==e&&(this.scaleY=e),this._setTransForm(),this.onTransformChangeObservable.notifyObservers({type:ki.scale,value:{scaleX:this._scaleX,scaleY:this._scaleY},preValue:{scaleX:r,scaleY:s}}),this}skew(t,e){const r=t;void 0!==t&&(this.skewX=t);const s=e;return void 0!==e&&(this.skewY=e),this._setTransForm(),this.onTransformChangeObservable.notifyObservers({type:ki.skew,value:{skewX:this._skewX,skewY:this._skewY},preValue:{skewX:r,skewY:s}}),this}flip(t,e){const r=t;void 0!==t&&(this.flipX=t);const s=e;return void 0!==e&&(this.flipY=e),this._setTransForm(),this.onTransformChangeObservable.notifyObservers({type:ki.flip,value:{flipX:this._flipX,flipY:this._flipY},preValue:{flipX:r,flipY:s}}),this}transformByState(t){const e=Object.keys(t),r={};if(0!==e.length)return e.forEach((e=>{void 0!==t[e]&&(r[e]=this[e],this[e]=t[e])})),this._setTransForm(),this.onTransformChangeObservable.notifyObservers({type:ki.all,value:t,preValue:r}),this}isRender(t){return!this._forceRender&&(t&&!this.isInGroup)}getParent(){return this._parent}getState(){return{left:this.left,top:this.top,width:this.width,height:this.height,scaleX:this.scaleX,scaleY:this.scaleY,angle:this.angle,skewX:this.skewX,skewY:this.skewY,flipX:this.flipX,flipY:this.flipY}}hide(){this._visible=!1,this._makeDirtyMix()}show(){this._visible=!0,this._makeDirtyMix()}render(t,e){}isHit(t){const e=this._getInverseCoord(t);return e.x>=-this.strokeWidth/2&&e.x<=this.width+this.strokeWidth/2&&e.y>=-this.strokeWidth/2&&e.y<=this.height+this.strokeWidth/2}on(t,e){return this[`on${t}Observer`].add(e.bind(this))}off(t,e){this[`on${t}Observer`].remove(e)}clear(t){this[`on${t}Observer`].clear()}resizeCacheCanvas(){}scaleCacheCanvas(){}triggerPointerMove(t){var e,r;return!!(null==(e=this.onPointerMoveObserver.notifyObservers(t))?void 0:e.stopPropagation)||(null==(r=this._parent)||r.triggerPointerMove(t),!1)}triggerPointerDown(t){var e,r;return!!(null==(e=this.onPointerDownObserver.notifyObservers(t))?void 0:e.stopPropagation)||(null==(r=this._parent)||r.triggerPointerDown(t),!1)}triggerPointerUp(t){var e,r;return!!(null==(e=this.onPointerUpObserver.notifyObservers(t))?void 0:e.stopPropagation)||(null==(r=this._parent)||r.triggerPointerUp(t),!1)}triggerDblclick(t){var e,r;return!!(null==(e=this.onDblclickObserver.notifyObservers(t))?void 0:e.stopPropagation)||(null==(r=this._parent)||r.triggerDblclick(t),!1)}triggerMouseWheel(t){var e,r;return!!(null==(e=this.onMouseWheelObserver.notifyObservers(t))?void 0:e.stopPropagation)||(null==(r=this._parent)||r.triggerMouseWheel(t),!1)}triggerPointerOut(t){var e,r;return!!(null==(e=this.onPointerOutObserver.notifyObservers(t))?void 0:e.stopPropagation)||(null==(r=this._parent)||r.triggerPointerOut(t),!1)}triggerPointerLeave(t){var e,r;return!!(null==(e=this.onPointerLeaveObserver.notifyObservers(t))?void 0:e.stopPropagation)||(null==(r=this._parent)||r.triggerPointerLeave(t),!1)}triggerPointerOver(t){var e;return!!this.onPointerOverObserver.notifyObservers(t)||(null==(e=this._parent)||e.triggerPointerOver(t),!1)}triggerPointerEnter(t){var e,r;return!!(null==(e=this.onPointerEnterObserver.notifyObservers(t))?void 0:e.stopPropagation)||(null==(r=this._parent)||r.triggerPointerEnter(t),!1)}dispose(){var t;this.onPointerDownObserver.clear(),this.onPointerMoveObserver.clear(),this.onPointerUpObserver.clear(),this.onMouseWheelObserver.clear(),this.onPointerOutObserver.clear(),this.onPointerLeaveObserver.clear(),this.onPointerOverObserver.clear(),this.onPointerEnterObserver.clear(),this.onDblclickObserver.clear(),this.onIsAddedToParentObserver.clear(),null==(t=this.parent)||t.removeObject(this),this.onDisposeObserver.notifyObservers(this)}toJson(){const t={};return La.forEach((e=>{this[e]&&(t[e]=this[e])})),t}getScene(){let t=this.parent;if(null!=t){if(t.classType===fi.SCENE)return t;for(;t;){if(t.classType===fi.SCENE)return t;t=t.getParent()}}}resetCursor(){this.setCursor(oi.DEFAULT)}setCursor(t){var e;this._cursor=t,null==(e=this.getScene())||e.setCursor(t)}getEngine(){let t=this.getParent();for(;null!=t;){if(t===fi.ENGINE)return t;t=t.getParent()}return null}_getInverseCoord(t){return this._transform.clone().invert().applyPoint(t)}_setTransForm(){const t=Ea.create().composeMatrix({left:this.left+this.strokeWidth/2,top:this.top+this.strokeWidth/2,scaleX:this.scaleX,scaleY:this.scaleY,angle:this.angle,skewX:this.skewX,skewY:this.skewY,flipX:this.flipX,flipY:this.flipY});this.transform=t,this._makeDirtyMix()}_makeDirtyMix(){this.debounceParentDirty?this.makeDirty(!0):this.makeDirtyNoDebounce(!0)}}function Ha(t){const e=t.getScene(),r=t.getViewportByCoord(e);if(!r)return{scrollX:0,scrollY:0};const s=r.getActualScroll(r.scrollX,r.scrollY);return{scrollX:s.x,scrollY:s.y}}function Fa(t,e){const r=t.transform.clone().invert().applyPoint(e.tl),s=t.transform.clone().invert().applyPoint(e.tr),l=t.transform.clone().invert().applyPoint(e.bl),n=t.transform.clone().invert().applyPoint(e.br),o=[r.x,s.x,l.x,n.x],i=[r.y,s.y,l.y,n.y],a=Math.max(...o),g=Math.min(...o),c=Math.max(...i);return{minX:g,maxX:a,minY:Math.min(...i),maxY:c}}function Ua(){let t=1,e=Xi().getContext("2d");return t=(window.devicePixelRatio||1)/(e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1),t<1?1:Math.ceil(10*t)/10}class za{constructor(t){this.isCache=!1,this._pixelRatio=1,this._width=0,this._height=0,t=t||{},this._canvasEle=Xi(),this._canvasEle.style.padding="0",this._canvasEle.style.margin="0",this._canvasEle.style.border="0",this._canvasEle.style.background="transparent",this._canvasEle.style.position="absolute",this._canvasEle.style.top="0",this._canvasEle.style.left="0",this._canvasEle.tabIndex=1,this._canvasEle.style.touchAction="none",this._canvasEle.style.outline="0",this._context=this._canvasEle.getContext("2d"),this.setSize(t.width,t.height,t.pixelRatio)}getCanvasEle(){return this._canvasEle}getContext(){return this._context}getPixelRatio(){return this._pixelRatio}getWidth(){return this._width}getHeight(){return this._height}setSize(t,e,r){this._pixelRatio=r||Ua(),t&&(this._width=t,this._canvasEle.width=t*this._pixelRatio,this._canvasEle.style.width=`${t}px`),e&&(this._height=e,this._canvasEle.height=e*this._pixelRatio,this._canvasEle.style.height=`${e}px`),this.getContext().setTransform(this._pixelRatio,0,0,this._pixelRatio,0,0)}setPixelRatio(t){0!==this._width&&0!==this._height&&(t<1&&(t=1),this.setSize(this._width,this._height,t))}dispose(){this.clear(),this._canvasEle.remove()}clear(){this.getContext().clearRect(0,0,this._width*this._pixelRatio,this._height*this._pixelRatio)}toDataURL(t,e){try{return this._canvasEle.toDataURL(t,e)}catch(r){try{return this._canvasEle.toDataURL()}catch(s){const{message:t}=s;return console.error(`Unable to get data URL. ${t} For more info read https://universheet.net/docs/Canvas.html.`),""}}}}class Wa{constructor(t=100,e=100){this.onInputChangedObservable=new o,this.renderEvenInBackground=!0,this.onBeginFrameObservable=new o,this.onEndFrameObservable=new o,this.onTransformChangeObservable=new o,this._canvas=new za,this._scenes={},this._activeScene=null,this._renderingQueueLaunched=!1,this._activeRenderLoops=new Array,this._usingSafari=$i(),this._fps=60,this._deltaTime=0,this._performanceMonitor=new Li,this.__pointer={},this.__mouseId=-1,this.__isUsingFirefox=-1!==navigator.userAgent.indexOf("Firefox"),this._canvasEle=this._canvas.getCanvasEle(),this._canvas.setSize(t,e),this._handleKeyboardAction(),this._handlePointerAction()}get width(){return this._canvas.getWidth()}get height(){return this._canvas.getHeight()}get classType(){return fi.ENGINE}get activeScene(){return this._activeScene}get requestNewFrameHandler(){return this._requestNewFrameHandler}get frameId(){return this._frameId}getCanvas(){return this._canvas}getScenes(){return this._scenes}getScene(t){return this._scenes[t]}hasScene(t){return t in this._scenes}addScene(t){const e=t.sceneKey;return this.hasScene(e)&&console.warn("Scenes has similar key, it will be covered"),this._scenes[e]=t,t}setActiveScene(t){const e=this.getScene(t);return e&&(this._activeScene=e),e}hasActiveScene(){return null!=this._activeScene}setContainer(t){this._container=t,this._container.appendChild(this._canvasEle),this.resize()}resize(){if(!this._container)return;const{width:t,height:e}=ya(this._container);this.resizeBySize(t,e)}resizeBySize(t,e){const r=this.width,s=this.height;this._canvas.setSize(t,e),this.onTransformChangeObservable.notifyObservers({type:ki.resize,value:{width:t,height:e},preValue:{width:r,height:s}})}dispose(){const t=this.getScenes();Object.keys(t).forEach((e=>{t[e].dispose()}));const e=Zi();this._canvasEle.removeEventListener(`${e}move`,this._pointerMoveEvent),this._canvasEle.removeEventListener(`${e}down`,this._pointerDownEvent),this._canvasEle.removeEventListener(`${e}up`,this._pointerUpEvent),this._canvasEle.removeEventListener("blur",this._pointerBlurEvent),this._canvasEle.removeEventListener(this._getWheelEventName(),this._pointerWheelEvent),this._activeRenderLoops=[],this._canvas.dispose(),this.onBeginFrameObservable.clear(),this.onEndFrameObservable.clear(),this.onTransformChangeObservable.clear()}remainScene(t){const e=this.getScenes();if(e[t]){const r=e[t];return delete e[t],r}}runRenderLoop(t){-1===this._activeRenderLoops.indexOf(t)&&(this._activeRenderLoops.push(t),this._renderingQueueLaunched||(this._renderingQueueLaunched=!0,this._renderFunction=this._renderLoop.bind(this),this._requestNewFrameHandler=Vi(this._renderFunction)))}beginFrame(){this._measureFps(),this.onBeginFrameObservable.notifyObservers(this)}endFrame(){this._frameId++,this.onEndFrameObservable.notifyObservers(this)}getFps(){return this._fps}getDeltaTime(){return this._deltaTime}_renderFrame(){for(let t=0;t0?this._requestNewFrameHandler=Vi(this._renderFunction):this._renderingQueueLaunched=!1}_measureFps(){this._performanceMonitor.sampleFrame(),this._fps=this._performanceMonitor.averageFPS,this._deltaTime=this._performanceMonitor.instantaneousFrameTime||0}_handleKeyboardAction(){this._canvasEle.addEventListener("keydown",(t=>{let e=t;e.deviceType=Ai.Keyboard,e.inputIndex=t.keyCode,e.previousState=0,e.currentState=1,this.onInputChangedObservable.notifyObservers(e)})),this._canvasEle.addEventListener("keyup",(t=>{let e=t;e.deviceType=Ai.Keyboard,e.inputIndex=t.keyCode,e.previousState=1,e.currentState=0,this.onInputChangedObservable.notifyObservers(e)}))}_handlePointerAction(){const t=Zi();this._pointerMoveEvent=t=>{const e=this.__getPointerType(t),r=this.__pointer[Oi.Horizontal],s=this.__pointer[Oi.Vertical],l=this.__pointer[Oi.DeltaHorizontal],n=this.__pointer[Oi.DeltaVertical];this.__pointer[Oi.Horizontal]=t.clientX,this.__pointer[Oi.Vertical]=t.clientY,this.__pointer[Oi.DeltaHorizontal]=t.movementX,this.__pointer[Oi.DeltaVertical]=t.movementY;let o=t;o.deviceType=e,r!==t.clientX&&(o.inputIndex=Oi.Horizontal,o.previousState=r,o.currentState=this.__pointer[Oi.Horizontal],this.onInputChangedObservable.notifyObservers(o)),s!==t.clientY&&(o.inputIndex=Oi.Vertical,o.previousState=s,o.currentState=this.__pointer[Oi.Vertical],this.onInputChangedObservable.notifyObservers(o)),0!==this.__pointer[Oi.DeltaHorizontal]&&(o.inputIndex=Oi.DeltaHorizontal,o.previousState=l,o.currentState=this.__pointer[Oi.DeltaHorizontal],this.onInputChangedObservable.notifyObservers(o)),0!==this.__pointer[Oi.DeltaVertical]&&(o.inputIndex=Oi.DeltaVertical,o.previousState=n,o.currentState=this.__pointer[Oi.DeltaVertical],this.onInputChangedObservable.notifyObservers(o)),this._usingSafari||-1===t.button||(o.inputIndex=t.button+2,o.previousState=this.__pointer[t.button+2],this.__pointer[t.button+2]=this.__pointer[t.button+2]?0:1,o.currentState=this.__pointer[t.button+2],this.onInputChangedObservable.notifyObservers(o))},this._pointerDownEvent=t=>{const e=this.__getPointerType(t),r=this.__pointer[Oi.Horizontal],s=this.__pointer[Oi.Vertical],l=this.__pointer[t.button+2];e===Ai.Mouse?(-1===this.__mouseId&&(void 0===t.pointerId?this.__mouseId=this.__isUsingFirefox?0:1:this.__mouseId=t.pointerId),document.pointerLockElement||this._canvasEle.setPointerCapture(this.__mouseId)):t.pointerId&&!document.pointerLockElement&&this._canvasEle.setPointerCapture(t.pointerId),this.__pointer[Oi.Horizontal]=t.clientX,this.__pointer[Oi.Vertical]=t.clientY,this.__pointer[t.button+2]=1;let n=t;n.deviceType=e,r!==t.clientX&&(n.inputIndex=Oi.Horizontal,n.previousState=r,n.currentState=this.__pointer[Oi.Horizontal],this.onInputChangedObservable.notifyObservers(n)),s!==t.clientY&&(n.inputIndex=Oi.Vertical,n.previousState=s,n.currentState=this.__pointer[Oi.Vertical],this.onInputChangedObservable.notifyObservers(n)),n.inputIndex=t.button+2,n.previousState=l,n.currentState=this.__pointer[t.button+2],this.onInputChangedObservable.notifyObservers(n)},this._pointerUpEvent=t=>{const e=this.__getPointerType(t),r=this.__pointer[Oi.Horizontal],s=this.__pointer[Oi.Vertical],l=this.__pointer[t.button+2];this.__pointer[Oi.Horizontal]=t.clientX,this.__pointer[Oi.Vertical]=t.clientY,this.__pointer[t.button+2]=0;let n=t;n.deviceType=e,r!==t.clientX&&(n.inputIndex=Oi.Horizontal,n.previousState=r,n.currentState=this.__pointer[Oi.Horizontal],this.onInputChangedObservable.notifyObservers(n)),s!==t.clientY&&(n.inputIndex=Oi.Vertical,n.previousState=s,n.currentState=this.__pointer[Oi.Vertical],this.onInputChangedObservable.notifyObservers(n)),n.inputIndex=t.button+2,n.previousState=l,n.currentState=this.__pointer[t.button+2],e===Ai.Mouse&&this.__mouseId>=0&&this._canvasEle.hasPointerCapture(this.__mouseId)?this._canvasEle.releasePointerCapture(this.__mouseId):t.pointerId&&this._canvasEle.hasPointerCapture(t.pointerId)&&this._canvasEle.releasePointerCapture(t.pointerId),this.onInputChangedObservable.notifyObservers(n),e!==Ai.Mouse&&(this.__pointer={})},this._pointerBlurEvent=t=>{this.__mouseId>=0&&this._canvasEle.hasPointerCapture(this.__mouseId)&&(this._canvasEle.releasePointerCapture(this.__mouseId),this.__mouseId=-1),this.__pointer={}},this._pointerWheelEvent=t=>{const e=Ai.Mouse;let r=this.__pointer[Oi.MouseWheelX],s=this.__pointer[Oi.MouseWheelY],l=this.__pointer[Oi.MouseWheelZ];this.__pointer[Oi.MouseWheelX]=t.deltaX||0,this.__pointer[Oi.MouseWheelY]=t.deltaY||t.wheelDelta||0,this.__pointer[Oi.MouseWheelZ]=t.deltaZ||0;let n=t;n.deviceType=e,0!==this.__pointer[Oi.MouseWheelX]&&(n.inputIndex=Oi.MouseWheelX,n.previousState=r,n.currentState=this.__pointer[Oi.MouseWheelX],this.onInputChangedObservable.notifyObservers(n)),0!==this.__pointer[Oi.MouseWheelY]&&(n.inputIndex=Oi.MouseWheelY,n.previousState=s,n.currentState=this.__pointer[Oi.MouseWheelY],this.onInputChangedObservable.notifyObservers(n)),0!==this.__pointer[Oi.MouseWheelZ]&&(n.inputIndex=Oi.MouseWheelZ,n.previousState=l,n.currentState=this.__pointer[Oi.MouseWheelZ],this.onInputChangedObservable.notifyObservers(n))},this._canvasEle.addEventListener(`${t}move`,this._pointerMoveEvent),this._canvasEle.addEventListener(`${t}down`,this._pointerDownEvent),this._canvasEle.addEventListener(`${t}up`,this._pointerUpEvent),this._canvasEle.addEventListener("blur",this._pointerBlurEvent),this._canvasEle.addEventListener(this._getWheelEventName(),this._pointerWheelEvent,!!this._getPassive()&&{passive:!1})}_getWheelEventName(){return"onwheel"in document.createElement("div")?"wheel":void 0!==document.onmousewheel?"mousewheel":"DOMMouseScroll"}_getPassive(){let t=!1;const e=()=>{};try{const r={passive:{get(){t=!0}}};this._canvasEle.addEventListener("test",e,r),this._canvasEle.removeEventListener("test",e,r)}catch(r){}return t}__getPointerType(t){let e=Ai.Mouse;return("touch"===t.pointerType||"pen"===t.pointerType||t.touches)&&(e=Ai.Touch),e}}class Va{constructor(t,e=[],r=1){this._scene=t,this._zIndex=r,this._objects=[],this.addObjects(e)}get scene(){return this._scene}get zIndex(){return this._zIndex}static create(t,e=[],r=1e3){return new this(t,e,r)}getObjectsByOrder(){const t=[];this._objects.sort(Es);for(let e of this._objects)!e.isInGroup&&e.visible&&t.push(e);return t}getObjectsByOrderForPick(){const t=[];this._objects.sort(Es);for(let e of this._objects)e.classType!==fi.GROUP&&e.visible&&t.push(e);return t}getObjects(){return this._objects}addObject(t){if(t.classType===fi.GROUP){const e=t.getObjects();for(let t of e)this.scene.getObject(t.oKey)||(this._objects.push(t),this.scene.setObjectBehavior(t))}return this._objects.push(t),this.scene.setObjectBehavior(t),this.scene.applyTransformer(t),this}removeObject(t){const e=this.getObjects(),r=e.length;if(t instanceof Pa)for(let s=0;s{this.addObject(t)})),this}removeObjects(t){const e=this.getObjects();for(let r=e.length-1;r>=0;r--){let s=e[r];const l=t.length;if(0===l)break;for(let n=0;n{t.dispose()})),this.clear()}}const Ga=class{constructor(t){this._alreadyAttached=!1,this._startingPosition=new Sa(1/0,1/0),this._doubleClickOccurred=0,this._scene=t}mouseLeaveEnterHandler(t,e){var r;if(null==t)null==(r=this._currentMouseEnterPicked)||r.triggerPointerLeave(e),this._currentMouseEnterPicked=null;else if(t!==this._currentMouseEnterPicked){const r=this._currentMouseEnterPicked;this._currentMouseEnterPicked=t,null==r||r.triggerPointerLeave(e),null==t||t.triggerPointerEnter(e)}}attachControl(t=!0,e=!0,r=!0,s=!0){const l=this._scene.getEngine();l&&(this._onPointerMove=t=>{void 0===t.pointerId&&(t.pointerId=0);const e=this._getCurrentObject(t.offsetX,t.offsetY),r=null==e?void 0:e.triggerPointerMove(t);this.mouseLeaveEnterHandler(e,t),this._checkDirectSceneEventTrigger(!r,e)&&this._scene.onPointerMoveObserver.hasObservers()&&this._scene.onPointerMoveObserver.notifyObservers(t)},this._onPointerDown=t=>{void 0===t.pointerId&&(t.pointerId=0);const e=this._getCurrentObject(t.offsetX,t.offsetY),r=null==e?void 0:e.triggerPointerDown(t);this._checkDirectSceneEventTrigger(!r,e)&&this._scene.onPointerDownObserver.hasObservers()&&this._scene.onPointerDownObserver.notifyObservers(t)},this._onPointerUp=t=>{void 0===t.pointerId&&(t.pointerId=0);const e=this._getCurrentObject(t.offsetX,t.offsetY),r=null==e?void 0:e.triggerPointerUp(t);this._checkDirectSceneEventTrigger(!r,e)&&this._scene.onPointerUpObserver.hasObservers()&&this._scene.onPointerUpObserver.notifyObservers(t),this._prePointerDoubleClick(t)},this._onMouseWheel=t=>{const e=this._getCurrentObject(t.offsetX,t.offsetY),r=null==e?void 0:e.triggerMouseWheel(t);this._scene.getViewports().forEach((e=>{e.onMouseWheelObserver.hasObservers()&&e.onMouseWheelObserver.notifyObservers(t)})),this._checkDirectSceneEventTrigger(!r,e)&&this._scene.onMouseWheelObserver.hasObservers()&&this._scene.onMouseWheelObserver.notifyObservers(t)},this._onKeyDown=t=>{this._scene.onKeyDownObservable.hasObservers()&&this._scene.onKeyDownObservable.notifyObservers(t)},this._onKeyUp=t=>{this._scene.onKeyUpObservable.hasObservers()&&this._scene.onKeyUpObservable.notifyObservers(t)},this._onInputObserver=l.onInputChangedObservable.add((l=>{const n=l;l.deviceType===Ai.Keyboard&&(1===l.currentState&&this._onKeyDown(n),0===l.currentState&&this._onKeyUp(n)),l.deviceType!==Ai.Mouse&&l.deviceType!==Ai.Touch||(t&&l.inputIndex>=Oi.LeftClick&&l.inputIndex<=Oi.RightClick&&1===l.currentState&&this._onPointerDown(n),e&&l.inputIndex>=Oi.LeftClick&&l.inputIndex<=Oi.RightClick&&0===l.currentState&&this._onPointerUp(n),!r||l.inputIndex!==Oi.Horizontal&&l.inputIndex!==Oi.Vertical&&l.inputIndex!==Oi.DeltaHorizontal&&l.inputIndex!==Oi.DeltaVertical?!s||l.inputIndex!==Oi.MouseWheelX&&l.inputIndex!==Oi.MouseWheelY&&l.inputIndex!==Oi.MouseWheelZ||this._onMouseWheel(n):this._onPointerMove(n))})),this._alreadyAttached=!0)}detachControl(){if(!this._alreadyAttached)return;const t=this._scene.getEngine();t&&(t.onInputChangedObservable.remove(this._onInputObserver),this._alreadyAttached=!1)}_getCurrentObject(t,e){var r;return null==(r=this._scene)?void 0:r.pick(Sa.FromArray([t,e]))}_checkDirectSceneEventTrigger(t,e){let r=!1;null==e&&(r=!0);let s=!0;if(e&&e.classType===fi.BASE_OBJECT){const t=e.getScene();if(t){s=t.getParent().classType!==fi.SCENE_VIEWER}}return!this._scene.evented&&t&&s||r}_isPointerSwiping(t,e){return Math.abs(this._startingPosition.x-t)>Ga.DragMovementThreshold||Math.abs(this._startingPosition.y-e)>Ga.DragMovementThreshold}_prePointerDoubleClick(t){var e,r;const{clientX:s,clientY:l}=t;if(0===this._doubleClickOccurred&&(this._startingPosition.x=s,this._startingPosition.y=l),this._doubleClickOccurred+=1,this._delayedTimeout=window.setTimeout((()=>{this._resetDoubleClickParam()}),Ga.DoubleClickDelay),this._doubleClickOccurred<2)return;this._isPointerSwiping(s,l)?this._resetDoubleClickParam():(null==(r=null==(e=this._scene)?void 0:e.pick(Sa.FromArray([t.offsetX,t.offsetY])))||r.triggerDblclick(t),this._scene.onDblclickObserver.hasObservers()&&this._scene.onDblclickObserver.notifyObservers(t),this._resetDoubleClickParam(),console.log("_prePointerDoubleClick",t))}_resetDoubleClickParam(){this._doubleClickOccurred=0,this._startingPosition.x=1/0,this._startingPosition.y=1/0,window.clearTimeout(this._delayedTimeout)}};let Xa=Ga;Xa.DragMovementThreshold=10,Xa.LongPressDelay=500,Xa.DoubleClickDelay=300,Xa.ExclusiveDoubleClickMode=!1;class Qa extends Pa{constructor(t,...e){super(t),this._objects=[],this.addObjects(...e)}get classType(){return fi.GROUP}set cursor(t){this.setCursor(t)}addObjects(...t){for(const e of t)this.addObject(e)}addObject(t){let e=t;if(ea(t)){const r=this.getScene();if(e=null==r?void 0:r.getObject(t),!e)return void console.info("No object be added");e.parent=this,e.isInGroup=!0,e.groupKey=this.oKey,this._objects.push(e)}else t.parent=this,t.isInGroup=!0,t.groupKey=this.oKey,this._objects.push(t)}removeObject(t){const e=this.getObjects(),r=e.length;if(ea(t))for(let s=0;s{t.dispose()})),super.dispose()}_transformBounds(t){return t}}class Ka{constructor(t,e,r=.05,s=.05){this._scene=t,this._padding=e,this._smoothRatioX=r,this._smoothRatioY=s,this._offsetX=0,this._offsetY=0,this._moveX=0,this._moveY=0,this._scrollX=0,this._scrollY=0,this._padding||(this._padding={t:20,b:20,l:46,r:60})}static create(t,e){return new Ka(t,e)}startScroll(t,e){this._offsetX=t,this._offsetY=e,this._moveX=t,this._moveY=e,this._viewport=this.getViewportByCoord(this._scene),this._runRenderLoop()}_scroll(t){const e=(null==t?void 0:t.top)||0,r=e+((null==t?void 0:t.height)||0),s=(null==t?void 0:t.left)||0,l=s+((null==t?void 0:t.width)||0),{t:n=0,b:o=0,r:i=0,l:a=0}=this._padding;let g=0,c=0;this._moveXl-i&&(g=(this._moveX-l+i)*this._smoothRatioX),this._moveYr-o&&(c=(this._moveY-r+o)*this._smoothRatioY);const b=null==t?void 0:t.scrollBy({x:g,y:c}),h=null==t?void 0:t.getActualScroll(g,c);if(this._scrollX=(null==h?void 0:h.x)||0,this._scrollY=(null==h?void 0:h.y)||0,b){const e=this._findAncestorScene(null==t?void 0:t.scene),r=this.getViewportByCoord(e);r&&this._scroll(r)}}scrolling(t,e,r){this._moveX=t,this._moveY=e,this._scrollFunction=r}stopScroll(){Gi(this._requestNewFrameNumber)}getViewportByCoord(t){return null==t?void 0:t.getActiveViewportByRelativeCoord(Sa.FromArray([this._offsetX,this._offsetY]))}getScene(){return this._scene}_runRenderLoop(){this._scroll(this._viewport),this._scrollFunction&&this._scrollFunction(this._scrollX,this._scrollY),this._requestNewFrameNumber=Vi(this._runRenderLoop.bind(this))}_findAncestorScene(t){let e=null==t?void 0:t.getParent();for(;e;){if(e.classType===fi.SCENE)return e;e=(null==e?void 0:e.getParent)&&(null==e?void 0:e.getParent())}}}const Za=["hoverCursor","moveCursor","fillRule","globalCompositeOperation","allowCache","paintFirst","stroke","strokeScaleEnabled","fill","fillAfterStrokeEnabled","hitStrokeWidth","strokeLineJoin","strokeLineCap","shadowColor","shadowBlur","shadowOffset","shadowOffsetX","shadowOffsetY","shadowOpacity","shadowEnabled","shadowForStrokeEnabled","strokeDashArray","strokeDashOffset","strokeMiterLimit"];class $a extends Pa{constructor(t,e){super(t),this._moveCursor=null,this._fillRule="nonzero",this._globalCompositeOperation="source-over",this._allowCache=!1,this._allowCache&&(this._cacheCanvas=new za,this.onTransformChangeObservable.add((()=>{this.resizeCacheCanvas()}))),this._initialProps(e)}get hoverCursor(){return this._hoverCursor}get moveCursor(){return this._moveCursor}get fillRule(){return this._fillRule}get globalCompositeOperation(){return this._globalCompositeOperation}get allowCache(){return this._allowCache}get paintFirst(){return this._paintFirst}get stroke(){return this._stroke}get strokeScaleEnabled(){return this._strokeScaleEnabled}get fill(){return this._fill}get fillAfterStrokeEnabled(){return this._fillAfterStrokeEnabled}get hitStrokeWidth(){return this._hitStrokeWidth}get strokeLineJoin(){return this._strokeLineJoin}get strokeLineCap(){return this._strokeLineCap}get shadowColor(){return this._shadowColor}get shadowBlur(){return this._shadowBlur}get shadowOffset(){return this._shadowOffset}get shadowOffsetX(){return this._shadowOffsetX}get shadowOffsetY(){return this._shadowOffsetY}get shadowOpacity(){return this._shadowOpacity}get shadowEnabled(){return this._shadowEnabled}get shadowForStrokeEnabled(){return this._shadowForStrokeEnabled}get strokeDashArray(){return this._strokeDashArray}get strokeDashOffset(){return this._strokeDashOffset}get strokeMiterLimit(){return this._strokeMiterLimit}static drawWith(t,e){}static _renderPaintInOrder(t,e){"stroke"===e.paintFirst?(this._renderStroke(t,e),this._renderFill(t,e)):(this._renderFill(t,e),this._renderStroke(t,e))}static _renderFill(t,e){e.fill&&(t.save(),this.__setFillStyles(t,e),"evenodd"===e.fillRule?t.fill("evenodd"):t.fill(),t.restore())}static _renderStroke(t,e){let{stroke:r,strokeWidth:s,shadowEnabled:l,shadowForStrokeEnabled:n,strokeScaleEnabled:o,scaleX:i,scaleY:a,parent:g}=e;if(r&&0!==s){if(l&&!n&&this.__removeShadow(t),t.save(),o&&g){let e=this.__getObjectScaling();t.scale(1/e.scaleX,1/e.scaleY)}else o&&(i=null!=i?i:1,a=null!=a?a:1,t.scale(1/i,1/a));this.__setLineDash(t),this.__setStrokeStyles(t,e),t.stroke(),t.restore()}}static __getObjectScaling(){return{scaleX:1,scaleY:1}}static __removeShadow(t){}static __setFillStyles(t,e){t.fillStyle=e.fill}static __setStrokeStyles(t,e){const{strokeWidth:r,strokeLineCap:s,strokeDashOffset:l,strokeLineJoin:n,strokeMiterLimit:o,stroke:i}=e;t.lineWidth=r,t.lineCap=s,t.lineDashOffset=l,t.lineJoin=n,t.miterLimit=o,t.strokeStyle=i}static __setLineDash(t){}render(t,e){if(!this.visible)return this.makeDirty(!1),this;if(this.isRender()){const{minX:t,maxX:r,minY:s,maxY:l}=Fa(this,e);if(this.width+this.strokeWidth{if(void 0===t[e])return!0;-1===La.indexOf(e)&&(this[`_${e}`]=t[e])})),this.makeDirty(!0),this):void 0}resizeCacheCanvas(){var t;null==(t=this._cacheCanvas)||t.setSize(this.width+this.strokeWidth,this.height+this.strokeWidth),this.makeDirty(!0)}scaleCacheCanvas(){var t,e,r;let s=(null==(t=this.getParent())?void 0:t.ancestorScaleX)||1,l=(null==(e=this.getParent())?void 0:e.ancestorScaleX)||1;null==(r=this._cacheCanvas)||r.setPixelRatio(Math.max(s,l)*Ua()),this.makeDirty(!0)}toJson(){const t={};return Za.forEach((e=>{this[e]&&(t[e]=this[e])})),__spreadValues(__spreadValues({},super.toJson()),t)}_applyCache(t){if(!t||!this._cacheCanvas)return;const e=this._cacheCanvas.getPixelRatio(),r=this._cacheCanvas.getWidth()*e,s=this._cacheCanvas.getHeight()*e;t.drawImage(this._cacheCanvas.getCanvasEle(),0,0,r,s,-this.strokeWidth/2,-this.strokeWidth/2,this.width+this.strokeWidth,this.height+this.strokeWidth)}_draw(t){}_initialProps(t){if(!t)return;const e=Object.keys(t);if(0===e.length)return;const r={};let s=!1;e.forEach((e=>{if(void 0===t[e])return!0;La.indexOf(e)>-1?(r[e]=t[e],s=!0):this[`_${e}`]=t[e]})),s&&this.transformByState(r),this.makeDirty(!0)}}const qa=["radius"];class Ja extends $a{constructor(t,e){super(t,e),(null==e?void 0:e.radius)&&(this._radius=null==e?void 0:e.radius)}get radius(){return this._radius}static drawWith(t,e){let{radius:r,width:s,height:l}=e;if(r=null!=r?r:0,s=null!=s?s:30,l=null!=l?l:30,t.beginPath(),e.strokeDashArray&&t.setLineDash(e.strokeDashArray),r){let e=0,n=0,o=0,i=0;e=n=o=i=Math.min(r,s/2,l/2),t.moveTo(e,0),t.lineTo(s-n,0),t.arc(s-n,n,n,3*Math.PI/2,0,!1),t.lineTo(s,l-i),t.arc(s-i,l-i,i,0,Math.PI/2,!1),t.lineTo(o,l),t.arc(o,l-o,o,Math.PI/2,Math.PI,!1),t.lineTo(0,e),t.arc(e,e,e,Math.PI,3*Math.PI/2,!1)}else t.rect(0,0,s,l);t.closePath(),this._renderPaintInOrder(t,e)}toJson(){const t={};return qa.forEach((e=>{this[e]&&(t[e]=this[e])})),__spreadValues(__spreadValues({},super.toJson()),t)}_draw(t){Ja.drawWith(t,this)}}const tg=["pointsGroup"];class eg extends $a{constructor(t,e){super(t,e),this._pointsGroup=(null==e?void 0:e.pointsGroup)||[[]],this._setFixBoundingBox(),this.onTransformChangeObservable.add((t=>{const{type:e,value:r,preValue:s}=t;e!==ki.resize&&e!==ki.all||this.resizePolygon(s)}))}get pointsGroup(){return this._pointsGroup}static drawWith(t,e){let{pointsGroup:r}=e;r=null!=r?r:[[]],e.strokeDashArray&&t.setLineDash(e.strokeDashArray),t.beginPath();for(let s of r){t.moveTo(s[0].x,s[0].y);for(let e=1;e{this[e]&&(t[e]=this[e])})),__spreadValues(__spreadValues({},super.toJson()),t)}getState(){const{left:t,top:e,width:r,height:s}=this.getRect();return{left:t,top:e,width:r,height:s,scaleX:this.scaleX,scaleY:this.scaleY,angle:this.angle,skewX:this.skewX,skewY:this.skewY,flipX:this.flipX,flipY:this.flipY}}getRect(){const{left:t,top:e,width:r,height:s}=this._getSelfRect();return{left:t*this.scaleX+this.left,top:e*this.scaleY+this.top,width:r*this.scaleX,height:s*this.scaleY}}_draw(t){eg.drawWith(t,this)}_setFixBoundingBox(){const{width:t,height:e,left:r,top:s}=this._getSelfRect();this.left=this.left+r,this.top=this.top+s,this.width=t,this.height=e;const l=this.pointsGroup;for(let n of l)for(let t of n)t.x-=r,t.y-=s;this._setTransForm()}_getSelfRect(){const t=this.pointsGroup;let e=t[0][0].x,r=t[0][0].x,s=t[0][0].y,l=t[0][0].y;for(let n of t)for(let t of n)e=Math.min(e,t.x),r=Math.max(r,t.x),s=Math.min(s,t.y),l=Math.max(l,t.y);return{left:e,top:s,width:r-e,height:l-s}}}const rg=17;class sg{constructor(t,e){this._thumbMargin=2,this._thumbLengthRatio=1,this._thumbBackgroundColor=zi(Ko.black,.2),this._thumbHoverBackgroundColor=zi(Ko.black,.35),this._thumbActiveBackgroundColor=zi(Ko.black,.4),this._barSize=14,this._barBackgroundColor=zi(Ko.white),this._barBorder=1,this._barBorderColor=zi([218,220,224]),this._enableHorizontal=!0,this._enableVertical=!0,this._verticalMinusMiniThumb=0,this._horizontalMinusMiniThumb=0,this._isHorizonMove=!1,this._isVerticalMove=!1,t||console.warn("Missing viewport"),this._view=t,this.setProps(e),this._initialScrollRect(),this._view.setScrollBar(this)}get limitX(){return this._horizonThumbRect.visible?this._horizontalBarWidth-this._horizontalThumbWidth:0}get limitY(){return this._verticalThumbRect.visible?this._verticalBarHeight-this._verticalThumbHeight:0}get horizontalThumbWidth(){return this._horizontalThumbWidth}get verticalThumbHeight(){return this._verticalThumbHeight}get ratioScrollX(){return void 0===this._horizontalThumbWidth||void 0===this._horizontalBarWidth?1:(this._horizontalThumbWidth-this._horizontalMinusMiniThumb)/this._horizontalBarWidth}get ratioScrollY(){return void 0===this._verticalThumbHeight||void 0===this._verticalBarHeight?1:(this._verticalThumbHeight-this._verticalMinusMiniThumb)/this._verticalBarHeight}get barSize(){return this._barSize}get barBorder(){return this._barBorder}static attachTo(t,e){return new sg(t,e)}setProps(t){if(!t)return;const e=Object.keys(t);0!==e.length&&e.forEach((e=>{void 0!==t[e]&&(this[`_${e}`]=t[e])}))}render(t,e=0,r=0){let{scrollX:s,scrollY:l}=this._view;t.save();const n=new Ea([1,0,0,1,e,r]).getMatrix();t.transform(n[0],n[1],n[2],n[3],n[4],n[5]),this._horizonBarRect.render(t),this._horizonThumbRect.translate(s).render(t),this._verticalBarRect.render(t),this._verticalThumbRect.translate(void 0,l).render(t),this._placeholderBarRect.render(t),t.restore()}resize(t=0,e=0,r=0,s=0){var l,n,o,i,a,g,c,b,h,d,u;0===t&&0===t||(this._enableHorizontal&&(this._horizontalMinusMiniThumb=0,this._horizontalBarWidth=t-this._barSize,this._horizontalThumbWidth=this._horizontalBarWidth*(this._horizontalBarWidth-this._barBorder)/r*this._thumbLengthRatio,this._horizontalThumbWidth=t?null==(n=this._horizonThumbRect)||n.setProps({visible:!1}):((null==(o=this._horizonThumbRect)?void 0:o.visible)||null==(i=this._horizonThumbRect)||i.setProps({visible:!0}),null==(a=this._horizonThumbRect)||a.transformByState({left:this._view.scrollX,top:e-this._barSize+this._thumbMargin,width:this._horizontalThumbWidth,height:this._barSize-2*this._thumbMargin}))),this._enableVertical&&(this._verticalMinusMiniThumb=0,this._verticalBarHeight=e-this._barSize,this._verticalThumbHeight=this._verticalBarHeight*(this._verticalBarHeight-this._barBorder)/s*this._thumbLengthRatio,this._verticalThumbHeight=e?null==(c=this._verticalThumbRect)||c.setProps({visible:!1}):((null==(b=this._verticalThumbRect)?void 0:b.visible)||null==(h=this._verticalThumbRect)||h.setProps({visible:!0}),null==(d=this._verticalThumbRect)||d.transformByState({left:t-this._barSize+this._thumbMargin,top:this._view.scrollY,width:this._barSize-2*this._thumbMargin,height:this._verticalThumbHeight}))),this._enableHorizontal&&this._enableVertical&&(null==(u=this._placeholderBarRect)||u.transformByState({left:t-this._barSize,top:e-this._barSize,width:this._barSize-this._barBorder,height:this._barSize-this._barBorder})))}makeDirty(t){var e,r,s,l,n;null==(e=this._horizonBarRect)||e.makeDirty(t),null==(r=this._horizonThumbRect)||r.makeDirty(t),null==(s=this._verticalBarRect)||s.makeDirty(t),null==(l=this._verticalThumbRect)||l.makeDirty(t),null==(n=this._placeholderBarRect)||n.makeDirty(t),this.makeViewDirty(t)}makeViewDirty(t){this._view.makeDirty(t);const e=this._view.scene.getParent();e.classType===fi.SCENE_VIEWER&&e.makeDirty(!0)}pick(t){var e,r,s,l;return(null==(e=this._horizonThumbRect)?void 0:e.isHit(t))?this._horizonThumbRect:(null==(r=this._verticalThumbRect)?void 0:r.isHit(t))?this._verticalThumbRect:(null==(s=this._horizonBarRect)?void 0:s.isHit(t))?this._horizonBarRect:(null==(l=this._verticalBarRect)?void 0:l.isHit(t))?this._verticalBarRect:null}dispose(){this._horizonBarRect.dispose(),this._horizonThumbRect.dispose(),this._verticalBarRect.dispose(),this._verticalThumbRect.dispose(),this._placeholderBarRect.dispose()}_initialScrollRect(){this._enableHorizontal&&(this._horizonBarRect=new Ja("__horizonBarRect__",{fill:this._barBackgroundColor,strokeWidth:this._barBorder,stroke:this._barBorderColor}),this._horizonThumbRect=new Ja("__horizonThumbRect__",{radius:6,fill:this._thumbBackgroundColor})),this._enableVertical&&(this._verticalBarRect=new Ja("__verticalBarRect__",{fill:this._barBackgroundColor,strokeWidth:this._barBorder,stroke:this._barBorderColor}),this._verticalThumbRect=new Ja("__verticalThumbRect__",{radius:6,fill:this._thumbBackgroundColor})),this._enableHorizontal&&this._enableVertical&&(this._placeholderBarRect=new Ja("__placeholderBarRect__",{fill:this._barBackgroundColor,strokeWidth:this._barBorder,stroke:this._barBorderColor})),this.__initialEvent()}__initialEvent(){const t=this._mainScene||this._view.scene,e=(t,e)=>(r,s)=>{if(this._isHorizonMove||this._isVerticalMove)return;e.setProps({fill:t}),this.makeViewDirty(!0)};this._enableHorizontal&&(this._horizonThumbRect.on($o.PointerEnter,e(this._thumbHoverBackgroundColor,this._horizonThumbRect)),this._horizonThumbRect.on($o.PointerLeave,e(this._thumbBackgroundColor,this._horizonThumbRect)),this._horizonBarRect.on($o.PointerDown,((t,e)=>{const r=t;this._view.scrollTo({x:r.offsetX-this._view.left-this._horizontalThumbWidth/2}),e.stopPropagation()})),this._horizonThumbRect.on($o.PointerDown,((e,r)=>{const s=e;this._isHorizonMove=!0,this._lastX=s.offsetX,this._lastY=s.offsetY,this._horizonThumbRect.setProps({fill:this._thumbActiveBackgroundColor}),this.makeViewDirty(!0),t.disableEvent(),r.stopPropagation()})),t.on($o.PointerMove,((t,e)=>{const r=t;this._isHorizonMove&&(this._view.scrollBy({x:r.offsetX-this._lastX}),this._lastX=r.offsetX)})),t.on($o.PointerUp,((e,r)=>{const s=this._horizonThumbRect;this._isHorizonMove=!1,t.enableEvent(),s.setProps({fill:this._thumbBackgroundColor}),this.makeViewDirty(!0)}))),this._enableVertical&&(this._verticalThumbRect.on($o.PointerEnter,e(this._thumbHoverBackgroundColor,this._verticalThumbRect)),this._verticalThumbRect.on($o.PointerLeave,e(this._thumbBackgroundColor,this._verticalThumbRect)),this._verticalBarRect.on($o.PointerDown,((t,e)=>{const r=t;this._view.scrollTo({y:r.offsetY-this._view.top-this._verticalThumbHeight/2}),e.stopPropagation()})),this._verticalThumbRect.on($o.PointerDown,((e,r)=>{const s=e,l=this._verticalThumbRect;this._isVerticalMove=!0,this._lastX=s.offsetX,this._lastY=s.offsetY,l.setProps({fill:this._thumbActiveBackgroundColor}),t.disableEvent(),this.makeViewDirty(!0),r.stopPropagation()})),t.on($o.PointerMove,((t,e)=>{const r=t;this._isVerticalMove&&(this._view.scrollBy({y:r.offsetY-this._lastY}),this._lastY=r.offsetY)})),t.on($o.PointerUp,((e,r)=>{const s=this._verticalThumbRect;this._isVerticalMove=!1,t.enableEvent(),s.setProps({fill:this._thumbBackgroundColor}),this.makeViewDirty(!0)})))}}class lg extends $a{constructor(t,e){super(t,e),this._props=__spreadValues({autoWidth:!1,autoHeight:!1},e),e.image?(this._native=e.image,this._init()):e.url&&(this._native=document.createElement("img"),this._native.src=e.url,this._native.onload=()=>{var t;null==(t=e.success)||t.call(e),this._init(),this.makeDirty(!0)},this._native.onerror=()=>{e.fail?e.fail():(this._native.src="data:image/svg+xml;base64,PHN2ZyBjbGFzcz0iaWNvbiIgdmlld0JveD0iMCAwIDEwMjQgMTAyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB3aWR0aD0iMjAwIiBoZWlnaHQ9IjIwMCI+PHBhdGggZD0iTTMwNC4xMjggNDU2LjE5MmM0OC42NCAwIDg4LjA2NC0zOS40MjQgODguMDY0LTg4LjA2NHMtMzkuNDI0LTg4LjA2NC04OC4wNjQtODguMDY0LTg4LjA2NCAzOS40MjQtODguMDY0IDg4LjA2NCAzOS40MjQgODguMDY0IDg4LjA2NCA4OC4wNjR6bTAtMTE2LjIyNGMxNS4zNiAwIDI4LjE2IDEyLjI4OCAyOC4xNiAyOC4xNnMtMTIuMjg4IDI4LjE2LTI4LjE2IDI4LjE2LTI4LjE2LTEyLjI4OC0yOC4xNi0yOC4xNiAxMi4yODgtMjguMTYgMjguMTYtMjguMTZ6IiBmaWxsPSIjZTZlNmU2Ii8+PHBhdGggZD0iTTg4Ny4yOTYgMTU5Ljc0NEgxMzYuNzA0Qzk2Ljc2OCAxNTkuNzQ0IDY0IDE5MiA2NCAyMzIuNDQ4djU1OS4xMDRjMCAzOS45MzYgMzIuMjU2IDcyLjcwNCA3Mi43MDQgNzIuNzA0aDE5OC4xNDRMNTAwLjIyNCA2ODguNjRsLTM2LjM1Mi0yMjIuNzIgMTYyLjMwNC0xMzAuNTYtNjEuNDQgMTQzLjg3MiA5Mi42NzIgMjE0LjAxNi0xMDUuNDcyIDE3MS4wMDhoMzM1LjM2QzkyNy4yMzIgODY0LjI1NiA5NjAgODMyIDk2MCA3OTEuNTUyVjIzMi40NDhjMC0zOS45MzYtMzIuMjU2LTcyLjcwNC03Mi43MDQtNzIuNzA0em0tMTM4Ljc1MiA3MS42OHYuNTEySDg1Ny42YzE2LjM4NCAwIDMwLjIwOCAxMy4zMTIgMzAuMjA4IDMwLjIwOHYzOTkuODcyTDY3My4yOCA0MDguMDY0bDc1LjI2NC0xNzYuNjR6TTMwNC42NCA3OTIuMDY0SDE2NS44ODhjLTE2LjM4NCAwLTMwLjIwOC0xMy4zMTItMzAuMjA4LTMwLjIwOHYtOS43MjhsMTM4Ljc1Mi0xNjQuMzUyIDEwNC45NiAxMjQuNDE2LTc0Ljc1MiA3OS44NzJ6bTgxLjkyLTM1NS44NGwzNy4zNzYgMjI4Ljg2NC0uNTEyLjUxMi0xNDIuODQ4LTE2OS45ODRjLTMuMDcyLTMuNTg0LTkuMjE2LTMuNTg0LTEyLjI4OCAwTDEzNS42OCA2NTIuOFYyNjIuMTQ0YzAtMTYuMzg0IDEzLjMxMi0zMC4yMDggMzAuMjA4LTMwLjIwOGg0NzQuNjI0TDM4Ni41NiA0MzYuMjI0em01MDEuMjQ4IDMyNS42MzJjMCAxNi44OTYtMTMuMzEyIDMwLjIwOC0yOS42OTYgMzAuMjA4SDY4MC45Nmw1Ny4zNDQtOTMuMTg0LTg3LjU1Mi0yMDIuMjQgNy4xNjgtNy42OCAyMjkuODg4IDI3Mi44OTZ6IiBmaWxsPSIjZTZlNmU2Ii8+PC9zdmc+",this._init(),this.makeDirty(!0))})}static drawWith(t,e){var r;if(null==(r=e._native)?void 0:r.complete){const{width:r,height:l}=e;try{t.drawImage(e._native,0,0,r,l)}catch(s){console.error(s)}}}static create(t,e,r){return new lg(t,{url:e,success:r})}getPictureProps(){return this._props}_draw(t){lg.drawWith(t,this)}_init(){this._props.autoWidth&&this.resize(this._native.width),this._props.autoHeight&&this.resize(void 0,this._native.height)}}const ng=["dataArray"];class og extends $a{constructor(t,e){super(t,e),this.pathLength=0,this._reCalculateCache=!0,(null==e?void 0:e.data)?this._dataArray=og.parsePathData(e.data):(null==e?void 0:e.dataArray)&&(this._dataArray=e.dataArray);for(let r=0;r{const{type:e,value:r,preValue:s}=t;if(e===ki.resize||e===ki.all){this._reCalculateCache=!0;const{left:t,top:e,width:r,height:l}=this._getSelfRect(),{width:n,height:o}=s;let i,a;i=n?this.width-n:0,a=o?this.height-o:0;const g=i/r,c=a/l;this.scaleX+=g,this.scaleY+=c,this.left=this.left-t*g,this.top=this.top-e*c,this._setTransForm()}}))}get dataArray(){return this._dataArray}static drawWith(t,e){const r=e.dataArray;if(r){t.beginPath();for(let e=0;en?s:n,b=s>n?1:s/n,h=s>n?n/s:1;t.translate(e,r),t.rotate(a),t.scale(b,h),t.arc(0,0,c,o,o+i,!!(1-g)),t.scale(1/b,1/h),t.rotate(-a),t.translate(-e,-r);break}case"z":t.closePath()}}this._renderPaintInOrder(t,e)}}static getLineLength(t,e,r,s){return Math.sqrt((r-t)*(r-t)+(s-e)*(s-e))}static getPointOnLine(t,e,r,s,l,n,o){void 0===n&&(n=e),void 0===o&&(o=r);let i=(l-r)/(s-e+1e-8),a=Math.sqrt(t*t/(1+i*i));s0&&!isNaN(r[0]);){let t,s,l,o,g,c,b,h,d,u,f,v=[],m=i,p=a;switch(e){case"l":i+=r.shift()||0,a+=r.shift()||0,t="L",v.push(i,a);break;case"L":i=r.shift()||0,a=r.shift()||0,v.push(i,a);break;case"m":{let s=r.shift()||0,l=r.shift()||0;if(i+=s,a+=l,t="M",n.length>2&&"z"===n[n.length-1].command)for(let t=n.length-2;t>=0;t--)if("M"===n[t].command){i=n[t].points[0]+s,a=n[t].points[1]+l;break}v.push(i,a),e="l";break}case"M":i=r.shift()||0,a=r.shift()||0,t="M",v.push(i,a),e="L";break;case"h":i+=r.shift()||0,t="L",v.push(i,a);break;case"H":i=r.shift()||0,t="L",v.push(i,a);break;case"v":a+=r.shift()||0,t="L",v.push(i,a);break;case"V":a=r.shift()||0,t="L",v.push(i,a);break;case"C":v.push(r.shift()||0,r.shift()||0,r.shift()||0,r.shift()||0),i=r.shift()||0,a=r.shift()||0,v.push(i,a);break;case"c":v.push(i+(r.shift()||0),a+(r.shift()||0),i+(r.shift()||0),a+(r.shift()||0)),i+=r.shift()||0,a+=r.shift()||0,t="C",v.push(i,a);break;case"S":l=i,o=a,s=n[n.length-1],"C"===s.command&&(l=i+(i-s.points[2]),o=a+(a-s.points[3])),v.push(l,o,r.shift()||0,r.shift()||0),i=r.shift()||0,a=r.shift()||0,t="C",v.push(i,a);break;case"s":l=i,o=a,s=n[n.length-1],"C"===s.command&&(l=i+(i-s.points[2]),o=a+(a-s.points[3])),v.push(l,o,i+(r.shift()||0),a+(r.shift()||0)),i+=r.shift()||0,a+=r.shift()||0,t="C",v.push(i,a);break;case"Q":v.push(r.shift()||0,r.shift()||0),i=r.shift()||0,a=r.shift()||0,v.push(i,a);break;case"q":v.push(i+(r.shift()||0),a+(r.shift()||0)),i+=r.shift()||0,a+=r.shift()||0,t="Q",v.push(i,a);break;case"T":l=i,o=a,s=n[n.length-1],"Q"===s.command&&(l=i+(i-s.points[0]),o=a+(a-s.points[1])),i=r.shift()||0,a=r.shift()||0,t="Q",v.push(l,o,i,a);break;case"t":l=i,o=a,s=n[n.length-1],"Q"===s.command&&(l=i+(i-s.points[0]),o=a+(a-s.points[1])),i+=r.shift()||0,a+=r.shift()||0,t="Q",v.push(l,o,i,a);break;case"A":g=r.shift()||0,c=r.shift()||0,b=r.shift()||0,h=r.shift()||0,d=r.shift()||0,u=i,f=a,i=r.shift()||0,a=r.shift()||0,t="A",v=this.convertEndpointToCenterParameterization(u,f,i,a,h,d,g,c,b);break;case"a":g=r.shift()||0,c=r.shift()||0,b=r.shift()||0,h=r.shift()||0,d=r.shift()||0,u=i,f=a,i+=r.shift()||0,a+=r.shift()||0,t="A",v=this.convertEndpointToCenterParameterization(u,f,i,a,h,d,g,c,b)}n.push({command:t||e,points:v,start:{x:m,y:p},pathLength:this.calcLength(m,p,t||e,v)})}"z"!==e&&"Z"!==e||n.push({command:"z",points:[],start:{x:0,y:0},pathLength:0})}return n}static calcLength(t,e,r,s){let l,n,o,i,a=og;switch(r){case"L":return a.getLineLength(t,e,s[0],s[1]);case"C":for(l=0,n=a.getPointOnCubicBezier(0,t,e,s[0],s[1],s[2],s[3],s[4],s[5]),i=.01;i<=1;i+=.01)o=a.getPointOnCubicBezier(i,t,e,s[0],s[1],s[2],s[3],s[4],s[5]),l+=a.getLineLength(n.x,n.y,o.x,o.y),n=o;return l;case"Q":for(l=0,n=a.getPointOnQuadraticBezier(0,t,e,s[0],s[1],s[2],s[3]),i=.01;i<=1;i+=.01)o=a.getPointOnQuadraticBezier(i,t,e,s[0],s[1],s[2],s[3]),l+=a.getLineLength(n.x,n.y,o.x,o.y),n=o;return l;case"A":{l=0;let t=s[4],e=s[5],r=s[4]+e,g=Math.PI/180;if(Math.abs(t-r)r;i-=g)o=a.getPointOnEllipticalArc(s[0],s[1],s[2],s[3],i,0),l+=a.getLineLength(n.x,n.y,o.x,o.y),n=o;else for(i=t+g;i1&&(o*=Math.sqrt(h),i*=Math.sqrt(h));let d=Math.sqrt((o*o*(i*i)-o*o*(b*b)-i*i*(c*c))/(o*o*(b*b)+i*i*(c*c)));l===n&&(d*=-1),isNaN(d)&&(d=0);let u=d*o*b/i,f=d*-i*c/o,v=(t+r)/2+Math.cos(g)*u-Math.sin(g)*f,m=(e+s)/2+Math.sin(g)*u+Math.cos(g)*f,p=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),_=(t,e)=>(t[0]*e[0]+t[1]*e[1])/(p(t)*p(e)),B=(t,e)=>(t[0]*e[1]=1&&(y=0),0===n&&y>0&&(y-=2*Math.PI),1===n&&y<0&&(y+=2*Math.PI),[v,m,o,i,C,y,g,n]}toJson(){const t={};return ng.forEach((e=>{this[e]&&(t[e]=this[e])})),__spreadValues(__spreadValues({},super.toJson()),t)}getState(){const{left:t,top:e,width:r,height:s}=this.getRect();return{left:t,top:e,width:r,height:s,scaleX:this.scaleX,scaleY:this.scaleY,angle:this.angle,skewX:this.skewX,skewY:this.skewY,flipX:this.flipX,flipY:this.flipY}}getRect(){const{left:t,top:e,width:r,height:s}=this._getSelfRect();return{left:t*this.scaleX+this.left,top:e*this.scaleY+this.top,width:r*this.scaleX,height:s*this.scaleY}}getLength(){return this.pathLength}getPointAtLength(t){let e,r=0,s=this.dataArray.length;if(!s)return null;for(;rthis.dataArray[r].pathLength;)t-=this.dataArray[r].pathLength,++r;if(r===s)return e=this.dataArray[r-1].points.slice(-2),{x:e[0],y:e[1]};if(t<.01)return e=this.dataArray[r].points.slice(0,2),{x:e[0],y:e[1]};let l=this.dataArray[r],n=l.points;switch(l.command){case"L":return og.getPointOnLine(t,l.start.x,l.start.y,n[0],n[1]);case"C":return og.getPointOnCubicBezier(t/l.pathLength,l.start.x,l.start.y,n[0],n[1],n[2],n[3],n[4],n[5]);case"Q":return og.getPointOnQuadraticBezier(t/l.pathLength,l.start.x,l.start.y,n[0],n[1],n[2],n[3]);case"A":{let e=n[0],r=n[1],s=n[2],o=n[3],i=n[4],a=n[5],g=n[6];return i+=a*t/l.pathLength,og.getPointOnEllipticalArc(e,r,s,o,i,g)}}return null}_draw(t){og.drawWith(t,this)}_setFixBoundingBox(){const{left:t,top:e,width:r,height:s}=this._getSelfRect(),l=this.width/r,n=this.height/s;this.left=this.left-t*l,this.top=this.top-e*n,this.scaleX=l,this.scaleY=n,this.width=r,this.height=s,this._setTransForm()}_getSelfRect(){if(!this._reCalculateCache)return this._selfRectCache;let t=[];this.dataArray.forEach((e=>{if("A"===e.command){let r=e.points[4],s=e.points[5],l=e.points[4]+s,n=Math.PI/180;if(Math.abs(r-l)l;o-=n){const r=og.getPointOnEllipticalArc(e.points[0],e.points[1],e.points[2],e.points[3],o,0);t.push(r.x,r.y)}else for(let o=r+n;o{const{type:e,value:r,preValue:s}=t;if(e===ki.resize||e===ki.all){const t=Math.min(this.width,this.height);this._radius=t/2,this.width=t,this.height=t,this._setTransForm()}}))}get radius(){return this._radius}static drawWith(t,e){let{radius:r}=e;r=null!=r?r:10,t.beginPath(),e.strokeDashArray&&t.setLineDash(e.strokeDashArray),t.beginPath(),t.arc(r,r,r||0,0,2*Math.PI,!1),t.closePath(),this._renderPaintInOrder(t,e)}toJson(){const t={};return ig.forEach((e=>{this[e]&&(t[e]=this[e])})),__spreadValues(__spreadValues({},super.toJson()),t)}_draw(t){ag.drawWith(t,this)}_setFixBoundingBox(){this.transformByState({width:2*this._radius,height:2*this._radius})}}function gg(t){return null==t?void 0:t[t.length-1]}function cg(t){var e;return null==(e=null==t?void 0:t.sections)?void 0:e[t.sections.length-1]}function bg(t){var e;const r=null==(e=fg(t))?void 0:e.column.lines;return null==r?void 0:r[r.length-1]}function hg(t){return t.lines[t.lines.length-1]}function dg(t){const{width:e,marginLeft:r,marginRight:s}=t;return e-r-s}function ug(t){var e;const r=null==(e=t.parent)?void 0:e.parent;if(r)return r}function fg(t){const e=cg(t);for(let r=0;r1)return!1;const e=cg(t),r=e.columns.length;for(let s=0;s1)return!1;return function(t){if(!t)return!0;for(let e=0;e1)return!1;if(1===r){const r=t.divides[e].spanGroup[0],{spanType:s}=r;if(s!==Si.TAB&&s!==Si.LIST)return!1}}return!0}(e[e.length-1])}function Bg(t,e){if(t instanceof Object){const{v:r,u:s}=t;return s===it.POINT?r:r*e}return t}function Cg(t=0,e,r=R.LINES,s=_e.TRUE){let l=1;return wg(r,s)&&(l=t),l*=e,l}function wg(t=R.LINES,e=_e.FALSE){return e===_e.TRUE&&(t===R.LINES_AND_CHARS||t===R.SNAP_TO_CHARS)}function Tg(t,e){const{paragraphStyle:r={}}=e,{linePitch:s=15.6,gridType:l=R.LINES,paragraphLineGapDefault:n=0}=t,{lineSpacing:o=1,spacingRule:i=V.AUTO,snapToGrid:a=_e.TRUE}=r;return{paragraphLineGapDefault:n,linePitch:s,gridType:l,lineSpacing:o,spacingRule:i,snapToGrid:a}}function yg(t,e){const{paragraphStyle:r={}}=e,{charSpace:s=0,gridType:l=R.LINES,defaultTabStop:n=36,documentTextStyle:o={}}=t,{fs:i=ni}=o,{snapToGrid:a=_e.TRUE}=r;return{charSpace:s,documentFontSize:i,defaultTabStop:n,gridType:l,snapToGrid:a}}function Sg(t,e=-1){t[0];let r=e;for(let s of t){const{sections:t}=s;let e=r,l=e,n=-1/0,o=0;for(let r of t){const{columns:t}=r;let e=l,s=e,i=-1/0;for(let r of t){const{lines:t}=r;let e=s,l=e,o=0,a=-1/0,g=null;for(let r of t){const{divides:t,lineHeight:e}=r;let s=l,n=s,i=0,c=0;o+=e;const b=t.length;for(let r=0;r=e.st?o:e.st,n=e.ed}r.st=0===s?0:s+1,r.ed=n>=r.st?n:r.st,r.width=i,r.asc=c,a=Math.max(a,i),r.top=((null==g?void 0:g.top)||0)+((null==g?void 0:g.lineHeight)||0),g=r,l=r.ed}r.st=0===e?0:e+1,r.ed=l>=r.st?l:r.st,r.height=o,r.width===1/0&&(r.width=a),n=Math.max(n,a),i=Math.max(i,r.height),s=r.ed}r.st=0===e?0:e+1,r.ed=s>=r.st?s:r.st,r.height=i,o+=i,l=r.ed}s.st=0===e?0:e+1,s.ed=l>=s.st?l:s.st,s.height=o,s.width=n,r=s.ed}}function jg(t,e){for(let r of t){const{sections:t}=r;for(let r of t){const{columns:t}=r;for(let r of t){const{lines:t}=r;for(let r of t)e&&ta(e)&&e(r)}}}}function Eg(t,e){for(let r of t){const{sections:t}=r;for(let r of t){const{columns:t}=r;for(let r of t)e&&ta(e)&&e(r)}}}function Yg(t,e,r,s,l=!1){const{relativeFrom:n,align:o,posOffset:i,percent:a}=t;if(null!=o)if(o===gt.INSIDE||o===gt.OUTSIDE)n===st.MARGIN||st.PAGE;else{if(n===st.COLUMN){const{width:t,left:r}=e;let l=0;return o===gt.LEFT?l=r:o===gt.RIGHT?l=r+t-s:o===gt.CENTER&&(l=r+t/2-s/2),l}if(n===st.LEFT_MARGIN);else if(n===st.MARGIN);else if(n===st.RIGHT_MARGIN);else if(n===st.INSIDE_MARGIN);else if(n===st.OUTSIDE_MARGIN);else if(n===st.PAGE){const{width:t}=r;let e=0;return o===gt.RIGHT?e=t-s:o===gt.CENTER&&(e=t/2-s/2),e}}else{if(i){const{width:t,marginLeft:o,marginRight:a}=r,g=t-a;let c=0;return n===st.COLUMN?c=(l?0:(null==e?void 0:e.left)||0)+i:n===st.LEFT_MARGIN||(n===st.MARGIN?c=i+o:n===st.RIGHT_MARGIN||n===st.INSIDE_MARGIN||n===st.OUTSIDE_MARGIN||n===st.PAGE&&(c=i)),c+s>g&&(c=g-s),c}if(a){const{width:t,marginLeft:e,marginRight:s}=r;if(n===st.LEFT_MARGIN);else if(n===st.MARGIN);else if(n===st.RIGHT_MARGIN);else if(n===st.INSIDE_MARGIN);else if(n===st.OUTSIDE_MARGIN);else if(n===st.PAGE)return a*t}}}function Rg(t,e,r,s,l,n,o=!1){const{relativeFrom:i,align:a,posOffset:g,percent:c}=t;if(null!=a){if(i===nt.LINE){let t=0;return a===bt.BOTTOM?t=r+s-l:a===bt.TOP?t=r:a===bt.CENTER&&(t=r+s/2-l/2),t}if(i===nt.TOP_MARGIN);else if(i===nt.MARGIN);else if(i===nt.BOTTOM_MARGIN);else if(i===nt.INSIDE_MARGIN);else if(i===nt.OUTSIDE_MARGIN);else if(i===nt.PAGE){const{height:t}=e;let r=0;return a===bt.BOTTOM?r=t-l:a===bt.CENTER&&(r=t/2-l/2),r}}else{if(g){let t=0;return i===nt.LINE?t=r||0+g:i===nt.TOP_MARGIN||i===nt.MARGIN||i===nt.BOTTOM_MARGIN||i===nt.INSIDE_MARGIN||i===nt.OUTSIDE_MARGIN||(i===nt.PAGE?t=g:i===nt.PARAGRAPH&&(t=(o?0:null==n?r:n)+g)),t}if(c){const{height:t,marginBottom:r,marginTop:s}=e;if(i===nt.TOP_MARGIN);else if(i===nt.MARGIN);else if(i===nt.BOTTOM_MARGIN);else if(i===nt.INSIDE_MARGIN);else if(i===nt.OUTSIDE_MARGIN);else if(i===nt.PAGE)return c*t}}}function Ig(t){const e=t.spanGroup;let r=0;for(let s of e)r+=s.width;return r}function Ag(t=[],e=O.NONE,r=0,s=0,l=1/0,n=1/0){const o=[];let i=0,a=0;if(0===t.length)o.push(Og(s,l,0,O.NONE));else for(let c=0;c{t.parent=g})),g}function xg(t,e){t.isFull=e}function Og(t,e,r,s){return{lines:[],left:t,width:e,height:0,spaceWidth:r,separator:s,st:0,ed:0,drawingLRIds:[],isFull:!1}}function Ng(t,e,r,s){return r in T?function(t,e,r){if(r===T.DECIMAL)return kg(t,e);if(r===T.ZERO_DECIMAL)return function(t,e){const r=t+e;if(r<10)return`0${r}`;return r.toString()}(t,e);if(r===T.UPPER_ALPHA)return function(t,e){return Ss(t+e-1,!0)}(t,e);if(r===T.ALPHA)return function(t,e){return Ss(t+e-1,!1)}(t,e);if(r===T.UPPER_ROMAN)return function(t,e){return Mg(t+e,!0)}(t,e);if(r===T.ROMAN)return function(t,e){return Mg(t+e,!1)}(t,e);return kg(t,e)}(t,e,r):Da(t,e,r,s)}function kg(t,e){return(t+e).toString()}function Mg(t,e=!1){let r={m:1e3,cm:900,d:500,cd:400,c:100,xc:90,l:50,xl:40,x:10,ix:9,v:5,iv:4,i:1};e&&(r={M:1e3,CM:900,D:500,CD:400,C:100,XC:90,L:50,XL:40,X:10,IX:9,V:5,IV:4,I:1});let s="";for(let l in r)for(;t>=r[l];)s+=l,t-=r[l];return s}function Dg(t,e,r,s,l){var n,o;if(!t||!e)return;const{listId:i,nestingLevel:a=0,textStyle:g}=t,c=e[i];if(!c||!c.nestingLevel)return Lg(i,null==(n=null==r?void 0:r[a])?void 0:n.startIndexItem,s);if(!c.nestingLevel[a])return Lg(i,null==(o=null==r?void 0:r[a])?void 0:o.startIndexItem,s);return function(t,e,r,s,l,n,o){var i,a;const g=r[e],{bulletAlignment:c,glyphFormat:b,textStyle:h,startNumber:d,glyphType:u,glyphSymbol:f,indentFirstLine:v,hanging:m,indentStart:p}=g,_=__spreadValues(__spreadValues({},l),h),B=la(_,n);let C;C=f||function(t,e,r,s,l){var n;const o=t.split("%"),i=[o[0]];for(let a=1;a{!l&&n.test(`${r}${t}`)?r+=t:(l=!0,s+=t)})),{level:parseInt(r)-1,suffix:s}}function Fg(t,e,r){return Wg(Si.WORD,t,e,r)}function Ug(t,e,r){return Wg(Si.LETTER,t,e,r)}function zg(t,e){return Wg(Si.TAB," ",t,e)}function Wg(t,e,r,s){const{fontStyle:l,textStyle:n,charSpace:o=1,gridType:i=R.LINES,snapToGrid:a=_e.FALSE}=r,g=pi.getTextSize(e,l),{width:c=0}=g;let b=null!=s?s:c,h=0;if(wg(i,a)){b=Math.ceil(c/o)*o,i===R.LINES_AND_CHARS&&(h=(b-c)/2)}return{content:e,ts:n,fontStyle:l,width:b,bBox:g,paddingLeft:h,left:0,spanType:t}}function Vg(t,e,r){const{bBox:s,symbol:l,ts:n,fontStyle:o,bulletAlign:i=S.START,bulletType:a=!1}=e,g=s.width,c=Math.ceil(g/r);let b=(c<2?2:c)*r,h=0;a&&(i===S.CENTER?(h=-g/2,b-=h):i===S.END&&(h=-g,b-=h));return{content:l,ts:n,fontStyle:o,width:b,paddingLeft:0,bBox:function(t,e){const{ba:r,bd:s}=t.bBox,{ba:l,bd:n}=e.bBox;if(r+s>l+n)return t.bBox;return e.bBox}(t,e),left:h,spanType:Si.LIST}}function Gg(t,e=0){const r=t.length;let s;for(let l=0;ll)break;o.push(e),i+=r,a=g}}return{charIndex:a,spanGroup:o}}(t,e,r,s)}var Qg,Kg,Zg,$g,qg,Jg;function tc(t,e,r,s,l=0,n=0,o=!1,i,a,g){const{lineHeight:c=15.6,lineTop:b=0,contentHeight:h=0,paddingLeft:d=0,paddingRight:u=0,paddingTop:f=0,paddingBottom:v=0,marginTop:m=0,spaceBelowApply:p=0}=r,_=function(t,e){return{blockId:e,type:t,divides:[],lineHeight:0,contentHeight:0,top:0,asc:0,paddingTop:0,paddingBottom:0,marginTop:0,marginBottom:0,spaceBelowApply:0,divideLen:0,st:-1,ed:-1,lineIndex:0,paragraphStart:!1}}(e,t);_.lineIndex=l,_.paragraphStart=gc(n,o),_.contentHeight=h,_.top=b,_.lineHeight=c,_.paddingTop=f,_.paddingBottom=v,_.marginTop=m,_.spaceBelowApply=p,_.divides=function(t,e,r,s,l,n,o,i){const a=[];return a.push({left:0,width:s},{left:r-l,width:l}),null==o||o.forEach(((s,l)=>{const n=lc(s,t,e,r);n&&a.push(n)})),null==i||i.forEach(((s,l)=>{const n=lc(s,t,e,r);n&&a.push(n)})),null==n||n.forEach(((s,l)=>{const n=lc(s,t,e,r);n&&a.push(n)})),function(t,e){e.sort(((t,e)=>t.left>e.left?1:-1));const r=[];let s=0;const l=e.length;for(let n=0;ns){let e=i-s;e=e{const s=rc(r,t,e);s&&(o=Math.max(o,s))})),null==n||n.forEach((r=>{const s=rc(r,t,e);s&&(o=Math.max(o,s))})),null==s||s.forEach((r=>{const s=rc(r,t,e);s&&(o=Math.max(o,s))})),o}function rc(t,e,r,s){const{aTop:l,height:n,aLeft:o,width:i,angle:a=0,drawingOrigin:g}=t,{layoutType:c,distT:b=0,distB:h=0}=g;if(c!==F.WRAP_TOP_AND_BOTTOM)return;if(0===a){const t=l-b;if(t+(n+h)e+r)return;return t+n}let{top:d=0,height:u=0}=nc(a,o,i,l,n);return d-=b,u+=h,d+ue+r?void 0:d+u}function sc(t,e){t.isFull=e}function lc(t,e,r,s){const{aTop:l,height:n,aLeft:o,width:i,angle:a=0,drawingOrigin:g}=t,{layoutType:c}=g;if(c===F.WRAP_NONE||c===F.WRAP_TOP_AND_BOTTOM)return;if(c===F.WRAP_POLYGON){const{start:t=[0,0],lineTo:l}=g;if(!l)return;let n=[];n.push(new Sa(t[0],t[1]));for(let e=0;en+l)return;let f=r-c,v=s+b,m=function(t,e,r,s){let l=0;t===P.LEFT?l=1:t===P.RIGHT?l=2:t===P.LARGEST&&(l=e>s-e-r?1:2);return l}(g,f,v,o);return 1===m?v=o-f:2===m&&(f=0,v=r+s+b),{left:f,width:v}}function ac(t,e){return{spanGroup:[],width:e,left:t,paddingLeft:0,isFull:!1,st:0,ed:0}}function gc(t,e){return 0===t&&!0===e}function cc(t,e,r,s){if(s)if(s.has(t)){const r=s.get(t);null==r||r.elements.push(e)}else s.set(t,{elements:[e],blockId:t,top:r})}function bc(t,e){const r=t.parent;if(null!=r){const t=null==r.divides[0].spanGroup[0],s=e[0],l=s.content||" ";if(t&&" "===l){const t=s.width;s.width=0;for(let r of e)r!==s&&(r.left-=t)}}t.spanGroup.push(...e)}function hc(t,e,r,s,l=0,n=!1){if(gc(l,n))if(s.bulletSkeleton){const{bulletSkeleton:o,paragraphStyle:i={}}=s,{gridType:a=R.LINES,charSpace:g=0,defaultTabStop:c=1}=r,{snapToGrid:b=_e.TRUE}=i,h=Cg(g,c,a,b);!function(t,e,r){const{hanging:s,indentStart:l}=t,{hanging:n,indentStart:o}=e;void 0===s&&(t.hanging=n);void 0===l&&(t.indentStart=Bg(o||0,r)-Bg(n||0,r))}(i,o,h);uc([Vg(t[0],o,h),...t],e,r,s,l,n)}else uc(t,e,r,s,l,n);else dc(t,e,r,s,l,n);return[...e]}function dc(t,e,r,s,l=0,n=!1,o){var i,a;const g=gg(e),c=vg(g);if(c){const b=function(t){const e=t.length;let r=0;for(let s=0;sh.width){sc(h,!0);const i=ug(h);b>v?pg(g)?(bc(h,t),function(t=[]){for(let e=0;ei.width?(xg(i,!0),_g(i)?(console.log(t),bc(h,t)):fc(t,e,r,s,l,n,o)):c.isLast?uc(t,e,r,s,l,n,o):dc(t,e,r,s,l,n,o)}else{const o=h.parent,i=function(t){const e=t.length;let r,s=-1/0;for(let l=0;l2?(g=[i[0],i[1]],c=2):g=[i[0]];const b=o.parent;null==b||b.lines.pop(),uc(g,e,r,s,l,n,u+f);for(let t=c;tn&&(n=0,l.lineHeight+=t,l.marginBottom=t)}return{marginTop:n,spaceBelowApply:o}}(rt,Y,R,q,f),nt=st+J+et+tt;let ot=u.parent;ot||(ot=cg(h));const it=((null==f?void 0:f.lineHeight)||0)+((null==f?void 0:f.top)||0),{width:at,headerId:gt,footerId:ct}=h,bt=null==(a=null==(i=null==C?void 0:C.get(gt))?void 0:i.get(at))?void 0:a.skeDrawings,ht=null==(c=null==(g=null==w?void 0:w.get(ct))?void 0:g.get(at))?void 0:c.skeDrawings;!function(t,e,r,s,l){var n;if(!l)return;const o=null==(n=r.parent)?void 0:n.parent;if(!o)return;const i=new Map,a=function(t){const e=t.parent;if(!e)return!1;const r=null==e?void 0:e.columns;if(!r)return!1;for(let s=r.length-1;s>=0;s--){const t=r[s].lines,e=t.length;if(!(e<=0))for(let r=e-1;r>=0;r--){if(t[r].paragraphStart)return!1}}return!0}(r);l.forEach((l=>{if(!l)return;const{initialState:n,drawingOrigin:g}=l;if(n||!g)return;const{objectProperties:c}=g,{positionH:b,positionV:h,size:d,angle:u}=c,{width:f=0,height:v=0}=d;l.aLeft=Yg(b,r,o,f,a)||0,l.aTop=Rg(h,o,t,e,v,s,a)||0,l.width=f,l.height=v,l.angle=u,l.initialState=!0,i.set(l.objectId,l)})),o.skeDrawings=new Map([...o.skeDrawings,...i])}(it,nt,u,null==(b=null==T?void 0:T.get(y))?void 0:b.top,B);const dt=ec(nt,it,l,h.skeDrawings,bt,ht);if(nt+dt>ot.height&&u.lines.length>0&&h.sections.length>0)return xg(u,!0),void fc(t,e,r,s,l,n,o);const ut=f?f.lineIndex+1:0,{charSpace:ft,defaultTabStop:vt}=yg(r,s),mt=Cg(ft,vt,$,Z),{paddingLeft:pt,paddingRight:_t,changeBulletWidth:Bt}=function(t,e=0,r=0,s=0,l=0,n){const{spanType:o=Si.LETTER,bBox:i}=t;let a=Bg(e,n),g=Bg(r,n),c=Bg(s,n),b=Bg(l,n),h=c,d=b,u={state:!1,hangingNumber:0};if(o===Si.LIST){const{width:t}=i;a>0?h+=a:g>0&&g>t&&(u.state=!0,u.hangingNumber=g)}else h+=g;return{paddingLeft:h,paddingRight:d,changeBulletWidth:u}}(t[0],k,M,D,L,mt);Bt.state&&(t[0].width=Bt.hangingNumber);const Ct=tc(y,Ti.PARAGRAPH,{lineHeight:nt,contentHeight:et,lineTop:dt,paddingLeft:pt,paddingRight:_t,paddingTop:J,paddingBottom:tt,marginTop:st,spaceBelowApply:lt},u.width,ut,l,n,h.skeDrawings,bt,ht);u.lines.push(Ct),Ct.parent=u,cc(y,Ct,it,T),dc(t,e,r,s,l,n,o)}function fc(t,e,r,s,l=0,n=!1,o){!0===mg(gg(e))?vc(t,e,r,s,l,n,o):uc(t,e,r,s,l,n,o)}function vc(t,e,r,s,l=0,n=!1,o){const i=gg(e),{skeHeaders:a,skeFooters:g}=s;e.push(yc(r,{skeHeaders:a,skeFooters:g},null==i?void 0:i.pageNumber)),fc(t,e,r,s,l,n,o)}function mc(t,e,r,s,l,n,o){let i=e,a=e;if(s===R.DEFAULT||o===_e.FALSE)return n===V.AUTO?{paddingTop:i,paddingBottom:a,contentHeight:l*t,lineSpacingApply:t}:{paddingTop:i,paddingBottom:a,contentHeight:Math.max(l,t),lineSpacingApply:l};let g=0;return g=n===V.AUTO?l*r:l,t+2*e{!function(t,e){if(e===ie.UNSPECIFIED||e===ie.LEFT)return;const{divides:r}=t,s=r.length;for(let l=0;l=0;i--){const t=null==l?void 0:l[i];o[i]=t||null}return o}(C,y),p,n);return function(t,e,r){if(!t||!e)return;const{listId:s,nestingLevel:l}=t,n=[...(null==r?void 0:r.get(s))||[]];n[l]=e,n.splice(l+1),null==r||r.set(s,n)}(C,I,y),j.bulletSkeleton=I,_.forEach(((t,e)=>{const{eId:r,et:s}=t;if(s===D.DRAWING){const t=m[r];t.layoutType===F.INLINE||R.set(r,function(t){return{objectId:t.objectId,aLeft:0,aTop:0,width:0,height:0,angle:0,initialState:!1,drawingOrigin:t}}(t))}})),_.forEach(((t,e)=>{const{eId:r,et:n}=t;let o=[];if(n===D.TEXT_RUN){const{tr:r,st:l,ed:n}=t;if(!r)return!1;o=pc(r,e,s,Y,__spreadProps(__spreadValues({},j),{paragraphAffectSkeDrawings:R}),p)}else if(n===D.PAGE_BREAK)o=[yc(s,l,Bc(Y),Ci.PAGE)],R.clear();else if(n===D.COLUMN_BREAK){const t=fg(Y);t&&!t.isLast?xg(t.column,!0):o=[yc(s,l,Bc(Y),Ci.COLUMN)]}Y=function(t,e){const r=t.slice(-1)[0],s=e[0];if(r===s){if(1===e.length)return r;e.shift()}return t.push(...e),t.slice(-1)[0]}(E,o)})),E}function Bc(t){return t.pageNumber+1}(Kg=Qg||(Qg={}))[Kg.BOTH=0]="BOTH",Kg[Kg.LEFT=1]="LEFT",Kg[Kg.RIGHT=2]="RIGHT",($g=Zg||(Zg={}))[$g.X=0]="X",$g[$g.Y=1]="Y";function Cc(){return[]}function wc(t,e,r,s,l,n){const o=[],i=new Map;for(let a of t){const{paragraph:t,table:g,tableOfContents:c,blockType:b,customBlock:h,blockId:d}=a;if(null==l?void 0:l.get(d))continue;let u=[],f=e;o.length>0&&(f=o[o.length-1]),b===E.PARAGRAPH&&t?u=_c(a.blockId,t,f,r,s,n):b===E.TABLE&&g||b===E.SECTION_BREAK&&c||b===E.CUSTOM&&(u=Ma(a.blockId,h,f,r,s,n)),0===u.length&&(u=[]),Tc(o,u),i.set(d,!0)}return{pages:o,renderedBlockIdMap:i}}function Tc(t,e){t[t.length-1]===e[0]&&e.splice(0,1),t.push(...e)}function yc(t,e,r=1,s=Ci.SECTION){var l,n,o,i;const a={sections:[],headerId:"",footerId:"",pageWidth:0,pageHeight:0,pageOrient:ft.PORTRAIT,pageNumber:1,pageNumberStart:1,verticalAlign:!1,angle:0,width:0,height:0,marginLeft:0,marginRight:0,marginTop:0,marginBottom:0,breakType:Ci.SECTION,st:0,ed:0,skeDrawings:new Map},{pageNumberStart:g=1,pageSize:c={width:1/0,height:1/0},pageOrient:b=ft.PORTRAIT,headerIds:h={},footerIds:d={},useFirstPageHeaderFooter:u,useEvenPageHeaderFooter:f,footers:v,headers:m,columnProperties:p=[],columnSeparatorType:_,marginTop:B=0,marginBottom:C=0,marginHeader:w=0,marginFooter:T=0,marginLeft:y=0,marginRight:S=0,renderConfig:j={}}=t,{skeHeaders:E,skeFooters:Y}=e,{width:R=1/0,height:I=1/0}=c;a.pageNumber=r,a.pageNumberStart=g,a.renderConfig=j,a.marginLeft=y,a.marginRight=S,a.breakType=s,a.width=a.pageWidth=R,a.height=a.pageHeight=I,a.pageOrient=b;const{defaultHeaderId:A,evenPageHeaderId:x,firstPageHeaderId:O}=h,{defaultFooterId:N,evenPageFooterId:k,firstPageFooterId:M}=d;let D,L,P=null!=A?A:"",H=null!=N?N:"";r===g&&u?(P=null!=O?O:"",H=null!=M?M:""):r%2==0&&f&&(P=null!=x?x:"",H=null!=k?k:""),P&&((null==(l=E.get(P))?void 0:l.has(R))?D=null==(n=E.get(P))?void 0:n.get(R):m&&(D=Sc(m[P],t,e),E.set(P,new Map([[R,D]]))),a.headerId=P),H&&((null==(o=Y.get(H))?void 0:o.has(R))?L=null==(i=Y.get(H))?void 0:i.get(R):v&&(L=Sc(v[H],t,e),Y.set(P,new Map([[R,L]]))),a.footerId=H),a.marginTop=jc(B,w,D),a.marginBottom=jc(C,T,L);const F=a.sections,U=F[F.length-1],{marginTop:z,marginBottom:W,marginLeft:V,marginRight:G}=a,X=R-V-G,Q=I-z-W;let K=0;U&&(K=U.top+U.height);const Z=Ag(p,_,K,0,X,Q-K);return Z.parent=a,F.push(Z),a}function Sc(t,e,r,s=!0){const{body:l}=t,{lists:n,headers:o,footers:i,fontLocale:a,pageSize:g,marginLeft:c=0,marginRight:b=0,drawings:h,marginTop:d=0,marginBottom:u=0,marginHeader:f=0,marginFooter:v=0}=e,m={lists:n,headers:o,footers:i,pageSize:{width:((null==g?void 0:g.width)||1/0)-c-b,height:1/0},fontLocale:a,drawings:h},{blockElements:p}=l,_=[];p.forEach((t=>{_.push(t)}));const B=yc(m,r),C=wc(_,B,m,r).pages[0];Sg([C]);const w=C.sections[0].columns[0],T=w.height||0,{skeDrawings:y,st:S,ed:j}=C,E={lines:w.lines,skeDrawings:y,height:T,st:S,ed:j,marginLeft:c,marginRight:b};return __spreadProps(__spreadValues({},E),s?{marginTop:Ec(d,f,T)}:{marginBottom:Yc(u,v,T)})}function jc(t,e,r){return r&&0!==r.lines.length?Math.max(t,e,(null==r?void 0:r.height)||0):t}function Ec(t,e,r){const s=Math.max(t,e);return r>s?0:s-r}function Yc(t,e,r){const s=Math.max(t,e);return r>s?0:s-r}class Rc{constructor(t){this._dirty=!0,this._context=t,this._localeInitial()}get dirty(){return this._dirty}getFontLocale(){return this._fontLocale}getContext(){return this._context}makeDirty(t){this._dirty=t}_localeInitial(){if(!this._context)return;const t=this._context.getUniver().getGlobalContext().getLocale(),e=t.getObject("renderFont");e||t.load({en:Qo,zh:Xo}),this._fontLocale=e}}(Jg=qg||(qg={})).PENDING="pending",Jg.CALCULATING="calculating",Jg.READY="ready",Jg.INVALID="invalid";class Ic extends Rc{constructor(t,e){super(e),this.onRecalculateChangeObservable=new o,this._renderedBlockIdMap=new Map,this._documentData=t}static create(t,e){return new Ic(t,e)}updateDrawing(t,e){const r=this._documentData.drawings;if(!r)return;const s=r[t];if(!s)return;const l=s.objectProperties;l.size.width=e.width,l.size.height=e.height,l.positionH.posOffset=e.left,l.positionV.posOffset=e.top}calculate(t){this.dirty&&(this._skeletonData=this._createSkeleton(t),this.onRecalculateChangeObservable.notifyObservers(this._skeletonData))}getSkeletonData(){return this._skeletonData}getPageSize(){return this._documentData.documentStyle.pageSize}updateDocumentDataPageSize(t,e){const r=this._documentData.documentStyle;if(!r.pageSize)return t=null!=t?t:1/0,e=null!=e?e:1/0,void(r.pageSize={width:t,height:e});void 0!==t&&(r.pageSize.width=t),void 0!==e&&(r.pageSize.height=e)}__getContentMapArr(){const{body:t}=this._documentData;if(!t)return[];const{blockElements:e}=t;if(0===e.length)return[];const r=[];let s={blockElements:[],sectionBreak:void 0};return e.forEach((t=>{const{sectionBreak:e}=t;e?(s.sectionBreak=e,r.push(s),s={blockElements:[],sectionBreak:void 0}):s.blockElements.push(t)})),s.sectionBreak||(s.sectionBreak={columnProperties:[],columnSeparatorType:O.NONE,sectionType:A.SECTION_TYPE_UNSPECIFIED},s.blockElements.length>0&&r.push(s)),r}_createSkeleton(t){var e;const r=this.__getContentMapArr(),s={width:1/0,height:1/0},{documentStyle:l,footers:n,headers:o,lists:i,drawings:a}=this._documentData,{pageNumberStart:g=1,pageSize:c=s,pageOrient:b=ft.PORTRAIT,defaultHeaderId:h,defaultFooterId:d,evenPageHeaderId:u,evenPageFooterId:f,firstPageHeaderId:v,firstPageFooterId:m,useFirstPageHeaderFooter:p,useEvenPageHeaderFooter:_,marginTop:B=0,marginBottom:C=0,marginRight:w=0,marginLeft:T=0,marginHeader:y=0,marginFooter:S=0,charSpace:j=0,linePitch:E=15.6,gridType:Y=R.LINES,paragraphLineGapDefault:I=0,defaultTabStop:x=10.5,textStyle:N={fs:14},renderConfig:k={horizontalAlign:ie.UNSPECIFIED,verticalAlign:ge.UNSPECIFIED,centerAngle:0,vertexAngle:0,wrapStrategy:be.UNSPECIFIED}}=l,M=this.__getNullSke();if(0===r.length)return M;const D={footers:n,headers:o,lists:i,drawings:a,charSpace:j,linePitch:E,gridType:Y,fontLocale:this.getFontLocale(),paragraphLineGapDefault:I,defaultTabStop:x,documentTextStyle:N},{skeHeaders:L,skeFooters:P,skeListLevel:H,blockAnchor:F}=M,U={skeHeaders:L,skeFooters:P,skeListLevel:H,blockAnchor:F},z=[];M.pages=z;for(let R=0;R{var e;null==(e=null==t?void 0:t.getEngine())||e.onTransformChangeObservable.add((t=>{this.resizeCacheCanvas()})),this.resizeCacheCanvas()}))}getSkeleton(){return this._skeleton}setSkeleton(t){this._skeleton=t}render(t,e){if(!this.visible)return this.makeDirty(!1),this;if(!this._skeleton)return;const r=this.transform.getMatrix();t.save(),t.transform(r[0],r[1],r[2],r[3],r[4],r[5]),this._draw(t,e),t.restore()}getParentScale(){if(!this.parent)return{scaleX:1,scaleY:1};let{scaleX:t=1,scaleY:e=1}=this.parent;return this.parent.classType===fi.SCENE&&(t=this.parent.ancestorScaleX||1,e=this.parent.ancestorScaleY||1),{scaleX:t,scaleY:e}}_getBounding(t){}_draw(t,e){}}class Oc{constructor(){this.translateX=0,this.translateY=0}draw(t,e,r){}clearCache(){}_getScale(t){return fa(t)}}const Nc=go.create(),kc=go.create(),Mc=go.create(),Dc=go.create();var Lc,Pc;(Pc=Lc||(Lc={}))[Pc.SPAN=0]="SPAN",Pc[Pc.LINE=1]="LINE";class Hc extends Oc{constructor(){super(...arguments),this.type=0,this.translateX=0,this.translateY=0}}Dc.add(new class extends Hc{constructor(){super(...arguments),this.uKey="DefaultDocsFontAndBaseLineExtension",this.zIndex=20,this._preFontString="",this._preFontColor=""}draw(t,e,r){var s;if(!(null==(s=r.parent)?void 0:s.parent))return;const{ts:l,content:n,fontStyle:o,bBox:i}=r;let{spanPointWithFont:a=Sa.create(0,0)}=this.extensionOffset;if(!l)return void(null!=n&&t.fillText(n,a.x,a.y));if(null==n)return;this._preFontString!==(null==o?void 0:o.fontString)&&(t.font=this._preFontString=(null==o?void 0:o.fontString)||"");const{cl:g,va:c}=l,b=xr(g)||ci;if(b&&this._preFontColor!==b&&(t.fillStyle=b),c===me.SUBSCRIPT||c===me.SUPERSCRIPT){let t=i.spo;c===me.SUPERSCRIPT&&(t=-i.sbo),a.y+=t}t.fillText(n,a.x,a.y)}clearCache(){this._preFontString="",this._preFontColor=""}});Dc.add(new class extends Hc{constructor(){super(...arguments),this.uKey="DefaultDocsBackgroundExtension",this.zIndex=10,this._preBackgroundColor=""}draw(t,e,r){var s;const l=null==(s=r.parent)?void 0:s.parent;if(!l)return;const{lineHeight:n=0}=l,{ts:o,width:i,content:a}=r;if(!o)return;const{bg:g}=o;if(!g)return;const c=xr(g),{spanStartPoint:b=Sa.create(0,0)}=this.extensionOffset;c&&(t.fillStyle=c,t.fillRect(b.x-.5,b.y,i+1,n))}clearCache(){this._preBackgroundColor=""}});Dc.add(new class extends Hc{constructor(){super(...arguments),this.uKey="DefaultDocsLineExtension",this.zIndex=40,this._preBackgroundColor=""}draw(t,e,r){var s;const l=null==(s=r.parent)?void 0:s.parent;if(!l)return;const{asc:n=0,lineHeight:o=0}=l,{ts:i,left:a,width:g,bBox:c}=r;if(!i)return;const{sp:b}=c,h=fa(e),{ul:d,st:u,ol:f}=i,{originTranslate:v=Sa.create(0,0),centerPoint:m=Sa.create(0,0),alignOffset:p=Sa.create(0,0),renderConfig:_={}}=this.extensionOffset,{centerAngle:B=0,vertexAngle:C=0}=_;if(d){const{s:e,cl:r,t:s}=d;if(e===_e.TRUE){t.beginPath();const e=xr(r)||ci;t.strokeStyle=e,this._setLineType(t,s||ne.SINGLE);const l=sa(o+1-.5,h),n=Aa(v.addByPoint(a,l),m,B,C,p),i=Aa(v.addByPoint(a+g,l),m,B,C,p);t.moveTo(n.x,n.y),t.lineTo(i.x,i.y),t.stroke()}}if(u){const{s:e,cl:r,t:s}=u;if(e===_e.TRUE){t.beginPath();const e=xr(r)||ci;t.strokeStyle=e,this._setLineType(t,s||ne.SINGLE);const l=sa(b-.5,h),n=Aa(v.addByPoint(a,l),m,B,C,p),o=Aa(v.addByPoint(a+g,l),m,B,C,p);t.moveTo(n.x,n.y),t.lineTo(o.x,o.y),t.stroke()}}if(f){const{s:e,cl:r,t:s}=f;if(e===_e.TRUE){t.beginPath();const e=xr(r)||ci;t.strokeStyle=e,this._setLineType(t,s||ne.SINGLE);const l=sa(-1.5,h),n=Aa(v.addByPoint(a,l),m,B,C,p),o=Aa(v.addByPoint(a+g,l),m,B,C,p);t.moveTo(n.x,n.y),t.lineTo(o.x,o.y),t.stroke()}}}clearCache(){this._preBackgroundColor=""}_setLineType(t,e){e===ne.DASH_DOT_DOT_HEAVY||e===ne.DOT_DOT_DASH?t.setLineDash([2,2,5,2,2]):e===ne.DASH_DOT_HEAVY||e===ne.DOT_DASH?t.setLineDash([2,5,2]):e===ne.DOTTED||e===ne.DOTTED_HEAVY?t.setLineDash([2]):e===ne.DASH||e===ne.DASHED_HEAVY?t.setLineDash([3]):e===ne.DASH_LONG||e===ne.DASH_LONG_HEAVY?t.setLineDash([6]):t.setLineDash([0])}_getLineWidth(t){let e=1;return t===ne.WAVY_HEAVY||t===ne.DASHED_HEAVY||t===ne.DOTTED_HEAVY||t===ne.DASH_DOT_HEAVY||t===ne.DASH_LONG_HEAVY||t===ne.DASH_DOT_DOT_HEAVY?e=2:t===ne.THICK&&(e=3),e}});Dc.add(new class extends Hc{constructor(){super(...arguments),this.uKey="DefaultDocsBorderExtension",this.zIndex=30,this._preBorderColor=""}draw(t,e,r){var s;const l=null==(s=r.parent)?void 0:s.parent;if(!l)return;const{asc:n=0,lineHeight:o=0}=l,{ts:i,left:a,width:g}=r;if(!i)return;const{bd:c}=i;if(!c)return;const b=this._getScale(e),h=this._createBorderCache(c),{spanStartPoint:d=Sa.create(0,0)}=this.extensionOffset;for(let u of h.keys()){const e=h.get(u);if(!e)continue;const{s:r,cl:s}=e,l=xr(s)||ci;r!==this._preBorderStyle&&(Ra(t,r),t.lineWidth=Ia(r)/b,this._preBorderStyle=r),l!==this._preBorderColor&&(t.strokeStyle=l||ci,this._preBorderColor=l),Ya(t,u,{startX:d.x,startY:d.y,endX:d.x+g,endY:d.y+o})}}clearCache(){this._preBorderStyle=null,this._preBorderColor=""}_createBorderCache(t){const{t:e,b:r,l:s,r:l}=t,n=new Map;return e&&n.set(bi.TOP,e),r&&n.set(bi.BOTTOM,r),s&&n.set(bi.LEFT,s),l&&n.set(bi.RIGHT,l),n}});class Fc{constructor(){this._translateX=0,this._translateY=0,this._translateSaveList=[]}get x(){return this._translateX}get y(){return this._translateY}reset(){this.translateBy(0,0),this._translateSaveList=[]}translateBy(t=0,e=0){this._translateX=t,this._translateY=e}translate(t=0,e=0){this._translateX+=t,this._translateY+=e}translateSave(){this._translateSaveList.push({x:this._translateX,y:this._translateY})}translateRestore(){const t=this._translateSaveList.pop();t&&(this._translateX=t.x,this._translateY=t.y)}translatePagePadding(t){const{marginTop:e=0,marginBottom:r=0,marginLeft:s=0,marginRight:l=0}=t;this.translate(s,e)}restorePagePadding(t){const{marginTop:e=0,marginBottom:r=0,marginLeft:s=0,marginRight:l=0}=t;this.translate(-s,-e)}translatePage(t,e=Ei.VERTICAL,r=0,s=0,l=0,n=0){const{sections:o,marginTop:i=0,marginBottom:a=0,marginLeft:g=0,marginRight:c=0,pageWidth:b,pageHeight:h,width:d,height:u,pageNumber:f=1,renderConfig:v={}}=t;let m=0,p=0;return e===Ei.VERTICAL?m=h+s:e===Ei.HORIZONTAL&&(p=b+r),this.translate(p,m),{x:p,y:m}}translateSection(t){const{top:e=0}=t;return this.translate(0,e),{x:0,y:e}}translateColumn(t){const{left:e}=t;return this.translate(e,0),{x:e,y:0}}translateLine(t,e=!1){const{top:r,marginBottom:s=0,marginTop:l=0,paddingTop:n=0,paddingBottom:o=0}=t,i=r+(!0===e?l:0)+n;return this.translate(0,i),{x:0,y:i}}translateDivide(t){const{left:e,paddingLeft:r}=t,s=e+r;return this.translate(s,0),{x:s,y:0}}translateSpan(t){const{left:e}=t;return this.translate(e,0),{x:e,y:0}}}var Uc,zc,Wc,Vc;(zc=Uc||(Uc={}))[zc.NORMAL=0]="NORMAL",zc[zc.START=1]="START",zc[zc.END=2]="END",(Vc=Wc||(Wc={}))[Vc.page=0]="page",Vc[Vc.section=1]="section",Vc[Vc.column=2]="column",Vc[Vc.line=3]="line",Vc[Vc.divide=4]="divide",Vc[Vc.span=5]="span";const Gc={page:0,section:1,column:2,line:3,divide:4,span:5};class Xc{constructor(t,e,r,s){this._scene=t,this.startNodePosition=e,this.endNodePosition=r,this.segmentId=s,this._current=!1,this._Liquid=new Fc,this._currentStartState={page:0,section:0,column:0,line:0,divide:0,span:0},this._currentEndState={page:0,section:0,column:0,line:0,divide:0,span:0}}getRange(){const t=this._rangeList,e=t[0],r=t[t.length-1];let s=1===t.length&&e.isCollapse;return{cursorStart:e.cursorStart,cursorEnd:r.cursorEnd,isStartBack:e.isStartBack,isEndBack:r.isEndBack,isCollapse:s}}getRangeList(){return this._rangeList}getAnchor(){return this._anchorShape}activeStatic(){var t;null==(t=this._anchorShape)||t.setProps({stroke:zi(Ko.black,1)})}deactivateStatic(){var t;null==(t=this._anchorShape)||t.setProps({stroke:zi(Ko.black,0)})}isActive(){return!0===this._current}activate(){this._current=!0}deactivate(){this._current=!1}isEmpty(){return null==this.startNodePosition&&null==this.endNodePosition}isCollapsed(){return null!=this.startNodePosition&&null==this.endNodePosition||!!this.isSamePosition()}isRange(){const t=this.startNodePosition,e=this.endNodePosition;return null!=t&&null!=e&&!this.isSamePosition()}dispose(){var t,e;null==(t=this._rangeShape)||t.dispose(),this._rangeShape=null,null==(e=this._anchorShape)||e.dispose(),this._anchorShape=null}isIntersection(t){const e=this.getRange(),r=t.getRange(),s=this._getCursorPosition(e.cursorStart,e.isStartBack),l=this._getCursorPosition(e.cursorEnd,e.isEndBack),n=this._getCursorPosition(r.cursorStart,r.isStartBack);return!(s>this._getCursorPosition(r.cursorEnd,r.isEndBack)||l0&&this._createAndUpdateAnchor(r,t.left,t.top))}const n=this._getRangePointData(s,l,t),{pointGroup:o,cursorList:i}=n;this._setRangeList(i),o.length>0&&this._createAndUpdateRange(o,t.left,t.top)}getStart(){if(null==this.startNodePosition)return this.endNodePosition;if(null==this.endNodePosition)return this.startNodePosition;const{start:t}=this._compareNodePosition(this.startNodePosition,this.endNodePosition);return t}_resetCurrentNodePositionState(){this._currentStartState={page:0,section:0,column:0,line:0,divide:0,span:0},this._currentEndState={page:0,section:0,column:0,line:0,divide:0,span:0}}_compareNodePositionLogic(t,e){return!(t.page>e.page)&&(t.pagee.section)&&(t.sectione.column)&&(t.columne.line)&&(t.linee.divide)&&(t.dividee.span)&&(t.span,e.span,!0))))))}_compareNodePosition(t,e){return this._compareNodePositionLogic(t,e)?{start:t,end:e}:{start:e,end:t}}_setNodePositionState(t=0,e,r,s){this._currentStartState[t]=s===e?1:0,this._currentEndState[t]=s===r?2:0}_checkPreviousNodePositionState(t,e=!0){let r,s=t;for(;s>=0;){const t=Wc[s];let l;if(l=e?this._currentStartState[t]:this._currentEndState[t],void 0===l)return;if(void 0===r&&(r=l),l!==r)return 0;s--}return r}_getSelectionRuler(t,e,r,s,l){let n=0,o=s;const i=Wc[t],a=Wc[t+1];if(null===a||null===i)return{start_next:n,end_next:o};const g=e[i],c=r[i];this._setNodePositionState(i,g,c,l);const b=this._checkPreviousNodePositionState(t),h=this._checkPreviousNodePositionState(t,!1);return 1===b&&(n=e[a]),2===h&&(o=r[a]),{start_next:n,end_next:o}}_pushToPoints(t){const{startX:e,startY:r,endX:s,endY:l}=t,n=[];return n.push({x:e,y:r}),n.push({x:s,y:r}),n.push({x:s,y:l}),n.push({x:e,y:l}),n.push({x:e,y:r}),n}isSamePosition(){const t=this.startNodePosition,e=this.endNodePosition;if(null==t||null==e)return!1;const r=Object.keys(Gc);for(let s of r){if(t[s]!==e[s])return!1}return t.isBack===e.isBack}_createAndUpdateRange(t,e,r){if(this._rangeShape)return this._rangeShape.translate(e,r),this._rangeShape.updatePointGroup(t),void this._rangeShape.show();const s=new eg("__TestSelectionRange__"+B.generateRandomId(6),{pointsGroup:t,fill:zi(Ko.black,.2),left:e,top:r,evented:!1});this._rangeShape=s,this._scene.addObject(s,2)}_getAnchorBounding(t){const e=t[0],r=e[0],s=e[2],{x:l,y:n}=r,{x:o,y:i}=s;return{left:l,top:n,width:o-l,height:i-n}}_createAndUpdateAnchor(t,e,r){const s=this._getAnchorBounding(t),{left:l,top:n,width:o,height:i}=s;if(this._anchorShape)return this._anchorShape.transformByState({left:l+e,top:n+r,height:i}),void this._anchorShape.show();const a=new Ja("__TestSelectionAnchor__"+B.generateRandomId(6),{left:l+e,top:n+r,height:i,strokeWidth:1,stroke:zi(Ko.black),evented:!1});this._anchorShape=a,this._scene.addObject(a,2)}_getRangePointData(t,e,r){const s=[],l=[];if(null==t||null==e)return{pointGroup:s,cursorList:l};const{start:n,end:o}=this._compareNodePosition(t,e);return this._selectionIterator(n,o,r,((t,e,r,i,a,g)=>{var c;const{lineHeight:b}=g,{spanGroup:h,st:d}=a,{x:u,y:f}=this._Liquid;let v;const m=h[t],p=h[e],_=(null==m?void 0:m.left)||0,B=(null==m?void 0:m.width)||0,C=(null==p?void 0:p.left)||0,w=(null==p?void 0:p.width)||0;let T=(null==m?void 0:m.spanType)===Si.LIST,y=(null==(c=h[0])?void 0:c.spanType)===Si.LIST,S=t+d,j=e+d;const E=n.span!==t||!r||n.isBack,Y=!(o.span!==e||!i)&&o.isBack,R=n===o;if(0===t&&e===h.length-1)j-=y?1:0,v={startX:u+_+(T?B:0),startY:f,endX:u+C+w,endY:f+b};else{S-=y&&!T?1:0,j-=y&&!T?1:0,v={startX:u+_+(E&&!T?0:B),startY:f,endX:u+C+(Y?0:w),endY:f+b}}s.push(this._pushToPoints(v)),l.push({isStartBack:E,isEndBack:Y,cursorStart:S,cursorEnd:j,isCollapse:R})})),{pointGroup:s,cursorList:l}}_selectionIterator(t,e,r,s){const l=r.getSkeleton();if(!l)return[];this._Liquid.reset();const n=l.getSkeletonData().pages,{page:o}=t,{page:i}=e;this._resetCurrentNodePositionState();for(let a=0;a<=o-1;a++){const t=n[a];this._Liquid.translatePage(t,r.pageLayoutType,r.pageMarginLeft,r.pageMarginTop)}for(let a=o;a<=i;a++){const l=n[a],g=l.sections,{start_next:c,end_next:b}=this._getSelectionRuler(Gc.page,t,e,g.length-1,a);this._Liquid.translateSave(),this._Liquid.translatePagePadding(l);for(let r=c;r<=b;r++){const n=g[r],h=n.columns,{start_next:d,end_next:u}=this._getSelectionRuler(Gc.section,t,e,h.length-1,r);this._Liquid.translateSection(n);for(let g=d;g<=u;g++){const f=h[g],v=f.lines,{start_next:m,end_next:p}=this._getSelectionRuler(Gc.column,t,e,v.length-1,g);this._Liquid.translateColumn(f);for(let h=m;h<=p;h++){const _=v[h],{divides:B,type:C,lineHeight:w=0}=_,{start_next:T,end_next:y}=this._getSelectionRuler(Gc.line,t,e,B.length-1,h);this._Liquid.translateSave(),this._Liquid.translateLine(_);for(let v=T;v<=y;v++){const C=B[v];this._Liquid.translateSave(),this._Liquid.translateDivide(C);const w=C.spanGroup,{start_next:S,end_next:j}=this._getSelectionRuler(Gc.divide,t,e,w.length-1,v);let E=!1,Y=!1;a===o&&r===c&&g===d&&h===m&&v===T&&(E=!0),a===i&&r===b&&g===u&&h===p&&v===y&&(Y=!0),s&&s(S,j,E,Y,C,_,f,n,l),this._Liquid.translateRestore()}this._Liquid.translateRestore()}}}this._Liquid.translateRestore(),this._Liquid.translatePage(l,r.pageLayoutType,r.pageMarginLeft,r.pageMarginTop)}}_setRangeList(t){0!==t.length&&(this._rangeList=t)}_getCursorPosition(t,e){return t-(!0===e?1:0)}}class Qc{constructor(t){var e;this._documents=t,this.onKeydownObservable=new o,this.onInputObservable=new o,this.onCompositionstartObservable=new o,this.onCompositionupdateObservable=new o,this.onCompositionendObservable=new o,this._textSelectionList=[],this._viewPortObserverMap=new Map,this._isIMEInputApply=!1,this._initialDom(),this.activeViewport=null==(e=this._documents)?void 0:e.getFirstViewport(),this._documents&&this.changeDocuments(this._documents)}set activeViewport(t){this._attachScrollEvent(t),this._activeViewport=t}static create(t){return new Qc(t)}getActiveTextSelection(){const t=this._textSelectionList;for(let e of t)if(e.isActive())return e}getTextSelectionList(){return this._textSelectionList}add(t){this._addTextSelection(t)}remain(){const t=this.getActiveTextSelection();if(null==t)return;const e=this._textSelectionList.indexOf(t);return this._textSelectionList.splice(e,1)[0]}sync(){this._syncDomToSelection()}active(t,e){this._container.style.left=`${t}px`,this._container.style.top=`${e}px`,this._cursor.style.animation="univer_cursor_blinkStyle 1s steps(1) infinite",this._cursor.style.display="revert",setTimeout((()=>{this._input.focus()}),0)}deactivate(){this._container.style.left="0px",this._container.style.top="0px",this._cursor.style.animation="",this._cursor.style.display="none",this._input.blur()}changeDocuments(t){var e;this._documents&&this._detachEvent(this._documents),this._documents=t,this._skeletonObserver=null==(e=t.getSkeleton())?void 0:e.onRecalculateChangeObservable.add((t=>{this._deleteAllTextSelection()})),this._attachSelectionEvent(this._documents)}dispose(){this._documents&&this._detachEvent(this._documents),this._container.remove()}_initialDom(){const t=document.createElement("div");t.style.position="absolute",t.style.position="absolute",t.style.left="0px",t.style.top="0px";const e=document.createElement("div"),r=document.createElement("div"),s=document.createElement("div");e.appendChild(r),t.appendChild(e),t.appendChild(s),this._container=t,this._inputParent=e,this._input=r,this._cursor=s,this._initialInput(),this._initialCursorDom(),this._attachInputEvent(),document.body.appendChild(t)}_initialInput(){this._inputParent.style.cssText="\n position:absolute;\n height:1px;\n width:1px;\n overflow: hidden;\n ",this._input.contentEditable="true",this._input.style.cssText="\n position: absolute; \n overflow: hidden; \n opacity: 1; \n background: #000; \n color: transparent; \n outline: none; \n z-index: -2; \n caret-color: transparent; \n white-space: pre-wrap; \n user-select: text;\n "}_initialCursorDom(){if(this._cursor.style.cssText="\n visibility: visible;\n position: absolute;\n background: #000;\n left: 0;\n top: 0;\n width: 1px;\n height: 20px;\n opacity: 0;\n z-index: 0;\n pointer-events: none;\n display: none\n ",!wa("keyframes univer_cursor_blinkStyle")){Ca(["\n @-webkit-keyframes univer_cursor_blinkStyle {\n 0% {\n opacity: 1;\n }\n \n 13% {\n opacity: 0;\n }\n\n 50% {\n opacity: 0;\n }\n\n 63% {\n opacity: 1;\n }\n \n 100% {\n opacity: 1;\n }\n }\n ","\n @keyframes univer_cursor_blinkStyle {\n 0% {\n opacity: 1;\n }\n \n 13% {\n opacity: 0;\n }\n\n 50% {\n opacity: 0;\n }\n\n 63% {\n opacity: 1;\n }\n \n 100% {\n opacity: 1;\n }\n }\n "])}}_getSkeletonData(){var t,e;return null==(e=null==(t=this._documents)?void 0:t.getSkeleton())?void 0:e.getSkeletonData()}_getNodePosition(t){var e;if(!1===t)return;const{node:r,ratioX:s,ratioY:l}=t,n=null==(e=this._documents)?void 0:e.findPositionBySpan(r);return null!=n?__spreadProps(__spreadValues({},n),{isBack:s<.5}):void 0}_interactTextSelection(t){const e=[];let r=!1;this._textSelectionList.forEach((s=>{if(s===t)return!0;t.isIntersection(s)?(r=!0,s.dispose()):e.push(s)})),r&&(e.push(t),this._textSelectionList=e)}_deleteAllTextSelection(){this._textSelectionList.forEach((t=>{t.dispose()})),this._textSelectionList=[]}_deactivateTextSelection(){this._textSelectionList.forEach((t=>{t.deactivate()}))}_addTextSelection(t){this._deactivateTextSelection(),t.activate(),this._textSelectionList.push(t)}_updateTextSelection(t){if(!this._documents)return;let e=this._textSelectionList.pop();e||(e=new Xc(this._documents.getScene(),t)),this._deleteAllTextSelection(),e.activate(),e.startNodePosition=t,e.endNodePosition=null,this._textSelectionList=[e]}_isEmptyTextSelection(){return 0===this._textSelectionList.length}_getCanvasOffset(){var t,e;const r=null==(t=this._documents)?void 0:t.getEngine(),s=null==(e=null==r?void 0:r.getCanvas())?void 0:e.getCanvasEle();if(!s)return{left:0,top:0};const{top:l,left:n}=function(t){let e=t.getBoundingClientRect(),r=document.body,s=document.documentElement,l=window.pageYOffset||s.scrollTop||r.scrollTop,n=window.pageXOffset||s.scrollLeft||r.scrollLeft,o=s.clientTop||r.clientTop,i=s.clientLeft||r.clientLeft;return{top:e.top+l-o,left:e.left+n-i}}(s);return{left:n,top:l}}_syncDomToSelection(){var t;const e=this.getActiveTextSelection(),r=null==e?void 0:e.getAnchor();if(!r||r&&!r.visible)return;const{height:s,left:l,top:n}=r,o=null==(t=this._activeViewport)?void 0:t.getAbsoluteVector(Sa.FromArray([l,n]));this._cursor.style.height=`${s}px`;let{left:i,top:a}=this._getCanvasOffset();i+=(null==o?void 0:o.x)||0,a+=(null==o?void 0:o.y)||0,this.active(i,a)}_moving(t,e,r){const{scrollX:s,scrollY:l}=Ha(r);if(!this._documents)return;const n=this._documents.findNodeByCoord(t,e),o=this._getNodePosition(n);if(console.log("endNode",n,o,{moveOffsetX:t,moveOffsetY:e,_viewportScrollY:this._viewportScrollY,scrollX:s}),!o)return;const i=this.getActiveTextSelection();i&&(i.endNodePosition=o,i.refresh(this._documents),this._interactTextSelection(i))}_attachScrollEvent(t){if(!t)return;const e=t.viewPortKey;if(this._viewPortObserverMap.has(e))return;const r=t.onScrollBeforeObserver.add((t=>{if(!t.viewport)return;const e=this.getActiveTextSelection();null==e||e.activeStatic(),this._cursor.style.display="none"})),s=t.onScrollStopObserver.add((t=>{const e=t.viewport;if(!e)return;const r=e.getBounding(),s=this.getActiveTextSelection(),l=null==s?void 0:s.getAnchor();if(l&&(!l||l.visible)){if(r){const{minX:t,maxX:e,minY:s,maxY:n}=Fa(l,r);if(l.strokeWidth{if(this._isIMEInputApply)return;const e=this.getActiveTextSelection(),r=this.getTextSelectionList();null!=this._documents&&(this._input.innerHTML="",this.onKeydownObservable.notifyObservers({event:t,content:"",document:this._documents,activeSelection:e,selectionList:r}))})),this._input.addEventListener("input",(t=>{if(this._isIMEInputApply)return;const e=this._input.textContent||"";this._input.innerHTML="";const r=this.getActiveTextSelection(),s=this.getTextSelectionList();null!=this._documents&&this.onInputObservable.notifyObservers({event:t,content:e,document:this._documents,activeSelection:r,selectionList:s})})),this._input.addEventListener("compositionstart",(t=>{this._isIMEInputApply=!0;const e=this._input.textContent||"";this._input.innerHTML="";const r=this.getActiveTextSelection(),s=this.getTextSelectionList();null!=this._documents&&this.onCompositionstartObservable.notifyObservers({event:t,content:e,document:this._documents,activeSelection:r,selectionList:s})})),this._input.addEventListener("compositionend",(t=>{this._isIMEInputApply=!1;const e=this._input.textContent||"";this._input.innerHTML="";const r=this.getActiveTextSelection(),s=this.getTextSelectionList();null!=this._documents&&this.onCompositionendObservable.notifyObservers({event:t,content:e,document:this._documents,activeSelection:r,selectionList:s})})),this._input.addEventListener("compositionupdate",(t=>{const e=this._input.textContent||"";this._input.innerHTML="";const r=this.getActiveTextSelection(),s=this.getTextSelectionList();null!=this._documents&&this.onCompositionupdateObservable.notifyObservers({event:t,content:e,document:this._documents,activeSelection:r,selectionList:s})}))}_attachSelectionEvent(t){this._moveInObserver=t.onPointerEnterObserver.add((()=>{t.cursor=oi.TEXT})),this._moveOutObserver=t.onPointerLeaveObserver.add((()=>{t.cursor=oi.DEFAULT,e.resetCursor()}));const e=t.getScene();this._downObserver=t.onPointerDownObserver.add(((t,r)=>{const{offsetX:s,offsetY:l}=t;if(!this._documents)return;this.activeViewport=this._documents.getActiveViewportByCoord(s,l);const n=this._documents.findNodeByCoord(s,l),o=this._getNodePosition(n);if(console.log("startNode",n,o,s,l),!o)return void this._deleteAllTextSelection();if(t.ctrlKey||this._isEmptyTextSelection()){const t=new Xc(this._documents.getScene(),o);this._addTextSelection(t)}else this._updateTextSelection(o);this._activeSelectionRefresh(),this._syncDomToSelection(),e.disableEvent();const i=Ka.create(e);i.startScroll(s,l);const{scrollX:a,scrollY:g}=Ha(i);this._viewportScrollX=a,this._viewportScrollY=g,this._moveObserver=e.onPointerMoveObserver.add((t=>{const{offsetX:r,offsetY:s}=t;this._moving(r,s,i),i.scrolling(r,s,(()=>{this._moving(r,s,i)})),e.setCursor(oi.TEXT)})),this._upObserver=e.onPointerUpObserver.add((t=>{e.onPointerMoveObserver.remove(this._moveObserver),e.onPointerUpObserver.remove(this._upObserver),e.enableEvent(),i.stopScroll()}))}))}_detachEvent(t){var e;t.onPointerEnterObserver.remove(this._moveInObserver),t.onPointerLeaveObserver.remove(this._moveOutObserver),t.onPointerDownObserver.remove(this._downObserver),null==(e=t.getSkeleton())||e.onRecalculateChangeObservable.remove(this._skeletonObserver),this.onKeydownObservable.clear(),this.onInputObservable.clear(),this.onCompositionstartObservable.clear(),this.onCompositionupdateObservable.clear(),this.onCompositionendObservable.clear()}_activeSelectionRefresh(){if(!this._documents)return;const t=this.getActiveTextSelection();null==t||t.refresh(this._documents)}}class Kc extends xc{constructor(t,e,r){super(t,e,null==r?void 0:r.allowCache),this.isCalculateSkeleton=!0,this.onPageRenderObservable=new o,this.docsLeft=0,this.docsTop=0,this._hasEditor=!1,void 0===(null==r?void 0:r.pageMarginLeft)?this.pageMarginLeft=17:this.pageMarginLeft=null==r?void 0:r.pageMarginLeft,void 0===(null==r?void 0:r.pageMarginTop)?this.pageMarginTop=14:this.pageMarginTop=null==r?void 0:r.pageMarginTop,this.pageLayoutType=(null==r?void 0:r.pageLayoutType)||Ei.VERTICAL,this._drawLiquid=new Fc,this._findLiquid=new Fc,this._hasEditor=(null==r?void 0:r.hasEditor)||!1,this._initialDefaultExtension(),this._addSkeletonChangeObserver(e),this.makeDirty(!0)}get hasEditor(){return this._hasEditor}static create(t,e,r){return new Kc(t,e,r)}calculatePagePosition(){const t=this.getScene();let e=null==t?void 0:t.getParent();const{width:r,height:s,pageMarginLeft:l,pageMarginTop:n}=this;if(null==e)return this;const{width:o,height:i}=e;let a=0,g=0,c=0,b=0;return o>r?(a=o/2-r/2,c=o-30):(a=l,c=r+2*l),i>s?(g=i/2-s/2,b=i-30):(g=n,b=s+2*n),this.docsLeft=a,this.docsTop=g,t.resize(c,b+200),this.translate(a,g),this}getFirstViewport(){return this.getScene().getViewports()[0]}getActiveViewportByCoord(t,e){return this.getScene().getActiveViewportByCoord(Sa.FromArray([t,e]))}getEngine(){return this.getScene().getEngine()}enableEditor(){this._hasEditor||(this._editor=Qc.create(this),this._hasEditor=!0)}disableEditor(){var t;null==(t=this._editor)||t.dispose(),this._hasEditor=!1}getEditorInputEvent(){if(!this._hasEditor)return;const{onInputObservable:t,onCompositionstartObservable:e,onCompositionupdateObservable:r,onCompositionendObservable:s,onKeydownObservable:l}=this._editor;return{onInputObservable:t,onCompositionstartObservable:e,onCompositionupdateObservable:r,onCompositionendObservable:s,onKeydownObservable:l}}remainActiveSelection(){if(this._hasEditor)return this._editor.remain()}addSelection(t){if(this._hasEditor)return this._editor.add(t)}syncSelection(){if(this._hasEditor)return this._editor.sync()}draw(t,e){const r=this.getSkeleton();if(!r)return;this._drawLiquid.reset();const s=r.getSkeletonData(),{pages:l}=s,n=this.getParentScale(),o=this.getExtensionsByOrder(),i=fa(n);for(let c of o)c.clearCache();let a=0,g=0;for(let c=0,b=l.length;cthis.height&&C!==be.WRAP&&(C===be.OVERFLOW||E>0)&&(u=this.height/Math.tan(Math.abs(E)));const f=this._horizontalHandler(u,h,d,p);let v=this._verticalHandler(r,s,b,m)-i;r>this.height&&(v=E<0?this.height-(r+i):-i),g=Sa.create(f+o,v),this._drawLiquid.translate(0,-a),c=t}else g=S;for(let r=0;rl))for(let s of e){const{columns:e,st:r,ed:l}=s;if(!(tl))for(let s of e){const{lines:e,st:r,ed:l}=s;if(!(tl))for(let s of e){const{divides:e,lineHeight:r,st:l,ed:n}=s,o=e.length;if(!(tn))for(let s=0;so)continue;const i=l[t-n];if(i)return i}}}}}}findNodeByCoord(t,e){const r=this.getScene().transformToSceneCoord(Sa.FromArray([t,e]));if(!r)return!1;const s=this._getInverseCoord(r);let{x:l,y:n}=s;const o=this.getSkeleton();if(!o)return!1;this._findLiquid.reset();const i=o.getSkeletonData().pages;for(let a=0,g=i.length;a=e&&l<=s&&n>=r&&n<=o)){this._translatePage(t);continue}this._findLiquid.translatePagePadding(t);const g=t.sections;for(let i of g){const{columns:t,height:e}=i;this._findLiquid.translateSection(i);const{y:r}=this._findLiquid;if(n>=r&&n<=r+e)for(let s of t){const{lines:t,width:e}=s;this._findLiquid.translateColumn(s);const{x:r}=this._findLiquid;if(!(l>=r&&l<=r+e))continue;const o=t.length;for(let s=0;s=s&&n<=o)){this._findLiquid.translateRestore();continue}const a=r.length;for(let e=0;e=g&&l<=g+a){for(let t of i){if(!t.content||0===t.content.length)continue;const{width:e,left:r}=t,i=g+r,a=g+r+e;if(l>=i&&l<=a)return{node:t,ratioX:l/(i+a),ratioY:n/(s+o)}}this._findLiquid.translateRestore()}else this._findLiquid.translateRestore()}this._findLiquid.translateRestore()}}}}this._findLiquid.restorePagePadding(t),this._translatePage(t)}return!1}_draw(t,e){this.draw(t,e)}_horizontalHandler(t,e,r,s){let l=0;return l=s===ie.CENTER?(this.width-t)/2:s===ie.RIGHT?this.width-t-r:e,l}_verticalHandler(t,e,r,s){let l=0;return l=s===ge.MIDDLE?(this.height-t)/2:s===ge.BOTTOM?this.height-t-r:e,l}_startRotation(t,e){t.rotate(e||0)}_resetRotation(t,e){t.rotate(-e||0)}_initialDefaultExtension(){Dc.getData().forEach((t=>{this.register(t)}))}_addSkeletonChangeObserver(t){t&&(this._skeletonObserver=t.onRecalculateChangeObservable.add((t=>{const e=t.pages;let r=0,s=0;for(let l=0,n=e.length;l{this.resizeCacheCanvas()}))),this._context=t,this._documentSkeleton=Ic.create(this._documentData,this._context),this._documents=new Kc(`${this.oKey}_DOCUMENTS`,this._documentSkeleton,{pageMarginLeft:0,pageMarginTop:0}),this._initialProps(r),this.onTransformChangeObservable.add((t=>{const{type:e,value:r,preValue:s}=t;if(e===ki.resize||e===ki.all){this._documentSkeleton.updateDocumentDataPageSize(this.width),this._documentSkeleton.makeDirty(!0),this._documentSkeleton.calculate();const t=this.getDocsSkeletonPageSize();this.height=(null==t?void 0:t.height)||this.height,this._setTransForm()}}))}get documentData(){return this._documentData}getDocsSkeletonPageSize(){var t;const e=null==(t=this._documentSkeleton)?void 0:t.getSkeletonData();if(!e)return;const{pages:r}=e,s=r[r.length-1],{width:l,height:n}=s;return{width:l,height:n}}setProps(t){if(!t)return;const e=Object.keys(t);return 0!==e.length?(e.forEach((e=>{if(void 0===t[e])return!0;-1===Zc.indexOf(e)&&(this[`_${e}`]=t[e])})),this.makeDirty(!0),this):void 0}render(t,e){if(!this.visible)return this.makeDirty(!1),this;if(this.isRender()){const{minX:t,maxX:r,minY:s,maxY:l}=Fa(this,e);if(this.width+this.strokeWidth{this[e]&&(t[e]=this[e])})),__spreadValues(__spreadValues({},super.toJson()),t)}_draw(t){this._documents.render(t)}convertToDocumentData(t){const e=t.length;return{id:"d",body:{blockElements:[{blockId:"oneParagraph",st:0,ed:e,blockType:E.PARAGRAPH,paragraph:{elements:[{eId:"oneElement",st:0,ed:e,et:D.TEXT_RUN,tr:{ct:t,ts:{fs:this._fs||14,ff:this._ff,it:this._it,bl:this._bl,ul:this._ul,st:this._st,ol:this._ol,bg:this._bg,bd:this._bd,cl:this._cl}}}]}}]},documentStyle:{pageSize:{width:1/0,height:1/0}}}}_initialProps(t){this._documentSkeleton.updateDocumentDataPageSize(null==t?void 0:t.width,null==t?void 0:t.height),this._documentSkeleton.calculate();const e=this.getDocsSkeletonPageSize();this.transformByState({width:(null==e?void 0:e.width)||0,height:(null==e?void 0:e.height)||0,left:(null==t?void 0:t.left)||0,top:(null==t?void 0:t.top)||0,angle:null==t?void 0:t.angle}),this.setProps(t),this.makeDirty(!0)}_applyCache(t){if(!t||!this._cacheCanvas)return;const e=this._cacheCanvas.getPixelRatio(),r=this._cacheCanvas.getWidth()*e,s=this._cacheCanvas.getHeight()*e;t.drawImage(this._cacheCanvas.getCanvasEle(),0,0,r,s,-this.strokeWidth/2,-this.strokeWidth/2,this.width+this.strokeWidth,this.height+this.strokeWidth)}}var qc,Jc;(Jc=qc||(qc={})).RESIZE_LT="__SpreadsheetTransformerResizeLT__",Jc.RESIZE_CT="__SpreadsheetTransformerResizeCT__",Jc.RESIZE_RT="__SpreadsheetTransformerResizeRT__",Jc.RESIZE_LM="__SpreadsheetTransformerResizeLM__",Jc.RESIZE_RM="__SpreadsheetTransformerResizeRM__",Jc.RESIZE_LB="__SpreadsheetTransformerResizeLB__",Jc.RESIZE_CB="__SpreadsheetTransformerResizeCB__",Jc.RESIZE_RB="__SpreadsheetTransformerResizeRB__",Jc.OUTLINE="__SpreadsheetTransformerOutline__",Jc.ROTATE_LINE="__SpreadsheetTransformerRotateLine__",Jc.ROTATE="__SpreadsheetTransformerRotate__",Jc.GROUP="__SpreadsheetTransformer__";const tb=[qc.RESIZE_LT,qc.RESIZE_CT,qc.RESIZE_RT,qc.RESIZE_LM,qc.RESIZE_RM,qc.RESIZE_LB,qc.RESIZE_CB,qc.RESIZE_RB];var eb,rb,sb,lb,nb,ob,ib,ab;(rb=eb||(eb={}))[rb.MOVE_START=0]="MOVE_START",rb[rb.MOVING=1]="MOVING",rb[rb.MOVE_END=2]="MOVE_END";class gb{constructor(t,e){this._scene=t,this.hoverEnabled=!1,this.resizeEnabled=!0,this.rotateEnabled=!0,this.rotationSnaps=[],this.rotationSnapTolerance=5,this.rotateAnchorOffset=50,this.rotateSize=10,this.rotateCornerRadius=10,this.borderEnabled=!0,this.borderStroke="rgb(97, 97, 97)",this.borderStrokeWidth=1,this.borderDash=[],this.borderSpacing=10,this.anchorFill="rgb(255,255,255)",this.anchorStroke="rgb(185,185,185)",this.anchorStrokeWidth=1,this.anchorSize=10,this.anchorCornerRadius=10,this.keepRatio=!0,this.centeredScaling=!1,this.enabledAnchors=[1,1,1,1,1,1,1,1],this.flipEnabled=!1,this.ignoreStroke=!1,this.onChangeStartObservable=new o,this.onChangingObservable=new o,this.onChangeEndObservable=new o,this.onClearControlObservable=new o,this.onCreateControlObservable=new o,this._transformerControlMap=new Map,this._selectedObjectMap=new Map,this._initialProps(e)}getScene(){return this._scene}attachTo(t){if(t.isTransformer)return this.hoverEnabled&&(this.hoverEnterFunc&&t.onPointerEnterObserver.add(this.hoverEnterFunc),this.hoverLeaveFunc&&t.onPointerLeaveObserver.add(this.hoverLeaveFunc)),t.onPointerDownObserver.add(((e,r)=>{const{offsetX:s,offsetY:l}=e;this._startOffsetX=s,this._startOffsetY=l;const n=this._getTopScene();if(!n)return;this._addCancelObserver(n),n.disableEvent();const o=Ka.create(n);o.startScroll(s,l);const{scrollX:i,scrollY:a}=Ha(o);this._viewportScrollX=i,this._viewportScrollY=a,this._updateActiveObjectList(t,e),this._moveObserver=n.onPointerMoveObserver.add((t=>{const{offsetX:e,offsetY:r}=t;this._moving(e,r,o),this._hiddenControl(),o.scrolling(e,r,(()=>{this._moving(e,r,o)}))})),this._upObserver=n.onPointerUpObserver.add((t=>{n.onPointerMoveObserver.remove(this._moveObserver),n.onPointerUpObserver.remove(this._upObserver),n.enableEvent(),this._updateControl(),o.stopScroll(),this.onChangeEndObservable.notifyObservers({objects:this._selectedObjectMap,type:2})})),r.stopPropagation()})),t}dispose(){this._moveObserver=null,this._upObserver=null,this._transformerControlMap.forEach((t=>{t.dispose()})),this._selectedObjectMap.forEach((t=>{t.dispose()})),this.onChangeStartObservable.clear(),this.onChangingObservable.clear(),this.onChangeEndObservable.clear()}_initialProps(t){if(!t)return;const e=Object.keys(t);0!==e.length&&e.forEach((e=>{if(void 0===t[e])return!0;this[e]=t[e]}))}_updateControlChildren(){this._updateControlIterator(((t,e)=>{const{left:r,top:s,width:l,height:n,scaleX:o,scaleY:i}=e.getState();t.getObjects().forEach((t=>{const e=t.oKey,r=this._checkTransformerType(e);if(!r)return!0;if(r===qc.OUTLINE)t.transformByState(this._getOutlinePosition(l,n,o,i));else{const{left:e,top:s}=this._getRotateAnchorPosition(r,n,l,o,i);t.transformByState({left:e,top:s})}})),t.transformByState({left:r,top:s})}))}_anchorMoving(t,e,r,s){const{scrollX:l,scrollY:n}=Ha(s),o=e-this._viewportScrollX+l,i=r-this._viewportScrollY+n,a=o-this._startOffsetX,g=i-this._startOffsetY;this._selectedObjectMap.forEach((e=>{const{left:r,top:s,width:l,height:n}=e,o={};switch(t){case qc.RESIZE_LT:o.left=r+a,o.top=s+g,o.width=l-a,o.height=n-g;break;case qc.RESIZE_CT:o.top=s+g,o.height=n-g;break;case qc.RESIZE_RT:o.top=s+g,o.width=l+a,o.height=n-g;break;case qc.RESIZE_LM:o.left=r+a,o.width=l-a;break;case qc.RESIZE_RM:o.width=a+l;break;case qc.RESIZE_LB:o.left=r+a,o.width=l-a,o.height=n+g;break;case qc.RESIZE_CB:o.height=g+n;break;case qc.RESIZE_RB:o.width=a+l,o.height=g+n}e.transformByState(o)})),this._updateControlChildren(),this.onChangingObservable.notifyObservers({objects:this._selectedObjectMap,moveX:a,moveY:g,type:1}),this._startOffsetX=o,this._startOffsetY=i}_attachEventToAnchor(t,e=qc.RESIZE_LT){t.onPointerDownObserver.add(((t,r)=>{const{offsetX:s,offsetY:l}=t;this._startOffsetX=s,this._startOffsetY=l;const n=this._getTopScene();if(null==n)return;n.disableEvent();const o=Ka.create(n);o.startScroll(s,l);const{scrollX:i,scrollY:a}=Ha(o);this._viewportScrollX=i,this._viewportScrollY=a;const g=this._getRotateAnchorCursor(e);this._moveObserver=n.onPointerMoveObserver.add((t=>{const{offsetX:r,offsetY:s}=t;this._anchorMoving(e,r,s,o),o.scrolling(r,s,(()=>{this._anchorMoving(e,r,s,o)})),n.setCursor(g)})),this._upObserver=n.onPointerUpObserver.add((t=>{n.onPointerMoveObserver.remove(this._moveObserver),n.onPointerUpObserver.remove(this._upObserver),n.enableEvent(),n.resetCursor(),o.stopScroll()})),r.stopPropagation()}))}_attachEventToRotate(t){t.onPointerDownObserver.add(((t,e)=>{const{offsetX:r,offsetY:s}=t;this._startOffsetX=r,this._startOffsetY=s;const l=this._getTopScene();null!=l&&(l.disableEvent(),this._viewportScrollX=scrollX,this._viewportScrollY=scrollY,this._moveObserver=l.onPointerMoveObserver.add((t=>{})),this._upObserver=l.onPointerUpObserver.add((t=>{l.onPointerMoveObserver.remove(this._moveObserver),l.onPointerUpObserver.remove(this._upObserver),l.enableEvent()})),e.stopPropagation())}))}_getOutlinePosition(t,e,r,s){return{left:-this.borderSpacing-this.borderStrokeWidth,top:-this.borderSpacing-this.borderStrokeWidth,width:t+2*this.borderSpacing,height:e+2*this.borderSpacing}}_getRotateAnchorCursor(t){let e=oi.NORTH_WEST_RESIZE;switch(t){case qc.ROTATE:case qc.ROTATE_LINE:e=oi.MOVE;break;case qc.RESIZE_LT:break;case qc.RESIZE_CT:e=oi.NORTH_RESIZE;break;case qc.RESIZE_RT:e=oi.NORTH_EAST_RESIZE;break;case qc.RESIZE_LM:e=oi.WEST_RESIZE;break;case qc.RESIZE_RM:e=oi.EAST_RESIZE;break;case qc.RESIZE_LB:e=oi.SOUTH_WEST_RESIZE;break;case qc.RESIZE_CB:e=oi.SOUTH_RESIZE;break;case qc.RESIZE_RB:e=oi.SOUTH_EAST_RESIZE}return e}_getRotateAnchorPosition(t,e,r,s,l){let n=-this.anchorSize/2,o=-this.anchorSize/2;switch(t){case qc.ROTATE:n=r/2-this.rotateSize/2,o=-this.rotateAnchorOffset-this.borderSpacing-2*this.borderStrokeWidth-this.rotateSize;break;case qc.ROTATE_LINE:n=r/2,o=-this.rotateAnchorOffset-this.borderSpacing-this.borderStrokeWidth;break;case qc.RESIZE_LT:n+=-this.borderSpacing-this.borderStrokeWidth,o+=-this.borderSpacing-this.borderStrokeWidth;break;case qc.RESIZE_CT:n+=r/2,o+=-this.borderSpacing-this.borderStrokeWidth;break;case qc.RESIZE_RT:n+=r+this.borderSpacing-this.borderStrokeWidth,o+=-this.borderSpacing-this.borderStrokeWidth;break;case qc.RESIZE_LM:n+=-this.borderSpacing-this.borderStrokeWidth,o+=e/2;break;case qc.RESIZE_RM:n+=r+this.borderSpacing-this.borderStrokeWidth,o+=e/2;break;case qc.RESIZE_LB:n+=-this.borderSpacing-this.borderStrokeWidth,o+=e+this.borderSpacing-this.borderStrokeWidth;break;case qc.RESIZE_CB:n+=r/2,o+=e+this.borderSpacing-this.borderStrokeWidth;break;case qc.RESIZE_RB:n+=r+this.borderSpacing-this.borderStrokeWidth,o+=e+this.borderSpacing-this.borderStrokeWidth}return{left:n,top:o}}_createResizeAnchor(t,e,r){let{height:s,width:l,scaleX:n,scaleY:o}=e.getState();const{left:i,top:a}=this._getRotateAnchorPosition(t,s,l,n,o),g=this._getRotateAnchorCursor(t),c=new Ja(`${t}_${r}`,{zIndex:r-1,fill:this.anchorFill,stroke:this.anchorStroke,strokeWidth:this.anchorStrokeWidth,width:this.anchorSize,height:this.anchorSize,radius:this.anchorCornerRadius,left:i,top:a});return this._attachHover(c,g,oi.DEFAULT),c}_checkTransformerType(t){return t.indexOf(qc.OUTLINE)>-1?qc.OUTLINE:t.indexOf(qc.ROTATE)>-1?qc.ROTATE:t.indexOf(qc.ROTATE_LINE)>-1?qc.ROTATE_LINE:t.indexOf(qc.RESIZE_LT)>-1?qc.RESIZE_LT:t.indexOf(qc.RESIZE_CT)>-1?qc.RESIZE_CT:t.indexOf(qc.RESIZE_RT)>-1?qc.RESIZE_RT:t.indexOf(qc.RESIZE_LM)>-1?qc.RESIZE_LM:t.indexOf(qc.RESIZE_RM)>-1?qc.RESIZE_RM:t.indexOf(qc.RESIZE_LB)>-1?qc.RESIZE_LB:t.indexOf(qc.RESIZE_CB)>-1?qc.RESIZE_CB:t.indexOf(qc.RESIZE_RB)>-1?qc.RESIZE_RB:void 0}_updateControlIterator(t){this._transformerControlMap.forEach(((e,r)=>{const s=this._selectedObjectMap.get(r);if(!s)return!0;t(e,s)}))}_updateControl(){this._updateControlIterator(((t,e)=>{const{left:r,top:s}=e.getState();t.transformByState({left:r,top:s}),t.show(),t.makeDirty(!0)}))}_hiddenControl(){this._transformerControlMap.forEach((t=>{t.hide(),t.makeDirty(!0)}))}_attachHover(t,e,r){t.onPointerEnterObserver.add((()=>{t.cursor=e})),t.onPointerLeaveObserver.add((()=>{t.cursor=r}))}_clearControl(){this._transformerControlMap.forEach((t=>{t.dispose()})),this._transformerControlMap.clear(),this.onClearControlObservable.notifyObservers(null)}_createControl(t){let{left:e,top:r,height:s,width:l,angle:n,scaleX:o,scaleY:i,skewX:a,skewY:g,flipX:c,flipY:b}=t.getState();const h=t.oKey,d=this._selectedObjectMap.size,u=[];if(this.borderEnabled){const t=new Ja(`${qc.OUTLINE}_${d}`,__spreadValues({zIndex:d-1,evented:!1,strokeWidth:this.borderStrokeWidth,stroke:this.borderStroke},this._getOutlinePosition(l,s,o,i)));u.push(t)}if(this.resizeEnabled){const{left:t,top:e}=this._getRotateAnchorPosition(qc.ROTATE_LINE,s,l,o,i),r=new Ja(`${qc.ROTATE_LINE}_${d}`,{zIndex:d-1,evented:!1,left:t,top:e,height:this.rotateAnchorOffset,width:1,strokeWidth:this.borderStrokeWidth,stroke:this.borderStroke}),{left:n,top:a}=this._getRotateAnchorPosition(qc.ROTATE,s,l,o,i),g=this._getRotateAnchorCursor(qc.ROTATE),c=new Ja(`${qc.ROTATE}_${d}`,{zIndex:d-1,left:n,top:a,height:this.rotateSize,width:this.rotateSize,radius:this.rotateCornerRadius,strokeWidth:2*this.borderStrokeWidth,stroke:this.borderStroke});this._attachEventToRotate(c),this._attachHover(c,g,oi.DEFAULT),u.push(r,c)}if(this.resizeEnabled)for(let m=0,p=this.enabledAnchors.length;m{t.translate(i+t.left,a+t.top)})),this.onChangingObservable.notifyObservers({objects:this._selectedObjectMap,moveX:i,moveY:a,type:1}),this._startOffsetX=n,this._startOffsetY=o}_updateActiveObjectList(t,e){this._selectedObjectMap.has(t.oKey)||(e.ctrlKey||(this._selectedObjectMap.clear(),this._clearControl()),this._selectedObjectMap.set(t.oKey,t),this._createControl(t))}_addCancelObserver(t){t.onPointerDownObserver.remove(this._cancelFocusObserver),this._cancelFocusObserver=t.onPointerDownObserver.add((e=>{this._selectedObjectMap.clear(),this._clearControl(),t.onPointerDownObserver.remove(this._cancelFocusObserver)}))}}class cb{constructor(t,e,r){var s;if(this._parent=e,this.onPointerDownObserver=new o,this.onPointerMoveObserver=new o,this.onPointerUpObserver=new o,this.onDblclickObserver=new o,this.onMouseWheelObserver=new o,this.onKeyDownObservable=new o,this.onKeyUpObservable=new o,this.onTransformChangeObservable=new o,this._layers=[],this._sceneKey="",this._viewports=[],this._width=100,this._height=100,this._scaleX=1,this._scaleY=1,this._transform=new Ea,this._isFirstDirty=!0,this._evented=!0,this._cursor=oi.DEFAULT,this._transformerOpenState=!1,this._sceneKey=t,r&&this.transformByState(r),this._parent.classType===fi.ENGINE){const e=this._parent;e.addScene(this),e.hasActiveScene()||e.setActiveScene(t),this._inputManager=new Xa(this)}else if(this._parent.classType===fi.SCENE_VIEWER){this._parent.addSubScene(this)}null==(s=this._parent)||s.onTransformChangeObservable.add((t=>{this._resetViewportSize(),this._setTransForm()}))}get classType(){return fi.SCENE}get transform(){return this._transform}get width(){return this._width}get height(){return this._height}get scaleX(){return this._scaleX}get scaleY(){return this._scaleY}get ancestorScaleX(){const t=this.getParent();let e=1;return t.classType===fi.SCENE_VIEWER&&(e=t.ancestorScaleX),this._scaleX*e}get ancestorScaleY(){const t=this.getParent();let e=1;return t.classType===fi.SCENE_VIEWER&&(e=t.ancestorScaleY),this._scaleY*e}get cursor(){return this._cursor}get sceneKey(){return this._sceneKey}get evented(){return this._evented}set transform(t){this._transform=t}set cursor(t){this.setCursor(t)}set width(t){this._width=t}set height(t){this._height=t}set scaleX(t){this._scaleX=t}set scaleY(t){this._scaleY=t}attachControl(t=!0,e=!0,r=!0,s=!0){var l;if(this._parent.classType===fi.ENGINE)return null==(l=this._inputManager)||l.attachControl(t,e,r,s),this}detachControl(){var t;return null==(t=this._inputManager)||t.detachControl(),this}makeDirty(t=!0){var e;return this._viewports.forEach((e=>{e.makeDirty(t)})),this._parent.classType===fi.SCENE_VIEWER&&(null==(e=this._parent)||e.makeDirty(t)),this}makeDirtyNoParent(t=!0){return this._viewports.forEach((e=>{e.makeDirty(t)})),this}isDirty(){for(let t=0;t{void 0!==t[e]&&(r[e]=this[e],this[e]=t[e])})),this._setTransForm(),this.onTransformChangeObservable.notifyObservers({type:ki.all,value:t,preValue:r}))}getParent(){return this._parent}getEngine(){if(this._parent.classType===fi.ENGINE)return this._parent;let t=this._parent;for(;t;){if(t.classType===fi.ENGINE)return t;t=null==t?void 0:t.getParent()}return null}getLayers(){return this._layers}getLayer(t=1){for(let e of this._layers)if(e.zIndex===t)return e;return this._createDefaultLayer(t)}getLayerMaxZIndex(){let t=Number.MIN_VALUE;for(let e=0;e=t&&(t=r.zIndex)}return t}addLayer(...t){this._layers.push(...t)}addObject(t,e=1){var r;return null==(r=this.getLayer(e))||r.addObject(t),this}setObjectBehavior(t){t.parent||(t.parent=this),this.onTransformChangeObservable.add((e=>{t.scaleCacheCanvas()})),t.onIsAddedToParentObserver.notifyObservers(this)}addObjects(t,e=1){var r;return null==(r=this.getLayer(e))||r.addObjects(t),this}removeObject(t){if(null==t)return;const e=this.getLayers();for(let r of e)r.removeObject(t);return this}removeObjects(t){if(null==t)return;const e=this.getLayers();for(let r of e)r.removeObjects(t);return this}getAllObjects(){const t=[];this._layers.sort(Es);for(let e of this._layers)t.push(...e.getObjectsByOrder());return t}getAllObjectsByOrder(t=!1){const e=[],r=t?Ys:Es;this._layers.sort(r);for(let s of this._layers)e.push(...s.getObjectsByOrder().sort(r));return e}getAllObjectsByOrderForPick(t=!1){const e=[],r=t?Ys:Es;this._layers.sort(r);for(let s of this._layers)e.push(...s.getObjectsByOrderForPick().sort(r));return e}getObject(t){for(let e of this._layers){const r=e.getObjectsByOrder();for(let e of r)if(e.oKey===t)return e}}fuzzyMathObjects(t){for(let e of this._layers){const r=e.getObjectsByOrder();for(let e of r)e.oKey.indexOf(t)>-1&&r.push(e)}return[]}addViewport(...t){return this._viewports.push(...t),this}removeViewport(){}getViewports(){return this._viewports}getViewport(t){for(let e of this._viewports)if(e.viewPortKey===t)return e}changeObjectOrder(){}renderObjects(t,e){return this.getAllObjectsByOrder().forEach((r=>{r.render(t,e)})),this}render(t){var e,r;this.isDirty()&&(!t&&(null==(e=this.getEngine())||e.getCanvas().clear()),null==(r=this.getViewports())||r.forEach((e=>e.render(t))))}enableEvent(){this._evented=!0}disableEvent(){this._evented=!1}async requestRender(t){return new Promise(((e,r)=>{this.render(t),Vi(e)}))}openTransformer(t){this._transformer||(this._transformer=new gb(this,t)),this._transformerOpenState=!0}closeTransformer(t=!1){t&&(this._transformer=null),this._transformerOpenState=!1}applyTransformer(t){var e;this._transformerOpenState&&(null==(e=this._transformer)||e.attachTo(t))}getTransformer(){return this._transformer}getActiveViewportByRelativeCoord(t){return this._viewports.find((e=>e.isHit(t)))}getActiveViewportByCoord(t){return t=this.getRelativeCoord(t),this.getActiveViewportByRelativeCoord(t)}getRelativeCoord(t){let e=this.getParent();const r=[];for(;e;)e.classType!==fi.SCENE&&e.classType!==fi.SCENE_VIEWER||r.push(e),e=(null==e?void 0:e.getParent)&&(null==e?void 0:e.getParent());r.reverse();for(let s of r)if(s.classType===fi.SCENE){const e=s.getActiveViewportByCoord(t);if(e){const r=e.actualScrollX||0,s=e.actualScrollY||0;t=t.addByPoint(r,s)}}else if(s.classType===fi.SCENE_VIEWER){t=s.transform.clone().invert().applyPoint(t)}return t}transformToSceneCoord(t){const e=this.getActiveViewportByCoord(t);return null==e?void 0:e.getRelativeVector(t)}clearLayer(){this._layers=[]}clearViewports(){this._viewports=[]}dispose(){var t;this.getLayers().forEach((t=>{t.dispose()})),this.getViewports().forEach((t=>{t.dispose()})),this.clearLayer(),this.clearViewports(),this.detachControl(),null==(t=this._transformer)||t.dispose(),this.onPointerDownObserver.clear(),this.onPointerMoveObserver.clear(),this.onPointerUpObserver.clear(),this.onDblclickObserver.clear(),this.onMouseWheelObserver.clear(),this.onKeyDownObservable.clear(),this.onKeyUpObservable.clear()}pick(t){let e=this.getActiveViewportByCoord(t);if(e||(e=this._viewports[0]),!this._evented||!e)return;const r=e.pickScrollBar(t);if(r)return r;const s=e.getRelativeVector(t);let l=null;const n=this.getAllObjectsByOrderForPick().reverse(),o=n.length;for(let i=0;i{t.resetSize()}))}_setTransForm(){const t=Ea.create().composeMatrix({scaleX:this.scaleX,scaleY:this.scaleY});this.transform=t,this.getViewports().forEach((t=>{t.resizeScrollBar()})),this.makeDirty(!0)}_getGroupCumLeftRight(t){let e=t.parent,r=0,s=0;for(;e.classType===fi.GROUP;){const{left:t,top:l}=e;r+=t,s+=l,e=e.parent}return{cumLeft:r,cumTop:s}}}class bb extends Pa{constructor(t,e){super(t),this._subScenes=new Map,this._allowSelectedClipElement=!1,this._initialProps(e)}get classType(){return fi.SCENE_VIEWER}render(t,e){var r;if(!this.visible)return this.makeDirty(!1),this;if(e){const{minX:t,maxX:r,minY:s,maxY:l}=Fa(this,e);if(this.width+this.strokeWidth{t.dispose()}))}_initialProps(t){if(!t)return;const e=Object.keys(t);if(0===e.length)return;const r={};let s=!1;e.forEach((e=>{if(void 0===t[e])return!0;r[e]=t[e],s=!0})),s&&this.transformByState(r),this.makeDirty(!0)}}(lb=sb||(sb={}))[lb.scrollTo=0]="scrollTo",lb[lb.scrollBy=1]="scrollBy";class hb{constructor(t,e,r){var s;this.scrollX=0,this.scrollY=0,this.onMouseWheelObserver=new o,this.onScrollAfterObserver=new o,this.onScrollBeforeObserver=new o,this.onScrollStopObserver=new o,this._dirty=!0,this._topOrigin=0,this._leftOrigin=0,this._bottomOrigin=0,this._rightOrigin=0,this._top=0,this._left=0,this._bottom=0,this._right=0,this._isWheelPreventDefaultX=!1,this._isWheelPreventDefaultY=!1,this._allowCache=!1,this._preScrollX=0,this._preScrollY=0,this._renderClipState=!0,this._viewPortKey=t,this._scene=e,this.top=(null==r?void 0:r.top)||0,this.left=(null==r?void 0:r.left)||0,this.bottom=(null==r?void 0:r.bottom)||0,this.right=(null==r?void 0:r.right)||0,(null==r?void 0:r.width)&&(this.width=null==r?void 0:r.width,this._widthOrigin=this.width),(null==r?void 0:r.height)&&(this.height=null==r?void 0:r.height,this._heightOrigin=this.height),this._allowCache&&(this._cacheCanvas=new za),this._isWheelPreventDefaultX=(null==r?void 0:r.isWheelPreventDefaultX)||!1,this._isWheelPreventDefaultY=(null==r?void 0:r.isWheelPreventDefaultY)||!1,this._resizeCacheCanvasAndScrollBar(),null==(s=this._scene)||s.getParent().onTransformChangeObservable.add((()=>{this._resizeCacheCanvasAndScrollBar()}))}get scene(){return this._scene}get width(){return this._width}get height(){return this._height}get viewPortKey(){return this._viewPortKey}get topOrigin(){return this._topOrigin}get leftOrigin(){return this._leftOrigin}get bottomOrigin(){return this._bottomOrigin}get rightOrigin(){return this._rightOrigin}get top(){return this._top}get left(){return this._left}get bottom(){return this._bottom}get right(){return this._right}set width(t){this._width=t}set height(t){this._height=t}set top(t){var e,r;this._topOrigin=t,this._top=Wi(t,null==(r=null==(e=this._scene)?void 0:e.getParent())?void 0:r.height)}set left(t){var e;this._leftOrigin=t,this._left=Wi(t,null==(e=this.scene.getParent())?void 0:e.width)}set bottom(t){var e;this._bottomOrigin=t,this._bottom=Wi(t,null==(e=this.scene.getParent())?void 0:e.height)}set right(t){var e;this._rightOrigin=t,this._right=Wi(t,null==(e=this.scene.getParent())?void 0:e.width)}resetSize(){this._resizeCacheCanvasAndScrollBar(!0)}setScrollBar(t){this._scrollBar&&console.warn("Old scrollBar will be replaced "),this._scrollBar=t,this._resizeCacheCanvasAndScrollBar()}resize(t){const e=Object.keys(t);0!==e.length&&(this._width=void 0,this._height=void 0,e.forEach((e=>{void 0!==t[e]&&(this[e]=t[e])})),this._resizeCacheCanvasAndScrollBar())}resizeScrollBar(){this._resizeCacheCanvasAndScrollBar()}makeDirty(t=!0){this._dirty=t}isDirty(){return this._dirty}scrollTo(t){return this._scroll(0,t)}scrollBy(t){return this._scroll(1,t)}getBarScroll(t,e){let r=t,s=e;if(this._scrollBar){r*=this._scrollBar.ratioScrollX,s*=this._scrollBar.ratioScrollY;const{scaleX:t,scaleY:e}=this.scene;r=Math.round(r)*t,s=Math.round(s)*e}else void 0!==this.scrollX&&(r=this.scrollX),void 0!==this.scrollY&&(s=this.scrollY);return{x:r,y:s}}getActualScroll(t,e){let r=t,s=e;if(this._scrollBar){r/=this._scrollBar.ratioScrollX,s/=this._scrollBar.ratioScrollY;const{scaleX:t,scaleY:e}=this.scene;r=Math.round(r)/t,s=Math.round(s)/e}else void 0!==this.actualScrollX&&(r=this.actualScrollX),void 0!==this.actualScrollY&&(s=this.actualScrollY);return{x:r,y:s}}transformScroll(){let t=this.scrollX,e=this.scrollY;return this.getActualScroll(t,e)}getScrollBar(){return this._scrollBar}updateScroll(t){this._preScrollX=this.scrollX,this._preScrollY=this.scrollY;const{scrollX:e,scrollY:r,actualScrollX:s,actualScrollY:l}=t;return void 0!==e&&(this.scrollX=e),void 0!==r&&(this.scrollY=r),void 0!==s&&(this.actualScrollX=s),void 0!==l&&(this.actualScrollY=l),this}getScrollBarTransForm(t=!1){const e=Ea.create();return!t&&this._allowCache||e.multiply(Ea.create([1,0,0,1,this._left,this._top])),e}render(t){var e;const r=t||(null==(e=this._scene.getEngine())?void 0:e.getCanvas().getContext());if(!this.isDirty()&&this._allowCache)return void this._applyCache(r);let s=this._scene.transform.clone();s.multiply(Ea.create([1,0,0,1,-this.actualScrollX||0,-this.actualScrollY||0]));let l=r;if(!l)return;const n=this._getApplyCanvasState();n&&(s.multiply(Ea.create([1,0,0,1,-this.left/this._scene.scaleX,-this.top/this._scene.scaleY])),l=this._cacheCanvas.getContext(),this._cacheCanvas.clear());const o=s.getMatrix(),i=this.getScrollBarTransForm().getMatrix();l.save(),!n&&this._renderClipState&&(l.beginPath(),l.rect(this.left,this.top,this.width||0,this.height||0),l.clip()),l.transform(o[0],o[1],o[2],o[3],o[4],o[5]),this._scene.renderObjects(l,this._calViewportRelativeBounding()),l.restore(),this._scrollBar&&(l.save(),l.transform(i[0],i[1],i[2],i[3],i[4],i[5]),this.drawScrollbar(l),l.restore()),n&&this._applyCache(r),this.makeDirty(!1),this._scrollRendered()}getBounding(){return this._calViewportRelativeBounding()}getRelativeVector(t){const e=this.scene.transform.clone().invert(),r=this.transformScroll();return e.applyPoint(t).add(Sa.FromArray([r.x,r.y]))}getAbsoluteVector(t){const e=this.scene.transform.clone(),r=this.transformScroll();return e.applyPoint(t).subtract(Sa.FromArray([r.x,r.y]))}onMouseWheel(t,e){if(!this._scrollBar)return;let r;if(t.inputIndex===Oi.MouseWheelX){const s=Math.abs(t.deltaX),l=this._scene.width;let n=(this.width||1)/l*s;r=t.deltaX>0?this.scrollBy({x:n}):this.scrollBy({x:-n}),this._scene.getParent().classType===fi.SCENE_VIEWER?(null==r?void 0:r.isLimitedX)||e.stopPropagation():this._isWheelPreventDefaultX?t.preventDefault():(null==r?void 0:r.isLimitedX)||t.preventDefault()}if(t.inputIndex===Oi.MouseWheelY){const s=Math.abs(t.deltaY),l=this._scene.height;let n=(this.height||1)/l*s;t.shiftKey?(r=t.deltaY>0?this.scrollBy({x:n}):this.scrollBy({x:-n}),this._scene.getParent().classType===fi.SCENE_VIEWER?(null==r?void 0:r.isLimitedX)||e.stopPropagation():this._isWheelPreventDefaultX?t.preventDefault():(null==r?void 0:r.isLimitedX)||t.preventDefault()):(r=t.deltaY>0?this.scrollBy({y:n}):this.scrollBy({y:-n}),this._scene.getParent().classType===fi.SCENE_VIEWER?(null==r?void 0:r.isLimitedY)||e.stopPropagation():this._isWheelPreventDefaultY?t.preventDefault():(null==r?void 0:r.isLimitedY)||t.preventDefault())}t.inputIndex,Oi.MouseWheelZ}isHit(t){const{width:e,height:r}=this._getViewPortSize();return t.x>=this.left&&t.x<=this.left+e&&t.y>=this.top&&t.y<=this.top+r}pickScrollBar(t){if(!this._scrollBar)return;const e=this.getScrollBarTransForm(!0).invert().applyPoint(t);return this._scrollBar.pick(e)}openClip(){this._renderClipState=!0}closeClip(){this._renderClipState=!1}dispose(){var t;this.onMouseWheelObserver.clear(),this.onScrollAfterObserver.clear(),this.onScrollBeforeObserver.clear(),this.onScrollStopObserver.clear(),null==(t=this._scrollBar)||t.dispose()}_resizeCacheCanvasAndScrollBar(t=!1){var e;const{width:r,height:s}=this._getViewPortSize(t);this.width=r,this.height=s;const l=this._scene.width*this._scene.scaleX,n=this._scene.height*this._scene.scaleY;null==(e=this._scrollBar)||e.resize(r,s,l,n),this.makeDirty(!0)}_getViewPortSize(t=!1){var e;const r=null==(e=this._scene)?void 0:e.getParent();let s,l;if(t||void 0===this._widthOrigin){const t=r.width;s=(r.classType===fi.SCENE_VIEWER?t*r.scaleX:t)-(this._left+this._right)}else s=this._widthOrigin;if(t||void 0===this._heightOrigin){const t=r.height;l=(r.classType===fi.SCENE_VIEWER?t*r.scaleY:t)-(this._top+this._bottom)}else l=this._heightOrigin;return{width:s,height:l}}_getApplyCanvasState(){return this._allowCache&&this._renderClipState}_scrollRendered(){this._preScrollX=this.scrollX,this._preScrollY=this.scrollY}_limitedScroll(){var t,e;if(!this._scrollBar)return;const r=(null==(t=this._scrollBar)?void 0:t.limitX)||1/0,s=(null==(e=this._scrollBar)?void 0:e.limitY)||1/0;let l=!0,n=!0;return this.scrollX<0?this.scrollX=0:this.scrollX>r?this.scrollX=r:l=!1,this.scrollY<0?this.scrollY=0:this.scrollY>s?this.scrollY=s:n=!1,{isLimitedX:l,isLimitedY:n}}_triggerScrollStop(t,e,r){window.clearTimeout(this._scrollStopNum),this._scrollStopNum=window.setTimeout((()=>{var s,l;this.onScrollStopObserver.notifyObservers({viewport:this,scrollX:this.scrollX,scrollY:this.scrollY,x:e,y:r,actualScrollX:t.x,actualScrollY:t.y,limitX:null==(s=this._scrollBar)?void 0:s.limitX,limitY:null==(l=this._scrollBar)?void 0:l.limitY})}),0)}_scroll(t,e){var r,s,l,n;const{x:o,y:i}=e;void 0!==o&&(1===t?this.scrollX+=o:this.scrollX=o),void 0!==i&&(1===t?this.scrollY+=i:this.scrollY=i);const a=this._limitedScroll();this.onScrollBeforeObserver.notifyObservers({viewport:this,scrollX:this.scrollX,scrollY:this.scrollY,x:o,y:i,limitX:null==(r=this._scrollBar)?void 0:r.limitX,limitY:null==(s=this._scrollBar)?void 0:s.limitY}),this._scrollBar?this._scrollBar.makeDirty(!0):this.makeDirty(!0);const g=this.transformScroll();return this.actualScrollX=g.x,this.actualScrollY=g.y,this.onScrollAfterObserver.notifyObservers({viewport:this,scrollX:this.scrollX,scrollY:this.scrollY,x:o,y:i,actualScrollX:g.x,actualScrollY:g.y,limitX:null==(l=this._scrollBar)?void 0:l.limitX,limitY:null==(n=this._scrollBar)?void 0:n.limitY}),this._triggerScrollStop(g,o,i),a}_calViewportRelativeBounding(){var t,e,r,s;let l=null!=(e=null==(t=this._scrollBar)?void 0:t.ratioScrollX)?e:1,n=null!=(s=null==(r=this._scrollBar)?void 0:r.ratioScrollY)?s:1,o=this.left,i=(this.width||0)+this.left,a=this.top,g=(this.height||0)+this.top,c=0,b=0;null!=this._preScrollX&&(c=(this._preScrollX-this.scrollX)/l),null!=this._preScrollY&&(b=(this._preScrollY-this.scrollY)/n);const h={tl:Sa.FromArray([o,a]),tr:Sa.FromArray([i,a]),bl:Sa.FromArray([o,g]),br:Sa.FromArray([i,g]),dx:c,dy:b};return h.tl=this.getRelativeVector(h.tl),h.tr=this.getRelativeVector(h.tr),h.bl=this.getRelativeVector(h.bl),h.br=this.getRelativeVector(h.br),h}drawScrollbar(t){if(!this._scrollBar)return;const e=this._scene.getParent();(e.classType===fi.SCENE_VIEWER||e.classType===fi.ENGINE)&&this._scrollBar.render(t)}_applyCache(t){if(!t)return;const e=this._cacheCanvas.getPixelRatio(),r=this._cacheCanvas.getWidth()*e,s=this._cacheCanvas.getHeight()*e;t.drawImage(this._cacheCanvas.getCanvasEle(),0,0,r,s,this.left,this.top,this.width||0,this.height||0)}}(ob=nb||(nb={}))[ob.OFF=0]="OFF",ob[ob.ON=1]="ON";class db extends Ac{constructor(t,e){super(t),this._skeleton=e}getSkeleton(){return this._skeleton}updateSkeleton(t){this._skeleton=t}render(t,e){if(!this.visible)return this.makeDirty(!1),this;t.save(),this._draw(t,e),t.restore()}getParentScale(){let{scaleX:t=1,scaleY:e=1}=this.parent;return this.parent.classType===fi.SCENE_VIEWER&&(t=this.parent.ancestorScaleX||1,e=this.parent.ancestorScaleY||1),{scaleX:t,scaleY:e}}_getBounding(t,e,r){const s=t.length,l=e.length;if(!r)return{startRow:0,endRow:s-1,startColumn:0,endColumn:l-1};let n=-1,o=-1,i=-1,a=-1;return n=b(t,r.tl.y),o=b(t,r.bl.y),-1===n&&(n=0),-1===o&&(o=s-1),o>=s&&(o=s-1),i=b(e,r.tl.x),a=b(e,r.tr.x),-1===i&&(i=0),-1===a&&(a=l-1),a>=l&&(a=l-1),{startRow:n-1,endRow:o+1,startColumn:i-1,endColumn:a+1}}_draw(t,e){}}class ub extends db{_draw(t,e){this.draw(t,e)}}(ab=ib||(ib={}))[ab.GRID=0]="GRID";class fb extends Oc{constructor(){super(...arguments),this.type=0}getCellIndex(t,e,r,s,l){return ma(t,e,r,s,l)}}class vb extends fb{constructor(){super(...arguments),this.uKey="DefaultBackgroundExtension",this.zIndex=20}draw(t,e,r){const{rowTitleWidth:s,columnTitleHeight:l,dataMergeCache:n,stylesCache:o}=r,{background:i}=o;if(!r)return;const{rowHeightAccumulation:a,columnTotalWidth:g,columnWidthAccumulation:c,rowTotalHeight:b}=r;if(!a||!c||void 0===g||void 0===b)return;t.save();const{scaleX:h=1,scaleY:d=1}=e;i&&Object.keys(i).forEach((e=>{const r=i[e];t.fillStyle=e||zi([255,255,255]),t.beginPath(),r.forEach(((e,r)=>{r.forEach((r=>{let{isMerged:s,startY:l,endY:o,startX:i,endX:g}=this.getCellIndex(e,r,a,c,n);if(s)return!0;l=sa(l,d),o=sa(o,d),i=sa(i,h),g=sa(g,h),t.moveTo(i,l),t.lineTo(i,o),t.lineTo(g,o),t.lineTo(g,l)}))})),t.closePath(),t.fill()})),t.restore()}}Nc.add(new vb);class mb extends fb{constructor(){super(...arguments),this.uKey="DefaultBorderExtension",this.zIndex=30}draw(t,e,r){const{rowColumnSegment:s,rowTitleWidth:l,columnTitleHeight:n,dataMergeCache:o,stylesCache:i,overflowCache:a}=r,{border:g}=i;if(!r)return;const{rowHeightAccumulation:c,columnTotalWidth:b,columnWidthAccumulation:h,rowTotalHeight:d}=r;if(!c||!h||void 0===b||void 0===d)return;t.save();const{scaleX:u=1,scaleY:f=1}=e,v=this._getScale(e);let m,p;null==g||g.forEach(((e,r)=>{null==r||r.forEach(((r,s)=>{if(!s)return!0;let{isMerged:l,startY:n,endY:i,startX:g,endX:b}=this.getCellIndex(e,r,c,h,o);if(l)return!0;n=sa(n,f),i=sa(i,f),g=sa(g,u),b=sa(b,u);for(let o in s){const{type:l,style:c,color:h}=s[o];this._getOverflowExclusion(a,l,e,r)||(c!==m&&(Ra(t,c),t.lineWidth=Ia(c)/v,m=c),h!==p&&(t.strokeStyle=h||ci,p=h),Ya(t,l,{startX:g,startY:n,endX:b,endY:i}))}}))})),t.closePath(),t.restore()}_getOverflowExclusion(t,e,r,s){let l=!1;return e===bi.TOP||e===bi.BOTTOM||t&&t.forEach(((t,s)=>{if(t!==r)return!0;s.forEach(((t,r)=>{const{startColumn:s,endColumn:n}=r;return e===bi.LEFT&&t>s&&t<=n||e===bi.RIGHT&&t>=s&&tw-1)continue;const e=sa(u[T],p);t.moveTo(0,e),t.lineTo(_,e)}for(let T=h;T<=d;T++){if(T<0||T>C-1)continue;const e=sa(v[T],p);t.moveTo(e,0),t.lineTo(e,B)}t.stroke(),t.closePath(),this._clearRectangle(t,p,u,v,o),this._clearRectangle(t,p,u,v,i),t.restore()}_clearRectangle(t,e,r,s,l){null==l||l.forEach(((l,n)=>{null==n||n.forEach(((l,n)=>{const{startRow:o,endRow:i,startColumn:a,endColumn:g}=n,c=sa(r[o-1]||0,e),b=sa(r[i],e),h=sa(s[a-1]||0,e),d=sa(s[g],e);t.clearRect(h,c,d-h,b-c),t.beginPath(),t.moveTo(h,c),t.lineTo(d,c),t.lineTo(d,b),t.lineTo(h,b),t.lineTo(h,c),t.stroke(),t.closePath()}))}))}}Nc.add(new pb);class _b extends fb{constructor(){super(...arguments),this.uKey="DefaultFontExtension",this.zIndex=40}getDocuments(){return this.parent.getDocuments()}setChangeFontColor(t,e,r){this.changeFontColor.setValue(t,e,r)}draw(t,e,r){const{rowColumnSegment:s,rowTitleWidth:l,columnTitleHeight:n,stylesCache:o,dataMergeCache:i,overflowCache:a}=r,{font:g}=o;if(!r)return;const{rowHeightAccumulation:c,columnTotalWidth:b,columnWidthAccumulation:h,rowTotalHeight:d}=r;if(!c||!h||void 0===b||void 0===d)return;t.save();const u=this._getScale(e),{scaleX:f=1,scaleY:v=1}=e;g&&Object.keys(g).forEach((e=>{g[e].forEach(((e,r)=>{r.forEach(((r,s)=>{let{isMerged:l,isMergedMainCell:n,startY:o,endY:g,startX:b,endX:d,mergeInfo:m}=this.getCellIndex(e,r,c,h,i);if(l)return!0;o=sa(o,v),g=sa(g,v),b=sa(b,f),d=sa(d,f);const p=d-b,_=g-o,B=a.getValue(e,r),{horizontalAlign:C}=s;if(t.save(),t.beginPath(),B){const{startColumn:s,startRow:l,endColumn:n,endRow:i}=B;s===n&&s===r?t.rect(b,o,p,_):C===ie.CENTER?this._clipRectangle(t,l,i,s,n,u,c,h):C===ie.RIGHT?this._clipRectangle(t,l,e,s,r,u,c,h):this._clipRectangle(t,e,i,r,n,u,c,h)}else t.rect(b,o,p,_);t.clip(),t.translate(b,o),this._renderDocuments(t,s,b,o,d,g,e,r),t.restore()}))}))})),t.restore()}_renderDocuments(t,e,r,s,l,n,o,i){const a=this.getDocuments(),{documentSkeleton:g,angle:c,verticalAlign:b,horizontalAlign:h,wrapStrategy:d,content:u}=e,f=l-r,v=n-s;d===be.WRAP&&0===c&&(g.updateDocumentDataPageSize(f),g.calculate()),g.makeDirty(!1),a.resize(f,v),a.changeSkeleton(g).render(t)}_clipRectangle(t,e,r,s,l,n,o,i){const a=sa(o[e-1]||0,n),g=sa(o[r],n),c=sa(i[s-1]||0,n),b=sa(i[l],n);t.rect(c,a,b-c,g-a)}}Nc.add(new _b);class Bb extends fb{constructor(){super(...arguments),this.uKey="DefaultRowTitleLayoutExtension",this.zIndex=10}draw(t,e,r){const{rowColumnSegment:s,rowTitleWidth:l=0,columnTitleHeight:n=0}=r,{startRow:o,endRow:i,startColumn:a,endColumn:g}=s;if(!r)return;const{rowHeightAccumulation:c,columnTotalWidth:b,columnWidthAccumulation:h,rowTotalHeight:d}=r;if(!c||!h||void 0===b||void 0===d)return;const u=this._getScale(e);t.fillStyle=zi([248,249,250]),t.fillRect(0,0,l,d),t.textAlign="center",t.textBaseline="middle",t.fillStyle=zi([0,0,0]),t.beginPath(),t.lineWidth=1/u,t.strokeStyle=zi([217,217,217]);let f=0;const v=c.length;for(let m=o-1;m<=i;m++){if(m<0||m>v-1)continue;const e=sa(c[m],u);if(f===e)continue;t.moveTo(0,e),t.lineTo(l,e);const r=f+(e-f)/2;t.fillText(`${m+1}`,l/2,r+1),f=e}t.moveTo(sa(l,u),0),t.lineTo(sa(l,u),d),t.stroke()}}kc.add(new Bb);class Cb extends fb{constructor(){super(...arguments),this.uKey="DefaultColumnTitleLayoutExtension",this.zIndex=10}draw(t,e,r){const{rowColumnSegment:s,rowTitleWidth:l=0,columnTitleHeight:n=0}=r,{startRow:o,endRow:i,startColumn:a,endColumn:g}=s;if(!r)return;const{rowHeightAccumulation:c,columnTotalWidth:b,columnWidthAccumulation:h,rowTotalHeight:d}=r;if(!c||!h||void 0===b||void 0===d)return;const u=this._getScale(e);t.fillStyle=zi([248,249,250]),t.fillRect(0,0,b,n),t.textAlign="center",t.textBaseline="middle",t.fillStyle=zi([0,0,0]),t.beginPath(),t.lineWidth=1/u,t.strokeStyle=zi([217,217,217]);let f=0;const v=h.length;for(let p=a-1;p<=g;p++){if(p<0||p>v-1)continue;const e=sa(h[p],u);if(f===e)continue;t.moveTo(e,0),t.lineTo(e,n);const r=f+(e-f)/2;t.fillText(Ts(p),r,n/2+1),f=e}const m=sa(n,u);t.moveTo(0,m),t.lineTo(b,m),t.stroke()}}Mc.add(new Cb);class wb{constructor(t=Rb.NORMAL){this._type=t}get startColumn(){return this._startColumn}get startRow(){return this._startRow}get endColumn(){return this._endColumn}get endRow(){return this._endRow}get startX(){return this._startX}get startY(){return this._startY}get endX(){return this._endX}get endY(){return this._endY}get type(){return this._type}get currentCell(){return this._currentCell}isEqual(t){const{startColumn:e,startRow:r,endColumn:s,endRow:l,type:n}=this,{startColumn:o,startRow:i,endColumn:a,endRow:g}=t;return e===o&&r===i&&s===a&&l===g}isInclude(t){const{startColumn:e,startRow:r,endColumn:s,endRow:l,type:n}=this,{startColumn:o,startRow:i,endColumn:a,endRow:g}=t;return!(as||i>l||g0)for(const e of t){if(e.model.currentCell)return e}}clearSelectionControls(){let t=this.getCurrentControls();if(t.length>0){for(let e of t)e.dispose();t.length=0}}getActiveRangeList(){const t=this.getCurrentControls();if(t&&t.length>0){return null==t?void 0:t.map((t=>{const e=t.model;return{startRow:e.startRow,startColumn:e.startColumn,endRow:e.endRow,endColumn:e.endColumn}}))}}getActiveRange(){const t=this.getCurrentControls(),e=t&&t[t.length-1].model;return e&&{startRow:e.startRow,startColumn:e.startColumn,endRow:e.endRow,endColumn:e.endColumn}}getActiveSelection(){const t=this.getCurrentControls();return t&&t[t.length-1]}dispose(){this.clearSelectionControls(),this._moveObserver=null,this._upObserver=null}_moving(t,e,r){const s=this._spreadsheet,{startRow:l,startColumn:n,endRow:o,endColumn:i}=this._startSelectionRange,a=s.getScrollXYByRelativeCoords(Sa.FromArray([this._startOffsetX,this._startOffsetY])),g=Ir(s.calculateCellIndexByPosition(t,e,a));if(!g)return!1;const{startRow:c,startColumn:b,endColumn:h,endRow:d}=g,u=Math.min(c,l),f=Math.min(b,n),v=Math.max(d,o),m=Math.max(h,i),p=s.getSelectionBounding(u,f,v,m);if(!p)return!1;const{startRow:_,startColumn:B,endRow:C,endColumn:w}=p,T=s.getNoMergeCellPositionByIndex(_,B),y=s.getNoMergeCellPositionByIndex(C,w),S={startColumn:B,startRow:_,endColumn:w,endRow:C,startY:(null==T?void 0:T.startY)||0,endY:(null==y?void 0:y.endY)||0,startX:(null==T?void 0:T.startX)||0,endX:(null==y?void 0:y.endX)||0},{startRow:j,endRow:E,startColumn:Y,endColumn:R}=(null==r?void 0:r.model)||{startRow:-1,endRow:-1,startColumn:-1,endColumn:-1};Y===B&&j===_&&R===w&&E===C||r&&r.update(S)}_endSelection(t){var e,r;t.onPointerMoveObserver.remove(this._moveObserver),t.onPointerUpObserver.remove(this._upObserver),t.enableEvent(),null==(e=this._scrollTimer)||e.stopScroll();const s=null==(r=t.getEngine())?void 0:r.activeScene;null==s||s.onPointerDownObserver.remove(this._cancelDownObserver),null==s||s.onPointerUpObserver.remove(this._cancelUpObserver)}_addCancelObserver(){var t;const e=this.getScene(),r=null==(t=e.getEngine())?void 0:t.activeScene;null!=r&&r!==e&&(r.onPointerDownObserver.remove(this._cancelDownObserver),r.onPointerUpObserver.remove(this._cancelUpObserver),this._cancelDownObserver=r.onPointerDownObserver.add((t=>{this._endSelection(e)})),this._cancelUpObserver=r.onPointerUpObserver.add((t=>{this._endSelection(e)})))}_mainEventInitial(){const t=this._spreadsheet;t.onPointerDownObserver.add(((e,r)=>{const{offsetX:s,offsetY:l}=e,n=this.getScene(),o=n.getRelativeCoord(Sa.FromArray([s,l])),{x:i,y:a}=o;this._startOffsetX=i,this._startOffsetY=a;const g=t.getScrollXYByRelativeCoords(o),c=t.calculateCellIndexByPosition(i,a,g),b=Ir(c);if(!b)return!1;const{startRow:h,startColumn:d,endColumn:u,endRow:f,startY:v,endY:m,startX:p,endX:_}=b,B={startColumn:d,startRow:h,endColumn:u,endRow:f,startY:v,endY:m,startX:p,endX:_};this._startSelectionRange=B;let C=this.getCurrentControl(),w=this.getCurrentControls();if(!w)return!1;for(let t of w){if(2===e.button&&t.model.isInclude(B))return void(C=t);if(t.model.isEqual(B)){C=t;break}e.shiftKey||t.clearHighlight()}if(w.length>0&&!e.ctrlKey&&!e.shiftKey){for(let t of w)t.dispose();w.length=0}const T=C&&C.model.currentCell;if(C&&e.shiftKey&&T){const{row:e,column:r}=T,s=t.getNoMergeCellPositionByIndex(e,r),l=t.getNoMergeCellPositionByIndex(f,u),n={startColumn:r,startRow:e,endColumn:B.startColumn,endRow:B.startRow,startY:(null==s?void 0:s.startY)||0,endY:(null==l?void 0:l.endY)||0,startX:(null==s?void 0:s.startX)||0,endX:(null==l?void 0:l.endX)||0};C.update(n,T)}else C=Ob.create(n,w.length+this.getMaxIndex()),C.update(B,c),w.push(C);this.hasSelection=!0,n.disableEvent(),this._endSelection(n);const y=Ka.create(this.getScene());y.startScroll(i,a),this._scrollTimer=y,this._addCancelObserver(),this._moveObserver=n.onPointerMoveObserver.add((t=>{const{offsetX:e,offsetY:r}=t,{x:s,y:l}=n.getRelativeCoord(Sa.FromArray([e,r]));this._moving(s,l,C),y.scrolling(s,l,(()=>{this._moving(s,l,C)}))})),this._upObserver=n.onPointerUpObserver.add((t=>{this._endSelection(n)})),r.stopPropagation()}))}}class kb extends db{constructor(t,e,r=!0){super(t,e),this._allowCache=r,this._cacheOffsetX=0,this._cacheOffsetY=0,this._hasSelection=!1,this._documents=new Kc("__SHEET_EXTENSION_FONT_DOCUMENT_INSTANCE__",void 0,{pageMarginLeft:0,pageMarginTop:0}),this._allowCache&&(this._cacheCanvas=new za),this.onIsAddedToParentObserver.add((t=>{var e;null==(e=null==t?void 0:t.getEngine())||e.onTransformChangeObservable.add((t=>{this.resizeCacheCanvas()})),this.resizeCacheCanvas(),this._addMakeDirtyToScroll()})),this._initialDefaultExtension(),this.makeDirty(!0)}get borderAuxiliaryExtension(){return this._borderAuxiliaryExtension}get backgroundExtension(){return this._backgroundExtension}get borderExtension(){return this._borderExtension}get fontExtension(){return this._fontExtension}getDocuments(){return this._documents}draw(t,e){const r=this.getSkeleton();if(!r)return;const s=this.getParentScale();r.calculate(e);const l=fa(s),{rowTitleWidth:n,columnTitleHeight:o}=r;t.translate(sa(n,l)-.5/l,sa(o,l)-.5/l),this._calculateOverflow();const i=this.getExtensionsByOrder();for(let a of i)a.draw(t,s,r)}isHit(t){const e=this._getInverseCoord(t),r=this.getSkeleton();if(!r)return!1;const{rowTitleWidth:s,columnTitleHeight:l}=r;return e.x>s&&e.y>l}getNoMergeCellPositionByIndex(t,e){const r=this.getSkeleton();if(!r)return;const{rowHeightAccumulation:s,columnWidthAccumulation:l,rowTitleWidth:n,columnTitleHeight:o}=r,{scaleX:i=1,scaleY:a=1}=this.getParentScale();let{startY:g,endY:c,startX:b,endX:h}=va(t,e,s,l);return g=sa(g+o,a),c=sa(c+o,a),b=sa(b+n,i),h=sa(h+n,i),{startY:g,endY:c,startX:b,endX:h}}calculateCellIndexByPosition(t,e,r){const s=this.getSkeleton();if(!s)return;const{x:l,y:n}=r,{rowHeightAccumulation:o,columnWidthAccumulation:i,rowTitleWidth:a,columnTitleHeight:g,dataMergeCacheAll:c}=s;t+=l-a;let h=b(o,e+=n-g),d=b(i,t);if(-1===h){h=o[o.length-1]<=e?o.length-1:0}if(-1===d){d=i[i.length-1]<=t?i.length-1:0}const{scaleX:u=1,scaleY:f=1}=this.getParentScale();let{isMerged:v,startY:m,endY:p,startX:_,endX:B,mergeInfo:C,isMergedMainCell:w}=ma(h,d,o,i,c);return m=sa(m+g,f),p=sa(p+g,f),_=sa(_+a,u),B=sa(B+a,u),C=_a(C,a,g,u,f),{row:h,column:d,startY:m,endY:p,startX:_,endX:B,isMerged:v,isMergedMainCell:w,mergeInfo:C}}getCellByIndex(t,e){const r=this.getSkeleton();if(!r)return;const{scaleX:s=1,scaleY:l=1}=this.getParentScale(),{rowHeightAccumulation:n,columnWidthAccumulation:o,rowTitleWidth:i,columnTitleHeight:a,dataMergeCacheAll:g}=r;let{isMerged:c,startY:b,endY:h,startX:d,endX:u,mergeInfo:f,isMergedMainCell:v}=ma(t,e,n,o,g);return b=sa(b+a,l),h=sa(h+a,l),d=sa(d+i,s),u=sa(u+i,s),f=_a(f,i,a,s,l),{row:t,column:e,startY:b,endY:h,startX:d,endX:u,isMerged:c,isMergedMainCell:v,mergeInfo:f}}getScrollXYByRelativeCoords(t){let e=0,r=0;const s=this.getParent().getActiveViewportByRelativeCoord(t);if(s){e+=s.actualScrollX||0,r+=s.actualScrollY||0}return{x:e,y:r}}getAncestorScrollXY(t,e){let r=this.getParent(),s=0,l=0,n=Sa.FromArray([t,e]);for(;r;){if(r.classType===fi.SCENE){const t=r.getActiveViewportByCoord(n);if(t){s+=t.actualScrollX||0,l+=t.actualScrollY||0}}r=(null==r?void 0:r.getParent)&&(null==r?void 0:r.getParent())}return{x:s,y:l}}getSelectionBounding(t,e,r,s){var l;return null==(l=this.getSkeleton())?void 0:l.getMergeBounding(t,e,r,s)}render(t,e){if(!this.visible)return this.makeDirty(!1),this;if(this._allowCache){if(this._cacheOffsetX=0,this._cacheOffsetY=0,this.isDirty()){let r=e;const s=this._cacheCanvas.getContext();if(r){const{dx:t=0,dy:e=0}=r;this._cacheOffsetX=t,this._cacheOffsetY=e}this._cacheCanvas.clear(),s.save(),s.setTransform(t.getTransform()),this._draw(s,r),s.restore(),this._boundsCache=e}this._applyCache(t)}else t.save(),this._draw(t,e),t.restore();return this.makeDirty(!1),this}resizeCacheCanvas(){const t=this._getAncestorSize();if(!t||null==this._cacheCanvas)return;const{width:e,height:r}=t,s=this.getSkeleton();s&&(s.rowTitleWidth,s.columnTitleHeight),this._cacheCanvas.setSize(e,r),this.makeDirty(!0)}enableSelection(){this._hasSelection||(this._selection=Nb.create(this),this._hasSelection=!0)}disableSelection(){var t;null==(t=this._selection)||t.dispose(),this._hasSelection=!1}getDocsSkeletonPageSize(t,e=0){const r=null==t?void 0:t.getSkeletonData();if(!r)return;const{pages:s}=r,l=s[s.length-1];if(0===e){const{width:t,height:e}=l;return{width:t,height:e}}let n=0,o=0;const i=xa(e),a=[];Eg([l],(t=>{const{lines:r,width:s,spaceWidth:l}=t,{rotatedHeight:n,rotatedWidth:i}=Oa(r,s,e);o+=n,a.push({rotatedWidth:i,spaceWidth:l})}));const g=Math.tan(e),c=Math.sin(e),b=a.length;for(let h=0;h{this.register(t)})),this._borderAuxiliaryExtension=this.getExtensionByKey("DefaultBorderAuxiliaryExtension"),this._backgroundExtension=this.getExtensionByKey("DefaultBackgroundExtension"),this._borderExtension=this.getExtensionByKey("DefaultBorderExtension"),this._fontExtension=this.getExtensionByKey("DefaultFontExtension")}_addMakeDirtyToScroll(){this._hasScrollViewportOperator(this,(t=>{t.onScrollBeforeObserver.add((()=>{this.makeDirty(!0)}))}))}_hasScrollViewportOperator(t,e){let r=t.getParent();for(;r;){if(r.classType===fi.SCENE){const t=r.getViewports();this._getHasScrollViewports(t);for(let r of t)r&&e(r)}r=(null==r?void 0:r.getParent)&&(null==r?void 0:r.getParent())}}_getHasScrollViewports(t){const e=[];for(let r of t){r.getScrollBar()&&e.push(r)}return e}_calculateOverflow(){const t=new v,e=this.getSkeleton();if(!e)return;const r=e.getColumnCount(),{stylesCache:s,rowHeightAccumulation:l,columnWidthAccumulation:n,dataMergeCache:o}=e,{font:i}=s;i&&Object.keys(i).forEach((s=>{i[s].forEach(((s,i)=>{i.forEach(((i,a)=>{let{documentSkeleton:g,angle:c=0,verticalAlign:b,horizontalAlign:h,wrapStrategy:d}=a;const u=e.getCellData().getValue(s,i),f=this.getSkeleton();if(!f)return!0;const{t:v=Ce.STRING}=u||{};if(d===be.OVERFLOW&&v!==Ce.NUMBER&&v!==Ce.BOOLEAN&&h!==ie.JUSTIFIED){let a=this.getDocsSkeletonPageSize(g,c);if(!a)return!0;if(0!==c){let{startY:t,endY:e,startX:r,endX:g}=ma(s,i,l,n,o);const b=g-r,h=e-t;a.height>h&&(a={width:h/Math.tan(Math.abs(c))+b,height:h})}const b=e.getOverflowPosition(a,h,s,i,r),{startColumn:d,endColumn:u}=b;t.setValue(s,i,{startRow:s,endRow:s,startColumn:d,endColumn:u})}else if(d===be.WRAP&&0!==c){let{startY:e,endY:r}=ma(s,i,l,n,o);const a=r-e;g.updateDocumentDataPageSize(a),g.calculate();const b=this.getDocsSkeletonPageSize(g,c);if(!b)return!0;const{startColumn:d,endColumn:u}=f.getOverflowPosition(b,h,s,i,f.getColumnCount());t.setValue(s,i,{startRow:s,endRow:s,startColumn:d,endColumn:u})}}))}))})),e.setOverflowCache(t)}_differentBounds(t){if(!this._boundsCache)return t;const{tl:e,tr:r,bl:s,br:l,dx:n,dy:o}=t,{tl:i,tr:a,bl:g,br:c,dx:b,dy:h}=this._boundsCache,d={tl:e,tr:r,bl:s,br:l,dx:0,dy:0};return e.x===i.x?(e.y>i.y?(d.tl=g,d.tr=c):(d.bl=i,d.br=a),d.dy=i.y-e.y):e.y===i.y&&(e.x>i.x?(d.tl=a,d.bl=c):(d.tr=i,d.br=g),d.dx=i.x-e.x),d}_checkSheetDifferentBounds(t,e){const{tl:r,tr:s,bl:l,br:n}=t,{tl:o,tr:i,bl:a,br:g}=e;return r.x===o.x&&s.x===i.x&&l.x===a.x&&n.x===g.x?r.y>=o.y&&r.y<=a.y||l.y>=o.y&&l.y<=a.y:r.y===o.y&&s.y===i.y&&l.y===a.y&&n.y===g.y&&(r.x>=o.x&&r.x<=i.x||s.x>=o.x&&(s.x,i.x),!0)}}class Mb extends ub{constructor(t,e){super(t,e),this._initialDefaultExtension(),this.makeDirty(!0)}get rowTitleLayoutExtension(){return this._rowTitleLayoutExtension}draw(t,e){const r=this.getSkeleton();if(!r)return;const s=this.getParentScale();r.calculate(e);const l=fa(s),{columnTitleHeight:n}=r;t.translate(-.5/l,sa(n,l)-.5/l);const o=this.getExtensionsByOrder();for(let i of o)i.draw(t,s,r)}isHit(t){const e=this._getInverseCoord(t),r=this.getSkeleton();if(!r)return!1;const{rowTitleWidth:s,columnTitleHeight:l}=r;return e.x>=0&&e.x<=s&&e.y>l}_initialDefaultExtension(){kc.getData().forEach((t=>{this.register(t)})),this._rowTitleLayoutExtension=this.getExtensionByKey("DefaultRowTitleLayoutExtension")}}class Db extends ub{constructor(t,e){super(t,e),this._initialDefaultExtension(),this.makeDirty(!0)}get columnTitleLayoutExtension(){return this._columnTitleLayoutExtension}draw(t,e){const r=this.getSkeleton();if(!r)return;const s=this.getParentScale();r.calculate(e);const l=fa(s),{rowTitleWidth:n}=r;t.translate(sa(n,l)-.5/l,-.5/l);const o=this.getExtensionsByOrder();for(let i of o)i.draw(t,s,r)}isHit(t){const e=this._getInverseCoord(t),r=this.getSkeleton();if(!r)return!1;const{rowTitleWidth:s,columnTitleHeight:l}=r;return e.x>s&&e.y>=0&&e.y<=l}_initialDefaultExtension(){Mc.getData().forEach((t=>{this.register(t)})),this._columnTitleLayoutExtension=this.getExtensionByKey("DefaultColumnTitleLayoutExtension")}}class Lb extends Rc{constructor(t,e,r,s){super(s),this._config=t,this._cellData=e,this._styles=r,this._rowTitleWidth=0,this._columnTitleHeight=0,this.updateLayout(),this.updateDataMerge()}get rowHeightAccumulation(){return this._rowHeightAccumulation}get rowTotalHeight(){return this._rowTotalHeight}get columnWidthAccumulation(){return this._columnWidthAccumulation}get columnTotalWidth(){return this._columnTotalWidth}get rowTitleWidth(){return this._rowTitleWidth}get columnTitleHeight(){return this._columnTitleHeight}get rowColumnSegment(){return this._rowColumnSegment}get dataMergeCache(){return this._dataMergeCache}get stylesCache(){return this._stylesCache}get overflowCache(){return this._overflowCache}get showGridlines(){return this._showGridlines}get dataMergeCacheAll(){return this._dataMergeCacheAll}static create(t,e,r,s){return new Lb(t,e,r,s)}getWorksheetConfig(){return this._config}getCellData(){return this._cellData}getsStyles(){return this._styles}setOverflowCache(t){this._overflowCache=t}calculate(t){if(!this._config)return;if(this.updateLayout(),!this._rowHeightAccumulation||!this._columnWidthAccumulation)return;const{mergeData:e}=this._config;return this._rowColumnSegment=this.getRowColumnSegment(t),this._dataMergeCache=e&&this._getMergeCells(e,this._rowColumnSegment),this._stylesCache=this._calculateStylesCache(),this}updateLayout(){if(!this.dirty)return;const{rowData:t,columnData:e,defaultRowHeight:r,defaultColumnWidth:s,rowCount:l,columnCount:n,rowTitle:o,columnTitle:i,showGridlines:a}=this._config,{rowTotalHeight:g,rowHeightAccumulation:c}=this._generateRowMatrixCache(l,t,r),{columnTotalWidth:b,columnWidthAccumulation:h}=this._generateColumnMatrixCache(n,e,s);return this._rowTitleWidth=o.hidden!==_e.TRUE?o.width:0,this._columnTitleHeight=i.hidden!==_e.TRUE?i.height:0,this._rowTotalHeight=g,this._rowHeightAccumulation=c,this._columnTotalWidth=b,this._columnWidthAccumulation=h,this._showGridlines=a,this.makeDirty(!0),this}updateDataMerge(){const{mergeData:t}=this._config;this._dataMergeCacheAll=t&&this._getMergeCells(t)}getRowColumnSegment(t){return this._getBounding(this._rowHeightAccumulation,this._columnWidthAccumulation,t)}getMergeBounding(t,e,r,s){const l=this._dataMergeCacheAll;if(!l)return{startRow:t,startColumn:e,endRow:r,endColumn:s};let n=!0,o=new v;for(;n;)n=!1,l.forEach(((l,i)=>{i.forEach(((i,a)=>{if(!a||o.getValue(l,i))return!0;const{startRow:g,startColumn:c,endRow:b,endColumn:h}=a;Ba({left:e,top:t,right:s,bottom:r},{left:c,top:g,right:h,bottom:b})&&(t=Math.min(t,g),e=Math.min(e,c),r=Math.max(r,b),s=Math.max(s,h),o.setValue(l,i,!0),n=!0)}))}));return{startRow:t,startColumn:e,endRow:r,endColumn:s}}appendToOverflowCache(t,e,r,s){this._overflowCache.setValue(t,e,{startRow:t,endRow:t,startColumn:r,endColumn:s})}getColumnCount(){return this._columnWidthAccumulation.length}getRowCount(){return this._rowHeightAccumulation.length}getOverflowPosition(t,e,r,s,l){const{width:n,height:o}=t;let i=s,a=s;return e===ie.CENTER?(i=this._getOverflowBound(r,s,0,n/2),a=this._getOverflowBound(r,s,l-1,n/2)):e===ie.RIGHT?i=this._getOverflowBound(r,s,0,n):a=this._getOverflowBound(r,s,l-1,n),{startColumn:i,endColumn:a}}_getBounding(t,e,r){const s=t.length,l=e.length;if(!r)return{startRow:0,endRow:s-1,startColumn:0,endColumn:l-1};let n=-1,o=-1,i=-1,a=-1;return n=b(t,r.tl.y-this.columnTitleHeight),o=b(t,r.bl.y-this.columnTitleHeight),-1===n&&(n=0),-1===o&&(o=s-1),o>=s&&(o=s-1),i=b(e,r.tl.x-this.rowTitleWidth),a=b(e,r.tr.x-this.rowTitleWidth),-1===i&&(i=0),-1===a&&(a=l-1),a>=l&&(a=l-1),{startRow:n-1,endRow:o+1,startColumn:i-1,endColumn:a+1}}_generateRowMatrixCache(t,e,r){let s=0;const l=[],n=new u(e);for(let o=0;or){const n=this._columnWidthAccumulation.length-1;for(let o=e;o>=r;o--){const r=o;if(!Ar(this._cellData.getValue(t,r))&&r!==e||this._intersectMergeRange(t,r))return r===e?r:r+1>n?n:r+1;const{startX:i,endX:a}=va(t,r,this.rowHeightAccumulation,this.columnWidthAccumulation);if(l+=a-i,s{null==l||l.forEach(((r,l)=>{const{startRow:n,endRow:o,startColumn:i,endColumn:a}=l;if(t>=n&&t<=o&&e>=i&&e<=a)return s=!0,!1}))})),s}_calculateStylesCache(){const t={background:{},font:{},border:new v},e=this.getFontLocale(),r=this._dataMergeCache,s=this._rowColumnSegment,l=this.columnWidthAccumulation,n=this._styles,o=this._cellData,{startRow:i,endRow:a,startColumn:g,endColumn:c}=s;for(let b=i;b<=a;b++){for(let r=g;r<=c;r++)this.__setCellCache(b,r,{cache:t,styles:n,cellData:o,skipBackgroundAndBorder:!1},e);for(let r=0;r{s.forEach(((s,l)=>{if(!l)return!0;this.__setCellCache(r,s,{cache:t,styles:n,cellData:o,skipBackgroundAndBorder:!1},e)}))})),t}__setCellCache(t,e,r,s){const{cache:l,skipBackgroundAndBorder:n=!1,styles:o,cellData:i}=r;if(!i)return!0;const a=i.getValue(t,e);if(!a)return!0;const g=o&&o.getStyleByCell(a);if(!n&&g&&g.bg&&g.bg.rgb){const r=g.bg.rgb;l.background[r]||(l.background[r]=new v);l.background[r].setValue(t,e,r)}!n&&g&&g.bd&&(this.___setBorderProps(t,e,bi.TOP,g,l),this.___setBorderProps(t,e,bi.BOTTOM,g,l),this.___setBorderProps(t,e,bi.LEFT,g,l),this.___setBorderProps(t,e,bi.RIGHT,g,l));const c=a.m||a.v;let b,h="document";const d=this._getOtherStyle(g),u=d.textRotation||{a:0,v:_e.FALSE},f=d.horizontalAlign||ie.UNSPECIFIED,m=d.verticalAlign||ge.UNSPECIFIED,p=d.wrapStrategy||be.UNSPECIFIED;if(a.p){l.font[h]||(l.font[h]=new v);let{a:t=0,v:e=_e.FALSE}=u,r=0,s=t;e===_e.TRUE&&(r=90,s=90),b=this._updateRenderConfigAndHorizon(a.p,f,{horizontalAlign:f,verticalAlign:m,centerAngle:r,vertexAngle:s,wrapStrategy:p})}else if(c){const t=this._getFontFormat(g);h=la(t,s).fontString,l.font[h]||(l.font[h]=new v),b=this._getDocumentDataByStyle(c.toString(),t,d)}const _=l.font[h];let{a:B,v:C=_e.FALSE}=u;if(C===_e.TRUE&&(B=90),b){const r=Ic.create(b,this.getContext());0!==B&&p===be.WRAP||r.calculate(),_.setValue(t,e,{documentSkeleton:r,angle:B,verticalAlign:m,horizontalAlign:f,wrapStrategy:p,content:null==c?void 0:c.toString()})}}_updateRenderConfigAndHorizon(t,e,r){var s;if(!r)return;if(!(null==(s=t.body)?void 0:s.blockElements))return;t.documentStyle||(t.documentStyle={}),t.documentStyle.renderConfig=r;const l=t.body.blockElements;for(let n of l)if(n.blockType===E.PARAGRAPH){if(!n.paragraph)continue;n.paragraph.paragraphStyle||(n.paragraph.paragraphStyle={}),n.paragraph.paragraphStyle.horizontalAlign=e}return t}_getDocumentDataByStyle(t,e,r){const s=t.length-1,{textRotation:l={a:0,v:_e.FALSE},textDirection:n=se.UNSPECIFIED,paddingData:o={t:0,r:2,b:0,l:2},horizontalAlign:i=ie.UNSPECIFIED,verticalAlign:a=ge.UNSPECIFIED,wrapStrategy:g=be.UNSPECIFIED}=r,{a:c=0,v:b=_e.FALSE}=l,{t:h,r:d,b:u,l:f}=o;k.NORMAL;let v=0,m=c;b===_e.TRUE&&(v=90,m=90,k.TBRL);return{id:"d",body:{blockElements:[{blockId:"oneParagraph",st:0,ed:s,blockType:E.PARAGRAPH,paragraph:{paragraphStyle:{horizontalAlign:i},elements:[{eId:"oneElement",st:0,ed:s,et:D.TEXT_RUN,tr:{ct:t,ts:e}}]}}]},documentStyle:{pageSize:{width:1/0,height:1/0},marginTop:h,marginBottom:u,marginRight:d,marginLeft:f,renderConfig:{horizontalAlign:i,verticalAlign:a,centerAngle:v,vertexAngle:m,wrapStrategy:g}}}}___setBorderProps(t,e,r,s,l){var n;const o=null==(n=s.bd)?void 0:n[r];if(!o||!l.border)return!0;const i=xr(o.cl)||ci,a=l.border;a.getValue(t,e)||a.setValue(t,e,{[r]:{}}),a.getValue(t,e)[r]={type:r,style:o.s,color:i}}_getFontFormat(t){if(!t)return{};const{ff:e,fs:r,it:s,bl:l,ul:n,st:o,ol:i,cl:a,bg:g,bd:c}=t;return{ff:e,fs:r,it:s,bl:l,ul:n,st:o,ol:i,cl:a}}_getOtherStyle(t){if(!t)return{};const{tr:e,td:r,ht:s,vt:l,tb:n,pd:o}=t;return{textRotation:e,textDirection:r,horizontalAlign:s,verticalAlign:l,wrapStrategy:n,paddingData:o}}_getMergeCells(t,e){const r=this.columnWidthAccumulation.length-1;if(e)e={startRow:e.startRow,endRow:e.endRow,endColumn:r,startColumn:0};else{e={startRow:0,startColumn:0,endRow:this.rowHeightAccumulation.length-1,endColumn:r}}const{startRow:s,startColumn:l,endRow:n,endColumn:o}=e,i=new v;for(let a=0;a=e&&t<=r&&n>=g&&n<=c){i.setValue(e,g,{startRow:e,endRow:r,startColumn:g,endColumn:c}),s=!0;break}if(s)break}}return i}}function Pb(t,e,r){t.onPointerEnterObserver.add((r=>{e(t,r)})),t.onPointerLeaveObserver.add((e=>{r(t,e)}))}var Hb,Fb;(Fb=Hb||(Hb={})).LEFT="__slideNavigationLeft__",Fb.RIGHT="__slideNavigationRight__";const Ub="M512 1024C229.248 1024 0 794.752 0 512S229.248 0 512 0s512 229.248 512 512-229.248 512-512 512z m200.746667-478.506667l1.749333-1.664 30.165333-30.165333-330.496-330.581333a42.837333 42.837333 0 0 0-60.288 0 42.538667 42.538667 0 0 0 0 60.330666l270.08 270.165334-270.08 269.952a42.496 42.496 0 0 0 0 60.288c16.64 16.64 43.861333 16.469333 60.288 0.042666l298.581334-298.368z";class zb extends bb{constructor(){super(...arguments),this.onSlideChangePageByNavigationObservable=new o,this._navigationEnabled=!1}activeFirstPage(){const t=this.getSubScenes().keys().next().value;null!=t&&this.changePage(t)}addPage(t){const e=t.sceneKey;null==this.getSubScene(e)&&(this.addSubScene(t),this.addNavigation())}changePage(t){null!==t&&(this.removeNavigation(),this.activeSubScene(t),this.addNavigation())}hasPage(t){return this.getSubScene(t)}addNavigation(){const t=this.getActiveSubScene();if(null==t||!1===this._navigationEnabled)return;const e=new og(Hb.LEFT,{data:Ub,width:60,height:60,left:90,top:(this.height-30)/2,fill:this._getArrowColor(),flipX:!0}),r=new og(Hb.RIGHT,{data:Ub,width:60,height:60,left:this.width-90,top:(this.height-30)/2,fill:this._getArrowColor()}),s=(t,e)=>{t.setCursor(oi.POINTER),t.setProps({fill:this._getArrowColor(!0)})},l=(t,e)=>{t.setCursor(oi.DEFAULT),t.setProps({fill:this._getArrowColor()})};Pb(e,s,l),Pb(r,s,l),this._addNavTrigger(e,r),t.addObjects([e,r],7)}removeNavigation(){var t,e;const r=this.getActiveSubScene();null!=r&&!1!==this._navigationEnabled&&(null==(t=r.getObject(Hb.LEFT))||t.dispose(),null==(e=r.getObject(Hb.RIGHT))||e.dispose())}enableNav(){this._navigationEnabled=!0}disableNav(){this._navigationEnabled=!1}hiddenNav(){var t,e;const r=this.getActiveSubScene();null!=r&&!1!==this._navigationEnabled&&(null==(t=r.getObject(Hb.LEFT))||t.hide(),null==(e=r.getObject(Hb.RIGHT))||e.hide())}showNav(){var t,e;const r=this.getActiveSubScene();null!=r&&!1!==this._navigationEnabled&&(null==(t=r.getObject(Hb.LEFT))||t.show(),null==(e=r.getObject(Hb.RIGHT))||e.show())}renderToThumb(t,e,r=1,s=1){const l=this.getSubScene(e);null!=l&&(t.save(),t.scale(r,s),l.makeDirtyNoParent(!0).render(t),t.restore())}_getSubScenesIndex(t){if(null==t)return;const e=Array.from(this.getSubScenes()),r=e.length;let s=0;for(let o=0;o=r?0:l,n=n<0?r-1:n,{nextScene:e[l][1],previousScene:e[n][1]}}_addNavTrigger(t,e){t.onPointerDownObserver.add((()=>{var t;const e=this._getSubScenesIndex(null==(t=this.getActiveSubScene())?void 0:t.sceneKey),r=null==e?void 0:e.previousScene.sceneKey;this.changePage(r),this.onSlideChangePageByNavigationObservable.notifyObservers(r)})),e.onPointerDownObserver.add((()=>{var t;const e=this._getSubScenesIndex(null==(t=this.getActiveSubScene())?void 0:t.sceneKey),r=null==e?void 0:e.nextScene.sceneKey;this.changePage(r),this.onSlideChangePageByNavigationObservable.notifyObservers(r)}))}_getArrowColor(t=!1){return zi(Ko.white,t?.8:.5)}}class Wb extends ro{constructor(){super(Fe.BASE_RENDER),this._engine=new Wa}static create(){return new Wb}installTo(t){t.install(this)}getEngine(){return this._engine}}var Vb,Gb,Xb=Object.freeze(Object.defineProperty({__proto__:null,zh:Xo,en:Qo,RGB_PAREN:"rgb(",RGBA_PAREN:"rgba(",COLORS:Ko,get SHAPE_TYPE(){return Zo},get EVENT_TYPE(){return $o},get LINK_VIEW_PORT_TYPE(){return Jo},MIDDLE_CELL_POS_MAGIC_NUMBER:1,DEFAULT_FONTFACE_PLANE:ei,DEFAULT_SKELETON_HEADER:si,DEFAULT_SKELETON_FOOTER:li,DEFAULT_MEASURE_TEXT:"0",DEFAULT_OFFSET_SPACING:1,DEFAULT_DOCUMENT_FONTSIZE:ni,get CURSOR_TYPE(){return oi},get DOCUMENT_CONTEXT_CLIP_TYPE(){return ai},COLOR_BLACK_RGB:ci,get BORDER_TYPE(){return bi},get ORIENTATION_TYPE(){return di},get RENDER_CLASS_TYPE(){return fi},FontCache:pi,get SkeletonType(){return _i},get BreakType(){return Ci},get LineType(){return Ti},get SpanType(){return Si},get PageLayoutType(){return Ei},get DeviceInputEventType(){return Ri},EventConstants:Di,get DeviceType(){return Ai},get PointerInput(){return Oi},get TRANSFORM_CHANGE_OBSERVABLE_TYPE(){return ki},PerformanceMonitor:Li,RollingAverage:Pi,INITIAL_MATRIX:ja,Transform:Ea,drawLineByBorderType:Ya,setLineType:Ra,getLineWidth:Ia,calculateRectRotate:Aa,getRotateOrientation:xa,getRotateOffsetAndFarthestHypotenuse:Oa,Vector2:Sa,INITIAL_Path2:Na,Path2:ka,getColor:zi,toPx:Wi,requestNewFrame:Vi,cancelRequestFrame:Gi,createCanvasElement:Xi,createImageElement:()=>document.createElement("img"),radToDeg:Qi,degToRad:Ki,getPointerPrefix:Zi,IsSafari:$i,generateRandomKey:qi,getValueType:Ji,isFunction:ta,isDate:function(t){return"[object Date]"===Ji(t)},isRegExp:function(t){return"[object RegExp]"===Ji(t)},isArray:function(t){return"[object Array]"===Ji(t)},isString:ea,isNumber:function(t){return"[object Number]"===Ji(t)},isObject:function(t){return"[object Object]"===Ji(t)},precisionTo:ra,fixLineWidthByScale:sa,getFontStyleString:la,isSupportBoundingBox:function(t){return null!=t.measureText("田").actualBoundingBoxAscent},hasChineseText:na,hasJapaneseText:oa,hasKoreanText:function(t){return!!/[^a-zA-Z0-9\p{Hangul}]/gi.exec(t)},hasCJK:ia,hasWrappableText:function(t){return na(t)||oa(t)},hasAllLatin:function(t){return!!/[\u0000-\u024F]/gi.exec(t)},hasBasicLatin:function(t){return!!/[\u0000-\u007F]/gi.exec(t)},hasLatinOneSupplement:function(t){return!!/[\u0080-\u00FF]/gi.exec(t)},hasLatinExtendedA:function(t){return!!/[\u0100-\u017F]/gi.exec(t)},hasLatinExtendedB:function(t){return!!/[\u0180-\u024F]/gi.exec(t)},hasArabic:aa,hasTibetan:ga,hasSpaceAndTab:ca,getDPI:ha,ptToPx:da,pxToPt:ua,ptToMM:function(t){return t*(ha()/25.4)},pxToInch:function(t){return t*ha()},getScale:fa,getCellPositionByIndex:va,getCellByIndex:ma,mergeCellHandler:pa,mergeInfoOffset:_a,isRectIntersect:Ba,injectStyle:Ca,checkStyle:wa,pxToNum:Ta,getSizeForDom:ya,BlockPlugin:class extends ro{dealWidthCustomBlock(t,e,r,s,l){return[]}onMapping(t){}onMounted(t){}onDestroy(){}},BulletPlugin:class extends ro{dealWidthCustomBulletOrderedSymbol(t,e,r){return""}onMapping(t){}onMounted(t){}onDestroy(){}},dealWidthCustomBlock:Ma,dealWidthCustomBulletOrderedSymbol:Da,CustomObject:class extends Pa{constructor(t,e=(t=>{}),r){super(t),this._render=e,this._isHitCustom=r}toJson(){return __spreadValues({},super.toJson())}render(t,e){if(!this.visible)return this.makeDirty(!1),this;if(e&&!this.isInGroup){const{minX:t,maxX:r,minY:s,maxY:l}=Fa(this,e);if(this.width+this.strokeWidthe.getRange().id===t));e>-1&&this._antLineList.splice(e,1)}addAntLine(t){this._antLineList.push(t)}getSheetId(){return this._sheetId}getAntLineList(){return this._antLineList}getAntLineById(t){const e=this._antLineList.findIndex((e=>e.getRange().id===t));if(e>-1)return this._antLineList[e]}}(eh=th||(th={})).Selection="__SelectionDragShape__",eh.top="__TopDragControl__",eh.bottom="__BottomDragControl__",eh.left="__LeftDragControl__",eh.right="__RightDragControl__";class oh{constructor(t){this._control=t,this._startOffsetX=0,this._startOffsetY=0,this._zIndex=t.zIndex+1,this._model=t.model,this._initialize()}static create(t){return new oh(t)}dragEventInitial(){}dragDown(t,e){const r=this._control.getPlugin().getMainComponent(),s=this._model.getValue().selection;this._model=new uh(gh.NORMAL,this._control.getPlugin()),this._model.setValue(s),this._updateControl();const{offsetX:l,offsetY:n}=t;this._startOffsetX=l,this._startOffsetY=n;const o=r.getAncestorScrollXY(this._startOffsetX,this._startOffsetY);let i=null;switch(e){case Pt.LEFT:i=r.calculateCellIndexByPosition(l+ah.strokeWidth,n,o);break;case Pt.TOP:i=r.calculateCellIndexByPosition(l,n+ah.strokeWidth,o);break;case Pt.RIGHT:i=r.calculateCellIndexByPosition(l-ah.strokeWidth,n,o);break;case Pt.BOTTOM:i=r.calculateCellIndexByPosition(l,n-ah.strokeWidth,o)}const a=Ir(i);if(!a)return!1;const{startRow:g,startColumn:c,endColumn:b,endRow:h,startY:d,endY:u,startX:f,endX:v}=a,m={startColumn:c,startRow:g,endColumn:b,endRow:h,startY:d,endY:u,startX:f,endX:v};this._oldSelectionRange=m,this._cellPositionOffset={top:m.startRow-this._model.startRow,bottom:this._model.endRow-m.endRow,left:m.startColumn-this._model.startColumn,right:this._model.endColumn-m.endColumn};const p=this._control.getScene();p.disableEvent();const _=Ka.create(p);_.startScroll(l,n),this._moveObserver=p.onPointerMoveObserver.add((t=>{this.dragMoving(t);const{offsetX:e,offsetY:r}=t;_.scrolling(e,r,(()=>{this.dragMoving(t)}))})),this._upObserver=p.onPointerUpObserver.add((t=>{this.dragUp(),p.onPointerMoveObserver.remove(this._moveObserver),p.onPointerUpObserver.remove(this._upObserver),p.enableEvent(),_.stopScroll()}))}dragMoving(t){const e=this._control.getPlugin().getMainComponent(),{offsetX:r,offsetY:s,clientX:l,clientY:n}=t,o=e.getAncestorScrollXY(this._startOffsetX,this._startOffsetY),i=Ir(e.calculateCellIndexByPosition(r,s,o));if(!i)return!1;const{startRow:a,startColumn:g,endColumn:c,endRow:b,startX:h,startY:d,endX:u,endY:f}=i,v={startColumn:g,startRow:a,endColumn:c,endRow:b,startY:d||0,endY:f||0,startX:h||0,endX:u||0},{startRow:m,endRow:p,startColumn:_,endColumn:B}=this._oldSelectionRange;if(_!==g||m!==a||B!==c||p!==b){this._oldSelectionRange=v;const{left:t,right:r,top:s,bottom:l}=this._cellPositionOffset,n=a-s,o=b+l,i=g-t,h=c+r;if(n<0||o<0||i<0||h<0)return;const d={startRow:n,endRow:o,startColumn:i,endColumn:h},u=e.getNoMergeCellPositionByIndex(d.startRow,d.startColumn),f=e.getNoMergeCellPositionByIndex(d.endRow,d.endColumn),m=Object.assign(d,{startY:(null==u?void 0:u.startY)||0,endY:(null==f?void 0:f.endY)||0,startX:(null==u?void 0:u.startX)||0,endX:(null==f?void 0:f.endX)||0});this._model.setValue(m),this._updateControl()}}dragUp(){const t=this._control.getPlugin().getMainComponent();this.hide();const{selection:e}=this._model.getValue(),r=t.getCellByIndex(e.startRow,e.startColumn);this._control.update(e,r)}_updateControl(){const{startX:t,startY:e,endX:r,endY:s}=this._model;this._leftDragControl.resize(void 0,s-e),this._rightDragControl.transformByState({height:s-e,left:r-t-ah.strokeWidth/2}),this._topDragControl.resize(r-t+ah.strokeWidth),this._bottomDragControl.transformByState({width:r-t+ah.strokeWidth,top:s-e-ah.strokeWidth/2}),this._selectionDragShape.show(),this._selectionDragShape.translate(t,e),this._selectionDragShape.makeDirty(!0)}hide(){this._selectionDragShape.hide(),this._selectionDragShape.makeDirty(!0)}dispose(){this._leftDragControl.dispose(),this._rightDragControl.dispose(),this._topDragControl.dispose(),this._bottomDragControl.dispose(),this._selectionDragShape.dispose()}remove(){const{leftControl:t,rightControl:e,topControl:r,bottomControl:s}=this._control;t.onPointerEnterObserver.clear(),t.onPointerLeaveObserver.clear(),e.onPointerEnterObserver.clear(),e.onPointerLeaveObserver.clear(),r.onPointerEnterObserver.clear(),r.onPointerLeaveObserver.clear(),s.onPointerEnterObserver.clear(),s.onPointerLeaveObserver.clear()}_initialize(){this._control.getPlugin().getMainComponent();const{leftControl:t,rightControl:e,topControl:r,bottomControl:s,fillControl:l}=this._control;t.onPointerEnterObserver.add((e=>{t.cursor=oi.MOVE})),t.onPointerLeaveObserver.add((e=>{t.resetCursor()})),e.onPointerEnterObserver.add((t=>{e.cursor=oi.MOVE})),e.onPointerLeaveObserver.add((t=>{e.resetCursor()})),r.onPointerEnterObserver.add((t=>{r.cursor=oi.MOVE})),r.onPointerLeaveObserver.add((t=>{r.resetCursor()})),s.onPointerEnterObserver.add((t=>{s.cursor=oi.MOVE})),s.onPointerLeaveObserver.add((t=>{s.resetCursor()})),s.onPointerDownObserver.add((t=>{this.dragDown(t,Pt.BOTTOM)})),s.onPointerUpObserver.add((t=>{s.resetCursor()}));const n=this._zIndex;this._leftDragControl=new Ja(th.left+n,{top:0,left:-ah.strokeWidth/2,width:2*ah.strokeWidth,fill:ah.strokeColor,zIndex:n}),this._rightDragControl=new Ja(th.right+n,{width:2*ah.strokeWidth,fill:ah.strokeColor,zIndex:n}),this._topDragControl=new Ja(th.top+n,{top:-ah.strokeWidth/2,left:-ah.strokeWidth/2,height:2*ah.strokeWidth,fill:ah.strokeColor,zIndex:n}),this._bottomDragControl=new Ja(th.bottom+n,{height:2*ah.strokeWidth,fill:ah.strokeColor,left:-ah.strokeWidth/2,zIndex:n}),this._selectionDragShape=new Qa(th.Selection+n,this._leftDragControl,this._rightDragControl,this._topDragControl,this._bottomDragControl),this._selectionDragShape.evented=!1,this._selectionDragShape.zIndex=n;this._control.getScene().addObject(this._selectionDragShape)}}class ih{constructor(t){this._control=t,this._initialize()}static create(t){return new ih(t)}remove(){const{fillControl:t}=this._control;t.onPointerEnterObserver.clear(),t.onPointerLeaveObserver.clear()}_initialize(){const{fillControl:t}=this._control;this._control.getPlugin(),t.onPointerEnterObserver.add((e=>{t.cursor=oi.CROSSHAIR})),t.onPointerLeaveObserver.add((e=>{t.resetCursor()}))}}const ah={strokeColor:"rgb(1,136,251)",backgroundColor:"rgba(1,136,251, 0.1)",strokeWidth:2,fillSideLength:6,fillStrokeLength:1,fillStrokeColor:"rgb(255,255,255)"};var gh,ch,bh,hh;!function(t){t[t.NORMAL=0]="NORMAL",t[t.ROW=1]="ROW",t[t.COLUMN=2]="COLUMN"}(gh||(gh={})),function(t){t.Selection="__SpreadsheetSelectionShape__",t.top="__SpreadsheetSelectionTopControl__",t.bottom="__SpreadsheetSelectionBottomControl__",t.left="__SpreadsheetSelectionShapeLeftControl__",t.right="__SpreadsheetSelectionShapeRightControl__",t.backgroundTop="__SpreadsheetSelectionBackgroundControlTop__",t.backgroundMiddleLeft="__SpreadsheetSelectionBackgroundControlMiddleLeft__",t.backgroundMiddleRight="__SpreadsheetSelectionBackgroundControlMiddleRight__",t.backgroundBottom="__SpreadsheetSelectionBackgroundControlBottom__",t.fill="__SpreadsheetSelectionFillControl__",t.lineMain="__SpreadsheetDragLineMainControl__",t.lineContent="__SpreadsheetDragLineContentControl__",t.line="__SpreadsheetDragLineControl__"}(ch||(ch={}));class dh{constructor(t,e){this._manager=t,this._zIndex=e,this._initialize()}get zIndex(){return this._zIndex}get leftControl(){return this._leftControl}get rightControl(){return this._rightControl}get topControl(){return this._topControl}get bottomControl(){return this._bottomControl}get fillControl(){return this._fillControl}get backgroundControlTop(){return this._backgroundControlTop}get backgroundControlBottom(){return this._backgroundControlBottom}get backgroundControlMiddleLeft(){return this._backgroundControlMiddleLeft}get backgroundControlMiddleRight(){return this._backgroundControlMiddleRight}get selectionShape(){return this._selectionShape}get model(){return this._selectionModel}static create(t,e){return new this(t,e)}static fromJson(t,e,r){const s=dh.create(t,e);return s.update(r),s}_updateControl(){const{startX:t,startY:e,endX:r,endY:s}=this._selectionModel;this.leftControl.resize(void 0,s-e),this.rightControl.transformByState({height:s-e,left:r-t-ah.strokeWidth/2}),this.topControl.resize(r-t+ah.strokeWidth),this.bottomControl.transformByState({width:r-t+ah.strokeWidth,top:s-e-ah.strokeWidth/2}),this.fillControl.translate(r-t-ah.fillSideLength/2,s-e-ah.fillSideLength/2),this._updateBackgroundControl(),this._updateDragAndFill(),this.selectionShape.show(),this.selectionShape.translate(t,e),this.selectionShape.makeDirty(!0)}update(t,e){this._selectionModel.setValue(t,e),this._updateControl()}clearHighlight(){this._selectionModel.clearCurrentCell(),this._updateControl()}dispose(){var t,e,r,s,l,n,o,i,a,g;null==(t=this._leftControl)||t.dispose(),null==(e=this._rightControl)||e.dispose(),null==(r=this._topControl)||r.dispose(),null==(s=this._bottomControl)||s.dispose(),null==(l=this._backgroundControlTop)||l.dispose(),null==(n=this._backgroundControlMiddleLeft)||n.dispose(),null==(o=this._backgroundControlMiddleRight)||o.dispose(),null==(i=this._backgroundControlBottom)||i.dispose(),null==(a=this._fillControl)||a.dispose(),null==(g=this._selectionShape)||g.dispose(),this._selectionDragAndDrop.dispose()}getScene(){return this._manager.getScene()}getPlugin(){return this._manager.getPlugin()}getCurrentCellInfo(){const t=this.model.currentCell;if(t){let e;if(t.isMerged){const r=t.mergeInfo;e={startRow:r.startRow,endRow:r.endRow,startColumn:r.startColumn,endColumn:r.endColumn,startX:r.startX,endX:r.endX,startY:r.startY,endY:r.endY}}else{const{row:r,column:s,startX:l,endX:n,startY:o,endY:i}=t;e={startRow:r,endRow:r,startColumn:s,endColumn:s,startX:l,endX:n,startY:o,endY:i}}return e}}_initialize(){this._selectionModel=new uh(0,this._manager.getPlugin());const t=this._zIndex;this._leftControl=new Ja(ch.left+t,{top:0,left:-ah.strokeWidth/2,width:ah.strokeWidth,fill:ah.strokeColor,zIndex:t}),this._rightControl=new Ja(ch.right+t,{width:ah.strokeWidth,fill:ah.strokeColor,zIndex:t}),this._topControl=new Ja(ch.top+t,{top:-ah.strokeWidth/2,left:-ah.strokeWidth/2,height:ah.strokeWidth,fill:ah.strokeColor,zIndex:t}),this._bottomControl=new Ja(ch.bottom+t,{height:ah.strokeWidth,fill:ah.strokeColor,left:-ah.strokeWidth/2,zIndex:t}),this._backgroundControlTop=new Ja(ch.backgroundTop+t,{fill:ah.backgroundColor,zIndex:t-1,evented:!1}),this._backgroundControlBottom=new Ja(ch.backgroundBottom+t,{fill:ah.backgroundColor,zIndex:t-1,evented:!1}),this._backgroundControlMiddleLeft=new Ja(ch.backgroundMiddleLeft+t,{fill:ah.backgroundColor,zIndex:t-1,evented:!1}),this._backgroundControlMiddleRight=new Ja(ch.backgroundMiddleRight+t,{fill:ah.backgroundColor,zIndex:t-1,evented:!1});const e=ah.fillSideLength-ah.fillStrokeLength;this._fillControl=new Ja(ch.fill+t,{width:e,height:e,fill:ah.strokeColor,strokeWidth:ah.fillStrokeLength,stroke:ah.fillStrokeColor,zIndex:t+1}),this._selectionShape=new Qa(ch.Selection+t,this._fillControl,this._leftControl,this._rightControl,this._topControl,this._bottomControl,this._backgroundControlTop,this._backgroundControlMiddleLeft,this._backgroundControlMiddleRight,this._backgroundControlBottom),this._selectionShape.hide(),this._selectionShape.evented=!1,this._selectionShape.zIndex=t,this._selectionDragAndDrop=oh.create(this),this._selectionControlFill=ih.create(this);this.getScene().addObject(this._selectionShape)}_updateBackgroundControl(){const{startColumn:t,startRow:e,endColumn:r,endRow:s,startX:l,startY:n,endX:o,endY:i}=this._selectionModel,a=this._selectionModel.highlightToSelection();if(!a)return this._backgroundControlTop.resize(o-l,i-n),this._backgroundControlBottom.resize(0,0),this._backgroundControlMiddleLeft.resize(0,0),void this._backgroundControlMiddleRight.resize(0,0);const{startX:g,startY:c,endX:b,endY:h}=a,d=ah.strokeWidth/2,u={left:-d,top:-d,width:o-l+2*d,height:c-n+d};u.height<0&&(u.width=0,u.height=0),this._backgroundControlTop.transformByState(u);const f={left:-d,top:c-n,width:g-l+d,height:h-c};f.width<0&&(f.width=0,f.height=0),this._backgroundControlMiddleLeft.transformByState(f);const v={left:b-l-d,top:c-n,width:o-b+2*d,height:h-c};v.width<0&&(v.width=0,v.height=0),this._backgroundControlMiddleRight.transformByState(v);const m={left:-d,top:h-n,width:o-l+2*d,height:i-h+d};m.height<0&&(m.width=0,m.height=0),this._backgroundControlBottom.transformByState(m)}_updateDragAndFill(){this._selectionModel.highlightToSelection()||(this._selectionDragAndDrop.remove(),this._fillControl.resize(0,0),this._selectionControlFill.remove())}}class uh{constructor(t=gh.NORMAL,e){this._type=t,this._plugin=e}get startColumn(){return this._startColumn}get startRow(){return this._startRow}get endColumn(){return this._endColumn}get endRow(){return this._endRow}get startX(){return this._startX}get startY(){return this._startY}get endX(){return this._endX}get endY(){return this._endY}get type(){return this._type}get currentCell(){return this._currentCell}isEqual(t){const{startColumn:e,startRow:r,endColumn:s,endRow:l,type:n}=this,{startColumn:o,startRow:i,endColumn:a,endRow:g}=t;return e===o&&r===i&&s===a&&l===g}isInclude(t){const{startColumn:e,startRow:r,endColumn:s,endRow:l,type:n}=this,{startColumn:o,startRow:i,endColumn:a,endRow:g}=t;return!(as||i>l||g{this.dragMoving(t)})),this._upObserver=e.onPointerUpObserver.add((t=>{this.dragUp(t),e.onPointerMoveObserver.remove(this._moveObserver),e.onPointerUpObserver.remove(this._upObserver),e.enableEvent()}))}dragMoving(t){if(this._direction){if(this._dragLine.cursor=oi.ROW_RESIZE,t.clientY=this._end-this._start-5)return;this._dragLine.transformByState({top:t.clientY-this._state.distance})}else{if(this._dragLine.cursor=oi.COLUMN_RESIZE,t.clientX=this._end-this._start-5)return;this._dragLine.transformByState({left:t.clientX-this._state.distance})}}dragUp(t){let e;this._direction?(e=t.clientY-this._state.distance,t.clientY=this._end-this._start-5&&(e=null)):(e=t.clientX-this._state.distance,t.clientX=this._end-this._start-5&&(e=null)),this._dragUp(e,t),this._dragLine.dispose()}}class jh{constructor(t){this._startOffsetX=0,this._startOffsetY=0,this._index=0,this._currentWidth=0,this._manager=t,this._leftTopWidth=this._manager.getSheetView().getSpreadsheetLeftTopPlaceholder().getState().width,this._content=new Ja("HighLightContent",{width:0,height:this._manager.getSheetView().getSpreadsheetSkeleton().columnTitleHeight,left:0,fill:"rgb(220,220,220,0.5)"}),this._Item=new Ja("HighLightItem",{width:5,height:this._manager.getSheetView().getSpreadsheetSkeleton().columnTitleHeight,left:0,fill:"rgb(220,220,220,0.5)"}),this._highlightItem=new Qa("HighLightColumnTitle",this._content,this._Item),this._highlightItem.hide();this._manager.getScene().addObject(this._highlightItem,3),this._initialize()}pointerDown(t){var e,r;const s=this._manager.getMainComponent(),{offsetX:l,offsetY:n}=t;this._startOffsetX=l,this._startOffsetY=n;const o=s.getAncestorScrollXY(this._startOffsetX,this._startOffsetY),i=this._manager.getPlugin().getSheetContainerControl().getContentRef(),a=t.clientX+o.x-this._leftTopWidth-i.current.getBoundingClientRect().left,g=null!=(r=null==(e=s.getSkeleton())?void 0:e.columnWidthAccumulation)?r:[];for(let c=0;c<(null==g?void 0:g.length);c++)if(g[c]>=a){this._index=c;break}if(this._currentWidth=g[0],this._index&&(this._currentWidth=g[this._index]-g[this._index-1]),g[this._index]-a<=5){const e=g[this._index]+this._leftTopWidth,r=(this._index?g[this._index-1]:0)+this._leftTopWidth;this._manager.getDragLineControl().create({direction:ph.VERTICAL,end:e,start:r,dragUp:(t,e)=>{this.setColumnWidth(t),this.highlightColumnTitle(e)}}),this._manager.getDragLineControl().dragDown(t)}this.highlightColumn()}setColumnWidth(t){const e=this._manager.getPlugin().getContext().getWorkBook().getActiveSheet();null===t?e.setColumnWidth(this._index,1,5):e.setColumnWidth(this._index,1,t+this._currentWidth),this.highlightColumn()}highlightColumn(){this._manager.clearSelectionControls();const t=this._manager.getPlugin().getWorkbook().getActiveSheet();this._manager.addControlToCurrentByRangeData({startRow:0,startColumn:this._index,endColumn:this._index,endRow:t.getRowCount()-1},{row:0,column:this._index})}highlightColumnTitle(t){var e,r;const s=this._manager.getMainComponent(),{offsetX:l,offsetY:n}=t;this._startOffsetX=l,this._startOffsetY=n;const o=s.getAncestorScrollXY(this._startOffsetX,this._startOffsetY),i=this._manager.getPlugin().getSheetContainerControl().getContentRef(),a=t.clientX+o.x-this._leftTopWidth-i.current.getBoundingClientRect().left,g=null!=(r=null==(e=s.getSkeleton())?void 0:e.columnWidthAccumulation)?r:[];for(let b=0;b<(null==g?void 0:g.length);b++)if(g[b]>=a){this._index=b;break}this._currentWidth=g[0];let c=this._leftTopWidth;this._index&&(this._currentWidth=g[this._index]-g[this._index-1],c=this._leftTopWidth+g[this._index-1]),this._content.transformByState({width:this._currentWidth-5}),this._Item.transformByState({left:this._currentWidth-5}),this._highlightItem.transformByState({width:this._currentWidth,left:c}),this._highlightItem.show()}_initialize(){this._highlightItem.onPointerEnterObserver.add((t=>{this._highlightItem.show()})),this._highlightItem.onPointerMoveObserver.add((t=>{this._highlightItem.show()})),this._highlightItem.onPointerLeaveObserver.add((t=>{this._highlightItem.hide()})),this._Item.onPointerEnterObserver.add((t=>{this._Item.cursor=oi.COLUMN_RESIZE})),this._Item.onPointerLeaveObserver.add((t=>{this._Item.resetCursor()})),this._Item.onPointerDownObserver.add((t=>{this.pointerDown(t)}))}}class Eh{constructor(t){this._startOffsetX=0,this._startOffsetY=0,this._index=0,this._currentHeight=0,this._manager=t,this._leftTopHeight=this._manager.getSheetView().getSpreadsheetLeftTopPlaceholder().getState().height;const e=this._manager.getSheetView().getSpreadsheetSkeleton().rowTitleWidth;this._content=new Ja("RowTitleContent",{width:e,height:0,top:0,fill:"rgb(220,220,220,0.5)"}),this._Item=new Ja("RowTitleItem",{width:e,height:5,top:0,fill:"rgb(220,220,220,0.5)"}),this._highlightItem=new Qa("RowTitleGroup",this._content,this._Item),this._highlightItem.hide();this._manager.getScene().addObject(this._highlightItem,3),this._initialize()}pointerDown(t){var e,r;const s=this._manager.getMainComponent(),{offsetX:l,offsetY:n}=t;this._startOffsetX=l,this._startOffsetY=n;const o=s.getAncestorScrollXY(this._startOffsetX,this._startOffsetY),i=this._manager.getPlugin().getSheetContainerControl().getContentRef(),a=t.clientY+o.y-this._leftTopHeight-i.current.getBoundingClientRect().top,g=null!=(r=null==(e=s.getSkeleton())?void 0:e.rowHeightAccumulation)?r:[];for(let c=0;c<(null==g?void 0:g.length);c++)if(g[c]>=a){this._index=c;break}if(this._currentHeight=g[0],this._index&&(this._currentHeight=g[this._index]-g[this._index-1]),g[this._index]-a<=5){const e=g[this._index]+this._leftTopHeight,r=(this._index?g[this._index-1]:0)+this._leftTopHeight;this._manager.getDragLineControl().create({direction:ph.HORIZONTAL,end:e,start:r,dragUp:this.setRowHeight.bind(this)}),this._manager.getDragLineControl().dragDown(t)}this.highlightRow()}setRowHeight(t){const e=this._manager.getPlugin().getContext().getWorkBook().getActiveSheet();null===t?e.setRowHeights(this._index,1,5):e.setRowHeights(this._index,1,t+this._currentHeight),this.highlightRow()}highlightRow(){this._manager.clearSelectionControls();const t=this._manager.getPlugin().getWorkbook().getActiveSheet();this._manager.addControlToCurrentByRangeData({startRow:this._index,startColumn:0,endColumn:t.getColumnCount()-1,endRow:this._index},{row:this._index,column:0})}highlightRowTitle(t){var e,r;const s=this._manager.getMainComponent(),{offsetX:l,offsetY:n}=t;this._startOffsetX=l,this._startOffsetY=n;const o=s.getAncestorScrollXY(this._startOffsetX,this._startOffsetY),i=this._manager.getPlugin().getSheetContainerControl().getContentRef(),a=t.clientY+o.y-this._leftTopHeight-i.current.getBoundingClientRect().top,g=null!=(r=null==(e=s.getSkeleton())?void 0:e.rowHeightAccumulation)?r:[];for(let b=0;b<(null==g?void 0:g.length);b++)if(g[b]>=a){this._index=b;break}this._currentHeight=g[0];let c=this._leftTopHeight;this._index&&(this._currentHeight=g[this._index]-g[this._index-1],c=this._leftTopHeight+g[this._index-1]),this._content.transformByState({height:this._currentHeight-5}),this._Item.transformByState({top:this._currentHeight-5}),this._highlightItem.transformByState({height:this._currentHeight,top:c}),this._highlightItem.show()}_initialize(){this._highlightItem.onPointerEnterObserver.add((t=>{this._highlightItem.show()})),this._highlightItem.onPointerMoveObserver.add((t=>{this._highlightItem.show()})),this._highlightItem.onPointerLeaveObserver.add((t=>{this._highlightItem.hide()})),this._Item.onPointerEnterObserver.add((t=>{this._Item.cursor=oi.ROW_RESIZE})),this._Item.onPointerLeaveObserver.add((t=>{this._Item.resetCursor()})),this._Item.onPointerDownObserver.add((t=>{this.pointerDown(t)}))}}class Yh{constructor(t){this._sheetView=t,this.hasSelection=!1,this._selectionControls=[],this._selectionModels=new Map,this._startOffsetX=0,this._startOffsetY=0,this._plugin=this._sheetView.getPlugin(),this._initialize(),this._initializeObserver()}getSheetView(){return this._sheetView}getScene(){return this._sheetView.getScene()}getContext(){return this._sheetView.getContext()}getMainComponent(){return this._mainComponent}updateToSheet(t){this._worksheet=t;const e=this.getWorksheetId();if(e){this._selectionModels.get(e)||this._selectionModels.set(e,[])}}getCurrentControls(){return this._selectionControls}getCurrentControl(){const t=this.getCurrentControls();if(t&&t.length>0)for(const e of t){if(e.model.currentCell)return e}}getCurrentModels(){const t=this.getWorksheetId();if(!t)return;return this._selectionModels.get(t)||this._selectionModels.set(t,[]),this._selectionModels.get(t)}getCurrentCellModel(){const t=this.getCurrentModels();if(t&&t.length>0)for(const e of t){const t=e.currentCell;if(t)return t}}getCurrentModel(){const t=this.getCurrentModels();if(t&&t.length>0)for(const e of t){if(e.currentCell)return e}}getCurrentModelsValue(){const t=this.getCurrentModels();if(!t)return[];const e=[];for(let r of t)e.push(r.getValue());return e}renderCurrentControls(t=!0,e){const r=this.getWorksheetId();if(r){if(this._selectionControls)for(let t of this._selectionControls)t.dispose();const s=e||this._selectionModels.get(r);this._selectionControls=[],null==s||s.forEach((t=>{const e=t.currentCell,r=this._mainComponent,s=dh.create(this,this._selectionControls.length);let l=null;e&&(l=r.getCellByIndex(e.row,e.column));const{startRow:n,startColumn:o,endRow:i,endColumn:a}=t,g=r.getNoMergeCellPositionByIndex(n,o),c=r.getNoMergeCellPositionByIndex(i,a);s.update({startColumn:o,startRow:n,endColumn:a,endRow:i,startY:(null==g?void 0:g.startY)||0,endY:(null==c?void 0:c.endY)||0,startX:(null==g?void 0:g.startX)||0,endX:(null==c?void 0:c.endX)||0},l),this._selectionControls.push(s)})),t&&this.setSelectionModel()}}getPlugin(){return this._plugin}getWorksheetId(){var t;return null==(t=this._worksheet)?void 0:t.getSheetId()}addControlToCurrentByRangeData(t,e){const r=this.getCurrentControls();if(!r)return;const s=this._mainComponent,l=dh.create(this,r.length);let n=null;e&&(n=s.getCellByIndex(e.row,e.column));const{startRow:o,startColumn:i,endRow:a,endColumn:g}=t,c=s.getNoMergeCellPositionByIndex(o,i),b=s.getNoMergeCellPositionByIndex(a,g);l.update({startColumn:i,startRow:o,endColumn:g,endRow:a,startY:(null==c?void 0:c.startY)||0,endY:(null==b?void 0:b.endY)||0,startX:(null==c?void 0:c.startX)||0,endX:(null==b?void 0:b.endX)||0},n),r.push(l),this.setSelectionModel()}clearSelectionControls(){let t=this.getCurrentControls();if(t.length>0){for(let e of t)e.dispose();t.length=0}}setSelectionModel(t){if(!this._worksheet)return;t||(t=this._selectionControls.map((t=>t.model.getValue())));const e=this._worksheet.getContext().getWorkBook(),r=e.getCommandManager();let s={sheetId:this._worksheet.getSheetId(),actionName:sh.NAME,selections:t};s=Zs.make(s).removeUndo().getAction();const l=new Us({WorkBookUnit:e},s);r.invoke(l)}updateSelectionModel(t,e,r){const s=this.getWorksheetId();if(!this._worksheet||!s)return;const l=this._selectionModels.get(s),n=[];null==l||l.forEach(((s,l)=>{l===r?n.push({selection:t,cell:e}):n.push(s.getValue())}));const o=this._worksheet.getContext().getWorkBook(),i=o.getCommandManager();let a={sheetId:this._worksheet.getSheetId(),actionName:Jb.SET_SELECTION_VALUE_ACTION,selections:n};a=Zs.make(a).removeUndo().getAction();const g=new Us({WorkBookUnit:o},a);i.invoke(g)}setModels(t){const e=this.getWorksheetId();if(!e)return;const r=t.map((({selection:t,cell:e})=>{const r=new uh(gh.NORMAL,this._plugin);return r.setValue(t,e),r}));this._selectionModels.set(e,r)}move(t){var e,r;const s=this.getCurrentCellModel();if(!s)return;let{startRow:l,startColumn:n,endRow:o,endColumn:i}=s.mergeInfo,{row:a,column:g}=s;const c=(null==(e=this._worksheet)?void 0:e.getRowCount())||1e3,b=(null==(r=this._worksheet)?void 0:r.getColumnCount())||50;switch(t){case Pt.TOP:s.isMerged||s.isMergedMainCell?a=--l:a--,a<0&&(a=0);break;case Pt.BOTTOM:s.isMerged||s.isMergedMainCell?a=++o:a++,a>c&&(a=c);break;case Pt.LEFT:s.isMerged||s.isMergedMainCell?g=--n:g--,g<0&&(g=0);break;case Pt.RIGHT:s.isMerged||s.isMergedMainCell?g=++i:g++,g>b&&(g=b)}const h=Ir(this._mainComponent.getCellByIndex(a,g));if(!h)return;const{startRow:d,endRow:u,startColumn:f,endColumn:v}=h,m=this._mainComponent.getSelectionBounding(d,f,u,v);if(!m)return;const{startRow:p,startColumn:_,endRow:B,endColumn:C}=m;let w={startRow:p,endRow:B,startColumn:_,endColumn:C},T={row:d,column:f};this.clearSelectionControls(),this.addControlToCurrentByRangeData(w,T),this.updatePreviousSelection()}setCurrentCell(t){var e;const{rangeData:r,sheetId:s}=t,{startRow:l,startColumn:n}=r;if(s!==this.getWorksheetId()){const t=null==(e=this._worksheet)?void 0:e.getIndex();if(null==t)return;this._plugin.getWorkbook().activateSheetByIndex(t)}const o=Ir(this._mainComponent.getCellByIndex(l,n));if(!o)return;const{startRow:i,endRow:a,startColumn:g,endColumn:c}=o,b=this._mainComponent.getSelectionBounding(i,g,a,c);if(!b)return;const{startRow:h,startColumn:d,endRow:u,endColumn:f}=b;let v={startRow:h,endRow:u,startColumn:d,endColumn:f},m={row:i,column:g};this.clearSelectionControls(),this.addControlToCurrentByRangeData(v,m),this.updatePreviousSelection()}moving(t,e,r=!1){var s;const l=this._mainComponent,{offsetX:n,offsetY:o,clientX:i,clientY:a}=t,{startRow:g,startColumn:c,endRow:b,endColumn:h}=this._startSelectionRange,d=l.getAncestorScrollXY(this._startOffsetX,this._startOffsetY),u=Ir(l.calculateCellIndexByPosition(n,o,d));if(!u)return!1;const{startRow:f,startColumn:v,endColumn:m,endRow:p}=u,_=Math.min(f,g),B=Math.min(v,c),C=Math.max(p,b),w=Math.max(m,h),T=l.getSelectionBounding(_,B,C,w);if(!T)return!1;const{startRow:y,startColumn:S,endRow:j,endColumn:E}=T,Y=l.getNoMergeCellPositionByIndex(y,S),R=l.getNoMergeCellPositionByIndex(j,E),I={startColumn:S,startRow:y,endColumn:E,endRow:j,startY:(null==Y?void 0:Y.startY)||0,endY:(null==R?void 0:R.endY)||0,startX:(null==Y?void 0:Y.startX)||0,endX:(null==R?void 0:R.endX)||0},{startRow:A,endRow:x,startColumn:O,endColumn:N}=(null==e?void 0:e.model)||Ae,{row:k,column:M}=(null==e?void 0:e.model.currentCell)||xe;if(O===S&&A===y&&N===E&&x===j||(e&&e.update(I),e&&(null==(s=this._plugin.getObserver("onChangeSelectionObserver"))||s.notifyObservers(e))),r)if(this._previousSelection){const{startRow:t,endRow:e,startColumn:r,endColumn:s}=this._previousSelection.selection||Ae,{row:l,column:n}=this._previousSelection.cell||xe;r===S&&t===y&&s===E&&e===j&&l===k&&n===M||this.setSelectionModel()}else this.setSelectionModel()}up(t,e){this.moving(t,e,!0),this.updatePreviousSelection()}updatePreviousSelection(){let t=this.getCurrentControl();if(!t)return;const{startRow:e,endRow:r,startColumn:s,endColumn:l}=t.model,{row:n,column:o}=t.model.currentCell||xe;this._previousSelection={selection:{startRow:e,endRow:r,startColumn:s,endColumn:l},cell:{row:n,column:o}}}getActiveRangeListData(){const t=this.getCurrentModels();if(t&&t.length>0){return null==t?void 0:t.map((t=>({startRow:t.startRow,startColumn:t.startColumn,endRow:t.endRow,endColumn:t.endColumn})))}}getActiveRangeList(){var t;const e=this.getActiveRangeListData();return e&&(null==(t=this._worksheet)?void 0:t.getRangeList(e))}getActiveRangeData(){const t=this.getCurrentModels();if(t&&t.length>0)for(const e of t)if(e.currentCell)return{startRow:e.startRow,startColumn:e.startColumn,endRow:e.endRow,endColumn:e.endColumn}}getActiveRange(){var t;const e=this.getActiveRangeData();return e&&(null==(t=this._worksheet)?void 0:t.getRange(e))}getCurrentCellData(){const t=this.getCurrentModels();if(t&&t.length>0)for(const e of t){const t=e.currentCell;if(t)return{startRow:t.row,startColumn:t.column,endRow:t.row,endColumn:t.column}}}getCurrentCell(){var t;const e=this.getCurrentCellData();return e&&(null==(t=this._worksheet)?void 0:t.getRange(e))}getDragLineControl(){return this._dragLineControl}_initialize(){this._mainComponent=this._sheetView.getSpreadsheet(),this._rowComponent=this._sheetView.getSpreadsheetRowTitle(),this._columnComponent=this._sheetView.getSpreadsheetColumnTitle(),this._leftTopComponent=this._sheetView.getSpreadsheetLeftTopPlaceholder(),this._mainEventInitial(),this._rowEventInitial(),this._columnEventInitial(),this._leftTopEventInitial(),this._worksheet=this.getContext().getWorkBook().getActiveSheet(),this._initModels(),this._dragLineControl=new Sh(this),this._columnTitleControl=new jh(this),this._rowTitleControl=new Eh(this)}_mainEventInitial(){const t=this._mainComponent;t.onPointerDownObserver.add((e=>{var r;const{offsetX:s,offsetY:l}=e;this._startOffsetX=s,this._startOffsetY=l;const n=t.getAncestorScrollXY(this._startOffsetX,this._startOffsetY),o=t.calculateCellIndexByPosition(s,l,n),i=Ir(o);if(!i||!this._worksheet)return!1;const{startRow:a,startColumn:g,endColumn:c,endRow:b,startY:h,endY:d,startX:u,endX:f}=i,v={startColumn:g,startRow:a,endColumn:c,endRow:b,startY:h,endY:d,startX:u,endX:f};this._startSelectionRange=v;let m=this.getCurrentControl(),p=this.getCurrentControls();if(!p)return!1;for(let t of p){if(2===e.button&&t.model.isInclude(v))return void(m=t);if(t.model.isEqual(v)){m=t;break}e.shiftKey||t.clearHighlight()}if(p.length>0&&!e.ctrlKey&&!e.shiftKey){for(let t of p)t.dispose();p.length=0}const _=m&&m.model.currentCell;if(m&&e.shiftKey&&_){const{row:e,column:r}=_,s=t.getNoMergeCellPositionByIndex(e,r),l=t.getNoMergeCellPositionByIndex(b,c),n={startColumn:r,startRow:e,endColumn:v.startColumn,endRow:v.startRow,startY:(null==s?void 0:s.startY)||0,endY:(null==l?void 0:l.endY)||0,startX:(null==s?void 0:s.startX)||0,endX:(null==l?void 0:l.endX)||0};m.update(n,_)}else m=dh.create(this,p.length),m.update(v,o),p.push(m);this.hasSelection=!0;const B=this.getScene();B.disableEvent();const C=Ka.create(this.getScene());C.startScroll(s,l),null==(r=this._plugin.getObserver("onChangeSelectionObserver"))||r.notifyObservers(m),this._moveObserver=B.onPointerMoveObserver.add((t=>{this.moving(t,m);const{offsetX:e,offsetY:r}=t;C.scrolling(e,r,(()=>{this.moving(t,m)}))})),this._upObserver=B.onPointerUpObserver.add((t=>{this.up(t,m),B.onPointerMoveObserver.remove(this._moveObserver),B.onPointerUpObserver.remove(this._upObserver),B.enableEvent(),C.stopScroll()}))}))}_rowEventInitial(){this._rowComponent.onPointerEnterObserver.add((t=>{}))}_columnEventInitial(){this._columnComponent.onPointerEnterObserver.add((t=>{}))}_leftTopEventInitial(){this._leftTopComponent.onPointerDownObserver.add((t=>{}))}_initModels(){const t=this._plugin.getConfig().selections;Object.keys(t).forEach((e=>{const r=t[e],s=[];r.forEach((t=>{const{startColumn:e,startRow:r,endColumn:l,endRow:n}=t.selection,o=t.cell,i=new uh(gh.NORMAL,this._plugin),a=o?{row:o.row,column:o.column,isMerged:!1,isMergedMainCell:!1,startY:0,endY:0,startX:0,endX:0,mergeInfo:{startColumn:e,startRow:r,endColumn:l,endRow:n,startY:0,endY:0,startX:0,endX:0}}:null;i.setValue({startColumn:e,startRow:r,endColumn:l,endRow:n,startY:0,endY:0,startX:0,endX:0},a),s.push(i)})),this._selectionModels.set(e,s)}))}_initControls(){const t=this._plugin.getConfig().selections;Object.keys(t).forEach((e=>{const r=t[e],s=[];r.forEach((t=>{const e=t.selection,r=t.cell,l=this._mainComponent,n=dh.create(this,s.length);let o=null;r&&(o=l.getCellByIndex(r.row,r.column));const{startRow:i,startColumn:a,endRow:g,endColumn:c}=e,b=l.getNoMergeCellPositionByIndex(i,a),h=l.getNoMergeCellPositionByIndex(g,c);n.model.setValue({startColumn:a,startRow:i,endColumn:c,endRow:g,startY:(null==b?void 0:b.startY)||0,endY:(null==h?void 0:h.endY)||0,startX:(null==b?void 0:b.startX)||0,endX:(null==h?void 0:h.endX)||0},o),s.push(n)}))}))}_initializeObserver(){var t;this._plugin.getContext().getContextObserver("onAfterChangeActiveSheetObservable").add((()=>{this.renderCurrentControls()})),null==(t=this._worksheet)||t.getContext().getContextObserver("onSheetRenderDidMountObservable").add((()=>{this.renderCurrentControls()}))}}(Ch=Bh||(Bh={})).MAIN="__SpreadsheetRender__",Ch.ROW="__SpreadsheetRowTitle__",Ch.COLUMN="__SpreadsheetColumnTitle__",Ch.LEFT_TOP="__SpreadsheetLeftTopPlaceholder__";class Rh extends Zb{constructor(){super(...arguments),this.viewKey=Vb.SHEET_VIEW}getSelectionManager(){return this._selectionManager}getSelectionControls(){return this._selectionManager.getCurrentControls()}getSpreadsheetSkeleton(){return this._spreadsheetSkeleton}getSpreadsheet(){return this._spreadsheet}getSpreadsheetRowTitle(){return this._spreadsheetRowTitle}getSpreadsheetColumnTitle(){return this._spreadsheetColumnTitle}getSpreadsheetLeftTopPlaceholder(){return this._spreadsheetLeftTopPlaceholder}updateToSheet(t){const e=this.getScene(),r=this._buildSkeleton(t),{rowTotalHeight:s,columnTotalWidth:l,rowTitleWidth:n,columnTitleHeight:o}=r;this._spreadsheetSkeleton=r,this._spreadsheet.updateSkeleton(r),this._spreadsheetRowTitle.updateSkeleton(r),this._spreadsheetColumnTitle.updateSkeleton(r),this._spreadsheetLeftTopPlaceholder.transformByState({width:n,height:o}),e.transformByState({width:this._columnWidthByTitle(t)+l,height:this._rowHeightByTitle(t)+s}),this._updateViewport(n,o),this._selectionManager.updateToSheet(t)}_initialize(){const t=this.getScene(),e=this.getContext().getWorkBook();let r=e.getActiveSheet();r||(r=e.getSheets()[0]);const s=this._buildSkeleton(r),{rowTotalHeight:l,columnTotalWidth:n,rowTitleWidth:o,columnTitleHeight:i}=s,a=new kb(Bh.MAIN,s),g=new Mb(Bh.ROW,s),c=new Db(Bh.COLUMN,s),b=new Ja(Bh.LEFT_TOP,{zIndex:2,left:-1,top:-1,width:o,height:i,fill:zi([248,249,250]),stroke:zi([217,217,217]),strokeWidth:1});this._spreadsheetSkeleton=s,this._spreadsheet=a,this._spreadsheetRowTitle=g,this._spreadsheetColumnTitle=c,this._spreadsheetLeftTopPlaceholder=b,t.addObjects([a],0),t.addObjects([g,c,b],2),t.transformByState({width:this._columnWidthByTitle(r)+n,height:this._rowHeightByTitle(r)+l}),this._updateViewport(o,i),this._selectionManager=new Yh(this)}_updateViewport(t,e){const r=this.getScene(),s=t*r.scaleX,l=e*r.scaleY,n=r.getViewport(Vb.VIEW_MAIN),o=r.getViewport(Vb.VIEW_TOP),i=r.getViewport(Vb.VIEW_LEFT),a=r.getViewport(Vb.VIEW_LEFT_TOP);null==n||n.resize({left:s,top:l}),null==o||o.resize({left:s,height:l}),null==i||i.resize({top:l,width:s}),null==a||a.resize({width:s,height:l})}_buildSkeleton(t){const e=this.getContext(),r=e.getWorkBook(),s=t.getConfig();return Lb.create(s,t.getCellMatrix(),r.getStyles(),e)}_rowHeightByTitle(t){const e=null==t?void 0:t.getConfig();return(null==e?void 0:e.columnTitle.height)||0}_columnWidthByTitle(t){const e=null==t?void 0:t.getConfig();return(null==e?void 0:e.rowTitle.width)||0}}$b.add(new class{create(t,e){return(new Rh).initialize(t,e)}}),function(t){t.MAIN="__SpreadsheetRender__Test",t.ROW="__SpreadsheetRowTitle__Test",t.COLUMN="__SpreadsheetColumnTitle__Test",t.LEFT_TOP="__SpreadsheetLeftTopPlaceholder__Test"}(wh||(wh={})),function(t){t.MAIN_SCENE="mainScene_Test",t.VIEW_MAIN="viewMain_Test",t.VIEW_TOP="viewTop_Test",t.VIEW_LEFT="viewLeft_Test",t.VIEW_LEFT_TOP="viewLeftTop_Test",t.SHEET_VIEW="sheetView_Test",t.DRAG_LINE_VIEW="dragLineView_Test"}(Th||(Th={})),st.COLUMN,nt.PARAGRAPH,F.WRAP_SQUARE,_e.FALSE,P.BOTH_SIDES,S.START,S.START,S.START,S.START,T.ROMAN,S.START,T.ROMAN,S.START,T.ROMAN,E.PARAGRAPH,D.TEXT_RUN,D.TEXT_RUN,me.SUPERSCRIPT,D.TEXT_RUN,D.TEXT_RUN,D.DRAWING,D.TEXT_RUN,D.TEXT_RUN,E.PARAGRAPH,D.TEXT_RUN,D.TEXT_RUN,D.TEXT_RUN,D.TEXT_RUN,E.PARAGRAPH,D.TEXT_RUN,D.TEXT_RUN,D.TEXT_RUN,D.TEXT_RUN,E.PARAGRAPH,D.TEXT_RUN,D.TEXT_RUN,D.TEXT_RUN,D.TEXT_RUN,E.PARAGRAPH,D.TEXT_RUN,D.TEXT_RUN,D.TEXT_RUN,D.TEXT_RUN;class Ih{constructor(t,e){this._engine=t,this._plugin=e,this._views=[],this._initialize()}getView(t){for(let e of this._views)if(e.viewKey===t)return e}getSheetView(){return this.getView(Vb.SHEET_VIEW)}updateToSheet(t){for(let e of this._views)e.updateToSheet(t)}_initialize(){const t=this._engine,e=this._plugin.getContext(),r=this._plugin.getWorkbook();let s=r.getActiveSheet();s||(s=r.getSheets()[0]);const l=s.getConfig(),n=l.rowTitle,o=l.columnTitle,i=new cb(Vb.MAIN_SCENE,t,{width:1500,height:1e3});i.openTransformer(),this._scene=i;const a=new hb(Vb.VIEW_MAIN,i,{left:n.width,top:o.height,bottom:0,right:0,isWheelPreventDefaultX:!0}),g=new hb(Vb.VIEW_TOP,i,{left:n.width,top:0,height:o.height,right:0,isWheelPreventDefaultX:!0}),c=new hb(Vb.VIEW_LEFT,i,{left:0,top:o.height,bottom:0,width:n.width,isWheelPreventDefaultX:!0}),b=new hb(Vb.VIEW_LEFT_TOP,i,{left:0,top:0,width:n.width,height:o.height,isWheelPreventDefaultX:!0});a.onScrollAfterObserver.add((t=>{const{scrollX:e,scrollY:r,actualScrollX:s,actualScrollY:l}=t;g.updateScroll({scrollX:e,actualScrollX:s}).makeDirty(!0),c.updateScroll({scrollY:r,actualScrollY:l}).makeDirty(!0)})),e.getContextObserver("onZoomRatioSheetObservable").add((t=>{this._plugin,this._scene.scale(t.zoomRatio,t.zoomRatio)})),i.addViewport(a,c,g,b).attachControl(),i.on($o.wheel,((t,r)=>{const s=t;if(s.ctrlKey){const t=Math.abs(s.deltaX);let r=t<40?.2:t<80?.4:.2;if(r*=s.deltaY>0?-1:1,i.scaleX<1&&(r/=2),i.scaleX+r>4)i.scale(4,4);else if(i.scaleX+r<.1)i.scale(.1,.1);else{const t=e.getWorkBook().getActiveSheet(),r=s.deltaY>0?.1:-.1;t.setZoomRatio(t.getZoomRatio()+r),s.preventDefault()}}else a.onMouseWheel(s,r)})),new sg(a),i.addLayer(Va.create(i,[],0),Va.create(i,[],2)),this._viewLoader(i,this._plugin),t.runRenderLoop((()=>{i.render();const e=document.getElementById("app");e&&(e.innerText=`fps:${Math.round(t.getFps()).toString()}`)}))}_viewLoader(t,e){$b.getData().forEach((r=>{this._views.push(r.create(t,e))}))}}(yh||(yh={})).AntLine="__AntLineShape__";class Ah{constructor(t){this._plugin=t}setCurrentEditRangeData(){const t=this._plugin.getSelectionManager().getCurrentCellModel();if(!t)return;let e,r;if(t.isMerged){const s=t.mergeInfo;e=s.startRow,r=s.startColumn}else e=t.row,r=t.column;this.currentEditRangeData={startRow:e,startColumn:r,endRow:e,endColumn:r}}getCurrentEditRangeData(){return this.currentEditRangeData}setCurrentEditRangeValue(t){const{startRow:e,startColumn:r,endRow:s,endColumn:l}=this.currentEditRangeData;this._plugin.getContext().getWorkBook().getActiveSheet().getRange(e,r,s,l).setRangeData(t)}getSelectionValue(){const t=this._plugin.getSelectionManager().getActiveRange();if(!t)return"";const e=t&&t.getDisplayValue();return"string"==typeof e?e:"object"==typeof e&&null!==e?Or(e):""}getSelectionStyle(){var t;return null==(t=this._plugin.getSelectionManager().getActiveRange())?void 0:t.getTextStyle()}setSelectionValue(t){const e=this._plugin.getSelectionManager().getActiveRange();e&&("string"==typeof t&&e.setValue(t),"object"==typeof t&&e.setRangeData({p:t}))}handleBackSpace(){}handleDirection(t){}}class xh{constructor(t){this._plugin=t}getPlugin(){return this._plugin}listenEventManager(){this._getCoreObserver("onUIChangeObservable").add((({name:t,value:e})=>{switch(t){case"changeZoom":{const t=this._plugin.getContext().getWorkBook();t&&t.getActiveSheet().setZoomRatio(e);break}}}))}_getCoreObserver(t){return this._plugin.getGlobalContext().getObserverManager().requiredObserver(t,"core")}}class Oh{constructor(t){this.insertRow=()=>{const t=this._getSelections();if(1===(null==t?void 0:t.length)){const e=this._plugin.getContext().getWorkBook().getActiveSheet();null==e||e.insertRowBefore(t[0].startRow,t[0].endRow-t[0].startRow+1)}},this.deleteRow=()=>{const t=this._getSelections();if(1===(null==t?void 0:t.length)){const e=this._plugin.getContext().getWorkBook().getActiveSheet();null==e||e.deleteRows(t[0].startRow,t[0].endRow-t[0].startRow+1)}},this.insertColumn=()=>{const t=this._getSelections();if(1===(null==t?void 0:t.length)){this._plugin.getContext().getWorkBook().getActiveSheet().insertColumnBefore(t[0].startColumn,t[0].endColumn-t[0].startColumn+1)}},this.deleteColumn=()=>{const t=this._getSelections();if(1===(null==t?void 0:t.length)){this._plugin.getContext().getWorkBook().getActiveSheet().deleteColumns(t[0].startColumn,t[0].endColumn-t[0].startColumn+1)}},this.clearContent=()=>{const t=this._getSelections();if(1===(null==t?void 0:t.length)){this._plugin.getContext().getWorkBook().getActiveSheet().getRange(t[0]).clear()}},this.deleteCellLeft=()=>{const t=this._getSelections();if(1===(null==t?void 0:t.length)){this._plugin.getContext().getWorkBook().getActiveSheet().getRange(t[0]).deleteCells(0)}},this.deleteCellTop=()=>{const t=this._getSelections();if(1===(null==t?void 0:t.length)){this._plugin.getContext().getWorkBook().getActiveSheet().getRange(t[0]).deleteCells(1)}},this._plugin=t}listenEventManager(){this._plugin.getContext().getUniver().getGlobalContext().getObserverManager().requiredObserver("onUIChangeObservable","core").add((t=>{switch(t.name){case"insertRow":this.insertRow();break;case"insertColumn":this.insertColumn();break;case"deleteRow":this.deleteRow();break;case"deleteColumn":this.deleteColumn();break;case"moveTop":this.deleteCellTop();break;case"moveLeft":this.deleteCellLeft();break;case"clearContent":this.clearContent();break;case"setRowHeight":this.setRowHeight(t.value);break;case"setColumnWidth":this.setColumnWidth(t.value)}}))}setColumnWidth(t){const e=this._getSelections();if(1===(null==e?void 0:e.length)){this._plugin.getContext().getWorkBook().getActiveSheet().setColumnWidth(e[0].startColumn,e[0].endColumn-e[0].startColumn+1,Number(t))}}setRowHeight(t){const e=this._getSelections();if(1===(null==e?void 0:e.length)){this._plugin.getContext().getWorkBook().getActiveSheet().setRowHeights(e[0].startRow,e[0].endRow-e[0].startRow+1,Number(t))}}_getSelections(){var t;const e=null==(t=this._plugin)?void 0:t.getSelectionManager().getCurrentControls();return null==e?void 0:e.map((t=>{const e=t.model;return{startRow:e.startRow,startColumn:e.startColumn,endRow:e.endRow,endColumn:e.endColumn}}))}}class Nh{constructor(t){this._plugin=t}listenEventManager(){this._getCoreObserver("onUIChangeObservable").add((({name:t,value:e})=>{switch(t){case"deleteSheet":{const t=this._plugin.getContext().getWorkBook();t&&t.removeSheetBySheetId(e);break}case"copySheet":{const t=this._plugin.getContext().getWorkBook(),e=t.getActiveSheet(),r=this._plugin.getContext().getGenName(),s=this._plugin.getGlobalContext().getLocale(),l=e.copy(r.onlyName(`${e.getName()} ${s.get("BaseSheetLocale.CopyName")}`));t&&t.insertSheet(t.getActiveSheetIndex()+1,l.getConfig());break}case"renameSheet":{const{sheetId:t,sheetName:r}=e,s=this._plugin.getContext().getUniver().getCurrentUniverSheetInstance().getWorkBook().getSheetBySheetId(t);s&&r!==s.getName()&&s.setName(r);break}case"addSheet":{const t=this._plugin.getContext().getWorkBook();t.insertSheet();const e=t.getSheetSize(),r=t.getSheets()[e-1];r&&r.activate();break}case"unHideSheet":{const t=this._plugin.getContext().getWorkBook().getSheetBySheetId(e);t&&t.showSheet();break}case"hideSheet":{const t=this._plugin.getContext().getWorkBook().getSheetBySheetId(e);t&&t.hideSheet();break}case"changeSheetColor":{const{color:t,sheetId:r}=e,s=this._plugin.getContext().getWorkBook().getSheetBySheetId(r);s&&s.setTabColor(t);break}}}))}_getCoreObserver(t){return this._plugin.getGlobalContext().getObserverManager().requiredObserver(t,"core")}}class kh{constructor(t){this._plugin=t,this._initialize()}_initialize(){Hs.getCommandObservers().add((({actions:t})=>{const e=this._plugin;if(!e)return;if(!t||0===t.length)return;const r=t[0],s=e.context.getWorkBook().getUnitId();try{r.getWorkBook()}catch(n){return}if(s!==r.getWorkBook().getUnitId())return;const l=r.getWorkBook().getActiveSheet();if(l)try{const t=e.getCanvasView();t&&(t.updateToSheet(l),e.getMainComponent().makeDirty(!0),e.getSelectionManager().renderCurrentControls(!1))}catch(n){console.info(n)}}))}}class Mh{constructor(t){this._plugin=t,this._initialize()}listenEventManager(){this._plugin.getContext().getUniver().getGlobalContext().getObserverManager().requiredObserver("onUIChangeObservable","core").add((t=>{switch(t.name){case"undo":this.setUndo();break;case"redo":this.setRedo()}})),this._plugin.getContext().getUniver().getGlobalContext().getObserverManager().requiredObserver("onUIChangeObservable","core").add((t=>{switch(t.name){case"fontSize":this.setFontSize(t.value);break;case"textRotation":this.setTextRotation(t.value);break;case"wrapStrategy":this.setWrapStrategy(t.value);break;case"verticalAlignment":this.setVerticalAlignment(t.value);break;case"horizontalAlignment":this.setHorizontalAlignment(t.value)}})),this._plugin.getContext().getUniver().getGlobalContext().getObserverManager().requiredObserver("onUIChangeObservable","core").add((t=>{switch(t.name){case"borderInfo":this.setBorder(t.value)}})),this._plugin.getContext().getUniver().getGlobalContext().getObserverManager().requiredObserver("onUIChangeObservable","core").add((t=>{switch(t.name){case"fontFamily":this.setFontFamily(t.value);break;case"fontColor":this.setFontColor(t.value);break;case"background":this.setBackground(t.value);break;case"merge":this.setMerge(t.value)}})),this._plugin.getContext().getUniver().getGlobalContext().getObserverManager().requiredObserver("onUIChangeObservable","core").add((t=>{switch(t.name){case"fontWeight":this.setFontWeight(t.value);break;case"fontStyle":this.setFontStyle(t.value);break;case"strikeThrough":this.setStrikeThrough(t.value);break;case"underLine":this.setUnderline(t.value)}}))}_initialize(){}setRedo(){this._plugin.getContext().getCommandManager().redo()}setUndo(){this._plugin.getContext().getCommandManager().undo()}setFontColor(t){var e;null==(e=this._plugin.getSelectionManager().getActiveRangeList())||e.setFontColor(t)}setBackground(t){var e;null==(e=this._plugin.getSelectionManager().getActiveRangeList())||e.setBackground(t)}setFontSize(t){var e;null==(e=this._plugin.getSelectionManager().getActiveRangeList())||e.setFontSize(t)}setFontFamily(t){var e;null==(e=this._plugin.getSelectionManager().getActiveRangeList())||e.setFontFamily(t)}setFontWeight(t){var e;null==(e=this._plugin.getSelectionManager().getActiveRangeList())||e.setFontWeight(t)}setFontStyle(t){var e;null==(e=this._plugin.getSelectionManager().getActiveRangeList())||e.setFontStyle(t)}setStrikeThrough(t){var e;null==(e=this._plugin.getSelectionManager().getActiveRangeList())||e.setStrikeThrough(t)}setUnderline(t){var e;null==(e=this._plugin.getSelectionManager().getActiveRangeList())||e.setUnderline(t)}setMerge(t){const e=this._plugin.getSelectionManager().getActiveRange();switch(t){case"all":null==e||e.merge();break;case"vertical":null==e||e.mergeVertically();break;case"horizontal":null==e||e.mergeAcross();break;case"cancel":null==e||e.breakApart()}}setHorizontalAlignment(t){var e;null==(e=this._plugin.getSelectionManager().getActiveRangeList())||e.setHorizontalAlignment(t)}setVerticalAlignment(t){var e;null==(e=this._plugin.getSelectionManager().getActiveRangeList())||e.setVerticalAlignment(t)}setWrapStrategy(t){var e;null==(e=this._plugin.getSelectionManager().getActiveRangeList())||e.setWrapStrategy(t)}setTextRotation(t){var e,r;"v"===t?null==(e=this._plugin.getSelectionManager().getActiveRangeList())||e.setVerticalText(1):null==(r=this._plugin.getSelectionManager().getActiveRangeList())||r.setTextRotation(t)}setBorder(t){const e=this._plugin.getSelectionManager().getCurrentControls();e&&e.length>0&&(null==e||e.forEach((e=>{const r=e.model,s={startRow:r.startRow,startColumn:r.startColumn,endRow:r.endRow,endColumn:r.endColumn};this._plugin.getContext().getWorkBook().getActiveSheet().getRange(s).setBorderByType(t.type,t.color,t.style)})))}}class Dh{constructor(t){this._plugin=t}}class Lh extends Vs{execute(){this.actionDataList.forEach((t=>{if(null!=t.operation&&!Zs.hasExtension(t))return!1;if(t.actionName===mt.INSERT_ROW_ACTION){const{sheetId:e,rowCount:r,rowIndex:s}=t,l=B.deepClone(this._plugin.getWorkbook().getConfig().namedRanges);for(let t=0;tn.endRow)continue;s>=n.startRow&&s<=n.endRow||(n.startRow+=r),n.endRow+=r;const o={actionName:mt.SET_NAMED_RANGE_ACTION,namedRange:l[t],sheetId:e};this.push(o)}}}))}}class Ph extends Gs{get zIndex(){return 3}create(t){return new Lh(t,this._plugin)}}var Hh={BaseSheetLocale:{CopyName:"副本"}},Fh={BaseSheetLocale:{CopyName:"Copy"}};class Uh extends ro{constructor(t){super(Fe.SPREADSHEET),this._config=Object.assign(qb,t)}static create(t){return new Uh(t)}installTo(t){t.installPlugin(this)}initialize(t){this.context=t,this.getGlobalContext().getLocale().load({en:Fh,zh:Hh}),Kb(this),this.initConfig(),this.initController(),this.initCanvasView(),this.registerExtension(),this.listenEventManager()}getConfig(){return this._config}initConfig(){const t=this._config;if(!t.selections){const e=this.getContext().getWorkBook().getActiveSheet().getSheetId();t.selections={[e]:[{selection:Ae}]}}}initController(){this._sheetContainerController=new kh(this),this._cellEditorController=new Ah(this),this._formulaBarController=new Dh(this),this._sheetBarControl=new Nh(this),this._toolbarControl=new Mh(this),this._rightMenuControl=new Oh(this),this._countBarController=new xh(this)}initCanvasView(){const t=this.getGlobalContext().getPluginManager().getRequirePluginByName(Fe.BASE_RENDER).getEngine();this._canvasEngine=t,null==this._canvasView&&(this._canvasView=new Ih(t,this))}onMounted(t){this.initialize(t)}onDestroy(){super.onDestroy(),Qb(this);this.context.getCommandManager().getActionExtensionManager().getRegister().delete(this._namedRangeActionExtensionFactory)}registerExtension(){const t=this.context.getCommandManager().getActionExtensionManager().getRegister();this._namedRangeActionExtensionFactory=new Ph(this),t.add(this._namedRangeActionExtensionFactory)}listenEventManager(){this._countBarController.listenEventManager(),this._sheetBarControl.listenEventManager(),this._toolbarControl.listenEventManager(),this._rightMenuControl.listenEventManager()}getCanvasEngine(){return this._canvasEngine}getCanvasView(){return this._canvasView}getMainScene(){return this._canvasEngine.getScene(Vb.MAIN_SCENE)}getSheetView(){return this.getCanvasView().getSheetView()}getSelectionManager(){var t;return null==(t=this.getSheetView())?void 0:t.getSelectionManager()}getCurrentControls(){var t;return null==(t=this.getSelectionManager())?void 0:t.getCurrentControls()}getSelectionShape(){return this._canvasEngine}getMainComponent(){return this.getSheetView().getSpreadsheet()}getLeftTopComponent(){return this.getSheetView().getSpreadsheetLeftTopPlaceholder()}getRowComponent(){return this.getSheetView().getSpreadsheetRowTitle()}getColumnComponent(){return this.getSheetView().getSpreadsheetColumnTitle()}getSpreadsheetSkeleton(){return this.getSheetView().getSpreadsheetSkeleton()}getWorkbook(){return this.context.getWorkBook()}getRightMenuControl(){return this._rightMenuControl}getToolbarControl(){return this._toolbarControl}getSheetBarControl(){return this._sheetBarControl}getCellEditorController(){return this._cellEditorController}getFormulaBarController(){return this._formulaBarController}getSheetContainerControl(){return this._sheetContainerController}getCountBarController(){return this._countBarController}_getCoreObserver(t){return this.getGlobalContext().getObserverManager().requiredObserver(t,"core")}}var zh=Object.freeze(Object.defineProperty({__proto__:null,SheetPlugin:Uh,AntLine:lh,AntLineModel:nh,SelectionModel:uh,AntLineControl:class{constructor(t){this._plugin=t,this._antLineModelList=[],t.getContext().getContextObserver("onAfterChangeActiveSheetObservable").add((()=>{this._activeSheetId=t.getWorkbook().getActiveSheet().getSheetId(),this._makeUpdateSceneAntLineRect()})),t.getContext().getContextObserver("onSheetRenderDidMountObservable").add((()=>{this._activeSheetId=t.getWorkbook().getActiveSheet().getSheetId(),this._makeUpdateSceneAntLineRect()}))}removeSheetAntLine(t=this._activeSheetId){this._removeAntLineModelBySheetId(t),this._makeUpdateSceneAntLineRect()}addAntLineToSheet(t,e=this._activeSheetId){const r=this._findAntLineModelBySheetId(e,new nh(e));r.addAntLine(new lh(t)),this._saveOrUpdateAntLineModel(r),this._makeUpdateSceneAntLineRect()}getSheetView(){return this._plugin.getCanvasView().getSheetView()}getWorkBook(){return this._plugin.getWorkbook()}getSheetViewScene(){return this._plugin.getCanvasView().getSheetView().getScene()}_removeAntLineModelBySheetId(t){const e=this._antLineModelList.findIndex((e=>e.getSheetId()!==t));e>-1&&this._antLineModelList.splice(e,1)}_findAntLineModelBySheetId(t,e){var r;return null!=(r=this._antLineModelList.find((e=>e.getSheetId()===t)))?r:e}_saveOrUpdateAntLineModel(t){for(let e=0;e